var o=Object.defineProperty;var c=(t)=>t;function m(t,r){this[t]=c.bind(null,r)}var g=(t,r)=>{for(var i in r)o(t,i,{get:r[i],enumerable:!0,configurable:!0,set:m.bind(r,i)})};var d=(t,r)=>()=>(t&&(r=t(t=0)),r);import{CodeBlock as n,InstallCommand as p}from"@contractspec/lib.design-system";import s from"@contractspec/lib.ui-link";import{ChevronRight as l}from"lucide-react";import{jsx as e,jsxs as a}from"react/jsx-runtime";function v(){return a("div",{className:"space-y-8",children:[a("div",{className:"space-y-4",children:[e("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.growth"}),e("p",{className:"text-lg text-muted-foreground",children:"Launch experiments without third-party SDKs. Register variants, assign users deterministically, track exposures, and compute significance."})]}),a("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Installation"}),e(p,{package:"@contractspec/lib.growth"})]}),a("div",{className:"space-y-3",children:[e("h2",{className:"font-bold text-2xl",children:"Register + assign"}),e(n,{language:"typescript",code:`import { ExperimentRegistry, ExperimentRunner } from '@contractspec/lib.growth/experiments';

const registry = new ExperimentRegistry().register({
  key: 'pricing.cta',
  version: '1.0.0',
  goal: 'Increase demo bookings',
  variants: [
    { id: 'A', weight: 1 },
    { id: 'B', weight: 1 },
  ],
  primaryMetric: 'demo_booked',
});

const runner = new ExperimentRunner();
const assignment = runner.assign(registry.get('pricing.cta')!, 'user_123');`})]}),a("div",{className:"space-y-3",children:[e("h2",{className:"font-bold text-2xl",children:"Track + analyze"}),e(n,{language:"typescript",code:`import { ExperimentTracker } from '@contractspec/lib.growth/tracker';
import { StatsEngine } from '@contractspec/lib.growth/stats';

const tracker = new ExperimentTracker(new InMemoryTrackerStore());
await tracker.recordAssignment(assignment);
await tracker.recordSample({
  experimentKey: assignment.experimentKey,
  variantId: assignment.variantId,
  metric: 'demo_booked',
  value: 1,
  timestamp: new Date(),
});

const stats = new StatsEngine().summarize(
  await tracker.getSamples(assignment.experimentKey, 'demo_booked'),
  'demo_booked'
);`})]}),a("div",{className:"flex items-center gap-4 pt-4",children:[e(s,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),a(s,{href:"/docs/libraries/analytics",className:"btn-primary",children:["Next: Analytics ",e(l,{size:16})]})]})]})}export{v as LibrariesGrowthPage};
