@orangecheck/app-design 1.0.0 → 1.1.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 (62) hide show
  1. package/README.md +21 -5
  2. package/dist/chrome.d.mts +31 -42
  3. package/dist/chrome.d.ts +31 -42
  4. package/dist/chrome.js +500 -23
  5. package/dist/chrome.js.map +1 -1
  6. package/dist/chrome.mjs +495 -25
  7. package/dist/chrome.mjs.map +1 -1
  8. package/dist/code.d.mts +52 -0
  9. package/dist/code.d.ts +52 -0
  10. package/dist/code.js +534 -0
  11. package/dist/code.js.map +1 -0
  12. package/dist/code.mjs +522 -0
  13. package/dist/code.mjs.map +1 -0
  14. package/dist/components.d.mts +61 -117
  15. package/dist/components.d.ts +61 -117
  16. package/dist/components.js +2170 -105
  17. package/dist/components.js.map +1 -1
  18. package/dist/components.mjs +2142 -109
  19. package/dist/components.mjs.map +1 -1
  20. package/dist/docs-DhnstueM.d.ts +219 -0
  21. package/dist/docs-DiR6s43s.d.mts +219 -0
  22. package/dist/format.d.mts +12 -0
  23. package/dist/format.d.ts +12 -0
  24. package/dist/format.js +65 -0
  25. package/dist/format.js.map +1 -0
  26. package/dist/format.mjs +58 -0
  27. package/dist/format.mjs.map +1 -0
  28. package/dist/hero-Dn37il-9.d.mts +31 -0
  29. package/dist/hero-Dn37il-9.d.ts +31 -0
  30. package/dist/index.d.mts +10 -3
  31. package/dist/index.d.ts +10 -3
  32. package/dist/index.js +2668 -131
  33. package/dist/index.js.map +1 -1
  34. package/dist/index.mjs +2614 -134
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/mdx.d.mts +58 -0
  37. package/dist/mdx.d.ts +58 -0
  38. package/dist/mdx.js +1712 -0
  39. package/dist/mdx.js.map +1 -0
  40. package/dist/mdx.mjs +1685 -0
  41. package/dist/mdx.mjs.map +1 -0
  42. package/dist/primitives.d.mts +22 -5
  43. package/dist/primitives.d.ts +22 -5
  44. package/dist/primitives.js +51 -5
  45. package/dist/primitives.js.map +1 -1
  46. package/dist/primitives.mjs +51 -7
  47. package/dist/primitives.mjs.map +1 -1
  48. package/dist/session.d.mts +18 -0
  49. package/dist/session.d.ts +18 -0
  50. package/dist/session.js +432 -0
  51. package/dist/session.js.map +1 -0
  52. package/dist/session.mjs +401 -0
  53. package/dist/session.mjs.map +1 -0
  54. package/dist/styles/code.css +97 -0
  55. package/dist/styles/theme.css +2 -0
  56. package/dist/styles/tokens.css +40 -0
  57. package/dist/styles.css +1 -0
  58. package/dist/tool-shell-B1C7ahKE.d.ts +81 -0
  59. package/dist/tool-shell-BDx_N5ai.d.mts +81 -0
  60. package/dist/tools-BggNN5DV.d.ts +131 -0
  61. package/dist/tools-DFIxIj5p.d.mts +131 -0
  62. package/package.json +31 -2
