{#if dragged && x && y}
{folders[folderId].name}
{/if}
{#if draggedOver}
{/if}
{ dispatch('open', e.detail); }} >
{ editHandler(); }} >
{#if open}
{:else}
{/if}
{#if edit}
{ nameUpdateHandler(); edit = false; }} on:click={(e) => { // Prevent accidental collapse toggling when clicking inside input e.stopPropagation(); }} on:mousedown={(e) => { // Prevent accidental collapse toggling when clicking inside input e.stopPropagation(); }} on:keydown={(e) => { if (e.key === 'Enter') { nameUpdateHandler(); edit = false; } }} class="w-full h-full bg-transparent text-gray-500 dark:text-gray-500 outline-none" /> {:else} {folders[folderId].name} {/if}
{ e.stopPropagation(); }} >
{ editHandler(); }} on:delete={() => { showDeleteConfirm = true; }} on:export={() => { exportHandler(); }} >
{}}>
{#if (folders[folderId]?.childrenIds ?? []).length > 0 || (folders[folderId].items?.chats ?? []).length > 0}
{#if folders[folderId]?.childrenIds} {@const children = folders[folderId]?.childrenIds .map((id) => folders[id]) .sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' }) )} {#each children as childFolder (`${folderId}-${childFolder.id}`)}
{ dispatch('import', e.detail); }} on:update={(e) => { dispatch('update', e.detail); }} on:change={(e) => { dispatch('change', e.detail); }} /> {/each} {/if} {#if folders[folderId].items?.chats} {#each folders[folderId].items.chats as chat (chat.id)}
{ dispatch('change', e.detail); }} /> {/each} {/if}
{/if}