@copilotkit/react-ui 0.10.0-alpha.6 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/.turbo/turbo-build.log +195 -287
  2. package/CHANGELOG.md +37 -0
  3. package/package.json +3 -3
  4. package/dist/components/chat-components/chat-list.js +0 -470
  5. package/dist/components/chat-components/chat-list.js.map +0 -1
  6. package/dist/components/chat-components/chat-message-actions.js +0 -188
  7. package/dist/components/chat-components/chat-message-actions.js.map +0 -1
  8. package/dist/components/chat-components/chat-message.js +0 -431
  9. package/dist/components/chat-components/chat-message.js.map +0 -1
  10. package/dist/components/chat-components/chat-panel.js +0 -330
  11. package/dist/components/chat-components/chat-panel.js.map +0 -1
  12. package/dist/components/chat-components/chat-scroll-anchor.js +0 -65
  13. package/dist/components/chat-components/chat-scroll-anchor.js.map +0 -1
  14. package/dist/components/chat-components/clear-history.js +0 -323
  15. package/dist/components/chat-components/clear-history.js.map +0 -1
  16. package/dist/components/chat-components/copilot-chat.js +0 -876
  17. package/dist/components/chat-components/copilot-chat.js.map +0 -1
  18. package/dist/components/chat-components/default-empty-screen.js +0 -211
  19. package/dist/components/chat-components/default-empty-screen.js.map +0 -1
  20. package/dist/components/chat-components/external-link.js +0 -35
  21. package/dist/components/chat-components/external-link.js.map +0 -1
  22. package/dist/components/chat-components/markdown.js +0 -14
  23. package/dist/components/chat-components/markdown.js.map +0 -1
  24. package/dist/components/chat-components/prompt-form.js +0 -245
  25. package/dist/components/chat-components/prompt-form.js.map +0 -1
  26. package/dist/components/chat-components/theme-toggle.js +0 -158
  27. package/dist/components/chat-components/theme-toggle.js.map +0 -1
  28. package/dist/components/chat-components/toaster.js +0 -12
  29. package/dist/components/chat-components/toaster.js.map +0 -1
  30. package/dist/components/chat-components/ui/alert-dialog.js +0 -229
  31. package/dist/components/chat-components/ui/alert-dialog.js.map +0 -1
  32. package/dist/components/chat-components/ui/badge.js +0 -70
  33. package/dist/components/chat-components/ui/badge.js.map +0 -1
  34. package/dist/components/chat-components/ui/button.js +0 -105
  35. package/dist/components/chat-components/ui/button.js.map +0 -1
  36. package/dist/components/chat-components/ui/codeblock.js +0 -299
  37. package/dist/components/chat-components/ui/codeblock.js.map +0 -1
  38. package/dist/components/chat-components/ui/dialog.js +0 -198
  39. package/dist/components/chat-components/ui/dialog.js.map +0 -1
  40. package/dist/components/chat-components/ui/dropdown-menu.js +0 -153
  41. package/dist/components/chat-components/ui/dropdown-menu.js.map +0 -1
  42. package/dist/components/chat-components/ui/icons.js +0 -567
  43. package/dist/components/chat-components/ui/icons.js.map +0 -1
  44. package/dist/components/chat-components/ui/input.js +0 -80
  45. package/dist/components/chat-components/ui/input.js.map +0 -1
  46. package/dist/components/chat-components/ui/label.js +0 -80
  47. package/dist/components/chat-components/ui/label.js.map +0 -1
  48. package/dist/components/chat-components/ui/select.js +0 -196
  49. package/dist/components/chat-components/ui/select.js.map +0 -1
  50. package/dist/components/chat-components/ui/separator.js +0 -84
  51. package/dist/components/chat-components/ui/separator.js.map +0 -1
  52. package/dist/components/chat-components/ui/sheet.js +0 -189
  53. package/dist/components/chat-components/ui/sheet.js.map +0 -1
  54. package/dist/components/chat-components/ui/switch.js +0 -88
  55. package/dist/components/chat-components/ui/switch.js.map +0 -1
  56. package/dist/components/chat-components/ui/textarea.js +0 -79
  57. package/dist/components/chat-components/ui/textarea.js.map +0 -1
  58. package/dist/components/chat-components/ui/tooltip.js +0 -86
  59. package/dist/components/chat-components/ui/tooltip.js.map +0 -1
  60. package/dist/components/index.js +0 -989
  61. package/dist/components/index.js.map +0 -1
  62. package/dist/components/sidebar/copilot-sidebar-ui-provider.js +0 -984
  63. package/dist/components/sidebar/copilot-sidebar-ui-provider.js.map +0 -1
  64. package/dist/components/sidebar/copilot-sidebar.js +0 -916
  65. package/dist/components/sidebar/copilot-sidebar.js.map +0 -1
  66. package/dist/components/sidebar/sidebar-context.js +0 -14
  67. package/dist/components/sidebar/sidebar-context.js.map +0 -1
  68. package/dist/context/index.js +0 -4
  69. package/dist/context/index.js.map +0 -1
  70. package/dist/hooks/index.js +0 -4
  71. package/dist/hooks/index.js.map +0 -1
  72. package/dist/hooks/use-at-bottom.js +0 -44
  73. package/dist/hooks/use-at-bottom.js.map +0 -1
  74. package/dist/hooks/use-copy-to-clipboard.js +0 -49
  75. package/dist/hooks/use-copy-to-clipboard.js.map +0 -1
  76. package/dist/hooks/use-enter-submit.js +0 -20
  77. package/dist/hooks/use-enter-submit.js.map +0 -1
  78. package/dist/index.js +0 -989
  79. package/dist/index.js.map +0 -1
  80. package/dist/lib/utils.js +0 -64
  81. package/dist/lib/utils.js.map +0 -1
  82. package/dist/lib/utils.test.js +0 -10
  83. package/dist/lib/utils.test.js.map +0 -1
  84. package/dist/types/index.js +0 -4
  85. package/dist/types/index.js.map +0 -1
  86. package/dist/types/types.js +0 -4
  87. package/dist/types/types.js.map +0 -1
