{event?.name || t('event.eventTitle')}
{#if error && !event}
⚠️

{t('event.eventNotFoundTitle')}

{t('event.eventNotFoundDescription')}

{:else if event}

{event.name}

{formatDate(event.date)} - {formatTime(event.time)}

{event.location}

{event.type === 'limited' ? t('common.limited') : t('common.unlimited')} {event.visibility === 'public' ? t('common.public') : t('common.private')}
{#if event.type === 'limited' && event.attendee_limit}

{t('common.capacity')}

{rsvps.length}/{event.attendee_limit}

{/if}

{t('event.joinThisEvent')}

{#if event.type === 'limited' && event.attendee_limit && rsvps.length >= event.attendee_limit}
🚫

{t('event.eventIsFull')}

{t('event.maximumCapacityReached')}

{:else}
{ isAddingRSVP = true; clearMessages(); return async ({ result, update }) => { isAddingRSVP = false; if (result.type === 'failure') { error = String(result.data?.error || 'Failed to add RSVP'); } update(); }; }} class="space-y-4" >
{#if addGuests}

{t('event.guestsWillBeAddedAs', { name: newAttendeeName || t('common.yourNamePlaceholder') })}

{/if}
{/if}

{t('event.attendeesTitle')}

{rsvps.length}
{#if rsvps.length === 0}

{t('event.noAttendeesYet')}

{t('event.beFirstToJoin')}

{:else}
{#each rsvps as attendee, i (i)}
{attendee.name.charAt(0).toUpperCase()}

{attendee.name}

{(() => { const date = new Date(attendee.created_at); const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); const hours = String(date.getHours()).padStart(2, '0'); const minutes = String(date.getMinutes()).padStart(2, '0'); return `${year}/${month}/${day} ${hours}:${minutes}`; })()}

{#if attendee.user_id === currentUserId}
{ clearMessages(); return async ({ result, update }) => { if (result.type === 'failure') { error = String(result.data?.error || 'Failed to remove RSVP'); } update(); }; }} style="display: inline;" >
{/if}
{/each}
{/if}
{/if}
{#if calendarEvent && browser} {/if} {#if success} {#if form?.type === 'add'}
{success}
{:else if form?.type === 'remove'}
{t('event.removedRsvpSuccessfully')}
{/if} {/if} {#if error}
{error}
{/if}