@object-ui/plugin-ai 3.1.3 → 3.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,628 +1,688 @@
1
- import { ComponentRegistry as Q } from "@object-ui/core";
2
- import ue, { useState as A } from "react";
3
- import { Card as S, CardHeader as Y, CardTitle as $, Badge as O, Button as y, CardContent as T, Input as xe } from "@object-ui/components";
4
- import { Sparkles as M, RefreshCw as fe, X as H, Lightbulb as he, Check as te, Star as ae, ThumbsUp as pe, ThumbsDown as ge, ExternalLink as je, Search as be, Loader2 as Ne, Table as ve, Clock as ye, ArrowRight as we } from "lucide-react";
5
- var z = { exports: {} }, F = {};
6
- var re;
7
- function Re() {
8
- if (re) return F;
9
- re = 1;
10
- var p = /* @__PURE__ */ Symbol.for("react.transitional.element"), g = /* @__PURE__ */ Symbol.for("react.fragment");
11
- function j(x, d, m) {
12
- var b = null;
13
- if (m !== void 0 && (b = "" + m), d.key !== void 0 && (b = "" + d.key), "key" in d) {
14
- m = {};
15
- for (var f in d)
16
- f !== "key" && (m[f] = d[f]);
17
- } else m = d;
18
- return d = m.ref, {
19
- $$typeof: p,
20
- type: x,
21
- key: b,
22
- ref: d !== void 0 ? d : null,
23
- props: m
24
- };
25
- }
26
- return F.Fragment = g, F.jsx = j, F.jsxs = j, F;
27
- }
28
- var L = {};
29
- var ne;
30
- function Ee() {
31
- return ne || (ne = 1, process.env.NODE_ENV !== "production" && (function() {
32
- function p(s) {
33
- if (s == null) return null;
34
- if (typeof s == "function")
35
- return s.$$typeof === ce ? null : s.displayName || s.name || null;
36
- if (typeof s == "string") return s;
37
- switch (s) {
38
- case _:
39
- return "Fragment";
40
- case u:
41
- return "Profiler";
42
- case l:
43
- return "StrictMode";
44
- case I:
45
- return "Suspense";
46
- case q:
47
- return "SuspenseList";
48
- case ie:
49
- return "Activity";
50
- }
51
- if (typeof s == "object")
52
- switch (typeof s.tag == "number" && console.error(
53
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
54
- ), s.$$typeof) {
55
- case w:
56
- return "Portal";
57
- case P:
58
- return s.displayName || "Context";
59
- case k:
60
- return (s._context.displayName || "Context") + ".Consumer";
61
- case r:
62
- var a = s.render;
63
- return s = s.displayName, s || (s = a.displayName || a.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
64
- case oe:
65
- return a = s.displayName || null, a !== null ? a : p(s.type) || "Memo";
66
- case V:
67
- a = s._payload, s = s._init;
68
- try {
69
- return p(s(a));
70
- } catch {
71
- }
72
- }
73
- return null;
74
- }
75
- function g(s) {
76
- return "" + s;
77
- }
78
- function j(s) {
79
- try {
80
- g(s);
81
- var a = !1;
82
- } catch {
83
- a = !0;
84
- }
85
- if (a) {
86
- a = console;
87
- var o = a.error, i = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
88
- return o.call(
89
- a,
90
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
91
- i
92
- ), g(s);
93
- }
94
- }
95
- function x(s) {
96
- if (s === _) return "<>";
97
- if (typeof s == "object" && s !== null && s.$$typeof === V)
98
- return "<...>";
99
- try {
100
- var a = p(s);
101
- return a ? "<" + a + ">" : "<...>";
102
- } catch {
103
- return "<...>";
104
- }
105
- }
106
- function d() {
107
- var s = U.A;
108
- return s === null ? null : s.getOwner();
109
- }
110
- function m() {
111
- return Error("react-stack-top-frame");
112
- }
113
- function b(s) {
114
- if (X.call(s, "key")) {
115
- var a = Object.getOwnPropertyDescriptor(s, "key").get;
116
- if (a && a.isReactWarning) return !1;
117
- }
118
- return s.key !== void 0;
119
- }
120
- function f(s, a) {
121
- function o() {
122
- B || (B = !0, console.error(
123
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
124
- a
125
- ));
126
- }
127
- o.isReactWarning = !0, Object.defineProperty(s, "key", {
128
- get: o,
129
- configurable: !0
130
- });
131
- }
132
- function v() {
133
- var s = p(this.type);
134
- return Z[s] || (Z[s] = !0, console.error(
135
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
136
- )), s = this.props.ref, s !== void 0 ? s : null;
137
- }
138
- function N(s, a, o, i, D, G) {
139
- var c = o.ref;
140
- return s = {
141
- $$typeof: h,
142
- type: s,
143
- key: a,
144
- props: o,
145
- _owner: i
146
- }, (c !== void 0 ? c : null) !== null ? Object.defineProperty(s, "ref", {
147
- enumerable: !1,
148
- get: v
149
- }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
150
- configurable: !1,
151
- enumerable: !1,
152
- writable: !0,
153
- value: 0
154
- }), Object.defineProperty(s, "_debugInfo", {
155
- configurable: !1,
156
- enumerable: !1,
157
- writable: !0,
158
- value: null
159
- }), Object.defineProperty(s, "_debugStack", {
160
- configurable: !1,
161
- enumerable: !1,
162
- writable: !0,
163
- value: D
164
- }), Object.defineProperty(s, "_debugTask", {
165
- configurable: !1,
166
- enumerable: !1,
167
- writable: !0,
168
- value: G
169
- }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
170
- }
171
- function n(s, a, o, i, D, G) {
172
- var c = a.children;
173
- if (c !== void 0)
174
- if (i)
175
- if (de(c)) {
176
- for (i = 0; i < c.length; i++)
177
- R(c[i]);
178
- Object.freeze && Object.freeze(c);
179
- } else
180
- console.error(
181
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
182
- );
183
- else R(c);
184
- if (X.call(a, "key")) {
185
- c = p(s);
186
- var C = Object.keys(a).filter(function(me) {
187
- return me !== "key";
188
- });
189
- i = 0 < C.length ? "{key: someKey, " + C.join(": ..., ") + ": ...}" : "{key: someKey}", se[c + i] || (C = 0 < C.length ? "{" + C.join(": ..., ") + ": ...}" : "{}", console.error(
190
- `A props object containing a "key" prop is being spread into JSX:
191
- let props = %s;
192
- <%s {...props} />
193
- React keys must be passed directly to JSX without using spread:
194
- let props = %s;
195
- <%s key={someKey} {...props} />`,
196
- i,
197
- c,
198
- C,
199
- c
200
- ), se[c + i] = !0);
201
- }
202
- if (c = null, o !== void 0 && (j(o), c = "" + o), b(a) && (j(a.key), c = "" + a.key), "key" in a) {
203
- o = {};
204
- for (var J in a)
205
- J !== "key" && (o[J] = a[J]);
206
- } else o = a;
207
- return c && f(
208
- o,
209
- typeof s == "function" ? s.displayName || s.name || "Unknown" : s
210
- ), N(
211
- s,
212
- c,
213
- o,
214
- d(),
215
- D,
216
- G
217
- );
218
- }
219
- function R(s) {
220
- E(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === V && (s._payload.status === "fulfilled" ? E(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
221
- }
222
- function E(s) {
223
- return typeof s == "object" && s !== null && s.$$typeof === h;
224
- }
225
- var t = ue, h = /* @__PURE__ */ Symbol.for("react.transitional.element"), w = /* @__PURE__ */ Symbol.for("react.portal"), _ = /* @__PURE__ */ Symbol.for("react.fragment"), l = /* @__PURE__ */ Symbol.for("react.strict_mode"), u = /* @__PURE__ */ Symbol.for("react.profiler"), k = /* @__PURE__ */ Symbol.for("react.consumer"), P = /* @__PURE__ */ Symbol.for("react.context"), r = /* @__PURE__ */ Symbol.for("react.forward_ref"), I = /* @__PURE__ */ Symbol.for("react.suspense"), q = /* @__PURE__ */ Symbol.for("react.suspense_list"), oe = /* @__PURE__ */ Symbol.for("react.memo"), V = /* @__PURE__ */ Symbol.for("react.lazy"), ie = /* @__PURE__ */ Symbol.for("react.activity"), ce = /* @__PURE__ */ Symbol.for("react.client.reference"), U = t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, X = Object.prototype.hasOwnProperty, de = Array.isArray, W = console.createTask ? console.createTask : function() {
226
- return null;
227
- };
228
- t = {
229
- react_stack_bottom_frame: function(s) {
230
- return s();
231
- }
232
- };
233
- var B, Z = {}, K = t.react_stack_bottom_frame.bind(
234
- t,
235
- m
236
- )(), ee = W(x(m)), se = {};
237
- L.Fragment = _, L.jsx = function(s, a, o) {
238
- var i = 1e4 > U.recentlyCreatedOwnerStacks++;
239
- return n(
240
- s,
241
- a,
242
- o,
243
- !1,
244
- i ? Error("react-stack-top-frame") : K,
245
- i ? W(x(s)) : ee
246
- );
247
- }, L.jsxs = function(s, a, o) {
248
- var i = 1e4 > U.recentlyCreatedOwnerStacks++;
249
- return n(
250
- s,
251
- a,
252
- o,
253
- !0,
254
- i ? Error("react-stack-top-frame") : K,
255
- i ? W(x(s)) : ee
256
- );
257
- };
258
- })()), L;
259
- }
260
- var le;
261
- function _e() {
262
- return le || (le = 1, process.env.NODE_ENV === "production" ? z.exports = Re() : z.exports = Ee()), z.exports;
263
- }
264
- var e = _e();
265
- const ke = ({ schema: p, onApply: g, onRefresh: j }) => {
266
- const {
267
- suggestions: x = [],
268
- showConfidence: d = !0,
269
- showReasoning: m = !1,
270
- autoFill: b = !1
271
- } = p, [f, v] = A(x), [N, n] = A(/* @__PURE__ */ new Set()), [R, E] = A(!1), [t, h] = A(!1), w = (r) => {
272
- g?.(r), n((I) => new Set(I).add(r.fieldName));
273
- }, _ = () => {
274
- f.forEach((r) => g?.(r)), n(new Set(f.map((r) => r.fieldName)));
275
- }, l = (r) => {
276
- v((I) => I.filter((q) => q.fieldName !== r));
277
- }, u = () => {
278
- h(!0), j && j(), setTimeout(() => h(!1), 1e3);
279
- };
280
- if (R || f.length === 0)
281
- return null;
282
- const k = f.filter((r) => !N.has(r.fieldName)), P = (r) => r >= 0.8 ? "text-green-600" : r >= 0.5 ? "text-yellow-600" : "text-red-600";
283
- return /* @__PURE__ */ e.jsxs(S, { className: "border-blue-200 bg-blue-50/30", children: [
284
- /* @__PURE__ */ e.jsx(Y, { className: "pb-2", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
285
- /* @__PURE__ */ e.jsxs($, { className: "text-sm flex items-center gap-2", children: [
286
- /* @__PURE__ */ e.jsx(M, { className: "h-4 w-4 text-blue-500" }),
287
- "AI Suggestions",
288
- /* @__PURE__ */ e.jsxs(O, { variant: "secondary", className: "text-xs", children: [
289
- k.length,
290
- " suggestion",
291
- k.length !== 1 ? "s" : ""
292
- ] })
293
- ] }),
294
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1", children: [
295
- /* @__PURE__ */ e.jsx(
296
- y,
297
- {
298
- variant: "ghost",
299
- size: "sm",
300
- onClick: u,
301
- disabled: t,
302
- className: "h-7",
303
- children: /* @__PURE__ */ e.jsx(fe, { className: `h-3 w-3 ${t ? "animate-spin" : ""}` })
304
- }
305
- ),
306
- k.length > 1 && /* @__PURE__ */ e.jsx(
307
- y,
308
- {
309
- variant: "outline",
310
- size: "sm",
311
- onClick: _,
312
- className: "h-7 text-xs",
313
- children: "Apply All"
314
- }
315
- ),
316
- /* @__PURE__ */ e.jsx(
317
- y,
318
- {
319
- variant: "ghost",
320
- size: "sm",
321
- onClick: () => E(!0),
322
- className: "h-7",
323
- children: /* @__PURE__ */ e.jsx(H, { className: "h-3 w-3" })
324
- }
325
- )
326
- ] })
327
- ] }) }),
328
- /* @__PURE__ */ e.jsxs(T, { className: "space-y-2 pt-0", children: [
329
- k.map((r) => /* @__PURE__ */ e.jsxs(
330
- "div",
331
- {
332
- className: "flex items-center gap-3 p-2 rounded-md bg-white border text-sm",
333
- children: [
334
- /* @__PURE__ */ e.jsx(he, { className: "h-4 w-4 text-yellow-500 shrink-0" }),
335
- /* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
336
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
337
- /* @__PURE__ */ e.jsx("span", { className: "font-medium", children: r.fieldName }),
338
- /* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground", children: "→" }),
339
- /* @__PURE__ */ e.jsx("span", { className: "font-mono text-blue-600 truncate", children: typeof r.value == "object" ? JSON.stringify(r.value) : String(r.value) })
340
- ] }),
341
- d && /* @__PURE__ */ e.jsxs("div", { className: `text-xs ${P(r.confidence)}`, children: [
342
- Math.round(r.confidence * 100),
343
- "% confidence"
344
- ] }),
345
- m && r.reasoning && /* @__PURE__ */ e.jsx("div", { className: "text-xs text-muted-foreground mt-1", children: r.reasoning })
346
- ] }),
347
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 shrink-0", children: [
348
- /* @__PURE__ */ e.jsx(
349
- y,
350
- {
351
- variant: "ghost",
352
- size: "sm",
353
- className: "h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50",
354
- onClick: () => w(r),
355
- children: /* @__PURE__ */ e.jsx(te, { className: "h-3.5 w-3.5" })
356
- }
357
- ),
358
- /* @__PURE__ */ e.jsx(
359
- y,
360
- {
361
- variant: "ghost",
362
- size: "sm",
363
- className: "h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50",
364
- onClick: () => l(r.fieldName),
365
- children: /* @__PURE__ */ e.jsx(H, { className: "h-3.5 w-3.5" })
366
- }
367
- )
368
- ] })
369
- ]
370
- },
371
- r.fieldName
372
- )),
373
- N.size > 0 && /* @__PURE__ */ e.jsxs("div", { className: "text-xs text-green-600 flex items-center gap-1 pt-1", children: [
374
- /* @__PURE__ */ e.jsx(te, { className: "h-3 w-3" }),
375
- N.size,
376
- " suggestion",
377
- N.size !== 1 ? "s" : "",
378
- " applied"
379
- ] })
380
- ] })
381
- ] });
382
- }, Se = ({ schema: p, onSelect: g, onDismiss: j }) => {
383
- const {
384
- recommendations: x = [],
385
- showScores: d = !1,
386
- layout: m = "list",
387
- loading: b = !1,
388
- emptyMessage: f = "No recommendations available"
389
- } = p, v = (t) => {
390
- g?.(t);
391
- }, N = (t) => {
392
- j?.(t);
393
- };
394
- if (b)
395
- return /* @__PURE__ */ e.jsx(S, { children: /* @__PURE__ */ e.jsxs(T, { className: "p-8 text-center", children: [
396
- /* @__PURE__ */ e.jsx(M, { className: "h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse" }),
397
- /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: "Generating recommendations..." })
398
- ] }) });
399
- if (x.length === 0)
400
- return /* @__PURE__ */ e.jsx(S, { children: /* @__PURE__ */ e.jsx(T, { className: "p-8 text-center text-muted-foreground", children: f }) });
401
- const n = (t) => {
402
- if (!d) return null;
403
- const h = Math.round(t * 100), w = t >= 0.7 ? "default" : t >= 0.4 ? "secondary" : "outline";
404
- return /* @__PURE__ */ e.jsxs(O, { variant: w, className: "text-xs", children: [
405
- h,
406
- "%"
407
- ] });
408
- }, R = (t) => /* @__PURE__ */ e.jsxs(
409
- "div",
410
- {
411
- className: "flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer",
412
- onClick: () => v(t),
413
- children: [
414
- /* @__PURE__ */ e.jsx("div", { className: "mt-1 shrink-0", children: /* @__PURE__ */ e.jsx(ae, { className: "h-4 w-4 text-yellow-500" }) }),
415
- /* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
416
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 mb-1", children: [
417
- /* @__PURE__ */ e.jsx("span", { className: "font-medium text-sm", children: t.title }),
418
- t.category && /* @__PURE__ */ e.jsx(O, { variant: "outline", className: "text-xs", children: t.category }),
419
- n(t.score)
420
- ] }),
421
- t.description && /* @__PURE__ */ e.jsx("p", { className: "text-xs text-muted-foreground line-clamp-2", children: t.description })
422
- ] }),
423
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 shrink-0", children: [
424
- t.action && /* @__PURE__ */ e.jsx(y, { variant: "ghost", size: "sm", className: "h-7 w-7 p-0", children: /* @__PURE__ */ e.jsx(je, { className: "h-3.5 w-3.5" }) }),
425
- /* @__PURE__ */ e.jsx(
426
- y,
427
- {
428
- variant: "ghost",
429
- size: "sm",
430
- className: "h-7 w-7 p-0 text-muted-foreground",
431
- onClick: (h) => {
432
- h.stopPropagation(), N(t);
433
- },
434
- children: /* @__PURE__ */ e.jsx(H, { className: "h-3.5 w-3.5" })
435
- }
436
- )
437
- ] })
438
- ]
439
- },
440
- t.id
441
- ), E = (t) => /* @__PURE__ */ e.jsx(
442
- S,
443
- {
444
- className: "cursor-pointer hover:shadow-md transition-shadow",
445
- onClick: () => v(t),
446
- children: /* @__PURE__ */ e.jsxs(T, { className: "p-4", children: [
447
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-start justify-between mb-2", children: [
448
- /* @__PURE__ */ e.jsx(ae, { className: "h-4 w-4 text-yellow-500" }),
449
- n(t.score)
450
- ] }),
451
- /* @__PURE__ */ e.jsx("h4", { className: "font-medium text-sm mb-1", children: t.title }),
452
- t.description && /* @__PURE__ */ e.jsx("p", { className: "text-xs text-muted-foreground line-clamp-3", children: t.description }),
453
- t.category && /* @__PURE__ */ e.jsx(O, { variant: "outline", className: "text-xs mt-2", children: t.category }),
454
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 mt-3", children: [
455
- /* @__PURE__ */ e.jsx(y, { variant: "ghost", size: "sm", className: "h-6 w-6 p-0 text-green-600", children: /* @__PURE__ */ e.jsx(pe, { className: "h-3 w-3" }) }),
456
- /* @__PURE__ */ e.jsx(y, { variant: "ghost", size: "sm", className: "h-6 w-6 p-0 text-red-500", children: /* @__PURE__ */ e.jsx(ge, { className: "h-3 w-3" }) })
457
- ] })
458
- ] })
459
- },
460
- t.id
461
- );
462
- return /* @__PURE__ */ e.jsxs(S, { children: [
463
- /* @__PURE__ */ e.jsx(Y, { children: /* @__PURE__ */ e.jsxs($, { className: "flex items-center gap-2 text-sm", children: [
464
- /* @__PURE__ */ e.jsx(M, { className: "h-4 w-4 text-blue-500" }),
465
- "Recommendations",
466
- /* @__PURE__ */ e.jsx(O, { variant: "secondary", className: "text-xs", children: x.length })
467
- ] }) }),
468
- /* @__PURE__ */ e.jsx(T, { children: m === "grid" ? /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3", children: x.map(E) }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: x.map(R) }) })
469
- ] });
470
- }, Te = ({ schema: p, onSubmit: g }) => {
471
- const {
472
- placeholder: j = "Ask a question about your data...",
473
- result: x,
474
- suggestions: d = [],
475
- showHistory: m = !1,
476
- history: b = [],
477
- loading: f = !1
478
- } = p, [v, N] = A(""), [n, R] = A(x), [E, t] = A(!1), h = E || f, w = (l) => {
479
- const u = l || v;
480
- u.trim() && (t(!0), g?.(u), g ? t(!1) : setTimeout(() => {
481
- R({
482
- query: u,
483
- summary: `Results for: "${u}"`,
484
- confidence: 0.85,
485
- data: [],
486
- columns: []
487
- }), t(!1);
488
- }, 1e3));
489
- }, _ = (l) => {
490
- N(l), w(l);
491
- };
492
- return /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
493
- /* @__PURE__ */ e.jsx(S, { children: /* @__PURE__ */ e.jsxs(T, { className: "p-4", children: [
494
- /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsxs("div", { className: "relative flex-1", children: [
495
- /* @__PURE__ */ e.jsx(be, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
496
- /* @__PURE__ */ e.jsx(
497
- xe,
498
- {
499
- value: v,
500
- onChange: (l) => N(l.target.value),
501
- onKeyDown: (l) => l.key === "Enter" && w(),
502
- placeholder: j,
503
- className: "pl-10 pr-20",
504
- disabled: h
505
- }
506
- ),
507
- /* @__PURE__ */ e.jsx("div", { className: "absolute right-2 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ e.jsx(
508
- y,
509
- {
510
- size: "sm",
511
- onClick: () => w(),
512
- disabled: h || !v.trim(),
513
- className: "h-7",
514
- children: h ? /* @__PURE__ */ e.jsx(Ne, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
515
- /* @__PURE__ */ e.jsx(M, { className: "h-3.5 w-3.5 mr-1" }),
516
- "Ask"
517
- ] })
518
- }
519
- ) })
520
- ] }) }),
521
- d.length > 0 && !n && /* @__PURE__ */ e.jsx("div", { className: "mt-3 flex flex-wrap gap-2", children: d.map((l, u) => /* @__PURE__ */ e.jsx(
522
- "button",
523
- {
524
- onClick: () => _(l),
525
- className: "text-xs px-2.5 py-1 rounded-full border bg-muted/30 hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",
526
- disabled: h,
527
- children: l
528
- },
529
- u
530
- )) })
531
- ] }) }),
532
- n && /* @__PURE__ */ e.jsxs(S, { children: [
533
- /* @__PURE__ */ e.jsx(Y, { className: "pb-2", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
534
- /* @__PURE__ */ e.jsxs($, { className: "text-sm flex items-center gap-2", children: [
535
- /* @__PURE__ */ e.jsx(ve, { className: "h-4 w-4" }),
536
- "Results"
537
- ] }),
538
- n.confidence !== void 0 && /* @__PURE__ */ e.jsxs(O, { variant: n.confidence >= 0.7 ? "default" : "secondary", className: "text-xs", children: [
539
- Math.round(n.confidence * 100),
540
- "% match"
541
- ] })
542
- ] }) }),
543
- /* @__PURE__ */ e.jsxs(T, { children: [
544
- n.summary && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground mb-3", children: n.summary }),
545
- n.data && n.data.length > 0 && n.columns && /* @__PURE__ */ e.jsx("div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full text-sm", children: [
546
- /* @__PURE__ */ e.jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ e.jsx("tr", { children: n.columns.map((l, u) => /* @__PURE__ */ e.jsx("th", { className: "px-4 py-2 text-left font-medium", children: l.label || l.name }, u)) }) }),
547
- /* @__PURE__ */ e.jsx("tbody", { children: n.data.map((l, u) => /* @__PURE__ */ e.jsx("tr", { className: "border-t", children: n.columns.map((k, P) => /* @__PURE__ */ e.jsx("td", { className: "px-4 py-2", children: String(l[k.name] ?? "") }, P)) }, u)) })
548
- ] }) }),
549
- (!n.data || n.data.length === 0) && /* @__PURE__ */ e.jsx("div", { className: "text-center py-6 text-muted-foreground text-sm", children: "No matching records found" })
550
- ] })
551
- ] }),
552
- m && b.length > 0 && /* @__PURE__ */ e.jsxs(S, { children: [
553
- /* @__PURE__ */ e.jsx(Y, { className: "pb-2", children: /* @__PURE__ */ e.jsxs($, { className: "text-xs text-muted-foreground flex items-center gap-1", children: [
554
- /* @__PURE__ */ e.jsx(ye, { className: "h-3 w-3" }),
555
- "Recent Queries"
556
- ] }) }),
557
- /* @__PURE__ */ e.jsx(T, { className: "space-y-1", children: b.slice(0, 5).map((l, u) => /* @__PURE__ */ e.jsxs(
558
- "button",
559
- {
560
- onClick: () => _(l.query),
561
- className: "w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors",
562
- children: [
563
- /* @__PURE__ */ e.jsx(we, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
564
- /* @__PURE__ */ e.jsx("span", { className: "truncate", children: l.query }),
565
- /* @__PURE__ */ e.jsx("span", { className: "text-xs text-muted-foreground shrink-0 ml-auto", children: new Date(l.timestamp).toLocaleDateString() })
566
- ]
567
- },
568
- u
569
- )) })
570
- ] })
571
- ] });
572
- };
573
- Q.register(
574
- "ai-form-assist",
575
- ke,
576
- {
577
- label: "AI Form Assist",
578
- category: "AI",
579
- inputs: [
580
- { name: "formId", type: "string", label: "Form ID" },
581
- { name: "objectName", type: "string", label: "Object Name" },
582
- { name: "fields", type: "array", label: "Fields to suggest" },
583
- { name: "suggestions", type: "code", label: "Suggestions Data" },
584
- { name: "autoFill", type: "boolean", label: "Auto Fill", defaultValue: !1 },
585
- { name: "showConfidence", type: "boolean", label: "Show Confidence", defaultValue: !0 },
586
- { name: "showReasoning", type: "boolean", label: "Show Reasoning", defaultValue: !1 }
587
- ]
588
- }
589
- );
590
- Q.register(
591
- "ai-recommendations",
592
- Se,
593
- {
594
- label: "AI Recommendations",
595
- category: "AI",
596
- inputs: [
597
- { name: "objectName", type: "string", label: "Object Name" },
598
- { name: "recommendations", type: "code", label: "Recommendations Data" },
599
- { name: "maxResults", type: "number", label: "Max Results", defaultValue: 10 },
600
- { name: "showScores", type: "boolean", label: "Show Scores", defaultValue: !1 },
601
- { name: "layout", type: "enum", label: "Layout", enum: [
602
- { label: "List", value: "list" },
603
- { label: "Grid", value: "grid" },
604
- { label: "Carousel", value: "carousel" }
605
- ], defaultValue: "list" },
606
- { name: "emptyMessage", type: "string", label: "Empty Message" }
607
- ]
608
- }
609
- );
610
- Q.register(
611
- "nl-query",
612
- Te,
613
- {
614
- label: "Natural Language Query",
615
- category: "AI",
616
- inputs: [
617
- { name: "objectName", type: "string", label: "Object Name" },
618
- { name: "placeholder", type: "string", label: "Placeholder Text" },
619
- { name: "suggestions", type: "array", label: "Example Queries" },
620
- { name: "showHistory", type: "boolean", label: "Show History", defaultValue: !1 }
621
- ]
622
- }
623
- );
624
- export {
625
- ke as AIFormAssist,
626
- Se as AIRecommendations,
627
- Te as NLQueryInput
1
+ import { ComponentRegistry as e } from "@object-ui/core";
2
+ import { useState as t } from "react";
3
+ import { Badge as n, Button as r, Card as i, CardContent as a, CardHeader as o, CardTitle as s, Input as c } from "@object-ui/components";
4
+ import { ArrowRight as l, Check as u, Clock as d, ExternalLink as f, Lightbulb as p, Loader2 as m, RefreshCw as h, Search as g, Sparkles as _, Star as v, Table as y, ThumbsDown as b, ThumbsUp as x, X as S } from "lucide-react";
5
+ //#region \0rolldown/runtime.js
6
+ var C = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), w = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
7
+ if (typeof require < "u") return require.apply(this, arguments);
8
+ throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
9
+ }), T = /* @__PURE__ */ C(((e) => {
10
+ var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
11
+ function r(e, n, r) {
12
+ var i = null;
13
+ if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
14
+ else r = n;
15
+ return n = r.ref, {
16
+ $$typeof: t,
17
+ type: e,
18
+ key: i,
19
+ ref: n === void 0 ? null : n,
20
+ props: r
21
+ };
22
+ }
23
+ e.Fragment = n, e.jsx = r, e.jsxs = r;
24
+ })), E = /* @__PURE__ */ C(((e) => {
25
+ process.env.NODE_ENV !== "production" && (function() {
26
+ function t(e) {
27
+ if (e == null) return null;
28
+ if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
29
+ if (typeof e == "string") return e;
30
+ switch (e) {
31
+ case _: return "Fragment";
32
+ case y: return "Profiler";
33
+ case v: return "StrictMode";
34
+ case C: return "Suspense";
35
+ case T: return "SuspenseList";
36
+ case O: return "Activity";
37
+ }
38
+ if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
39
+ case g: return "Portal";
40
+ case x: return e.displayName || "Context";
41
+ case b: return (e._context.displayName || "Context") + ".Consumer";
42
+ case S:
43
+ var n = e.render;
44
+ return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
45
+ case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
46
+ case D:
47
+ n = e._payload, e = e._init;
48
+ try {
49
+ return t(e(n));
50
+ } catch {}
51
+ }
52
+ return null;
53
+ }
54
+ function n(e) {
55
+ return "" + e;
56
+ }
57
+ function r(e) {
58
+ try {
59
+ n(e);
60
+ var t = !1;
61
+ } catch {
62
+ t = !0;
63
+ }
64
+ if (t) {
65
+ t = console;
66
+ var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
67
+ return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
68
+ }
69
+ }
70
+ function i(e) {
71
+ if (e === _) return "<>";
72
+ if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
73
+ try {
74
+ var n = t(e);
75
+ return n ? "<" + n + ">" : "<...>";
76
+ } catch {
77
+ return "<...>";
78
+ }
79
+ }
80
+ function a() {
81
+ var e = A.A;
82
+ return e === null ? null : e.getOwner();
83
+ }
84
+ function o() {
85
+ return Error("react-stack-top-frame");
86
+ }
87
+ function s(e) {
88
+ if (j.call(e, "key")) {
89
+ var t = Object.getOwnPropertyDescriptor(e, "key").get;
90
+ if (t && t.isReactWarning) return !1;
91
+ }
92
+ return e.key !== void 0;
93
+ }
94
+ function c(e, t) {
95
+ function n() {
96
+ P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
97
+ }
98
+ n.isReactWarning = !0, Object.defineProperty(e, "key", {
99
+ get: n,
100
+ configurable: !0
101
+ });
102
+ }
103
+ function l() {
104
+ var e = t(this.type);
105
+ return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
106
+ }
107
+ function u(e, t, n, r, i, a) {
108
+ var o = n.ref;
109
+ return e = {
110
+ $$typeof: h,
111
+ type: e,
112
+ key: t,
113
+ props: n,
114
+ _owner: r
115
+ }, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
116
+ enumerable: !1,
117
+ value: null
118
+ }) : Object.defineProperty(e, "ref", {
119
+ enumerable: !1,
120
+ get: l
121
+ }), e._store = {}, Object.defineProperty(e._store, "validated", {
122
+ configurable: !1,
123
+ enumerable: !1,
124
+ writable: !0,
125
+ value: 0
126
+ }), Object.defineProperty(e, "_debugInfo", {
127
+ configurable: !1,
128
+ enumerable: !1,
129
+ writable: !0,
130
+ value: null
131
+ }), Object.defineProperty(e, "_debugStack", {
132
+ configurable: !1,
133
+ enumerable: !1,
134
+ writable: !0,
135
+ value: i
136
+ }), Object.defineProperty(e, "_debugTask", {
137
+ configurable: !1,
138
+ enumerable: !1,
139
+ writable: !0,
140
+ value: a
141
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
142
+ }
143
+ function d(e, n, i, o, l, d) {
144
+ var p = n.children;
145
+ if (p !== void 0) if (o) if (M(p)) {
146
+ for (o = 0; o < p.length; o++) f(p[o]);
147
+ Object.freeze && Object.freeze(p);
148
+ } else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
149
+ else f(p);
150
+ if (j.call(n, "key")) {
151
+ p = t(e);
152
+ var m = Object.keys(n).filter(function(e) {
153
+ return e !== "key";
154
+ });
155
+ o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[p + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, p, m, p), R[p + o] = !0);
156
+ }
157
+ if (p = null, i !== void 0 && (r(i), p = "" + i), s(n) && (r(n.key), p = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
158
+ else i = n;
159
+ return p && c(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), u(e, p, i, a(), l, d);
160
+ }
161
+ function f(e) {
162
+ p(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? p(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
163
+ }
164
+ function p(e) {
165
+ return typeof e == "object" && !!e && e.$$typeof === h;
166
+ }
167
+ var m = w("react"), h = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), b = Symbol.for("react.consumer"), x = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
168
+ return null;
169
+ };
170
+ m = { react_stack_bottom_frame: function(e) {
171
+ return e();
172
+ } };
173
+ var P, F = {}, I = m.react_stack_bottom_frame.bind(m, o)(), L = N(i(o)), R = {};
174
+ e.Fragment = _, e.jsx = function(e, t, n) {
175
+ var r = 1e4 > A.recentlyCreatedOwnerStacks++;
176
+ return d(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
177
+ }, e.jsxs = function(e, t, n) {
178
+ var r = 1e4 > A.recentlyCreatedOwnerStacks++;
179
+ return d(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
180
+ };
181
+ })();
182
+ })), D = (/* @__PURE__ */ C(((e, t) => {
183
+ process.env.NODE_ENV === "production" ? t.exports = T() : t.exports = E();
184
+ })))(), O = ({ schema: e, onApply: c, onRefresh: l }) => {
185
+ let { suggestions: d = [], showConfidence: f = !0, showReasoning: m = !1, autoFill: g = !1 } = e, [v, y] = t(d), [b, x] = t(/* @__PURE__ */ new Set()), [C, w] = t(!1), [T, E] = t(!1), O = (e) => {
186
+ c?.(e), x((t) => new Set(t).add(e.fieldName));
187
+ }, k = () => {
188
+ v.forEach((e) => c?.(e)), x(new Set(v.map((e) => e.fieldName)));
189
+ }, A = (e) => {
190
+ y((t) => t.filter((t) => t.fieldName !== e));
191
+ }, j = () => {
192
+ E(!0), l && l(), setTimeout(() => E(!1), 1e3);
193
+ };
194
+ if (C || v.length === 0) return null;
195
+ let M = v.filter((e) => !b.has(e.fieldName)), N = (e) => e >= .8 ? "text-green-600" : e >= .5 ? "text-yellow-600" : "text-red-600";
196
+ return /* @__PURE__ */ (0, D.jsxs)(i, {
197
+ className: "border-blue-200 bg-blue-50/30",
198
+ children: [/* @__PURE__ */ (0, D.jsx)(o, {
199
+ className: "pb-2",
200
+ children: /* @__PURE__ */ (0, D.jsxs)("div", {
201
+ className: "flex items-center justify-between",
202
+ children: [/* @__PURE__ */ (0, D.jsxs)(s, {
203
+ className: "text-sm flex items-center gap-2",
204
+ children: [
205
+ /* @__PURE__ */ (0, D.jsx)(_, { className: "h-4 w-4 text-blue-500" }),
206
+ "AI Suggestions",
207
+ /* @__PURE__ */ (0, D.jsxs)(n, {
208
+ variant: "secondary",
209
+ className: "text-xs",
210
+ children: [
211
+ M.length,
212
+ " suggestion",
213
+ M.length === 1 ? "" : "s"
214
+ ]
215
+ })
216
+ ]
217
+ }), /* @__PURE__ */ (0, D.jsxs)("div", {
218
+ className: "flex items-center gap-1",
219
+ children: [
220
+ /* @__PURE__ */ (0, D.jsx)(r, {
221
+ variant: "ghost",
222
+ size: "sm",
223
+ onClick: j,
224
+ disabled: T,
225
+ className: "h-7",
226
+ children: /* @__PURE__ */ (0, D.jsx)(h, { className: `h-3 w-3 ${T ? "animate-spin" : ""}` })
227
+ }),
228
+ M.length > 1 && /* @__PURE__ */ (0, D.jsx)(r, {
229
+ variant: "outline",
230
+ size: "sm",
231
+ onClick: k,
232
+ className: "h-7 text-xs",
233
+ children: "Apply All"
234
+ }),
235
+ /* @__PURE__ */ (0, D.jsx)(r, {
236
+ variant: "ghost",
237
+ size: "sm",
238
+ onClick: () => w(!0),
239
+ className: "h-7",
240
+ children: /* @__PURE__ */ (0, D.jsx)(S, { className: "h-3 w-3" })
241
+ })
242
+ ]
243
+ })]
244
+ })
245
+ }), /* @__PURE__ */ (0, D.jsxs)(a, {
246
+ className: "space-y-2 pt-0",
247
+ children: [M.map((e) => /* @__PURE__ */ (0, D.jsxs)("div", {
248
+ className: "flex items-center gap-3 p-2 rounded-md bg-white border text-sm",
249
+ children: [
250
+ /* @__PURE__ */ (0, D.jsx)(p, { className: "h-4 w-4 text-yellow-500 shrink-0" }),
251
+ /* @__PURE__ */ (0, D.jsxs)("div", {
252
+ className: "flex-1 min-w-0",
253
+ children: [
254
+ /* @__PURE__ */ (0, D.jsxs)("div", {
255
+ className: "flex items-center gap-2",
256
+ children: [
257
+ /* @__PURE__ */ (0, D.jsx)("span", {
258
+ className: "font-medium",
259
+ children: e.fieldName
260
+ }),
261
+ /* @__PURE__ */ (0, D.jsx)("span", {
262
+ className: "text-muted-foreground",
263
+ children: "→"
264
+ }),
265
+ /* @__PURE__ */ (0, D.jsx)("span", {
266
+ className: "font-mono text-blue-600 truncate",
267
+ children: typeof e.value == "object" ? JSON.stringify(e.value) : String(e.value)
268
+ })
269
+ ]
270
+ }),
271
+ f && /* @__PURE__ */ (0, D.jsxs)("div", {
272
+ className: `text-xs ${N(e.confidence)}`,
273
+ children: [Math.round(e.confidence * 100), "% confidence"]
274
+ }),
275
+ m && e.reasoning && /* @__PURE__ */ (0, D.jsx)("div", {
276
+ className: "text-xs text-muted-foreground mt-1",
277
+ children: e.reasoning
278
+ })
279
+ ]
280
+ }),
281
+ /* @__PURE__ */ (0, D.jsxs)("div", {
282
+ className: "flex items-center gap-1 shrink-0",
283
+ children: [/* @__PURE__ */ (0, D.jsx)(r, {
284
+ variant: "ghost",
285
+ size: "sm",
286
+ className: "h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50",
287
+ onClick: () => O(e),
288
+ children: /* @__PURE__ */ (0, D.jsx)(u, { className: "h-3.5 w-3.5" })
289
+ }), /* @__PURE__ */ (0, D.jsx)(r, {
290
+ variant: "ghost",
291
+ size: "sm",
292
+ className: "h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50",
293
+ onClick: () => A(e.fieldName),
294
+ children: /* @__PURE__ */ (0, D.jsx)(S, { className: "h-3.5 w-3.5" })
295
+ })]
296
+ })
297
+ ]
298
+ }, e.fieldName)), b.size > 0 && /* @__PURE__ */ (0, D.jsxs)("div", {
299
+ className: "text-xs text-green-600 flex items-center gap-1 pt-1",
300
+ children: [
301
+ /* @__PURE__ */ (0, D.jsx)(u, { className: "h-3 w-3" }),
302
+ b.size,
303
+ " suggestion",
304
+ b.size === 1 ? "" : "s",
305
+ " applied"
306
+ ]
307
+ })]
308
+ })]
309
+ });
310
+ }, k = ({ schema: e, onSelect: t, onDismiss: c }) => {
311
+ let { recommendations: l = [], showScores: u = !1, layout: d = "list", loading: p = !1, emptyMessage: m = "No recommendations available" } = e, h = (e) => {
312
+ t?.(e);
313
+ }, g = (e) => {
314
+ c?.(e);
315
+ };
316
+ if (p) return /* @__PURE__ */ (0, D.jsx)(i, { children: /* @__PURE__ */ (0, D.jsxs)(a, {
317
+ className: "p-8 text-center",
318
+ children: [/* @__PURE__ */ (0, D.jsx)(_, { className: "h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse" }), /* @__PURE__ */ (0, D.jsx)("p", {
319
+ className: "text-sm text-muted-foreground",
320
+ children: "Generating recommendations..."
321
+ })]
322
+ }) });
323
+ if (l.length === 0) return /* @__PURE__ */ (0, D.jsx)(i, { children: /* @__PURE__ */ (0, D.jsx)(a, {
324
+ className: "p-8 text-center text-muted-foreground",
325
+ children: m
326
+ }) });
327
+ let y = (e) => {
328
+ if (!u) return null;
329
+ let t = Math.round(e * 100);
330
+ return /* @__PURE__ */ (0, D.jsxs)(n, {
331
+ variant: e >= .7 ? "default" : e >= .4 ? "secondary" : "outline",
332
+ className: "text-xs",
333
+ children: [t, "%"]
334
+ });
335
+ };
336
+ return /* @__PURE__ */ (0, D.jsxs)(i, { children: [/* @__PURE__ */ (0, D.jsx)(o, { children: /* @__PURE__ */ (0, D.jsxs)(s, {
337
+ className: "flex items-center gap-2 text-sm",
338
+ children: [
339
+ /* @__PURE__ */ (0, D.jsx)(_, { className: "h-4 w-4 text-blue-500" }),
340
+ "Recommendations",
341
+ /* @__PURE__ */ (0, D.jsx)(n, {
342
+ variant: "secondary",
343
+ className: "text-xs",
344
+ children: l.length
345
+ })
346
+ ]
347
+ }) }), /* @__PURE__ */ (0, D.jsx)(a, { children: d === "grid" ? /* @__PURE__ */ (0, D.jsx)("div", {
348
+ className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",
349
+ children: l.map((e) => /* @__PURE__ */ (0, D.jsx)(i, {
350
+ className: "cursor-pointer hover:shadow-md transition-shadow",
351
+ onClick: () => h(e),
352
+ children: /* @__PURE__ */ (0, D.jsxs)(a, {
353
+ className: "p-4",
354
+ children: [
355
+ /* @__PURE__ */ (0, D.jsxs)("div", {
356
+ className: "flex items-start justify-between mb-2",
357
+ children: [/* @__PURE__ */ (0, D.jsx)(v, { className: "h-4 w-4 text-yellow-500" }), y(e.score)]
358
+ }),
359
+ /* @__PURE__ */ (0, D.jsx)("h4", {
360
+ className: "font-medium text-sm mb-1",
361
+ children: e.title
362
+ }),
363
+ e.description && /* @__PURE__ */ (0, D.jsx)("p", {
364
+ className: "text-xs text-muted-foreground line-clamp-3",
365
+ children: e.description
366
+ }),
367
+ e.category && /* @__PURE__ */ (0, D.jsx)(n, {
368
+ variant: "outline",
369
+ className: "text-xs mt-2",
370
+ children: e.category
371
+ }),
372
+ /* @__PURE__ */ (0, D.jsxs)("div", {
373
+ className: "flex items-center gap-1 mt-3",
374
+ children: [/* @__PURE__ */ (0, D.jsx)(r, {
375
+ variant: "ghost",
376
+ size: "sm",
377
+ className: "h-6 w-6 p-0 text-green-600",
378
+ children: /* @__PURE__ */ (0, D.jsx)(x, { className: "h-3 w-3" })
379
+ }), /* @__PURE__ */ (0, D.jsx)(r, {
380
+ variant: "ghost",
381
+ size: "sm",
382
+ className: "h-6 w-6 p-0 text-red-500",
383
+ children: /* @__PURE__ */ (0, D.jsx)(b, { className: "h-3 w-3" })
384
+ })]
385
+ })
386
+ ]
387
+ })
388
+ }, e.id))
389
+ }) : /* @__PURE__ */ (0, D.jsx)("div", {
390
+ className: "space-y-2",
391
+ children: l.map((e) => /* @__PURE__ */ (0, D.jsxs)("div", {
392
+ className: "flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer",
393
+ onClick: () => h(e),
394
+ children: [
395
+ /* @__PURE__ */ (0, D.jsx)("div", {
396
+ className: "mt-1 shrink-0",
397
+ children: /* @__PURE__ */ (0, D.jsx)(v, { className: "h-4 w-4 text-yellow-500" })
398
+ }),
399
+ /* @__PURE__ */ (0, D.jsxs)("div", {
400
+ className: "flex-1 min-w-0",
401
+ children: [/* @__PURE__ */ (0, D.jsxs)("div", {
402
+ className: "flex items-center gap-2 mb-1",
403
+ children: [
404
+ /* @__PURE__ */ (0, D.jsx)("span", {
405
+ className: "font-medium text-sm",
406
+ children: e.title
407
+ }),
408
+ e.category && /* @__PURE__ */ (0, D.jsx)(n, {
409
+ variant: "outline",
410
+ className: "text-xs",
411
+ children: e.category
412
+ }),
413
+ y(e.score)
414
+ ]
415
+ }), e.description && /* @__PURE__ */ (0, D.jsx)("p", {
416
+ className: "text-xs text-muted-foreground line-clamp-2",
417
+ children: e.description
418
+ })]
419
+ }),
420
+ /* @__PURE__ */ (0, D.jsxs)("div", {
421
+ className: "flex items-center gap-1 shrink-0",
422
+ children: [e.action && /* @__PURE__ */ (0, D.jsx)(r, {
423
+ variant: "ghost",
424
+ size: "sm",
425
+ className: "h-7 w-7 p-0",
426
+ children: /* @__PURE__ */ (0, D.jsx)(f, { className: "h-3.5 w-3.5" })
427
+ }), /* @__PURE__ */ (0, D.jsx)(r, {
428
+ variant: "ghost",
429
+ size: "sm",
430
+ className: "h-7 w-7 p-0 text-muted-foreground",
431
+ onClick: (t) => {
432
+ t.stopPropagation(), g(e);
433
+ },
434
+ children: /* @__PURE__ */ (0, D.jsx)(S, { className: "h-3.5 w-3.5" })
435
+ })]
436
+ })
437
+ ]
438
+ }, e.id))
439
+ }) })] });
440
+ }, A = ({ schema: e, onSubmit: u }) => {
441
+ let { placeholder: f = "Ask a question about your data...", result: p, suggestions: h = [], showHistory: v = !1, history: b = [], loading: x = !1 } = e, [S, C] = t(""), [w, T] = t(p), [E, O] = t(!1), k = E || x, A = (e) => {
442
+ let t = e || S;
443
+ t.trim() && (O(!0), u?.(t), u ? O(!1) : setTimeout(() => {
444
+ T({
445
+ query: t,
446
+ summary: `Results for: "${t}"`,
447
+ confidence: .85,
448
+ data: [],
449
+ columns: []
450
+ }), O(!1);
451
+ }, 1e3));
452
+ }, j = (e) => {
453
+ C(e), A(e);
454
+ };
455
+ return /* @__PURE__ */ (0, D.jsxs)("div", {
456
+ className: "space-y-4",
457
+ children: [
458
+ /* @__PURE__ */ (0, D.jsx)(i, { children: /* @__PURE__ */ (0, D.jsxs)(a, {
459
+ className: "p-4",
460
+ children: [/* @__PURE__ */ (0, D.jsx)("div", {
461
+ className: "flex items-center gap-2",
462
+ children: /* @__PURE__ */ (0, D.jsxs)("div", {
463
+ className: "relative flex-1",
464
+ children: [
465
+ /* @__PURE__ */ (0, D.jsx)(g, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
466
+ /* @__PURE__ */ (0, D.jsx)(c, {
467
+ value: S,
468
+ onChange: (e) => C(e.target.value),
469
+ onKeyDown: (e) => e.key === "Enter" && A(),
470
+ placeholder: f,
471
+ className: "pl-10 pr-20",
472
+ disabled: k
473
+ }),
474
+ /* @__PURE__ */ (0, D.jsx)("div", {
475
+ className: "absolute right-2 top-1/2 -translate-y-1/2",
476
+ children: /* @__PURE__ */ (0, D.jsx)(r, {
477
+ size: "sm",
478
+ onClick: () => A(),
479
+ disabled: k || !S.trim(),
480
+ className: "h-7",
481
+ children: k ? /* @__PURE__ */ (0, D.jsx)(m, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, D.jsxs)(D.Fragment, { children: [/* @__PURE__ */ (0, D.jsx)(_, { className: "h-3.5 w-3.5 mr-1" }), "Ask"] })
482
+ })
483
+ })
484
+ ]
485
+ })
486
+ }), h.length > 0 && !w && /* @__PURE__ */ (0, D.jsx)("div", {
487
+ className: "mt-3 flex flex-wrap gap-2",
488
+ children: h.map((e, t) => /* @__PURE__ */ (0, D.jsx)("button", {
489
+ onClick: () => j(e),
490
+ className: "text-xs px-2.5 py-1 rounded-full border bg-muted/30 hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",
491
+ disabled: k,
492
+ children: e
493
+ }, t))
494
+ })]
495
+ }) }),
496
+ w && /* @__PURE__ */ (0, D.jsxs)(i, { children: [/* @__PURE__ */ (0, D.jsx)(o, {
497
+ className: "pb-2",
498
+ children: /* @__PURE__ */ (0, D.jsxs)("div", {
499
+ className: "flex items-center justify-between",
500
+ children: [/* @__PURE__ */ (0, D.jsxs)(s, {
501
+ className: "text-sm flex items-center gap-2",
502
+ children: [/* @__PURE__ */ (0, D.jsx)(y, { className: "h-4 w-4" }), "Results"]
503
+ }), w.confidence !== void 0 && /* @__PURE__ */ (0, D.jsxs)(n, {
504
+ variant: w.confidence >= .7 ? "default" : "secondary",
505
+ className: "text-xs",
506
+ children: [Math.round(w.confidence * 100), "% match"]
507
+ })]
508
+ })
509
+ }), /* @__PURE__ */ (0, D.jsxs)(a, { children: [
510
+ w.summary && /* @__PURE__ */ (0, D.jsx)("p", {
511
+ className: "text-sm text-muted-foreground mb-3",
512
+ children: w.summary
513
+ }),
514
+ w.data && w.data.length > 0 && w.columns && /* @__PURE__ */ (0, D.jsx)("div", {
515
+ className: "border rounded-lg overflow-hidden",
516
+ children: /* @__PURE__ */ (0, D.jsxs)("table", {
517
+ className: "w-full text-sm",
518
+ children: [/* @__PURE__ */ (0, D.jsx)("thead", {
519
+ className: "bg-muted",
520
+ children: /* @__PURE__ */ (0, D.jsx)("tr", { children: w.columns.map((e, t) => /* @__PURE__ */ (0, D.jsx)("th", {
521
+ className: "px-4 py-2 text-left font-medium",
522
+ children: e.label || e.name
523
+ }, t)) })
524
+ }), /* @__PURE__ */ (0, D.jsx)("tbody", { children: w.data.map((e, t) => /* @__PURE__ */ (0, D.jsx)("tr", {
525
+ className: "border-t",
526
+ children: w.columns.map((t, n) => /* @__PURE__ */ (0, D.jsx)("td", {
527
+ className: "px-4 py-2",
528
+ children: String(e[t.name] ?? "")
529
+ }, n))
530
+ }, t)) })]
531
+ })
532
+ }),
533
+ (!w.data || w.data.length === 0) && /* @__PURE__ */ (0, D.jsx)("div", {
534
+ className: "text-center py-6 text-muted-foreground text-sm",
535
+ children: "No matching records found"
536
+ })
537
+ ] })] }),
538
+ v && b.length > 0 && /* @__PURE__ */ (0, D.jsxs)(i, { children: [/* @__PURE__ */ (0, D.jsx)(o, {
539
+ className: "pb-2",
540
+ children: /* @__PURE__ */ (0, D.jsxs)(s, {
541
+ className: "text-xs text-muted-foreground flex items-center gap-1",
542
+ children: [/* @__PURE__ */ (0, D.jsx)(d, { className: "h-3 w-3" }), "Recent Queries"]
543
+ })
544
+ }), /* @__PURE__ */ (0, D.jsx)(a, {
545
+ className: "space-y-1",
546
+ children: b.slice(0, 5).map((e, t) => /* @__PURE__ */ (0, D.jsxs)("button", {
547
+ onClick: () => j(e.query),
548
+ className: "w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors",
549
+ children: [
550
+ /* @__PURE__ */ (0, D.jsx)(l, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
551
+ /* @__PURE__ */ (0, D.jsx)("span", {
552
+ className: "truncate",
553
+ children: e.query
554
+ }),
555
+ /* @__PURE__ */ (0, D.jsx)("span", {
556
+ className: "text-xs text-muted-foreground shrink-0 ml-auto",
557
+ children: new Date(e.timestamp).toLocaleDateString()
558
+ })
559
+ ]
560
+ }, t))
561
+ })] })
562
+ ]
563
+ });
628
564
  };
565
+ e.register("ai-form-assist", O, {
566
+ label: "AI Form Assist",
567
+ category: "AI",
568
+ inputs: [
569
+ {
570
+ name: "formId",
571
+ type: "string",
572
+ label: "Form ID"
573
+ },
574
+ {
575
+ name: "objectName",
576
+ type: "string",
577
+ label: "Object Name"
578
+ },
579
+ {
580
+ name: "fields",
581
+ type: "array",
582
+ label: "Fields to suggest"
583
+ },
584
+ {
585
+ name: "suggestions",
586
+ type: "code",
587
+ label: "Suggestions Data"
588
+ },
589
+ {
590
+ name: "autoFill",
591
+ type: "boolean",
592
+ label: "Auto Fill",
593
+ defaultValue: !1
594
+ },
595
+ {
596
+ name: "showConfidence",
597
+ type: "boolean",
598
+ label: "Show Confidence",
599
+ defaultValue: !0
600
+ },
601
+ {
602
+ name: "showReasoning",
603
+ type: "boolean",
604
+ label: "Show Reasoning",
605
+ defaultValue: !1
606
+ }
607
+ ]
608
+ }), e.register("ai-recommendations", k, {
609
+ label: "AI Recommendations",
610
+ category: "AI",
611
+ inputs: [
612
+ {
613
+ name: "objectName",
614
+ type: "string",
615
+ label: "Object Name"
616
+ },
617
+ {
618
+ name: "recommendations",
619
+ type: "code",
620
+ label: "Recommendations Data"
621
+ },
622
+ {
623
+ name: "maxResults",
624
+ type: "number",
625
+ label: "Max Results",
626
+ defaultValue: 10
627
+ },
628
+ {
629
+ name: "showScores",
630
+ type: "boolean",
631
+ label: "Show Scores",
632
+ defaultValue: !1
633
+ },
634
+ {
635
+ name: "layout",
636
+ type: "enum",
637
+ label: "Layout",
638
+ enum: [
639
+ {
640
+ label: "List",
641
+ value: "list"
642
+ },
643
+ {
644
+ label: "Grid",
645
+ value: "grid"
646
+ },
647
+ {
648
+ label: "Carousel",
649
+ value: "carousel"
650
+ }
651
+ ],
652
+ defaultValue: "list"
653
+ },
654
+ {
655
+ name: "emptyMessage",
656
+ type: "string",
657
+ label: "Empty Message"
658
+ }
659
+ ]
660
+ }), e.register("nl-query", A, {
661
+ label: "Natural Language Query",
662
+ category: "AI",
663
+ inputs: [
664
+ {
665
+ name: "objectName",
666
+ type: "string",
667
+ label: "Object Name"
668
+ },
669
+ {
670
+ name: "placeholder",
671
+ type: "string",
672
+ label: "Placeholder Text"
673
+ },
674
+ {
675
+ name: "suggestions",
676
+ type: "array",
677
+ label: "Example Queries"
678
+ },
679
+ {
680
+ name: "showHistory",
681
+ type: "boolean",
682
+ label: "Show History",
683
+ defaultValue: !1
684
+ }
685
+ ]
686
+ });
687
+ //#endregion
688
+ export { O as AIFormAssist, k as AIRecommendations, A as NLQueryInput };