@arbidocs/react 0.5.29 → 0.5.31

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.
@@ -2280,6 +2280,14 @@ function InlineMicButton({
2280
2280
  )
2281
2281
  ] });
2282
2282
  }
2283
+ function ThreadVisibilityIcon({
2284
+ shared,
2285
+ className,
2286
+ ...props
2287
+ }) {
2288
+ const Icon2 = shared ? lucideReact.MessageSquareShare : lucideReact.MessageSquareLock;
2289
+ return /* @__PURE__ */ jsxRuntime.jsx(Icon2, { ...props, className: chunkS6A6FSG7_cjs.cn(shared ? "text-secondary" : "text-primary", className) });
2290
+ }
2283
2291
  var ENTITY_MAPPINGS = {
2284
2292
  PRODUCT: {
2285
2293
  NAMES: {
@@ -2609,2457 +2617,2449 @@ var VisibilityIcon = ({
2609
2617
  className: [isShared ? "text-secondary" : "text-primary", className].filter(Boolean).join(" ")
2610
2618
  });
2611
2619
  };
2612
- var Select = SelectPrimitive__namespace.Root;
2613
- var SelectGroup = SelectPrimitive__namespace.Group;
2614
- var SelectValue = SelectPrimitive__namespace.Value;
2615
- function SelectPortal({
2616
- container,
2617
- ...props
2618
- }) {
2619
- const fallback = chunkHJDR5HEO_cjs.usePortalContainer();
2620
- return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { container: container ?? fallback, ...props });
2620
+
2621
+ // src/entities/tag-kinds.ts
2622
+ var KIND_ENTITY = {
2623
+ label: "LABEL",
2624
+ annotation: "ANNOTATION",
2625
+ search: "SAVED_SEARCH",
2626
+ issue: "ISSUE",
2627
+ person: "PERSON",
2628
+ organisation: "ORGANISATION"
2629
+ };
2630
+ function tagKindTitle(kind, { plural = false } = {}) {
2631
+ return getEntityLabel(KIND_ENTITY[kind], plural ? "PLURAL" : "SINGULAR");
2621
2632
  }
2622
- var SelectTrigger = React__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
2623
- SelectPrimitive__namespace.Trigger,
2624
- {
2625
- ref,
2626
- className: chunkS6A6FSG7_cjs.cn(
2627
- "flex h-9 pointer-coarse:min-h-11 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground/60 focus:outline-none focus-visible:border-ring/50 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
2628
- className
2629
- ),
2630
- ...props,
2631
- children: [
2632
- children,
2633
- /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 opacity-50" }) })
2634
- ]
2635
- }
2636
- ));
2637
- SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
2638
- var SelectScrollUpButton = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2639
- SelectPrimitive__namespace.ScrollUpButton,
2640
- {
2641
- ref,
2642
- className: chunkS6A6FSG7_cjs.cn("flex cursor-default items-center justify-center py-1", className),
2643
- ...props,
2644
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { className: "h-4 w-4" })
2645
- }
2646
- ));
2647
- SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
2648
- var SelectScrollDownButton = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2649
- SelectPrimitive__namespace.ScrollDownButton,
2650
- {
2651
- ref,
2652
- className: chunkS6A6FSG7_cjs.cn("flex cursor-default items-center justify-center py-1", className),
2653
- ...props,
2654
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4" })
2655
- }
2656
- ));
2657
- SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
2658
- var SelectContent = React__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(SelectPortal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2659
- SelectPrimitive__namespace.Content,
2660
- {
2661
- ref,
2662
- className: chunkS6A6FSG7_cjs.cn(
2663
- "relative z-50 max-h-[min(24rem,var(--radix-select-content-available-height))] min-w-[8rem] max-w-[calc(100vw-1rem)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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",
2664
- 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",
2665
- className
2666
- ),
2667
- position,
2668
- collisionPadding: chunkHJDR5HEO_cjs.getCollisionPadding(),
2669
- ...props,
2670
- children: [
2671
- /* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
2672
- /* @__PURE__ */ jsxRuntime.jsx(
2673
- SelectPrimitive__namespace.Viewport,
2674
- {
2675
- className: chunkS6A6FSG7_cjs.cn(
2676
- "p-1",
2677
- position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
2678
- ),
2679
- children
2680
- }
2681
- ),
2682
- /* @__PURE__ */ jsxRuntime.jsx(SelectScrollDownButton, {})
2683
- ]
2684
- }
2685
- ) }));
2686
- SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
2687
- var SelectLabel = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2688
- SelectPrimitive__namespace.Label,
2689
- {
2690
- ref,
2691
- className: chunkS6A6FSG7_cjs.cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className),
2692
- ...props
2693
- }
2694
- ));
2695
- SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
2696
- var SelectItem = React__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
2697
- SelectPrimitive__namespace.Item,
2698
- {
2699
- ref,
2700
- className: chunkS6A6FSG7_cjs.cn(
2701
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 pointer-coarse:min-h-11 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2702
- className
2703
- ),
2704
- ...props,
2705
- children: [
2706
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) }) }),
2707
- /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemText, { children })
2708
- ]
2709
- }
2710
- ));
2711
- SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
2712
- var SelectSeparator = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2713
- SelectPrimitive__namespace.Separator,
2714
- {
2715
- ref,
2716
- className: chunkS6A6FSG7_cjs.cn("-mx-1 my-1 h-px bg-muted", className),
2717
- ...props
2633
+ function tagKindNouns(kind) {
2634
+ return {
2635
+ singular: tagKindTitle(kind).toLowerCase(),
2636
+ plural: tagKindTitle(kind, { plural: true }).toLowerCase()
2637
+ };
2638
+ }
2639
+ var VARIANT_STYLES = {
2640
+ "mine-paid": {
2641
+ pill: "text-primary",
2642
+ icon: "text-primary"
2643
+ },
2644
+ other: {
2645
+ pill: "text-secondary",
2646
+ icon: "text-secondary"
2647
+ },
2648
+ "mine-free": {
2649
+ pill: "text-muted-foreground",
2650
+ icon: "text-muted-foreground"
2651
+ },
2652
+ common: {
2653
+ pill: "",
2654
+ icon: "text-muted-foreground"
2718
2655
  }
2719
- ));
2720
- SelectSeparator.displayName = SelectPrimitive__namespace.Separator.displayName;
2721
- var COLORS = {
2722
- text: "text-secondary",
2723
- bg: "bg-secondary"
2724
2656
  };
2725
- function isItemShared(item) {
2726
- return item.shared === true || item.is_shared === true;
2657
+ function resolveVariant(relation, paid, hasCollaborators) {
2658
+ if (relation === "common") return "common";
2659
+ if (relation === "other") return "other";
2660
+ if (relation === "mine") return paid ? "mine-paid" : "mine-free";
2661
+ if (paid) return hasCollaborators ? "other" : "mine-paid";
2662
+ return "mine-free";
2727
2663
  }
2728
- function VisibilityToggle({
2729
- items,
2730
- presentation = "toggle",
2731
- onToggle,
2732
- disabled = false,
2733
- disabledTooltip,
2734
- disablePrivate = false,
2735
- showLabel = true,
2736
- showTooltip = true,
2737
- tooltipActive,
2738
- tooltipInactive,
2739
- tooltipMixed,
2740
- label = "Visibility",
2741
- workspaceLabel = getEntityLabel("WORKSPACE"),
2742
- "data-testid": dataTestId
2664
+ function ProjectEntity({
2665
+ name,
2666
+ label,
2667
+ icon,
2668
+ subscription = "none",
2669
+ hasCollaborators = false,
2670
+ size = "sm",
2671
+ className,
2672
+ onClick,
2673
+ relation,
2674
+ isPaid,
2675
+ tooltipContent
2743
2676
  }) {
2744
- const itemsArray = React.useMemo(() => Array.isArray(items) ? items : [items], [items]);
2745
- const { isAllShared, isMixed } = React.useMemo(() => {
2746
- if (itemsArray.length === 0) return { isAllShared: false, isMixed: false };
2747
- const sharedCount = itemsArray.filter(isItemShared).length;
2748
- return {
2749
- isAllShared: sharedCount === itemsArray.length,
2750
- isMixed: sharedCount > 0 && sharedCount < itemsArray.length
2751
- };
2752
- }, [itemsArray]);
2753
- const isSingle = itemsArray.length === 1;
2754
- const defaultTooltipActive = `Hide${isSingle ? "" : " all"} from ${workspaceLabel} members`;
2755
- const defaultTooltipInactive = `Make${isSingle ? "" : " all"} visible to ${workspaceLabel} members`;
2756
- const defaultTooltipMixed = `Make all visible to ${workspaceLabel} members (some already shared)`;
2757
- const handleToggle = () => {
2758
- const shouldShare = !isAllShared;
2759
- if (disablePrivate && !shouldShare) return;
2760
- onToggle(shouldShare);
2761
- };
2762
- if (presentation === "select")
2763
- return /* @__PURE__ */ jsxRuntime.jsxs(
2764
- Select,
2765
- {
2766
- value: isMixed ? "mixed" : isAllShared ? "workspace" : "me",
2767
- onValueChange: (value) => onToggle(value === "workspace"),
2768
- disabled: disabled || !itemsArray.length,
2769
- children: [
2770
- /* @__PURE__ */ jsxRuntime.jsxs(
2771
- SelectTrigger,
2772
- {
2773
- "aria-label": label,
2774
- "data-testid": dataTestId,
2775
- className: "h-7 w-auto gap-1 border-0 bg-transparent px-1 text-xs font-normal text-muted-foreground shadow-none hover:bg-muted pointer-coarse:h-11",
2776
- children: [
2777
- showLabel && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
2778
- label,
2779
- ":"
2780
- ] }),
2781
- /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {})
2782
- ]
2783
- }
2784
- ),
2785
- /* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { children: [
2786
- /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "me", disabled: disablePrivate, children: "Me" }),
2787
- /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "workspace", children: "Workspace" }),
2788
- isMixed && /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "mixed", disabled: true, children: "Mixed" })
2789
- ] })
2790
- ]
2791
- }
2792
- );
2677
+ const paid = isPaid ?? (subscription === "active" || subscription === "past_due" || subscription === "dev");
2678
+ const variant = resolveVariant(relation, paid, hasCollaborators);
2679
+ const { pill, icon: iconClass } = VARIANT_STYLES[variant];
2680
+ const iconSizeClass = size === "base" ? "h-4 w-4" : "h-3.5 w-3.5";
2681
+ const iconNode = icon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: chunkS6A6FSG7_cjs.cn(iconSizeClass, iconClass) });
2793
2682
  return /* @__PURE__ */ jsxRuntime.jsx(
2794
- IconToggle,
2683
+ EntityPill,
2795
2684
  {
2796
- icon: lucideReact.Share2,
2797
- isActive: isAllShared,
2798
- onToggle: handleToggle,
2799
- colors: COLORS,
2800
- inactiveColors: { text: "text-primary", bg: "bg-primary/10" },
2801
- disabled: disabled || itemsArray.length === 0,
2802
- disabledTooltip,
2803
- showLabel,
2804
- showTooltip,
2805
- label,
2806
- isMixed,
2807
- tooltipActive: tooltipActive || defaultTooltipActive,
2808
- tooltipInactive: tooltipInactive || defaultTooltipInactive,
2809
- tooltipMixed: tooltipMixed || defaultTooltipMixed,
2810
- "data-testid": dataTestId
2685
+ icon: iconNode,
2686
+ label: label ?? name,
2687
+ size,
2688
+ shape: "rounded",
2689
+ className: chunkS6A6FSG7_cjs.cn(pill, className),
2690
+ onClick,
2691
+ tooltipContent
2811
2692
  }
2812
2693
  );
2813
2694
  }
2814
- var COLORS2 = {
2815
- text: "text-green-text",
2816
- bg: "bg-green-text"
2695
+ var ArbiBotHeadIcon = ({ size = 24, className = "" }) => {
2696
+ const maskId = React.useId();
2697
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2698
+ "svg",
2699
+ {
2700
+ xmlns: "http://www.w3.org/2000/svg",
2701
+ width: size,
2702
+ height: size,
2703
+ viewBox: "30 -5 190 190",
2704
+ preserveAspectRatio: "xMidYMid meet",
2705
+ className,
2706
+ children: [
2707
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("mask", { id: maskId, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", children: [
2708
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "0", y: "0", width: "2500", height: "2500", fill: "white" }),
2709
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "855", cy: "1715", r: "190", fill: "black" }),
2710
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "855", cy: "1715", r: "50", fill: "white" }),
2711
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "1665", cy: "1700", r: "190", fill: "black" }),
2712
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "1665", cy: "1700", r: "50", fill: "white" })
2713
+ ] }) }) }),
2714
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { mask: `url(#${maskId})`, children: [
2715
+ /* @__PURE__ */ jsxRuntime.jsx(
2716
+ "g",
2717
+ {
2718
+ transform: "translate(0,250) scale(0.1,-0.1)",
2719
+ fill: "currentColor",
2720
+ stroke: "currentColor",
2721
+ strokeWidth: "100",
2722
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1038 2434 c-217 -39 -406 -154 -522 -318 -121 -170 -176 -376 -103 -384 l27 -3 0 -106 c0 -88 -3 -108 -17 -118 -15 -11 -16 -18 -5 -66 44 -188 209 -369 420 -459 l65 -28 -74 -7 c-283 -26 -444 -152 -535 -418 -70 -204 -73 -507 -5 -507 4 0 12 75 19 168 18 263 68 419 167 530 78 87 224 162 263 134 9 -6 43 -26 76 -43 224 -117 802 -95 948 38 38 34 165 -22 253 -111 117 -119 168 -268 187 -549 6 -92 15 -167 19 -167 89 0 53 415 -54 627 -88 173 -238 270 -458 295 l-99 11 75 32 c201 88 367 274 406 454 10 47 9 56 -5 66 -13 10 -16 32 -16 118 l0 106 28 3 c91 10 -12 297 -165 459 -202 214 -544 307 -895 243z m472 -84 c170 -43 323 -140 416 -264 47 -61 117 -197 128 -248 l6 -28 -65 0 c-64 0 -65 1 -78 33 -43 102 -109 136 -262 137 l-110 0 -38 -40 c-25 -27 -46 -40 -65 -41 -134 -5 -394 1 -410 10 -11 6 -30 24 -42 41 l-21 30 -112 0 c-156 -1 -219 -33 -262 -136 -14 -34 -14 -34 -80 -34 -76 0 -74 -7 -30 103 96 243 311 406 595 452 118 20 319 13 430 -15z m-561 -505 c97 -50 126 -174 61 -263 -118 -163 -380 -23 -309 165 35 93 162 143 248 98z m799 -15 c129 -96 69 -304 -92 -318 -189 -16 -265 218 -106 326 48 33 149 29 198 -8z m272 -389 c0 -23 -45 -110 -86 -168 -245 -343 -856 -408 -1231 -130 -90 67 -213 236 -213 294 0 11 132 13 765 13 457 0 765 -4 765 -9z" })
2723
+ }
2724
+ ),
2725
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", fill: "currentColor", stroke: "none", children: [
2726
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M785 1777 c-60 -60 -59 -134 1 -186 92 -82 236 9 204 128 -25 93 -138 125 -205 58z m161 -29 c7 -22 -19 -52 -40 -45 -21 7 -30 35 -17 51 19 23 48 20 57 -6z" }),
2727
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1591 1803 c-128 -67 -85 -243 60 -243 83 0 141 99 105 178 -32 69 -103 97 -165 65z m127 -59 c4 -25 -19 -47 -41 -38 -22 8 -30 34 -16 51 17 20 53 12 57 -13z" }),
2728
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M843 1347 c-9 -15 9 -63 41 -108 148 -202 565 -209 730 -12 37 44 60 103 47 116 -13 13 -810 17 -818 4z" })
2729
+ ] })
2730
+ ] })
2731
+ ]
2732
+ }
2733
+ );
2817
2734
  };
2818
- function VerifiedToggle({
2819
- verified,
2820
- onToggle,
2821
- disabled = false,
2822
- showLabel = true,
2823
- showTooltip = true,
2824
- tooltipActive,
2825
- tooltipInactive,
2826
- "data-testid": dataTestId
2827
- }) {
2735
+ function VerifiedBadge({ className, label = "Identity verified" }) {
2828
2736
  return /* @__PURE__ */ jsxRuntime.jsx(
2829
- IconToggle,
2737
+ lucideReact.BadgeCheck,
2830
2738
  {
2831
- icon: lucideReact.CheckCircle2,
2832
- isActive: verified,
2833
- onToggle,
2834
- colors: COLORS2,
2835
- disabled,
2836
- showLabel,
2837
- label: "Verified",
2838
- showTooltip,
2839
- tooltipActive: tooltipActive || "Verified by a human \u2014 click to unverify",
2840
- tooltipInactive: tooltipInactive || "Not verified \u2014 click to verify",
2841
- "data-testid": dataTestId
2739
+ role: "img",
2740
+ "aria-label": label,
2741
+ "data-testid": "verified-badge",
2742
+ className: chunkS6A6FSG7_cjs.cn("h-3.5 w-3.5 shrink-0 text-sky-500", className),
2743
+ children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: label })
2842
2744
  }
2843
2745
  );
2844
2746
  }
2845
-
2846
- // src/lib/format-friendly-date.ts
2847
- function formatFriendlyDate(dateString, includeTime = true) {
2848
- if (!dateString) return "";
2849
- try {
2850
- if (dateString.includes("Today") || dateString.includes("Yesterday") || /\w+ \d+, \d+:\d+:\d+/.test(dateString)) {
2851
- return dateString;
2852
- }
2853
- if (/^\d{1,2}:\d{2}(:\d{2})?$/.test(dateString)) {
2854
- return dateString;
2855
- }
2856
- const date = new Date(dateString);
2857
- if (isNaN(date.getTime())) return dateString;
2858
- const timeOptions = { hour: "2-digit", minute: "2-digit" };
2859
- const timeString = date.toLocaleTimeString([], timeOptions);
2860
- const now = /* @__PURE__ */ new Date();
2861
- const today = now.toDateString();
2862
- const yesterday = new Date(now);
2863
- yesterday.setDate(yesterday.getDate() - 1);
2864
- if (date.toDateString() === today) {
2865
- return includeTime ? `Today, ${timeString}` : "today";
2866
- } else if (date.toDateString() === yesterday.toDateString()) {
2867
- return includeTime ? `Yesterday, ${timeString}` : "yesterday";
2868
- } else {
2869
- const dateOptions = {
2870
- month: "short",
2871
- day: "numeric"
2872
- };
2873
- if (date.getFullYear() !== now.getFullYear()) {
2874
- dateOptions.year = "numeric";
2747
+ var sizeClasses = {
2748
+ xs: "h-5 w-5",
2749
+ sm: "h-6 w-6",
2750
+ md: "h-8 w-8",
2751
+ lg: "h-10 w-10"
2752
+ };
2753
+ var textSizeClasses = {
2754
+ xs: "text-xs",
2755
+ sm: "text-xs",
2756
+ md: "text-xs",
2757
+ lg: "text-sm"
2758
+ };
2759
+ var presenceDotClasses = {
2760
+ xs: "w-2 h-2 border",
2761
+ sm: "w-2.5 h-2.5 border",
2762
+ md: "w-3 h-3 border-2",
2763
+ lg: "w-3.5 h-3.5 border-2"
2764
+ };
2765
+ var presencePositionClasses = {
2766
+ xs: "-right-1 bottom-0",
2767
+ sm: "-right-1 bottom-0",
2768
+ md: "-right-1.5 -bottom-0.5",
2769
+ lg: "-right-1.5 -bottom-0.5"
2770
+ };
2771
+ var PRESENCE_LABELS = {
2772
+ connected: "Online",
2773
+ connecting: "Connecting",
2774
+ disconnected: "Offline",
2775
+ error: "Connection problem",
2776
+ hidden: "Status hidden"
2777
+ };
2778
+ var presenceColorClasses = {
2779
+ connected: "bg-status-online",
2780
+ connecting: "bg-status-connecting",
2781
+ disconnected: "bg-status-away",
2782
+ error: "bg-status-busy",
2783
+ hidden: "bg-status-offline"
2784
+ };
2785
+ var UserEntity = React.memo(function UserEntity2({
2786
+ size = "md",
2787
+ variant = "pill",
2788
+ className,
2789
+ showTooltip = true,
2790
+ interactive = true,
2791
+ hasUnreadMessages = false,
2792
+ initials = "",
2793
+ displayName = "",
2794
+ picture,
2795
+ avatarImageClassName,
2796
+ colorClass = "",
2797
+ isAgent: isAgent2 = false,
2798
+ isVerified = false,
2799
+ agentStyle,
2800
+ avatarStyle,
2801
+ isMe = false,
2802
+ displayStatus,
2803
+ onClick,
2804
+ tooltipContent,
2805
+ empty = false
2806
+ }) {
2807
+ if (empty) {
2808
+ return /* @__PURE__ */ jsxRuntime.jsx(
2809
+ chunkEEIYXVM4_cjs.Avatar,
2810
+ {
2811
+ className: chunkS6A6FSG7_cjs.cn(sizeClasses[size], "border border-border", className),
2812
+ "data-testid": "user-entity",
2813
+ children: /* @__PURE__ */ jsxRuntime.jsx(chunkEEIYXVM4_cjs.AvatarFallback, { className: "bg-status-empty text-muted-foreground text-xs font-semibold", children: "?" })
2875
2814
  }
2876
- const formattedDate = date.toLocaleDateString([], dateOptions);
2877
- return includeTime ? `${formattedDate}, ${timeString}` : formattedDate;
2878
- }
2879
- } catch {
2880
- return dateString;
2815
+ );
2881
2816
  }
2882
- }
2883
-
2884
- // src/lib/markdown-to-text.ts
2885
- function markdownToPlainText(input) {
2886
- if (!input) return "";
2887
- return input.replace(/```[^\n]*\n?/g, "").replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/^[ \t]*#{1,6}[ \t]+/gm, "").replace(/^[ \t]*>[ \t]?/gm, "").replace(/^[ \t]*([-*+]|\d+[.)])[ \t]+/gm, "").replace(/(\*\*|__)(.*?)\1/g, "$2").replace(/(\*|_)(.*?)\1/g, "$2").replace(/`([^`]*)`/g, "$1").replace(/\s+/g, " ").trim();
2888
- }
2889
- var TABLE_DELIMITER_ROW = /^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/;
2890
- function splitTableRow(line) {
2891
- return line.trim().replace(/^\|/, "").replace(/(?<!\\)\|$/, "").split(/(?<!\\)\|/).map((cell) => cell.trim().replace(/\\\|/g, "|"));
2892
- }
2893
- function flattenMarkdownTables(input) {
2894
- const lines = input.split("\n");
2895
- const out = [];
2896
- for (let i = 0; i < lines.length; i++) {
2897
- const isTableStart = lines[i].includes("|") && i + 1 < lines.length && lines[i + 1].includes("|") && TABLE_DELIMITER_ROW.test(lines[i + 1]);
2898
- if (!isTableStart) {
2899
- out.push(lines[i]);
2900
- continue;
2817
+ const agentBadge = isAgent2 ? /* @__PURE__ */ jsxRuntime.jsx(ArbiBotHeadIcon, { className: "w-3.5 h-3.5 text-muted-foreground" }) : void 0;
2818
+ const canMessage = interactive && !isMe && !isAgent2;
2819
+ const showUnread = hasUnreadMessages && !isMe && !isAgent2;
2820
+ const surfaceStyle = avatarStyle ?? agentStyle;
2821
+ const avatarCore = /* @__PURE__ */ jsxRuntime.jsxs(
2822
+ chunkEEIYXVM4_cjs.Avatar,
2823
+ {
2824
+ className: chunkS6A6FSG7_cjs.cn(
2825
+ sizeClasses[size],
2826
+ isAgent2 ? "rounded-full border-2 border-dashed" : "border border-white"
2827
+ ),
2828
+ style: surfaceStyle,
2829
+ "data-testid": "user-entity",
2830
+ children: [
2831
+ picture && /* @__PURE__ */ jsxRuntime.jsx(chunkEEIYXVM4_cjs.AvatarImage, { src: picture, alt: initials, className: avatarImageClassName }),
2832
+ /* @__PURE__ */ jsxRuntime.jsx(
2833
+ chunkEEIYXVM4_cjs.AvatarFallback,
2834
+ {
2835
+ className: chunkS6A6FSG7_cjs.cn(
2836
+ textSizeClasses[size],
2837
+ "font-semibold leading-none",
2838
+ isAgent2 ? "rounded-full bg-transparent" : `text-white ${colorClass}`
2839
+ ),
2840
+ style: surfaceStyle,
2841
+ children: initials
2842
+ }
2843
+ )
2844
+ ]
2901
2845
  }
2902
- out.push(splitTableRow(lines[i]).join(" "));
2903
- i += 1;
2904
- while (i + 1 < lines.length && lines[i + 1].includes("|") && lines[i + 1].trim()) {
2905
- i += 1;
2906
- out.push(splitTableRow(lines[i]).join(" "));
2846
+ );
2847
+ const statusDot = showUnread || displayStatus ? /* @__PURE__ */ jsxRuntime.jsx(
2848
+ "span",
2849
+ {
2850
+ className: chunkS6A6FSG7_cjs.cn(
2851
+ "absolute rounded-full border-white",
2852
+ presenceDotClasses[size],
2853
+ presencePositionClasses[size],
2854
+ !showUnread && displayStatus ? presenceColorClasses[displayStatus] : ""
2855
+ ),
2856
+ style: showUnread ? { backgroundColor: "#00adef" } : void 0,
2857
+ "data-testid": "user-entity-presence",
2858
+ role: "img",
2859
+ "aria-label": showUnread ? "Unread messages" : PRESENCE_LABELS[displayStatus],
2860
+ title: showUnread ? "Unread messages" : PRESENCE_LABELS[displayStatus]
2907
2861
  }
2908
- }
2909
- return out.join("\n");
2910
- }
2911
- function markdownToPlainTextBlocks(input) {
2912
- if (!input) return "";
2913
- return flattenMarkdownTables(input).replace(/^[ \t]*([-*_])([ \t]*\1){2,}[ \t]*$/gm, "").replace(/```[^\n]*\n?/g, "").replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, "$1 ($2)").replace(/^[ \t]*#{1,6}[ \t]+/gm, "").replace(/^[ \t]*>[ \t]?/gm, "").replace(/(\*\*|__)(?=\S)(.+?)(?<=\S)\1/g, "$2").replace(/\*(?=\S)(.+?)(?<=\S)\*/g, "$1").replace(/(^|[^\w])_(?=\S)(.+?)(?<=\S)_(?!\w)/g, "$1$2").replace(/`([^`]*)`/g, "$1").replace(/[ \t]+\n/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
2914
- }
2915
-
2916
- // src/ui/DictateContext.tsx
2917
- function useDictateContext() {
2918
- return chunkRCKA7BEF_cjs.useHostConfigRecord().dictate ?? null;
2919
- }
2920
- var Input = React__namespace.forwardRef(
2921
- ({ className, type, dictate, onFocus, onBlur, ...props }, forwardedRef) => {
2922
- const dictateCtx = useDictateContext();
2923
- const [focused, setFocused] = React__namespace.useState(false);
2924
- const innerRef = React__namespace.useRef(null);
2925
- React__namespace.useImperativeHandle(forwardedRef, () => innerRef.current);
2926
- const showDictate = dictate && !!dictateCtx && !props.disabled && !props.readOnly;
2927
- const input = /* @__PURE__ */ jsxRuntime.jsx(
2928
- "input",
2929
- {
2930
- type,
2931
- "data-slot": "input",
2932
- className: chunkS6A6FSG7_cjs.cn(
2933
- "flex h-9 pointer-coarse:h-11 w-full rounded-md border border-input bg-background px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/60 focus-visible:outline-none focus-visible:border-ring/50 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
2934
- showDictate && "pr-9",
2935
- className
2936
- ),
2937
- ref: innerRef,
2938
- onFocus: (e) => {
2939
- setFocused(true);
2940
- onFocus?.(e);
2941
- },
2942
- onBlur: (e) => {
2943
- setFocused(false);
2944
- onBlur?.(e);
2945
- },
2946
- ...props
2947
- }
2948
- );
2949
- if (!showDictate) return input;
2950
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full", children: [
2951
- input,
2952
- /* @__PURE__ */ jsxRuntime.jsx(
2953
- InlineMicButton,
2862
+ ) : null;
2863
+ const avatarElement = statusDot ? /* @__PURE__ */ jsxRuntime.jsxs(
2864
+ "div",
2865
+ {
2866
+ className: chunkS6A6FSG7_cjs.cn(
2867
+ "relative inline-block",
2868
+ sizeClasses[size],
2869
+ variant === "pill" ? "" : className
2870
+ ),
2871
+ children: [
2872
+ avatarCore,
2873
+ statusDot
2874
+ ]
2875
+ }
2876
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkS6A6FSG7_cjs.cn("inline-block", variant === "pill" ? "" : className), children: avatarCore });
2877
+ const pillAvatar = (
2878
+ // shrink-0: when the pill is squeezed the NAME truncates away — the avatar
2879
+ // must never collapse under it and overflow onto neighbouring text.
2880
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: chunkS6A6FSG7_cjs.cn("relative inline-block shrink-0", sizeClasses[size]), children: [
2881
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkS6A6FSG7_cjs.cn("block transition-opacity", canMessage && "group-hover/pill:opacity-0"), children: avatarCore }),
2882
+ canMessage && /* @__PURE__ */ jsxRuntime.jsx(
2883
+ "span",
2954
2884
  {
2955
- focused,
2956
- transcribe: dictateCtx.transcribe,
2957
- onError: dictateCtx.onError,
2958
- className: "absolute right-1.5 top-1/2 -translate-y-1/2",
2959
- onTranscript: (text) => {
2960
- const el = innerRef.current;
2961
- if (!el) return;
2962
- const next = el.value ? `${el.value} ${text}` : text;
2963
- const setter = Object.getOwnPropertyDescriptor(
2964
- window.HTMLInputElement.prototype,
2965
- "value"
2966
- )?.set;
2967
- setter?.call(el, next);
2968
- el.dispatchEvent(new Event("input", { bubbles: true }));
2969
- }
2885
+ "aria-hidden": true,
2886
+ className: "absolute inset-0 flex items-center justify-center rounded-full bg-muted text-foreground opacity-0 transition-opacity group-hover/pill:opacity-100",
2887
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageCircleMore, { className: size === "xs" ? "h-3 w-3" : "h-4 w-4" })
2970
2888
  }
2971
- )
2889
+ ),
2890
+ statusDot
2891
+ ] })
2892
+ );
2893
+ const resolvedTooltip = showTooltip ? tooltipContent : void 0;
2894
+ if (variant === "pill") {
2895
+ const row = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2896
+ pillAvatar,
2897
+ displayName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 max-w-[320px] truncate text-sm leading-tight", children: displayName }),
2898
+ isVerified && !isAgent2 && /* @__PURE__ */ jsxRuntime.jsx(VerifiedBadge, {}),
2899
+ agentBadge
2972
2900
  ] });
2973
- }
2974
- );
2975
- Input.displayName = "Input";
2976
- var Textarea = React__namespace.forwardRef(
2977
- ({ className, dictate, onFocus, onBlur, ...props }, forwardedRef) => {
2978
- const dictateCtx = useDictateContext();
2979
- const [focused, setFocused] = React__namespace.useState(false);
2980
- const innerRef = React__namespace.useRef(null);
2981
- React__namespace.useImperativeHandle(forwardedRef, () => innerRef.current);
2982
- const showDictate = dictate && !!dictateCtx && !props.disabled && !props.readOnly;
2983
- const textarea = /* @__PURE__ */ jsxRuntime.jsx(
2984
- "textarea",
2985
- {
2986
- className: chunkS6A6FSG7_cjs.cn(
2987
- "flex min-h-[60px] w-full rounded-md border border-input bg-background px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground/60 focus-visible:outline-none focus-visible:border-ring/50 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
2988
- showDictate && "pr-9",
2989
- className
2901
+ const rowClass = "group/pill inline-flex min-w-0 items-center gap-2";
2902
+ const clickable = interactive && !!onClick;
2903
+ const clickableClass = "relative cursor-pointer rounded-md px-1 py-0.5 -mx-1 transition-colors hover:bg-muted/60 pointer-coarse:after:absolute pointer-coarse:after:inset-x-0 pointer-coarse:after:-inset-y-3 pointer-coarse:after:content-['']";
2904
+ if (resolvedTooltip) {
2905
+ return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
2906
+ /* @__PURE__ */ jsxRuntime.jsx(
2907
+ TooltipTrigger,
2908
+ {
2909
+ type: "button",
2910
+ onClick: clickable ? onClick : void 0,
2911
+ onFocusCapture: (e) => e.stopPropagation(),
2912
+ className: chunkS6A6FSG7_cjs.cn(rowClass, clickable && clickableClass, className),
2913
+ "data-testid": "user-entity-pill",
2914
+ children: row
2915
+ }
2990
2916
  ),
2991
- ref: innerRef,
2992
- onFocus: (e) => {
2993
- setFocused(true);
2994
- onFocus?.(e);
2995
- },
2996
- onBlur: (e) => {
2997
- setFocused(false);
2998
- onBlur?.(e);
2999
- },
3000
- ...props
3001
- }
3002
- );
3003
- if (!showDictate) return textarea;
3004
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full", children: [
3005
- textarea,
2917
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { className: "p-2", children: resolvedTooltip })
2918
+ ] });
2919
+ }
2920
+ if (clickable) {
2921
+ return /* @__PURE__ */ jsxRuntime.jsx(
2922
+ "button",
2923
+ {
2924
+ type: "button",
2925
+ onClick,
2926
+ className: chunkS6A6FSG7_cjs.cn(rowClass, clickableClass, className),
2927
+ "data-testid": "user-entity-pill",
2928
+ children: row
2929
+ }
2930
+ );
2931
+ }
2932
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkS6A6FSG7_cjs.cn(rowClass, className), "data-testid": "user-entity-pill", children: row });
2933
+ }
2934
+ if (showTooltip) {
2935
+ return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
3006
2936
  /* @__PURE__ */ jsxRuntime.jsx(
3007
- InlineMicButton,
2937
+ TooltipTrigger,
3008
2938
  {
3009
- focused,
3010
- transcribe: dictateCtx.transcribe,
3011
- onError: dictateCtx.onError,
3012
- className: "absolute right-1.5 top-1.5",
3013
- onTranscript: (text) => {
3014
- const el = innerRef.current;
3015
- if (!el) return;
3016
- const next = el.value ? `${el.value} ${text}` : text;
3017
- const setter = Object.getOwnPropertyDescriptor(
3018
- window.HTMLTextAreaElement.prototype,
3019
- "value"
3020
- )?.set;
3021
- setter?.call(el, next);
3022
- el.dispatchEvent(new Event("input", { bubbles: true }));
3023
- }
2939
+ onFocusCapture: (e) => e.stopPropagation(),
2940
+ className: "touch-hit inline-flex",
2941
+ children: avatarElement
3024
2942
  }
3025
- )
2943
+ ),
2944
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { className: "p-2", children: tooltipContent })
3026
2945
  ] });
