@poolse/react-ui 3.5.0 → 3.6.1

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.cjs CHANGED
@@ -13,7 +13,877 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
13
  var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
14
14
  var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
15
15
 
16
- // src/CallVideoGrid.tsx
16
+ var __defProp = Object.defineProperty;
17
+ var __getOwnPropNames = Object.getOwnPropertyNames;
18
+ var __esm = (fn, res) => function __init() {
19
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
20
+ };
21
+ var __export = (target, all) => {
22
+ for (var name in all)
23
+ __defProp(target, name, { get: all[name], enumerable: true });
24
+ };
25
+
26
+ // src/emojiData.ts
27
+ var emojiData_exports = {};
28
+ __export(emojiData_exports, {
29
+ EMOJI_CATEGORIES: () => EMOJI_CATEGORIES
30
+ });
31
+ var EMOJI_CATEGORIES;
32
+ var init_emojiData = __esm({
33
+ "src/emojiData.ts"() {
34
+ EMOJI_CATEGORIES = [
35
+ {
36
+ id: "smileys",
37
+ label: "Smileys & people",
38
+ emojis: [
39
+ ["\u{1F600}", "grinning face"],
40
+ ["\u{1F601}", "grinning face with smiling eyes"],
41
+ ["\u{1F602}", "face with tears of joy lol laugh haha"],
42
+ ["\u{1F603}", "smiling face with open mouth"],
43
+ ["\u{1F604}", "smiling face with open mouth and smiling eyes happy"],
44
+ ["\u{1F605}", "smiling face with open mouth and cold sweat"],
45
+ ["\u{1F606}", "smiling face with open mouth and tightly closed eyes"],
46
+ ["\u{1F607}", "smiling face with halo"],
47
+ ["\u{1F608}", "smiling face with horns"],
48
+ ["\u{1F609}", "winking face"],
49
+ ["\u{1F60A}", "smiling face with smiling eyes happy smile"],
50
+ ["\u{1F60B}", "face savouring delicious food"],
51
+ ["\u{1F60C}", "relieved face"],
52
+ ["\u{1F60D}", "smiling face with heart shaped eyes love crush"],
53
+ ["\u{1F60E}", "smiling face with sunglasses"],
54
+ ["\u{1F60F}", "smirking face"],
55
+ ["\u{1F610}", "neutral face"],
56
+ ["\u{1F611}", "expressionless face"],
57
+ ["\u{1F612}", "unamused face"],
58
+ ["\u{1F613}", "face with cold sweat"],
59
+ ["\u{1F614}", "pensive face"],
60
+ ["\u{1F615}", "confused face"],
61
+ ["\u{1F616}", "confounded face"],
62
+ ["\u{1F617}", "kissing face"],
63
+ ["\u{1F618}", "face throwing a kiss"],
64
+ ["\u{1F619}", "kissing face with smiling eyes"],
65
+ ["\u{1F61A}", "kissing face with closed eyes"],
66
+ ["\u{1F61B}", "face with stuck out tongue"],
67
+ ["\u{1F61C}", "face with stuck out tongue and winking eye"],
68
+ ["\u{1F61D}", "face with stuck out tongue and tightly closed eyes"],
69
+ ["\u{1F61E}", "disappointed face"],
70
+ ["\u{1F61F}", "worried face"],
71
+ ["\u{1F620}", "angry face"],
72
+ ["\u{1F621}", "pouting face"],
73
+ ["\u{1F622}", "crying face sad"],
74
+ ["\u{1F623}", "persevering face"],
75
+ ["\u{1F624}", "face with look of triumph"],
76
+ ["\u{1F625}", "disappointed but relieved face"],
77
+ ["\u{1F626}", "frowning face with open mouth"],
78
+ ["\u{1F627}", "anguished face"],
79
+ ["\u{1F628}", "fearful face"],
80
+ ["\u{1F629}", "weary face"],
81
+ ["\u{1F62A}", "sleepy face"],
82
+ ["\u{1F62B}", "tired face"],
83
+ ["\u{1F62C}", "grimacing face"],
84
+ ["\u{1F62D}", "loudly crying face sad sob"],
85
+ ["\u{1F62E}", "face with open mouth"],
86
+ ["\u{1F62F}", "hushed face"],
87
+ ["\u{1F630}", "face with open mouth and cold sweat"],
88
+ ["\u{1F631}", "face screaming in fear"],
89
+ ["\u{1F632}", "astonished face"],
90
+ ["\u{1F633}", "flushed face"],
91
+ ["\u{1F634}", "sleeping face"],
92
+ ["\u{1F635}", "dizzy face"],
93
+ ["\u{1F636}", "face without mouth"],
94
+ ["\u{1F637}", "face with medical mask"],
95
+ ["\u{1F641}", "slightly frowning face"],
96
+ ["\u{1F642}", "slightly smiling face smile"],
97
+ ["\u{1F643}", "upside down face"],
98
+ ["\u{1F644}", "face with rolling eyes eye roll"],
99
+ ["\u{1F910}", "zipper mouth face"],
100
+ ["\u{1F911}", "money mouth face"],
101
+ ["\u{1F912}", "face with thermometer"],
102
+ ["\u{1F913}", "nerd face"],
103
+ ["\u{1F914}", "thinking face think hmm"],
104
+ ["\u{1F915}", "face with head bandage"],
105
+ ["\u{1F917}", "hugging face"],
106
+ ["\u{1F918}", "sign of the horns"],
107
+ ["\u{1F919}", "call me hand"],
108
+ ["\u{1F91A}", "raised back of hand"],
109
+ ["\u{1F91B}", "left facing fist"],
110
+ ["\u{1F91C}", "right facing fist"],
111
+ ["\u{1F91D}", "handshake"],
112
+ ["\u{1F91E}", "hand with index and middle fingers crossed"],
113
+ ["\u{1F91F}", "i love you hand sign"],
114
+ ["\u{1F920}", "face with cowboy hat"],
115
+ ["\u{1F921}", "clown face"],
116
+ ["\u{1F922}", "nauseated face"],
117
+ ["\u{1F923}", "rolling on the floor laughing"],
118
+ ["\u{1F924}", "drooling face"],
119
+ ["\u{1F925}", "lying face"],
120
+ ["\u{1F926}", "face palm facepalm"],
121
+ ["\u{1F927}", "sneezing face"],
122
+ ["\u{1F928}", "face with one eyebrow raised"],
123
+ ["\u{1F929}", "grinning face with star eyes"],
124
+ ["\u{1F92A}", "grinning face with one large and one small eye"],
125
+ ["\u{1F92B}", "face with finger covering closed lips"],
126
+ ["\u{1F92C}", "serious face with symbols covering mouth"],
127
+ ["\u{1F92D}", "smiling face with smiling eyes and hand covering mouth"],
128
+ ["\u{1F92E}", "face with open mouth vomiting"],
129
+ ["\u{1F92F}", "shocked face with exploding head"],
130
+ ["\u{1F970}", "smiling face with smiling eyes and three hearts"],
131
+ ["\u{1F971}", "yawning face"],
132
+ ["\u{1F972}", "smiling face with tear"],
133
+ ["\u{1F973}", "face with party horn and party hat"],
134
+ ["\u{1F974}", "face with uneven eyes and wavy mouth"],
135
+ ["\u{1F975}", "overheated face"],
136
+ ["\u{1F976}", "freezing face"],
137
+ ["\u{1F978}", "disguised face"],
138
+ ["\u{1F97A}", "face with pleading eyes"],
139
+ ["\u{1F9D0}", "face with monocle"],
140
+ ["\u{1F648}", "see no evil monkey"],
141
+ ["\u{1F649}", "hear no evil monkey"],
142
+ ["\u{1F64A}", "speak no evil monkey"],
143
+ ["\u{1F47B}", "ghost"],
144
+ ["\u{1F480}", "skull"],
145
+ ["\u{1F47D}", "extraterrestrial alien"],
146
+ ["\u{1F916}", "robot face"],
147
+ ["\u{1F4A9}", "pile of poo"],
148
+ ["\u{1F47F}", "imp"],
149
+ ["\u{1F44B}", "waving hand sign"],
150
+ ["\u270B\uFE0F", "raised hand"],
151
+ ["\u{1F596}", "raised hand with part between middle and ring fingers"],
152
+ ["\u{1F44C}", "ok hand sign"],
153
+ ["\u{1F90C}", "pinched fingers"],
154
+ ["\u{1F90F}", "pinching hand"],
155
+ ["\u270C\uFE0F", "victory hand"],
156
+ ["\u{1F448}", "white left pointing backhand index"],
157
+ ["\u{1F449}", "white right pointing backhand index"],
158
+ ["\u{1F446}", "white up pointing backhand index"],
159
+ ["\u{1F447}", "white down pointing backhand index"],
160
+ ["\u261D\uFE0F", "white up pointing index"],
161
+ ["\u{1F44D}", "thumbs up sign +1 like yes ok approve"],
162
+ ["\u{1F44E}", "thumbs down sign -1 dislike no"],
163
+ ["\u270A\uFE0F", "raised fist"],
164
+ ["\u{1F44A}", "fisted hand sign"],
165
+ ["\u{1F44F}", "clapping hands sign applause bravo"],
166
+ ["\u{1F64C}", "person raising both hands in celebration"],
167
+ ["\u{1F450}", "open hands sign"],
168
+ ["\u{1F932}", "palms up together"],
169
+ ["\u{1F64F}", "person with folded hands pray please thanks thank you"],
170
+ ["\u270D\uFE0F", "writing hand"],
171
+ ["\u{1F485}", "nail polish"],
172
+ ["\u{1F933}", "selfie"],
173
+ ["\u{1F4AA}", "flexed biceps"],
174
+ ["\u{1F9BE}", "mechanical arm"],
175
+ ["\u{1F440}", "eyes look see watching"],
176
+ ["\u{1F9E0}", "brain"],
177
+ ["\u{1F476}", "baby"],
178
+ ["\u{1F9D2}", "child"],
179
+ ["\u{1F466}", "boy"],
180
+ ["\u{1F467}", "girl"],
181
+ ["\u{1F9D1}", "adult"],
182
+ ["\u{1F468}", "man"],
183
+ ["\u{1F469}", "woman"],
184
+ ["\u{1F9D3}", "older adult"],
185
+ ["\u{1F474}", "older man"],
186
+ ["\u{1F475}", "older woman"],
187
+ ["\u{1F64B}", "happy person raising one hand"],
188
+ ["\u{1F64D}", "person frowning"],
189
+ ["\u{1F64E}", "person with pouting face"],
190
+ ["\u{1F645}", "face with no good gesture"],
191
+ ["\u{1F646}", "face with ok gesture"],
192
+ ["\u{1F481}", "information desk person"],
193
+ ["\u{1F937}", "shrug shrug idk"],
194
+ ["\u{1F483}", "dancer"],
195
+ ["\u{1F57A}", "man dancing"],
196
+ ["\u{1F46F}", "woman with bunny ears"],
197
+ ["\u2764\uFE0F", "heavy black heart love"],
198
+ ["\u{1F9E1}", "orange heart"],
199
+ ["\u{1F49B}", "yellow heart"],
200
+ ["\u{1F49A}", "green heart"],
201
+ ["\u{1F499}", "blue heart"],
202
+ ["\u{1F49C}", "purple heart"],
203
+ ["\u{1F5A4}", "black heart"],
204
+ ["\u{1F90D}", "white heart"],
205
+ ["\u{1F90E}", "brown heart"],
206
+ ["\u{1F494}", "broken heart"],
207
+ ["\u2763\uFE0F", "heavy heart exclamation mark ornament"],
208
+ ["\u{1F495}", "two hearts"],
209
+ ["\u{1F49E}", "revolving hearts"],
210
+ ["\u{1F493}", "beating heart"],
211
+ ["\u{1F497}", "growing heart"],
212
+ ["\u{1F496}", "sparkling heart"],
213
+ ["\u{1F498}", "heart with arrow"],
214
+ ["\u{1F49D}", "heart with ribbon"],
215
+ ["\u{1F48B}", "kiss mark"],
216
+ ["\u{1F4AF}", "hundred points symbol hundred perfect"],
217
+ ["\u{1F4A2}", "anger symbol"],
218
+ ["\u{1F4A5}", "collision symbol"],
219
+ ["\u{1F4AB}", "dizzy symbol"],
220
+ ["\u{1F4A6}", "splashing sweat symbol"],
221
+ ["\u{1F4A8}", "dash symbol"],
222
+ ["\u{1F4AC}", "speech balloon"],
223
+ ["\u{1F4AD}", "thought balloon"],
224
+ ["\u{1F4A4}", "sleeping symbol"]
225
+ ]
226
+ },
227
+ {
228
+ id: "nature",
229
+ label: "Animals & nature",
230
+ emojis: [
231
+ ["\u{1F400}", "rat"],
232
+ ["\u{1F401}", "mouse"],
233
+ ["\u{1F402}", "ox"],
234
+ ["\u{1F403}", "water buffalo"],
235
+ ["\u{1F404}", "cow"],
236
+ ["\u{1F405}", "tiger"],
237
+ ["\u{1F406}", "leopard"],
238
+ ["\u{1F407}", "rabbit"],
239
+ ["\u{1F408}", "cat"],
240
+ ["\u{1F409}", "dragon"],
241
+ ["\u{1F40A}", "crocodile"],
242
+ ["\u{1F40B}", "whale"],
243
+ ["\u{1F40C}", "snail"],
244
+ ["\u{1F40D}", "snake"],
245
+ ["\u{1F40E}", "horse"],
246
+ ["\u{1F40F}", "ram"],
247
+ ["\u{1F410}", "goat"],
248
+ ["\u{1F411}", "sheep"],
249
+ ["\u{1F412}", "monkey"],
250
+ ["\u{1F413}", "rooster"],
251
+ ["\u{1F414}", "chicken"],
252
+ ["\u{1F415}", "dog"],
253
+ ["\u{1F416}", "pig"],
254
+ ["\u{1F417}", "boar"],
255
+ ["\u{1F418}", "elephant"],
256
+ ["\u{1F419}", "octopus"],
257
+ ["\u{1F41A}", "spiral shell"],
258
+ ["\u{1F41B}", "bug"],
259
+ ["\u{1F41C}", "ant"],
260
+ ["\u{1F41D}", "honeybee"],
261
+ ["\u{1F41E}", "lady beetle"],
262
+ ["\u{1F41F}", "fish"],
263
+ ["\u{1F420}", "tropical fish"],
264
+ ["\u{1F421}", "blowfish"],
265
+ ["\u{1F422}", "turtle"],
266
+ ["\u{1F423}", "hatching chick"],
267
+ ["\u{1F424}", "baby chick"],
268
+ ["\u{1F425}", "front facing baby chick"],
269
+ ["\u{1F426}", "bird"],
270
+ ["\u{1F427}", "penguin"],
271
+ ["\u{1F428}", "koala"],
272
+ ["\u{1F429}", "poodle"],
273
+ ["\u{1F42A}", "dromedary camel"],
274
+ ["\u{1F42B}", "bactrian camel"],
275
+ ["\u{1F42C}", "dolphin"],
276
+ ["\u{1F42D}", "mouse face"],
277
+ ["\u{1F42E}", "cow face"],
278
+ ["\u{1F42F}", "tiger face"],
279
+ ["\u{1F430}", "rabbit face"],
280
+ ["\u{1F431}", "cat face"],
281
+ ["\u{1F432}", "dragon face"],
282
+ ["\u{1F433}", "spouting whale"],
283
+ ["\u{1F434}", "horse face"],
284
+ ["\u{1F435}", "monkey face"],
285
+ ["\u{1F436}", "dog face"],
286
+ ["\u{1F437}", "pig face"],
287
+ ["\u{1F438}", "frog face"],
288
+ ["\u{1F439}", "hamster face"],
289
+ ["\u{1F43A}", "wolf face"],
290
+ ["\u{1F43B}", "bear face"],
291
+ ["\u{1F43C}", "panda face"],
292
+ ["\u{1F43D}", "pig nose"],
293
+ ["\u{1F43E}", "paw prints"],
294
+ ["\u{1F980}", "crab"],
295
+ ["\u{1F981}", "lion face"],
296
+ ["\u{1F982}", "scorpion"],
297
+ ["\u{1F983}", "turkey"],
298
+ ["\u{1F984}", "unicorn face"],
299
+ ["\u{1F985}", "eagle"],
300
+ ["\u{1F986}", "duck"],
301
+ ["\u{1F987}", "bat"],
302
+ ["\u{1F988}", "shark"],
303
+ ["\u{1F989}", "owl"],
304
+ ["\u{1F98A}", "fox face"],
305
+ ["\u{1F98B}", "butterfly"],
306
+ ["\u{1F98C}", "deer"],
307
+ ["\u{1F98D}", "gorilla"],
308
+ ["\u{1F98E}", "lizard"],
309
+ ["\u{1F98F}", "rhinoceros"],
310
+ ["\u{1F990}", "shrimp"],
311
+ ["\u{1F991}", "squid"],
312
+ ["\u{1F992}", "giraffe face"],
313
+ ["\u{1F993}", "zebra face"],
314
+ ["\u{1F994}", "hedgehog"],
315
+ ["\u{1F995}", "sauropod"],
316
+ ["\u{1F996}", "t rex"],
317
+ ["\u{1F997}", "cricket"],
318
+ ["\u{1F99A}", "peacock"],
319
+ ["\u{1F99C}", "parrot"],
320
+ ["\u{1F99D}", "raccoon"],
321
+ ["\u{1F99E}", "lobster"],
322
+ ["\u{1F99F}", "mosquito"],
323
+ ["\u{1F331}", "seedling"],
324
+ ["\u{1F332}", "evergreen tree"],
325
+ ["\u{1F333}", "deciduous tree"],
326
+ ["\u{1F334}", "palm tree"],
327
+ ["\u{1F335}", "cactus"],
328
+ ["\u{1F337}", "tulip"],
329
+ ["\u{1F338}", "cherry blossom"],
330
+ ["\u{1F339}", "rose"],
331
+ ["\u{1F33A}", "hibiscus"],
332
+ ["\u{1F33B}", "sunflower"],
333
+ ["\u{1F33C}", "blossom"],
334
+ ["\u{1F33D}", "ear of maize"],
335
+ ["\u{1F33E}", "ear of rice"],
336
+ ["\u{1F33F}", "herb"],
337
+ ["\u{1F340}", "four leaf clover"],
338
+ ["\u{1F341}", "maple leaf"],
339
+ ["\u{1F342}", "fallen leaf"],
340
+ ["\u{1F343}", "leaf fluttering in wind"],
341
+ ["\u{1F344}", "mushroom"],
342
+ ["\u{1F490}", "bouquet"],
343
+ ["\u{1F940}", "wilted flower"],
344
+ ["\u{1F311}", "new moon symbol"],
345
+ ["\u{1F315}", "full moon symbol"],
346
+ ["\u{1F319}", "crescent moon"],
347
+ ["\u{1F31A}", "new moon with face"],
348
+ ["\u{1F31E}", "sun with face"],
349
+ ["\u{1F31D}", "full moon with face"],
350
+ ["\u2600\uFE0F", "black sun with rays"],
351
+ ["\u2B50\uFE0F", "white medium star"],
352
+ ["\u{1F31F}", "glowing star"],
353
+ ["\u{1F320}", "shooting star"],
354
+ ["\u2601\uFE0F", "cloud"],
355
+ ["\u26C5\uFE0F", "sun behind cloud"],
356
+ ["\u{1F308}", "rainbow"],
357
+ ["\u2744\uFE0F", "snowflake"],
358
+ ["\u2603\uFE0F", "snowman"],
359
+ ["\u26C4\uFE0F", "snowman without snow"],
360
+ ["\u{1F525}", "fire fire lit hot"],
361
+ ["\u{1F4A7}", "droplet"],
362
+ ["\u{1F30A}", "water wave"]
363
+ ]
364
+ },
365
+ {
366
+ id: "food",
367
+ label: "Food & drink",
368
+ emojis: [
369
+ ["\u{1F345}", "tomato"],
370
+ ["\u{1F346}", "aubergine"],
371
+ ["\u{1F347}", "grapes"],
372
+ ["\u{1F348}", "melon"],
373
+ ["\u{1F349}", "watermelon"],
374
+ ["\u{1F34A}", "tangerine"],
375
+ ["\u{1F34B}", "lemon"],
376
+ ["\u{1F34C}", "banana"],
377
+ ["\u{1F34D}", "pineapple"],
378
+ ["\u{1F34E}", "red apple"],
379
+ ["\u{1F34F}", "green apple"],
380
+ ["\u{1F350}", "pear"],
381
+ ["\u{1F351}", "peach"],
382
+ ["\u{1F352}", "cherries"],
383
+ ["\u{1F353}", "strawberry"],
384
+ ["\u{1F354}", "hamburger"],
385
+ ["\u{1F355}", "slice of pizza"],
386
+ ["\u{1F356}", "meat on bone"],
387
+ ["\u{1F357}", "poultry leg"],
388
+ ["\u{1F358}", "rice cracker"],
389
+ ["\u{1F359}", "rice ball"],
390
+ ["\u{1F35A}", "cooked rice"],
391
+ ["\u{1F35B}", "curry and rice"],
392
+ ["\u{1F35C}", "steaming bowl"],
393
+ ["\u{1F35D}", "spaghetti"],
394
+ ["\u{1F35E}", "bread"],
395
+ ["\u{1F35F}", "french fries"],
396
+ ["\u{1F360}", "roasted sweet potato"],
397
+ ["\u{1F361}", "dango"],
398
+ ["\u{1F362}", "oden"],
399
+ ["\u{1F363}", "sushi"],
400
+ ["\u{1F364}", "fried shrimp"],
401
+ ["\u{1F365}", "fish cake with swirl design"],
402
+ ["\u{1F366}", "soft ice cream"],
403
+ ["\u{1F367}", "shaved ice"],
404
+ ["\u{1F368}", "ice cream"],
405
+ ["\u{1F369}", "doughnut"],
406
+ ["\u{1F36A}", "cookie"],
407
+ ["\u{1F36B}", "chocolate bar"],
408
+ ["\u{1F36C}", "candy"],
409
+ ["\u{1F36D}", "lollipop"],
410
+ ["\u{1F36E}", "custard"],
411
+ ["\u{1F36F}", "honey pot"],
412
+ ["\u{1F370}", "shortcake"],
413
+ ["\u{1F371}", "bento box"],
414
+ ["\u{1F372}", "pot of food"],
415
+ ["\u{1F373}", "cooking"],
416
+ ["\u{1F374}", "fork and knife"],
417
+ ["\u{1F375}", "teacup without handle"],
418
+ ["\u{1F376}", "sake bottle and cup"],
419
+ ["\u{1F377}", "wine glass"],
420
+ ["\u{1F378}", "cocktail glass"],
421
+ ["\u{1F379}", "tropical drink"],
422
+ ["\u{1F37A}", "beer mug"],
423
+ ["\u{1F37B}", "clinking beer mugs"],
424
+ ["\u{1F37C}", "baby bottle"],
425
+ ["\u{1F950}", "croissant"],
426
+ ["\u{1F951}", "avocado"],
427
+ ["\u{1F952}", "cucumber"],
428
+ ["\u{1F953}", "bacon"],
429
+ ["\u{1F954}", "potato"],
430
+ ["\u{1F955}", "carrot"],
431
+ ["\u{1F956}", "baguette bread"],
432
+ ["\u{1F957}", "green salad"],
433
+ ["\u{1F958}", "shallow pan of food"],
434
+ ["\u{1F959}", "stuffed flatbread"],
435
+ ["\u{1F95A}", "egg"],
436
+ ["\u{1F95B}", "glass of milk"],
437
+ ["\u{1F95C}", "peanuts"],
438
+ ["\u{1F95D}", "kiwifruit"],
439
+ ["\u{1F95E}", "pancakes"],
440
+ ["\u{1F95F}", "dumpling"],
441
+ ["\u{1F960}", "fortune cookie"],
442
+ ["\u{1F961}", "takeout box"],
443
+ ["\u{1F962}", "chopsticks"],
444
+ ["\u{1F963}", "bowl with spoon"],
445
+ ["\u{1F964}", "cup with straw"],
446
+ ["\u{1F965}", "coconut"],
447
+ ["\u{1F966}", "broccoli"],
448
+ ["\u{1F967}", "pie"],
449
+ ["\u{1F968}", "pretzel"],
450
+ ["\u{1F969}", "cut of meat"],
451
+ ["\u{1F96A}", "sandwich"],
452
+ ["\u{1F96B}", "canned food"],
453
+ ["\u{1F96C}", "leafy green"],
454
+ ["\u{1F96D}", "mango"],
455
+ ["\u{1F96E}", "moon cake"],
456
+ ["\u{1F96F}", "bagel"],
457
+ ["\u{1F9C0}", "cheese wedge"],
458
+ ["\u{1F9C1}", "cupcake"],
459
+ ["\u{1F9C2}", "salt shaker"],
460
+ ["\u{1F9C3}", "beverage box"],
461
+ ["\u{1F9C4}", "garlic"],
462
+ ["\u{1F9C5}", "onion"],
463
+ ["\u{1F9C6}", "falafel"],
464
+ ["\u{1F9C7}", "waffle"],
465
+ ["\u{1F9C8}", "butter"],
466
+ ["\u{1F9C9}", "mate drink"],
467
+ ["\u{1F9CA}", "ice cube"],
468
+ ["\u{1F9CB}", "bubble tea"],
469
+ ["\u{1F37E}", "bottle with popping cork"],
470
+ ["\u{1F37F}", "popcorn"],
471
+ ["\u2615\uFE0F", "hot beverage"]
472
+ ]
473
+ },
474
+ {
475
+ id: "activity",
476
+ label: "Activities",
477
+ emojis: [
478
+ ["\u{1F380}", "ribbon"],
479
+ ["\u{1F381}", "wrapped present"],
480
+ ["\u{1F382}", "birthday cake"],
481
+ ["\u{1F383}", "jack o lantern"],
482
+ ["\u{1F384}", "christmas tree"],
483
+ ["\u{1F385}", "father christmas"],
484
+ ["\u{1F386}", "fireworks"],
485
+ ["\u{1F387}", "firework sparkler"],
486
+ ["\u{1F388}", "balloon"],
487
+ ["\u{1F389}", "party popper party tada celebrate congrats"],
488
+ ["\u{1F38A}", "confetti ball"],
489
+ ["\u{1F38B}", "tanabata tree"],
490
+ ["\u{1F38C}", "crossed flags"],
491
+ ["\u{1F38D}", "pine decoration"],
492
+ ["\u{1F38E}", "japanese dolls"],
493
+ ["\u{1F38F}", "carp streamer"],
494
+ ["\u{1F390}", "wind chime"],
495
+ ["\u{1F391}", "moon viewing ceremony"],
496
+ ["\u{1F392}", "school satchel"],
497
+ ["\u{1F393}", "graduation cap"],
498
+ ["\u{1F9E8}", "firecracker"],
499
+ ["\u2728\uFE0F", "sparkles"],
500
+ ["\u26BD\uFE0F", "soccer ball"],
501
+ ["\u26BE\uFE0F", "baseball"],
502
+ ["\u{1F94E}", "softball"],
503
+ ["\u{1F3C0}", "basketball and hoop"],
504
+ ["\u{1F3D0}", "volleyball"],
505
+ ["\u{1F3C8}", "american football"],
506
+ ["\u{1F3C9}", "rugby football"],
507
+ ["\u{1F3BE}", "tennis racquet and ball"],
508
+ ["\u{1F94F}", "flying disc"],
509
+ ["\u{1F3B3}", "bowling"],
510
+ ["\u{1F3CF}", "cricket bat and ball"],
511
+ ["\u{1F3D1}", "field hockey stick and ball"],
512
+ ["\u{1F3D2}", "ice hockey stick and puck"],
513
+ ["\u{1F94D}", "lacrosse stick and ball"],
514
+ ["\u{1F3D3}", "table tennis paddle and ball"],
515
+ ["\u{1F3F8}", "badminton racquet and shuttlecock"],
516
+ ["\u{1F94A}", "boxing glove"],
517
+ ["\u{1F94B}", "martial arts uniform"],
518
+ ["\u{1F945}", "goal net"],
519
+ ["\u26F3\uFE0F", "flag in hole"],
520
+ ["\u26F8\uFE0F", "ice skate"],
521
+ ["\u{1F3A3}", "fishing pole and fish"],
522
+ ["\u{1F93F}", "diving mask"],
523
+ ["\u{1F3BD}", "running shirt with sash"],
524
+ ["\u{1F3BF}", "ski and ski boot"],
525
+ ["\u{1F6F7}", "sled"],
526
+ ["\u{1F94C}", "curling stone"],
527
+ ["\u{1F3AF}", "direct hit"],
528
+ ["\u{1F3B1}", "billiards"],
529
+ ["\u{1F52E}", "crystal ball"],
530
+ ["\u{1F3AE}", "video game"],
531
+ ["\u{1F3B0}", "slot machine"],
532
+ ["\u{1F3B2}", "game die"],
533
+ ["\u{1F9E9}", "jigsaw puzzle piece"],
534
+ ["\u265F\uFE0F", "black chess pawn"],
535
+ ["\u{1F3AD}", "performing arts"],
536
+ ["\u{1F3A8}", "artist palette"],
537
+ ["\u{1F9F5}", "spool of thread"],
538
+ ["\u{1F9F6}", "ball of yarn"],
539
+ ["\u{1F3A4}", "microphone"],
540
+ ["\u{1F3A7}", "headphone"],
541
+ ["\u{1F3BC}", "musical score"],
542
+ ["\u{1F3B5}", "musical note"],
543
+ ["\u{1F3B6}", "multiple musical notes"],
544
+ ["\u{1F3B7}", "saxophone"],
545
+ ["\u{1F3B8}", "guitar"],
546
+ ["\u{1F3B9}", "musical keyboard"],
547
+ ["\u{1F3BA}", "trumpet"],
548
+ ["\u{1F3BB}", "violin"],
549
+ ["\u{1F941}", "drum with drumsticks"],
550
+ ["\u{1F3AC}", "clapper board"],
551
+ ["\u{1F3C6}", "trophy"],
552
+ ["\u{1F3C5}", "sports medal"],
553
+ ["\u{1F947}", "first place medal"],
554
+ ["\u{1F948}", "second place medal"],
555
+ ["\u{1F949}", "third place medal"],
556
+ ["\u{1F3AB}", "ticket"]
557
+ ]
558
+ },
559
+ {
560
+ id: "travel",
561
+ label: "Travel & places",
562
+ emojis: [
563
+ ["\u{1F680}", "rocket launch ship"],
564
+ ["\u{1F681}", "helicopter"],
565
+ ["\u{1F682}", "steam locomotive"],
566
+ ["\u{1F683}", "railway car"],
567
+ ["\u{1F684}", "high speed train"],
568
+ ["\u{1F685}", "high speed train with bullet nose"],
569
+ ["\u{1F686}", "train"],
570
+ ["\u{1F687}", "metro"],
571
+ ["\u{1F688}", "light rail"],
572
+ ["\u{1F689}", "station"],
573
+ ["\u{1F68A}", "tram"],
574
+ ["\u{1F68B}", "tram car"],
575
+ ["\u{1F68C}", "bus"],
576
+ ["\u{1F68D}", "oncoming bus"],
577
+ ["\u{1F68E}", "trolleybus"],
578
+ ["\u{1F68F}", "bus stop"],
579
+ ["\u{1F690}", "minibus"],
580
+ ["\u{1F691}", "ambulance"],
581
+ ["\u{1F692}", "fire engine"],
582
+ ["\u{1F693}", "police car"],
583
+ ["\u{1F694}", "oncoming police car"],
584
+ ["\u{1F695}", "taxi"],
585
+ ["\u{1F696}", "oncoming taxi"],
586
+ ["\u{1F697}", "automobile"],
587
+ ["\u{1F698}", "oncoming automobile"],
588
+ ["\u{1F699}", "recreational vehicle"],
589
+ ["\u{1F69A}", "delivery truck"],
590
+ ["\u{1F69B}", "articulated lorry"],
591
+ ["\u{1F69C}", "tractor"],
592
+ ["\u{1F69D}", "monorail"],
593
+ ["\u{1F69E}", "mountain railway"],
594
+ ["\u{1F69F}", "suspension railway"],
595
+ ["\u{1F6A0}", "mountain cableway"],
596
+ ["\u{1F6A1}", "aerial tramway"],
597
+ ["\u{1F6A2}", "ship"],
598
+ ["\u{1F6A3}", "rowboat"],
599
+ ["\u{1F6A4}", "speedboat"],
600
+ ["\u{1F6B2}", "bicycle"],
601
+ ["\u{1F6F4}", "scooter"],
602
+ ["\u{1F6F5}", "motor scooter"],
603
+ ["\u{1F6F6}", "canoe"],
604
+ ["\u{1F6F8}", "flying saucer"],
605
+ ["\u{1F6F9}", "skateboard"],
606
+ ["\u2708\uFE0F", "airplane"],
607
+ ["\u26F5\uFE0F", "sailboat"],
608
+ ["\u2693\uFE0F", "anchor"],
609
+ ["\u26FD\uFE0F", "fuel pump"],
610
+ ["\u{1F6A7}", "construction sign"],
611
+ ["\u{1F3E0}", "house building"],
612
+ ["\u{1F3E1}", "house with garden"],
613
+ ["\u{1F3E2}", "office building"],
614
+ ["\u{1F3E3}", "japanese post office"],
615
+ ["\u{1F3E4}", "european post office"],
616
+ ["\u{1F3E5}", "hospital"],
617
+ ["\u{1F3E6}", "bank"],
618
+ ["\u{1F3E7}", "automated teller machine"],
619
+ ["\u{1F3E8}", "hotel"],
620
+ ["\u{1F3E9}", "love hotel"],
621
+ ["\u{1F3EA}", "convenience store"],
622
+ ["\u{1F3EB}", "school"],
623
+ ["\u{1F3EC}", "department store"],
624
+ ["\u{1F3ED}", "factory"],
625
+ ["\u{1F3EE}", "izakaya lantern"],
626
+ ["\u{1F3EF}", "japanese castle"],
627
+ ["\u{1F3F0}", "european castle"],
628
+ ["\u{1F5FC}", "tokyo tower"],
629
+ ["\u{1F5FD}", "statue of liberty"],
630
+ ["\u{1F5FE}", "silhouette of japan"],
631
+ ["\u{1F5FF}", "moyai"],
632
+ ["\u26EA\uFE0F", "church"],
633
+ ["\u{1F54C}", "mosque"],
634
+ ["\u{1F54D}", "synagogue"],
635
+ ["\u26F2\uFE0F", "fountain"],
636
+ ["\u26FA\uFE0F", "tent"],
637
+ ["\u{1F301}", "foggy"],
638
+ ["\u{1F303}", "night with stars"],
639
+ ["\u{1F304}", "sunrise over mountains"],
640
+ ["\u{1F305}", "sunrise"],
641
+ ["\u{1F306}", "cityscape at dusk"],
642
+ ["\u{1F307}", "sunset over buildings"],
643
+ ["\u{1F309}", "bridge at night"],
644
+ ["\u{1F30C}", "milky way"],
645
+ ["\u{1F30D}", "earth globe europe africa"],
646
+ ["\u{1F30E}", "earth globe americas"],
647
+ ["\u{1F30F}", "earth globe asia australia"],
648
+ ["\u{1F310}", "globe with meridians"],
649
+ ["\u{1F5FA}\uFE0F", "world map"],
650
+ ["\u{1F3A0}", "carousel horse"],
651
+ ["\u{1F3A1}", "ferris wheel"],
652
+ ["\u{1F3A2}", "roller coaster"]
653
+ ]
654
+ },
655
+ {
656
+ id: "objects",
657
+ label: "Objects",
658
+ emojis: [
659
+ ["\u231A\uFE0F", "watch"],
660
+ ["\u{1F4F1}", "mobile phone"],
661
+ ["\u{1F4F2}", "mobile phone with rightwards arrow at left"],
662
+ ["\u{1F4BB}", "personal computer"],
663
+ ["\u2328\uFE0F", "keyboard"],
664
+ ["\u{1F4BD}", "minidisc"],
665
+ ["\u{1F4BE}", "floppy disk"],
666
+ ["\u{1F4BF}", "optical disc"],
667
+ ["\u{1F4C0}", "dvd"],
668
+ ["\u{1F4F7}", "camera"],
669
+ ["\u{1F4F8}", "camera with flash"],
670
+ ["\u{1F4F9}", "video camera"],
671
+ ["\u{1F3A5}", "movie camera"],
672
+ ["\u{1F4FA}", "television"],
673
+ ["\u{1F4FB}", "radio"],
674
+ ["\u23F0\uFE0F", "alarm clock"],
675
+ ["\u23F3\uFE0F", "hourglass with flowing sand"],
676
+ ["\u231B\uFE0F", "hourglass"],
677
+ ["\u{1F4E1}", "satellite antenna"],
678
+ ["\u{1F50B}", "battery"],
679
+ ["\u{1F50C}", "electric plug"],
680
+ ["\u{1F4A1}", "electric light bulb"],
681
+ ["\u{1F526}", "electric torch"],
682
+ ["\u{1F56F}\uFE0F", "candle"],
683
+ ["\u{1F4B8}", "money with wings"],
684
+ ["\u{1F4B5}", "banknote with dollar sign"],
685
+ ["\u{1F4B4}", "banknote with yen sign"],
686
+ ["\u{1F4B6}", "banknote with euro sign"],
687
+ ["\u{1F4B7}", "banknote with pound sign"],
688
+ ["\u{1F4B0}", "money bag"],
689
+ ["\u{1F4B3}", "credit card"],
690
+ ["\u{1F48E}", "gem stone"],
691
+ ["\u2696\uFE0F", "scales"],
692
+ ["\u{1F527}", "wrench"],
693
+ ["\u{1F528}", "hammer"],
694
+ ["\u2692\uFE0F", "hammer and pick"],
695
+ ["\u{1F529}", "nut and bolt"],
696
+ ["\u2699\uFE0F", "gear"],
697
+ ["\u{1F9F0}", "toolbox"],
698
+ ["\u{1F9F2}", "magnet"],
699
+ ["\u{1F9EA}", "test tube"],
700
+ ["\u{1F52D}", "telescope"],
701
+ ["\u{1F52C}", "microscope"],
702
+ ["\u{1F48A}", "pill"],
703
+ ["\u{1F489}", "syringe"],
704
+ ["\u{1F9EC}", "dna double helix"],
705
+ ["\u{1F9F9}", "broom"],
706
+ ["\u{1F9FA}", "basket"],
707
+ ["\u{1F6BD}", "toilet"],
708
+ ["\u{1F6BF}", "shower"],
709
+ ["\u{1F6C1}", "bathtub"],
710
+ ["\u{1F9FC}", "bar of soap"],
711
+ ["\u{1F511}", "key"],
712
+ ["\u{1F5DD}\uFE0F", "old key"],
713
+ ["\u{1F6AA}", "door"],
714
+ ["\u{1F6CF}\uFE0F", "bed"],
715
+ ["\u{1F4E9}", "envelope with downwards arrow above"],
716
+ ["\u{1F4E8}", "incoming envelope"],
717
+ ["\u{1F4E7}", "e mail symbol"],
718
+ ["\u{1F48C}", "love letter"],
719
+ ["\u{1F4E5}", "inbox tray"],
720
+ ["\u{1F4E4}", "outbox tray"],
721
+ ["\u{1F4E6}", "package"],
722
+ ["\u{1F4EB}", "closed mailbox with raised flag"],
723
+ ["\u{1F4EE}", "postbox"],
724
+ ["\u{1F4DD}", "memo"],
725
+ ["\u{1F4BC}", "briefcase"],
726
+ ["\u{1F4C1}", "file folder"],
727
+ ["\u{1F4C2}", "open file folder"],
728
+ ["\u{1F4C5}", "calendar"],
729
+ ["\u{1F4C6}", "tear off calendar"],
730
+ ["\u{1F4C7}", "card index"],
731
+ ["\u{1F4C8}", "chart with upwards trend"],
732
+ ["\u{1F4C9}", "chart with downwards trend"],
733
+ ["\u{1F4CA}", "bar chart"],
734
+ ["\u{1F4CB}", "clipboard"],
735
+ ["\u{1F4CC}", "pushpin"],
736
+ ["\u{1F4CD}", "round pushpin"],
737
+ ["\u{1F4CE}", "paperclip"],
738
+ ["\u{1F4CF}", "straight ruler"],
739
+ ["\u{1F4D0}", "triangular ruler"],
740
+ ["\u2702\uFE0F", "black scissors"],
741
+ ["\u{1F4D3}", "notebook"],
742
+ ["\u{1F4D4}", "notebook with decorative cover"],
743
+ ["\u{1F4D2}", "ledger"],
744
+ ["\u{1F4D5}", "closed book"],
745
+ ["\u{1F4D7}", "green book"],
746
+ ["\u{1F4D8}", "blue book"],
747
+ ["\u{1F4D9}", "orange book"],
748
+ ["\u{1F4DA}", "books"],
749
+ ["\u{1F4D6}", "open book"],
750
+ ["\u{1F516}", "bookmark"],
751
+ ["\u{1F517}", "link symbol"],
752
+ ["\u{1F4F0}", "newspaper"],
753
+ ["\u270F\uFE0F", "pencil"],
754
+ ["\u2712\uFE0F", "black nib"],
755
+ ["\u{1F58A}\uFE0F", "lower left ballpoint pen"],
756
+ ["\u{1F58B}\uFE0F", "lower left fountain pen"],
757
+ ["\u{1F58C}\uFE0F", "lower left paintbrush"],
758
+ ["\u{1F58D}\uFE0F", "lower left crayon"],
759
+ ["\u{1F50D}", "left pointing magnifying glass"],
760
+ ["\u{1F50E}", "right pointing magnifying glass"],
761
+ ["\u{1F512}", "lock"],
762
+ ["\u{1F513}", "open lock"],
763
+ ["\u{1F50F}", "lock with ink pen"],
764
+ ["\u{1F510}", "closed lock with key"],
765
+ ["\u{1F514}", "bell"],
766
+ ["\u{1F515}", "bell with cancellation stroke"],
767
+ ["\u{1F4E3}", "cheering megaphone"],
768
+ ["\u{1F4E2}", "public address loudspeaker"],
769
+ ["\u{1F3F7}\uFE0F", "label"]
770
+ ]
771
+ },
772
+ {
773
+ id: "symbols",
774
+ label: "Symbols",
775
+ emojis: [
776
+ ["\u2705\uFE0F", "white heavy check mark done yes ok check"],
777
+ ["\u2714\uFE0F", "heavy check mark"],
778
+ ["\u2611\uFE0F", "ballot box with check"],
779
+ ["\u274C\uFE0F", "cross mark"],
780
+ ["\u274E\uFE0F", "negative squared cross mark"],
781
+ ["\u2795\uFE0F", "heavy plus sign"],
782
+ ["\u2796\uFE0F", "heavy minus sign"],
783
+ ["\u2797\uFE0F", "heavy division sign"],
784
+ ["\u2716\uFE0F", "heavy multiplication x"],
785
+ ["\u267E\uFE0F", "permanent paper sign"],
786
+ ["\u203C\uFE0F", "double exclamation mark"],
787
+ ["\u2049\uFE0F", "exclamation question mark"],
788
+ ["\u2753\uFE0F", "black question mark ornament"],
789
+ ["\u2754\uFE0F", "white question mark ornament"],
790
+ ["\u2755\uFE0F", "white exclamation mark ornament"],
791
+ ["\u2757\uFE0F", "heavy exclamation mark symbol"],
792
+ ["\u3030\uFE0F", "wavy dash"],
793
+ ["\u26A0\uFE0F", "warning sign"],
794
+ ["\u{1F6AB}", "no entry sign"],
795
+ ["\u26D4\uFE0F", "no entry"],
796
+ ["\u{1F6B3}", "no bicycles"],
797
+ ["\u{1F6AD}", "no smoking symbol"],
798
+ ["\u{1F51E}", "no one under eighteen symbol"],
799
+ ["\u2622\uFE0F", "radioactive sign"],
800
+ ["\u2623\uFE0F", "biohazard sign"],
801
+ ["\u2B06\uFE0F", "upwards black arrow"],
802
+ ["\u2197\uFE0F", "north east arrow"],
803
+ ["\u27A1\uFE0F", "black rightwards arrow"],
804
+ ["\u2198\uFE0F", "south east arrow"],
805
+ ["\u2B07\uFE0F", "downwards black arrow"],
806
+ ["\u2199\uFE0F", "south west arrow"],
807
+ ["\u2B05\uFE0F", "leftwards black arrow"],
808
+ ["\u2196\uFE0F", "north west arrow"],
809
+ ["\u2195\uFE0F", "up down arrow"],
810
+ ["\u2194\uFE0F", "left right arrow"],
811
+ ["\u21A9\uFE0F", "leftwards arrow with hook"],
812
+ ["\u21AA\uFE0F", "rightwards arrow with hook"],
813
+ ["\u{1F504}", "anticlockwise downwards and upwards open circle arrows"],
814
+ ["\u{1F503}", "clockwise downwards and upwards open circle arrows"],
815
+ ["\u{1F519}", "back with leftwards arrow above"],
816
+ ["\u{1F51A}", "end with leftwards arrow above"],
817
+ ["\u{1F51B}", "on with exclamation mark with left right arrow above"],
818
+ ["\u{1F51C}", "soon with rightwards arrow above"],
819
+ ["\u{1F51D}", "top with upwards arrow above"],
820
+ ["\u267B\uFE0F", "black universal recycling symbol"],
821
+ ["\u269C\uFE0F", "fleur de lis"],
822
+ ["\u{1F531}", "trident emblem"],
823
+ ["\u{1F4DB}", "name badge"],
824
+ ["\u{1F530}", "japanese symbol for beginner"],
825
+ ["\u2B55\uFE0F", "heavy large circle"],
826
+ ["\u{1F197}", "squared ok"],
827
+ ["\u{1F195}", "squared new"],
828
+ ["\u{1F193}", "squared free"],
829
+ ["\u{1F192}", "squared cool"],
830
+ ["\u{1F199}", "squared up with exclamation mark"],
831
+ ["\u{1F196}", "squared ng"],
832
+ ["\u{1F198}", "squared sos"],
833
+ ["\u{1F6D1}", "octagonal sign"],
834
+ ["\u{1F4F4}", "mobile phone off"],
835
+ ["\u{1F4F3}", "vibration mode"],
836
+ ["\u{1F534}", "large red circle"],
837
+ ["\u{1F7E0}", "large orange circle"],
838
+ ["\u{1F7E1}", "large yellow circle"],
839
+ ["\u{1F7E2}", "large green circle"],
840
+ ["\u{1F535}", "large blue circle"],
841
+ ["\u{1F7E3}", "large purple circle"],
842
+ ["\u{1F7E4}", "large brown circle"],
843
+ ["\u26AB\uFE0F", "medium black circle"],
844
+ ["\u26AA\uFE0F", "medium white circle"],
845
+ ["\u{1F7E5}", "large red square"],
846
+ ["\u{1F7E7}", "large orange square"],
847
+ ["\u{1F7E8}", "large yellow square"],
848
+ ["\u{1F7E9}", "large green square"],
849
+ ["\u{1F7E6}", "large blue square"],
850
+ ["\u{1F7EA}", "large purple square"],
851
+ ["\u{1F7EB}", "large brown square"],
852
+ ["\u2B1B\uFE0F", "black large square"],
853
+ ["\u2B1C\uFE0F", "white large square"],
854
+ ["\u{1F536}", "large orange diamond"],
855
+ ["\u{1F537}", "large blue diamond"],
856
+ ["\u{1F538}", "small orange diamond"],
857
+ ["\u{1F539}", "small blue diamond"],
858
+ ["\u{1F53A}", "up pointing red triangle"],
859
+ ["\u{1F53B}", "down pointing red triangle"],
860
+ ["\u{1F4A0}", "diamond shape with a dot inside"],
861
+ ["\u{1F518}", "radio button"],
862
+ ["\u2660\uFE0F", "black spade suit"],
863
+ ["\u2663\uFE0F", "black club suit"],
864
+ ["\u2665\uFE0F", "black heart suit"],
865
+ ["\u2666\uFE0F", "black diamond suit"],
866
+ ["\u{1F0CF}", "playing card black joker"],
867
+ ["\u{1F3B4}", "flower playing cards"],
868
+ ["\u{1F004}", "mahjong tile red dragon"],
869
+ ["\u{1F552}\uFE0F", "clock face three oclock"],
870
+ ["\u{1F4F6}", "antenna with bars"],
871
+ ["\u{1F6BB}", "restroom"],
872
+ ["\u{1F6B9}", "mens symbol"],
873
+ ["\u{1F6BA}", "womens symbol"],
874
+ ["\u267F\uFE0F", "wheelchair symbol"],
875
+ ["\u{1F17F}", "negative squared latin capital letter p"],
876
+ ["\u2139\uFE0F", "information source"],
877
+ ["\u{1F523}", "input symbol for symbols"],
878
+ ["\u{1F524}", "input symbol for latin letters"],
879
+ ["\u{1F521}", "input symbol for latin small letters"],
880
+ ["\u{1F522}", "input symbol for numbers"],
881
+ ["\u{1F520}", "input symbol for latin capital letters"]
882
+ ]
883
+ }
884
+ ];
885
+ }
886
+ });
17
887
 
