@orangecheck/app-design 1.2.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/chrome.d.mts +8 -3
  2. package/dist/chrome.d.ts +8 -3
  3. package/dist/chrome.js +605 -553
  4. package/dist/chrome.js.map +1 -1
  5. package/dist/chrome.mjs +605 -555
  6. package/dist/chrome.mjs.map +1 -1
  7. package/dist/code.js +3 -1
  8. package/dist/code.js.map +1 -1
  9. package/dist/code.mjs +3 -1
  10. package/dist/code.mjs.map +1 -1
  11. package/dist/components.d.mts +3 -3
  12. package/dist/components.d.ts +3 -3
  13. package/dist/components.js +730 -666
  14. package/dist/components.js.map +1 -1
  15. package/dist/components.mjs +731 -667
  16. package/dist/components.mjs.map +1 -1
  17. package/dist/{docs-Dxg4Tp_q.d.ts → docs-BB9gK4KF.d.ts} +18 -4
  18. package/dist/{docs-wJBfLS08.d.mts → docs-D-T-nHiu.d.mts} +18 -4
  19. package/dist/index.d.mts +4 -4
  20. package/dist/index.d.ts +4 -4
  21. package/dist/index.js +1549 -1406
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +1548 -1407
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/mdx.d.mts +6 -2
  26. package/dist/mdx.d.ts +6 -2
  27. package/dist/mdx.js +168 -74
  28. package/dist/mdx.js.map +1 -1
  29. package/dist/mdx.mjs +169 -75
  30. package/dist/mdx.mjs.map +1 -1
  31. package/dist/primitives.d.mts +9 -3
  32. package/dist/primitives.d.ts +9 -3
  33. package/dist/primitives.js +7 -6
  34. package/dist/primitives.js.map +1 -1
  35. package/dist/primitives.mjs +7 -6
  36. package/dist/primitives.mjs.map +1 -1
  37. package/dist/session.d.mts +4 -3
  38. package/dist/session.d.ts +4 -3
  39. package/dist/session.js +27 -3
  40. package/dist/session.js.map +1 -1
  41. package/dist/session.mjs +27 -3
  42. package/dist/session.mjs.map +1 -1
  43. package/dist/styles/swagger.css +252 -0
  44. package/dist/styles/tokens.css +2 -0
  45. package/dist/{tool-shell-kqGWMTep.d.mts → tool-shell-D8Q8XX11.d.mts} +8 -5
  46. package/dist/{tool-shell-DLSwUxTD.d.ts → tool-shell-gmlj47Ie.d.ts} +8 -5
  47. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -12,14 +12,15 @@ import * as LabelPrimitive from '@radix-ui/react-label';
12
12
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
13
13
  import * as SelectPrimitive from '@radix-ui/react-select';
14
14
  import * as SwitchPrimitive from '@radix-ui/react-switch';
15
- import { ChevronDown, Check, X, Search, ArrowUpRight, ArrowRight, Copy, ChevronLeft, ChevronRight, CornerDownLeft, Download, FileText, Upload, Menu, PanelLeft, Sun, Moon, SunMoon, CircleUser, LogOut, ArrowLeft, Lock, CircleDashed, CircleMinus, Clock, CircleX, CircleCheck } from 'lucide-react';
15
+ import { ChevronDown, Check, X, Search, ArrowUpRight, ArrowRight, Copy, ChevronLeft, ChevronRight, CornerDownLeft, Download, FileText, Upload, Menu, Sun, Moon, SunMoon, PanelLeft, CircleUser, LogOut, ArrowLeft, Lock, CircleDashed, CircleMinus, CircleSlash, Clock, CircleX, CircleCheck } from 'lucide-react';
16
16
  import * as DialogPrimitive from '@radix-ui/react-dialog';
17
17
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
18
18
  import * as PopoverPrimitive from '@radix-ui/react-popover';
19
19
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
20
20
  import * as TabsPrimitive from '@radix-ui/react-tabs';
21
21
  import QRCode from 'qrcode';
22
- import Link8 from 'next/link';
22
+ import Link6 from 'next/link';
23
+ import { useRouter } from 'next/compat/router';
23
24
  import { useTheme } from 'next-themes';
24
25
 
25
26
  // src/tokens/index.ts
@@ -425,16 +426,17 @@ var Label = forwardRef(function Label2({ className, ...props }, ref) {
425
426
  }
426
427
  );
427
428
  });
428
- function Field({ label, hint, optional, error, children, className, hideLabel, action }) {
429
- const id = useId();
429
+ function Field({ label, hint, optional, error, children, id: fixedId, className, hideLabel, action }) {
430
+ const generated = useId();
431
+ const id = fixedId ?? generated;
430
432
  const hintId = hint ? `${id}-hint` : void 0;
431
433
  const errorId = error ? `${id}-error` : void 0;
432
- const describedBy = [hintId, errorId].filter(Boolean).join(" ") || void 0;
433
- const control = isValidElement(children) ? cloneElement(children, {
434
+ const wiring = {
434
435
  id,
435
- "aria-describedby": describedBy,
436
+ "aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
436
437
  "aria-invalid": error ? true : void 0
437
- }) : children;
438
+ };
439
+ const control = typeof children === "function" ? children(wiring) : isValidElement(children) ? cloneElement(children, { ...wiring }) : children;
438
440
  const hintNode = hint ? /* @__PURE__ */ jsx("p", { id: hintId, className: "text-[0.8125rem] leading-snug text-muted-foreground", children: hint }) : null;
439
441
  return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2", className), children: [
440
442
  /* @__PURE__ */ jsxs(Label, { htmlFor: id, className: hideLabel ? "sr-only" : "flex items-baseline gap-2", children: [
@@ -2969,11 +2971,13 @@ function forClipboard(text, lang) {
2969
2971
  if (!lines.some((l) => l.startsWith("$ "))) return text;
2970
2972
  return lines.filter((l) => l.startsWith("$ ")).map((l) => l.slice(2)).join("\n");
2971
2973
  }
2972
- function linesFromDom(pre) {
2974
+ function linesFromDom(pre, newline) {
2973
2975
  if (!pre) return null;
2974
2976
  const lines = pre.querySelectorAll("[data-line]");
2975
2977
  if (lines.length === 0) return pre.textContent ?? "";
2976
- return Array.from(lines).filter((l) => l.getAttribute("data-diff") !== "remove").map((l) => l.textContent ?? "").join("\n");
2978
+ const text = Array.from(lines).filter((l) => l.getAttribute("data-diff") !== "remove").map((l) => l.textContent ?? "").join("\n");
2979
+ return newline ? `${text}
2980
+ ` : text;
2977
2981
  }
2978
2982
  function prepare(code, lang, marks, diff) {
2979
2983
  const d = diff ? readDiff(code) : null;
@@ -2982,7 +2986,8 @@ function prepare(code, lang, marks, diff) {
2982
2986
  const kept = d ? src.split("\n").filter((_, i) => d.diff.get(i + 1) !== "remove") : null;
2983
2987
  return {
2984
2988
  html: linesToHtml(lines, { highlight: parseLineRanges(marks), diff: d?.diff }),
2985
- copy: kept ? kept.join("\n") : src,
2989
+ // Byte for byte, the final newline too: a hash printed beside the code must match a copy of it.
2990
+ copy: kept ? kept.join("\n") + (/\n$/.test(code) ? "\n" : "") : code,
2986
2991
  lines: lines.length,
2987
2992
  diff: !!d
2988
2993
  };
@@ -3047,6 +3052,7 @@ function CodeBlock({
3047
3052
  code,
3048
3053
  html,
3049
3054
  children,
3055
+ trailingNewline = false,
3050
3056
  lang,
3051
3057
  caption,
3052
3058
  copy = true,
@@ -3067,7 +3073,7 @@ function CodeBlock({
3067
3073
  );
3068
3074
  const markup = prepared?.html ?? html;
3069
3075
  const lines = prepared?.lines ?? (html !== void 0 ? html.split("\n").length : code?.split("\n").length ?? 0);
3070
- const read = () => forClipboard(prepared?.copy ?? linesFromDom(preRef.current) ?? code ?? "", lang);
3076
+ const read = () => forClipboard(prepared?.copy ?? linesFromDom(preRef.current, trailingNewline) ?? code ?? "", lang);
3071
3077
  return /* @__PURE__ */ jsxs("figure", { className: cn(FRAME, className), children: [
3072
3078
  /* @__PURE__ */ jsxs("figcaption", { className: "flex h-11 items-center justify-between gap-3 border-b border-[var(--oca-code-line)] pl-5 pr-2", children: [
3073
3079
  /* @__PURE__ */ jsx("span", { className: "truncate text-[0.8125rem] text-oca-ink-subtle", children: caption ?? languageName(lang) ?? "Code" }),
@@ -3584,7 +3590,7 @@ function ErrorPage({
3584
3590
  /* @__PURE__ */ jsx("p", { className: "oca-lead oca-enter [--enter-delay:150ms]", children: detail ?? words.detail }),
3585
3591
  /* @__PURE__ */ jsx("div", { className: "oca-enter flex flex-wrap gap-3 [--enter-delay:230ms]", children: actions ?? /* @__PURE__ */ jsxs(Fragment, { children: [
3586
3592
  server ? /* @__PURE__ */ jsx(Button, { onClick: () => window.location.reload(), children: "Try again" }) : null,
3587
- /* @__PURE__ */ jsx(Button, { asChild: true, variant: server ? "secondary" : "primary", children: /* @__PURE__ */ jsx(Link8, { href: home, children: "Go home" }) })
3593
+ /* @__PURE__ */ jsx(Button, { asChild: true, variant: server ? "secondary" : "primary", children: /* @__PURE__ */ jsx(Link6, { href: home, children: "Go home" }) })
3588
3594
  ] }) })
3589
3595
  ] }),
3590
3596
  art !== null ? /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "oca-enter hidden justify-center md:col-span-5 md:flex [--enter-delay:120ms]", children: art ?? /* @__PURE__ */ jsx(MarkOutline, { className: "w-full max-w-[20rem] text-oca-hairline-strong" }) }) : null
@@ -3703,16 +3709,25 @@ function Faq({
3703
3709
  return /* @__PURE__ */ jsx(Accordion, { single: true, className, children: items.map((it, i) => /* @__PURE__ */ jsx(AccordionItem, { id: it.id, title: it.q, children: it.a }, it.id ?? i)) });
3704
3710
  }
3705
3711
  var LINK = "text-foreground underline decoration-foreground/35 underline-offset-4 transition-colors hover:decoration-foreground";
3712
+ var SCHEME = /^[a-z][a-z\d+.-]*:/i;
3713
+ function useResolved(href) {
3714
+ const router = useRouter();
3715
+ if (!router || !href || href.startsWith("/") || href.startsWith("#") || href.startsWith("?") || SCHEME.test(href)) return href;
3716
+ const here = router.asPath.split(/[?#]/)[0] || "/";
3717
+ const url = new URL(href, `https://page.invalid${here}`);
3718
+ return url.pathname + url.search + url.hash;
3719
+ }
3706
3720
  function TextLink({
3707
- href,
3721
+ href: written,
3708
3722
  children,
3709
3723
  external,
3710
3724
  className
3711
3725
  }) {
3726
+ const href = useResolved(written);
3712
3727
  const internal = href.startsWith("/") && !href.startsWith("/api/") && !href.startsWith("/.well-known/");
3713
3728
  const offsite = external ?? /^https?:\/\//.test(href);
3714
3729
  if (internal && !offsite) {
3715
- return /* @__PURE__ */ jsx(Link8, { href, className: cn(LINK, className), children });
3730
+ return /* @__PURE__ */ jsx(Link6, { href, className: cn(LINK, className), children });
3716
3731
  }
3717
3732
  return /* @__PURE__ */ jsxs("a", { href, className: cn(LINK, className), ...offsite ? { target: "_blank", rel: "noreferrer" } : {}, children: [
3718
3733
  children,
@@ -3980,6 +3995,10 @@ var OCHK_IO_FOOTER = [
3980
3995
  ]
3981
3996
  }
3982
3997
  ];
3998
+ var InDocsContext = sharedContext("in-docs", false);
3999
+ function useInDocs() {
4000
+ return useContext(InDocsContext);
4001
+ }
3983
4002
  var CARD = "group relative flex h-full flex-col rounded-[1.25rem] border border-border bg-card p-6 transition-colors hover:border-oca-hairline-strong md:p-7 has-[a:focus-visible]:ring-2 has-[a:focus-visible]:ring-ring has-[a:focus-visible]:ring-offset-2 has-[a:focus-visible]:ring-offset-background";
3984
4003
  var STRETCH = 'outline-none after:absolute after:inset-0 after:rounded-[1.25rem] after:content-[""]';
3985
4004
  var pad2 = (n) => String(n + 1).padStart(2, "0");
@@ -3988,6 +4007,7 @@ function ProtocolGrid({
3988
4007
  link = "page",
3989
4008
  className
3990
4009
  }) {
4010
+ const inDocs = useInDocs();
3991
4011
  return /* @__PURE__ */ jsx("ul", { className: cn("grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 md:gap-5", className), children: protocols.map((slug) => {
3992
4012
  const p = protocolSite(slug);
3993
4013
  const i = PROTOCOL_ORDER.indexOf(slug);
@@ -4000,7 +4020,7 @@ function ProtocolGrid({
4000
4020
  ] }),
4001
4021
  p.status !== "live" ? /* @__PURE__ */ jsx(StatusBadge, { status: p.status }) : null
4002
4022
  ] }),
4003
- /* @__PURE__ */ jsx("h3", { className: "oca-display-3", children: /* @__PURE__ */ jsx(
4023
+ /* @__PURE__ */ jsx("h3", { className: "oca-display-3", children: link === "docs" && inDocs ? /* @__PURE__ */ jsx(Link6, { href: `/${p.slug}`, className: STRETCH, children: p.label }) : /* @__PURE__ */ jsx(
4004
4024
  "a",
4005
4025
  {
4006
4026
  href: link === "tool" ? p.toolHref : link === "docs" ? `${DOCS_HREF}/${p.slug}` : p.pageHref,
@@ -4058,751 +4078,795 @@ function AppGrid({
4058
4078
  const list = sites ? sites.map((slug) => FAMILY.find((s) => s.slug === slug)).filter((s) => s !== void 0) : FAMILY.filter((s) => s.group === group);
4059
4079
  return /* @__PURE__ */ jsx("ul", { className: cn("grid grid-cols-1 gap-4 sm:grid-cols-2 md:gap-5", className), children: list.map((s) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(AppCard, { name: s.label, line: s.line, href: s.href, protocols: s.protocols, status: s.status }) }, s.slug)) });
4060
4080
  }
4061
- function ProtocolHero({
4062
- protocol: protocol2,
4081
+ var isInternal = (href) => href.startsWith("/") || href.startsWith("#");
4082
+ function DocLink({ href, className, children, ...rest }) {
4083
+ return isInternal(href) ? /* @__PURE__ */ jsx(Link6, { href, className, ...rest, children }) : /* @__PURE__ */ jsx("a", { href, className, ...rest, children });
4084
+ }
4085
+ function Breadcrumbs({ items, action, className }) {
4086
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex min-h-11 items-center justify-between gap-4 sm:min-h-0", className), children: [
4087
+ /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: "min-w-0", children: /* @__PURE__ */ jsx("ol", { className: "flex min-w-0 items-center gap-1.5 text-[0.875rem] text-muted-foreground", children: items.map((c, i) => {
4088
+ const last = i === items.length - 1;
4089
+ return /* @__PURE__ */ jsxs("li", { className: cn("flex items-center gap-1.5", last ? "min-w-0" : "shrink-0"), children: [
4090
+ c.href && !last ? /* @__PURE__ */ jsx(DocLink, { href: c.href, className: "inline-flex min-h-11 items-center transition-colors hover:text-foreground sm:min-h-0", children: c.label }) : /* @__PURE__ */ jsx("span", { "aria-current": last ? "page" : void 0, className: cn("truncate", last && "text-foreground"), children: c.label }),
4091
+ !last ? /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": true, className: "size-3.5 shrink-0 text-oca-subtle" }) : null
4092
+ ] }, i);
4093
+ }) }) }),
4094
+ action ? /* @__PURE__ */ jsx("div", { className: "shrink-0 text-[0.875rem]", children: action }) : null
4095
+ ] });
4096
+ }
4097
+ function DocsPager({ prev, next, className }) {
4098
+ if (!prev && !next) return null;
4099
+ const card = (l, dir) => /* @__PURE__ */ jsxs(
4100
+ DocLink,
4101
+ {
4102
+ href: l.href,
4103
+ className: cn(
4104
+ "group flex min-h-20 flex-col justify-center gap-1 rounded-2xl border border-border bg-card px-5 py-4 transition-colors hover:border-oca-hairline-strong",
4105
+ dir === "next" && "items-end text-right sm:col-start-2"
4106
+ ),
4107
+ children: [
4108
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-[0.8125rem] text-muted-foreground", children: [
4109
+ dir === "prev" ? /* @__PURE__ */ jsx(ArrowLeft, { "aria-hidden": true, className: "size-3.5" }) : null,
4110
+ dir === "prev" ? "Previous" : "Next",
4111
+ l.section ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\xB7" }) : null,
4112
+ l.section ? /* @__PURE__ */ jsx("span", { className: "truncate", children: l.section }) : null,
4113
+ dir === "next" ? /* @__PURE__ */ jsx(ArrowRight, { "aria-hidden": true, className: "size-3.5" }) : null
4114
+ ] }),
4115
+ /* @__PURE__ */ jsx("span", { className: "text-[1rem] font-medium leading-snug text-foreground", children: l.label })
4116
+ ]
4117
+ }
4118
+ );
4119
+ return /* @__PURE__ */ jsxs("nav", { "aria-label": "Previous and next page", className: cn("grid grid-cols-1 gap-3 border-t border-border pt-8 sm:grid-cols-2", className), children: [
4120
+ prev ? card(prev, "prev") : null,
4121
+ next ? card(next, "next") : null
4122
+ ] });
4123
+ }
4124
+ function useHeadings(selector = "#docs-content", key) {
4125
+ const [items, setItems] = useState([]);
4126
+ useEffect(() => {
4127
+ const read = () => {
4128
+ const root = document.querySelector(selector);
4129
+ if (!root) return setItems([]);
4130
+ setItems(
4131
+ Array.from(root.querySelectorAll("h2[id], h3[id]")).map((h) => ({
4132
+ id: h.id,
4133
+ // The anchor link's "#" is not part of the name.
4134
+ label: (h.querySelector("[data-heading-text]") ?? h).textContent?.trim() ?? "",
4135
+ level: h.tagName === "H3" ? 3 : 2
4136
+ }))
4137
+ );
4138
+ };
4139
+ const raf = requestAnimationFrame(read);
4140
+ const t = setTimeout(read, 80);
4141
+ return () => {
4142
+ cancelAnimationFrame(raf);
4143
+ clearTimeout(t);
4144
+ };
4145
+ }, [selector, key]);
4146
+ const activeId = useActiveHeading(items.map((i) => i.id));
4147
+ return { items, activeId };
4148
+ }
4149
+ function OnThisPage({
4150
+ items,
4151
+ activeId,
4152
+ title = "On this page",
4153
+ onNavigate,
4154
+ className
4155
+ }) {
4156
+ const id = useId();
4157
+ if (items.length === 0) return null;
4158
+ return (
4159
+ // With no visible title (a folded list under its own summary) the name is still "On this page".
4160
+ /* @__PURE__ */ jsxs("nav", { "aria-labelledby": title ? id : void 0, "aria-label": title ? void 0 : "On this page", className, children: [
4161
+ title ? /* @__PURE__ */ jsx("p", { id, className: "mb-3 text-[0.875rem] font-medium", children: title }) : null,
4162
+ /* @__PURE__ */ jsx("ul", { children: items.map((t) => {
4163
+ const on = t.id === activeId;
4164
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
4165
+ "a",
4166
+ {
4167
+ href: `#${t.id}`,
4168
+ onClick: onNavigate,
4169
+ "aria-current": on ? "location" : void 0,
4170
+ className: cn(
4171
+ "block border-l py-1.5 text-[0.875rem] leading-snug transition-colors",
4172
+ t.level === 3 ? "pl-7" : "pl-4",
4173
+ on ? "border-foreground text-foreground" : "border-border text-muted-foreground hover:text-foreground"
4174
+ ),
4175
+ children: t.label
4176
+ }
4177
+ ) }, t.id);
4178
+ }) })
4179
+ ] })
4180
+ );
4181
+ }
4182
+ var CALLOUT_TONE = { note: "neutral", warning: "brand", danger: "danger" };
4183
+ function Callout({
4184
+ tone = "note",
4063
4185
  title,
4064
- lead,
4065
- actions,
4066
- art,
4067
4186
  children,
4068
4187
  className
4069
4188
  }) {
4070
- const p = protocolSite(protocol2);
4071
4189
  return /* @__PURE__ */ jsx(
4072
- PageHero,
4190
+ Notice,
4073
4191
  {
4074
- className,
4075
- eyebrow: `Protocol \xB7 ${p.verb}`,
4192
+ tone: CALLOUT_TONE[tone],
4076
4193
  title,
4077
- lead,
4078
- actions,
4079
- art,
4080
- children: p.status !== "live" || children ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-4", children: [
4081
- p.status !== "live" ? /* @__PURE__ */ jsx(StatusBadge, { status: p.status }) : null,
4082
- children
4083
- ] }) : null
4194
+ role: "note",
4195
+ className: cn("my-6 [&_p]:my-0 [&_p]:text-[0.9375rem] [&_p]:leading-relaxed [&_p+p]:mt-3", className),
4196
+ children
4084
4197
  }
4085
4198
  );
4086
4199
  }
4087
- function ProtocolNav({
4088
- current: current2,
4089
- link = "page",
4090
- className
4091
- }) {
4092
- return /* @__PURE__ */ jsx("nav", { "aria-label": "Protocols", className, children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--background)", children: /* @__PURE__ */ jsx("ul", { className: "flex w-max min-w-full items-center gap-6 border-b border-border", children: PROTOCOLS.map((p) => {
4093
- const on = p.slug === current2;
4094
- return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
4095
- "a",
4096
- {
4097
- href: link === "tool" ? p.toolHref : p.pageHref,
4098
- "aria-current": on ? "page" : void 0,
4099
- className: cn(
4100
- "-mb-px inline-flex h-11 items-center border-b-2 text-[0.9375rem] transition-colors",
4101
- on ? "border-foreground text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
4102
- ),
4103
- children: p.label
4104
- }
4105
- ) }, p.slug);
4106
- }) }) }) });
4107
- }
4108
- function SpecCard({
4109
- protocol: protocol2,
4110
- version,
4111
- license,
4112
- vectors,
4113
- size = "md",
4114
- className
4115
- }) {
4116
- const p = protocolSite(protocol2);
4117
- const repo = `oc-${p.slug}-protocol`;
4118
- const facts = [
4119
- ["Version", version],
4120
- ...license ? [["Licence", license]] : [],
4121
- ["Nostr kind", p.kinds],
4122
- ...vectors !== void 0 ? [["Test vectors", String(vectors)]] : []
4123
- ];
4124
- if (size === "sm") {
4125
- return /* @__PURE__ */ jsxs(
4126
- "a",
4200
+ function Step({ title, id, children }) {
4201
+ return /* @__PURE__ */ jsxs("li", { className: "relative pb-8 pl-11 last:pb-0 [counter-increment:oca-step]", children: [
4202
+ /* @__PURE__ */ jsx(
4203
+ "span",
4127
4204
  {
4128
- href: p.specHref,
4129
- className: cn(
4130
- "group flex flex-wrap items-center gap-x-4 gap-y-1 rounded-2xl border border-border bg-card px-4 py-3 text-[0.875rem] transition-colors hover:border-oca-hairline-strong",
4131
- className
4132
- ),
4133
- children: [
4134
- /* @__PURE__ */ jsx("span", { className: "font-mono text-[0.8125rem] text-foreground", children: repo }),
4135
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: facts.map(([k, v]) => k === "Version" ? `v${v}` : k === "Nostr kind" ? `kind ${v}` : v).join(" \xB7 ") }),
4136
- /* @__PURE__ */ jsxs("span", { className: "ml-auto flex items-center gap-1 text-muted-foreground group-hover:text-foreground", children: [
4137
- "Read the spec ",
4138
- /* @__PURE__ */ jsx(ArrowUpRight, { "aria-hidden": true, className: "size-4" })
4139
- ] })
4140
- ]
4205
+ "aria-hidden": true,
4206
+ className: "absolute left-0 top-0 flex size-7 items-center justify-center rounded-full border border-oca-hairline-strong bg-card text-[0.8125rem] oca-tabular text-foreground before:content-[counter(oca-step)]"
4141
4207
  }
4142
- );
4143
- }
4144
- return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-6 rounded-[1.25rem] border border-border bg-card p-6 md:p-8", className), children: [
4145
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [
4146
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1.5", children: [
4147
- /* @__PURE__ */ jsx("p", { className: "text-[0.875rem] text-muted-foreground", children: "The spec" }),
4148
- /* @__PURE__ */ jsx("h3", { className: "oca-title break-all font-mono text-[1.0625rem] tracking-normal", children: repo })
4149
- ] }),
4150
- p.status !== "live" ? /* @__PURE__ */ jsx(StatusBadge, { status: p.status }) : null
4151
- ] }),
4152
- /* @__PURE__ */ jsx("dl", { className: "grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-4", children: facts.map(([k, v]) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
4153
- /* @__PURE__ */ jsx("dt", { className: "text-[0.8125rem] text-muted-foreground", children: k }),
4154
- /* @__PURE__ */ jsx("dd", { className: "oca-tabular text-[1.0625rem]", children: v })
4155
- ] }, k)) }),
4156
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, { asChild: true, variant: "secondary", size: "sm", children: /* @__PURE__ */ jsxs("a", { href: p.specHref, children: [
4157
- "Read the spec ",
4158
- /* @__PURE__ */ jsx(ArrowUpRight, { "aria-hidden": true })
4159
- ] }) }) })
4208
+ ),
4209
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute bottom-1 left-[0.8125rem] top-9 w-px bg-border" }),
4210
+ /* @__PURE__ */ jsx("h3", { id, className: "scroll-mt-28 pt-0.5 text-[1.0625rem] font-medium leading-snug tracking-[-0.008em] text-foreground", children: title }),
4211
+ /* @__PURE__ */ jsx("div", { className: "mt-2 text-muted-foreground [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", children })
4160
4212
  ] });