3027
2946
  }
3028
- );
3029
- Textarea.displayName = "Textarea";
3030
- function DebouncedInput({
3031
- value,
3032
- onChange,
3033
- disabled,
3034
- type = "text",
3035
- multiline = false,
3036
- className,
3037
- debounceMs = 500,
3038
- placeholder,
3039
- autoResize = true,
3040
- minHeight = 28,
3041
- maxHeight = 72
3042
- }) {
3043
- const [localValue, setLocalValue] = React.useState(value);
3044
- const timeoutRef = React.useRef(void 0);
3045
- const pendingRef = React.useRef(null);
3046
- const textareaRef = React.useRef(null);
3047
- const adjustHeight = React.useCallback(() => {
3048
- const textarea = textareaRef.current;
3049
- if (!textarea || !autoResize) return;
3050
- textarea.style.height = "auto";
3051
- const newHeight = Math.min(Math.max(textarea.scrollHeight, minHeight), maxHeight);
3052
- textarea.style.height = `${newHeight}px`;
3053
- }, [autoResize, minHeight, maxHeight]);
3054
- React.useEffect(() => {
3055
- if (pendingRef.current !== null) return;
3056
- setLocalValue(value);
3057
- }, [value]);
3058
- React.useEffect(() => {
3059
- if (multiline) {
3060
- adjustHeight();
2947
+ return avatarElement;
2948
+ });
2949
+ function AgentBadge({ className }) {
2950
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2951
+ "span",
2952
+ {
2953
+ "data-testid": "agent-badge",
2954
+ className: chunkS6A6FSG7_cjs.cn(
2955
+ "inline-flex shrink-0 items-center gap-1 rounded-full border border-ai-accent/50",
2956
+ "bg-ai-accent-soft px-2 py-0.5 text-xs font-bold uppercase tracking-wider text-ai-accent",
2957
+ className
2958
+ ),
2959
+ children: [
2960
+ /* @__PURE__ */ jsxRuntime.jsx(ArbiBotHeadIcon, { size: 14, className: "text-ai-accent" }),
2961
+ "Agent"
2962
+ ]
3061
2963
  }
3062
- }, [localValue, multiline, adjustHeight]);
3063
- const onChangeRef = React.useRef(onChange);
3064
- React.useEffect(() => {
3065
- onChangeRef.current = onChange;
3066
- }, [onChange]);
3067
- const flushPendingChange = React.useCallback(() => {
3068
- if (pendingRef.current === null) return false;
3069
- const pending = pendingRef.current;
3070
- pendingRef.current = null;
3071
- clearTimeout(timeoutRef.current);
3072
- onChangeRef.current(pending);
3073
- return true;
3074
- }, []);
3075
- const handleChange = React.useCallback(
3076
- (e) => {
3077
- const newValue = e.target.value;
3078
- setLocalValue(newValue);
3079
- pendingRef.current = newValue;
3080
- clearTimeout(timeoutRef.current);
3081
- timeoutRef.current = setTimeout(() => {
3082
- pendingRef.current = null;
3083
- onChangeRef.current(newValue);
3084
- }, debounceMs);
3085
- },
3086
- [debounceMs]
3087
2964
  );
3088
- React.useEffect(
3089
- () => () => {
3090
- const pending = pendingRef.current;
3091
- pendingRef.current = null;
3092
- clearTimeout(timeoutRef.current);
3093
- if (pending !== null) onChangeRef.current(pending);
3094
- },
3095
- []
3096
- );
3097
- const handleBlur = React.useCallback(() => {
3098
- flushPendingChange();
3099
- if (localValue !== value) {
3100
- setLocalValue(value);
3101
- }
3102
- }, [flushPendingChange, localValue, value]);
3103
- if (multiline) {
3104
- return /* @__PURE__ */ jsxRuntime.jsx(
3105
- Textarea,
3106
- {
3107
- ref: textareaRef,
3108
- value: localValue,
3109
- onChange: handleChange,
3110
- onBlur: handleBlur,
3111
- disabled,
3112
- className: `resize-y ${className || ""}`,
3113
- placeholder,
3114
- style: { minHeight: `${minHeight}px` }
3115
- }
3116
- );
3117
- }
3118
- return /* @__PURE__ */ jsxRuntime.jsx(
3119
- Input,
2965
+ }
2966
+ var PRESENCE_WORDS = {
2967
+ connected: "Online",
2968
+ connecting: "Connecting",
2969
+ disconnected: "Offline",
2970
+ error: "Connection problem",
2971
+ hidden: null
2972
+ };
2973
+ function PresenceLabel({
2974
+ status,
2975
+ className
2976
+ }) {
2977
+ if (!status) return null;
2978
+ const word = PRESENCE_WORDS[status];
2979
+ if (!word) return null;
2980
+ const online = status === "connected";
2981
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2982
+ "span",
3120
2983
  {
3121
- type,
3122
- value: localValue,
3123
- onChange: handleChange,
3124
- onBlur: handleBlur,
3125
- disabled,
3126
- className,
3127
- placeholder
2984
+ "data-testid": "presence-label",
2985
+ className: chunkS6A6FSG7_cjs.cn("inline-flex shrink-0 items-center gap-1 text-xs", className),
2986
+ children: [
2987
+ /* @__PURE__ */ jsxRuntime.jsx(
2988
+ "span",
2989
+ {
2990
+ className: chunkS6A6FSG7_cjs.cn(
2991
+ "size-1.5 rounded-full",
2992
+ online ? "bg-status-online" : "bg-muted-foreground/50"
2993
+ ),
2994
+ "aria-hidden": "true"
2995
+ }
2996
+ ),
2997
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: online ? "font-medium text-status-online" : "text-muted-foreground", children: word })
2998
+ ]
3128
2999
  }
3129
3000
  );
3130
3001
  }
3131
- var HoverCard = HoverCardPrimitive__namespace.Root;
3132
- var HoverCardTrigger = HoverCardPrimitive__namespace.Trigger;
3133
- function HoverCardPortal({
3134
- container,
3135
- ...props
3002
+ var PACKAGE_BADGE_VARIANTS = [
3003
+ "default",
3004
+ "accent",
3005
+ "secondary",
3006
+ "destructive",
3007
+ "outline"
3008
+ ];
3009
+ function isPackageBadgeVariant(v) {
3010
+ return PACKAGE_BADGE_VARIANTS.some((known) => known === v);
3011
+ }
3012
+ function PackageStatusBadge({ variant, ...rest }) {
3013
+ return /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: isPackageBadgeVariant(variant) ? variant : "outline", ...rest });
3014
+ }
3015
+ var registry = {
3016
+ variants: {},
3017
+ fallback: "outline",
3018
+ Badge: PackageStatusBadge
3019
+ };
3020
+ function configureStatusRegistry(map, opts) {
3021
+ Object.assign(registry.variants, map);
3022
+ if (opts?.fallback) registry.fallback = opts.fallback;
3023
+ if (opts?.Badge) registry.Badge = opts.Badge;
3024
+ }
3025
+ function getStatusVariant(status) {
3026
+ return registry.variants[status] ?? registry.fallback;
3027
+ }
3028
+ function StatusPill({ status, label, variant, className, testId }) {
3029
+ const Badge2 = registry.Badge;
3030
+ return /* @__PURE__ */ jsxRuntime.jsx(Badge2, { variant: variant ?? getStatusVariant(status), className, "data-testid": testId, children: label ?? status });
3031
+ }
3032
+ var RAG_LABELS = { red: "At risk", amber: "Attention", green: "On track" };
3033
+ function configureRagLabels(labels) {
3034
+ RAG_LABELS = { ...RAG_LABELS, ...labels };
3035
+ }
3036
+ function RagDot({
3037
+ rag,
3038
+ withLabel,
3039
+ className
3136
3040
  }) {
3137
- const fallback = chunkHJDR5HEO_cjs.usePortalContainer();
3138
- return /* @__PURE__ */ jsxRuntime.jsx(HoverCardPrimitive__namespace.Portal, { container: container ?? fallback, ...props });
3041
+ const color = rag === "red" ? "bg-destructive" : rag === "amber" ? "bg-warning" : "bg-success";
3042
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: chunkS6A6FSG7_cjs.cn("inline-flex items-center gap-1.5", className), "data-testid": `rag-${rag}`, children: [
3043
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkS6A6FSG7_cjs.cn("size-2 rounded-full", color) }),
3044
+ withLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: RAG_LABELS[rag] })
3045
+ ] });
3139
3046
  }
