@nswds/app 4.0.4 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -60,14 +60,6 @@ var ProgressPrimitive = require('@radix-ui/react-progress');
60
60
  var tailwindVariants = require('tailwind-variants');
61
61
  var ResizablePrimitive = require('react-resizable-panels');
62
62
  var SliderPrimitive = require('@radix-ui/react-slider');
63
- var reactUseControllableState = require('@radix-ui/react-use-controllable-state');
64
- var reactSyntaxHighlighter = require('react-syntax-highlighter');
65
- var oneDark = require('react-syntax-highlighter/dist/esm/styles/prism/one-dark');
66
- var oneLight = require('react-syntax-highlighter/dist/esm/styles/prism/one-light');
67
- var tokenlens = require('tokenlens');
68
- var useStickToBottom = require('use-stick-to-bottom');
69
- var nanoid = require('nanoid');
70
- var streamdown = require('streamdown');
71
63
  var slugify = require('@sindresorhus/slugify');
72
64
  var zustand = require('zustand');
73
65
  var middleware = require('zustand/middleware');
@@ -126,8 +118,6 @@ var NavigationMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(Navigati
126
118
  var ProgressPrimitive__namespace = /*#__PURE__*/_interopNamespace(ProgressPrimitive);
127
119
  var ResizablePrimitive__namespace = /*#__PURE__*/_interopNamespace(ResizablePrimitive);
128
120
  var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespace(SliderPrimitive);
129
- var oneDark__default = /*#__PURE__*/_interopDefault(oneDark);
130
- var oneLight__default = /*#__PURE__*/_interopDefault(oneLight);
131
121
 
132
122
  // src/components/Accordion.tsx
133
123
  var Icons = {
@@ -14492,7 +14482,7 @@ function FormatToggle({ format, setFormat }) {
14492
14482
 
14493
14483
  // package.json
14494
14484
  var package_default = {
14495
- version: "4.0.4"};
14485
+ version: "5.0.0"};
14496
14486
  var SluggerContext = React5__namespace.default.createContext(null);
14497
14487
  function flattenText(nodes) {
14498
14488
  if (nodes == null || typeof nodes === "boolean") return "";
@@ -20604,2480 +20594,6 @@ var Tracker = React5__namespace.default.forwardRef(
20604
20594
  }
20605
20595
  );
20606
20596
  Tracker.displayName = "Tracker";
20607
- var buttonVariants5 = classVarianceAuthority.cva(
20608
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
20609
- {
20610
- variants: {
20611
- variant: {
20612
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
20613
- destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
20614
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
20615
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
20616
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
20617
- link: "text-primary underline-offset-4 hover:underline"
20618
- },
20619
- size: {
20620
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
20621
- sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
20622
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
20623
- icon: "size-9"
20624
- }
20625
- },
20626
- defaultVariants: {
20627
- variant: "default",
20628
- size: "default"
20629
- }
20630
- }
20631
- );
20632
- function Button7({
20633
- className,
20634
- variant,
20635
- size,
20636
- asChild = false,
20637
- ...props
20638
- }) {
20639
- const Comp = asChild ? reactSlot.Slot : "button";
20640
- return /* @__PURE__ */ jsxRuntime.jsx(
20641
- Comp,
20642
- {
20643
- "data-slot": "button",
20644
- className: cn(buttonVariants5({ variant, size, className })),
20645
- ...props
20646
- }
20647
- );
20648
- }
20649
- function TooltipProvider2({
20650
- delayDuration = 0,
20651
- ...props
20652
- }) {
20653
- return /* @__PURE__ */ jsxRuntime.jsx(
20654
- TooltipPrimitives__namespace.Provider,
20655
- {
20656
- "data-slot": "tooltip-provider",
20657
- delayDuration,
20658
- ...props
20659
- }
20660
- );
20661
- }
20662
- function Tooltip9({ ...props }) {
20663
- return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider2, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitives__namespace.Root, { "data-slot": "tooltip", ...props }) });
20664
- }
20665
- function TooltipTrigger2({ ...props }) {
20666
- return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitives__namespace.Trigger, { "data-slot": "tooltip-trigger", ...props });
20667
- }
20668
- function TooltipContent2({
20669
- className,
20670
- sideOffset = 0,
20671
- children,
20672
- ...props
20673
- }) {
20674
- return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitives__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
20675
- TooltipPrimitives__namespace.Content,
20676
- {
20677
- "data-slot": "tooltip-content",
20678
- sideOffset,
20679
- className: cn(
20680
- "z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md bg-primary px-3 py-1.5 text-xs text-balance text-primary-foreground animate-in fade-in-0 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 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
20681
- className
20682
- ),
20683
- ...props,
20684
- children: [
20685
- children,
20686
- /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitives__namespace.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-primary fill-primary" })
20687
- ]
20688
- }
20689
- ) });
20690
- }
20691
- var Actions = ({ className, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center gap-1", className), ...props, children });
20692
- var Action2 = ({
20693
- tooltip,
20694
- children,
20695
- label,
20696
- className,
20697
- variant = "ghost",
20698
- size = "sm",
20699
- ...props
20700
- }) => {
20701
- const button = /* @__PURE__ */ jsxRuntime.jsxs(
20702
- Button7,
20703
- {
20704
- className: cn("relative size-9 p-1.5 text-muted-foreground hover:text-foreground", className),
20705
- size,
20706
- type: "button",
20707
- variant,
20708
- ...props,
20709
- children: [
20710
- children,
20711
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: label || tooltip })
20712
- ]
20713
- }
20714
- );
20715
- if (tooltip) {
20716
- return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider2, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip9, { children: [
20717
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger2, { asChild: true, children: button }),
20718
- /* @__PURE__ */ jsxRuntime.jsx(TooltipContent2, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: tooltip }) })
20719
- ] }) });
20720
- }
20721
- return button;
20722
- };
20723
- var Artifact = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
20724
- "div",
20725
- {
20726
- className: cn(
20727
- "flex flex-col overflow-hidden rounded-sm border bg-background shadow-sm",
20728
- className
20729
- ),
20730
- ...props
20731
- }
20732
- );
20733
- var ArtifactHeader = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
20734
- "div",
20735
- {
20736
- className: cn("flex items-center justify-between border-b bg-muted/50 px-4 py-3", className),
20737
- ...props
20738
- }
20739
- );
20740
- var ArtifactTitle = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("text-sm font-medium text-foreground", className), ...props });
20741
- var ArtifactDescription = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("text-sm text-muted-foreground", className), ...props });
20742
- var ArtifactActions = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center gap-1", className), ...props });
20743
- var ArtifactAction = ({
20744
- tooltip,
20745
- label,
20746
- icon: Icon2,
20747
- children,
20748
- className,
20749
- size = "sm",
20750
- variant = "ghost",
20751
- ...props
20752
- }) => {
20753
- const button = /* @__PURE__ */ jsxRuntime.jsxs(
20754
- Button7,
20755
- {
20756
- className: cn("size-8 p-0 text-muted-foreground hover:text-foreground", className),
20757
- size,
20758
- type: "button",
20759
- variant,
20760
- ...props,
20761
- children: [
20762
- Icon2 ? /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-4" }) : children,
20763
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: label || tooltip })
20764
- ]
20765
- }
20766
- );
20767
- if (tooltip) {
20768
- return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider2, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip9, { children: [
20769
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger2, { asChild: true, children: button }),
20770
- /* @__PURE__ */ jsxRuntime.jsx(TooltipContent2, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: tooltip }) })
20771
- ] }) });
20772
- }
20773
- return button;
20774
- };
20775
- var ArtifactContent = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex-1 overflow-auto p-4", className), ...props });
20776
- var BranchContext = React5.createContext(null);
20777
- var useBranch = () => {
20778
- const context = React5.useContext(BranchContext);
20779
- if (!context) {
20780
- throw new Error("Branch components must be used within Branch");
20781
- }
20782
- return context;
20783
- };
20784
- var Branch = ({ defaultBranch = 0, onBranchChange, className, ...props }) => {
20785
- const [currentBranch, setCurrentBranch] = React5.useState(defaultBranch);
20786
- const [branches, setBranches] = React5.useState([]);
20787
- const handleBranchChange = (newBranch) => {
20788
- setCurrentBranch(newBranch);
20789
- onBranchChange?.(newBranch);
20790
- };
20791
- const goToPrevious = () => {
20792
- const newBranch = currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
20793
- handleBranchChange(newBranch);
20794
- };
20795
- const goToNext = () => {
20796
- const newBranch = currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
20797
- handleBranchChange(newBranch);
20798
- };
20799
- const contextValue = {
20800
- currentBranch,
20801
- totalBranches: branches.length,
20802
- goToPrevious,
20803
- goToNext,
20804
- branches,
20805
- setBranches
20806
- };
20807
- return /* @__PURE__ */ jsxRuntime.jsx(BranchContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("grid w-full gap-2 [&>div]:pb-0", className), ...props }) });
20808
- };
20809
- var BranchMessages = ({ children, ...props }) => {
20810
- const { currentBranch, setBranches, branches } = useBranch();
20811
- const childrenArray = React5.useMemo(() => Array.isArray(children) ? children : [children], [children]);
20812
- React5.useEffect(() => {
20813
- if (branches.length !== childrenArray.length) {
20814
- setBranches(childrenArray);
20815
- }
20816
- }, [childrenArray, branches, setBranches]);
20817
- return childrenArray.map((branch, index) => /* @__PURE__ */ jsxRuntime.jsx(
20818
- "div",
20819
- {
20820
- className: cn(
20821
- "grid gap-2 overflow-hidden [&>div]:pb-0",
20822
- index === currentBranch ? "block" : "hidden"
20823
- ),
20824
- ...props,
20825
- children: branch
20826
- },
20827
- branch.key
20828
- ));
20829
- };
20830
- var BranchSelector = ({ className, from, ...props }) => {
20831
- const { totalBranches } = useBranch();
20832
- if (totalBranches <= 1) {
20833
- return null;
20834
- }
20835
- return /* @__PURE__ */ jsxRuntime.jsx(
20836
- "div",
20837
- {
20838
- className: cn(
20839
- "flex items-center gap-2 self-end px-10",
20840
- from === "assistant" ? "justify-start" : "justify-end",
20841
- className
20842
- ),
20843
- ...props
20844
- }
20845
- );
20846
- };
20847
- var BranchPrevious = ({ className, children, ...props }) => {
20848
- const { goToPrevious, totalBranches } = useBranch();
20849
- return /* @__PURE__ */ jsxRuntime.jsx(
20850
- Button7,
20851
- {
20852
- "aria-label": "Previous branch",
20853
- className: cn(
20854
- "size-7 shrink-0 rounded-full text-muted-foreground transition-colors",
20855
- "hover:bg-accent hover:text-foreground",
20856
- "disabled:pointer-events-none disabled:opacity-50",
20857
- className
20858
- ),
20859
- disabled: totalBranches <= 1,
20860
- onClick: goToPrevious,
20861
- size: "icon",
20862
- type: "button",
20863
- variant: "ghost",
20864
- ...props,
20865
- children: children ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { size: 14 })
20866
- }
20867
- );
20868
- };
20869
- var BranchNext = ({ className, children, ...props }) => {
20870
- const { goToNext, totalBranches } = useBranch();
20871
- return /* @__PURE__ */ jsxRuntime.jsx(
20872
- Button7,
20873
- {
20874
- "aria-label": "Next branch",
20875
- className: cn(
20876
- "size-7 shrink-0 rounded-full text-muted-foreground transition-colors",
20877
- "hover:bg-accent hover:text-foreground",
20878
- "disabled:pointer-events-none disabled:opacity-50",
20879
- className
20880
- ),
20881
- disabled: totalBranches <= 1,
20882
- onClick: goToNext,
20883
- size: "icon",
20884
- type: "button",
20885
- variant: "ghost",
20886
- ...props,
20887
- children: children ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, { size: 14 })
20888
- }
20889
- );
20890
- };
20891
- var BranchPage = ({ className, ...props }) => {
20892
- const { currentBranch, totalBranches } = useBranch();
20893
- return /* @__PURE__ */ jsxRuntime.jsxs(
20894
- "span",
20895
- {
20896
- className: cn("text-xs font-medium text-muted-foreground tabular-nums", className),
20897
- ...props,
20898
- children: [
20899
- currentBranch + 1,
20900
- " of ",
20901
- totalBranches
20902
- ]
20903
- }
20904
- );
20905
- };
20906
- var badgeVariants2 = classVarianceAuthority.cva(
20907
- "inline-flex items-center justify-center rounded-sm border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
20908
- {
20909
- variants: {
20910
- variant: {
20911
- default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
20912
- secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
20913
- destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
20914
- outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
20915
- }
20916
- },
20917
- defaultVariants: {
20918
- variant: "default"
20919
- }
20920
- }
20921
- );
20922
- function Badge2({
20923
- className,
20924
- variant,
20925
- asChild = false,
20926
- ...props
20927
- }) {
20928
- const Comp = asChild ? reactSlot.Slot : "span";
20929
- return /* @__PURE__ */ jsxRuntime.jsx(Comp, { "data-slot": "badge", className: cn(badgeVariants2({ variant }), className), ...props });
20930
- }
20931
- function Collapsible2({ ...props }) {
20932
- return /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.Root, { "data-slot": "collapsible", ...props });
20933
- }
20934
- function CollapsibleTrigger4({
20935
- ...props
20936
- }) {
20937
- return /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.CollapsibleTrigger, { "data-slot": "collapsible-trigger", ...props });
20938
- }
20939
- function CollapsibleContent4({
20940
- ...props
20941
- }) {
20942
- return /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.CollapsibleContent, { "data-slot": "collapsible-content", ...props });
20943
- }
20944
- var ChainOfThoughtContext = React5.createContext(null);
20945
- var useChainOfThought = () => {
20946
- const context = React5.useContext(ChainOfThoughtContext);
20947
- if (!context) {
20948
- throw new Error("ChainOfThought components must be used within ChainOfThought");
20949
- }
20950
- return context;
20951
- };
20952
- var ChainOfThought = React5.memo(
20953
- ({
20954
- className,
20955
- open,
20956
- defaultOpen = false,
20957
- onOpenChange,
20958
- children,
20959
- ...props
20960
- }) => {
20961
- const [isOpen, setIsOpen] = reactUseControllableState.useControllableState({
20962
- prop: open,
20963
- defaultProp: defaultOpen,
20964
- onChange: onOpenChange
20965
- });
20966
- return /* @__PURE__ */ jsxRuntime.jsx(ChainOfThoughtContext.Provider, { value: { isOpen, setIsOpen }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("not-prose max-w-prose space-y-4", className), ...props, children }) });
20967
- }
20968
- );
20969
- var ChainOfThoughtHeader = React5.memo(
20970
- ({ className, children, ...props }) => {
20971
- const { isOpen, setIsOpen } = useChainOfThought();
20972
- return /* @__PURE__ */ jsxRuntime.jsx(Collapsible2, { onOpenChange: setIsOpen, open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(
20973
- CollapsibleTrigger4,
20974
- {
20975
- className: cn(
20976
- "flex w-full items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",
20977
- className
20978
- ),
20979
- ...props,
20980
- children: [
20981
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BrainIcon, { className: "size-4" }),
20982
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 text-left", children: children ?? "Chain of Thought" }),
20983
- /* @__PURE__ */ jsxRuntime.jsx(
20984
- lucideReact.ChevronDownIcon,
20985
- {
20986
- className: cn("size-4 transition-transform", isOpen ? "rotate-180" : "rotate-0")
20987
- }
20988
- )
20989
- ]
20990
- }
20991
- ) });
20992
- }
20993
- );
20994
- var ChainOfThoughtStep = React5.memo(
20995
- ({
20996
- className,
20997
- icon: Icon2 = lucideReact.DotIcon,
20998
- label,
20999
- description,
21000
- status = "complete",
21001
- children,
21002
- ...props
21003
- }) => {
21004
- const statusStyles = {
21005
- complete: "text-muted-foreground",
21006
- active: "text-foreground",
21007
- pending: "text-muted-foreground/50"
21008
- };
21009
- return /* @__PURE__ */ jsxRuntime.jsxs(
21010
- "div",
21011
- {
21012
- className: cn(
21013
- "flex gap-2 text-sm",
21014
- statusStyles[status],
21015
- "animate-in fade-in-0 slide-in-from-top-2",
21016
- className
21017
- ),
21018
- ...props,
21019
- children: [
21020
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative mt-0.5", children: [
21021
- /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-4" }),
21022
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-7 bottom-0 left-1/2 -mx-px w-px bg-border" })
21023
- ] }),
21024
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-2", children: [
21025
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: label }),
21026
- description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground", children: description }),
21027
- children
21028
- ] })
21029
- ]
21030
- }
21031
- );
21032
- }
21033
- );
21034
- var ChainOfThoughtSearchResults = React5.memo(
21035
- ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center gap-2", className), ...props })
21036
- );
21037
- var ChainOfThoughtSearchResult = React5.memo(
21038
- ({ className, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
21039
- Badge2,
21040
- {
21041
- className: cn("gap-1 px-2 py-0.5 text-xs font-normal", className),
21042
- variant: "secondary",
21043
- ...props,
21044
- children
21045
- }
21046
- )
21047
- );
21048
- var ChainOfThoughtContent = React5.memo(
21049
- ({ className, children, ...props }) => {
21050
- const { isOpen } = useChainOfThought();
21051
- return /* @__PURE__ */ jsxRuntime.jsx(Collapsible2, { open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsx(
21052
- CollapsibleContent4,
21053
- {
21054
- className: cn(
21055
- "mt-2 space-y-3",
21056
- "text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:animate-in data-[state=open]:slide-in-from-top-2",
21057
- className
21058
- ),
21059
- ...props,
21060
- children
21061
- }
21062
- ) });
21063
- }
21064
- );
21065
- var ChainOfThoughtImage = React5.memo(
21066
- ({ className, children, caption, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("mt-2 space-y-2", className), ...props, children: [
21067
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg bg-muted p-3", children }),
21068
- caption && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: caption })
21069
- ] })
21070
- );
21071
- ChainOfThought.displayName = "ChainOfThought";
21072
- ChainOfThoughtHeader.displayName = "ChainOfThoughtHeader";
21073
- ChainOfThoughtStep.displayName = "ChainOfThoughtStep";
21074
- ChainOfThoughtSearchResults.displayName = "ChainOfThoughtSearchResults";
21075
- ChainOfThoughtSearchResult.displayName = "ChainOfThoughtSearchResult";
21076
- ChainOfThoughtContent.displayName = "ChainOfThoughtContent";
21077
- ChainOfThoughtImage.displayName = "ChainOfThoughtImage";
21078
- var CodeBlockContext = React5.createContext({
21079
- code: ""
21080
- });
21081
- var CodeBlock = ({
21082
- code,
21083
- language,
21084
- showLineNumbers = false,
21085
- className,
21086
- children,
21087
- ...props
21088
- }) => /* @__PURE__ */ jsxRuntime.jsx(CodeBlockContext.Provider, { value: { code }, children: /* @__PURE__ */ jsxRuntime.jsx(
21089
- "div",
21090
- {
21091
- className: cn(
21092
- "relative w-full overflow-hidden rounded-sm border bg-background text-foreground",
21093
- className
21094
- ),
21095
- ...props,
21096
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
21097
- /* @__PURE__ */ jsxRuntime.jsx(
21098
- reactSyntaxHighlighter.Prism,
21099
- {
21100
- className: "overflow-hidden dark:hidden",
21101
- codeTagProps: {
21102
- className: "font-mono text-sm"
21103
- },
21104
- customStyle: {
21105
- margin: 0,
21106
- padding: "1rem",
21107
- fontSize: "0.875rem",
21108
- background: "var(--background)",
21109
- color: "var(--foreground)"
21110
- },
21111
- language,
21112
- lineNumberStyle: {
21113
- color: "var(--muted-foreground)",
21114
- paddingRight: "1rem",
21115
- minWidth: "2.5rem"
21116
- },
21117
- showLineNumbers,
21118
- style: oneLight__default.default,
21119
- children: code
21120
- }
21121
- ),
21122
- /* @__PURE__ */ jsxRuntime.jsx(
21123
- reactSyntaxHighlighter.Prism,
21124
- {
21125
- className: "hidden overflow-hidden dark:block",
21126
- codeTagProps: {
21127
- className: "font-mono text-sm"
21128
- },
21129
- customStyle: {
21130
- margin: 0,
21131
- padding: "1rem",
21132
- fontSize: "0.875rem",
21133
- background: "var(--background)",
21134
- color: "var(--foreground)"
21135
- },
21136
- language,
21137
- lineNumberStyle: {
21138
- color: "var(--muted-foreground)",
21139
- paddingRight: "1rem",
21140
- minWidth: "2.5rem"
21141
- },
21142
- showLineNumbers,
21143
- style: oneDark__default.default,
21144
- children: code
21145
- }
21146
- ),
21147
- children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-2 right-2 flex items-center gap-2", children })
21148
- ] })
21149
- }
21150
- ) });
21151
- var CodeBlockCopyButton = ({
21152
- onCopy,
21153
- onError,
21154
- timeout = 2e3,
21155
- children,
21156
- className,
21157
- ...props
21158
- }) => {
21159
- const [isCopied, setIsCopied] = React5.useState(false);
21160
- const { code } = React5.useContext(CodeBlockContext);
21161
- const copyToClipboard = async () => {
21162
- if (typeof window === "undefined" || !navigator.clipboard.writeText) {
21163
- onError?.(new Error("Clipboard API not available"));
21164
- return;
21165
- }
21166
- try {
21167
- await navigator.clipboard.writeText(code);
21168
- setIsCopied(true);
21169
- onCopy?.();
21170
- setTimeout(() => setIsCopied(false), timeout);
21171
- } catch (error) {
21172
- onError?.(error);
21173
- }
21174
- };
21175
- const Icon2 = isCopied ? lucideReact.CheckIcon : lucideReact.CopyIcon;
21176
- return /* @__PURE__ */ jsxRuntime.jsx(
21177
- Button7,
21178
- {
21179
- className: cn("shrink-0", className),
21180
- onClick: copyToClipboard,
21181
- size: "icon",
21182
- variant: "ghost",
21183
- ...props,
21184
- children: children ?? /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 14 })
21185
- }
21186
- );
21187
- };
21188
- function HoverCard2({ ...props }) {
21189
- return /* @__PURE__ */ jsxRuntime.jsx(HoverCardPrimitive__namespace.Root, { "data-slot": "hover-card", ...props });
21190
- }
21191
- function HoverCardTrigger2({ ...props }) {
21192
- return /* @__PURE__ */ jsxRuntime.jsx(HoverCardPrimitive__namespace.Trigger, { "data-slot": "hover-card-trigger", ...props });
21193
- }
21194
- function HoverCardContent2({
21195
- className,
21196
- align = "center",
21197
- sideOffset = 4,
21198
- ...props
21199
- }) {
21200
- return /* @__PURE__ */ jsxRuntime.jsx(HoverCardPrimitive__namespace.Portal, { "data-slot": "hover-card-portal", children: /* @__PURE__ */ jsxRuntime.jsx(
21201
- HoverCardPrimitive__namespace.Content,
21202
- {
21203
- "data-slot": "hover-card-content",
21204
- align,
21205
- sideOffset,
21206
- className: cn(
21207
- "z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-sm border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
21208
- className
21209
- ),
21210
- ...props
21211
- }
21212
- ) });
21213
- }
21214
- function Progress2({
21215
- className,
21216
- value,
21217
- ...props
21218
- }) {
21219
- return /* @__PURE__ */ jsxRuntime.jsx(
21220
- ProgressPrimitive__namespace.Root,
21221
- {
21222
- "data-slot": "progress",
21223
- className: cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20", className),
21224
- ...props,
21225
- children: /* @__PURE__ */ jsxRuntime.jsx(
21226
- ProgressPrimitive__namespace.Indicator,
21227
- {
21228
- "data-slot": "progress-indicator",
21229
- className: "h-full w-full flex-1 bg-primary transition-all",
21230
- style: { transform: `translateX(-${100 - (value || 0)}%)` }
21231
- }
21232
- )
21233
- }
21234
- );
21235
- }
21236
- var PERCENT_MAX = 100;
21237
- var ICON_RADIUS = 10;
21238
- var ICON_VIEWBOX = 24;
21239
- var ICON_CENTER = 12;
21240
- var ICON_STROKE_WIDTH = 2;
21241
- var ContextContext = React5.createContext(null);
21242
- var useContextValue = () => {
21243
- const context = React5.useContext(ContextContext);
21244
- if (!context) {
21245
- throw new Error("Context components must be used within Context");
21246
- }
21247
- return context;
21248
- };
21249
- var Context = ({ usedTokens, maxTokens, usage, modelId, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
21250
- ContextContext.Provider,
21251
- {
21252
- value: {
21253
- usedTokens,
21254
- maxTokens,
21255
- usage,
21256
- modelId
21257
- },
21258
- children: /* @__PURE__ */ jsxRuntime.jsx(HoverCard2, { closeDelay: 0, openDelay: 0, ...props })
21259
- }
21260
- );
21261
- var ContextIcon = () => {
21262
- const { usedTokens, maxTokens } = useContextValue();
21263
- const circumference = 2 * Math.PI * ICON_RADIUS;
21264
- const usedPercent = usedTokens / maxTokens;
21265
- const dashOffset = circumference * (1 - usedPercent);
21266
- return /* @__PURE__ */ jsxRuntime.jsxs(
21267
- "svg",
21268
- {
21269
- "aria-label": "Model context usage",
21270
- height: "20",
21271
- role: "img",
21272
- style: { color: "currentcolor" },
21273
- viewBox: `0 0 ${ICON_VIEWBOX} ${ICON_VIEWBOX}`,
21274
- width: "20",
21275
- children: [
21276
- /* @__PURE__ */ jsxRuntime.jsx(
21277
- "circle",
21278
- {
21279
- cx: ICON_CENTER,
21280
- cy: ICON_CENTER,
21281
- fill: "none",
21282
- opacity: "0.25",
21283
- r: ICON_RADIUS,
21284
- stroke: "currentColor",
21285
- strokeWidth: ICON_STROKE_WIDTH
21286
- }
21287
- ),
21288
- /* @__PURE__ */ jsxRuntime.jsx(
21289
- "circle",
21290
- {
21291
- cx: ICON_CENTER,
21292
- cy: ICON_CENTER,
21293
- fill: "none",
21294
- opacity: "0.7",
21295
- r: ICON_RADIUS,
21296
- stroke: "currentColor",
21297
- strokeDasharray: `${circumference} ${circumference}`,
21298
- strokeDashoffset: dashOffset,
21299
- strokeLinecap: "round",
21300
- strokeWidth: ICON_STROKE_WIDTH,
21301
- style: { transformOrigin: "center", transform: "rotate(-90deg)" }
21302
- }
21303
- )
21304
- ]
21305
- }
21306
- );
21307
- };
21308
- var ContextTrigger = ({ children, ...props }) => {
21309
- const { usedTokens, maxTokens } = useContextValue();
21310
- const usedPercent = usedTokens / maxTokens;
21311
- const renderedPercent = new Intl.NumberFormat("en-US", {
21312
- style: "percent",
21313
- maximumFractionDigits: 1
21314
- }).format(usedPercent);
21315
- return /* @__PURE__ */ jsxRuntime.jsx(HoverCardTrigger2, { asChild: true, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(Button7, { type: "button", variant: "ghost", ...props, children: [
21316
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-muted-foreground", children: renderedPercent }),
21317
- /* @__PURE__ */ jsxRuntime.jsx(ContextIcon, {})
21318
- ] }) });
21319
- };
21320
- var ContextContent = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
21321
- HoverCardContent2,
21322
- {
21323
- className: cn("min-w-[240px] divide-y overflow-hidden p-0", className),
21324
- ...props
21325
- }
21326
- );
21327
- var ContextContentHeader = ({ children, className, ...props }) => {
21328
- const { usedTokens, maxTokens } = useContextValue();
21329
- const usedPercent = usedTokens / maxTokens;
21330
- const displayPct = new Intl.NumberFormat("en-US", {
21331
- style: "percent",
21332
- maximumFractionDigits: 1
21333
- }).format(usedPercent);
21334
- const used = new Intl.NumberFormat("en-US", {
21335
- notation: "compact"
21336
- }).format(usedTokens);
21337
- const total = new Intl.NumberFormat("en-US", {
21338
- notation: "compact"
21339
- }).format(maxTokens);
21340
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full space-y-2 p-3", className), ...props, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
21341
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3 text-xs", children: [
21342
- /* @__PURE__ */ jsxRuntime.jsx("p", { children: displayPct }),
21343
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "font-mono text-muted-foreground", children: [
21344
- used,
21345
- " / ",
21346
- total
21347
- ] })
21348
- ] }),
21349
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: /* @__PURE__ */ jsxRuntime.jsx(Progress2, { className: "bg-muted", value: usedPercent * PERCENT_MAX }) })
21350
- ] }) });
21351
- };
21352
- var ContextContentBody = ({ children, className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full p-3", className), ...props, children });
21353
- var ContextContentFooter = ({ children, className, ...props }) => {
21354
- const { modelId, usage } = useContextValue();
21355
- const costUSD = modelId ? tokenlens.estimateCost({
21356
- modelId,
21357
- usage: {
21358
- input: usage?.inputTokens ?? 0,
21359
- output: usage?.outputTokens ?? 0
21360
- }
21361
- }).totalUSD : void 0;
21362
- const totalCost = new Intl.NumberFormat("en-US", {
21363
- style: "currency",
21364
- currency: "USD"
21365
- }).format(costUSD ?? 0);
21366
- return /* @__PURE__ */ jsxRuntime.jsx(
21367
- "div",
21368
- {
21369
- className: cn(
21370
- "flex w-full items-center justify-between gap-3 bg-secondary p-3 text-xs",
21371
- className
21372
- ),
21373
- ...props,
21374
- children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
21375
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Total cost" }),
21376
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: totalCost })
21377
- ] })
21378
- }
21379
- );
21380
- };
21381
- var ContextInputUsage = ({ className, children, ...props }) => {
21382
- const { usage, modelId } = useContextValue();
21383
- const inputTokens = usage?.inputTokens ?? 0;
21384
- if (children) {
21385
- return children;
21386
- }
21387
- if (!inputTokens) {
21388
- return null;
21389
- }
21390
- const inputCost = modelId ? tokenlens.estimateCost({
21391
- modelId,
21392
- usage: { input: inputTokens, output: 0 }
21393
- }).totalUSD : void 0;
21394
- const inputCostText = new Intl.NumberFormat("en-US", {
21395
- style: "currency",
21396
- currency: "USD"
21397
- }).format(inputCost ?? 0);
21398
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center justify-between text-xs", className), ...props, children: [
21399
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Input" }),
21400
- /* @__PURE__ */ jsxRuntime.jsx(TokensWithCost, { costText: inputCostText, tokens: inputTokens })
21401
- ] });
21402
- };
21403
- var ContextOutputUsage = ({ className, children, ...props }) => {
21404
- const { usage, modelId } = useContextValue();
21405
- const outputTokens = usage?.outputTokens ?? 0;
21406
- if (children) {
21407
- return children;
21408
- }
21409
- if (!outputTokens) {
21410
- return null;
21411
- }
21412
- const outputCost = modelId ? tokenlens.estimateCost({
21413
- modelId,
21414
- usage: { input: 0, output: outputTokens }
21415
- }).totalUSD : void 0;
21416
- const outputCostText = new Intl.NumberFormat("en-US", {
21417
- style: "currency",
21418
- currency: "USD"
21419
- }).format(outputCost ?? 0);
21420
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center justify-between text-xs", className), ...props, children: [
21421
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Output" }),
21422
- /* @__PURE__ */ jsxRuntime.jsx(TokensWithCost, { costText: outputCostText, tokens: outputTokens })
21423
- ] });
21424
- };
21425
- var ContextReasoningUsage = ({
21426
- className,
21427
- children,
21428
- ...props
21429
- }) => {
21430
- const { usage, modelId } = useContextValue();
21431
- const reasoningTokens = usage?.outputTokenDetails?.reasoningTokens ?? 0;
21432
- if (children) {
21433
- return children;
21434
- }
21435
- if (!reasoningTokens) {
21436
- return null;
21437
- }
21438
- const reasoningCost = modelId ? tokenlens.estimateCost({
21439
- modelId,
21440
- usage: { reasoningTokens }
21441
- }).totalUSD : void 0;
21442
- const reasoningCostText = new Intl.NumberFormat("en-US", {
21443
- style: "currency",
21444
- currency: "USD"
21445
- }).format(reasoningCost ?? 0);
21446
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center justify-between text-xs", className), ...props, children: [
21447
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Reasoning" }),
21448
- /* @__PURE__ */ jsxRuntime.jsx(TokensWithCost, { costText: reasoningCostText, tokens: reasoningTokens })
21449
- ] });
21450
- };
21451
- var ContextCacheUsage = ({ className, children, ...props }) => {
21452
- const { usage, modelId } = useContextValue();
21453
- const cacheTokens = usage?.inputTokenDetails?.cacheReadTokens ?? 0;
21454
- if (children) {
21455
- return children;
21456
- }
21457
- if (!cacheTokens) {
21458
- return null;
21459
- }
21460
- const cacheCost = modelId ? tokenlens.estimateCost({
21461
- modelId,
21462
- usage: { cacheReads: cacheTokens, input: 0, output: 0 }
21463
- }).totalUSD : void 0;
21464
- const cacheCostText = new Intl.NumberFormat("en-US", {
21465
- style: "currency",
21466
- currency: "USD"
21467
- }).format(cacheCost ?? 0);
21468
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center justify-between text-xs", className), ...props, children: [
21469
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Cache" }),
21470
- /* @__PURE__ */ jsxRuntime.jsx(TokensWithCost, { costText: cacheCostText, tokens: cacheTokens })
21471
- ] });
21472
- };
21473
- var TokensWithCost = ({ tokens, costText }) => /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
21474
- tokens === void 0 ? "\u2014" : new Intl.NumberFormat("en-US", {
21475
- notation: "compact"
21476
- }).format(tokens),
21477
- costText ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-2 text-muted-foreground", children: [
21478
- "\u2022 ",
21479
- costText
21480
- ] }) : null
21481
- ] });
21482
- var Conversation = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
21483
- useStickToBottom.StickToBottom,
21484
- {
21485
- className: cn("relative flex-1 overflow-y-auto", className),
21486
- initial: "smooth",
21487
- resize: "smooth",
21488
- role: "log",
21489
- ...props
21490
- }
21491
- );
21492
- var ConversationContent = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(useStickToBottom.StickToBottom.Content, { className: cn("p-4", className), ...props });
21493
- var ConversationEmptyState = ({
21494
- className,
21495
- title = "No messages yet",
21496
- description = "Start a conversation to see messages here",
21497
- icon,
21498
- children,
21499
- ...props
21500
- }) => /* @__PURE__ */ jsxRuntime.jsx(
21501
- "div",
21502
- {
21503
- className: cn(
21504
- "flex size-full flex-col items-center justify-center gap-3 p-8 text-center",
21505
- className
21506
- ),
21507
- ...props,
21508
- children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
21509
- icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground", children: icon }),
21510
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
21511
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-medium", children: title }),
21512
- description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: description })
21513
- ] })
21514
- ] })
21515
- }
21516
- );
21517
- var ConversationScrollButton = ({
21518
- className,
21519
- ...props
21520
- }) => {
21521
- const { isAtBottom, scrollToBottom } = useStickToBottom.useStickToBottomContext();
21522
- const handleScrollToBottom = React5.useCallback(() => {
21523
- scrollToBottom();
21524
- }, [scrollToBottom]);
21525
- return !isAtBottom && /* @__PURE__ */ jsxRuntime.jsx(
21526
- Button7,
21527
- {
21528
- className: cn("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full", className),
21529
- onClick: handleScrollToBottom,
21530
- size: "icon",
21531
- type: "button",
21532
- variant: "outline",
21533
- ...props,
21534
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDownIcon, { className: "size-4" })
21535
- }
21536
- );
21537
- };
21538
- var Image4 = ({ base64, uint8Array, mediaType, ...props }) => (/* @__PURE__ */ jsxRuntime.jsx(
21539
- "img",
21540
- {
21541
- ...props,
21542
- alt: props.alt,
21543
- className: cn("h-auto max-w-full overflow-hidden rounded-md", props.className),
21544
- src: `data:${mediaType};base64,${base64}`
21545
- }
21546
- ));
21547
- var CarouselContext2 = React5__namespace.createContext(null);
21548
- function useCarousel2() {
21549
- const context = React5__namespace.useContext(CarouselContext2);
21550
- if (!context) {
21551
- throw new Error("useCarousel must be used within a <Carousel />");
21552
- }
21553
- return context;
21554
- }
21555
- function Carousel2({
21556
- orientation = "horizontal",
21557
- opts,
21558
- setApi,
21559
- plugins,
21560
- className,
21561
- children,
21562
- ...props
21563
- }) {
21564
- const [carouselRef, api] = useEmblaCarousel__default.default(
21565
- {
21566
- ...opts,
21567
- axis: orientation === "horizontal" ? "x" : "y"
21568
- },
21569
- plugins
21570
- );
21571
- const [canScrollPrev, setCanScrollPrev] = React5__namespace.useState(false);
21572
- const [canScrollNext, setCanScrollNext] = React5__namespace.useState(false);
21573
- const onSelect = React5__namespace.useCallback((api2) => {
21574
- if (!api2) return;
21575
- setCanScrollPrev(api2.canScrollPrev());
21576
- setCanScrollNext(api2.canScrollNext());
21577
- }, []);
21578
- const scrollPrev = React5__namespace.useCallback(() => {
21579
- api?.scrollPrev();
21580
- }, [api]);
21581
- const scrollNext = React5__namespace.useCallback(() => {
21582
- api?.scrollNext();
21583
- }, [api]);
21584
- const handleKeyDown = React5__namespace.useCallback(
21585
- (event) => {
21586
- if (event.key === "ArrowLeft") {
21587
- event.preventDefault();
21588
- scrollPrev();
21589
- } else if (event.key === "ArrowRight") {
21590
- event.preventDefault();
21591
- scrollNext();
21592
- }
21593
- },
21594
- [scrollPrev, scrollNext]
21595
- );
21596
- React5__namespace.useEffect(() => {
21597
- if (!api || !setApi) return;
21598
- setApi(api);
21599
- }, [api, setApi]);
21600
- React5__namespace.useEffect(() => {
21601
- if (!api) return;
21602
- onSelect(api);
21603
- api.on("reInit", onSelect);
21604
- api.on("select", onSelect);
21605
- return () => {
21606
- api?.off("select", onSelect);
21607
- };
21608
- }, [api, onSelect]);
21609
- return /* @__PURE__ */ jsxRuntime.jsx(
21610
- CarouselContext2.Provider,
21611
- {
21612
- value: {
21613
- carouselRef,
21614
- api,
21615
- opts,
21616
- orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
21617
- scrollPrev,
21618
- scrollNext,
21619
- canScrollPrev,
21620
- canScrollNext
21621
- },
21622
- children: /* @__PURE__ */ jsxRuntime.jsx(
21623
- "div",
21624
- {
21625
- onKeyDownCapture: handleKeyDown,
21626
- className: cn("relative", className),
21627
- role: "region",
21628
- "aria-roledescription": "carousel",
21629
- "data-slot": "carousel",
21630
- ...props,
21631
- children
21632
- }
21633
- )
21634
- }
21635
- );
21636
- }
21637
- function CarouselContent2({ className, ...props }) {
21638
- const { carouselRef, orientation } = useCarousel2();
21639
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: carouselRef, className: "overflow-hidden", "data-slot": "carousel-content", children: /* @__PURE__ */ jsxRuntime.jsx(
21640
- "div",
21641
- {
21642
- className: cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className),
21643
- ...props
21644
- }
21645
- ) });
21646
- }
21647
- function CarouselItem2({ className, ...props }) {
21648
- const { orientation } = useCarousel2();
21649
- return /* @__PURE__ */ jsxRuntime.jsx(
21650
- "div",
21651
- {
21652
- role: "group",
21653
- "aria-roledescription": "slide",
21654
- "data-slot": "carousel-item",
21655
- className: cn(
21656
- "min-w-0 shrink-0 grow-0 basis-full",
21657
- orientation === "horizontal" ? "pl-4" : "pt-4",
21658
- className
21659
- ),
21660
- ...props
21661
- }
21662
- );
21663
- }
21664
- var InlineCitation = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("group inline items-center gap-1", className), ...props });
21665
- var InlineCitationText = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("transition-colors group-hover:bg-accent", className), ...props });
21666
- var InlineCitationCard = (props) => /* @__PURE__ */ jsxRuntime.jsx(HoverCard2, { closeDelay: 0, openDelay: 0, ...props });
21667
- var InlineCitationCardTrigger = ({
21668
- sources,
21669
- className,
21670
- ...props
21671
- }) => /* @__PURE__ */ jsxRuntime.jsx(HoverCardTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Badge2, { className: cn("ml-1 rounded-full", className), variant: "secondary", ...props, children: sources.length ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
21672
- new URL(sources[0]).hostname,
21673
- " ",
21674
- sources.length > 1 && `+${sources.length - 1}`
21675
- ] }) : "unknown" }) });
21676
- var InlineCitationCardBody = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(HoverCardContent2, { className: cn("relative w-80 p-0", className), ...props });
21677
- var CarouselApiContext = React5.createContext(void 0);
21678
- var useCarouselApi = () => {
21679
- const context = React5.useContext(CarouselApiContext);
21680
- return context;
21681
- };
21682
- var InlineCitationCarousel = ({
21683
- className,
21684
- children,
21685
- ...props
21686
- }) => {
21687
- const [api, setApi] = React5.useState();
21688
- return /* @__PURE__ */ jsxRuntime.jsx(CarouselApiContext.Provider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(Carousel2, { className: cn("w-full", className), setApi, ...props, children }) });
21689
- };
21690
- var InlineCitationCarouselContent = (props) => /* @__PURE__ */ jsxRuntime.jsx(CarouselContent2, { ...props });
21691
- var InlineCitationCarouselItem = ({
21692
- className,
21693
- ...props
21694
- }) => /* @__PURE__ */ jsxRuntime.jsx(CarouselItem2, { className: cn("w-full space-y-2 p-4 pl-8", className), ...props });
21695
- var InlineCitationCarouselHeader = ({
21696
- className,
21697
- ...props
21698
- }) => /* @__PURE__ */ jsxRuntime.jsx(
21699
- "div",
21700
- {
21701
- className: cn(
21702
- "flex items-center justify-between gap-2 rounded-t-md bg-secondary p-2",
21703
- className
21704
- ),
21705
- ...props
21706
- }
21707
- );
21708
- var useCarouselIndex = () => {
21709
- const api = useCarouselApi();
21710
- const subscribe = React5.useCallback(
21711
- (callback) => {
21712
- if (!api) {
21713
- return () => {
21714
- };
21715
- }
21716
- api.on("select", callback);
21717
- api.on("reInit", callback);
21718
- return () => {
21719
- api.off("select", callback);
21720
- api.off("reInit", callback);
21721
- };
21722
- },
21723
- [api]
21724
- );
21725
- const getSnapshot = React5.useCallback(() => {
21726
- if (!api) {
21727
- return { current: 0, count: 0 };
21728
- }
21729
- return {
21730
- current: api.selectedScrollSnap() + 1,
21731
- count: api.scrollSnapList().length
21732
- };
21733
- }, [api]);
21734
- const { current, count } = React5.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
21735
- return { current, count };
21736
- };
21737
- var InlineCitationCarouselIndex = ({
21738
- children,
21739
- className,
21740
- ...props
21741
- }) => {
21742
- const { current, count } = useCarouselIndex();
21743
- return /* @__PURE__ */ jsxRuntime.jsx(
21744
- "div",
21745
- {
21746
- className: cn(
21747
- "flex flex-1 items-center justify-end px-3 py-1 text-xs text-muted-foreground",
21748
- className
21749
- ),
21750
- ...props,
21751
- children: children ?? `${current}/${count}`
21752
- }
21753
- );
21754
- };
21755
- var InlineCitationSource = ({
21756
- title,
21757
- url,
21758
- description,
21759
- className,
21760
- children,
21761
- ...props
21762
- }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-1", className), ...props, children: [
21763
- title && /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "truncate text-sm leading-tight font-medium", children: title }),
21764
- url && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-xs break-all text-muted-foreground", children: url }),
21765
- description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "line-clamp-3 text-sm leading-relaxed text-muted-foreground", children: description }),
21766
- children
21767
- ] });
21768
- var LoaderIcon = ({ size = 16 }) => /* @__PURE__ */ jsxRuntime.jsxs(
21769
- "svg",
21770
- {
21771
- height: size,
21772
- strokeLinejoin: "round",
21773
- style: { color: "currentcolor" },
21774
- viewBox: "0 0 16 16",
21775
- width: size,
21776
- children: [
21777
- /* @__PURE__ */ jsxRuntime.jsx("title", { children: "Loader" }),
21778
- /* @__PURE__ */ jsxRuntime.jsxs("g", { clipPath: "url(#clip0_2393_1490)", children: [
21779
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 0V4", stroke: "currentColor", strokeWidth: "1.5" }),
21780
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 16V12", opacity: "0.5", stroke: "currentColor", strokeWidth: "1.5" }),
21781
- /* @__PURE__ */ jsxRuntime.jsx(
21782
- "path",
21783
- {
21784
- d: "M3.29773 1.52783L5.64887 4.7639",
21785
- opacity: "0.9",
21786
- stroke: "currentColor",
21787
- strokeWidth: "1.5"
21788
- }
21789
- ),
21790
- /* @__PURE__ */ jsxRuntime.jsx(
21791
- "path",
21792
- {
21793
- d: "M12.7023 1.52783L10.3511 4.7639",
21794
- opacity: "0.1",
21795
- stroke: "currentColor",
21796
- strokeWidth: "1.5"
21797
- }
21798
- ),
21799
- /* @__PURE__ */ jsxRuntime.jsx(
21800
- "path",
21801
- {
21802
- d: "M12.7023 14.472L10.3511 11.236",
21803
- opacity: "0.4",
21804
- stroke: "currentColor",
21805
- strokeWidth: "1.5"
21806
- }
21807
- ),
21808
- /* @__PURE__ */ jsxRuntime.jsx(
21809
- "path",
21810
- {
21811
- d: "M3.29773 14.472L5.64887 11.236",
21812
- opacity: "0.6",
21813
- stroke: "currentColor",
21814
- strokeWidth: "1.5"
21815
- }
21816
- ),
21817
- /* @__PURE__ */ jsxRuntime.jsx(
21818
- "path",
21819
- {
21820
- d: "M15.6085 5.52783L11.8043 6.7639",
21821
- opacity: "0.2",
21822
- stroke: "currentColor",
21823
- strokeWidth: "1.5"
21824
- }
21825
- ),
21826
- /* @__PURE__ */ jsxRuntime.jsx(
21827
- "path",
21828
- {
21829
- d: "M0.391602 10.472L4.19583 9.23598",
21830
- opacity: "0.7",
21831
- stroke: "currentColor",
21832
- strokeWidth: "1.5"
21833
- }
21834
- ),
21835
- /* @__PURE__ */ jsxRuntime.jsx(
21836
- "path",
21837
- {
21838
- d: "M15.6085 10.4722L11.8043 9.2361",
21839
- opacity: "0.3",
21840
- stroke: "currentColor",
21841
- strokeWidth: "1.5"
21842
- }
21843
- ),
21844
- /* @__PURE__ */ jsxRuntime.jsx(
21845
- "path",
21846
- {
21847
- d: "M0.391602 5.52783L4.19583 6.7639",
21848
- opacity: "0.8",
21849
- stroke: "currentColor",
21850
- strokeWidth: "1.5"
21851
- }
21852
- )
21853
- ] }),
21854
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_2393_1490", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { fill: "white", height: "16", width: "16" }) }) })
21855
- ]
21856
- }
21857
- );
21858
- var Loader = ({ className, size = 16, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("inline-flex animate-spin items-center justify-center", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsx(LoaderIcon, { size }) });
21859
- var Message = ({ className, from, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
21860
- "div",
21861
- {
21862
- className: cn(
21863
- "group flex w-full items-end justify-end gap-2 py-4",
21864
- from === "user" ? "is-user" : "is-assistant flex-row-reverse justify-end",
21865
- className
21866
- ),
21867
- ...props
21868
- }
21869
- );
21870
- var messageContentVariants = classVarianceAuthority.cva(
21871
- "is-user:dark flex flex-col gap-2 overflow-hidden rounded-lg text-sm",
21872
- {
21873
- variants: {
21874
- variant: {
21875
- contained: [
21876
- "max-w-[80%] px-4 py-3",
21877
- "group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground",
21878
- "group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground"
21879
- ],
21880
- flat: [
21881
- "group-[.is-user]:max-w-[80%] group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground",
21882
- "group-[.is-assistant]:text-foreground"
21883
- ]
21884
- }
21885
- },
21886
- defaultVariants: {
21887
- variant: "contained"
21888
- }
21889
- }
21890
- );
21891
- var MessageContent = ({ children, className, variant, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(messageContentVariants({ variant, className })), ...props, children });
21892
- function DropdownMenu2({ ...props }) {
21893
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Root, { "data-slot": "dropdown-menu", ...props });
21894
- }
21895
- function DropdownMenuTrigger3({
21896
- ...props
21897
- }) {
21898
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
21899
- }
21900
- function DropdownMenuContent2({
21901
- className,
21902
- sideOffset = 4,
21903
- ...props
21904
- }) {
21905
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
21906
- DropdownMenuPrimitive__namespace.Content,
21907
- {
21908
- "data-slot": "dropdown-menu-content",
21909
- sideOffset,
21910
- className: cn(
21911
- "z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-sm border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
21912
- className
21913
- ),
21914
- ...props
21915
- }
21916
- ) });
21917
- }
21918
- function DropdownMenuItem2({
21919
- className,
21920
- inset,
21921
- variant = "default",
21922
- ...props
21923
- }) {
21924
- return /* @__PURE__ */ jsxRuntime.jsx(
21925
- DropdownMenuPrimitive__namespace.Item,
21926
- {
21927
- "data-slot": "dropdown-menu-item",
21928
- "data-inset": inset,
21929
- "data-variant": variant,
21930
- className: cn(
21931
- "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:!text-destructive",
21932
- className
21933
- ),
21934
- ...props
21935
- }
21936
- );
21937
- }
21938
- var providers = {
21939
- scira: {
21940
- title: "Open in Scira",
21941
- createUrl: (q) => `https://scira.ai/?${new URLSearchParams({
21942
- q
21943
- })}`,
21944
- icon: /* @__PURE__ */ jsxRuntime.jsxs(
21945
- "svg",
21946
- {
21947
- fill: "none",
21948
- height: "934",
21949
- viewBox: "0 0 910 934",
21950
- width: "910",
21951
- xmlns: "http://www.w3.org/2000/svg",
21952
- children: [
21953
- /* @__PURE__ */ jsxRuntime.jsx("title", { children: "Scira AI" }),
21954
- /* @__PURE__ */ jsxRuntime.jsx(
21955
- "path",
21956
- {
21957
- d: "M647.664 197.775C569.13 189.049 525.5 145.419 516.774 66.8849C508.048 145.419 464.418 189.049 385.884 197.775C464.418 206.501 508.048 250.131 516.774 328.665C525.5 250.131 569.13 206.501 647.664 197.775Z",
21958
- fill: "currentColor",
21959
- stroke: "currentColor",
21960
- strokeLinejoin: "round",
21961
- strokeWidth: "8"
21962
- }
21963
- ),
21964
- /* @__PURE__ */ jsxRuntime.jsx(
21965
- "path",
21966
- {
21967
- d: "M516.774 304.217C510.299 275.491 498.208 252.087 480.335 234.214C462.462 216.341 439.058 204.251 410.333 197.775C439.059 191.3 462.462 179.209 480.335 161.336C498.208 143.463 510.299 120.06 516.774 91.334C523.25 120.059 535.34 143.463 553.213 161.336C571.086 179.209 594.49 191.3 623.216 197.775C594.49 204.251 571.086 216.341 553.213 234.214C535.34 252.087 523.25 275.491 516.774 304.217Z",
21968
- fill: "currentColor",
21969
- stroke: "currentColor",
21970
- strokeLinejoin: "round",
21971
- strokeWidth: "8"
21972
- }
21973
- ),
21974
- /* @__PURE__ */ jsxRuntime.jsx(
21975
- "path",
21976
- {
21977
- d: "M857.5 508.116C763.259 497.644 710.903 445.288 700.432 351.047C689.961 445.288 637.605 497.644 543.364 508.116C637.605 518.587 689.961 570.943 700.432 665.184C710.903 570.943 763.259 518.587 857.5 508.116Z",
21978
- stroke: "currentColor",
21979
- strokeLinejoin: "round",
21980
- strokeWidth: "20"
21981
- }
21982
- ),
21983
- /* @__PURE__ */ jsxRuntime.jsx(
21984
- "path",
21985
- {
21986
- d: "M700.432 615.957C691.848 589.05 678.575 566.357 660.383 548.165C642.191 529.973 619.499 516.7 592.593 508.116C619.499 499.533 642.191 486.258 660.383 468.066C678.575 449.874 691.848 427.181 700.432 400.274C709.015 427.181 722.289 449.874 740.481 468.066C758.673 486.258 781.365 499.533 808.271 508.116C781.365 516.7 758.673 529.973 740.481 548.165C722.289 566.357 709.015 589.05 700.432 615.957Z",
21987
- stroke: "currentColor",
21988
- strokeLinejoin: "round",
21989
- strokeWidth: "20"
21990
- }
21991
- ),
21992
- /* @__PURE__ */ jsxRuntime.jsx(
21993
- "path",
21994
- {
21995
- d: "M889.949 121.237C831.049 114.692 798.326 81.9698 791.782 23.0692C785.237 81.9698 752.515 114.692 693.614 121.237C752.515 127.781 785.237 160.504 791.782 219.404C798.326 160.504 831.049 127.781 889.949 121.237Z",
21996
- fill: "currentColor",
21997
- stroke: "currentColor",
21998
- strokeLinejoin: "round",
21999
- strokeWidth: "8"
22000
- }
22001
- ),
22002
- /* @__PURE__ */ jsxRuntime.jsx(
22003
- "path",
22004
- {
22005
- d: "M791.782 196.795C786.697 176.937 777.869 160.567 765.16 147.858C752.452 135.15 736.082 126.322 716.226 121.237C736.082 116.152 752.452 107.324 765.16 94.6152C777.869 81.9065 786.697 65.5368 791.782 45.6797C796.867 65.5367 805.695 81.9066 818.403 94.6152C831.112 107.324 847.481 116.152 867.338 121.237C847.481 126.322 831.112 135.15 818.403 147.858C805.694 160.567 796.867 176.937 791.782 196.795Z",
22006
- fill: "currentColor",
22007
- stroke: "currentColor",
22008
- strokeLinejoin: "round",
22009
- strokeWidth: "8"
22010
- }
22011
- ),
22012
- /* @__PURE__ */ jsxRuntime.jsx(
22013
- "path",
22014
- {
22015
- d: "M760.632 764.337C720.719 814.616 669.835 855.1 611.872 882.692C553.91 910.285 490.404 924.255 426.213 923.533C362.022 922.812 298.846 907.419 241.518 878.531C184.19 849.643 134.228 808.026 95.4548 756.863C56.6815 705.7 30.1238 646.346 17.8129 583.343C5.50207 520.339 7.76433 455.354 24.4266 393.359C41.089 331.364 71.7099 274.001 113.947 225.658C156.184 177.315 208.919 139.273 268.117 114.442",
22016
- stroke: "currentColor",
22017
- strokeLinecap: "round",
22018
- strokeLinejoin: "round",
22019
- strokeWidth: "30"
22020
- }
22021
- )
22022
- ]
22023
- }
22024
- )
22025
- },
22026
- chatgpt: {
22027
- title: "Open in ChatGPT",
22028
- createUrl: (q) => `https://chatgpt.com/?${new URLSearchParams({
22029
- hints: "search",
22030
- q
22031
- })}`,
22032
- icon: /* @__PURE__ */ jsxRuntime.jsxs("svg", { fill: "currentColor", role: "img", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
22033
- /* @__PURE__ */ jsxRuntime.jsx("title", { children: "OpenAI" }),
22034
- /* @__PURE__ */ jsxRuntime.jsx("path", { 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" })
22035
- ] })
22036
- },
22037
- claude: {
22038
- title: "Open in Claude",
22039
- createUrl: (q) => `https://claude.ai/new?${new URLSearchParams({
22040
- q
22041
- })}`,
22042
- icon: /* @__PURE__ */ jsxRuntime.jsxs("svg", { fill: "currentColor", role: "img", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
22043
- /* @__PURE__ */ jsxRuntime.jsx("title", { children: "Anthropic" }),
22044
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z" })
22045
- ] })
22046
- },
22047
- t3: {
22048
- title: "Open in T3 Chat",
22049
- createUrl: (q) => `https://t3.chat/new?${new URLSearchParams({
22050
- q
22051
- })}`,
22052
- icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageCircleIcon, {})
22053
- },
22054
- v0: {
22055
- title: "Open in V0",
22056
- createUrl: (q) => `https://v0.app?${new URLSearchParams({
22057
- q
22058
- })}`,
22059
- icon: /* @__PURE__ */ jsxRuntime.jsxs("svg", { fill: "currentColor", viewBox: "0 0 147 70", xmlns: "http://www.w3.org/2000/svg", children: [
22060
- /* @__PURE__ */ jsxRuntime.jsx("title", { children: "V0" }),
22061
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M56 50.2031V14H70V60.1562C70 65.5928 65.5928 70 60.1562 70C57.5605 70 54.9982 68.9992 53.1562 67.1573L0 14H19.7969L56 50.2031Z" }),
22062
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M147 56H133V23.9531L100.953 56H133V70H96.6875C85.8144 70 77 61.1856 77 50.3125V14H91V46.1562L123.156 14H91V0H127.312C138.186 0 147 8.81439 147 19.6875V56Z" })
22063
- ] })
22064
- }
22065
- };
22066
- var OpenInContext = React5.createContext(void 0);
22067
- var useOpenInContext = () => {
22068
- const context = React5.useContext(OpenInContext);
22069
- if (!context) {
22070
- throw new Error("OpenIn components must be used within an OpenIn provider");
22071
- }
22072
- return context;
22073
- };
22074
- var OpenIn = ({ query, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(OpenInContext.Provider, { value: { query }, children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2, { ...props }) });
22075
- var OpenInContent = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuContent2, { align: "start", className: cn("w-[240px]", className), ...props });
22076
- var OpenInTrigger = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger3, { ...props, asChild: true, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(Button7, { type: "button", variant: "outline", children: [
22077
- "Open in chat",
22078
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "ml-2 size-4" })
22079
- ] }) });
22080
- var OpenInChatGPT = (props) => {
22081
- const { query } = useOpenInContext();
22082
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem2, { asChild: true, ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(
22083
- "a",
22084
- {
22085
- className: "flex items-center gap-2",
22086
- href: providers.chatgpt.createUrl(query),
22087
- rel: "noopener",
22088
- target: "_blank",
22089
- children: [
22090
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: providers.chatgpt.icon }),
22091
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: providers.chatgpt.title }),
22092
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLinkIcon, { className: "size-4 shrink-0" })
22093
- ]
22094
- }
22095
- ) });
22096
- };
22097
- var OpenInClaude = (props) => {
22098
- const { query } = useOpenInContext();
22099
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem2, { asChild: true, ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(
22100
- "a",
22101
- {
22102
- className: "flex items-center gap-2",
22103
- href: providers.claude.createUrl(query),
22104
- rel: "noopener",
22105
- target: "_blank",
22106
- children: [
22107
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: providers.claude.icon }),
22108
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: providers.claude.title }),
22109
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLinkIcon, { className: "size-4 shrink-0" })
22110
- ]
22111
- }
22112
- ) });
22113
- };
22114
- var OpenInT3 = (props) => {
22115
- const { query } = useOpenInContext();
22116
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem2, { asChild: true, ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(
22117
- "a",
22118
- {
22119
- className: "flex items-center gap-2",
22120
- href: providers.t3.createUrl(query),
22121
- rel: "noopener",
22122
- target: "_blank",
22123
- children: [
22124
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: providers.t3.icon }),
22125
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: providers.t3.title }),
22126
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLinkIcon, { className: "size-4 shrink-0" })
22127
- ]
22128
- }
22129
- ) });
22130
- };
22131
- var OpenInScira = (props) => {
22132
- const { query } = useOpenInContext();
22133
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem2, { asChild: true, ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(
22134
- "a",
22135
- {
22136
- className: "flex items-center gap-2",
22137
- href: providers.scira.createUrl(query),
22138
- rel: "noopener",
22139
- target: "_blank",
22140
- children: [
22141
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: providers.scira.icon }),
22142
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: providers.scira.title }),
22143
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLinkIcon, { className: "size-4 shrink-0" })
22144
- ]
22145
- }
22146
- ) });
22147
- };
22148
- var OpenInv0 = (props) => {
22149
- const { query } = useOpenInContext();
22150
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem2, { asChild: true, ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(
22151
- "a",
22152
- {
22153
- className: "flex items-center gap-2",
22154
- href: providers.v0.createUrl(query),
22155
- rel: "noopener",
22156
- target: "_blank",
22157
- children: [
22158
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: providers.v0.icon }),
22159
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: providers.v0.title }),
22160
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLinkIcon, { className: "size-4 shrink-0" })
22161
- ]
22162
- }
22163
- ) });
22164
- };
22165
- function Textarea2({ className, ...props }) {
22166
- return /* @__PURE__ */ jsxRuntime.jsx(
22167
- "textarea",
22168
- {
22169
- "data-slot": "textarea",
22170
- className: cn(
22171
- "flex field-sizing-content min-h-16 w-full rounded-sm border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
22172
- className
22173
- ),
22174
- ...props
22175
- }
22176
- );
22177
- }
22178
- var AttachmentsContext = React5.createContext(null);
22179
- var usePromptInputAttachments = () => {
22180
- const context = React5.useContext(AttachmentsContext);
22181
- if (!context) {
22182
- throw new Error("usePromptInputAttachments must be used within a PromptInput");
22183
- }
22184
- return context;
22185
- };
22186
- function PromptInputAttachment({ data, className, ...props }) {
22187
- const attachments = usePromptInputAttachments();
22188
- return /* @__PURE__ */ jsxRuntime.jsxs(
22189
- "div",
22190
- {
22191
- className: cn("group relative h-14 w-14 rounded-sm border", className),
22192
- ...props,
22193
- children: [
22194
- data.mediaType?.startsWith("image/") && data.url ? /* @__PURE__ */ jsxRuntime.jsx(
22195
- "img",
22196
- {
22197
- alt: data.filename || "attachment",
22198
- className: "size-full rounded-md object-cover",
22199
- height: 56,
22200
- src: data.url,
22201
- width: 56
22202
- }
22203
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-full items-center justify-center text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PaperclipIcon, { className: "size-4" }) }),
22204
- /* @__PURE__ */ jsxRuntime.jsx(
22205
- Button7,
22206
- {
22207
- "aria-label": "Remove attachment",
22208
- className: "absolute -top-1.5 -right-1.5 h-6 w-6 rounded-full opacity-0 group-hover:opacity-100",
22209
- onClick: () => attachments.remove(data.id),
22210
- size: "icon",
22211
- type: "button",
22212
- variant: "outline",
22213
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "h-3 w-3" })
22214
- }
22215
- )
22216
- ]
22217
- },
22218
- data.id
22219
- );
22220
- }
22221
- function PromptInputAttachments({
22222
- className,
22223
- children,
22224
- ...props
22225
- }) {
22226
- const attachments = usePromptInputAttachments();
22227
- const [height, setHeight] = React5.useState(0);
22228
- const contentRef = React5.useRef(null);
22229
- React5.useLayoutEffect(() => {
22230
- const el = contentRef.current;
22231
- if (!el) {
22232
- return;
22233
- }
22234
- const ro = new ResizeObserver(() => {
22235
- setHeight(el.getBoundingClientRect().height);
22236
- });
22237
- ro.observe(el);
22238
- setHeight(el.getBoundingClientRect().height);
22239
- return () => ro.disconnect();
22240
- }, []);
22241
- return /* @__PURE__ */ jsxRuntime.jsx(
22242
- "div",
22243
- {
22244
- "aria-live": "polite",
22245
- className: cn("overflow-hidden transition-[height] duration-200 ease-out", className),
22246
- style: { height: attachments.files.length ? height : 0 },
22247
- ...props,
22248
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2 p-3 pt-3", ref: contentRef, children: attachments.files.map((file) => /* @__PURE__ */ jsxRuntime.jsx(React5.Fragment, { children: children(file) }, file.id)) })
22249
- }
22250
- );
22251
- }
22252
- var PromptInputActionAddAttachments = ({
22253
- label = "Add photos or files",
22254
- ...props
22255
- }) => {
22256
- const attachments = usePromptInputAttachments();
22257
- return /* @__PURE__ */ jsxRuntime.jsxs(
22258
- DropdownMenuItem2,
22259
- {
22260
- ...props,
22261
- onSelect: (e) => {
22262
- e.preventDefault();
22263
- attachments.openFileDialog();
22264
- },
22265
- children: [
22266
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ImageIcon, { className: "mr-2 size-4" }),
22267
- " ",
22268
- label
22269
- ]
22270
- }
22271
- );
22272
- };
22273
- var PromptInput = ({
22274
- className,
22275
- accept,
22276
- multiple,
22277
- globalDrop,
22278
- syncHiddenInput,
22279
- maxFiles,
22280
- maxFileSize,
22281
- onError,
22282
- onSubmit,
22283
- ...props
22284
- }) => {
22285
- const [items, setItems] = React5.useState([]);
22286
- const inputRef = React5.useRef(null);
22287
- const anchorRef = React5.useRef(null);
22288
- const formRef = React5.useRef(null);
22289
- React5.useEffect(() => {
22290
- const root = anchorRef.current?.closest("form");
22291
- if (root instanceof HTMLFormElement) {
22292
- formRef.current = root;
22293
- }
22294
- }, []);
22295
- const openFileDialog = React5.useCallback(() => {
22296
- inputRef.current?.click();
22297
- }, []);
22298
- const matchesAccept = React5.useCallback(
22299
- (f) => {
22300
- if (!accept || accept.trim() === "") {
22301
- return true;
22302
- }
22303
- if (accept.includes("image/*")) {
22304
- return f.type.startsWith("image/");
22305
- }
22306
- return true;
22307
- },
22308
- [accept]
22309
- );
22310
- const add = React5.useCallback(
22311
- (files) => {
22312
- const incoming = Array.from(files);
22313
- const accepted = incoming.filter((f) => matchesAccept(f));
22314
- if (accepted.length === 0) {
22315
- onError?.({
22316
- code: "accept",
22317
- message: "No files match the accepted types."
22318
- });
22319
- return;
22320
- }
22321
- const withinSize = (f) => maxFileSize ? f.size <= maxFileSize : true;
22322
- const sized = accepted.filter(withinSize);
22323
- if (sized.length === 0 && accepted.length > 0) {
22324
- onError?.({
22325
- code: "max_file_size",
22326
- message: "All files exceed the maximum size."
22327
- });
22328
- return;
22329
- }
22330
- setItems((prev) => {
22331
- const capacity = typeof maxFiles === "number" ? Math.max(0, maxFiles - prev.length) : void 0;
22332
- const capped = typeof capacity === "number" ? sized.slice(0, capacity) : sized;
22333
- if (typeof capacity === "number" && sized.length > capacity) {
22334
- onError?.({
22335
- code: "max_files",
22336
- message: "Too many files. Some were not added."
22337
- });
22338
- }
22339
- const next = [];
22340
- for (const file of capped) {
22341
- next.push({
22342
- id: nanoid.nanoid(),
22343
- type: "file",
22344
- url: URL.createObjectURL(file),
22345
- mediaType: file.type,
22346
- filename: file.name
22347
- });
22348
- }
22349
- return prev.concat(next);
22350
- });
22351
- },
22352
- [matchesAccept, maxFiles, maxFileSize, onError]
22353
- );
22354
- const remove = React5.useCallback((id) => {
22355
- setItems((prev) => {
22356
- const found = prev.find((file) => file.id === id);
22357
- if (found?.url) {
22358
- URL.revokeObjectURL(found.url);
22359
- }
22360
- return prev.filter((file) => file.id !== id);
22361
- });
22362
- }, []);
22363
- const clear = React5.useCallback(() => {
22364
- setItems((prev) => {
22365
- for (const file of prev) {
22366
- if (file.url) {
22367
- URL.revokeObjectURL(file.url);
22368
- }
22369
- }
22370
- return [];
22371
- });
22372
- }, []);
22373
- React5.useEffect(() => {
22374
- if (syncHiddenInput && inputRef.current) {
22375
- if (items.length === 0) {
22376
- inputRef.current.value = "";
22377
- }
22378
- }
22379
- }, [items, syncHiddenInput]);
22380
- React5.useEffect(() => {
22381
- const form = formRef.current;
22382
- if (!form) {
22383
- return;
22384
- }
22385
- const onDragOver = (e) => {
22386
- if (e.dataTransfer?.types?.includes("Files")) {
22387
- e.preventDefault();
22388
- }
22389
- };
22390
- const onDrop = (e) => {
22391
- if (e.dataTransfer?.types?.includes("Files")) {
22392
- e.preventDefault();
22393
- }
22394
- if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) {
22395
- add(e.dataTransfer.files);
22396
- }
22397
- };
22398
- form.addEventListener("dragover", onDragOver);
22399
- form.addEventListener("drop", onDrop);
22400
- return () => {
22401
- form.removeEventListener("dragover", onDragOver);
22402
- form.removeEventListener("drop", onDrop);
22403
- };
22404
- }, [add]);
22405
- React5.useEffect(() => {
22406
- if (!globalDrop) {
22407
- return;
22408
- }
22409
- const onDragOver = (e) => {
22410
- if (e.dataTransfer?.types?.includes("Files")) {
22411
- e.preventDefault();
22412
- }
22413
- };
22414
- const onDrop = (e) => {
22415
- if (e.dataTransfer?.types?.includes("Files")) {
22416
- e.preventDefault();
22417
- }
22418
- if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) {
22419
- add(e.dataTransfer.files);
22420
- }
22421
- };
22422
- document.addEventListener("dragover", onDragOver);
22423
- document.addEventListener("drop", onDrop);
22424
- return () => {
22425
- document.removeEventListener("dragover", onDragOver);
22426
- document.removeEventListener("drop", onDrop);
22427
- };
22428
- }, [add, globalDrop]);
22429
- const handleChange = (event) => {
22430
- if (event.currentTarget.files) {
22431
- add(event.currentTarget.files);
22432
- }
22433
- };
22434
- const handleSubmit = (event) => {
22435
- event.preventDefault();
22436
- const files = items.map(({ ...item }) => ({
22437
- ...item
22438
- }));
22439
- onSubmit({ text: event.currentTarget.message.value, files }, event);
22440
- };
22441
- const ctx = React5.useMemo(
22442
- () => ({
22443
- files: items.map((item) => ({ ...item, id: item.id })),
22444
- add,
22445
- remove,
22446
- clear,
22447
- openFileDialog,
22448
- fileInputRef: inputRef
22449
- }),
22450
- [items, add, remove, clear, openFileDialog]
22451
- );
22452
- return /* @__PURE__ */ jsxRuntime.jsxs(AttachmentsContext.Provider, { value: ctx, children: [
22453
- /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "hidden", ref: anchorRef }),
22454
- /* @__PURE__ */ jsxRuntime.jsx(
22455
- "input",
22456
- {
22457
- accept,
22458
- className: "hidden",
22459
- multiple,
22460
- onChange: handleChange,
22461
- ref: inputRef,
22462
- type: "file"
22463
- }
22464
- ),
22465
- /* @__PURE__ */ jsxRuntime.jsx(
22466
- "form",
22467
- {
22468
- className: cn(
22469
- "w-full divide-y overflow-hidden rounded-sm border bg-background shadow-sm",
22470
- className
22471
- ),
22472
- onSubmit: handleSubmit,
22473
- ...props
22474
- }
22475
- )
22476
- ] });
22477
- };
22478
- var PromptInputBody = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(className, "flex flex-col"), ...props });
22479
- var PromptInputTextarea = ({
22480
- onChange,
22481
- className,
22482
- placeholder = "What would you like to know?",
22483
- ...props
22484
- }) => {
22485
- const handleKeyDown = (e) => {
22486
- if (e.key === "Enter") {
22487
- if (e.nativeEvent.isComposing) {
22488
- return;
22489
- }
22490
- if (e.shiftKey) {
22491
- return;
22492
- }
22493
- e.preventDefault();
22494
- const form = e.currentTarget.form;
22495
- if (form) {
22496
- form.requestSubmit();
22497
- }
22498
- }
22499
- };
22500
- return /* @__PURE__ */ jsxRuntime.jsx(
22501
- Textarea2,
22502
- {
22503
- className: cn(
22504
- "w-full resize-none rounded-none border-none p-3 shadow-none ring-0 outline-none",
22505
- "field-sizing-content bg-transparent dark:bg-transparent",
22506
- "max-h-48 min-h-16",
22507
- "focus-visible:ring-0",
22508
- className
22509
- ),
22510
- name: "message",
22511
- onChange: (e) => {
22512
- onChange?.(e);
22513
- },
22514
- onKeyDown: handleKeyDown,
22515
- placeholder,
22516
- ...props
22517
- }
22518
- );
22519
- };
22520
- var PromptInputToolbar = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center justify-between p-1", className), ...props });
22521
- var PromptInputTools = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
22522
- "div",
22523
- {
22524
- className: cn("flex items-center gap-1", "[&_button:first-child]:rounded-bl-xl", className),
22525
- ...props
22526
- }
22527
- );
22528
- var PromptInputButton = ({
22529
- variant = "ghost",
22530
- className,
22531
- size,
22532
- ...props
22533
- }) => {
22534
- const newSize = size ?? React5.Children.count(props.children) > 1 ? "default" : "icon";
22535
- return /* @__PURE__ */ jsxRuntime.jsx(
22536
- Button7,
22537
- {
22538
- className: cn(
22539
- "shrink-0 gap-1.5 rounded-lg",
22540
- variant === "ghost" && "text-muted-foreground",
22541
- newSize === "default" && "px-3",
22542
- className
22543
- ),
22544
- size: newSize,
22545
- type: "button",
22546
- variant,
22547
- ...props
22548
- }
22549
- );
22550
- };
22551
- var PromptInputActionMenu = (props) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2, { ...props });
22552
- var PromptInputActionMenuTrigger = ({
22553
- className,
22554
- children,
22555
- ...props
22556
- }) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger3, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(PromptInputButton, { className, ...props, children: children ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, { className: "size-4" }) }) });
22557
- var PromptInputActionMenuContent = ({
22558
- className,
22559
- ...props
22560
- }) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuContent2, { align: "start", className: cn(className), ...props });
22561
- var PromptInputActionMenuItem = ({
22562
- className,
22563
- ...props
22564
- }) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem2, { className: cn(className), ...props });
22565
- var PromptInputSubmit = ({
22566
- className,
22567
- variant = "default",
22568
- size = "icon",
22569
- status,
22570
- children,
22571
- ...props
22572
- }) => {
22573
- let Icon2 = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SendIcon, { className: "size-4" });
22574
- if (status === "submitted") {
22575
- Icon2 = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2Icon, { className: "size-4 animate-spin" });
22576
- } else if (status === "streaming") {
22577
- Icon2 = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SquareIcon, { className: "size-4" });
22578
- } else if (status === "error") {
22579
- Icon2 = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "size-4" });
22580
- }
22581
- return /* @__PURE__ */ jsxRuntime.jsx(
22582
- Button7,
22583
- {
22584
- className: cn("gap-1.5 rounded-lg", className),
22585
- size,
22586
- type: "submit",
22587
- variant,
22588
- ...props,
22589
- children: children ?? Icon2
22590
- }
22591
- );
22592
- };
22593
- var Response = React5.memo(
22594
- ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
22595
- streamdown.Streamdown,
22596
- {
22597
- className: cn("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", className),
22598
- ...props
22599
- }
22600
- ),
22601
- (prevProps, nextProps) => prevProps.children === nextProps.children
22602
- );
22603
- Response.displayName = "Response";
22604
- var ReasoningContext = React5.createContext(null);
22605
- var useReasoning = () => {
22606
- const context = React5.useContext(ReasoningContext);
22607
- if (!context) {
22608
- throw new Error("Reasoning components must be used within Reasoning");
22609
- }
22610
- return context;
22611
- };
22612
- var AUTO_CLOSE_DELAY = 1e3;
22613
- var MS_IN_S = 1e3;
22614
- var Reasoning = React5.memo(
22615
- ({
22616
- className,
22617
- isStreaming = false,
22618
- open,
22619
- defaultOpen = true,
22620
- onOpenChange,
22621
- duration: durationProp,
22622
- children,
22623
- ...props
22624
- }) => {
22625
- const [isOpen, setIsOpen] = reactUseControllableState.useControllableState({
22626
- prop: open,
22627
- defaultProp: defaultOpen,
22628
- onChange: onOpenChange
22629
- });
22630
- const [duration, setDuration] = reactUseControllableState.useControllableState({
22631
- prop: durationProp,
22632
- defaultProp: 0
22633
- });
22634
- const [hasAutoClosed, setHasAutoClosed] = React5.useState(false);
22635
- const startTimeRef = React5.useRef(null);
22636
- React5.useEffect(() => {
22637
- if (isStreaming) {
22638
- if (startTimeRef.current === null) {
22639
- startTimeRef.current = Date.now();
22640
- }
22641
- } else if (startTimeRef.current !== null) {
22642
- const elapsedSeconds = Math.ceil((Date.now() - startTimeRef.current) / MS_IN_S);
22643
- setDuration(elapsedSeconds);
22644
- startTimeRef.current = null;
22645
- }
22646
- }, [isStreaming, setDuration]);
22647
- React5.useEffect(() => {
22648
- if (defaultOpen && !isStreaming && isOpen && !hasAutoClosed) {
22649
- const timer = setTimeout(() => {
22650
- setIsOpen(false);
22651
- setHasAutoClosed(true);
22652
- }, AUTO_CLOSE_DELAY);
22653
- return () => clearTimeout(timer);
22654
- }
22655
- return () => {
22656
- };
22657
- }, [isStreaming, isOpen, defaultOpen, setIsOpen, hasAutoClosed]);
22658
- const handleOpenChange = (newOpen) => {
22659
- setIsOpen(newOpen);
22660
- };
22661
- return /* @__PURE__ */ jsxRuntime.jsx(ReasoningContext.Provider, { value: { isStreaming, isOpen, setIsOpen, duration }, children: /* @__PURE__ */ jsxRuntime.jsx(
22662
- Collapsible2,
22663
- {
22664
- className: cn("not-prose mb-4", className),
22665
- onOpenChange: handleOpenChange,
22666
- open: isOpen,
22667
- ...props,
22668
- children
22669
- }
22670
- ) });
22671
- }
22672
- );
22673
- var getThinkingMessage = (isStreaming, duration) => {
22674
- if (isStreaming || duration === 0) {
22675
- return /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Thinking..." });
22676
- }
22677
- if (duration === void 0) {
22678
- return /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Thought for a few seconds" });
22679
- }
22680
- return /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
22681
- "Thought for ",
22682
- duration,
22683
- " seconds"
22684
- ] });
22685
- };
22686
- var ReasoningTrigger = React5.memo(({ className, children, ...props }) => {
22687
- const { isStreaming, isOpen, duration } = useReasoning();
22688
- return /* @__PURE__ */ jsxRuntime.jsx(
22689
- CollapsibleTrigger4,
22690
- {
22691
- className: cn(
22692
- "flex w-full items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",
22693
- className
22694
- ),
22695
- ...props,
22696
- children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
22697
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BrainIcon, { className: "size-4" }),
22698
- getThinkingMessage(isStreaming, duration),
22699
- /* @__PURE__ */ jsxRuntime.jsx(
22700
- lucideReact.ChevronDownIcon,
22701
- {
22702
- className: cn("size-4 transition-transform", isOpen ? "rotate-180" : "rotate-0")
22703
- }
22704
- )
22705
- ] })
22706
- }
22707
- );
22708
- });
22709
- var ReasoningContent = React5.memo(({ className, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
22710
- CollapsibleContent4,
22711
- {
22712
- className: cn(
22713
- "mt-4 text-sm",
22714
- "text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:animate-in data-[state=open]:slide-in-from-top-2",
22715
- className
22716
- ),
22717
- ...props,
22718
- children: /* @__PURE__ */ jsxRuntime.jsx(Response, { className: "grid gap-2", children })
22719
- }
22720
- ));
22721
- Reasoning.displayName = "Reasoning";
22722
- ReasoningTrigger.displayName = "ReasoningTrigger";
22723
- ReasoningContent.displayName = "ReasoningContent";
22724
- var Sources = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(Collapsible2, { className: cn("not-prose mb-4 text-xs text-primary", className), ...props });
22725
- var SourcesTrigger = ({ className, count, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(CollapsibleTrigger4, { className: cn("flex items-center gap-2", className), ...props, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
22726
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "font-medium", children: [
22727
- "Used ",
22728
- count,
22729
- " sources"
22730
- ] }),
22731
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "h-4 w-4" })
22732
- ] }) });
22733
- var SourcesContent = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
22734
- CollapsibleContent4,
22735
- {
22736
- className: cn(
22737
- "mt-3 flex w-fit flex-col gap-2",
22738
- "outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:animate-in data-[state=open]:slide-in-from-top-2",
22739
- className
22740
- ),
22741
- ...props
22742
- }
22743
- );
22744
- var Source = ({ href, title, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("a", { className: "flex items-center gap-2", href, rel: "noreferrer", target: "_blank", ...props, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
22745
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BookIcon, { className: "h-4 w-4" }),
22746
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block font-medium", children: title })
22747
- ] }) });
22748
- function ScrollArea2({
22749
- className,
22750
- children,
22751
- ...props
22752
- }) {
22753
- return /* @__PURE__ */ jsxRuntime.jsxs(
22754
- ScrollAreaPrimitive__namespace.Root,
22755
- {
22756
- "data-slot": "scroll-area",
22757
- className: cn("relative", className),
22758
- ...props,
22759
- children: [
22760
- /* @__PURE__ */ jsxRuntime.jsx(
22761
- ScrollAreaPrimitive__namespace.Viewport,
22762
- {
22763
- "data-slot": "scroll-area-viewport",
22764
- className: "size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",
22765
- children
22766
- }
22767
- ),
22768
- /* @__PURE__ */ jsxRuntime.jsx(ScrollBar2, {}),
22769
- /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.Corner, {})
22770
- ]
22771
- }
22772
- );
22773
- }
22774
- function ScrollBar2({
22775
- className,
22776
- orientation = "vertical",
22777
- ...props
22778
- }) {
22779
- return /* @__PURE__ */ jsxRuntime.jsx(
22780
- ScrollAreaPrimitive__namespace.ScrollAreaScrollbar,
22781
- {
22782
- "data-slot": "scroll-area-scrollbar",
22783
- orientation,
22784
- className: cn(
22785
- "flex touch-none p-px transition-colors select-none",
22786
- orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent",
22787
- orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent",
22788
- className
22789
- ),
22790
- ...props,
22791
- children: /* @__PURE__ */ jsxRuntime.jsx(
22792
- ScrollAreaPrimitive__namespace.ScrollAreaThumb,
22793
- {
22794
- "data-slot": "scroll-area-thumb",
22795
- className: "relative flex-1 rounded-full bg-border"
22796
- }
22797
- )
22798
- }
22799
- );
22800
- }
22801
- var Suggestions = ({ className, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(ScrollArea2, { className: "w-full overflow-x-auto whitespace-nowrap", ...props, children: [
22802
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex w-max flex-nowrap items-center gap-2", className), children }),
22803
- /* @__PURE__ */ jsxRuntime.jsx(ScrollBar2, { className: "hidden", orientation: "horizontal" })
22804
- ] });
22805
- var Suggestion = ({
22806
- suggestion,
22807
- onClick,
22808
- className,
22809
- variant = "outline",
22810
- size = "sm",
22811
- children,
22812
- ...props
22813
- }) => {
22814
- const handleClick = () => {
22815
- onClick?.(suggestion);
22816
- };
22817
- return /* @__PURE__ */ jsxRuntime.jsx(
22818
- Button7,
22819
- {
22820
- className: cn("cursor-pointer rounded-full px-4", className),
22821
- onClick: handleClick,
22822
- size,
22823
- type: "button",
22824
- variant,
22825
- ...props,
22826
- children: children || suggestion
22827
- }
22828
- );
22829
- };
22830
- var TaskItemFile = ({ children, className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
22831
- "div",
22832
- {
22833
- className: cn(
22834
- "inline-flex items-center gap-1 rounded-sm border bg-secondary px-1.5 py-0.5 text-xs text-foreground",
22835
- className
22836
- ),
22837
- ...props,
22838
- children
22839
- }
22840
- );
22841
- var TaskItem = ({ children, className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("text-sm text-muted-foreground", className), ...props, children });
22842
- var Task = ({ defaultOpen = true, className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
22843
- Collapsible2,
22844
- {
22845
- className: cn(
22846
- "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:animate-in data-[state=open]:slide-in-from-top-2",
22847
- className
22848
- ),
22849
- defaultOpen,
22850
- ...props
22851
- }
22852
- );
22853
- var TaskTrigger = ({ children, className, title, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(CollapsibleTrigger4, { asChild: true, className: cn("group", className), ...props, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full cursor-pointer items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground", children: [
22854
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "size-4" }),
22855
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", children: title }),
22856
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4 transition-transform group-data-[state=open]:rotate-180" })
22857
- ] }) });
22858
- var TaskContent = ({ children, className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
22859
- CollapsibleContent4,
22860
- {
22861
- className: cn(
22862
- "text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:animate-in data-[state=open]:slide-in-from-top-2",
22863
- className
22864
- ),
22865
- ...props,
22866
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 space-y-2 border-l-2 border-muted pl-4", children })
22867
- }
22868
- );
22869
- var Tool = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(Collapsible2, { className: cn("not-prose mb-4 w-full rounded-sm border", className), ...props });
22870
- var getStatusBadge = (status) => {
22871
- const labels = {
22872
- "input-streaming": "Pending",
22873
- "input-available": "Running",
22874
- "approval-requested": "Awaiting approval",
22875
- "approval-responded": "Approval response received",
22876
- "output-available": "Completed",
22877
- "output-error": "Error",
22878
- "output-denied": "Denied"
22879
- };
22880
- const icons = {
22881
- "input-streaming": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleIcon, { className: "size-4" }),
22882
- "input-available": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ClockIcon, { className: "size-4 animate-pulse" }),
22883
- "approval-requested": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ClockIcon, { className: "size-4 animate-pulse" }),
22884
- "approval-responded": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleIcon, { className: "size-4" }),
22885
- "output-available": /* @__PURE__ */ jsxRuntime.jsx(Icons.check_circle, { className: "size-4 text-green-600" }),
22886
- "output-error": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircleIcon, { className: "size-4 text-red-600" }),
22887
- "output-denied": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircleIcon, { className: "size-4 text-red-600" })
22888
- };
22889
- return /* @__PURE__ */ jsxRuntime.jsxs(Badge2, { className: "gap-1.5 rounded-full text-xs", variant: "secondary", children: [
22890
- icons[status],
22891
- labels[status]
22892
- ] });
22893
- };
22894
- var ToolHeader = ({ className, type, state, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(
22895
- CollapsibleTrigger4,
22896
- {
22897
- className: cn("flex w-full items-center justify-between gap-4 p-3", className),
22898
- ...props,
22899
- children: [
22900
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
22901
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.WrenchIcon, { className: "size-4 text-muted-foreground" }),
22902
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: type }),
22903
- getStatusBadge(state)
22904
- ] }),
22905
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })
22906
- ]
22907
- }
22908
- );
22909
- var ToolContent = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
22910
- CollapsibleContent4,
22911
- {
22912
- className: cn(
22913
- "text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:animate-in data-[state=open]:slide-in-from-top-2",
22914
- className
22915
- ),
22916
- ...props
22917
- }
22918
- );
22919
- var ToolInput = ({ className, input, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-2 overflow-hidden p-4", className), ...props, children: [
22920
- /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-xs font-medium tracking-wide text-muted-foreground uppercase", children: "Parameters" }),
22921
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md bg-muted/50", children: /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { code: JSON.stringify(input, null, 2), language: "json" }) })
22922
- ] });
22923
- var ToolOutput = ({ className, output, errorText, ...props }) => {
22924
- if (!(output || errorText)) {
22925
- return null;
22926
- }
22927
- let Output = /* @__PURE__ */ jsxRuntime.jsx("div", { children: output });
22928
- if (typeof output === "object") {
22929
- Output = /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { code: JSON.stringify(output, null, 2), language: "json" });
22930
- } else if (typeof output === "string") {
22931
- Output = /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { code: output, language: "json" });
22932
- }
22933
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-2 p-4", className), ...props, children: [
22934
- /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-xs font-medium tracking-wide text-muted-foreground uppercase", children: errorText ? "Error" : "Result" }),
22935
- /* @__PURE__ */ jsxRuntime.jsxs(
22936
- "div",
22937
- {
22938
- className: cn(
22939
- "overflow-x-auto rounded-md text-xs [&_table]:w-full",
22940
- errorText ? "bg-destructive/10 text-destructive" : "bg-muted/50 text-foreground"
22941
- ),
22942
- children: [
22943
- errorText && /* @__PURE__ */ jsxRuntime.jsx("div", { children: errorText }),
22944
- Output
22945
- ]
22946
- }
22947
- )
22948
- ] });
22949
- };
22950
- function Input2({ className, type, ...props }) {
22951
- return /* @__PURE__ */ jsxRuntime.jsx(
22952
- "input",
22953
- {
22954
- type,
22955
- "data-slot": "input",
22956
- className: cn(
22957
- "h-9 w-full min-w-0 rounded-sm border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
22958
- "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
22959
- "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
22960
- className
22961
- ),
22962
- ...props
22963
- }
22964
- );
22965
- }
22966
- var sanitizePreviewUrl = (value) => {
22967
- if (!value) return void 0;
22968
- const trimmed = value.trim();
22969
- if (!trimmed) return void 0;
22970
- const baseOrigin = typeof window !== "undefined" ? window.location.origin : "http://localhost";
22971
- const hasExplicitScheme = /^[a-zA-Z][a-zA-Z\d+.-]*:/.test(trimmed);
22972
- const isRelativeUrl = trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("?") || trimmed.startsWith("#");
22973
- const isBareHostname = !hasExplicitScheme && !isRelativeUrl && /^[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+([/:?#].*)?$/.test(trimmed);
22974
- try {
22975
- const parsed = hasExplicitScheme ? new URL(trimmed) : isBareHostname ? new URL(`https://${trimmed}`) : new URL(trimmed, baseOrigin);
22976
- if (parsed.protocol === "http:" || parsed.protocol === "https:") {
22977
- return parsed.toString();
22978
- }
22979
- } catch {
22980
- }
22981
- return void 0;
22982
- };
22983
- var WebPreviewContext = React5.createContext(null);
22984
- var useWebPreview = () => {
22985
- const context = React5.useContext(WebPreviewContext);
22986
- if (!context) {
22987
- throw new Error("WebPreview components must be used within a WebPreview");
22988
- }
22989
- return context;
22990
- };
22991
- var WebPreview = ({
22992
- className,
22993
- children,
22994
- defaultUrl = "",
22995
- onUrlChange,
22996
- ...props
22997
- }) => {
22998
- const initialUrl = sanitizePreviewUrl(defaultUrl) ?? "";
22999
- const [url, setUrl] = React5.useState(initialUrl);
23000
- const [consoleOpen, setConsoleOpen] = React5.useState(false);
23001
- const handleUrlChange = (newUrl) => {
23002
- if (!newUrl.trim()) {
23003
- setUrl("");
23004
- onUrlChange?.("");
23005
- return;
23006
- }
23007
- const safeUrl = sanitizePreviewUrl(newUrl);
23008
- if (safeUrl === void 0) {
23009
- return;
23010
- }
23011
- setUrl(safeUrl);
23012
- onUrlChange?.(safeUrl);
23013
- };
23014
- const contextValue = {
23015
- url,
23016
- setUrl: handleUrlChange,
23017
- consoleOpen,
23018
- setConsoleOpen
23019
- };
23020
- return /* @__PURE__ */ jsxRuntime.jsx(WebPreviewContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
23021
- "div",
23022
- {
23023
- className: cn("flex size-full flex-col rounded-sm border bg-card", className),
23024
- ...props,
23025
- children
23026
- }
23027
- ) });
23028
- };
23029
- var WebPreviewNavigation = ({
23030
- className,
23031
- children,
23032
- ...props
23033
- }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center gap-1 border-b p-2", className), ...props, children });
23034
- var WebPreviewUrl = ({ value, onChange, onKeyDown, ...props }) => {
23035
- const { url, setUrl } = useWebPreview();
23036
- const handleKeyDown = (event) => {
23037
- if (event.key === "Enter") {
23038
- const target = event.target;
23039
- setUrl(target.value);
23040
- }
23041
- onKeyDown?.(event);
23042
- };
23043
- return /* @__PURE__ */ jsxRuntime.jsx(
23044
- Input2,
23045
- {
23046
- className: "h-8 flex-1 text-sm",
23047
- onChange,
23048
- onKeyDown: handleKeyDown,
23049
- placeholder: "Enter URL...",
23050
- value: value ?? url,
23051
- ...props
23052
- }
23053
- );
23054
- };
23055
- var WebPreviewBody = ({
23056
- className,
23057
- loading,
23058
- loadingFallback,
23059
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
23060
- sandbox: _sandbox,
23061
- src,
23062
- ...props
23063
- }) => {
23064
- const { url } = useWebPreview();
23065
- const safeSrc = sanitizePreviewUrl(src ?? url);
23066
- const resolvedLoadingFallback = loadingFallback ?? loading;
23067
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
23068
- /* @__PURE__ */ jsxRuntime.jsx(
23069
- "iframe",
23070
- {
23071
- className: cn("size-full", className),
23072
- sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-presentation",
23073
- src: safeSrc,
23074
- title: "Preview",
23075
- ...props
23076
- }
23077
- ),
23078
- resolvedLoadingFallback
23079
- ] });
23080
- };
23081
20597
  var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React5.useLayoutEffect : React5.useEffect;
