@poolse/react-ui 2.23.0 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
- import { createContext, forwardRef, useState, useRef, useCallback, useImperativeHandle, useEffect, useMemo, Fragment as Fragment$1, useContext } from 'react';
2
+ import { forwardRef, useState, useRef, useCallback, useImperativeHandle, useEffect, useMemo, Fragment as Fragment$1 } from 'react';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
- import { useMembers, useAttachmentUpload, useMe, useConversations, useUser, useConversation, usePresence, useMessages, useTyping, useRealtimeStatus, isMessageVisibleTo, receiptsOf, computeGroupPosition, sameDay, formatDayLabel, canEditOwnMessage, formatCallLogPreview, useLiveCall, callLogDisplayFor, useThread, useReactions, useAttachmentUrl, useCalls, useCallRoom, useVoiceRoom } from '@poolse/react';
4
+ import { useMembers, useAttachmentUpload, useMe, useConversations, useUser, useConversation, usePresence, useMessages, useTyping, useRealtimeStatus, isMessageVisibleTo, receiptsOf, computeGroupPosition, sameDay, formatDayLabel, canEditOwnMessage, formatCallLogPreview, useLiveCall, callLogDisplayFor, useThread, useReactions, useAttachmentUrl } from '@poolse/react';
5
5
  import ReactMarkdown from 'react-markdown';
6
6
  import remarkGfm from 'remark-gfm';
7
7
 
@@ -365,7 +365,9 @@ function CallVideoTile({
365
365
  className: "callgrid__avatar",
366
366
  style: { background: userColor(participant.userId) },
367
367
  "aria-hidden": "true",
368
- children: initialsOf(name)
368
+ children: initialsOf(
369
+ participant.isSelf ? participant.name ?? label(participant.userId) : name
370
+ )
369
371
  }
370
372
  ) }),