3140
- var HoverCardContent = React__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(HoverCardPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
3141
- HoverCardPrimitive__namespace.Content,
3142
- {
3143
- ref,
3144
- align,
3145
- sideOffset,
3146
- collisionPadding: chunkHJDR5HEO_cjs.getCollisionPadding(),
3147
- className: chunkS6A6FSG7_cjs.cn(
3148
- "z-50 w-64 max-w-[calc(100vw-1rem)] rounded-md border bg-popover p-4 text-popover-foreground shadow-lg outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 origin-[--radix-hover-card-content-transform-origin]",
3149
- className
3150
- ),
3151
- ...props
3152
- }
3153
- ) }));
3154
- HoverCardContent.displayName = HoverCardPrimitive__namespace.Content.displayName;
3155
- var cardVariants = classVarianceAuthority.cva("min-w-0 rounded-lg bg-card text-card-foreground", {
3156
- variants: {
3157
- variant: {
3158
- flat: "",
3159
- outline: "border",
3160
- elevated: "border shadow-sm"
3161
- }
3162
- },
3163
- defaultVariants: {
3164
- variant: "flat"
3047
+
3048
+ // src/entities/colors.ts
3049
+ var OPACITY_LIGHT = 0.15;
3050
+ var OPACITY_MEDIUM = 1;
3051
+ var OPACITY_BORDER = 0.3;
3052
+ var PLACEHOLDER_COLOR = "#9ca3af";
3053
+ var NEUTRAL_GRAY2 = "#64748b";
3054
+ var BASE_COLORS2 = {
3055
+ "0": "#10b981",
3056
+ "1": "#3b82f6",
3057
+ "2": "#8b5cf6",
3058
+ "3": "#f43f5e",
3059
+ "4": "#f59e0b",
3060
+ "5": "#84cc16",
3061
+ "6": "#a855f7",
3062
+ "7": "#06b6d4",
3063
+ "8": "#f97316",
3064
+ "9": "#14b8a6",
3065
+ a: "#ef4444",
3066
+ b: "#6366f1",
3067
+ c: "#ec4899",
3068
+ d: "#22c55e",
3069
+ e: "#eab308",
3070
+ f: "#0ea5e9"
3071
+ };
3072
+ function hexToRgba(hex, opacity) {
3073
+ const r = parseInt(hex.slice(1, 3), 16);
3074
+ const g = parseInt(hex.slice(3, 5), 16);
3075
+ const b = parseInt(hex.slice(5, 7), 16);
3076
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`;
3077
+ }
3078
+ function getEntityColor2(entityId, variant = "medium") {
3079
+ const baseColor = BASE_COLORS2[entityId[4]] || BASE_COLORS2["0"];
3080
+ switch (variant) {
3081
+ case "light":
3082
+ return hexToRgba(baseColor, OPACITY_LIGHT);
3083
+ case "medium":
3084
+ return hexToRgba(baseColor, OPACITY_MEDIUM);
3085
+ case "text":
3086
+ return baseColor;
3165
3087
  }
3166
- });
3167
- var Card = React__namespace.forwardRef(
3168
- ({ className, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3169
- "div",
3088
+ }
3089
+ function getEntityColorStyles(entityId) {
3090
+ const baseColor = BASE_COLORS2[entityId[4]] || BASE_COLORS2["0"];
3091
+ return {
3092
+ backgroundColor: getEntityColor2(entityId, "light"),
3093
+ color: baseColor,
3094
+ borderColor: hexToRgba(baseColor, OPACITY_BORDER)
3095
+ };
3096
+ }
3097
+ var getWorkspaceColor = (workspaceId, useWorkspaceColors) => {
3098
+ const shouldUseWorkspaceColors = useWorkspaceColors !== void 0 ? useWorkspaceColors : true;
3099
+ if (!shouldUseWorkspaceColors) return "hsl(var(--primary))";
3100
+ const isValidId = workspaceId && workspaceId.startsWith("wrk-") && workspaceId.length >= 5;
3101
+ if (!isValidId) return "hsl(var(--primary))";
3102
+ return getEntityColor2(workspaceId, "medium");
3103
+ };
3104
+ var ShieldIcon = ({
3105
+ char,
3106
+ size = 24,
3107
+ className = "",
3108
+ workspaceColor,
3109
+ isSelected = false,
3110
+ ...props
3111
+ }) => {
3112
+ const fillColor = workspaceColor && workspaceColor !== "hsl(var(--primary))" ? workspaceColor : "transparent";
3113
+ const strokeColor = isSelected ? "white" : workspaceColor && workspaceColor !== "hsl(var(--primary))" ? workspaceColor : "currentColor";
3114
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3115
+ "svg",
3170
3116
  {
3171
- ref,
3172
- "data-slot": "card",
3173
- className: chunkS6A6FSG7_cjs.cn(cardVariants({ variant }), className),
3174
- ...props
3117
+ width: size,
3118
+ height: size,
3119
+ viewBox: "0 0 24 24",
3120
+ fill: fillColor,
3121
+ stroke: strokeColor,
3122
+ strokeWidth: "2",
3123
+ strokeLinecap: "round",
3124
+ strokeLinejoin: "round",
3125
+ className: `lucide lucide-square ${className}`,
3126
+ ...props,
3127
+ children: [
3128
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
3129
+ char && /* @__PURE__ */ jsxRuntime.jsx(
3130
+ "text",
3131
+ {
3132
+ x: "12",
3133
+ y: "12.5",
3134
+ textAnchor: "middle",
3135
+ fontSize: "9",
3136
+ fontFamily: "sans-serif",
3137
+ fontWeight: "300",
3138
+ dominantBaseline: "middle",
3139
+ stroke: workspaceColor ? "white" : "currentColor",
3140
+ strokeWidth: "0.8",
3141
+ children: char.toUpperCase()
3142
+ }
3143
+ )
3144
+ ]
3175
3145
  }
3176
- )
3177
- );
3178
- Card.displayName = "Card";
3179
- var CardHeader = React__namespace.forwardRef(
3180
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3181
- "div",
3182
- {
3183
- ref,
3184
- "data-slot": "card-header",
3185
- className: chunkS6A6FSG7_cjs.cn("flex flex-col space-y-1.5 p-6", className),
3186
- ...props
3187
- }
3188
- )
3189
- );
3190
- CardHeader.displayName = "CardHeader";
3191
- var CardTitle = React__namespace.forwardRef(
3192
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3193
- "div",
3194
- {
3195
- ref,
3196
- "data-slot": "card-title",
3197
- className: chunkS6A6FSG7_cjs.cn("font-semibold leading-none tracking-tight", className),
3198
- ...props
3199
- }
3200
- )
3201
- );
3202
- CardTitle.displayName = "CardTitle";
3203
- var CardDescription = React__namespace.forwardRef(
3204
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3205
- "div",
3206
- {
3207
- ref,
3208
- "data-slot": "card-description",
3209
- className: chunkS6A6FSG7_cjs.cn("text-sm text-muted-foreground", className),
3210
- ...props
3211
- }
3212
- )
3213
- );
3214
- CardDescription.displayName = "CardDescription";
3215
- var CardContent = React__namespace.forwardRef(
3216
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, "data-slot": "card-content", className: chunkS6A6FSG7_cjs.cn("p-6 pt-0", className), ...props })
3217
- );
3218
- CardContent.displayName = "CardContent";
3219
- var CardFooter = React__namespace.forwardRef(
3220
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3221
- "div",
3222
- {
3223
- ref,
3224
- "data-slot": "card-footer",
3225
- className: chunkS6A6FSG7_cjs.cn("flex items-center p-6 pt-0", className),
3226
- ...props
3146
+ );
3147
+ };
3148
+
3149
+ // src/entities/agent-avatar-colors.ts
3150
+ var BG_TO_COLOR = {
3151
+ "bg-emerald-700": "#047857",
3152
+ "bg-blue-700": "#1d4ed8",
3153
+ "bg-purple-700": "#7e22ce",
3154
+ "bg-amber-700": "#b45309",
3155
+ "bg-rose-700": "#be123c",
3156
+ "bg-red-700": "#b91c1c",
3157
+ "bg-indigo-700": "#4338ca",
3158
+ "bg-teal-700": "#0f766e",
3159
+ "bg-cyan-700": "#0e7490",
3160
+ "bg-sky-700": "#0369a1",
3161
+ "bg-lime-700": "#4d7c0f",
3162
+ "bg-orange-700": "#c2410c",
3163
+ "bg-pink-700": "#be185d",
3164
+ "bg-violet-700": "#6d28d9",
3165
+ "bg-fuchsia-700": "#a21caf",
3166
+ "bg-yellow-700": "#a16207"
3167
+ };
3168
+ function agentAvatarColors(bgColorClass) {
3169
+ const color = BG_TO_COLOR[bgColorClass] || "#047857";
3170
+ return { borderColor: color, color };
3171
+ }
3172
+
3173
+ // src/entities/media-type.ts
3174
+ function getDottedExtension(fileName) {
3175
+ if (!fileName) return "";
3176
+ return fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
3177
+ }
3178
+ var DOWNLOAD_ONLY_EXTENSIONS = /* @__PURE__ */ new Set([
3179
+ ".zip",
3180
+ ".rar",
3181
+ ".7z",
3182
+ ".tar",
3183
+ ".gz",
3184
+ ".exe",
3185
+ ".bin",
3186
+ ".dmg",
3187
+ ".iso",
3188
+ ".apk",
3189
+ ".msi",
3190
+ ".dll",
3191
+ ".so",
3192
+ ".psd",
3193
+ ".ai",
3194
+ ".sketch"
3195
+ ]);
3196
+ var IMAGE_EXTENSIONS3 = /* @__PURE__ */ new Set([
3197
+ ".jpg",
3198
+ ".jpeg",
3199
+ ".png",
3200
+ ".gif",
3201
+ ".bmp",
3202
+ ".tiff",
3203
+ ".tif",
3204
+ ".webp"
3205
+ ]);
3206
+ var VIDEO_EXTENSIONS3 = /* @__PURE__ */ new Set([".mp4", ".mpeg", ".mpg", ".webm", ".mov", ".avi", ".mkv"]);
3207
+ var AUDIO_EXTENSIONS3 = /* @__PURE__ */ new Set([".mp3", ".wav", ".m4a", ".aac", ".ogg", ".flac"]);
3208
+ function isImageFile(fileName) {
3209
+ return IMAGE_EXTENSIONS3.has(getDottedExtension(fileName));
3210
+ }
3211
+ function isVideoFile(fileName) {
3212
+ return VIDEO_EXTENSIONS3.has(getDottedExtension(fileName));
3213
+ }
3214
+ function isAudioFile(fileName) {
3215
+ return AUDIO_EXTENSIONS3.has(getDottedExtension(fileName));
3216
+ }
3217
+ function isMediaFile(fileName) {
3218
+ return isImageFile(fileName) || isVideoFile(fileName) || isAudioFile(fileName);
3219
+ }
3220
+ function usesOriginalBytesForViewer(fileName) {
3221
+ return isMediaFile(fileName);
3222
+ }
3223
+ function isDownloadOnlyFile(fileName) {
3224
+ return DOWNLOAD_ONLY_EXTENSIONS.has(getDottedExtension(fileName));
3225
+ }
3226
+
3227
+ // src/entities/file-type.ts
3228
+ var EXT_LABELS = {
3229
+ pdf: "PDF",
3230
+ // Word / docs
3231
+ doc: "Word",
3232
+ docx: "Word",
3233
+ rtf: "Word",
3234
+ odt: "Word",
3235
+ // Spreadsheets
3236
+ xls: "Excel",
3237
+ xlsx: "Excel",
3238
+ ods: "Excel",
3239
+ csv: "CSV",
3240
+ tsv: "CSV",
3241
+ // Slides
3242
+ ppt: "PowerPoint",
3243
+ pptx: "PowerPoint",
3244
+ odp: "PowerPoint",
3245
+ // Plain text / markup
3246
+ txt: "Text",
3247
+ log: "Text",
3248
+ md: "Markdown",
3249
+ markdown: "Markdown",
3250
+ html: "HTML",
3251
+ htm: "HTML",
3252
+ xml: "XML",
3253
+ json: "JSON",
3254
+ yaml: "YAML",
3255
+ yml: "YAML",
3256
+ // Email
3257
+ eml: "Email",
3258
+ msg: "Email",
3259
+ mbox: "Email",
3260
+ pst: "Outlook",
3261
+ ost: "Outlook",
3262
+ // Images
3263
+ jpg: "Image",
3264
+ jpeg: "Image",
3265
+ png: "Image",
3266
+ gif: "Image",
3267
+ bmp: "Image",
3268
+ tif: "Image",
3269
+ tiff: "Image",
3270
+ webp: "Image",
3271
+ svg: "Image",
3272
+ heic: "Image",
3273
+ heif: "Image",
3274
+ // Audio
3275
+ mp3: "Audio",
3276
+ wav: "Audio",
3277
+ m4a: "Audio",
3278
+ aac: "Audio",
3279
+ ogg: "Audio",
3280
+ flac: "Audio",
3281
+ opus: "Audio",
3282
+ // Video
3283
+ mp4: "Video",
3284
+ webm: "Video",
3285
+ mov: "Video",
3286
+ avi: "Video",
3287
+ mkv: "Video",
3288
+ // Archives
3289
+ zip: "Archive",
3290
+ tar: "Archive",
3291
+ gz: "Archive",
3292
+ rar: "Archive",
3293
+ "7z": "Archive"
3294
+ };
3295
+ var MIME_SUBTYPE_LABELS = {
3296
+ // PDF
3297
+ pdf: "PDF",
3298
+ "x-pdf": "PDF",
3299
+ // Word
3300
+ msword: "Word",
3301
+ "vnd.openxmlformats-officedocument.wordprocessingml.document": "Word",
3302
+ "vnd.oasis.opendocument.text": "Word",
3303
+ rtf: "Word",
3304
+ // Excel
3305
+ "vnd.ms-excel": "Excel",
3306
+ "vnd.openxmlformats-officedocument.spreadsheetml.sheet": "Excel",
3307
+ "vnd.oasis.opendocument.spreadsheet": "Excel",
3308
+ csv: "CSV",
3309
+ "tab-separated-values": "CSV",
3310
+ // PowerPoint
3311
+ "vnd.ms-powerpoint": "PowerPoint",
3312
+ "vnd.openxmlformats-officedocument.presentationml.presentation": "PowerPoint",
3313
+ "vnd.oasis.opendocument.presentation": "PowerPoint",
3314
+ // Plain text / markup
3315
+ plain: "Text",
3316
+ html: "HTML",
3317
+ xml: "XML",
3318
+ json: "JSON",
3319
+ markdown: "Markdown",
3320
+ "x-markdown": "Markdown",
3321
+ yaml: "YAML",
3322
+ "x-yaml": "YAML",
3323
+ // Email
3324
+ rfc822: "Email",
3325
+ "vnd.ms-outlook": "Email",
3326
+ // Archives
3327
+ zip: "Archive",
3328
+ "x-zip-compressed": "Archive",
3329
+ "x-tar": "Archive",
3330
+ gzip: "Archive",
3331
+ "x-7z-compressed": "Archive",
3332
+ "x-rar-compressed": "Archive"
3333
+ };
3334
+ var MIME_TYPE_LABELS = {
3335
+ image: "Image",
3336
+ audio: "Audio",
3337
+ video: "Video",
3338
+ text: "Text"
3339
+ };
3340
+ function lookupExt(ext) {
3341
+ return EXT_LABELS[ext.toLowerCase().replace(/^\./, "")];
3342
+ }
3343
+ function lookupMime(mime) {
3344
+ const base = mime.toLowerCase().split(";")[0].trim();
3345
+ const slash = base.indexOf("/");
3346
+ if (slash <= 0) return void 0;
3347
+ const top = base.slice(0, slash);
3348
+ const sub = base.slice(slash + 1);
3349
+ return MIME_SUBTYPE_LABELS[sub] ?? MIME_TYPE_LABELS[top];
3350
+ }
3351
+ function extFromFileName(fileName) {
3352
+ if (!fileName) return void 0;
3353
+ const dot = fileName.lastIndexOf(".");
3354
+ if (dot <= 0 || dot === fileName.length - 1) return void 0;
3355
+ return fileName.slice(dot + 1);
3356
+ }
3357
+ function friendlyFileType(fileType, fileName) {
3358
+ if (fileType) {
3359
+ const trimmed = fileType.trim();
3360
+ if (trimmed.includes("/")) {
3361
+ const fromMime = lookupMime(trimmed);
3362
+ if (fromMime) return fromMime;
3363
+ } else {
3364
+ const fromExt = lookupExt(trimmed);
3365
+ if (fromExt) return fromExt;
3227
3366
  }
3228
- )
3229
- );
3230
- CardFooter.displayName = "CardFooter";
3231
- var Label2 = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3232
- "label",
3233
- {
3234
- ref,
3235
- className: `text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 ${className || ""}`,
3236
- ...props
3237
3367
  }
3238
- ));
3239
- Label2.displayName = "Label";
3240
- var Separator2 = React__namespace.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3241
- SeparatorPrimitive__namespace.Root,
3368
+ const fnExt = extFromFileName(fileName);
3369
+ if (fnExt) {
3370
+ const fromExt = lookupExt(fnExt);
3371
+ if (fromExt) return fromExt;
3372
+ }
3373
+ return "Other";
3374
+ }
3375
+ var Select = SelectPrimitive__namespace.Root;
3376
+ var SelectGroup = SelectPrimitive__namespace.Group;
3377
+ var SelectValue = SelectPrimitive__namespace.Value;
3378
+ function SelectPortal({
3379
+ container,
3380
+ ...props
3381
+ }) {
3382
+ const fallback = chunkHJDR5HEO_cjs.usePortalContainer();
3383
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { container: container ?? fallback, ...props });
3384
+ }
3385
+ var SelectTrigger = React__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
3386
+ SelectPrimitive__namespace.Trigger,
3242
3387
  {
3243
3388
  ref,
3244
- decorative,
3245
- orientation,
3246
3389
  className: chunkS6A6FSG7_cjs.cn(
3247
- "shrink-0 bg-border",
3248
- orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
3390
+ "flex h-9 pointer-coarse:min-h-11 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground/60 focus:outline-none focus-visible:border-ring/50 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
3249
3391
  className
3250
3392
  ),
3251
- ...props
3393
+ ...props,
3394
+ children: [
3395
+ children,
3396
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 opacity-50" }) })
3397
+ ]
3252
3398
  }
3253
3399
  ));
3254
- Separator2.displayName = SeparatorPrimitive__namespace.Root.displayName;
3255
- var Collapsible = CollapsiblePrimitive__namespace.Root;
3256
- var CollapsibleTrigger2 = CollapsiblePrimitive__namespace.CollapsibleTrigger;
3257
- var CollapsibleContent2 = CollapsiblePrimitive__namespace.CollapsibleContent;
3258
- var Progress = React__namespace.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3259
- ProgressPrimitive__namespace.Root,
3400
+ SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
3401
+ var SelectScrollUpButton = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3402
+ SelectPrimitive__namespace.ScrollUpButton,
3260
3403
  {
3261
3404
  ref,
3262
- className: chunkS6A6FSG7_cjs.cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20", className),
3405
+ className: chunkS6A6FSG7_cjs.cn("flex cursor-default items-center justify-center py-1", className),
3263
3406
  ...props,
3264
- children: /* @__PURE__ */ jsxRuntime.jsx(
3265
- ProgressPrimitive__namespace.Indicator,
3266
- {
3267
- className: "h-full w-full flex-1 bg-primary transition-all",
3268
- style: { transform: `translateX(-${100 - (value || 0)}%)` }
3269
- }
3270
- )
3407
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { className: "h-4 w-4" })
3271
3408
  }
3272
3409
  ));
3273
- Progress.displayName = ProgressPrimitive__namespace.Root.displayName;
3274
- var RadioGroup = React__namespace.forwardRef(({ className, ...props }, ref) => {
3275
- return /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Root, { className: chunkS6A6FSG7_cjs.cn("grid gap-2", className), ...props, ref });
3276
- });
3277
- RadioGroup.displayName = RadioGroupPrimitive__namespace.Root.displayName;
3278
- var RadioGroupItem = React__namespace.forwardRef(({ className, ...props }, ref) => {
3279
- return /* @__PURE__ */ jsxRuntime.jsx(
3280
- RadioGroupPrimitive__namespace.Item,
3281
- {
3282
- ref,
3283
- className: chunkS6A6FSG7_cjs.cn(
3284
- "relative aspect-square h-4 w-4 rounded-full border border-primary text-primary after:absolute after:left-1/2 after:top-1/2 after:hidden after:size-11 after:-translate-x-1/2 after:-translate-y-1/2 after:content-[''] pointer-coarse:after:block focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
3285
- className
3286
- ),
3287
- ...props,
3288
- children: /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Circle, { className: "h-2.5 w-2.5 fill-current text-current" }) })
3289
- }
3290
- );
3291
- });
3292
- RadioGroupItem.displayName = RadioGroupPrimitive__namespace.Item.displayName;
3293
- var Switch = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3294
- SwitchPrimitives__namespace.Root,
3410
+ SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
3411
+ var SelectScrollDownButton = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3412
+ SelectPrimitive__namespace.ScrollDownButton,
3295
3413
  {
3296
- className: chunkS6A6FSG7_cjs.cn(
3297
- "peer relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-muted-foreground/45 after:absolute after:left-1/2 after:top-1/2 after:hidden after:size-11 after:-translate-x-1/2 after:-translate-y-1/2 after:content-[''] pointer-coarse:after:block",
3298
- className
3299
- ),
3300
- ...props,
3301
3414
  ref,
3302
- children: /* @__PURE__ */ jsxRuntime.jsx(
3303
- SwitchPrimitives__namespace.Thumb,
3304
- {
3305
- className: chunkS6A6FSG7_cjs.cn(
3306
- "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"
3307
- )
3308
- }
3309
- )
3415
+ className: chunkS6A6FSG7_cjs.cn("flex cursor-default items-center justify-center py-1", className),
3416
+ ...props,
3417
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4" })
3310
3418
  }
3311
3419
  ));
3312
- Switch.displayName = SwitchPrimitives__namespace.Root.displayName;
3313
- var Tabs = TabsPrimitive__namespace.Root;
3314
- var TabsList = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3315
- TabsPrimitive__namespace.List,
3420
+ SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
3421
+ var SelectContent = React__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(SelectPortal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
3422
+ SelectPrimitive__namespace.Content,
3316
3423
  {
3317
3424
  ref,
3318
3425
  className: chunkS6A6FSG7_cjs.cn(
3319
- "inline-flex h-9 pointer-coarse:h-auto items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
3426
+ "relative z-50 max-h-[min(24rem,var(--radix-select-content-available-height))] min-w-[8rem] max-w-[calc(100vw-1rem)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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",
3427
+ 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",
3320
3428
  className
3321
3429
  ),
3322
- ...props
3430
+ position,
3431
+ collisionPadding: chunkHJDR5HEO_cjs.getCollisionPadding(),
3432
+ ...props,
3433
+ children: [
3434
+ /* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
3435
+ /* @__PURE__ */ jsxRuntime.jsx(
3436
+ SelectPrimitive__namespace.Viewport,
3437
+ {
3438
+ className: chunkS6A6FSG7_cjs.cn(
3439
+ "p-1",
3440
+ position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
3441
+ ),
3442
+ children
3443
+ }
3444
+ ),
3445
+ /* @__PURE__ */ jsxRuntime.jsx(SelectScrollDownButton, {})
3446
+ ]
3323
3447
  }
3324
- ));
3325
- TabsList.displayName = TabsPrimitive__namespace.List.displayName;
3326
- var TabsTrigger = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3327
- TabsPrimitive__namespace.Trigger,
3328
- {
3329
- ref,
3330
- className: chunkS6A6FSG7_cjs.cn(
3331
- "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm pointer-coarse:min-h-11 font-medium ring-offset-background transition-all 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",
3332
- className
3333
- ),
3448
+ ) }));
3449
+ SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
3450
+ var SelectLabel = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3451
+ SelectPrimitive__namespace.Label,
3452
+ {
3453
+ ref,
3454
+ className: chunkS6A6FSG7_cjs.cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className),
3334
3455
  ...props
3335
3456
  }
3336
3457
  ));
3337
- TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
3338
- var TabsContent = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3339
- TabsPrimitive__namespace.Content,
3458
+ SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
3459
+ var SelectItem = React__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
3460
+ SelectPrimitive__namespace.Item,
3340
3461
  {
3341
3462
  ref,
3342
3463
  className: chunkS6A6FSG7_cjs.cn(
3343
- "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
3464
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 pointer-coarse:min-h-11 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
3344
3465
  className
3345
3466
  ),
3346
- ...props
3467
+ ...props,
3468
+ children: [
3469
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) }) }),
3470
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemText, { children })
3471
+ ]
3347
3472
  }
3348
3473
  ));
3349
- TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
3350
- var Table = React__namespace.forwardRef(
3351
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx("table", { ref, className: chunkS6A6FSG7_cjs.cn("w-full caption-bottom text-sm", className), ...props }) })
3352
- );
3353
- Table.displayName = "Table";
3354
- var TableHeader = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: chunkS6A6FSG7_cjs.cn("[&_tr]:border-b", className), ...props }));
3355
- TableHeader.displayName = "TableHeader";
3356
- var TableBody = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("tbody", { ref, className: chunkS6A6FSG7_cjs.cn("[&_tr:last-child]:border-0", className), ...props }));
3357
- TableBody.displayName = "TableBody";
3358
- var TableFooter = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3359
- "tfoot",
3474
+ SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
3475
+ var SelectSeparator = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3476
+ SelectPrimitive__namespace.Separator,
3360
3477
  {
3361
3478
  ref,
3362
- className: chunkS6A6FSG7_cjs.cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
3479
+ className: chunkS6A6FSG7_cjs.cn("-mx-1 my-1 h-px bg-muted", className),
3363
3480
  ...props
3364
3481
  }
3365
3482
  ));
3366
- TableFooter.displayName = "TableFooter";
3367
- var TableRow = React__namespace.forwardRef(
3368
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3369
- "tr",
3370
- {
3371
- ref,
3372
- className: chunkS6A6FSG7_cjs.cn(
3373
- "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
3374
- className
3375
- ),
3376
- ...props
3377
- }
3378
- )
3379
- );
3380
- TableRow.displayName = "TableRow";
3381
- var TableHead = React__namespace.forwardRef(
3382
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3383
- "th",
3384
- {
3385
- ref,
3386
- className: chunkS6A6FSG7_cjs.cn(
3387
- "h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
3388
- className
3389
- ),
3390
- ...props
3391
- }
3392
- )
3393
- );
3394
- TableHead.displayName = "TableHead";
3395
- var TableCell = React__namespace.forwardRef(
3396
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3397
- "td",
3398
- {
3399
- ref,
3400
- className: chunkS6A6FSG7_cjs.cn(
3401
- "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
3402
- className
3403
- ),
3404
- ...props
3405
- }
3406
- )
3407
- );
3408
- TableCell.displayName = "TableCell";
3409
- var TableCaption = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("caption", { ref, className: chunkS6A6FSG7_cjs.cn("mt-4 text-sm text-muted-foreground", className), ...props }));
3410
- TableCaption.displayName = "TableCaption";
3411
- var Slider = React__namespace.forwardRef(
3412
- ({ className, rangeClassName, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
3413
- SliderPrimitive__namespace.Root,
3414
- {
3415
- ref,
3416
- className: chunkS6A6FSG7_cjs.cn("relative flex w-full touch-none select-none items-center", className),
3417
- ...props,
3418
- children: [
3419
- /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Track, { className: "relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20", children: /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Range, { className: chunkS6A6FSG7_cjs.cn("absolute h-full bg-primary", rangeClassName) }) }),
3420
- /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Thumb, { className: "block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" })
3421
- ]
3422
- }
3423
- )
3424
- );
3425
- Slider.displayName = SliderPrimitive__namespace.Root.displayName;
3426
- var toggleVariants = classVarianceAuthority.cva(
3427
- "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
3428
- {
3429
- variants: {
3430
- variant: {
3431
- default: "bg-transparent",
3432
- outline: "border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground"
3433
- },
3434
- size: {
3435
- default: "h-9 px-2 min-w-9 pointer-coarse:h-11 pointer-coarse:min-w-11",
3436
- sm: "h-8 px-1.5 min-w-8 pointer-coarse:h-11 pointer-coarse:min-w-11",
3437
- lg: "h-10 px-2.5 min-w-10 pointer-coarse:h-11 pointer-coarse:min-w-11"
3483
+ SelectSeparator.displayName = SelectPrimitive__namespace.Separator.displayName;
3484
+ var COLORS = {
3485
+ text: "text-secondary",
3486
+ bg: "bg-secondary"
3487
+ };
3488
+ function isItemShared(item) {
3489
+ return item.shared === true || item.is_shared === true;
3490
+ }
3491
+ function VisibilityToggle({
3492
+ items,
3493
+ presentation = "toggle",
3494
+ onToggle,
3495
+ disabled = false,
3496
+ disabledTooltip,
3497
+ disablePrivate = false,
3498
+ showLabel = true,
3499
+ showTooltip = true,
3500
+ tooltipActive,
3501
+ tooltipInactive,
3502
+ tooltipMixed,
3503
+ label = "Visibility",
3504
+ workspaceLabel = getEntityLabel("WORKSPACE"),
3505
+ "data-testid": dataTestId
3506
+ }) {
3507
+ const itemsArray = React.useMemo(() => Array.isArray(items) ? items : [items], [items]);
3508
+ const { isAllShared, isMixed } = React.useMemo(() => {
3509
+ if (itemsArray.length === 0) return { isAllShared: false, isMixed: false };
3510
+ const sharedCount = itemsArray.filter(isItemShared).length;
3511
+ return {
3512
+ isAllShared: sharedCount === itemsArray.length,
3513
+ isMixed: sharedCount > 0 && sharedCount < itemsArray.length
3514
+ };
3515
+ }, [itemsArray]);
3516
+ const isSingle = itemsArray.length === 1;
3517
+ const defaultTooltipActive = `Hide${isSingle ? "" : " all"} from ${workspaceLabel} members`;
3518
+ const defaultTooltipInactive = `Make${isSingle ? "" : " all"} visible to ${workspaceLabel} members`;
3519
+ const defaultTooltipMixed = `Make all visible to ${workspaceLabel} members (some already shared)`;
3520
+ const handleToggle = () => {
3521
+ const shouldShare = !isAllShared;
3522
+ if (disablePrivate && !shouldShare) return;
3523
+ onToggle(shouldShare);
3524
+ };
3525
+ if (presentation === "select")
3526
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3527
+ Select,
3528
+ {
3529
+ value: isMixed ? "mixed" : isAllShared ? "workspace" : "me",
3530
+ onValueChange: (value) => onToggle(value === "workspace"),
3531
+ disabled: disabled || !itemsArray.length,
3532
+ children: [
3533
+ /* @__PURE__ */ jsxRuntime.jsxs(
3534
+ SelectTrigger,
3535
+ {
3536
+ "aria-label": label,
3537
+ "data-testid": dataTestId,
3538
+ className: "h-7 w-auto gap-1 border-0 bg-transparent px-1 text-xs font-normal text-muted-foreground shadow-none hover:bg-muted pointer-coarse:h-11",
3539
+ children: [
3540
+ showLabel && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
3541
+ label,
3542
+ ":"
3543
+ ] }),
3544
+ /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {})
3545
+ ]
3546
+ }
3547
+ ),
3548
+ /* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { children: [
3549
+ /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "me", disabled: disablePrivate, children: "Me" }),
3550
+ /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "workspace", children: "Workspace" }),
3551
+ isMixed && /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "mixed", disabled: true, children: "Mixed" })
3552
+ ] })
3553
+ ]
3438
3554
  }
3439
- },
3440
- defaultVariants: {
3441
- variant: "default",
3442
- size: "default"
3555
+ );
3556
+ return /* @__PURE__ */ jsxRuntime.jsx(
3557
+ IconToggle,
3558
+ {
3559
+ icon: lucideReact.Share2,
3560
+ isActive: isAllShared,
3561
+ onToggle: handleToggle,
3562
+ colors: COLORS,
3563
+ inactiveColors: { text: "text-primary", bg: "bg-primary/10" },
3564
+ disabled: disabled || itemsArray.length === 0,
3565
+ disabledTooltip,
3566
+ showLabel,
3567
+ showTooltip,
3568
+ label,
3569
+ isMixed,
3570
+ tooltipActive: tooltipActive || defaultTooltipActive,
3571
+ tooltipInactive: tooltipInactive || defaultTooltipInactive,
3572
+ tooltipMixed: tooltipMixed || defaultTooltipMixed,
3573
+ "data-testid": dataTestId
3443
3574
  }
3444
- }
3445
- );
3446
- var Toggle = React__namespace.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3447
- TogglePrimitive__namespace.Root,
3448
- {
3449
- ref,
3450
- className: chunkS6A6FSG7_cjs.cn(toggleVariants({ variant, size, className })),
3451
- ...props
3452
- }
3453
- ));
3454
- Toggle.displayName = TogglePrimitive__namespace.Root.displayName;
3455
- var ToggleGroupContext = React__namespace.createContext({
3456
- size: "default",
3457
- variant: "default"
3458
- });
3459
- var ToggleGroup = React__namespace.forwardRef(({ className, variant, size, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3460
- ToggleGroupPrimitive__namespace.Root,
3461
- {
3462
- ref,
3463
- className: chunkS6A6FSG7_cjs.cn("flex items-center justify-center gap-1", className),
3464
- ...props,
3465
- children: /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupContext.Provider, { value: { variant, size }, children })
3466
- }
3467
- ));
3468
- ToggleGroup.displayName = ToggleGroupPrimitive__namespace.Root.displayName;
3469
- var ToggleGroupItem = React__namespace.forwardRef(({ className, children, variant, size, ...props }, ref) => {
3470
- const context = React__namespace.useContext(ToggleGroupContext);
3575
+ );
3576
+ }
3577
+ var COLORS2 = {
3578
+ text: "text-green-text",
3579
+ bg: "bg-green-text"
3580
+ };
3581
+ function VerifiedToggle({
3582
+ verified,
3583
+ onToggle,
3584
+ disabled = false,
3585
+ showLabel = true,
3586
+ showTooltip = true,
3587
+ tooltipActive,
3588
+ tooltipInactive,
3589
+ "data-testid": dataTestId
3590
+ }) {
3471
3591
  return /* @__PURE__ */ jsxRuntime.jsx(
3472
- ToggleGroupPrimitive__namespace.Item,
3592
+ IconToggle,
3473
3593
  {
3474
- ref,
3475
- className: chunkS6A6FSG7_cjs.cn(
3476
- toggleVariants({
3477
- variant: context.variant || variant,
3478
- size: context.size || size
3479
- }),
3480
- className
3481
- ),
3482
- ...props,
3483
- children
3594
+ icon: lucideReact.CheckCircle2,
3595
+ isActive: verified,
3596
+ onToggle,
3597
+ colors: COLORS2,
3598
+ disabled,
3599
+ showLabel,
3600
+ label: "Verified",
3601
+ showTooltip,
3602
+ tooltipActive: tooltipActive || "Verified by a human \u2014 click to unverify",
3603
+ tooltipInactive: tooltipInactive || "Not verified \u2014 click to verify",
3604
+ "data-testid": dataTestId
3484
3605
  }
3485
3606
  );
3486
- });
3487
- ToggleGroupItem.displayName = ToggleGroupPrimitive__namespace.Item.displayName;
3488
- var Popover = PopoverPrimitive__namespace.Root;
3489
- var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
3490
- var PopoverAnchor = PopoverPrimitive__namespace.Anchor;
3491
- function PopoverPortal({
3492
- container,
3493
- ...props
3494
- }) {
3495
- const fallback = chunkHJDR5HEO_cjs.usePortalContainer();
3496
- return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { container: container ?? fallback, ...props });
3497
- }
3498
- var PopoverContent = React__namespace.forwardRef(({ className, align = "center", sideOffset = 4, container, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPortal, { container: container ?? void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
3499
- PopoverPrimitive__namespace.Content,
3500
- {
3501
- ref,
3502
- align,
3503
- sideOffset,
3504
- collisionPadding: chunkHJDR5HEO_cjs.getCollisionPadding(),
3505
- className: chunkS6A6FSG7_cjs.cn(
3506
- "z-50 w-72 max-w-[calc(100vw-1rem)] max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-lg outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 origin-[--radix-popover-content-transform-origin]",
3507
- className
3508
- ),
3509
- ...props
3510
- }
3511
- ) }));
3512
- PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
3513
- var PopoverClose = PopoverPrimitive__namespace.Close;
3514
- var FINE_OPEN_DELAY = 350;
3515
- var FINE_CLOSE_DELAY = 180;
3516
- var silentFocusMarks = /* @__PURE__ */ new WeakSet();
3517
- function returnFocusToMark(mark) {
3518
- silentFocusMarks.add(mark);
3519
- mark.focus({ preventScroll: true });
3520
- silentFocusMarks.delete(mark);
3521
3607
  }
3522
- function isFocusVisible(el) {
3608
+
3609
+ // src/lib/format-friendly-date.ts
3610
+ function formatFriendlyDate(dateString, includeTime = true) {
3611
+ if (!dateString) return "";
3523
3612
  try {
3524
- return el.matches(":focus-visible");
3613
+ if (dateString.includes("Today") || dateString.includes("Yesterday") || /\w+ \d+, \d+:\d+:\d+/.test(dateString)) {
3614
+ return dateString;
3615
+ }
3616
+ if (/^\d{1,2}:\d{2}(:\d{2})?$/.test(dateString)) {
3617
+ return dateString;
3618
+ }
3619
+ const date = new Date(dateString);
3620
+ if (isNaN(date.getTime())) return dateString;
3621
+ const timeOptions = { hour: "2-digit", minute: "2-digit" };
3622
+ const timeString = date.toLocaleTimeString([], timeOptions);
3623
+ const now = /* @__PURE__ */ new Date();
3624
+ const today = now.toDateString();
3625
+ const yesterday = new Date(now);
3626
+ yesterday.setDate(yesterday.getDate() - 1);
3627
+ if (date.toDateString() === today) {
3628
+ return includeTime ? `Today, ${timeString}` : "today";
3629
+ } else if (date.toDateString() === yesterday.toDateString()) {
3630
+ return includeTime ? `Yesterday, ${timeString}` : "yesterday";
3631
+ } else {
3632
+ const dateOptions = {
3633
+ month: "short",
3634
+ day: "numeric"
3635
+ };
3636
+ if (date.getFullYear() !== now.getFullYear()) {
3637
+ dateOptions.year = "numeric";
3638
+ }
3639
+ const formattedDate = date.toLocaleDateString([], dateOptions);
3640
+ return includeTime ? `${formattedDate}, ${timeString}` : formattedDate;
3641
+ }
3525
3642
  } catch {
3526
- return true;
3643
+ return dateString;
3527
3644
  }
3528
3645
  }
3529
- function isCoarse(pointerType) {
3530
- if (pointerType === "touch" || pointerType === "pen") return true;
3531
- if (pointerType === "mouse") return false;
3532
- return typeof window !== "undefined" && !!window.matchMedia?.("(pointer: coarse)").matches;
3646
+
3647
+ // src/lib/markdown-to-text.ts
3648
+ function markdownToPlainText(input) {
3649
+ if (!input) return "";
3650
+ return input.replace(/```[^\n]*\n?/g, "").replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/^[ \t]*#{1,6}[ \t]+/gm, "").replace(/^[ \t]*>[ \t]?/gm, "").replace(/^[ \t]*([-*+]|\d+[.)])[ \t]+/gm, "").replace(/(\*\*|__)(.*?)\1/g, "$2").replace(/(\*|_)(.*?)\1/g, "$2").replace(/`([^`]*)`/g, "$1").replace(/\s+/g, " ").trim();
3533
3651
  }
3534
- function MarkMenu({
3535
- as = "span",
3536
- href,
3537
- items,
3538
- preview,
3539
- menuLabel,
3540
- shouldClickRunPrimary = true,
3541
- openDelay = FINE_OPEN_DELAY,
3542
- closeDelay = FINE_CLOSE_DELAY,
3543
- testId,
3544
- menuTestId,
3545
- triggerRef: externalRef,
3546
- className,
3547
- children,
3548
- onPointerDown,
3549
- onPointerEnter,
3550
- onPointerMove,
3551
- onPointerLeave,
3552
- onFocus,
3553
- onBlur,
3554
- onKeyDown,
3555
- ...rest
3556
- }) {
3557
- const [open, setOpen] = React.useState(false);
3558
- const [side, setSide] = React.useState("bottom");
3559
- const menuId = React.useId();
3560
- const triggerRef = React.useRef(null);
3561
- const contentRef = React.useRef(null);
3562
- const timer = React.useRef(null);
3563
- const mode = React.useRef("hover");
3564
- const lastPointer = React.useRef("mouse");
3565
- const focusFirstOnOpen = React.useRef(false);
3566
- const hoverArmed = React.useRef(false);
3567
- const isEmpty = items.length === 0 && !preview;
3568
- const ordered = [...items].sort((a, b) => Number(!!b.primary) - Number(!!a.primary));
3569
- const primary = ordered[0];
3570
- const clearTimer = () => {
3571
- if (timer.current) clearTimeout(timer.current);
3572
- timer.current = null;
3573
- };
3574
- React.useEffect(() => clearTimer, []);
3575
- React.useEffect(() => {
3576
- if (!open) return;
3577
- const onDocumentPointerDown = (e) => {
3578
- const target = e.target;
3579
- if (triggerRef.current?.contains(target) || contentRef.current?.contains(target)) return;
3580
- if (timer.current) clearTimeout(timer.current);
3581
- setOpen(false);
3582
- };
3583
- document.addEventListener("pointerdown", onDocumentPointerDown, true);
3584
- return () => document.removeEventListener("pointerdown", onDocumentPointerDown, true);
3585
- }, [open]);
3586
- const rows = () => Array.from(contentRef.current?.querySelectorAll('[role="menuitem"]') ?? []);
3587
- const firstItem = () => rows()[0];
3588
- const openWith = (next, focusFirst = false) => {
3589
- clearTimer();
3590
- mode.current = next;
3591
- focusFirstOnOpen.current = focusFirst;
3592
- setSide(next === "press" && isCoarse(lastPointer.current) ? "top" : "bottom");
3593
- setOpen(true);
3594
- if (focusFirst) {
3595
- requestAnimationFrame(() => firstItem()?.focus());
3596
- }
3597
- };
3598
- const close = (returnFocus = false) => {
3599
- clearTimer();
3600
- setOpen(false);
3601
- if (returnFocus && triggerRef.current) returnFocusToMark(triggerRef.current);
3602
- };
3603
- const schedule = (action, delay) => {
3604
- clearTimer();
3605
- timer.current = setTimeout(action, delay);
3606
- };
3607
- const handlePointerDown = (e) => {
3608
- lastPointer.current = e.pointerType;
3609
- onPointerDown?.(e);
3610
- };
3611
- const handlePointerEnter = (e) => {
3612
- onPointerEnter?.(e);
3613
- if (isCoarse(e.pointerType) || isEmpty) return;
3614
- lastPointer.current = e.pointerType;
3615
- hoverArmed.current = true;
3616
- };
3617
- const handlePointerMove = (e) => {
3618
- onPointerMove?.(e);
3619
- if (!hoverArmed.current) return;
3620
- hoverArmed.current = false;
3621
- if (isCoarse(e.pointerType)) return;
3622
- schedule(() => openWith("hover"), openDelay);
3623
- };
3624
- const handlePointerLeave = (e) => {
3625
- onPointerLeave?.(e);
3626
- hoverArmed.current = false;
3627
- if (isCoarse(e.pointerType)) return;
3628
- if (!open) return clearTimer();
3629
- if (mode.current === "hover") schedule(() => close(), closeDelay);
3630
- };
3631
- const handleFocus = (e) => {
3632
- onFocus?.(e);
3633
- if (isEmpty || silentFocusMarks.has(e.currentTarget)) return;
3634
- if (isFocusVisible(e.currentTarget)) schedule(() => openWith("focus"), openDelay);
3635
- };
3636
- const handleBlur = (e) => {
3637
- onBlur?.(e);
3638
- const next = e.relatedTarget;
3639
- if (next && contentRef.current?.contains(next)) return;
3640
- if (mode.current === "focus" || mode.current === "key") schedule(() => close(), closeDelay);
3641
- else clearTimer();
3642
- };
3643
- const handleKeyDown = (e) => {
3644
- onKeyDown?.(e);
3645
- lastPointer.current = "keyboard";
3646
- if (e.defaultPrevented || isEmpty) return;
3647
- if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
3648
- e.preventDefault();
3649
- openWith("key", true);
3650
- } else if (e.key === "Escape" && open) {
3651
- e.preventDefault();
3652
- e.stopPropagation();
3653
- close(true);
3654
- }
3655
- };
3656
- const handleClick = (e) => {
3657
- if (isEmpty) return;
3658
- if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
3659
- if (e.detail === 0 && lastPointer.current === "keyboard") {
3660
- e.preventDefault();
3661
- return;
3662
- }
3663
- if (isCoarse(lastPointer.current)) {
3664
- e.preventDefault();
3665
- if (open) close();
3666
- else openWith("press");
3667
- return;
3668
- }
3669
- if (shouldClickRunPrimary && primary?.onSelect) {
3670
- e.preventDefault();
3671
- close();
3672
- primary.onSelect();
3673
- }
3674
- };
3675
- const handleMenuKeyDown = (e) => {
3676
- const list = rows();
3677
- const index = list.indexOf(document.activeElement);
3678
- let target;
3679
- if (e.key === "ArrowDown") target = list[(index + 1) % list.length];
3680
- else if (e.key === "ArrowUp") target = list[(index - 1 + list.length) % list.length];
3681
- else if (e.key === "Home") target = list[0];
3682
- else if (e.key === "End") target = list[list.length - 1];
3683
- else if (e.key === "Escape") {
3684
- e.preventDefault();
3685
- e.stopPropagation();
3686
- close(true);
3687
- return;
3688
- } else if (e.key === "Tab") {
3689
- close();
3690
- return;
3652
+ var TABLE_DELIMITER_ROW = /^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/;
3653
+ function splitTableRow(line) {
3654
+ return line.trim().replace(/^\|/, "").replace(/(?<!\\)\|$/, "").split(/(?<!\\)\|/).map((cell) => cell.trim().replace(/\\\|/g, "|"));
3655
+ }
3656
+ function flattenMarkdownTables(input) {
3657
+ const lines = input.split("\n");
3658
+ const out = [];
3659
+ for (let i = 0; i < lines.length; i++) {
3660
+ const isTableStart = lines[i].includes("|") && i + 1 < lines.length && lines[i + 1].includes("|") && TABLE_DELIMITER_ROW.test(lines[i + 1]);
3661
+ if (!isTableStart) {
3662
+ out.push(lines[i]);
3663
+ continue;
3691
3664
  }
3692
- if (target) {
3693
- e.preventDefault();
3694
- target.focus();
3665
+ out.push(splitTableRow(lines[i]).join(" "));
3666
+ i += 1;
3667
+ while (i + 1 < lines.length && lines[i + 1].includes("|") && lines[i + 1].trim()) {
3668
+ i += 1;
3669
+ out.push(splitTableRow(lines[i]).join(" "));
3695
3670
  }
3696
- };
3697
- const choose = (item) => {
3698
- const wasKey = mode.current === "key";
3699
- close(wasKey);
3700
- item.onSelect?.();
3701
- };
3702
- const setTriggerRef = React.useCallback(
3703
- (el) => {
3704
- triggerRef.current = el;
3705
- if (typeof externalRef === "function") externalRef(el);
3706
- else if (externalRef) externalRef.current = el;
3707
- },
3708
- [externalRef]
3709
- );
3710
- const triggerProps = {
3711
- ref: setTriggerRef,
3712
- className,
3713
- "data-testid": testId,
3714
- "data-slot": "mark",
3715
- "aria-haspopup": "true",
3716
- "aria-expanded": open,
3717
- "aria-controls": open ? menuId : void 0,
3718
- onPointerDown: handlePointerDown,
3719
- onPointerEnter: handlePointerEnter,
3720
- onPointerMove: handlePointerMove,
3721
- onPointerLeave: handlePointerLeave,
3722
- onFocus: handleFocus,
3723
- onBlur: handleBlur,
3724
- onKeyDown: handleKeyDown,
3725
- onClick: handleClick,
3726
- ...rest
3727
- };
3728
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: open && !isEmpty, children: [
3729
- /* @__PURE__ */ jsxRuntime.jsx(PopoverAnchor, { asChild: true, children: as === "a" ? /* @__PURE__ */ jsxRuntime.jsx("a", { href, ...triggerProps, children }) : /* @__PURE__ */ jsxRuntime.jsx("span", { role: "button", tabIndex: 0, ...triggerProps, children }) }),
3730
- /* @__PURE__ */ jsxRuntime.jsxs(
3731
- PopoverContent,
3671
+ }
3672
+ return out.join("\n");
3673
+ }
3674
+ function markdownToPlainTextBlocks(input) {
3675
+ if (!input) return "";
3676
+ return flattenMarkdownTables(input).replace(/^[ \t]*([-*_])([ \t]*\1){2,}[ \t]*$/gm, "").replace(/```[^\n]*\n?/g, "").replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, "$1 ($2)").replace(/^[ \t]*#{1,6}[ \t]+/gm, "").replace(/^[ \t]*>[ \t]?/gm, "").replace(/(\*\*|__)(?=\S)(.+?)(?<=\S)\1/g, "$2").replace(/\*(?=\S)(.+?)(?<=\S)\*/g, "$1").replace(/(^|[^\w])_(?=\S)(.+?)(?<=\S)_(?!\w)/g, "$1$2").replace(/`([^`]*)`/g, "$1").replace(/[ \t]+\n/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
3677
+ }
3678
+
3679
+ // src/ui/DictateContext.tsx
3680
+ function useDictateContext() {
3681
+ return chunkRCKA7BEF_cjs.useHostConfigRecord().dictate ?? null;
3682
+ }
3683
+ var Input = React__namespace.forwardRef(
3684
+ ({ className, type, dictate, onFocus, onBlur, ...props }, forwardedRef) => {
3685
+ const dictateCtx = useDictateContext();
3686
+ const [focused, setFocused] = React__namespace.useState(false);
3687
+ const innerRef = React__namespace.useRef(null);
3688
+ React__namespace.useImperativeHandle(forwardedRef, () => innerRef.current);
3689
+ const showDictate = dictate && !!dictateCtx && !props.disabled && !props.readOnly;
3690
+ const input = /* @__PURE__ */ jsxRuntime.jsx(
3691
+ "input",
3732
3692
  {
3733
- ref: contentRef,
3734
- id: menuId,
3735
- side,
3736
- align: "start",
3737
- sideOffset: 6,
3738
- collisionPadding: 8,
3739
- role: "group",
3740
- "data-testid": menuTestId,
3741
- "data-slot": "mark-menu",
3742
- className: "w-auto min-w-[12rem] max-w-[min(22rem,calc(100vw-1rem))] p-1",
3743
- onOpenAutoFocus: (e) => {
3744
- e.preventDefault();
3745
- if (focusFirstOnOpen.current) firstItem()?.focus();
3693
+ type,
3694
+ "data-slot": "input",
3695
+ className: chunkS6A6FSG7_cjs.cn(
3696
+ "flex h-9 pointer-coarse:h-11 w-full rounded-md border border-input bg-background px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/60 focus-visible:outline-none focus-visible:border-ring/50 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
3697
+ showDictate && "pr-9",
3698
+ className
3699
+ ),
3700
+ ref: innerRef,
3701
+ onFocus: (e) => {
3702
+ setFocused(true);
3703
+ onFocus?.(e);
3746
3704
  },
3747
- onCloseAutoFocus: (e) => e.preventDefault(),
3748
- onEscapeKeyDown: (e) => {
3749
- e.preventDefault();
3750
- close(true);
3705
+ onBlur: (e) => {
3706
+ setFocused(false);
3707
+ onBlur?.(e);
3751
3708
  },
3752
- onInteractOutside: (e) => {
3753
- if (triggerRef.current?.contains(e.target)) e.preventDefault();
3709
+ ...props
3710
+ }
3711
+ );
3712
+ if (!showDictate) return input;
3713
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full", children: [
3714
+ input,
3715
+ /* @__PURE__ */ jsxRuntime.jsx(
3716
+ InlineMicButton,
3717
+ {
3718
+ focused,
3719
+ transcribe: dictateCtx.transcribe,
3720
+ onError: dictateCtx.onError,
3721
+ className: "absolute right-1.5 top-1/2 -translate-y-1/2",
3722
+ onTranscript: (text) => {
3723
+ const el = innerRef.current;
3724
+ if (!el) return;
3725
+ const next = el.value ? `${el.value} ${text}` : text;
3726
+ const setter = Object.getOwnPropertyDescriptor(
3727
+ window.HTMLInputElement.prototype,
3728
+ "value"
3729
+ )?.set;
3730
+ setter?.call(el, next);
3731
+ el.dispatchEvent(new Event("input", { bubbles: true }));
3732
+ }
3733
+ }
3734
+ )
3735
+ ] });
3736
+ }
3737
+ );
3738
+ Input.displayName = "Input";
3739
+ var Textarea = React__namespace.forwardRef(
3740
+ ({ className, dictate, onFocus, onBlur, ...props }, forwardedRef) => {
3741
+ const dictateCtx = useDictateContext();
3742
+ const [focused, setFocused] = React__namespace.useState(false);
3743
+ const innerRef = React__namespace.useRef(null);
3744
+ React__namespace.useImperativeHandle(forwardedRef, () => innerRef.current);
3745
+ const showDictate = dictate && !!dictateCtx && !props.disabled && !props.readOnly;
3746
+ const textarea = /* @__PURE__ */ jsxRuntime.jsx(
3747
+ "textarea",
3748
+ {
3749
+ className: chunkS6A6FSG7_cjs.cn(
3750
+ "flex min-h-[60px] w-full rounded-md border border-input bg-background px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground/60 focus-visible:outline-none focus-visible:border-ring/50 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
3751
+ showDictate && "pr-9",
3752
+ className
3753
+ ),
3754
+ ref: innerRef,
3755
+ onFocus: (e) => {
3756
+ setFocused(true);
3757
+ onFocus?.(e);
3754
3758
  },
3755
- onPointerEnter: clearTimer,
3756
- onPointerLeave: (e) => {
3757
- if (!isCoarse(e.pointerType) && mode.current === "hover")
3758
- schedule(() => close(), closeDelay);
3759
+ onBlur: (e) => {
3760
+ setFocused(false);
3761
+ onBlur?.(e);
3759
3762
  },
3760
- children: [
3761
- preview && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-1.5 text-sm", children: preview }),
3762
- ordered.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "menu", "aria-label": menuLabel, onKeyDown: handleMenuKeyDown, children: ordered.map((item) => {
3763
- const rowClass = chunkS6A6FSG7_cjs.cn(
3764
- "flex w-full cursor-pointer items-center rounded-sm px-2 py-1.5 text-left text-sm outline-none transition-colors hover:bg-accent focus-visible:bg-accent pointer-coarse:min-h-11 pointer-coarse:px-3",
3765
- item.primary && "font-medium pointer-coarse:text-base",
3766
- item.destructive && "text-destructive"
3767
- );
3768
- return item.href && !item.onSelect ? /* @__PURE__ */ jsxRuntime.jsx(
3769
- "a",
3770
- {
3771
- role: "menuitem",
3772
- tabIndex: -1,
3773
- href: item.href,
3774
- className: rowClass,
3775
- "data-testid": item.testId,
3776
- onClick: () => close(),
3777
- children: item.label
3778
- },
3779
- item.id
3780
- ) : /* @__PURE__ */ jsxRuntime.jsx(
3781
- "button",
3782
- {
3783
- type: "button",
3784
- role: "menuitem",
3785
- tabIndex: -1,
3786
- className: rowClass,
3787
- "data-testid": item.testId,
3788
- onClick: () => choose(item),
3789
- children: item.label
3790
- },
3791
- item.id
3792
- );
3793
- }) })
3794
- ]
3763
+ ...props
3764
+ }
3765
+ );
3766
+ if (!showDictate) return textarea;
3767
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full", children: [
3768
+ textarea,
3769
+ /* @__PURE__ */ jsxRuntime.jsx(
3770
+ InlineMicButton,
3771
+ {
3772
+ focused,
3773
+ transcribe: dictateCtx.transcribe,
3774
+ onError: dictateCtx.onError,
3775
+ className: "absolute right-1.5 top-1.5",
3776
+ onTranscript: (text) => {
3777
+ const el = innerRef.current;
3778
+ if (!el) return;
3779
+ const next = el.value ? `${el.value} ${text}` : text;
3780
+ const setter = Object.getOwnPropertyDescriptor(
3781
+ window.HTMLTextAreaElement.prototype,
3782
+ "value"
3783
+ )?.set;
3784
+ setter?.call(el, next);
3785
+ el.dispatchEvent(new Event("input", { bubbles: true }));
3786
+ }
3787
+ }
3788
+ )
3789
+ ] });
3790
+ }
3791
+ );
3792
+ Textarea.displayName = "Textarea";
3793
+ function DebouncedInput({
3794
+ value,
3795
+ onChange,
3796
+ disabled,
3797
+ type = "text",
3798
+ multiline = false,
3799
+ className,
3800
+ debounceMs = 500,
3801
+ placeholder,
3802
+ autoResize = true,
3803
+ minHeight = 28,
3804
+ maxHeight = 72
3805
+ }) {
3806
+ const [localValue, setLocalValue] = React.useState(value);
3807
+ const timeoutRef = React.useRef(void 0);
3808
+ const pendingRef = React.useRef(null);
3809
+ const textareaRef = React.useRef(null);
3810
+ const adjustHeight = React.useCallback(() => {
3811
+ const textarea = textareaRef.current;
3812
+ if (!textarea || !autoResize) return;
3813
+ textarea.style.height = "auto";
3814
+ const newHeight = Math.min(Math.max(textarea.scrollHeight, minHeight), maxHeight);
3815
+ textarea.style.height = `${newHeight}px`;
3816
+ }, [autoResize, minHeight, maxHeight]);
3817
+ React.useEffect(() => {
3818
+ if (pendingRef.current !== null) return;
3819
+ setLocalValue(value);
3820
+ }, [value]);
3821
+ React.useEffect(() => {
3822
+ if (multiline) {
3823
+ adjustHeight();
3824
+ }
3825
+ }, [localValue, multiline, adjustHeight]);
3826
+ const onChangeRef = React.useRef(onChange);
3827
+ React.useEffect(() => {
3828
+ onChangeRef.current = onChange;
3829
+ }, [onChange]);
3830
+ const flushPendingChange = React.useCallback(() => {
3831
+ if (pendingRef.current === null) return false;
3832
+ const pending = pendingRef.current;
3833
+ pendingRef.current = null;
3834
+ clearTimeout(timeoutRef.current);
3835
+ onChangeRef.current(pending);
3836
+ return true;
3837
+ }, []);
3838
+ const handleChange = React.useCallback(
3839
+ (e) => {
3840
+ const newValue = e.target.value;
3841
+ setLocalValue(newValue);
3842
+ pendingRef.current = newValue;
3843
+ clearTimeout(timeoutRef.current);
3844
+ timeoutRef.current = setTimeout(() => {
3845
+ pendingRef.current = null;
3846
+ onChangeRef.current(newValue);
3847
+ }, debounceMs);
3848
+ },
3849
+ [debounceMs]
3850
+ );
3851
+ React.useEffect(
3852
+ () => () => {
3853
+ const pending = pendingRef.current;
3854
+ pendingRef.current = null;
3855
+ clearTimeout(timeoutRef.current);
3856
+ if (pending !== null) onChangeRef.current(pending);
3857
+ },
3858
+ []
3859
+ );
3860
+ const handleBlur = React.useCallback(() => {
3861
+ flushPendingChange();
3862
+ if (localValue !== value) {
3863
+ setLocalValue(value);
3864
+ }
3865
+ }, [flushPendingChange, localValue, value]);
3866
+ if (multiline) {
3867
+ return /* @__PURE__ */ jsxRuntime.jsx(
3868
+ Textarea,
3869
+ {
3870
+ ref: textareaRef,
3871
+ value: localValue,
3872
+ onChange: handleChange,
3873
+ onBlur: handleBlur,
3874
+ disabled,
3875
+ className: `resize-y ${className || ""}`,
3876
+ placeholder,
3877
+ style: { minHeight: `${minHeight}px` }
3795
3878
  }
3796
- )
3797
- ] });
3798
- }
3799
- var Command = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3800
- cmdk.Command,
3801
- {
3802
- ref,
3803
- className: chunkS6A6FSG7_cjs.cn(
3804
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
3805
- className
3806
- ),
3807
- ...props
3879
+ );
3808
3880
  }
3809
- ));
3810
- Command.displayName = cmdk.Command.displayName;
3811
- var CommandDialog = ({ children, ...props }) => {
3812
- return /* @__PURE__ */ jsxRuntime.jsx(chunkWYZJLZ67_cjs.Dialog, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(chunkWYZJLZ67_cjs.DialogContent, { className: "overflow-hidden p-0", children: /* @__PURE__ */ jsxRuntime.jsx(Command, { className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children }) }) });
3813
- };
3814
- var CommandInput = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border-b px-3", "data-cmdk-input-wrapper": "", children: [
3815
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
3816
- /* @__PURE__ */ jsxRuntime.jsx(
3817
- cmdk.Command.Input,
3881
+ return /* @__PURE__ */ jsxRuntime.jsx(
3882
+ Input,
3818
3883
  {
3819
- ref,
3820
- className: chunkS6A6FSG7_cjs.cn(
3821
- "flex h-10 pointer-coarse:h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
3822
- className
3823
- ),
3824
- ...props
3884
+ type,
3885
+ value: localValue,
3886
+ onChange: handleChange,
3887
+ onBlur: handleBlur,
3888
+ disabled,
3889
+ className,
3890
+ placeholder
3825
3891
  }
3826
- )
3827
- ] }));
3828
- CommandInput.displayName = cmdk.Command.Input.displayName;
3829
- var CommandList = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3830
- cmdk.Command.List,
3831
- {
3832
- ref,
3833
- className: chunkS6A6FSG7_cjs.cn("max-h-[min(300px,50dvh)] overflow-y-auto overflow-x-hidden", className),
3834
- ...props
3835
- }
3836
- ));
3837
- CommandList.displayName = cmdk.Command.List.displayName;
3838
- var CommandEmpty = React__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(cmdk.Command.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
3839
- CommandEmpty.displayName = cmdk.Command.Empty.displayName;
3840
- var CommandGroup = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3841
- cmdk.Command.Group,
3892
+ );
3893
+ }
3894
+ var HoverCard = HoverCardPrimitive__namespace.Root;
3895
+ var HoverCardTrigger = HoverCardPrimitive__namespace.Trigger;
3896
+ function HoverCardPortal({
3897
+ container,
3898
+ ...props
3899
+ }) {
3900
+ const fallback = chunkHJDR5HEO_cjs.usePortalContainer();
3901
+ return /* @__PURE__ */ jsxRuntime.jsx(HoverCardPrimitive__namespace.Portal, { container: container ?? fallback, ...props });
3902
+ }
3903
+ var HoverCardContent = React__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(HoverCardPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
3904
+ HoverCardPrimitive__namespace.Content,
3842
3905
  {
3843
3906
  ref,
3907
+ align,
3908
+ sideOffset,
3909
+ collisionPadding: chunkHJDR5HEO_cjs.getCollisionPadding(),
3844
3910
  className: chunkS6A6FSG7_cjs.cn(
3845
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-sm [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
3911
+ "z-50 w-64 max-w-[calc(100vw-1rem)] rounded-md border bg-popover p-4 text-popover-foreground shadow-lg outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 origin-[--radix-hover-card-content-transform-origin]",
3846
3912
  className
3847
3913
  ),
3848
3914
  ...props
3849
3915
  }
3850
- ));
3851
- CommandGroup.displayName = cmdk.Command.Group.displayName;
3852
- var CommandSeparator = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3853
- cmdk.Command.Separator,
3854
- {
3855
- ref,
3856
- className: chunkS6A6FSG7_cjs.cn("-mx-1 h-px bg-border", className),
3857
- ...props
3858
- }
3859
- ));
3860
- CommandSeparator.displayName = cmdk.Command.Separator.displayName;
3861
- var CommandItem = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3862
- cmdk.Command.Item,
3863
- {
3864
- ref,
3865
- className: chunkS6A6FSG7_cjs.cn(
3866
- "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 pointer-coarse:min-h-11 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
3867
- className
3868
- ),
3869
- ...props
3916
+ ) }));
3917
+ HoverCardContent.displayName = HoverCardPrimitive__namespace.Content.displayName;
3918
+ var cardVariants = classVarianceAuthority.cva("min-w-0 rounded-lg bg-card text-card-foreground", {
3919
+ variants: {
3920
+ variant: {
3921
+ flat: "",
3922
+ outline: "border",
3923
+ elevated: "border shadow-sm"
3924
+ }
3925
+ },
3926
+ defaultVariants: {
3927
+ variant: "flat"
3870
3928
  }
3871
- ));
3872
- CommandItem.displayName = cmdk.Command.Item.displayName;
3873
- var CommandShortcut = ({ className, ...props }) => {
3874
- return /* @__PURE__ */ jsxRuntime.jsx(
3875
- "span",
3929
+ });
3930
+ var Card = React__namespace.forwardRef(
3931
+ ({ className, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3932
+ "div",
3876
3933
  {
3877
- className: chunkS6A6FSG7_cjs.cn("ml-auto text-sm tracking-widest text-muted-foreground", className),
3934
+ ref,
3935
+ "data-slot": "card",
3936
+ className: chunkS6A6FSG7_cjs.cn(cardVariants({ variant }), className),
3878
3937
  ...props
3879
3938
  }
3880
- );
3881
- };
3882
- CommandShortcut.displayName = "CommandShortcut";
3883
- var AI_COMPONENTS = {
3884
- a: (p) => /* @__PURE__ */ jsxRuntime.jsx(
3885
- "a",
3886
- {
3887
- className: "text-ai-accent underline underline-offset-2",
3888
- target: "_blank",
3889
- rel: "noopener noreferrer",
3890
- ...p
3891
- }
3892
- ),
3893
- // Redline marks: deletions in red strike, <ins>/<mark> additions accented.
3894
- del: (p) => /* @__PURE__ */ jsxRuntime.jsx("del", { className: "rounded bg-destructive/10 text-destructive decoration-destructive/60", ...p }),
3895
- ins: (p) => /* @__PURE__ */ jsxRuntime.jsx("ins", { className: "rounded bg-ai-accent-soft px-0.5 text-ai-accent no-underline", ...p }),
3896
- mark: (p) => /* @__PURE__ */ jsxRuntime.jsx("mark", { className: "rounded bg-ai-accent-soft px-0.5 text-ai-accent", ...p }),
3897
- thead: (p) => /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-secondary/60", ...p })
3898
- };
3899
- function AiMarkdown({
3900
- children,
3901
- className,
3902
- isStreaming,
3903
- allowHtml
3904
- }) {
3905
- return /* @__PURE__ */ jsxRuntime.jsx(
3906
- chunkOC7F5SNA_cjs.MarkdownRenderer,
3907
- {
3908
- className: className ?? "text-sm",
3909
- components: AI_COMPONENTS,
3910
- isStreaming,
3911
- allowHtml,
3912
- testId: "ai-markdown",
3913
- children
3914
- }
3915
- );
3916
- }
3917
- var TIERS = [
3918
- { min: 0.7, tone: "bg-emerald-500", label: "High relevance" },
3919
- { min: 0.4, tone: "bg-amber-500", label: "Medium relevance" },
3920
- { min: -Infinity, tone: "bg-muted-foreground/40", label: "Low relevance" }
3921
- ];
3922
- function RelevanceDot({ score }) {
3923
- if (score == null) return null;
3924
- const tier = TIERS.find((t) => score >= t.min) ?? TIERS[TIERS.length - 1];
3925
- return /* @__PURE__ */ jsxRuntime.jsx(
3926
- "span",
3939
+ )
3940
+ );
3941
+ Card.displayName = "Card";
3942
+ var CardHeader = React__namespace.forwardRef(
3943
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3944
+ "div",
3927
3945
  {
3928
- role: "img",
3929
- "aria-label": tier.label,
3930
- title: `${tier.label} (${score.toFixed(2)})`,
3931
- className: chunkS6A6FSG7_cjs.cn("size-1.5 shrink-0 rounded-full", tier.tone),
3932
- "data-testid": "passage-relevance"
3946
+ ref,
3947
+ "data-slot": "card-header",
3948
+ className: chunkS6A6FSG7_cjs.cn("flex flex-col space-y-1.5 p-6", className),
3949
+ ...props
3933
3950
  }
3934
- );
3935
- }
3936
- function PassageCard({
3937
- header,
3938
- score,
3939
- headerRight,
3940
- active,
3941
- onClick,
3942
- footer,
3943
- className,
3944
- children,
3945
- "data-testid": testId
3946
- }) {
3947
- const body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3948
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1.5 flex items-center gap-2", children: [
3949
- header,
3950
- (score != null || headerRight) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
3951
- /* @__PURE__ */ jsxRuntime.jsx(RelevanceDot, { score }),
3952
- headerRight
3953
- ] })
3954
- ] }),
3955
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "[&_mark]:rounded-sm [&_mark]:bg-ai-accent/20 [&_mark]:px-0.5 [&_mark]:font-medium [&_mark]:text-foreground", children })
3956
- ] });
3957
- return /* @__PURE__ */ jsxRuntime.jsxs(
3951
+ )
3952
+ );
3953
+ CardHeader.displayName = "CardHeader";
3954
+ var CardTitle = React__namespace.forwardRef(
3955
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3958
3956
  "div",
3959
3957
  {
3960
- className: chunkS6A6FSG7_cjs.cn(
3961
- "group rounded-lg border border-border bg-card p-3 text-left transition-colors",
3962
- onClick && "hover:border-ai-accent/40 focus-within:ring-2 focus-within:ring-ai-accent/40",
3963
- active && "border-ai-accent/60 ring-1 ring-ai-accent/30",
3964
- className
3965
- ),
3966
- children: [
3967
- onClick ? /* @__PURE__ */ jsxRuntime.jsx(
3968
- "div",
3969
- {
3970
- role: "button",
3971
- tabIndex: 0,
3972
- onClick,
3973
- onKeyDown: (e) => {
3974
- if (e.key === "Enter" || e.key === " ") {
3975
- e.preventDefault();
3976
- onClick(e);
3977
- }
3978
- },
3979
- "aria-current": active || void 0,
3980
- "data-testid": testId,
3981
- className: "cursor-pointer focus:outline-none",
3982
- children: body
3983
- }
3984
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-current": active || void 0, "data-testid": testId, children: body }),
3985
- footer
3986
- ]
3958
+ ref,
3959
+ "data-slot": "card-title",
3960
+ className: chunkS6A6FSG7_cjs.cn("font-semibold leading-none tracking-tight", className),
3961
+ ...props
3987
3962
  }
3988
- );
3989
- }
3990
- var TextIcon = lucideReact.FileText;
3991
- var IMAGE_EXTENSIONS3 = /* @__PURE__ */ new Set(["jpg", "jpeg", "png", "gif", "bmp", "tiff", "tif", "webp", "svg"]);
3992
- var VIDEO_EXTENSIONS3 = /* @__PURE__ */ new Set(["mp4", "mpeg", "mpg", "webm", "mov", "avi", "mkv"]);
3993
- var AUDIO_EXTENSIONS3 = /* @__PURE__ */ new Set(["mp3", "wav", "m4a", "aac", "ogg", "flac"]);
3994
- var DOCX_EXTENSIONS2 = /* @__PURE__ */ new Set(["doc", "docx", "odt", "rtf"]);
3995
- var XLSX_EXTENSIONS2 = /* @__PURE__ */ new Set(["xls", "xlsx", "csv", "ods"]);
3996
- var EMAIL_EXTENSIONS3 = /* @__PURE__ */ new Set(["eml", "msg"]);
3997
- var HTML_EXTENSIONS2 = /* @__PURE__ */ new Set(["html", "htm", "mhtml"]);
3998
- var PDF_EXTENSIONS = /* @__PURE__ */ new Set(["pdf"]);
3999
- var TEXT_EXTENSIONS2 = /* @__PURE__ */ new Set([
4000
- "txt",
4001
- "text",
4002
- "md",
4003
- "markdown",
4004
- "log",
4005
- "json",
4006
- "xml",
4007
- "yaml",
4008
- "yml"
4009
- ]);
4010
- function getFileExtension(fileName) {
4011
- if (!fileName) return "";
4012
- const dot = fileName.lastIndexOf(".");
4013
- if (dot <= 0 || dot === fileName.length - 1) return "";
4014
- return fileName.slice(dot + 1).toLowerCase();
4015
- }
4016
- var MIME_TO_EXTENSION = {
4017
- "application/pdf": "pdf",
4018
- "text/plain": "txt",
4019
- "text/markdown": "md",
4020
- "text/html": "html",
4021
- "text/csv": "csv",
4022
- "application/json": "json",
4023
- "application/xml": "xml",
4024
- "application/msword": "doc",
4025
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
4026
- "application/rtf": "rtf",
4027
- "application/vnd.oasis.opendocument.text": "odt",
4028
- "application/vnd.ms-excel": "xls",
4029
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
4030
- "application/vnd.oasis.opendocument.spreadsheet": "ods",
4031
- "image/png": "png",
4032
- "image/jpeg": "jpg",
4033
- "image/gif": "gif",
4034
- "image/webp": "webp",
4035
- "image/svg+xml": "svg",
4036
- "image/tiff": "tiff",
4037
- "image/bmp": "bmp",
4038
- "video/mp4": "mp4",
4039
- "video/webm": "webm",
4040
- "video/quicktime": "mov",
4041
- "audio/mpeg": "mp3",
4042
- "audio/wav": "wav",
4043
- "audio/ogg": "ogg",
4044
- "message/rfc822": "eml"
4045
- };
4046
- function extensionFromMime(mime) {
4047
- if (!mime) return "";
4048
- return MIME_TO_EXTENSION[mime.toLowerCase()] ?? "";
4049
- }
4050
- function iconFromExtension(ext) {
4051
- if (VIDEO_EXTENSIONS3.has(ext)) return VidIcon;
4052
- if (AUDIO_EXTENSIONS3.has(ext)) return AudIcon;
4053
- if (IMAGE_EXTENSIONS3.has(ext)) return ImgIcon;
4054
- if (DOCX_EXTENSIONS2.has(ext)) return DocIcon;
4055
- if (XLSX_EXTENSIONS2.has(ext)) return XlsIcon;
4056
- if (EMAIL_EXTENSIONS3.has(ext)) return EmlIcon;
4057
- if (HTML_EXTENSIONS2.has(ext)) return HtmlIcon;
4058
- if (PDF_EXTENSIONS.has(ext)) return PdfIcon;
4059
- if (TEXT_EXTENSIONS2.has(ext)) return TextIcon;
4060
- return null;
4061
- }
4062
- function iconFromMime(mime) {
4063
- const m = mime.toLowerCase();
4064
- if (m.startsWith("image/")) return ImgIcon;
4065
- if (m.startsWith("video/")) return VidIcon;
4066
- if (m.startsWith("audio/")) return AudIcon;
4067
- if (m === "application/pdf") return PdfIcon;
4068
- if (m === "text/html") return HtmlIcon;
4069
- if (m === "message/rfc822" || m.includes("outlook")) return EmlIcon;
4070
- if (m.includes("word") || m === "application/rtf" || m.includes("opendocument.text"))
4071
- return DocIcon;
4072
- if (m.includes("sheet") || m.includes("excel") || m === "text/csv" || m.includes("opendocument.spreadsheet"))
4073
- return XlsIcon;
4074
- if (m.startsWith("text/") || m === "application/json" || m === "application/xml") return TextIcon;
4075
- return null;
4076
- }
4077
- function getFileTypeIcon(fileName, opts) {
4078
- return iconFromExtension(getFileExtension(fileName)) ?? (opts?.mime ? iconFromMime(opts.mime) : null) ?? (opts?.defaultToPdf ? PdfIcon : TextIcon);
4079
- }
4080
- var GoogleIcon = ({
4081
- size = 20,
4082
- className = "",
4083
- "aria-label": ariaLabel,
4084
- "aria-hidden": ariaHidden = true
4085
- }) => {
4086
- return /* @__PURE__ */ jsxRuntime.jsxs(
4087
- "svg",
3963
+ )
3964
+ );
3965
+ CardTitle.displayName = "CardTitle";
3966
+ var CardDescription = React__namespace.forwardRef(
3967
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3968
+ "div",
4088
3969
  {
4089
- className,
4090
- width: size,
4091
- height: size,
4092
- viewBox: "0 0 24 24",
4093
- "aria-label": ariaLabel,
4094
- "aria-hidden": ariaHidden,
4095
- children: [
4096
- /* @__PURE__ */ jsxRuntime.jsx(
4097
- "path",
4098
- {
4099
- fill: "#4285F4",
4100
- d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
4101
- }
4102
- ),
4103
- /* @__PURE__ */ jsxRuntime.jsx(
4104
- "path",
4105
- {
4106
- fill: "#34A853",
4107
- d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
4108
- }
4109
- ),
4110
- /* @__PURE__ */ jsxRuntime.jsx(
4111
- "path",
4112
- {
4113
- fill: "#FBBC05",
4114
- d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
4115
- }
4116
- ),
4117
- /* @__PURE__ */ jsxRuntime.jsx(
4118
- "path",
4119
- {
4120
- fill: "#EA4335",
4121
- d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
4122
- }
4123
- )
4124
- ]
3970
+ ref,
3971
+ "data-slot": "card-description",
3972
+ className: chunkS6A6FSG7_cjs.cn("text-sm text-muted-foreground", className),
3973
+ ...props
4125
3974
  }
4126
- );
4127
- };
4128
- var OpenAIIcon = ({
4129
- size = 16,
4130
- className = "",
4131
- "aria-label": ariaLabel = "OpenAI",
4132
- "aria-hidden": ariaHidden = true
4133
- }) => /* @__PURE__ */ jsxRuntime.jsx(
4134
- "svg",
3975
+ )
3976
+ );
3977
+ CardDescription.displayName = "CardDescription";
3978
+ var CardContent = React__namespace.forwardRef(
3979
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, "data-slot": "card-content", className: chunkS6A6FSG7_cjs.cn("p-6 pt-0", className), ...props })
3980
+ );
3981
+ CardContent.displayName = "CardContent";
3982
+ var CardFooter = React__namespace.forwardRef(
3983
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3984
+ "div",
3985
+ {
3986
+ ref,
3987
+ "data-slot": "card-footer",
3988
+ className: chunkS6A6FSG7_cjs.cn("flex items-center p-6 pt-0", className),
3989
+ ...props
3990
+ }
3991
+ )
3992
+ );
3993
+ CardFooter.displayName = "CardFooter";
3994
+ var Label2 = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3995
+ "label",
3996
+ {
3997
+ ref,
3998
+ className: `text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 ${className || ""}`,
3999
+ ...props
4000
+ }
4001
+ ));
4002
+ Label2.displayName = "Label";
4003
+ var Separator2 = React__namespace.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4004
+ SeparatorPrimitive__namespace.Root,
4005
+ {
4006
+ ref,
4007
+ decorative,
4008
+ orientation,
4009
+ className: chunkS6A6FSG7_cjs.cn(
4010
+ "shrink-0 bg-border",
4011
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
4012
+ className
4013
+ ),
4014
+ ...props
4015
+ }
4016
+ ));
4017
+ Separator2.displayName = SeparatorPrimitive__namespace.Root.displayName;
4018
+ var Collapsible = CollapsiblePrimitive__namespace.Root;
4019
+ var CollapsibleTrigger2 = CollapsiblePrimitive__namespace.CollapsibleTrigger;
4020
+ var CollapsibleContent2 = CollapsiblePrimitive__namespace.CollapsibleContent;
4021
+ var Progress = React__namespace.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4022
+ ProgressPrimitive__namespace.Root,
4023
+ {
4024
+ ref,
4025
+ className: chunkS6A6FSG7_cjs.cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20", className),
4026
+ ...props,
4027
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4028
+ ProgressPrimitive__namespace.Indicator,
4029
+ {
4030
+ className: "h-full w-full flex-1 bg-primary transition-all",
4031
+ style: { transform: `translateX(-${100 - (value || 0)}%)` }
4032
+ }
4033
+ )
4034
+ }
4035
+ ));
4036
+ Progress.displayName = ProgressPrimitive__namespace.Root.displayName;
4037
+ var RadioGroup = React__namespace.forwardRef(({ className, ...props }, ref) => {
4038
+ return /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Root, { className: chunkS6A6FSG7_cjs.cn("grid gap-2", className), ...props, ref });
4039
+ });
4040
+ RadioGroup.displayName = RadioGroupPrimitive__namespace.Root.displayName;
4041
+ var RadioGroupItem = React__namespace.forwardRef(({ className, ...props }, ref) => {
4042
+ return /* @__PURE__ */ jsxRuntime.jsx(
4043
+ RadioGroupPrimitive__namespace.Item,
4044
+ {
4045
+ ref,
4046
+ className: chunkS6A6FSG7_cjs.cn(
4047
+ "relative aspect-square h-4 w-4 rounded-full border border-primary text-primary after:absolute after:left-1/2 after:top-1/2 after:hidden after:size-11 after:-translate-x-1/2 after:-translate-y-1/2 after:content-[''] pointer-coarse:after:block focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
4048
+ className
4049
+ ),
4050
+ ...props,
4051
+ children: /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Circle, { className: "h-2.5 w-2.5 fill-current text-current" }) })
4052
+ }
4053
+ );
4054
+ });
4055
+ RadioGroupItem.displayName = RadioGroupPrimitive__namespace.Item.displayName;
4056
+ var Switch = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4057
+ SwitchPrimitives__namespace.Root,
4135
4058
  {
4136
- className,
4137
- width: size,
4138
- height: size,
4139
- viewBox: "0 0 24 24",
4140
- "aria-label": ariaLabel,
4141
- "aria-hidden": ariaHidden,
4059
+ className: chunkS6A6FSG7_cjs.cn(
4060
+ "peer relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-muted-foreground/45 after:absolute after:left-1/2 after:top-1/2 after:hidden after:size-11 after:-translate-x-1/2 after:-translate-y-1/2 after:content-[''] pointer-coarse:after:block",
4061
+ className
4062
+ ),
4063
+ ...props,
4064
+ ref,
4142
4065
  children: /* @__PURE__ */ jsxRuntime.jsx(
4143
- "path",
4066
+ SwitchPrimitives__namespace.Thumb,
4144
4067
  {
4145
- fill: "#10A37F",
4146
- d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"
4068
+ className: chunkS6A6FSG7_cjs.cn(
4069
+ "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"
4070
+ )
4147
4071
  }
4148
4072
  )
4149
4073
  }