18
888
  // src/icons-data.ts
19
889
  var ICONS = {
@@ -753,6 +1623,85 @@ function PoolseFonts() {
753
1623
  return null;
754
1624
  }
755
1625
 
1626
+ // src/drafts.ts
1627
+ var localDraftStorage = {
1628
+ get: (key) => {
1629
+ try {
1630
+ return globalThis.localStorage?.getItem(key) ?? null;
1631
+ } catch {
1632
+ return null;
1633
+ }
1634
+ },
1635
+ set: (key, value) => {
1636
+ try {
1637
+ globalThis.localStorage?.setItem(key, value);
1638
+ } catch {
1639
+ }
1640
+ },
1641
+ remove: (key) => {
1642
+ try {
1643
+ globalThis.localStorage?.removeItem(key);
1644
+ } catch {
1645
+ }
1646
+ }
1647
+ };
1648
+ var memory = /* @__PURE__ */ new Map();
1649
+ function draftKey(userId, conversationId) {
1650
+ return `poolse:draft:${userId}:${conversationId}`;
1651
+ }
1652
+ var isEmpty = (d) => d.text.trim() === "" && !d.replyTo;
1653
+ function readDraft(storage, key) {
1654
+ const held = memory.get(key);
1655
+ if (held) return held;
1656
+ let raw;
1657
+ try {
1658
+ raw = storage.get(key);
1659
+ } catch {
1660
+ return null;
1661
+ }
1662
+ const hold = (d) => {
1663
+ if (d && !memory.has(key)) memory.set(key, d);
1664
+ return memory.get(key) ?? d;
1665
+ };
1666
+ if (raw instanceof Promise)
1667
+ return raw.then(
1668
+ (r) => hold(parse(r)),
1669
+ () => null
1670
+ );
1671
+ return hold(parse(raw));
1672
+ }
1673
+ function writeDraft(storage, key, draft) {
1674
+ if (isEmpty(draft)) {
1675
+ clearDraft(storage, key);
1676
+ return;
1677
+ }
1678
+ memory.set(key, draft);
1679
+ const value = JSON.stringify({ v: 1, text: draft.text, replyTo: draft.replyTo });
1680
+ try {
1681
+ void Promise.resolve(storage.set(key, value)).catch(() => void 0);
1682
+ } catch {
1683
+ }
1684
+ }
1685
+ function clearDraft(storage, key) {
1686
+ memory.delete(key);
1687
+ try {
1688
+ void Promise.resolve(storage.remove(key)).catch(() => void 0);
1689
+ } catch {
1690
+ }
1691
+ }
1692
+ function parse(raw) {
1693
+ if (!raw) return null;
1694
+ try {
1695
+ const v = JSON.parse(raw);
1696
+ const text = typeof v.text === "string" ? v.text : "";
1697
+ const replyTo = v.replyTo && typeof v.replyTo === "object" && typeof v.replyTo.id === "string" ? v.replyTo : null;
1698
+ const draft = { text, replyTo };
1699
+ return isEmpty(draft) ? null : draft;
1700
+ } catch {
1701
+ return null;
1702
+ }
1703
+ }
1704
+
756
1705
  // src/layout.ts
757
1706
  function formatMessageTime(iso, format) {
758
1707
  if (!iso) return "";
@@ -797,6 +1746,488 @@ function LiveCallBanner({ call, inCall, onJoin }) {
797
1746
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "poolse-live-call__join", onClick: () => onJoin(call), children: "Join" })
798
1747
  ] });
