@axtec/components 0.1.8 → 0.1.10
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/README.md +1 -0
- package/dist/components/AgentChat/AgentChat.d.ts +32 -0
- package/dist/components/AgentChat/index.d.ts +1 -0
- package/dist/components/AgentPanel/AgentPanel.d.ts +44 -0
- package/dist/components/AgentPanel/index.d.ts +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/index.css +1 -1
- package/dist/index.js +161 -157
- package/dist/index.js.map +1 -1
- package/dist/index10.js +77 -99
- package/dist/index10.js.map +1 -1
- package/dist/index11.js +91 -36
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +97 -75
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +38 -24
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +76 -16
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +24 -38
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +18 -72
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +36 -47
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +73 -13
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +47 -151
- package/dist/index19.js.map +1 -1
- package/dist/index20.js +12 -17
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +148 -40
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +18 -50
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +41 -74
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +46 -216
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +73 -46
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +212 -70
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +51 -23
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +74 -74
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +19 -28
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +2 -2
- package/dist/index30.js +62 -76
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +28 -55
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +87 -40
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +57 -45
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +40 -47
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +47 -27
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +52 -54
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +28 -49
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +54 -13
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +46 -79
- package/dist/index39.js.map +1 -1
- package/dist/index40.js +13 -49
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +80 -17
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +48 -33
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +18 -17
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +34 -15
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +16 -89
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +15 -69
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +85 -116
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +69 -40
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +120 -42
- package/dist/index49.js.map +1 -1
- package/dist/index5.js +1 -1
- package/dist/index50.js +39 -55
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +39 -11
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +53 -62
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +16 -54
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +64 -36
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +54 -66
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +37 -22
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +63 -101
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +16 -67
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +99 -213
- package/dist/index59.js.map +1 -1
- package/dist/index6.js +1 -1
- package/dist/index60.js +67 -62
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +206 -224
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +62 -96
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +233 -33
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +98 -14
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +35 -59
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +16 -59
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +57 -72
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +58 -106
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +70 -43
- package/dist/index69.js.map +1 -1
- package/dist/index7.js +157 -69
- package/dist/index7.js.map +1 -1
- package/dist/index70.js +101 -40
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +44 -72
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +47 -53
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +70 -62
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +46 -28
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +67 -13
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +35 -2263
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +17 -0
- package/dist/index77.js.map +1 -0
- package/dist/index78.js +2267 -0
- package/dist/index78.js.map +1 -0
- package/dist/index8.js +377 -70
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +60 -77
- package/dist/index9.js.map +1 -1
- package/package.json +1 -1
package/dist/index68.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index68.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index68.js","sources":["../src/components/Table/Table.tsx"],"sourcesContent":["import { cn } from '@/lib/utils'\nimport type { ReactNode } from 'react'\n\nexport interface TableColumn<T> {\n key: string\n header: string\n render?: (item: T, index: number) => ReactNode\n className?: string\n headerClassName?: string\n}\n\nexport interface TableProps<T> {\n columns: TableColumn<T>[]\n data: T[]\n keyExtractor: (item: T, index: number) => string | number\n striped?: boolean\n hoverable?: boolean\n compact?: boolean\n className?: string\n emptyMessage?: string\n}\n\nexport function Table<T>({\n columns,\n data,\n keyExtractor,\n striped = false,\n hoverable = true,\n compact = false,\n className,\n emptyMessage = 'No data available',\n}: TableProps<T>) {\n return (\n <div className={cn('overflow-x-auto', className)}>\n <table className=\"w-full text-left\">\n <thead>\n <tr className=\"border-b border-slate-200 bg-slate-50\">\n {columns.map((column) => (\n <th\n key={column.key}\n className={cn(\n 'font-semibold text-slate-700 text-sm',\n compact ? 'px-4 py-2' : 'px-6 py-3',\n column.headerClassName\n )}\n >\n {column.header}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {data.length === 0 ? (\n <tr>\n <td\n colSpan={columns.length}\n className={cn(\n 'text-center text-slate-500',\n compact ? 'px-4 py-8' : 'px-6 py-12'\n )}\n >\n {emptyMessage}\n </td>\n </tr>\n ) : (\n data.map((item, index) => (\n <tr\n key={keyExtractor(item, index)}\n className={cn(\n 'border-b border-slate-100 transition-colors duration-150',\n striped && index % 2 === 1 && 'bg-slate-50',\n hoverable && 'hover:bg-slate-50'\n )}\n >\n {columns.map((column) => (\n <td\n key={column.key}\n className={cn(\n 'text-slate-900',\n compact ? 'px-4 py-2' : 'px-6 py-4',\n column.className\n )}\n >\n {column.render\n ? column.render(item, index)\n : (item as Record<string, unknown>)[column.key] as ReactNode}\n </td>\n ))}\n </tr>\n ))\n )}\n </tbody>\n </table>\n </div>\n )\n}\n"],"names":["Table","columns","data","keyExtractor","striped","hoverable","compact","className","emptyMessage","jsx","cn","jsxs","column","item","index"],"mappings":";;AAsBO,SAASA,EAAS;AAAA,EACvB,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,WAAAC,IAAY;AAAA,EACZ,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,cAAAC,IAAe;AACjB,GAAkB;AAChB,SACE,gBAAAC,EAAC,OAAA,EAAI,WAA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ist/index69.js
CHANGED
|
@@ -1,51 +1,78 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
h1: "h1",
|
|
13
|
-
h2: "h2",
|
|
14
|
-
h3: "h3"
|
|
15
|
-
}, x = {
|
|
16
|
-
default: "text-slate-900",
|
|
17
|
-
muted: "text-slate-500",
|
|
18
|
-
primary: "text-primary-600",
|
|
19
|
-
danger: "text-red-600"
|
|
20
|
-
}, f = {
|
|
21
|
-
normal: "font-normal",
|
|
22
|
-
medium: "font-medium",
|
|
23
|
-
semibold: "font-semibold",
|
|
24
|
-
bold: "font-bold"
|
|
25
|
-
};
|
|
26
|
-
function b({
|
|
27
|
-
children: e,
|
|
28
|
-
variant: t = "body",
|
|
29
|
-
color: o = "default",
|
|
30
|
-
weight: l = "normal",
|
|
31
|
-
as: n,
|
|
32
|
-
className: m
|
|
1
|
+
import { jsxs as c, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useState as u } from "react";
|
|
3
|
+
import { TabGroup as f, TabList as m, Tab as x, TabPanels as g, TabPanel as h } from "@headlessui/react";
|
|
4
|
+
import { cn as a } from "./index3.js";
|
|
5
|
+
function j({
|
|
6
|
+
items: t,
|
|
7
|
+
defaultIndex: i = 0,
|
|
8
|
+
onChange: l,
|
|
9
|
+
variant: r = "underline",
|
|
10
|
+
fullWidth: d = !1,
|
|
11
|
+
className: n
|
|
33
12
|
}) {
|
|
34
|
-
const
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
|
|
13
|
+
const [b, p] = u(i);
|
|
14
|
+
return /* @__PURE__ */ c(
|
|
15
|
+
f,
|
|
37
16
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
17
|
+
selectedIndex: b,
|
|
18
|
+
onChange: (e) => {
|
|
19
|
+
p(e), l == null || l(e);
|
|
20
|
+
},
|
|
21
|
+
className: n,
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ s(
|
|
24
|
+
m,
|
|
25
|
+
{
|
|
26
|
+
className: a(
|
|
27
|
+
"flex",
|
|
28
|
+
r === "underline" && "border-b border-slate-200 gap-0",
|
|
29
|
+
r === "pills" && "gap-2",
|
|
30
|
+
r === "boxed" && "bg-slate-100 p-1 rounded-lg gap-1"
|
|
31
|
+
),
|
|
32
|
+
children: t.map((e) => /* @__PURE__ */ s(
|
|
33
|
+
x,
|
|
34
|
+
{
|
|
35
|
+
disabled: e.disabled,
|
|
36
|
+
className: ({ selected: o }) => a(
|
|
37
|
+
"font-medium text-sm transition-colors duration-200",
|
|
38
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2",
|
|
39
|
+
d && "flex-1",
|
|
40
|
+
e.disabled && "opacity-50 cursor-not-allowed",
|
|
41
|
+
// Underline variant
|
|
42
|
+
r === "underline" && [
|
|
43
|
+
"px-4 py-3 -mb-px border-b-2",
|
|
44
|
+
o ? "border-primary-500 text-primary-600" : "border-transparent text-slate-500 hover:text-slate-700 hover:border-slate-300"
|
|
45
|
+
],
|
|
46
|
+
// Pills variant
|
|
47
|
+
r === "pills" && [
|
|
48
|
+
"px-4 py-2 rounded-lg",
|
|
49
|
+
o ? "bg-primary-500 text-white" : "text-slate-600 hover:bg-slate-100"
|
|
50
|
+
],
|
|
51
|
+
// Boxed variant
|
|
52
|
+
r === "boxed" && [
|
|
53
|
+
"px-4 py-2 rounded-md",
|
|
54
|
+
o ? "bg-white text-slate-900 shadow-sm" : "text-slate-600 hover:text-slate-900"
|
|
55
|
+
]
|
|
56
|
+
),
|
|
57
|
+
children: e.label
|
|
58
|
+
},
|
|
59
|
+
e.key
|
|
60
|
+
))
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ s(g, { className: "mt-4", children: t.map((e) => /* @__PURE__ */ s(
|
|
64
|
+
h,
|
|
65
|
+
{
|
|
66
|
+
className: "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 rounded-lg",
|
|
67
|
+
children: e.content
|
|
68
|
+
},
|
|
69
|
+
e.key
|
|
70
|
+
)) })
|
|
71
|
+
]
|
|
45
72
|
}
|
|
46
73
|
);
|
|
47
74
|
}
|
|
48
75
|
export {
|
|
49
|
-
|
|
76
|
+
j as Tabs
|
|
50
77
|
};
|
|
51
78
|
//# sourceMappingURL=index69.js.map
|
package/dist/index69.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index69.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index69.js","sources":["../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { Tab, TabGroup, TabList, TabPanel, TabPanels } from '@headlessui/react'\nimport { cn } from '@/lib/utils'\nimport type { ReactNode } from 'react'\n\nexport interface TabItem {\n key: string\n label: string\n content: ReactNode\n disabled?: boolean\n}\n\nexport interface TabsProps {\n items: TabItem[]\n defaultIndex?: number\n onChange?: (index: number) => void\n variant?: 'underline' | 'pills' | 'boxed'\n fullWidth?: boolean\n className?: string\n}\n\nexport function Tabs({\n items,\n defaultIndex = 0,\n onChange,\n variant = 'underline',\n fullWidth = false,\n className,\n}: TabsProps) {\n const [selectedIndex, setSelectedIndex] = useState(defaultIndex)\n\n const handleChange = (index: number) => {\n setSelectedIndex(index)\n onChange?.(index)\n }\n\n return (\n <TabGroup\n selectedIndex={selectedIndex}\n onChange={handleChange}\n className={className}\n >\n <TabList\n className={cn(\n 'flex',\n variant === 'underline' && 'border-b border-slate-200 gap-0',\n variant === 'pills' && 'gap-2',\n variant === 'boxed' && 'bg-slate-100 p-1 rounded-lg gap-1'\n )}\n >\n {items.map((item) => (\n <Tab\n key={item.key}\n disabled={item.disabled}\n className={({ selected }) =>\n cn(\n 'font-medium text-sm transition-colors duration-200',\n 'focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2',\n fullWidth && 'flex-1',\n item.disabled && 'opacity-50 cursor-not-allowed',\n\n // Underline variant\n variant === 'underline' && [\n 'px-4 py-3 -mb-px border-b-2',\n selected\n ? 'border-primary-500 text-primary-600'\n : 'border-transparent text-slate-500 hover:text-slate-700 hover:border-slate-300',\n ],\n\n // Pills variant\n variant === 'pills' && [\n 'px-4 py-2 rounded-lg',\n selected\n ? 'bg-primary-500 text-white'\n : 'text-slate-600 hover:bg-slate-100',\n ],\n\n // Boxed variant\n variant === 'boxed' && [\n 'px-4 py-2 rounded-md',\n selected\n ? 'bg-white text-slate-900 shadow-sm'\n : 'text-slate-600 hover:text-slate-900',\n ]\n )\n }\n >\n {item.label}\n </Tab>\n ))}\n </TabList>\n <TabPanels className=\"mt-4\">\n {items.map((item) => (\n <TabPanel\n key={item.key}\n className=\"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 rounded-lg\"\n >\n {item.content}\n </TabPanel>\n ))}\n </TabPanels>\n </TabGroup>\n )\n}\n"],"names":["Tabs","items","defaultIndex","onChange","variant","fullWidth","className","selectedIndex","setSelectedIndex","useState","jsxs","TabGroup","index","jsx","TabList","cn","item","Tab","selected","TabPanels","TabPanel"],"mappings":";;;;AAqBO,SAASA,EAAK;AAAA,EACnB,OAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,UAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,WAAAC,IAAY;AAAA,EACZ,WAAAC;AACF,GAAc;AACZ,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAASP,CAAY;AAO/D,SACE,gBAAAQ;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,eAAAJ;AAAA,MACA,UARiB,CAACK,MAAkB;AACtC,QAAAJ,EAAiBI,CAAK,GACtBT,KAAA,QAAAA,EAAWS;AAAA,MACb;AAAA,MA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12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
container: "bg-yellow-50 border-yellow-200",
|
|
19
|
-
icon: "text-yellow-500",
|
|
20
|
-
title: "text-yellow-800",
|
|
21
|
-
content: "text-yellow-700"
|
|
22
|
-
},
|
|
23
|
-
info: {
|
|
24
|
-
container: "bg-blue-50 border-blue-200",
|
|
25
|
-
icon: "text-blue-500",
|
|
26
|
-
title: "text-blue-800",
|
|
27
|
-
content: "text-blue-700"
|
|
28
|
-
}
|
|
29
|
-
}, u = {
|
|
30
|
-
success: b,
|
|
31
|
-
error: x,
|
|
32
|
-
warning: d,
|
|
33
|
-
info: m
|
|
34
|
-
};
|
|
35
|
-
function y({
|
|
36
|
-
variant: c = "info",
|
|
37
|
-
title: o,
|
|
38
|
-
children: l,
|
|
39
|
-
onClose: i,
|
|
40
|
-
className: s
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useRef as y, useEffect as w } from "react";
|
|
3
|
+
import { Transition as E } from "@headlessui/react";
|
|
4
|
+
import { SparklesIcon as g, XMarkIcon as v, PaperAirplaneIcon as K, ChatBubbleLeftRightIcon as V } from "@heroicons/react/24/outline";
|
|
5
|
+
import { cn as s } from "./index3.js";
|
|
6
|
+
function O({
|
|
7
|
+
title: N = "AI Assistant",
|
|
8
|
+
subtitle: j = "Ask me anything",
|
|
9
|
+
messages: n = [],
|
|
10
|
+
onSendMessage: o,
|
|
11
|
+
isTyping: m = !1,
|
|
12
|
+
placeholder: I = "Type a message...",
|
|
13
|
+
buttonIcon: k,
|
|
14
|
+
open: D,
|
|
15
|
+
onOpenChange: c,
|
|
16
|
+
position: d = "bottom-right",
|
|
17
|
+
className: A
|
|
41
18
|
}) {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
19
|
+
const [R, T] = b(!1), [l, h] = b(""), u = y(null), f = y(null), a = D ?? R, x = (t) => {
|
|
20
|
+
T(t), c == null || c(t);
|
|
21
|
+
};
|
|
22
|
+
w(() => {
|
|
23
|
+
var t;
|
|
24
|
+
(t = u.current) == null || t.scrollIntoView({ behavior: "smooth" });
|
|
25
|
+
}, [n, m]), w(() => {
|
|
26
|
+
a && setTimeout(() => {
|
|
27
|
+
var t;
|
|
28
|
+
return (t = f.current) == null ? void 0 : t.focus();
|
|
29
|
+
}, 300);
|
|
30
|
+
}, [a]);
|
|
31
|
+
const p = () => {
|
|
32
|
+
const t = l.trim();
|
|
33
|
+
t && (o == null || o(t), h(""));
|
|
34
|
+
}, $ = (t) => {
|
|
35
|
+
t.key === "Enter" && !t.shiftKey && (t.preventDefault(), p());
|
|
36
|
+
}, C = d === "bottom-right" ? "right-5 bottom-5" : "left-5 bottom-5", i = d === "bottom-right" ? "origin-bottom-right" : "origin-bottom-left";
|
|
37
|
+
return /* @__PURE__ */ r("div", { className: s("fixed z-50", C, A), children: [
|
|
38
|
+
/* @__PURE__ */ e(
|
|
39
|
+
E,
|
|
40
|
+
{
|
|
41
|
+
show: a,
|
|
42
|
+
enter: "transition ease-out duration-200",
|
|
43
|
+
enterFrom: `opacity-0 scale-95 ${i}`,
|
|
44
|
+
enterTo: `opacity-100 scale-100 ${i}`,
|
|
45
|
+
leave: "transition ease-in duration-150",
|
|
46
|
+
leaveFrom: `opacity-100 scale-100 ${i}`,
|
|
47
|
+
leaveTo: `opacity-0 scale-95 ${i}`,
|
|
48
|
+
children: /* @__PURE__ */ r(
|
|
49
|
+
"div",
|
|
60
50
|
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"flex
|
|
65
|
-
"
|
|
51
|
+
className: s(
|
|
52
|
+
"absolute bottom-16 w-[360px] rounded-2xl shadow-2xl",
|
|
53
|
+
"border border-slate-200 bg-white",
|
|
54
|
+
"flex flex-col overflow-hidden",
|
|
55
|
+
d === "bottom-right" ? "right-0" : "left-0"
|
|
66
56
|
),
|
|
57
|
+
style: { height: "480px" },
|
|
67
58
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
|
|
59
|
+
/* @__PURE__ */ r("div", { className: "bg-primary-600 px-5 py-4 flex items-center justify-between flex-shrink-0", children: [
|
|
60
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
|
|
61
|
+
/* @__PURE__ */ e("div", { className: "w-8 h-8 rounded-lg bg-white/20 flex items-center justify-center", children: /* @__PURE__ */ e(g, { className: "w-4.5 h-4.5 text-white" }) }),
|
|
62
|
+
/* @__PURE__ */ r("div", { children: [
|
|
63
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-white leading-tight", children: N }),
|
|
64
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-white/70", children: j })
|
|
65
|
+
] })
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ e(
|
|
68
|
+
"button",
|
|
69
|
+
{
|
|
70
|
+
type: "button",
|
|
71
|
+
onClick: () => x(!1),
|
|
72
|
+
className: "p-1 rounded-lg text-white/70 hover:text-white hover:bg-white/10 transition-colors",
|
|
73
|
+
children: /* @__PURE__ */ e(v, { className: "w-5 h-5" })
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-3", children: [
|
|
78
|
+
n.length === 0 && /* @__PURE__ */ r("div", { className: "flex flex-col items-center justify-center h-full text-center px-6", children: [
|
|
79
|
+
/* @__PURE__ */ e("div", { className: "w-12 h-12 rounded-2xl bg-primary-50 flex items-center justify-center mb-3", children: /* @__PURE__ */ e(g, { className: "w-6 h-6 text-primary-500" }) }),
|
|
80
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-slate-700", children: "How can I help?" }),
|
|
81
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-slate-400 mt-1", children: "Send a message to get started" })
|
|
82
|
+
] }),
|
|
83
|
+
n.map((t) => /* @__PURE__ */ e(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
className: s(
|
|
87
|
+
"flex",
|
|
88
|
+
t.role === "user" ? "justify-end" : "justify-start"
|
|
89
|
+
),
|
|
90
|
+
children: /* @__PURE__ */ e(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: s(
|
|
94
|
+
"max-w-[80%] rounded-2xl px-3.5 py-2.5 text-sm leading-relaxed",
|
|
95
|
+
t.role === "user" ? "bg-primary-500 text-white rounded-br-md" : "bg-slate-100 text-slate-800 rounded-bl-md"
|
|
96
|
+
),
|
|
97
|
+
children: t.content
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
},
|
|
101
|
+
t.id
|
|
102
|
+
)),
|
|
103
|
+
m && /* @__PURE__ */ e("div", { className: "flex justify-start", children: /* @__PURE__ */ e("div", { className: "bg-slate-100 rounded-2xl rounded-bl-md px-4 py-3", children: /* @__PURE__ */ r("div", { className: "flex gap-1", children: [
|
|
104
|
+
/* @__PURE__ */ e("span", { className: "w-1.5 h-1.5 bg-slate-400 rounded-full animate-bounce", style: { animationDelay: "0ms" } }),
|
|
105
|
+
/* @__PURE__ */ e("span", { className: "w-1.5 h-1.5 bg-slate-400 rounded-full animate-bounce", style: { animationDelay: "150ms" } }),
|
|
106
|
+
/* @__PURE__ */ e("span", { className: "w-1.5 h-1.5 bg-slate-400 rounded-full animate-bounce", style: { animationDelay: "300ms" } })
|
|
107
|
+
] }) }) }),
|
|
108
|
+
/* @__PURE__ */ e("div", { ref: u })
|
|
109
|
+
] }),
|
|
110
|
+
/* @__PURE__ */ e("div", { className: "border-t border-slate-100 px-3 py-3 flex-shrink-0", children: /* @__PURE__ */ r("div", { className: "flex items-end gap-2", children: [
|
|
111
|
+
/* @__PURE__ */ e(
|
|
112
|
+
"textarea",
|
|
113
|
+
{
|
|
114
|
+
ref: f,
|
|
115
|
+
value: l,
|
|
116
|
+
onChange: (t) => h(t.target.value),
|
|
117
|
+
onKeyDown: $,
|
|
118
|
+
placeholder: I,
|
|
119
|
+
rows: 1,
|
|
120
|
+
className: s(
|
|
121
|
+
"flex-1 resize-none rounded-xl border border-slate-200 px-3.5 py-2.5",
|
|
122
|
+
"text-sm text-slate-800 placeholder:text-slate-400",
|
|
123
|
+
"focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",
|
|
124
|
+
"max-h-24"
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
/* @__PURE__ */ e(
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
type: "button",
|
|
132
|
+
onClick: p,
|
|
133
|
+
disabled: !l.trim(),
|
|
134
|
+
className: s(
|
|
135
|
+
"p-2.5 rounded-xl transition-all duration-150",
|
|
136
|
+
"focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
137
|
+
l.trim() ? "bg-primary-500 text-white hover:bg-primary-600 shadow-sm" : "bg-slate-100 text-slate-300 cursor-not-allowed"
|
|
138
|
+
),
|
|
139
|
+
children: /* @__PURE__ */ e(K, { className: "w-4 h-4" })
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
] }) })
|
|
70
143
|
]
|
|
71
144
|
}
|
|
72
145
|
)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
/* @__PURE__ */ e(
|
|
149
|
+
"button",
|
|
150
|
+
{
|
|
151
|
+
type: "button",
|
|
152
|
+
onClick: () => x(!a),
|
|
153
|
+
className: s(
|
|
154
|
+
"w-14 h-14 rounded-full shadow-lg",
|
|
155
|
+
"bg-primary-500 hover:bg-primary-600 active:bg-primary-700",
|
|
156
|
+
"text-white flex items-center justify-center",
|
|
157
|
+
"transition-all duration-200 hover:scale-105 hover:shadow-xl",
|
|
158
|
+
"focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2"
|
|
159
|
+
),
|
|
160
|
+
children: a ? /* @__PURE__ */ e(v, { className: "w-6 h-6" }) : k || /* @__PURE__ */ e(V, { className: "w-6 h-6" })
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
] });
|
|
76
164
|
}
|
|
77
165
|
export {
|
|
78
|
-
|
|
166
|
+
O as AgentChat
|
|
79
167
|
};
|
|
80
168
|
//# sourceMappingURL=index7.js.map
|
package/dist/index7.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index7.js","sources":["../src/components/Alert/Alert.tsx"],"sourcesContent":["import { cn } from '@/lib/utils'\nimport {\n CheckCircleIcon,\n ExclamationCircleIcon,\n ExclamationTriangleIcon,\n InformationCircleIcon,\n XMarkIcon,\n} from '@heroicons/react/20/solid'\nimport type { ReactNode } from 'react'\n\nexport interface AlertProps {\n variant?: 'success' | 'error' | 'warning' | 'info'\n title?: string\n children?: ReactNode\n onClose?: () => void\n className?: string\n}\n\nconst variantStyles = {\n success: {\n container: 'bg-green-50 border-green-200',\n icon: 'text-green-500',\n title: 'text-green-800',\n content: 'text-green-700',\n },\n error: {\n container: 'bg-red-50 border-red-200',\n icon: 'text-red-500',\n title: 'text-red-800',\n content: 'text-red-700',\n },\n warning: {\n container: 'bg-yellow-50 border-yellow-200',\n icon: 'text-yellow-500',\n title: 'text-yellow-800',\n content: 'text-yellow-700',\n },\n info: {\n container: 'bg-blue-50 border-blue-200',\n icon: 'text-blue-500',\n title: 'text-blue-800',\n content: 'text-blue-700',\n },\n}\n\nconst icons = {\n success: CheckCircleIcon,\n error: ExclamationCircleIcon,\n warning: ExclamationTriangleIcon,\n info: InformationCircleIcon,\n}\n\nexport function Alert({\n variant = 'info',\n title,\n children,\n onClose,\n className,\n}: AlertProps) {\n const styles = variantStyles[variant]\n const Icon = icons[variant]\n\n return (\n <div\n className={cn(\n 'flex gap-3 p-4 rounded-lg border',\n styles.container,\n className\n )}\n role=\"alert\"\n >\n <Icon className={cn('h-5 w-5 flex-shrink-0 mt-0.5', styles.icon)} />\n <div className=\"flex-1 min-w-0\">\n {title && (\n <h3 className={cn('text-sm font-semibold', styles.title)}>{title}</h3>\n )}\n {children && (\n <div className={cn('text-sm', styles.content, title && 'mt-1')}>\n {children}\n </div>\n )}\n </div>\n {onClose && (\n <button\n type=\"button\"\n onClick={onClose}\n className={cn(\n 'flex-shrink-0 p-1 rounded-lg transition-colors duration-200',\n 'hover:bg-black/5 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-slate-500'\n )}\n >\n <XMarkIcon className={cn('h-5 w-5', styles.icon)} />\n <span className=\"sr-only\">Dismiss</span>\n </button>\n )}\n </div>\n )\n}\n"],"names":["variantStyles","icons","CheckCircleIcon","ExclamationCircleIcon","ExclamationTriangleIcon","InformationCircleIcon","Alert","variant","title","children","onClose","className","styles","Icon","jsxs","cn","jsx","XMarkIcon"],"mappings":";;;AAkBA,MAAMA,IAAgB;AAAA,EACpB,SAAS;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,EAAA;AAAA,EAEX,OAAO;AAAA,IACL,WAAW;AAAA,IACX,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,EAAA;AAAA,EAEX,SAAS;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,EAAA;AAAA,EAEX,MAAM;AAAA,IACJ,WAAW;AAAA,IACX,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,EAAA;AAEb,GAEMC,IAAQ;AAAA,EACZ,SAASC;AAAA,EACT,OAAOC;AAAA,EACP,SAASC;AAAA,EACT,MAAMC;AACR;AAEO,SAASC,EAAM;AAAA,EACpB,SAAAC,IAAU;AAAA,EACV,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AACF,GAAe;AACb,QAAMC,IAASZ,EAAcO,CAAO,GAC9BM,IAAOZ,EAAMM,CAAO;AAE1B,SACE,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAH,EAAO;AAAA,QACPD;AAAA,MAAA;AAAA,MAEF,MAAK;AAAA,MAEL,UAAA;AAAA,QAAA,gBAAAK,EAACH,KAAK,WAAWE,EAAG,gCAAgCH,EAAO,IAAI,GAAG;AAAA,QAClE,gBAAAE,EAAC,OAAA,EAAI,WAAU,kBACZ,UAAA;AAAA,UAAAN,KACC,gBAAAQ,EAAC,QAAG,WAAWD,EAAG,yBAAyBH,EAAO,KAAK,GAAI,UAAAJ,EAAA,CAAM;AAAA,UAElEC,KACC,gBAAAO,EAAC,OAAA,EAAI,WAAWD,EAAG,WAAWH,EAAO,SAASJ,KAAS,MAAM,GAC1D,UAAAC,EAAA,CACH;AAAA,QAAA,GAEJ;AAAA,QACCC,KACC,gBAAAI;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,SAASJ;AAAA,YACT,WAAWK;AAAA,cACT;AAAA,cACA;AAAA,YAAA;AAAA,YAGF,UAAA;AAAA,cAAA,gBAAAC,EAACC,KAAU,WAAWF,EAAG,WAAWH,EAAO,IAAI,GAAG;AAAA,cAClD,gBAAAI,EAAC,QAAA,EAAK,WAAU,WAAU,UAAA,UAAA,CAAO;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACnC;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
1
|
+
{"version":3,"file":"index7.js","sources":["../src/components/AgentChat/AgentChat.tsx"],"sourcesContent":["import { useState, useRef, useEffect, type ReactNode, type KeyboardEvent } from 'react'\nimport { Transition } from '@headlessui/react'\nimport {\n ChatBubbleLeftRightIcon,\n XMarkIcon,\n PaperAirplaneIcon,\n SparklesIcon,\n} from '@heroicons/react/24/outline'\nimport { cn } from '@/lib/utils'\n\nexport interface AgentChatMessage {\n id: string\n role: 'user' | 'agent'\n content: string\n timestamp?: Date\n}\n\nexport interface AgentChatProps {\n /** Title shown in the chat header */\n title?: string\n /** Subtitle / agent description */\n subtitle?: string\n /** Chat messages */\n messages?: AgentChatMessage[]\n /** Called when user sends a message */\n onSendMessage?: (message: string) => void\n /** Whether the agent is currently typing */\n isTyping?: boolean\n /** Placeholder text for the input */\n placeholder?: string\n /** Custom icon for the floating button */\n buttonIcon?: ReactNode\n /** Whether the chat window is open (controlled mode) */\n open?: boolean\n /** Callback when open state changes */\n onOpenChange?: (open: boolean) => void\n /** Position of the chat bubble */\n position?: 'bottom-right' | 'bottom-left'\n /** Additional class for the container */\n className?: string\n}\n\nexport function AgentChat({\n title = 'AI Assistant',\n subtitle = 'Ask me anything',\n messages = [],\n onSendMessage,\n isTyping = false,\n placeholder = 'Type a message...',\n buttonIcon,\n open: controlledOpen,\n onOpenChange,\n position = 'bottom-right',\n className,\n}: AgentChatProps) {\n const [internalOpen, setInternalOpen] = useState(false)\n const [inputValue, setInputValue] = useState('')\n const messagesEndRef = useRef<HTMLDivElement>(null)\n const inputRef = useRef<HTMLTextAreaElement>(null)\n\n const isOpen = controlledOpen ?? internalOpen\n const setIsOpen = (value: boolean) => {\n setInternalOpen(value)\n onOpenChange?.(value)\n }\n\n useEffect(() => {\n messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' })\n }, [messages, isTyping])\n\n useEffect(() => {\n if (isOpen) {\n setTimeout(() => inputRef.current?.focus(), 300)\n }\n }, [isOpen])\n\n const handleSend = () => {\n const trimmed = inputValue.trim()\n if (!trimmed) return\n onSendMessage?.(trimmed)\n setInputValue('')\n }\n\n const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault()\n handleSend()\n }\n }\n\n const positionClasses = position === 'bottom-right'\n ? 'right-5 bottom-5'\n : 'left-5 bottom-5'\n\n const windowOrigin = position === 'bottom-right'\n ? 'origin-bottom-right'\n : 'origin-bottom-left'\n\n return (\n <div className={cn('fixed z-50', positionClasses, className)}>\n {/* Chat Window */}\n <Transition\n show={isOpen}\n enter=\"transition ease-out duration-200\"\n enterFrom={`opacity-0 scale-95 ${windowOrigin}`}\n enterTo={`opacity-100 scale-100 ${windowOrigin}`}\n leave=\"transition ease-in duration-150\"\n leaveFrom={`opacity-100 scale-100 ${windowOrigin}`}\n leaveTo={`opacity-0 scale-95 ${windowOrigin}`}\n >\n <div\n className={cn(\n 'absolute bottom-16 w-[360px] rounded-2xl shadow-2xl',\n 'border border-slate-200 bg-white',\n 'flex flex-col overflow-hidden',\n position === 'bottom-right' ? 'right-0' : 'left-0'\n )}\n style={{ height: '480px' }}\n >\n {/* Header */}\n <div className=\"bg-primary-600 px-5 py-4 flex items-center justify-between flex-shrink-0\">\n <div className=\"flex items-center gap-3\">\n <div className=\"w-8 h-8 rounded-lg bg-white/20 flex items-center justify-center\">\n <SparklesIcon className=\"w-4.5 h-4.5 text-white\" />\n </div>\n <div>\n <h3 className=\"text-sm font-semibold text-white leading-tight\">{title}</h3>\n <p className=\"text-xs text-white/70\">{subtitle}</p>\n </div>\n </div>\n <button\n type=\"button\"\n onClick={() => setIsOpen(false)}\n className=\"p-1 rounded-lg text-white/70 hover:text-white hover:bg-white/10 transition-colors\"\n >\n <XMarkIcon className=\"w-5 h-5\" />\n </button>\n </div>\n\n {/* Messages */}\n <div className=\"flex-1 overflow-y-auto px-4 py-4 space-y-3\">\n {messages.length === 0 && (\n <div className=\"flex flex-col items-center justify-center h-full text-center px-6\">\n <div className=\"w-12 h-12 rounded-2xl bg-primary-50 flex items-center justify-center mb-3\">\n <SparklesIcon className=\"w-6 h-6 text-primary-500\" />\n </div>\n <p className=\"text-sm font-medium text-slate-700\">How can I help?</p>\n <p className=\"text-xs text-slate-400 mt-1\">Send a message to get started</p>\n </div>\n )}\n {messages.map((msg) => (\n <div\n key={msg.id}\n className={cn(\n 'flex',\n msg.role === 'user' ? 'justify-end' : 'justify-start'\n )}\n >\n <div\n className={cn(\n 'max-w-[80%] rounded-2xl px-3.5 py-2.5 text-sm leading-relaxed',\n msg.role === 'user'\n ? 'bg-primary-500 text-white rounded-br-md'\n : 'bg-slate-100 text-slate-800 rounded-bl-md'\n )}\n >\n {msg.content}\n </div>\n </div>\n ))}\n {isTyping && (\n <div className=\"flex justify-start\">\n <div className=\"bg-slate-100 rounded-2xl rounded-bl-md px-4 py-3\">\n <div className=\"flex gap-1\">\n <span className=\"w-1.5 h-1.5 bg-slate-400 rounded-full animate-bounce\" style={{ animationDelay: '0ms' }} />\n <span className=\"w-1.5 h-1.5 bg-slate-400 rounded-full animate-bounce\" style={{ animationDelay: '150ms' }} />\n <span className=\"w-1.5 h-1.5 bg-slate-400 rounded-full animate-bounce\" style={{ animationDelay: '300ms' }} />\n </div>\n </div>\n </div>\n )}\n <div ref={messagesEndRef} />\n </div>\n\n {/* Input */}\n <div className=\"border-t border-slate-100 px-3 py-3 flex-shrink-0\">\n <div className=\"flex items-end gap-2\">\n <textarea\n ref={inputRef}\n value={inputValue}\n onChange={(e) => setInputValue(e.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n rows={1}\n className={cn(\n 'flex-1 resize-none rounded-xl border border-slate-200 px-3.5 py-2.5',\n 'text-sm text-slate-800 placeholder:text-slate-400',\n 'focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent',\n 'max-h-24'\n )}\n />\n <button\n type=\"button\"\n onClick={handleSend}\n disabled={!inputValue.trim()}\n className={cn(\n 'p-2.5 rounded-xl transition-all duration-150',\n 'focus:outline-none focus:ring-2 focus:ring-primary-500',\n inputValue.trim()\n ? 'bg-primary-500 text-white hover:bg-primary-600 shadow-sm'\n : 'bg-slate-100 text-slate-300 cursor-not-allowed'\n )}\n >\n <PaperAirplaneIcon className=\"w-4 h-4\" />\n </button>\n </div>\n </div>\n </div>\n </Transition>\n\n {/* Floating Button */}\n <button\n type=\"button\"\n onClick={() => setIsOpen(!isOpen)}\n className={cn(\n 'w-14 h-14 rounded-full shadow-lg',\n 'bg-primary-500 hover:bg-primary-600 active:bg-primary-700',\n 'text-white flex items-center justify-center',\n 'transition-all duration-200 hover:scale-105 hover:shadow-xl',\n 'focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2'\n )}\n >\n {isOpen ? (\n <XMarkIcon className=\"w-6 h-6\" />\n ) : (\n buttonIcon || <ChatBubbleLeftRightIcon className=\"w-6 h-6\" />\n )}\n </button>\n </div>\n )\n}\n"],"names":["AgentChat","title","subtitle","messages","onSendMessage","isTyping","placeholder","buttonIcon","controlledOpen","onOpenChange","position","className","internalOpen","setInternalOpen","useState","inputValue","setInputValue","messagesEndRef","useRef","inputRef","isOpen","setIsOpen","value","useEffect","_a","handleSend","trimmed","handleKeyDown","e","positionClasses","windowOrigin","cn","jsx","Transition","jsxs","SparklesIcon","XMarkIcon","msg","PaperAirplaneIcon","ChatBubbleLeftRightIcon"],"mappings":";;;;;AA0CO,SAASA,EAAU;AAAA,EACxB,OAAAC,IAAQ;AAAA,EACR,UAAAC,IAAW;AAAA,EACX,UAAAC,IAAW,CAAA;AAAA,EACX,eAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,aAAAC,IAAc;AAAA,EACd,YAAAC;AAAA,EACA,MAAMC;AAAA,EACN,cAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,WAAAC;AACF,GAAmB;AACjB,QAAM,CAACC,GAAcC,CAAe,IAAIC,EAAS,EAAK,GAChD,CAACC,GAAYC,CAAa,IAAIF,EAAS,EAAE,GACzCG,IAAiBC,EAAuB,IAAI,GAC5CC,IAAWD,EAA4B,IAAI,GAE3CE,IAASZ,KAAkBI,GAC3BS,IAAY,CAACC,MAAmB;AACpC,IAAAT,EAAgBS,CAAK,GACrBb,KAAA,QAAAA,EAAea;AAAA,EACjB;AAEA,EAAAC,EAAU,MAAM;;AACd,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