4150
- );
4151
- var ClaudeIcon = ({
4152
- size = 16,
4153
- className = "",
4154
- "aria-label": ariaLabel = "Claude",
4155
- "aria-hidden": ariaHidden = true
4156
- }) => /* @__PURE__ */ jsxRuntime.jsx(
4157
- "svg",
4074
+ ));
4075
+ Switch.displayName = SwitchPrimitives__namespace.Root.displayName;
4076
+ var Tabs = TabsPrimitive__namespace.Root;
4077
+ var TabsList = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4078
+ TabsPrimitive__namespace.List,
4158
4079
  {
4159
- className,
4160
- width: size,
4161
- height: size,
4162
- viewBox: "0 0 24 24",
4163
- "aria-label": ariaLabel,
4164
- "aria-hidden": ariaHidden,
4165
- children: /* @__PURE__ */ jsxRuntime.jsx(
4166
- "path",
4167
- {
4168
- fill: "#D97757",
4169
- d: "m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"
4170
- }
4171
- )
4080
+ ref,
4081
+ className: chunkS6A6FSG7_cjs.cn(
4082
+ "inline-flex h-9 pointer-coarse:h-auto items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
4083
+ className
4084
+ ),
4085
+ ...props
4172
4086
  }
4173
- );
4174
- var GeminiIcon = ({
4175
- size = 16,
4176
- className = "",
4177
- "aria-label": ariaLabel = "Gemini",
4178
- "aria-hidden": ariaHidden = true
4179
- }) => /* @__PURE__ */ jsxRuntime.jsxs(
4180
- "svg",
4087
+ ));
4088
+ TabsList.displayName = TabsPrimitive__namespace.List.displayName;
4089
+ var TabsTrigger = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4090
+ TabsPrimitive__namespace.Trigger,
4181
4091
  {
4182
- className,
4183
- width: size,
4184
- height: size,
4185
- viewBox: "0 0 24 24",
4186
- "aria-label": ariaLabel,
4187
- "aria-hidden": ariaHidden,
4188
- children: [
4189
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: "geminiGradient", x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
4190
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: "#1BA1E3" }),
4191
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "25%", stopColor: "#5489D6" }),
4192
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "50%", stopColor: "#9B72CB" }),
4193
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "75%", stopColor: "#D96570" }),
4194
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: "#F49C46" })
4195
- ] }) }),
4196
- /* @__PURE__ */ jsxRuntime.jsx(
4197
- "path",
4198
- {
4199
- fill: "url(#geminiGradient)",
4200
- d: "M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"
4201
- }
4202
- )
4203
- ]
4092
+ ref,
4093
+ className: chunkS6A6FSG7_cjs.cn(
4094
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm pointer-coarse:min-h-11 font-medium ring-offset-background transition-all 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",
4095
+ className
4096
+ ),
4097
+ ...props
4098
+ }
4099
+ ));
4100
+ TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
4101
+ var TabsContent = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4102
+ TabsPrimitive__namespace.Content,
4103
+ {
4104
+ ref,
4105
+ className: chunkS6A6FSG7_cjs.cn(
4106
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
4107
+ className
4108
+ ),
4109
+ ...props
4204
4110
  }