4161
4213
  }
4162
- function VerifyBox({
4163
- action,
4164
- param = "q",
4214
+ function Steps({ children, className }) {
4215
+ return /* @__PURE__ */ jsx("ol", { className: cn("not-prose my-8 flex flex-col [counter-reset:oca-step] [&>li:last-child>span:nth-child(2)]:hidden", className), children });
4216
+ }
4217
+ function LinkCard({
4218
+ href,
4165
4219
  title,
4166
4220
  description,
4167
- label = "Id, envelope or link",
4168
- placeholder,
4169
- hint,
4170
- submitLabel = "Verify",
4171
- multiline = false,
4172
- onVerify,
4221
+ icon,
4222
+ meta,
4173
4223
  className
4174
4224
  }) {
4175
- const [value, setValue] = useState("");
4176
- const submit = (e) => {
4177
- if (!onVerify) return;
4178
- e.preventDefault();
4179
- if (value.trim()) onVerify(value.trim());
4180
- };
4181
- const button = /* @__PURE__ */ jsx(Button, { type: "submit", className: multiline ? void 0 : "w-full sm:w-auto", children: submitLabel });
4225
+ const Arrow = isInternal(href) ? ArrowRight : ArrowUpRight;
4182
4226
  return /* @__PURE__ */ jsxs(
4183
- "form",
4227
+ DocLink,
4184
4228
  {
4185
- action,
4186
- method: "get",
4187
- onSubmit: submit,
4188
- className: cn("flex flex-col gap-5 rounded-[1.25rem] border border-border bg-card p-6 md:p-8", className),
4229
+ href,
4230
+ className: cn(
4231
+ "group flex h-full flex-col gap-3 rounded-[1.25rem] border border-border bg-card p-5 transition-colors hover:border-oca-hairline-strong",
4232
+ className
4233
+ ),
4189
4234
  children: [
4190
- title || description ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
4191
- title ? /* @__PURE__ */ jsx("h3", { className: "oca-title", children: title }) : null,
4192
- description ? /* @__PURE__ */ jsx("p", { className: "oca-body text-[0.9375rem]", children: description }) : null
4193
- ] }) : null,
4194
- multiline ? /* @__PURE__ */ jsxs(Fragment, { children: [
4195
- /* @__PURE__ */ jsx(Field, { label, hint, children: /* @__PURE__ */ jsx(
4196
- Textarea,
4197
- {
4198
- name: param,
4199
- required: true,
4200
- value,
4201
- onChange: (e) => setValue(e.target.value),
4202
- placeholder,
4203
- spellCheck: false,
4204
- className: "min-h-32 font-mono text-base md:text-[0.8125rem]"
4205
- }
4206
- ) }),
4207
- /* @__PURE__ */ jsx("div", { children: button })
4208
- ] }) : /* @__PURE__ */ jsx(Field, { label, hint, action: button, children: /* @__PURE__ */ jsx(
4209
- Input,
4210
- {
4211
- name: param,
4212
- required: true,
4213
- value,
4214
- onChange: (e) => setValue(e.target.value),
4215
- placeholder,
4216
- spellCheck: false,
4217
- autoComplete: "off",
4218
- className: "font-mono text-base md:text-[0.875rem]"
4219
- }
4220
- ) })
4235
+ /* @__PURE__ */ jsxs("span", { className: "flex items-start justify-between gap-3", children: [
4236
+ icon ? /* @__PURE__ */ jsx("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-xl bg-muted text-foreground [&_svg]:size-[1.125rem]", children: icon }) : /* @__PURE__ */ jsx("span", { className: "text-[1rem] font-medium leading-snug text-foreground", children: title }),
4237
+ /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-2", children: [
4238
+ meta,
4239
+ /* @__PURE__ */ jsx(Arrow, { "aria-hidden": true, className: "size-4 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-foreground" })
4240
+ ] })
4241
+ ] }),
4242
+ icon ? /* @__PURE__ */ jsx("span", { className: "text-[1rem] font-medium leading-snug text-foreground", children: title }) : null,
4243
+ description ? /* @__PURE__ */ jsx("span", { className: "text-[0.9375rem] leading-relaxed text-muted-foreground", children: description }) : null
4221
4244
  ]
4222
4245
  }
4223
4246
  );
4224
4247
  }
4225
- var TINT = "bg-[color-mix(in_oklab,var(--oca-orange)_9%,var(--card))]";
4226
- function ComparisonTable({
4227
- columns,
4248
+ function CardGrid({ columns = 2, children, className }) {
4249
+ return /* @__PURE__ */ jsx("div", { className: cn("not-prose my-6 grid grid-cols-1 gap-3 sm:grid-cols-2", columns === 3 && "lg:grid-cols-3", className), children });
4250
+ }
4251
+ function MdxTable({ className, ...props }) {
4252
+ return /* @__PURE__ */ jsx("div", { className: "not-prose my-6 overflow-hidden rounded-2xl border border-border bg-card", children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsx(
4253
+ "table",
4254
+ {
4255
+ className: cn(
4256
+ "w-full border-collapse text-left text-[0.875rem] leading-relaxed",
4257
+ "[&_th]:whitespace-nowrap [&_th]:border-b [&_th]:border-oca-hairline-strong [&_th]:bg-oca-table-head [&_th]:px-4 [&_th]:py-2.5 [&_th]:text-[0.8125rem] [&_th]:font-medium [&_th]:text-foreground",
4258
+ "[&_td]:border-t [&_td]:border-border [&_td]:px-4 [&_td]:py-2.5 [&_td]:align-top [&_td]:text-muted-foreground [&_tbody_tr:first-child_td]:border-t-0",
4259
+ "[&_td_code]:bg-transparent [&_td_code]:p-0 [&_td_code]:text-foreground [&_td:first-child]:text-foreground",
4260
+ "[&_[align=center]]:text-center [&_[align=right]]:text-right",
4261
+ // On a phone a cell keeps a readable width; the table scrolls instead of crushing it.
4262
+ "max-sm:[&_td]:min-w-[9rem]",
4263
+ className
4264
+ ),
4265
+ ...props
4266
+ }
4267
+ ) }) });
4268
+ }
4269
+ var said = (n) => n !== void 0 && n !== null && n !== false && n !== "";
4270
+ function ApiTable({
4228
4271
  rows,
4229
- label,
4230
- propertyHeading = "Property",
4272
+ caption,
4273
+ nameHeader = "Name",
4231
4274
  className
4232
4275
  }) {
4233
- const wide = columns.length > 3;
4234
- const grid = wide ? "lg:grid lg:grid-cols-[var(--oca-compare)]" : "md:grid md:grid-cols-[var(--oca-compare)]";
4235
- const desk = wide ? "lg" : "md";
4236
- const style = {
4237
- // The argued-for column gets a little more room: its answers carry the page.
4238
- "--oca-compare": ["minmax(0, 1.4fr)", ...columns.map((c) => c.highlight ? "minmax(0, 1.3fr)" : "minmax(0, 1fr)")].join(" ")
4276
+ const hasDefault = rows.some((r) => r.default !== void 0);
4277
+ const hasDescription = rows.some((r) => said(r.description));
4278
+ const hasSource = rows.some((r) => said(r.source));
4279
+ const cell = "px-4 py-3 max-sm:p-0";
4280
+ return /* @__PURE__ */ jsx("div", { className: cn("not-prose my-6 overflow-hidden rounded-2xl border border-border bg-card", className), children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-left text-[0.875rem] max-sm:block", children: [
4281
+ caption ? /* @__PURE__ */ jsx("caption", { className: "sr-only", children: caption }) : null,
4282
+ /* @__PURE__ */ jsx("thead", { className: "max-sm:sr-only", children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-oca-hairline-strong bg-oca-table-head text-[0.8125rem]", children: [
4283
+ /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: nameHeader }),
4284
+ /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Type" }),
4285
+ hasDefault ? /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Default" }) : null,
4286
+ hasDescription ? /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Description" }) : null,
4287
+ hasSource ? /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Defined in" }) : null
4288
+ ] }) }),
4289
+ /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-border max-sm:block", children: rows.map((r) => /* @__PURE__ */ jsxs(
4290
+ "tr",
4291
+ {
4292
+ id: r.id,
4293
+ className: "scroll-mt-28 align-top target:bg-muted max-sm:flex max-sm:flex-col max-sm:gap-1.5 max-sm:px-4 max-sm:py-3.5",
4294
+ children: [
4295
+ /* @__PURE__ */ jsx("th", { scope: "row", className: cn(cell, "text-left font-normal"), children: /* @__PURE__ */ jsxs("span", { className: "flex flex-col items-start gap-1 max-sm:flex-row max-sm:flex-wrap max-sm:items-baseline max-sm:gap-x-2", children: [
4296
+ /* @__PURE__ */ jsx("code", { className: cn("font-mono text-[0.8125rem] text-foreground max-sm:text-[0.875rem]", r.deprecated && "line-through decoration-oca-subtle"), children: r.name }),
4297
+ r.required ? /* @__PURE__ */ jsx("span", { className: "text-[0.75rem] text-oca-accent-ink", children: "Required" }) : null,
4298
+ r.deprecated ? /* @__PURE__ */ jsx(Badge, { tone: "muted", children: "Deprecated" }) : null,
4299
+ r.status ? /* @__PURE__ */ jsx(StatusBadge, { status: r.status }) : null
4300
+ ] }) }),
4301
+ /* @__PURE__ */ jsx("td", { className: cn(cell, "font-mono text-[0.8125rem] text-muted-foreground max-sm:break-all", !said(r.type) && "max-sm:hidden"), children: r.type ?? "\u2014" }),
4302
+ hasDefault ? /* @__PURE__ */ jsxs("td", { className: cn(cell, "font-mono text-[0.8125rem] text-muted-foreground max-sm:order-last", r.default === void 0 && "max-sm:hidden"), children: [
4303
+ /* @__PURE__ */ jsx("span", { className: "font-sans sm:hidden", children: "Default " }),
4304
+ r.default ?? "\u2014"
4305
+ ] }) : null,
4306
+ hasDescription ? /* @__PURE__ */ jsx("td", { className: cn(cell, "leading-relaxed text-muted-foreground", !said(r.description) && "max-sm:hidden"), children: r.description }) : null,
4307
+ hasSource ? /* @__PURE__ */ jsx("td", { className: cn(cell, "text-[0.8125rem] text-muted-foreground max-sm:order-last max-sm:break-all", !said(r.source) && "max-sm:hidden"), children: r.source }) : null
4308
+ ]
4309
+ },
4310
+ r.id ?? r.name
4311
+ )) })
4312
+ ] }) }) });
4313
+ }
4314
+ function useDarkMode() {
4315
+ const [dark, setDark] = useState(false);
4316
+ useEffect(() => {
4317
+ const root = document.documentElement;
4318
+ const read = () => setDark(root.classList.contains("dark"));
4319
+ read();
4320
+ const mo = new MutationObserver(read);
4321
+ mo.observe(root, { attributes: true, attributeFilter: ["class"] });
4322
+ return () => mo.disconnect();
4323
+ }, []);
4324
+ return dark;
4325
+ }
4326
+ function mermaidTheme(el) {
4327
+ const css = getComputedStyle(el);
4328
+ const v = (name) => css.getPropertyValue(name).trim();
4329
+ const card = v("--card");
4330
+ const muted = v("--muted");
4331
+ const text = v("--foreground");
4332
+ const subtle = v("--muted-foreground");
4333
+ const line = v("--input");
4334
+ const hair = v("--oca-hairline-strong");
4335
+ return {
4336
+ background: "transparent",
4337
+ fontFamily: css.fontFamily,
4338
+ fontSize: "14px",
4339
+ textColor: text,
4340
+ mainBkg: card,
4341
+ primaryColor: card,
4342
+ primaryTextColor: text,
4343
+ primaryBorderColor: hair,
4344
+ secondaryColor: muted,
4345
+ secondaryTextColor: text,
4346
+ secondaryBorderColor: hair,
4347
+ tertiaryColor: muted,
4348
+ tertiaryTextColor: text,
4349
+ tertiaryBorderColor: hair,
4350
+ nodeBorder: hair,
4351
+ lineColor: line,
4352
+ edgeLabelBackground: card,
4353
+ clusterBkg: muted,
4354
+ clusterBorder: hair,
4355
+ titleColor: text,
4356
+ noteBkgColor: muted,
4357
+ noteTextColor: text,
4358
+ noteBorderColor: hair,
4359
+ actorBkg: card,
4360
+ actorBorder: hair,
4361
+ actorTextColor: text,
4362
+ actorLineColor: line,
4363
+ signalColor: text,
4364
+ signalTextColor: text,
4365
+ labelBoxBkgColor: card,
4366
+ labelBoxBorderColor: hair,
4367
+ labelTextColor: text,
4368
+ loopTextColor: subtle,
4369
+ activationBkgColor: muted,
4370
+ activationBorderColor: hair,
4371
+ sequenceNumberColor: card
4239
4372
  };
4240
- const ordered = [...columns].sort((a, b) => Number(Boolean(b.highlight)) - Number(Boolean(a.highlight)));
4241
- return /* @__PURE__ */ jsxs("ul", { "aria-label": label, style, className: cn("divide-y divide-border rounded-[1.25rem] border border-border bg-card", className), children: [
4242
- /* @__PURE__ */ jsxs(
4243
- "li",
4373
+ }
4374
+ var FIT = 4 / 3;
4375
+ function naturalSize(svg) {
4376
+ const w = svg.match(/viewBox="[\d.-]+ [\d.-]+ ([\d.]+) [\d.]+"/)?.[1];
4377
+ if (!w) return { svg, width: null };
4378
+ const width = Math.ceil(Number(w));
4379
+ return {
4380
+ svg: svg.replace(/<svg([^>]*?)\swidth="100%"/, `<svg$1 width="${width}"`).replace(/max-width:\s*[\d.]+px;?/, ""),
4381
+ width
4382
+ };
4383
+ }
4384
+ function useInnerWidth(ref, padding) {
4385
+ const [width, setWidth] = useState(null);
4386
+ useEffect(() => {
4387
+ const el = ref.current;
4388
+ if (!el) return;
4389
+ const ro = new ResizeObserver(() => setWidth(el.clientWidth - padding));
4390
+ ro.observe(el);
4391
+ return () => ro.disconnect();
4392
+ }, [ref, padding]);
4393
+ return width;
4394
+ }
4395
+ function Diagram({ chart, caption, load, className }) {
4396
+ const ref = useRef(null);
4397
+ const dark = useDarkMode();
4398
+ const raw = useId();
4399
+ const [drawn, setDrawn] = useState(null);
4400
+ const [failed, setFailed] = useState(false);
4401
+ const room = useInnerWidth(ref, 48);
4402
+ const fits = drawn?.width != null && room != null && drawn.width <= room * FIT;
4403
+ useEffect(() => {
4404
+ let live = true;
4405
+ const el = ref.current;
4406
+ if (!el) return;
4407
+ (async () => {
4408
+ try {
4409
+ const mod = await load();
4410
+ const mermaid = "default" in mod ? mod.default : mod;
4411
+ mermaid.initialize({ startOnLoad: false, securityLevel: "strict", theme: "base", themeVariables: mermaidTheme(el) });
4412
+ const { svg } = await mermaid.render(`oca-diagram-${raw.replace(/[^a-zA-Z0-9]/g, "")}-${dark ? "d" : "l"}`, chart);
4413
+ if (live) {
4414
+ setDrawn(naturalSize(svg));
4415
+ setFailed(false);
4416
+ }
4417
+ } catch {
4418
+ if (live) setFailed(true);
4419
+ }
4420
+ })();
4421
+ return () => {
4422
+ live = false;
4423
+ };
4424
+ }, [chart, dark, load, raw]);
4425
+ if (failed) return /* @__PURE__ */ jsx(CodeBlock, { code: chart, caption: "Diagram (shown as its source)", className: cn("my-6", className) });
4426
+ return /* @__PURE__ */ jsxs("figure", { ref, className: cn("not-prose my-6 overflow-hidden rounded-[1.25rem] border border-border bg-card", className), children: [
4427
+ drawn ? /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsx(
4428
+ "div",
4244
4429
  {
4245
- "aria-hidden": true,
4430
+ "data-fit": fits ? "" : void 0,
4246
4431
  className: cn(
4247
- "hidden gap-5 px-5 py-4 text-[0.875rem] font-medium text-muted-foreground",
4248
- wide ? "lg:grid lg:px-8" : "md:grid md:px-8",
4249
- grid
4432
+ "flex justify-center p-6 [&_svg]:h-auto",
4433
+ fits ? "w-full [&_svg]:max-w-full" : "w-max min-w-full [&_svg]:max-w-none"
4250
4434
  ),
4251
- children: [
4252
- /* @__PURE__ */ jsx("span", { children: propertyHeading }),
4253
- columns.map((c) => /* @__PURE__ */ jsx("span", { className: cn(c.highlight && cn(TINT, "-my-4 px-4 py-4 text-oca-accent-ink")), children: c.label }, c.key))
4254
- ]
4435
+ role: "img",
4436
+ "aria-label": typeof caption === "string" ? caption : "Diagram",
4437
+ dangerouslySetInnerHTML: { __html: drawn.svg }
4255
4438
  }
4256
- ),
4257
- rows.map((r, ri) => /* @__PURE__ */ jsxs("li", { className: cn("grid grid-cols-1 gap-3 px-5 py-5", wide ? "lg:items-start lg:gap-5 lg:px-8" : "md:items-start md:gap-5 md:px-8", grid), children: [
4258
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
4259
- /* @__PURE__ */ jsx("span", { className: "oca-title-sm", children: r.label }),
4260
- r.note ? /* @__PURE__ */ jsx("span", { className: "text-[0.875rem] leading-snug text-muted-foreground", children: r.note }) : null
4261
- ] }),
4262
- /* @__PURE__ */ jsx("div", { className: cn("grid grid-cols-2 gap-1", desk === "lg" ? "lg:contents" : "md:contents"), children: columns.map((c) => {
4263
- return /* @__PURE__ */ jsxs(
4264
- "div",
4265
- {
4266
- style: { "--oca-order": ordered.indexOf(c) },
4267
- className: cn(
4268
- // Two rows of the pair's grid (name, answer), so answers line up
4269
- // across a pair even when one name wraps.
4270
- "order-[var(--oca-order)] row-span-2 grid min-w-0 grid-rows-subgrid gap-1 rounded-xl px-3 py-2.5",
4271
- desk === "lg" ? "lg:order-none lg:row-span-1 lg:flex lg:flex-col" : "md:order-none md:row-span-1 md:flex md:flex-col",
4272
- c.highlight ? cn(
4273
- TINT,
4274
- "col-span-2",
4275
- desk === "lg" ? "lg:col-span-1 lg:-my-5 lg:self-stretch lg:rounded-none lg:px-4 lg:py-5" : "md:col-span-1 md:-my-5 md:self-stretch md:rounded-none md:px-4 md:py-5"
4276
- ) : desk === "lg" ? "lg:p-0" : "md:p-0"
4277
- ),
4278
- children: [
4279
- /* @__PURE__ */ jsx(
4280
- "span",
4281
- {
4282
- className: cn(
4283
- "text-[0.8125rem]",
4284
- c.highlight ? "text-oca-accent-ink" : "text-muted-foreground",
4285
- desk === "lg" ? "lg:sr-only" : "md:sr-only"
4286
- ),
4287
- children: c.label
4288
- }
4289
- ),
4290
- /* @__PURE__ */ jsx("span", { className: cn("text-[0.9375rem]", c.highlight && "font-medium"), children: r.values[c.key] ?? "\u2014" })
4291
- ]
4292
- },
4293
- c.key
4294
- );
4295
- }) })
4296
- ] }, ri))
4439
+ ) }) : /* @__PURE__ */ jsx("div", { role: "status", "aria-label": "Drawing the diagram", className: "p-6", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full rounded-xl" }) }),
4440
+ caption ? /* @__PURE__ */ jsx("figcaption", { className: "border-t border-border px-5 py-3 text-[0.8125rem] text-muted-foreground", children: caption }) : null
4297
4441
  ] });
4298
4442
  }
