{#if !loaded}{:else} {#if showForm} {#if error}
{error}
{/if}
form.icon = v} />
{#if !editing}
{/if}
{/if} {#if bots.length === 0 && !showForm}

{t('telegramBot.noBots')}

{:else}
{#each bots as bot}
{#if bot.icon}{/if}

{bot.name}

{#if bot.bot_username} @{bot.bot_username} {/if}

{bot.token_preview}

editBot(bot)} /> remove(bot.id)} variant="danger" />
{#if expandedSection[bot.id] === 'chats'}
{#if chatsLoading[bot.id]}

{t('common.loading')}

{:else if (chats[bot.id] || []).length === 0}

{t('telegramBot.noChats')}

{:else}
{#each chats[bot.id] as chat}
copyChatId(e, chat.chat_id)} title={t('telegramBot.clickToCopy')} role="button" tabindex="0">
{chat.title || chat.username || 'Unknown'} {chatTypeLabel(chat.type)} {chat.chat_id}
{ e.stopPropagation(); deleteChat(bot.id, chat.id); }} variant="danger" />
{/each}
{/if}
{/if}
{/each}
{/if} {/if} confirmDelete?.onconfirm()} oncancel={() => confirmDelete = null} />