4111
+ ));
4112
+ TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
4113
+ var Table = React__namespace.forwardRef(
4114
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx("table", { ref, className: chunkS6A6FSG7_cjs.cn("w-full caption-bottom text-sm", className), ...props }) })
4205
4115
  );
4206
- var FireworksIcon = ({
4207
- size = 16,
4208
- className = "",
4209
- "aria-label": ariaLabel = "Fireworks AI",
4210
- "aria-hidden": ariaHidden = true
4211
- }) => /* @__PURE__ */ jsxRuntime.jsxs(
4212
- "svg",
4116
+ Table.displayName = "Table";
4117
+ var TableHeader = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: chunkS6A6FSG7_cjs.cn("[&_tr]:border-b", className), ...props }));
4118
+ TableHeader.displayName = "TableHeader";
4119
+ var TableBody = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("tbody", { ref, className: chunkS6A6FSG7_cjs.cn("[&_tr:last-child]:border-0", className), ...props }));
4120
+ TableBody.displayName = "TableBody";
4121
+ var TableFooter = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4122
+ "tfoot",
4213
4123
  {
4214
- className,
4215
- width: size,
4216
- height: size,
4217
- viewBox: "-2 6 36 20",
4218
- preserveAspectRatio: "xMidYMid meet",
4219
- fill: "none",
4220
- style: { minWidth: size, minHeight: size },
4221
- "aria-label": ariaLabel,
4222
- "aria-hidden": ariaHidden,
4223
- children: [
4224
- /* @__PURE__ */ jsxRuntime.jsx(
4225
- "path",
4226
- {
4227
- fill: "#6720FF",
4228
- d: "M15.9851 19.1274C15.0969 19.1274 14.2999 18.6001 13.96 17.7838L9.86258 8H12.2608L15.9991 16.9499L19.7339 8H22.1321L18.0102 17.7873C17.6686 18.6001 16.8733 19.1274 15.9851 19.1274Z"
4229
- }
4124
+ ref,
4125
+ className: chunkS6A6FSG7_cjs.cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
4126
+ ...props
4127
+ }
4128
+ ));
4129
+ TableFooter.displayName = "TableFooter";
4130
+ var TableRow = React__namespace.forwardRef(
4131
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4132
+ "tr",
4133
+ {
4134
+ ref,
4135
+ className: chunkS6A6FSG7_cjs.cn(
4136
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
4137
+ className
4230
4138
  ),
4231
- /* @__PURE__ */ jsxRuntime.jsx(
4232
- "path",
4233
- {
4234
- fill: "#6720FF",
4235
- d: "M21.3316 23.8029C20.4469 23.8029 19.6533 23.2792 19.31 22.4698C18.9649 21.6535 19.1436 20.7215 19.7672 20.0891L27.2299 12.5302L28.1618 14.7287L21.3298 21.636L31.068 21.5817L32 23.7802L21.3333 23.8065L21.3298 23.8029H21.3316Z"
4236
- }
4139
+ ...props
4140
+ }
4141
+ )
4142
+ );
4143
+ TableRow.displayName = "TableRow";
4144
+ var TableHead = React__namespace.forwardRef(
4145
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4146
+ "th",
4147
+ {
4148
+ ref,
4149
+ className: chunkS6A6FSG7_cjs.cn(
4150
+ "h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
4151
+ className
4237
4152
  ),
4238
- /* @__PURE__ */ jsxRuntime.jsx(
4239
- "path",
4240
- {
4241
- fill: "#6720FF",
4242
- d: "M0 23.7766L0.931955 21.5781L10.6702 21.6324L3.83993 14.7234L4.77189 12.5249L12.2345 20.0838C12.8582 20.7145 13.0386 21.65 12.6918 22.4645C12.3484 23.2756 11.5513 23.7977 10.6702 23.7977L0.00350359 23.7731L0 23.7766Z"
4243
- }
4244
- )
4245
- ]
4246
- }
4153
+ ...props
4154
+ }
4155
+ )
4247
4156
  );
4248
- function ProviderIcon({
4249
- modelName,
4250
- provider,
4251
- size = 16,
4252
- className = ""
4253
- }) {
4254
- const m = (modelName ?? "").toLowerCase();
4255
- const p = (provider ?? "").toLowerCase();
4256
- if (m.includes("gpt") || p === "openai") {
4257
- return /* @__PURE__ */ jsxRuntime.jsx(OpenAIIcon, { size, className });
4258
- }
4259
- if (m.includes("claude") || p === "anthropic") {
4260
- return /* @__PURE__ */ jsxRuntime.jsx(ClaudeIcon, { size, className });
4261
- }
4262
- if (m.includes("gemini") || p.startsWith("vertex_ai")) {
4263
- return /* @__PURE__ */ jsxRuntime.jsx(GeminiIcon, { size, className });
4157
+ TableHead.displayName = "TableHead";
4158
+ var TableCell = React__namespace.forwardRef(
4159
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4160
+ "td",
4161
+ {
4162
+ ref,
4163
+ className: chunkS6A6FSG7_cjs.cn(
4164
+ "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
4165
+ className
4166
+ ),
4167
+ ...props
4168
+ }
4169
+ )
4170
+ );
4171
+ TableCell.displayName = "TableCell";
4172
+ var TableCaption = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("caption", { ref, className: chunkS6A6FSG7_cjs.cn("mt-4 text-sm text-muted-foreground", className), ...props }));
4173
+ TableCaption.displayName = "TableCaption";
4174
+ var Slider = React__namespace.forwardRef(
4175
+ ({ className, rangeClassName, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
4176
+ SliderPrimitive__namespace.Root,
4177
+ {
4178
+ ref,
4179
+ className: chunkS6A6FSG7_cjs.cn("relative flex w-full touch-none select-none items-center", className),
4180
+ ...props,
4181
+ children: [
4182
+ /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Track, { className: "relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20", children: /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Range, { className: chunkS6A6FSG7_cjs.cn("absolute h-full bg-primary", rangeClassName) }) }),
4183
+ /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Thumb, { className: "block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" })
4184
+ ]
4185
+ }
4186
+ )
4187
+ );
4188
+ Slider.displayName = SliderPrimitive__namespace.Root.displayName;
4189
+ var toggleVariants = classVarianceAuthority.cva(
4190
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
4191
+ {
4192
+ variants: {
4193
+ variant: {
4194
+ default: "bg-transparent",
4195
+ outline: "border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground"
4196
+ },
4197
+ size: {
4198
+ default: "h-9 px-2 min-w-9 pointer-coarse:h-11 pointer-coarse:min-w-11",
4199
+ sm: "h-8 px-1.5 min-w-8 pointer-coarse:h-11 pointer-coarse:min-w-11",
4200
+ lg: "h-10 px-2.5 min-w-10 pointer-coarse:h-11 pointer-coarse:min-w-11"
4201
+ }
4202
+ },
4203
+ defaultVariants: {
4204
+ variant: "default",
4205
+ size: "default"
4206
+ }
4264
4207
  }
4265
- if (p === "google") {
4266
- return /* @__PURE__ */ jsxRuntime.jsx(GoogleIcon, { size, className });
4208
+ );
4209
+ var Toggle = React__namespace.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4210
+ TogglePrimitive__namespace.Root,
4211
+ {
4212
+ ref,
4213
+ className: chunkS6A6FSG7_cjs.cn(toggleVariants({ variant, size, className })),
4214
+ ...props
4267
4215
  }
4268
- if (p === "fireworks_ai") {
4269
- return /* @__PURE__ */ jsxRuntime.jsx(FireworksIcon, { size, className });
4216
+ ));
4217
+ Toggle.displayName = TogglePrimitive__namespace.Root.displayName;
4218
+ var ToggleGroupContext = React__namespace.createContext({
4219
+ size: "default",
4220
+ variant: "default"
4221
+ });
4222
+ var ToggleGroup = React__namespace.forwardRef(({ className, variant, size, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4223
+ ToggleGroupPrimitive__namespace.Root,
4224
+ {
4225
+ ref,
4226
+ className: chunkS6A6FSG7_cjs.cn("flex items-center justify-center gap-1", className),
4227
+ ...props,
4228
+ children: /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupContext.Provider, { value: { variant, size }, children })
4270
4229
  }
4230
+ ));
4231
+ ToggleGroup.displayName = ToggleGroupPrimitive__namespace.Root.displayName;
4232
+ var ToggleGroupItem = React__namespace.forwardRef(({ className, children, variant, size, ...props }, ref) => {
4233
+ const context = React__namespace.useContext(ToggleGroupContext);
4271
4234
  return /* @__PURE__ */ jsxRuntime.jsx(
4272
- lucideReact.Crown,
4235
+ ToggleGroupPrimitive__namespace.Item,
4273
4236
  {
4274
- className,
4275
- style: { width: size, height: size, color: "#EAB308", fill: "#EAB308" }
4237
+ ref,
4238
+ className: chunkS6A6FSG7_cjs.cn(
4239
+ toggleVariants({
4240
+ variant: context.variant || variant,
4241
+ size: context.size || size
4242
+ }),
4243
+ className
4244
+ ),
4245
+ ...props,
4246
+ children
4276
4247
  }
4277
4248
  );
4249
+ });
4250
+ ToggleGroupItem.displayName = ToggleGroupPrimitive__namespace.Item.displayName;
4251
+ var Popover = PopoverPrimitive__namespace.Root;
4252
+ var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
4253
+ var PopoverAnchor = PopoverPrimitive__namespace.Anchor;
4254
+ function PopoverPortal({
4255
+ container,
4256
+ ...props
4257
+ }) {
4258
+ const fallback = chunkHJDR5HEO_cjs.usePortalContainer();
4259
+ return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { container: container ?? fallback, ...props });
4278
4260
  }