4299
- var CHECK = {
4300
- ok: { word: "Passed", icon: /* @__PURE__ */ jsx(CircleCheck, {}), tone: "text-success" },
4301
- fail: { word: "Failed", icon: /* @__PURE__ */ jsx(CircleX, {}), tone: "text-destructive" },
4302
- pending: { word: "Pending", icon: /* @__PURE__ */ jsx(Clock, {}), tone: "text-oca-accent-ink" },
4303
- skipped: { word: "Skipped", icon: /* @__PURE__ */ jsx(CircleMinus, {}), tone: "text-muted-foreground" },
4304
- unchecked: { word: "Not checked", icon: /* @__PURE__ */ jsx(CircleDashed, {}), tone: "text-oca-subtle" }
4443
+ var HEADING = {
4444
+ h1: "oca-display-3 mb-4 text-foreground",
4445
+ h2: "mb-3 mt-12 text-[1.375rem] font-medium leading-tight tracking-[-0.015em] text-foreground md:text-[1.5rem]",
4446
+ h3: "mb-2 mt-9 text-[1.125rem] font-medium leading-snug tracking-[-0.01em] text-foreground",
4447
+ h4: "mb-2 mt-7 text-[1rem] font-medium leading-snug text-foreground"
4305
4448
  };
4306
- function VerifyReport({
4307
- verdict,
4308
- title,
4309
- summary,
4310
- checks,
4311
- facts,
4312
- notChecked,
4313
- actions,
4314
- as: Heading = "h2",
4315
- className
4449
+ function DocsHeading({
4450
+ as: Tag,
4451
+ id,
4452
+ children,
4453
+ className,
4454
+ ...props
4316
4455
  }) {
4317
- return /* @__PURE__ */ jsxs(
4318
- "section",
4319
- {
4320
- "aria-label": "Verification result",
4321
- className: cn("overflow-hidden rounded-[1.25rem] border border-border bg-card", className),
4322
- children: [
4323
- /* @__PURE__ */ jsxs("header", { className: "flex flex-col items-start gap-3 p-6 md:p-8", children: [
4324
- /* @__PURE__ */ jsx(StatusBadge, { status: verdict }),
4325
- /* @__PURE__ */ jsx(Heading, { className: "oca-display-3", children: title }),
4326
- summary ? /* @__PURE__ */ jsx("p", { className: "oca-body max-w-[40rem]", children: summary }) : null
4327
- ] }),
4328
- /* @__PURE__ */ jsx("ul", { "aria-label": "Checks", className: "divide-y divide-border border-t border-border", children: checks.map((c, i) => {
4329
- const k = CHECK[c.state];
4330
- return /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-3 px-6 py-3.5 md:px-8", children: [
4331
- /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cn("mt-0.5 shrink-0 [&_svg]:size-[1.125rem]", k.tone), children: k.icon }),
4332
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5 sm:flex-row sm:items-baseline sm:justify-between sm:gap-6", children: [
4333
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
4334
- /* @__PURE__ */ jsx("span", { className: "text-[0.9375rem]", children: c.label }),
4335
- c.note ? /* @__PURE__ */ jsx("span", { className: "break-words text-[0.8125rem] leading-snug text-muted-foreground", children: c.note }) : null
4336
- ] }),
4337
- /* @__PURE__ */ jsx(
4338
- "span",
4339
- {
4340
- className: cn(
4341
- "shrink-0 text-[0.8125rem]",
4342
- c.state === "fail" ? "text-destructive" : "text-muted-foreground"
4343
- ),
4344
- children: k.word
4345
- }
4346
- )
4347
- ] })
4348
- ] }, i);
4349
- }) }),
4350
- facts && facts.length > 0 ? /* @__PURE__ */ jsx(KeyValueList, { items: facts, className: "rounded-none border-x-0 border-b-0 bg-transparent [&>div]:px-6 md:[&>div]:px-8" }) : null,
4351
- notChecked && notChecked.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 border-t border-border bg-muted/50 px-6 py-5 md:px-8", children: [
4352
- /* @__PURE__ */ jsx("p", { className: "text-[0.875rem] font-medium", children: "What this did not check" }),
4353
- /* @__PURE__ */ jsx("ul", { className: "flex list-disc flex-col gap-1 pl-5 text-[0.875rem] leading-relaxed text-muted-foreground", children: notChecked.map((n, i) => /* @__PURE__ */ jsx("li", { children: n }, i)) })
4354
- ] }) : null,
4355
- actions ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3 border-t border-border px-6 py-5 md:px-8", children: actions }) : null
4356
- ]
4357
- }
4358
- );
4359
- }
4360
- function SignMessage({
4361
- lead,
4362
- address,
4363
- message,
4364
- wallets,
4365
- busy = false,
4366
- error,
4367
- submitLabel = "Confirm",
4368
- secondary,
4369
- onSignature,
4370
- className
4371
- }) {
4372
- const [pasted, setPasted] = useState("");
4373
- return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-5", className), children: [
4374
- lead ? /* @__PURE__ */ jsx("p", { className: "text-[0.9375rem] leading-relaxed", children: lead }) : null,
4375
- wallets ? /* @__PURE__ */ jsxs(Fragment, { children: [
4376
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: wallets }),
4377
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 text-[0.8125rem] text-muted-foreground", children: [
4378
- /* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-border" }),
4379
- "or sign it in any wallet",
4380
- /* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-border" })
4381
- ] })
4382
- ] }) : null,
4383
- /* @__PURE__ */ jsx(CodeBlock, { code: message, caption: "Message to sign" }),
4384
- /* @__PURE__ */ jsxs(
4385
- "form",
4456
+ return /* @__PURE__ */ jsxs(Tag, { id, className: cn("group scroll-mt-28", HEADING[Tag], className), ...props, children: [
4457
+ /* @__PURE__ */ jsx("span", { "data-heading-text": "", children }),
4458
+ id && Tag !== "h1" ? /* @__PURE__ */ jsxs(
4459
+ "a",
4386
4460
  {
4387
- className: "flex flex-col gap-4",
4388
- onSubmit: (e) => {
4389
- e.preventDefault();
4390
- if (pasted.trim()) onSignature(pasted.trim());
4391
- },
4461
+ href: `#${id}`,
4462
+ className: "ml-2 inline-block rounded-md px-1 align-baseline text-[0.85em] font-normal text-oca-subtle no-underline opacity-0 transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100",
4392
4463
  children: [
4393
- /* @__PURE__ */ jsx(
4394
- Field,
4395
- {
4396
- label: "Signature",
4397
- error,
4398
- hint: /* @__PURE__ */ jsxs(Fragment, { children: [
4399
- "From your wallet\u2019s \u201Csign message\u201D (BIP-322), signed by",
4400
- " ",
4401
- /* @__PURE__ */ jsx("span", { className: "break-all font-mono", children: address }),
4402
- "."
4403
- ] }),
4404
- children: /* @__PURE__ */ jsx(
4405
- Textarea,
4406
- {
4407
- value: pasted,
4408
- onChange: (e) => setPasted(e.target.value),
4409
- rows: 3,
4410
- spellCheck: false,
4411
- className: "min-h-24 font-mono text-base md:text-[0.8125rem]"
4412
- }
4413
- )
4414
- }
4415
- ),
4416
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
4417
- /* @__PURE__ */ jsx(Button, { type: "submit", loading: busy, disabled: !pasted.trim(), children: submitLabel }),
4418
- secondary
4419
- ] })
4464
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "#" }),
4465
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Link to this section" })
4420
4466
  ]
4421
4467
  }
4422
- )
4423
- ] });
4424
- }
4425
- var isInternal = (href) => href.startsWith("/") || href.startsWith("#");
4426
- function DocLink({ href, className, children, ...rest }) {
4427
- return isInternal(href) ? /* @__PURE__ */ jsx(Link8, { href, className, ...rest, children }) : /* @__PURE__ */ jsx("a", { href, className, ...rest, children });
4428
- }
4429
- function Breadcrumbs({ items, action, className }) {
4430
- return /* @__PURE__ */ jsxs("div", { className: cn("flex min-h-11 items-center justify-between gap-4 sm:min-h-0", className), children: [
4431
- /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: "min-w-0", children: /* @__PURE__ */ jsx("ol", { className: "flex min-w-0 items-center gap-1.5 text-[0.875rem] text-muted-foreground", children: items.map((c, i) => {
4432
- const last = i === items.length - 1;
4433
- return /* @__PURE__ */ jsxs("li", { className: cn("flex items-center gap-1.5", last ? "min-w-0" : "shrink-0"), children: [
4434
- c.href && !last ? /* @__PURE__ */ jsx(DocLink, { href: c.href, className: "inline-flex min-h-11 items-center transition-colors hover:text-foreground sm:min-h-0", children: c.label }) : /* @__PURE__ */ jsx("span", { "aria-current": last ? "page" : void 0, className: cn("truncate", last && "text-foreground"), children: c.label }),
4435
- !last ? /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": true, className: "size-3.5 shrink-0 text-oca-subtle" }) : null
4436
- ] }, i);
4437
- }) }) }),
4438
- action ? /* @__PURE__ */ jsx("div", { className: "shrink-0 text-[0.875rem]", children: action }) : null
4439
- ] });
4440
- }
4441
- function DocsPager({ prev, next, className }) {
4442
- if (!prev && !next) return null;
4443
- const card = (l, dir) => /* @__PURE__ */ jsxs(
4444
- DocLink,
4445
- {
4446
- href: l.href,
4447
- className: cn(
4448
- "group flex min-h-20 flex-col justify-center gap-1 rounded-2xl border border-border bg-card px-5 py-4 transition-colors hover:border-oca-hairline-strong",
4449
- dir === "next" && "items-end text-right sm:col-start-2"
4450
- ),
4451
- children: [
4452
- /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-[0.8125rem] text-muted-foreground", children: [
4453
- dir === "prev" ? /* @__PURE__ */ jsx(ArrowLeft, { "aria-hidden": true, className: "size-3.5" }) : null,
4454
- dir === "prev" ? "Previous" : "Next",
4455
- l.section ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\xB7" }) : null,
4456
- l.section ? /* @__PURE__ */ jsx("span", { className: "truncate", children: l.section }) : null,
4457
- dir === "next" ? /* @__PURE__ */ jsx(ArrowRight, { "aria-hidden": true, className: "size-3.5" }) : null
4458
- ] }),
4459
- /* @__PURE__ */ jsx("span", { className: "text-[1rem] font-medium leading-snug text-foreground", children: l.label })
4460
- ]
4461
- }
4462
- );
4463
- return /* @__PURE__ */ jsxs("nav", { "aria-label": "Previous and next page", className: cn("grid grid-cols-1 gap-3 border-t border-border pt-8 sm:grid-cols-2", className), children: [
4464
- prev ? card(prev, "prev") : null,
4465
- next ? card(next, "next") : null
4468
+ ) : null
4466
4469
  ] });
4467
4470
  }
4468
- function useHeadings(selector = "#docs-content", key) {
4469
- const [items, setItems] = useState([]);
4470
- useEffect(() => {
4471
- const read = () => {
4472
- const root = document.querySelector(selector);
4473
- if (!root) return setItems([]);
4474
- setItems(
4475
- Array.from(root.querySelectorAll("h2[id], h3[id]")).map((h) => ({
4476
- id: h.id,
4477
- // The anchor link's "#" is not part of the name.
4478
- label: (h.querySelector("[data-heading-text]") ?? h).textContent?.trim() ?? "",
4479
- level: h.tagName === "H3" ? 3 : 2
4480
- }))
4481
- );
4482
- };
4483
- const raf = requestAnimationFrame(read);
4484
- const t = setTimeout(read, 80);
4485
- return () => {
4486
- cancelAnimationFrame(raf);
4487
- clearTimeout(t);
4488
- };
4489
- }, [selector, key]);
4490
- const activeId = useActiveHeading(items.map((i) => i.id));
4491
- return { items, activeId };
4471
+ function codeText(node) {
4472
+ if (typeof node === "string") return node;
4473
+ if (typeof node === "number") return String(node);
4474
+ if (Array.isArray(node)) return node.map(codeText).join("");
4475
+ if (isValidElement(node)) return codeText(node.props.children);
4476
+ return "";
4492
4477
  }
4493
- function OnThisPage({
4494
- items,
4495
- activeId,
4496
- title = "On this page",
4497
- onNavigate,
4498
- className
4499
- }) {
4500
- const id = useId();
4501
- if (items.length === 0) return null;
4502
- return (
4503
- // With no visible title (a folded list under its own summary) the name is still "On this page".
4504
- /* @__PURE__ */ jsxs("nav", { "aria-labelledby": title ? id : void 0, "aria-label": title ? void 0 : "On this page", className, children: [
4505
- title ? /* @__PURE__ */ jsx("p", { id, className: "mb-3 text-[0.875rem] font-medium", children: title }) : null,
4506
- /* @__PURE__ */ jsx("ul", { children: items.map((t) => {
4507
- const on = t.id === activeId;
4508
- return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
4509
- "a",
4510
- {
4511
- href: `#${t.id}`,
4512
- onClick: onNavigate,
4513
- "aria-current": on ? "location" : void 0,
4514
- className: cn(
4515
- "block border-l py-1.5 text-[0.875rem] leading-snug transition-colors",
4516
- t.level === 3 ? "pl-7" : "pl-4",
4517
- on ? "border-foreground text-foreground" : "border-border text-muted-foreground hover:text-foreground"
4518
- ),
4519
- children: t.label
4520
- }
4521
- ) }, t.id);
4522
- }) })
4523
- ] })
4524
- );
4478
+ function codeLang(node) {
4479
+ const child = Children.toArray(node)[0];
4480
+ if (!isValidElement(child)) return void 0;
4481
+ const cls = child.props.className ?? "";
4482
+ return cls.match(/language-([\w+-]+)/)?.[1];
4525
4483
  }
4526
- var CALLOUT_TONE = { note: "neutral", warning: "brand", danger: "danger" };
4527
- function Callout({
4528
- tone = "note",
4484
+ function ProtocolHero({
4485
+ protocol: protocol2,
4529
4486
  title,
4487
+ lead,
4488
+ actions,
4489
+ art,
4530
4490
  children,
4531
4491
  className
4532
4492
  }) {
4493
+ const p = protocolSite(protocol2);
4533
4494
  return /* @__PURE__ */ jsx(
4534
- Notice,
4495
+ PageHero,
4535
4496
  {
4536
- tone: CALLOUT_TONE[tone],
4497
+ className,
4498
+ eyebrow: `Protocol \xB7 ${p.verb}`,
4537
4499
  title,
4538
- role: "note",
4539
- className: cn("my-6 [&_p]:my-0 [&_p]:text-[0.9375rem] [&_p]:leading-relaxed [&_p+p]:mt-3", className),
4540
- children
4500
+ lead,
4501
+ actions,
4502
+ art,
4503
+ children: p.status !== "live" || children ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-4", children: [
4504
+ p.status !== "live" ? /* @__PURE__ */ jsx(StatusBadge, { status: p.status }) : null,
4505
+ children
4506
+ ] }) : null
4541
4507
  }
4542
4508
  );
4543
4509
  }
4544
- function Step({ title, id, children }) {
4545
- return /* @__PURE__ */ jsxs("li", { className: "relative pb-8 pl-11 last:pb-0 [counter-increment:oca-step]", children: [
4546
- /* @__PURE__ */ jsx(
4547
- "span",
4510
+ function ProtocolNav({
4511
+ current: current2,
4512
+ link = "page",
4513
+ className
4514
+ }) {
4515
+ return /* @__PURE__ */ jsx("nav", { "aria-label": "Protocols", className, children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--background)", children: /* @__PURE__ */ jsx("ul", { className: "flex w-max min-w-full items-center gap-6 border-b border-border", children: PROTOCOLS.map((p) => {
4516
+ const on = p.slug === current2;
4517
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
4518
+ "a",
4548
4519
  {
4549
- "aria-hidden": true,
4550
- className: "absolute left-0 top-0 flex size-7 items-center justify-center rounded-full border border-oca-hairline-strong bg-card text-[0.8125rem] oca-tabular text-foreground before:content-[counter(oca-step)]"
4551
- }
4552
- ),
4553
- /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute bottom-1 left-[0.8125rem] top-9 w-px bg-border" }),
4554
- /* @__PURE__ */ jsx("h3", { id, className: "scroll-mt-28 pt-0.5 text-[1.0625rem] font-medium leading-snug tracking-[-0.008em] text-foreground", children: title }),
4555
- /* @__PURE__ */ jsx("div", { className: "mt-2 text-muted-foreground [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", children })
4520
+ href: link === "tool" ? p.toolHref : p.pageHref,
4521
+ "aria-current": on ? "page" : void 0,
4522
+ className: cn(
4523
+ "-mb-px inline-flex h-11 items-center border-b-2 text-[0.9375rem] transition-colors",
4524
+ on ? "border-foreground text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
4525
+ ),
4526
+ children: p.label
4527
+ }
4528
+ ) }, p.slug);
4529
+ }) }) }) });
4530
+ }
4531
+ var SPEC_FILE = {
4532
+ spec: {
4533
+ file: "SPEC.md",
4534
+ title: "Normative source",
4535
+ note: "This page is a human-readable summary. The authoritative copy lives in the spec repo. If the two ever drift, the repo wins."
4536
+ },
4537
+ security: {
4538
+ file: "SECURITY.md",
4539
+ title: "Normative threat model",
4540
+ note: "This page is the short form. The authoritative, numbered threat model lives in the spec repo."
4541
+ },
4542
+ rationale: {
4543
+ file: "WHY.md",
4544
+ title: "Design rationale",
4545
+ note: "This page is the short version. The full rationale and the rejected-design log live in the spec repo."
4546
+ }
4547
+ };
4548
+ function SpecCard(props) {
4549
+ return props.repo !== void 0 ? /* @__PURE__ */ jsx(SpecFileNote, { ...props }) : /* @__PURE__ */ jsx(ProtocolSpecCard, { ...props });
4550
+ }
4551
+ function SpecFileNote({ repo, file, kind = "spec", version, note, className }) {
4552
+ const d = SPEC_FILE[kind];
4553
+ const f = file ?? d.file;
4554
+ return /* @__PURE__ */ jsxs(Callout, { title: version ? `${d.title} \xB7 ${version}` : d.title, className, children: [
4555
+ /* @__PURE__ */ jsx("p", { children: note ?? d.note }),
4556
+ /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx(TextLink, { href: `https://github.com/orangecheck/${repo}/blob/main/${f}`, className: "break-all font-mono text-[0.875rem]", children: `${repo}/${f}` }) })
4556
4557
  ] });
4557
4558
  }
4558
- function Steps({ children, className }) {
4559
- return /* @__PURE__ */ jsx("ol", { className: cn("not-prose my-8 flex flex-col [counter-reset:oca-step] [&>li:last-child>span:nth-child(2)]:hidden", className), children });
4559
+ function ProtocolSpecCard({ protocol: protocol2, version, license, vectors, size = "md", className }) {
4560
+ const p = protocolSite(protocol2);
4561
+ const repo = `oc-${p.slug}-protocol`;
4562
+ const facts = [
4563
+ ["Version", version],
4564
+ ...license ? [["Licence", license]] : [],
4565
+ ["Nostr kind", p.kinds],
4566
+ ...vectors !== void 0 ? [["Test vectors", String(vectors)]] : []
4567
+ ];
4568
+ if (size === "sm") {
4569
+ return /* @__PURE__ */ jsxs(
4570
+ "a",
4571
+ {
4572
+ href: p.specHref,
4573
+ className: cn(
4574
+ "group flex flex-wrap items-center gap-x-4 gap-y-1 rounded-2xl border border-border bg-card px-4 py-3 text-[0.875rem] transition-colors hover:border-oca-hairline-strong",
4575
+ className
4576
+ ),
4577
+ children: [
4578
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-[0.8125rem] text-foreground", children: repo }),
4579
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: facts.map(([k, v]) => k === "Version" ? `v${v}` : k === "Nostr kind" ? `kind ${v}` : v).join(" \xB7 ") }),
4580
+ /* @__PURE__ */ jsxs("span", { className: "ml-auto flex items-center gap-1 text-muted-foreground group-hover:text-foreground", children: [
4581
+ "Read the spec ",
4582
+ /* @__PURE__ */ jsx(ArrowUpRight, { "aria-hidden": true, className: "size-4" })
4583
+ ] })
4584
+ ]
4585
+ }
4586
+ );
4587
+ }
4588
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-6 rounded-[1.25rem] border border-border bg-card p-6 md:p-8", className), children: [
4589
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [
4590
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1.5", children: [
4591
+ /* @__PURE__ */ jsx("p", { className: "text-[0.875rem] text-muted-foreground", children: "The spec" }),
4592
+ /* @__PURE__ */ jsx("h3", { className: "oca-title break-all font-mono text-[1.0625rem] tracking-normal", children: repo })
4593
+ ] }),
4594
+ p.status !== "live" ? /* @__PURE__ */ jsx(StatusBadge, { status: p.status }) : null
4595
+ ] }),
4596
+ /* @__PURE__ */ jsx("dl", { className: "grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-4", children: facts.map(([k, v]) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
4597
+ /* @__PURE__ */ jsx("dt", { className: "text-[0.8125rem] text-muted-foreground", children: k }),
4598
+ /* @__PURE__ */ jsx("dd", { className: "oca-tabular text-[1.0625rem]", children: v })
4599
+ ] }, k)) }),
4600
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, { asChild: true, variant: "secondary", size: "sm", children: /* @__PURE__ */ jsxs("a", { href: p.specHref, children: [
4601
+ "Read the spec ",
4602
+ /* @__PURE__ */ jsx(ArrowUpRight, { "aria-hidden": true })
4603
+ ] }) }) })
4604
+ ] });
4560
4605
  }
4561
- function LinkCard({
4562
- href,
4606
+ function VerifyBox({
4607
+ action,
4608
+ param = "q",
4563
4609
  title,
4564
4610
  description,
4565
- icon,
4566
- meta,
4611
+ label = "Id, envelope or link",
4612
+ placeholder,
4613
+ hint,
4614
+ submitLabel = "Verify",
4615
+ multiline = false,
4616
+ onVerify,
4567
4617
  className
4568
4618
  }) {
4569
- const Arrow = isInternal(href) ? ArrowRight : ArrowUpRight;
4619
+ const [value, setValue] = useState("");
4620
+ const submit = (e) => {
4621
+ if (!onVerify) return;
4622
+ e.preventDefault();
4623
+ if (value.trim()) onVerify(value.trim());
4624
+ };
4625
+ const button = /* @__PURE__ */ jsx(Button, { type: "submit", className: multiline ? void 0 : "w-full sm:w-auto", children: submitLabel });
4570
4626
  return /* @__PURE__ */ jsxs(
4571
- DocLink,
4627
+ "form",
4572
4628
  {
4573
- href,
4574
- className: cn(
4575
- "group flex h-full flex-col gap-3 rounded-[1.25rem] border border-border bg-card p-5 transition-colors hover:border-oca-hairline-strong",
4576
- className
4577
- ),
4629
+ action,
4630
+ method: "get",
4631
+ onSubmit: submit,
4632
+ className: cn("flex flex-col gap-5 rounded-[1.25rem] border border-border bg-card p-6 md:p-8", className),
4578
4633
  children: [
4579
- /* @__PURE__ */ jsxs("span", { className: "flex items-start justify-between gap-3", children: [
4580
- icon ? /* @__PURE__ */ jsx("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-xl bg-muted text-foreground [&_svg]:size-[1.125rem]", children: icon }) : /* @__PURE__ */ jsx("span", { className: "text-[1rem] font-medium leading-snug text-foreground", children: title }),
4581
- /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-2", children: [
4582
- meta,
4583
- /* @__PURE__ */ jsx(Arrow, { "aria-hidden": true, className: "size-4 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-foreground" })
4584
- ] })
4585
- ] }),
4586
- icon ? /* @__PURE__ */ jsx("span", { className: "text-[1rem] font-medium leading-snug text-foreground", children: title }) : null,
4587
- description ? /* @__PURE__ */ jsx("span", { className: "text-[0.9375rem] leading-relaxed text-muted-foreground", children: description }) : null
4634
+ title || description ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
4635
+ title ? /* @__PURE__ */ jsx("h3", { className: "oca-title", children: title }) : null,
4636
+ description ? /* @__PURE__ */ jsx("p", { className: "oca-body text-[0.9375rem]", children: description }) : null
4637
+ ] }) : null,
4638
+ multiline ? /* @__PURE__ */ jsxs(Fragment, { children: [
4639
+ /* @__PURE__ */ jsx(Field, { label, hint, children: /* @__PURE__ */ jsx(
4640
+ Textarea,
4641
+ {
4642
+ name: param,
4643
+ required: true,
4644
+ value,
4645
+ onChange: (e) => setValue(e.target.value),
4646
+ placeholder,
4647
+ spellCheck: false,
4648
+ className: "min-h-32 font-mono text-base md:text-[0.8125rem]"
4649
+ }
4650
+ ) }),
4651
+ /* @__PURE__ */ jsx("div", { children: button })
4652
+ ] }) : /* @__PURE__ */ jsx(Field, { label, hint, action: button, children: /* @__PURE__ */ jsx(
4653
+ Input,
4654
+ {
4655
+ name: param,
4656
+ required: true,
4657
+ value,
4658
+ onChange: (e) => setValue(e.target.value),
4659
+ placeholder,
4660
+ spellCheck: false,
4661
+ autoComplete: "off",
4662
+ className: "font-mono text-base md:text-[0.875rem]"
4663
+ }
4664
+ ) })
4588
4665
  ]
4589
4666
  }
4590
4667
  );
4591
4668
  }