23082
20598
  function useDisableToc() {
23083
20599
  const { setToc } = useToc();
@@ -23296,8 +20812,6 @@ exports.Accordion = Accordion;
23296
20812
  exports.AccordionContent = AccordionContent;
23297
20813
  exports.AccordionItem = AccordionItem;
23298
20814
  exports.AccordionTrigger = AccordionTrigger;
23299
- exports.Action = Action2;
23300
- exports.Actions = Actions;
23301
20815
  exports.Alert = Alert;
23302
20816
  exports.AlertDescription = AlertDescription;
23303
20817
  exports.AlertDialog = AlertDialog;
@@ -23313,13 +20827,6 @@ exports.AlertDialogTitle = AlertDialogTitle;
23313
20827
  exports.AlertDialogTrigger = AlertDialogTrigger;
23314
20828
  exports.AlertTitle = AlertTitle;
23315
20829
  exports.AreaChart = AreaChart;
23316
- exports.Artifact = Artifact;
23317
- exports.ArtifactAction = ArtifactAction;
23318
- exports.ArtifactActions = ArtifactActions;
23319
- exports.ArtifactContent = ArtifactContent;
23320
- exports.ArtifactDescription = ArtifactDescription;
23321
- exports.ArtifactHeader = ArtifactHeader;
23322
- exports.ArtifactTitle = ArtifactTitle;
23323
20830
  exports.AspectRatio = AspectRatio;
23324
20831
  exports.AuthLayout = AuthLayout;
23325
20832
  exports.AvailableChartColors = AvailableChartColors;
@@ -23331,12 +20838,6 @@ exports.BadgeButton = BadgeButton;
23331
20838
  exports.BarChart = BarChart;
23332
20839
  exports.BarList = BarList;
23333
20840
  exports.BaseColorSwatches = BaseColorSwatches;
23334
- exports.Branch = Branch;
23335
- exports.BranchMessages = BranchMessages;
23336
- exports.BranchNext = BranchNext;
23337
- exports.BranchPage = BranchPage;
23338
- exports.BranchPrevious = BranchPrevious;
23339
- exports.BranchSelector = BranchSelector;
23340
20841
  exports.Breadcrumb = Breadcrumb;
23341
20842
  exports.BreadcrumbEllipsis = BreadcrumbEllipsis;
23342
20843
  exports.BreadcrumbItem = BreadcrumbItem;
@@ -23361,13 +20862,6 @@ exports.CarouselItem = CarouselItem;
23361
20862
  exports.CarouselNext = CarouselNext;
23362
20863
  exports.CarouselPrevious = CarouselPrevious;
23363
20864
  exports.CategoryBar = CategoryBar;
23364
- exports.ChainOfThought = ChainOfThought;
23365
- exports.ChainOfThoughtContent = ChainOfThoughtContent;
23366
- exports.ChainOfThoughtHeader = ChainOfThoughtHeader;
23367
- exports.ChainOfThoughtImage = ChainOfThoughtImage;
23368
- exports.ChainOfThoughtSearchResult = ChainOfThoughtSearchResult;
23369
- exports.ChainOfThoughtSearchResults = ChainOfThoughtSearchResults;
23370
- exports.ChainOfThoughtStep = ChainOfThoughtStep;
23371
20865
  exports.ChartContainer = ChartContainer;
23372
20866
  exports.ChartLegend = ChartLegend3;
23373
20867
  exports.ChartLegendContent = ChartLegendContent;
@@ -23377,8 +20871,6 @@ exports.ChartTooltipContent = ChartTooltipContent;
23377
20871
  exports.Checkbox = Checkbox;
23378
20872
  exports.CheckboxSmall = CheckboxSmall;
23379
20873
  exports.Code = Code;
23380
- exports.CodeBlock = CodeBlock;
23381
- exports.CodeBlockCopyButton = CodeBlockCopyButton;
23382
20874
  exports.CodeDemo = CodeDemo;
23383
20875
  exports.CodeHighlight = CodeHighlight;
23384
20876
  exports.Collapsible = Collapsible;
@@ -23398,13 +20890,6 @@ exports.CommandItem = CommandItem;
23398
20890
  exports.CommandList = CommandList;
23399
20891
  exports.CommandSeparator = CommandSeparator;
23400
20892
  exports.CommandShortcut = CommandShortcut;
23401
- exports.Context = Context;
23402
- exports.ContextCacheUsage = ContextCacheUsage;
23403
- exports.ContextContent = ContextContent;
23404
- exports.ContextContentBody = ContextContentBody;
23405
- exports.ContextContentFooter = ContextContentFooter;
23406
- exports.ContextContentHeader = ContextContentHeader;
23407
- exports.ContextInputUsage = ContextInputUsage;
23408
20893
  exports.ContextMenu = ContextMenu;
23409
20894
  exports.ContextMenuCheckboxItem = ContextMenuCheckboxItem;
23410
20895
  exports.ContextMenuContent = ContextMenuContent;
@@ -23420,13 +20905,6 @@ exports.ContextMenuSub = ContextMenuSub;
23420
20905
  exports.ContextMenuSubContent = ContextMenuSubContent;
23421
20906
  exports.ContextMenuSubTrigger = ContextMenuSubTrigger;
23422
20907
  exports.ContextMenuTrigger = ContextMenuTrigger;
23423
- exports.ContextOutputUsage = ContextOutputUsage;
23424
- exports.ContextReasoningUsage = ContextReasoningUsage;
23425
- exports.ContextTrigger = ContextTrigger;
23426
- exports.Conversation = Conversation;
23427
- exports.ConversationContent = ConversationContent;
23428
- exports.ConversationEmptyState = ConversationEmptyState;
23429
- exports.ConversationScrollButton = ConversationScrollButton;
23430
20908
  exports.DataTable = DataTable;
23431
20909
  exports.DataTableColumnHeader = DataTableColumnHeader;
23432
20910
  exports.DataTableFacetedFilter = DataTableFacetedFilter;
@@ -23503,18 +20981,6 @@ exports.HoverCard = HoverCard;
23503
20981
  exports.HoverCardContent = HoverCardContent;
23504
20982
  exports.HoverCardTrigger = HoverCardTrigger;
23505
20983
  exports.Icons = Icons;
23506
- exports.Image = Image4;
23507
- exports.InlineCitation = InlineCitation;
23508
- exports.InlineCitationCard = InlineCitationCard;
23509
- exports.InlineCitationCardBody = InlineCitationCardBody;
23510
- exports.InlineCitationCardTrigger = InlineCitationCardTrigger;
23511
- exports.InlineCitationCarousel = InlineCitationCarousel;
23512
- exports.InlineCitationCarouselContent = InlineCitationCarouselContent;
23513
- exports.InlineCitationCarouselHeader = InlineCitationCarouselHeader;
23514
- exports.InlineCitationCarouselIndex = InlineCitationCarouselIndex;
23515
- exports.InlineCitationCarouselItem = InlineCitationCarouselItem;
23516
- exports.InlineCitationSource = InlineCitationSource;
23517
- exports.InlineCitationText = InlineCitationText;
23518
20984
  exports.Input = Input;
23519
20985
  exports.InputOTP = InputOTP;
23520
20986
  exports.InputOTPGroup = InputOTPGroup;
@@ -23529,7 +20995,6 @@ exports.Listbox = Listbox2;
23529
20995
  exports.ListboxDescription = ListboxDescription;
23530
20996
  exports.ListboxLabel = ListboxLabel;
23531
20997
  exports.ListboxOption = ListboxOption2;
23532
- exports.Loader = Loader;
23533
20998
  exports.Loading = Loading;
23534
20999
  exports.Logo = Logo;
23535
21000
  exports.MainNavigation = MainNavigation;
@@ -23551,8 +21016,6 @@ exports.MenubarSub = MenubarSub;
23551
21016
  exports.MenubarSubContent = MenubarSubContent;
23552
21017
  exports.MenubarSubTrigger = MenubarSubTrigger;
23553
21018
  exports.MenubarTrigger = MenubarTrigger;
23554
- exports.Message = Message;
23555
- exports.MessageContent = MessageContent;
23556
21019
  exports.MobileHeader = MobileHeader;
23557
21020
  exports.MobileSearch = MobileSearch;
23558
21021
  exports.MultiLevelPushMenu = MultiLevelPushMenu;
@@ -23579,14 +21042,6 @@ exports.NavigationMenuMainNavigation = NavigationMenuMainNavigation;
23579
21042
  exports.NavigationMenuTrigger = NavigationMenuTrigger;
23580
21043
  exports.NavigationMenuViewport = NavigationMenuViewport;
23581
21044
  exports.NotFound = NotFound;
23582
- exports.OpenIn = OpenIn;
23583
- exports.OpenInChatGPT = OpenInChatGPT;
23584
- exports.OpenInClaude = OpenInClaude;
23585
- exports.OpenInContent = OpenInContent;
23586
- exports.OpenInScira = OpenInScira;
23587
- exports.OpenInT3 = OpenInT3;
23588
- exports.OpenInTrigger = OpenInTrigger;
23589
- exports.OpenInv0 = OpenInv0;
23590
21045
  exports.PageHeading = PageHeading;
23591
21046
  exports.Pagination = Pagination;
23592
21047
  exports.PaginationGap = PaginationGap;
@@ -23604,30 +21059,12 @@ exports.PrevNextLinksPageLink = PrevNextLinksPageLink;
23604
21059
  exports.Progress = Progress;
23605
21060
  exports.ProgressBar = ProgressBar;
23606
21061
  exports.ProgressCircle = ProgressCircle;
23607
- exports.PromptInput = PromptInput;
23608
- exports.PromptInputActionAddAttachments = PromptInputActionAddAttachments;
23609
- exports.PromptInputActionMenu = PromptInputActionMenu;
23610
- exports.PromptInputActionMenuContent = PromptInputActionMenuContent;
23611
- exports.PromptInputActionMenuItem = PromptInputActionMenuItem;
23612
- exports.PromptInputActionMenuTrigger = PromptInputActionMenuTrigger;
23613
- exports.PromptInputAttachment = PromptInputAttachment;
23614
- exports.PromptInputAttachments = PromptInputAttachments;
23615
- exports.PromptInputBody = PromptInputBody;
23616
- exports.PromptInputButton = PromptInputButton;
23617
- exports.PromptInputSubmit = PromptInputSubmit;
23618
- exports.PromptInputTextarea = PromptInputTextarea;
23619
- exports.PromptInputToolbar = PromptInputToolbar;
23620
- exports.PromptInputTools = PromptInputTools;
23621
21062
  exports.Prose = Prose;
23622
21063
  exports.RadioGroup = RadioGroup2;
23623
21064
  exports.RadioGroupItem = RadioGroupItem;
23624
- exports.Reasoning = Reasoning;
23625
- exports.ReasoningContent = ReasoningContent;
23626
- exports.ReasoningTrigger = ReasoningTrigger;
23627
21065
  exports.ResizableHandle = ResizableHandle;
23628
21066
  exports.ResizablePanel = ResizablePanel;
23629
21067
  exports.ResizablePanelGroup = ResizablePanelGroup;
23630
- exports.Response = Response;
23631
21068
  exports.ScrollArea = ScrollArea;
23632
21069
  exports.ScrollBar = ScrollBar;
23633
21070
  exports.Select = Select;
@@ -23678,10 +21115,6 @@ exports.SiteSearch = SiteSearch;
23678
21115
  exports.Skeleton = Skeleton;
23679
21116
  exports.Slider = Slider;
23680
21117
  exports.Social = Social;
23681
- exports.Source = Source;
23682
- exports.Sources = Sources;
23683
- exports.SourcesContent = SourcesContent;
23684
- exports.SourcesTrigger = SourcesTrigger;
23685
21118
  exports.SparkAreaChart = SparkAreaChart;
23686
21119
  exports.SparkBarChart = SparkBarChart;
23687
21120
  exports.SparkLineChart = SparkLineChart;
@@ -23690,8 +21123,6 @@ exports.StepIndicator = StepIndicator;
23690
21123
  exports.StepNavigation = StepNavigation;
23691
21124
  exports.Strong = Strong;
23692
21125
  exports.SubmitButton = SubmitButton;
23693
- exports.Suggestion = Suggestion;
23694
- exports.Suggestions = Suggestions;
23695
21126
  exports.Switch = Switch2;
23696
21127
  exports.SwitchField = SwitchField;
23697
21128
  exports.SwitchGroup = SwitchGroup;
@@ -23710,11 +21141,6 @@ exports.Tabs = Tabs2;
23710
21141
  exports.TabsContent = TabsContent;
23711
21142
  exports.TabsList = TabsList;
23712
21143
  exports.TabsTrigger = TabsTrigger;
23713
- exports.Task = Task;
23714
- exports.TaskContent = TaskContent;
23715
- exports.TaskItem = TaskItem;
23716
- exports.TaskItemFile = TaskItemFile;
23717
- exports.TaskTrigger = TaskTrigger;
23718
21144
  exports.Text = Text;
23719
21145
  exports.TextLink = TextLink;
23720
21146
  exports.Textarea = Textarea;
@@ -23728,11 +21154,6 @@ exports.TocProvider = TocProvider;
23728
21154
  exports.Toggle = Toggle;
23729
21155
  exports.ToggleGroup = ToggleGroup;
23730
21156
  exports.ToggleGroupItem = ToggleGroupItem;
23731
- exports.Tool = Tool;
23732
- exports.ToolContent = ToolContent;
23733
- exports.ToolHeader = ToolHeader;
23734
- exports.ToolInput = ToolInput;
23735
- exports.ToolOutput = ToolOutput;
23736
21157
  exports.Tooltip = Tooltip5;
23737
21158
  exports.TooltipContent = TooltipContent;
23738
21159
  exports.TooltipProvider = TooltipProvider;
@@ -23742,10 +21163,6 @@ exports.TouchTarget = TouchTarget;
23742
21163
  exports.Tracker = Tracker;
23743
21164
  exports.TremorTooltip = Tooltip3;
23744
21165
  exports.ViewToggle = ViewToggle;
23745
- exports.WebPreview = WebPreview;
23746
- exports.WebPreviewBody = WebPreviewBody;
23747
- exports.WebPreviewNavigation = WebPreviewNavigation;
23748
- exports.WebPreviewUrl = WebPreviewUrl;
23749
21166
  exports.Wrapper = Wrapper;
23750
21167
  exports.aboriginal = aboriginal;
23751
21168
  exports.addStartStopToColorArray = addStartStopToColorArray;
@@ -23803,7 +21220,6 @@ exports.useFormField = useFormField;
23803
21220
  exports.useIsMobile = useIsMobile;
23804
21221
  exports.useOnWindowResize = useOnWindowResize;
23805
21222
  exports.usePageHeadings = usePageHeadings;
23806
- exports.usePromptInputAttachments = usePromptInputAttachments;
23807
21223
  exports.useSelectorHeight = useSelectorHeight;
23808
21224
  exports.useSidebar = useSidebar;
23809
21225
  exports.useStickyOffset = useStickyOffset;