@factorialco/f0-react 12.14.0 → 12.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ArchiveThumbnail-CgaNJ6v9.js → ArchiveThumbnail-dGuKclaw.js} +5 -5
- package/dist/{ArchiveViewer-Uohl6wf1.js → ArchiveViewer-D4fZ2Zko.js} +12 -12
- package/dist/{ChatPostComposerDialog-Cr6Ci2dz.js → ChatPostComposerDialog-ZUy4oL4n.js} +2 -2
- package/dist/{CoachmarkProvider-Cfb6WvLp.js → CoachmarkProvider-Bui0J43V.js} +19184 -19184
- package/dist/{CodeThumbnail-CFNKh12S.js → CodeThumbnail-BN74kiZ4.js} +1 -1
- package/dist/{CodeViewer-C4XxNdq4.js → CodeViewer-DAISBEVU.js} +6 -6
- package/dist/{DocumentToolbar-CcEggNyX.js → DocumentToolbar-DY0Zl0N_.js} +2 -2
- package/dist/{DocxViewer-DIiFGMl7.js → DocxViewer-CU-h8JZo.js} +1 -1
- package/dist/{F0AiProcessingOverlay-wFS85Arm.js → F0AiProcessingOverlay-1sgWr47b.js} +1103 -1024
- package/dist/{F0Alert-DRK5Na7T.js → F0Alert--45qrdm9.js} +10 -10
- package/dist/F0AudioPlayer-ZqghWPaS.js +2 -0
- package/dist/{F0CanvasPanel-CbJxX6Qv.js → F0CanvasPanel-B07KPl9L.js} +9682 -9568
- package/dist/{F0DocumentViewer-B6ccmcTZ.js → F0DocumentViewer-CPu9X2o1.js} +2 -2
- package/dist/{F0DocumentViewer-B2_6INMo.js → F0DocumentViewer-gfD2E9-m.js} +1 -1
- package/dist/{F0Map-BkrkSniz.js → F0Map-CpggFT94.js} +129 -142
- package/dist/{F0Select-BZ20yXKy.js → F0Select-DmSUsNZ8.js} +1 -1
- package/dist/F0VideoPlayer-BqAcQLm4.js +1 -0
- package/dist/{F0VideoPlayer-BkRdc58E.js → F0VideoPlayer-C1JRJ63P.js} +22 -22
- package/dist/{HtmlViewer-qkAWMkJy.js → HtmlViewer-D6_vKugG.js} +4 -4
- package/dist/{Map-CZcZoNEa.js → Map-BSvthUb7.js} +5 -5
- package/dist/{PdfThumbnail-RTw1aKm_.js → PdfThumbnail-CXumcn98.js} +1 -1
- package/dist/{PdfViewer-m56GqoJt.js → PdfViewer-Pdk37Dts.js} +8 -8
- package/dist/{SheetViewer-C80n4nta.js → SheetViewer-BvAA9h38.js} +2 -2
- package/dist/{TextViewer-BINEouL8.js → TextViewer-D9CCbblP.js} +1 -1
- package/dist/ai.d.ts +3 -3
- package/dist/ai.js +3 -3
- package/dist/component-status.js +1 -1
- package/dist/experimental.d.ts +13 -2
- package/dist/experimental.js +4463 -4459
- package/dist/{exports-BGemf1WM.d.ts → exports-4R3tYgiD.d.ts} +9 -1
- package/dist/f0.d.ts +4 -4
- package/dist/f0.js +220 -220
- package/dist/{highlight-BNASV9vz.js → highlight-cuPZlWw_.js} +5 -5
- package/dist/{index-BkCnaiJG.d.ts → index-MOV0Rv_v.d.ts} +857 -845
- package/dist/{maplibre-DTAAiC-N.js → maplibre-D0TBtDi0.js} +1 -1
- package/dist/{pdfWorker-D16_euGm.js → pdfWorker-B3PnBrSO.js} +1 -1
- package/dist/styles.css +1 -1
- package/dist/{types-C2gKTwyT.d.ts → types-BdObZULx.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/F0AudioPlayer-Ds4txTh4.js +0 -2
- package/dist/F0VideoPlayer-5bnm6ryg.js +0 -1
|
@@ -2,22 +2,22 @@ import { a as e, r as t } from "./i18n-provider-Bdgo-LeP.js";
|
|
|
2
2
|
import { n, t as r } from "./skeleton-AC0Fb8zj.js";
|
|
3
3
|
import { L as i, R as a } from "./tooltip-BX4dSfeL.js";
|
|
4
4
|
import { R as o, T as s, U as c, h as l, n as u, r as d, t as f, wt as p, y as m } from "./F0Button-d91IgOnc.js";
|
|
5
|
-
import {
|
|
6
|
-
import { o as
|
|
7
|
-
import { t as
|
|
8
|
-
import { C as
|
|
9
|
-
import {
|
|
10
|
-
import { t as
|
|
11
|
-
import { t as
|
|
12
|
-
import { a as
|
|
13
|
-
import { a as
|
|
14
|
-
import { createContext as
|
|
15
|
-
import { Fragment as
|
|
16
|
-
import { createPortal as
|
|
17
|
-
import { useTrackVolume as
|
|
5
|
+
import { $ as h, $o as g, $t as _, A as v, At as y, B as b, C as x, Ct as S, Ds as C, Fo as w, G as T, Go as E, Gt as D, H as O, Hc as ee, Io as k, K as A, Ka as j, Kt as M, Lt as N, M as P, Mc as F, Ms as te, Mt as ne, Ni as re, No as I, Nt as ie, O as L, Ot as R, Po as ae, Pt as oe, Rr as se, Rt as ce, S as le, So as ue, St as de, Tr as fe, Tt as pe, U as me, V as he, Vc as ge, Vt as _e, W as ve, Wt as ye, X as be, Xt as xe, Yo as Se, Z as Ce, Za as we, Zo as Te, Zt as Ee, _i as De, _t as Oe, a as ke, ac as z, b as Ae, bs as je, bt as Me, co as Ne, cs as Pe, es as Fe, g as Ie, gi as Le, gt as Re, h as ze, hi as Be, hs as Ve, in as He, j as Ue, ji as We, k as Ge, ki as Ke, ko as qe, kr as Je, lc as Ye, ln as Xe, m as Ze, mi as Qe, nt as $e, q as et, qa as tt, qt as nt, r as rt, rt as it, si as at, tt as B, uc as ot, ut as st, va as ct, vo as lt, vs as ut, x as dt, y as ft, yr as pt, yt as mt, zr as ht } from "./F0CanvasPanel-B07KPl9L.js";
|
|
6
|
+
import { o as gt, t as V } from "./F0Icon-DmCBV0gK.js";
|
|
7
|
+
import { t as _t } from "./i18n-provider-defaults-B9vdZZeS.js";
|
|
8
|
+
import { C as vt, H as yt, I as bt, N as xt, U as St, b as Ct, g as wt, h as Tt, k as Et, l as Dt, m as Ot } from "./useData-BYkiGUHX.js";
|
|
9
|
+
import { Cr as kt, Dr as At, En as jt, Et as Mt, Nt, Sr as Pt, Tn as Ft, Tr as It, _t as Lt, an as Rt, cn as zt, en as Bt, gt as Vt, lt as Ht, on as Ut, vt as Wt, xr as Gt } from "./F0Select-DmSUsNZ8.js";
|
|
10
|
+
import { t as Kt } from "./Ellipsis-CBouJQYY.js";
|
|
11
|
+
import { t as qt } from "./ExternalLink-RdKU698E.js";
|
|
12
|
+
import { a as Jt, gt as Yt, i as Xt, n as Zt, t as Qt } from "./popover-ics24JxK.js";
|
|
13
|
+
import { a as $t } from "./dist-Cuwaibqg.js";
|
|
14
|
+
import { createContext as en, createElement as tn, forwardRef as H, memo as nn, useCallback as U, useContext as rn, useEffect as W, useId as an, useInsertionEffect as on, useLayoutEffect as sn, useMemo as G, useRef as K, useState as q } from "react";
|
|
15
|
+
import { Fragment as cn, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
16
|
+
import { createPortal as ln } from "react-dom";
|
|
17
|
+
import { useTrackVolume as un } from "@livekit/components-react";
|
|
18
18
|
//#region ../../node_modules/.pnpm/motion@12.17.0_@emotion+is-prop-valid@1.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/motion/dist/es/framer-motion/dist/es/utils/use-motion-value-event.mjs
|
|
19
|
-
function
|
|
20
|
-
|
|
19
|
+
function dn(e, t, n) {
|
|
20
|
+
on(() => e.on(t, n), [
|
|
21
21
|
e,
|
|
22
22
|
t,
|
|
23
23
|
n
|
|
@@ -25,26 +25,26 @@ function on(e, t, n) {
|
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/elements/ai/F0ActionItem/types.ts
|
|
28
|
-
var
|
|
28
|
+
var fn = [
|
|
29
29
|
"inProgress",
|
|
30
30
|
"executing",
|
|
31
31
|
"writing",
|
|
32
32
|
"asking",
|
|
33
33
|
"completed"
|
|
34
|
-
],
|
|
34
|
+
], pn = [
|
|
35
35
|
"xs",
|
|
36
36
|
"sm",
|
|
37
37
|
"md",
|
|
38
38
|
"lg"
|
|
39
|
-
],
|
|
40
|
-
function
|
|
41
|
-
let n = e.length - e.trimStart().length, r = e.trimEnd().length, i = t.filter((t) => t.start >= n &&
|
|
42
|
-
for (let t of i) t.start < o ||
|
|
43
|
-
return a +
|
|
39
|
+
], mn = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), hn = /[\\`*_{}[\]()#+\-.!|~>]/g, gn = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(hn, "\\$&"), _n = (e) => `<entity-ref type="${mn(e.type)}" id="${mn(e.id)}">${mn(e.label)}</entity-ref>`, vn = (e, t) => e.slice(t.start, it(t)).normalize("NFC") === `@${t.label}`.normalize("NFC");
|
|
40
|
+
function yn(e, t) {
|
|
41
|
+
let n = e.length - e.trimStart().length, r = e.trimEnd().length, i = t.filter((t) => t.start >= n && vn(e, t)).sort((e, t) => e.start - t.start), a = "", o = n;
|
|
42
|
+
for (let t of i) t.start < o || it(t) > r || (a += gn(e.slice(o, t.start)) + _n(t), o = it(t));
|
|
43
|
+
return a + gn(e.slice(o, r));
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region src/addons/ai/ai/F0AiChat/hooks/useRevealOnChange.ts
|
|
47
|
-
function
|
|
47
|
+
function bn(e, t, n = .2) {
|
|
48
48
|
let r = l(), [i, a] = q(!0), o = K(e);
|
|
49
49
|
return m(() => {
|
|
50
50
|
if (o.current === e) return;
|
|
@@ -68,10 +68,10 @@ function hn(e, t, n = .2) {
|
|
|
68
68
|
}
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region src/addons/ai/ai/F0AiChatUsageLimits/components/UsageRing.tsx
|
|
71
|
-
var
|
|
72
|
-
let n =
|
|
71
|
+
var xn = 14, Sn = 2.31, Cn = ({ percentage: e, tone: t }) => {
|
|
72
|
+
let n = xn / 2, r = n - Sn / 2, a = 2 * Math.PI * r, o = (100 - (t === "unlimited" ? 100 : e)) / 100 * a;
|
|
73
73
|
return /* @__PURE__ */ Y("svg", {
|
|
74
|
-
viewBox: `0 0 ${
|
|
74
|
+
viewBox: `0 0 ${xn} ${xn}`,
|
|
75
75
|
className: "h-3.5 w-3.5 -rotate-90",
|
|
76
76
|
"aria-hidden": "true",
|
|
77
77
|
focusable: "false",
|
|
@@ -80,21 +80,21 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
80
80
|
cy: n,
|
|
81
81
|
r,
|
|
82
82
|
fill: "none",
|
|
83
|
-
strokeWidth:
|
|
83
|
+
strokeWidth: Sn,
|
|
84
84
|
className: "stroke-f1-border-secondary"
|
|
85
85
|
}), /* @__PURE__ */ J("circle", {
|
|
86
86
|
cx: n,
|
|
87
87
|
cy: n,
|
|
88
88
|
r,
|
|
89
89
|
fill: "none",
|
|
90
|
-
strokeWidth:
|
|
90
|
+
strokeWidth: Sn,
|
|
91
91
|
strokeDasharray: a,
|
|
92
92
|
strokeDashoffset: o,
|
|
93
93
|
strokeLinecap: "round",
|
|
94
94
|
className: i("transition-[stroke-dashoffset] duration-300 ease-out motion-reduce:transition-none", t === "exhausted" && "stroke-f1-background-critical-bold", t === "unlimited" && "stroke-f1-border", t === "default" && "stroke-f1-background-info-bold")
|
|
95
95
|
})]
|
|
96
96
|
});
|
|
97
|
-
},
|
|
97
|
+
}, wn = ({ label: e, description: n, percentage: r, unlimited: a = !1 }) => {
|
|
98
98
|
let o = t(), s = !a && r >= 100;
|
|
99
99
|
return /* @__PURE__ */ Y("div", {
|
|
100
100
|
className: "flex flex-col gap-3",
|
|
@@ -131,7 +131,7 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
131
131
|
}) : null
|
|
132
132
|
]
|
|
133
133
|
});
|
|
134
|
-
},
|
|
134
|
+
}, Tn = (e) => Math.min(100, Math.max(0, Math.round(e))), En = () => /* @__PURE__ */ Y("div", {
|
|
135
135
|
className: "flex flex-col gap-2",
|
|
136
136
|
"aria-busy": "true",
|
|
137
137
|
"aria-live": "polite",
|
|
@@ -139,21 +139,21 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
139
139
|
className: "flex justify-between",
|
|
140
140
|
children: [/* @__PURE__ */ J("div", { className: "h-5 w-28 animate-pulse rounded bg-f1-background-secondary" }), /* @__PURE__ */ J("div", { className: "h-5 w-16 animate-pulse rounded bg-f1-background-secondary" })]
|
|
141
141
|
}), /* @__PURE__ */ J("div", { className: "h-2 w-full animate-pulse rounded-full bg-f1-background-secondary" })]
|
|
142
|
-
}),
|
|
142
|
+
}), Dn = ({ usage: e, error: n = !1, onOpenChange: r, trigger: o, side: s = "top" }) => {
|
|
143
143
|
let c = t(), [l, u] = q(!1), d = K(null), f = U((e) => {
|
|
144
144
|
u(e), r?.(e);
|
|
145
|
-
}, [r]), p = e ?
|
|
146
|
-
return /* @__PURE__ */ Y(
|
|
145
|
+
}, [r]), p = e ? Tn(e.usedPercentage) : 0, m = e?.unlimited ?? !1, h = m ? "unlimited" : p >= 100 ? "exhausted" : "default", g = e?.sections ?? [], _ = !!e?.onSeeCompany || g.length > 0, v = c.t("ai.usageLimits.title"), y = m ? c.t("ai.usageLimits.unlimited") : c.t("ai.usageLimits.used", { percentage: p }), b = e ? `${v}: ${y}` : v;
|
|
146
|
+
return /* @__PURE__ */ Y(Qt, {
|
|
147
147
|
open: l,
|
|
148
148
|
onOpenChange: f,
|
|
149
|
-
children: [/* @__PURE__ */ J(
|
|
149
|
+
children: [/* @__PURE__ */ J(Jt, {
|
|
150
150
|
asChild: !0,
|
|
151
151
|
children: o ?? /* @__PURE__ */ Y("button", {
|
|
152
152
|
type: "button",
|
|
153
153
|
"aria-expanded": l,
|
|
154
154
|
"aria-haspopup": "dialog",
|
|
155
155
|
className: i("flex h-6 w-6 shrink-0 items-center justify-center rounded-sm bg-transparent p-0", "hover:bg-f1-background-secondary-hover", l && "bg-f1-background-secondary-hover", a()),
|
|
156
|
-
children: [/* @__PURE__ */ J(
|
|
156
|
+
children: [/* @__PURE__ */ J(Cn, {
|
|
157
157
|
percentage: p,
|
|
158
158
|
tone: h
|
|
159
159
|
}), /* @__PURE__ */ J("span", {
|
|
@@ -161,7 +161,7 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
161
161
|
children: b
|
|
162
162
|
})]
|
|
163
163
|
})
|
|
164
|
-
}), /* @__PURE__ */ Y(
|
|
164
|
+
}), /* @__PURE__ */ Y(Xt, {
|
|
165
165
|
ref: d,
|
|
166
166
|
side: s,
|
|
167
167
|
align: "end",
|
|
@@ -177,12 +177,12 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
177
177
|
children: n ? /* @__PURE__ */ J("span", {
|
|
178
178
|
className: "text-sm text-f1-foreground-secondary",
|
|
179
179
|
children: c.t("ai.usageLimits.error")
|
|
180
|
-
}) : e ? /* @__PURE__ */ J(
|
|
180
|
+
}) : e ? /* @__PURE__ */ J(wn, {
|
|
181
181
|
label: v,
|
|
182
182
|
description: e.description,
|
|
183
183
|
percentage: p,
|
|
184
184
|
unlimited: m
|
|
185
|
-
}) : /* @__PURE__ */ J(
|
|
185
|
+
}) : /* @__PURE__ */ J(En, {})
|
|
186
186
|
}), e && _ ? /* @__PURE__ */ Y("div", {
|
|
187
187
|
className: "flex flex-col border-0 border-t border-solid border-f1-border-secondary p-2",
|
|
188
188
|
children: [e.onSeeCompany ? /* @__PURE__ */ Y("button", {
|
|
@@ -192,37 +192,37 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
192
192
|
children: [/* @__PURE__ */ J("span", {
|
|
193
193
|
className: "min-w-0 flex-1 truncate",
|
|
194
194
|
children: c.t("ai.usageLimits.yourCompany")
|
|
195
|
-
}), /* @__PURE__ */ J(
|
|
196
|
-
icon:
|
|
195
|
+
}), /* @__PURE__ */ J(V, {
|
|
196
|
+
icon: Pt,
|
|
197
197
|
size: "md",
|
|
198
198
|
color: "default"
|
|
199
199
|
})]
|
|
200
200
|
}) : null, g.map((e) => /* @__PURE__ */ J("div", {
|
|
201
201
|
className: "p-2",
|
|
202
|
-
children: /* @__PURE__ */ J(
|
|
202
|
+
children: /* @__PURE__ */ J(wn, {
|
|
203
203
|
label: e.label,
|
|
204
204
|
description: e.description,
|
|
205
|
-
percentage:
|
|
205
|
+
percentage: Tn(e.usedPercentage),
|
|
206
206
|
unlimited: e.unlimited
|
|
207
207
|
})
|
|
208
208
|
}, e.id))]
|
|
209
209
|
}) : null]
|
|
210
210
|
})]
|
|
211
211
|
});
|
|
212
|
-
},
|
|
213
|
-
let { provided: t } =
|
|
214
|
-
return t ? /* @__PURE__ */ J(
|
|
215
|
-
},
|
|
216
|
-
let o = t(), s =
|
|
212
|
+
}, On = (e) => {
|
|
213
|
+
let { provided: t } = Me();
|
|
214
|
+
return t ? /* @__PURE__ */ J(kn, { ...e }) : /* @__PURE__ */ J(mt, { children: /* @__PURE__ */ J(kn, { ...e }) });
|
|
215
|
+
}, kn = ({ attachedFiles: e, isUploading: n, onRemove: r, removeLabel: i, reducedMotion: a }) => {
|
|
216
|
+
let o = t(), s = An(e), c = G(() => e.flatMap((e) => {
|
|
217
217
|
let t = s.get(e.id);
|
|
218
218
|
if (!t) return [];
|
|
219
|
-
let n = e.file.name, r = e.file.type ||
|
|
219
|
+
let n = e.file.name, r = e.file.type || ie({
|
|
220
220
|
name: n,
|
|
221
221
|
url: t
|
|
222
222
|
});
|
|
223
223
|
return [{
|
|
224
224
|
att: e,
|
|
225
|
-
attachment:
|
|
225
|
+
attachment: oe({
|
|
226
226
|
name: n,
|
|
227
227
|
url: t,
|
|
228
228
|
mimeType: r
|
|
@@ -241,10 +241,10 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
241
241
|
}];
|
|
242
242
|
}), [e, s]), l = G(() => c.map(({ att: e, attachment: t }, n) => ({
|
|
243
243
|
file: t,
|
|
244
|
-
item: e.status === "uploaded" ?
|
|
245
|
-
})), [c]), u =
|
|
244
|
+
item: e.status === "uploaded" ? S(t, pe(n, t.url)) : null
|
|
245
|
+
})), [c]), u = he(l, "composer"), d = c.map(({ att: e, attachment: t }) => ({
|
|
246
246
|
id: e.id,
|
|
247
|
-
content: /* @__PURE__ */ J(
|
|
247
|
+
content: /* @__PURE__ */ J(me, {
|
|
248
248
|
attachment: t,
|
|
249
249
|
status: e.status === "uploaded" ? "ready" : e.status === "error" ? "error" : "uploading",
|
|
250
250
|
errorMessage: e.errorMessage,
|
|
@@ -254,16 +254,16 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
254
254
|
testIdPrefix: "ai-chat"
|
|
255
255
|
})
|
|
256
256
|
}));
|
|
257
|
-
return /* @__PURE__ */ J(
|
|
257
|
+
return /* @__PURE__ */ J(O, {
|
|
258
258
|
items: d,
|
|
259
259
|
label: o.t(e.length === 1 ? "chat.attachmentCount.one" : "chat.attachmentCount.other", { count: e.length }),
|
|
260
260
|
busy: n,
|
|
261
261
|
reducedMotion: a,
|
|
262
262
|
testIdPrefix: "ai-chat"
|
|
263
263
|
});
|
|
264
|
-
},
|
|
264
|
+
}, An = (e) => {
|
|
265
265
|
let [t, n] = q(() => /* @__PURE__ */ new Map()), r = K(t);
|
|
266
|
-
return
|
|
266
|
+
return sn(() => {
|
|
267
267
|
r.current = t;
|
|
268
268
|
}, [t]), W(() => {
|
|
269
269
|
let t = r.current, i = new Set(e.map((e) => e.id)), a = e.filter((e) => !t.has(e.id)), o = [...t.keys()].filter((e) => !i.has(e));
|
|
@@ -279,14 +279,14 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
279
279
|
for (let e of r.current.values()) URL.revokeObjectURL(e);
|
|
280
280
|
r.current = /* @__PURE__ */ new Map();
|
|
281
281
|
}, []), t;
|
|
282
|
-
},
|
|
282
|
+
}, jn = (e) => e.map((e) => {
|
|
283
283
|
if (e.type === "separator") return { type: "separator" };
|
|
284
284
|
if (e.type === "submenu") {
|
|
285
285
|
let { id: t, type: n, actions: r, ...i } = e;
|
|
286
286
|
return {
|
|
287
287
|
...i,
|
|
288
288
|
type: "submenu",
|
|
289
|
-
items:
|
|
289
|
+
items: jn(r)
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
292
|
if (e.type === "toggle") {
|
|
@@ -298,19 +298,19 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
298
298
|
}
|
|
299
299
|
let { id: t, type: n, ...r } = e;
|
|
300
300
|
return r;
|
|
301
|
-
}),
|
|
301
|
+
}), Mn = ({ actions: e, showAttachEntry: n, onAttachClick: r, attachDisabled: i, attachDisabledTooltip: a, disabled: o, onOpenChange: s }) => {
|
|
302
302
|
let c = t(), [l, d] = q(!1), f = (e) => {
|
|
303
303
|
d(e), s?.(e);
|
|
304
304
|
}, p = [...n ? [{
|
|
305
305
|
label: c.ai.addFilesOrPhotos,
|
|
306
|
-
icon:
|
|
306
|
+
icon: Pe,
|
|
307
307
|
onClick: r,
|
|
308
308
|
disabled: i,
|
|
309
309
|
disabledTooltip: a
|
|
310
|
-
}, ...e.length > 0 ? [{ type: "separator" }] : []] : [], ...
|
|
310
|
+
}, ...e.length > 0 ? [{ type: "separator" }] : []] : [], ...jn(e)];
|
|
311
311
|
return /* @__PURE__ */ J("div", {
|
|
312
312
|
onClick: (e) => e.stopPropagation(),
|
|
313
|
-
children: /* @__PURE__ */ J(
|
|
313
|
+
children: /* @__PURE__ */ J(we, {
|
|
314
314
|
items: p,
|
|
315
315
|
align: "start",
|
|
316
316
|
disabled: o,
|
|
@@ -321,7 +321,7 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
321
321
|
label: c.ai.addToConversation,
|
|
322
322
|
hideLabel: !0,
|
|
323
323
|
type: "button",
|
|
324
|
-
icon:
|
|
324
|
+
icon: St,
|
|
325
325
|
variant: "outline",
|
|
326
326
|
size: "md",
|
|
327
327
|
pressed: l,
|
|
@@ -329,9 +329,9 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
329
329
|
})
|
|
330
330
|
})
|
|
331
331
|
});
|
|
332
|
-
},
|
|
332
|
+
}, Nn = ({ onUploadFiles: e, composerActions: n, isAtMaxFiles: r, maxFiles: i, acceptValue: a, fileInputRef: o, handleFileSelect: s, recordingStatus: c, onComposerActionsOpenChange: l }) => {
|
|
333
333
|
let d = t(), f = c === "transcribing", p = () => o.current?.click(), m = n?.length ? n : null;
|
|
334
|
-
return !e && !m ? null : /* @__PURE__ */ Y(
|
|
334
|
+
return !e && !m ? null : /* @__PURE__ */ Y(cn, { children: [m ? /* @__PURE__ */ J(Mn, {
|
|
335
335
|
actions: m,
|
|
336
336
|
showAttachEntry: !!e,
|
|
337
337
|
onAttachClick: p,
|
|
@@ -343,7 +343,7 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
343
343
|
label: d.ai.attachFile,
|
|
344
344
|
hideLabel: !0,
|
|
345
345
|
type: "button",
|
|
346
|
-
icon:
|
|
346
|
+
icon: Pe,
|
|
347
347
|
variant: "outline",
|
|
348
348
|
size: "md",
|
|
349
349
|
disabled: r || f,
|
|
@@ -359,16 +359,16 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
359
359
|
className: "hidden",
|
|
360
360
|
onChange: s
|
|
361
361
|
}) : null] });
|
|
362
|
-
},
|
|
362
|
+
}, Pn = { soft: {
|
|
363
363
|
text: "",
|
|
364
364
|
bg: "bg-f1-background-secondary",
|
|
365
365
|
fontColor: "text-f1-foreground-secondary",
|
|
366
366
|
formBorder: "[&_form]:border-f1-border"
|
|
367
|
-
} },
|
|
367
|
+
} }, Fn = ({ creditWarning: e, children: n }) => {
|
|
368
368
|
let r = t();
|
|
369
369
|
if (!e) return n;
|
|
370
370
|
let a = {
|
|
371
|
-
...
|
|
371
|
+
...Pn[e.level],
|
|
372
372
|
text: e.text ?? r.ai.creditWarning.soft
|
|
373
373
|
}, o = e.actionLabel ?? r.ai.creditWarning.getCredits ?? "";
|
|
374
374
|
return /* @__PURE__ */ Y("div", {
|
|
@@ -391,14 +391,14 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
391
391
|
label: r.ai.creditWarning.dismiss ?? "",
|
|
392
392
|
size: "sm",
|
|
393
393
|
variant: "ghost",
|
|
394
|
-
icon:
|
|
394
|
+
icon: ot,
|
|
395
395
|
hideLabel: !0,
|
|
396
396
|
onClick: e.onDismiss
|
|
397
397
|
}) : null]
|
|
398
398
|
})]
|
|
399
399
|
}), n]
|
|
400
400
|
});
|
|
401
|
-
},
|
|
401
|
+
}, In = ({ quote: e, onRemove: n }) => {
|
|
402
402
|
let r = t();
|
|
403
403
|
return /* @__PURE__ */ J("div", {
|
|
404
404
|
"aria-atomic": "true",
|
|
@@ -410,8 +410,8 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
410
410
|
children: [
|
|
411
411
|
/* @__PURE__ */ J("div", {
|
|
412
412
|
className: "flex items-center py-0.5",
|
|
413
|
-
children: /* @__PURE__ */ J(
|
|
414
|
-
icon:
|
|
413
|
+
children: /* @__PURE__ */ J(V, {
|
|
414
|
+
icon: Se,
|
|
415
415
|
size: "md",
|
|
416
416
|
color: "default"
|
|
417
417
|
})
|
|
@@ -426,16 +426,16 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
426
426
|
variant: "ghost",
|
|
427
427
|
label: r.ai.removeQuote,
|
|
428
428
|
onClick: n,
|
|
429
|
-
icon:
|
|
429
|
+
icon: ot,
|
|
430
430
|
hideLabel: !0,
|
|
431
431
|
size: "sm"
|
|
432
432
|
})
|
|
433
433
|
]
|
|
434
434
|
})
|
|
435
435
|
});
|
|
436
|
-
},
|
|
436
|
+
}, Ln = ({ cards: e }) => e.length === 0 ? null : /* @__PURE__ */ J("div", {
|
|
437
437
|
className: "grid w-full grid-cols-2 gap-3",
|
|
438
|
-
children: e.slice(0, 4).map((e) => /* @__PURE__ */ J(
|
|
438
|
+
children: e.slice(0, 4).map((e) => /* @__PURE__ */ J(b, {
|
|
439
439
|
avatar: {
|
|
440
440
|
type: "icon",
|
|
441
441
|
icon: e.icon
|
|
@@ -445,7 +445,7 @@ var gn = 14, _n = 2.31, vn = ({ percentage: e, tone: t }) => {
|
|
|
445
445
|
onClick: e.onClick
|
|
446
446
|
}, e.id))
|
|
447
447
|
});
|
|
448
|
-
function
|
|
448
|
+
function Rn(e = 24) {
|
|
449
449
|
let [t, n] = q(null), [r, i] = q({
|
|
450
450
|
start: !1,
|
|
451
451
|
end: !1
|
|
@@ -480,20 +480,20 @@ function Nn(e = 24) {
|
|
|
480
480
|
}
|
|
481
481
|
//#endregion
|
|
482
482
|
//#region src/addons/ai/ai/F0AiChatTextArea/components/WelcomeScreenSuggestionsRow.tsx
|
|
483
|
-
var
|
|
484
|
-
function
|
|
483
|
+
var zn = 5, Bn = 46, Vn = 400, Hn = 16, Un = 16;
|
|
484
|
+
function Wn(e, t = zn) {
|
|
485
485
|
return e.length <= t ? e : [...e].sort(() => .5 - Math.random()).slice(0, t);
|
|
486
486
|
}
|
|
487
|
-
var
|
|
488
|
-
let [s, c] = q(null), l = K(null), d = o === "scroll", f =
|
|
489
|
-
return e.length === 0 ? null : /* @__PURE__ */ Y(
|
|
487
|
+
var Gn = ({ suggestions: e, onItemClick: t, onItemHover: n, side: r = "top", reserveTwoRows: a = !0, overflow: o = "wrap" }) => {
|
|
488
|
+
let [s, c] = q(null), l = K(null), d = o === "scroll", f = Rn(), p = K(null), m = K(!1), h = an(), g = an(), _ = s === null ? null : e[s];
|
|
489
|
+
return e.length === 0 ? null : /* @__PURE__ */ Y(Qt, {
|
|
490
490
|
open: _ !== null,
|
|
491
491
|
onOpenChange: (e) => {
|
|
492
492
|
e || (c(null), n?.(null));
|
|
493
493
|
},
|
|
494
494
|
children: [/* @__PURE__ */ J("div", {
|
|
495
495
|
className: i("flex w-full items-end", a && "min-h-[72px]"),
|
|
496
|
-
children: /* @__PURE__ */ J(
|
|
496
|
+
children: /* @__PURE__ */ J(Zt, {
|
|
497
497
|
asChild: !0,
|
|
498
498
|
children: /* @__PURE__ */ J("div", {
|
|
499
499
|
ref: (e) => {
|
|
@@ -517,7 +517,7 @@ var Bn = ({ suggestions: e, onItemClick: t, onItemHover: n, side: r = "top", res
|
|
|
517
517
|
}, `${e.label}-${t}`))
|
|
518
518
|
})
|
|
519
519
|
})
|
|
520
|
-
}), _ ? /* @__PURE__ */ Y(
|
|
520
|
+
}), _ ? /* @__PURE__ */ Y(Xt, {
|
|
521
521
|
side: r,
|
|
522
522
|
align: "start",
|
|
523
523
|
sideOffset: 8,
|
|
@@ -538,14 +538,14 @@ var Bn = ({ suggestions: e, onItemClick: t, onItemHover: n, side: r = "top", res
|
|
|
538
538
|
children: [/* @__PURE__ */ Y("div", {
|
|
539
539
|
id: g,
|
|
540
540
|
className: "flex items-center gap-1.5 p-2 pb-1 text-sm font-medium text-f1-foreground-secondary",
|
|
541
|
-
children: [/* @__PURE__ */ J(
|
|
541
|
+
children: [/* @__PURE__ */ J(V, {
|
|
542
542
|
"aria-hidden": !0,
|
|
543
543
|
icon: _.icon,
|
|
544
544
|
size: "sm"
|
|
545
545
|
}), /* @__PURE__ */ J("span", { children: _.label })]
|
|
546
546
|
}), /* @__PURE__ */ J("div", {
|
|
547
547
|
className: "flex flex-col",
|
|
548
|
-
children:
|
|
548
|
+
children: Wn(_.items).map((e, r) => /* @__PURE__ */ J(Kn, {
|
|
549
549
|
item: e,
|
|
550
550
|
onHover: n,
|
|
551
551
|
onSelect: (r) => {
|
|
@@ -556,7 +556,7 @@ var Bn = ({ suggestions: e, onItemClick: t, onItemHover: n, side: r = "top", res
|
|
|
556
556
|
}) : null]
|
|
557
557
|
});
|
|
558
558
|
};
|
|
559
|
-
function
|
|
559
|
+
function Kn({ item: e, onSelect: t, onHover: n }) {
|
|
560
560
|
let r = K(null), o = K(null), s = K(null), c = l(), u = U(() => {
|
|
561
561
|
s.current != null && (clearTimeout(s.current), s.current = null);
|
|
562
562
|
let e = o.current, t = r.current;
|
|
@@ -567,11 +567,11 @@ function Vn({ item: e, onSelect: t, onHover: n }) {
|
|
|
567
567
|
if (!e || !t) return;
|
|
568
568
|
let n = e.scrollWidth - e.clientWidth;
|
|
569
569
|
if (n <= 0) return;
|
|
570
|
-
let i = n +
|
|
570
|
+
let i = n + Hn, a = i / Bn * 1e3;
|
|
571
571
|
e.style.overflow = "visible";
|
|
572
|
-
let s = `linear-gradient(90deg, transparent 0, #000 ${
|
|
572
|
+
let s = `linear-gradient(90deg, transparent 0, #000 ${Un}px)`;
|
|
573
573
|
t.style.setProperty("mask-image", s), t.style.setProperty("-webkit-mask-image", s), e.style.transition = `transform ${a}ms linear`, e.style.transform = `translateX(-${i}px)`;
|
|
574
|
-
},
|
|
574
|
+
}, Vn));
|
|
575
575
|
}, [c]), f = U(() => {
|
|
576
576
|
n?.(e), d();
|
|
577
577
|
}, [
|
|
@@ -602,8 +602,8 @@ function Vn({ item: e, onSelect: t, onHover: n }) {
|
|
|
602
602
|
}), /* @__PURE__ */ J("span", {
|
|
603
603
|
"aria-hidden": !0,
|
|
604
604
|
className: "flex flex-shrink-0 items-center text-f1-foreground-secondary opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100",
|
|
605
|
-
children: /* @__PURE__ */ J(
|
|
606
|
-
icon:
|
|
605
|
+
children: /* @__PURE__ */ J(V, {
|
|
606
|
+
icon: It,
|
|
607
607
|
size: "sm"
|
|
608
608
|
})
|
|
609
609
|
})]
|
|
@@ -611,7 +611,7 @@ function Vn({ item: e, onSelect: t, onHover: n }) {
|
|
|
611
611
|
}
|
|
612
612
|
//#endregion
|
|
613
613
|
//#region src/addons/ai/ai/F0AiChatTextArea/mentions/useMentionSources.ts
|
|
614
|
-
function
|
|
614
|
+
function qn(e, t) {
|
|
615
615
|
return {
|
|
616
616
|
type: "person",
|
|
617
617
|
label: t.label,
|
|
@@ -629,11 +629,11 @@ function Hn(e, t) {
|
|
|
629
629
|
}))
|
|
630
630
|
};
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function Jn({ searchPersons: e, mentionSources: n }) {
|
|
633
633
|
let { ai: r } = t(), i = r.mentions.people;
|
|
634
634
|
return G(() => {
|
|
635
635
|
let t = n ?? [];
|
|
636
|
-
return !e || t.some((e) => e.type === "person") ? t : [
|
|
636
|
+
return !e || t.some((e) => e.type === "person") ? t : [qn(e, { label: i }), ...t];
|
|
637
637
|
}, [
|
|
638
638
|
e,
|
|
639
639
|
n,
|
|
@@ -642,7 +642,7 @@ function Un({ searchPersons: e, mentionSources: n }) {
|
|
|
642
642
|
}
|
|
643
643
|
//#endregion
|
|
644
644
|
//#region src/addons/ai/ai/F0AiChatTextArea/file-utils.ts
|
|
645
|
-
function
|
|
645
|
+
function Yn(e, t) {
|
|
646
646
|
if (t === "*/*") return !0;
|
|
647
647
|
if (t.endsWith("/*")) {
|
|
648
648
|
let n = t.slice(0, t.indexOf("/"));
|
|
@@ -650,15 +650,15 @@ function Wn(e, t) {
|
|
|
650
650
|
}
|
|
651
651
|
return e === t;
|
|
652
652
|
}
|
|
653
|
-
function
|
|
653
|
+
function Xn(e, t) {
|
|
654
654
|
if (!t) return e;
|
|
655
655
|
let n = Array.isArray(t) ? t : [t];
|
|
656
|
-
return n.length === 0 ? e : e.filter((e) => n.some((t) =>
|
|
656
|
+
return n.length === 0 ? e : e.filter((e) => n.some((t) => Yn(e.type, t)));
|
|
657
657
|
}
|
|
658
658
|
//#endregion
|
|
659
659
|
//#region src/addons/ai/ai/F0AiChatTextArea/useFileAttachments.ts
|
|
660
|
-
var
|
|
661
|
-
function
|
|
660
|
+
var Zn = 4e3;
|
|
661
|
+
function Qn(e) {
|
|
662
662
|
let [n, r] = q([]), [i, a] = q(null), o = K(null), s = K(null), c = t(), l = e?.onUploadFiles, u = e?.allowedMimeTypes, d = e?.maxFiles, f = G(() => {
|
|
663
663
|
if (u) return Array.isArray(u) ? u.join(",") : u;
|
|
664
664
|
}, [u]), p = d !== void 0 && n.length >= d, m = K(0);
|
|
@@ -668,14 +668,14 @@ function qn(e) {
|
|
|
668
668
|
let h = U((e) => {
|
|
669
669
|
o.current && clearTimeout(o.current), a(e), o.current = setTimeout(() => {
|
|
670
670
|
a(null), o.current = null;
|
|
671
|
-
},
|
|
671
|
+
}, Zn);
|
|
672
672
|
}, []);
|
|
673
673
|
W(() => () => {
|
|
674
674
|
o.current && clearTimeout(o.current);
|
|
675
675
|
}, []);
|
|
676
676
|
let g = U(async (e) => {
|
|
677
677
|
if (e.length === 0 || !l) return;
|
|
678
|
-
let t =
|
|
678
|
+
let t = Xn(e, u);
|
|
679
679
|
if (t.length === 0) return;
|
|
680
680
|
if (d !== void 0 && m.current + t.length > d) {
|
|
681
681
|
h(c.ai.tooManyFilesError.replace("{{maxFiles}}", String(d)));
|
|
@@ -741,91 +741,91 @@ function qn(e) {
|
|
|
741
741
|
}
|
|
742
742
|
//#endregion
|
|
743
743
|
//#region src/addons/ai/ai/F0AiChatTextArea/AiChatComposer.tsx
|
|
744
|
-
var
|
|
745
|
-
let
|
|
744
|
+
var $n = ({ onSubmit: e, onStop: n, inProgress: r, onBeforeSubmit: a, placeholders: s, creditWarning: u, clarifyingUI: f, pendingContext: m = null, onPendingContextChange: h, pendingQuote: g = null, onPendingQuoteChange: v, fileAttachments: y, toolbarStart: b, composerActions: x, onComposerActionsOpenChange: S, onTranscribe: C, searchPersons: w, mentionSources: T, onProcessFilesRef: E, disclaimer: D, usageLimits: O, footer: ee, isWelcomeScreen: k = !1, fullscreen: A = !1, welcomeScreenSuggestions: j, onSuggestionClick: M, welcomeScreenSuggestionsPlacement: N = "above", welcomeScreenSuggestionsCollapsedByDefault: P = !1, welcomeScreenCards: F, padding: te = "default", name: ne, ref: re }) => {
|
|
745
|
+
let I = t(), ie = l(), L = !!ie, R = K(null), [ae, oe] = q(null), [se, ce] = q(!1), [le, ue] = q({
|
|
746
746
|
isEmpty: !0,
|
|
747
747
|
recorder: "idle"
|
|
748
748
|
}), de = K(null), fe = K(null);
|
|
749
749
|
W(() => () => {
|
|
750
750
|
fe.current && clearTimeout(fe.current);
|
|
751
751
|
}, []);
|
|
752
|
-
let
|
|
753
|
-
|
|
754
|
-
|
|
752
|
+
let pe = f != null, me = K(m), he = K(g);
|
|
753
|
+
sn(() => {
|
|
754
|
+
me.current = m, he.current = g;
|
|
755
755
|
});
|
|
756
|
-
let { tracking:
|
|
757
|
-
|
|
756
|
+
let { tracking: ge, setFocusChatInputFunction: _e } = B(), ve = U((e, t) => {
|
|
757
|
+
ge?.onWelcomeSuggestionClick?.({
|
|
758
758
|
item: e,
|
|
759
759
|
group: t,
|
|
760
760
|
prompt: e.prompt || e.title
|
|
761
|
-
}),
|
|
762
|
-
}, [
|
|
763
|
-
searchPersons:
|
|
764
|
-
mentionSources:
|
|
761
|
+
}), M?.(e, t);
|
|
762
|
+
}, [ge, M]), { attachedFiles: ye, fileInputRef: be, onUploadFiles: xe, acceptValue: Se, isAtMaxFiles: Ce, maxFiles: we, processFiles: Te, handleFileSelect: Ee, handleRemoveFile: De, transientError: Oe, showTransientError: ke } = Qn(y), z = Jn({
|
|
763
|
+
searchPersons: w,
|
|
764
|
+
mentionSources: T
|
|
765
765
|
});
|
|
766
766
|
W(() => {
|
|
767
|
-
|
|
767
|
+
P || typeof window < "u" && window.location.hash.length === 0 && R.current?.focus();
|
|
768
768
|
}, []), W(() => {
|
|
769
|
-
if (
|
|
770
|
-
else return
|
|
771
|
-
|
|
772
|
-
}), () =>
|
|
773
|
-
}, [
|
|
774
|
-
if (
|
|
775
|
-
|
|
769
|
+
if (pe) _e(null);
|
|
770
|
+
else return _e(() => {
|
|
771
|
+
R.current?.focus();
|
|
772
|
+
}), () => _e(null);
|
|
773
|
+
}, [pe, _e]), W(() => {
|
|
774
|
+
if (E) return E((e) => {
|
|
775
|
+
Te(e);
|
|
776
776
|
}), () => {
|
|
777
|
-
|
|
777
|
+
E(null);
|
|
778
778
|
};
|
|
779
|
-
}, [
|
|
780
|
-
let Ae = U((e) => void
|
|
781
|
-
if (Ne) return
|
|
779
|
+
}, [E, Te]);
|
|
780
|
+
let Ae = U((e) => void Te(e), [Te]), je = ye.filter((e) => e.status === "uploaded"), Me = ye.some((e) => e.status === "uploading"), Ne = ye.some((e) => e.status === "error"), Pe = !le.isEmpty || je.length > 0, Fe = async ({ text: t, mentions: n }) => {
|
|
781
|
+
if (Ne) return ke(I.ai.fileUploadBlockedSubmit), !1;
|
|
782
782
|
if (a && await a() === !1) return !1;
|
|
783
783
|
let r = je, i = r.flatMap((e) => e.uploadedFile ? [e.uploadedFile] : []), o = m, s = g;
|
|
784
|
-
o && h?.(null), s &&
|
|
784
|
+
o && h?.(null), s && v?.(null);
|
|
785
785
|
try {
|
|
786
786
|
await e({
|
|
787
|
-
text:
|
|
787
|
+
text: yn(t, n),
|
|
788
788
|
files: i,
|
|
789
789
|
context: o,
|
|
790
790
|
quote: s
|
|
791
791
|
});
|
|
792
792
|
} catch {
|
|
793
|
-
return o && (
|
|
793
|
+
return o && (me.current == null || me.current === o) && h?.(o), s && (he.current == null || he.current === s) && v?.(s), !1;
|
|
794
794
|
}
|
|
795
|
-
for (let e of r)
|
|
795
|
+
for (let e of r) De(e.id);
|
|
796
796
|
return !0;
|
|
797
|
-
}, Ie = ae ? ae.prompt ?? ae.title : null, Le = Ie ? [Ie] : s ?? [], Re =
|
|
798
|
-
suggestions:
|
|
799
|
-
onItemClick:
|
|
797
|
+
}, Ie = ae ? ae.prompt ?? ae.title : null, Le = Ie ? [Ie] : s ?? [], Re = N === "inside", ze = k && j && j.length > 0 && M ? /* @__PURE__ */ J(Gn, {
|
|
798
|
+
suggestions: j,
|
|
799
|
+
onItemClick: ve,
|
|
800
800
|
onItemHover: oe,
|
|
801
801
|
side: Re ? "bottom" : "top",
|
|
802
802
|
reserveTwoRows: !Re,
|
|
803
803
|
overflow: Re ? "scroll" : "wrap"
|
|
804
|
-
}) : null, Be = !
|
|
804
|
+
}) : null, Be = !P || se || Pe || le.recorder !== "idle", Ve = (e) => e instanceof Node ? de.current?.contains(e) ? !0 : e instanceof Element && e.closest("[data-radix-popper-content-wrapper]") !== null : !1, He = () => {
|
|
805
805
|
fe.current && clearTimeout(fe.current), fe.current = setTimeout(() => {
|
|
806
806
|
Ve(document.activeElement) || ce(!1);
|
|
807
807
|
}, 0);
|
|
808
|
-
}, Ue = Re, We = Ue &&
|
|
808
|
+
}, Ue = Re, We = Ue && P, Ge = We && !Be, Ke = Ue && ze ? /* @__PURE__ */ J("div", {
|
|
809
809
|
onClick: (e) => e.stopPropagation(),
|
|
810
810
|
children: ze
|
|
811
811
|
}) : void 0, qe = {
|
|
812
|
-
duration:
|
|
812
|
+
duration: L ? 0 : .32,
|
|
813
813
|
ease: [
|
|
814
814
|
.4,
|
|
815
815
|
0,
|
|
816
816
|
.2,
|
|
817
817
|
1
|
|
818
818
|
]
|
|
819
|
-
}, Je =
|
|
819
|
+
}, Je = k && A && !!F && F.length > 0, Ye = A && k, { motionProps: Xe } = bn(k, 160, .5);
|
|
820
820
|
return /* @__PURE__ */ Y(c.div, {
|
|
821
821
|
ref: re,
|
|
822
822
|
"data-composer-layout": Ye ? "welcome" : "docked",
|
|
823
823
|
className: i("flex flex-col items-center gap-2", te === "default" && "px-4 pb-3 pt-2", Ye && "min-h-0 flex-1 justify-start -mt-20"),
|
|
824
|
-
...
|
|
824
|
+
...A ? Xe : {},
|
|
825
825
|
children: [
|
|
826
826
|
/* @__PURE__ */ Y("div", {
|
|
827
827
|
className: "flex w-full max-w-content flex-col gap-2",
|
|
828
|
-
children: [ze && !Re ? /* @__PURE__ */ J("div", { children:
|
|
828
|
+
children: [ze && !Re ? /* @__PURE__ */ J("div", { children: P ? /* @__PURE__ */ J(p, {
|
|
829
829
|
initial: !1,
|
|
830
830
|
children: Be ? /* @__PURE__ */ J(c.div, {
|
|
831
831
|
className: "overflow-hidden",
|
|
@@ -844,15 +844,15 @@ var Jn = ({ onSubmit: e, onStop: n, inProgress: r, onBeforeSubmit: a, placeholde
|
|
|
844
844
|
transition: qe,
|
|
845
845
|
children: ze
|
|
846
846
|
}, "welcome-suggestions") : null
|
|
847
|
-
}) : ze }) : null, /* @__PURE__ */ J(
|
|
847
|
+
}) : ze }) : null, /* @__PURE__ */ J(Fn, {
|
|
848
848
|
creditWarning: u,
|
|
849
|
-
children: /* @__PURE__ */ J(
|
|
849
|
+
children: /* @__PURE__ */ J($e, {
|
|
850
850
|
asForm: !0,
|
|
851
851
|
surfaceRef: de,
|
|
852
|
-
handleRef:
|
|
852
|
+
handleRef: R,
|
|
853
853
|
className: "isolate z-20 items-stretch p-0 hover:cursor-text",
|
|
854
|
-
accent:
|
|
855
|
-
replacement:
|
|
854
|
+
accent: pe,
|
|
855
|
+
replacement: pe ? f : null,
|
|
856
856
|
onSurfaceFocus: () => ce(!0),
|
|
857
857
|
onSurfaceBlur: He,
|
|
858
858
|
onStateChange: ue,
|
|
@@ -861,62 +861,62 @@ var Jn = ({ onSubmit: e, onStop: n, inProgress: r, onBeforeSubmit: a, placeholde
|
|
|
861
861
|
onStop: n,
|
|
862
862
|
hasAttachments: je.length > 0,
|
|
863
863
|
sendBlocked: Me,
|
|
864
|
-
error:
|
|
864
|
+
error: Oe,
|
|
865
865
|
role: "textbox",
|
|
866
866
|
name: ne,
|
|
867
867
|
placeholders: Le,
|
|
868
868
|
placeholdersPaused: r,
|
|
869
869
|
labels: {
|
|
870
|
-
placeholder:
|
|
871
|
-
listening:
|
|
872
|
-
send:
|
|
873
|
-
stop:
|
|
874
|
-
recordAudio:
|
|
875
|
-
cancelRecording:
|
|
876
|
-
confirmRecording:
|
|
877
|
-
micPermissionDenied:
|
|
878
|
-
micError:
|
|
879
|
-
transcriptionError:
|
|
880
|
-
mentionSuggestions:
|
|
870
|
+
placeholder: I.ai.inputPlaceholder,
|
|
871
|
+
listening: I.ai.listening,
|
|
872
|
+
send: I.ai.sendMessage,
|
|
873
|
+
stop: I.ai.stopAnswerGeneration,
|
|
874
|
+
recordAudio: I.ai.recordAudio,
|
|
875
|
+
cancelRecording: I.ai.cancelRecording,
|
|
876
|
+
confirmRecording: I.ai.stopRecording,
|
|
877
|
+
micPermissionDenied: I.ai.micPermissionDenied,
|
|
878
|
+
micError: I.ai.micError,
|
|
879
|
+
transcriptionError: I.ai.transcriptionError,
|
|
880
|
+
mentionSuggestions: I.ai.mentions.suggestions
|
|
881
881
|
},
|
|
882
882
|
mentions: {
|
|
883
|
-
sources:
|
|
884
|
-
showGroupLabels:
|
|
883
|
+
sources: z,
|
|
884
|
+
showGroupLabels: z.length > 1
|
|
885
885
|
},
|
|
886
|
-
voice:
|
|
887
|
-
onTranscribe:
|
|
888
|
-
onPress:
|
|
889
|
-
onCancelled:
|
|
886
|
+
voice: C ? {
|
|
887
|
+
onTranscribe: C,
|
|
888
|
+
onPress: ge?.onDictationStart,
|
|
889
|
+
onCancelled: ge?.onDictationCancel
|
|
890
890
|
} : void 0,
|
|
891
891
|
onPasteFiles: y?.onUploadFiles ? Ae : void 0,
|
|
892
892
|
pastePreferText: !0,
|
|
893
|
-
header: g ? /* @__PURE__ */ J(
|
|
893
|
+
header: g ? /* @__PURE__ */ J(In, {
|
|
894
894
|
quote: g,
|
|
895
|
-
onRemove: () =>
|
|
895
|
+
onRemove: () => v?.(null)
|
|
896
896
|
}) : null,
|
|
897
|
-
tray: /* @__PURE__ */ J(
|
|
898
|
-
attachedFiles:
|
|
897
|
+
tray: /* @__PURE__ */ J(On, {
|
|
898
|
+
attachedFiles: ye,
|
|
899
899
|
isUploading: Me,
|
|
900
|
-
onRemove:
|
|
901
|
-
removeLabel:
|
|
902
|
-
reducedMotion:
|
|
900
|
+
onRemove: De,
|
|
901
|
+
removeLabel: I.ai.removeFile,
|
|
902
|
+
reducedMotion: L
|
|
903
903
|
}),
|
|
904
904
|
leading: Ue ? /* @__PURE__ */ J("div", {
|
|
905
905
|
className: "flex shrink-0 self-center pl-3",
|
|
906
|
-
children: /* @__PURE__ */ J(
|
|
906
|
+
children: /* @__PURE__ */ J(_, {
|
|
907
907
|
size: "sm",
|
|
908
908
|
spin: r
|
|
909
909
|
})
|
|
910
910
|
}) : void 0,
|
|
911
|
-
toolbarStart:
|
|
912
|
-
onUploadFiles:
|
|
911
|
+
toolbarStart: xe || b || x?.length ? (e) => /* @__PURE__ */ Y(cn, { children: [/* @__PURE__ */ J(Nn, {
|
|
912
|
+
onUploadFiles: xe,
|
|
913
913
|
composerActions: x,
|
|
914
|
-
onComposerActionsOpenChange:
|
|
915
|
-
isAtMaxFiles:
|
|
916
|
-
maxFiles:
|
|
917
|
-
acceptValue:
|
|
918
|
-
fileInputRef:
|
|
919
|
-
handleFileSelect:
|
|
914
|
+
onComposerActionsOpenChange: S,
|
|
915
|
+
isAtMaxFiles: Ce,
|
|
916
|
+
maxFiles: we,
|
|
917
|
+
acceptValue: Se,
|
|
918
|
+
fileInputRef: be,
|
|
919
|
+
handleFileSelect: Ee,
|
|
920
920
|
recordingStatus: e
|
|
921
921
|
}), b ? /* @__PURE__ */ J("div", {
|
|
922
922
|
className: "min-w-0 cursor-default",
|
|
@@ -926,22 +926,22 @@ var Jn = ({ onSubmit: e, onStop: n, inProgress: r, onBeforeSubmit: a, placeholde
|
|
|
926
926
|
toolbarCenter: Ke,
|
|
927
927
|
collapsible: We,
|
|
928
928
|
collapsed: Ge,
|
|
929
|
-
reducedMotion:
|
|
929
|
+
reducedMotion: L
|
|
930
930
|
})
|
|
931
931
|
})]
|
|
932
932
|
}),
|
|
933
933
|
Je ? /* @__PURE__ */ J("div", {
|
|
934
934
|
className: "w-full max-w-content pt-2",
|
|
935
|
-
children: /* @__PURE__ */ J(
|
|
935
|
+
children: /* @__PURE__ */ J(Ln, { cards: F })
|
|
936
936
|
}) : null,
|
|
937
|
-
ee &&
|
|
937
|
+
ee && k && A ? /* @__PURE__ */ J("div", {
|
|
938
938
|
className: "w-full py-4 mx-auto flex max-w-content justify-center",
|
|
939
939
|
children: ee
|
|
940
940
|
}) : null,
|
|
941
941
|
/* @__PURE__ */ J(p, {
|
|
942
942
|
mode: "wait",
|
|
943
943
|
initial: !1,
|
|
944
|
-
children:
|
|
944
|
+
children: pe ? /* @__PURE__ */ Y(c.div, {
|
|
945
945
|
className: "flex w-full max-w-content flex-row flex-wrap items-center justify-center gap-x-3 gap-y-1 text-sm font-medium text-f1-foreground-tertiary",
|
|
946
946
|
initial: { opacity: 0 },
|
|
947
947
|
animate: { opacity: 1 },
|
|
@@ -957,7 +957,7 @@ var Jn = ({ onSubmit: e, onStop: n, inProgress: r, onBeforeSubmit: a, placeholde
|
|
|
957
957
|
children: "↑↓"
|
|
958
958
|
}),
|
|
959
959
|
" ",
|
|
960
|
-
|
|
960
|
+
I.ai.clarifyingQuestion.navHint.navigate
|
|
961
961
|
] }),
|
|
962
962
|
/* @__PURE__ */ Y("span", { children: [
|
|
963
963
|
/* @__PURE__ */ J("kbd", {
|
|
@@ -965,7 +965,7 @@ var Jn = ({ onSubmit: e, onStop: n, inProgress: r, onBeforeSubmit: a, placeholde
|
|
|
965
965
|
children: "Enter"
|
|
966
966
|
}),
|
|
967
967
|
" ",
|
|
968
|
-
|
|
968
|
+
I.ai.clarifyingQuestion.navHint.select
|
|
969
969
|
] }),
|
|
970
970
|
/* @__PURE__ */ Y("span", { children: [
|
|
971
971
|
/* @__PURE__ */ J("kbd", {
|
|
@@ -973,74 +973,74 @@ var Jn = ({ onSubmit: e, onStop: n, inProgress: r, onBeforeSubmit: a, placeholde
|
|
|
973
973
|
children: "Esc"
|
|
974
974
|
}),
|
|
975
975
|
" ",
|
|
976
|
-
|
|
976
|
+
I.ai.clarifyingQuestion.navHint.cancel
|
|
977
977
|
] })
|
|
978
978
|
]
|
|
979
|
-
}, "clarifying-nav-hint") : (
|
|
980
|
-
className: i("flex w-full max-w-content flex-row items-center gap-1",
|
|
979
|
+
}, "clarifying-nav-hint") : (D?.text || O) && !Ye && /* @__PURE__ */ Y(c.div, {
|
|
980
|
+
className: i("flex w-full max-w-content flex-row items-center gap-1", O ? "justify-between" : "justify-center"),
|
|
981
981
|
initial: { opacity: 0 },
|
|
982
982
|
animate: { opacity: 1 },
|
|
983
983
|
exit: { opacity: 0 },
|
|
984
984
|
transition: {
|
|
985
|
-
duration:
|
|
985
|
+
duration: ie ? 0 : .3,
|
|
986
986
|
ease: "easeOut"
|
|
987
987
|
},
|
|
988
988
|
children: [/* @__PURE__ */ Y("div", {
|
|
989
989
|
className: "flex min-w-0 flex-row items-center gap-1",
|
|
990
|
-
children: [
|
|
990
|
+
children: [D?.text && D.onClick ? /* @__PURE__ */ J("button", {
|
|
991
991
|
type: "button",
|
|
992
|
-
onClick:
|
|
992
|
+
onClick: D.onClick,
|
|
993
993
|
className: i("group min-w-0 cursor-pointer bg-transparent p-0 text-inherit", "transition-transform duration-700 ease-out", "hover:scale-[1.02] focus-visible:scale-[1.02]", "motion-reduce:transition-none motion-reduce:hover:scale-100 motion-reduce:focus-visible:scale-100"),
|
|
994
994
|
children: /* @__PURE__ */ J(d, {
|
|
995
995
|
className: i("text-sm font-medium text-f1-foreground-tertiary transition-colors duration-700 ease-out", "group-hover:bg-gradient-to-r group-hover:from-[#E55619] group-hover:to-[#A1ADE5] group-hover:bg-clip-text group-hover:text-transparent", "group-focus-visible:bg-gradient-to-r group-focus-visible:from-[#E55619] group-focus-visible:to-[#A1ADE5] group-focus-visible:bg-clip-text group-focus-visible:text-transparent"),
|
|
996
|
-
children:
|
|
996
|
+
children: D.text
|
|
997
997
|
})
|
|
998
|
-
}) :
|
|
998
|
+
}) : D?.text ? /* @__PURE__ */ J(d, {
|
|
999
999
|
className: "text-sm font-medium text-f1-foreground-tertiary",
|
|
1000
|
-
children:
|
|
1001
|
-
}) : null,
|
|
1002
|
-
href:
|
|
1000
|
+
children: D.text
|
|
1001
|
+
}) : null, D?.link && D.linkText ? /* @__PURE__ */ J(o, {
|
|
1002
|
+
href: D.link,
|
|
1003
1003
|
target: "_blank",
|
|
1004
1004
|
rel: "noopener noreferrer",
|
|
1005
1005
|
className: "flex-shrink-0 text-sm font-medium text-f1-foreground-tertiary",
|
|
1006
|
-
children:
|
|
1006
|
+
children: D.linkText
|
|
1007
1007
|
}) : null]
|
|
1008
|
-
}),
|
|
1008
|
+
}), O ? /* @__PURE__ */ J("div", {
|
|
1009
1009
|
className: "flex shrink-0 items-center",
|
|
1010
|
-
children: /* @__PURE__ */ J(
|
|
1010
|
+
children: /* @__PURE__ */ J(Dn, { ...O })
|
|
1011
1011
|
}) : null]
|
|
1012
1012
|
}, "chat-disclaimer")
|
|
1013
1013
|
})
|
|
1014
1014
|
]
|
|
1015
1015
|
});
|
|
1016
|
-
},
|
|
1016
|
+
}, er = (e) => /* @__PURE__ */ J($n, {
|
|
1017
1017
|
...e,
|
|
1018
1018
|
name: "one-ai-input"
|
|
1019
1019
|
});
|
|
1020
1020
|
//#endregion
|
|
1021
1021
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/components/Block.tsx
|
|
1022
|
-
function
|
|
1022
|
+
function tr({ children: e, ...t }) {
|
|
1023
1023
|
return /* @__PURE__ */ J("pre", {
|
|
1024
1024
|
...t,
|
|
1025
1025
|
className: i("relative mx-0 overflow-x-auto whitespace-pre-wrap rounded-md bg-f1-background-secondary p-2", t.className),
|
|
1026
1026
|
children: e
|
|
1027
1027
|
});
|
|
1028
1028
|
}
|
|
1029
|
-
function
|
|
1029
|
+
function nr({ children: e, ...t }) {
|
|
1030
1030
|
return /* @__PURE__ */ J("code", {
|
|
1031
1031
|
...t,
|
|
1032
1032
|
className: i("rounded bg-f1-background-secondary px-1 py-0.5 font-mono text-base text-f1-foreground", "[pre_&]:rounded-none [pre_&]:bg-transparent [pre_&]:p-0 [pre_&]:text-base", t.className),
|
|
1033
1033
|
children: e
|
|
1034
1034
|
});
|
|
1035
1035
|
}
|
|
1036
|
-
function
|
|
1036
|
+
function rr({ children: e, ...t }) {
|
|
1037
1037
|
return /* @__PURE__ */ J("blockquote", {
|
|
1038
1038
|
...t,
|
|
1039
1039
|
className: i("mr-1 my-2 mb-2.5 border-0 border-l-4 border-solid border-f1-border pl-3 text-base", t.className),
|
|
1040
1040
|
children: e
|
|
1041
1041
|
});
|
|
1042
1042
|
}
|
|
1043
|
-
function
|
|
1043
|
+
function ir({ ...e }) {
|
|
1044
1044
|
return /* @__PURE__ */ J("hr", {
|
|
1045
1045
|
...e,
|
|
1046
1046
|
className: i("my-3 border-0 border-t border-f1-border", e.className)
|
|
@@ -1048,13 +1048,13 @@ function $n({ ...e }) {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
//#endregion
|
|
1050
1050
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/components/Image.tsx
|
|
1051
|
-
function
|
|
1052
|
-
let o = t(), s =
|
|
1051
|
+
function ar({ src: e, alt: n, ...r }) {
|
|
1052
|
+
let o = t(), s = ye(), c = D(), l = nt(e || void 0), [u, d] = q(!1), [p, m] = q(!1), h = n || (e ? R(e) : "") || "image";
|
|
1053
1053
|
if (!e || u || l.status === "error") return n ? /* @__PURE__ */ J("span", {
|
|
1054
1054
|
className: "text-f1-foreground-secondary",
|
|
1055
1055
|
children: n
|
|
1056
1056
|
}) : null;
|
|
1057
|
-
let g = l.status === "ready" ? /* @__PURE__ */ J(
|
|
1057
|
+
let g = l.status === "ready" ? /* @__PURE__ */ J(_e, {
|
|
1058
1058
|
...r,
|
|
1059
1059
|
src: l.url,
|
|
1060
1060
|
alt: n,
|
|
@@ -1082,7 +1082,7 @@ function er({ src: e, alt: n, ...r }) {
|
|
|
1082
1082
|
variant: "neutral",
|
|
1083
1083
|
label: o.chat.download,
|
|
1084
1084
|
hideLabel: !0,
|
|
1085
|
-
icon:
|
|
1085
|
+
icon: z,
|
|
1086
1086
|
onClick: () => c(e, h)
|
|
1087
1087
|
})
|
|
1088
1088
|
})]
|
|
@@ -1090,8 +1090,8 @@ function er({ src: e, alt: n, ...r }) {
|
|
|
1090
1090
|
}
|
|
1091
1091
|
//#endregion
|
|
1092
1092
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/components/Link.tsx
|
|
1093
|
-
function
|
|
1094
|
-
return /* @__PURE__ */ J(
|
|
1093
|
+
function or({ children: e, ...t }) {
|
|
1094
|
+
return /* @__PURE__ */ J(De, {
|
|
1095
1095
|
...t,
|
|
1096
1096
|
variant: "link",
|
|
1097
1097
|
href: t.href,
|
|
@@ -1100,21 +1100,21 @@ function tr({ children: e, ...t }) {
|
|
|
1100
1100
|
}
|
|
1101
1101
|
//#endregion
|
|
1102
1102
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/components/Lists.tsx
|
|
1103
|
-
function
|
|
1103
|
+
function sr({ children: e, ...t }) {
|
|
1104
1104
|
return /* @__PURE__ */ J("ul", {
|
|
1105
1105
|
...t,
|
|
1106
1106
|
className: i("list-disc pl-5 [&>li>ol]:mt-2 [&>li>ul]:mt-2", t.className),
|
|
1107
1107
|
children: e
|
|
1108
1108
|
});
|
|
1109
1109
|
}
|
|
1110
|
-
function
|
|
1110
|
+
function cr({ children: e, ...t }) {
|
|
1111
1111
|
return /* @__PURE__ */ J("ol", {
|
|
1112
1112
|
...t,
|
|
1113
1113
|
className: i("list-decimal pl-5 [&>li>ol]:mt-2 [&>li>ul]:mt-2", t.className),
|
|
1114
1114
|
children: e
|
|
1115
1115
|
});
|
|
1116
1116
|
}
|
|
1117
|
-
function
|
|
1117
|
+
function lr({ children: e, ...t }) {
|
|
1118
1118
|
return /* @__PURE__ */ J("li", {
|
|
1119
1119
|
...t,
|
|
1120
1120
|
className: i("mb-2", t.className),
|
|
@@ -1123,7 +1123,7 @@ function ir({ children: e, ...t }) {
|
|
|
1123
1123
|
}
|
|
1124
1124
|
//#endregion
|
|
1125
1125
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/entityRef/components/EntityRefHoverCard.tsx
|
|
1126
|
-
function
|
|
1126
|
+
function ur({ id: e, trigger: t, resolver: n, contentClassName: r = "w-64", ...a }) {
|
|
1127
1127
|
let o = K(/* @__PURE__ */ new Map()), [s, c] = q(() => o.current.get(e) ?? null), [l, u] = q(!1), [d, f] = q(!1), p = K(!0);
|
|
1128
1128
|
W(() => () => {
|
|
1129
1129
|
p.current = !1;
|
|
@@ -1144,36 +1144,36 @@ function ar({ id: e, trigger: t, resolver: n, contentClassName: r = "w-64", ...a
|
|
|
1144
1144
|
s,
|
|
1145
1145
|
l
|
|
1146
1146
|
]), h = d ? null : s;
|
|
1147
|
-
return /* @__PURE__ */ Y(
|
|
1147
|
+
return /* @__PURE__ */ Y(Vt, {
|
|
1148
1148
|
openDelay: 300,
|
|
1149
1149
|
closeDelay: 100,
|
|
1150
1150
|
onOpenChange: (e) => {
|
|
1151
1151
|
e && m();
|
|
1152
1152
|
},
|
|
1153
|
-
children: [/* @__PURE__ */ J(
|
|
1153
|
+
children: [/* @__PURE__ */ J(Wt, {
|
|
1154
1154
|
asChild: !0,
|
|
1155
1155
|
children: t
|
|
1156
|
-
}), /* @__PURE__ */ J(
|
|
1156
|
+
}), /* @__PURE__ */ J(Lt, {
|
|
1157
1157
|
side: "top",
|
|
1158
1158
|
align: "start",
|
|
1159
1159
|
className: i(r, "rounded-2xl border-none p-0 shadow-md"),
|
|
1160
|
-
children: l ? /* @__PURE__ */ J(
|
|
1160
|
+
children: l ? /* @__PURE__ */ J(at.Skeleton, {}) : a.renderCard ? a.renderCard(h) : /* @__PURE__ */ J(at, { ...h ? a.mapToCard(h) : a.fallbackCard })
|
|
1161
1161
|
})]
|
|
1162
1162
|
});
|
|
1163
1163
|
}
|
|
1164
1164
|
//#endregion
|
|
1165
1165
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/entityRef/components/MentionTrigger.tsx
|
|
1166
|
-
var
|
|
1166
|
+
var dr = H(({ label: e, ...t }, n) => /* @__PURE__ */ Y("button", {
|
|
1167
1167
|
ref: n,
|
|
1168
1168
|
type: "button",
|
|
1169
1169
|
className: i("cursor-pointer font-medium text-f1-foreground-secondary hover:text-f1-foreground", a()),
|
|
1170
1170
|
...t,
|
|
1171
1171
|
children: ["@", e]
|
|
1172
1172
|
}));
|
|
1173
|
-
|
|
1173
|
+
dr.displayName = "MentionTrigger";
|
|
1174
1174
|
//#endregion
|
|
1175
1175
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/entityRef/entities/custom/CustomEntityRef.tsx
|
|
1176
|
-
function
|
|
1176
|
+
function fr({ id: e, label: n, config: r }) {
|
|
1177
1177
|
let i = t(), { resolve: a, avatar: o, url: s } = r, c = s?.(e), l = U((e) => ({
|
|
1178
1178
|
...e,
|
|
1179
1179
|
avatar: e.avatar ?? o,
|
|
@@ -1186,9 +1186,9 @@ function sr({ id: e, label: n, config: r }) {
|
|
|
1186
1186
|
c,
|
|
1187
1187
|
i
|
|
1188
1188
|
]), u = G(() => l({ title: n }), [l, n]), d = U((e) => a ? a(e) : Promise.resolve({ title: n }), [a, n]);
|
|
1189
|
-
return /* @__PURE__ */ J(
|
|
1189
|
+
return /* @__PURE__ */ J(ur, {
|
|
1190
1190
|
id: e,
|
|
1191
|
-
trigger: /* @__PURE__ */ J(
|
|
1191
|
+
trigger: /* @__PURE__ */ J(dr, { label: n }),
|
|
1192
1192
|
resolver: d,
|
|
1193
1193
|
mapToCard: l,
|
|
1194
1194
|
fallbackCard: u
|
|
@@ -1196,15 +1196,15 @@ function sr({ id: e, label: n, config: r }) {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
//#endregion
|
|
1198
1198
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/entityRef/entities/candidate/CandidateEntityRef.tsx
|
|
1199
|
-
var
|
|
1199
|
+
var pr = H(({ label: e, ...t }, n) => /* @__PURE__ */ J("button", {
|
|
1200
1200
|
ref: n,
|
|
1201
1201
|
type: "button",
|
|
1202
1202
|
className: i("cursor-pointer font-medium text-f1-foreground-secondary hover:text-f1-foreground", a()),
|
|
1203
1203
|
...t,
|
|
1204
1204
|
children: e
|
|
1205
1205
|
}));
|
|
1206
|
-
|
|
1207
|
-
function
|
|
1206
|
+
pr.displayName = "CandidateTrigger";
|
|
1207
|
+
function mr({ id: e, label: n }) {
|
|
1208
1208
|
let { entityRefs: r } = B(), i = r?.resolvers?.candidate, a = t(), o = r?.urls?.candidate?.(e), s = G(() => (e) => {
|
|
1209
1209
|
let t = [];
|
|
1210
1210
|
return e.source && t.push({
|
|
@@ -1250,9 +1250,9 @@ function lr({ id: e, label: n }) {
|
|
|
1250
1250
|
a,
|
|
1251
1251
|
o
|
|
1252
1252
|
]);
|
|
1253
|
-
return i ? /* @__PURE__ */ J(
|
|
1253
|
+
return i ? /* @__PURE__ */ J(ur, {
|
|
1254
1254
|
id: e,
|
|
1255
|
-
trigger: /* @__PURE__ */ J(
|
|
1255
|
+
trigger: /* @__PURE__ */ J(pr, { label: n }),
|
|
1256
1256
|
resolver: i,
|
|
1257
1257
|
mapToCard: s,
|
|
1258
1258
|
fallbackCard: c
|
|
@@ -1260,19 +1260,19 @@ function lr({ id: e, label: n }) {
|
|
|
1260
1260
|
}
|
|
1261
1261
|
//#endregion
|
|
1262
1262
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/entityRef/entities/expense/ExpenseEntityRef.tsx
|
|
1263
|
-
var
|
|
1263
|
+
var hr = H(({ label: e, ...t }, n) => /* @__PURE__ */ J("button", {
|
|
1264
1264
|
ref: n,
|
|
1265
1265
|
type: "button",
|
|
1266
1266
|
className: i("cursor-pointer font-medium text-f1-foreground-secondary hover:text-f1-foreground", a()),
|
|
1267
1267
|
...t,
|
|
1268
1268
|
children: e
|
|
1269
1269
|
}));
|
|
1270
|
-
|
|
1271
|
-
function
|
|
1270
|
+
hr.displayName = "ExpenseTrigger";
|
|
1271
|
+
function gr({ id: e, label: n }) {
|
|
1272
1272
|
let { entityRefs: r } = B(), i = r?.resolvers?.expense, a = t(), o = r?.urls?.expense?.(e), s = G(() => (e) => ({
|
|
1273
1273
|
avatar: {
|
|
1274
1274
|
type: "icon",
|
|
1275
|
-
icon:
|
|
1275
|
+
icon: ut
|
|
1276
1276
|
},
|
|
1277
1277
|
title: e.description || `Expense #${e.id}`,
|
|
1278
1278
|
description: [e.amount, e.status].filter(Boolean).join(" · "),
|
|
@@ -1291,9 +1291,9 @@ function dr({ id: e, label: n }) {
|
|
|
1291
1291
|
a,
|
|
1292
1292
|
o
|
|
1293
1293
|
]);
|
|
1294
|
-
return i ? /* @__PURE__ */ J(
|
|
1294
|
+
return i ? /* @__PURE__ */ J(ur, {
|
|
1295
1295
|
id: e,
|
|
1296
|
-
trigger: /* @__PURE__ */ J(
|
|
1296
|
+
trigger: /* @__PURE__ */ J(hr, { label: n }),
|
|
1297
1297
|
resolver: i,
|
|
1298
1298
|
mapToCard: s,
|
|
1299
1299
|
fallbackCard: c
|
|
@@ -1301,15 +1301,15 @@ function dr({ id: e, label: n }) {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
//#endregion
|
|
1303
1303
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/entityRef/entities/jobPosting/JobPostingEntityRef.tsx
|
|
1304
|
-
var
|
|
1304
|
+
var _r = H(({ label: e, ...t }, n) => /* @__PURE__ */ J("button", {
|
|
1305
1305
|
ref: n,
|
|
1306
1306
|
type: "button",
|
|
1307
1307
|
className: i("cursor-pointer font-medium text-f1-foreground-secondary hover:text-f1-foreground", a()),
|
|
1308
1308
|
...t,
|
|
1309
1309
|
children: e
|
|
1310
1310
|
}));
|
|
1311
|
-
|
|
1312
|
-
function
|
|
1311
|
+
_r.displayName = "JobPostingTrigger";
|
|
1312
|
+
function vr({ id: e, label: n }) {
|
|
1313
1313
|
let { entityRefs: r } = B(), i = r?.resolvers?.jobPosting, a = t(), o = r?.urls?.jobPosting?.(e), s = G(() => (e) => ({
|
|
1314
1314
|
title: e.title,
|
|
1315
1315
|
description: [e.status, e.location].filter(Boolean).join(" · "),
|
|
@@ -1328,9 +1328,9 @@ function pr({ id: e, label: n }) {
|
|
|
1328
1328
|
a,
|
|
1329
1329
|
o
|
|
1330
1330
|
]);
|
|
1331
|
-
return i ? /* @__PURE__ */ J(
|
|
1331
|
+
return i ? /* @__PURE__ */ J(ur, {
|
|
1332
1332
|
id: e,
|
|
1333
|
-
trigger: /* @__PURE__ */ J(
|
|
1333
|
+
trigger: /* @__PURE__ */ J(_r, { label: n }),
|
|
1334
1334
|
resolver: i,
|
|
1335
1335
|
mapToCard: s,
|
|
1336
1336
|
fallbackCard: c
|
|
@@ -1338,14 +1338,14 @@ function pr({ id: e, label: n }) {
|
|
|
1338
1338
|
}
|
|
1339
1339
|
//#endregion
|
|
1340
1340
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/entityRef/entities/person/PersonEntityRef.tsx
|
|
1341
|
-
function
|
|
1341
|
+
function yr({ id: e, label: t }) {
|
|
1342
1342
|
let { entityRefs: n } = B(), r = n?.resolvers?.person, i = n?.urls?.person?.(e);
|
|
1343
|
-
return r ? /* @__PURE__ */ J(
|
|
1343
|
+
return r ? /* @__PURE__ */ J(ur, {
|
|
1344
1344
|
id: e,
|
|
1345
|
-
trigger: /* @__PURE__ */ J(
|
|
1345
|
+
trigger: /* @__PURE__ */ J(dr, { label: t }),
|
|
1346
1346
|
resolver: r,
|
|
1347
1347
|
contentClassName: "w-72",
|
|
1348
|
-
renderCard: (e) => e ? /* @__PURE__ */ J(
|
|
1348
|
+
renderCard: (e) => e ? /* @__PURE__ */ J(L, {
|
|
1349
1349
|
name: `${e.firstName} ${e.lastName}`,
|
|
1350
1350
|
avatar: {
|
|
1351
1351
|
type: "person",
|
|
@@ -1357,7 +1357,7 @@ function mr({ id: e, label: t }) {
|
|
|
1357
1357
|
profileHref: i,
|
|
1358
1358
|
onProfileClick: e.onProfileClick,
|
|
1359
1359
|
actions: e.actions
|
|
1360
|
-
}) : /* @__PURE__ */ J(
|
|
1360
|
+
}) : /* @__PURE__ */ J(L, {
|
|
1361
1361
|
name: t,
|
|
1362
1362
|
profileHref: i
|
|
1363
1363
|
})
|
|
@@ -1365,7 +1365,7 @@ function mr({ id: e, label: t }) {
|
|
|
1365
1365
|
}
|
|
1366
1366
|
//#endregion
|
|
1367
1367
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/entityRef/components/EntityRefDetails.tsx
|
|
1368
|
-
function
|
|
1368
|
+
function br({ rows: e }) {
|
|
1369
1369
|
return e.length === 0 ? null : /* @__PURE__ */ J("div", {
|
|
1370
1370
|
className: "flex flex-col gap-2",
|
|
1371
1371
|
children: e.map((e, t) => /* @__PURE__ */ Y("div", {
|
|
@@ -1382,22 +1382,22 @@ function hr({ rows: e }) {
|
|
|
1382
1382
|
}
|
|
1383
1383
|
//#endregion
|
|
1384
1384
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/entityRef/entities/requisition/RequisitionEntityRef.tsx
|
|
1385
|
-
var
|
|
1385
|
+
var xr = H(({ label: e, ...t }, n) => /* @__PURE__ */ J("button", {
|
|
1386
1386
|
ref: n,
|
|
1387
1387
|
type: "button",
|
|
1388
1388
|
className: i("cursor-pointer font-medium text-f1-foreground-secondary hover:text-f1-foreground", a()),
|
|
1389
1389
|
...t,
|
|
1390
1390
|
children: e
|
|
1391
1391
|
}));
|
|
1392
|
-
|
|
1393
|
-
function
|
|
1392
|
+
xr.displayName = "RequisitionTrigger";
|
|
1393
|
+
function Sr({ id: e, label: n }) {
|
|
1394
1394
|
let { entityRefs: r } = B(), i = r?.resolvers?.requisition, a = t(), o = r?.urls?.requisition?.(e), s = G(() => (e) => {
|
|
1395
1395
|
let t = e.lineManager ? `${e.lineManager.firstName} ${e.lineManager.lastName}` : void 0, n = [
|
|
1396
1396
|
e.status ? {
|
|
1397
1397
|
label: a.t("ai.entityRef.requisition.status"),
|
|
1398
1398
|
value: /* @__PURE__ */ J("div", {
|
|
1399
1399
|
className: "flex items-center pt-1",
|
|
1400
|
-
children: /* @__PURE__ */ J(
|
|
1400
|
+
children: /* @__PURE__ */ J(Ft, {
|
|
1401
1401
|
text: e.status,
|
|
1402
1402
|
variant: e.statusVariant ?? "neutral"
|
|
1403
1403
|
})
|
|
@@ -1407,7 +1407,7 @@ function _r({ id: e, label: n }) {
|
|
|
1407
1407
|
label: a.t("ai.entityRef.requisition.lineManager"),
|
|
1408
1408
|
value: /* @__PURE__ */ Y("div", {
|
|
1409
1409
|
className: "flex items-center gap-1.5 pt-1",
|
|
1410
|
-
children: [/* @__PURE__ */ J(
|
|
1410
|
+
children: [/* @__PURE__ */ J(Tt, {
|
|
1411
1411
|
firstName: e.lineManager.firstName,
|
|
1412
1412
|
lastName: e.lineManager.lastName,
|
|
1413
1413
|
src: e.lineManager.avatarUrl,
|
|
@@ -1423,7 +1423,7 @@ function _r({ id: e, label: n }) {
|
|
|
1423
1423
|
return {
|
|
1424
1424
|
title: e.title,
|
|
1425
1425
|
...e.location && { description: e.location },
|
|
1426
|
-
...n.length > 0 && { children: /* @__PURE__ */ J(
|
|
1426
|
+
...n.length > 0 && { children: /* @__PURE__ */ J(br, { rows: n }) },
|
|
1427
1427
|
...o && { secondaryActions: {
|
|
1428
1428
|
label: a.t("ai.view"),
|
|
1429
1429
|
href: o
|
|
@@ -1440,9 +1440,9 @@ function _r({ id: e, label: n }) {
|
|
|
1440
1440
|
a,
|
|
1441
1441
|
o
|
|
1442
1442
|
]);
|
|
1443
|
-
return i ? /* @__PURE__ */ J(
|
|
1443
|
+
return i ? /* @__PURE__ */ J(ur, {
|
|
1444
1444
|
id: e,
|
|
1445
|
-
trigger: /* @__PURE__ */ J(
|
|
1445
|
+
trigger: /* @__PURE__ */ J(xr, { label: n }),
|
|
1446
1446
|
resolver: i,
|
|
1447
1447
|
mapToCard: s,
|
|
1448
1448
|
fallbackCard: c
|
|
@@ -1450,15 +1450,15 @@ function _r({ id: e, label: n }) {
|
|
|
1450
1450
|
}
|
|
1451
1451
|
//#endregion
|
|
1452
1452
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/entityRef/entities/vacancy/VacancyEntityRef.tsx
|
|
1453
|
-
var
|
|
1453
|
+
var Cr = H(({ label: e, ...t }, n) => /* @__PURE__ */ J("button", {
|
|
1454
1454
|
ref: n,
|
|
1455
1455
|
type: "button",
|
|
1456
1456
|
className: i("cursor-pointer font-medium text-f1-foreground-secondary hover:text-f1-foreground", a()),
|
|
1457
1457
|
...t,
|
|
1458
1458
|
children: e
|
|
1459
1459
|
}));
|
|
1460
|
-
|
|
1461
|
-
function
|
|
1460
|
+
Cr.displayName = "VacancyTrigger";
|
|
1461
|
+
function wr({ id: e, label: n }) {
|
|
1462
1462
|
let { entityRefs: r } = B(), i = r?.resolvers?.vacancy, a = t(), o = r?.urls?.vacancy?.(e), s = G(() => (e) => ({
|
|
1463
1463
|
title: e.name,
|
|
1464
1464
|
description: [e.status, e.vacancyType].filter(Boolean).join(" · "),
|
|
@@ -1477,9 +1477,9 @@ function yr({ id: e, label: n }) {
|
|
|
1477
1477
|
a,
|
|
1478
1478
|
o
|
|
1479
1479
|
]);
|
|
1480
|
-
return i ? /* @__PURE__ */ J(
|
|
1480
|
+
return i ? /* @__PURE__ */ J(ur, {
|
|
1481
1481
|
id: e,
|
|
1482
|
-
trigger: /* @__PURE__ */ J(
|
|
1482
|
+
trigger: /* @__PURE__ */ J(Cr, { label: n }),
|
|
1483
1483
|
resolver: i,
|
|
1484
1484
|
mapToCard: s,
|
|
1485
1485
|
fallbackCard: c
|
|
@@ -1487,35 +1487,35 @@ function yr({ id: e, label: n }) {
|
|
|
1487
1487
|
}
|
|
1488
1488
|
//#endregion
|
|
1489
1489
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/entityRef/components/entityRefRegistry.ts
|
|
1490
|
-
var
|
|
1491
|
-
["person",
|
|
1492
|
-
["candidate",
|
|
1493
|
-
["expense",
|
|
1494
|
-
["job-posting",
|
|
1495
|
-
["requisition",
|
|
1496
|
-
["vacancy",
|
|
1490
|
+
var Tr = /* @__PURE__ */ new Map([
|
|
1491
|
+
["person", yr],
|
|
1492
|
+
["candidate", mr],
|
|
1493
|
+
["expense", gr],
|
|
1494
|
+
["job-posting", vr],
|
|
1495
|
+
["requisition", Sr],
|
|
1496
|
+
["vacancy", wr]
|
|
1497
1497
|
]);
|
|
1498
|
-
function
|
|
1499
|
-
return
|
|
1498
|
+
function Er(e) {
|
|
1499
|
+
return Tr.get(e);
|
|
1500
1500
|
}
|
|
1501
|
-
function
|
|
1501
|
+
function Dr(e, t) {
|
|
1502
1502
|
return e && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
1503
1503
|
}
|
|
1504
1504
|
//#endregion
|
|
1505
1505
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/entityRef/components/EntityRef.tsx
|
|
1506
|
-
function
|
|
1507
|
-
return typeof e == "string" ? e : typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(
|
|
1506
|
+
function Or(e) {
|
|
1507
|
+
return typeof e == "string" ? e : typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(Or).join("") : e && typeof e == "object" && "props" in e ? Or(e.props.children) : "";
|
|
1508
1508
|
}
|
|
1509
|
-
function
|
|
1509
|
+
function kr({ type: e, id: t, children: n }) {
|
|
1510
1510
|
let { entityRefs: r } = B();
|
|
1511
1511
|
if (!t || !e) return /* @__PURE__ */ J("span", { children: n });
|
|
1512
|
-
let i =
|
|
1512
|
+
let i = Or(n), a = Er(e);
|
|
1513
1513
|
if (a) return /* @__PURE__ */ J(a, {
|
|
1514
1514
|
id: t,
|
|
1515
1515
|
label: i
|
|
1516
1516
|
});
|
|
1517
|
-
let o =
|
|
1518
|
-
return o ? /* @__PURE__ */ J(
|
|
1517
|
+
let o = Dr(r?.custom, e);
|
|
1518
|
+
return o ? /* @__PURE__ */ J(fr, {
|
|
1519
1519
|
id: t,
|
|
1520
1520
|
label: i,
|
|
1521
1521
|
config: o
|
|
@@ -1523,18 +1523,18 @@ function wr({ type: e, id: t, children: n }) {
|
|
|
1523
1523
|
}
|
|
1524
1524
|
//#endregion
|
|
1525
1525
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/components/Table.tsx
|
|
1526
|
-
async function
|
|
1527
|
-
let r =
|
|
1526
|
+
async function Ar(e, t, n) {
|
|
1527
|
+
let r = Ue(e), i = t === "xlsx" ? await P([{
|
|
1528
1528
|
name: "Data",
|
|
1529
1529
|
rows: r
|
|
1530
|
-
}]) : await
|
|
1531
|
-
|
|
1530
|
+
}]) : await Ge(r);
|
|
1531
|
+
v(i, `${n}.${t}`);
|
|
1532
1532
|
}
|
|
1533
|
-
function
|
|
1533
|
+
function jr({ children: e, title: n, ...r }) {
|
|
1534
1534
|
let a = t(), o = K(null), s = U((e) => {
|
|
1535
1535
|
if (!o.current) return;
|
|
1536
1536
|
let t = n?.replace(/\s+/g, "_").toLowerCase() || "table";
|
|
1537
|
-
|
|
1537
|
+
Ar(o.current, e, t);
|
|
1538
1538
|
}, [n]);
|
|
1539
1539
|
return /* @__PURE__ */ Y("div", {
|
|
1540
1540
|
className: "group/table relative my-2 flex flex-col gap-2 rounded-md border border-solid border-f1-border-secondary first:mt-0 last:mb-0",
|
|
@@ -1544,16 +1544,16 @@ function Er({ children: e, title: n, ...r }) {
|
|
|
1544
1544
|
tag: "h2",
|
|
1545
1545
|
className: "text-base font-medium capitalize text-f1-foreground",
|
|
1546
1546
|
children: n ?? a.ai.reportCard.tableLabel
|
|
1547
|
-
}), /* @__PURE__ */ J(
|
|
1548
|
-
icon:
|
|
1547
|
+
}), /* @__PURE__ */ J(we, {
|
|
1548
|
+
icon: z,
|
|
1549
1549
|
size: "md",
|
|
1550
1550
|
items: [{
|
|
1551
1551
|
label: a.t("ai.dataDownload.download", { format: "Excel" }),
|
|
1552
|
-
icon:
|
|
1552
|
+
icon: z,
|
|
1553
1553
|
onClick: () => s("xlsx")
|
|
1554
1554
|
}, {
|
|
1555
1555
|
label: a.t("ai.dataDownload.download", { format: "CSV" }),
|
|
1556
|
-
icon:
|
|
1556
|
+
icon: z,
|
|
1557
1557
|
onClick: () => s("csv")
|
|
1558
1558
|
}]
|
|
1559
1559
|
})]
|
|
@@ -1568,15 +1568,15 @@ function Er({ children: e, title: n, ...r }) {
|
|
|
1568
1568
|
})]
|
|
1569
1569
|
});
|
|
1570
1570
|
}
|
|
1571
|
-
function
|
|
1571
|
+
function Mr({ children: e, ...t }) {
|
|
1572
1572
|
return /* @__PURE__ */ J("th", {
|
|
1573
1573
|
...t,
|
|
1574
1574
|
className: i("sticky top-0 z-10 whitespace-nowrap border-0 border-b border-solid border-f1-border-secondary bg-f1-background px-3 py-2 text-left font-medium text-f1-foreground-secondary", t.className),
|
|
1575
1575
|
children: e
|
|
1576
1576
|
});
|
|
1577
1577
|
}
|
|
1578
|
-
function
|
|
1579
|
-
let r = t ?
|
|
1578
|
+
function Nr({ children: e, ellipsis: t = !1, ...n }) {
|
|
1579
|
+
let r = t ? Or(e) : void 0;
|
|
1580
1580
|
return /* @__PURE__ */ J("td", {
|
|
1581
1581
|
title: r || void 0,
|
|
1582
1582
|
...n,
|
|
@@ -1586,42 +1586,42 @@ function Or({ children: e, ellipsis: t = !1, ...n }) {
|
|
|
1586
1586
|
}
|
|
1587
1587
|
//#endregion
|
|
1588
1588
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/components/Typography.tsx
|
|
1589
|
-
function
|
|
1589
|
+
function Pr({ children: e, ...t }) {
|
|
1590
1590
|
return /* @__PURE__ */ J("p", {
|
|
1591
1591
|
...t,
|
|
1592
1592
|
className: i("text-base font-normal", t.className),
|
|
1593
1593
|
children: e
|
|
1594
1594
|
});
|
|
1595
1595
|
}
|
|
1596
|
-
function
|
|
1596
|
+
function Fr({ children: e, ...t }) {
|
|
1597
1597
|
return /* @__PURE__ */ J("h1", {
|
|
1598
1598
|
...t,
|
|
1599
1599
|
className: i("mb-2.5 mt-4 text-2xl font-medium first:mt-0 last:mb-0", t.className),
|
|
1600
1600
|
children: e
|
|
1601
1601
|
});
|
|
1602
1602
|
}
|
|
1603
|
-
function
|
|
1603
|
+
function Ir({ children: e, ...t }) {
|
|
1604
1604
|
return /* @__PURE__ */ J("h2", {
|
|
1605
1605
|
...t,
|
|
1606
1606
|
className: i("mb-2.5 mt-4 text-lg font-medium leading-6 first:mt-0 last:mb-0", t.className),
|
|
1607
1607
|
children: e
|
|
1608
1608
|
});
|
|
1609
1609
|
}
|
|
1610
|
-
function
|
|
1610
|
+
function Lr({ children: e, ...t }) {
|
|
1611
1611
|
return /* @__PURE__ */ J("h3", {
|
|
1612
1612
|
...t,
|
|
1613
1613
|
className: i("mb-2 mt-3.5 text-base font-semibold first:mt-0 last:mb-0", t.className),
|
|
1614
1614
|
children: e
|
|
1615
1615
|
});
|
|
1616
1616
|
}
|
|
1617
|
-
function
|
|
1617
|
+
function Rr({ children: e, ...t }) {
|
|
1618
1618
|
return /* @__PURE__ */ J("strong", {
|
|
1619
1619
|
...t,
|
|
1620
1620
|
className: i("font-semibold", t.className),
|
|
1621
1621
|
children: e
|
|
1622
1622
|
});
|
|
1623
1623
|
}
|
|
1624
|
-
function
|
|
1624
|
+
function zr({ children: e, ...t }) {
|
|
1625
1625
|
return /* @__PURE__ */ J("em", {
|
|
1626
1626
|
...t,
|
|
1627
1627
|
className: i("italic", t.className),
|
|
@@ -1630,90 +1630,101 @@ function Pr({ children: e, ...t }) {
|
|
|
1630
1630
|
}
|
|
1631
1631
|
//#endregion
|
|
1632
1632
|
//#region src/addons/ai/ai/F0AiChat/components/markdownRenderers/MarkdownRenderers.tsx
|
|
1633
|
-
var
|
|
1634
|
-
p:
|
|
1635
|
-
h1:
|
|
1636
|
-
h2:
|
|
1637
|
-
h3:
|
|
1638
|
-
a:
|
|
1639
|
-
strong:
|
|
1640
|
-
em:
|
|
1641
|
-
li:
|
|
1642
|
-
pre:
|
|
1643
|
-
code:
|
|
1644
|
-
blockquote:
|
|
1645
|
-
hr:
|
|
1646
|
-
ul:
|
|
1647
|
-
ol:
|
|
1648
|
-
table:
|
|
1649
|
-
th:
|
|
1650
|
-
td:
|
|
1651
|
-
img:
|
|
1652
|
-
"entity-ref":
|
|
1653
|
-
},
|
|
1633
|
+
var Br = {
|
|
1634
|
+
p: Pr,
|
|
1635
|
+
h1: Fr,
|
|
1636
|
+
h2: Ir,
|
|
1637
|
+
h3: Lr,
|
|
1638
|
+
a: or,
|
|
1639
|
+
strong: Rr,
|
|
1640
|
+
em: zr,
|
|
1641
|
+
li: lr,
|
|
1642
|
+
pre: tr,
|
|
1643
|
+
code: nr,
|
|
1644
|
+
blockquote: rr,
|
|
1645
|
+
hr: ir,
|
|
1646
|
+
ul: sr,
|
|
1647
|
+
ol: cr,
|
|
1648
|
+
table: jr,
|
|
1649
|
+
th: Mr,
|
|
1650
|
+
td: Nr,
|
|
1651
|
+
img: ar,
|
|
1652
|
+
"entity-ref": kr
|
|
1653
|
+
}, Vr = (e) => typeof e == "object" && !!e, X = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Hr = (e, t) => {
|
|
1654
1654
|
if (e && e.trim() && e !== "file") return e;
|
|
1655
1655
|
if (t.startsWith("data:")) {
|
|
1656
1656
|
let [e, n] = (t.slice(5).split(/[;,]/, 1)[0] ?? "").split("/"), r = e === "image" ? "image" : "file", i = n?.split("+")[0];
|
|
1657
1657
|
return i ? `${r}.${i}` : r;
|
|
1658
1658
|
}
|
|
1659
1659
|
let n = t.split("?")[1], r = n ? new URLSearchParams(n.split("#")[0]).get("path") : null;
|
|
1660
|
-
return
|
|
1661
|
-
},
|
|
1662
|
-
let n = X(e.data), r = X(e.url) ?? (n ?
|
|
1663
|
-
|
|
1660
|
+
return R(r ?? t) || e || "file";
|
|
1661
|
+
}, Ur = (e, t) => e.startsWith("data:") ? e : `data:${t ?? "application/octet-stream"};base64,${e}`, Wr = (e, t) => {
|
|
1662
|
+
let n = X(e.data), r = X(e.url) ?? (n ? Ur(n, t) : void 0);
|
|
1663
|
+
if (!r) return null;
|
|
1664
|
+
let i = Gr(e.size ?? e.bytes) ?? Kr(n);
|
|
1665
|
+
return {
|
|
1664
1666
|
url: r,
|
|
1665
|
-
name:
|
|
1666
|
-
mimeType: t
|
|
1667
|
-
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
|
|
1667
|
+
name: Hr(X(e.filename), r),
|
|
1668
|
+
mimeType: t,
|
|
1669
|
+
...i === void 0 ? {} : { size: i }
|
|
1670
|
+
};
|
|
1671
|
+
}, Gr = (e) => typeof e == "number" && e >= 0 ? e : void 0, Kr = (e) => {
|
|
1672
|
+
let t = e?.startsWith("data:") ? e.slice(e.indexOf(",") + 1) : e;
|
|
1673
|
+
if (!t || e?.startsWith("data:") && !e.includes(";base64,")) return;
|
|
1674
|
+
let n = t.endsWith("==") ? 2 : +!!t.endsWith("=");
|
|
1675
|
+
return Math.floor(t.length * 3 / 4) - n;
|
|
1676
|
+
}, qr = (e) => {
|
|
1677
|
+
if (!Vr(e)) return null;
|
|
1678
|
+
if (e.type === "binary") return Wr(e, X(e.mimeType));
|
|
1671
1679
|
if (e.type !== "file") return null;
|
|
1672
|
-
if (!
|
|
1680
|
+
if (!Vr(e.file)) return Wr(e, X(e.mediaType) ?? X(e.mimeType));
|
|
1673
1681
|
let t = X(e.file.url);
|
|
1674
1682
|
if (!t) return null;
|
|
1675
1683
|
let n = e.file.size ?? e.file.bytes;
|
|
1676
1684
|
return {
|
|
1677
1685
|
url: t,
|
|
1678
|
-
name:
|
|
1686
|
+
name: Hr(X(e.file.filename), t),
|
|
1679
1687
|
mimeType: X(e.file.mimetype) ?? X(e.file.mimeType),
|
|
1680
1688
|
...typeof n == "number" ? { size: n } : {},
|
|
1681
1689
|
...X(e.file.previewUrl) ? { previewUrl: X(e.file.previewUrl) } : {},
|
|
1682
1690
|
...X(e.file.thumbnailUrl) ? { thumbnailUrl: X(e.file.thumbnailUrl) } : {}
|
|
1683
1691
|
};
|
|
1684
|
-
},
|
|
1692
|
+
}, Jr = (e) => ({
|
|
1685
1693
|
url: e.url,
|
|
1686
|
-
name:
|
|
1694
|
+
name: Hr(e.filename, e.url),
|
|
1687
1695
|
mimeType: e.mimetype
|
|
1688
|
-
}),
|
|
1696
|
+
}), Yr = (e) => {
|
|
1689
1697
|
let t = /* @__PURE__ */ new Set();
|
|
1690
1698
|
return e.filter((e) => !t.has(e.url) && (t.add(e.url), !0));
|
|
1691
|
-
},
|
|
1692
|
-
let t = Array.isArray(e.content) ? e.content.map(
|
|
1693
|
-
if (t.length > 0) return
|
|
1694
|
-
let n =
|
|
1695
|
-
return Array.isArray(n) ?
|
|
1696
|
-
},
|
|
1699
|
+
}, Xr = (e) => {
|
|
1700
|
+
let t = Array.isArray(e.content) ? e.content.map(qr).filter((e) => e !== null) : [];
|
|
1701
|
+
if (t.length > 0) return Yr(t);
|
|
1702
|
+
let n = Vr(e.rawData) ? e.rawData.uploadedFiles : void 0;
|
|
1703
|
+
return Array.isArray(n) ? Yr(n.filter((e) => Vr(e) && typeof e.url == "string").map(Jr)) : [];
|
|
1704
|
+
}, Zr = (e, t = "assistant") => {
|
|
1697
1705
|
if (typeof e == "string") return e;
|
|
1698
1706
|
if (!Array.isArray(e)) return;
|
|
1699
|
-
let n = e.filter((e) =>
|
|
1707
|
+
let n = e.filter((e) => Vr(e) && e.type === "text" && typeof e.text == "string").map((e) => e.text);
|
|
1700
1708
|
if (n.length !== 0) return t === "user" ? n[n.length - 1] : n.join("\n\n");
|
|
1701
|
-
},
|
|
1709
|
+
}, Qr = (e, { urlFor: t } = {}) => ({
|
|
1702
1710
|
url: e.url ?? t?.(e.path) ?? e.path,
|
|
1703
|
-
name: e.displayName ||
|
|
1711
|
+
name: e.displayName || R(e.path),
|
|
1704
1712
|
mimeType: e.mimeType,
|
|
1705
1713
|
size: e.bytes,
|
|
1706
1714
|
previewUrl: e.preview ? t?.(e.preview.path) ?? e.preview.url : void 0
|
|
1707
|
-
}),
|
|
1715
|
+
}), $r = (e) => ie(e) ?? "", ei = en(!1), ti = () => rn(ei), ni = (e, t) => {
|
|
1716
|
+
let [n, r] = q(() => t ? null : new Set(e));
|
|
1717
|
+
return t && n !== null ? r(null) : !t && n === null && r(new Set(e)), (e) => e !== void 0 && n !== null && !n.has(e);
|
|
1718
|
+
}, ri = ({ avatar: e }) => e?.type === "module" ? /* @__PURE__ */ J(Et, {
|
|
1708
1719
|
module: e.module,
|
|
1709
1720
|
size: "md"
|
|
1710
|
-
}) : e?.type === "file" ? /* @__PURE__ */ J(
|
|
1721
|
+
}) : e?.type === "file" ? /* @__PURE__ */ J(Ct, {
|
|
1711
1722
|
file: e.file,
|
|
1712
1723
|
size: "lg"
|
|
1713
|
-
}) : e?.type === "icon" ? /* @__PURE__ */ J(
|
|
1724
|
+
}) : e?.type === "icon" ? /* @__PURE__ */ J(wt, {
|
|
1714
1725
|
icon: e.icon,
|
|
1715
1726
|
size: "md"
|
|
1716
|
-
}) : null,
|
|
1727
|
+
}) : null, ii = ({ action: e, isActive: n }) => {
|
|
1717
1728
|
let r = t();
|
|
1718
1729
|
return e.type === "open" && e.showButton !== !1 ? /* @__PURE__ */ J(f, {
|
|
1719
1730
|
variant: "outline",
|
|
@@ -1729,7 +1740,7 @@ var Fr = {
|
|
|
1729
1740
|
onClick: e.onClick
|
|
1730
1741
|
}) : null;
|
|
1731
1742
|
};
|
|
1732
|
-
function
|
|
1743
|
+
function ai({ avatar: e, title: t, description: n, isActive: r = !1, action: a, children: o }) {
|
|
1733
1744
|
let s = a.type === "open", c = s ? r ? a.onClose : a.onOpen : void 0;
|
|
1734
1745
|
return /* @__PURE__ */ Y("div", {
|
|
1735
1746
|
className: i("flex flex-col items-center justify-between gap-3 rounded-lg border border-solid px-3 py-2", s && "cursor-pointer", r ? "border-f1-border-hover" : "border-f1-border-secondary"),
|
|
@@ -1737,7 +1748,7 @@ function Yr({ avatar: e, title: t, description: n, isActive: r = !1, action: a,
|
|
|
1737
1748
|
children: [/* @__PURE__ */ Y("div", {
|
|
1738
1749
|
className: "flex w-full min-w-0 flex-row items-center gap-3",
|
|
1739
1750
|
children: [
|
|
1740
|
-
/* @__PURE__ */ J(
|
|
1751
|
+
/* @__PURE__ */ J(ri, { avatar: e }),
|
|
1741
1752
|
/* @__PURE__ */ Y("div", {
|
|
1742
1753
|
className: "flex min-w-0 flex-1 flex-col",
|
|
1743
1754
|
children: [/* @__PURE__ */ J(d, {
|
|
@@ -1748,19 +1759,23 @@ function Yr({ avatar: e, title: t, description: n, isActive: r = !1, action: a,
|
|
|
1748
1759
|
children: n
|
|
1749
1760
|
}) : null]
|
|
1750
1761
|
}),
|
|
1751
|
-
/* @__PURE__ */ J(
|
|
1752
|
-
|
|
1753
|
-
|
|
1762
|
+
/* @__PURE__ */ J("span", {
|
|
1763
|
+
className: "shrink-0",
|
|
1764
|
+
onClick: (e) => e.stopPropagation(),
|
|
1765
|
+
children: /* @__PURE__ */ J(ii, {
|
|
1766
|
+
action: a,
|
|
1767
|
+
isActive: r
|
|
1768
|
+
})
|
|
1754
1769
|
})
|
|
1755
1770
|
]
|
|
1756
1771
|
}), o]
|
|
1757
1772
|
});
|
|
1758
1773
|
}
|
|
1759
|
-
|
|
1774
|
+
ai.displayName = "F0CanvasCard";
|
|
1760
1775
|
//#endregion
|
|
1761
1776
|
//#region src/addons/ai/ai/F0AiChat/providers/FormCardValueFormatterProvider.tsx
|
|
1762
|
-
var
|
|
1763
|
-
function
|
|
1777
|
+
var oi = en(null);
|
|
1778
|
+
function si({ children: e }) {
|
|
1764
1779
|
let [t, n] = q(0), r = K([]), i = U((e) => {
|
|
1765
1780
|
let t = r.current, i = t.findIndex((t) => t.formName === e.formName && t.customFieldName === e.customFieldName), a = e;
|
|
1766
1781
|
i >= 0 ? t[i] = a : t.push(a), n((e) => e + 1);
|
|
@@ -1768,13 +1783,13 @@ function Zr({ children: e }) {
|
|
|
1768
1783
|
formatters: [...r.current],
|
|
1769
1784
|
setFormCardValueFormatter: i
|
|
1770
1785
|
}), [i, t]);
|
|
1771
|
-
return /* @__PURE__ */ J(
|
|
1786
|
+
return /* @__PURE__ */ J(oi.Provider, {
|
|
1772
1787
|
value: a,
|
|
1773
1788
|
children: e
|
|
1774
1789
|
});
|
|
1775
1790
|
}
|
|
1776
|
-
function
|
|
1777
|
-
let t =
|
|
1791
|
+
function ci(e) {
|
|
1792
|
+
let t = rn(oi)?.formatters;
|
|
1778
1793
|
return G(() => !t || t.length === 0 ? null : (n, r, i) => {
|
|
1779
1794
|
let a, o = -1;
|
|
1780
1795
|
for (let n of t) {
|
|
@@ -1789,57 +1804,57 @@ function Qr(e) {
|
|
|
1789
1804
|
});
|
|
1790
1805
|
}, [t, e]);
|
|
1791
1806
|
}
|
|
1792
|
-
function
|
|
1793
|
-
let e =
|
|
1807
|
+
function li() {
|
|
1808
|
+
let e = rn(oi);
|
|
1794
1809
|
if (!e) throw Error("useSetFormCardValueFormatter must be used within a FormCardValueFormatterProvider");
|
|
1795
1810
|
return e.setFormCardValueFormatter;
|
|
1796
1811
|
}
|
|
1797
1812
|
//#endregion
|
|
1798
1813
|
//#region src/addons/ai/ai/F0AiMessagesContainer/components/FormCard.tsx
|
|
1799
|
-
var
|
|
1800
|
-
function
|
|
1814
|
+
var ui = 7, di = 625, fi = /* @__PURE__ */ new Set();
|
|
1815
|
+
function pi(e) {
|
|
1801
1816
|
return typeof DOMParser < "u" ? new DOMParser().parseFromString(e, "text/html").body.textContent?.replace(/\s+/g, " ").trim() ?? "" : e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
1802
1817
|
}
|
|
1803
|
-
function
|
|
1818
|
+
function mi(e) {
|
|
1804
1819
|
return e && e.charAt(0).toUpperCase() + e.slice(1);
|
|
1805
1820
|
}
|
|
1806
|
-
function
|
|
1807
|
-
let { days: t, hours: n, minutes: r, seconds: i } =
|
|
1821
|
+
function hi(e) {
|
|
1822
|
+
let { days: t, hours: n, minutes: r, seconds: i } = fe(e), a = [];
|
|
1808
1823
|
return t > 0 && a.push(`${t}d`), n > 0 && a.push(`${n}h`), r > 0 && a.push(`${r}m`), (i > 0 || a.length === 0) && a.push(`${i}s`), a.join(" ");
|
|
1809
1824
|
}
|
|
1810
|
-
function
|
|
1825
|
+
function gi(e) {
|
|
1811
1826
|
if (e instanceof Date) return !0;
|
|
1812
1827
|
if (typeof e != "string") return !1;
|
|
1813
1828
|
let t = new Date(e);
|
|
1814
1829
|
return !Number.isNaN(t.getTime());
|
|
1815
1830
|
}
|
|
1816
|
-
function
|
|
1831
|
+
function _i(e) {
|
|
1817
1832
|
return (e instanceof Date ? e : new Date(e)).toLocaleDateString();
|
|
1818
1833
|
}
|
|
1819
|
-
function
|
|
1834
|
+
function vi(e) {
|
|
1820
1835
|
return e.type === "item" ? e.text : "";
|
|
1821
1836
|
}
|
|
1822
|
-
function
|
|
1837
|
+
function yi(e, t) {
|
|
1823
1838
|
if (e == null || e === "") return {
|
|
1824
1839
|
type: "item",
|
|
1825
1840
|
text: "—"
|
|
1826
1841
|
};
|
|
1827
1842
|
if (t === "duration" && typeof e == "number") return {
|
|
1828
1843
|
type: "item",
|
|
1829
|
-
text:
|
|
1844
|
+
text: hi(e)
|
|
1830
1845
|
};
|
|
1831
1846
|
if (t === "richtext" && typeof e == "object" && e && "value" in e) {
|
|
1832
1847
|
let t = e.value;
|
|
1833
1848
|
return {
|
|
1834
1849
|
type: "item",
|
|
1835
|
-
text: (t ?
|
|
1850
|
+
text: (t ? pi(t) : "") || "—"
|
|
1836
1851
|
};
|
|
1837
1852
|
}
|
|
1838
1853
|
if (t === "daterange" && typeof e == "object" && e && "from" in e && "to" in e) {
|
|
1839
1854
|
let { from: t, to: n } = e;
|
|
1840
1855
|
return {
|
|
1841
1856
|
type: "item",
|
|
1842
|
-
text: `${
|
|
1857
|
+
text: `${gi(t) ? _i(t) : String(t)} – ${gi(n) ? _i(n) : String(n)}`
|
|
1843
1858
|
};
|
|
1844
1859
|
}
|
|
1845
1860
|
if (e instanceof Date) return {
|
|
@@ -1853,8 +1868,8 @@ function li(e, t) {
|
|
|
1853
1868
|
if (Array.isArray(e)) return {
|
|
1854
1869
|
type: "item",
|
|
1855
1870
|
text: e.map((e) => {
|
|
1856
|
-
let t =
|
|
1857
|
-
return Array.isArray(t) ? t.map(
|
|
1871
|
+
let t = yi(e);
|
|
1872
|
+
return Array.isArray(t) ? t.map(vi).join(", ") : vi(t);
|
|
1858
1873
|
}).filter(Boolean).join(", ") || "—"
|
|
1859
1874
|
};
|
|
1860
1875
|
if (typeof e == "object" && e) {
|
|
@@ -1875,11 +1890,11 @@ function li(e, t) {
|
|
|
1875
1890
|
}
|
|
1876
1891
|
return {
|
|
1877
1892
|
type: "item",
|
|
1878
|
-
text:
|
|
1893
|
+
text: mi(String(e))
|
|
1879
1894
|
};
|
|
1880
1895
|
}
|
|
1881
|
-
function
|
|
1882
|
-
let { canvasContent: c, openCanvas: l, closeCanvas: u, dismissCanvas: d } = B(), f =
|
|
1896
|
+
function bi({ formName: e, formDescription: t, module: n, cardTitle: r, cardDescription: i, fieldDescriptions: a, formValues: o, valueFormatter: s }) {
|
|
1897
|
+
let { canvasContent: c, openCanvas: l, closeCanvas: u, dismissCanvas: d } = B(), f = ci(e), p = s ?? f, m = K(() => {}), h = r ?? e, g = i ?? t ?? "", _ = c?.type === "form" && c.formName === e, v = () => l({
|
|
1883
1898
|
type: "form",
|
|
1884
1899
|
title: h,
|
|
1885
1900
|
description: g,
|
|
@@ -1888,7 +1903,7 @@ function ui({ formName: e, formDescription: t, module: n, cardTitle: r, cardDesc
|
|
|
1888
1903
|
formModule: n
|
|
1889
1904
|
});
|
|
1890
1905
|
m.current = v, W(() => {
|
|
1891
|
-
typeof window < "u" && (window.innerWidth <
|
|
1906
|
+
typeof window < "u" && (window.innerWidth < di || fi.has(e) || (fi.add(e), m.current()));
|
|
1892
1907
|
}, [e]);
|
|
1893
1908
|
let y = a && o ? Object.entries(a).map(([e, t]) => {
|
|
1894
1909
|
let n = o[e], r = p?.(e, n, {
|
|
@@ -1896,7 +1911,7 @@ function ui({ formName: e, formDescription: t, module: n, cardTitle: r, cardDesc
|
|
|
1896
1911
|
customFieldName: t.customFieldName
|
|
1897
1912
|
});
|
|
1898
1913
|
if (!r && t.fieldType === "custom" && typeof n == "object" && n) return null;
|
|
1899
|
-
let i = r ??
|
|
1914
|
+
let i = r ?? yi(n, t.fieldType);
|
|
1900
1915
|
return {
|
|
1901
1916
|
label: t.label,
|
|
1902
1917
|
content: i,
|
|
@@ -1906,8 +1921,8 @@ function ui({ formName: e, formDescription: t, module: n, cardTitle: r, cardDesc
|
|
|
1906
1921
|
if (!e) return !1;
|
|
1907
1922
|
let t = Array.isArray(e.content) ? e.content[0] : e.content;
|
|
1908
1923
|
return t?.type !== "item" || t.text !== "—";
|
|
1909
|
-
}) : [], b = y.slice(0,
|
|
1910
|
-
return /* @__PURE__ */ J(
|
|
1924
|
+
}) : [], b = y.slice(0, ui), S = y.length > ui;
|
|
1925
|
+
return /* @__PURE__ */ J(ai, {
|
|
1911
1926
|
avatar: n ? {
|
|
1912
1927
|
type: "module",
|
|
1913
1928
|
module: n
|
|
@@ -1923,29 +1938,29 @@ function ui({ formName: e, formDescription: t, module: n, cardTitle: r, cardDesc
|
|
|
1923
1938
|
},
|
|
1924
1939
|
children: b.length > 0 && !_ ? /* @__PURE__ */ J("div", {
|
|
1925
1940
|
className: "-mx-3 flex w-full flex-col overflow-hidden pb-1",
|
|
1926
|
-
children: /* @__PURE__ */ J(
|
|
1941
|
+
children: /* @__PURE__ */ J(x, {
|
|
1927
1942
|
details: b.map((e) => ({
|
|
1928
1943
|
title: e.label,
|
|
1929
1944
|
content: e.content,
|
|
1930
1945
|
...e.verticalLayout && { verticalLayout: !0 }
|
|
1931
1946
|
})),
|
|
1932
|
-
showSeeMore:
|
|
1947
|
+
showSeeMore: S,
|
|
1933
1948
|
onClickSeeMore: v,
|
|
1934
1949
|
tableView: !0
|
|
1935
1950
|
})
|
|
1936
1951
|
}) : null
|
|
1937
1952
|
});
|
|
1938
1953
|
}
|
|
1939
|
-
|
|
1954
|
+
bi.displayName = "FormCard";
|
|
1940
1955
|
//#endregion
|
|
1941
1956
|
//#region src/addons/ai/ai/F0AiMessagesContainer/components/ActiveFormCard.tsx
|
|
1942
|
-
function
|
|
1943
|
-
let e =
|
|
1957
|
+
function xi() {
|
|
1958
|
+
let e = Xe(), t = e?.activeForm;
|
|
1944
1959
|
if (!t) return null;
|
|
1945
1960
|
let n = t.cardTitle, r = t.cardDescription, i = (e?.getFillVersion(t.formName) ?? 0) > 0;
|
|
1946
1961
|
return !n || !r || !i ? null : /* @__PURE__ */ J("div", {
|
|
1947
1962
|
className: "mt-2 w-full",
|
|
1948
|
-
children: /* @__PURE__ */ J(
|
|
1963
|
+
children: /* @__PURE__ */ J(bi, {
|
|
1949
1964
|
formName: t.formName,
|
|
1950
1965
|
formDescription: t.description,
|
|
1951
1966
|
module: t.module,
|
|
@@ -1957,134 +1972,267 @@ function di() {
|
|
|
1957
1972
|
});
|
|
1958
1973
|
}
|
|
1959
1974
|
//#endregion
|
|
1960
|
-
//#region src/addons/ai/ai/
|
|
1961
|
-
var
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1975
|
+
//#region src/addons/ai/ai/F0AiMessagesContainer/hooks/useScrollAnchor.ts
|
|
1976
|
+
var Si = $t.settleMs, Ci = 1e3, wi = 2, Ti = "data-ai-anchor", Ei = "data-turn-index", Di = (e) => {
|
|
1977
|
+
if (!e) return null;
|
|
1978
|
+
let t = e.closest(`[${Ti}]`);
|
|
1979
|
+
if (t) return t;
|
|
1980
|
+
let n = e.closest(`[${Ei}]`);
|
|
1981
|
+
if (!n) return null;
|
|
1982
|
+
let r = e;
|
|
1983
|
+
for (; r.parentElement && r.parentElement !== n;) r = r.parentElement;
|
|
1984
|
+
return r.parentElement === n ? r : n;
|
|
1985
|
+
}, Oi = (e, t) => t.getBoundingClientRect().top - e.getBoundingClientRect().top, ki = (e) => e.scrollHeight - e.scrollTop - e.clientHeight <= wi;
|
|
1986
|
+
function Ai({ viewportRef: e, contentRef: t }) {
|
|
1987
|
+
W(() => {
|
|
1988
|
+
let n = e.current, r = t.current;
|
|
1989
|
+
if (!n || !r || typeof ResizeObserver > "u") return;
|
|
1990
|
+
let i = n.clientWidth, a = null, o, s = !1, c = null, l = () => {
|
|
1991
|
+
let e = n.getBoundingClientRect(), t = r.querySelector(`[${Ei}]`)?.parentElement, i = t ? t.getBoundingClientRect().left + t.clientWidth / 2 : e.left + e.width / 2, a = Di(typeof document.elementFromPoint == "function" ? document.elementFromPoint(i, e.top + 8) : null);
|
|
1992
|
+
return a && n.contains(a) ? {
|
|
1993
|
+
kind: "element",
|
|
1994
|
+
element: a,
|
|
1995
|
+
offset: Oi(n, a)
|
|
1996
|
+
} : null;
|
|
1997
|
+
}, u = null, d = () => {
|
|
1998
|
+
u = ki(n) ? { kind: "bottom" } : l();
|
|
1999
|
+
}, f = () => c && c.element.isConnected && performance.now() - c.at < Ci ? {
|
|
2000
|
+
kind: "element",
|
|
2001
|
+
element: c.element,
|
|
2002
|
+
offset: c.offset
|
|
2003
|
+
} : u, p = () => {
|
|
2004
|
+
if (!a || s) return;
|
|
2005
|
+
let e = a.kind === "bottom" ? n.scrollHeight - n.clientHeight : a.element.isConnected ? n.scrollTop + Oi(n, a.element) - a.offset : null;
|
|
2006
|
+
if (e === null) return;
|
|
2007
|
+
let t = Math.round(e);
|
|
2008
|
+
Math.abs(t - n.scrollTop) >= 1 && (n.scrollTop = t);
|
|
2009
|
+
}, m = new ResizeObserver(() => {
|
|
2010
|
+
let e = n.clientWidth;
|
|
2011
|
+
i === 0 && (i = e), e !== i && (a ||= (s = !1, f()), i = e, window.clearTimeout(o), o = window.setTimeout(() => {
|
|
2012
|
+
a = null, d();
|
|
2013
|
+
}, Si)), a ? p() : d();
|
|
2014
|
+
});
|
|
2015
|
+
m.observe(n), m.observe(r), d();
|
|
2016
|
+
let h = 0, g = () => {
|
|
2017
|
+
a || h || (h = window.requestAnimationFrame(() => {
|
|
2018
|
+
h = 0, d();
|
|
2019
|
+
}));
|
|
2020
|
+
}, _ = (e) => {
|
|
2021
|
+
let t = Di(e.target);
|
|
2022
|
+
c = t ? {
|
|
2023
|
+
element: t,
|
|
2024
|
+
offset: Oi(n, t),
|
|
2025
|
+
at: performance.now()
|
|
2026
|
+
} : null;
|
|
2027
|
+
}, v = () => {
|
|
2028
|
+
a && (s = !0);
|
|
2029
|
+
}, y = (e) => {
|
|
2030
|
+
[
|
|
2031
|
+
"PageUp",
|
|
2032
|
+
"PageDown",
|
|
2033
|
+
"Home",
|
|
2034
|
+
"End",
|
|
2035
|
+
"ArrowUp",
|
|
2036
|
+
"ArrowDown",
|
|
2037
|
+
" "
|
|
2038
|
+
].includes(e.key) && e.target === n && v();
|
|
2039
|
+
}, b = (e) => {
|
|
2040
|
+
e.target === n && v();
|
|
2041
|
+
};
|
|
2042
|
+
return n.addEventListener("scroll", g, { passive: !0 }), r.addEventListener("pointerdown", _, !0), r.addEventListener("keydown", _, !0), n.addEventListener("wheel", v, { passive: !0 }), n.addEventListener("touchmove", v, { passive: !0 }), n.addEventListener("keydown", y), n.addEventListener("pointerdown", b), () => {
|
|
2043
|
+
m.disconnect(), window.clearTimeout(o), window.cancelAnimationFrame(h), n.removeEventListener("scroll", g), r.removeEventListener("pointerdown", _, !0), r.removeEventListener("keydown", _, !0), n.removeEventListener("wheel", v), n.removeEventListener("touchmove", v), n.removeEventListener("keydown", y), n.removeEventListener("pointerdown", b);
|
|
2044
|
+
};
|
|
2045
|
+
}, [e, t]);
|
|
2046
|
+
}
|
|
2047
|
+
//#endregion
|
|
2048
|
+
//#region src/addons/ai/ai/F0AiFileAttachments/components/FileCanvasCards.tsx
|
|
2049
|
+
var ji = 625, Mi = /* @__PURE__ */ new Set(), Ni = ({ documents: e, onOpenFile: t, onCanvasUnavailable: n }) => {
|
|
2050
|
+
let { canvasContent: r, tryOpenCanvas: i, closeCanvas: a, dismissCanvas: o, panelOverlays: s } = B(), c = xe(), l = ti(), u = e.map((e) => e.file), d = (r, { fallback: a = !0 } = {}) => {
|
|
2051
|
+
let o = e[r];
|
|
2052
|
+
o && t?.(o.file, "document", { documentKind: o.documentKind }) !== !1 && !(i?.(rt({
|
|
2053
|
+
files: u,
|
|
2054
|
+
index: r,
|
|
2055
|
+
config: c
|
|
2056
|
+
})) ?? !1) && a && n(r);
|
|
2057
|
+
}, f = K(d);
|
|
2058
|
+
sn(() => {
|
|
2059
|
+
f.current = d;
|
|
2060
|
+
});
|
|
2061
|
+
let p = u[0]?.url, m = s === !0 || typeof window < "u" && window.innerWidth < ji;
|
|
2062
|
+
return W(() => {
|
|
2063
|
+
l && p && !Mi.has(p) && !m && (Mi.add(p), f.current(0, { fallback: !1 }));
|
|
2064
|
+
}, [
|
|
2065
|
+
l,
|
|
2066
|
+
p,
|
|
2067
|
+
m
|
|
2068
|
+
]), /* @__PURE__ */ J("div", {
|
|
2069
|
+
className: "flex w-full max-w-sm flex-col gap-2",
|
|
2070
|
+
"data-testid": "ai-chat-file-canvas-cards",
|
|
2071
|
+
children: e.map(({ file: e }, t) => {
|
|
2072
|
+
let n = ke(r, e.url);
|
|
2073
|
+
return /* @__PURE__ */ J("div", {
|
|
2074
|
+
"data-active": n || void 0,
|
|
2075
|
+
"data-testid": "ai-chat-file-canvas-card",
|
|
2076
|
+
[Ti]: "",
|
|
2077
|
+
children: /* @__PURE__ */ J(ai, {
|
|
2078
|
+
avatar: {
|
|
2079
|
+
type: "file",
|
|
2080
|
+
file: {
|
|
2081
|
+
name: e.name,
|
|
2082
|
+
type: $r(e)
|
|
2083
|
+
}
|
|
2084
|
+
},
|
|
2085
|
+
title: e.name,
|
|
2086
|
+
description: e.size ? ne(e.size) : de(e.name, $r(e)),
|
|
2087
|
+
isActive: n,
|
|
2088
|
+
action: {
|
|
2089
|
+
type: "open",
|
|
2090
|
+
onOpen: () => d(t),
|
|
2091
|
+
onClose: () => (o ?? a)()
|
|
2092
|
+
}
|
|
2093
|
+
})
|
|
2094
|
+
}, `${e.url}-${t}`);
|
|
2095
|
+
})
|
|
2096
|
+
});
|
|
2097
|
+
}, Pi = "rounded-xl", Z = "ai-chat", Fi = (e) => {
|
|
2098
|
+
let { provided: t } = Me();
|
|
2099
|
+
return t ? /* @__PURE__ */ J(Ri, { ...e }) : /* @__PURE__ */ J(mt, { children: /* @__PURE__ */ J(Ri, { ...e }) });
|
|
2100
|
+
}, Ii = {
|
|
1965
2101
|
image: 0,
|
|
1966
2102
|
video: 1,
|
|
1967
2103
|
document: 2,
|
|
1968
2104
|
audio: 3,
|
|
1969
2105
|
file: 4
|
|
1970
|
-
},
|
|
1971
|
-
let { remotePreviews:
|
|
2106
|
+
}, Li = (e) => e.bucket === "image" || e.bucket === "video" || e.bucket === "audio" || e.bucket === "document" ? e.bucket : "file", Ri = ({ files: e, align: t = "start", onOpenFile: n, onFileDownloaded: r, size: i = "default", opensIn: a }) => {
|
|
2107
|
+
let { remotePreviews: o } = Me(), s = st(), c = i === "default" && (a ?? (t === "start" && s ? "canvas" : "viewer")) === "canvas", [l, u] = q(() => /* @__PURE__ */ new Set()), d = G(() => zi(e, o, l), [
|
|
1972
2108
|
e,
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
]),
|
|
1976
|
-
return e.length === 0 ? null : J(i === "compact" ?
|
|
1977
|
-
entries:
|
|
2109
|
+
o,
|
|
2110
|
+
l
|
|
2111
|
+
]), f = G(() => i === "compact" ? d : [...d].sort((e, t) => Ii[e.cls.bucket] - Ii[t.cls.bucket]), [d, i]), p = he(f, "transcript");
|
|
2112
|
+
return e.length === 0 ? null : J(i === "compact" ? Hi : Vi, {
|
|
2113
|
+
entries: d,
|
|
2114
|
+
canvas: c,
|
|
1978
2115
|
align: t,
|
|
1979
2116
|
onOpenFile: n,
|
|
1980
2117
|
onFileDownloaded: r,
|
|
1981
2118
|
open: (e, { askHost: t = !0 } = {}) => {
|
|
1982
|
-
(t ? n?.(e.file,
|
|
2119
|
+
(t ? n?.(e.file, Li(e.cls)) : void 0) !== !1 && p.openFile(e.file);
|
|
1983
2120
|
},
|
|
1984
|
-
onImageError: (e) =>
|
|
2121
|
+
onImageError: (e) => u((t) => new Set(t).add(e.url))
|
|
1985
2122
|
});
|
|
1986
|
-
},
|
|
1987
|
-
let i =
|
|
2123
|
+
}, zi = (e, t, n) => e.map((e, r) => {
|
|
2124
|
+
let i = y(e), a = !(t || Ee(e.url)) || i.bucket === "file" || i.bucket === "image" && n.has(e.url);
|
|
1988
2125
|
return {
|
|
1989
2126
|
file: e,
|
|
1990
2127
|
cls: i,
|
|
1991
2128
|
generic: a,
|
|
1992
|
-
item: a ? null :
|
|
2129
|
+
item: a ? null : S(e, pe(r, e.url))
|
|
1993
2130
|
};
|
|
1994
|
-
}),
|
|
2131
|
+
}), Bi = ({ align: e, compact: t = !1, children: n }) => /* @__PURE__ */ J("div", {
|
|
1995
2132
|
className: i("flex w-full min-w-0 flex-col gap-1.5", e === "end" ? "items-end" : "items-start"),
|
|
1996
2133
|
"data-testid": "ai-chat-file-attachments",
|
|
1997
2134
|
"data-size": t ? "compact" : void 0,
|
|
1998
2135
|
children: n
|
|
1999
|
-
}),
|
|
2000
|
-
let
|
|
2001
|
-
|
|
2002
|
-
|
|
2136
|
+
}), Vi = ({ entries: e, canvas: t = !1, align: n, open: r, onImageError: a, onOpenFile: o, onFileDownloaded: s }) => {
|
|
2137
|
+
let c = e.filter((e) => !e.generic), l = c.filter((e) => e.cls.bucket === "image"), u = e.filter((e) => e.generic), d = c.filter((e) => e.cls.bucket === "document"), f = d.length + u.length > 1, p = d.filter((e) => e.cls.bucket === "document" && e.cls.kind !== "archive"), m = d.filter((e) => e.cls.bucket === "document" && e.cls.kind === "archive"), h = t ? /* @__PURE__ */ J(Ni, {
|
|
2138
|
+
documents: p.flatMap((e) => e.cls.bucket === "document" ? [{
|
|
2139
|
+
file: e.file,
|
|
2140
|
+
documentKind: e.cls.kind
|
|
2141
|
+
}] : []),
|
|
2142
|
+
onOpenFile: o,
|
|
2143
|
+
onCanvasUnavailable: (e) => {
|
|
2144
|
+
let t = p[e];
|
|
2145
|
+
t && r(t, { askHost: !1 });
|
|
2146
|
+
}
|
|
2147
|
+
}) : null, g = t ? m : f ? d : [];
|
|
2148
|
+
return /* @__PURE__ */ Y(Bi, {
|
|
2149
|
+
align: n,
|
|
2003
2150
|
children: [
|
|
2004
|
-
|
|
2005
|
-
images:
|
|
2151
|
+
l.length > 0 ? /* @__PURE__ */ J(qi, {
|
|
2152
|
+
images: l.map((e) => e.file),
|
|
2006
2153
|
onOpen: (e) => {
|
|
2007
|
-
let t =
|
|
2008
|
-
t &&
|
|
2154
|
+
let t = l[e];
|
|
2155
|
+
t && r(t);
|
|
2009
2156
|
},
|
|
2010
|
-
onImageError:
|
|
2157
|
+
onImageError: a
|
|
2011
2158
|
}) : null,
|
|
2012
|
-
|
|
2159
|
+
c.map((e, t) => {
|
|
2013
2160
|
let { file: n, cls: r } = e, i = `${n.name}-${t}`;
|
|
2014
|
-
return r.bucket === "video" ? /* @__PURE__ */ J(
|
|
2015
|
-
file:
|
|
2161
|
+
return r.bucket === "video" ? /* @__PURE__ */ J(ft, {
|
|
2162
|
+
file: ce(n),
|
|
2016
2163
|
cornerClass: "rounded-xl",
|
|
2017
2164
|
testIdPrefix: Z,
|
|
2018
|
-
onDownloaded: () =>
|
|
2165
|
+
onDownloaded: () => s?.(n)
|
|
2019
2166
|
}, i) : null;
|
|
2020
2167
|
}),
|
|
2021
|
-
|
|
2022
|
-
let { file:
|
|
2023
|
-
return i.bucket === "document" ? /* @__PURE__ */ J(
|
|
2024
|
-
file:
|
|
2168
|
+
f || t ? null : d.map((e, t) => {
|
|
2169
|
+
let { file: n, cls: i } = e;
|
|
2170
|
+
return i.bucket === "document" ? /* @__PURE__ */ J(Ce, {
|
|
2171
|
+
file: ce(n),
|
|
2025
2172
|
kind: i.kind,
|
|
2026
2173
|
cornerClass: "rounded-xl",
|
|
2027
2174
|
testIdPrefix: Z,
|
|
2028
2175
|
lazyMount: !0,
|
|
2029
2176
|
fitWidth: !0,
|
|
2030
2177
|
decorativeSnapshot: !0,
|
|
2031
|
-
onBeforeOpen: () =>
|
|
2032
|
-
onOpen: () =>
|
|
2033
|
-
onDownloaded: () =>
|
|
2034
|
-
}, `${
|
|
2178
|
+
onBeforeOpen: () => o?.(n, "document", { documentKind: i.kind }),
|
|
2179
|
+
onOpen: () => r(e, { askHost: !1 }),
|
|
2180
|
+
onDownloaded: () => s?.(n)
|
|
2181
|
+
}, `${n.name}-${t}`) : null;
|
|
2035
2182
|
}),
|
|
2036
|
-
|
|
2037
|
-
file:
|
|
2183
|
+
c.map((e, t) => e.cls.bucket === "audio" ? /* @__PURE__ */ J(dt, {
|
|
2184
|
+
file: ce(e.file),
|
|
2038
2185
|
testIdPrefix: Z,
|
|
2039
|
-
onDownloaded: () =>
|
|
2186
|
+
onDownloaded: () => s?.(e.file)
|
|
2040
2187
|
}, `${e.file.name}-${t}`) : null),
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
"
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2188
|
+
h,
|
|
2189
|
+
g.length > 0 || u.length > 0 ? /* @__PURE__ */ Y("div", {
|
|
2190
|
+
className: i("flex max-w-full flex-wrap gap-2", n === "end" ? "justify-end" : "justify-start"),
|
|
2191
|
+
"data-testid": f ? `${Z}-file-shelf` : void 0,
|
|
2192
|
+
children: [g.length > 0 ? g.map((e, t) => {
|
|
2193
|
+
let { file: n, cls: i } = e;
|
|
2194
|
+
return i.bucket === "document" ? /* @__PURE__ */ J(Ce, {
|
|
2195
|
+
file: ce(n),
|
|
2048
2196
|
kind: i.kind,
|
|
2049
2197
|
cornerClass: "rounded-xl",
|
|
2050
2198
|
compact: !0,
|
|
2051
2199
|
testIdPrefix: Z,
|
|
2052
2200
|
lazyMount: !0,
|
|
2053
2201
|
decorativeSnapshot: !0,
|
|
2054
|
-
onBeforeOpen: () =>
|
|
2055
|
-
onOpen: () =>
|
|
2056
|
-
onDownloaded: () =>
|
|
2057
|
-
}, `${
|
|
2058
|
-
}) : null,
|
|
2202
|
+
onBeforeOpen: () => o?.(n, "document", { documentKind: i.kind }),
|
|
2203
|
+
onOpen: () => r(e, { askHost: !1 }),
|
|
2204
|
+
onDownloaded: () => s?.(n)
|
|
2205
|
+
}, `${n.name}-${t}`) : null;
|
|
2206
|
+
}) : null, u.map((e, t) => /* @__PURE__ */ J(Ui, {
|
|
2059
2207
|
file: e.file,
|
|
2060
|
-
onFileDownloaded:
|
|
2208
|
+
onFileDownloaded: s
|
|
2061
2209
|
}, `${e.file.name}-${t}`))]
|
|
2062
2210
|
}) : null
|
|
2063
2211
|
]
|
|
2064
2212
|
});
|
|
2065
|
-
},
|
|
2213
|
+
}, Hi = ({ entries: e, align: t, open: n, onImageError: r, onOpenFile: a, onFileDownloaded: o }) => /* @__PURE__ */ J(Bi, {
|
|
2066
2214
|
align: t,
|
|
2067
2215
|
compact: !0,
|
|
2068
2216
|
children: /* @__PURE__ */ J("div", {
|
|
2069
2217
|
className: i("flex max-w-full flex-wrap gap-2", t === "end" ? "justify-end" : "justify-start"),
|
|
2070
2218
|
children: e.map((e, t) => {
|
|
2071
2219
|
let { file: i, cls: s } = e, c = `${i.name}-${t}`;
|
|
2072
|
-
return e.generic ? /* @__PURE__ */ J(
|
|
2220
|
+
return e.generic ? /* @__PURE__ */ J(Ui, {
|
|
2073
2221
|
file: i,
|
|
2074
2222
|
onFileDownloaded: o
|
|
2075
|
-
}, c) : s.bucket === "image" ? /* @__PURE__ */ J(
|
|
2223
|
+
}, c) : s.bucket === "image" ? /* @__PURE__ */ J(Gi, {
|
|
2076
2224
|
file: i,
|
|
2077
2225
|
onOpen: () => n(e),
|
|
2078
2226
|
onError: () => r(i)
|
|
2079
|
-
}, c) : s.bucket === "video" ? /* @__PURE__ */ J(
|
|
2227
|
+
}, c) : s.bucket === "video" ? /* @__PURE__ */ J(Ki, {
|
|
2080
2228
|
file: i,
|
|
2081
2229
|
onOpen: () => n(e)
|
|
2082
|
-
}, c) : s.bucket === "audio" ? /* @__PURE__ */ J(
|
|
2083
|
-
file:
|
|
2230
|
+
}, c) : s.bucket === "audio" ? /* @__PURE__ */ J(le, {
|
|
2231
|
+
file: ce(i),
|
|
2084
2232
|
testIdPrefix: Z,
|
|
2085
2233
|
onOpen: () => n(e)
|
|
2086
|
-
}, c) : s.bucket === "document" ? /* @__PURE__ */ J(
|
|
2087
|
-
file:
|
|
2234
|
+
}, c) : s.bucket === "document" ? /* @__PURE__ */ J(Ce, {
|
|
2235
|
+
file: ce(i),
|
|
2088
2236
|
kind: s.kind,
|
|
2089
2237
|
cornerClass: "rounded-xl",
|
|
2090
2238
|
compact: !0,
|
|
@@ -2097,33 +2245,33 @@ var fi = "rounded-xl", Z = "ai-chat", pi = (e) => {
|
|
|
2097
2245
|
}, c) : null;
|
|
2098
2246
|
})
|
|
2099
2247
|
})
|
|
2100
|
-
}),
|
|
2101
|
-
let r = t(), i =
|
|
2102
|
-
return /* @__PURE__ */ J(
|
|
2248
|
+
}), Ui = ({ file: e, onFileDownloaded: n }) => {
|
|
2249
|
+
let r = t(), i = D(), a = $r(e);
|
|
2250
|
+
return /* @__PURE__ */ J(h, {
|
|
2103
2251
|
file: {
|
|
2104
2252
|
...e,
|
|
2105
2253
|
mimeType: a
|
|
2106
2254
|
},
|
|
2107
|
-
icon: a === "application/zip" ?
|
|
2255
|
+
icon: a === "application/zip" ? F : void 0,
|
|
2108
2256
|
testId: `${Z}-file-tile`,
|
|
2109
2257
|
action: {
|
|
2110
2258
|
label: r.t("chat.downloadNamedFile", { name: e.name }),
|
|
2111
|
-
icon:
|
|
2259
|
+
icon: z,
|
|
2112
2260
|
onClick: () => {
|
|
2113
2261
|
i(e.url, e.name), n?.(e);
|
|
2114
2262
|
}
|
|
2115
2263
|
}
|
|
2116
2264
|
});
|
|
2117
|
-
},
|
|
2118
|
-
let o = t(), s =
|
|
2119
|
-
return
|
|
2265
|
+
}, Wi = "relative box-border h-[132px] w-[168px] shrink-0 overflow-hidden rounded-xl border border-solid border-f1-border-secondary bg-f1-background-secondary p-0 transition-opacity hover:opacity-90", Gi = ({ file: e, onOpen: n, onError: r }) => {
|
|
2266
|
+
let o = t(), s = nt(e.thumbnailUrl ?? e.url);
|
|
2267
|
+
return M(s.status, r), /* @__PURE__ */ J("button", {
|
|
2120
2268
|
type: "button",
|
|
2121
2269
|
onClick: n,
|
|
2122
2270
|
draggable: !1,
|
|
2123
2271
|
"aria-label": o.t("chat.openNamedDocument", { name: e.name }),
|
|
2124
|
-
className: i(
|
|
2272
|
+
className: i(Wi, a()),
|
|
2125
2273
|
"data-testid": "ai-chat-image-attachment",
|
|
2126
|
-
children: s.status === "ready" ? /* @__PURE__ */ J(
|
|
2274
|
+
children: s.status === "ready" ? /* @__PURE__ */ J(_e, {
|
|
2127
2275
|
src: s.url,
|
|
2128
2276
|
alt: e.name,
|
|
2129
2277
|
draggable: !1,
|
|
@@ -2131,32 +2279,32 @@ var fi = "rounded-xl", Z = "ai-chat", pi = (e) => {
|
|
|
2131
2279
|
className: "h-full w-full object-cover"
|
|
2132
2280
|
}) : null
|
|
2133
2281
|
});
|
|
2134
|
-
},
|
|
2135
|
-
let r = t(), { urlCache: o } =
|
|
2282
|
+
}, Ki = ({ file: e, onOpen: n }) => {
|
|
2283
|
+
let r = t(), { urlCache: o } = xe(), s = nt(e.thumbnailUrl), c = !e.thumbnailUrl && o === null, [l, u] = q(!1);
|
|
2136
2284
|
return /* @__PURE__ */ Y("button", {
|
|
2137
2285
|
type: "button",
|
|
2138
2286
|
onClick: n,
|
|
2139
2287
|
"aria-label": r.t("chat.videoPlayerLabel", { name: e.name }),
|
|
2140
|
-
className: i(
|
|
2288
|
+
className: i(Wi, a()),
|
|
2141
2289
|
"data-testid": "ai-chat-video-attachment",
|
|
2142
|
-
children: [!l && (s.status === "ready" || c) ? /* @__PURE__ */ J(
|
|
2290
|
+
children: [!l && (s.status === "ready" || c) ? /* @__PURE__ */ J(T, {
|
|
2143
2291
|
url: e.url,
|
|
2144
2292
|
posterUrl: s.status === "ready" ? s.url : void 0,
|
|
2145
2293
|
onError: () => u(!0)
|
|
2146
|
-
}) : null, /* @__PURE__ */ J(
|
|
2294
|
+
}) : null, /* @__PURE__ */ J(ve, {})]
|
|
2147
2295
|
});
|
|
2148
|
-
},
|
|
2149
|
-
let a = t(), o = e.length === 1 ? e[0] : void 0, s =
|
|
2296
|
+
}, qi = ({ images: e, onOpen: n, onImageError: r }) => {
|
|
2297
|
+
let a = t(), o = e.length === 1 ? e[0] : void 0, s = nt(o ? o.thumbnailUrl ?? o.url : void 0), c = Ie(o && s.status === "ready" ? s.url : void 0, o) ?? void 0, l = o ? ze(c?.width, c?.height) : null;
|
|
2150
2298
|
return /* @__PURE__ */ J("div", {
|
|
2151
2299
|
style: l ? { width: l.width } : void 0,
|
|
2152
|
-
className: i("grid grid-cols-2 overflow-hidden border border-solid border-f1-border-secondary", l ? "max-w-full" :
|
|
2300
|
+
className: i("grid grid-cols-2 overflow-hidden border border-solid border-f1-border-secondary", l ? "max-w-full" : be, A, Pi),
|
|
2153
2301
|
"data-testid": "ai-chat-image-album",
|
|
2154
|
-
children:
|
|
2302
|
+
children: Ze(c ? [c] : e).map((t, o, s) => {
|
|
2155
2303
|
let c = e[t.index];
|
|
2156
2304
|
if (!c) return null;
|
|
2157
2305
|
let l = o === s.length - 1;
|
|
2158
|
-
return /* @__PURE__ */ J(
|
|
2159
|
-
image:
|
|
2306
|
+
return /* @__PURE__ */ J(Ae, {
|
|
2307
|
+
image: N(c),
|
|
2160
2308
|
aspectRatio: t.aspectRatio,
|
|
2161
2309
|
spanFull: t.span === 2,
|
|
2162
2310
|
inset: t.inset,
|
|
@@ -2172,29 +2320,29 @@ var fi = "rounded-xl", Z = "ai-chat", pi = (e) => {
|
|
|
2172
2320
|
testIdPrefix: Z,
|
|
2173
2321
|
overlay: t.hiddenCount > 0 ? /* @__PURE__ */ J("span", {
|
|
2174
2322
|
"aria-hidden": !0,
|
|
2175
|
-
className: i("absolute inset-0 flex items-center justify-center text-2xl font-semibold text-f1-foreground-inverse",
|
|
2323
|
+
className: i("absolute inset-0 flex items-center justify-center text-2xl font-semibold text-f1-foreground-inverse", et),
|
|
2176
2324
|
"data-testid": "ai-chat-image-album-more",
|
|
2177
2325
|
children: `+${t.hiddenCount}`
|
|
2178
2326
|
}) : void 0
|
|
2179
2327
|
}, `${c.name}-${t.index}`);
|
|
2180
2328
|
})
|
|
2181
2329
|
});
|
|
2182
|
-
},
|
|
2183
|
-
function
|
|
2330
|
+
}, Ji = n("F0AiFileAttachments", Fi), Yi = 2;
|
|
2331
|
+
function Xi(e, t) {
|
|
2184
2332
|
if (!e.intersectsNode(t)) return null;
|
|
2185
2333
|
let n = document.createRange();
|
|
2186
2334
|
n.selectNodeContents(t);
|
|
2187
2335
|
let r = e.cloneRange();
|
|
2188
2336
|
r.compareBoundaryPoints(Range.START_TO_START, n) < 0 && r.setStart(n.startContainer, n.startOffset), r.compareBoundaryPoints(Range.END_TO_END, n) > 0 && r.setEnd(n.endContainer, n.endOffset);
|
|
2189
2337
|
let i = r.toString().trim();
|
|
2190
|
-
if (i.length <
|
|
2338
|
+
if (i.length < Yi) return null;
|
|
2191
2339
|
let a = r.getBoundingClientRect();
|
|
2192
2340
|
return {
|
|
2193
2341
|
rect: a.width > 0 || a.height > 0 ? a : t.getBoundingClientRect(),
|
|
2194
2342
|
text: i
|
|
2195
2343
|
};
|
|
2196
2344
|
}
|
|
2197
|
-
function
|
|
2345
|
+
function Zi({ containerRef: e, enabled: t = !0 }) {
|
|
2198
2346
|
let [n, r] = q(null), i = U(() => r(null), []);
|
|
2199
2347
|
return W(() => {
|
|
2200
2348
|
if (!t || typeof window > "u") return;
|
|
@@ -2202,7 +2350,7 @@ function ki({ containerRef: e, enabled: t = !0 }) {
|
|
|
2202
2350
|
if (!n) return;
|
|
2203
2351
|
let i = () => {
|
|
2204
2352
|
let e = window.getSelection();
|
|
2205
|
-
!e || e.isCollapsed || e.rangeCount === 0 ? r(null) : r(
|
|
2353
|
+
!e || e.isCollapsed || e.rangeCount === 0 ? r(null) : r(Xi(e.getRangeAt(0), n));
|
|
2206
2354
|
}, a = () => {
|
|
2207
2355
|
window.setTimeout(i, 0);
|
|
2208
2356
|
}, o = () => {
|
|
@@ -2219,26 +2367,26 @@ function ki({ containerRef: e, enabled: t = !0 }) {
|
|
|
2219
2367
|
}
|
|
2220
2368
|
//#endregion
|
|
2221
2369
|
//#region src/addons/ai/ai/F0AiMessagesContainer/components/ReplyPopover.tsx
|
|
2222
|
-
var
|
|
2223
|
-
function
|
|
2370
|
+
var Qi = 8, $i = 8;
|
|
2371
|
+
function ea({ anchor: e, onReply: n }) {
|
|
2224
2372
|
let r = t(), a = K(null), [o, s] = q(null);
|
|
2225
|
-
if (
|
|
2373
|
+
if (sn(() => {
|
|
2226
2374
|
if (!e) {
|
|
2227
2375
|
s(null);
|
|
2228
2376
|
return;
|
|
2229
2377
|
}
|
|
2230
2378
|
let t = a.current;
|
|
2231
2379
|
if (!t) return;
|
|
2232
|
-
let n = t.offsetWidth, r = t.offsetHeight, i = window.innerWidth, o = window.innerHeight, c = e.rect.top - r -
|
|
2233
|
-
c <
|
|
2234
|
-
let l = e.rect.left + e.rect.width / 2 - n / 2, u = Math.min(Math.max(l,
|
|
2380
|
+
let n = t.offsetWidth, r = t.offsetHeight, i = window.innerWidth, o = window.innerHeight, c = e.rect.top - r - Qi;
|
|
2381
|
+
c < $i && (c = e.rect.bottom + Qi), c = Math.min(Math.max(c, $i), o - r - $i);
|
|
2382
|
+
let l = e.rect.left + e.rect.width / 2 - n / 2, u = Math.min(Math.max(l, $i), i - n - $i);
|
|
2235
2383
|
s({
|
|
2236
2384
|
top: c,
|
|
2237
2385
|
left: u
|
|
2238
2386
|
});
|
|
2239
2387
|
}, [e]), typeof document > "u" || !e) return null;
|
|
2240
2388
|
let c = r.ai.reply;
|
|
2241
|
-
return
|
|
2389
|
+
return ln(/* @__PURE__ */ J("div", {
|
|
2242
2390
|
style: {
|
|
2243
2391
|
position: "fixed",
|
|
2244
2392
|
top: o?.top ?? -9999,
|
|
@@ -2251,7 +2399,7 @@ function Mi({ anchor: e, onReply: n }) {
|
|
|
2251
2399
|
type: "button",
|
|
2252
2400
|
variant: "ghost",
|
|
2253
2401
|
label: c,
|
|
2254
|
-
icon:
|
|
2402
|
+
icon: Te,
|
|
2255
2403
|
onClick: () => {
|
|
2256
2404
|
n(e.text);
|
|
2257
2405
|
}
|
|
@@ -2260,52 +2408,55 @@ function Mi({ anchor: e, onReply: n }) {
|
|
|
2260
2408
|
}
|
|
2261
2409
|
//#endregion
|
|
2262
2410
|
//#region src/addons/ai/ai/F0AiMessagesContainer/components/AssistantMessage.tsx
|
|
2263
|
-
var
|
|
2411
|
+
var ta = en(void 0), na = () => rn(ta), ra = (e) => /* @__PURE__ */ J(ht, {
|
|
2264
2412
|
content: e,
|
|
2265
2413
|
format: "markdown"
|
|
2266
|
-
}),
|
|
2267
|
-
let
|
|
2268
|
-
containerRef:
|
|
2269
|
-
enabled: !!(
|
|
2414
|
+
}), ia = ({ isGenerating: e, isLoading: t, isLive: n = !1, message: r, renderToolCall: i, onReplyQuote: a, onRendered: o, renderMarkdown: s }) => {
|
|
2415
|
+
let c = r?.content, l = Zr(c, "assistant") ?? "", u = G(() => Xr({ content: c }), [c]), d = (r && i?.(r)) ?? r?.generativeUI?.() ?? null, f = r?.toolCalls?.[0]?.id, p = !l && !d && u.length === 0, m = K(null), { anchor: h, clear: g } = Zi({
|
|
2416
|
+
containerRef: m,
|
|
2417
|
+
enabled: !!(r?.id && l)
|
|
2270
2418
|
});
|
|
2271
2419
|
return W(() => {
|
|
2272
|
-
|
|
2420
|
+
r?.id && !t && !e && o?.(r);
|
|
2273
2421
|
}, [
|
|
2274
|
-
|
|
2422
|
+
r,
|
|
2275
2423
|
t,
|
|
2276
2424
|
e,
|
|
2277
|
-
|
|
2278
|
-
]), !t && !e &&
|
|
2279
|
-
value:
|
|
2280
|
-
children: /* @__PURE__ */
|
|
2281
|
-
|
|
2282
|
-
children:
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2425
|
+
o
|
|
2426
|
+
]), !t && !e && p ? null : /* @__PURE__ */ J(ta.Provider, {
|
|
2427
|
+
value: f,
|
|
2428
|
+
children: /* @__PURE__ */ J(ei.Provider, {
|
|
2429
|
+
value: n,
|
|
2430
|
+
children: /* @__PURE__ */ Y("div", {
|
|
2431
|
+
className: "relative isolate flex w-full flex-col items-start justify-center",
|
|
2432
|
+
children: [
|
|
2433
|
+
r && l ? /* @__PURE__ */ J("div", {
|
|
2434
|
+
ref: m,
|
|
2435
|
+
className: "w-full max-w-full [&>div]:flex [&>div]:flex-col [&>div]:gap-1",
|
|
2436
|
+
children: (s ?? ra)(l)
|
|
2437
|
+
}) : null,
|
|
2438
|
+
u.length > 0 ? /* @__PURE__ */ J("div", {
|
|
2439
|
+
className: "mt-2 w-full",
|
|
2440
|
+
children: /* @__PURE__ */ J(Ji, {
|
|
2441
|
+
files: u,
|
|
2442
|
+
align: "start"
|
|
2443
|
+
})
|
|
2444
|
+
}) : null,
|
|
2445
|
+
d ? /* @__PURE__ */ J("div", {
|
|
2446
|
+
className: "w-full",
|
|
2447
|
+
children: d
|
|
2448
|
+
}) : null,
|
|
2449
|
+
/* @__PURE__ */ J(ea, {
|
|
2450
|
+
anchor: h,
|
|
2451
|
+
onReply: (e) => {
|
|
2452
|
+
a?.(e), g(), window.getSelection()?.removeAllRanges();
|
|
2453
|
+
}
|
|
2293
2454
|
})
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
className: "w-full",
|
|
2297
|
-
children: u
|
|
2298
|
-
}) : null,
|
|
2299
|
-
/* @__PURE__ */ J(Mi, {
|
|
2300
|
-
anchor: m,
|
|
2301
|
-
onReply: (e) => {
|
|
2302
|
-
i?.(e), h(), window.getSelection()?.removeAllRanges();
|
|
2303
|
-
}
|
|
2304
|
-
})
|
|
2305
|
-
]
|
|
2455
|
+
]
|
|
2456
|
+
})
|
|
2306
2457
|
})
|
|
2307
2458
|
});
|
|
2308
|
-
},
|
|
2459
|
+
}, aa = ({ onClose: e, onSubmit: n, reactionType: r, message: i }) => {
|
|
2309
2460
|
let [a, o] = q(""), s = t(), { title: c, label: l, placeholder: u } = r === "like" ? s.ai.feedbackModal.positive : s.ai.feedbackModal.negative, d = U(() => {
|
|
2310
2461
|
n(i, a);
|
|
2311
2462
|
}, [
|
|
@@ -2322,7 +2473,7 @@ var Ni = Jt(void 0), Pi = () => Qt(Ni), Fi = (e) => /* @__PURE__ */ J(b, {
|
|
|
2322
2473
|
return document.addEventListener("keydown", e), () => {
|
|
2323
2474
|
document.removeEventListener("keydown", e);
|
|
2324
2475
|
};
|
|
2325
|
-
}, [d]), /* @__PURE__ */ J(
|
|
2476
|
+
}, [d]), /* @__PURE__ */ J(Je, {
|
|
2326
2477
|
position: "center",
|
|
2327
2478
|
isOpen: !0,
|
|
2328
2479
|
onClose: f,
|
|
@@ -2339,7 +2490,7 @@ var Ni = Jt(void 0), Pi = () => Qt(Ni), Fi = (e) => /* @__PURE__ */ J(b, {
|
|
|
2339
2490
|
},
|
|
2340
2491
|
children: /* @__PURE__ */ J("div", {
|
|
2341
2492
|
className: "flex flex-col gap-6",
|
|
2342
|
-
children: /* @__PURE__ */ J(
|
|
2493
|
+
children: /* @__PURE__ */ J(pt, {
|
|
2343
2494
|
autoFocus: !0,
|
|
2344
2495
|
label: l,
|
|
2345
2496
|
placeholder: u,
|
|
@@ -2350,7 +2501,7 @@ var Ni = Jt(void 0), Pi = () => Qt(Ni), Fi = (e) => /* @__PURE__ */ J(b, {
|
|
|
2350
2501
|
})
|
|
2351
2502
|
})
|
|
2352
2503
|
});
|
|
2353
|
-
},
|
|
2504
|
+
}, oa = en(null), sa = ({ children: e }) => {
|
|
2354
2505
|
let [t, n] = q(null), r = t ? {
|
|
2355
2506
|
isOpen: !0,
|
|
2356
2507
|
currentReaction: t.action,
|
|
@@ -2370,17 +2521,17 @@ var Ni = Jt(void 0), Pi = () => Qt(Ni), Fi = (e) => /* @__PURE__ */ J(b, {
|
|
|
2370
2521
|
}),
|
|
2371
2522
|
close: () => n(null)
|
|
2372
2523
|
};
|
|
2373
|
-
return /* @__PURE__ */ J(
|
|
2524
|
+
return /* @__PURE__ */ J(oa.Provider, {
|
|
2374
2525
|
value: r,
|
|
2375
2526
|
children: e
|
|
2376
2527
|
});
|
|
2377
|
-
},
|
|
2378
|
-
let e =
|
|
2528
|
+
}, ca = () => {
|
|
2529
|
+
let e = rn(oa);
|
|
2379
2530
|
if (e === null) throw Error("useFeedbackModal must be used within a FeedbackModalProvider");
|
|
2380
2531
|
return e;
|
|
2381
2532
|
};
|
|
2382
|
-
function
|
|
2383
|
-
let t =
|
|
2533
|
+
function la(e) {
|
|
2534
|
+
let t = ca();
|
|
2384
2535
|
return {
|
|
2385
2536
|
modal: t,
|
|
2386
2537
|
handleSubmit: (n, r) => {
|
|
@@ -2399,12 +2550,12 @@ function Vi(e) {
|
|
|
2399
2550
|
}
|
|
2400
2551
|
//#endregion
|
|
2401
2552
|
//#region src/addons/ai/ai/F0AiMessagesContainer/components/feedback/TurnFeedback.tsx
|
|
2402
|
-
var
|
|
2403
|
-
let i = t(), { open: a } =
|
|
2553
|
+
var ua = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
2554
|
+
let i = t(), { open: a } = ca(), [o, c] = q(null);
|
|
2404
2555
|
return /* @__PURE__ */ Y("div", {
|
|
2405
2556
|
className: "flex",
|
|
2406
2557
|
children: [
|
|
2407
|
-
/* @__PURE__ */ J(
|
|
2558
|
+
/* @__PURE__ */ J(se, {
|
|
2408
2559
|
size: "md",
|
|
2409
2560
|
variant: "ghost",
|
|
2410
2561
|
valueToCopy: e,
|
|
@@ -2423,9 +2574,9 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2423
2574
|
"aria-label": i.actions.thumbsUp,
|
|
2424
2575
|
children: /* @__PURE__ */ J("div", {
|
|
2425
2576
|
className: "flex min-w-0 flex-1 items-center justify-center gap-1",
|
|
2426
|
-
children: /* @__PURE__ */ J(
|
|
2577
|
+
children: /* @__PURE__ */ J(V, {
|
|
2427
2578
|
size: "md",
|
|
2428
|
-
icon: o === "like" ?
|
|
2579
|
+
icon: o === "like" ? I : ae,
|
|
2429
2580
|
color: "default"
|
|
2430
2581
|
})
|
|
2431
2582
|
})
|
|
@@ -2441,16 +2592,16 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2441
2592
|
"aria-label": i.actions.thumbsDown,
|
|
2442
2593
|
children: /* @__PURE__ */ J("div", {
|
|
2443
2594
|
className: "flex min-w-0 flex-1 items-center justify-center gap-1",
|
|
2444
|
-
children: /* @__PURE__ */ J(
|
|
2595
|
+
children: /* @__PURE__ */ J(V, {
|
|
2445
2596
|
size: "md",
|
|
2446
|
-
icon: o === "dislike" ?
|
|
2597
|
+
icon: o === "dislike" ? w : k,
|
|
2447
2598
|
color: "default"
|
|
2448
2599
|
})
|
|
2449
2600
|
})
|
|
2450
2601
|
})
|
|
2451
2602
|
]
|
|
2452
2603
|
});
|
|
2453
|
-
},
|
|
2604
|
+
}, da = ({ position: e }) => /* @__PURE__ */ J(c.div, {
|
|
2454
2605
|
transition: {
|
|
2455
2606
|
duration: .2,
|
|
2456
2607
|
ease: "easeOut"
|
|
@@ -2466,21 +2617,21 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2466
2617
|
"bg-gradient-to-t from-f1-background dark:from-f1-background-secondary to-transparent",
|
|
2467
2618
|
"after:bottom-0"
|
|
2468
2619
|
])
|
|
2469
|
-
}),
|
|
2620
|
+
}), fa = ({ icon: e, title: t, children: n, open: r, defaultOpen: a = !1, onOpenChange: o, lockOpen: s = !1 }) => {
|
|
2470
2621
|
let [u, d] = q(a), f = l(), p = r !== void 0, m = p ? r : u;
|
|
2471
|
-
return /* @__PURE__ */ Y(
|
|
2622
|
+
return /* @__PURE__ */ Y(Qe, {
|
|
2472
2623
|
className: "mb-1 w-full",
|
|
2473
2624
|
open: m,
|
|
2474
2625
|
onOpenChange: (e) => {
|
|
2475
2626
|
s || (p || d(e), o?.(e));
|
|
2476
2627
|
},
|
|
2477
|
-
children: [/* @__PURE__ */ Y(
|
|
2628
|
+
children: [/* @__PURE__ */ Y(Le, {
|
|
2478
2629
|
disabled: s,
|
|
2479
2630
|
className: i("gap-1", s ? "flex w-full items-center text-base text-f1-foreground-secondary" : "flex w-full items-center text-base text-f1-foreground-secondary transition-colors duration-150 hover:text-f1-foreground [&[data-state=open]>svg]:rotate-90"),
|
|
2480
2631
|
children: [
|
|
2481
2632
|
/* @__PURE__ */ J("span", {
|
|
2482
2633
|
className: "flex items-center justify-start h-6 w-6",
|
|
2483
|
-
children: /* @__PURE__ */ J(
|
|
2634
|
+
children: /* @__PURE__ */ J(V, {
|
|
2484
2635
|
icon: e,
|
|
2485
2636
|
className: "block"
|
|
2486
2637
|
})
|
|
@@ -2489,9 +2640,9 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2489
2640
|
className: "min-h-6 flex items-center",
|
|
2490
2641
|
children: /* @__PURE__ */ J("span", { children: t })
|
|
2491
2642
|
}),
|
|
2492
|
-
s ? null : /* @__PURE__ */ J(
|
|
2643
|
+
s ? null : /* @__PURE__ */ J(V, { icon: Pt })
|
|
2493
2644
|
]
|
|
2494
|
-
}), /* @__PURE__ */ J(
|
|
2645
|
+
}), /* @__PURE__ */ J(Be, {
|
|
2495
2646
|
forceMount: !0,
|
|
2496
2647
|
className: "data-[state=open]:mt-3",
|
|
2497
2648
|
children: /* @__PURE__ */ J(c.div, {
|
|
@@ -2515,7 +2666,7 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2515
2666
|
})
|
|
2516
2667
|
})]
|
|
2517
2668
|
});
|
|
2518
|
-
},
|
|
2669
|
+
}, pa = 1e3, ma = 1e3, ha = ({ startedAt: e }) => {
|
|
2519
2670
|
let n = t(), [r, i] = q(() => e === null ? 0 : Date.now() - e);
|
|
2520
2671
|
if (W(() => {
|
|
2521
2672
|
if (e === null) {
|
|
@@ -2525,9 +2676,9 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2525
2676
|
i(Date.now() - e);
|
|
2526
2677
|
let t = setInterval(() => {
|
|
2527
2678
|
i(Date.now() - e);
|
|
2528
|
-
},
|
|
2679
|
+
}, ma);
|
|
2529
2680
|
return () => clearInterval(t);
|
|
2530
|
-
}, [e]), e === null || r <
|
|
2681
|
+
}, [e]), e === null || r < pa) return null;
|
|
2531
2682
|
let a = Math.floor(r / 1e3), o = Math.floor(a / 60), s = a % 60, c = o > 0 ? n.t("ai.thinkingElapsedMinutes", {
|
|
2532
2683
|
minutes: o,
|
|
2533
2684
|
seconds: s
|
|
@@ -2540,14 +2691,14 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2540
2691
|
children: "·"
|
|
2541
2692
|
}), c]
|
|
2542
2693
|
});
|
|
2543
|
-
},
|
|
2694
|
+
}, ga = ({ titles: e, title: n, inProgress: r, isWriting: i, startedAt: a = null }) => {
|
|
2544
2695
|
let o = t(), [s, c] = q(!!r), l = K(r);
|
|
2545
2696
|
W(() => {
|
|
2546
2697
|
l.current && !r ? c(!1) : r && !s && c(!0), l.current = r;
|
|
2547
2698
|
}, [r, s]);
|
|
2548
2699
|
let u = r ? o.ai.thoughtsGroupTitle : n ?? o.ai.thoughtsGroupTitle, d = e.length - 1, f = (e) => !r || i ? "completed" : e === d ? "executing" : "completed";
|
|
2549
|
-
return /* @__PURE__ */ J(
|
|
2550
|
-
icon:
|
|
2700
|
+
return /* @__PURE__ */ J(fa, {
|
|
2701
|
+
icon: te,
|
|
2551
2702
|
title: u,
|
|
2552
2703
|
open: s,
|
|
2553
2704
|
onOpenChange: c,
|
|
@@ -2556,10 +2707,10 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2556
2707
|
className: "flex flex-col gap-3 pb-4",
|
|
2557
2708
|
children: e.map((t, n) => /* @__PURE__ */ Y("div", {
|
|
2558
2709
|
className: "relative",
|
|
2559
|
-
children: [/* @__PURE__ */ J(
|
|
2710
|
+
children: [/* @__PURE__ */ J(He, {
|
|
2560
2711
|
title: t,
|
|
2561
2712
|
status: f(n),
|
|
2562
|
-
suffix: f(n) === "executing" ? /* @__PURE__ */ J(
|
|
2713
|
+
suffix: f(n) === "executing" ? /* @__PURE__ */ J(ha, { startedAt: a }) : void 0,
|
|
2563
2714
|
inGroup: !0
|
|
2564
2715
|
}), n < e.length - 1 ? /* @__PURE__ */ J("div", {
|
|
2565
2716
|
"aria-hidden": !0,
|
|
@@ -2568,27 +2719,27 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2568
2719
|
}, n))
|
|
2569
2720
|
})
|
|
2570
2721
|
});
|
|
2571
|
-
},
|
|
2722
|
+
}, _a = (e) => /* @__PURE__ */ J(ht, {
|
|
2572
2723
|
content: e,
|
|
2573
2724
|
format: "markdown"
|
|
2574
|
-
}),
|
|
2725
|
+
}), va = ({ text: e, renderMarkdown: t }) => /* @__PURE__ */ Y("div", {
|
|
2575
2726
|
className: "flex max-w-[90%] items-start gap-2 self-end pb-1 pr-2 text-f1-foreground-tertiary",
|
|
2576
2727
|
children: [/* @__PURE__ */ J("div", {
|
|
2577
2728
|
className: "flex h-5 items-center",
|
|
2578
|
-
children: /* @__PURE__ */ J(
|
|
2729
|
+
children: /* @__PURE__ */ J(V, { icon: Se })
|
|
2579
2730
|
}), /* @__PURE__ */ J("div", {
|
|
2580
2731
|
className: "min-w-0 whitespace-pre-wrap text-base leading-5 [&>div]:flex [&>div]:flex-col [&>div]:gap-1 [&_p]:m-0",
|
|
2581
|
-
children: (t ??
|
|
2732
|
+
children: (t ?? _a)(e)
|
|
2582
2733
|
})]
|
|
2583
|
-
}),
|
|
2734
|
+
}), ya = ({ message: e, onReplyQuote: t, autoScrollIntoView: n = !0, renderMarkdown: r }) => {
|
|
2584
2735
|
let i = K(null), a = K(null), o = K(n);
|
|
2585
2736
|
W(() => {
|
|
2586
2737
|
o.current && i.current?.scrollIntoView({ behavior: "smooth" });
|
|
2587
2738
|
}, []);
|
|
2588
|
-
let s = e?.content, c = e?.rawData, l = G(() =>
|
|
2739
|
+
let s = e?.content, c = e?.rawData, l = G(() => Xr({
|
|
2589
2740
|
content: s,
|
|
2590
2741
|
rawData: c
|
|
2591
|
-
}), [s, c]), u = (
|
|
2742
|
+
}), [s, c]), u = (Zr(s, "user") ?? "").trim(), d = e?.replyQuote ?? null, f = u.length > 0, { anchor: p, clear: m } = Zi({
|
|
2592
2743
|
containerRef: a,
|
|
2593
2744
|
enabled: f
|
|
2594
2745
|
});
|
|
@@ -2596,13 +2747,13 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2596
2747
|
ref: i,
|
|
2597
2748
|
className: "my-4 flex w-full flex-col items-end gap-2 first:mt-0 last:mb-0",
|
|
2598
2749
|
children: [
|
|
2599
|
-
d ? /* @__PURE__ */ J(
|
|
2750
|
+
d ? /* @__PURE__ */ J(va, {
|
|
2600
2751
|
text: d,
|
|
2601
2752
|
renderMarkdown: r
|
|
2602
2753
|
}) : null,
|
|
2603
2754
|
l.length > 0 ? /* @__PURE__ */ J("div", {
|
|
2604
2755
|
className: "flex w-full max-w-[90%] justify-end",
|
|
2605
|
-
children: /* @__PURE__ */ J(
|
|
2756
|
+
children: /* @__PURE__ */ J(Ji, {
|
|
2606
2757
|
files: l,
|
|
2607
2758
|
align: "end",
|
|
2608
2759
|
size: "compact"
|
|
@@ -2611,9 +2762,9 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2611
2762
|
f ? /* @__PURE__ */ J("div", {
|
|
2612
2763
|
ref: a,
|
|
2613
2764
|
className: "w-fit max-w-[90%] self-end whitespace-pre-wrap rounded-xl bg-f1-background-tertiary px-4 py-3 [&>div]:flex [&>div]:flex-col [&>div]:gap-1",
|
|
2614
|
-
children: (r ??
|
|
2765
|
+
children: (r ?? _a)(u)
|
|
2615
2766
|
}) : null,
|
|
2616
|
-
/* @__PURE__ */ J(
|
|
2767
|
+
/* @__PURE__ */ J(ea, {
|
|
2617
2768
|
anchor: p,
|
|
2618
2769
|
onReply: (e) => {
|
|
2619
2770
|
t?.(e), m(), window.getSelection()?.removeAllRanges();
|
|
@@ -2621,7 +2772,7 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2621
2772
|
})
|
|
2622
2773
|
]
|
|
2623
2774
|
});
|
|
2624
|
-
},
|
|
2775
|
+
}, ba = 35, xa = 22, Sa = 400, Ca = 2500, wa = 220, Ta = ({ phrase: e, typed: t, phraseIndex: n, onClick: r }) => {
|
|
2625
2776
|
let a = l(), o = !!r;
|
|
2626
2777
|
return /* @__PURE__ */ Y("p", {
|
|
2627
2778
|
role: o ? "button" : void 0,
|
|
@@ -2641,21 +2792,21 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2641
2792
|
children: a ? e : e.slice(0, t)
|
|
2642
2793
|
})]
|
|
2643
2794
|
}, n);
|
|
2644
|
-
},
|
|
2795
|
+
}, Ea = ({ messages: e, caption: t, subtitle: n, cta: r, onClick: a, fullscreen: o = !1 }) => {
|
|
2645
2796
|
let [s, c] = q(0), [d, f] = q(0), [p, m] = q("starting"), h = l(), g = e[s] ?? "", _ = e.join("\0"), v = K(!0);
|
|
2646
2797
|
return W(() => {
|
|
2647
2798
|
v.current ? v.current = !1 : (c(0), f(0), m("writing"));
|
|
2648
2799
|
}, [_]), W(() => {
|
|
2649
2800
|
if (h) return;
|
|
2650
2801
|
let t;
|
|
2651
|
-
if (p === "starting") t = setTimeout(() => m("writing"),
|
|
2652
|
-
else if (p === "writing") d < g.length ? t = setTimeout(() => f((e) => e + 1),
|
|
2802
|
+
if (p === "starting") t = setTimeout(() => m("writing"), Sa);
|
|
2803
|
+
else if (p === "writing") d < g.length ? t = setTimeout(() => f((e) => e + 1), ba) : m("holding");
|
|
2653
2804
|
else if (p === "holding") {
|
|
2654
2805
|
if (e.length <= 1) return;
|
|
2655
|
-
t = setTimeout(() => m("erasing"),
|
|
2656
|
-
} else p === "erasing" && (t = d > 0 ? setTimeout(() => f((e) => e - 1),
|
|
2806
|
+
t = setTimeout(() => m("erasing"), Ca);
|
|
2807
|
+
} else p === "erasing" && (t = d > 0 ? setTimeout(() => f((e) => e - 1), xa) : setTimeout(() => {
|
|
2657
2808
|
c((t) => (t + 1) % e.length), m("starting");
|
|
2658
|
-
},
|
|
2809
|
+
}, wa));
|
|
2659
2810
|
return () => {
|
|
2660
2811
|
t && clearTimeout(t);
|
|
2661
2812
|
};
|
|
@@ -2682,7 +2833,7 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2682
2833
|
className: "animate-in fade-in-0 text-center text-2xl font-semibold leading-[28px] text-f1-foreground-secondary duration-500",
|
|
2683
2834
|
children: t
|
|
2684
2835
|
}) : null,
|
|
2685
|
-
/* @__PURE__ */ J(
|
|
2836
|
+
/* @__PURE__ */ J(Ta, {
|
|
2686
2837
|
phrase: g,
|
|
2687
2838
|
typed: d,
|
|
2688
2839
|
phraseIndex: s,
|
|
@@ -2695,80 +2846,7 @@ var Hi = ({ content: e, targetMessage: n, onCopy: r }) => {
|
|
|
2695
2846
|
]
|
|
2696
2847
|
})
|
|
2697
2848
|
});
|
|
2698
|
-
},
|
|
2699
|
-
if (!e) return null;
|
|
2700
|
-
let t = e.closest(`[${ca}]`);
|
|
2701
|
-
if (t) return t;
|
|
2702
|
-
let n = e.closest(`[${la}]`);
|
|
2703
|
-
if (!n) return null;
|
|
2704
|
-
let r = e;
|
|
2705
|
-
for (; r.parentElement && r.parentElement !== n;) r = r.parentElement;
|
|
2706
|
-
return r.parentElement === n ? r : n;
|
|
2707
|
-
}, da = (e, t) => t.getBoundingClientRect().top - e.getBoundingClientRect().top, fa = (e) => e.scrollHeight - e.scrollTop - e.clientHeight <= sa;
|
|
2708
|
-
function pa({ viewportRef: e, contentRef: t }) {
|
|
2709
|
-
W(() => {
|
|
2710
|
-
let n = e.current, r = t.current;
|
|
2711
|
-
if (!n || !r || typeof ResizeObserver > "u") return;
|
|
2712
|
-
let i = n.clientWidth, a = null, o, s = !1, c = null, l = () => {
|
|
2713
|
-
let e = n.getBoundingClientRect(), t = r.querySelector(`[${la}]`)?.parentElement, i = t ? t.getBoundingClientRect().left + t.clientWidth / 2 : e.left + e.width / 2, a = ua(typeof document.elementFromPoint == "function" ? document.elementFromPoint(i, e.top + 8) : null);
|
|
2714
|
-
return a && n.contains(a) ? {
|
|
2715
|
-
kind: "element",
|
|
2716
|
-
element: a,
|
|
2717
|
-
offset: da(n, a)
|
|
2718
|
-
} : null;
|
|
2719
|
-
}, u = null, d = () => {
|
|
2720
|
-
u = fa(n) ? { kind: "bottom" } : l();
|
|
2721
|
-
}, f = () => c && c.element.isConnected && performance.now() - c.at < oa ? {
|
|
2722
|
-
kind: "element",
|
|
2723
|
-
element: c.element,
|
|
2724
|
-
offset: c.offset
|
|
2725
|
-
} : u, p = () => {
|
|
2726
|
-
if (!a || s) return;
|
|
2727
|
-
let e = a.kind === "bottom" ? n.scrollHeight - n.clientHeight : a.element.isConnected ? n.scrollTop + da(n, a.element) - a.offset : null;
|
|
2728
|
-
if (e === null) return;
|
|
2729
|
-
let t = Math.round(e);
|
|
2730
|
-
Math.abs(t - n.scrollTop) >= 1 && (n.scrollTop = t);
|
|
2731
|
-
}, m = new ResizeObserver(() => {
|
|
2732
|
-
let e = n.clientWidth;
|
|
2733
|
-
i === 0 && (i = e), e !== i && (a ||= (s = !1, f()), i = e, window.clearTimeout(o), o = window.setTimeout(() => {
|
|
2734
|
-
a = null, d();
|
|
2735
|
-
}, aa)), a ? p() : d();
|
|
2736
|
-
});
|
|
2737
|
-
m.observe(n), m.observe(r), d();
|
|
2738
|
-
let h = 0, g = () => {
|
|
2739
|
-
a || h || (h = window.requestAnimationFrame(() => {
|
|
2740
|
-
h = 0, d();
|
|
2741
|
-
}));
|
|
2742
|
-
}, _ = (e) => {
|
|
2743
|
-
let t = ua(e.target);
|
|
2744
|
-
c = t ? {
|
|
2745
|
-
element: t,
|
|
2746
|
-
offset: da(n, t),
|
|
2747
|
-
at: performance.now()
|
|
2748
|
-
} : null;
|
|
2749
|
-
}, v = () => {
|
|
2750
|
-
a && (s = !0);
|
|
2751
|
-
}, y = (e) => {
|
|
2752
|
-
[
|
|
2753
|
-
"PageUp",
|
|
2754
|
-
"PageDown",
|
|
2755
|
-
"Home",
|
|
2756
|
-
"End",
|
|
2757
|
-
"ArrowUp",
|
|
2758
|
-
"ArrowDown",
|
|
2759
|
-
" "
|
|
2760
|
-
].includes(e.key) && e.target === n && v();
|
|
2761
|
-
}, b = (e) => {
|
|
2762
|
-
e.target === n && v();
|
|
2763
|
-
};
|
|
2764
|
-
return n.addEventListener("scroll", g, { passive: !0 }), r.addEventListener("pointerdown", _, !0), r.addEventListener("keydown", _, !0), n.addEventListener("wheel", v, { passive: !0 }), n.addEventListener("touchmove", v, { passive: !0 }), n.addEventListener("keydown", y), n.addEventListener("pointerdown", b), () => {
|
|
2765
|
-
m.disconnect(), window.clearTimeout(o), window.cancelAnimationFrame(h), n.removeEventListener("scroll", g), r.removeEventListener("pointerdown", _, !0), r.removeEventListener("keydown", _, !0), n.removeEventListener("wheel", v), n.removeEventListener("touchmove", v), n.removeEventListener("keydown", y), n.removeEventListener("pointerdown", b);
|
|
2766
|
-
};
|
|
2767
|
-
}, [e, t]);
|
|
2768
|
-
}
|
|
2769
|
-
//#endregion
|
|
2770
|
-
//#region src/addons/ai/ai/F0AiMessagesContainer/hooks/useThinkingClock.ts
|
|
2771
|
-
var ma = (e, t) => {
|
|
2849
|
+
}, Da = (e, t) => {
|
|
2772
2850
|
let [n, r] = q(null);
|
|
2773
2851
|
return W(() => {
|
|
2774
2852
|
r(e ? (e) => e ?? t ?? Date.now() : null);
|
|
@@ -2776,7 +2854,7 @@ var ma = (e, t) => {
|
|
|
2776
2854
|
};
|
|
2777
2855
|
//#endregion
|
|
2778
2856
|
//#region src/addons/ai/ai/F0AiMessagesContainer/useMessageScroll.ts
|
|
2779
|
-
function
|
|
2857
|
+
function Oa({ viewportRef: e, contentRef: t, endRef: n, lastTurnRef: r, turnsCount: i, freezeTurnMinHeight: a = !1 }) {
|
|
2780
2858
|
let [o, s] = q(0), [c, l] = q(!1), u = K(i), d = K(a);
|
|
2781
2859
|
d.current = a;
|
|
2782
2860
|
let f = U((e = "smooth") => {
|
|
@@ -2825,33 +2903,33 @@ function ha({ viewportRef: e, contentRef: t, endRef: n, lastTurnRef: r, turnsCou
|
|
|
2825
2903
|
}
|
|
2826
2904
|
//#endregion
|
|
2827
2905
|
//#region src/addons/ai/ai/F0AiMessagesContainer/F0AiMessagesContainer.tsx
|
|
2828
|
-
var
|
|
2906
|
+
var ka = {
|
|
2829
2907
|
threadId: "",
|
|
2830
2908
|
onThumbsUp: () => {},
|
|
2831
2909
|
onThumbsDown: () => {}
|
|
2832
|
-
},
|
|
2833
|
-
let t =
|
|
2834
|
-
return e.filePreviews || !t.provided ? /* @__PURE__ */ J(
|
|
2910
|
+
}, Aa = (e) => {
|
|
2911
|
+
let t = Me(), n = /* @__PURE__ */ J(sa, { children: /* @__PURE__ */ J(ja, { ...e }) });
|
|
2912
|
+
return e.filePreviews || !t.provided ? /* @__PURE__ */ J(mt, {
|
|
2835
2913
|
filePreviews: e.filePreviews,
|
|
2836
2914
|
children: n
|
|
2837
2915
|
}) : n;
|
|
2838
|
-
},
|
|
2839
|
-
let { modal:
|
|
2840
|
-
let e = a ??
|
|
2916
|
+
}, ja = ({ turns: e, isLoadingThread: n = !1, interrupt: r, initialMessage: a, initialMessageCaption: o, initialMessageSubtitle: s, initialMessageCta: l, onWelcomeClick: d, renderToolCall: f, onReplyQuote: m, onAssistantMessageRendered: h, autoScrollUserIntoView: g = !0, renderMarkdown: _, feedback: v, freezeLayout: y = !1, noShadows: b = !1, fullscreen: x = !1, children: S, AssistantMessage: C, UserMessage: w, onRegenerate: T, onCopy: E }) => {
|
|
2917
|
+
let { modal: D, handleSubmit: O, handleClose: ee } = la(v ?? ka), k = t(), A = C ?? ia, j = w ?? ya, M = G(() => {
|
|
2918
|
+
let e = a ?? k.ai.defaultInitialMessage;
|
|
2841
2919
|
return (Array.isArray(e) ? e : [e]).filter((e) => typeof e == "string" && e.length > 0);
|
|
2842
|
-
}, [a,
|
|
2843
|
-
viewportRef:
|
|
2844
|
-
contentRef:
|
|
2920
|
+
}, [a, k.ai.defaultInitialMessage]), N = !n && e.length === 0 && M.length > 0, P = K(null), F = K(null), te = K(null), ne = K(null), re = K(null), { showScrollBtn: I, turnMinHeight: ie, scrollToBottom: L } = Oa({
|
|
2921
|
+
viewportRef: P,
|
|
2922
|
+
contentRef: F,
|
|
2845
2923
|
endRef: te,
|
|
2846
2924
|
lastTurnRef: re,
|
|
2847
2925
|
turnsCount: e.length,
|
|
2848
2926
|
freezeTurnMinHeight: y
|
|
2849
2927
|
});
|
|
2850
|
-
|
|
2851
|
-
viewportRef:
|
|
2852
|
-
contentRef:
|
|
2928
|
+
Ai({
|
|
2929
|
+
viewportRef: P,
|
|
2930
|
+
contentRef: F
|
|
2853
2931
|
});
|
|
2854
|
-
let
|
|
2932
|
+
let R = e[e.length - 1], ae = Da(!(!R || R.endIndicator !== "thinking" && !R.thinking?.inProgress), R?.thinking?.startedAt), oe = R?.endIndicator === "asking", se = ni(e.flatMap((e) => e.assistantMessages.flatMap((e) => e.id ? [e.id] : [])), n), ce = (t, n) => {
|
|
2855
2933
|
let r = n === e.length - 1, a = {
|
|
2856
2934
|
renderToolCall: f,
|
|
2857
2935
|
onReplyQuote: m,
|
|
@@ -2864,95 +2942,96 @@ var ga = {
|
|
|
2864
2942
|
inProgress: t.isInProgress,
|
|
2865
2943
|
index: r,
|
|
2866
2944
|
isCurrentMessage: !1,
|
|
2867
|
-
AssistantMessage:
|
|
2868
|
-
UserMessage:
|
|
2869
|
-
onRegenerate:
|
|
2870
|
-
onCopy:
|
|
2945
|
+
AssistantMessage: A,
|
|
2946
|
+
UserMessage: j,
|
|
2947
|
+
onRegenerate: T,
|
|
2948
|
+
onCopy: E,
|
|
2871
2949
|
rawData: e.rawData || {},
|
|
2872
2950
|
...a
|
|
2873
2951
|
};
|
|
2874
|
-
return /* @__PURE__ */ J(
|
|
2952
|
+
return /* @__PURE__ */ J(j, { ...i }, `${n}-u-${r}`);
|
|
2875
2953
|
}, s = (e, i) => {
|
|
2876
2954
|
let o = r && i === t.assistantMessages.length - 1, s = t.userMessages.length + i, c = {
|
|
2877
2955
|
message: e,
|
|
2878
2956
|
inProgress: t.isInProgress,
|
|
2879
2957
|
index: s,
|
|
2880
2958
|
isCurrentMessage: o,
|
|
2881
|
-
AssistantMessage:
|
|
2882
|
-
UserMessage:
|
|
2883
|
-
onRegenerate:
|
|
2884
|
-
onCopy:
|
|
2959
|
+
AssistantMessage: A,
|
|
2960
|
+
UserMessage: j,
|
|
2961
|
+
onRegenerate: T,
|
|
2962
|
+
onCopy: E,
|
|
2885
2963
|
rawData: e.rawData || {},
|
|
2886
2964
|
...a
|
|
2887
2965
|
};
|
|
2888
|
-
return /* @__PURE__ */ J(
|
|
2966
|
+
return /* @__PURE__ */ J(A, {
|
|
2889
2967
|
...c,
|
|
2890
2968
|
isGenerating: t.isInProgress && o,
|
|
2891
|
-
|
|
2969
|
+
isLive: t.isInProgress || se(e.id),
|
|
2970
|
+
isLoading: t.isInProgress && o && !Ma(e)
|
|
2892
2971
|
}, `${n}-a-${i}`);
|
|
2893
2972
|
};
|
|
2894
2973
|
return /* @__PURE__ */ Y("div", {
|
|
2895
2974
|
ref: r ? re : void 0,
|
|
2896
2975
|
className: i("flex flex-col items-start justify-start gap-2 px-1", r && "pb-5"),
|
|
2897
|
-
[
|
|
2898
|
-
style: { minHeight: r &&
|
|
2976
|
+
[Ei]: n,
|
|
2977
|
+
style: { minHeight: r && ie || void 0 },
|
|
2899
2978
|
children: [
|
|
2900
2979
|
t.userMessages.map((e, t) => o(e, t)),
|
|
2901
|
-
t.thinking && t.thinking.titles.length > 0 ? /* @__PURE__ */ J(
|
|
2980
|
+
t.thinking && t.thinking.titles.length > 0 ? /* @__PURE__ */ J(ga, {
|
|
2902
2981
|
titles: t.thinking.titles,
|
|
2903
|
-
title:
|
|
2982
|
+
title: k.ai.thoughtsGroupTitle,
|
|
2904
2983
|
inProgress: t.thinking.inProgress,
|
|
2905
2984
|
isWriting: t.thinking.isWriting,
|
|
2906
2985
|
startedAt: r ? ae : null
|
|
2907
2986
|
}) : null,
|
|
2908
2987
|
t.assistantMessages.map((e, t) => s(e, t)),
|
|
2909
|
-
t.endIndicator === "thinking" ? /* @__PURE__ */ J(
|
|
2910
|
-
title:
|
|
2988
|
+
t.endIndicator === "thinking" ? /* @__PURE__ */ J(He, {
|
|
2989
|
+
title: k.ai.thinking,
|
|
2911
2990
|
status: "executing",
|
|
2912
|
-
suffix: /* @__PURE__ */ J(
|
|
2991
|
+
suffix: /* @__PURE__ */ J(ha, { startedAt: ae })
|
|
2913
2992
|
}) : null,
|
|
2914
|
-
t.endIndicator === "activity" ? /* @__PURE__ */ J(
|
|
2915
|
-
t.endIndicator === "asking" ? /* @__PURE__ */ J(
|
|
2916
|
-
title:
|
|
2993
|
+
t.endIndicator === "activity" ? /* @__PURE__ */ J(He, { status: "writing" }) : null,
|
|
2994
|
+
t.endIndicator === "asking" ? /* @__PURE__ */ J(He, {
|
|
2995
|
+
title: k.ai.askingQuestions,
|
|
2917
2996
|
status: "asking"
|
|
2918
2997
|
}) : null,
|
|
2919
|
-
t.feedback && t.endIndicator !== "asking" ? /* @__PURE__ */ J(
|
|
2998
|
+
t.feedback && t.endIndicator !== "asking" ? /* @__PURE__ */ J(ua, {
|
|
2920
2999
|
content: t.feedback.content,
|
|
2921
3000
|
targetMessage: t.feedback.targetMessage,
|
|
2922
|
-
onCopy:
|
|
3001
|
+
onCopy: E
|
|
2923
3002
|
}) : null,
|
|
2924
|
-
r ? /* @__PURE__ */ J(
|
|
3003
|
+
r ? /* @__PURE__ */ J(xi, {}) : null
|
|
2925
3004
|
]
|
|
2926
3005
|
}, `turn-${n}`);
|
|
2927
3006
|
};
|
|
2928
|
-
return /* @__PURE__ */ Y(
|
|
3007
|
+
return /* @__PURE__ */ Y(cn, { children: [/* @__PURE__ */ Y("div", {
|
|
2929
3008
|
className: "relative flex flex-1 flex-col overflow-hidden",
|
|
2930
3009
|
children: [
|
|
2931
3010
|
/* @__PURE__ */ J("div", {
|
|
2932
3011
|
role: "status",
|
|
2933
3012
|
className: "sr-only",
|
|
2934
|
-
children: oe ?
|
|
3013
|
+
children: oe ? k.ai.askingQuestions : ""
|
|
2935
3014
|
}),
|
|
2936
3015
|
/* @__PURE__ */ J("div", {
|
|
2937
|
-
ref:
|
|
3016
|
+
ref: P,
|
|
2938
3017
|
className: i("flex-1 overflow-y-scroll [overflow-anchor:none]", "[scrollbar-width:thin] [scrollbar-color:transparent_transparent]", "hover:[scrollbar-color:var(--scrollbar-thumb)_transparent]", "[&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent", "[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-transparent", "hover:[&::-webkit-scrollbar-thumb]:bg-f1-background-inverse/30"),
|
|
2939
3018
|
children: /* @__PURE__ */ Y("div", {
|
|
2940
|
-
ref:
|
|
3019
|
+
ref: F,
|
|
2941
3020
|
className: "flex min-h-full flex-col items-center px-4 pb-[calc(1rem+var(--f0-ai-composer-overlap,0px))] pt-4",
|
|
2942
3021
|
children: [
|
|
2943
3022
|
/* @__PURE__ */ Y("div", {
|
|
2944
|
-
className: i(
|
|
3023
|
+
className: i(N ? "flex flex-1" : "flex flex-col gap-6", "w-full max-w-content"),
|
|
2945
3024
|
children: [
|
|
2946
|
-
n ? /* @__PURE__ */ J(
|
|
2947
|
-
|
|
2948
|
-
messages:
|
|
3025
|
+
n ? /* @__PURE__ */ J(Na, {}) : null,
|
|
3026
|
+
N ? /* @__PURE__ */ J(Ea, {
|
|
3027
|
+
messages: M,
|
|
2949
3028
|
caption: o,
|
|
2950
3029
|
subtitle: s,
|
|
2951
3030
|
cta: l,
|
|
2952
3031
|
onClick: d,
|
|
2953
3032
|
fullscreen: x
|
|
2954
3033
|
}) : null,
|
|
2955
|
-
n ? null : e.map((e, t) =>
|
|
3034
|
+
n ? null : e.map((e, t) => ce(e, t)),
|
|
2956
3035
|
r
|
|
2957
3036
|
]
|
|
2958
3037
|
}),
|
|
@@ -2966,7 +3045,7 @@ var ga = {
|
|
|
2966
3045
|
ref: te,
|
|
2967
3046
|
children: S
|
|
2968
3047
|
}),
|
|
2969
|
-
/* @__PURE__ */ J(p, { children:
|
|
3048
|
+
/* @__PURE__ */ J(p, { children: I ? /* @__PURE__ */ J(c.div, {
|
|
2970
3049
|
className: "sticky bottom-[calc(0.5rem+var(--f0-ai-composer-overlap,0px))] z-10 flex justify-center",
|
|
2971
3050
|
initial: {
|
|
2972
3051
|
opacity: 0,
|
|
@@ -2982,25 +3061,25 @@ var ga = {
|
|
|
2982
3061
|
},
|
|
2983
3062
|
transition: { duration: .2 },
|
|
2984
3063
|
children: /* @__PURE__ */ J(u, {
|
|
2985
|
-
onClick: () =>
|
|
2986
|
-
label:
|
|
3064
|
+
onClick: () => L(),
|
|
3065
|
+
label: k.ai.scrollToBottom,
|
|
2987
3066
|
variant: "neutral",
|
|
2988
|
-
icon:
|
|
3067
|
+
icon: At,
|
|
2989
3068
|
hideLabel: !0
|
|
2990
3069
|
})
|
|
2991
3070
|
}) : null })
|
|
2992
3071
|
]
|
|
2993
3072
|
})
|
|
2994
3073
|
}),
|
|
2995
|
-
!b && !
|
|
3074
|
+
!b && !N ? /* @__PURE__ */ J(da, { position: "top" }, "shadow-top") : null
|
|
2996
3075
|
]
|
|
2997
|
-
}),
|
|
2998
|
-
onSubmit:
|
|
3076
|
+
}), D.isOpen ? /* @__PURE__ */ J(aa, {
|
|
3077
|
+
onSubmit: O,
|
|
2999
3078
|
onClose: ee,
|
|
3000
|
-
reactionType:
|
|
3001
|
-
message:
|
|
3079
|
+
reactionType: D.currentReaction,
|
|
3080
|
+
message: D.currentMessage
|
|
3002
3081
|
}) : null] });
|
|
3003
|
-
},
|
|
3082
|
+
}, Ma = (e) => !!Zr(e.content) || Xr(e).length > 0, Na = () => /* @__PURE__ */ J("div", {
|
|
3004
3083
|
className: "flex h-full w-full max-w-content flex-col gap-6",
|
|
3005
3084
|
children: /* @__PURE__ */ Y("div", {
|
|
3006
3085
|
className: "flex flex-col gap-2",
|
|
@@ -3014,33 +3093,33 @@ var ga = {
|
|
|
3014
3093
|
/* @__PURE__ */ J(r, { className: "h-5 w-4/5 rounded-md" })
|
|
3015
3094
|
]
|
|
3016
3095
|
})
|
|
3017
|
-
}),
|
|
3018
|
-
function
|
|
3019
|
-
return /* @__PURE__ */ J(
|
|
3096
|
+
}), Pa = { ai: _t.ai }, Fa = en(null);
|
|
3097
|
+
function Ia({ children: e, translations: t }) {
|
|
3098
|
+
return /* @__PURE__ */ J(Fa.Provider, {
|
|
3020
3099
|
value: t,
|
|
3021
3100
|
children: e
|
|
3022
3101
|
});
|
|
3023
3102
|
}
|
|
3024
|
-
function
|
|
3025
|
-
let e =
|
|
3103
|
+
function La() {
|
|
3104
|
+
let e = rn(Fa);
|
|
3026
3105
|
if (e === null) throw Error("useAiChatTranslations must be used within an AiChatTranslationsProvider");
|
|
3027
3106
|
return e;
|
|
3028
3107
|
}
|
|
3029
3108
|
//#endregion
|
|
3030
3109
|
//#region src/addons/ai/ai/F0AiChat/providers/useCanvasEntities.ts
|
|
3031
|
-
function
|
|
3110
|
+
function Ra() {
|
|
3032
3111
|
let { canvasEntities: e } = B();
|
|
3033
3112
|
return e;
|
|
3034
3113
|
}
|
|
3035
3114
|
//#endregion
|
|
3036
3115
|
//#region src/addons/ai/ai/canvas/registry.ts
|
|
3037
|
-
function
|
|
3038
|
-
let t =
|
|
3116
|
+
function za(e) {
|
|
3117
|
+
let t = Ra();
|
|
3039
3118
|
if (e && t) return t[e];
|
|
3040
3119
|
}
|
|
3041
3120
|
//#endregion
|
|
3042
3121
|
//#region src/blocks/ai/F0ClarifyingPanel/components/ConfirmFooter.tsx
|
|
3043
|
-
var
|
|
3122
|
+
var Ba = ({ canProceed: e, submitDisabled: n, label: r, onConfirm: i, onSkip: a, showSkip: o }) => {
|
|
3044
3123
|
let s = t();
|
|
3045
3124
|
return /* @__PURE__ */ Y("div", {
|
|
3046
3125
|
className: "flex items-center justify-end gap-3 p-3",
|
|
@@ -3061,19 +3140,19 @@ var Da = ({ canProceed: e, submitDisabled: n, label: r, onConfirm: i, onSkip: a,
|
|
|
3061
3140
|
onClick: i
|
|
3062
3141
|
})]
|
|
3063
3142
|
});
|
|
3064
|
-
},
|
|
3143
|
+
}, Va = ({ isSelected: e }) => /* @__PURE__ */ J("div", {
|
|
3065
3144
|
className: i("flex h-5 w-5 shrink-0 items-center justify-center rounded-full transition-colors", e ? "bg-f1-background-selected-bold" : "border-2 border-solid border-f1-border bg-f1-background"),
|
|
3066
3145
|
children: e ? /* @__PURE__ */ J("div", { className: "h-2 w-2 rounded-full bg-f1-background" }) : null
|
|
3067
|
-
}),
|
|
3068
|
-
let p = t().ai.clarifyingQuestion.typeYourAnswer, m = K(null), h =
|
|
3069
|
-
|
|
3146
|
+
}), Ha = 132, Ua = ({ mode: e, hasSelection: n, hasCustomText: r, customAnswerText: a, isCustomAnswerActive: o, canProceed: s, inputRef: c, onActivate: l, onChangeText: u, onToggleActive: d, onConfirm: f }) => {
|
|
3147
|
+
let p = t().ai.clarifyingQuestion.typeYourAnswer, m = K(null), h = Yt(m, c);
|
|
3148
|
+
sn(() => {
|
|
3070
3149
|
let e = m.current;
|
|
3071
3150
|
if (!e) return;
|
|
3072
3151
|
e.style.height = "auto";
|
|
3073
|
-
let t = Math.min(e.scrollHeight,
|
|
3074
|
-
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight >
|
|
3152
|
+
let t = Math.min(e.scrollHeight, Ha);
|
|
3153
|
+
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > Ha ? "auto" : "hidden";
|
|
3075
3154
|
}, [a]);
|
|
3076
|
-
let g = e === "single" ? /* @__PURE__ */ J(
|
|
3155
|
+
let g = e === "single" ? /* @__PURE__ */ J(Va, { isSelected: r && !n }) : /* @__PURE__ */ J(Ht, {
|
|
3077
3156
|
checked: o,
|
|
3078
3157
|
onCheckedChange: () => d(!o),
|
|
3079
3158
|
title: p,
|
|
@@ -3095,7 +3174,7 @@ var Da = ({ canProceed: e, submitDisabled: n, label: r, onConfirm: i, onSkip: a,
|
|
|
3095
3174
|
className: "min-w-0 flex-1 resize-none bg-transparent text-base text-f1-foreground outline-none placeholder:text-f1-foreground-tertiary"
|
|
3096
3175
|
})]
|
|
3097
3176
|
});
|
|
3098
|
-
},
|
|
3177
|
+
}, Wa = H(({ option: e, isSelected: t, mode: n, isTabStop: r, onToggle: o, onKeyNavigate: s }, c) => n === "single" ? /* @__PURE__ */ Y("div", {
|
|
3099
3178
|
ref: c,
|
|
3100
3179
|
role: "radio",
|
|
3101
3180
|
"aria-checked": t,
|
|
@@ -3105,14 +3184,14 @@ var Da = ({ canProceed: e, submitDisabled: n, label: r, onConfirm: i, onSkip: a,
|
|
|
3105
3184
|
onKeyDown: (t) => {
|
|
3106
3185
|
t.key === " " || t.key === "Enter" ? (t.preventDefault(), o(e.id)) : s?.(t);
|
|
3107
3186
|
},
|
|
3108
|
-
children: [/* @__PURE__ */ J(
|
|
3187
|
+
children: [/* @__PURE__ */ J(Va, { isSelected: t }), /* @__PURE__ */ J("span", {
|
|
3109
3188
|
className: "text-base font-normal text-f1-foreground",
|
|
3110
3189
|
children: e.label
|
|
3111
3190
|
})]
|
|
3112
3191
|
}) : /* @__PURE__ */ Y("div", {
|
|
3113
3192
|
ref: c,
|
|
3114
3193
|
className: i("flex cursor-pointer items-center rounded-md pl-2 transition-[background-color,transform] hover:bg-f1-background-secondary active:scale-[0.99]"),
|
|
3115
|
-
children: [/* @__PURE__ */ J(
|
|
3194
|
+
children: [/* @__PURE__ */ J(Ht, {
|
|
3116
3195
|
checked: t,
|
|
3117
3196
|
onCheckedChange: () => o(e.id),
|
|
3118
3197
|
title: e.label,
|
|
@@ -3123,15 +3202,15 @@ var Da = ({ canProceed: e, submitDisabled: n, label: r, onConfirm: i, onSkip: a,
|
|
|
3123
3202
|
children: e.label
|
|
3124
3203
|
})]
|
|
3125
3204
|
}));
|
|
3126
|
-
|
|
3205
|
+
Wa.displayName = "OptionRow";
|
|
3127
3206
|
//#endregion
|
|
3128
3207
|
//#region src/blocks/ai/F0ClarifyingPanel/components/OptionsList.tsx
|
|
3129
|
-
var
|
|
3208
|
+
var Ga = [
|
|
3130
3209
|
.23,
|
|
3131
3210
|
1,
|
|
3132
3211
|
.32,
|
|
3133
3212
|
1
|
|
3134
|
-
],
|
|
3213
|
+
], Ka = .2, qa = .03, Ja = 4, Ya = ({ mode: e, question: t, options: n, selectedOptionIds: r, allowCustomAnswer: i, hasSelection: a, hasCustomText: o, customAnswerText: s, isCustomAnswerActive: u, canProceed: d, customInputRef: f, autoFocus: p, onToggleOption: m, onActivateCustom: h, onChangeCustomText: g, onToggleCustomActive: _, onConfirm: v }) => {
|
|
3135
3214
|
let y = l(), b = (() => {
|
|
3136
3215
|
if (e !== "single") return 0;
|
|
3137
3216
|
let t = n.findIndex((e) => r.includes(e.id));
|
|
@@ -3166,16 +3245,16 @@ var Ma = [
|
|
|
3166
3245
|
}, T = (e) => ({
|
|
3167
3246
|
initial: !y && {
|
|
3168
3247
|
opacity: 0,
|
|
3169
|
-
y:
|
|
3248
|
+
y: Ja
|
|
3170
3249
|
},
|
|
3171
3250
|
animate: {
|
|
3172
3251
|
opacity: 1,
|
|
3173
3252
|
y: 0
|
|
3174
3253
|
},
|
|
3175
3254
|
transition: {
|
|
3176
|
-
duration: y ? 0 :
|
|
3177
|
-
ease:
|
|
3178
|
-
delay: y ? 0 : e *
|
|
3255
|
+
duration: y ? 0 : Ka,
|
|
3256
|
+
ease: Ga,
|
|
3257
|
+
delay: y ? 0 : e * qa
|
|
3179
3258
|
}
|
|
3180
3259
|
});
|
|
3181
3260
|
return /* @__PURE__ */ Y("div", {
|
|
@@ -3184,7 +3263,7 @@ var Ma = [
|
|
|
3184
3263
|
"aria-label": t,
|
|
3185
3264
|
children: [n.map((t, n) => /* @__PURE__ */ J(c.div, {
|
|
3186
3265
|
...T(n),
|
|
3187
|
-
children: /* @__PURE__ */ J(
|
|
3266
|
+
children: /* @__PURE__ */ J(Wa, {
|
|
3188
3267
|
ref: (e) => {
|
|
3189
3268
|
C.current[n] = e;
|
|
3190
3269
|
},
|
|
@@ -3197,7 +3276,7 @@ var Ma = [
|
|
|
3197
3276
|
})
|
|
3198
3277
|
}, t.id)), i ? /* @__PURE__ */ J(c.div, {
|
|
3199
3278
|
...T(n.length),
|
|
3200
|
-
children: /* @__PURE__ */ J(
|
|
3279
|
+
children: /* @__PURE__ */ J(Ua, {
|
|
3201
3280
|
mode: e,
|
|
3202
3281
|
hasSelection: a,
|
|
3203
3282
|
hasCustomText: o,
|
|
@@ -3212,7 +3291,7 @@ var Ma = [
|
|
|
3212
3291
|
})
|
|
3213
3292
|
}) : null]
|
|
3214
3293
|
});
|
|
3215
|
-
},
|
|
3294
|
+
}, Xa = ({ question: e, stepLabel: n, isFirstStep: r, isFinalStep: i, canProceed: a, onBack: o, onNext: s, onCancel: c }) => {
|
|
3216
3295
|
let l = t();
|
|
3217
3296
|
return /* @__PURE__ */ Y("div", {
|
|
3218
3297
|
className: "flex items-start gap-0.5 pl-4 pr-3",
|
|
@@ -3233,7 +3312,7 @@ var Ma = [
|
|
|
3233
3312
|
disabled: r,
|
|
3234
3313
|
label: l.ai.clarifyingQuestion.back,
|
|
3235
3314
|
hideLabel: !0,
|
|
3236
|
-
icon:
|
|
3315
|
+
icon: kt
|
|
3237
3316
|
}),
|
|
3238
3317
|
/* @__PURE__ */ J("span", {
|
|
3239
3318
|
className: "translate-y-px text-sm font-semibold text-f1-foreground-tertiary",
|
|
@@ -3247,7 +3326,7 @@ var Ma = [
|
|
|
3247
3326
|
disabled: i || !a,
|
|
3248
3327
|
label: l.ai.clarifyingQuestion.next,
|
|
3249
3328
|
hideLabel: !0,
|
|
3250
|
-
icon:
|
|
3329
|
+
icon: Pt
|
|
3251
3330
|
})
|
|
3252
3331
|
]
|
|
3253
3332
|
}) : null,
|
|
@@ -3258,34 +3337,34 @@ var Ma = [
|
|
|
3258
3337
|
onClick: c,
|
|
3259
3338
|
label: l.actions.cancel,
|
|
3260
3339
|
hideLabel: !0,
|
|
3261
|
-
icon:
|
|
3340
|
+
icon: ot
|
|
3262
3341
|
})
|
|
3263
3342
|
]
|
|
3264
3343
|
});
|
|
3265
|
-
},
|
|
3344
|
+
}, Za = "easeOut", Qa = .15, $a = .1, eo = ({ clarifyingQuestion: e, isSubmitDisabled: t }) => /* @__PURE__ */ J(to, {
|
|
3266
3345
|
clarifyingQuestion: e,
|
|
3267
3346
|
isSubmitDisabled: t
|
|
3268
|
-
}),
|
|
3269
|
-
let r = t(), i = l(), { currentStep: a, currentStepIndex: o, totalSteps: s, toggleOption: u, confirm: d, skip: f, cancel: m, back: h, setCustomAnswerText: g, setCustomAnswerActive: _, activateCustomAnswer: v } = e, { question: y, options: b, selectedOptionIds: x, selectionMode: S, optional: C, allowCustomAnswer: w, customAnswerText: T, isCustomAnswerActive: E } = a, D = K(null), O = S ?? "single",
|
|
3347
|
+
}), to = ({ clarifyingQuestion: e, isSubmitDisabled: n }) => {
|
|
3348
|
+
let r = t(), i = l(), { currentStep: a, currentStepIndex: o, totalSteps: s, toggleOption: u, confirm: d, skip: f, cancel: m, back: h, setCustomAnswerText: g, setCustomAnswerActive: _, activateCustomAnswer: v } = e, { question: y, options: b, selectedOptionIds: x, selectionMode: S, optional: C, allowCustomAnswer: w, customAnswerText: T, isCustomAnswerActive: E } = a, D = K(null), O = S ?? "single", ee = s > 1, k = o === 0, A = o === s - 1, j = ee ? r.t("ai.clarifyingQuestion.stepOf", {
|
|
3270
3349
|
current: String(o + 1),
|
|
3271
3350
|
total: String(s)
|
|
3272
|
-
}) : void 0, M = x.length > 0, N = (T ?? "").trim().length > 0, P = M || E && N || C === !0, F = n === !0 && A,
|
|
3351
|
+
}) : void 0, M = x.length > 0, N = (T ?? "").trim().length > 0, P = M || E && N || C === !0, F = n === !0 && A, te = () => {
|
|
3273
3352
|
F || d();
|
|
3274
|
-
},
|
|
3353
|
+
}, ne = () => {
|
|
3275
3354
|
F || f();
|
|
3276
|
-
},
|
|
3355
|
+
}, re = (e) => {
|
|
3277
3356
|
let t = O === "single" && x.includes(e);
|
|
3278
3357
|
u(e), O === "single" && !A && !t && Promise.resolve().then(d);
|
|
3279
|
-
},
|
|
3358
|
+
}, I = A ? r.ai.clarifyingQuestion.submit : r.ai.clarifyingQuestion.next, ie = C === !0 && !M && !(E && N), L = () => {
|
|
3280
3359
|
v(), requestAnimationFrame(() => {
|
|
3281
3360
|
D.current?.focus();
|
|
3282
3361
|
});
|
|
3283
|
-
},
|
|
3362
|
+
}, R = (e) => {
|
|
3284
3363
|
e.key === "Escape" && (e.preventDefault(), m());
|
|
3285
|
-
},
|
|
3364
|
+
}, ae = i ? 0 : Qa, oe = i ? 0 : $a;
|
|
3286
3365
|
return /* @__PURE__ */ Y("div", {
|
|
3287
3366
|
className: "flex flex-col",
|
|
3288
|
-
onKeyDown:
|
|
3367
|
+
onKeyDown: R,
|
|
3289
3368
|
children: [/* @__PURE__ */ J("div", {
|
|
3290
3369
|
className: "flex flex-col gap-3 pt-3",
|
|
3291
3370
|
children: /* @__PURE__ */ J(p, {
|
|
@@ -3297,27 +3376,27 @@ var Ma = [
|
|
|
3297
3376
|
animate: {
|
|
3298
3377
|
opacity: 1,
|
|
3299
3378
|
transition: {
|
|
3300
|
-
duration:
|
|
3301
|
-
ease:
|
|
3379
|
+
duration: ae,
|
|
3380
|
+
ease: Za
|
|
3302
3381
|
}
|
|
3303
3382
|
},
|
|
3304
3383
|
exit: {
|
|
3305
3384
|
opacity: 0,
|
|
3306
3385
|
transition: {
|
|
3307
|
-
duration:
|
|
3308
|
-
ease:
|
|
3386
|
+
duration: oe,
|
|
3387
|
+
ease: Za
|
|
3309
3388
|
}
|
|
3310
3389
|
},
|
|
3311
|
-
children: [/* @__PURE__ */ J(
|
|
3390
|
+
children: [/* @__PURE__ */ J(Xa, {
|
|
3312
3391
|
question: y,
|
|
3313
3392
|
stepLabel: j,
|
|
3314
|
-
isFirstStep:
|
|
3393
|
+
isFirstStep: k,
|
|
3315
3394
|
isFinalStep: A,
|
|
3316
3395
|
canProceed: P,
|
|
3317
3396
|
onBack: h,
|
|
3318
3397
|
onNext: d,
|
|
3319
3398
|
onCancel: m
|
|
3320
|
-
}), /* @__PURE__ */ J(
|
|
3399
|
+
}), /* @__PURE__ */ J(Ya, {
|
|
3321
3400
|
mode: O,
|
|
3322
3401
|
question: y,
|
|
3323
3402
|
options: b,
|
|
@@ -3329,27 +3408,27 @@ var Ma = [
|
|
|
3329
3408
|
isCustomAnswerActive: E,
|
|
3330
3409
|
canProceed: P,
|
|
3331
3410
|
customInputRef: D,
|
|
3332
|
-
onToggleOption:
|
|
3333
|
-
onActivateCustom:
|
|
3411
|
+
onToggleOption: re,
|
|
3412
|
+
onActivateCustom: L,
|
|
3334
3413
|
onChangeCustomText: g,
|
|
3335
3414
|
onToggleCustomActive: _,
|
|
3336
|
-
onConfirm:
|
|
3415
|
+
onConfirm: te
|
|
3337
3416
|
})]
|
|
3338
3417
|
}, o)
|
|
3339
3418
|
})
|
|
3340
|
-
}), /* @__PURE__ */ J(
|
|
3419
|
+
}), /* @__PURE__ */ J(Ba, {
|
|
3341
3420
|
canProceed: P,
|
|
3342
3421
|
submitDisabled: F,
|
|
3343
|
-
label:
|
|
3344
|
-
onConfirm:
|
|
3345
|
-
onSkip:
|
|
3346
|
-
showSkip:
|
|
3422
|
+
label: I,
|
|
3423
|
+
onConfirm: te,
|
|
3424
|
+
onSkip: ne,
|
|
3425
|
+
showSkip: ie
|
|
3347
3426
|
})]
|
|
3348
3427
|
});
|
|
3349
3428
|
};
|
|
3350
3429
|
//#endregion
|
|
3351
3430
|
//#region src/elements/ai/F0AiMask/gl/geometry.ts
|
|
3352
|
-
function
|
|
3431
|
+
function no(e, t, n, r) {
|
|
3353
3432
|
let i = Math.max(1, Math.min(e, t)), a = Math.min(Math.min(n, 20) + r, i), o = Math.min(a, Math.floor(e / 2)), s = Math.min(a, Math.floor(t / 2)), c = (t) => t / e * 2 - 1, l = (e) => e / t * 2 - 1, u = e, d = t, f = o, p = e - o, m = s, h = t - s, g = c(0), _ = c(u), v = l(0), y = l(d), b = c(f), x = c(p), S = l(m), C = l(h), w = o / e, T = 1 - o / e, E = s / t, D = 1 - s / t;
|
|
3354
3433
|
return {
|
|
3355
3434
|
positions: new Float32Array([
|
|
@@ -3456,7 +3535,7 @@ function Ua(e, t, n, r) {
|
|
|
3456
3535
|
}
|
|
3457
3536
|
//#endregion
|
|
3458
3537
|
//#region src/elements/ai/F0AiMask/gl/program.ts
|
|
3459
|
-
function
|
|
3538
|
+
function ro(e, t, n) {
|
|
3460
3539
|
let r = e.createShader(t);
|
|
3461
3540
|
if (!r) throw Error("Failed to create shader");
|
|
3462
3541
|
if (e.shaderSource(r, n), e.compileShader(r), !e.getShaderParameter(r, e.COMPILE_STATUS)) {
|
|
@@ -3465,8 +3544,8 @@ function Wa(e, t, n) {
|
|
|
3465
3544
|
}
|
|
3466
3545
|
return r;
|
|
3467
3546
|
}
|
|
3468
|
-
function
|
|
3469
|
-
let r =
|
|
3547
|
+
function io(e, t, n) {
|
|
3548
|
+
let r = ro(e, e.VERTEX_SHADER, t), i = ro(e, e.FRAGMENT_SHADER, n), a = e.createProgram();
|
|
3470
3549
|
if (!a) throw Error("Failed to create program");
|
|
3471
3550
|
if (e.attachShader(a, r), e.attachShader(a, i), e.linkProgram(a), !e.getProgramParameter(a, e.LINK_STATUS)) {
|
|
3472
3551
|
let t = e.getProgramInfoLog(a) || "Unknown link error";
|
|
@@ -3476,13 +3555,13 @@ function Ga(e, t, n) {
|
|
|
3476
3555
|
}
|
|
3477
3556
|
//#endregion
|
|
3478
3557
|
//#region src/elements/ai/F0AiMask/gl/shaders/fragment.ts
|
|
3479
|
-
var
|
|
3558
|
+
var ao = "#version 300 es\nprecision lowp float;\n\nin vec2 vUV;\nout vec4 outColor;\n\nuniform vec2 uResolution;\nuniform float uTime;\nuniform float uBorderWidth;\nuniform float uGlowWidth;\nuniform float uBorderRadius;\nuniform vec3 uColors[4];\n\n// dark/light mode\nuniform float uGlowExponent;\nuniform float uGlowFactor;\n\nconst float PI = 3.14159265359;\nconst float TWO_PI = 2.0 * PI;\nconst float HALF_PI = 0.5 * PI;\n\n// Light source parameters (constants)\nconst vec4 startPositions = vec4(0.0, PI, HALF_PI, 1.5 * PI);\nconst vec4 speeds = vec4(-1.9, -1.9, -1.5, 2.1);\nconst vec4 innerRadius = vec4(PI * 0.8, PI * 0.7, PI * 0.3, PI * 0.1);\nconst vec4 outerRadius = vec4(PI * 1.2, PI * 0.9, PI * 0.6, PI * 0.4);\n\n/**\n * @brief Generates a random float value based on the input 2D coordinates.\n * @param st The input 2D coordinates.\n * @return float A random float value.\n */\nfloat random(vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123);\n}\n\nvec2 random2(vec2 st) {\n return vec2(random(st), random(st + 1.0));\n}\n\n/**\n * Derivative-based Anti-aliasing\n */\nfloat aaStep(float edge, float d) {\n // Calculate the width of the anti-aliasing transition\n // This is the distance the value changes over one pixel.\n float width = fwidth(d);\n return smoothstep(edge - width * 0.5, edge + width * 0.5, d);\n}\n\n/**\n * @brief Provides an anti-aliased version of fract().\n * @param x The input value.\n * @return float The anti-aliased fractional part of x.\n */\nfloat aaFract(float x) {\n float f = fract(x);\n float w = fwidth(x); // Get the width of the transition band for one pixel.\n\n // Use smoothstep to fade the line out as it approaches the 1.0 boundary.\n // The fade happens over a distance equal to the pixel width 'w'.\n float smooth_f = f * (1.0 - smoothstep(1.0 - w, 1.0, f));\n\n return smooth_f;\n}\n\n/**\n * @name sdRoundedBox\n * @description Calculates the signed distance from a point to a rounded rectangle.\n * @param {vec2} p - The point coordinates.\n * @param {vec2} b - Half the size of the rectangle (half width and half height).\n * @param {float} r - The corner radius.\n * @returns {float} - Signed distance to the surface of the rounded rectangle.\n */\nfloat sdRoundedBox(in vec2 p, in vec2 b, in float r) {\n vec2 q = abs(p) - b + r;\n return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r;\n}\n\n/**\n * @brief Calculates the smooth inner glow intensity for a rectangle.\n * @param p The current pixel coordinate, centered at (0,0).\n * @param b The half-dimensions of the rectangle.\n * @param radius The radius of the glow/blur.\n * @return float The glow intensity, from 0.0 to 1.0.\n */\nfloat getInnerGlow(vec2 p, vec2 b, float radius) {\n // Check if the pixel is outside the rectangle.\n // vec2 d_out = abs(p) - b;\n // if (max(d_out.x, d_out.y) > 0.0) {\n // return 0.0;\n // }\n\n // Calculate the distance to the nearest vertical and horizontal edges (positive inwards).\n float dist_x = b.x - abs(p.x);\n float dist_y = b.y - abs(p.y);\n\n // Calculate the horizontal and vertical glow intensities independently.\n float glow_x = smoothstep(radius, 0.0, dist_x);\n float glow_y = smoothstep(radius, 0.0, dist_y);\n\n // Combine the two directional glows using a screen blend mode: 1.0 - (1.0 - a) * (1.0 - b).\n return 1.0 - (1.0 - glow_x) * (1.0 - glow_y);\n}\n\nfloat getVignette(vec2 uv) {\n vec2 vignetteUv = uv;\n vignetteUv = vignetteUv * (1.0 - vignetteUv);\n float vignette = vignetteUv.x * vignetteUv.y * 25.0; // multiply with sth for intensity\n vignette = pow(vignette, 0.16); // change pow for modifying the extend of the vignette\n // vignette = smoothstep(0.0, 0.7, vignette); // smoothstep to avoid hard edges\n vignette = 1.0 - vignette;\n\n return vignette;\n}\n\n/**\n * Convert UV coordinates to angle (0 to 2π) around the border\n */\nfloat uvToAngle(vec2 uv) {\n vec2 center = vec2(0.5);\n vec2 dir = uv - center;\n return atan(dir.y, dir.x) + PI;\n}\n\n/**\n * Get current light center position (angle) based on start position, speed and time\n */\n// float getLightCenter(float startPos, float speed, float time) {\n// return mod(startPos + speed * time, TWO_PI);\n// }\n\nvoid main() {\n vec2 uv = vUV;\n vec2 pos = uv * uResolution;\n vec2 centeredPos = pos - uResolution * 0.5;\n vec2 size = uResolution - uBorderWidth;\n vec2 halfSize = size * 0.5;\n\n // Calculate the signed distance from the rounded rectangle\n float dBorderBox = sdRoundedBox(centeredPos, halfSize, uBorderRadius);\n float border = aaStep(0.0, dBorderBox);\n\n // This will create a gradient mask to safely fade out from borders to inner edges.\n float glow = getInnerGlow(centeredPos, halfSize, uGlowWidth);\n // glow = smoothstep(0.0, 0.5, glow);\n // glow = aaFract(glow * 10.0);\n\n float vignette = getVignette(uv);\n glow *= vignette;\n\n float posAngle = uvToAngle(uv);\n\n // vec4 lightCenter = vec4(\n // getLightCenter(startPositions.x, speeds.x, uTime),\n // getLightCenter(startPositions.y, speeds.y, uTime),\n // getLightCenter(startPositions.z, speeds.z, uTime),\n // getLightCenter(startPositions.w, speeds.w, uTime)\n // );\n vec4 lightCenter = mod(startPositions + speeds * uTime, TWO_PI);\n\n vec4 angleDist = abs(posAngle - lightCenter);\n\n // Calculate shortest angular distance (considering wrap-around)\n vec4 disToLight = min(angleDist, TWO_PI - angleDist) / TWO_PI;\n\n float intensityBorder[4];\n intensityBorder[0] = 1.0;\n intensityBorder[1] = smoothstep(0.4, 0.0, disToLight.y);\n intensityBorder[2] = smoothstep(0.4, 0.0, disToLight.z);\n intensityBorder[3] = smoothstep(0.2, 0.0, disToLight.w) * 0.5;\n\n // mix these 4 colors with distance\n vec3 borderColor = vec3(0.0);\n for(int i = 0; i < 4; i++) {\n borderColor = mix(borderColor, uColors[i], intensityBorder[i]);\n }\n borderColor *= 1.1;\n\n borderColor = clamp(borderColor, 0.0, 1.0);\n\n float intensityGlow[4];\n intensityGlow[0] = smoothstep(0.9, 0.0, disToLight.x);\n intensityGlow[1] = smoothstep(0.7, 0.0, disToLight.y);\n intensityGlow[2] = smoothstep(0.4, 0.0, disToLight.z);\n intensityGlow[3] = smoothstep(0.1, 0.0, disToLight.w) * 0.7;\n\n // timely breathing effect\n vec4 breath = smoothstep(0.0, 1.0, sin(uTime * 1.0 + startPositions * PI) * 0.2 + 0.8);\n\n vec3 glowColor = vec3(0.0);\n glowColor += uColors[0] * intensityGlow[0] * breath.x;\n glowColor += uColors[1] * intensityGlow[1] * breath.y;\n glowColor += uColors[2] * intensityGlow[2] * breath.z;\n glowColor += uColors[3] * intensityGlow[3] * breath.w * glow; // fade it a little bit\n\n glow = pow(glow, uGlowExponent);\n glow *= random(pos + uTime) * 0.1 + 1.0;\n glowColor *= glow * uGlowFactor;\n glowColor = clamp(glowColor, 0.0, 1.0);\n\n vec3 color = mix(glowColor, borderColor + glowColor * 0.2, border);\n\n float alpha = mix(glow, 1.0, border);\n\n outColor = vec4(color, alpha);\n}\n", oo = "#version 300 es\n\nin vec2 aPosition;\nin vec2 aUV;\nout vec2 vUV;\nvoid main() {\n vUV = aUV;\n gl_Position = vec4(aPosition, 0.0, 1.0);\n}\n", so = [
|
|
3480
3559
|
"rgb(229, 25, 67)",
|
|
3481
3560
|
"rgb(229, 86, 25)",
|
|
3482
3561
|
"rgb(229, 25, 67)",
|
|
3483
3562
|
"rgb(161, 173, 229)"
|
|
3484
3563
|
];
|
|
3485
|
-
function
|
|
3564
|
+
function co(e) {
|
|
3486
3565
|
let t = e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
3487
3566
|
if (!t) throw Error(`Invalid color format: ${e}`);
|
|
3488
3567
|
let [, n, r, i] = t;
|
|
@@ -3492,7 +3571,7 @@ function Ya(e) {
|
|
|
3492
3571
|
parseInt(i, 10) / 255
|
|
3493
3572
|
];
|
|
3494
3573
|
}
|
|
3495
|
-
var
|
|
3574
|
+
var lo = class {
|
|
3496
3575
|
element;
|
|
3497
3576
|
canvas;
|
|
3498
3577
|
options;
|
|
@@ -3549,7 +3628,7 @@ var Xa = class {
|
|
|
3549
3628
|
if (this.options.width = e, this.options.height = t, n && (this.options.ratio = n), !this.running) return;
|
|
3550
3629
|
let { gl: r, program: i, vao: a, positionBuffer: o, uvBuffer: s, uResolution: c } = this.glr, l = n ?? this.options.ratio ?? window.devicePixelRatio ?? 1, u = Math.max(1, Math.floor(e * l)), d = Math.max(1, Math.floor(t * l));
|
|
3551
3630
|
this.canvas.style.width = `${e}px`, this.canvas.style.height = `${t}px`, (this.canvas.width !== u || this.canvas.height !== d) && (this.canvas.width = u, this.canvas.height = d), r.viewport(0, 0, this.canvas.width, this.canvas.height), this.checkGLError(r, "resize: after viewport setup");
|
|
3552
|
-
let { positions: f, uvs: p } =
|
|
3631
|
+
let { positions: f, uvs: p } = no(this.canvas.width, this.canvas.height, this.options.borderWidth * l, this.options.glowWidth * l);
|
|
3553
3632
|
r.bindVertexArray(a), r.bindBuffer(r.ARRAY_BUFFER, o), r.bufferData(r.ARRAY_BUFFER, f, r.STATIC_DRAW);
|
|
3554
3633
|
let m = r.getAttribLocation(i, "aPosition");
|
|
3555
3634
|
r.enableVertexAttribArray(m), r.vertexAttribPointer(m, 2, r.FLOAT, !1, 0, 0), this.checkGLError(r, "resize: after position buffer update"), r.bindBuffer(r.ARRAY_BUFFER, s), r.bufferData(r.ARRAY_BUFFER, p, r.STATIC_DRAW);
|
|
@@ -3624,11 +3703,11 @@ var Xa = class {
|
|
|
3624
3703
|
alpha: !0
|
|
3625
3704
|
});
|
|
3626
3705
|
if (!e) throw Error("WebGL2 is required but not available.");
|
|
3627
|
-
let t =
|
|
3706
|
+
let t = io(e, oo, ao);
|
|
3628
3707
|
this.checkGLError(e, "setupGL: after createProgram");
|
|
3629
3708
|
let n = e.createVertexArray();
|
|
3630
3709
|
e.bindVertexArray(n), this.checkGLError(e, "setupGL: after VAO creation");
|
|
3631
|
-
let { positions: r, uvs: i } =
|
|
3710
|
+
let { positions: r, uvs: i } = no(this.canvas.width || 2, this.canvas.height || 2, this.options.borderWidth, this.options.glowWidth), a = e.createBuffer();
|
|
3632
3711
|
e.bindBuffer(e.ARRAY_BUFFER, a), e.bufferData(e.ARRAY_BUFFER, r, e.STATIC_DRAW);
|
|
3633
3712
|
let o = e.getAttribLocation(t, "aPosition");
|
|
3634
3713
|
e.enableVertexAttribArray(o), e.vertexAttribPointer(o, 2, e.FLOAT, !1, 0, 0), this.checkGLError(e, "setupGL: after position buffer setup");
|
|
@@ -3638,7 +3717,7 @@ var Xa = class {
|
|
|
3638
3717
|
e.enableVertexAttribArray(c), e.vertexAttribPointer(c, 2, e.FLOAT, !1, 0, 0), this.checkGLError(e, "setupGL: after UV buffer setup");
|
|
3639
3718
|
let l = e.getUniformLocation(t, "uResolution"), u = e.getUniformLocation(t, "uTime"), d = e.getUniformLocation(t, "uBorderWidth"), f = e.getUniformLocation(t, "uGlowWidth"), p = e.getUniformLocation(t, "uBorderRadius"), m = e.getUniformLocation(t, "uColors"), h = e.getUniformLocation(t, "uGlowExponent"), g = e.getUniformLocation(t, "uGlowFactor");
|
|
3640
3719
|
e.useProgram(t), e.uniform1f(d, this.options.borderWidth), e.uniform1f(f, this.options.glowWidth), e.uniform1f(p, this.options.borderRadius), this.options.mode === "dark" ? (e.uniform1f(h, 2), e.uniform1f(g, 1.8)) : (e.uniform1f(h, 1), e.uniform1f(g, 1));
|
|
3641
|
-
let _ = (this.options.colors ||
|
|
3720
|
+
let _ = (this.options.colors || so).map(co);
|
|
3642
3721
|
for (let n = 0; n < _.length; n++) e.uniform3f(e.getUniformLocation(t, `uColors[${n}]`), ..._[n]);
|
|
3643
3722
|
this.checkGLError(e, "setupGL: after uniform setup"), e.bindVertexArray(null), e.bindBuffer(e.ARRAY_BUFFER, null), this.glr = {
|
|
3644
3723
|
gl: e,
|
|
@@ -3659,28 +3738,28 @@ var Xa = class {
|
|
|
3659
3738
|
let { gl: t, program: n, vao: r, uTime: i } = this.glr;
|
|
3660
3739
|
t.useProgram(n), t.bindVertexArray(r), t.uniform1f(i, e), t.disable(t.DEPTH_TEST), t.disable(t.CULL_FACE), t.disable(t.BLEND), t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), t.drawArrays(t.TRIANGLES, 0, 24), this.checkGLError(t, "render: after draw call"), t.bindVertexArray(null);
|
|
3661
3740
|
}
|
|
3662
|
-
},
|
|
3741
|
+
}, uo = 10, fo = 2, po = .5, mo = .2, ho = 1.5, Q = {
|
|
3663
3742
|
duration: .5,
|
|
3664
3743
|
ease: "easeOut"
|
|
3665
|
-
},
|
|
3744
|
+
}, go = {
|
|
3666
3745
|
duration: .35,
|
|
3667
3746
|
ease: "easeOut",
|
|
3668
3747
|
repeat: Infinity,
|
|
3669
3748
|
repeatType: "mirror"
|
|
3670
3749
|
};
|
|
3671
|
-
function
|
|
3672
|
-
let [t, n] = q(e), r =
|
|
3673
|
-
return
|
|
3750
|
+
function _o(e) {
|
|
3751
|
+
let [t, n] = q(e), r = ee(e), i = K(null);
|
|
3752
|
+
return dn(r, "change", (e) => n(e)), {
|
|
3674
3753
|
value: t,
|
|
3675
3754
|
motionValue: r,
|
|
3676
3755
|
controls: i,
|
|
3677
3756
|
animate: U((e, t) => {
|
|
3678
|
-
i.current =
|
|
3757
|
+
i.current = ge(r, e, t);
|
|
3679
3758
|
}, [r])
|
|
3680
3759
|
};
|
|
3681
3760
|
}
|
|
3682
|
-
function
|
|
3683
|
-
let [n, r] = q(
|
|
3761
|
+
function vo(e, t) {
|
|
3762
|
+
let [n, r] = q(uo), { value: i, animate: a, motionValue: o } = _o(mo), { value: s, animate: c } = _o(fo), { value: l, animate: u } = _o(po), { value: d, animate: f } = _o(ho), p = un(t, {
|
|
3684
3763
|
fftSize: 512,
|
|
3685
3764
|
smoothingTimeConstant: .55
|
|
3686
3765
|
});
|
|
@@ -3697,12 +3776,12 @@ function io(e, t) {
|
|
|
3697
3776
|
type: "spring",
|
|
3698
3777
|
duration: 1,
|
|
3699
3778
|
bounce: .35
|
|
3700
|
-
}), c(1, Q), u(.7, Q), f([1.5, 2],
|
|
3779
|
+
}), c(1, Q), u(.7, Q), f([1.5, 2], go);
|
|
3701
3780
|
return;
|
|
3702
3781
|
case "thinking":
|
|
3703
3782
|
case "connecting":
|
|
3704
3783
|
case "initializing":
|
|
3705
|
-
r(30), a(.3, Q), c(.5, Q), u(1, Q), f([.5, 2.5],
|
|
3784
|
+
r(30), a(.3, Q), c(.5, Q), u(1, Q), f([.5, 2.5], go);
|
|
3706
3785
|
return;
|
|
3707
3786
|
case "speaking":
|
|
3708
3787
|
r(70), a(.3, Q), c(.75, Q), u(1.25, Q), f(1.5, Q);
|
|
@@ -3734,32 +3813,32 @@ function io(e, t) {
|
|
|
3734
3813
|
}
|
|
3735
3814
|
//#endregion
|
|
3736
3815
|
//#region src/addons/ai/ai/F0AuraVoiceAnimation/components/ReactShaderToy.tsx
|
|
3737
|
-
var
|
|
3816
|
+
var yo = [
|
|
3738
3817
|
"lowp",
|
|
3739
3818
|
"mediump",
|
|
3740
3819
|
"highp"
|
|
3741
|
-
],
|
|
3742
|
-
function
|
|
3820
|
+
], bo = "\nvoid main(void){\n vec4 color = vec4(0.0,0.0,0.0,1.0);\n mainImage( color, gl_FragCoord.xy );\n gl_FragColor = color;\n}", xo = "void mainImage( out vec4 fragColor, in vec2 fragCoord ) {\n vec2 uv = fragCoord/iResolution.xy;\n vec3 col = 0.5 + 0.5*cos(iTime+uv.xyx+vec3(0,2,4));\n fragColor = vec4(col,1.0);\n}", So = "attribute vec3 aVertexPosition;\nvoid main(void) {\n gl_Position = vec4(aVertexPosition, 1.0);\n}", Co = "iTime", wo = "iTimeDelta", To = "iDate", Eo = "iFrame", Do = "iMouse", Oo = "iResolution", ko = "iChannel", Ao = "iChannelResolution", jo = "iDeviceOrientation";
|
|
3821
|
+
function Mo(e, t) {
|
|
3743
3822
|
return e.includes("Matrix") && Array.isArray(t);
|
|
3744
3823
|
}
|
|
3745
|
-
function
|
|
3824
|
+
function No(e, t) {
|
|
3746
3825
|
return e.includes("v") && Array.isArray(t) && t.length > Number.parseInt(e.charAt(0), 10);
|
|
3747
3826
|
}
|
|
3748
|
-
function
|
|
3749
|
-
if (
|
|
3827
|
+
function Po(e, t) {
|
|
3828
|
+
if (Mo(e, t)) {
|
|
3750
3829
|
let n = Number.parseInt(e.charAt(e.length - 3), 10);
|
|
3751
3830
|
return t.length > n * n ? `[${Math.floor(t.length / (n * n))}]` : void 0;
|
|
3752
3831
|
}
|
|
3753
|
-
if (
|
|
3832
|
+
if (No(e, t)) {
|
|
3754
3833
|
let n = Number.parseInt(e.charAt(0), 10);
|
|
3755
3834
|
return `[${Math.floor(t.length / n)}]`;
|
|
3756
3835
|
}
|
|
3757
3836
|
}
|
|
3758
|
-
function
|
|
3837
|
+
function Fo(e, t) {
|
|
3759
3838
|
return !e.includes("v") && Array.isArray(t) && t.length > Number.parseInt(e.charAt(0), 10);
|
|
3760
3839
|
}
|
|
3761
|
-
var
|
|
3762
|
-
if (
|
|
3840
|
+
var Io = (e, t, n, r) => {
|
|
3841
|
+
if (Fo(n, r)) switch (n) {
|
|
3763
3842
|
case "2f": return e.uniform2f(t, r[0], r[1]);
|
|
3764
3843
|
case "3f": return e.uniform3f(t, r[0], r[1], r[2]);
|
|
3765
3844
|
case "4f": return e.uniform4f(t, r[0], r[1], r[2], r[3]);
|
|
@@ -3781,7 +3860,7 @@ var Co = (e, t, n, r) => {
|
|
|
3781
3860
|
case "Matrix3fv": return e.uniformMatrix3fv(t, !1, r);
|
|
3782
3861
|
case "Matrix4fv": return e.uniformMatrix4fv(t, !1, r);
|
|
3783
3862
|
}
|
|
3784
|
-
},
|
|
3863
|
+
}, Lo = (e) => {
|
|
3785
3864
|
switch (e) {
|
|
3786
3865
|
case "1f": return "float";
|
|
3787
3866
|
case "2f": return "vec2";
|
|
@@ -3804,7 +3883,7 @@ var Co = (e, t, n, r) => {
|
|
|
3804
3883
|
case "Matrix4fv": return "mat4";
|
|
3805
3884
|
default: console.error($(`The uniform type "${e}" is not valid, please make sure your uniform type is valid`));
|
|
3806
3885
|
}
|
|
3807
|
-
},
|
|
3886
|
+
}, Ro = 9729, zo = 9728, Bo = 9987, Vo = 33071, Ho = 10497, Uo = class {
|
|
3808
3887
|
gl;
|
|
3809
3888
|
url;
|
|
3810
3889
|
wrapS;
|
|
@@ -3873,33 +3952,33 @@ var Co = (e, t, n, r) => {
|
|
|
3873
3952
|
});
|
|
3874
3953
|
}
|
|
3875
3954
|
let g = await h(), _ = !(g.width & g.width - 1) && !(g.height & g.height - 1);
|
|
3876
|
-
return (e.wrapS !==
|
|
3955
|
+
return (e.wrapS !== Vo || e.wrapT !== Vo || e.minFilter !== zo && e.minFilter !== Ro) && !_ && (g = this.makePowerOf2(g), _ = !0), t.bindTexture(t.TEXTURE_2D, m), t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL, s), t.texImage2D(t.TEXTURE_2D, 0, u, d, f, g), _ && e.minFilter !== zo && e.minFilter !== Ro && t.generateMipmap(t.TEXTURE_2D), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, this.wrapS || Ho), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, this.wrapT || Ho), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, this.minFilter || Bo), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, this.magFilter || Ro), this._webglTexture = m, this.source = g, this.isVideo = !1, this.isLoaded = !0, this.width = g.width || 0, this.height = g.height || 0, this;
|
|
3877
3956
|
};
|
|
3878
|
-
}, $ = (e) => `react-shaders: ${e}`,
|
|
3957
|
+
}, $ = (e) => `react-shaders: ${e}`, Wo = (e) => {
|
|
3879
3958
|
if ("changedTouches" in e) {
|
|
3880
3959
|
let t = e.changedTouches[0];
|
|
3881
3960
|
return [t?.clientX ?? 0, t?.clientY ?? 0];
|
|
3882
3961
|
}
|
|
3883
3962
|
return [e.clientX, e.clientY];
|
|
3884
|
-
},
|
|
3885
|
-
function
|
|
3963
|
+
}, Go = (e, t, n) => e * (1 - n) + t * n, Ko = (e, t, n) => n > 0 ? e.substring(0, n) + t + e.substring(n, e.length) : t + e;
|
|
3964
|
+
function qo({ fs: e, vs: t = So, textures: n = [], uniforms: r, clearColor: i = [
|
|
3886
3965
|
0,
|
|
3887
3966
|
0,
|
|
3888
3967
|
0,
|
|
3889
3968
|
1
|
|
3890
3969
|
], precision: a = "highp", style: o, contextAttributes: s = {}, lerp: c = 1, devicePixelRatio: l = 1, onDoneLoadingTextures: u, onError: d = console.error, onWarning: f = console.warn }) {
|
|
3891
3970
|
let p = K(null), m = K(null), h = K(null), g = K(null), _ = K(void 0), v = K(void 0), y = K(!1), b = K(void 0), x = K(0), S = K([0, 0]), C = K([]), w = K(0), T = K(void 0), E = K({
|
|
3892
|
-
[
|
|
3971
|
+
[Co]: {
|
|
3893
3972
|
type: "float",
|
|
3894
3973
|
isNeeded: !1,
|
|
3895
3974
|
value: 0
|
|
3896
3975
|
},
|
|
3897
|
-
[
|
|
3976
|
+
[wo]: {
|
|
3898
3977
|
type: "float",
|
|
3899
3978
|
isNeeded: !1,
|
|
3900
3979
|
value: 0
|
|
3901
3980
|
},
|
|
3902
|
-
[
|
|
3981
|
+
[To]: {
|
|
3903
3982
|
type: "vec4",
|
|
3904
3983
|
isNeeded: !1,
|
|
3905
3984
|
value: [
|
|
@@ -3909,7 +3988,7 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
3909
3988
|
0
|
|
3910
3989
|
]
|
|
3911
3990
|
},
|
|
3912
|
-
[
|
|
3991
|
+
[Do]: {
|
|
3913
3992
|
type: "vec4",
|
|
3914
3993
|
isNeeded: !1,
|
|
3915
3994
|
value: [
|
|
@@ -3919,17 +3998,17 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
3919
3998
|
0
|
|
3920
3999
|
]
|
|
3921
4000
|
},
|
|
3922
|
-
[
|
|
4001
|
+
[Oo]: {
|
|
3923
4002
|
type: "vec2",
|
|
3924
4003
|
isNeeded: !1,
|
|
3925
4004
|
value: [0, 0]
|
|
3926
4005
|
},
|
|
3927
|
-
[
|
|
4006
|
+
[Eo]: {
|
|
3928
4007
|
type: "int",
|
|
3929
4008
|
isNeeded: !1,
|
|
3930
4009
|
value: 0
|
|
3931
4010
|
},
|
|
3932
|
-
[
|
|
4011
|
+
[jo]: {
|
|
3933
4012
|
type: "vec4",
|
|
3934
4013
|
isNeeded: !1,
|
|
3935
4014
|
value: [
|
|
@@ -3945,9 +4024,9 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
3945
4024
|
Array.isArray(i.value) || (i.value = []);
|
|
3946
4025
|
let a = i.value;
|
|
3947
4026
|
a[t * 3] = n * l, a[t * 3 + 1] = r * l, a[t * 3 + 2] = 0;
|
|
3948
|
-
}, k = () => {
|
|
3949
|
-
p.current && (m.current = p.current.getContext("webgl", s) || p.current.getContext("experimental-webgl", s), m.current?.getExtension("OES_standard_derivatives"), m.current?.getExtension("EXT_shader_texture_lod"));
|
|
3950
4027
|
}, ee = () => {
|
|
4028
|
+
p.current && (m.current = p.current.getContext("webgl", s) || p.current.getContext("experimental-webgl", s), m.current?.getExtension("OES_standard_derivatives"), m.current?.getExtension("EXT_shader_texture_lod"));
|
|
4029
|
+
}, k = () => {
|
|
3951
4030
|
let e = m.current;
|
|
3952
4031
|
h.current = e?.createBuffer() ?? null, e?.bindBuffer(e.ARRAY_BUFFER, h.current), e?.bufferData(e.ARRAY_BUFFER, new Float32Array([
|
|
3953
4032
|
1,
|
|
@@ -3971,13 +4050,13 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
3971
4050
|
window.orientation ?? 0
|
|
3972
4051
|
];
|
|
3973
4052
|
}, j = (e) => {
|
|
3974
|
-
let [t = 0, n = 0] =
|
|
4053
|
+
let [t = 0, n = 0] = Wo(e), r = t - (b.current?.left ?? 0) - window.pageXOffset, i = (b.current?.height ?? 0) - n - (b.current?.top ?? 0) - window.pageYOffset;
|
|
3975
4054
|
y.current = !0;
|
|
3976
4055
|
let a = Array.isArray(E.current.iMouse?.value) ? E.current.iMouse.value : void 0;
|
|
3977
4056
|
a && (a[2] = r, a[3] = i), S.current[0] = r, S.current[1] = i;
|
|
3978
4057
|
}, M = (e) => {
|
|
3979
4058
|
b.current = p.current?.getBoundingClientRect();
|
|
3980
|
-
let [t = 0, n = 0] =
|
|
4059
|
+
let [t = 0, n = 0] = Wo(e), r = t - (b.current?.left ?? 0), i = (b.current?.height ?? 0) - n - (b.current?.top ?? 0);
|
|
3981
4060
|
if (c !== 1) S.current[0] = r, S.current[1] = i;
|
|
3982
4061
|
else {
|
|
3983
4062
|
let e = Array.isArray(E.current.iMouse?.value) ? E.current.iMouse.value : void 0;
|
|
@@ -3992,7 +4071,7 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
3992
4071
|
b.current = p.current?.getBoundingClientRect();
|
|
3993
4072
|
let t = l, n = Math.floor((b.current?.width ?? 1) * t), r = Math.floor((b.current?.height ?? 1) * t);
|
|
3994
4073
|
if (e.canvas.width = n, e.canvas.height = r, E.current.iResolution?.isNeeded && g.current) {
|
|
3995
|
-
let t = e.getUniformLocation(g.current,
|
|
4074
|
+
let t = e.getUniformLocation(g.current, Oo);
|
|
3996
4075
|
e.uniform2fv(t, [e.canvas.width, e.canvas.height]);
|
|
3997
4076
|
}
|
|
3998
4077
|
}, F = (e, t) => {
|
|
@@ -4006,18 +4085,18 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
4006
4085
|
n.deleteShader(r), d?.($(`Shader compiler log: ${e}`));
|
|
4007
4086
|
}
|
|
4008
4087
|
return r;
|
|
4009
|
-
},
|
|
4088
|
+
}, te = (e, t) => {
|
|
4010
4089
|
let n = m.current;
|
|
4011
4090
|
if (!n) return;
|
|
4012
4091
|
let r = F(n.FRAGMENT_SHADER, e), i = F(n.VERTEX_SHADER, t);
|
|
4013
4092
|
g.current = n.createProgram(), g.current && i && r && (n.attachShader(g.current, i), n.attachShader(g.current, r), n.linkProgram(g.current), n.getProgramParameter(g.current, n.LINK_STATUS) ? (n.useProgram(g.current), _.current = n.getAttribLocation(g.current, "aVertexPosition"), n.enableVertexAttribArray(_.current)) : d?.($(`Unable to initialize the shader program: ${n.getProgramInfoLog(g.current)}`)));
|
|
4014
|
-
},
|
|
4093
|
+
}, ne = () => {
|
|
4015
4094
|
if (r) for (let e of Object.keys(r)) {
|
|
4016
4095
|
let t = r[e];
|
|
4017
4096
|
if (!t) continue;
|
|
4018
|
-
let { value: n, type: i } = t, a =
|
|
4097
|
+
let { value: n, type: i } = t, a = Lo(i);
|
|
4019
4098
|
if (!a) continue;
|
|
4020
|
-
let o =
|
|
4099
|
+
let o = Po(i, n);
|
|
4021
4100
|
E.current[e] = {
|
|
4022
4101
|
type: a,
|
|
4023
4102
|
isNeeded: !1,
|
|
@@ -4025,20 +4104,20 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
4025
4104
|
...o ? { arraySize: o } : {}
|
|
4026
4105
|
};
|
|
4027
4106
|
}
|
|
4028
|
-
},
|
|
4107
|
+
}, re = () => {
|
|
4029
4108
|
let e = m.current;
|
|
4030
4109
|
if (e) {
|
|
4031
4110
|
if (n && n.length > 0) {
|
|
4032
|
-
E.current[
|
|
4111
|
+
E.current[Ao] = {
|
|
4033
4112
|
type: "vec3",
|
|
4034
4113
|
isNeeded: !1,
|
|
4035
4114
|
arraySize: `[${n.length}]`,
|
|
4036
4115
|
value: []
|
|
4037
4116
|
};
|
|
4038
|
-
let t = n.map((t, n) => (E.current[`${
|
|
4117
|
+
let t = n.map((t, n) => (E.current[`${ko}${n}`] = {
|
|
4039
4118
|
type: "sampler2D",
|
|
4040
4119
|
isNeeded: !1
|
|
4041
|
-
}, O(t, n), C.current[n] = new
|
|
4120
|
+
}, O(t, n), C.current[n] = new Uo(e), C.current[n]?.load(t).then((e) => O(e, n))));
|
|
4042
4121
|
Promise.all(t).then(() => {
|
|
4043
4122
|
u && u();
|
|
4044
4123
|
}).catch((e) => {
|
|
@@ -4046,17 +4125,17 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
4046
4125
|
});
|
|
4047
4126
|
} else u && u();
|
|
4048
4127
|
}
|
|
4049
|
-
},
|
|
4050
|
-
let t =
|
|
4128
|
+
}, I = (e) => {
|
|
4129
|
+
let t = yo.includes(a ?? "highp"), n = `precision ${t ? a : yo[1]} float;\n`;
|
|
4051
4130
|
t || f?.($(`wrong precision type ${a}, please make sure to pass one of a valid precision lowp, mediump, highp, by default you shader precision will be set to highp.`));
|
|
4052
4131
|
let r = n.concat(`#define DPR ${l.toFixed(1)}\n`).concat(e.replace(/texture\(/g, "texture2D("));
|
|
4053
4132
|
for (let t of Object.keys(E.current)) if (e.includes(t)) {
|
|
4054
4133
|
let e = E.current[t];
|
|
4055
4134
|
if (!e) continue;
|
|
4056
|
-
r =
|
|
4135
|
+
r = Ko(r, `uniform ${e.type} ${t}${e.arraySize || ""}; \n`, r.lastIndexOf(n) + n.length), e.isNeeded = !0;
|
|
4057
4136
|
}
|
|
4058
|
-
return e.includes("mainImage") && (r = r.concat(
|
|
4059
|
-
},
|
|
4137
|
+
return e.includes("mainImage") && (r = r.concat(bo)), r;
|
|
4138
|
+
}, ie = (e) => {
|
|
4060
4139
|
let t = m.current;
|
|
4061
4140
|
if (!t || !g.current) return;
|
|
4062
4141
|
let n = w.current ? (e - w.current) / 1e3 : 0;
|
|
@@ -4068,31 +4147,31 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
4068
4147
|
if (!g.current) return;
|
|
4069
4148
|
let r = t.getUniformLocation(g.current, e);
|
|
4070
4149
|
if (!r) return;
|
|
4071
|
-
|
|
4150
|
+
Io(t, r, n.type, n.value);
|
|
4072
4151
|
}
|
|
4073
4152
|
}
|
|
4074
4153
|
if (E.current.iMouse?.isNeeded) {
|
|
4075
|
-
let e = t.getUniformLocation(g.current,
|
|
4154
|
+
let e = t.getUniformLocation(g.current, Do);
|
|
4076
4155
|
t.uniform4fv(e, E.current.iMouse.value);
|
|
4077
4156
|
}
|
|
4078
4157
|
if (E.current.iChannelResolution?.isNeeded) {
|
|
4079
|
-
let e = t.getUniformLocation(g.current,
|
|
4158
|
+
let e = t.getUniformLocation(g.current, Ao);
|
|
4080
4159
|
t.uniform3fv(e, E.current.iChannelResolution.value);
|
|
4081
4160
|
}
|
|
4082
4161
|
if (E.current.iDeviceOrientation?.isNeeded) {
|
|
4083
|
-
let e = t.getUniformLocation(g.current,
|
|
4162
|
+
let e = t.getUniformLocation(g.current, jo);
|
|
4084
4163
|
t.uniform4fv(e, E.current.iDeviceOrientation.value);
|
|
4085
4164
|
}
|
|
4086
4165
|
if (E.current.iTime?.isNeeded) {
|
|
4087
|
-
let e = t.getUniformLocation(g.current,
|
|
4166
|
+
let e = t.getUniformLocation(g.current, Co);
|
|
4088
4167
|
x.current += n, t.uniform1f(e, x.current);
|
|
4089
4168
|
}
|
|
4090
4169
|
if (E.current.iTimeDelta?.isNeeded) {
|
|
4091
|
-
let e = t.getUniformLocation(g.current,
|
|
4170
|
+
let e = t.getUniformLocation(g.current, wo);
|
|
4092
4171
|
t.uniform1f(e, n);
|
|
4093
4172
|
}
|
|
4094
4173
|
if (E.current.iDate?.isNeeded) {
|
|
4095
|
-
let e = /* @__PURE__ */ new Date(), n = e.getMonth() + 1, r = e.getDate(), i = e.getFullYear(), a = e.getHours() * 60 * 60 + e.getMinutes() * 60 + e.getSeconds() + e.getMilliseconds() * .001, o = t.getUniformLocation(g.current,
|
|
4174
|
+
let e = /* @__PURE__ */ new Date(), n = e.getMonth() + 1, r = e.getDate(), i = e.getFullYear(), a = e.getHours() * 60 * 60 + e.getMinutes() * 60 + e.getSeconds() + e.getMilliseconds() * .001, o = t.getUniformLocation(g.current, To);
|
|
4096
4175
|
t.uniform4fv(o, [
|
|
4097
4176
|
i,
|
|
4098
4177
|
n,
|
|
@@ -4101,7 +4180,7 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
4101
4180
|
]);
|
|
4102
4181
|
}
|
|
4103
4182
|
if (E.current.iFrame?.isNeeded) {
|
|
4104
|
-
let e = t.getUniformLocation(g.current,
|
|
4183
|
+
let e = t.getUniformLocation(g.current, Eo), n = E.current.iFrame.value;
|
|
4105
4184
|
t.uniform1i(e, n), E.current.iFrame.value = n + 1;
|
|
4106
4185
|
}
|
|
4107
4186
|
if (C.current.length > 0) for (let e = 0; e < C.current.length; e++) {
|
|
@@ -4115,20 +4194,20 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
4115
4194
|
t.activeTexture(t.TEXTURE0 + e), t.bindTexture(t.TEXTURE_2D, i), t.uniform1i(s, e), r && n.updateTexture(i, a, o);
|
|
4116
4195
|
}
|
|
4117
4196
|
}
|
|
4118
|
-
},
|
|
4197
|
+
}, L = (e) => {
|
|
4119
4198
|
let t = m.current;
|
|
4120
4199
|
if (!t) return;
|
|
4121
|
-
t.viewport(0, 0, t.drawingBufferWidth, t.drawingBufferHeight), t.clear(t.COLOR_BUFFER_BIT | t.DEPTH_BUFFER_BIT), t.bindBuffer(t.ARRAY_BUFFER, h.current), t.vertexAttribPointer(_.current ?? 0, 3, t.FLOAT, !1, 0, 0),
|
|
4200
|
+
t.viewport(0, 0, t.drawingBufferWidth, t.drawingBufferHeight), t.clear(t.COLOR_BUFFER_BIT | t.DEPTH_BUFFER_BIT), t.bindBuffer(t.ARRAY_BUFFER, h.current), t.vertexAttribPointer(_.current ?? 0, 3, t.FLOAT, !1, 0, 0), ie(e), t.drawArrays(t.TRIANGLE_STRIP, 0, 4);
|
|
4122
4201
|
let n = E.current.iMouse?.value;
|
|
4123
4202
|
if (E.current.iMouse?.isNeeded && c !== 1 && Array.isArray(n)) {
|
|
4124
4203
|
let e = n[0] ?? 0, t = n[1] ?? 0;
|
|
4125
|
-
n[0] =
|
|
4204
|
+
n[0] = Go(e, S.current[0] ?? 0, c), n[1] = Go(t, S.current[1] ?? 0, c);
|
|
4126
4205
|
}
|
|
4127
|
-
v.current = requestAnimationFrame(
|
|
4128
|
-
},
|
|
4206
|
+
v.current = requestAnimationFrame(L);
|
|
4207
|
+
}, R = () => {
|
|
4129
4208
|
let e = { passive: !0 };
|
|
4130
4209
|
E.current.iMouse?.isNeeded && p.current && (p.current.addEventListener("mousemove", M, e), p.current.addEventListener("mouseout", N, e), p.current.addEventListener("mouseup", N, e), p.current.addEventListener("mousedown", j, e), p.current.addEventListener("touchmove", M, e), p.current.addEventListener("touchend", N, e), p.current.addEventListener("touchstart", j, e)), E.current.iDeviceOrientation?.isNeeded && window.addEventListener("deviceorientation", A, e), p.current && (T.current = new ResizeObserver(P), T.current.observe(p.current), window.addEventListener("resize", P, e));
|
|
4131
|
-
},
|
|
4210
|
+
}, ae = () => {
|
|
4132
4211
|
let e = { passive: !0 };
|
|
4133
4212
|
E.current.iMouse?.isNeeded && p.current && (p.current.removeEventListener("mousemove", M, e), p.current.removeEventListener("mouseout", N, e), p.current.removeEventListener("mouseup", N, e), p.current.removeEventListener("mousedown", j, e), p.current.removeEventListener("touchmove", M, e), p.current.removeEventListener("touchend", N, e), p.current.removeEventListener("touchstart", j, e)), E.current.iDeviceOrientation?.isNeeded && window.removeEventListener("deviceorientation", A, e), T.current && (T.current.disconnect(), window.removeEventListener("resize", P, e));
|
|
4134
4213
|
};
|
|
@@ -4137,9 +4216,9 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
4137
4216
|
}, [r]), W(() => {
|
|
4138
4217
|
let n = C.current;
|
|
4139
4218
|
function r() {
|
|
4140
|
-
|
|
4219
|
+
ee();
|
|
4141
4220
|
let n = m.current;
|
|
4142
|
-
n && p.current && (n.clearColor(...i), n.clearDepth(1), n.enable(n.DEPTH_TEST), n.depthFunc(n.LEQUAL), n.viewport(0, 0, p.current.width, p.current.height), p.current.height = p.current.clientHeight, p.current.width = p.current.clientWidth,
|
|
4221
|
+
n && p.current && (n.clearColor(...i), n.clearDepth(1), n.enable(n.DEPTH_TEST), n.depthFunc(n.LEQUAL), n.viewport(0, 0, p.current.width, p.current.height), p.current.height = p.current.clientHeight, p.current.width = p.current.clientWidth, ne(), re(), te(I(e || xo), t || So), k(), requestAnimationFrame(L), R(), P());
|
|
4143
4222
|
}
|
|
4144
4223
|
return requestAnimationFrame(r), () => {
|
|
4145
4224
|
let e = m.current;
|
|
@@ -4147,7 +4226,7 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
4147
4226
|
if (e.getExtension("WEBGL_lose_context")?.loseContext(), e.useProgram(null), e.deleteProgram(g.current ?? null), n.length > 0) for (let t of n) e.deleteTexture(t._webglTexture);
|
|
4148
4227
|
g.current = null;
|
|
4149
4228
|
}
|
|
4150
|
-
|
|
4229
|
+
ae(), cancelAnimationFrame(v.current ?? 0);
|
|
4151
4230
|
};
|
|
4152
4231
|
}, []), /* @__PURE__ */ J("canvas", {
|
|
4153
4232
|
ref: p,
|
|
@@ -4160,7 +4239,7 @@ function Po({ fs: e, vs: t = co, textures: n = [], uniforms: r, clearColor: i =
|
|
|
4160
4239
|
}
|
|
4161
4240
|
//#endregion
|
|
4162
4241
|
//#region src/addons/ai/ai/F0AuraVoiceAnimation/components/shaderSource.ts
|
|
4163
|
-
var
|
|
4242
|
+
var Jo = "\nconst float TAU = 6.283185;\n\n// Noise for dithering\nvec2 randFibo(vec2 p) {\n p = fract(p * vec2(443.897, 441.423));\n p += dot(p, p.yx + 19.19);\n return fract((p.xx + p.yx) * p.xy);\n}\n\n// Tonemap\nvec3 Tonemap(vec3 x) {\n x *= 4.0;\n return x / (1.0 + x);\n}\n\n// Luma for alpha\nfloat luma(vec3 color) {\n return dot(color, vec3(0.299, 0.587, 0.114));\n}\n\n// RGB to HSV\nvec3 rgb2hsv(vec3 c) {\n vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n float d = q.x - min(q.w, q.y);\n float e = 1.0e-10;\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n}\n\n// HSV to RGB\nvec3 hsv2rgb(vec3 c) {\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\n// SDF shapes\nfloat sdCircle(vec2 st, float r) {\n return length(st) - r;\n}\n\nfloat sdLine(vec2 p, float r) {\n float halfLen = r * 2.0;\n vec2 a = vec2(-halfLen, 0.0);\n vec2 b = vec2(halfLen, 0.0);\n vec2 pa = p - a;\n vec2 ba = b - a;\n float h = clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0);\n return length(pa - ba * h);\n}\n\nfloat getSdf(vec2 st) {\n if(uShape == 1.0) return sdCircle(st, uScale);\n else if(uShape == 2.0) return sdLine(st, uScale);\n return sdCircle(st, uScale); // Default\n}\n\nvec2 turb(vec2 pos, float t, float it) {\n // Initial rotation matrix for swirl direction\n mat2 rotation = mat2(0.6, -0.25, 0.25, 0.9);\n // Secondary rotation applied each iteration (approx 53 degree rotation)\n mat2 layerRotation = mat2(0.6, -0.8, 0.8, 0.6);\n\n float frequency = mix(2.0, 15.0, uFrequency);\n float amplitude = uAmplitude;\n float frequencyGrowth = 1.4;\n float animTime = t * 0.1 * uSpeed;\n\n const int LAYERS = 4;\n for(int i = 0; i < LAYERS; i++) {\n // Calculate wave displacement for this layer\n vec2 rotatedPos = pos * rotation;\n vec2 wave = sin(frequency * rotatedPos + float(i) * animTime + it);\n\n // Apply displacement along rotation direction\n pos += (amplitude / frequency) * rotation[0] * wave;\n\n // Evolve parameters for next layer\n rotation *= layerRotation;\n amplitude *= mix(1.0, max(wave.x, wave.y), uVariance);\n frequency *= frequencyGrowth;\n }\n\n return pos;\n}\n\nconst float ITERATIONS = 36.0;\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n vec2 uv = fragCoord / iResolution.xy;\n\n vec3 pp = vec3(0.0);\n vec3 bloom = vec3(0.0);\n float t = iTime * 0.5;\n vec2 pos = uv - 0.5;\n\n vec2 prevPos = turb(pos, t, 0.0 - 1.0 / ITERATIONS);\n float spacing = mix(1.0, TAU, uSpacing);\n\n for(float i = 1.0; i < ITERATIONS + 1.0; i++) {\n float iter = i / ITERATIONS;\n vec2 st = turb(pos, t, iter * spacing);\n float d = abs(getSdf(st));\n float pd = distance(st, prevPos);\n prevPos = st;\n float dynamicBlur = exp2(pd * 2.0 * 1.4426950408889634) - 1.0;\n float ds = smoothstep(0.0, uBlur * 0.05 + max(dynamicBlur * uSmoothing, 0.001), d);\n\n // Shift color based on iteration using uColorScale\n vec3 color = uColor;\n if(uColorShift > 0.01) {\n vec3 hsv = rgb2hsv(color);\n // Shift hue by iteration\n hsv.x = fract(hsv.x + (1.0 - iter) * uColorShift * 0.3);\n color = hsv2rgb(hsv);\n }\n\n float invd = 1.0 / max(d + dynamicBlur, 0.001);\n pp += (ds - 1.0) * color;\n bloom += clamp(invd, 0.0, 250.0) * color;\n }\n\n pp *= 1.0 / ITERATIONS;\n\n vec3 color;\n\n // Dark mode (default)\n if(uMode < 0.5) {\n // use bloom effect\n bloom = bloom / (bloom + 2e4);\n color = (-pp + bloom * 3.0 * uBloom) * 1.2;\n color += (randFibo(fragCoord).x - 0.5) / 255.0;\n color = Tonemap(color);\n float alpha = luma(color) * uMix;\n fragColor = vec4(color * uMix, alpha);\n }\n\n // Light mode\n else {\n // no bloom effect\n color = -pp;\n color += (randFibo(fragCoord).x - 0.5) / 255.0;\n\n // Preserve hue by tone mapping brightness only\n float brightness = length(color);\n vec3 direction = brightness > 0.0 ? color / brightness : color;\n\n // Reinhard on brightness\n float factor = 2.0;\n float mappedBrightness = (brightness * factor) / (1.0 + brightness * factor);\n color = direction * mappedBrightness;\n\n // Boost saturation to compensate for white background bleed-through\n // When alpha < 1.0, white bleeds through making colors look desaturated\n // So we increase saturation to maintain vibrant appearance\n float gray = dot(color, vec3(0.2, 0.5, 0.1));\n float saturationBoost = 3.0;\n color = mix(vec3(gray), color, saturationBoost);\n\n // Clamp between 0-1\n color = clamp(color, 0.0, 1.0);\n\n float alpha = mappedBrightness * clamp(uMix, 1.0, 2.0);\n fragColor = vec4(color, alpha);\n }\n}", Yo = gt({
|
|
4164
4243
|
base: "aspect-square",
|
|
4165
4244
|
variants: { size: {
|
|
4166
4245
|
icon: "h-[24px]",
|
|
@@ -4171,7 +4250,7 @@ var Fo = "\nconst float TAU = 6.283185;\n\n// Noise for dithering\nvec2 randFibo
|
|
|
4171
4250
|
} },
|
|
4172
4251
|
defaultVariants: { size: "lg" }
|
|
4173
4252
|
});
|
|
4174
|
-
function
|
|
4253
|
+
function Xo(e) {
|
|
4175
4254
|
let t = e.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);
|
|
4176
4255
|
if (t) {
|
|
4177
4256
|
let [, e, n, r] = t;
|
|
@@ -4182,14 +4261,14 @@ function Lo(e) {
|
|
|
4182
4261
|
].map((e = "00") => parseInt(e, 16) / 255);
|
|
4183
4262
|
}
|
|
4184
4263
|
}
|
|
4185
|
-
function
|
|
4186
|
-
let p = G(() =>
|
|
4264
|
+
function Zo({ shape: e = 1, speed: t = 1, amplitude: n = .5, frequency: r = .5, scale: i = .2, blur: a = 1, color: o = "#FF355E", colorShift: s = 1, brightness: c = 1, themeMode: l = typeof window < "u" && document.documentElement.classList.contains("dark") ? "dark" : "light", ref: u, className: d, ...f }) {
|
|
4265
|
+
let p = G(() => Xo(o), [o]);
|
|
4187
4266
|
return /* @__PURE__ */ J("div", {
|
|
4188
4267
|
ref: u,
|
|
4189
4268
|
className: d,
|
|
4190
4269
|
...f,
|
|
4191
|
-
children: /* @__PURE__ */ J(
|
|
4192
|
-
fs:
|
|
4270
|
+
children: /* @__PURE__ */ J(qo, {
|
|
4271
|
+
fs: Jo,
|
|
4193
4272
|
devicePixelRatio: globalThis.devicePixelRatio ?? 1,
|
|
4194
4273
|
uniforms: {
|
|
4195
4274
|
uSpeed: {
|
|
@@ -4266,10 +4345,10 @@ function Ro({ shape: e = 1, speed: t = 1, amplitude: n = .5, frequency: r = .5,
|
|
|
4266
4345
|
})
|
|
4267
4346
|
});
|
|
4268
4347
|
}
|
|
4269
|
-
|
|
4270
|
-
function
|
|
4271
|
-
let { speed: u, scale: d, amplitude: f, frequency: p, brightness: m } =
|
|
4272
|
-
return /* @__PURE__ */ J(
|
|
4348
|
+
Zo.displayName = "AuraShader";
|
|
4349
|
+
function Qo({ size: e = "lg", state: t, color: n, colorShift: r = .05, audioTrack: a, themeMode: o, className: s, ref: c, ...l }) {
|
|
4350
|
+
let { speed: u, scale: d, amplitude: f, frequency: p, brightness: m } = vo(t, a);
|
|
4351
|
+
return /* @__PURE__ */ J(Zo, {
|
|
4273
4352
|
ref: c,
|
|
4274
4353
|
blur: .2,
|
|
4275
4354
|
color: n,
|
|
@@ -4280,13 +4359,13 @@ function zo({ size: e = "lg", state: t, color: n, colorShift: r = .05, audioTrac
|
|
|
4280
4359
|
amplitude: f,
|
|
4281
4360
|
frequency: p,
|
|
4282
4361
|
brightness: m,
|
|
4283
|
-
className: i(
|
|
4362
|
+
className: i(Yo({ size: e }), "overflow-hidden rounded-full", s),
|
|
4284
4363
|
...l
|
|
4285
4364
|
});
|
|
4286
4365
|
}
|
|
4287
4366
|
//#endregion
|
|
4288
4367
|
//#region src/blocks/ai/F0HILActionConfirmation/F0HILActionConfirmation.tsx
|
|
4289
|
-
var
|
|
4368
|
+
var $o = ({ text: e, description: t, avatar: n, confirmationText: r, onConfirm: i, cancelText: a, onCancel: o, stackAt: s = "sm" }) => /* @__PURE__ */ J(b, {
|
|
4290
4369
|
title: e,
|
|
4291
4370
|
description: t,
|
|
4292
4371
|
avatar: n,
|
|
@@ -4299,7 +4378,7 @@ var Bo = ({ text: e, description: t, avatar: n, confirmationText: r, onConfirm:
|
|
|
4299
4378
|
label: a,
|
|
4300
4379
|
onClick: o
|
|
4301
4380
|
}
|
|
4302
|
-
}),
|
|
4381
|
+
}), es = gt({
|
|
4303
4382
|
base: [
|
|
4304
4383
|
"relative flex flex-col rounded-2xl bg-f1-background",
|
|
4305
4384
|
"border border-solid border-f1-border-secondary",
|
|
@@ -4311,10 +4390,10 @@ var Bo = ({ text: e, description: t, avatar: n, confirmationText: r, onConfirm:
|
|
|
4311
4390
|
false: "hover:shadow-md"
|
|
4312
4391
|
} },
|
|
4313
4392
|
defaultVariants: { selected: !1 }
|
|
4314
|
-
}),
|
|
4393
|
+
}), ts = gt({ base: "text-lg font-semibold text-f1-foreground line-clamp-3" }), ns = gt({ base: "text-sm text-f1-foreground-secondary leading-normal" }), rs = gt({ base: "text-sm font-medium text-f1-foreground leading-normal" }), is = ({ description: e, isRevealed: n, onAskOne: r }) => {
|
|
4315
4394
|
let a = t(), o = l();
|
|
4316
|
-
return /* @__PURE__ */ Y(
|
|
4317
|
-
className: i(
|
|
4395
|
+
return /* @__PURE__ */ Y(cn, { children: [e ? /* @__PURE__ */ J("span", {
|
|
4396
|
+
className: i(ns(), "truncate"),
|
|
4318
4397
|
children: e
|
|
4319
4398
|
}) : null, /* @__PURE__ */ J(p, { children: r && n ? /* @__PURE__ */ J(c.div, {
|
|
4320
4399
|
className: "absolute bottom-4 left-4 z-10",
|
|
@@ -4330,7 +4409,7 @@ var Bo = ({ text: e, description: t, avatar: n, confirmationText: r, onConfirm:
|
|
|
4330
4409
|
1
|
|
4331
4410
|
]
|
|
4332
4411
|
},
|
|
4333
|
-
children: /* @__PURE__ */ J(
|
|
4412
|
+
children: /* @__PURE__ */ J(lt, {
|
|
4334
4413
|
size: "md",
|
|
4335
4414
|
label: a.ai.ask,
|
|
4336
4415
|
onClick: (e) => {
|
|
@@ -4338,81 +4417,81 @@ var Bo = ({ text: e, description: t, avatar: n, confirmationText: r, onConfirm:
|
|
|
4338
4417
|
}
|
|
4339
4418
|
})
|
|
4340
4419
|
}) : null })] });
|
|
4341
|
-
},
|
|
4420
|
+
}, as = /* @__PURE__ */ new Set([
|
|
4342
4421
|
"person",
|
|
4343
4422
|
"people",
|
|
4344
4423
|
"team",
|
|
4345
4424
|
"company",
|
|
4346
4425
|
"alert",
|
|
4347
4426
|
"balance"
|
|
4348
|
-
]),
|
|
4427
|
+
]), os = ({ label: e, children: t }) => /* @__PURE__ */ Y("div", {
|
|
4349
4428
|
className: "flex items-center gap-1",
|
|
4350
4429
|
children: [t, e ? /* @__PURE__ */ J("span", {
|
|
4351
|
-
className: i(
|
|
4430
|
+
className: i(rs()),
|
|
4352
4431
|
children: e
|
|
4353
4432
|
}) : null]
|
|
4354
|
-
}),
|
|
4433
|
+
}), ss = ({ balance: e }) => /* @__PURE__ */ J(Nt, {
|
|
4355
4434
|
amount: e.amount,
|
|
4356
4435
|
percentage: e.percentage ?? void 0,
|
|
4357
4436
|
invertStatus: e.invertStatus,
|
|
4358
4437
|
hint: e.hint
|
|
4359
|
-
}),
|
|
4438
|
+
}), cs = (e) => {
|
|
4360
4439
|
let { label: t } = e;
|
|
4361
|
-
return e.content === "person" ? /* @__PURE__ */ J(
|
|
4440
|
+
return e.content === "person" ? /* @__PURE__ */ J(os, {
|
|
4362
4441
|
label: t,
|
|
4363
|
-
children: /* @__PURE__ */ J(
|
|
4442
|
+
children: /* @__PURE__ */ J(Tt, {
|
|
4364
4443
|
firstName: e.avatar.firstName,
|
|
4365
4444
|
lastName: e.avatar.lastName,
|
|
4366
4445
|
src: e.avatar.src,
|
|
4367
4446
|
size: "xs"
|
|
4368
4447
|
})
|
|
4369
|
-
}) : e.content === "people" ? /* @__PURE__ */ J(
|
|
4448
|
+
}) : e.content === "people" ? /* @__PURE__ */ J(Dt, {
|
|
4370
4449
|
type: "person",
|
|
4371
4450
|
avatars: e.avatars,
|
|
4372
4451
|
size: "md",
|
|
4373
4452
|
max: 3
|
|
4374
|
-
}) : e.content === "team" ? /* @__PURE__ */ J(
|
|
4453
|
+
}) : e.content === "team" ? /* @__PURE__ */ J(os, {
|
|
4375
4454
|
label: t,
|
|
4376
|
-
children: /* @__PURE__ */ J(
|
|
4455
|
+
children: /* @__PURE__ */ J(Ot, {
|
|
4377
4456
|
name: e.avatar.name,
|
|
4378
4457
|
src: e.avatar.src,
|
|
4379
4458
|
size: "xs"
|
|
4380
4459
|
})
|
|
4381
|
-
}) : e.content === "company" ? /* @__PURE__ */ J(
|
|
4460
|
+
}) : e.content === "company" ? /* @__PURE__ */ J(os, {
|
|
4382
4461
|
label: t,
|
|
4383
|
-
children: /* @__PURE__ */ J(
|
|
4462
|
+
children: /* @__PURE__ */ J(vt, {
|
|
4384
4463
|
name: e.avatar.name,
|
|
4385
4464
|
src: e.avatar.src,
|
|
4386
4465
|
size: "xs"
|
|
4387
4466
|
})
|
|
4388
|
-
}) : e.content === "alert" ? /* @__PURE__ */ J(
|
|
4467
|
+
}) : e.content === "alert" ? /* @__PURE__ */ J(jt, {
|
|
4389
4468
|
text: e.alertLabel,
|
|
4390
4469
|
level: e.level
|
|
4391
|
-
}) : e.content === "balance" ? /* @__PURE__ */ J(
|
|
4392
|
-
},
|
|
4470
|
+
}) : e.content === "balance" ? /* @__PURE__ */ J(ss, { balance: e.balance }) : null;
|
|
4471
|
+
}, ls = (e) => {
|
|
4393
4472
|
let { heading: t, label: n, content: r, shouldFadeContent: a = !1, fadeTransition: o } = e;
|
|
4394
4473
|
return /* @__PURE__ */ Y("div", {
|
|
4395
4474
|
className: "flex flex-1 flex-col gap-2",
|
|
4396
4475
|
children: [
|
|
4397
4476
|
/* @__PURE__ */ J("span", {
|
|
4398
|
-
className: i(
|
|
4477
|
+
className: i(ts()),
|
|
4399
4478
|
children: t
|
|
4400
4479
|
}),
|
|
4401
4480
|
/* @__PURE__ */ J(c.div, {
|
|
4402
4481
|
className: "flex flex-1 flex-col justify-end gap-2",
|
|
4403
4482
|
animate: { opacity: +!a },
|
|
4404
4483
|
transition: o,
|
|
4405
|
-
children: /* @__PURE__ */ J(
|
|
4484
|
+
children: /* @__PURE__ */ J(cs, { ...e })
|
|
4406
4485
|
}),
|
|
4407
|
-
n && !
|
|
4408
|
-
className: i(
|
|
4486
|
+
n && !as.has(r) ? /* @__PURE__ */ J(c.span, {
|
|
4487
|
+
className: i(rs()),
|
|
4409
4488
|
animate: { opacity: +!a },
|
|
4410
4489
|
transition: o,
|
|
4411
4490
|
children: n
|
|
4412
4491
|
}) : null
|
|
4413
4492
|
]
|
|
4414
4493
|
});
|
|
4415
|
-
},
|
|
4494
|
+
}, us = {
|
|
4416
4495
|
positive: {
|
|
4417
4496
|
stroke: "hsl(var(--positive-50))",
|
|
4418
4497
|
fill: "hsl(var(--positive-50))",
|
|
@@ -4429,18 +4508,18 @@ var Bo = ({ text: e, description: t, avatar: n, confirmationText: r, onConfirm:
|
|
|
4429
4508
|
border: "border-f1-border"
|
|
4430
4509
|
}
|
|
4431
4510
|
};
|
|
4432
|
-
function
|
|
4511
|
+
function ds(e, t) {
|
|
4433
4512
|
let n = e[0]?.value ?? 0, r = e[e.length - 1]?.value ?? 0, i = Math.sign(r - n), a = t ? i * -1 : i;
|
|
4434
4513
|
return a > 0 ? "positive" : a < 0 ? "negative" : "neutral";
|
|
4435
4514
|
}
|
|
4436
|
-
var
|
|
4515
|
+
var fs = ({ cx: e, cy: t, index: n, dataLength: r, color: i }) => n !== r - 1 || e == null || t == null ? null : /* @__PURE__ */ J("circle", {
|
|
4437
4516
|
cx: e,
|
|
4438
4517
|
cy: t,
|
|
4439
4518
|
r: 2,
|
|
4440
4519
|
fill: i,
|
|
4441
4520
|
stroke: "none"
|
|
4442
|
-
}),
|
|
4443
|
-
let n =
|
|
4521
|
+
}), ps = ({ label: e, direction: t }) => {
|
|
4522
|
+
let n = us[t];
|
|
4444
4523
|
return /* @__PURE__ */ J("span", {
|
|
4445
4524
|
className: i("absolute right-0 inline-flex items-center rounded-full border border-solid bg-f1-background px-1.5 py-px text-xs font-medium shadow", t === "negative" ? "bottom-0 translate-y-full" : "top-0 -translate-y-full", n.border, {
|
|
4446
4525
|
positive: "text-f1-foreground-positive",
|
|
@@ -4450,18 +4529,18 @@ var $o = ({ cx: e, cy: t, index: n, dataLength: r, color: i }) => n !== r - 1 ||
|
|
|
4450
4529
|
"data-testid": "sparkline-balance",
|
|
4451
4530
|
children: e
|
|
4452
4531
|
});
|
|
4453
|
-
},
|
|
4454
|
-
let r = `sparkline-gradient-${
|
|
4532
|
+
}, ms = ({ data: e, label: t, invertStatus: n }) => {
|
|
4533
|
+
let r = `sparkline-gradient-${an().replace(/:/g, "")}`, i = ds(e, n), a = us[i];
|
|
4455
4534
|
return /* @__PURE__ */ J("div", {
|
|
4456
4535
|
className: "flex flex-1 flex-col",
|
|
4457
4536
|
children: /* @__PURE__ */ Y("div", {
|
|
4458
4537
|
className: "relative w-full flex-1",
|
|
4459
4538
|
role: "img",
|
|
4460
4539
|
"aria-label": `Sparkline chart showing ${i} trend`,
|
|
4461
|
-
children: [/* @__PURE__ */ J(
|
|
4540
|
+
children: [/* @__PURE__ */ J(ct, {
|
|
4462
4541
|
width: "100%",
|
|
4463
4542
|
height: "100%",
|
|
4464
|
-
children: /* @__PURE__ */ Y(
|
|
4543
|
+
children: /* @__PURE__ */ Y(Ke, {
|
|
4465
4544
|
data: e,
|
|
4466
4545
|
margin: {
|
|
4467
4546
|
top: 4,
|
|
@@ -4486,11 +4565,11 @@ var $o = ({ cx: e, cy: t, index: n, dataLength: r, color: i }) => n !== r - 1 ||
|
|
|
4486
4565
|
stopOpacity: .02
|
|
4487
4566
|
})]
|
|
4488
4567
|
}) }),
|
|
4489
|
-
/* @__PURE__ */ J(
|
|
4568
|
+
/* @__PURE__ */ J(We, {
|
|
4490
4569
|
hide: !0,
|
|
4491
4570
|
domain: ["dataMin - 1", "dataMax + 1"]
|
|
4492
4571
|
}),
|
|
4493
|
-
/* @__PURE__ */ J(
|
|
4572
|
+
/* @__PURE__ */ J(re, {
|
|
4494
4573
|
type: "linear",
|
|
4495
4574
|
dataKey: "value",
|
|
4496
4575
|
stroke: a.stroke,
|
|
@@ -4498,7 +4577,7 @@ var $o = ({ cx: e, cy: t, index: n, dataLength: r, color: i }) => n !== r - 1 ||
|
|
|
4498
4577
|
fill: `url(#${r})`,
|
|
4499
4578
|
fillOpacity: 1,
|
|
4500
4579
|
isAnimationActive: !1,
|
|
4501
|
-
dot: (t) => /* @__PURE__ */
|
|
4580
|
+
dot: (t) => /* @__PURE__ */ tn(fs, {
|
|
4502
4581
|
...t,
|
|
4503
4582
|
key: t.index,
|
|
4504
4583
|
dataLength: e.length,
|
|
@@ -4508,13 +4587,13 @@ var $o = ({ cx: e, cy: t, index: n, dataLength: r, color: i }) => n !== r - 1 ||
|
|
|
4508
4587
|
})
|
|
4509
4588
|
]
|
|
4510
4589
|
})
|
|
4511
|
-
}), /* @__PURE__ */ J(
|
|
4590
|
+
}), /* @__PURE__ */ J(ps, {
|
|
4512
4591
|
label: t,
|
|
4513
4592
|
direction: i
|
|
4514
4593
|
})]
|
|
4515
4594
|
})
|
|
4516
4595
|
});
|
|
4517
|
-
},
|
|
4596
|
+
}, hs = H((e, t) => {
|
|
4518
4597
|
let { description: n, heading: r, label: o, selected: s = !1, onClick: u, onAskOne: d, className: f, ...p } = e, [m, h] = q(!1), [g, _] = q(!1), v = m || g, y = l(), b = v && !!d, x = {
|
|
4519
4598
|
duration: y ? 0 : .2,
|
|
4520
4599
|
ease: [
|
|
@@ -4530,7 +4609,7 @@ var $o = ({ cx: e, cy: t, index: n, dataLength: r, color: i }) => n !== r - 1 ||
|
|
|
4530
4609
|
}, w = m ? "[animation:rotate-gradient_2s_linear_infinite_running]" : "[animation:rotate-gradient_2s_linear_infinite_paused]";
|
|
4531
4610
|
return /* @__PURE__ */ Y("div", {
|
|
4532
4611
|
className: "relative",
|
|
4533
|
-
children: [s ? /* @__PURE__ */ Y(
|
|
4612
|
+
children: [s ? /* @__PURE__ */ Y(cn, { children: [/* @__PURE__ */ J("div", {
|
|
4534
4613
|
"data-testid": "selected-border",
|
|
4535
4614
|
className: i("absolute -inset-px rounded-2xl", "[--gradient-angle:0deg]", "bg-[conic-gradient(from_var(--gradient-angle),hsla(229,57%,76%,0.7),hsla(348,80%,50%,0.7),hsla(348,80%,50%,0.7),hsla(18,80%,50%,0.7),hsla(229,57%,76%,0.7),hsla(229,57%,76%,0.7))]", w)
|
|
4536
4615
|
}), /* @__PURE__ */ J("div", {
|
|
@@ -4540,33 +4619,33 @@ var $o = ({ cx: e, cy: t, index: n, dataLength: r, color: i }) => n !== r - 1 ||
|
|
|
4540
4619
|
ref: t,
|
|
4541
4620
|
role: u ? "button" : void 0,
|
|
4542
4621
|
tabIndex: u ? 0 : void 0,
|
|
4543
|
-
className: i(
|
|
4622
|
+
className: i(es({ selected: s }), s && "relative border-transparent", u && "cursor-pointer select-none", u && a(), f),
|
|
4544
4623
|
onClick: u ? S : void 0,
|
|
4545
4624
|
onKeyDown: u ? C : void 0,
|
|
4546
4625
|
onMouseEnter: () => h(!0),
|
|
4547
4626
|
onMouseLeave: () => h(!1),
|
|
4548
4627
|
onFocus: () => _(!0),
|
|
4549
4628
|
onBlur: () => _(!1),
|
|
4550
|
-
children: [/* @__PURE__ */ J(
|
|
4629
|
+
children: [/* @__PURE__ */ J(is, {
|
|
4551
4630
|
description: n,
|
|
4552
4631
|
isRevealed: v,
|
|
4553
4632
|
onAskOne: d
|
|
4554
4633
|
}), p.content === "sparkline" ? /* @__PURE__ */ Y("div", {
|
|
4555
4634
|
className: "flex flex-1 flex-col gap-2",
|
|
4556
4635
|
children: [/* @__PURE__ */ J("span", {
|
|
4557
|
-
className: i(
|
|
4636
|
+
className: i(ts()),
|
|
4558
4637
|
children: r
|
|
4559
4638
|
}), /* @__PURE__ */ J(c.div, {
|
|
4560
4639
|
className: "-ml-4 flex flex-1 flex-col",
|
|
4561
4640
|
animate: { opacity: +!b },
|
|
4562
4641
|
transition: x,
|
|
4563
|
-
children: /* @__PURE__ */ J(
|
|
4642
|
+
children: /* @__PURE__ */ J(ms, {
|
|
4564
4643
|
data: p.data,
|
|
4565
4644
|
label: o ?? "",
|
|
4566
4645
|
invertStatus: p.invertStatus
|
|
4567
4646
|
})
|
|
4568
4647
|
})]
|
|
4569
|
-
}) : /* @__PURE__ */ J(
|
|
4648
|
+
}) : /* @__PURE__ */ J(ls, {
|
|
4570
4649
|
heading: r,
|
|
4571
4650
|
label: o,
|
|
4572
4651
|
shouldFadeContent: b,
|
|
@@ -4576,21 +4655,21 @@ var $o = ({ cx: e, cy: t, index: n, dataLength: r, color: i }) => n !== r - 1 ||
|
|
|
4576
4655
|
})]
|
|
4577
4656
|
});
|
|
4578
4657
|
});
|
|
4579
|
-
|
|
4658
|
+
hs.displayName = "F0AiInsightCardInternal";
|
|
4580
4659
|
//#endregion
|
|
4581
4660
|
//#region src/addons/ai/ai/F0AiInsightCard/F0AiInsightCard.tsx
|
|
4582
|
-
var
|
|
4583
|
-
let n =
|
|
4661
|
+
var gs = ["className"], _s = H((e, t) => {
|
|
4662
|
+
let n = gs.reduce((e, t) => {
|
|
4584
4663
|
let { [t]: n, ...r } = e;
|
|
4585
4664
|
return r;
|
|
4586
4665
|
}, e);
|
|
4587
|
-
return /* @__PURE__ */ J(
|
|
4666
|
+
return /* @__PURE__ */ J(hs, {
|
|
4588
4667
|
ref: t,
|
|
4589
4668
|
...n
|
|
4590
4669
|
});
|
|
4591
4670
|
});
|
|
4592
|
-
|
|
4593
|
-
var
|
|
4671
|
+
_s.displayName = "F0AiInsightCard";
|
|
4672
|
+
var vs = e(Ne(_s, () => /* @__PURE__ */ Y("div", {
|
|
4594
4673
|
className: "flex w-[217px] h-[200px] flex-col gap-2 rounded-2xl border border-solid border-f1-border-secondary bg-f1-background p-4",
|
|
4595
4674
|
"aria-busy": "true",
|
|
4596
4675
|
"aria-live": "polite",
|
|
@@ -4604,7 +4683,7 @@ var as = e(de(is, () => /* @__PURE__ */ Y("div", {
|
|
|
4604
4683
|
children: [/* @__PURE__ */ J(r, { className: "h-5 w-5 rounded-full" }), /* @__PURE__ */ J(r, { className: "h-3 w-20 rounded" })]
|
|
4605
4684
|
})]
|
|
4606
4685
|
})]
|
|
4607
|
-
}))),
|
|
4686
|
+
}))), ys = [
|
|
4608
4687
|
"text",
|
|
4609
4688
|
"person",
|
|
4610
4689
|
"people",
|
|
@@ -4613,9 +4692,9 @@ var as = e(de(is, () => /* @__PURE__ */ Y("div", {
|
|
|
4613
4692
|
"alert",
|
|
4614
4693
|
"balance",
|
|
4615
4694
|
"sparkline"
|
|
4616
|
-
],
|
|
4617
|
-
function
|
|
4618
|
-
let { module: t, heading: n, title: r, subtitle: o, description: s, seeMoreLabel: c, maxCollapsedDescriptionLength: l =
|
|
4695
|
+
], bs = 180, xs = (e) => Number.isFinite(e) ? Math.max(0, Math.floor(e)) : bs, Ss = (e, t) => e.length <= t ? e : `${e.slice(0, t).trimEnd()}...`, Cs = (e) => e.showActions !== !1, ws = (e) => Object.fromEntries(Object.entries(e).filter(([e]) => e.startsWith("data-")));
|
|
4696
|
+
function Ts(e) {
|
|
4697
|
+
let { module: t, heading: n, title: r, subtitle: o, description: s, seeMoreLabel: c, maxCollapsedDescriptionLength: l = bs } = e, [u, d] = q(!1), p = an(), m = K(null), h = xs(l), g = s.length > h, _ = u ? s : Ss(s, h), v = Cs(e) ? e : null, y = ws(e);
|
|
4619
4698
|
return W(() => {
|
|
4620
4699
|
u && m.current?.focus();
|
|
4621
4700
|
}, [u]), /* @__PURE__ */ Y("section", {
|
|
@@ -4624,7 +4703,7 @@ function fs(e) {
|
|
|
4624
4703
|
children: [
|
|
4625
4704
|
/* @__PURE__ */ Y("div", {
|
|
4626
4705
|
className: "flex items-center gap-3 px-4 py-3",
|
|
4627
|
-
children: [t ? /* @__PURE__ */ J(
|
|
4706
|
+
children: [t ? /* @__PURE__ */ J(Et, {
|
|
4628
4707
|
module: t,
|
|
4629
4708
|
size: "md"
|
|
4630
4709
|
}) : null, /* @__PURE__ */ Y("div", {
|
|
@@ -4648,7 +4727,7 @@ function fs(e) {
|
|
|
4648
4727
|
ref: m,
|
|
4649
4728
|
tabIndex: u ? -1 : void 0,
|
|
4650
4729
|
className: i("text-base text-f1-foreground whitespace-pre-wrap break-words", u && a(), !u && "inline"),
|
|
4651
|
-
children: [_, g && !u ? /* @__PURE__ */ Y(
|
|
4730
|
+
children: [_, g && !u ? /* @__PURE__ */ Y(cn, { children: [" ", /* @__PURE__ */ J("button", {
|
|
4652
4731
|
type: "button",
|
|
4653
4732
|
className: i("inline cursor-pointer rounded-none border-0 bg-transparent p-0 text-base text-f1-foreground underline underline-offset-2 hover:text-f1-foreground-secondary", a()),
|
|
4654
4733
|
"aria-controls": p,
|
|
@@ -4670,21 +4749,21 @@ function fs(e) {
|
|
|
4670
4749
|
]
|
|
4671
4750
|
});
|
|
4672
4751
|
}
|
|
4673
|
-
|
|
4752
|
+
Ts.displayName = "F0AiProposalCard";
|
|
4674
4753
|
//#endregion
|
|
4675
4754
|
//#region src/blocks/ai/F0AiMessageSources/components/CollapsibleMessage.tsx
|
|
4676
|
-
var
|
|
4755
|
+
var Es = ({ icon: e, title: t, children: n }) => {
|
|
4677
4756
|
let [r, i] = q(!1), a = l();
|
|
4678
|
-
return /* @__PURE__ */ Y(
|
|
4757
|
+
return /* @__PURE__ */ Y(Qe, {
|
|
4679
4758
|
className: "mb-1 w-full",
|
|
4680
4759
|
open: r,
|
|
4681
4760
|
onOpenChange: i,
|
|
4682
|
-
children: [/* @__PURE__ */ Y(
|
|
4761
|
+
children: [/* @__PURE__ */ Y(Le, {
|
|
4683
4762
|
className: "flex w-full items-center text-base text-f1-foreground-secondary transition-colors duration-150 hover:text-f1-foreground [&[data-state=open]>svg]:rotate-90",
|
|
4684
4763
|
children: [
|
|
4685
4764
|
/* @__PURE__ */ J("span", {
|
|
4686
4765
|
className: "mr-2 *:block",
|
|
4687
|
-
children: /* @__PURE__ */ J(
|
|
4766
|
+
children: /* @__PURE__ */ J(V, {
|
|
4688
4767
|
icon: e,
|
|
4689
4768
|
className: "block"
|
|
4690
4769
|
})
|
|
@@ -4693,12 +4772,12 @@ var ps = ({ icon: e, title: t, children: n }) => {
|
|
|
4693
4772
|
className: "mr-[2px]",
|
|
4694
4773
|
children: t
|
|
4695
4774
|
}),
|
|
4696
|
-
/* @__PURE__ */ J(
|
|
4697
|
-
icon:
|
|
4775
|
+
/* @__PURE__ */ J(V, {
|
|
4776
|
+
icon: Pt,
|
|
4698
4777
|
className: "h-4 w-4 transition-transform duration-200"
|
|
4699
4778
|
})
|
|
4700
4779
|
]
|
|
4701
|
-
}), /* @__PURE__ */ J(
|
|
4780
|
+
}), /* @__PURE__ */ J(Be, {
|
|
4702
4781
|
forceMount: !0,
|
|
4703
4782
|
className: "data-[state=open]:mt-3",
|
|
4704
4783
|
children: /* @__PURE__ */ J(c.div, {
|
|
@@ -4722,25 +4801,25 @@ var ps = ({ icon: e, title: t, children: n }) => {
|
|
|
4722
4801
|
})
|
|
4723
4802
|
})]
|
|
4724
4803
|
});
|
|
4725
|
-
},
|
|
4804
|
+
}, Ds = (e) => ue[e] ?? qt, Os = ({ iconName: e }) => e ? /* @__PURE__ */ J("div", {
|
|
4726
4805
|
className: "mr-1 flex items-center justify-center",
|
|
4727
|
-
children: /* @__PURE__ */ J(
|
|
4728
|
-
icon:
|
|
4806
|
+
children: /* @__PURE__ */ J(V, {
|
|
4807
|
+
icon: Ds(e),
|
|
4729
4808
|
size: "md",
|
|
4730
4809
|
color: "default"
|
|
4731
4810
|
})
|
|
4732
4811
|
}) : null;
|
|
4733
|
-
function
|
|
4812
|
+
function ks({ sources: e, title: n }) {
|
|
4734
4813
|
let r = t();
|
|
4735
4814
|
if (!e || e.length === 0 || !Array.isArray(e)) return null;
|
|
4736
4815
|
let i = n ?? r.ai.resourcesGroupTitle;
|
|
4737
|
-
return /* @__PURE__ */ J(
|
|
4738
|
-
icon:
|
|
4816
|
+
return /* @__PURE__ */ J(Es, {
|
|
4817
|
+
icon: bt,
|
|
4739
4818
|
title: i,
|
|
4740
4819
|
children: /* @__PURE__ */ J("div", {
|
|
4741
4820
|
className: "flex flex-col gap-1 rounded-lg border border-solid border-f1-border-secondary p-2",
|
|
4742
4821
|
children: e.map((e, t) => {
|
|
4743
|
-
let n = /* @__PURE__ */ J(
|
|
4822
|
+
let n = /* @__PURE__ */ J(Os, { iconName: e.icon });
|
|
4744
4823
|
return e.link ? /* @__PURE__ */ J(s, {
|
|
4745
4824
|
"aria-label": e.title,
|
|
4746
4825
|
href: e.link,
|
|
@@ -4762,30 +4841,30 @@ function gs({ sources: e, title: n }) {
|
|
|
4762
4841
|
})
|
|
4763
4842
|
});
|
|
4764
4843
|
}
|
|
4765
|
-
|
|
4844
|
+
ks.displayName = "F0AiMessageSources";
|
|
4766
4845
|
//#endregion
|
|
4767
4846
|
//#region src/addons/ai/ai/F0AiTableCard/F0AiTableCard.tsx
|
|
4768
|
-
async function
|
|
4769
|
-
let r =
|
|
4847
|
+
async function As(e, t, n) {
|
|
4848
|
+
let r = Ue(e), i = t === "xlsx" ? await P([{
|
|
4770
4849
|
name: "Data",
|
|
4771
4850
|
rows: r
|
|
4772
|
-
}]) : await
|
|
4773
|
-
|
|
4851
|
+
}]) : await Ge(r);
|
|
4852
|
+
v(i, `${n}.${t}`);
|
|
4774
4853
|
}
|
|
4775
|
-
function
|
|
4854
|
+
function js({ dataset: e, title: n, filename: r }) {
|
|
4776
4855
|
let a = t(), o = K(null), s = n ?? a.ai.aiTable.title, c = U((e) => {
|
|
4777
4856
|
if (!o.current) return;
|
|
4778
4857
|
let t = r ?? (s.replace(/\s+/g, "_").toLowerCase() || "table");
|
|
4779
|
-
|
|
4858
|
+
As(o.current, e, t);
|
|
4780
4859
|
}, [s, r]);
|
|
4781
|
-
return e.columns?.length ? /* @__PURE__ */ Y(
|
|
4860
|
+
return e.columns?.length ? /* @__PURE__ */ Y(xt, {
|
|
4782
4861
|
display: "flex",
|
|
4783
4862
|
flexDirection: "column",
|
|
4784
4863
|
gap: "md",
|
|
4785
4864
|
borderRadius: "md",
|
|
4786
4865
|
border: "default",
|
|
4787
4866
|
borderColor: "secondary",
|
|
4788
|
-
children: [/* @__PURE__ */ Y(
|
|
4867
|
+
children: [/* @__PURE__ */ Y(xt, {
|
|
4789
4868
|
display: "flex",
|
|
4790
4869
|
alignItems: "center",
|
|
4791
4870
|
justifyContent: "between",
|
|
@@ -4799,20 +4878,20 @@ function vs({ dataset: e, title: n, filename: r }) {
|
|
|
4799
4878
|
tag: "h2",
|
|
4800
4879
|
className: "text-base font-medium capitalize text-f1-foreground",
|
|
4801
4880
|
children: s
|
|
4802
|
-
}), /* @__PURE__ */ J(
|
|
4803
|
-
icon:
|
|
4881
|
+
}), /* @__PURE__ */ J(we, {
|
|
4882
|
+
icon: z,
|
|
4804
4883
|
size: "md",
|
|
4805
4884
|
items: [{
|
|
4806
4885
|
label: a.ai.aiTable.downloadExcel,
|
|
4807
|
-
icon:
|
|
4886
|
+
icon: z,
|
|
4808
4887
|
onClick: () => c("xlsx")
|
|
4809
4888
|
}, {
|
|
4810
4889
|
label: a.ai.aiTable.downloadCsv,
|
|
4811
|
-
icon:
|
|
4890
|
+
icon: z,
|
|
4812
4891
|
onClick: () => c("csv")
|
|
4813
4892
|
}]
|
|
4814
4893
|
})]
|
|
4815
|
-
}), /* @__PURE__ */ J(
|
|
4894
|
+
}), /* @__PURE__ */ J(xt, {
|
|
4816
4895
|
overflowX: "auto",
|
|
4817
4896
|
children: /* @__PURE__ */ Y("table", {
|
|
4818
4897
|
ref: o,
|
|
@@ -4831,10 +4910,10 @@ function vs({ dataset: e, title: n, filename: r }) {
|
|
|
4831
4910
|
})]
|
|
4832
4911
|
}) : null;
|
|
4833
4912
|
}
|
|
4834
|
-
|
|
4913
|
+
js.displayName = "F0AiTableCard";
|
|
4835
4914
|
//#endregion
|
|
4836
4915
|
//#region src/addons/ai/ai/F0AiChatHeader/components/CreditsPopover.tsx
|
|
4837
|
-
function
|
|
4916
|
+
function Ms({ credits: e, trigger: n }) {
|
|
4838
4917
|
let r = t(), [i, a] = q(!1), [o, s] = q(!1), [l, p] = q(!1), [m, h] = q(null), g = U((t) => {
|
|
4839
4918
|
a(t), t && e?.fetchUsage && (s(!0), p(!1), e.fetchUsage().then((e) => {
|
|
4840
4919
|
h(e), p(!1);
|
|
@@ -4846,19 +4925,19 @@ function ys({ credits: e, trigger: n }) {
|
|
|
4846
4925
|
}, [e]);
|
|
4847
4926
|
if (!e) return null;
|
|
4848
4927
|
let _ = m ? Math.min(100, Math.round(m.used / m.total * 100)) : 0, v = e.companyName;
|
|
4849
|
-
return /* @__PURE__ */ Y(
|
|
4928
|
+
return /* @__PURE__ */ Y(Qt, {
|
|
4850
4929
|
open: i,
|
|
4851
4930
|
onOpenChange: g,
|
|
4852
|
-
children: [/* @__PURE__ */ J(
|
|
4931
|
+
children: [/* @__PURE__ */ J(Jt, {
|
|
4853
4932
|
asChild: !0,
|
|
4854
4933
|
children: n ?? /* @__PURE__ */ J(u, {
|
|
4855
4934
|
variant: "ghost",
|
|
4856
4935
|
hideLabel: !0,
|
|
4857
4936
|
label: r.t("ai.credits.title"),
|
|
4858
|
-
icon:
|
|
4937
|
+
icon: E,
|
|
4859
4938
|
pressed: i
|
|
4860
4939
|
})
|
|
4861
|
-
}), /* @__PURE__ */ Y(
|
|
4940
|
+
}), /* @__PURE__ */ Y(Xt, {
|
|
4862
4941
|
side: "bottom",
|
|
4863
4942
|
align: "end",
|
|
4864
4943
|
alignOffset: -68,
|
|
@@ -4867,7 +4946,7 @@ function ys({ credits: e, trigger: n }) {
|
|
|
4867
4946
|
className: "flex w-[324px] flex-col gap-3 rounded-md border border-solid border-f1-border-secondary p-3",
|
|
4868
4947
|
children: [v ? /* @__PURE__ */ Y("div", {
|
|
4869
4948
|
className: "flex min-w-0 max-w-full flex-1 items-center gap-2 overflow-hidden text-left text-lg text-f1-foreground",
|
|
4870
|
-
children: [/* @__PURE__ */ J(
|
|
4949
|
+
children: [/* @__PURE__ */ J(vt, {
|
|
4871
4950
|
name: e.companyName ?? "",
|
|
4872
4951
|
src: e.companyLogoUrl,
|
|
4873
4952
|
size: "lg"
|
|
@@ -4906,7 +4985,7 @@ function ys({ credits: e, trigger: n }) {
|
|
|
4906
4985
|
className: "text-sm text-f1-foreground-secondary",
|
|
4907
4986
|
children: r.t("ai.credits.creditsError")
|
|
4908
4987
|
}) : null,
|
|
4909
|
-
!o && !l && m ? /* @__PURE__ */ Y(
|
|
4988
|
+
!o && !l && m ? /* @__PURE__ */ Y(cn, { children: [
|
|
4910
4989
|
/* @__PURE__ */ Y("div", {
|
|
4911
4990
|
className: "flex justify-between",
|
|
4912
4991
|
children: [/* @__PURE__ */ J("span", {
|
|
@@ -4953,7 +5032,7 @@ function ys({ credits: e, trigger: n }) {
|
|
|
4953
5032
|
variant: "outlinePromote",
|
|
4954
5033
|
href: e.upgradePlanUrl,
|
|
4955
5034
|
label: r.t("ai.credits.upgradePlan"),
|
|
4956
|
-
icon:
|
|
5035
|
+
icon: qe
|
|
4957
5036
|
})]
|
|
4958
5037
|
}) : null]
|
|
4959
5038
|
})]
|
|
@@ -4962,7 +5041,7 @@ function ys({ credits: e, trigger: n }) {
|
|
|
4962
5041
|
}
|
|
4963
5042
|
//#endregion
|
|
4964
5043
|
//#region src/addons/ai/ai/F0AiChatHeader/components/EmployeeCreditsPopover.tsx
|
|
4965
|
-
var
|
|
5044
|
+
var Ns = "linear-gradient(90deg, #E55619, #A1ADE5, #E51943, #E55619)", Ps = ({ loading: e, error: n, data: r }) => {
|
|
4966
5045
|
let i = t(), a = l(), o = r && r.total > 0 ? Math.min(100, Math.round(r.used / r.total * 100)) : 0, s = r ? Math.max(0, r.total - r.used) : 0;
|
|
4967
5046
|
return /* @__PURE__ */ J("div", {
|
|
4968
5047
|
className: "flex flex-col rounded border border-solid border-f1-border-secondary",
|
|
@@ -5010,7 +5089,7 @@ var bs = "linear-gradient(90deg, #E55619, #A1ADE5, #E51943, #E55619)", xs = ({ l
|
|
|
5010
5089
|
className: "h-full rounded-full",
|
|
5011
5090
|
style: {
|
|
5012
5091
|
width: `${o}%`,
|
|
5013
|
-
backgroundImage:
|
|
5092
|
+
backgroundImage: Ns,
|
|
5014
5093
|
backgroundSize: "300% 100%"
|
|
5015
5094
|
},
|
|
5016
5095
|
animate: a ? void 0 : { backgroundPosition: ["0% 0%", "100% 0%"] },
|
|
@@ -5036,7 +5115,7 @@ var bs = "linear-gradient(90deg, #E55619, #A1ADE5, #E51943, #E55619)", xs = ({ l
|
|
|
5036
5115
|
})
|
|
5037
5116
|
});
|
|
5038
5117
|
};
|
|
5039
|
-
function
|
|
5118
|
+
function Fs({ employeeCredits: e, trigger: n }) {
|
|
5040
5119
|
let r = t(), [i, a] = q(!1), [o, s] = q(!1), [c, l] = q(!1), [f, p] = q(null), m = U((t) => {
|
|
5041
5120
|
a(t), t && e?.fetchUsage && (s(!0), l(!1), e.fetchUsage().then((e) => {
|
|
5042
5121
|
p(e), l(!1);
|
|
@@ -5048,19 +5127,19 @@ function Ss({ employeeCredits: e, trigger: n }) {
|
|
|
5048
5127
|
}, [e]);
|
|
5049
5128
|
if (!e) return null;
|
|
5050
5129
|
let h = !!e.companyName;
|
|
5051
|
-
return /* @__PURE__ */ Y(
|
|
5130
|
+
return /* @__PURE__ */ Y(Qt, {
|
|
5052
5131
|
open: i,
|
|
5053
5132
|
onOpenChange: m,
|
|
5054
|
-
children: [/* @__PURE__ */ J(
|
|
5133
|
+
children: [/* @__PURE__ */ J(Jt, {
|
|
5055
5134
|
asChild: !0,
|
|
5056
5135
|
children: n ?? /* @__PURE__ */ J(u, {
|
|
5057
5136
|
variant: "ghost",
|
|
5058
5137
|
hideLabel: !0,
|
|
5059
5138
|
label: r.t("ai.credits.title"),
|
|
5060
|
-
icon:
|
|
5139
|
+
icon: E,
|
|
5061
5140
|
pressed: i
|
|
5062
5141
|
})
|
|
5063
|
-
}), /* @__PURE__ */ Y(
|
|
5142
|
+
}), /* @__PURE__ */ Y(Xt, {
|
|
5064
5143
|
side: "bottom",
|
|
5065
5144
|
align: "end",
|
|
5066
5145
|
alignOffset: -68,
|
|
@@ -5069,7 +5148,7 @@ function Ss({ employeeCredits: e, trigger: n }) {
|
|
|
5069
5148
|
className: "flex w-[324px] flex-col gap-3 rounded-md border border-solid border-f1-border-secondary p-3",
|
|
5070
5149
|
children: [h ? /* @__PURE__ */ Y("div", {
|
|
5071
5150
|
className: "flex min-w-0 max-w-full flex-1 items-center gap-2 overflow-hidden text-left text-lg text-f1-foreground",
|
|
5072
|
-
children: [/* @__PURE__ */ J(
|
|
5151
|
+
children: [/* @__PURE__ */ J(vt, {
|
|
5073
5152
|
name: e.companyName ?? "",
|
|
5074
5153
|
src: e.companyLogoUrl,
|
|
5075
5154
|
size: "lg"
|
|
@@ -5085,7 +5164,7 @@ function Ss({ employeeCredits: e, trigger: n }) {
|
|
|
5085
5164
|
children: e.planName
|
|
5086
5165
|
}) : null]
|
|
5087
5166
|
})]
|
|
5088
|
-
}) : null, /* @__PURE__ */ J(
|
|
5167
|
+
}) : null, /* @__PURE__ */ J(Ps, {
|
|
5089
5168
|
loading: o,
|
|
5090
5169
|
error: c,
|
|
5091
5170
|
data: f
|
|
@@ -5095,26 +5174,26 @@ function Ss({ employeeCredits: e, trigger: n }) {
|
|
|
5095
5174
|
}
|
|
5096
5175
|
//#endregion
|
|
5097
5176
|
//#region src/addons/ai/ai/F0AiChatHeader/F0AiChatHeader.tsx
|
|
5098
|
-
var
|
|
5177
|
+
var Is = ({ credits: e, employeeCredits: t, trigger: n }) => t ? /* @__PURE__ */ J(Fs, {
|
|
5099
5178
|
employeeCredits: t,
|
|
5100
5179
|
trigger: n
|
|
5101
|
-
}) : e ? /* @__PURE__ */ J(
|
|
5180
|
+
}) : e ? /* @__PURE__ */ J(Ms, {
|
|
5102
5181
|
credits: e,
|
|
5103
5182
|
trigger: n
|
|
5104
|
-
}) : null,
|
|
5105
|
-
let x = t(), S = l(), { panelOverlays:
|
|
5183
|
+
}) : null, Ls = Is, Rs = ({ historyEnabled: e = !1, title: n, currentThreadTitle: r, fullscreen: a = !1, lockVisualizationMode: o = !1, onToggleVisualizationMode: f, onClose: p, onNewChat: m, onOpenHistory: h, hasMessages: g = !1, credits: _, employeeCredits: v, compact: y = !1, actions: b }) => {
|
|
5184
|
+
let x = t(), S = l(), { panelOverlays: w } = B(), T = !o && !w && /* @__PURE__ */ J(u, {
|
|
5106
5185
|
variant: "ghost",
|
|
5107
5186
|
hideLabel: !0,
|
|
5108
5187
|
label: a ? x.ai.collapseChat : x.ai.expandChat,
|
|
5109
|
-
icon: a ?
|
|
5188
|
+
icon: a ? je : C,
|
|
5110
5189
|
onClick: f
|
|
5111
|
-
}),
|
|
5190
|
+
}), E = /* @__PURE__ */ J(u, {
|
|
5112
5191
|
variant: "ghost",
|
|
5113
5192
|
hideLabel: !0,
|
|
5114
5193
|
label: x.ai.closeChat,
|
|
5115
|
-
icon:
|
|
5194
|
+
icon: ot,
|
|
5116
5195
|
onClick: p
|
|
5117
|
-
}),
|
|
5196
|
+
}), D = b?.map((e) => /* @__PURE__ */ J(u, {
|
|
5118
5197
|
variant: "ghost",
|
|
5119
5198
|
hideLabel: !0,
|
|
5120
5199
|
label: e.label,
|
|
@@ -5137,9 +5216,9 @@ var Cs = ({ credits: e, employeeCredits: t, trigger: n }) => t ? /* @__PURE__ */
|
|
|
5137
5216
|
ease: "easeOut"
|
|
5138
5217
|
},
|
|
5139
5218
|
children: [
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5219
|
+
D,
|
|
5220
|
+
T,
|
|
5221
|
+
E
|
|
5143
5222
|
]
|
|
5144
5223
|
})]
|
|
5145
5224
|
}) : e ? /* @__PURE__ */ Y("header", {
|
|
@@ -5157,8 +5236,8 @@ var Cs = ({ credits: e, employeeCredits: t, trigger: n }) => t ? /* @__PURE__ */
|
|
|
5157
5236
|
lines: 1,
|
|
5158
5237
|
className: "min-w-0 text-left",
|
|
5159
5238
|
children: r ?? x.ai.newConversation
|
|
5160
|
-
}), /* @__PURE__ */ J(
|
|
5161
|
-
icon:
|
|
5239
|
+
}), /* @__PURE__ */ J(V, {
|
|
5240
|
+
icon: yt,
|
|
5162
5241
|
color: "default",
|
|
5163
5242
|
size: "md"
|
|
5164
5243
|
})]
|
|
@@ -5173,13 +5252,13 @@ var Cs = ({ credits: e, employeeCredits: t, trigger: n }) => t ? /* @__PURE__ */
|
|
|
5173
5252
|
ease: "easeOut"
|
|
5174
5253
|
},
|
|
5175
5254
|
children: [
|
|
5176
|
-
/* @__PURE__ */ J(
|
|
5255
|
+
/* @__PURE__ */ J(Is, {
|
|
5177
5256
|
credits: _,
|
|
5178
5257
|
employeeCredits: v
|
|
5179
5258
|
}),
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5259
|
+
D,
|
|
5260
|
+
T,
|
|
5261
|
+
E
|
|
5183
5262
|
]
|
|
5184
5263
|
})]
|
|
5185
5264
|
}) : /* @__PURE__ */ Y("header", {
|
|
@@ -5203,41 +5282,41 @@ var Cs = ({ credits: e, employeeCredits: t, trigger: n }) => t ? /* @__PURE__ */
|
|
|
5203
5282
|
variant: "ghost",
|
|
5204
5283
|
hideLabel: !0,
|
|
5205
5284
|
label: x.ai.startNewChat,
|
|
5206
|
-
icon:
|
|
5285
|
+
icon: Ve,
|
|
5207
5286
|
onClick: m
|
|
5208
5287
|
}) : null,
|
|
5209
|
-
/* @__PURE__ */ J(
|
|
5288
|
+
/* @__PURE__ */ J(Is, {
|
|
5210
5289
|
credits: _,
|
|
5211
5290
|
employeeCredits: v
|
|
5212
5291
|
}),
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5292
|
+
D,
|
|
5293
|
+
T,
|
|
5294
|
+
E
|
|
5216
5295
|
]
|
|
5217
5296
|
})]
|
|
5218
5297
|
});
|
|
5219
5298
|
};
|
|
5220
5299
|
//#endregion
|
|
5221
5300
|
//#region src/addons/ai/ai/F0AiChatHistory/utils.ts
|
|
5222
|
-
function
|
|
5301
|
+
function zs(e) {
|
|
5223
5302
|
let t = new Date(e), n = /* @__PURE__ */ new Date();
|
|
5224
|
-
return
|
|
5303
|
+
return tt(t) ? "today" : j(t) ? "yesterday" : Ut(t, n) ? "thisMonth" : "older";
|
|
5225
5304
|
}
|
|
5226
|
-
function
|
|
5227
|
-
let r = new Date(e), i =
|
|
5228
|
-
if (
|
|
5229
|
-
if (
|
|
5230
|
-
let a = !
|
|
5231
|
-
return `${
|
|
5305
|
+
function Bs(e, t, n) {
|
|
5306
|
+
let r = new Date(e), i = zt(r, "p", { locale: n });
|
|
5307
|
+
if (tt(r)) return `${t.today}, ${i}`;
|
|
5308
|
+
if (j(r)) return `${t.yesterday}, ${i}`;
|
|
5309
|
+
let a = !Rt(r, /* @__PURE__ */ new Date());
|
|
5310
|
+
return `${zt(r, a ? "MMM d yyyy" : "MMM d", { locale: n })}, ${i}`;
|
|
5232
5311
|
}
|
|
5233
|
-
function
|
|
5312
|
+
function Vs(e) {
|
|
5234
5313
|
let t = {
|
|
5235
5314
|
today: [],
|
|
5236
5315
|
yesterday: [],
|
|
5237
5316
|
thisMonth: [],
|
|
5238
5317
|
older: []
|
|
5239
5318
|
};
|
|
5240
|
-
for (let n of e) t[
|
|
5319
|
+
for (let n of e) t[zs(n.updatedAt)].push(n);
|
|
5241
5320
|
return [
|
|
5242
5321
|
"today",
|
|
5243
5322
|
"yesterday",
|
|
@@ -5250,14 +5329,14 @@ function Os(e) {
|
|
|
5250
5329
|
}
|
|
5251
5330
|
//#endregion
|
|
5252
5331
|
//#region src/addons/ai/ai/F0AiChatHistory/components/ThreadItem.tsx
|
|
5253
|
-
function
|
|
5254
|
-
let m = t(), h =
|
|
5332
|
+
function Hs({ thread: e, isPinned: n, isActive: r = !1, isPending: o = !1, onSelect: s, onPin: c, onUnpin: l, onDelete: f, className: p }) {
|
|
5333
|
+
let m = t(), h = Bt(), _ = G(() => [{
|
|
5255
5334
|
label: n ? m.ai.unpinChat : m.ai.pinChat,
|
|
5256
|
-
icon: n ?
|
|
5335
|
+
icon: n ? g : Fe,
|
|
5257
5336
|
onClick: () => n ? l(e.id) : c(e.id)
|
|
5258
5337
|
}, {
|
|
5259
5338
|
label: m.ai.deleteChat,
|
|
5260
|
-
icon:
|
|
5339
|
+
icon: Ye,
|
|
5261
5340
|
critical: !0,
|
|
5262
5341
|
onClick: () => f(e.id)
|
|
5263
5342
|
}], [
|
|
@@ -5266,7 +5345,7 @@ function ks({ thread: e, isPinned: n, isActive: r = !1, isPending: o = !1, onSel
|
|
|
5266
5345
|
c,
|
|
5267
5346
|
l,
|
|
5268
5347
|
f
|
|
5269
|
-
]), v = G(() =>
|
|
5348
|
+
]), v = G(() => Bs(e.updatedAt, {
|
|
5270
5349
|
today: m.ai.today,
|
|
5271
5350
|
yesterday: m.ai.yesterday
|
|
5272
5351
|
}, h), [
|
|
@@ -5288,7 +5367,7 @@ function ks({ thread: e, isPinned: n, isActive: r = !1, isPending: o = !1, onSel
|
|
|
5288
5367
|
className: "flex w-full min-w-0 items-center gap-1",
|
|
5289
5368
|
onClick: () => s(e.id, e.title),
|
|
5290
5369
|
children: [
|
|
5291
|
-
e.icon ? /* @__PURE__ */ J(
|
|
5370
|
+
e.icon ? /* @__PURE__ */ J(V, {
|
|
5292
5371
|
icon: e.icon,
|
|
5293
5372
|
size: "sm",
|
|
5294
5373
|
className: "mr-1 shrink-0 text-f1-icon",
|
|
@@ -5312,13 +5391,13 @@ function ks({ thread: e, isPinned: n, isActive: r = !1, isPending: o = !1, onSel
|
|
|
5312
5391
|
o ? /* @__PURE__ */ J("div", {
|
|
5313
5392
|
className: "flex h-7 w-7 shrink-0 items-center justify-center",
|
|
5314
5393
|
"aria-label": m.ai.threadOptions,
|
|
5315
|
-
children: /* @__PURE__ */ J(
|
|
5394
|
+
children: /* @__PURE__ */ J(Mt, { size: "small" })
|
|
5316
5395
|
}) : /* @__PURE__ */ J("div", {
|
|
5317
5396
|
className: i("hidden items-center", "group-hover:flex group-focus-within:flex", "has-[[aria-expanded=true]]:flex"),
|
|
5318
|
-
children: /* @__PURE__ */ J(
|
|
5319
|
-
items:
|
|
5397
|
+
children: /* @__PURE__ */ J(we, {
|
|
5398
|
+
items: _,
|
|
5320
5399
|
children: /* @__PURE__ */ J(u, {
|
|
5321
|
-
icon:
|
|
5400
|
+
icon: Kt,
|
|
5322
5401
|
variant: "ghost",
|
|
5323
5402
|
size: "sm",
|
|
5324
5403
|
label: m.ai.threadOptions,
|
|
@@ -5331,7 +5410,7 @@ function ks({ thread: e, isPinned: n, isActive: r = !1, isPending: o = !1, onSel
|
|
|
5331
5410
|
}
|
|
5332
5411
|
//#endregion
|
|
5333
5412
|
//#region src/addons/ai/ai/F0AiChatHistory/components/CollapsibleGroup.tsx
|
|
5334
|
-
function
|
|
5413
|
+
function Us({ label: e, threads: t, pinnedIds: n, onSelect: r, onPin: o, onUnpin: s, onDelete: c }) {
|
|
5335
5414
|
let [l, u] = q(!0), d = U(() => {
|
|
5336
5415
|
u((e) => !e);
|
|
5337
5416
|
}, []), f = U((e) => {
|
|
@@ -5346,14 +5425,14 @@ function As({ label: e, threads: t, pinnedIds: n, onSelect: r, onPin: o, onUnpin
|
|
|
5346
5425
|
children: [/* @__PURE__ */ J("span", {
|
|
5347
5426
|
className: "text-sm font-medium capitalize tracking-wide text-f1-foreground-secondary",
|
|
5348
5427
|
children: e
|
|
5349
|
-
}), /* @__PURE__ */ J(
|
|
5350
|
-
icon: l ?
|
|
5428
|
+
}), /* @__PURE__ */ J(V, {
|
|
5429
|
+
icon: l ? yt : Gt,
|
|
5351
5430
|
color: "secondary",
|
|
5352
5431
|
size: "xs"
|
|
5353
5432
|
})]
|
|
5354
5433
|
}), l ? /* @__PURE__ */ J("div", {
|
|
5355
5434
|
className: "flex flex-col",
|
|
5356
|
-
children: t.map((e) => /* @__PURE__ */ J(
|
|
5435
|
+
children: t.map((e) => /* @__PURE__ */ J(Hs, {
|
|
5357
5436
|
thread: e,
|
|
5358
5437
|
isPinned: n.has(e.id),
|
|
5359
5438
|
onSelect: r,
|
|
@@ -5365,39 +5444,39 @@ function As({ label: e, threads: t, pinnedIds: n, onSelect: r, onPin: o, onUnpin
|
|
|
5365
5444
|
}
|
|
5366
5445
|
//#endregion
|
|
5367
5446
|
//#region src/addons/ai/ai/F0AiChatHistory/components/ThreadListSkeleton.tsx
|
|
5368
|
-
var
|
|
5447
|
+
var Ws = [
|
|
5369
5448
|
"w-3/5",
|
|
5370
5449
|
"w-4/5",
|
|
5371
5450
|
"w-2/5",
|
|
5372
5451
|
"w-3/4",
|
|
5373
5452
|
"w-1/2",
|
|
5374
5453
|
"w-2/3"
|
|
5375
|
-
],
|
|
5454
|
+
], Gs = ({ width: e }) => /* @__PURE__ */ J("div", {
|
|
5376
5455
|
className: "flex items-center py-1.5 pl-1.5 pr-2",
|
|
5377
5456
|
children: /* @__PURE__ */ J(r, { className: i("h-4 rounded", e) })
|
|
5378
|
-
}),
|
|
5457
|
+
}), Ks = ({ titleWidth: e, rows: t }) => /* @__PURE__ */ Y("div", {
|
|
5379
5458
|
className: "flex flex-col gap-0.5",
|
|
5380
5459
|
children: [/* @__PURE__ */ J("div", {
|
|
5381
5460
|
className: "flex items-center p-1.5",
|
|
5382
5461
|
children: /* @__PURE__ */ J(r, { className: i("h-3 rounded", e) })
|
|
5383
|
-
}), t.map((e, t) => /* @__PURE__ */ J(
|
|
5462
|
+
}), t.map((e, t) => /* @__PURE__ */ J(Gs, { width: e }, t))]
|
|
5384
5463
|
});
|
|
5385
|
-
function
|
|
5464
|
+
function qs() {
|
|
5386
5465
|
return /* @__PURE__ */ Y("div", {
|
|
5387
5466
|
"aria-hidden": "true",
|
|
5388
5467
|
className: "flex flex-col gap-4",
|
|
5389
|
-
children: [/* @__PURE__ */ J(
|
|
5468
|
+
children: [/* @__PURE__ */ J(Ks, {
|
|
5390
5469
|
titleWidth: "w-12",
|
|
5391
|
-
rows:
|
|
5392
|
-
}), /* @__PURE__ */ J(
|
|
5470
|
+
rows: Ws.slice(0, 2)
|
|
5471
|
+
}), /* @__PURE__ */ J(Ks, {
|
|
5393
5472
|
titleWidth: "w-24",
|
|
5394
|
-
rows:
|
|
5473
|
+
rows: Ws
|
|
5395
5474
|
})]
|
|
5396
5475
|
});
|
|
5397
5476
|
}
|
|
5398
5477
|
//#endregion
|
|
5399
5478
|
//#region src/addons/ai/ai/F0AiChatHistory/F0AiChatHistory.tsx
|
|
5400
|
-
var
|
|
5479
|
+
var Js = ({ onClose: e, onSelectThread: n, onNewChat: r, threads: a, isLoading: o, error: c, pinnedIds: l, onPinThread: u, onUnpinThread: f, onDeleteThread: p }) => {
|
|
5401
5480
|
let m = t(), [h, g] = q("");
|
|
5402
5481
|
W(() => {
|
|
5403
5482
|
let t = (t) => {
|
|
@@ -5419,14 +5498,14 @@ var Fs = ({ onClose: e, onSelectThread: n, onNewChat: r, threads: a, isLoading:
|
|
|
5419
5498
|
if (!h.trim()) return a;
|
|
5420
5499
|
let e = h.toLowerCase();
|
|
5421
5500
|
return a.filter((t) => t.title.toLowerCase().includes(e));
|
|
5422
|
-
}, [a, h]), y = G(() => v.filter((e) => l.has(e.id)), [v, l]), b = G(() => v.filter((e) => !l.has(e.id)), [v, l]), x = G(() =>
|
|
5501
|
+
}, [a, h]), y = G(() => v.filter((e) => l.has(e.id)), [v, l]), b = G(() => v.filter((e) => !l.has(e.id)), [v, l]), x = G(() => Vs(b), [b]), S = U((t, r) => {
|
|
5423
5502
|
n(t, r), e();
|
|
5424
5503
|
}, [n, e]), C = U(() => {
|
|
5425
5504
|
r(), e();
|
|
5426
5505
|
}, [r, e]), w = U((e) => {
|
|
5427
5506
|
p(e);
|
|
5428
5507
|
}, [p]), T = y.length > 0 || x.length > 0;
|
|
5429
|
-
return
|
|
5508
|
+
return ln(/* @__PURE__ */ Y(cn, { children: [/* @__PURE__ */ J("div", {
|
|
5430
5509
|
className: "fixed inset-0 z-50 bg-f1-background-overlay animate-in fade-in-0",
|
|
5431
5510
|
onClick: e,
|
|
5432
5511
|
"aria-hidden": "true"
|
|
@@ -5439,8 +5518,8 @@ var Fs = ({ onClose: e, onSelectThread: n, onNewChat: r, threads: a, isLoading:
|
|
|
5439
5518
|
className: i("pointer-events-auto relative flex w-full max-w-[600px] flex-col", "rounded-xl bg-f1-background shadow-lg", "max-h-[min(600px,80vh)]"),
|
|
5440
5519
|
children: [/* @__PURE__ */ Y("div", {
|
|
5441
5520
|
className: "flex flex-shrink-0 items-center gap-2 border-0 border-b border-solid border-f1-border-secondary py-2 pl-5 pr-3",
|
|
5442
|
-
children: [/* @__PURE__ */ J(
|
|
5443
|
-
icon:
|
|
5521
|
+
children: [/* @__PURE__ */ J(V, {
|
|
5522
|
+
icon: bt,
|
|
5444
5523
|
color: "secondary",
|
|
5445
5524
|
size: "md"
|
|
5446
5525
|
}), /* @__PURE__ */ J("input", {
|
|
@@ -5460,8 +5539,8 @@ var Fs = ({ onClose: e, onSelectThread: n, onNewChat: r, threads: a, isLoading:
|
|
|
5460
5539
|
onClick: C,
|
|
5461
5540
|
children: /* @__PURE__ */ Y("div", {
|
|
5462
5541
|
className: "flex w-full items-center gap-2",
|
|
5463
|
-
children: [/* @__PURE__ */ J(
|
|
5464
|
-
icon:
|
|
5542
|
+
children: [/* @__PURE__ */ J(V, {
|
|
5543
|
+
icon: Ve,
|
|
5465
5544
|
color: "default",
|
|
5466
5545
|
size: "md"
|
|
5467
5546
|
}), /* @__PURE__ */ J(d, {
|
|
@@ -5471,7 +5550,7 @@ var Fs = ({ onClose: e, onSelectThread: n, onNewChat: r, threads: a, isLoading:
|
|
|
5471
5550
|
})]
|
|
5472
5551
|
})
|
|
5473
5552
|
}),
|
|
5474
|
-
o ? /* @__PURE__ */ J(
|
|
5553
|
+
o ? /* @__PURE__ */ J(qs, {}) : null,
|
|
5475
5554
|
!o && c ? /* @__PURE__ */ J("p", {
|
|
5476
5555
|
className: "py-8 text-center text-base text-f1-foreground-tertiary",
|
|
5477
5556
|
children: c
|
|
@@ -5480,7 +5559,7 @@ var Fs = ({ onClose: e, onSelectThread: n, onNewChat: r, threads: a, isLoading:
|
|
|
5480
5559
|
className: "py-8 text-center text-base text-f1-foreground-tertiary",
|
|
5481
5560
|
children: m.ai.noPreviousChats
|
|
5482
5561
|
}) : null,
|
|
5483
|
-
!o && !c && y.length > 0 ? /* @__PURE__ */ J(
|
|
5562
|
+
!o && !c && y.length > 0 ? /* @__PURE__ */ J(Us, {
|
|
5484
5563
|
label: m.ai.pinnedChats,
|
|
5485
5564
|
threads: y,
|
|
5486
5565
|
pinnedIds: l,
|
|
@@ -5489,7 +5568,7 @@ var Fs = ({ onClose: e, onSelectThread: n, onNewChat: r, threads: a, isLoading:
|
|
|
5489
5568
|
onUnpin: f,
|
|
5490
5569
|
onDelete: w
|
|
5491
5570
|
}) : null,
|
|
5492
|
-
!o && !c ? x.map((e) => /* @__PURE__ */ J(
|
|
5571
|
+
!o && !c ? x.map((e) => /* @__PURE__ */ J(Us, {
|
|
5493
5572
|
label: _[e.key],
|
|
5494
5573
|
threads: e.threads,
|
|
5495
5574
|
pinnedIds: l,
|
|
@@ -5502,16 +5581,16 @@ var Fs = ({ onClose: e, onSelectThread: n, onNewChat: r, threads: a, isLoading:
|
|
|
5502
5581
|
})]
|
|
5503
5582
|
})
|
|
5504
5583
|
})] }), document.body);
|
|
5505
|
-
},
|
|
5506
|
-
function
|
|
5507
|
-
let e =
|
|
5584
|
+
}, Ys = "f0-ai-pinned-threads";
|
|
5585
|
+
function Xs() {
|
|
5586
|
+
let e = Re(Ys, []);
|
|
5508
5587
|
return new Set(Array.isArray(e) ? e : []);
|
|
5509
5588
|
}
|
|
5510
|
-
function
|
|
5511
|
-
|
|
5589
|
+
function Zs(e) {
|
|
5590
|
+
Oe(Ys, [...e]);
|
|
5512
5591
|
}
|
|
5513
|
-
function
|
|
5514
|
-
let [a, o] = q([]), [s, c] = q(!1), [l, u] = q(null), [d, f] = q(
|
|
5592
|
+
function Qs({ enabled: e = !1, fetchThreads: t, deleteThread: n, pinThread: r, unpinThread: i }) {
|
|
5593
|
+
let [a, o] = q([]), [s, c] = q(!1), [l, u] = q(null), [d, f] = q(Xs), [p, m] = q(() => /* @__PURE__ */ new Set()), h = U(async () => {
|
|
5515
5594
|
c(!0), u(null);
|
|
5516
5595
|
try {
|
|
5517
5596
|
let e = await t();
|
|
@@ -5530,7 +5609,7 @@ function zs({ enabled: e = !1, fetchThreads: t, deleteThread: n, pinThread: r, u
|
|
|
5530
5609
|
f((n) => {
|
|
5531
5610
|
if (t === n.has(e)) return n;
|
|
5532
5611
|
let r = new Set(n);
|
|
5533
|
-
return t ? r.add(e) : r.delete(e),
|
|
5612
|
+
return t ? r.add(e) : r.delete(e), Zs(r), r;
|
|
5534
5613
|
});
|
|
5535
5614
|
}, []), _ = U((e, t) => {
|
|
5536
5615
|
m((n) => {
|
|
@@ -5562,7 +5641,7 @@ function zs({ enabled: e = !1, fetchThreads: t, deleteThread: n, pinThread: r, u
|
|
|
5562
5641
|
await n(e), o((t) => t.filter((t) => t.id !== e)), f((t) => {
|
|
5563
5642
|
if (!t.has(e)) return t;
|
|
5564
5643
|
let n = new Set(t);
|
|
5565
|
-
return n.delete(e),
|
|
5644
|
+
return n.delete(e), Zs(n), n;
|
|
5566
5645
|
});
|
|
5567
5646
|
} catch {
|
|
5568
5647
|
h();
|
|
@@ -5578,11 +5657,11 @@ function zs({ enabled: e = !1, fetchThreads: t, deleteThread: n, pinThread: r, u
|
|
|
5578
5657
|
}
|
|
5579
5658
|
//#endregion
|
|
5580
5659
|
//#region src/addons/ai/ai/F0AiChatUsageLimits/types.ts
|
|
5581
|
-
var
|
|
5660
|
+
var $s = ["top", "bottom"], ec = c.create(_), tc = ({ label: e, reduceMotion: t }) => /* @__PURE__ */ Y("div", {
|
|
5582
5661
|
role: "status",
|
|
5583
5662
|
"aria-live": "polite",
|
|
5584
5663
|
className: "flex flex-row items-center gap-1 rounded-full border border-solid border-f1-border-secondary bg-f1-background px-2 py-1.5 pr-2.5 shadow-md",
|
|
5585
|
-
children: [/* @__PURE__ */ J(
|
|
5664
|
+
children: [/* @__PURE__ */ J(ec, {
|
|
5586
5665
|
size: "xs",
|
|
5587
5666
|
animate: t ? void 0 : {
|
|
5588
5667
|
rotate: [0, 360],
|
|
@@ -5631,7 +5710,7 @@ var Bs = ["top", "bottom"], Vs = c.create(v), Hs = ({ label: e, reduceMotion: t
|
|
|
5631
5710
|
className: "font-medium",
|
|
5632
5711
|
children: e
|
|
5633
5712
|
})]
|
|
5634
|
-
}),
|
|
5713
|
+
}), nc = nn(function({ active: e, label: n, className: r, children: a }) {
|
|
5635
5714
|
let { t: o } = t(), s = l(), u = n ?? o("ai.applyingChanges");
|
|
5636
5715
|
return W(() => {
|
|
5637
5716
|
if (!e) return;
|
|
@@ -5655,7 +5734,7 @@ var Bs = ["top", "bottom"], Vs = c.create(v), Hs = ({ label: e, reduceMotion: t
|
|
|
5655
5734
|
},
|
|
5656
5735
|
children: /* @__PURE__ */ J("div", {
|
|
5657
5736
|
className: "mt-[40vh]",
|
|
5658
|
-
children: /* @__PURE__ */ J(
|
|
5737
|
+
children: /* @__PURE__ */ J(tc, {
|
|
5659
5738
|
label: u,
|
|
5660
5739
|
reduceMotion: s
|
|
5661
5740
|
})
|
|
@@ -5670,4 +5749,4 @@ var Bs = ["top", "bottom"], Vs = c.create(v), Hs = ({ label: e, reduceMotion: t
|
|
|
5670
5749
|
});
|
|
5671
5750
|
});
|
|
5672
5751
|
//#endregion
|
|
5673
|
-
export {
|
|
5752
|
+
export { Qr as A, Aa as C, ci as D, si as E, er as F, qn as I, Dn as L, Xr as M, Zr as N, li as O, Br as P, pn as R, Pa as S, Ji as T, lo as _, qs as a, Ia as b, Ls as c, ks as d, Ts as f, Qo as g, $o as h, Js as i, Jr as j, ai as k, Rs as l, vs as m, $s as n, Us as o, ys as p, Qs as r, Hs as s, nc as t, js as u, eo as v, na as w, La as x, za as y, fn as z };
|