4592
- function CardGrid({ columns = 2, children, className }) {
4593
- return /* @__PURE__ */ jsx("div", { className: cn("not-prose my-6 grid grid-cols-1 gap-3 sm:grid-cols-2", columns === 3 && "lg:grid-cols-3", className), children });
4594
- }
4595
- function MdxTable({ className, ...props }) {
4596
- return /* @__PURE__ */ jsx("div", { className: "not-prose my-6 overflow-hidden rounded-2xl border border-border bg-card", children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsx(
4597
- "table",
4598
- {
4599
- className: cn(
4600
- "w-full border-collapse text-left text-[0.875rem] leading-relaxed",
4601
- "[&_th]:whitespace-nowrap [&_th]:border-b [&_th]:border-oca-hairline-strong [&_th]:bg-oca-table-head [&_th]:px-4 [&_th]:py-2.5 [&_th]:text-[0.8125rem] [&_th]:font-medium [&_th]:text-foreground",
4602
- "[&_td]:border-t [&_td]:border-border [&_td]:px-4 [&_td]:py-2.5 [&_td]:align-top [&_td]:text-muted-foreground [&_tbody_tr:first-child_td]:border-t-0",
4603
- "[&_td_code]:bg-transparent [&_td_code]:p-0 [&_td_code]:text-foreground [&_td:first-child]:text-foreground",
4604
- "[&_[align=center]]:text-center [&_[align=right]]:text-right",
4605
- // On a phone a cell keeps a readable width; the table scrolls instead of crushing it.
4606
- "max-sm:[&_td]:min-w-[9rem]",
4607
- className
4608
- ),
4609
- ...props
4610
- }
4611
- ) }) });
4612
- }
4613
- function ApiTable({
4669
+ var TINT = "bg-[color-mix(in_oklab,var(--oca-orange)_9%,var(--card))]";
4670
+ function ComparisonTable({
4671
+ columns,
4614
4672
  rows,
4615
- caption,
4616
- nameHeader = "Name",
4673
+ label,
4674
+ propertyHeading = "Property",
4617
4675
  className
4618
4676
  }) {
4619
- const hasDefault = rows.some((r) => r.default !== void 0);
4620
- const marks = (r) => /* @__PURE__ */ jsxs(Fragment, { children: [
4621
- r.required ? /* @__PURE__ */ jsx("span", { className: "text-[0.75rem] text-oca-accent-ink", children: "Required" }) : null,
4622
- r.deprecated ? /* @__PURE__ */ jsx(Badge, { tone: "muted", children: "Deprecated" }) : null,
4623
- r.status ? /* @__PURE__ */ jsx(StatusBadge, { status: r.status }) : null
4624
- ] });
4625
- return /* @__PURE__ */ jsxs("div", { className: cn("not-prose my-6", className), children: [
4626
- /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-2xl border border-border bg-card max-sm:hidden", children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-left text-[0.875rem]", children: [
4627
- caption ? /* @__PURE__ */ jsx("caption", { className: "sr-only", children: caption }) : null,
4628
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-oca-hairline-strong bg-oca-table-head text-[0.8125rem]", children: [
4629
- /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: nameHeader }),
4630
- /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Type" }),
4631
- hasDefault ? /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Default" }) : null,
4632
- /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Description" })
4633
- ] }) }),
4634
- /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-border", children: rows.map((r) => /* @__PURE__ */ jsxs("tr", { className: "align-top", children: [
4635
- /* @__PURE__ */ jsx("th", { scope: "row", className: "px-4 py-3 text-left font-normal", children: /* @__PURE__ */ jsxs("span", { className: "flex flex-col items-start gap-1", children: [
4636
- /* @__PURE__ */ jsx("code", { className: cn("font-mono text-[0.8125rem] text-foreground", r.deprecated && "line-through decoration-oca-subtle"), children: r.name }),
4637
- marks(r)
4638
- ] }) }),
4639
- /* @__PURE__ */ jsx("td", { className: "px-4 py-3 font-mono text-[0.8125rem] text-muted-foreground", children: r.type ?? "\u2014" }),
4640
- hasDefault ? /* @__PURE__ */ jsx("td", { className: "px-4 py-3 font-mono text-[0.8125rem] text-muted-foreground", children: r.default ?? "\u2014" }) : null,
4641
- /* @__PURE__ */ jsx("td", { className: "px-4 py-3 leading-relaxed text-muted-foreground", children: r.description })
4642
- ] }, r.name)) })
4643
- ] }) }) }),
4644
- /* @__PURE__ */ jsx("ul", { "aria-label": caption, className: "divide-y divide-border rounded-2xl border border-border bg-card sm:hidden", children: rows.map((r) => /* @__PURE__ */ jsxs("li", { className: "flex flex-col gap-1.5 px-4 py-3.5", children: [
4645
- /* @__PURE__ */ jsxs("span", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
4646
- /* @__PURE__ */ jsx("code", { className: cn("font-mono text-[0.875rem] text-foreground", r.deprecated && "line-through decoration-oca-subtle"), children: r.name }),
4647
- r.type ? /* @__PURE__ */ jsx("code", { className: "break-all font-mono text-[0.8125rem] text-muted-foreground", children: r.type }) : null
4677
+ const wide = columns.length > 3;
4678
+ const grid = wide ? "lg:grid lg:grid-cols-[var(--oca-compare)]" : "md:grid md:grid-cols-[var(--oca-compare)]";
4679
+ const desk = wide ? "lg" : "md";
4680
+ const style = {
4681
+ // The argued-for column gets a little more room: its answers carry the page.
4682
+ "--oca-compare": ["minmax(0, 1.4fr)", ...columns.map((c) => c.highlight ? "minmax(0, 1.3fr)" : "minmax(0, 1fr)")].join(" ")
4683
+ };
4684
+ const ordered = [...columns].sort((a, b) => Number(Boolean(b.highlight)) - Number(Boolean(a.highlight)));
4685
+ return /* @__PURE__ */ jsxs("ul", { "aria-label": label, style, className: cn("divide-y divide-border rounded-[1.25rem] border border-border bg-card", className), children: [
4686
+ /* @__PURE__ */ jsxs(
4687
+ "li",
4688
+ {
4689
+ "aria-hidden": true,
4690
+ className: cn(
4691
+ "hidden gap-5 px-5 py-4 text-[0.875rem] font-medium text-muted-foreground",
4692
+ wide ? "lg:grid lg:px-8" : "md:grid md:px-8",
4693
+ grid
4694
+ ),
4695
+ children: [
4696
+ /* @__PURE__ */ jsx("span", { children: propertyHeading }),
4697
+ columns.map((c) => /* @__PURE__ */ jsx("span", { className: cn(c.highlight && cn(TINT, "-my-4 px-4 py-4 text-oca-accent-ink")), children: c.label }, c.key))
4698
+ ]
4699
+ }
4700
+ ),
4701
+ rows.map((r, ri) => /* @__PURE__ */ jsxs("li", { className: cn("grid grid-cols-1 gap-3 px-5 py-5", wide ? "lg:items-start lg:gap-5 lg:px-8" : "md:items-start md:gap-5 md:px-8", grid), children: [
4702
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
4703
+ /* @__PURE__ */ jsx("span", { className: "oca-title-sm", children: r.label }),
4704
+ r.note ? /* @__PURE__ */ jsx("span", { className: "text-[0.875rem] leading-snug text-muted-foreground", children: r.note }) : null
4648
4705
  ] }),
4649
- /* @__PURE__ */ jsx("span", { className: "flex flex-wrap items-center gap-2 empty:hidden", children: marks(r) }),
4650
- r.description ? /* @__PURE__ */ jsx("span", { className: "text-[0.875rem] leading-relaxed text-muted-foreground", children: r.description }) : null,
4651
- r.default !== void 0 ? /* @__PURE__ */ jsxs("span", { className: "text-[0.8125rem] text-muted-foreground", children: [
4652
- "Default ",
4653
- /* @__PURE__ */ jsx("code", { className: "font-mono text-foreground", children: r.default })
4654
- ] }) : null
4655
- ] }, r.name)) })
4706
+ /* @__PURE__ */ jsx("div", { className: cn("grid grid-cols-2 gap-1", desk === "lg" ? "lg:contents" : "md:contents"), children: columns.map((c) => {
4707
+ return /* @__PURE__ */ jsxs(
4708
+ "div",
4709
+ {
4710
+ style: { "--oca-order": ordered.indexOf(c) },
4711
+ className: cn(
4712
+ // Two rows of the pair's grid (name, answer), so answers line up
4713
+ // across a pair even when one name wraps.
4714
+ "order-[var(--oca-order)] row-span-2 grid min-w-0 grid-rows-subgrid gap-1 rounded-xl px-3 py-2.5",
4715
+ desk === "lg" ? "lg:order-none lg:row-span-1 lg:flex lg:flex-col" : "md:order-none md:row-span-1 md:flex md:flex-col",
4716
+ c.highlight ? cn(
4717
+ TINT,
4718
+ "col-span-2",
4719
+ desk === "lg" ? "lg:col-span-1 lg:-my-5 lg:self-stretch lg:rounded-none lg:px-4 lg:py-5" : "md:col-span-1 md:-my-5 md:self-stretch md:rounded-none md:px-4 md:py-5"
4720
+ ) : desk === "lg" ? "lg:p-0" : "md:p-0"
4721
+ ),
4722
+ children: [
4723
+ /* @__PURE__ */ jsx(
4724
+ "span",
4725
+ {
4726
+ className: cn(
4727
+ "text-[0.8125rem]",
4728
+ c.highlight ? "text-oca-accent-ink" : "text-muted-foreground",
4729
+ desk === "lg" ? "lg:sr-only" : "md:sr-only"
4730
+ ),
4731
+ children: c.label
4732
+ }
4733
+ ),
4734
+ /* @__PURE__ */ jsx("span", { className: cn("text-[0.9375rem]", c.highlight && "font-medium"), children: r.values[c.key] ?? "\u2014" })
4735
+ ]
4736
+ },
4737
+ c.key
4738
+ );
4739
+ }) })
4740
+ ] }, ri))
4656
4741
  ] });
4657
4742
  }
4658
- function useDarkMode() {
4659
- const [dark, setDark] = useState(false);
4660
- useEffect(() => {
4661
- const root = document.documentElement;
4662
- const read = () => setDark(root.classList.contains("dark"));
4663
- read();
4664
- const mo = new MutationObserver(read);
4665
- mo.observe(root, { attributes: true, attributeFilter: ["class"] });
4666
- return () => mo.disconnect();
4667
- }, []);
4668
- return dark;
4669
- }
4670
- function mermaidTheme(el) {
4671
- const css = getComputedStyle(el);
4672
- const v = (name) => css.getPropertyValue(name).trim();
4673
- const card = v("--card");
4674
- const muted = v("--muted");
4675
- const text = v("--foreground");
4676
- const subtle = v("--muted-foreground");
4677
- const line = v("--input");
4678
- const hair = v("--oca-hairline-strong");
4679
- return {
4680
- background: "transparent",
4681
- fontFamily: css.fontFamily,
4682
- fontSize: "14px",
4683
- textColor: text,
4684
- mainBkg: card,
4685
- primaryColor: card,
4686
- primaryTextColor: text,
4687
- primaryBorderColor: hair,
4688
- secondaryColor: muted,
4689
- secondaryTextColor: text,
4690
- secondaryBorderColor: hair,
4691
- tertiaryColor: muted,
4692
- tertiaryTextColor: text,
4693
- tertiaryBorderColor: hair,
4694
- nodeBorder: hair,
4695
- lineColor: line,
4696
- edgeLabelBackground: card,
4697
- clusterBkg: muted,
4698
- clusterBorder: hair,
4699
- titleColor: text,
4700
- noteBkgColor: muted,
4701
- noteTextColor: text,
4702
- noteBorderColor: hair,
4703
- actorBkg: card,
4704
- actorBorder: hair,
4705
- actorTextColor: text,
4706
- actorLineColor: line,
4707
- signalColor: text,
4708
- signalTextColor: text,
4709
- labelBoxBkgColor: card,
4710
- labelBoxBorderColor: hair,
4711
- labelTextColor: text,
4712
- loopTextColor: subtle,
4713
- activationBkgColor: muted,
4714
- activationBorderColor: hair,
4715
- sequenceNumberColor: card
4716
- };
4717
- }
4718
- function naturalSize(svg) {
4719
- const w = svg.match(/viewBox="[\d.-]+ [\d.-]+ ([\d.]+) [\d.]+"/)?.[1];
4720
- if (!w) return svg;
4721
- return svg.replace(/<svg([^>]*?)\swidth="100%"/, `<svg$1 width="${Math.ceil(Number(w))}"`).replace(/max-width:\s*[\d.]+px;?/, "");
4722
- }
4723
- function Diagram({ chart, caption, load, className }) {
4724
- const ref = useRef(null);
4725
- const dark = useDarkMode();
4726
- const raw = useId();
4727
- const [svg, setSvg] = useState(null);
4728
- const [failed, setFailed] = useState(false);
4729
- useEffect(() => {
4730
- let live = true;
4731
- const el = ref.current;
4732
- if (!el) return;
4733
- (async () => {
4734
- try {
4735
- const mod = await load();
4736
- const mermaid = "default" in mod ? mod.default : mod;
4737
- mermaid.initialize({ startOnLoad: false, securityLevel: "strict", theme: "base", themeVariables: mermaidTheme(el) });
4738
- const { svg: drawn } = await mermaid.render(`oca-diagram-${raw.replace(/[^a-zA-Z0-9]/g, "")}-${dark ? "d" : "l"}`, chart);
4739
- if (live) {
4740
- setSvg(naturalSize(drawn));
4741
- setFailed(false);
4742
- }
4743
- } catch {
4744
- if (live) setFailed(true);
4745
- }
4746
- })();
4747
- return () => {
4748
- live = false;
4749
- };
4750
- }, [chart, dark, load, raw]);
4751
- if (failed) return /* @__PURE__ */ jsx(CodeBlock, { code: chart, caption: "Diagram (shown as its source)", className: cn("my-6", className) });
4752
- return /* @__PURE__ */ jsxs("figure", { ref, className: cn("not-prose my-6 overflow-hidden rounded-[1.25rem] border border-border bg-card", className), children: [
4753
- svg ? /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsx(
4754
- "div",
4755
- {
4756
- className: "flex w-max min-w-full justify-center p-6 [&_svg]:h-auto [&_svg]:max-w-none",
4757
- role: "img",
4758
- "aria-label": typeof caption === "string" ? caption : "Diagram",
4759
- dangerouslySetInnerHTML: { __html: svg }
4760
- }
4761
- ) }) : /* @__PURE__ */ jsx("div", { role: "status", "aria-label": "Drawing the diagram", className: "p-6", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full rounded-xl" }) }),
4762
- caption ? /* @__PURE__ */ jsx("figcaption", { className: "border-t border-border px-5 py-3 text-[0.8125rem] text-muted-foreground", children: caption }) : null
4763
- ] });
4764
- }
4765
- var HEADING = {
4766
- h1: "oca-display-3 mb-4 text-foreground",
4767
- h2: "mb-3 mt-12 text-[1.375rem] font-medium leading-tight tracking-[-0.015em] text-foreground md:text-[1.5rem]",
4768
- h3: "mb-2 mt-9 text-[1.125rem] font-medium leading-snug tracking-[-0.01em] text-foreground",
4769
- h4: "mb-2 mt-7 text-[1rem] font-medium leading-snug text-foreground"
4743
+ var CHECK = {
4744
+ ok: { word: "Passed", icon: /* @__PURE__ */ jsx(CircleCheck, {}), tone: "text-success" },
4745
+ fail: { word: "Failed", icon: /* @__PURE__ */ jsx(CircleX, {}), tone: "text-destructive" },
4746
+ pending: { word: "Pending", icon: /* @__PURE__ */ jsx(Clock, {}), tone: "text-oca-accent-ink" },
4747
+ none: { word: "None", icon: /* @__PURE__ */ jsx(CircleSlash, {}), tone: "text-muted-foreground" },
4748
+ skipped: { word: "Skipped", icon: /* @__PURE__ */ jsx(CircleMinus, {}), tone: "text-muted-foreground" },
4749
+ unchecked: { word: "Not checked", icon: /* @__PURE__ */ jsx(CircleDashed, {}), tone: "text-oca-subtle" }
4770
4750
  };
4771
- function DocsHeading({
4772
- as: Tag,
4773
- id,
4774
- children,
4775
- className,
4776
- ...props
4751
+ function VerifyReport({
4752
+ verdict,
4753
+ title,
4754
+ summary,
4755
+ checks,
4756
+ facts,
4757
+ notChecked,
4758
+ actions,
4759
+ as: Heading = "h2",
4760
+ className
4777
4761
  }) {
4778
- return /* @__PURE__ */ jsxs(Tag, { id, className: cn("group scroll-mt-28", HEADING[Tag], className), ...props, children: [
4779
- /* @__PURE__ */ jsx("span", { "data-heading-text": "", children }),
4780
- id && Tag !== "h1" ? /* @__PURE__ */ jsxs(
4781
- "a",
4762
+ return /* @__PURE__ */ jsxs(
4763
+ "section",
4764
+ {
4765
+ "aria-label": "Verification result",
4766
+ className: cn("overflow-hidden rounded-[1.25rem] border border-border bg-card", className),
4767
+ children: [
4768
+ /* @__PURE__ */ jsxs("header", { className: "flex flex-col items-start gap-3 p-6 md:p-8", children: [
4769
+ /* @__PURE__ */ jsx(StatusBadge, { status: verdict }),
4770
+ /* @__PURE__ */ jsx(Heading, { className: "oca-display-3 [overflow-wrap:anywhere]", children: title }),
4771
+ summary ? /* @__PURE__ */ jsx("p", { className: "oca-body max-w-[40rem] [overflow-wrap:anywhere]", children: summary }) : null
4772
+ ] }),
4773
+ /* @__PURE__ */ jsx("ul", { "aria-label": "Checks", className: "divide-y divide-border border-t border-border", children: checks.map((c, i) => {
4774
+ const k = CHECK[c.state];
4775
+ return /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-3 px-6 py-3.5 md:px-8", children: [
4776
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cn("mt-0.5 shrink-0 [&_svg]:size-[1.125rem]", k.tone), children: k.icon }),
4777
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5 sm:flex-row sm:items-baseline sm:justify-between sm:gap-6", children: [
4778
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
4779
+ /* @__PURE__ */ jsx("span", { className: "text-[0.9375rem]", children: c.label }),
4780
+ c.note ? /* @__PURE__ */ jsx("span", { className: "break-words text-[0.8125rem] leading-snug text-muted-foreground", children: c.note }) : null
4781
+ ] }),
4782
+ /* @__PURE__ */ jsx(
4783
+ "span",
4784
+ {
4785
+ className: cn(
4786
+ "shrink-0 text-[0.8125rem]",
4787
+ c.state === "fail" ? "text-destructive" : "text-muted-foreground"
4788
+ ),
4789
+ children: k.word
4790
+ }
4791
+ )
4792
+ ] })
4793
+ ] }, i);
4794
+ }) }),
4795
+ facts && facts.length > 0 ? /* @__PURE__ */ jsx(KeyValueList, { items: facts, className: "rounded-none border-x-0 border-b-0 bg-transparent [&>div]:px-6 md:[&>div]:px-8" }) : null,
4796
+ notChecked && notChecked.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 border-t border-border bg-muted/50 px-6 py-5 md:px-8", children: [
4797
+ /* @__PURE__ */ jsx("p", { className: "text-[0.875rem] font-medium", children: "What this did not check" }),
4798
+ /* @__PURE__ */ jsx("ul", { className: "flex list-disc flex-col gap-1 pl-5 text-[0.875rem] leading-relaxed text-muted-foreground", children: notChecked.map((n, i) => /* @__PURE__ */ jsx("li", { children: n }, i)) })
4799
+ ] }) : null,
4800
+ actions ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3 border-t border-border px-6 py-5 md:px-8", children: actions }) : null
4801
+ ]
4802
+ }
4803
+ );
4804
+ }
4805
+ function SignMessage({
4806
+ lead,
4807
+ address,
4808
+ message,
4809
+ wallets,
4810
+ busy = false,
4811
+ error,
4812
+ submitLabel = "Confirm",
4813
+ secondary,
4814
+ onSignature,
4815
+ className
4816
+ }) {
4817
+ const [pasted, setPasted] = useState("");
4818
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-5", className), children: [
4819
+ lead ? /* @__PURE__ */ jsx("p", { className: "text-[0.9375rem] leading-relaxed", children: lead }) : null,
4820
+ wallets ? /* @__PURE__ */ jsxs(Fragment, { children: [
4821
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: wallets }),
4822
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 text-[0.8125rem] text-muted-foreground", children: [
4823
+ /* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-border" }),
4824
+ "or sign it in any wallet",
4825
+ /* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-border" })
4826
+ ] })
4827
+ ] }) : null,
4828
+ /* @__PURE__ */ jsx(CodeBlock, { code: message, caption: "Message to sign" }),
4829
+ /* @__PURE__ */ jsxs(
4830
+ "form",
4782
4831
  {
4783
- href: `#${id}`,
4784
- className: "ml-2 inline-block rounded-md px-1 align-baseline text-[0.85em] font-normal text-oca-subtle no-underline opacity-0 transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100",
4832
+ className: "flex flex-col gap-4",
4833
+ onSubmit: (e) => {
4834
+ e.preventDefault();
4835
+ if (pasted.trim()) onSignature(pasted.trim());
4836
+ },
4785
4837
  children: [
4786
- /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "#" }),
4787
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Link to this section" })
4838
+ /* @__PURE__ */ jsx(
4839
+ Field,
4840
+ {
4841
+ label: "Signature",
4842
+ error,
4843
+ hint: /* @__PURE__ */ jsxs(Fragment, { children: [
4844
+ "From your wallet\u2019s \u201Csign message\u201D (BIP-322), signed by",
4845
+ " ",
4846
+ /* @__PURE__ */ jsx("span", { className: "break-all font-mono", children: address }),
4847
+ "."
4848
+ ] }),
4849
+ children: /* @__PURE__ */ jsx(
4850
+ Textarea,
4851
+ {
4852
+ value: pasted,
4853
+ onChange: (e) => setPasted(e.target.value),
4854
+ rows: 3,
4855
+ spellCheck: false,
4856
+ className: "min-h-24 font-mono text-base md:text-[0.8125rem]"
4857
+ }
4858
+ )
4859
+ }
4860
+ ),
4861
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
4862
+ /* @__PURE__ */ jsx(Button, { type: "submit", loading: busy, disabled: !pasted.trim(), children: submitLabel }),
4863
+ secondary
4864
+ ] })
4788
4865
  ]
4789
4866
  }
4790
- ) : null
4867
+ )
4791
4868
  ] });
4792
4869
  }
