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6BA,IAAAY,EAAAC,GAAA,EAWCC,EAAGxC,EAAAF,EAXJwC,CAAA,EAAA,CAAA,EAYEG,IADDD,CAAG,MACFC,EAAI,EAAA,IAAJA,CAAI,EACJ,IAAAC,IADAD,EAAI,CAAA,EAEHE,IADDD,CAAI,MACHC,EAAI,EAAA,IAAJA,CAAI,UAAJA,CAAI,IADLD,CAAI,IAFLF,CAAG,EAXJjC,EAAA+B,CAAA,+CAY0D,IAAAzB,EAAE,sBAAsB,EAE5B,IAAAA,EAAE,SAAS,EAAW,IAAAA,EAAE,+BAA8B,CAAI,OAAQA,EAACtB,EAAA,MAAA,CAAA,CAAA,IAdzHuB,EAAA,QAAAwB,EAAA,YAAAvB,EAAA,6BAAAO,EAAAC,EAAAe,CAAA,WA/BGrD,EAAQ,IAAK,SAAQuC,EAAAoB,CAAA,EA6BhB3D,EAAQ,IAAK,UAAQuC,EAAAqB,EAAA,CAAA,sBA5E3BxD,CAAS,EAAAmC,EAAAsB,CAAA,EAAAtB,EAAAuB,EAAA,EAAA,eAFN","names":["save","saveMode","hasSelection","uploadNew","$.state","showReuse","$.derived","$$props","$.get","toggle","div","root_1","div_1","img","$.child","div_2","$.sibling","p","p_1","span","text_1","button","text_4","$.reset","button_1","text_5","$.set_attribute","$0","$.set_class","t","$.delegated","$$args","$.set","button_2","root_3","text_6","$.template_effect","$.set_text","$.append","$$anchor","$$render","consequent_1","button_3","root_4","div_3","div_4","div_5","span_1","span_2","span_3","text_8","text_11","consequent_2","alternate","button_4","root_7","div_6","span_4","span_5","span_6","consequent_3","consequent_4","consequent","alternate_1"],"sources":["../../../../../../src/lib/components/ReusePhoto.svelte"],"sourcesContent":["<script lang=\"ts\">\n\timport { t } from '$lib/i18n';\n\timport { msg } from '$lib/i18n/mark';\n\timport type { Snippet } from 'svelte';\n\n\t// the product names pages pass in, said in the page's language\n\tmsg('Arena');\n\n\ttype Props = {\n\t\t/** Signed in? Drives whether the reuse card can show (saved photo implies an account). */\n\t\tloggedIn: boolean;\n\t\t/** Signed URL of the user's last saved photo, or null when nothing is saved. */\n\t\tlastPhotoUrl: string | null;\n\t\t/** Other features the photo works on, Arena featured, never the current one (e.g. \"Arena\"). */\n\t\tothers: string;\n\t\t/** Literal Tailwind classes for the primary button (e.g. \"bg-coral text-white\"). */\n\t\tuseBtnClass: string;\n\t\t/** Literal Tailwind class for the toggle's on-track (e.g. \"bg-coral\"). */\n\t\ttoggleOnClass: string;\n\t\t/** Save-for-reuse state. Bindable so the page reads it on submit. */\n\t\tsave?: boolean;\n\t\t/**\n\t\t * What to show under the dropzone:\n\t\t *  - 'toggle': the save-for-reuse toggle (surfaces that sign the user in during the flow, e.g. Rate/Duel/Arena).\n\t\t *  - 'signup': a sign-up hook (truly anonymous surfaces where saving needs an account, e.g. Beat/Bet).\n\t\t *  - 'none': nothing (the page owns the control elsewhere).\n\t\t */\n\t\tsaveMode?: 'toggle' | 'signup' | 'none';\n\t\t/** \"Use this\" tapped on the saved photo — page proceeds with the saved image, skipping upload. */\n\t\tonUseSaved: () => void;\n\t\t/** Sign-up hook tapped (saveMode 'signup'). */\n\t\tonSignUp?: () => void;\n\t\t/** Fired when the save toggle flips, for analytics. */\n\t\tonToggle?: (value: boolean) => void;\n\t\t/** \"Use saved photo\" (back from Upload new) tapped — page should clear any picked file so the reuse card returns. */\n\t\tonBack?: () => void;\n\t\t/** True when the page already has a file selected (e.g. Arena's in-place preview) — hides the reuse card. */\n\t\thasSelection?: boolean;\n\t\t/** The page's own dropzone / selected-preview markup, rendered when not reusing. */\n\t\tupload: Snippet;\n\t};\n\n\tlet {\n\t\tloggedIn,\n\t\tlastPhotoUrl,\n\t\tothers,\n\t\tuseBtnClass,\n\t\ttoggleOnClass,\n\t\tsave = $bindable(true),\n\t\tsaveMode = 'toggle',\n\t\tonUseSaved,\n\t\tonSignUp,\n\t\tonToggle,\n\t\tonBack,\n\t\thasSelection = false,\n\t\tupload\n\t}: Props = $props();\n\n\tlet uploadNew = $state(false);\n\tconst showReuse = $derived(loggedIn && !!lastPhotoUrl && !uploadNew && !hasSelection);\n\n\tfunction toggle() {\n\t\tsave = !save;\n\t\tonToggle?.(save);\n\t}\n</script>\n\n{#if showReuse}\n\t<!-- S1 — reuse card replaces the dropzone -->\n\t<div class=\"rounded-xl border border-border bg-surface p-3\">\n\t\t<div class=\"flex items-center gap-3\">\n\t\t\t<img\n\t\t\t\tsrc={lastPhotoUrl}\n\t\t\t\talt={t('your last upload')}\n\t\t\t\tclass=\"h-[50px] w-[50px] shrink-0 rounded-xl object-cover\"\n\t\t\t/>\n\t\t\t<div class=\"min-w-0 flex-1\">\n\t\t\t\t<p class=\"text-sm font-bold leading-tight text-text\">{t('Use your last photo')}</p>\n\t\t\t\t<p class=\"mt-0.5 text-[11px] leading-snug text-muted\">\n\t\t\t\t\t{t('Works on')} <span class=\"font-semibold text-text/80\">{t(others)}</span> {t('& more.')}\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonclick={onUseSaved}\n\t\t\t\tclass=\"shrink-0 rounded-lg px-4 py-2.5 text-[13px] font-bold {useBtnClass}\"\n\t\t\t>\n\t\t\t\t{t('Use this')}\n\t\t\t</button>\n\t\t</div>\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonclick={() => (uploadNew = true)}\n\t\t\tclass=\"mt-2.5 w-full rounded-xl border border-border py-2.5 text-[13px] font-bold text-text transition-colors hover:border-muted\"\n\t\t>\n\t\t\t{t('Upload new')}\n\t\t</button>\n\t</div>\n{:else}\n\t{#if uploadNew}\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonclick={() => {\n\t\t\t\tuploadNew = false;\n\t\t\t\tonBack?.();\n\t\t\t}}\n\t\t\tclass=\"mb-2 inline-block text-[11px] text-muted underline\"\n\t\t>\n\t\t\t{t('← Use saved photo')}\n\t\t</button>\n\t{/if}\n\n\t{@render upload()}\n\n\t{#if saveMode === 'toggle'}\n\t\t<!-- S0 / S2 — save toggle below the dropzone, always visible -->\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonclick={toggle}\n\t\t\tclass=\"mt-3 flex w-full items-center gap-3 rounded-xl border border-border bg-surface px-4 py-3 text-left transition-colors hover:border-muted\"\n\t\t>\n\t\t\t<div\n\t\t\t\tclass=\"relative h-5 w-9 shrink-0 rounded-full transition-colors duration-200 {save\n\t\t\t\t\t? toggleOnClass\n\t\t\t\t\t: 'bg-border'}\"\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclass=\"absolute top-0.5 h-4 w-4 rounded-full bg-white shadow transition-transform duration-200 {save\n\t\t\t\t\t\t? 'translate-x-4'\n\t\t\t\t\t\t: 'translate-x-0.5'}\"\n\t\t\t\t></div>\n\t\t\t</div>\n\t\t\t<div class=\"min-w-0 flex-1\">\n\t\t\t\t<span class=\"block text-[13px] font-semibold text-text\">{t('Save photo for later')}</span>\n\t\t\t\t<span class=\"mt-0.5 block text-[11px] leading-snug text-muted\">\n\t\t\t\t\t{#if save}\n\t\t\t\t\t\t{t('Reuse on')} <span class=\"font-semibold text-text/80\">{t(others)}</span> {t('& more.')}\n\t\t\t\t\t{:else}\n\t\t\t\t\t\t{t('Off · zero storage.')}\n\t\t\t\t\t{/if}\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</button>\n\t{:else if saveMode === 'signup'}\n\t\t<!-- S0a / S3 — anonymous: saving needs an account, so the row is a sign-up hook -->\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonclick={onSignUp}\n\t\t\tclass=\"mt-3 flex w-full items-center gap-3 rounded-xl border border-border bg-surface px-4 py-3 text-left transition-colors hover:border-muted\"\n\t\t>\n\t\t\t<div class=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-border/40 text-muted\">\n\t\t\t\t<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t<rect x=\"5\" y=\"11\" width=\"14\" height=\"9\" rx=\"2\" />\n\t\t\t\t\t<path d=\"M8 11V8a4 4 0 0 1 8 0v3\" />\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t\t<div class=\"min-w-0 flex-1\">\n\t\t\t\t<span class=\"block text-[13px] font-semibold text-text\">{t('Save photo for later')}</span>\n\t\t\t\t<span class=\"mt-0.5 block text-[11px] leading-snug text-muted\">\n\t\t\t\t\t<span class=\"font-semibold text-text/80 underline\">{t('Sign up')}</span> {t('to reuse on {others} & more.', { others: t(others) })}\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</button>\n\t{/if}\n{/if}\n"],"version":3}