4279
-
4280
- // src/icons/arbi-mark.ts
4281
- var ARBI_MARK_SRC = "data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20xmlns:xlink=%22http://www.w3.org/1999/xlink%22%20width=%22500%22%20zoomAndPan=%22magnify%22%20viewBox=%220%200%20375%20374.999991%22%20height=%22500%22%20preserveAspectRatio=%22xMidYMid%20meet%22%20version=%221.0%22%3E%3Cdefs%3E%3Cg/%3E%3CclipPath%20id=%22413a615d81%22%3E%3Cpath%20d=%22M%20187.5%200%20C%2083.945312%200%200%2083.945312%200%20187.5%20C%200%20291.054688%2083.945312%20375%20187.5%20375%20C%20291.054688%20375%20375%20291.054688%20375%20187.5%20C%20375%2083.945312%20291.054688%200%20187.5%200%20Z%20M%20187.5%200%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22b4114fb668%22%3E%3Cpath%20d=%22M%200%200%20L%20375%200%20L%20375%20375%20L%200%20375%20Z%20M%200%200%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2202d2f74560%22%3E%3Cpath%20d=%22M%20187.5%200%20C%2083.945312%200%200%2083.945312%200%20187.5%20C%200%20291.054688%2083.945312%20375%20187.5%20375%20C%20291.054688%20375%20375%20291.054688%20375%20187.5%20C%20375%2083.945312%20291.054688%200%20187.5%200%20Z%20M%20187.5%200%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2266f7fee432%22%3E%3Crect%20x=%220%22%20width=%22375%22%20y=%220%22%20height=%22375%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2244a7358375%22%3E%3Cpath%20d=%22M%2066.527344%2066.527344%20L%20308.472656%2066.527344%20L%20308.472656%20308.472656%20L%2066.527344%20308.472656%20Z%20M%2066.527344%2066.527344%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2206d1da3b78%22%3E%3Cpath%20d=%22M%20187.5%2066.527344%20C%20120.6875%2066.527344%2066.527344%20120.6875%2066.527344%20187.5%20C%2066.527344%20254.3125%20120.6875%20308.472656%20187.5%20308.472656%20C%20254.3125%20308.472656%20308.472656%20254.3125%20308.472656%20187.5%20C%20308.472656%20120.6875%20254.3125%2066.527344%20187.5%2066.527344%20Z%20M%20187.5%2066.527344%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%225f19be2713%22%3E%3Cpath%20d=%22M%200.527344%200.527344%20L%20242.472656%200.527344%20L%20242.472656%20242.472656%20L%200.527344%20242.472656%20Z%20M%200.527344%200.527344%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22fde3ba0cc4%22%3E%3Cpath%20d=%22M%20121.5%200.527344%20C%2054.6875%200.527344%200.527344%2054.6875%200.527344%20121.5%20C%200.527344%20188.3125%2054.6875%20242.472656%20121.5%20242.472656%20C%20188.3125%20242.472656%20242.472656%20188.3125%20242.472656%20121.5%20C%20242.472656%2054.6875%20188.3125%200.527344%20121.5%200.527344%20Z%20M%20121.5%200.527344%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2267bf874d33%22%3E%3Crect%20x=%220%22%20width=%22243%22%20y=%220%22%20height=%22243%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2205f2bd6677%22%3E%3Cpath%20d=%22M%200%2098.171875%20L%20375%2098.171875%20L%20375%20375%20L%200%20375%20Z%20M%200%2098.171875%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22a5274c9106%22%3E%3Cpath%20d=%22M%20187.5%2098.171875%20L%20404.023438%20508.144531%20L%20-29.023438%20508.144531%20Z%20M%20187.5%2098.171875%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%220f4217ffe3%22%3E%3Cpath%20d=%22M%200%200.171875%20L%20375%200.171875%20L%20375%20277%20L%200%20277%20Z%20M%200%200.171875%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22ca1f5799a3%22%3E%3Cpath%20d=%22M%20187.5%200.171875%20L%20404.023438%20410.144531%20L%20-29.023438%20410.144531%20Z%20M%20187.5%200.171875%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%228bb016993a%22%3E%3Crect%20x=%220%22%20width=%22375%22%20y=%220%22%20height=%22277%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2276af0040d9%22%3E%3Cpath%20d=%22M%200%20195.949219%20L%20375%20195.949219%20L%20375%20375%20L%200%20375%20Z%20M%200%20195.949219%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%221062f89594%22%3E%3Cpath%20d=%22M%200%200.949219%20L%20375%200.949219%20L%20375%20180%20L%200%20180%20Z%20M%200%200.949219%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2217bc809498%22%3E%3Crect%20x=%220%22%20width=%22375%22%20y=%220%22%20height=%22180%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22ad524f887e%22%3E%3Cpath%20d=%22M%202%2094%20L%20293%2094%20L%20293%20342%20L%202%20342%20Z%20M%202%2094%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22ac73806eb1%22%3E%3Crect%20x=%220%22%20width=%22294%22%20y=%220%22%20height=%22342%22/%3E%3C/clipPath%3E%3C/defs%3E%3Crect%20x=%22-37.5%22%20width=%22450%22%20fill=%22%23ffffff%22%20y=%22-37.499999%22%20height=%22449.999989%22%20fill-opacity=%221%22/%3E%3Crect%20x=%22-37.5%22%20width=%22450%22%20fill=%22%23ffffff%22%20y=%22-37.499999%22%20height=%22449.999989%22%20fill-opacity=%221%22/%3E%3Cg%20clip-path=%22url(%23413a615d81)%22%3E%3Cg%20transform=%22matrix(1,%200,%200,%201,%200,%200)%22%3E%3Cg%20clip-path=%22url(%2366f7fee432)%22%3E%3Cg%20clip-path=%22url(%23b4114fb668)%22%3E%3Cg%20clip-path=%22url(%2302d2f74560)%22%3E%3Crect%20x=%22-82.5%22%20width=%22540%22%20fill=%22%2301adef%22%20height=%22539.999987%22%20y=%22-82.499998%22%20fill-opacity=%221%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%20clip-path=%22url(%2344a7358375)%22%3E%3Cg%20clip-path=%22url(%2306d1da3b78)%22%3E%3Cg%20transform=%22matrix(1,%200,%200,%201,%2066,%2066)%22%3E%3Cg%20clip-path=%22url(%2367bf874d33)%22%3E%3Cg%20clip-path=%22url(%235f19be2713)%22%3E%3Cg%20clip-path=%22url(%23fde3ba0cc4)%22%3E%3Cpath%20fill=%22%23ffffff%22%20d=%22M%200.527344%200.527344%20L%20242.472656%200.527344%20L%20242.472656%20242.472656%20L%200.527344%20242.472656%20Z%20M%200.527344%200.527344%20%22%20fill-opacity=%221%22%20fill-rule=%22nonzero%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%20clip-path=%22url(%2305f2bd6677)%22%3E%3Cg%20clip-path=%22url(%23a5274c9106)%22%3E%3Cg%20transform=%22matrix(1,%200,%200,%201,%200,%2098)%22%3E%3Cg%20clip-path=%22url(%238bb016993a)%22%3E%3Cg%20clip-path=%22url(%230f4217ffe3)%22%3E%3Cg%20clip-path=%22url(%23ca1f5799a3)%22%3E%3Cpath%20fill=%22%23ffffff%22%20d=%22M%20-29.023438%200.171875%20L%20403.371094%200.171875%20L%20403.371094%20410.144531%20L%20-29.023438%20410.144531%20Z%20M%20-29.023438%200.171875%20%22%20fill-opacity=%221%22%20fill-rule=%22nonzero%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%20clip-path=%22url(%2376af0040d9)%22%3E%3Cg%20transform=%22matrix(1,%200,%200,%201,%200,%20195)%22%3E%3Cg%20clip-path=%22url(%2317bc809498)%22%3E%3Cg%20clip-path=%22url(%231062f89594)%22%3E%3Cpath%20fill=%22%23ffffff%22%20d=%22M%20-62.902344%200.949219%20L%20438.316406%200.949219%20L%20438.316406%20313.144531%20L%20-62.902344%20313.144531%20Z%20M%20-62.902344%200.949219%20%22%20fill-opacity=%221%22%20fill-rule=%22nonzero%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%20transform=%22matrix(1,%200,%200,%201,%2040,%2033)%22%3E%3Cg%20clip-path=%22url(%23ac73806eb1)%22%3E%3Cg%20clip-path=%22url(%23ad524f887e)%22%3E%3Cg%20fill=%22%23202b61%22%20fill-opacity=%221%22%3E%3Cg%20transform=%22translate(7.369923,%20344.002374)%22%3E%3Cg%3E%3Cpath%20d=%22M%20192.15625%20-48.484375%20L%2086.640625%20-48.484375%20L%2067.03125%200%20L%20-4.984375%200%20L%20105.171875%20-249.5625%20L%20174.6875%20-249.5625%20L%20285.21875%200%20L%20211.765625%200%20Z%20M%20171.484375%20-100.53125%20L%20139.390625%20-180.390625%20L%20107.3125%20-100.53125%20Z%20M%20171.484375%20-100.53125%20%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cpath%20stroke-linecap=%22butt%22%20transform=%22matrix(0.75,%200,%200,%200.75,%200.0000045,%20209.710181)%22%20fill=%22none%22%20stroke-linejoin=%22miter%22%20d=%22M%20-0.000006%2010.001009%20L%2088.703125%2010.001009%20%22%20stroke=%22%23202b61%22%20stroke-width=%2220%22%20stroke-opacity=%221%22%20stroke-miterlimit=%224%22/%3E%3Cpath%20stroke-linecap=%22butt%22%20transform=%22matrix(0.75,%200,%200,%200.75,%20308.473813,%20209.710181)%22%20fill=%22none%22%20stroke-linejoin=%22miter%22%20d=%22M%20-0.00154239%2010.001009%20L%2088.701588%2010.001009%20%22%20stroke=%22%23202b61%22%20stroke-width=%2220%22%20stroke-opacity=%221%22%20stroke-miterlimit=%224%22/%3E%3C/svg%3E";
4282
- var ArbiIcon = ({
4283
- size = 20,
4284
- className = "",
4285
- "aria-label": ariaLabel = "ARBI Docs",
4286
- "aria-hidden": ariaHidden = false
4287
- }) => {
4288
- return /* @__PURE__ */ jsxRuntime.jsx(
4289
- "img",
4290
- {
4291
- src: ARBI_MARK_SRC,
4292
- alt: ariaLabel,
4293
- className: `rounded object-contain ${className}`,
4294
- style: { width: size, height: size },
4295
- "aria-label": ariaLabel,
4296
- "aria-hidden": ariaHidden
4261
+ var PopoverContent = React__namespace.forwardRef(({ className, align = "center", sideOffset = 4, container, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPortal, { container: container ?? void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
4262
+ PopoverPrimitive__namespace.Content,
4263
+ {
4264
+ ref,
4265
+ align,
4266
+ sideOffset,
4267
+ collisionPadding: chunkHJDR5HEO_cjs.getCollisionPadding(),
4268
+ className: chunkS6A6FSG7_cjs.cn(
4269
+ "z-50 w-72 max-w-[calc(100vw-1rem)] max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-lg outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 origin-[--radix-popover-content-transform-origin]",
4270
+ className
4271
+ ),
4272
+ ...props
4273
+ }
4274
+ ) }));
4275
+ PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
4276
+ var PopoverClose = PopoverPrimitive__namespace.Close;
4277
+ var FINE_OPEN_DELAY = 350;
4278
+ var FINE_CLOSE_DELAY = 180;
4279
+ var silentFocusMarks = /* @__PURE__ */ new WeakSet();
4280
+ function returnFocusToMark(mark) {
4281
+ silentFocusMarks.add(mark);
4282
+ mark.focus({ preventScroll: true });
4283
+ silentFocusMarks.delete(mark);
4284
+ }
4285
+ function isFocusVisible(el) {
4286
+ try {
4287
+ return el.matches(":focus-visible");
4288
+ } catch {
4289
+ return true;
4290
+ }
4291
+ }
4292
+ function isCoarse(pointerType) {
4293
+ if (pointerType === "touch" || pointerType === "pen") return true;
4294
+ if (pointerType === "mouse") return false;
4295
+ return typeof window !== "undefined" && !!window.matchMedia?.("(pointer: coarse)").matches;
4296
+ }
4297
+ function MarkMenu({
4298
+ as = "span",
4299
+ href,
4300
+ items,
4301
+ preview,
4302
+ menuLabel,
4303
+ shouldClickRunPrimary = true,
4304
+ openDelay = FINE_OPEN_DELAY,
4305
+ closeDelay = FINE_CLOSE_DELAY,
4306
+ testId,
4307
+ menuTestId,
4308
+ triggerRef: externalRef,
4309
+ className,
4310
+ children,
4311
+ onPointerDown,
4312
+ onPointerEnter,
4313
+ onPointerMove,
4314
+ onPointerLeave,
4315
+ onFocus,
4316
+ onBlur,
4317
+ onKeyDown,
4318
+ ...rest
4319
+ }) {
4320
+ const [open, setOpen] = React.useState(false);
4321
+ const [side, setSide] = React.useState("bottom");
4322
+ const menuId = React.useId();
4323
+ const triggerRef = React.useRef(null);
4324
+ const contentRef = React.useRef(null);
4325
+ const timer = React.useRef(null);
4326
+ const mode = React.useRef("hover");
4327
+ const lastPointer = React.useRef("mouse");
4328
+ const focusFirstOnOpen = React.useRef(false);
4329
+ const hoverArmed = React.useRef(false);
4330
+ const isEmpty = items.length === 0 && !preview;
4331
+ const ordered = [...items].sort((a, b) => Number(!!b.primary) - Number(!!a.primary));
4332
+ const primary = ordered[0];
4333
+ const clearTimer = () => {
4334
+ if (timer.current) clearTimeout(timer.current);
4335
+ timer.current = null;
4336
+ };
4337
+ React.useEffect(() => clearTimer, []);
4338
+ React.useEffect(() => {
4339
+ if (!open) return;
4340
+ const onDocumentPointerDown = (e) => {
4341
+ const target = e.target;
4342
+ if (triggerRef.current?.contains(target) || contentRef.current?.contains(target)) return;
4343
+ if (timer.current) clearTimeout(timer.current);
4344
+ setOpen(false);
4345
+ };
4346
+ document.addEventListener("pointerdown", onDocumentPointerDown, true);
4347
+ return () => document.removeEventListener("pointerdown", onDocumentPointerDown, true);
4348
+ }, [open]);
4349
+ const rows = () => Array.from(contentRef.current?.querySelectorAll('[role="menuitem"]') ?? []);
4350
+ const firstItem = () => rows()[0];
4351
+ const openWith = (next, focusFirst = false) => {
4352
+ clearTimer();
4353
+ mode.current = next;
4354
+ focusFirstOnOpen.current = focusFirst;
4355
+ setSide(next === "press" && isCoarse(lastPointer.current) ? "top" : "bottom");
4356
+ setOpen(true);
4357
+ if (focusFirst) {
4358
+ requestAnimationFrame(() => firstItem()?.focus());
4297
4359
  }
4298
- );
4299
- };
4300
- var ArbiBotHeadIcon = ({ size = 24, className = "" }) => {
4301
- const maskId = React.useId();
4302
- return /* @__PURE__ */ jsxRuntime.jsxs(
4303
- "svg",
4304
- {
4305
- xmlns: "http://www.w3.org/2000/svg",
4306
- width: size,
4307
- height: size,
4308
- viewBox: "30 -5 190 190",
4309
- preserveAspectRatio: "xMidYMid meet",
4310
- className,
4311
- children: [
4312
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("mask", { id: maskId, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", children: [
4313
- /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "0", y: "0", width: "2500", height: "2500", fill: "white" }),
4314
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "855", cy: "1715", r: "190", fill: "black" }),
4315
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "855", cy: "1715", r: "50", fill: "white" }),
4316
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "1665", cy: "1700", r: "190", fill: "black" }),
4317
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "1665", cy: "1700", r: "50", fill: "white" })
4318
- ] }) }) }),
4319
- /* @__PURE__ */ jsxRuntime.jsxs("g", { mask: `url(#${maskId})`, children: [
4320
- /* @__PURE__ */ jsxRuntime.jsx(
4321
- "g",
4322
- {
4323
- transform: "translate(0,250) scale(0.1,-0.1)",
4324
- fill: "currentColor",
4325
- stroke: "currentColor",
4326
- strokeWidth: "100",
4327
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1038 2434 c-217 -39 -406 -154 -522 -318 -121 -170 -176 -376 -103 -384 l27 -3 0 -106 c0 -88 -3 -108 -17 -118 -15 -11 -16 -18 -5 -66 44 -188 209 -369 420 -459 l65 -28 -74 -7 c-283 -26 -444 -152 -535 -418 -70 -204 -73 -507 -5 -507 4 0 12 75 19 168 18 263 68 419 167 530 78 87 224 162 263 134 9 -6 43 -26 76 -43 224 -117 802 -95 948 38 38 34 165 -22 253 -111 117 -119 168 -268 187 -549 6 -92 15 -167 19 -167 89 0 53 415 -54 627 -88 173 -238 270 -458 295 l-99 11 75 32 c201 88 367 274 406 454 10 47 9 56 -5 66 -13 10 -16 32 -16 118 l0 106 28 3 c91 10 -12 297 -165 459 -202 214 -544 307 -895 243z m472 -84 c170 -43 323 -140 416 -264 47 -61 117 -197 128 -248 l6 -28 -65 0 c-64 0 -65 1 -78 33 -43 102 -109 136 -262 137 l-110 0 -38 -40 c-25 -27 -46 -40 -65 -41 -134 -5 -394 1 -410 10 -11 6 -30 24 -42 41 l-21 30 -112 0 c-156 -1 -219 -33 -262 -136 -14 -34 -14 -34 -80 -34 -76 0 -74 -7 -30 103 96 243 311 406 595 452 118 20 319 13 430 -15z m-561 -505 c97 -50 126 -174 61 -263 -118 -163 -380 -23 -309 165 35 93 162 143 248 98z m799 -15 c129 -96 69 -304 -92 -318 -189 -16 -265 218 -106 326 48 33 149 29 198 -8z m272 -389 c0 -23 -45 -110 -86 -168 -245 -343 -856 -408 -1231 -130 -90 67 -213 236 -213 294 0 11 132 13 765 13 457 0 765 -4 765 -9z" })
4328
- }
4329
- ),
4330
- /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", fill: "currentColor", stroke: "none", children: [
4331
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M785 1777 c-60 -60 -59 -134 1 -186 92 -82 236 9 204 128 -25 93 -138 125 -205 58z m161 -29 c7 -22 -19 -52 -40 -45 -21 7 -30 35 -17 51 19 23 48 20 57 -6z" }),
4332
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1591 1803 c-128 -67 -85 -243 60 -243 83 0 141 99 105 178 -32 69 -103 97 -165 65z m127 -59 c4 -25 -19 -47 -41 -38 -22 8 -30 34 -16 51 17 20 53 12 57 -13z" }),
4333
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M843 1347 c-9 -15 9 -63 41 -108 148 -202 565 -209 730 -12 37 44 60 103 47 116 -13 13 -810 17 -818 4z" })
4334
- ] })
4335
- ] })
4336
- ]
4360
+ };
4361
+ const close = (returnFocus = false) => {
4362
+ clearTimer();
4363
+ setOpen(false);
4364
+ if (returnFocus && triggerRef.current) returnFocusToMark(triggerRef.current);
4365
+ };
4366
+ const schedule = (action, delay) => {
4367
+ clearTimer();
4368
+ timer.current = setTimeout(action, delay);
4369
+ };
4370
+ const handlePointerDown = (e) => {
4371
+ lastPointer.current = e.pointerType;
4372
+ onPointerDown?.(e);
4373
+ };
4374
+ const handlePointerEnter = (e) => {
4375
+ onPointerEnter?.(e);
4376
+ if (isCoarse(e.pointerType) || isEmpty) return;
4377
+ lastPointer.current = e.pointerType;
4378
+ hoverArmed.current = true;
4379
+ };
4380
+ const handlePointerMove = (e) => {
4381
+ onPointerMove?.(e);
4382
+ if (!hoverArmed.current) return;
4383
+ hoverArmed.current = false;
4384
+ if (isCoarse(e.pointerType)) return;
4385
+ schedule(() => openWith("hover"), openDelay);
4386
+ };
4387
+ const handlePointerLeave = (e) => {
4388
+ onPointerLeave?.(e);
4389
+ hoverArmed.current = false;
4390
+ if (isCoarse(e.pointerType)) return;
4391
+ if (!open) return clearTimer();
4392
+ if (mode.current === "hover") schedule(() => close(), closeDelay);
4393
+ };
4394
+ const handleFocus = (e) => {
4395
+ onFocus?.(e);
4396
+ if (isEmpty || silentFocusMarks.has(e.currentTarget)) return;
4397
+ if (isFocusVisible(e.currentTarget)) schedule(() => openWith("focus"), openDelay);
4398
+ };
4399
+ const handleBlur = (e) => {
4400
+ onBlur?.(e);
4401
+ const next = e.relatedTarget;
4402
+ if (next && contentRef.current?.contains(next)) return;
4403
+ if (mode.current === "focus" || mode.current === "key") schedule(() => close(), closeDelay);
4404
+ else clearTimer();
4405
+ };
4406
+ const handleKeyDown = (e) => {
4407
+ onKeyDown?.(e);
4408
+ lastPointer.current = "keyboard";
4409
+ if (e.defaultPrevented || isEmpty) return;
4410
+ if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
4411
+ e.preventDefault();
4412
+ openWith("key", true);
4413
+ } else if (e.key === "Escape" && open) {
4414
+ e.preventDefault();
4415
+ e.stopPropagation();
4416
+ close(true);
4337
4417
  }
4338
- );
4339
- };
4340
- function ThreadVisibilityIcon({
4341
- shared,
4342
- className,
4343
- ...props
4344
- }) {
4345
- const Icon2 = shared ? lucideReact.MessageSquareShare : lucideReact.MessageSquareLock;
4346
- return /* @__PURE__ */ jsxRuntime.jsx(Icon2, { ...props, className: chunkS6A6FSG7_cjs.cn(shared ? "text-secondary" : "text-primary", className) });
4347
- }
4348
-
4349
- // src/entities/tag-kinds.ts
4350
- var KIND_ENTITY = {
4351
- label: "LABEL",
4352
- annotation: "ANNOTATION",
4353
- search: "SAVED_SEARCH",
4354
- issue: "ISSUE",
4355
- person: "PERSON",
4356
- organisation: "ORGANISATION"
4357
- };
4358
- function tagKindTitle(kind, { plural = false } = {}) {
4359
- return getEntityLabel(KIND_ENTITY[kind], plural ? "PLURAL" : "SINGULAR");
4360
- }
4361
- function tagKindNouns(kind) {
4362
- return {
4363
- singular: tagKindTitle(kind).toLowerCase(),
4364
- plural: tagKindTitle(kind, { plural: true }).toLowerCase()
4365
4418
  };
4366
- }
4367
- var VARIANT_STYLES = {
4368
- "mine-paid": {
4369
- pill: "text-primary",
4370
- icon: "text-primary"
4371
- },
4372
- other: {
4373
- pill: "text-secondary",
4374
- icon: "text-secondary"
4375
- },
4376
- "mine-free": {
4377
- pill: "text-muted-foreground",
4378
- icon: "text-muted-foreground"
4379
- },
4380
- common: {
4381
- pill: "",
4382
- icon: "text-muted-foreground"
4383
- }
4384
- };
4385
- function resolveVariant(relation, paid, hasCollaborators) {
4386
- if (relation === "common") return "common";
4387
- if (relation === "other") return "other";
4388
- if (relation === "mine") return paid ? "mine-paid" : "mine-free";
4389
- if (paid) return hasCollaborators ? "other" : "mine-paid";
4390
- return "mine-free";
4391
- }
4392
- function ProjectEntity({
4393
- name,
4394
- label,
4395
- icon,
4396
- subscription = "none",
4397
- hasCollaborators = false,
4398
- size = "sm",
4399
- className,
4400
- onClick,
4401
- relation,
4402
- isPaid,
4403
- tooltipContent
4404
- }) {
4405
- const paid = isPaid ?? (subscription === "active" || subscription === "past_due" || subscription === "dev");
4406
- const variant = resolveVariant(relation, paid, hasCollaborators);
4407
- const { pill, icon: iconClass } = VARIANT_STYLES[variant];
4408
- const iconSizeClass = size === "base" ? "h-4 w-4" : "h-3.5 w-3.5";
4409
- const iconNode = icon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: chunkS6A6FSG7_cjs.cn(iconSizeClass, iconClass) });
4410
- return /* @__PURE__ */ jsxRuntime.jsx(
4411
- EntityPill,
4412
- {
4413
- icon: iconNode,
4414
- label: label ?? name,
4415
- size,
4416
- shape: "rounded",
4417
- className: chunkS6A6FSG7_cjs.cn(pill, className),
4418
- onClick,
4419
- tooltipContent
4419
+ const handleClick = (e) => {
4420
+ if (isEmpty) return;
4421
+ if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
4422
+ if (e.detail === 0 && lastPointer.current === "keyboard") {
4423
+ e.preventDefault();
4424
+ return;
4420
4425
  }
4421
- );
4422
- }
4423
- function VerifiedBadge({ className, label = "Identity verified" }) {
4424
- return /* @__PURE__ */ jsxRuntime.jsx(
4425
- lucideReact.BadgeCheck,
4426
- {
4427
- role: "img",
4428
- "aria-label": label,
4429
- "data-testid": "verified-badge",
4430
- className: chunkS6A6FSG7_cjs.cn("h-3.5 w-3.5 shrink-0 text-sky-500", className),
4431
- children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: label })
4426
+ if (isCoarse(lastPointer.current)) {
4427
+ e.preventDefault();
4428
+ if (open) close();
4429
+ else openWith("press");
4430
+ return;
4431
+ }
4432
+ if (shouldClickRunPrimary && primary?.onSelect) {
4433
+ e.preventDefault();
4434
+ close();
4435
+ primary.onSelect();
4436
+ }
4437
+ };
4438
+ const handleMenuKeyDown = (e) => {
4439
+ const list = rows();
4440
+ const index = list.indexOf(document.activeElement);
4441
+ let target;
4442
+ if (e.key === "ArrowDown") target = list[(index + 1) % list.length];
4443
+ else if (e.key === "ArrowUp") target = list[(index - 1 + list.length) % list.length];
4444
+ else if (e.key === "Home") target = list[0];
4445
+ else if (e.key === "End") target = list[list.length - 1];
4446
+ else if (e.key === "Escape") {
4447
+ e.preventDefault();
4448
+ e.stopPropagation();
4449
+ close(true);
4450
+ return;
4451
+ } else if (e.key === "Tab") {
4452
+ close();
4453
+ return;
4432
4454
  }
4455
+ if (target) {
4456
+ e.preventDefault();
4457
+ target.focus();
4458
+ }
4459
+ };
4460
+ const choose = (item) => {
4461
+ const wasKey = mode.current === "key";
4462
+ close(wasKey);
4463
+ item.onSelect?.();
4464
+ };
4465
+ const setTriggerRef = React.useCallback(
4466
+ (el) => {
4467
+ triggerRef.current = el;
4468
+ if (typeof externalRef === "function") externalRef(el);
4469
+ else if (externalRef) externalRef.current = el;
4470
+ },
4471
+ [externalRef]
4433
4472
  );
4434
- }
4435
- var sizeClasses = {
4436
- xs: "h-5 w-5",
4437
- sm: "h-6 w-6",
4438
- md: "h-8 w-8",
4439
- lg: "h-10 w-10"
4440
- };
4441
- var textSizeClasses = {
4442
- xs: "text-xs",
4443
- sm: "text-xs",
4444
- md: "text-xs",
4445
- lg: "text-sm"
4446
- };
4447
- var presenceDotClasses = {
4448
- xs: "w-2 h-2 border",
4449
- sm: "w-2.5 h-2.5 border",
4450
- md: "w-3 h-3 border-2",
4451
- lg: "w-3.5 h-3.5 border-2"
4452
- };
4453
- var presencePositionClasses = {
4454
- xs: "-right-1 bottom-0",
4455
- sm: "-right-1 bottom-0",
4456
- md: "-right-1.5 -bottom-0.5",
4457
- lg: "-right-1.5 -bottom-0.5"
4458
- };
4459
- var PRESENCE_LABELS = {
4460
- connected: "Online",
4461
- connecting: "Connecting",
4462
- disconnected: "Offline",
4463
- error: "Connection problem",
4464
- hidden: "Status hidden"
4465
- };
4466
- var presenceColorClasses = {
4467
- connected: "bg-status-online",
4468
- connecting: "bg-status-connecting",
4469
- disconnected: "bg-status-away",
4470
- error: "bg-status-busy",
4471
- hidden: "bg-status-offline"
4472
- };
4473
- var UserEntity = React.memo(function UserEntity2({
4474
- size = "md",
4475
- variant = "pill",
4476
- className,
4477
- showTooltip = true,
4478
- interactive = true,
4479
- hasUnreadMessages = false,
4480
- initials = "",
4481
- displayName = "",
4482
- picture,
4483
- avatarImageClassName,
4484
- colorClass = "",
4485
- isAgent: isAgent2 = false,
4486
- isVerified = false,
4487
- agentStyle,
4488
- avatarStyle,
4489
- isMe = false,
4490
- displayStatus,
4491
- onClick,
4492
- tooltipContent,
4493
- empty = false
4494
- }) {
4495
- if (empty) {
4496
- return /* @__PURE__ */ jsxRuntime.jsx(
4497
- chunkEEIYXVM4_cjs.Avatar,
4473
+ const triggerProps = {
4474
+ ref: setTriggerRef,
4475
+ className,
4476
+ "data-testid": testId,
4477
+ "data-slot": "mark",
4478
+ "aria-haspopup": "true",
4479
+ "aria-expanded": open,
4480
+ "aria-controls": open ? menuId : void 0,
4481
+ onPointerDown: handlePointerDown,
4482
+ onPointerEnter: handlePointerEnter,
4483
+ onPointerMove: handlePointerMove,
4484
+ onPointerLeave: handlePointerLeave,
4485
+ onFocus: handleFocus,
4486
+ onBlur: handleBlur,
4487
+ onKeyDown: handleKeyDown,
4488
+ onClick: handleClick,
4489
+ ...rest
4490
+ };
4491
+ return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: open && !isEmpty, children: [
4492
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverAnchor, { asChild: true, children: as === "a" ? /* @__PURE__ */ jsxRuntime.jsx("a", { href, ...triggerProps, children }) : /* @__PURE__ */ jsxRuntime.jsx("span", { role: "button", tabIndex: 0, ...triggerProps, children }) }),
4493
+ /* @__PURE__ */ jsxRuntime.jsxs(
4494
+ PopoverContent,
4498
4495
  {
4499
- className: chunkS6A6FSG7_cjs.cn(sizeClasses[size], "border border-border", className),
4500
- "data-testid": "user-entity",
4501
- children: /* @__PURE__ */ jsxRuntime.jsx(chunkEEIYXVM4_cjs.AvatarFallback, { className: "bg-status-empty text-muted-foreground text-xs font-semibold", children: "?" })
4496
+ ref: contentRef,
4497
+ id: menuId,
4498
+ side,
4499
+ align: "start",
4500
+ sideOffset: 6,
4501
+ collisionPadding: 8,
4502
+ role: "group",
4503
+ "data-testid": menuTestId,
4504
+ "data-slot": "mark-menu",
4505
+ className: "w-auto min-w-[12rem] max-w-[min(22rem,calc(100vw-1rem))] p-1",
4506
+ onOpenAutoFocus: (e) => {
4507
+ e.preventDefault();
4508
+ if (focusFirstOnOpen.current) firstItem()?.focus();
4509
+ },
4510
+ onCloseAutoFocus: (e) => e.preventDefault(),
4511
+ onEscapeKeyDown: (e) => {
4512
+ e.preventDefault();
4513
+ close(true);
4514
+ },
4515
+ onInteractOutside: (e) => {
4516
+ if (triggerRef.current?.contains(e.target)) e.preventDefault();
4517
+ },
4518
+ onPointerEnter: clearTimer,
4519
+ onPointerLeave: (e) => {
4520
+ if (!isCoarse(e.pointerType) && mode.current === "hover")
4521
+ schedule(() => close(), closeDelay);
4522
+ },
4523
+ children: [
4524
+ preview && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-1.5 text-sm", children: preview }),
4525
+ ordered.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "menu", "aria-label": menuLabel, onKeyDown: handleMenuKeyDown, children: ordered.map((item) => {
4526
+ const rowClass = chunkS6A6FSG7_cjs.cn(
4527
+ "flex w-full cursor-pointer items-center rounded-sm px-2 py-1.5 text-left text-sm outline-none transition-colors hover:bg-accent focus-visible:bg-accent pointer-coarse:min-h-11 pointer-coarse:px-3",
4528
+ item.primary && "font-medium pointer-coarse:text-base",
4529
+ item.destructive && "text-destructive"
4530
+ );
4531
+ return item.href && !item.onSelect ? /* @__PURE__ */ jsxRuntime.jsx(
4532
+ "a",
4533
+ {
4534
+ role: "menuitem",
4535
+ tabIndex: -1,
4536
+ href: item.href,
4537
+ className: rowClass,
4538
+ "data-testid": item.testId,
4539
+ onClick: () => close(),
4540
+ children: item.label
4541
+ },
4542
+ item.id
4543
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
4544
+ "button",
4545
+ {
4546
+ type: "button",
4547
+ role: "menuitem",
4548
+ tabIndex: -1,
4549
+ className: rowClass,
4550
+ "data-testid": item.testId,
4551
+ onClick: () => choose(item),
4552
+ children: item.label
4553
+ },
4554
+ item.id
4555
+ );
4556
+ }) })
4557
+ ]
4502
4558
  }
4503
- );
4559
+ )
4560
+ ] });
4561
+ }
4562
+ var Command = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4563
+ cmdk.Command,
4564
+ {
4565
+ ref,
4566
+ className: chunkS6A6FSG7_cjs.cn(
4567
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
4568
+ className
4569
+ ),
4570
+ ...props
4504
4571
  }