4793
- function codeText(node) {
4794
- if (typeof node === "string") return node;
4795
- if (typeof node === "number") return String(node);
4796
- if (Array.isArray(node)) return node.map(codeText).join("");
4797
- if (isValidElement(node)) return codeText(node.props.children);
4798
- return "";
4799
- }
4800
- function codeLang(node) {
4801
- const child = Children.toArray(node)[0];
4802
- if (!isValidElement(child)) return void 0;
4803
- const cls = child.props.className ?? "";
4804
- return cls.match(/language-([\w+-]+)/)?.[1];
4805
- }
4806
4870
  function useMacKeys() {
4807
4871
  const [mac, setMac] = useState(true);
4808
4872
  useEffect(() => {
@@ -5605,7 +5669,7 @@ function ToolGrid({
5605
5669
  ] }),
5606
5670
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
5607
5671
  /* @__PURE__ */ jsx(Heading, { className: "oca-title-sm", children: /* @__PURE__ */ jsx(
5608
- Link8,
5672
+ Link6,
5609
5673
  {
5610
5674
  href: t.href,
5611
5675
  className: "outline-none after:absolute after:inset-0 after:rounded-[1.25rem] after:content-['']",
@@ -5698,813 +5762,861 @@ function FamilyMenu({ current: current2, className }) {
5698
5762
  )
5699
5763
  ] });
5700
5764
  }
5701
- function NavLink({
5702
- item,
5703
- className,
5704
- onNavigate,
5705
- line = false
5765
+ function SideNav({ groups, onNavigate }) {
5766
+ return /* @__PURE__ */ jsx("nav", { "aria-label": "Pages", className: "flex flex-col gap-5", children: groups.map((g, gi) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
5767
+ g.label ? /* @__PURE__ */ jsx("p", { className: "px-3 pb-1 text-[0.8125rem] text-muted-foreground", children: g.label }) : null,
5768
+ g.items.map((it) => /* @__PURE__ */ jsxs(
5769
+ Link6,
5770
+ {
5771
+ href: it.href,
5772
+ onClick: onNavigate,
5773
+ "aria-current": it.active ? "page" : void 0,
5774
+ className: cn(
5775
+ "flex h-9 items-center gap-3 rounded-xl px-3 text-[0.9375rem] transition-colors",
5776
+ "[&_svg]:size-[1.0625rem] [&_svg]:shrink-0",
5777
+ it.active ? "bg-card text-foreground shadow-sm ring-1 ring-border [&_svg]:text-foreground" : "text-muted-foreground hover:bg-accent hover:text-foreground"
5778
+ ),
5779
+ children: [
5780
+ it.icon,
5781
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: it.label }),
5782
+ it.badge ? /* @__PURE__ */ jsx("span", { className: "shrink-0", children: it.badge }) : null
5783
+ ]
5784
+ },
5785
+ it.href
5786
+ ))
5787
+ ] }, g.label ?? gi)) });
5788
+ }
5789
+ function SectionSwitch({
5790
+ sections,
5791
+ current: current2,
5792
+ onNavigate
5706
5793
  }) {
5707
- const cls = cn(
5708
- "rounded-full px-3 py-2 text-[0.9375rem] transition-colors",
5709
- item.active ? "text-foreground" : "text-muted-foreground hover:text-foreground",
5710
- line && "relative after:absolute after:inset-x-3 after:-bottom-[0.625rem] after:h-0.5 after:rounded-full",
5711
- line && item.active && "after:bg-foreground",
5712
- className
5713
- );
5714
- if (item.external) {
5715
- return /* @__PURE__ */ jsx("a", { href: item.href, className: cls, rel: "noreferrer", onClick: onNavigate, children: item.label });
5716
- }
5717
- return /* @__PURE__ */ jsx(Link8, { href: item.href, className: cls, "aria-current": item.active ? "page" : void 0, onClick: onNavigate, children: item.label });
5718
- }
5719
- function NavRow({ item, onNavigate }) {
5720
- const body = /* @__PURE__ */ jsxs(Fragment, { children: [
5721
- /* @__PURE__ */ jsx("span", { className: "text-[0.9375rem] font-medium leading-6 text-foreground", children: item.label }),
5722
- item.description ? /* @__PURE__ */ jsx("span", { className: "text-[0.8125rem] leading-snug text-muted-foreground", children: item.description }) : null
5723
- ] });
5724
- const cls = cn(
5725
- "flex flex-col gap-0.5 rounded-xl px-3 py-2 transition-colors hover:bg-accent",
5726
- item.active && "bg-muted hover:bg-muted dark:bg-white/[0.06]"
5794
+ const cols = sections.length <= 3 ? sections.length : 2;
5795
+ return /* @__PURE__ */ jsx(
5796
+ "nav",
5797
+ {
5798
+ "aria-label": "Sections",
5799
+ className: cn("grid gap-1 bg-muted p-1", cols === sections.length ? "rounded-full" : "rounded-[1.25rem]"),
5800
+ style: { gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))` },
5801
+ children: sections.map((sec) => {
5802
+ const on = sec.id === current2.id;
5803
+ return /* @__PURE__ */ jsx(
5804
+ Link6,
5805
+ {
5806
+ href: sec.href,
5807
+ onClick: onNavigate,
5808
+ "aria-current": on ? "true" : void 0,
5809
+ className: cn(
5810
+ "flex h-8 min-w-0 items-center justify-center rounded-full px-1.5 text-[0.8125rem] font-medium transition-colors",
5811
+ on ? "bg-card text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
5812
+ ),
5813
+ children: /* @__PURE__ */ jsx("span", { className: "truncate", children: sec.label })
5814
+ },
5815
+ sec.id
5816
+ );
5817
+ })
5818
+ }
5727
5819
  );
5728
- return item.external ? /* @__PURE__ */ jsx("a", { href: item.href, className: cls, rel: "noreferrer", onClick: onNavigate, children: body }) : /* @__PURE__ */ jsx(Link8, { href: item.href, className: cls, "aria-current": item.active ? "page" : void 0, onClick: onNavigate, children: body });
5729
- }
5730
- var seeAll = (item) => typeof item.label === "string" ? `All ${item.label.toLowerCase()}` : "See all";
5731
- function NavDropdown({ item }) {
5732
- const [open, setOpen] = useState(false);
5733
- const active = item.active || item.children?.some((c) => c.active);
5734
- return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
5735
- /* @__PURE__ */ jsxs(
5736
- PopoverTrigger,
5737
- {
5738
- className: cn(
5739
- "group inline-flex items-center gap-1 rounded-full py-2 pl-3 pr-2.5 text-[0.9375rem] transition-colors md:max-lg:pl-2.5 md:max-lg:pr-2",
5740
- active ? "text-foreground" : "text-muted-foreground hover:text-foreground data-[state=open]:text-foreground"
5741
- ),
5742
- children: [
5743
- item.label,
5744
- /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": true, className: "size-3.5 transition-transform duration-200 group-data-[state=open]:rotate-180" })
5745
- ]
5746
- }
5747
- ),
5748
- /* @__PURE__ */ jsxs(PopoverContent, { align: "center", sideOffset: 10, className: "w-[min(calc(100vw-2rem),26rem)] p-2", children: [
5749
- /* @__PURE__ */ jsx("ul", { className: "flex flex-col", children: item.children?.map((c) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(NavRow, { item: c, onNavigate: () => setOpen(false) }) }, c.href)) }),
5750
- /* @__PURE__ */ jsx("div", { className: "mt-1.5 border-t border-border px-1 pt-1.5", children: /* @__PURE__ */ jsx(
5751
- NavLink,
5752
- {
5753
- item: { ...item, label: seeAll(item), children: void 0 },
5754
- className: "block rounded-xl px-2 py-2 text-[0.875rem]",
5755
- onNavigate: () => setOpen(false)
5756
- }
5757
- ) })
5758
- ] })
5759
- ] });
5760
5820
  }
5761
- function SiteHeader({
5762
- home = "/",
5763
- brand,
5764
- product,
5765
- family,
5766
- nav = [],
5767
- search,
5768
- actions,
5769
- variant = "site",
5770
- navOnPhone = true,
5771
- menu: menuExtra,
5772
- className
5773
- }) {
5774
- const [open, setOpen] = useState(false);
5775
- const tool = variant === "tool";
5776
- const size = tool ? 24 : 28;
5777
- const current2 = typeof family === "string" ? family : void 0;
5778
- const phoneNav = navOnPhone ? nav : [];
5779
- const menu = phoneNav.length > 0 || Boolean(family) || Boolean(menuExtra);
5780
- const brandNode = brand ?? /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center", children: [
5781
- /* @__PURE__ */ jsx(Lockup, { size }),
5782
- product ? /* @__PURE__ */ jsxs(Fragment, { children: [
5783
- /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "mx-3 h-5 w-px bg-oca-hairline-strong" }),
5784
- /* @__PURE__ */ jsx("span", { className: "font-medium tracking-[-0.01em]", style: { fontSize: size * 0.56 }, children: product })
5785
- ] }) : null
5786
- ] });
5787
- const navigation = nav.length > 0 ? /* @__PURE__ */ jsx("nav", { "aria-label": "Main", className: "hidden items-center gap-1 md:flex", children: nav.map(
5788
- (n) => n.children?.length ? /* @__PURE__ */ jsx(NavDropdown, { item: n }, n.href) : (
5789
- // Between md and lg the family menu and the actions share the row: tighter.
5790
- /* @__PURE__ */ jsx(NavLink, { item: n, line: tool, className: tool ? void 0 : "md:max-lg:px-2.5" }, n.href)
5791
- )
5792
- ) }) : null;
5821
+ function TabBar({ items }) {
5793
5822
  return /* @__PURE__ */ jsx(
5794
- "header",
5823
+ "nav",
5795
5824
  {
5796
- className: cn(
5797
- "sticky top-0 z-40 w-full border-b bg-background/95 backdrop-blur-md supports-[backdrop-filter]:bg-background/90",
5798
- tool ? "border-border" : "border-transparent",
5799
- className
5800
- ),
5801
- children: /* @__PURE__ */ jsxs(
5825
+ "aria-label": "Pages",
5826
+ "data-oca-tabbar": "",
5827
+ className: "fixed inset-x-0 bottom-0 z-40 border-t border-border bg-background/90 pb-[env(safe-area-inset-bottom)] backdrop-blur-md md:hidden",
5828
+ children: /* @__PURE__ */ jsx(
5802
5829
  "div",
5803
5830
  {
5804
- className: cn(
5805
- "flex items-center justify-between gap-4",
5806
- tool ? "h-14 px-4 md:px-6" : "oca-container h-16 md:h-[4.5rem] md:max-lg:gap-2",
5807
- // Three columns, the outer two each at least their content: the
5808
- // navigation stays centred whatever the actions hold, so it does
5809
- // not shift when they change (signed out to signed in).
5810
- !tool && nav.length > 0 && "md:grid md:grid-cols-[minmax(max-content,1fr)_auto_minmax(max-content,1fr)]"
5811
- ),
5812
- children: [
5813
- /* @__PURE__ */ jsxs("div", { className: cn("flex min-w-0 items-center gap-1", tool ? "md:gap-1" : "justify-self-start"), children: [
5814
- /* @__PURE__ */ jsxs(Link8, { href: home, className: "-ml-1 min-w-0 rounded-lg p-1", children: [
5815
- brandNode,
5816
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: " home" })
5817
- ] }),
5818
- family ? /* @__PURE__ */ jsx(FamilyMenu, { current: current2, className: "max-md:hidden" }) : null,
5819
- tool && navigation ? /* @__PURE__ */ jsx("div", { className: "ml-5", children: navigation }) : null
5820
- ] }),
5821
- !tool ? navigation : null,
5822
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 justify-self-end", children: [
5823
- search,
5824
- actions,
5825
- menu ? /* @__PURE__ */ jsxs(Sheet, { open, onOpenChange: setOpen, children: [
5826
- /* @__PURE__ */ jsx(
5827
- SheetTrigger,
5831
+ className: "mx-auto grid h-14 max-w-[32rem] px-1.5",
5832
+ style: { gridTemplateColumns: `repeat(${items.length}, minmax(0, 1fr))` },
5833
+ children: items.map((it) => /* @__PURE__ */ jsxs(
5834
+ Link6,
5835
+ {
5836
+ href: it.href,
5837
+ "aria-current": it.active ? "page" : void 0,
5838
+ className: cn(
5839
+ "flex min-w-0 flex-col items-center justify-center gap-1 rounded-2xl text-[0.6875rem] leading-none outline-none transition-colors [-webkit-tap-highlight-color:transparent] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
5840
+ it.active ? "text-foreground" : "text-muted-foreground hover:text-foreground"
5841
+ ),
5842
+ children: [
5843
+ /* @__PURE__ */ jsxs(
5844
+ "span",
5828
5845
  {
5829
- className: "inline-flex size-10 items-center justify-center rounded-full text-foreground hover:bg-accent md:hidden",
5830
- "aria-label": "Open menu",
5831
- children: /* @__PURE__ */ jsx(Menu, { className: "size-5" })
5846
+ className: cn(
5847
+ "relative flex h-7 w-12 items-center justify-center rounded-full transition-[background-color,box-shadow] duration-200",
5848
+ "[&_svg]:size-[1.125rem] [&_svg]:shrink-0",
5849
+ it.active ? "bg-card shadow-sm ring-1 ring-border [&_svg]:stroke-2" : "[&_svg]:stroke-[1.75]"
5850
+ ),
5851
+ children: [
5852
+ it.icon,
5853
+ it.badge ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute right-2.5 top-0.5 size-2 rounded-full bg-oca-orange ring-2 ring-background" }) : null
5854
+ ]
5832
5855
  }
5833
5856
  ),
5834
- /* @__PURE__ */ jsxs(SheetContent, { side: "right", className: "pt-16", children: [
5835
- /* @__PURE__ */ jsx(SheetTitle, { className: "sr-only", children: "Menu" }),
5836
- menuExtra ? /* @__PURE__ */ jsx("div", { className: cn("flex flex-col", (phoneNav.length > 0 || family) && "border-b border-border pb-3"), children: menuExtra }) : null,
5837
- phoneNav.length > 0 ? /* @__PURE__ */ jsx("nav", { "aria-label": "Main", className: "flex flex-col", children: phoneNav.map(
5838
- (n) => n.children?.length ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col py-2", children: [
5839
- /* @__PURE__ */ jsx("p", { className: "px-3 pb-1 text-[0.8125rem] text-muted-foreground", children: n.label }),
5840
- n.children.map((c) => /* @__PURE__ */ jsx(
5841
- NavLink,
5842
- {
5843
- item: c,
5844
- className: "rounded-xl px-3 py-2.5 text-[1.0625rem]",
5845
- onNavigate: () => setOpen(false)
5846
- },
5847
- c.href
5848
- ))
5849
- ] }, n.href) : /* @__PURE__ */ jsx(
5850
- NavLink,
5851
- {
5852
- item: n,
5853
- className: "rounded-xl px-3 py-3 text-[1.0625rem]",
5854
- onNavigate: () => setOpen(false)
5855
- },
5856
- n.href
5857
- )
5858
- ) }) : null,
5859
- family ? /* @__PURE__ */ jsxs("details", { className: cn("group", phoneNav.length > 0 && "mt-2 border-t border-border pt-4"), children: [
5860
- /* @__PURE__ */ jsxs("summary", { className: "flex cursor-pointer list-none items-center justify-between rounded-xl px-3 py-2.5 text-[1.0625rem] [&::-webkit-details-marker]:hidden", children: [
5861
- "All orangecheck sites",
5862
- /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": true, className: "size-4 text-muted-foreground transition-transform group-open:rotate-180" })
5863
- ] }),
5864
- /* @__PURE__ */ jsx(FamilyList, { current: current2, onNavigate: () => setOpen(false), stack: true, className: "mt-2" })
5865
- ] }) : null
5866
- ] })
5867
- ] }) : null
5868
- ] })
5869
- ]
5857
+ /* @__PURE__ */ jsx("span", { className: "max-w-full truncate px-0.5", children: it.label }),
5858
+ it.badge ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: it.badge }) : null
5859
+ ]
5860
+ },
5861
+ it.href
5862
+ ))
5870
5863
  }
5871
5864
  )
5872
5865
  }
5873
5866
  );
5874
5867
  }
5875
- function SkipLink({ href = "#main-content", children = "Skip to content" }) {
5876
- return /* @__PURE__ */ jsx(
5877
- "a",
5878
- {
5879
- href,
5880
- className: "sr-only focus:not-sr-only focus:fixed focus:left-4 focus:top-3 focus:z-50 focus:rounded-full focus:border focus:border-border focus:bg-card focus:px-4 focus:py-2 focus:text-[0.9375rem] focus:font-medium focus:text-foreground focus:shadow-md",
5881
- children
5868
+ function tabsFor(groups) {
5869
+ const items = groups.flatMap((g) => g.items);
5870
+ return items.length >= 2 && items.length <= 5 && items.every((it) => it.icon) ? items : null;
5871
+ }
5872
+ var activeItem = (groups) => groups.flatMap((g) => g.items).find((it) => it.active);
5873
+ var warned = /* @__PURE__ */ new Set();
5874
+ function warnDuplicateLabels(groups) {
5875
+ if (typeof process === "undefined" || process.env.NODE_ENV === "production") return;
5876
+ const seen = /* @__PURE__ */ new Set();
5877
+ for (const it of groups.flatMap((g) => g.items)) {
5878
+ if (seen.has(it.label) && !warned.has(it.label)) {
5879
+ warned.add(it.label);
5880
+ console.warn(`AppShell: two pages are labelled "${it.label}"; give each its own name.`);
5882
5881
  }
5883
- );
5882
+ seen.add(it.label);
5883
+ }
5884
5884
  }
5885
- var BANNER_TONE = {
5886
- neutral: "border-border bg-muted",
5887
- brand: "border-[color-mix(in_oklab,var(--oca-orange)_30%,var(--border))] bg-[color-mix(in_oklab,var(--oca-orange)_9%,var(--background))]",
5888
- danger: "border-[color-mix(in_oklab,var(--destructive)_35%,var(--border))] bg-[color-mix(in_oklab,var(--destructive)_8%,var(--background))]"
5889
- };
5890
- function SiteBanner({
5891
- tone = "neutral",
5885
+ function AppShell({
5886
+ nav,
5887
+ sections,
5888
+ activeSection,
5889
+ page: pageOverride,
5890
+ persistent = [],
5891
+ home = "/",
5892
+ family,
5893
+ account,
5894
+ banner,
5895
+ footer,
5892
5896
  children,
5893
- action,
5894
5897
  className
5895
5898
  }) {
5896
- return /* @__PURE__ */ jsx("div", { role: "status", "aria-live": "polite", "data-tone": tone, className: cn("border-b text-[0.875rem]", BANNER_TONE[tone], className), children: /* @__PURE__ */ jsxs("div", { className: "oca-container flex flex-wrap items-center justify-between gap-x-4 gap-y-1 py-2.5", children: [
5897
- /* @__PURE__ */ jsxs("p", { className: "flex min-w-0 items-baseline gap-2.5 leading-snug", children: [
5898
- tone !== "neutral" ? /* @__PURE__ */ jsx(
5899
- "span",
5900
- {
5901
- "aria-hidden": true,
5902
- className: cn(
5903
- "size-2 shrink-0 translate-y-[-0.05em] rounded-full",
5904
- tone === "brand" ? "bg-oca-orange" : "bg-destructive"
5905
- )
5906
- }
5907
- ) : null,
5908
- /* @__PURE__ */ jsx("span", { children })
5909
- ] }),
5910
- action ? /* @__PURE__ */ jsx("div", { className: cn("shrink-0 font-medium", tone !== "neutral" && "max-sm:pl-[1.125rem]"), children: action }) : null
5911
- ] }) });
5912
- }
5913
- var FOOT_LINK = "inline-flex min-h-11 items-center transition-colors hover:text-foreground md:min-h-0";
5914
- function LegalRow({ links }) {
5915
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-x-6 gap-y-2 sm:flex-row sm:items-center sm:justify-between", children: [
5916
- /* @__PURE__ */ jsx("nav", { "aria-label": "Legal", children: /* @__PURE__ */ jsx("ul", { className: "flex flex-wrap gap-x-5", children: links.map((l) => /* @__PURE__ */ jsx("li", { children: l.href.startsWith("/") ? /* @__PURE__ */ jsx(Link8, { href: l.href, className: FOOT_LINK, children: l.label }) : /* @__PURE__ */ jsx("a", { href: l.href, className: FOOT_LINK, children: l.label }) }, l.href)) }) }),
5917
- /* @__PURE__ */ jsxs("p", { children: [
5918
- "\xA9 ",
5919
- (/* @__PURE__ */ new Date()).getFullYear(),
5920
- " OrangeCheck"
5921
- ] })
5922
- ] });
5923
- }
5924
- function SiteFooter({
5925
- columns = [],
5926
- family = false,
5927
- legal = false,
5928
- compact = false,
5929
- fineprint,
5930
- meta,
5931
- signature = true,
5932
- className
5933
- }) {
5934
- const legalLinks = legal === true ? LEGAL_LINKS : legal || null;
5935
- if (compact) {
5936
- return /* @__PURE__ */ jsx("footer", { className: cn("border-t border-border bg-background text-[0.875rem] text-muted-foreground", className), children: /* @__PURE__ */ jsxs("div", { className: "oca-container flex flex-col gap-x-8 gap-y-3 py-5 lg:flex-row lg:items-center lg:justify-between", children: [
5937
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-1", children: [
5938
- /* @__PURE__ */ jsx("a", { href: OCHK_IO, className: "rounded-lg text-foreground", children: /* @__PURE__ */ jsx(Lockup, { size: 22 }) }),
5939
- family ? /* @__PURE__ */ jsx("nav", { "aria-label": "Protocols", children: /* @__PURE__ */ jsx("ul", { className: "flex flex-wrap gap-x-4", children: PROTOCOLS.map((p) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { href: p.pageHref, className: FOOT_LINK, children: p.label }) }, p.slug)) }) }) : null
5940
- ] }),
5941
- legalLinks || meta ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-x-6 gap-y-2 sm:flex-row sm:flex-wrap sm:items-center", children: [
5942
- legalLinks ? /* @__PURE__ */ jsx(LegalRow, { links: legalLinks }) : null,
5943
- meta
5944
- ] }) : null
5945
- ] }) });
5946
- }
5947
- const cols = [
5948
- ...columns,
5949
- ...family ? familyByGroup().map((g) => ({
5950
- // The lockup above already says orangecheck.
5951
- heading: g.id === "orangecheck" ? "Start here" : g.label,
5952
- links: g.sites.map((s) => ({ href: s.href, label: s.label, external: true }))
5953
- })) : []
5954
- ];
5955
- const n = cols.length;
5956
- const inline = n <= 5;
5957
- const grid = {
5958
- "--oca-footer-md": `repeat(${Math.max(1, Math.min(n, 4))}, minmax(0, 1fr))`,
5959
- "--oca-footer-lg": inline ? `minmax(0, 1.3fr) repeat(${Math.max(1, n)}, minmax(0, 1fr))` : `repeat(${Math.min(n, 6)}, minmax(0, 1fr))`
5960
- };
5961
- return /* @__PURE__ */ jsxs("footer", { className: cn("border-t border-border bg-background", className), children: [
5962
- /* @__PURE__ */ jsxs(
5963
- "div",
5964
- {
5965
- style: grid,
5966
- className: "oca-container grid grid-cols-2 gap-x-6 gap-y-10 py-14 md:grid-cols-[var(--oca-footer-md)] md:py-16 lg:grid-cols-[var(--oca-footer-lg)]",
5967
- children: [
5968
- /* @__PURE__ */ jsxs("div", { className: cn("col-span-full flex flex-col gap-4", inline && "lg:col-span-1"), children: [
5969
- /* @__PURE__ */ jsx(Lockup, { size: 26 }),
5970
- fineprint ? /* @__PURE__ */ jsx("p", { className: "max-w-xs text-[0.9375rem] leading-relaxed text-muted-foreground", children: fineprint }) : null
5971
- ] }),
5972
- cols.map((col, i) => {
5973
- const spans = n % 2 === 1 && i === n - 1;
5974
- return /* @__PURE__ */ jsxs(
5975
- "div",
5976
- {
5977
- className: cn("flex min-w-0 flex-col gap-1", spans && "col-span-2 md:col-span-1"),
5978
- children: [
5979
- /* @__PURE__ */ jsx("p", { className: "mb-2 text-[0.875rem] font-medium", children: col.heading }),
5980
- /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-1", spans && "grid grid-cols-2 gap-x-6 md:flex md:flex-col"), children: col.links.map((l) => /* @__PURE__ */ jsx(
5981
- NavLink,
5982
- {
5983
- item: l,
5984
- className: "-mx-3 py-2.5 text-[0.9375rem] md:py-1.5"
5985
- },
5986
- l.href
5987
- )) })
5988
- ]
5989
- },
5990
- col.heading
5991
- );
5992
- })
5993
- ]
5994
- }
5995
- ),
5996
- signature ? /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "oca-container select-none overflow-hidden pb-8 md:pb-12", children: /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-[0.18em] text-[clamp(3rem,11.5vw,10rem)] leading-[0.78] tracking-[-0.065em] [font-family:var(--oc-font-display)]", children: [
5997
- /* @__PURE__ */ jsx("span", { className: "mb-[0.06em] inline-block w-[1.1em] shrink-0", children: /* @__PURE__ */ jsx(Mark, { className: "block h-auto w-full" }) }),
5998
- /* @__PURE__ */ jsx("span", { children: "orangecheck" })
5999
- ] }) }) : null,
6000
- legalLinks || meta ? /* @__PURE__ */ jsx("div", { className: "oca-container", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 border-t border-border py-6 text-[0.875rem] text-muted-foreground", children: [
6001
- legalLinks ? /* @__PURE__ */ jsx(LegalRow, { links: legalLinks }) : null,
6002
- meta
6003
- ] }) }) : null
6004
- ] });
6005
- }
6006
- function SignInFrame({
6007
- title = "Sign in",
6008
- lead,
6009
- children,
6010
- error,
6011
- fineprint,
6012
- brand,
6013
- home = "/",
6014
- back,
6015
- art,
6016
- caption,
6017
- className
6018
- }) {
6019
- return /* @__PURE__ */ jsxs(
6020
- "main",
5899
+ const [open, setOpen] = useState(false);
5900
+ const current2 = sections && sections.length > 0 ? sections.find((sec) => sec.id === activeSection) ?? sections.find((sec) => activeItem(sec.groups)) ?? sections[0] : void 0;
5901
+ const groups = current2 ? [...current2.groups, ...persistent] : [...nav ?? [], ...persistent];
5902
+ warnDuplicateLabels(groups);
5903
+ const tabs = current2 ? null : tabsFor(groups);
5904
+ const page = activeItem(groups);
5905
+ const place = useMemo(
5906
+ () => ({
5907
+ section: current2 ? current2.title ?? current2.label : void 0,
5908
+ page: pageOverride ?? page?.label
5909
+ }),
5910
+ [current2, page?.label, pageOverride]
5911
+ );
5912
+ const familyMenu = family ? /* @__PURE__ */ jsx(FamilyMenu, { current: typeof family === "string" ? family : void 0 }) : null;
5913
+ const switcher = sections && current2 && sections.length > 1 ? /* @__PURE__ */ jsx(SectionSwitch, { sections, current: current2, onNavigate: () => setOpen(false) }) : null;
5914
+ return /* @__PURE__ */ jsx(ShellContext.Provider, { value: place, children: /* @__PURE__ */ jsxs(
5915
+ "div",
6021
5916
  {
6022
- id: "main-content",
6023
- className: cn("grid min-h-dvh grid-cols-1 bg-background text-foreground lg:grid-cols-2", className),
5917
+ className: cn(
5918
+ "min-h-dvh bg-background",
5919
+ tabs && "max-md:pb-[calc(3.5rem_+_env(safe-area-inset-bottom))]",
5920
+ className
5921
+ ),
6024
5922
  children: [
6025
- /* @__PURE__ */ jsxs("section", { className: "flex flex-col px-4 pb-8 pt-5 sm:px-8 lg:px-14 lg:pt-8", children: [
6026
- /* @__PURE__ */ jsxs("header", { className: "flex items-center justify-between gap-4", children: [
6027
- /* @__PURE__ */ jsxs(Link8, { href: home, className: "w-fit rounded-lg", children: [
6028
- brand ?? /* @__PURE__ */ jsx(Lockup, { size: 28 }),
6029
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: " home" })
5923
+ /* @__PURE__ */ jsxs("div", { className: "sticky top-0 z-40 border-b border-border bg-background/90 backdrop-blur-md lg:hidden", children: [
5924
+ /* @__PURE__ */ jsxs("div", { className: "flex h-14 items-center gap-2 px-3", children: [
5925
+ /* @__PURE__ */ jsxs(Sheet, { open, onOpenChange: setOpen, children: [
5926
+ /* @__PURE__ */ jsx(
5927
+ SheetTrigger,
5928
+ {
5929
+ className: cn(
5930
+ "inline-flex size-10 items-center justify-center rounded-full hover:bg-accent",
5931
+ // The tab bar holds every page; the sheet is left for a footer.
5932
+ tabs && !footer && "max-md:hidden"
5933
+ ),
5934
+ "aria-label": "Open navigation",
5935
+ children: /* @__PURE__ */ jsx(Menu, { className: "size-5" })
5936
+ }
5937
+ ),
5938
+ /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "flex flex-col gap-6 overflow-y-auto p-4 pt-16", children: [
5939
+ /* @__PURE__ */ jsx(SheetTitle, { className: "sr-only", children: "Navigation" }),
5940
+ switcher,
5941
+ /* @__PURE__ */ jsx("div", { className: tabs ? "max-md:hidden" : void 0, children: /* @__PURE__ */ jsx(SideNav, { groups, onNavigate: () => setOpen(false) }) }),
5942
+ footer ? /* @__PURE__ */ jsx("div", { className: "mt-auto flex flex-col gap-3", children: footer }) : null
5943
+ ] })
6030
5944
  ] }),
6031
- back === void 0 ? /* @__PURE__ */ jsx(
6032
- Link8,
6033
- {
6034
- href: home,
6035
- className: "text-[0.9375rem] text-muted-foreground underline-offset-4 hover:text-foreground hover:underline",
6036
- children: "Back to home"
6037
- }
6038
- ) : back
5945
+ /* @__PURE__ */ jsx(Link6, { href: home, "aria-label": "Home", className: "rounded-lg p-1", children: /* @__PURE__ */ jsx(Lockup, { size: 22 }) }),
5946
+ familyMenu,
5947
+ /* @__PURE__ */ jsx("div", { className: "ml-auto flex items-center", children: account })
6039
5948
  ] }),
6040
- /* @__PURE__ */ jsxs("div", { className: "mx-auto flex w-full max-w-[25rem] flex-1 flex-col justify-center gap-9 py-12", children: [
6041
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
6042
- /* @__PURE__ */ jsx("h1", { className: "oca-display-2", children: title }),
6043
- lead ? /* @__PURE__ */ jsx("p", { className: "oca-lead", children: lead }) : null
5949
+ place.page ? /* @__PURE__ */ jsxs(
5950
+ "div",
5951
+ {
5952
+ className: cn(
5953
+ "flex h-9 items-center gap-1.5 border-t border-border px-4 text-[0.875rem]",
5954
+ // The active tab already names the page.
5955
+ tabs && !pageOverride && "max-md:hidden"
5956
+ ),
5957
+ children: [
5958
+ place.section ? /* @__PURE__ */ jsxs(Fragment, { children: [
5959
+ /* @__PURE__ */ jsx("span", { className: "shrink-0 text-muted-foreground", children: place.section }),
5960
+ /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": true, className: "size-3.5 shrink-0 text-muted-foreground" })
5961
+ ] }) : null,
5962
+ /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: place.page })
5963
+ ]
5964
+ }
5965
+ ) : null
5966
+ ] }),
5967
+ /* @__PURE__ */ jsxs("div", { className: "mx-auto flex w-full max-w-[90rem]", children: [
5968
+ /* @__PURE__ */ jsxs("aside", { className: "sticky top-0 hidden h-dvh w-[17rem] shrink-0 flex-col gap-6 overflow-y-auto px-4 py-6 lg:flex", children: [
5969
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
5970
+ /* @__PURE__ */ jsx(Link6, { href: home, className: "px-2", "aria-label": "Home", children: /* @__PURE__ */ jsx(Lockup, { size: 26 }) }),
5971
+ familyMenu
6044
5972
  ] }),
6045
- /* @__PURE__ */ jsx("div", { children }),
6046
- error ? /* @__PURE__ */ jsx("p", { role: "alert", className: "text-[0.9375rem] text-destructive", children: error }) : null,
6047
- fineprint ? /* @__PURE__ */ jsx("p", { className: "text-[0.8125rem] leading-relaxed text-muted-foreground", children: fineprint }) : null
5973
+ switcher,
5974
+ /* @__PURE__ */ jsx(SideNav, { groups }),
5975
+ /* @__PURE__ */ jsx("div", { className: "mt-auto flex flex-col gap-3", children: footer })
5976
+ ] }),
5977
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
5978
+ /* @__PURE__ */ jsx("div", { className: "hidden h-[4.5rem] items-center justify-end gap-3 px-8 lg:flex", children: account }),
5979
+ banner ? /* @__PURE__ */ jsx("div", { className: "px-4 pb-2 pt-4 md:px-8 lg:pt-0", children: banner }) : null,
5980
+ /* @__PURE__ */ jsx("main", { id: "main-content", className: "flex-1 px-4 pb-16 pt-6 md:px-8 lg:pt-2", children: /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-[72rem]", children }) })
6048
5981
  ] })
6049
5982
  ] }),
6050
- /* @__PURE__ */ jsxs(
6051
- "aside",
6052
- {
6053
- "aria-hidden": true,
6054
- className: "relative hidden flex-col justify-between gap-10 overflow-hidden border-l border-[var(--oca-band-line)] bg-oca-ink p-14 text-oca-ink-foreground lg:flex",
6055
- children: [
6056
- /* @__PURE__ */ jsx("div", { className: "flex flex-1 items-center justify-center", children: art ?? /* @__PURE__ */ jsx(IsoCheck, { size: 340, settle: true, tilt: true, className: "max-w-full" }) }),
6057
- caption ? /* @__PURE__ */ jsx("div", { className: "flex max-w-[24rem] flex-col gap-3", children: caption }) : null
6058
- ]
6059
- }
6060
- )
5983
+ tabs ? /* @__PURE__ */ jsx(TabBar, { items: tabs }) : null
6061
5984
  ]
6062
5985
  }
6063
- );
5986
+ ) });
6064
5987
  }
6065
- var STATUS_WORDS = /* @__PURE__ */ new Set(["live", "testing", "not-yet", "paused", "good", "caution", "refused"]);
6066
- var pathOf = (href) => href.split(/[?#]/)[0].replace(/(.)\/$/, "$1");
6067
- function DocsNav({
6068
- sections,
6069
- current: current2,
6070
- onNavigate,
6071
- className
5988
+ function AccountMenu({
5989
+ name,
5990
+ detail,
5991
+ items,
5992
+ nameFrom = "sm"
6072
5993
  }) {
6073
- const here = pathOf(current2);
6074
- const activeSection = useMemo(
6075
- () => sections.findIndex((s) => s.items.some((i) => pathOf(i.href) === here)),
6076
- [sections, here]
6077
- );
6078
- const [peeked, setPeeked] = useState(() => /* @__PURE__ */ new Set());
6079
- useEffect(() => setPeeked(/* @__PURE__ */ new Set()), [activeSection]);
6080
- const activeRef = useRef(null);
6081
- useEffect(() => {
6082
- const id = requestAnimationFrame(() => activeRef.current?.scrollIntoView({ block: "nearest" }));
6083
- return () => cancelAnimationFrame(id);
6084
- }, [here]);
6085
- const base = useId();
6086
- return /* @__PURE__ */ jsx("nav", { "aria-label": "Docs", className: cn("flex flex-col gap-0.5", className), children: sections.map((section, si) => {
6087
- const isActive = si === activeSection;
6088
- const open = isActive || peeked.has(si);
6089
- const panel = `${base}-s${si}`;
6090
- return /* @__PURE__ */ jsxs("div", { children: [
6091
- /* @__PURE__ */ jsxs(
6092
- "button",
6093
- {
6094
- type: "button",
6095
- "aria-expanded": open,
6096
- "aria-controls": panel,
6097
- onClick: () => {
6098
- if (isActive) return;
6099
- setPeeked((p) => {
6100
- const n = new Set(p);
6101
- if (n.has(si)) n.delete(si);
6102
- else n.add(si);
6103
- return n;
6104
- });
6105
- },
6106
- className: cn(
6107
- "flex min-h-9 w-full items-center justify-between gap-2 rounded-lg px-2.5 py-1.5 text-left text-[0.875rem] transition-colors",
6108
- isActive ? "font-medium text-foreground" : "text-muted-foreground hover:bg-accent hover:text-foreground",
6109
- isActive && "cursor-default"
5994
+ const initial = name.trim().charAt(0).toUpperCase() || "\xB7";
5995
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
5996
+ /* @__PURE__ */ jsxs(
5997
+ DropdownMenuTrigger,
5998
+ {
5999
+ className: cn(
6000
+ "inline-flex h-10 items-center gap-2.5 rounded-full border border-border bg-card pl-1 pr-1 text-[0.9375rem] outline-none transition-colors hover:border-oca-hairline-strong focus-visible:ring-2 focus-visible:ring-ring",
6001
+ nameFrom === "lg" ? "lg:pr-3.5" : "sm:pr-3.5"
6002
+ ),
6003
+ "aria-label": `${name}, account menu`,
6004
+ children: [
6005
+ /* @__PURE__ */ jsx(
6006
+ "span",
6007
+ {
6008
+ "aria-hidden": true,
6009
+ "data-initial": initial,
6010
+ className: "flex size-8 items-center justify-center rounded-full bg-foreground text-[0.8125rem] font-medium text-background before:content-[attr(data-initial)]"
6011
+ }
6110
6012
  ),
6111
- children: [
6112
- section.label,
6113
- /* @__PURE__ */ jsx(
6114
- ChevronRight,
6115
- {
6116
- "aria-hidden": true,
6117
- className: cn("size-3.5 shrink-0 text-oca-subtle transition-transform duration-200", open && "rotate-90")
6118
- }
6119
- )
6120
- ]
6121
- }
6122
- ),
6123
- /* @__PURE__ */ jsx("ul", { id: panel, hidden: !open, className: "mb-2 ml-2.5 mt-0.5 border-l border-border", children: section.items.map((item) => {
6124
- const on = pathOf(item.href) === here;
6125
- const badge = typeof item.badge === "string" && STATUS_WORDS.has(item.badge) ? /* @__PURE__ */ jsx(StatusBadge, { status: item.badge }) : item.badge ? /* @__PURE__ */ jsx(Badge, { tone: "muted", children: item.badge }) : null;
6126
- return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
6127
- Link8,
6128
- {
6129
- href: item.href,
6130
- ref: on ? activeRef : void 0,
6131
- onClick: onNavigate,
6132
- "aria-current": on ? "page" : void 0,
6133
- className: cn(
6134
- "-ml-px flex min-h-9 items-center gap-2 border-l-2 py-1.5 pl-3.5 pr-2 text-[0.875rem] leading-snug transition-colors",
6135
- on ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:border-oca-hairline-strong hover:text-foreground"
6136
- ),
6137
- children: [
6138
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1", children: item.label }),
6139
- badge
6140
- ]
6141
- }
6142
- ) }, item.href);
6143
- }) })
6144
- ] }, section.label);
6145
- }) });
6146
- }
6147
- var DOCS_HEADER_NAV = OCHK_IO_NAV.map((n) => n.href === DOCS_HREF ? { ...n, active: true } : n);
6148
- function DocsShell({
6149
- nav,
6150
- current: current2,
6151
- header,
6152
- search,
6153
- actions,
6154
- breadcrumbs,
6155
- toc,
6156
- pager,
6157
- footer,
6158
- children
6159
- }) {
6160
- const [menu, setMenu] = useState(false);
6161
- useEffect(() => setMenu(false), [current2]);
6162
- const read = useHeadings("#docs-content", current2);
6163
- const items = toc ?? read.items;
6164
- const activeId = toc ? void 0 : read.activeId;
6165
- const here = pathOf(current2);
6166
- const place = useMemo(() => {
6167
- for (const s of nav) {
6168
- const it = s.items.find((i) => pathOf(i.href) === here);
6169
- if (it) return { section: s.label, page: it.label };
6170
- }
6171
- return null;
6172
- }, [nav, here]);
6173
- return /* @__PURE__ */ jsxs("div", { className: "flex min-h-dvh flex-col bg-background", children: [
6174
- /* @__PURE__ */ jsx(SkipLink, {}),
6175
- header ?? /* @__PURE__ */ jsx(SiteHeader, { home: OCHK_IO, family: "docs", nav: DOCS_HEADER_NAV, search, actions }),
6176
- /* @__PURE__ */ jsx("div", { className: "sticky top-16 z-30 border-b border-border bg-background/95 backdrop-blur-md supports-[backdrop-filter]:bg-background/90 md:top-[4.5rem] lg:hidden", children: /* @__PURE__ */ jsx("div", { className: "oca-container flex h-12 items-center gap-2", children: /* @__PURE__ */ jsxs(Sheet, { open: menu, onOpenChange: setMenu, children: [
6177
- /* @__PURE__ */ jsxs(SheetTrigger, { className: "-ml-2 inline-flex h-10 min-w-0 items-center gap-2 rounded-full px-2.5 text-[0.875rem] hover:bg-accent", children: [
6178
- /* @__PURE__ */ jsx(PanelLeft, { "aria-hidden": true, className: "size-[1.125rem] shrink-0" }),
6179
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Docs menu. " }),
6180
- place ? /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [
6181
- /* @__PURE__ */ jsx("span", { className: "shrink-0 text-muted-foreground", children: place.section }),
6182
- /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": true, className: "size-3.5 shrink-0 text-oca-subtle" }),
6183
- /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: place.page })
6184
- ] }) : /* @__PURE__ */ jsx("span", { className: "font-medium", children: "Docs" })
6185
- ] }),
6186
- /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "w-[min(88vw,22rem)] gap-0 p-0", children: [
6187
- /* @__PURE__ */ jsx("div", { className: "border-b border-border px-5 py-4 pr-14", children: /* @__PURE__ */ jsx(SheetTitle, { className: "text-[1.0625rem] font-medium", children: "Docs" }) }),
6188
- /* @__PURE__ */ jsx("div", { className: "overflow-y-auto p-3", children: /* @__PURE__ */ jsx(DocsNav, { sections: nav, current: current2, onNavigate: () => setMenu(false) }) })
6189
- ] })
6190
- ] }) }) }),
6191
- /* @__PURE__ */ jsx("div", { className: "oca-container flex-1", children: /* @__PURE__ */ jsxs("div", { className: "lg:grid lg:grid-cols-[13.5rem_minmax(0,1fr)] lg:gap-x-10 xl:grid-cols-[13.5rem_minmax(0,1fr)_11rem]", children: [
6192
- /* @__PURE__ */ jsx("div", { className: "sticky top-[4.5rem] hidden max-h-[calc(100dvh-4.5rem)] self-start overflow-y-auto overscroll-contain py-8 pr-1 lg:block", children: /* @__PURE__ */ jsx(DocsNav, { sections: nav, current: current2 }) }),
6193
- /* @__PURE__ */ jsxs("main", { id: "main-content", className: "min-w-0 pb-16 pt-6 md:pt-8", children: [
6194
- breadcrumbs ? /* @__PURE__ */ jsx("div", { className: "mb-6 max-lg:hidden", children: breadcrumbs }) : null,
6195
- items.length > 1 ? /* @__PURE__ */ jsxs("details", { className: "group mb-8 rounded-2xl border border-border bg-card xl:hidden", children: [
6196
- /* @__PURE__ */ jsxs("summary", { className: "flex min-h-12 cursor-pointer list-none items-center justify-between px-4 text-[0.9375rem] font-medium [&::-webkit-details-marker]:hidden", children: [
6197
- "On this page",
6198
- /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": true, className: "size-4 text-muted-foreground transition-transform group-open:rotate-180" })
6199
- ] }),
6200
- /* @__PURE__ */ jsx(OnThisPage, { items, activeId, title: null, className: "px-4 pb-4" })
6201
- ] }) : null,
6202
- /* @__PURE__ */ jsx("article", { id: "docs-content", className: "max-w-[46rem]", children }),
6203
- pager ? /* @__PURE__ */ jsx("div", { className: "mt-16 max-w-[46rem]", children: pager }) : null
6013
+ /* @__PURE__ */ jsx("span", { className: cn("max-w-[10rem] truncate", nameFrom === "lg" ? "max-lg:hidden" : "max-sm:hidden"), children: name })
6014
+ ]
6015
+ }
6016
+ ),
6017
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-64", children: [
6018
+ /* @__PURE__ */ jsxs(DropdownMenuLabel, { className: "flex flex-col gap-0.5", children: [
6019
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[0.9375rem] font-medium text-foreground", children: name }),
6020
+ detail ? /* @__PURE__ */ jsx("span", { className: "truncate font-mono text-[0.75rem]", children: detail }) : null
6204
6021
  ] }),
6205
- /* @__PURE__ */ jsx("div", { className: "sticky top-[4.5rem] hidden max-h-[calc(100dvh-4.5rem)] self-start overflow-y-auto py-10 xl:block", children: items.length > 1 ? /* @__PURE__ */ jsx(OnThisPage, { items, activeId }) : null })
6206
- ] }) }),
6207
- footer ?? /* @__PURE__ */ jsx(SiteFooter, { columns: OCHK_IO_FOOTER, family: true, legal: true, signature: false })
6022
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
6023
+ items.map(
6024
+ (it, i) => it === "separator" ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}, `sep-${i}`) : it.href ? /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: true, destructive: it.destructive, children: /* @__PURE__ */ jsxs(Link6, { href: it.href, children: [
6025
+ it.icon,
6026
+ it.label
6027
+ ] }) }, it.label) : /* @__PURE__ */ jsxs(DropdownMenuItem, { onSelect: it.onSelect, destructive: it.destructive, children: [
6028
+ it.icon,
6029
+ it.label
6030
+ ] }, it.label)
6031
+ )
6032
+ ] })
6208
6033
  ] });
6209
6034
  }
6210
- function SideNav({ groups, onNavigate }) {
6211
- return /* @__PURE__ */ jsx("nav", { "aria-label": "Pages", className: "flex flex-col gap-5", children: groups.map((g, gi) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
6212
- g.label ? /* @__PURE__ */ jsx("p", { className: "px-3 pb-1 text-[0.8125rem] text-muted-foreground", children: g.label }) : null,
6213
- g.items.map((it) => /* @__PURE__ */ jsxs(
6214
- Link8,
6035
+ function ThemeToggle({ className }) {
6036
+ const { theme, setTheme } = useTheme();
6037
+ const [mounted, setMounted] = useState(false);
6038
+ useEffect(() => setMounted(true), []);
6039
+ const current2 = mounted ? theme ?? "system" : "system";
6040
+ const next = current2 === "light" ? "dark" : current2 === "dark" ? "system" : "light";
6041
+ const Icon2 = current2 === "light" ? Sun : current2 === "dark" ? Moon : SunMoon;
6042
+ return /* @__PURE__ */ jsx(
6043
+ "button",
6044
+ {
6045
+ type: "button",
6046
+ onClick: () => setTheme(next),
6047
+ "aria-label": `Theme: ${current2}. Switch to ${next}`,
6048
+ title: `Theme: ${current2}`,
6049
+ className: cn(
6050
+ "inline-flex size-10 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
6051
+ className
6052
+ ),
6053
+ children: /* @__PURE__ */ jsx(Icon2, { className: "size-[1.125rem]" })
6054
+ }
6055
+ );
6056
+ }
6057
+ function NavLink({
6058
+ item,
6059
+ className,
6060
+ onNavigate,
6061
+ line = false
6062
+ }) {
6063
+ const cls = cn(
6064
+ "rounded-full px-3 py-2 text-[0.9375rem] transition-colors",
6065
+ item.active ? "text-foreground" : "text-muted-foreground hover:text-foreground",
6066
+ line && "relative after:absolute after:inset-x-3 after:-bottom-[0.625rem] after:h-0.5 after:rounded-full",
6067
+ line && item.active && "after:bg-foreground",
6068
+ className
6069
+ );
6070
+ if (item.external) {
6071
+ return /* @__PURE__ */ jsx("a", { href: item.href, className: cls, rel: "noreferrer", onClick: onNavigate, children: item.label });
6072
+ }
6073
+ return /* @__PURE__ */ jsx(Link6, { href: item.href, className: cls, "aria-current": item.active ? "page" : void 0, onClick: onNavigate, children: item.label });
6074
+ }
6075
+ function NavRow({ item, onNavigate }) {
6076
+ const body = /* @__PURE__ */ jsxs(Fragment, { children: [
6077
+ /* @__PURE__ */ jsx("span", { className: "text-[0.9375rem] font-medium leading-6 text-foreground", children: item.label }),
6078
+ item.description ? /* @__PURE__ */ jsx("span", { className: "text-[0.8125rem] leading-snug text-muted-foreground", children: item.description }) : null
6079
+ ] });
6080
+ const cls = cn(
6081
+ "flex flex-col gap-0.5 rounded-xl px-3 py-2 transition-colors hover:bg-accent",
6082
+ item.active && "bg-muted hover:bg-muted dark:bg-white/[0.06]"
6083
+ );
6084
+ return item.external ? /* @__PURE__ */ jsx("a", { href: item.href, className: cls, rel: "noreferrer", onClick: onNavigate, children: body }) : /* @__PURE__ */ jsx(Link6, { href: item.href, className: cls, "aria-current": item.active ? "page" : void 0, onClick: onNavigate, children: body });
6085
+ }
6086
+ var seeAll = (item) => typeof item.label === "string" ? `All ${item.label.toLowerCase()}` : "See all";
6087
+ function NavDropdown({ item }) {
6088
+ const [open, setOpen] = useState(false);
6089
+ const active = item.active || item.children?.some((c) => c.active);
6090
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
6091
+ /* @__PURE__ */ jsxs(
6092
+ PopoverTrigger,
6215
6093
  {
6216
- href: it.href,
6217
- onClick: onNavigate,
6218
- "aria-current": it.active ? "page" : void 0,
6219
6094
  className: cn(
6220
- "flex h-9 items-center gap-3 rounded-xl px-3 text-[0.9375rem] transition-colors",
6221
- "[&_svg]:size-[1.0625rem] [&_svg]:shrink-0",
6222
- it.active ? "bg-card text-foreground shadow-sm ring-1 ring-border [&_svg]:text-foreground" : "text-muted-foreground hover:bg-accent hover:text-foreground"
6095
+ "group inline-flex items-center gap-1 rounded-full py-2 pl-3 pr-2.5 text-[0.9375rem] transition-colors md:max-lg:pl-2.5 md:max-lg:pr-2",
6096
+ active ? "text-foreground" : "text-muted-foreground hover:text-foreground data-[state=open]:text-foreground"
6223
6097
  ),
6224
6098
  children: [
6225
- it.icon,
6226
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: it.label }),
6227
- it.badge ? /* @__PURE__ */ jsx("span", { className: "shrink-0", children: it.badge }) : null
6099
+ item.label,
6100
+ /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": true, className: "size-3.5 transition-transform duration-200 group-data-[state=open]:rotate-180" })
6228
6101
  ]
6229
- },
6230
- it.href
6231
- ))
6232
- ] }, g.label ?? gi)) });
6102
+ }
6103
+ ),
6104
+ /* @__PURE__ */ jsxs(PopoverContent, { align: "center", sideOffset: 10, className: "w-[min(calc(100vw-2rem),26rem)] p-2", children: [
6105
+ /* @__PURE__ */ jsx("ul", { className: "flex flex-col", children: item.children?.map((c) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(NavRow, { item: c, onNavigate: () => setOpen(false) }) }, c.href)) }),
6106
+ /* @__PURE__ */ jsx("div", { className: "mt-1.5 border-t border-border px-1 pt-1.5", children: /* @__PURE__ */ jsx(
6107
+ NavLink,
6108
+ {
6109
+ item: { ...item, label: seeAll(item), children: void 0 },
6110
+ className: "block rounded-xl px-2 py-2 text-[0.875rem]",
6111
+ onNavigate: () => setOpen(false)
6112
+ }
6113
+ ) })
6114
+ ] })
6115
+ ] });
6233
6116
  }
6234
- function SectionSwitch({
6235
- sections,
6236
- current: current2,
6237
- onNavigate
6117
+ function SiteHeader({
6118
+ home = "/",
6119
+ brand,
6120
+ product,
6121
+ family,
6122
+ nav = [],
6123
+ search,
6124
+ actions,
6125
+ variant = "site",
6126
+ navOnPhone = true,
6127
+ menu: menuExtra,
6128
+ className
6238
6129
  }) {
6239
- const cols = sections.length <= 3 ? sections.length : 2;
6240
- return /* @__PURE__ */ jsx(
6241
- "nav",
6242
- {
6243
- "aria-label": "Sections",
6244
- className: cn("grid gap-1 bg-muted p-1", cols === sections.length ? "rounded-full" : "rounded-[1.25rem]"),
6245
- style: { gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))` },
6246
- children: sections.map((sec) => {
6247
- const on = sec.id === current2.id;
6248
- return /* @__PURE__ */ jsx(
6249
- Link8,
6250
- {
6251
- href: sec.href,
6252
- onClick: onNavigate,
6253
- "aria-current": on ? "true" : void 0,
6254
- className: cn(
6255
- "flex h-8 min-w-0 items-center justify-center rounded-full px-1.5 text-[0.8125rem] font-medium transition-colors",
6256
- on ? "bg-card text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
6257
- ),
6258
- children: /* @__PURE__ */ jsx("span", { className: "truncate", children: sec.label })
6259
- },
6260
- sec.id
6261
- );
6262
- })
6263
- }
6264
- );
6265
- }
6266
- function TabBar({ items }) {
6130
+ const [open, setOpen] = useState(false);
6131
+ const tool = variant === "tool";
6132
+ const size = tool ? 24 : 28;
6133
+ const current2 = typeof family === "string" ? family : void 0;
6134
+ const phoneNav = navOnPhone ? nav : [];
6135
+ const menu = phoneNav.length > 0 || Boolean(family) || Boolean(menuExtra);
6136
+ const brandNode = brand ?? /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center", children: [
6137
+ /* @__PURE__ */ jsx(Lockup, { size }),
6138
+ product ? /* @__PURE__ */ jsxs(Fragment, { children: [
6139
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "mx-3 h-5 w-px bg-oca-hairline-strong" }),
6140
+ /* @__PURE__ */ jsx("span", { className: "font-medium tracking-[-0.01em]", style: { fontSize: size * 0.56 }, children: product })
6141
+ ] }) : null
6142
+ ] });
6143
+ const navigation = nav.length > 0 ? /* @__PURE__ */ jsx("nav", { "aria-label": "Main", className: "hidden items-center gap-1 md:flex", children: nav.map(
6144
+ (n) => n.children?.length ? /* @__PURE__ */ jsx(NavDropdown, { item: n }, n.href) : (
6145
+ // Between md and lg the family menu and the actions share the row: tighter.
6146
+ /* @__PURE__ */ jsx(NavLink, { item: n, line: tool, className: tool ? void 0 : "md:max-lg:px-2.5" }, n.href)
6147
+ )
6148
+ ) }) : null;
6267
6149
  return /* @__PURE__ */ jsx(
6268
- "nav",
6150
+ "header",
6269
6151
  {
6270
- "aria-label": "Pages",
6271
- "data-oca-tabbar": "",
6272
- className: "fixed inset-x-0 bottom-0 z-40 border-t border-border bg-background/90 pb-[env(safe-area-inset-bottom)] backdrop-blur-md md:hidden",
6273
- children: /* @__PURE__ */ jsx(
6152
+ className: cn(
6153
+ "sticky top-0 z-40 w-full border-b bg-background/95 backdrop-blur-md supports-[backdrop-filter]:bg-background/90",
6154
+ tool ? "border-border" : "border-transparent",
6155
+ className
6156
+ ),
6157
+ children: /* @__PURE__ */ jsxs(
6274
6158
  "div",
6275
6159
  {
6276
- className: "mx-auto grid h-14 max-w-[32rem] px-1.5",
6277
- style: { gridTemplateColumns: `repeat(${items.length}, minmax(0, 1fr))` },
6278
- children: items.map((it) => /* @__PURE__ */ jsxs(
6279
- Link8,
6280
- {
6281
- href: it.href,
6282
- "aria-current": it.active ? "page" : void 0,
6283
- className: cn(
6284
- "flex min-w-0 flex-col items-center justify-center gap-1 rounded-2xl text-[0.6875rem] leading-none outline-none transition-colors [-webkit-tap-highlight-color:transparent] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
6285
- it.active ? "text-foreground" : "text-muted-foreground hover:text-foreground"
6286
- ),
6287
- children: [
6288
- /* @__PURE__ */ jsxs(
6289
- "span",
6160
+ className: cn(
6161
+ "flex items-center justify-between gap-4",
6162
+ tool ? "h-14 px-4 md:px-6" : "oca-container h-16 md:h-[4.5rem] md:max-lg:gap-2",
6163
+ // Three columns, the outer two each at least their content: the
6164
+ // navigation stays centred whatever the actions hold, so it does
6165
+ // not shift when they change (signed out to signed in).
6166
+ !tool && nav.length > 0 && "md:grid md:grid-cols-[minmax(max-content,1fr)_auto_minmax(max-content,1fr)]"
6167
+ ),
6168
+ children: [
6169
+ /* @__PURE__ */ jsxs("div", { className: cn("flex min-w-0 items-center gap-1", tool ? "md:gap-1" : "justify-self-start"), children: [
6170
+ /* @__PURE__ */ jsxs(Link6, { href: home, className: "-ml-1 min-w-0 rounded-lg p-1", children: [
6171
+ brandNode,
6172
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: " home" })
6173
+ ] }),
6174
+ family ? /* @__PURE__ */ jsx(FamilyMenu, { current: current2, className: "max-md:hidden" }) : null,
6175
+ tool && navigation ? /* @__PURE__ */ jsx("div", { className: "ml-5", children: navigation }) : null
6176
+ ] }),
6177
+ !tool ? navigation : null,
6178
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 justify-self-end", children: [
6179
+ search,
6180
+ actions,
6181
+ menu ? /* @__PURE__ */ jsxs(Sheet, { open, onOpenChange: setOpen, children: [
6182
+ /* @__PURE__ */ jsx(
6183
+ SheetTrigger,
6290
6184
  {
6291
- className: cn(
6292
- "relative flex h-7 w-12 items-center justify-center rounded-full transition-[background-color,box-shadow] duration-200",
6293
- "[&_svg]:size-[1.125rem] [&_svg]:shrink-0",
6294
- it.active ? "bg-card shadow-sm ring-1 ring-border [&_svg]:stroke-2" : "[&_svg]:stroke-[1.75]"
6295
- ),
6296
- children: [
6297
- it.icon,
6298
- it.badge ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute right-2.5 top-0.5 size-2 rounded-full bg-oca-orange ring-2 ring-background" }) : null
6299
- ]
6185
+ className: "inline-flex size-10 items-center justify-center rounded-full text-foreground hover:bg-accent md:hidden",
6186
+ "aria-label": "Open menu",
6187
+ children: /* @__PURE__ */ jsx(Menu, { className: "size-5" })
6300
6188
  }
6301
6189
  ),
6302
- /* @__PURE__ */ jsx("span", { className: "max-w-full truncate px-0.5", children: it.label }),
6303
- it.badge ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: it.badge }) : null
6304
- ]
6305
- },
6306
- it.href
6307
- ))
6190
+ /* @__PURE__ */ jsxs(SheetContent, { side: "right", className: "pt-16", children: [
6191
+ /* @__PURE__ */ jsx(SheetTitle, { className: "sr-only", children: "Menu" }),
6192
+ menuExtra ? /* @__PURE__ */ jsx("div", { className: cn("flex flex-col", (phoneNav.length > 0 || family) && "border-b border-border pb-3"), children: menuExtra }) : null,
6193
+ phoneNav.length > 0 ? /* @__PURE__ */ jsx("nav", { "aria-label": "Main", className: "flex flex-col", children: phoneNav.map(
6194
+ (n) => n.children?.length ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col py-2", children: [
6195
+ /* @__PURE__ */ jsx("p", { className: "px-3 pb-1 text-[0.8125rem] text-muted-foreground", children: n.label }),
6196
+ n.children.map((c) => /* @__PURE__ */ jsx(
6197
+ NavLink,
6198
+ {
6199
+ item: c,
6200
+ className: "rounded-xl px-3 py-2.5 text-[1.0625rem]",
6201
+ onNavigate: () => setOpen(false)
6202
+ },
6203
+ c.href
6204
+ ))
6205
+ ] }, n.href) : /* @__PURE__ */ jsx(
6206
+ NavLink,
6207
+ {
6208
+ item: n,
6209
+ className: "rounded-xl px-3 py-3 text-[1.0625rem]",
6210
+ onNavigate: () => setOpen(false)
6211
+ },
6212
+ n.href
6213
+ )
6214
+ ) }) : null,
6215
+ family ? /* @__PURE__ */ jsxs("details", { className: cn("group", phoneNav.length > 0 && "mt-2 border-t border-border pt-4"), children: [
6216
+ /* @__PURE__ */ jsxs("summary", { className: "flex cursor-pointer list-none items-center justify-between rounded-xl px-3 py-2.5 text-[1.0625rem] [&::-webkit-details-marker]:hidden", children: [
6217
+ "All orangecheck sites",
6218
+ /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": true, className: "size-4 text-muted-foreground transition-transform group-open:rotate-180" })
6219
+ ] }),
6220
+ /* @__PURE__ */ jsx(FamilyList, { current: current2, onNavigate: () => setOpen(false), stack: true, className: "mt-2" })
6221
+ ] }) : null
6222
+ ] })
6223
+ ] }) : null
6224
+ ] })
6225
+ ]
6308
6226
  }
