isometrik-plugin-chat-sdk 1.0.1 → 1.0.2

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.
Files changed (38) hide show
  1. package/dist/cjs/{MessageSearch-f5b72462.js → MessageSearch-a73ca677.js} +82 -11
  2. package/dist/cjs/MessageSearch-a73ca677.js.map +1 -0
  3. package/dist/cjs/{WebChat-2329244b.js → WebChat-11c06cb9.js} +428 -37
  4. package/dist/cjs/WebChat-11c06cb9.js.map +1 -0
  5. package/dist/cjs/audio-bubble_8.cjs.entry.js +1 -1
  6. package/dist/cjs/chat-app.cjs.entry.js +2 -2
  7. package/dist/cjs/theme-provider_2.cjs.entry.js +2 -2
  8. package/dist/collection/api/social-accounts.js +77 -9
  9. package/dist/collection/components/my-component/web-chat/WebChat.js +19 -14
  10. package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -1
  11. package/dist/collection/stories/Components/InstagramAccounts/InstagramAccountsPanel.js +412 -22
  12. package/dist/esm/{MessageSearch-4010486c.js → MessageSearch-69b3a0f3.js} +79 -11
  13. package/dist/esm/MessageSearch-69b3a0f3.js.map +1 -0
  14. package/dist/esm/{WebChat-95518d72.js → WebChat-372df148.js} +428 -37
  15. package/dist/esm/WebChat-372df148.js.map +1 -0
  16. package/dist/esm/audio-bubble_8.entry.js +2 -2
  17. package/dist/esm/chat-app.entry.js +2 -2
  18. package/dist/esm/theme-provider_2.entry.js +2 -2
  19. package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
  20. package/dist/isometrik-webchat/{p-d7e335cb.entry.js → p-56fbdbc3.entry.js} +2 -2
  21. package/dist/isometrik-webchat/{p-35f143c9.entry.js → p-8456ee94.entry.js} +2 -2
  22. package/dist/isometrik-webchat/{p-55355714.js → p-9058d82c.js} +17 -17
  23. package/dist/isometrik-webchat/p-9058d82c.js.map +1 -0
  24. package/dist/isometrik-webchat/p-9588b7ec.js +780 -0
  25. package/dist/isometrik-webchat/p-9588b7ec.js.map +1 -0
  26. package/dist/isometrik-webchat/{p-675c105e.entry.js → p-e66e5e61.entry.js} +2 -2
  27. package/package.json +1 -1
  28. package/readme.md +5 -5
  29. package/dist/cjs/MessageSearch-f5b72462.js.map +0 -1
  30. package/dist/cjs/WebChat-2329244b.js.map +0 -1
  31. package/dist/esm/MessageSearch-4010486c.js.map +0 -1
  32. package/dist/esm/WebChat-95518d72.js.map +0 -1
  33. package/dist/isometrik-webchat/p-55355714.js.map +0 -1
  34. package/dist/isometrik-webchat/p-e954c29f.js +0 -591
  35. package/dist/isometrik-webchat/p-e954c29f.js.map +0 -1
  36. /package/dist/isometrik-webchat/{p-d7e335cb.entry.js.map → p-56fbdbc3.entry.js.map} +0 -0
  37. /package/dist/isometrik-webchat/{p-35f143c9.entry.js.map → p-8456ee94.entry.js.map} +0 -0
  38. /package/dist/isometrik-webchat/{p-675c105e.entry.js.map → p-e66e5e61.entry.js.map} +0 -0
