@cuadra-ai/uikit 0.1.27 → 0.1.28
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/adapters/chatModelAdapter.d.ts +2 -1
- package/dist/adapters/chatModelAdapter.d.ts.map +1 -1
- package/dist/components/CuadraChat.d.ts +9 -3
- package/dist/components/CuadraChat.d.ts.map +1 -1
- package/dist/components/CuadraRuntimeProvider.d.ts +2 -1
- package/dist/components/CuadraRuntimeProvider.d.ts.map +1 -1
- package/dist/components/WidgetContent.d.ts +2 -1
- package/dist/components/WidgetContent.d.ts.map +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +398 -398
- package/dist/index.mjs.map +1 -1
- package/dist/widget/cuadra-uikit.umd.js +22 -22
- package/dist/widget/cuadra-uikit.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
var Pr = Object.defineProperty;
|
|
2
2
|
var Rr = (e, r, t) => r in e ? Pr(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
|
-
var
|
|
3
|
+
var oe = (e, r, t) => Rr(e, typeof r != "symbol" ? r + "" : r, t);
|
|
4
4
|
import { jsx as d, jsxs as w, Fragment as ae } from "react/jsx-runtime";
|
|
5
|
-
import vt, { forwardRef as
|
|
6
|
-
import { createPortal as
|
|
7
|
-
import { useThreadListItem as $t, RuntimeAdapterProvider as Fr, useLocalRuntime as Ot, AssistantRuntimeProvider as Ut, unstable_useRemoteThreadListRuntime as zr, useThreadRuntime as jr, useAssistantApi as $r, ThreadPrimitive as
|
|
5
|
+
import vt, { forwardRef as Ae, createElement as tt, useMemo as Q, useState as R, useEffect as O, useCallback as G, memo as Dr, useImperativeHandle as ct, useSyncExternalStore as _r, useRef as pe, createContext as Er } from "react";
|
|
6
|
+
import { createPortal as rt } from "react-dom";
|
|
7
|
+
import { useThreadListItem as $t, RuntimeAdapterProvider as Fr, useLocalRuntime as Ot, AssistantRuntimeProvider as Ut, unstable_useRemoteThreadListRuntime as zr, useThreadRuntime as jr, useAssistantApi as $r, ThreadPrimitive as _e, ComposerPrimitive as ke, useAssistantState as Ce, AttachmentPrimitive as Or, MessagePrimitive as we, ThreadListPrimitive as Xe, useThread as Ur, ThreadListItemPrimitive as Ke } from "@assistant-ui/react";
|
|
8
8
|
import { unstable_memoizeMarkdownComponents as Br, useIsMarkdownCodeBlock as Wr, MarkdownTextPrimitive as qr } from "@assistant-ui/react-markdown";
|
|
9
|
-
let
|
|
9
|
+
let ve = !1, Ct = !1;
|
|
10
10
|
function Tt() {
|
|
11
11
|
if (Ct || (Ct = !0, typeof document > "u" || typeof window > "u"))
|
|
12
12
|
return;
|
|
13
13
|
const e = document.querySelector("link[data-cuadra-uikit-styles]"), r = document.querySelector("style[data-cuadra-uikit-styles]");
|
|
14
14
|
if (e || r) {
|
|
15
|
-
|
|
15
|
+
ve = !0;
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
try {
|
|
@@ -20,7 +20,7 @@ function Tt() {
|
|
|
20
20
|
t.className = "cuadra-flex", t.style.visibility = "hidden", t.style.position = "absolute", t.style.pointerEvents = "none", document.body.appendChild(t);
|
|
21
21
|
const a = window.getComputedStyle(t).display === "flex";
|
|
22
22
|
if (document.body.removeChild(t), a) {
|
|
23
|
-
|
|
23
|
+
ve = !0;
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
} catch {
|
|
@@ -28,7 +28,7 @@ function Tt() {
|
|
|
28
28
|
Hr();
|
|
29
29
|
}
|
|
30
30
|
function Hr() {
|
|
31
|
-
if (
|
|
31
|
+
if (ve)
|
|
32
32
|
return;
|
|
33
33
|
const e = document.createElement("link");
|
|
34
34
|
e.setAttribute("data-cuadra-uikit-styles", "true"), e.rel = "stylesheet", e.type = "text/css";
|
|
@@ -39,7 +39,7 @@ function Hr() {
|
|
|
39
39
|
e.href = "/node_modules/@cuadra-ai/uikit/dist/uikit.css";
|
|
40
40
|
}
|
|
41
41
|
e.onload = () => {
|
|
42
|
-
|
|
42
|
+
ve = !0;
|
|
43
43
|
}, e.onerror = () => {
|
|
44
44
|
const r = [
|
|
45
45
|
"/node_modules/@cuadra-ai/uikit/dist/uikit.css",
|
|
@@ -48,7 +48,7 @@ function Hr() {
|
|
|
48
48
|
let t = 0;
|
|
49
49
|
const a = () => {
|
|
50
50
|
t < r.length && (e.href = r[t++], e.onerror = a, e.onload = () => {
|
|
51
|
-
|
|
51
|
+
ve = !0;
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
54
|
a();
|
|
@@ -77,7 +77,7 @@ var Qr = {
|
|
|
77
77
|
strokeLinecap: "round",
|
|
78
78
|
strokeLinejoin: "round"
|
|
79
79
|
};
|
|
80
|
-
const Gr =
|
|
80
|
+
const Gr = Ae(
|
|
81
81
|
({
|
|
82
82
|
color: e = "currentColor",
|
|
83
83
|
size: r = 24,
|
|
@@ -87,7 +87,7 @@ const Gr = Me(
|
|
|
87
87
|
children: o,
|
|
88
88
|
iconNode: n,
|
|
89
89
|
...s
|
|
90
|
-
}, c) =>
|
|
90
|
+
}, c) => tt(
|
|
91
91
|
"svg",
|
|
92
92
|
{
|
|
93
93
|
ref: c,
|
|
@@ -101,14 +101,14 @@ const Gr = Me(
|
|
|
101
101
|
...s
|
|
102
102
|
},
|
|
103
103
|
[
|
|
104
|
-
...n.map(([u, f]) =>
|
|
104
|
+
...n.map(([u, f]) => tt(u, f)),
|
|
105
105
|
...Array.isArray(o) ? o : [o]
|
|
106
106
|
]
|
|
107
107
|
)
|
|
108
108
|
);
|
|
109
109
|
const U = (e, r) => {
|
|
110
|
-
const t =
|
|
111
|
-
({ className: a, ...i }, o) =>
|
|
110
|
+
const t = Ae(
|
|
111
|
+
({ className: a, ...i }, o) => tt(Gr, {
|
|
112
112
|
ref: o,
|
|
113
113
|
iconNode: r,
|
|
114
114
|
className: Bt(
|
|
@@ -126,7 +126,7 @@ const Zr = [
|
|
|
126
126
|
["path", { d: "M12 19V5", key: "x0mq9r" }]
|
|
127
127
|
], Jr = U("arrow-up", Zr);
|
|
128
128
|
const Yr = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], ea = U("check", Yr);
|
|
129
|
-
const ta = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]],
|
|
129
|
+
const ta = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], at = U("chevron-down", ta);
|
|
130
130
|
const ra = [
|
|
131
131
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
132
132
|
["path", { d: "M12 18a6 6 0 0 0 0-12v12z", key: "j4l70d" }]
|
|
@@ -207,12 +207,12 @@ const xa = [
|
|
|
207
207
|
const wa = [
|
|
208
208
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
209
209
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
210
|
-
],
|
|
210
|
+
], st = U("x", wa);
|
|
211
211
|
class Vt {
|
|
212
212
|
constructor(r, t, a = !1) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
oe(this, "baseUrl");
|
|
214
|
+
oe(this, "sessionToken", null);
|
|
215
|
+
oe(this, "isProxyMode", !1);
|
|
216
216
|
this.baseUrl = r.replace(/\/$/, ""), this.isProxyMode = a, t && (this.sessionToken = t);
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
@@ -535,7 +535,7 @@ function Ta(e) {
|
|
|
535
535
|
}
|
|
536
536
|
};
|
|
537
537
|
}
|
|
538
|
-
const
|
|
538
|
+
const je = /* @__PURE__ */ new Map();
|
|
539
539
|
function Ma(e, r) {
|
|
540
540
|
return {
|
|
541
541
|
async list() {
|
|
@@ -557,7 +557,7 @@ function Ma(e, r) {
|
|
|
557
557
|
}).filter((s) => s !== null) };
|
|
558
558
|
},
|
|
559
559
|
async initialize(t) {
|
|
560
|
-
return { remoteId:
|
|
560
|
+
return { remoteId: je.get(t) || t, externalId: void 0 };
|
|
561
561
|
},
|
|
562
562
|
async rename(t, a) {
|
|
563
563
|
await e.updateChat(t, { title: a });
|
|
@@ -593,7 +593,7 @@ function Ma(e, r) {
|
|
|
593
593
|
},
|
|
594
594
|
// Add a method to update the remoteId mapping when chat ID is received
|
|
595
595
|
updateRemoteId(t, a) {
|
|
596
|
-
|
|
596
|
+
je.set(t, a), r?.(t, a);
|
|
597
597
|
},
|
|
598
598
|
// Provider component that adds thread-specific history adapter
|
|
599
599
|
unstable_Provider: ({ children: t }) => {
|
|
@@ -620,10 +620,10 @@ function Ma(e, r) {
|
|
|
620
620
|
class Aa {
|
|
621
621
|
constructor() {
|
|
622
622
|
/** Per-message metadata, keyed by message ID */
|
|
623
|
-
|
|
623
|
+
oe(this, "messageMetadata", /* @__PURE__ */ new Map());
|
|
624
624
|
/** Current streaming message ID */
|
|
625
|
-
|
|
626
|
-
|
|
625
|
+
oe(this, "currentMessageId", null);
|
|
626
|
+
oe(this, "listeners", /* @__PURE__ */ new Set());
|
|
627
627
|
}
|
|
628
628
|
/**
|
|
629
629
|
* Set the current streaming message ID
|
|
@@ -677,36 +677,36 @@ class Aa {
|
|
|
677
677
|
this.listeners.forEach((r) => r());
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
|
-
const
|
|
681
|
-
let
|
|
680
|
+
const se = new Aa(), At = /* @__PURE__ */ new Map(), nt = [];
|
|
681
|
+
let Ee = [];
|
|
682
682
|
function Xt(e, r, t = 50, a = 800) {
|
|
683
|
-
|
|
683
|
+
nt.push({ question: e, response: r, streamingSpeed: t, initialDelay: a });
|
|
684
684
|
}
|
|
685
685
|
function Kt(e, r) {
|
|
686
686
|
const { modelId: t, systemPrompt: a, ephemeral: i, enableReasoning: o, onChatCreated: n, onUserMessage: s, onThreadIdUpdate: c, onBeforeRequest: u, mockResponseOnBlocked: f } = r;
|
|
687
687
|
let l;
|
|
688
688
|
return {
|
|
689
689
|
async *run(p) {
|
|
690
|
-
const { messages: g, abortSignal: m, context: x } = p, b =
|
|
690
|
+
const { messages: g, abortSignal: m, context: x } = p, b = nt.shift();
|
|
691
691
|
if (b) {
|
|
692
692
|
s?.();
|
|
693
693
|
const T = b.initialDelay ?? 800;
|
|
694
|
-
if (T > 0 && await new Promise((
|
|
694
|
+
if (T > 0 && await new Promise((S) => setTimeout(S, T)), m?.aborted)
|
|
695
695
|
throw new Error("Request aborted");
|
|
696
696
|
const N = b.response.split(" ");
|
|
697
|
-
let
|
|
698
|
-
const
|
|
699
|
-
i && n?.(
|
|
700
|
-
for (let
|
|
697
|
+
let _ = "";
|
|
698
|
+
const L = b.streamingSpeed || 50, H = `premade-${Date.now()}`;
|
|
699
|
+
i && n?.(H);
|
|
700
|
+
for (let S = 0; S < N.length; S++) {
|
|
701
701
|
if (m?.aborted)
|
|
702
702
|
throw new Error("Request aborted");
|
|
703
|
-
|
|
704
|
-
content: [{ type: "text", text:
|
|
705
|
-
}, await new Promise((
|
|
703
|
+
_ += (S === 0 ? "" : " ") + N[S], yield {
|
|
704
|
+
content: [{ type: "text", text: _ }]
|
|
705
|
+
}, await new Promise((q) => setTimeout(q, L + Math.random() * (L * 0.5)));
|
|
706
706
|
}
|
|
707
707
|
yield {
|
|
708
|
-
content: [{ type: "text", text:
|
|
709
|
-
},
|
|
708
|
+
content: [{ type: "text", text: _ }]
|
|
709
|
+
}, Ee.push(
|
|
710
710
|
{ role: "user", content: b.question },
|
|
711
711
|
{ role: "assistant", content: b.response }
|
|
712
712
|
);
|
|
@@ -716,26 +716,26 @@ function Kt(e, r) {
|
|
|
716
716
|
let k = y;
|
|
717
717
|
if (!k && g.length > 0) {
|
|
718
718
|
const T = g.find((N) => N.role === "user");
|
|
719
|
-
T && (k = (typeof T.content == "string" ? T.content : Array.isArray(T.content) && T.content.find((
|
|
719
|
+
T && (k = (typeof T.content == "string" ? T.content : Array.isArray(T.content) && T.content.find((_) => _.type === "text")?.text || "").substring(0, 50));
|
|
720
720
|
}
|
|
721
721
|
let v;
|
|
722
|
-
y && (v =
|
|
723
|
-
let
|
|
722
|
+
y && (v = je.get(y)), !v && k && (v = At.get(k)), !v && l && (v = l), s?.();
|
|
723
|
+
let P = g, I = -1;
|
|
724
724
|
for (let T = g.length - 1; T >= 0; T--)
|
|
725
725
|
if (g[T].role === "assistant") {
|
|
726
|
-
|
|
726
|
+
I = T;
|
|
727
727
|
break;
|
|
728
728
|
}
|
|
729
|
-
(v ||
|
|
730
|
-
const C = Ca(
|
|
731
|
-
if (
|
|
732
|
-
const T =
|
|
729
|
+
(v || I >= 0) && I >= 0 && (P = g.slice(I + 1));
|
|
730
|
+
const C = Ca(P);
|
|
731
|
+
if (Ee.length > 0 && !v) {
|
|
732
|
+
const T = Ee.map((N) => ({
|
|
733
733
|
role: N.role,
|
|
734
734
|
content: N.content
|
|
735
735
|
}));
|
|
736
|
-
C.unshift(...T),
|
|
736
|
+
C.unshift(...T), Ee = [];
|
|
737
737
|
}
|
|
738
|
-
const
|
|
738
|
+
const D = {
|
|
739
739
|
messages: C,
|
|
740
740
|
chatId: v || null,
|
|
741
741
|
// Use server chatId if available
|
|
@@ -744,50 +744,50 @@ function Kt(e, r) {
|
|
|
744
744
|
enableReasoning: o,
|
|
745
745
|
stream: !0
|
|
746
746
|
};
|
|
747
|
-
if (t && t.trim() !== "" && (
|
|
747
|
+
if (t && t.trim() !== "" && (D.modelId = t), u && !await u()) {
|
|
748
748
|
if (f) {
|
|
749
|
-
const N = g.filter((
|
|
750
|
-
let
|
|
751
|
-
|
|
752
|
-
(
|
|
753
|
-
)?.text || "Message")), Xt(
|
|
754
|
-
const
|
|
755
|
-
if (
|
|
749
|
+
const N = typeof f == "function" ? f() : f, _ = g.filter((q) => q.role === "user"), L = _.length > 0 ? _[_.length - 1] : void 0;
|
|
750
|
+
let H = "Message";
|
|
751
|
+
L && (typeof L.content == "string" ? H = L.content : Array.isArray(L.content) && (H = L.content.find(
|
|
752
|
+
(V) => V.type === "text"
|
|
753
|
+
)?.text || "Message")), Xt(H, N, 40, 400);
|
|
754
|
+
const S = nt.shift();
|
|
755
|
+
if (S) {
|
|
756
756
|
s?.();
|
|
757
|
-
const
|
|
758
|
-
if (
|
|
757
|
+
const q = S.initialDelay ?? 400;
|
|
758
|
+
if (q > 0 && await new Promise((Y) => setTimeout(Y, q)), m?.aborted)
|
|
759
759
|
throw new Error("Request aborted");
|
|
760
|
-
const
|
|
761
|
-
let
|
|
762
|
-
const
|
|
763
|
-
i && n?.(
|
|
764
|
-
for (let
|
|
760
|
+
const V = S.response.split(" ");
|
|
761
|
+
let ie = "";
|
|
762
|
+
const le = S.streamingSpeed || 40, de = `mock-${Date.now()}`;
|
|
763
|
+
i && n?.(de);
|
|
764
|
+
for (let Y = 0; Y < V.length; Y++) {
|
|
765
765
|
if (m?.aborted)
|
|
766
766
|
throw new Error("Request aborted");
|
|
767
|
-
|
|
768
|
-
content: [{ type: "text", text:
|
|
769
|
-
}, await new Promise((
|
|
767
|
+
ie += (Y === 0 ? "" : " ") + V[Y], yield {
|
|
768
|
+
content: [{ type: "text", text: ie }]
|
|
769
|
+
}, await new Promise((Le) => setTimeout(Le, le + Math.random() * (le * 0.3)));
|
|
770
770
|
}
|
|
771
771
|
yield {
|
|
772
|
-
content: [{ type: "text", text:
|
|
772
|
+
content: [{ type: "text", text: ie }]
|
|
773
773
|
};
|
|
774
774
|
return;
|
|
775
775
|
}
|
|
776
776
|
}
|
|
777
777
|
throw new Error("Request blocked");
|
|
778
778
|
}
|
|
779
|
-
const E = await e.createOrContinueChat(
|
|
779
|
+
const E = await e.createOrContinueChat(D, m);
|
|
780
780
|
let A = "", h = "", B;
|
|
781
781
|
const z = [];
|
|
782
782
|
let X = 0, K = !1;
|
|
783
|
-
const
|
|
784
|
-
|
|
785
|
-
const
|
|
786
|
-
z.length !== X && (X = z.length,
|
|
783
|
+
const Ie = `msg_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
784
|
+
se.clear(), se.setCurrentMessage(Ie);
|
|
785
|
+
const Se = () => {
|
|
786
|
+
z.length !== X && (X = z.length, se.update({
|
|
787
787
|
sources: z.length > 0 ? [...z] : void 0
|
|
788
788
|
}));
|
|
789
|
-
},
|
|
790
|
-
|
|
789
|
+
}, J = () => {
|
|
790
|
+
Se();
|
|
791
791
|
const T = [];
|
|
792
792
|
return h && T.push({ type: "reasoning", text: h }), A && T.push({ type: "text", text: A }), T.length === 0 && T.push({ type: "text", text: "" }), { content: T };
|
|
793
793
|
};
|
|
@@ -795,19 +795,19 @@ function Kt(e, r) {
|
|
|
795
795
|
if (m?.aborted)
|
|
796
796
|
throw new Error("Request aborted");
|
|
797
797
|
const N = T.id || T.chatId || T.messageId;
|
|
798
|
-
N && !B && (B = N, l = N, n?.(N), y && c && (c(y, N),
|
|
799
|
-
const
|
|
800
|
-
if (
|
|
801
|
-
for (const
|
|
802
|
-
z.some((
|
|
803
|
-
sourceId:
|
|
804
|
-
filename:
|
|
805
|
-
score:
|
|
806
|
-
chunkId:
|
|
807
|
-
datasetId:
|
|
798
|
+
N && !B && (B = N, l = N, n?.(N), y && c && (c(y, N), je.set(y, N)), k && At.set(k, N));
|
|
799
|
+
const _ = T.sources;
|
|
800
|
+
if (_ && Array.isArray(_) && _.length > 0)
|
|
801
|
+
for (const S of _)
|
|
802
|
+
z.some((q) => q.sourceId === S.sourceId) || z.push({
|
|
803
|
+
sourceId: S.sourceId,
|
|
804
|
+
filename: S.filename || "Unknown",
|
|
805
|
+
score: S.score ?? 1,
|
|
806
|
+
chunkId: S.chunkId,
|
|
807
|
+
datasetId: S.datasetId
|
|
808
808
|
});
|
|
809
|
-
const
|
|
810
|
-
if (
|
|
809
|
+
const L = T.reasoning;
|
|
810
|
+
if (L && L.length > 0 && (h += L, yield J()), T.type)
|
|
811
811
|
switch (T.type) {
|
|
812
812
|
case "source-document":
|
|
813
813
|
T.sourceId && z.push({
|
|
@@ -819,13 +819,13 @@ function Kt(e, r) {
|
|
|
819
819
|
case "reasoning-start":
|
|
820
820
|
continue;
|
|
821
821
|
case "reasoning-delta":
|
|
822
|
-
T.delta && (h += T.delta), (A || h) && (yield
|
|
822
|
+
T.delta && (h += T.delta), (A || h) && (yield J());
|
|
823
823
|
continue;
|
|
824
824
|
case "reasoning-end":
|
|
825
|
-
(A || h) && (yield
|
|
825
|
+
(A || h) && (yield J());
|
|
826
826
|
continue;
|
|
827
827
|
case "text-delta":
|
|
828
|
-
T.delta && (h && !K && !A && (K = !0, await new Promise((
|
|
828
|
+
T.delta && (h && !K && !A && (K = !0, await new Promise((S) => setTimeout(S, 400))), A += T.delta), A && (yield J());
|
|
829
829
|
continue;
|
|
830
830
|
case "error":
|
|
831
831
|
throw new Error(T.errorText || "Stream error");
|
|
@@ -837,14 +837,14 @@ function Kt(e, r) {
|
|
|
837
837
|
case "finish":
|
|
838
838
|
continue;
|
|
839
839
|
}
|
|
840
|
-
const
|
|
841
|
-
if (
|
|
842
|
-
(A || h || z.length > 0) && (yield
|
|
840
|
+
const H = T.delta;
|
|
841
|
+
if (H != null && (h && !K && !A && (K = !0, await new Promise((S) => setTimeout(S, 400))), A += H), T.content && (A += T.content), T.message && (A += T.message.content || ""), T.finished) {
|
|
842
|
+
(A || h || z.length > 0) && (yield J());
|
|
843
843
|
break;
|
|
844
844
|
}
|
|
845
|
-
(A || h || z.length > 0) && (yield
|
|
845
|
+
(A || h || z.length > 0) && (yield J());
|
|
846
846
|
}
|
|
847
|
-
(A || h || z.length > 0) && (yield
|
|
847
|
+
(A || h || z.length > 0) && (yield J());
|
|
848
848
|
}
|
|
849
849
|
};
|
|
850
850
|
}
|
|
@@ -910,25 +910,25 @@ function Na({
|
|
|
910
910
|
onBeforeRequest: y,
|
|
911
911
|
mockResponseOnBlocked: k
|
|
912
912
|
}) {
|
|
913
|
-
const v =
|
|
913
|
+
const v = Q(
|
|
914
914
|
() => new Vt(r, t || void 0, a),
|
|
915
915
|
[r, t, a]
|
|
916
|
-
), [
|
|
916
|
+
), [P, I] = R(o || null);
|
|
917
917
|
O(() => {
|
|
918
|
-
o &&
|
|
918
|
+
o && I(o);
|
|
919
919
|
}, [o]);
|
|
920
|
-
const C =
|
|
920
|
+
const C = G(
|
|
921
921
|
(A) => {
|
|
922
922
|
p?.(A);
|
|
923
923
|
},
|
|
924
924
|
[p]
|
|
925
|
-
),
|
|
925
|
+
), D = G(
|
|
926
926
|
(A, h) => {
|
|
927
927
|
m?.(A, h);
|
|
928
928
|
},
|
|
929
929
|
[m]
|
|
930
|
-
), E =
|
|
931
|
-
modelId:
|
|
930
|
+
), E = Q(() => Kt(v, {
|
|
931
|
+
modelId: P || void 0,
|
|
932
932
|
// Pass undefined if not set (backend resolves it)
|
|
933
933
|
systemPrompt: c,
|
|
934
934
|
ephemeral: s,
|
|
@@ -937,13 +937,13 @@ function Na({
|
|
|
937
937
|
onUserMessage: g,
|
|
938
938
|
onBeforeRequest: y,
|
|
939
939
|
mockResponseOnBlocked: k
|
|
940
|
-
}), [v,
|
|
940
|
+
}), [v, P, c, s, u, C, g, y, k]);
|
|
941
941
|
return i === "singleChat" ? /* @__PURE__ */ d(Ia, { modelAdapter: E, enableAttachments: b, children: e }) : /* @__PURE__ */ d(
|
|
942
942
|
Sa,
|
|
943
943
|
{
|
|
944
944
|
client: v,
|
|
945
945
|
modelAdapterOptions: {
|
|
946
|
-
modelId:
|
|
946
|
+
modelId: P || void 0,
|
|
947
947
|
systemPrompt: c,
|
|
948
948
|
ephemeral: s,
|
|
949
949
|
enableReasoning: u,
|
|
@@ -954,7 +954,7 @@ function Na({
|
|
|
954
954
|
},
|
|
955
955
|
initialThreadId: f,
|
|
956
956
|
onChatsLoaded: x,
|
|
957
|
-
onThreadIdUpdate:
|
|
957
|
+
onThreadIdUpdate: D,
|
|
958
958
|
onError: l,
|
|
959
959
|
enableAttachments: b,
|
|
960
960
|
children: e
|
|
@@ -966,7 +966,7 @@ function Ia({
|
|
|
966
966
|
enableAttachments: r,
|
|
967
967
|
children: t
|
|
968
968
|
}) {
|
|
969
|
-
const a =
|
|
969
|
+
const a = Q(() => r ? Qt() : void 0, [r]), i = Ot(e, {
|
|
970
970
|
adapters: {
|
|
971
971
|
...a && { attachments: a }
|
|
972
972
|
}
|
|
@@ -983,14 +983,14 @@ function Sa({
|
|
|
983
983
|
enableAttachments: n,
|
|
984
984
|
children: s
|
|
985
985
|
}) {
|
|
986
|
-
const c =
|
|
986
|
+
const c = Q(() => Ma(e, (x, b) => {
|
|
987
987
|
i?.(x, b);
|
|
988
|
-
}), [e, i]), u =
|
|
988
|
+
}), [e, i]), u = G(
|
|
989
989
|
(x, b) => {
|
|
990
990
|
c.updateRemoteId && c.updateRemoteId(x, b), i?.(x, b);
|
|
991
991
|
},
|
|
992
992
|
[c, i]
|
|
993
|
-
), f =
|
|
993
|
+
), f = Q(() => ({
|
|
994
994
|
...c,
|
|
995
995
|
async list() {
|
|
996
996
|
const x = await c.list();
|
|
@@ -1000,10 +1000,10 @@ function Sa({
|
|
|
1000
1000
|
O(() => {
|
|
1001
1001
|
window.__cuadraThreadListAdapter = f, window.__cuadraThreadListRuntime = null;
|
|
1002
1002
|
}, [f]);
|
|
1003
|
-
const l =
|
|
1003
|
+
const l = Q(() => Kt(e, {
|
|
1004
1004
|
...r,
|
|
1005
1005
|
onThreadIdUpdate: u
|
|
1006
|
-
}), [e, r, u]), p =
|
|
1006
|
+
}), [e, r, u]), p = Q(() => n ? Qt() : void 0, [n]), g = G(() => Ot(l, {
|
|
1007
1007
|
adapters: {
|
|
1008
1008
|
...p && { attachments: p }
|
|
1009
1009
|
}
|
|
@@ -1024,7 +1024,7 @@ function Nt(e, r) {
|
|
|
1024
1024
|
a++, i = t.indexOf(r, i + r.length);
|
|
1025
1025
|
return a;
|
|
1026
1026
|
}
|
|
1027
|
-
const
|
|
1027
|
+
const Te = Be(/[A-Za-z]/), ut = Be(/[\dA-Za-z]/);
|
|
1028
1028
|
function La(e) {
|
|
1029
1029
|
return (
|
|
1030
1030
|
// Special whitespace codes (which have negative values), C0 and Control
|
|
@@ -1032,7 +1032,7 @@ function La(e) {
|
|
|
1032
1032
|
e !== null && (e < 32 || e === 127)
|
|
1033
1033
|
);
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1035
|
+
function ge(e) {
|
|
1036
1036
|
return e !== null && e < -2;
|
|
1037
1037
|
}
|
|
1038
1038
|
function W(e) {
|
|
@@ -1041,8 +1041,8 @@ function W(e) {
|
|
|
1041
1041
|
function te(e) {
|
|
1042
1042
|
return e === -2 || e === -1 || e === 32;
|
|
1043
1043
|
}
|
|
1044
|
-
const
|
|
1045
|
-
function
|
|
1044
|
+
const Ue = Be(/\p{P}|\p{S}/u), ue = Be(/\s/);
|
|
1045
|
+
function Be(e) {
|
|
1046
1046
|
return r;
|
|
1047
1047
|
function r(t) {
|
|
1048
1048
|
return t !== null && t > -1 && e.test(String.fromCharCode(t));
|
|
@@ -1053,7 +1053,7 @@ function Pa(e) {
|
|
|
1053
1053
|
throw new TypeError("Expected a string");
|
|
1054
1054
|
return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
1055
1055
|
}
|
|
1056
|
-
const
|
|
1056
|
+
const We = (
|
|
1057
1057
|
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
|
1058
1058
|
/**
|
|
1059
1059
|
* @type {(
|
|
@@ -1072,7 +1072,7 @@ const Be = (
|
|
|
1072
1072
|
if (e == null)
|
|
1073
1073
|
return Ea;
|
|
1074
1074
|
if (typeof e == "function")
|
|
1075
|
-
return
|
|
1075
|
+
return qe(e);
|
|
1076
1076
|
if (typeof e == "object")
|
|
1077
1077
|
return Array.isArray(e) ? Ra(e) : (
|
|
1078
1078
|
// Cast because `ReadonlyArray` goes into the above but `isArray`
|
|
@@ -1091,8 +1091,8 @@ function Ra(e) {
|
|
|
1091
1091
|
const r = [];
|
|
1092
1092
|
let t = -1;
|
|
1093
1093
|
for (; ++t < e.length; )
|
|
1094
|
-
r[t] =
|
|
1095
|
-
return
|
|
1094
|
+
r[t] = We(e[t]);
|
|
1095
|
+
return qe(a);
|
|
1096
1096
|
function a(...i) {
|
|
1097
1097
|
let o = -1;
|
|
1098
1098
|
for (; ++o < r.length; )
|
|
@@ -1105,7 +1105,7 @@ function Da(e) {
|
|
|
1105
1105
|
/** @type {Record<string, unknown>} */
|
|
1106
1106
|
e
|
|
1107
1107
|
);
|
|
1108
|
-
return
|
|
1108
|
+
return qe(t);
|
|
1109
1109
|
function t(a) {
|
|
1110
1110
|
const i = (
|
|
1111
1111
|
/** @type {Record<string, unknown>} */
|
|
@@ -1119,12 +1119,12 @@ function Da(e) {
|
|
|
1119
1119
|
}
|
|
1120
1120
|
}
|
|
1121
1121
|
function _a(e) {
|
|
1122
|
-
return
|
|
1122
|
+
return qe(r);
|
|
1123
1123
|
function r(t) {
|
|
1124
1124
|
return t && t.type === e;
|
|
1125
1125
|
}
|
|
1126
1126
|
}
|
|
1127
|
-
function
|
|
1127
|
+
function qe(e) {
|
|
1128
1128
|
return r;
|
|
1129
1129
|
function r(t, a, i) {
|
|
1130
1130
|
return !!(Fa(t) && e.call(
|
|
@@ -1141,11 +1141,11 @@ function Ea() {
|
|
|
1141
1141
|
function Fa(e) {
|
|
1142
1142
|
return e !== null && typeof e == "object" && "type" in e;
|
|
1143
1143
|
}
|
|
1144
|
-
const Gt = [], za = !0,
|
|
1144
|
+
const Gt = [], za = !0, it = !1, ja = "skip";
|
|
1145
1145
|
function Zt(e, r, t, a) {
|
|
1146
1146
|
let i;
|
|
1147
1147
|
typeof r == "function" && typeof t != "function" ? (a = t, t = r) : i = r;
|
|
1148
|
-
const o =
|
|
1148
|
+
const o = We(i), n = a ? -1 : 1;
|
|
1149
1149
|
s(e, void 0, [])();
|
|
1150
1150
|
function s(c, u, f) {
|
|
1151
1151
|
const l = (
|
|
@@ -1167,7 +1167,7 @@ function Zt(e, r, t, a) {
|
|
|
1167
1167
|
return p;
|
|
1168
1168
|
function p() {
|
|
1169
1169
|
let g = Gt, m, x, b;
|
|
1170
|
-
if ((!r || o(c, u, f[f.length - 1] || void 0)) && (g = $a(t(c, f)), g[0] ===
|
|
1170
|
+
if ((!r || o(c, u, f[f.length - 1] || void 0)) && (g = $a(t(c, f)), g[0] === it))
|
|
1171
1171
|
return g;
|
|
1172
1172
|
if ("children" in c && c.children) {
|
|
1173
1173
|
const y = (
|
|
@@ -1177,7 +1177,7 @@ function Zt(e, r, t, a) {
|
|
|
1177
1177
|
if (y.children && g[0] !== ja)
|
|
1178
1178
|
for (x = (a ? y.children.length : -1) + n, b = f.concat(y); x > -1 && x < y.children.length; ) {
|
|
1179
1179
|
const k = y.children[x];
|
|
1180
|
-
if (m = s(k, x, b)(), m[0] ===
|
|
1180
|
+
if (m = s(k, x, b)(), m[0] === it)
|
|
1181
1181
|
return m;
|
|
1182
1182
|
x = typeof m[1] == "number" ? m[1] : x + n;
|
|
1183
1183
|
}
|
|
@@ -1190,7 +1190,7 @@ function $a(e) {
|
|
|
1190
1190
|
return Array.isArray(e) ? e : typeof e == "number" ? [za, e] : e == null ? Gt : [e];
|
|
1191
1191
|
}
|
|
1192
1192
|
function Oa(e, r, t) {
|
|
1193
|
-
const i =
|
|
1193
|
+
const i = We((t || {}).ignore || []), o = Ua(r);
|
|
1194
1194
|
let n = -1;
|
|
1195
1195
|
for (; ++n < o.length; )
|
|
1196
1196
|
Zt(e, "text", s);
|
|
@@ -1217,16 +1217,16 @@ function Oa(e, r, t) {
|
|
|
1217
1217
|
p.lastIndex = 0;
|
|
1218
1218
|
let v = p.exec(u.value);
|
|
1219
1219
|
for (; v; ) {
|
|
1220
|
-
const
|
|
1220
|
+
const P = v.index, I = {
|
|
1221
1221
|
index: v.index,
|
|
1222
1222
|
input: v.input,
|
|
1223
1223
|
stack: [...f, u]
|
|
1224
1224
|
};
|
|
1225
|
-
let C = g(...v,
|
|
1226
|
-
if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex =
|
|
1225
|
+
let C = g(...v, I);
|
|
1226
|
+
if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex = P + 1 : (m !== P && k.push({
|
|
1227
1227
|
type: "text",
|
|
1228
|
-
value: u.value.slice(m,
|
|
1229
|
-
}), Array.isArray(C) ? k.push(...C) : C && k.push(C), m =
|
|
1228
|
+
value: u.value.slice(m, P)
|
|
1229
|
+
}), Array.isArray(C) ? k.push(...C) : C && k.push(C), m = P + v[0].length, y = !0), !p.global)
|
|
1230
1230
|
break;
|
|
1231
1231
|
v = p.exec(u.value);
|
|
1232
1232
|
}
|
|
@@ -1253,15 +1253,15 @@ function Wa(e) {
|
|
|
1253
1253
|
return e;
|
|
1254
1254
|
};
|
|
1255
1255
|
}
|
|
1256
|
-
const
|
|
1256
|
+
const Qe = "phrasing", Ge = ["autolink", "link", "image", "label"];
|
|
1257
1257
|
function qa() {
|
|
1258
1258
|
return {
|
|
1259
1259
|
transforms: [Za],
|
|
1260
1260
|
enter: {
|
|
1261
1261
|
literalAutolink: Va,
|
|
1262
|
-
literalAutolinkEmail:
|
|
1263
|
-
literalAutolinkHttp:
|
|
1264
|
-
literalAutolinkWww:
|
|
1262
|
+
literalAutolinkEmail: Ze,
|
|
1263
|
+
literalAutolinkHttp: Ze,
|
|
1264
|
+
literalAutolinkWww: Ze
|
|
1265
1265
|
},
|
|
1266
1266
|
exit: {
|
|
1267
1267
|
literalAutolink: Ga,
|
|
@@ -1278,22 +1278,22 @@ function Ha() {
|
|
|
1278
1278
|
character: "@",
|
|
1279
1279
|
before: "[+\\-.\\w]",
|
|
1280
1280
|
after: "[\\-.\\w]",
|
|
1281
|
-
inConstruct:
|
|
1282
|
-
notInConstruct:
|
|
1281
|
+
inConstruct: Qe,
|
|
1282
|
+
notInConstruct: Ge
|
|
1283
1283
|
},
|
|
1284
1284
|
{
|
|
1285
1285
|
character: ".",
|
|
1286
1286
|
before: "[Ww]",
|
|
1287
1287
|
after: "[\\-.\\w]",
|
|
1288
|
-
inConstruct:
|
|
1289
|
-
notInConstruct:
|
|
1288
|
+
inConstruct: Qe,
|
|
1289
|
+
notInConstruct: Ge
|
|
1290
1290
|
},
|
|
1291
1291
|
{
|
|
1292
1292
|
character: ":",
|
|
1293
1293
|
before: "[ps]",
|
|
1294
1294
|
after: "\\/",
|
|
1295
|
-
inConstruct:
|
|
1296
|
-
notInConstruct:
|
|
1295
|
+
inConstruct: Qe,
|
|
1296
|
+
notInConstruct: Ge
|
|
1297
1297
|
}
|
|
1298
1298
|
]
|
|
1299
1299
|
};
|
|
@@ -1301,7 +1301,7 @@ function Ha() {
|
|
|
1301
1301
|
function Va(e) {
|
|
1302
1302
|
this.enter({ type: "link", title: null, url: "", children: [] }, e);
|
|
1303
1303
|
}
|
|
1304
|
-
function
|
|
1304
|
+
function Ze(e) {
|
|
1305
1305
|
this.config.enter.autolinkProtocol.call(this, e);
|
|
1306
1306
|
}
|
|
1307
1307
|
function Xa(e) {
|
|
@@ -1372,10 +1372,10 @@ function tn(e) {
|
|
|
1372
1372
|
}
|
|
1373
1373
|
function Jt(e, r) {
|
|
1374
1374
|
const t = e.input.charCodeAt(e.index - 1);
|
|
1375
|
-
return (e.index === 0 ||
|
|
1375
|
+
return (e.index === 0 || ue(t) || Ue(t)) && // If it’s an email, the previous character should not be a slash.
|
|
1376
1376
|
(!r || t !== 47);
|
|
1377
1377
|
}
|
|
1378
|
-
function
|
|
1378
|
+
function Ne(e) {
|
|
1379
1379
|
return e.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
|
|
1380
1380
|
}
|
|
1381
1381
|
Yt.peek = dn;
|
|
@@ -1396,7 +1396,7 @@ function on(e) {
|
|
|
1396
1396
|
}
|
|
1397
1397
|
function cn(e) {
|
|
1398
1398
|
const r = this.resume(), t = this.stack[this.stack.length - 1];
|
|
1399
|
-
t.type, t.identifier =
|
|
1399
|
+
t.type, t.identifier = Ne(
|
|
1400
1400
|
this.sliceSerialize(e)
|
|
1401
1401
|
).toLowerCase(), t.label = r;
|
|
1402
1402
|
}
|
|
@@ -1405,7 +1405,7 @@ function sn(e) {
|
|
|
1405
1405
|
}
|
|
1406
1406
|
function un(e) {
|
|
1407
1407
|
const r = this.resume(), t = this.stack[this.stack.length - 1];
|
|
1408
|
-
t.type, t.identifier =
|
|
1408
|
+
t.type, t.identifier = Ne(
|
|
1409
1409
|
this.sliceSerialize(e)
|
|
1410
1410
|
).toLowerCase(), t.label = r;
|
|
1411
1411
|
}
|
|
@@ -1562,14 +1562,14 @@ function vn(e, r) {
|
|
|
1562
1562
|
const y = [];
|
|
1563
1563
|
for (; ++l < u; ) {
|
|
1564
1564
|
const k = x[l] || "";
|
|
1565
|
-
let v = "",
|
|
1565
|
+
let v = "", P = "";
|
|
1566
1566
|
if (t.alignDelimiters !== !1) {
|
|
1567
|
-
const
|
|
1568
|
-
C === 114 ? v = " ".repeat(
|
|
1567
|
+
const I = c[l] - (b[l] || 0), C = o[l];
|
|
1568
|
+
C === 114 ? v = " ".repeat(I) : C === 99 ? I % 2 ? (v = " ".repeat(I / 2 + 0.5), P = " ".repeat(I / 2 - 0.5)) : (v = " ".repeat(I / 2), P = v) : P = " ".repeat(I);
|
|
1569
1569
|
}
|
|
1570
1570
|
t.delimiterStart !== !1 && !l && y.push("|"), t.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is
|
|
1571
1571
|
// empty: there will be a closing space.
|
|
1572
|
-
!(t.alignDelimiters === !1 && k === "") && (t.delimiterStart !== !1 || l) && y.push(" "), t.alignDelimiters !== !1 && y.push(v), y.push(k), t.alignDelimiters !== !1 && y.push(
|
|
1572
|
+
!(t.alignDelimiters === !1 && k === "") && (t.delimiterStart !== !1 || l) && y.push(" "), t.alignDelimiters !== !1 && y.push(v), y.push(k), t.alignDelimiters !== !1 && y.push(P), t.padding !== !1 && y.push(" "), (t.delimiterEnd !== !1 || l !== u - 1) && y.push("|");
|
|
1573
1573
|
}
|
|
1574
1574
|
m.push(
|
|
1575
1575
|
t.delimiterEnd === !1 ? y.join("").replace(/ +$/, "") : y.join("")
|
|
@@ -1679,7 +1679,7 @@ function Ln(e, r, t, a) {
|
|
|
1679
1679
|
function Pn(e, r, t) {
|
|
1680
1680
|
return (t ? "" : " ") + e;
|
|
1681
1681
|
}
|
|
1682
|
-
function
|
|
1682
|
+
function lt(e) {
|
|
1683
1683
|
const r = e.options.quote || '"';
|
|
1684
1684
|
if (r !== '"' && r !== "'")
|
|
1685
1685
|
throw new Error(
|
|
@@ -1688,7 +1688,7 @@ function ut(e) {
|
|
|
1688
1688
|
return r;
|
|
1689
1689
|
}
|
|
1690
1690
|
function Rn(e, r, t, a) {
|
|
1691
|
-
const i =
|
|
1691
|
+
const i = lt(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.enter("definition");
|
|
1692
1692
|
let s = t.enter("label");
|
|
1693
1693
|
const c = t.createTracker(a);
|
|
1694
1694
|
let u = c.move("[");
|
|
@@ -1725,17 +1725,17 @@ function Dn(e) {
|
|
|
1725
1725
|
);
|
|
1726
1726
|
return r;
|
|
1727
1727
|
}
|
|
1728
|
-
function
|
|
1728
|
+
function Me(e) {
|
|
1729
1729
|
return "&#x" + e.toString(16).toUpperCase() + ";";
|
|
1730
1730
|
}
|
|
1731
|
-
function
|
|
1732
|
-
if (e === null || W(e) ||
|
|
1731
|
+
function $e(e) {
|
|
1732
|
+
if (e === null || W(e) || ue(e))
|
|
1733
1733
|
return 1;
|
|
1734
|
-
if (
|
|
1734
|
+
if (Ue(e))
|
|
1735
1735
|
return 2;
|
|
1736
1736
|
}
|
|
1737
|
-
function
|
|
1738
|
-
const a =
|
|
1737
|
+
function Oe(e, r, t) {
|
|
1738
|
+
const a = $e(e), i = $e(r);
|
|
1739
1739
|
return a === void 0 ? i === void 0 ? (
|
|
1740
1740
|
// Letter inside:
|
|
1741
1741
|
// we have to encode *both* letters for `_` as it is looser.
|
|
@@ -1777,14 +1777,14 @@ function rr(e, r, t, a) {
|
|
|
1777
1777
|
...n.current()
|
|
1778
1778
|
})
|
|
1779
1779
|
);
|
|
1780
|
-
const u = c.charCodeAt(0), f =
|
|
1780
|
+
const u = c.charCodeAt(0), f = Oe(
|
|
1781
1781
|
a.before.charCodeAt(a.before.length - 1),
|
|
1782
1782
|
u,
|
|
1783
1783
|
i
|
|
1784
1784
|
);
|
|
1785
|
-
f.inside && (c =
|
|
1786
|
-
const l = c.charCodeAt(c.length - 1), p =
|
|
1787
|
-
p.inside && (c = c.slice(0, -1) +
|
|
1785
|
+
f.inside && (c = Me(u) + c.slice(1));
|
|
1786
|
+
const l = c.charCodeAt(c.length - 1), p = Oe(a.after.charCodeAt(0), l, i);
|
|
1787
|
+
p.inside && (c = c.slice(0, -1) + Me(l));
|
|
1788
1788
|
const g = n.move(i);
|
|
1789
1789
|
return o(), t.attentionEncodeSurroundingInfo = {
|
|
1790
1790
|
after: p.outside,
|
|
@@ -1832,7 +1832,7 @@ function jn(e, r) {
|
|
|
1832
1832
|
let t = !1;
|
|
1833
1833
|
return En(e, function(a) {
|
|
1834
1834
|
if ("value" in a && /\r?\n|\r/.test(a.value) || a.type === "break")
|
|
1835
|
-
return t = !0,
|
|
1835
|
+
return t = !0, it;
|
|
1836
1836
|
}), !!((!e.depth || e.depth < 3) && ar(e) && (r.options.setext || t));
|
|
1837
1837
|
}
|
|
1838
1838
|
function $n(e, r, t, a) {
|
|
@@ -1862,7 +1862,7 @@ function $n(e, r, t, a) {
|
|
|
1862
1862
|
`,
|
|
1863
1863
|
...o.current()
|
|
1864
1864
|
});
|
|
1865
|
-
return /^[\t ]/.test(u) && (u =
|
|
1865
|
+
return /^[\t ]/.test(u) && (u = Me(u.charCodeAt(0)) + u.slice(1)), u = u ? n + " " + u : n, t.options.closeAtx && (u += " " + n), c(), s(), u;
|
|
1866
1866
|
}
|
|
1867
1867
|
ir.peek = On;
|
|
1868
1868
|
function ir(e) {
|
|
@@ -1873,7 +1873,7 @@ function On() {
|
|
|
1873
1873
|
}
|
|
1874
1874
|
or.peek = Un;
|
|
1875
1875
|
function or(e, r, t, a) {
|
|
1876
|
-
const i =
|
|
1876
|
+
const i = lt(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.enter("image");
|
|
1877
1877
|
let s = t.enter("label");
|
|
1878
1878
|
const c = t.createTracker(a);
|
|
1879
1879
|
let u = c.move("![");
|
|
@@ -1956,7 +1956,7 @@ function ur(e, r) {
|
|
|
1956
1956
|
}
|
|
1957
1957
|
lr.peek = qn;
|
|
1958
1958
|
function lr(e, r, t, a) {
|
|
1959
|
-
const i =
|
|
1959
|
+
const i = lt(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.createTracker(a);
|
|
1960
1960
|
let s, c;
|
|
1961
1961
|
if (ur(e, t)) {
|
|
1962
1962
|
const f = t.stack;
|
|
@@ -2023,7 +2023,7 @@ function dr(e, r, t, a) {
|
|
|
2023
2023
|
function Hn() {
|
|
2024
2024
|
return "[";
|
|
2025
2025
|
}
|
|
2026
|
-
function
|
|
2026
|
+
function dt(e) {
|
|
2027
2027
|
const r = e.options.bullet || "*";
|
|
2028
2028
|
if (r !== "*" && r !== "+" && r !== "-")
|
|
2029
2029
|
throw new Error(
|
|
@@ -2032,7 +2032,7 @@ function lt(e) {
|
|
|
2032
2032
|
return r;
|
|
2033
2033
|
}
|
|
2034
2034
|
function Vn(e) {
|
|
2035
|
-
const r =
|
|
2035
|
+
const r = dt(e), t = e.options.bulletOther;
|
|
2036
2036
|
if (!t)
|
|
2037
2037
|
return r === "*" ? "-" : "*";
|
|
2038
2038
|
if (t !== "*" && t !== "+" && t !== "-")
|
|
@@ -2063,7 +2063,7 @@ function fr(e) {
|
|
|
2063
2063
|
}
|
|
2064
2064
|
function Kn(e, r, t, a) {
|
|
2065
2065
|
const i = t.enter("list"), o = t.bulletCurrent;
|
|
2066
|
-
let n = e.ordered ? Xn(t) :
|
|
2066
|
+
let n = e.ordered ? Xn(t) : dt(t);
|
|
2067
2067
|
const s = e.ordered ? n === "." ? ")" : "." : Vn(t);
|
|
2068
2068
|
let c = r && t.bulletLastUsed ? n === t.bulletLastUsed : !1;
|
|
2069
2069
|
if (!e.ordered) {
|
|
@@ -2099,7 +2099,7 @@ function Qn(e) {
|
|
|
2099
2099
|
}
|
|
2100
2100
|
function Gn(e, r, t, a) {
|
|
2101
2101
|
const i = Qn(t);
|
|
2102
|
-
let o = t.bulletCurrent ||
|
|
2102
|
+
let o = t.bulletCurrent || dt(t);
|
|
2103
2103
|
r && r.type === "list" && r.ordered && (o = (typeof r.start == "number" && r.start > -1 ? r.start : 1) + (t.options.incrementListMarker === !1 ? 0 : r.children.indexOf(e)) + o);
|
|
2104
2104
|
let n = o.length + 1;
|
|
2105
2105
|
(i === "tab" || i === "mixed" && (r && r.type === "list" && r.spread || e.spread)) && (n = Math.ceil(n / 4) * 4);
|
|
@@ -2120,7 +2120,7 @@ function Zn(e, r, t, a) {
|
|
|
2120
2120
|
}
|
|
2121
2121
|
const Jn = (
|
|
2122
2122
|
/** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
|
|
2123
|
-
|
|
2123
|
+
We([
|
|
2124
2124
|
"break",
|
|
2125
2125
|
"delete",
|
|
2126
2126
|
"emphasis",
|
|
@@ -2167,14 +2167,14 @@ function hr(e, r, t, a) {
|
|
|
2167
2167
|
...n.current()
|
|
2168
2168
|
})
|
|
2169
2169
|
);
|
|
2170
|
-
const u = c.charCodeAt(0), f =
|
|
2170
|
+
const u = c.charCodeAt(0), f = Oe(
|
|
2171
2171
|
a.before.charCodeAt(a.before.length - 1),
|
|
2172
2172
|
u,
|
|
2173
2173
|
i
|
|
2174
2174
|
);
|
|
2175
|
-
f.inside && (c =
|
|
2176
|
-
const l = c.charCodeAt(c.length - 1), p =
|
|
2177
|
-
p.inside && (c = c.slice(0, -1) +
|
|
2175
|
+
f.inside && (c = Me(u) + c.slice(1));
|
|
2176
|
+
const l = c.charCodeAt(c.length - 1), p = Oe(a.after.charCodeAt(0), l, i);
|
|
2177
|
+
p.inside && (c = c.slice(0, -1) + Me(l));
|
|
2178
2178
|
const g = n.move(i + i);
|
|
2179
2179
|
return o(), t.attentionEncodeSurroundingInfo = {
|
|
2180
2180
|
after: p.outside,
|
|
@@ -2232,9 +2232,9 @@ function ii() {
|
|
|
2232
2232
|
exit: {
|
|
2233
2233
|
codeText: ui,
|
|
2234
2234
|
table: ci,
|
|
2235
|
-
tableData:
|
|
2236
|
-
tableHeader:
|
|
2237
|
-
tableRow:
|
|
2235
|
+
tableData: Je,
|
|
2236
|
+
tableHeader: Je,
|
|
2237
|
+
tableRow: Je
|
|
2238
2238
|
}
|
|
2239
2239
|
};
|
|
2240
2240
|
}
|
|
@@ -2257,7 +2257,7 @@ function ci(e) {
|
|
|
2257
2257
|
function si(e) {
|
|
2258
2258
|
this.enter({ type: "tableRow", children: [] }, e);
|
|
2259
2259
|
}
|
|
2260
|
-
function
|
|
2260
|
+
function Je(e) {
|
|
2261
2261
|
this.exit(e);
|
|
2262
2262
|
}
|
|
2263
2263
|
function Rt(e) {
|
|
@@ -2421,7 +2421,7 @@ function bi(e) {
|
|
|
2421
2421
|
]
|
|
2422
2422
|
};
|
|
2423
2423
|
}
|
|
2424
|
-
function
|
|
2424
|
+
function ze(e, r, t, a) {
|
|
2425
2425
|
const i = e.length;
|
|
2426
2426
|
let o = 0, n;
|
|
2427
2427
|
if (r < 0 ? r = -r > i ? 0 : i + r : r = r > i ? i : r, t = t > 0 ? t : 0, a.length < 1e4)
|
|
@@ -2460,7 +2460,7 @@ function ki(e, r) {
|
|
|
2460
2460
|
const a = [];
|
|
2461
2461
|
for (; ++t < r.length; )
|
|
2462
2462
|
(r[t].add === "after" ? e : a).push(r[t]);
|
|
2463
|
-
|
|
2463
|
+
ze(e, 0, 0, a);
|
|
2464
2464
|
}
|
|
2465
2465
|
const wi = {
|
|
2466
2466
|
tokenize: Ni,
|
|
@@ -2489,48 +2489,48 @@ const wi = {
|
|
|
2489
2489
|
name: "emailAutolink",
|
|
2490
2490
|
tokenize: Ti,
|
|
2491
2491
|
previous: vr
|
|
2492
|
-
},
|
|
2492
|
+
}, Z = {};
|
|
2493
2493
|
function Ci() {
|
|
2494
2494
|
return {
|
|
2495
|
-
text:
|
|
2495
|
+
text: Z
|
|
2496
2496
|
};
|
|
2497
2497
|
}
|
|
2498
|
-
let
|
|
2499
|
-
for (;
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2498
|
+
let ce = 48;
|
|
2499
|
+
for (; ce < 123; )
|
|
2500
|
+
Z[ce] = ne, ce++, ce === 58 ? ce = 65 : ce === 91 && (ce = 97);
|
|
2501
|
+
Z[43] = ne;
|
|
2502
|
+
Z[45] = ne;
|
|
2503
|
+
Z[46] = ne;
|
|
2504
|
+
Z[95] = ne;
|
|
2505
|
+
Z[72] = [ne, xr];
|
|
2506
|
+
Z[104] = [ne, xr];
|
|
2507
|
+
Z[87] = [ne, yr];
|
|
2508
|
+
Z[119] = [ne, yr];
|
|
2509
2509
|
function Ti(e, r, t) {
|
|
2510
2510
|
const a = this;
|
|
2511
2511
|
let i, o;
|
|
2512
2512
|
return n;
|
|
2513
2513
|
function n(l) {
|
|
2514
|
-
return !
|
|
2514
|
+
return !ot(l) || !vr.call(a, a.previous) || ft(a.events) ? t(l) : (e.enter("literalAutolink"), e.enter("literalAutolinkEmail"), s(l));
|
|
2515
2515
|
}
|
|
2516
2516
|
function s(l) {
|
|
2517
|
-
return
|
|
2517
|
+
return ot(l) ? (e.consume(l), s) : l === 64 ? (e.consume(l), c) : t(l);
|
|
2518
2518
|
}
|
|
2519
2519
|
function c(l) {
|
|
2520
|
-
return l === 46 ? e.check(vi, f, u)(l) : l === 45 || l === 95 ||
|
|
2520
|
+
return l === 46 ? e.check(vi, f, u)(l) : l === 45 || l === 95 || ut(l) ? (o = !0, e.consume(l), c) : f(l);
|
|
2521
2521
|
}
|
|
2522
2522
|
function u(l) {
|
|
2523
2523
|
return e.consume(l), i = !0, c;
|
|
2524
2524
|
}
|
|
2525
2525
|
function f(l) {
|
|
2526
|
-
return o && i &&
|
|
2526
|
+
return o && i && Te(a.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(l)) : t(l);
|
|
2527
2527
|
}
|
|
2528
2528
|
}
|
|
2529
2529
|
function Mi(e, r, t) {
|
|
2530
2530
|
const a = this;
|
|
2531
2531
|
return i;
|
|
2532
2532
|
function i(n) {
|
|
2533
|
-
return n !== 87 && n !== 119 || !kr.call(a, a.previous) ||
|
|
2533
|
+
return n !== 87 && n !== 119 || !kr.call(a, a.previous) || ft(a.events) ? t(n) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(wi, e.attempt(pr, e.attempt(gr, o), t), t)(n));
|
|
2534
2534
|
}
|
|
2535
2535
|
function o(n) {
|
|
2536
2536
|
return e.exit("literalAutolinkWww"), e.exit("literalAutolink"), r(n);
|
|
@@ -2541,10 +2541,10 @@ function Ai(e, r, t) {
|
|
|
2541
2541
|
let i = "", o = !1;
|
|
2542
2542
|
return n;
|
|
2543
2543
|
function n(l) {
|
|
2544
|
-
return (l === 72 || l === 104) && wr.call(a, a.previous) && !
|
|
2544
|
+
return (l === 72 || l === 104) && wr.call(a, a.previous) && !ft(a.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), i += String.fromCodePoint(l), e.consume(l), s) : t(l);
|
|
2545
2545
|
}
|
|
2546
2546
|
function s(l) {
|
|
2547
|
-
if (
|
|
2547
|
+
if (Te(l) && i.length < 5)
|
|
2548
2548
|
return i += String.fromCodePoint(l), e.consume(l), s;
|
|
2549
2549
|
if (l === 58) {
|
|
2550
2550
|
const p = i.toLowerCase();
|
|
@@ -2557,7 +2557,7 @@ function Ai(e, r, t) {
|
|
|
2557
2557
|
return l === 47 ? (e.consume(l), o ? u : (o = !0, c)) : t(l);
|
|
2558
2558
|
}
|
|
2559
2559
|
function u(l) {
|
|
2560
|
-
return l === null || La(l) || W(l) ||
|
|
2560
|
+
return l === null || La(l) || W(l) || ue(l) || Ue(l) ? t(l) : e.attempt(pr, e.attempt(gr, f), t)(l);
|
|
2561
2561
|
}
|
|
2562
2562
|
function f(l) {
|
|
2563
2563
|
return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(l);
|
|
@@ -2577,7 +2577,7 @@ function Ii(e, r, t) {
|
|
|
2577
2577
|
let a, i, o;
|
|
2578
2578
|
return n;
|
|
2579
2579
|
function n(u) {
|
|
2580
|
-
return u === 46 || u === 95 ? e.check(br, c, s)(u) : u === null || W(u) ||
|
|
2580
|
+
return u === 46 || u === 95 ? e.check(br, c, s)(u) : u === null || W(u) || ue(u) || u !== 45 && Ue(u) ? c(u) : (o = !0, e.consume(u), n);
|
|
2581
2581
|
}
|
|
2582
2582
|
function s(u) {
|
|
2583
2583
|
return u === 95 ? a = !0 : (i = a, a = void 0), e.consume(u), n;
|
|
@@ -2590,7 +2590,7 @@ function Si(e, r) {
|
|
|
2590
2590
|
let t = 0, a = 0;
|
|
2591
2591
|
return i;
|
|
2592
2592
|
function i(n) {
|
|
2593
|
-
return n === 40 ? (t++, e.consume(n), i) : n === 41 && a < t ? o(n) : n === 33 || n === 34 || n === 38 || n === 39 || n === 41 || n === 42 || n === 44 || n === 46 || n === 58 || n === 59 || n === 60 || n === 63 || n === 93 || n === 95 || n === 126 ? e.check(br, r, o)(n) : n === null || W(n) ||
|
|
2593
|
+
return n === 40 ? (t++, e.consume(n), i) : n === 41 && a < t ? o(n) : n === 33 || n === 34 || n === 38 || n === 39 || n === 41 || n === 42 || n === 44 || n === 46 || n === 58 || n === 59 || n === 60 || n === 63 || n === 93 || n === 95 || n === 126 ? e.check(br, r, o)(n) : n === null || W(n) || ue(n) ? r(n) : (e.consume(n), i);
|
|
2594
2594
|
}
|
|
2595
2595
|
function o(n) {
|
|
2596
2596
|
return n === 41 && a++, e.consume(n), i;
|
|
@@ -2602,17 +2602,17 @@ function Li(e, r, t) {
|
|
|
2602
2602
|
return s === 33 || s === 34 || s === 39 || s === 41 || s === 42 || s === 44 || s === 46 || s === 58 || s === 59 || s === 63 || s === 95 || s === 126 ? (e.consume(s), a) : s === 38 ? (e.consume(s), o) : s === 93 ? (e.consume(s), i) : (
|
|
2603
2603
|
// `<` is an end.
|
|
2604
2604
|
s === 60 || // So is whitespace.
|
|
2605
|
-
s === null || W(s) ||
|
|
2605
|
+
s === null || W(s) || ue(s) ? r(s) : t(s)
|
|
2606
2606
|
);
|
|
2607
2607
|
}
|
|
2608
2608
|
function i(s) {
|
|
2609
|
-
return s === null || s === 40 || s === 91 || W(s) ||
|
|
2609
|
+
return s === null || s === 40 || s === 91 || W(s) || ue(s) ? r(s) : a(s);
|
|
2610
2610
|
}
|
|
2611
2611
|
function o(s) {
|
|
2612
|
-
return
|
|
2612
|
+
return Te(s) ? n(s) : t(s);
|
|
2613
2613
|
}
|
|
2614
2614
|
function n(s) {
|
|
2615
|
-
return s === 59 ? (e.consume(s), a) :
|
|
2615
|
+
return s === 59 ? (e.consume(s), a) : Te(s) ? (e.consume(s), n) : t(s);
|
|
2616
2616
|
}
|
|
2617
2617
|
}
|
|
2618
2618
|
function Pi(e, r, t) {
|
|
@@ -2621,22 +2621,22 @@ function Pi(e, r, t) {
|
|
|
2621
2621
|
return e.consume(o), i;
|
|
2622
2622
|
}
|
|
2623
2623
|
function i(o) {
|
|
2624
|
-
return
|
|
2624
|
+
return ut(o) ? t(o) : r(o);
|
|
2625
2625
|
}
|
|
2626
2626
|
}
|
|
2627
2627
|
function kr(e) {
|
|
2628
2628
|
return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || W(e);
|
|
2629
2629
|
}
|
|
2630
2630
|
function wr(e) {
|
|
2631
|
-
return !
|
|
2631
|
+
return !Te(e);
|
|
2632
2632
|
}
|
|
2633
2633
|
function vr(e) {
|
|
2634
|
-
return !(e === 47 ||
|
|
2634
|
+
return !(e === 47 || ot(e));
|
|
2635
2635
|
}
|
|
2636
|
-
function
|
|
2637
|
-
return e === 43 || e === 45 || e === 46 || e === 95 ||
|
|
2636
|
+
function ot(e) {
|
|
2637
|
+
return e === 43 || e === 45 || e === 46 || e === 95 || ut(e);
|
|
2638
2638
|
}
|
|
2639
|
-
function
|
|
2639
|
+
function ft(e) {
|
|
2640
2640
|
let r = e.length, t = !1;
|
|
2641
2641
|
for (; r--; ) {
|
|
2642
2642
|
const a = e[r][1];
|
|
@@ -2681,7 +2681,7 @@ function _i(e, r, t) {
|
|
|
2681
2681
|
return te(o) ? re(e, i, "linePrefix")(o) : i(o);
|
|
2682
2682
|
}
|
|
2683
2683
|
function i(o) {
|
|
2684
|
-
return o === null ||
|
|
2684
|
+
return o === null || ge(o) ? r(o) : t(o);
|
|
2685
2685
|
}
|
|
2686
2686
|
}
|
|
2687
2687
|
const Ei = {
|
|
@@ -2732,7 +2732,7 @@ function zi(e, r, t) {
|
|
|
2732
2732
|
function s(c) {
|
|
2733
2733
|
if (!n || !n._balanced)
|
|
2734
2734
|
return t(c);
|
|
2735
|
-
const u =
|
|
2735
|
+
const u = Ne(a.sliceSerialize({
|
|
2736
2736
|
start: n.end,
|
|
2737
2737
|
end: a.now()
|
|
2738
2738
|
}));
|
|
@@ -2811,7 +2811,7 @@ function $i(e, r, t) {
|
|
|
2811
2811
|
if (l === 93) {
|
|
2812
2812
|
e.exit("chunkString");
|
|
2813
2813
|
const p = e.exit("gfmFootnoteCallString");
|
|
2814
|
-
return i.includes(
|
|
2814
|
+
return i.includes(Ne(a.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(l), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), r) : t(l);
|
|
2815
2815
|
}
|
|
2816
2816
|
return W(l) || (n = !0), o++, e.consume(l), l === 92 ? f : u;
|
|
2817
2817
|
}
|
|
@@ -2841,7 +2841,7 @@ function Oi(e, r, t) {
|
|
|
2841
2841
|
if (m === 93) {
|
|
2842
2842
|
e.exit("chunkString");
|
|
2843
2843
|
const x = e.exit("gfmFootnoteDefinitionLabelString");
|
|
2844
|
-
return o =
|
|
2844
|
+
return o = Ne(a.sliceSerialize(x)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(m), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
|
|
2845
2845
|
}
|
|
2846
2846
|
return W(m) || (s = !0), n++, e.consume(m), m === 92 ? l : f;
|
|
2847
2847
|
}
|
|
@@ -2905,7 +2905,7 @@ function qi(e) {
|
|
|
2905
2905
|
start: Object.assign({}, n[u][1].end),
|
|
2906
2906
|
end: Object.assign({}, n[c][1].start)
|
|
2907
2907
|
}, p = [["enter", f, s], ["enter", n[u][1], s], ["exit", n[u][1], s], ["enter", l, s]], g = s.parser.constructs.insideSpan.null;
|
|
2908
|
-
g &&
|
|
2908
|
+
g && ze(p, p.length, 0, Ri(g, n.slice(u + 1, c), s)), ze(p, p.length, 0, [["exit", l, s], ["enter", n[c][1], s], ["exit", n[c][1], s], ["exit", f, s]]), ze(n, u - 1, c - u + 3, p), c = u + p.length - 2;
|
|
2909
2909
|
break;
|
|
2910
2910
|
}
|
|
2911
2911
|
}
|
|
@@ -2921,11 +2921,11 @@ function qi(e) {
|
|
|
2921
2921
|
return u === 126 && f[f.length - 1][1].type !== "characterEscape" ? c(m) : (n.enter("strikethroughSequenceTemporary"), g(m));
|
|
2922
2922
|
}
|
|
2923
2923
|
function g(m) {
|
|
2924
|
-
const x =
|
|
2924
|
+
const x = $e(u);
|
|
2925
2925
|
if (m === 126)
|
|
2926
2926
|
return l > 1 ? c(m) : (n.consume(m), l++, g);
|
|
2927
2927
|
if (l < 2 && !t) return c(m);
|
|
2928
|
-
const b = n.exit("strikethroughSequenceTemporary"), y =
|
|
2928
|
+
const b = n.exit("strikethroughSequenceTemporary"), y = $e(m);
|
|
2929
2929
|
return b._open = !y || y === 2 && !!x, b._close = !x || x === 2 && !!y, s(m);
|
|
2930
2930
|
}
|
|
2931
2931
|
}
|
|
@@ -3051,7 +3051,7 @@ function Qi(e, r, t) {
|
|
|
3051
3051
|
return h === 124 || (n = !0, o += 1), f(h);
|
|
3052
3052
|
}
|
|
3053
3053
|
function f(h) {
|
|
3054
|
-
return h === null ? t(h) :
|
|
3054
|
+
return h === null ? t(h) : ge(h) ? o > 1 ? (o = 0, a.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(h), e.exit("lineEnding"), g) : t(h) : te(h) ? re(e, f, "whitespace")(h) : (o += 1, n && (n = !1, i += 1), h === 124 ? (e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), n = !0, f) : (e.enter("data"), l(h)));
|
|
3055
3055
|
}
|
|
3056
3056
|
function l(h) {
|
|
3057
3057
|
return h === null || h === 124 || W(h) ? (e.exit("data"), f(h)) : (e.consume(h), h === 92 ? p : l);
|
|
@@ -3063,37 +3063,37 @@ function Qi(e, r, t) {
|
|
|
3063
3063
|
return a.interrupt = !1, a.parser.lazy[a.now().line] ? t(h) : (e.enter("tableDelimiterRow"), n = !1, te(h) ? re(e, m, "linePrefix", a.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(h) : m(h));
|
|
3064
3064
|
}
|
|
3065
3065
|
function m(h) {
|
|
3066
|
-
return h === 45 || h === 58 ? b(h) : h === 124 ? (n = !0, e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), x) :
|
|
3066
|
+
return h === 45 || h === 58 ? b(h) : h === 124 ? (n = !0, e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), x) : I(h);
|
|
3067
3067
|
}
|
|
3068
3068
|
function x(h) {
|
|
3069
3069
|
return te(h) ? re(e, b, "whitespace")(h) : b(h);
|
|
3070
3070
|
}
|
|
3071
3071
|
function b(h) {
|
|
3072
|
-
return h === 58 ? (o += 1, n = !0, e.enter("tableDelimiterMarker"), e.consume(h), e.exit("tableDelimiterMarker"), y) : h === 45 ? (o += 1, y(h)) : h === null ||
|
|
3072
|
+
return h === 58 ? (o += 1, n = !0, e.enter("tableDelimiterMarker"), e.consume(h), e.exit("tableDelimiterMarker"), y) : h === 45 ? (o += 1, y(h)) : h === null || ge(h) ? P(h) : I(h);
|
|
3073
3073
|
}
|
|
3074
3074
|
function y(h) {
|
|
3075
|
-
return h === 45 ? (e.enter("tableDelimiterFiller"), k(h)) :
|
|
3075
|
+
return h === 45 ? (e.enter("tableDelimiterFiller"), k(h)) : I(h);
|
|
3076
3076
|
}
|
|
3077
3077
|
function k(h) {
|
|
3078
3078
|
return h === 45 ? (e.consume(h), k) : h === 58 ? (n = !0, e.exit("tableDelimiterFiller"), e.enter("tableDelimiterMarker"), e.consume(h), e.exit("tableDelimiterMarker"), v) : (e.exit("tableDelimiterFiller"), v(h));
|
|
3079
3079
|
}
|
|
3080
3080
|
function v(h) {
|
|
3081
|
-
return te(h) ? re(e,
|
|
3081
|
+
return te(h) ? re(e, P, "whitespace")(h) : P(h);
|
|
3082
3082
|
}
|
|
3083
|
-
function
|
|
3084
|
-
return h === 124 ? m(h) : h === null ||
|
|
3083
|
+
function P(h) {
|
|
3084
|
+
return h === 124 ? m(h) : h === null || ge(h) ? !n || i !== o ? I(h) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), r(h)) : I(h);
|
|
3085
3085
|
}
|
|
3086
|
-
function
|
|
3086
|
+
function I(h) {
|
|
3087
3087
|
return t(h);
|
|
3088
3088
|
}
|
|
3089
3089
|
function C(h) {
|
|
3090
|
-
return e.enter("tableRow"),
|
|
3090
|
+
return e.enter("tableRow"), D(h);
|
|
3091
3091
|
}
|
|
3092
|
-
function
|
|
3093
|
-
return h === 124 ? (e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"),
|
|
3092
|
+
function D(h) {
|
|
3093
|
+
return h === 124 ? (e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), D) : h === null || ge(h) ? (e.exit("tableRow"), r(h)) : te(h) ? re(e, D, "whitespace")(h) : (e.enter("data"), E(h));
|
|
3094
3094
|
}
|
|
3095
3095
|
function E(h) {
|
|
3096
|
-
return h === null || h === 124 || W(h) ? (e.exit("data"),
|
|
3096
|
+
return h === null || h === 124 || W(h) ? (e.exit("data"), D(h)) : (e.consume(h), h === 92 ? A : E);
|
|
3097
3097
|
}
|
|
3098
3098
|
function A(h) {
|
|
3099
3099
|
return h === 92 || h === 124 ? (e.consume(h), E) : E(h);
|
|
@@ -3114,7 +3114,7 @@ function Gi(e, r) {
|
|
|
3114
3114
|
start: Object.assign({}, m.start),
|
|
3115
3115
|
// Note: correct end is set later.
|
|
3116
3116
|
end: Object.assign({}, m.end)
|
|
3117
|
-
}, p.add(t, 0, [["enter", f, r]])), i = m.type === "tableDelimiterRow" ? 2 : f ? 3 : 1) : i && (m.type === "data" || m.type === "tableDelimiterMarker" || m.type === "tableDelimiterFiller") ? (a = !1, n[2] === 0 && (o[1] !== 0 && (n[0] = n[1], l =
|
|
3117
|
+
}, p.add(t, 0, [["enter", f, r]])), i = m.type === "tableDelimiterRow" ? 2 : f ? 3 : 1) : i && (m.type === "data" || m.type === "tableDelimiterMarker" || m.type === "tableDelimiterFiller") ? (a = !1, n[2] === 0 && (o[1] !== 0 && (n[0] = n[1], l = Fe(p, r, o, i, void 0, l), o = [0, 0, 0, 0]), n[2] = t)) : m.type === "tableCellDivider" && (a ? a = !1 : (o[1] !== 0 && (n[0] = n[1], l = Fe(p, r, o, i, void 0, l)), o = n, n = [o[1], t, 0, 0])) : m.type === "tableHead" ? (s = !0, c = t) : m.type === "tableRow" || m.type === "tableDelimiterRow" ? (c = t, o[1] !== 0 ? (n[0] = n[1], l = Fe(p, r, o, i, t, l)) : n[1] !== 0 && (l = Fe(p, r, n, i, t, l)), i = 0) : i && (m.type === "data" || m.type === "tableDelimiterMarker" || m.type === "tableDelimiterFiller") && (n[3] = t);
|
|
3118
3118
|
}
|
|
3119
3119
|
for (c !== 0 && Et(p, r, c, u, f), p.consume(r.events), t = -1; ++t < r.events.length; ) {
|
|
3120
3120
|
const g = r.events[t];
|
|
@@ -3122,17 +3122,17 @@ function Gi(e, r) {
|
|
|
3122
3122
|
}
|
|
3123
3123
|
return e;
|
|
3124
3124
|
}
|
|
3125
|
-
function
|
|
3125
|
+
function Fe(e, r, t, a, i, o) {
|
|
3126
3126
|
const n = a === 1 ? "tableHeader" : a === 2 ? "tableDelimiter" : "tableData", s = "tableContent";
|
|
3127
|
-
t[0] !== 0 && (o.end = Object.assign({},
|
|
3128
|
-
const c =
|
|
3127
|
+
t[0] !== 0 && (o.end = Object.assign({}, me(r.events, t[0])), e.add(t[0], 0, [["exit", o, r]]));
|
|
3128
|
+
const c = me(r.events, t[1]);
|
|
3129
3129
|
if (o = {
|
|
3130
3130
|
type: n,
|
|
3131
3131
|
start: Object.assign({}, c),
|
|
3132
3132
|
// Note: correct end is set later.
|
|
3133
3133
|
end: Object.assign({}, c)
|
|
3134
3134
|
}, e.add(t[1], 0, [["enter", o, r]]), t[2] !== 0) {
|
|
3135
|
-
const u =
|
|
3135
|
+
const u = me(r.events, t[2]), f = me(r.events, t[3]), l = {
|
|
3136
3136
|
type: s,
|
|
3137
3137
|
start: Object.assign({}, u),
|
|
3138
3138
|
end: Object.assign({}, f)
|
|
@@ -3146,13 +3146,13 @@ function Ee(e, r, t, a, i, o) {
|
|
|
3146
3146
|
}
|
|
3147
3147
|
e.add(t[3] + 1, 0, [["exit", l, r]]);
|
|
3148
3148
|
}
|
|
3149
|
-
return i !== void 0 && (o.end = Object.assign({},
|
|
3149
|
+
return i !== void 0 && (o.end = Object.assign({}, me(r.events, i)), e.add(i, 0, [["exit", o, r]]), o = void 0), o;
|
|
3150
3150
|
}
|
|
3151
3151
|
function Et(e, r, t, a, i) {
|
|
3152
|
-
const o = [], n =
|
|
3152
|
+
const o = [], n = me(r.events, t);
|
|
3153
3153
|
i && (i.end = Object.assign({}, n), o.push(["exit", i, r])), a.end = Object.assign({}, n), o.push(["exit", a, r]), e.add(t + 1, 0, o);
|
|
3154
3154
|
}
|
|
3155
|
-
function
|
|
3155
|
+
function me(e, r) {
|
|
3156
3156
|
const t = e[r], a = t[0] === "enter" ? "start" : "end";
|
|
3157
3157
|
return t[1][a];
|
|
3158
3158
|
}
|
|
@@ -3185,7 +3185,7 @@ function Yi(e, r, t) {
|
|
|
3185
3185
|
return c === 93 ? (e.enter("taskListCheckMarker"), e.consume(c), e.exit("taskListCheckMarker"), e.exit("taskListCheck"), s) : t(c);
|
|
3186
3186
|
}
|
|
3187
3187
|
function s(c) {
|
|
3188
|
-
return
|
|
3188
|
+
return ge(c) ? r(c) : te(c) ? e.check({
|
|
3189
3189
|
tokenize: eo
|
|
3190
3190
|
}, r, t)(c) : t(c);
|
|
3191
3191
|
}
|
|
@@ -3224,7 +3224,7 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3224
3224
|
components: co,
|
|
3225
3225
|
children: e
|
|
3226
3226
|
}
|
|
3227
|
-
),
|
|
3227
|
+
), ht = Dr(no), io = ({ language: e, code: r }) => {
|
|
3228
3228
|
const { isCopied: t, copyToClipboard: a } = oo();
|
|
3229
3229
|
return /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-between cuadra-gap-4 cuadra-mt-4 cuadra-rounded-t-lg cuadra-bg-muted/50 cuadra-border-b cuadra-border-border cuadra-px-4 cuadra-py-2 cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-font-brand", children: [
|
|
3230
3230
|
/* @__PURE__ */ d("span", { className: "cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand", children: e }),
|
|
@@ -3246,7 +3246,7 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3246
3246
|
}, oo = ({
|
|
3247
3247
|
copiedDuration: e = 3e3
|
|
3248
3248
|
} = {}) => {
|
|
3249
|
-
const [r, t] =
|
|
3249
|
+
const [r, t] = R(!1);
|
|
3250
3250
|
return { isCopied: r, copyToClipboard: (i) => {
|
|
3251
3251
|
i && navigator.clipboard.writeText(i).then(() => {
|
|
3252
3252
|
t(!0), setTimeout(() => t(!1), e);
|
|
@@ -3439,7 +3439,7 @@ function fo({ source: e }) {
|
|
|
3439
3439
|
}
|
|
3440
3440
|
);
|
|
3441
3441
|
}
|
|
3442
|
-
const Ft =
|
|
3442
|
+
const Ft = Ae(
|
|
3443
3443
|
function({
|
|
3444
3444
|
welcomeTitle: r = "Hi, how can I help you today?",
|
|
3445
3445
|
welcomeSubtitle: t = "Start exploring our platform and discover what you can build.",
|
|
@@ -3450,47 +3450,47 @@ const Ft = Me(
|
|
|
3450
3450
|
preMadeResponseDelay: s = 1e3,
|
|
3451
3451
|
streamingSpeed: c = 50
|
|
3452
3452
|
}, u) {
|
|
3453
|
-
const f = jr(), l = $r(), [p, g] =
|
|
3453
|
+
const f = jr(), l = $r(), [p, g] = R(!1), [m, x] = R(null), [b, y] = R(!1), k = G((C, D, E) => {
|
|
3454
3454
|
if (!b)
|
|
3455
3455
|
try {
|
|
3456
3456
|
const A = E?.streamingSpeed ?? c, h = E?.delay ?? s;
|
|
3457
|
-
Xt(C,
|
|
3457
|
+
Xt(C, D, A, h), l.composer().setText(C), setTimeout(() => {
|
|
3458
3458
|
l.composer().send();
|
|
3459
3459
|
}, 10);
|
|
3460
3460
|
} catch {
|
|
3461
3461
|
}
|
|
3462
|
-
}, [b, c, s, l]), v =
|
|
3462
|
+
}, [b, c, s, l]), v = G((C) => {
|
|
3463
3463
|
try {
|
|
3464
3464
|
l.composer().setText(C), setTimeout(() => {
|
|
3465
3465
|
l.composer().send();
|
|
3466
3466
|
}, 10);
|
|
3467
3467
|
} catch {
|
|
3468
3468
|
}
|
|
3469
|
-
}, [l]),
|
|
3469
|
+
}, [l]), P = G(async (C) => {
|
|
3470
3470
|
if (!(b || !f))
|
|
3471
3471
|
try {
|
|
3472
3472
|
if (C.response) {
|
|
3473
|
-
const
|
|
3473
|
+
const D = C.responseDelay ?? s;
|
|
3474
3474
|
await k(C.prompt, C.response, {
|
|
3475
|
-
delay:
|
|
3475
|
+
delay: D,
|
|
3476
3476
|
streamingSpeed: c
|
|
3477
3477
|
});
|
|
3478
3478
|
} else
|
|
3479
3479
|
v(C.prompt);
|
|
3480
3480
|
} catch {
|
|
3481
3481
|
}
|
|
3482
|
-
}, [f, b, s, c, k, v]),
|
|
3482
|
+
}, [f, b, s, c, k, v]), I = G(() => {
|
|
3483
3483
|
try {
|
|
3484
3484
|
const C = window.__cuadraThreadListRuntime;
|
|
3485
3485
|
C?.switchToNewThread && C.switchToNewThread();
|
|
3486
3486
|
} catch {
|
|
3487
3487
|
}
|
|
3488
3488
|
}, []);
|
|
3489
|
-
return
|
|
3489
|
+
return ct(u, () => ({
|
|
3490
3490
|
sendMessage: v,
|
|
3491
3491
|
sendPreMadeQA: k,
|
|
3492
|
-
clearChat:
|
|
3493
|
-
}), [v, k,
|
|
3492
|
+
clearChat: I
|
|
3493
|
+
}), [v, k, I]), O(() => {
|
|
3494
3494
|
if (!f) {
|
|
3495
3495
|
g(!1);
|
|
3496
3496
|
return;
|
|
@@ -3501,7 +3501,7 @@ const Ft = Me(
|
|
|
3501
3501
|
g(!1);
|
|
3502
3502
|
return;
|
|
3503
3503
|
}
|
|
3504
|
-
const
|
|
3504
|
+
const D = C.subscribe?.((A) => {
|
|
3505
3505
|
const h = A?.threadId, B = A?.messages || [], z = A?.isLoadingHistory || !1, X = B.length;
|
|
3506
3506
|
h && h !== m && x(h), g(z && X === 0);
|
|
3507
3507
|
}), E = C.getState?.();
|
|
@@ -3510,14 +3510,14 @@ const Ft = Me(
|
|
|
3510
3510
|
A && A !== m && x(A), g(B && z === 0);
|
|
3511
3511
|
}
|
|
3512
3512
|
return () => {
|
|
3513
|
-
|
|
3513
|
+
D && D();
|
|
3514
3514
|
};
|
|
3515
3515
|
} catch {
|
|
3516
3516
|
g(!1);
|
|
3517
3517
|
}
|
|
3518
|
-
}, [f, m]), /* @__PURE__ */ w(
|
|
3518
|
+
}, [f, m]), /* @__PURE__ */ w(_e.Root, { className: "cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full", children: [
|
|
3519
3519
|
/* @__PURE__ */ d(
|
|
3520
|
-
|
|
3520
|
+
_e.Viewport,
|
|
3521
3521
|
{
|
|
3522
3522
|
className: "cuadra-w-full cuadra-bg-inherit cuadra-px-4 cuadra-flex-1 cuadra-min-h-0 cuadra-overflow-y-auto cuadra-relative scrollbar-thin cuadra-pt-4",
|
|
3523
3523
|
style: a ? { paddingTop: a } : void 0,
|
|
@@ -3525,18 +3525,18 @@ const Ft = Me(
|
|
|
3525
3525
|
/* @__PURE__ */ d(qt, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }),
|
|
3526
3526
|
/* @__PURE__ */ d("p", { className: "cuadra-text-sm cuadra-text-muted-foreground font-brand", children: "Loading messages..." })
|
|
3527
3527
|
] }) }) : /* @__PURE__ */ w(ae, { children: [
|
|
3528
|
-
/* @__PURE__ */ d(
|
|
3528
|
+
/* @__PURE__ */ d(_e.Empty, { children: /* @__PURE__ */ d(
|
|
3529
3529
|
ho,
|
|
3530
3530
|
{
|
|
3531
3531
|
title: r,
|
|
3532
3532
|
subtitle: t,
|
|
3533
3533
|
suggestions: i,
|
|
3534
|
-
onSuggestionClick:
|
|
3534
|
+
onSuggestionClick: P,
|
|
3535
3535
|
isProcessing: b
|
|
3536
3536
|
}
|
|
3537
3537
|
) }),
|
|
3538
3538
|
/* @__PURE__ */ d(
|
|
3539
|
-
|
|
3539
|
+
_e.Messages,
|
|
3540
3540
|
{
|
|
3541
3541
|
components: {
|
|
3542
3542
|
UserMessage: mo,
|
|
@@ -3549,11 +3549,11 @@ const Ft = Me(
|
|
|
3549
3549
|
),
|
|
3550
3550
|
/* @__PURE__ */ w("div", { className: "cuadra-w-full cuadra-mt-3 cuadra-border-t cuadra-border-border cuadra-pt-4", children: [
|
|
3551
3551
|
n && /* @__PURE__ */ d(
|
|
3552
|
-
|
|
3552
|
+
ke.Attachments,
|
|
3553
3553
|
{
|
|
3554
3554
|
components: {
|
|
3555
3555
|
Attachment: () => {
|
|
3556
|
-
const C =
|
|
3556
|
+
const C = Ce(({ attachment: D }) => D);
|
|
3557
3557
|
return C ? /* @__PURE__ */ w("div", { className: "cuadra-relative cuadra-inline-flex cuadra-items-center cuadra-gap-2 cuadra-mb-2 cuadra-px-2 cuadra-py-1 cuadra-rounded-md cuadra-bg-muted cuadra-border cuadra-border-border", children: [
|
|
3558
3558
|
/* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-text-muted-foreground font-brand", children: C.name || "Attachment" }),
|
|
3559
3559
|
/* @__PURE__ */ d(Or.Remove, { asChild: !0, children: /* @__PURE__ */ d(
|
|
@@ -3562,7 +3562,7 @@ const Ft = Me(
|
|
|
3562
3562
|
type: "button",
|
|
3563
3563
|
className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-size-4 cuadra-rounded hover:cuadra-bg-background cuadra-transition-colors",
|
|
3564
3564
|
"aria-label": "Remove attachment",
|
|
3565
|
-
children: /* @__PURE__ */ d(
|
|
3565
|
+
children: /* @__PURE__ */ d(st, { className: "cuadra-h-3 cuadra-w-3 cuadra-text-muted-foreground" })
|
|
3566
3566
|
}
|
|
3567
3567
|
) })
|
|
3568
3568
|
] }) : null;
|
|
@@ -3570,9 +3570,9 @@ const Ft = Me(
|
|
|
3570
3570
|
}
|
|
3571
3571
|
}
|
|
3572
3572
|
),
|
|
3573
|
-
/* @__PURE__ */ w(
|
|
3573
|
+
/* @__PURE__ */ w(ke.Root, { className: "cuadra-relative !cuadra-relative cuadra-flex-1 cuadra-w-full", children: [
|
|
3574
3574
|
/* @__PURE__ */ d(
|
|
3575
|
-
|
|
3575
|
+
ke.Input,
|
|
3576
3576
|
{
|
|
3577
3577
|
asChild: !0,
|
|
3578
3578
|
children: /* @__PURE__ */ d(
|
|
@@ -3591,7 +3591,7 @@ const Ft = Me(
|
|
|
3591
3591
|
}
|
|
3592
3592
|
),
|
|
3593
3593
|
n && /* @__PURE__ */ d(
|
|
3594
|
-
|
|
3594
|
+
ke.AddAttachment,
|
|
3595
3595
|
{
|
|
3596
3596
|
multiple: !0,
|
|
3597
3597
|
asChild: !0,
|
|
@@ -3611,7 +3611,7 @@ const Ft = Me(
|
|
|
3611
3611
|
)
|
|
3612
3612
|
}
|
|
3613
3613
|
),
|
|
3614
|
-
/* @__PURE__ */ d(
|
|
3614
|
+
/* @__PURE__ */ d(ke.Send, { asChild: !0, children: /* @__PURE__ */ d(
|
|
3615
3615
|
"button",
|
|
3616
3616
|
{
|
|
3617
3617
|
className: "!cuadra-absolute !cuadra-bottom-2 !cuadra-right-2 cuadra-size-8 cuadra-rounded-md cuadra-shadow-sm hover:cuadra-opacity-90 disabled:cuadra-opacity-50 disabled:cuadra-cursor-not-allowed cuadra-flex cuadra-items-center cuadra-justify-center",
|
|
@@ -3653,13 +3653,13 @@ function ho({ title: e, subtitle: r, suggestions: t, onSuggestionClick: a, isPro
|
|
|
3653
3653
|
] }) });
|
|
3654
3654
|
}
|
|
3655
3655
|
function mo() {
|
|
3656
|
-
return /* @__PURE__ */ w(
|
|
3656
|
+
return /* @__PURE__ */ w(we.Root, { className: "cuadra-grid cuadra-w-full cuadra-auto-rows-auto cuadra-grid-cols-[minmax(72px,1fr)_auto] cuadra-gap-y-2 cuadra-py-3 [&:where(>*)]:cuadra-col-start-2", children: [
|
|
3657
3657
|
/* @__PURE__ */ d(
|
|
3658
|
-
|
|
3658
|
+
we.Attachments,
|
|
3659
3659
|
{
|
|
3660
3660
|
components: {
|
|
3661
3661
|
Attachment: () => {
|
|
3662
|
-
const e =
|
|
3662
|
+
const e = Ce(({ attachment: o }) => o);
|
|
3663
3663
|
if (!e) return null;
|
|
3664
3664
|
const r = e.type === "image", t = e.file, a = e.content?.find((o) => o.type === "image"), i = t ? URL.createObjectURL(t) : a?.image;
|
|
3665
3665
|
return /* @__PURE__ */ d("div", { className: "cuadra-col-start-2 cuadra-row-start-1 cuadra-mb-2 cuadra-max-w-[calc(42rem*0.8)]", children: r && i ? /* @__PURE__ */ d(
|
|
@@ -3695,10 +3695,10 @@ function mo() {
|
|
|
3695
3695
|
borderWidth: "1px"
|
|
3696
3696
|
},
|
|
3697
3697
|
children: /* @__PURE__ */ d(
|
|
3698
|
-
|
|
3698
|
+
we.Parts,
|
|
3699
3699
|
{
|
|
3700
3700
|
components: {
|
|
3701
|
-
Text: ({ text: e }) => /* @__PURE__ */ d(
|
|
3701
|
+
Text: ({ text: e }) => /* @__PURE__ */ d(ht, { content: e || "" })
|
|
3702
3702
|
}
|
|
3703
3703
|
}
|
|
3704
3704
|
)
|
|
@@ -3707,7 +3707,7 @@ function mo() {
|
|
|
3707
3707
|
] });
|
|
3708
3708
|
}
|
|
3709
3709
|
function po({ text: e }) {
|
|
3710
|
-
const [r, t] =
|
|
3710
|
+
const [r, t] = R(!1), a = Ce(({ message: i }) => i?.status?.type === "running");
|
|
3711
3711
|
return e ? a ? /* @__PURE__ */ d("div", { className: "cuadra-mb-3 cuadra-py-1", children: /* @__PURE__ */ d("div", { className: "cuadra-text-sm cuadra-text-muted-foreground cuadra-leading-relaxed font-brand cuadra-animate-text-shimmer", children: e }) }) : /* @__PURE__ */ w("div", { className: "cuadra-mb-3", children: [
|
|
3712
3712
|
/* @__PURE__ */ w(
|
|
3713
3713
|
"button",
|
|
@@ -3717,7 +3717,7 @@ function po({ text: e }) {
|
|
|
3717
3717
|
className: "cuadra-flex cuadra-items-center cuadra-gap-1.5 cuadra-py-1 cuadra-text-sm cuadra-text-muted-foreground hover:cuadra-text-foreground cuadra-transition-colors font-brand",
|
|
3718
3718
|
children: [
|
|
3719
3719
|
/* @__PURE__ */ d(
|
|
3720
|
-
|
|
3720
|
+
at,
|
|
3721
3721
|
{
|
|
3722
3722
|
className: `cuadra-h-3.5 cuadra-w-3.5 cuadra-shrink-0 cuadra-transition-transform cuadra-duration-200 ${r ? "" : "cuadra--rotate-90"}`
|
|
3723
3723
|
}
|
|
@@ -3730,7 +3730,7 @@ function po({ text: e }) {
|
|
|
3730
3730
|
"div",
|
|
3731
3731
|
{
|
|
3732
3732
|
className: `cuadra-overflow-hidden cuadra-transition-all cuadra-duration-200 cuadra-ease-out ${r ? "cuadra-max-h-[2000px] cuadra-opacity-100" : "cuadra-max-h-0 cuadra-opacity-0"}`,
|
|
3733
|
-
children: /* @__PURE__ */ d("div", { className: "cuadra-pl-5 cuadra-pt-2 cuadra-text-sm cuadra-text-muted-foreground cuadra-leading-relaxed font-brand", children: /* @__PURE__ */ d(
|
|
3733
|
+
children: /* @__PURE__ */ d("div", { className: "cuadra-pl-5 cuadra-pt-2 cuadra-text-sm cuadra-text-muted-foreground cuadra-leading-relaxed font-brand", children: /* @__PURE__ */ d(ht, { content: e }) })
|
|
3734
3734
|
}
|
|
3735
3735
|
)
|
|
3736
3736
|
] }) : null;
|
|
@@ -3746,21 +3746,21 @@ function go() {
|
|
|
3746
3746
|
] });
|
|
3747
3747
|
}
|
|
3748
3748
|
function bo() {
|
|
3749
|
-
const [e] =
|
|
3749
|
+
const [e] = R(() => se.getCurrentMessageId()), r = Ce(({ message: i }) => i?.status?.type === "running"), t = Ce(({ message: i }) => {
|
|
3750
3750
|
const o = i?.content;
|
|
3751
3751
|
return !o || !Array.isArray(o) ? !1 : o.some((n) => !!(n.type === "text" && n.text && n.text.length > 0 || n.type === "reasoning" && n.text && n.text.length > 0));
|
|
3752
3752
|
}), a = _r(
|
|
3753
|
-
(i) =>
|
|
3753
|
+
(i) => se.subscribe(i),
|
|
3754
3754
|
() => {
|
|
3755
3755
|
if (e) {
|
|
3756
|
-
const i =
|
|
3756
|
+
const i = se.getForMessage(e);
|
|
3757
3757
|
if (i.sources?.length) return i.sources;
|
|
3758
3758
|
}
|
|
3759
|
-
return
|
|
3759
|
+
return se.get().sources || null;
|
|
3760
3760
|
},
|
|
3761
3761
|
() => null
|
|
3762
3762
|
);
|
|
3763
|
-
return /* @__PURE__ */ d(
|
|
3763
|
+
return /* @__PURE__ */ d(we.Root, { className: "cuadra-relative cuadra-grid cuadra-w-full cuadra-grid-cols-[auto_auto_1fr] cuadra-grid-rows-[auto_1fr] cuadra-py-3", children: /* @__PURE__ */ w(
|
|
3764
3764
|
"div",
|
|
3765
3765
|
{
|
|
3766
3766
|
className: "cuadra-text-foreground cuadra-col-span-2 cuadra-col-start-2 cuadra-row-start-1 cuadra-my-1.5 cuadra-max-w-[90%] cuadra-break-words cuadra-leading-7 font-brand",
|
|
@@ -3771,10 +3771,10 @@ function bo() {
|
|
|
3771
3771
|
},
|
|
3772
3772
|
children: [
|
|
3773
3773
|
/* @__PURE__ */ d(
|
|
3774
|
-
|
|
3774
|
+
we.Parts,
|
|
3775
3775
|
{
|
|
3776
3776
|
components: {
|
|
3777
|
-
Text: ({ text: i }) => /* @__PURE__ */ d(
|
|
3777
|
+
Text: ({ text: i }) => /* @__PURE__ */ d(ht, { content: i || "" }),
|
|
3778
3778
|
Reasoning: ({ text: i }) => /* @__PURE__ */ d(po, { text: i || "" })
|
|
3779
3779
|
}
|
|
3780
3780
|
}
|
|
@@ -3793,7 +3793,7 @@ const Tr = ({ className: e = "", theme: r = "system" }) => {
|
|
|
3793
3793
|
return n || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
|
|
3794
3794
|
}
|
|
3795
3795
|
return r;
|
|
3796
|
-
}, [a, i] =
|
|
3796
|
+
}, [a, i] = R(t);
|
|
3797
3797
|
return O(() => {
|
|
3798
3798
|
r !== "system" && i(r);
|
|
3799
3799
|
}, [r]), O(() => {
|
|
@@ -3819,7 +3819,7 @@ const Tr = ({ className: e = "", theme: r = "system" }) => {
|
|
|
3819
3819
|
);
|
|
3820
3820
|
};
|
|
3821
3821
|
function yo({ onThreadSelect: e }) {
|
|
3822
|
-
const r = $t(), t = Ur((b) => b.threadId), [a, i] =
|
|
3822
|
+
const r = $t(), t = Ur((b) => b.threadId), [a, i] = R(null), o = r?.id === t, n = a === r?.id, [s, c] = R(!1), [u, f] = R(r?.title || ""), [l, p] = R(!1), [g, m] = R(!1), x = async () => {
|
|
3823
3823
|
if (!r?.remoteId || !u || u === r.title) {
|
|
3824
3824
|
c(!1);
|
|
3825
3825
|
return;
|
|
@@ -3837,7 +3837,7 @@ function yo({ onThreadSelect: e }) {
|
|
|
3837
3837
|
return O(() => {
|
|
3838
3838
|
r?.title && !s && f(r.title);
|
|
3839
3839
|
}, [r?.title, s]), r ? /* @__PURE__ */ w(
|
|
3840
|
-
|
|
3840
|
+
Ke.Root,
|
|
3841
3841
|
{
|
|
3842
3842
|
className: `group cuadra-relative cuadra-flex cuadra-items-center cuadra-rounded-lg cuadra-transition-colors cuadra-cursor-pointer cuadra-border cuadra-mb-2 ${o ? "cuadra-bg-muted cuadra-border-border" : "cuadra-border-transparent hover:cuadra-bg-muted hover:cuadra-border-border"}`,
|
|
3843
3843
|
style: { marginBottom: "0.5rem" },
|
|
@@ -3845,7 +3845,7 @@ function yo({ onThreadSelect: e }) {
|
|
|
3845
3845
|
onMouseLeave: () => i(null),
|
|
3846
3846
|
children: [
|
|
3847
3847
|
/* @__PURE__ */ d(
|
|
3848
|
-
|
|
3848
|
+
Ke.Trigger,
|
|
3849
3849
|
{
|
|
3850
3850
|
className: "cuadra-p-3 cuadra-flex-1 cuadra-flex cuadra-items-center cuadra-min-w-0 cuadra-cursor-pointer",
|
|
3851
3851
|
onClick: () => e?.(),
|
|
@@ -3913,7 +3913,7 @@ function yo({ onThreadSelect: e }) {
|
|
|
3913
3913
|
}
|
|
3914
3914
|
),
|
|
3915
3915
|
/* @__PURE__ */ d("div", { className: "cuadra-border-t cuadra-border-border" }),
|
|
3916
|
-
/* @__PURE__ */ d(
|
|
3916
|
+
/* @__PURE__ */ d(Ke.Delete, { asChild: !0, children: /* @__PURE__ */ d(
|
|
3917
3917
|
"button",
|
|
3918
3918
|
{
|
|
3919
3919
|
type: "button",
|
|
@@ -3937,7 +3937,7 @@ function zt({
|
|
|
3937
3937
|
theme: t,
|
|
3938
3938
|
onLogout: a
|
|
3939
3939
|
}) {
|
|
3940
|
-
return /* @__PURE__ */ w(
|
|
3940
|
+
return /* @__PURE__ */ w(Xe.Root, { className: "!cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-transition-all cuadra-duration-300 cuadra-ease-in-out cuadra-h-full cuadra-w-80", style: { borderRightWidth: "1px" }, children: [
|
|
3941
3941
|
/* @__PURE__ */ d("div", { className: "cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-end cuadra-transition-all cuadra-duration-300 cuadra-h-16 cuadra-px-4", children: /* @__PURE__ */ d(
|
|
3942
3942
|
"button",
|
|
3943
3943
|
{
|
|
@@ -3945,12 +3945,12 @@ function zt({
|
|
|
3945
3945
|
onClick: e,
|
|
3946
3946
|
className: "cuadra-flex md:cuadra-hidden cuadra-items-center cuadra-justify-center cuadra-h-8 cuadra-w-8 cuadra-rounded-full cuadra-bg-muted hover:cuadra-bg-muted/80 cuadra-transition-colors",
|
|
3947
3947
|
"aria-label": "Close",
|
|
3948
|
-
children: /* @__PURE__ */ d(
|
|
3948
|
+
children: /* @__PURE__ */ d(st, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
|
|
3949
3949
|
}
|
|
3950
3950
|
) }),
|
|
3951
3951
|
/* @__PURE__ */ w("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin", children: [
|
|
3952
3952
|
/* @__PURE__ */ d(
|
|
3953
|
-
|
|
3953
|
+
Xe.New,
|
|
3954
3954
|
{
|
|
3955
3955
|
className: "group cuadra-relative cuadra-flex cuadra-items-center cuadra-gap-3 cuadra-p-3 cuadra-rounded-lg cuadra-cursor-pointer cuadra-transition-colors cuadra-border cuadra-border-transparent hover:cuadra-bg-muted hover:cuadra-border-border",
|
|
3956
3956
|
onClick: () => e?.(),
|
|
@@ -3962,7 +3962,7 @@ function zt({
|
|
|
3962
3962
|
),
|
|
3963
3963
|
/* @__PURE__ */ d("div", { className: "cuadra-my-2 cuadra-border-t cuadra-border-border" }),
|
|
3964
3964
|
/* @__PURE__ */ d(
|
|
3965
|
-
|
|
3965
|
+
Xe.Items,
|
|
3966
3966
|
{
|
|
3967
3967
|
components: {
|
|
3968
3968
|
ThreadListItem: (i) => /* @__PURE__ */ d(yo, { ...i, onThreadSelect: e })
|
|
@@ -3989,7 +3989,7 @@ const xo = `
|
|
|
3989
3989
|
@keyframes rotate {
|
|
3990
3990
|
100% { transform: rotate(1turn); }
|
|
3991
3991
|
}
|
|
3992
|
-
`,
|
|
3992
|
+
`, Ye = ({
|
|
3993
3993
|
children: e,
|
|
3994
3994
|
className: r = "",
|
|
3995
3995
|
paddingX: t = "px-0",
|
|
@@ -4056,7 +4056,7 @@ const xo = `
|
|
|
4056
4056
|
onMobileMenuClick: c,
|
|
4057
4057
|
showMobileMenuButton: u = !1
|
|
4058
4058
|
}) => {
|
|
4059
|
-
const [f, l] =
|
|
4059
|
+
const [f, l] = R(!1), [p, g] = R(!1), m = pe(null);
|
|
4060
4060
|
O(() => {
|
|
4061
4061
|
const y = (k) => {
|
|
4062
4062
|
m.current && !m.current.contains(k.target) && l(!1);
|
|
@@ -4095,7 +4095,7 @@ const xo = `
|
|
|
4095
4095
|
className: "cuadra-flex cuadra-h-10 cuadra-w-full cuadra-items-center cuadra-justify-between cuadra-rounded-md cuadra-border cuadra-border-input cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-sm placeholder:cuadra-text-muted-foreground focus:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 cuadra-font-brand",
|
|
4096
4096
|
children: [
|
|
4097
4097
|
/* @__PURE__ */ d("span", { className: x ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: x?.name || "Select model" }),
|
|
4098
|
-
/* @__PURE__ */ d(
|
|
4098
|
+
/* @__PURE__ */ d(at, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
|
|
4099
4099
|
]
|
|
4100
4100
|
}
|
|
4101
4101
|
),
|
|
@@ -4140,11 +4140,11 @@ const xo = `
|
|
|
4140
4140
|
className: "cuadra-flex md:cuadra-hidden cuadra-h-10 cuadra-w-full cuadra-items-center cuadra-justify-between cuadra-rounded-md cuadra-border cuadra-border-input cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-sm placeholder:cuadra-text-muted-foreground focus:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 cuadra-font-brand",
|
|
4141
4141
|
children: [
|
|
4142
4142
|
/* @__PURE__ */ d("span", { className: x ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: x?.name || "Select model" }),
|
|
4143
|
-
/* @__PURE__ */ d(
|
|
4143
|
+
/* @__PURE__ */ d(at, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
|
|
4144
4144
|
]
|
|
4145
4145
|
}
|
|
4146
4146
|
),
|
|
4147
|
-
p && typeof document < "u" &&
|
|
4147
|
+
p && typeof document < "u" && rt(
|
|
4148
4148
|
/* @__PURE__ */ w(ae, { children: [
|
|
4149
4149
|
/* @__PURE__ */ d(
|
|
4150
4150
|
"div",
|
|
@@ -4163,7 +4163,7 @@ const xo = `
|
|
|
4163
4163
|
onClick: () => g(!1),
|
|
4164
4164
|
className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-8 cuadra-w-8 cuadra-rounded-full cuadra-bg-muted hover:cuadra-bg-muted/80 cuadra-transition-colors",
|
|
4165
4165
|
"aria-label": "Close",
|
|
4166
|
-
children: /* @__PURE__ */ d(
|
|
4166
|
+
children: /* @__PURE__ */ d(st, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
|
|
4167
4167
|
}
|
|
4168
4168
|
)
|
|
4169
4169
|
] }),
|
|
@@ -4206,7 +4206,7 @@ const xo = `
|
|
|
4206
4206
|
] })
|
|
4207
4207
|
] })
|
|
4208
4208
|
] });
|
|
4209
|
-
}, ko = Er(void 0),
|
|
4209
|
+
}, ko = Er(void 0), et = ({ children: e, value: r }) => /* @__PURE__ */ d(ko.Provider, { value: r, children: e });
|
|
4210
4210
|
function wo() {
|
|
4211
4211
|
O(() => {
|
|
4212
4212
|
if (document.querySelector("style[data-cuadra-uikit]"))
|
|
@@ -4230,10 +4230,10 @@ function wo() {
|
|
|
4230
4230
|
}, document.head.appendChild(a), o) break;
|
|
4231
4231
|
}, []);
|
|
4232
4232
|
}
|
|
4233
|
-
const vo =
|
|
4233
|
+
const vo = Ae(
|
|
4234
4234
|
function({ config: r }, t) {
|
|
4235
4235
|
wo();
|
|
4236
|
-
const a =
|
|
4236
|
+
const a = pe(null), i = pe(!1), {
|
|
4237
4237
|
baseUrl: o,
|
|
4238
4238
|
proxyUrl: n,
|
|
4239
4239
|
sessionToken: s,
|
|
@@ -4249,10 +4249,10 @@ const vo = Me(
|
|
|
4249
4249
|
welcomeSubtitle: y,
|
|
4250
4250
|
extraTopPadding: k,
|
|
4251
4251
|
suggestions: v,
|
|
4252
|
-
inputPlaceholder:
|
|
4253
|
-
preMadeResponseDelay:
|
|
4252
|
+
inputPlaceholder: P,
|
|
4253
|
+
preMadeResponseDelay: I = 1e3,
|
|
4254
4254
|
streamingSpeed: C = 50,
|
|
4255
|
-
showThemeToggle:
|
|
4255
|
+
showThemeToggle: D = !0,
|
|
4256
4256
|
initialMessage: E,
|
|
4257
4257
|
initialPreMadeQA: A,
|
|
4258
4258
|
theme: h = "system",
|
|
@@ -4260,12 +4260,12 @@ const vo = Me(
|
|
|
4260
4260
|
onChatCreated: z,
|
|
4261
4261
|
onUserMessage: X,
|
|
4262
4262
|
onThreadIdUpdate: K,
|
|
4263
|
-
onLogout:
|
|
4264
|
-
enableAttachments:
|
|
4265
|
-
onBeforeRequest:
|
|
4263
|
+
onLogout: Ie,
|
|
4264
|
+
enableAttachments: Se = !1,
|
|
4265
|
+
onBeforeRequest: J,
|
|
4266
4266
|
mockResponseOnBlocked: T
|
|
4267
4267
|
} = r;
|
|
4268
|
-
|
|
4268
|
+
ct(t, () => ({
|
|
4269
4269
|
sendMessage: (M) => {
|
|
4270
4270
|
a.current?.sendMessage(M);
|
|
4271
4271
|
},
|
|
@@ -4281,54 +4281,54 @@ const vo = Me(
|
|
|
4281
4281
|
A ? (i.current = !0, a.current?.sendPreMadeQA(
|
|
4282
4282
|
A.question,
|
|
4283
4283
|
A.answer,
|
|
4284
|
-
{ delay:
|
|
4284
|
+
{ delay: I, streamingSpeed: C }
|
|
4285
4285
|
)) : E && (i.current = !0, a.current?.sendMessage(E));
|
|
4286
4286
|
}, 500);
|
|
4287
4287
|
return () => clearTimeout(M);
|
|
4288
|
-
}, [E, A,
|
|
4289
|
-
const [N,
|
|
4288
|
+
}, [E, A, I, C]);
|
|
4289
|
+
const [N, _] = R(!1), [L, H] = R(null), [S, q] = R(null), [V, ie] = R(!1), le = pe(null), de = (M) => {
|
|
4290
4290
|
if (M < 30) return !0;
|
|
4291
|
-
if (
|
|
4292
|
-
const F =
|
|
4291
|
+
if (le.current) {
|
|
4292
|
+
const F = le.current.getBoundingClientRect();
|
|
4293
4293
|
if (M - F.left < 30) return !0;
|
|
4294
4294
|
}
|
|
4295
4295
|
return !1;
|
|
4296
|
-
},
|
|
4296
|
+
}, Y = (M) => {
|
|
4297
4297
|
const j = M.touches[0].clientX;
|
|
4298
|
-
(
|
|
4299
|
-
},
|
|
4300
|
-
if (
|
|
4298
|
+
(de(j) || N) && (H(j), q(j), ie(!0));
|
|
4299
|
+
}, Le = (M) => {
|
|
4300
|
+
if (L === null || !V) return;
|
|
4301
4301
|
const F = M.touches[0];
|
|
4302
|
-
|
|
4302
|
+
q(F.clientX);
|
|
4303
4303
|
}, mt = () => {
|
|
4304
|
-
if (
|
|
4305
|
-
|
|
4304
|
+
if (L === null || S === null) {
|
|
4305
|
+
ie(!1);
|
|
4306
4306
|
return;
|
|
4307
4307
|
}
|
|
4308
|
-
const M =
|
|
4309
|
-
M > F && !N &&
|
|
4308
|
+
const M = S - L, F = 50, j = 0.3, wt = Math.abs(M) / 300;
|
|
4309
|
+
M > F && !N && L !== null ? de(L) && _(!0) : ((M < -F || M < 0 && wt > j) && N || N && M < -20 && wt > j) && _(!1), H(null), q(null), ie(!1);
|
|
4310
4310
|
}, Ar = () => {
|
|
4311
|
-
if (
|
|
4312
|
-
const M =
|
|
4311
|
+
if (V && L !== null && S !== null) {
|
|
4312
|
+
const M = S - L;
|
|
4313
4313
|
if (N)
|
|
4314
4314
|
return `translateX(${Math.min(0, M)}px)`;
|
|
4315
|
-
if (
|
|
4315
|
+
if (L !== null && de(L))
|
|
4316
4316
|
return `translateX(${Math.min(0, -320 + M)}px)`;
|
|
4317
4317
|
}
|
|
4318
4318
|
return N ? "translateX(0)" : "translateX(-100%)";
|
|
4319
4319
|
}, Nr = () => {
|
|
4320
|
-
if (!
|
|
4320
|
+
if (!V || L === null || S === null)
|
|
4321
4321
|
return N ? 0.5 : 0;
|
|
4322
|
-
const F =
|
|
4323
|
-
return N ? Math.max(0, Math.min(1, (320 + F) / 320)) * 0.5 :
|
|
4324
|
-
},
|
|
4325
|
-
() => new Vt(
|
|
4326
|
-
[
|
|
4327
|
-
), [
|
|
4322
|
+
const F = S - L;
|
|
4323
|
+
return N ? Math.max(0, Math.min(1, (320 + F) / 320)) * 0.5 : L !== null && de(L) ? Math.max(0, Math.min(1, (F + 320) / 320)) * 0.5 : 0;
|
|
4324
|
+
}, Pe = n || o || "", Re = !!n, pt = Q(
|
|
4325
|
+
() => new Vt(Pe, s || void 0, Re),
|
|
4326
|
+
[Pe, s, Re]
|
|
4327
|
+
), [fe, Ir] = R(null), [be, gt] = R(!1), [ye, bt] = R(null), [Sr, yt] = R(!1);
|
|
4328
4328
|
O(() => {
|
|
4329
4329
|
c === "multiChat" && yt(!0);
|
|
4330
4330
|
}, [c]);
|
|
4331
|
-
const
|
|
4331
|
+
const he = G(async () => {
|
|
4332
4332
|
if (u === "selector") {
|
|
4333
4333
|
gt(!0), bt(null);
|
|
4334
4334
|
try {
|
|
@@ -4342,13 +4342,13 @@ const vo = Me(
|
|
|
4342
4342
|
}
|
|
4343
4343
|
}, [pt, u]);
|
|
4344
4344
|
O(() => {
|
|
4345
|
-
u === "selector" &&
|
|
4346
|
-
}, [u,
|
|
4345
|
+
u === "selector" && he();
|
|
4346
|
+
}, [u, he]), O(() => (typeof window < "u" && (window.__cuadraUIKitRefetchModels = he), () => {
|
|
4347
4347
|
typeof window < "u" && delete window.__cuadraUIKitRefetchModels;
|
|
4348
|
-
}), [
|
|
4349
|
-
const [ee, xt] =
|
|
4348
|
+
}), [he]);
|
|
4349
|
+
const [ee, xt] = R(
|
|
4350
4350
|
u === "fixed" && f || null
|
|
4351
|
-
), kt =
|
|
4351
|
+
), kt = pe(ee), xe = G(
|
|
4352
4352
|
(M) => {
|
|
4353
4353
|
const F = kt.current;
|
|
4354
4354
|
xt(M), kt.current = M, l?.(M), F !== null && F !== M && c === "multiChat" && setTimeout(() => {
|
|
@@ -4373,54 +4373,54 @@ const vo = Me(
|
|
|
4373
4373
|
[l, c]
|
|
4374
4374
|
);
|
|
4375
4375
|
O(() => {
|
|
4376
|
-
if (u === "selector" &&
|
|
4377
|
-
const M =
|
|
4376
|
+
if (u === "selector" && fe?.items && fe.items.length > 0 && !ee) {
|
|
4377
|
+
const M = fe.items[0];
|
|
4378
4378
|
if (M?.id) {
|
|
4379
4379
|
const F = M.id;
|
|
4380
4380
|
xt(F), l?.(F);
|
|
4381
4381
|
}
|
|
4382
4382
|
}
|
|
4383
|
-
}, [u,
|
|
4384
|
-
const Lr = u === "fixed" ? !!f : !!ee,
|
|
4385
|
-
() => (
|
|
4386
|
-
[
|
|
4387
|
-
),
|
|
4383
|
+
}, [u, fe?.items, ee, l]);
|
|
4384
|
+
const Lr = u === "fixed" ? !!f : !!ee, De = Q(
|
|
4385
|
+
() => (fe?.items || []).filter((M) => M?.id && M?.displayName).map((M) => ({ id: M.id, name: M.displayName })),
|
|
4386
|
+
[fe]
|
|
4387
|
+
), He = Q(
|
|
4388
4388
|
() => ({
|
|
4389
4389
|
currentModelId: ee || "",
|
|
4390
|
-
models:
|
|
4391
|
-
modelsLoading:
|
|
4392
|
-
modelsError:
|
|
4393
|
-
onModelChange:
|
|
4394
|
-
refetchModels:
|
|
4390
|
+
models: De,
|
|
4391
|
+
modelsLoading: be,
|
|
4392
|
+
modelsError: ye,
|
|
4393
|
+
onModelChange: xe,
|
|
4394
|
+
refetchModels: he
|
|
4395
4395
|
}),
|
|
4396
|
-
[ee,
|
|
4396
|
+
[ee, De, be, ye, xe, he]
|
|
4397
4397
|
);
|
|
4398
|
-
return u === "selector" &&
|
|
4398
|
+
return u === "selector" && be || c === "multiChat" && Sr ? /* @__PURE__ */ d(et, { value: He, children: /* @__PURE__ */ d(Ye, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ d(qt, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }) }) }) }) : u === "selector" && !Lr && ye ? /* @__PURE__ */ d(et, { value: He, children: /* @__PURE__ */ d(Ye, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d("p", { className: "cuadra-text-sm cuadra-text-destructive font-brand", children: "Failed to load models" }) }) }) }) }) : /* @__PURE__ */ d("div", { className: "cuadra-uikit cuadra-h-full cuadra-w-full", style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ d(et, { value: He, children: /* @__PURE__ */ d(
|
|
4399
4399
|
Na,
|
|
4400
4400
|
{
|
|
4401
|
-
baseUrl:
|
|
4401
|
+
baseUrl: Re ? Pe : o || Pe,
|
|
4402
4402
|
sessionToken: s,
|
|
4403
|
-
isProxyMode:
|
|
4403
|
+
isProxyMode: Re,
|
|
4404
4404
|
mode: c,
|
|
4405
4405
|
modelMode: u,
|
|
4406
4406
|
modelId: ee || f || void 0,
|
|
4407
|
-
onModelChange:
|
|
4407
|
+
onModelChange: xe,
|
|
4408
4408
|
ephemeral: p,
|
|
4409
4409
|
systemPrompt: g,
|
|
4410
4410
|
enableReasoning: m,
|
|
4411
4411
|
initialThreadId: x,
|
|
4412
|
-
enableAttachments:
|
|
4412
|
+
enableAttachments: Se,
|
|
4413
4413
|
onError: B,
|
|
4414
4414
|
onChatCreated: z,
|
|
4415
4415
|
onUserMessage: X,
|
|
4416
4416
|
onThreadIdUpdate: K,
|
|
4417
|
-
onBeforeRequest:
|
|
4417
|
+
onBeforeRequest: J,
|
|
4418
4418
|
mockResponseOnBlocked: T,
|
|
4419
4419
|
onChatsLoaded: () => {
|
|
4420
4420
|
c === "multiChat" && yt(!1);
|
|
4421
4421
|
},
|
|
4422
4422
|
children: /* @__PURE__ */ d(
|
|
4423
|
-
|
|
4423
|
+
Ye,
|
|
4424
4424
|
{
|
|
4425
4425
|
paddingX: "cuadra-px-0",
|
|
4426
4426
|
paddingY: "cuadra-py-0",
|
|
@@ -4432,17 +4432,17 @@ const vo = Me(
|
|
|
4432
4432
|
{
|
|
4433
4433
|
className: "cuadra-h-full cuadra-flex cuadra-relative",
|
|
4434
4434
|
style: { height: "100%" },
|
|
4435
|
-
onTouchStart:
|
|
4436
|
-
onTouchMove:
|
|
4435
|
+
onTouchStart: Y,
|
|
4436
|
+
onTouchMove: Le,
|
|
4437
4437
|
onTouchEnd: mt,
|
|
4438
4438
|
children: c === "multiChat" ? /* @__PURE__ */ w(ae, { children: [
|
|
4439
|
-
typeof document < "u" &&
|
|
4439
|
+
typeof document < "u" && rt(
|
|
4440
4440
|
/* @__PURE__ */ d(
|
|
4441
4441
|
"div",
|
|
4442
4442
|
{
|
|
4443
|
-
className: `cuadra-fixed cuadra-inset-0 cuadra-bg-black cuadra-z-40 md:cuadra-hidden cuadra-transition-opacity cuadra-duration-300 ${N ||
|
|
4443
|
+
className: `cuadra-fixed cuadra-inset-0 cuadra-bg-black cuadra-z-40 md:cuadra-hidden cuadra-transition-opacity cuadra-duration-300 ${N || V ? "" : "cuadra-pointer-events-none"}`,
|
|
4444
4444
|
style: { opacity: Nr() },
|
|
4445
|
-
onClick: () =>
|
|
4445
|
+
onClick: () => _(!1)
|
|
4446
4446
|
}
|
|
4447
4447
|
),
|
|
4448
4448
|
document.body
|
|
@@ -4456,34 +4456,34 @@ const vo = Me(
|
|
|
4456
4456
|
children: /* @__PURE__ */ d(
|
|
4457
4457
|
zt,
|
|
4458
4458
|
{
|
|
4459
|
-
onThreadSelect: () =>
|
|
4460
|
-
showThemeToggle:
|
|
4459
|
+
onThreadSelect: () => _(!1),
|
|
4460
|
+
showThemeToggle: D,
|
|
4461
4461
|
theme: h,
|
|
4462
|
-
onLogout:
|
|
4462
|
+
onLogout: Ie
|
|
4463
4463
|
}
|
|
4464
4464
|
)
|
|
4465
4465
|
}
|
|
4466
4466
|
),
|
|
4467
|
-
typeof document < "u" &&
|
|
4467
|
+
typeof document < "u" && rt(
|
|
4468
4468
|
/* @__PURE__ */ d(
|
|
4469
4469
|
"div",
|
|
4470
4470
|
{
|
|
4471
|
-
className: `cuadra-block md:cuadra-hidden !cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-h-screen cuadra-w-80 cuadra-fixed cuadra-z-50 cuadra-top-0 cuadra-left-0 ${N ||
|
|
4471
|
+
className: `cuadra-block md:cuadra-hidden !cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-h-screen cuadra-w-80 cuadra-fixed cuadra-z-50 cuadra-top-0 cuadra-left-0 ${N || V ? "" : "cuadra-pointer-events-none"}`,
|
|
4472
4472
|
style: {
|
|
4473
4473
|
borderRightWidth: "1px",
|
|
4474
4474
|
transform: Ar(),
|
|
4475
|
-
transition:
|
|
4475
|
+
transition: V ? "none" : "transform 0.3s ease-in-out"
|
|
4476
4476
|
},
|
|
4477
|
-
onTouchStart:
|
|
4478
|
-
onTouchMove:
|
|
4477
|
+
onTouchStart: Y,
|
|
4478
|
+
onTouchMove: Le,
|
|
4479
4479
|
onTouchEnd: mt,
|
|
4480
4480
|
children: /* @__PURE__ */ d(
|
|
4481
4481
|
zt,
|
|
4482
4482
|
{
|
|
4483
|
-
onThreadSelect: () =>
|
|
4484
|
-
showThemeToggle:
|
|
4483
|
+
onThreadSelect: () => _(!1),
|
|
4484
|
+
showThemeToggle: D,
|
|
4485
4485
|
theme: h,
|
|
4486
|
-
onLogout:
|
|
4486
|
+
onLogout: Ie
|
|
4487
4487
|
}
|
|
4488
4488
|
)
|
|
4489
4489
|
}
|
|
@@ -4491,18 +4491,18 @@ const vo = Me(
|
|
|
4491
4491
|
document.body
|
|
4492
4492
|
)
|
|
4493
4493
|
] }),
|
|
4494
|
-
/* @__PURE__ */ w("div", { ref:
|
|
4494
|
+
/* @__PURE__ */ w("div", { ref: le, className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
|
|
4495
4495
|
u === "selector" && /* @__PURE__ */ d(
|
|
4496
4496
|
jt,
|
|
4497
4497
|
{
|
|
4498
4498
|
currentModel: ee || "",
|
|
4499
|
-
models:
|
|
4500
|
-
modelsLoading:
|
|
4501
|
-
modelsError:
|
|
4502
|
-
onModelChange:
|
|
4503
|
-
showThemeToggle:
|
|
4499
|
+
models: De,
|
|
4500
|
+
modelsLoading: be,
|
|
4501
|
+
modelsError: ye,
|
|
4502
|
+
onModelChange: xe,
|
|
4503
|
+
showThemeToggle: D,
|
|
4504
4504
|
theme: h,
|
|
4505
|
-
onMobileMenuClick: () =>
|
|
4505
|
+
onMobileMenuClick: () => _(!N),
|
|
4506
4506
|
showMobileMenuButton: c === "multiChat"
|
|
4507
4507
|
}
|
|
4508
4508
|
),
|
|
@@ -4514,9 +4514,9 @@ const vo = Me(
|
|
|
4514
4514
|
welcomeSubtitle: y,
|
|
4515
4515
|
extraTopPadding: k,
|
|
4516
4516
|
suggestions: v,
|
|
4517
|
-
inputPlaceholder:
|
|
4518
|
-
enableAttachments:
|
|
4519
|
-
preMadeResponseDelay:
|
|
4517
|
+
inputPlaceholder: P,
|
|
4518
|
+
enableAttachments: Se,
|
|
4519
|
+
preMadeResponseDelay: I,
|
|
4520
4520
|
streamingSpeed: C
|
|
4521
4521
|
}
|
|
4522
4522
|
) })
|
|
@@ -4526,11 +4526,11 @@ const vo = Me(
|
|
|
4526
4526
|
jt,
|
|
4527
4527
|
{
|
|
4528
4528
|
currentModel: ee || "",
|
|
4529
|
-
models:
|
|
4530
|
-
modelsLoading:
|
|
4531
|
-
modelsError:
|
|
4532
|
-
onModelChange:
|
|
4533
|
-
showThemeToggle:
|
|
4529
|
+
models: De,
|
|
4530
|
+
modelsLoading: be,
|
|
4531
|
+
modelsError: ye,
|
|
4532
|
+
onModelChange: xe,
|
|
4533
|
+
showThemeToggle: D,
|
|
4534
4534
|
theme: h
|
|
4535
4535
|
}
|
|
4536
4536
|
),
|
|
@@ -4542,8 +4542,8 @@ const vo = Me(
|
|
|
4542
4542
|
welcomeSubtitle: y,
|
|
4543
4543
|
extraTopPadding: k,
|
|
4544
4544
|
suggestions: v,
|
|
4545
|
-
inputPlaceholder:
|
|
4546
|
-
preMadeResponseDelay:
|
|
4545
|
+
inputPlaceholder: P,
|
|
4546
|
+
preMadeResponseDelay: I,
|
|
4547
4547
|
streamingSpeed: C
|
|
4548
4548
|
}
|
|
4549
4549
|
) })
|
|
@@ -4619,12 +4619,12 @@ function _o() {
|
|
|
4619
4619
|
const t = document.getElementById("cuadra-theme-dark");
|
|
4620
4620
|
t && t.remove();
|
|
4621
4621
|
}
|
|
4622
|
-
const Eo =
|
|
4622
|
+
const Eo = Ae(
|
|
4623
4623
|
function(r, t) {
|
|
4624
|
-
const a =
|
|
4624
|
+
const a = pe(null);
|
|
4625
4625
|
O(() => {
|
|
4626
4626
|
r.customTheme && Co(r.customTheme);
|
|
4627
|
-
}, [r.customTheme]),
|
|
4627
|
+
}, [r.customTheme]), ct(t, () => ({
|
|
4628
4628
|
sendMessage: (o) => {
|
|
4629
4629
|
a.current?.sendMessage(o);
|
|
4630
4630
|
},
|
|
@@ -4684,6 +4684,6 @@ export {
|
|
|
4684
4684
|
uo as SourceCitations,
|
|
4685
4685
|
Co as applyTheme,
|
|
4686
4686
|
_o as removeTheme,
|
|
4687
|
-
|
|
4687
|
+
se as streamingMetadataStore
|
|
4688
4688
|
};
|
|
4689
4689
|
//# sourceMappingURL=index.mjs.map
|