371
373
  !hideName && /* @__PURE__ */ jsxs("div", { className: "callgrid__caption", children: [
@@ -539,275 +541,6 @@ function kindLabel(kind) {
539
541
  if (kind === "audioinput") return "Microphone";
540
542
  return "Output";
541
543
  }
542
- var InviteContext = createContext(null);
543
- function useCallInvite() {
544
- return useContext(InviteContext) ?? {
545
- placeCall: () => {
546
- },
547
- busy: true
548
- };
549
- }
550
- var CHROME_IDLE_MS = 4500;
551
- function CallProvider({ userId, livekit, labelFor, children }) {
552
- const calls = useCalls(userId);
553
- const label = labelFor ?? ((id) => `User ${id.slice(0, 6)}`);
554
- const placeCall = useCallback(
555
- (conversationId, media = "audio") => {
556
- void calls.call(conversationId, media);
557
- },
558
- [calls]
559
- );
560
- const invite = { placeCall, busy: calls.phase !== "idle" };
561
- return /* @__PURE__ */ jsxs(InviteContext.Provider, { value: invite, children: [
562
- children,
563
- /* @__PURE__ */ jsx(CallSurface, { calls, livekit, labelFor: label })
564
- ] });
565
- }
566
- function CallSurface({
567
- calls,
568
- livekit,
569
- labelFor
570
- }) {
571
- const conversationInCall = calls.phase === "active" ? calls.activeConversationId : null;
572
- const isVideoCall = calls.media === "video";
573
- const sfu = useCallRoom(conversationInCall, { livekit, video: isVideoCall });
574
- const voice = useVoiceRoom(conversationInCall);
575
- const usingSfu = sfu.sfuAvailable === true;
576
- const mediaStatus = usingSfu ? sfu.status : voice.status;
577
- const connected = calls.phase === "active" && mediaStatus === "connected";
578
- useEffect(() => {
579
- if (calls.phase !== "active" || !conversationInCall) return;
580
- let cancelled = false;
581
- void (async () => {
582
- const joined = await sfu.join();
583
- if (cancelled || joined) return;
584
- await voice.join();
585
- })();
586
- return () => {
587
- cancelled = true;
588
- };
589
- }, [calls.phase, conversationInCall]);
590
- const hangUp = useCallback(() => {
591
- sfu.leave();
592
- voice.leave();
593
- void calls.hangUp();
594
- }, [sfu, voice, calls]);
595
- const alone = usingSfu ? sfu.alone : voice.alone;
596
- const endedOnEmpty = useRef(false);
597
- if (calls.phase !== "active") endedOnEmpty.current = false;
598
- useEffect(() => {
599
- if (!alone || calls.phase !== "active" || endedOnEmpty.current) return;
600
- endedOnEmpty.current = true;
601
- hangUp();
602
- }, [alone, calls.phase, hangUp]);
603
- const [chromeVisible, setChromeVisible] = useState(true);
604
- const [lastWake, setLastWake] = useState(0);
605
- const [menu, setMenu] = useState(null);
606
- const chromeHides = connected && isVideoCall && menu === null;
607
- useEffect(() => {
608
- setChromeVisible(true);
609
- if (!chromeHides) return;
610
- const timer = setTimeout(() => setChromeVisible(false), CHROME_IDLE_MS);
611
- return () => clearTimeout(timer);
612
- }, [chromeHides, lastWake]);
613
- const wake = useCallback(() => setLastWake(Date.now()), []);
614
- const withWake = useCallback(
615
- (fn) => () => {
616
- wake();
617
- fn();
618
- },
619
- [wake]
620
- );
621
- const micOn = usingSfu ? sfu.micEnabled : !voice.muted;
622
- const toggleMic = useCallback(() => {
623
- if (usingSfu) void sfu.toggleMic();
624
- else voice.toggleMute();
625
- }, [usingSfu, sfu, voice]);
626
- const openMenu = useCallback(
627
- (kind) => {
628
- sfu.refreshDevices();
629
- setMenu((current) => current === kind ? null : kind);
630
- },
631
- [sfu]
632
- );
633
- const duration = useCallDuration(connected);
634
- if (calls.phase === "idle") return null;
635
- const ringingIn = calls.phase === "ringing-in";
636
- const ringingOut = calls.phase === "ringing-out";
637
- const ended = calls.phase === "declined" || calls.phase === "busy" || calls.phase === "timed-out";
638
- const others = usingSfu ? sfu.participants.filter((p) => !p.isSelf) : [];
639
- const peerIds = ringingIn && calls.incoming ? [calls.incoming.callerUserId] : others.length > 0 ? others.map((p) => p.userId) : calls.outgoing?.calleeUserIds ?? [];
640
- const who = peerIds.length === 0 ? "Call" : peerIds.length <= 2 ? peerIds.map(labelFor).join(", ") : `${labelFor(peerIds[0])} and ${peerIds.length - 1} others`;
641
- const showStage = connected && usingSfu && sfu.participants.length > 0;
642
- const error = calls.error ?? (usingSfu ? sfu.error : voice.error);
643
- const isGroup = others.length > 1;
644
- return /* @__PURE__ */ jsxs(
645
- "div",
646
- {
647
- className: "callsheet",
648
- role: "dialog",
649
- "aria-modal": "true",
650
- "aria-label": "Call",
651
- onPointerMove: wake,
652
- children: [
653
- /* @__PURE__ */ jsx("div", { className: "callsheet__stage", children: showStage ? /* @__PURE__ */ jsx(
654
- CallVideoGrid,
655
- {
656
- participants: sfu.participants,
657
- labelFor,
658
- onLocalClick: sfu.cameraEnabled ? () => void sfu.switchCamera() : void 0
659
- }
660
- ) : /* @__PURE__ */ jsx("div", { className: "callsheet__identity", children: /* @__PURE__ */ jsx("span", { className: "callsheet__avatar", "aria-hidden": "true", children: who.slice(0, 1).toUpperCase() }) }) }),
661
- /* @__PURE__ */ jsxs("header", { className: `callsheet__header${chromeVisible ? "" : " callsheet__header--hidden"}`, children: [
662
- /* @__PURE__ */ jsx("p", { className: "callsheet__who", children: who }),
663
- /* @__PURE__ */ jsxs("p", { className: "callsheet__state", children: [
664
- isGroup && showStage ? `${sfu.participants.length} \xB7 ` : "",
665
- duration ?? statusLine(calls.phase, mediaStatus)
666
- ] })
667
- ] }),
668
- /* @__PURE__ */ jsxs("div", { className: `callsheet__actions${chromeVisible ? "" : " callsheet__actions--hidden"}`, children: [
669
- error && /* @__PURE__ */ jsx("p", { className: "callsheet__error", children: error.message }),
670
- ringingIn ? /* @__PURE__ */ jsxs("div", { className: "callsheet__row", children: [
671
- /* @__PURE__ */ jsx(
672
- CallControlButton,
673
- {
674
- icon: "phone-off",
675
- tone: "danger",
676
- large: true,
677
- label: "Decline",
678
- onClick: () => void calls.decline()
679
- }
680
- ),
681
- /* @__PURE__ */ jsx(
682
- CallControlButton,
683
- {
684
- icon: isVideoCall ? "video" : "phone",
685
- tone: "accept",
686
- large: true,
687
- label: "Accept",
688
- onClick: () => void calls.accept()
689
- }
690
- )
691
- ] }) : ended ? /* @__PURE__ */ jsx("div", { className: "callsheet__row", children: /* @__PURE__ */ jsx(CallControlButton, { icon: "close", label: "Close", onClick: calls.reset }) }) : /* @__PURE__ */ jsxs("div", { className: "callsheet__row", children: [
692
- /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
693
- /* @__PURE__ */ jsx(
694
- CallControlButton,
695
- {
696
- icon: micOn ? "mic" : "mic-off",
697
- active: !micOn,
698
- label: micOn ? "Mute" : "Unmute",
699
- onClick: withWake(toggleMic),
700
- hasMenu: usingSfu && sfu.devices.audioinput.length > 0,
701
- onMenuClick: withWake(() => openMenu("audioinput"))
702
- }
703
- ),
704
- menu === "audioinput" && /* @__PURE__ */ jsx(
705
- CallDeviceMenu,
706
- {
707
- title: "Microphone",
708
- devices: sfu.devices.audioinput,
709
- activeId: sfu.activeDevices.audioinput,
710
- onSelect: (kind, id) => void sfu.selectDevice(kind, id),
711
- onClose: () => setMenu(null)
712
- }
713
- )
714
- ] }),
715
- usingSfu && /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
716
- /* @__PURE__ */ jsx(
717
- CallControlButton,
718
- {
719
- icon: sfu.cameraEnabled ? "video" : "video-off",
720
- active: !sfu.cameraEnabled,
721
- label: "Camera",
722
- onClick: withWake(() => void sfu.toggleCamera()),
723
- disabled: sfu.devices.videoinput.length === 0,
724
- hasMenu: sfu.devices.videoinput.length > 0,
725
- onMenuClick: withWake(() => openMenu("videoinput"))
726
- }
727
- ),
728
- menu === "videoinput" && /* @__PURE__ */ jsx(
729
- CallDeviceMenu,
730
- {
731
- title: "Camera",
732
- devices: sfu.devices.videoinput,
733
- activeId: sfu.activeDevices.videoinput,
734
- onSelect: (kind, id) => void sfu.selectDevice(kind, id),
735
- onClose: () => setMenu(null)
736
- }
737
- )
738
- ] }),
739
- usingSfu && sfu.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
740
- /* @__PURE__ */ jsx(
741
- CallControlButton,
742
- {
743
- icon: "speaker",
744
- label: "Output",
745
- onClick: withWake(() => openMenu("audiooutput"))
746
- }
747
- ),
748
- menu === "audiooutput" && /* @__PURE__ */ jsx(
749
- CallDeviceMenu,
750
- {
751
- title: "Speaker",
752
- devices: sfu.devices.audiooutput,
753
- activeId: sfu.activeDevices.audiooutput,
754
- onSelect: (kind, id) => void sfu.selectDevice(kind, id),
755
- onClose: () => setMenu(null)
756
- }
757
- )
758
- ] }),
759
- /* @__PURE__ */ jsx(
760
- CallControlButton,
761
- {
762
- icon: "phone-off",
763
- tone: "danger",
764
- large: true,
765
- label: ringingOut ? "Cancel" : "Hang up",
766
- onClick: ringingOut ? () => void calls.cancel() : hangUp
767
- }
768
- )
769
- ] })
770
- ] })
771
- ]
772
- }
773
- );
774
- }
775
- function useCallDuration(connected) {
776
- const [startedAt, setStartedAt] = useState(null);
777
- const [, tick] = useState(0);
778
- useEffect(() => {
779
- if (!connected) {
780
- setStartedAt(null);
781
- return;
782
- }
783
- setStartedAt(Date.now());
784
- const id = setInterval(() => tick((n) => n + 1), 1e3);
785
- return () => clearInterval(id);
786
- }, [connected]);
787
- if (!connected || startedAt === null) return null;
788
- const total = Math.max(0, Math.floor((Date.now() - startedAt) / 1e3));
789
- const minutes = Math.floor(total / 60);
790
- const seconds = total % 60;
791
- return `${minutes}:${String(seconds).padStart(2, "0")}`;
792
- }
793
- function statusLine(phase, mediaStatus) {
794
- switch (phase) {
795
- case "ringing-in":
796
- return "Incoming call\u2026";
797
- case "ringing-out":
798
- return "Ringing\u2026";
799
- case "declined":
800
- return "Call declined";
801
- case "busy":
802
- return "Already on another call";
803
- case "timed-out":
804
- return "No answer";
805
- case "active":
806
- return mediaStatus === "connected" ? "Connected" : "Connecting\u2026";
807
- default:
808
- return "";
809
- }
810
- }
811
544
  var FONT_HREF = "https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600;12..96,800&family=Hanken+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap";