4505
- const agentBadge = isAgent2 ? /* @__PURE__ */ jsxRuntime.jsx(ArbiBotHeadIcon, { className: "w-3.5 h-3.5 text-muted-foreground" }) : void 0;
4506
- const canMessage = interactive && !isMe && !isAgent2;
4507
- const showUnread = hasUnreadMessages && !isMe && !isAgent2;
4508
- const surfaceStyle = avatarStyle ?? agentStyle;
4509
- const avatarCore = /* @__PURE__ */ jsxRuntime.jsxs(
4510
- chunkEEIYXVM4_cjs.Avatar,
4511
- {
4512
- className: chunkS6A6FSG7_cjs.cn(
4513
- sizeClasses[size],
4514
- isAgent2 ? "rounded-full border-2 border-dashed" : "border border-white"
4515
- ),
4516
- style: surfaceStyle,
4517
- "data-testid": "user-entity",
4518
- children: [
4519
- picture && /* @__PURE__ */ jsxRuntime.jsx(chunkEEIYXVM4_cjs.AvatarImage, { src: picture, alt: initials, className: avatarImageClassName }),
4520
- /* @__PURE__ */ jsxRuntime.jsx(
4521
- chunkEEIYXVM4_cjs.AvatarFallback,
4522
- {
4523
- className: chunkS6A6FSG7_cjs.cn(
4524
- textSizeClasses[size],
4525
- "font-semibold leading-none",
4526
- isAgent2 ? "rounded-full bg-transparent" : `text-white ${colorClass}`
4527
- ),
4528
- style: surfaceStyle,
4529
- children: initials
4530
- }
4531
- )
4532
- ]
4533
- }
4534
- );
4535
- const statusDot = showUnread || displayStatus ? /* @__PURE__ */ jsxRuntime.jsx(
4536
- "span",
4537
- {
4538
- className: chunkS6A6FSG7_cjs.cn(
4539
- "absolute rounded-full border-white",
4540
- presenceDotClasses[size],
4541
- presencePositionClasses[size],
4542
- !showUnread && displayStatus ? presenceColorClasses[displayStatus] : ""
4543
- ),
4544
- style: showUnread ? { backgroundColor: "#00adef" } : void 0,
4545
- "data-testid": "user-entity-presence",
4546
- role: "img",
4547
- "aria-label": showUnread ? "Unread messages" : PRESENCE_LABELS[displayStatus],
4548
- title: showUnread ? "Unread messages" : PRESENCE_LABELS[displayStatus]
4549
- }
4550
- ) : null;
4551
- const avatarElement = statusDot ? /* @__PURE__ */ jsxRuntime.jsxs(
4552
- "div",
4572
+ ));
4573
+ Command.displayName = cmdk.Command.displayName;
4574
+ var CommandDialog = ({ children, ...props }) => {
4575
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkWYZJLZ67_cjs.Dialog, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(chunkWYZJLZ67_cjs.DialogContent, { className: "overflow-hidden p-0", children: /* @__PURE__ */ jsxRuntime.jsx(Command, { className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children }) }) });
4576
+ };
4577
+ var CommandInput = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border-b px-3", "data-cmdk-input-wrapper": "", children: [
4578
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
4579
+ /* @__PURE__ */ jsxRuntime.jsx(
4580
+ cmdk.Command.Input,
4553
4581
  {
4582
+ ref,
4554
4583
  className: chunkS6A6FSG7_cjs.cn(
4555
- "relative inline-block",
4556
- sizeClasses[size],
4557
- variant === "pill" ? "" : className
4558
- ),
4559
- children: [
4560
- avatarCore,
4561
- statusDot
4562
- ]
4563
- }
4564
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkS6A6FSG7_cjs.cn("inline-block", variant === "pill" ? "" : className), children: avatarCore });
4565
- const pillAvatar = (
4566
- // shrink-0: when the pill is squeezed the NAME truncates away — the avatar
4567
- // must never collapse under it and overflow onto neighbouring text.
4568
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: chunkS6A6FSG7_cjs.cn("relative inline-block shrink-0", sizeClasses[size]), children: [
4569
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkS6A6FSG7_cjs.cn("block transition-opacity", canMessage && "group-hover/pill:opacity-0"), children: avatarCore }),
4570
- canMessage && /* @__PURE__ */ jsxRuntime.jsx(
4571
- "span",
4572
- {
4573
- "aria-hidden": true,
4574
- className: "absolute inset-0 flex items-center justify-center rounded-full bg-muted text-foreground opacity-0 transition-opacity group-hover/pill:opacity-100",
4575
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageCircleMore, { className: size === "xs" ? "h-3 w-3" : "h-4 w-4" })
4576
- }
4584
+ "flex h-10 pointer-coarse:h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
4585
+ className
4577
4586
  ),
4578
- statusDot
4579
- ] })
4580
- );
4581
- const resolvedTooltip = showTooltip ? tooltipContent : void 0;
4582
- if (variant === "pill") {
4583
- const row = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4584
- pillAvatar,
4585
- displayName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 max-w-[320px] truncate text-sm leading-tight", children: displayName }),
4586
- isVerified && !isAgent2 && /* @__PURE__ */ jsxRuntime.jsx(VerifiedBadge, {}),
4587
- agentBadge
4588
- ] });
4589
- const rowClass = "group/pill inline-flex min-w-0 items-center gap-2";
4590
- const clickable = interactive && !!onClick;
4591
- const clickableClass = "relative cursor-pointer rounded-md px-1 py-0.5 -mx-1 transition-colors hover:bg-muted/60 pointer-coarse:after:absolute pointer-coarse:after:inset-x-0 pointer-coarse:after:-inset-y-3 pointer-coarse:after:content-['']";
4592
- if (resolvedTooltip) {
4593
- return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
4594
- /* @__PURE__ */ jsxRuntime.jsx(
4595
- TooltipTrigger,
4596
- {
4597
- type: "button",
4598
- onClick: clickable ? onClick : void 0,
4599
- onFocusCapture: (e) => e.stopPropagation(),
4600
- className: chunkS6A6FSG7_cjs.cn(rowClass, clickable && clickableClass, className),
4601
- "data-testid": "user-entity-pill",
4602
- children: row
4603
- }
4604
- ),
4605
- /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { className: "p-2", children: resolvedTooltip })
4606
- ] });
4607
- }
4608
- if (clickable) {
4609
- return /* @__PURE__ */ jsxRuntime.jsx(
4610
- "button",
4611
- {
4612
- type: "button",
4613
- onClick,
4614
- className: chunkS6A6FSG7_cjs.cn(rowClass, clickableClass, className),
4615
- "data-testid": "user-entity-pill",
4616
- children: row
4617
- }
4618
- );
4587
+ ...props
4619
4588
  }
4620
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkS6A6FSG7_cjs.cn(rowClass, className), "data-testid": "user-entity-pill", children: row });
4589
+ )
4590
+ ] }));
4591
+ CommandInput.displayName = cmdk.Command.Input.displayName;
4592
+ var CommandList = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4593
+ cmdk.Command.List,
4594
+ {
4595
+ ref,
4596
+ className: chunkS6A6FSG7_cjs.cn("max-h-[min(300px,50dvh)] overflow-y-auto overflow-x-hidden", className),
4597
+ ...props
4621
4598
  }
4622
- if (showTooltip) {
4623
- return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
4624
- /* @__PURE__ */ jsxRuntime.jsx(
4625
- TooltipTrigger,
4626
- {
4627
- onFocusCapture: (e) => e.stopPropagation(),
4628
- className: "touch-hit inline-flex",
4629
- children: avatarElement
4630
- }
4631
- ),
4632
- /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { className: "p-2", children: tooltipContent })
4633
- ] });
4599
+ ));
4600
+ CommandList.displayName = cmdk.Command.List.displayName;
4601
+ var CommandEmpty = React__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(cmdk.Command.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
4602
+ CommandEmpty.displayName = cmdk.Command.Empty.displayName;
4603
+ var CommandGroup = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4604
+ cmdk.Command.Group,
4605
+ {
4606
+ ref,
4607
+ className: chunkS6A6FSG7_cjs.cn(
4608
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-sm [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
4609
+ className
4610
+ ),
4611
+ ...props
4634
4612
  }
4635
- return avatarElement;
4636
- });
4637
- function AgentBadge({ className }) {
4638
- return /* @__PURE__ */ jsxRuntime.jsxs(
4639
- "span",
4640
- {
4641
- "data-testid": "agent-badge",
4642
- className: chunkS6A6FSG7_cjs.cn(
4643
- "inline-flex shrink-0 items-center gap-1 rounded-full border border-ai-accent/50",
4644
- "bg-ai-accent-soft px-2 py-0.5 text-xs font-bold uppercase tracking-wider text-ai-accent",
4645
- className
4646
- ),
4647
- children: [
4648
- /* @__PURE__ */ jsxRuntime.jsx(ArbiBotHeadIcon, { size: 14, className: "text-ai-accent" }),
4649
- "Agent"
4650
- ]
4613
+ ));
4614
+ CommandGroup.displayName = cmdk.Command.Group.displayName;
4615
+ var CommandSeparator = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4616
+ cmdk.Command.Separator,
4617
+ {
4618
+ ref,
4619
+ className: chunkS6A6FSG7_cjs.cn("-mx-1 h-px bg-border", className),
4620
+ ...props
4621
+ }
4622
+ ));
4623
+ CommandSeparator.displayName = cmdk.Command.Separator.displayName;
4624
+ var CommandItem = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4625
+ cmdk.Command.Item,
4626
+ {
4627
+ ref,
4628
+ className: chunkS6A6FSG7_cjs.cn(
4629
+ "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 pointer-coarse:min-h-11 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
4630
+ className
4631
+ ),
4632
+ ...props
4633
+ }
4634
+ ));
4635
+ CommandItem.displayName = cmdk.Command.Item.displayName;
4636
+ var CommandShortcut = ({ className, ...props }) => {
4637
+ return /* @__PURE__ */ jsxRuntime.jsx(
4638
+ "span",
4639
+ {
4640
+ className: chunkS6A6FSG7_cjs.cn("ml-auto text-sm tracking-widest text-muted-foreground", className),
4641
+ ...props
4651
4642
  }
4652
4643
  );
4653
- }
4654
- var PRESENCE_WORDS = {
4655
- connected: "Online",
4656
- connecting: "Connecting",
4657
- disconnected: "Offline",
4658
- error: "Connection problem",
4659
- hidden: null
4660
4644
  };
4661
- function PresenceLabel({
4662
- status,
4663
- className
4645
+ CommandShortcut.displayName = "CommandShortcut";
4646
+ var AI_COMPONENTS = {
4647
+ a: (p) => /* @__PURE__ */ jsxRuntime.jsx(
4648
+ "a",
4649
+ {
4650
+ className: "text-ai-accent underline underline-offset-2",
4651
+ target: "_blank",
4652
+ rel: "noopener noreferrer",
4653
+ ...p
4654
+ }
4655
+ ),
4656
+ // Redline marks: deletions in red strike, <ins>/<mark> additions accented.
4657
+ del: (p) => /* @__PURE__ */ jsxRuntime.jsx("del", { className: "rounded bg-destructive/10 text-destructive decoration-destructive/60", ...p }),
4658
+ ins: (p) => /* @__PURE__ */ jsxRuntime.jsx("ins", { className: "rounded bg-ai-accent-soft px-0.5 text-ai-accent no-underline", ...p }),
4659
+ mark: (p) => /* @__PURE__ */ jsxRuntime.jsx("mark", { className: "rounded bg-ai-accent-soft px-0.5 text-ai-accent", ...p }),
4660
+ thead: (p) => /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-secondary/60", ...p })
4661
+ };
4662
+ function AiMarkdown({
4663
+ children,
4664
+ className,
4665
+ isStreaming,
4666
+ allowHtml
4664
4667
  }) {
4665
- if (!status) return null;
4666
- const word = PRESENCE_WORDS[status];
4667
- if (!word) return null;
4668
- const online = status === "connected";
4669
- return /* @__PURE__ */ jsxRuntime.jsxs(
4670
- "span",
4668
+ return /* @__PURE__ */ jsxRuntime.jsx(
4669
+ chunkOC7F5SNA_cjs.MarkdownRenderer,
4671
4670
  {
4672
- "data-testid": "presence-label",
4673
- className: chunkS6A6FSG7_cjs.cn("inline-flex shrink-0 items-center gap-1 text-xs", className),
4674
- children: [
4675
- /* @__PURE__ */ jsxRuntime.jsx(
4676
- "span",
4677
- {
4678
- className: chunkS6A6FSG7_cjs.cn(
4679
- "size-1.5 rounded-full",
4680
- online ? "bg-status-online" : "bg-muted-foreground/50"
4681
- ),
4682
- "aria-hidden": "true"
4683
- }
4684
- ),
4685
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: online ? "font-medium text-status-online" : "text-muted-foreground", children: word })
4686
- ]
4671
+ className: className ?? "text-sm",
4672
+ components: AI_COMPONENTS,
4673
+ isStreaming,
4674
+ allowHtml,
4675
+ testId: "ai-markdown",
4676
+ children
4687
4677
  }
4688
4678
  );
4689
4679
  }
4690
- var PACKAGE_BADGE_VARIANTS = [
4691
- "default",
4692
- "accent",
4693
- "secondary",
4694
- "destructive",
4695
- "outline"
4680
+ var TIERS = [
4681
+ { min: 0.7, tone: "bg-emerald-500", label: "High relevance" },
4682
+ { min: 0.4, tone: "bg-amber-500", label: "Medium relevance" },
4683
+ { min: -Infinity, tone: "bg-muted-foreground/40", label: "Low relevance" }
4696
4684
  ];
4697
- function isPackageBadgeVariant(v) {
4698
- return PACKAGE_BADGE_VARIANTS.some((known) => known === v);
4699
- }
4700
- function PackageStatusBadge({ variant, ...rest }) {
4701
- return /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: isPackageBadgeVariant(variant) ? variant : "outline", ...rest });
4702
- }
4703
- var registry = {
4704
- variants: {},
4705
- fallback: "outline",
4706
- Badge: PackageStatusBadge
4707
- };
4708
- function configureStatusRegistry(map, opts) {
4709
- Object.assign(registry.variants, map);
4710
- if (opts?.fallback) registry.fallback = opts.fallback;
4711
- if (opts?.Badge) registry.Badge = opts.Badge;
4712
- }
4713
- function getStatusVariant(status) {
4714
- return registry.variants[status] ?? registry.fallback;
4715
- }
4716
- function StatusPill({ status, label, variant, className, testId }) {
4717
- const Badge2 = registry.Badge;
4718
- return /* @__PURE__ */ jsxRuntime.jsx(Badge2, { variant: variant ?? getStatusVariant(status), className, "data-testid": testId, children: label ?? status });
4719
- }
4720
- var RAG_LABELS = { red: "At risk", amber: "Attention", green: "On track" };
4721
- function configureRagLabels(labels) {
4722
- RAG_LABELS = { ...RAG_LABELS, ...labels };
4685
+ function RelevanceDot({ score }) {
4686
+ if (score == null) return null;
4687
+ const tier = TIERS.find((t) => score >= t.min) ?? TIERS[TIERS.length - 1];
4688
+ return /* @__PURE__ */ jsxRuntime.jsx(
4689
+ "span",
4690
+ {
4691
+ role: "img",
4692
+ "aria-label": tier.label,
4693
+ title: `${tier.label} (${score.toFixed(2)})`,
4694
+ className: chunkS6A6FSG7_cjs.cn("size-1.5 shrink-0 rounded-full", tier.tone),
4695
+ "data-testid": "passage-relevance"
4696
+ }
4697
+ );
4723
4698
  }
4724
- function RagDot({
4725
- rag,
4726
- withLabel,
4727
- className
4699
+ function PassageCard({
4700
+ header,
4701
+ score,
4702
+ headerRight,
4703
+ active,
4704
+ onClick,
4705
+ footer,
4706
+ className,
4707
+ children,
4708
+ "data-testid": testId
4728
4709
  }) {
4729
- const color = rag === "red" ? "bg-destructive" : rag === "amber" ? "bg-warning" : "bg-success";
4730
- return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: chunkS6A6FSG7_cjs.cn("inline-flex items-center gap-1.5", className), "data-testid": `rag-${rag}`, children: [
4731
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkS6A6FSG7_cjs.cn("size-2 rounded-full", color) }),
4732
- withLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: RAG_LABELS[rag] })
4710
+ const body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4711
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1.5 flex items-center gap-2", children: [
4712
+ header,
4713
+ (score != null || headerRight) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
4714
+ /* @__PURE__ */ jsxRuntime.jsx(RelevanceDot, { score }),
4715
+ headerRight
4716
+ ] })
4717
+ ] }),
4718
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "[&_mark]:rounded-sm [&_mark]:bg-ai-accent/20 [&_mark]:px-0.5 [&_mark]:font-medium [&_mark]:text-foreground", children })
4733
4719
  ] });
