@alquimia-ai/ui 1.0.3
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 +42 -0
- package/dist/chunk-6EP6KTGV.mjs +1529 -0
- package/dist/chunk-6EP6KTGV.mjs.map +1 -0
- package/dist/chunk-HGMICDIH.mjs +21 -0
- package/dist/chunk-HGMICDIH.mjs.map +1 -0
- package/dist/index.d.mts +653 -0
- package/dist/index.d.ts +653 -0
- package/dist/index.js +4344 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1663 -0
- package/dist/index.mjs.map +1 -0
- package/dist/pdf-viewer-J3ENKRHZ.mjs +177 -0
- package/dist/pdf-viewer-J3ENKRHZ.mjs.map +1 -0
- package/dist/plain-text-viewer-Q3O4LAOE.mjs +244 -0
- package/dist/plain-text-viewer-Q3O4LAOE.mjs.map +1 -0
- package/package.json +93 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1663 @@
|
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
9
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
10
|
+
try {
|
|
11
|
+
var info = gen[key](arg);
|
|
12
|
+
var value = info.value;
|
|
13
|
+
} catch (error) {
|
|
14
|
+
reject(error);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (info.done) {
|
|
18
|
+
resolve(value);
|
|
19
|
+
} else {
|
|
20
|
+
Promise.resolve(value).then(_next, _throw);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function _async_to_generator(fn) {
|
|
24
|
+
return function() {
|
|
25
|
+
var self = this, args = arguments;
|
|
26
|
+
return new Promise(function(resolve, reject) {
|
|
27
|
+
var gen = fn.apply(self, args);
|
|
28
|
+
function _next(value) {
|
|
29
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
30
|
+
}
|
|
31
|
+
function _throw(err) {
|
|
32
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
33
|
+
}
|
|
34
|
+
_next(undefined);
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function _define_property(obj, key, value) {
|
|
39
|
+
if (key in obj) {
|
|
40
|
+
Object.defineProperty(obj, key, {
|
|
41
|
+
value: value,
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
obj[key] = value;
|
|
48
|
+
}
|
|
49
|
+
return obj;
|
|
50
|
+
}
|
|
51
|
+
function _extends() {
|
|
52
|
+
_extends = Object.assign || function(target) {
|
|
53
|
+
for(var i = 1; i < arguments.length; i++){
|
|
54
|
+
var source = arguments[i];
|
|
55
|
+
for(var key in source){
|
|
56
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
57
|
+
target[key] = source[key];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return target;
|
|
62
|
+
};
|
|
63
|
+
return _extends.apply(this, arguments);
|
|
64
|
+
}
|
|
65
|
+
function _iterable_to_array_limit(arr, i) {
|
|
66
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
67
|
+
if (_i == null) return;
|
|
68
|
+
var _arr = [];
|
|
69
|
+
var _n = true;
|
|
70
|
+
var _d = false;
|
|
71
|
+
var _s, _e;
|
|
72
|
+
try {
|
|
73
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
74
|
+
_arr.push(_s.value);
|
|
75
|
+
if (i && _arr.length === i) break;
|
|
76
|
+
}
|
|
77
|
+
} catch (err) {
|
|
78
|
+
_d = true;
|
|
79
|
+
_e = err;
|
|
80
|
+
} finally{
|
|
81
|
+
try {
|
|
82
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
83
|
+
} finally{
|
|
84
|
+
if (_d) throw _e;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return _arr;
|
|
88
|
+
}
|
|
89
|
+
function _non_iterable_rest() {
|
|
90
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
91
|
+
}
|
|
92
|
+
function _object_destructuring_empty(o) {
|
|
93
|
+
if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
|
|
94
|
+
return o;
|
|
95
|
+
}
|
|
96
|
+
function _object_spread(target) {
|
|
97
|
+
for(var i = 1; i < arguments.length; i++){
|
|
98
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
99
|
+
var ownKeys = Object.keys(source);
|
|
100
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
101
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
102
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
ownKeys.forEach(function(key) {
|
|
106
|
+
_define_property(target, key, source[key]);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return target;
|
|
110
|
+
}
|
|
111
|
+
function ownKeys(object, enumerableOnly) {
|
|
112
|
+
var keys = Object.keys(object);
|
|
113
|
+
if (Object.getOwnPropertySymbols) {
|
|
114
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
115
|
+
if (enumerableOnly) {
|
|
116
|
+
symbols = symbols.filter(function(sym) {
|
|
117
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
keys.push.apply(keys, symbols);
|
|
121
|
+
}
|
|
122
|
+
return keys;
|
|
123
|
+
}
|
|
124
|
+
function _object_spread_props(target, source) {
|
|
125
|
+
source = source != null ? source : {};
|
|
126
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
127
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
128
|
+
} else {
|
|
129
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
130
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return target;
|
|
134
|
+
}
|
|
135
|
+
function _object_without_properties(source, excluded) {
|
|
136
|
+
if (source == null) return {};
|
|
137
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
138
|
+
var key, i;
|
|
139
|
+
if (Object.getOwnPropertySymbols) {
|
|
140
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
141
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
142
|
+
key = sourceSymbolKeys[i];
|
|
143
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
144
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
145
|
+
target[key] = source[key];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return target;
|
|
149
|
+
}
|
|
150
|
+
function _object_without_properties_loose(source, excluded) {
|
|
151
|
+
if (source == null) return {};
|
|
152
|
+
var target = {};
|
|
153
|
+
var sourceKeys = Object.keys(source);
|
|
154
|
+
var key, i;
|
|
155
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
156
|
+
key = sourceKeys[i];
|
|
157
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
158
|
+
target[key] = source[key];
|
|
159
|
+
}
|
|
160
|
+
return target;
|
|
161
|
+
}
|
|
162
|
+
function _sliced_to_array(arr, i) {
|
|
163
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
164
|
+
}
|
|
165
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
166
|
+
if (!o) return;
|
|
167
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
168
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
169
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
170
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
171
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
172
|
+
}
|
|
173
|
+
function _ts_generator(thisArg, body) {
|
|
174
|
+
var f, y, t, g, _ = {
|
|
175
|
+
label: 0,
|
|
176
|
+
sent: function() {
|
|
177
|
+
if (t[0] & 1) throw t[1];
|
|
178
|
+
return t[1];
|
|
179
|
+
},
|
|
180
|
+
trys: [],
|
|
181
|
+
ops: []
|
|
182
|
+
};
|
|
183
|
+
return g = {
|
|
184
|
+
next: verb(0),
|
|
185
|
+
"throw": verb(1),
|
|
186
|
+
"return": verb(2)
|
|
187
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
188
|
+
return this;
|
|
189
|
+
}), g;
|
|
190
|
+
function verb(n) {
|
|
191
|
+
return function(v) {
|
|
192
|
+
return step([
|
|
193
|
+
n,
|
|
194
|
+
v
|
|
195
|
+
]);
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function step(op) {
|
|
199
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
200
|
+
while(_)try {
|
|
201
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
202
|
+
if (y = 0, t) op = [
|
|
203
|
+
op[0] & 2,
|
|
204
|
+
t.value
|
|
205
|
+
];
|
|
206
|
+
switch(op[0]){
|
|
207
|
+
case 0:
|
|
208
|
+
case 1:
|
|
209
|
+
t = op;
|
|
210
|
+
break;
|
|
211
|
+
case 4:
|
|
212
|
+
_.label++;
|
|
213
|
+
return {
|
|
214
|
+
value: op[1],
|
|
215
|
+
done: false
|
|
216
|
+
};
|
|
217
|
+
case 5:
|
|
218
|
+
_.label++;
|
|
219
|
+
y = op[1];
|
|
220
|
+
op = [
|
|
221
|
+
0
|
|
222
|
+
];
|
|
223
|
+
continue;
|
|
224
|
+
case 7:
|
|
225
|
+
op = _.ops.pop();
|
|
226
|
+
_.trys.pop();
|
|
227
|
+
continue;
|
|
228
|
+
default:
|
|
229
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
230
|
+
_ = 0;
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
234
|
+
_.label = op[1];
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
238
|
+
_.label = t[1];
|
|
239
|
+
t = op;
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
if (t && _.label < t[2]) {
|
|
243
|
+
_.label = t[2];
|
|
244
|
+
_.ops.push(op);
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
if (t[2]) _.ops.pop();
|
|
248
|
+
_.trys.pop();
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
op = body.call(thisArg, _);
|
|
252
|
+
} catch (e) {
|
|
253
|
+
op = [
|
|
254
|
+
6,
|
|
255
|
+
e
|
|
256
|
+
];
|
|
257
|
+
y = 0;
|
|
258
|
+
} finally{
|
|
259
|
+
f = t = 0;
|
|
260
|
+
}
|
|
261
|
+
if (op[0] & 5) throw op[1];
|
|
262
|
+
return {
|
|
263
|
+
value: op[0] ? op[1] : void 0,
|
|
264
|
+
done: true
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
import "./chunk-HGMICDIH.mjs";
|
|
269
|
+
import { Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, Input, Label, Loader, Popover, PopoverContent, PopoverTrigger, RichText, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Skeleton, Slider, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Toaster, Toggle, Typography, badgeVariants, blobToBase64, buttonVariants, cn, getCookies, parseTextToSpeech, reducer, toast, toggleVariants, truncateString, useToast } from "./chunk-6EP6KTGV.mjs";
|
|
270
|
+
// src/components/templates/messages-window.tsx
|
|
271
|
+
import { forwardRef } from "react";
|
|
272
|
+
var MessagesWindow = forwardRef(function(_param, ref) {
|
|
273
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
274
|
+
"className"
|
|
275
|
+
]);
|
|
276
|
+
return /* @__PURE__ */ React.createElement("div", _object_spread({
|
|
277
|
+
className: cn(className, "alq--messages--window")
|
|
278
|
+
}, props));
|
|
279
|
+
});
|
|
280
|
+
MessagesWindow.displayName = "MessagesWindow";
|
|
281
|
+
// src/components/templates/query-box.tsx
|
|
282
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
283
|
+
var QueryBox = forwardRef2(function(_param, ref) {
|
|
284
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
285
|
+
"className"
|
|
286
|
+
]);
|
|
287
|
+
return /* @__PURE__ */ React.createElement("div", _object_spread({
|
|
288
|
+
className: cn(className, "alq--querybox")
|
|
289
|
+
}, props));
|
|
290
|
+
});
|
|
291
|
+
QueryBox.displayName = "QueryBox";
|
|
292
|
+
// src/components/templates/hero/index.tsx
|
|
293
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
294
|
+
var Hero = forwardRef3(function(_param, ref) {
|
|
295
|
+
var className = _param.className, children = _param.children, props = _object_without_properties(_param, [
|
|
296
|
+
"className",
|
|
297
|
+
"children"
|
|
298
|
+
]);
|
|
299
|
+
return /* @__PURE__ */ React.createElement("div", _object_spread({
|
|
300
|
+
ref: ref,
|
|
301
|
+
className: cn("alq--hero-container", "grid", className)
|
|
302
|
+
}, props), children);
|
|
303
|
+
});
|
|
304
|
+
var HeroContent = forwardRef3(function(_param, ref) {
|
|
305
|
+
var className = _param.className, children = _param.children, props = _object_without_properties(_param, [
|
|
306
|
+
"className",
|
|
307
|
+
"children"
|
|
308
|
+
]);
|
|
309
|
+
return /* @__PURE__ */ React.createElement("div", _object_spread({
|
|
310
|
+
ref: ref,
|
|
311
|
+
className: cn("alq--hero-container", className)
|
|
312
|
+
}, props), children);
|
|
313
|
+
});
|
|
314
|
+
Hero.displayName = "Hero";
|
|
315
|
+
HeroContent.displayName = "HeroContent";
|
|
316
|
+
// src/components/templates/cards/with-image-heading-description.tsx
|
|
317
|
+
var CardWithImageHeadingDescriptionVertical = function(props) {
|
|
318
|
+
var showBorder = props.showBorder, image = props.image, heading = props.heading, description = props.description;
|
|
319
|
+
return /* @__PURE__ */ React.createElement(Card, {
|
|
320
|
+
className: cn("w-[360px]", !showBorder && "border-none shadow-none")
|
|
321
|
+
}, image, /* @__PURE__ */ React.createElement(CardHeader, null, /* @__PURE__ */ React.createElement(CardTitle, null, heading), /* @__PURE__ */ React.createElement(Typography, {
|
|
322
|
+
typeStyle: "small",
|
|
323
|
+
className: "text-font-weak-color"
|
|
324
|
+
}, description)), /* @__PURE__ */ React.createElement(CardContent, null));
|
|
325
|
+
};
|
|
326
|
+
var CardImageWithHeadingAndDescriptionHorizontal = function(props) {
|
|
327
|
+
var showBorder = props.showBorder, image = props.image, heading = props.heading, description = props.description;
|
|
328
|
+
return /* @__PURE__ */ React.createElement(Card, {
|
|
329
|
+
className: cn("lg:w-[600px] w-[360px] lg:flex lg:h-[150px]", !showBorder && "border-none shadow-none ")
|
|
330
|
+
}, image, /* @__PURE__ */ React.createElement(CardHeader, null, /* @__PURE__ */ React.createElement(CardTitle, null, heading), /* @__PURE__ */ React.createElement(Typography, {
|
|
331
|
+
typeStyle: "small",
|
|
332
|
+
className: "text-font-weak-color"
|
|
333
|
+
}, description)), /* @__PURE__ */ React.createElement(CardContent, null));
|
|
334
|
+
};
|
|
335
|
+
// src/components/templates/cards/with-image-heading-description-avatar.tsx
|
|
336
|
+
var AvatarInfo = function(props) {
|
|
337
|
+
var userName = props.userName, email = props.email, avatarImage = props.avatarImage;
|
|
338
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
339
|
+
className: "flex space-x-2 items-center"
|
|
340
|
+
}, /* @__PURE__ */ React.createElement(Avatar, {
|
|
341
|
+
className: "w-16 h-16"
|
|
342
|
+
}, /* @__PURE__ */ React.createElement(AvatarImage, {
|
|
343
|
+
src: avatarImage
|
|
344
|
+
})), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Typography, {
|
|
345
|
+
typeStyle: "small",
|
|
346
|
+
className: "font-semibold"
|
|
347
|
+
}, userName), /* @__PURE__ */ React.createElement(Typography, {
|
|
348
|
+
typeStyle: "tiny",
|
|
349
|
+
className: "text-font-weak-color"
|
|
350
|
+
}, email)));
|
|
351
|
+
};
|
|
352
|
+
var CardWithImageHeadingDescriptionAvatarVertical = function(props) {
|
|
353
|
+
var showBorder = props.showBorder, image = props.image, heading = props.heading, description = props.description;
|
|
354
|
+
return /* @__PURE__ */ React.createElement(Card, {
|
|
355
|
+
className: cn("w-[360px]", !showBorder && "border-none shadow-none")
|
|
356
|
+
}, image, /* @__PURE__ */ React.createElement(CardHeader, null, /* @__PURE__ */ React.createElement(CardTitle, null, heading), /* @__PURE__ */ React.createElement(Typography, {
|
|
357
|
+
typeStyle: "small",
|
|
358
|
+
className: "text-font-weak-color"
|
|
359
|
+
}, description)), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(AvatarInfo, _object_spread({}, props))));
|
|
360
|
+
};
|
|
361
|
+
var CardImageWithHeadingAndDescriptionAvatarHorizontal = function(props) {
|
|
362
|
+
var showBorder = props.showBorder, image = props.image, heading = props.heading, description = props.description;
|
|
363
|
+
return /* @__PURE__ */ React.createElement(Card, {
|
|
364
|
+
className: cn("lg:w-[600px] w-[360px] lg:flex lg:h-[246px]", !showBorder && "border-none shadow-none ")
|
|
365
|
+
}, image, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(CardHeader, null, /* @__PURE__ */ React.createElement(CardTitle, null, heading), /* @__PURE__ */ React.createElement(Typography, {
|
|
366
|
+
typeStyle: "small",
|
|
367
|
+
className: "text-font-weak-color"
|
|
368
|
+
}, description)), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(AvatarInfo, _object_spread({}, props)))));
|
|
369
|
+
};
|
|
370
|
+
// src/components/organisms/whisper.tsx
|
|
371
|
+
import { useState, useEffect } from "react";
|
|
372
|
+
import { AudioLinesIcon, PlayCircleIcon, LoaderPinwheelIcon } from "lucide-react";
|
|
373
|
+
function Whisper(param) {
|
|
374
|
+
var className = param.className, message = param.message, isMessageStreaming = param.isMessageStreaming, textToSpeech = param.textToSpeech;
|
|
375
|
+
var _useState = _sliced_to_array(useState(null), 2), audioUrl = _useState[0], setAudioUrl = _useState[1];
|
|
376
|
+
var _useState1 = _sliced_to_array(useState(false), 2), isPlaying = _useState1[0], setIsPlaying = _useState1[1];
|
|
377
|
+
var _useState2 = _sliced_to_array(useState(false), 2), isLoading = _useState2[0], setIsLoading = _useState2[1];
|
|
378
|
+
var content = message.content;
|
|
379
|
+
useEffect(function() {
|
|
380
|
+
if (audioUrl) {
|
|
381
|
+
var handlePlaying = function() {
|
|
382
|
+
return setIsPlaying(true);
|
|
383
|
+
};
|
|
384
|
+
var handlePause = function() {
|
|
385
|
+
return setIsPlaying(false);
|
|
386
|
+
};
|
|
387
|
+
var handleEnded = function() {
|
|
388
|
+
return setIsPlaying(false);
|
|
389
|
+
};
|
|
390
|
+
audioUrl.addEventListener("playing", handlePlaying);
|
|
391
|
+
audioUrl.addEventListener("pause", handlePause);
|
|
392
|
+
audioUrl.addEventListener("ended", handleEnded);
|
|
393
|
+
return function() {
|
|
394
|
+
audioUrl.removeEventListener("playing", handlePlaying);
|
|
395
|
+
audioUrl.removeEventListener("pause", handlePause);
|
|
396
|
+
audioUrl.removeEventListener("ended", handleEnded);
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
}, [
|
|
400
|
+
audioUrl
|
|
401
|
+
]);
|
|
402
|
+
var resetAudio = function() {
|
|
403
|
+
audioUrl && (audioUrl.currentTime = 0);
|
|
404
|
+
audioUrl === null || audioUrl === void 0 ? void 0 : audioUrl.pause();
|
|
405
|
+
};
|
|
406
|
+
var handleAudioPlay = function() {
|
|
407
|
+
return isPlaying ? resetAudio() : audioUrl === null || audioUrl === void 0 ? void 0 : audioUrl.play();
|
|
408
|
+
};
|
|
409
|
+
var handleTextToSpeech = /*#__PURE__*/ function() {
|
|
410
|
+
var _ref = _async_to_generator(function(content2) {
|
|
411
|
+
var filteredContent, audioFile, url, audio;
|
|
412
|
+
return _ts_generator(this, function(_state) {
|
|
413
|
+
switch(_state.label){
|
|
414
|
+
case 0:
|
|
415
|
+
if (!!audioUrl) return [
|
|
416
|
+
3,
|
|
417
|
+
2
|
|
418
|
+
];
|
|
419
|
+
setIsLoading(true);
|
|
420
|
+
filteredContent = parseTextToSpeech(content2);
|
|
421
|
+
return [
|
|
422
|
+
4,
|
|
423
|
+
textToSpeech(filteredContent)
|
|
424
|
+
];
|
|
425
|
+
case 1:
|
|
426
|
+
audioFile = _state.sent();
|
|
427
|
+
if (audioFile) {
|
|
428
|
+
url = URL.createObjectURL(audioFile);
|
|
429
|
+
audio = new Audio(url);
|
|
430
|
+
setIsLoading(false);
|
|
431
|
+
audio.play();
|
|
432
|
+
setAudioUrl(audio);
|
|
433
|
+
}
|
|
434
|
+
return [
|
|
435
|
+
3,
|
|
436
|
+
3
|
|
437
|
+
];
|
|
438
|
+
case 2:
|
|
439
|
+
setIsLoading(false);
|
|
440
|
+
handleAudioPlay();
|
|
441
|
+
_state.label = 3;
|
|
442
|
+
case 3:
|
|
443
|
+
return [
|
|
444
|
+
2
|
|
445
|
+
];
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
return function handleTextToSpeech(content2) {
|
|
450
|
+
return _ref.apply(this, arguments);
|
|
451
|
+
};
|
|
452
|
+
}();
|
|
453
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
454
|
+
className: cn(className)
|
|
455
|
+
}, isMessageStreaming && /* @__PURE__ */ React.createElement("div", {
|
|
456
|
+
className: "p-2 w-[24px] h-[24px]"
|
|
457
|
+
}), !isMessageStreaming && /* @__PURE__ */ React.createElement("div", {
|
|
458
|
+
onClick: function() {
|
|
459
|
+
return handleTextToSpeech(content);
|
|
460
|
+
}
|
|
461
|
+
}, isPlaying && /* @__PURE__ */ React.createElement("button", {
|
|
462
|
+
className: "p-2 items-center justify-center"
|
|
463
|
+
}, /* @__PURE__ */ React.createElement(AudioLinesIcon, {
|
|
464
|
+
size: 20
|
|
465
|
+
})), isLoading && /* @__PURE__ */ React.createElement("button", {
|
|
466
|
+
className: "p-2 items-center justify-center"
|
|
467
|
+
}, " ", /* @__PURE__ */ React.createElement(LoaderPinwheelIcon, {
|
|
468
|
+
size: 20,
|
|
469
|
+
className: "circular-animation"
|
|
470
|
+
})), !isLoading && !isPlaying && /* @__PURE__ */ React.createElement("button", {
|
|
471
|
+
disabled: isLoading,
|
|
472
|
+
className: "p-2 items-center justify-center"
|
|
473
|
+
}, /* @__PURE__ */ React.createElement(PlayCircleIcon, {
|
|
474
|
+
size: 20
|
|
475
|
+
}))));
|
|
476
|
+
}
|
|
477
|
+
// src/components/organisms/speechToText.tsx
|
|
478
|
+
import { useState as useState2, useEffect as useEffect2 } from "react";
|
|
479
|
+
function SpeechToText(_param) {
|
|
480
|
+
var className = _param.className, speechToText = _param.speechToText, RecordAudioIcon = _param.RecordAudioIcon, IdleAudioIcon = _param.IdleAudioIcon, handleReplaceInput = _param.handleReplaceInput, setIsAudioRecording = _param.setIsAudioRecording, props = _object_without_properties(_param, [
|
|
481
|
+
"className",
|
|
482
|
+
"speechToText",
|
|
483
|
+
"RecordAudioIcon",
|
|
484
|
+
"IdleAudioIcon",
|
|
485
|
+
"handleReplaceInput",
|
|
486
|
+
"setIsAudioRecording"
|
|
487
|
+
]);
|
|
488
|
+
var _useState2 = _sliced_to_array(useState2(false), 2), isRecording = _useState2[0], setIsRecording = _useState2[1];
|
|
489
|
+
var _useState21 = _sliced_to_array(useState2(false), 2), isLoading = _useState21[0], setIsLoading = _useState21[1];
|
|
490
|
+
var _useState22 = _sliced_to_array(useState2(null), 2), mediaRecorder = _useState22[0], setMediaRecorder = _useState22[1];
|
|
491
|
+
var _useState23 = _sliced_to_array(useState2(null), 2), audioBlob = _useState23[0], setAudioBlob = _useState23[1];
|
|
492
|
+
var startRecording = /*#__PURE__*/ function() {
|
|
493
|
+
var _ref = _async_to_generator(function() {
|
|
494
|
+
var stream, recorder;
|
|
495
|
+
return _ts_generator(this, function(_state) {
|
|
496
|
+
switch(_state.label){
|
|
497
|
+
case 0:
|
|
498
|
+
setIsRecording(true);
|
|
499
|
+
return [
|
|
500
|
+
4,
|
|
501
|
+
navigator.mediaDevices.getUserMedia({
|
|
502
|
+
audio: true
|
|
503
|
+
})
|
|
504
|
+
];
|
|
505
|
+
case 1:
|
|
506
|
+
stream = _state.sent();
|
|
507
|
+
recorder = new MediaRecorder(stream);
|
|
508
|
+
setMediaRecorder(recorder);
|
|
509
|
+
recorder.ondataavailable = function(event) {
|
|
510
|
+
setAudioBlob(event.data);
|
|
511
|
+
};
|
|
512
|
+
recorder.start();
|
|
513
|
+
return [
|
|
514
|
+
2
|
|
515
|
+
];
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
});
|
|
519
|
+
return function startRecording() {
|
|
520
|
+
return _ref.apply(this, arguments);
|
|
521
|
+
};
|
|
522
|
+
}();
|
|
523
|
+
var stopRecording = function() {
|
|
524
|
+
setIsRecording(false);
|
|
525
|
+
mediaRecorder === null || mediaRecorder === void 0 ? void 0 : mediaRecorder.stop();
|
|
526
|
+
mediaRecorder === null || mediaRecorder === void 0 ? void 0 : mediaRecorder.stream.getTracks().forEach(function(track) {
|
|
527
|
+
return track.stop();
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
var handleSpeechToText = /*#__PURE__*/ function() {
|
|
531
|
+
var _ref = _async_to_generator(function() {
|
|
532
|
+
var audioBase64, transcription, error;
|
|
533
|
+
return _ts_generator(this, function(_state) {
|
|
534
|
+
switch(_state.label){
|
|
535
|
+
case 0:
|
|
536
|
+
if (!audioBlob) return [
|
|
537
|
+
2
|
|
538
|
+
];
|
|
539
|
+
return [
|
|
540
|
+
4,
|
|
541
|
+
blobToBase64(audioBlob)
|
|
542
|
+
];
|
|
543
|
+
case 1:
|
|
544
|
+
audioBase64 = _state.sent();
|
|
545
|
+
_state.label = 2;
|
|
546
|
+
case 2:
|
|
547
|
+
_state.trys.push([
|
|
548
|
+
2,
|
|
549
|
+
4,
|
|
550
|
+
5,
|
|
551
|
+
6
|
|
552
|
+
]);
|
|
553
|
+
setIsLoading(true);
|
|
554
|
+
return [
|
|
555
|
+
4,
|
|
556
|
+
speechToText(audioBase64)
|
|
557
|
+
];
|
|
558
|
+
case 3:
|
|
559
|
+
transcription = _state.sent();
|
|
560
|
+
if (transcription) {
|
|
561
|
+
handleReplaceInput(transcription);
|
|
562
|
+
setIsLoading(false);
|
|
563
|
+
}
|
|
564
|
+
return [
|
|
565
|
+
3,
|
|
566
|
+
6
|
|
567
|
+
];
|
|
568
|
+
case 4:
|
|
569
|
+
error = _state.sent();
|
|
570
|
+
console.error("Error transcribing audio:", error);
|
|
571
|
+
setIsLoading(false);
|
|
572
|
+
return [
|
|
573
|
+
3,
|
|
574
|
+
6
|
|
575
|
+
];
|
|
576
|
+
case 5:
|
|
577
|
+
setAudioBlob(null);
|
|
578
|
+
return [
|
|
579
|
+
7
|
|
580
|
+
];
|
|
581
|
+
case 6:
|
|
582
|
+
return [
|
|
583
|
+
2
|
|
584
|
+
];
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
});
|
|
588
|
+
return function handleSpeechToText() {
|
|
589
|
+
return _ref.apply(this, arguments);
|
|
590
|
+
};
|
|
591
|
+
}();
|
|
592
|
+
useEffect2(function() {
|
|
593
|
+
if (!isRecording && audioBlob) {
|
|
594
|
+
handleSpeechToText();
|
|
595
|
+
}
|
|
596
|
+
}, [
|
|
597
|
+
isRecording,
|
|
598
|
+
audioBlob
|
|
599
|
+
]);
|
|
600
|
+
useEffect2(function() {
|
|
601
|
+
isLoading || isRecording ? setIsAudioRecording(true) : setIsAudioRecording(false);
|
|
602
|
+
}, [
|
|
603
|
+
isRecording,
|
|
604
|
+
isLoading
|
|
605
|
+
]);
|
|
606
|
+
var handleRecordButtonClick = function() {
|
|
607
|
+
if (isRecording) {
|
|
608
|
+
stopRecording();
|
|
609
|
+
} else {
|
|
610
|
+
startRecording();
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
var recordIcons = isRecording ? RecordAudioIcon : IdleAudioIcon;
|
|
614
|
+
return /* @__PURE__ */ React.createElement("div", _object_spread({
|
|
615
|
+
className: cn(className)
|
|
616
|
+
}, props), /* @__PURE__ */ React.createElement("button", {
|
|
617
|
+
disabled: isLoading,
|
|
618
|
+
type: "button",
|
|
619
|
+
onClick: handleRecordButtonClick
|
|
620
|
+
}, recordIcons));
|
|
621
|
+
}
|
|
622
|
+
// src/components/organisms/assistant.tsx
|
|
623
|
+
import * as React12 from "react";
|
|
624
|
+
import { useEffect as useEffect8 } from "react";
|
|
625
|
+
// src/components/molecules/page-container.tsx
|
|
626
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
627
|
+
var PageContainer = forwardRef4(function(_param, ref) {
|
|
628
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
629
|
+
"className"
|
|
630
|
+
]);
|
|
631
|
+
return /* @__PURE__ */ React.createElement("div", _object_spread({
|
|
632
|
+
ref: ref,
|
|
633
|
+
className: cn(className, "alq--page-container")
|
|
634
|
+
}, props));
|
|
635
|
+
});
|
|
636
|
+
PageContainer.displayName = "PageContainer";
|
|
637
|
+
// src/components/molecules/carousel.tsx
|
|
638
|
+
import * as React2 from "react";
|
|
639
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
640
|
+
import { ArrowLeft, ArrowRight } from "lucide-react";
|
|
641
|
+
var CarouselContext = React2.createContext(null);
|
|
642
|
+
function useCarousel() {
|
|
643
|
+
var context = React2.useContext(CarouselContext);
|
|
644
|
+
if (!context) {
|
|
645
|
+
throw new Error("useCarousel must be used within a <Carousel />");
|
|
646
|
+
}
|
|
647
|
+
return context;
|
|
648
|
+
}
|
|
649
|
+
var Carousel = React2.forwardRef(function(_param, ref) {
|
|
650
|
+
var _param_orientation = _param.orientation, orientation = _param_orientation === void 0 ? "horizontal" : _param_orientation, opts = _param.opts, setApi = _param.setApi, plugins = _param.plugins, className = _param.className, children = _param.children, props = _object_without_properties(_param, [
|
|
651
|
+
"orientation",
|
|
652
|
+
"opts",
|
|
653
|
+
"setApi",
|
|
654
|
+
"plugins",
|
|
655
|
+
"className",
|
|
656
|
+
"children"
|
|
657
|
+
]);
|
|
658
|
+
var _useEmblaCarousel = _sliced_to_array(useEmblaCarousel(_object_spread_props(_object_spread({}, opts), {
|
|
659
|
+
axis: orientation === "horizontal" ? "x" : "y"
|
|
660
|
+
}), plugins), 2), carouselRef = _useEmblaCarousel[0], api = _useEmblaCarousel[1];
|
|
661
|
+
var _React2_useState = _sliced_to_array(React2.useState(false), 2), canScrollPrev = _React2_useState[0], setCanScrollPrev = _React2_useState[1];
|
|
662
|
+
var _React2_useState1 = _sliced_to_array(React2.useState(false), 2), canScrollNext = _React2_useState1[0], setCanScrollNext = _React2_useState1[1];
|
|
663
|
+
var onSelect = React2.useCallback(function(api2) {
|
|
664
|
+
if (!api2) {
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
setCanScrollPrev(api2.canScrollPrev());
|
|
668
|
+
setCanScrollNext(api2.canScrollNext());
|
|
669
|
+
}, []);
|
|
670
|
+
var scrollPrev = React2.useCallback(function() {
|
|
671
|
+
api === null || api === void 0 ? void 0 : api.scrollPrev();
|
|
672
|
+
}, [
|
|
673
|
+
api
|
|
674
|
+
]);
|
|
675
|
+
var scrollNext = React2.useCallback(function() {
|
|
676
|
+
api === null || api === void 0 ? void 0 : api.scrollNext();
|
|
677
|
+
}, [
|
|
678
|
+
api
|
|
679
|
+
]);
|
|
680
|
+
var handleKeyDown = React2.useCallback(function(event) {
|
|
681
|
+
if (event.key === "ArrowLeft") {
|
|
682
|
+
event.preventDefault();
|
|
683
|
+
scrollPrev();
|
|
684
|
+
} else if (event.key === "ArrowRight") {
|
|
685
|
+
event.preventDefault();
|
|
686
|
+
scrollNext();
|
|
687
|
+
}
|
|
688
|
+
}, [
|
|
689
|
+
scrollPrev,
|
|
690
|
+
scrollNext
|
|
691
|
+
]);
|
|
692
|
+
React2.useEffect(function() {
|
|
693
|
+
if (!api || !setApi) {
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
setApi(api);
|
|
697
|
+
}, [
|
|
698
|
+
api,
|
|
699
|
+
setApi
|
|
700
|
+
]);
|
|
701
|
+
React2.useEffect(function() {
|
|
702
|
+
if (!api) {
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
onSelect(api);
|
|
706
|
+
api.on("reInit", onSelect);
|
|
707
|
+
api.on("select", onSelect);
|
|
708
|
+
return function() {
|
|
709
|
+
api === null || api === void 0 ? void 0 : api.off("select", onSelect);
|
|
710
|
+
};
|
|
711
|
+
}, [
|
|
712
|
+
api,
|
|
713
|
+
onSelect
|
|
714
|
+
]);
|
|
715
|
+
return /* @__PURE__ */ React2.createElement(CarouselContext.Provider, {
|
|
716
|
+
value: {
|
|
717
|
+
carouselRef: carouselRef,
|
|
718
|
+
api: api,
|
|
719
|
+
opts: opts,
|
|
720
|
+
orientation: orientation || ((opts === null || opts === void 0 ? void 0 : opts.axis) === "y" ? "vertical" : "horizontal"),
|
|
721
|
+
scrollPrev: scrollPrev,
|
|
722
|
+
scrollNext: scrollNext,
|
|
723
|
+
canScrollPrev: canScrollPrev,
|
|
724
|
+
canScrollNext: canScrollNext
|
|
725
|
+
}
|
|
726
|
+
}, /* @__PURE__ */ React2.createElement("div", _object_spread({
|
|
727
|
+
ref: ref,
|
|
728
|
+
onKeyDownCapture: handleKeyDown,
|
|
729
|
+
className: cn("relative", className),
|
|
730
|
+
role: "region",
|
|
731
|
+
"aria-roledescription": "carousel"
|
|
732
|
+
}, props), children));
|
|
733
|
+
});
|
|
734
|
+
Carousel.displayName = "Carousel";
|
|
735
|
+
var CarouselContent = React2.forwardRef(function(_param, ref) {
|
|
736
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
737
|
+
"className"
|
|
738
|
+
]);
|
|
739
|
+
var _useCarousel = useCarousel(), carouselRef = _useCarousel.carouselRef, orientation = _useCarousel.orientation;
|
|
740
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
741
|
+
ref: carouselRef,
|
|
742
|
+
className: "overflow-hidden"
|
|
743
|
+
}, /* @__PURE__ */ React2.createElement("div", _object_spread({
|
|
744
|
+
ref: ref,
|
|
745
|
+
className: cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className)
|
|
746
|
+
}, props)));
|
|
747
|
+
});
|
|
748
|
+
CarouselContent.displayName = "CarouselContent";
|
|
749
|
+
var CarouselItem = React2.forwardRef(function(_param, ref) {
|
|
750
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
751
|
+
"className"
|
|
752
|
+
]);
|
|
753
|
+
var orientation = useCarousel().orientation;
|
|
754
|
+
return /* @__PURE__ */ React2.createElement("div", _object_spread({
|
|
755
|
+
ref: ref,
|
|
756
|
+
role: "group",
|
|
757
|
+
"aria-roledescription": "slide",
|
|
758
|
+
className: cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className)
|
|
759
|
+
}, props));
|
|
760
|
+
});
|
|
761
|
+
CarouselItem.displayName = "CarouselItem";
|
|
762
|
+
var CarouselPrevious = React2.forwardRef(function(_param, ref) {
|
|
763
|
+
var className = _param.className, _param_variant = _param.variant, variant = _param_variant === void 0 ? "outline" : _param_variant, _param_size = _param.size, size = _param_size === void 0 ? "icon" : _param_size, props = _object_without_properties(_param, [
|
|
764
|
+
"className",
|
|
765
|
+
"variant",
|
|
766
|
+
"size"
|
|
767
|
+
]);
|
|
768
|
+
var _useCarousel = useCarousel(), orientation = _useCarousel.orientation, scrollPrev = _useCarousel.scrollPrev, canScrollPrev = _useCarousel.canScrollPrev;
|
|
769
|
+
return /* @__PURE__ */ React2.createElement(Button, _object_spread({
|
|
770
|
+
ref: ref,
|
|
771
|
+
variant: variant,
|
|
772
|
+
size: size,
|
|
773
|
+
className: cn("absolute h-8 w-8 rounded-full", orientation === "horizontal" ? "-left-12 top-1/2 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90", className),
|
|
774
|
+
disabled: !canScrollPrev,
|
|
775
|
+
onClick: scrollPrev
|
|
776
|
+
}, props), /* @__PURE__ */ React2.createElement(ArrowLeft, {
|
|
777
|
+
className: "h-4 w-4"
|
|
778
|
+
}), /* @__PURE__ */ React2.createElement("span", {
|
|
779
|
+
className: "sr-only"
|
|
780
|
+
}, "Previous slide"));
|
|
781
|
+
});
|
|
782
|
+
CarouselPrevious.displayName = "CarouselPrevious";
|
|
783
|
+
var CarouselNext = React2.forwardRef(function(_param, ref) {
|
|
784
|
+
var className = _param.className, _param_variant = _param.variant, variant = _param_variant === void 0 ? "outline" : _param_variant, _param_size = _param.size, size = _param_size === void 0 ? "icon" : _param_size, props = _object_without_properties(_param, [
|
|
785
|
+
"className",
|
|
786
|
+
"variant",
|
|
787
|
+
"size"
|
|
788
|
+
]);
|
|
789
|
+
var _useCarousel = useCarousel(), orientation = _useCarousel.orientation, scrollNext = _useCarousel.scrollNext, canScrollNext = _useCarousel.canScrollNext;
|
|
790
|
+
return /* @__PURE__ */ React2.createElement(Button, _object_spread({
|
|
791
|
+
ref: ref,
|
|
792
|
+
variant: variant,
|
|
793
|
+
size: size,
|
|
794
|
+
className: cn("absolute h-8 w-8 rounded-full", orientation === "horizontal" ? "-right-12 top-1/2 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className),
|
|
795
|
+
disabled: !canScrollNext,
|
|
796
|
+
onClick: scrollNext
|
|
797
|
+
}, props), /* @__PURE__ */ React2.createElement(ArrowRight, {
|
|
798
|
+
className: "h-4 w-4"
|
|
799
|
+
}), /* @__PURE__ */ React2.createElement("span", {
|
|
800
|
+
className: "sr-only"
|
|
801
|
+
}, "Next slide"));
|
|
802
|
+
});
|
|
803
|
+
CarouselNext.displayName = "CarouselNext";
|
|
804
|
+
// src/components/molecules/navigation-menu.tsx
|
|
805
|
+
import * as React3 from "react";
|
|
806
|
+
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
|
|
807
|
+
import { cva } from "class-variance-authority";
|
|
808
|
+
import { ChevronDown } from "lucide-react";
|
|
809
|
+
var NavigationMenu = React3.forwardRef(function(_param, ref) {
|
|
810
|
+
var className = _param.className, children = _param.children, props = _object_without_properties(_param, [
|
|
811
|
+
"className",
|
|
812
|
+
"children"
|
|
813
|
+
]);
|
|
814
|
+
return /* @__PURE__ */ React3.createElement(NavigationMenuPrimitive.Root, _object_spread({
|
|
815
|
+
ref: ref,
|
|
816
|
+
className: cn("relative z-10 flex max-w-max flex-1 items-center justify-center", className)
|
|
817
|
+
}, props), children, /* @__PURE__ */ React3.createElement(NavigationMenuViewport, null));
|
|
818
|
+
});
|
|
819
|
+
NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName;
|
|
820
|
+
var NavigationMenuList = React3.forwardRef(function(_param, ref) {
|
|
821
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
822
|
+
"className"
|
|
823
|
+
]);
|
|
824
|
+
return /* @__PURE__ */ React3.createElement(NavigationMenuPrimitive.List, _object_spread({
|
|
825
|
+
ref: ref,
|
|
826
|
+
className: cn("group flex flex-1 list-none items-center justify-center space-x-1", className)
|
|
827
|
+
}, props));
|
|
828
|
+
});
|
|
829
|
+
NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName;
|
|
830
|
+
var NavigationMenuItem = NavigationMenuPrimitive.Item;
|
|
831
|
+
var navigationMenuTriggerStyle = cva("group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50");
|
|
832
|
+
var NavigationMenuTrigger = React3.forwardRef(function(_param, ref) {
|
|
833
|
+
var className = _param.className, children = _param.children, props = _object_without_properties(_param, [
|
|
834
|
+
"className",
|
|
835
|
+
"children"
|
|
836
|
+
]);
|
|
837
|
+
return /* @__PURE__ */ React3.createElement(NavigationMenuPrimitive.Trigger, _object_spread({
|
|
838
|
+
ref: ref,
|
|
839
|
+
className: cn(navigationMenuTriggerStyle(), "group", className)
|
|
840
|
+
}, props), children, " ", /* @__PURE__ */ React3.createElement(ChevronDown, {
|
|
841
|
+
className: "relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180",
|
|
842
|
+
"aria-hidden": "true"
|
|
843
|
+
}));
|
|
844
|
+
});
|
|
845
|
+
NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName;
|
|
846
|
+
var NavigationMenuContent = React3.forwardRef(function(_param, ref) {
|
|
847
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
848
|
+
"className"
|
|
849
|
+
]);
|
|
850
|
+
return /* @__PURE__ */ React3.createElement(NavigationMenuPrimitive.Content, _object_spread({
|
|
851
|
+
ref: ref,
|
|
852
|
+
className: cn("left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ", className)
|
|
853
|
+
}, props));
|
|
854
|
+
});
|
|
855
|
+
NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName;
|
|
856
|
+
var NavigationMenuLink = NavigationMenuPrimitive.Link;
|
|
857
|
+
var NavigationMenuViewport = React3.forwardRef(function(_param, ref) {
|
|
858
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
859
|
+
"className"
|
|
860
|
+
]);
|
|
861
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
862
|
+
className: cn("absolute left-0 top-full flex justify-center")
|
|
863
|
+
}, /* @__PURE__ */ React3.createElement(NavigationMenuPrimitive.Viewport, _object_spread({
|
|
864
|
+
className: cn("origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]", className),
|
|
865
|
+
ref: ref
|
|
866
|
+
}, props)));
|
|
867
|
+
});
|
|
868
|
+
NavigationMenuViewport.displayName = NavigationMenuPrimitive.Viewport.displayName;
|
|
869
|
+
var NavigationMenuIndicator = React3.forwardRef(function(_param, ref) {
|
|
870
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
871
|
+
"className"
|
|
872
|
+
]);
|
|
873
|
+
return /* @__PURE__ */ React3.createElement(NavigationMenuPrimitive.Indicator, _object_spread({
|
|
874
|
+
ref: ref,
|
|
875
|
+
className: cn("top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in", className)
|
|
876
|
+
}, props), /* @__PURE__ */ React3.createElement("div", {
|
|
877
|
+
className: "relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"
|
|
878
|
+
}));
|
|
879
|
+
});
|
|
880
|
+
NavigationMenuIndicator.displayName = NavigationMenuPrimitive.Indicator.displayName;
|
|
881
|
+
// src/components/molecules/sidebar.tsx
|
|
882
|
+
import * as React4 from "react";
|
|
883
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
884
|
+
var sidebarVariants = cva2("flex flex-col border-r", {
|
|
885
|
+
variants: {
|
|
886
|
+
size: {
|
|
887
|
+
sm: "w-48",
|
|
888
|
+
default: "w-64",
|
|
889
|
+
lg: "w-72"
|
|
890
|
+
}
|
|
891
|
+
},
|
|
892
|
+
defaultVariants: {
|
|
893
|
+
size: "default"
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
var SidebarFooter = React4.forwardRef(function(_param, ref) {
|
|
897
|
+
var className = _param.className, children = _param.children, props = _object_without_properties(_param, [
|
|
898
|
+
"className",
|
|
899
|
+
"children"
|
|
900
|
+
]);
|
|
901
|
+
return /* @__PURE__ */ React4.createElement("div", _object_spread({
|
|
902
|
+
ref: ref,
|
|
903
|
+
className: cn("p-4", className)
|
|
904
|
+
}, props), children);
|
|
905
|
+
});
|
|
906
|
+
SidebarFooter.displayName = "SidebarFooter";
|
|
907
|
+
var Sidebar = React4.forwardRef(function(_param, ref) {
|
|
908
|
+
var className = _param.className, items = _param.items, selectedSection = _param.selectedSection, onSelect = _param.onSelect, footerContent = _param.footerContent, _param_size = _param.size, size = _param_size === void 0 ? "default" : _param_size, _param_selectedVariant = _param.selectedVariant, selectedVariant = _param_selectedVariant === void 0 ? "secondary" : _param_selectedVariant, _param_defaultVariant = _param.defaultVariant, defaultVariant = _param_defaultVariant === void 0 ? "ghost" : _param_defaultVariant, buttonClassName = _param.buttonClassName, props = _object_without_properties(_param, [
|
|
909
|
+
"className",
|
|
910
|
+
"items",
|
|
911
|
+
"selectedSection",
|
|
912
|
+
"onSelect",
|
|
913
|
+
"footerContent",
|
|
914
|
+
"size",
|
|
915
|
+
"selectedVariant",
|
|
916
|
+
"defaultVariant",
|
|
917
|
+
"buttonClassName"
|
|
918
|
+
]);
|
|
919
|
+
return /* @__PURE__ */ React4.createElement("div", _object_spread({
|
|
920
|
+
className: cn(className, "alq--navigation-sidebar h-full"),
|
|
921
|
+
ref: ref
|
|
922
|
+
}, props), /* @__PURE__ */ React4.createElement("aside", {
|
|
923
|
+
className: cn(sidebarVariants({
|
|
924
|
+
size: size
|
|
925
|
+
}), "h-full")
|
|
926
|
+
}, /* @__PURE__ */ React4.createElement(ScrollArea, {
|
|
927
|
+
className: "flex-grow justify-between"
|
|
928
|
+
}, /* @__PURE__ */ React4.createElement("div", {
|
|
929
|
+
className: "flex flex-col gap-2 p-4"
|
|
930
|
+
}, items.map(function(item) {
|
|
931
|
+
return /* @__PURE__ */ React4.createElement(Button, {
|
|
932
|
+
key: item.name,
|
|
933
|
+
variant: (selectedSection === null || selectedSection === void 0 ? void 0 : selectedSection.name) === item.name ? selectedVariant : defaultVariant,
|
|
934
|
+
className: cn("justify-start", buttonClassName),
|
|
935
|
+
disabled: item.disabled,
|
|
936
|
+
onClick: function() {
|
|
937
|
+
if (onSelect) {
|
|
938
|
+
onSelect(item);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
}, item.icon && /* @__PURE__ */ React4.createElement(item.icon, {
|
|
942
|
+
className: "mr-2 h-4 w-4"
|
|
943
|
+
}), item.name);
|
|
944
|
+
}))), footerContent && /* @__PURE__ */ React4.createElement(SidebarFooter, null, footerContent)));
|
|
945
|
+
});
|
|
946
|
+
// src/components/molecules/sonner.tsx
|
|
947
|
+
import * as React5 from "react";
|
|
948
|
+
import { useTheme } from "next-themes";
|
|
949
|
+
import { Toaster as Sonner } from "sonner";
|
|
950
|
+
var Toaster2 = function(_param) {
|
|
951
|
+
var props = _extends({}, _object_destructuring_empty(_param));
|
|
952
|
+
var _useTheme = useTheme(), _useTheme_theme = _useTheme.theme, theme = _useTheme_theme === void 0 ? "system" : _useTheme_theme;
|
|
953
|
+
return /* @__PURE__ */ React5.createElement(Sonner, _object_spread({
|
|
954
|
+
theme: theme,
|
|
955
|
+
className: "toaster group",
|
|
956
|
+
toastOptions: {
|
|
957
|
+
classNames: {
|
|
958
|
+
toast: "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
|
|
959
|
+
description: "group-[.toast]:text-muted-foreground",
|
|
960
|
+
actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
|
|
961
|
+
cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}, props));
|
|
965
|
+
};
|
|
966
|
+
// src/components/molecules/rating-stars.tsx
|
|
967
|
+
import * as React6 from "react";
|
|
968
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
969
|
+
import { Star } from "lucide-react";
|
|
970
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
971
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
972
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
973
|
+
var TooltipContent = React6.forwardRef(function(_param, ref) {
|
|
974
|
+
var className = _param.className, _param_sideOffset = _param.sideOffset, sideOffset = _param_sideOffset === void 0 ? 4 : _param_sideOffset, props = _object_without_properties(_param, [
|
|
975
|
+
"className",
|
|
976
|
+
"sideOffset"
|
|
977
|
+
]);
|
|
978
|
+
return /* @__PURE__ */ React6.createElement(TooltipPrimitive.Content, _object_spread({
|
|
979
|
+
ref: ref,
|
|
980
|
+
sideOffset: sideOffset,
|
|
981
|
+
className: cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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", className)
|
|
982
|
+
}, props));
|
|
983
|
+
});
|
|
984
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
985
|
+
var StarRating = React6.forwardRef(function(param, ref) {
|
|
986
|
+
var rating = param.rating, onRate = param.onRate;
|
|
987
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
988
|
+
ref: ref,
|
|
989
|
+
className: "flex"
|
|
990
|
+
}, [
|
|
991
|
+
1,
|
|
992
|
+
2,
|
|
993
|
+
3,
|
|
994
|
+
4,
|
|
995
|
+
5
|
|
996
|
+
].map(function(star) {
|
|
997
|
+
return /* @__PURE__ */ React6.createElement(Button, {
|
|
998
|
+
key: star,
|
|
999
|
+
onClick: function() {
|
|
1000
|
+
return onRate(star);
|
|
1001
|
+
},
|
|
1002
|
+
variant: "link",
|
|
1003
|
+
className: "p-1 transition-colors [&_svg]:size-5 h-5",
|
|
1004
|
+
"aria-label": "Rate ".concat(star, " star").concat(star !== 1 ? "s" : "")
|
|
1005
|
+
}, /* @__PURE__ */ React6.createElement(Star, {
|
|
1006
|
+
className: cn("w-5 h-5", star <= rating ? "alq-rating-star-active fill-current stroke-current" : "alq-rating-star-inactive")
|
|
1007
|
+
}));
|
|
1008
|
+
}));
|
|
1009
|
+
});
|
|
1010
|
+
StarRating.displayName = "StarRating";
|
|
1011
|
+
var RatingStars = React6.forwardRef(function(param, ref) {
|
|
1012
|
+
var _param_currentRating = param.currentRating, currentRating = _param_currentRating === void 0 ? 0 : _param_currentRating, onRate = param.onRate, className = param.className, isLoading = param.isLoading;
|
|
1013
|
+
var _React6_useState = _sliced_to_array(React6.useState(false), 2), open = _React6_useState[0], setOpen = _React6_useState[1];
|
|
1014
|
+
var _React6_useState1 = _sliced_to_array(React6.useState(false), 2), animate = _React6_useState1[0], setAnimate = _React6_useState1[1];
|
|
1015
|
+
var handleRate = function(rating) {
|
|
1016
|
+
onRate(rating);
|
|
1017
|
+
setOpen(false);
|
|
1018
|
+
};
|
|
1019
|
+
React6.useEffect(function() {
|
|
1020
|
+
if (currentRating > 0) {
|
|
1021
|
+
setAnimate(true);
|
|
1022
|
+
var timer = setTimeout(function() {
|
|
1023
|
+
return setAnimate(false);
|
|
1024
|
+
}, 150);
|
|
1025
|
+
return function() {
|
|
1026
|
+
return clearTimeout(timer);
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
}, [
|
|
1030
|
+
currentRating
|
|
1031
|
+
]);
|
|
1032
|
+
var hasRated = currentRating > 0;
|
|
1033
|
+
return /* @__PURE__ */ React6.createElement(TooltipProvider, null, /* @__PURE__ */ React6.createElement(Tooltip, {
|
|
1034
|
+
open: open,
|
|
1035
|
+
onOpenChange: setOpen
|
|
1036
|
+
}, /* @__PURE__ */ React6.createElement(TooltipTrigger, {
|
|
1037
|
+
asChild: true
|
|
1038
|
+
}, /* @__PURE__ */ React6.createElement(Button, {
|
|
1039
|
+
ref: ref,
|
|
1040
|
+
variant: "link",
|
|
1041
|
+
className: cn("inline-flex items-center justify-center rounded-md text-sm font-medium [&_svg]:size-5 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", className),
|
|
1042
|
+
disabled: isLoading,
|
|
1043
|
+
onClick: function() {
|
|
1044
|
+
return setOpen(!open);
|
|
1045
|
+
}
|
|
1046
|
+
}, /* @__PURE__ */ React6.createElement(Star, {
|
|
1047
|
+
className: cn("w-5 h-5 transition-all duration-500", animate && "animate-ping", isLoading && "animate-pulse", hasRated ? "alq-rating-star-active fill-current stroke-current" : "alq-rating-star-inactive")
|
|
1048
|
+
}))), /* @__PURE__ */ React6.createElement(TooltipContent, {
|
|
1049
|
+
side: "top",
|
|
1050
|
+
align: "center",
|
|
1051
|
+
className: "p-0"
|
|
1052
|
+
}, /* @__PURE__ */ React6.createElement("div", {
|
|
1053
|
+
className: "p-2 bg-background"
|
|
1054
|
+
}, /* @__PURE__ */ React6.createElement(StarRating, {
|
|
1055
|
+
rating: currentRating,
|
|
1056
|
+
onRate: handleRate
|
|
1057
|
+
})))));
|
|
1058
|
+
});
|
|
1059
|
+
RatingStars.displayName = "RatingStars";
|
|
1060
|
+
// src/components/molecules/rating-thumbs.tsx
|
|
1061
|
+
import * as React7 from "react";
|
|
1062
|
+
import { ThumbsUp, ThumbsDown } from "lucide-react";
|
|
1063
|
+
var RatingThumbs = React7.forwardRef(function(param, ref) {
|
|
1064
|
+
var currentRating = param.currentRating, onRate = param.onRate, _param_direction = param.direction, direction = _param_direction === void 0 ? "row" : _param_direction, className = param.className, isLoading = param.isLoading;
|
|
1065
|
+
var _React7_useState = _sliced_to_array(React7.useState(false), 2), animate = _React7_useState[0], setAnimate = _React7_useState[1];
|
|
1066
|
+
React7.useEffect(function() {
|
|
1067
|
+
if (currentRating) {
|
|
1068
|
+
setAnimate(true);
|
|
1069
|
+
var timer = setTimeout(function() {
|
|
1070
|
+
return setAnimate(false);
|
|
1071
|
+
}, 150);
|
|
1072
|
+
return function() {
|
|
1073
|
+
return clearTimeout(timer);
|
|
1074
|
+
};
|
|
1075
|
+
}
|
|
1076
|
+
}, [
|
|
1077
|
+
currentRating
|
|
1078
|
+
]);
|
|
1079
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
1080
|
+
ref: ref,
|
|
1081
|
+
className: cn("inline-flex", direction === "column" ? "flex-col" : "flex-row", "space-x-1 gap-4", className)
|
|
1082
|
+
}, /* @__PURE__ */ React7.createElement(Button, {
|
|
1083
|
+
variant: "link",
|
|
1084
|
+
onClick: function() {
|
|
1085
|
+
return onRate(currentRating === "thumbsUp" ? "" : "thumbsUp");
|
|
1086
|
+
},
|
|
1087
|
+
className: cn("p-1 transition-colors disabled:opacity-50 [&_svg]:size-5", "hover:alq-rating-thumbsup/10"),
|
|
1088
|
+
"aria-label": "Thumbs up",
|
|
1089
|
+
disabled: isLoading
|
|
1090
|
+
}, /* @__PURE__ */ React7.createElement(ThumbsUp, {
|
|
1091
|
+
className: cn("w-5 h-5 transition-all duration-500", animate && currentRating === "thumbsUp" && "animate-ping", isLoading && "animate-pulse", currentRating === "thumbsUp" ? "alq-rating-thumbsup fill-current stroke-current" : "alq-rating-thumbs-inactive fill-transparent")
|
|
1092
|
+
})), /* @__PURE__ */ React7.createElement(Button, {
|
|
1093
|
+
variant: "link",
|
|
1094
|
+
onClick: function() {
|
|
1095
|
+
return onRate(currentRating === "thumbsDown" ? "" : "thumbsDown");
|
|
1096
|
+
},
|
|
1097
|
+
className: cn("p-1 transition-colors disabled:opacity-50 mt-0.5 [&_svg]:size-5", "hover:bg-alq-rating-thumbsdown/10"),
|
|
1098
|
+
"aria-label": "Thumbs down",
|
|
1099
|
+
disabled: isLoading
|
|
1100
|
+
}, /* @__PURE__ */ React7.createElement(ThumbsDown, {
|
|
1101
|
+
className: cn("w-5 h-5 transition-all duration-500", animate && currentRating === "thumbsDown" && "animate-ping", isLoading && "animate-pulse", currentRating === "thumbsDown" ? "alq-rating-thumbsdown fill-current stroke-current" : "alq-rating-thumbs-inactive fill-transparent")
|
|
1102
|
+
})));
|
|
1103
|
+
});
|
|
1104
|
+
RatingThumbs.displayName = "RatingThumbs";
|
|
1105
|
+
// src/components/molecules/rating-comment.tsx
|
|
1106
|
+
import * as React8 from "react";
|
|
1107
|
+
import { Book } from "lucide-react";
|
|
1108
|
+
var RatingComment = React8.forwardRef(function(param, ref) {
|
|
1109
|
+
var currentRating = param.currentRating, onRate = param.onRate, className = param.className, isLoading = param.isLoading;
|
|
1110
|
+
var _React8_useState = _sliced_to_array(React8.useState(false), 2), open = _React8_useState[0], setOpen = _React8_useState[1];
|
|
1111
|
+
var _React8_useState1 = _sliced_to_array(React8.useState(""), 2), comment = _React8_useState1[0], setComment = _React8_useState1[1];
|
|
1112
|
+
var _React8_useState2 = _sliced_to_array(React8.useState(false), 2), animate = _React8_useState2[0], setAnimate = _React8_useState2[1];
|
|
1113
|
+
var handleRate = function() {
|
|
1114
|
+
onRate(comment);
|
|
1115
|
+
setOpen(false);
|
|
1116
|
+
};
|
|
1117
|
+
React8.useEffect(function() {
|
|
1118
|
+
if (currentRating) {
|
|
1119
|
+
setAnimate(true);
|
|
1120
|
+
var timer = setTimeout(function() {
|
|
1121
|
+
return setAnimate(false);
|
|
1122
|
+
}, 150);
|
|
1123
|
+
return function() {
|
|
1124
|
+
return clearTimeout(timer);
|
|
1125
|
+
};
|
|
1126
|
+
}
|
|
1127
|
+
}, [
|
|
1128
|
+
currentRating
|
|
1129
|
+
]);
|
|
1130
|
+
React8.useEffect(function() {
|
|
1131
|
+
setComment("");
|
|
1132
|
+
}, [
|
|
1133
|
+
open
|
|
1134
|
+
]);
|
|
1135
|
+
return /* @__PURE__ */ React8.createElement(Dialog, {
|
|
1136
|
+
open: open,
|
|
1137
|
+
onOpenChange: setOpen
|
|
1138
|
+
}, /* @__PURE__ */ React8.createElement(DialogTrigger, {
|
|
1139
|
+
asChild: true
|
|
1140
|
+
}, /* @__PURE__ */ React8.createElement(Button, {
|
|
1141
|
+
ref: ref,
|
|
1142
|
+
variant: "link",
|
|
1143
|
+
size: "lg",
|
|
1144
|
+
className: cn("inline-flex p-2 items-center justify-center rounded-md text-sm font-medium transition-colors [&_svg]:size-5 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring bg-transparent hover:none disabled:pointer-events-none disabled:opacity-50", className),
|
|
1145
|
+
disabled: isLoading
|
|
1146
|
+
}, /* @__PURE__ */ React8.createElement(Book, {
|
|
1147
|
+
className: cn("w-5 h-5 transition-all duration-500", animate && "animate-ping", isLoading && "animate-pulse", "".concat(comment ? "alq-rating-comment" : "stroke-gray-400"))
|
|
1148
|
+
}))), /* @__PURE__ */ React8.createElement(DialogOverlay, {
|
|
1149
|
+
className: "fixed inset-0 bg-black bg-opacity-50"
|
|
1150
|
+
}), /* @__PURE__ */ React8.createElement(DialogContent, {
|
|
1151
|
+
"aria-describedby": void 0
|
|
1152
|
+
}, /* @__PURE__ */ React8.createElement(DialogTitle, {
|
|
1153
|
+
className: "text-lg font-medium"
|
|
1154
|
+
}, "Deja un comentario"), /* @__PURE__ */ React8.createElement("textarea", {
|
|
1155
|
+
className: "mt-4 w-full p-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-primary",
|
|
1156
|
+
rows: 4,
|
|
1157
|
+
value: comment,
|
|
1158
|
+
onChange: function(e) {
|
|
1159
|
+
return setComment(e.target.value);
|
|
1160
|
+
}
|
|
1161
|
+
}), /* @__PURE__ */ React8.createElement("div", {
|
|
1162
|
+
className: "mt-4 flex justify-end"
|
|
1163
|
+
}, /* @__PURE__ */ React8.createElement(Button, {
|
|
1164
|
+
onClick: handleRate,
|
|
1165
|
+
disabled: !comment
|
|
1166
|
+
}, "Enviar"))));
|
|
1167
|
+
});
|
|
1168
|
+
RatingComment.displayName = "RatingComment";
|
|
1169
|
+
// src/components/molecules/documents/document-selector.tsx
|
|
1170
|
+
import React10, { useState as useState8 } from "react";
|
|
1171
|
+
import { ExternalLink } from "lucide-react";
|
|
1172
|
+
// src/components/molecules/documents/document-viewer.tsx
|
|
1173
|
+
import React9, { useEffect as useEffect7 } from "react";
|
|
1174
|
+
// src/components/hooks/use-document.tsx
|
|
1175
|
+
import { useState as useState7 } from "react";
|
|
1176
|
+
var useDocumentReader = function(url, getDocument) {
|
|
1177
|
+
var _useState7 = _sliced_to_array(useState7(true), 2), loading = _useState7[0], setLoading = _useState7[1];
|
|
1178
|
+
var _useState71 = _sliced_to_array(useState7(null), 2), error = _useState71[0], setError = _useState71[1];
|
|
1179
|
+
var _useState72 = _sliced_to_array(useState7(null), 2), document = _useState72[0], setDocument = _useState72[1];
|
|
1180
|
+
var handleDocumentError = function(error2) {
|
|
1181
|
+
var errorMessage = "Hubo un error al obtener el documento. Por favor ponganse en contacto con el administrador.";
|
|
1182
|
+
setError(errorMessage);
|
|
1183
|
+
throw new Error((error2 === null || error2 === void 0 ? void 0 : error2.message) || "Unknown error");
|
|
1184
|
+
};
|
|
1185
|
+
var resetDocument = function() {
|
|
1186
|
+
setDocument(null);
|
|
1187
|
+
};
|
|
1188
|
+
var fetchDocument = /*#__PURE__*/ function() {
|
|
1189
|
+
var _ref = _async_to_generator(function() {
|
|
1190
|
+
var res, error2;
|
|
1191
|
+
return _ts_generator(this, function(_state) {
|
|
1192
|
+
switch(_state.label){
|
|
1193
|
+
case 0:
|
|
1194
|
+
setLoading(true);
|
|
1195
|
+
setError(null);
|
|
1196
|
+
_state.label = 1;
|
|
1197
|
+
case 1:
|
|
1198
|
+
_state.trys.push([
|
|
1199
|
+
1,
|
|
1200
|
+
3,
|
|
1201
|
+
4,
|
|
1202
|
+
5
|
|
1203
|
+
]);
|
|
1204
|
+
return [
|
|
1205
|
+
4,
|
|
1206
|
+
getDocument(url)
|
|
1207
|
+
];
|
|
1208
|
+
case 2:
|
|
1209
|
+
res = _state.sent();
|
|
1210
|
+
if (!res.success) {
|
|
1211
|
+
handleDocumentError(res.error || new Error("Unknown error"));
|
|
1212
|
+
setLoading(false);
|
|
1213
|
+
return [
|
|
1214
|
+
2
|
|
1215
|
+
];
|
|
1216
|
+
}
|
|
1217
|
+
res.data && setDocument(res.data);
|
|
1218
|
+
return [
|
|
1219
|
+
3,
|
|
1220
|
+
5
|
|
1221
|
+
];
|
|
1222
|
+
case 3:
|
|
1223
|
+
error2 = _state.sent();
|
|
1224
|
+
handleDocumentError(error2);
|
|
1225
|
+
return [
|
|
1226
|
+
3,
|
|
1227
|
+
5
|
|
1228
|
+
];
|
|
1229
|
+
case 4:
|
|
1230
|
+
setLoading(false);
|
|
1231
|
+
return [
|
|
1232
|
+
7
|
|
1233
|
+
];
|
|
1234
|
+
case 5:
|
|
1235
|
+
return [
|
|
1236
|
+
2
|
|
1237
|
+
];
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1240
|
+
});
|
|
1241
|
+
return function fetchDocument() {
|
|
1242
|
+
return _ref.apply(this, arguments);
|
|
1243
|
+
};
|
|
1244
|
+
}();
|
|
1245
|
+
return {
|
|
1246
|
+
document: document,
|
|
1247
|
+
loading: loading,
|
|
1248
|
+
fetchDocument: fetchDocument,
|
|
1249
|
+
resetDocument: resetDocument,
|
|
1250
|
+
error: error
|
|
1251
|
+
};
|
|
1252
|
+
};
|
|
1253
|
+
// src/components/molecules/documents/document-viewer.tsx
|
|
1254
|
+
import dynamic from "next/dynamic";
|
|
1255
|
+
var PdfViewer = dynamic(function() {
|
|
1256
|
+
return import("./pdf-viewer-J3ENKRHZ.mjs");
|
|
1257
|
+
}, {
|
|
1258
|
+
ssr: false
|
|
1259
|
+
});
|
|
1260
|
+
var PlainTextViewer = dynamic(function() {
|
|
1261
|
+
return import("./plain-text-viewer-Q3O4LAOE.mjs");
|
|
1262
|
+
}, {
|
|
1263
|
+
ssr: false
|
|
1264
|
+
});
|
|
1265
|
+
var DocumentViewer = function(param) {
|
|
1266
|
+
var docId = param.docId, doc = param.doc, isOpen = param.isOpen, onClose = param.onClose, getDocument = param.getDocument;
|
|
1267
|
+
var _useDocumentReader = useDocumentReader(doc.id, getDocument), document = _useDocumentReader.document, loading = _useDocumentReader.loading, fetchDocument = _useDocumentReader.fetchDocument, resetDocument = _useDocumentReader.resetDocument, error = _useDocumentReader.error;
|
|
1268
|
+
useEffect7(function() {
|
|
1269
|
+
resetDocument();
|
|
1270
|
+
if (isOpen) {
|
|
1271
|
+
fetchDocument();
|
|
1272
|
+
}
|
|
1273
|
+
}, [
|
|
1274
|
+
isOpen
|
|
1275
|
+
]);
|
|
1276
|
+
var documentRender = document && !error ? /* @__PURE__ */ React9.createElement(DocumentFactory, {
|
|
1277
|
+
document: document,
|
|
1278
|
+
docId: doc.id
|
|
1279
|
+
}) : /* @__PURE__ */ React9.createElement("div", {
|
|
1280
|
+
className: "flex flex-col items-center justify-center h-full w-full text-center p-4"
|
|
1281
|
+
}, /* @__PURE__ */ React9.createElement("div", {
|
|
1282
|
+
className: "text-primary font-medium"
|
|
1283
|
+
}, error));
|
|
1284
|
+
return /* @__PURE__ */ React9.createElement(Dialog, {
|
|
1285
|
+
open: isOpen,
|
|
1286
|
+
onOpenChange: onClose
|
|
1287
|
+
}, /* @__PURE__ */ React9.createElement(DialogContent, {
|
|
1288
|
+
"aria-describedby": document ? "document-description" : void 0,
|
|
1289
|
+
className: "h-[90%] max-w-[90%] gap-0 flex flex-col focus:outline-none"
|
|
1290
|
+
}, /* @__PURE__ */ React9.createElement(DialogHeader, {
|
|
1291
|
+
className: "border-b border-border pb-2"
|
|
1292
|
+
}, /* @__PURE__ */ React9.createElement(DialogTitle, null, doc.name)), !document && loading ? /* @__PURE__ */ React9.createElement(Loader, {
|
|
1293
|
+
size: "xl",
|
|
1294
|
+
colorVariant: "destructive"
|
|
1295
|
+
}) : documentRender));
|
|
1296
|
+
};
|
|
1297
|
+
var DocumentFactory = function(param) {
|
|
1298
|
+
var document = param.document, docId = param.docId;
|
|
1299
|
+
switch(document && document.type){
|
|
1300
|
+
case "application/pdf":
|
|
1301
|
+
return /* @__PURE__ */ React9.createElement(PdfViewer, {
|
|
1302
|
+
doc: document,
|
|
1303
|
+
docId: docId
|
|
1304
|
+
});
|
|
1305
|
+
case "text/plain":
|
|
1306
|
+
return /* @__PURE__ */ React9.createElement(PlainTextViewer, {
|
|
1307
|
+
doc: document,
|
|
1308
|
+
docId: docId
|
|
1309
|
+
});
|
|
1310
|
+
default:
|
|
1311
|
+
return /* @__PURE__ */ React9.createElement("div", null, "Unsupported file type");
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
// src/components/molecules/documents/document-selector.tsx
|
|
1315
|
+
var DocumentSelector = function(param) {
|
|
1316
|
+
var documents = param.documents, getDocument = param.getDocument, logInfoMessage = param.logInfoMessage;
|
|
1317
|
+
var _useState8 = _sliced_to_array(useState8(void 0), 2), selectedDocName = _useState8[0], setSelectedDocName = _useState8[1];
|
|
1318
|
+
var _useState81 = _sliced_to_array(useState8(null), 2), selectedDoc = _useState81[0], setSelectedDoc = _useState81[1];
|
|
1319
|
+
var _useState82 = _sliced_to_array(useState8(false), 2), isModalOpen = _useState82[0], setIsModalOpen = _useState82[1];
|
|
1320
|
+
var handleDocumentClick = function(doc, event) {
|
|
1321
|
+
event.stopPropagation();
|
|
1322
|
+
setSelectedDoc(doc);
|
|
1323
|
+
logInfoMessage("Selected document", {
|
|
1324
|
+
documentId: doc.id,
|
|
1325
|
+
documentName: doc.name
|
|
1326
|
+
});
|
|
1327
|
+
setIsModalOpen(true);
|
|
1328
|
+
};
|
|
1329
|
+
var handleDrawerClose = function() {
|
|
1330
|
+
setIsModalOpen(false);
|
|
1331
|
+
};
|
|
1332
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
1333
|
+
className: "w-full md:w-4/6 alq--document-selector"
|
|
1334
|
+
}, /* @__PURE__ */ React10.createElement(Select, {
|
|
1335
|
+
value: selectedDocName,
|
|
1336
|
+
onValueChange: setSelectedDocName
|
|
1337
|
+
}, /* @__PURE__ */ React10.createElement(SelectTrigger, {
|
|
1338
|
+
"aria-label": "Documentos"
|
|
1339
|
+
}, /* @__PURE__ */ React10.createElement(SelectValue, {
|
|
1340
|
+
placeholder: "Documentos"
|
|
1341
|
+
})), /* @__PURE__ */ React10.createElement(SelectContent, null, /* @__PURE__ */ React10.createElement(SelectGroup, null, /* @__PURE__ */ React10.createElement(SelectLabel, null, "Documents"), documents.map(function(doc) {
|
|
1342
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
1343
|
+
key: doc.id,
|
|
1344
|
+
className: "w-full flex relative"
|
|
1345
|
+
}, /* @__PURE__ */ React10.createElement(SelectItem, {
|
|
1346
|
+
className: "w-full",
|
|
1347
|
+
key: doc.id,
|
|
1348
|
+
value: doc.id
|
|
1349
|
+
}, /* @__PURE__ */ React10.createElement("div", {
|
|
1350
|
+
className: "flex justify-between w-full"
|
|
1351
|
+
}, /* @__PURE__ */ React10.createElement("p", {
|
|
1352
|
+
className: "h-4 truncate mr-5"
|
|
1353
|
+
}, doc.name))), /* @__PURE__ */ React10.createElement("div", {
|
|
1354
|
+
onClick: function(event) {
|
|
1355
|
+
return handleDocumentClick(doc, event);
|
|
1356
|
+
},
|
|
1357
|
+
className: "bflex items-center text-gray-400 hover:text-gray-500 absolute right-0 mt-2",
|
|
1358
|
+
"aria-label": "Open ".concat(doc.name)
|
|
1359
|
+
}, /* @__PURE__ */ React10.createElement(ExternalLink, {
|
|
1360
|
+
className: "h-4 w-4 mx-2"
|
|
1361
|
+
})));
|
|
1362
|
+
})))), selectedDoc && /* @__PURE__ */ React10.createElement(DocumentViewer, {
|
|
1363
|
+
doc: selectedDoc,
|
|
1364
|
+
docName: selectedDocName || "",
|
|
1365
|
+
isOpen: isModalOpen,
|
|
1366
|
+
onClose: handleDrawerClose,
|
|
1367
|
+
getDocument: getDocument
|
|
1368
|
+
}));
|
|
1369
|
+
};
|
|
1370
|
+
// src/components/molecules/call-out.tsx
|
|
1371
|
+
import * as React11 from "react";
|
|
1372
|
+
var CallOut = React11.forwardRef(function(_param, ref) {
|
|
1373
|
+
var className = _param.className, children = _param.children, role = _param.role, props = _object_without_properties(_param, [
|
|
1374
|
+
"className",
|
|
1375
|
+
"children",
|
|
1376
|
+
"role"
|
|
1377
|
+
]);
|
|
1378
|
+
return /* @__PURE__ */ React11.createElement("div", _object_spread({
|
|
1379
|
+
ref: ref,
|
|
1380
|
+
className: cn("alq--callout-box", className),
|
|
1381
|
+
"data-role": role
|
|
1382
|
+
}, props), children);
|
|
1383
|
+
});
|
|
1384
|
+
var CallOutDate = React11.forwardRef(function(_param, ref) {
|
|
1385
|
+
var className = _param.className, children = _param.children, props = _object_without_properties(_param, [
|
|
1386
|
+
"className",
|
|
1387
|
+
"children"
|
|
1388
|
+
]);
|
|
1389
|
+
return /* @__PURE__ */ React11.createElement("div", _object_spread({
|
|
1390
|
+
ref: ref,
|
|
1391
|
+
className: cn("alq--callout-date", className)
|
|
1392
|
+
}, props), children);
|
|
1393
|
+
});
|
|
1394
|
+
var CallOutActions = React11.forwardRef(function(_param, ref) {
|
|
1395
|
+
var className = _param.className, actions = _param.actions, role = _param.role, message = _param.message, props = _object_without_properties(_param, [
|
|
1396
|
+
"className",
|
|
1397
|
+
"actions",
|
|
1398
|
+
"role",
|
|
1399
|
+
"message"
|
|
1400
|
+
]);
|
|
1401
|
+
var _React11_useState = _sliced_to_array(React11.useState(false), 2), isLoading = _React11_useState[0], setIsLoading = _React11_useState[1];
|
|
1402
|
+
var _React11_useState1 = _sliced_to_array(React11.useState(false), 2), isClicked = _React11_useState1[0], setIsClicked = _React11_useState1[1];
|
|
1403
|
+
if (role === "user") {
|
|
1404
|
+
return null;
|
|
1405
|
+
}
|
|
1406
|
+
return /* @__PURE__ */ React11.createElement("div", _object_spread({
|
|
1407
|
+
ref: ref,
|
|
1408
|
+
className: cn("alq--callout-actions", className)
|
|
1409
|
+
}, props), actions.map(function(action) {
|
|
1410
|
+
return /* @__PURE__ */ React11.createElement("button", {
|
|
1411
|
+
key: action.label,
|
|
1412
|
+
className: cn("alq--callout-action", {
|
|
1413
|
+
"alq--callout-animate-action": isLoading
|
|
1414
|
+
}, {
|
|
1415
|
+
"alq--callout-clicked-action": isClicked
|
|
1416
|
+
}),
|
|
1417
|
+
type: "button",
|
|
1418
|
+
title: action.label,
|
|
1419
|
+
onClick: function() {
|
|
1420
|
+
setIsLoading(true);
|
|
1421
|
+
action.onClick(message).then(function() {
|
|
1422
|
+
setIsLoading(false);
|
|
1423
|
+
setIsClicked(true);
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
}, /* @__PURE__ */ React11.createElement("span", {
|
|
1427
|
+
className: cn("alq-action-icon-wrapper", {
|
|
1428
|
+
"alq--callout-animate-action": isLoading
|
|
1429
|
+
})
|
|
1430
|
+
}, action.icon), /* @__PURE__ */ React11.createElement("label", null, action.label));
|
|
1431
|
+
}));
|
|
1432
|
+
});
|
|
1433
|
+
var CallOutResponse = React11.forwardRef(function(_param, ref) {
|
|
1434
|
+
var className = _param.className, children = _param.children, role = _param.role, additionalInfo = _param.additionalInfo, props = _object_without_properties(_param, [
|
|
1435
|
+
"className",
|
|
1436
|
+
"children",
|
|
1437
|
+
"role",
|
|
1438
|
+
"additionalInfo"
|
|
1439
|
+
]);
|
|
1440
|
+
return /* @__PURE__ */ React11.createElement("div", _object_spread({
|
|
1441
|
+
ref: ref,
|
|
1442
|
+
"data-role": role,
|
|
1443
|
+
className: cn("alq--callout-response", className)
|
|
1444
|
+
}, props), /* @__PURE__ */ React11.createElement(RichText, {
|
|
1445
|
+
content: children
|
|
1446
|
+
}), additionalInfo && /* @__PURE__ */ React11.createElement("div", {
|
|
1447
|
+
className: "alq--callout-response-additional-info"
|
|
1448
|
+
}, additionalInfo));
|
|
1449
|
+
});
|
|
1450
|
+
CallOut.displayName = "CallOut";
|
|
1451
|
+
CallOutDate.displayName = "CallOutDate";
|
|
1452
|
+
CallOutActions.displayName = "CallOutActions";
|
|
1453
|
+
CallOutResponse.displayName = "CallOutResponse";
|
|
1454
|
+
// src/components/organisms/assistant.tsx
|
|
1455
|
+
import { Send } from "lucide-react";
|
|
1456
|
+
var Assistant = React12.forwardRef(function(_param, ref) {
|
|
1457
|
+
var className = _param.className, sdk = _param.sdk, title = _param.title, description = _param.description, children = _param.children, props = _object_without_properties(_param, [
|
|
1458
|
+
"className",
|
|
1459
|
+
"sdk",
|
|
1460
|
+
"title",
|
|
1461
|
+
"description",
|
|
1462
|
+
"children"
|
|
1463
|
+
]);
|
|
1464
|
+
return /* @__PURE__ */ React12.createElement("div", _object_spread({
|
|
1465
|
+
ref: ref,
|
|
1466
|
+
className: cn("flex flex-col h-full", className)
|
|
1467
|
+
}, props), (title || description) && /* @__PURE__ */ React12.createElement(AssistantHeader, null, title && /* @__PURE__ */ React12.createElement(AssistantTitle, {
|
|
1468
|
+
title: title
|
|
1469
|
+
}), description && /* @__PURE__ */ React12.createElement(AssistantDescription, {
|
|
1470
|
+
description: description
|
|
1471
|
+
})), children);
|
|
1472
|
+
});
|
|
1473
|
+
Assistant.displayName = "Assistant";
|
|
1474
|
+
var AssistantTitle = React12.forwardRef(function(_param, ref) {
|
|
1475
|
+
var className = _param.className, title = _param.title, props = _object_without_properties(_param, [
|
|
1476
|
+
"className",
|
|
1477
|
+
"title"
|
|
1478
|
+
]);
|
|
1479
|
+
return /* @__PURE__ */ React12.createElement("div", _object_spread({
|
|
1480
|
+
ref: ref,
|
|
1481
|
+
className: className
|
|
1482
|
+
}, props), /* @__PURE__ */ React12.createElement(Typography, {
|
|
1483
|
+
typeStyle: "heading1",
|
|
1484
|
+
as: "h1"
|
|
1485
|
+
}, title));
|
|
1486
|
+
});
|
|
1487
|
+
AssistantTitle.displayName = "AssistantTitle";
|
|
1488
|
+
var AssistantDescription = React12.forwardRef(function(_param, ref) {
|
|
1489
|
+
var className = _param.className, description = _param.description, props = _object_without_properties(_param, [
|
|
1490
|
+
"className",
|
|
1491
|
+
"description"
|
|
1492
|
+
]);
|
|
1493
|
+
return /* @__PURE__ */ React12.createElement("div", _object_spread({
|
|
1494
|
+
ref: ref,
|
|
1495
|
+
className: className
|
|
1496
|
+
}, props), /* @__PURE__ */ React12.createElement(Typography, {
|
|
1497
|
+
typeStyle: "display",
|
|
1498
|
+
as: "p"
|
|
1499
|
+
}, description));
|
|
1500
|
+
});
|
|
1501
|
+
AssistantDescription.displayName = "AssistantDescription";
|
|
1502
|
+
var AssistantHeader = React12.forwardRef(function(_param, ref) {
|
|
1503
|
+
var className = _param.className, children = _param.children, props = _object_without_properties(_param, [
|
|
1504
|
+
"className",
|
|
1505
|
+
"children"
|
|
1506
|
+
]);
|
|
1507
|
+
return /* @__PURE__ */ React12.createElement("div", _object_spread({
|
|
1508
|
+
ref: ref,
|
|
1509
|
+
className: className
|
|
1510
|
+
}, props), children);
|
|
1511
|
+
});
|
|
1512
|
+
AssistantHeader.displayName = "AssistantHeader";
|
|
1513
|
+
var AssistantMessageArea = React12.forwardRef(function(_param, ref) {
|
|
1514
|
+
var className = _param.className, messages = _param.messages, messagesEndRef = _param.messagesEndRef, actions = _param.actions, streamingMessageId = _param.streamingMessageId, props = _object_without_properties(_param, [
|
|
1515
|
+
"className",
|
|
1516
|
+
"messages",
|
|
1517
|
+
"messagesEndRef",
|
|
1518
|
+
"actions",
|
|
1519
|
+
"streamingMessageId"
|
|
1520
|
+
]);
|
|
1521
|
+
useEffect8(function() {
|
|
1522
|
+
var _messagesEndRef_current;
|
|
1523
|
+
(_messagesEndRef_current = messagesEndRef.current) === null || _messagesEndRef_current === void 0 ? void 0 : _messagesEndRef_current.scrollIntoView({
|
|
1524
|
+
behavior: "instant"
|
|
1525
|
+
});
|
|
1526
|
+
}, []);
|
|
1527
|
+
return /* @__PURE__ */ React12.createElement("div", _object_spread({
|
|
1528
|
+
ref: ref,
|
|
1529
|
+
className: cn("p-6 overflow-y-auto flex-grow", className)
|
|
1530
|
+
}, props), messages.map(function(message) {
|
|
1531
|
+
return /* @__PURE__ */ React12.createElement("div", {
|
|
1532
|
+
key: message.id
|
|
1533
|
+
}, /* @__PURE__ */ React12.createElement(CallOut, {
|
|
1534
|
+
key: message.id,
|
|
1535
|
+
role: message.role,
|
|
1536
|
+
message: message
|
|
1537
|
+
}, message.created_at && /* @__PURE__ */ React12.createElement("div", {
|
|
1538
|
+
className: "text-xs text-muted-foreground/80 pb-1"
|
|
1539
|
+
}, new Date(Number(message.created_at)).toLocaleString("es-ES", {
|
|
1540
|
+
day: "2-digit",
|
|
1541
|
+
month: "2-digit",
|
|
1542
|
+
year: "numeric",
|
|
1543
|
+
hour: "2-digit",
|
|
1544
|
+
minute: "2-digit",
|
|
1545
|
+
second: "2-digit",
|
|
1546
|
+
hour12: false
|
|
1547
|
+
})), message.error_code && /* @__PURE__ */ React12.createElement(CallOutResponse, {
|
|
1548
|
+
role: "assistant",
|
|
1549
|
+
"data-error-code": message.error_code
|
|
1550
|
+
}, "We have an internal error, please try again later."), message.content && /* @__PURE__ */ React12.createElement(CallOutResponse, {
|
|
1551
|
+
role: message.role,
|
|
1552
|
+
additionalInfo: streamingMessageId !== message.id ? message === null || message === void 0 ? void 0 : message.additionalInfo : void 0
|
|
1553
|
+
}, message.content), actions && streamingMessageId !== message.id && /* @__PURE__ */ React12.createElement(CallOutActions, {
|
|
1554
|
+
key: message.id,
|
|
1555
|
+
actions: actions,
|
|
1556
|
+
message: message,
|
|
1557
|
+
role: message.role
|
|
1558
|
+
})));
|
|
1559
|
+
}), /* @__PURE__ */ React12.createElement("div", {
|
|
1560
|
+
ref: messagesEndRef
|
|
1561
|
+
}));
|
|
1562
|
+
});
|
|
1563
|
+
AssistantMessageArea.displayName = "AssistantMessageArea";
|
|
1564
|
+
var AssistantInput = React12.forwardRef(function(_param, ref) {
|
|
1565
|
+
var className = _param.className, sendMessageFunc = _param.sendMessageFunc, isButtonDisabled = _param.isButtonDisabled, input = _param.input, handleInputChange = _param.handleInputChange, isMessageStreaming = _param.isMessageStreaming, props = _object_without_properties(_param, [
|
|
1566
|
+
"className",
|
|
1567
|
+
"sendMessageFunc",
|
|
1568
|
+
"isButtonDisabled",
|
|
1569
|
+
"input",
|
|
1570
|
+
"handleInputChange",
|
|
1571
|
+
"isMessageStreaming"
|
|
1572
|
+
]);
|
|
1573
|
+
return /* @__PURE__ */ React12.createElement("form", _object_spread({
|
|
1574
|
+
onSubmit: sendMessageFunc,
|
|
1575
|
+
className: "flex items-center space-x-4 ".concat(className),
|
|
1576
|
+
ref: ref
|
|
1577
|
+
}, props), /* @__PURE__ */ React12.createElement("input", {
|
|
1578
|
+
type: "text",
|
|
1579
|
+
disabled: isButtonDisabled,
|
|
1580
|
+
value: input,
|
|
1581
|
+
onChange: handleInputChange,
|
|
1582
|
+
placeholder: isMessageStreaming ? "Procesando..." : "Escribe tu mensaje aqu\xED...",
|
|
1583
|
+
className: "flex-1 text-sm p-3 rounded-lg focus:outline-none w-full border"
|
|
1584
|
+
}), /* @__PURE__ */ React12.createElement("button", {
|
|
1585
|
+
type: "submit",
|
|
1586
|
+
disabled: isButtonDisabled,
|
|
1587
|
+
className: "w-10 h-10 ".concat(isButtonDisabled ? "bg-gray-500" : "bg-black", " rounded-full flex items-center justify-center alq--assistant-button-send")
|
|
1588
|
+
}, /* @__PURE__ */ React12.createElement(Send, {
|
|
1589
|
+
className: "text-white w-5 h-5"
|
|
1590
|
+
})));
|
|
1591
|
+
});
|
|
1592
|
+
AssistantInput.displayName = "AssistantInput";
|
|
1593
|
+
// src/components/organisms/rating-dialog.tsx
|
|
1594
|
+
import { useRatings } from "@alquimia-ai/tools/hooks";
|
|
1595
|
+
function RatingDialog(param) {
|
|
1596
|
+
var sendRating = param.sendRating, topicId = param.topicId, assistantId = param.assistantId, isOpen = param.isOpen, onOpenChange = param.onOpenChange, setHasRatedTopic = param.setHasRatedTopic;
|
|
1597
|
+
var _useToast = useToast(), toast2 = _useToast.toast;
|
|
1598
|
+
var _useRatings = useRatings({
|
|
1599
|
+
assistantId: assistantId,
|
|
1600
|
+
sendRating: sendRating,
|
|
1601
|
+
topicId: topicId
|
|
1602
|
+
}), handleRate = _useRatings.handleRate, ratingStars = _useRatings.ratingStars, ratingThumbs = _useRatings.ratingThumbs, ratingComment = _useRatings.ratingComment, isLoading = _useRatings.isLoading;
|
|
1603
|
+
var onHandleRateSuccess = function(success, err) {
|
|
1604
|
+
setTimeout(function() {
|
|
1605
|
+
return onOpenChange(false);
|
|
1606
|
+
}, 1e3);
|
|
1607
|
+
success ? setHasRatedTopic(true) : toast2({
|
|
1608
|
+
title: "Error",
|
|
1609
|
+
description: "Hubo un error al enviar la calificaci\xf3n",
|
|
1610
|
+
action: /* @__PURE__ */ React.createElement(ToastAction, {
|
|
1611
|
+
altText: "Goto schedule to undo"
|
|
1612
|
+
}, "Cerrar")
|
|
1613
|
+
});
|
|
1614
|
+
};
|
|
1615
|
+
var handleCancelRate = function() {
|
|
1616
|
+
setHasRatedTopic(true);
|
|
1617
|
+
onOpenChange(false);
|
|
1618
|
+
};
|
|
1619
|
+
return /* @__PURE__ */ React.createElement(Dialog, {
|
|
1620
|
+
open: isOpen,
|
|
1621
|
+
onOpenChange: onOpenChange
|
|
1622
|
+
}, /* @__PURE__ */ React.createElement(DialogContent, {
|
|
1623
|
+
className: "sm:max-w-md"
|
|
1624
|
+
}, /* @__PURE__ */ React.createElement(DialogHeader, null, /* @__PURE__ */ React.createElement(DialogTitle, null, "Calific\xE1 esta conversaci\xF3n"), /* @__PURE__ */ React.createElement(DialogDescription, null, "Por favor, compart\xED tu opini\xF3n sobre el asistente.")), /* @__PURE__ */ React.createElement("div", {
|
|
1625
|
+
className: "flex flex-row justify-center gap-4 py-4"
|
|
1626
|
+
}, /* @__PURE__ */ React.createElement(RatingStars, {
|
|
1627
|
+
currentRating: ratingStars,
|
|
1628
|
+
onRate: function(newRating) {
|
|
1629
|
+
return handleRate("score", newRating, onHandleRateSuccess);
|
|
1630
|
+
},
|
|
1631
|
+
isLoading: isLoading,
|
|
1632
|
+
className: "p-2 rounded"
|
|
1633
|
+
}), /* @__PURE__ */ React.createElement(RatingThumbs, {
|
|
1634
|
+
currentRating: ratingComment,
|
|
1635
|
+
onRate: function(newRating) {
|
|
1636
|
+
return handleRate("description", newRating, onHandleRateSuccess);
|
|
1637
|
+
},
|
|
1638
|
+
direction: "row",
|
|
1639
|
+
isLoading: isLoading
|
|
1640
|
+
}), /* @__PURE__ */ React.createElement(RatingComment, {
|
|
1641
|
+
currentRating: ratingComment,
|
|
1642
|
+
onRate: function(newRating) {
|
|
1643
|
+
return handleRate("description", newRating, onHandleRateSuccess);
|
|
1644
|
+
},
|
|
1645
|
+
isLoading: isLoading
|
|
1646
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
1647
|
+
className: "flex flex-row justify-center gap-4"
|
|
1648
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
1649
|
+
onClick: handleCancelRate,
|
|
1650
|
+
variant: "secondary"
|
|
1651
|
+
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
1652
|
+
as: "p",
|
|
1653
|
+
typeStyle: "tiny"
|
|
1654
|
+
}, "No, gracias.")))));
|
|
1655
|
+
}
|
|
1656
|
+
// src/types/type.ts
|
|
1657
|
+
var EditingStatus = /* @__PURE__ */ function(EditingStatus2) {
|
|
1658
|
+
EditingStatus2["EDITING"] = "EDITING";
|
|
1659
|
+
EditingStatus2["FINISHED"] = "FINISHED";
|
|
1660
|
+
return EditingStatus2;
|
|
1661
|
+
}(EditingStatus || {});
|
|
1662
|
+
export { Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Assistant, AssistantInput, AssistantMessageArea, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, CallOut, CallOutActions, CallOutDate, CallOutResponse, Card, CardContent, CardDescription, CardFooter, CardHeader, CardImageWithHeadingAndDescriptionAvatarHorizontal, CardImageWithHeadingAndDescriptionHorizontal, CardTitle, CardWithImageHeadingDescriptionAvatarVertical, CardWithImageHeadingDescriptionVertical, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DocumentSelector, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, EditingStatus, Hero, HeroContent, Input, Label, Loader, MessagesWindow, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, PageContainer, Popover, PopoverContent, PopoverTrigger, QueryBox, RatingComment, RatingDialog, RatingStars, RatingThumbs, RichText, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarFooter, Skeleton, Slider, Toaster2 as SonnerToaster, SpeechToText, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Toaster, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, Whisper, badgeVariants, blobToBase64, buttonVariants, cn, getCookies, navigationMenuTriggerStyle, parseTextToSpeech, reducer, toast, toggleVariants, truncateString, useDocumentReader, useToast };
|
|
1663
|
+
//# sourceMappingURL=index.mjs.map
|