@@ -1,153 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
5
- var clsx = require('clsx');
6
- var nanoid = require('nanoid');
7
- var tailwindMerge = require('tailwind-merge');
8
- var jsxRuntime = require('react/jsx-runtime');
9
-
10
- function _interopNamespaceDefault(e) {
11
- var n = Object.create(null);
12
- if (e) {
13
- Object.keys(e).forEach(function (k) {
14
- if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: function () { return e[k]; }
19
- });
20
- }
21
- });
22
- }
23
- n.default = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
28
- var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DropdownMenuPrimitive);
29
-
30
- var __defProp = Object.defineProperty;
31
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
32
- var __hasOwnProp = Object.prototype.hasOwnProperty;
33
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
34
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
35
- var __spreadValues = (a, b) => {
36
- for (var prop in b || (b = {}))
37
- if (__hasOwnProp.call(b, prop))
38
- __defNormalProp(a, prop, b[prop]);
39
- if (__getOwnPropSymbols)
40
- for (var prop of __getOwnPropSymbols(b)) {
41
- if (__propIsEnum.call(b, prop))
42
- __defNormalProp(a, prop, b[prop]);
43
- }
44
- return a;
45
- };
46
- var __objRest = (source, exclude) => {
47
- var target = {};
48
- for (var prop in source)
49
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
50
- target[prop] = source[prop];
51
- if (source != null && __getOwnPropSymbols)
52
- for (var prop of __getOwnPropSymbols(source)) {
53
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
54
- target[prop] = source[prop];
55
- }
56
- return target;
57
- };
58
- function cn(...inputs) {
59
- return tailwindMerge.twMerge(clsx.clsx(inputs));
60
- }
61
- nanoid.customAlphabet(
62
- "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
63
- 7
64
- );
65
- var DropdownMenu = DropdownMenuPrimitive__namespace.Root;
66
- var DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
67
- var DropdownMenuGroup = DropdownMenuPrimitive__namespace.Group;
68
- var DropdownMenuPortal = DropdownMenuPrimitive__namespace.Portal;
69
- var DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
70
- var DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
71
- var DropdownMenuSubContent = React__namespace.forwardRef((_a, ref) => {
72
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
73
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.SubContent, __spreadValues({
74
- ref,
75
- className: cn(
76
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",
77
- className
78
- )
79
- }, props));
80
- });
81
- DropdownMenuSubContent.displayName = DropdownMenuPrimitive__namespace.SubContent.displayName;
82
- var DropdownMenuContent = React__namespace.forwardRef((_a, ref) => {
83
- var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest(_b, ["className", "sideOffset"]);
84
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, {
85
- children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Content, __spreadValues({
86
- ref,
87
- sideOffset,
88
- className: cn(
89
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow animate-in 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",
90
- className
91
- )
92
- }, props))
93
- });
94
- });
95
- DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
96
- var DropdownMenuItem = React__namespace.forwardRef((_a, ref) => {
97
- var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
98
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Item, __spreadValues({
99
- ref,
100
- className: cn(
101
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
102
- inset && "pl-8",
103
- className
104
- )
105
- }, props));
106
- });
107
- DropdownMenuItem.displayName = DropdownMenuPrimitive__namespace.Item.displayName;
108
- var DropdownMenuLabel = React__namespace.forwardRef((_a, ref) => {
109
- var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
110
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Label, __spreadValues({
111
- ref,
112
- className: cn(
113
- "px-2 py-1.5 text-sm font-semibold",
114
- inset && "pl-8",
115
- className
116
- )
117
- }, props));
118
- });
119
- DropdownMenuLabel.displayName = DropdownMenuPrimitive__namespace.Label.displayName;
120
- var DropdownMenuSeparator = React__namespace.forwardRef((_a, ref) => {
121
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
122
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Separator, __spreadValues({
123
- ref,
124
- className: cn("-mx-1 my-1 h-px bg-muted", className)
125
- }, props));
126
- });
127
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive__namespace.Separator.displayName;
128
- var DropdownMenuShortcut = (_a) => {
129
- var _b = _a, {
130
- className
131
- } = _b, props = __objRest(_b, [
132
- "className"
133
- ]);
134
- return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadValues({
135
- className: cn("ml-auto text-xs tracking-widest opacity-60", className)
136
- }, props));
137
- };
138
- DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
139
-
140
- exports.DropdownMenu = DropdownMenu;
141
- exports.DropdownMenuContent = DropdownMenuContent;
142
- exports.DropdownMenuGroup = DropdownMenuGroup;
143
- exports.DropdownMenuItem = DropdownMenuItem;
144
- exports.DropdownMenuLabel = DropdownMenuLabel;
145
- exports.DropdownMenuPortal = DropdownMenuPortal;
146
- exports.DropdownMenuRadioGroup = DropdownMenuRadioGroup;
147
- exports.DropdownMenuSeparator = DropdownMenuSeparator;
148
- exports.DropdownMenuShortcut = DropdownMenuShortcut;
149
- exports.DropdownMenuSub = DropdownMenuSub;
150
- exports.DropdownMenuSubContent = DropdownMenuSubContent;
151
- exports.DropdownMenuTrigger = DropdownMenuTrigger;
152
- //# sourceMappingURL=out.js.map
153
- //# sourceMappingURL=dropdown-menu.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/chat-components/ui/dropdown-menu.tsx","../../../../src/lib/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,YAAY,WAAW;AACvB,YAAY,2BAA2B;;;ACHvC,SAAS,YAA6B;AACtC,SAAS,sBAAsB;AAC/B,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;AAEO,IAAM,SAAS;AAAA,EACpB;AAAA,EACA;AACF;;;ADYE;AAvBF;AAOA,IAAM,eAAqC;AAE3C,IAAM,sBAA4C;AAElD,IAAM,oBAA0C;AAEhD,IAAM,qBAA2C;AAEjD,IAAM,kBAAwC;AAE9C,IAAM,yBAA+C;AAErD,IAAM,yBAA+B,iBAGnC,CAAC,IAAyB,QAAK;AAA9B,eAAE,YAtBL,IAsBG,IAAgB,kBAAhB,IAAgB,CAAd;AACH,6BAAuB,kCAAtB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,KACI,MACN;AAAA,CACD;AACD,uBAAuB,cACC,iCAAW;AAEnC,IAAM,sBAA4B,iBAGhC,CAAC,IAAyC,QAAK;AAA9C,eAAE,aAAW,aAAa,EAtC7B,IAsCG,IAAgC,kBAAhC,IAAgC,CAA9B,aAAW;AACd,6BAAuB,8BAAtB;AAAA,IACC,8BAAuB,+BAAtB;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,OACI,MACN;AAAA,GACF;AAAA,CACD;AACD,oBAAoB,cAAoC,8BAAQ;AAEhE,IAAM,mBAAyB,iBAK7B,CAAC,IAAgC,QAAK;AAArC,eAAE,aAAW,MA1DhB,IA0DG,IAAuB,kBAAvB,IAAuB,CAArB,aAAW;AACd,6BAAuB,4BAAtB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA,SAAS;AAAA,MACT;AAAA,IACF;AAAA,KACI,MACN;AAAA,CACD;AACD,iBAAiB,cAAoC,2BAAK;AAE1D,IAAM,oBAA0B,iBAK9B,CAAC,IAAgC,QAAK;AAArC,eAAE,aAAW,MA5EhB,IA4EG,IAAuB,kBAAvB,IAAuB,CAArB,aAAW;AACd,6BAAuB,6BAAtB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA,SAAS;AAAA,MACT;AAAA,IACF;AAAA,KACI,MACN;AAAA,CACD;AACD,kBAAkB,cAAoC,4BAAM;AAE5D,IAAM,wBAA8B,iBAGlC,CAAC,IAAyB,QAAK;AAA9B,eAAE,YA5FL,IA4FG,IAAgB,kBAAhB,IAAgB,CAAd;AACH,6BAAuB,iCAAtB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,4BAA4B,SAAS;AAAA,KAC/C,MACN;AAAA,CACD;AACD,sBAAsB,cAAoC,gCAAU;AAEpE,IAAM,uBAAuB,CAAC,OAGe;AAHf,eAC5B;AAAA;AAAA,EAtGF,IAqG8B,IAEzB,kBAFyB,IAEzB;AAAA,IADH;AAAA;AAGA,SACE,oBAAC;AAAA,IACC,WAAW,GAAG,8CAA8C,SAAS;AAAA,KACjE,MACN;AAEJ;AACA,qBAAqB,cAAc","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\n\nimport { cn } from \"../../../lib/utils\";\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow animate-in 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\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"px-2 py-1.5 text-sm font-semibold\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)}\n {...props}\n />\n );\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuRadioGroup,\n};\n","import { clsx, type ClassValue } from \"clsx\";\nimport { customAlphabet } from \"nanoid\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const nanoid = customAlphabet(\n \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\",\n 7\n); // 7-character random string\n\nexport async function fetcher<JSON = any>(\n input: RequestInfo,\n init?: RequestInit\n): Promise<JSON> {\n const res = await fetch(input, init);\n\n if (!res.ok) {\n const json = await res.json();\n if (json.error) {\n const error = new Error(json.error) as Error & {\n status: number;\n };\n error.status = res.status;\n throw error;\n } else {\n throw new Error(\"An unexpected error occurred\");\n }\n }\n\n return res.json();\n}\n\nexport function formatDate(input: string | number | Date): string {\n const date = new Date(input);\n return date.toLocaleDateString(\"en-US\", {\n month: \"long\",\n day: \"numeric\",\n year: \"numeric\",\n });\n}\n"]}