4734
- }
4735
-
4736
- // src/entities/colors.ts
4737
- var OPACITY_LIGHT = 0.15;
4738
- var OPACITY_MEDIUM = 1;
4739
- var OPACITY_BORDER = 0.3;
4740
- var PLACEHOLDER_COLOR = "#9ca3af";
4741
- var NEUTRAL_GRAY2 = "#64748b";
4742
- var BASE_COLORS2 = {
4743
- "0": "#10b981",
4744
- "1": "#3b82f6",
4745
- "2": "#8b5cf6",
4746
- "3": "#f43f5e",
4747
- "4": "#f59e0b",
4748
- "5": "#84cc16",
4749
- "6": "#a855f7",
4750
- "7": "#06b6d4",
4751
- "8": "#f97316",
4752
- "9": "#14b8a6",
4753
- a: "#ef4444",
4754
- b: "#6366f1",
4755
- c: "#ec4899",
4756
- d: "#22c55e",
4757
- e: "#eab308",
4758
- f: "#0ea5e9"
4759
- };
4760
- function hexToRgba(hex, opacity) {
4761
- const r = parseInt(hex.slice(1, 3), 16);
4762
- const g = parseInt(hex.slice(3, 5), 16);
4763
- const b = parseInt(hex.slice(5, 7), 16);
4764
- return `rgba(${r}, ${g}, ${b}, ${opacity})`;
4765
- }
4766
- function getEntityColor2(entityId, variant = "medium") {
4767
- const baseColor = BASE_COLORS2[entityId[4]] || BASE_COLORS2["0"];
4768
- switch (variant) {
4769
- case "light":
4770
- return hexToRgba(baseColor, OPACITY_LIGHT);
4771
- case "medium":
4772
- return hexToRgba(baseColor, OPACITY_MEDIUM);
4773
- case "text":
4774
- return baseColor;
4775
- }
4776
- }
4777
- function getEntityColorStyles(entityId) {
4778
- const baseColor = BASE_COLORS2[entityId[4]] || BASE_COLORS2["0"];
4779
- return {
4780
- backgroundColor: getEntityColor2(entityId, "light"),
4781
- color: baseColor,
4782
- borderColor: hexToRgba(baseColor, OPACITY_BORDER)
4783
- };
4784
- }
4785
- var getWorkspaceColor = (workspaceId, useWorkspaceColors) => {
4786
- const shouldUseWorkspaceColors = useWorkspaceColors !== void 0 ? useWorkspaceColors : true;
4787
- if (!shouldUseWorkspaceColors) return "hsl(var(--primary))";
4788
- const isValidId = workspaceId && workspaceId.startsWith("wrk-") && workspaceId.length >= 5;
4789
- if (!isValidId) return "hsl(var(--primary))";
4790
- return getEntityColor2(workspaceId, "medium");
4791
- };
4792
- var ShieldIcon = ({
4793
- char,
4794
- size = 24,
4795
- className = "",
4796
- workspaceColor,
4797
- isSelected = false,
4798
- ...props
4799
- }) => {
4800
- const fillColor = workspaceColor && workspaceColor !== "hsl(var(--primary))" ? workspaceColor : "transparent";
4801
- const strokeColor = isSelected ? "white" : workspaceColor && workspaceColor !== "hsl(var(--primary))" ? workspaceColor : "currentColor";
4802
4720
  return /* @__PURE__ */ jsxRuntime.jsxs(
4803
- "svg",
4721
+ "div",
4804
4722
  {
4805
- width: size,
4806
- height: size,
4807
- viewBox: "0 0 24 24",
4808
- fill: fillColor,
4809
- stroke: strokeColor,
4810
- strokeWidth: "2",
4811
- strokeLinecap: "round",
4812
- strokeLinejoin: "round",
4813
- className: `lucide lucide-square ${className}`,
4814
- ...props,
4723
+ className: chunkS6A6FSG7_cjs.cn(
4724
+ "group rounded-lg border border-border bg-card p-3 text-left transition-colors",
4725
+ onClick && "hover:border-ai-accent/40 focus-within:ring-2 focus-within:ring-ai-accent/40",
4726
+ active && "border-ai-accent/60 ring-1 ring-ai-accent/30",
4727
+ className
4728
+ ),
4815
4729
  children: [
4816
- /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
4817
- char && /* @__PURE__ */ jsxRuntime.jsx(
4818
- "text",
4730
+ onClick ? /* @__PURE__ */ jsxRuntime.jsx(
4731
+ "div",
4819
4732
  {
4820
- x: "12",
4821
- y: "12.5",
4822
- textAnchor: "middle",
4823
- fontSize: "9",
4824
- fontFamily: "sans-serif",
4825
- fontWeight: "300",
4826
- dominantBaseline: "middle",
4827
- stroke: workspaceColor ? "white" : "currentColor",
4828
- strokeWidth: "0.8",
4829
- children: char.toUpperCase()
4733
+ role: "button",
4734
+ tabIndex: 0,
4735
+ onClick,
4736
+ onKeyDown: (e) => {
4737
+ if (e.key === "Enter" || e.key === " ") {
4738
+ e.preventDefault();
4739
+ onClick(e);
4740
+ }
4741
+ },
4742
+ "aria-current": active || void 0,
4743
+ "data-testid": testId,
4744
+ className: "cursor-pointer focus:outline-none",
4745
+ children: body
4830
4746
  }
4831
- )
4747
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-current": active || void 0, "data-testid": testId, children: body }),
4748
+ footer
4832
4749
  ]
4833
4750
  }
4834
4751
  );
4835
- };
4836
-
4837
- // src/entities/agent-avatar-colors.ts
4838
- var BG_TO_COLOR = {
4839
- "bg-emerald-700": "#047857",
4840
- "bg-blue-700": "#1d4ed8",
4841
- "bg-purple-700": "#7e22ce",
4842
- "bg-amber-700": "#b45309",
4843
- "bg-rose-700": "#be123c",
4844
- "bg-red-700": "#b91c1c",
4845
- "bg-indigo-700": "#4338ca",
4846
- "bg-teal-700": "#0f766e",
4847
- "bg-cyan-700": "#0e7490",
4848
- "bg-sky-700": "#0369a1",
4849
- "bg-lime-700": "#4d7c0f",
4850
- "bg-orange-700": "#c2410c",
4851
- "bg-pink-700": "#be185d",
4852
- "bg-violet-700": "#6d28d9",
4853
- "bg-fuchsia-700": "#a21caf",
4854
- "bg-yellow-700": "#a16207"
4855
- };
4856
- function agentAvatarColors(bgColorClass) {
4857
- const color = BG_TO_COLOR[bgColorClass] || "#047857";
4858
- return { borderColor: color, color };
4859
- }
4860
-
4861
- // src/entities/media-type.ts
4862
- function getDottedExtension(fileName) {
4863
- if (!fileName) return "";
4864
- return fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
4865
4752
  }
4866
- var DOWNLOAD_ONLY_EXTENSIONS = /* @__PURE__ */ new Set([
4867
- ".zip",
4868
- ".rar",
4869
- ".7z",
4870
- ".tar",
4871
- ".gz",
4872
- ".exe",
4873
- ".bin",
4874
- ".dmg",
4875
- ".iso",
4876
- ".apk",
4877
- ".msi",
4878
- ".dll",
4879
- ".so",
4880
- ".psd",
4881
- ".ai",
4882
- ".sketch"
4883
- ]);
4884
- var IMAGE_EXTENSIONS4 = /* @__PURE__ */ new Set([
4885
- ".jpg",
4886
- ".jpeg",
4887
- ".png",
4888
- ".gif",
4889
- ".bmp",
4890
- ".tiff",
4891
- ".tif",
4892
- ".webp"
4753
+ var TextIcon = lucideReact.FileText;
4754
+ var IMAGE_EXTENSIONS4 = /* @__PURE__ */ new Set(["jpg", "jpeg", "png", "gif", "bmp", "tiff", "tif", "webp", "svg"]);
4755
+ var VIDEO_EXTENSIONS4 = /* @__PURE__ */ new Set(["mp4", "mpeg", "mpg", "webm", "mov", "avi", "mkv"]);
4756
+ var AUDIO_EXTENSIONS4 = /* @__PURE__ */ new Set(["mp3", "wav", "m4a", "aac", "ogg", "flac"]);
4757
+ var DOCX_EXTENSIONS2 = /* @__PURE__ */ new Set(["doc", "docx", "odt", "rtf"]);
4758
+ var XLSX_EXTENSIONS2 = /* @__PURE__ */ new Set(["xls", "xlsx", "csv", "ods"]);
4759
+ var EMAIL_EXTENSIONS3 = /* @__PURE__ */ new Set(["eml", "msg"]);
4760
+ var HTML_EXTENSIONS2 = /* @__PURE__ */ new Set(["html", "htm", "mhtml"]);
4761
+ var PDF_EXTENSIONS = /* @__PURE__ */ new Set(["pdf"]);
4762
+ var TEXT_EXTENSIONS2 = /* @__PURE__ */ new Set([
4763
+ "txt",
4764
+ "text",
4765
+ "md",
4766
+ "markdown",
4767
+ "log",
4768
+ "json",
4769
+ "xml",
4770
+ "yaml",
4771
+ "yml"
4893
4772
  ]);
4894
- var VIDEO_EXTENSIONS4 = /* @__PURE__ */ new Set([".mp4", ".mpeg", ".mpg", ".webm", ".mov", ".avi", ".mkv"]);
4895
- var AUDIO_EXTENSIONS4 = /* @__PURE__ */ new Set([".mp3", ".wav", ".m4a", ".aac", ".ogg", ".flac"]);
4896
- function isImageFile(fileName) {
4897
- return IMAGE_EXTENSIONS4.has(getDottedExtension(fileName));
4898
- }
4899
- function isVideoFile(fileName) {
4900
- return VIDEO_EXTENSIONS4.has(getDottedExtension(fileName));
4901
- }
4902
- function isAudioFile(fileName) {
4903
- return AUDIO_EXTENSIONS4.has(getDottedExtension(fileName));
4904
- }
4905
- function isMediaFile(fileName) {
4906
- return isImageFile(fileName) || isVideoFile(fileName) || isAudioFile(fileName);
4907
- }
4908
- function usesOriginalBytesForViewer(fileName) {
4909
- return isMediaFile(fileName);
4910
- }
4911
- function isDownloadOnlyFile(fileName) {
4912
- return DOWNLOAD_ONLY_EXTENSIONS.has(getDottedExtension(fileName));
4773
+ function getFileExtension(fileName) {
4774
+ if (!fileName) return "";
4775
+ const dot = fileName.lastIndexOf(".");
4776
+ if (dot <= 0 || dot === fileName.length - 1) return "";
4777
+ return fileName.slice(dot + 1).toLowerCase();
4913
4778
  }
4914
-
4915
- // src/entities/file-type.ts
4916
- var EXT_LABELS = {
4917
- pdf: "PDF",
4918
- // Word / docs
4919
- doc: "Word",
4920
- docx: "Word",
4921
- rtf: "Word",
4922
- odt: "Word",
4923
- // Spreadsheets
4924
- xls: "Excel",
4925
- xlsx: "Excel",
4926
- ods: "Excel",
4927
- csv: "CSV",
4928
- tsv: "CSV",
4929
- // Slides
4930
- ppt: "PowerPoint",
4931
- pptx: "PowerPoint",
4932
- odp: "PowerPoint",
4933
- // Plain text / markup
4934
- txt: "Text",
4935
- log: "Text",
4936
- md: "Markdown",
4937
- markdown: "Markdown",
4938
- html: "HTML",
4939
- htm: "HTML",
4940
- xml: "XML",
4941
- json: "JSON",
4942
- yaml: "YAML",
4943
- yml: "YAML",
4944
- // Email
4945
- eml: "Email",
4946
- msg: "Email",
4947
- mbox: "Email",
4948
- pst: "Outlook",
4949
- ost: "Outlook",
4950
- // Images
4951
- jpg: "Image",
4952
- jpeg: "Image",
4953
- png: "Image",
4954
- gif: "Image",
4955
- bmp: "Image",
4956
- tif: "Image",
4957
- tiff: "Image",
4958
- webp: "Image",
4959
- svg: "Image",
4960
- heic: "Image",
4961
- heif: "Image",
4962
- // Audio
4963
- mp3: "Audio",
4964
- wav: "Audio",
4965
- m4a: "Audio",
4966
- aac: "Audio",
4967
- ogg: "Audio",
4968
- flac: "Audio",
4969
- opus: "Audio",
4970
- // Video
4971
- mp4: "Video",
4972
- webm: "Video",
4973
- mov: "Video",
4974
- avi: "Video",
4975
- mkv: "Video",
4976
- // Archives
4977
- zip: "Archive",
4978
- tar: "Archive",
4979
- gz: "Archive",
4980
- rar: "Archive",
4981
- "7z": "Archive"
4982
- };
4983
- var MIME_SUBTYPE_LABELS = {
4984
- // PDF
4985
- pdf: "PDF",
4986
- "x-pdf": "PDF",
4987
- // Word
4988
- msword: "Word",
4989
- "vnd.openxmlformats-officedocument.wordprocessingml.document": "Word",
4990
- "vnd.oasis.opendocument.text": "Word",
4991
- rtf: "Word",
4992
- // Excel
4993
- "vnd.ms-excel": "Excel",
4994
- "vnd.openxmlformats-officedocument.spreadsheetml.sheet": "Excel",
4995
- "vnd.oasis.opendocument.spreadsheet": "Excel",
4996
- csv: "CSV",
4997
- "tab-separated-values": "CSV",
4998
- // PowerPoint
4999
- "vnd.ms-powerpoint": "PowerPoint",
5000
- "vnd.openxmlformats-officedocument.presentationml.presentation": "PowerPoint",
5001
- "vnd.oasis.opendocument.presentation": "PowerPoint",
5002
- // Plain text / markup
5003
- plain: "Text",
5004
- html: "HTML",
5005
- xml: "XML",
5006
- json: "JSON",
5007
- markdown: "Markdown",
5008
- "x-markdown": "Markdown",
5009
- yaml: "YAML",
5010
- "x-yaml": "YAML",
5011
- // Email
5012
- rfc822: "Email",
5013
- "vnd.ms-outlook": "Email",
5014
- // Archives
5015
- zip: "Archive",
5016
- "x-zip-compressed": "Archive",
5017
- "x-tar": "Archive",
5018
- gzip: "Archive",
5019
- "x-7z-compressed": "Archive",
5020
- "x-rar-compressed": "Archive"
5021
- };
5022
- var MIME_TYPE_LABELS = {
5023
- image: "Image",
5024
- audio: "Audio",
5025
- video: "Video",
5026
- text: "Text"
4779
+ var MIME_TO_EXTENSION = {
4780
+ "application/pdf": "pdf",
4781
+ "text/plain": "txt",
4782
+ "text/markdown": "md",
4783
+ "text/html": "html",
4784
+ "text/csv": "csv",
4785
+ "application/json": "json",
4786
+ "application/xml": "xml",
4787
+ "application/msword": "doc",
4788
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
4789
+ "application/rtf": "rtf",
4790
+ "application/vnd.oasis.opendocument.text": "odt",
4791
+ "application/vnd.ms-excel": "xls",
4792
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
4793
+ "application/vnd.oasis.opendocument.spreadsheet": "ods",
4794
+ "image/png": "png",
4795
+ "image/jpeg": "jpg",
4796
+ "image/gif": "gif",
4797
+ "image/webp": "webp",
4798
+ "image/svg+xml": "svg",
4799
+ "image/tiff": "tiff",
4800
+ "image/bmp": "bmp",
4801
+ "video/mp4": "mp4",
4802
+ "video/webm": "webm",
4803
+ "video/quicktime": "mov",
4804
+ "audio/mpeg": "mp3",
4805
+ "audio/wav": "wav",
4806
+ "audio/ogg": "ogg",
4807
+ "message/rfc822": "eml"
5027
4808
  };
5028
- function lookupExt(ext) {
5029
- return EXT_LABELS[ext.toLowerCase().replace(/^\./, "")];
4809
+ function extensionFromMime(mime) {
4810
+ if (!mime) return "";
4811
+ return MIME_TO_EXTENSION[mime.toLowerCase()] ?? "";
5030
4812
  }
5031
- function lookupMime(mime) {
5032
- const base = mime.toLowerCase().split(";")[0].trim();
5033
- const slash = base.indexOf("/");
5034
- if (slash <= 0) return void 0;
5035
- const top = base.slice(0, slash);
5036
- const sub = base.slice(slash + 1);
5037
- return MIME_SUBTYPE_LABELS[sub] ?? MIME_TYPE_LABELS[top];
4813
+ function iconFromExtension(ext) {
4814
+ if (VIDEO_EXTENSIONS4.has(ext)) return VidIcon;
4815
+ if (AUDIO_EXTENSIONS4.has(ext)) return AudIcon;
4816
+ if (IMAGE_EXTENSIONS4.has(ext)) return ImgIcon;
4817
+ if (DOCX_EXTENSIONS2.has(ext)) return DocIcon;
4818
+ if (XLSX_EXTENSIONS2.has(ext)) return XlsIcon;
4819
+ if (EMAIL_EXTENSIONS3.has(ext)) return EmlIcon;
4820
+ if (HTML_EXTENSIONS2.has(ext)) return HtmlIcon;
4821
+ if (PDF_EXTENSIONS.has(ext)) return PdfIcon;
4822
+ if (TEXT_EXTENSIONS2.has(ext)) return TextIcon;
4823
+ return null;
5038
4824
  }
5039
- function extFromFileName(fileName) {
5040
- if (!fileName) return void 0;
5041
- const dot = fileName.lastIndexOf(".");
5042
- if (dot <= 0 || dot === fileName.length - 1) return void 0;
5043
- return fileName.slice(dot + 1);
4825
+ function iconFromMime(mime) {
4826
+ const m = mime.toLowerCase();
4827
+ if (m.startsWith("image/")) return ImgIcon;
4828
+ if (m.startsWith("video/")) return VidIcon;
4829
+ if (m.startsWith("audio/")) return AudIcon;
4830
+ if (m === "application/pdf") return PdfIcon;
4831
+ if (m === "text/html") return HtmlIcon;
4832
+ if (m === "message/rfc822" || m.includes("outlook")) return EmlIcon;
4833
+ if (m.includes("word") || m === "application/rtf" || m.includes("opendocument.text"))
4834
+ return DocIcon;
4835
+ if (m.includes("sheet") || m.includes("excel") || m === "text/csv" || m.includes("opendocument.spreadsheet"))
4836
+ return XlsIcon;
4837
+ if (m.startsWith("text/") || m === "application/json" || m === "application/xml") return TextIcon;
4838
+ return null;
5044
4839
  }
5045
- function friendlyFileType(fileType, fileName) {
5046
- if (fileType) {
5047
- const trimmed = fileType.trim();
5048
- if (trimmed.includes("/")) {
5049
- const fromMime = lookupMime(trimmed);
5050
- if (fromMime) return fromMime;
5051
- } else {
5052
- const fromExt = lookupExt(trimmed);
5053
- if (fromExt) return fromExt;
4840
+ function getFileTypeIcon(fileName, opts) {
4841
+ return iconFromExtension(getFileExtension(fileName)) ?? (opts?.mime ? iconFromMime(opts.mime) : null) ?? (opts?.defaultToPdf ? PdfIcon : TextIcon);
4842
+ }
4843
+ var GoogleIcon = ({
4844
+ size = 20,
4845
+ className = "",
4846
+ "aria-label": ariaLabel,
4847
+ "aria-hidden": ariaHidden = true
4848
+ }) => {
4849
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4850
+ "svg",
4851
+ {
4852
+ className,
4853
+ width: size,
4854
+ height: size,
4855
+ viewBox: "0 0 24 24",
4856
+ "aria-label": ariaLabel,
4857
+ "aria-hidden": ariaHidden,
4858
+ children: [
4859
+ /* @__PURE__ */ jsxRuntime.jsx(
4860
+ "path",
4861
+ {
4862
+ fill: "#4285F4",
4863
+ d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
4864
+ }
4865
+ ),
4866
+ /* @__PURE__ */ jsxRuntime.jsx(
4867
+ "path",
4868
+ {
4869
+ fill: "#34A853",
4870
+ d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
4871
+ }
4872
+ ),
4873
+ /* @__PURE__ */ jsxRuntime.jsx(
4874
+ "path",
4875
+ {
4876
+ fill: "#FBBC05",
4877
+ d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
4878
+ }
4879
+ ),
4880
+ /* @__PURE__ */ jsxRuntime.jsx(
4881
+ "path",
4882
+ {
4883
+ fill: "#EA4335",
4884
+ d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
4885
+ }
4886
+ )
4887
+ ]
5054
4888
  }
4889
+ );
4890
+ };
4891
+ var OpenAIIcon = ({
4892
+ size = 16,
4893
+ className = "",
4894
+ "aria-label": ariaLabel = "OpenAI",
4895
+ "aria-hidden": ariaHidden = true
4896
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
4897
+ "svg",
4898
+ {
4899
+ className,
4900
+ width: size,
4901
+ height: size,
4902
+ viewBox: "0 0 24 24",
4903
+ "aria-label": ariaLabel,
4904
+ "aria-hidden": ariaHidden,
4905
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4906
+ "path",
4907
+ {
4908
+ fill: "#10A37F",
4909
+ d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"
4910
+ }
4911
+ )
5055
4912
  }
5056
- const fnExt = extFromFileName(fileName);
5057
- if (fnExt) {
5058
- const fromExt = lookupExt(fnExt);
5059
- if (fromExt) return fromExt;
4913
+ );
4914
+ var ClaudeIcon = ({
4915
+ size = 16,
4916
+ className = "",
4917
+ "aria-label": ariaLabel = "Claude",
4918
+ "aria-hidden": ariaHidden = true
4919
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
4920
+ "svg",
4921
+ {
4922
+ className,
4923
+ width: size,
4924
+ height: size,
4925
+ viewBox: "0 0 24 24",
4926
+ "aria-label": ariaLabel,
4927
+ "aria-hidden": ariaHidden,
4928
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4929
+ "path",
4930
+ {
4931
+ fill: "#D97757",
4932
+ d: "m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"
4933
+ }
4934
+ )
5060
4935
  }
5061
- return "Other";
4936
+ );
4937
+ var GeminiIcon = ({
4938
+ size = 16,
4939
+ className = "",
4940
+ "aria-label": ariaLabel = "Gemini",
4941
+ "aria-hidden": ariaHidden = true
4942
+ }) => /* @__PURE__ */ jsxRuntime.jsxs(
4943
+ "svg",
4944
+ {
4945
+ className,
4946
+ width: size,
4947
+ height: size,
4948
+ viewBox: "0 0 24 24",
4949
+ "aria-label": ariaLabel,
4950
+ "aria-hidden": ariaHidden,
4951
+ children: [
4952
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: "geminiGradient", x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
4953
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: "#1BA1E3" }),
4954
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "25%", stopColor: "#5489D6" }),
4955
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "50%", stopColor: "#9B72CB" }),
4956
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "75%", stopColor: "#D96570" }),
4957
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: "#F49C46" })
4958
+ ] }) }),
4959
+ /* @__PURE__ */ jsxRuntime.jsx(
4960
+ "path",
4961
+ {
4962
+ fill: "url(#geminiGradient)",
4963
+ d: "M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"
4964
+ }
4965
+ )
4966
+ ]
4967
+ }
4968
+ );
4969
+ var FireworksIcon = ({
4970
+ size = 16,
4971
+ className = "",
4972
+ "aria-label": ariaLabel = "Fireworks AI",
4973
+ "aria-hidden": ariaHidden = true
4974
+ }) => /* @__PURE__ */ jsxRuntime.jsxs(
4975
+ "svg",
4976
+ {
4977
+ className,
4978
+ width: size,
4979
+ height: size,
4980
+ viewBox: "-2 6 36 20",
4981
+ preserveAspectRatio: "xMidYMid meet",
4982
+ fill: "none",
4983
+ style: { minWidth: size, minHeight: size },
4984
+ "aria-label": ariaLabel,
4985
+ "aria-hidden": ariaHidden,
4986
+ children: [
4987
+ /* @__PURE__ */ jsxRuntime.jsx(
4988
+ "path",
4989
+ {
4990
+ fill: "#6720FF",
4991
+ d: "M15.9851 19.1274C15.0969 19.1274 14.2999 18.6001 13.96 17.7838L9.86258 8H12.2608L15.9991 16.9499L19.7339 8H22.1321L18.0102 17.7873C17.6686 18.6001 16.8733 19.1274 15.9851 19.1274Z"
4992
+ }
4993
+ ),
4994
+ /* @__PURE__ */ jsxRuntime.jsx(
4995
+ "path",
4996
+ {
4997
+ fill: "#6720FF",
4998
+ d: "M21.3316 23.8029C20.4469 23.8029 19.6533 23.2792 19.31 22.4698C18.9649 21.6535 19.1436 20.7215 19.7672 20.0891L27.2299 12.5302L28.1618 14.7287L21.3298 21.636L31.068 21.5817L32 23.7802L21.3333 23.8065L21.3298 23.8029H21.3316Z"
4999
+ }
5000
+ ),
5001
+ /* @__PURE__ */ jsxRuntime.jsx(
5002
+ "path",
5003
+ {
5004
+ fill: "#6720FF",
5005
+ d: "M0 23.7766L0.931955 21.5781L10.6702 21.6324L3.83993 14.7234L4.77189 12.5249L12.2345 20.0838C12.8582 20.7145 13.0386 21.65 12.6918 22.4645C12.3484 23.2756 11.5513 23.7977 10.6702 23.7977L0.00350359 23.7731L0 23.7766Z"
5006
+ }
5007
+ )
5008
+ ]
5009
+ }
5010
+ );
5011
+ function ProviderIcon({
5012
+ modelName,
5013
+ provider,
5014
+ size = 16,
5015
+ className = ""
5016
+ }) {
5017
+ const m = (modelName ?? "").toLowerCase();
5018
+ const p = (provider ?? "").toLowerCase();
5019
+ if (m.includes("gpt") || p === "openai") {
5020
+ return /* @__PURE__ */ jsxRuntime.jsx(OpenAIIcon, { size, className });
5021
+ }
5022
+ if (m.includes("claude") || p === "anthropic") {
5023
+ return /* @__PURE__ */ jsxRuntime.jsx(ClaudeIcon, { size, className });
5024
+ }
5025
+ if (m.includes("gemini") || p.startsWith("vertex_ai")) {
5026
+ return /* @__PURE__ */ jsxRuntime.jsx(GeminiIcon, { size, className });
5027
+ }
5028
+ if (p === "google") {
5029
+ return /* @__PURE__ */ jsxRuntime.jsx(GoogleIcon, { size, className });
5030
+ }
5031
+ if (p === "fireworks_ai") {
5032
+ return /* @__PURE__ */ jsxRuntime.jsx(FireworksIcon, { size, className });
5033
+ }
5034
+ return /* @__PURE__ */ jsxRuntime.jsx(
5035
+ lucideReact.Crown,
5036
+ {
5037
+ className,
5038
+ style: { width: size, height: size, color: "#EAB308", fill: "#EAB308" }
5039
+ }
5040
+ );
5062
5041
  }
5042
+
5043
+ // src/icons/arbi-mark.ts
5044
+ var ARBI_MARK_SRC = "data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20xmlns:xlink=%22http://www.w3.org/1999/xlink%22%20width=%22500%22%20zoomAndPan=%22magnify%22%20viewBox=%220%200%20375%20374.999991%22%20height=%22500%22%20preserveAspectRatio=%22xMidYMid%20meet%22%20version=%221.0%22%3E%3Cdefs%3E%3Cg/%3E%3CclipPath%20id=%22413a615d81%22%3E%3Cpath%20d=%22M%20187.5%200%20C%2083.945312%200%200%2083.945312%200%20187.5%20C%200%20291.054688%2083.945312%20375%20187.5%20375%20C%20291.054688%20375%20375%20291.054688%20375%20187.5%20C%20375%2083.945312%20291.054688%200%20187.5%200%20Z%20M%20187.5%200%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22b4114fb668%22%3E%3Cpath%20d=%22M%200%200%20L%20375%200%20L%20375%20375%20L%200%20375%20Z%20M%200%200%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2202d2f74560%22%3E%3Cpath%20d=%22M%20187.5%200%20C%2083.945312%200%200%2083.945312%200%20187.5%20C%200%20291.054688%2083.945312%20375%20187.5%20375%20C%20291.054688%20375%20375%20291.054688%20375%20187.5%20C%20375%2083.945312%20291.054688%200%20187.5%200%20Z%20M%20187.5%200%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2266f7fee432%22%3E%3Crect%20x=%220%22%20width=%22375%22%20y=%220%22%20height=%22375%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2244a7358375%22%3E%3Cpath%20d=%22M%2066.527344%2066.527344%20L%20308.472656%2066.527344%20L%20308.472656%20308.472656%20L%2066.527344%20308.472656%20Z%20M%2066.527344%2066.527344%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2206d1da3b78%22%3E%3Cpath%20d=%22M%20187.5%2066.527344%20C%20120.6875%2066.527344%2066.527344%20120.6875%2066.527344%20187.5%20C%2066.527344%20254.3125%20120.6875%20308.472656%20187.5%20308.472656%20C%20254.3125%20308.472656%20308.472656%20254.3125%20308.472656%20187.5%20C%20308.472656%20120.6875%20254.3125%2066.527344%20187.5%2066.527344%20Z%20M%20187.5%2066.527344%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%225f19be2713%22%3E%3Cpath%20d=%22M%200.527344%200.527344%20L%20242.472656%200.527344%20L%20242.472656%20242.472656%20L%200.527344%20242.472656%20Z%20M%200.527344%200.527344%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22fde3ba0cc4%22%3E%3Cpath%20d=%22M%20121.5%200.527344%20C%2054.6875%200.527344%200.527344%2054.6875%200.527344%20121.5%20C%200.527344%20188.3125%2054.6875%20242.472656%20121.5%20242.472656%20C%20188.3125%20242.472656%20242.472656%20188.3125%20242.472656%20121.5%20C%20242.472656%2054.6875%20188.3125%200.527344%20121.5%200.527344%20Z%20M%20121.5%200.527344%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2267bf874d33%22%3E%3Crect%20x=%220%22%20width=%22243%22%20y=%220%22%20height=%22243%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2205f2bd6677%22%3E%3Cpath%20d=%22M%200%2098.171875%20L%20375%2098.171875%20L%20375%20375%20L%200%20375%20Z%20M%200%2098.171875%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22a5274c9106%22%3E%3Cpath%20d=%22M%20187.5%2098.171875%20L%20404.023438%20508.144531%20L%20-29.023438%20508.144531%20Z%20M%20187.5%2098.171875%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%220f4217ffe3%22%3E%3Cpath%20d=%22M%200%200.171875%20L%20375%200.171875%20L%20375%20277%20L%200%20277%20Z%20M%200%200.171875%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22ca1f5799a3%22%3E%3Cpath%20d=%22M%20187.5%200.171875%20L%20404.023438%20410.144531%20L%20-29.023438%20410.144531%20Z%20M%20187.5%200.171875%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%228bb016993a%22%3E%3Crect%20x=%220%22%20width=%22375%22%20y=%220%22%20height=%22277%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2276af0040d9%22%3E%3Cpath%20d=%22M%200%20195.949219%20L%20375%20195.949219%20L%20375%20375%20L%200%20375%20Z%20M%200%20195.949219%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%221062f89594%22%3E%3Cpath%20d=%22M%200%200.949219%20L%20375%200.949219%20L%20375%20180%20L%200%20180%20Z%20M%200%200.949219%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%2217bc809498%22%3E%3Crect%20x=%220%22%20width=%22375%22%20y=%220%22%20height=%22180%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22ad524f887e%22%3E%3Cpath%20d=%22M%202%2094%20L%20293%2094%20L%20293%20342%20L%202%20342%20Z%20M%202%2094%20%22%20clip-rule=%22nonzero%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22ac73806eb1%22%3E%3Crect%20x=%220%22%20width=%22294%22%20y=%220%22%20height=%22342%22/%3E%3C/clipPath%3E%3C/defs%3E%3Crect%20x=%22-37.5%22%20width=%22450%22%20fill=%22%23ffffff%22%20y=%22-37.499999%22%20height=%22449.999989%22%20fill-opacity=%221%22/%3E%3Crect%20x=%22-37.5%22%20width=%22450%22%20fill=%22%23ffffff%22%20y=%22-37.499999%22%20height=%22449.999989%22%20fill-opacity=%221%22/%3E%3Cg%20clip-path=%22url(%23413a615d81)%22%3E%3Cg%20transform=%22matrix(1,%200,%200,%201,%200,%200)%22%3E%3Cg%20clip-path=%22url(%2366f7fee432)%22%3E%3Cg%20clip-path=%22url(%23b4114fb668)%22%3E%3Cg%20clip-path=%22url(%2302d2f74560)%22%3E%3Crect%20x=%22-82.5%22%20width=%22540%22%20fill=%22%2301adef%22%20height=%22539.999987%22%20y=%22-82.499998%22%20fill-opacity=%221%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%20clip-path=%22url(%2344a7358375)%22%3E%3Cg%20clip-path=%22url(%2306d1da3b78)%22%3E%3Cg%20transform=%22matrix(1,%200,%200,%201,%2066,%2066)%22%3E%3Cg%20clip-path=%22url(%2367bf874d33)%22%3E%3Cg%20clip-path=%22url(%235f19be2713)%22%3E%3Cg%20clip-path=%22url(%23fde3ba0cc4)%22%3E%3Cpath%20fill=%22%23ffffff%22%20d=%22M%200.527344%200.527344%20L%20242.472656%200.527344%20L%20242.472656%20242.472656%20L%200.527344%20242.472656%20Z%20M%200.527344%200.527344%20%22%20fill-opacity=%221%22%20fill-rule=%22nonzero%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%20clip-path=%22url(%2305f2bd6677)%22%3E%3Cg%20clip-path=%22url(%23a5274c9106)%22%3E%3Cg%20transform=%22matrix(1,%200,%200,%201,%200,%2098)%22%3E%3Cg%20clip-path=%22url(%238bb016993a)%22%3E%3Cg%20clip-path=%22url(%230f4217ffe3)%22%3E%3Cg%20clip-path=%22url(%23ca1f5799a3)%22%3E%3Cpath%20fill=%22%23ffffff%22%20d=%22M%20-29.023438%200.171875%20L%20403.371094%200.171875%20L%20403.371094%20410.144531%20L%20-29.023438%20410.144531%20Z%20M%20-29.023438%200.171875%20%22%20fill-opacity=%221%22%20fill-rule=%22nonzero%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%20clip-path=%22url(%2376af0040d9)%22%3E%3Cg%20transform=%22matrix(1,%200,%200,%201,%200,%20195)%22%3E%3Cg%20clip-path=%22url(%2317bc809498)%22%3E%3Cg%20clip-path=%22url(%231062f89594)%22%3E%3Cpath%20fill=%22%23ffffff%22%20d=%22M%20-62.902344%200.949219%20L%20438.316406%200.949219%20L%20438.316406%20313.144531%20L%20-62.902344%20313.144531%20Z%20M%20-62.902344%200.949219%20%22%20fill-opacity=%221%22%20fill-rule=%22nonzero%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%20transform=%22matrix(1,%200,%200,%201,%2040,%2033)%22%3E%3Cg%20clip-path=%22url(%23ac73806eb1)%22%3E%3Cg%20clip-path=%22url(%23ad524f887e)%22%3E%3Cg%20fill=%22%23202b61%22%20fill-opacity=%221%22%3E%3Cg%20transform=%22translate(7.369923,%20344.002374)%22%3E%3Cg%3E%3Cpath%20d=%22M%20192.15625%20-48.484375%20L%2086.640625%20-48.484375%20L%2067.03125%200%20L%20-4.984375%200%20L%20105.171875%20-249.5625%20L%20174.6875%20-249.5625%20L%20285.21875%200%20L%20211.765625%200%20Z%20M%20171.484375%20-100.53125%20L%20139.390625%20-180.390625%20L%20107.3125%20-100.53125%20Z%20M%20171.484375%20-100.53125%20%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cpath%20stroke-linecap=%22butt%22%20transform=%22matrix(0.75,%200,%200,%200.75,%200.0000045,%20209.710181)%22%20fill=%22none%22%20stroke-linejoin=%22miter%22%20d=%22M%20-0.000006%2010.001009%20L%2088.703125%2010.001009%20%22%20stroke=%22%23202b61%22%20stroke-width=%2220%22%20stroke-opacity=%221%22%20stroke-miterlimit=%224%22/%3E%3Cpath%20stroke-linecap=%22butt%22%20transform=%22matrix(0.75,%200,%200,%200.75,%20308.473813,%20209.710181)%22%20fill=%22none%22%20stroke-linejoin=%22miter%22%20d=%22M%20-0.00154239%2010.001009%20L%2088.701588%2010.001009%20%22%20stroke=%22%23202b61%22%20stroke-width=%2220%22%20stroke-opacity=%221%22%20stroke-miterlimit=%224%22/%3E%3C/svg%3E";
5045
+ var ArbiIcon = ({
5046
+ size = 20,
5047
+ className = "",
5048
+ "aria-label": ariaLabel = "ARBI Docs",
5049
+ "aria-hidden": ariaHidden = false
5050
+ }) => {
5051
+ return /* @__PURE__ */ jsxRuntime.jsx(
5052
+ "img",
5053
+ {
5054
+ src: ARBI_MARK_SRC,
5055
+ alt: ariaLabel,
5056
+ className: `rounded object-contain ${className}`,
5057
+ style: { width: size, height: size },
5058
+ "aria-label": ariaLabel,
5059
+ "aria-hidden": ariaHidden
5060
+ }
5061
+ );
5062
+ };
5063
5063
  function nameInitials(name) {
5064
5064
  const parts = name.trim().split(/\s+/).filter(Boolean);
5065
5065
  if (!parts.length) return "?";
@@ -5405,5 +5405,5 @@ exports.toggleVariants = toggleVariants;
5405
5405
  exports.useAudioRecorder = useAudioRecorder;
5406
5406
  exports.useDictateContext = useDictateContext;
5407
5407
  exports.usesOriginalBytesForViewer = usesOriginalBytesForViewer;
5408
- //# sourceMappingURL=chunk-YMAZYYD5.cjs.map
5409
- //# sourceMappingURL=chunk-YMAZYYD5.cjs.map
5408
+ //# sourceMappingURL=chunk-FSPLYO52.cjs.map
5409
+ //# sourceMappingURL=chunk-FSPLYO52.cjs.map