6309
6227
  )
6310
6228
  }
6311
6229
  );
6312
6230
  }
6313
- function tabsFor(groups) {
6314
- const items = groups.flatMap((g) => g.items);
6315
- return items.length >= 2 && items.length <= 5 && items.every((it) => it.icon) ? items : null;
6316
- }
6317
- var activeItem = (groups) => groups.flatMap((g) => g.items).find((it) => it.active);
6318
- var warned = /* @__PURE__ */ new Set();
6319
- function warnDuplicateLabels(groups) {
6320
- if (typeof process === "undefined" || process.env.NODE_ENV === "production") return;
6321
- const seen = /* @__PURE__ */ new Set();
6322
- for (const it of groups.flatMap((g) => g.items)) {
6323
- if (seen.has(it.label) && !warned.has(it.label)) {
6324
- warned.add(it.label);
6325
- console.warn(`AppShell: two pages are labelled "${it.label}"; give each its own name.`);
6231
+ function SkipLink({ href = "#main-content", children = "Skip to content" }) {
6232
+ return /* @__PURE__ */ jsx(
6233
+ "a",
6234
+ {
6235
+ href,
6236
+ className: "sr-only focus:not-sr-only focus:fixed focus:left-4 focus:top-3 focus:z-50 focus:rounded-full focus:border focus:border-border focus:bg-card focus:px-4 focus:py-2 focus:text-[0.9375rem] focus:font-medium focus:text-foreground focus:shadow-md",
6237
+ children
6326
6238
  }
6327
- seen.add(it.label);
6328
- }
6239
+ );
6329
6240
  }
6330
- function AppShell({
6331
- nav,
6332
- sections,
6333
- activeSection,
6334
- page: pageOverride,
6335
- persistent = [],
6336
- home = "/",
6337
- account,
6338
- banner,
6339
- footer,
6241
+ var BANNER_TONE = {
6242
+ neutral: "border-border bg-muted",
6243
+ brand: "border-[color-mix(in_oklab,var(--oca-orange)_30%,var(--border))] bg-[color-mix(in_oklab,var(--oca-orange)_9%,var(--background))]",
6244
+ danger: "border-[color-mix(in_oklab,var(--destructive)_35%,var(--border))] bg-[color-mix(in_oklab,var(--destructive)_8%,var(--background))]"
6245
+ };
6246
+ function SiteBanner({
6247
+ tone = "neutral",
6340
6248
  children,
6249
+ action,
6341
6250
  className
6342
6251
  }) {
6343
- const [open, setOpen] = useState(false);
6344
- const current2 = sections && sections.length > 0 ? sections.find((sec) => sec.id === activeSection) ?? sections.find((sec) => activeItem(sec.groups)) ?? sections[0] : void 0;
6345
- const groups = current2 ? [...current2.groups, ...persistent] : [...nav ?? [], ...persistent];
6346
- warnDuplicateLabels(groups);
6347
- const tabs = current2 ? null : tabsFor(groups);
6348
- const page = activeItem(groups);
6349
- const place = useMemo(
6350
- () => ({
6351
- section: current2 ? current2.title ?? current2.label : void 0,
6352
- page: pageOverride ?? page?.label
6353
- }),
6354
- [current2, page?.label, pageOverride]
6355
- );
6356
- const switcher = sections && current2 && sections.length > 1 ? /* @__PURE__ */ jsx(SectionSwitch, { sections, current: current2, onNavigate: () => setOpen(false) }) : null;
6357
- return /* @__PURE__ */ jsx(ShellContext.Provider, { value: place, children: /* @__PURE__ */ jsxs(
6358
- "div",
6359
- {
6360
- className: cn(
6361
- "min-h-dvh bg-background",
6362
- tabs && "max-md:pb-[calc(3.5rem_+_env(safe-area-inset-bottom))]",
6363
- className
6364
- ),
6365
- children: [
6366
- /* @__PURE__ */ jsxs("div", { className: "sticky top-0 z-40 border-b border-border bg-background/90 backdrop-blur-md lg:hidden", children: [
6367
- /* @__PURE__ */ jsxs("div", { className: "flex h-14 items-center gap-2 px-3", children: [
6368
- /* @__PURE__ */ jsxs(Sheet, { open, onOpenChange: setOpen, children: [
6369
- /* @__PURE__ */ jsx(
6370
- SheetTrigger,
6371
- {
6372
- className: cn(
6373
- "inline-flex size-10 items-center justify-center rounded-full hover:bg-accent",
6374
- // The tab bar holds every page; the sheet is left for a footer.
6375
- tabs && !footer && "max-md:hidden"
6376
- ),
6377
- "aria-label": "Open navigation",
6378
- children: /* @__PURE__ */ jsx(Menu, { className: "size-5" })
6379
- }
6380
- ),
6381
- /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "flex flex-col gap-6 overflow-y-auto p-4 pt-16", children: [
6382
- /* @__PURE__ */ jsx(SheetTitle, { className: "sr-only", children: "Navigation" }),
6383
- switcher,
6384
- /* @__PURE__ */ jsx("div", { className: tabs ? "max-md:hidden" : void 0, children: /* @__PURE__ */ jsx(SideNav, { groups, onNavigate: () => setOpen(false) }) }),
6385
- footer ? /* @__PURE__ */ jsx("div", { className: "mt-auto flex flex-col gap-3", children: footer }) : null
6386
- ] })
6387
- ] }),
6388
- /* @__PURE__ */ jsx(Link8, { href: home, "aria-label": "Home", className: "rounded-lg p-1", children: /* @__PURE__ */ jsx(Lockup, { size: 22 }) }),
6389
- /* @__PURE__ */ jsx("div", { className: "ml-auto flex items-center", children: account })
6252
+ return /* @__PURE__ */ jsx("div", { role: "status", "aria-live": "polite", "data-tone": tone, className: cn("border-b text-[0.875rem]", BANNER_TONE[tone], className), children: /* @__PURE__ */ jsxs("div", { className: "oca-container flex flex-wrap items-center justify-between gap-x-4 gap-y-1 py-2.5", children: [
6253
+ /* @__PURE__ */ jsxs("p", { className: "flex min-w-0 items-baseline gap-2.5 leading-snug", children: [
6254
+ tone !== "neutral" ? /* @__PURE__ */ jsx(
6255
+ "span",
6256
+ {
6257
+ "aria-hidden": true,
6258
+ className: cn(
6259
+ "size-2 shrink-0 translate-y-[-0.05em] rounded-full",
6260
+ tone === "brand" ? "bg-oca-orange" : "bg-destructive"
6261
+ )
6262
+ }
6263
+ ) : null,
6264
+ /* @__PURE__ */ jsx("span", { children })
6265
+ ] }),
6266
+ action ? /* @__PURE__ */ jsx("div", { className: cn("shrink-0 font-medium", tone !== "neutral" && "max-sm:pl-[1.125rem]"), children: action }) : null
6267
+ ] }) });
6268
+ }
6269
+ var FOOT_LINK = "inline-flex min-h-11 items-center transition-colors hover:text-foreground md:min-h-0";
6270
+ function LegalRow({ links }) {
6271
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-x-6 gap-y-2 sm:flex-row sm:items-center sm:justify-between", children: [
6272
+ /* @__PURE__ */ jsx("nav", { "aria-label": "Legal", children: /* @__PURE__ */ jsx("ul", { className: "flex flex-wrap gap-x-5", children: links.map((l) => /* @__PURE__ */ jsx("li", { children: l.href.startsWith("/") ? /* @__PURE__ */ jsx(Link6, { href: l.href, className: FOOT_LINK, children: l.label }) : /* @__PURE__ */ jsx("a", { href: l.href, className: FOOT_LINK, children: l.label }) }, l.href)) }) }),
6273
+ /* @__PURE__ */ jsxs("p", { children: [
6274
+ "\xA9 ",
6275
+ (/* @__PURE__ */ new Date()).getFullYear(),
6276
+ " OrangeCheck"
6277
+ ] })
6278
+ ] });
6279
+ }
6280
+ function SiteFooter({
6281
+ columns = [],
6282
+ family = false,
6283
+ legal = false,
6284
+ compact = false,
6285
+ fineprint,
6286
+ meta,
6287
+ signature = true,
6288
+ className
6289
+ }) {
6290
+ const legalLinks = legal === true ? LEGAL_LINKS : legal || null;
6291
+ if (compact) {
6292
+ return /* @__PURE__ */ jsx("footer", { className: cn("border-t border-border bg-background text-[0.875rem] text-muted-foreground", className), children: /* @__PURE__ */ jsxs("div", { className: "oca-container flex flex-col gap-x-8 gap-y-3 py-5 lg:flex-row lg:items-center lg:justify-between", children: [
6293
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-1", children: [
6294
+ /* @__PURE__ */ jsx("a", { href: OCHK_IO, className: "rounded-lg text-foreground", children: /* @__PURE__ */ jsx(Lockup, { size: 22 }) }),
6295
+ family ? /* @__PURE__ */ jsx("nav", { "aria-label": "Protocols", children: /* @__PURE__ */ jsx("ul", { className: "flex flex-wrap gap-x-4", children: PROTOCOLS.map((p) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { href: p.pageHref, className: FOOT_LINK, children: p.label }) }, p.slug)) }) }) : null
6296
+ ] }),
6297
+ legalLinks || meta ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-x-6 gap-y-2 sm:flex-row sm:flex-wrap sm:items-center", children: [
6298
+ legalLinks ? /* @__PURE__ */ jsx(LegalRow, { links: legalLinks }) : null,
6299
+ meta
6300
+ ] }) : null
6301
+ ] }) });
6302
+ }
6303
+ const cols = [
6304
+ ...columns,
6305
+ ...family ? familyByGroup().map((g) => ({
6306
+ // The lockup above already says orangecheck.
6307
+ heading: g.id === "orangecheck" ? "Start here" : g.label,
6308
+ links: g.sites.map((s) => ({ href: s.href, label: s.label, external: true }))
6309
+ })) : []
6310
+ ];
6311
+ const n = cols.length;
6312
+ const inline = n <= 5;
6313
+ const grid = {
6314
+ "--oca-footer-md": `repeat(${Math.max(1, Math.min(n, 4))}, minmax(0, 1fr))`,
6315
+ "--oca-footer-lg": inline ? `minmax(0, 1.3fr) repeat(${Math.max(1, n)}, minmax(0, 1fr))` : `repeat(${Math.min(n, 6)}, minmax(0, 1fr))`
6316
+ };
6317
+ return /* @__PURE__ */ jsxs("footer", { className: cn("border-t border-border bg-background", className), children: [
6318
+ /* @__PURE__ */ jsxs(
6319
+ "div",
6320
+ {
6321
+ style: grid,
6322
+ className: "oca-container grid grid-cols-2 gap-x-6 gap-y-10 py-14 md:grid-cols-[var(--oca-footer-md)] md:py-16 lg:grid-cols-[var(--oca-footer-lg)]",
6323
+ children: [
6324
+ /* @__PURE__ */ jsxs("div", { className: cn("col-span-full flex flex-col gap-4", inline && "lg:col-span-1"), children: [
6325
+ /* @__PURE__ */ jsx(Lockup, { size: 26 }),
6326
+ fineprint ? /* @__PURE__ */ jsx("p", { className: "max-w-xs text-[0.9375rem] leading-relaxed text-muted-foreground", children: fineprint }) : null
6390
6327
  ] }),
6391
- place.page ? /* @__PURE__ */ jsxs(
6392
- "div",
6393
- {
6394
- className: cn(
6395
- "flex h-9 items-center gap-1.5 border-t border-border px-4 text-[0.875rem]",
6396
- // The active tab already names the page.
6397
- tabs && !pageOverride && "max-md:hidden"
6398
- ),
6399
- children: [
6400
- place.section ? /* @__PURE__ */ jsxs(Fragment, { children: [
6401
- /* @__PURE__ */ jsx("span", { className: "shrink-0 text-muted-foreground", children: place.section }),
6402
- /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": true, className: "size-3.5 shrink-0 text-muted-foreground" })
6403
- ] }) : null,
6404
- /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: place.page })
6405
- ]
6406
- }
6407
- ) : null
6328
+ cols.map((col, i) => {
6329
+ const spans = n % 2 === 1 && i === n - 1;
6330
+ return /* @__PURE__ */ jsxs(
6331
+ "div",
6332
+ {
6333
+ className: cn("flex min-w-0 flex-col gap-1", spans && "col-span-2 md:col-span-1"),
6334
+ children: [
6335
+ /* @__PURE__ */ jsx("p", { className: "mb-2 text-[0.875rem] font-medium", children: col.heading }),
6336
+ /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-1", spans && "grid grid-cols-2 gap-x-6 md:flex md:flex-col"), children: col.links.map((l) => /* @__PURE__ */ jsx(
6337
+ NavLink,
6338
+ {
6339
+ item: l,
6340
+ className: "-mx-3 py-2.5 text-[0.9375rem] md:py-1.5"
6341
+ },
6342
+ l.href
6343
+ )) })
6344
+ ]
6345
+ },
6346
+ col.heading
6347
+ );
6348
+ })
6349
+ ]
6350
+ }
6351
+ ),
6352
+ signature ? /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "oca-container select-none overflow-hidden pb-8 md:pb-12", children: /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-[0.18em] text-[clamp(3rem,11.5vw,10rem)] leading-[0.78] tracking-[-0.065em] [font-family:var(--oc-font-display)]", children: [
6353
+ /* @__PURE__ */ jsx("span", { className: "mb-[0.06em] inline-block w-[1.1em] shrink-0", children: /* @__PURE__ */ jsx(Mark, { className: "block h-auto w-full" }) }),
6354
+ /* @__PURE__ */ jsx("span", { children: "orangecheck" })
6355
+ ] }) }) : null,
6356
+ legalLinks || meta ? /* @__PURE__ */ jsx("div", { className: "oca-container", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 border-t border-border py-6 text-[0.875rem] text-muted-foreground", children: [
6357
+ legalLinks ? /* @__PURE__ */ jsx(LegalRow, { links: legalLinks }) : null,
6358
+ meta
6359
+ ] }) }) : null
6360
+ ] });
6361
+ }
6362
+ function OchkIoFooter({ columns = OCHK_IO_FOOTER, className }) {
6363
+ return /* @__PURE__ */ jsx(
6364
+ SiteFooter,
6365
+ {
6366
+ columns,
6367
+ family: true,
6368
+ legal: true,
6369
+ fineprint: "Open protocols on Bitcoin. Anyone can check the result.",
6370
+ meta: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
6371
+ /* @__PURE__ */ jsxs("p", { children: [
6372
+ "Open-source work on orangecheck is ",
6373
+ /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: "supported by OpenSats." })
6408
6374
  ] }),
6409
- /* @__PURE__ */ jsxs("div", { className: "mx-auto flex w-full max-w-[90rem]", children: [
6410
- /* @__PURE__ */ jsxs("aside", { className: "sticky top-0 hidden h-dvh w-[17rem] shrink-0 flex-col gap-6 overflow-y-auto px-4 py-6 lg:flex", children: [
6411
- /* @__PURE__ */ jsx(Link8, { href: home, className: "px-2", "aria-label": "Home", children: /* @__PURE__ */ jsx(Lockup, { size: 26 }) }),
6412
- switcher,
6413
- /* @__PURE__ */ jsx(SideNav, { groups }),
6414
- /* @__PURE__ */ jsx("div", { className: "mt-auto flex flex-col gap-3", children: footer })
6375
+ /* @__PURE__ */ jsx(ThemeToggle, { className: "-mx-3" })
6376
+ ] }),
6377
+ className
6378
+ }
6379
+ );
6380
+ }
6381
+ function SignInFrame({
6382
+ title = "Sign in",
6383
+ lead,
6384
+ children,
6385
+ error,
6386
+ fineprint,
6387
+ brand,
6388
+ home = "/",
6389
+ back,
6390
+ art,
6391
+ caption,
6392
+ className
6393
+ }) {
6394
+ return /* @__PURE__ */ jsxs(
6395
+ "main",
6396
+ {
6397
+ id: "main-content",
6398
+ className: cn("grid min-h-dvh grid-cols-1 bg-background text-foreground lg:grid-cols-2", className),
6399
+ children: [
6400
+ /* @__PURE__ */ jsxs("section", { className: "flex flex-col px-4 pb-8 pt-5 sm:px-8 lg:px-14 lg:pt-8", children: [
6401
+ /* @__PURE__ */ jsxs("header", { className: "flex items-center justify-between gap-4", children: [
6402
+ /* @__PURE__ */ jsxs(Link6, { href: home, className: "w-fit rounded-lg", children: [
6403
+ brand ?? /* @__PURE__ */ jsx(Lockup, { size: 28 }),
6404
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: " home" })
6405
+ ] }),
6406
+ back === void 0 ? /* @__PURE__ */ jsx(
6407
+ Link6,
6408
+ {
6409
+ href: home,
6410
+ className: "text-[0.9375rem] text-muted-foreground underline-offset-4 hover:text-foreground hover:underline",
6411
+ children: "Back to home"
6412
+ }
6413
+ ) : back
6415
6414
  ] }),
6416
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
6417
- /* @__PURE__ */ jsx("div", { className: "hidden h-[4.5rem] items-center justify-end gap-3 px-8 lg:flex", children: account }),
6418
- banner ? /* @__PURE__ */ jsx("div", { className: "px-4 pb-2 pt-4 md:px-8 lg:pt-0", children: banner }) : null,
6419
- /* @__PURE__ */ jsx("main", { id: "main-content", className: "flex-1 px-4 pb-16 pt-6 md:px-8 lg:pt-2", children: /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-[72rem]", children }) })
6415
+ /* @__PURE__ */ jsxs("div", { className: "mx-auto flex w-full max-w-[25rem] flex-1 flex-col justify-center gap-9 py-12", children: [
6416
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
6417
+ /* @__PURE__ */ jsx("h1", { className: "oca-display-2", children: title }),
6418
+ lead ? /* @__PURE__ */ jsx("p", { className: "oca-lead", children: lead }) : null
6419
+ ] }),
6420
+ /* @__PURE__ */ jsx("div", { children }),
6421
+ error ? /* @__PURE__ */ jsx("p", { role: "alert", className: "text-[0.9375rem] text-destructive", children: error }) : null,
6422
+ fineprint ? /* @__PURE__ */ jsx("p", { className: "text-[0.8125rem] leading-relaxed text-muted-foreground", children: fineprint }) : null
6420
6423
  ] })
6421
6424
  ] }),
6422
- tabs ? /* @__PURE__ */ jsx(TabBar, { items: tabs }) : null
6425
+ /* @__PURE__ */ jsxs(
6426
+ "aside",
6427
+ {
6428
+ "aria-hidden": true,
6429
+ className: "relative hidden flex-col justify-between gap-10 overflow-hidden border-l border-[var(--oca-band-line)] bg-oca-ink p-14 text-oca-ink-foreground lg:flex",
6430
+ children: [
6431
+ /* @__PURE__ */ jsx("div", { className: "flex flex-1 items-center justify-center", children: art ?? /* @__PURE__ */ jsx(IsoCheck, { size: 340, settle: true, tilt: true, className: "max-w-full" }) }),
6432
+ caption ? /* @__PURE__ */ jsx("div", { className: "flex max-w-[24rem] flex-col gap-3", children: caption }) : null
6433
+ ]
6434
+ }
6435
+ )
6423
6436
  ]
6424
6437
  }
