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AAuL,GAEStD,EAAU,YAWnBuD,GAAA,IAAA7P,EAEgB+J,GAAe,EAAI,CAAA,EAmBnC1F,EAAA,QAAA0L,GAES9O,EAAM,eAnQZ","names":["TIERS","tierCls","tier","t","title","$.state","caption","candidates","$.proxy","loading","loadError","placed","posting","error","pickerSelection","sheetTier","search","captionEl","mentionOpen","mentionQuery","mentionCandidates","mentionLoadKicked","byId","$.derived","$.get","c","tierByUserId","p","filtered","hasNiche","submittable","onMount","cancelled","res","j","$.set","openSheet","closeSheet","toggleInTier","userId","current","removePlaced","refreshMentionState","q","mentionQueryAtCaret","loadMentionCandidates","pickMention","nickname","r","spliceMention","tick","entriesForTier","submit","requireAge","page","positionByTier","entries","position","body","$$props","AGE_REQUIRED","openAgeGate","handleBackdrop","e","handleKey","div","root","div_1","$.child","header","h3","text","$.reset","button","$.sibling","input","$.remove_input_defaults","node","p_1","root_1","p_2","root_2","$$render","consequent_1","div_2","$$anchor","rowEntries","div_3","root_3","div_4","text_3","button_1","node_1","$.each","span","root_5","node_3","getAvatarUrl","DuelAvatar","span_1","$.set_attribute","$0","$.set_text","text_4","$.delegated","$.append","consequent_2","span_2","root_6","$.template_effect","text_5","consequent_3","textarea","$.remove_textarea_child","$$value","p_3","div_5","NichePicker","n","span_3","root_8","button_2","node_5","text_7","p_4","root_9","consequent_5","node_7","MentionAutocomplete","currentTier","div_6","root_10","div_7","header_1","span_4","text_9","h4","button_3","div_8","input_1","div_9","p_5","root_11","text_11","p_6","root_12","node_10","placedTier","button_4","root_14","node_11","span_5","span_6","root_15","span_7","root_16","text_14","$.set_class","$1","span_8","root_17","consequent_8","consequent_9","alternate_1","text_13","consequent_6","consequent_7","alternate_2","$3","$4","$.transition","fly","consequent_10","$2","$5","$6","$$args","autofocus","framed","extraSelection1","extraSelection2","pickExtra","slot","linkUrl","linkOpen","file","filePreviewUrl","extraFiles","MAX_IMAGES","dragOver","uploading","progress","nudgeOpen","nudgeCode","tierlistOpen","textareaEl","ACCEPT_IMAGE","ACCEPT_IMAGE_PICKER","ACCEPT_VIDEO","MAX_IMAGE","MAX_VIDEO","MAX_VIDEO_DUR","imageInput","videoInput","fileKind","hasContent","viewerNickname","viewerAvatarPath","reset","clearFile","autosize","x","removeExtra","i","_","idx","autofocusFired","$.user_effect","CAPTION_IDEAS","useCaptionIdea","idea","handleFile","f","detachIfImage","isHeic","heicToJpeg","fail","pickFailure","analytics.trackUploadFail","isImage","isVideo","pickImage","pickVideo","toggleLink","onDrop","readImageDimensions","resolve","url","img","readVideoMeta","v","canvas","ctx","b","uploadToSigned","mimeType","size","purpose","bytes","urlRes","path","signedUrl","putRes","sharedCode","extractDuelCode","clean","stripExifClient","dims","extraMedia","cleanX","dimsX","pathX","meta","mediaPath","posterPath","extraIds","invalidateAll","stale","isStaleFileError","section","$.first_child","fragment","text_1","d","fragment_1","img_1","root_4","video","alternate","root_7","img_2","consequent_4","input_2","node_8","div_10","div_11","button_5","button_6","button_7","div_12","button_8","node_12","node_13","consequent_11","node_14","DuelFeatureNudge","consequent_12","node_15","TierListComposerDialog","consequent_13","$7","$8","$.event"],"sources":["../../../../../../src/lib/components/post/TierListComposerDialog.svelte","../../../../../../src/lib/components/post/PostComposer.svelte"],"sourcesContent":["<script lang=\"ts\">\n\timport { t } from '$lib/i18n';\n\t// Tier list composer: rank people you follow into S–D tiers, post to feed.\n\t// Opened from PostComposer's \"tier list\" action. Interaction: tap a tier ROW\n\t// → a bottom sheet slides up with search + the people you follow; tapping a\n\t// person toggles them into that tier (tapping someone already placed\n\t// elsewhere moves them). Tap a placed chip in a row to remove directly.\n\timport { onMount, tick } from 'svelte';\n\timport { fly } from 'svelte/transition';\n\timport DuelAvatar from '$lib/components/duel/DuelAvatar.svelte';\n\timport MentionAutocomplete from '$lib/components/chat/MentionAutocomplete.svelte';\n\timport NichePicker from '$lib/components/post/NichePicker.svelte';\n\timport { getAvatarUrl } from '$lib/avatar';\n\timport { page } from '$app/state';\n\timport { requireAge, openAgeGate } from '$lib/stores/ageGate';\n\timport { AGE_REQUIRED } from '$lib/age-gate';\n\timport {\n\t\tmentionQueryAtCaret,\n\t\tspliceMention,\n\t\tloadMentionCandidates,\n\t\ttype MentionCandidate\n\t} from '$lib/mention-typeahead';\n\timport type { NicheOption } from '$lib/types/niche';\n\n\ttype Tier = 'S' | 'A' | 'B' | 'C' | 'D';\n\ttype Candidate = { userId: string; nickname: string; avatarPath: string | null };\n\n\tinterface Props {\n\t\tnicheContext?: { id: string; slug: string; name: string };\n\t\tclanContext?: { id: string; tag: string; name: string };\n\t\tonclose: () => void;\n\t\t/** Fired after a successful post — parent refreshes the feed + closes. */\n\t\tonposted: () => void;\n\t}\n\tlet { nicheContext, clanContext, onclose, onposted }: Props = $props();\n\n\tconst TIERS: { key: Tier; cls: string }[] = [\n\t\t{ key: 'S', cls: 'bg-coral' },\n\t\t{ key: 'A', cls: 'bg-orange' },\n\t\t{ key: 'B', cls: 'bg-yellow' },\n\t\t{ key: 'C', cls: 'bg-green' },\n\t\t{ key: 'D', cls: 'bg-blue' }\n\t];\n\tconst tierCls = (tier: Tier) => TIERS.find((t) => t.key === tier)?.cls ?? 'bg-surface-2';\n\n\tlet title = $state('');\n\tlet caption = $state('');\n\tlet candidates = $state<Candidate[]>([]);\n\tlet loading = $state(true);\n\tlet loadError = $state('');\n\tlet placed = $state<{ userId: string; tier: Tier }[]>([]);\n\tlet posting = $state(false);\n\tlet error = $state('');\n\tlet pickerSelection = $state<NicheOption | null>(null);\n\t// Which tier's picker sheet is open (null = closed).\n\tlet sheetTier = $state<Tier | null>(null);\n\tlet search = $state('');\n\t// @-mention typeahead on the caption. Candidates = viewer's followers\n\t// (that's who a mention notifies), NOT the tier candidates (following).\n\tlet captionEl = $state<HTMLTextAreaElement | null>(null);\n\tlet mentionOpen = $state(false);\n\tlet mentionQuery = $state('');\n\tlet mentionCandidates = $state<MentionCandidate[]>([]);\n\tlet mentionLoadKicked = false;\n\n\tconst byId = $derived(new Map(candidates.map((c) => [c.userId, c])));\n\tconst tierByUserId = $derived(new Map(placed.map((p) => [p.userId, p.tier])));\n\tconst filtered = $derived(\n\t\tcandidates.filter((c) => c.nickname.toLowerCase().includes(search.trim().toLowerCase()))\n\t);\n\tconst hasNiche = $derived(!!nicheContext || !!clanContext || !!pickerSelection);\n\tconst submittable = $derived(\n\t\t!posting && title.trim().length > 0 && placed.length > 0 && hasNiche\n\t);\n\n\tonMount(() => {\n\t\tlet cancelled = false;\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tconst res = await fetch('/api/post/tier-candidates');\n\t\t\t\tif (!res.ok) throw new Error('failed');\n\t\t\t\tconst j = (await res.json()) as { candidates: Candidate[] };\n\t\t\t\tif (!cancelled) candidates = j.candidates;\n\t\t\t} catch {\n\t\t\t\tif (!cancelled) loadError = t('could not load the people you follow — try again');\n\t\t\t} finally {\n\t\t\t\tif (!cancelled) loading = false;\n\t\t\t}\n\t\t})();\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t};\n\t});\n\n\tfunction openSheet(tier: Tier) {\n\t\tsheetTier = tier;\n\t\tsearch = '';\n\t}\n\tfunction closeSheet() {\n\t\tsheetTier = null;\n\t}\n\n\t/** Sheet tap: toggle membership in the sheet's tier. Someone placed in\n\t *  another tier gets MOVED here (their old row entry is replaced). */\n\tfunction toggleInTier(userId: string, tier: Tier) {\n\t\tconst current = tierByUserId.get(userId);\n\t\tif (current === tier) {\n\t\t\tplaced = placed.filter((p) => p.userId !== userId);\n\t\t} else if (current) {\n\t\t\tplaced = placed.map((p) => (p.userId === userId ? { ...p, tier } : p));\n\t\t} else {\n\t\t\tplaced = [...placed, { userId, tier }];\n\t\t}\n\t}\n\n\tfunction removePlaced(userId: string) {\n\t\tplaced = placed.filter((p) => p.userId !== userId);\n\t}\n\n\tfunction refreshMentionState() {\n\t\tconst q = mentionQueryAtCaret(caption, captionEl);\n\t\tif (q === null) {\n\t\t\tmentionOpen = false;\n\t\t\treturn;\n\t\t}\n\t\tmentionQuery = q;\n\t\tmentionOpen = true;\n\t\tif (!mentionLoadKicked) {\n\t\t\tmentionLoadKicked = true;\n\t\t\tloadMentionCandidates().then((c) => (mentionCandidates = c));\n\t\t}\n\t}\n\n\tfunction pickMention(nickname: string) {\n\t\tconst r = spliceMention(caption, captionEl, nickname);\n\t\tcaption = r.text;\n\t\tmentionOpen = false;\n\t\ttick().then(() => {\n\t\t\tcaptionEl?.focus();\n\t\t\tcaptionEl?.setSelectionRange(r.caret, r.caret);\n\t\t});\n\t}\n\n\tfunction entriesForTier(tier: Tier) {\n\t\treturn placed.filter((p) => p.tier === tier);\n\t}\n\n\tasync function submit() {\n\t\tif (!hasNiche && title.trim() && placed.length > 0) {\n\t\t\terror = t('pick a niche first');\n\t\t\treturn;\n\t\t}\n\t\tif (!submittable) return;\n\t\t// RAT-641: a feed post is in front of others, so the age check comes first.\n\t\tif (!requireAge(page.data, { surface: 'publish_post', mode: 'publish', onPass: () => void submit() }))\n\t\t\treturn;\n\t\tposting = true;\n\t\terror = '';\n\t\ttry {\n\t\t\tconst positionByTier: Record<string, number> = {};\n\t\t\tconst entries = placed.map((p) => {\n\t\t\t\tconst position = positionByTier[p.tier] ?? 0;\n\t\t\t\tpositionByTier[p.tier] = position + 1;\n\t\t\t\treturn { userId: p.userId, tier: p.tier, position };\n\t\t\t});\n\t\t\tconst body: Record<string, unknown> = {\n\t\t\t\tkind: 'tierlist',\n\t\t\t\ttitle: title.trim(),\n\t\t\t\tcaption: caption.trim() || null,\n\t\t\t\tentries\n\t\t\t};\n\t\t\tif (nicheContext) body.nicheId = nicheContext.id;\n\t\t\telse if (pickerSelection) body.nicheId = pickerSelection.id;\n\t\t\tif (clanContext) body.clanId = clanContext.id;\n\t\t\tconst res = await fetch('/api/post/create', {\n\t\t\t\tmethod: 'POST',\n\t\t\t\theaders: { 'content-type': 'application/json' },\n\t\t\t\tbody: JSON.stringify(body)\n\t\t\t});\n\t\t\tconst j = await res.json();\n\t\t\tif (!res.ok) {\n\t\t\t\tif (res.status === 403 && j.error === AGE_REQUIRED) {\n\t\t\t\t\topenAgeGate({ surface: 'publish_post', mode: 'publish', onPass: () => void submit() });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\terror = j.error ?? t('failed to post');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonposted();\n\t\t} catch {\n\t\t\terror = t('something broke — try again');\n\t\t} finally {\n\t\t\tposting = false;\n\t\t}\n\t}\n\n\tfunction handleBackdrop(e: MouseEvent) {\n\t\tif (e.target === e.currentTarget) onclose();\n\t}\n\tfunction handleKey(e: KeyboardEvent) {\n\t\tif (e.key === 'Escape') {\n\t\t\tif (mentionOpen) mentionOpen = false;\n\t\t\telse if (sheetTier) closeSheet();\n\t\t\telse onclose();\n\t\t}\n\t}\n</script>\n\n<!-- Full-screen takeover on mobile (the centered card squished between the\n\t banner + bottom nav); centered card from sm up. z-[215]: above all site\n\t chrome (nav band is 90–110, PostToFeedCta 210) but BELOW NichePicker's\n\t fullscreen sheet (220) — the picker opens from inside this dialog and has\n\t to land on top of it. MentionAutocomplete (250) also clears us. -->\n<div\n\tclass=\"fixed inset-0 z-[215] flex items-stretch justify-center bg-black/60 sm:items-center sm:p-4 sm:pb-[calc(1rem+env(safe-area-inset-bottom,0px))]\"\n\trole=\"dialog\"\n\taria-modal=\"true\"\n\taria-labelledby=\"tierlist-title\"\n\ttabindex=\"-1\"\n\tonclick={handleBackdrop}\n\tonkeydown={handleKey}\n>\n\t<div\n\t\tclass=\"h-full w-full overflow-y-auto bg-bg p-5 pb-[calc(1.25rem+env(safe-area-inset-bottom,0px))] shadow-2xl sm:h-auto sm:max-h-[calc(100dvh-2rem)] sm:max-w-md sm:rounded-2xl sm:border sm:border-border sm:pb-5\"\n\t>\n\t\t<header class=\"flex items-center justify-between\">\n\t\t\t<h3\n\t\t\t\tid=\"tierlist-title\"\n\t\t\t\tclass=\"font-display text-[17px] font-semibold tracking-tight text-text\"\n\t\t\t>\n\t\t\t\t{t('New tier list')}\n\t\t\t</h3>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"rounded-lg px-1.5 text-2xl leading-none text-muted transition-colors hover:bg-surface hover:text-text\"\n\t\t\t\taria-label={t('close')}\n\t\t\t\tonclick={onclose}\n\t\t\t>\n\t\t\t\t×\n\t\t\t</button>\n\t\t</header>\n\n\t\t<input\n\t\t\ttype=\"text\"\n\t\t\tbind:value={title}\n\t\t\tmaxlength=\"80\"\n\t\t\tplaceholder={t('Name your list')}\n\t\t\tdisabled={posting}\n\t\t\tclass=\"mt-3 block w-full border-0 border-b border-border bg-transparent px-0 pb-2 font-display text-lg font-bold tracking-tight text-text placeholder:text-muted/40 focus:border-accent focus:ring-0 focus:outline-none disabled:opacity-50\"\n\t\t/>\n\n\t\t{#if loadError}\n\t\t\t<p class=\"mt-3 text-xs text-red-400\">{loadError}</p>\n\t\t{:else if !loading && candidates.length === 0}\n\t\t\t<p class=\"mt-3 text-xs text-muted\">{t(\"you don't follow anyone yet — follow people to rank them.\")}</p>\n\t\t{/if}\n\n\t\t<div class=\"mt-3 flex flex-col gap-0.5\">\n\t\t\t{#each TIERS as tier (tier.key)}\n\t\t\t\t{@const rowEntries = entriesForTier(tier.key)}\n\t\t\t\t<div class=\"grid grid-cols-[40px_1fr] gap-0.5\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"flex min-h-[64px] items-center justify-center rounded-l-lg {tier.cls} font-display text-lg font-bold text-bg\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{tier.key}\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclass=\"flex flex-wrap content-center items-center gap-2 rounded-r-lg bg-surface-2 p-2 text-left transition-colors hover:bg-surface\"\n\t\t\t\t\t\taria-label={t('add people to {tier} tier', { tier: tier.key })}\n\t\t\t\t\t\tonclick={() => openSheet(tier.key)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{#each rowEntries as p (p.userId)}\n\t\t\t\t\t\t\t{@const c = byId.get(p.userId)}\n\t\t\t\t\t\t\t{#if c}\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tclass=\"flex w-14 flex-col items-center gap-1\"\n\t\t\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t\t\t\ttitle={t('remove @{name}', { name: c.nickname })}\n\t\t\t\t\t\t\t\t\tonclick={(e) => {\n\t\t\t\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t\t\t\t\tremovePlaced(p.userId);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonkeydown={(e) => {\n\t\t\t\t\t\t\t\t\t\tif (e.key === 'Enter' || e.key === ' ') {\n\t\t\t\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tremovePlaced(p.userId);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<DuelAvatar\n\t\t\t\t\t\t\t\t\t\tnickname={c.nickname}\n\t\t\t\t\t\t\t\t\t\tavatarUrl={getAvatarUrl(c.avatarPath)}\n\t\t\t\t\t\t\t\t\t\tsize={40}\n\t\t\t\t\t\t\t\t\t\thref=\"\"\n\t\t\t\t\t\t\t\t\t\tlink={false}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<span class=\"w-full truncate text-center text-[9px] font-semibold text-muted\"\n\t\t\t\t\t\t\t\t\t\t>{c.nickname}</span\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{/if}\n\t\t\t\t\t\t{/each}\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclass=\"flex h-10 w-10 items-center justify-center rounded-full border border-dashed border-border text-lg text-muted/60\"\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t+\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{#if rowEntries.length === 0}\n\t\t\t\t\t\t\t<span class=\"text-[11px] text-muted/50 select-none\">{t('tap to add people')}</span>\n\t\t\t\t\t\t{/if}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t{/each}\n\t\t</div>\n\n\t\t<textarea\n\t\t\tbind:this={captionEl}\n\t\t\tbind:value={caption}\n\t\t\trows=\"2\"\n\t\t\tmaxlength=\"2000\"\n\t\t\tplaceholder={t('say something about it… (optional)')}\n\t\t\tdisabled={posting}\n\t\t\toninput={refreshMentionState}\n\t\t\tonkeyup={refreshMentionState}\n\t\t\tonclick={refreshMentionState}\n\t\t\tclass=\"mt-4 block w-full resize-none rounded-lg border border-border bg-surface px-3 py-2 text-sm text-text placeholder:text-muted/40 focus:border-accent focus:ring-0 focus:outline-none disabled:opacity-50\"\n\t\t></textarea>\n\n\t\t<p class=\"mt-2 text-[11px] text-muted/70\">\n\t\t\t{placed.length > 0\n\t\t\t\t? placed.length === 1\n\t\t\t\t\t? t('you can only rank people you follow. 1 person will get notified.')\n\t\t\t\t\t: t('you can only rank people you follow. {n} people will get notified.', { n: placed.length })\n\t\t\t\t: t('you can only rank people you follow. everyone you rank gets notified.')}\n\t\t</p>\n\n\t\t<div class=\"mt-3 flex items-center justify-between gap-2\">\n\t\t\t{#if !nicheContext && !clanContext}\n\t\t\t\t<NichePicker\n\t\t\t\t\tbind:selected={pickerSelection}\n\t\t\t\t\tonSelect={(n) => {\n\t\t\t\t\t\tpickerSelection = n;\n\t\t\t\t\t\tif (n) error = '';\n\t\t\t\t\t}}\n\t\t\t\t\tallowSkip={false}\n\t\t\t\t/>\n\t\t\t{:else}\n\t\t\t\t<span></span>\n\t\t\t{/if}\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonclick={submit}\n\t\t\t\tdisabled={posting || title.trim().length === 0 || placed.length === 0}\n\t\t\t\tclass=\"rounded-full bg-accent px-4 py-1.5 text-[13px] font-semibold text-bg transition-colors hover:bg-accent/85 disabled:cursor-not-allowed disabled:opacity-40 {title.trim() &&\n\t\t\t\tplaced.length > 0 &&\n\t\t\t\t!hasNiche\n\t\t\t\t\t? 'opacity-60'\n\t\t\t\t\t: ''}\"\n\t\t\t>\n\t\t\t\t{posting ? t('posting…') : t('post')}\n\t\t\t</button>\n\t\t</div>\n\t\t{#if error}\n\t\t\t<p class=\"mt-2 text-xs text-red-400\">{error}</p>\n\t\t{/if}\n\t</div>\n\n\t<MentionAutocomplete\n\t\topen={mentionOpen}\n\t\tquery={mentionQuery}\n\t\tcandidates={mentionCandidates}\n\t\tanchor={captionEl}\n\t\tonPick={pickMention}\n\t\tonClose={() => (mentionOpen = false)}\n\t/>\n\n\t{#if sheetTier}\n\t\t{@const currentTier = sheetTier}\n\t\t<!-- svelte-ignore a11y_no_static_element_interactions -->\n\t\t<div\n\t\t\tclass=\"absolute inset-0 z-10 flex items-end justify-center bg-black/50\"\n\t\t\tonclick={(e) => {\n\t\t\t\tif (e.target === e.currentTarget) closeSheet();\n\t\t\t}}\n\t\t\tonkeydown={(e) => {\n\t\t\t\tif (e.key === 'Escape') closeSheet();\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tclass=\"flex max-h-[70dvh] w-full max-w-md flex-col rounded-t-2xl border-x border-t border-border bg-bg shadow-2xl\"\n\t\t\t\ttransition:fly={{ y: 240, duration: 220 }}\n\t\t\t\trole=\"dialog\"\n\t\t\t\taria-label={t('add people to {tier} tier', { tier: currentTier })}\n\t\t\t>\n\t\t\t\t<header class=\"flex items-center gap-2.5 px-4 pt-4 pb-2\">\n\t\t\t\t\t<span\n\t\t\t\t\t\tclass=\"flex h-7 w-7 items-center justify-center rounded-md {tierCls(currentTier)} font-display text-sm font-bold text-bg\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{currentTier}\n\t\t\t\t\t</span>\n\t\t\t\t\t<h4 class=\"font-display text-[15px] font-semibold tracking-tight text-text\">\n\t\t\t\t\t\t{t('Add to {tier} tier', { tier: currentTier })}\n\t\t\t\t\t</h4>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclass=\"ml-auto rounded-lg px-1.5 text-2xl leading-none text-muted transition-colors hover:bg-surface hover:text-text\"\n\t\t\t\t\t\taria-label={t('done')}\n\t\t\t\t\t\tonclick={closeSheet}\n\t\t\t\t\t>\n\t\t\t\t\t\t×\n\t\t\t\t\t</button>\n\t\t\t\t</header>\n\n\t\t\t\t<div class=\"px-4 pb-2\">\n\t\t\t\t\t<input\n\t\t\t\t\t\ttype=\"search\"\n\t\t\t\t\t\tbind:value={search}\n\t\t\t\t\t\tplaceholder={t('search people you follow…')}\n\t\t\t\t\t\tclass=\"block w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-text placeholder:text-muted/40 focus:border-accent focus:ring-0 focus:outline-none\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"min-h-0 flex-1 overflow-y-auto px-2 pb-[calc(0.75rem+env(safe-area-inset-bottom,0px))]\">\n\t\t\t\t\t{#if loading}\n\t\t\t\t\t\t<p class=\"px-2 py-3 text-xs text-muted\">{t('loading…')}</p>\n\t\t\t\t\t{:else if filtered.length === 0}\n\t\t\t\t\t\t<p class=\"px-2 py-3 text-xs text-muted\">\n\t\t\t\t\t\t\t{candidates.length === 0\n\t\t\t\t\t\t\t\t? t(\"you don't follow anyone yet.\")\n\t\t\t\t\t\t\t\t: t('nobody matches that search.')}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t{:else}\n\t\t\t\t\t\t{#each filtered as c (c.userId)}\n\t\t\t\t\t\t\t{@const placedTier = tierByUserId.get(c.userId)}\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tclass=\"flex w-full items-center gap-3 rounded-xl px-2 py-2 text-left transition-colors hover:bg-surface\"\n\t\t\t\t\t\t\t\tonclick={() => toggleInTier(c.userId, currentTier)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DuelAvatar\n\t\t\t\t\t\t\t\t\tnickname={c.nickname}\n\t\t\t\t\t\t\t\t\tavatarUrl={getAvatarUrl(c.avatarPath)}\n\t\t\t\t\t\t\t\t\tsize={36}\n\t\t\t\t\t\t\t\t\thref=\"\"\n\t\t\t\t\t\t\t\t\tlink={false}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<span class=\"min-w-0 flex-1 truncate text-sm font-semibold text-text\"\n\t\t\t\t\t\t\t\t\t>{c.nickname}</span\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{#if placedTier === currentTier}\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tclass=\"flex h-6 w-6 items-center justify-center rounded-full bg-accent text-bg\"\n\t\t\t\t\t\t\t\t\t\taria-label={t('in this tier — tap to remove')}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<svg viewBox=\"0 0 24 24\" class=\"h-3.5 w-3.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t\t\t\t\t\t\t<path d=\"M5 13l4 4L19 7\" />\n\t\t\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{:else if placedTier}\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tclass=\"flex h-6 w-6 items-center justify-center rounded-md {tierCls(placedTier)} font-display text-xs font-bold text-bg\"\n\t\t\t\t\t\t\t\t\t\taria-label={t('currently in {tier} tier — tap to move here', { tier: placedTier })}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{placedTier}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{:else}\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tclass=\"flex h-6 w-6 items-center justify-center rounded-full border border-border text-muted/60\"\n\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t+\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{/if}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t{/each}\n\t\t\t\t\t{/if}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t{/if}\n</div>\n","<script lang=\"ts\">\n\timport { t } from '$lib/i18n';\n\timport { tick } from 'svelte';\n\timport { invalidateAll } from '$app/navigation';\n\timport { page } from '$app/state';\n\timport { requireAge, openAgeGate } from '$lib/stores/ageGate';\n\timport { AGE_REQUIRED } from '$lib/age-gate';\n\timport DuelAvatar from '$lib/components/duel/DuelAvatar.svelte';\n\timport MentionAutocomplete from '$lib/components/chat/MentionAutocomplete.svelte';\n\timport {\n\t\tmentionQueryAtCaret,\n\t\tspliceMention,\n\t\tloadMentionCandidates,\n\t\ttype MentionCandidate\n\t} from '$lib/mention-typeahead';\n\timport { getAvatarUrl } from '$lib/avatar';\n\timport { stripExifClient } from '$lib/utils/strip-exif-client';\n\timport { heicToJpeg, isHeic } from '$lib/utils/heic-to-jpeg';\n\timport { detachIfImage, isStaleFileError, pickFailure } from '$lib/utils/stale-file';\n\timport * as analytics from '$lib/analytics';\n\timport NichePicker from '$lib/components/post/NichePicker.svelte';\n\timport TierListComposerDialog from '$lib/components/post/TierListComposerDialog.svelte';\n\timport DuelFeatureNudge from '$lib/components/duel/DuelFeatureNudge.svelte';\n\timport { extractDuelCode } from '$lib/duel-feature';\n\timport type { NicheOption } from '$lib/types/niche';\n\n\t// RAT-269: optional niche context — when rendered on /n/[slug], the niche\n\t// id auto-tags the post so it surfaces in that niche's feed. When NOT set\n\t// (i.e. on /f home), the NichePicker lets the user pick per-post.\n\tinterface Props {\n\t\tnicheContext?: { id: string; slug: string; name: string };\n\t\t/** Clan mode: when set, the post is tagged to this clan (no niche picker). */\n\t\tclanContext?: { id: string; tag: string; name: string };\n\t\t/** Framed = rounded card on every breakpoint (the /f feed is edge-to-edge\n\t\t *  on mobile; padded surfaces like the clan feed want a rounded box). */\n\t\tframed?: boolean;\n\t\t/** RAT-272: deeplink intent. /f?compose=1 (driven by the bottom-nav\n\t\t *  + picker's \"post to feed\" entry) sets this true so the composer\n\t\t *  scrolls into view + focuses its textarea on mount. iOS Safari\n\t\t *  won't pop the on-screen keyboard from a programmatic focus that\n\t\t *  happens after a navigation (user activation is lost across the\n\t\t *  hop), but the scroll-and-cursor-ready state still saves the user\n\t\t *  one tap. */\n\t\tautofocus?: boolean;\n\t}\n\tlet { nicheContext, clanContext, autofocus = false, framed = false }: Props = $props();\n\n\t// RAT-270: NichePicker selection state — only used on /f home (when\n\t// nicheContext is not supplied). The pill renders in the bottom button row.\n\tlet pickerSelection = $state<NicheOption | null>(null);\n\t// Multi-niche: up to 2 extra tags beyond the primary. Two explicit slots\n\t// rather than an array — each renders its own bindable NichePicker pill,\n\t// and the second only appears once the first is filled.\n\tlet extraSelection1 = $state<NicheOption | null>(null);\n\tlet extraSelection2 = $state<NicheOption | null>(null);\n\n\tfunction pickExtra(slot: 1 | 2, n: NicheOption | null) {\n\t\tif (n) {\n\t\t\tconst chosen = [\n\t\t\t\tnicheContext?.id,\n\t\t\t\tpickerSelection?.id,\n\t\t\t\tslot === 1 ? extraSelection2?.id : extraSelection1?.id\n\t\t\t];\n\t\t\tif (chosen.includes(n.id)) {\n\t\t\t\t// bind:selected already wrote the dup into the slot — undo it.\n\t\t\t\tif (slot === 1) extraSelection1 = null;\n\t\t\t\telse extraSelection2 = null;\n\t\t\t\terror = t('already tagged in that niche');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\terror = '';\n\t\t}\n\t\tif (slot === 1) extraSelection1 = n;\n\t\telse extraSelection2 = n;\n\t}\n\n\tlet caption = $state('');\n\tlet linkUrl = $state('');\n\tlet linkOpen = $state(false);\n\tlet file = $state<File | null>(null);\n\tlet filePreviewUrl = $state<string | null>(null);\n\t// Multi-pic: up to 3 extra photos beyond the cover (`file`). Images only —\n\t// picking a video replaces the whole selection.\n\tlet extraFiles = $state<{ file: File; previewUrl: string }[]>([]);\n\tconst MAX_IMAGES = 4;\n\tlet dragOver = $state(false);\n\tlet uploading = $state(false);\n\tlet progress = $state<string>('');\n\tlet error = $state('');\n\t// Duel-link nudge: a duel link in a post is redirected to the board (or reddit)\n\t// instead of being posted — same anti-spam intercept as the group chat.\n\tlet nudgeOpen = $state(false);\n\tlet nudgeCode = $state('');\n\t// Tier list composer dialog — separate posting path from the inline flow.\n\tlet tierlistOpen = $state(false);\n\tlet textareaEl: HTMLTextAreaElement | null = $state(null);\n\n\tconst ACCEPT_IMAGE = 'image/jpeg,image/png,image/webp';\n\tconst ACCEPT_IMAGE_PICKER = 'image/jpeg,image/png,image/webp,image/heic,image/heif,.heic,.heif';\n\t// RAT-269: include video/quicktime (.mov) for iPhone uploads.\n\tconst ACCEPT_VIDEO = 'video/mp4,video/webm,video/quicktime';\n\tconst MAX_IMAGE = 10 * 1024 * 1024;\n\tconst MAX_VIDEO = 200 * 1024 * 1024;\n\tconst MAX_VIDEO_DUR = 300;\n\n\tlet imageInput: HTMLInputElement | null = $state(null);\n\tlet videoInput: HTMLInputElement | null = $state(null);\n\n\tconst fileKind = $derived(file ? (file.type.startsWith('video/') ? 'video' : 'image') : null);\n\t// A niche is REQUIRED for feed posts (product call: every post should land\n\t// in a niche feed so it actually reaches people — most posters have thin\n\t// follower graphs, an untagged post is near-invisible). The old dead-end\n\t// (picker offered \"skip\" while this gate refused it) is fixed the other way\n\t// around: the composer's picker hides the skip affordance (allowSkip=false).\n\t// Clan posts are exempt — the clan is their posting context.\n\tconst hasContent = $derived(\n\t\t!!file || (linkOpen && linkUrl.trim().length > 0) || caption.trim().length > 0\n\t);\n\tconst hasNiche = $derived(!!nicheContext || !!pickerSelection || !!clanContext);\n\tconst submittable = $derived(!uploading && hasContent && hasNiche);\n\n\t// /f supplies viewerNickname/viewerAvatarPath; elsewhere (e.g. the clan feed)\n\t// fall back to the root layout's nickname/avatarPath so the avatar still shows.\n\tconst viewerNickname = $derived(\n\t\t(page.data.viewerNickname as string | null) ?? (page.data.nickname as string | null) ?? null\n\t);\n\tconst viewerAvatarPath = $derived(\n\t\t(page.data.viewerAvatarPath as string | null) ?? (page.data.avatarPath as string | null) ?? null\n\t);\n\n\tfunction reset() {\n\t\tcaption = '';\n\t\tlinkUrl = '';\n\t\tlinkOpen = false;\n\t\tclearFile();\n\t\tprogress = '';\n\t\terror = '';\n\t\t// RAT-270: clear niche pick on /f home reset (no-op on niche page,\n\t\t// where nicheContext is the locked source of truth).\n\t\tif (!nicheContext) pickerSelection = null;\n\t\textraSelection1 = null;\n\t\textraSelection2 = null;\n\t\tautosize();\n\t}\n\n\tfunction clearFile() {\n\t\tif (filePreviewUrl) URL.revokeObjectURL(filePreviewUrl);\n\t\tfilePreviewUrl = null;\n\t\tfile = null;\n\t\tfor (const x of extraFiles) URL.revokeObjectURL(x.previewUrl);\n\t\textraFiles = [];\n\t\tif (imageInput) imageInput.value = '';\n\t\tif (videoInput) videoInput.value = '';\n\t}\n\n\tfunction removeExtra(i: number) {\n\t\tURL.revokeObjectURL(extraFiles[i].previewUrl);\n\t\textraFiles = extraFiles.filter((_, idx) => idx !== i);\n\t}\n\n\t// RAT-272 / RAT-294 follow-up: when the composer is asked to grab focus\n\t// (autofocus=true, triggered by /f?compose=1 from the bottom-nav +\n\t// picker), focus the textarea once it's mounted. The feed page owns the\n\t// scroll-to-top — focusing here with preventScroll:true keeps the parent\n\t// in control instead of fighting it with our own scrollIntoView (which\n\t// previously parked the composer at the top and pushed live raters +\n\t// stories off-screen). Wrapped in a one-shot guard so SvelteKit re-\n\t// running this effect on invalidate doesn't re-focus mid-feed.\n\tlet autofocusFired = false;\n\t$effect(() => {\n\t\tif (!autofocus || autofocusFired || !textareaEl) return;\n\t\tautofocusFired = true;\n\t\t// rAF gives the layout a tick to settle (the StoryRail + recommended\n\t\t// rail may still be mounting) before the focus lands.\n\t\trequestAnimationFrame(() => {\n\t\t\ttextareaEl?.focus({ preventScroll: true });\n\t\t});\n\t});\n\n\tfunction autosize() {\n\t\tif (!textareaEl) return;\n\t\ttextareaEl.style.height = 'auto';\n\t\ttextareaEl.style.height = textareaEl.scrollHeight + 'px';\n\t}\n\n\t// RAT-663: a photo or clip with an empty caption gets a few lines to start\n\t// from. Hand-made posts with a caption got a comment 48–51% of the time,\n\t// without one 23% (2026-10-27..11-24, n=708) — and 32% went out without.\n\tconst CAPTION_IDEAS = ['rate me 1–10?', 'be honest 👀', 'first post here 👋', 'thoughts?'] as const;\n\tfunction useCaptionIdea(idea: (typeof CAPTION_IDEAS)[number]) {\n\t\tcaption = t(idea);\n\t\trequestAnimationFrame(() => {\n\t\t\tautosize();\n\t\t\ttextareaEl?.focus();\n\t\t});\n\t}\n\n\t// @-mention typeahead on the caption (Telegram-style). Candidates =\n\t// viewer's followers, lazily loaded on the first `@`, cached page-wide.\n\tlet mentionOpen = $state(false);\n\tlet mentionQuery = $state('');\n\tlet mentionCandidates = $state<MentionCandidate[]>([]);\n\tlet mentionLoadKicked = false;\n\n\tfunction refreshMentionState() {\n\t\tconst q = mentionQueryAtCaret(caption, textareaEl);\n\t\tif (q === null) {\n\t\t\tmentionOpen = false;\n\t\t\treturn;\n\t\t}\n\t\tmentionQuery = q;\n\t\tmentionOpen = true;\n\t\tif (!mentionLoadKicked) {\n\t\t\tmentionLoadKicked = true;\n\t\t\tloadMentionCandidates().then((c) => (mentionCandidates = c));\n\t\t}\n\t}\n\n\tfunction pickMention(nickname: string) {\n\t\tconst r = spliceMention(caption, textareaEl, nickname);\n\t\tcaption = r.text;\n\t\tmentionOpen = false;\n\t\tautosize();\n\t\ttick().then(() => {\n\t\t\ttextareaEl?.focus();\n\t\t\ttextareaEl?.setSelectionRange(r.caret, r.caret);\n\t\t});\n\t}\n\n\tasync function handleFile(f: File) {\n\t\terror = '';\n\t\t// Read the bytes at pick time so the OS handle can't die while the user is\n\t\t// off in the login flow — photos only. This composer accepts video up to\n\t\t// 200 MB and any file at all reaches here before the allowlist below runs,\n\t\t// so an unguarded read would pull a mislabelled 2 GB file into memory just\n\t\t// to then reject it (see $lib/utils/stale-file). A file that can't be read\n\t\t// at all throws in these reads — said, not dropped (see pickFailure).\n\t\ttry {\n\t\t\tf = await detachIfImage(f);\n\t\t\t// HEIC pre-pass — convert before MIME validation so iPhone uploads land\n\t\t\t// as JPEG and the strict allowlist below stays narrow.\n\t\t\tif (await isHeic(f)) {\n\t\t\t\terror = t('converting heic photo…');\n\t\t\t\tf = await heicToJpeg(f);\n\t\t\t\terror = '';\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconst fail = pickFailure(e);\n\t\t\tanalytics.trackUploadFail({ error: fail.error, context: 'feed_pick', stale: fail.stale });\n\t\t\terror = fail.message;\n\t\t\treturn;\n\t\t}\n\t\tconst isImage = ACCEPT_IMAGE.split(',').includes(f.type);\n\t\tconst isVideo = ACCEPT_VIDEO.split(',').includes(f.type);\n\t\tif (!isImage && !isVideo) {\n\t\t\terror = t('use jpeg/png/webp or mp4/webm');\n\t\t\treturn;\n\t\t}\n\t\tif (isImage && f.size > MAX_IMAGE) {\n\t\t\terror = t('image too large (10MB max)');\n\t\t\treturn;\n\t\t}\n\t\tif (isVideo && f.size > MAX_VIDEO) {\n\t\t\terror = t('video too large (200MB max)');\n\t\t\treturn;\n\t\t}\n\t\t// Multi-pic: an image picked while an image cover already exists appends\n\t\t// as an extra instead of replacing — up to 4 photos total. A video pick\n\t\t// still replaces the whole selection below.\n\t\tif (isImage && file && fileKind === 'image') {\n\t\t\tif (1 + extraFiles.length >= MAX_IMAGES) {\n\t\t\t\terror = t('up to {n} photos per post', { n: MAX_IMAGES });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\textraFiles = [...extraFiles, { file: f, previewUrl: URL.createObjectURL(f) }];\n\t\t\treturn;\n\t\t}\n\t\tlinkOpen = false;\n\t\tlinkUrl = '';\n\t\tclearFile();\n\t\tfile = f;\n\t\tfilePreviewUrl = URL.createObjectURL(f);\n\t}\n\n\tfunction pickImage() {\n\t\timageInput?.click();\n\t}\n\tfunction pickVideo() {\n\t\tvideoInput?.click();\n\t}\n\tfunction toggleLink() {\n\t\tif (file) clearFile();\n\t\tlinkOpen = !linkOpen;\n\t\tif (!linkOpen) linkUrl = '';\n\t}\n\n\tasync function onDrop(e: DragEvent) {\n\t\te.preventDefault();\n\t\tdragOver = false;\n\t\t// Sequential so the first file becomes the cover and the rest append.\n\t\tfor (const f of Array.from(e.dataTransfer?.files ?? [])) await handleFile(f);\n\t}\n\n\tasync function readImageDimensions(f: File): Promise<{ width: number; height: number } | null> {\n\t\treturn new Promise((resolve) => {\n\t\t\tconst url = URL.createObjectURL(f);\n\t\t\tconst img = new Image();\n\t\t\timg.onload = () => {\n\t\t\t\tURL.revokeObjectURL(url);\n\t\t\t\tresolve({ width: img.naturalWidth, height: img.naturalHeight });\n\t\t\t};\n\t\t\timg.onerror = () => {\n\t\t\t\tURL.revokeObjectURL(url);\n\t\t\t\tresolve(null);\n\t\t\t};\n\t\t\timg.src = url;\n\t\t});\n\t}\n\n\tasync function readVideoMeta(\n\t\tf: File\n\t): Promise<{ width: number; height: number; durationSec: number; posterBlob: Blob | null } | null> {\n\t\treturn new Promise((resolve) => {\n\t\t\tconst url = URL.createObjectURL(f);\n\t\t\tconst v = document.createElement('video');\n\t\t\tv.preload = 'metadata';\n\t\t\tv.muted = true;\n\t\t\tv.playsInline = true;\n\t\t\tv.src = url;\n\t\t\tv.onloadedmetadata = () => {\n\t\t\t\tv.currentTime = Math.min(0.1, v.duration / 2 || 0);\n\t\t\t};\n\t\t\tv.onseeked = () => {\n\t\t\t\tconst canvas = document.createElement('canvas');\n\t\t\t\tcanvas.width = v.videoWidth;\n\t\t\t\tcanvas.height = v.videoHeight;\n\t\t\t\tconst ctx = canvas.getContext('2d');\n\t\t\t\tif (ctx) ctx.drawImage(v, 0, 0, canvas.width, canvas.height);\n\t\t\t\tcanvas.toBlob(\n\t\t\t\t\t(b) => {\n\t\t\t\t\t\tURL.revokeObjectURL(url);\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\twidth: v.videoWidth,\n\t\t\t\t\t\t\theight: v.videoHeight,\n\t\t\t\t\t\t\tdurationSec: Math.round(v.duration),\n\t\t\t\t\t\t\tposterBlob: b\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\t'image/webp',\n\t\t\t\t\t0.85\n\t\t\t\t);\n\t\t\t};\n\t\t\tv.onerror = () => {\n\t\t\t\tURL.revokeObjectURL(url);\n\t\t\t\tresolve(null);\n\t\t\t};\n\t\t});\n\t}\n\n\tasync function uploadToSigned(\n\t\tmimeType: string,\n\t\tsize: number,\n\t\tpurpose: 'media' | 'poster',\n\t\tbytes: Blob\n\t): Promise<string | null> {\n\t\tconst urlRes = await fetch('/api/post/upload-url', {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'content-type': 'application/json' },\n\t\t\tbody: JSON.stringify({ mimeType, size, purpose })\n\t\t});\n\t\tif (!urlRes.ok) {\n\t\t\tconst j = await urlRes.json().catch(() => ({}));\n\t\t\terror = j.error ?? t('upload init failed');\n\t\t\tanalytics.trackUploadFail({\n\t\t\t\terror: j.error || `upload-url ${urlRes.status}`,\n\t\t\t\tcontext: 'feed',\n\t\t\t\tstale: false\n\t\t\t});\n\t\t\treturn null;\n\t\t}\n\t\tconst { path, signedUrl } = await urlRes.json();\n\t\tconst putRes = await fetch(signedUrl, {\n\t\t\tmethod: 'PUT',\n\t\t\theaders: { 'content-type': mimeType },\n\t\t\tbody: bytes\n\t\t});\n\t\tif (!putRes.ok) {\n\t\t\terror = t('upload failed');\n\t\t\tanalytics.trackUploadFail({ error: `put ${putRes.status}`, context: 'feed', stale: false });\n\t\t\treturn null;\n\t\t}\n\t\treturn path;\n\t}\n\n\tasync function submit() {\n\t\terror = '';\n\t\t// Duel link in the caption or the link field → intercept: pop the board\n\t\t// nudge, don't post it. Sharing duel links in the feed is the same\n\t\t// opponent-hunting spam we redirect onto the board.\n\t\tconst sharedCode = extractDuelCode(`${caption} ${linkOpen ? linkUrl : ''}`);\n\t\tif (sharedCode) {\n\t\t\tnudgeCode = sharedCode;\n\t\t\tnudgeOpen = true;\n\t\t\treturn;\n\t\t}\n\t\t// Concrete reason when only the niche is missing — the disabled button\n\t\t// gives no feedback on its own.\n\t\tif (!hasNiche && hasContent && !uploading) {\n\t\t\terror = t('pick a niche first');\n\t\t\treturn;\n\t\t}\n\t\tif (!submittable) return;\n\t\t// RAT-641: posting media puts it in front of others, so the age check\n\t\t// comes first — before anything uploads. A text-only post needs none.\n\t\t// The sheet re-runs this on a pass.\n\t\tconst hasMedia = !!file || (linkOpen && !!linkUrl.trim());\n\t\tif (\n\t\t\thasMedia &&\n\t\t\t!requireAge(page.data, { surface: 'publish_post', mode: 'publish', onPass: () => void submit() })\n\t\t)\n\t\t\treturn;\n\t\tuploading = true;\n\t\ttry {\n\t\t\tlet body: Record<string, unknown>;\n\t\t\tif (file && fileKind === 'image') {\n\t\t\t\tprogress = t('uploading image…');\n\t\t\t\tconst clean = await stripExifClient(file);\n\t\t\t\tconst dims = await readImageDimensions(clean);\n\t\t\t\tconst path = await uploadToSigned(clean.type, clean.size, 'media', clean);\n\t\t\t\tif (!path) return;\n\t\t\t\t// Multi-pic extras: same strip-exif + upload pipeline per photo.\n\t\t\t\tconst extraMedia: Record<string, unknown>[] = [];\n\t\t\t\tfor (let i = 0; i < extraFiles.length; i++) {\n\t\t\t\t\tprogress = t('uploading image {i}/{n}…', { i: i + 2, n: extraFiles.length + 1 });\n\t\t\t\t\tconst cleanX = await stripExifClient(extraFiles[i].file);\n\t\t\t\t\tconst dimsX = await readImageDimensions(cleanX);\n\t\t\t\t\tconst pathX = await uploadToSigned(cleanX.type, cleanX.size, 'media', cleanX);\n\t\t\t\t\tif (!pathX) return;\n\t\t\t\t\textraMedia.push({\n\t\t\t\t\t\tmediaPath: pathX,\n\t\t\t\t\t\tmediaMime: cleanX.type,\n\t\t\t\t\t\tmediaWidth: dimsX?.width,\n\t\t\t\t\t\tmediaHeight: dimsX?.height\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tbody = {\n\t\t\t\t\tkind: 'image',\n\t\t\t\t\tmediaPath: path,\n\t\t\t\t\tmediaMime: clean.type,\n\t\t\t\t\tmediaWidth: dims?.width,\n\t\t\t\t\tmediaHeight: dims?.height,\n\t\t\t\t\tcaption,\n\t\t\t\t\t...(extraMedia.length > 0 ? { extraMedia } : {})\n\t\t\t\t};\n\t\t\t} else if (file && fileKind === 'video') {\n\t\t\t\tprogress = t('reading video…');\n\t\t\t\tconst meta = await readVideoMeta(file);\n\t\t\t\tif (meta && meta.durationSec > MAX_VIDEO_DUR) {\n\t\t\t\t\terror = t('video too long (5 min max)');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tprogress = t('uploading video…');\n\t\t\t\tconst mediaPath = await uploadToSigned(file.type, file.size, 'media', file);\n\t\t\t\tif (!mediaPath) return;\n\t\t\t\tlet posterPath: string | undefined;\n\t\t\t\tif (meta?.posterBlob) {\n\t\t\t\t\tprogress = t('uploading thumbnail…');\n\t\t\t\t\tconst p = await uploadToSigned('image/webp', meta.posterBlob.size, 'poster', meta.posterBlob);\n\t\t\t\t\tif (p) posterPath = p;\n\t\t\t\t}\n\t\t\t\tbody = {\n\t\t\t\t\tkind: 'video',\n\t\t\t\t\tmediaPath,\n\t\t\t\t\tmediaMime: file.type,\n\t\t\t\t\tmediaWidth: meta?.width,\n\t\t\t\t\tmediaHeight: meta?.height,\n\t\t\t\t\tdurationSec: meta?.durationSec,\n\t\t\t\t\tposterPath,\n\t\t\t\t\tcaption\n\t\t\t\t};\n\t\t\t} else if (linkOpen && linkUrl.trim()) {\n\t\t\t\tprogress = t('fetching link preview…');\n\t\t\t\tbody = { kind: 'link', url: linkUrl, caption };\n\t\t\t} else if (caption.trim()) {\n\t\t\t\tprogress = t('posting…');\n\t\t\t\tbody = { kind: 'text', caption };\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tprogress = progress || t('posting…');\n\t\t\t// RAT-269/270: niche tag — locked context (niche page) takes\n\t\t\t// priority; otherwise use the picker selection from /f home.\n\t\t\tif (nicheContext) body.nicheId = nicheContext.id;\n\t\t\telse if (pickerSelection) body.nicheId = pickerSelection.id;\n\t\t\t// Multi-niche extras ride alongside the primary; the server enforces\n\t\t\t// the 3-total cap + validates each id.\n\t\t\tconst extraIds = [extraSelection1, extraSelection2]\n\t\t\t\t.filter((n): n is NicheOption => !!n)\n\t\t\t\t.map((n) => n.id);\n\t\t\tif (extraIds.length > 0) body.extraNicheIds = extraIds;\n\t\t\tif (clanContext) body.clanId = clanContext.id;\n\t\t\tconst res = await fetch('/api/post/create', {\n\t\t\t\tmethod: 'POST',\n\t\t\t\theaders: { 'content-type': 'application/json' },\n\t\t\t\tbody: JSON.stringify(body)\n\t\t\t});\n\t\t\tconst j = await res.json();\n\t\t\tif (!res.ok) {\n\t\t\t\t// The page's age state was stale: open the check, not an error.\n\t\t\t\tif (res.status === 403 && j.error === AGE_REQUIRED) {\n\t\t\t\t\topenAgeGate({ surface: 'publish_post', mode: 'publish', onPass: () => void submit() });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\terror = j.error ?? t('failed');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treset();\n\t\t\tawait invalidateAll();\n\t\t} catch (e) {\n\t\t\t// A thrown failure here is almost always a dead File handle surfacing\n\t\t\t// from stripExifClient / the media readers (detachFile makes this\n\t\t\t// near-impossible now, but keep it measurable + recoverable).\n\t\t\tconst stale = isStaleFileError(e);\n\t\t\tanalytics.trackUploadFail({\n\t\t\t\terror: e instanceof Error ? `${e.name}: ${e.message}` : String(e),\n\t\t\t\tcontext: 'feed',\n\t\t\t\tstale\n\t\t\t});\n\t\t\terror = stale ? t('that photo went stale — pick it again') : t('something broke — try again');\n\t\t} finally {\n\t\t\tuploading = false;\n\t\t\tprogress = '';\n\t\t}\n\t}\n</script>\n\n<!-- svelte-ignore a11y_no_static_element_interactions -->\n<section\n\tclass=\"overflow-hidden bg-surface transition-colors {framed\n\t\t? 'rounded-2xl border border-border'\n\t\t: 'border-b border-border sm:rounded-2xl sm:border'} {dragOver ? 'border-accent' : ''}\"\n\tondragover={(e) => {\n\t\te.preventDefault();\n\t\tdragOver = true;\n\t}}\n\tondragleave={() => (dragOver = false)}\n\tondrop={onDrop}\n>\n\t<div class=\"flex gap-3 px-4 pt-3.5 pb-2\">\n\t\t<div class=\"shrink-0\">\n\t\t\t<DuelAvatar\n\t\t\tnickname={viewerNickname}\n\t\t\tavatarUrl={getAvatarUrl(viewerAvatarPath)}\n\t\t\tsize={36}\n\t\t\thref=\"\"\n\t\t\tlink={false}\n\t\t\tvariant={viewerAvatarPath ? 'auto' : 'accent'}\n\t\t/>\n\t\t</div>\n\t\t<div class=\"min-w-0 flex-1\">\n\t\t\t<textarea\n\t\t\t\tbind:this={textareaEl}\n\t\t\t\tbind:value={caption}\n\t\t\t\toninput={() => {\n\t\t\t\t\tautosize();\n\t\t\t\t\trefreshMentionState();\n\t\t\t\t}}\n\t\t\t\tonkeyup={refreshMentionState}\n\t\t\t\tonclick={refreshMentionState}\n\t\t\t\tplaceholder={clanContext\n\t\t\t\t\t? t('post to {name}…', { name: clanContext.name })\n\t\t\t\t\t: nicheContext\n\t\t\t\t\t\t? t('post to /n/{slug}…', { slug: nicheContext.slug })\n\t\t\t\t\t\t: t(\"what's on your mind?\")}\n\t\t\t\trows=\"1\"\n\t\t\t\tmaxlength=\"2000\"\n\t\t\t\tdisabled={uploading}\n\t\t\t\tclass=\"block w-full resize-none border-0 bg-transparent p-0 text-[15px] leading-snug text-text shadow-none ring-0 outline-none placeholder:text-muted/60 focus:border-0 focus:ring-0 focus:outline-none disabled:opacity-50\"\n\t\t\t></textarea>\n\n\t\t\t{#if file && !caption.trim() && !uploading}\n\t\t\t\t<div class=\"mt-2\">\n\t\t\t\t\t<p class=\"text-[11px] text-muted\">{t('posts with a caption get twice the comments')}</p>\n\t\t\t\t\t<div class=\"mt-1.5 flex flex-wrap gap-1.5\">\n\t\t\t\t\t\t{#each CAPTION_IDEAS as idea (idea)}\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tonclick={() => useCaptionIdea(idea)}\n\t\t\t\t\t\t\t\tclass=\"rounded-full bg-surface-2 px-2.5 py-1 text-[12px] text-text transition-colors hover:bg-surface\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{t(idea)}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t{/each}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t{/if}\n\n\t\t\t{#if file && filePreviewUrl}\n\t\t\t\t<div class=\"relative mt-2 overflow-hidden rounded-xl border border-border bg-bg\">\n\t\t\t\t\t{#if fileKind === 'image'}\n\t\t\t\t\t\t<img src={filePreviewUrl} alt=\"\" class=\"block max-h-72 w-full object-contain\" />\n\t\t\t\t\t{:else}\n\t\t\t\t\t\t<!-- svelte-ignore a11y_media_has_caption -->\n\t\t\t\t\t\t<video src={filePreviewUrl} controls class=\"block max-h-72 w-full\"></video>\n\t\t\t\t\t{/if}\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonclick={clearFile}\n\t\t\t\t\t\tclass=\"absolute top-2 right-2 rounded-full bg-black/70 px-2 py-0.5 text-xs font-semibold text-white hover:bg-black/90\"\n\t\t\t\t\t\taria-label={t('remove file')}\n\t\t\t\t\t>\n\t\t\t\t\t\t×\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t{#if fileKind === 'image' && extraFiles.length > 0}\n\t\t\t\t\t<!-- Multi-pic: extra photo thumbs, each removable. The image button\n\t\t\t\t\t\t (or another pick from the same multi-select) appends more. -->\n\t\t\t\t\t<div class=\"mt-2 flex flex-wrap items-center gap-2\">\n\t\t\t\t\t\t{#each extraFiles as x, i (x.previewUrl)}\n\t\t\t\t\t\t\t<div class=\"relative\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={x.previewUrl}\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\tclass=\"h-16 w-16 rounded-lg border border-border object-cover\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tonclick={() => removeExtra(i)}\n\t\t\t\t\t\t\t\t\tclass=\"absolute -top-1.5 -right-1.5 flex h-5 w-5 items-center justify-center rounded-full bg-black/80 text-[11px] font-semibold text-white hover:bg-black\"\n\t\t\t\t\t\t\t\t\taria-label={t('remove photo')}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t×\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{/each}\n\t\t\t\t\t\t{#if 1 + extraFiles.length < MAX_IMAGES}\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tonclick={pickImage}\n\t\t\t\t\t\t\t\tdisabled={uploading}\n\t\t\t\t\t\t\t\tclass=\"flex h-16 w-16 items-center justify-center rounded-lg border border-dashed border-border text-lg text-muted transition-colors hover:border-border-strong hover:text-text disabled:opacity-40\"\n\t\t\t\t\t\t\t\taria-label={t('add another photo')}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t+\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t{/if}\n\t\t\t\t\t</div>\n\t\t\t\t{/if}\n\t\t\t{/if}\n\n\t\t\t{#if linkOpen}\n\t\t\t\t<input\n\t\t\t\t\ttype=\"url\"\n\t\t\t\t\tbind:value={linkUrl}\n\t\t\t\t\tplaceholder={t('paste a url…')}\n\t\t\t\t\tdisabled={uploading}\n\t\t\t\t\tclass=\"mt-2 block w-full rounded-lg border border-border bg-bg px-3 py-1.5 text-sm text-text placeholder:text-muted/40 focus:border-accent focus:ring-0 focus:outline-none disabled:opacity-50\"\n\t\t\t\t/>\n\t\t\t{/if}\n\n\t\t</div>\n\t</div>\n\n\t<input\n\t\tbind:this={imageInput}\n\t\ttype=\"file\"\n\t\taccept={ACCEPT_IMAGE_PICKER}\n\t\tmultiple\n\t\tonchange={async (e) => {\n\t\t\t// Sequential so the first file becomes the cover and the rest append\n\t\t\t// as extras (handleFile caps at 4 total).\n\t\t\tfor (const f of Array.from(e.currentTarget.files ?? [])) await handleFile(f);\n\t\t}}\n\t\tclass=\"hidden\"\n\t/>\n\t<input\n\t\tbind:this={videoInput}\n\t\ttype=\"file\"\n\t\taccept={ACCEPT_VIDEO}\n\t\tonchange={(e) => {\n\t\t\tconst f = e.currentTarget.files?.[0];\n\t\t\tif (f) handleFile(f);\n\t\t}}\n\t\tclass=\"hidden\"\n\t/>\n\n\t<!-- Two deliberate rows on phones (niche chips, then tools + post) so nothing\n\t\t wraps by accident. From sm up it's one row; if the chips don't fit, the\n\t\t tools group drops below as a whole — never a single icon. -->\n\t<div\n\t\tclass=\"flex flex-col gap-1.5 border-border/60 px-3 py-2 sm:flex-row sm:flex-wrap sm:items-center sm:gap-x-3 sm:gap-y-1.5 sm:border-t\"\n\t>\n\t\t<!-- RAT-270: niche picker pill (only on /f home, not /n/[slug] where\n\t\t\t the niche is locked via nicheContext). Multi-niche: once a primary\n\t\t\t exists (picked here or locked via nicheContext), up to two \"+ niche\"\n\t\t\t slots let the post reach 2-3 niche feeds at once. -->\n\t\t{#if !clanContext}\n\t\t\t<div class=\"flex max-w-full min-w-0 flex-wrap items-center gap-1.5\">\n\t\t\t\t{#if !nicheContext}\n\t\t\t\t\t<NichePicker\n\t\t\t\t\t\tbind:selected={pickerSelection}\n\t\t\t\t\t\tonSelect={(n) => {\n\t\t\t\t\t\t\tpickerSelection = n;\n\t\t\t\t\t\t\tif (n) error = '';\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tallowSkip={false}\n\t\t\t\t\t/>\n\t\t\t\t{/if}\n\t\t\t\t{#if nicheContext || pickerSelection}\n\t\t\t\t\t<NichePicker\n\t\t\t\t\t\tbind:selected={extraSelection1}\n\t\t\t\t\t\tonSelect={(n) => pickExtra(1, n)}\n\t\t\t\t\t\tallowSkip={false}\n\t\t\t\t\t\tplaceholder={t('+ add a niche')}\n\t\t\t\t\t\tcompact\n\t\t\t\t\t/>\n\t\t\t\t{/if}\n\t\t\t\t{#if extraSelection1}\n\t\t\t\t\t<NichePicker\n\t\t\t\t\t\tbind:selected={extraSelection2}\n\t\t\t\t\t\tonSelect={(n) => pickExtra(2, n)}\n\t\t\t\t\t\tallowSkip={false}\n\t\t\t\t\t\tplaceholder={t('+ add a niche')}\n\t\t\t\t\t\tcompact\n\t\t\t\t\t/>\n\t\t\t\t{/if}\n\t\t\t</div>\n\t\t{/if}\n\t\t<div class=\"flex min-w-0 items-center justify-between gap-2 sm:flex-auto sm:shrink-0\">\n\t\t\t<div class=\"-ml-1.5 flex items-center gap-0.5\">\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonclick={pickImage}\n\t\t\t\t\tdisabled={uploading}\n\t\t\t\t\tclass=\"rounded-full p-1.5 text-muted transition-colors hover:bg-bg hover:text-accent disabled:opacity-40\"\n\t\t\t\t\taria-label={t('add image')}\n\t\t\t\t\ttitle={t('add image')}\n\t\t\t\t>\n\t\t\t\t\t<svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t\t<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" />\n\t\t\t\t\t\t<circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\" />\n\t\t\t\t\t\t<polyline points=\"21 15 16 10 5 21\" />\n\t\t\t\t\t</svg>\n\t\t\t\t</button>\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonclick={pickVideo}\n\t\t\t\t\tdisabled={uploading}\n\t\t\t\t\tclass=\"rounded-full p-1.5 text-muted transition-colors hover:bg-bg hover:text-accent disabled:opacity-40\"\n\t\t\t\t\taria-label={t('add video')}\n\t\t\t\t\ttitle={t('add video')}\n\t\t\t\t>\n\t\t\t\t\t<svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t\t<polygon points=\"23 7 16 12 23 17 23 7\" />\n\t\t\t\t\t\t<rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\" ry=\"2\" />\n\t\t\t\t\t</svg>\n\t\t\t\t</button>\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonclick={toggleLink}\n\t\t\t\t\tdisabled={uploading}\n\t\t\t\t\tclass=\"rounded-full p-1.5 transition-colors hover:bg-bg disabled:opacity-40 {linkOpen ? 'text-accent' : 'text-muted hover:text-accent'}\"\n\t\t\t\t\taria-label={t('add link')}\n\t\t\t\t\ttitle={t('add link')}\n\t\t\t\t>\n\t\t\t\t\t<svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t\t<path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\" />\n\t\t\t\t\t\t<path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\" />\n\t\t\t\t\t</svg>\n\t\t\t\t</button>\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonclick={() => (tierlistOpen = true)}\n\t\t\t\t\tdisabled={uploading}\n\t\t\t\t\tclass=\"inline-flex items-center gap-1 rounded-full p-1.5 text-muted transition-colors hover:bg-bg hover:text-accent disabled:opacity-40\"\n\t\t\t\t\taria-label={t('create tier list')}\n\t\t\t\t\ttitle={t('create tier list')}\n\t\t\t\t>\n\t\t\t\t\t<svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n\t\t\t\t\t\t<rect x=\"3\" y=\"4\" width=\"4\" height=\"4\" rx=\"1\" />\n\t\t\t\t\t\t<path d=\"M11 6h10\" />\n\t\t\t\t\t\t<rect x=\"3\" y=\"14\" width=\"4\" height=\"4\" rx=\"1\" />\n\t\t\t\t\t\t<path d=\"M11 16h10\" />\n\t\t\t\t\t</svg>\n\t\t\t\t\t<span class=\"new-badge\" aria-hidden=\"true\">{t('NEW')}</span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t\t<div class=\"flex min-w-0 items-center gap-3\">\n\t\t\t\t{#if progress}\n\t\t\t\t\t<span class=\"truncate text-[11px] text-muted\">{progress}</span>\n\t\t\t\t{/if}\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonclick={submit}\n\t\t\t\t\tdisabled={uploading || !hasContent}\n\t\t\t\t\tclass=\"shrink-0 rounded-full bg-accent px-4 py-1 text-[13px] font-semibold text-bg transition-colors hover:bg-accent/85 disabled:cursor-not-allowed disabled:opacity-40 {hasContent && !hasNiche ? 'opacity-60' : ''}\"\n\t\t\t\t>\n\t\t\t\t\t{t('post')}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t{#if error}\n\t\t<!-- Under the niche pill row: the \"pick a niche first\" guard (and any\n\t\t\t upload error) lands next to the control that fixes it. -->\n\t\t<p class=\"px-3 pb-2 text-xs text-red-400\">{error}</p>\n\t{/if}\n</section>\n\n{#if nudgeOpen}\n\t<DuelFeatureNudge code={nudgeCode} onclose={() => (nudgeOpen = false)} />\n{/if}\n\n<MentionAutocomplete\n\topen={mentionOpen}\n\tquery={mentionQuery}\n\tcandidates={mentionCandidates}\n\tanchor={textareaEl}\n\tonPick={pickMention}\n\tonClose={() => (mentionOpen = false)}\n/>\n\n{#if tierlistOpen}\n\t<TierListComposerDialog\n\t\t{nicheContext}\n\t\t{clanContext}\n\t\tonclose={() => (tierlistOpen = false)}\n\t\tonposted={async () => {\n\t\t\ttierlistOpen = false;\n\t\t\tawait invalidateAll();\n\t\t}}\n\t/>\n{/if}\n\n<style>\n\t/* NEW badge on the tier list action: a small solid accent pill, inline next\n\t   to the icon, never floated over neighbouring controls. No shimmer or glow\n\t   (design rules: no neon). */\n\t.new-badge {\n\t\tborder-radius: 999px;\n\t\tbackground: var(--color-accent);\n\t\tpadding: 1px 5px;\n\t\tfont-size: 8px;\n\t\tline-height: 1.4;\n\t\tfont-weight: 700;\n\t\tletter-spacing: 0.08em;\n\t\tcolor: white;\n\t\tpointer-events: none;\n\t}\n</style>\n"],"version":3}