{#if source === "upload"}
{#if (value === null && !static_image) || streaming}
{:else if tool === "select"}
(handle_clear(e), (tool = "editor"))} /> {:else if tool === "editor"}
(tool = "select")} on:clear={handle_clear} editable />
{:else if (tool === "sketch" || tool === "color-sketch") && (value !== null || static_image)} {#key static_image}
{/key} {#if img_width > 0}
sketch.undo()} on:clear_mask={handle_mask_clear} on:remove_image={handle_sketch_clear} /> {#if tool === "color-sketch" || tool === "sketch"}
{/if} {/if} {:else}
{/if}
{:else if source === "canvas"}
sketch.undo()} on:remove_image={handle_sketch_clear} /> {#if tool === "color-sketch"}
{/if}
{:else if (value === null && !static_image) || streaming} {#if source === "webcam" && !static_image}
tool === "color-sketch" ? handle_upload(e) : handle_save(e, true)} on:stream={handle_save} on:error {streaming} {pending} {mirror_webcam} /> {/if} {:else if tool === "select"}
(handle_clear(e), (tool = "editor"))} /> {:else if tool === "editor"}
(tool = "select")} on:clear={handle_clear} editable />
{:else if (tool === "sketch" || tool === "color-sketch") && (value !== null || static_image)} {#key static_image}
{/key} {#if img_width > 0}
sketch.undo()} on:remove_image={handle_sketch_clear} /> {#if tool === "color-sketch" || tool === "sketch"}
{/if} {/if} {:else}
{/if}