{#if filteredItems.length > 0 || prompt.split(' ')?.at(0)?.substring(1).startsWith('http')}
{#each filteredItems as item, idx}
{ console.log(item); confirmSelect(item); }} on:mousemove={() => { selectedIdx = idx; }} >
{#if item.legacy}
Legacy
{:else if item?.meta?.document}
Document
{:else if item?.type === 'file'}
File
{:else}
Collection
{/if}
{item?.name}
{item?.description}
{/each} {#if prompt .split(' ') .some((s) => s.substring(1).startsWith('https://www.youtube.com') || s .substring(1) .startsWith('https://youtu.be'))}
{ const url = prompt.split(' ')?.at(0)?.substring(1); if (isValidHttpUrl(url)) { confirmSelectYoutube(url); } else { toast.error( $i18n.t( 'Oops! Looks like the URL is invalid. Please double-check and try again.' ) ); } }} >
{prompt.split(' ')?.at(0)?.substring(1)}
{$i18n.t('Youtube')}
{:else if prompt.split(' ')?.at(0)?.substring(1).startsWith('http')}
{ const url = prompt.split(' ')?.at(0)?.substring(1); if (isValidHttpUrl(url)) { confirmSelectWeb(url); } else { toast.error( $i18n.t( 'Oops! Looks like the URL is invalid. Please double-check and try again.' ) ); } }} >
{prompt.split(' ')?.at(0)?.substring(1)}
{$i18n.t('Web')}
{/if}
{/if}