package/dist/mdx.js ADDED
@@ -0,0 +1,1712 @@
1
+ 'use strict';
2
+
3
+ var TabsPrimitive = require('@radix-ui/react-tabs');
4
+ var react = require('react');
5
+ var clsx = require('clsx');
6
+ var tailwindMerge = require('tailwind-merge');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var lucideReact = require('lucide-react');
9
+ var reactSlot = require('@radix-ui/react-slot');
10
+ var classVarianceAuthority = require('class-variance-authority');
11
+ var SeparatorPrimitive = require('@radix-ui/react-separator');
12
+ require('sonner');
13
+ var Link = require('next/link');
14
+
15
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
+
17
+ function _interopNamespace(e) {
18
+ if (e && e.__esModule) return e;
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ Object.keys(e).forEach(function (k) {
22
+ if (k !== 'default') {
23
+ var d = Object.getOwnPropertyDescriptor(e, k);
24
+ Object.defineProperty(n, k, d.get ? d : {
25
+ enumerable: true,
26
+ get: function () { return e[k]; }
27
+ });
28
+ }
29
+ });
30
+ }
31
+ n.default = e;
32
+ return Object.freeze(n);
33
+ }
34
+
35
+ var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
36
+ var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
37
+ var Link__default = /*#__PURE__*/_interopDefault(Link);
38
+
39
+ // src/code/highlight.ts
40
+ var TOKEN_CLASS = {
41
+ keyword: "oca-k",
42
+ string: "oca-s",
43
+ number: "oca-n",
44
+ function: "oca-f",
45
+ type: "oca-y",
46
+ property: "oca-p",
47
+ comment: "oca-c",
48
+ tag: "oca-g",
49
+ url: "oca-u"
50
+ };
51
+ var ALIASES = {
52
+ ts: "js",
53
+ typescript: "js",
54
+ tsx: "js",
55
+ js: "js",
56
+ javascript: "js",
57
+ jsx: "js",
58
+ mjs: "js",
59
+ cjs: "js",
60
+ json: "json",
61
+ jsonc: "json",
62
+ json5: "json",
63
+ bash: "shell",
64
+ sh: "shell",
65
+ shell: "shell",
66
+ zsh: "shell",
67
+ console: "shell",
68
+ terminal: "shell",
69
+ py: "python",
70
+ python: "python",
71
+ yaml: "yaml",
72
+ yml: "yaml",
73
+ diff: "diff"
74
+ };
75
+ function grammarOf(lang) {
76
+ return lang && ALIASES[lang.toLowerCase()] || "plain";
77
+ }
78
+ function collector() {
79
+ const tokens = [];
80
+ const emit = (text, kind) => {
81
+ if (!text) return;
82
+ const last = tokens[tokens.length - 1];
83
+ if (last && last.kind === kind) last.text += text;
84
+ else tokens.push(kind ? { text, kind } : { text });
85
+ };
86
+ return { emit, tokens };
87
+ }
88
+ function at(re, src, i) {
89
+ re.lastIndex = i;
90
+ const m = re.exec(src);
91
+ return m ? m[0] : null;
92
+ }
93
+ var WS = /[ \t]+/y;
94
+ var NEWLINE = /\r?\n/y;
95
+ var JS_KEYWORDS = new Set(
96
+ "abstract as async await break case catch class const continue debugger declare default delete do else enum export extends finally for from function get if implements import in infer instanceof interface is keyof let module namespace new of override private protected public readonly return satisfies set static super switch this throw try type typeof unique var void while with yield".split(" ")
97
+ );
98
+ var JS_CONSTANTS = /* @__PURE__ */ new Set(["true", "false", "null", "undefined", "NaN", "Infinity"]);
99
+ var TS_PRIMITIVES = /* @__PURE__ */ new Set(["string", "number", "boolean", "bigint", "symbol", "object", "unknown", "any", "never"]);
100
+ var isConstant = (m) => /^[A-Z][A-Z\d_]+$/.test(m) && (m.includes("_") || m.length > 4);
101
+ var JS_LINE_COMMENT = /\/\/[^\n]*/y;
102
+ var JS_BLOCK_COMMENT = /\/\*[\s\S]*?(?:\*\/|$)/y;
103
+ var JS_TEMPLATE = /`(?:\\[\s\S]|[^\\`])*`?/y;
104
+ var JS_STRING = /'(?:\\.|[^\\'\n])*'?|"(?:\\.|[^\\"\n])*"?/y;
105
+ var JS_NUMBER = /(?:0[xX][\da-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|\d[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?|\.\d[\d_]*(?:[eE][+-]?\d+)?)n?/y;
106
+ var JS_IDENT = /[A-Za-z_$][\w$]*/y;
107
+ var JS_DECORATOR = /@[A-Za-z_$][\w$.]*/y;
108
+ var JS_CALL_AFTER = /\s*(?:<[\w$\s,.[\]|&'"]*>)?\s*\(/y;
109
+ var JS_TAG = /<\/?(?=[A-Za-z])/y;
110
+ var JS_TAG_NAME = /[A-Za-z][\w$.:-]*/y;
111
+ var JS_PUNCT = /=>|\.\.\.|[{}()[\];,.<>=+\-*/%!?:&|^~#]/y;
112
+ var JSX_BEFORE = /* @__PURE__ */ new Set(["(", ",", "=", "?", ":", "{", "[", ";", ">", "&&", "||", "=>", "return"]);
113
+ function scanJs(src, emit, jsx13) {
114
+ let i = 0;
115
+ let prev = "";
116
+ let tagDepth = 0;
117
+ let braceInTag = 0;
118
+ const sig = (t) => {
119
+ prev = t;
120
+ };
121
+ while (i < src.length) {
122
+ let m;
123
+ if ((m = at(WS, src, i)) || (m = at(NEWLINE, src, i))) {
124
+ emit(m);
125
+ i += m.length;
126
+ continue;
127
+ }
128
+ if ((m = at(JS_LINE_COMMENT, src, i)) || (m = at(JS_BLOCK_COMMENT, src, i))) {
129
+ emit(m, "comment");
130
+ i += m.length;
131
+ continue;
132
+ }
133
+ if ((m = at(JS_TEMPLATE, src, i)) || (m = at(JS_STRING, src, i))) {
134
+ emit(m, "string");
135
+ i += m.length;
136
+ sig('"');
137
+ continue;
138
+ }
139
+ if (jsx13 && tagDepth === 0 && (m = at(JS_TAG, src, i)) && (prev === "" || JSX_BEFORE.has(prev))) {
140
+ const name = at(JS_TAG_NAME, src, i + m.length);
141
+ if (name) {
142
+ emit(m);
143
+ emit(name, "tag");
144
+ i += m.length + name.length;
145
+ tagDepth = 1;
146
+ braceInTag = 0;
147
+ sig("tag");
148
+ continue;
149
+ }
150
+ }
151
+ if (jsx13 && tagDepth > 0 && braceInTag === 0) {
152
+ if (src.startsWith("/>", i) || src[i] === ">") {
153
+ const close = src[i] === ">" ? ">" : "/>";
154
+ emit(close);
155
+ i += close.length;
156
+ tagDepth = 0;
157
+ sig(">");
158
+ continue;
159
+ }
160
+ if ((m = at(JS_IDENT, src, i)) && /^\s*=/.test(src.slice(i + m.length, i + m.length + 4))) {
161
+ emit(m, "property");
162
+ i += m.length;
163
+ continue;
164
+ }
165
+ if (m = at(JS_IDENT, src, i)) {
166
+ emit(m, "property");
167
+ i += m.length;
168
+ continue;
169
+ }
170
+ if (src[i] === "{") braceInTag = 1;
171
+ } else if (jsx13 && tagDepth > 0 && braceInTag > 0) {
172
+ if (src[i] === "{") braceInTag++;
173
+ else if (src[i] === "}") braceInTag--;
174
+ }
175
+ if (m = at(JS_DECORATOR, src, i)) {
176
+ emit(m, "function");
177
+ i += m.length;
178
+ sig("@");
179
+ continue;
180
+ }
181
+ if (m = at(JS_IDENT, src, i)) {
182
+ const end = i + m.length;
183
+ let kind;
184
+ if (prev !== "." && JS_CONSTANTS.has(m)) kind = "number";
185
+ else if (prev !== "." && JS_KEYWORDS.has(m)) kind = "keyword";
186
+ else if (at(JS_CALL_AFTER, src, end) !== null) kind = "function";
187
+ else if (prev !== "." && TS_PRIMITIVES.has(m)) kind = "type";
188
+ else if (isConstant(m)) kind = "number";
189
+ else if (/^[A-Z]/.test(m)) kind = "type";
190
+ emit(m, kind);
191
+ i = end;
192
+ sig(kind === "keyword" ? m : "id");
193
+ continue;
194
+ }
195
+ if (m = at(JS_NUMBER, src, i)) {
196
+ emit(m, "number");
197
+ i += m.length;
198
+ sig("0");
199
+ continue;
200
+ }
201
+ if (m = at(JS_PUNCT, src, i)) {
202
+ emit(m);
203
+ i += m.length;
204
+ sig(m === "." ? "." : m);
205
+ continue;
206
+ }
207
+ emit(src[i]);
208
+ i++;
209
+ }
210
+ }
211
+ var JSON_STRING = /"(?:\\.|[^\\"\n])*"?/y;
212
+ var JSON_KEY_AFTER = /\s*:/y;
213
+ var JSON_NUMBER = /-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/y;
214
+ var JSON_WORD = /true|false|null/y;
215
+ function scanJson(src, emit) {
216
+ let i = 0;
217
+ while (i < src.length) {
218
+ let m;
219
+ if ((m = at(JS_LINE_COMMENT, src, i)) || (m = at(JS_BLOCK_COMMENT, src, i))) {
220
+ emit(m, "comment");
221
+ } else if (m = at(JSON_STRING, src, i)) {
222
+ emit(m, at(JSON_KEY_AFTER, src, i + m.length) !== null ? "property" : "string");
223
+ } else if ((m = at(JSON_NUMBER, src, i)) || (m = at(JSON_WORD, src, i))) {
224
+ emit(m, "number");
225
+ } else {
226
+ m = src[i];
227
+ emit(m);
228
+ }
229
+ i += m.length;
230
+ }
231
+ }
232
+ var SH_KEYWORDS = new Set(
233
+ "if then else elif fi for in do done case esac while until function return export local select time".split(" ")
234
+ );
235
+ var SH_PROMPT = /\$ (?=\S)/y;
236
+ var SH_COMMENT = /#[^\n]*/y;
237
+ var SH_SINGLE = /'[^']*'?/y;
238
+ var SH_DOUBLE = /"(?:\\.|[^\\"])*"?/y;
239
+ var SH_VAR = /\$(?:\{[^}\n]*\}?|[A-Za-z_][\w]*|[@*#?$!\d])/y;
240
+ var SH_URL = /https?:\/\/[^\s'"`)]+/y;
241
+ var SH_FLAG = /--?[A-Za-z][\w-]*/y;
242
+ var SH_ASSIGN = /[A-Za-z_][\w]*(?==)/y;
243
+ var SH_VALUE = /=[^\s|&;()<>'"`$]*/y;
244
+ var SH_WORD = /[^\s|&;()<>'"`$#]+/y;
245
+ var SH_OPERATOR = /\|\||&&|[|;&]|\$\(|[()<>]/y;
246
+ function scanShell(src, emit) {
247
+ let i = 0;
248
+ let command = true;
249
+ let lineStart = true;
250
+ while (i < src.length) {
251
+ let m;
252
+ if (m = at(NEWLINE, src, i)) {
253
+ emit(m);
254
+ i += m.length;
255
+ command = !/\\\s*$/.test(src.slice(0, i - m.length));
256
+ lineStart = true;
257
+ continue;
258
+ }
259
+ if (m = at(WS, src, i)) {
260
+ emit(m);
261
+ i += m.length;
262
+ continue;
263
+ }
264
+ if (lineStart && (m = at(SH_PROMPT, src, i))) {
265
+ emit(m, "comment");
266
+ i += m.length;
267
+ lineStart = false;
268
+ continue;
269
+ }
270
+ lineStart = false;
271
+ if ((m = at(SH_COMMENT, src, i)) && (i === 0 || /\s/.test(src[i - 1]))) {
272
+ emit(m, "comment");
273
+ i += m.length;
274
+ continue;
275
+ }
276
+ if ((m = at(SH_SINGLE, src, i)) || (m = at(SH_DOUBLE, src, i))) {
277
+ emit(m, "string");
278
+ i += m.length;
279
+ command = false;
280
+ continue;
281
+ }
282
+ if (m = at(SH_OPERATOR, src, i)) {
283
+ emit(m);
284
+ i += m.length;
285
+ command = m !== ")" && m !== ">" && m !== "<";
286
+ continue;
287
+ }
288
+ if (m = at(SH_VAR, src, i)) {
289
+ emit(m, "type");
290
+ i += m.length;
291
+ command = false;
292
+ continue;
293
+ }
294
+ if (m = at(SH_URL, src, i)) {
295
+ emit(m, "url");
296
+ i += m.length;
297
+ command = false;
298
+ continue;
299
+ }
300
+ if (command && (m = at(SH_ASSIGN, src, i))) {
301
+ emit(m, "property");
302
+ i += m.length;
303
+ const v = at(SH_VALUE, src, i);
304
+ emit(v);
305
+ i += v.length;
306
+ continue;
307
+ }
308
+ if ((m = at(SH_FLAG, src, i)) && !command) {
309
+ emit(m, "keyword");
310
+ i += m.length;
311
+ continue;
312
+ }
313
+ if (m = at(SH_WORD, src, i)) {
314
+ if (command && SH_KEYWORDS.has(m)) emit(m, "keyword");
315
+ else if (command) {
316
+ emit(m, "function");
317
+ command = m === "sudo" || m === "npx" || m === "env" || m === "time";
318
+ i += m.length;
319
+ continue;
320
+ } else emit(m);
321
+ i += m.length;
322
+ continue;
323
+ }
324
+ emit(src[i]);
325
+ i++;
326
+ }
327
+ }
328
+ var PY_KEYWORDS = new Set(
329
+ "and as assert async await break class continue def del elif else except finally for from global if import in is lambda match case nonlocal not or pass raise return try while with yield self cls".split(" ")
330
+ );
331
+ var PY_CONSTANTS = /* @__PURE__ */ new Set(["True", "False", "None"]);
332
+ var PY_TYPES = /* @__PURE__ */ new Set(["int", "str", "bool", "float", "bytes", "list", "dict", "tuple", "set", "object"]);
333
+ var PY_COMMENT = /#[^\n]*/y;
334
+ var PY_TRIPLE = /[rRbBuUfF]{0,2}(?:"""[\s\S]*?(?:"""|$)|'''[\s\S]*?(?:'''|$))/y;
335
+ var PY_STRING = /[rRbBuUfF]{0,2}(?:'(?:\\.|[^\\'\n])*'?|"(?:\\.|[^\\"\n])*"?)/y;
336
+ var PY_NUMBER = /(?:0[xX][\da-fA-F_]+|\d[\d_]*(?:\.[\d_]*)?(?:[eE][+-]?\d+)?j?)/y;
337
+ var PY_IDENT = /[A-Za-z_]\w*/y;
338
+ var PY_DECORATOR = /@[A-Za-z_][\w.]*/y;
339
+ var PY_CALL_AFTER = /\s*\(/y;
340
+ function scanPython(src, emit) {
341
+ let i = 0;
342
+ let prev = "";
343
+ while (i < src.length) {
344
+ let m;
345
+ if ((m = at(WS, src, i)) || (m = at(NEWLINE, src, i))) {
346
+ emit(m);
347
+ i += m.length;
348
+ continue;
349
+ }
350
+ if (m = at(PY_COMMENT, src, i)) {
351
+ emit(m, "comment");
352
+ } else if ((m = at(PY_TRIPLE, src, i)) || (m = at(PY_STRING, src, i))) {
353
+ if (/^[A-Za-z]+$/.test(m)) {
354
+ emit(m);
355
+ } else emit(m, "string");
356
+ prev = '"';
357
+ } else if (m = at(PY_DECORATOR, src, i)) {
358
+ emit(m, "function");
359
+ prev = "@";
360
+ } else if (m = at(PY_IDENT, src, i)) {
361
+ let kind;
362
+ if (PY_CONSTANTS.has(m)) kind = "number";
363
+ else if (prev !== "." && PY_KEYWORDS.has(m)) kind = "keyword";
364
+ else if (prev === "def" || at(PY_CALL_AFTER, src, i + m.length) !== null) kind = "function";
365
+ else if (prev === "class" || /^[A-Z][a-z]/.test(m) || PY_TYPES.has(m)) kind = "type";
366
+ else if (isConstant(m)) kind = "number";
367
+ emit(m, kind);
368
+ prev = kind === "keyword" ? m : "id";
369
+ } else if (m = at(PY_NUMBER, src, i)) {
370
+ emit(m, "number");
371
+ prev = "0";
372
+ } else {
373
+ m = src[i];
374
+ emit(m);
375
+ prev = m;
376
+ }
377
+ i += m.length;
378
+ }
379
+ }
380
+ var YAML_KEY = /[ \t]*(?:- )?[\w.$/-]+(?=[ \t]*:(?:\s|$))/y;
381
+ var YAML_VALUE_WORD = /(?:true|false|null|yes|no|~|-?\d+(?:\.\d+)?)(?=\s*(?:#|$))/y;
382
+ function scanYaml(src, emit) {
383
+ let i = 0;
384
+ let lineStart = true;
385
+ while (i < src.length) {
386
+ let m;
387
+ if (m = at(NEWLINE, src, i)) {
388
+ emit(m);
389
+ i += m.length;
390
+ lineStart = true;
391
+ continue;
392
+ }
393
+ if (lineStart && (m = at(YAML_KEY, src, i))) {
394
+ const dash = m.match(/^([ \t]*(?:- )?)/)[1];
395
+ emit(dash);
396
+ emit(m.slice(dash.length), "property");
397
+ i += m.length;
398
+ lineStart = false;
399
+ continue;
400
+ }
401
+ lineStart = false;
402
+ if ((m = at(SH_COMMENT, src, i)) && (i === 0 || /\s/.test(src[i - 1]))) emit(m, "comment");
403
+ else if ((m = at(SH_SINGLE, src, i)) || (m = at(JSON_STRING, src, i))) emit(m, "string");
404
+ else if (m = at(YAML_VALUE_WORD, src, i)) emit(m, "number");
405
+ else if (m = at(SH_URL, src, i)) emit(m, "url");
406
+ else {
407
+ m = src[i];
408
+ emit(m);
409
+ }
410
+ i += m.length;
411
+ }
412
+ }
413
+ function toLines(tokens) {
414
+ const lines = [[]];
415
+ for (const t of tokens) {
416
+ const parts = t.text.split(/\r?\n/);
417
+ parts.forEach((part, j) => {
418
+ if (j > 0) lines.push([]);
419
+ if (part) lines[lines.length - 1].push(t.kind ? { text: part, kind: t.kind } : { text: part });
420
+ });
421
+ }
422
+ return lines;
423
+ }
424
+ function highlight(code, lang) {
425
+ const src = code.replace(/\r?\n$/, "");
426
+ const grammar = grammarOf(lang);
427
+ const { emit, tokens } = collector();
428
+ const name = (lang ?? "").toLowerCase();
429
+ switch (grammar) {
430
+ case "js":
431
+ scanJs(src, emit, name === "tsx" || name === "jsx");
432
+ break;
433
+ case "json":
434
+ scanJson(src, emit);
435
+ break;
436
+ case "shell":
437
+ scanShell(src, emit);
438
+ break;
439
+ case "python":
440
+ scanPython(src, emit);
441
+ break;
442
+ case "yaml":
443
+ scanYaml(src, emit);
444
+ break;
445
+ default:
446
+ emit(src);
447
+ }
448
+ return toLines(tokens);
449
+ }
450
+ function readDiff(code) {
451
+ const diff = /* @__PURE__ */ new Map();
452
+ const lines = code.replace(/\r?\n$/, "").split(/\r?\n/);
453
+ const out = lines.map((line, i) => {
454
+ const c = line[0];
455
+ if (c === "+" || c === "-") {
456
+ diff.set(i + 1, c === "+" ? "add" : "remove");
457
+ return line.slice(1);
458
+ }
459
+ return c === " " ? line.slice(1) : line;
460
+ });
461
+ return { code: out.join("\n"), diff };
462
+ }
463
+ function parseLineRanges(spec) {
464
+ if (!spec) return /* @__PURE__ */ new Set();
465
+ if (typeof spec !== "string") return new Set(spec);
466
+ const out = /* @__PURE__ */ new Set();
467
+ for (const part of spec.split(",")) {
468
+ const m = part.trim().match(/^(\d+)(?:\s*-\s*(\d+))?$/);
469
+ if (!m) continue;
470
+ const a = Number(m[1]);
471
+ const b = m[2] ? Number(m[2]) : a;
472
+ for (let n = Math.min(a, b); n <= Math.max(a, b) && n - a < 1e4; n++) out.add(n);
473
+ }
474
+ return out;
475
+ }
476
+ var ESCAPE = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" };
477
+ function escapeHtml(s) {
478
+ return s.replace(/[&<>"]/g, (c) => ESCAPE[c]);
479
+ }
480
+ function linesToHtml(lines, marks = {}) {
481
+ return lines.map((line, i) => {
482
+ const n = i + 1;
483
+ const attrs = [
484
+ 'data-line=""',
485
+ marks.highlight?.has(n) ? 'data-mark=""' : "",
486
+ marks.diff?.has(n) ? `data-diff="${marks.diff.get(n)}"` : ""
487
+ ].filter(Boolean).join(" ");
488
+ const body = line.map((t) => t.kind ? `<span class="${TOKEN_CLASS[t.kind]}">${escapeHtml(t.text)}</span>` : escapeHtml(t.text)).join("");
489
+ return `<span ${attrs}>${body}</span>`;
490
+ }).join("\n");
491
+ }
492
+ var merge = tailwindMerge.extendTailwindMerge({
493
+ extend: {
494
+ classGroups: {
495
+ "oca-type": [
496
+ "oca-display-1",
497
+ "oca-display-2",
498
+ "oca-display-3",
499
+ "oca-title",
500
+ "oca-title-sm",
501
+ "oca-eyebrow",
502
+ "oca-lead",
503
+ "oca-body",
504
+ "oca-numeral"
505
+ ]
506
+ }
507
+ }
508
+ });
509
+ function cn(...inputs) {
510
+ return merge(clsx.clsx(inputs));
511
+ }
512
+ function ScrollFade({ fade = "var(--card)", className, innerClassName, children, ...props }) {
513
+ const ref = react.useRef(null);
514
+ const [edges, setEdges] = react.useState({ left: false, right: false });
515
+ const measure = react.useCallback(() => {
516
+ const el = ref.current;
517
+ if (!el) return;
518
+ const left = el.scrollLeft > 1;
519
+ const right = el.scrollLeft + el.clientWidth < el.scrollWidth - 1;
520
+ setEdges((e) => e.left === left && e.right === right ? e : { left, right });
521
+ }, []);
522
+ react.useEffect(() => {
523
+ const el = ref.current;
524
+ if (!el) return;
525
+ measure();
526
+ if (typeof ResizeObserver === "undefined") return;
527
+ const ro = new ResizeObserver(measure);
528
+ ro.observe(el);
529
+ if (el.firstElementChild) ro.observe(el.firstElementChild);
530
+ return () => ro.disconnect();
531
+ }, [measure]);
532
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative min-w-0", className), ...props, children: [
533
+ /* @__PURE__ */ jsxRuntime.jsx(
534
+ "div",
535
+ {
536
+ ref,
537
+ onScroll: measure,
538
+ tabIndex: edges.left || edges.right ? 0 : void 0,
539
+ className: cn(
540
+ "overflow-x-auto overscroll-x-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-ring",
541
+ innerClassName
542
+ ),
543
+ children
544
+ }
545
+ ),
546
+ /* @__PURE__ */ jsxRuntime.jsx(
547
+ "span",
548
+ {
549
+ "aria-hidden": true,
550
+ className: cn(
551
+ "pointer-events-none absolute inset-y-0 left-0 w-8 transition-opacity duration-150",
552
+ edges.left ? "opacity-100" : "opacity-0"
553
+ ),
554
+ style: { background: `linear-gradient(to right, ${fade}, transparent)` }
555
+ }
556
+ ),
557
+ /* @__PURE__ */ jsxRuntime.jsx(
558
+ "span",
559
+ {
560
+ "aria-hidden": true,
561
+ className: cn(
562
+ "pointer-events-none absolute inset-y-0 right-0 w-10 transition-opacity duration-150",
563
+ edges.right ? "opacity-100" : "opacity-0"
564
+ ),
565
+ style: { background: `linear-gradient(to left, ${fade}, transparent)` }
566
+ }
567
+ )
568
+ ] });
569
+ }
570
+ function Spinner({ className, label }) {
571
+ return /* @__PURE__ */ jsxRuntime.jsxs(
572
+ "svg",
573
+ {
574
+ viewBox: "0 0 24 24",
575
+ fill: "none",
576
+ role: label ? "status" : void 0,
577
+ "aria-label": label,
578
+ "aria-hidden": label ? void 0 : true,
579
+ className: cn("size-4 animate-spin", className),
580
+ children: [
581
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "9", stroke: "currentColor", strokeOpacity: "0.2", strokeWidth: "2.5" }),
582
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 12a9 9 0 0 0-9-9", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" })
583
+ ]
584
+ }
585
+ );
586
+ }
587
+ function Skeleton({ className, ...props }) {
588
+ return /* @__PURE__ */ jsxRuntime.jsx(
589
+ "div",
590
+ {
591
+ "data-ui": "skeleton",
592
+ className: cn("animate-pulse rounded-lg bg-[var(--oca-skeleton)]", className),
593
+ ...props
594
+ }
595
+ );
596
+ }
597
+ react.forwardRef(function Separator2({ className, orientation = "horizontal", decorative = true, ...props }, ref) {
598
+ return /* @__PURE__ */ jsxRuntime.jsx(
599
+ SeparatorPrimitive__namespace.Root,
600
+ {
601
+ ref,
602
+ decorative,
603
+ orientation,
604
+ className: cn(
605
+ "shrink-0 bg-border",
606
+ orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
607
+ className
608
+ ),
609
+ ...props
610
+ }
611
+ );
612
+ });
613
+ var buttonVariants = classVarianceAuthority.cva(
614
+ [
615
+ "inline-flex shrink-0 select-none items-center justify-center gap-2 whitespace-nowrap rounded-full font-medium",
616
+ "transition-[background-color,border-color,color,box-shadow,transform] duration-150",
617
+ "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
618
+ "active:translate-y-px disabled:pointer-events-none",
619
+ // Disabled is one look for every variant: a quiet grey pill, never a
620
+ // faded black or orange slab that reads as broken.
621
+ "disabled:border disabled:border-border disabled:bg-muted disabled:text-oca-subtle disabled:shadow-none",
622
+ "[&_svg]:pointer-events-none [&_svg]:size-[1.1em] [&_svg]:shrink-0"
623
+ ],
624
+ {
625
+ variants: {
626
+ variant: {
627
+ primary: "bg-primary text-primary-foreground hover:bg-primary/85",
628
+ secondary: "border border-border bg-secondary text-secondary-foreground hover:border-oca-hairline-strong hover:bg-accent",
629
+ brand: "bg-brand text-brand-foreground hover:bg-oca-orange-deep",
630
+ ghost: "text-foreground hover:bg-accent",
631
+ danger: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
632
+ link: "h-auto rounded-none px-0 text-foreground underline decoration-foreground/35 underline-offset-4 hover:decoration-foreground",
633
+ onInk: "bg-white text-oca-ink hover:bg-white/90",
634
+ onInkOutline: "border border-white/20 text-white hover:bg-white/10"
635
+ },
636
+ size: {
637
+ sm: "h-9 px-4 text-sm",
638
+ md: "h-11 px-5 text-[0.9375rem]",
639
+ lg: "h-14 px-7 text-[1.0625rem]",
640
+ icon: "size-10",
641
+ "icon-sm": "size-8"
642
+ }
643
+ },
644
+ compoundVariants: [{ variant: "link", className: "h-auto px-0" }],
645
+ defaultVariants: { variant: "primary", size: "md" }
646
+ }
647
+ );
648
+ var Button = react.forwardRef(function Button2({ className, variant, size, asChild = false, loading = false, disabled, children, type, ...props }, ref) {
649
+ const Comp = asChild ? reactSlot.Slot : "button";
650
+ return /* @__PURE__ */ jsxRuntime.jsx(
651
+ Comp,
652
+ {
653
+ ref,
654
+ "data-ui": "button",
655
+ className: cn(buttonVariants({ variant, size }), className),
656
+ disabled: asChild ? void 0 : disabled || loading,
657
+ "aria-busy": loading || void 0,
658
+ type: asChild ? void 0 : type ?? "button",
659
+ ...props,
660
+ children: asChild ? children : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
661
+ loading ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { className: "size-[1.1em]" }) : null,
662
+ children
663
+ ] })
664
+ }
665
+ );
666
+ });
667
+ react.createContext(false);
668
+ var NOTICE_KIND = {
669
+ neutral: "neutral",
670
+ info: "neutral",
671
+ success: "neutral",
672
+ brand: "brand",
673
+ warning: "brand",
674
+ danger: "danger"
675
+ };
676
+ function Notice({
677
+ tone = "neutral",
678
+ title,
679
+ children,
680
+ action,
681
+ role,
682
+ className
683
+ }) {
684
+ const kind = NOTICE_KIND[tone];
685
+ return /* @__PURE__ */ jsxRuntime.jsxs(
686
+ "div",
687
+ {
688
+ role: role ?? (tone === "danger" || tone === "warning" ? "alert" : "note"),
689
+ "data-tone": kind,
690
+ className: cn(
691
+ "flex flex-col gap-3 rounded-2xl border border-border bg-card px-5 py-4 sm:flex-row sm:items-start sm:justify-between",
692
+ kind === "danger" && "border-[color-mix(in_oklab,var(--destructive)_40%,var(--border))]",
693
+ className
694
+ ),
695
+ children: [
696
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 gap-3", children: [
697
+ kind !== "neutral" ? /* @__PURE__ */ jsxRuntime.jsx(
698
+ "span",
699
+ {
700
+ "aria-hidden": true,
701
+ className: cn(
702
+ "mt-[0.45rem] size-2 shrink-0 rounded-full",
703
+ kind === "brand" ? "bg-oca-orange" : "bg-destructive"
704
+ )
705
+ }
706
+ ) : null,
707
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
708
+ title ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("text-[0.9375rem] font-medium", kind === "danger" && "text-destructive"), children: title }) : null,
709
+ children ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[0.9375rem] leading-relaxed text-muted-foreground", children }) : null
710
+ ] })
711
+ ] }),
712
+ action ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: action }) : null
713
+ ]
714
+ }
715
+ );
716
+ }
717
+ async function wipeIfUnchanged(expected) {
718
+ try {
719
+ if (await navigator.clipboard.readText() !== expected) return;
720
+ } catch {
721
+ }
722
+ try {
723
+ await navigator.clipboard.writeText("");
724
+ } catch {
725
+ }
726
+ }
727
+ function useCopy(timeoutMs = 1600) {
728
+ const [copied, setCopied] = react.useState(false);
729
+ const t = react.useRef(null);
730
+ const wipe = react.useRef(null);
731
+ react.useEffect(
732
+ () => () => {
733
+ if (t.current) clearTimeout(t.current);
734
+ },
735
+ []
736
+ );
737
+ const copy = react.useCallback(
738
+ async (text, opts = {}) => {
739
+ try {
740
+ await navigator.clipboard.writeText(text);
741
+ setCopied(true);
742
+ if (t.current) clearTimeout(t.current);
743
+ t.current = setTimeout(() => setCopied(false), timeoutMs);
744
+ if (opts.clearAfter && opts.clearAfter > 0) {
745
+ if (wipe.current) clearTimeout(wipe.current);
746
+ wipe.current = setTimeout(() => void wipeIfUnchanged(text), opts.clearAfter);
747
+ }
748
+ return true;
749
+ } catch {
750
+ setCopied(false);
751
+ return false;
752
+ }
753
+ },
754
+ [timeoutMs]
755
+ );
756
+ return { copied, copy };
757
+ }
758
+ function CopyButton({ value, label = "Copy", clearAfter, onCopied, className }) {
759
+ const { copied, copy } = useCopy();
760
+ const done = copied ? clearAfter ? `Copied. Cleared in ${Math.round(clearAfter / 1e3)} seconds` : "Copied" : "";
761
+ return /* @__PURE__ */ jsxRuntime.jsxs(
762
+ "button",
763
+ {
764
+ type: "button",
765
+ onClick: async () => {
766
+ if (await copy(typeof value === "function" ? value() : value, { clearAfter })) onCopied?.();
767
+ },
768
+ "aria-label": copied ? "Copied" : label,
769
+ title: label,
770
+ className: cn(
771
+ "inline-flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
772
+ className
773
+ ),
774
+ children: [
775
+ copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-4 text-success" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "size-4" }),
776
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-live": "polite", className: "sr-only", children: done })
777
+ ]
778
+ }
779
+ );
780
+ }
781
+ var LANG_NAME = {
782
+ ts: "TypeScript",
783
+ typescript: "TypeScript",
784
+ tsx: "TSX",
785
+ js: "JavaScript",
786
+ javascript: "JavaScript",
787
+ jsx: "JSX",
788
+ mjs: "JavaScript",
789
+ json: "JSON",
790
+ jsonc: "JSON",
791
+ bash: "Shell",
792
+ sh: "Shell",
793
+ shell: "Shell",
794
+ zsh: "Shell",
795
+ console: "Terminal",
796
+ terminal: "Terminal",
797
+ python: "Python",
798
+ py: "Python",
799
+ yaml: "YAML",
800
+ yml: "YAML",
801
+ diff: "Diff",
802
+ text: "Text"
803
+ };
804
+ function languageName(lang) {
805
+ return lang ? LANG_NAME[lang.toLowerCase()] ?? lang : void 0;
806
+ }
807
+ function forClipboard(text, lang) {
808
+ if (grammarOf(lang) !== "shell") return text;
809
+ const lines = text.split("\n");
810
+ if (!lines.some((l) => l.startsWith("$ "))) return text;
811
+ return lines.filter((l) => l.startsWith("$ ")).map((l) => l.slice(2)).join("\n");
812
+ }
813
+ function linesFromDom(pre) {
814
+ if (!pre) return null;
815
+ const lines = pre.querySelectorAll("[data-line]");
816
+ if (lines.length === 0) return pre.textContent ?? "";
817
+ return Array.from(lines).filter((l) => l.getAttribute("data-diff") !== "remove").map((l) => l.textContent ?? "").join("\n");
818
+ }
819
+ function prepare(code, lang, marks, diff) {
820
+ const d = diff ? readDiff(code) : null;
821
+ const src = d ? d.code : code.replace(/\r?\n$/, "");
822
+ const lines = highlight(src, lang === "diff" ? void 0 : lang);
823
+ const kept = d ? src.split("\n").filter((_, i) => d.diff.get(i + 1) !== "remove") : null;
824
+ return {
825
+ html: linesToHtml(lines, { highlight: parseLineRanges(marks), diff: d?.diff }),
826
+ copy: kept ? kept.join("\n") : src,
827
+ lines: lines.length,
828
+ diff: !!d
829
+ };
830
+ }
831
+ function Well({
832
+ preRef,
833
+ html,
834
+ children,
835
+ lang,
836
+ lines,
837
+ maxLines,
838
+ diff,
839
+ lineNumbers
840
+ }) {
841
+ const foldable = maxLines !== void 0 && lines > maxLines + 2;
842
+ const [open, setOpen] = react.useState(false);
843
+ const folded = foldable && !open;
844
+ const lined = html !== void 0;
845
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
846
+ /* @__PURE__ */ jsxRuntime.jsx(
847
+ "div",
848
+ {
849
+ className: cn(folded && "overflow-hidden"),
850
+ style: folded ? { maxHeight: `calc(${maxLines} * 1.625em + 2rem)` } : void 0,
851
+ children: /* @__PURE__ */ jsxRuntime.jsx(ScrollFade, { fade: "var(--oca-code-surface)", children: /* @__PURE__ */ jsxRuntime.jsx(
852
+ "pre",
853
+ {
854
+ ref: preRef,
855
+ "data-diff": diff ? "" : void 0,
856
+ "data-line-numbers": lineNumbers ? "" : void 0,
857
+ className: cn(
858
+ "oca-code w-max min-w-full py-4 font-mono text-[0.875rem] leading-[1.625] text-oca-ink-muted [font-variant-ligatures:none]",
859
+ !lined && "px-5"
860
+ ),
861
+ children: lined ? /* @__PURE__ */ jsxRuntime.jsx("code", { className: "block", "data-lang": lang, dangerouslySetInnerHTML: { __html: html } }) : /* @__PURE__ */ jsxRuntime.jsx("code", { className: "block", "data-lang": lang, children })
862
+ }
863
+ ) })
864
+ }
865
+ ),
866
+ foldable ? /* @__PURE__ */ jsxRuntime.jsx(
867
+ "div",
868
+ {
869
+ className: cn("flex justify-center px-5 pb-4", folded && "absolute inset-x-0 bottom-0 pt-16"),
870
+ style: folded ? { background: "linear-gradient(to top, var(--oca-code-surface) 40%, transparent)" } : void 0,
871
+ children: /* @__PURE__ */ jsxRuntime.jsx(
872
+ "button",
873
+ {
874
+ type: "button",
875
+ onClick: () => setOpen((v) => !v),
876
+ "aria-expanded": open,
877
+ className: "rounded-full border border-white/20 px-4 py-1.5 text-[0.8125rem] text-white transition-colors hover:bg-white/10",
878
+ children: open ? "Show less" : `Show all ${lines} lines`
879
+ }
880
+ )
881
+ }
882
+ ) : null
883
+ ] });
884
+ }
885
+ var FRAME = "overflow-hidden rounded-[1.25rem] border border-[var(--oca-code-line)] bg-[var(--oca-code-surface)]";
886
+ var COPY_ON_INK = "text-oca-ink-subtle hover:bg-white/10 hover:text-white";
887
+ function CodeBlock({
888
+ code,
889
+ html,
890
+ children,
891
+ lang,
892
+ caption,
893
+ copy = true,
894
+ clearAfter,
895
+ maxLines,
896
+ highlight: marks,
897
+ diff,
898
+ lineNumbers,
899
+ actions,
900
+ className
901
+ }) {
902
+ const preRef = react.useRef(null);
903
+ const isDiff = diff || lang === "diff";
904
+ const markKey = typeof marks === "string" ? marks : marks?.join(",");
905
+ const prepared = react.useMemo(
906
+ () => html === void 0 && children === void 0 && code !== void 0 ? prepare(code, lang, markKey, !!isDiff) : null,
907
+ [code, html, children, lang, markKey, isDiff]
908
+ );
909
+ const markup = prepared?.html ?? html;
910
+ const lines = prepared?.lines ?? (html !== void 0 ? html.split("\n").length : code?.split("\n").length ?? 0);
911
+ const read = () => forClipboard(prepared?.copy ?? linesFromDom(preRef.current) ?? code ?? "", lang);
912
+ return /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: cn(FRAME, className), children: [
913
+ /* @__PURE__ */ jsxRuntime.jsxs("figcaption", { className: "flex h-11 items-center justify-between gap-3 border-b border-[var(--oca-code-line)] pl-5 pr-2", children: [
914
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-[0.8125rem] text-oca-ink-subtle", children: caption ?? languageName(lang) ?? "Code" }),
915
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex shrink-0 items-center gap-1", children: [
916
+ actions,
917
+ copy ? /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: read, label: "Copy code", clearAfter, className: COPY_ON_INK }) : null
918
+ ] })
919
+ ] }),
920
+ /* @__PURE__ */ jsxRuntime.jsx(
921
+ Well,
922
+ {
923
+ preRef,
924
+ html: markup,
925
+ lang,
926
+ lines,
927
+ maxLines,
928
+ diff: prepared ? prepared.diff : isDiff,
929
+ lineNumbers,
930
+ children
931
+ }
932
+ )
933
+ ] });
934
+ }
935
+ var tabListeners = /* @__PURE__ */ new Map();
936
+ var tabMemory = /* @__PURE__ */ new Map();
937
+ var storeKey = (k) => `oca-code-tab:${k}`;
938
+ function readTab(key) {
939
+ if (tabMemory.has(key)) return tabMemory.get(key);
940
+ try {
941
+ return window.localStorage.getItem(storeKey(key));
942
+ } catch {
943
+ return null;
944
+ }
945
+ }
946
+ function writeTab(key, value) {
947
+ tabMemory.set(key, value);
948
+ try {
949
+ window.localStorage.setItem(storeKey(key), value);
950
+ } catch {
951
+ }
952
+ tabListeners.get(key)?.forEach((l) => l());
953
+ }
954
+ function useSyncedTab(key) {
955
+ const subscribe = react.useCallback(
956
+ (cb) => {
957
+ if (!key) return () => {
958
+ };
959
+ const set = tabListeners.get(key) ?? /* @__PURE__ */ new Set();
960
+ set.add(cb);
961
+ tabListeners.set(key, set);
962
+ return () => {
963
+ set.delete(cb);
964
+ };
965
+ },
966
+ [key]
967
+ );
968
+ const value = react.useSyncExternalStore(
969
+ subscribe,
970
+ () => key ? readTab(key) : null,
971
+ () => null
972
+ );
973
+ return [value, (v) => key && writeTab(key, v)];
974
+ }
975
+ function CodeTabs({
976
+ items,
977
+ syncKey,
978
+ defaultValue,
979
+ maxLines,
980
+ className
981
+ }) {
982
+ const [synced, setSynced] = useSyncedTab(syncKey);
983
+ const [local, setLocal] = react.useState(null);
984
+ const labels = items.map((it) => it.label);
985
+ const pick = [local, synced, defaultValue].find((v) => !!v && labels.includes(v)) ?? labels[0] ?? "";
986
+ const active = items.find((it) => it.label === pick);
987
+ const prepared = react.useMemo(() => items.map((it) => prepare(it.code, it.lang, void 0, it.lang === "diff")), [items]);
988
+ return /* @__PURE__ */ jsxRuntime.jsxs(
989
+ TabsPrimitive__namespace.Root,
990
+ {
991
+ value: pick,
992
+ onValueChange: (v) => {
993
+ setLocal(v);
994
+ setSynced(v);
995
+ },
996
+ className: cn(FRAME, className),
997
+ children: [
998
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-11 items-center justify-between gap-3 border-b border-[var(--oca-code-line)] pl-2 pr-2", children: [
999
+ /* @__PURE__ */ jsxRuntime.jsx(ScrollFade, { fade: "var(--oca-code-surface)", className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.List, { "aria-label": "Versions", className: "flex w-max items-center gap-0.5", children: items.map((it) => /* @__PURE__ */ jsxRuntime.jsx(
1000
+ TabsPrimitive__namespace.Trigger,
1001
+ {
1002
+ value: it.label,
1003
+ className: cn(
1004
+ "relative inline-flex h-11 items-center whitespace-nowrap px-3 text-[0.8125rem] text-oca-ink-subtle outline-none transition-colors",
1005
+ "hover:text-white focus-visible:text-white focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
1006
+ "data-[state=active]:text-white",
1007
+ "after:absolute after:inset-x-3 after:bottom-0 after:h-0.5 after:rounded-full after:bg-transparent data-[state=active]:after:bg-oca-orange"
1008
+ ),
1009
+ children: it.label
1010
+ },
1011
+ it.label
1012
+ )) }) }),
1013
+ active ? /* @__PURE__ */ jsxRuntime.jsx(
1014
+ CopyButton,
1015
+ {
1016
+ value: () => forClipboard(prepared[items.indexOf(active)]?.copy ?? active.code, active.lang),
1017
+ label: `Copy ${active.label}`,
1018
+ className: COPY_ON_INK
1019
+ }
1020
+ ) : null
1021
+ ] }),
1022
+ items.map((it, i) => /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.Content, { value: it.label, className: "outline-none", tabIndex: -1, children: /* @__PURE__ */ jsxRuntime.jsx(
1023
+ Well,
1024
+ {
1025
+ html: prepared[i].html,
1026
+ lang: it.lang,
1027
+ lines: prepared[i].lines,
1028
+ maxLines,
1029
+ diff: prepared[i].diff
1030
+ }
1031
+ ) }, it.label))
1032
+ ]
1033
+ }
1034
+ );
1035
+ }
1036
+ function InstallTabs({ pkg, dev = false, className }) {
1037
+ const items = [
1038
+ { label: "npm", code: `npm install ${dev ? "--save-dev " : ""}${pkg}`, lang: "bash" },
1039
+ { label: "yarn", code: `yarn add ${dev ? "--dev " : ""}${pkg}`, lang: "bash" },
1040
+ { label: "pnpm", code: `pnpm add ${dev ? "--save-dev " : ""}${pkg}`, lang: "bash" }
1041
+ ];
1042
+ return /* @__PURE__ */ jsxRuntime.jsx(CodeTabs, { items, syncKey: "package-manager", className });
1043
+ }
1044
+ var GOOD_DOT = "border-border bg-card text-foreground before:size-1.5 before:shrink-0 before:rounded-full before:bg-success before:content-['']";
1045
+ var badgeVariants = classVarianceAuthority.cva(
1046
+ "inline-flex h-6 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 text-[0.8125rem] font-medium leading-none",
1047
+ {
1048
+ variants: {
1049
+ tone: {
1050
+ neutral: "border-border bg-card text-foreground",
1051
+ muted: "border-transparent bg-muted text-muted-foreground",
1052
+ brand: "border-transparent bg-[color-mix(in_oklab,var(--oca-orange)_9%,var(--card))] text-oca-accent-ink",
1053
+ danger: "border-transparent bg-[color-mix(in_oklab,var(--destructive)_12%,var(--card))] text-destructive",
1054
+ // A good state is a neutral pill with a green dot, not a green pill.
1055
+ success: GOOD_DOT,
1056
+ // Aliases kept so older call sites keep compiling: attention is
1057
+ // the brand accent, information is neutral.
1058
+ warning: "border-transparent bg-[color-mix(in_oklab,var(--oca-orange)_9%,var(--card))] text-oca-accent-ink",
1059
+ info: "border-border bg-card text-foreground",
1060
+ // Inverted in dark mode, where ink would sit on a card of nearly its own colour.
1061
+ ink: "border-transparent bg-oca-ink text-oca-ink-foreground dark:bg-foreground dark:text-background",
1062
+ onInk: "border-white/15 bg-white/5 text-white/90"
1063
+ }
1064
+ },
1065
+ defaultVariants: { tone: "neutral" }
1066
+ }
1067
+ );
1068
+ function Badge({ className, tone, ...props }) {
1069
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-ui": "badge", className: cn(badgeVariants({ tone }), className), ...props });
1070
+ }
1071
+ var WORD = {
1072
+ live: "Live",
1073
+ testing: "In testing",
1074
+ "not-yet": "Not yet",
1075
+ paused: "Paused",
1076
+ good: "Good",
1077
+ caution: "Caution",
1078
+ refused: "Refused"
1079
+ };
1080
+ var TONE = {
1081
+ live: "success",
1082
+ testing: "brand",
1083
+ "not-yet": "muted",
1084
+ paused: "muted",
1085
+ good: "success",
1086
+ caution: "brand",
1087
+ refused: "danger"
1088
+ };
1089
+ function StatusBadge({ status, className, ...props }) {
1090
+ return /* @__PURE__ */ jsxRuntime.jsx(Badge, { tone: TONE[status], "data-status": status, className: cn(className), ...props, children: WORD[status] });
1091
+ }
1092
+ var isInternal = (href) => href.startsWith("/") || href.startsWith("#");
1093
+ function DocLink({ href, className, children, ...rest }) {
1094
+ return isInternal(href) ? /* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href, className, ...rest, children }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href, className, ...rest, children });
1095
+ }
1096
+ var CALLOUT_TONE = { note: "neutral", warning: "brand", danger: "danger" };
1097
+ function Callout({
1098
+ tone = "note",
1099
+ title,
1100
+ children,
1101
+ className
1102
+ }) {
1103
+ return /* @__PURE__ */ jsxRuntime.jsx(
1104
+ Notice,
1105
+ {
1106
+ tone: CALLOUT_TONE[tone],
1107
+ title,
1108
+ role: "note",
1109
+ className: cn("my-6 [&_p]:my-0 [&_p]:text-[0.9375rem] [&_p]:leading-relaxed [&_p+p]:mt-3", className),
1110
+ children
1111
+ }
1112
+ );
1113
+ }
1114
+ function Step({ title, id, children }) {
1115
+ return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "relative pb-8 pl-11 last:pb-0 [counter-increment:oca-step]", children: [
1116
+ /* @__PURE__ */ jsxRuntime.jsx(
1117
+ "span",
1118
+ {
1119
+ "aria-hidden": true,
1120
+ 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)]"
1121
+ }
1122
+ ),
1123
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "absolute bottom-1 left-[0.8125rem] top-9 w-px bg-border" }),
1124
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { id, className: "scroll-mt-28 pt-0.5 text-[1.0625rem] font-medium leading-snug tracking-[-0.008em] text-foreground", children: title }),
1125
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 text-muted-foreground [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", children })
1126
+ ] });
1127
+ }
1128
+ function Steps({ children, className }) {
1129
+ return /* @__PURE__ */ jsxRuntime.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 });
1130
+ }
1131
+ function LinkCard({
1132
+ href,
1133
+ title,
1134
+ description,
1135
+ icon,
1136
+ meta,
1137
+ className
1138
+ }) {
1139
+ const Arrow = isInternal(href) ? lucideReact.ArrowRight : lucideReact.ArrowUpRight;
1140
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1141
+ DocLink,
1142
+ {
1143
+ href,
1144
+ className: cn(
1145
+ "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",
1146
+ className
1147
+ ),
1148
+ children: [
1149
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-start justify-between gap-3", children: [
1150
+ icon ? /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("span", { className: "text-[1rem] font-medium leading-snug text-foreground", children: title }),
1151
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex shrink-0 items-center gap-2", children: [
1152
+ meta,
1153
+ /* @__PURE__ */ jsxRuntime.jsx(Arrow, { "aria-hidden": true, className: "size-4 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-foreground" })
1154
+ ] })
1155
+ ] }),
1156
+ icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[1rem] font-medium leading-snug text-foreground", children: title }) : null,
1157
+ description ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[0.9375rem] leading-relaxed text-muted-foreground", children: description }) : null
1158
+ ]
1159
+ }
1160
+ );
1161
+ }
1162
+ function CardGrid({ columns = 2, children, className }) {
1163
+ return /* @__PURE__ */ jsxRuntime.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 });
1164
+ }
1165
+ function MdxTable({ className, ...props }) {
1166
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "not-prose my-6 overflow-hidden rounded-2xl border border-border bg-card", children: /* @__PURE__ */ jsxRuntime.jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxRuntime.jsx(
1167
+ "table",
1168
+ {
1169
+ className: cn(
1170
+ "w-full border-collapse text-left text-[0.875rem] leading-relaxed",
1171
+ "[&_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",
1172
+ "[&_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",
1173
+ "[&_td_code]:bg-transparent [&_td_code]:p-0 [&_td_code]:text-foreground [&_td:first-child]:text-foreground",
1174
+ "[&_[align=center]]:text-center [&_[align=right]]:text-right",
1175
+ // On a phone a cell keeps a readable width; the table scrolls instead of crushing it.
1176
+ "max-sm:[&_td]:min-w-[9rem]",
1177
+ className
1178
+ ),
1179
+ ...props
1180
+ }
1181
+ ) }) });
1182
+ }
1183
+ function ApiTable({
1184
+ rows,
1185
+ caption,
1186
+ nameHeader = "Name",
1187
+ className
1188
+ }) {
1189
+ const hasDefault = rows.some((r) => r.default !== void 0);
1190
+ const marks = (r) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1191
+ r.required ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[0.75rem] text-oca-accent-ink", children: "Required" }) : null,
1192
+ r.deprecated ? /* @__PURE__ */ jsxRuntime.jsx(Badge, { tone: "muted", children: "Deprecated" }) : null,
1193
+ r.status ? /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: r.status }) : null
1194
+ ] });
1195
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("not-prose my-6", className), children: [
1196
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-2xl border border-border bg-card max-sm:hidden", children: /* @__PURE__ */ jsxRuntime.jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full border-collapse text-left text-[0.875rem]", children: [
1197
+ caption ? /* @__PURE__ */ jsxRuntime.jsx("caption", { className: "sr-only", children: caption }) : null,
1198
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-b border-oca-hairline-strong bg-oca-table-head text-[0.8125rem]", children: [
1199
+ /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: nameHeader }),
1200
+ /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Type" }),
1201
+ hasDefault ? /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Default" }) : null,
1202
+ /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Description" })
1203
+ ] }) }),
1204
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-border", children: rows.map((r) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "align-top", children: [
1205
+ /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "row", className: "px-4 py-3 text-left font-normal", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col items-start gap-1", children: [
1206
+ /* @__PURE__ */ jsxRuntime.jsx("code", { className: cn("font-mono text-[0.8125rem] text-foreground", r.deprecated && "line-through decoration-oca-subtle"), children: r.name }),
1207
+ marks(r)
1208
+ ] }) }),
1209
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 font-mono text-[0.8125rem] text-muted-foreground", children: r.type ?? "\u2014" }),
1210
+ hasDefault ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 font-mono text-[0.8125rem] text-muted-foreground", children: r.default ?? "\u2014" }) : null,
1211
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 leading-relaxed text-muted-foreground", children: r.description })
1212
+ ] }, r.name)) })
1213
+ ] }) }) }),
1214
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { "aria-label": caption, className: "divide-y divide-border rounded-2xl border border-border bg-card sm:hidden", children: rows.map((r) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex flex-col gap-1.5 px-4 py-3.5", children: [
1215
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
1216
+ /* @__PURE__ */ jsxRuntime.jsx("code", { className: cn("font-mono text-[0.875rem] text-foreground", r.deprecated && "line-through decoration-oca-subtle"), children: r.name }),
1217
+ r.type ? /* @__PURE__ */ jsxRuntime.jsx("code", { className: "break-all font-mono text-[0.8125rem] text-muted-foreground", children: r.type }) : null
1218
+ ] }),
1219
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex flex-wrap items-center gap-2 empty:hidden", children: marks(r) }),
1220
+ r.description ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[0.875rem] leading-relaxed text-muted-foreground", children: r.description }) : null,
1221
+ r.default !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[0.8125rem] text-muted-foreground", children: [
1222
+ "Default ",
1223
+ /* @__PURE__ */ jsxRuntime.jsx("code", { className: "font-mono text-foreground", children: r.default })
1224
+ ] }) : null
1225
+ ] }, r.name)) })
1226
+ ] });
1227
+ }
1228
+ function useDarkMode() {
1229
+ const [dark, setDark] = react.useState(false);
1230
+ react.useEffect(() => {
1231
+ const root = document.documentElement;
1232
+ const read = () => setDark(root.classList.contains("dark"));
1233
+ read();
1234
+ const mo = new MutationObserver(read);
1235
+ mo.observe(root, { attributes: true, attributeFilter: ["class"] });
1236
+ return () => mo.disconnect();
1237
+ }, []);
1238
+ return dark;
1239
+ }
1240
+ function mermaidTheme(el) {
1241
+ const css = getComputedStyle(el);
1242
+ const v = (name) => css.getPropertyValue(name).trim();
1243
+ const card = v("--card");
1244
+ const muted = v("--muted");
1245
+ const text = v("--foreground");
1246
+ const subtle = v("--muted-foreground");
1247
+ const line = v("--input");
1248
+ const hair = v("--oca-hairline-strong");
1249
+ return {
1250
+ background: "transparent",
1251
+ fontFamily: css.fontFamily,
1252
+ fontSize: "14px",
1253
+ textColor: text,
1254
+ mainBkg: card,
1255
+ primaryColor: card,
1256
+ primaryTextColor: text,
1257
+ primaryBorderColor: hair,
1258
+ secondaryColor: muted,
1259
+ secondaryTextColor: text,
1260
+ secondaryBorderColor: hair,
1261
+ tertiaryColor: muted,
1262
+ tertiaryTextColor: text,
1263
+ tertiaryBorderColor: hair,
1264
+ nodeBorder: hair,
1265
+ lineColor: line,
1266
+ edgeLabelBackground: card,
1267
+ clusterBkg: muted,
1268
+ clusterBorder: hair,
1269
+ titleColor: text,
1270
+ noteBkgColor: muted,
1271
+ noteTextColor: text,
1272
+ noteBorderColor: hair,
1273
+ actorBkg: card,
1274
+ actorBorder: hair,
1275
+ actorTextColor: text,
1276
+ actorLineColor: line,
1277
+ signalColor: text,
1278
+ signalTextColor: text,
1279
+ labelBoxBkgColor: card,
1280
+ labelBoxBorderColor: hair,
1281
+ labelTextColor: text,
1282
+ loopTextColor: subtle,
1283
+ activationBkgColor: muted,
1284
+ activationBorderColor: hair,
1285
+ sequenceNumberColor: card
1286
+ };
1287
+ }
1288
+ function naturalSize(svg) {
1289
+ const w = svg.match(/viewBox="[\d.-]+ [\d.-]+ ([\d.]+) [\d.]+"/)?.[1];
1290
+ if (!w) return svg;
1291
+ return svg.replace(/<svg([^>]*?)\swidth="100%"/, `<svg$1 width="${Math.ceil(Number(w))}"`).replace(/max-width:\s*[\d.]+px;?/, "");
1292
+ }
1293
+ function Diagram({ chart, caption, load, className }) {
1294
+ const ref = react.useRef(null);
1295
+ const dark = useDarkMode();
1296
+ const raw = react.useId();
1297
+ const [svg, setSvg] = react.useState(null);
1298
+ const [failed, setFailed] = react.useState(false);
1299
+ react.useEffect(() => {
1300
+ let live = true;
1301
+ const el = ref.current;
1302
+ if (!el) return;
1303
+ (async () => {
1304
+ try {
1305
+ const mod = await load();
1306
+ const mermaid = "default" in mod ? mod.default : mod;
1307
+ mermaid.initialize({ startOnLoad: false, securityLevel: "strict", theme: "base", themeVariables: mermaidTheme(el) });
1308
+ const { svg: drawn } = await mermaid.render(`oca-diagram-${raw.replace(/[^a-zA-Z0-9]/g, "")}-${dark ? "d" : "l"}`, chart);
1309
+ if (live) {
1310
+ setSvg(naturalSize(drawn));
1311
+ setFailed(false);
1312
+ }
1313
+ } catch {
1314
+ if (live) setFailed(true);
1315
+ }
1316
+ })();
1317
+ return () => {
1318
+ live = false;
1319
+ };
1320
+ }, [chart, dark, load, raw]);
1321
+ if (failed) return /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { code: chart, caption: "Diagram (shown as its source)", className: cn("my-6", className) });
1322
+ return /* @__PURE__ */ jsxRuntime.jsxs("figure", { ref, className: cn("not-prose my-6 overflow-hidden rounded-[1.25rem] border border-border bg-card", className), children: [
1323
+ svg ? /* @__PURE__ */ jsxRuntime.jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxRuntime.jsx(
1324
+ "div",
1325
+ {
1326
+ className: "flex w-max min-w-full justify-center p-6 [&_svg]:h-auto [&_svg]:max-w-none",
1327
+ role: "img",
1328
+ "aria-label": typeof caption === "string" ? caption : "Diagram",
1329
+ dangerouslySetInnerHTML: { __html: svg }
1330
+ }
1331
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { role: "status", "aria-label": "Drawing the diagram", className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-40 w-full rounded-xl" }) }),
1332
+ caption ? /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "border-t border-border px-5 py-3 text-[0.8125rem] text-muted-foreground", children: caption }) : null
1333
+ ] });
1334
+ }
1335
+ var HEADING = {
1336
+ h1: "oca-display-3 mb-4 text-foreground",
1337
+ h2: "mb-3 mt-12 text-[1.375rem] font-medium leading-tight tracking-[-0.015em] text-foreground md:text-[1.5rem]",
1338
+ h3: "mb-2 mt-9 text-[1.125rem] font-medium leading-snug tracking-[-0.01em] text-foreground",
1339
+ h4: "mb-2 mt-7 text-[1rem] font-medium leading-snug text-foreground"
1340
+ };
1341
+ function DocsHeading({
1342
+ as: Tag,
1343
+ id,
1344
+ children,
1345
+ className,
1346
+ ...props
1347
+ }) {
1348
+ return /* @__PURE__ */ jsxRuntime.jsxs(Tag, { id, className: cn("group scroll-mt-28", HEADING[Tag], className), ...props, children: [
1349
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-heading-text": "", children }),
1350
+ id && Tag !== "h1" ? /* @__PURE__ */ jsxRuntime.jsxs(
1351
+ "a",
1352
+ {
1353
+ href: `#${id}`,
1354
+ 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",
1355
+ children: [
1356
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, children: "#" }),
1357
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Link to this section" })
1358
+ ]
1359
+ }
1360
+ ) : null
1361
+ ] });
1362
+ }
1363
+ function codeText(node) {
1364
+ if (typeof node === "string") return node;
1365
+ if (typeof node === "number") return String(node);
1366
+ if (Array.isArray(node)) return node.map(codeText).join("");
1367
+ if (react.isValidElement(node)) return codeText(node.props.children);
1368
+ return "";
1369
+ }
1370
+ function codeLang(node) {
1371
+ const child = react.Children.toArray(node)[0];
1372
+ if (!react.isValidElement(child)) return void 0;
1373
+ const cls = child.props.className ?? "";
1374
+ return cls.match(/language-([\w+-]+)/)?.[1];
1375
+ }
1376
+
1377
+ // src/family/index.ts
1378
+ var OCHK_IO = "https://ochk.io";
1379
+ var DOCS_HREF = `${OCHK_IO}/docs`;
1380
+ function protocol(slug, verb, line, kinds) {
1381
+ return {
1382
+ slug,
1383
+ label: slug,
1384
+ href: `${OCHK_IO}/${slug}`,
1385
+ group: "protocol",
1386
+ line,
1387
+ status: "live",
1388
+ verb,
1389
+ pageHref: `${OCHK_IO}/${slug}`,
1390
+ toolHref: `https://${slug}.ochk.io`,
1391
+ specHref: `https://github.com/orangecheck/oc-${slug}-protocol`,
1392
+ kinds
1393
+ };
1394
+ }
1395
+ var PROTOCOLS = [
1396
+ protocol("attest", "identity", "Show that an address holds bitcoin, and for how long.", "30078"),
1397
+ protocol("lock", "confidentiality", "Encrypt to a Bitcoin address, so only its holder can open it.", "30078"),
1398
+ protocol("vote", "legitimacy", "Polls weighed in sats, that anyone can tally.", "30080\u201330082"),
1399
+ protocol("stamp", "provenance", "Prove who signed something, and when.", "30083"),
1400
+ protocol("agent", "authority", "Give software scoped, revocable permission to act for you.", "30083\u201330086"),
1401
+ protocol("pledge", "commitment", "Make a promise with bitcoin behind it, on a public record.", "30078")
1402
+ ];
1403
+ var PROTOCOL_ORDER = PROTOCOLS.map((p) => p.slug);
1404
+ var FAMILY = [
1405
+ {
1406
+ slug: "home",
1407
+ label: "ochk.io",
1408
+ href: OCHK_IO,
1409
+ group: "orangecheck",
1410
+ line: "The open protocols, and the company behind them.",
1411
+ status: "live"
1412
+ },
1413
+ {
1414
+ slug: "me",
1415
+ label: "ochk.app",
1416
+ href: "https://ochk.app",
1417
+ group: "orangecheck",
1418
+ line: "One account, with Bitcoin behind it.",
1419
+ status: "testing"
1420
+ },
1421
+ {
1422
+ slug: "docs",
1423
+ label: "docs",
1424
+ href: DOCS_HREF,
1425
+ group: "orangecheck",
1426
+ line: "Specs, SDKs and guides for every protocol.",
1427
+ status: "live"
1428
+ },
1429
+ ...PROTOCOLS,
1430
+ {
1431
+ slug: "vault",
1432
+ label: "vault",
1433
+ href: "https://vault.ochk.io",
1434
+ group: "app",
1435
+ line: "A password manager, encrypted in your browser.",
1436
+ status: "live",
1437
+ protocols: ["lock"]
1438
+ },
1439
+ {
1440
+ slug: "chat",
1441
+ label: "chat",
1442
+ href: "https://chat.ochk.io",
1443
+ group: "app",
1444
+ line: "Messages only the holder of a Bitcoin address can read.",
1445
+ status: "testing",
1446
+ protocols: ["lock"]
1447
+ },
1448
+ {
1449
+ slug: "cosign",
1450
+ label: "cosign",
1451
+ href: "https://cosign.ochk.io",
1452
+ group: "app",
1453
+ line: "Builders find co-founders and backers.",
1454
+ status: "testing",
1455
+ protocols: ["attest"]
1456
+ },
1457
+ {
1458
+ slug: "me-demo",
1459
+ // "demo", not the made-up app's own name, so nobody takes it for ours.
1460
+ label: "demo",
1461
+ href: "https://me-demo.ochk.io",
1462
+ group: "app",
1463
+ line: "Lumen Notes, a made-up app that signs in with orangecheck.",
1464
+ status: "live"
1465
+ },
1466
+ {
1467
+ slug: "globe",
1468
+ label: "globe",
1469
+ href: "https://globe.ochk.io",
1470
+ group: "public-good",
1471
+ line: "The Bitcoin network, live, on a globe.",
1472
+ status: "live"
1473
+ },
1474
+ {
1475
+ slug: "btc",
1476
+ label: "btc",
1477
+ href: "https://btc.ochk.io",
1478
+ group: "public-good",
1479
+ line: "A free desk for reading the Bitcoin market.",
1480
+ status: "live"
1481
+ }
1482
+ ];
1483
+ var BY_SLUG = new Map(FAMILY.map((s) => [s.slug, s]));
1484
+ function protocolSite(slug) {
1485
+ return BY_SLUG.get(slug);
1486
+ }
1487
+ [
1488
+ {
1489
+ href: `${OCHK_IO}/protocols`,
1490
+ label: "Protocols",
1491
+ children: PROTOCOLS.map((p) => ({ href: p.pageHref, label: p.label, description: p.line }))
1492
+ },
1493
+ { href: `${OCHK_IO}/apps`, label: "Apps" },
1494
+ { href: DOCS_HREF, label: "Docs" },
1495
+ { href: `${OCHK_IO}/trust`, label: "Trust" },
1496
+ { href: `${OCHK_IO}/about`, label: "About" }
1497
+ ];
1498
+ 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";
1499
+ var STRETCH = 'outline-none after:absolute after:inset-0 after:rounded-[1.25rem] after:content-[""]';
1500
+ var pad = (n) => String(n + 1).padStart(2, "0");
1501
+ function ProtocolGrid({
1502
+ protocols = PROTOCOL_ORDER,
1503
+ link = "page",
1504
+ className
1505
+ }) {
1506
+ return /* @__PURE__ */ jsxRuntime.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) => {
1507
+ const p = protocolSite(slug);
1508
+ const i = PROTOCOL_ORDER.indexOf(slug);
1509
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(CARD, "gap-4"), children: [
1510
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
1511
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "oca-numeral", children: [
1512
+ pad(i),
1513
+ " ",
1514
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-1.5 capitalize", children: p.verb })
1515
+ ] }),
1516
+ p.status !== "live" ? /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: p.status }) : null
1517
+ ] }),
1518
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "oca-display-3", children: /* @__PURE__ */ jsxRuntime.jsx(
1519
+ "a",
1520
+ {
1521
+ href: link === "tool" ? p.toolHref : link === "docs" ? `${DOCS_HREF}/${p.slug}` : p.pageHref,
1522
+ className: STRETCH,
1523
+ children: p.label
1524
+ }
1525
+ ) }),
1526
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "oca-body", children: p.line }),
1527
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-auto flex items-center justify-between gap-3 pt-2 text-[0.875rem] text-muted-foreground", children: [
1528
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "oca-tabular", children: [
1529
+ "Nostr kind ",
1530
+ p.kinds
1531
+ ] }),
1532
+ /* @__PURE__ */ jsxRuntime.jsx(
1533
+ lucideReact.ArrowUpRight,
1534
+ {
1535
+ "aria-hidden": true,
1536
+ className: "size-4 transition-transform duration-200 group-hover:-translate-y-0.5 group-hover:translate-x-0.5 group-hover:text-foreground"
1537
+ }
1538
+ )
1539
+ ] })
1540
+ ] }) }, slug);
1541
+ }) });
1542
+ }
1543
+ function SpecCard({
1544
+ protocol: protocol2,
1545
+ version,
1546
+ license,
1547
+ vectors,
1548
+ size = "md",
1549
+ className
1550
+ }) {
1551
+ const p = protocolSite(protocol2);
1552
+ const repo = `oc-${p.slug}-protocol`;
1553
+ const facts = [
1554
+ ["Version", version],
1555
+ ...license ? [["Licence", license]] : [],
1556
+ ["Nostr kind", p.kinds],
1557
+ ...vectors !== void 0 ? [["Test vectors", String(vectors)]] : []
1558
+ ];
1559
+ if (size === "sm") {
1560
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1561
+ "a",
1562
+ {
1563
+ href: p.specHref,
1564
+ className: cn(
1565
+ "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",
1566
+ className
1567
+ ),
1568
+ children: [
1569
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-[0.8125rem] text-foreground", children: repo }),
1570
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: facts.map(([k, v]) => k === "Version" ? `v${v}` : k === "Nostr kind" ? `kind ${v}` : v).join(" \xB7 ") }),
1571
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-auto flex items-center gap-1 text-muted-foreground group-hover:text-foreground", children: [
1572
+ "Read the spec ",
1573
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpRight, { "aria-hidden": true, className: "size-4" })
1574
+ ] })
1575
+ ]
1576
+ }
1577
+ );
1578
+ }
1579
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-6 rounded-[1.25rem] border border-border bg-card p-6 md:p-8", className), children: [
1580
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-4", children: [
1581
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col gap-1.5", children: [
1582
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[0.875rem] text-muted-foreground", children: "The spec" }),
1583
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "oca-title break-all font-mono text-[1.0625rem] tracking-normal", children: repo })
1584
+ ] }),
1585
+ p.status !== "live" ? /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: p.status }) : null
1586
+ ] }),
1587
+ /* @__PURE__ */ jsxRuntime.jsx("dl", { className: "grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-4", children: facts.map(([k, v]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
1588
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { className: "text-[0.8125rem] text-muted-foreground", children: k }),
1589
+ /* @__PURE__ */ jsxRuntime.jsx("dd", { className: "oca-tabular text-[1.0625rem]", children: v })
1590
+ ] }, k)) }),
1591
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(Button, { asChild: true, variant: "secondary", size: "sm", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: p.specHref, children: [
1592
+ "Read the spec ",
1593
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpRight, { "aria-hidden": true })
1594
+ ] }) }) })
1595
+ ] });
1596
+ }
1597
+ var LINK = "text-foreground underline decoration-foreground/35 underline-offset-4 transition-colors hover:decoration-foreground";
1598
+ function TextLink({
1599
+ href,
1600
+ children,
1601
+ external,
1602
+ className
1603
+ }) {
1604
+ const internal = href.startsWith("/") && !href.startsWith("/api/") && !href.startsWith("/.well-known/");
1605
+ const offsite = external ?? /^https?:\/\//.test(href);
1606
+ if (internal && !offsite) {
1607
+ return /* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href, className: cn(LINK, className), children });
1608
+ }
1609
+ return /* @__PURE__ */ jsxRuntime.jsxs("a", { href, className: cn(LINK, className), ...offsite ? { target: "_blank", rel: "noreferrer" } : {}, children: [
1610
+ children,
1611
+ offsite ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: " (opens in a new tab)" }) : null
1612
+ ] });
1613
+ }
1614
+ function createMdxComponents({ mermaid } = {}) {
1615
+ function Pre(props) {
1616
+ if (props["data-oca-code"] !== void 0) {
1617
+ return /* @__PURE__ */ jsxRuntime.jsx(
1618
+ CodeBlock,
1619
+ {
1620
+ html: props["data-html"] ?? "",
1621
+ lang: props["data-lang"],
1622
+ caption: props["data-title"],
1623
+ diff: props["data-diff"] !== void 0,
1624
+ lineNumbers: props["data-line-numbers"] !== void 0,
1625
+ className: "my-6"
1626
+ }
1627
+ );
1628
+ }
1629
+ const lang = codeLang(props.children);
1630
+ const code = codeText(props.children);
1631
+ if (lang === "mermaid" && mermaid) return /* @__PURE__ */ jsxRuntime.jsx(Diagram, { chart: code, load: mermaid });
1632
+ return /* @__PURE__ */ jsxRuntime.jsx(
1633
+ CodeBlock,
1634
+ {
1635
+ code,
1636
+ lang: lang === "mermaid" ? void 0 : lang,
1637
+ caption: lang === "mermaid" ? "Diagram source" : void 0,
1638
+ className: "my-6"
1639
+ }
1640
+ );
1641
+ }
1642
+ function A({ href, children, ...rest }) {
1643
+ if (!href || href.startsWith("#")) {
1644
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { href, ...rest, className: "text-foreground underline decoration-foreground/35 underline-offset-4 hover:decoration-foreground", children });
1645
+ }
1646
+ return /* @__PURE__ */ jsxRuntime.jsx(TextLink, { href, children });
1647
+ }
1648
+ const heading = (as) => function Heading(props) {
1649
+ return /* @__PURE__ */ jsxRuntime.jsx(DocsHeading, { as, ...props });
1650
+ };
1651
+ return {
1652
+ h1: heading("h1"),
1653
+ h2: heading("h2"),
1654
+ h3: heading("h3"),
1655
+ h4: heading("h4"),
1656
+ p: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("my-4 text-[1rem] leading-[1.75] text-muted-foreground md:text-[1.0625rem]", className), ...props }),
1657
+ a: A,
1658
+ strong: (props) => /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "font-medium text-foreground", ...props }),
1659
+ ul: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1660
+ "ul",
1661
+ {
1662
+ className: cn(
1663
+ "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]",
1664
+ className
1665
+ ),
1666
+ ...props
1667
+ }
1668
+ ),
1669
+ ol: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1670
+ "ol",
1671
+ {
1672
+ className: cn(
1673
+ "my-4 list-decimal space-y-1.5 pl-5 text-[1rem] leading-[1.7] text-muted-foreground marker:text-oca-subtle md:text-[1.0625rem]",
1674
+ className
1675
+ ),
1676
+ ...props
1677
+ }
1678
+ ),
1679
+ li: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: cn("pl-1 [&>p]:my-1 [&>ul]:my-1.5 [&>ol]:my-1.5", className), ...props }),
1680
+ blockquote: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(Callout, { children }),
1681
+ hr: () => /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "my-10 border-border" }),
1682
+ table: MdxTable,
1683
+ code: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1684
+ "code",
1685
+ {
1686
+ className: cn("break-words rounded-md bg-muted px-1.5 py-0.5 font-mono text-[0.875em] text-foreground", className),
1687
+ ...props
1688
+ }
1689
+ ),
1690
+ pre: Pre,
1691
+ img: ({ className, alt = "", ...props }) => /* @__PURE__ */ jsxRuntime.jsx("img", { alt, loading: "lazy", className: cn("my-6 h-auto max-w-full rounded-2xl border border-border", className), ...props }),
1692
+ Callout,
1693
+ Steps,
1694
+ Step,
1695
+ LinkCard,
1696
+ CardGrid,
1697
+ ApiTable,
1698
+ CodeBlock,
1699
+ CodeTabs,
1700
+ InstallTabs,
1701
+ SpecCard,
1702
+ ProtocolGrid,
1703
+ StatusBadge,
1704
+ ...mermaid ? { Diagram: (p) => /* @__PURE__ */ jsxRuntime.jsx(Diagram, { ...p, load: mermaid }) } : {}
1705
+ };
1706
+ }
1707
+ var mdxComponents = createMdxComponents();
1708
+
1709
+ exports.createMdxComponents = createMdxComponents;
1710
+ exports.mdxComponents = mdxComponents;
1711
+ //# sourceMappingURL=mdx.js.map
1712
+ //# sourceMappingURL=mdx.js.map