@showwhat/configurator 2.0.0 → 2.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.
package/dist/index.js CHANGED
@@ -62,23 +62,46 @@ function stripAutoIds(definitions) {
62
62
  // src/components/condition-builder/StringConditionEditor.tsx
63
63
  import { useCallback as useCallback2, useMemo } from "react";
64
64
 
65
- // src/components/condition-builder/ConditionRow.tsx
65
+ // src/components/condition-builder/ConditionBlockContext.tsx
66
+ import { createContext, useContext } from "react";
66
67
  import { jsx } from "react/jsx-runtime";
67
- function ConditionRow({ children }) {
68
- return /* @__PURE__ */ jsx(
69
- "div",
70
- {
71
- className: "grid flex-1 items-start gap-2",
72
- style: { gridTemplateColumns: "140px 72px 1fr" },
73
- children
74
- }
75
- );
68
+ var ConditionBlockContext = createContext(null);
69
+ function ConditionBlockProvider({
70
+ children,
71
+ ...chrome
72
+ }) {
73
+ return /* @__PURE__ */ jsx(ConditionBlockContext.Provider, { value: chrome, children });
74
+ }
75
+ function useConditionBlockChrome() {
76
+ return useContext(ConditionBlockContext);
77
+ }
78
+
79
+ // src/components/condition-builder/ConditionRow.tsx
80
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
81
+ function ConditionRow({ keySlot, children }) {
82
+ const chrome = useConditionBlockChrome();
83
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
84
+ chrome && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
85
+ chrome.typeBadge,
86
+ /* @__PURE__ */ jsx2("div", { className: "flex-1" }),
87
+ chrome.controls
88
+ ] }),
89
+ keySlot && /* @__PURE__ */ jsx2("div", { children: keySlot }),
90
+ /* @__PURE__ */ jsx2(
91
+ "div",
92
+ {
93
+ className: "grid items-start gap-2",
94
+ style: { gridTemplateColumns: "minmax(8rem, auto) 1fr" },
95
+ children
96
+ }
97
+ )
98
+ ] });
76
99
  }
77
100
 
78
101
  // src/components/ui/input.tsx