812
545
  var FONT_HREF_PRECONNECT_GOOGLE = "https://fonts.googleapis.com";
813
546
  var FONT_HREF_PRECONNECT_STATIC = "https://fonts.gstatic.com";
@@ -844,8 +577,8 @@ function PoolseFonts() {
844
577
  return null;
845
578
  }
846
579
  function LiveCallBanner({ call, inCall, onJoin }) {
847
- const what = call.media === "video" ? "Video call in progress" : "Voice call in progress";
848
- const who = inCall > 0 ? `${inCall} on the call` : "Ringing";
580
+ const what = call.kind === "room" ? call.media === "video" ? "Video room" : "Voice room" : call.media === "video" ? "Video call in progress" : "Voice call in progress";
581
+ const who = inCall > 0 ? `${inCall} ${call.kind === "room" ? "in the room" : "on the call"}` : call.kind === "room" ? "Starting" : "Ringing";
849
582
  return /* @__PURE__ */ jsxs("div", { className: "poolse-live-call", role: "status", "aria-label": `${what}, ${who}`, children: [
850
583
  /* @__PURE__ */ jsx(
851
584
  PoolseIcon,
@@ -3636,6 +3369,206 @@ var PoolseInbox = forwardRef(function PoolseInbox2({
3636
3369
  ) : null
3637
3370
  ] });
3638
3371
  });
3372
+ function RoomJoinBar({ room, allowStart = true }) {
3373
+ if (room.joined) return null;
3374
+ const live = room.live;
3375
+ if (live) {
3376
+ const isRoom = live.kind === "room";
3377
+ const what = isRoom ? live.media === "video" ? "Video room" : "Voice room" : live.media === "video" ? "Video call in progress" : "Call in progress";
3378
+ const n = room.presentIds.length;
3379
+ return /* @__PURE__ */ jsxs("div", { className: "poolse-roombar poolse-roombar--live", role: "status", children: [
3380
+ /* @__PURE__ */ jsx("span", { className: "poolse-roombar__dot", "aria-hidden": "true" }),
3381
+ /* @__PURE__ */ jsxs("span", { className: "poolse-roombar__text", children: [
3382
+ /* @__PURE__ */ jsx("strong", { children: what }),
3383
+ /* @__PURE__ */ jsx("span", { children: n > 0 ? ` \xB7 ${n} in the room` : " \xB7 starting" })
3384
+ ] }),
3385
+ /* @__PURE__ */ jsxs("span", { className: "poolse-roombar__actions", children: [
3386
+ /* @__PURE__ */ jsxs(
3387
+ "button",
3388
+ {
3389
+ type: "button",
3390
+ className: "poolse-roombar__btn",
3391
+ onClick: () => void room.join("audio"),
3392
+ disabled: room.joining,
3393
+ children: [
3394
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "mic", size: 15, label: null }),
3395
+ " Join"
3396
+ ]
3397
+ }
3398
+ ),
3399
+ /* @__PURE__ */ jsxs(
3400
+ "button",
3401
+ {
3402
+ type: "button",
3403
+ className: "poolse-roombar__btn poolse-roombar__btn--primary",
3404
+ onClick: () => void room.join("video"),
3405
+ disabled: room.joining,
3406
+ children: [
3407
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "video", size: 15, label: null }),
3408
+ " Join with video"
3409
+ ]
3410
+ }
3411
+ )
3412
+ ] })
3413
+ ] });
3414
+ }
3415
+ if (!allowStart) return null;
3416
+ return /* @__PURE__ */ jsxs("div", { className: "poolse-roombar", children: [
3417
+ /* @__PURE__ */ jsx("span", { className: "poolse-roombar__text", children: "Start a room \u2014 nobody is rung, anyone here can drop in" }),
3418
+ /* @__PURE__ */ jsxs("span", { className: "poolse-roombar__actions", children: [
3419
+ /* @__PURE__ */ jsxs(
3420
+ "button",
3421
+ {
3422
+ type: "button",
3423
+ className: "poolse-roombar__btn",
3424
+ onClick: () => void room.join("audio"),
3425
+ disabled: room.joining,
3426
+ children: [
3427
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "mic", size: 15, label: null }),
3428
+ " Voice"
3429
+ ]
3430
+ }
3431
+ ),
3432
+ /* @__PURE__ */ jsxs(
3433
+ "button",
3434
+ {
3435
+ type: "button",
3436
+ className: "poolse-roombar__btn poolse-roombar__btn--primary",
3437
+ onClick: () => void room.join("video"),
3438
+ disabled: room.joining,
3439
+ children: [
3440
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "video", size: 15, label: null }),
3441
+ " Video"
3442
+ ]
3443
+ }
3444
+ )
3445
+ ] })
3446
+ ] });
3447
+ }
3448
+ function RoomStage({ room, title, labelFor, className }) {
3449
+ const media = room.media;
3450
+ const [menu, setMenu] = useState(null);
3451
+ const elapsed = useElapsed(room.live?.started_at ?? null, media.status === "connected");
3452
+ const openMenu = useCallback(
3453
+ (kind) => {
3454
+ media.refreshDevices();
3455
+ setMenu((current) => current === kind ? null : kind);
3456
+ },
3457
+ [media]
3458
+ );
3459
+ const count = media.participants.length;
3460
+ const status = media.status === "connecting" || room.joining ? "Connecting\u2026" : `${count} in the room${elapsed ? ` \xB7 ${elapsed}` : ""}`;
3461
+ return /* @__PURE__ */ jsxs("section", { className: ["poolse-room", className].filter(Boolean).join(" "), "aria-label": "Room", children: [
3462
+ /* @__PURE__ */ jsxs("header", { className: "poolse-room__head", children: [
3463
+ /* @__PURE__ */ jsx("span", { className: "poolse-room__title", children: title ?? "Room" }),
3464
+ /* @__PURE__ */ jsx("span", { className: "poolse-room__status", children: status })
3465
+ ] }),
3466
+ /* @__PURE__ */ jsx("div", { className: "poolse-room__stage", children: count > 0 ? /* @__PURE__ */ jsx(
3467
+ CallVideoGrid,
3468
+ {
3469
+ participants: media.participants,
3470
+ ...labelFor ? { labelFor } : {},
3471
+ onLocalClick: media.cameraEnabled ? () => void media.switchCamera() : void 0
3472
+ }
3473
+ ) : /* @__PURE__ */ jsx("div", { className: "poolse-room__waiting", children: "Connecting\u2026" }) }),
3474
+ room.error && /* @__PURE__ */ jsx("p", { className: "poolse-room__error", children: room.error.message }),
3475
+ /* @__PURE__ */ jsxs("div", { className: "poolse-room__bar", children: [
3476
+ /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
3477
+ /* @__PURE__ */ jsx(
3478
+ CallControlButton,
3479
+ {
3480
+ icon: media.micEnabled ? "mic" : "mic-off",
3481
+ active: !media.micEnabled,
3482
+ label: media.micEnabled ? "Mute" : "Unmute",
3483
+ onClick: () => void media.toggleMic(),
3484
+ hasMenu: media.devices.audioinput.length > 0,
3485
+ onMenuClick: () => openMenu("audioinput")
3486
+ }
3487
+ ),
3488
+ menu === "audioinput" && /* @__PURE__ */ jsx(
3489
+ CallDeviceMenu,
3490
+ {
3491
+ title: "Microphone",
3492
+ devices: media.devices.audioinput,
3493
+ activeId: media.activeDevices.audioinput,
3494
+ onSelect: (kind, id) => void media.selectDevice(kind, id),
3495
+ onClose: () => setMenu(null)
3496
+ }
3497
+ )
3498
+ ] }),
3499
+ /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
3500
+ /* @__PURE__ */ jsx(
3501
+ CallControlButton,
3502
+ {
3503
+ icon: media.cameraEnabled ? "video" : "video-off",
3504
+ active: !media.cameraEnabled,
3505
+ label: media.cameraEnabled ? "Camera" : "Camera off",
3506
+ onClick: () => void media.toggleCamera(),
3507
+ disabled: media.devices.videoinput.length === 0 && !media.cameraEnabled,
3508
+ hasMenu: media.devices.videoinput.length > 0,
3509
+ onMenuClick: () => openMenu("videoinput")
3510
+ }
3511
+ ),
3512
+ menu === "videoinput" && /* @__PURE__ */ jsx(
3513
+ CallDeviceMenu,
3514
+ {
3515
+ title: "Camera",
3516
+ devices: media.devices.videoinput,
3517
+ activeId: media.activeDevices.videoinput,
3518
+ onSelect: (kind, id) => void media.selectDevice(kind, id),
3519
+ onClose: () => setMenu(null)
3520
+ }
3521
+ )
3522
+ ] }),
3523
+ media.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
3524
+ /* @__PURE__ */ jsx(
3525
+ CallControlButton,
3526
+ {
3527
+ icon: "speaker",
3528
+ label: "Speaker",
3529
+ onClick: () => openMenu("audiooutput")
3530
+ }
3531
+ ),
3532
+ menu === "audiooutput" && /* @__PURE__ */ jsx(
3533
+ CallDeviceMenu,
3534
+ {
3535
+ title: "Speaker",
3536
+ devices: media.devices.audiooutput,
3537
+ activeId: media.activeDevices.audiooutput,
3538
+ onSelect: (kind, id) => void media.selectDevice(kind, id),
3539
+ onClose: () => setMenu(null)
3540
+ }
3541
+ )
3542
+ ] }),
3543
+ /* @__PURE__ */ jsx(
3544
+ CallControlButton,
3545
+ {
3546
+ icon: "phone-off",
3547
+ tone: "danger",
3548
+ large: true,
3549
+ label: "Leave",
3550
+ onClick: room.leave
3551
+ }
3552
+ )
3553
+ ] })
3554
+ ] });
3555
+ }
3556
+ function useElapsed(startedAt, running) {
3557
+ const [, tick] = useState(0);
3558
+ useEffect(() => {
3559
+ if (!running) return;
3560
+ const id = setInterval(() => tick((n) => n + 1), 1e3);
3561
+ return () => clearInterval(id);
3562
+ }, [running]);
3563
+ if (!running || !startedAt) return null;
3564
+ const start = Date.parse(startedAt);
3565
+ if (!Number.isFinite(start)) return null;
3566
+ const total = Math.max(0, Math.floor((Date.now() - start) / 1e3));
3567
+ const h = Math.floor(total / 3600);
3568
+ const m = Math.floor(total % 3600 / 60);
3569
+ const s = String(total % 60).padStart(2, "0");
3570
+ return h > 0 ? `${h}:${String(m).padStart(2, "0")}:${s}` : `${m}:${s}`;
3571
+ }
3639
3572
  var MARK_PATHS = /* @__PURE__ */ jsxs(Fragment, { children: [
3640
3573
  /* @__PURE__ */ jsx(
3641
3574
  "path",
@@ -3744,6 +3677,6 @@ function PoolseLogo({
3744
3677
  );
3745
3678
  }
3746
3679
 
3747
- export { AttachmentPreview, Avatar, CallControlButton, CallDeviceMenu, CallLogRow, CallProvider, CallVideoGrid, ChatHeader, ConversationList, ConversationView, EditableMessageBubble, GroupDetailsSheet, LiveCallBanner, MemberList, MentionInput, MessageActions, MessageBubble, MessageComposer, PoolseFonts, PoolseIcon, PoolseInbox, PoolseLogo, ReactionPicker, ReactionStrip, ThreadView, TypingIndicator, UploadQueueStrip, UserName, UserPickerSheet, useCallInvite, useDisplayName, usePoolseFonts };
3680
+ export { AttachmentPreview, Avatar, CallControlButton, CallDeviceMenu, CallLogRow, CallVideoGrid, ChatHeader, ConversationList, ConversationView, EditableMessageBubble, GroupDetailsSheet, LiveCallBanner, MemberList, MentionInput, MessageActions, MessageBubble, MessageComposer, PoolseFonts, PoolseIcon, PoolseInbox, PoolseLogo, ReactionPicker, ReactionStrip, RoomJoinBar, RoomStage, ThreadView, TypingIndicator, UploadQueueStrip, UserName, UserPickerSheet, useDisplayName, usePoolseFonts };
3748
3681
  //# sourceMappingURL=index.js.map
3749
3682
  //# sourceMappingURL=index.js.map