{#if value == null || streaming}
{#if active_source === "microphone"}
{#if streaming}
{:else}
onstart_recording?.()}
onpauserecording={() => onpause_recording?.()}
onstoprecording={() => onstop_recording?.()}
/>
{/if}
{:else if active_source === "upload"}
onerror?.(detail)}
{root}
{max_file_size}
{upload}
{stream_handler}
aria_label={i18n("audio.drop_to_upload")}
>
{#if children}{@render children()}{/if}
{/if}
{:else}
{
mode = "edit";
onedit?.();
}}
download={buttons === null
? value.url
: buttons.some((btn) => typeof btn === "string" && btn === "download")
? value.url
: null}
>
{#if value !== null && buttons}
{#each buttons as btn}
{#if typeof btn === "string"}
{#if btn === "share"}
{}}
formatter={async (fileData: FileData) => {
if (!fileData || !fileData.url) return "";
let url = await uploadToHuggingFace(fileData.url, "url");
return ``;
}}
{value}
/>
{/if}
{:else}
{
if (on_custom_button_click) {
on_custom_button_click(id);
}
}}
/>
{/if}
{/each}
{/if}
{/if}