@nice2dev/ui-ai 1.2.2 → 1.3.1
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/CHANGELOG.md +380 -0
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +568 -555
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as a, jsxs as o, Fragment as re } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as X, useCallback as F, useMemo as ae, useContext as
|
|
3
|
-
import { useNiceTranslation as ie, NiceIcon as $, NiceTutorialButton as
|
|
4
|
-
import { NiceAppShell as
|
|
5
|
-
class
|
|
2
|
+
import { useRef as X, useCallback as F, useMemo as ae, useContext as ua, createContext as pa, useState as M, useEffect as te, forwardRef as ea } from "react";
|
|
3
|
+
import { useNiceTranslation as ie, NiceIcon as $, clickOnActivationKey as fe, NiceTutorialButton as ma, resolveTutorial as ga, createId as oe, NICE_BUILTIN_ICONS as Me } from "@nice2dev/ui-core";
|
|
4
|
+
import { NiceAppShell as ha } from "@nice2dev/ui";
|
|
5
|
+
class fa {
|
|
6
6
|
constructor(e = {}, i) {
|
|
7
7
|
this.timestamps = [], this.tokenCount = 0, this.warningEmitted = !1, this.config = {
|
|
8
8
|
maxRequestsPerMinute: e.maxRequestsPerMinute ?? 30,
|
|
@@ -48,8 +48,8 @@ class ha {
|
|
|
48
48
|
this.getStatus().isWarning && (this.warningEmitted = !0, (i = this.onWarning) == null || i.call(this));
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
const
|
|
52
|
-
function
|
|
51
|
+
const aa = /* @__PURE__ */ pa(null);
|
|
52
|
+
function tr({
|
|
53
53
|
config: r,
|
|
54
54
|
rateLimits: e,
|
|
55
55
|
enabled: i = !0,
|
|
@@ -57,7 +57,7 @@ function rr({
|
|
|
57
57
|
children: t
|
|
58
58
|
}) {
|
|
59
59
|
const s = X(null);
|
|
60
|
-
s.current || (s.current = new
|
|
60
|
+
s.current || (s.current = new fa(e, n));
|
|
61
61
|
const l = F(() => s.current.getStatus(), []), c = ae(
|
|
62
62
|
() => ({
|
|
63
63
|
config: r,
|
|
@@ -67,12 +67,12 @@ function rr({
|
|
|
67
67
|
}),
|
|
68
68
|
[r, i, l]
|
|
69
69
|
);
|
|
70
|
-
return /* @__PURE__ */ a(
|
|
70
|
+
return /* @__PURE__ */ a(aa.Provider, { value: c, children: t });
|
|
71
71
|
}
|
|
72
72
|
function se() {
|
|
73
|
-
return
|
|
73
|
+
return ua(aa);
|
|
74
74
|
}
|
|
75
|
-
async function*
|
|
75
|
+
async function* ba(r, e) {
|
|
76
76
|
var s, l, c, p, m, d, b, S, I;
|
|
77
77
|
const i = (s = r.body) == null ? void 0 : s.getReader();
|
|
78
78
|
if (!i)
|
|
@@ -131,7 +131,7 @@ async function* fa(r, e) {
|
|
|
131
131
|
i.releaseLock();
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
async function
|
|
134
|
+
async function ya(r) {
|
|
135
135
|
var i, n, t, s;
|
|
136
136
|
const e = await r.json();
|
|
137
137
|
if ((t = (n = (i = e.choices) == null ? void 0 : i[0]) == null ? void 0 : n.message) != null && t.content)
|
|
@@ -150,11 +150,11 @@ async function ba(r) {
|
|
|
150
150
|
throw new Error("Unrecognized AI response format");
|
|
151
151
|
}
|
|
152
152
|
const ge = /* @__PURE__ */ new Map();
|
|
153
|
-
function
|
|
153
|
+
function je(r, e) {
|
|
154
154
|
const i = e ? { ...r, fieldValue: void 0, formContext: void 0 } : r;
|
|
155
155
|
return JSON.stringify(i);
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function va(r, e) {
|
|
158
158
|
const i = [], n = e.systemPrompt ?? "You are a helpful assistant providing concise contextual hints for form fields. Keep responses short (1-3 sentences). Be specific and actionable.";
|
|
159
159
|
i.push({ role: "system", content: n });
|
|
160
160
|
const t = [];
|
|
@@ -185,7 +185,7 @@ function ne(r = {}, e = {}) {
|
|
|
185
185
|
);
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
188
|
-
const A =
|
|
188
|
+
const A = je(r, v.privacyMode ?? !1), _ = ge.get(A);
|
|
189
189
|
if (_) {
|
|
190
190
|
c(_), m(!1), b(null), I(!1);
|
|
191
191
|
return;
|
|
@@ -193,7 +193,7 @@ function ne(r = {}, e = {}) {
|
|
|
193
193
|
(k = R.current) == null || k.abort();
|
|
194
194
|
const h = new AbortController();
|
|
195
195
|
R.current = h, m(!0), b(null), c(""), I(!1);
|
|
196
|
-
const w =
|
|
196
|
+
const w = va(r, v), f = v.stream !== !1;
|
|
197
197
|
try {
|
|
198
198
|
const L = {
|
|
199
199
|
"Content-Type": "application/json",
|
|
@@ -206,20 +206,20 @@ function ne(r = {}, e = {}) {
|
|
|
206
206
|
temperature: v.temperature ?? 0.7,
|
|
207
207
|
max_tokens: v.maxTokens ?? 256,
|
|
208
208
|
stream: f
|
|
209
|
-
}),
|
|
209
|
+
}), D = await fetch(v.endpoint, {
|
|
210
210
|
method: "POST",
|
|
211
211
|
headers: L,
|
|
212
212
|
body: j,
|
|
213
213
|
signal: h.signal
|
|
214
214
|
});
|
|
215
|
-
if (!
|
|
216
|
-
const q = await
|
|
217
|
-
throw new Error(`AI request failed (${
|
|
215
|
+
if (!D.ok) {
|
|
216
|
+
const q = await D.text().catch(() => D.statusText);
|
|
217
|
+
throw new Error(`AI request failed (${D.status}): ${q}`);
|
|
218
218
|
}
|
|
219
219
|
if (f) {
|
|
220
220
|
I(!0);
|
|
221
221
|
let q = "";
|
|
222
|
-
for await (const W of
|
|
222
|
+
for await (const W of ba(D, h.signal))
|
|
223
223
|
if (h.signal.aborted || (q += W.token, c(q), (N = W.usage) != null && N.completion_tokens && x.recordTokens(W.usage.completion_tokens), W.done))
|
|
224
224
|
break;
|
|
225
225
|
if (q.length > 0) {
|
|
@@ -228,7 +228,7 @@ function ne(r = {}, e = {}) {
|
|
|
228
228
|
}
|
|
229
229
|
ge.set(A, q);
|
|
230
230
|
} else {
|
|
231
|
-
const q = await
|
|
231
|
+
const q = await ya(D);
|
|
232
232
|
c(q.text), ge.set(A, q.text), (T = q.usage) != null && T.completion_tokens ? x.recordTokens(q.usage.completion_tokens) : x.recordTokens(Math.ceil(q.text.length / 4));
|
|
233
233
|
}
|
|
234
234
|
} catch (L) {
|
|
@@ -265,7 +265,7 @@ function ne(r = {}, e = {}) {
|
|
|
265
265
|
(v = R.current) == null || v.abort(), m(!1), I(!1);
|
|
266
266
|
}, []), u = F(() => {
|
|
267
267
|
if (s) {
|
|
268
|
-
const v =
|
|
268
|
+
const v = je(r, s.config.privacyMode ?? !1);
|
|
269
269
|
ge.delete(v);
|
|
270
270
|
}
|
|
271
271
|
O.current += 1, P();
|
|
@@ -295,13 +295,13 @@ function ne(r = {}, e = {}) {
|
|
|
295
295
|
}
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function _a(r, e) {
|
|
299
299
|
if (r !== "auto" || !e)
|
|
300
300
|
return r === "auto" ? "top" : r;
|
|
301
301
|
const i = e.top, n = window.innerHeight - e.bottom, t = e.left, s = window.innerWidth - e.right, l = Math.max(i, n, t, s);
|
|
302
302
|
return l === i ? "top" : l === n ? "bottom" : l === s ? "right" : "left";
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function xa(r) {
|
|
305
305
|
const e = {
|
|
306
306
|
position: "absolute",
|
|
307
307
|
zIndex: 9999,
|
|
@@ -342,8 +342,8 @@ function _a(r) {
|
|
|
342
342
|
};
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
const
|
|
346
|
-
/* @__PURE__ */
|
|
345
|
+
const wa = /* @__PURE__ */ Object.assign(
|
|
346
|
+
/* @__PURE__ */ ea(
|
|
347
347
|
({
|
|
348
348
|
context: r,
|
|
349
349
|
position: e = "auto",
|
|
@@ -390,7 +390,7 @@ const xa = /* @__PURE__ */ Object.assign(
|
|
|
390
390
|
}, [n]);
|
|
391
391
|
if (!m || !m.enabled)
|
|
392
392
|
return null;
|
|
393
|
-
const x =
|
|
393
|
+
const x = _a(
|
|
394
394
|
e,
|
|
395
395
|
((A = R.current) == null ? void 0 : A.getBoundingClientRect()) ?? null
|
|
396
396
|
);
|
|
@@ -438,7 +438,7 @@ const xa = /* @__PURE__ */ Object.assign(
|
|
|
438
438
|
ref: O,
|
|
439
439
|
role: "tooltip",
|
|
440
440
|
className: "ntd-ai-popover",
|
|
441
|
-
style:
|
|
441
|
+
style: xa(x),
|
|
442
442
|
children: [
|
|
443
443
|
P.loading && !P.text && /* @__PURE__ */ o(
|
|
444
444
|
"div",
|
|
@@ -561,7 +561,7 @@ const xa = /* @__PURE__ */ Object.assign(
|
|
|
561
561
|
),
|
|
562
562
|
{ displayName: "NiceAIHintBubble" }
|
|
563
563
|
);
|
|
564
|
-
function
|
|
564
|
+
function ia(r, e, i) {
|
|
565
565
|
return {
|
|
566
566
|
fieldLabel: r,
|
|
567
567
|
fieldType: "text",
|
|
@@ -573,7 +573,7 @@ function aa(r, e, i) {
|
|
|
573
573
|
customPrompt: i != null && i.placeholder ? `Placeholder: "${i.placeholder}". Suggest content or correct grammar.` : "Suggest content, correct grammar, or auto-complete the text."
|
|
574
574
|
};
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function ra(r, e, i) {
|
|
577
577
|
return {
|
|
578
578
|
fieldLabel: r,
|
|
579
579
|
fieldType: "number",
|
|
@@ -586,7 +586,7 @@ function ia(r, e, i) {
|
|
|
586
586
|
customPrompt: i != null && i.unit ? `Unit: ${i.unit}. Suggest a reasonable value or range for this field.` : "Suggest a reasonable value or range for this field based on the label and constraints."
|
|
587
587
|
};
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function ta(r, e, i) {
|
|
590
590
|
return {
|
|
591
591
|
fieldLabel: r,
|
|
592
592
|
fieldType: i != null && i.multiple ? "multi-select" : "select",
|
|
@@ -595,7 +595,7 @@ function ra(r, e, i) {
|
|
|
595
595
|
customPrompt: "Suggest the most likely selection. Explain why this option is recommended."
|
|
596
596
|
};
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function na(r, e, i) {
|
|
599
599
|
const n = e instanceof Date ? e.toISOString().split("T")[0] : e;
|
|
600
600
|
return {
|
|
601
601
|
fieldLabel: r,
|
|
@@ -609,7 +609,7 @@ function ta(r, e, i) {
|
|
|
609
609
|
customPrompt: 'Suggest a date. For example: "next business day", "end of month", "in 2 weeks". Explain your suggestion briefly.'
|
|
610
610
|
};
|
|
611
611
|
}
|
|
612
|
-
function
|
|
612
|
+
function sa(r, e, i) {
|
|
613
613
|
return {
|
|
614
614
|
fieldLabel: r,
|
|
615
615
|
fieldType: "color",
|
|
@@ -618,7 +618,7 @@ function na(r, e, i) {
|
|
|
618
618
|
customPrompt: i != null && i.industry ? `Industry: ${i.industry}. Suggest a color palette (3-5 hex colors) suitable for this context.` : "Suggest a color or palette of colors that works well for this context. Provide hex values."
|
|
619
619
|
};
|
|
620
620
|
}
|
|
621
|
-
function
|
|
621
|
+
function nr(r, e) {
|
|
622
622
|
return {
|
|
623
623
|
fieldLabel: r,
|
|
624
624
|
fieldType: "data-grid",
|
|
@@ -633,7 +633,7 @@ function tr(r, e) {
|
|
|
633
633
|
customPrompt: "Suggest column configuration, useful filters, or highlight potential data anomalies."
|
|
634
634
|
};
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function sr(r, e) {
|
|
637
637
|
return {
|
|
638
638
|
fieldLabel: r,
|
|
639
639
|
fieldType: "chart",
|
|
@@ -645,7 +645,7 @@ function nr(r, e) {
|
|
|
645
645
|
customPrompt: e != null && e.dataDescription ? `Data: ${e.dataDescription}. Suggest the best chart type and labeling strategy.` : "Suggest the most effective chart type for this data. Explain your recommendation."
|
|
646
646
|
};
|
|
647
647
|
}
|
|
648
|
-
function
|
|
648
|
+
function ka(r, e) {
|
|
649
649
|
return {
|
|
650
650
|
fieldLabel: "Form auto-fill",
|
|
651
651
|
fieldType: "form",
|
|
@@ -654,7 +654,7 @@ function wa(r, e) {
|
|
|
654
654
|
Parse this description and return suggested values for each field as JSON: { ${e.map((i) => `"${i.label}": "value"`).join(", ")} }`
|
|
655
655
|
};
|
|
656
656
|
}
|
|
657
|
-
function
|
|
657
|
+
function Na(r, e, i, n, t) {
|
|
658
658
|
return {
|
|
659
659
|
fieldLabel: r,
|
|
660
660
|
fieldType: e,
|
|
@@ -663,37 +663,37 @@ function ka(r, e, i, n, t) {
|
|
|
663
663
|
customPrompt: `Current validation error: "${n}". Provide a friendly, specific error message with an example of a valid value. Do NOT say "field is required" — instead explain what the user should enter.`
|
|
664
664
|
};
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function or(r, e, i) {
|
|
667
667
|
const { placeholder: n, maxLength: t, pattern: s } = i ?? {}, l = ae(
|
|
668
|
-
() =>
|
|
668
|
+
() => ia(r, e, { placeholder: n, maxLength: t, pattern: s }),
|
|
669
669
|
[r, e, n, t, s]
|
|
670
670
|
);
|
|
671
671
|
return ne(l, i);
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function cr(r, e, i) {
|
|
674
674
|
const { min: n, max: t, step: s, unit: l } = i ?? {}, c = ae(
|
|
675
|
-
() =>
|
|
675
|
+
() => ra(r, e, { min: n, max: t, step: s, unit: l }),
|
|
676
676
|
[r, e, n, t, s, l]
|
|
677
677
|
);
|
|
678
678
|
return ne(c, i);
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function lr(r, e, i) {
|
|
681
681
|
const n = i == null ? void 0 : i.multiple, t = JSON.stringify((i == null ? void 0 : i.options) ?? null), s = ae(
|
|
682
|
-
() =>
|
|
682
|
+
() => ta(r, e, { options: JSON.parse(t) ?? void 0, multiple: n }),
|
|
683
683
|
[r, e, t, n]
|
|
684
684
|
);
|
|
685
685
|
return ne(s, i);
|
|
686
686
|
}
|
|
687
|
-
function
|
|
687
|
+
function dr(r, e, i) {
|
|
688
688
|
const { min: n, max: t, disableWeekends: s } = i ?? {}, l = ae(
|
|
689
|
-
() =>
|
|
689
|
+
() => na(r, e, { min: n, max: t, disableWeekends: s }),
|
|
690
690
|
[r, e, n, t, s]
|
|
691
691
|
);
|
|
692
692
|
return ne(l, i);
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function ur(r, e, i) {
|
|
695
695
|
const n = i == null ? void 0 : i.industry, t = JSON.stringify((i == null ? void 0 : i.palette) ?? null), s = ae(
|
|
696
|
-
() =>
|
|
696
|
+
() => sa(r, e, {
|
|
697
697
|
palette: JSON.parse(t) ?? void 0,
|
|
698
698
|
industry: n
|
|
699
699
|
}),
|
|
@@ -701,18 +701,18 @@ function dr(r, e, i) {
|
|
|
701
701
|
);
|
|
702
702
|
return ne(s, i);
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function pr(r, e, i, n, t) {
|
|
705
705
|
const s = JSON.stringify((t == null ? void 0 : t.rules) ?? null), l = ae(
|
|
706
|
-
() => n ?
|
|
706
|
+
() => n ? Na(r, e, i, n, {
|
|
707
707
|
rules: JSON.parse(s) ?? void 0
|
|
708
708
|
}) : { fieldLabel: r, fieldType: e },
|
|
709
709
|
[r, e, i, n, s]
|
|
710
710
|
);
|
|
711
711
|
return ne(l, { ...t, disabled: !n || (t == null ? void 0 : t.disabled) });
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function mr(r, e, i) {
|
|
714
714
|
const n = ae(
|
|
715
|
-
() => r ?
|
|
715
|
+
() => r ? ka(r, e) : { fieldLabel: "Form" },
|
|
716
716
|
[r, e]
|
|
717
717
|
);
|
|
718
718
|
return ne(n, {
|
|
@@ -720,7 +720,7 @@ function pr(r, e, i) {
|
|
|
720
720
|
disabled: !r || (i == null ? void 0 : i.disabled)
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
|
-
function
|
|
723
|
+
function Sa(r, e, i) {
|
|
724
724
|
const t = (e == null ? void 0 : e.split(`
|
|
725
725
|
`)) ?? [], s = (i == null ? void 0 : i.cursorLine) != null ? t.slice(Math.max(0, i.cursorLine - 8), i.cursorLine + 3).join(`
|
|
726
726
|
`) : t.slice(0, 16).join(`
|
|
@@ -738,7 +738,7 @@ function Na(r, e, i) {
|
|
|
738
738
|
Provide a concise inline completion or improvement hint for the code near the cursor. Limit response to ${(i == null ? void 0 : i.maxSuggestLines) ?? 5} lines of code. If unsure, suggest the most idiomatic approach for this language/framework.`
|
|
739
739
|
};
|
|
740
740
|
}
|
|
741
|
-
function
|
|
741
|
+
function Ca(r, e, i) {
|
|
742
742
|
var s;
|
|
743
743
|
const n = (i == null ? void 0 : i.mode) ?? "grammar", t = {
|
|
744
744
|
seo: "Analyze this HTML for SEO: missing meta tags, heading hierarchy (h1→h2→h3), keyword density, image alt attributes. Return a prioritized list of improvements.",
|
|
@@ -758,7 +758,7 @@ function Sa(r, e, i) {
|
|
|
758
758
|
customPrompt: t[n]
|
|
759
759
|
};
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function Aa(r, e) {
|
|
762
762
|
const i = (e == null ? void 0 : e.mode) ?? "tag", n = `"${r}"` + ((e == null ? void 0 : e.bpm) != null ? `, BPM: ${e.bpm}` : "") + (e != null && e.key ? `, Key: ${e.key}` : "") + (e != null && e.genre ? `, Genre: ${e.genre}` : "") + ((e == null ? void 0 : e.duration) != null ? `, Duration: ${e.duration}s` : ""), t = {
|
|
763
763
|
tag: `Audio: ${n}. Suggest genre tags, mood descriptors and playlist categories. Return as JSON array of strings.`,
|
|
764
764
|
bpm: `Audio: ${n}. Suggest likely BPM range and musical key based on metadata. Return as JSON: { bpm: number, key: string }.`,
|
|
@@ -778,7 +778,7 @@ function Ca(r, e) {
|
|
|
778
778
|
customPrompt: t[i]
|
|
779
779
|
};
|
|
780
780
|
}
|
|
781
|
-
function
|
|
781
|
+
function Ta(r, e) {
|
|
782
782
|
var s;
|
|
783
783
|
const i = (e == null ? void 0 : e.mode) ?? "material", n = (e == null ? void 0 : e.targetDevice) ?? "web", t = {
|
|
784
784
|
material: `Scene "${r}", ${(e == null ? void 0 : e.meshCount) ?? "?"} meshes. Materials: ${((s = e == null ? void 0 : e.materials) == null ? void 0 : s.join(", ")) || "none"}. Suggest PBR properties (roughness, metalness, baseColor) and texture maps for each material.`,
|
|
@@ -798,7 +798,7 @@ function Aa(r, e) {
|
|
|
798
798
|
customPrompt: t[i]
|
|
799
799
|
};
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function Ia(r, e) {
|
|
802
802
|
const i = (e == null ? void 0 : e.mode) ?? "palette", n = (e == null ? void 0 : e.width) != null ? `${e.width}×${e.height ?? "?"}px` : "unknown dimensions", t = {
|
|
803
803
|
filter: `Image "${r}" (${n}). Suggest CSS/SVG filter parameters (brightness, contrast, saturate, hue-rotate, blur) as JSON: { brightness, contrast, saturate, hueRotate, blur }.`,
|
|
804
804
|
palette: `Image "${r}". Extract or suggest a harmonious 5-color palette as JSON: { primary, secondary, accent, background, text }.`,
|
|
@@ -816,7 +816,7 @@ function Ta(r, e) {
|
|
|
816
816
|
customPrompt: t[i]
|
|
817
817
|
};
|
|
818
818
|
}
|
|
819
|
-
function
|
|
819
|
+
function Ra(r, e) {
|
|
820
820
|
var i;
|
|
821
821
|
return {
|
|
822
822
|
fieldLabel: "Icon search",
|
|
@@ -831,55 +831,55 @@ function Ia(r, e) {
|
|
|
831
831
|
Return the ${(e == null ? void 0 : e.limit) ?? 5} most semantically relevant icon names from the available set as a JSON array of strings, ordered by relevance. Prefer specific over generic names.`
|
|
832
832
|
};
|
|
833
833
|
}
|
|
834
|
-
function
|
|
834
|
+
function gr(r, e, i) {
|
|
835
835
|
const n = ae(
|
|
836
|
-
() =>
|
|
836
|
+
() => Sa(r, e, i),
|
|
837
837
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
838
838
|
[r, e, i == null ? void 0 : i.cursorLine, i == null ? void 0 : i.cursorCol, i == null ? void 0 : i.framework]
|
|
839
839
|
);
|
|
840
840
|
return ne(n, i);
|
|
841
841
|
}
|
|
842
|
-
function
|
|
842
|
+
function hr(r, e, i) {
|
|
843
843
|
const n = ae(
|
|
844
|
-
() =>
|
|
844
|
+
() => Ca(r, e, i),
|
|
845
845
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
846
846
|
[r, e, i == null ? void 0 : i.mode, i == null ? void 0 : i.locale]
|
|
847
847
|
);
|
|
848
848
|
return ne(n, i);
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function fr(r, e) {
|
|
851
851
|
const i = ae(
|
|
852
|
-
() =>
|
|
852
|
+
() => Aa(r, e),
|
|
853
853
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
854
854
|
[r, e == null ? void 0 : e.bpm, e == null ? void 0 : e.key, e == null ? void 0 : e.duration, e == null ? void 0 : e.mode]
|
|
855
855
|
);
|
|
856
856
|
return ne(i, e);
|
|
857
857
|
}
|
|
858
|
-
function
|
|
858
|
+
function br(r, e) {
|
|
859
859
|
const i = ae(
|
|
860
|
-
() =>
|
|
860
|
+
() => Ta(r, e),
|
|
861
861
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
862
862
|
[r, e == null ? void 0 : e.meshCount, e == null ? void 0 : e.triangleCount, e == null ? void 0 : e.targetDevice, e == null ? void 0 : e.mode]
|
|
863
863
|
);
|
|
864
864
|
return ne(i, e);
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function yr(r, e) {
|
|
867
867
|
const i = ae(
|
|
868
|
-
() =>
|
|
868
|
+
() => Ia(r, e),
|
|
869
869
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
870
870
|
[r, e == null ? void 0 : e.width, e == null ? void 0 : e.height, e == null ? void 0 : e.mode, e == null ? void 0 : e.targetStyle]
|
|
871
871
|
);
|
|
872
872
|
return ne(i, e);
|
|
873
873
|
}
|
|
874
|
-
function
|
|
874
|
+
function vr(r, e) {
|
|
875
875
|
const i = ae(
|
|
876
|
-
() =>
|
|
876
|
+
() => Ra(r, e),
|
|
877
877
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
878
878
|
[r, e == null ? void 0 : e.limit, e == null ? void 0 : e.style]
|
|
879
879
|
);
|
|
880
880
|
return ne(i, { ...e, disabled: !r || (e == null ? void 0 : e.disabled) });
|
|
881
881
|
}
|
|
882
|
-
function
|
|
882
|
+
function za(r, e) {
|
|
883
883
|
var s;
|
|
884
884
|
const i = (e == null ? void 0 : e.mode) ?? "npc-decision", n = (e == null ? void 0 : e.genre) ?? "fantasy", t = {
|
|
885
885
|
"npc-decision": `You are an AI game director. The NPC "${r}" must make a decision. Available BT nodes: ${JSON.stringify((e == null ? void 0 : e.btStatus) ?? [])}. Game state: ${JSON.stringify((e == null ? void 0 : e.gameState) ?? {})}. Return the name of the BT node to activate next, and one sentence of reasoning.`,
|
|
@@ -900,15 +900,15 @@ function Ra(r, e) {
|
|
|
900
900
|
}
|
|
901
901
|
};
|
|
902
902
|
}
|
|
903
|
-
function
|
|
903
|
+
function _r(r, e) {
|
|
904
904
|
const i = JSON.stringify(e == null ? void 0 : e.btStatus), n = JSON.stringify(e == null ? void 0 : e.gameState), t = ae(
|
|
905
|
-
() =>
|
|
905
|
+
() => za(r, e),
|
|
906
906
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- opts by its fields and the content of the state objects (callers pass them inline)
|
|
907
907
|
[r, e == null ? void 0 : e.mode, e == null ? void 0 : e.genre, i, n]
|
|
908
908
|
);
|
|
909
909
|
return ne(t, e);
|
|
910
910
|
}
|
|
911
|
-
function
|
|
911
|
+
function La(r, e, i) {
|
|
912
912
|
const n = (i == null ? void 0 : i.mode) ?? "layout", t = (i == null ? void 0 : i.diagramType) ?? "flowchart", s = {
|
|
913
913
|
layout: `You are a diagram layout optimizer. Given this ${t} with ${r.length} nodes and ${e.length} edges, suggest optimal positions for each node to minimize edge crossings and improve readability. Return JSON: { suggestions: [{ id: string, x: number, y: number, reason: string }] }. Consider flow direction (top-to-bottom or left-to-right) and grouping related nodes.`,
|
|
914
914
|
structure: `You are a diagram analyst. Analyze this ${t} structure. Identify: 1) Missing connections, 2) Potential bottlenecks, 3) Orphan nodes, 4) Cycles or loops. Return JSON: { issues: [{ type: string, description: string, nodeIds: string[] }], score: number }`,
|
|
@@ -941,15 +941,15 @@ function za(r, e, i) {
|
|
|
941
941
|
customPrompt: s[n]
|
|
942
942
|
};
|
|
943
943
|
}
|
|
944
|
-
function
|
|
944
|
+
function xr(r, e, i) {
|
|
945
945
|
const n = ae(
|
|
946
|
-
() =>
|
|
946
|
+
() => La(r, e, i),
|
|
947
947
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
948
948
|
[JSON.stringify(r), JSON.stringify(e), i == null ? void 0 : i.mode, i == null ? void 0 : i.diagramType]
|
|
949
949
|
);
|
|
950
950
|
return ne(n, { ...i, disabled: r.length === 0 || (i == null ? void 0 : i.disabled) });
|
|
951
951
|
}
|
|
952
|
-
function
|
|
952
|
+
function $a(r, e) {
|
|
953
953
|
const i = (e == null ? void 0 : e.mode) ?? "generate", n = (e == null ? void 0 : e.presentationType) ?? "business", t = (e == null ? void 0 : e.duration) ?? 15, s = Math.ceil(t / 2), l = {
|
|
954
954
|
generate: `You are a presentation designer. Create a ${n} presentation outline based on: "${r}". Target audience: ${(e == null ? void 0 : e.audience) ?? "general"}. Duration: ${t} minutes (~${s} slides). Return JSON: { title: string, slides: [{ title: string, layout: 'title'|'content'|'two-column'|'chart'|'image', bullets?: string[], chartType?: string, speakerNotes?: string }] }. Include: clear slide titles, 3-5 bullet points per content slide, and brief speaker notes.`,
|
|
955
955
|
summarize: `You are a presentation optimizer. Summarize this presentation to be more concise: "${r}". Reduce slide count by 30% while preserving key messages. Return JSON: { summary: string, reducedSlides: [{ title: string, keyPoints: string[] }] }`,
|
|
@@ -971,15 +971,15 @@ function La(r, e) {
|
|
|
971
971
|
customPrompt: l[i]
|
|
972
972
|
};
|
|
973
973
|
}
|
|
974
|
-
function
|
|
974
|
+
function wr(r, e) {
|
|
975
975
|
const i = ae(
|
|
976
|
-
() =>
|
|
976
|
+
() => $a(r, e),
|
|
977
977
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
978
978
|
[r, e == null ? void 0 : e.mode, e == null ? void 0 : e.presentationType, e == null ? void 0 : e.duration, e == null ? void 0 : e.audience]
|
|
979
979
|
);
|
|
980
980
|
return ne(i, { ...e, disabled: !r || (e == null ? void 0 : e.disabled) });
|
|
981
981
|
}
|
|
982
|
-
function
|
|
982
|
+
function Pa(r, e) {
|
|
983
983
|
var t;
|
|
984
984
|
const i = (e == null ? void 0 : e.mode) ?? "all", n = {
|
|
985
985
|
alignment: "Analyze element alignment on this slide. Suggest adjustments to create visual harmony. Return JSON: { suggestions: [{ elementIndex: number, issue: string, fixX?: number, fixY?: number }] }",
|
|
@@ -1001,16 +1001,16 @@ function $a(r, e) {
|
|
|
1001
1001
|
customPrompt: n[i]
|
|
1002
1002
|
};
|
|
1003
1003
|
}
|
|
1004
|
-
function
|
|
1004
|
+
function kr(r, e) {
|
|
1005
1005
|
const i = ae(
|
|
1006
|
-
() =>
|
|
1006
|
+
() => Pa(r, e),
|
|
1007
1007
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1008
1008
|
[JSON.stringify(r), e == null ? void 0 : e.mode, JSON.stringify(e == null ? void 0 : e.brandColors)]
|
|
1009
1009
|
);
|
|
1010
1010
|
return ne(i, e);
|
|
1011
1011
|
}
|
|
1012
|
-
function
|
|
1013
|
-
const n =
|
|
1012
|
+
function Nr(r, e, i) {
|
|
1013
|
+
const n = ea((t, s) => {
|
|
1014
1014
|
const {
|
|
1015
1015
|
aiEnabled: l = !0,
|
|
1016
1016
|
aiPosition: c = "right",
|
|
@@ -1026,7 +1026,7 @@ function kr(r, e, i) {
|
|
|
1026
1026
|
return /* @__PURE__ */ o("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
|
|
1027
1027
|
/* @__PURE__ */ a(r, { ...S, ref: s }),
|
|
1028
1028
|
l && /* @__PURE__ */ a(
|
|
1029
|
-
|
|
1029
|
+
wa,
|
|
1030
1030
|
{
|
|
1031
1031
|
context: I,
|
|
1032
1032
|
position: c,
|
|
@@ -1039,35 +1039,35 @@ function kr(r, e, i) {
|
|
|
1039
1039
|
});
|
|
1040
1040
|
return n.displayName = i ?? `withAIHint(${r.displayName ?? r.name ?? "Component"})`, n;
|
|
1041
1041
|
}
|
|
1042
|
-
function
|
|
1043
|
-
return
|
|
1042
|
+
function Sr(r) {
|
|
1043
|
+
return ia(r.label ?? "Text", r.value, {
|
|
1044
1044
|
placeholder: r.placeholder,
|
|
1045
1045
|
maxLength: r.maxLength
|
|
1046
1046
|
});
|
|
1047
1047
|
}
|
|
1048
|
-
function
|
|
1049
|
-
return
|
|
1048
|
+
function Cr(r) {
|
|
1049
|
+
return ra(r.label ?? "Number", r.value, {
|
|
1050
1050
|
min: r.min,
|
|
1051
1051
|
max: r.max,
|
|
1052
1052
|
step: r.step
|
|
1053
1053
|
});
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1056
|
-
return
|
|
1055
|
+
function Ar(r) {
|
|
1056
|
+
return ta(r.label ?? "Select", r.value, {
|
|
1057
1057
|
options: r.options,
|
|
1058
1058
|
multiple: r.multiple
|
|
1059
1059
|
});
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1062
|
-
return
|
|
1061
|
+
function Tr(r) {
|
|
1062
|
+
return na(r.label ?? "Date", r.value, {
|
|
1063
1063
|
min: r.min,
|
|
1064
1064
|
max: r.max
|
|
1065
1065
|
});
|
|
1066
1066
|
}
|
|
1067
|
-
function
|
|
1068
|
-
return
|
|
1067
|
+
function Ir(r) {
|
|
1068
|
+
return sa(r.label ?? "Color", r.value);
|
|
1069
1069
|
}
|
|
1070
|
-
const
|
|
1070
|
+
const Ma = (r) => ({
|
|
1071
1071
|
id: oe(),
|
|
1072
1072
|
name: r,
|
|
1073
1073
|
type: "classification",
|
|
@@ -1077,7 +1077,7 @@ const Pa = (r) => ({
|
|
|
1077
1077
|
models: [],
|
|
1078
1078
|
createdAt: /* @__PURE__ */ new Date(),
|
|
1079
1079
|
updatedAt: /* @__PURE__ */ new Date()
|
|
1080
|
-
}),
|
|
1080
|
+
}), Ne = {
|
|
1081
1081
|
classification: [
|
|
1082
1082
|
{
|
|
1083
1083
|
id: "logistic-regression",
|
|
@@ -1106,10 +1106,10 @@ const Pa = (r) => ({
|
|
|
1106
1106
|
{ id: "dbscan", key: "mlStudio.alg.dbscan", name: "DBSCAN" },
|
|
1107
1107
|
{ id: "hierarchical", key: "mlStudio.alg.hierarchical", name: "Hierarchical Clustering" }
|
|
1108
1108
|
]
|
|
1109
|
-
},
|
|
1110
|
-
const i =
|
|
1109
|
+
}, Oa = /* @__PURE__ */ Object.values(Ne).flat(), Be = (r, e) => {
|
|
1110
|
+
const i = Oa.find((n) => n.id === r);
|
|
1111
1111
|
return i ? e(i.key, i.name) : r;
|
|
1112
|
-
},
|
|
1112
|
+
}, Da = [
|
|
1113
1113
|
["classification", "mlStudio.type.classification", "Classification"],
|
|
1114
1114
|
["regression", "mlStudio.type.regression", "Regression"],
|
|
1115
1115
|
["clustering", "mlStudio.type.clustering", "Clustering"],
|
|
@@ -1121,36 +1121,36 @@ const Pa = (r) => ({
|
|
|
1121
1121
|
["experiments", "mlStudio.tab.experiments", "Experiments"],
|
|
1122
1122
|
["models", "mlStudio.tab.models", "Models"],
|
|
1123
1123
|
["deploy", "mlStudio.tab.deploy", "Deploy"]
|
|
1124
|
-
],
|
|
1124
|
+
], ja = [
|
|
1125
1125
|
["numeric", "mlStudio.colType.numeric", "Numeric"],
|
|
1126
1126
|
["categorical", "mlStudio.colType.categorical", "Categorical"],
|
|
1127
1127
|
["text", "mlStudio.colType.text", "Text"],
|
|
1128
1128
|
["datetime", "mlStudio.colType.datetime", "DateTime"],
|
|
1129
1129
|
["boolean", "mlStudio.colType.boolean", "Boolean"],
|
|
1130
1130
|
["embedding", "mlStudio.colType.embedding", "Embedding"]
|
|
1131
|
-
],
|
|
1131
|
+
], Ba = {
|
|
1132
1132
|
train: ["mlStudio.split.train", "Train"],
|
|
1133
1133
|
validation: ["mlStudio.split.validation", "Validation"],
|
|
1134
1134
|
test: ["mlStudio.split.test", "Test"]
|
|
1135
|
-
},
|
|
1135
|
+
}, Fa = {
|
|
1136
1136
|
pending: ["mlStudio.experimentStatus.pending", "Pending"],
|
|
1137
1137
|
running: ["mlStudio.experimentStatus.running", "Running"],
|
|
1138
1138
|
completed: ["mlStudio.experimentStatus.completed", "Completed"],
|
|
1139
1139
|
failed: ["mlStudio.experimentStatus.failed", "Failed"],
|
|
1140
1140
|
cancelled: ["mlStudio.experimentStatus.cancelled", "Cancelled"]
|
|
1141
|
-
},
|
|
1141
|
+
}, Ja = {
|
|
1142
1142
|
draft: ["mlStudio.modelStatus.draft", "Draft"],
|
|
1143
1143
|
registered: ["mlStudio.modelStatus.registered", "Registered"],
|
|
1144
1144
|
staging: ["mlStudio.modelStatus.staging", "Staging"],
|
|
1145
1145
|
production: ["mlStudio.modelStatus.production", "Production"],
|
|
1146
1146
|
archived: ["mlStudio.modelStatus.archived", "Archived"]
|
|
1147
|
-
},
|
|
1147
|
+
}, qa = {
|
|
1148
1148
|
pending: ["mlStudio.deploymentStatus.pending", "Pending"],
|
|
1149
1149
|
deploying: ["mlStudio.deploymentStatus.deploying", "Deploying"],
|
|
1150
1150
|
running: ["mlStudio.deploymentStatus.running", "Running"],
|
|
1151
1151
|
stopped: ["mlStudio.deploymentStatus.stopped", "Stopped"],
|
|
1152
1152
|
failed: ["mlStudio.deploymentStatus.failed", "Failed"]
|
|
1153
|
-
}, he = (r, e, i) => r ? i(r[0], r[1]) : e,
|
|
1153
|
+
}, he = (r, e, i) => r ? i(r[0], r[1]) : e, Ua = /* @__PURE__ */ new Set(["accuracy", "precision", "recall", "f1-score", "auc-roc"]), Fe = ({ name: r, value: e }, i) => Ua.has(r) ? `${(e * 100).toLocaleString(i, { minimumFractionDigits: 1, maximumFractionDigits: 1 })}%` : e.toLocaleString(i, { maximumFractionDigits: 3 }), Ga = [
|
|
1154
1154
|
{
|
|
1155
1155
|
target: ".nice-ml-studio",
|
|
1156
1156
|
titleKey: "tutorial.mlStudio.intro.title",
|
|
@@ -1159,7 +1159,7 @@ const Pa = (r) => ({
|
|
|
1159
1159
|
content: "Work through the tabs: prepare datasets, run experiments, compare and pick models, then deploy the best one.",
|
|
1160
1160
|
placement: "auto"
|
|
1161
1161
|
}
|
|
1162
|
-
],
|
|
1162
|
+
], Rr = ({
|
|
1163
1163
|
project: r,
|
|
1164
1164
|
onProjectChange: e,
|
|
1165
1165
|
onExperimentRun: i,
|
|
@@ -1170,7 +1170,7 @@ const Pa = (r) => ({
|
|
|
1170
1170
|
}) => {
|
|
1171
1171
|
var Z;
|
|
1172
1172
|
const { t: c, lang: p } = ie(), [m, d] = M(
|
|
1173
|
-
() => r ||
|
|
1173
|
+
() => r || Ma(c("mlStudio.newProject", "New ML Project"))
|
|
1174
1174
|
), [b, S] = M("data"), [I, R] = M(null), [O, P] = M(null), [g, u] = M(null), [v, x] = M(!1), [A, _] = M({
|
|
1175
1175
|
algorithm: "",
|
|
1176
1176
|
hyperparameters: {},
|
|
@@ -1282,7 +1282,7 @@ const Pa = (r) => ({
|
|
|
1282
1282
|
(U) => U.id === C ? { ...U, status: "production", deployments: [...U.deployments, J] } : U
|
|
1283
1283
|
)
|
|
1284
1284
|
}));
|
|
1285
|
-
}, j = (C) => C < 1024 ? `${C} B` : C < 1024 * 1024 ? `${(C / 1024).toFixed(1)} KB` : C < 1024 * 1024 * 1024 ? `${(C / 1024 / 1024).toFixed(1)} MB` : `${(C / 1024 / 1024 / 1024).toFixed(1)} GB`,
|
|
1285
|
+
}, j = (C) => C < 1024 ? `${C} B` : C < 1024 * 1024 ? `${(C / 1024).toFixed(1)} KB` : C < 1024 * 1024 * 1024 ? `${(C / 1024 / 1024).toFixed(1)} MB` : `${(C / 1024 / 1024 / 1024).toFixed(1)} GB`, D = (C) => {
|
|
1286
1286
|
switch (C) {
|
|
1287
1287
|
case "completed":
|
|
1288
1288
|
case "production":
|
|
@@ -1317,7 +1317,7 @@ const Pa = (r) => ({
|
|
|
1317
1317
|
onChange: (C) => w({ type: C.target.value }),
|
|
1318
1318
|
className: "nice-ml-studio__project-type-select",
|
|
1319
1319
|
"aria-label": c("mlStudio.projectType", "Project type"),
|
|
1320
|
-
children:
|
|
1320
|
+
children: Da.map(([C, y, J]) => /* @__PURE__ */ a("option", { value: C, children: c(y, J) }, C))
|
|
1321
1321
|
}
|
|
1322
1322
|
)
|
|
1323
1323
|
] }), W = /* @__PURE__ */ a("div", { className: "nice-ml-studio__header-tabs", children: Ea.map(([C, y, J]) => /* @__PURE__ */ a(
|
|
@@ -1358,6 +1358,9 @@ const Pa = (r) => ({
|
|
|
1358
1358
|
] }) : m.datasets.map((C) => /* @__PURE__ */ o(
|
|
1359
1359
|
"div",
|
|
1360
1360
|
{
|
|
1361
|
+
role: "button",
|
|
1362
|
+
tabIndex: 0,
|
|
1363
|
+
onKeyDown: fe,
|
|
1361
1364
|
className: `nice-ml-studio__dataset-card ${I === C.id ? "nice-ml-studio__dataset-card--selected" : ""}`,
|
|
1362
1365
|
onClick: () => R(C.id),
|
|
1363
1366
|
children: [
|
|
@@ -1392,7 +1395,7 @@ const Pa = (r) => ({
|
|
|
1392
1395
|
{
|
|
1393
1396
|
className: `nice-ml-studio__split nice-ml-studio__split--${y.name}`,
|
|
1394
1397
|
style: { width: `${y.ratio * 100}%` },
|
|
1395
|
-
title: `${he(
|
|
1398
|
+
title: `${he(Ba[y.name], y.name, c)}: ${(y.ratio * 100).toFixed(0)}%`
|
|
1396
1399
|
},
|
|
1397
1400
|
y.name
|
|
1398
1401
|
)) })
|
|
@@ -1433,7 +1436,7 @@ const Pa = (r) => ({
|
|
|
1433
1436
|
)
|
|
1434
1437
|
});
|
|
1435
1438
|
},
|
|
1436
|
-
children:
|
|
1439
|
+
children: ja.map(([J, H, U]) => /* @__PURE__ */ a("option", { value: J, children: c(H, U) }, J))
|
|
1437
1440
|
}
|
|
1438
1441
|
) }),
|
|
1439
1442
|
/* @__PURE__ */ a("td", { children: y.missing }),
|
|
@@ -1486,7 +1489,7 @@ const Pa = (r) => ({
|
|
|
1486
1489
|
onChange: (C) => _({ ...A, algorithm: C.target.value }),
|
|
1487
1490
|
children: [
|
|
1488
1491
|
/* @__PURE__ */ a("option", { value: "", children: c("mlStudio.selectAlgorithm", "Select algorithm...") }),
|
|
1489
|
-
(
|
|
1492
|
+
(Ne[m.type] || Ne.classification).map((C) => /* @__PURE__ */ a("option", { value: C.id, children: c(C.key, C.name) }, C.id))
|
|
1490
1493
|
]
|
|
1491
1494
|
}
|
|
1492
1495
|
)
|
|
@@ -1536,6 +1539,9 @@ const Pa = (r) => ({
|
|
|
1536
1539
|
] }) : m.experiments.map((C) => /* @__PURE__ */ o(
|
|
1537
1540
|
"div",
|
|
1538
1541
|
{
|
|
1542
|
+
role: "button",
|
|
1543
|
+
tabIndex: 0,
|
|
1544
|
+
onKeyDown: fe,
|
|
1539
1545
|
className: `nice-ml-studio__experiment-card ${O === C.id ? "nice-ml-studio__experiment-card--selected" : ""}`,
|
|
1540
1546
|
onClick: () => P(C.id),
|
|
1541
1547
|
children: [
|
|
@@ -1544,15 +1550,15 @@ const Pa = (r) => ({
|
|
|
1544
1550
|
/* @__PURE__ */ a(
|
|
1545
1551
|
"span",
|
|
1546
1552
|
{
|
|
1547
|
-
className: `nice-ml-studio__status-badge nice-ml-studio__status-badge--${
|
|
1548
|
-
children: he(
|
|
1553
|
+
className: `nice-ml-studio__status-badge nice-ml-studio__status-badge--${D(C.status)}`,
|
|
1554
|
+
children: he(Fa[C.status], C.status, c)
|
|
1549
1555
|
}
|
|
1550
1556
|
)
|
|
1551
1557
|
] }),
|
|
1552
1558
|
/* @__PURE__ */ o("div", { className: "nice-ml-studio__card-meta", children: [
|
|
1553
1559
|
/* @__PURE__ */ a("span", { children: c("mlStudio.algorithmValue", "Algorithm: {name}").replace(
|
|
1554
1560
|
"{name}",
|
|
1555
|
-
|
|
1561
|
+
Be(C.config.algorithm, c)
|
|
1556
1562
|
) }),
|
|
1557
1563
|
C.duration !== void 0 && /* @__PURE__ */ a("span", { children: c("mlStudio.duration", "Duration: {seconds}s").replace(
|
|
1558
1564
|
"{seconds}",
|
|
@@ -1561,7 +1567,7 @@ const Pa = (r) => ({
|
|
|
1561
1567
|
] }),
|
|
1562
1568
|
C.metrics.length > 0 && /* @__PURE__ */ a("div", { className: "nice-ml-studio__metrics-row", children: C.metrics.slice(0, 3).map((y) => /* @__PURE__ */ o("div", { className: "nice-ml-studio__metric-item", children: [
|
|
1563
1569
|
/* @__PURE__ */ a("span", { className: "nice-ml-studio__metric-name", children: y.name }),
|
|
1564
|
-
/* @__PURE__ */ a("span", { className: "nice-ml-studio__metric-value", children:
|
|
1570
|
+
/* @__PURE__ */ a("span", { className: "nice-ml-studio__metric-value", children: Fe(y, p) })
|
|
1565
1571
|
] }, y.name)) }),
|
|
1566
1572
|
C.status === "completed" && /* @__PURE__ */ a(
|
|
1567
1573
|
"button",
|
|
@@ -1587,6 +1593,9 @@ const Pa = (r) => ({
|
|
|
1587
1593
|
] }) : m.models.map((C) => /* @__PURE__ */ o(
|
|
1588
1594
|
"div",
|
|
1589
1595
|
{
|
|
1596
|
+
role: "button",
|
|
1597
|
+
tabIndex: 0,
|
|
1598
|
+
onKeyDown: fe,
|
|
1590
1599
|
className: `nice-ml-studio__model-card ${g === C.id ? "nice-ml-studio__model-card--selected" : ""}`,
|
|
1591
1600
|
onClick: () => u(C.id),
|
|
1592
1601
|
children: [
|
|
@@ -1595,15 +1604,15 @@ const Pa = (r) => ({
|
|
|
1595
1604
|
/* @__PURE__ */ a(
|
|
1596
1605
|
"span",
|
|
1597
1606
|
{
|
|
1598
|
-
className: `nice-ml-studio__status-badge nice-ml-studio__status-badge--${
|
|
1599
|
-
children: he(
|
|
1607
|
+
className: `nice-ml-studio__status-badge nice-ml-studio__status-badge--${D(C.status)}`,
|
|
1608
|
+
children: he(Ja[C.status], C.status, c)
|
|
1600
1609
|
}
|
|
1601
1610
|
)
|
|
1602
1611
|
] }),
|
|
1603
1612
|
/* @__PURE__ */ o("div", { className: "nice-ml-studio__card-meta", children: [
|
|
1604
1613
|
/* @__PURE__ */ a("span", { children: c("mlStudio.algorithmValue", "Algorithm: {name}").replace(
|
|
1605
1614
|
"{name}",
|
|
1606
|
-
|
|
1615
|
+
Be(C.algorithm, c)
|
|
1607
1616
|
) }),
|
|
1608
1617
|
/* @__PURE__ */ a("span", { children: c("mlStudio.version", "Version: {version}").replace(
|
|
1609
1618
|
"{version}",
|
|
@@ -1616,7 +1625,7 @@ const Pa = (r) => ({
|
|
|
1616
1625
|
] }),
|
|
1617
1626
|
C.metrics.length > 0 && /* @__PURE__ */ a("div", { className: "nice-ml-studio__metrics-row", children: C.metrics.slice(0, 3).map((y) => /* @__PURE__ */ o("div", { className: "nice-ml-studio__metric-item", children: [
|
|
1618
1627
|
/* @__PURE__ */ a("span", { className: "nice-ml-studio__metric-name", children: y.name }),
|
|
1619
|
-
/* @__PURE__ */ a("span", { className: "nice-ml-studio__metric-value", children:
|
|
1628
|
+
/* @__PURE__ */ a("span", { className: "nice-ml-studio__metric-value", children: Fe(y, p) })
|
|
1620
1629
|
] }, y.name)) }),
|
|
1621
1630
|
/* @__PURE__ */ o("div", { className: "nice-ml-studio__card-actions", children: [
|
|
1622
1631
|
/* @__PURE__ */ a(
|
|
@@ -1661,8 +1670,8 @@ const Pa = (r) => ({
|
|
|
1661
1670
|
/* @__PURE__ */ a(
|
|
1662
1671
|
"span",
|
|
1663
1672
|
{
|
|
1664
|
-
className: `nice-ml-studio__status-badge nice-ml-studio__status-badge--${
|
|
1665
|
-
children: he(
|
|
1673
|
+
className: `nice-ml-studio__status-badge nice-ml-studio__status-badge--${D(y.status)}`,
|
|
1674
|
+
children: he(qa[y.status], y.status, c)
|
|
1666
1675
|
}
|
|
1667
1676
|
)
|
|
1668
1677
|
] }),
|
|
@@ -1691,10 +1700,10 @@ const Pa = (r) => ({
|
|
|
1691
1700
|
] })
|
|
1692
1701
|
] });
|
|
1693
1702
|
return /* @__PURE__ */ o("div", { className: `nice-ml-studio ${s}`, style: { position: "relative" }, children: [
|
|
1694
|
-
/* @__PURE__ */ a("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 30 }, children: /* @__PURE__ */ a(
|
|
1695
|
-
/* @__PURE__ */ a(
|
|
1703
|
+
/* @__PURE__ */ a("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 30 }, children: /* @__PURE__ */ a(ma, { steps: ga(l, Ga) }) }),
|
|
1704
|
+
/* @__PURE__ */ a(ha, { flush: !0, menubar: q, toolbar: W, children: Y })
|
|
1696
1705
|
] });
|
|
1697
|
-
},
|
|
1706
|
+
}, Wa = {
|
|
1698
1707
|
id: oe(),
|
|
1699
1708
|
name: "New Labeling Project",
|
|
1700
1709
|
type: "classification",
|
|
@@ -1714,7 +1723,7 @@ const Pa = (r) => ({
|
|
|
1714
1723
|
byClass: []
|
|
1715
1724
|
},
|
|
1716
1725
|
createdAt: /* @__PURE__ */ new Date()
|
|
1717
|
-
},
|
|
1726
|
+
}, Je = [
|
|
1718
1727
|
"var(--nice-danger, #ef4444)",
|
|
1719
1728
|
"var(--nice-warning, #f97316)",
|
|
1720
1729
|
"var(--nice-warning, #f59e0b)",
|
|
@@ -1729,12 +1738,12 @@ const Pa = (r) => ({
|
|
|
1729
1738
|
"var(--nice-color-accent-pink, #d946ef)",
|
|
1730
1739
|
"var(--nice-color-accent-pink, #ec4899)",
|
|
1731
1740
|
"var(--nice-danger, #f43f5e)"
|
|
1732
|
-
],
|
|
1741
|
+
], Ha = {
|
|
1733
1742
|
label: "Label",
|
|
1734
1743
|
schema: "Schema",
|
|
1735
1744
|
review: "Review",
|
|
1736
1745
|
export: "Export"
|
|
1737
|
-
},
|
|
1746
|
+
}, zr = ({
|
|
1738
1747
|
project: r,
|
|
1739
1748
|
onProjectChange: e,
|
|
1740
1749
|
onLabelSave: i,
|
|
@@ -1742,30 +1751,30 @@ const Pa = (r) => ({
|
|
|
1742
1751
|
className: t = ""
|
|
1743
1752
|
}) => {
|
|
1744
1753
|
var me;
|
|
1745
|
-
const { t: s } = ie(), [l, c] = M(r ||
|
|
1754
|
+
const { t: s } = ie(), [l, c] = M(r || Wa), [p, m] = M("label"), [d, b] = M(0), [S, I] = M(null), [R, O] = M("select"), [P, g] = M(!1), [u, v] = M(null), [x, A] = M(1), [_, h] = M(!1), [w, f] = M("all"), k = X(null), N = X(null), T = l.items[d];
|
|
1746
1755
|
te(() => {
|
|
1747
1756
|
r && c(r);
|
|
1748
1757
|
}, [r]);
|
|
1749
1758
|
const L = F(
|
|
1750
1759
|
(z) => {
|
|
1751
|
-
const
|
|
1752
|
-
|
|
1753
|
-
totalItems:
|
|
1754
|
-
labeled:
|
|
1755
|
-
reviewed:
|
|
1756
|
-
approved:
|
|
1757
|
-
byClass:
|
|
1760
|
+
const E = { ...l, ...z };
|
|
1761
|
+
E.statistics = {
|
|
1762
|
+
totalItems: E.items.length,
|
|
1763
|
+
labeled: E.items.filter((G) => G.status !== "pending").length,
|
|
1764
|
+
reviewed: E.items.filter((G) => G.status === "review" || G.status === "approved").length,
|
|
1765
|
+
approved: E.items.filter((G) => G.status === "approved").length,
|
|
1766
|
+
byClass: E.labelSchema.classes.map((G) => ({
|
|
1758
1767
|
classId: G.id,
|
|
1759
|
-
count:
|
|
1768
|
+
count: E.items.flatMap((B) => B.labels).filter((B) => B.classId === G.id).length
|
|
1760
1769
|
}))
|
|
1761
|
-
}, c(
|
|
1770
|
+
}, c(E), e == null || e(E);
|
|
1762
1771
|
},
|
|
1763
1772
|
[l, e]
|
|
1764
1773
|
), j = () => {
|
|
1765
1774
|
const z = {
|
|
1766
1775
|
id: oe(),
|
|
1767
1776
|
name: `Class ${l.labelSchema.classes.length + 1}`,
|
|
1768
|
-
color:
|
|
1777
|
+
color: Je[l.labelSchema.classes.length % Je.length],
|
|
1769
1778
|
shortcut: String(l.labelSchema.classes.length + 1)
|
|
1770
1779
|
};
|
|
1771
1780
|
L({
|
|
@@ -1774,34 +1783,34 @@ const Pa = (r) => ({
|
|
|
1774
1783
|
classes: [...l.labelSchema.classes, z]
|
|
1775
1784
|
}
|
|
1776
1785
|
});
|
|
1777
|
-
},
|
|
1786
|
+
}, D = (z) => {
|
|
1778
1787
|
L({
|
|
1779
1788
|
labelSchema: {
|
|
1780
1789
|
...l.labelSchema,
|
|
1781
|
-
classes: l.labelSchema.classes.filter((
|
|
1790
|
+
classes: l.labelSchema.classes.filter((E) => E.id !== z)
|
|
1782
1791
|
},
|
|
1783
|
-
items: l.items.map((
|
|
1784
|
-
...
|
|
1785
|
-
labels:
|
|
1792
|
+
items: l.items.map((E) => ({
|
|
1793
|
+
...E,
|
|
1794
|
+
labels: E.labels.filter((G) => G.classId !== z)
|
|
1786
1795
|
}))
|
|
1787
1796
|
});
|
|
1788
|
-
}, q = (z,
|
|
1797
|
+
}, q = (z, E) => {
|
|
1789
1798
|
L({
|
|
1790
1799
|
labelSchema: {
|
|
1791
1800
|
...l.labelSchema,
|
|
1792
1801
|
classes: l.labelSchema.classes.map(
|
|
1793
|
-
(G) => G.id === z ? { ...G, ...
|
|
1802
|
+
(G) => G.id === z ? { ...G, ...E } : G
|
|
1794
1803
|
)
|
|
1795
1804
|
}
|
|
1796
1805
|
});
|
|
1797
|
-
}, W = (z,
|
|
1806
|
+
}, W = (z, E) => {
|
|
1798
1807
|
if (!T)
|
|
1799
1808
|
return;
|
|
1800
1809
|
const G = {
|
|
1801
1810
|
id: oe(),
|
|
1802
1811
|
classId: z,
|
|
1803
1812
|
type: l.type === "classification" ? "class" : l.type === "bounding-box" ? "bbox" : "class",
|
|
1804
|
-
data:
|
|
1813
|
+
data: E || {},
|
|
1805
1814
|
createdBy: "current-user",
|
|
1806
1815
|
createdAt: /* @__PURE__ */ new Date()
|
|
1807
1816
|
}, B = {
|
|
@@ -1815,31 +1824,31 @@ const Pa = (r) => ({
|
|
|
1815
1824
|
}, Y = (z) => {
|
|
1816
1825
|
if (!T)
|
|
1817
1826
|
return;
|
|
1818
|
-
const
|
|
1827
|
+
const E = {
|
|
1819
1828
|
...T,
|
|
1820
1829
|
labels: T.labels.filter((G) => G.id !== z),
|
|
1821
1830
|
status: T.labels.length <= 1 ? "pending" : "labeled"
|
|
1822
1831
|
};
|
|
1823
1832
|
L({
|
|
1824
|
-
items: l.items.map((G) => G.id === T.id ?
|
|
1833
|
+
items: l.items.map((G) => G.id === T.id ? E : G)
|
|
1825
1834
|
});
|
|
1826
1835
|
}, Z = (z) => {
|
|
1827
1836
|
var K;
|
|
1828
1837
|
if (R !== "bbox" || !S)
|
|
1829
1838
|
return;
|
|
1830
|
-
const
|
|
1831
|
-
if (!
|
|
1839
|
+
const E = (K = k.current) == null ? void 0 : K.getBoundingClientRect();
|
|
1840
|
+
if (!E)
|
|
1832
1841
|
return;
|
|
1833
|
-
const G = (z.clientX -
|
|
1842
|
+
const G = (z.clientX - E.left) / x, B = (z.clientY - E.top) / x;
|
|
1834
1843
|
g(!0), v({ x: G, y: B, width: 0, height: 0 });
|
|
1835
1844
|
}, C = (z) => {
|
|
1836
1845
|
var K;
|
|
1837
1846
|
if (!P || !u)
|
|
1838
1847
|
return;
|
|
1839
|
-
const
|
|
1840
|
-
if (!
|
|
1848
|
+
const E = (K = k.current) == null ? void 0 : K.getBoundingClientRect();
|
|
1849
|
+
if (!E)
|
|
1841
1850
|
return;
|
|
1842
|
-
const G = (z.clientX -
|
|
1851
|
+
const G = (z.clientX - E.left) / x, B = (z.clientY - E.top) / x;
|
|
1843
1852
|
v({
|
|
1844
1853
|
...u,
|
|
1845
1854
|
width: G - u.x,
|
|
@@ -1853,12 +1862,12 @@ const Pa = (r) => ({
|
|
|
1853
1862
|
height: Math.abs(u.height)
|
|
1854
1863
|
}), v(null));
|
|
1855
1864
|
}, J = (z) => {
|
|
1856
|
-
const
|
|
1865
|
+
const E = w === "all" ? l.items : l.items.filter((B) => B.status === w), G = E.findIndex((B) => B.id === (T == null ? void 0 : T.id));
|
|
1857
1866
|
if (z === "prev" && G > 0) {
|
|
1858
|
-
const B =
|
|
1867
|
+
const B = E[G - 1];
|
|
1859
1868
|
b(l.items.findIndex((K) => K.id === B.id));
|
|
1860
|
-
} else if (z === "next" && G <
|
|
1861
|
-
const B =
|
|
1869
|
+
} else if (z === "next" && G < E.length - 1) {
|
|
1870
|
+
const B = E[G + 1];
|
|
1862
1871
|
b(l.items.findIndex((K) => K.id === B.id));
|
|
1863
1872
|
}
|
|
1864
1873
|
}, H = () => {
|
|
@@ -1869,7 +1878,7 @@ const Pa = (r) => ({
|
|
|
1869
1878
|
status: "approved"
|
|
1870
1879
|
};
|
|
1871
1880
|
L({
|
|
1872
|
-
items: l.items.map((
|
|
1881
|
+
items: l.items.map((E) => E.id === T.id ? z : E)
|
|
1873
1882
|
}), J("next");
|
|
1874
1883
|
}, U = () => {
|
|
1875
1884
|
if (!T)
|
|
@@ -1879,20 +1888,20 @@ const Pa = (r) => ({
|
|
|
1879
1888
|
status: "rejected"
|
|
1880
1889
|
};
|
|
1881
1890
|
L({
|
|
1882
|
-
items: l.items.map((
|
|
1891
|
+
items: l.items.map((E) => E.id === T.id ? z : E)
|
|
1883
1892
|
}), J("next");
|
|
1884
1893
|
}, V = async (z) => {
|
|
1885
1894
|
n && await n(z);
|
|
1886
1895
|
}, Q = X(() => {
|
|
1887
1896
|
});
|
|
1888
1897
|
Q.current = (z) => {
|
|
1889
|
-
const
|
|
1890
|
-
if (p !== "label" || z.defaultPrevented || z.ctrlKey || z.metaKey || z.altKey ||
|
|
1898
|
+
const E = z.target instanceof HTMLElement ? z.target : null;
|
|
1899
|
+
if (p !== "label" || z.defaultPrevented || z.ctrlKey || z.metaKey || z.altKey || E != null && E.isContentEditable || E && /^(INPUT|TEXTAREA|SELECT)$/.test(E.tagName) || z.key === "Enter" && (E != null && E.closest("button, a")))
|
|
1891
1900
|
return;
|
|
1892
1901
|
const G = z.key, B = l.labelSchema.classes.find((K) => K.shortcut === G);
|
|
1893
1902
|
B && (l.type === "classification" ? (W(B.id), J("next")) : I(B.id)), z.key === "ArrowLeft" || z.key === "a" ? J("prev") : (z.key === "ArrowRight" || z.key === "d") && J("next"), z.key === "Enter" ? H() : z.key === "Backspace" && U();
|
|
1894
1903
|
}, te(() => {
|
|
1895
|
-
const z = (
|
|
1904
|
+
const z = (E) => Q.current(E);
|
|
1896
1905
|
return window.addEventListener("keydown", z), () => window.removeEventListener("keydown", z);
|
|
1897
1906
|
}, []);
|
|
1898
1907
|
const ue = (z) => {
|
|
@@ -1939,7 +1948,7 @@ const Pa = (r) => ({
|
|
|
1939
1948
|
{
|
|
1940
1949
|
className: `nice-data-labeler__tab-button ${p === z ? "nice-data-labeler__tab-button--active" : ""}`,
|
|
1941
1950
|
onClick: () => m(z),
|
|
1942
|
-
children: s(`dataLabeler.tab.${z}`,
|
|
1951
|
+
children: s(`dataLabeler.tab.${z}`, Ha[z])
|
|
1943
1952
|
},
|
|
1944
1953
|
z
|
|
1945
1954
|
)) }),
|
|
@@ -2074,7 +2083,7 @@ const Pa = (r) => ({
|
|
|
2074
2083
|
style: { transform: `scale(${x})` },
|
|
2075
2084
|
children: [
|
|
2076
2085
|
T.labels.filter((z) => z.type === "bbox" && z.data.x !== void 0).map((z) => {
|
|
2077
|
-
const
|
|
2086
|
+
const E = l.labelSchema.classes.find(
|
|
2078
2087
|
(G) => G.id === z.classId
|
|
2079
2088
|
);
|
|
2080
2089
|
return /* @__PURE__ */ o(
|
|
@@ -2086,7 +2095,7 @@ const Pa = (r) => ({
|
|
|
2086
2095
|
top: z.data.y,
|
|
2087
2096
|
width: z.data.width,
|
|
2088
2097
|
height: z.data.height,
|
|
2089
|
-
borderColor: (
|
|
2098
|
+
borderColor: (E == null ? void 0 : E.color) || "var(--nice-danger, #ff0000)"
|
|
2090
2099
|
},
|
|
2091
2100
|
children: [
|
|
2092
2101
|
/* @__PURE__ */ a(
|
|
@@ -2094,9 +2103,9 @@ const Pa = (r) => ({
|
|
|
2094
2103
|
{
|
|
2095
2104
|
className: "nice-data-labeler__bbox-label",
|
|
2096
2105
|
style: {
|
|
2097
|
-
backgroundColor: (
|
|
2106
|
+
backgroundColor: (E == null ? void 0 : E.color) || "var(--nice-danger, #ff0000)"
|
|
2098
2107
|
},
|
|
2099
|
-
children:
|
|
2108
|
+
children: E == null ? void 0 : E.name
|
|
2100
2109
|
}
|
|
2101
2110
|
),
|
|
2102
2111
|
/* @__PURE__ */ a(
|
|
@@ -2164,16 +2173,16 @@ const Pa = (r) => ({
|
|
|
2164
2173
|
T && T.labels.length > 0 && /* @__PURE__ */ o("div", { className: "nice-data-labeler__current-labels", children: [
|
|
2165
2174
|
/* @__PURE__ */ a("h4", { children: s("dataLabeler.labels", "Labels") }),
|
|
2166
2175
|
T.labels.map((z) => {
|
|
2167
|
-
const
|
|
2176
|
+
const E = l.labelSchema.classes.find((G) => G.id === z.classId);
|
|
2168
2177
|
return /* @__PURE__ */ o("div", { className: "nice-data-labeler__label-item", children: [
|
|
2169
2178
|
/* @__PURE__ */ a(
|
|
2170
2179
|
"span",
|
|
2171
2180
|
{
|
|
2172
2181
|
className: "nice-data-labeler__label-color",
|
|
2173
|
-
style: { backgroundColor:
|
|
2182
|
+
style: { backgroundColor: E == null ? void 0 : E.color }
|
|
2174
2183
|
}
|
|
2175
2184
|
),
|
|
2176
|
-
/* @__PURE__ */ a("span", { className: "nice-data-labeler__label-name", children:
|
|
2185
|
+
/* @__PURE__ */ a("span", { className: "nice-data-labeler__label-name", children: E == null ? void 0 : E.name }),
|
|
2177
2186
|
/* @__PURE__ */ a(
|
|
2178
2187
|
"button",
|
|
2179
2188
|
{
|
|
@@ -2245,7 +2254,7 @@ const Pa = (r) => ({
|
|
|
2245
2254
|
)
|
|
2246
2255
|
] })
|
|
2247
2256
|
] }),
|
|
2248
|
-
/* @__PURE__ */ a("div", { className: "nice-data-labeler__classes-list", children: l.labelSchema.classes.map((z,
|
|
2257
|
+
/* @__PURE__ */ a("div", { className: "nice-data-labeler__classes-list", children: l.labelSchema.classes.map((z, E) => /* @__PURE__ */ o("div", { className: "nice-data-labeler__class-editor", children: [
|
|
2249
2258
|
/* @__PURE__ */ a(
|
|
2250
2259
|
"input",
|
|
2251
2260
|
{
|
|
@@ -2281,7 +2290,7 @@ const Pa = (r) => ({
|
|
|
2281
2290
|
{
|
|
2282
2291
|
className: "nice-data-labeler__remove-class-button",
|
|
2283
2292
|
"aria-label": s("dataLabeler.removeClass", "Remove class"),
|
|
2284
|
-
onClick: () =>
|
|
2293
|
+
onClick: () => D(z.id),
|
|
2285
2294
|
children: /* @__PURE__ */ a($, { name: "trash", size: 16 })
|
|
2286
2295
|
}
|
|
2287
2296
|
)
|
|
@@ -2320,11 +2329,14 @@ const Pa = (r) => ({
|
|
|
2320
2329
|
}
|
|
2321
2330
|
) })
|
|
2322
2331
|
] }),
|
|
2323
|
-
/* @__PURE__ */ a("div", { className: "nice-data-labeler__items-grid", children: l.items.filter((z) => w === "all" || z.status === w).map((z,
|
|
2332
|
+
/* @__PURE__ */ a("div", { className: "nice-data-labeler__items-grid", children: l.items.filter((z) => w === "all" || z.status === w).map((z, E) => {
|
|
2324
2333
|
var G;
|
|
2325
2334
|
return /* @__PURE__ */ o(
|
|
2326
2335
|
"div",
|
|
2327
2336
|
{
|
|
2337
|
+
role: "button",
|
|
2338
|
+
tabIndex: 0,
|
|
2339
|
+
onKeyDown: fe,
|
|
2328
2340
|
className: `nice-data-labeler__item-card ${d === l.items.indexOf(z) ? "nice-data-labeler__item-card--active" : ""}`,
|
|
2329
2341
|
onClick: () => {
|
|
2330
2342
|
b(l.items.indexOf(z)), m("label");
|
|
@@ -2336,7 +2348,7 @@ const Pa = (r) => ({
|
|
|
2336
2348
|
src: z.data.url,
|
|
2337
2349
|
alt: s("dataLabeler.item", "Item {index}").replace(
|
|
2338
2350
|
"{index}",
|
|
2339
|
-
String(
|
|
2351
|
+
String(E + 1)
|
|
2340
2352
|
),
|
|
2341
2353
|
className: "nice-data-labeler__item-thumbnail"
|
|
2342
2354
|
}
|
|
@@ -2440,14 +2452,14 @@ const Pa = (r) => ({
|
|
|
2440
2452
|
/* @__PURE__ */ o("div", { className: "nice-data-labeler__class-distribution", children: [
|
|
2441
2453
|
/* @__PURE__ */ a("h3", { children: s("dataLabeler.classDistribution", "Class Distribution") }),
|
|
2442
2454
|
/* @__PURE__ */ a("div", { className: "nice-data-labeler__distribution-bars", children: l.statistics.byClass.map((z) => {
|
|
2443
|
-
const
|
|
2455
|
+
const E = l.labelSchema.classes.find((B) => B.id === z.classId), G = z.count / Math.max(l.statistics.labeled, 1) * 100;
|
|
2444
2456
|
return /* @__PURE__ */ o("div", { className: "nice-data-labeler__distribution-row", children: [
|
|
2445
|
-
/* @__PURE__ */ a("span", { className: "nice-data-labeler__class-name", style: { color:
|
|
2457
|
+
/* @__PURE__ */ a("span", { className: "nice-data-labeler__class-name", style: { color: E == null ? void 0 : E.color }, children: E == null ? void 0 : E.name }),
|
|
2446
2458
|
/* @__PURE__ */ a("div", { className: "nice-data-labeler__bar-container", children: /* @__PURE__ */ a(
|
|
2447
2459
|
"div",
|
|
2448
2460
|
{
|
|
2449
2461
|
className: "nice-data-labeler__bar-fill",
|
|
2450
|
-
style: { width: `${G}%`, backgroundColor:
|
|
2462
|
+
style: { width: `${G}%`, backgroundColor: E == null ? void 0 : E.color }
|
|
2451
2463
|
}
|
|
2452
2464
|
) }),
|
|
2453
2465
|
/* @__PURE__ */ a("span", { className: "nice-data-labeler__count", children: z.count })
|
|
@@ -2500,7 +2512,7 @@ const Pa = (r) => ({
|
|
|
2500
2512
|
] })
|
|
2501
2513
|
] }) })
|
|
2502
2514
|
] });
|
|
2503
|
-
},
|
|
2515
|
+
}, Ka = {
|
|
2504
2516
|
id: oe(),
|
|
2505
2517
|
name: "Model Endpoint",
|
|
2506
2518
|
modelId: "",
|
|
@@ -2518,20 +2530,20 @@ const Pa = (r) => ({
|
|
|
2518
2530
|
successRate: 100
|
|
2519
2531
|
},
|
|
2520
2532
|
logs: []
|
|
2521
|
-
},
|
|
2533
|
+
}, Lr = ({
|
|
2522
2534
|
endpoint: r,
|
|
2523
2535
|
onInference: e,
|
|
2524
2536
|
showMetrics: i = !0,
|
|
2525
2537
|
showLogs: n = !0,
|
|
2526
2538
|
className: t = ""
|
|
2527
2539
|
}) => {
|
|
2528
|
-
const { t: s } = ie(), [l, c] = M(r ||
|
|
2540
|
+
const { t: s } = ie(), [l, c] = M(r || Ka), [p, m] = M("test"), [d, b] = M("text"), [S, I] = M(""), [R, O] = M("{}"), [P, g] = M(null), [u, v] = M({
|
|
2529
2541
|
temperature: 0.7,
|
|
2530
2542
|
topK: 50,
|
|
2531
2543
|
topP: 0.9,
|
|
2532
2544
|
maxTokens: 256,
|
|
2533
2545
|
threshold: 0.5
|
|
2534
|
-
}), [x, A] = M(null), [_, h] = M(!1), [w, f] = M(null), [k, N] = M([]), [T, L] = M(null), j = X(null),
|
|
2546
|
+
}), [x, A] = M(null), [_, h] = M(!1), [w, f] = M(null), [k, N] = M([]), [T, L] = M(null), j = X(null), D = (y) => {
|
|
2535
2547
|
var H;
|
|
2536
2548
|
const J = (H = y.target.files) == null ? void 0 : H[0];
|
|
2537
2549
|
if (J) {
|
|
@@ -2761,7 +2773,7 @@ const Pa = (r) => ({
|
|
|
2761
2773
|
ref: j,
|
|
2762
2774
|
type: "file",
|
|
2763
2775
|
accept: "image/*",
|
|
2764
|
-
onChange:
|
|
2776
|
+
onChange: D,
|
|
2765
2777
|
hidden: !0
|
|
2766
2778
|
}
|
|
2767
2779
|
),
|
|
@@ -3152,7 +3164,7 @@ class pe {
|
|
|
3152
3164
|
}
|
|
3153
3165
|
}
|
|
3154
3166
|
}
|
|
3155
|
-
class
|
|
3167
|
+
class qe extends pe {
|
|
3156
3168
|
constructor(e) {
|
|
3157
3169
|
super(e), this.type = "openai", this.name = "OpenAI", this.baseUrl = e.baseUrl || "https://api.openai.com/v1";
|
|
3158
3170
|
}
|
|
@@ -3251,7 +3263,7 @@ class Je extends pe {
|
|
|
3251
3263
|
return i / 1e6 * l.input + n / 1e6 * l.output;
|
|
3252
3264
|
}
|
|
3253
3265
|
}
|
|
3254
|
-
class
|
|
3266
|
+
class Va extends pe {
|
|
3255
3267
|
constructor(e) {
|
|
3256
3268
|
super(e), this.type = "anthropic", this.name = "Anthropic Claude", this.baseUrl = e.baseUrl || "https://api.anthropic.com/v1";
|
|
3257
3269
|
}
|
|
@@ -3386,7 +3398,7 @@ class Ka extends pe {
|
|
|
3386
3398
|
return i / 1e6 * l.input + n / 1e6 * l.output;
|
|
3387
3399
|
}
|
|
3388
3400
|
}
|
|
3389
|
-
class
|
|
3401
|
+
class Ya extends pe {
|
|
3390
3402
|
constructor(e) {
|
|
3391
3403
|
if (super(e), this.type = "azure-openai", this.name = "Azure OpenAI", !e.baseUrl || !e.deployment)
|
|
3392
3404
|
throw new Error("Azure OpenAI requires baseUrl and deployment");
|
|
@@ -3460,7 +3472,7 @@ class Va extends pe {
|
|
|
3460
3472
|
};
|
|
3461
3473
|
}
|
|
3462
3474
|
}
|
|
3463
|
-
class
|
|
3475
|
+
class Xa extends pe {
|
|
3464
3476
|
constructor(e) {
|
|
3465
3477
|
super(e), this.type = "ollama", this.name = "Ollama (Local)", this.baseUrl = e.baseUrl || "http://localhost:11434";
|
|
3466
3478
|
}
|
|
@@ -3587,7 +3599,7 @@ class Ya extends pe {
|
|
|
3587
3599
|
}
|
|
3588
3600
|
}
|
|
3589
3601
|
}
|
|
3590
|
-
class
|
|
3602
|
+
class Qa extends pe {
|
|
3591
3603
|
constructor(e) {
|
|
3592
3604
|
super(e), this.type = "groq", this.name = "Groq", this.baseUrl = e.baseUrl || "https://api.groq.com/openai/v1";
|
|
3593
3605
|
}
|
|
@@ -3664,17 +3676,17 @@ class Xa extends pe {
|
|
|
3664
3676
|
function le(r) {
|
|
3665
3677
|
switch (r.type) {
|
|
3666
3678
|
case "openai":
|
|
3667
|
-
return new
|
|
3679
|
+
return new qe(r);
|
|
3668
3680
|
case "anthropic":
|
|
3669
|
-
return new Ka(r);
|
|
3670
|
-
case "azure-openai":
|
|
3671
3681
|
return new Va(r);
|
|
3672
|
-
case "
|
|
3682
|
+
case "azure-openai":
|
|
3673
3683
|
return new Ya(r);
|
|
3674
|
-
case "
|
|
3684
|
+
case "ollama":
|
|
3675
3685
|
return new Xa(r);
|
|
3686
|
+
case "groq":
|
|
3687
|
+
return new Qa(r);
|
|
3676
3688
|
case "custom":
|
|
3677
|
-
return new
|
|
3689
|
+
return new qe(r);
|
|
3678
3690
|
default:
|
|
3679
3691
|
throw new Error(`Unsupported provider type: ${r.type}`);
|
|
3680
3692
|
}
|
|
@@ -3723,7 +3735,7 @@ function de(r, e) {
|
|
|
3723
3735
|
}
|
|
3724
3736
|
};
|
|
3725
3737
|
}
|
|
3726
|
-
const
|
|
3738
|
+
const Se = {
|
|
3727
3739
|
id: "data-grid-filter",
|
|
3728
3740
|
name: "DataGrid Natural Language Filter",
|
|
3729
3741
|
description: "Convert natural language queries to DataGrid filter configurations",
|
|
@@ -3792,7 +3804,7 @@ Generate the filter configuration:`,
|
|
|
3792
3804
|
],
|
|
3793
3805
|
suggestedTemperature: 0.2,
|
|
3794
3806
|
maxTokens: 512
|
|
3795
|
-
},
|
|
3807
|
+
}, Ce = {
|
|
3796
3808
|
id: "data-grid-sort",
|
|
3797
3809
|
name: "DataGrid Natural Language Sort",
|
|
3798
3810
|
description: "Convert natural language to sort configuration",
|
|
@@ -3823,7 +3835,7 @@ Generate sort configuration:`,
|
|
|
3823
3835
|
],
|
|
3824
3836
|
suggestedTemperature: 0.1,
|
|
3825
3837
|
maxTokens: 256
|
|
3826
|
-
},
|
|
3838
|
+
}, Ae = {
|
|
3827
3839
|
id: "form-builder",
|
|
3828
3840
|
name: "Form Generation from Description",
|
|
3829
3841
|
description: "Generate form configuration from natural language description",
|
|
@@ -3903,7 +3915,7 @@ Generate the form configuration:`,
|
|
|
3903
3915
|
],
|
|
3904
3916
|
suggestedTemperature: 0.5,
|
|
3905
3917
|
maxTokens: 2048
|
|
3906
|
-
},
|
|
3918
|
+
}, Te = {
|
|
3907
3919
|
id: "chart-config",
|
|
3908
3920
|
name: "Chart Configuration Generator",
|
|
3909
3921
|
description: "Generate chart configuration from data description",
|
|
@@ -3962,7 +3974,7 @@ Generate the chart configuration:`,
|
|
|
3962
3974
|
],
|
|
3963
3975
|
suggestedTemperature: 0.4,
|
|
3964
3976
|
maxTokens: 1024
|
|
3965
|
-
},
|
|
3977
|
+
}, Ie = {
|
|
3966
3978
|
id: "code-completion",
|
|
3967
3979
|
name: "Code Completion",
|
|
3968
3980
|
description: "Complete code based on context",
|
|
@@ -4011,7 +4023,7 @@ Complete the code at the cursor position:`,
|
|
|
4011
4023
|
suggestedModel: "gpt-4o",
|
|
4012
4024
|
suggestedTemperature: 0.2,
|
|
4013
4025
|
maxTokens: 512
|
|
4014
|
-
},
|
|
4026
|
+
}, Re = {
|
|
4015
4027
|
id: "workflow-generator",
|
|
4016
4028
|
name: "Workflow/BPMN Generator",
|
|
4017
4029
|
description: "Generate workflow definition from process description",
|
|
@@ -4067,7 +4079,7 @@ Generate the workflow definition:`,
|
|
|
4067
4079
|
],
|
|
4068
4080
|
suggestedTemperature: 0.3,
|
|
4069
4081
|
maxTokens: 2048
|
|
4070
|
-
},
|
|
4082
|
+
}, ze = {
|
|
4071
4083
|
id: "report-layout",
|
|
4072
4084
|
name: "Report Layout Generator",
|
|
4073
4085
|
description: "Generate report layout from description",
|
|
@@ -4118,7 +4130,7 @@ Generate the report layout:`,
|
|
|
4118
4130
|
],
|
|
4119
4131
|
suggestedTemperature: 0.4,
|
|
4120
4132
|
maxTokens: 2048
|
|
4121
|
-
},
|
|
4133
|
+
}, Ue = {
|
|
4122
4134
|
id: "theme-generator",
|
|
4123
4135
|
name: "Theme Generator from Brand Colors",
|
|
4124
4136
|
description: "Generate complete theme from brand colors",
|
|
@@ -4194,7 +4206,7 @@ Generate the complete theme:`,
|
|
|
4194
4206
|
],
|
|
4195
4207
|
suggestedTemperature: 0.5,
|
|
4196
4208
|
maxTokens: 2048
|
|
4197
|
-
},
|
|
4209
|
+
}, Ge = {
|
|
4198
4210
|
id: "accessibility-checker",
|
|
4199
4211
|
name: "Accessibility Checker",
|
|
4200
4212
|
description: "Check and fix accessibility issues in HTML/JSX",
|
|
@@ -4240,7 +4252,7 @@ Output JSON:
|
|
|
4240
4252
|
],
|
|
4241
4253
|
suggestedTemperature: 0.2,
|
|
4242
4254
|
maxTokens: 2048
|
|
4243
|
-
},
|
|
4255
|
+
}, We = {
|
|
4244
4256
|
id: "translation",
|
|
4245
4257
|
name: "UI Translation",
|
|
4246
4258
|
description: "Translate UI text maintaining context and formatting",
|
|
@@ -4277,7 +4289,7 @@ Provide translations:`,
|
|
|
4277
4289
|
],
|
|
4278
4290
|
suggestedTemperature: 0.3,
|
|
4279
4291
|
maxTokens: 2048
|
|
4280
|
-
},
|
|
4292
|
+
}, He = {
|
|
4281
4293
|
id: "summarize-data",
|
|
4282
4294
|
name: "Data Summarization",
|
|
4283
4295
|
description: "Summarize tabular data into insights",
|
|
@@ -4319,29 +4331,29 @@ Provide summary and insights:`,
|
|
|
4319
4331
|
],
|
|
4320
4332
|
suggestedTemperature: 0.4,
|
|
4321
4333
|
maxTokens: 1024
|
|
4322
|
-
},
|
|
4323
|
-
[Ne.id]: Ne,
|
|
4334
|
+
}, Oe = {
|
|
4324
4335
|
[Se.id]: Se,
|
|
4325
4336
|
[Ce.id]: Ce,
|
|
4326
4337
|
[Ae.id]: Ae,
|
|
4327
4338
|
[Te.id]: Te,
|
|
4328
4339
|
[Ie.id]: Ie,
|
|
4329
4340
|
[Re.id]: Re,
|
|
4330
|
-
[
|
|
4341
|
+
[ze.id]: ze,
|
|
4331
4342
|
[Ue.id]: Ue,
|
|
4332
4343
|
[Ge.id]: Ge,
|
|
4333
|
-
[We.id]: We
|
|
4344
|
+
[We.id]: We,
|
|
4345
|
+
[He.id]: He
|
|
4334
4346
|
};
|
|
4335
|
-
function Lr(r) {
|
|
4336
|
-
return Me[r];
|
|
4337
|
-
}
|
|
4338
4347
|
function $r(r) {
|
|
4339
|
-
return
|
|
4348
|
+
return Oe[r];
|
|
4349
|
+
}
|
|
4350
|
+
function Pr(r) {
|
|
4351
|
+
return Object.values(Oe).filter((e) => e.category === r);
|
|
4340
4352
|
}
|
|
4341
|
-
function
|
|
4342
|
-
return Object.keys(
|
|
4353
|
+
function Mr() {
|
|
4354
|
+
return Object.keys(Oe);
|
|
4343
4355
|
}
|
|
4344
|
-
class
|
|
4356
|
+
class oa {
|
|
4345
4357
|
constructor() {
|
|
4346
4358
|
this.records = /* @__PURE__ */ new Map();
|
|
4347
4359
|
}
|
|
@@ -4365,7 +4377,7 @@ class sa {
|
|
|
4365
4377
|
}
|
|
4366
4378
|
}
|
|
4367
4379
|
}
|
|
4368
|
-
class
|
|
4380
|
+
class Za {
|
|
4369
4381
|
constructor() {
|
|
4370
4382
|
this.prefix = "nice2dev-ai-cost:";
|
|
4371
4383
|
}
|
|
@@ -4396,9 +4408,9 @@ class Qa {
|
|
|
4396
4408
|
}
|
|
4397
4409
|
}
|
|
4398
4410
|
}
|
|
4399
|
-
class
|
|
4411
|
+
class ei {
|
|
4400
4412
|
constructor(e, i) {
|
|
4401
|
-
this.pendingRecords = [], this.flushTimer = null, this.alertCallbacks = [], this.minuteCounter = /* @__PURE__ */ new Map(), this.dayCounter = /* @__PURE__ */ new Map(), this.storage = e || new
|
|
4413
|
+
this.pendingRecords = [], this.flushTimer = null, this.alertCallbacks = [], this.minuteCounter = /* @__PURE__ */ new Map(), this.dayCounter = /* @__PURE__ */ new Map(), this.storage = e || new oa(), this.budgetConfig = {
|
|
4402
4414
|
monthlyBudget: 100,
|
|
4403
4415
|
dailyBudget: 10,
|
|
4404
4416
|
maxTokensPerRequest: 4096,
|
|
@@ -4528,11 +4540,11 @@ class Za {
|
|
|
4528
4540
|
}
|
|
4529
4541
|
}
|
|
4530
4542
|
}
|
|
4531
|
-
function
|
|
4543
|
+
function Or(r, e) {
|
|
4532
4544
|
const i = X(null), [n, t] = M(null), [s, l] = M(null), [c, p] = M(!0);
|
|
4533
4545
|
te(() => {
|
|
4534
|
-
const S = typeof window < "u" ? new
|
|
4535
|
-
i.current = new
|
|
4546
|
+
const S = typeof window < "u" ? new Za() : new oa();
|
|
4547
|
+
i.current = new ei(S, e);
|
|
4536
4548
|
const I = i.current.onAlert((R) => {
|
|
4537
4549
|
console.warn(`[AI Cost Alert] ${R}`);
|
|
4538
4550
|
});
|
|
@@ -4572,7 +4584,7 @@ function Mr(r, e) {
|
|
|
4572
4584
|
refresh: m
|
|
4573
4585
|
};
|
|
4574
4586
|
}
|
|
4575
|
-
class
|
|
4587
|
+
class ai {
|
|
4576
4588
|
constructor(e = 100, i = 36e5) {
|
|
4577
4589
|
this.cache = /* @__PURE__ */ new Map(), this.maxSize = e, this.ttl = i;
|
|
4578
4590
|
}
|
|
@@ -4609,7 +4621,7 @@ class ei {
|
|
|
4609
4621
|
this.cache.clear();
|
|
4610
4622
|
}
|
|
4611
4623
|
}
|
|
4612
|
-
class
|
|
4624
|
+
class ii {
|
|
4613
4625
|
constructor(e, i) {
|
|
4614
4626
|
this.backupProviders = [], this.circuitBreakers = /* @__PURE__ */ new Map(), this.primaryProvider = e, this.config = {
|
|
4615
4627
|
strategies: ["retry", "failover", "cache", "graceful-degrade"],
|
|
@@ -4625,7 +4637,7 @@ class ai {
|
|
|
4625
4637
|
// 1 minute
|
|
4626
4638
|
onFallback: void 0,
|
|
4627
4639
|
...i
|
|
4628
|
-
}, this.cache = new
|
|
4640
|
+
}, this.cache = new ai(100, this.config.cacheTTL);
|
|
4629
4641
|
for (const n of this.config.backupProviders || [])
|
|
4630
4642
|
this.backupProviders.push(le(n));
|
|
4631
4643
|
this.config.offlineConfig && (this.offlineProvider = le(this.config.offlineConfig));
|
|
@@ -4840,11 +4852,11 @@ class ai {
|
|
|
4840
4852
|
return this.offlineProvider && (e.offline = await this.offlineProvider.healthCheck()), e;
|
|
4841
4853
|
}
|
|
4842
4854
|
}
|
|
4843
|
-
function
|
|
4855
|
+
function ri(r, e) {
|
|
4844
4856
|
const i = le(r);
|
|
4845
|
-
return new
|
|
4857
|
+
return new ii(i, e);
|
|
4846
4858
|
}
|
|
4847
|
-
function
|
|
4859
|
+
function Dr(r, e) {
|
|
4848
4860
|
const i = {
|
|
4849
4861
|
strategies: ["retry", "failover", "cache", "graceful-degrade"],
|
|
4850
4862
|
maxRetries: 3,
|
|
@@ -4857,10 +4869,10 @@ function Or(r, e) {
|
|
|
4857
4869
|
return typeof window > "u" && (i.offlineConfig = {
|
|
4858
4870
|
type: "ollama",
|
|
4859
4871
|
model: "llama3"
|
|
4860
|
-
}),
|
|
4872
|
+
}), ri(r, i);
|
|
4861
4873
|
}
|
|
4862
|
-
const
|
|
4863
|
-
function
|
|
4874
|
+
const ti = [];
|
|
4875
|
+
function ni(r) {
|
|
4864
4876
|
const { columns: e, config: i, onFilterGenerated: n, onSortGenerated: t, onError: s } = r, l = se(), { t: c, lang: p } = ie(), [m, d] = M(!1), [b, S] = M(null), [I, R] = M(null), [O, P] = M([]), g = X(null), u = i || (l == null ? void 0 : l.config), v = ae(() => e.map((h) => ({
|
|
4865
4877
|
id: h.id,
|
|
4866
4878
|
label: h.label,
|
|
@@ -4877,9 +4889,9 @@ function ti(r) {
|
|
|
4877
4889
|
const w = performance.now();
|
|
4878
4890
|
(f = g.current) == null || f.abort(), g.current = new AbortController();
|
|
4879
4891
|
try {
|
|
4880
|
-
const k = ee(u), N = h.toLowerCase(), T = N.includes("sort") || N.includes("order") || N.includes("arrange") || N.includes("by highest") || N.includes("by lowest"), L = N.includes("show") || N.includes("find") || N.includes("filter") || N.includes("where") || N.includes("with") || N.includes("only"), j = p !== "en" && !T && !L,
|
|
4892
|
+
const k = ee(u), N = h.toLowerCase(), T = N.includes("sort") || N.includes("order") || N.includes("arrange") || N.includes("by highest") || N.includes("by lowest"), L = N.includes("show") || N.includes("find") || N.includes("filter") || N.includes("where") || N.includes("with") || N.includes("only"), j = p !== "en" && !T && !L, D = T || j, q = L || !T, W = { type: "combined" };
|
|
4881
4893
|
if (q) {
|
|
4882
|
-
const Y = de(
|
|
4894
|
+
const Y = de(Se, {
|
|
4883
4895
|
columns: v,
|
|
4884
4896
|
query: h
|
|
4885
4897
|
}), Z = await k.chat({
|
|
@@ -4889,11 +4901,11 @@ function ti(r) {
|
|
|
4889
4901
|
],
|
|
4890
4902
|
temperature: 0.2,
|
|
4891
4903
|
maxTokens: 512
|
|
4892
|
-
}), C =
|
|
4904
|
+
}), C = si(Z);
|
|
4893
4905
|
C && (!j || C.filters.length > 0) && (W.filterConfig = C, W.type = "filter", n == null || n(C));
|
|
4894
4906
|
}
|
|
4895
|
-
if (
|
|
4896
|
-
const Y = de(
|
|
4907
|
+
if (D) {
|
|
4908
|
+
const Y = de(Ce, {
|
|
4897
4909
|
columns: v,
|
|
4898
4910
|
query: h
|
|
4899
4911
|
}), Z = await k.chat({
|
|
@@ -4903,7 +4915,7 @@ function ti(r) {
|
|
|
4903
4915
|
],
|
|
4904
4916
|
temperature: 0.1,
|
|
4905
4917
|
maxTokens: 256
|
|
4906
|
-
}), C =
|
|
4918
|
+
}), C = oi(Z);
|
|
4907
4919
|
C && (!j || C.sort.length > 0) && (W.sortConfig = C, W.type = W.filterConfig ? "combined" : "sort", t == null || t(C));
|
|
4908
4920
|
}
|
|
4909
4921
|
return W.latencyMs = performance.now() - w, R(W), P((Y) => [...Y.slice(-9), { query: h, result: W }]), W;
|
|
@@ -4939,7 +4951,7 @@ function ti(r) {
|
|
|
4939
4951
|
isConfigured: !!u
|
|
4940
4952
|
};
|
|
4941
4953
|
}
|
|
4942
|
-
function
|
|
4954
|
+
function si(r) {
|
|
4943
4955
|
var e, i, n;
|
|
4944
4956
|
try {
|
|
4945
4957
|
const t = ((i = (e = r.choices[0]) == null ? void 0 : e.message) == null ? void 0 : i.content) || "", l = ((n = (t.match(/```(?:json)?\s*([\s\S]*?)```/) || [null, t])[1]) == null ? void 0 : n.trim()) || t, c = JSON.parse(l);
|
|
@@ -4954,7 +4966,7 @@ function ni(r) {
|
|
|
4954
4966
|
}
|
|
4955
4967
|
return null;
|
|
4956
4968
|
}
|
|
4957
|
-
function
|
|
4969
|
+
function oi(r) {
|
|
4958
4970
|
var e, i, n;
|
|
4959
4971
|
try {
|
|
4960
4972
|
const t = ((i = (e = r.choices[0]) == null ? void 0 : e.message) == null ? void 0 : i.content) || "", l = ((n = (t.match(/```(?:json)?\s*([\s\S]*?)```/) || [null, t])[1]) == null ? void 0 : n.trim()) || t, c = JSON.parse(l);
|
|
@@ -4968,7 +4980,7 @@ function si(r) {
|
|
|
4968
4980
|
return null;
|
|
4969
4981
|
}
|
|
4970
4982
|
function Er({
|
|
4971
|
-
columns: r =
|
|
4983
|
+
columns: r = ti,
|
|
4972
4984
|
config: e,
|
|
4973
4985
|
onFilter: i,
|
|
4974
4986
|
onSort: n,
|
|
@@ -4978,7 +4990,7 @@ function Er({
|
|
|
4978
4990
|
className: c,
|
|
4979
4991
|
style: p
|
|
4980
4992
|
}) {
|
|
4981
|
-
const { t: m } = ie(), [d, b] = M(""), [S, I] = M(!1), R = X(null), { processQuery: O, loading: P, lastResult: g, history: u, isConfigured: v } =
|
|
4993
|
+
const { t: m } = ie(), [d, b] = M(""), [S, I] = M(!1), R = X(null), { processQuery: O, loading: P, lastResult: g, history: u, isConfigured: v } = ni({
|
|
4982
4994
|
columns: r,
|
|
4983
4995
|
config: e,
|
|
4984
4996
|
onFilterGenerated: i,
|
|
@@ -4986,7 +4998,7 @@ function Er({
|
|
|
4986
4998
|
}), x = ae(() => {
|
|
4987
4999
|
if (!l || r.length === 0)
|
|
4988
5000
|
return [];
|
|
4989
|
-
const f = [], k = (
|
|
5001
|
+
const f = [], k = (D, q, W) => m(D, q).replace("{column}", W.label), N = r.filter((D) => D.type === "string");
|
|
4990
5002
|
N.length > 0 && f.push(
|
|
4991
5003
|
k(
|
|
4992
5004
|
"dataGridAI.suggest.contains",
|
|
@@ -4994,21 +5006,21 @@ function Er({
|
|
|
4994
5006
|
N[0]
|
|
4995
5007
|
)
|
|
4996
5008
|
);
|
|
4997
|
-
const T = r.filter((
|
|
5009
|
+
const T = r.filter((D) => D.type === "number");
|
|
4998
5010
|
T.length > 0 && (f.push(
|
|
4999
5011
|
k("dataGridAI.suggest.greaterThan", "{column} greater than 100", T[0])
|
|
5000
5012
|
), f.push(
|
|
5001
5013
|
k("dataGridAI.suggest.sortHighest", "Sort by highest {column}", T[0])
|
|
5002
5014
|
));
|
|
5003
|
-
const L = r.filter((
|
|
5015
|
+
const L = r.filter((D) => D.type === "date");
|
|
5004
5016
|
L.length > 0 && (f.push(
|
|
5005
5017
|
k("dataGridAI.suggest.lastDays", "{column} in the last 7 days", L[0])
|
|
5006
5018
|
), f.push(
|
|
5007
5019
|
k("dataGridAI.suggest.sortNewest", "Sort by newest {column}", L[0])
|
|
5008
5020
|
));
|
|
5009
|
-
const j = r.filter((
|
|
5021
|
+
const j = r.filter((D) => {
|
|
5010
5022
|
var q;
|
|
5011
|
-
return
|
|
5023
|
+
return D.type === "enum" && ((q = D.options) == null ? void 0 : q.length);
|
|
5012
5024
|
});
|
|
5013
5025
|
return j.length > 0 && j[0].options && f.push(
|
|
5014
5026
|
k("dataGridAI.suggest.equals", "Where {column} is {value}", j[0]).replace(
|
|
@@ -5313,7 +5325,7 @@ function Er({
|
|
|
5313
5325
|
}
|
|
5314
5326
|
);
|
|
5315
5327
|
}
|
|
5316
|
-
function
|
|
5328
|
+
function ci(r = {}) {
|
|
5317
5329
|
const { config: e, schema: i, context: n, onFormGenerated: t, onError: s } = r, l = se(), { t: c } = ie(), [p, m] = M(!1), [d, b] = M(null), [S, I] = M(null), [R, O] = M([]), P = X(null), g = e || (l == null ? void 0 : l.config), u = F(
|
|
5318
5330
|
async (_) => {
|
|
5319
5331
|
var w, f, k;
|
|
@@ -5325,7 +5337,7 @@ function oi(r = {}) {
|
|
|
5325
5337
|
const h = performance.now();
|
|
5326
5338
|
(w = P.current) == null || w.abort(), P.current = new AbortController();
|
|
5327
5339
|
try {
|
|
5328
|
-
const N = ee(g), T = de(
|
|
5340
|
+
const N = ee(g), T = de(Ae, {
|
|
5329
5341
|
description: _,
|
|
5330
5342
|
schema: i ? JSON.stringify(i, null, 2) : void 0,
|
|
5331
5343
|
context: n
|
|
@@ -5336,13 +5348,13 @@ function oi(r = {}) {
|
|
|
5336
5348
|
],
|
|
5337
5349
|
temperature: 0.5,
|
|
5338
5350
|
maxTokens: 2048
|
|
5339
|
-
}), j =
|
|
5351
|
+
}), j = li(L), D = {
|
|
5340
5352
|
config: j || void 0,
|
|
5341
5353
|
rawResponse: (k = (f = L.choices[0]) == null ? void 0 : f.message) == null ? void 0 : k.content,
|
|
5342
5354
|
latencyMs: performance.now() - h,
|
|
5343
5355
|
error: j ? void 0 : c("formBuilderAI.parseFailed", "Failed to parse form configuration")
|
|
5344
5356
|
};
|
|
5345
|
-
return j && (t == null || t(j)), I(
|
|
5357
|
+
return j && (t == null || t(j)), I(D), O((q) => [...q.slice(-9), { description: _, result: D }]), D;
|
|
5346
5358
|
} catch (N) {
|
|
5347
5359
|
const T = N instanceof Error ? N.message : c("formBuilderAI.requestFailed", "AI request failed"), L = {
|
|
5348
5360
|
error: T,
|
|
@@ -5391,7 +5403,7 @@ function oi(r = {}) {
|
|
|
5391
5403
|
isConfigured: !!g
|
|
5392
5404
|
};
|
|
5393
5405
|
}
|
|
5394
|
-
function
|
|
5406
|
+
function li(r) {
|
|
5395
5407
|
var e, i, n;
|
|
5396
5408
|
try {
|
|
5397
5409
|
const t = ((i = (e = r.choices[0]) == null ? void 0 : e.message) == null ? void 0 : i.content) || "", l = ((n = (t.match(/```(?:json)?\s*([\s\S]*?)```/) || [null, t])[1]) == null ? void 0 : n.trim()) || t, c = JSON.parse(l);
|
|
@@ -5408,7 +5420,7 @@ function ci(r) {
|
|
|
5408
5420
|
}
|
|
5409
5421
|
return null;
|
|
5410
5422
|
}
|
|
5411
|
-
function
|
|
5423
|
+
function jr({
|
|
5412
5424
|
config: r,
|
|
5413
5425
|
schema: e,
|
|
5414
5426
|
context: i,
|
|
@@ -5420,7 +5432,7 @@ function Dr({
|
|
|
5420
5432
|
style: p,
|
|
5421
5433
|
renderForm: m
|
|
5422
5434
|
}) {
|
|
5423
|
-
const { t: d } = ie(), [b, S] = M(""), [I, R] = M(!1), O = X(null), { generateForm: P, loading: g, lastResult: u, isConfigured: v } =
|
|
5435
|
+
const { t: d } = ie(), [b, S] = M(""), [I, R] = M(!1), O = X(null), { generateForm: P, loading: g, lastResult: u, isConfigured: v } = ci({
|
|
5424
5436
|
config: r,
|
|
5425
5437
|
schema: e,
|
|
5426
5438
|
context: i,
|
|
@@ -5551,7 +5563,7 @@ function Dr({
|
|
|
5551
5563
|
)
|
|
5552
5564
|
] }),
|
|
5553
5565
|
u.config.description && /* @__PURE__ */ a("p", { className: "nice-form-builder-ai__result-description", children: u.config.description }),
|
|
5554
|
-
l && /* @__PURE__ */ a("div", { className: "nice-form-builder-ai__preview", children: m ? m(u.config) : /* @__PURE__ */ a(
|
|
5566
|
+
l && /* @__PURE__ */ a("div", { className: "nice-form-builder-ai__preview", children: m ? m(u.config) : /* @__PURE__ */ a(di, { config: u.config }) }),
|
|
5555
5567
|
/* @__PURE__ */ o("details", { className: "nice-form-builder-ai__json", children: [
|
|
5556
5568
|
/* @__PURE__ */ a("summary", { children: d("formBuilderAI.viewJson", "View JSON Configuration") }),
|
|
5557
5569
|
/* @__PURE__ */ a("pre", { children: JSON.stringify(u.config, null, 2) })
|
|
@@ -5791,7 +5803,7 @@ function Dr({
|
|
|
5791
5803
|
}
|
|
5792
5804
|
);
|
|
5793
5805
|
}
|
|
5794
|
-
function
|
|
5806
|
+
function di({ config: r }) {
|
|
5795
5807
|
var t, s;
|
|
5796
5808
|
const { t: e } = ie(), i = (l) => {
|
|
5797
5809
|
var p, m;
|
|
@@ -5996,7 +6008,7 @@ function li({ config: r }) {
|
|
|
5996
6008
|
` })
|
|
5997
6009
|
] });
|
|
5998
6010
|
}
|
|
5999
|
-
function
|
|
6011
|
+
function ui(r = {}) {
|
|
6000
6012
|
const { config: e, dataFields: i, context: n, onChartGenerated: t, onError: s } = r, l = se(), { t: c } = ie(), [p, m] = M(!1), [d, b] = M(null), [S, I] = M(null), [R, O] = M([]), P = X(null), g = e || (l == null ? void 0 : l.config), u = ae(() => {
|
|
6001
6013
|
if (i)
|
|
6002
6014
|
return i.map((h) => {
|
|
@@ -6019,7 +6031,7 @@ function di(r = {}) {
|
|
|
6019
6031
|
const w = performance.now();
|
|
6020
6032
|
(f = P.current) == null || f.abort(), P.current = new AbortController();
|
|
6021
6033
|
try {
|
|
6022
|
-
const T = ee(g), L = de(
|
|
6034
|
+
const T = ee(g), L = de(Te, {
|
|
6023
6035
|
request: h,
|
|
6024
6036
|
data: u ? JSON.stringify(u, null, 2) : void 0,
|
|
6025
6037
|
context: n
|
|
@@ -6030,14 +6042,14 @@ function di(r = {}) {
|
|
|
6030
6042
|
],
|
|
6031
6043
|
temperature: 0.4,
|
|
6032
6044
|
maxTokens: 1024
|
|
6033
|
-
}),
|
|
6034
|
-
config:
|
|
6045
|
+
}), D = pi(j), q = {
|
|
6046
|
+
config: D || void 0,
|
|
6035
6047
|
rawResponse: (N = (k = j.choices[0]) == null ? void 0 : k.message) == null ? void 0 : N.content,
|
|
6036
6048
|
latencyMs: performance.now() - w,
|
|
6037
|
-
error:
|
|
6038
|
-
suggestions:
|
|
6049
|
+
error: D ? void 0 : c("chartAI.parseFailed", "Failed to parse chart configuration"),
|
|
6050
|
+
suggestions: mi(D, c)
|
|
6039
6051
|
};
|
|
6040
|
-
return
|
|
6052
|
+
return D && (t == null || t(D)), I(q), O((W) => [...W.slice(-9), { request: h, result: q }]), q;
|
|
6041
6053
|
} catch (T) {
|
|
6042
6054
|
const L = T instanceof Error ? T.message : c("chartAI.requestFailed", "AI request failed"), j = {
|
|
6043
6055
|
error: L,
|
|
@@ -6087,7 +6099,7 @@ function di(r = {}) {
|
|
|
6087
6099
|
isConfigured: !!g
|
|
6088
6100
|
};
|
|
6089
6101
|
}
|
|
6090
|
-
function
|
|
6102
|
+
function pi(r) {
|
|
6091
6103
|
var e, i, n;
|
|
6092
6104
|
try {
|
|
6093
6105
|
const t = ((i = (e = r.choices[0]) == null ? void 0 : e.message) == null ? void 0 : i.content) || "", l = ((n = (t.match(/```(?:json)?\s*([\s\S]*?)```/) || [null, t])[1]) == null ? void 0 : n.trim()) || t, c = JSON.parse(l);
|
|
@@ -6105,14 +6117,14 @@ function ui(r) {
|
|
|
6105
6117
|
}
|
|
6106
6118
|
return null;
|
|
6107
6119
|
}
|
|
6108
|
-
function
|
|
6120
|
+
function mi(r, e) {
|
|
6109
6121
|
var n;
|
|
6110
6122
|
if (!r)
|
|
6111
6123
|
return [];
|
|
6112
6124
|
const i = [];
|
|
6113
6125
|
return (r.type === "line" || r.type === "bar") && (i.push(e("chartAI.suggest.trendLine", "Add trend line for forecasting")), i.push(e("chartAI.suggest.stack", "Stack series for comparison"))), (r.type === "pie" || r.type === "donut") && (i.push(e("chartAI.suggest.toBar", "Convert to bar chart for better comparison")), i.push(e("chartAI.suggest.percentLabels", "Add data labels for percentages"))), (n = r.options) != null && n.animation || i.push(e("chartAI.suggest.animate", "Enable animations for better UX")), i.slice(0, 3);
|
|
6114
6126
|
}
|
|
6115
|
-
const
|
|
6127
|
+
const gi = {
|
|
6116
6128
|
line: ["chartAI.type.line", "Line"],
|
|
6117
6129
|
area: ["chartAI.type.area", "Area"],
|
|
6118
6130
|
bar: ["chartAI.type.bar", "Bar"],
|
|
@@ -6129,11 +6141,11 @@ const mi = {
|
|
|
6129
6141
|
gauge: ["chartAI.type.gauge", "Gauge"],
|
|
6130
6142
|
candlestick: ["chartAI.type.candlestick", "Candlestick"],
|
|
6131
6143
|
sankey: ["chartAI.type.sankey", "Sankey"]
|
|
6132
|
-
},
|
|
6133
|
-
const i =
|
|
6144
|
+
}, Le = (r, e) => {
|
|
6145
|
+
const i = gi[r];
|
|
6134
6146
|
return i ? e(i[0], i[1]) : r.charAt(0).toUpperCase() + r.slice(1);
|
|
6135
6147
|
};
|
|
6136
|
-
function
|
|
6148
|
+
function Br({
|
|
6137
6149
|
config: r,
|
|
6138
6150
|
dataFields: e,
|
|
6139
6151
|
context: i,
|
|
@@ -6151,7 +6163,7 @@ function jr({
|
|
|
6151
6163
|
loading: u,
|
|
6152
6164
|
lastResult: v,
|
|
6153
6165
|
isConfigured: x
|
|
6154
|
-
} =
|
|
6166
|
+
} = ui({
|
|
6155
6167
|
config: r,
|
|
6156
6168
|
dataFields: e,
|
|
6157
6169
|
context: i,
|
|
@@ -6167,7 +6179,7 @@ function jr({
|
|
|
6167
6179
|
["funnel", "filter"],
|
|
6168
6180
|
["gauge", "target"],
|
|
6169
6181
|
["radar", "target"]
|
|
6170
|
-
].map(([k, N]) => ({ type: k, icon: N, label:
|
|
6182
|
+
].map(([k, N]) => ({ type: k, icon: N, label: Le(k, d) })), _ = async () => {
|
|
6171
6183
|
if (!b.trim() || u)
|
|
6172
6184
|
return;
|
|
6173
6185
|
const k = I ? `Create a ${I} chart: ${b}` : b;
|
|
@@ -6246,7 +6258,7 @@ function jr({
|
|
|
6246
6258
|
})(),
|
|
6247
6259
|
d("chartAI.chartOfType", "{type} Chart").replace(
|
|
6248
6260
|
"{type}",
|
|
6249
|
-
|
|
6261
|
+
Le(v.config.type, d)
|
|
6250
6262
|
)
|
|
6251
6263
|
] }),
|
|
6252
6264
|
v.config.title && /* @__PURE__ */ a("span", { className: "nice-chart-ai__chart-title", children: v.config.title })
|
|
@@ -6283,7 +6295,7 @@ function jr({
|
|
|
6283
6295
|
k
|
|
6284
6296
|
))
|
|
6285
6297
|
] }),
|
|
6286
|
-
l && /* @__PURE__ */ a("div", { className: "nice-chart-ai__preview", children: m ? m(v.config) : /* @__PURE__ */ a(
|
|
6298
|
+
l && /* @__PURE__ */ a("div", { className: "nice-chart-ai__preview", children: m ? m(v.config) : /* @__PURE__ */ a(hi, { config: v.config }) }),
|
|
6287
6299
|
/* @__PURE__ */ o("details", { className: "nice-chart-ai__json", children: [
|
|
6288
6300
|
/* @__PURE__ */ a("summary", { children: d("chartAI.viewConfig", "View Configuration") }),
|
|
6289
6301
|
/* @__PURE__ */ a("pre", { children: JSON.stringify(v.config, null, 2) })
|
|
@@ -6539,7 +6551,7 @@ function jr({
|
|
|
6539
6551
|
"AI not configured. Please provide config or wrap in NiceAIProvider."
|
|
6540
6552
|
) }) });
|
|
6541
6553
|
}
|
|
6542
|
-
function
|
|
6554
|
+
function hi({ config: r }) {
|
|
6543
6555
|
var t;
|
|
6544
6556
|
const { t: e } = ie(), i = (s) => e("chartAI.series", "Series {n}").replace("{n}", String(s)), n = () => {
|
|
6545
6557
|
switch (r.type) {
|
|
@@ -6636,7 +6648,7 @@ function gi({ config: r }) {
|
|
|
6636
6648
|
/* @__PURE__ */ a("span", { className: "nice-chart-preview__icon", children: /* @__PURE__ */ a($, { name: "bar-chart", size: 32 }) }),
|
|
6637
6649
|
/* @__PURE__ */ a("span", { children: e("chartAI.chartOfType", "{type} Chart").replace(
|
|
6638
6650
|
"{type}",
|
|
6639
|
-
|
|
6651
|
+
Le(r.type, e)
|
|
6640
6652
|
) })
|
|
6641
6653
|
] });
|
|
6642
6654
|
}
|
|
@@ -6723,7 +6735,7 @@ function gi({ config: r }) {
|
|
|
6723
6735
|
` })
|
|
6724
6736
|
] });
|
|
6725
6737
|
}
|
|
6726
|
-
function
|
|
6738
|
+
function fi(r = {}) {
|
|
6727
6739
|
const {
|
|
6728
6740
|
config: e,
|
|
6729
6741
|
language: i = "typescript",
|
|
@@ -6734,10 +6746,10 @@ function hi(r = {}) {
|
|
|
6734
6746
|
onError: c
|
|
6735
6747
|
} = r, p = se(), [m, d] = M(!1), [b, S] = M([]), [I, R] = M(-1), O = X(null), P = X(null), g = e || (p == null ? void 0 : p.config), u = F(
|
|
6736
6748
|
async (T, L) => {
|
|
6737
|
-
var
|
|
6749
|
+
var D, q, W;
|
|
6738
6750
|
if (!g)
|
|
6739
6751
|
return { suggestions: [], error: "AI not configured" };
|
|
6740
|
-
d(!0), (
|
|
6752
|
+
d(!0), (D = O.current) == null || D.abort(), O.current = new AbortController();
|
|
6741
6753
|
const j = performance.now();
|
|
6742
6754
|
try {
|
|
6743
6755
|
const Y = ee(g), Z = T.split(`
|
|
@@ -6749,7 +6761,7 @@ function hi(r = {}) {
|
|
|
6749
6761
|
C.substring(L.column),
|
|
6750
6762
|
...Z.slice(L.line + 1, L.line + 10)
|
|
6751
6763
|
].join(`
|
|
6752
|
-
`), H = de(
|
|
6764
|
+
`), H = de(Ie, {
|
|
6753
6765
|
language: i,
|
|
6754
6766
|
prefix: y,
|
|
6755
6767
|
suffix: J,
|
|
@@ -6762,7 +6774,7 @@ function hi(r = {}) {
|
|
|
6762
6774
|
temperature: 0.2,
|
|
6763
6775
|
// Lower temperature for more deterministic completions
|
|
6764
6776
|
maxTokens: 512
|
|
6765
|
-
}), V =
|
|
6777
|
+
}), V = bi(U, L, t), Q = {
|
|
6766
6778
|
suggestions: V,
|
|
6767
6779
|
rawResponse: (W = (q = U.choices[0]) == null ? void 0 : q.message) == null ? void 0 : W.content,
|
|
6768
6780
|
latencyMs: performance.now() - j
|
|
@@ -6804,7 +6816,7 @@ function hi(r = {}) {
|
|
|
6804
6816
|
temperature: 0.3,
|
|
6805
6817
|
maxTokens: 1024
|
|
6806
6818
|
});
|
|
6807
|
-
return
|
|
6819
|
+
return yi(j);
|
|
6808
6820
|
} catch {
|
|
6809
6821
|
return null;
|
|
6810
6822
|
} finally {
|
|
@@ -6829,7 +6841,7 @@ function hi(r = {}) {
|
|
|
6829
6841
|
temperature: 0.4,
|
|
6830
6842
|
maxTokens: 2048
|
|
6831
6843
|
});
|
|
6832
|
-
return
|
|
6844
|
+
return vi(j);
|
|
6833
6845
|
} catch {
|
|
6834
6846
|
return [];
|
|
6835
6847
|
} finally {
|
|
@@ -6839,13 +6851,13 @@ function hi(r = {}) {
|
|
|
6839
6851
|
[g, i]
|
|
6840
6852
|
), _ = F(
|
|
6841
6853
|
async (T, L) => {
|
|
6842
|
-
var j,
|
|
6854
|
+
var j, D;
|
|
6843
6855
|
if (!g)
|
|
6844
6856
|
return null;
|
|
6845
6857
|
d(!0);
|
|
6846
6858
|
try {
|
|
6847
|
-
const q = ee(g), W = L ||
|
|
6848
|
-
return ((
|
|
6859
|
+
const q = ee(g), W = L || _i(i);
|
|
6860
|
+
return ((D = (j = (await q.chat({
|
|
6849
6861
|
messages: [
|
|
6850
6862
|
{
|
|
6851
6863
|
role: "system",
|
|
@@ -6855,7 +6867,7 @@ function hi(r = {}) {
|
|
|
6855
6867
|
],
|
|
6856
6868
|
temperature: 0.3,
|
|
6857
6869
|
maxTokens: 2048
|
|
6858
|
-
})).choices[0]) == null ? void 0 : j.message) == null ? void 0 :
|
|
6870
|
+
})).choices[0]) == null ? void 0 : j.message) == null ? void 0 : D.content) || null;
|
|
6859
6871
|
} catch {
|
|
6860
6872
|
return null;
|
|
6861
6873
|
} finally {
|
|
@@ -6865,13 +6877,13 @@ function hi(r = {}) {
|
|
|
6865
6877
|
[g, i]
|
|
6866
6878
|
), h = F(
|
|
6867
6879
|
async (T, L) => {
|
|
6868
|
-
var j,
|
|
6880
|
+
var j, D;
|
|
6869
6881
|
if (!g)
|
|
6870
6882
|
return null;
|
|
6871
6883
|
d(!0);
|
|
6872
6884
|
try {
|
|
6873
|
-
const q = ee(g), W = L ||
|
|
6874
|
-
return ((
|
|
6885
|
+
const q = ee(g), W = L || xi(i);
|
|
6886
|
+
return ((D = (j = (await q.chat({
|
|
6875
6887
|
messages: [
|
|
6876
6888
|
{
|
|
6877
6889
|
role: "system",
|
|
@@ -6881,7 +6893,7 @@ function hi(r = {}) {
|
|
|
6881
6893
|
],
|
|
6882
6894
|
temperature: 0.3,
|
|
6883
6895
|
maxTokens: 2048
|
|
6884
|
-
})).choices[0]) == null ? void 0 : j.message) == null ? void 0 :
|
|
6896
|
+
})).choices[0]) == null ? void 0 : j.message) == null ? void 0 : D.content) || null;
|
|
6885
6897
|
} catch {
|
|
6886
6898
|
return null;
|
|
6887
6899
|
} finally {
|
|
@@ -6929,7 +6941,7 @@ function hi(r = {}) {
|
|
|
6929
6941
|
isConfigured: !!g
|
|
6930
6942
|
};
|
|
6931
6943
|
}
|
|
6932
|
-
function
|
|
6944
|
+
function bi(r, e, i) {
|
|
6933
6945
|
var l, c;
|
|
6934
6946
|
const n = ((c = (l = r.choices[0]) == null ? void 0 : l.message) == null ? void 0 : c.content) || "", t = /^\s*```[\w+#.-]*\n([\s\S]*?)\n?```\s*$/.exec(n), s = (t ? t[1] : n).replace(/^\n+/, "").replace(/\s+$/, "");
|
|
6935
6947
|
return !s.trim() || i < 1 ? [] : [
|
|
@@ -6945,7 +6957,7 @@ function fi(r, e, i) {
|
|
|
6945
6957
|
}
|
|
6946
6958
|
];
|
|
6947
6959
|
}
|
|
6948
|
-
function
|
|
6960
|
+
function yi(r) {
|
|
6949
6961
|
var e, i;
|
|
6950
6962
|
try {
|
|
6951
6963
|
const n = ((i = (e = r.choices[0]) == null ? void 0 : e.message) == null ? void 0 : i.content) || "", t = n.match(/\{[\s\S]*\}/);
|
|
@@ -6954,7 +6966,7 @@ function bi(r) {
|
|
|
6954
6966
|
return null;
|
|
6955
6967
|
}
|
|
6956
6968
|
}
|
|
6957
|
-
function
|
|
6969
|
+
function vi(r) {
|
|
6958
6970
|
var e, i;
|
|
6959
6971
|
try {
|
|
6960
6972
|
const t = (((i = (e = r.choices[0]) == null ? void 0 : e.message) == null ? void 0 : i.content) || "").match(/\[[\s\S]*\]/);
|
|
@@ -6964,7 +6976,7 @@ function yi(r) {
|
|
|
6964
6976
|
}
|
|
6965
6977
|
return [];
|
|
6966
6978
|
}
|
|
6967
|
-
function
|
|
6979
|
+
function _i(r) {
|
|
6968
6980
|
return {
|
|
6969
6981
|
javascript: "Jest",
|
|
6970
6982
|
typescript: "Jest",
|
|
@@ -6980,7 +6992,7 @@ function vi(r) {
|
|
|
6980
6992
|
dart: "flutter_test"
|
|
6981
6993
|
}[r] || "unit test";
|
|
6982
6994
|
}
|
|
6983
|
-
function
|
|
6995
|
+
function xi(r) {
|
|
6984
6996
|
return {
|
|
6985
6997
|
javascript: "jsdoc",
|
|
6986
6998
|
typescript: "tsdoc",
|
|
@@ -6989,7 +7001,7 @@ function _i(r) {
|
|
|
6989
7001
|
kotlin: "javadoc"
|
|
6990
7002
|
}[r] || "jsdoc";
|
|
6991
7003
|
}
|
|
6992
|
-
function
|
|
7004
|
+
function Fr({
|
|
6993
7005
|
code: r = "",
|
|
6994
7006
|
language: e = "typescript",
|
|
6995
7007
|
config: i,
|
|
@@ -7010,27 +7022,27 @@ function Br({
|
|
|
7010
7022
|
activeSuggestion: T,
|
|
7011
7023
|
acceptSuggestion: L,
|
|
7012
7024
|
dismissSuggestions: j,
|
|
7013
|
-
navigateSuggestions:
|
|
7025
|
+
navigateSuggestions: D,
|
|
7014
7026
|
explainCode: q,
|
|
7015
7027
|
suggestRefactoring: W,
|
|
7016
7028
|
generateTests: Y,
|
|
7017
7029
|
generateDocs: Z,
|
|
7018
7030
|
loading: C,
|
|
7019
7031
|
isConfigured: y
|
|
7020
|
-
} =
|
|
7032
|
+
} = fi({
|
|
7021
7033
|
config: i,
|
|
7022
7034
|
language: e
|
|
7023
7035
|
}), J = (B) => {
|
|
7024
7036
|
if (R(B), n == null || n(B), l && f.current) {
|
|
7025
|
-
const K =
|
|
7037
|
+
const K = wi(f.current);
|
|
7026
7038
|
k(B, K);
|
|
7027
7039
|
}
|
|
7028
7040
|
}, H = (B) => {
|
|
7029
7041
|
if (N.length > 0)
|
|
7030
7042
|
if (B.key === "ArrowUp")
|
|
7031
|
-
B.preventDefault(),
|
|
7043
|
+
B.preventDefault(), D("up");
|
|
7032
7044
|
else if (B.key === "ArrowDown")
|
|
7033
|
-
B.preventDefault(),
|
|
7045
|
+
B.preventDefault(), D("down");
|
|
7034
7046
|
else if (B.key === "Tab" || B.key === "Enter") {
|
|
7035
7047
|
if (T >= 0) {
|
|
7036
7048
|
B.preventDefault();
|
|
@@ -7041,8 +7053,8 @@ function Br({
|
|
|
7041
7053
|
}, U = (B) => {
|
|
7042
7054
|
if (!f.current)
|
|
7043
7055
|
return;
|
|
7044
|
-
const K = f.current, ce = K.selectionStart,
|
|
7045
|
-
R(
|
|
7056
|
+
const K = f.current, ce = K.selectionStart, De = I.slice(0, ce) + B.text + I.slice(ce);
|
|
7057
|
+
R(De), n == null || n(De);
|
|
7046
7058
|
const Ee = ce + B.text.length;
|
|
7047
7059
|
setTimeout(() => {
|
|
7048
7060
|
K.focus(), K.setSelectionRange(Ee, Ee);
|
|
@@ -7076,7 +7088,7 @@ function Br({
|
|
|
7076
7088
|
}, z = (B) => {
|
|
7077
7089
|
const K = I.replace(B.before, B.after);
|
|
7078
7090
|
R(K), n == null || n(K), w(null);
|
|
7079
|
-
},
|
|
7091
|
+
}, E = () => {
|
|
7080
7092
|
A && navigator.clipboard.writeText(A);
|
|
7081
7093
|
}, G = () => {
|
|
7082
7094
|
if (f.current) {
|
|
@@ -7173,6 +7185,7 @@ function Br({
|
|
|
7173
7185
|
N.map((B, K) => /* @__PURE__ */ o(
|
|
7174
7186
|
"div",
|
|
7175
7187
|
{
|
|
7188
|
+
role: "presentation",
|
|
7176
7189
|
className: `nice-code-editor-ai__suggestion ${K === T ? "nice-code-editor-ai__suggestion--active" : ""}`,
|
|
7177
7190
|
onClick: () => {
|
|
7178
7191
|
const ce = L(K);
|
|
@@ -7280,7 +7293,7 @@ function Br({
|
|
|
7280
7293
|
] }, K)) }),
|
|
7281
7294
|
(h === "tests" || h === "docs") && A && /* @__PURE__ */ o("div", { className: "nice-code-editor-ai__generated", children: [
|
|
7282
7295
|
/* @__PURE__ */ a("pre", { children: A }),
|
|
7283
|
-
/* @__PURE__ */ o("button", { type: "button", onClick:
|
|
7296
|
+
/* @__PURE__ */ o("button", { type: "button", onClick: E, children: [
|
|
7284
7297
|
/* @__PURE__ */ a($, { name: "clipboard", size: 14 }),
|
|
7285
7298
|
" ",
|
|
7286
7299
|
b("codeEditorAI.copy", "Copy")
|
|
@@ -7618,7 +7631,7 @@ function Br({
|
|
|
7618
7631
|
}
|
|
7619
7632
|
);
|
|
7620
7633
|
}
|
|
7621
|
-
function
|
|
7634
|
+
function wi(r) {
|
|
7622
7635
|
const i = r.value.substring(0, r.selectionStart).split(`
|
|
7623
7636
|
`);
|
|
7624
7637
|
return {
|
|
@@ -7626,7 +7639,7 @@ function xi(r) {
|
|
|
7626
7639
|
column: i[i.length - 1].length
|
|
7627
7640
|
};
|
|
7628
7641
|
}
|
|
7629
|
-
function
|
|
7642
|
+
function ki(r = {}) {
|
|
7630
7643
|
const {
|
|
7631
7644
|
config: e,
|
|
7632
7645
|
context: i,
|
|
@@ -7650,7 +7663,7 @@ function wi(r = {}) {
|
|
|
7650
7663
|
n != null && n.length ? `Available roles: ${n.join(", ")}` : "",
|
|
7651
7664
|
t != null && t.length ? `Existing variables: ${t.join(", ")}` : ""
|
|
7652
7665
|
].filter(Boolean).join(`
|
|
7653
|
-
`), L = de(
|
|
7666
|
+
`), L = de(Re, {
|
|
7654
7667
|
description: T ? `${_}
|
|
7655
7668
|
|
|
7656
7669
|
${T}` : _
|
|
@@ -7661,14 +7674,14 @@ ${T}` : _
|
|
|
7661
7674
|
],
|
|
7662
7675
|
temperature: 0.5,
|
|
7663
7676
|
maxTokens: 2048
|
|
7664
|
-
}),
|
|
7665
|
-
workflow:
|
|
7677
|
+
}), D = Ke(j), q = {
|
|
7678
|
+
workflow: D || void 0,
|
|
7666
7679
|
rawResponse: (k = (f = j.choices[0]) == null ? void 0 : f.message) == null ? void 0 : k.content,
|
|
7667
7680
|
latencyMs: performance.now() - h,
|
|
7668
|
-
error:
|
|
7669
|
-
suggestions:
|
|
7681
|
+
error: D ? void 0 : "Failed to generate workflow",
|
|
7682
|
+
suggestions: Si(D)
|
|
7670
7683
|
};
|
|
7671
|
-
return
|
|
7684
|
+
return D && (s == null || s(D)), b(q), I((W) => [...W.slice(-9), { request: _, result: q }]), q;
|
|
7672
7685
|
} catch (N) {
|
|
7673
7686
|
const T = N instanceof Error ? N.message : "Workflow generation failed", L = {
|
|
7674
7687
|
error: T,
|
|
@@ -7702,7 +7715,7 @@ ${T}` : _
|
|
|
7702
7715
|
maxTokens: 2048
|
|
7703
7716
|
});
|
|
7704
7717
|
return {
|
|
7705
|
-
workflow:
|
|
7718
|
+
workflow: Ke(f) || void 0,
|
|
7706
7719
|
latencyMs: performance.now() - h
|
|
7707
7720
|
};
|
|
7708
7721
|
} catch (w) {
|
|
@@ -7719,7 +7732,7 @@ ${T}` : _
|
|
|
7719
7732
|
return [];
|
|
7720
7733
|
m(!0);
|
|
7721
7734
|
try {
|
|
7722
|
-
const k = ee(O), N = _.nodes.find((
|
|
7735
|
+
const k = ee(O), N = _.nodes.find((D) => D.id === h), j = (((f = (w = (await k.chat({
|
|
7723
7736
|
messages: [
|
|
7724
7737
|
{
|
|
7725
7738
|
role: "system",
|
|
@@ -7729,7 +7742,7 @@ ${T}` : _
|
|
|
7729
7742
|
role: "user",
|
|
7730
7743
|
content: `Workflow: ${_.name}
|
|
7731
7744
|
Current node: ${(N == null ? void 0 : N.label) || h}
|
|
7732
|
-
Existing nodes: ${_.nodes.map((
|
|
7745
|
+
Existing nodes: ${_.nodes.map((D) => D.label).join(", ")}`
|
|
7733
7746
|
}
|
|
7734
7747
|
],
|
|
7735
7748
|
temperature: 0.6,
|
|
@@ -7795,7 +7808,7 @@ Existing nodes: ${_.nodes.map((E) => E.label).join(", ")}`
|
|
|
7795
7808
|
isConfigured: !!O
|
|
7796
7809
|
};
|
|
7797
7810
|
}
|
|
7798
|
-
function
|
|
7811
|
+
function Ke(r) {
|
|
7799
7812
|
var e, i, n;
|
|
7800
7813
|
try {
|
|
7801
7814
|
const t = ((i = (e = r.choices[0]) == null ? void 0 : e.message) == null ? void 0 : i.content) || "", l = ((n = (t.match(/```(?:json)?\s*([\s\S]*?)```/) || [null, t])[1]) == null ? void 0 : n.trim()) || t, c = JSON.parse(l);
|
|
@@ -7810,7 +7823,7 @@ function He(r) {
|
|
|
7810
7823
|
label: S.label ?? S.name ?? S.id ?? `Step ${I + 1}`,
|
|
7811
7824
|
type: p[S.type] ?? S.type
|
|
7812
7825
|
})
|
|
7813
|
-
), d =
|
|
7826
|
+
), d = Ni(m), b = m.map((S, I) => ({
|
|
7814
7827
|
...S,
|
|
7815
7828
|
position: S.position || d[I]
|
|
7816
7829
|
}));
|
|
@@ -7830,32 +7843,32 @@ function He(r) {
|
|
|
7830
7843
|
}
|
|
7831
7844
|
return null;
|
|
7832
7845
|
}
|
|
7833
|
-
function
|
|
7846
|
+
function ca(r) {
|
|
7834
7847
|
return r.type === "start" || r.type === "end" || r.type.startsWith("gateway") ? 40 : Math.round((r.label ?? "").length * 7.2 + 64);
|
|
7835
7848
|
}
|
|
7836
|
-
function
|
|
7849
|
+
function Ni(r) {
|
|
7837
7850
|
let t = 20, s = 40;
|
|
7838
7851
|
return r.map((l) => {
|
|
7839
|
-
const c =
|
|
7852
|
+
const c = ca(l);
|
|
7840
7853
|
t > 20 && t + c > 640 && (t = 20, s += 110);
|
|
7841
7854
|
const p = { x: t, y: s };
|
|
7842
7855
|
return t += c + 48, p;
|
|
7843
7856
|
});
|
|
7844
7857
|
}
|
|
7845
|
-
function
|
|
7858
|
+
function Si(r) {
|
|
7846
7859
|
if (!r)
|
|
7847
7860
|
return [];
|
|
7848
7861
|
const e = [];
|
|
7849
7862
|
return r.nodes.some((s) => s.type === "event-error") || e.push("Add error boundary events for critical tasks"), !r.nodes.some((s) => s.type === "gateway-parallel") && r.nodes.length > 5 && e.push("Consider parallel gateways for independent tasks"), (!r.lanes || r.lanes.length === 0) && e.push("Add swimlanes to clarify responsibilities"), r.nodes.some((s) => s.type === "event-timer") || e.push("Add timer events for SLA monitoring"), e.slice(0, 3);
|
|
7850
7863
|
}
|
|
7851
|
-
const
|
|
7864
|
+
const Ci = [
|
|
7852
7865
|
"Employee onboarding process with HR approval",
|
|
7853
7866
|
"Purchase order approval with budget check",
|
|
7854
7867
|
"Customer support ticket escalation workflow",
|
|
7855
7868
|
"Document review and approval process",
|
|
7856
7869
|
"Leave request with manager and HR approval"
|
|
7857
7870
|
];
|
|
7858
|
-
function
|
|
7871
|
+
function Jr({
|
|
7859
7872
|
config: r,
|
|
7860
7873
|
context: e,
|
|
7861
7874
|
roles: i,
|
|
@@ -7870,7 +7883,7 @@ function Fr({
|
|
|
7870
7883
|
const { t: d } = ie(), b = t ?? d(
|
|
7871
7884
|
"workflowDesignerAI.describeTheWorkflow",
|
|
7872
7885
|
'Describe the workflow process... (e.g., "Leave request with manager approval")'
|
|
7873
|
-
), [S, I] = M(""), [R, O] = M([]), P = X(null), { generateWorkflow: g, validateWorkflow: u, loading: v, lastResult: x, isConfigured: A } =
|
|
7886
|
+
), [S, I] = M(""), [R, O] = M([]), P = X(null), { generateWorkflow: g, validateWorkflow: u, loading: v, lastResult: x, isConfigured: A } = ki({
|
|
7874
7887
|
config: r,
|
|
7875
7888
|
context: e,
|
|
7876
7889
|
existingRoles: i,
|
|
@@ -7888,7 +7901,7 @@ function Fr({
|
|
|
7888
7901
|
}, f = () => {
|
|
7889
7902
|
if (!(x != null && x.workflow))
|
|
7890
7903
|
return;
|
|
7891
|
-
const k =
|
|
7904
|
+
const k = Ti(x.workflow), N = new Blob([k], { type: "application/xml" }), T = URL.createObjectURL(N), L = document.createElement("a");
|
|
7892
7905
|
L.href = T, L.download = `${x.workflow.name.replace(/\s+/g, "_")}.bpmn`, L.click(), URL.revokeObjectURL(T);
|
|
7893
7906
|
};
|
|
7894
7907
|
return A ? /* @__PURE__ */ o("div", { className: `nice-workflow-ai ${c || ""}`, style: p, children: [
|
|
@@ -7922,7 +7935,7 @@ function Fr({
|
|
|
7922
7935
|
] }),
|
|
7923
7936
|
s && /* @__PURE__ */ o("div", { className: "nice-workflow-ai__examples", children: [
|
|
7924
7937
|
/* @__PURE__ */ a("span", { className: "nice-workflow-ai__examples-label", children: d("workflowDesignerAI.try", "Try:") }),
|
|
7925
|
-
|
|
7938
|
+
Ci.slice(0, 3).map((k, N) => /* @__PURE__ */ a(
|
|
7926
7939
|
"button",
|
|
7927
7940
|
{
|
|
7928
7941
|
type: "button",
|
|
@@ -7982,7 +7995,7 @@ function Fr({
|
|
|
7982
7995
|
N
|
|
7983
7996
|
)) })
|
|
7984
7997
|
] }),
|
|
7985
|
-
l && /* @__PURE__ */ a("div", { className: "nice-workflow-ai__preview", children: m ? m(x.workflow) : /* @__PURE__ */ a(
|
|
7998
|
+
l && /* @__PURE__ */ a("div", { className: "nice-workflow-ai__preview", children: m ? m(x.workflow) : /* @__PURE__ */ a(Ai, { workflow: x.workflow }) }),
|
|
7986
7999
|
x.suggestions && x.suggestions.length > 0 && /* @__PURE__ */ o("div", { className: "nice-workflow-ai__suggestions", children: [
|
|
7987
8000
|
/* @__PURE__ */ o("span", { className: "nice-workflow-ai__suggestions-title", children: [
|
|
7988
8001
|
/* @__PURE__ */ a($, { name: "lightbulb", size: 14 }),
|
|
@@ -8273,7 +8286,7 @@ function Fr({
|
|
|
8273
8286
|
}
|
|
8274
8287
|
);
|
|
8275
8288
|
}
|
|
8276
|
-
function
|
|
8289
|
+
function Ai({ workflow: r }) {
|
|
8277
8290
|
const { t: e } = ie(), i = (t) => ({
|
|
8278
8291
|
start: "play",
|
|
8279
8292
|
end: "stop",
|
|
@@ -8314,7 +8327,7 @@ function Ci({ workflow: r }) {
|
|
|
8314
8327
|
const s = r.nodes.find((b) => b.id === t.source), l = r.nodes.find((b) => b.id === t.target);
|
|
8315
8328
|
if (!(s != null && s.position) || !(l != null && l.position))
|
|
8316
8329
|
return null;
|
|
8317
|
-
const c = s.position.x +
|
|
8330
|
+
const c = s.position.x + ca(s), p = s.position.y + 20, m = l.position.x, d = l.position.y + 20;
|
|
8318
8331
|
return /* @__PURE__ */ o("g", { children: [
|
|
8319
8332
|
/* @__PURE__ */ a(
|
|
8320
8333
|
"line",
|
|
@@ -8467,7 +8480,7 @@ function Ci({ workflow: r }) {
|
|
|
8467
8480
|
` })
|
|
8468
8481
|
] });
|
|
8469
8482
|
}
|
|
8470
|
-
function
|
|
8483
|
+
function Ti(r) {
|
|
8471
8484
|
const e = {
|
|
8472
8485
|
start: "bpmn:startEvent",
|
|
8473
8486
|
end: "bpmn:endEvent",
|
|
@@ -8478,24 +8491,24 @@ function Ai(r) {
|
|
|
8478
8491
|
"gateway-exclusive": "bpmn:exclusiveGateway",
|
|
8479
8492
|
"gateway-parallel": "bpmn:parallelGateway",
|
|
8480
8493
|
"gateway-inclusive": "bpmn:inclusiveGateway"
|
|
8481
|
-
}, i = r.nodes.map((t) => ` <${e[t.type] || "bpmn:task"} id="${t.id}" name="${
|
|
8482
|
-
`), n = r.edges.map((t) => ` <bpmn:sequenceFlow id="${t.id}" sourceRef="${t.source}" targetRef="${t.target}"${t.label ? ` name="${
|
|
8494
|
+
}, i = r.nodes.map((t) => ` <${e[t.type] || "bpmn:task"} id="${t.id}" name="${ve(t.label)}" />`).join(`
|
|
8495
|
+
`), n = r.edges.map((t) => ` <bpmn:sequenceFlow id="${t.id}" sourceRef="${t.source}" targetRef="${t.target}"${t.label ? ` name="${ve(t.label)}"` : ""} />`).join(`
|
|
8483
8496
|
`);
|
|
8484
8497
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
8485
8498
|
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
|
|
8486
8499
|
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
|
|
8487
8500
|
id="${r.id}"
|
|
8488
8501
|
targetNamespace="http://nice2dev.com/bpmn">
|
|
8489
|
-
<bpmn:process id="Process_${r.id}" name="${
|
|
8502
|
+
<bpmn:process id="Process_${r.id}" name="${ve(r.name)}" isExecutable="true">
|
|
8490
8503
|
${i}
|
|
8491
8504
|
${n}
|
|
8492
8505
|
</bpmn:process>
|
|
8493
8506
|
</bpmn:definitions>`;
|
|
8494
8507
|
}
|
|
8495
|
-
function
|
|
8508
|
+
function ve(r) {
|
|
8496
8509
|
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
8497
8510
|
}
|
|
8498
|
-
function
|
|
8511
|
+
function Ii(r = {}) {
|
|
8499
8512
|
const { config: e, dataSources: i, context: n, onReportGenerated: t, onError: s } = r, l = se(), [c, p] = M(!1), [m, d] = M(null), [b, S] = M([]), I = X(null), R = e || (l == null ? void 0 : l.config), O = F(
|
|
8500
8513
|
async (A) => {
|
|
8501
8514
|
var h, w, f;
|
|
@@ -8508,7 +8521,7 @@ function Ti(r = {}) {
|
|
|
8508
8521
|
(h = I.current) == null || h.abort(), I.current = new AbortController();
|
|
8509
8522
|
try {
|
|
8510
8523
|
const k = ee(R), N = i ? i.map((q) => `- ${q.name} (${q.id}): ${q.fields.join(", ")}`).join(`
|
|
8511
|
-
`) : void 0, T = de(
|
|
8524
|
+
`) : void 0, T = de(ze, {
|
|
8512
8525
|
// audit-allow: i18n — the prompt for the model, not UI copy
|
|
8513
8526
|
description: n ? `${A}
|
|
8514
8527
|
|
|
@@ -8521,14 +8534,14 @@ Context: ${n}` : A,
|
|
|
8521
8534
|
],
|
|
8522
8535
|
temperature: 0.5,
|
|
8523
8536
|
maxTokens: 2048
|
|
8524
|
-
}), j =
|
|
8537
|
+
}), j = Li(L), D = {
|
|
8525
8538
|
layout: j || void 0,
|
|
8526
8539
|
rawResponse: (f = (w = L.choices[0]) == null ? void 0 : w.message) == null ? void 0 : f.content,
|
|
8527
8540
|
latencyMs: performance.now() - _,
|
|
8528
8541
|
error: j ? void 0 : "Failed to generate report layout",
|
|
8529
|
-
suggestions:
|
|
8542
|
+
suggestions: $i(j)
|
|
8530
8543
|
};
|
|
8531
|
-
return j && (t == null || t(j)), d(
|
|
8544
|
+
return j && (t == null || t(j)), d(D), S((q) => [...q.slice(-9), { request: A, result: D }]), D;
|
|
8532
8545
|
} catch (k) {
|
|
8533
8546
|
const N = k instanceof Error ? k.message : "Report generation failed", T = {
|
|
8534
8547
|
error: N,
|
|
@@ -8628,7 +8641,7 @@ Purpose: ${_}`
|
|
|
8628
8641
|
"combo",
|
|
8629
8642
|
"gauge",
|
|
8630
8643
|
"heatmap"
|
|
8631
|
-
].find((
|
|
8644
|
+
].find((D) => L == null ? void 0 : L.includes(D)) || "bar";
|
|
8632
8645
|
} catch {
|
|
8633
8646
|
return "bar";
|
|
8634
8647
|
}
|
|
@@ -8656,7 +8669,7 @@ Purpose: ${_}`
|
|
|
8656
8669
|
isConfigured: !!R
|
|
8657
8670
|
};
|
|
8658
8671
|
}
|
|
8659
|
-
const
|
|
8672
|
+
const Ri = /* @__PURE__ */ new Set([
|
|
8660
8673
|
"header",
|
|
8661
8674
|
"summary",
|
|
8662
8675
|
"kpi",
|
|
@@ -8670,7 +8683,7 @@ const Ii = /* @__PURE__ */ new Set([
|
|
|
8670
8683
|
"footer",
|
|
8671
8684
|
"toc",
|
|
8672
8685
|
"customBlock"
|
|
8673
|
-
]),
|
|
8686
|
+
]), zi = {
|
|
8674
8687
|
title: "header",
|
|
8675
8688
|
subtitle: "text",
|
|
8676
8689
|
"kpi-card": "kpi",
|
|
@@ -8680,21 +8693,21 @@ const Ii = /* @__PURE__ */ new Set([
|
|
|
8680
8693
|
"section-break": "divider",
|
|
8681
8694
|
logo: "image"
|
|
8682
8695
|
};
|
|
8683
|
-
function
|
|
8696
|
+
function Ve(r) {
|
|
8684
8697
|
const e = typeof r == "string" ? r : "";
|
|
8685
|
-
return
|
|
8698
|
+
return zi[e] ?? (Ri.has(e) ? e : "customBlock");
|
|
8686
8699
|
}
|
|
8687
|
-
function
|
|
8700
|
+
function Li(r) {
|
|
8688
8701
|
var e, i, n;
|
|
8689
8702
|
try {
|
|
8690
8703
|
const t = ((i = (e = r.choices[0]) == null ? void 0 : e.message) == null ? void 0 : i.content) || "", l = ((n = (t.match(/```(?:json)?\s*([\s\S]*?)```/) || [null, t])[1]) == null ? void 0 : n.trim()) || t, c = JSON.parse(l);
|
|
8691
8704
|
if (c.sections && Array.isArray(c.sections)) {
|
|
8692
8705
|
const p = c.sections.flatMap(
|
|
8693
8706
|
(d) => Array.isArray(d.elements) && !d.type ? d.elements.map((b, S) => ({
|
|
8694
|
-
type:
|
|
8707
|
+
type: Ve(b.type),
|
|
8695
8708
|
title: S === 0 ? d.title : void 0,
|
|
8696
8709
|
config: b.config ?? {}
|
|
8697
|
-
})) : [{ ...d, type:
|
|
8710
|
+
})) : [{ ...d, type: Ve(d.type) }]
|
|
8698
8711
|
);
|
|
8699
8712
|
c.header && !p.some((d) => d.type === "header") && p.unshift({ type: "header", title: "Header", config: c.header }), c.footer && !p.some((d) => d.type === "footer") && p.push({ type: "footer", title: "Footer", config: c.footer });
|
|
8700
8713
|
const m = p.map((d, b) => ({
|
|
@@ -8720,13 +8733,13 @@ function zi(r) {
|
|
|
8720
8733
|
}
|
|
8721
8734
|
return null;
|
|
8722
8735
|
}
|
|
8723
|
-
function
|
|
8736
|
+
function $i(r) {
|
|
8724
8737
|
if (!r)
|
|
8725
8738
|
return [];
|
|
8726
8739
|
const e = [], i = new Set(r.sections.map((n) => n.type));
|
|
8727
8740
|
return i.has("summary") || e.push("Add an executive summary for quick insights"), i.has("kpi") || e.push("Include KPI cards for key metrics"), i.has("chart") || e.push("Add visualizations to make data more accessible"), i.has("footer") || e.push("Add a footer with page numbers and date"), r.sections.length > 5 && !i.has("toc") && e.push("Consider adding a table of contents"), e.slice(0, 3);
|
|
8728
8741
|
}
|
|
8729
|
-
const
|
|
8742
|
+
const Pi = [
|
|
8730
8743
|
{
|
|
8731
8744
|
icon: "bar-chart",
|
|
8732
8745
|
name: "Sales Report",
|
|
@@ -8753,7 +8766,7 @@ const $i = [
|
|
|
8753
8766
|
prompt: "Executive KPI dashboard with performance metrics, trends, and target comparison"
|
|
8754
8767
|
}
|
|
8755
8768
|
];
|
|
8756
|
-
function
|
|
8769
|
+
function qr({
|
|
8757
8770
|
config: r,
|
|
8758
8771
|
dataSources: e,
|
|
8759
8772
|
context: i,
|
|
@@ -8768,7 +8781,7 @@ function Jr({
|
|
|
8768
8781
|
const { t: d } = ie(), b = t ?? d(
|
|
8769
8782
|
"reportBuilderAI.describeTheReport",
|
|
8770
8783
|
'Describe the report you need... (e.g., "Monthly sales report with KPIs and charts")'
|
|
8771
|
-
), [S, I] = M(""), R = X(null), { generateReport: O, loading: P, lastResult: g, isConfigured: u } =
|
|
8784
|
+
), [S, I] = M(""), R = X(null), { generateReport: O, loading: P, lastResult: g, isConfigured: u } = Ii({
|
|
8772
8785
|
config: r,
|
|
8773
8786
|
dataSources: e,
|
|
8774
8787
|
context: i,
|
|
@@ -8785,7 +8798,7 @@ function Jr({
|
|
|
8785
8798
|
f.href = w, f.download = `${g.layout.name.replace(/\s+/g, "_")}.json`, f.click(), URL.revokeObjectURL(w);
|
|
8786
8799
|
};
|
|
8787
8800
|
return u ? /* @__PURE__ */ o("div", { className: `nice-report-ai ${c || ""}`, style: p, children: [
|
|
8788
|
-
s && /* @__PURE__ */ a("div", { className: "nice-report-ai__templates", children:
|
|
8801
|
+
s && /* @__PURE__ */ a("div", { className: "nice-report-ai__templates", children: Pi.map((_, h) => /* @__PURE__ */ o(
|
|
8789
8802
|
"button",
|
|
8790
8803
|
{
|
|
8791
8804
|
type: "button",
|
|
@@ -8868,12 +8881,12 @@ function Jr({
|
|
|
8868
8881
|
/* @__PURE__ */ a("div", { className: "nice-report-ai__sections-title", children: d("reportBuilderAI.reportStructure", "Report Structure:") }),
|
|
8869
8882
|
/* @__PURE__ */ a("div", { className: "nice-report-ai__sections-list", children: g.layout.sections.map((_, h) => /* @__PURE__ */ o("div", { className: "nice-report-ai__section", children: [
|
|
8870
8883
|
/* @__PURE__ */ a("span", { className: "nice-report-ai__section-number", children: h + 1 }),
|
|
8871
|
-
/* @__PURE__ */ a("span", { className: "nice-report-ai__section-icon", children: /* @__PURE__ */ a($, { name:
|
|
8884
|
+
/* @__PURE__ */ a("span", { className: "nice-report-ai__section-icon", children: /* @__PURE__ */ a($, { name: la(_.type), size: 16 }) }),
|
|
8872
8885
|
/* @__PURE__ */ a("span", { className: "nice-report-ai__section-type", children: _.type }),
|
|
8873
8886
|
_.title && /* @__PURE__ */ a("span", { className: "nice-report-ai__section-title", children: _.title })
|
|
8874
8887
|
] }, _.id)) })
|
|
8875
8888
|
] }),
|
|
8876
|
-
l && /* @__PURE__ */ a("div", { className: "nice-report-ai__preview", children: m ? m(g.layout) : /* @__PURE__ */ a(
|
|
8889
|
+
l && /* @__PURE__ */ a("div", { className: "nice-report-ai__preview", children: m ? m(g.layout) : /* @__PURE__ */ a(Mi, { layout: g.layout }) }),
|
|
8877
8890
|
g.suggestions && g.suggestions.length > 0 && /* @__PURE__ */ o("div", { className: "nice-report-ai__suggestions", children: [
|
|
8878
8891
|
/* @__PURE__ */ o("span", { className: "nice-report-ai__suggestions-title", children: [
|
|
8879
8892
|
/* @__PURE__ */ a($, { name: "lightbulb", size: 14 }),
|
|
@@ -9205,7 +9218,7 @@ function Jr({
|
|
|
9205
9218
|
"AI not configured. Please provide config or wrap in NiceAIProvider."
|
|
9206
9219
|
) }) });
|
|
9207
9220
|
}
|
|
9208
|
-
function
|
|
9221
|
+
function la(r) {
|
|
9209
9222
|
return {
|
|
9210
9223
|
header: "file",
|
|
9211
9224
|
summary: "edit",
|
|
@@ -9222,7 +9235,7 @@ function ca(r) {
|
|
|
9222
9235
|
customBlock: "puzzle"
|
|
9223
9236
|
}[r] || "file";
|
|
9224
9237
|
}
|
|
9225
|
-
function
|
|
9238
|
+
function Mi({ layout: r }) {
|
|
9226
9239
|
return /* @__PURE__ */ o(
|
|
9227
9240
|
"div",
|
|
9228
9241
|
{
|
|
@@ -9237,7 +9250,7 @@ function Pi({ layout: r }) {
|
|
|
9237
9250
|
{
|
|
9238
9251
|
className: `report-preview__section report-preview__section--${e.type}`,
|
|
9239
9252
|
children: [
|
|
9240
|
-
/* @__PURE__ */ a("span", { className: "report-preview__section-icon", children: /* @__PURE__ */ a($, { name:
|
|
9253
|
+
/* @__PURE__ */ a("span", { className: "report-preview__section-icon", children: /* @__PURE__ */ a($, { name: la(e.type), size: 14 }) }),
|
|
9241
9254
|
/* @__PURE__ */ a("span", { className: "report-preview__section-label", children: e.title || e.type })
|
|
9242
9255
|
]
|
|
9243
9256
|
},
|
|
@@ -9328,7 +9341,7 @@ function Pi({ layout: r }) {
|
|
|
9328
9341
|
}
|
|
9329
9342
|
);
|
|
9330
9343
|
}
|
|
9331
|
-
function
|
|
9344
|
+
function Oi(r, e) {
|
|
9332
9345
|
return {
|
|
9333
9346
|
system: `You are a UI/UX designer specializing in design systems. Create a complete theme for the request, with WCAG 2.1 AA contrast (4.5:1 for text).
|
|
9334
9347
|
Return only JSON: ${e ? '{ "light": THEME, "dark": THEME }, the dark one with "mode": "dark",' : '{ "light": THEME },'} where THEME is
|
|
@@ -9349,7 +9362,7 @@ Return only JSON: ${e ? '{ "light": THEME, "dark": THEME }, the dark one with "m
|
|
|
9349
9362
|
user: r
|
|
9350
9363
|
};
|
|
9351
9364
|
}
|
|
9352
|
-
function
|
|
9365
|
+
function Di(r = {}) {
|
|
9353
9366
|
const { config: e, generateDarkMode: i = !0, onThemeGenerated: n, onError: t } = r, s = se(), [l, c] = M(!1), [p, m] = M(null), d = X(null), b = e || (s == null ? void 0 : s.config), S = F(
|
|
9354
9367
|
async (u) => {
|
|
9355
9368
|
var x, A, _, h;
|
|
@@ -9377,14 +9390,14 @@ function Oi(r = {}) {
|
|
|
9377
9390
|
f = "Extract colors and create a theme from the provided image palette";
|
|
9378
9391
|
break;
|
|
9379
9392
|
}
|
|
9380
|
-
const k =
|
|
9393
|
+
const k = Oi(f, i), N = await w.chat({
|
|
9381
9394
|
messages: [
|
|
9382
9395
|
{ role: "system", content: k.system },
|
|
9383
9396
|
{ role: "user", content: k.user }
|
|
9384
9397
|
],
|
|
9385
9398
|
temperature: 0.6,
|
|
9386
9399
|
maxTokens: 2048
|
|
9387
|
-
}), T =
|
|
9400
|
+
}), T = Ye(N), L = {
|
|
9388
9401
|
theme: T.light || void 0,
|
|
9389
9402
|
darkTheme: T.dark || void 0,
|
|
9390
9403
|
rawResponse: (h = (_ = N.choices[0]) == null ? void 0 : _.message) == null ? void 0 : h.content,
|
|
@@ -9427,7 +9440,7 @@ Adjustments: ${v}`
|
|
|
9427
9440
|
temperature: 0.4,
|
|
9428
9441
|
maxTokens: 2048
|
|
9429
9442
|
});
|
|
9430
|
-
return
|
|
9443
|
+
return Ye(A).light || null;
|
|
9431
9444
|
} catch {
|
|
9432
9445
|
return null;
|
|
9433
9446
|
} finally {
|
|
@@ -9438,10 +9451,10 @@ Adjustments: ${v}`
|
|
|
9438
9451
|
), R = F((u) => {
|
|
9439
9452
|
const v = [];
|
|
9440
9453
|
return v.push(" /* Colors */"), Object.entries(u.colors).forEach(([x, A]) => {
|
|
9441
|
-
v.push(` --nice-${
|
|
9454
|
+
v.push(` --nice-${xe(x)}: ${A};`);
|
|
9442
9455
|
}), v.push(`
|
|
9443
9456
|
/* Typography */`), Object.entries(u.typography).forEach(([x, A]) => {
|
|
9444
|
-
v.push(` --nice-${
|
|
9457
|
+
v.push(` --nice-${xe(x)}: ${A};`);
|
|
9445
9458
|
}), v.push(`
|
|
9446
9459
|
/* Spacing */`), Object.entries(u.spacing).forEach(([x, A]) => {
|
|
9447
9460
|
v.push(` --nice-spacing-${x}: ${A};`);
|
|
@@ -9453,7 +9466,7 @@ Adjustments: ${v}`
|
|
|
9453
9466
|
v.push(` --nice-shadow-${x}: ${A};`);
|
|
9454
9467
|
}), v.push(`
|
|
9455
9468
|
/* Animations */`), Object.entries(u.animations).forEach(([x, A]) => {
|
|
9456
|
-
v.push(` --nice-${
|
|
9469
|
+
v.push(` --nice-${xe(x)}: ${A};`);
|
|
9457
9470
|
}), `:root {
|
|
9458
9471
|
${v.join(`
|
|
9459
9472
|
`)}
|
|
@@ -9511,25 +9524,25 @@ module.exports = ${JSON.stringify(v, null, 2)}`;
|
|
|
9511
9524
|
isConfigured: !!b
|
|
9512
9525
|
};
|
|
9513
9526
|
}
|
|
9514
|
-
function
|
|
9527
|
+
function Ye(r) {
|
|
9515
9528
|
var e, i, n;
|
|
9516
9529
|
try {
|
|
9517
9530
|
const t = ((i = (e = r.choices[0]) == null ? void 0 : e.message) == null ? void 0 : i.content) || "", l = ((n = (t.match(/```(?:json)?\s*([\s\S]*?)```/) || [null, t])[1]) == null ? void 0 : n.trim()) || t, c = JSON.parse(l);
|
|
9518
9531
|
if (c.light || c.theme)
|
|
9519
9532
|
return {
|
|
9520
|
-
light:
|
|
9521
|
-
dark: c.dark ?
|
|
9533
|
+
light: _e(c.light || c.theme),
|
|
9534
|
+
dark: c.dark ? _e(c.dark) : null
|
|
9522
9535
|
};
|
|
9523
9536
|
if (c.colors)
|
|
9524
9537
|
return {
|
|
9525
|
-
light:
|
|
9538
|
+
light: _e(c),
|
|
9526
9539
|
dark: null
|
|
9527
9540
|
};
|
|
9528
9541
|
} catch {
|
|
9529
9542
|
}
|
|
9530
9543
|
return { light: null, dark: null };
|
|
9531
9544
|
}
|
|
9532
|
-
function
|
|
9545
|
+
function _e(r) {
|
|
9533
9546
|
return {
|
|
9534
9547
|
id: r.id || `theme_${Date.now()}`,
|
|
9535
9548
|
name: r.name || "Generated Theme",
|
|
@@ -9628,10 +9641,10 @@ function Ei(r) {
|
|
|
9628
9641
|
const e = [];
|
|
9629
9642
|
return e.push("Verify WCAG contrast ratios for text on background"), e.push("Test the theme in both light and dark environments"), e.push("Ensure button and input styles are consistent"), e.slice(0, 3);
|
|
9630
9643
|
}
|
|
9631
|
-
function
|
|
9644
|
+
function xe(r) {
|
|
9632
9645
|
return r.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
9633
9646
|
}
|
|
9634
|
-
const
|
|
9647
|
+
const ji = [
|
|
9635
9648
|
{
|
|
9636
9649
|
icon: "building",
|
|
9637
9650
|
name: "Corporate",
|
|
@@ -9643,7 +9656,7 @@ const Di = [
|
|
|
9643
9656
|
{ icon: "gift", name: "Playful", prompt: "Fun playful theme with candy colors for kids" },
|
|
9644
9657
|
{ icon: "star", name: "Luxury", prompt: "Elegant luxury brand theme with gold accents" }
|
|
9645
9658
|
];
|
|
9646
|
-
function
|
|
9659
|
+
function Ur({
|
|
9647
9660
|
config: r,
|
|
9648
9661
|
generateDarkMode: e = !0,
|
|
9649
9662
|
onGenerate: i,
|
|
@@ -9652,52 +9665,52 @@ function qr({
|
|
|
9652
9665
|
className: s,
|
|
9653
9666
|
style: l
|
|
9654
9667
|
}) {
|
|
9655
|
-
const { t: c } = ie(), [p, m] = M("description"), [d, b] = M(""), [S, I] = M(""), [R, O] = M(""), [P, g] = M("#0066cc"), [u, v] = M("light"), { generateTheme: x, toCSSVariables: A, toTailwindConfig: _, loading: h, lastResult: w, isConfigured: f } =
|
|
9668
|
+
const { t: c } = ie(), [p, m] = M("description"), [d, b] = M(""), [S, I] = M(""), [R, O] = M(""), [P, g] = M("#0066cc"), [u, v] = M("light"), { generateTheme: x, toCSSVariables: A, toTailwindConfig: _, loading: h, lastResult: w, isConfigured: f } = Di({
|
|
9656
9669
|
config: r,
|
|
9657
9670
|
generateDarkMode: e,
|
|
9658
9671
|
onThemeGenerated: i
|
|
9659
9672
|
}), k = async () => {
|
|
9660
9673
|
if (h)
|
|
9661
9674
|
return;
|
|
9662
|
-
let
|
|
9675
|
+
let D;
|
|
9663
9676
|
switch (p) {
|
|
9664
9677
|
case "brand":
|
|
9665
9678
|
if (!S.trim())
|
|
9666
9679
|
return;
|
|
9667
|
-
|
|
9680
|
+
D = { type: "brand", value: { name: S, industry: R || void 0 } };
|
|
9668
9681
|
break;
|
|
9669
9682
|
case "colors":
|
|
9670
|
-
|
|
9683
|
+
D = { type: "colors", value: { primary: P } };
|
|
9671
9684
|
break;
|
|
9672
9685
|
default:
|
|
9673
9686
|
if (!d.trim())
|
|
9674
9687
|
return;
|
|
9675
|
-
|
|
9688
|
+
D = { type: "description", value: d };
|
|
9676
9689
|
}
|
|
9677
|
-
await x(
|
|
9678
|
-
}, N = (
|
|
9679
|
-
m("description"), b(
|
|
9690
|
+
await x(D);
|
|
9691
|
+
}, N = (D) => {
|
|
9692
|
+
m("description"), b(D.prompt);
|
|
9680
9693
|
}, T = () => {
|
|
9681
9694
|
if (!(w != null && w.theme))
|
|
9682
9695
|
return;
|
|
9683
|
-
const
|
|
9696
|
+
const D = A(w.theme), q = new Blob([D], { type: "text/css" }), W = URL.createObjectURL(q), Y = document.createElement("a");
|
|
9684
9697
|
Y.href = W, Y.download = `${w.theme.name.replace(/\s+/g, "-").toLowerCase()}.css`, Y.click(), URL.revokeObjectURL(W);
|
|
9685
9698
|
}, L = () => {
|
|
9686
9699
|
if (!(w != null && w.theme))
|
|
9687
9700
|
return;
|
|
9688
|
-
const
|
|
9701
|
+
const D = _(w.theme), q = new Blob([D], { type: "text/javascript" }), W = URL.createObjectURL(q), Y = document.createElement("a");
|
|
9689
9702
|
Y.href = W, Y.download = "tailwind.config.js", Y.click(), URL.revokeObjectURL(W);
|
|
9690
9703
|
}, j = u === "dark" && (w != null && w.darkTheme) ? w.darkTheme : w == null ? void 0 : w.theme;
|
|
9691
9704
|
return f ? /* @__PURE__ */ o("div", { className: `nice-theme-ai ${s || ""}`, style: l, children: [
|
|
9692
|
-
n && /* @__PURE__ */ a("div", { className: "nice-theme-ai__presets", children:
|
|
9705
|
+
n && /* @__PURE__ */ a("div", { className: "nice-theme-ai__presets", children: ji.map((D, q) => /* @__PURE__ */ o(
|
|
9693
9706
|
"button",
|
|
9694
9707
|
{
|
|
9695
9708
|
type: "button",
|
|
9696
9709
|
className: "nice-theme-ai__preset",
|
|
9697
|
-
onClick: () => N(
|
|
9710
|
+
onClick: () => N(D),
|
|
9698
9711
|
children: [
|
|
9699
|
-
/* @__PURE__ */ a("span", { className: "nice-theme-ai__preset-icon", children: /* @__PURE__ */ a($, { name:
|
|
9700
|
-
/* @__PURE__ */ a("span", { className: "nice-theme-ai__preset-name", children:
|
|
9712
|
+
/* @__PURE__ */ a("span", { className: "nice-theme-ai__preset-icon", children: /* @__PURE__ */ a($, { name: D.icon, size: 24 }) }),
|
|
9713
|
+
/* @__PURE__ */ a("span", { className: "nice-theme-ai__preset-name", children: D.name })
|
|
9701
9714
|
]
|
|
9702
9715
|
},
|
|
9703
9716
|
q
|
|
@@ -9748,7 +9761,7 @@ function qr({
|
|
|
9748
9761
|
"textarea",
|
|
9749
9762
|
{
|
|
9750
9763
|
value: d,
|
|
9751
|
-
onChange: (
|
|
9764
|
+
onChange: (D) => b(D.target.value),
|
|
9752
9765
|
placeholder: c(
|
|
9753
9766
|
"themeGeneratorAI.describeTheThemeYouWant",
|
|
9754
9767
|
"Describe the theme you want... (e.g., 'Modern tech startup with blue and green')"
|
|
@@ -9764,7 +9777,7 @@ function qr({
|
|
|
9764
9777
|
{
|
|
9765
9778
|
type: "text",
|
|
9766
9779
|
value: S,
|
|
9767
|
-
onChange: (
|
|
9780
|
+
onChange: (D) => I(D.target.value),
|
|
9768
9781
|
placeholder: c("themeGeneratorAI.brandName", "Brand name"),
|
|
9769
9782
|
className: "nice-theme-ai__input",
|
|
9770
9783
|
disabled: h
|
|
@@ -9775,7 +9788,7 @@ function qr({
|
|
|
9775
9788
|
{
|
|
9776
9789
|
type: "text",
|
|
9777
9790
|
value: R,
|
|
9778
|
-
onChange: (
|
|
9791
|
+
onChange: (D) => O(D.target.value),
|
|
9779
9792
|
placeholder: c("themeGeneratorAI.industryOptional", "Industry (optional)"),
|
|
9780
9793
|
className: "nice-theme-ai__input",
|
|
9781
9794
|
disabled: h
|
|
@@ -9789,7 +9802,7 @@ function qr({
|
|
|
9789
9802
|
{
|
|
9790
9803
|
type: "color",
|
|
9791
9804
|
value: P,
|
|
9792
|
-
onChange: (
|
|
9805
|
+
onChange: (D) => g(D.target.value),
|
|
9793
9806
|
className: "nice-theme-ai__color-picker",
|
|
9794
9807
|
disabled: h
|
|
9795
9808
|
}
|
|
@@ -9852,14 +9865,14 @@ function qr({
|
|
|
9852
9865
|
] })
|
|
9853
9866
|
] })
|
|
9854
9867
|
] }),
|
|
9855
|
-
t && /* @__PURE__ */ a(
|
|
9868
|
+
t && /* @__PURE__ */ a(Bi, { theme: j }),
|
|
9856
9869
|
/* @__PURE__ */ o("div", { className: "nice-theme-ai__palette", children: [
|
|
9857
9870
|
/* @__PURE__ */ a("div", { className: "nice-theme-ai__palette-title", children: c("themeGeneratorAI.colorPalette", "Color Palette") }),
|
|
9858
|
-
/* @__PURE__ */ a("div", { className: "nice-theme-ai__colors", children: Object.entries(j.colors).map(([
|
|
9871
|
+
/* @__PURE__ */ a("div", { className: "nice-theme-ai__colors", children: Object.entries(j.colors).map(([D, q]) => /* @__PURE__ */ o("div", { className: "nice-theme-ai__color", children: [
|
|
9859
9872
|
/* @__PURE__ */ a("div", { className: "nice-theme-ai__color-swatch", style: { backgroundColor: q } }),
|
|
9860
|
-
/* @__PURE__ */ a("span", { className: "nice-theme-ai__color-name", children:
|
|
9873
|
+
/* @__PURE__ */ a("span", { className: "nice-theme-ai__color-name", children: D }),
|
|
9861
9874
|
/* @__PURE__ */ a("span", { className: "nice-theme-ai__color-hex", children: q })
|
|
9862
|
-
] },
|
|
9875
|
+
] }, D)) })
|
|
9863
9876
|
] }),
|
|
9864
9877
|
/* @__PURE__ */ o("div", { className: "nice-theme-ai__typography", children: [
|
|
9865
9878
|
/* @__PURE__ */ a("div", { className: "nice-theme-ai__typography-title", children: c("themeGeneratorAI.typography", "Typography") }),
|
|
@@ -10178,7 +10191,7 @@ function qr({
|
|
|
10178
10191
|
"AI not configured. Please provide config or wrap in NiceAIProvider."
|
|
10179
10192
|
) }) });
|
|
10180
10193
|
}
|
|
10181
|
-
function
|
|
10194
|
+
function Bi({ theme: r }) {
|
|
10182
10195
|
const { t: e } = ie();
|
|
10183
10196
|
return /* @__PURE__ */ o(
|
|
10184
10197
|
"div",
|
|
@@ -10293,7 +10306,7 @@ function ji({ theme: r }) {
|
|
|
10293
10306
|
}
|
|
10294
10307
|
);
|
|
10295
10308
|
}
|
|
10296
|
-
function
|
|
10309
|
+
function Fi(r = {}) {
|
|
10297
10310
|
const { config: e, targetDevice: i = "responsive", onLayoutGenerated: n, onError: t } = r, s = se(), [l, c] = M(!1), [p, m] = M(null), d = X(null), b = e || (s == null ? void 0 : s.config), S = F(
|
|
10298
10311
|
async (g, u) => {
|
|
10299
10312
|
var x, A, _;
|
|
@@ -10350,12 +10363,12 @@ Return JSON with this structure:
|
|
|
10350
10363
|
],
|
|
10351
10364
|
temperature: 0.5,
|
|
10352
10365
|
maxTokens: 2048
|
|
10353
|
-
}), k =
|
|
10366
|
+
}), k = Ji(f), N = {
|
|
10354
10367
|
layout: k || void 0,
|
|
10355
10368
|
rawResponse: (_ = (A = f.choices[0]) == null ? void 0 : A.message) == null ? void 0 : _.content,
|
|
10356
10369
|
latencyMs: performance.now() - v,
|
|
10357
10370
|
error: k ? void 0 : "Failed to generate layout",
|
|
10358
|
-
suggestions:
|
|
10371
|
+
suggestions: qi(k)
|
|
10359
10372
|
};
|
|
10360
10373
|
return k && (n == null || n(k)), m(N), N;
|
|
10361
10374
|
} catch (h) {
|
|
@@ -10436,7 +10449,7 @@ Return JSON with this structure:
|
|
|
10436
10449
|
return `import React from 'react';
|
|
10437
10450
|
import './${g.id}.css';
|
|
10438
10451
|
|
|
10439
|
-
export function ${
|
|
10452
|
+
export function ${da(g.name)}() {
|
|
10440
10453
|
return (
|
|
10441
10454
|
<div className="${g.id}">
|
|
10442
10455
|
${u}
|
|
@@ -10463,7 +10476,7 @@ ${u}
|
|
|
10463
10476
|
isConfigured: !!b
|
|
10464
10477
|
};
|
|
10465
10478
|
}
|
|
10466
|
-
function
|
|
10479
|
+
function Ji(r) {
|
|
10467
10480
|
var e, i, n;
|
|
10468
10481
|
try {
|
|
10469
10482
|
const t = ((i = (e = r.choices[0]) == null ? void 0 : e.message) == null ? void 0 : i.content) || "", l = ((n = (t.match(/```(?:json)?\s*([\s\S]*?)```/) || [null, t])[1]) == null ? void 0 : n.trim()) || t, c = JSON.parse(l);
|
|
@@ -10496,16 +10509,16 @@ function Fi(r) {
|
|
|
10496
10509
|
}
|
|
10497
10510
|
return null;
|
|
10498
10511
|
}
|
|
10499
|
-
function
|
|
10512
|
+
function qi(r) {
|
|
10500
10513
|
if (!r)
|
|
10501
10514
|
return [];
|
|
10502
10515
|
const e = [], i = new Set(r.regions.map((n) => n.type));
|
|
10503
10516
|
return i.has("header") || e.push("Consider adding a header region for navigation"), !i.has("sidebar") && r.type === "dashboard" && e.push("Add a sidebar for dashboard navigation"), r.regions.some((n) => !n.responsive) && e.push("Add responsive breakpoints for mobile compatibility"), e.slice(0, 3);
|
|
10504
10517
|
}
|
|
10505
|
-
function
|
|
10518
|
+
function da(r) {
|
|
10506
10519
|
return r.replace(/[^a-zA-Z0-9]+(.)/g, (e, i) => i.toUpperCase()).replace(/^./, (e) => e.toUpperCase());
|
|
10507
10520
|
}
|
|
10508
|
-
const
|
|
10521
|
+
const Ui = [
|
|
10509
10522
|
{ type: "dashboard", icon: "bar-chart", label: "Dashboard" },
|
|
10510
10523
|
{ type: "form", icon: "edit", label: "Form" },
|
|
10511
10524
|
{ type: "list", icon: "list", label: "List" },
|
|
@@ -10517,7 +10530,7 @@ const qi = [
|
|
|
10517
10530
|
{ type: "grid", icon: "grid", label: "Grid" },
|
|
10518
10531
|
{ type: "kanban", icon: "columns", label: "Kanban" }
|
|
10519
10532
|
];
|
|
10520
|
-
function
|
|
10533
|
+
function Gr({
|
|
10521
10534
|
config: r,
|
|
10522
10535
|
targetDevice: e = "responsive",
|
|
10523
10536
|
onGenerate: i,
|
|
@@ -10527,7 +10540,7 @@ function Ur({
|
|
|
10527
10540
|
style: l,
|
|
10528
10541
|
renderLayout: c
|
|
10529
10542
|
}) {
|
|
10530
|
-
const { t: p } = ie(), [m, d] = M(""), [b, S] = M(null), { generateLayout: I, toCSS: R, toReactComponent: O, loading: P, lastResult: g, isConfigured: u } =
|
|
10543
|
+
const { t: p } = ie(), [m, d] = M(""), [b, S] = M(null), { generateLayout: I, toCSS: R, toReactComponent: O, loading: P, lastResult: g, isConfigured: u } = Fi({
|
|
10531
10544
|
config: r,
|
|
10532
10545
|
targetDevice: e,
|
|
10533
10546
|
onLayoutGenerated: i
|
|
@@ -10542,10 +10555,10 @@ function Ur({
|
|
|
10542
10555
|
if (!(g != null && g.layout))
|
|
10543
10556
|
return;
|
|
10544
10557
|
const _ = O(g.layout), h = new Blob([_], { type: "text/javascript" }), w = URL.createObjectURL(h), f = document.createElement("a");
|
|
10545
|
-
f.href = w, f.download = `${
|
|
10558
|
+
f.href = w, f.download = `${da(g.layout.name)}.tsx`, f.click(), URL.revokeObjectURL(w);
|
|
10546
10559
|
};
|
|
10547
10560
|
return u ? /* @__PURE__ */ o("div", { className: `nice-layout-ai ${s || ""}`, style: l, children: [
|
|
10548
|
-
n && /* @__PURE__ */ a("div", { className: "nice-layout-ai__types", children:
|
|
10561
|
+
n && /* @__PURE__ */ a("div", { className: "nice-layout-ai__types", children: Ui.map(({ type: _, icon: h, label: w }) => /* @__PURE__ */ o(
|
|
10549
10562
|
"button",
|
|
10550
10563
|
{
|
|
10551
10564
|
type: "button",
|
|
@@ -10623,7 +10636,7 @@ function Ur({
|
|
|
10623
10636
|
_.id
|
|
10624
10637
|
)) })
|
|
10625
10638
|
] }),
|
|
10626
|
-
t && /* @__PURE__ */ a("div", { className: "nice-layout-ai__preview", children: c ? c(g.layout) : /* @__PURE__ */ a(
|
|
10639
|
+
t && /* @__PURE__ */ a("div", { className: "nice-layout-ai__preview", children: c ? c(g.layout) : /* @__PURE__ */ a(Gi, { layout: g.layout }) }),
|
|
10627
10640
|
/* @__PURE__ */ o("details", { className: "nice-layout-ai__json", children: [
|
|
10628
10641
|
/* @__PURE__ */ a("summary", { children: p("layoutAI.viewJsonDefinition", "View JSON Definition") }),
|
|
10629
10642
|
/* @__PURE__ */ a("pre", { children: JSON.stringify(g.layout, null, 2) })
|
|
@@ -10870,7 +10883,7 @@ function Ur({
|
|
|
10870
10883
|
"AI not configured. Please provide config or wrap in NiceAIProvider."
|
|
10871
10884
|
) }) });
|
|
10872
10885
|
}
|
|
10873
|
-
function
|
|
10886
|
+
function Gi({ layout: r }) {
|
|
10874
10887
|
const e = (i) => ({
|
|
10875
10888
|
header: "var(--nice-primary-bg, #e3f2fd)",
|
|
10876
10889
|
sidebar: "var(--nice-success-bg, #e8f5e9)",
|
|
@@ -10922,13 +10935,13 @@ function Ui({ layout: r }) {
|
|
|
10922
10935
|
}
|
|
10923
10936
|
);
|
|
10924
10937
|
}
|
|
10925
|
-
function
|
|
10938
|
+
function Wi(r = {}) {
|
|
10926
10939
|
const { config: e, wcagLevel: i = "AA", onAuditComplete: n, onError: t } = r, s = se(), [l, c] = M(!1), [p, m] = M(null), d = X(null), b = e || (s == null ? void 0 : s.config), S = F(
|
|
10927
10940
|
async (u, v) => {
|
|
10928
10941
|
var x;
|
|
10929
10942
|
if (!b) {
|
|
10930
10943
|
const A = "AI not configured";
|
|
10931
|
-
return t == null || t(A),
|
|
10944
|
+
return t == null || t(A), $e("html", i, A);
|
|
10932
10945
|
}
|
|
10933
10946
|
c(!0), (x = d.current) == null || x.abort(), d.current = new AbortController();
|
|
10934
10947
|
try {
|
|
@@ -10979,18 +10992,18 @@ ${v ? `Context: ${v}
|
|
|
10979
10992
|
],
|
|
10980
10993
|
temperature: 0.3,
|
|
10981
10994
|
maxTokens: 4096
|
|
10982
|
-
}), w =
|
|
10995
|
+
}), w = Hi(h, "html", i);
|
|
10983
10996
|
return m(w), n == null || n(w), w;
|
|
10984
10997
|
} catch (A) {
|
|
10985
10998
|
const _ = A instanceof Error ? A.message : "Audit failed";
|
|
10986
|
-
return t == null || t(_),
|
|
10999
|
+
return t == null || t(_), $e("html", i, _);
|
|
10987
11000
|
} finally {
|
|
10988
11001
|
c(!1);
|
|
10989
11002
|
}
|
|
10990
11003
|
},
|
|
10991
11004
|
[b, i, n, t]
|
|
10992
11005
|
), I = F((u, v) => {
|
|
10993
|
-
const x = be(
|
|
11006
|
+
const x = ye(be(u)), A = ye(be(v)), _ = (Math.max(x, A) + 0.05) / (Math.min(x, A) + 0.05), h = {
|
|
10994
11007
|
foreground: u,
|
|
10995
11008
|
background: v,
|
|
10996
11009
|
ratio: Math.round(_ * 100) / 100,
|
|
@@ -10999,7 +11012,7 @@ ${v ? `Context: ${v}
|
|
|
10999
11012
|
passesAAA: _ >= 7,
|
|
11000
11013
|
passesAAALarge: _ >= 4.5
|
|
11001
11014
|
};
|
|
11002
|
-
return h.passesAA || (h.suggestions =
|
|
11015
|
+
return h.passesAA || (h.suggestions = Vi(u, v, 4.5)), h;
|
|
11003
11016
|
}, []), R = F(
|
|
11004
11017
|
async (u) => {
|
|
11005
11018
|
var v, x;
|
|
@@ -11079,7 +11092,7 @@ ${u}` }
|
|
|
11079
11092
|
isConfigured: !!b
|
|
11080
11093
|
};
|
|
11081
11094
|
}
|
|
11082
|
-
function
|
|
11095
|
+
function $e(r, e, i) {
|
|
11083
11096
|
return {
|
|
11084
11097
|
timestamp: /* @__PURE__ */ new Date(),
|
|
11085
11098
|
target: r,
|
|
@@ -11102,7 +11115,7 @@ function Le(r, e, i) {
|
|
|
11102
11115
|
recommendations: []
|
|
11103
11116
|
};
|
|
11104
11117
|
}
|
|
11105
|
-
function
|
|
11118
|
+
function Hi(r, e, i) {
|
|
11106
11119
|
var n, t, s;
|
|
11107
11120
|
try {
|
|
11108
11121
|
const l = ((t = (n = r.choices[0]) == null ? void 0 : n.message) == null ? void 0 : t.content) || "", p = ((s = (l.match(/```(?:json)?\s*([\s\S]*?)```/) || [null, l])[1]) == null ? void 0 : s.trim()) || l, m = JSON.parse(p), d = (m.issues || []).map(
|
|
@@ -11133,19 +11146,19 @@ function Wi(r, e, i) {
|
|
|
11133
11146
|
target: e,
|
|
11134
11147
|
wcagLevel: i,
|
|
11135
11148
|
issues: d,
|
|
11136
|
-
score: m.score ??
|
|
11149
|
+
score: m.score ?? Ki(b),
|
|
11137
11150
|
summary: b,
|
|
11138
11151
|
recommendations: m.recommendations || []
|
|
11139
11152
|
};
|
|
11140
11153
|
} catch {
|
|
11141
|
-
return
|
|
11154
|
+
return $e(e, i, "Failed to parse audit results");
|
|
11142
11155
|
}
|
|
11143
11156
|
}
|
|
11144
|
-
function
|
|
11157
|
+
function Ki(r) {
|
|
11145
11158
|
const e = r.critical * 25 + r.serious * 15 + r.moderate * 5 + r.minor * 2;
|
|
11146
11159
|
return Math.max(0, 100 - e);
|
|
11147
11160
|
}
|
|
11148
|
-
function
|
|
11161
|
+
function be(r) {
|
|
11149
11162
|
const e = r.replace("#", "");
|
|
11150
11163
|
return e.length === 3 ? {
|
|
11151
11164
|
r: parseInt(e[0] + e[0], 16),
|
|
@@ -11157,16 +11170,16 @@ function fe(r) {
|
|
|
11157
11170
|
b: parseInt(e.slice(4, 6), 16)
|
|
11158
11171
|
};
|
|
11159
11172
|
}
|
|
11160
|
-
function
|
|
11173
|
+
function ye(r) {
|
|
11161
11174
|
const [e, i, n] = [r.r, r.g, r.b].map((t) => (t /= 255, t <= 0.03928 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4)));
|
|
11162
11175
|
return 0.2126 * e + 0.7152 * i + 0.0722 * n;
|
|
11163
11176
|
}
|
|
11164
|
-
function
|
|
11165
|
-
const n = [], t =
|
|
11177
|
+
function Vi(r, e, i) {
|
|
11178
|
+
const n = [], t = be(r), s = be(e), l = {
|
|
11166
11179
|
r: Math.max(0, t.r - 40),
|
|
11167
11180
|
g: Math.max(0, t.g - 40),
|
|
11168
11181
|
b: Math.max(0, t.b - 40)
|
|
11169
|
-
}, c = `#${l.r.toString(16).padStart(2, "0")}${l.g.toString(16).padStart(2, "0")}${l.b.toString(16).padStart(2, "0")}`, p =
|
|
11182
|
+
}, c = `#${l.r.toString(16).padStart(2, "0")}${l.g.toString(16).padStart(2, "0")}${l.b.toString(16).padStart(2, "0")}`, p = ye(l), m = ye(s);
|
|
11170
11183
|
(Math.max(p, m) + 0.05) / (Math.min(p, m) + 0.05) >= i && n.push(`Try darker foreground: ${c}`);
|
|
11171
11184
|
const b = {
|
|
11172
11185
|
r: Math.min(255, s.r + 40),
|
|
@@ -11175,7 +11188,7 @@ function Ki(r, e, i) {
|
|
|
11175
11188
|
}, S = `#${b.r.toString(16).padStart(2, "0")}${b.g.toString(16).padStart(2, "0")}${b.b.toString(16).padStart(2, "0")}`;
|
|
11176
11189
|
return n.push(`Try lighter background: ${S}`), n;
|
|
11177
11190
|
}
|
|
11178
|
-
const
|
|
11191
|
+
const we = {
|
|
11179
11192
|
critical: {
|
|
11180
11193
|
bg: "var(--nice-danger-bg, #ffebee)",
|
|
11181
11194
|
color: "var(--nice-danger-dark, #c62828)",
|
|
@@ -11197,7 +11210,7 @@ const xe = {
|
|
|
11197
11210
|
icon: "info"
|
|
11198
11211
|
}
|
|
11199
11212
|
};
|
|
11200
|
-
function
|
|
11213
|
+
function Wr({
|
|
11201
11214
|
config: r,
|
|
11202
11215
|
wcagLevel: e = "AA",
|
|
11203
11216
|
onAuditComplete: i,
|
|
@@ -11206,7 +11219,7 @@ function Gr({
|
|
|
11206
11219
|
style: s,
|
|
11207
11220
|
renderIssue: l
|
|
11208
11221
|
}) {
|
|
11209
|
-
const { t: c } = ie(), [p, m] = M(""), [d, b] = M("#333333"), [S, I] = M("#ffffff"), [R, O] = M(null), { analyzeHTML: P, checkContrast: g, suggestAccessibleCode: u, loading: v, lastAudit: x, isConfigured: A } =
|
|
11222
|
+
const { t: c } = ie(), [p, m] = M(""), [d, b] = M("#333333"), [S, I] = M("#ffffff"), [R, O] = M(null), { analyzeHTML: P, checkContrast: g, suggestAccessibleCode: u, loading: v, lastAudit: x, isConfigured: A } = Wi({
|
|
11210
11223
|
config: r,
|
|
11211
11224
|
wcagLevel: e,
|
|
11212
11225
|
onAuditComplete: i
|
|
@@ -11332,12 +11345,12 @@ function Gr({
|
|
|
11332
11345
|
{
|
|
11333
11346
|
className: "nice-a11y-ai__issue",
|
|
11334
11347
|
style: {
|
|
11335
|
-
background:
|
|
11336
|
-
borderLeftColor:
|
|
11348
|
+
background: we[f.severity].bg,
|
|
11349
|
+
borderLeftColor: we[f.severity].color
|
|
11337
11350
|
},
|
|
11338
11351
|
children: [
|
|
11339
11352
|
/* @__PURE__ */ o("div", { className: "nice-a11y-ai__issue-header", children: [
|
|
11340
|
-
/* @__PURE__ */ a("span", { className: "nice-a11y-ai__issue-icon", children: /* @__PURE__ */ a($, { name:
|
|
11353
|
+
/* @__PURE__ */ a("span", { className: "nice-a11y-ai__issue-icon", children: /* @__PURE__ */ a($, { name: we[f.severity].icon, size: 16 }) }),
|
|
11341
11354
|
/* @__PURE__ */ a("span", { className: "nice-a11y-ai__issue-title", children: f.title }),
|
|
11342
11355
|
/* @__PURE__ */ a("span", { className: "nice-a11y-ai__issue-wcag", children: c("accessibilityAI.wcag", "WCAG {wcagCriteria} ({wcagLevel})").replace("{wcagCriteria}", String(f.wcagCriteria)).replace("{wcagLevel}", String(f.wcagLevel)) })
|
|
11343
11356
|
] }),
|
|
@@ -11664,7 +11677,7 @@ function Gr({
|
|
|
11664
11677
|
"AI not configured. Please provide config or wrap in NiceAIProvider."
|
|
11665
11678
|
) }) });
|
|
11666
11679
|
}
|
|
11667
|
-
const
|
|
11680
|
+
const Pe = [
|
|
11668
11681
|
{ name: "home", category: "navigation", keywords: ["home", "house", "start", "main"] },
|
|
11669
11682
|
{ name: "menu", category: "navigation", keywords: ["menu", "hamburger", "nav", "bars"] },
|
|
11670
11683
|
{ name: "arrow-left", category: "navigation", keywords: ["back", "previous", "left", "arrow"] },
|
|
@@ -11733,20 +11746,20 @@ const $e = [
|
|
|
11733
11746
|
{ name: "link", category: "action", keywords: ["link", "url", "chain", "hyperlink"] },
|
|
11734
11747
|
{ name: "external-link", category: "action", keywords: ["external", "open", "new-window"] }
|
|
11735
11748
|
];
|
|
11736
|
-
let
|
|
11737
|
-
function
|
|
11738
|
-
if (!
|
|
11739
|
-
const r = new Map(
|
|
11740
|
-
|
|
11749
|
+
let ke = null, Xe = null;
|
|
11750
|
+
function Yi() {
|
|
11751
|
+
if (!ke) {
|
|
11752
|
+
const r = new Map(Pe.map((e) => [e.name, e]));
|
|
11753
|
+
ke = Me.map(
|
|
11741
11754
|
(e) => r.get(e) ?? { name: e, category: "content", keywords: e.split("-") }
|
|
11742
11755
|
);
|
|
11743
11756
|
}
|
|
11744
|
-
return
|
|
11757
|
+
return ke;
|
|
11745
11758
|
}
|
|
11746
|
-
function
|
|
11747
|
-
return
|
|
11759
|
+
function Xi(r) {
|
|
11760
|
+
return Xe ?? (Xe = new Set(Me)), Xe.has(r);
|
|
11748
11761
|
}
|
|
11749
|
-
function
|
|
11762
|
+
function Qi(r = {}) {
|
|
11750
11763
|
const {
|
|
11751
11764
|
config: e,
|
|
11752
11765
|
defaultLibrary: i = "nice",
|
|
@@ -11757,7 +11770,7 @@ function Xi(r = {}) {
|
|
|
11757
11770
|
} = r, c = se(), [p, m] = M(!1), [d, b] = M(null), S = X(null), I = e || (c == null ? void 0 : c.config), R = F(
|
|
11758
11771
|
(x) => {
|
|
11759
11772
|
const A = x.toLowerCase(), _ = A.split(/\s+/);
|
|
11760
|
-
return
|
|
11773
|
+
return Yi().map((h) => {
|
|
11761
11774
|
let w = 0;
|
|
11762
11775
|
return h.name === A ? w += 100 : h.name.includes(A) && (w += 50), _.forEach((f) => {
|
|
11763
11776
|
h.keywords.forEach((k) => {
|
|
@@ -11802,7 +11815,7 @@ Context:
|
|
|
11802
11815
|
role: "system",
|
|
11803
11816
|
content: `You are an icon recommendation expert. Suggest icons based on user query.
|
|
11804
11817
|
Choose ONLY from this icon set (NiceIcon names), and use the names exactly as written:
|
|
11805
|
-
${
|
|
11818
|
+
${Me.join(", ")}
|
|
11806
11819
|
|
|
11807
11820
|
Return JSON array of 5-10 icon suggestions:
|
|
11808
11821
|
[{
|
|
@@ -11827,7 +11840,7 @@ Focus on semantic meaning and common UI patterns.`
|
|
|
11827
11840
|
let W = [];
|
|
11828
11841
|
if (q)
|
|
11829
11842
|
try {
|
|
11830
|
-
W = JSON.parse(q[0]).filter((y) => typeof y.name == "string" &&
|
|
11843
|
+
W = JSON.parse(q[0]).filter((y) => typeof y.name == "string" && Xi(y.name)).map((y, J) => ({
|
|
11831
11844
|
id: y.id || `ai_icon_${J}`,
|
|
11832
11845
|
name: y.name,
|
|
11833
11846
|
displayName: y.displayName || y.name,
|
|
@@ -11840,7 +11853,7 @@ Focus on semantic meaning and common UI patterns.`
|
|
|
11840
11853
|
}));
|
|
11841
11854
|
} catch {
|
|
11842
11855
|
}
|
|
11843
|
-
const Y =
|
|
11856
|
+
const Y = Zi(h, W, t), Z = {
|
|
11844
11857
|
query: x,
|
|
11845
11858
|
suggestions: Y,
|
|
11846
11859
|
latencyMs: performance.now() - _
|
|
@@ -11860,7 +11873,7 @@ Focus on semantic meaning and common UI patterns.`
|
|
|
11860
11873
|
},
|
|
11861
11874
|
[I, i, n, t, R, s, l]
|
|
11862
11875
|
), P = F(
|
|
11863
|
-
(x) =>
|
|
11876
|
+
(x) => Pe.filter((A) => A.category === x).map((A) => ({
|
|
11864
11877
|
id: `icon_${A.name}`,
|
|
11865
11878
|
name: A.name,
|
|
11866
11879
|
displayName: A.name.replace(/-/g, " ").replace(/\b\w/g, (_) => _.toUpperCase()),
|
|
@@ -11873,7 +11886,7 @@ Focus on semantic meaning and common UI patterns.`
|
|
|
11873
11886
|
[i, n]
|
|
11874
11887
|
), g = ae(() => {
|
|
11875
11888
|
const x = /* @__PURE__ */ new Set();
|
|
11876
|
-
return
|
|
11889
|
+
return Pe.forEach((A) => x.add(A.category)), Array.from(x);
|
|
11877
11890
|
}, []), u = F(() => {
|
|
11878
11891
|
b(null);
|
|
11879
11892
|
}, []), v = F(() => {
|
|
@@ -11895,7 +11908,7 @@ Focus on semantic meaning and common UI patterns.`
|
|
|
11895
11908
|
isConfigured: !!I
|
|
11896
11909
|
};
|
|
11897
11910
|
}
|
|
11898
|
-
function
|
|
11911
|
+
function Zi(r, e, i) {
|
|
11899
11912
|
const n = /* @__PURE__ */ new Set(), t = [];
|
|
11900
11913
|
for (const s of r)
|
|
11901
11914
|
n.has(s.name) || (n.add(s.name), t.push(s));
|
|
@@ -11903,7 +11916,7 @@ function Qi(r, e, i) {
|
|
|
11903
11916
|
!n.has(s.name) && t.length < i && (n.add(s.name), t.push(s));
|
|
11904
11917
|
return t.slice(0, i);
|
|
11905
11918
|
}
|
|
11906
|
-
function
|
|
11919
|
+
function Hr({
|
|
11907
11920
|
config: r,
|
|
11908
11921
|
defaultLibrary: e = "nice",
|
|
11909
11922
|
defaultStyle: i = "outline",
|
|
@@ -11914,7 +11927,7 @@ function Wr({
|
|
|
11914
11927
|
className: c,
|
|
11915
11928
|
style: p
|
|
11916
11929
|
}) {
|
|
11917
|
-
const { t: m } = ie(), d = (N) => m(`iconSuggestor.category.${N}`, N.charAt(0).toUpperCase() + N.slice(1)), [b, S] = M(""), [I, R] = M(null), [O, P] = M(null), { suggestIcons: g, getByCategory: u, categories: v, loading: x, lastResult: A } =
|
|
11930
|
+
const { t: m } = ie(), d = (N) => m(`iconSuggestor.category.${N}`, N.charAt(0).toUpperCase() + N.slice(1)), [b, S] = M(""), [I, R] = M(null), [O, P] = M(null), { suggestIcons: g, getByCategory: u, categories: v, loading: x, lastResult: A } = Qi({
|
|
11918
11931
|
config: r,
|
|
11919
11932
|
defaultLibrary: e,
|
|
11920
11933
|
defaultStyle: i,
|
|
@@ -11976,14 +11989,14 @@ function Wr({
|
|
|
11976
11989
|
onClick: () => f(N),
|
|
11977
11990
|
title: N.displayName,
|
|
11978
11991
|
children: [
|
|
11979
|
-
/* @__PURE__ */ a(
|
|
11992
|
+
/* @__PURE__ */ a(Qe, { icon: N }),
|
|
11980
11993
|
/* @__PURE__ */ a("span", { className: "nice-icon-ai__icon-name", children: N.displayName })
|
|
11981
11994
|
]
|
|
11982
11995
|
},
|
|
11983
11996
|
N.id
|
|
11984
11997
|
)) }),
|
|
11985
11998
|
l && O && /* @__PURE__ */ o("div", { className: "nice-icon-ai__preview", children: [
|
|
11986
|
-
/* @__PURE__ */ a("div", { className: "nice-icon-ai__preview-icon", children: /* @__PURE__ */ a(
|
|
11999
|
+
/* @__PURE__ */ a("div", { className: "nice-icon-ai__preview-icon", children: /* @__PURE__ */ a(Qe, { icon: O, size: 64 }) }),
|
|
11987
12000
|
/* @__PURE__ */ o("div", { className: "nice-icon-ai__preview-info", children: [
|
|
11988
12001
|
/* @__PURE__ */ a("div", { className: "nice-icon-ai__preview-name", children: O.displayName }),
|
|
11989
12002
|
/* @__PURE__ */ o("div", { className: "nice-icon-ai__preview-details", children: [
|
|
@@ -11991,7 +12004,7 @@ function Wr({
|
|
|
11991
12004
|
"{category}",
|
|
11992
12005
|
d(O.category)
|
|
11993
12006
|
) }),
|
|
11994
|
-
/* @__PURE__ */ a("code", { className: "nice-icon-ai__preview-code", children:
|
|
12007
|
+
/* @__PURE__ */ a("code", { className: "nice-icon-ai__preview-code", children: Ze(O) })
|
|
11995
12008
|
] }),
|
|
11996
12009
|
/* @__PURE__ */ a("div", { className: "nice-icon-ai__preview-keywords", children: O.keywords.map((N) => /* @__PURE__ */ a("span", { className: "nice-icon-ai__keyword", children: N }, N)) }),
|
|
11997
12010
|
O.usage && /* @__PURE__ */ a("div", { className: "nice-icon-ai__preview-usage", children: O.usage }),
|
|
@@ -12020,7 +12033,7 @@ function Wr({
|
|
|
12020
12033
|
{
|
|
12021
12034
|
type: "button",
|
|
12022
12035
|
onClick: () => {
|
|
12023
|
-
navigator.clipboard.writeText(
|
|
12036
|
+
navigator.clipboard.writeText(Ze(O));
|
|
12024
12037
|
},
|
|
12025
12038
|
children: [
|
|
12026
12039
|
/* @__PURE__ */ a($, { name: "code", size: 14 }),
|
|
@@ -12242,113 +12255,113 @@ function Wr({
|
|
|
12242
12255
|
` })
|
|
12243
12256
|
] });
|
|
12244
12257
|
}
|
|
12245
|
-
function
|
|
12258
|
+
function Qe({ icon: r, size: e = 32 }) {
|
|
12246
12259
|
return /* @__PURE__ */ a($, { name: r.name, size: e });
|
|
12247
12260
|
}
|
|
12248
|
-
function
|
|
12261
|
+
function Ze(r) {
|
|
12249
12262
|
return `<NiceIcon name="${r.name}" />`;
|
|
12250
12263
|
}
|
|
12251
12264
|
export {
|
|
12252
|
-
|
|
12253
|
-
|
|
12254
|
-
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12265
|
+
Ge as ACCESSIBILITY_CHECKER_TEMPLATE,
|
|
12266
|
+
Va as AnthropicProvider,
|
|
12267
|
+
Ya as AzureOpenAIProvider,
|
|
12268
|
+
Te as CHART_CONFIG_TEMPLATE,
|
|
12269
|
+
Ie as CODE_COMPLETION_TEMPLATE,
|
|
12270
|
+
ei as CostTracker,
|
|
12271
|
+
Se as DATA_GRID_FILTER_TEMPLATE,
|
|
12272
|
+
Ce as DATA_GRID_SORT_TEMPLATE,
|
|
12273
|
+
Ae as FORM_BUILDER_TEMPLATE,
|
|
12274
|
+
Qa as GroqProvider,
|
|
12275
|
+
oa as InMemoryCostStorage,
|
|
12276
|
+
Za as LocalStorageCostStorage,
|
|
12277
|
+
wa as NiceAIHintBubble,
|
|
12278
|
+
tr as NiceAIProvider,
|
|
12279
|
+
Wr as NiceAccessibilityAI,
|
|
12280
|
+
Br as NiceChartAI,
|
|
12281
|
+
Fr as NiceCodeEditorAI,
|
|
12269
12282
|
Er as NiceDataGridAI,
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
|
|
12278
|
-
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
|
|
12282
|
-
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
|
|
12289
|
-
|
|
12290
|
-
|
|
12291
|
-
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12283
|
+
zr as NiceDataLabeler,
|
|
12284
|
+
jr as NiceFormBuilderAI,
|
|
12285
|
+
Hr as NiceIconSuggestorAI,
|
|
12286
|
+
Gr as NiceLayoutAI,
|
|
12287
|
+
Rr as NiceMLStudio,
|
|
12288
|
+
Lr as NiceModelInference,
|
|
12289
|
+
qr as NiceReportBuilderAI,
|
|
12290
|
+
Ur as NiceThemeGeneratorAI,
|
|
12291
|
+
Jr as NiceWorkflowDesignerAI,
|
|
12292
|
+
Xa as OllamaProvider,
|
|
12293
|
+
qe as OpenAIProvider,
|
|
12294
|
+
Oe as PROMPT_TEMPLATES,
|
|
12295
|
+
ze as REPORT_LAYOUT_TEMPLATE,
|
|
12296
|
+
fa as RateLimiter,
|
|
12297
|
+
ii as ResilientLLMClient,
|
|
12298
|
+
He as SUMMARIZE_DATA_TEMPLATE,
|
|
12299
|
+
Ue as THEME_GENERATOR_TEMPLATE,
|
|
12300
|
+
We as TRANSLATION_TEMPLATE,
|
|
12301
|
+
Re as WORKFLOW_GENERATOR_TEMPLATE,
|
|
12302
|
+
Ta as build3DSceneContext,
|
|
12303
|
+
Aa as buildAudioContext,
|
|
12304
|
+
sr as buildChartContext,
|
|
12305
|
+
Sa as buildCodeEditorContext,
|
|
12306
|
+
sa as buildColorPickerContext,
|
|
12307
|
+
nr as buildDataGridContext,
|
|
12308
|
+
na as buildDatePickerContext,
|
|
12309
|
+
La as buildDiagramLayoutContext,
|
|
12310
|
+
ka as buildFormFillContext,
|
|
12311
|
+
za as buildGameEngineContext,
|
|
12312
|
+
Ia as buildGraphicsContext,
|
|
12313
|
+
Ca as buildHtmlEditorContext,
|
|
12314
|
+
Ra as buildIconSearchContext,
|
|
12315
|
+
ra as buildNumberInputContext,
|
|
12316
|
+
$a as buildPresentationGenerateContext,
|
|
12317
|
+
ta as buildSelectContext,
|
|
12318
|
+
Pa as buildSlideDesignContext,
|
|
12319
|
+
ia as buildTextInputContext,
|
|
12320
|
+
Na as buildValidationContext,
|
|
12321
|
+
Ir as colorControlContext,
|
|
12309
12322
|
de as compileTemplate,
|
|
12310
12323
|
le as createLLMProvider,
|
|
12311
12324
|
ee as createProviderFromConfig,
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
12323
|
-
|
|
12324
|
-
|
|
12325
|
-
|
|
12326
|
-
|
|
12325
|
+
ri as createResilientClient,
|
|
12326
|
+
Dr as createResilientClientWithDefaults,
|
|
12327
|
+
Tr as dateControlContext,
|
|
12328
|
+
$r as getTemplate,
|
|
12329
|
+
Pr as getTemplatesByCategory,
|
|
12330
|
+
Mr as listTemplates,
|
|
12331
|
+
Cr as numberControlContext,
|
|
12332
|
+
ya as parseJSONResponse,
|
|
12333
|
+
ba as parseSSEStream,
|
|
12334
|
+
Ar as selectControlContext,
|
|
12335
|
+
Sr as textControlContext,
|
|
12336
|
+
br as useAI3DHint,
|
|
12337
|
+
fr as useAIAudioHint,
|
|
12338
|
+
gr as useAICodeHint,
|
|
12339
|
+
ur as useAIColorHint,
|
|
12327
12340
|
se as useAIContext,
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12341
|
+
dr as useAIDateHint,
|
|
12342
|
+
xr as useAIDiagramLayout,
|
|
12343
|
+
mr as useAIFormFill,
|
|
12344
|
+
yr as useAIGraphicsHint,
|
|
12345
|
+
hr as useAIHtmlHint,
|
|
12346
|
+
vr as useAIIconSearch,
|
|
12347
|
+
_r as useAINpcHint,
|
|
12348
|
+
cr as useAINumberHint,
|
|
12349
|
+
wr as useAIPresentationGenerate,
|
|
12350
|
+
lr as useAISelectHint,
|
|
12351
|
+
kr as useAISlideDesign,
|
|
12352
|
+
or as useAITextHint,
|
|
12353
|
+
pr as useAIValidation,
|
|
12354
|
+
Wi as useAccessibilityAI,
|
|
12355
|
+
ui as useChartAI,
|
|
12356
|
+
fi as useCodeEditorAI,
|
|
12357
|
+
Or as useCostTracker,
|
|
12358
|
+
ni as useDataGridAI,
|
|
12359
|
+
ci as useFormBuilderAI,
|
|
12360
|
+
Qi as useIconSuggestorAI,
|
|
12361
|
+
Fi as useLayoutAI,
|
|
12349
12362
|
ne as useNiceAIHint,
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
|
|
12353
|
-
|
|
12363
|
+
Ii as useReportBuilderAI,
|
|
12364
|
+
Di as useThemeGeneratorAI,
|
|
12365
|
+
ki as useWorkflowDesignerAI,
|
|
12366
|
+
Nr as withAIHint
|
|
12354
12367
|
};
|