@seekhiwave/agent-widget 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +8 -0
- package/dist/react.d.ts +7 -0
- package/dist/react.js +1166 -0
- package/dist/script-entry.d.ts +10 -0
- package/dist/seekhiwave-widget.es.js +1166 -0
- package/dist/seekhiwave-widget.iife.js +1166 -0
- package/dist/styles.d.ts +1 -0
- package/dist/types.d.ts +112 -0
- package/dist/widget.d.ts +86 -0
- package/package.json +46 -4
- package/README.md +0 -3
|
@@ -0,0 +1,1166 @@
|
|
|
1
|
+
"use strict";var SeekhiWaveWidgetLib=(()=>{var A=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var K=(o,e)=>{for(var t in e)A(o,t,{get:e[t],enumerable:!0})},F=(o,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of j(e))!$.call(o,i)&&i!==t&&A(o,i,{get:()=>e[i],enumerable:!(s=P(e,i))||s.enumerable});return o};var q=o=>F(A({},"__esModule",{value:!0}),o);var te={};K(te,{mountSeekhiWaveWidget:()=>L});var H=`
|
|
2
|
+
:host {
|
|
3
|
+
all: initial;
|
|
4
|
+
--sw-bg: #080d19;
|
|
5
|
+
--sw-surface: #0f172a;
|
|
6
|
+
--sw-surface-2: #162036;
|
|
7
|
+
--sw-surface-3: #1e293b;
|
|
8
|
+
--sw-border: rgba(148, 163, 184, 0.16);
|
|
9
|
+
--sw-border-strong: rgba(148, 163, 184, 0.28);
|
|
10
|
+
--sw-text: #f8fafc;
|
|
11
|
+
--sw-text-muted: #94a3b8;
|
|
12
|
+
--sw-text-dim: #64748b;
|
|
13
|
+
--sw-accent: #f59e0b;
|
|
14
|
+
--sw-accent-soft: rgba(245, 158, 11, 0.14);
|
|
15
|
+
--sw-accent-glow: rgba(245, 158, 11, 0.32);
|
|
16
|
+
--sw-green: #22c55e;
|
|
17
|
+
--sw-red: #ef4444;
|
|
18
|
+
--sw-user-bubble: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
|
|
19
|
+
--sw-spectrum: linear-gradient(90deg, #ef4444 0%, #f59e0b 52%, #22c55e 100%);
|
|
20
|
+
--sw-shadow: 0 24px 64px rgba(2, 6, 23, 0.62), 0 4px 18px rgba(2, 6, 23, 0.35);
|
|
21
|
+
--sw-font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
22
|
+
font-family: var(--sw-font);
|
|
23
|
+
color: var(--sw-text);
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
-webkit-font-smoothing: antialiased;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
*, *::before, *::after {
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.sw-root {
|
|
33
|
+
position: fixed;
|
|
34
|
+
bottom: 22px;
|
|
35
|
+
right: 22px;
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
align-items: flex-end;
|
|
39
|
+
gap: 12px;
|
|
40
|
+
font-family: var(--sw-font);
|
|
41
|
+
color: var(--sw-text);
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.sw-root.sw-left {
|
|
46
|
+
right: auto;
|
|
47
|
+
left: 22px;
|
|
48
|
+
align-items: flex-start;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.sw-root > * {
|
|
52
|
+
pointer-events: auto;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* ---------- Launcher & Teaser Pill ---------- */
|
|
56
|
+
.sw-launcher-row {
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: 10px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.sw-root.sw-left .sw-launcher-row {
|
|
63
|
+
flex-direction: row-reverse;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.sw-teaser {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: 10px;
|
|
70
|
+
background: rgba(15, 23, 42, 0.96);
|
|
71
|
+
border: 1px solid var(--sw-border-strong);
|
|
72
|
+
color: var(--sw-text);
|
|
73
|
+
padding: 10px 14px;
|
|
74
|
+
border-radius: 14px;
|
|
75
|
+
font-size: 13px;
|
|
76
|
+
line-height: 1.35;
|
|
77
|
+
max-width: 260px;
|
|
78
|
+
box-shadow: 0 14px 36px rgba(2, 6, 23, 0.45);
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
animation: sw-fade-up 0.35s cubic-bezier(0.22, 1, 0.36, 1);
|
|
81
|
+
transition: transform 0.18s ease, border-color 0.18s ease;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.sw-teaser:hover {
|
|
85
|
+
transform: translateY(-2px);
|
|
86
|
+
border-color: rgba(245, 158, 11, 0.48);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.sw-teaser-close {
|
|
90
|
+
background: none;
|
|
91
|
+
border: none;
|
|
92
|
+
color: var(--sw-text-muted);
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
padding: 2px 4px;
|
|
95
|
+
font-size: 14px;
|
|
96
|
+
line-height: 1;
|
|
97
|
+
border-radius: 6px;
|
|
98
|
+
flex-shrink: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.sw-teaser-close:hover {
|
|
102
|
+
color: var(--sw-text);
|
|
103
|
+
background: rgba(148, 163, 184, 0.14);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.sw-launcher {
|
|
107
|
+
position: relative;
|
|
108
|
+
width: 60px;
|
|
109
|
+
height: 60px;
|
|
110
|
+
border-radius: 999px;
|
|
111
|
+
border: 1.5px solid rgba(251, 191, 36, 0.42);
|
|
112
|
+
background: radial-gradient(circle at 30% 25%, #1e293b 0%, #080d19 72%);
|
|
113
|
+
box-shadow: 0 14px 34px rgba(2, 6, 23, 0.55), 0 0 0 0 var(--sw-accent-glow);
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
justify-content: center;
|
|
118
|
+
padding: 0;
|
|
119
|
+
transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease, border-color 0.22s ease;
|
|
120
|
+
-webkit-tap-highlight-color: transparent;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.sw-launcher:hover {
|
|
124
|
+
transform: translateY(-2px) scale(1.04);
|
|
125
|
+
border-color: rgba(251, 191, 36, 0.85);
|
|
126
|
+
box-shadow: 0 18px 40px rgba(2, 6, 23, 0.65), 0 0 22px rgba(245, 158, 11, 0.28);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.sw-launcher:active {
|
|
130
|
+
transform: scale(0.95);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.sw-launcher-img {
|
|
134
|
+
width: 44px;
|
|
135
|
+
height: 44px;
|
|
136
|
+
border-radius: 999px;
|
|
137
|
+
object-fit: cover;
|
|
138
|
+
display: block;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.sw-launcher-icon-close {
|
|
142
|
+
display: none;
|
|
143
|
+
color: var(--sw-text);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.sw-root.sw-open .sw-launcher-img {
|
|
147
|
+
display: none;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.sw-root.sw-open .sw-launcher-icon-close {
|
|
151
|
+
display: flex;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.sw-status-dot {
|
|
155
|
+
position: absolute;
|
|
156
|
+
bottom: 2px;
|
|
157
|
+
right: 2px;
|
|
158
|
+
width: 13px;
|
|
159
|
+
height: 13px;
|
|
160
|
+
border-radius: 999px;
|
|
161
|
+
background: var(--sw-green);
|
|
162
|
+
border: 2.5px solid #080d19;
|
|
163
|
+
box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.sw-unread-badge {
|
|
167
|
+
position: absolute;
|
|
168
|
+
top: -4px;
|
|
169
|
+
right: -3px;
|
|
170
|
+
min-width: 20px;
|
|
171
|
+
height: 20px;
|
|
172
|
+
padding: 0 6px;
|
|
173
|
+
border-radius: 999px;
|
|
174
|
+
background: #ef4444;
|
|
175
|
+
color: #fff;
|
|
176
|
+
font-size: 11px;
|
|
177
|
+
font-weight: 700;
|
|
178
|
+
display: flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
border: 2px solid #080d19;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* ---------- Chat Panel ---------- */
|
|
185
|
+
.sw-panel {
|
|
186
|
+
position: relative;
|
|
187
|
+
width: 400px;
|
|
188
|
+
max-width: calc(100vw - 32px);
|
|
189
|
+
height: 620px;
|
|
190
|
+
max-height: calc(100dvh - 110px);
|
|
191
|
+
background: var(--sw-bg);
|
|
192
|
+
border: 1px solid var(--sw-border-strong);
|
|
193
|
+
border-radius: 22px;
|
|
194
|
+
box-shadow: var(--sw-shadow);
|
|
195
|
+
display: flex;
|
|
196
|
+
flex-direction: column;
|
|
197
|
+
overflow: hidden;
|
|
198
|
+
transform-origin: bottom right;
|
|
199
|
+
opacity: 0;
|
|
200
|
+
transform: translateY(14px) scale(0.96);
|
|
201
|
+
pointer-events: none;
|
|
202
|
+
visibility: hidden;
|
|
203
|
+
transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.22s;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.sw-root.sw-left .sw-panel {
|
|
207
|
+
transform-origin: bottom left;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.sw-root.sw-open .sw-panel {
|
|
211
|
+
opacity: 1;
|
|
212
|
+
transform: translateY(0) scale(1);
|
|
213
|
+
pointer-events: auto;
|
|
214
|
+
visibility: visible;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.sw-spectrum-bar {
|
|
218
|
+
height: 3px;
|
|
219
|
+
width: 100%;
|
|
220
|
+
background: var(--sw-spectrum);
|
|
221
|
+
flex-shrink: 0;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/* ---------- Header ---------- */
|
|
225
|
+
.sw-header {
|
|
226
|
+
display: flex;
|
|
227
|
+
align-items: center;
|
|
228
|
+
justify-content: space-between;
|
|
229
|
+
gap: 10px;
|
|
230
|
+
padding: 13px 14px 12px;
|
|
231
|
+
background: rgba(15, 23, 42, 0.94);
|
|
232
|
+
border-bottom: 1px solid var(--sw-border);
|
|
233
|
+
flex-shrink: 0;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.sw-header-brand {
|
|
237
|
+
display: flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
gap: 10px;
|
|
240
|
+
min-width: 0;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.sw-header-avatar-wrap {
|
|
244
|
+
position: relative;
|
|
245
|
+
width: 38px;
|
|
246
|
+
height: 38px;
|
|
247
|
+
flex-shrink: 0;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.sw-header-avatar {
|
|
251
|
+
width: 38px;
|
|
252
|
+
height: 38px;
|
|
253
|
+
border-radius: 999px;
|
|
254
|
+
object-fit: cover;
|
|
255
|
+
border: 1px solid rgba(251, 191, 36, 0.38);
|
|
256
|
+
background: #0f172a;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.sw-header-dot {
|
|
260
|
+
position: absolute;
|
|
261
|
+
bottom: 0;
|
|
262
|
+
right: 0;
|
|
263
|
+
width: 10px;
|
|
264
|
+
height: 10px;
|
|
265
|
+
border-radius: 999px;
|
|
266
|
+
background: var(--sw-green);
|
|
267
|
+
border: 2px solid #0f172a;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.sw-header-dot.sw-offline {
|
|
271
|
+
background: #f59e0b;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.sw-header-info {
|
|
275
|
+
min-width: 0;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.sw-header-title {
|
|
279
|
+
font-size: 14px;
|
|
280
|
+
font-weight: 700;
|
|
281
|
+
color: var(--sw-text);
|
|
282
|
+
letter-spacing: -0.01em;
|
|
283
|
+
white-space: nowrap;
|
|
284
|
+
overflow: hidden;
|
|
285
|
+
text-overflow: ellipsis;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.sw-header-sub {
|
|
289
|
+
font-size: 11.5px;
|
|
290
|
+
color: var(--sw-text-muted);
|
|
291
|
+
margin-top: 1px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.sw-header-actions {
|
|
295
|
+
display: flex;
|
|
296
|
+
align-items: center;
|
|
297
|
+
gap: 4px;
|
|
298
|
+
flex-shrink: 0;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.sw-icon-btn {
|
|
302
|
+
width: 32px;
|
|
303
|
+
height: 32px;
|
|
304
|
+
border-radius: 10px;
|
|
305
|
+
border: 1px solid transparent;
|
|
306
|
+
background: transparent;
|
|
307
|
+
color: var(--sw-text-muted);
|
|
308
|
+
display: flex;
|
|
309
|
+
align-items: center;
|
|
310
|
+
justify-content: center;
|
|
311
|
+
cursor: pointer;
|
|
312
|
+
transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
|
|
313
|
+
padding: 0;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.sw-icon-btn:hover {
|
|
317
|
+
background: rgba(148, 163, 184, 0.12);
|
|
318
|
+
color: var(--sw-text);
|
|
319
|
+
border-color: var(--sw-border);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/* ---------- Messages Stream ---------- */
|
|
323
|
+
.sw-messages {
|
|
324
|
+
flex: 1;
|
|
325
|
+
overflow-y: auto;
|
|
326
|
+
overflow-x: hidden;
|
|
327
|
+
padding: 16px 14px 14px;
|
|
328
|
+
display: flex;
|
|
329
|
+
flex-direction: column;
|
|
330
|
+
gap: 10px;
|
|
331
|
+
scroll-behavior: smooth;
|
|
332
|
+
overscroll-behavior: contain;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.sw-messages::-webkit-scrollbar {
|
|
336
|
+
width: 6px;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.sw-messages::-webkit-scrollbar-thumb {
|
|
340
|
+
background: rgba(148, 163, 184, 0.22);
|
|
341
|
+
border-radius: 999px;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.sw-welcome {
|
|
345
|
+
background: linear-gradient(155deg, rgba(22, 32, 54, 0.92), rgba(15, 23, 42, 0.92));
|
|
346
|
+
border: 1px solid var(--sw-border);
|
|
347
|
+
border-radius: 16px;
|
|
348
|
+
padding: 14px 15px;
|
|
349
|
+
margin-bottom: 4px;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.sw-welcome-eyebrow {
|
|
353
|
+
font-size: 10.5px;
|
|
354
|
+
font-weight: 700;
|
|
355
|
+
text-transform: uppercase;
|
|
356
|
+
letter-spacing: 0.12em;
|
|
357
|
+
color: #fbbf24;
|
|
358
|
+
margin-bottom: 6px;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.sw-welcome-text {
|
|
362
|
+
font-size: 13.5px;
|
|
363
|
+
line-height: 1.5;
|
|
364
|
+
color: #e2e8f0;
|
|
365
|
+
margin: 0 0 12px;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.sw-chips {
|
|
369
|
+
display: flex;
|
|
370
|
+
flex-wrap: wrap;
|
|
371
|
+
gap: 6px;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.sw-chip {
|
|
375
|
+
font-family: inherit;
|
|
376
|
+
font-size: 12px;
|
|
377
|
+
font-weight: 500;
|
|
378
|
+
color: #fde68a;
|
|
379
|
+
background: rgba(245, 158, 11, 0.11);
|
|
380
|
+
border: 1px solid rgba(245, 158, 11, 0.32);
|
|
381
|
+
border-radius: 999px;
|
|
382
|
+
padding: 6px 11px;
|
|
383
|
+
cursor: pointer;
|
|
384
|
+
transition: background 0.15s ease, transform 0.12s ease, border-color 0.15s ease;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.sw-chip:hover {
|
|
388
|
+
background: rgba(245, 158, 11, 0.22);
|
|
389
|
+
border-color: rgba(251, 191, 36, 0.65);
|
|
390
|
+
transform: translateY(-1px);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.sw-msg-row {
|
|
394
|
+
display: flex;
|
|
395
|
+
flex-direction: column;
|
|
396
|
+
max-width: 86%;
|
|
397
|
+
position: relative;
|
|
398
|
+
animation: sw-fade-up 0.2s ease-out;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.sw-msg-row.sw-user {
|
|
402
|
+
align-self: flex-end;
|
|
403
|
+
align-items: flex-end;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.sw-msg-row.sw-agent {
|
|
407
|
+
align-self: flex-start;
|
|
408
|
+
align-items: flex-start;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.sw-msg-row.sw-system {
|
|
412
|
+
align-self: center;
|
|
413
|
+
max-width: 94%;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.sw-bubble {
|
|
417
|
+
position: relative;
|
|
418
|
+
padding: 10px 13px;
|
|
419
|
+
border-radius: 16px;
|
|
420
|
+
font-size: 13.8px;
|
|
421
|
+
line-height: 1.52;
|
|
422
|
+
word-wrap: break-word;
|
|
423
|
+
overflow-wrap: anywhere;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.sw-user .sw-bubble {
|
|
427
|
+
background: var(--sw-user-bubble);
|
|
428
|
+
color: #ffffff;
|
|
429
|
+
border-bottom-right-radius: 5px;
|
|
430
|
+
box-shadow: 0 6px 18px rgba(29, 78, 216, 0.28);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.sw-agent .sw-bubble {
|
|
434
|
+
background: var(--sw-surface-2);
|
|
435
|
+
color: #f1f5f9;
|
|
436
|
+
border: 1px solid var(--sw-border);
|
|
437
|
+
border-bottom-left-radius: 5px;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.sw-system .sw-bubble {
|
|
441
|
+
background: rgba(239, 68, 68, 0.12);
|
|
442
|
+
border: 1px solid rgba(239, 68, 68, 0.34);
|
|
443
|
+
color: #fecaca;
|
|
444
|
+
font-size: 12.5px;
|
|
445
|
+
text-align: center;
|
|
446
|
+
border-radius: 12px;
|
|
447
|
+
padding: 8px 12px;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.sw-bubble a {
|
|
451
|
+
color: #fbbf24;
|
|
452
|
+
text-decoration: underline;
|
|
453
|
+
text-underline-offset: 2px;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.sw-user .sw-bubble a {
|
|
457
|
+
color: #fef08a;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.sw-bubble code {
|
|
461
|
+
background: rgba(2, 6, 23, 0.5);
|
|
462
|
+
padding: 1px 5px;
|
|
463
|
+
border-radius: 5px;
|
|
464
|
+
font-size: 12.5px;
|
|
465
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.sw-reaction {
|
|
469
|
+
position: absolute;
|
|
470
|
+
bottom: -10px;
|
|
471
|
+
left: -6px;
|
|
472
|
+
background: #0f172a;
|
|
473
|
+
border: 1px solid var(--sw-border-strong);
|
|
474
|
+
border-radius: 999px;
|
|
475
|
+
padding: 2px 6px;
|
|
476
|
+
font-size: 13px;
|
|
477
|
+
line-height: 1.2;
|
|
478
|
+
box-shadow: 0 4px 12px rgba(2, 6, 23, 0.45);
|
|
479
|
+
animation: sw-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.sw-time {
|
|
483
|
+
font-size: 10px;
|
|
484
|
+
color: var(--sw-text-dim);
|
|
485
|
+
margin-top: 4px;
|
|
486
|
+
padding: 0 3px;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/* ---------- Action Buttons & Quick Replies ---------- */
|
|
490
|
+
.sw-url-buttons {
|
|
491
|
+
display: flex;
|
|
492
|
+
flex-wrap: wrap;
|
|
493
|
+
gap: 6px;
|
|
494
|
+
margin-top: 8px;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.sw-url-btn {
|
|
498
|
+
display: inline-flex;
|
|
499
|
+
align-items: center;
|
|
500
|
+
gap: 5px;
|
|
501
|
+
padding: 7px 11px;
|
|
502
|
+
border-radius: 10px;
|
|
503
|
+
background: rgba(245, 158, 11, 0.14);
|
|
504
|
+
border: 1px solid rgba(245, 158, 11, 0.38);
|
|
505
|
+
color: #fde68a !important;
|
|
506
|
+
text-decoration: none !important;
|
|
507
|
+
font-size: 12.2px;
|
|
508
|
+
font-weight: 600;
|
|
509
|
+
transition: background 0.15s ease, transform 0.12s ease;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.sw-url-btn:hover {
|
|
513
|
+
background: rgba(245, 158, 11, 0.26);
|
|
514
|
+
transform: translateY(-1px);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.sw-quick-replies {
|
|
518
|
+
display: flex;
|
|
519
|
+
flex-wrap: wrap;
|
|
520
|
+
gap: 6px;
|
|
521
|
+
margin-top: 7px;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/* ---------- Image Card ---------- */
|
|
525
|
+
.sw-image-card {
|
|
526
|
+
width: 100%;
|
|
527
|
+
background: var(--sw-surface-2);
|
|
528
|
+
border: 1px solid var(--sw-border);
|
|
529
|
+
border-radius: 16px;
|
|
530
|
+
overflow: hidden;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.sw-image-card img {
|
|
534
|
+
display: block;
|
|
535
|
+
width: 100%;
|
|
536
|
+
max-height: 210px;
|
|
537
|
+
object-fit: cover;
|
|
538
|
+
cursor: pointer;
|
|
539
|
+
background: #0b1120;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.sw-image-card-body {
|
|
543
|
+
padding: 10px 12px;
|
|
544
|
+
font-size: 13.2px;
|
|
545
|
+
line-height: 1.48;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/* ---------- Branded PDF Card ---------- */
|
|
549
|
+
.sw-pdf-card {
|
|
550
|
+
width: 100%;
|
|
551
|
+
min-width: 245px;
|
|
552
|
+
background: linear-gradient(155deg, #162036 0%, #0f172a 100%);
|
|
553
|
+
border: 1px solid rgba(245, 158, 11, 0.35);
|
|
554
|
+
border-radius: 16px;
|
|
555
|
+
padding: 12px 13px;
|
|
556
|
+
display: flex;
|
|
557
|
+
flex-direction: column;
|
|
558
|
+
gap: 10px;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.sw-pdf-top {
|
|
562
|
+
display: flex;
|
|
563
|
+
align-items: center;
|
|
564
|
+
gap: 10px;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.sw-pdf-badge {
|
|
568
|
+
width: 40px;
|
|
569
|
+
height: 40px;
|
|
570
|
+
border-radius: 11px;
|
|
571
|
+
background: rgba(239, 68, 68, 0.16);
|
|
572
|
+
border: 1px solid rgba(239, 68, 68, 0.38);
|
|
573
|
+
color: #fca5a5;
|
|
574
|
+
font-size: 11px;
|
|
575
|
+
font-weight: 800;
|
|
576
|
+
letter-spacing: 0.06em;
|
|
577
|
+
display: flex;
|
|
578
|
+
align-items: center;
|
|
579
|
+
justify-content: center;
|
|
580
|
+
flex-shrink: 0;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.sw-pdf-meta {
|
|
584
|
+
min-width: 0;
|
|
585
|
+
flex: 1;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.sw-pdf-name {
|
|
589
|
+
font-size: 13px;
|
|
590
|
+
font-weight: 700;
|
|
591
|
+
color: var(--sw-text);
|
|
592
|
+
white-space: nowrap;
|
|
593
|
+
overflow: hidden;
|
|
594
|
+
text-overflow: ellipsis;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
.sw-pdf-sub {
|
|
598
|
+
font-size: 11.5px;
|
|
599
|
+
color: var(--sw-text-muted);
|
|
600
|
+
margin-top: 2px;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.sw-pdf-caption {
|
|
604
|
+
font-size: 12.8px;
|
|
605
|
+
line-height: 1.48;
|
|
606
|
+
color: #cbd5e1;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
.sw-pdf-dl {
|
|
610
|
+
display: inline-flex;
|
|
611
|
+
align-items: center;
|
|
612
|
+
justify-content: center;
|
|
613
|
+
gap: 7px;
|
|
614
|
+
width: 100%;
|
|
615
|
+
padding: 9px 12px;
|
|
616
|
+
border-radius: 11px;
|
|
617
|
+
background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
|
|
618
|
+
color: #080d19 !important;
|
|
619
|
+
text-decoration: none !important;
|
|
620
|
+
font-size: 12.8px;
|
|
621
|
+
font-weight: 700;
|
|
622
|
+
cursor: pointer;
|
|
623
|
+
border: none;
|
|
624
|
+
transition: filter 0.15s ease, transform 0.12s ease;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.sw-pdf-dl:hover {
|
|
628
|
+
filter: brightness(1.08);
|
|
629
|
+
transform: translateY(-1px);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/* ---------- Voice Audio Bubble ---------- */
|
|
633
|
+
.sw-voice-bubble {
|
|
634
|
+
display: flex;
|
|
635
|
+
flex-direction: column;
|
|
636
|
+
gap: 7px;
|
|
637
|
+
min-width: 230px;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.sw-voice-row {
|
|
641
|
+
display: flex;
|
|
642
|
+
align-items: center;
|
|
643
|
+
gap: 10px;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
.sw-voice-play {
|
|
647
|
+
width: 34px;
|
|
648
|
+
height: 34px;
|
|
649
|
+
border-radius: 999px;
|
|
650
|
+
border: none;
|
|
651
|
+
background: #f59e0b;
|
|
652
|
+
color: #080d19;
|
|
653
|
+
display: flex;
|
|
654
|
+
align-items: center;
|
|
655
|
+
justify-content: center;
|
|
656
|
+
cursor: pointer;
|
|
657
|
+
flex-shrink: 0;
|
|
658
|
+
padding: 0;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
.sw-user .sw-voice-play {
|
|
662
|
+
background: #ffffff;
|
|
663
|
+
color: #1d4ed8;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
.sw-voice-track {
|
|
667
|
+
flex: 1;
|
|
668
|
+
display: flex;
|
|
669
|
+
flex-direction: column;
|
|
670
|
+
gap: 4px;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
.sw-voice-bar {
|
|
674
|
+
height: 5px;
|
|
675
|
+
width: 100%;
|
|
676
|
+
border-radius: 999px;
|
|
677
|
+
background: rgba(148, 163, 184, 0.28);
|
|
678
|
+
overflow: hidden;
|
|
679
|
+
cursor: pointer;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
.sw-voice-fill {
|
|
683
|
+
height: 100%;
|
|
684
|
+
width: 0%;
|
|
685
|
+
background: #fbbf24;
|
|
686
|
+
border-radius: 999px;
|
|
687
|
+
transition: width 0.12s linear;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
.sw-user .sw-voice-fill {
|
|
691
|
+
background: #ffffff;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
.sw-voice-meta {
|
|
695
|
+
display: flex;
|
|
696
|
+
justify-content: space-between;
|
|
697
|
+
font-size: 10.5px;
|
|
698
|
+
color: var(--sw-text-muted);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.sw-user .sw-voice-meta {
|
|
702
|
+
color: rgba(255, 255, 255, 0.82);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/* ---------- Portfolio Carousel ---------- */
|
|
706
|
+
.sw-carousel {
|
|
707
|
+
width: 100%;
|
|
708
|
+
min-width: 280px;
|
|
709
|
+
background: var(--sw-surface-2);
|
|
710
|
+
border: 1px solid var(--sw-border-strong);
|
|
711
|
+
border-radius: 16px;
|
|
712
|
+
overflow: hidden;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
.sw-carousel-media {
|
|
716
|
+
position: relative;
|
|
717
|
+
width: 100%;
|
|
718
|
+
height: 158px;
|
|
719
|
+
background: #0b1120;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
.sw-carousel-media img {
|
|
723
|
+
width: 100%;
|
|
724
|
+
height: 100%;
|
|
725
|
+
object-fit: cover;
|
|
726
|
+
display: block;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
.sw-carousel-counter {
|
|
730
|
+
position: absolute;
|
|
731
|
+
top: 10px;
|
|
732
|
+
right: 10px;
|
|
733
|
+
background: rgba(8, 13, 25, 0.82);
|
|
734
|
+
border: 1px solid rgba(255, 255, 255, 0.16);
|
|
735
|
+
color: #f8fafc;
|
|
736
|
+
font-size: 11px;
|
|
737
|
+
font-weight: 700;
|
|
738
|
+
padding: 3px 9px;
|
|
739
|
+
border-radius: 999px;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
.sw-carousel-body {
|
|
743
|
+
padding: 12px 13px;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
.sw-carousel-industry {
|
|
747
|
+
font-size: 10.5px;
|
|
748
|
+
font-weight: 700;
|
|
749
|
+
text-transform: uppercase;
|
|
750
|
+
letter-spacing: 0.1em;
|
|
751
|
+
color: #fbbf24;
|
|
752
|
+
margin-bottom: 4px;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
.sw-carousel-title {
|
|
756
|
+
font-size: 15px;
|
|
757
|
+
font-weight: 700;
|
|
758
|
+
color: var(--sw-text);
|
|
759
|
+
margin: 0 0 6px;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
.sw-carousel-summary {
|
|
763
|
+
font-size: 12.6px;
|
|
764
|
+
line-height: 1.48;
|
|
765
|
+
color: #cbd5e1;
|
|
766
|
+
margin: 0 0 11px;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
.sw-carousel-cta {
|
|
770
|
+
display: grid;
|
|
771
|
+
grid-template-columns: 1fr 1fr;
|
|
772
|
+
gap: 7px;
|
|
773
|
+
margin-bottom: 9px;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
.sw-btn-secondary, .sw-btn-primary {
|
|
777
|
+
font-family: inherit;
|
|
778
|
+
font-size: 12px;
|
|
779
|
+
font-weight: 600;
|
|
780
|
+
padding: 8px 10px;
|
|
781
|
+
border-radius: 10px;
|
|
782
|
+
text-align: center;
|
|
783
|
+
text-decoration: none;
|
|
784
|
+
cursor: pointer;
|
|
785
|
+
display: inline-flex;
|
|
786
|
+
align-items: center;
|
|
787
|
+
justify-content: center;
|
|
788
|
+
gap: 4px;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
.sw-btn-secondary {
|
|
792
|
+
background: rgba(148, 163, 184, 0.12);
|
|
793
|
+
border: 1px solid var(--sw-border-strong);
|
|
794
|
+
color: var(--sw-text);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
.sw-btn-secondary:hover {
|
|
798
|
+
background: rgba(148, 163, 184, 0.22);
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
.sw-btn-primary {
|
|
802
|
+
background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
|
|
803
|
+
border: none;
|
|
804
|
+
color: #080d19;
|
|
805
|
+
font-weight: 700;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
.sw-btn-primary:hover {
|
|
809
|
+
filter: brightness(1.07);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
.sw-carousel-nav {
|
|
813
|
+
display: flex;
|
|
814
|
+
align-items: center;
|
|
815
|
+
justify-content: space-between;
|
|
816
|
+
border-top: 1px solid var(--sw-border);
|
|
817
|
+
padding-top: 8px;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
.sw-carousel-nav button {
|
|
821
|
+
font-family: inherit;
|
|
822
|
+
background: rgba(148, 163, 184, 0.1);
|
|
823
|
+
border: 1px solid var(--sw-border);
|
|
824
|
+
color: var(--sw-text);
|
|
825
|
+
border-radius: 8px;
|
|
826
|
+
padding: 5px 10px;
|
|
827
|
+
font-size: 12px;
|
|
828
|
+
font-weight: 600;
|
|
829
|
+
cursor: pointer;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
.sw-carousel-nav button:hover {
|
|
833
|
+
background: rgba(148, 163, 184, 0.2);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
/* ---------- Typing Indicator ---------- */
|
|
837
|
+
.sw-typing {
|
|
838
|
+
display: none;
|
|
839
|
+
align-self: flex-start;
|
|
840
|
+
align-items: center;
|
|
841
|
+
gap: 8px;
|
|
842
|
+
background: var(--sw-surface-2);
|
|
843
|
+
border: 1px solid var(--sw-border);
|
|
844
|
+
border-radius: 16px;
|
|
845
|
+
border-bottom-left-radius: 5px;
|
|
846
|
+
padding: 10px 14px;
|
|
847
|
+
margin: 0 14px 10px;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
.sw-typing.sw-visible {
|
|
851
|
+
display: inline-flex;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
.sw-dots {
|
|
855
|
+
display: inline-flex;
|
|
856
|
+
gap: 4px;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
.sw-dots span {
|
|
860
|
+
width: 6px;
|
|
861
|
+
height: 6px;
|
|
862
|
+
border-radius: 999px;
|
|
863
|
+
background: #fbbf24;
|
|
864
|
+
animation: sw-bounce 1.2s infinite ease-in-out;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
.sw-dots span:nth-child(2) { animation-delay: 0.18s; }
|
|
868
|
+
.sw-dots span:nth-child(3) { animation-delay: 0.36s; }
|
|
869
|
+
|
|
870
|
+
.sw-typing-label {
|
|
871
|
+
font-size: 12px;
|
|
872
|
+
color: var(--sw-text-muted);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/* ---------- Drag & Drop Overlay ---------- */
|
|
876
|
+
.sw-drop-overlay {
|
|
877
|
+
position: absolute;
|
|
878
|
+
inset: 0;
|
|
879
|
+
background: rgba(8, 13, 25, 0.88);
|
|
880
|
+
backdrop-filter: blur(6px);
|
|
881
|
+
border: 2px dashed #f59e0b;
|
|
882
|
+
border-radius: 20px;
|
|
883
|
+
margin: 8px;
|
|
884
|
+
display: none;
|
|
885
|
+
flex-direction: column;
|
|
886
|
+
align-items: center;
|
|
887
|
+
justify-content: center;
|
|
888
|
+
gap: 8px;
|
|
889
|
+
z-index: 20;
|
|
890
|
+
pointer-events: none;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
.sw-drop-overlay.sw-visible {
|
|
894
|
+
display: flex;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
.sw-drop-title {
|
|
898
|
+
font-size: 15px;
|
|
899
|
+
font-weight: 700;
|
|
900
|
+
color: #fde68a;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
.sw-drop-sub {
|
|
904
|
+
font-size: 12.5px;
|
|
905
|
+
color: var(--sw-text-muted);
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
/* ---------- Composer / Input Bar ---------- */
|
|
909
|
+
.sw-composer {
|
|
910
|
+
padding: 10px 12px 12px;
|
|
911
|
+
background: rgba(15, 23, 42, 0.96);
|
|
912
|
+
border-top: 1px solid var(--sw-border);
|
|
913
|
+
flex-shrink: 0;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
.sw-recording-bar {
|
|
917
|
+
display: none;
|
|
918
|
+
align-items: center;
|
|
919
|
+
justify-content: space-between;
|
|
920
|
+
gap: 10px;
|
|
921
|
+
background: rgba(239, 68, 68, 0.14);
|
|
922
|
+
border: 1px solid rgba(239, 68, 68, 0.42);
|
|
923
|
+
border-radius: 14px;
|
|
924
|
+
padding: 8px 12px;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
.sw-recording-bar.sw-visible {
|
|
928
|
+
display: flex;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
.sw-rec-status {
|
|
932
|
+
display: flex;
|
|
933
|
+
align-items: center;
|
|
934
|
+
gap: 8px;
|
|
935
|
+
font-size: 13px;
|
|
936
|
+
font-weight: 600;
|
|
937
|
+
color: #fecaca;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
.sw-rec-dot {
|
|
941
|
+
width: 9px;
|
|
942
|
+
height: 9px;
|
|
943
|
+
border-radius: 999px;
|
|
944
|
+
background: #ef4444;
|
|
945
|
+
animation: sw-pulse 1s infinite;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
.sw-rec-actions {
|
|
949
|
+
display: flex;
|
|
950
|
+
gap: 6px;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
.sw-input-row {
|
|
954
|
+
display: flex;
|
|
955
|
+
align-items: flex-end;
|
|
956
|
+
gap: 7px;
|
|
957
|
+
background: var(--sw-bg);
|
|
958
|
+
border: 1px solid var(--sw-border-strong);
|
|
959
|
+
border-radius: 15px;
|
|
960
|
+
padding: 6px 7px;
|
|
961
|
+
transition: border-color 0.18s ease, box-shadow 0.18s ease;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
.sw-input-row:focus-within {
|
|
965
|
+
border-color: rgba(245, 158, 11, 0.6);
|
|
966
|
+
box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
.sw-input-row.sw-hidden {
|
|
970
|
+
display: none;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
.sw-textarea {
|
|
974
|
+
flex: 1;
|
|
975
|
+
background: transparent;
|
|
976
|
+
border: none;
|
|
977
|
+
outline: none;
|
|
978
|
+
color: var(--sw-text);
|
|
979
|
+
font-family: inherit;
|
|
980
|
+
font-size: 14px;
|
|
981
|
+
line-height: 1.4;
|
|
982
|
+
max-height: 100px;
|
|
983
|
+
min-height: 24px;
|
|
984
|
+
resize: none;
|
|
985
|
+
padding: 5px 4px;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
.sw-textarea::placeholder {
|
|
989
|
+
color: var(--sw-text-dim);
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
.sw-send-btn {
|
|
993
|
+
width: 34px;
|
|
994
|
+
height: 34px;
|
|
995
|
+
border-radius: 11px;
|
|
996
|
+
border: none;
|
|
997
|
+
background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
|
|
998
|
+
color: #080d19;
|
|
999
|
+
display: flex;
|
|
1000
|
+
align-items: center;
|
|
1001
|
+
justify-content: center;
|
|
1002
|
+
cursor: pointer;
|
|
1003
|
+
flex-shrink: 0;
|
|
1004
|
+
padding: 0;
|
|
1005
|
+
transition: transform 0.14s ease, filter 0.14s ease;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
.sw-send-btn:hover {
|
|
1009
|
+
filter: brightness(1.08);
|
|
1010
|
+
transform: translateY(-1px);
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
.sw-send-btn:active {
|
|
1014
|
+
transform: scale(0.94);
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
.sw-footer-note {
|
|
1018
|
+
display: flex;
|
|
1019
|
+
align-items: center;
|
|
1020
|
+
justify-content: space-between;
|
|
1021
|
+
margin-top: 7px;
|
|
1022
|
+
padding: 0 3px;
|
|
1023
|
+
font-size: 10.5px;
|
|
1024
|
+
color: var(--sw-text-dim);
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
.sw-footer-note a {
|
|
1028
|
+
color: var(--sw-text-muted);
|
|
1029
|
+
text-decoration: none;
|
|
1030
|
+
font-weight: 600;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
.sw-footer-note a:hover {
|
|
1034
|
+
color: #fbbf24;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/* ---------- Animations ---------- */
|
|
1038
|
+
@keyframes sw-fade-up {
|
|
1039
|
+
from { opacity: 0; transform: translateY(6px); }
|
|
1040
|
+
to { opacity: 1; transform: translateY(0); }
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
@keyframes sw-pop {
|
|
1044
|
+
0% { transform: scale(0.4); opacity: 0; }
|
|
1045
|
+
100% { transform: scale(1); opacity: 1; }
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
@keyframes sw-bounce {
|
|
1049
|
+
0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
|
|
1050
|
+
40% { transform: translateY(-4px); opacity: 1; }
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
@keyframes sw-pulse {
|
|
1054
|
+
0%, 100% { opacity: 1; transform: scale(1); }
|
|
1055
|
+
50% { opacity: 0.35; transform: scale(0.85); }
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
/* ---------- Mobile Full-Screen Drawer ---------- */
|
|
1059
|
+
@media (max-width: 520px) {
|
|
1060
|
+
.sw-root {
|
|
1061
|
+
bottom: 14px;
|
|
1062
|
+
right: 14px;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
.sw-root.sw-left {
|
|
1066
|
+
left: 14px;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
.sw-root.sw-open {
|
|
1070
|
+
inset: 0;
|
|
1071
|
+
padding: 0;
|
|
1072
|
+
gap: 0;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
.sw-root.sw-open .sw-launcher-row {
|
|
1076
|
+
display: none;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
.sw-panel {
|
|
1080
|
+
width: 100vw;
|
|
1081
|
+
max-width: 100vw;
|
|
1082
|
+
height: 100dvh;
|
|
1083
|
+
max-height: 100dvh;
|
|
1084
|
+
border-radius: 0;
|
|
1085
|
+
border: none;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
.sw-composer {
|
|
1089
|
+
padding-bottom: max(12px, env(safe-area-inset-bottom));
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
.sw-textarea {
|
|
1093
|
+
font-size: 16px;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
.sw-teaser {
|
|
1097
|
+
max-width: 210px;
|
|
1098
|
+
font-size: 12.2px;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1103
|
+
.sw-panel, .sw-launcher, .sw-msg-row, .sw-teaser, .sw-reaction, .sw-dots span, .sw-rec-dot {
|
|
1104
|
+
animation: none !important;
|
|
1105
|
+
transition: none !important;
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
`;var V=10*1024*1024,_=40,R='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><path d="M18 6L6 18M6 6l12 12"/></svg>',Y='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/></svg>',J='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/></svg>',X='<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>',G='<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="2" width="6" height="12" rx="3"/><path d="M5 10v2a7 7 0 0 0 14 0v-2"/><line x1="12" y1="19" x2="12" y2="22"/></svg>',W='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>',B='<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><polygon points="6 4 20 12 6 20 6 4"/></svg>',Q='<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/></svg>',Z='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>',O="data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="32" fill="#080d19"/><text x="50%" y="56%" text-anchor="middle" fill="#fbbf24" font-family="Arial,sans-serif" font-weight="800" font-size="24">SW</text></svg>');function I(o){if(!o)return null;try{let e=new URL(o,window.location.origin);if(e.protocol==="http:"||e.protocol==="https:")return e.href}catch{return null}return null}function z(o,e){let t=atob(o),s=t.length,i=new Uint8Array(s);for(let n=0;n<s;n++)i[n]=t.charCodeAt(n);return URL.createObjectURL(new Blob([i],{type:e}))}function U(o){try{return(o?new Date(o):new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function N(o){if(!Number.isFinite(o)||o<0)return"0:00";let e=Math.floor(o/60),t=Math.floor(o%60);return`${e}:${t.toString().padStart(2,"0")}`}function k(o){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`${o}_${crypto.randomUUID().replace(/-/g,"").slice(0,12)}`:`${o}_${Math.random().toString(36).slice(2,12)}`}var T=class{constructor(e){this.teaserEl=null;this.isOpen=!1;this.unreadCount=0;this.sessionToken=null;this.sessionExpiresAt=0;this.ws=null;this.wsConnecting=!1;this.pingTimer=null;this.reconnectTimer=null;this.reconnectAttempt=0;this.typingClearTimer=null;this.pendingFrames=[];this.objectUrls=[];this.storedMessages=[];this.msgRowById=new Map;this.destroyed=!1;this.mediaRecorder=null;this.mediaStream=null;this.recChunks=[];this.recStartedAt=0;this.recTickTimer=null;this.recCancelled=!1;let t=e.apiUrl.replace(/\/+$/,"");this.opts={siteId:e.siteId,apiUrl:t,position:e.position??"bottom-right",greeting:e.greeting??"Need a website, app, or AI agent? Chat with our AI Agent",title:e.title??"SEEKHI WAVE AI Agent",avatarUrl:e.avatarUrl??`${t}/widget/avatar.png`,turnstileSiteKey:e.turnstileSiteKey,zIndex:e.zIndex??2147483e3,hideTeaser:e.hideTeaser??!1},this.hostEl=document.createElement("div"),this.hostEl.id="seekhiwave-agent-widget-host",this.hostEl.setAttribute("data-seekhiwave-widget","true"),this.shadow=this.hostEl.attachShadow({mode:"open"}),this.renderShell(),document.body.appendChild(this.hostEl),this.loadStoredHistory()}get storageSessionKey(){return`sw_widget_sess_${this.opts.siteId}`}get storageHistoryKey(){return`sw_widget_hist_${this.opts.siteId}`}get storageTeaserKey(){return`sw_widget_teaser_dismissed_${this.opts.siteId}`}renderShell(){let e=document.createElement("style");e.textContent=H,this.shadow.appendChild(e);let t=document.createElement("div");t.className=`sw-root${this.opts.position==="bottom-left"?" sw-left":""}`,t.style.zIndex=String(this.opts.zIndex),this.rootEl=t;let s=document.createElement("section");s.className="sw-panel",s.setAttribute("aria-label",this.opts.title);let i=document.createElement("div");i.className="sw-spectrum-bar",s.appendChild(i);let n=document.createElement("header");n.className="sw-header",n.innerHTML=`
|
|
1109
|
+
<div class="sw-header-brand">
|
|
1110
|
+
<div class="sw-header-avatar-wrap">
|
|
1111
|
+
<img class="sw-header-avatar" alt="SEEKHI WAVE" />
|
|
1112
|
+
<span class="sw-header-dot"></span>
|
|
1113
|
+
</div>
|
|
1114
|
+
<div class="sw-header-info">
|
|
1115
|
+
<div class="sw-header-title"></div>
|
|
1116
|
+
<div class="sw-header-sub">Online \xB7 Replies in seconds</div>
|
|
1117
|
+
</div>
|
|
1118
|
+
</div>
|
|
1119
|
+
<div class="sw-header-actions">
|
|
1120
|
+
<button class="sw-icon-btn sw-act-portfolio" type="button" title="Browse Portfolio" aria-label="Browse Portfolio">${Y}</button>
|
|
1121
|
+
<button class="sw-icon-btn sw-act-reset" type="button" title="New Conversation" aria-label="New Conversation">${J}</button>
|
|
1122
|
+
<button class="sw-icon-btn sw-act-close" type="button" title="Close Chat" aria-label="Close Chat">${R}</button>
|
|
1123
|
+
</div>
|
|
1124
|
+
`;let r=n.querySelector(".sw-header-avatar");r.src=this.opts.avatarUrl,r.onerror=()=>{r.src=O},n.querySelector(".sw-header-title").textContent=this.opts.title,this.headerDotEl=n.querySelector(".sw-header-dot"),this.headerSubEl=n.querySelector(".sw-header-sub"),n.querySelector(".sw-act-portfolio").addEventListener("click",()=>this.openPortfolio()),n.querySelector(".sw-act-reset").addEventListener("click",()=>this.resetSession()),n.querySelector(".sw-act-close").addEventListener("click",()=>this.close()),s.appendChild(n);let d=document.createElement("div");d.className="sw-messages",this.messagesEl=d,s.appendChild(d);let a=document.createElement("div");a.className="sw-typing",a.innerHTML=`
|
|
1125
|
+
<span class="sw-dots"><span></span><span></span><span></span></span>
|
|
1126
|
+
<span class="sw-typing-label">SEEKHI WAVE Agent is typing\u2026</span>
|
|
1127
|
+
`,this.typingEl=a,s.appendChild(a);let l=document.createElement("div");l.className="sw-drop-overlay",l.innerHTML=`
|
|
1128
|
+
<div class="sw-drop-title">Drop file to share with SEEKHI WAVE</div>
|
|
1129
|
+
<div class="sw-drop-sub">Screenshots, designs, PDFs, or DOCX specs (up to 10 MB)</div>
|
|
1130
|
+
`,this.dropOverlayEl=l,s.appendChild(l);let c=document.createElement("div");c.className="sw-composer";let p=document.createElement("div");p.className="sw-recording-bar",p.innerHTML=`
|
|
1131
|
+
<div class="sw-rec-status">
|
|
1132
|
+
<span class="sw-rec-dot"></span>
|
|
1133
|
+
<span>Recording voice note\u2026</span>
|
|
1134
|
+
<span class="sw-rec-timer">0:00</span>
|
|
1135
|
+
</div>
|
|
1136
|
+
<div class="sw-rec-actions">
|
|
1137
|
+
<button class="sw-icon-btn sw-rec-cancel" type="button" title="Cancel" aria-label="Cancel Recording">${R}</button>
|
|
1138
|
+
<button class="sw-send-btn sw-rec-send" type="button" title="Send Voice Note" aria-label="Send Voice Note">${W}</button>
|
|
1139
|
+
</div>
|
|
1140
|
+
`,this.recordingBarEl=p,this.recTimerEl=p.querySelector(".sw-rec-timer"),p.querySelector(".sw-rec-cancel").addEventListener("click",()=>this.stopRecording(!0)),p.querySelector(".sw-rec-send").addEventListener("click",()=>this.stopRecording(!1)),c.appendChild(p);let u=document.createElement("div");u.className="sw-input-row",u.innerHTML=`
|
|
1141
|
+
<input class="sw-file-input" type="file" accept="image/*,audio/*,.pdf,.doc,.docx,.txt" style="display:none" />
|
|
1142
|
+
<button class="sw-icon-btn sw-btn-attach" type="button" title="Attach image, PDF, or DOCX" aria-label="Attach File">${X}</button>
|
|
1143
|
+
<textarea class="sw-textarea" rows="1" placeholder="Ask about projects, voice note, or drop a brief\u2026"></textarea>
|
|
1144
|
+
<button class="sw-icon-btn sw-btn-mic" type="button" title="Record voice note" aria-label="Record Voice Note">${G}</button>
|
|
1145
|
+
<button class="sw-send-btn sw-btn-send" type="button" title="Send" aria-label="Send Message">${W}</button>
|
|
1146
|
+
`,this.inputRowEl=u,this.fileInputEl=u.querySelector(".sw-file-input"),this.textareaEl=u.querySelector(".sw-textarea"),u.querySelector(".sw-btn-attach").addEventListener("click",()=>this.fileInputEl.click()),this.fileInputEl.addEventListener("change",()=>{var f;let h=(f=this.fileInputEl.files)==null?void 0:f[0];h&&this.handleFileUpload(h),this.fileInputEl.value=""}),u.querySelector(".sw-btn-mic").addEventListener("click",()=>{this.startRecording()}),u.querySelector(".sw-btn-send").addEventListener("click",()=>this.submitTextarea()),this.textareaEl.addEventListener("input",()=>this.autoResizeTextarea()),this.textareaEl.addEventListener("keydown",h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),this.submitTextarea())}),c.appendChild(u);let v=document.createElement("div");v.className="sw-footer-note",v.innerHTML=`
|
|
1147
|
+
<span>Voice \xB7 Screenshots \xB7 PDFs supported</span>
|
|
1148
|
+
<span>Powered by <a href="https://www.seekhiwave.com/" target="_blank" rel="noopener noreferrer">SEEKHI WAVE</a></span>
|
|
1149
|
+
`,c.appendChild(v),s.appendChild(c);let m=0;s.addEventListener("dragenter",h=>{h.preventDefault(),m++,this.dropOverlayEl.classList.add("sw-visible")}),s.addEventListener("dragover",h=>{h.preventDefault()}),s.addEventListener("dragleave",()=>{m=Math.max(0,m-1),m===0&&this.dropOverlayEl.classList.remove("sw-visible")}),s.addEventListener("drop",h=>{var x,g;h.preventDefault(),m=0,this.dropOverlayEl.classList.remove("sw-visible");let f=(g=(x=h.dataTransfer)==null?void 0:x.files)==null?void 0:g[0];f&&this.handleFileUpload(f)}),t.appendChild(s);let b=document.createElement("div");b.className="sw-launcher-row";let y=(()=>{try{return sessionStorage.getItem(this.storageTeaserKey)==="1"}catch{return!1}})();if(!this.opts.hideTeaser&&!y){let h=document.createElement("div");h.className="sw-teaser";let f=document.createElement("span");f.textContent=this.opts.greeting;let x=document.createElement("button");x.className="sw-teaser-close",x.type="button",x.setAttribute("aria-label","Dismiss greeting"),x.textContent="\xD7",x.addEventListener("click",g=>{g.stopPropagation(),this.dismissTeaser()}),h.addEventListener("click",()=>this.open()),h.appendChild(f),h.appendChild(x),this.teaserEl=h,b.appendChild(h)}let w=document.createElement("button");w.className="sw-launcher",w.type="button",w.setAttribute("aria-label","Open SEEKHI WAVE AI Agent Chat"),w.innerHTML=`
|
|
1150
|
+
<img class="sw-launcher-img" alt="SEEKHI WAVE AI Agent" />
|
|
1151
|
+
<span class="sw-launcher-icon-close">${R}</span>
|
|
1152
|
+
<span class="sw-status-dot"></span>
|
|
1153
|
+
<span class="sw-unread-badge" style="display:none">0</span>
|
|
1154
|
+
`;let E=w.querySelector(".sw-launcher-img");E.src=this.opts.avatarUrl,E.onerror=()=>{E.src=O},this.unreadBadgeEl=w.querySelector(".sw-unread-badge"),w.addEventListener("click",()=>this.toggle()),b.appendChild(w),t.appendChild(b),this.shadow.appendChild(t),this.renderWelcomeCard()}renderWelcomeCard(){let e=document.createElement("div");e.className="sw-welcome",e.innerHTML=`
|
|
1155
|
+
<div class="sw-welcome-eyebrow">SEEKHI WAVE \xB7 AI SALES & CONSULTATION AGENT</div>
|
|
1156
|
+
<p class="sw-welcome-text">
|
|
1157
|
+
Hi! I'm SEEKHI WAVE's AI Agent. Ask about websites, POS, SaaS apps, AI agents, drop a screenshot or PDF brief, or send a voice note in English or Sinhala.
|
|
1158
|
+
</p>
|
|
1159
|
+
<div class="sw-chips"></div>
|
|
1160
|
+
`;let t=e.querySelector(".sw-chips"),s=[{label:"Explore Portfolio",action:()=>this.openPortfolio()},{label:"What do you build?",action:()=>this.sendMessage("What services and software solutions does SEEKHI WAVE build?")},{label:"Audit my website",action:()=>this.sendMessage("Can you audit my website and tell me how we can improve it?")}];for(let i of s){let n=document.createElement("button");n.type="button",n.className="sw-chip",n.textContent=i.label,n.addEventListener("click",i.action),t.appendChild(n)}this.messagesEl.appendChild(e)}open(){this.destroyed||(this.isOpen=!0,this.rootEl.classList.add("sw-open"),this.dismissTeaser(),this.clearUnread(),this.ensureConnected(),setTimeout(()=>{this.scrollToBottom(),this.textareaEl.focus()},180))}close(){this.destroyed||(this.isOpen=!1,this.rootEl.classList.remove("sw-open"))}toggle(){this.isOpen?this.close():this.open()}sendMessage(e){let t=e.trim();if(!t)return;this.isOpen||this.open();let s=k("msg"),i=new Date().toISOString(),n={id:s,role:"user",kind:"text",text:t,ts:i};this.appendStoredMessage(n),this.renderMessage(n),this.showTyping(),this.sendWsFrame({type:"message",text:t,page_path:window.location.pathname||"/",client_message_id:s})}openPortfolio(){this.isOpen||this.open(),this.sendWsFrame({type:"open_portfolio"})}resetSession(){try{localStorage.removeItem(this.storageSessionKey),localStorage.removeItem(this.storageHistoryKey)}catch{}if(this.sessionToken=null,this.sessionExpiresAt=0,this.storedMessages=[],this.msgRowById.clear(),this.ws){try{this.ws.close(1e3,"reset")}catch{}this.ws=null}this.messagesEl.innerHTML="",this.renderWelcomeCard(),this.hideTyping(),this.ensureConnected()}destroy(){if(this.destroyed=!0,this.stopTimers(),this.mediaRecorder&&this.mediaRecorder.state!=="inactive"&&this.stopRecording(!0),this.ws){try{this.ws.close(1e3,"destroy")}catch{}this.ws=null}for(let e of this.objectUrls)URL.revokeObjectURL(e);this.objectUrls=[],this.hostEl.remove()}setConnectionStatus(e,t){this.headerDotEl.classList.toggle("sw-offline",!e),this.headerSubEl.textContent=t??(e?"Online \xB7 Replies in seconds":"Connecting\u2026")}async ensureSession(){let e=Math.floor(Date.now()/1e3);if(this.sessionToken&&this.sessionExpiresAt>e+60)return this.sessionToken;let t;try{let d=localStorage.getItem(this.storageSessionKey);if(d){let a=JSON.parse(d);a.token&&(a.expiresAt??0)>e+60&&(t=a.token)}}catch{}let s=this.opts.turnstileSiteKey;if(!s&&!t)try{let d=await fetch(`${this.opts.apiUrl}/api/widget/config`,{method:"GET",credentials:"omit"});if(d.ok){let a=await d.json();a.turnstile_site_key&&(s=a.turnstile_site_key,this.opts.turnstileSiteKey=s)}}catch{}let i;s&&!t&&(i=await this.acquireTurnstileToken(s));let n=await fetch(`${this.opts.apiUrl}/api/widget/session`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify({site_id:this.opts.siteId,page_path:window.location.pathname||"/",existing_token:t??null,turnstile_token:i??null})});if(!n.ok){let d=`Session failed (${n.status})`;try{let a=await n.json();a.detail&&(d=a.detail)}catch{}throw new Error(d)}let r=await n.json();this.sessionToken=r.session_token,this.sessionExpiresAt=r.expires_at;try{localStorage.setItem(this.storageSessionKey,JSON.stringify({token:r.session_token,visitorId:r.visitor_id,expiresAt:r.expires_at}))}catch{}return r.session_token}async acquireTurnstileToken(e){let t=window;if(t.turnstile||await new Promise(s=>{let i=document.createElement("script");i.src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",i.async=!0,i.onload=()=>s(),i.onerror=()=>s(),document.head.appendChild(i)}),!!t.turnstile)return await new Promise(s=>{let i=document.createElement("div");i.style.cssText="position:fixed;bottom:0;right:0;opacity:0;pointer-events:none;z-index:-1;",document.body.appendChild(i);let n=!1,r=a=>{n||(n=!0,i.remove(),s(a))},d=window.setTimeout(()=>r(void 0),1e4);try{t.turnstile.render(i,{sitekey:e,size:"compact",callback:a=>{window.clearTimeout(d),r(a)},"error-callback":()=>{window.clearTimeout(d),r(void 0)}})}catch{window.clearTimeout(d),r(void 0)}})}async ensureConnected(){if(!this.destroyed&&!(this.ws&&this.ws.readyState===WebSocket.OPEN)&&!this.wsConnecting){this.wsConnecting=!0,this.setConnectionStatus(!1,"Connecting\u2026");try{let e=await this.ensureSession(),t=this.opts.apiUrl.replace(/^http:/i,"ws:").replace(/^https:/i,"wss:"),s=new WebSocket(`${t}/ws/widget?token=${encodeURIComponent(e)}`);this.ws=s,s.onopen=()=>{this.wsConnecting=!1,this.reconnectAttempt=0,this.setConnectionStatus(!0),this.startPingLoop(),this.flushPendingFrames()},s.onmessage=i=>{try{let n=JSON.parse(i.data);this.handleServerEvent(n)}catch{}},s.onclose=i=>{if(this.wsConnecting=!1,this.stopPingLoop(),this.ws===s&&(this.ws=null),this.destroyed)return;if(i.code===4401){this.sessionToken=null,this.sessionExpiresAt=0;try{localStorage.removeItem(this.storageSessionKey)}catch{}}if(i.code===4403){this.setConnectionStatus(!1,"Origin not authorized"),this.showSystemNotice("This website origin is not authorized for this widget.");return}if(i.code===1e3)return;this.setConnectionStatus(!1,"Reconnecting\u2026");let n=Math.min(12e3,1e3*Math.pow(2,this.reconnectAttempt));this.reconnectAttempt++,this.reconnectTimer=window.setTimeout(()=>{this.ensureConnected()},n)},s.onerror=()=>{this.wsConnecting=!1}}catch(e){this.wsConnecting=!1,this.setConnectionStatus(!1,"Connection issue"),this.hideTyping(),this.showSystemNotice(e instanceof Error?e.message:"Could not connect to SEEKHI WAVE Agent.")}}}async sendWsFrame(e){if(this.ws&&this.ws.readyState===WebSocket.OPEN){this.ws.send(JSON.stringify(e));return}this.pendingFrames.push(e),await this.ensureConnected()}flushPendingFrames(){if(!(!this.ws||this.ws.readyState!==WebSocket.OPEN))for(;this.pendingFrames.length>0;){let e=this.pendingFrames.shift();e&&this.ws.send(JSON.stringify(e))}}startPingLoop(){this.stopPingLoop(),this.pingTimer=window.setInterval(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"ping"}))},25e3)}stopPingLoop(){this.pingTimer!==null&&(window.clearInterval(this.pingTimer),this.pingTimer=null)}stopTimers(){this.stopPingLoop(),this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.typingClearTimer!==null&&(window.clearTimeout(this.typingClearTimer),this.typingClearTimer=null),this.recTickTimer!==null&&(window.clearInterval(this.recTickTimer),this.recTickTimer=null)}handleServerEvent(e){switch(e.type){case"connected":case"pong":return;case"typing":this.showTyping();return;case"error":this.hideTyping(),this.showSystemNotice(e.message);return;case"reaction":this.attachReaction(e.message_id,e.emoji);return;case"text_bubble":{this.hideTyping();let t={id:k("ag"),role:"agent",kind:"text",html:e.html,text:e.text,urlButtons:e.url_buttons,quickReplies:e.quick_replies,ts:e.ts??new Date().toISOString()};this.appendStoredMessage(t),this.renderMessage(t),this.bumpUnreadIfClosed();return}case"image_card":{this.hideTyping();let t={id:k("img"),role:"agent",kind:"image",imageUrl:e.image_url,html:e.caption_html,urlButtons:e.url_buttons,quickReplies:e.quick_replies,ts:e.ts??new Date().toISOString()};this.appendStoredMessage(t),this.renderMessage(t),this.bumpUnreadIfClosed();return}case"pdf_card":{this.hideTyping();let t=z(e.data_b64,e.mime||"application/pdf");this.objectUrls.push(t);let s={id:k("pdf"),role:"agent",kind:"pdf",filename:e.filename,html:e.caption_html,urlButtons:e.url_buttons,ts:e.ts??new Date().toISOString()};this.appendStoredMessage(s),this.renderPdfCard(s,t),this.bumpUnreadIfClosed();return}case"voice_audio":{this.hideTyping();let t=z(e.audio_b64,e.mime||"audio/mpeg");this.objectUrls.push(t);let s={id:k("voc"),role:"agent",kind:"voice",filename:e.filename??"seekhiwave_reply.mp3",html:e.caption_html,ts:e.ts??new Date().toISOString()};this.appendStoredMessage(s),this.renderVoiceMessage(s,t),this.bumpUnreadIfClosed();return}case"portfolio_carousel":{this.hideTyping();let t={id:k("car"),role:"agent",kind:"carousel",projects:e.projects,startIndex:e.start_index??0,ts:e.ts??new Date().toISOString()};this.appendStoredMessage(t),this.renderCarousel(t),this.bumpUnreadIfClosed();return}}}async handleFileUpload(e,t=!1){if(e.size>V){this.showSystemNotice("File is too large. Maximum allowed size is 10 MB.");return}let s=k("up"),i=new Date().toISOString(),n=e.type.startsWith("image/");if(t||e.type.startsWith("audio/")){let d=URL.createObjectURL(e);this.objectUrls.push(d);let a={id:s,role:"user",kind:"voice",filename:e.name,ts:i};this.appendStoredMessage(a),this.renderVoiceMessage(a,d)}else if(n){let d=URL.createObjectURL(e);this.objectUrls.push(d);let a={id:s,role:"user",kind:"image",imageUrl:d,text:e.name,ts:i};this.appendStoredMessage({...a,imageUrl:void 0,text:`\u{1F4F7} Uploaded image: ${e.name}`}),this.renderMessage(a)}else{let d={id:s,role:"user",kind:"text",text:`\u{1F4CE} ${e.name}`,ts:i};this.appendStoredMessage(d),this.renderMessage(d)}this.showTyping();try{await this.ensureConnected();let d=await this.ensureSession(),a=new FormData;a.append("file",e,e.name),a.append("caption",this.textareaEl.value.trim()),a.append("page_path",window.location.pathname||"/"),a.append("client_message_id",s),this.textareaEl.value.trim()&&(this.textareaEl.value="",this.autoResizeTextarea());let l=await fetch(`${this.opts.apiUrl}/api/widget/upload`,{method:"POST",headers:{Authorization:`Bearer ${d}`},credentials:"omit",body:a});if(!l.ok){let c=`Upload failed (${l.status})`;try{let p=await l.json();p.detail&&(c=p.detail)}catch{}throw new Error(c)}}catch(d){this.hideTyping(),this.showSystemNotice(d instanceof Error?d.message:"Could not upload file.")}}async startRecording(){if(!navigator.mediaDevices||typeof MediaRecorder>"u"){this.showSystemNotice("Voice recording is not supported in this browser.");return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});this.mediaStream=e;let t=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/ogg;codecs=opus")?"audio/ogg;codecs=opus":MediaRecorder.isTypeSupported("audio/mp4")?"audio/mp4":"",s=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);this.mediaRecorder=s,this.recChunks=[],this.recCancelled=!1,this.recStartedAt=Date.now(),this.recTimerEl.textContent="0:00",s.ondataavailable=i=>{i.data&&i.data.size>0&&this.recChunks.push(i.data)},s.onstop=()=>{if(this.cleanupMediaStream(),this.recCancelled||this.recChunks.length===0)return;let i=s.mimeType||t||"audio/webm",n=i.includes("ogg")?"ogg":i.includes("mp4")?"m4a":"webm",r=new Blob(this.recChunks,{type:i}),d=new File([r],`voice_note.${n}`,{type:i});this.handleFileUpload(d,!0)},s.start(),this.inputRowEl.classList.add("sw-hidden"),this.recordingBarEl.classList.add("sw-visible"),this.recTickTimer=window.setInterval(()=>{let i=(Date.now()-this.recStartedAt)/1e3;this.recTimerEl.textContent=N(i),i>=120&&this.stopRecording(!1)},300)}catch{this.showSystemNotice("Microphone permission was denied. You can type or attach files instead.")}}stopRecording(e){if(this.recCancelled=e,this.recTickTimer!==null&&(window.clearInterval(this.recTickTimer),this.recTickTimer=null),this.recordingBarEl.classList.remove("sw-visible"),this.inputRowEl.classList.remove("sw-hidden"),this.mediaRecorder&&this.mediaRecorder.state!=="inactive")try{this.mediaRecorder.stop()}catch{this.cleanupMediaStream()}else this.cleanupMediaStream()}cleanupMediaStream(){if(this.mediaStream){for(let e of this.mediaStream.getTracks())e.stop();this.mediaStream=null}this.mediaRecorder=null}submitTextarea(){let e=this.textareaEl.value.trim();e&&(this.textareaEl.value="",this.autoResizeTextarea(),this.sendMessage(e))}autoResizeTextarea(){this.textareaEl.style.height="auto",this.textareaEl.style.height=`${Math.min(100,this.textareaEl.scrollHeight)}px`}showTyping(){this.typingEl.classList.add("sw-visible"),this.typingClearTimer!==null&&window.clearTimeout(this.typingClearTimer),this.typingClearTimer=window.setTimeout(()=>this.hideTyping(),25e3),this.scrollToBottom()}hideTyping(){this.typingEl.classList.remove("sw-visible"),this.typingClearTimer!==null&&(window.clearTimeout(this.typingClearTimer),this.typingClearTimer=null)}showSystemNotice(e){let t=document.createElement("div");t.className="sw-msg-row sw-system";let s=document.createElement("div");s.className="sw-bubble",s.textContent=e,t.appendChild(s),this.messagesEl.appendChild(t),this.scrollToBottom()}attachReaction(e,t){let s=this.msgRowById.get(e);if(!s)return;let i=s.querySelector(".sw-bubble");if(!i)return;let n=i.querySelector(".sw-reaction");n||(n=document.createElement("span"),n.className="sw-reaction",i.appendChild(n)),n.textContent=t;let r=this.storedMessages.find(d=>d.id===e);r&&(r.reaction=t,this.saveStoredHistory())}renderMessage(e){var i,n,r,d,a;if(e.kind==="carousel"&&((i=e.projects)!=null&&i.length)){this.renderCarousel(e);return}if(e.kind==="pdf"){this.renderPdfCard(e,null);return}if(e.kind==="voice"){this.renderVoiceMessage(e,null);return}let t=document.createElement("div");if(t.className=`sw-msg-row sw-${e.role}`,t.dataset.msgId=e.id,e.kind==="image"&&e.imageUrl){let l=document.createElement("div");l.className="sw-image-card";let c=document.createElement("img");if(c.src=e.imageUrl,c.alt="Project preview",c.loading="lazy",c.addEventListener("click",()=>{let p=I(e.imageUrl);p&&window.open(p,"_blank","noopener,noreferrer")}),l.appendChild(c),e.html||e.text||(n=e.urlButtons)!=null&&n.length){let p=document.createElement("div");if(p.className="sw-image-card-body",e.html&&e.role==="agent"){let u=document.createElement("div");u.innerHTML=e.html,p.appendChild(u)}else if(e.text){let u=document.createElement("div");u.textContent=e.text,p.appendChild(u)}(r=e.urlButtons)!=null&&r.length&&p.appendChild(this.buildUrlButtons(e.urlButtons)),l.appendChild(p)}t.appendChild(l)}else{let l=document.createElement("div");if(l.className="sw-bubble",e.role==="agent"&&e.html?l.innerHTML=e.html:l.textContent=e.text??"",e.reaction){let c=document.createElement("span");c.className="sw-reaction",c.textContent=e.reaction,l.appendChild(c)}t.appendChild(l),(d=e.urlButtons)!=null&&d.length&&t.appendChild(this.buildUrlButtons(e.urlButtons))}(a=e.quickReplies)!=null&&a.length&&t.appendChild(this.buildQuickReplies(e.quickReplies));let s=document.createElement("div");s.className="sw-time",s.textContent=U(e.ts),t.appendChild(s),this.msgRowById.set(e.id,t),this.messagesEl.appendChild(t),this.scrollToBottom()}renderPdfCard(e,t){var d;let s=document.createElement("div");s.className=`sw-msg-row sw-${e.role}`,s.dataset.msgId=e.id;let i=document.createElement("div");i.className="sw-pdf-card";let n=document.createElement("div");if(n.className="sw-pdf-top",n.innerHTML=`
|
|
1161
|
+
<div class="sw-pdf-badge">PDF</div>
|
|
1162
|
+
<div class="sw-pdf-meta">
|
|
1163
|
+
<div class="sw-pdf-name"></div>
|
|
1164
|
+
<div class="sw-pdf-sub">SEEKHI WAVE Project Brief</div>
|
|
1165
|
+
</div>
|
|
1166
|
+
`,n.querySelector(".sw-pdf-name").textContent=e.filename||"SEEKHI_WAVE_Brief.pdf",i.appendChild(n),e.html){let a=document.createElement("div");a.className="sw-pdf-caption",a.innerHTML=e.html,i.appendChild(a)}if(t){let a=document.createElement("a");a.className="sw-pdf-dl",a.href=t,a.download=e.filename||"SEEKHI_WAVE_Brief.pdf",a.innerHTML=`${Z}<span>Download PDF Brief</span>`,i.appendChild(a)}else{let a=document.createElement("div");a.className="sw-pdf-sub",a.textContent="PDF sent earlier in this session \u2014 ask me to regenerate a fresh copy anytime.",i.appendChild(a)}(d=e.urlButtons)!=null&&d.length&&i.appendChild(this.buildUrlButtons(e.urlButtons)),s.appendChild(i);let r=document.createElement("div");r.className="sw-time",r.textContent=U(e.ts),s.appendChild(r),this.msgRowById.set(e.id,s),this.messagesEl.appendChild(s),this.scrollToBottom()}renderVoiceMessage(e,t){let s=document.createElement("div");s.className=`sw-msg-row sw-${e.role}`,s.dataset.msgId=e.id;let i=document.createElement("div");if(i.className="sw-bubble sw-voice-bubble",t){let r=new Audio(t),d=document.createElement("div");d.className="sw-voice-row";let a=document.createElement("button");a.type="button",a.className="sw-voice-play",a.setAttribute("aria-label","Play voice note"),a.innerHTML=B;let l=document.createElement("div");l.className="sw-voice-track";let c=document.createElement("div");c.className="sw-voice-bar";let p=document.createElement("div");p.className="sw-voice-fill",c.appendChild(p);let u=document.createElement("div");u.className="sw-voice-meta";let v=document.createElement("span");v.textContent=e.role==="user"?"Voice note":"SEEKHI WAVE Voice Reply";let m=document.createElement("span");m.textContent="0:00",u.appendChild(v),u.appendChild(m),l.appendChild(c),l.appendChild(u),d.appendChild(a),d.appendChild(l),i.appendChild(d),r.addEventListener("loadedmetadata",()=>{Number.isFinite(r.duration)&&(m.textContent=N(r.duration))}),r.addEventListener("timeupdate",()=>{r.duration>0&&(p.style.width=`${Math.min(100,r.currentTime/r.duration*100)}%`,m.textContent=N(r.currentTime))}),r.addEventListener("ended",()=>{a.innerHTML=B,p.style.width="0%",Number.isFinite(r.duration)&&(m.textContent=N(r.duration))}),a.addEventListener("click",()=>{r.paused?(r.play(),a.innerHTML=Q):(r.pause(),a.innerHTML=B)}),c.addEventListener("click",b=>{if(!Number.isFinite(r.duration)||r.duration<=0)return;let y=c.getBoundingClientRect(),w=Math.max(0,Math.min(1,(b.clientX-y.left)/y.width));r.currentTime=w*r.duration})}else{let r=document.createElement("div");r.textContent=e.role==="user"?"\u{1F3A4} Voice note sent earlier":"\u{1F50A} Voice reply sent earlier",i.appendChild(r)}if(e.html&&e.role==="agent"){let r=document.createElement("div");r.style.fontSize="12.5px",r.style.opacity="0.9",r.innerHTML=e.html,i.appendChild(r)}s.appendChild(i);let n=document.createElement("div");n.className="sw-time",n.textContent=U(e.ts),s.appendChild(n),this.msgRowById.set(e.id,s),this.messagesEl.appendChild(s),this.scrollToBottom()}renderCarousel(e){let t=e.projects??[];if(t.length===0)return;let s=document.createElement("div");s.className="sw-msg-row sw-agent",s.style.maxWidth="94%";let i=document.createElement("div");i.className="sw-carousel";let n=(e.startIndex??0)%t.length,r=document.createElement("div");r.className="sw-carousel-media";let d=document.createElement("img");d.loading="lazy";let a=document.createElement("span");a.className="sw-carousel-counter",r.appendChild(d),r.appendChild(a);let l=document.createElement("div");l.className="sw-carousel-body";let c=document.createElement("div");c.className="sw-carousel-industry";let p=document.createElement("h4");p.className="sw-carousel-title";let u=document.createElement("p");u.className="sw-carousel-summary";let v=document.createElement("div");v.className="sw-carousel-cta";let m=document.createElement("a");m.className="sw-btn-secondary",m.target="_blank",m.rel="noopener noreferrer",m.textContent="Visit Live \u2197";let b=document.createElement("button");b.type="button",b.className="sw-btn-primary",b.textContent="Build Similar \u2192",v.appendChild(m),v.appendChild(b);let y=document.createElement("div");y.className="sw-carousel-nav";let w=document.createElement("button");w.type="button",w.textContent="\u2190 Prev";let E=document.createElement("span");E.style.fontSize="11px",E.style.color="#94a3b8";let h=document.createElement("button");h.type="button",h.textContent="Next \u2192",y.appendChild(w),y.appendChild(E),y.appendChild(h),l.appendChild(c),l.appendChild(p),l.appendChild(u),l.appendChild(v),l.appendChild(y),i.appendChild(r),i.appendChild(l),s.appendChild(i);let f=()=>{let g=t[n];d.src=I(g.image_url)||O,d.alt=g.name,a.textContent=`${n+1} / ${t.length}`,c.textContent=g.industry||"Featured Project",p.textContent=g.name,u.textContent=g.summary,m.href=I(g.url)||"https://www.seekhiwave.com/",E.textContent="SEEKHI WAVE Portfolio"};w.addEventListener("click",()=>{n=(n-1+t.length)%t.length,f()}),h.addEventListener("click",()=>{n=(n+1)%t.length,f()}),b.addEventListener("click",()=>{let g=t[n],S=k("sim"),C={id:S,role:"user",kind:"text",text:`I'd like to build something similar to ${g.name}!`,ts:new Date().toISOString()};this.appendStoredMessage(C),this.renderMessage(C),this.showTyping(),this.sendWsFrame({type:"carousel_similar",project_name:g.name,industry:g.industry,page_path:window.location.pathname||"/",client_message_id:S})});let x=0;i.addEventListener("touchstart",g=>{var S;x=((S=g.touches[0])==null?void 0:S.clientX)??0},{passive:!0}),i.addEventListener("touchend",g=>{var C;let S=(((C=g.changedTouches[0])==null?void 0:C.clientX)??0)-x;Math.abs(S)>40&&(n=S<0?(n+1)%t.length:(n-1+t.length)%t.length,f())},{passive:!0}),f(),this.messagesEl.appendChild(s),this.scrollToBottom()}buildUrlButtons(e){let t=document.createElement("div");t.className="sw-url-buttons";for(let s of e){let i=I(s.url);if(!i)continue;let n=document.createElement("a");n.className="sw-url-btn",n.href=i,n.target="_blank",n.rel="noopener noreferrer",n.textContent=`${s.label} \u2197`,t.appendChild(n)}return t}buildQuickReplies(e){let t=document.createElement("div");t.className="sw-quick-replies";for(let s of e){let i=document.createElement("button");i.type="button",i.className="sw-chip",i.textContent=s.label,i.addEventListener("click",()=>{t.remove(),this.sendMessage(s.label)}),t.appendChild(i)}return t}dismissTeaser(){this.teaserEl&&(this.teaserEl.remove(),this.teaserEl=null);try{sessionStorage.setItem(this.storageTeaserKey,"1")}catch{}}bumpUnreadIfClosed(){this.isOpen||(this.unreadCount++,this.unreadBadgeEl.textContent=this.unreadCount>9?"9+":String(this.unreadCount),this.unreadBadgeEl.style.display="flex")}clearUnread(){this.unreadCount=0,this.unreadBadgeEl.style.display="none"}scrollToBottom(){requestAnimationFrame(()=>{this.messagesEl.scrollTop=this.messagesEl.scrollHeight})}loadStoredHistory(){try{let e=localStorage.getItem(this.storageHistoryKey);if(!e)return;let t=JSON.parse(e);if(!Array.isArray(t))return;this.storedMessages=t.slice(-_);for(let s of this.storedMessages)this.renderMessage(s)}catch{}}appendStoredMessage(e){this.storedMessages.push(e),this.storedMessages.length>_&&(this.storedMessages=this.storedMessages.slice(-_)),this.saveStoredHistory()}saveStoredHistory(){try{localStorage.setItem(this.storageHistoryKey,JSON.stringify(this.storedMessages))}catch{}}};var M=null;function L(o){return M&&(M.destroy(),M=null),M=new T(o),M}function ee(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript;let o=document.querySelectorAll("script[data-site-id]");for(let e=o.length-1;e>=0;e--)if(o[e].src.includes("seekhiwave-widget"))return o[e];return o.length>0?o[o.length-1]:null}function D(){var n,r;let o=ee(),e=(n=o==null?void 0:o.dataset.siteId)==null?void 0:n.trim();if(!e){window.SeekhiWaveWidget=Object.assign({open:()=>{},close:()=>{},toggle:()=>{},sendMessage:()=>{},openPortfolio:()=>{},resetSession:()=>{},destroy:()=>{}},{mount:L});return}let t=((r=o==null?void 0:o.dataset.apiUrl)==null?void 0:r.trim())||"";if(!t&&(o!=null&&o.src))try{t=new URL(o.src,window.location.href).origin}catch{t=window.location.origin}let s={siteId:e,apiUrl:t,position:(o==null?void 0:o.dataset.position)==="bottom-left"?"bottom-left":"bottom-right",greeting:(o==null?void 0:o.dataset.greeting)||void 0,title:(o==null?void 0:o.dataset.title)||void 0,avatarUrl:(o==null?void 0:o.dataset.avatarUrl)||void 0,turnstileSiteKey:(o==null?void 0:o.dataset.turnstileSiteKey)||void 0,hideTeaser:(o==null?void 0:o.dataset.hideTeaser)==="true"},i=L(s);window.SeekhiWaveWidget=Object.assign(i,{mount:L})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",D,{once:!0}):D();return q(te);})();
|