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,CAAS,EAAG,mDAAqD,yCAAyC,qCAChHA,CAAS,IAAIE,CAAO,EAAG,qDAAuD,+DAAkE,2DAA2D,EAAA,sBAhBhPqB,EAAA,QAAAH,EAiBOjB,CAAK,GAAI,MAAS,QAExBmB,CAAK,CAAA,IAnBNiB,EAAA,QAAAhB,EAEUiB,GAAM,CACfA,EAAE,gBAAe,EACjB7B,EAAM,CACP,CAAC,mBALDY,EAMiBiB,KAAOtC,EAAUsC,EAAE,cAAgB,OAAO,CAAA,mBAN3DjB,EAAA,IAAAd,EAOuBP,EAAU,EAAK,CAAA,iBAX/B","names":["KEY","MAX","counted","takeFollowHint","where","n","source","variant","followsYou","nickname","hint","$.prop","$$props","local","$.derived","pending","$.state","following","$followState","hovered","error","toast","toastTimer","say","text","kind","$.set","onDestroy","toggle","wasFollowing","url","res","body","t","isBlockedByMe","setFollowState","trackFollowHintShown","$.get","trackRaterFollowed","label","button","$.first_child","fragment","text_1","$.child","$.reset","node","$.sibling","div","root_1","BlockedByMeNote","$$anchor","span","fragment_2","a","text_3","$.delegated","e","trackFollowHintClicked","$.template_effect","$.set_text","text_4","$$render","consequent_1","alternate","consequent_2","$.set_attribute"],"sources":["../../../../../../src/lib/follow-hint.ts","../../../../../../src/lib/components/profile/FollowButton.svelte"],"sourcesContent":["/**\n * RAT-683: after a follow, where the posts are. A follow used to change nothing\n * but the button, so the first few in a browser say it; after that people know.\n */\nconst KEY = 'rmd_follow_hints';\nconst MAX = 3;\n\n// what storage can't hold (blocked) is counted for this page's life\nlet counted = 0;\n\n/** Take one showing, if there is one left — and never on the Following tab\n *  itself, which shows the posts. */\nexport function takeFollowHint(\n\twhere: { pathname: string; search: string } = window.location\n): boolean {\n\tif (where.pathname === '/f' && new URLSearchParams(where.search).get('tab') === 'following') {\n\t\treturn false;\n\t}\n\tlet n = counted;\n\ttry {\n\t\tn = Math.max(n, Number(localStorage.getItem(KEY)) || 0);\n\t} catch {\n\t\t/* storage blocked */\n\t}\n\tif (n >= MAX) return false;\n\tcounted = n + 1;\n\ttry {\n\t\tlocalStorage.setItem(KEY, String(counted));\n\t} catch {\n\t\t/* storage blocked */\n\t}\n\treturn true;\n}\n","<script lang=\"ts\">\n\timport { t } from '$lib/i18n';\n\timport { onDestroy } from 'svelte';\n\timport { trackFollowHintClicked, trackFollowHintShown, trackRaterFollowed } from '$lib/analytics';\n\timport { takeFollowHint } from '$lib/follow-hint';\n\timport type { FollowSource } from '$lib/social-sources';\n\timport { followState, setFollowState } from '$lib/stores/followState';\n\timport { isBlockedByMe } from '$lib/block-refusal';\n\timport BlockedByMeNote from '$lib/components/block/BlockedByMeNote.svelte';\n\n\t// RAT-660: one list shared with the API, which drops anything not on it.\n\ttype Source = FollowSource;\n\n\tinterface Props {\n\t\ttargetUserId: string;\n\t\tinitialIsFollowing: boolean;\n\t\tsource?: Source;\n\t\t/** RAT-657: `compact` sits in a feed card's header, `overlay` on a\n\t\t *  full-screen reel (white on video). `default` is the profile button. */\n\t\tvariant?: 'default' | 'compact' | 'overlay';\n\t\t/** RAT-661: this person already follows the viewer — the button says\n\t\t *  \"follow back\" until it's pressed. */\n\t\tfollowsYou?: boolean;\n\t\t/** Optional callback fired with the updated count after a successful toggle. */\n\t\toncountschange?: (counts: { followers: number; following: number }) => void;\n\t\t/** RAT-657: fired with the new state after a successful toggle. */\n\t\tonchange?: (following: boolean) => void;\n\t\t/** @deprecated RAT-327: the button now follows the active module\n\t\t *  accent (`--color-accent`) regardless of this prop. Kept in the\n\t\t *  signature so existing call sites still type-check; the value\n\t\t *  is ignored. */\n\t\taccent?: 'coral' | 'green';\n\t\t/** their nickname, for the \"you blocked @x\" refusal */\n\t\tnickname?: string | null;\n\t\t/** RAT-683: say where the posts are after a follow (the first few in a\n\t\t *  browser). Off where the place around the button says it itself. */\n\t\thint?: boolean;\n\t}\n\n\tlet {\n\t\ttargetUserId,\n\t\tinitialIsFollowing,\n\t\tsource = 'other',\n\t\tvariant = 'default',\n\t\tfollowsYou = false,\n\t\toncountschange,\n\t\tonchange,\n\t\tnickname = null,\n\t\thint = true\n\t}: Props = $props();\n\n\t// The follow state from the page, owned by local toggles from here; a writable $derived, so a\n\t// reload with a new answer (a block dropped the follow) resyncs it.\n\tlet local = $derived(initialIsFollowing);\n\tlet pending = $state(false);\n\t// A toggle on another button for the same person (another feed card, the\n\t// reels viewer) wins over this button's own snapshot — except mid-request.\n\tconst following = $derived(\n\t\tpending ? local : ($followState[targetUserId] ?? local)\n\t);\n\tlet hovered = $state(false);\n\tlet error = $state('');\n\t// A refused follow says so on screen (a title tooltip never shows on touch): the site toast's\n\t// look, a few seconds. `blocked` = I blocked them (block everything): name it, link to Settings.\n\t// `hint` = a follow that went through: where the posts are, with a link there.\n\tlet toast = $state<{ text: string; kind: 'text' | 'blocked' | 'hint' } | null>(null);\n\tlet toastTimer: ReturnType<typeof setTimeout> | undefined;\n\tfunction say(text: string, kind: 'text' | 'blocked' | 'hint' = 'text') {\n\t\ttoast = { text, kind };\n\t\tclearTimeout(toastTimer);\n\t\ttoastTimer = setTimeout(() => (toast = null), 5000);\n\t}\n\t// no DOM here, so safe on the server pass too\n\tonDestroy(() => clearTimeout(toastTimer));\n\n\tasync function toggle() {\n\t\tif (pending) return;\n\t\tconst wasFollowing = following;\n\t\t// optimistic flip\n\t\tlocal = !wasFollowing;\n\t\tpending = true;\n\t\terror = '';\n\n\t\tconst url = wasFollowing\n\t\t\t? `/api/follow/${encodeURIComponent(targetUserId)}`\n\t\t\t: `/api/follow/${encodeURIComponent(targetUserId)}?source=${encodeURIComponent(source)}`;\n\n\t\ttry {\n\t\t\tconst res = await fetch(url, { method: wasFollowing ? 'DELETE' : 'POST' });\n\t\t\tif (!res.ok) {\n\t\t\t\tlocal = wasFollowing; // rollback\n\t\t\t\tconst body = await res.json().catch(() => ({}));\n\t\t\t\terror = (body as { error?: string }).error ?? t('failed');\n\t\t\t\tif (isBlockedByMe(res.status, body)) say('', 'blocked');\n\t\t\t\telse if (res.status === 404) say(t(\"This account isn't available.\"));\n\t\t\t\telse say(wasFollowing ? t(\"Couldn't unfollow. Try again.\") : t(\"Couldn't follow. Try again.\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst body = (await res.json()) as {\n\t\t\t\tfollowing: boolean;\n\t\t\t\tcounts: { followers: number; following: number };\n\t\t\t};\n\t\t\tlocal = body.following;\n\t\t\tsetFollowState(targetUserId, body.following);\n\t\t\toncountschange?.(body.counts);\n\t\t\tonchange?.(body.following);\n\t\t\t// Not over a reel: its next clip is the reel itself.\n\t\t\tif (body.following && !wasFollowing) {\n\t\t\t\tif (hint && variant !== 'overlay' && takeFollowHint()) {\n\t\t\t\t\tsay('', 'hint');\n\t\t\t\t\ttrackFollowHintShown(source);\n\t\t\t\t}\n\t\t\t} else if (toast?.kind === 'hint') toast = null;\n\t\t\t// RAT-182: rater-flow follow funnel. Only on the not-following → following\n\t\t\t// edge, only when source is rater-flow specific (rater_profile / post_session).\n\t\t\t// Generic profile follows already have trackProfileFollow elsewhere.\n\t\t\tif (\n\t\t\t\t!wasFollowing &&\n\t\t\t\tbody.following &&\n\t\t\t\t(source === 'rater_profile' || source === 'post_session')\n\t\t\t) {\n\t\t\t\ttrackRaterFollowed({\n\t\t\t\t\traterUserId: targetUserId,\n\t\t\t\t\tsource\n\t\t\t\t});\n\t\t\t}\n\t\t} catch {\n\t\t\tlocal = wasFollowing;\n\t\t\terror = t('network');\n\t\t\tsay(t('No connection. Try again.'));\n\t\t} finally {\n\t\t\tpending = false;\n\t\t}\n\t}\n\n\tconst label = $derived(\n\t\tpending\n\t\t\t? following\n\t\t\t\t? t('following…')\n\t\t\t\t: t('following…')\n\t\t\t: following\n\t\t\t\t? hovered\n\t\t\t\t\t? t('unfollow')\n\t\t\t\t\t: t('following')\n\t\t\t\t: followsYou\n\t\t\t\t\t? t('follow back')\n\t\t\t\t\t: t('follow')\n\t);\n</script>\n\n<!-- RAT-657: the click stays on the button — a feed card or a reel around it\n\t must not also navigate or toggle mute. -->\n<button\n\ttype=\"button\"\n\tonclick={(e) => {\n\t\te.stopPropagation();\n\t\ttoggle();\n\t}}\n\tonpointerenter={(e) => (hovered = e.pointerType === 'mouse')}\n\tonpointerleave={() => (hovered = false)}\n\tdisabled={pending}\n\taria-pressed={following}\n\tdata-no-card-nav\n\tclass=\"shrink-0 cursor-pointer font-semibold transition-all disabled:cursor-wait disabled:opacity-70\n\t\t{variant === 'compact'\n\t\t\t? `rounded-full px-3 py-1 text-[12px] ${following ? 'border border-border bg-transparent text-muted' : 'border border-accent bg-accent text-bg hover:bg-accent/85'}`\n\t\t\t: variant === 'overlay'\n\t\t\t\t? `rounded-full px-3 py-1 text-[12px] ${following ? 'border border-white/50 bg-transparent text-white' : 'border border-white bg-white text-black'}`\n\t\t\t\t: `rounded-lg px-5 py-2 text-sm ${following ? (hovered ? 'border border-accent/40 bg-transparent text-accent' : 'border border-border bg-surface text-text hover:border-muted') : 'border border-accent bg-accent text-bg hover:bg-accent/85'}`}\"\n\ttitle={error || undefined}\n>\n\t{label}\n</button>\n\n{#if toast}\n\t<div class=\"fb-toast\" role=\"status\" data-no-card-nav>\n\t\t{#if toast.kind === 'blocked'}\n\t\t\t<BlockedByMeNote {nickname} userId={targetUserId} alert={false} class=\"fb-note\" />\n\t\t{:else if toast.kind === 'hint'}\n\t\t\t<span>{t('their posts are in your feed, under Following.')}</span>\n\t\t\t<a\n\t\t\t\tclass=\"fb-link\"\n\t\t\t\thref=\"/f?tab=following\"\n\t\t\t\tonclick={(e) => {\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\ttrackFollowHintClicked(source);\n\t\t\t\t}}>{t('show their posts')}</a\n\t\t\t>\n\t\t{:else}\n\t\t\t{toast.text}\n\t\t{/if}\n\t</div>\n{/if}\n\n<style>\n\t/* the site toast's look (realtime/Toast.svelte): above the bottom nav (68px), under the\n\t   navbar from 768px */\n\t.fb-toast {\n\t\tposition: fixed;\n\t\tleft: 50%;\n\t\tbottom: calc(env(safe-area-inset-bottom, 0px) + 78px);\n\t\ttransform: translateX(-50%);\n\t\tz-index: 1000;\n\t\twidth: max-content;\n\t\tmax-width: min(360px, calc(100vw - 32px));\n\t\tmin-height: 48px;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tpadding: 10px 16px;\n\t\tborder-radius: 14px;\n\t\tborder: 1px solid var(--color-border);\n\t\tbackground: var(--color-surface);\n\t\tbox-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);\n\t\tfont-size: 13.5px;\n\t\tcolor: var(--color-text);\n\t\ttext-align: left;\n\t}\n\t.fb-link {\n\t\tflex-shrink: 0;\n\t\tmargin-left: 14px;\n\t\tfont-weight: 600;\n\t\tcolor: var(--color-text);\n\t\ttext-decoration: underline;\n\t\ttext-underline-offset: 3px;\n\t}\n\t.fb-toast :global(.fb-note) {\n\t\tmargin: 0;\n\t\tfont-size: 13.5px;\n\t\tcolor: var(--color-text);\n\t}\n\t@media (min-width: 768px) {\n\t\t.fb-toast {\n\t\t\tbottom: auto;\n\t\t\ttop: calc(env(safe-area-inset-top, 0px) + 76px);\n\t\t}\n\t}\n</style>\n"],"version":3}