6425
- ) });
6438
+ );
6426
6439
  }
6427
- function AccountMenu({
6428
- name,
6429
- detail,
6430
- items,
6431
- nameFrom = "sm"
6440
+ var STATUS_WORDS = /* @__PURE__ */ new Set(["live", "testing", "not-yet", "paused", "good", "caution", "refused"]);
6441
+ var pathOf = (href) => href.split(/[?#]/)[0].replace(/(.)\/$/, "$1");
6442
+ function DocsNav({
6443
+ sections,
6444
+ current: current2,
6445
+ onNavigate,
6446
+ className
6432
6447
  }) {
6433
- const initial = name.trim().charAt(0).toUpperCase() || "\xB7";
6434
- return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
6435
- /* @__PURE__ */ jsxs(
6436
- DropdownMenuTrigger,
6437
- {
6438
- className: cn(
6439
- "inline-flex h-10 items-center gap-2.5 rounded-full border border-border bg-card pl-1 pr-1 text-[0.9375rem] outline-none transition-colors hover:border-oca-hairline-strong focus-visible:ring-2 focus-visible:ring-ring",
6440
- nameFrom === "lg" ? "lg:pr-3.5" : "sm:pr-3.5"
6441
- ),
6442
- "aria-label": `${name}, account menu`,
6443
- children: [
6444
- /* @__PURE__ */ jsx(
6445
- "span",
6446
- {
6447
- "aria-hidden": true,
6448
- "data-initial": initial,
6449
- className: "flex size-8 items-center justify-center rounded-full bg-foreground text-[0.8125rem] font-medium text-background before:content-[attr(data-initial)]"
6450
- }
6448
+ const here = pathOf(current2);
6449
+ const activeSection = useMemo(
6450
+ () => sections.findIndex((s) => s.items.some((i) => pathOf(i.href) === here)),
6451
+ [sections, here]
6452
+ );
6453
+ const [peeked, setPeeked] = useState(() => /* @__PURE__ */ new Set());
6454
+ useEffect(() => setPeeked(/* @__PURE__ */ new Set()), [activeSection]);
6455
+ const activeRef = useRef(null);
6456
+ useEffect(() => {
6457
+ const id = requestAnimationFrame(() => activeRef.current?.scrollIntoView({ block: "nearest" }));
6458
+ return () => cancelAnimationFrame(id);
6459
+ }, [here]);
6460
+ const base = useId();
6461
+ return /* @__PURE__ */ jsx("nav", { "aria-label": "Docs", className: cn("flex flex-col gap-0.5", className), children: sections.map((section, si) => {
6462
+ const isActive = si === activeSection;
6463
+ const open = isActive || peeked.has(si);
6464
+ const panel = `${base}-s${si}`;
6465
+ return /* @__PURE__ */ jsxs("div", { children: [
6466
+ /* @__PURE__ */ jsxs(
6467
+ "button",
6468
+ {
6469
+ type: "button",
6470
+ "aria-expanded": open,
6471
+ "aria-controls": panel,
6472
+ onClick: () => {
6473
+ if (isActive) return;
6474
+ setPeeked((p) => {
6475
+ const n = new Set(p);
6476
+ if (n.has(si)) n.delete(si);
6477
+ else n.add(si);
6478
+ return n;
6479
+ });
6480
+ },
6481
+ className: cn(
6482
+ "flex min-h-9 w-full items-center justify-between gap-2 rounded-lg px-2.5 py-1.5 text-left text-[0.875rem] transition-colors",
6483
+ isActive ? "font-medium text-foreground" : "text-muted-foreground hover:bg-accent hover:text-foreground",
6484
+ isActive && "cursor-default"
6451
6485
  ),
6452
- /* @__PURE__ */ jsx("span", { className: cn("max-w-[10rem] truncate", nameFrom === "lg" ? "max-lg:hidden" : "max-sm:hidden"), children: name })
6453
- ]
6454
- }
6455
- ),
6456
- /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-64", children: [
6457
- /* @__PURE__ */ jsxs(DropdownMenuLabel, { className: "flex flex-col gap-0.5", children: [
6458
- /* @__PURE__ */ jsx("span", { className: "truncate text-[0.9375rem] font-medium text-foreground", children: name }),
6459
- detail ? /* @__PURE__ */ jsx("span", { className: "truncate font-mono text-[0.75rem]", children: detail }) : null
6460
- ] }),
6461
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
6462
- items.map(
6463
- (it, i) => it === "separator" ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}, `sep-${i}`) : it.href ? /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: true, destructive: it.destructive, children: /* @__PURE__ */ jsxs(Link8, { href: it.href, children: [
6464
- it.icon,
6465
- it.label
6466
- ] }) }, it.label) : /* @__PURE__ */ jsxs(DropdownMenuItem, { onSelect: it.onSelect, destructive: it.destructive, children: [
6467
- it.icon,
6468
- it.label
6469
- ] }, it.label)
6470
- )
6471
- ] })
6472
- ] });
6473
- }
6474
- function ThemeToggle({ className }) {
6475
- const { theme, setTheme } = useTheme();
6476
- const [mounted, setMounted] = useState(false);
6477
- useEffect(() => setMounted(true), []);
6478
- const current2 = mounted ? theme ?? "system" : "system";
6479
- const next = current2 === "light" ? "dark" : current2 === "dark" ? "system" : "light";
6480
- const Icon2 = current2 === "light" ? Sun : current2 === "dark" ? Moon : SunMoon;
6481
- return /* @__PURE__ */ jsx(
6482
- "button",
6483
- {
6484
- type: "button",
6485
- onClick: () => setTheme(next),
6486
- "aria-label": `Theme: ${current2}. Switch to ${next}`,
6487
- title: `Theme: ${current2}`,
6488
- className: cn(
6489
- "inline-flex size-10 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
6490
- className
6486
+ children: [
6487
+ section.label,
6488
+ /* @__PURE__ */ jsx(
6489
+ ChevronRight,
6490
+ {
6491
+ "aria-hidden": true,
6492
+ className: cn("size-3.5 shrink-0 text-oca-subtle transition-transform duration-200", open && "rotate-90")
6493
+ }
6494
+ )
6495
+ ]
6496
+ }
6491
6497
  ),
6492
- children: /* @__PURE__ */ jsx(Icon2, { className: "size-[1.125rem]" })
6498
+ /* @__PURE__ */ jsx("ul", { id: panel, hidden: !open, className: "mb-2 ml-2.5 mt-0.5 border-l border-border", children: section.items.map((item) => {
6499
+ const on = pathOf(item.href) === here;
6500
+ const badge = typeof item.badge === "string" && STATUS_WORDS.has(item.badge) ? /* @__PURE__ */ jsx(StatusBadge, { status: item.badge }) : item.badge ? /* @__PURE__ */ jsx(Badge, { tone: "muted", children: item.badge }) : null;
6501
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
6502
+ Link6,
6503
+ {
6504
+ href: item.href,
6505
+ ref: on ? activeRef : void 0,
6506
+ onClick: onNavigate,
6507
+ "aria-current": on ? "page" : void 0,
6508
+ className: cn(
6509
+ "-ml-px flex min-h-9 items-center gap-2 border-l-2 py-1.5 pl-3.5 pr-2 text-[0.875rem] leading-snug transition-colors",
6510
+ on ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:border-oca-hairline-strong hover:text-foreground"
6511
+ ),
6512
+ children: [
6513
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1", children: item.label }),
6514
+ badge
6515
+ ]
6516
+ }
6517
+ ) }, item.href);
6518
+ }) })
6519
+ ] }, section.label);
6520
+ }) });
6521
+ }
6522
+ var DOCS_HEADER_NAV = OCHK_IO_NAV.map((n) => n.href === DOCS_HREF ? { ...n, active: true } : n);
6523
+ function DocsShell({
6524
+ nav,
6525
+ current: current2,
6526
+ navCurrent,
6527
+ header,
6528
+ search,
6529
+ actions,
6530
+ breadcrumbs,
6531
+ toc,
6532
+ pager,
6533
+ footer,
6534
+ children
6535
+ }) {
6536
+ const [menu, setMenu] = useState(false);
6537
+ useEffect(() => setMenu(false), [current2]);
6538
+ const read = useHeadings("#docs-content", current2);
6539
+ const items = toc ?? read.items;
6540
+ const activeId = toc ? void 0 : read.activeId;
6541
+ const marked = navCurrent ?? current2;
6542
+ const here = pathOf(marked);
6543
+ const place = useMemo(() => {
6544
+ for (const s of nav) {
6545
+ const it = s.items.find((i) => pathOf(i.href) === here);
6546
+ if (it) return { section: s.label, page: it.label };
6493
6547
  }
6494
- );
6548
+ return null;
6549
+ }, [nav, here]);
6550
+ return /* @__PURE__ */ jsxs("div", { className: "flex min-h-dvh flex-col bg-background", children: [
6551
+ /* @__PURE__ */ jsx(SkipLink, {}),
6552
+ header ?? /* @__PURE__ */ jsx(SiteHeader, { home: OCHK_IO, family: "docs", nav: DOCS_HEADER_NAV, search, actions }),
6553
+ /* @__PURE__ */ jsx("div", { className: "sticky top-16 z-30 border-b border-border bg-background/95 backdrop-blur-md supports-[backdrop-filter]:bg-background/90 md:top-[4.5rem] lg:hidden", children: /* @__PURE__ */ jsx("div", { className: "oca-container flex h-12 items-center gap-2", children: /* @__PURE__ */ jsxs(Sheet, { open: menu, onOpenChange: setMenu, children: [
6554
+ /* @__PURE__ */ jsxs(SheetTrigger, { className: "-ml-2 inline-flex h-10 min-w-0 items-center gap-2 rounded-full px-2.5 text-[0.875rem] hover:bg-accent", children: [
6555
+ /* @__PURE__ */ jsx(PanelLeft, { "aria-hidden": true, className: "size-[1.125rem] shrink-0" }),
6556
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Docs menu. " }),
6557
+ place ? /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [
6558
+ /* @__PURE__ */ jsx("span", { className: "shrink-0 text-muted-foreground", children: place.section }),
6559
+ /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": true, className: "size-3.5 shrink-0 text-oca-subtle" }),
6560
+ /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: place.page })
6561
+ ] }) : /* @__PURE__ */ jsx("span", { className: "font-medium", children: "Docs" })
6562
+ ] }),
6563
+ /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "w-[min(88vw,22rem)] gap-0 p-0", children: [
6564
+ /* @__PURE__ */ jsx("div", { className: "border-b border-border px-5 py-4 pr-14", children: /* @__PURE__ */ jsx(SheetTitle, { className: "text-[1.0625rem] font-medium", children: "Docs" }) }),
6565
+ /* @__PURE__ */ jsx("div", { className: "overflow-y-auto p-3", children: /* @__PURE__ */ jsx(DocsNav, { sections: nav, current: marked, onNavigate: () => setMenu(false) }) })
6566
+ ] })
6567
+ ] }) }) }),
6568
+ /* @__PURE__ */ jsx("div", { className: "oca-container flex-1", children: /* @__PURE__ */ jsxs("div", { className: "lg:grid lg:grid-cols-[13.5rem_minmax(0,1fr)] lg:gap-x-10 xl:grid-cols-[13.5rem_minmax(0,1fr)_11rem]", children: [
6569
+ /* @__PURE__ */ jsx("div", { className: "sticky top-[4.5rem] hidden max-h-[calc(100dvh-4.5rem)] self-start overflow-y-auto overscroll-contain py-8 pr-1 lg:block", children: /* @__PURE__ */ jsx(DocsNav, { sections: nav, current: marked }) }),
6570
+ /* @__PURE__ */ jsxs("main", { id: "main-content", className: "min-w-0 pb-16 pt-6 md:pt-8", children: [
6571
+ breadcrumbs ? /* @__PURE__ */ jsx("div", { className: "mb-6 max-lg:hidden", children: breadcrumbs }) : null,
6572
+ items.length > 1 ? /* @__PURE__ */ jsxs("details", { className: "group mb-8 rounded-2xl border border-border bg-card xl:hidden", children: [
6573
+ /* @__PURE__ */ jsxs("summary", { className: "flex min-h-12 cursor-pointer list-none items-center justify-between px-4 text-[0.9375rem] font-medium [&::-webkit-details-marker]:hidden", children: [
6574
+ "On this page",
6575
+ /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": true, className: "size-4 text-muted-foreground transition-transform group-open:rotate-180" })
6576
+ ] }),
6577
+ /* @__PURE__ */ jsx(OnThisPage, { items, activeId, title: null, className: "px-4 pb-4" })
6578
+ ] }) : null,
6579
+ /* @__PURE__ */ jsx("article", { id: "docs-content", className: "max-w-[46rem]", children: /* @__PURE__ */ jsx(InDocsContext.Provider, { value: true, children }) }),
6580
+ pager ? /* @__PURE__ */ jsx("div", { className: "mt-16 max-w-[46rem]", children: pager }) : null
6581
+ ] }),
6582
+ /* @__PURE__ */ jsx("div", { className: "sticky top-[4.5rem] hidden max-h-[calc(100dvh-4.5rem)] self-start overflow-y-auto py-10 xl:block", children: items.length > 1 ? /* @__PURE__ */ jsx(OnThisPage, { items, activeId }) : null })
6583
+ ] }) }),
6584
+ footer ?? /* @__PURE__ */ jsx(OchkIoFooter, {})
6585
+ ] });
6495
6586
  }