@@ -0,0 +1,780 @@
1
+ import{r as i,a as t,h as e,F as s}from"./p-f1f5d5bd.js";import{h as o,i as n,k as a,M as r}from"./p-48e1d174.js";import{C as l,M as d}from"./p-70f4360e.js";import{a as c,b as h,c as u}from"./p-40517d7f.js";import{r as v,g as p}from"./p-1415e589.js";import{s as g}from"./p-92d0b21c.js";import{g as f,a as m,c as b,b as y,o as x,d as w,i as k,s as I,e as C,f as M,h as j,j as A,n as D,p as O,k as $,l as S}from"./p-9058d82c.js";import{W as z}from"./p-610bfd8a.js";import{g as T,a as L,b as U,r as N,d as E}from"./p-229095d4.js";class B extends o{static properties={userMetaData:{type:Object},openAccounts:{type:Function},openChat:{type:Function},activeTab:{type:String},isMqttConnected:{type:Boolean},unreadConversationsCount:{type:Number}};constructor(){super();this.userMetaData={};this.activeTab="Chat"}static styles=n`
2
+ :host {
3
+ display: block;
4
+ width: 68px;
5
+ min-width: 68px;
6
+ height: 100%;
7
+ flex-shrink: 0;
8
+ }
9
+
10
+ .profile-tab {
11
+ box-sizing: border-box;
12
+ min-width: 68px;
13
+ width: 68px;
14
+ transition: background-color var(--duration, 180ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: space-between;
18
+ flex-direction: column;
19
+ height: 100%;
20
+ background-color: var(--sidebar-bg, #000000);
21
+ border-right: 1px solid var(--sidebar-border, #333333);
22
+ color: var(--sidebar-foreground, #ffffff);
23
+ padding: 16px 0 18px;
24
+ }
25
+ .chat-button {
26
+ width: 40px;
27
+ height: 40px;
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ cursor: pointer;
32
+ position: relative;
33
+ border-radius: var(--radius-md, 12px);
34
+ color: var(--sidebar-foreground-secondary, #ffffff);
35
+ transition: background-color var(--duration, 180ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)), transform 120ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
36
+ }
37
+ .chat-button:hover {
38
+ background-color: var(--sidebar-accent, color-mix(in srgb, #ffffff 10%, transparent));
39
+ }
40
+ .chat-button:active {
41
+ transform: scale(0.96);
42
+ }
43
+ .active-Chat {
44
+ background-color: var(--sidebar-accent, color-mix(in srgb, #ffffff 10%, transparent));
45
+ border-radius: var(--radius-md, 12px);
46
+ margin-top: 0;
47
+ }
48
+ .mqtt-indicator {
49
+ position: absolute;
50
+ right: 5px;
51
+ bottom: 7px;
52
+ width: 7px;
53
+ height: 7px;
54
+ border-radius: 50%;
55
+ filter: blur(0.3px);
56
+ }
57
+ .mqtt-indicator.connected {
58
+ background-color: var(--success, #0070f3);
59
+ }
60
+ .mqtt-indicator.disconnected {
61
+ background-color: var(--destructive, #ff0000);
62
+ }
63
+ .accounts-icon {
64
+ width: 22px;
65
+ height: 22px;
66
+ color: currentColor;
67
+ }
68
+ .top-buttons,
69
+ .bottom-buttons {
70
+ display: flex;
71
+ align-items: center;
72
+ justify-content: center;
73
+ flex-direction: column;
74
+ gap: 10px;
75
+ padding: 10px 0;
76
+ }
77
+ .unread-count {
78
+ position: absolute;
79
+ right: -2px;
80
+ top: -2px;
81
+ min-width: 16px;
82
+ height: 16px;
83
+ padding: 0 4px;
84
+ border-radius: var(--radius-pill, 999px);
85
+ background: var(--success, #0070f3);
86
+ display: flex;
87
+ align-items: center;
88
+ justify-content: center;
89
+ font-size: 10px;
90
+ font-weight: 600;
91
+ color: #ffffff;
92
+ }
93
+ @media (max-width: 768px) {
94
+ .profile-tab {
95
+ display: none;
96
+ }
97
+ }
98
+ `;renderChatIcon(i){return a`
99
+ <svg width="22" height="22" viewBox="0 0 24 24" fill="${i?"currentColor":"none"}" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
100
+ <path d="M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"></path>
101
+ </svg>
102
+ `}renderAccountsIcon(){return a`
103
+ <svg class="accounts-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
104
+ <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
105
+ <circle cx="9" cy="7" r="4"></circle>
106
+ <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
107
+ <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
108
+ </svg>
109
+ `}render(){return a`
110
+ <div class="profile-tab">
111
+ <div class="top-buttons">
112
+ <div class="${this.activeTab==="Chat"?"active-Chat":""} chat-button" title="Chat" @click="${this.openChat}">
113
+ ${this.renderChatIcon(this.activeTab==="Chat")}
114
+ ${this.unreadConversationsCount>0?a`<div class="unread-count">${this.unreadConversationsCount}</div>`:""}
115
+ </div>
116
+ </div>
117
+
118
+ <div class="bottom-buttons">
119
+ <div
120
+ class="${this.activeTab==="Accounts"?"active-Chat":""} chat-button"
121
+ title="Accounts"
122
+ @click="${this.openAccounts}"
123
+ >
124
+ ${this.renderAccountsIcon()}
125
+ ${this.isMqttConnected?a`<div class="mqtt-indicator connected"></div>`:a`<div class="mqtt-indicator disconnected"></div>`}
126
+ </div>
127
+ </div>
128
+ </div>
129
+ `}}customElements.define("profile-sidebar",B);class F extends o{static properties={agentUserId:{type:String},defaultTheme:{type:String},toggleTheme:{type:Function},closeDrawer:{type:Function},accountsChange:{type:Function},hideClose:{type:Boolean},socialAccounts:{type:Array},linkedInAccounts:{type:Array},isSocialLoading:{type:Boolean},isLinkedInLoading:{type:Boolean},linkedInUsername:{type:String},linkedInPassword:{type:String},linkedInCode:{type:String},linkedInCheckpointAccountId:{type:String}};constructor(){super();this.agentUserId="";this.defaultTheme="light";this.toggleTheme=()=>{};this.closeDrawer=()=>{};this.accountsChange=null;this.hideClose=false;this.socialAccounts=[];this.linkedInAccounts=[];this.isSocialLoading=false;this.isLinkedInLoading=false;this.linkedInUsername="";this.linkedInPassword="";this.linkedInCode="";this.linkedInCheckpointAccountId=""}get connectedAccounts(){return f(this.socialAccounts)}get connectedLinkedInAccounts(){return f(this.linkedInAccounts)}get resolvedAgentUserId(){return this.agentUserId||l.isometrikUserId||""}connectedCallback(){super.connectedCallback();this.loadSocialAccounts();this.loadLinkedInAccounts()}notifyAccountsChange(i=this.socialAccounts){const t=i||[];this.dispatchEvent(new CustomEvent("instagramAccountsChange",{detail:t,bubbles:true,composed:true}));if(typeof this.accountsChange==="function"){this.accountsChange(t)}}async loadSocialAccounts(){this.isSocialLoading=true;try{const i=await m({platform:"instagram"});this.socialAccounts=i?.accounts||[];this.notifyAccountsChange(this.socialAccounts)}catch(i){console.error("Failed to load social accounts:",i);this.socialAccounts=[];this.notifyAccountsChange([])}finally{this.isSocialLoading=false}}async loadLinkedInAccounts({notify:i=false}={}){this.isLinkedInLoading=true;try{const t=await m({platform:"linkedin"});this.linkedInAccounts=t?.accounts||[];if(i)this.notifyAccountsChange()}catch(t){console.error("Failed to load LinkedIn accounts:",t);this.linkedInAccounts=[];if(i)this.notifyAccountsChange()}finally{this.isLinkedInLoading=false}}formatSocialDate(i){if(!i)return"-";try{return new Date(i).toLocaleDateString(undefined,{day:"numeric",month:"short",year:"numeric"})}catch{return String(i)}}async completeSocialCallback(i){await b({platform:i.platform||"instagram",username:i.username||"",displayName:i.displayName||"",loginMethod:"instagram_login"});await this.loadSocialAccounts();g({message:"Instagram connected",type:"success",position:"bottom-right"})}async handleConnectInstagram(){this.isSocialLoading=true;try{const i=await y({platform:"instagram",redirectUrl:C(),loginMethod:"instagram_login"});if(!i?.authUrl)throw new Error("No auth URL returned");const t=await x(i.authUrl);if(t?.redirected)return;if(t?.cancelled){await this.loadSocialAccounts();return}await this.completeSocialCallback(t||{})}catch(i){console.error("Failed to connect Instagram:",i);g({message:i?.message||"Failed to connect Instagram",type:"error",position:"bottom-right"})}finally{this.isSocialLoading=false}}handleDisconnectInstagram(i,t){c.openDialog("confirm-dialog",{title:"Disconnect Instagram",description:`Disconnect @${t||"this account"}?`,handleConfirm:async()=>{c.closeDialog("confirm-dialog");this.isSocialLoading=true;try{await w({accountId:i});await this.loadSocialAccounts();g({message:"Instagram disconnected",type:"success",position:"bottom-right"})}catch(i){console.error("Failed to disconnect Instagram:",i);g({message:i?.message||"Failed to disconnect Instagram",type:"error",position:"bottom-right"})}finally{this.isSocialLoading=false}}})}resetLinkedInForm(){this.linkedInUsername="";this.linkedInPassword="";this.linkedInCode="";this.linkedInCheckpointAccountId=""}async handleConnectLinkedIn(i){i?.preventDefault?.();const t=(this.linkedInUsername||"").trim();const e=this.linkedInPassword||"";if(!t||!e){g({message:"Enter LinkedIn email and password",type:"error",position:"bottom-right"});return}this.isLinkedInLoading=true;try{const i=await y({platform:"linkedin",username:t,password:e,agentUserId:this.resolvedAgentUserId});const s=M(i);const o=k(i)||Boolean(s)&&String(i?.status||"").toLowerCase()!=="connected";if(o){if(!s)throw new Error("No accountId returned for LinkedIn checkpoint");this.linkedInCheckpointAccountId=s;this.linkedInPassword="";g({message:"Enter the verification code from LinkedIn",type:"success",position:"bottom-right"});return}this.resetLinkedInForm();await this.loadLinkedInAccounts({notify:true});g({message:"LinkedIn connected",type:"success",position:"bottom-right"})}catch(i){console.error("Failed to connect LinkedIn:",i);g({message:i?.message||"Failed to connect LinkedIn",type:"error",position:"bottom-right"})}finally{this.isLinkedInLoading=false}}async handleLinkedInCheckpoint(i){i?.preventDefault?.();const t=(this.linkedInCode||"").trim();if(!this.linkedInCheckpointAccountId||!t){g({message:"Enter the LinkedIn verification code",type:"error",position:"bottom-right"});return}this.isLinkedInLoading=true;try{await I({platform:"linkedin",accountId:this.linkedInCheckpointAccountId,code:t,agentUserId:this.resolvedAgentUserId});this.resetLinkedInForm();await this.loadLinkedInAccounts({notify:true});g({message:"LinkedIn connected",type:"success",position:"bottom-right"})}catch(i){console.error("Failed LinkedIn checkpoint:",i);g({message:i?.message||"Failed to verify LinkedIn code",type:"error",position:"bottom-right"})}finally{this.isLinkedInLoading=false}}handleDisconnectLinkedIn(i,t){c.openDialog("confirm-dialog",{title:"Disconnect LinkedIn",description:`Disconnect ${t||"this LinkedIn account"}?`,handleConfirm:async()=>{c.closeDialog("confirm-dialog");this.isLinkedInLoading=true;try{await w({accountId:i});await this.loadLinkedInAccounts({notify:true});g({message:"LinkedIn disconnected",type:"success",position:"bottom-right"})}catch(i){console.error("Failed to disconnect LinkedIn:",i);g({message:i?.message||"Failed to disconnect LinkedIn",type:"error",position:"bottom-right"})}finally{this.isLinkedInLoading=false}}})}renderSocialAccount(i){const t=i.displayName||i.username||"Instagram";const e=i.username?`@${i.username}`:"";const s=i.status==="connected";const o=`igGrad-${i.zernioAccountId||i.accountId||i.username||"acc"}`;const n=i.zernioAccountId||i.accountId;return a`
130
+ <article class="ig-card">
131
+ <div class="ig-card-top">
132
+ <div class="ig-mark" aria-hidden="true">
133
+ <svg viewBox="0 0 24 24" width="22" height="22" fill="none">
134
+ <defs>
135
+ <linearGradient id=${o} x1="0%" y1="100%" x2="100%" y2="0%">
136
+ <stop offset="0%" stop-color="#f58529" />
137
+ <stop offset="50%" stop-color="#dd2a7b" />
138
+ <stop offset="100%" stop-color="#8134af" />
139
+ </linearGradient>
140
+ </defs>
141
+ <rect x="2" y="2" width="20" height="20" rx="5.5" stroke="url(#${o})" stroke-width="1.75" />
142
+ <circle cx="12" cy="12" r="4.25" stroke="url(#${o})" stroke-width="1.75" />
143
+ <circle cx="17.35" cy="6.65" r="1.15" fill="url(#${o})" />
144
+ </svg>
145
+ </div>
146
+ <div class="ig-identity">
147
+ <div class="ig-name-row">
148
+ <h3 class="ig-name">${t}</h3>
149
+ ${s?a`<span class="ig-badge">Connected</span>`:a`<span class="ig-badge is-muted">${i.status||"Unknown"}</span>`}
150
+ </div>
151
+ ${e?a`<p class="ig-handle">${e}</p>`:null}
152
+ <p class="ig-connected-on">Connected ${this.formatSocialDate(i.connectedAt)}</p>
153
+ </div>
154
+ </div>
155
+ <div class="ig-actions">
156
+ ${i.profileUrl?a`<a class="ig-link" href=${i.profileUrl} target="_blank" rel="noopener noreferrer">View profile</a>`:a`<span></span>`}
157
+ <button
158
+ type="button"
159
+ class="ig-disconnect"
160
+ @click=${()=>this.handleDisconnectInstagram(n,i.username)}
161
+ >
162
+ Disconnect
163
+ </button>
164
+ </div>
165
+ </article>
166
+ `}renderLinkedInAccount(i){const t=i.displayName||i.username||"LinkedIn";const e=i.handle||(i.username?i.username:"");const s=i.status==="connected";const o=i.accountId||i.unipileAccountId||i.zernioAccountId;return a`
167
+ <article class="ig-card li-card">
168
+ <div class="ig-card-top">
169
+ <div class="li-mark" aria-hidden="true">
170
+ <svg viewBox="0 0 24 24" width="22" height="22" fill="#0a66c2">
171
+ <path d="M20.45 20.45h-3.55v-5.57c0-1.33-.02-3.04-1.85-3.04-1.85 0-2.14 1.45-2.14 2.94v5.67H9.36V9h3.41v1.56h.05c.47-.9 1.64-1.85 3.37-1.85 3.6 0 4.27 2.37 4.27 5.46v6.28zM5.34 7.43a2.06 2.06 0 1 1 0-4.12 2.06 2.06 0 0 1 0 4.12zM7.12 20.45H3.56V9h3.56v11.45zM22.23 0H1.77C.79 0 0 .77 0 1.73v20.54C0 23.23.79 24 1.77 24h20.46c.98 0 1.77-.77 1.77-1.73V1.73C24 .77 23.21 0 22.23 0z" />
172
+ </svg>
173
+ </div>
174
+ <div class="ig-identity">
175
+ <div class="ig-name-row">
176
+ <h3 class="ig-name">${t}</h3>
177
+ ${s?a`<span class="ig-badge">Connected</span>`:a`<span class="ig-badge is-muted">${i.status||"Unknown"}</span>`}
178
+ </div>
179
+ ${e?a`<p class="ig-handle">${e}</p>`:null}
180
+ <p class="ig-connected-on">Connected ${this.formatSocialDate(i.connectedAt)}</p>
181
+ </div>
182
+ </div>
183
+ <div class="ig-actions">
184
+ ${i.profileUrl?a`<a class="ig-link" href=${i.profileUrl} target="_blank" rel="noopener noreferrer">View profile</a>`:a`<span></span>`}
185
+ <button
186
+ type="button"
187
+ class="ig-disconnect"
188
+ @click=${()=>this.handleDisconnectLinkedIn(o,i.username||i.handle)}
189
+ >
190
+ Disconnect
191
+ </button>
192
+ </div>
193
+ </article>
194
+ `}renderConnectInstagram(){return a`
195
+ <div class="ig-empty">
196
+ <p class="ig-empty-title">Connect a social account to see chats</p>
197
+ <p class="ig-empty-copy">
198
+ Link Instagram or LinkedIn. Chats stay hidden until at least one account is connected.
199
+ </p>
200
+ <button type="button" class="ig-connect" @click=${()=>this.handleConnectInstagram()} ?disabled=${this.isSocialLoading}>
201
+ <span class="ig-mark" aria-hidden="true">
202
+ <svg viewBox="0 0 24 24" width="22" height="22" fill="none">
203
+ <defs>
204
+ <linearGradient id="igGradEmpty" x1="0%" y1="100%" x2="100%" y2="0%">
205
+ <stop offset="0%" stop-color="#f58529" />
206
+ <stop offset="50%" stop-color="#dd2a7b" />
207
+ <stop offset="100%" stop-color="#8134af" />
208
+ </linearGradient>
209
+ </defs>
210
+ <rect x="2" y="2" width="20" height="20" rx="5.5" stroke="url(#igGradEmpty)" stroke-width="1.75" />
211
+ <circle cx="12" cy="12" r="4.25" stroke="url(#igGradEmpty)" stroke-width="1.75" />
212
+ <circle cx="17.35" cy="6.65" r="1.15" fill="url(#igGradEmpty)" />
213
+ </svg>
214
+ </span>
215
+ <span class="ig-connect-copy">
216
+ <span class="ig-connect-title">${this.isSocialLoading?"Connecting…":"Connect Instagram"}</span>
217
+ <span class="ig-connect-sub">Link your business account to manage DMs here</span>
218
+ </span>
219
+ </button>
220
+ </div>
221
+ `}renderLinkedInForm(){if(this.linkedInCheckpointAccountId){return a`
222
+ <form class="li-form" @submit=${i=>this.handleLinkedInCheckpoint(i)}>
223
+ <p class="ig-empty-copy">Enter the verification code LinkedIn sent you.</p>
224
+ <label class="li-label">
225
+ <span>Verification code</span>
226
+ <input
227
+ class="li-input"
228
+ type="text"
229
+ inputmode="numeric"
230
+ autocomplete="one-time-code"
231
+ .value=${this.linkedInCode}
232
+ @input=${i=>{this.linkedInCode=i.target.value}}
233
+ placeholder="6-digit code"
234
+ ?disabled=${this.isLinkedInLoading}
235
+ />
236
+ </label>
237
+ <div class="li-form-actions">
238
+ <button type="button" class="li-secondary" @click=${()=>this.resetLinkedInForm()} ?disabled=${this.isLinkedInLoading}>
239
+ Back
240
+ </button>
241
+ <button type="submit" class="li-primary" ?disabled=${this.isLinkedInLoading}>
242
+ ${this.isLinkedInLoading?"Verifying…":"Verify & connect"}
243
+ </button>
244
+ </div>
245
+ </form>
246
+ `}return a`
247
+ <form class="li-form" @submit=${i=>this.handleConnectLinkedIn(i)}>
248
+ <label class="li-label">
249
+ <span>Email or username</span>
250
+ <input
251
+ class="li-input"
252
+ type="text"
253
+ autocomplete="username"
254
+ .value=${this.linkedInUsername}
255
+ @input=${i=>{this.linkedInUsername=i.target.value}}
256
+ placeholder="you@example.com"
257
+ ?disabled=${this.isLinkedInLoading}
258
+ />
259
+ </label>
260
+ <label class="li-label">
261
+ <span>Password</span>
262
+ <input
263
+ class="li-input"
264
+ type="password"
265
+ autocomplete="current-password"
266
+ .value=${this.linkedInPassword}
267
+ @input=${i=>{this.linkedInPassword=i.target.value}}
268
+ placeholder="LinkedIn password"
269
+ ?disabled=${this.isLinkedInLoading}
270
+ />
271
+ </label>
272
+ <button type="submit" class="li-primary li-primary-full" ?disabled=${this.isLinkedInLoading}>
273
+ ${this.isLinkedInLoading?"Connecting…":"Connect LinkedIn"}
274
+ </button>
275
+ </form>
276
+ `}renderSkeleton(){return a`<div class="ig-skeleton" aria-hidden="true">
277
+ <div class="ig-skeleton-mark"></div>
278
+ <div class="ig-skeleton-lines">
279
+ <div class="ig-skeleton-line wide"></div>
280
+ <div class="ig-skeleton-line"></div>
281
+ </div>
282
+ </div>`}render(){return a`
283
+ <div class="panel">
284
+ <div class="header">
285
+ ${this.hideClose?null:a`<div class="close-btn" @click=${this.closeDrawer} title="Close">
286
+ <svg xmlns="http://www.w3.org/2000/svg" height="30" viewBox="0 -960 960 960" width="30" fill="var(--text-primary-color)">
287
+ <path d="m249-207-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z" />
288
+ </svg>
289
+ </div>`}
290
+ <h1 class="title">Connected accounts</h1>
291
+ </div>
292
+
293
+ <div class="body">
294
+ <section class="platform-section">
295
+ <h2 class="section-title">Instagram</h2>
296
+ ${this.isSocialLoading?this.renderSkeleton():this.connectedAccounts.length?this.connectedAccounts.map((i=>this.renderSocialAccount(i))):this.renderConnectInstagram()}
297
+ </section>
298
+
299
+ <section class="platform-section">
300
+ <h2 class="section-title">LinkedIn</h2>
301
+ ${this.isLinkedInLoading&&!this.linkedInCheckpointAccountId&&!this.linkedInUsername?this.renderSkeleton():this.connectedLinkedInAccounts.length?this.connectedLinkedInAccounts.map((i=>this.renderLinkedInAccount(i))):this.renderLinkedInForm()}
302
+ </section>
303
+ </div>
304
+
305
+ <div class="bottom-actions">
306
+ <button type="button" class="action-button" @click=${this.toggleTheme}>
307
+ ${this.defaultTheme==="dark"?a`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
308
+ <circle cx="12" cy="12" r="4"></circle>
309
+ <path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"></path>
310
+ </svg>`:a`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
311
+ <path d="M21 14.5A8.5 8.5 0 0 1 9.5 3 7 7 0 1 0 21 14.5z"></path>
312
+ </svg>`}
313
+ <span>${this.defaultTheme==="dark"?"Light Theme":"Dark Theme"}</span>
314
+ </button>
315
+ </div>
316
+ </div>
317
+ `}static styles=n`
318
+ :host {
319
+ display: block;
320
+ height: 100%;
321
+ }
322
+
323
+ .panel {
324
+ padding: 16px 20px 24px;
325
+ display: flex;
326
+ flex-direction: column;
327
+ height: 100%;
328
+ box-sizing: border-box;
329
+ overflow-y: auto;
330
+ background-color: var(--bg-primary-color);
331
+ }
332
+
333
+ .header {
334
+ display: flex;
335
+ align-items: center;
336
+ margin-bottom: 24px;
337
+ flex-shrink: 0;
338
+ }
339
+
340
+ .close-btn {
341
+ cursor: pointer;
342
+ display: flex;
343
+ align-items: center;
344
+ }
345
+
346
+ .title {
347
+ font-size: 1.25rem;
348
+ font-weight: 600;
349
+ margin: 0 0 0 8px;
350
+ color: var(--text-primary-color);
351
+ line-height: 1.3;
352
+ }
353
+
354
+ .body {
355
+ flex: 1;
356
+ min-height: 0;
357
+ display: flex;
358
+ flex-direction: column;
359
+ gap: 28px;
360
+ }
361
+
362
+ .platform-section {
363
+ display: flex;
364
+ flex-direction: column;
365
+ gap: 12px;
366
+ }
367
+
368
+ .section-title {
369
+ margin: 0;
370
+ font-size: 0.8125rem;
371
+ font-weight: 600;
372
+ letter-spacing: 0.04em;
373
+ text-transform: uppercase;
374
+ color: var(--text-secondary-color);
375
+ }
376
+
377
+ .ig-card {
378
+ display: flex;
379
+ flex-direction: column;
380
+ gap: 14px;
381
+ padding: 14px;
382
+ border-radius: 12px;
383
+ border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 10%, transparent));
384
+ background: color-mix(in srgb, var(--bg-secondary-color, #f5f5f5) 70%, transparent);
385
+ margin-bottom: 0;
386
+ animation: ig-in 280ms cubic-bezier(0.16, 1, 0.3, 1);
387
+ }
388
+
389
+ @keyframes ig-in {
390
+ from {
391
+ opacity: 0;
392
+ transform: translateY(6px);
393
+ }
394
+ to {
395
+ opacity: 1;
396
+ transform: translateY(0);
397
+ }
398
+ }
399
+
400
+ @media (prefers-reduced-motion: reduce) {
401
+ .ig-card {
402
+ animation: none;
403
+ }
404
+ }
405
+
406
+ .ig-card-top {
407
+ display: flex;
408
+ align-items: flex-start;
409
+ gap: 12px;
410
+ }
411
+
412
+ .ig-mark,
413
+ .li-mark {
414
+ width: 40px;
415
+ height: 40px;
416
+ border-radius: 12px;
417
+ display: grid;
418
+ place-items: center;
419
+ flex-shrink: 0;
420
+ }
421
+
422
+ .ig-mark {
423
+ background: color-mix(in srgb, #dd2a7b 8%, var(--bg-primary-color, #fff));
424
+ }
425
+
426
+ .li-mark {
427
+ background: color-mix(in srgb, #0a66c2 10%, var(--bg-primary-color, #fff));
428
+ }
429
+
430
+ .ig-identity {
431
+ min-width: 0;
432
+ flex: 1;
433
+ }
434
+
435
+ .ig-name-row {
436
+ display: flex;
437
+ align-items: center;
438
+ gap: 8px;
439
+ flex-wrap: wrap;
440
+ }
441
+
442
+ .ig-name {
443
+ margin: 0;
444
+ font-size: 0.9375rem;
445
+ font-weight: 600;
446
+ color: var(--text-primary-color);
447
+ line-height: 1.3;
448
+ overflow: hidden;
449
+ text-overflow: ellipsis;
450
+ white-space: nowrap;
451
+ }
452
+
453
+ .ig-badge {
454
+ font-size: 0.6875rem;
455
+ font-weight: 600;
456
+ letter-spacing: 0.01em;
457
+ padding: 3px 8px;
458
+ border-radius: 999px;
459
+ background: color-mix(in srgb, var(--success) 14%, transparent);
460
+ color: #15803d;
461
+ }
462
+
463
+ .ig-badge.is-muted {
464
+ background: color-mix(in srgb, var(--text-secondary-color) 14%, transparent);
465
+ color: var(--text-secondary-color);
466
+ }
467
+
468
+ .ig-handle {
469
+ margin: 2px 0 0;
470
+ font-size: 0.8125rem;
471
+ color: var(--text-secondary-color);
472
+ overflow: hidden;
473
+ text-overflow: ellipsis;
474
+ white-space: nowrap;
475
+ }
476
+
477
+ .ig-connected-on {
478
+ margin: 6px 0 0;
479
+ font-size: 0.75rem;
480
+ color: var(--text-secondary-color);
481
+ }
482
+
483
+ .ig-actions {
484
+ display: flex;
485
+ align-items: center;
486
+ justify-content: space-between;
487
+ gap: 12px;
488
+ padding-top: 2px;
489
+ border-top: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 8%, transparent));
490
+ }
491
+
492
+ .ig-link {
493
+ font-size: 0.8125rem;
494
+ font-weight: 500;
495
+ color: var(--base-color, var(--primary));
496
+ text-decoration: none;
497
+ }
498
+
499
+ .ig-link:hover {
500
+ text-decoration: underline;
501
+ }
502
+
503
+ .ig-disconnect {
504
+ background: none;
505
+ border: none;
506
+ cursor: pointer;
507
+ color: var(--text-danger-color, #e53935);
508
+ font-size: 0.8125rem;
509
+ font-weight: 500;
510
+ padding: 4px 0;
511
+ }
512
+
513
+ .ig-disconnect:hover {
514
+ opacity: 0.85;
515
+ }
516
+
517
+ .ig-connect {
518
+ width: 100%;
519
+ display: flex;
520
+ align-items: center;
521
+ gap: 12px;
522
+ text-align: left;
523
+ padding: 12px 14px;
524
+ border-radius: 12px;
525
+ border: 1px dashed color-mix(in srgb, var(--text-primary-color) 18%, transparent);
526
+ background: transparent;
527
+ cursor: pointer;
528
+ box-sizing: border-box;
529
+ }
530
+
531
+ .ig-empty {
532
+ display: flex;
533
+ flex-direction: column;
534
+ gap: 12px;
535
+ padding: 0;
536
+ }
537
+
538
+ .ig-empty-title {
539
+ margin: 0;
540
+ font-size: 1rem;
541
+ font-weight: 600;
542
+ color: var(--text-primary-color);
543
+ }
544
+
545
+ .ig-empty-copy {
546
+ margin: 0;
547
+ font-size: 0.875rem;
548
+ line-height: 1.45;
549
+ color: var(--text-secondary-color);
550
+ }
551
+
552
+ .ig-connect:hover {
553
+ background: var(--bg-secondary-color, #f5f5f5);
554
+ border-style: solid;
555
+ }
556
+
557
+ .ig-connect:disabled {
558
+ opacity: 0.6;
559
+ cursor: not-allowed;
560
+ }
561
+
562
+ .ig-connect-copy {
563
+ display: flex;
564
+ flex-direction: column;
565
+ gap: 2px;
566
+ min-width: 0;
567
+ }
568
+
569
+ .ig-connect-title {
570
+ font-size: 0.875rem;
571
+ font-weight: 600;
572
+ color: var(--text-primary-color);
573
+ }
574
+
575
+ .ig-connect-sub {
576
+ font-size: 0.75rem;
577
+ color: var(--text-secondary-color);
578
+ line-height: 1.35;
579
+ }
580
+
581
+ .li-form {
582
+ display: flex;
583
+ flex-direction: column;
584
+ gap: 12px;
585
+ padding: 14px;
586
+ border-radius: 12px;
587
+ border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 10%, transparent));
588
+ background: color-mix(in srgb, var(--bg-secondary-color, #f5f5f5) 70%, transparent);
589
+ }
590
+
591
+ .li-label {
592
+ display: flex;
593
+ flex-direction: column;
594
+ gap: 6px;
595
+ font-size: 0.75rem;
596
+ font-weight: 500;
597
+ color: var(--text-secondary-color);
598
+ }
599
+
600
+ .li-input {
601
+ width: 100%;
602
+ box-sizing: border-box;
603
+ padding: 10px 12px;
604
+ border-radius: 8px;
605
+ border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 14%, transparent));
606
+ background: var(--bg-primary-color, #fff);
607
+ color: var(--text-primary-color);
608
+ font-size: 0.875rem;
609
+ }
610
+
611
+ .li-input:focus {
612
+ outline: 2px solid color-mix(in srgb, #0a66c2 35%, transparent);
613
+ outline-offset: 1px;
614
+ }
615
+
616
+ .li-form-actions {
617
+ display: flex;
618
+ gap: 8px;
619
+ justify-content: flex-end;
620
+ }
621
+
622
+ .li-primary,
623
+ .li-secondary {
624
+ border: none;
625
+ border-radius: 8px;
626
+ padding: 10px 14px;
627
+ font-size: 0.8125rem;
628
+ font-weight: 600;
629
+ cursor: pointer;
630
+ }
631
+
632
+ .li-primary {
633
+ background: #0a66c2;
634
+ color: #fff;
635
+ }
636
+
637
+ .li-primary-full {
638
+ width: 100%;
639
+ }
640
+
641
+ .li-primary:disabled,
642
+ .li-secondary:disabled {
643
+ opacity: 0.6;
644
+ cursor: not-allowed;
645
+ }
646
+
647
+ .li-secondary {
648
+ background: transparent;
649
+ color: var(--text-secondary-color);
650
+ border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 14%, transparent));
651
+ }
652
+
653
+ .ig-skeleton {
654
+ display: flex;
655
+ align-items: center;
656
+ gap: 12px;
657
+ padding: 14px;
658
+ border-radius: 12px;
659
+ border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 10%, transparent));
660
+ }
661
+
662
+ .ig-skeleton-mark {
663
+ width: 40px;
664
+ height: 40px;
665
+ border-radius: 12px;
666
+ background: color-mix(in srgb, var(--text-secondary-color) 12%, transparent);
667
+ }
668
+
669
+ .ig-skeleton-lines {
670
+ flex: 1;
671
+ display: flex;
672
+ flex-direction: column;
673
+ gap: 8px;
674
+ }
675
+
676
+ .ig-skeleton-line {
677
+ height: 10px;
678
+ width: 42%;
679
+ border-radius: 999px;
680
+ background: color-mix(in srgb, var(--text-secondary-color) 12%, transparent);
681
+ }
682
+
683
+ .ig-skeleton-line.wide {
684
+ width: 68%;
685
+ }
686
+
687
+ .bottom-actions {
688
+ margin-top: auto;
689
+ display: flex;
690
+ flex-direction: column;
691
+ gap: 2px;
692
+ padding-top: 16px;
693
+ border-top: 1px solid var(--border-subtle, #eaeaea);
694
+ flex-shrink: 0;
695
+ }
696
+
697
+ .action-button {
698
+ display: flex;
699
+ align-items: center;
700
+ gap: 12px;
701
+ background: none;
702
+ border: none;
703
+ cursor: pointer;
704
+ color: var(--text-primary-color, #111111);
705
+ font-size: 15px;
706
+ line-height: 1.3;
707
+ padding: 12px 8px;
708
+ text-align: left;
709
+ width: 100%;
710
+ box-sizing: border-box;
711
+ border-radius: 8px;
712
+ }
713
+
714
+ .action-button:hover {
715
+ background-color: var(--bg-secondary-color, #f5f5f5);
716
+ }
717
+
718
+ .action-button svg {
719
+ width: 18px;
720
+ height: 18px;
721
+ min-width: 18px;
722
+ flex-shrink: 0;
723
+ stroke: currentColor;
724
+ }
725
+ `}customElements.define("instagram-accounts-panel",F);class P extends o{static properties={progress:{type:Number},loadingStatus:{type:String}};static styles=n`
726
+ .loading-container {
727
+ position: fixed;
728
+ top: 0;
729
+ left: 0;
730
+ width: 100%;
731
+ height: 100%;
732
+ background-color: var(--bg-secondary-color);
733
+ display: flex;
734
+ flex-direction: column;
735
+ justify-content: center;
736
+ align-items: center;
737
+ z-index: 1000;
738
+ }
739
+
740
+ .whatsapp-logo {
741
+ margin-bottom: 30px;
742
+ }
743
+
744
+ .progress-container {
745
+ width: 250px;
746
+ height: 4px;
747
+ background-color: var(--bg-primary-color);
748
+ border-radius: 2px;
749
+ margin-bottom: 10px;
750
+ overflow: hidden;
751
+ }
752
+
753
+ .progress-bar {
754
+ height: 100%;
755
+ background-color: var(--base-color);
756
+ border-radius: 2px;
757
+ transition: width 0.3s ease;
758
+ }
759
+
760
+ .progress-text {
761
+ font-size: 14px;
762
+ color: var(--text-primary-color);
763
+ }
764
+
765
+ .status-text {
766
+ margin-top: 15px;
767
+ font-size: 16px;
768
+ color: var(--text-secondary-color);
769
+ }
770
+ `;constructor(){super();this.progress=0;this.loadingStatus="Initializing..."}render(){return a`
771
+ <div class="loading-container">
772
+
773
+ <div class="progress-container">
774
+ <div class="progress-bar" style="width: ${this.progress}%"></div>
775
+ </div>
776
+ <div class="progress-text">${this.progress}%</div>
777
+ <div class="status-text">${z.PLACEHOLDER_CONTENT.LOADING}</div>
778
+ </div>
779
+ `}}customElements.define("chat-loading-placeholder",P);const R=async()=>{const i=await r.getInstance().Conversation.getConversationUnreadCount();return i?.count};const{state:G,onChange:q}=j({totalUnreadCount:0});const H={state:G,updateTotalUnreadCount(i){G.totalUnreadCount=i},getTotalUnreadCount(){return G.totalUnreadCount},onChange:q};const V=":host{display:flex;flex:1;font-family:var(--font-sans);color:var(--text-primary-color)}web-chat{display:flex;flex:1}.isometrik-quickchat{display:flex;height:100dvh;width:100%;min-height:0;overflow:hidden;background:var(--bg-primary-color);color:var(--text-primary-color)}.isometrik-quickchat.is-resizing{cursor:col-resize;user-select:none}.isometrik-quickchat.is-resizing *{cursor:col-resize !important;user-select:none !important}.chat-sidebar-container{position:relative;flex:0 0 calc(68px + var(--sidebar-width));width:calc(68px + var(--sidebar-width));max-width:calc(68px + var(--sidebar-width));height:100%;min-height:0;min-width:0;overflow:visible;transition:transform var(--duration) var(--ease-out);border-right:1px solid var(--border-subtle);display:flex;flex-direction:row;background-color:var(--bg-primary-color);box-shadow:none;z-index:2}.isometrik-quickchat.is-instagram-gate .chat-sidebar-container.is-full-gate{flex:1 1 auto;width:100%;max-width:none;border-right:none}.isometrik-quickchat.is-instagram-gate .sidebar-tab{max-width:480px;margin:0 auto;width:100%}.chat-sidebar-container.is-resizing{transition:none}.sidebar-tab{flex:1 1 auto;width:auto;height:100%;min-height:0;min-width:0;overflow:hidden;background-color:var(--bg-primary-color)}.sidebar-resize-handle{position:absolute;top:0;right:-5px;width:10px;height:100%;z-index:30;cursor:col-resize;display:flex;align-items:center;justify-content:center;touch-action:none}.sidebar-resize-handle::before{content:'';position:absolute;top:0;bottom:0;left:50%;width:1px;transform:translateX(-50%);background:transparent;transition:background-color var(--duration) var(--ease-out), width 120ms var(--ease-out)}.sidebar-resize-grip{width:3px;height:32px;border-radius:999px;background:var(--border, #eaeaea);opacity:0;transition:opacity var(--duration) var(--ease-out), background-color var(--duration) var(--ease-out), height 120ms var(--ease-out);pointer-events:none}.sidebar-resize-handle:hover::before,.sidebar-resize-handle.active::before{width:2px;background:var(--text-primary-color)}.sidebar-resize-handle:hover .sidebar-resize-grip,.sidebar-resize-handle.active .sidebar-resize-grip{opacity:1;background:var(--text-primary-color);height:40px}.chat-body-container{flex:1;display:flex;flex-direction:column;min-width:0;background-color:var(--bg-secondary-color)}.noChatSelectedPlaceholder{height:100%;width:100%;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:0;padding:40px 24px;color:var(--text-secondary-color);background-image:radial-gradient(circle, var(--border-subtle) 1px, transparent 1.2px);background-size:22px 22px}.empty-mark{position:relative;width:92px;height:68px;margin-bottom:24px}.empty-mark span{position:absolute;width:56px;height:38px;background:var(--primary, #000000)}.empty-mark span:first-child{left:0;top:0;opacity:0.18;border-radius:18px 18px 4px 18px}.empty-mark span:last-child{right:0;bottom:0;border-radius:18px 18px 18px 4px}.noChatSelectedPlaceholder h2{margin:0;font-size:24px;font-weight:600;letter-spacing:-0.04em;color:var(--text-primary-color);line-height:1.15}.noChatSelectedPlaceholder p{margin:8px 0 0;font-size:14px;line-height:1.5;max-width:34ch;text-align:center;color:var(--text-secondary-color)}.empty-cta{margin-top:20px;border:none;cursor:pointer;font-family:inherit;font-size:13px;font-weight:600;color:var(--primary-foreground, #ffffff);background:var(--primary, #000000);border-radius:var(--radius-pill);padding:10px 18px;transition:transform 120ms var(--ease-out), filter 180ms var(--ease-out)}.empty-cta:hover{filter:brightness(1.06)}.empty-cta:active{transform:scale(0.98)}.chat-sidebar-right{flex:0 0 var(--sidebar-width);width:var(--sidebar-width);max-width:var(--sidebar-width);min-width:0;overflow:hidden;transition:transform var(--duration) var(--ease-out);border-left:1px solid var(--border-subtle);background-color:var(--bg-primary-color)}.loaderoverlay{width:100%;position:absolute;margin:auto;background:var(--overlay-color);z-index:1400}.loadingPlaceholder{height:100%;width:100%;z-index:12839283}.back-button{display:none;padding:0;background:none;border:none;cursor:pointer;align-items:center;gap:4px}spinner-loader{display:flex;height:100dvh}.blockMessageContainer{text-align:center;padding:16px 0;margin:0;background-color:var(--bg-primary-color);color:var(--text-secondary-color);font-size:var(--text-secondary-size);border-top:1px solid var(--border-subtle)}@media (max-width: 768px){.isometrik-quickchat{position:relative;overflow:hidden}.sidebar-resize-handle{display:none}.chat-sidebar-right{width:100%;max-width:none;flex:none;position:fixed;z-index:10;border-right:1px solid var(--border-subtle)}.chat-sidebar-container{width:100%;height:100%;position:absolute;left:0;top:0;transform:translateX(0);transition:transform var(--duration) var(--ease-out);z-index:2;flex:none;max-width:none;min-width:100% !important;overflow:hidden;box-shadow:none}.chat-sidebar-container.hidden{transform:translateX(-100%)}.chat-body-container{width:100%;height:100%;position:absolute;left:0;top:0;transform:translateX(100%);transition:transform var(--duration) var(--ease-out);z-index:1}.chat-body-container.hidden{transform:translateX(0)}.chat-body-container.show{transform:translateX(0);z-index:3}.back-button{display:flex;align-items:center;justify-content:center;position:absolute;right:3rem;z-index:10;top:2.3rem}}";const W=V;const Q=class{constructor(e){i(this,e);this.unreadMessageCountUpdated=t(this,"unreadMessageCountUpdated",7);this.conversationNotFound=t(this,"conversationNotFound",7);this.messageReadStatusUpdated=t(this,"messageReadStatusUpdated",7);this.chatBodyRef=null;this.conversationDetailsInterval=null;this.SIDEBAR_MIN=280;this.SIDEBAR_MAX=560;this.SIDEBAR_RAIL=68;this.SIDEBAR_WIDTH_KEY="isometrik-sidebar-list-width";this.sidebarResizeOriginLeft=0;this.clampSidebarWidth=i=>{const t=Math.floor(window.innerWidth*.55)-this.SIDEBAR_RAIL;const e=Math.min(this.SIDEBAR_MAX,Math.max(this.SIDEBAR_MIN,t));return Math.min(Math.max(Math.round(i),this.SIDEBAR_MIN),e)};this.onSidebarResizeMove=i=>{if(!this.isResizingSidebar)return;this.sidebarListWidth=this.clampSidebarWidth(i.clientX-this.sidebarResizeOriginLeft-this.SIDEBAR_RAIL)};this.onSidebarResizeEnd=()=>{if(!this.isResizingSidebar)return;this.isResizingSidebar=false;try{localStorage.setItem(this.SIDEBAR_WIDTH_KEY,String(this.sidebarListWidth))}catch(i){}window.removeEventListener("pointermove",this.onSidebarResizeMove);window.removeEventListener("pointerup",this.onSidebarResizeEnd)};this.startSidebarResize=i=>{var t;if(this.isMobileView)return;i.preventDefault();const e=i.currentTarget;const s=e.closest(".chat-sidebar-container");this.sidebarResizeOriginLeft=(t=s===null||s===void 0?void 0:s.getBoundingClientRect().left)!==null&&t!==void 0?t:0;this.isResizingSidebar=true;window.addEventListener("pointermove",this.onSidebarResizeMove);window.addEventListener("pointerup",this.onSidebarResizeEnd)};this.handleReplyMessage=i=>{this.replyMessage=i.detail};this.handleremoveReplyMessage=()=>{this.replyMessage=null};this.handleMessageSearchTextChange=i=>{this.messageSearchText=i.detail};this.getCookie=i=>{const t=`; ${document.cookie}`;const e=t.split(`; ${i}=`);if(e.length===2)return e.pop().split(";").shift()};this.userTokenFromCookie="";this.isometrikUserIdFromCookie="";this.applyParentCreds=()=>{var i;const t=(i,t="")=>typeof i==="string"&&i.trim()?i.trim():t;l.userToken=t(this.userToken);l.appSecret=t(this.appSecret);l.licenseKey=t(this.licenseKey);l.userSecret=t(this.userSecret);l.accountId=t(this.accountId);l.keysetId=t(this.keysetId);l.projectId=t(this.projectId);l.isometrikUserId=t(this.isometrikUserId);l.baseUrl=t(this.baseUrl,l.baseUrl||"https://apis.isometrik.ai");l.socialRedirectUrl=t(this.socialRedirectUrl);if((i=this.hostUrl)===null||i===void 0?void 0:i.trim()){d.URL=this.hostUrl.trim()}this.userTokenFromCookie=l.userToken;this.isometrikUserIdFromCookie=l.isometrikUserId};this.clearConversationState=()=>{this.allConversationList=[];this.selectedConversationId=null;this.initialConversationIdFromURL="";this.allMessages=[];this.selectConversationMessages=[];this.conversationMetaData={};this.selctConversationMetaData={};this.allAttachments=[];this.selectConverSationAttachments=[];this.unreadConversationsCount=0;this.hasMoreConversations=false;this.isContactInfoOpen=false;this.isProfileInfoOpen=false;this.showRightSideBar=false;H.updateTotalUnreadCount(0);if(typeof window!=="undefined"){const i=new URL(window.location.href);i.searchParams.delete("conversation");i.searchParams.delete("groupcast");window.history.replaceState({},"",i)}};this.applySocialGate=(i,t={})=>{const e=this.isInstagramConnected;this.isInstagramConnected=i;if(!i){this.clearConversationState();this.activeTab="Accounts";return}if(!t.bootstrap&&!e){this.activeTab="Chat";void this.loadConversationsAfterInstagramConnect()}};this.refreshInstagramConnectionGate=async(i={bootstrap:true})=>{const[t,e]=await Promise.all([m({platform:"instagram"}).catch((()=>({accounts:[]}))),m({platform:"linkedin"}).catch((()=>({accounts:[]})))]);const s=A((t===null||t===void 0?void 0:t.accounts)||[])||A((e===null||e===void 0?void 0:e.accounts)||[]);this.applySocialGate(s,i)};this.loadConversationsAfterInstagramConnect=async()=>{if(!this.isInstagramConnected)return;try{this.isConversationLoading=true;const i=await R();H.updateTotalUnreadCount(i);this.unreadConversationsCount=i;H.onChange("totalUnreadCount",(i=>{this.unreadConversationsCount=i}));await this.getConversations()}catch(i){console.error("Failed to load conversations after social connect:",i)}finally{this.isConversationLoading=false}};this.handleInstagramAccountsChange=i=>{void this.refreshInstagramConnectionGate({bootstrap:false})};this.openChatTab=()=>{if(this.isInstagramConnected){this.activeTab="Chat";return}this.activeTab="Accounts"};this.closeAccountsDrawer=()=>{this.activeTab=this.isInstagramConnected?"Chat":"Accounts"};this.getUserDetails=async()=>{var i,t,e;try{const s=await r.getInstance().user.getUserDetails();const o={userId:(s===null||s===void 0?void 0:s.userId)||"",userIdentifier:(s===null||s===void 0?void 0:s.userIdentifier)||"",firstName:((i=s===null||s===void 0?void 0:s.metaData)===null||i===void 0?void 0:i.firstName)||"",lastName:((t=s===null||s===void 0?void 0:s.metaData)===null||t===void 0?void 0:t.lastName)||"",updatedAt:(s===null||s===void 0?void 0:s.updatedAt)||"",userName:(s===null||s===void 0?void 0:s.userName)||"",online:(s===null||s===void 0?void 0:s.online)||"",userProfileImageUrl:(s===null||s===void 0?void 0:s.userProfileImageUrl)||"",profilePic:((e=s===null||s===void 0?void 0:s.metaData)===null||e===void 0?void 0:e.profilePic)||""};this.userMetaData=o}catch(i){console.error(i,"getUserDetails fetching error")}};this.handleSocialConnectCallback=async()=>{if(D())return;const i=O();if(!i)return;try{await b({platform:i.platform||"instagram",username:i.username||"",displayName:i.displayName||"",loginMethod:"instagram_login"});g({message:"Instagram connected",type:"success",position:"bottom-right"});this.activeTab="Chat"}catch(i){console.error("Social connect callback failed:",i);g({message:(i===null||i===void 0?void 0:i.message)||"Failed to connect Instagram",type:"error",position:"bottom-right"})}finally{$()}};this.getConversations=async(i=0,t=null,e=false)=>{this.hasMoreConversations=true;const s={limit:20,skip:i,includeMembers:true};if(t){s["searchTag"]=t}if(e){this.isLoadingConversationList=true}try{const i=await r.getInstance().Conversation.getConversations(s);const t=i.conversations.filter((i=>!this.allConversationList.some((t=>t.conversationId===i.conversationId))));this.allConversationList=[...this.allConversationList,...t]}catch(i){console.error("getConversations fetching error",i);if((i===null||i===void 0?void 0:i.status)===404||(i===null||i===void 0?void 0:i.statusCode)===404){this.hasMoreConversations=false}}finally{this.isLoadingConversationList=false}};this.getGroupCastConversationDetails=async i=>{var t;try{const e=await T({ids:i});this.conversationMetaData=(t=e===null||e===void 0?void 0:e.groupcasts)===null||t===void 0?void 0:t[0]}catch(i){console.error(i,"GroupCast details fetching error")}};this.getUserConversationDetails=async i=>{const t={conversationId:i||this.selectedConversationId,includeMembers:true};try{const e=await r.getInstance().Conversation.getConversationDetails(t,i||this.selectedConversationId);if(i){this.selctConversationMetaData=e.conversationDetails}else{this.conversationMetaData=e.conversationDetails}return e.conversationDetails}catch(i){console.error(i,"getConversationDetails fetching error")}};this.getMessages=async(i,t)=>{this.isMessagesLoading=true;this.isScrollToTop=true;this.isMessageLimitEnd=false;try{const e=await r.getInstance().message.getMessages({conversationId:t||this.selectedConversationId,limit:20,skip:i});if(i==0){if(t){this.selectConversationMessages=[...e.messages.reverse()]}else{this.allMessages=[...e.messages.reverse()]}}else{this.allMessages=[...e.messages.reverse(),...this.allMessages]}this.allMessages.forEach((i=>{if(i.hasOwnProperty("attachments")&&i.attachments!==null);}))}catch(i){if((i===null||i===void 0?void 0:i.status)===404||(i===null||i===void 0?void 0:i.statusCode)===404){this.isMessageLimitEnd=true}}finally{this.isMessagesLoading=false}};this.getMessageUnreadCount=async()=>{try{const i=await r.getInstance().message.getUnreadCount({converationId:this.selectedConversationId});this.unreadMessageCountFromApi=i.count}catch(i){console.error("Error while getting unread count",i)}};this.getMessagesByQuery=async i=>{const t={conversationId:this.selectedConversationId,searchTag:i,skip:0,limit:20};this.isLoadingMessage=true;try{const i=await r.getInstance().message.getMessages(t);this.searchedMessageDetails=i.messages}catch(i){this.searchedMessageDetails=[];console.error("Error while searching messages in a chat",i)}finally{this.isLoadingMessage=false}};this.getAllLinks=async i=>{const t={conversationId:i,customTypes:"AttachmentMessage:Link"};try{const i=await r.getInstance().message.getMessages(t);this.allLinks=[...i.messages]}catch(i){console.error("Error while fetching all the links for a particular conversation",i);this.allLinks=[]}};this.getGroupcastMembers=async i=>{try{const t=await L({groupcastId:i});this.groupcastMembers=t===null||t===void 0?void 0:t.members}catch(i){console.error("Error while fetching all the links for a particular conversation",i);this.groupcastMembers=[]}};this.getAllLinksCount=async i=>{const t={conversationId:i,customTypes:"AttachmentMessage:Link,AttachmentMessage:Multiple,AttachmentMessage:Image,AttachmentMessage:Video,AttachmentMessage:Audio,AttachmentMessage:File"};try{const i=await r.getInstance().message.getMessagesCount(t);this.allLinksCount=i.messagesCount}catch(i){console.error("Error while fetching all the links for a particular conversation",i);this.allLinksCount=0}};this.getAllAttachments=async(i,t)=>{const e={conversationId:i,customTypes:"AttachmentMessage:Media,AttachmentMessage:Multiple"};this.loadingMediaGallery=true;this.allAttachments=[];this.selectConverSationAttachments=[];try{const i=await r.getInstance().message.getMessages(e);if(Array.isArray(i.messages)){const e=i.messages.filter((i=>{if(!i.attachments||!Array.isArray(i.attachments)){return false}const t=i.attachments.filter((i=>i.mimeType&&!i.mimeType.startsWith("application")));return t.length>0}));if(t==="Profile-info"){this.selectConverSationAttachments=[...e]}else{this.allAttachments=[...e]}}}catch(i){console.error("Error while fetching all the attachments for a particular conversation",i);this.allAttachments=[];this.selectConverSationAttachments=[]}finally{this.loadingMediaGallery=false}};this.clearConversation=async i=>{try{await r.getInstance().Conversation.deleteConversationLocal({conversationId:i||this.selectedConversationId});this.allMessages=[];this.allConversationList=this.allConversationList.map((i=>{if(i.conversationId===this.selectedConversationId){return Object.assign(Object.assign({},i),{lastMessageDetails:Object.assign(Object.assign({},i.lastMessageDetails),{body:"",updatedAt:Date.now()})})}return i}))}catch(i){console.error("Error while clearing conversation:",i)}finally{c.closeDialog("confirm-dialog")}};this.deleteConversation=async i=>{try{await r.getInstance().Conversation.deleteConversationClear({conversationId:i});if(this.selectedConversationId===i){const i=new URL(window.location.href);i.searchParams.delete("conversation");window.history.pushState({},"",i);this.selectedConversationId=null;this.showSidebar=true}this.allConversationList=this.allConversationList.filter((t=>t.conversationId!==i))}catch(i){console.error("Error while deleting the chat",i)}finally{c.closeDialog("confirm-dialog")}};this.blockUser=async(i,t)=>{try{await r.getInstance().user.postUserBlock({opponentId:i});this.isBlocked=null;g({message:`${t} blocked`,type:"info",duration:3e3,position:"bottom-left"})}catch(t){this.isConversationLoading=false;console.error(`Failed to block user with ID ${i}:`,t)}finally{c.closeDialog("confirm-dialog")}};this.unblockUser=async(i,t)=>{try{await r.getInstance().user.postUserUnblock({opponentId:i});this.isBlocked=null;g({message:`${t} unblocked`,type:"success",duration:3e3,position:"bottom-left"})}catch(t){this.isConversationLoading=false;console.error(`Failed to unblock user with ID ${i}:`,t)}finally{c.closeDialog("confirm-dialog")}};this.changeScrollToBottomState=i=>{this.isScrollToBottom=i};this.changeScrollToTopState=i=>{this.isScrollToTop=i};this.updateSkip=()=>{if(!this.isMessageLimitEnd){this.skip+=20}};this.updateAllMessages=i=>{this.allMessages=i};this.refetchMessages=()=>{this.isScrollToBottom=true;this.isMessageLimitEnd=true;this.messageAction={action:"",initiator:false};this.skip=0;this.allMessages=[];this.getMessages(0);this.getMessageAction()};this.changeMessageSendingState=i=>{this.isMessageSending=i};this.getMessageAction=()=>{var i,t,e,s,o;const n=this.isProfileInfoOpen?(i=this.selectConversationMessages)===null||i===void 0?void 0:i[((t=this.selectConversationMessages)===null||t===void 0?void 0:t.length)-1]:(e=this.allMessages)===null||e===void 0?void 0:e[((s=this.allMessages)===null||s===void 0?void 0:s.length)-1];if(n&&["userBlockConversation","userUnblockConversation"].includes(n===null||n===void 0?void 0:n.action)){this.messageAction={action:n===null||n===void 0?void 0:n.action,initiator:(n===null||n===void 0?void 0:n.initiatorId)==((o=this.userMetaData)===null||o===void 0?void 0:o.userId)}}};this.deleteMessageFromSelf=async i=>{try{await r.getInstance().message.deleteMessageSelf(i);this.allMessages=this.allMessages.filter((t=>t.messageId!==i.messageIds));this.allConversationList=this.sortConversationsByLatestMessage(this.allConversationList.map((t=>{var e,s,o;if(t.conversationId===i.conversationId&&((e=t===null||t===void 0?void 0:t.lastMessageDetails)===null||e===void 0?void 0:e.messageId)===i.messageIds){const e=this.allMessages.filter((t=>t.conversationId===i.conversationId)).sort(((i,t)=>(i.sentAt||0)-(t.sentAt||0)));const n=e.length>0?e[e.length-1]:null;return Object.assign(Object.assign({},t),{lastMessageDetails:n?Object.assign(Object.assign({},n),{body:n.body,updatedAt:n.sentAt||Date.now(),action:n.action||"",senderName:(s=n===null||n===void 0?void 0:n.senderInfo)===null||s===void 0?void 0:s.userName,senderId:(o=n===null||n===void 0?void 0:n.senderInfo)===null||o===void 0?void 0:o.userId}):null})}return t})))}catch(i){g({type:"error",message:(i===null||i===void 0?void 0:i.message)||"Failed to delete the message",position:"bottom-right"})}finally{c.closeDialog("delete-message")}};this.deleteMeassageFromEveryOne=async i=>{try{await r.getInstance().message.deleteMessagesEveryone(i);this.allMessages=this.allMessages.filter((t=>t.messageId!==i.messageIds));this.allConversationList=this.sortConversationsByLatestMessage(this.allConversationList.map((t=>{var e,s,o;if(t.conversationId===i.conversationId&&((e=t===null||t===void 0?void 0:t.lastMessageDetails)===null||e===void 0?void 0:e.messageId)===i.messageIds){const e=this.allMessages.filter((t=>t.conversationId===i.conversationId)).sort(((i,t)=>(i.sentAt||0)-(t.sentAt||0)));const n=e.length>0?e[e.length-1]:null;return Object.assign(Object.assign({},t),{lastMessageDetails:n?Object.assign(Object.assign({},n),{body:n.body,updatedAt:n.sentAt||Date.now(),action:n.action||"",senderName:(s=n===null||n===void 0?void 0:n.senderInfo)===null||s===void 0?void 0:s.userName,senderId:(o=n===null||n===void 0?void 0:n.senderInfo)===null||o===void 0?void 0:o.userId}):null})}return t})))}catch(i){console.error(i,"delete all error");g({type:"error",message:(i===null||i===void 0?void 0:i.message)||"Failed to delete the message",position:"bottom-right"})}finally{c.closeDialog("delete-message")}};this.typingTimeout=null;this.handleChatOpen=()=>{this.isChatClosed=false};this.handleSearchResultClick=async i=>{this.highlightedMessageId=i;const t=this.allMessages.some((t=>t.messageId===i));if(!t){while(!this.allMessages.some((t=>t.messageId===i))){await this.getMessages(this.skip);this.skip+=20}}const e=document.querySelector("web-chat-body");if(e){e.scrollToMessage(i)}};this.handleCloseChat=()=>{this.selectedConversationId=null;this.showSidebar=true;const i=new URL(window.location.href);i.searchParams.delete("conversation");i.searchParams.delete("groupcast");window.history.pushState({},"",i.toString());this.activeTab="Chat";c.closeDialog("confirm-dialog")};this.updateConversationList=i=>{const t=this.sortConversationsByLatestMessage(i);this.allConversationList=t;return t};this.getGroupCastContacts=async(i=0)=>{var t;this.activeTab="GroupCast";if(!this.hasMoreGroupcast||this.isLoadingMoreGroupcast)return;this.isLoadingMoreGroupcast=true;try{const e=await T({skip:i,limit:20});if(((t=e===null||e===void 0?void 0:e.groupcasts)===null||t===void 0?void 0:t.length)>0){this.allGroupCastContacts=i===0?e.groupcasts:[...this.allGroupCastContacts,...e.groupcasts];this.groupcastSkip=i}else{this.hasMoreGroupcast=false}}catch(i){console.error("Error fetching groupcast contacts:",i);this.hasMoreGroupcast=false}finally{this.isLoadingMoreGroupcast=false}};this.name=undefined;this.baseUrl=undefined;this.licenseKey=undefined;this.appSecret=undefined;this.userSecret=undefined;this.userToken=undefined;this.themeUrl=undefined;this.defaultTheme=undefined;this.isometrikUserId=undefined;this.projectId=undefined;this.keysetId=undefined;this.accountId=undefined;this.conversationId=undefined;this.hostUrl=undefined;this.groupcastEnabled=undefined;this.socialRedirectUrl=undefined;this.unreadConversations=[];this.allLinks=undefined;this.allLinksCount=undefined;this.isInitialized=false;this.findUserId={};this.mqttClient=null;this.mqttInitialized=false;this.isMqttConnected=false;this.allMessages=[];this.selectConversationMessages=[];this.userMetaData=null;this.allConversationList=[];this.conversationMetaData={};this.selctConversationMetaData={};this.isMessageLimitEnd=false;this.skip=0;this.isMessagesLoading=false;this.isMessageSending=false;this.deviceId="";this.isScrollToBottom=true;this.isScrollToTop=false;this.isConversationLoading=false;this.isLoadingConversationList=false;this.unreadConversationsCount=0;this.isChatClosed=false;this.isChatMinimized=false;this.isSubscribedToTopic=false;this.isMessageListenerAttached=false;this.isInitialCallDone=false;this.isTyping=false;this.typingUserName="";this.selectedConversationId=null;this.unreadMessageCount=null;this.unreadMessageCountFromApi=null;this.isLoading=true;this.loadingProgress=0;this.loadingStatus="Initializing...";this.isLoadingMessage=false;this.hasMoreConversations=false;this.eligibleMembers=[];this.membersListSkip=0;this.hasMoreEligibleMembers=true;this.isMobileView=false;this.showSidebar=false;this.isContactInfoOpen=false;this.isProfileInfoOpen=false;this.isOpenSearchBar=false;this.isChatFilter=false;this.isAllChatButton=true;this.isSidebarHeaderLabel=true;this.sidebarHeaderLabel="Chats";this.isSidebarHeaderSearch=true;this.sidebarColor="var(--bg-primary-color)";this.sidebarSelectedColor="var(--bg-primary-light)";this.messageSearchText="";this.searchedMessageDetails=[];this.initialConversationIdFromURL="";this.allAttachments=[];this.selectConverSationAttachments=[];this.highlightedMessageId=null;this.messageAction={action:"",initiator:false};this.replyMessage=null;this.loadingMediaGallery=false;this.activeTab="Chat";this.isInstagramConnected=false;this.showRightSideBar=false;this.conversationIdFromContactinfo="";this.exitedGroupIds=new Set;this.conversationCountSkip=0;this.typingConversationId=null;this.newMessageNotification=null;this.isBlocked=null;this.allGroupCastContacts=[];this.toggleTheme=undefined;this.groupcastSkip=0;this.isLoadingMoreGroupcast=false;this.hasMoreGroupcast=true;this.groupcastMembers=[];this.sidebarListWidth=360;this.isResizingSidebar=false}async handleConversationChange(){this.replyMessage=null;this.isBlocked=null;this.conversationMetaData={};this.allAttachments=[]}checkMobileView(){this.isMobileView=window.innerWidth<=768}componentWillLoad(){this.applyParentCreds();if(D())return;const i=new URLSearchParams(window.location.search);const t=i.has("groupcast");const e=i.get("conversation");const s=i.get("groupcast");this.initialConversationIdFromURL=t?s:e;this.isMobileView=window.innerWidth<=768;this.selectedConversationId=t?s:e;if(this.isMobileView&&(e||s)){this.showSidebar=false}else{this.showSidebar=true}try{const i=localStorage.getItem(this.SIDEBAR_WIDTH_KEY);if(i){this.sidebarListWidth=this.clampSidebarWidth(parseInt(i,10)||360)}}catch(i){}}async componentDidLoad(){try{try{this.updateLoading(10,"Getting device ID...");const i=await h();this.deviceId=i}catch(i){console.error("Error getting device ID:",i)}try{this.updateLoading(25,"Initializing chat SDK...");this.applyParentCreds();r.initializeInstance({baseUrl:l.baseUrl,licenseKey:l.licenseKey,appSecret:l.appSecret,userSecret:l.userSecret,userToken:l.userToken});this.isInitialized=true}catch(i){console.error("ChatSDK failed to initialize",i);this.isInitialized=false;throw new Error("Failed to initialize chat SDK")}try{this.updateLoading(40,"Setting up MQTT client...");await this.setupMqttClient()}catch(i){console.error("MQTT client setup failed:",i)}try{this.updateLoading(55,"Getting user details...");await this.getUserDetails();await this.handleSocialConnectCallback()}catch(i){console.error("Failed to get user details:",i)}try{this.updateLoading(65,"Checking social connections...");await this.refreshInstagramConnectionGate()}catch(i){console.error("Failed to check social accounts:",i);this.applySocialGate(false,{bootstrap:true})}if(!this.isInstagramConnected){this.activeTab="Accounts";this.updateLoading(100,"Connect Instagram or LinkedIn to continue");this.checkMobileView();window.addEventListener("resize",this.checkMobileView.bind(this));return}if(this.initialConversationIdFromURL){try{this.updateLoading(70,"Loading conversation...");this.selectedConversationId=this.initialConversationIdFromURL;const i=new URLSearchParams(window.location.search);const t=i.has("groupcast");if(t){await this.getGroupCastConversationDetails(this.initialConversationIdFromURL);const i=await U(this.initialConversationIdFromURL);if(i===null||i===void 0?void 0:i.messages){this.allMessages=i===null||i===void 0?void 0:i.messages.reverse()}}else{await this.getUserConversationDetails();await this.getMessages(0);await this.getAllAttachments(this.initialConversationIdFromURL)}}catch(i){console.error("Failed to load conversation details:",i)}}try{this.updateLoading(85,"Checking unread messages...");const i=await R();H.updateTotalUnreadCount(i);this.unreadConversationsCount=i;H.onChange("totalUnreadCount",(i=>{this.unreadConversationsCount=i}))}catch(i){console.error("Error fetching unread conversations:",i);this.unreadConversationsCount=0;H.updateTotalUnreadCount(0)}try{this.updateLoading(95,"Loading conversations...");await this.getConversations()}catch(i){console.error("Failed to load conversations:",i)}this.checkMobileView();window.addEventListener("resize",this.checkMobileView.bind(this));this.updateLoading(100,"Complete!")}catch(i){console.error("Critical initialization error:",i)}finally{setTimeout((()=>{this.isLoading=false}),500)}}updateLoading(i,t){this.loadingProgress=i;this.loadingStatus=t}disconnectedCallback(){window.removeEventListener("resize",this.checkMobileView.bind(this));window.removeEventListener("pointermove",this.onSidebarResizeMove);window.removeEventListener("pointerup",this.onSidebarResizeEnd);if(this.conversationDetailsInterval){clearInterval(this.conversationDetailsInterval)}}async setupMqttClient(){var i;const t=await h();this.applyParentCreds();const e=r.getInstance().initializeMqtt({hostUri:((i=this.hostUrl)===null||i===void 0?void 0:i.trim())||d.URL,clientId:l.isometrikUserId,licenseKey:l.licenseKey,projectId:l.projectId,keysetId:l.keysetId,accountId:l.accountId,deviceId:t});this.mqttClient=e;let s=null;this.isMqttConnected=false;this.mqttClient.client.on("connect",(async()=>{this.mqttInitialized=true;this.isMqttConnected=true;this.subscribeToMQTT();if(s){clearInterval(s);s=null}if(!this.isInitialCallDone&&this.selectedConversationId){await r.getInstance().message.putRead({conversationId:this.selectedConversationId});this.refetchMessages();this.isInitialCallDone=true}}));this.mqttClient.client.on("disconnect",(()=>{this.isMqttConnected=false}));this.mqttClient.client.on("error",(i=>{console.error("MQTT connection error:---\x3e",i);this.mqttInitialized=false;this.isMqttConnected=false;this.isInitialCallDone=true;if(!s){s=setInterval((()=>{console.error("MQTT connection failed, refetching messages...");this.refetchMessages()}),3e4)}}))}handleChatSelect(i){const t=typeof i==="string"?i:i.groupcastId;this.selectedConversationId=t;this.isProfileInfoOpen=false;this.isContactInfoOpen=false;this.isOpenSearchBar=false;const e=this.allConversationList.find((i=>(i===null||i===void 0?void 0:i.conversationId)===t));this.conversationMetaData=e?{isGroup:e===null||e===void 0?void 0:e.isGroup,conversationImageUrl:(e===null||e===void 0?void 0:e.isGroup)?e===null||e===void 0?void 0:e.conversationImageUrl:null,conversationTitle:(e===null||e===void 0?void 0:e.isGroup)?e===null||e===void 0?void 0:e.conversationTitle:null,opponentDetails:Object.assign({},e.opponentDetails)}:null;if(typeof i==="string"){this.getAllAttachments(t)}const s=new URL(window.location.href);s.search="";if(typeof i==="object"){s.searchParams.set("groupcast",i.groupcastId);this.activeTab="GroupCast";this.getGroupCastContacts();this.conversationMetaData=null}else{if(t){s.searchParams.set("conversation",t);if(this.isMobileView){this.showSidebar=false}}else{s.searchParams.delete("conversation");this.showSidebar=true}}window.history.pushState({},"",s);this.allConversationList=this.allConversationList.map((i=>{if(i.conversationId===t){i.unreadMessagesCount=0}return i}));this.unreadMessageCountUpdated.emit({detail:{conversationId:t,count:0}})}handleBackButton(){this.showSidebar=true;this.selectedConversationId=null;const i=new URL(window.location.href);i.searchParams.delete("conversation");window.history.pushState({},"",i)}sortConversationsByLatestMessage(i){return[...i].sort(((i,t)=>{var e,s,o,n,a,r,l,d,c,h;if((((e=i===null||i===void 0?void 0:i.lastMessageDetails)===null||e===void 0?void 0:e.action)=="chatMessageSent"||((s=i===null||i===void 0?void 0:i.lastMessageDetails)===null||s===void 0?void 0:s.action)=="forward")&&(((o=i===null||i===void 0?void 0:i.lastMessageDetails)===null||o===void 0?void 0:o.body)===""||((n=i===null||i===void 0?void 0:i.lastMessageDetails)===null||n===void 0?void 0:n.action)==="clearConversation"))return;if((((a=t===null||t===void 0?void 0:t.lastMessageDetails)===null||a===void 0?void 0:a.action)=="chatMessageSent"||((r=t===null||t===void 0?void 0:t.lastMessageDetails)===null||r===void 0?void 0:r.action)=="forward")&&(((l=t===null||t===void 0?void 0:t.lastMessageDetails)===null||l===void 0?void 0:l.body)===""||((d=t===null||t===void 0?void 0:t.lastMessageDetails)===null||d===void 0?void 0:d.action)==="clearConversation"))return;const u=(c=i===null||i===void 0?void 0:i.lastMessageDetails)===null||c===void 0?void 0:c.updatedAt;const v=(h=t===null||t===void 0?void 0:t.lastMessageDetails)===null||h===void 0?void 0:h.updatedAt;return v-u}))}subscribeToMQTT(){const i=`/${l.accountId}/${l.projectId}/Message/${l.isometrikUserId}`;if(!this.isSubscribedToTopic){this.mqttClient.client.subscribe(i,(t=>{if(t){console.error("Subscribed Failed to subscribe:---\x3e",t)}else{console.log(`Subscribed to MQTT topic---\x3e: ${i}`);this.isSubscribedToTopic=true}}))}if(!this.isMessageListenerAttached){this.mqttClient.client.on("message",(async(i,t)=>{var e,s,o,n,a,d,c,h,u,v,p,f,m,b,y,x,w,k,I,C,M,j,A,D,O,$,z,T,L,U,N,E;const B=JSON.parse(t.toString());console.log(`New Incoming message from ${i}:`,B);if(B.action==="conversationCreated"&&B.conversationDetails){const i=Object.assign({conversationId:B.conversationId,lastMessageDetails:{body:B===null||B===void 0?void 0:B.body,updatedAt:((e=B===null||B===void 0?void 0:B.conversationDetails)===null||e===void 0?void 0:e.updatedAt)||Date.now(),userName:B===null||B===void 0?void 0:B.senderName,userProfileImageUrl:B===null||B===void 0?void 0:B.senderProfileImageUrl,action:B===null||B===void 0?void 0:B.action,isDeliveredToAllMembers:false,isReadByAllMembers:false,senderId:B===null||B===void 0?void 0:B.senderId,sentAt:(B===null||B===void 0?void 0:B.sentAt)||0,members:(B===null||B===void 0?void 0:B.members)||[],senderName:B===null||B===void 0?void 0:B.senderName,messageId:B===null||B===void 0?void 0:B.messageId},isGroup:B.conversationDetails.isGroup,conversationTitle:B===null||B===void 0?void 0:B.conversationTitle,conversationImageUrl:B===null||B===void 0?void 0:B.conversationImageUrl},B===null||B===void 0?void 0:B.conversationDetails);this.allConversationList=this.sortConversationsByLatestMessage([i,...this.allConversationList])}if((B===null||B===void 0?void 0:B.action)==='"deleteConversationLocally"'){this.allConversationList=this.allConversationList.filter((i=>i.conversationId!==B.conversationId));if(this.selectedConversationId===B.conversationId){this.selectedConversationId=null;this.showSidebar=true;const i=new URL(window.location.href);i.searchParams.delete("conversation");window.history.pushState({},"",i)}}if((B===null||B===void 0?void 0:B.action)==="forward"){this.handleForwardMessage(B)}if((B===null||B===void 0?void 0:B.action)==="typingEvent"&&B.userId!=this.userMetaData.userId){this.isTyping=true;this.typingConversationId=B.conversationId;this.typingUserName=B.userName;setTimeout((()=>{if(this.typingConversationId===B.conversationId){this.isTyping=false;this.typingConversationId=null;this.typingUserName=""}}),3e3)}else if((B===null||B===void 0?void 0:B.action)!=="typingEvent"){this.isTyping=false;this.typingConversationId=null;this.typingUserName=""}if((B===null||B===void 0?void 0:B.action)==="multipleMessagesRead"&&B.userId!=((s=this.userMetaData)===null||s===void 0?void 0:s.userId)){this.allMessages=(o=this.allMessages)===null||o===void 0?void 0:o.map((i=>{var t,e;return(i===null||i===void 0?void 0:i.readByAll)!=true&&((i===null||i===void 0?void 0:i.senderId)||((t=i===null||i===void 0?void 0:i.senderInfo)===null||t===void 0?void 0:t.userId))==((e=this.userMetaData)===null||e===void 0?void 0:e.userId)?Object.assign(Object.assign({},i),{readByAll:true}):i}));this.messageReadStatusUpdated.emit({detail:{conversationId:B.conversationId,isRead:true,isDelivered:true,messageId:B.messageId}})}if((B===null||B===void 0?void 0:B.action)=="messagesDeleteForAll"){this.allMessages=this.allMessages.filter((i=>i.messageId!=B.messageIds[0]));if((B===null||B===void 0?void 0:B.userId)!==((n=this.userMetaData)===null||n===void 0?void 0:n.userId)){this.allConversationList=this.sortConversationsByLatestMessage(this.allConversationList.map((i=>{var t,e,s,o;if(i.conversationId===B.conversationId&&((t=i===null||i===void 0?void 0:i.lastMessageDetails)===null||t===void 0?void 0:t.messageId)===B.messageIds[0]){const t=i===null||i===void 0?void 0:i.lastMessageDetails;return Object.assign(Object.assign({},i),{lastMessageDetails:t?Object.assign(Object.assign({},t),{body:i.isGroup?`This Message Was Deleted`:`${(t===null||t===void 0?void 0:t.senderId)===((e=this.userMetaData)===null||e===void 0?void 0:e.userId)?"You":t===null||t===void 0?void 0:t.senderName} have Delete message`,updatedAt:B.sentAt||Date.now(),action:B.action||"",senderName:(B===null||B===void 0?void 0:B.userName)||((s=t===null||t===void 0?void 0:t.senderInfo)===null||s===void 0?void 0:s.userName),senderId:(t===null||t===void 0?void 0:t.userId)||((o=t===null||t===void 0?void 0:t.senderInfo)===null||o===void 0?void 0:o.userId)}):null})}if(i.conversationId===B.conversationId){return Object.assign(Object.assign({},i),{unreadMessagesCount:i.unreadMessagesCount-1})}return i})))}}if((B===null||B===void 0?void 0:B.senderId)==((a=this.userMetaData)===null||a===void 0?void 0:a.userId)&&((B===null||B===void 0?void 0:B.action)=="chatMessageSent"||(B===null||B===void 0?void 0:B.action)=="forward")){this.changeMessageSendingState(false);this.allMessages=this.allMessages.map((i=>{var t,e;if(i.messageId==B.messageId){return Object.assign(Object.assign({},B),{mentionedUsers:((t=B===null||B===void 0?void 0:B.mentionedUsers)===null||t===void 0?void 0:t.length)?(e=B===null||B===void 0?void 0:B.mentionedUsers)===null||e===void 0?void 0:e.map((t=>{const e=i.mentionedUsers.find((i=>i.userId===t.userId));return Object.assign(Object.assign({},t),{userName:e?e===null||e===void 0?void 0:e.userName:undefined})})):[]})}return i}))}if((B===null||B===void 0?void 0:B.action)=="messageDelivered"&&B.senderId!=((d=this.userMetaData)===null||d===void 0?void 0:d.userId)){this.allMessages=(c=this.allMessages)===null||c===void 0?void 0:c.map((i=>(i===null||i===void 0?void 0:i.messageId)===(B===null||B===void 0?void 0:B.messageId)?Object.assign(Object.assign({},i),{deliveredToAll:true}):i))}if((B===null||B===void 0?void 0:B.action)=="userBlockConversation"||B.action=="userUnblockConversation"||B.action=="userUnblock"){if(B.action==="userBlockConversation"){if(B.conversationId===this.selectedConversationId){this.conversationMetaData=Object.assign(Object.assign({},this.conversationMetaData),{messagingDisabled:true,updateBlockStatus:Date.now()})}this.allConversationList=this.sortConversationsByLatestMessage(this.allConversationList.map((i=>{var t;if(i.conversationId===B.conversationId){return Object.assign(Object.assign({},i),{lastMessageDetails:Object.assign(Object.assign({},i.lastMessageDetails),{body:`${(B===null||B===void 0?void 0:B.initiatorId)===((t=this.userMetaData)===null||t===void 0?void 0:t.userId)?`🚫 You blocked ${B===null||B===void 0?void 0:B.opponentName}`:`🚫 ${B===null||B===void 0?void 0:B.initiatorName} blocked you`}`,updatedAt:B.sentAt||Date.now(),action:B.action||"",initiatorName:B===null||B===void 0?void 0:B.initiatorName,initiatorId:B===null||B===void 0?void 0:B.initiatorId,opponentName:B===null||B===void 0?void 0:B.opponentName})})}if(i.conversationId===B.conversationId){return Object.assign(Object.assign({},i),{unreadMessagesCount:i.unreadMessagesCount-1})}return i})))}if(B.action=="userUnblock"||B.action==="userUnblockConversation"){if(B.conversationId===this.selectedConversationId){this.conversationMetaData=Object.assign(Object.assign({},this.conversationMetaData),{messagingDisabled:false,updateBlockStatus:Date.now()})}this.allConversationList=this.sortConversationsByLatestMessage(this.allConversationList.map((i=>{var t;if(i.conversationId===B.conversationId){return Object.assign(Object.assign({},i),{lastMessageDetails:Object.assign(Object.assign({},i.lastMessageDetails),{body:`${(B===null||B===void 0?void 0:B.initiatorId)===((t=this.userMetaData)===null||t===void 0?void 0:t.userId)?`You unblocked ${B===null||B===void 0?void 0:B.opponentName}`:`${B===null||B===void 0?void 0:B.initiatorName} unblocked you`}`,updatedAt:B.sentAt||Date.now(),action:B.action||"",initiatorName:B===null||B===void 0?void 0:B.initiatorName,initiatorId:B===null||B===void 0?void 0:B.initiatorId,opponentName:B===null||B===void 0?void 0:B.opponentName})})}if(i.conversationId===B.conversationId){return Object.assign(Object.assign({},i),{unreadMessagesCount:i.unreadMessagesCount-1})}return i})))}}if((B===null||B===void 0?void 0:B.action)==="reactionAdd"){const i=this.allMessages.some((i=>i.messageId===B.messageId));const t=B.conversationId===this.selectedConversationId||i&&this.selectedConversationId;if(t){this.allMessages=this.allMessages.map((i=>{if(i.messageId===B.messageId){const t=Object.assign({},i.reactions||{});let e=t[B.reactionType]||[];if(Array.isArray(e)&&e.length>0&&typeof e[0]==="object"){e=e.map((i=>i.userId||i))}const s=e.includes(B.userId);if(!s){const s=Object.assign(Object.assign({},t),{[B.reactionType]:[...e,B.userId]});return Object.assign(Object.assign({},i),{reactions:s})}return i}return i}))}}if((B===null||B===void 0?void 0:B.action)==="reactionRemove"){if(B.conversationId===this.selectedConversationId){this.allMessages=this.allMessages.map((i=>{if(i.messageId===B.messageId){const t=Object.assign({},i.reactions||{});const e=t[B.reactionType]||[];const s=Array.isArray(e)?e.filter((i=>i!==B.userId)):[];if(s.length>0){t[B.reactionType]=s}else{delete t[B.reactionType]}return Object.assign(Object.assign({},i),{reactions:t})}return i}))}}if((B===null||B===void 0?void 0:B.action)==="membersAdd"){const i=this.allConversationList.some((i=>i.conversationId===(B===null||B===void 0?void 0:B.conversationId)));if(B.conversationId===this.selectedConversationId){this.conversationMetaData.members=[...this.conversationMetaData.members,...B===null||B===void 0?void 0:B.members.map((i=>({userId:i.memberId,userName:i.memberName,userProfileImageUrl:i.memberProfileImageUrl,userIdentifier:i.memberIdentifier,isAdmin:i.isAdmin||false})))]}const t=(h=B.members)===null||h===void 0?void 0:h.some((i=>{var t;return i.memberId===((t=this.userMetaData)===null||t===void 0?void 0:t.userId)}));if(!i&&t){const i={conversationId:B.conversationId,isGroup:true,conversationTitle:B.conversationTitle,conversationImageUrl:B.conversationImageUrl,lastMessageDetails:{body:`${B===null||B===void 0?void 0:B.userName} added you`,sentAt:(B===null||B===void 0?void 0:B.sentAt)||Date.now(),action:"membersAdd",userName:B===null||B===void 0?void 0:B.userName,userProfileImageUrl:B===null||B===void 0?void 0:B.userProfileImageUrl,senderId:B===null||B===void 0?void 0:B.userId,senderName:B===null||B===void 0?void 0:B.userName,memberAdded:(u=B===null||B===void 0?void 0:B.members)===null||u===void 0?void 0:u.map((i=>i.memberName)),memberAddedUserId:(v=B===null||B===void 0?void 0:B.members)===null||v===void 0?void 0:v.map((i=>i.memberId))},unreadMessagesCount:1,members:B.members||[]};this.allConversationList=this.sortConversationsByLatestMessage([i,...this.allConversationList]);this.unreadMessageCountUpdated.emit({detail:{conversationId:B.conversationId,count:1}})}else if(i){this.allConversationList=this.sortConversationsByLatestMessage(this.allConversationList.map((i=>{var t,e,s,o;if(i.conversationId===B.conversationId){return Object.assign(Object.assign({},i),{lastMessageDetails:Object.assign(Object.assign({},i.lastMessageDetails),{body:`${B===null||B===void 0?void 0:B.userName} added ${(e=(t=B===null||B===void 0?void 0:B.members)===null||t===void 0?void 0:t[0])===null||e===void 0?void 0:e.memberName}`,sentAt:(B===null||B===void 0?void 0:B.sentAt)||Date.now(),action:"membersAdd",userName:B===null||B===void 0?void 0:B.userName,userProfileImageUrl:B===null||B===void 0?void 0:B.userProfileImageUrl,memberAdded:(s=B===null||B===void 0?void 0:B.members)===null||s===void 0?void 0:s.map((i=>i.memberName)),memberAddedUserId:(o=B===null||B===void 0?void 0:B.members)===null||o===void 0?void 0:o.map((i=>i.memberId)),members:[...i.members||[],...B.members]}),members:[...i.members||[],...B.members]})}return i})))}}if((B===null||B===void 0?void 0:B.action)==="membersRemove"){const i=this.allConversationList.some((i=>i.conversationId===(B===null||B===void 0?void 0:B.conversationId)));if(B.conversationId===this.selectedConversationId){this.conversationMetaData.members=(f=(p=this.conversationMetaData)===null||p===void 0?void 0:p.members)===null||f===void 0?void 0:f.filter((i=>{var t,e;return(i===null||i===void 0?void 0:i.userId)!==((e=(t=B===null||B===void 0?void 0:B.members)===null||t===void 0?void 0:t[0])===null||e===void 0?void 0:e.memberId)}))}if(i){this.allConversationList=this.sortConversationsByLatestMessage(this.allConversationList.map((i=>{var t,e,s;if(i.conversationId===B.conversationId){return Object.assign(Object.assign({},i),{lastMessageDetails:Object.assign(Object.assign({},i.lastMessageDetails),{body:`${B===null||B===void 0?void 0:B.userName} removed ${(t=B===null||B===void 0?void 0:B.members[0])===null||t===void 0?void 0:t.memberName}`,sentAt:(B===null||B===void 0?void 0:B.sentAt)||Date.now(),action:"membersRemove",userName:B===null||B===void 0?void 0:B.userName,userProfileImageUrl:B===null||B===void 0?void 0:B.userProfileImageUrl,memberAdded:(e=B===null||B===void 0?void 0:B.members)===null||e===void 0?void 0:e.map((i=>i.memberName)),memberAddedUserId:(s=B===null||B===void 0?void 0:B.members)===null||s===void 0?void 0:s.map((i=>i.memberId)),members:[...i.members||[],...B.members]}),members:[...i.members||[],...B.members]})}return i})))}}if((B===null||B===void 0?void 0:B.action)==="addAdmin"){const i=this.allConversationList.some((i=>i.conversationId===B.conversationId));if(B.conversationId===this.selectedConversationId){this.conversationMetaData.members=(b=(m=this.conversationMetaData)===null||m===void 0?void 0:m.members)===null||b===void 0?void 0:b.map((i=>Object.assign(Object.assign({},i),{isAdmin:i.userId===B.memberId?true:i.isAdmin})))}if(i){this.allConversationList=this.sortConversationsByLatestMessage(this.allConversationList.map((i=>{if(i.conversationId===B.conversationId){return Object.assign(Object.assign({},i),{lastMessageDetails:Object.assign(Object.assign({},i.lastMessageDetails),{body:`${(B===null||B===void 0?void 0:B.initiatorId)===this.userMetaData.userId?"you":B.memberName} made ${B===null||B===void 0?void 0:B.memberName} an admin`,sentAt:(B===null||B===void 0?void 0:B.sentAt)||Date.now(),action:B===null||B===void 0?void 0:B.action,userName:B===null||B===void 0?void 0:B.userName,userProfileImageUrl:B===null||B===void 0?void 0:B.userProfileImageUrl,initiatorId:B===null||B===void 0?void 0:B.initiatorId,initiatorName:B===null||B===void 0?void 0:B.initiatorName,memberName:B===null||B===void 0?void 0:B.memberName})})}return i})))}else if(!i){const i={conversationId:B.conversationId,lastMessageDetails:{body:`${(B===null||B===void 0?void 0:B.initiatorId)===this.userMetaData.userId?"you":B.memberName} made ${B===null||B===void 0?void 0:B.memberName} an admin`,sentAt:(B===null||B===void 0?void 0:B.sentAt)||Date.now(),action:B===null||B===void 0?void 0:B.action,userName:B===null||B===void 0?void 0:B.userName,userProfileImageUrl:B===null||B===void 0?void 0:B.userProfileImageUrl,initiatorId:B===null||B===void 0?void 0:B.initiatorId,initiatorName:B===null||B===void 0?void 0:B.initiatorName,memberName:B===null||B===void 0?void 0:B.memberName},isGroup:true,conversationTitle:B===null||B===void 0?void 0:B.conversationTitle,conversationImageUrl:B===null||B===void 0?void 0:B.conversationImageUrl};this.allConversationList=this.sortConversationsByLatestMessage([i,...this.allConversationList])}}if((B===null||B===void 0?void 0:B.action)==="removeAdmin"){const i=this.allConversationList.some((i=>i.conversationId===B.conversationId));if(B.conversationId===this.selectedConversationId){this.conversationMetaData.members=(x=(y=this.conversationMetaData)===null||y===void 0?void 0:y.members)===null||x===void 0?void 0:x.map((i=>Object.assign(Object.assign({},i),{isAdmin:i.userId===B.memberId?false:i.isAdmin})))}if(i){this.allConversationList=this.sortConversationsByLatestMessage(this.allConversationList.map((i=>{if(i.conversationId===B.conversationId){return Object.assign(Object.assign({},i),{lastMessageDetails:Object.assign(Object.assign({},i.lastMessageDetails),{body:`${(B===null||B===void 0?void 0:B.initiatorId)===this.userMetaData.userId?"you":B.memberName} removed ${B===null||B===void 0?void 0:B.memberName} as an admin`,sentAt:(B===null||B===void 0?void 0:B.sentAt)||Date.now(),action:B===null||B===void 0?void 0:B.action,userName:B===null||B===void 0?void 0:B.userName,userProfileImageUrl:B===null||B===void 0?void 0:B.userProfileImageUrl,initiatorId:B===null||B===void 0?void 0:B.initiatorId,initiatorName:B===null||B===void 0?void 0:B.initiatorName,memberName:B===null||B===void 0?void 0:B.memberName})})}return i})))}else if(!i){const i={conversationId:B.conversationId,lastMessageDetails:{body:`${(B===null||B===void 0?void 0:B.initiatorId)===this.userMetaData.userId?"you":B.memberName} removed ${B===null||B===void 0?void 0:B.memberName} as an admin`,sentAt:(B===null||B===void 0?void 0:B.sentAt)||Date.now(),action:B===null||B===void 0?void 0:B.action,userName:B===null||B===void 0?void 0:B.userName,userProfileImageUrl:B===null||B===void 0?void 0:B.userProfileImageUrl,initiatorId:B===null||B===void 0?void 0:B.initiatorId,initiatorName:B===null||B===void 0?void 0:B.initiatorName,memberName:B===null||B===void 0?void 0:B.memberName},isGroup:true,conversationTitle:B===null||B===void 0?void 0:B.conversationTitle,conversationImageUrl:B===null||B===void 0?void 0:B.conversationImageUrl};this.allConversationList=this.sortConversationsByLatestMessage([i,...this.allConversationList])}}if((B===null||B===void 0?void 0:B.action)=="chatMessageSent"||(B===null||B===void 0?void 0:B.action)=="forward"){const i=this.allConversationList.some((i=>i.conversationId===B.conversationId));const t=!B.privateOneToOne;if(!i){const i={conversationId:B.conversationId,lastMessageDetails:{body:B===null||B===void 0?void 0:B.body,updatedAt:(B===null||B===void 0?void 0:B.sentAt)||Date.now(),userName:B===null||B===void 0?void 0:B.senderName,userProfileImageUrl:B===null||B===void 0?void 0:B.senderProfileImageUrl,action:B===null||B===void 0?void 0:B.action,isDeliveredToAllMembers:false,isReadByAllMembers:false,isPendingAllMembers:false,senderId:B===null||B===void 0?void 0:B.senderId,sentAt:(B===null||B===void 0?void 0:B.sentAt)||0,members:(B===null||B===void 0?void 0:B.members)||[],senderName:B===null||B===void 0?void 0:B.senderName,messageId:B===null||B===void 0?void 0:B.messageId},isGroup:t,conversationTitle:B===null||B===void 0?void 0:B.conversationTitle,conversationImageUrl:B===null||B===void 0?void 0:B.conversationImageUrl,opponentDetails:!t?{userName:(B===null||B===void 0?void 0:B.senderId)!==((w=this.userMetaData)===null||w===void 0?void 0:w.userId)?B===null||B===void 0?void 0:B.senderName:(I=(k=this.conversationMetaData)===null||k===void 0?void 0:k.opponentDetails)===null||I===void 0?void 0:I.userName,userProfileImageUrl:(B===null||B===void 0?void 0:B.senderId)!==((C=this.userMetaData)===null||C===void 0?void 0:C.userId)?B===null||B===void 0?void 0:B.senderProfileImageUrl:(j=(M=this.conversationMetaData)===null||M===void 0?void 0:M.opponentDetails)===null||j===void 0?void 0:j.userProfileImageUrl,userId:(B===null||B===void 0?void 0:B.senderId)!==((A=this.userMetaData)===null||A===void 0?void 0:A.userId)?B===null||B===void 0?void 0:B.senderId:(O=(D=this.conversationMetaData)===null||D===void 0?void 0:D.opponentDetails)===null||O===void 0?void 0:O.userId}:null};this.allConversationList=this.sortConversationsByLatestMessage([i,...this.allConversationList])}else{this.allConversationList=this.sortConversationsByLatestMessage(this.allConversationList.map((i=>{if(i.conversationId===B.conversationId){return Object.assign(Object.assign({},i),{lastMessageDetails:Object.assign(Object.assign({},i.lastMessageDetails),{body:B.body,updatedAt:B.updatedAt||B.sentAt||Date.now(),attachments:(B===null||B===void 0?void 0:B.attachments)||[],action:B===null||B===void 0?void 0:B.action,isDeliveredToAllMembers:false,isReadByAllMembers:false,isPendingAllMembers:false,senderId:B.senderId,sentAt:(B===null||B===void 0?void 0:B.sentAt)||0,members:(B===null||B===void 0?void 0:B.members)||[],senderName:B===null||B===void 0?void 0:B.senderName,messageId:B===null||B===void 0?void 0:B.messageId,opponentDetails:i.opponentDetails}),isGroup:i.isGroup,conversationTitle:i.conversationTitle,conversationImageUrl:i.conversationImageUrl,opponentDetails:i.opponentDetails})}return i})))}this.allConversationList=this.sortConversationsByLatestMessage(this.allConversationList);if(B.conversationId===this.selectedConversationId){if(B.senderId!==(($=this.userMetaData)===null||$===void 0?void 0:$.userId)){const i=((z=this.newMessageNotification)===null||z===void 0?void 0:z.count)||0;this.newMessageNotification={messageId:B.messageId,count:i+1,conversationId:B.conversationId}}}}if((B===null||B===void 0?void 0:B.senderId)!=((T=this.userMetaData)===null||T===void 0?void 0:T.userId)&&(B===null||B===void 0?void 0:B.action)!="typingEvent"&&(B===null||B===void 0?void 0:B.action)!="messageRead"&&(B===null||B===void 0?void 0:B.action)!="multipleMessagesRead"&&(B===null||B===void 0?void 0:B.action)!="messageRead"&&(B===null||B===void 0?void 0:B.action)!="messagesDeleteForAll"&&(B===null||B===void 0?void 0:B.action)!="messagesDeleteLocal"&&(B===null||B===void 0?void 0:B.action)!="messageDelivered"&&(B===null||B===void 0?void 0:B.action)!="conversationCreated"){if(B.conversationId===this.selectedConversationId){this.allMessages=[...this.allMessages,B]}else{this.allConversationList=this.allConversationList.map((i=>{if(i.conversationId===(B===null||B===void 0?void 0:B.conversationId)){const t=parseInt(i.unreadMessagesCount)||0;i.unreadMessagesCount=t+1;this.unreadMessageCount=i.unreadMessagesCount}return i}))}this.unreadMessageCountUpdated.emit({detail:{conversationId:B.conversationId,count:1}});try{await r.getInstance().message.putIndicateDelivered({conversationId:B===null||B===void 0?void 0:B.conversationId,messageId:B===null||B===void 0?void 0:B.messageId})}catch(i){console.error(i,"putIndicateDelivered request error")}}if((B===null||B===void 0?void 0:B.action)==="messageDelivered"||(B===null||B===void 0?void 0:B.action)==="messageRead"){const i=(B===null||B===void 0?void 0:B.action)==="messageRead";const t=(B===null||B===void 0?void 0:B.action)==="messageDelivered";this.allConversationList=this.allConversationList.map((e=>{var s,o,n;if(e.conversationId===B.conversationId){const a=(s=e.lastMessageDetails)===null||s===void 0?void 0:s.readByAll;const r=(o=e.lastMessageDetails)===null||o===void 0?void 0:o.deliveredToAll;if(a!==i||r!==t){this.messageReadStatusUpdated.emit({detail:{conversationId:B===null||B===void 0?void 0:B.conversationId,isRead:i,isDelivered:t,messageId:B===null||B===void 0?void 0:B.messageId},bubbles:true,composed:true});return Object.assign(Object.assign({},e),{lastMessageDetails:Object.assign(Object.assign({},e.lastMessageDetails),{readByAll:i,deliveredToAll:t,senderId:(n=e.lastMessageDetails)===null||n===void 0?void 0:n.senderId})})}}return e}))}if((B===null||B===void 0?void 0:B.action)=="messageRead"&&B.senderId!=((L=this.userMetaData)===null||L===void 0?void 0:L.userId)){this.allMessages=(U=this.allMessages)===null||U===void 0?void 0:U.map((i=>(i===null||i===void 0?void 0:i.messageId)===(B===null||B===void 0?void 0:B.messageId)?Object.assign(Object.assign({},i),{readByAll:true}):i));this.messageReadStatusUpdated.emit({detail:{conversationId:B.conversationId,isRead:true,isDelivered:true,messageId:B.messageId}})}if(((B===null||B===void 0?void 0:B.action)=="chatMessageSent"||(B===null||B===void 0?void 0:B.action)=="forward")&&B.senderId!=((N=this.userMetaData)===null||N===void 0?void 0:N.userId)){const i=(E=this.allConversationList)===null||E===void 0?void 0:E.filter((i=>(i===null||i===void 0?void 0:i.unreadMessagesCount)>0));if((i===null||i===void 0?void 0:i.length)>0){H.updateTotalUnreadCount(i===null||i===void 0?void 0:i.length)}}if(i.includes("/members")){try{const i=JSON.parse(t.toString());if(i.type==="member_removed"&&i.conversationId===this.selectedConversationId){this.conversationMetaData=Object.assign(Object.assign({},this.conversationMetaData),{members:i.updatedMembers});S.initializeMembers(i.updatedMembers,i.conversationId);if(i.removedByUserId!==l.isometrikUserId){g({message:"A member has been removed from the group",type:"info",duration:3e3,position:"bottom-left"})}}}catch(i){console.error("Error handling member update message:",i)}}}));this.isMessageListenerAttached=true}}async handleForwardMessage(i){var t,e;try{const s=this.allConversationList.some((t=>t.conversationId===i.conversationId));if(!s){const s=await this.getUserConversationDetails(i.conversationId);const o={conversationId:i.conversationId,lastMessageDetails:{body:i.body,updatedAt:i.updatedAt||Date.now(),userName:(t=s===null||s===void 0?void 0:s.opponentDetails)===null||t===void 0?void 0:t.userName,userProfileImageUrl:(e=s===null||s===void 0?void 0:s.opponentDetails)===null||e===void 0?void 0:e.userProfileImageUrl},unreadMessagesCount:0};this.allConversationList=this.sortConversationsByLatestMessage([o,...this.allConversationList]);await this.getAllAttachments(o.conversationId)}else{this.allConversationList=this.sortConversationsByLatestMessage(this.allConversationList.map((t=>{if(t.conversationId===i.conversationId){return Object.assign(Object.assign({},t),{lastMessageDetails:Object.assign(Object.assign({},t.lastMessageDetails),{body:i.body,updatedAt:i.updatedAt||Date.now()}),isGroup:t.isGroup,conversationTitle:t.conversationTitle,conversationImageUrl:t.conversationImageUrl,opponentDetails:t.opponentDetails})}return t})))}this.unreadMessageCountUpdated.emit({detail:{conversationId:i.conversationId,count:1}})}catch(i){console.error("Error handling forward message:",i)}}async handleRemoveMemberClicked(i){var t;const e=i.detail.isGroupcast;const s=i.detail.userId;const o=((t=this.conversationMetaData)===null||t===void 0?void 0:t.members)||[];const n=i.detail.conversationId;try{if(e){N(n,s)}else{await v(this.selectedConversationId,s);const i=o.filter((i=>i.userId!==s));this.conversationMetaData=Object.assign(Object.assign({},this.conversationMetaData),{members:i});S.initializeMembers(i,this.selectedConversationId)}g({message:"Member removed successfully",type:"success",duration:3e3,position:"bottom-left"})}catch(i){console.error("Error removing member:",i);g({message:"Failed to remove member",type:"error",duration:3e3,position:"bottom-left"})}finally{c.closeDialog("confirm-dialog")}}async onProfileClick(i){if(i.type==="profile-clicked"){this.activeTab="Profile"}}async handleMembersListScrolledToBottom(i){try{this.hasMoreEligibleMembers=true;this.membersListSkip+=20;const t=await p(this.selectedConversationId);if(t.conversationEligibleMembers.length<20){this.hasMoreEligibleMembers=false}this.eligibleMembers=[...this.eligibleMembers,...t.conversationEligibleMembers];const e=i.target;e.isLoading=false}catch(t){console.error("Error loading more members:",t);this.hasMoreEligibleMembers=false;const e=i.target;e.isLoading=false}}async handleContactInfo(i){const{type:t}=i.detail;if(t==="close-right-Sidebar"){this.showRightSideBar=false;this.isOpenSearchBar=false;this.isContactInfoOpen=false;this.isProfileInfoOpen=false;this.searchedMessageDetails=[]}}async handleProfileInfo(i){const{type:t}=i.detail;if(t==="close-contact-info"){this.showRightSideBar=true;this.isContactInfoOpen=true;this.isProfileInfoOpen=false;this.searchedMessageDetails=[]}}async handleOpen(i){const{type:t,renderComponent:e,userId:s,userName:o}=i.detail;const{isGroupcast:n,groupcastId:a}=await u();if(t==="open-right-Sidebar"){this.showRightSideBar=true;if(e==="message-search-container"){this.isOpenSearchBar=true;this.isContactInfoOpen=false;this.isProfileInfoOpen=false}else if(e==="contact-info"){this.isContactInfoOpen=true;this.getAllLinksCount(this.selectedConversationId);if(n){this.getGroupcastMembers(a)}this.isOpenSearchBar=false}else if(e==="profile-info"){this.isContactInfoOpen=false;this.isProfileInfoOpen=true;this.isOpenSearchBar=false;this.getConversationId(s,o)}}}async getConversationId(i,t){try{const e={typingEvents:true,readEvents:true,pushNotifications:true,members:[i],isGroup:false,conversationType:0,searchableTags:[t]};const s=await r.getInstance().Conversation.postConversation(e);if(s.conversationId){this.conversationIdFromContactinfo=s.conversationId;this.getUserConversationDetails(s.conversationId);this.getAllAttachments(s.conversationId,"Profile-info");this.getMessages(0,s.conversationId)}}catch(i){console.error("Error creating conversation:",i)}}async handleGetLinks(i){const{conversationId:t}=i.detail;this.getAllLinks(t)}handleSkipChange(){if(!this.isMessageLimitEnd){this.getMessages(this.skip)}}handleTypingChange(){if(this.isTyping){if(this.typingTimeout){clearTimeout(this.typingTimeout)}this.typingTimeout=setTimeout((()=>{this.isTyping=false;this.typingUserName=""}),1e4)}}async handleSelectedConversationChange(i){if(i){this.isConversationLoading=true;const t=new URL(window.location.href);const e=t.searchParams.has("groupcast");if(e){const i=t.searchParams.get("groupcast");try{this.isScrollToBottom=true;this.isMessageLimitEnd=true;this.messageAction={action:"",initiator:false};this.skip=0;this.allMessages=[];await this.getGroupCastConversationDetails(i);const t=await U(i);if(t===null||t===void 0?void 0:t.messages){this.allMessages=t===null||t===void 0?void 0:t.messages.reverse()}}catch(i){console.error("Error while getting groupcast data",i)}}else{this.refetchMessages();this.getUserConversationDetails()}this.isConversationLoading=false;const s=this.allConversationList.find((t=>t.conversationId===i));if(s&&s.unreadMessagesCount>0){const i=H.getTotalUnreadCount();const t=Math.max(0,i-1);H.updateTotalUnreadCount(t)}}else{if(this.conversationDetailsInterval){clearInterval(this.conversationDetailsInterval)}}}async handlemessageAction(){this.getMessageAction()}handleGroupExited(i){const{conversationId:t}=i.detail;this.exitedGroupIds.add(t)}handleTaguserClick(i){const{userId:t,userName:e}=i.detail;if(t&&e){this.createConversation(t,e)}}async createConversation(i,t){try{const e={typingEvents:true,readEvents:true,pushNotifications:true,members:[i],isGroup:false,conversationType:0,searchableTags:[t]};const s=await r.getInstance().Conversation.postConversation(e);if(s.conversationId){this.handleChatSelect(s.conversationId)}}catch(i){console.error("Error creating conversation:",i)}}handleContactAction(i){const t=i.detail.action;switch(t){case"exit-group":break;case"block-contact":this.blockUser(i.detail.oppenentId,i.detail.userName);break;case"unblock-contact":this.unblockUser(i.detail.oppenentId,i.detail.userName);break;case"delete-chat":this.deleteConversation(i.detail.conversationId);break;case"clear-chat":this.clearConversation(i.detail.conversationId);break}}handleChatTileScrolledToBottom(){this.conversationCountSkip+=20;if(this.hasMoreConversations){this.getConversations(this.conversationCountSkip)}}resetNewMessageNotification(){this.newMessageNotification=null}async handleConversationUpdate(i){const{conversationId:t,type:e,value:s}=i.detail;if(e==="title"&&s){this.allConversationList=this.allConversationList.map((i=>i.conversationId===t?Object.assign(Object.assign({},i),{conversationTitle:s}):i))}else if(e==="image"&&s){this.allConversationList=this.allConversationList.map((i=>i.conversationId===t?Object.assign(Object.assign({},i),{conversationImageUrl:s}):i))}try{const i=await r.getInstance().Conversation.getConversationDetails(t,"true");if(i){this.allConversationList=this.allConversationList.map((e=>e.conversationId===t?Object.assign(Object.assign({},e),i):e));if(this.selectedConversationId===t){this.conversationMetaData=i}}}catch(i){console.error("Error refreshing conversation details:",i)}}async watchPropHandler(i){if((i===null||i===void 0?void 0:i.updateBlockStatus)||(i===null||i===void 0?void 0:i.messagingDisabled)&&this.isBlocked===null){await this.findBlokedUser()}}async findBlokedUser(){var i,t;this.isBlocked="loading";try{const e=await r.getInstance().user.getUserBlock({searchTag:(t=(i=this.conversationMetaData)===null||i===void 0?void 0:i.opponentDetails)===null||t===void 0?void 0:t.userName});const s=(e===null||e===void 0?void 0:e.users)||[];const o=s===null||s===void 0?void 0:s.find((i=>{var t,e;return(i===null||i===void 0?void 0:i.userId)===((e=(t=this.conversationMetaData)===null||t===void 0?void 0:t.opponentDetails)===null||e===void 0?void 0:e.userId)}));this.isBlocked=o?true:null}catch(i){this.isBlocked=null}finally{this.isConversationLoading=false}}handleGroupcastScroll(){if(this.hasMoreGroupcast&&!this.isLoadingMoreGroupcast){this.getGroupCastContacts(this.groupcastSkip+20)}}async handleDeleteGroupcast(i){var t;try{const e=(t=i===null||i===void 0?void 0:i.detail)===null||t===void 0?void 0:t.groupcastId;await E(e);this.allGroupCastContacts=this.allGroupCastContacts.filter((i=>i.groupcastId!==e));const s=new URL(window.location.href);s.searchParams.delete("groupcast");window.history.pushState({},"",s);this.selectedConversationId=null;this.showSidebar=true;g({message:"Groupcast deleted successfully",type:"success",duration:3e3,position:"bottom-left"})}catch(i){console.error("Error deleting groupcast:",i);g({message:"Error while deleting groupcast",type:"error",duration:3e3,position:"bottom-left"})}}render(){var i,t,o,n,a;return e(s,{key:"48018669b503b2bb6fee4d774d69800cad5e913e"},this.isLoading?e("chat-loading-placeholder",{progress:this.loadingProgress,loadingStatus:this.loadingStatus}):e(s,null,this.isConversationLoading?e("div",{class:"loaderoverlay"},e("spinner-loader",{height:"30px",width:"30px",spinTime:"1s",spinnerPrimaryColor:"var(--bg-primary-color)",spinnerSecondaryColor:"var(--text-primary-color)",spinnerBorderWidth:"2px"})):null,e("div",{class:{"isometrik-quickchat":true,"is-resizing":this.isResizingSidebar,"is-instagram-gate":!this.isInstagramConnected},style:{"--sidebar-width":`${this.sidebarListWidth}px`}},e("div",{class:{"chat-sidebar-container":true,hidden:this.isMobileView&&!this.showSidebar,"is-resizing":this.isResizingSidebar,"is-full-gate":!this.isInstagramConnected}},e("profile-sidebar",{userMetaData:this.userMetaData,activeTab:this.activeTab,openChat:this.openChatTab,openAccounts:()=>this.activeTab="Accounts",isMqttConnected:this.isMqttConnected,unreadConversationsCount:this.isInstagramConnected?this.unreadConversationsCount:0}),e("div",{class:"sidebar-tab"},this.activeTab==="GroupCast"?e("group-cast",{isLoadingMore:this.isLoadingMoreGroupcast,groupCastData:this.allGroupCastContacts,onGroupcastTileSelected:i=>this.handleChatSelect(i.detail)}):this.activeTab==="Chat"&&this.isInstagramConnected?e("chat-side-bar",{conversationDetails:this.conversationMetaData,isMqttConnected:this.isMqttConnected,unreadConversationsCount:this.unreadConversationsCount,hasMoreConversations:this.hasMoreConversations,userMetaData:this.userMetaData,onChatTileSelected:i=>this.handleChatSelect(i.detail),onDeleteConversation:i=>this.deleteConversation(i),conversationList:this.allConversationList,isTyping:this.isTyping,typingUserName:this.typingUserName,typingConversationId:this.typingConversationId,isChatFilter:this.isChatFilter,customTypes:[{type:"Test conversations",label:"Unread"},{type:"SingleChat",label:"Past"},{type:"Chatbot",label:"Present"}],isAllChatButton:this.isAllChatButton,filterTabsContainer:{display:"flex",gap:"10px",width:"100%",flexWrap:"wrap",marginBottom:"10px"},filterTab:{padding:"6px 12px",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-pill)",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.18s, color 0.18s",color:"var(--text-secondary-color)",fontSize:"13px",fontWeight:"500"},filterTabHover:{backgroundColor:"var(--bg-primary-light)",color:"var(--text-primary-color)"},isSidebarHeaderLabel:this.isSidebarHeaderLabel,isSidebarHeaderSearch:this.isSidebarHeaderSearch,sidebarHeaderLabel:this.sidebarHeaderLabel,sidebarColor:this.sidebarColor,sidebarSelectedColor:this.sidebarSelectedColor,onGroupExited:i=>this.handleGroupExited(i),handleSearchData:i=>this.getConversations(0,i,true),allMessages:this.allMessages,isConversationLoading:this.isLoadingConversationList}):this.activeTab==="Accounts"||!this.isInstagramConnected?e("instagram-accounts-panel",{agentUserId:(i=this.userMetaData)===null||i===void 0?void 0:i.userId,defaultTheme:this.defaultTheme,toggleTheme:this.toggleTheme,closeDrawer:this.closeAccountsDrawer,hideClose:!this.isInstagramConnected,onInstagramAccountsChange:i=>this.handleInstagramAccountsChange(i.detail||[])}):e("profile-page",{getUserDetails:this.getUserDetails,name:this.userMetaData.userName,profilePhotoUrl:this.userMetaData.userProfileImageUrl,closeDrawer:()=>this.activeTab=this.isInstagramConnected?"Chat":"Accounts",toggleTheme:this.toggleTheme,defaultTheme:this.defaultTheme,agentUserId:(t=this.userMetaData)===null||t===void 0?void 0:t.userId,onInstagramAccountsChanged:i=>this.handleInstagramAccountsChange(i.detail||[])})),!this.isMobileView&&this.isInstagramConnected?e("div",{class:{"sidebar-resize-handle":true,active:this.isResizingSidebar},role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar","aria-valuenow":this.sidebarListWidth,"aria-valuemin":this.SIDEBAR_MIN,"aria-valuemax":this.SIDEBAR_MAX,onPointerDown:this.startSidebarResize},e("span",{class:"sidebar-resize-grip","aria-hidden":"true"})):null),this.isInstagramConnected?e("div",{class:{"chat-body-container":true,show:this.isMobileView&&this.selectedConversationId&&!this.showSidebar}},this.selectedConversationId?e(s,null,e("web-chat-header",{searchedMessageDetails:this.searchedMessageDetails,onSearchHandler:i=>this.getMessagesByQuery(i),onSearchResultClick:this.handleSearchResultClick,headerBgColor:"var(--bg-primary-color)",headerLastSeenColor:"var(--text-last-seen)",headerSvgColor:"var(--text-primary-color)",headerUsernameColor:"var(--text-primary-color)",onClearConversation:()=>this.clearConversation(),conversationDetails:this.conversationMetaData,isTyping:this.isTyping&&this.selectedConversationId===this.typingConversationId,typingUserName:this.typingUserName,chatBodyRef:this.chatBodyRef,onTextClick:()=>this.getAllAttachments(this.selectedConversationId),allAttachments:this.allAttachments,lastSeen:(n=(o=this.conversationMetaData)===null||o===void 0?void 0:o.opponentDetails)===null||n===void 0?void 0:n.lastSeen,userMetaData:this.userMetaData,selectedConversationId:this.selectedConversationId,messageAction:this.messageAction,eligibleMembers:this.eligibleMembers,hasMoreEligibleMembers:this.hasMoreEligibleMembers,handleCloseChat:()=>this.handleCloseChat(),typingConversationId:this.typingConversationId,isBlocked:this.isBlocked,onBackButtonClick:this.handleBackButton}),e("web-chat-body",{ref:i=>this.chatBodyRef=i,allAttachments:this.allAttachments,isMessagesLoading:this.isMessagesLoading,updateSkip:this.updateSkip,isMessageLimitEnd:this.isMessageLimitEnd,allMessages:this.allMessages,userMetaData:this.userMetaData,skip:this.skip,isScrollToBottom:this.isScrollToBottom,changeScrollToBottomState:this.changeScrollToBottomState,isMessageSending:this.isMessageSending,isScrollToTop:this.isScrollToTop,changeScrollToTopState:this.changeScrollToTopState,deleteForSelf:this.deleteMessageFromSelf,deleteForAll:this.deleteMeassageFromEveryOne,isChatClosed:this.isChatClosed,isChatMinimized:this.isChatMinimized,updateAllMessages:this.updateAllMessages,selectedConversationId:this.selectedConversationId,highlightedMessageId:this.highlightedMessageId,onMediaClick:()=>this.getAllAttachments(this.selectedConversationId),onReplyMessageDetails:this.handleReplyMessage,conversationList:this.allConversationList,newMessageNotification:this.newMessageNotification,onNewMessageCountReset:()=>this.resetNewMessageNotification(),conversationDetails:this.conversationMetaData,loadingMediaGallery:this.loadingMediaGallery}),this.exitedGroupIds.has(this.selectedConversationId)?e("div",{style:{padding:"1rem",textAlign:"center",backgroundColor:"var(--bg-primary-color)",color:"var(--text-secondary-color)",borderTop:"1px solid var(--border-subtle)",fontSize:"13px"}},"You are no longer a member of this group"):this.isBlocked==="loading"?e("p",{class:"blockMessageContainer"},z.PLEASE_WAIT):((a=this.conversationMetaData)===null||a===void 0?void 0:a.messagingDisabled)?e("p",{class:"blockMessageContainer"},z.BLOCK_CHAT_MESSAGE):e("chat-footer",{userMetaData:this.userMetaData,updateAllMessages:this.updateAllMessages,changeMessageSendingState:this.changeMessageSendingState,changeScrollToBottomState:this.changeScrollToBottomState,refetchMessages:this.refetchMessages,allMessages:this.allMessages,selectedConversationId:this.selectedConversationId,replyMessage:this.replyMessage,handleremoveReplyMessage:this.handleremoveReplyMessage,conversationDetails:this.conversationMetaData,allConversationList:this.allConversationList,updateConversationListProp:this.updateConversationList})):e("div",{class:"noChatSelectedPlaceholder"},e("div",{class:"empty-mark","aria-hidden":"true"},e("span",null),e("span",null)),e("h2",null,"Select a chat"),e("p",null,"Open a thread on the left to get started."))):null,this.isInstagramConnected&&this.showRightSideBar?e("div",{class:"chat-sidebar-right"},e("web-chat-right-sidebar",{conversationMetaData:this.isProfileInfoOpen?this.selctConversationMetaData:this.conversationMetaData,selectedConversationId:this.selectedConversationId,hasMoreEligibleMembers:this.hasMoreEligibleMembers,eligibleMembers:this.eligibleMembers,allAttachments:this.isProfileInfoOpen?this.selectConverSationAttachments:this.allAttachments,userMetaData:this.userMetaData,messageAction:this.messageAction,searchedMessageDetails:this.searchedMessageDetails,onSearchHandler:i=>this.getMessagesByQuery(i),onSearchResultClick:this.handleSearchResultClick,isContactInfoOpen:this.isContactInfoOpen,isProfileInfoOpen:this.isProfileInfoOpen,isOpenSearchBar:this.isOpenSearchBar,chatBodyRef:this.chatBodyRef,isLoadingMessage:this.isLoadingMessage,conversationIdFromContactinfo:this.conversationIdFromContactinfo,openOwnProfile:()=>this.activeTab="Profile",handleChatSelect:i=>this.handleChatSelect(i),allLinks:this.allLinks,allLinksCount:this.allLinksCount,isBlocked:this.isBlocked,groupcastMembers:this.groupcastMembers})):null)))}static get watchers(){return{selectedConversationId:["handleConversationChange","handleSelectedConversationChange"],skip:["handleSkipChange"],isTyping:["handleTypingChange"],initialConversationIdFromURL:["handleSelectedConversationChange"],allMessages:["handlemessageAction"],selectConversationMessages:["handlemessageAction"],conversationMetaData:["watchPropHandler"]}}};Q.style=W;export{Q as W};
780
+ //# sourceMappingURL=p-9588b7ec.js.map