{#if automationId} {#if detailLoading}
{:else if detail}
{#if !$sidebarOpen} {/if} / {detail.name}
handleToggle(detail!)} />
{$t('automations.status')}
{detail.is_active ? $t('automations.active') : $t('automations.paused')}
{$t('automations.schedule')} {parseFrequency(detail.rrule)}
{$t('automations.model')} {detail.model_id}
{$t('automations.nextRun')} {formatTime(detail.next_run_at)}
{$t('automations.lastRun')} {formatTime(detail.last_run_at)}
{$t('automations.webhook')} {#if detail.webhook_url}
...?token={detail.webhook_url.split('token=')[1]?.slice(0, 12)}...
{:else if detail.has_webhook}
{$t('automations.enabled')} · ·
{:else} {/if}
{$t('automations.prompt')}
{detail.prompt}
{$t('automations.runs')}
{#if runs.length === 0}
{$t('automations.noRuns')}
{:else} {#each runs as run}
{formatTime(run.created_at)} {#if run.chat_id} {/if} {#if run.error} {run.error} {/if}
{/each} {/if}
{/if} {:else}
{#if !$sidebarOpen} {/if} {$t('automations.title')} {#if total > 0} {total} {/if}
{#if searchQuery} {/if}
{#if loading}
{:else if items.length === 0}

{searchQuery ? $t('automations.noMatches') : $t('automations.noAutomations')}

{#if !searchQuery} {/if}
{:else} {#each items as a (a.id)}
{a.workspace.split('/').pop()} · {parseFrequency(a.rrule)}
e.stopPropagation()}>
e.stopPropagation()}> handleToggle(a)} />
{/each} {/if}
{/if}
{#if showModal} { showModal = false; editingAutomation = null; }} onsave={handleSave} /> {/if}