79
- import { jsx as jsx2 } from "react/jsx-runtime";
102
+ import { jsx as jsx3 } from "react/jsx-runtime";
80
103
  function Input({ className, type, ...props }) {
81
- return /* @__PURE__ */ jsx2(
104
+ return /* @__PURE__ */ jsx3(
82
105
  "input",
83
106
  {
84
107
  type,
@@ -95,9 +118,9 @@ function Input({ className, type, ...props }) {
95
118
  }
96
119
 
97
120
  // src/components/condition-builder/KeyInput.tsx
98
- import { jsx as jsx3 } from "react/jsx-runtime";
121
+ import { jsx as jsx4 } from "react/jsx-runtime";
99
122
  function KeyInput({ value, onChange, placeholder, disabled }) {
100
- return /* @__PURE__ */ jsx3(
123
+ return /* @__PURE__ */ jsx4(
101
124
  Input,
102
125
  {
103
126
  className: "h-8 font-mono text-sm",
@@ -112,16 +135,16 @@ function KeyInput({ value, onChange, placeholder, disabled }) {
112
135
 
113
136
  // src/components/ui/select.tsx
114
137
  import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
115
- import { Select as SelectPrimitive } from "radix-ui";
116
- import { jsx as jsx4, jsxs } from "react/jsx-runtime";
138
+ import { Select as SelectPrimitive } from "@base-ui/react/select";
139
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
117
140
  function Select({ ...props }) {
118
- return /* @__PURE__ */ jsx4(SelectPrimitive.Root, { "data-slot": "select", ...props });
141
+ return /* @__PURE__ */ jsx5(SelectPrimitive.Root, { "data-slot": "select", ...props });
119
142
  }
120
143
  function SelectGroup({ ...props }) {
121
- return /* @__PURE__ */ jsx4(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
144
+ return /* @__PURE__ */ jsx5(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
122
145
  }
123
146
  function SelectValue({ ...props }) {
124
- return /* @__PURE__ */ jsx4(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
147
+ return /* @__PURE__ */ jsx5(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
125
148
  }
126
149
  function SelectTrigger({
127
150
  className,
@@ -129,7 +152,7 @@ function SelectTrigger({
129
152
  children,
130
153
  ...props
131
154
  }) {
132
- return /* @__PURE__ */ jsxs(
155
+ return /* @__PURE__ */ jsxs2(
133
156
  SelectPrimitive.Trigger,
134
157
  {
135
158
  "data-slot": "select-trigger",
@@ -141,7 +164,7 @@ function SelectTrigger({
141
164
  ...props,
142
165
  children: [
143
166
  children,
144
- /* @__PURE__ */ jsx4(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx4(ChevronDownIcon, { className: "size-4 opacity-50" }) })
167
+ /* @__PURE__ */ jsx5(SelectPrimitive.Icon, { render: /* @__PURE__ */ jsx5(ChevronDownIcon, { className: "size-4 opacity-50" }) })
145
168
  ]
146
169
  }
147
170
  );
@@ -149,42 +172,31 @@ function SelectTrigger({
149
172
  function SelectContent({
150
173
  className,
151
174
  children,
152
- position = "item-aligned",
153
- align = "center",
154
175
  ...props
155
176
  }) {
156
- return /* @__PURE__ */ jsx4(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
157
- SelectPrimitive.Content,
177
+ return /* @__PURE__ */ jsx5(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx5(SelectPrimitive.Positioner, { "data-slot": "select-positioner", children: /* @__PURE__ */ jsxs2(
178
+ SelectPrimitive.Popup,
158
179
  {
159
180
  "data-slot": "select-content",
160
181
  className: cn(
161
- "relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
162
- position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
182
+ "relative z-50 max-h-96 min-w-[8rem] overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95 data-[open]:animate-in data-[open]:fade-in-0 data-[open]:zoom-in-95",
163
183
  className
164
184
  ),
165
- position,
166
- align,
167
185
  ...props,
168
186
  children: [
169
- /* @__PURE__ */ jsx4(SelectScrollUpButton, {}),
170
- /* @__PURE__ */ jsx4(
171
- SelectPrimitive.Viewport,
172
- {
173
- className: cn(
174
- "p-1",
175
- position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
176
- ),
177
- children
178
- }
179
- ),
180
- /* @__PURE__ */ jsx4(SelectScrollDownButton, {})
187
+ /* @__PURE__ */ jsx5(SelectScrollUpArrow, {}),
188
+ /* @__PURE__ */ jsx5(SelectPrimitive.List, { className: "p-1", children }),
189
+ /* @__PURE__ */ jsx5(SelectScrollDownArrow, {})
181
190
  ]
182
191
  }
183
- ) });
192
+ ) }) });
184
193
  }
185
- function SelectLabel({ className, ...props }) {
186
- return /* @__PURE__ */ jsx4(
187
- SelectPrimitive.Label,
194
+ function SelectLabel({
195
+ className,
196
+ ...props
197
+ }) {
198
+ return /* @__PURE__ */ jsx5(
199
+ SelectPrimitive.GroupLabel,
188
200
  {
189
201
  "data-slot": "select-label",
190
202
  className: cn("px-2 py-1.5 text-xs text-muted-foreground", className),
@@ -197,7 +209,7 @@ function SelectItem({
197
209
  children,
198
210
  ...props
199
211
  }) {
200
- return /* @__PURE__ */ jsxs(
212
+ return /* @__PURE__ */ jsxs2(
201
213
  SelectPrimitive.Item,
202
214
  {
203
215
  "data-slot": "select-item",
@@ -207,15 +219,15 @@ function SelectItem({
207
219
  ),
208
220
  ...props,
209
221
  children: [
210
- /* @__PURE__ */ jsx4(
222
+ /* @__PURE__ */ jsx5(
211
223
  "span",
212
224
  {
213
225
  "data-slot": "select-item-indicator",
214
226
  className: "absolute right-2 flex size-3.5 items-center justify-center",
215
- children: /* @__PURE__ */ jsx4(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx4(CheckIcon, { className: "size-4" }) })
227
+ children: /* @__PURE__ */ jsx5(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx5(CheckIcon, { className: "size-4" }) })
216
228
  }
217
229
  ),
218
- /* @__PURE__ */ jsx4(SelectPrimitive.ItemText, { children })
230
+ /* @__PURE__ */ jsx5(SelectPrimitive.ItemText, { children })
219
231
  ]
220
232
  }
221
233
  );
@@ -224,7 +236,7 @@ function SelectSeparator({
224
236
  className,
225
237
  ...props
226
238
  }) {
227
- return /* @__PURE__ */ jsx4(
239
+ return /* @__PURE__ */ jsx5(
228
240
  SelectPrimitive.Separator,
229
241
  {
230
242
  "data-slot": "select-separator",
@@ -233,50 +245,86 @@ function SelectSeparator({
233
245
  }
234
246
  );
235
247
  }
236
- function SelectScrollUpButton({
248
+ function SelectScrollUpArrow({
237
249
  className,
238
250
  ...props
239
251
  }) {
240
- return /* @__PURE__ */ jsx4(
241
- SelectPrimitive.ScrollUpButton,
252
+ return /* @__PURE__ */ jsx5(
253
+ SelectPrimitive.ScrollUpArrow,
242
254
  {
243
- "data-slot": "select-scroll-up-button",
255
+ "data-slot": "select-scroll-up-arrow",
244
256
  className: cn("flex cursor-default items-center justify-center py-1", className),
245
257
  ...props,
246
- children: /* @__PURE__ */ jsx4(ChevronUpIcon, { className: "size-4" })
258
+ children: /* @__PURE__ */ jsx5(ChevronUpIcon, { className: "size-4" })
247
259
  }
248
260
  );
249
261
  }
250
- function SelectScrollDownButton({
262
+ function SelectScrollDownArrow({
251
263
  className,
252
264
  ...props
253
265
  }) {
254
- return /* @__PURE__ */ jsx4(
255
- SelectPrimitive.ScrollDownButton,
266
+ return /* @__PURE__ */ jsx5(
267
+ SelectPrimitive.ScrollDownArrow,
256
268
  {
257
- "data-slot": "select-scroll-down-button",
269
+ "data-slot": "select-scroll-down-arrow",
258
270
  className: cn("flex cursor-default items-center justify-center py-1", className),
259
271
  ...props,
260
- children: /* @__PURE__ */ jsx4(ChevronDownIcon, { className: "size-4" })
272
+ children: /* @__PURE__ */ jsx5(ChevronDownIcon, { className: "size-4" })
261
273
  }
262
274
  );
263
275
  }
264
276
 
265
277
  // src/components/condition-builder/OperatorSelect.tsx
266
- import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
278
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
267
279
  function OperatorSelect({ value, onChange, options, disabled }) {
268
- return /* @__PURE__ */ jsxs2(Select, { value, onValueChange: onChange, disabled, children: [
269
- /* @__PURE__ */ jsx5(SelectTrigger, { className: "h-8 font-mono text-xs", disabled, children: /* @__PURE__ */ jsx5(SelectValue, {}) }),
270
- /* @__PURE__ */ jsx5(SelectContent, { children: options.map((opt) => /* @__PURE__ */ jsx5(SelectItem, { value: opt.value, children: opt.label }, opt.value)) })
280
+ const selected = options.find((o) => o.value === value);
281
+ return /* @__PURE__ */ jsxs3(Select, { value, onValueChange: (v) => onChange?.(v), disabled, children: [
282
+ /* @__PURE__ */ jsx6(SelectTrigger, { className: "h-8 w-full text-xs", disabled, children: /* @__PURE__ */ jsx6("span", { className: "truncate", children: selected?.label ?? value }) }),
283
+ /* @__PURE__ */ jsx6(SelectContent, { children: options.map((opt) => /* @__PURE__ */ jsxs3(SelectItem, { value: opt.value, children: [
284
+ /* @__PURE__ */ jsx6("span", { children: opt.label }),
285
+ opt.code && /* @__PURE__ */ jsxs3("span", { className: "ml-1.5 text-muted-foreground", children: [
286
+ "(",
287
+ opt.code,
288
+ ")"
289
+ ] })
290
+ ] }, opt.value)) })
271
291
  ] });
272
292
  }
273
293
 
294
+ // src/components/condition-builder/operator-labels.ts
295
+ var LABEL = {
296
+ eq: "equals",
297
+ neq: "not equals",
298
+ gt: "more than",
299
+ gte: "at least",
300
+ lt: "less than",
301
+ lte: "at most",
302
+ in: "one of",
303
+ nin: "not one of",
304
+ regex: "matches"
305
+ };
306
+ function op(code) {
307
+ return { value: code, label: LABEL[code] ?? code, code };
308
+ }
309
+ var STRING_OPS = [op("eq"), op("neq"), op("in"), op("nin"), op("regex")];
310
+ var NUMBER_OPS = [
311
+ op("eq"),
312
+ op("neq"),
313
+ op("gt"),
314
+ op("gte"),
315
+ op("lt"),
316
+ op("lte"),
317
+ op("in"),
318
+ op("nin")
319
+ ];
320
+ var DATETIME_OPS = [op("eq"), op("gt"), op("gte"), op("lt"), op("lte")];
321
+ var BOOL_OPS = [op("eq")];
322
+
274
323
  // src/components/condition-builder/TagInput.tsx
275
324
  import { useCallback, useState } from "react";
276
325
 
277
326
  // src/components/ui/badge.tsx
278
- import { Slot } from "radix-ui";
279
- import { jsx as jsx6 } from "react/jsx-runtime";
327
+ import { jsx as jsx7 } from "react/jsx-runtime";
280
328
  var badgeBase = "inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3";
281
329
  var badgeVariantStyles = {
282
330
  default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
@@ -292,12 +340,10 @@ function badgeVariants(opts) {
292
340
  function Badge({
293
341
  className,
294
342
  variant = "default",
295
- asChild = false,
296
343
  ...props
297
344
  }) {
298
- const Comp = asChild ? Slot.Root : "span";
299
- return /* @__PURE__ */ jsx6(
300
- Comp,
345
+ return /* @__PURE__ */ jsx7(
346
+ "span",
301
347
  {
302
348
  "data-slot": "badge",
303
349
  "data-variant": variant,
@@ -308,7 +354,7 @@ function Badge({
308
354
  }
309
355
 
310
356
  // src/components/condition-builder/TagInput.tsx
311
- import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
357
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
312
358
  function TagInput({ value, onChange, placeholder, disabled }) {
313
359
  const values = Array.isArray(value) ? value.filter(Boolean) : value ? [value] : [];
314
360
  const [text, setText] = useState("");
@@ -358,14 +404,14 @@ function TagInput({ value, onChange, placeholder, disabled }) {
358
404
  },
359
405
  [addValues]
360
406
  );
361
- return /* @__PURE__ */ jsxs3(
407
+ return /* @__PURE__ */ jsxs4(
362
408
  "div",
363
409
  {
364
410
  className: `border-input focus-within:border-ring focus-within:ring-ring/50 flex min-h-9 flex-1 flex-wrap items-center gap-1 rounded-md border px-2 py-1 focus-within:ring-[3px]${disabled ? " opacity-50" : ""}`,
365
411
  children: [
366
- values.map((v, i) => /* @__PURE__ */ jsxs3(Badge, { variant: "outline", className: "bg-muted gap-1 font-mono text-xs", children: [
412
+ values.map((v, i) => /* @__PURE__ */ jsxs4(Badge, { variant: "outline", className: "bg-muted gap-1 font-mono text-xs", children: [
367
413
  v,
368
- !disabled && /* @__PURE__ */ jsx7(
414
+ !disabled && /* @__PURE__ */ jsx8(
369
415
  "button",
370
416
  {
371
417
  type: "button",
@@ -376,7 +422,7 @@ function TagInput({ value, onChange, placeholder, disabled }) {
376
422
  }
377
423
  )
378
424
  ] }, `${v}-${i}`)),
379
- /* @__PURE__ */ jsx7(
425
+ /* @__PURE__ */ jsx8(
380
426
  "input",
381
427
  {
382
428
  className: "min-w-[80px] flex-1 bg-transparent py-0.5 font-mono text-sm outline-none placeholder:text-muted-foreground",
@@ -400,22 +446,18 @@ function buildAndCondition(conditions, id) {
400
446
  function buildOrCondition(conditions, id) {
401
447
  return id ? { id, type: "or", conditions } : { type: "or", conditions };
402
448
  }
449
+ function buildCheckAnnotationsCondition(conditions, id) {
450
+ return id ? { id, type: "checkAnnotations", conditions } : { type: "checkAnnotations", conditions };
451
+ }
403
452
  function buildCustomCondition(fields) {
404
453
  return fields;
405
454
  }
406
455
 
407
456
  // src/components/condition-builder/StringConditionEditor.tsx
408
- import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
409
- var OP_OPTIONS = [
410
- { value: "eq", label: "eq" },
411
- { value: "neq", label: "neq" },
412
- { value: "in", label: "in" },
413
- { value: "nin", label: "nin" },
414
- { value: "regex", label: "regex" }
415
- ];
457
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
416
458
  var meta = {
417
459
  type: "string",
418
- label: "String",
460
+ label: "string",
419
461
  description: "Match a context key against string value(s)",
420
462
  defaults: { type: "string", key: "", op: "eq", value: "" }
421
463
  };
@@ -436,51 +478,56 @@ function StringConditionEditor({ condition, onChange }) {
436
478
  },
437
479
  [rec, onChange]
438
480
  );
439
- const op = rec.op;
440
- const isArray = op === "in" || op === "nin";
441
- const isRegex = op === "regex";
442
- return /* @__PURE__ */ jsxs4(ConditionRow, { children: [
443
- /* @__PURE__ */ jsx8(
444
- KeyInput,
445
- {
446
- value: String(rec.key ?? ""),
447
- onChange: (v) => update("key", v),
448
- placeholder: "e.g. userId"
449
- }
450
- ),
451
- /* @__PURE__ */ jsx8(
452
- OperatorSelect,
453
- {
454
- value: String(rec.op ?? "eq"),
455
- onChange: handleOpChange,
456
- options: OP_OPTIONS
457
- }
458
- ),
459
- isArray ? /* @__PURE__ */ jsx8(
460
- TagInput,
461
- {
462
- value: rec.value ?? "",
463
- onChange: (v) => update("value", v),
464
- placeholder: "e.g. user-123"
465
- }
466
- ) : isRegex ? /* @__PURE__ */ jsx8(
467
- Input,
468
- {
469
- className: "h-8 font-mono text-sm",
470
- value: String(rec.value ?? ""),
471
- placeholder: "e.g. ^test.*$",
472
- onChange: (e) => update("value", e.target.value)
473
- }
474
- ) : /* @__PURE__ */ jsx8(
475
- Input,
476
- {
477
- className: "h-8 text-sm",
478
- value: String(rec.value ?? ""),
479
- placeholder: "e.g. user-123",
480
- onChange: (e) => update("value", e.target.value)
481
- }
482
- )
483
- ] });
481
+ const op2 = rec.op;
482
+ const isArray = op2 === "in" || op2 === "nin";
483
+ const isRegex = op2 === "regex";
484
+ return /* @__PURE__ */ jsxs5(
485
+ ConditionRow,
486
+ {
487
+ keySlot: /* @__PURE__ */ jsx9(
488
+ KeyInput,
489
+ {
490
+ value: String(rec.key ?? ""),
491
+ onChange: (v) => update("key", v),
492
+ placeholder: "e.g. userId"
493
+ }
494
+ ),
495
+ children: [
496
+ /* @__PURE__ */ jsx9(
497
+ OperatorSelect,
498
+ {
499
+ value: String(rec.op ?? "eq"),
500
+ onChange: handleOpChange,
501
+ options: STRING_OPS
502
+ }
503
+ ),
504
+ isArray ? /* @__PURE__ */ jsx9(
505
+ TagInput,
506
+ {
507
+ value: rec.value ?? "",
508
+ onChange: (v) => update("value", v),
509
+ placeholder: "e.g. user-123"
510
+ }
511
+ ) : isRegex ? /* @__PURE__ */ jsx9(
512
+ Input,
513
+ {
514
+ className: "h-8 font-mono text-sm",
515
+ value: String(rec.value ?? ""),
516
+ placeholder: "e.g. ^test.*$",
517
+ onChange: (e) => update("value", e.target.value)
518
+ }
519
+ ) : /* @__PURE__ */ jsx9(
520
+ Input,
521
+ {
522
+ className: "h-8 text-sm",
523
+ value: String(rec.value ?? ""),
524
+ placeholder: "e.g. user-123",
525
+ onChange: (e) => update("value", e.target.value)
526
+ }
527
+ )
528
+ ]
529
+ }
530
+ );
484
531
  }
485
532
 
486
533
  // src/components/condition-builder/NumberConditionEditor.tsx
@@ -488,7 +535,7 @@ import { useCallback as useCallback4, useMemo as useMemo2 } from "react";
488
535
 
489
536
  // src/components/condition-builder/NumberTagInput.tsx
490
537
  import { useCallback as useCallback3, useState as useState2 } from "react";
491
- import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
538
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
492
539
  function NumberTagInput({ value, onChange, placeholder, disabled }) {
493
540
  const values = Array.isArray(value) ? value : [value];
494
541
  const [text, setText] = useState2("");
@@ -538,14 +585,14 @@ function NumberTagInput({ value, onChange, placeholder, disabled }) {
538
585
  },
539
586
  [addValues]
540
587
  );
541
- return /* @__PURE__ */ jsxs5(
588
+ return /* @__PURE__ */ jsxs6(
542
589
  "div",
543
590
  {
544
591
  className: `border-input focus-within:border-ring focus-within:ring-ring/50 flex min-h-9 flex-1 flex-wrap items-center gap-1 rounded-md border px-2 py-1 focus-within:ring-[3px]${disabled ? " opacity-50" : ""}`,
545
592
  children: [
546
- values.map((v, i) => /* @__PURE__ */ jsxs5(Badge, { variant: "outline", className: "bg-muted gap-1 font-mono text-xs", children: [
593
+ values.map((v, i) => /* @__PURE__ */ jsxs6(Badge, { variant: "outline", className: "bg-muted gap-1 font-mono text-xs", children: [
547
594
  v,
548
- !disabled && /* @__PURE__ */ jsx9(
595
+ !disabled && /* @__PURE__ */ jsx10(
549
596
  "button",
550
597
  {
551
598
  type: "button",
@@ -556,7 +603,7 @@ function NumberTagInput({ value, onChange, placeholder, disabled }) {
556
603
  }
557
604
  )
558
605
  ] }, `${v}-${i}`)),
559
- /* @__PURE__ */ jsx9(
606
+ /* @__PURE__ */ jsx10(
560
607
  "input",
561
608
  {
562
609
  className: "min-w-[80px] flex-1 bg-transparent py-0.5 font-mono text-sm outline-none placeholder:text-muted-foreground",
@@ -575,20 +622,10 @@ function NumberTagInput({ value, onChange, placeholder, disabled }) {
575
622
  }
576
623
 
577
624
  // src/components/condition-builder/NumberConditionEditor.tsx
578
- import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
579
- var OP_OPTIONS2 = [
580
- { value: "eq", label: "eq" },
581
- { value: "neq", label: "neq" },
582
- { value: "gt", label: "gt" },
583
- { value: "gte", label: "gte" },
584
- { value: "lt", label: "lt" },
585
- { value: "lte", label: "lte" },
586
- { value: "in", label: "in" },
587
- { value: "nin", label: "nin" }
588
- ];
625
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
589
626
  var meta2 = {
590
627
  type: "number",
591
- label: "Number",
628
+ label: "number",
592
629
  description: "Compare a context key against a number or list of numbers",
593
630
  defaults: { type: "number", key: "", op: "eq", value: 0 }
594
631
  };
@@ -609,43 +646,48 @@ function NumberConditionEditor({ condition, onChange }) {
609
646
  },
610
647
  [rec, onChange]
611
648
  );
612
- const op = rec.op;
613
- const isArray = op === "in" || op === "nin";
614
- return /* @__PURE__ */ jsxs6(ConditionRow, { children: [
615
- /* @__PURE__ */ jsx10(
616
- KeyInput,
617
- {
618
- value: String(rec.key ?? ""),
619
- onChange: (v) => update("key", v),
620
- placeholder: "e.g. score"
621
- }
622
- ),
623
- /* @__PURE__ */ jsx10(
624
- OperatorSelect,
625
- {
626
- value: String(rec.op ?? "eq"),
627
- onChange: handleOpChange,
628
- options: OP_OPTIONS2
629
- }
630
- ),
631
- isArray ? /* @__PURE__ */ jsx10(
632
- NumberTagInput,
633
- {
634
- value: rec.value ?? [],
635
- onChange: (v) => update("value", v),
636
- placeholder: "e.g. 200"
637
- }
638
- ) : /* @__PURE__ */ jsx10(
639
- Input,
640
- {
641
- type: "number",
642
- className: "h-8 font-mono text-sm",
643
- value: rec.value !== void 0 ? String(rec.value) : "",
644
- placeholder: "e.g. 100",
645
- onChange: (e) => update("value", e.target.value === "" ? "" : Number(e.target.value))
646
- }
647
- )
648
- ] });
649
+ const op2 = rec.op;
650
+ const isArray = op2 === "in" || op2 === "nin";
651
+ return /* @__PURE__ */ jsxs7(
652
+ ConditionRow,
653
+ {
654
+ keySlot: /* @__PURE__ */ jsx11(
655
+ KeyInput,
656
+ {
657
+ value: String(rec.key ?? ""),
658
+ onChange: (v) => update("key", v),
659
+ placeholder: "e.g. score"
660
+ }
661
+ ),
662
+ children: [
663
+ /* @__PURE__ */ jsx11(
664
+ OperatorSelect,
665
+ {
666
+ value: String(rec.op ?? "eq"),
667
+ onChange: handleOpChange,
668
+ options: NUMBER_OPS
669
+ }
670
+ ),
671
+ isArray ? /* @__PURE__ */ jsx11(
672
+ NumberTagInput,
673
+ {
674
+ value: rec.value ?? [],
675
+ onChange: (v) => update("value", v),
676
+ placeholder: "e.g. 200"
677
+ }
678
+ ) : /* @__PURE__ */ jsx11(
679
+ Input,
680
+ {
681
+ type: "number",
682
+ className: "h-8 font-mono text-sm",
683
+ value: rec.value !== void 0 ? String(rec.value) : "",
684
+ placeholder: "e.g. 100",
685
+ onChange: (e) => update("value", e.target.value === "" ? "" : Number(e.target.value))
686
+ }
687
+ )
688
+ ]
689
+ }
690
+ );
649
691
  }
650
692
 
651
693
  // src/components/condition-builder/DatetimeConditionEditor.tsx
@@ -654,7 +696,7 @@ import { useCallback as useCallback5, useMemo as useMemo3 } from "react";
654
696
  // src/components/common/DateTimeInput.tsx
655
697
  import { useRef, useState as useState3 } from "react";
656
698
  import { Calendar, Code } from "lucide-react";
657
- import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
699
+ import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
658
700
  function toLocalDatetime(iso) {
659
701
  if (!iso) return "";
660
702
  const d = new Date(iso);
@@ -672,15 +714,15 @@ function fromLocalDatetime(local) {
672
714
  }
673
715
  function DateTimeInput({ value, onChange, disabled }) {
674
716
  const [rawValue, setRawValue] = useState3(value);
675
- const [showRaw, setShowRaw] = useState3(false);
717
+ const [showRaw, setShowRaw] = useState3(true);
676
718
  const prevValueRef = useRef(value);
677
719
  if (prevValueRef.current !== value) {
678
720
  prevValueRef.current = value;
679
721
  setRawValue(value);
680
722
  }
681
723
  if (showRaw) {
682
- return /* @__PURE__ */ jsxs7("div", { className: "flex gap-1", children: [
683
- /* @__PURE__ */ jsx11(
724
+ return /* @__PURE__ */ jsxs8("div", { className: "flex gap-1", children: [
725
+ /* @__PURE__ */ jsx12(
684
726
  Input,
685
727
  {
686
728
  className: "h-8 flex-1 font-mono text-xs",
@@ -693,20 +735,20 @@ function DateTimeInput({ value, onChange, disabled }) {
693
735
  disabled
694
736
  }
695
737
  ),
696
- /* @__PURE__ */ jsx11(
738
+ /* @__PURE__ */ jsx12(
697
739
  "button",
698
740
  {
699
741
  type: "button",
700
742
  className: "flex items-center justify-center w-8 h-8 text-muted-foreground hover:text-foreground",
701
743
  "aria-label": "Switch to date picker",
702
744
  onClick: () => setShowRaw(false),
703
- children: /* @__PURE__ */ jsx11(Calendar, { className: "h-3.5 w-3.5" })
745
+ children: /* @__PURE__ */ jsx12(Calendar, { className: "h-3.5 w-3.5" })
704
746
  }
705
747
  )
706
748
  ] });
707
749
  }
708
- return /* @__PURE__ */ jsxs7("div", { className: "flex gap-1", children: [
709
- /* @__PURE__ */ jsx11(
750
+ return /* @__PURE__ */ jsxs8("div", { className: "flex gap-1", children: [
751
+ /* @__PURE__ */ jsx12(
710
752
  Input,
711
753
  {
712
754
  className: "h-8 flex-1 text-xs",
@@ -716,7 +758,7 @@ function DateTimeInput({ value, onChange, disabled }) {
716
758
  disabled
717
759
  }
718
760
  ),
719
- /* @__PURE__ */ jsx11(
761
+ /* @__PURE__ */ jsx12(
720
762
  "button",
721
763
  {
722
764
  type: "button",
@@ -726,24 +768,17 @@ function DateTimeInput({ value, onChange, disabled }) {
726
768
  setRawValue(value);
727
769
  setShowRaw(true);
728
770
  },
729
- children: /* @__PURE__ */ jsx11(Code, { className: "h-3.5 w-3.5" })
771
+ children: /* @__PURE__ */ jsx12(Code, { className: "h-3.5 w-3.5" })
730
772
  }
731
773
  )
732
774
  ] });
733
775
  }
734
776
 
735
777
  // src/components/condition-builder/DatetimeConditionEditor.tsx
736
- import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
737
- var OP_OPTIONS3 = [
738
- { value: "eq", label: "eq" },
739
- { value: "gt", label: "gt" },
740
- { value: "gte", label: "gte" },
741
- { value: "lt", label: "lt" },
742
- { value: "lte", label: "lte" }
743
- ];
778
+ import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
744
779
  var meta3 = {
745
780
  type: "datetime",
746
- label: "Datetime",
781
+ label: "datetime",
747
782
  description: "Compare a context key against a date/time",
748
783
  defaults: { type: "datetime", key: "", op: "eq", value: (/* @__PURE__ */ new Date()).toISOString() }
749
784
  };
@@ -755,34 +790,38 @@ function DatetimeConditionEditor({ condition, onChange }) {
755
790
  },
756
791
  [rec, onChange]
757
792
  );
758
- return /* @__PURE__ */ jsxs8(ConditionRow, { children: [
759
- /* @__PURE__ */ jsx12(
760
- KeyInput,
761
- {
762
- value: String(rec.key ?? ""),
763
- onChange: (v) => update("key", v),
764
- placeholder: "e.g. at"
765
- }
766
- ),
767
- /* @__PURE__ */ jsx12(
768
- OperatorSelect,
769
- {
770
- value: String(rec.op ?? "eq"),
771
- onChange: (v) => update("op", v),
772
- options: OP_OPTIONS3
773
- }
774
- ),
775
- /* @__PURE__ */ jsx12(DateTimeInput, { value: String(rec.value ?? ""), onChange: (v) => update("value", v) })
776
- ] });
793
+ return /* @__PURE__ */ jsxs9(
794
+ ConditionRow,
795
+ {
796
+ keySlot: /* @__PURE__ */ jsx13(
797
+ KeyInput,
798
+ {
799
+ value: String(rec.key ?? ""),
800
+ onChange: (v) => update("key", v),
801
+ placeholder: "e.g. at"
802
+ }
803
+ ),
804
+ children: [
805
+ /* @__PURE__ */ jsx13(
806
+ OperatorSelect,
807
+ {
808
+ value: String(rec.op ?? "eq"),
809
+ onChange: (v) => update("op", v),
810
+ options: DATETIME_OPS
811
+ }
812
+ ),
813
+ /* @__PURE__ */ jsx13(DateTimeInput, { value: String(rec.value ?? ""), onChange: (v) => update("value", v) })
814
+ ]
815
+ }
816
+ );
777
817
  }
778
818
 
779
819
  // src/components/condition-builder/BoolConditionEditor.tsx
780
820
  import { useCallback as useCallback6, useMemo as useMemo4 } from "react";
781
- import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
782
- var OP_OPTIONS4 = [{ value: "eq", label: "eq" }];
821
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
783
822
  var meta4 = {
784
823
  type: "bool",
785
- label: "Boolean",
824
+ label: "bool",
786
825
  description: "Match a context key against a boolean",
787
826
  defaults: { type: "bool", key: "", value: true }
788
827
  };
@@ -794,40 +833,44 @@ function BoolConditionEditor({ condition, onChange }) {
794
833
  },
795
834
  [rec, onChange]
796
835
  );
797
- return /* @__PURE__ */ jsxs9(ConditionRow, { children: [
798
- /* @__PURE__ */ jsx13(
799
- KeyInput,
800
- {
801
- value: String(rec.key ?? ""),
802
- onChange: (v) => update("key", v),
803
- placeholder: "e.g. isAdmin"
804
- }
805
- ),
806
- /* @__PURE__ */ jsx13(OperatorSelect, { value: "eq", options: OP_OPTIONS4, disabled: true }),
807
- /* @__PURE__ */ jsxs9(
808
- Select,
809
- {
810
- value: String(rec.value ?? "true"),
811
- onValueChange: (v) => update("value", v === "true"),
812
- children: [
813
- /* @__PURE__ */ jsx13(SelectTrigger, { className: "h-8 text-sm", children: /* @__PURE__ */ jsx13(SelectValue, {}) }),
814
- /* @__PURE__ */ jsxs9(SelectContent, { children: [
815
- /* @__PURE__ */ jsx13(SelectItem, { value: "true", children: "true" }),
816
- /* @__PURE__ */ jsx13(SelectItem, { value: "false", children: "false" })
817
- ] })
818
- ]
819
- }
820
- )
821
- ] });
836
+ return /* @__PURE__ */ jsxs10(
837
+ ConditionRow,
838
+ {
839
+ keySlot: /* @__PURE__ */ jsx14(
840
+ KeyInput,
841
+ {
842
+ value: String(rec.key ?? ""),
843
+ onChange: (v) => update("key", v),
844
+ placeholder: "e.g. isAdmin"
845
+ }
846
+ ),
847
+ children: [
848
+ /* @__PURE__ */ jsx14(OperatorSelect, { value: "eq", options: BOOL_OPS, disabled: true }),
849
+ /* @__PURE__ */ jsxs10(
850
+ Select,
851
+ {
852
+ value: String(rec.value ?? "true"),
853
+ onValueChange: (v) => update("value", v === "true"),
854
+ children: [
855
+ /* @__PURE__ */ jsx14(SelectTrigger, { className: "h-8 text-sm", children: /* @__PURE__ */ jsx14(SelectValue, {}) }),
856
+ /* @__PURE__ */ jsxs10(SelectContent, { children: [
857
+ /* @__PURE__ */ jsx14(SelectItem, { value: "true", children: "true" }),
858
+ /* @__PURE__ */ jsx14(SelectItem, { value: "false", children: "false" })
859
+ ] })
860
+ ]
861
+ }
862
+ )
863
+ ]
864
+ }
865
+ );
822
866
  }
823
867
 
824
868
  // src/components/condition-builder/EnvConditionEditor.tsx
825
869
  import { useCallback as useCallback7, useMemo as useMemo5 } from "react";
826
- import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
827
- var OP_OPTIONS5 = [{ value: "eq", label: "eq" }];
870
+ import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
828
871
  var meta5 = {
829
872
  type: "env",
830
- label: "Environment",
873
+ label: "env",
831
874
  description: "Match the environment name",
832
875
  defaults: { type: "env", value: "" }
833
876
  };
@@ -839,10 +882,9 @@ function EnvConditionEditor({ condition, onChange }) {
839
882
  },
840
883
  [rec, onChange]
841
884
  );
842
- return /* @__PURE__ */ jsxs10(ConditionRow, { children: [
843
- /* @__PURE__ */ jsx14(KeyInput, { value: "env", disabled: true }),
844
- /* @__PURE__ */ jsx14(OperatorSelect, { value: "eq", options: OP_OPTIONS5, disabled: true }),
845
- /* @__PURE__ */ jsx14(
885
+ return /* @__PURE__ */ jsxs11(ConditionRow, { children: [
886
+ /* @__PURE__ */ jsx15(OperatorSelect, { value: "eq", options: BOOL_OPS, disabled: true }),
887
+ /* @__PURE__ */ jsx15(
846
888
  TagInput,
847
889
  {
848
890
  value: rec.value ?? "",
@@ -855,20 +897,19 @@ function EnvConditionEditor({ condition, onChange }) {
855
897
 
856
898
  // src/components/condition-builder/StartAtConditionEditor.tsx
857
899
  import { useMemo as useMemo6 } from "react";
858
- import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
859
- var OP_OPTIONS6 = [{ value: "gte", label: "gte" }];
900
+ import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
901
+ var STARTAT_OPS = DATETIME_OPS.filter((o) => o.value === "gte");
860
902
  var meta6 = {
861
903
  type: "startAt",
862
- label: "Start At",
904
+ label: "startAt",
863
905
  description: "Active after a specific date/time",
864
906
  defaults: { type: "startAt", value: (/* @__PURE__ */ new Date()).toISOString() }
865
907
  };
866
908
  function StartAtConditionEditor({ condition, onChange }) {
867
909
  const rec = useMemo6(() => condition, [condition]);
868
- return /* @__PURE__ */ jsxs11(ConditionRow, { children: [
869
- /* @__PURE__ */ jsx15(KeyInput, { value: "at", disabled: true }),
870
- /* @__PURE__ */ jsx15(OperatorSelect, { value: "gte", options: OP_OPTIONS6, disabled: true }),
871
- /* @__PURE__ */ jsx15(
910
+ return /* @__PURE__ */ jsxs12(ConditionRow, { children: [
911
+ /* @__PURE__ */ jsx16(OperatorSelect, { value: "gte", options: STARTAT_OPS, disabled: true }),
912
+ /* @__PURE__ */ jsx16(
872
913
  DateTimeInput,
873
914
  {
874
915
  value: String(rec.value ?? ""),
@@ -880,20 +921,19 @@ function StartAtConditionEditor({ condition, onChange }) {
880
921
 
881
922
  // src/components/condition-builder/EndAtConditionEditor.tsx
882
923
  import { useMemo as useMemo7 } from "react";
883
- import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
884
- var OP_OPTIONS7 = [{ value: "lt", label: "lt" }];
924
+ import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
925
+ var ENDAT_OPS = DATETIME_OPS.filter((o) => o.value === "lt");
885
926
  var meta7 = {
886
927
  type: "endAt",
887
- label: "End At",
928
+ label: "endAt",
888
929
  description: "Active before a specific date/time",
889
930
  defaults: { type: "endAt", value: (/* @__PURE__ */ new Date()).toISOString() }
890
931
  };
891
932
  function EndAtConditionEditor({ condition, onChange }) {
892
933
  const rec = useMemo7(() => condition, [condition]);
893
- return /* @__PURE__ */ jsxs12(ConditionRow, { children: [
894
- /* @__PURE__ */ jsx16(KeyInput, { value: "at", disabled: true }),
895
- /* @__PURE__ */ jsx16(OperatorSelect, { value: "lt", options: OP_OPTIONS7, disabled: true }),
896
- /* @__PURE__ */ jsx16(
934
+ return /* @__PURE__ */ jsxs13(ConditionRow, { children: [
935
+ /* @__PURE__ */ jsx17(OperatorSelect, { value: "lt", options: ENDAT_OPS, disabled: true }),
936
+ /* @__PURE__ */ jsx17(
897
937
  DateTimeInput,
898
938
  {
899
939
  value: String(rec.value ?? ""),
@@ -919,8 +959,7 @@ function getConditionMeta(type) {
919
959
  }
920
960
 
921
961
  // src/components/ui/button.tsx
922
- import { Slot as Slot2 } from "radix-ui";
923
- import { jsx as jsx17 } from "react/jsx-runtime";
962
+ import { jsx as jsx18 } from "react/jsx-runtime";
924
963
  var buttonBase = "inline-flex shrink-0 items-center justify-center gap-2 rounded text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 hover:cursor-pointer";
925
964
  var buttonVariantStyles = {
926
965
  default: "bg-primary text-primary-foreground hover:bg-primary/90",
@@ -952,13 +991,11 @@ function Button({
952
991
  className,
953
992
  variant = "default",
954
993
  size = "default",
955
- asChild = false,
956
994
  ref,
957
995
  ...props
958
996
  }) {
959
- const Comp = asChild ? Slot2.Root : "button";
960
- return /* @__PURE__ */ jsx17(
961
- Comp,
997
+ return /* @__PURE__ */ jsx18(
998
+ "button",
962
999
  {
963
1000
  ref,
964
1001
  "data-slot": "button",
@@ -971,19 +1008,17 @@ function Button({
971
1008
  }
972
1009
 
973
1010
  // src/components/ui/separator.tsx
974
- import { Separator as SeparatorPrimitive } from "radix-ui";
975
- import { jsx as jsx18 } from "react/jsx-runtime";
1011
+ import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
1012
+ import { jsx as jsx19 } from "react/jsx-runtime";
976
1013
  function Separator({
977
1014
  className,
978
1015
  orientation = "horizontal",
979
- decorative = true,
980
1016
  ...props
981
1017
  }) {
982
- return /* @__PURE__ */ jsx18(
983
- SeparatorPrimitive.Root,
1018
+ return /* @__PURE__ */ jsx19(
1019
+ SeparatorPrimitive,
984
1020
  {
985
1021
  "data-slot": "separator",
986
- decorative,
987
1022
  orientation,
988
1023
  className: cn(
989
1024
  "shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
@@ -995,30 +1030,30 @@ function Separator({
995
1030
  }
996
1031
 
997
1032
  // src/components/ui/scroll-area.tsx
998
- import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
999
- import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
1033
+ import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
1034
+ import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
1000
1035
  function ScrollArea({
1001
1036
  className,
1002
1037
  children,
1003
1038
  ...props
1004
1039
  }) {
1005
- return /* @__PURE__ */ jsxs13(
1040
+ return /* @__PURE__ */ jsxs14(
1006
1041
  ScrollAreaPrimitive.Root,
1007
1042
  {
1008
1043
  "data-slot": "scroll-area",
1009
1044
  className: cn("relative", className),
1010
1045
  ...props,
1011
1046
  children: [
1012
- /* @__PURE__ */ jsx19(
1047
+ /* @__PURE__ */ jsx20(
1013
1048
  ScrollAreaPrimitive.Viewport,
1014
1049
  {
1015
1050
  "data-slot": "scroll-area-viewport",
1016
1051
  className: "size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",
1017
- children
1052
+ children: /* @__PURE__ */ jsx20(ScrollAreaPrimitive.Content, { children })
1018
1053
  }
1019
1054
  ),
1020
- /* @__PURE__ */ jsx19(ScrollBar, {}),
1021
- /* @__PURE__ */ jsx19(ScrollAreaPrimitive.Corner, {})
1055
+ /* @__PURE__ */ jsx20(ScrollBar, {}),
1056
+ /* @__PURE__ */ jsx20(ScrollAreaPrimitive.Corner, {})
1022
1057
  ]
1023
1058
  }
1024
1059
  );
@@ -1028,8 +1063,8 @@ function ScrollBar({
1028
1063
  orientation = "vertical",
1029
1064
  ...props
1030
1065
  }) {
1031
- return /* @__PURE__ */ jsx19(
1032
- ScrollAreaPrimitive.ScrollAreaScrollbar,
1066
+ return /* @__PURE__ */ jsx20(
1067
+ ScrollAreaPrimitive.Scrollbar,
1033
1068
  {
1034
1069
  "data-slot": "scroll-area-scrollbar",
1035
1070
  orientation,
@@ -1040,8 +1075,8 @@ function ScrollBar({
1040
1075
  className
1041
1076
  ),
1042
1077
  ...props,
1043
- children: /* @__PURE__ */ jsx19(
1044
- ScrollAreaPrimitive.ScrollAreaThumb,
1078
+ children: /* @__PURE__ */ jsx20(
1079
+ ScrollAreaPrimitive.Thumb,
1045
1080
  {
1046
1081
  "data-slot": "scroll-area-thumb",
1047
1082
  className: "relative flex-1 rounded-full bg-border"
@@ -1053,30 +1088,30 @@ function ScrollBar({
1053
1088
 
1054
1089
  // src/components/ui/dialog.tsx
1055
1090
  import { XIcon } from "lucide-react";
1056
- import { Dialog as DialogPrimitive } from "radix-ui";
1057
- import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
1091
+ import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
1092
+ import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
1058
1093
  function Dialog({ ...props }) {
1059
- return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
1094
+ return /* @__PURE__ */ jsx21(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
1060
1095
  }
1061
1096
  function DialogTrigger({ ...props }) {
1062
- return /* @__PURE__ */ jsx20(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
1097
+ return /* @__PURE__ */ jsx21(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
1063
1098
  }
1064
1099
  function DialogPortal({ ...props }) {
1065
- return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
1100
+ return /* @__PURE__ */ jsx21(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
1066
1101
  }
1067
1102
  function DialogClose({ ...props }) {
1068
- return /* @__PURE__ */ jsx20(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
1103
+ return /* @__PURE__ */ jsx21(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
1069
1104
  }
1070
- function DialogOverlay({
1105
+ function DialogBackdrop({
1071
1106
  className,
1072
1107
  ...props
1073
1108
  }) {
1074
- return /* @__PURE__ */ jsx20(
1075
- DialogPrimitive.Overlay,
1109
+ return /* @__PURE__ */ jsx21(
1110
+ DialogPrimitive.Backdrop,
1076
1111
  {
1077
- "data-slot": "dialog-overlay",
1112
+ "data-slot": "dialog-backdrop",
1078
1113
  className: cn(
1079
- "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
1114
+ "fixed inset-0 z-50 bg-black/50 data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:animate-in data-[open]:fade-in-0",
1080
1115
  className
1081
1116
  ),
1082
1117
  ...props
@@ -1089,27 +1124,27 @@ function DialogContent({
1089
1124
  showCloseButton = true,
1090
1125
  ...props
1091
1126
  }) {
1092
- return /* @__PURE__ */ jsxs14(DialogPortal, { "data-slot": "dialog-portal", children: [
1093
- /* @__PURE__ */ jsx20(DialogOverlay, {}),
1094
- /* @__PURE__ */ jsxs14(
1095
- DialogPrimitive.Content,
1127
+ return /* @__PURE__ */ jsxs15(DialogPortal, { "data-slot": "dialog-portal", children: [
1128
+ /* @__PURE__ */ jsx21(DialogBackdrop, {}),
1129
+ /* @__PURE__ */ jsxs15(
1130
+ DialogPrimitive.Popup,
1096
1131
  {
1097
1132
  "data-slot": "dialog-content",
1098
1133
  className: cn(
1099
- "fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
1134
+ "fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95 data-[open]:animate-in data-[open]:fade-in-0 data-[open]:zoom-in-95 sm:max-w-lg",
1100
1135
  className
1101
1136
  ),
1102
1137
  ...props,
1103
1138
  children: [
1104
1139
  children,
1105
- showCloseButton && /* @__PURE__ */ jsxs14(
1140
+ showCloseButton && /* @__PURE__ */ jsxs15(
1106
1141
  DialogPrimitive.Close,
1107
1142
  {
1108
1143
  "data-slot": "dialog-close",
1109
- className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1144
+ className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[open]:bg-accent data-[open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1110
1145
  children: [
1111
- /* @__PURE__ */ jsx20(XIcon, {}),
1112
- /* @__PURE__ */ jsx20("span", { className: "sr-only", children: "Close" })
1146
+ /* @__PURE__ */ jsx21(XIcon, {}),
1147
+ /* @__PURE__ */ jsx21("span", { className: "sr-only", children: "Close" })
1113
1148
  ]
1114
1149
  }
1115
1150
  )
@@ -1119,7 +1154,7 @@ function DialogContent({
1119
1154
  ] });
1120
1155
  }
1121
1156
  function DialogHeader({ className, ...props }) {
1122
- return /* @__PURE__ */ jsx20(
1157
+ return /* @__PURE__ */ jsx21(
1123
1158
  "div",
1124
1159
  {
1125
1160
  "data-slot": "dialog-header",
@@ -1134,7 +1169,7 @@ function DialogFooter({
1134
1169
  children,
1135
1170
  ...props
1136
1171
  }) {
1137
- return /* @__PURE__ */ jsxs14(
1172
+ return /* @__PURE__ */ jsxs15(
1138
1173
  "div",
1139
1174
  {
1140
1175
  "data-slot": "dialog-footer",
@@ -1142,13 +1177,13 @@ function DialogFooter({
1142
1177
  ...props,
1143
1178
  children: [
1144
1179
  children,
1145
- showCloseButton && /* @__PURE__ */ jsx20(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx20(Button, { variant: "outline", children: "Close" }) })
1180
+ showCloseButton && /* @__PURE__ */ jsx21(DialogPrimitive.Close, { render: /* @__PURE__ */ jsx21(Button, { variant: "outline" }), children: "Close" })
1146
1181
  ]
1147
1182
  }
1148
1183
  );
1149
1184
  }
1150
1185
  function DialogTitle({ className, ...props }) {
1151
- return /* @__PURE__ */ jsx20(
1186
+ return /* @__PURE__ */ jsx21(
1152
1187
  DialogPrimitive.Title,
1153
1188
  {
1154
1189
  "data-slot": "dialog-title",
@@ -1161,7 +1196,7 @@ function DialogDescription({
1161
1196
  className,
1162
1197
  ...props
1163
1198
  }) {
1164
- return /* @__PURE__ */ jsx20(
1199
+ return /* @__PURE__ */ jsx21(
1165
1200
  DialogPrimitive.Description,
1166
1201
  {
1167
1202
  "data-slot": "dialog-description",
@@ -1171,46 +1206,44 @@ function DialogDescription({
1171
1206
  );
1172
1207
  }
1173
1208
 
1174
- // src/components/ui/dropdown-menu.tsx
1209
+ // src/components/ui/menu.tsx
1175
1210
  import { CheckIcon as CheckIcon2, ChevronRightIcon, CircleIcon } from "lucide-react";
1176
- import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
1177
- import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
1178
- function DropdownMenu({ ...props }) {
1179
- return /* @__PURE__ */ jsx21(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
1211
+ import { Menu as MenuPrimitive } from "@base-ui/react/menu";
1212
+ import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
1213
+ function Menu({ ...props }) {
1214
+ return /* @__PURE__ */ jsx22(MenuPrimitive.Root, { "data-slot": "menu", ...props });
1180
1215
  }
1181
- function DropdownMenuTrigger({
1182
- ...props
1183
- }) {
1184
- return /* @__PURE__ */ jsx21(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
1216
+ function MenuTrigger({ ...props }) {
1217
+ return /* @__PURE__ */ jsx22(MenuPrimitive.Trigger, { "data-slot": "menu-trigger", ...props });
1185
1218
  }
1186
- function DropdownMenuContent({
1219
+ function MenuContent({
1187
1220
  className,
1188
1221
  sideOffset = 4,
1222
+ align = "start",
1189
1223
  ...props
1190
1224
  }) {
1191
- return /* @__PURE__ */ jsx21(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx21(
1192
- DropdownMenuPrimitive.Content,
1225
+ return /* @__PURE__ */ jsx22(MenuPrimitive.Portal, { children: /* @__PURE__ */ jsx22(MenuPrimitive.Positioner, { "data-slot": "menu-positioner", sideOffset, align, children: /* @__PURE__ */ jsx22(
1226
+ MenuPrimitive.Popup,
1193
1227
  {
1194
- "data-slot": "dropdown-menu-content",
1195
- sideOffset,
1228
+ "data-slot": "menu-content",
1196
1229
  className: cn(
1197
- "z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
1230
+ "z-50 min-w-[8rem] overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95 data-[open]:animate-in data-[open]:fade-in-0 data-[open]:zoom-in-95",
1198
1231
  className
1199
1232
  ),
1200
1233
  ...props
1201
1234
  }
1202
- ) });
1235
+ ) }) });
1203
1236
  }
1204
- function DropdownMenuItem({
1237
+ function MenuItem({
1205
1238
  className,
1206
1239
  inset,
1207
1240
  variant = "default",
1208
1241
  ...props
1209
1242
  }) {
1210
- return /* @__PURE__ */ jsx21(
1211
- DropdownMenuPrimitive.Item,
1243
+ return /* @__PURE__ */ jsx22(
1244
+ MenuPrimitive.Item,
1212
1245
  {
1213
- "data-slot": "dropdown-menu-item",
1246
+ "data-slot": "menu-item",
1214
1247
  "data-inset": inset,
1215
1248
  "data-variant": variant,
1216
1249
  className: cn(
@@ -1221,14 +1254,14 @@ function DropdownMenuItem({
1221
1254
  }
1222
1255
  );
1223
1256
  }
1224
- function DropdownMenuSeparator({
1257
+ function MenuSeparator({
1225
1258
  className,
1226
1259
  ...props
1227
1260
  }) {
1228
- return /* @__PURE__ */ jsx21(
1229
- DropdownMenuPrimitive.Separator,
1261
+ return /* @__PURE__ */ jsx22(
1262
+ MenuPrimitive.Separator,
1230
1263
  {
1231
- "data-slot": "dropdown-menu-separator",
1264
+ "data-slot": "menu-separator",
1232
1265
  className: cn("-mx-1 my-1 h-px bg-border", className),
1233
1266
  ...props
1234
1267
  }
@@ -1236,11 +1269,10 @@ function DropdownMenuSeparator({
1236
1269
  }
1237
1270
 
1238
1271
  // src/components/ui/label.tsx
1239
- import { Label as LabelPrimitive } from "radix-ui";
1240
- import { jsx as jsx22 } from "react/jsx-runtime";
1272
+ import { jsx as jsx23 } from "react/jsx-runtime";
1241
1273
  function Label({ className, ...props }) {
1242
- return /* @__PURE__ */ jsx22(
1243
- LabelPrimitive.Root,
1274
+ return /* @__PURE__ */ jsx23(
1275
+ "label",
1244
1276
  {
1245
1277
  "data-slot": "label",
1246
1278
  className: cn(
@@ -1253,23 +1285,37 @@ function Label({ className, ...props }) {
1253
1285
  }
1254
1286
 
1255
1287
  // src/components/ui/switch.tsx
1256
- import { Switch as SwitchPrimitive } from "radix-ui";
1257
- import { jsx as jsx23 } from "react/jsx-runtime";
1258
- function Switch({ className, ...props }) {
1259
- return /* @__PURE__ */ jsx23(
1288
+ import { Switch as SwitchPrimitive } from "@base-ui/react/switch";
1289
+ import { jsx as jsx24 } from "react/jsx-runtime";
1290
+ function Switch({
1291
+ className,
1292
+ checked,
1293
+ defaultChecked,
1294
+ onCheckedChange,
1295
+ disabled,
1296
+ name,
1297
+ ...props
1298
+ }) {
1299
+ return /* @__PURE__ */ jsx24(
1260
1300
  SwitchPrimitive.Root,
1261
1301
  {
1262
1302
  "data-slot": "switch",
1303
+ checked,
1304
+ defaultChecked,
1305
+ onCheckedChange,
1306
+ disabled,
1307
+ name,
1308
+ nativeButton: false,
1263
1309
  className: cn(
1264
- "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
1310
+ "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:bg-primary data-[unchecked]:bg-input",
1265
1311
  className
1266
1312
  ),
1267
1313
  ...props,
1268
- children: /* @__PURE__ */ jsx23(
1314
+ children: /* @__PURE__ */ jsx24(
1269
1315
  SwitchPrimitive.Thumb,
1270
1316
  {
1271
1317
  className: cn(
1272
- "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
1318
+ "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[checked]:translate-x-4 data-[unchecked]:translate-x-0"
1273
1319
  )
1274
1320
  }
1275
1321
  )
@@ -1278,9 +1324,9 @@ function Switch({ className, ...props }) {
1278
1324
  }
1279
1325
 
1280
1326
  // src/components/ui/textarea.tsx
1281
- import { jsx as jsx24 } from "react/jsx-runtime";
1327
+ import { jsx as jsx25 } from "react/jsx-runtime";
1282
1328
  function Textarea({ className, ...props }) {
1283
- return /* @__PURE__ */ jsx24(
1329
+ return /* @__PURE__ */ jsx25(
1284
1330
  "textarea",
1285
1331
  {
1286
1332
  "data-slot": "textarea",
@@ -1294,13 +1340,13 @@ function Textarea({ className, ...props }) {
1294
1340
  }
1295
1341
 
1296
1342
  // src/components/ui/popover.tsx
1297
- import { Popover as PopoverPrimitive } from "radix-ui";
1298
- import { jsx as jsx25 } from "react/jsx-runtime";
1343
+ import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
1344
+ import { jsx as jsx26 } from "react/jsx-runtime";
1299
1345
  function Popover({ ...props }) {
1300
- return /* @__PURE__ */ jsx25(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
1346
+ return /* @__PURE__ */ jsx26(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
1301
1347
  }
1302
1348
  function PopoverTrigger({ ...props }) {
1303
- return /* @__PURE__ */ jsx25(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
1349
+ return /* @__PURE__ */ jsx26(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
1304
1350
  }
1305
1351
  function PopoverContent({
1306
1352
  className,
@@ -1308,29 +1354,35 @@ function PopoverContent({
1308
1354
  sideOffset = 4,
1309
1355
  ...props
1310
1356
  }) {
1311
- return /* @__PURE__ */ jsx25(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx25(
1312
- PopoverPrimitive.Content,
1357
+ return /* @__PURE__ */ jsx26(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx26(
1358
+ PopoverPrimitive.Positioner,
1313
1359
  {
1314
- "data-slot": "popover-content",
1360
+ "data-slot": "popover-positioner",
1315
1361
  align,
1316
1362
  sideOffset,
1317
- className: cn(
1318
- "z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
1319
- className
1320
- ),
1321
- ...props
1363
+ children: /* @__PURE__ */ jsx26(
1364
+ PopoverPrimitive.Popup,
1365
+ {
1366
+ "data-slot": "popover-content",
1367
+ className: cn(
1368
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95 data-[open]:animate-in data-[open]:fade-in-0 data-[open]:zoom-in-95",
1369
+ className
1370
+ ),
1371
+ ...props
1372
+ }
1373
+ )
1322
1374
  }
1323
1375
  ) });
1324
1376
  }
1325
1377
 
1326
1378
  // src/components/ui/tabs.tsx
1327
- import { Tabs as TabsPrimitive } from "radix-ui";
1328
- import { jsx as jsx26 } from "react/jsx-runtime";
1329
- function Tabs({ ...props }) {
1330
- return /* @__PURE__ */ jsx26(TabsPrimitive.Root, { "data-slot": "tabs", ...props });
1379
+ import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
1380
+ import { jsx as jsx27 } from "react/jsx-runtime";
1381
+ function Tabs({ className, ...props }) {
1382
+ return /* @__PURE__ */ jsx27(TabsPrimitive.Root, { "data-slot": "tabs", className, ...props });
1331
1383
  }
1332
1384
  function TabsList({ className, ...props }) {
1333
- return /* @__PURE__ */ jsx26(
1385
+ return /* @__PURE__ */ jsx27(
1334
1386
  TabsPrimitive.List,
1335
1387
  {
1336
1388
  "data-slot": "tabs-list",
@@ -1342,24 +1394,24 @@ function TabsList({ className, ...props }) {
1342
1394
  }
1343
1395
  );
1344
1396
  }
1345
- function TabsTrigger({ className, ...props }) {
1346
- return /* @__PURE__ */ jsx26(
1347
- TabsPrimitive.Trigger,
1397
+ function TabsTab({ className, ...props }) {
1398
+ return /* @__PURE__ */ jsx27(
1399
+ TabsPrimitive.Tab,
1348
1400
  {
1349
- "data-slot": "tabs-trigger",
1401
+ "data-slot": "tabs-tab",
1350
1402
  className: cn(
1351
- "inline-flex items-center justify-center gap-2 rounded-md px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm data-[orientation=vertical]:justify-start data-[orientation=vertical]:rounded-none data-[orientation=vertical]:border-l-2 data-[orientation=vertical]:border-l-transparent data-[orientation=vertical]:px-3 data-[orientation=vertical]:py-2.5 data-[orientation=vertical]:text-sm data-[orientation=vertical]:font-normal data-[orientation=vertical]:text-muted-foreground data-[orientation=vertical]:shadow-none data-[orientation=vertical]:hover:bg-muted data-[orientation=vertical]:data-[state=active]:border-l-primary data-[orientation=vertical]:data-[state=active]:bg-accent data-[orientation=vertical]:data-[state=active]:font-medium data-[orientation=vertical]:data-[state=active]:text-accent-foreground",
1403
+ "inline-flex items-center justify-center gap-2 rounded-md px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[selected]:bg-background data-[selected]:text-foreground data-[selected]:shadow-sm data-[orientation=vertical]:justify-start data-[orientation=vertical]:rounded-none data-[orientation=vertical]:border-l-2 data-[orientation=vertical]:border-l-transparent data-[orientation=vertical]:px-3 data-[orientation=vertical]:py-2.5 data-[orientation=vertical]:text-sm data-[orientation=vertical]:font-normal data-[orientation=vertical]:text-muted-foreground data-[orientation=vertical]:shadow-none data-[orientation=vertical]:hover:bg-muted data-[orientation=vertical]:data-[selected]:border-l-primary data-[orientation=vertical]:data-[selected]:bg-accent data-[orientation=vertical]:data-[selected]:font-medium data-[orientation=vertical]:data-[selected]:text-accent-foreground",
1352
1404
  className
1353
1405
  ),
1354
1406
  ...props
1355
1407
  }
1356
1408
  );
1357
1409
  }
1358
- function TabsContent({ className, ...props }) {
1359
- return /* @__PURE__ */ jsx26(
1360
- TabsPrimitive.Content,
1410
+ function TabsPanel({ className, ...props }) {
1411
+ return /* @__PURE__ */ jsx27(
1412
+ TabsPrimitive.Panel,
1361
1413
  {
1362
- "data-slot": "tabs-content",
1414
+ "data-slot": "tabs-panel",
1363
1415
  className: cn(
1364
1416
  "flex-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1365
1417
  className
@@ -1371,7 +1423,7 @@ function TabsContent({ className, ...props }) {
1371
1423
 
1372
1424
  // src/components/common/ValueInput.tsx
1373
1425
  import { useRef as useRef2, useState as useState4 } from "react";
1374
- import { Fragment, jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
1426
+ import { Fragment, jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
1375
1427
  function detectType(value) {
1376
1428
  if (typeof value === "boolean") return "boolean";
1377
1429
  if (typeof value === "number") return "number";
@@ -1443,18 +1495,18 @@ function ValueInput({ value, onChange, placeholder }) {
1443
1495
  setJsonError("Invalid JSON");
1444
1496
  }
1445
1497
  }
1446
- return /* @__PURE__ */ jsxs16("div", { className: "flex items-start gap-2", children: [
1447
- /* @__PURE__ */ jsxs16(Select, { value: type, onValueChange: handleTypeChange, children: [
1448
- /* @__PURE__ */ jsx27(SelectTrigger, { className: "h-9 w-[110px] shrink-0 text-sm", children: /* @__PURE__ */ jsx27(SelectValue, {}) }),
1449
- /* @__PURE__ */ jsxs16(SelectContent, { children: [
1450
- /* @__PURE__ */ jsx27(SelectItem, { value: "string", children: "String" }),
1451
- /* @__PURE__ */ jsx27(SelectItem, { value: "number", children: "Number" }),
1452
- /* @__PURE__ */ jsx27(SelectItem, { value: "boolean", children: "Boolean" }),
1453
- /* @__PURE__ */ jsx27(SelectItem, { value: "json", children: "JSON" })
1498
+ return /* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-2", children: [
1499
+ /* @__PURE__ */ jsxs17(Select, { value: type, onValueChange: (v) => handleTypeChange(v), children: [
1500
+ /* @__PURE__ */ jsx28(SelectTrigger, { className: "h-9 w-[110px] shrink-0 text-sm", children: /* @__PURE__ */ jsx28(SelectValue, {}) }),
1501
+ /* @__PURE__ */ jsxs17(SelectContent, { children: [
1502
+ /* @__PURE__ */ jsx28(SelectItem, { value: "string", children: "String" }),
1503
+ /* @__PURE__ */ jsx28(SelectItem, { value: "number", children: "Number" }),
1504
+ /* @__PURE__ */ jsx28(SelectItem, { value: "boolean", children: "Boolean" }),
1505
+ /* @__PURE__ */ jsx28(SelectItem, { value: "json", children: "JSON" })
1454
1506
  ] })
1455
1507
  ] }),
1456
- /* @__PURE__ */ jsxs16("div", { className: "flex-1", children: [
1457
- type === "string" && /* @__PURE__ */ jsx27(
1508
+ /* @__PURE__ */ jsxs17("div", { className: "flex-1", children: [
1509
+ type === "string" && /* @__PURE__ */ jsx28(
1458
1510
  Input,
1459
1511
  {
1460
1512
  className: "h-9 font-mono text-sm",
@@ -1463,7 +1515,7 @@ function ValueInput({ value, onChange, placeholder }) {
1463
1515
  onChange: (e) => onChange(e.target.value)
1464
1516
  }
1465
1517
  ),
1466
- type === "number" && /* @__PURE__ */ jsx27(
1518
+ type === "number" && /* @__PURE__ */ jsx28(
1467
1519
  Input,
1468
1520
  {
1469
1521
  className: "h-9 font-mono text-sm",
@@ -1472,15 +1524,15 @@ function ValueInput({ value, onChange, placeholder }) {
1472
1524
  onChange: (e) => onChange(Number(e.target.value))
1473
1525
  }
1474
1526
  ),
1475
- type === "boolean" && /* @__PURE__ */ jsxs16(Select, { value: String(Boolean(value)), onValueChange: (v) => onChange(v === "true"), children: [
1476
- /* @__PURE__ */ jsx27(SelectTrigger, { className: "h-9 text-sm", children: /* @__PURE__ */ jsx27(SelectValue, {}) }),
1477
- /* @__PURE__ */ jsxs16(SelectContent, { children: [
1478
- /* @__PURE__ */ jsx27(SelectItem, { value: "true", children: "true" }),
1479
- /* @__PURE__ */ jsx27(SelectItem, { value: "false", children: "false" })
1527
+ type === "boolean" && /* @__PURE__ */ jsxs17(Select, { value: String(Boolean(value)), onValueChange: (v) => onChange(v === "true"), children: [
1528
+ /* @__PURE__ */ jsx28(SelectTrigger, { className: "h-9 text-sm", children: /* @__PURE__ */ jsx28(SelectValue, {}) }),
1529
+ /* @__PURE__ */ jsxs17(SelectContent, { children: [
1530
+ /* @__PURE__ */ jsx28(SelectItem, { value: "true", children: "true" }),
1531
+ /* @__PURE__ */ jsx28(SelectItem, { value: "false", children: "false" })
1480
1532
  ] })
1481
1533
  ] }),
1482
- type === "json" && /* @__PURE__ */ jsxs16(Fragment, { children: [
1483
- /* @__PURE__ */ jsx27(
1534
+ type === "json" && /* @__PURE__ */ jsxs17(Fragment, { children: [
1535
+ /* @__PURE__ */ jsx28(
1484
1536
  Textarea,
1485
1537
  {
1486
1538
  className: "font-mono text-sm",
@@ -1490,9 +1542,9 @@ function ValueInput({ value, onChange, placeholder }) {
1490
1542
  onBlur: handleJsonBlur
1491
1543
  }
1492
1544
  ),
1493
- /* @__PURE__ */ jsxs16("div", { className: "mt-1 flex items-center gap-2", children: [
1494
- jsonError && /* @__PURE__ */ jsx27("p", { className: "text-xs text-destructive", children: jsonError }),
1495
- /* @__PURE__ */ jsx27(
1545
+ /* @__PURE__ */ jsxs17("div", { className: "mt-1 flex items-center gap-2", children: [
1546
+ jsonError && /* @__PURE__ */ jsx28("p", { className: "text-xs text-destructive", children: jsonError }),
1547
+ /* @__PURE__ */ jsx28(
1496
1548
  Button,
1497
1549
  {
1498
1550
  type: "button",
@@ -1510,11 +1562,11 @@ function ValueInput({ value, onChange, placeholder }) {
1510
1562
  }
1511
1563
 
1512
1564
  // src/components/common/ValidationMessage.tsx
1513
- import { jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
1565
+ import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
1514
1566
  function ValidationMessage({ errors }) {
1515
1567
  if (!errors || errors.length === 0) return null;
1516
- return /* @__PURE__ */ jsx28("div", { className: "space-y-1", children: errors.map((err, i) => /* @__PURE__ */ jsxs17("p", { className: "text-xs text-destructive", children: [
1517
- err.path.length > 0 && /* @__PURE__ */ jsxs17("span", { className: "font-mono text-destructive/70", children: [
1568
+ return /* @__PURE__ */ jsx29("div", { className: "space-y-1", children: errors.map((err, i) => /* @__PURE__ */ jsxs18("p", { className: "text-xs text-destructive", children: [
1569
+ err.path.length > 0 && /* @__PURE__ */ jsxs18("span", { className: "font-mono text-destructive/70", children: [
1518
1570
  err.path.join("."),
1519
1571
  " "
1520
1572
  ] }),
@@ -1524,7 +1576,7 @@ function ValidationMessage({ errors }) {
1524
1576
 
1525
1577
  // src/components/common/ThemeToggle.tsx
1526
1578
  import { Moon, Sun, Monitor } from "lucide-react";
1527
- import { jsx as jsx29 } from "react/jsx-runtime";
1579
+ import { jsx as jsx30 } from "react/jsx-runtime";
1528
1580
  var icons = {
1529
1581
  light: Sun,
1530
1582
  dark: Moon,
@@ -1537,21 +1589,21 @@ var next = {
1537
1589
  };
1538
1590
  function ThemeToggle({ theme, onToggle }) {
1539
1591
  const Icon = icons[theme];
1540
- return /* @__PURE__ */ jsx29(
1592
+ return /* @__PURE__ */ jsx30(
1541
1593
  Button,
1542
1594
  {
1543
1595
  variant: "ghost",
1544
1596
  size: "icon",
1545
1597
  onClick: () => onToggle(next[theme]),
1546
1598
  "aria-label": `Switch to ${next[theme]} theme`,
1547
- children: /* @__PURE__ */ jsx29(Icon, { className: "h-4 w-4" })
1599
+ children: /* @__PURE__ */ jsx30(Icon, { className: "h-4 w-4" })
1548
1600
  }
1549
1601
  );
1550
1602
  }
1551
1603
 
1552
1604
  // src/components/common/ErrorBoundary.tsx
1553
1605
  import { Component } from "react";
1554
- import { jsx as jsx30, jsxs as jsxs18 } from "react/jsx-runtime";
1606
+ import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
1555
1607
  function defaultOnError(error, info) {
1556
1608
  console.error("ErrorBoundary caught an error:", error, info);
1557
1609
  }
@@ -1575,15 +1627,15 @@ var ErrorBoundary = class extends Component {
1575
1627
  if (this.props.fallback) {
1576
1628
  return this.props.fallback;
1577
1629
  }
1578
- return /* @__PURE__ */ jsxs18(
1630
+ return /* @__PURE__ */ jsxs19(
1579
1631
  "div",
1580
1632
  {
1581
1633
  role: "alert",
1582
1634
  className: "flex flex-col items-center justify-center gap-3 p-6 text-center",
1583
1635
  children: [
1584
- /* @__PURE__ */ jsx30("p", { className: "text-sm font-medium text-destructive", children: "Something went wrong" }),
1585
- /* @__PURE__ */ jsx30("p", { className: "text-xs text-muted-foreground", children: this.state.error.message }),
1586
- /* @__PURE__ */ jsx30(
1636
+ /* @__PURE__ */ jsx31("p", { className: "text-sm font-medium text-destructive", children: "Something went wrong" }),
1637
+ /* @__PURE__ */ jsx31("p", { className: "text-xs text-muted-foreground", children: this.state.error.message }),
1638
+ /* @__PURE__ */ jsx31(
1587
1639
  "button",
1588
1640
  {
1589
1641
  type: "button",
@@ -1601,29 +1653,29 @@ var ErrorBoundary = class extends Component {
1601
1653
  };
1602
1654
 
1603
1655
  // src/components/ui/alert-dialog.tsx
1604
- import { AlertDialog as AlertDialogPrimitive } from "radix-ui";
1605
- import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
1656
+ import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
1657
+ import { jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
1606
1658
  function AlertDialog({ ...props }) {
1607
- return /* @__PURE__ */ jsx31(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
1659
+ return /* @__PURE__ */ jsx32(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
1608
1660
  }
1609
1661
  function AlertDialogTrigger({
1610
1662
  ...props
1611
1663
  }) {
1612
- return /* @__PURE__ */ jsx31(AlertDialogPrimitive.Trigger, { "data-slot": "alert-dialog-trigger", ...props });
1664
+ return /* @__PURE__ */ jsx32(AlertDialogPrimitive.Trigger, { "data-slot": "alert-dialog-trigger", ...props });
1613
1665
  }
1614
1666
  function AlertDialogPortal({ ...props }) {
1615
- return /* @__PURE__ */ jsx31(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props });
1667
+ return /* @__PURE__ */ jsx32(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props });
1616
1668
  }
1617
- function AlertDialogOverlay({
1669
+ function AlertDialogBackdrop({
1618
1670
  className,
1619
1671
  ...props
1620
1672
  }) {
1621
- return /* @__PURE__ */ jsx31(
1622
- AlertDialogPrimitive.Overlay,
1673
+ return /* @__PURE__ */ jsx32(
1674
+ AlertDialogPrimitive.Backdrop,
1623
1675
  {
1624
- "data-slot": "alert-dialog-overlay",
1676
+ "data-slot": "alert-dialog-backdrop",
1625
1677
  className: cn(
1626
- "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
1678
+ "fixed inset-0 z-50 bg-black/50 data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:animate-in data-[open]:fade-in-0",
1627
1679
  className
1628
1680
  ),
1629
1681
  ...props
@@ -1634,14 +1686,14 @@ function AlertDialogContent({
1634
1686
  className,
1635
1687
  ...props
1636
1688
  }) {
1637
- return /* @__PURE__ */ jsxs19(AlertDialogPortal, { children: [
1638
- /* @__PURE__ */ jsx31(AlertDialogOverlay, {}),
1639
- /* @__PURE__ */ jsx31(
1640
- AlertDialogPrimitive.Content,
1689
+ return /* @__PURE__ */ jsxs20(AlertDialogPortal, { children: [
1690
+ /* @__PURE__ */ jsx32(AlertDialogBackdrop, {}),
1691
+ /* @__PURE__ */ jsx32(
1692
+ AlertDialogPrimitive.Popup,
1641
1693
  {
1642
1694
  "data-slot": "alert-dialog-content",
1643
1695
  className: cn(
1644
- "fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
1696
+ "fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95 data-[open]:animate-in data-[open]:fade-in-0 data-[open]:zoom-in-95 sm:max-w-lg",
1645
1697
  className
1646
1698
  ),
1647
1699
  ...props
@@ -1650,7 +1702,7 @@ function AlertDialogContent({
1650
1702
  ] });
1651
1703
  }
1652
1704
  function AlertDialogHeader({ className, ...props }) {
1653
- return /* @__PURE__ */ jsx31(
1705
+ return /* @__PURE__ */ jsx32(
1654
1706
  "div",
1655
1707
  {
1656
1708
  "data-slot": "alert-dialog-header",
@@ -1660,7 +1712,7 @@ function AlertDialogHeader({ className, ...props }) {
1660
1712
  );
1661
1713
  }
1662
1714
  function AlertDialogFooter({ className, ...props }) {
1663
- return /* @__PURE__ */ jsx31(
1715
+ return /* @__PURE__ */ jsx32(
1664
1716
  "div",
1665
1717
  {
1666
1718
  "data-slot": "alert-dialog-footer",
@@ -1673,7 +1725,7 @@ function AlertDialogTitle({
1673
1725
  className,
1674
1726
  ...props
1675
1727
  }) {
1676
- return /* @__PURE__ */ jsx31(
1728
+ return /* @__PURE__ */ jsx32(
1677
1729
  AlertDialogPrimitive.Title,
1678
1730
  {
1679
1731
  "data-slot": "alert-dialog-title",
@@ -1686,7 +1738,7 @@ function AlertDialogDescription({
1686
1738
  className,
1687
1739
  ...props
1688
1740
  }) {
1689
- return /* @__PURE__ */ jsx31(
1741
+ return /* @__PURE__ */ jsx32(
1690
1742
  AlertDialogPrimitive.Description,
1691
1743
  {
1692
1744
  "data-slot": "alert-dialog-description",
@@ -1699,14 +1751,14 @@ function AlertDialogAction({
1699
1751
  className,
1700
1752
  ...props
1701
1753
  }) {
1702
- return /* @__PURE__ */ jsx31(AlertDialogPrimitive.Action, { className: cn(buttonVariants(), className), ...props });
1754
+ return /* @__PURE__ */ jsx32(AlertDialogPrimitive.Close, { className: cn(buttonVariants(), className), ...props });
1703
1755
  }
1704
- function AlertDialogCancel({
1756
+ function AlertDialogClose({
1705
1757
  className,
1706
1758
  ...props
1707
1759
  }) {
1708
- return /* @__PURE__ */ jsx31(
1709
- AlertDialogPrimitive.Cancel,
1760
+ return /* @__PURE__ */ jsx32(
1761
+ AlertDialogPrimitive.Close,
1710
1762
  {
1711
1763
  className: cn(buttonVariants({ variant: "outline" }), className),
1712
1764
  ...props
@@ -1715,7 +1767,7 @@ function AlertDialogCancel({
1715
1767
  }
1716
1768
 
1717
1769
  // src/components/common/ConfirmDialog.tsx
1718
- import { jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
1770
+ import { jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
1719
1771
  function ConfirmDialog({
1720
1772
  title,
1721
1773
  description,
@@ -1725,16 +1777,16 @@ function ConfirmDialog({
1725
1777
  onOpenChange,
1726
1778
  children
1727
1779
  }) {
1728
- return /* @__PURE__ */ jsxs20(AlertDialog, { open, onOpenChange, children: [
1729
- /* @__PURE__ */ jsx32(AlertDialogTrigger, { asChild: true, children }),
1730
- /* @__PURE__ */ jsxs20(AlertDialogContent, { children: [
1731
- /* @__PURE__ */ jsxs20(AlertDialogHeader, { children: [
1732
- /* @__PURE__ */ jsx32(AlertDialogTitle, { children: title }),
1733
- /* @__PURE__ */ jsx32(AlertDialogDescription, { children: description })
1780
+ return /* @__PURE__ */ jsxs21(AlertDialog, { open, onOpenChange, children: [
1781
+ /* @__PURE__ */ jsx33(AlertDialogTrigger, { render: children, children: null }),
1782
+ /* @__PURE__ */ jsxs21(AlertDialogContent, { children: [
1783
+ /* @__PURE__ */ jsxs21(AlertDialogHeader, { children: [
1784
+ /* @__PURE__ */ jsx33(AlertDialogTitle, { children: title }),
1785
+ /* @__PURE__ */ jsx33(AlertDialogDescription, { children: description })
1734
1786
  ] }),
1735
- /* @__PURE__ */ jsxs20(AlertDialogFooter, { children: [
1736
- /* @__PURE__ */ jsx32(AlertDialogCancel, { children: "Cancel" }),
1737
- /* @__PURE__ */ jsx32(
1787
+ /* @__PURE__ */ jsxs21(AlertDialogFooter, { children: [
1788
+ /* @__PURE__ */ jsx33(AlertDialogClose, { children: "Cancel" }),
1789
+ /* @__PURE__ */ jsx33(
1738
1790
  AlertDialogAction,
1739
1791
  {
1740
1792
  className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
@@ -1748,16 +1800,16 @@ function ConfirmDialog({
1748
1800
  }
1749
1801
 
1750
1802
  // src/components/condition-builder/ConditionBuilder.tsx
1751
- import { Fragment as Fragment5 } from "react";
1803
+ import { Fragment as Fragment4 } from "react";
1752
1804
 
1753
1805
  // src/components/condition-builder/ConditionBlock.tsx
1754
1806
  import { memo as memo2 } from "react";
1755
- import { isAndCondition, isOrCondition } from "showwhat";
1807
+ import { isAndCondition, isOrCondition, isCheckAnnotationsCondition } from "showwhat";
1756
1808
  import { X as X2 } from "lucide-react";
1757
1809
 
1758
1810
  // src/components/condition-builder/CustomConditionEditor.tsx
1759
1811
  import { useCallback as useCallback8, useRef as useRef3, useState as useState5 } from "react";
1760
- import { jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
1812
+ import { jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
1761
1813
  function extractArgs(condition) {
1762
1814
  return Object.fromEntries(Object.entries(condition).filter(([k]) => k !== "type" && k !== "id"));
1763
1815
  }
@@ -1765,7 +1817,11 @@ function argsToText(args) {
1765
1817
  if (Object.keys(args).length === 0) return "";
1766
1818
  return JSON.stringify(args, null, 2);
1767
1819
  }
1768
- function CustomConditionEditor({ condition, onChange }) {
1820
+ function CustomConditionEditor({
1821
+ condition,
1822
+ onChange,
1823
+ isPresetBacked = false
1824
+ }) {
1769
1825
  const rec = condition;
1770
1826
  const [text, setText] = useState5(() => argsToText(extractArgs(rec)));
1771
1827
  const [jsonError, setJsonError] = useState5(null);
@@ -1811,10 +1867,16 @@ function CustomConditionEditor({ condition, onChange }) {
1811
1867
  },
1812
1868
  [rec, onChange]
1813
1869
  );
1814
- return /* @__PURE__ */ jsxs21("div", { className: "flex-1 space-y-2", children: [
1815
- /* @__PURE__ */ jsxs21("div", { className: "space-y-1", children: [
1816
- /* @__PURE__ */ jsx33(Label, { className: "text-xs text-muted-foreground", children: "Type" }),
1817
- /* @__PURE__ */ jsx33(
1870
+ const chrome = useConditionBlockChrome();
1871
+ return /* @__PURE__ */ jsxs22("div", { className: "flex-1 space-y-2", children: [
1872
+ chrome && /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
1873
+ chrome.typeBadge,
1874
+ /* @__PURE__ */ jsx34("div", { className: "flex-1" }),
1875
+ chrome.controls
1876
+ ] }),
1877
+ /* @__PURE__ */ jsxs22("div", { className: "space-y-1", children: [
1878
+ /* @__PURE__ */ jsx34(Label, { className: "text-xs text-muted-foreground", children: "Type" }),
1879
+ /* @__PURE__ */ jsx34(
1818
1880
  Input,
1819
1881
  {
1820
1882
  className: "h-8 font-mono text-sm",
@@ -1824,9 +1886,9 @@ function CustomConditionEditor({ condition, onChange }) {
1824
1886
  }
1825
1887
  )
1826
1888
  ] }),
1827
- /* @__PURE__ */ jsxs21("div", { className: "space-y-1", children: [
1828
- /* @__PURE__ */ jsx33(Label, { className: "text-xs text-muted-foreground", children: "Args" }),
1829
- /* @__PURE__ */ jsx33(
1889
+ /* @__PURE__ */ jsxs22("div", { className: "space-y-1", children: [
1890
+ /* @__PURE__ */ jsx34(Label, { className: "text-xs text-muted-foreground", children: "Args" }),
1891
+ /* @__PURE__ */ jsx34(
1830
1892
  Textarea,
1831
1893
  {
1832
1894
  className: "font-mono text-sm",
@@ -1843,44 +1905,53 @@ function CustomConditionEditor({ condition, onChange }) {
1843
1905
  onBlur: handleArgsBlur
1844
1906
  }
1845
1907
  ),
1846
- jsonError && /* @__PURE__ */ jsx33("p", { className: "mt-1 text-xs text-destructive", children: jsonError })
1847
- ] })
1908
+ jsonError && /* @__PURE__ */ jsx34("p", { className: "mt-1 text-xs text-destructive", children: jsonError })
1909
+ ] }),
1910
+ isPresetBacked && /* @__PURE__ */ jsx34("p", { className: "text-xs text-muted-foreground/70 italic", children: "Some fields may be overridden by the preset configuration at evaluation time." })
1848
1911
  ] });
1849
1912
  }
1850
1913
 
1851
1914
  // src/components/condition-builder/ConditionExtensionsContext.tsx
1852
- import { createContext, useContext } from "react";
1853
- var ConditionExtensionsContext = createContext(null);
1915
+ import { createContext as createContext2, useContext as useContext2 } from "react";
1916
+ var ConditionExtensionsContext = createContext2(null);
1854
1917
  var ConditionExtensionsProvider = ConditionExtensionsContext.Provider;
1855
1918
  function useConditionExtensions() {
1856
- return useContext(ConditionExtensionsContext);
1919
+ return useContext2(ConditionExtensionsContext);
1857
1920
  }
1858
1921
 
1859
1922
  // src/components/condition-builder/ConditionValueEditor.tsx
1860
- import { jsx as jsx34 } from "react/jsx-runtime";
1923
+ import { jsx as jsx35 } from "react/jsx-runtime";
1861
1924
  function ConditionValueEditor({ condition, onChange }) {
1862
1925
  const extensions = useConditionExtensions();
1863
1926
  switch (condition.type) {
1864
1927
  case "string":
1865
- return /* @__PURE__ */ jsx34(StringConditionEditor, { condition, onChange });
1928
+ return /* @__PURE__ */ jsx35(StringConditionEditor, { condition, onChange });
1866
1929
  case "number":
1867
- return /* @__PURE__ */ jsx34(NumberConditionEditor, { condition, onChange });
1930
+ return /* @__PURE__ */ jsx35(NumberConditionEditor, { condition, onChange });
1868
1931
  case "datetime":
1869
- return /* @__PURE__ */ jsx34(DatetimeConditionEditor, { condition, onChange });
1932
+ return /* @__PURE__ */ jsx35(DatetimeConditionEditor, { condition, onChange });
1870
1933
  case "bool":
1871
- return /* @__PURE__ */ jsx34(BoolConditionEditor, { condition, onChange });
1934
+ return /* @__PURE__ */ jsx35(BoolConditionEditor, { condition, onChange });
1872
1935
  case "env":
1873
- return /* @__PURE__ */ jsx34(EnvConditionEditor, { condition, onChange });
1936
+ return /* @__PURE__ */ jsx35(EnvConditionEditor, { condition, onChange });
1874
1937
  case "startAt":
1875
- return /* @__PURE__ */ jsx34(StartAtConditionEditor, { condition, onChange });
1938
+ return /* @__PURE__ */ jsx35(StartAtConditionEditor, { condition, onChange });
1876
1939
  case "endAt":
1877
- return /* @__PURE__ */ jsx34(EndAtConditionEditor, { condition, onChange });
1940
+ return /* @__PURE__ */ jsx35(EndAtConditionEditor, { condition, onChange });
1878
1941
  default: {
1879
1942
  const OverrideEditor = extensions?.editorOverrides.get(condition.type);
1880
1943
  if (OverrideEditor) {
1881
- return /* @__PURE__ */ jsx34(OverrideEditor, { condition, onChange });
1944
+ return /* @__PURE__ */ jsx35(OverrideEditor, { condition, onChange });
1882
1945
  }
1883
- return /* @__PURE__ */ jsx34(CustomConditionEditor, { condition, onChange });
1946
+ const isPresetBacked = extensions?.extraConditionTypes.some((m) => m.type === condition.type) ?? false;
1947
+ return /* @__PURE__ */ jsx35(
1948
+ CustomConditionEditor,
1949
+ {
1950
+ condition,
1951
+ onChange,
1952
+ isPresetBacked
1953
+ }
1954
+ );
1884
1955
  }
1885
1956
  }
1886
1957
  }
@@ -1889,7 +1960,8 @@ function ConditionValueEditor({ condition, onChange }) {
1889
1960
  import { X } from "lucide-react";
1890
1961
 
1891
1962
  // src/components/condition-builder/AddConditionMenu.tsx
1892
- import { Plus } from "lucide-react";
1963
+ import { useState as useState6, useCallback as useCallback9, useRef as useRef4, useMemo as useMemo8 } from "react";
1964
+ import { Plus, Search } from "lucide-react";
1893
1965
 
1894
1966
  // src/components/condition-builder/utils.ts
1895
1967
  function buildDefaultCondition(type, id, extraTypes) {
@@ -1899,6 +1971,9 @@ function buildDefaultCondition(type, id, extraTypes) {
1899
1971
  if (type === "or") {
1900
1972
  return buildOrCondition([], id);
1901
1973
  }
1974
+ if (type === "checkAnnotations") {
1975
+ return buildCheckAnnotationsCondition([], id);
1976
+ }
1902
1977
  if (type === "__custom") {
1903
1978
  return buildCustomCondition({ type: "", ...id ? { id } : {} });
1904
1979
  }
@@ -1914,43 +1989,114 @@ function buildDefaultCondition(type, id, extraTypes) {
1914
1989
  }
1915
1990
 
1916
1991
  // src/components/condition-builder/AddConditionMenu.tsx
1917
- import { Fragment as Fragment2, jsx as jsx35, jsxs as jsxs22 } from "react/jsx-runtime";
1992
+ import { Fragment as Fragment2, jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
1993
+ var BUILTIN_TYPES = /* @__PURE__ */ new Set(["string", "number", "datetime", "bool", "env", "startAt", "endAt"]);
1994
+ var GROUP_ITEMS = [
1995
+ { type: "and", label: "and", group: "Groups" },
1996
+ { type: "or", label: "or", group: "Groups" },
1997
+ { type: "checkAnnotations", label: "checkAnnotations", group: "Groups" }
1998
+ ];
1999
+ var CUSTOM_ITEM = { type: "__custom", label: "Custom", group: "" };
2000
+ function SectionLabel({ children }) {
2001
+ return /* @__PURE__ */ jsx36("span", { className: "px-2 py-1 text-[10px] uppercase tracking-wider text-muted-foreground/70", children });
2002
+ }
1918
2003
  function AddConditionMenu({ onAdd }) {
1919
2004
  const extensions = useConditionExtensions();
1920
2005
  const extraTypes = extensions?.extraConditionTypes ?? [];
1921
- const primitives = BUILTIN_CONDITION_TYPES.filter(
1922
- (m) => ["string", "number", "datetime", "bool"].includes(m.type)
1923
- );
1924
- const sugar = BUILTIN_CONDITION_TYPES.filter((m) => ["env", "startAt", "endAt"].includes(m.type));
1925
- return /* @__PURE__ */ jsxs22(DropdownMenu, { children: [
1926
- /* @__PURE__ */ jsxs22(DropdownMenuTrigger, { className: "inline-flex shrink-0 items-center justify-center gap-1.5 rounded px-3 h-8 text-sm font-medium hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", children: [
1927
- /* @__PURE__ */ jsx35(Plus, { className: "mr-1 h-3.5 w-3.5" }),
1928
- "Add condition"
1929
- ] }),
1930
- /* @__PURE__ */ jsxs22(DropdownMenuContent, { align: "start", children: [
1931
- primitives.map((meta8) => /* @__PURE__ */ jsx35(DropdownMenuItem, { onSelect: () => onAdd(meta8.type), children: meta8.label }, meta8.type)),
1932
- /* @__PURE__ */ jsx35(DropdownMenuSeparator, {}),
1933
- sugar.map((meta8) => /* @__PURE__ */ jsx35(DropdownMenuItem, { onSelect: () => onAdd(meta8.type), children: meta8.label }, meta8.type)),
1934
- extraTypes.length > 0 && /* @__PURE__ */ jsxs22(Fragment2, { children: [
1935
- /* @__PURE__ */ jsx35(DropdownMenuSeparator, {}),
1936
- extraTypes.map((meta8) => /* @__PURE__ */ jsx35(DropdownMenuItem, { onSelect: () => onAdd(meta8.type), children: meta8.label }, meta8.type))
1937
- ] }),
1938
- /* @__PURE__ */ jsx35(DropdownMenuSeparator, {}),
1939
- /* @__PURE__ */ jsx35(DropdownMenuItem, { onSelect: () => onAdd("and"), children: "AND Group" }),
1940
- /* @__PURE__ */ jsx35(DropdownMenuItem, { onSelect: () => onAdd("or"), children: "OR Group" }),
1941
- /* @__PURE__ */ jsx35(DropdownMenuSeparator, {}),
1942
- /* @__PURE__ */ jsx35(DropdownMenuItem, { onSelect: () => onAdd("__custom"), children: "Custom" })
1943
- ] })
1944
- ] });
2006
+ const [filter, setFilter] = useState6("");
2007
+ const inputRef = useRef4(null);
2008
+ const allItems = useMemo8(() => {
2009
+ const items = [];
2010
+ for (const m of BUILTIN_CONDITION_TYPES) {
2011
+ if (BUILTIN_TYPES.has(m.type)) {
2012
+ items.push({ type: m.type, label: m.label, group: "Built-in" });
2013
+ }
2014
+ }
2015
+ for (const m of extraTypes) {
2016
+ items.push({ type: m.type, label: m.label, group: "Presets" });
2017
+ }
2018
+ items.push(...GROUP_ITEMS);
2019
+ items.push(CUSTOM_ITEM);
2020
+ return items;
2021
+ }, [extraTypes]);
2022
+ const filtered = useMemo8(() => {
2023
+ if (!filter.trim()) return null;
2024
+ const q = filter.toLowerCase();
2025
+ return allItems.filter(
2026
+ (item) => item.label.toLowerCase().includes(q) || item.type.toLowerCase().includes(q)
2027
+ );
2028
+ }, [filter, allItems]);
2029
+ const handleSelect = useCallback9(
2030
+ (type) => {
2031
+ setFilter("");
2032
+ onAdd(type);
2033
+ },
2034
+ [onAdd]
2035
+ );
2036
+ const builtins = BUILTIN_CONDITION_TYPES.filter((m) => BUILTIN_TYPES.has(m.type));
2037
+ return /* @__PURE__ */ jsxs23(
2038
+ Menu,
2039
+ {
2040
+ onOpenChange: (open) => {
2041
+ if (!open) setFilter("");
2042
+ },
2043
+ children: [
2044
+ /* @__PURE__ */ jsxs23(MenuTrigger, { className: "inline-flex shrink-0 items-center justify-center gap-1.5 rounded px-3 h-8 text-sm font-medium hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", children: [
2045
+ /* @__PURE__ */ jsx36(Plus, { className: "mr-1 h-3.5 w-3.5" }),
2046
+ "Add condition"
2047
+ ] }),
2048
+ /* @__PURE__ */ jsxs23(
2049
+ MenuContent,
2050
+ {
2051
+ align: "start",
2052
+ className: "flex max-h-[var(--available-height)] flex-col overflow-hidden",
2053
+ children: [
2054
+ /* @__PURE__ */ jsx36("div", { className: "shrink-0 px-1 pb-1", children: /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-1.5 rounded-sm border border-input px-2 py-1", children: [
2055
+ /* @__PURE__ */ jsx36(Search, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground/50" }),
2056
+ /* @__PURE__ */ jsx36(
2057
+ "input",
2058
+ {
2059
+ ref: inputRef,
2060
+ type: "text",
2061
+ className: "w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground/50",
2062
+ placeholder: "Filter...",
2063
+ value: filter,
2064
+ onChange: (e) => setFilter(e.target.value),
2065
+ onKeyDown: (e) => e.stopPropagation()
2066
+ }
2067
+ )
2068
+ ] }) }),
2069
+ /* @__PURE__ */ jsx36("div", { className: "overflow-y-auto", children: filtered ? filtered.length > 0 ? filtered.map((item) => /* @__PURE__ */ jsx36(MenuItem, { onClick: () => handleSelect(item.type), children: item.label }, item.type)) : /* @__PURE__ */ jsx36("span", { className: "block px-2 py-1.5 text-sm text-muted-foreground", children: "No matches" }) : /* @__PURE__ */ jsxs23(Fragment2, { children: [
2070
+ /* @__PURE__ */ jsx36(SectionLabel, { children: "Built-in" }),
2071
+ builtins.map((meta8) => /* @__PURE__ */ jsx36(MenuItem, { onClick: () => handleSelect(meta8.type), children: meta8.label }, meta8.type)),
2072
+ extraTypes.length > 0 && /* @__PURE__ */ jsxs23(Fragment2, { children: [
2073
+ /* @__PURE__ */ jsx36(MenuSeparator, {}),
2074
+ /* @__PURE__ */ jsx36(SectionLabel, { children: "Presets" }),
2075
+ extraTypes.map((meta8) => /* @__PURE__ */ jsx36(MenuItem, { onClick: () => handleSelect(meta8.type), children: meta8.label }, meta8.type))
2076
+ ] }),
2077
+ /* @__PURE__ */ jsx36(MenuSeparator, {}),
2078
+ /* @__PURE__ */ jsx36(SectionLabel, { children: "Groups" }),
2079
+ /* @__PURE__ */ jsx36(MenuItem, { onClick: () => handleSelect("and"), children: "and" }),
2080
+ /* @__PURE__ */ jsx36(MenuItem, { onClick: () => handleSelect("or"), children: "or" }),
2081
+ /* @__PURE__ */ jsx36(MenuItem, { onClick: () => handleSelect("checkAnnotations"), children: "checkAnnotations" }),
2082
+ /* @__PURE__ */ jsx36(MenuSeparator, {}),
2083
+ /* @__PURE__ */ jsx36(MenuItem, { onClick: () => handleSelect("__custom"), children: "Custom" })
2084
+ ] }) })
2085
+ ]
2086
+ }
2087
+ )
2088
+ ]
2089
+ }
2090
+ );
1945
2091
  }
1946
2092
 
1947
2093
  // src/components/condition-builder/MoveButtons.tsx
1948
2094
  import { ChevronDown, ChevronUp } from "lucide-react";
1949
- import { Fragment as Fragment3, jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
2095
+ import { jsx as jsx37, jsxs as jsxs24 } from "react/jsx-runtime";
1950
2096
  function MoveButtons({ onMoveUp, onMoveDown, size = "h-8 w-8" }) {
1951
- if (!onMoveUp && !onMoveDown) return null;
1952
- return /* @__PURE__ */ jsxs23(Fragment3, { children: [
1953
- /* @__PURE__ */ jsx36(
2097
+ const hidden = !onMoveUp && !onMoveDown;
2098
+ return /* @__PURE__ */ jsxs24("div", { className: hidden ? "invisible" : void 0, children: [
2099
+ /* @__PURE__ */ jsx37(
1954
2100
  Button,
1955
2101
  {
1956
2102
  variant: "ghost",
@@ -1959,10 +2105,10 @@ function MoveButtons({ onMoveUp, onMoveDown, size = "h-8 w-8" }) {
1959
2105
  disabled: !onMoveUp,
1960
2106
  onClick: onMoveUp,
1961
2107
  "aria-label": "Move up",
1962
- children: /* @__PURE__ */ jsx36(ChevronUp, { className: "h-3.5 w-3.5" })
2108
+ children: /* @__PURE__ */ jsx37(ChevronUp, { className: "h-3.5 w-3.5" })
1963
2109
  }
1964
2110
  ),
1965
- /* @__PURE__ */ jsx36(
2111
+ /* @__PURE__ */ jsx37(
1966
2112
  Button,
1967
2113
  {
1968
2114
  variant: "ghost",
@@ -1971,7 +2117,7 @@ function MoveButtons({ onMoveUp, onMoveDown, size = "h-8 w-8" }) {
1971
2117
  disabled: !onMoveDown,
1972
2118
  onClick: onMoveDown,
1973
2119
  "aria-label": "Move down",
1974
- children: /* @__PURE__ */ jsx36(ChevronDown, { className: "h-3.5 w-3.5" })
2120
+ children: /* @__PURE__ */ jsx37(ChevronDown, { className: "h-3.5 w-3.5" })
1975
2121
  }
1976
2122
  )
1977
2123
  ] });
@@ -1986,12 +2132,12 @@ function filterErrorsByPath(errors, pathKey, index) {
1986
2132
  }
1987
2133
 
1988
2134
  // src/components/condition-builder/useConditionArray.ts
1989
- import { useCallback as useCallback9, useMemo as useMemo8 } from "react";
2135
+ import { useCallback as useCallback10, useMemo as useMemo9 } from "react";
1990
2136
  function useConditionArray(conditions, onChange) {
1991
2137
  const extensions = useConditionExtensions();
1992
2138
  const extraTypes = extensions?.extraConditionTypes;
1993
- const withIds = useMemo8(() => ensureIds(conditions), [conditions]);
1994
- const handleConditionChange = useCallback9(
2139
+ const withIds = useMemo9(() => ensureIds(conditions), [conditions]);
2140
+ const handleConditionChange = useCallback10(
1995
2141
  (index, updated) => {
1996
2142
  const next2 = [...withIds];
1997
2143
  next2[index] = updated;
@@ -1999,13 +2145,13 @@ function useConditionArray(conditions, onChange) {
1999
2145
  },
2000
2146
  [withIds, onChange]
2001
2147
  );
2002
- const handleConditionRemove = useCallback9(
2148
+ const handleConditionRemove = useCallback10(
2003
2149
  (index) => {
2004
2150
  onChange(withIds.filter((_, i) => i !== index));
2005
2151
  },
2006
2152
  [withIds, onChange]
2007
2153
  );
2008
- const handleAddCondition = useCallback9(
2154
+ const handleAddCondition = useCallback10(
2009
2155
  (type) => {
2010
2156
  const newCondition = buildDefaultCondition(
2011
2157
  type,
@@ -2016,7 +2162,7 @@ function useConditionArray(conditions, onChange) {
2016
2162
  },
2017
2163
  [withIds, onChange, extraTypes]
2018
2164
  );
2019
- const handleMoveUp = useCallback9(
2165
+ const handleMoveUp = useCallback10(
2020
2166
  (index) => {
2021
2167
  if (index <= 0) return;
2022
2168
  const next2 = [...withIds];
@@ -2025,7 +2171,7 @@ function useConditionArray(conditions, onChange) {
2025
2171
  },
2026
2172
  [withIds, onChange]
2027
2173
  );
2028
- const handleMoveDown = useCallback9(
2174
+ const handleMoveDown = useCallback10(
2029
2175
  (index) => {
2030
2176
  if (index >= withIds.length - 1) return;
2031
2177
  const next2 = [...withIds];
@@ -2045,8 +2191,22 @@ function useConditionArray(conditions, onChange) {
2045
2191
  }
2046
2192
 
2047
2193
  // src/components/condition-builder/ConditionGroup.tsx
2048
- import { Fragment as Fragment4, memo } from "react";
2049
- import { jsx as jsx37, jsxs as jsxs24 } from "react/jsx-runtime";
2194
+ import { Fragment as Fragment3, memo } from "react";
2195
+ import { jsx as jsx38, jsxs as jsxs25 } from "react/jsx-runtime";
2196
+ var GROUP_TYPE_CLASSES = {
2197
+ and: { border: "border-primary/30", badge: "bg-primary/10 text-primary border-primary/20" },
2198
+ or: {
2199
+ border: "border-amber-500/30",
2200
+ badge: "bg-amber-500/10 text-amber-600 border-amber-500/20 dark:text-amber-400"
2201
+ },
2202
+ default: {
2203
+ border: "border-violet-500/30",
2204
+ badge: "bg-violet-500/10 text-violet-600 border-violet-500/20 dark:text-violet-400"
2205
+ }
2206
+ };
2207
+ function getGroupTypeClasses(type) {
2208
+ return GROUP_TYPE_CLASSES[type] ?? GROUP_TYPE_CLASSES.default;
2209
+ }
2050
2210
  var ConditionGroup = memo(function ConditionGroup2({
2051
2211
  type,
2052
2212
  conditions: rawConditions,
@@ -2065,19 +2225,16 @@ var ConditionGroup = memo(function ConditionGroup2({
2065
2225
  handleMoveDown,
2066
2226
  handleAddCondition
2067
2227
  } = useConditionArray(rawConditions, onChange);
2068
- return /* @__PURE__ */ jsxs24(
2228
+ return /* @__PURE__ */ jsxs25(
2069
2229
  "div",
2070
2230
  {
2071
- className: cn(
2072
- "border-l-3 pl-3 pr-2 py-2 rounded-r-md",
2073
- type === "and" ? "border-primary/30" : "border-amber-500/30"
2074
- ),
2231
+ className: cn("border-l-3 pl-3 pr-2 py-2 rounded-r-md", getGroupTypeClasses(type).border),
2075
2232
  style: {
2076
2233
  backgroundColor: `oklch(from var(--color-muted) l c h / ${Math.min(0.2 + depth * 0.1, 0.5)})`
2077
2234
  },
2078
2235
  children: [
2079
- /* @__PURE__ */ jsxs24("div", { className: "mb-2 flex items-center gap-2", children: [
2080
- /* @__PURE__ */ jsxs24(
2236
+ /* @__PURE__ */ jsxs25("div", { className: "mb-2 flex items-center gap-2", children: [
2237
+ /* @__PURE__ */ jsxs25(
2081
2238
  Badge,
2082
2239
  {
2083
2240
  variant: "outline",
@@ -2086,19 +2243,19 @@ var ConditionGroup = memo(function ConditionGroup2({
2086
2243
  "L",
2087
2244
  depth,
2088
2245
  " | ",
2089
- type.toUpperCase()
2246
+ type
2090
2247
  ]
2091
2248
  }
2092
2249
  ),
2093
- /* @__PURE__ */ jsxs24("span", { className: "text-sm text-muted-foreground", children: [
2250
+ /* @__PURE__ */ jsxs25("span", { className: "text-sm text-muted-foreground", children: [
2094
2251
  conditions.length,
2095
2252
  " condition",
2096
2253
  conditions.length !== 1 ? "s" : ""
2097
2254
  ] }),
2098
- /* @__PURE__ */ jsx37("div", { className: "flex-1" }),
2099
- /* @__PURE__ */ jsxs24("div", { className: "flex shrink-0 gap-0.5", children: [
2100
- /* @__PURE__ */ jsx37(MoveButtons, { onMoveUp, onMoveDown, size: "h-6 w-6" }),
2101
- /* @__PURE__ */ jsx37(
2255
+ /* @__PURE__ */ jsx38("div", { className: "flex-1" }),
2256
+ /* @__PURE__ */ jsxs25("div", { className: "flex shrink-0 gap-0.5", children: [
2257
+ /* @__PURE__ */ jsx38(MoveButtons, { onMoveUp, onMoveDown, size: "h-6 w-6" }),
2258
+ /* @__PURE__ */ jsx38(
2102
2259
  Button,
2103
2260
  {
2104
2261
  variant: "ghost",
@@ -2106,24 +2263,21 @@ var ConditionGroup = memo(function ConditionGroup2({
2106
2263
  className: "h-6 w-6 text-destructive/60 hover:bg-destructive/10 hover:text-destructive",
2107
2264
  "aria-label": "Remove condition group",
2108
2265
  onClick: onRemove,
2109
- children: /* @__PURE__ */ jsx37(X, { className: "h-3.5 w-3.5" })
2266
+ children: /* @__PURE__ */ jsx38(X, { className: "h-3.5 w-3.5" })
2110
2267
  }
2111
2268
  )
2112
2269
  ] })
2113
2270
  ] }),
2114
- /* @__PURE__ */ jsx37("div", { className: "space-y-1.5", children: conditions.map((c, i) => /* @__PURE__ */ jsxs24(Fragment4, { children: [
2115
- i > 0 && /* @__PURE__ */ jsx37("div", { className: "flex", children: /* @__PURE__ */ jsx37(
2271
+ /* @__PURE__ */ jsx38("div", { className: "space-y-1.5", children: conditions.map((c, i) => /* @__PURE__ */ jsxs25(Fragment3, { children: [
2272
+ i > 0 && /* @__PURE__ */ jsx38("div", { className: "flex", children: /* @__PURE__ */ jsx38(
2116
2273
  Badge,
2117
2274
  {
2118
2275
  variant: "outline",
2119
- className: cn(
2120
- "select-none font-mono text-xs",
2121
- type === "and" ? "bg-primary/10 text-primary border-primary/20" : "bg-amber-500/10 text-amber-600 border-amber-500/20 dark:text-amber-400"
2122
- ),
2123
- children: type.toUpperCase()
2276
+ className: cn("select-none font-mono text-xs", getGroupTypeClasses(type).badge),
2277
+ children: type === "checkAnnotations" ? "and" : type
2124
2278
  }
2125
2279
  ) }),
2126
- /* @__PURE__ */ jsx37(
2280
+ /* @__PURE__ */ jsx38(
2127
2281
  ConditionBlock,
2128
2282
  {
2129
2283
  condition: c,
@@ -2136,15 +2290,18 @@ var ConditionGroup = memo(function ConditionGroup2({
2136
2290
  }
2137
2291
  )
2138
2292
  ] }, c.id)) }),
2139
- /* @__PURE__ */ jsx37("div", { className: "mt-2", children: /* @__PURE__ */ jsx37(AddConditionMenu, { onAdd: handleAddCondition }) })
2293
+ /* @__PURE__ */ jsx38("div", { className: "mt-2", children: /* @__PURE__ */ jsx38(AddConditionMenu, { onAdd: handleAddCondition }) })
2140
2294
  ]
2141
2295
  }
2142
2296
  );
2143
2297
  });
2144
2298
 
2145
2299
  // src/components/condition-builder/ConditionBlock.tsx
2146
- import { jsx as jsx38, jsxs as jsxs25 } from "react/jsx-runtime";
2300
+ import { jsx as jsx39, jsxs as jsxs26 } from "react/jsx-runtime";
2147
2301
  var GENERIC_ZOD_ERROR = "Invalid input";
2302
+ function TypeBadge({ label }) {
2303
+ return /* @__PURE__ */ jsx39("span", { className: "inline-flex h-6 shrink-0 items-center rounded-md bg-muted px-2 text-xs font-medium text-muted-foreground", children: label });
2304
+ }
2148
2305
  var ConditionBlock = memo2(function ConditionBlock2({
2149
2306
  condition,
2150
2307
  onChange,
@@ -2157,14 +2314,14 @@ var ConditionBlock = memo2(function ConditionBlock2({
2157
2314
  function handleChange(updated) {
2158
2315
  onChange(updated);
2159
2316
  }
2160
- if (isAndCondition(condition) || isOrCondition(condition)) {
2161
- return /* @__PURE__ */ jsx38(
2317
+ if (isAndCondition(condition) || isOrCondition(condition) || isCheckAnnotationsCondition(condition)) {
2318
+ return /* @__PURE__ */ jsx39(
2162
2319
  ConditionGroup,
2163
2320
  {
2164
2321
  type: condition.type,
2165
2322
  conditions: condition.conditions,
2166
2323
  onChange: (conditions) => handleChange(
2167
- condition.type === "and" ? buildAndCondition(conditions, condition.id) : buildOrCondition(conditions, condition.id)
2324
+ condition.type === "and" ? buildAndCondition(conditions, condition.id) : condition.type === "or" ? buildOrCondition(conditions, condition.id) : buildCheckAnnotationsCondition(conditions, condition.id)
2168
2325
  ),
2169
2326
  onRemove,
2170
2327
  onMoveUp,
@@ -2177,31 +2334,28 @@ var ConditionBlock = memo2(function ConditionBlock2({
2177
2334
  const extensions = useConditionExtensions();
2178
2335
  const meta8 = getConditionMeta(condition.type) ?? extensions?.extraConditionTypes.find((m) => m.type === condition.type);
2179
2336
  const label = meta8?.label ?? (condition.type || "Custom");
2180
- return /* @__PURE__ */ jsxs25("div", { className: "border border-border bg-card p-2 space-y-2", children: [
2181
- /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2", children: [
2182
- /* @__PURE__ */ jsx38("span", { className: "flex h-8 shrink-0 items-center text-sm font-medium text-muted-foreground", children: label }),
2183
- /* @__PURE__ */ jsx38("div", { className: "flex-1" }),
2184
- /* @__PURE__ */ jsxs25("div", { className: "flex shrink-0 gap-0.5", children: [
2185
- /* @__PURE__ */ jsx38(MoveButtons, { onMoveUp, onMoveDown }),
2186
- /* @__PURE__ */ jsx38(
2187
- Button,
2188
- {
2189
- variant: "ghost",
2190
- size: "icon",
2191
- className: "h-8 w-8 text-destructive/60 hover:bg-destructive/10 hover:text-destructive",
2192
- onClick: onRemove,
2193
- "aria-label": "Remove condition",
2194
- children: /* @__PURE__ */ jsx38(X2, { className: "h-3.5 w-3.5" })
2195
- }
2196
- )
2197
- ] })
2198
- ] }),
2199
- /* @__PURE__ */ jsx38(ConditionValueEditor, { condition, onChange: handleChange }),
2200
- (errors?.length ?? 0) > 0 && /* @__PURE__ */ jsx38("div", { className: "space-y-0.5", children: errors.map((err, i) => {
2337
+ const typeBadge = /* @__PURE__ */ jsx39(TypeBadge, { label });
2338
+ const controls = /* @__PURE__ */ jsxs26("div", { className: "flex shrink-0 gap-0.5", children: [
2339
+ /* @__PURE__ */ jsx39(MoveButtons, { onMoveUp, onMoveDown }),
2340
+ /* @__PURE__ */ jsx39(
2341
+ Button,
2342
+ {
2343
+ variant: "ghost",
2344
+ size: "icon",
2345
+ className: "h-8 w-8 text-destructive/60 hover:bg-destructive/10 hover:text-destructive",
2346
+ onClick: onRemove,
2347
+ "aria-label": "Remove condition",
2348
+ children: /* @__PURE__ */ jsx39(X2, { className: "h-3.5 w-3.5" })
2349
+ }
2350
+ )
2351
+ ] });
2352
+ return /* @__PURE__ */ jsxs26("div", { className: "border border-border bg-card p-2 space-y-2", children: [
2353
+ /* @__PURE__ */ jsx39(ConditionBlockProvider, { typeBadge, controls, children: /* @__PURE__ */ jsx39(ConditionValueEditor, { condition, onChange: handleChange }) }),
2354
+ (errors?.length ?? 0) > 0 && /* @__PURE__ */ jsx39("div", { className: "space-y-0.5", children: errors.map((err, i) => {
2201
2355
  const field = err.path.length > 0 ? err.path.join(".") : null;
2202
2356
  const msg = err.message === GENERIC_ZOD_ERROR ? "Invalid condition \u2014 check required fields" : err.message;
2203
- return /* @__PURE__ */ jsxs25("p", { className: "text-xs text-destructive", children: [
2204
- field && /* @__PURE__ */ jsxs25("span", { className: "font-mono text-destructive/70", children: [
2357
+ return /* @__PURE__ */ jsxs26("p", { className: "text-xs text-destructive", children: [
2358
+ field && /* @__PURE__ */ jsxs26("span", { className: "font-mono text-destructive/70", children: [
2205
2359
  field,
2206
2360
  ": "
2207
2361
  ] }),
@@ -2212,7 +2366,7 @@ var ConditionBlock = memo2(function ConditionBlock2({
2212
2366
  });
2213
2367
 
2214
2368
  // src/components/condition-builder/ConditionBuilder.tsx
2215
- import { jsx as jsx39, jsxs as jsxs26 } from "react/jsx-runtime";
2369
+ import { jsx as jsx40, jsxs as jsxs27 } from "react/jsx-runtime";
2216
2370
  function ConditionBuilder({
2217
2371
  conditions: rawConditions,
2218
2372
  onChange,
@@ -2226,23 +2380,23 @@ function ConditionBuilder({
2226
2380
  handleMoveDown,
2227
2381
  handleAddCondition
2228
2382
  } = useConditionArray(rawConditions, onChange);
2229
- return /* @__PURE__ */ jsx39(ErrorBoundary, { children: /* @__PURE__ */ jsxs26("div", { className: "space-y-1.5", children: [
2230
- conditions.length > 0 && /* @__PURE__ */ jsxs26("div", { className: "border-l-3 pl-3 py-2 bg-muted/20 rounded-r-md border-primary/30", children: [
2231
- /* @__PURE__ */ jsx39("div", { className: "mb-2 flex items-center gap-2", children: /* @__PURE__ */ jsxs26("span", { className: "text-sm text-muted-foreground", children: [
2383
+ return /* @__PURE__ */ jsx40(ErrorBoundary, { children: /* @__PURE__ */ jsxs27("div", { className: "space-y-1.5", children: [
2384
+ conditions.length > 0 && /* @__PURE__ */ jsxs27("div", { className: "border-l-3 pl-3 py-2 bg-muted/20 rounded-r-md border-primary/30", children: [
2385
+ /* @__PURE__ */ jsx40("div", { className: "mb-2 flex items-center gap-2", children: /* @__PURE__ */ jsxs27("span", { className: "text-sm text-muted-foreground", children: [
2232
2386
  conditions.length,
2233
2387
  " condition",
2234
2388
  conditions.length !== 1 ? "s" : ""
2235
2389
  ] }) }),
2236
- /* @__PURE__ */ jsx39("div", { className: "space-y-1.5", children: conditions.map((c, i) => /* @__PURE__ */ jsxs26(Fragment5, { children: [
2237
- i > 0 && /* @__PURE__ */ jsx39("div", { className: "flex", children: /* @__PURE__ */ jsx39(
2390
+ /* @__PURE__ */ jsx40("div", { className: "space-y-1.5", children: conditions.map((c, i) => /* @__PURE__ */ jsxs27(Fragment4, { children: [
2391
+ i > 0 && /* @__PURE__ */ jsx40("div", { className: "flex", children: /* @__PURE__ */ jsx40(
2238
2392
  Badge,
2239
2393
  {
2240
2394
  variant: "outline",
2241
2395
  className: "select-none font-mono text-xs bg-primary/10 text-primary border-primary/20",
2242
- children: "AND"
2396
+ children: "and"
2243
2397
  }
2244
2398
  ) }),
2245
- /* @__PURE__ */ jsx39(
2399
+ /* @__PURE__ */ jsx40(
2246
2400
  ConditionBlock,
2247
2401
  {
2248
2402
  condition: c,
@@ -2256,13 +2410,13 @@ function ConditionBuilder({
2256
2410
  )
2257
2411
  ] }, c.id)) })
2258
2412
  ] }),
2259
- /* @__PURE__ */ jsx39(AddConditionMenu, { onAdd: handleAddCondition })
2413
+ /* @__PURE__ */ jsx40(AddConditionMenu, { onAdd: handleAddCondition })
2260
2414
  ] }) });
2261
2415
  }
2262
2416
 
2263
2417
  // src/components/variation-editor/VariationCard.tsx
2264
- import { memo as memo3, useState as useState6 } from "react";
2265
- import { Collapsible as CollapsiblePrimitive } from "radix-ui";
2418
+ import { memo as memo3, useState as useState7 } from "react";
2419
+ import { Collapsible } from "@base-ui/react/collapsible";
2266
2420
  import { ChevronRight, Eye, GripVertical, Trash2 } from "lucide-react";
2267
2421
 
2268
2422
  // src/utils/condition-summary.ts
@@ -2330,10 +2484,10 @@ function formatOne(c, indent) {
2330
2484
  }
2331
2485
  const meta8 = getConditionMeta(c.type);
2332
2486
  const label = meta8?.label ?? c.type;
2333
- const { op, val } = formatLeafOperator(c);
2487
+ const { op: op2, val } = formatLeafOperator(c);
2334
2488
  const key = "key" in c ? String(c.key) : "";
2335
- if (key && val) return [`${prefix}${key} ${op} ${val}`];
2336
- if (val) return [`${prefix}${label} ${op} ${val}`];
2489
+ if (key && val) return [`${prefix}${key} ${op2} ${val}`];
2490
+ if (val) return [`${prefix}${label} ${op2} ${val}`];
2337
2491
  return [`${prefix}${label}`];
2338
2492
  }
2339
2493
  function formatConditionSummary(conditions) {
@@ -2347,7 +2501,7 @@ function formatConditionSummary(conditions) {
2347
2501
  }
2348
2502
 
2349
2503
  // src/components/variation-editor/VariationCard.tsx
2350
- import { jsx as jsx40, jsxs as jsxs27 } from "react/jsx-runtime";
2504
+ import { jsx as jsx41, jsxs as jsxs28 } from "react/jsx-runtime";
2351
2505
  var VariationCard = memo3(function VariationCard2({
2352
2506
  variation,
2353
2507
  index,
@@ -2356,34 +2510,39 @@ var VariationCard = memo3(function VariationCard2({
2356
2510
  onRemove,
2357
2511
  dragHandleProps
2358
2512
  }) {
2359
- const [open, setOpen] = useState6(false);
2513
+ const [open, setOpen] = useState7(false);
2360
2514
  const conditionCount = variation.conditions?.length ?? 0;
2361
- return /* @__PURE__ */ jsx40(CollapsiblePrimitive.Root, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs27("div", { className: "rounded-lg border border-border/50 bg-card transition-colors hover:border-primary/30", children: [
2362
- /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2 px-3 py-2.5", children: [
2363
- /* @__PURE__ */ jsx40(
2515
+ return /* @__PURE__ */ jsx41(Collapsible.Root, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs28("div", { className: "rounded-lg border border-border/50 bg-card transition-colors hover:border-primary/30", children: [
2516
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2 px-3 py-2.5", children: [
2517
+ /* @__PURE__ */ jsx41(
2364
2518
  "button",
2365
2519
  {
2366
2520
  type: "button",
2367
2521
  className: "cursor-grab touch-none text-muted-foreground/50 hover:text-muted-foreground",
2368
2522
  "aria-label": "Drag to reorder",
2369
2523
  ...dragHandleProps,
2370
- children: /* @__PURE__ */ jsx40(GripVertical, { className: "h-4 w-4" })
2524
+ children: /* @__PURE__ */ jsx41(GripVertical, { className: "h-4 w-4" })
2371
2525
  }
2372
2526
  ),
2373
- /* @__PURE__ */ jsx40(CollapsiblePrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs27(
2374
- "button",
2527
+ /* @__PURE__ */ jsxs28(
2528
+ Collapsible.Trigger,
2375
2529
  {
2376
- type: "button",
2377
- className: "flex flex-1 items-center gap-2 text-left hover:cursor-pointer",
2530
+ render: /* @__PURE__ */ jsx41(
2531
+ "button",
2532
+ {
2533
+ type: "button",
2534
+ className: "flex flex-1 items-center gap-2 text-left hover:cursor-pointer"
2535
+ }
2536
+ ),
2378
2537
  children: [
2379
- /* @__PURE__ */ jsx40(Badge, { variant: "secondary", className: "font-mono text-xs", children: index }),
2380
- /* @__PURE__ */ jsx40("span", { className: "flex-1 truncate text-sm text-muted-foreground", children: variation.description || String(variation.value ?? "") }),
2381
- conditionCount > 0 && /* @__PURE__ */ jsxs27("span", { className: "text-xs text-muted-foreground/60", children: [
2538
+ /* @__PURE__ */ jsx41(Badge, { variant: "secondary", className: "font-mono text-xs", children: index }),
2539
+ /* @__PURE__ */ jsx41("span", { className: "flex-1 truncate text-sm text-muted-foreground", children: variation.description || String(variation.value ?? "") }),
2540
+ conditionCount > 0 && /* @__PURE__ */ jsxs28("span", { className: "text-xs text-muted-foreground/60", children: [
2382
2541
  conditionCount,
2383
2542
  " ",
2384
2543
  conditionCount === 1 ? "condition" : "conditions"
2385
2544
  ] }),
2386
- /* @__PURE__ */ jsx40(
2545
+ /* @__PURE__ */ jsx41(
2387
2546
  ChevronRight,
2388
2547
  {
2389
2548
  className: `h-4 w-4 text-muted-foreground/60 transition-transform ${open ? "rotate-90" : ""}`
@@ -2391,39 +2550,39 @@ var VariationCard = memo3(function VariationCard2({
2391
2550
  )
2392
2551
  ]
2393
2552
  }
2394
- ) })
2553
+ )
2395
2554
  ] }),
2396
- /* @__PURE__ */ jsx40(CollapsiblePrimitive.Content, { children: /* @__PURE__ */ jsxs27("div", { className: "space-y-4 border-t border-border/40 px-4 py-4", children: [
2397
- /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
2398
- /* @__PURE__ */ jsx40(Label, { className: "text-xs font-medium uppercase tracking-wider text-muted-foreground", children: "Value" }),
2399
- /* @__PURE__ */ jsx40(
2555
+ /* @__PURE__ */ jsx41(Collapsible.Panel, { children: /* @__PURE__ */ jsxs28("div", { className: "space-y-4 border-t border-border/40 px-4 py-4", children: [
2556
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
2557
+ /* @__PURE__ */ jsx41(Label, { className: "text-xs font-medium uppercase tracking-wider text-muted-foreground", children: "Value" }),
2558
+ /* @__PURE__ */ jsx41(
2400
2559
  ConfirmDialog,
2401
2560
  {
2402
2561
  title: "Remove variation?",
2403
2562
  description: `This will delete variation ${index} and all its conditions. This action cannot be undone.`,
2404
2563
  actionLabel: "Remove",
2405
2564
  onConfirm: onRemove,
2406
- children: /* @__PURE__ */ jsx40(
2565
+ children: /* @__PURE__ */ jsx41(
2407
2566
  Button,
2408
2567
  {
2409
2568
  variant: "ghost",
2410
2569
  size: "icon-xs",
2411
2570
  className: "shrink-0 text-destructive/60 hover:bg-destructive/10 hover:text-destructive",
2412
2571
  "aria-label": "Remove variation",
2413
- children: /* @__PURE__ */ jsx40(Trash2, { className: "h-3.5 w-3.5" })
2572
+ children: /* @__PURE__ */ jsx41(Trash2, { className: "h-3.5 w-3.5" })
2414
2573
  }
2415
2574
  )
2416
2575
  }
2417
2576
  )
2418
2577
  ] }),
2419
- /* @__PURE__ */ jsx40("div", { children: /* @__PURE__ */ jsx40(
2578
+ /* @__PURE__ */ jsx41("div", { children: /* @__PURE__ */ jsx41(
2420
2579
  ValueInput,
2421
2580
  {
2422
2581
  value: variation.value,
2423
2582
  onChange: (value) => onChange({ ...variation, value })
2424
2583
  }
2425
2584
  ) }),
2426
- /* @__PURE__ */ jsx40(
2585
+ /* @__PURE__ */ jsx41(
2427
2586
  "input",
2428
2587
  {
2429
2588
  className: "w-full border-none bg-transparent text-sm text-muted-foreground placeholder:text-muted-foreground/50 focus:text-foreground focus:outline-none",
@@ -2435,28 +2594,33 @@ var VariationCard = memo3(function VariationCard2({
2435
2594
  })
2436
2595
  }
2437
2596
  ),
2438
- /* @__PURE__ */ jsx40("div", { className: "border-t border-border/40 pt-4", children: /* @__PURE__ */ jsxs27("div", { className: "rounded-lg border border-border/40 bg-muted/30 p-3", children: [
2439
- /* @__PURE__ */ jsxs27("div", { className: "mb-1.5 flex items-center gap-1.5", children: [
2440
- /* @__PURE__ */ jsx40(Label, { className: "text-sm font-medium", children: "Conditions" }),
2441
- conditionCount > 0 && /* @__PURE__ */ jsxs27(Dialog, { children: [
2442
- /* @__PURE__ */ jsx40(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx40(
2443
- "button",
2597
+ /* @__PURE__ */ jsx41("div", { className: "border-t border-border/40 pt-4", children: /* @__PURE__ */ jsxs28("div", { className: "rounded-lg border border-border/40 bg-muted/30 p-3", children: [
2598
+ /* @__PURE__ */ jsxs28("div", { className: "mb-1.5 flex items-center gap-1.5", children: [
2599
+ /* @__PURE__ */ jsx41(Label, { className: "text-sm font-medium", children: "Conditions" }),
2600
+ conditionCount > 0 && /* @__PURE__ */ jsxs28(Dialog, { children: [
2601
+ /* @__PURE__ */ jsx41(
2602
+ DialogTrigger,
2444
2603
  {
2445
- type: "button",
2446
- className: "inline-flex items-center justify-center rounded p-0.5 text-muted-foreground/60 hover:text-muted-foreground",
2447
- children: /* @__PURE__ */ jsx40(Eye, { className: "h-3.5 w-3.5" })
2604
+ render: /* @__PURE__ */ jsx41(
2605
+ "button",
2606
+ {
2607
+ type: "button",
2608
+ className: "inline-flex items-center justify-center rounded p-0.5 text-muted-foreground/60 hover:text-muted-foreground"
2609
+ }
2610
+ ),
2611
+ children: /* @__PURE__ */ jsx41(Eye, { className: "h-3.5 w-3.5" })
2448
2612
  }
2449
- ) }),
2450
- /* @__PURE__ */ jsxs27(DialogContent, { children: [
2451
- /* @__PURE__ */ jsxs27(DialogHeader, { children: [
2452
- /* @__PURE__ */ jsx40(DialogTitle, { children: "Condition Summary" }),
2453
- /* @__PURE__ */ jsx40(DialogDescription, { children: "Evaluation logic for this variation" })
2613
+ ),
2614
+ /* @__PURE__ */ jsxs28(DialogContent, { children: [
2615
+ /* @__PURE__ */ jsxs28(DialogHeader, { children: [
2616
+ /* @__PURE__ */ jsx41(DialogTitle, { children: "Condition Summary" }),
2617
+ /* @__PURE__ */ jsx41(DialogDescription, { children: "Evaluation logic for this variation" })
2454
2618
  ] }),
2455
- /* @__PURE__ */ jsx40("pre", { className: "rounded-md bg-muted p-4 font-mono text-xs whitespace-pre overflow-auto max-h-80", children: formatConditionSummary(variation.conditions ?? []) })
2619
+ /* @__PURE__ */ jsx41("pre", { className: "rounded-md bg-muted p-4 font-mono text-xs whitespace-pre overflow-auto max-h-80", children: formatConditionSummary(variation.conditions ?? []) })
2456
2620
  ] })
2457
2621
  ] })
2458
2622
  ] }),
2459
- /* @__PURE__ */ jsx40(
2623
+ /* @__PURE__ */ jsx41(
2460
2624
  ConditionBuilder,
2461
2625
  {
2462
2626
  conditions: variation.conditions ?? [],
@@ -2468,7 +2632,7 @@ var VariationCard = memo3(function VariationCard2({
2468
2632
  }
2469
2633
  )
2470
2634
  ] }) }),
2471
- /* @__PURE__ */ jsx40(
2635
+ /* @__PURE__ */ jsx41(
2472
2636
  ValidationMessage,
2473
2637
  {
2474
2638
  errors: validationErrors?.filter((err) => err.path[0] !== "conditions")
@@ -2479,7 +2643,7 @@ var VariationCard = memo3(function VariationCard2({
2479
2643
  });
2480
2644
 
2481
2645
  // src/components/variation-editor/VariationList.tsx
2482
- import { useCallback as useCallback10, useMemo as useMemo9 } from "react";
2646
+ import { useCallback as useCallback11, useMemo as useMemo10 } from "react";
2483
2647
  import {
2484
2648
  DndContext,
2485
2649
  closestCenter,
@@ -2495,7 +2659,7 @@ import {
2495
2659
  arrayMove
2496
2660
  } from "@dnd-kit/sortable";
2497
2661
  import { CSS } from "@dnd-kit/utilities";
2498
- import { jsx as jsx41 } from "react/jsx-runtime";
2662
+ import { jsx as jsx42 } from "react/jsx-runtime";
2499
2663
  function SortableVariation({
2500
2664
  id,
2501
2665
  variation,
@@ -2518,7 +2682,7 @@ function SortableVariation({
2518
2682
  transition,
2519
2683
  opacity: isDragging ? 0.5 : 1
2520
2684
  };
2521
- return /* @__PURE__ */ jsx41(
2685
+ return /* @__PURE__ */ jsx42(
2522
2686
  "div",
2523
2687
  {
2524
2688
  ref: setNodeRef,
@@ -2527,7 +2691,7 @@ function SortableVariation({
2527
2691
  animationDelay: `${index * 50}ms`
2528
2692
  },
2529
2693
  className: "animate-fade-up",
2530
- children: /* @__PURE__ */ jsx41(
2694
+ children: /* @__PURE__ */ jsx42(
2531
2695
  VariationCard,
2532
2696
  {
2533
2697
  variation,
@@ -2550,9 +2714,9 @@ function VariationList({
2550
2714
  useSensor(PointerSensor, { activationConstraint: { distance: 8 } }),
2551
2715
  useSensor(KeyboardSensor)
2552
2716
  );
2553
- const variations = useMemo9(() => ensureIds(rawVariations), [rawVariations]);
2554
- const sortableIds = useMemo9(() => variations.map((v) => v.id), [variations]);
2555
- const handleDragEnd = useCallback10(
2717
+ const variations = useMemo10(() => ensureIds(rawVariations), [rawVariations]);
2718
+ const sortableIds = useMemo10(() => variations.map((v) => v.id), [variations]);
2719
+ const handleDragEnd = useCallback11(
2556
2720
  (event) => {
2557
2721
  const { active, over } = event;
2558
2722
  if (!over || active.id === over.id) return;
@@ -2563,7 +2727,7 @@ function VariationList({
2563
2727
  },
2564
2728
  [sortableIds, variations, onChange]
2565
2729
  );
2566
- const handleVariationChange = useCallback10(
2730
+ const handleVariationChange = useCallback11(
2567
2731
  (index, updated) => {
2568
2732
  const next2 = [...variations];
2569
2733
  next2[index] = updated;
@@ -2571,13 +2735,13 @@ function VariationList({
2571
2735
  },
2572
2736
  [variations, onChange]
2573
2737
  );
2574
- const handleRemove = useCallback10(
2738
+ const handleRemove = useCallback11(
2575
2739
  (index) => {
2576
2740
  onChange(variations.filter((_, i) => i !== index));
2577
2741
  },
2578
2742
  [variations, onChange]
2579
2743
  );
2580
- return /* @__PURE__ */ jsx41("div", { className: "space-y-3", children: /* @__PURE__ */ jsx41(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsx41(SortableContext, { items: sortableIds, strategy: verticalListSortingStrategy, children: variations.map((v, i) => /* @__PURE__ */ jsx41(
2744
+ return /* @__PURE__ */ jsx42("div", { className: "space-y-3", children: /* @__PURE__ */ jsx42(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsx42(SortableContext, { items: sortableIds, strategy: verticalListSortingStrategy, children: variations.map((v, i) => /* @__PURE__ */ jsx42(
2581
2745
  SortableVariation,
2582
2746
  {
2583
2747
  id: v.id,
@@ -2592,9 +2756,18 @@ function VariationList({
2592
2756
  }
2593
2757
 
2594
2758
  // src/components/definition-editor/DefinitionEditor.tsx
2595
- import { useRef as useRef4, useState as useState7 } from "react";
2596
- import { AlertTriangle, Plus as Plus2, Save, Undo2 } from "lucide-react";
2597
- import { jsx as jsx42, jsxs as jsxs28 } from "react/jsx-runtime";
2759
+ import { useRef as useRef5, useState as useState8 } from "react";
2760
+ import {
2761
+ AlertTriangle,
2762
+ Download,
2763
+ MoreHorizontal,
2764
+ Plus as Plus2,
2765
+ RefreshCw,
2766
+ Save,
2767
+ Trash2 as Trash22,
2768
+ Undo2
2769
+ } from "lucide-react";
2770
+ import { jsx as jsx43, jsxs as jsxs29 } from "react/jsx-runtime";
2598
2771
  function DefinitionEditor({
2599
2772
  definitionKey,
2600
2773
  definition,
@@ -2604,11 +2777,15 @@ function DefinitionEditor({
2604
2777
  onUpdate,
2605
2778
  onRename,
2606
2779
  onSave,
2607
- onDiscard
2780
+ onDiscard,
2781
+ onRemove,
2782
+ onExport,
2783
+ onRefresh
2608
2784
  }) {
2609
- const [editingKey, setEditingKey] = useState7(false);
2610
- const [keyDraft, setKeyDraft] = useState7(definitionKey);
2611
- const prevKeyRef = useRef4(definitionKey);
2785
+ const [editingKey, setEditingKey] = useState8(false);
2786
+ const [deleteOpen, setDeleteOpen] = useState8(false);
2787
+ const [keyDraft, setKeyDraft] = useState8(definitionKey);
2788
+ const prevKeyRef = useRef5(definitionKey);
2612
2789
  if (prevKeyRef.current !== definitionKey) {
2613
2790
  prevKeyRef.current = definitionKey;
2614
2791
  setKeyDraft(definitionKey);
@@ -2633,9 +2810,9 @@ function DefinitionEditor({
2633
2810
  });
2634
2811
  }
2635
2812
  const errorCount = validationErrors?.length ?? 0;
2636
- return /* @__PURE__ */ jsxs28("div", { className: "flex h-full flex-col overflow-hidden", children: [
2637
- /* @__PURE__ */ jsxs28("div", { className: "flex shrink-0 items-center justify-end gap-2 border-b border-border bg-muted/30 px-4 py-2", children: [
2638
- /* @__PURE__ */ jsxs28(
2813
+ return /* @__PURE__ */ jsxs29("div", { className: "flex h-full flex-col overflow-hidden", children: [
2814
+ /* @__PURE__ */ jsxs29("div", { className: "flex h-12 shrink-0 items-center justify-end gap-2 border-b border-border bg-muted/30 px-4", children: [
2815
+ /* @__PURE__ */ jsxs29(
2639
2816
  Button,
2640
2817
  {
2641
2818
  variant: isDirty ? "default" : "ghost",
@@ -2643,38 +2820,86 @@ function DefinitionEditor({
2643
2820
  disabled: !isDirty || isPending,
2644
2821
  onClick: onSave,
2645
2822
  children: [
2646
- /* @__PURE__ */ jsx42(Save, { className: "mr-1.5 h-4 w-4" }),
2823
+ /* @__PURE__ */ jsx43(Save, { className: "mr-1.5 h-4 w-4" }),
2647
2824
  "Save"
2648
2825
  ]
2649
2826
  }
2650
2827
  ),
2651
- onDiscard ? /* @__PURE__ */ jsx42(
2828
+ onDiscard ? /* @__PURE__ */ jsx43(
2652
2829
  ConfirmDialog,
2653
2830
  {
2654
2831
  title: "Discard changes?",
2655
2832
  description: "This will revert all unsaved changes to this definition. This action cannot be undone.",
2656
2833
  actionLabel: "Discard",
2657
2834
  onConfirm: onDiscard,
2658
- children: /* @__PURE__ */ jsxs28(Button, { variant: "ghost", size: "sm", disabled: !isDirty || isPending, children: [
2659
- /* @__PURE__ */ jsx42(Undo2, { className: "mr-1.5 h-4 w-4" }),
2835
+ children: /* @__PURE__ */ jsxs29(Button, { variant: "ghost", size: "sm", disabled: !isDirty || isPending, children: [
2836
+ /* @__PURE__ */ jsx43(Undo2, { className: "mr-1.5 h-4 w-4" }),
2660
2837
  "Discard"
2661
2838
  ] })
2662
2839
  }
2663
- ) : /* @__PURE__ */ jsxs28(Button, { variant: "ghost", size: "sm", disabled: true, children: [
2664
- /* @__PURE__ */ jsx42(Undo2, { className: "mr-1.5 h-4 w-4" }),
2840
+ ) : /* @__PURE__ */ jsxs29(Button, { variant: "ghost", size: "sm", disabled: true, children: [
2841
+ /* @__PURE__ */ jsx43(Undo2, { className: "mr-1.5 h-4 w-4" }),
2665
2842
  "Discard"
2666
- ] })
2843
+ ] }),
2844
+ onExport && /* @__PURE__ */ jsxs29(Menu, { children: [
2845
+ /* @__PURE__ */ jsxs29(
2846
+ MenuTrigger,
2847
+ {
2848
+ render: /* @__PURE__ */ jsx43(Button, { variant: "ghost", size: "sm", disabled: isDirty || isPending }),
2849
+ children: [
2850
+ /* @__PURE__ */ jsx43(Download, { className: "mr-1.5 h-4 w-4" }),
2851
+ "Export"
2852
+ ]
2853
+ }
2854
+ ),
2855
+ /* @__PURE__ */ jsxs29(MenuContent, { children: [
2856
+ /* @__PURE__ */ jsx43(MenuItem, { onClick: () => onExport("yaml"), children: "Export as YAML" }),
2857
+ /* @__PURE__ */ jsx43(MenuItem, { onClick: () => onExport("json"), children: "Export as JSON" })
2858
+ ] })
2859
+ ] }),
2860
+ (onRemove || onRefresh) && /* @__PURE__ */ jsxs29(Menu, { children: [
2861
+ /* @__PURE__ */ jsx43(MenuTrigger, { render: /* @__PURE__ */ jsx43(Button, { variant: "ghost", size: "sm", "aria-label": "More actions" }), children: /* @__PURE__ */ jsx43(MoreHorizontal, { className: "h-4 w-4" }) }),
2862
+ /* @__PURE__ */ jsxs29(MenuContent, { children: [
2863
+ onRefresh && /* @__PURE__ */ jsxs29(MenuItem, { disabled: isDirty || isPending, onClick: onRefresh, children: [
2864
+ /* @__PURE__ */ jsx43(RefreshCw, { className: "mr-1.5 h-4 w-4" }),
2865
+ "Refresh from server"
2866
+ ] }),
2867
+ onRemove && /* @__PURE__ */ jsxs29(
2868
+ MenuItem,
2869
+ {
2870
+ className: "text-destructive/60 hover:text-destructive",
2871
+ onClick: () => setDeleteOpen(true),
2872
+ children: [
2873
+ /* @__PURE__ */ jsx43(Trash22, { className: "mr-1.5 h-4 w-4" }),
2874
+ "Delete"
2875
+ ]
2876
+ }
2877
+ )
2878
+ ] })
2879
+ ] }),
2880
+ onRemove && /* @__PURE__ */ jsx43(
2881
+ ConfirmDialog,
2882
+ {
2883
+ title: "Delete definition?",
2884
+ description: `This will permanently remove "${definitionKey}" and all its variations. This action cannot be undone.`,
2885
+ actionLabel: "Delete",
2886
+ open: deleteOpen,
2887
+ onOpenChange: setDeleteOpen,
2888
+ onConfirm: onRemove,
2889
+ children: /* @__PURE__ */ jsx43("span", {})
2890
+ }
2891
+ )
2667
2892
  ] }),
2668
- errorCount > 0 && /* @__PURE__ */ jsx42("div", { className: "shrink-0 border-b border-destructive/30 bg-destructive/10 px-4 py-2", children: /* @__PURE__ */ jsxs28("p", { className: "flex items-center gap-1.5 text-xs font-medium text-destructive", children: [
2669
- /* @__PURE__ */ jsx42(AlertTriangle, { className: "h-3.5 w-3.5" }),
2893
+ errorCount > 0 && /* @__PURE__ */ jsx43("div", { className: "shrink-0 border-b border-destructive/30 bg-destructive/10 px-4 py-2", children: /* @__PURE__ */ jsxs29("p", { className: "flex items-center gap-1.5 text-xs font-medium text-destructive", children: [
2894
+ /* @__PURE__ */ jsx43(AlertTriangle, { className: "h-3.5 w-3.5" }),
2670
2895
  errorCount,
2671
2896
  " validation error",
2672
2897
  errorCount !== 1 ? "s" : "",
2673
2898
  " \u2014 fix the highlighted fields below"
2674
2899
  ] }) }),
2675
- /* @__PURE__ */ jsx42("div", { className: "shrink-0 border-b border-border/50 mx-auto w-full max-w-3xl px-8 pt-8 pb-4 space-y-3", children: /* @__PURE__ */ jsxs28("div", { className: "space-y-3", children: [
2676
- /* @__PURE__ */ jsxs28("div", { className: "flex items-start justify-between gap-4", children: [
2677
- /* @__PURE__ */ jsx42("div", { className: "flex-1", children: editingKey ? /* @__PURE__ */ jsx42(
2900
+ /* @__PURE__ */ jsx43("div", { className: "shrink-0 border-b border-border/50 mx-auto w-full max-w-3xl px-8 pt-8 pb-4 space-y-3", children: /* @__PURE__ */ jsxs29("div", { className: "space-y-3", children: [
2901
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-start justify-between gap-4", children: [
2902
+ /* @__PURE__ */ jsx43("div", { className: "flex-1", children: editingKey ? /* @__PURE__ */ jsx43(
2678
2903
  Input,
2679
2904
  {
2680
2905
  className: "h-auto border-none bg-transparent px-0 font-mono text-2xl font-semibold shadow-none focus-visible:ring-0",
@@ -2690,7 +2915,7 @@ function DefinitionEditor({
2690
2915
  }
2691
2916
  }
2692
2917
  }
2693
- ) : /* @__PURE__ */ jsx42(
2918
+ ) : /* @__PURE__ */ jsx43(
2694
2919
  "button",
2695
2920
  {
2696
2921
  type: "button",
@@ -2703,9 +2928,9 @@ function DefinitionEditor({
2703
2928
  children: definitionKey
2704
2929
  }
2705
2930
  ) }),
2706
- /* @__PURE__ */ jsxs28("div", { className: "flex shrink-0 items-center gap-2 pt-1.5", children: [
2707
- /* @__PURE__ */ jsx42(Label, { htmlFor: "definition-active", className: "text-xs text-muted-foreground", children: "Active" }),
2708
- /* @__PURE__ */ jsx42(
2931
+ /* @__PURE__ */ jsxs29("div", { className: "flex shrink-0 items-center gap-2 pt-1.5", children: [
2932
+ /* @__PURE__ */ jsx43(Label, { htmlFor: "definition-active", className: "text-xs text-muted-foreground", children: "Active" }),
2933
+ /* @__PURE__ */ jsx43(
2709
2934
  Switch,
2710
2935
  {
2711
2936
  id: "definition-active",
@@ -2718,7 +2943,7 @@ function DefinitionEditor({
2718
2943
  )
2719
2944
  ] })
2720
2945
  ] }),
2721
- /* @__PURE__ */ jsx42(
2946
+ /* @__PURE__ */ jsx43(
2722
2947
  "input",
2723
2948
  {
2724
2949
  className: "w-full border-none bg-transparent text-sm text-muted-foreground placeholder:text-muted-foreground/50 focus:text-foreground focus:outline-none",
@@ -2732,10 +2957,10 @@ function DefinitionEditor({
2732
2957
  }
2733
2958
  )
2734
2959
  ] }) }),
2735
- /* @__PURE__ */ jsx42("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ jsx42("div", { className: "mx-auto w-full max-w-3xl px-8 py-8 space-y-4", children: /* @__PURE__ */ jsxs28("div", { className: "space-y-4", children: [
2736
- /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
2737
- /* @__PURE__ */ jsx42("span", { className: "text-xs font-medium uppercase tracking-wider text-muted-foreground", children: "Variations" }),
2738
- /* @__PURE__ */ jsxs28(
2960
+ /* @__PURE__ */ jsx43("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ jsx43("div", { className: "mx-auto w-full max-w-3xl px-8 py-8 space-y-4", children: /* @__PURE__ */ jsxs29("div", { className: "space-y-4", children: [
2961
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between", children: [
2962
+ /* @__PURE__ */ jsx43("span", { className: "text-xs font-medium uppercase tracking-wider text-muted-foreground", children: "Variations" }),
2963
+ /* @__PURE__ */ jsxs29(
2739
2964
  Button,
2740
2965
  {
2741
2966
  variant: "ghost",
@@ -2743,13 +2968,13 @@ function DefinitionEditor({
2743
2968
  className: "h-7 text-xs text-muted-foreground",
2744
2969
  onClick: handleAddVariation,
2745
2970
  children: [
2746
- /* @__PURE__ */ jsx42(Plus2, { className: "mr-1 h-3 w-3" }),
2971
+ /* @__PURE__ */ jsx43(Plus2, { className: "mr-1 h-3 w-3" }),
2747
2972
  "Add"
2748
2973
  ]
2749
2974
  }
2750
2975
  )
2751
2976
  ] }),
2752
- /* @__PURE__ */ jsx42(
2977
+ /* @__PURE__ */ jsx43(
2753
2978
  VariationList,
2754
2979
  {
2755
2980
  variations: definition.variations,
@@ -2757,14 +2982,14 @@ function DefinitionEditor({
2757
2982
  onChange: (variations) => onUpdate({ ...definition, variations })
2758
2983
  }
2759
2984
  ),
2760
- definition.variations.length > 2 && /* @__PURE__ */ jsxs28(
2985
+ /* @__PURE__ */ jsxs29(
2761
2986
  "button",
2762
2987
  {
2763
2988
  type: "button",
2764
2989
  className: "flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border/60 py-2.5 text-xs text-muted-foreground hover:border-border hover:text-foreground",
2765
2990
  onClick: handleAddVariation,
2766
2991
  children: [
2767
- /* @__PURE__ */ jsx42(Plus2, { className: "h-3 w-3" }),
2992
+ /* @__PURE__ */ jsx43(Plus2, { className: "h-3 w-3" }),
2768
2993
  "Add variation"
2769
2994
  ]
2770
2995
  }
@@ -2775,12 +3000,20 @@ function DefinitionEditor({
2775
3000
 
2776
3001
  // src/components/definition-list/DefinitionList.tsx
2777
3002
  import { useState as useState9 } from "react";
2778
- import { Plus as Plus3, Search, X as X3 } from "lucide-react";
3003
+ import { Plus as Plus3, Search as Search2, X as X3 } from "lucide-react";
2779
3004
 
2780
3005
  // src/components/definition-list/DefinitionListItem.tsx
2781
- import { memo as memo4, useState as useState8 } from "react";
2782
- import { Trash2 as Trash22 } from "lucide-react";
2783
- import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs29 } from "react/jsx-runtime";
3006
+ import { memo as memo4 } from "react";
3007
+ import { jsx as jsx44, jsxs as jsxs30 } from "react/jsx-runtime";
3008
+ var STATUS_CLASSES = {
3009
+ unfetched: "border-muted-foreground/40 bg-muted-foreground/40",
3010
+ error: "border-status-error bg-status-error",
3011
+ error_dirty: "border-status-error bg-transparent",
3012
+ active: "border-status-active bg-status-active",
3013
+ active_dirty: "border-status-active bg-transparent",
3014
+ inactive: "border-status-inactive bg-status-inactive",
3015
+ inactive_dirty: "border-status-inactive bg-transparent"
3016
+ };
2784
3017
  var DefinitionListItem = memo4(function DefinitionListItem2({
2785
3018
  definitionKey,
2786
3019
  variationCount,
@@ -2788,11 +3021,16 @@ var DefinitionListItem = memo4(function DefinitionListItem2({
2788
3021
  hasErrors,
2789
3022
  isSelected,
2790
3023
  isDirty,
2791
- onSelect,
2792
- onRemove
3024
+ onSelect
2793
3025
  }) {
2794
- const [confirmOpen, setConfirmOpen] = useState8(false);
2795
- return /* @__PURE__ */ jsxs29(
3026
+ const isUnfetched = isActive === void 0;
3027
+ function getStatusLabel() {
3028
+ if (isUnfetched) return `${definitionKey} is unfetched`;
3029
+ const state = hasErrors ? "error" : isActive ? "active" : "inactive";
3030
+ const dirty = isDirty ? ", unsaved changes" : "";
3031
+ return `${definitionKey} is ${state}${dirty}`;
3032
+ }
3033
+ return /* @__PURE__ */ jsxs30(
2796
3034
  "div",
2797
3035
  {
2798
3036
  tabIndex: 0,
@@ -2808,56 +3046,28 @@ var DefinitionListItem = memo4(function DefinitionListItem2({
2808
3046
  }
2809
3047
  },
2810
3048
  children: [
2811
- /* @__PURE__ */ jsx43(
3049
+ /* @__PURE__ */ jsx44(
2812
3050
  "span",
2813
3051
  {
2814
3052
  role: "status",
2815
- "aria-label": `${definitionKey} is ${hasErrors ? "error" : isActive ? "active" : "inactive"}${isDirty ? ", unsaved changes" : ""}`,
3053
+ "aria-label": getStatusLabel(),
2816
3054
  className: cn(
2817
3055
  "h-2 w-2 shrink-0 rounded-full border-[1.5px]",
2818
- hasErrors ? isDirty ? "border-status-error bg-transparent" : "border-status-error bg-status-error" : isActive ? isDirty ? "border-status-active bg-transparent" : "border-status-active bg-status-active" : isDirty ? "border-status-inactive bg-transparent" : "border-status-inactive bg-status-inactive"
3056
+ isUnfetched ? STATUS_CLASSES.unfetched : hasErrors ? isDirty ? STATUS_CLASSES.error_dirty : STATUS_CLASSES.error : isActive ? isDirty ? STATUS_CLASSES.active_dirty : STATUS_CLASSES.active : isDirty ? STATUS_CLASSES.inactive_dirty : STATUS_CLASSES.inactive
2819
3057
  )
2820
3058
  }
2821
3059
  ),
2822
- /* @__PURE__ */ jsx43("span", { className: "flex-1 truncate font-mono text-sm", children: definitionKey }),
2823
- /* @__PURE__ */ jsx43(Badge, { variant: "secondary", className: "text-xs tabular-nums", children: variationCount }),
2824
- /* @__PURE__ */ jsx43(
2825
- ConfirmDialog,
2826
- {
2827
- open: confirmOpen,
2828
- onOpenChange: setConfirmOpen,
2829
- title: "Delete definition?",
2830
- description: /* @__PURE__ */ jsxs29(Fragment6, { children: [
2831
- "This will permanently delete ",
2832
- /* @__PURE__ */ jsx43("strong", { className: "font-mono", children: definitionKey }),
2833
- " and all its variations. This action cannot be undone."
2834
- ] }),
2835
- actionLabel: "Delete",
2836
- onConfirm: onRemove,
2837
- children: /* @__PURE__ */ jsx43(
2838
- Button,
2839
- {
2840
- variant: "ghost",
2841
- size: "icon-xs",
2842
- className: "text-destructive/60 opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",
2843
- "aria-label": `Remove ${definitionKey}`,
2844
- onClick: (e) => {
2845
- e.stopPropagation();
2846
- setConfirmOpen(true);
2847
- },
2848
- children: /* @__PURE__ */ jsx43(Trash22, { className: "h-3.5 w-3.5" })
2849
- }
2850
- )
2851
- }
2852
- )
3060
+ /* @__PURE__ */ jsx44("span", { className: "min-w-0 flex-1 break-all font-mono text-sm", children: definitionKey }),
3061
+ variationCount !== void 0 && /* @__PURE__ */ jsx44(Badge, { variant: "secondary", className: "text-xs tabular-nums", children: variationCount })
2853
3062
  ]
2854
3063
  }
2855
3064
  );
2856
3065
  });
2857
3066
 
2858
3067
  // src/components/definition-list/DefinitionList.tsx
2859
- import { jsx as jsx44, jsxs as jsxs30 } from "react/jsx-runtime";
3068
+ import { jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
2860
3069
  function DefinitionList({
3070
+ keys,
2861
3071
  definitions,
2862
3072
  selectedKey,
2863
3073
  validationErrors,
@@ -2869,12 +3079,10 @@ function DefinitionList({
2869
3079
  const [search, setSearch] = useState9("");
2870
3080
  const [adding, setAdding] = useState9(false);
2871
3081
  const [newKey, setNewKey] = useState9("");
2872
- const keys = Object.keys(definitions).filter(
2873
- (k) => k.toLowerCase().includes(search.toLowerCase())
2874
- );
3082
+ const filteredKeys = keys.filter((k) => k.toLowerCase().includes(search.toLowerCase()));
2875
3083
  async function handleAdd() {
2876
3084
  const trimmed = newKey.trim();
2877
- if (trimmed && !(trimmed in definitions)) {
3085
+ if (trimmed && !keys.includes(trimmed)) {
2878
3086
  try {
2879
3087
  await onAdd(trimmed);
2880
3088
  setNewKey("");
@@ -2883,10 +3091,10 @@ function DefinitionList({
2883
3091
  }
2884
3092
  }
2885
3093
  }
2886
- return /* @__PURE__ */ jsxs30("div", { className: "flex h-full flex-col", children: [
2887
- /* @__PURE__ */ jsx44("div", { className: "p-3", children: /* @__PURE__ */ jsxs30("div", { className: "relative", children: [
2888
- /* @__PURE__ */ jsx44(Search, { className: "absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
2889
- /* @__PURE__ */ jsx44(
3094
+ return /* @__PURE__ */ jsxs31("div", { className: "flex min-h-0 flex-1 flex-col", children: [
3095
+ /* @__PURE__ */ jsx45("div", { className: "p-3", children: /* @__PURE__ */ jsxs31("div", { className: "relative", children: [
3096
+ /* @__PURE__ */ jsx45(Search2, { className: "absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
3097
+ /* @__PURE__ */ jsx45(
2890
3098
  Input,
2891
3099
  {
2892
3100
  className: "h-9 pl-8 text-sm",
@@ -2896,25 +3104,28 @@ function DefinitionList({
2896
3104
  }
2897
3105
  )
2898
3106
  ] }) }),
2899
- /* @__PURE__ */ jsx44(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsxs30("div", { className: "px-2", children: [
2900
- keys.map((key) => /* @__PURE__ */ jsx44(
2901
- DefinitionListItem,
2902
- {
2903
- definitionKey: key,
2904
- variationCount: definitions[key].variations.length,
2905
- isActive: definitions[key].active !== false,
2906
- hasErrors: !!(validationErrors?.[key] && validationErrors[key].length > 0),
2907
- isDirty: dirtyKeys?.includes(key),
2908
- isSelected: key === selectedKey,
2909
- onSelect: () => onSelect(key),
2910
- onRemove: () => onRemove(key)
2911
- },
2912
- key
2913
- )),
2914
- keys.length === 0 && /* @__PURE__ */ jsx44("p", { className: "px-3 py-8 text-center text-sm text-muted-foreground", children: search ? "No definitions match" : "No definitions" })
3107
+ /* @__PURE__ */ jsx45(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsxs31("div", { className: "px-2", children: [
3108
+ filteredKeys.map((key) => {
3109
+ const def = definitions[key];
3110
+ return /* @__PURE__ */ jsx45(
3111
+ DefinitionListItem,
3112
+ {
3113
+ definitionKey: key,
3114
+ variationCount: def?.variations.length,
3115
+ isActive: def ? def.active !== false : void 0,
3116
+ hasErrors: !!(validationErrors?.[key] && validationErrors[key].length > 0),
3117
+ isDirty: dirtyKeys?.includes(key),
3118
+ isSelected: key === selectedKey,
3119
+ onSelect: () => onSelect(key),
3120
+ onRemove: () => onRemove(key)
3121
+ },
3122
+ key
3123
+ );
3124
+ }),
3125
+ filteredKeys.length === 0 && /* @__PURE__ */ jsx45("p", { className: "px-3 py-8 text-center text-sm text-muted-foreground", children: search ? "No definitions match" : "No definitions" })
2915
3126
  ] }) }),
2916
- /* @__PURE__ */ jsx44("div", { className: "border-t border-border p-3", children: adding ? /* @__PURE__ */ jsxs30("div", { className: "space-y-2", children: [
2917
- /* @__PURE__ */ jsx44(
3127
+ /* @__PURE__ */ jsx45("div", { className: "border-t border-border p-3", children: adding ? /* @__PURE__ */ jsxs31("div", { className: "space-y-2", children: [
3128
+ /* @__PURE__ */ jsx45(
2918
3129
  Input,
2919
3130
  {
2920
3131
  className: "h-9 w-full font-mono text-sm",
@@ -2928,9 +3139,9 @@ function DefinitionList({
2928
3139
  }
2929
3140
  }
2930
3141
  ),
2931
- /* @__PURE__ */ jsxs30("div", { className: "flex gap-2", children: [
2932
- /* @__PURE__ */ jsx44(Button, { size: "sm", className: "h-8 flex-1", onClick: handleAdd, children: "Save" }),
2933
- /* @__PURE__ */ jsx44(
3142
+ /* @__PURE__ */ jsxs31("div", { className: "flex gap-2", children: [
3143
+ /* @__PURE__ */ jsx45(Button, { size: "sm", className: "h-8 flex-1", onClick: handleAdd, children: "Save" }),
3144
+ /* @__PURE__ */ jsx45(
2934
3145
  Button,
2935
3146
  {
2936
3147
  variant: "ghost",
@@ -2941,11 +3152,11 @@ function DefinitionList({
2941
3152
  setAdding(false);
2942
3153
  setNewKey("");
2943
3154
  },
2944
- children: /* @__PURE__ */ jsx44(X3, { className: "h-4 w-4" })
3155
+ children: /* @__PURE__ */ jsx45(X3, { className: "h-4 w-4" })
2945
3156
  }
2946
3157
  )
2947
3158
  ] })
2948
- ] }) : /* @__PURE__ */ jsxs30(
3159
+ ] }) : /* @__PURE__ */ jsxs31(
2949
3160
  Button,
2950
3161
  {
2951
3162
  variant: "outline",
@@ -2954,7 +3165,7 @@ function DefinitionList({
2954
3165
  "aria-label": "Add new definition",
2955
3166
  onClick: () => setAdding(true),
2956
3167
  children: [
2957
- /* @__PURE__ */ jsx44(Plus3, { className: "mr-1.5 h-4 w-4" }),
3168
+ /* @__PURE__ */ jsx45(Plus3, { className: "mr-1.5 h-4 w-4" }),
2958
3169
  "New definition"
2959
3170
  ]
2960
3171
  }
@@ -2963,26 +3174,70 @@ function DefinitionList({
2963
3174
  }
2964
3175
 
2965
3176
  // src/components/condition-builder/preset-ui.tsx
2966
- import { useCallback as useCallback11, useMemo as useMemo10 } from "react";
2967
- import { PRIMITIVE_TYPES } from "showwhat";
2968
- import { jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
3177
+ import { useCallback as useCallback12, useMemo as useMemo11 } from "react";
3178
+
3179
+ // src/components/condition-builder/CompositePresetViewer.tsx
3180
+ import { useState as useState10 } from "react";
3181
+ import { Eye as Eye2 } from "lucide-react";
3182
+ import { jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
3183
+ function createCompositePresetEditor(presetName, compositeType, conditions) {
3184
+ function CompositePresetEditor() {
3185
+ const [open, setOpen] = useState10(false);
3186
+ return /* @__PURE__ */ jsxs32("div", { className: "flex items-center gap-2", children: [
3187
+ /* @__PURE__ */ jsxs32("span", { className: "text-xs text-muted-foreground", children: [
3188
+ "Composite ",
3189
+ /* @__PURE__ */ jsx46("span", { className: "font-mono font-medium", children: compositeType.toUpperCase() }),
3190
+ " ",
3191
+ "preset (",
3192
+ conditions.length,
3193
+ " condition",
3194
+ conditions.length !== 1 ? "s" : "",
3195
+ ")"
3196
+ ] }),
3197
+ /* @__PURE__ */ jsx46(
3198
+ Button,
3199
+ {
3200
+ variant: "ghost",
3201
+ size: "icon",
3202
+ className: "h-7 w-7",
3203
+ onClick: () => setOpen(true),
3204
+ "aria-label": "View preset conditions",
3205
+ children: /* @__PURE__ */ jsx46(Eye2, { className: "h-3.5 w-3.5" })
3206
+ }
3207
+ ),
3208
+ /* @__PURE__ */ jsx46(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs32(DialogContent, { children: [
3209
+ /* @__PURE__ */ jsxs32(DialogHeader, { children: [
3210
+ /* @__PURE__ */ jsx46(DialogTitle, { children: presetName }),
3211
+ /* @__PURE__ */ jsx46(DialogDescription, { children: "Read-only view of the preset conditions." })
3212
+ ] }),
3213
+ /* @__PURE__ */ jsx46("pre", { className: "max-h-80 overflow-auto rounded bg-muted p-3 text-xs font-mono", children: JSON.stringify(conditions, null, 2) }),
3214
+ /* @__PURE__ */ jsx46(DialogFooter, { showCloseButton: true })
3215
+ ] }) })
3216
+ ] });
3217
+ }
3218
+ CompositePresetEditor.displayName = `CompositePresetEditor(${presetName})`;
3219
+ return CompositePresetEditor;
3220
+ }
3221
+
3222
+ // src/components/condition-builder/preset-ui.tsx
3223
+ import { jsx as jsx47, jsxs as jsxs33 } from "react/jsx-runtime";
3224
+ var PRIMITIVE_TYPES = /* @__PURE__ */ new Set(["string", "number", "bool", "datetime"]);
3225
+ var COMPOSITE_TYPES = /* @__PURE__ */ new Set(["and", "or", "checkAnnotations"]);
2969
3226
  var TYPE_DEFAULTS = {
2970
3227
  string: { op: "eq", value: "" },
2971
3228
  number: { op: "eq", value: 0 },
2972
3229
  bool: { value: true },
2973
3230
  datetime: { op: "eq", value: (/* @__PURE__ */ new Date()).toISOString() }
2974
3231
  };
2975
- function capitalize(s) {
2976
- return s.charAt(0).toUpperCase() + s.slice(1);
2977
- }
2978
3232
  function createPresetConditionMeta(presets) {
2979
3233
  return Object.entries(presets).map(([name, preset]) => {
2980
3234
  const isBuiltin = PRIMITIVE_TYPES.has(preset.type);
2981
- const description = isBuiltin ? `Match the ${preset.key} key (${preset.type})` : `Custom ${preset.type} condition`;
3235
+ const isComposite = COMPOSITE_TYPES.has(preset.type);
3236
+ const description = isComposite ? `Composite ${preset.type} preset` : isBuiltin ? `Match the ${preset.key} key (${preset.type})` : `Custom ${preset.type} condition`;
2982
3237
  const baseDefaults = isBuiltin ? { ...TYPE_DEFAULTS[preset.type], key: preset.key } : {};
2983
3238
  return {
2984
3239
  type: name,
2985
- label: capitalize(name),
3240
+ label: name,
2986
3241
  description,
2987
3242
  defaults: { ...baseDefaults, ...preset.overrides, type: name }
2988
3243
  };
@@ -2991,8 +3246,15 @@ function createPresetConditionMeta(presets) {
2991
3246
  function createPresetEditor(presetName, builtinType, presetKey, overrides = {}) {
2992
3247
  const lockedFields = new Set(Object.keys(overrides));
2993
3248
  function PresetConditionEditor({ condition, onChange }) {
2994
- const rec = useMemo10(() => condition, [condition]);
2995
- const update = useCallback11(
3249
+ const rec = useMemo11(
3250
+ () => ({
3251
+ key: presetKey,
3252
+ ...condition,
3253
+ ...overrides
3254
+ }),
3255
+ [condition]
3256
+ );
3257
+ const update = useCallback12(
2996
3258
  (field, value) => {
2997
3259
  onChange(
2998
3260
  buildCustomCondition({
@@ -3008,9 +3270,9 @@ function createPresetEditor(presetName, builtinType, presetKey, overrides = {})
3008
3270
  );
3009
3271
  switch (builtinType) {
3010
3272
  case "string": {
3011
- const op = rec.op;
3012
- const isArray = op === "in" || op === "nin";
3013
- const isRegex = op === "regex";
3273
+ const op2 = rec.op;
3274
+ const isArray = op2 === "in" || op2 === "nin";
3275
+ const isRegex = op2 === "regex";
3014
3276
  const handleOpChange = (newOp) => {
3015
3277
  const isArrayOp = newOp === "in" || newOp === "nin";
3016
3278
  const currentValue = rec.value;
@@ -3027,18 +3289,17 @@ function createPresetEditor(presetName, builtinType, presetKey, overrides = {})
3027
3289
  };
3028
3290
  const opLocked = lockedFields.has("op");
3029
3291
  const valueLocked = lockedFields.has("value");
3030
- return /* @__PURE__ */ jsxs31(ConditionRow, { children: [
3031
- /* @__PURE__ */ jsx45(KeyInput, { value: presetKey, disabled: true }),
3032
- /* @__PURE__ */ jsx45(
3292
+ return /* @__PURE__ */ jsxs33(ConditionRow, { keySlot: /* @__PURE__ */ jsx47(KeyInput, { value: presetKey, disabled: true }), children: [
3293
+ /* @__PURE__ */ jsx47(
3033
3294
  OperatorSelect,
3034
3295
  {
3035
3296
  value: String(rec.op ?? "eq"),
3036
3297
  onChange: handleOpChange,
3037
- options: OP_OPTIONS,
3298
+ options: STRING_OPS,
3038
3299
  disabled: opLocked
3039
3300
  }
3040
3301
  ),
3041
- isArray ? /* @__PURE__ */ jsx45(
3302
+ isArray ? /* @__PURE__ */ jsx47(
3042
3303
  TagInput,
3043
3304
  {
3044
3305
  value: rec.value ?? "",
@@ -3046,7 +3307,7 @@ function createPresetEditor(presetName, builtinType, presetKey, overrides = {})
3046
3307
  placeholder: `e.g. ${presetKey} value`,
3047
3308
  disabled: valueLocked
3048
3309
  }
3049
- ) : isRegex ? /* @__PURE__ */ jsx45(
3310
+ ) : isRegex ? /* @__PURE__ */ jsx47(
3050
3311
  Input,
3051
3312
  {
3052
3313
  className: "h-8 font-mono text-sm",
@@ -3055,7 +3316,7 @@ function createPresetEditor(presetName, builtinType, presetKey, overrides = {})
3055
3316
  onChange: (e) => update("value", e.target.value),
3056
3317
  disabled: valueLocked
3057
3318
  }
3058
- ) : /* @__PURE__ */ jsx45(
3319
+ ) : /* @__PURE__ */ jsx47(
3059
3320
  Input,
3060
3321
  {
3061
3322
  className: "h-8 text-sm",
@@ -3086,18 +3347,17 @@ function createPresetEditor(presetName, builtinType, presetKey, overrides = {})
3086
3347
  };
3087
3348
  const numOpLocked = lockedFields.has("op");
3088
3349
  const numValueLocked = lockedFields.has("value");
3089
- return /* @__PURE__ */ jsxs31(ConditionRow, { children: [
3090
- /* @__PURE__ */ jsx45(KeyInput, { value: presetKey, disabled: true }),
3091
- /* @__PURE__ */ jsx45(
3350
+ return /* @__PURE__ */ jsxs33(ConditionRow, { keySlot: /* @__PURE__ */ jsx47(KeyInput, { value: presetKey, disabled: true }), children: [
3351
+ /* @__PURE__ */ jsx47(
3092
3352
  OperatorSelect,
3093
3353
  {
3094
3354
  value: String(rec.op ?? "eq"),
3095
3355
  onChange: handleNumOpChange,
3096
- options: OP_OPTIONS2,
3356
+ options: NUMBER_OPS,
3097
3357
  disabled: numOpLocked
3098
3358
  }
3099
3359
  ),
3100
- isNumArray ? /* @__PURE__ */ jsx45(
3360
+ isNumArray ? /* @__PURE__ */ jsx47(
3101
3361
  NumberTagInput,
3102
3362
  {
3103
3363
  value: rec.value ?? [],
@@ -3105,7 +3365,7 @@ function createPresetEditor(presetName, builtinType, presetKey, overrides = {})
3105
3365
  placeholder: `e.g. ${presetKey} value`,
3106
3366
  disabled: numValueLocked
3107
3367
  }
3108
- ) : /* @__PURE__ */ jsx45(
3368
+ ) : /* @__PURE__ */ jsx47(
3109
3369
  Input,
3110
3370
  {
3111
3371
  type: "number",
@@ -3120,20 +3380,19 @@ function createPresetEditor(presetName, builtinType, presetKey, overrides = {})
3120
3380
  }
3121
3381
  case "bool": {
3122
3382
  const boolValueLocked = lockedFields.has("value");
3123
- return /* @__PURE__ */ jsxs31(ConditionRow, { children: [
3124
- /* @__PURE__ */ jsx45(KeyInput, { value: presetKey, disabled: true }),
3125
- /* @__PURE__ */ jsx45(OperatorSelect, { value: "eq", options: OP_OPTIONS4, disabled: true }),
3126
- /* @__PURE__ */ jsxs31(
3383
+ return /* @__PURE__ */ jsxs33(ConditionRow, { keySlot: /* @__PURE__ */ jsx47(KeyInput, { value: presetKey, disabled: true }), children: [
3384
+ /* @__PURE__ */ jsx47(OperatorSelect, { value: "eq", options: BOOL_OPS, disabled: true }),
3385
+ /* @__PURE__ */ jsxs33(
3127
3386
  Select,
3128
3387
  {
3129
3388
  value: String(rec.value ?? "true"),
3130
3389
  onValueChange: (v) => update("value", v === "true"),
3131
3390
  disabled: boolValueLocked,
3132
3391
  children: [
3133
- /* @__PURE__ */ jsx45(SelectTrigger, { className: "h-8 text-sm", children: /* @__PURE__ */ jsx45(SelectValue, {}) }),
3134
- /* @__PURE__ */ jsxs31(SelectContent, { children: [
3135
- /* @__PURE__ */ jsx45(SelectItem, { value: "true", children: "true" }),
3136
- /* @__PURE__ */ jsx45(SelectItem, { value: "false", children: "false" })
3392
+ /* @__PURE__ */ jsx47(SelectTrigger, { className: "h-8 text-sm", children: /* @__PURE__ */ jsx47(SelectValue, {}) }),
3393
+ /* @__PURE__ */ jsxs33(SelectContent, { children: [
3394
+ /* @__PURE__ */ jsx47(SelectItem, { value: "true", children: "true" }),
3395
+ /* @__PURE__ */ jsx47(SelectItem, { value: "false", children: "false" })
3137
3396
  ] })
3138
3397
  ]
3139
3398
  }
@@ -3143,18 +3402,17 @@ function createPresetEditor(presetName, builtinType, presetKey, overrides = {})
3143
3402
  case "datetime": {
3144
3403
  const dtOpLocked = lockedFields.has("op");
3145
3404
  const dtValueLocked = lockedFields.has("value");
3146
- return /* @__PURE__ */ jsxs31(ConditionRow, { children: [
3147
- /* @__PURE__ */ jsx45(KeyInput, { value: presetKey, disabled: true }),
3148
- /* @__PURE__ */ jsx45(
3405
+ return /* @__PURE__ */ jsxs33(ConditionRow, { keySlot: /* @__PURE__ */ jsx47(KeyInput, { value: presetKey, disabled: true }), children: [
3406
+ /* @__PURE__ */ jsx47(
3149
3407
  OperatorSelect,
3150
3408
  {
3151
3409
  value: String(rec.op ?? "eq"),
3152
3410
  onChange: (v) => update("op", v),
3153
- options: OP_OPTIONS3,
3411
+ options: DATETIME_OPS,
3154
3412
  disabled: dtOpLocked
3155
3413
  }
3156
3414
  ),
3157
- /* @__PURE__ */ jsx45(
3415
+ /* @__PURE__ */ jsx47(
3158
3416
  DateTimeInput,
3159
3417
  {
3160
3418
  value: String(rec.value ?? ""),
@@ -3174,7 +3432,10 @@ function createPresetUI(presets) {
3174
3432
  const extraConditionTypes = createPresetConditionMeta(presets);
3175
3433
  const editorOverrides = /* @__PURE__ */ new Map();
3176
3434
  for (const [name, preset] of Object.entries(presets)) {
3177
- if (PRIMITIVE_TYPES.has(preset.type) && preset.key) {
3435
+ if (COMPOSITE_TYPES.has(preset.type)) {
3436
+ const conditions = preset.overrides?.conditions ?? [];
3437
+ editorOverrides.set(name, createCompositePresetEditor(name, preset.type, conditions));
3438
+ } else if (PRIMITIVE_TYPES.has(preset.type) && preset.key) {
3178
3439
  editorOverrides.set(
3179
3440
  name,
3180
3441
  createPresetEditor(name, preset.type, preset.key, preset.overrides)
@@ -3185,14 +3446,14 @@ function createPresetUI(presets) {
3185
3446
  }
3186
3447
 
3187
3448
  // src/configurator/Configurator.tsx
3188
- import { useMemo as useMemo12 } from "react";
3449
+ import { useMemo as useMemo13 } from "react";
3189
3450
 
3190
3451
  // src/configurator/context.ts
3191
- import { createContext as createContext2, useCallback as useCallback12, useContext as useContext2, useSyncExternalStore, useState as useState10 } from "react";
3192
- var StoreSourceContext = createContext2(null);
3193
- var ActionStateContext = createContext2(null);
3452
+ import { createContext as createContext3, useCallback as useCallback13, useContext as useContext3, useSyncExternalStore, useState as useState11 } from "react";
3453
+ var StoreSourceContext = createContext3(null);
3454
+ var ActionStateContext = createContext3(null);
3194
3455
  function useStoreSource() {
3195
- const source = useContext2(StoreSourceContext);
3456
+ const source = useContext3(StoreSourceContext);
3196
3457
  if (source) return source;
3197
3458
  throw new Error("useConfiguratorStore must be used within a <Configurator> component");
3198
3459
  }
@@ -3201,17 +3462,17 @@ function useConfiguratorStore() {
3201
3462
  return useSyncExternalStore(source.subscribe, source.getSnapshot);
3202
3463
  }
3203
3464
  function useActionState() {
3204
- const ctx = useContext2(ActionStateContext);
3465
+ const ctx = useContext3(ActionStateContext);
3205
3466
  if (ctx) return ctx;
3206
3467
  throw new Error("useActionState must be used within a <Configurator> component");
3207
3468
  }
3208
3469
  function useStoreRef() {
3209
3470
  const source = useStoreSource();
3210
- return useCallback12(() => source.getSnapshot(), [source]);
3471
+ return useCallback13(() => source.getSnapshot(), [source]);
3211
3472
  }
3212
3473
  function useActionRunner() {
3213
- const [state, setState] = useState10({ pending: false, error: null });
3214
- const run = useCallback12(async (action) => {
3474
+ const [state, setState] = useState11({ pending: false, error: null });
3475
+ const run = useCallback13(async (action) => {
3215
3476
  setState({ pending: true, error: null });
3216
3477
  try {
3217
3478
  await action();
@@ -3221,7 +3482,7 @@ function useActionRunner() {
3221
3482
  throw err;
3222
3483
  }
3223
3484
  }, []);
3224
- const clearError = useCallback12(() => setState((s) => ({ ...s, error: null })), []);
3485
+ const clearError = useCallback13(() => setState((s) => ({ ...s, error: null })), []);
3225
3486
  return {
3226
3487
  actionState: state,
3227
3488
  runAction: run,
@@ -3230,19 +3491,19 @@ function useActionRunner() {
3230
3491
  }
3231
3492
 
3232
3493
  // src/configurator/useConfiguratorSelector.ts
3233
- import { useContext as useContext3, useCallback as useCallback13, useSyncExternalStore as useSyncExternalStore2 } from "react";
3494
+ import { useContext as useContext4, useCallback as useCallback14, useSyncExternalStore as useSyncExternalStore2 } from "react";
3234
3495
  function useConfiguratorSelector(selector) {
3235
- const source = useContext3(StoreSourceContext);
3496
+ const source = useContext4(StoreSourceContext);
3236
3497
  if (!source) {
3237
3498
  throw new Error("useConfiguratorSelector must be used within a <Configurator> component");
3238
3499
  }
3239
- const getSnapshot = useCallback13(() => selector(source.getSnapshot()), [source, selector]);
3500
+ const getSnapshot = useCallback14(() => selector(source.getSnapshot()), [source, selector]);
3240
3501
  return useSyncExternalStore2(source.subscribe, getSnapshot);
3241
3502
  }
3242
3503
 
3243
3504
  // src/configurator/PreviewPanel.tsx
3244
- import { useCallback as useCallback14, useEffect, useMemo as useMemo11, useRef as useRef5, useState as useState11 } from "react";
3245
- import { ChevronRight as ChevronRight2, Eye as Eye2, Loader2, Maximize2, Play } from "lucide-react";
3505
+ import { useCallback as useCallback15, useEffect, useMemo as useMemo12, useRef as useRef6, useState as useState12 } from "react";
3506
+ import { ChevronRight as ChevronRight2, Eye as Eye3, Loader2, Maximize2, Play } from "lucide-react";
3246
3507
  import { resolve, builtinEvaluators } from "showwhat";
3247
3508
  import { DefinitionInactiveError, DefinitionNotFoundError, VariationNotFoundError } from "showwhat";
3248
3509
 
@@ -3254,22 +3515,43 @@ var selectDirtyKeys = (s) => s.dirtyKeys;
3254
3515
  var selectRevision = (s) => s.revision;
3255
3516
 
3256
3517
  // src/configurator/fallback-context.ts
3257
- import { createContext as createContext3, useContext as useContext4 } from "react";
3258
- var FallbackEvaluatorContext = createContext3(null);
3518
+ import { createContext as createContext4, useContext as useContext5 } from "react";
3519
+ var FallbackEvaluatorContext = createContext4(null);
3259
3520
  var FallbackEvaluatorProvider = FallbackEvaluatorContext.Provider;
3260
3521
  function useFallbackEvaluator() {
3261
- return useContext4(FallbackEvaluatorContext);
3522
+ return useContext5(FallbackEvaluatorContext);
3523
+ }
3524
+
3525
+ // src/configurator/preview-context.ts
3526
+ import { createContext as createContext5, useContext as useContext6 } from "react";
3527
+ var defaultState = {
3528
+ contextText: "",
3529
+ annotationsText: "",
3530
+ evaluatorText: "",
3531
+ setContextText: () => {
3532
+ },
3533
+ setAnnotationsText: () => {
3534
+ },
3535
+ setEvaluatorText: () => {
3536
+ },
3537
+ resetPreview: () => {
3538
+ }
3539
+ };
3540
+ var PreviewStateContext = createContext5(defaultState);
3541
+ var PreviewStateProvider = PreviewStateContext.Provider;
3542
+ function usePreviewState() {
3543
+ return useContext6(PreviewStateContext);
3262
3544
  }
3263
3545
 
3264
3546
  // src/configurator/PreviewPanel.tsx
3265
- import { Fragment as Fragment7, jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
3547
+ import { Fragment as Fragment5, jsx as jsx48, jsxs as jsxs34 } from "react/jsx-runtime";
3266
3548
  function ResultBadge({ result, onViewMeta }) {
3267
3549
  switch (result.status) {
3268
3550
  case "success":
3269
- return /* @__PURE__ */ jsxs32("div", { className: "space-y-2", children: [
3270
- /* @__PURE__ */ jsxs32("div", { className: "flex items-center justify-between", children: [
3271
- /* @__PURE__ */ jsx46(Badge, { className: "bg-status-active/15 text-green-700 hover:bg-status-active/15 dark:text-green-400", children: "Matched" }),
3272
- onViewMeta ? /* @__PURE__ */ jsxs32(
3551
+ return /* @__PURE__ */ jsxs34("div", { className: "space-y-2", children: [
3552
+ /* @__PURE__ */ jsxs34("div", { className: "flex items-center justify-between", children: [
3553
+ /* @__PURE__ */ jsx48(Badge, { className: "bg-status-active/15 text-green-700 hover:bg-status-active/15 dark:text-green-400", children: "Matched" }),
3554
+ onViewMeta ? /* @__PURE__ */ jsxs34(
3273
3555
  "button",
3274
3556
  {
3275
3557
  type: "button",
@@ -3277,36 +3559,36 @@ function ResultBadge({ result, onViewMeta }) {
3277
3559
  onClick: onViewMeta,
3278
3560
  "aria-label": "View evaluation meta",
3279
3561
  children: [
3280
- /* @__PURE__ */ jsx46(Eye2, { className: "size-3" }),
3281
- /* @__PURE__ */ jsx46("span", { children: "Details" }),
3282
- /* @__PURE__ */ jsx46("span", { children: "|" }),
3283
- /* @__PURE__ */ jsxs32("span", { children: [
3562
+ /* @__PURE__ */ jsx48(Eye3, { className: "size-3" }),
3563
+ /* @__PURE__ */ jsx48("span", { children: "Details" }),
3564
+ /* @__PURE__ */ jsx48("span", { children: "|" }),
3565
+ /* @__PURE__ */ jsxs34("span", { children: [
3284
3566
  "Variation #",
3285
3567
  result.meta.variation.index
3286
3568
  ] })
3287
3569
  ]
3288
3570
  }
3289
- ) : /* @__PURE__ */ jsxs32("span", { className: "text-xs text-muted-foreground", children: [
3571
+ ) : /* @__PURE__ */ jsxs34("span", { className: "text-xs text-muted-foreground", children: [
3290
3572
  "Variation #",
3291
3573
  result.meta.variation.index
3292
3574
  ] })
3293
3575
  ] }),
3294
- /* @__PURE__ */ jsx46("div", { className: "rounded-md border border-border bg-background p-2", children: /* @__PURE__ */ jsx46("pre", { className: "whitespace-pre-wrap break-all font-mono text-xs", children: typeof result.value === "string" ? result.value : JSON.stringify(result.value, null, 2) }) })
3576
+ /* @__PURE__ */ jsx48("div", { className: "rounded-md border border-border bg-background p-2", children: /* @__PURE__ */ jsx48("pre", { className: "whitespace-pre-wrap break-all font-mono text-xs", children: typeof result.value === "string" ? result.value : JSON.stringify(result.value, null, 2) }) })
3295
3577
  ] });
3296
3578
  case "inactive":
3297
- return /* @__PURE__ */ jsxs32("div", { className: "space-y-2", children: [
3298
- /* @__PURE__ */ jsx46(Badge, { className: "bg-amber-500/15 text-amber-600 hover:bg-amber-500/15", children: "Inactive" }),
3299
- /* @__PURE__ */ jsx46("p", { className: "text-xs text-muted-foreground", children: result.message })
3579
+ return /* @__PURE__ */ jsxs34("div", { className: "space-y-2", children: [
3580
+ /* @__PURE__ */ jsx48(Badge, { className: "bg-amber-500/15 text-amber-600 hover:bg-amber-500/15", children: "Inactive" }),
3581
+ /* @__PURE__ */ jsx48("p", { className: "text-xs text-muted-foreground", children: result.message })
3300
3582
  ] });
3301
3583
  case "no-match":
3302
- return /* @__PURE__ */ jsxs32("div", { className: "space-y-2", children: [
3303
- /* @__PURE__ */ jsx46(Badge, { className: "bg-orange-500/15 text-orange-600 hover:bg-orange-500/15", children: "No Match" }),
3304
- /* @__PURE__ */ jsx46("p", { className: "text-xs text-muted-foreground", children: result.message })
3584
+ return /* @__PURE__ */ jsxs34("div", { className: "space-y-2", children: [
3585
+ /* @__PURE__ */ jsx48(Badge, { className: "bg-orange-500/15 text-orange-600 hover:bg-orange-500/15", children: "No Match" }),
3586
+ /* @__PURE__ */ jsx48("p", { className: "text-xs text-muted-foreground", children: result.message })
3305
3587
  ] });
3306
3588
  case "error":
3307
- return /* @__PURE__ */ jsxs32("div", { className: "space-y-2", children: [
3308
- /* @__PURE__ */ jsx46(Badge, { variant: "destructive", children: "Error" }),
3309
- /* @__PURE__ */ jsx46("p", { className: "text-xs text-destructive", children: result.message })
3589
+ return /* @__PURE__ */ jsxs34("div", { className: "space-y-2", children: [
3590
+ /* @__PURE__ */ jsx48(Badge, { variant: "destructive", children: "Error" }),
3591
+ /* @__PURE__ */ jsx48("p", { className: "text-xs text-destructive", children: result.message })
3310
3592
  ] });
3311
3593
  }
3312
3594
  }
@@ -3325,6 +3607,15 @@ function parseContextJson(text) {
3325
3607
  }
3326
3608
  return context;
3327
3609
  }
3610
+ function parseAnnotationsJson(text) {
3611
+ const trimmed = text.trim();
3612
+ if (!trimmed) return null;
3613
+ const parsed = JSON.parse(trimmed);
3614
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
3615
+ throw new SyntaxError("Annotations must be a JSON object");
3616
+ }
3617
+ return parsed;
3618
+ }
3328
3619
  function parseEvaluatorOverrides(text) {
3329
3620
  const overrides = {};
3330
3621
  for (const line of text.split("\n")) {
@@ -3344,10 +3635,13 @@ function JsonEditorDialog({
3344
3635
  open,
3345
3636
  onOpenChange,
3346
3637
  value,
3347
- onSave
3638
+ onSave,
3639
+ title = "Edit Context",
3640
+ description = "JSON object with context values for resolving the definition.",
3641
+ placeholder = '{\n "env": "production",\n "region": "us-east-1"\n}'
3348
3642
  }) {
3349
- const [draft, setDraft] = useState11(value);
3350
- const [formatError, setFormatError] = useState11(null);
3643
+ const [draft, setDraft] = useState12(value);
3644
+ const [formatError, setFormatError] = useState12(null);
3351
3645
  useEffect(() => {
3352
3646
  if (open) {
3353
3647
  setDraft(value);
@@ -3369,15 +3663,15 @@ function JsonEditorDialog({
3369
3663
  onSave(draft);
3370
3664
  onOpenChange(false);
3371
3665
  }
3372
- return /* @__PURE__ */ jsx46(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs32(DialogContent, { className: "sm:max-w-2xl", children: [
3373
- /* @__PURE__ */ jsxs32(DialogHeader, { children: [
3374
- /* @__PURE__ */ jsx46(DialogTitle, { children: "Edit Context" }),
3375
- /* @__PURE__ */ jsx46(DialogDescription, { children: "JSON object with context values for resolving the definition." })
3666
+ return /* @__PURE__ */ jsx48(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs34(DialogContent, { className: "sm:max-w-2xl", children: [
3667
+ /* @__PURE__ */ jsxs34(DialogHeader, { children: [
3668
+ /* @__PURE__ */ jsx48(DialogTitle, { children: title }),
3669
+ /* @__PURE__ */ jsx48(DialogDescription, { children: description })
3376
3670
  ] }),
3377
- /* @__PURE__ */ jsx46(
3671
+ /* @__PURE__ */ jsx48(
3378
3672
  Textarea,
3379
3673
  {
3380
- placeholder: '{\n "env": "production",\n "region": "us-east-1"\n}',
3674
+ placeholder,
3381
3675
  value: draft,
3382
3676
  onChange: (e) => {
3383
3677
  setDraft(e.target.value);
@@ -3387,10 +3681,10 @@ function JsonEditorDialog({
3387
3681
  rows: 14
3388
3682
  }
3389
3683
  ),
3390
- formatError && /* @__PURE__ */ jsx46("p", { className: "text-xs text-destructive", children: formatError }),
3391
- /* @__PURE__ */ jsxs32(DialogFooter, { children: [
3392
- /* @__PURE__ */ jsx46(Button, { variant: "outline", size: "sm", onClick: handleFormat, children: "Format" }),
3393
- /* @__PURE__ */ jsx46(Button, { size: "sm", onClick: handleSave, children: "Apply" })
3684
+ formatError && /* @__PURE__ */ jsx48("p", { className: "text-xs text-destructive", children: formatError }),
3685
+ /* @__PURE__ */ jsxs34(DialogFooter, { children: [
3686
+ /* @__PURE__ */ jsx48(Button, { variant: "outline", size: "sm", onClick: handleFormat, children: "Format" }),
3687
+ /* @__PURE__ */ jsx48(Button, { size: "sm", onClick: handleSave, children: "Apply" })
3394
3688
  ] })
3395
3689
  ] }) });
3396
3690
  }
@@ -3398,15 +3692,23 @@ function PreviewPanel() {
3398
3692
  const definitions = useConfiguratorSelector(selectDefinitions);
3399
3693
  const selectedKey = useConfiguratorSelector(selectSelectedKey);
3400
3694
  const externalFallback = useFallbackEvaluator();
3401
- const [contextText, setContextText] = useState11("");
3402
- const [evaluatorText, setEvaluatorText] = useState11("");
3403
- const [contextError, setContextError] = useState11(null);
3404
- const [simulatorOpen, setSimulatorOpen] = useState11(false);
3405
- const [jsonEditorOpen, setJsonEditorOpen] = useState11(false);
3406
- const [previewResult, setPreviewResult] = useState11(null);
3407
- const [isResolving, setIsResolving] = useState11(false);
3408
- const [metaDialogOpen, setMetaDialogOpen] = useState11(false);
3409
- const abortControllerRef = useRef5(null);
3695
+ const {
3696
+ contextText,
3697
+ setContextText,
3698
+ annotationsText,
3699
+ setAnnotationsText,
3700
+ evaluatorText,
3701
+ setEvaluatorText,
3702
+ resetPreview
3703
+ } = usePreviewState();
3704
+ const [contextError, setContextError] = useState12(null);
3705
+ const [simulatorOpen, setSimulatorOpen] = useState12(false);
3706
+ const [jsonEditorOpen, setJsonEditorOpen] = useState12(false);
3707
+ const [annotationsEditorOpen, setAnnotationsEditorOpen] = useState12(false);
3708
+ const [previewResult, setPreviewResult] = useState12(null);
3709
+ const [isResolving, setIsResolving] = useState12(false);
3710
+ const [metaDialogOpen, setMetaDialogOpen] = useState12(false);
3711
+ const abortControllerRef = useRef6(null);
3410
3712
  useEffect(() => {
3411
3713
  abortControllerRef.current?.abort();
3412
3714
  abortControllerRef.current = null;
@@ -3415,7 +3717,7 @@ function PreviewPanel() {
3415
3717
  abortControllerRef.current?.abort();
3416
3718
  };
3417
3719
  }, [selectedKey]);
3418
- const fallback = useMemo11(() => {
3720
+ const fallback = useMemo12(() => {
3419
3721
  const overrides = parseEvaluatorOverrides(evaluatorText);
3420
3722
  const hasOverrides = Object.keys(overrides).length > 0;
3421
3723
  if (!hasOverrides && !externalFallback) return void 0;
@@ -3426,7 +3728,7 @@ function PreviewPanel() {
3426
3728
  return false;
3427
3729
  };
3428
3730
  }, [evaluatorText, externalFallback]);
3429
- const handleResolve = useCallback14(async () => {
3731
+ const handleResolve = useCallback15(async () => {
3430
3732
  if (!selectedKey || !definitions[selectedKey]) {
3431
3733
  setPreviewResult({ status: "error", message: "No definition selected" });
3432
3734
  return;
@@ -3444,13 +3746,22 @@ function PreviewPanel() {
3444
3746
  setIsResolving(false);
3445
3747
  return;
3446
3748
  }
3749
+ let seedAnnotations = null;
3750
+ try {
3751
+ seedAnnotations = parseAnnotationsJson(annotationsText);
3752
+ } catch {
3753
+ setPreviewResult({ status: "error", message: "Invalid JSON in annotations" });
3754
+ setIsResolving(false);
3755
+ return;
3756
+ }
3447
3757
  try {
3448
3758
  const result = await resolve({
3449
3759
  definitions: { [selectedKey]: definitions[selectedKey] },
3450
3760
  context,
3451
3761
  options: {
3452
3762
  evaluators: builtinEvaluators,
3453
- ...fallback ? { fallback } : void 0
3763
+ ...fallback ? { fallback } : void 0,
3764
+ ...seedAnnotations ? { createAnnotations: () => ({ ...seedAnnotations }) } : void 0
3454
3765
  }
3455
3766
  });
3456
3767
  if (controller.signal.aborted) return;
@@ -3496,42 +3807,42 @@ function PreviewPanel() {
3496
3807
  setIsResolving(false);
3497
3808
  }
3498
3809
  }
3499
- }, [selectedKey, definitions, contextText, fallback]);
3500
- return /* @__PURE__ */ jsxs32("div", { className: "flex w-80 shrink-0 flex-col border-l border-border bg-muted/30", children: [
3501
- /* @__PURE__ */ jsx46("div", { className: "flex h-12 items-center border-b border-border px-3", children: /* @__PURE__ */ jsx46("span", { className: "text-sm font-semibold", children: "Preview" }) }),
3502
- /* @__PURE__ */ jsx46(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsxs32("div", { className: "space-y-4 p-3", children: [
3503
- /* @__PURE__ */ jsxs32("div", { children: [
3504
- /* @__PURE__ */ jsx46(Label, { className: "text-xs text-muted-foreground", children: "Definition" }),
3505
- /* @__PURE__ */ jsx46("p", { className: "mt-0.5 truncate font-mono text-sm", children: selectedKey ?? "None selected" })
3810
+ }, [selectedKey, definitions, contextText, annotationsText, fallback]);
3811
+ return /* @__PURE__ */ jsxs34("div", { className: "flex w-80 shrink-0 flex-col border-l border-border bg-muted/30", children: [
3812
+ /* @__PURE__ */ jsx48("div", { className: "flex h-12 items-center border-b border-border px-3", children: /* @__PURE__ */ jsx48("span", { className: "text-sm font-semibold", children: "Preview" }) }),
3813
+ /* @__PURE__ */ jsx48(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsxs34("div", { className: "space-y-4 p-3", children: [
3814
+ /* @__PURE__ */ jsxs34("div", { children: [
3815
+ /* @__PURE__ */ jsx48(Label, { className: "text-xs text-muted-foreground", children: "Definition" }),
3816
+ /* @__PURE__ */ jsx48("p", { className: "mt-0.5 truncate font-mono text-sm", children: selectedKey ?? "None selected" })
3506
3817
  ] }),
3507
- /* @__PURE__ */ jsx46(Separator, {}),
3508
- /* @__PURE__ */ jsxs32("div", { children: [
3509
- /* @__PURE__ */ jsxs32("div", { className: "flex items-center justify-between", children: [
3510
- /* @__PURE__ */ jsx46(Label, { className: "text-xs text-muted-foreground", children: "Context" }),
3511
- /* @__PURE__ */ jsxs32(
3818
+ /* @__PURE__ */ jsx48(Separator, {}),
3819
+ /* @__PURE__ */ jsxs34("div", { children: [
3820
+ /* @__PURE__ */ jsxs34("div", { className: "flex items-center justify-between", children: [
3821
+ /* @__PURE__ */ jsx48(Label, { className: "text-xs text-muted-foreground", children: "Context" }),
3822
+ /* @__PURE__ */ jsxs34(
3512
3823
  "button",
3513
3824
  {
3514
3825
  type: "button",
3515
3826
  className: "flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground",
3516
3827
  onClick: () => setJsonEditorOpen(true),
3517
3828
  children: [
3518
- /* @__PURE__ */ jsx46(Maximize2, { className: "h-3 w-3" }),
3829
+ /* @__PURE__ */ jsx48(Maximize2, { className: "h-3 w-3" }),
3519
3830
  "Edit"
3520
3831
  ]
3521
3832
  }
3522
3833
  )
3523
3834
  ] }),
3524
- /* @__PURE__ */ jsx46(
3835
+ /* @__PURE__ */ jsx48(
3525
3836
  "button",
3526
3837
  {
3527
3838
  type: "button",
3528
3839
  className: `mt-1.5 w-full cursor-pointer rounded-md border bg-transparent px-3 py-2 text-left transition-colors hover:border-ring ${contextError ? "border-destructive" : "border-input"}`,
3529
3840
  onClick: () => setJsonEditorOpen(true),
3530
- children: contextText.trim() ? /* @__PURE__ */ jsx46("pre", { className: "max-h-28 overflow-hidden font-mono text-xs text-foreground", children: contextText }) : /* @__PURE__ */ jsx46("span", { className: "font-mono text-xs text-muted-foreground", children: '{ "env": "production" }' })
3841
+ children: contextText.trim() ? /* @__PURE__ */ jsx48("pre", { className: "max-h-28 overflow-hidden font-mono text-xs text-foreground", children: contextText }) : /* @__PURE__ */ jsx48("span", { className: "font-mono text-xs text-muted-foreground", children: '{ "env": "production" }' })
3531
3842
  }
3532
3843
  ),
3533
- contextError && /* @__PURE__ */ jsx46("p", { className: "mt-1 text-[10px] text-destructive", children: contextError }),
3534
- /* @__PURE__ */ jsx46(
3844
+ contextError && /* @__PURE__ */ jsx48("p", { className: "mt-1 text-[10px] text-destructive", children: contextError }),
3845
+ /* @__PURE__ */ jsx48(
3535
3846
  JsonEditorDialog,
3536
3847
  {
3537
3848
  open: jsonEditorOpen,
@@ -3544,40 +3855,82 @@ function PreviewPanel() {
3544
3855
  }
3545
3856
  )
3546
3857
  ] }),
3547
- /* @__PURE__ */ jsx46(Separator, {}),
3548
- /* @__PURE__ */ jsxs32("div", { children: [
3549
- /* @__PURE__ */ jsxs32(
3858
+ /* @__PURE__ */ jsx48(Separator, {}),
3859
+ /* @__PURE__ */ jsxs34("div", { children: [
3860
+ /* @__PURE__ */ jsxs34(
3550
3861
  "button",
3551
3862
  {
3552
3863
  type: "button",
3553
3864
  className: "flex w-full items-center gap-1 text-xs text-muted-foreground hover:text-foreground",
3554
3865
  onClick: () => setSimulatorOpen((o) => !o),
3555
3866
  children: [
3556
- /* @__PURE__ */ jsx46(
3867
+ /* @__PURE__ */ jsx48(
3557
3868
  ChevronRight2,
3558
3869
  {
3559
3870
  className: `h-3.5 w-3.5 transition-transform ${simulatorOpen ? "rotate-90" : ""}`
3560
3871
  }
3561
3872
  ),
3562
- "Condition Simulator"
3873
+ "Condition Simulator",
3874
+ annotationsText.trim() || evaluatorText.trim() ? /* @__PURE__ */ jsx48("span", { className: "text-amber-500 font-medium", children: "(active)" }) : /* @__PURE__ */ jsx48("span", { className: "text-muted-foreground/50", children: "(inactive)" })
3563
3875
  ]
3564
3876
  }
3565
3877
  ),
3566
- simulatorOpen && /* @__PURE__ */ jsxs32("div", { className: "mt-2", children: [
3567
- /* @__PURE__ */ jsx46(
3568
- Textarea,
3569
- {
3570
- placeholder: "tier:true\ngeo:false",
3571
- value: evaluatorText,
3572
- onChange: (e) => setEvaluatorText(e.target.value),
3573
- className: "min-h-20 font-mono text-xs",
3574
- rows: 6
3575
- }
3576
- ),
3577
- /* @__PURE__ */ jsx46("p", { className: "mt-1 text-[10px] text-muted-foreground", children: "Simulate unregistered condition types. One type:true|false per line" })
3878
+ simulatorOpen && /* @__PURE__ */ jsxs34("div", { className: "mt-2 space-y-3", children: [
3879
+ /* @__PURE__ */ jsxs34("div", { children: [
3880
+ /* @__PURE__ */ jsxs34("div", { className: "flex items-center justify-between", children: [
3881
+ /* @__PURE__ */ jsx48(Label, { className: "text-[10px] text-muted-foreground", children: "Seed Annotations" }),
3882
+ /* @__PURE__ */ jsxs34(
3883
+ "button",
3884
+ {
3885
+ type: "button",
3886
+ className: "flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground",
3887
+ onClick: () => setAnnotationsEditorOpen(true),
3888
+ children: [
3889
+ /* @__PURE__ */ jsx48(Maximize2, { className: "h-3 w-3" }),
3890
+ "Edit"
3891
+ ]
3892
+ }
3893
+ )
3894
+ ] }),
3895
+ /* @__PURE__ */ jsx48(
3896
+ "button",
3897
+ {
3898
+ type: "button",
3899
+ className: "mt-1 w-full cursor-pointer rounded-md border border-input bg-transparent px-3 py-2 text-left transition-colors hover:border-ring",
3900
+ onClick: () => setAnnotationsEditorOpen(true),
3901
+ children: annotationsText.trim() ? /* @__PURE__ */ jsx48("pre", { className: "max-h-20 overflow-hidden font-mono text-xs text-foreground", children: annotationsText }) : /* @__PURE__ */ jsx48("span", { className: "font-mono text-xs text-muted-foreground", children: '{ "bucket": 42 }' })
3902
+ }
3903
+ ),
3904
+ /* @__PURE__ */ jsx48(
3905
+ JsonEditorDialog,
3906
+ {
3907
+ open: annotationsEditorOpen,
3908
+ onOpenChange: setAnnotationsEditorOpen,
3909
+ value: annotationsText,
3910
+ onSave: setAnnotationsText,
3911
+ title: "Edit Seed Annotations",
3912
+ description: "JSON object to pre-populate annotations for checkAnnotations conditions.",
3913
+ placeholder: '{\n "bucket": 42,\n "threshold": 80\n}'
3914
+ }
3915
+ )
3916
+ ] }),
3917
+ /* @__PURE__ */ jsxs34("div", { children: [
3918
+ /* @__PURE__ */ jsx48(Label, { className: "text-[10px] text-muted-foreground", children: "Evaluator Overrides" }),
3919
+ /* @__PURE__ */ jsx48(
3920
+ Textarea,
3921
+ {
3922
+ placeholder: "tier:true\ngeo:false",
3923
+ value: evaluatorText,
3924
+ onChange: (e) => setEvaluatorText(e.target.value),
3925
+ className: "mt-1 min-h-20 font-mono text-xs",
3926
+ rows: 4
3927
+ }
3928
+ ),
3929
+ /* @__PURE__ */ jsx48("p", { className: "mt-1 text-[10px] text-muted-foreground", children: "Simulate unregistered condition types. One type:true|false per line" })
3930
+ ] })
3578
3931
  ] })
3579
3932
  ] }),
3580
- /* @__PURE__ */ jsxs32(
3933
+ /* @__PURE__ */ jsxs34(
3581
3934
  Button,
3582
3935
  {
3583
3936
  size: "sm",
@@ -3585,28 +3938,44 @@ function PreviewPanel() {
3585
3938
  onClick: handleResolve,
3586
3939
  disabled: !selectedKey || isResolving,
3587
3940
  children: [
3588
- isResolving ? /* @__PURE__ */ jsx46(Loader2, { className: "mr-1.5 h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx46(Play, { className: "mr-1.5 h-4 w-4" }),
3941
+ isResolving ? /* @__PURE__ */ jsx48(Loader2, { className: "mr-1.5 h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx48(Play, { className: "mr-1.5 h-4 w-4" }),
3589
3942
  "Resolve"
3590
3943
  ]
3591
3944
  }
3592
3945
  ),
3593
- previewResult && /* @__PURE__ */ jsxs32(Fragment7, { children: [
3594
- /* @__PURE__ */ jsx46(Separator, {}),
3595
- /* @__PURE__ */ jsxs32("div", { className: "animate-slide-in-right", children: [
3596
- /* @__PURE__ */ jsx46(Label, { className: "text-xs text-muted-foreground", children: "Result" }),
3597
- /* @__PURE__ */ jsx46("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx46(
3946
+ /* @__PURE__ */ jsx48(
3947
+ Button,
3948
+ {
3949
+ variant: "outline",
3950
+ size: "sm",
3951
+ className: "w-full",
3952
+ onClick: () => {
3953
+ if (window.confirm("Reset all preview inputs? This cannot be undone.")) {
3954
+ resetPreview();
3955
+ setPreviewResult(null);
3956
+ setContextError(null);
3957
+ }
3958
+ },
3959
+ children: "Reset"
3960
+ }
3961
+ ),
3962
+ previewResult && /* @__PURE__ */ jsxs34(Fragment5, { children: [
3963
+ /* @__PURE__ */ jsx48(Separator, {}),
3964
+ /* @__PURE__ */ jsxs34("div", { className: "animate-slide-in-right", children: [
3965
+ /* @__PURE__ */ jsx48(Label, { className: "text-xs text-muted-foreground", children: "Result" }),
3966
+ /* @__PURE__ */ jsx48("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx48(
3598
3967
  ResultBadge,
3599
3968
  {
3600
3969
  result: previewResult,
3601
3970
  onViewMeta: previewResult.status === "success" ? () => setMetaDialogOpen(true) : void 0
3602
3971
  }
3603
3972
  ) }),
3604
- previewResult.status === "success" && /* @__PURE__ */ jsx46(Dialog, { open: metaDialogOpen, onOpenChange: setMetaDialogOpen, children: /* @__PURE__ */ jsxs32(DialogContent, { className: "sm:max-w-lg", children: [
3605
- /* @__PURE__ */ jsxs32(DialogHeader, { children: [
3606
- /* @__PURE__ */ jsx46(DialogTitle, { children: "Evaluation Meta" }),
3607
- /* @__PURE__ */ jsx46(DialogDescription, { children: "Full resolution metadata from the last evaluation." })
3973
+ previewResult.status === "success" && /* @__PURE__ */ jsx48(Dialog, { open: metaDialogOpen, onOpenChange: setMetaDialogOpen, children: /* @__PURE__ */ jsxs34(DialogContent, { className: "sm:max-w-lg", children: [
3974
+ /* @__PURE__ */ jsxs34(DialogHeader, { children: [
3975
+ /* @__PURE__ */ jsx48(DialogTitle, { children: "Evaluation Meta" }),
3976
+ /* @__PURE__ */ jsx48(DialogDescription, { children: "Full resolution metadata from the last evaluation." })
3608
3977
  ] }),
3609
- /* @__PURE__ */ jsx46(ScrollArea, { className: "max-h-96", children: /* @__PURE__ */ jsx46("pre", { className: "whitespace-pre-wrap break-all font-mono text-xs", children: JSON.stringify(previewResult.meta, null, 2) }) })
3978
+ /* @__PURE__ */ jsx48(ScrollArea, { className: "max-h-96", children: /* @__PURE__ */ jsx48("pre", { className: "whitespace-pre-wrap break-all font-mono text-xs", children: JSON.stringify(previewResult.meta, null, 2) }) })
3610
3979
  ] }) })
3611
3980
  ] })
3612
3981
  ] })
@@ -3615,9 +3984,9 @@ function PreviewPanel() {
3615
3984
  }
3616
3985
 
3617
3986
  // src/configurator/Configurator.tsx
3618
- import { Fragment as Fragment8, jsx as jsx47, jsxs as jsxs33 } from "react/jsx-runtime";
3987
+ import { Fragment as Fragment6, jsx as jsx49, jsxs as jsxs35 } from "react/jsx-runtime";
3619
3988
  function useNormalizedSource(store) {
3620
- return useMemo12(() => {
3989
+ return useMemo13(() => {
3621
3990
  if (isStoreSource(store)) {
3622
3991
  return store;
3623
3992
  }
@@ -3635,22 +4004,31 @@ function isStoreSource(obj) {
3635
4004
  function ErrorBanner() {
3636
4005
  const { actionState, clearError } = useActionState();
3637
4006
  if (!actionState.error) return null;
3638
- return /* @__PURE__ */ jsxs33(
4007
+ return /* @__PURE__ */ jsxs35(
3639
4008
  "div",
3640
4009
  {
3641
4010
  role: "alert",
3642
4011
  className: "flex items-center justify-between border-b border-destructive/30 bg-destructive/10 px-4 py-2",
3643
4012
  children: [
3644
- /* @__PURE__ */ jsxs33("p", { className: "text-xs font-medium text-destructive", children: [
4013
+ /* @__PURE__ */ jsxs35("p", { className: "text-xs font-medium text-destructive", children: [
3645
4014
  "Action failed: ",
3646
4015
  actionState.error.message
3647
4016
  ] }),
3648
- /* @__PURE__ */ jsx47("button", { type: "button", className: "text-xs text-destructive underline", onClick: clearError, children: "Dismiss" })
4017
+ /* @__PURE__ */ jsx49("button", { type: "button", className: "text-xs text-destructive underline", onClick: clearError, children: "Dismiss" })
3649
4018
  ]
3650
4019
  }
3651
4020
  );
3652
4021
  }
3653
- function EditorLayout({ emptyState }) {
4022
+ function EditorLayout({
4023
+ emptyState,
4024
+ sidebarHeader,
4025
+ definitionKeys,
4026
+ onBeforeSelect,
4027
+ isLoadingDefinition,
4028
+ conditionExtensionsResolver,
4029
+ onRefreshDefinition,
4030
+ onExportDefinition
4031
+ }) {
3654
4032
  const definitions = useConfiguratorSelector(selectDefinitions);
3655
4033
  const selectedKey = useConfiguratorSelector(selectSelectedKey);
3656
4034
  const validationErrors = useConfiguratorSelector(selectValidationErrors);
@@ -3658,56 +4036,75 @@ function EditorLayout({ emptyState }) {
3658
4036
  const revision = useConfiguratorSelector(selectRevision);
3659
4037
  const getStore = useStoreRef();
3660
4038
  const { actionState, runAction } = useActionState();
4039
+ const keysForList = definitionKeys ?? Object.keys(definitions);
3661
4040
  const selectedDefinition = selectedKey ? definitions[selectedKey] : null;
3662
- if (Object.keys(definitions).length === 0 && emptyState) {
3663
- return /* @__PURE__ */ jsx47(Fragment8, { children: emptyState });
4041
+ const resolvedExtensions = useMemo13(
4042
+ () => conditionExtensionsResolver && selectedKey ? conditionExtensionsResolver(selectedKey) : null,
4043
+ [conditionExtensionsResolver, selectedKey]
4044
+ );
4045
+ if (keysForList.length === 0 && emptyState) {
4046
+ return /* @__PURE__ */ jsx49(Fragment6, { children: emptyState });
3664
4047
  }
3665
- return /* @__PURE__ */ jsxs33("div", { className: "flex h-full flex-col", children: [
3666
- /* @__PURE__ */ jsx47(ErrorBanner, {}),
3667
- /* @__PURE__ */ jsxs33("div", { className: "flex flex-1 overflow-hidden", children: [
3668
- /* @__PURE__ */ jsx47("div", { className: "w-72 shrink-0 border-r border-border bg-muted/30", children: /* @__PURE__ */ jsx47(
3669
- DefinitionList,
3670
- {
3671
- definitions,
3672
- selectedKey,
3673
- validationErrors,
3674
- dirtyKeys,
3675
- onSelect: (key) => {
3676
- runAction(() => getStore().selectDefinition(key)).catch(() => {
3677
- });
3678
- },
3679
- onAdd: (key) => runAction(() => getStore().addDefinition(key)),
3680
- onRemove: (key) => {
3681
- runAction(() => getStore().removeDefinition(key)).catch(() => {
3682
- });
3683
- }
3684
- }
3685
- ) }),
3686
- /* @__PURE__ */ jsx47("div", { className: "flex-1 overflow-hidden bg-background", children: /* @__PURE__ */ jsx47(ErrorBoundary, { children: selectedDefinition && selectedKey ? /* @__PURE__ */ jsx47("div", { className: "h-full animate-fade-up", children: /* @__PURE__ */ jsx47(
3687
- DefinitionEditor,
3688
- {
3689
- definitionKey: selectedKey,
3690
- definition: selectedDefinition,
3691
- validationErrors: validationErrors[selectedKey],
3692
- isDirty: dirtyKeys.includes(selectedKey),
3693
- isPending: actionState.pending,
3694
- onUpdate: (def) => {
3695
- getStore().updateDefinition(selectedKey, def).catch(() => {
3696
- });
3697
- },
3698
- onRename: (newKey) => runAction(() => getStore().renameDefinition(selectedKey, newKey)),
3699
- onSave: () => {
3700
- runAction(() => getStore().saveDefinition(selectedKey)).catch(() => {
3701
- });
3702
- },
3703
- onDiscard: () => {
3704
- runAction(() => getStore().discardDefinition(selectedKey)).catch(() => {
3705
- });
4048
+ const editorContent = selectedDefinition && selectedKey ? /* @__PURE__ */ jsx49("div", { className: "h-full animate-fade-up", children: /* @__PURE__ */ jsx49(
4049
+ DefinitionEditor,
4050
+ {
4051
+ definitionKey: selectedKey,
4052
+ definition: selectedDefinition,
4053
+ validationErrors: validationErrors[selectedKey],
4054
+ isDirty: dirtyKeys.includes(selectedKey),
4055
+ isPending: actionState.pending,
4056
+ onUpdate: (def) => {
4057
+ getStore().updateDefinition(selectedKey, def).catch(() => {
4058
+ });
4059
+ },
4060
+ onRename: (newKey) => runAction(() => getStore().renameDefinition(selectedKey, newKey)),
4061
+ onSave: () => {
4062
+ runAction(() => getStore().saveDefinition(selectedKey)).catch(() => {
4063
+ });
4064
+ },
4065
+ onDiscard: () => {
4066
+ runAction(() => getStore().discardDefinition(selectedKey)).catch(() => {
4067
+ });
4068
+ },
4069
+ onRemove: () => {
4070
+ runAction(() => getStore().removeDefinition(selectedKey)).catch(() => {
4071
+ });
4072
+ },
4073
+ onRefresh: onRefreshDefinition && selectedKey ? () => onRefreshDefinition(selectedKey) : void 0,
4074
+ onExport: onExportDefinition && selectedDefinition ? (fmt) => onExportDefinition(selectedKey, selectedDefinition, fmt) : void 0
4075
+ },
4076
+ `${selectedKey}-${revision}`
4077
+ ) }, `anim-${selectedKey}-${revision}`) : isLoadingDefinition ? /* @__PURE__ */ jsx49("div", { className: "flex h-full items-center justify-center text-sm text-muted-foreground", children: "Loading definition\u2026" }) : /* @__PURE__ */ jsx49("div", { className: "flex h-full items-center justify-center text-sm text-muted-foreground", children: "Select a definition to edit" });
4078
+ return /* @__PURE__ */ jsxs35("div", { className: "flex h-full flex-col", children: [
4079
+ /* @__PURE__ */ jsx49(ErrorBanner, {}),
4080
+ /* @__PURE__ */ jsxs35("div", { className: "flex flex-1 overflow-hidden", children: [
4081
+ /* @__PURE__ */ jsxs35("div", { className: "flex w-72 shrink-0 flex-col overflow-hidden border-r border-border bg-muted/30", children: [
4082
+ sidebarHeader,
4083
+ /* @__PURE__ */ jsx49(
4084
+ DefinitionList,
4085
+ {
4086
+ keys: keysForList,
4087
+ definitions,
4088
+ selectedKey,
4089
+ validationErrors,
4090
+ dirtyKeys,
4091
+ onSelect: (key) => {
4092
+ runAction(async () => {
4093
+ if (onBeforeSelect) await onBeforeSelect(key);
4094
+ await getStore().selectDefinition(key);
4095
+ }).catch(() => {
4096
+ });
4097
+ },
4098
+ onAdd: (key) => runAction(() => getStore().addDefinition(key)),
4099
+ onRemove: (key) => {
4100
+ runAction(() => getStore().removeDefinition(key)).catch(() => {
4101
+ });
4102
+ }
3706
4103
  }
3707
- },
3708
- `${selectedKey}-${revision}`
3709
- ) }, `anim-${selectedKey}-${revision}`) : /* @__PURE__ */ jsx47("div", { className: "flex h-full items-center justify-center text-sm text-muted-foreground", children: "Select a definition to edit" }) }) }),
3710
- /* @__PURE__ */ jsx47(ErrorBoundary, { children: /* @__PURE__ */ jsx47(PreviewPanel, {}) })
4104
+ )
4105
+ ] }),
4106
+ /* @__PURE__ */ jsx49("div", { className: "flex-1 overflow-hidden bg-background", children: /* @__PURE__ */ jsx49(ErrorBoundary, { children: resolvedExtensions ? /* @__PURE__ */ jsx49(ConditionExtensionsProvider, { value: resolvedExtensions, children: editorContent }) : editorContent }) }),
4107
+ /* @__PURE__ */ jsx49(ErrorBoundary, { children: /* @__PURE__ */ jsx49(PreviewPanel, {}) })
3711
4108
  ] })
3712
4109
  ] });
3713
4110
  }
@@ -3715,12 +4112,31 @@ function Configurator({
3715
4112
  store,
3716
4113
  className,
3717
4114
  emptyState,
4115
+ sidebarHeader,
4116
+ definitionKeys,
4117
+ onBeforeSelect,
4118
+ isLoadingDefinition,
3718
4119
  conditionExtensions,
3719
- fallbackEvaluator
4120
+ conditionExtensionsResolver,
4121
+ fallbackEvaluator,
4122
+ onRefreshDefinition,
4123
+ onExportDefinition
3720
4124
  }) {
3721
4125
  const runner = useActionRunner();
3722
4126
  const storeSource = useNormalizedSource(store);
3723
- return /* @__PURE__ */ jsx47(StoreSourceContext.Provider, { value: storeSource, children: /* @__PURE__ */ jsx47(ActionStateContext.Provider, { value: runner, children: /* @__PURE__ */ jsx47(ConditionExtensionsProvider, { value: conditionExtensions ?? null, children: /* @__PURE__ */ jsx47(FallbackEvaluatorProvider, { value: fallbackEvaluator ?? null, children: /* @__PURE__ */ jsx47("div", { className, children: /* @__PURE__ */ jsx47(EditorLayout, { emptyState }) }) }) }) }) });
4127
+ return /* @__PURE__ */ jsx49(StoreSourceContext.Provider, { value: storeSource, children: /* @__PURE__ */ jsx49(ActionStateContext.Provider, { value: runner, children: /* @__PURE__ */ jsx49(ConditionExtensionsProvider, { value: conditionExtensions ?? null, children: /* @__PURE__ */ jsx49(FallbackEvaluatorProvider, { value: fallbackEvaluator ?? null, children: /* @__PURE__ */ jsx49("div", { className, children: /* @__PURE__ */ jsx49(
4128
+ EditorLayout,
4129
+ {
4130
+ emptyState,
4131
+ sidebarHeader,
4132
+ definitionKeys,
4133
+ onBeforeSelect,
4134
+ isLoadingDefinition,
4135
+ conditionExtensionsResolver,
4136
+ onRefreshDefinition,
4137
+ onExportDefinition
4138
+ }
4139
+ ) }) }) }) }) });
3724
4140
  }
3725
4141
  export {
3726
4142
  AUTO_ID_PREFIX,
@@ -3743,17 +4159,18 @@ export {
3743
4159
  DialogHeader,
3744
4160
  DialogTitle,
3745
4161
  DialogTrigger,
3746
- DropdownMenu,
3747
- DropdownMenuContent,
3748
- DropdownMenuItem,
3749
- DropdownMenuSeparator,
3750
- DropdownMenuTrigger,
3751
4162
  ErrorBoundary,
3752
4163
  Input,
3753
4164
  Label,
4165
+ Menu,
4166
+ MenuContent,
4167
+ MenuItem,
4168
+ MenuSeparator,
4169
+ MenuTrigger,
3754
4170
  Popover,
3755
4171
  PopoverContent,
3756
4172
  PopoverTrigger,
4173
+ PreviewStateProvider,
3757
4174
  ScrollArea,
3758
4175
  ScrollBar,
3759
4176
  Select,
@@ -3768,9 +4185,9 @@ export {
3768
4185
  StoreSourceContext,
3769
4186
  Switch,
3770
4187
  Tabs,
3771
- TabsContent,
3772
4188
  TabsList,
3773
- TabsTrigger,
4189
+ TabsPanel,
4190
+ TabsTab,
3774
4191
  Textarea,
3775
4192
  ThemeToggle,
3776
4193
  ValidationMessage,