{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "legal-02",
  "title": "Cookie choices",
  "description": "A consent banner that never covers the page, where Reject all weighs as much as Accept all and Customize opens a dialog of switches with Necessary locked on and its reason; a saved choice calls back, and the banner fades out leaving a small Cookie settings link behind to reopen it.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/company-mark.json",
    "https://ui.ndekocode.dev/r/demonstration.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/live-duration.json",
    "https://ui.ndekocode.dev/r/live-region.json",
    "https://ui.ndekocode.dev/r/motion-presets.json",
    "https://ui.ndekocode.dev/r/replay-button.json",
    "https://ui.ndekocode.dev/r/switch.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/use-session.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/legal/legal-02/index.tsx",
      "content": "'use client';\n\nimport { useEffect, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { useSession } from '@/registry/ndeko/hooks/use-session';\nimport { spokenUnless } from '@/registry/ndeko/lib/demonstration';\nimport { ClockGate } from '@/registry/ndeko/ui/live-duration';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\n\nimport { ConsentBanner, SettingsLink } from './consent-banner';\nimport {\n  SITE_NAME,\n  STORAGE_KEY,\n  type CookieConsent,\n  type OptionalCategoryId,\n} from './data';\nimport { PreferencesDialog } from './preferences-dialog';\nimport {\n  INITIAL,\n  LOOP_AFTER_MS,\n  reducer,\n  RESTING,\n  SCRIPT,\n  type ConsentAction,\n} from './session';\nimport { SitePage } from './site-page';\n\nexport type { CookieConsent } from './data';\n\nconst SESSION = {\n  reducer,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n\nfunction isConsent(value: unknown): value is CookieConsent {\n  if (typeof value !== 'object' || value === null) {\n    return false;\n  }\n  const hasNecessary = 'necessary' in value && value.necessary === true;\n  const hasPreferences =\n    'preferences' in value && typeof value.preferences === 'boolean';\n  const hasAnalytics =\n    'analytics' in value && typeof value.analytics === 'boolean';\n  const hasMarketing =\n    'marketing' in value && typeof value.marketing === 'boolean';\n  const hasOptional = hasPreferences && hasAnalytics;\n  return hasNecessary && hasOptional && hasMarketing;\n}\n\n/** Storage can be refused (private windows, blocked site data): the choice then lives in memory only. */\nfunction readConsent(key: string) {\n  try {\n    const raw = window.localStorage.getItem(key);\n    if (raw === null) {\n      return null;\n    }\n    const parsed: unknown = JSON.parse(raw);\n    if (isConsent(parsed)) {\n      return parsed;\n    }\n    return null;\n  } catch {\n    return null;\n  }\n}\n\nfunction writeConsent(key: string, consent: CookieConsent) {\n  try {\n    const raw = JSON.stringify(consent);\n    window.localStorage.setItem(key, raw);\n  } catch {\n    return;\n  }\n}\n\n/** Once a choice exists the banner is gone, so the focus goes back to the way to it. */\nfunction returnFocusOf(consent: CookieConsent | null) {\n  if (consent) {\n    return '[data-cookie-settings]';\n  }\n  return '[data-customize]';\n}\n\nexport type Legal02Props = {\n  /** Called with every choice a person saves. The demonstration never calls it. */\n  onChange?: (consent: CookieConsent) => void;\n  /** Keeps the choice in this browser and starts from it on the next visit. */\n  persist?: boolean;\n  storageKey?: string;\n};\n\nexport default function Legal02({\n  onChange,\n  persist = false,\n  storageKey = STORAGE_KEY,\n}: Legal02Props) {\n  const {\n    ref,\n    isInView,\n    isAutoplaying,\n    state,\n    act,\n    pressed,\n    isFinished,\n    restart,\n    takeOver,\n  } = useSession(SESSION);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const [hasReadStorage, setHasReadStorage] = useState(!persist);\n  const hasNoChoice = state.consent === null;\n  const isBannerShown = hasNoChoice && hasReadStorage;\n  const isLinkShown = state.consent !== null;\n  const message = spokenUnless(isAutoplaying, state.spoken);\n  const canReplay = isFinished && !isAutoplaying;\n\n  /**\n   * Under reduced motion the session puts its resting state in place on the next task, which\n   * would hide a stored choice: the choice is read and put back after it, whenever that setting\n   * changes. Until it is read the banner waits, so a returning visitor never sees it flash.\n   */\n  useEffect(() => {\n    if (!persist) {\n      return;\n    }\n    const timer = setTimeout(() => {\n      setHasReadStorage(true);\n      const stored = readConsent(storageKey);\n      if (!stored) {\n        return;\n      }\n      act({ type: 'restored', consent: stored });\n      takeOver();\n    }, 0);\n    return () => clearTimeout(timer);\n  }, [persist, storageKey, act, takeOver, shouldReduceMotion]);\n\n  function focusLater(selector: string) {\n    requestAnimationFrame(() => {\n      const target = ref.current?.querySelector<HTMLElement>(selector);\n      target?.focus();\n    });\n  }\n\n  function decide(action: ConsentAction) {\n    const after = reducer(state, action);\n    act(action);\n    const consent = after.consent;\n    if (!consent) {\n      return;\n    }\n    onChange?.(consent);\n    if (persist) {\n      writeConsent(storageKey, consent);\n    }\n    focusLater('[data-cookie-settings]');\n  }\n\n  function openDialog() {\n    act({ type: 'dialogOpened' });\n    focusLater('[data-dialog-title]');\n  }\n\n  function closeDialog() {\n    act({ type: 'dialogClosed' });\n    focusLater(returnFocusOf(state.consent));\n  }\n\n  function switchCategory(id: OptionalCategoryId, isOn: boolean) {\n    act({ type: 'categorySwitched', id, isOn });\n  }\n\n  return (\n    <ClockGate isActive={isInView}>\n      <div\n        ref={ref}\n        className='bg-background text-foreground @container relative isolate flex h-dvh min-h-[34rem] w-full flex-col overflow-hidden'\n      >\n        <div\n          inert={state.isDialogOpen}\n          className='flex min-h-0 flex-1 flex-col'\n        >\n          <div\n            role='region'\n            aria-label={`${SITE_NAME} guide`}\n            tabIndex={0}\n            className='focus-visible:ring-ring/25 min-h-0 flex-1 overflow-y-auto outline-none focus-visible:ring-[3px] focus-visible:ring-inset'\n          >\n            <SitePage\n              aside={\n                <ReplayButton\n                  isShown={canReplay}\n                  onReplay={restart}\n                  label='Replay'\n                />\n              }\n            />\n          </div>\n          <div className='pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-center p-4'>\n            <ConsentBanner\n              isShown={isBannerShown}\n              pressed={pressed}\n              onRejectAll={() => decide({ type: 'rejectedAll' })}\n              onAcceptAll={() => decide({ type: 'acceptedAll' })}\n              onCustomize={openDialog}\n            />\n          </div>\n          <div className='pointer-events-none absolute start-0 bottom-0 z-20 p-3'>\n            <SettingsLink\n              isShown={isLinkShown}\n              isPressed={pressed === 'settings'}\n              onOpen={openDialog}\n            />\n          </div>\n        </div>\n        <PreferencesDialog\n          isOpen={state.isDialogOpen}\n          draft={state.draft}\n          pressed={pressed}\n          onSwitch={switchCategory}\n          onAcceptAll={() => decide({ type: 'acceptedAll' })}\n          onRejectAll={() => decide({ type: 'rejectedAll' })}\n          onSave={() => decide({ type: 'choicesSaved' })}\n          onClose={closeDialog}\n        />\n        <LiveRegion message={message} />\n      </div>\n    </ClockGate>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/legal-02/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/legal/legal-02/consent-banner.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { pressedQuietOf } from '@/registry/ndeko/lib/demonstration';\nimport { CookieIcon } from '@/registry/ndeko/lib/icons';\nimport {\n  EASE_OUT_STRONG,\n  fadePresence,\n} from '@/registry/ndeko/lib/motion-presets';\nimport { Button } from '@/registry/ndeko/ui/button';\n\nimport { SITE_NAME } from './data';\n\nconst BANNER_PRESENCE = {\n  initial: { opacity: 0, y: 12 },\n  animate: { opacity: 1, y: 0 },\n  exit: {\n    opacity: 0,\n    y: 8,\n    transition: { duration: 0.2, ease: EASE_OUT_STRONG },\n  },\n  transition: { duration: 0.25, ease: EASE_OUT_STRONG },\n};\n\nfunction bannerPresenceOf(shouldReduceMotion: boolean) {\n  if (shouldReduceMotion) {\n    return fadePresence();\n  }\n  return BANNER_PRESENCE;\n}\n\ntype ConsentBannerProps = {\n  isShown: boolean;\n  pressed: string | null;\n  onRejectAll: () => void;\n  onAcceptAll: () => void;\n  onCustomize: () => void;\n};\n\n/** It never covers the page: no backdrop, the article under it still scrolls and reads. */\nexport function ConsentBanner({\n  isShown,\n  pressed,\n  onRejectAll,\n  onAcceptAll,\n  onCustomize,\n}: ConsentBannerProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const presence = bannerPresenceOf(shouldReduceMotion);\n\n  return (\n    <AnimatePresence initial={false}>\n      {isShown && (\n        <motion.div\n          key='banner'\n          role='region'\n          aria-label='Cookie choices'\n          className='surface-raised pointer-events-auto flex w-full max-w-2xl flex-col gap-3 rounded-xl p-4 @2xl:flex-row @2xl:items-center @2xl:gap-6'\n          {...presence}\n        >\n          <p className='min-w-0 flex-1 text-[13px] text-pretty'>\n            <span className='font-medium'>{`Cookies on ${SITE_NAME}.`}</span> We\n            use the ones the site needs to work. With your yes, we also count\n            visits and remember your reading preferences.\n          </p>\n          <div className='flex flex-wrap items-center gap-2'>\n            <Button\n              type='button'\n              variant='outline'\n              size='sm'\n              data-reject-all\n              onClick={onRejectAll}\n              className={pressedQuietOf(pressed === 'reject')}\n            >\n              Reject all\n            </Button>\n            <Button\n              type='button'\n              variant='outline'\n              size='sm'\n              onClick={onAcceptAll}\n              className={pressedQuietOf(pressed === 'accept')}\n            >\n              Accept all\n            </Button>\n            <Button\n              type='button'\n              variant='ghost'\n              size='sm'\n              data-customize\n              onClick={onCustomize}\n              className={pressedQuietOf(pressed === 'customize')}\n            >\n              Customize\n            </Button>\n          </div>\n        </motion.div>\n      )}\n    </AnimatePresence>\n  );\n}\n\ntype SettingsLinkProps = {\n  isShown: boolean;\n  isPressed: boolean;\n  onOpen: () => void;\n};\n\n/** What the banner leaves behind once a choice is saved: the way back to it. */\nexport function SettingsLink({\n  isShown,\n  isPressed,\n  onOpen,\n}: SettingsLinkProps) {\n  const fade = fadePresence();\n\n  return (\n    <AnimatePresence initial={false}>\n      {isShown && (\n        <motion.div key='settings' className='pointer-events-auto' {...fade}>\n          <Button\n            type='button'\n            variant='ghost'\n            size='sm'\n            data-cookie-settings\n            onClick={onOpen}\n            className={pressedQuietOf(isPressed)}\n          >\n            <CookieIcon />\n            Cookie settings\n          </Button>\n        </motion.div>\n      )}\n    </AnimatePresence>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/legal-02/consent-banner.tsx"
    },
    {
      "path": "registry/ndeko/blocks/legal/legal-02/preferences-dialog.tsx",
      "content": "'use client';\n\nimport { useId } from 'react';\n\nimport {\n  pressedQuietOf,\n  pressedSolidOf,\n} from '@/registry/ndeko/lib/demonstration';\nimport { LockIcon, XIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Switch } from '@/registry/ndeko/ui/switch';\n\nimport {\n  NECESSARY,\n  OPTIONAL_CATEGORIES,\n  SITE_NAME,\n  type Category,\n  type OptionalCategoryId,\n} from './data';\nimport type { ConsentDraft } from './session';\n\nfunction layerOf(isOpen: boolean) {\n  if (isOpen) {\n    return undefined;\n  }\n  return 'pointer-events-none';\n}\n\nfunction backdropOf(isOpen: boolean) {\n  if (isOpen) {\n    return 'opacity-100';\n  }\n  return 'opacity-0';\n}\n\nfunction panelOf(isOpen: boolean) {\n  if (isOpen) {\n    return 'scale-100 opacity-100';\n  }\n  return 'scale-95 opacity-0 duration-150';\n}\n\ntype CategoryRowProps = {\n  category: Category;\n  isOn: boolean;\n  isLocked: boolean;\n  isPressed: boolean;\n  /** A locked category takes no change. */\n  onSwitch?: (isOn: boolean) => void;\n};\n\nfunction CategoryRow({\n  category,\n  isOn,\n  isLocked,\n  isPressed,\n  onSwitch,\n}: CategoryRowProps) {\n  const nameId = useId();\n  const lineId = useId();\n\n  return (\n    <li className='flex items-start gap-4 py-3'>\n      <div className='flex min-w-0 flex-1 flex-col gap-1'>\n        <p\n          id={nameId}\n          className='flex flex-wrap items-center gap-2 text-[13px] font-medium'\n        >\n          {category.name}\n          {isLocked && (\n            <Badge variant='secondary'>\n              <LockIcon />\n              Always on\n            </Badge>\n          )}\n        </p>\n        <p id={lineId} className='text-muted-foreground text-xs text-pretty'>\n          {category.line}\n        </p>\n      </div>\n      <span\n        className={cn(\n          'mt-0.5 inline-flex rounded-full transition-[scale] duration-150 ease-(--ease-out-strong)',\n          pressedQuietOf(isPressed)\n        )}\n      >\n        <Switch\n          checked={isOn}\n          disabled={isLocked}\n          onCheckedChange={onSwitch}\n          aria-labelledby={nameId}\n          aria-describedby={lineId}\n        />\n      </span>\n    </li>\n  );\n}\n\ntype PreferencesDialogProps = {\n  isOpen: boolean;\n  draft: ConsentDraft;\n  pressed: string | null;\n  onSwitch: (id: OptionalCategoryId, isOn: boolean) => void;\n  onAcceptAll: () => void;\n  onRejectAll: () => void;\n  onSave: () => void;\n  onClose: () => void;\n};\n\n/**\n * Drawn inside the block, so it never covers anything but the page it belongs to. While it is open\n * the page under it is inert, so the keyboard stays in the dialog until it closes.\n */\nexport function PreferencesDialog({\n  isOpen,\n  draft,\n  pressed,\n  onSwitch,\n  onAcceptAll,\n  onRejectAll,\n  onSave,\n  onClose,\n}: PreferencesDialogProps) {\n  const titleId = useId();\n  const lineId = useId();\n\n  function closeOnEscape(event: React.KeyboardEvent<HTMLDivElement>) {\n    if (event.key !== 'Escape') {\n      return;\n    }\n    event.preventDefault();\n    onClose();\n  }\n\n  return (\n    <div\n      inert={!isOpen}\n      onKeyDown={closeOnEscape}\n      className={cn('absolute inset-0 z-30', layerOf(isOpen))}\n    >\n      <button\n        type='button'\n        tabIndex={-1}\n        aria-label='Close cookie preferences'\n        onClick={onClose}\n        className={cn(\n          'absolute inset-0 cursor-default bg-black/40 backdrop-blur-xs transition-opacity duration-200',\n          backdropOf(isOpen)\n        )}\n      />\n      <div\n        role='dialog'\n        aria-modal='true'\n        aria-labelledby={titleId}\n        aria-describedby={lineId}\n        className={cn(\n          'bg-card text-card-foreground hairline-ring ring-border absolute top-1/2 left-1/2 flex max-h-[calc(100%-2rem)] w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 flex-col gap-4 overflow-x-hidden overflow-y-auto rounded-2xl p-5 shadow-xl shadow-black/8 transition-[opacity,scale] duration-200 ease-(--ease-out-strong) @md:p-6',\n          panelOf(isOpen)\n        )}\n      >\n        <div className='flex flex-col gap-1.5 pe-8'>\n          <h2\n            id={titleId}\n            data-dialog-title\n            tabIndex={-1}\n            className='text-lg leading-tight font-semibold outline-none'\n          >\n            Cookie preferences\n          </h2>\n          <p\n            id={lineId}\n            className='text-muted-foreground text-[13px] text-pretty'\n          >\n            {`Choose what ${SITE_NAME} may keep on this device. You can change it any time from Cookie settings at the foot of the page.`}\n          </p>\n        </div>\n        <ul className='hairline-divide-y divide-border flex flex-col'>\n          <CategoryRow category={NECESSARY} isOn isLocked isPressed={false} />\n          {OPTIONAL_CATEGORIES.map((category) => (\n            <CategoryRow\n              key={category.id}\n              category={category}\n              isOn={draft[category.id]}\n              isLocked={false}\n              isPressed={pressed === `switch-${category.id}`}\n              onSwitch={(isOn) => onSwitch(category.id, isOn)}\n            />\n          ))}\n        </ul>\n        <div className='flex flex-wrap items-center justify-end gap-2'>\n          <Button\n            type='button'\n            variant='outline'\n            onClick={onRejectAll}\n            className={pressedQuietOf(pressed === 'reject-in-dialog')}\n          >\n            Reject all\n          </Button>\n          <Button type='button' variant='outline' onClick={onAcceptAll}>\n            Accept all\n          </Button>\n          <Button\n            type='button'\n            onClick={onSave}\n            className={pressedSolidOf(pressed === 'save')}\n          >\n            Save choices\n          </Button>\n        </div>\n        <Button\n          type='button'\n          variant='ghost'\n          size='icon-sm'\n          aria-label='Close'\n          onClick={onClose}\n          className='text-muted-foreground absolute top-3 right-3'\n        >\n          <XIcon />\n        </Button>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/legal-02/preferences-dialog.tsx"
    },
    {
      "path": "registry/ndeko/blocks/legal/legal-02/site-page.tsx",
      "content": "import { CompanyMark } from '@/registry/ndeko/ui/company-mark';\n\nimport { ARTICLE, SITE_NAME } from './data';\n\ntype SitePageProps = {\n  aside?: React.ReactNode;\n};\n\n/** The page the banner sits on: a guide on the site of a fictional product, there to be read. */\nexport function SitePage({ aside }: SitePageProps) {\n  return (\n    <div className='flex flex-col'>\n      <header className='hairline-b border-border flex h-14 shrink-0 items-center gap-2.5 px-4 @xl:px-8'>\n        <CompanyMark seed={SITE_NAME} size='lg' />\n        <span className='text-sm font-semibold'>{SITE_NAME}</span>\n        <span className='text-muted-foreground ms-3 hidden text-[13px] @md:inline'>\n          {ARTICLE.section}\n        </span>\n        <span className='ms-auto flex items-center'>{aside}</span>\n      </header>\n      <article className='mx-auto flex w-full max-w-2xl flex-col gap-5 px-4 pt-10 pb-56 @xl:px-8 @xl:pt-14'>\n        <div className='flex flex-col gap-2'>\n          <p className='text-primary-ink text-xs font-medium'>\n            {ARTICLE.section}\n          </p>\n          <h1 className='text-2xl font-semibold text-balance @xl:text-3xl'>\n            {ARTICLE.title}\n          </h1>\n          <p className='text-muted-foreground text-xs'>{ARTICLE.meta}</p>\n        </div>\n        {ARTICLE.paragraphs.map((paragraph) => (\n          <p\n            key={paragraph}\n            className='text-muted-foreground text-base leading-relaxed text-pretty'\n          >\n            {paragraph}\n          </p>\n        ))}\n      </article>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/legal-02/site-page.tsx"
    },
    {
      "path": "registry/ndeko/blocks/legal/legal-02/session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\n\nimport type { CookieConsent, OptionalCategoryId } from './data';\n\nexport type ConsentDraft = Record<OptionalCategoryId, boolean>;\n\nexport type ConsentState = {\n  /** The saved choice, or null while the visitor has not answered. */\n  consent: CookieConsent | null;\n  draft: ConsentDraft;\n  isDialogOpen: boolean;\n  spoken: string;\n};\n\nexport type ConsentAction =\n  | { type: 'dialogOpened' }\n  | { type: 'dialogClosed' }\n  | { type: 'categorySwitched'; id: OptionalCategoryId; isOn: boolean }\n  | { type: 'acceptedAll' }\n  | { type: 'rejectedAll' }\n  | { type: 'choicesSaved' }\n  | { type: 'restored'; consent: CookieConsent };\n\ntype Step = SessionStep<ConsentState, ConsentAction>;\n\nconst NOTHING_OPTIONAL: ConsentDraft = {\n  preferences: false,\n  analytics: false,\n  marketing: false,\n};\n\nconst EVERYTHING: ConsentDraft = {\n  preferences: true,\n  analytics: true,\n  marketing: true,\n};\n\nexport const INITIAL: ConsentState = {\n  consent: null,\n  draft: NOTHING_OPTIONAL,\n  isDialogOpen: false,\n  spoken: '',\n};\n\nfunction consentOf(draft: ConsentDraft): CookieConsent {\n  return { necessary: true, ...draft };\n}\n\nfunction draftOf(consent: CookieConsent | null): ConsentDraft {\n  if (!consent) {\n    return NOTHING_OPTIONAL;\n  }\n  return {\n    preferences: consent.preferences,\n    analytics: consent.analytics,\n    marketing: consent.marketing,\n  };\n}\n\nfunction allowedCountOf(draft: ConsentDraft) {\n  const allowed = Object.values(draft).filter(Boolean);\n  return allowed.length;\n}\n\nfunction savedLineOf(draft: ConsentDraft) {\n  const count = allowedCountOf(draft);\n  if (count === 0) {\n    return 'Saved: only necessary cookies';\n  }\n  if (count === 1) {\n    return 'Saved: necessary cookies and 1 more kind';\n  }\n  return `Saved: necessary cookies and ${count} more kinds`;\n}\n\n/** The dialog opens on the choice already saved, or on nothing but the necessary ones. */\nfunction dialogOpened(state: ConsentState): ConsentState {\n  return {\n    ...state,\n    isDialogOpen: true,\n    draft: draftOf(state.consent),\n    spoken: 'Cookie preferences opened',\n  };\n}\n\nfunction decided(\n  state: ConsentState,\n  draft: ConsentDraft,\n  spoken: string\n): ConsentState {\n  return {\n    ...state,\n    consent: consentOf(draft),\n    draft,\n    isDialogOpen: false,\n    spoken,\n  };\n}\n\nexport function reducer(\n  state: ConsentState,\n  action: ConsentAction\n): ConsentState {\n  switch (action.type) {\n    case 'dialogOpened':\n      return dialogOpened(state);\n    case 'dialogClosed':\n      return { ...state, isDialogOpen: false, spoken: '' };\n    case 'categorySwitched': {\n      const draft = { ...state.draft, [action.id]: action.isOn };\n      return { ...state, draft };\n    }\n    case 'acceptedAll':\n      return decided(state, EVERYTHING, 'Saved: all cookies');\n    case 'rejectedAll':\n      return decided(state, NOTHING_OPTIONAL, 'Saved: only necessary cookies');\n    case 'choicesSaved':\n      return decided(state, state.draft, savedLineOf(state.draft));\n    case 'restored':\n      return {\n        ...state,\n        consent: action.consent,\n        draft: draftOf(action.consent),\n      };\n  }\n}\n\n/**\n * A visitor opens Customize, allows two kinds and saves, then comes back from Cookie settings and\n * refuses everything with one press: rejecting takes no more than accepting.\n */\nexport const SCRIPT: Step[] = [\n  {\n    after: 1600,\n    by: 'demo',\n    press: 'customize',\n    action: { type: 'dialogOpened' },\n  },\n  {\n    after: 1300,\n    by: 'demo',\n    press: 'switch-analytics',\n    action: { type: 'categorySwitched', id: 'analytics', isOn: true },\n  },\n  {\n    after: 900,\n    by: 'demo',\n    press: 'switch-preferences',\n    action: { type: 'categorySwitched', id: 'preferences', isOn: true },\n  },\n  {\n    after: 1300,\n    by: 'demo',\n    press: 'save',\n    action: { type: 'choicesSaved' },\n  },\n  {\n    after: 2600,\n    by: 'demo',\n    press: 'settings',\n    action: { type: 'dialogOpened' },\n  },\n  {\n    after: 1700,\n    by: 'demo',\n    press: 'reject-in-dialog',\n    action: { type: 'rejectedAll' },\n  },\n];\n\n/** Under reduced motion the banner waits with its three answers, as a visitor first sees it. */\nexport const RESTING = INITIAL;\n\nexport const LOOP_AFTER_MS = 3000;\n",
      "type": "registry:component",
      "target": "components/blocks/legal-02/session.ts"
    },
    {
      "path": "registry/ndeko/blocks/legal/legal-02/data.ts",
      "content": "export type OptionalCategoryId = 'preferences' | 'analytics' | 'marketing';\n\nexport type CategoryId = 'necessary' | OptionalCategoryId;\n\n/** What the visitor allowed. Necessary cookies cannot be refused, so they are always true. */\nexport type CookieConsent = {\n  necessary: true;\n  preferences: boolean;\n  analytics: boolean;\n  marketing: boolean;\n};\n\nexport type Category = {\n  id: CategoryId;\n  name: string;\n  line: string;\n};\n\nexport const SITE_NAME = 'Brightloom';\n\nexport const STORAGE_KEY = 'brightloom-cookie-consent';\n\nexport const NECESSARY: Category = {\n  id: 'necessary',\n  name: 'Necessary',\n  line: 'Keep you signed in, protect the forms and remember this choice. The site does not work without them, so they stay on.',\n};\n\nexport const OPTIONAL_CATEGORIES: (Category & { id: OptionalCategoryId })[] = [\n  {\n    id: 'preferences',\n    name: 'Preferences',\n    line: 'Remember your language, your text size and the guides you saved',\n  },\n  {\n    id: 'analytics',\n    name: 'Analytics',\n    line: 'Count visits and the pages people leave from, without your name',\n  },\n  {\n    id: 'marketing',\n    name: 'Marketing',\n    line: 'Let partners show you ads based on what you read here',\n  },\n];\n\nexport const ARTICLE = {\n  section: 'Guides',\n  title: 'Plan the week on one board',\n  meta: 'Nov 10, 2026 · 4 min read',\n  paragraphs: [\n    'A week that starts on a Monday morning meeting tends to end on a Friday list of what slipped. A board that the whole team can see turns that list into something you watch move, one card at a time.',\n    'Start with three lanes and nothing else: what is waiting, what someone holds right now, and what is done. Each card carries one owner and one sentence that says what done means. When a lane holds more cards than the people working it, that is the conversation to have before anything new comes in.',\n    'Keep the board where the work happens. A link pinned in the team channel gets opened; a board in a folder gets forgotten by Wednesday.',\n    'On Friday, read the done lane out loud. It takes two minutes and it is the only status update most teams need.',\n  ],\n};\n",
      "type": "registry:component",
      "target": "components/blocks/legal-02/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "legal"
  ],
  "type": "registry:block"
}