6496
6587
  var OCHK_APP_ACCOUNT = "https://ochk.app/me/account";
6588
+ function onHistory(change) {
6589
+ window.addEventListener("popstate", change);
6590
+ return () => window.removeEventListener("popstate", change);
6591
+ }
6592
+ function herePath() {
6593
+ const { href, origin, pathname, search } = window.location;
6594
+ const path = pathname + search;
6595
+ return new URL(path, href).origin === origin ? path : "/";
6596
+ }
6597
+ function routePath(router) {
6598
+ if (!router || router.pathname.includes("[")) return null;
6599
+ return router.basePath && router.pathname === "/" ? router.basePath : router.basePath + router.pathname;
6600
+ }
6601
+ function useSignInHref(path) {
6602
+ const router = useRouter();
6603
+ const here = useSyncExternalStore(onHistory, herePath, () => routePath(router));
6604
+ if (!path) return void 0;
6605
+ return here ? `${path}?return_to=${encodeURIComponent(here)}` : path;
6606
+ }
6497
6607
  function SessionAccountView({
6498
6608
  state,
6499
6609
  name,
6500
6610
  detail,
6501
6611
  items = [],
6502
6612
  signInHref,
6613
+ signInPath,
6503
6614
  signInLabel = "Sign in",
6504
6615
  accountHref = OCHK_APP_ACCOUNT,
6505
6616
  onSignOut,
6506
6617
  nameFrom = "lg"
6507
6618
  }) {
6619
+ const inPlace = useSignInHref(signInPath);
6508
6620
  if (state === "in") {
6509
6621
  return /* @__PURE__ */ jsx(
6510
6622
  AccountMenu,
@@ -6527,13 +6639,13 @@ function SessionAccountView({
6527
6639
  }
6528
6640
  return (
6529
6641
  // No box of its own: it sits exactly where the signed-in chip will. While checking it is only unseen.
6530
- /* @__PURE__ */ jsx("span", { className: state === "checking" ? "contents invisible" : "contents", "aria-hidden": state === "checking" || void 0, children: /* @__PURE__ */ jsx(Button, { asChild: true, size: "sm", variant: "secondary", tabIndex: state === "checking" ? -1 : void 0, children: /* @__PURE__ */ jsx("a", { href: signInHref, children: signInLabel }) }) })
6642
+ /* @__PURE__ */ jsx("span", { className: state === "checking" ? "contents invisible" : "contents", "aria-hidden": state === "checking" || void 0, children: /* @__PURE__ */ jsx(Button, { asChild: true, size: "sm", variant: "secondary", tabIndex: state === "checking" ? -1 : void 0, children: /* @__PURE__ */ jsx("a", { href: signInHref ?? inPlace ?? "https://ochk.io/signin", children: signInLabel }) }) })
6531
6643
  );
6532
6644
  }
6533
6645
  function ToolShell({
6534
6646
  protocol: protocol2,
6535
6647
  tools,
6536
- home = "/",
6648
+ home,
6537
6649
  account,
6538
6650
  rail = false,
6539
6651
  railFooter,
@@ -6572,7 +6684,7 @@ function ToolShell({
6572
6684
  SiteHeader,
6573
6685
  {
6574
6686
  variant: "tool",
6575
- home,
6687
+ home: home ?? p.pageHref,
6576
6688
  product: p.label,
6577
6689
  family: protocol2,
6578
6690
  nav: tools.map((t) => ({ href: t.href, label: t.label, active: t.active })),
@@ -6632,6 +6744,7 @@ function rehypeCode(options = {}) {
6632
6744
  if (lang && skip.has(lang)) continue;
6633
6745
  const meta = parseCodeMeta(code.data?.meta);
6634
6746
  let source = textOf(code);
6747
+ const newline = /\n$/.test(source);
6635
6748
  const diff = meta.diff || lang === "diff" ? readDiff(source) : null;
6636
6749
  if (diff) source = diff.code;
6637
6750
  const lines = options.tokenize?.(source, lang) ?? highlight(source, lang === "diff" ? void 0 : lang);
@@ -6642,7 +6755,8 @@ function rehypeCode(options = {}) {
6642
6755
  ...lang ? { dataLang: lang } : {},
6643
6756
  ...meta.title ? { dataTitle: meta.title } : {},
6644
6757
  ...diff ? { dataDiff: "" } : {},
6645
- ...meta.lineNumbers ? { dataLineNumbers: "" } : {}
6758
+ ...meta.lineNumbers ? { dataLineNumbers: "" } : {},
6759
+ ...newline ? { dataEol: "" } : {}
6646
6760
  };
6647
6761
  child.children = [];
6648
6762
  continue;
@@ -6663,6 +6777,7 @@ function createMdxComponents({ mermaid } = {}) {
6663
6777
  caption: props["data-title"],
6664
6778
  diff: props["data-diff"] !== void 0,
6665
6779
  lineNumbers: props["data-line-numbers"] !== void 0,
6780
+ trailingNewline: props["data-eol"] !== void 0,
6666
6781
  className: "my-6"
6667
6782
  }
6668
6783
  );
@@ -6689,6 +6804,9 @@ function createMdxComponents({ mermaid } = {}) {
6689
6804
  const heading = (as) => function Heading(props) {
6690
6805
  return /* @__PURE__ */ jsx(DocsHeading, { as, ...props });
6691
6806
  };
6807
+ const minor = (Tag) => function Minor({ className, ...props }) {
6808
+ return /* @__PURE__ */ jsx(Tag, { className: cn("mb-2 mt-6 scroll-mt-28 text-[0.9375rem] font-medium leading-snug text-foreground", className), ...props });
6809
+ };
6692
6810
  return {
6693
6811
  h1: heading("h1"),
6694
6812
  h2: heading("h2"),
@@ -6697,11 +6815,15 @@ function createMdxComponents({ mermaid } = {}) {
6697
6815
  p: ({ className, ...props }) => /* @__PURE__ */ jsx("p", { className: cn("my-4 text-[1rem] leading-[1.75] text-muted-foreground md:text-[1.0625rem]", className), ...props }),
6698
6816
  a: A,
6699
6817
  strong: (props) => /* @__PURE__ */ jsx("strong", { className: "font-medium text-foreground", ...props }),
6818
+ h5: minor("h5"),
6819
+ h6: minor("h6"),
6700
6820
  ul: ({ className, ...props }) => /* @__PURE__ */ jsx(
6701
6821
  "ul",
6702
6822
  {
6703
6823
  className: cn(
6704
6824
  "my-4 list-disc space-y-1.5 pl-5 text-[1rem] leading-[1.7] text-muted-foreground marker:text-oca-subtle md:text-[1.0625rem]",
6825
+ // A GitHub task list: the box replaces the bullet.
6826
+ className?.includes("contains-task-list") && "list-none pl-0",
6705
6827
  className
6706
6828
  ),
6707
6829
  ...props
@@ -6717,7 +6839,26 @@ function createMdxComponents({ mermaid } = {}) {
6717
6839
  ...props
6718
6840
  }
6719
6841
  ),
6720
- li: ({ className, ...props }) => /* @__PURE__ */ jsx("li", { className: cn("pl-1 [&>p]:my-1 [&>ul]:my-1.5 [&>ol]:my-1.5", className), ...props }),
6842
+ li: ({ className, ...props }) => /* @__PURE__ */ jsx(
6843
+ "li",
6844
+ {
6845
+ className: cn(
6846
+ "pl-1 [&>p]:my-1 [&>ul]:my-1.5 [&>ol]:my-1.5",
6847
+ // A wrapped task starts under its text, not under the box.
6848
+ className?.includes("task-list-item") && "pl-6 -indent-6",
6849
+ className
6850
+ ),
6851
+ ...props
6852
+ }
6853
+ ),
6854
+ input: (props) => props.type === "checkbox" ? /* @__PURE__ */ jsx(
6855
+ "input",
6856
+ {
6857
+ ...props,
6858
+ className: cn("mr-2 size-4 translate-y-[2px] align-baseline accent-foreground", props.className),
6859
+ "aria-label": props.checked ? "Done" : "To do"
6860
+ }
6861
+ ) : /* @__PURE__ */ jsx("input", { ...props }),
6721
6862
  blockquote: ({ children }) => /* @__PURE__ */ jsx(Callout, { children }),
6722
6863
  hr: () => /* @__PURE__ */ jsx("hr", { className: "my-10 border-border" }),
6723
6864
  table: MdxTable,
@@ -6747,6 +6888,6 @@ function createMdxComponents({ mermaid } = {}) {
6747
6888
  }
6748
6889
  var mdxComponents = createMdxComponents();
6749
6890
 
6750
- export { APP_ATTRIBUTE, APP_ID, Accent, Accordion, AccordionItem, AccountMenu, ActivityList, AnchorStatus, ApiTable, AppCard, AppGrid, AppIcon, AppShell, ArtifactView, Badge, BlockCountdown, BlockHeight, Breadcrumbs, BrowserFrame, Button, CODE_LANGS, Callout, Card, CardContent, CardDescription, CardFooter, CardGrid, CardHeader, CardNumeral, CardTitle, Checkbox, Closing, CodeBlock, CodeTabs, ComparisonTable, Container, CopyButton, Crowd, DOCS_HEADER_NAV, DOCS_HREF, DataTable, DensityProvider, Diagram, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogHost, DialogTitle, DialogTrigger, Display, DocHeader, DocLayout, DocsHeading, DocsNav, DocsPager, DocsShell, DropZone, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EmptyLine, EmptyState, EndpointList, ErrorBoundary, ErrorPage, Eyebrow, FAMILY, FAMILY_GROUPS, FactBlock, FactRows, FamilyMenu, Faq, Field, FilterChips, FloatChip, Footnote, FormSection, HalftoneCanvas, HalftoneSphere, HashChip, Input, InstallTabs, IsoCheck, Kbd, KeyValueList, LEGAL_LINKS, Label, Lead, LegalDocument, LinkCard, LoadingBlock, Lockup, MARK_FACES, Mark, MdxTable, Meter, Monogram, Notice, OCHK_APP_ACCOUNT, OCHK_IO, OCHK_IO_FOOTER, OCHK_IO_NAV, OnThisPage, PROTOCOLS, PROTOCOL_ORDER, PackageCard, PageHeader, PageHero, Pagination, PhoneFrame, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProgressSteps, ProofStrip, Prose, ProtocolGrid, ProtocolHero, ProtocolNav, QrCode, RadioGroup, RadioGroupItem, Reveal, SELF_HOSTED_LEGAL_LINKS, SPHERE_GRADIENT, Sats, SatsFigure, ScrollFade, ScrollStory, SearchButton, SearchDialog, Section, SectionHeading, SectionIntro, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Separator, SessionAccountView, Sheet, SheetClose, SheetContent, SheetDescription, SheetTitle, SheetTrigger, ShellContext, SignInFrame, SignMessage, SiteBanner, SiteFooter, SiteHeader, Skeleton, SkipLink, SpecCard, Spinner, SplitBar, StatCard, StatGrid, StateBadge, StatusBadge, StatusDot, StatusPill, Step, StepGrid, Steps, Switch, TOKEN_CLASS, Tabs, TabsContent, TabsList, TabsTrigger, TextLink, Textarea, ThemeToggle, Ticker, Toaster, ToolGrid, ToolShell, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TruthTable, UsdApprox, VerifyBox, VerifyReport, appColors, appFonts, badgeVariants, blocksToDuration, buttonVariants, cardVariants, cn, confirm, createMdxComponents, createStateBadge, escapeHtml, explorerUrl, familyByGroup, familySite, formatBlockHeight, formatBytes, formatUtc, grammarOf, highlight, highlightToHtml, languageName, linesToHtml, mdxComponents, monogramGround, monogramLetter, parseCodeMeta, parseLineRanges, portraitTone, prompt, protocolSite, readDiff, rehypeCode, satsText, sectionVariants, shortenMiddle, statusWord, useActiveHeading, useCopy, useDensity, useHeadings, useInView, useShellPlace, useTimedOut };
6891
+ export { APP_ATTRIBUTE, APP_ID, Accent, Accordion, AccordionItem, AccountMenu, ActivityList, AnchorStatus, ApiTable, AppCard, AppGrid, AppIcon, AppShell, ArtifactView, Badge, BlockCountdown, BlockHeight, Breadcrumbs, BrowserFrame, Button, CODE_LANGS, Callout, Card, CardContent, CardDescription, CardFooter, CardGrid, CardHeader, CardNumeral, CardTitle, Checkbox, Closing, CodeBlock, CodeTabs, ComparisonTable, Container, CopyButton, Crowd, DOCS_HEADER_NAV, DOCS_HREF, DataTable, DensityProvider, Diagram, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogHost, DialogTitle, DialogTrigger, Display, DocHeader, DocLayout, DocsHeading, DocsNav, DocsPager, DocsShell, DropZone, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EmptyLine, EmptyState, EndpointList, ErrorBoundary, ErrorPage, Eyebrow, FAMILY, FAMILY_GROUPS, FactBlock, FactRows, FamilyMenu, Faq, Field, FilterChips, FloatChip, Footnote, FormSection, HalftoneCanvas, HalftoneSphere, HashChip, Input, InstallTabs, IsoCheck, Kbd, KeyValueList, LEGAL_LINKS, Label, Lead, LegalDocument, LinkCard, LoadingBlock, Lockup, MARK_FACES, Mark, MdxTable, Meter, Monogram, Notice, OCHK_APP_ACCOUNT, OCHK_IO, OCHK_IO_FOOTER, OCHK_IO_NAV, OchkIoFooter, OnThisPage, PROTOCOLS, PROTOCOL_ORDER, PackageCard, PageHeader, PageHero, Pagination, PhoneFrame, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProgressSteps, ProofStrip, Prose, ProtocolGrid, ProtocolHero, ProtocolNav, QrCode, RadioGroup, RadioGroupItem, Reveal, SELF_HOSTED_LEGAL_LINKS, SPHERE_GRADIENT, Sats, SatsFigure, ScrollFade, ScrollStory, SearchButton, SearchDialog, Section, SectionHeading, SectionIntro, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Separator, SessionAccountView, Sheet, SheetClose, SheetContent, SheetDescription, SheetTitle, SheetTrigger, ShellContext, SignInFrame, SignMessage, SiteBanner, SiteFooter, SiteHeader, Skeleton, SkipLink, SpecCard, Spinner, SplitBar, StatCard, StatGrid, StateBadge, StatusBadge, StatusDot, StatusPill, Step, StepGrid, Steps, Switch, TOKEN_CLASS, Tabs, TabsContent, TabsList, TabsTrigger, TextLink, Textarea, ThemeToggle, Ticker, Toaster, ToolGrid, ToolShell, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TruthTable, UsdApprox, VerifyBox, VerifyReport, appColors, appFonts, badgeVariants, blocksToDuration, buttonVariants, cardVariants, cn, confirm, createMdxComponents, createStateBadge, escapeHtml, explorerUrl, familyByGroup, familySite, formatBlockHeight, formatBytes, formatUtc, grammarOf, highlight, highlightToHtml, languageName, linesToHtml, mdxComponents, monogramGround, monogramLetter, parseCodeMeta, parseLineRanges, portraitTone, prompt, protocolSite, readDiff, rehypeCode, satsText, sectionVariants, shortenMiddle, statusWord, useActiveHeading, useCopy, useDensity, useHeadings, useInView, useShellPlace, useSignInHref, useTimedOut };
6751
6892
  //# sourceMappingURL=index.mjs.map
6752
6893
  //# sourceMappingURL=index.mjs.map