799
1748
  }
1749
+ function formatRelativeTime(iso, now = Date.now()) {
1750
+ if (!iso) return "";
1751
+ const then = new Date(iso).getTime();
1752
+ if (Number.isNaN(then)) return "";
1753
+ const sec = Math.max(0, Math.floor((now - then) / 1e3));
1754
+ if (sec < 60) return "just now";
1755
+ if (sec < 3600) return `${Math.floor(sec / 60)}m ago`;
1756
+ if (sec < 86400) return `${Math.floor(sec / 3600)}h ago`;
1757
+ const days = Math.floor(sec / 86400);
1758
+ if (days === 1) return "yesterday";
1759
+ if (days < 7) return `${days}d ago`;
1760
+ const date = new Date(then);
1761
+ const sameYear = date.getFullYear() === new Date(now).getFullYear();
1762
+ return date.toLocaleDateString(void 0, {
1763
+ month: "short",
1764
+ day: "numeric",
1765
+ ...sameYear ? {} : { year: "numeric" }
1766
+ });
1767
+ }
1768
+ function useNow(intervalMs = 6e4) {
1769
+ const [now, setNow] = react.useState(() => Date.now());
1770
+ react.useEffect(() => {
1771
+ const t = setInterval(() => setNow(Date.now()), intervalMs);
1772
+ return () => clearInterval(t);
1773
+ }, [intervalMs]);
1774
+ return now;
1775
+ }
1776
+ function PresenceBadge({
1777
+ state,
1778
+ doNotDisturb = false,
1779
+ size = "md",
1780
+ className
1781
+ }) {
1782
+ if (!state || state === "offline") return null;
1783
+ const kind = doNotDisturb ? "dnd" : state;
1784
+ const label = doNotDisturb ? "Do not disturb" : presenceStateLabel(state);
1785
+ return /* @__PURE__ */ jsxRuntime.jsx(
1786
+ "span",
1787
+ {
1788
+ className: [
1789
+ "poolse-presence-badge",
1790
+ `poolse-presence-badge--${kind}`,
1791
+ `poolse-presence-badge--${size}`,
1792
+ className
1793
+ ].filter(Boolean).join(" "),
1794
+ role: "img",
1795
+ "aria-label": label,
1796
+ title: label,
1797
+ "data-presence": kind,
1798
+ children: kind === "in_call" ? /* @__PURE__ */ jsxRuntime.jsx(PhoneGlyph, {}) : kind === "dnd" ? /* @__PURE__ */ jsxRuntime.jsx(MoonGlyph, {}) : null
1799
+ }
1800
+ );
1801
+ }
1802
+ function presenceStateLabel(state) {
1803
+ switch (state) {
1804
+ case "online":
1805
+ return "Online";
1806
+ case "away":
1807
+ return "Away";
1808
+ case "in_call":
1809
+ return "In a call";
1810
+ default:
1811
+ return "Offline";
1812
+ }
1813
+ }
1814
+ function presenceText(presence, now = Date.now()) {
1815
+ if (!presence) return null;
1816
+ if (presence.state === "offline") {
1817
+ const ago = formatRelativeTime(presence.last_seen_at, now);
1818
+ return ago ? `Last seen ${ago}` : "Offline";
1819
+ }
1820
+ return presenceStateLabel(presence.state);
1821
+ }
1822
+ function PhoneGlyph() {
1823
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsxRuntime.jsx(
1824
+ "path",
1825
+ {
1826
+ fill: "currentColor",
1827
+ d: "M6.6 10.8a15.1 15.1 0 0 0 6.6 6.6l2.2-2.2a1 1 0 0 1 1-.25 11.4 11.4 0 0 0 3.6.57 1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1c0 1.25.2 2.45.57 3.57a1 1 0 0 1-.25 1z"
1828
+ }
1829
+ ) });
1830
+ }
1831
+ function MoonGlyph() {
1832
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", d: "M20.5 14.6A8.6 8.6 0 0 1 9.4 3.5a8.6 8.6 0 1 0 11.1 11.1z" }) });
1833
+ }
1834
+ function Avatar({
1835
+ src,
1836
+ name,
1837
+ online,
1838
+ presence,
1839
+ userId,
1840
+ size = "md",
1841
+ className
1842
+ }) {
1843
+ const initials = computeInitials(name);
1844
+ const classes = ["poolse-avatar", size !== "md" ? `poolse-avatar--${size}` : null, className].filter(Boolean).join(" ");
1845
+ const badge = presence === true ? userId ? /* @__PURE__ */ jsxRuntime.jsx(LivePresenceBadge, { userId, size }) : null : presence ? typeof presence === "string" ? /* @__PURE__ */ jsxRuntime.jsx(PresenceBadge, { state: presence, size, className: "poolse-avatar__badge" }) : /* @__PURE__ */ jsxRuntime.jsx(
1846
+ PresenceBadge,
1847
+ {
1848
+ state: presence.state,
1849
+ doNotDisturb: !!presence.do_not_disturb,
1850
+ size,
1851
+ className: "poolse-avatar__badge"
1852
+ }
1853
+ ) : online ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-avatar__presence", "aria-hidden": "true" }) : null;
1854
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: classes, "aria-label": name ?? "avatar", role: "img", children: [
1855
+ src ? /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt: name ?? "" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: initials }),
1856
+ badge
1857
+ ] });
1858
+ }
1859
+ function LivePresenceBadge({ userId, size }) {
1860
+ const presence = react$1.useUserPresence(userId);
1861
+ if (!presence) return null;
1862
+ return /* @__PURE__ */ jsxRuntime.jsx(
1863
+ PresenceBadge,
1864
+ {
1865
+ state: presence.state,
1866
+ doNotDisturb: !!presence.do_not_disturb,
1867
+ ...size ? { size } : {},
1868
+ className: "poolse-avatar__badge"
1869
+ }
1870
+ );
1871
+ }
1872
+ function computeInitials(name) {
1873
+ if (!name) return "?";
1874
+ const parts = name.trim().split(/\s+/).slice(0, 2);
1875
+ return parts.map((p) => p.charAt(0).toUpperCase()).join("").slice(0, 2) || "?";
1876
+ }
1877
+ var RECENT_KEY = "poolse:recent-emoji";
1878
+ var RECENT_MAX = 24;
1879
+ var SEARCH_MAX = 120;
1880
+ var COLUMNS = 8;
1881
+ var dataPromise = null;
1882
+ var loadedData = null;
1883
+ function loadEmojiData() {
1884
+ dataPromise ??= Promise.resolve().then(() => (init_emojiData(), emojiData_exports)).then((m) => {
1885
+ loadedData = m.EMOJI_CATEGORIES;
1886
+ return loadedData;
1887
+ });
1888
+ return dataPromise;
1889
+ }
1890
+ var recentMemory = null;
1891
+ function readRecent() {
1892
+ if (recentMemory) return recentMemory;
1893
+ try {
1894
+ const raw = globalThis.localStorage?.getItem(RECENT_KEY);
1895
+ const parsed = raw ? JSON.parse(raw) : [];
1896
+ recentMemory = Array.isArray(parsed) ? parsed.filter((e) => typeof e === "string").slice(0, RECENT_MAX) : [];
1897
+ } catch {
1898
+ recentMemory = [];
1899
+ }
1900
+ return recentMemory;
1901
+ }
1902
+ function rememberEmoji(emoji) {
1903
+ const next = [emoji, ...readRecent().filter((e) => e !== emoji)].slice(0, RECENT_MAX);
1904
+ recentMemory = next;
1905
+ try {
1906
+ globalThis.localStorage?.setItem(RECENT_KEY, JSON.stringify(next));
1907
+ } catch {
1908
+ }
1909
+ }
1910
+ function EmojiPicker({ onPick, onClose, autoFocus = true, className }) {
1911
+ const [data, setData] = react.useState(loadedData);
1912
+ const [query, setQuery] = react.useState("");
1913
+ const [recent] = react.useState(readRecent);
1914
+ const rootRef = react.useRef(null);
1915
+ const searchRef = react.useRef(null);
1916
+ const gridRef = react.useRef(null);
1917
+ react.useEffect(() => {
1918
+ if (data) return;
1919
+ let live = true;
1920
+ void loadEmojiData().then((d) => {
1921
+ if (live) setData(d);
1922
+ });
1923
+ return () => {
1924
+ live = false;
1925
+ };
1926
+ }, [data]);
1927
+ react.useEffect(() => {
1928
+ if (autoFocus) searchRef.current?.focus();
1929
+ }, [autoFocus]);
1930
+ react.useEffect(() => {
1931
+ if (!onClose) return;
1932
+ const onPointer = (e) => {
1933
+ const t = e.target;
1934
+ if (t instanceof Node && rootRef.current && !rootRef.current.contains(t)) onClose();
1935
+ };
1936
+ document.addEventListener("pointerdown", onPointer, true);
1937
+ return () => document.removeEventListener("pointerdown", onPointer, true);
1938
+ }, [onClose]);
1939
+ const results = react.useMemo(() => {
1940
+ const q = query.trim().toLowerCase();
1941
+ if (!q || !data) return null;
1942
+ const words = q.split(/\s+/);
1943
+ const out = [];
1944
+ for (const cat of data) {
1945
+ for (const [emoji, keywords] of cat.emojis) {
1946
+ if (words.every((w) => keywords.includes(w))) out.push(emoji);
1947
+ if (out.length >= SEARCH_MAX) return out;
1948
+ }
1949
+ }
1950
+ return out;
1951
+ }, [query, data]);
1952
+ const pick = (emoji) => {
1953
+ rememberEmoji(emoji);
1954
+ onPick(emoji);
1955
+ };
1956
+ const sections = data ? [
1957
+ ...recent.length > 0 ? [{ id: "recent", label: "Recently used", emojis: recent }] : [],
1958
+ ...data.map((c) => ({ id: c.id, label: c.label, emojis: c.emojis.map(([e]) => e) }))
1959
+ ] : [];
1960
+ const jumpTo = (id) => {
1961
+ const el = gridRef.current?.querySelector(`[data-emoji-section="${id}"]`);
1962
+ if (el instanceof HTMLElement) {
1963
+ const grid = gridRef.current;
1964
+ grid.scrollTop = el.offsetTop - grid.offsetTop;
1965
+ }
1966
+ };
1967
+ const onGridKey = (e) => {
1968
+ const keys = {
1969
+ ArrowRight: 1,
1970
+ ArrowLeft: -1,
1971
+ ArrowDown: COLUMNS,
1972
+ ArrowUp: -COLUMNS
1973
+ };
1974
+ const step = keys[e.key];
1975
+ if (step === void 0) return;
1976
+ const buttons = Array.from(
1977
+ gridRef.current?.querySelectorAll(".poolse-emoji-picker__emoji") ?? []
1978
+ );
1979
+ const idx = buttons.findIndex((b) => b === document.activeElement);
1980
+ if (idx === -1) return;
1981
+ const next = buttons[idx + step];
1982
+ if (next) {
1983
+ next.focus();
1984
+ e.preventDefault();
1985
+ } else if (step < 0) {
1986
+ searchRef.current?.focus();
1987
+ e.preventDefault();
1988
+ }
1989
+ };
1990
+ const onRootKey = (e) => {
1991
+ if (e.key === "Escape") {
1992
+ e.stopPropagation();
1993
+ e.preventDefault();
1994
+ onClose?.();
1995
+ }
1996
+ };
1997
+ const emojiButton = (emoji, key) => /* @__PURE__ */ jsxRuntime.jsx(
1998
+ "button",
1999
+ {
2000
+ type: "button",
2001
+ className: "poolse-emoji-picker__emoji",
2002
+ onClick: () => pick(emoji),
2003
+ "aria-label": emoji,
2004
+ children: emoji
2005
+ },
2006
+ key
2007
+ );
2008
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2009
+ "div",
2010
+ {
2011
+ ref: rootRef,
2012
+ className: ["poolse-emoji-picker", className].filter(Boolean).join(" "),
2013
+ role: "dialog",
2014
+ "aria-label": "Emoji picker",
2015
+ onKeyDown: onRootKey,
2016
+ children: [
2017
+ /* @__PURE__ */ jsxRuntime.jsx(
2018
+ "input",
2019
+ {
2020
+ ref: searchRef,
2021
+ type: "search",
2022
+ className: "poolse-emoji-picker__search",
2023
+ placeholder: "Search emoji",
2024
+ "aria-label": "Search emoji",
2025
+ value: query,
2026
+ onChange: (e) => setQuery(e.target.value),
2027
+ onKeyDown: (e) => {
2028
+ if (e.key === "Enter") {
2029
+ e.preventDefault();
2030
+ const first = results?.[0];
2031
+ if (first) pick(first);
2032
+ }
2033
+ if (e.key === "ArrowDown") {
2034
+ e.preventDefault();
2035
+ gridRef.current?.querySelector(".poolse-emoji-picker__emoji")?.focus();
2036
+ }
2037
+ }
2038
+ }
2039
+ ),
2040
+ !results && data ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-emoji-picker__tabs", role: "toolbar", "aria-label": "Emoji categories", children: sections.map((s) => /* @__PURE__ */ jsxRuntime.jsx(
2041
+ "button",
2042
+ {
2043
+ type: "button",
2044
+ className: "poolse-emoji-picker__tab",
2045
+ "aria-label": s.label,
2046
+ title: s.label,
2047
+ onClick: () => jumpTo(s.id),
2048
+ children: s.id === "recent" ? "\u{1F558}" : s.emojis[0]
2049
+ },
2050
+ s.id
2051
+ )) }) : null,
2052
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: gridRef, className: "poolse-emoji-picker__scroll", onKeyDown: onGridKey, children: !data ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-emoji-picker__empty", children: "Loading\u2026" }) : results ? results.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-emoji-picker__empty", children: "No emoji found" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-emoji-picker__grid", role: "group", "aria-label": "Search results", children: results.map((e, i) => emojiButton(e, `${i}-${e}`)) }) : sections.map((s) => /* @__PURE__ */ jsxRuntime.jsxs("section", { "data-emoji-section": s.id, "aria-label": s.label, children: [
2053
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-emoji-picker__heading", children: s.label }),
2054
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-emoji-picker__grid", children: s.emojis.map((e, i) => emojiButton(e, `${s.id}-${i}`)) })
2055
+ ] }, s.id)) })
2056
+ ]
2057
+ }
2058
+ );
2059
+ }
2060
+ function ComposerEmojiButton({
2061
+ disabled,
2062
+ onPick
2063
+ }) {
2064
+ const [open, setOpen] = react.useState(false);
2065
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-composer__emoji", children: [
2066
+ /* @__PURE__ */ jsxRuntime.jsx(
2067
+ "button",
2068
+ {
2069
+ type: "button",
2070
+ className: "poolse-composer__attach poolse-composer__emoji-btn",
2071
+ onClick: () => setOpen((o) => !o),
2072
+ onPointerEnter: () => void loadEmojiData(),
2073
+ disabled,
2074
+ "aria-label": "Insert emoji",
2075
+ "aria-expanded": open,
2076
+ title: "Insert emoji",
2077
+ children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "emoji", size: 20, label: null })
2078
+ }
2079
+ ),
2080
+ open && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-composer__emoji-popover", children: /* @__PURE__ */ jsxRuntime.jsx(
2081
+ EmojiPicker,
2082
+ {
2083
+ onPick: (emoji) => {
2084
+ setOpen(false);
2085
+ onPick(emoji);
2086
+ },
2087
+ onClose: () => setOpen(false)
2088
+ }
2089
+ ) })
2090
+ ] });
2091
+ }
2092
+ function insertAtCaret(value, text, ta) {
2093
+ const el = ta.current;
2094
+ const start = el?.selectionStart ?? value.length;
2095
+ const end = el?.selectionEnd ?? value.length;
2096
+ const next = value.slice(0, start) + text + value.slice(end);
2097
+ const caret = start + text.length;
2098
+ requestAnimationFrame(() => {
2099
+ const t = ta.current;
2100
+ if (!t) return;
2101
+ t.focus();
2102
+ t.setSelectionRange(caret, caret);
2103
+ });
2104
+ return next;
2105
+ }
2106
+ function attachmentProblem(file, rules) {
2107
+ if (rules.maxFileSize !== void 0 && file.size > rules.maxFileSize) {
2108
+ return `Larger than ${formatBytes(rules.maxFileSize)}`;
2109
+ }
2110
+ const accept = rules.acceptFileTypes;
2111
+ if (accept && accept.length > 0 && !accept.some((rule) => matchesType(file, rule))) {
2112
+ return "This file type isn't allowed";
2113
+ }
2114
+ return null;
2115
+ }
2116
+ function matchesType(file, rule) {
2117
+ const r = rule.trim().toLowerCase();
2118
+ if (!r) return false;
2119
+ if (r.startsWith(".")) return file.name.toLowerCase().endsWith(r);
2120
+ const type = (file.type || "").toLowerCase();
2121
+ if (r.endsWith("/*")) return type.startsWith(r.slice(0, -1));
2122
+ return type === r;
2123
+ }
2124
+ function formatBytes(n) {
2125
+ if (n >= 1024 * 1024 * 1024) return `${trim(n / (1024 * 1024 * 1024))} GB`;
2126
+ if (n >= 1024 * 1024) return `${trim(n / (1024 * 1024))} MB`;
2127
+ if (n >= 1024) return `${trim(n / 1024)} KB`;
2128
+ return `${n} B`;
2129
+ }
2130
+ function trim(x) {
2131
+ return x >= 10 ? String(Math.round(x)) : String(Math.round(x * 10) / 10);
2132
+ }
2133
+ var fileKey = (name, size, type) => `${name}\0${size}\0${type}`;
2134
+ function useComposerAttachments(enabled, rules) {
2135
+ const { queue, uploadAll, cancel, remove } = react$1.useAttachmentUpload();
2136
+ const [rejected, setRejected] = react.useState([]);
2137
+ const thumbs = react.useRef(/* @__PURE__ */ new Map());
2138
+ react.useEffect(() => {
2139
+ const map = thumbs.current;
2140
+ return () => {
2141
+ for (const url of map.values()) URL.revokeObjectURL?.(url);
2142
+ map.clear();
2143
+ };
2144
+ }, []);
2145
+ const rulesRef = react.useRef(rules);
2146
+ rulesRef.current = rules;
2147
+ const addFiles = react.useCallback(
2148
+ (files) => {
2149
+ if (!enabled || files.length === 0) return;
2150
+ const ok = [];
2151
+ const refused = [];
2152
+ for (const f of files) {
2153
+ const problem = attachmentProblem(f, rulesRef.current);
2154
+ if (problem) {
2155
+ refused.push({
2156
+ localId: `rejected-${Math.random().toString(36).slice(2)}`,
2157
+ filename: f.name,
2158
+ contentType: f.type || "application/octet-stream",
2159
+ byteSize: f.size,
2160
+ status: "error",
2161
+ loaded: 0,
2162
+ attachment: null,
2163
+ error: new Error(problem)
2164
+ });
2165
+ continue;
2166
+ }
2167
+ ok.push(f);
2168
+ if (f.type.startsWith("image/") && typeof URL.createObjectURL === "function") {
2169
+ const key = fileKey(f.name, f.size, f.type);
2170
+ if (!thumbs.current.has(key)) thumbs.current.set(key, URL.createObjectURL(f));
2171
+ }
2172
+ }
2173
+ if (refused.length > 0) setRejected((prev) => [...prev, ...refused]);
2174
+ if (ok.length === 0) return;
2175
+ void uploadAll(
2176
+ ok.map((f) => ({
2177
+ body: f,
2178
+ contentType: f.type || "application/octet-stream",
2179
+ byteSize: f.size,
2180
+ filename: f.name
2181
+ }))
2182
+ ).catch(() => {
2183
+ });
2184
+ },
2185
+ [enabled, uploadAll]
2186
+ );
2187
+ const dismiss = react.useCallback(
2188
+ (localId) => {
2189
+ if (localId.startsWith("rejected-")) {
2190
+ setRejected((prev) => prev.filter((it) => it.localId !== localId));
2191
+ } else {
2192
+ remove(localId);
2193
+ }
2194
+ },
2195
+ [remove]
2196
+ );
2197
+ const previewFor = react.useCallback(
2198
+ (item) => thumbs.current.get(fileKey(item.filename, item.byteSize, item.contentType)) ?? null,
2199
+ []
2200
+ );
2201
+ const onPaste = react.useCallback(
2202
+ (e) => {
2203
+ if (!enabled) return;
2204
+ const files = Array.from(e.clipboardData?.files ?? []);
2205
+ if (files.length === 0) return;
2206
+ e.preventDefault();
2207
+ addFiles(files);
2208
+ },
2209
+ [enabled, addFiles]
2210
+ );
2211
+ const live = queue.filter((it) => it.status !== "cancelled");
2212
+ return {
2213
+ queue,
2214
+ /** Every chip to show: staged uploads, then files refused before upload. */
2215
+ items: [...live, ...rejected],
2216
+ ready: queue.filter((it) => it.status === "ready"),
2217
+ uploading: queue.some((it) => it.status === "pending" || it.status === "uploading"),
2218
+ addFiles,
2219
+ cancel,
2220
+ /** Remove a chip (an upload or a refused file). */
2221
+ dismiss,
2222
+ remove,
2223
+ /** Clear the refused-file chips (after a send). */
2224
+ clearRejected: () => setRejected([]),
2225
+ previewFor,
2226
+ onPaste,
2227
+ /** For the file input's `accept`. */
2228
+ accept: rules.acceptFileTypes?.join(",") || void 0
2229
+ };
2230
+ }
800
2231
 
