{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing",
  "title": "Pricing",
  "description": "A card per plan under a monthly and yearly switch whose prices roll to the new amount, with what the year saves, the plan you recommend outlined, what each plan includes, and every feature compared below. On a phone the comparison shows one plan at a time, and switching plans changes only the values that differ.",
  "dependencies": [],
  "registryDependencies": [
    "https://kinoui.com/r/animated-number.json",
    "https://kinoui.com/r/badge.json",
    "https://kinoui.com/r/button.json",
    "https://kinoui.com/r/card.json",
    "https://kinoui.com/r/segmented-control.json",
    "https://kinoui.com/r/table.json",
    "https://kinoui.com/r/announce.json",
    "https://kinoui.com/r/controllable.json",
    "https://kinoui.com/r/money.json",
    "https://kinoui.com/r/section-heading.json",
    "https://kinoui.com/r/swap.json",
    "https://kinoui.com/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/pricing/pricing.tsx",
      "content": "'use client'\n\nimport { Badge } from '@/registry/components/kino/badge'\nimport {\n  Card,\n  CardAction,\n  CardContent,\n  CardDescription,\n  CardHeader,\n  CardTitle,\n} from '@/registry/components/kino/card'\nimport { PricingComparison } from '@/registry/components/kino/pricing/pricing-comparison'\nimport type {\n  PricingBilling,\n  PricingFeatureGroup,\n  PricingPlan,\n} from '@/registry/components/kino/pricing/pricing-model'\nimport {\n  type BillingChangeDetails,\n  PlanAction,\n  PlanFeatures,\n  PlanPrice,\n  type PricingChoice,\n  PricingBillingSwitch,\n  PricingContext,\n  type PricingContextValue,\n  type PricingHeading,\n  usePricing,\n} from '@/registry/components/kino/pricing/pricing-parts'\nimport { announce } from '@/registry/lib/announce'\nimport { useControllable } from '@/registry/lib/controllable'\nimport { HEADING_BELOW, SectionHeading } from '@/registry/lib/section-heading'\nimport { type ComponentProps, type MouseEvent, type ReactNode, useId } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * A pricing page: a card per plan under a monthly and yearly switch whose\n * prices roll to the new amount, the plan you recommend outlined in the\n * primary colour, what each plan includes, and every feature compared\n * below, one plan at a time in a column as narrow as a phone.\n *\n *   <Pricing plans={plans} features={features} onChoose={startCheckout} />\n */\n\ninterface PricingProps extends Omit<ComponentProps<'section'>, 'title' | 'children'> {\n  plans: PricingPlan[]\n  /** The comparison under the plans, in groups; leave it out for the plans alone. */\n  features?: PricingFeatureGroup[]\n  billing?: PricingBilling\n  defaultBilling?: PricingBilling\n  onBillingChange?: (billing: PricingBilling, details: BillingChangeDetails) => void\n  /** The plan the comparison shows in a column as narrow as a phone. */\n  plan?: string\n  /** The plan picked at first: the one with a `badge`, unless you give another. */\n  defaultPlan?: string\n  onPlanChange?: (plan: string) => void\n  /** The plan the person is on, when they are signed in: its button says so. */\n  current?: string\n  /** The locale prices are written in. Give one, so the page's server and browser agree. */\n  locale?: Intl.LocalesArgument\n  /** The prices' ISO 4217 currency code. */\n  currency?: string\n  title?: ReactNode\n  description?: ReactNode\n  /** The title's level: the page's `h1` on a pricing page, lower inside another page. */\n  heading?: PricingHeading\n  /** The comparison's heading. */\n  comparisonTitle?: string\n  /** Under the plans: an offer for larger teams, or what the prices include. */\n  footer?: ReactNode\n  /** Runs when a plan's button is pressed, before its link is followed. */\n  onChoose?: (choice: PricingChoice, event: MouseEvent<HTMLElement>) => void\n}\n\nfunction Pricing({\n  plans,\n  features,\n  billing: billingProp,\n  defaultBilling = 'yearly',\n  onBillingChange,\n  plan: planProp,\n  defaultPlan,\n  onPlanChange,\n  current,\n  locale = 'en-US',\n  currency = 'USD',\n  title = 'Pricing',\n  description,\n  heading = 'h2',\n  comparisonTitle = 'Compare plans',\n  footer,\n  onChoose,\n  className,\n  ...props\n}: PricingProps) {\n  const recommended = plans.find((plan) => plan.badge)?.value\n  const [billing, setBilling] = useControllable<PricingBilling, [BillingChangeDetails]>(\n    billingProp,\n    defaultBilling,\n    onBillingChange,\n  )\n  const [plan, setPlan] = useControllable(\n    planProp,\n    defaultPlan ?? recommended ?? plans[0]?.value ?? '',\n    onPlanChange,\n  )\n  const titleId = useId()\n  const featuresId = useId()\n  const Subheading = HEADING_BELOW[heading]\n\n  const context: PricingContextValue = {\n    plans,\n    billing,\n    setBilling: (next, details) => {\n      setBilling(next, details)\n      // The prices change out of sight of a screen reader, which hears only the switch.\n      announce(`Prices are now billed ${next}`)\n    },\n    current,\n    locale,\n    currency,\n    onChoose,\n  }\n\n  return (\n    <PricingContext value={context}>\n      <section\n        data-slot='pricing'\n        aria-labelledby={titleId}\n        className={cn(\n          '@container flex min-h-full w-full min-w-0 flex-col gap-10 bg-background px-(--surface-padding) py-12 @3xl:py-16',\n          className,\n        )}\n        {...props}\n      >\n        <SectionHeading\n          id={titleId}\n          title={title}\n          description={description}\n          heading={heading}\n        >\n          <PricingBillingSwitch className='mt-3' />\n        </SectionHeading>\n\n        <PlanCards recommended={recommended} heading={Subheading} />\n\n        {footer}\n\n        {features ? (\n          <div className='flex min-w-0 flex-col gap-4 bg-inherit'>\n            <Subheading\n              id={featuresId}\n              className='text-xl font-medium tracking-tight @2xl:text-center'\n            >\n              {comparisonTitle}\n            </Subheading>\n            <PricingComparison\n              groups={features}\n              labelledBy={featuresId}\n              band={recommended}\n              plan={plan}\n              onPlanChange={setPlan}\n            />\n          </div>\n        ) : null}\n      </section>\n    </PricingContext>\n  )\n}\n\n/** A card per plan, their rows lined up across the cards. */\nfunction PlanCards({\n  recommended,\n  heading,\n}: {\n  recommended?: string\n  heading: 'h2' | 'h3' | 'h4'\n}) {\n  const { plans } = usePricing()\n  const Heading = heading\n  return (\n    <ul\n      data-slot='pricing-plans'\n      className='grid min-w-0 gap-4 @2xl:auto-cols-fr @2xl:grid-flow-col @2xl:grid-rows-[auto_auto_auto_1fr]'\n    >\n      {plans.map((plan) => {\n        const emphasis = plan.value === recommended\n        return (\n          <Card\n            key={plan.value}\n            render={<li />}\n            data-recommended={emphasis ? '' : undefined}\n            className={cn(\n              // Every card's name, price, button and features start on one line.\n              '@2xl:row-span-4 @2xl:grid @2xl:grid-rows-subgrid',\n              emphasis &&\n                'border-primary ring-primary ring-1 forced-colors:outline-2 forced-colors:outline-[Highlight]',\n            )}\n          >\n            <CardHeader>\n              <CardTitle render={<Heading />}>{plan.name}</CardTitle>\n              {plan.badge ? (\n                <CardAction>\n                  <Badge>{plan.badge}</Badge>\n                </CardAction>\n              ) : null}\n              <CardDescription>\n                {/* Its own direction, so its words read the same way round right to left. */}\n                <bdi>{plan.description}</bdi>\n              </CardDescription>\n            </CardHeader>\n            <CardContent>\n              <PlanPrice plan={plan} />\n            </CardContent>\n            <CardContent>\n              <PlanAction plan={plan} emphasis={emphasis} />\n            </CardContent>\n            <CardContent className='border-t pt-(--surface-padding)'>\n              <PlanFeatures plan={plan} />\n            </CardContent>\n          </Card>\n        )\n      })}\n    </ul>\n  )\n}\n\nexport { Pricing, type PricingProps }\n",
      "type": "registry:component",
      "target": "@components/kino/pricing/pricing.tsx"
    },
    {
      "path": "registry/components/kino/pricing/pricing-parts.tsx",
      "content": "'use client'\n\nimport { AnimatedNumber } from '@/registry/components/kino/animated-number'\nimport { Badge } from '@/registry/components/kino/badge'\nimport { Button, buttonVariants } from '@/registry/components/kino/button'\nimport {\n  type PricingBilling,\n  type PricingPlan,\n  savingPercent,\n  yearlyTotal,\n} from '@/registry/components/kino/pricing/pricing-model'\nimport {\n  SegmentedControl,\n  SegmentedControlItem,\n} from '@/registry/components/kino/segmented-control'\nimport { IconPlaceholder } from '@/registry/icons/icon-placeholder'\nimport { formatAmount, moneyFormat } from '@/registry/lib/money'\nimport type { SectionHeadingLevel } from '@/registry/lib/section-heading'\nimport { Swap } from '@/registry/lib/swap'\nimport { type ComponentProps, createContext, type MouseEvent, use } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * What every arrangement of the Pricing block shares: the billing switch,\n * a plan's price that rolls to its new amount, its button, its features,\n * and a value in the comparison.\n */\n\ntype PricingHeading = SectionHeadingLevel\n\ninterface PricingChoice {\n  plan: string\n  billing: PricingBilling\n}\n\ninterface PricingContextValue {\n  plans: PricingPlan[]\n  billing: PricingBilling\n  setBilling: (billing: PricingBilling, details: BillingChangeDetails) => void\n  /** The plan the person is on, if they are signed in. */\n  current?: string\n  locale: Intl.LocalesArgument\n  currency: string\n  onChoose?: (choice: PricingChoice, event: MouseEvent<HTMLElement>) => void\n}\n\n/** What a change of billing comes with: the Segmented control's change details. */\ntype BillingChangeDetails = Parameters<\n  NonNullable<ComponentProps<typeof SegmentedControl>['onValueChange']>\n>[1]\n\nconst PricingContext = createContext<PricingContextValue | null>(null)\n\nfunction usePricing() {\n  const context = use(PricingContext)\n  if (!context) throw new Error('A Pricing part must be inside Pricing.')\n  return context\n}\n\n/** Monthly or yearly, with what the year saves on the yearly side. */\nfunction PricingBillingSwitch({ className }: { className?: string }) {\n  const { plans, billing, setBilling } = usePricing()\n  const { most, same } = savingPercent(plans)\n  return (\n    <SegmentedControl\n      aria-label='Billing period'\n      value={billing}\n      onValueChange={(next, details) => setBilling(next as PricingBilling, details)}\n      className={className}\n    >\n      <SegmentedControlItem value='monthly'>Monthly</SegmentedControlItem>\n      <SegmentedControlItem value='yearly'>\n        Yearly\n        {/* A space the row doesn't draw, so an agent reads \"Yearly Save 20%\". */}\n        {most > 0 ? ' ' : null}\n        {most > 0 ? (\n          <Badge variant='secondary'>\n            {/* Shorter in a column as narrow as a small phone, so the switch fits it; read in full. */}\n            <span className='@max-xs:sr-only'>\n              {same ? `Save ${most}%` : `Save up to ${most}%`}\n            </span>\n            <span aria-hidden className='@xs:hidden'>\n              {same ? `−${most}%` : `Up to −${most}%`}\n            </span>\n          </Badge>\n        ) : null}\n      </SegmentedControlItem>\n    </SegmentedControl>\n  )\n}\n\n/**\n * What the plan costs a month, rolling to the new amount when the billing\n * changes: large on its card, smaller and centred in the comparison's header.\n */\nfunction PlanPrice({\n  plan,\n  size = 'default',\n  className,\n}: {\n  plan: PricingPlan\n  size?: 'default' | 'sm'\n  className?: string\n}) {\n  const { billing, locale, currency } = usePricing()\n  const amount = plan.price[billing]\n  const free = plan.price.monthly === 0\n  const total = yearlyTotal(plan)\n  const money = formatAmount(total, currency, 'when-needed', locale)\n  const small = size === 'sm'\n  // As text, so the line rolls when it changes.\n  const billed =\n    plan.note ??\n    (free\n      ? 'Free forever'\n      : billing === 'monthly'\n        ? 'Billed monthly'\n        : plan.per\n          ? `${money} per ${plan.per}, billed yearly`\n          : `${money} billed yearly`)\n  return (\n    <div\n      className={cn(\n        'flex min-w-0 flex-col',\n        small ? 'items-center gap-0.5 text-center' : 'gap-1',\n        className,\n      )}\n    >\n      <p\n        className={cn(\n          'flex min-w-0 flex-wrap items-baseline gap-x-1.5',\n          small && 'justify-center',\n        )}\n      >\n        <AnimatedNumber\n          value={amount}\n          locale={locale}\n          format={moneyFormat(currency, amount, 'when-needed')}\n          className={cn(\n            'text-foreground font-medium tracking-tight',\n            small ? 'text-2xl' : 'text-4xl',\n          )}\n        />\n        {free ? null : (\n          <span className={cn('text-muted-foreground', small ? 'text-xs' : 'text-sm')}>\n            {plan.per ? `per ${plan.per} a month` : 'a month'}\n          </span>\n        )}\n      </p>\n      <p\n        className={cn(\n          'text-muted-foreground flex max-w-full min-w-0',\n          small ? 'justify-center text-xs' : 'text-sm',\n        )}\n      >\n        {/* Its words keep their own direction, so `$96 per member` reads the same way round right to left. */}\n        <Swap roll align={small ? 'center' : 'start'}>\n          <bdi>{billed}</bdi>\n        </Swap>\n      </p>\n    </div>\n  )\n}\n\n/** The plan's button: its link, or the plan the person is already on. */\nfunction PlanAction({\n  plan,\n  emphasis,\n  size = 'default',\n  className,\n  onClick,\n  ...props\n}: Omit<ComponentProps<'a'>, 'href' | 'children' | 'className'> & {\n  plan: Pick<PricingPlan, 'value' | 'action'>\n  /** The plan you recommend, in the primary colour; the rest are outlined. */\n  emphasis: boolean\n  size?: 'default' | 'sm'\n  className?: string\n}) {\n  const { billing, current, onChoose } = usePricing()\n  if (current === plan.value) {\n    return (\n      <Button variant='outline' size={size} disabled className={cn('w-full', className)}>\n        Current plan\n      </Button>\n    )\n  }\n  return (\n    // A link in a Button's look, as it goes to another page.\n    <a\n      {...props}\n      href={plan.action.href}\n      onClick={(event) => {\n        onClick?.(event)\n        onChoose?.({ plan: plan.value, billing }, event)\n      }}\n      className={cn(\n        buttonVariants({ variant: emphasis ? 'default' : 'outline', size }),\n        'w-full',\n        className,\n      )}\n    >\n      {plan.action.label}\n    </a>\n  )\n}\n\nconst CheckMark = (props: { className?: string }) => (\n  <IconPlaceholder\n    lucide='CheckIcon'\n    tabler='IconCheck'\n    hugeicons='Tick02Icon'\n    phosphor='CheckIcon'\n    remixicon='RiCheckLine'\n    aria-hidden\n    {...props}\n  />\n)\n\n/** What the plan is for, a line each, under the line that leads them. */\nfunction PlanFeatures({\n  plan,\n  className,\n}: {\n  plan: Pick<PricingPlan, 'featuresTitle' | 'features'>\n  className?: string\n}) {\n  return (\n    <div className={cn('flex min-w-0 flex-col gap-3 text-sm', className)}>\n      {plan.featuresTitle ? <p className='font-medium'>{plan.featuresTitle}</p> : null}\n      <ul className='flex flex-col gap-2'>\n        {plan.features.map((feature) => (\n          <li key={feature} className='flex min-w-0 gap-2'>\n            <CheckMark className='text-muted-foreground mt-0.5 size-4 shrink-0' />\n            <span className='min-w-0 text-pretty'>\n              <bdi>{feature}</bdi>\n            </span>\n          </li>\n        ))}\n      </ul>\n    </div>\n  )\n}\n\n/** A value in the comparison: included and not as a mark with words for screen readers, or the value. */\nfunction FeatureValue({ value }: { value: boolean | string | undefined }) {\n  // Its own direction, so `250 MB` reads the same way round in a page that runs right to left.\n  if (typeof value === 'string')\n    return (\n      <span dir='auto' className='tabular-nums'>\n        {value}\n      </span>\n    )\n  return value ? (\n    <span className='inline-flex align-middle'>\n      <CheckMark className='size-4' />\n      <span className='sr-only'>Included</span>\n    </span>\n  ) : (\n    <span className='text-muted-foreground inline-flex align-middle'>\n      <IconPlaceholder\n        lucide='MinusIcon'\n        tabler='IconMinus'\n        hugeicons='MinusSignIcon'\n        phosphor='MinusIcon'\n        remixicon='RiSubtractLine'\n        aria-hidden\n        className='size-4'\n      />\n      <span className='sr-only'>Not included</span>\n    </span>\n  )\n}\n\nexport {\n  FeatureValue,\n  PlanAction,\n  PlanFeatures,\n  PlanPrice,\n  PricingBillingSwitch,\n  PricingContext,\n  usePricing,\n  type BillingChangeDetails,\n  type PricingChoice,\n  type PricingContextValue,\n  type PricingHeading,\n}\n",
      "type": "registry:component",
      "target": "@components/kino/pricing/pricing-parts.tsx"
    },
    {
      "path": "registry/components/kino/pricing/pricing-comparison.tsx",
      "content": "'use client'\n\nimport { Badge } from '@/registry/components/kino/badge'\nimport {\n  planStep,\n  type PricingFeatureGroup,\n  type PricingPlan,\n} from '@/registry/components/kino/pricing/pricing-model'\nimport {\n  FeatureValue,\n  PlanAction,\n  PlanPrice,\n  usePricing,\n} from '@/registry/components/kino/pricing/pricing-parts'\nimport {\n  SegmentedControl,\n  SegmentedControlItem,\n} from '@/registry/components/kino/segmented-control'\nimport {\n  Table,\n  TableBody,\n  TableCell,\n  TableHead,\n  TableHeader,\n  TableRow,\n} from '@/registry/components/kino/table'\nimport { Swap } from '@/registry/lib/swap'\nimport { type ReactNode, useState } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * Every plan's features side by side, grouped, a column per plan under a\n * header that holds each plan's name, price and button and sticks to the\n * page as the rows scroll by. In a column narrower than a tablet's it shows\n * one plan at a time, picked in a switch that sticks instead, and switching\n * plans changes only the values that differ, in place, so the switch shows\n * what one plan has that the other hasn't. `--pricing-top` sets how\n * far from the top they stick, below a page's own sticky header.\n */\n\n// A plan's own column shows from a tablet's width up; the one picked column below it.\nconst wideOnly = 'hidden @2xl:table-cell'\nconst narrowOnly = '@2xl:hidden'\nconst stickyTop = 'top-(--pricing-top,0px)'\n\n/**\n * The plan you recommend, marked down its whole column as its card is: an\n * outline in the primary colour and a tint, from the header to the last row,\n * square where its cells meet and round at its two ends. Both fade in and\n * out as the mark moves to another plan. Muted text in it darkens, as in a\n * picked choice card, so it keeps 4.5:1 on the tint.\n */\nconst bandClassName =\n  'relative after:pointer-events-none after:absolute after:inset-x-0 after:-inset-y-px after:border-x after:border-primary after:opacity-0 after:transition-opacity after:duration-(--motion-press-duration) after:ease-(--motion-press-fade-easing) data-band:after:opacity-100 [&_.text-muted-foreground]:transition-[color] [&_.text-muted-foreground]:duration-(--motion-press-duration) [&_.text-muted-foreground]:ease-(--motion-press-fade-easing) data-band:bg-primary/5 dark:data-band:bg-primary/10 data-band:[--muted-foreground:color-mix(in_oklab,var(--foreground)_70%,var(--background))] rounded-none! in-[thead>tr:first-child]:rounded-t-(--surface-radius)! in-[thead>tr:first-child]:after:rounded-t-(--surface-radius) in-[thead>tr:first-child]:after:border-t in-[tbody:last-of-type>tr:last-child]:rounded-b-(--surface-radius)! in-[tbody:last-of-type>tr:last-child]:after:rounded-b-(--surface-radius) in-[tbody:last-of-type>tr:last-child]:after:border-b'\n\nfunction PricingComparison({\n  groups,\n  labelledBy,\n  band,\n  plan: picked,\n  onPlanChange: setPlan,\n  className,\n}: {\n  groups: PricingFeatureGroup[]\n  /** The id of the heading that names the table. */\n  labelledBy: string\n  /** The plan whose column is marked, and whose button is in the primary colour. */\n  band?: string\n  /** The plan it shows in a column as narrow as a phone. */\n  plan: string\n  onPlanChange: (plan: string) => void\n  className?: string\n}) {\n  const { plans } = usePricing()\n  const pickedPlan = plans.find((plan) => plan.value === picked) ?? plans[0]\n  // The picked column's values slide the way the plans run, to a later plan or back.\n  const [seen, setSeen] = useState<{ plan: string; slide: 1 | -1 }>({\n    plan: pickedPlan.value,\n    slide: 1,\n  })\n  if (seen.plan !== pickedPlan.value) {\n    setSeen({\n      plan: pickedPlan.value,\n      slide: planStep(plans, seen.plan, pickedPlan.value),\n    })\n  }\n  const slide = seen.slide\n\n  /** The plan's own cell, from a tablet's width up, and the picked plan's, below it. */\n  const cells = (\n    cell: (plan: PricingPlan) => ReactNode,\n    Cell: typeof TableCell | typeof TableHead = TableCell,\n    cellClassName?: string,\n  ) => (\n    <>\n      {plans.map((plan) => (\n        <Cell\n          key={plan.value}\n          data-band={band === plan.value ? '' : undefined}\n          className={cn(wideOnly, bandClassName, 'text-center', cellClassName)}\n        >\n          {cell(plan)}\n        </Cell>\n      ))}\n      <Cell\n        data-band={band === pickedPlan.value ? '' : undefined}\n        className={cn(narrowOnly, bandClassName, 'text-center', cellClassName)}\n      >\n        {/* Its height glides to the new plan's, so the rows below follow. */}\n        <Swap slide={slide} wait block>\n          {cell(pickedPlan)}\n        </Swap>\n      </Cell>\n    </>\n  )\n\n  return (\n    <div className={cn('flex min-w-0 flex-col gap-1 bg-inherit', className)}>\n      <div\n        className={cn(\n          narrowOnly,\n          stickyTop,\n          'sticky z-30 flex justify-center bg-inherit py-2',\n        )}\n      >\n        <SegmentedControl\n          aria-label='Plan to compare'\n          value={pickedPlan.value}\n          onValueChange={(next) => setPlan(next as string)}\n        >\n          {plans.map((plan) => (\n            <SegmentedControlItem key={plan.value} value={plan.value}>\n              {plan.name}\n            </SegmentedControlItem>\n          ))}\n        </SegmentedControl>\n      </div>\n      <Table\n        aria-labelledby={labelledBy}\n        variant='lined'\n        scroll={false}\n        className='table-fixed'\n      >\n        <TableHeader className={cn(stickyTop, '@max-2xl:static')}>\n          {/* Names, prices and buttons in rows of their own, so each lines up\n              across the plans, and a column's header is only its plan's name. */}\n          <TableRow>\n            <TableHead rowSpan={3} className='border-b-border w-1/2 @2xl:w-auto'>\n              <span className='sr-only'>Feature</span>\n            </TableHead>\n            {cells(\n              (plan) => (\n                <span className='flex flex-wrap items-center justify-center gap-x-2 gap-y-1'>\n                  {plan.name}\n                  {/* A space a flex row doesn't draw, so the header reads \"Pro Most popular\". */}\n                  {plan.badge ? (\n                    <>\n                      {' '}\n                      <Badge>{plan.badge}</Badge>\n                    </>\n                  ) : null}\n                </span>\n              ),\n              TableHead,\n              'text-foreground h-auto pt-4 pb-2 align-bottom text-base font-medium whitespace-normal border-b-0',\n            )}\n          </TableRow>\n          <TableRow>\n            {cells(\n              (plan) => (\n                <PlanPrice plan={plan} size='sm' />\n              ),\n              TableCell,\n              'h-auto py-1 align-top whitespace-normal',\n            )}\n          </TableRow>\n          <TableRow>\n            {cells(\n              (plan) => (\n                <PlanAction\n                  plan={plan}\n                  emphasis={plan.value === band}\n                  size='sm'\n                  className='max-w-48'\n                />\n              ),\n              TableCell,\n              'border-b-border h-auto border-b pt-3 pb-4 align-top',\n            )}\n          </TableRow>\n        </TableHeader>\n        {groups.map((group) => (\n          <TableBody key={group.name}>\n            <TableRow>\n              <TableHead\n                scope='rowgroup'\n                className='text-foreground h-auto pt-8 pb-3 align-bottom text-sm font-medium whitespace-normal'\n              >\n                {group.name}\n              </TableHead>\n              {/* Empty, so a marked column runs on through the group's title. */}\n              {cells(() => null)}\n            </TableRow>\n            {group.features.map((feature) => (\n              <TableRow key={feature.name}>\n                <TableHead scope='row' className='font-normal whitespace-normal'>\n                  {feature.name}\n                </TableHead>\n                {cells((plan) => (\n                  <FeatureValue value={feature.values[plan.value]} />\n                ))}\n              </TableRow>\n            ))}\n          </TableBody>\n        ))}\n      </Table>\n    </div>\n  )\n}\n\nexport { PricingComparison }\n",
      "type": "registry:component",
      "target": "@components/kino/pricing/pricing-comparison.tsx"
    },
    {
      "path": "registry/components/kino/pricing/pricing-model.ts",
      "content": "/*\n * The Pricing block's plans and the sums it shows from them: what a year\n * comes to, and how much paying for the year saves. Prices are what a month\n * costs, as every pricing page shows them, so a yearly price is the month's\n * share of the year's bill.\n */\n\ntype PricingBilling = 'monthly' | 'yearly'\n\ninterface PricingPlan {\n  /** Names the plan in the comparison's values, the pick and `onChoose`. */\n  value: string\n  name: string\n  /** Who it's for, in a line. */\n  description: string\n  /**\n   * What a month costs, billed monthly and billed yearly, in the currency's\n   * units: `{ monthly: 10, yearly: 8 }`. A free plan costs 0 on both.\n   */\n  price: { monthly: number; yearly: number }\n  /** What one price buys, when it isn't the whole plan: `member`, for a price per member. */\n  per?: string\n  /** Under the price, in place of how it's billed: `Free for up to 3 members`. */\n  note?: string\n  /** The line that leads its features: `Everything in Free, plus`. */\n  featuresTitle?: string\n  /** What it's for, a line each, the ones that set it apart first. */\n  features: string[]\n  /** Its button: what it says, and where it goes. */\n  action: { label: string; href: string }\n  /** Marks the plan you recommend, with this label: `Most popular`. */\n  badge?: string\n}\n\n/** A row of the comparison, by plan: included, not, or a value such as `10 GB`. */\ninterface PricingFeature {\n  name: string\n  values: Record<string, boolean | string>\n}\n\ninterface PricingFeatureGroup {\n  name: string\n  features: PricingFeature[]\n}\n\n/** Cents survive the sums: 12 × 9.99 is 119.88, never 119.88000000000001. */\nconst round = (amount: number) => Math.round(amount * 100) / 100\n\n/** What a year costs, paid yearly: twelve of its months. */\nfunction yearlyTotal(plan: PricingPlan) {\n  return round(plan.price.yearly * 12)\n}\n\n/**\n * How much the yearly price takes off the monthly one, as a whole percent,\n * rounded down so it never promises more than it gives: the most any paid\n * plan saves, and whether every paid plan saves that much.\n */\nfunction savingPercent(plans: readonly Pick<PricingPlan, 'price'>[]): {\n  most: number\n  same: boolean\n} {\n  const percents = plans.flatMap(({ price }) =>\n    price.monthly > 0\n      ? // Nudged up, so 20% worked out as 19.999… still reads as 20.\n        [Math.floor(((price.monthly - price.yearly) / price.monthly) * 100 + 1e-9)]\n      : [],\n  )\n  const most = Math.max(0, ...percents)\n  return { most, same: percents.every((percent) => percent === most) }\n}\n\n/** Which way the plans run from `from` to `to`: 1 to a later plan, -1 to an earlier one. */\nfunction planStep(plans: PricingPlan[], from: string, to: string): 1 | -1 {\n  const index = (value: string) => plans.findIndex((plan) => plan.value === value)\n  return index(to) < index(from) ? -1 : 1\n}\n\nexport {\n  planStep,\n  savingPercent,\n  yearlyTotal,\n  type PricingBilling,\n  type PricingFeature,\n  type PricingFeatureGroup,\n  type PricingPlan,\n}\n",
      "type": "registry:component",
      "target": "@components/kino/pricing/pricing-model.ts"
    }
  ],
  "type": "registry:block"
}