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B,CAAG,CAAC,EAAI,CAAA,CACjD,MAAQ,CACP,MAAO,CAAA,CACR,CACD,CAEO,SAASC,GAAWpB,EAAkB,CAC5C,GAAI,CACH,eAAe,QAAQgB,EAAK,KAAK,UAAUhB,CAAC,CAAC,CAC9C,MAAQ,CAER,CACD,CAEO,SAASqB,IAAmB,CAClC,GAAI,CACH,eAAe,WAAWL,CAAG,CAC9B,MAAQ,CAER,CACD,CAEA,MAAMM,EAAS,iBAIR,SAASC,GAAerF,EAAqB,CACnD,GAAI,CACH,eAAe,QAAQoF,EAAQpF,CAAK,CACrC,MAAQ,CAER,CACD,CAEO,SAASsF,IAAkC,CACjD,GAAI,CACH,OAAO,eAAe,QAAQF,CAAM,CACrC,MAAQ,CACP,OAAO,IACR,CACD,CAIO,SAASG,GAAiBC,EAAuB,CACvD,GAAI,CACH,OAAI,eAAe,QAAQT,EAAOS,CAAI,EAAU,IAChD,eAAe,QAAQT,EAAOS,EAAM,GAAG,EAChC,GACR,MAAQ,CACP,MAAO,EACR,CACD","names":["INVITE_PARAM","TOKEN_RE","isInviteToken","s","readInviteToken","hash","m","compareUrl","token","sealAnswers","answers","signal","res","body","matchAnswers","isTouchDevice","copyLink","url","shareCompareLink","data","err","label","copied","$.state","manual","timer","onDestroy","share","$$props","$.set","outcome","method","trackKinkCompare","button","$.first_child","fragment","input","root_1","$.remove_input_defaults","$.template_effect","$.set_value","$.get","$.event","e","$.append","$$anchor","$$render","consequent","$.delegated","CHOICES","CHOICE_KEYS","c","CATEGORIES","DEFS","ARENA_KEYS","ARENA_KINKS","k","KINK_ITEMS","d","KINK_BY_KEY","KINK_COUNT","itemsIn","cat","categoryName","sanitizeAnswers","out","key","value","isYes","answeredCount","a","n","countByChoice","topKinks","max","fav","yes","arenaKinks","arenaHref","keys","categoryBreakdown","items","x","y","firstUnanswered","answersKey","KEY","ONCE","readDraft","raw","writeDraft","clearDraft","INVITE","rememberInvite","rememberedInvite","firstThisSession","name"],"sources":["../../../../../../src/lib/kink/compare.ts","../../../../../../src/lib/components/kink/KinkCompareButton.svelte","../../../../../../src/lib/kink/items.ts","../../../../../../src/lib/kink/draft.ts"],"sourcesContent":["import type { Answers } from './items';\n\n/**\n * RAT-647: the partner compare, page side. Answers are sealed by\n * /api/kink-compare/seal into a token only the server can open, and the link\n * carries it after the # (/kink-test#with=<token>): a fragment never reaches\n * the server or the pageview, and analytics-redact rewrites it out of every\n * url PostHog records. /api/kink-compare/match returns only the kinks both\n * people marked favourite or yes.\n */\n\n/** A kink both marked favourite or yes; `fav` when both marked favourite. */\nexport type MutualItem = { key: string; fav: boolean };\n\nexport const INVITE_PARAM = 'with';\n\n/** base64url, as the seal endpoint writes it; anything else isn't one. */\nconst TOKEN_RE = /^[A-Za-z0-9_-]{40,1024}$/;\n\nexport const isInviteToken = (s: string | null | undefined): s is string =>\n\ttypeof s === 'string' && TOKEN_RE.test(s);\n\nexport function readInviteToken(hash: string): string | null {\n\tconst m = /^#with=([^&]+)/.exec(hash);\n\treturn m && isInviteToken(m[1]) ? m[1] : null;\n}\n\nexport function compareUrl(token: string): string {\n\treturn `${location.origin}/kink-test#${INVITE_PARAM}=${token}`;\n}\n\nexport async function sealAnswers(answers: Answers, signal?: AbortSignal): Promise<string | null> {\n\ttry {\n\t\tconst res = await fetch('/api/kink-compare/seal', {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'content-type': 'application/json' },\n\t\t\tbody: JSON.stringify({ answers }),\n\t\t\tsignal\n\t\t});\n\t\tif (!res.ok) return null;\n\t\tconst body = (await res.json()) as { token?: unknown };\n\t\treturn typeof body.token === 'string' ? body.token : null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport type MatchResult =\n\t| { ok: true; mutual: MutualItem[]; token: string | null }\n\t| { ok: false; reason: 'expired' | 'invalid' | 'error' };\n\nexport async function matchAnswers(\n\ttoken: string,\n\tanswers: Answers,\n\tsignal?: AbortSignal\n): Promise<MatchResult> {\n\ttry {\n\t\tconst res = await fetch('/api/kink-compare/match', {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'content-type': 'application/json' },\n\t\t\tbody: JSON.stringify({ token, answers }),\n\t\t\tsignal\n\t\t});\n\t\tconst body = (await res.json().catch(() => ({}))) as {\n\t\t\tmutual?: MutualItem[];\n\t\t\ttoken?: unknown;\n\t\t\terror?: string;\n\t\t};\n\t\tif (res.ok && Array.isArray(body.mutual)) {\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tmutual: body.mutual,\n\t\t\t\ttoken: typeof body.token === 'string' ? body.token : null\n\t\t\t};\n\t\t}\n\t\tif (res.status === 410) return { ok: false, reason: 'expired' };\n\t\tif (body.error === 'invalid_token') return { ok: false, reason: 'invalid' };\n\t\treturn { ok: false, reason: 'error' };\n\t} catch {\n\t\treturn { ok: false, reason: 'error' };\n\t}\n}\n\nexport type ShareOutcome = 'shared' | 'copied' | 'cancelled' | 'failed';\n\n/** Touch devices get the share sheet, desktops a copied link: the\n *  FoilCardHero pattern. canShare is true on desktop browsers too, hence\n *  the `(pointer: coarse)` gate. */\nfunction isTouchDevice(): boolean {\n\treturn typeof window !== 'undefined' && window.matchMedia('(pointer: coarse)').matches;\n}\n\nfunction copyLink(url: string): Promise<ShareOutcome> {\n\tif (!navigator.clipboard?.writeText) return Promise.resolve('failed');\n\treturn navigator.clipboard.writeText(url).then(\n\t\t() => 'copied' as const,\n\t\t() => 'failed' as const\n\t);\n}\n\n/**\n * Call it straight from the tap handler, with the token already sealed: iOS\n * Safari drops user activation across an await, and navigator.share (and the\n * clipboard) then refuse.\n */\nexport function shareCompareLink(url: string): Promise<ShareOutcome> {\n\tconst data = {\n\t\turl,\n\t\ttitle: 'Kink test',\n\t\ttext: 'Compare kinks with me. Only what we both want shows up.'\n\t};\n\tif (\n\t\tisTouchDevice() &&\n\t\ttypeof navigator.share === 'function' &&\n\t\t(!navigator.canShare || navigator.canShare(data))\n\t) {\n\t\treturn navigator.share(data).then(\n\t\t\t() => 'shared' as const,\n\t\t\t// AbortError = the sheet was dismissed; anything else, the link is\n\t\t\t// still useful on the clipboard\n\t\t\t(err: unknown) =>\n\t\t\t\t(err as Error)?.name === 'AbortError' ? ('cancelled' as const) : copyLink(url)\n\t\t);\n\t}\n\treturn copyLink(url);\n}\n","<script lang=\"ts\">\n\timport { onDestroy } from 'svelte';\n\timport { compareUrl, shareCompareLink } from '$lib/kink/compare';\n\timport { trackKinkCompare } from '$lib/analytics';\n\n\t/** RAT-647: the one accent on the kink pages. It hands out a compare link\n\t *  for answers sealed before the tap (the page seals them as they settle),\n\t *  so the share sheet opens synchronously — iOS Safari refuses\n\t *  navigator.share after an await. Touch: share sheet. Desktop: copied. */\n\ttype Props = {\n\t\ttoken: string | null;\n\t\tsurface: 'list' | 'test' | 'reply';\n\t\tlabel?: string;\n\t\tonshared?: (method: 'share' | 'copy') => void;\n\t};\n\tlet { token, surface, label = 'Compare with a partner', onshared }: Props = $props();\n\n\tlet copied = $state(false);\n\tlet manual = $state<string | null>(null);\n\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\tonDestroy(() => clearTimeout(timer));\n\n\tfunction share() {\n\t\tif (!token) return;\n\t\tconst url = compareUrl(token);\n\t\tmanual = null;\n\t\tvoid shareCompareLink(url).then((outcome) => {\n\t\t\tif (outcome === 'cancelled') return;\n\t\t\tif (outcome === 'failed') {\n\t\t\t\t// no share sheet and no clipboard: the link itself, to copy by hand\n\t\t\t\tmanual = url;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst method = outcome === 'shared' ? 'share' : 'copy';\n\t\t\ttrackKinkCompare('created', { surface, method });\n\t\t\tonshared?.(method);\n\t\t\tif (outcome === 'copied') {\n\t\t\t\tcopied = true;\n\t\t\t\tclearTimeout(timer);\n\t\t\t\ttimer = setTimeout(() => (copied = false), 2400);\n\t\t\t}\n\t\t});\n\t}\n</script>\n\n<button type=\"button\" class=\"kc\" disabled={!token} onclick={share}>\n\t{copied ? 'Link copied' : label}\n</button>\n{#if manual}\n\t<input\n\t\tclass=\"kc-url\"\n\t\treadonly\n\t\tvalue={manual}\n\t\taria-label=\"Compare link\"\n\t\tonfocus={(e) => e.currentTarget.select()}\n\t/>\n{/if}\n\n<style>\n\t.kc {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\twidth: 100%;\n\t\tmin-height: 52px;\n\t\tpadding: 0 22px;\n\t\tborder: 0;\n\t\tborder-radius: 14px;\n\t\tbackground: #ff4d6d;\n\t\tcolor: #fff;\n\t\tfont: 700 16px/1.1 var(--font-body);\n\t\tletter-spacing: -0.01em;\n\t\tcursor: pointer;\n\t\ttouch-action: manipulation;\n\t\t-webkit-tap-highlight-color: transparent;\n\t\ttransition:\n\t\t\topacity 160ms var(--ease-out-quart),\n\t\t\ttransform 120ms var(--ease-out-quart);\n\t}\n\t.kc:active:not(:disabled) {\n\t\ttransform: scale(0.98);\n\t}\n\t.kc:disabled {\n\t\topacity: 0.45;\n\t\tcursor: default;\n\t}\n\t.kc:focus-visible {\n\t\toutline: 2px solid #f5f5f7;\n\t\toutline-offset: 3px;\n\t}\n\t.kc-url {\n\t\tdisplay: block;\n\t\twidth: 100%;\n\t\tmargin-top: 10px;\n\t\tpadding: 10px 12px;\n\t\tborder: 1px solid #262626;\n\t\tborder-radius: 10px;\n\t\tbackground: transparent;\n\t\tcolor: #f5f5f7;\n\t\tfont: 400 13px var(--font-body);\n\t}\n\t@media (min-width: 640px) {\n\t\t.kc {\n\t\t\twidth: auto;\n\t\t}\n\t}\n\t@media (prefers-reduced-motion: reduce) {\n\t\t.kc {\n\t\t\ttransition: none;\n\t\t}\n\t}\n</style>\n","import { KINKS as ARENA_KINKS } from '$lib/types/arena-identity';\n\n/**\n * The kink list (/kink-list) and the kink test (/kink-test), RAT-647: one\n * catalogue for both, and for the partner compare behind them.\n *\n * The 23 arena kinks keep their arena keys, so an answer maps 1:1 onto the\n * arena's \"into\" tags (/a/submit?kinks=…). The rest are common adult kinks\n * the arena doesn't tag. Every definition is one short, neutral sentence:\n * it is the glossary the page ranks with, and it is read by people who have\n * never heard the word.\n *\n * Left out on purpose, here and in any copy about it: anything youth-coded,\n * family, non-consent, animals, real people, breath play, scat and blood.\n */\n\nexport type Choice = 'fav' | 'yes' | 'ok' | 'maybe' | 'no';\n\n/** The five answers, strongest first. Their order is the order on screen. */\nexport const CHOICES: readonly { key: Choice; label: string }[] = [\n\t{ key: 'fav', label: 'Favourite' },\n\t{ key: 'yes', label: 'Yes' },\n\t{ key: 'ok', label: 'OK' },\n\t{ key: 'maybe', label: 'Maybe' },\n\t{ key: 'no', label: 'No' }\n];\n\nconst CHOICE_KEYS = new Set<string>(CHOICES.map((c) => c.key));\n\nexport type CategoryId = 'power' | 'words' | 'sensation' | 'orgasm' | 'watching' | 'fetish';\n\nexport const CATEGORIES: readonly { id: CategoryId; name: string }[] = [\n\t{ id: 'power', name: 'Power & role play' },\n\t{ id: 'words', name: 'Humiliation & praise' },\n\t{ id: 'sensation', name: 'Bondage & sensation' },\n\t{ id: 'orgasm', name: 'Orgasm play' },\n\t{ id: 'watching', name: 'Watching & sharing' },\n\t{ id: 'fetish', name: 'Fetishes & acts' }\n];\n\nexport type KinkItem = {\n\tkey: string;\n\tname: string;\n\tdef: string;\n\tcat: CategoryId;\n\t/** One of the arena's \"into\" tags (the key is the arena's). */\n\tarena: boolean;\n\t/** The page on ratemyd that goes deeper. */\n\thref?: string;\n};\n\ntype Def = Omit<KinkItem, 'arena'>;\n\nconst DEFS: Def[] = [\n\t// power & role play\n\t{\n\t\tkey: 'ds',\n\t\tcat: 'power',\n\t\tname: 'Dominance & submission',\n\t\tdef: 'One partner takes control and the other hands it over, for a scene or as an ongoing dynamic.'\n\t},\n\t{\n\t\tkey: 'ms',\n\t\tcat: 'power',\n\t\tname: 'Master/slave (M/s)',\n\t\tdef: 'A deeper power exchange where one partner serves and the other is in charge, often beyond sex.'\n\t},\n\t{\n\t\tkey: 'daddyboy',\n\t\tcat: 'power',\n\t\tname: 'Daddy dom / sub (adults)',\n\t\tdef: 'A protective, in-charge dominant and a submissive partner, both adults, built on rules, care and reward.'\n\t},\n\t{\n\t\tkey: 'findom',\n\t\tcat: 'power',\n\t\tname: 'Findom',\n\t\tdef: 'Financial domination: sending money or gifts to a dominant as an act of submission, and being turned on by it.',\n\t\thref: '/findom'\n\t},\n\t{\n\t\tkey: 'roleplay',\n\t\tcat: 'power',\n\t\tname: 'Role play',\n\t\tdef: 'Acting out an agreed scenario as adult characters, such as two strangers meeting at a bar.'\n\t},\n\t{\n\t\tkey: 'pup',\n\t\tcat: 'power',\n\t\tname: 'Pup play',\n\t\tdef: 'Adults playing a lively, loyal pup, often with a hood, a collar and a handler.'\n\t},\n\t{\n\t\tkey: 'sissy',\n\t\tcat: 'power',\n\t\tname: 'Sissy play',\n\t\tdef: 'Dressing or acting in an exaggerated feminine way as part of a submissive scene.'\n\t},\n\n\t// humiliation & praise\n\t{\n\t\tkey: 'humiliation',\n\t\tcat: 'words',\n\t\tname: 'Humiliation',\n\t\tdef: 'Being embarrassed, teased or put in your place on purpose, in ways you asked for.'\n\t},\n\t{\n\t\tkey: 'sph',\n\t\tcat: 'words',\n\t\tname: 'SPH',\n\t\tdef: 'Small penis humiliation: consensual teasing about size, from playful ribbing to scripted put-downs.',\n\t\thref: '/sph'\n\t},\n\t{\n\t\tkey: 'degradation',\n\t\tcat: 'words',\n\t\tname: 'Degradation',\n\t\tdef: 'Harsher names and put-downs that cast someone as lesser, within limits agreed beforehand.'\n\t},\n\t{\n\t\tkey: 'praise',\n\t\tcat: 'words',\n\t\tname: 'Praise',\n\t\tdef: 'Being told you’re good, hot or doing well: the warm opposite of humiliation.'\n\t},\n\t{\n\t\tkey: 'dirtytalk',\n\t\tcat: 'words',\n\t\tname: 'Dirty talk',\n\t\tdef: 'Saying out loud, or by text, exactly what you want and what you’re doing.'\n\t},\n\t{\n\t\tkey: 'cockfight',\n\t\tcat: 'words',\n\t\tname: 'Size comparison & cockfighting',\n\t\tdef: 'Comparing cocks side by side or rubbing them together, often as a contest of who’s bigger.'\n\t},\n\n\t// bondage & sensation\n\t{\n\t\tkey: 'bondage',\n\t\tcat: 'sensation',\n\t\tname: 'Bondage',\n\t\tdef: 'Being cuffed, strapped or tied so you can’t move freely, or doing the tying.'\n\t},\n\t{\n\t\tkey: 'rope',\n\t\tcat: 'sensation',\n\t\tname: 'Rope & shibari',\n\t\tdef: 'Tying with rope, from simple wrist ties to Japanese-style patterns that are part restraint, part art.'\n\t},\n\t{\n\t\tkey: 'spanking',\n\t\tcat: 'sensation',\n\t\tname: 'Spanking',\n\t\tdef: 'Slapping the butt with a hand or a paddle, for the sting, the warmth or the discipline.'\n\t},\n\t{\n\t\tkey: 'impact',\n\t\tcat: 'sensation',\n\t\tname: 'Impact play',\n\t\tdef: 'Floggers, crops, canes and paddles on the body, from soft thuds to sharp stings.'\n\t},\n\t{\n\t\tkey: 'sensory',\n\t\tcat: 'sensation',\n\t\tname: 'Blindfolds & sensory deprivation',\n\t\tdef: 'Taking away sight, sound or movement so that every touch lands harder.'\n\t},\n\t{\n\t\tkey: 'wax',\n\t\tcat: 'sensation',\n\t\tname: 'Wax & temperature play',\n\t\tdef: 'Warm candle wax, ice and other hot and cold sensations on the skin.'\n\t},\n\t{\n\t\tkey: 'nipples',\n\t\tcat: 'sensation',\n\t\tname: 'Nipple play',\n\t\tdef: 'Pinching, sucking, clamps or toys on the nipples.'\n\t},\n\t{\n\t\tkey: 'cbt',\n\t\tcat: 'sensation',\n\t\tname: 'Cock & ball play (CBT)',\n\t\tdef: 'Squeezing, stretching, binding or light impact on the cock and balls, for intense sensation.'\n\t},\n\t{\n\t\tkey: 'tickling',\n\t\tcat: 'sensation',\n\t\tname: 'Tickling',\n\t\tdef: 'Tickling a partner who can’t easily get away, for laughs, for torment or both.'\n\t},\n\t{\n\t\tkey: 'rough',\n\t\tcat: 'sensation',\n\t\tname: 'Rough sex',\n\t\tdef: 'Hard, physical sex, like pinning down, hair pulling or biting, that both people want.'\n\t},\n\n\t// orgasm play\n\t{\n\t\tkey: 'edging',\n\t\tcat: 'orgasm',\n\t\tname: 'Edging',\n\t\tdef: 'Getting close to orgasm and stopping, again and again, so the finish hits harder.'\n\t},\n\t{\n\t\tkey: 'orgasmcontrol',\n\t\tcat: 'orgasm',\n\t\tname: 'Orgasm control',\n\t\tdef: 'A partner decides when, how or whether you get to come: tease and denial.'\n\t},\n\t{\n\t\tkey: 'chastity',\n\t\tcat: 'orgasm',\n\t\tname: 'Chastity',\n\t\tdef: 'Wearing a locked cage so a partner controls when you can touch yourself or come.',\n\t\thref: '/chastity/captions'\n\t},\n\t{\n\t\tkey: 'goon',\n\t\tcat: 'orgasm',\n\t\tname: 'Gooning',\n\t\tdef: 'Long masturbation sessions, usually with porn, staying close to the edge for as long as possible.'\n\t},\n\t{\n\t\tkey: 'cum',\n\t\tcat: 'orgasm',\n\t\tname: 'Cum',\n\t\tdef: 'A focus on ejaculation itself: watching it, where it lands and how much there is.'\n\t},\n\t{\n\t\tkey: 'breed',\n\t\tcat: 'orgasm',\n\t\tname: 'Breeding',\n\t\tdef: 'Finishing inside a partner, or being finished in, usually without a condom; agree on testing and PrEP first.'\n\t},\n\t{\n\t\tkey: 'mutual',\n\t\tcat: 'orgasm',\n\t\tname: 'Mutual masturbation',\n\t\tdef: 'Jerking off together, side by side or on camera.'\n\t},\n\n\t// watching & sharing\n\t{\n\t\tkey: 'exhibitionist',\n\t\tcat: 'watching',\n\t\tname: 'Exhibitionism',\n\t\tdef: 'Being watched naked or during sex by people who want to see it.'\n\t},\n\t{\n\t\tkey: 'voyeur',\n\t\tcat: 'watching',\n\t\tname: 'Voyeurism',\n\t\tdef: 'Watching others undress or have sex, with their knowledge and consent.'\n\t},\n\t{\n\t\tkey: 'cuck',\n\t\tcat: 'watching',\n\t\tname: 'Cuckolding',\n\t\tdef: 'Being turned on by your partner having sex with someone else, often while you watch.'\n\t},\n\t{\n\t\tkey: 'group',\n\t\tcat: 'watching',\n\t\tname: 'Threesomes & group play',\n\t\tdef: 'Sex with more than one partner at once, from a threesome to a group.'\n\t},\n\t{\n\t\tkey: 'filming',\n\t\tcat: 'watching',\n\t\tname: 'Filming & photos',\n\t\tdef: 'Taking photos or video of each other, kept private unless you both agree otherwise.'\n\t},\n\t{\n\t\tkey: 'sexting',\n\t\tcat: 'watching',\n\t\tname: 'Sexting & nudes',\n\t\tdef: 'Swapping explicit messages and pics with someone who wants them.'\n\t},\n\n\t// fetishes & acts\n\t{\n\t\tkey: 'feet',\n\t\tcat: 'fetish',\n\t\tname: 'Feet',\n\t\tdef: 'Attraction to feet, from looking and touching to socks, shoes and worship.'\n\t},\n\t{\n\t\tkey: 'worship',\n\t\tcat: 'fetish',\n\t\tname: 'Body worship',\n\t\tdef: 'Lavishing slow attention on a partner’s body, from muscles to cock, with hands and mouth.'\n\t},\n\t{\n\t\tkey: 'gear',\n\t\tcat: 'fetish',\n\t\tname: 'Leather & gear',\n\t\tdef: 'Leather, rubber, harnesses and other gear, for the look, the feel and the smell.'\n\t},\n\t{\n\t\tkey: 'underwear',\n\t\tcat: 'fetish',\n\t\tname: 'Underwear & jockstraps',\n\t\tdef: 'A thing for briefs, jocks and what they show off.'\n\t},\n\t{\n\t\tkey: 'watersports',\n\t\tcat: 'fetish',\n\t\tname: 'Watersports',\n\t\tdef: 'Pee play: urinating on a partner, or being urinated on.'\n\t},\n\t{\n\t\tkey: 'rimming',\n\t\tcat: 'fetish',\n\t\tname: 'Rimming',\n\t\tdef: 'Using your mouth on a partner’s anus.'\n\t},\n\t{\n\t\tkey: 'fisting',\n\t\tcat: 'fetish',\n\t\tname: 'Fisting',\n\t\tdef: 'Slowly working a whole hand inside a partner, with plenty of lube and patience.'\n\t},\n\t{\n\t\tkey: 'toys',\n\t\tcat: 'fetish',\n\t\tname: 'Toys',\n\t\tdef: 'Dildos, plugs, cock rings and vibrators, alone or together.'\n\t}\n];\n\nconst ARENA_KEYS = new Set(ARENA_KINKS.map((k) => k.key));\n\n/** Every kink, in the order the list and the test show them. */\nexport const KINK_ITEMS: readonly KinkItem[] = DEFS.map((d) => ({\n\t...d,\n\tarena: ARENA_KEYS.has(d.key)\n}));\n\nexport const KINK_BY_KEY: ReadonlyMap<string, KinkItem> = new Map(\n\tKINK_ITEMS.map((k) => [k.key, k])\n);\n\nexport const KINK_COUNT = KINK_ITEMS.length;\n\nexport function itemsIn(cat: CategoryId): KinkItem[] {\n\treturn KINK_ITEMS.filter((k) => k.cat === cat);\n}\n\nexport function categoryName(cat: CategoryId): string {\n\treturn CATEGORIES.find((c) => c.id === cat)?.name ?? cat;\n}\n\n/** Someone's answers by kink key. A missing key is unanswered (or skipped). */\nexport type Answers = Partial<Record<string, Choice>>;\n\n/** Known kinks with a valid answer only: anything else in the input is dropped. */\nexport function sanitizeAnswers(input: unknown): Answers {\n\tconst out: Answers = {};\n\tif (!input || typeof input !== 'object' || Array.isArray(input)) return out;\n\tfor (const [key, value] of Object.entries(input as Record<string, unknown>)) {\n\t\tif (KINK_BY_KEY.has(key) && typeof value === 'string' && CHOICE_KEYS.has(value)) {\n\t\t\tout[key] = value as Choice;\n\t\t}\n\t}\n\treturn out;\n}\n\n/** Favourite or yes: the two answers a partner match counts. */\nexport const isYes = (c: Choice | undefined): boolean => c === 'fav' || c === 'yes';\n\nexport function answeredCount(a: Answers): number {\n\treturn KINK_ITEMS.reduce((n, k) => n + (a[k.key] ? 1 : 0), 0);\n}\n\nexport function countByChoice(a: Answers): Record<Choice, number> {\n\tconst out: Record<Choice, number> = { fav: 0, yes: 0, ok: 0, maybe: 0, no: 0 };\n\tfor (const k of KINK_ITEMS) {\n\t\tconst c = a[k.key];\n\t\tif (c) out[c] += 1;\n\t}\n\treturn out;\n}\n\n/** Favourites first, then yeses, each in list order. */\nexport function topKinks(a: Answers, max = Infinity): KinkItem[] {\n\tconst fav = KINK_ITEMS.filter((k) => a[k.key] === 'fav');\n\tconst yes = KINK_ITEMS.filter((k) => a[k.key] === 'yes');\n\treturn [...fav, ...yes].slice(0, max);\n}\n\n/** Up to three arena tags for the submit flow, favourites before yeses. */\nexport function arenaKinks(a: Answers, max = 3): string[] {\n\treturn topKinks(a)\n\t\t.filter((k) => k.arena)\n\t\t.slice(0, max)\n\t\t.map((k) => k.key);\n}\n\n/** The arena submit link that carries them (read by /a/submit). */\nexport function arenaHref(a: Answers): string {\n\tconst keys = arenaKinks(a);\n\treturn keys.length ? `/a/submit?kinks=${keys.join(',')}` : '/a/submit';\n}\n\nexport type CategoryScore = { id: CategoryId; name: string; yes: number; total: number };\n\n/** How many of each group's kinks are a favourite or a yes, most first. */\nexport function categoryBreakdown(a: Answers): CategoryScore[] {\n\treturn CATEGORIES.map((c) => {\n\t\tconst items = itemsIn(c.id);\n\t\treturn {\n\t\t\tid: c.id,\n\t\t\tname: c.name,\n\t\t\tyes: items.filter((k) => isYes(a[k.key])).length,\n\t\t\ttotal: items.length\n\t\t};\n\t}).sort((x, y) => y.yes / y.total - x.yes / x.total);\n}\n\n/** The first kink without an answer, or -1 when every one has one. */\nexport function firstUnanswered(a: Answers): number {\n\treturn KINK_ITEMS.findIndex((k) => !a[k.key]);\n}\n\n/** A stable string of the answers, to tell whether a sealed token is current. */\nexport function answersKey(a: Answers): string {\n\treturn KINK_ITEMS.map((k) => {\n\t\tconst c = a[k.key];\n\t\treturn c ? CHOICES.findIndex((x) => x.key === c) : '-';\n\t}).join('');\n}\n","import { sanitizeAnswers, type Answers } from './items';\n\n/**\n * RAT-647: the answers in progress, shared by /kink-list and /kink-test. They\n * live in sessionStorage: this tab only, gone when it closes, never on an\n * account. Storage that can't be read (private mode, blocked site data) just\n * means nothing is remembered; the page works the same.\n */\n\nconst KEY = 'rmd:kinks:v1';\nconst ONCE = 'rmd:kinks:once:';\n\nexport function readDraft(): Answers {\n\ttry {\n\t\tconst raw = sessionStorage.getItem(KEY);\n\t\treturn raw ? sanitizeAnswers(JSON.parse(raw)) : {};\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nexport function writeDraft(a: Answers): void {\n\ttry {\n\t\tsessionStorage.setItem(KEY, JSON.stringify(a));\n\t} catch {\n\t\t/* not remembered; nothing else changes */\n\t}\n}\n\nexport function clearDraft(): void {\n\ttry {\n\t\tsessionStorage.removeItem(KEY);\n\t} catch {\n\t\t/* nothing stored */\n\t}\n}\n\nconst INVITE = 'rmd:kinks:with';\n\n/** A partner's compare token, kept for this tab once it has left the address\n *  bar, so a reload still compares. */\nexport function rememberInvite(token: string): void {\n\ttry {\n\t\tsessionStorage.setItem(INVITE, token);\n\t} catch {\n\t\t/* a reload then starts without it */\n\t}\n}\n\nexport function rememberedInvite(): string | null {\n\ttry {\n\t\treturn sessionStorage.getItem(INVITE);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/** True the first time it's asked about `name` in this tab, so a funnel event\n *  counts once per visit rather than once per reload. */\nexport function firstThisSession(name: string): boolean {\n\ttry {\n\t\tif (sessionStorage.getItem(ONCE + name)) return false;\n\t\tsessionStorage.setItem(ONCE + name, '1');\n\t\treturn true;\n\t} catch {\n\t\treturn true;\n\t}\n}\n"],"version":3}