801
2232
  // src/listAutocomplete.ts
802
2233
  var UNORDERED_RE = /^(\s*)([-*+]) (.*)$/;
@@ -831,12 +2262,18 @@ ${indent}${nextMarker} `;
831
2262
  caret: caret + prefix.length
832
2263
  };
833
2264
  }
834
- function UploadQueueStrip({ items, onCancel, onDismiss }) {
2265
+ function UploadQueueStrip({
2266
+ items,
2267
+ onCancel,
2268
+ onDismiss,
2269
+ previewFor
2270
+ }) {
835
2271
  if (items.length === 0) return null;
836
2272
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-upload-strip", role: "status", "aria-live": "polite", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
837
2273
  UploadChip,
838
2274
  {
839
2275
  item,
2276
+ thumbnail: previewFor?.(item) ?? null,
840
2277
  onCancel: () => onCancel(item.localId),
841
2278
  onDismiss: () => onDismiss(item.localId)
842
2279
  },
@@ -845,6 +2282,7 @@ function UploadQueueStrip({ items, onCancel, onDismiss }) {
845
2282
  }
846
2283
  function UploadChip({
847
2284
  item,
2285
+ thumbnail,
848
2286
  onCancel,
849
2287
  onDismiss
850
2288
  }) {
@@ -858,7 +2296,7 @@ function UploadChip({
858
2296
  className: `poolse-upload-chip poolse-upload-chip--${item.status}`,
859
2297
  "data-status": item.status,
860
2298
  children: [
861
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-upload-chip__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: isReady ? "check" : "attachment", size: 18, label: null }) }),
2299
+ thumbnail && !isError ? /* @__PURE__ */ jsxRuntime.jsx("img", { className: "poolse-upload-chip__thumb", src: thumbnail, alt: "", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-upload-chip__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: isReady ? "check" : "attachment", size: 18, label: null }) }),
862
2300
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-upload-chip__body", children: [
863
2301
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-upload-chip__filename", title: item.filename, children: item.filename }),
864
2302
  isError ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-upload-chip__error", children: item.error?.message ?? "Upload failed" }) : isReady ? (
@@ -894,31 +2332,6 @@ function UploadChip({
894
2332
  }
895
2333
  );
896
2334
  }
897
- var MAX_NAME_CHARS = 24;
898
- function UserName({
899
- externalId,
900
- labelFor,
901
- emptyFallback = "Unknown",
902
- className
903
- }) {
904
- const { profile } = react$1.useUser(labelFor ? null : externalId);
905
- const name = resolveDisplayName(externalId, profile?.displayName, labelFor, emptyFallback);
906
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: truncate(name) });
907
- }
908
- function useDisplayName(externalId, labelFor, emptyFallback = "Unknown") {
909
- const { profile } = react$1.useUser(labelFor ? null : externalId);
910
- return resolveDisplayName(externalId, profile?.displayName, labelFor, emptyFallback);
911
- }
912
- function resolveDisplayName(externalId, resolved, labelFor, emptyFallback) {
913
- if (!externalId) return emptyFallback;
914
- if (labelFor) return labelFor(externalId);
915
- if (resolved) return resolved;
916
- return externalId;
917
- }
918
- function truncate(s) {
919
- if (s.length <= MAX_NAME_CHARS) return s;
920
- return s.slice(0, MAX_NAME_CHARS - 1) + "\u2026";
921
- }
922
2335
  function useAutogrow(ref, value) {
923
2336
  react.useEffect(() => {
924
2337
  const ta = ref.current;
@@ -927,6 +2340,7 @@ function useAutogrow(ref, value) {
927
2340
  ta.style.height = `${ta.scrollHeight}px`;
928
2341
  }, [ref, value]);
929
2342
  }
2343
+ var MAX_SUGGESTIONS = 8;
930
2344
  var MentionInput = react.forwardRef(
931
2345
  function MentionInput2({
932
2346
  conversationId,
@@ -937,52 +2351,83 @@ var MentionInput = react.forwardRef(
937
2351
  labelFor,
938
2352
  replyingTo,
939
2353
  onCancelReply,
940
- attachments = true
2354
+ attachments = true,
2355
+ emojiPicker = true,
2356
+ maxFileSize,
2357
+ acceptFileTypes,
2358
+ onValueChange
941
2359
  }, ref) {
2360
+ const chat = react$1.usePoolse();
942
2361
  const { members } = react$1.useMembers(conversationId);
943
2362
  const [value, setValue] = react.useState("");
944
2363
  const [sending, setSending] = react.useState(false);
945
2364
  const [mention, setMention] = react.useState(null);
946
2365
  const [activeIdx, setActiveIdx] = react.useState(0);
947
- const selectedMentions = react.useRef(/* @__PURE__ */ new Set());
2366
+ const menuId = react.useId();
2367
+ const [, bumpProfiles] = react.useReducer((n) => n + 1, 0);
2368
+ const selectedMentions = react.useRef(/* @__PURE__ */ new Map());
948
2369
  const taRef = react.useRef(null);
949
2370
  const fileInputRef = react.useRef(null);
950
2371
  useAutogrow(taRef, value);
951
- const { queue, uploadAll, cancel: cancelUpload, remove: removeUpload } = react$1.useAttachmentUpload();
952
- const visibleUploads = queue.filter((it) => it.status !== "cancelled");
953
- const readyCount = queue.filter((it) => it.status === "ready").length;
954
- const uploading = queue.some((it) => it.status === "pending" || it.status === "uploading");
955
- const addFiles = react.useCallback(
956
- (files) => {
957
- if (!attachments || files.length === 0) return;
958
- void uploadAll(
959
- files.map((f) => ({
960
- body: f,
961
- contentType: f.type || "application/octet-stream",
962
- byteSize: f.size,
963
- filename: f.name
964
- }))
965
- ).catch(() => {
966
- });
967
- },
968
- [attachments, uploadAll]
2372
+ const uploads = useComposerAttachments(attachments, {
2373
+ ...maxFileSize !== void 0 ? { maxFileSize } : {},
2374
+ ...acceptFileTypes ? { acceptFileTypes } : {}
2375
+ });
2376
+ const { addFiles, uploading } = uploads;
2377
+ const visibleUploads = uploads.items;
2378
+ const readyCount = uploads.ready.length;
2379
+ const valueRef = react.useRef(value);
2380
+ valueRef.current = value;
2381
+ const onValueChangeRef = react.useRef(onValueChange);
2382
+ onValueChangeRef.current = onValueChange;
2383
+ const reportedRef = react.useRef(value);
2384
+ react.useEffect(() => {
2385
+ if (reportedRef.current === value) return;
2386
+ reportedRef.current = value;
2387
+ onValueChangeRef.current?.(value);
2388
+ }, [value]);
2389
+ react.useImperativeHandle(
2390
+ ref,
2391
+ () => ({
2392
+ addFiles,
2393
+ getText: () => valueRef.current,
2394
+ setText: (text) => setValue(text),
2395
+ focus: () => taRef.current?.focus()
2396
+ }),
2397
+ [addFiles]
969
2398
  );
970
- react.useImperativeHandle(ref, () => ({ addFiles }), [addFiles]);
971
- const label = labelFor ?? ((id) => id);
972
- const filtered = mention ? members.filter(
973
- (m) => label(m.external_id).toLowerCase().includes(mention.query.toLowerCase())
974
- ) : [];
2399
+ const label = (id) => labelFor?.(id) ?? chat.users.peek(id)?.displayName ?? id;
2400
+ const meId = chat.me.peek()?.id ?? null;
2401
+ const menuOpen = mention !== null;
2402
+ react.useEffect(() => {
2403
+ if (!menuOpen || labelFor) return;
2404
+ let live = true;
2405
+ for (const m of members) {
2406
+ if (chat.users.peek(m.external_id) !== void 0) continue;
2407
+ void chat.users.get(m.external_id).then(() => {
2408
+ if (live) bumpProfiles();
2409
+ }).catch(() => void 0);
2410
+ }
2411
+ return () => {
2412
+ live = false;
2413
+ };
2414
+ }, [menuOpen, members, chat, labelFor]);
2415
+ const filtered = mention ? rankMembers(
2416
+ members.filter((m) => m.user_id !== meId),
2417
+ mention.query.toLowerCase(),
2418
+ label
2419
+ ).slice(0, MAX_SUGGESTIONS) : [];
975
2420
  react.useEffect(() => {
976
2421
  setActiveIdx(0);
977
2422
  }, [filtered.length, mention?.query]);
978
2423
  const submit = async () => {
979
2424
  const trimmed = value.trim();
980
- const ready = queue.filter((it) => it.status === "ready");
2425
+ const ready = uploads.ready;
981
2426
  const hasReady = ready.length > 0;
982
2427
  if (!trimmed && !hasReady || sending || uploading) return;
983
2428
  setSending(true);
984
2429
  try {
985
- const mentions = Array.from(selectedMentions.current);
2430
+ const mentions = [...selectedMentions.current].filter(([, name]) => trimmed.includes(`@${name}`)).map(([id]) => id);
986
2431
  await onSend({
987
2432
  body: trimmed,
988
2433
  ...mentions.length > 0 ? { mentions } : {},
@@ -990,8 +2435,9 @@ var MentionInput = react.forwardRef(
990
2435
  ...hasReady ? { attachment_ids: ready.map((it) => it.attachment.id) } : {}
991
2436
  });
992
2437
  setValue("");
993
- selectedMentions.current = /* @__PURE__ */ new Set();
994
- for (const it of ready) removeUpload(it.localId);
2438
+ selectedMentions.current = /* @__PURE__ */ new Map();
2439
+ for (const it of ready) uploads.remove(it.localId);
2440
+ uploads.clearRejected();
995
2441
  } finally {
996
2442
  setSending(false);
997
2443
  }
@@ -1003,7 +2449,7 @@ var MentionInput = react.forwardRef(
1003
2449
  const after = value.slice(mention.start + 1 + mention.query.length);
1004
2450
  const inserted = `@${name} `;
1005
2451
  const next = `${before}${inserted}${after}`;
1006
- selectedMentions.current.add(m.user_id);
2452
+ selectedMentions.current.set(m.user_id, name);
1007
2453
  setValue(next);
1008
2454
  setMention(null);
1009
2455
  requestAnimationFrame(() => {
@@ -1116,8 +2562,9 @@ var MentionInput = react.forwardRef(
1116
2562
  UploadQueueStrip,
1117
2563
  {
1118
2564
  items: visibleUploads,
1119
- onCancel: cancelUpload,
1120
- onDismiss: removeUpload
2565
+ onCancel: uploads.cancel,
2566
+ onDismiss: uploads.dismiss,
2567
+ previewFor: uploads.previewFor
1121
2568
  }
1122
2569
  ),
1123
2570
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-composer__row", children: [
@@ -1128,6 +2575,7 @@ var MentionInput = react.forwardRef(
1128
2575
  ref: fileInputRef,
1129
2576
  type: "file",
1130
2577
  multiple: true,
2578
+ ...uploads.accept ? { accept: uploads.accept } : {},
1131
2579
  className: "poolse-attach-input",
1132
2580
  onChange: (e) => {
1133
2581
  const files = Array.from(e.target.files ?? []);
@@ -1158,14 +2606,22 @@ var MentionInput = react.forwardRef(
1158
2606
  value,
1159
2607
  onChange,
1160
2608
  onKeyDown,
2609
+ onPaste: uploads.onPaste,
1161
2610
  placeholder,
1162
2611
  disabled: disabled || sending,
1163
2612
  "aria-label": placeholder,
1164
2613
  role: "combobox",
1165
2614
  "aria-expanded": Boolean(mention && filtered.length > 0),
1166
- "aria-controls": "poolse-mention-menu",
2615
+ "aria-controls": menuId,
1167
2616
  "aria-autocomplete": "list",
1168
- ...mention && filtered.length > 0 ? { "aria-activedescendant": `poolse-mention-opt-${activeIdx}` } : {}
2617
+ ...mention && filtered.length > 0 ? { "aria-activedescendant": `${menuId}-opt-${activeIdx}` } : {}
2618
+ }
2619
+ ),
2620
+ emojiPicker && /* @__PURE__ */ jsxRuntime.jsx(
2621
+ ComposerEmojiButton,
2622
+ {
2623
+ disabled: disabled || sending,
2624
+ onPick: (emoji) => setValue((v) => insertAtCaret(v, emoji, taRef))
1169
2625
  }
1170
2626
  ),
1171
2627
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1180,38 +2636,46 @@ var MentionInput = react.forwardRef(
1180
2636
  }
1181
2637
  )
1182
2638
  ] }),
1183
- mention && filtered.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
2639
+ mention && filtered.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { id: menuId, className: "poolse-mention-menu", role: "listbox", "aria-label": "Members", children: filtered.map((m, i) => /* @__PURE__ */ jsxRuntime.jsx(
1184
2640
  "div",
1185
2641
  {
1186
- id: "poolse-mention-menu",
1187
- className: "poolse-mention-menu",
1188
- role: "listbox",
1189
- "aria-label": "Members",
1190
- children: filtered.map((m, i) => /* @__PURE__ */ jsxRuntime.jsxs(
1191
- "div",
1192
- {
1193
- id: `poolse-mention-opt-${i}`,
1194
- role: "option",
1195
- "aria-selected": i === activeIdx,
1196
- className: `poolse-mention-menu__item${i === activeIdx ? " poolse-mention-menu__item--active" : ""}`,
1197
- onMouseDown: (e) => {
1198
- e.preventDefault();
1199
- insertMention(m);
1200
- },
1201
- children: [
1202
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "@" }),
1203
- /* @__PURE__ */ jsxRuntime.jsx(UserName, { externalId: m.external_id, ...labelFor ? { labelFor } : {} })
1204
- ]
1205
- },
1206
- m.id
1207
- ))
1208
- }
1209
- )
2642
+ id: `${menuId}-opt-${i}`,
2643
+ role: "option",
2644
+ "aria-selected": i === activeIdx,
2645
+ className: `poolse-mention-menu__item${i === activeIdx ? " poolse-mention-menu__item--active" : ""}`,
2646
+ onMouseEnter: () => setActiveIdx(i),
2647
+ onMouseDown: (e) => {
2648
+ e.preventDefault();
2649
+ insertMention(m);
2650
+ },
2651
+ children: /* @__PURE__ */ jsxRuntime.jsx(MentionOption, { member: m, name: label(m.external_id) })
2652
+ },
2653
+ m.id
2654
+ )) })
1210
2655
  ]
1211
2656
  }
1212
2657
  );
1213
2658
  }
1214
2659
  );
2660
+ function MentionOption({ member, name }) {
2661
+ const { profile } = react$1.useUser(member.external_id);
2662
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2663
+ /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: profile?.avatarUrl ?? null, name, size: "xs" }),
2664
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-mention-menu__name", children: name }),
2665
+ name !== member.external_id ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-mention-menu__handle", children: member.external_id }) : null
2666
+ ] });
2667
+ }
2668
+ function rankMembers(members, query, label) {
2669
+ const scored = [];
2670
+ for (const m of members) {
2671
+ const name = label(m.external_id).toLowerCase();
2672
+ const ext = m.external_id.toLowerCase();
2673
+ const score = query === "" ? 1 : name.startsWith(query) ? 3 : name.split(/\s+/).some((w) => w.startsWith(query)) ? 2 : name.includes(query) || ext.includes(query) ? 1 : 0;
2674
+ if (score > 0) scored.push({ m, score, name });
2675
+ }
2676
+ scored.sort((a, b) => b.score - a.score || a.name.localeCompare(b.name));
2677
+ return scored.map((s) => s.m);
2678
+ }
1215
2679
  var MessageComposer = react.forwardRef(
1216
2680
  function MessageComposer2({
1217
2681
  onSend,
@@ -1221,36 +2685,47 @@ var MessageComposer = react.forwardRef(
1221
2685
  replyingTo,
1222
2686
  onCancelReply,
1223
2687
  labelFor,
1224
- attachments = true
2688
+ attachments = true,
2689
+ emojiPicker = true,
2690
+ maxFileSize,
2691
+ acceptFileTypes,
2692
+ onValueChange
1225
2693
  }, ref) {
1226
2694
  const [value, setValue] = react.useState("");
1227
2695
  const [sending, setSending] = react.useState(false);
1228
2696
  const taRef = react.useRef(null);
1229
2697
  const fileInputRef = react.useRef(null);
1230
2698
  useAutogrow(taRef, value);
1231
- const { queue, uploadAll, cancel: cancelUpload, remove: removeUpload } = react$1.useAttachmentUpload();
1232
- const visibleUploads = queue.filter((it) => it.status !== "cancelled");
1233
- const readyCount = queue.filter((it) => it.status === "ready").length;
1234
- const uploading = queue.some((it) => it.status === "pending" || it.status === "uploading");
1235
- const addFiles = react.useCallback(
1236
- (files) => {
1237
- if (!attachments || files.length === 0) return;
1238
- void uploadAll(
1239
- files.map((f) => ({
1240
- body: f,
1241
- contentType: f.type || "application/octet-stream",
1242
- byteSize: f.size,
1243
- filename: f.name
1244
- }))
1245
- ).catch(() => {
1246
- });
1247
- },
1248
- [attachments, uploadAll]
2699
+ const uploads = useComposerAttachments(attachments, {
2700
+ ...maxFileSize !== void 0 ? { maxFileSize } : {},
2701
+ ...acceptFileTypes ? { acceptFileTypes } : {}
2702
+ });
2703
+ const { addFiles, uploading } = uploads;
2704
+ const visibleUploads = uploads.items;
2705
+ const readyCount = uploads.ready.length;
2706
+ const valueRef = react.useRef(value);
2707
+ valueRef.current = value;
2708
+ const onValueChangeRef = react.useRef(onValueChange);
2709
+ onValueChangeRef.current = onValueChange;
2710
+ const reportedRef = react.useRef(value);
2711
+ react.useEffect(() => {
2712
+ if (reportedRef.current === value) return;
2713
+ reportedRef.current = value;
2714
+ onValueChangeRef.current?.(value);
2715
+ }, [value]);
2716
+ react.useImperativeHandle(
2717
+ ref,
2718
+ () => ({
2719
+ addFiles,
2720
+ getText: () => valueRef.current,
2721
+ setText: (text) => setValue(text),
2722
+ focus: () => taRef.current?.focus()
2723
+ }),
2724
+ [addFiles]
1249
2725
  );
1250
- react.useImperativeHandle(ref, () => ({ addFiles }), [addFiles]);
1251
2726
  const submit = async () => {
1252
2727
  const trimmed = value.trim();
1253
- const ready = queue.filter((it) => it.status === "ready");
2728
+ const ready = uploads.ready;
1254
2729
  const hasReady = ready.length > 0;
1255
2730
  if (!trimmed && !hasReady || sending || uploading) return;
1256
2731
  const opts = {
@@ -1258,7 +2733,8 @@ var MessageComposer = react.forwardRef(
1258
2733
  ...hasReady ? { attachment_ids: ready.map((it) => it.attachment.id) } : {}
1259
2734
  };
1260
2735
  setValue("");
1261
- for (const it of ready) removeUpload(it.localId);
2736
+ for (const it of ready) uploads.remove(it.localId);
2737
+ uploads.clearRejected();
1262
2738
  setSending(true);
1263
2739
  try {
1264
2740
  await onSend(trimmed, Object.keys(opts).length > 0 ? opts : void 0);
@@ -1313,8 +2789,9 @@ var MessageComposer = react.forwardRef(
1313
2789
  UploadQueueStrip,
1314
2790
  {
1315
2791
  items: visibleUploads,
1316
- onCancel: cancelUpload,
1317
- onDismiss: removeUpload
2792
+ onCancel: uploads.cancel,
2793
+ onDismiss: uploads.dismiss,
2794
+ previewFor: uploads.previewFor
1318
2795
  }
1319
2796
  ),
1320
2797
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-composer__row", children: [
@@ -1325,6 +2802,7 @@ var MessageComposer = react.forwardRef(
1325
2802
  ref: fileInputRef,
1326
2803
  type: "file",
1327
2804
  multiple: true,
2805
+ ...uploads.accept ? { accept: uploads.accept } : {},
1328
2806
  className: "poolse-attach-input",
1329
2807
  onChange: (e) => {
1330
2808
  const files = Array.from(e.target.files ?? []);
@@ -1355,11 +2833,19 @@ var MessageComposer = react.forwardRef(
1355
2833
  value,
1356
2834
  onChange,
1357
2835
  onKeyDown,
2836
+ onPaste: uploads.onPaste,
1358
2837
  placeholder,
1359
2838
  disabled: disabled || sending,
1360
2839
  "aria-label": placeholder
1361
2840
  }
1362
2841
  ),
2842
+ emojiPicker && /* @__PURE__ */ jsxRuntime.jsx(
2843
+ ComposerEmojiButton,
2844
+ {
2845
+ disabled: disabled || sending,
2846
+ onPick: (emoji) => setValue((v) => insertAtCaret(v, emoji, taRef))
2847
+ }
2848
+ ),
1363
2849
  /* @__PURE__ */ jsxRuntime.jsx(
1364
2850
  "button",
1365
2851
  {
@@ -1405,24 +2891,6 @@ function ReplyChip({
1405
2891
  )
1406
2892
  ] });
1407
2893
  }
1408
- function Avatar({ src, name, online, size = "md", className }) {
1409
- const initials = computeInitials(name);
1410
- const classes = [
1411
- "poolse-avatar",
1412
- size === "sm" ? "poolse-avatar--sm" : null,
1413
- size === "lg" ? "poolse-avatar--lg" : null,
1414
- className
1415
- ].filter(Boolean).join(" ");
1416
- return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: classes, "aria-label": name ?? "avatar", role: "img", children: [
1417
- src ? /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt: name ?? "" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: initials }),
1418
- online ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-avatar__presence", "aria-hidden": "true" }) : null
1419
- ] });
1420
- }
1421
- function computeInitials(name) {
1422
- if (!name) return "?";
1423
- const parts = name.trim().split(/\s+/).slice(0, 2);
1424
- return parts.map((p) => p.charAt(0).toUpperCase()).join("").slice(0, 2) || "?";
1425
- }
1426
2894
  function CallLogRow({ msg, meId, onCallBack }) {
1427
2895
  const display = react$1.callLogDisplayFor(msg, meId);
1428
2896
  if (!display) return null;
@@ -1544,7 +3012,7 @@ function AttachmentPreview({ attachment, onClick }) {
1544
3012
  ),
1545
3013
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-attachment__file-body", children: [
1546
3014
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-attachment__file-name", children: filename }),
1547
- byteSize !== null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-attachment__file-meta", children: formatBytes(byteSize) })
3015
+ byteSize !== null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-attachment__file-meta", children: formatBytes2(byteSize) })
1548
3016
  ] }),
1549
3017
  /* @__PURE__ */ jsxRuntime.jsx(
1550
3018
  PoolseIcon,
@@ -1621,21 +3089,274 @@ function Lightbox({
1621
3089
  )
1622
3090
  ]
1623
3091
  }
1624
- );
3092
+ );
3093
+ }
3094
+ function guessContentType(url) {
3095
+ const m = url.match(/\.([a-z0-9]+)(?:\?|#|$)/i);
3096
+ if (!m) return "application/octet-stream";
3097
+ const ext = m[1].toLowerCase();
3098
+ const imageExts = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "avif", "svg"]);
3099
+ if (imageExts.has(ext)) return `image/${ext === "jpg" ? "jpeg" : ext}`;
3100
+ return "application/octet-stream";
3101
+ }
3102
+ function formatBytes2(n) {
3103
+ if (n < 1024) return `${n} B`;
3104
+ if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
3105
+ if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`;
3106
+ return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`;
3107
+ }
3108
+ var POPOVER_WIDTH = 280;
3109
+ function EditedLabel({ messageId, label = "edited", className }) {
3110
+ const history = useEditHistory(messageId);
3111
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3112
+ history.label(label, className),
3113
+ history.popover
3114
+ ] });
3115
+ }
3116
+ function useEditHistory(messageId) {
3117
+ const chat = react$1.usePoolse();
3118
+ const [open, setOpen] = react.useState(false);
3119
+ const [forbidden, setForbidden] = react.useState(false);
3120
+ const [history, setHistory] = react.useState({ status: "idle" });
3121
+ const [position, setPosition] = react.useState(null);
3122
+ const buttonRef = react.useRef(null);
3123
+ const popoverRef = react.useRef(null);
3124
+ react.useEffect(() => {
3125
+ setOpen(false);
3126
+ setForbidden(false);
3127
+ setHistory({ status: "idle" });
3128
+ }, [messageId]);
3129
+ const load = () => {
3130
+ setHistory({ status: "loading" });
3131
+ chat.messages.edits(messageId).then((list) => setHistory({ status: "ready", edits: list.data })).catch((err) => {
3132
+ if (err instanceof react$1.ApiError && err.status === 403) {
3133
+ setForbidden(true);
3134
+ setOpen(false);
3135
+ return;
3136
+ }
3137
+ setHistory({ status: "error" });
3138
+ });
3139
+ };
3140
+ react.useLayoutEffect(() => {
3141
+ if (!open) return;
3142
+ const place = () => {
3143
+ const rect = buttonRef.current?.getBoundingClientRect();
3144
+ if (!rect) return;
3145
+ const vw = window.innerWidth || POPOVER_WIDTH + 16;
3146
+ const left = Math.max(8, Math.min(rect.right - POPOVER_WIDTH, vw - POPOVER_WIDTH - 8));
3147
+ const below = rect.top < 200;
3148
+ setPosition(
3149
+ below ? { position: "fixed", left, top: rect.bottom + 6 } : { position: "fixed", left, top: rect.top - 6, transform: "translateY(-100%)" }
3150
+ );
3151
+ };
3152
+ place();
3153
+ window.addEventListener("resize", place);
3154
+ return () => window.removeEventListener("resize", place);
3155
+ }, [open]);
3156
+ react.useEffect(() => {
3157
+ if (!open) return;
3158
+ const onDown = (e) => {
3159
+ const t = e.target;
3160
+ if (!(t instanceof Node)) return;
3161
+ if (popoverRef.current?.contains(t) || buttonRef.current?.contains(t)) return;
3162
+ setOpen(false);
3163
+ };
3164
+ const onKey = (e) => {
3165
+ if (e.key === "Escape") {
3166
+ setOpen(false);
3167
+ buttonRef.current?.focus();
3168
+ }
3169
+ };
3170
+ const onScroll = (e) => {
3171
+ if (e.target instanceof Node && popoverRef.current?.contains(e.target)) return;
3172
+ setOpen(false);
3173
+ };
3174
+ document.addEventListener("pointerdown", onDown, true);
3175
+ document.addEventListener("keydown", onKey);
3176
+ document.addEventListener("scroll", onScroll, true);
3177
+ return () => {
3178
+ document.removeEventListener("pointerdown", onDown, true);
3179
+ document.removeEventListener("keydown", onKey);
3180
+ document.removeEventListener("scroll", onScroll, true);
3181
+ };
3182
+ }, [open]);
3183
+ const label = (text = "edited", className) => forbidden ? /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: text }) : /* @__PURE__ */ jsxRuntime.jsx(
3184
+ "button",
3185
+ {
3186
+ ref: buttonRef,
3187
+ type: "button",
3188
+ className: ["poolse-edited-label", className].filter(Boolean).join(" "),
3189
+ "aria-haspopup": "dialog",
3190
+ "aria-expanded": open,
3191
+ title: "Show edit history",
3192
+ onClick: (e) => {
3193
+ e.stopPropagation();
3194
+ const next = !open;
3195
+ setOpen(next);
3196
+ if (next && (history.status === "idle" || history.status === "error")) load();
3197
+ },
3198
+ children: text
3199
+ }
3200
+ );
3201
+ const popover = open ? /* @__PURE__ */ jsxRuntime.jsxs(
3202
+ "div",
3203
+ {
3204
+ ref: popoverRef,
3205
+ className: "poolse-edit-history",
3206
+ role: "dialog",
3207
+ "aria-label": "Edit history",
3208
+ style: position ?? { position: "fixed", visibility: "hidden" },
3209
+ onClick: (e) => e.stopPropagation(),
3210
+ children: [
3211
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-edit-history__title", children: "Edit history" }),
3212
+ history.status === "loading" || history.status === "idle" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-edit-history__empty", children: "Loading\u2026" }) : history.status === "error" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-edit-history__empty", children: "Couldn't load the history." }) : history.edits.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-edit-history__empty", children: "No earlier versions." }) : /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "poolse-edit-history__list", children: history.edits.map((v) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "poolse-edit-history__item", children: [
3213
+ /* @__PURE__ */ jsxRuntime.jsxs("time", { className: "poolse-edit-history__time", dateTime: v.written_at, children: [
3214
+ v.version === 1 ? "Original \xB7 " : "",
3215
+ formatWhen(v.written_at)
3216
+ ] }),
3217
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-edit-history__body", children: v.body ?? /* @__PURE__ */ jsxRuntime.jsx("em", { children: "(no text)" }) })
3218
+ ] }, v.version)) })
3219
+ ]
3220
+ }
3221
+ ) : null;
3222
+ return { label, popover };
3223
+ }
3224
+ function formatWhen(iso) {
3225
+ const d = new Date(iso);
3226
+ if (Number.isNaN(d.getTime())) return "";
3227
+ return d.toLocaleString(void 0, {
3228
+ month: "short",
3229
+ day: "numeric",
3230
+ hour: "2-digit",
3231
+ minute: "2-digit"
3232
+ });
3233
+ }
3234
+ function LinkPreviewCard({ preview, onRemove, className }) {
3235
+ const [imageFailed, setImageFailed] = react.useState(false);
3236
+ const [faviconFailed, setFaviconFailed] = react.useState(false);
3237
+ if (!isWebUrl(preview.url)) return null;
3238
+ const image = preview.image_url && isWebUrl(preview.image_url) && !imageFailed;
3239
+ const host = hostOf(preview.url);
3240
+ const remove = onRemove ? /* @__PURE__ */ jsxRuntime.jsx(
3241
+ "button",
3242
+ {
3243
+ type: "button",
3244
+ className: "poolse-link-preview__remove",
3245
+ "aria-label": "Remove preview",
3246
+ title: "Remove preview",
3247
+ onClick: (e) => {
3248
+ e.preventDefault();
3249
+ e.stopPropagation();
3250
+ onRemove();
3251
+ },
3252
+ children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 12, label: null })
3253
+ }
3254
+ ) : null;
3255
+ if (preview.type === "image") {
3256
+ const src = preview.image_url && isWebUrl(preview.image_url) ? preview.image_url : preview.url;
3257
+ if (imageFailed) return null;
3258
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3259
+ "div",
3260
+ {
3261
+ className: ["poolse-link-preview", "poolse-link-preview--image", className].filter(Boolean).join(" "),
3262
+ children: [
3263
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: preview.url, target: "_blank", rel: "noopener noreferrer nofollow", children: /* @__PURE__ */ jsxRuntime.jsx(
3264
+ "img",
3265
+ {
3266
+ className: "poolse-link-preview__picture",
3267
+ src,
3268
+ alt: preview.title ?? host,
3269
+ loading: "lazy",
3270
+ onError: () => setImageFailed(true)
3271
+ }
3272
+ ) }),
3273
+ remove
3274
+ ]
3275
+ }
3276
+ );
3277
+ }
3278
+ const site = preview.site_name || host;
3279
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["poolse-link-preview", className].filter(Boolean).join(" "), children: [
3280
+ /* @__PURE__ */ jsxRuntime.jsxs(
3281
+ "a",
3282
+ {
3283
+ className: "poolse-link-preview__link",
3284
+ href: preview.url,
3285
+ target: "_blank",
3286
+ rel: "noopener noreferrer nofollow",
3287
+ children: [
3288
+ image ? /* @__PURE__ */ jsxRuntime.jsx(
3289
+ "img",
3290
+ {
3291
+ className: "poolse-link-preview__image",
3292
+ src: preview.image_url,
3293
+ alt: "",
3294
+ loading: "lazy",
3295
+ onError: () => setImageFailed(true)
3296
+ }
3297
+ ) : null,
3298
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-link-preview__text", children: [
3299
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-link-preview__site", children: [
3300
+ preview.favicon_url && isWebUrl(preview.favicon_url) && !faviconFailed ? /* @__PURE__ */ jsxRuntime.jsx(
3301
+ "img",
3302
+ {
3303
+ className: "poolse-link-preview__favicon",
3304
+ src: preview.favicon_url,
3305
+ alt: "",
3306
+ loading: "lazy",
3307
+ onError: () => setFaviconFailed(true)
3308
+ }
3309
+ ) : null,
3310
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: site })
3311
+ ] }),
3312
+ preview.title ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-link-preview__title", children: preview.title }) : null,
3313
+ preview.description ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-link-preview__description", children: preview.description }) : null
3314
+ ] })
3315
+ ]
3316
+ }
3317
+ ),
3318
+ remove
3319
+ ] });
1625
3320
  }
1626
- function guessContentType(url) {
1627
- const m = url.match(/\.([a-z0-9]+)(?:\?|#|$)/i);
1628
- if (!m) return "application/octet-stream";
1629
- const ext = m[1].toLowerCase();
1630
- const imageExts = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "avif", "svg"]);
1631
- if (imageExts.has(ext)) return `image/${ext === "jpg" ? "jpeg" : ext}`;
1632
- return "application/octet-stream";
3321
+ function MessageLinkPreviews({
3322
+ message,
3323
+ canRemove
3324
+ }) {
3325
+ const chat = react$1.usePoolse();
3326
+ const [hidden, setHidden] = react.useState(() => /* @__PURE__ */ new Set());
3327
+ const previews = (message.link_previews ?? []).filter((p) => !hidden.has(p.url));
3328
+ if (message.deleted_at || previews.length === 0) return null;
3329
+ const remove = (url) => {
3330
+ setHidden((prev) => new Set(prev).add(url));
3331
+ void chat.messages.update(message.id, { remove_link_previews: [url] }).catch(() => {
3332
+ setHidden((prev) => {
3333
+ const next = new Set(prev);
3334
+ next.delete(url);
3335
+ return next;
3336
+ });
3337
+ });
3338
+ };
3339
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-link-previews", children: previews.map((p) => /* @__PURE__ */ jsxRuntime.jsx(
3340
+ LinkPreviewCard,
3341
+ {
3342
+ preview: p,
3343
+ ...canRemove ? { onRemove: () => remove(p.url) } : {}
3344
+ },
3345
+ p.url
3346
+ )) });
1633
3347
  }
1634
- function formatBytes(n) {
1635
- if (n < 1024) return `${n} B`;
1636
- if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
1637
- if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`;
1638
- return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`;
3348
+ function hasLinkPreviews(message) {
3349
+ return !message.deleted_at && (message.link_previews?.length ?? 0) > 0;
3350
+ }
3351
+ function isWebUrl(url) {
3352
+ return /^https?:\/\//i.test(url);
3353
+ }
3354
+ function hostOf(url) {
3355
+ try {
3356
+ return new URL(url).hostname.replace(/^www\./, "");
3357
+ } catch {
3358
+ return url;
3359
+ }
1639
3360
  }
1640
3361
 
1641
3362
  // src/bubbleText.ts
@@ -1672,6 +3393,7 @@ function MessageBubble({
1672
3393
  actionsTrigger,
1673
3394
  showAttachments = true,
1674
3395
  timeFormat,
3396
+ linkPreviews = true,
1675
3397
  slots,
1676
3398
  slotContext
1677
3399
  }) {
@@ -1695,7 +3417,8 @@ function MessageBubble({
1695
3417
  const metaOverlay = hasAnyAttachment && imageAttachments.length > 0 && !hasVisibleBody && fileAttachments.length === 0;
1696
3418
  const jumboCount = hasVisibleBody && !hasAnyAttachment && !message.quoted_message_id ? emojiOnlyCount(rawBody) : 0;
1697
3419
  const trimToggleVisible = shouldTrim || expanded && rawBody.length > maxBodyLength + TRIM_BUFFER2;
1698
- const inlineMeta = hasVisibleBody && jumboCount === 0 && !trimToggleVisible && (!markdown || !hasMarkdown(displayBody));
3420
+ const showPreviews = linkPreviews && hasLinkPreviews(message);
3421
+ const inlineMeta = hasVisibleBody && !showPreviews && jumboCount === 0 && !trimToggleVisible && (!markdown || !hasMarkdown(displayBody));
1699
3422
  const className = [
1700
3423
  "poolse-message",
1701
3424
  isSelf ? "poolse-message--self" : "poolse-message--other",
@@ -1709,7 +3432,8 @@ function MessageBubble({
1709
3432
  jumboCount > 0 ? "poolse-message--jumbo" : ""
1710
3433
  ].filter(Boolean).join(" ");
1711
3434
  const time = formatMessageTime(message.inserted_at, timeFormat);
1712
- const showQuoteCard = message.quoted_message !== void 0 && message.quoted_message !== null ? "full" : message.quoted_message_id ? "placeholder" : null;
3435
+ const editHistory = useEditHistory(message.id);
3436
+ const showQuoteCard = message.deleted_at ? null : message.quoted_message !== void 0 && message.quoted_message !== null ? "full" : message.quoted_message_id ? "placeholder" : null;
1713
3437
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
1714
3438
  actionsTrigger,
1715
3439
  renderSlot(
@@ -1745,9 +3469,12 @@ function MessageBubble({
1745
3469
  ] }) : null
1746
3470
  ),
1747
3471
  (() => {
1748
- const metaContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3472
+ const metaParts = (interactive) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1749
3473
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: time }),
1750
- message.edited_at && !message.deleted_at ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\xB7 edited" }) : null,
3474
+ message.edited_at && !message.deleted_at ? /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
3475
+ "\xB7 ",
3476
+ interactive ? editHistory.label() : "edited"
3477
+ ] }) : null,
1751
3478
  isSelf && readState ? /* @__PURE__ */ jsxRuntime.jsx(
1752
3479
  PoolseIcon,
1753
3480
  {
@@ -1757,7 +3484,8 @@ function MessageBubble({
1757
3484
  }
1758
3485
  ) : null
1759
3486
  ] });
1760
- const body = message.deleted_at ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-message__body--deleted", children: "Message deleted" }) : hasVisibleBody ? /* @__PURE__ */ jsxRuntime.jsxs(
3487
+ const metaContent = metaParts(true);
3488
+ const body = message.deleted_at ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-message__body--deleted", children: "This message was deleted" }) : hasVisibleBody ? /* @__PURE__ */ jsxRuntime.jsxs(
1761
3489
  "div",
1762
3490
  {
1763
3491
  className: markdown && !inlineMeta && jumboCount === 0 ? "poolse-message__body poolse-message__body--md" : "poolse-message__body",
@@ -1787,7 +3515,7 @@ function MessageBubble({
1787
3515
  // overlaps a glyph — and when the line is full, the
1788
3516
  // reservation wraps and the meta drops a line, flush
1789
3517
  // right. The WhatsApp trick.
1790
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-message__meta poolse-message__meta--spacer", "aria-hidden": true, children: metaContent }),
3518
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-message__meta poolse-message__meta--spacer", "aria-hidden": true, children: metaParts(false) }),
1791
3519
  shouldTrim && /* @__PURE__ */ jsxRuntime.jsx(
1792
3520
  "button",
1793
3521
  {
@@ -1818,7 +3546,9 @@ function MessageBubble({
1818
3546
  const metaClass = metaOverlay ? "poolse-message__meta poolse-message__meta--overlay" : inlineMeta ? "poolse-message__meta poolse-message__meta--inline" : "poolse-message__meta poolse-message__meta--block";
1819
3547
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1820
3548
  renderSlot(slots?.body, slotContext, body),
1821
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: metaClass, children: metaContent })
3549
+ showPreviews ? /* @__PURE__ */ jsxRuntime.jsx(MessageLinkPreviews, { message, canRemove: isSelf }) : null,
3550
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: metaClass, children: metaContent }),
3551
+ editHistory.popover
1822
3552
  ] });
1823
3553
  })()
1824
3554
  ] });
@@ -1871,14 +3601,15 @@ function QuotedCard({
1871
3601
  labelFor,
1872
3602
  onClick
1873
3603
  }) {
1874
- const senderLabel = quoted.sender_external_id ? labelFor?.(quoted.sender_external_id) ?? quoted.sender_external_id : "Unknown";
3604
+ const { profile: quotedSender } = react$1.useUser(quoted.sender_external_id ?? null);
3605
+ const senderLabel = quoted.sender_external_id ? labelFor?.(quoted.sender_external_id) ?? quotedSender?.displayName ?? quoted.sender_external_id : "Unknown";
1875
3606
  const isDeleted = !!quoted.deleted_at;
1876
3607
  const handleClick = onClick ? () => onClick(quoted.id) : void 0;
1877
3608
  return /* @__PURE__ */ jsxRuntime.jsxs(
1878
3609
  "button",
1879
3610
  {
1880
3611
  type: "button",
1881
- className: `poolse-quote ${isSelf ? "poolse-quote--self" : "poolse-quote--other"}`,
3612
+ className: `poolse-quote ${isSelf ? "poolse-quote--self" : "poolse-quote--other"}${isDeleted ? " poolse-quote--deleted" : ""}`,
1882
3613
  onClick: handleClick,
1883
3614
  disabled: !handleClick,
1884
3615
  "aria-label": `Quoted message from ${senderLabel}`,
@@ -2043,10 +3774,15 @@ function ReactionPicker({
2043
3774
  onClose
2044
3775
  }) {
2045
3776
  const rootRef = react.useRef(null);
3777
+ const [full, setFull] = react.useState(false);
2046
3778
  react.useEffect(() => {
2047
3779
  const firstBtn = rootRef.current?.querySelector("button");
2048
3780
  if (firstBtn instanceof HTMLElement) firstBtn.focus();
2049
3781
  }, []);
3782
+ const pick = (emoji) => {
3783
+ rememberEmoji(emoji);
3784
+ onPick(emoji);
3785
+ };
2050
3786
  react.useEffect(() => {
2051
3787
  if (!onClose) return;
2052
3788
  const onPointer = (e) => {
@@ -2075,7 +3811,10 @@ function ReactionPicker({
2075
3811
  e.preventDefault();
2076
3812
  }
2077
3813
  };
2078
- return /* @__PURE__ */ jsxRuntime.jsx(
3814
+ if (full) {
3815
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: rootRef, className: "poolse-reaction-picker poolse-reaction-picker--full", children: /* @__PURE__ */ jsxRuntime.jsx(EmojiPicker, { onPick: pick, ...onClose ? { onClose } : {} }) });
3816
+ }
3817
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2079
3818
  "div",
2080
3819
  {
2081
3820
  ref: rootRef,
@@ -2083,18 +3822,34 @@ function ReactionPicker({
2083
3822
  role: "menu",
2084
3823
  "aria-label": "Pick a reaction",
2085
3824
  onKeyDown: onKey,
2086
- children: COMMON_EMOJIS.map((e) => /* @__PURE__ */ jsxRuntime.jsx(
2087
- "button",
2088
- {
2089
- type: "button",
2090
- role: "menuitem",
2091
- className: "poolse-reaction-picker__btn",
2092
- onClick: () => onPick(e),
2093
- "aria-label": `React with ${e}`,
2094
- children: e
2095
- },
2096
- e
2097
- ))
3825
+ children: [
3826
+ COMMON_EMOJIS.map((e) => /* @__PURE__ */ jsxRuntime.jsx(
3827
+ "button",
3828
+ {
3829
+ type: "button",
3830
+ role: "menuitem",
3831
+ className: "poolse-reaction-picker__btn",
3832
+ onClick: () => pick(e),
3833
+ "aria-label": `React with ${e}`,
3834
+ children: e
3835
+ },
3836
+ e
3837
+ )),
3838
+ /* @__PURE__ */ jsxRuntime.jsx(
3839
+ "button",
3840
+ {
3841
+ type: "button",
3842
+ role: "menuitem",
3843
+ className: "poolse-reaction-picker__btn poolse-reaction-picker__more",
3844
+ "aria-label": "More emoji",
3845
+ title: "More emoji",
3846
+ onPointerEnter: () => void loadEmojiData(),
3847
+ onFocus: () => void loadEmojiData(),
3848
+ onClick: () => setFull(true),
3849
+ children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "plus", size: 16, label: null })
3850
+ }
3851
+ )
3852
+ ]
2098
3853
  }
2099
3854
  );
2100
3855
  }
@@ -2103,6 +3858,7 @@ function MessageActions({
2103
3858
  onReply,
2104
3859
  onQuote,
2105
3860
  onCopy,
3861
+ onMarkUnread,
2106
3862
  onEdit,
2107
3863
  onDelete,
2108
3864
  moreMenu = false,
@@ -2110,7 +3866,7 @@ function MessageActions({
2110
3866
  }) {
2111
3867
  const [pickerOpen, setPickerOpen] = react.useState(false);
2112
3868
  const [menuOpen, setMenuOpen] = react.useState(false);
2113
- const hasMore = !!(onCopy || onEdit || onDelete);
3869
+ const hasMore = !!(onCopy || onMarkUnread || onEdit || onDelete);
2114
3870
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-msg-actions", role: "toolbar", "aria-label": "Message actions", children: [
2115
3871
  onReact && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2116
3872
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2157,6 +3913,11 @@ function MessageActions({
2157
3913
  },
2158
3914
  children: [
2159
3915
  onCopy && { label: "Copy", icon: "copy", run: onCopy },
3916
+ onMarkUnread && {
3917
+ label: "Mark unread",
3918
+ icon: "message",
3919
+ run: onMarkUnread
3920
+ },
2160
3921
  onEdit && { label: "Edit", icon: "edit", run: onEdit },
2161
3922
  onDelete && { label: "Delete", icon: "trash", run: onDelete }
2162
3923
  ].filter((item) => !!item).map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2183,6 +3944,7 @@ function MessageActions({
2183
3944
  onReply && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: "Reply in thread", icon: "messages", onClick: onReply }),
2184
3945
  onQuote && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: "Reply", icon: "reply", onClick: onQuote }),
2185
3946
  onCopy && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: "Copy", icon: "copy", onClick: onCopy }),
3947
+ onMarkUnread && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: "Mark unread", icon: "message", onClick: onMarkUnread }),
2186
3948
  onEdit && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: "Edit", icon: "edit", onClick: onEdit }),
2187
3949
  onDelete && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: "Delete", icon: "trash", danger: true, onClick: onDelete }),
2188
3950
  children
@@ -2255,6 +4017,36 @@ function InlineReactions({
2255
4017
  );
2256
4018
  }) });
2257
4019
  }
4020
+ function ThreadSummary({ message, onOpen, maxAvatars = 3, className }) {
4021
+ const now = useNow();
4022
+ const count = message.reply_count ?? 0;
4023
+ if (count <= 0) return null;
4024
+ const participants = (message.thread_participants ?? []).slice(0, maxAvatars);
4025
+ const replies = `${count} ${count === 1 ? "reply" : "replies"}`;
4026
+ const last = formatRelativeTime(message.last_reply_at, now);
4027
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4028
+ "button",
4029
+ {
4030
+ type: "button",
4031
+ className: ["poolse-thread-summary", className].filter(Boolean).join(" "),
4032
+ onClick: onOpen,
4033
+ "aria-label": `View ${replies}`,
4034
+ children: [
4035
+ participants.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-thread-summary__avatars", "aria-hidden": "true", children: participants.map((p) => /* @__PURE__ */ jsxRuntime.jsx(ParticipantAvatar, { participant: p }, p.user_id)) }) : /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "messages", size: 12, label: null }),
4036
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-thread-summary__count", children: replies }),
4037
+ last ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-thread-summary__last", children: [
4038
+ "\xB7 last reply ",
4039
+ last
4040
+ ] }) : null
4041
+ ]
4042
+ }
4043
+ );
4044
+ }
4045
+ function ParticipantAvatar({ participant }) {
4046
+ const { profile } = react$1.useUser(participant.external_id);
4047
+ const name = profile?.displayName ?? participant.external_id ?? "Someone";
4048
+ return /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: profile?.avatarUrl ?? null, name, size: "xs" });
4049
+ }
2258
4050
  var TRIM_BUFFER = 40;
2259
4051
  function FlatMessageRow({
2260
4052
  msg,
@@ -2273,12 +4065,15 @@ function FlatMessageRow({
2273
4065
  onDelete,
2274
4066
  onOpenThread,
2275
4067
  onQuote,
4068
+ onMarkUnread,
2276
4069
  labelFor,
2277
4070
  onQuotedClick,
2278
4071
  groupPosition = "standalone",
2279
4072
  maxBodyLength = 0,
2280
4073
  markdown = false,
2281
4074
  showAvatar = layout === "list",
4075
+ showPresence = false,
4076
+ linkPreviews = true,
2282
4077
  onSenderPress,
2283
4078
  onAvatarPress,
2284
4079
  timeFormat,
@@ -2306,10 +4101,19 @@ function FlatMessageRow({
2306
4101
  const deleted = !!msg.deleted_at;
2307
4102
  const time = formatMessageTime(msg.inserted_at, timeFormat);
2308
4103
  const replyCount = msg.reply_count ?? 0;
2309
- const showThreadLink = threads && !deleted && !msg.thread_root_id && replyCount > 0;
4104
+ const showThreadLink = threads && !msg.thread_root_id && replyCount > 0;
2310
4105
  const showActions = actions && !deleted && !editing;
2311
4106
  const timeEl = (className) => /* @__PURE__ */ jsxRuntime.jsx("time", { className, dateTime: msg.inserted_at, children: time });
2312
4107
  const avatarSize = compact ? "sm" : "md";
4108
+ const avatarEl = /* @__PURE__ */ jsxRuntime.jsx(
4109
+ Avatar,
4110
+ {
4111
+ src: sender.avatarUrl,
4112
+ name: senderName,
4113
+ size: avatarSize,
4114
+ ...showPresence && msg.sender_external_id ? { presence: true, userId: msg.sender_external_id } : {}
4115
+ }
4116
+ );
2313
4117
  const avatar = !showAvatar ? null : onAvatarPress && !isSelf ? /* @__PURE__ */ jsxRuntime.jsx(
2314
4118
  "button",
2315
4119
  {
@@ -2317,9 +4121,9 @@ function FlatMessageRow({
2317
4121
  className: "poolse-row__avatar-button",
2318
4122
  "aria-label": senderName,
2319
4123
  onClick: () => onAvatarPress(sender),
2320
- children: /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: sender.avatarUrl, name: senderName, size: avatarSize })
4124
+ children: avatarEl
2321
4125
  }
2322
- ) : /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: sender.avatarUrl, name: senderName, size: avatarSize });
4126
+ ) : avatarEl;
2323
4127
  const nameStyle = compact ? { color: userColor(msg.sender_external_id ?? msg.sender_id ?? "") } : void 0;
2324
4128
  const name = onSenderPress && !isSelf ? /* @__PURE__ */ jsxRuntime.jsx(
2325
4129
  "button",
@@ -2335,7 +4139,7 @@ function FlatMessageRow({
2335
4139
  name,
2336
4140
  timeEl("poolse-row__time")
2337
4141
  ] }) : null;
2338
- const quote = msg.quoted_message !== void 0 && msg.quoted_message !== null ? /* @__PURE__ */ jsxRuntime.jsx(
4142
+ const quote = deleted ? null : msg.quoted_message !== void 0 && msg.quoted_message !== null ? /* @__PURE__ */ jsxRuntime.jsx(
2339
4143
  QuotedCard,
2340
4144
  {
2341
4145
  quoted: msg.quoted_message,
@@ -2351,8 +4155,14 @@ function FlatMessageRow({
2351
4155
  images.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(ImageMosaic, { images }),
2352
4156
  files.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-message__files", children: files.map((att) => /* @__PURE__ */ jsxRuntime.jsx(AttachmentPreview, { attachment: att }, att.id)) })
2353
4157
  ] }) : null;
4158
+ const editHistory = useEditHistory(msg.id);
2354
4159
  const meta = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2355
- msg.edited_at && !deleted ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-row__edited", children: "(edited)" }) : null,
4160
+ msg.edited_at && !deleted ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-row__edited", children: [
4161
+ "(",
4162
+ editHistory.label(),
4163
+ ")"
4164
+ ] }) : null,
4165
+ editHistory.popover,
2356
4166
  isSelf && readState ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-row__receipt", children: /* @__PURE__ */ jsxRuntime.jsx(
2357
4167
  PoolseIcon,
2358
4168
  {
@@ -2394,21 +4204,12 @@ function FlatMessageRow({
2394
4204
  onRemove: (e) => void reactionsHook.removeReaction(e)
2395
4205
  }
2396
4206
  ) : null;
2397
- const threadEl = showThreadLink ? /* @__PURE__ */ jsxRuntime.jsxs(
2398
- "button",
4207
+ const threadEl = showThreadLink ? /* @__PURE__ */ jsxRuntime.jsx(
4208
+ ThreadSummary,
2399
4209
  {
2400
- type: "button",
4210
+ message: msg,
2401
4211
  className: "poolse-row__thread",
2402
- onClick: onOpenThread,
2403
- "aria-label": `View ${replyCount} ${replyCount === 1 ? "reply" : "replies"}`,
2404
- children: [
2405
- /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "messages", size: 14, label: null }),
2406
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
2407
- replyCount,
2408
- " ",
2409
- replyCount === 1 ? "reply" : "replies"
2410
- ] })
2411
- ]
4212
+ ...onOpenThread ? { onOpen: onOpenThread } : {}
2412
4213
  }
2413
4214
  ) : null;
2414
4215
  const toolbar = showActions ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-row__toolbar", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2423,6 +4224,7 @@ function FlatMessageRow({
2423
4224
  void navigator?.clipboard?.writeText(msg.body ?? "").catch(() => void 0);
2424
4225
  }
2425
4226
  } : {},
4227
+ ...!isSelf && onMarkUnread ? { onMarkUnread } : {},
2426
4228
  ...isSelf && onStartEdit ? { onEdit: onStartEdit } : {},
2427
4229
  ...isSelf && onDelete ? { onDelete } : {}
2428
4230
  }
@@ -2432,6 +4234,7 @@ function FlatMessageRow({
2432
4234
  quote,
2433
4235
  renderSlot(slots?.attachments, ctx, attachmentsEl),
2434
4236
  renderSlot(slots?.body, ctx, body),
4237
+ linkPreviews && !editing && hasLinkPreviews(msg) ? /* @__PURE__ */ jsxRuntime.jsx(MessageLinkPreviews, { message: msg, canRemove: isSelf }) : null,
2435
4238
  renderSlot(slots?.reactions, ctx, reactionsEl),
2436
4239
  renderSlot(slots?.thread, ctx, threadEl)
2437
4240
  ] });
@@ -2474,7 +4277,7 @@ function FlatBody({
2474
4277
  }) {
2475
4278
  const [expanded, setExpanded] = react.useState(false);
2476
4279
  if (message.deleted_at) {
2477
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-message__body poolse-row__body", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-message__body--deleted", children: "Message deleted" }) });
4280
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-message__body poolse-row__body", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-message__body--deleted", children: "This message was deleted" }) });
2478
4281
  }
2479
4282
  const raw = message.body ?? "";
2480
4283
  if (!raw) {
@@ -2549,6 +4352,7 @@ function BubbleMessageRow({
2549
4352
  onDelete,
2550
4353
  onOpenThread,
2551
4354
  onQuote,
4355
+ onMarkUnread,
2552
4356
  labelFor,
2553
4357
  onQuotedClick,
2554
4358
  groupPosition = "standalone",
@@ -2556,6 +4360,8 @@ function BubbleMessageRow({
2556
4360
  markdown = false,
2557
4361
  showSenderName = false,
2558
4362
  showAvatar = false,
4363
+ showPresence = false,
4364
+ linkPreviews = true,
2559
4365
  onSenderPress,
2560
4366
  onAvatarPress,
2561
4367
  timeFormat,
@@ -2579,7 +4385,7 @@ function BubbleMessageRow({
2579
4385
  const showReactions = reactions && !msg.deleted_at;
2580
4386
  const showActions = actions && !msg.deleted_at && !editing;
2581
4387
  const replyCount = msg.reply_count ?? 0;
2582
- const showThreadPill = threads && !msg.deleted_at && !msg.thread_root_id && replyCount > 0;
4388
+ const showThreadPill = threads && !msg.thread_root_id && replyCount > 0;
2583
4389
  const handleSave = onSaveEdit ?? (async () => void 0);
2584
4390
  const handleCancel = onCancelEdit ?? (() => void 0);
2585
4391
  const { actionsOpen, setActionsOpen, rowRef, onRowClick } = useRowActions();
@@ -2626,6 +4432,7 @@ function BubbleMessageRow({
2626
4432
  groupPosition,
2627
4433
  senderName,
2628
4434
  avatarUrl: senderProfile?.avatarUrl ?? null,
4435
+ presenceId: showPresence ? msg.sender_external_id : null,
2629
4436
  ...onAvatarPress ? { onAvatarPress: () => onAvatarPress(sender) } : {},
2630
4437
  children: /* @__PURE__ */ jsxRuntime.jsx(
2631
4438
  MessageBubble,
@@ -2638,6 +4445,7 @@ function BubbleMessageRow({
2638
4445
  showSenderName,
2639
4446
  ...onSenderPress ? { onSenderPress: () => onSenderPress(sender) } : {},
2640
4447
  showAttachments: attachments,
4448
+ linkPreviews,
2641
4449
  ...readState ? { readState } : {},
2642
4450
  ...labelFor ? { labelFor } : {},
2643
4451
  ...onQuotedClick ? { onQuotedClick } : {},
@@ -2679,21 +4487,12 @@ function BubbleMessageRow({
2679
4487
  renderSlot(
2680
4488
  slots?.thread,
2681
4489
  slotContext,
2682
- showThreadPill ? /* @__PURE__ */ jsxRuntime.jsxs(
2683
- "button",
4490
+ showThreadPill ? /* @__PURE__ */ jsxRuntime.jsx(
4491
+ ThreadSummary,
2684
4492
  {
2685
- type: "button",
4493
+ message: msg,
2686
4494
  className: `poolse-thread-pill ${isSelf ? "poolse-thread-pill--right" : "poolse-thread-pill--left"}`,
2687
- onClick: onOpenThread,
2688
- "aria-label": `View ${replyCount} ${replyCount === 1 ? "reply" : "replies"}`,
2689
- children: [
2690
- /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "messages", size: 12, label: null }),
2691
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
2692
- replyCount,
2693
- " ",
2694
- replyCount === 1 ? "reply" : "replies"
2695
- ] })
2696
- ]
4495
+ ...onOpenThread ? { onOpen: onOpenThread } : {}
2697
4496
  }
2698
4497
  ) : null
2699
4498
  ),
@@ -2719,6 +4518,7 @@ function BubbleMessageRow({
2719
4518
  void navigator?.clipboard?.writeText(msg.body ?? "").catch(() => void 0);
2720
4519
  }
2721
4520
  } : {},
4521
+ ...!isSelf && onMarkUnread ? { onMarkUnread } : {},
2722
4522
  ...isSelf && onStartEdit ? { onEdit: onStartEdit } : {},
2723
4523
  ...isSelf && onDelete ? { onDelete } : {}
2724
4524
  }
@@ -2736,11 +4536,21 @@ function BubbleWithAvatar({
2736
4536
  groupPosition,
2737
4537
  senderName,
2738
4538
  avatarUrl,
4539
+ presenceId,
2739
4540
  onAvatarPress,
2740
4541
  children
2741
4542
  }) {
2742
4543
  if (isSelf || !showAvatar) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
2743
4544
  const isLastOfCluster = groupPosition === "last" || groupPosition === "standalone";
4545
+ const avatar = /* @__PURE__ */ jsxRuntime.jsx(
4546
+ Avatar,
4547
+ {
4548
+ src: avatarUrl,
4549
+ name: senderName,
4550
+ size: "sm",
4551
+ ...presenceId ? { presence: true, userId: presenceId } : {}
4552
+ }
4553
+ );
2744
4554
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-bubble-shell", children: [
2745
4555
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-bubble-shell__avatar", children: !isLastOfCluster ? null : onAvatarPress ? /* @__PURE__ */ jsxRuntime.jsx(
2746
4556
  "button",
@@ -2749,9 +4559,9 @@ function BubbleWithAvatar({
2749
4559
  className: "poolse-bubble-shell__avatar-button",
2750
4560
  "aria-label": senderName,
2751
4561
  onClick: onAvatarPress,
2752
- children: /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name: senderName, size: "sm" })
4562
+ children: avatar
2753
4563
  }
2754
- ) : /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name: senderName, size: "sm" }) }),
4564
+ ) : avatar }),
2755
4565
  children
2756
4566
  ] });
2757
4567
  }
@@ -2761,7 +4571,9 @@ function ThreadView({
2761
4571
  onClose,
2762
4572
  renderMessage,
2763
4573
  layout,
2764
- timeFormat
4574
+ timeFormat,
4575
+ maxFileSize,
4576
+ acceptFileTypes
2765
4577
  }) {
2766
4578
  const { me } = react$1.useMe();
2767
4579
  const {
@@ -2896,7 +4708,9 @@ function ThreadView({
2896
4708
  body,
2897
4709
  ...opts?.attachment_ids && opts.attachment_ids.length > 0 ? { attachment_ids: opts.attachment_ids } : {}
2898
4710
  }),
2899
- placeholder: "Reply in thread\u2026"
4711
+ placeholder: "Reply in thread\u2026",
4712
+ ...maxFileSize !== void 0 ? { maxFileSize } : {},
4713
+ ...acceptFileTypes ? { acceptFileTypes } : {}
2900
4714
  }
2901
4715
  ),
2902
4716
  dragActive && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__drop-overlay", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-conversation__drop-overlay-inner", children: [
@@ -2908,6 +4722,31 @@ function ThreadView({
2908
4722
  }
2909
4723
  );
2910
4724
  }
4725
+ var MAX_NAME_CHARS = 24;
4726
+ function UserName({
4727
+ externalId,
4728
+ labelFor,
4729
+ emptyFallback = "Unknown",
4730
+ className
4731
+ }) {
4732
+ const { profile } = react$1.useUser(labelFor ? null : externalId);
4733
+ const name = resolveDisplayName(externalId, profile?.displayName, labelFor, emptyFallback);
4734
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: truncate(name) });
4735
+ }
4736
+ function useDisplayName(externalId, labelFor, emptyFallback = "Unknown") {
4737
+ const { profile } = react$1.useUser(labelFor ? null : externalId);
4738
+ return resolveDisplayName(externalId, profile?.displayName, labelFor, emptyFallback);
4739
+ }
4740
+ function resolveDisplayName(externalId, resolved, labelFor, emptyFallback) {
4741
+ if (!externalId) return emptyFallback;
4742
+ if (labelFor) return labelFor(externalId);
4743
+ if (resolved) return resolved;
4744
+ return externalId;
4745
+ }
4746
+ function truncate(s) {
4747
+ if (s.length <= MAX_NAME_CHARS) return s;
4748
+ return s.slice(0, MAX_NAME_CHARS - 1) + "\u2026";
4749
+ }
2911
4750
  function TypingIndicator({ typing, labelFor }) {
2912
4751
  const ids = Array.from(typing);
2913
4752
  const isTyping = ids.length > 0;
@@ -2955,10 +4794,14 @@ function ConversationView({
2955
4794
  reactions = TRUE,
2956
4795
  mentions = TRUE,
2957
4796
  attachments = TRUE,
4797
+ maxFileSize,
4798
+ acceptFileTypes,
4799
+ emojiPicker = TRUE,
2958
4800
  actions = TRUE,
2959
4801
  threads = TRUE,
2960
4802
  quotations = TRUE,
2961
4803
  readReceipts = TRUE,
4804
+ linkPreviews = TRUE,
2962
4805
  markdown = TRUE,
2963
4806
  maxBodyLength = 200,
2964
4807
  grouping = TRUE,
@@ -2967,6 +4810,7 @@ function ConversationView({
2967
4810
  layout = "bubbles",
2968
4811
  density = "comfortable",
2969
4812
  showAvatars,
4813
+ showPresence = false,
2970
4814
  timeFormat,
2971
4815
  slots,
2972
4816
  daySeparators = TRUE,
@@ -2981,7 +4825,9 @@ function ConversationView({
2981
4825
  readOnly = false,
2982
4826
  onCallBack,
2983
4827
  onJoinCall,
2984
- currentCallId = null
4828
+ currentCallId = null,
4829
+ persistDrafts = TRUE,
4830
+ draftStorage
2985
4831
  }) {
2986
4832
  usePoolseFonts(loadFonts);
2987
4833
  const showComposer = composer && !readOnly;
@@ -3013,13 +4859,16 @@ function ConversationView({
3013
4859
  const status = react$1.useRealtimeStatus();
3014
4860
  const wantsMemberCount = senderLabels === "auto" || avatars === "auto";
3015
4861
  const membersOn = mentions || readReceipts || wantsMemberCount;
3016
- const { members } = react$1.useMembers(membersOn ? conversationId : "");
4862
+ const { members, loading: membersLoading } = react$1.useMembers(membersOn ? conversationId : "");
4863
+ const chat = react$1.usePoolse();
3017
4864
  const isGroupChat = members.length > 2;
3018
4865
  const showSenderLabelsResolved = senderLabels === "always" || senderLabels === "auto" && isGroupChat;
3019
4866
  const showAvatarsResolved = showAvatars ?? (layout === "list" ? true : layout === "compact" ? false : avatars === "always" || avatars === "auto" && isGroupChat);
3020
4867
  const groupWindowMs = groupWindowMinutes !== void 0 ? groupWindowMinutes * 60 * 1e3 : groupingWindowMs ?? 5 * 60 * 1e3;
3021
4868
  const layoutProps = {
3022
4869
  layout,
4870
+ showPresence,
4871
+ linkPreviews,
3023
4872
  ...timeFormat ? { timeFormat } : {},
3024
4873
  ...slots ? { slots } : {}
3025
4874
  };
@@ -3090,12 +4939,14 @@ function ConversationView({
3090
4939
  if (el) el.scrollTop = el.scrollHeight;
3091
4940
  }, [streamedChars, atBottom]);
3092
4941
  const lastMarkedReadRef = react.useRef(null);
4942
+ const [markerReadyFor, setMarkerReadyFor] = react.useState(null);
3093
4943
  react.useEffect(() => {
3094
4944
  if (!atBottom) return;
3095
4945
  if (messages.length === 0) return;
3096
4946
  const tail = messages[messages.length - 1];
3097
4947
  if (!tail) return;
3098
4948
  if (tail.sequence === Number.MAX_SAFE_INTEGER) return;
4949
+ if (membersOn && markerReadyFor !== conversationId) return;
3099
4950
  if (lastMarkedReadRef.current === tail.id) return;
3100
4951
  lastMarkedReadRef.current = tail.id;
3101
4952
  void markReadUpTo(tail.id).then(() => {
@@ -3103,7 +4954,33 @@ function ConversationView({
3103
4954
  }).catch(() => {
3104
4955
  lastMarkedReadRef.current = null;
3105
4956
  });
3106
- }, [atBottom, messages, markReadUpTo, onMarkedRead, conversationId]);
4957
+ }, [atBottom, messages, markReadUpTo, onMarkedRead, conversationId, membersOn, markerReadyFor]);
4958
+ const [unreadMarker, setUnreadMarker] = react.useState(null);
4959
+ const markerTakenRef = react.useRef(null);
4960
+ react.useEffect(() => {
4961
+ setUnreadMarker(null);
4962
+ markerTakenRef.current = null;
4963
+ }, [conversationId]);
4964
+ react.useEffect(() => {
4965
+ if (markerTakenRef.current === conversationId) return;
4966
+ if (!membersOn || loading || membersLoading) return;
4967
+ if (members.some((m) => m.conversation_id !== conversationId)) return;
4968
+ if (!me && members.length > 0) return;
4969
+ markerTakenRef.current = conversationId;
4970
+ setMarkerReadyFor(conversationId);
4971
+ const mine = me ? members.find((m) => m.user_id === me.id) : void 0;
4972
+ if (!mine) return;
4973
+ let after = mine.last_read_sequence ?? null;
4974
+ if (after === null && mine.last_read_message_id) {
4975
+ after = messages.find((m) => m.id === mine.last_read_message_id)?.sequence ?? null;
4976
+ if (after === null) return;
4977
+ }
4978
+ setUnreadMarker({
4979
+ conversationId,
4980
+ afterSequence: after ?? 0,
4981
+ lastReadId: mine.last_read_message_id
4982
+ });
4983
+ }, [conversationId, membersOn, loading, membersLoading, me, members, messages]);
3107
4984
  const scrollToBottom = () => {
3108
4985
  const el = listRef.current;
3109
4986
  if (el) el.scrollTop = el.scrollHeight;
@@ -3114,6 +4991,74 @@ function ConversationView({
3114
4991
  () => messages.filter((m) => react$1.isMessageVisibleTo(m, meIdForFeed)),
3115
4992
  [messages, meIdForFeed]
3116
4993
  );
4994
+ const marker = unreadMarker && unreadMarker.conversationId === conversationId ? unreadMarker : null;
4995
+ const unread = react.useMemo(() => {
4996
+ if (!marker) return { firstId: null, reaches: true, any: false };
4997
+ const isUnread = (m) => m.sequence > marker.afterSequence && m.sequence !== Number.MAX_SAFE_INTEGER && m.sender_id !== meIdForFeed;
4998
+ const reaches = !hasMore || visibleMessages.some((m) => m.sequence <= marker.afterSequence);
4999
+ const first = visibleMessages.find(isUnread) ?? null;
5000
+ return {
5001
+ firstId: reaches ? first?.id ?? null : null,
5002
+ reaches,
5003
+ any: first !== null
5004
+ };
5005
+ }, [marker, visibleMessages, hasMore, meIdForFeed]);
5006
+ const dividerRef = react.useRef(null);
5007
+ const [dividerInView, setDividerInView] = react.useState(false);
5008
+ const [jumpDismissed, setJumpDismissed] = react.useState(false);
5009
+ react.useEffect(() => {
5010
+ setJumpDismissed(false);
5011
+ }, [conversationId, marker?.afterSequence]);
5012
+ react.useEffect(() => {
5013
+ setDividerInView(false);
5014
+ const el = dividerRef.current;
5015
+ const root = listRef.current;
5016
+ if (!el || !root || typeof IntersectionObserver === "undefined") return;
5017
+ const io = new IntersectionObserver(([entry]) => setDividerInView(!!entry?.isIntersecting), {
5018
+ root,
5019
+ threshold: 0
5020
+ });
5021
+ io.observe(el);
5022
+ return () => io.disconnect();
5023
+ }, [unread.firstId]);
5024
+ const [jump, setJump] = react.useState(null);
5025
+ const jumpToFirstUnread = () => {
5026
+ if (!marker) return;
5027
+ if (unread.firstId) {
5028
+ scrollDividerIntoView(dividerRef.current);
5029
+ return;
5030
+ }
5031
+ setJump("loading");
5032
+ void loadUntil(marker.lastReadId ?? NO_MESSAGE).catch(() => false).then(() => {
5033
+ if (conversationIdRef.current === marker.conversationId) {
5034
+ setJump((j) => j ? "loaded" : j);
5035
+ }
5036
+ });
5037
+ };
5038
+ react.useEffect(() => {
5039
+ if (!jump) return;
5040
+ if (unread.firstId) {
5041
+ setJump(null);
5042
+ scrollDividerIntoView(dividerRef.current);
5043
+ } else if (jump === "loaded") {
5044
+ setJump(null);
5045
+ }
5046
+ }, [jump, unread.firstId]);
5047
+ react.useEffect(() => {
5048
+ setJump(null);
5049
+ }, [conversationId]);
5050
+ const showJump = !!marker && unread.any && !jumpDismissed && (!unread.firstId || !dividerInView);
5051
+ const markUnreadFrom = async (msg) => {
5052
+ const tail = messages[messages.length - 1];
5053
+ if (tail) lastMarkedReadRef.current = tail.id;
5054
+ try {
5055
+ await chat.conversations.one(conversationId).markUnread(msg.id);
5056
+ markerTakenRef.current = conversationId;
5057
+ setUnreadMarker({ conversationId, afterSequence: msg.sequence - 1, lastReadId: null });
5058
+ } catch {
5059
+ setSendNotice("Couldn't mark the message unread.");
5060
+ }
5061
+ };
3117
5062
  const [pendingFocusId, setPendingFocusId] = react.useState(null);
3118
5063
  const [focusMissing, setFocusMissing] = react.useState(false);
3119
5064
  const onFocusNotFoundRef = react.useRef(onFocusMessageNotFound);
@@ -3182,12 +5127,68 @@ function ConversationView({
3182
5127
  () => threadRootId ? messages.find((m) => m.id === threadRootId) ?? null : null,
3183
5128
  [threadRootId, messages]
3184
5129
  );
3185
- const [replyingTo, setReplyingTo] = react.useState(null);
5130
+ const [replyingTo, setReplyingToState] = react.useState(null);
5131
+ const mentionComposer = mentions && members.length > 0;
3186
5132
  react.useEffect(() => {
3187
- setReplyingTo(null);
5133
+ setReplyingToState(null);
3188
5134
  setEditingId(null);
3189
5135
  setThreadRootId(null);
5136
+ setSendNotice(null);
3190
5137
  }, [conversationId]);
5138
+ const meIdForDrafts = me?.id ?? null;
5139
+ const draftsOn = persistDrafts && showComposer;
5140
+ const storage = draftStorage ?? localDraftStorage;
5141
+ const draftRef = react.useRef({ text: "", replyTo: null });
5142
+ const draftKeyFor = react.useCallback(
5143
+ () => draftsOn && meIdForDrafts ? draftKey(meIdForDrafts, conversationIdRef.current) : null,
5144
+ [draftsOn, meIdForDrafts]
5145
+ );
5146
+ const saveDraft = react.useCallback(
5147
+ (patch) => {
5148
+ draftRef.current = { ...draftRef.current, ...patch };
5149
+ const key = draftKeyFor();
5150
+ if (key) writeDraft(storage, key, draftRef.current);
5151
+ },
5152
+ [draftKeyFor, storage]
5153
+ );
5154
+ const setReplyingTo = react.useCallback(
5155
+ (m) => {
5156
+ setReplyingToState(m);
5157
+ saveDraft({ replyTo: m });
5158
+ },
5159
+ [saveDraft]
5160
+ );
5161
+ react.useEffect(() => {
5162
+ draftRef.current = { text: "", replyTo: null };
5163
+ const key = draftKeyFor();
5164
+ if (!key) return;
5165
+ let live = true;
5166
+ const apply = (d) => {
5167
+ if (!live || !d) return;
5168
+ const composer2 = composerRef.current;
5169
+ if (d.text && composer2 && composer2.getText() === "") composer2.setText(d.text);
5170
+ draftRef.current = { text: composer2?.getText() || d.text, replyTo: d.replyTo };
5171
+ if (d.replyTo && canQuote) setReplyingToState((cur) => cur ?? d.replyTo);
5172
+ };
5173
+ const found = readDraft(storage, key);
5174
+ if (found instanceof Promise) void found.then(apply);
5175
+ else apply(found);
5176
+ return () => {
5177
+ live = false;
5178
+ };
5179
+ }, [conversationId, draftKeyFor, storage, canQuote, mentionComposer]);
5180
+ const onComposerChange = react.useCallback((text) => saveDraft({ text }), [saveDraft]);
5181
+ react.useEffect(() => {
5182
+ if (!replyingTo) return;
5183
+ const current = messages.find((m) => m.id === replyingTo.id);
5184
+ if (current?.deleted_at) setReplyingTo(null);
5185
+ }, [messages, replyingTo, setReplyingTo]);
5186
+ const [sendNotice, setSendNotice] = react.useState(null);
5187
+ react.useEffect(() => {
5188
+ if (!sendNotice) return;
5189
+ const t = setTimeout(() => setSendNotice(null), 4e3);
5190
+ return () => clearTimeout(t);
5191
+ }, [sendNotice]);
3191
5192
  const scrollToOriginal = (id) => {
3192
5193
  const root = listRef.current;
3193
5194
  if (!root) return;
@@ -3224,39 +5225,69 @@ function ConversationView({
3224
5225
  const files = Array.from(e.dataTransfer?.files ?? []);
3225
5226
  if (files.length > 0) composerRef.current?.addFiles(files);
3226
5227
  };
3227
- const onSendBody = async (body, opts) => {
3228
- await send({
3229
- body,
3230
- ...opts?.quoted_message_id ? { quoted_message_id: opts.quoted_message_id } : {},
3231
- ...opts?.attachment_ids && opts.attachment_ids.length > 0 ? { attachment_ids: opts.attachment_ids } : {}
3232
- });
3233
- setReplyingTo(null);
5228
+ const sendRequest = async (req) => {
5229
+ try {
5230
+ await send(req);
5231
+ } catch (err) {
5232
+ if (err instanceof react$1.ApiError && err.code === "quoted_message_deleted") {
5233
+ setReplyingTo(null);
5234
+ setSendNotice("The message you replied to was deleted.");
5235
+ const body = req.body;
5236
+ if (body) {
5237
+ setTimeout(() => {
5238
+ const composer2 = composerRef.current;
5239
+ if (composer2 && composer2.getText() === "") composer2.setText(body);
5240
+ }, 0);
5241
+ }
5242
+ return;
5243
+ }
5244
+ throw err;
5245
+ }
5246
+ setReplyingToState(null);
5247
+ setUnreadMarker(null);
5248
+ draftRef.current = { text: "", replyTo: null };
5249
+ const key = draftKeyFor();
5250
+ if (key) clearDraft(storage, key);
3234
5251
  };
3235
- const onSendWithMentions = async (req) => {
3236
- await send(req);
3237
- setReplyingTo(null);
5252
+ const onSendBody = (body, opts) => sendRequest({
5253
+ body,
5254
+ ...opts?.quoted_message_id ? { quoted_message_id: opts.quoted_message_id } : {},
5255
+ ...opts?.attachment_ids && opts.attachment_ids.length > 0 ? { attachment_ids: opts.attachment_ids } : {}
5256
+ });
5257
+ const onSendWithMentions = (req) => sendRequest(req);
5258
+ const attachmentRules = {
5259
+ ...maxFileSize !== void 0 ? { maxFileSize } : {},
5260
+ ...acceptFileTypes ? { acceptFileTypes } : {}
3238
5261
  };
3239
- const Composer = mentions && members.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
5262
+ const Composer = mentionComposer ? /* @__PURE__ */ jsxRuntime.jsx(
3240
5263
  MentionInput,
3241
5264
  {
3242
5265
  ref: composerRef,
5266
+ onValueChange: onComposerChange,
3243
5267
  conversationId,
3244
5268
  onSend: onSendWithMentions,
3245
5269
  onTyping: signalTyping,
3246
5270
  attachments,
5271
+ emojiPicker,
5272
+ ...attachmentRules,
3247
5273
  ...labelFor ? { labelFor } : {},
3248
5274
  ...canQuote ? { replyingTo, onCancelReply: () => setReplyingTo(null) } : {}
3249
- }
5275
+ },
5276
+ conversationId
3250
5277
  ) : /* @__PURE__ */ jsxRuntime.jsx(
3251
5278
  MessageComposer,
3252
5279
  {
3253
5280
  ref: composerRef,
5281
+ onValueChange: onComposerChange,
3254
5282
  onSend: onSendBody,
3255
5283
  onTyping: signalTyping,
3256
5284
  attachments,
5285
+ emojiPicker,
5286
+ ...attachmentRules,
3257
5287
  ...labelFor ? { labelFor } : {},
3258
5288
  ...canQuote ? { replyingTo, onCancelReply: () => setReplyingTo(null) } : {}
3259
- }
5289
+ },
5290
+ conversationId
3260
5291
  );
3261
5292
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-conversation-shell", children: [
3262
5293
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -3297,6 +5328,14 @@ function ConversationView({
3297
5328
  }
3298
5329
  ),
3299
5330
  focusMissing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__status", role: "status", "aria-live": "polite", children: "That message isn't available." }),
5331
+ sendNotice && /* @__PURE__ */ jsxRuntime.jsx(
5332
+ "div",
5333
+ {
5334
+ className: "poolse-conversation__status poolse-conversation__status--error",
5335
+ role: "alert",
5336
+ children: sendNotice
5337
+ }
5338
+ ),
3300
5339
  /* @__PURE__ */ jsxRuntime.jsxs(
3301
5340
  "div",
3302
5341
  {
@@ -3308,6 +5347,31 @@ function ConversationView({
3308
5347
  "aria-relevant": "additions",
3309
5348
  children: [
3310
5349
  hasMore && /* @__PURE__ */ jsxRuntime.jsx("div", { ref: topSentinelRef, "aria-hidden": "true", style: { height: 1 } }),
5350
+ showJump && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-conversation__jump-unread", children: [
5351
+ /* @__PURE__ */ jsxRuntime.jsxs(
5352
+ "button",
5353
+ {
5354
+ type: "button",
5355
+ className: "poolse-conversation__jump-unread-btn",
5356
+ onClick: jumpToFirstUnread,
5357
+ disabled: jump !== null,
5358
+ children: [
5359
+ /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "chevron-up", size: 14, label: null }),
5360
+ jump ? "Loading\u2026" : "Jump to first unread"
5361
+ ]
5362
+ }
5363
+ ),
5364
+ /* @__PURE__ */ jsxRuntime.jsx(
5365
+ "button",
5366
+ {
5367
+ type: "button",
5368
+ className: "poolse-conversation__jump-unread-close",
5369
+ "aria-label": "Dismiss",
5370
+ onClick: () => setJumpDismissed(true),
5371
+ children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 12, label: null })
5372
+ }
5373
+ )
5374
+ ] }),
3311
5375
  loading && messages.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__empty", children: "Loading\u2026" }) : messages.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__empty", children: emptyState ?? "No messages yet." }) : visibleMessages.map((msg, idx) => {
3312
5376
  const prev = idx > 0 ? visibleMessages[idx - 1] ?? null : null;
3313
5377
  const next = idx < visibleMessages.length - 1 ? visibleMessages[idx + 1] ?? null : null;
@@ -3365,22 +5429,37 @@ function ConversationView({
3365
5429
  onDelete: () => void deleteMsg(msg.id),
3366
5430
  onOpenThread: () => setThreadRootId(msg.id),
3367
5431
  onQuote: () => setReplyingTo(msg),
5432
+ ...!isSelf && msg.sequence !== Number.MAX_SAFE_INTEGER ? { onMarkUnread: () => void markUnreadFrom(msg) } : {},
3368
5433
  onQuotedClick: scrollToOriginal,
3369
5434
  ...onCallBack ? { onCallBack } : {},
3370
5435
  ...layoutProps,
3371
5436
  mentionsMe: mentionsViewer(msg, me?.id ?? null)
3372
5437
  }
3373
5438
  );
5439
+ const divider = unread.firstId === msg.id ? /* @__PURE__ */ jsxRuntime.jsx(
5440
+ "div",
5441
+ {
5442
+ ref: dividerRef,
5443
+ className: "poolse-unread-divider",
5444
+ role: "separator",
5445
+ "aria-label": "New messages",
5446
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "New messages" })
5447
+ }
5448
+ ) : null;
3374
5449
  if (renderMessage) {
3375
- return /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: renderMessage(msg, me?.id ?? null, {
3376
- layout,
3377
- groupPosition,
3378
- isRunStart: layout === "compact" || groupPosition === "first" || groupPosition === "standalone",
3379
- renderDefault
3380
- }) }, msg.id);
5450
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
5451
+ divider,
5452
+ renderMessage(msg, me?.id ?? null, {
5453
+ layout,
5454
+ groupPosition,
5455
+ isRunStart: layout === "compact" || groupPosition === "first" || groupPosition === "standalone",
5456
+ renderDefault
5457
+ })
5458
+ ] }, msg.id);
3381
5459
  }
3382
5460
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
3383
5461
  showDaySeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-day-separator", "aria-hidden": "false", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: react$1.formatDayLabel(msg.inserted_at) }) }),
5462
+ divider,
3384
5463
  renderDefault()
3385
5464
  ] }, msg.id);
3386
5465
  }),
@@ -3441,11 +5520,18 @@ function ConversationView({
3441
5520
  rootMessage: threadRoot,
3442
5521
  onClose: () => setThreadRootId(null),
3443
5522
  layout,
3444
- ...timeFormat ? { timeFormat } : {}
5523
+ ...timeFormat ? { timeFormat } : {},
5524
+ ...attachmentRules
3445
5525
  }
3446
5526
  ) })
3447
5527
  ] });
3448
5528
  }
5529
+ var NO_MESSAGE = "00000000-0000-0000-0000-000000000000";
5530
+ function scrollDividerIntoView(el) {
5531
+ if (el && typeof el.scrollIntoView === "function") {
5532
+ el.scrollIntoView({ behavior: "smooth", block: "start" });
5533
+ }
5534
+ }
3449
5535
  function highlightRow(el) {
3450
5536
  if (typeof el.scrollIntoView === "function") {
3451
5537
  el.scrollIntoView({ behavior: "smooth", block: "center" });
@@ -3492,23 +5578,34 @@ function ChatHeader({
3492
5578
  onBack,
3493
5579
  onPress,
3494
5580
  onMembersPress,
3495
- rightSlot
5581
+ rightSlot,
5582
+ showPresence = true
3496
5583
  }) {
3497
5584
  const { me } = react$1.useMe();
3498
5585
  const meId = me?.id ?? null;
3499
5586
  const { conversation: conv } = react$1.useConversation(conversationId);
3500
5587
  const { members } = react$1.useMembers(conversationId);
3501
- const { online } = react$1.usePresence(conversationId);
5588
+ const { online } = react$1.usePresence(showPresence ? conversationId : "");
3502
5589
  const isDirect = conv?.type === "direct";
3503
5590
  const otherMember = isDirect ? members.find((m) => m.user_id !== meId) : null;
3504
5591
  const otherExtId = otherMember?.external_id ?? null;
3505
5592
  const title = isDirect ? otherExtId ? labelFor?.(otherExtId) ?? otherExtId : conv?.name ?? "Direct chat" : conv?.name ?? "Untitled group";
3506
5593
  const avatarUrl = isDirect && otherExtId ? avatarFor?.(otherExtId) ?? null : null;
3507
- const otherOnline = isDirect && otherExtId ? online.has(otherExtId) : false;
3508
- const subtitle = isDirect ? otherOnline ? "Online" : null : `${members.length} member${members.length === 1 ? "" : "s"}`;
5594
+ const presence = react$1.useUserPresence(showPresence && isDirect ? otherExtId : null);
5595
+ const now = useNow();
5596
+ const otherOnline = showPresence && isDirect && otherExtId ? !presence && online.has(otherExtId) : false;
5597
+ const subtitle = isDirect ? !showPresence ? null : presence ? presenceText(presence, now) : otherOnline ? "Online" : null : `${members.length} member${members.length === 1 ? "" : "s"}`;
3509
5598
  const isPressable = typeof onPress === "function";
3510
5599
  const titleContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3511
- /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name: title, online: otherOnline, size: "md" }),
5600
+ /* @__PURE__ */ jsxRuntime.jsx(
5601
+ Avatar,
5602
+ {
5603
+ src: avatarUrl,
5604
+ name: title,
5605
+ presence: presence ?? (otherOnline ? "online" : null),
5606
+ size: "md"
5607
+ }
5608
+ ),
3512
5609
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-chat-header__titles", children: [
3513
5610
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-chat-header__title", children: title }),
3514
5611
  subtitle ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-chat-header__subtitle", children: subtitle }) : null
@@ -3551,7 +5648,15 @@ function ConversationList({
3551
5648
  error: controlledError,
3552
5649
  unreadCounts,
3553
5650
  labelFor,
3554
- avatarFor
5651
+ avatarFor,
5652
+ showPresence = true,
5653
+ density = "comfortable",
5654
+ sections,
5655
+ groupBy,
5656
+ header,
5657
+ hasMore: controlledHasMore,
5658
+ loadingMore: controlledLoadingMore,
5659
+ onLoadMore
3555
5660
  }) {
3556
5661
  const auto = react$1.useConversations();
3557
5662
  const { me } = react$1.useMe();
@@ -3562,49 +5667,123 @@ function ConversationList({
3562
5667
  const loading = isControlled ? controlledLoading ?? false : auto.loading;
3563
5668
  const error = isControlled ? controlledError ?? null : auto.error;
3564
5669
  const counts = unreadCounts ?? (isControlled ? void 0 : auto.unreadCounts);
3565
- if (loading && conversations.length === 0) {
3566
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list poolse-list--placeholder", children: "Loading conversations\u2026" });
3567
- }
3568
- if (error) {
3569
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list poolse-list--placeholder poolse-list--error", children: "Failed to load conversations." });
3570
- }
3571
- if (conversations.length === 0) {
3572
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list poolse-list--placeholder", children: emptyState ?? "No conversations yet." });
3573
- }
3574
- return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "poolse-list", role: "listbox", "aria-label": "Conversations", children: conversations.map((conv) => {
3575
- const selected = selectedId === conv.id;
3576
- const unread = counts?.[conv.id] ?? 0;
3577
- const content = renderItem ? renderItem(conv, selected) : /* @__PURE__ */ jsxRuntime.jsx(
3578
- DefaultRow,
3579
- {
3580
- conv,
3581
- selected,
3582
- unread,
3583
- meExternalId,
3584
- meId,
3585
- ...labelFor ? { labelFor } : {},
3586
- ...avatarFor ? { avatarFor } : {}
3587
- }
3588
- );
3589
- return /* @__PURE__ */ jsxRuntime.jsx(
3590
- "li",
3591
- {
3592
- role: "option",
3593
- "aria-selected": selected,
3594
- className: `poolse-list__item${selected ? " poolse-list__item--selected" : ""}`,
3595
- onClick: () => onSelect?.(conv),
3596
- onKeyDown: (e) => {
3597
- if (e.key === "Enter" || e.key === " ") {
3598
- e.preventDefault();
3599
- onSelect?.(conv);
3600
- }
3601
- },
3602
- tabIndex: 0,
3603
- children: content
5670
+ const hasMore = isControlled ? controlledHasMore ?? false : auto.hasMore;
5671
+ const loadingMore = isControlled ? controlledLoadingMore ?? false : auto.loadingMore;
5672
+ const loadMore = isControlled ? onLoadMore : auto.loadMore;
5673
+ const listRef = react.useRef(null);
5674
+ const sentinelRef = react.useRef(null);
5675
+ const loadMoreRef = react.useRef(loadMore);
5676
+ loadMoreRef.current = loadMore;
5677
+ const busyRef = react.useRef(false);
5678
+ const hasRows = conversations.length > 0;
5679
+ react.useEffect(() => {
5680
+ const sentinel = sentinelRef.current;
5681
+ const root = listRef.current;
5682
+ if (!sentinel || !root || !hasMore || loadingMore) return;
5683
+ if (typeof IntersectionObserver === "undefined") return;
5684
+ const io = new IntersectionObserver(
5685
+ ([entry]) => {
5686
+ if (!entry?.isIntersecting || busyRef.current) return;
5687
+ const fn = loadMoreRef.current;
5688
+ if (!fn) return;
5689
+ busyRef.current = true;
5690
+ void Promise.resolve().then(fn).catch(() => void 0).finally(() => {
5691
+ busyRef.current = false;
5692
+ });
3604
5693
  },
3605
- conv.id
5694
+ { root, rootMargin: "0px 0px 240px 0px", threshold: 0 }
3606
5695
  );
3607
- }) });
5696
+ io.observe(sentinel);
5697
+ return () => io.disconnect();
5698
+ }, [hasMore, loadingMore, hasRows]);
5699
+ const groups = react.useMemo(
5700
+ () => groupConversations(conversations, sections ?? (groupBy === "type" ? TYPE_SECTIONS : null)),
5701
+ [conversations, sections, groupBy]
5702
+ );
5703
+ const rootClass = [
5704
+ "poolse-conversation-list",
5705
+ `poolse-conversation-list--density-${density}`
5706
+ ].join(" ");
5707
+ const body = (() => {
5708
+ if (loading && conversations.length === 0) {
5709
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list poolse-list--placeholder", children: "Loading conversations\u2026" });
5710
+ }
5711
+ if (error && conversations.length === 0) {
5712
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list poolse-list--placeholder poolse-list--error", children: "Failed to load conversations." });
5713
+ }
5714
+ if (conversations.length === 0) {
5715
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list poolse-list--placeholder", children: emptyState ?? "No conversations yet." });
5716
+ }
5717
+ const row = (conv) => {
5718
+ const selected = selectedId === conv.id;
5719
+ const unread = counts?.[conv.id] ?? 0;
5720
+ const content = renderItem ? renderItem(conv, selected) : /* @__PURE__ */ jsxRuntime.jsx(
5721
+ DefaultRow,
5722
+ {
5723
+ conv,
5724
+ selected,
5725
+ unread,
5726
+ meExternalId,
5727
+ meId,
5728
+ showPresence,
5729
+ compact: density === "compact",
5730
+ ...labelFor ? { labelFor } : {},
5731
+ ...avatarFor ? { avatarFor } : {}
5732
+ }
5733
+ );
5734
+ return /* @__PURE__ */ jsxRuntime.jsx(
5735
+ "li",
5736
+ {
5737
+ role: "option",
5738
+ "aria-selected": selected,
5739
+ className: `poolse-list__item${selected ? " poolse-list__item--selected" : ""}`,
5740
+ onClick: () => onSelect?.(conv),
5741
+ onKeyDown: (e) => {
5742
+ if (e.key === "Enter" || e.key === " ") {
5743
+ e.preventDefault();
5744
+ onSelect?.(conv);
5745
+ }
5746
+ },
5747
+ tabIndex: 0,
5748
+ children: content
5749
+ },
5750
+ conv.id
5751
+ );
5752
+ };
5753
+ return /* @__PURE__ */ jsxRuntime.jsxs("ul", { ref: listRef, className: "poolse-list", role: "listbox", "aria-label": "Conversations", children: [
5754
+ groups === null ? conversations.map(row) : groups.map((g) => /* @__PURE__ */ jsxRuntime.jsxs("li", { role: "group", "aria-label": g.title, className: "poolse-list__section", children: [
5755
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list__section-title", "aria-hidden": "true", children: g.title }),
5756
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "poolse-list__section-items", role: "presentation", children: g.conversations.map(row) })
5757
+ ] }, g.title)),
5758
+ loadingMore && /* @__PURE__ */ jsxRuntime.jsx("li", { className: "poolse-list__loading-more", role: "presentation", children: "Loading\u2026" }),
5759
+ hasMore && /* @__PURE__ */ jsxRuntime.jsx(
5760
+ "li",
5761
+ {
5762
+ ref: sentinelRef,
5763
+ className: "poolse-list__sentinel",
5764
+ role: "presentation",
5765
+ "aria-hidden": "true"
5766
+ }
5767
+ )
5768
+ ] });
5769
+ })();
5770
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: rootClass, children: [
5771
+ header !== void 0 && header !== null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation-list__header", children: header }) : null,
5772
+ body
5773
+ ] });
5774
+ }
5775
+ var TYPE_SECTIONS = [
5776
+ { title: "Channels", filter: (c) => c.type !== "direct" },
5777
+ { title: "Direct messages", filter: (c) => c.type === "direct" }
5778
+ ];
5779
+ function groupConversations(conversations, sections) {
5780
+ if (!sections || sections.length === 0) return null;
5781
+ const out = sections.map((s) => ({ title: s.title, conversations: [] }));
5782
+ for (const conv of conversations) {
5783
+ const i = sections.findIndex((s) => s.filter(conv));
5784
+ if (i !== -1) out[i].conversations.push(conv);
5785
+ }
5786
+ return out.filter((g) => g.conversations.length > 0);
3608
5787
  }
3609
5788
  function DefaultRow({
3610
5789
  conv,
@@ -3612,24 +5791,35 @@ function DefaultRow({
3612
5791
  unread,
3613
5792
  meExternalId,
3614
5793
  meId = null,
5794
+ showPresence,
5795
+ compact = false,
3615
5796
  labelFor,
3616
5797
  avatarFor
3617
5798
  }) {
3618
5799
  const isDirect = conv.type === "direct";
3619
5800
  const otherExtId = isDirect && meExternalId ? (conv.member_external_ids ?? []).find((x) => x !== meExternalId) : null;
3620
- const title = isDirect ? otherExtId ? labelFor?.(otherExtId) ?? otherExtId : conv.name ?? "Direct chat" : conv.name ?? "Untitled group";
3621
- const avatarUrl = isDirect ? otherExtId ? avatarFor?.(otherExtId) ?? null : conv.avatar_url ?? null : conv.avatar_url ?? null;
5801
+ const { profile: other } = react$1.useUser(isDirect && otherExtId ? otherExtId : null);
5802
+ const title = isDirect ? otherExtId ? labelFor?.(otherExtId) ?? other?.displayName ?? otherExtId : conv.name ?? "Direct chat" : conv.name ?? "Untitled group";
5803
+ const avatarUrl = isDirect ? otherExtId ? avatarFor?.(otherExtId) ?? other?.avatarUrl ?? null : conv.avatar_url ?? null : conv.avatar_url ?? null;
3622
5804
  const time = conv.last_message_at ? formatRelative(conv.last_message_at) : "";
3623
5805
  const hasUnread = unread > 0;
3624
5806
  const preview = react$1.formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview ?? (conv.last_sequence > 0 ? `${conv.last_sequence} message${conv.last_sequence === 1 ? "" : "s"}` : "No messages yet");
3625
5807
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3626
- /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name: title, size: "md" }),
5808
+ /* @__PURE__ */ jsxRuntime.jsx(
5809
+ Avatar,
5810
+ {
5811
+ src: avatarUrl,
5812
+ name: title,
5813
+ size: compact ? "sm" : "md",
5814
+ ...showPresence && otherExtId ? { presence: true, userId: otherExtId } : {}
5815
+ }
5816
+ ),
3627
5817
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-list__body", children: [
3628
5818
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-list__head", children: [
3629
5819
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: `poolse-list__title${hasUnread ? " poolse-list__title--unread" : ""}`, children: title }),
3630
5820
  time && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-list__time", children: time })
3631
5821
  ] }),
3632
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list__preview", children: preview })
5822
+ compact ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list__preview", children: preview })
3633
5823
  ] }),
3634
5824
  hasUnread && /* @__PURE__ */ jsxRuntime.jsx(
3635
5825
  "span",
@@ -3655,15 +5845,17 @@ function MemberList({
3655
5845
  labelFor,
3656
5846
  avatarFor,
3657
5847
  onlineExternalIds,
5848
+ showPresence = true,
3658
5849
  canRemove,
3659
5850
  renderItem,
3660
5851
  emptyState
3661
5852
  }) {
3662
5853
  const { members, loading, error, removeMember } = react$1.useMembers(conversationId);
3663
- const { online: presenceOnline } = react$1.usePresence(
3664
- onlineExternalIds === void 0 ? conversationId : ""
5854
+ const legacy = onlineExternalIds !== void 0;
5855
+ const presences = react$1.usePresenceMany(
5856
+ showPresence && !legacy ? members.map((m) => m.external_id) : NO_IDS
3665
5857
  );
3666
- const effectiveOnline = onlineExternalIds ?? presenceOnline;
5858
+ const now = useNow();
3667
5859
  if (loading && members.length === 0) {
3668
5860
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list poolse-list--placeholder", children: "Loading members\u2026" });
3669
5861
  }
@@ -3682,7 +5874,8 @@ function MemberList({
3682
5874
  {
3683
5875
  membership: m,
3684
5876
  avatarUrl: avatarFor?.(m.external_id) ?? null,
3685
- online: effectiveOnline.has(m.external_id),
5877
+ presence: !showPresence ? null : legacy ? onlineExternalIds.has(m.external_id) : presences[m.external_id] ?? null,
5878
+ now,
3686
5879
  removable: canRemove?.(m) ?? false,
3687
5880
  onRemove: () => {
3688
5881
  void removeMember(m.external_id);
@@ -3693,20 +5886,22 @@ function MemberList({
3693
5886
  return /* @__PURE__ */ jsxRuntime.jsx("li", { className: "poolse-list__item", children: content }, m.id);
3694
5887
  }) });
3695
5888
  }
5889
+ var NO_IDS = [];
3696
5890
  function DefaultMemberRow({
3697
5891
  membership,
3698
5892
  avatarUrl,
3699
- online,
5893
+ presence,
5894
+ now,
3700
5895
  removable,
3701
5896
  onRemove,
3702
5897
  labelFor
3703
5898
  }) {
3704
5899
  const name = useDisplayName(membership.external_id, labelFor);
3705
5900
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-member-row", children: [
3706
- /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name, online, size: "md" }),
5901
+ typeof presence === "boolean" ? /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name, online: presence, size: "md" }) : /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name, presence, size: "md" }),
3707
5902
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-member-row__body", children: [
3708
5903
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-member-row__name", children: name }),
3709
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-member-row__sub", children: online ? "online" : "offline" })
5904
+ typeof presence === "boolean" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-member-row__sub", children: presence ? "online" : "offline" }) : presence ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-member-row__sub", children: presenceText(presence, now) }) : null
3710
5905
  ] }),
3711
5906
  /* @__PURE__ */ jsxRuntime.jsx(RoleBadge, { role: membership.role }),
3712
5907
  removable && /* @__PURE__ */ jsxRuntime.jsx(
@@ -4543,7 +6738,10 @@ exports.ChatHeader = ChatHeader;
4543
6738
  exports.ConversationList = ConversationList;
4544
6739
  exports.ConversationView = ConversationView;
4545
6740
  exports.EditableMessageBubble = EditableMessageBubble;
6741
+ exports.EditedLabel = EditedLabel;
6742
+ exports.EmojiPicker = EmojiPicker;
4546
6743
  exports.GroupDetailsSheet = GroupDetailsSheet;
6744
+ exports.LinkPreviewCard = LinkPreviewCard;
4547
6745
  exports.LiveCallBanner = LiveCallBanner;
4548
6746
  exports.MemberList = MemberList;
4549
6747
  exports.MentionInput = MentionInput;
@@ -4555,16 +6753,24 @@ exports.PoolseIcon = PoolseIcon;
4555
6753
  exports.PoolseInbox = PoolseInbox;
4556
6754
  exports.PoolseLogo = PoolseLogo;
4557
6755
  exports.PoolseTheme = PoolseTheme;
6756
+ exports.PresenceBadge = PresenceBadge;
4558
6757
  exports.ReactionPicker = ReactionPicker;
4559
6758
  exports.ReactionStrip = ReactionStrip;
4560
6759
  exports.RoomJoinBar = RoomJoinBar;
4561
6760
  exports.RoomStage = RoomStage;
6761
+ exports.ThreadSummary = ThreadSummary;
4562
6762
  exports.ThreadView = ThreadView;
4563
6763
  exports.TypingIndicator = TypingIndicator;
4564
6764
  exports.UploadQueueStrip = UploadQueueStrip;
4565
6765
  exports.UserName = UserName;
4566
6766
  exports.UserPickerSheet = UserPickerSheet;
6767
+ exports.formatRelativeTime = formatRelativeTime;
6768
+ exports.loadEmojiData = loadEmojiData;
6769
+ exports.localDraftStorage = localDraftStorage;
6770
+ exports.presenceStateLabel = presenceStateLabel;
6771
+ exports.presenceText = presenceText;
4567
6772
  exports.useDisplayName = useDisplayName;
6773
+ exports.useEditHistory = useEditHistory;
4568
6774
  exports.usePoolseFonts = usePoolseFonts;
4569
6775
  exports.useSystemColorScheme = useSystemColorScheme;
4570
6776
  exports.useTheme = useTheme;