@cuadra-ai/uikit 0.1.24 → 0.1.26
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 -0
- package/dist/adapters/chatModelAdapter.d.ts.map +1 -1
- package/dist/components/CuadraChat.d.ts.map +1 -1
- package/dist/components/CuadraRuntimeProvider.d.ts +3 -1
- package/dist/components/CuadraRuntimeProvider.d.ts.map +1 -1
- package/dist/components/WidgetContent.d.ts +2 -0
- package/dist/components/WidgetContent.d.ts.map +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1117 -1092
- package/dist/index.mjs.map +1 -1
- package/dist/lib/cuadraChatClient.d.ts.map +1 -1
- package/dist/types/cuadra.d.ts +2 -0
- package/dist/types/cuadra.d.ts.map +1 -1
- package/dist/uikit.css +1 -1
- package/dist/widget/cuadra-uikit.css +1 -1
- package/dist/widget/cuadra-uikit.umd.js +26 -26
- package/dist/widget/cuadra-uikit.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var ae = (e, r, t) =>
|
|
1
|
+
var Sr = Object.defineProperty;
|
|
2
|
+
var Lr = (e, r, t) => r in e ? Sr(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
|
+
var ae = (e, r, t) => Lr(e, typeof r != "symbol" ? r + "" : r, t);
|
|
4
4
|
import { jsx as d, jsxs as w, Fragment as J } from "react/jsx-runtime";
|
|
5
|
-
import
|
|
6
|
-
import { createPortal as
|
|
7
|
-
import { useThreadListItem as
|
|
8
|
-
import { unstable_memoizeMarkdownComponents as
|
|
9
|
-
let ye = !1,
|
|
10
|
-
function
|
|
11
|
-
if (
|
|
5
|
+
import kt, { forwardRef as ve, createElement as Je, useMemo as V, useState as R, useEffect as O, useCallback as X, memo as Pr, useImperativeHandle as at, useSyncExternalStore as Rr, useRef as de, createContext as Dr } from "react";
|
|
6
|
+
import { createPortal as Ye } from "react-dom";
|
|
7
|
+
import { useThreadListItem as zt, RuntimeAdapterProvider as _r, useLocalRuntime as jt, AssistantRuntimeProvider as $t, unstable_useRemoteThreadListRuntime as Er, useThreadRuntime as Fr, useAssistantApi as zr, ThreadPrimitive as Se, ComposerPrimitive as ge, useAssistantState as xe, AttachmentPrimitive as jr, MessagePrimitive as be, ThreadListPrimitive as He, useThread as $r, ThreadListItemPrimitive as qe } from "@assistant-ui/react";
|
|
8
|
+
import { unstable_memoizeMarkdownComponents as Or, useIsMarkdownCodeBlock as Ur, MarkdownTextPrimitive as Br } from "@assistant-ui/react-markdown";
|
|
9
|
+
let ye = !1, wt = !1;
|
|
10
|
+
function vt() {
|
|
11
|
+
if (wt || (wt = !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) {
|
|
@@ -25,9 +25,9 @@ function kt() {
|
|
|
25
25
|
}
|
|
26
26
|
} catch {
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
Wr();
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Wr() {
|
|
31
31
|
if (ye)
|
|
32
32
|
return;
|
|
33
33
|
const e = document.createElement("link");
|
|
@@ -54,19 +54,19 @@ function Br() {
|
|
|
54
54
|
a();
|
|
55
55
|
}, document.head.appendChild(e);
|
|
56
56
|
}
|
|
57
|
-
typeof document < "u" && typeof window < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
58
|
-
const
|
|
57
|
+
typeof document < "u" && typeof window < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", vt) : vt());
|
|
58
|
+
const Hr = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), qr = (e) => e.replace(
|
|
59
59
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
60
60
|
(r, t, a) => a ? a.toUpperCase() : t.toLowerCase()
|
|
61
|
-
),
|
|
61
|
+
), Ct = (e) => {
|
|
62
62
|
const r = qr(e);
|
|
63
63
|
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
64
|
-
},
|
|
64
|
+
}, Ot = (...e) => e.filter((r, t, a) => !!r && r.trim() !== "" && a.indexOf(r) === t).join(" ").trim(), Vr = (e) => {
|
|
65
65
|
for (const r in e)
|
|
66
66
|
if (r.startsWith("aria-") || r === "role" || r === "title")
|
|
67
67
|
return !0;
|
|
68
68
|
};
|
|
69
|
-
var
|
|
69
|
+
var Xr = {
|
|
70
70
|
xmlns: "http://www.w3.org/2000/svg",
|
|
71
71
|
width: 24,
|
|
72
72
|
height: 24,
|
|
@@ -77,7 +77,7 @@ var Vr = {
|
|
|
77
77
|
strokeLinecap: "round",
|
|
78
78
|
strokeLinejoin: "round"
|
|
79
79
|
};
|
|
80
|
-
const
|
|
80
|
+
const Kr = ve(
|
|
81
81
|
({
|
|
82
82
|
color: e = "currentColor",
|
|
83
83
|
size: r = 24,
|
|
@@ -87,70 +87,60 @@ const Xr = we(
|
|
|
87
87
|
children: o,
|
|
88
88
|
iconNode: n,
|
|
89
89
|
...u
|
|
90
|
-
}, c) =>
|
|
90
|
+
}, c) => Je(
|
|
91
91
|
"svg",
|
|
92
92
|
{
|
|
93
93
|
ref: c,
|
|
94
|
-
...
|
|
94
|
+
...Xr,
|
|
95
95
|
width: r,
|
|
96
96
|
height: r,
|
|
97
97
|
stroke: e,
|
|
98
98
|
strokeWidth: a ? Number(t) * 24 / Number(r) : t,
|
|
99
|
-
className:
|
|
100
|
-
...!o && !
|
|
99
|
+
className: Ot("lucide", i),
|
|
100
|
+
...!o && !Vr(u) && { "aria-hidden": "true" },
|
|
101
101
|
...u
|
|
102
102
|
},
|
|
103
103
|
[
|
|
104
|
-
...n.map(([s, f]) =>
|
|
104
|
+
...n.map(([s, f]) => Je(s, f)),
|
|
105
105
|
...Array.isArray(o) ? o : [o]
|
|
106
106
|
]
|
|
107
107
|
)
|
|
108
108
|
);
|
|
109
|
-
const
|
|
110
|
-
const t =
|
|
111
|
-
({ className: a, ...i }, o) =>
|
|
109
|
+
const U = (e, r) => {
|
|
110
|
+
const t = ve(
|
|
111
|
+
({ className: a, ...i }, o) => Je(Kr, {
|
|
112
112
|
ref: o,
|
|
113
113
|
iconNode: r,
|
|
114
|
-
className:
|
|
115
|
-
`lucide-${
|
|
114
|
+
className: Ot(
|
|
115
|
+
`lucide-${Hr(Ct(e))}`,
|
|
116
116
|
`lucide-${e}`,
|
|
117
117
|
a
|
|
118
118
|
),
|
|
119
119
|
...i
|
|
120
120
|
})
|
|
121
121
|
);
|
|
122
|
-
return t.displayName =
|
|
122
|
+
return t.displayName = Ct(e), t;
|
|
123
123
|
};
|
|
124
|
-
const
|
|
124
|
+
const Qr = [
|
|
125
125
|
["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
|
|
126
126
|
["path", { d: "M12 19V5", key: "x0mq9r" }]
|
|
127
|
-
],
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
|
|
132
|
-
["path", { d: "M17.997 5.125a4 4 0 0 1 2.526 5.77", key: "iwvgf7" }],
|
|
133
|
-
["path", { d: "M18 18a4 4 0 0 0 2-7.464", key: "efp6ie" }],
|
|
134
|
-
["path", { d: "M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517", key: "1gq6am" }],
|
|
135
|
-
["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
|
|
136
|
-
["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
|
|
137
|
-
], Zr = O("brain", Gr);
|
|
138
|
-
const Jr = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], Yr = O("check", Jr);
|
|
139
|
-
const ea = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], Je = O("chevron-down", ea);
|
|
140
|
-
const ta = [
|
|
127
|
+
], Gr = U("arrow-up", Qr);
|
|
128
|
+
const Zr = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], Jr = U("check", Zr);
|
|
129
|
+
const Yr = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], et = U("chevron-down", Yr);
|
|
130
|
+
const ea = [
|
|
141
131
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
142
132
|
["path", { d: "M12 18a6 6 0 0 0 0-12v12z", key: "j4l70d" }]
|
|
143
|
-
],
|
|
144
|
-
const
|
|
133
|
+
], ta = U("contrast", ea);
|
|
134
|
+
const ra = [
|
|
145
135
|
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
146
136
|
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
147
|
-
],
|
|
148
|
-
const
|
|
137
|
+
], aa = U("copy", ra);
|
|
138
|
+
const na = [
|
|
149
139
|
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
150
140
|
["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
|
|
151
141
|
["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
|
|
152
|
-
],
|
|
153
|
-
const
|
|
142
|
+
], ia = U("ellipsis-vertical", na);
|
|
143
|
+
const oa = [
|
|
154
144
|
[
|
|
155
145
|
"path",
|
|
156
146
|
{
|
|
@@ -163,8 +153,8 @@ const ca = [
|
|
|
163
153
|
["path", { d: "M14 13h2", key: "un5t4a" }],
|
|
164
154
|
["path", { d: "M8 17h2", key: "2yhykz" }],
|
|
165
155
|
["path", { d: "M14 17h2", key: "10kma7" }]
|
|
166
|
-
],
|
|
167
|
-
const
|
|
156
|
+
], ca = U("file-spreadsheet", oa);
|
|
157
|
+
const ua = [
|
|
168
158
|
[
|
|
169
159
|
"path",
|
|
170
160
|
{
|
|
@@ -176,8 +166,8 @@ const sa = [
|
|
|
176
166
|
["path", { d: "M10 9H8", key: "b1mrlr" }],
|
|
177
167
|
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
178
168
|
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
179
|
-
],
|
|
180
|
-
const
|
|
169
|
+
], Ut = U("file-text", ua);
|
|
170
|
+
const sa = [
|
|
181
171
|
[
|
|
182
172
|
"path",
|
|
183
173
|
{
|
|
@@ -189,19 +179,19 @@ const la = [
|
|
|
189
179
|
["path", { d: "M11 18h2", key: "12mj7e" }],
|
|
190
180
|
["path", { d: "M12 12v6", key: "3ahymv" }],
|
|
191
181
|
["path", { d: "M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5", key: "qbrxap" }]
|
|
192
|
-
],
|
|
193
|
-
const
|
|
194
|
-
const
|
|
182
|
+
], la = U("file-type", sa);
|
|
183
|
+
const da = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], Bt = U("loader-circle", da);
|
|
184
|
+
const fa = [
|
|
195
185
|
["path", { d: "m16 17 5-5-5-5", key: "1bji2h" }],
|
|
196
186
|
["path", { d: "M21 12H9", key: "dn1m92" }],
|
|
197
187
|
["path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4", key: "1uf3rs" }]
|
|
198
|
-
],
|
|
199
|
-
const
|
|
188
|
+
], ha = U("log-out", fa);
|
|
189
|
+
const ma = [
|
|
200
190
|
["path", { d: "M4 5h16", key: "1tepv9" }],
|
|
201
191
|
["path", { d: "M4 12h16", key: "1lakjw" }],
|
|
202
192
|
["path", { d: "M4 19h16", key: "1djgab" }]
|
|
203
|
-
],
|
|
204
|
-
const
|
|
193
|
+
], pa = U("menu", ma);
|
|
194
|
+
const ga = [
|
|
205
195
|
[
|
|
206
196
|
"path",
|
|
207
197
|
{
|
|
@@ -209,16 +199,16 @@ const ba = [
|
|
|
209
199
|
key: "1miecu"
|
|
210
200
|
}
|
|
211
201
|
]
|
|
212
|
-
],
|
|
213
|
-
const
|
|
202
|
+
], Wt = U("paperclip", ga);
|
|
203
|
+
const ba = [
|
|
214
204
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
215
205
|
["path", { d: "M12 5v14", key: "s699le" }]
|
|
216
|
-
],
|
|
217
|
-
const
|
|
206
|
+
], ya = U("plus", ba);
|
|
207
|
+
const xa = [
|
|
218
208
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
219
209
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
220
|
-
],
|
|
221
|
-
class
|
|
210
|
+
], nt = U("x", xa);
|
|
211
|
+
class Ht {
|
|
222
212
|
constructor(r, t, a = !1) {
|
|
223
213
|
ae(this, "baseUrl");
|
|
224
214
|
ae(this, "sessionToken", null);
|
|
@@ -245,6 +235,14 @@ class Wt {
|
|
|
245
235
|
async createOrContinueChat(r, t) {
|
|
246
236
|
const a = this.getUrl("/v1/chats"), o = {
|
|
247
237
|
"Content-Type": "application/json",
|
|
238
|
+
Accept: "text/event-stream",
|
|
239
|
+
// Tell server we expect SSE streaming
|
|
240
|
+
"Accept-Encoding": "identity",
|
|
241
|
+
// Disable compression to prevent buffering
|
|
242
|
+
"Cache-Control": "no-cache",
|
|
243
|
+
// Prevent caching of streaming response
|
|
244
|
+
"X-Accel-Buffering": "no",
|
|
245
|
+
// Disable nginx buffering if behind reverse proxy
|
|
248
246
|
"Idempotency-Key": this.generateIdempotencyKey()
|
|
249
247
|
};
|
|
250
248
|
this.sessionToken && (o.Authorization = `Bearer ${this.sessionToken}`);
|
|
@@ -255,7 +253,8 @@ class Wt {
|
|
|
255
253
|
method: "POST",
|
|
256
254
|
headers: o,
|
|
257
255
|
body: JSON.stringify(n),
|
|
258
|
-
signal: t
|
|
256
|
+
signal: t,
|
|
257
|
+
cache: "no-store"
|
|
259
258
|
});
|
|
260
259
|
if (!u.ok) {
|
|
261
260
|
const c = await u.json().catch(() => ({}));
|
|
@@ -455,7 +454,7 @@ class Wt {
|
|
|
455
454
|
return c.json();
|
|
456
455
|
}
|
|
457
456
|
}
|
|
458
|
-
async function*
|
|
457
|
+
async function* ka(e, r) {
|
|
459
458
|
const t = e.getReader(), a = new TextDecoder();
|
|
460
459
|
let i = "";
|
|
461
460
|
try {
|
|
@@ -488,7 +487,7 @@ async function* wa(e, r) {
|
|
|
488
487
|
t.releaseLock();
|
|
489
488
|
}
|
|
490
489
|
}
|
|
491
|
-
function
|
|
490
|
+
function wa(e) {
|
|
492
491
|
return e.map((r) => {
|
|
493
492
|
let t = "";
|
|
494
493
|
if (typeof r.content == "string")
|
|
@@ -504,7 +503,7 @@ function va(e) {
|
|
|
504
503
|
};
|
|
505
504
|
});
|
|
506
505
|
}
|
|
507
|
-
function
|
|
506
|
+
function va(e) {
|
|
508
507
|
return {
|
|
509
508
|
id: e.id,
|
|
510
509
|
role: e.role,
|
|
@@ -536,8 +535,8 @@ function Ca(e) {
|
|
|
536
535
|
}
|
|
537
536
|
};
|
|
538
537
|
}
|
|
539
|
-
const
|
|
540
|
-
function
|
|
538
|
+
const De = /* @__PURE__ */ new Map();
|
|
539
|
+
function Ca(e, r) {
|
|
541
540
|
return {
|
|
542
541
|
async list() {
|
|
543
542
|
const t = [];
|
|
@@ -558,7 +557,7 @@ function Ma(e, r) {
|
|
|
558
557
|
}).filter((u) => u !== null) };
|
|
559
558
|
},
|
|
560
559
|
async initialize(t) {
|
|
561
|
-
return { remoteId:
|
|
560
|
+
return { remoteId: De.get(t) || t, externalId: void 0 };
|
|
562
561
|
},
|
|
563
562
|
async rename(t, a) {
|
|
564
563
|
await e.updateChat(t, { title: a });
|
|
@@ -594,17 +593,17 @@ function Ma(e, r) {
|
|
|
594
593
|
},
|
|
595
594
|
// Add a method to update the remoteId mapping when chat ID is received
|
|
596
595
|
updateRemoteId(t, a) {
|
|
597
|
-
|
|
596
|
+
De.set(t, a), r?.(t, a);
|
|
598
597
|
},
|
|
599
598
|
// Provider component that adds thread-specific history adapter
|
|
600
599
|
unstable_Provider: ({ children: t }) => {
|
|
601
|
-
const i =
|
|
600
|
+
const i = zt()?.remoteId, o = kt.useMemo(
|
|
602
601
|
() => ({
|
|
603
602
|
async load() {
|
|
604
603
|
if (!i) return { messages: [] };
|
|
605
604
|
try {
|
|
606
605
|
const u = await e.getChat(i);
|
|
607
|
-
return !u.messages || u.messages.length === 0 ? { messages: [] } : { messages: u.messages.map((s) =>
|
|
606
|
+
return !u.messages || u.messages.length === 0 ? { messages: [] } : { messages: u.messages.map((s) => va(s)) };
|
|
608
607
|
} catch {
|
|
609
608
|
return { messages: [] };
|
|
610
609
|
}
|
|
@@ -613,7 +612,7 @@ function Ma(e, r) {
|
|
|
613
612
|
}
|
|
614
613
|
}),
|
|
615
614
|
[i, e]
|
|
616
|
-
), n =
|
|
615
|
+
), n = kt.useMemo(() => ({ history: o }), [o]);
|
|
617
616
|
return /* @__PURE__ */ d(_r, { adapters: n, children: t });
|
|
618
617
|
}
|
|
619
618
|
};
|
|
@@ -678,109 +677,110 @@ class Ta {
|
|
|
678
677
|
this.listeners.forEach((r) => r());
|
|
679
678
|
}
|
|
680
679
|
}
|
|
681
|
-
const ie = new Ta(),
|
|
682
|
-
let
|
|
683
|
-
function
|
|
680
|
+
const ie = new Ta(), Tt = /* @__PURE__ */ new Map(), qt = [];
|
|
681
|
+
let Le = [];
|
|
682
|
+
function Ma(e, r, t = 50, a = 800) {
|
|
684
683
|
qt.push({ question: e, response: r, streamingSpeed: t, initialDelay: a });
|
|
685
684
|
}
|
|
686
|
-
function
|
|
687
|
-
const { modelId: t, systemPrompt: a, ephemeral: i,
|
|
688
|
-
let
|
|
685
|
+
function Vt(e, r) {
|
|
686
|
+
const { modelId: t, systemPrompt: a, ephemeral: i, enableReasoning: o, onChatCreated: n, onUserMessage: u, onThreadIdUpdate: c, onBeforeRequest: s } = r;
|
|
687
|
+
let f;
|
|
689
688
|
return {
|
|
690
|
-
async *run(
|
|
691
|
-
const { messages:
|
|
692
|
-
if (
|
|
693
|
-
|
|
694
|
-
const v =
|
|
695
|
-
if (v > 0 && await new Promise((
|
|
689
|
+
async *run(l) {
|
|
690
|
+
const { messages: p, abortSignal: g, context: m } = l, x = qt.shift();
|
|
691
|
+
if (x) {
|
|
692
|
+
u?.();
|
|
693
|
+
const v = x.initialDelay ?? 800;
|
|
694
|
+
if (v > 0 && await new Promise((P) => setTimeout(P, v)), g?.aborted)
|
|
696
695
|
throw new Error("Request aborted");
|
|
697
|
-
const
|
|
698
|
-
let
|
|
699
|
-
const
|
|
700
|
-
i &&
|
|
701
|
-
for (let
|
|
702
|
-
if (
|
|
696
|
+
const S = x.response.split(" ");
|
|
697
|
+
let $ = "";
|
|
698
|
+
const E = x.streamingSpeed || 50, ee = `premade-${Date.now()}`;
|
|
699
|
+
i && n?.(ee);
|
|
700
|
+
for (let P = 0; P < S.length; P++) {
|
|
701
|
+
if (g?.aborted)
|
|
703
702
|
throw new Error("Request aborted");
|
|
704
|
-
|
|
705
|
-
content: [{ type: "text", text:
|
|
706
|
-
}, await new Promise((re) => setTimeout(re,
|
|
703
|
+
$ += (P === 0 ? "" : " ") + S[P], yield {
|
|
704
|
+
content: [{ type: "text", text: $ }]
|
|
705
|
+
}, await new Promise((re) => setTimeout(re, E + Math.random() * (E * 0.5)));
|
|
707
706
|
}
|
|
708
707
|
yield {
|
|
709
|
-
content: [{ type: "text", text:
|
|
710
|
-
},
|
|
711
|
-
{ role: "user", content:
|
|
712
|
-
{ role: "assistant", content:
|
|
708
|
+
content: [{ type: "text", text: $ }]
|
|
709
|
+
}, Le.push(
|
|
710
|
+
{ role: "user", content: x.question },
|
|
711
|
+
{ role: "assistant", content: x.response }
|
|
713
712
|
);
|
|
714
713
|
return;
|
|
715
714
|
}
|
|
716
|
-
const
|
|
717
|
-
let
|
|
718
|
-
if (!
|
|
719
|
-
const v =
|
|
720
|
-
v && (
|
|
715
|
+
const b = m?.threadId;
|
|
716
|
+
let y = b;
|
|
717
|
+
if (!y && p.length > 0) {
|
|
718
|
+
const v = p.find((S) => S.role === "user");
|
|
719
|
+
v && (y = (typeof v.content == "string" ? v.content : Array.isArray(v.content) && v.content.find(($) => $.type === "text")?.text || "").substring(0, 50));
|
|
721
720
|
}
|
|
722
|
-
let
|
|
723
|
-
|
|
724
|
-
let
|
|
725
|
-
for (let v =
|
|
726
|
-
if (
|
|
727
|
-
|
|
721
|
+
let k;
|
|
722
|
+
b && (k = De.get(b)), !k && y && (k = Tt.get(y)), !k && f && (k = f), u?.();
|
|
723
|
+
let T = p, L = -1;
|
|
724
|
+
for (let v = p.length - 1; v >= 0; v--)
|
|
725
|
+
if (p[v].role === "assistant") {
|
|
726
|
+
L = v;
|
|
728
727
|
break;
|
|
729
728
|
}
|
|
730
|
-
(
|
|
731
|
-
const
|
|
732
|
-
if (
|
|
733
|
-
const v =
|
|
734
|
-
role:
|
|
735
|
-
content:
|
|
729
|
+
(k || L >= 0) && L >= 0 && (T = p.slice(L + 1));
|
|
730
|
+
const I = wa(T);
|
|
731
|
+
if (Le.length > 0 && !k) {
|
|
732
|
+
const v = Le.map((S) => ({
|
|
733
|
+
role: S.role,
|
|
734
|
+
content: S.content
|
|
736
735
|
}));
|
|
737
|
-
|
|
736
|
+
I.unshift(...v), Le = [];
|
|
738
737
|
}
|
|
739
|
-
const
|
|
740
|
-
messages:
|
|
741
|
-
chatId:
|
|
738
|
+
const C = {
|
|
739
|
+
messages: I,
|
|
740
|
+
chatId: k || null,
|
|
742
741
|
// Use server chatId if available
|
|
743
742
|
systemPrompt: a,
|
|
744
743
|
ephemeral: i,
|
|
744
|
+
enableReasoning: o,
|
|
745
745
|
stream: !0
|
|
746
746
|
};
|
|
747
|
-
if (t && t.trim() !== "" && (
|
|
747
|
+
if (t && t.trim() !== "" && (C.modelId = t), s && !await s())
|
|
748
748
|
throw new Error("Request blocked");
|
|
749
|
-
const
|
|
750
|
-
let A = "", N = "",
|
|
751
|
-
const
|
|
752
|
-
let
|
|
753
|
-
const
|
|
754
|
-
ie.clear(), ie.setCurrentMessage(
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
sources:
|
|
749
|
+
const D = await e.createOrContinueChat(C, g);
|
|
750
|
+
let A = "", N = "", h;
|
|
751
|
+
const _ = [];
|
|
752
|
+
let H = 0, W = !1;
|
|
753
|
+
const te = `msg_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
754
|
+
ie.clear(), ie.setCurrentMessage(te);
|
|
755
|
+
const Te = () => {
|
|
756
|
+
_.length !== H && (H = _.length, ie.update({
|
|
757
|
+
sources: _.length > 0 ? [..._] : void 0
|
|
758
758
|
}));
|
|
759
|
-
},
|
|
760
|
-
|
|
759
|
+
}, q = () => {
|
|
760
|
+
Te();
|
|
761
761
|
const v = [];
|
|
762
762
|
return N && v.push({ type: "reasoning", text: N }), A && v.push({ type: "text", text: A }), v.length === 0 && v.push({ type: "text", text: "" }), { content: v };
|
|
763
763
|
};
|
|
764
|
-
for await (const v of
|
|
765
|
-
if (
|
|
764
|
+
for await (const v of ka(D, g)) {
|
|
765
|
+
if (g?.aborted)
|
|
766
766
|
throw new Error("Request aborted");
|
|
767
|
-
const
|
|
768
|
-
|
|
769
|
-
const
|
|
770
|
-
if (
|
|
771
|
-
for (const
|
|
772
|
-
|
|
773
|
-
sourceId:
|
|
774
|
-
filename:
|
|
775
|
-
score:
|
|
776
|
-
chunkId:
|
|
777
|
-
datasetId:
|
|
767
|
+
const S = v.id || v.chatId || v.messageId;
|
|
768
|
+
S && !h && (h = S, f = S, n?.(S), b && c && (c(b, S), De.set(b, S)), y && Tt.set(y, S));
|
|
769
|
+
const $ = v.sources;
|
|
770
|
+
if ($ && Array.isArray($) && $.length > 0)
|
|
771
|
+
for (const P of $)
|
|
772
|
+
_.some((re) => re.sourceId === P.sourceId) || _.push({
|
|
773
|
+
sourceId: P.sourceId,
|
|
774
|
+
filename: P.filename || "Unknown",
|
|
775
|
+
score: P.score ?? 1,
|
|
776
|
+
chunkId: P.chunkId,
|
|
777
|
+
datasetId: P.datasetId
|
|
778
778
|
});
|
|
779
|
-
const
|
|
780
|
-
if (
|
|
779
|
+
const E = v.reasoning;
|
|
780
|
+
if (E && E.length > 0 && (N += E, yield q()), v.type)
|
|
781
781
|
switch (v.type) {
|
|
782
782
|
case "source-document":
|
|
783
|
-
v.sourceId &&
|
|
783
|
+
v.sourceId && _.push({
|
|
784
784
|
sourceId: v.sourceId,
|
|
785
785
|
filename: v.title || "Unknown",
|
|
786
786
|
score: 1
|
|
@@ -789,13 +789,13 @@ function Ht(e, r) {
|
|
|
789
789
|
case "reasoning-start":
|
|
790
790
|
continue;
|
|
791
791
|
case "reasoning-delta":
|
|
792
|
-
v.delta && (N += v.delta), (A || N) && (yield
|
|
792
|
+
v.delta && (N += v.delta), (A || N) && (yield q());
|
|
793
793
|
continue;
|
|
794
794
|
case "reasoning-end":
|
|
795
|
-
(A || N) && (yield
|
|
795
|
+
(A || N) && (yield q());
|
|
796
796
|
continue;
|
|
797
797
|
case "text-delta":
|
|
798
|
-
v.delta && (A += v.delta), A && (yield
|
|
798
|
+
v.delta && (N && !W && !A && (W = !0, await new Promise((P) => setTimeout(P, 400))), A += v.delta), A && (yield q());
|
|
799
799
|
continue;
|
|
800
800
|
case "error":
|
|
801
801
|
throw new Error(v.errorText || "Stream error");
|
|
@@ -807,18 +807,18 @@ function Ht(e, r) {
|
|
|
807
807
|
case "finish":
|
|
808
808
|
continue;
|
|
809
809
|
}
|
|
810
|
-
const
|
|
811
|
-
if (
|
|
812
|
-
(A || N ||
|
|
810
|
+
const ee = v.delta;
|
|
811
|
+
if (ee != null && (N && !W && !A && (W = !0, await new Promise((P) => setTimeout(P, 400))), A += ee), v.content && (A += v.content), v.message && (A += v.message.content || ""), v.finished) {
|
|
812
|
+
(A || N || _.length > 0) && (yield q());
|
|
813
813
|
break;
|
|
814
814
|
}
|
|
815
|
-
(A || N ||
|
|
815
|
+
(A || N || _.length > 0) && (yield q());
|
|
816
816
|
}
|
|
817
|
-
(A || N ||
|
|
817
|
+
(A || N || _.length > 0) && (yield q());
|
|
818
818
|
}
|
|
819
819
|
};
|
|
820
820
|
}
|
|
821
|
-
function
|
|
821
|
+
function Xt() {
|
|
822
822
|
return {
|
|
823
823
|
accept: ".pdf,.docx,.txt,.md,.csv,.json,image/*",
|
|
824
824
|
async add({ file: e }) {
|
|
@@ -859,7 +859,7 @@ function Vt() {
|
|
|
859
859
|
}
|
|
860
860
|
};
|
|
861
861
|
}
|
|
862
|
-
function
|
|
862
|
+
function Aa({
|
|
863
863
|
children: e,
|
|
864
864
|
baseUrl: r,
|
|
865
865
|
sessionToken: t,
|
|
@@ -869,75 +869,78 @@ function Na({
|
|
|
869
869
|
onModelChange: n,
|
|
870
870
|
ephemeral: u = !1,
|
|
871
871
|
systemPrompt: c,
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
872
|
+
enableReasoning: s = !1,
|
|
873
|
+
initialThreadId: f,
|
|
874
|
+
onError: l,
|
|
875
|
+
onChatCreated: p,
|
|
876
|
+
onUserMessage: g,
|
|
877
|
+
onThreadIdUpdate: m,
|
|
878
|
+
onChatsLoaded: x,
|
|
879
|
+
enableAttachments: b = !1,
|
|
880
|
+
onBeforeRequest: y
|
|
880
881
|
}) {
|
|
881
|
-
const
|
|
882
|
-
() => new
|
|
882
|
+
const k = V(
|
|
883
|
+
() => new Ht(r, t || void 0, a),
|
|
883
884
|
[r, t, a]
|
|
884
|
-
), [
|
|
885
|
-
|
|
886
|
-
o &&
|
|
885
|
+
), [T, L] = R(o || null);
|
|
886
|
+
O(() => {
|
|
887
|
+
o && L(o);
|
|
887
888
|
}, [o]);
|
|
888
|
-
const
|
|
889
|
+
const I = X(
|
|
889
890
|
(A) => {
|
|
890
|
-
|
|
891
|
+
p?.(A);
|
|
891
892
|
},
|
|
892
|
-
[
|
|
893
|
-
),
|
|
893
|
+
[p]
|
|
894
|
+
), C = X(
|
|
894
895
|
(A, N) => {
|
|
895
|
-
|
|
896
|
+
m?.(A, N);
|
|
896
897
|
},
|
|
897
|
-
[
|
|
898
|
-
),
|
|
899
|
-
modelId:
|
|
898
|
+
[m]
|
|
899
|
+
), D = V(() => Vt(k, {
|
|
900
|
+
modelId: T || void 0,
|
|
900
901
|
// Pass undefined if not set (backend resolves it)
|
|
901
902
|
systemPrompt: c,
|
|
902
903
|
ephemeral: u,
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
904
|
+
enableReasoning: s,
|
|
905
|
+
onChatCreated: I,
|
|
906
|
+
onUserMessage: g,
|
|
907
|
+
onBeforeRequest: y
|
|
908
|
+
}), [k, T, c, u, s, I, g, y]);
|
|
909
|
+
return i === "singleChat" ? /* @__PURE__ */ d(Na, { modelAdapter: D, enableAttachments: b, children: e }) : /* @__PURE__ */ d(
|
|
910
|
+
Ia,
|
|
909
911
|
{
|
|
910
|
-
client:
|
|
912
|
+
client: k,
|
|
911
913
|
modelAdapterOptions: {
|
|
912
|
-
modelId:
|
|
914
|
+
modelId: T || void 0,
|
|
913
915
|
systemPrompt: c,
|
|
914
916
|
ephemeral: u,
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
917
|
+
enableReasoning: s,
|
|
918
|
+
onChatCreated: I,
|
|
919
|
+
onUserMessage: g,
|
|
920
|
+
onBeforeRequest: y
|
|
918
921
|
},
|
|
919
|
-
initialThreadId:
|
|
920
|
-
onChatsLoaded:
|
|
921
|
-
onThreadIdUpdate:
|
|
922
|
-
onError:
|
|
923
|
-
enableAttachments:
|
|
922
|
+
initialThreadId: f,
|
|
923
|
+
onChatsLoaded: x,
|
|
924
|
+
onThreadIdUpdate: C,
|
|
925
|
+
onError: l,
|
|
926
|
+
enableAttachments: b,
|
|
924
927
|
children: e
|
|
925
928
|
}
|
|
926
929
|
);
|
|
927
930
|
}
|
|
928
|
-
function
|
|
931
|
+
function Na({
|
|
929
932
|
modelAdapter: e,
|
|
930
933
|
enableAttachments: r,
|
|
931
934
|
children: t
|
|
932
935
|
}) {
|
|
933
|
-
const a =
|
|
936
|
+
const a = V(() => r ? Xt() : void 0, [r]), i = jt(e, {
|
|
934
937
|
adapters: {
|
|
935
938
|
...a && { attachments: a }
|
|
936
939
|
}
|
|
937
940
|
});
|
|
938
|
-
return /* @__PURE__ */ d(
|
|
941
|
+
return /* @__PURE__ */ d($t, { runtime: i, children: t });
|
|
939
942
|
}
|
|
940
|
-
function
|
|
943
|
+
function Ia({
|
|
941
944
|
client: e,
|
|
942
945
|
modelAdapterOptions: r,
|
|
943
946
|
initialThreadId: t,
|
|
@@ -947,39 +950,39 @@ function Sa({
|
|
|
947
950
|
enableAttachments: n,
|
|
948
951
|
children: u
|
|
949
952
|
}) {
|
|
950
|
-
const c =
|
|
951
|
-
i?.(x,
|
|
952
|
-
}), [e, i]), s =
|
|
953
|
-
(x,
|
|
954
|
-
c.updateRemoteId && c.updateRemoteId(x,
|
|
953
|
+
const c = V(() => Ca(e, (x, b) => {
|
|
954
|
+
i?.(x, b);
|
|
955
|
+
}), [e, i]), s = X(
|
|
956
|
+
(x, b) => {
|
|
957
|
+
c.updateRemoteId && c.updateRemoteId(x, b), i?.(x, b);
|
|
955
958
|
},
|
|
956
959
|
[c, i]
|
|
957
|
-
), f =
|
|
960
|
+
), f = V(() => ({
|
|
958
961
|
...c,
|
|
959
962
|
async list() {
|
|
960
963
|
const x = await c.list();
|
|
961
964
|
return a?.(), x;
|
|
962
965
|
}
|
|
963
966
|
}), [c, a]);
|
|
964
|
-
|
|
967
|
+
O(() => {
|
|
965
968
|
window.__cuadraThreadListAdapter = f, window.__cuadraThreadListRuntime = null;
|
|
966
969
|
}, [f]);
|
|
967
|
-
const l =
|
|
970
|
+
const l = V(() => Vt(e, {
|
|
968
971
|
...r,
|
|
969
972
|
onThreadIdUpdate: s
|
|
970
|
-
}), [e, r, s]), p =
|
|
973
|
+
}), [e, r, s]), p = V(() => n ? Xt() : void 0, [n]), g = X(() => jt(l, {
|
|
971
974
|
adapters: {
|
|
972
975
|
...p && { attachments: p }
|
|
973
976
|
}
|
|
974
|
-
}), [l, p]), m =
|
|
977
|
+
}), [l, p]), m = Er({
|
|
975
978
|
adapter: f,
|
|
976
|
-
runtimeHook:
|
|
979
|
+
runtimeHook: g
|
|
977
980
|
});
|
|
978
|
-
return
|
|
981
|
+
return O(() => {
|
|
979
982
|
window.__cuadraThreadListRuntime = m;
|
|
980
|
-
}, [m]), /* @__PURE__ */ d(
|
|
983
|
+
}, [m]), /* @__PURE__ */ d($t, { runtime: m, children: u });
|
|
981
984
|
}
|
|
982
|
-
function
|
|
985
|
+
function Mt(e, r) {
|
|
983
986
|
const t = String(e);
|
|
984
987
|
if (typeof r != "string")
|
|
985
988
|
throw new TypeError("Expected character");
|
|
@@ -988,8 +991,8 @@ function Ct(e, r) {
|
|
|
988
991
|
a++, i = t.indexOf(r, i + r.length);
|
|
989
992
|
return a;
|
|
990
993
|
}
|
|
991
|
-
const
|
|
992
|
-
function
|
|
994
|
+
const ke = ze(/[A-Za-z]/), it = ze(/[\dA-Za-z]/);
|
|
995
|
+
function Sa(e) {
|
|
993
996
|
return (
|
|
994
997
|
// Special whitespace codes (which have negative values), C0 and Control
|
|
995
998
|
// character DEL
|
|
@@ -1005,19 +1008,19 @@ function B(e) {
|
|
|
1005
1008
|
function G(e) {
|
|
1006
1009
|
return e === -2 || e === -1 || e === 32;
|
|
1007
1010
|
}
|
|
1008
|
-
const
|
|
1009
|
-
function
|
|
1011
|
+
const Fe = ze(/\p{P}|\p{S}/u), oe = ze(/\s/);
|
|
1012
|
+
function ze(e) {
|
|
1010
1013
|
return r;
|
|
1011
1014
|
function r(t) {
|
|
1012
1015
|
return t !== null && t > -1 && e.test(String.fromCharCode(t));
|
|
1013
1016
|
}
|
|
1014
1017
|
}
|
|
1015
|
-
function
|
|
1018
|
+
function La(e) {
|
|
1016
1019
|
if (typeof e != "string")
|
|
1017
1020
|
throw new TypeError("Expected a string");
|
|
1018
1021
|
return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
1019
1022
|
}
|
|
1020
|
-
const
|
|
1023
|
+
const je = (
|
|
1021
1024
|
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
|
1022
1025
|
/**
|
|
1023
1026
|
* @type {(
|
|
@@ -1034,14 +1037,14 @@ const Fe = (
|
|
|
1034
1037
|
*/
|
|
1035
1038
|
(function(e) {
|
|
1036
1039
|
if (e == null)
|
|
1037
|
-
return
|
|
1040
|
+
return _a;
|
|
1038
1041
|
if (typeof e == "function")
|
|
1039
|
-
return
|
|
1042
|
+
return $e(e);
|
|
1040
1043
|
if (typeof e == "object")
|
|
1041
|
-
return Array.isArray(e) ?
|
|
1044
|
+
return Array.isArray(e) ? Pa(e) : (
|
|
1042
1045
|
// Cast because `ReadonlyArray` goes into the above but `isArray`
|
|
1043
1046
|
// narrows to `Array`.
|
|
1044
|
-
|
|
1047
|
+
Ra(
|
|
1045
1048
|
/** @type {Props} */
|
|
1046
1049
|
e
|
|
1047
1050
|
)
|
|
@@ -1051,12 +1054,12 @@ const Fe = (
|
|
|
1051
1054
|
throw new Error("Expected function, string, or object as test");
|
|
1052
1055
|
})
|
|
1053
1056
|
);
|
|
1054
|
-
function
|
|
1057
|
+
function Pa(e) {
|
|
1055
1058
|
const r = [];
|
|
1056
1059
|
let t = -1;
|
|
1057
1060
|
for (; ++t < e.length; )
|
|
1058
|
-
r[t] =
|
|
1059
|
-
return
|
|
1061
|
+
r[t] = je(e[t]);
|
|
1062
|
+
return $e(a);
|
|
1060
1063
|
function a(...i) {
|
|
1061
1064
|
let o = -1;
|
|
1062
1065
|
for (; ++o < r.length; )
|
|
@@ -1064,12 +1067,12 @@ function Ra(e) {
|
|
|
1064
1067
|
return !1;
|
|
1065
1068
|
}
|
|
1066
1069
|
}
|
|
1067
|
-
function
|
|
1070
|
+
function Ra(e) {
|
|
1068
1071
|
const r = (
|
|
1069
1072
|
/** @type {Record<string, unknown>} */
|
|
1070
1073
|
e
|
|
1071
1074
|
);
|
|
1072
|
-
return
|
|
1075
|
+
return $e(t);
|
|
1073
1076
|
function t(a) {
|
|
1074
1077
|
const i = (
|
|
1075
1078
|
/** @type {Record<string, unknown>} */
|
|
@@ -1083,15 +1086,15 @@ function _a(e) {
|
|
|
1083
1086
|
}
|
|
1084
1087
|
}
|
|
1085
1088
|
function Da(e) {
|
|
1086
|
-
return
|
|
1089
|
+
return $e(r);
|
|
1087
1090
|
function r(t) {
|
|
1088
1091
|
return t && t.type === e;
|
|
1089
1092
|
}
|
|
1090
1093
|
}
|
|
1091
|
-
function
|
|
1094
|
+
function $e(e) {
|
|
1092
1095
|
return r;
|
|
1093
1096
|
function r(t, a, i) {
|
|
1094
|
-
return !!(
|
|
1097
|
+
return !!(Ea(t) && e.call(
|
|
1095
1098
|
this,
|
|
1096
1099
|
t,
|
|
1097
1100
|
typeof a == "number" ? a : void 0,
|
|
@@ -1099,17 +1102,17 @@ function ze(e) {
|
|
|
1099
1102
|
));
|
|
1100
1103
|
}
|
|
1101
1104
|
}
|
|
1102
|
-
function
|
|
1105
|
+
function _a() {
|
|
1103
1106
|
return !0;
|
|
1104
1107
|
}
|
|
1105
|
-
function
|
|
1108
|
+
function Ea(e) {
|
|
1106
1109
|
return e !== null && typeof e == "object" && "type" in e;
|
|
1107
1110
|
}
|
|
1108
|
-
const
|
|
1109
|
-
function
|
|
1111
|
+
const Kt = [], Fa = !0, tt = !1, za = "skip";
|
|
1112
|
+
function Qt(e, r, t, a) {
|
|
1110
1113
|
let i;
|
|
1111
1114
|
typeof r == "function" && typeof t != "function" ? (a = t, t = r) : i = r;
|
|
1112
|
-
const o =
|
|
1115
|
+
const o = je(i), n = a ? -1 : 1;
|
|
1113
1116
|
u(e, void 0, [])();
|
|
1114
1117
|
function u(c, s, f) {
|
|
1115
1118
|
const l = (
|
|
@@ -1117,7 +1120,7 @@ function Kt(e, r, t, a) {
|
|
|
1117
1120
|
c && typeof c == "object" ? c : {}
|
|
1118
1121
|
);
|
|
1119
1122
|
if (typeof l.type == "string") {
|
|
1120
|
-
const
|
|
1123
|
+
const g = (
|
|
1121
1124
|
// `hast`
|
|
1122
1125
|
typeof l.tagName == "string" ? l.tagName : (
|
|
1123
1126
|
// `xast`
|
|
@@ -1125,79 +1128,79 @@ function Kt(e, r, t, a) {
|
|
|
1125
1128
|
)
|
|
1126
1129
|
);
|
|
1127
1130
|
Object.defineProperty(p, "name", {
|
|
1128
|
-
value: "node (" + (c.type + (
|
|
1131
|
+
value: "node (" + (c.type + (g ? "<" + g + ">" : "")) + ")"
|
|
1129
1132
|
});
|
|
1130
1133
|
}
|
|
1131
1134
|
return p;
|
|
1132
1135
|
function p() {
|
|
1133
|
-
let
|
|
1134
|
-
if ((!r || o(c, s, f[f.length - 1] || void 0)) && (
|
|
1135
|
-
return
|
|
1136
|
+
let g = Kt, m, x, b;
|
|
1137
|
+
if ((!r || o(c, s, f[f.length - 1] || void 0)) && (g = ja(t(c, f)), g[0] === tt))
|
|
1138
|
+
return g;
|
|
1136
1139
|
if ("children" in c && c.children) {
|
|
1137
|
-
const
|
|
1140
|
+
const y = (
|
|
1138
1141
|
/** @type {UnistParent} */
|
|
1139
1142
|
c
|
|
1140
1143
|
);
|
|
1141
|
-
if (
|
|
1142
|
-
for (x = (a ?
|
|
1143
|
-
const k =
|
|
1144
|
-
if (m = u(k, x,
|
|
1144
|
+
if (y.children && g[0] !== za)
|
|
1145
|
+
for (x = (a ? y.children.length : -1) + n, b = f.concat(y); x > -1 && x < y.children.length; ) {
|
|
1146
|
+
const k = y.children[x];
|
|
1147
|
+
if (m = u(k, x, b)(), m[0] === tt)
|
|
1145
1148
|
return m;
|
|
1146
1149
|
x = typeof m[1] == "number" ? m[1] : x + n;
|
|
1147
1150
|
}
|
|
1148
1151
|
}
|
|
1149
|
-
return
|
|
1152
|
+
return g;
|
|
1150
1153
|
}
|
|
1151
1154
|
}
|
|
1152
1155
|
}
|
|
1153
|
-
function
|
|
1154
|
-
return Array.isArray(e) ? e : typeof e == "number" ? [
|
|
1156
|
+
function ja(e) {
|
|
1157
|
+
return Array.isArray(e) ? e : typeof e == "number" ? [Fa, e] : e == null ? Kt : [e];
|
|
1155
1158
|
}
|
|
1156
|
-
function
|
|
1157
|
-
const i =
|
|
1159
|
+
function $a(e, r, t) {
|
|
1160
|
+
const i = je((t || {}).ignore || []), o = Oa(r);
|
|
1158
1161
|
let n = -1;
|
|
1159
1162
|
for (; ++n < o.length; )
|
|
1160
|
-
|
|
1163
|
+
Qt(e, "text", u);
|
|
1161
1164
|
function u(s, f) {
|
|
1162
1165
|
let l = -1, p;
|
|
1163
1166
|
for (; ++l < f.length; ) {
|
|
1164
|
-
const
|
|
1167
|
+
const g = f[l], m = p ? p.children : void 0;
|
|
1165
1168
|
if (i(
|
|
1166
|
-
|
|
1167
|
-
m ? m.indexOf(
|
|
1169
|
+
g,
|
|
1170
|
+
m ? m.indexOf(g) : void 0,
|
|
1168
1171
|
p
|
|
1169
1172
|
))
|
|
1170
1173
|
return;
|
|
1171
|
-
p =
|
|
1174
|
+
p = g;
|
|
1172
1175
|
}
|
|
1173
1176
|
if (p)
|
|
1174
1177
|
return c(s, f);
|
|
1175
1178
|
}
|
|
1176
1179
|
function c(s, f) {
|
|
1177
|
-
const l = f[f.length - 1], p = o[n][0],
|
|
1180
|
+
const l = f[f.length - 1], p = o[n][0], g = o[n][1];
|
|
1178
1181
|
let m = 0;
|
|
1179
|
-
const
|
|
1180
|
-
let
|
|
1182
|
+
const b = l.children.indexOf(s);
|
|
1183
|
+
let y = !1, k = [];
|
|
1181
1184
|
p.lastIndex = 0;
|
|
1182
|
-
let
|
|
1183
|
-
for (;
|
|
1184
|
-
const
|
|
1185
|
-
index:
|
|
1186
|
-
input:
|
|
1185
|
+
let T = p.exec(s.value);
|
|
1186
|
+
for (; T; ) {
|
|
1187
|
+
const L = T.index, I = {
|
|
1188
|
+
index: T.index,
|
|
1189
|
+
input: T.input,
|
|
1187
1190
|
stack: [...f, s]
|
|
1188
1191
|
};
|
|
1189
|
-
let C =
|
|
1190
|
-
if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex =
|
|
1192
|
+
let C = g(...T, I);
|
|
1193
|
+
if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex = L + 1 : (m !== L && k.push({
|
|
1191
1194
|
type: "text",
|
|
1192
|
-
value: s.value.slice(m,
|
|
1193
|
-
}), Array.isArray(C) ? k.push(...C) : C && k.push(C), m =
|
|
1195
|
+
value: s.value.slice(m, L)
|
|
1196
|
+
}), Array.isArray(C) ? k.push(...C) : C && k.push(C), m = L + T[0].length, y = !0), !p.global)
|
|
1194
1197
|
break;
|
|
1195
|
-
|
|
1198
|
+
T = p.exec(s.value);
|
|
1196
1199
|
}
|
|
1197
|
-
return
|
|
1200
|
+
return y ? (m < s.value.length && k.push({ type: "text", value: s.value.slice(m) }), l.children.splice(b, 1, ...k)) : k = [s], b + k.length;
|
|
1198
1201
|
}
|
|
1199
1202
|
}
|
|
1200
|
-
function
|
|
1203
|
+
function Oa(e) {
|
|
1201
1204
|
const r = [];
|
|
1202
1205
|
if (!Array.isArray(e))
|
|
1203
1206
|
throw new TypeError("Expected find and replace tuple or list of tuples");
|
|
@@ -1205,33 +1208,33 @@ function Ua(e) {
|
|
|
1205
1208
|
let a = -1;
|
|
1206
1209
|
for (; ++a < t.length; ) {
|
|
1207
1210
|
const i = t[a];
|
|
1208
|
-
r.push([
|
|
1211
|
+
r.push([Ua(i[0]), Ba(i[1])]);
|
|
1209
1212
|
}
|
|
1210
1213
|
return r;
|
|
1211
1214
|
}
|
|
1212
|
-
function
|
|
1213
|
-
return typeof e == "string" ? new RegExp(
|
|
1215
|
+
function Ua(e) {
|
|
1216
|
+
return typeof e == "string" ? new RegExp(La(e), "g") : e;
|
|
1214
1217
|
}
|
|
1215
|
-
function
|
|
1218
|
+
function Ba(e) {
|
|
1216
1219
|
return typeof e == "function" ? e : function() {
|
|
1217
1220
|
return e;
|
|
1218
1221
|
};
|
|
1219
1222
|
}
|
|
1220
|
-
const
|
|
1221
|
-
function
|
|
1223
|
+
const Ve = "phrasing", Xe = ["autolink", "link", "image", "label"];
|
|
1224
|
+
function Wa() {
|
|
1222
1225
|
return {
|
|
1223
|
-
transforms: [
|
|
1226
|
+
transforms: [Ga],
|
|
1224
1227
|
enter: {
|
|
1225
|
-
literalAutolink:
|
|
1226
|
-
literalAutolinkEmail:
|
|
1227
|
-
literalAutolinkHttp:
|
|
1228
|
-
literalAutolinkWww:
|
|
1228
|
+
literalAutolink: qa,
|
|
1229
|
+
literalAutolinkEmail: Ke,
|
|
1230
|
+
literalAutolinkHttp: Ke,
|
|
1231
|
+
literalAutolinkWww: Ke
|
|
1229
1232
|
},
|
|
1230
1233
|
exit: {
|
|
1231
|
-
literalAutolink:
|
|
1232
|
-
literalAutolinkEmail:
|
|
1233
|
-
literalAutolinkHttp:
|
|
1234
|
-
literalAutolinkWww:
|
|
1234
|
+
literalAutolink: Qa,
|
|
1235
|
+
literalAutolinkEmail: Ka,
|
|
1236
|
+
literalAutolinkHttp: Va,
|
|
1237
|
+
literalAutolinkWww: Xa
|
|
1235
1238
|
}
|
|
1236
1239
|
};
|
|
1237
1240
|
}
|
|
@@ -1242,61 +1245,61 @@ function Ha() {
|
|
|
1242
1245
|
character: "@",
|
|
1243
1246
|
before: "[+\\-.\\w]",
|
|
1244
1247
|
after: "[\\-.\\w]",
|
|
1245
|
-
inConstruct:
|
|
1246
|
-
notInConstruct:
|
|
1248
|
+
inConstruct: Ve,
|
|
1249
|
+
notInConstruct: Xe
|
|
1247
1250
|
},
|
|
1248
1251
|
{
|
|
1249
1252
|
character: ".",
|
|
1250
1253
|
before: "[Ww]",
|
|
1251
1254
|
after: "[\\-.\\w]",
|
|
1252
|
-
inConstruct:
|
|
1253
|
-
notInConstruct:
|
|
1255
|
+
inConstruct: Ve,
|
|
1256
|
+
notInConstruct: Xe
|
|
1254
1257
|
},
|
|
1255
1258
|
{
|
|
1256
1259
|
character: ":",
|
|
1257
1260
|
before: "[ps]",
|
|
1258
1261
|
after: "\\/",
|
|
1259
|
-
inConstruct:
|
|
1260
|
-
notInConstruct:
|
|
1262
|
+
inConstruct: Ve,
|
|
1263
|
+
notInConstruct: Xe
|
|
1261
1264
|
}
|
|
1262
1265
|
]
|
|
1263
1266
|
};
|
|
1264
1267
|
}
|
|
1265
|
-
function
|
|
1268
|
+
function qa(e) {
|
|
1266
1269
|
this.enter({ type: "link", title: null, url: "", children: [] }, e);
|
|
1267
1270
|
}
|
|
1268
|
-
function
|
|
1271
|
+
function Ke(e) {
|
|
1269
1272
|
this.config.enter.autolinkProtocol.call(this, e);
|
|
1270
1273
|
}
|
|
1271
|
-
function
|
|
1274
|
+
function Va(e) {
|
|
1272
1275
|
this.config.exit.autolinkProtocol.call(this, e);
|
|
1273
1276
|
}
|
|
1274
|
-
function
|
|
1277
|
+
function Xa(e) {
|
|
1275
1278
|
this.config.exit.data.call(this, e);
|
|
1276
1279
|
const r = this.stack[this.stack.length - 1];
|
|
1277
1280
|
r.type, r.url = "http://" + this.sliceSerialize(e);
|
|
1278
1281
|
}
|
|
1279
|
-
function
|
|
1282
|
+
function Ka(e) {
|
|
1280
1283
|
this.config.exit.autolinkEmail.call(this, e);
|
|
1281
1284
|
}
|
|
1282
|
-
function
|
|
1285
|
+
function Qa(e) {
|
|
1283
1286
|
this.exit(e);
|
|
1284
1287
|
}
|
|
1285
|
-
function
|
|
1286
|
-
|
|
1288
|
+
function Ga(e) {
|
|
1289
|
+
$a(
|
|
1287
1290
|
e,
|
|
1288
1291
|
[
|
|
1289
|
-
[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,
|
|
1290
|
-
[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,
|
|
1292
|
+
[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, Za],
|
|
1293
|
+
[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, Ja]
|
|
1291
1294
|
],
|
|
1292
1295
|
{ ignore: ["link", "linkReference"] }
|
|
1293
1296
|
);
|
|
1294
1297
|
}
|
|
1295
|
-
function
|
|
1298
|
+
function Za(e, r, t, a, i) {
|
|
1296
1299
|
let o = "";
|
|
1297
|
-
if (!
|
|
1300
|
+
if (!Gt(i) || (/^w/i.test(r) && (t = r + t, r = "", o = "http://"), !Ya(t)))
|
|
1298
1301
|
return !1;
|
|
1299
|
-
const n =
|
|
1302
|
+
const n = en(t + a);
|
|
1300
1303
|
if (!n[0]) return !1;
|
|
1301
1304
|
const u = {
|
|
1302
1305
|
type: "link",
|
|
@@ -1306,10 +1309,10 @@ function Ja(e, r, t, a, i) {
|
|
|
1306
1309
|
};
|
|
1307
1310
|
return n[1] ? [u, { type: "text", value: n[1] }] : u;
|
|
1308
1311
|
}
|
|
1309
|
-
function
|
|
1312
|
+
function Ja(e, r, t, a) {
|
|
1310
1313
|
return (
|
|
1311
1314
|
// Not an expected previous character.
|
|
1312
|
-
!
|
|
1315
|
+
!Gt(a, !0) || // Label ends in not allowed character.
|
|
1313
1316
|
/[-\d_]$/.test(t) ? !1 : {
|
|
1314
1317
|
type: "link",
|
|
1315
1318
|
title: null,
|
|
@@ -1318,68 +1321,68 @@ function Ya(e, r, t, a) {
|
|
|
1318
1321
|
}
|
|
1319
1322
|
);
|
|
1320
1323
|
}
|
|
1321
|
-
function
|
|
1324
|
+
function Ya(e) {
|
|
1322
1325
|
const r = e.split(".");
|
|
1323
1326
|
return !(r.length < 2 || r[r.length - 1] && (/_/.test(r[r.length - 1]) || !/[a-zA-Z\d]/.test(r[r.length - 1])) || r[r.length - 2] && (/_/.test(r[r.length - 2]) || !/[a-zA-Z\d]/.test(r[r.length - 2])));
|
|
1324
1327
|
}
|
|
1325
|
-
function
|
|
1328
|
+
function en(e) {
|
|
1326
1329
|
const r = /[!"&'),.:;<>?\]}]+$/.exec(e);
|
|
1327
1330
|
if (!r)
|
|
1328
1331
|
return [e, void 0];
|
|
1329
1332
|
e = e.slice(0, r.index);
|
|
1330
1333
|
let t = r[0], a = t.indexOf(")");
|
|
1331
|
-
const i =
|
|
1332
|
-
let o =
|
|
1334
|
+
const i = Mt(e, "(");
|
|
1335
|
+
let o = Mt(e, ")");
|
|
1333
1336
|
for (; a !== -1 && i > o; )
|
|
1334
1337
|
e += t.slice(0, a + 1), t = t.slice(a + 1), a = t.indexOf(")"), o++;
|
|
1335
1338
|
return [e, t];
|
|
1336
1339
|
}
|
|
1337
|
-
function
|
|
1340
|
+
function Gt(e, r) {
|
|
1338
1341
|
const t = e.input.charCodeAt(e.index - 1);
|
|
1339
|
-
return (e.index === 0 || oe(t) ||
|
|
1342
|
+
return (e.index === 0 || oe(t) || Fe(t)) && // If it’s an email, the previous character should not be a slash.
|
|
1340
1343
|
(!r || t !== 47);
|
|
1341
1344
|
}
|
|
1342
|
-
function
|
|
1345
|
+
function Ce(e) {
|
|
1343
1346
|
return e.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
|
|
1344
1347
|
}
|
|
1345
|
-
|
|
1346
|
-
function
|
|
1348
|
+
Zt.peek = ln;
|
|
1349
|
+
function tn() {
|
|
1347
1350
|
this.buffer();
|
|
1348
1351
|
}
|
|
1349
|
-
function
|
|
1352
|
+
function rn(e) {
|
|
1350
1353
|
this.enter({ type: "footnoteReference", identifier: "", label: "" }, e);
|
|
1351
1354
|
}
|
|
1352
|
-
function
|
|
1355
|
+
function an() {
|
|
1353
1356
|
this.buffer();
|
|
1354
1357
|
}
|
|
1355
|
-
function
|
|
1358
|
+
function nn(e) {
|
|
1356
1359
|
this.enter(
|
|
1357
1360
|
{ type: "footnoteDefinition", identifier: "", label: "", children: [] },
|
|
1358
1361
|
e
|
|
1359
1362
|
);
|
|
1360
1363
|
}
|
|
1361
|
-
function
|
|
1364
|
+
function on(e) {
|
|
1362
1365
|
const r = this.resume(), t = this.stack[this.stack.length - 1];
|
|
1363
|
-
t.type, t.identifier =
|
|
1366
|
+
t.type, t.identifier = Ce(
|
|
1364
1367
|
this.sliceSerialize(e)
|
|
1365
1368
|
).toLowerCase(), t.label = r;
|
|
1366
1369
|
}
|
|
1367
|
-
function
|
|
1370
|
+
function cn(e) {
|
|
1368
1371
|
this.exit(e);
|
|
1369
1372
|
}
|
|
1370
|
-
function
|
|
1373
|
+
function un(e) {
|
|
1371
1374
|
const r = this.resume(), t = this.stack[this.stack.length - 1];
|
|
1372
|
-
t.type, t.identifier =
|
|
1375
|
+
t.type, t.identifier = Ce(
|
|
1373
1376
|
this.sliceSerialize(e)
|
|
1374
1377
|
).toLowerCase(), t.label = r;
|
|
1375
1378
|
}
|
|
1376
|
-
function
|
|
1379
|
+
function sn(e) {
|
|
1377
1380
|
this.exit(e);
|
|
1378
1381
|
}
|
|
1379
|
-
function
|
|
1382
|
+
function ln() {
|
|
1380
1383
|
return "[";
|
|
1381
1384
|
}
|
|
1382
|
-
function
|
|
1385
|
+
function Zt(e, r, t, a) {
|
|
1383
1386
|
const i = t.createTracker(a);
|
|
1384
1387
|
let o = i.move("[^");
|
|
1385
1388
|
const n = t.enter("footnoteReference"), u = t.enter("reference");
|
|
@@ -1387,26 +1390,26 @@ function Gt(e, r, t, a) {
|
|
|
1387
1390
|
t.safe(t.associationId(e), { after: "]", before: o })
|
|
1388
1391
|
), u(), n(), o += i.move("]"), o;
|
|
1389
1392
|
}
|
|
1390
|
-
function
|
|
1393
|
+
function dn() {
|
|
1391
1394
|
return {
|
|
1392
1395
|
enter: {
|
|
1393
|
-
gfmFootnoteCallString:
|
|
1394
|
-
gfmFootnoteCall:
|
|
1395
|
-
gfmFootnoteDefinitionLabelString:
|
|
1396
|
-
gfmFootnoteDefinition:
|
|
1396
|
+
gfmFootnoteCallString: tn,
|
|
1397
|
+
gfmFootnoteCall: rn,
|
|
1398
|
+
gfmFootnoteDefinitionLabelString: an,
|
|
1399
|
+
gfmFootnoteDefinition: nn
|
|
1397
1400
|
},
|
|
1398
1401
|
exit: {
|
|
1399
|
-
gfmFootnoteCallString:
|
|
1400
|
-
gfmFootnoteCall:
|
|
1401
|
-
gfmFootnoteDefinitionLabelString:
|
|
1402
|
-
gfmFootnoteDefinition:
|
|
1402
|
+
gfmFootnoteCallString: on,
|
|
1403
|
+
gfmFootnoteCall: cn,
|
|
1404
|
+
gfmFootnoteDefinitionLabelString: un,
|
|
1405
|
+
gfmFootnoteDefinition: sn
|
|
1403
1406
|
}
|
|
1404
1407
|
};
|
|
1405
1408
|
}
|
|
1406
|
-
function
|
|
1409
|
+
function fn(e) {
|
|
1407
1410
|
let r = !1;
|
|
1408
1411
|
return e && e.firstLineBlank && (r = !0), {
|
|
1409
|
-
handlers: { footnoteDefinition: t, footnoteReference:
|
|
1412
|
+
handlers: { footnoteDefinition: t, footnoteReference: Zt },
|
|
1410
1413
|
// This is on by default already.
|
|
1411
1414
|
unsafe: [{ character: "[", inConstruct: ["label", "phrasing", "reference"] }]
|
|
1412
1415
|
};
|
|
@@ -1420,18 +1423,18 @@ function hn(e) {
|
|
|
1420
1423
|
(r ? `
|
|
1421
1424
|
` : " ") + o.indentLines(
|
|
1422
1425
|
o.containerFlow(a, u.current()),
|
|
1423
|
-
r ?
|
|
1426
|
+
r ? Jt : hn
|
|
1424
1427
|
)
|
|
1425
1428
|
)), s(), c;
|
|
1426
1429
|
}
|
|
1427
1430
|
}
|
|
1428
|
-
function
|
|
1429
|
-
return r === 0 ? e :
|
|
1431
|
+
function hn(e, r, t) {
|
|
1432
|
+
return r === 0 ? e : Jt(e, r, t);
|
|
1430
1433
|
}
|
|
1431
|
-
function
|
|
1434
|
+
function Jt(e, r, t) {
|
|
1432
1435
|
return (t ? "" : " ") + e;
|
|
1433
1436
|
}
|
|
1434
|
-
const
|
|
1437
|
+
const mn = [
|
|
1435
1438
|
"autolink",
|
|
1436
1439
|
"destinationLiteral",
|
|
1437
1440
|
"destinationRaw",
|
|
@@ -1439,33 +1442,33 @@ const pn = [
|
|
|
1439
1442
|
"titleQuote",
|
|
1440
1443
|
"titleApostrophe"
|
|
1441
1444
|
];
|
|
1442
|
-
|
|
1443
|
-
function
|
|
1445
|
+
Yt.peek = xn;
|
|
1446
|
+
function pn() {
|
|
1444
1447
|
return {
|
|
1445
1448
|
canContainEols: ["delete"],
|
|
1446
|
-
enter: { strikethrough:
|
|
1447
|
-
exit: { strikethrough:
|
|
1449
|
+
enter: { strikethrough: bn },
|
|
1450
|
+
exit: { strikethrough: yn }
|
|
1448
1451
|
};
|
|
1449
1452
|
}
|
|
1450
|
-
function
|
|
1453
|
+
function gn() {
|
|
1451
1454
|
return {
|
|
1452
1455
|
unsafe: [
|
|
1453
1456
|
{
|
|
1454
1457
|
character: "~",
|
|
1455
1458
|
inConstruct: "phrasing",
|
|
1456
|
-
notInConstruct:
|
|
1459
|
+
notInConstruct: mn
|
|
1457
1460
|
}
|
|
1458
1461
|
],
|
|
1459
|
-
handlers: { delete:
|
|
1462
|
+
handlers: { delete: Yt }
|
|
1460
1463
|
};
|
|
1461
1464
|
}
|
|
1462
|
-
function
|
|
1465
|
+
function bn(e) {
|
|
1463
1466
|
this.enter({ type: "delete", children: [] }, e);
|
|
1464
1467
|
}
|
|
1465
|
-
function
|
|
1468
|
+
function yn(e) {
|
|
1466
1469
|
this.exit(e);
|
|
1467
1470
|
}
|
|
1468
|
-
function
|
|
1471
|
+
function Yt(e, r, t, a) {
|
|
1469
1472
|
const i = t.createTracker(a), o = t.enter("strikethrough");
|
|
1470
1473
|
let n = i.move("~~");
|
|
1471
1474
|
return n += t.containerPhrasing(e, {
|
|
@@ -1474,82 +1477,82 @@ function Jt(e, r, t, a) {
|
|
|
1474
1477
|
after: "~"
|
|
1475
1478
|
}), n += i.move("~~"), o(), n;
|
|
1476
1479
|
}
|
|
1477
|
-
function
|
|
1480
|
+
function xn() {
|
|
1478
1481
|
return "~";
|
|
1479
1482
|
}
|
|
1480
|
-
function
|
|
1483
|
+
function kn(e) {
|
|
1481
1484
|
return e.length;
|
|
1482
1485
|
}
|
|
1483
|
-
function
|
|
1484
|
-
const t = r || {}, a = (t.align || []).concat(), i = t.stringLength ||
|
|
1486
|
+
function wn(e, r) {
|
|
1487
|
+
const t = r || {}, a = (t.align || []).concat(), i = t.stringLength || kn, o = [], n = [], u = [], c = [];
|
|
1485
1488
|
let s = 0, f = -1;
|
|
1486
1489
|
for (; ++f < e.length; ) {
|
|
1487
|
-
const x = [],
|
|
1488
|
-
let
|
|
1489
|
-
for (e[f].length > s && (s = e[f].length); ++
|
|
1490
|
-
const k =
|
|
1490
|
+
const x = [], b = [];
|
|
1491
|
+
let y = -1;
|
|
1492
|
+
for (e[f].length > s && (s = e[f].length); ++y < e[f].length; ) {
|
|
1493
|
+
const k = vn(e[f][y]);
|
|
1491
1494
|
if (t.alignDelimiters !== !1) {
|
|
1492
|
-
const
|
|
1493
|
-
|
|
1495
|
+
const T = i(k);
|
|
1496
|
+
b[y] = T, (c[y] === void 0 || T > c[y]) && (c[y] = T);
|
|
1494
1497
|
}
|
|
1495
1498
|
x.push(k);
|
|
1496
1499
|
}
|
|
1497
|
-
n[f] = x, u[f] =
|
|
1500
|
+
n[f] = x, u[f] = b;
|
|
1498
1501
|
}
|
|
1499
1502
|
let l = -1;
|
|
1500
1503
|
if (typeof a == "object" && "length" in a)
|
|
1501
1504
|
for (; ++l < s; )
|
|
1502
|
-
o[l] =
|
|
1505
|
+
o[l] = At(a[l]);
|
|
1503
1506
|
else {
|
|
1504
|
-
const x =
|
|
1507
|
+
const x = At(a);
|
|
1505
1508
|
for (; ++l < s; )
|
|
1506
1509
|
o[l] = x;
|
|
1507
1510
|
}
|
|
1508
1511
|
l = -1;
|
|
1509
|
-
const p = [],
|
|
1512
|
+
const p = [], g = [];
|
|
1510
1513
|
for (; ++l < s; ) {
|
|
1511
1514
|
const x = o[l];
|
|
1512
|
-
let
|
|
1513
|
-
x === 99 ? (
|
|
1515
|
+
let b = "", y = "";
|
|
1516
|
+
x === 99 ? (b = ":", y = ":") : x === 108 ? b = ":" : x === 114 && (y = ":");
|
|
1514
1517
|
let k = t.alignDelimiters === !1 ? 1 : Math.max(
|
|
1515
1518
|
1,
|
|
1516
|
-
c[l] -
|
|
1519
|
+
c[l] - b.length - y.length
|
|
1517
1520
|
);
|
|
1518
|
-
const
|
|
1519
|
-
t.alignDelimiters !== !1 && (k =
|
|
1521
|
+
const T = b + "-".repeat(k) + y;
|
|
1522
|
+
t.alignDelimiters !== !1 && (k = b.length + k + y.length, k > c[l] && (c[l] = k), g[l] = k), p[l] = T;
|
|
1520
1523
|
}
|
|
1521
|
-
n.splice(1, 0, p), u.splice(1, 0,
|
|
1524
|
+
n.splice(1, 0, p), u.splice(1, 0, g), f = -1;
|
|
1522
1525
|
const m = [];
|
|
1523
1526
|
for (; ++f < n.length; ) {
|
|
1524
|
-
const x = n[f],
|
|
1527
|
+
const x = n[f], b = u[f];
|
|
1525
1528
|
l = -1;
|
|
1526
|
-
const
|
|
1529
|
+
const y = [];
|
|
1527
1530
|
for (; ++l < s; ) {
|
|
1528
1531
|
const k = x[l] || "";
|
|
1529
|
-
let
|
|
1532
|
+
let T = "", L = "";
|
|
1530
1533
|
if (t.alignDelimiters !== !1) {
|
|
1531
|
-
const
|
|
1532
|
-
C === 114 ?
|
|
1534
|
+
const I = c[l] - (b[l] || 0), C = o[l];
|
|
1535
|
+
C === 114 ? T = " ".repeat(I) : C === 99 ? I % 2 ? (T = " ".repeat(I / 2 + 0.5), L = " ".repeat(I / 2 - 0.5)) : (T = " ".repeat(I / 2), L = T) : L = " ".repeat(I);
|
|
1533
1536
|
}
|
|
1534
|
-
t.delimiterStart !== !1 && !l &&
|
|
1537
|
+
t.delimiterStart !== !1 && !l && y.push("|"), t.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is
|
|
1535
1538
|
// empty: there will be a closing space.
|
|
1536
|
-
!(t.alignDelimiters === !1 && k === "") && (t.delimiterStart !== !1 || l) &&
|
|
1539
|
+
!(t.alignDelimiters === !1 && k === "") && (t.delimiterStart !== !1 || l) && y.push(" "), t.alignDelimiters !== !1 && y.push(T), y.push(k), t.alignDelimiters !== !1 && y.push(L), t.padding !== !1 && y.push(" "), (t.delimiterEnd !== !1 || l !== s - 1) && y.push("|");
|
|
1537
1540
|
}
|
|
1538
1541
|
m.push(
|
|
1539
|
-
t.delimiterEnd === !1 ?
|
|
1542
|
+
t.delimiterEnd === !1 ? y.join("").replace(/ +$/, "") : y.join("")
|
|
1540
1543
|
);
|
|
1541
1544
|
}
|
|
1542
1545
|
return m.join(`
|
|
1543
1546
|
`);
|
|
1544
1547
|
}
|
|
1545
|
-
function
|
|
1548
|
+
function vn(e) {
|
|
1546
1549
|
return e == null ? "" : String(e);
|
|
1547
1550
|
}
|
|
1548
|
-
function
|
|
1551
|
+
function At(e) {
|
|
1549
1552
|
const r = typeof e == "string" ? e.codePointAt(0) : 0;
|
|
1550
1553
|
return r === 67 || r === 99 ? 99 : r === 76 || r === 108 ? 108 : r === 82 || r === 114 ? 114 : 0;
|
|
1551
1554
|
}
|
|
1552
|
-
function
|
|
1555
|
+
function Cn(e, r, t, a) {
|
|
1553
1556
|
const i = t.enter("blockquote"), o = t.createTracker(a);
|
|
1554
1557
|
o.move("> "), o.shift(2);
|
|
1555
1558
|
const n = t.indentLines(
|
|
@@ -1561,10 +1564,10 @@ function Mn(e, r, t, a) {
|
|
|
1561
1564
|
function Tn(e, r, t) {
|
|
1562
1565
|
return ">" + (t ? "" : " ") + e;
|
|
1563
1566
|
}
|
|
1564
|
-
function
|
|
1565
|
-
return
|
|
1567
|
+
function Mn(e, r) {
|
|
1568
|
+
return Nt(e, r.inConstruct, !0) && !Nt(e, r.notInConstruct, !1);
|
|
1566
1569
|
}
|
|
1567
|
-
function
|
|
1570
|
+
function Nt(e, r, t) {
|
|
1568
1571
|
if (typeof r == "string" && (r = [r]), !r || r.length === 0)
|
|
1569
1572
|
return t;
|
|
1570
1573
|
let a = -1;
|
|
@@ -1573,16 +1576,16 @@ function Tt(e, r, t) {
|
|
|
1573
1576
|
return !0;
|
|
1574
1577
|
return !1;
|
|
1575
1578
|
}
|
|
1576
|
-
function
|
|
1579
|
+
function It(e, r, t, a) {
|
|
1577
1580
|
let i = -1;
|
|
1578
1581
|
for (; ++i < t.unsafe.length; )
|
|
1579
1582
|
if (t.unsafe[i].character === `
|
|
1580
|
-
` &&
|
|
1583
|
+
` && Mn(t.stack, t.unsafe[i]))
|
|
1581
1584
|
return /[ \t]/.test(a.before) ? "" : " ";
|
|
1582
1585
|
return `\\
|
|
1583
1586
|
`;
|
|
1584
1587
|
}
|
|
1585
|
-
function
|
|
1588
|
+
function An(e, r) {
|
|
1586
1589
|
const t = String(e);
|
|
1587
1590
|
let a = t.indexOf(r), i = a, o = 0, n = 0;
|
|
1588
1591
|
if (typeof r != "string")
|
|
@@ -1591,13 +1594,13 @@ function Nn(e, r) {
|
|
|
1591
1594
|
a === i ? ++o > n && (n = o) : o = 1, i = a + r.length, a = t.indexOf(r, i);
|
|
1592
1595
|
return n;
|
|
1593
1596
|
}
|
|
1594
|
-
function
|
|
1597
|
+
function Nn(e, r) {
|
|
1595
1598
|
return !!(r.options.fences === !1 && e.value && // If there’s no info…
|
|
1596
1599
|
!e.lang && // And there’s a non-whitespace character…
|
|
1597
1600
|
/[^ \r\n]/.test(e.value) && // And the value doesn’t start or end in a blank…
|
|
1598
1601
|
!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value));
|
|
1599
1602
|
}
|
|
1600
|
-
function
|
|
1603
|
+
function In(e) {
|
|
1601
1604
|
const r = e.options.fence || "`";
|
|
1602
1605
|
if (r !== "`" && r !== "~")
|
|
1603
1606
|
throw new Error(
|
|
@@ -1605,13 +1608,13 @@ function Sn(e) {
|
|
|
1605
1608
|
);
|
|
1606
1609
|
return r;
|
|
1607
1610
|
}
|
|
1608
|
-
function
|
|
1609
|
-
const i =
|
|
1610
|
-
if (
|
|
1611
|
-
const l = t.enter("codeIndented"), p = t.indentLines(o,
|
|
1611
|
+
function Sn(e, r, t, a) {
|
|
1612
|
+
const i = In(t), o = e.value || "", n = i === "`" ? "GraveAccent" : "Tilde";
|
|
1613
|
+
if (Nn(e, t)) {
|
|
1614
|
+
const l = t.enter("codeIndented"), p = t.indentLines(o, Ln);
|
|
1612
1615
|
return l(), p;
|
|
1613
1616
|
}
|
|
1614
|
-
const u = t.createTracker(a), c = i.repeat(Math.max(
|
|
1617
|
+
const u = t.createTracker(a), c = i.repeat(Math.max(An(o, i) + 1, 3)), s = t.enter("codeFenced");
|
|
1615
1618
|
let f = u.move(c);
|
|
1616
1619
|
if (e.lang) {
|
|
1617
1620
|
const l = t.enter(`codeFencedLang${n}`);
|
|
@@ -1640,10 +1643,10 @@ function Ln(e, r, t, a) {
|
|
|
1640
1643
|
`), o && (f += u.move(o + `
|
|
1641
1644
|
`)), f += u.move(c), s(), f;
|
|
1642
1645
|
}
|
|
1643
|
-
function
|
|
1646
|
+
function Ln(e, r, t) {
|
|
1644
1647
|
return (t ? "" : " ") + e;
|
|
1645
1648
|
}
|
|
1646
|
-
function
|
|
1649
|
+
function ot(e) {
|
|
1647
1650
|
const r = e.options.quote || '"';
|
|
1648
1651
|
if (r !== '"' && r !== "'")
|
|
1649
1652
|
throw new Error(
|
|
@@ -1651,8 +1654,8 @@ function nt(e) {
|
|
|
1651
1654
|
);
|
|
1652
1655
|
return r;
|
|
1653
1656
|
}
|
|
1654
|
-
function
|
|
1655
|
-
const i =
|
|
1657
|
+
function Pn(e, r, t, a) {
|
|
1658
|
+
const i = ot(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.enter("definition");
|
|
1656
1659
|
let u = t.enter("label");
|
|
1657
1660
|
const c = t.createTracker(a);
|
|
1658
1661
|
let s = c.move("[");
|
|
@@ -1681,7 +1684,7 @@ function Rn(e, r, t, a) {
|
|
|
1681
1684
|
})
|
|
1682
1685
|
), s += c.move(i), u()), n(), s;
|
|
1683
1686
|
}
|
|
1684
|
-
function
|
|
1687
|
+
function Rn(e) {
|
|
1685
1688
|
const r = e.options.emphasis || "*";
|
|
1686
1689
|
if (r !== "*" && r !== "_")
|
|
1687
1690
|
throw new Error(
|
|
@@ -1689,17 +1692,17 @@ function _n(e) {
|
|
|
1689
1692
|
);
|
|
1690
1693
|
return r;
|
|
1691
1694
|
}
|
|
1692
|
-
function
|
|
1695
|
+
function we(e) {
|
|
1693
1696
|
return "&#x" + e.toString(16).toUpperCase() + ";";
|
|
1694
1697
|
}
|
|
1695
|
-
function
|
|
1698
|
+
function _e(e) {
|
|
1696
1699
|
if (e === null || B(e) || oe(e))
|
|
1697
1700
|
return 1;
|
|
1698
|
-
if (
|
|
1701
|
+
if (Fe(e))
|
|
1699
1702
|
return 2;
|
|
1700
1703
|
}
|
|
1701
|
-
function
|
|
1702
|
-
const a =
|
|
1704
|
+
function Ee(e, r, t) {
|
|
1705
|
+
const a = _e(e), i = _e(r);
|
|
1703
1706
|
return a === void 0 ? i === void 0 ? (
|
|
1704
1707
|
// Letter inside:
|
|
1705
1708
|
// we have to encode *both* letters for `_` as it is looser.
|
|
@@ -1731,9 +1734,9 @@ function _e(e, r, t) {
|
|
|
1731
1734
|
{ inside: !1, outside: !1 }
|
|
1732
1735
|
);
|
|
1733
1736
|
}
|
|
1734
|
-
|
|
1735
|
-
function
|
|
1736
|
-
const i =
|
|
1737
|
+
er.peek = Dn;
|
|
1738
|
+
function er(e, r, t, a) {
|
|
1739
|
+
const i = Rn(t), o = t.enter("emphasis"), n = t.createTracker(a), u = n.move(i);
|
|
1737
1740
|
let c = n.move(
|
|
1738
1741
|
t.containerPhrasing(e, {
|
|
1739
1742
|
after: i,
|
|
@@ -1741,67 +1744,67 @@ function Yt(e, r, t, a) {
|
|
|
1741
1744
|
...n.current()
|
|
1742
1745
|
})
|
|
1743
1746
|
);
|
|
1744
|
-
const s = c.charCodeAt(0), f =
|
|
1747
|
+
const s = c.charCodeAt(0), f = Ee(
|
|
1745
1748
|
a.before.charCodeAt(a.before.length - 1),
|
|
1746
1749
|
s,
|
|
1747
1750
|
i
|
|
1748
1751
|
);
|
|
1749
|
-
f.inside && (c =
|
|
1750
|
-
const l = c.charCodeAt(c.length - 1), p =
|
|
1751
|
-
p.inside && (c = c.slice(0, -1) +
|
|
1752
|
-
const
|
|
1752
|
+
f.inside && (c = we(s) + c.slice(1));
|
|
1753
|
+
const l = c.charCodeAt(c.length - 1), p = Ee(a.after.charCodeAt(0), l, i);
|
|
1754
|
+
p.inside && (c = c.slice(0, -1) + we(l));
|
|
1755
|
+
const g = n.move(i);
|
|
1753
1756
|
return o(), t.attentionEncodeSurroundingInfo = {
|
|
1754
1757
|
after: p.outside,
|
|
1755
1758
|
before: f.outside
|
|
1756
|
-
}, u + c +
|
|
1759
|
+
}, u + c + g;
|
|
1757
1760
|
}
|
|
1758
1761
|
function Dn(e, r, t) {
|
|
1759
1762
|
return t.options.emphasis || "*";
|
|
1760
1763
|
}
|
|
1761
|
-
function
|
|
1764
|
+
function _n(e, r, t, a) {
|
|
1762
1765
|
let i, o, n;
|
|
1763
|
-
typeof r == "function" && typeof t != "function" ? (o = void 0, n = r, i = t) : (o = r, n = t, i = a),
|
|
1766
|
+
typeof r == "function" && typeof t != "function" ? (o = void 0, n = r, i = t) : (o = r, n = t, i = a), Qt(e, o, u, i);
|
|
1764
1767
|
function u(c, s) {
|
|
1765
1768
|
const f = s[s.length - 1], l = f ? f.children.indexOf(c) : void 0;
|
|
1766
1769
|
return n(c, l, f);
|
|
1767
1770
|
}
|
|
1768
1771
|
}
|
|
1769
|
-
const
|
|
1770
|
-
function
|
|
1771
|
-
const t =
|
|
1772
|
-
return
|
|
1772
|
+
const En = {};
|
|
1773
|
+
function tr(e, r) {
|
|
1774
|
+
const t = En, a = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, i = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
|
|
1775
|
+
return rr(e, a, i);
|
|
1773
1776
|
}
|
|
1774
|
-
function
|
|
1775
|
-
if (
|
|
1777
|
+
function rr(e, r, t) {
|
|
1778
|
+
if (Fn(e)) {
|
|
1776
1779
|
if ("value" in e)
|
|
1777
1780
|
return e.type === "html" && !t ? "" : e.value;
|
|
1778
1781
|
if (r && "alt" in e && e.alt)
|
|
1779
1782
|
return e.alt;
|
|
1780
1783
|
if ("children" in e)
|
|
1781
|
-
return
|
|
1784
|
+
return St(e.children, r, t);
|
|
1782
1785
|
}
|
|
1783
|
-
return Array.isArray(e) ?
|
|
1786
|
+
return Array.isArray(e) ? St(e, r, t) : "";
|
|
1784
1787
|
}
|
|
1785
|
-
function
|
|
1788
|
+
function St(e, r, t) {
|
|
1786
1789
|
const a = [];
|
|
1787
1790
|
let i = -1;
|
|
1788
1791
|
for (; ++i < e.length; )
|
|
1789
|
-
a[i] =
|
|
1792
|
+
a[i] = rr(e[i], r, t);
|
|
1790
1793
|
return a.join("");
|
|
1791
1794
|
}
|
|
1792
|
-
function
|
|
1795
|
+
function Fn(e) {
|
|
1793
1796
|
return !!(e && typeof e == "object");
|
|
1794
1797
|
}
|
|
1795
|
-
function
|
|
1798
|
+
function zn(e, r) {
|
|
1796
1799
|
let t = !1;
|
|
1797
|
-
return
|
|
1800
|
+
return _n(e, function(a) {
|
|
1798
1801
|
if ("value" in a && /\r?\n|\r/.test(a.value) || a.type === "break")
|
|
1799
|
-
return t = !0,
|
|
1800
|
-
}), !!((!e.depth || e.depth < 3) &&
|
|
1802
|
+
return t = !0, tt;
|
|
1803
|
+
}), !!((!e.depth || e.depth < 3) && tr(e) && (r.options.setext || t));
|
|
1801
1804
|
}
|
|
1802
|
-
function
|
|
1805
|
+
function jn(e, r, t, a) {
|
|
1803
1806
|
const i = Math.max(Math.min(6, e.depth || 1), 1), o = t.createTracker(a);
|
|
1804
|
-
if (
|
|
1807
|
+
if (zn(e, t)) {
|
|
1805
1808
|
const f = t.enter("headingSetext"), l = t.enter("phrasing"), p = t.containerPhrasing(e, {
|
|
1806
1809
|
...o.current(),
|
|
1807
1810
|
before: `
|
|
@@ -1826,18 +1829,18 @@ function $n(e, r, t, a) {
|
|
|
1826
1829
|
`,
|
|
1827
1830
|
...o.current()
|
|
1828
1831
|
});
|
|
1829
|
-
return /^[\t ]/.test(s) && (s =
|
|
1832
|
+
return /^[\t ]/.test(s) && (s = we(s.charCodeAt(0)) + s.slice(1)), s = s ? n + " " + s : n, t.options.closeAtx && (s += " " + n), c(), u(), s;
|
|
1830
1833
|
}
|
|
1831
|
-
|
|
1832
|
-
function
|
|
1834
|
+
ar.peek = $n;
|
|
1835
|
+
function ar(e) {
|
|
1833
1836
|
return e.value || "";
|
|
1834
1837
|
}
|
|
1835
|
-
function
|
|
1838
|
+
function $n() {
|
|
1836
1839
|
return "<";
|
|
1837
1840
|
}
|
|
1838
|
-
|
|
1839
|
-
function
|
|
1840
|
-
const i =
|
|
1841
|
+
nr.peek = On;
|
|
1842
|
+
function nr(e, r, t, a) {
|
|
1843
|
+
const i = ot(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.enter("image");
|
|
1841
1844
|
let u = t.enter("label");
|
|
1842
1845
|
const c = t.createTracker(a);
|
|
1843
1846
|
let s = c.move("![");
|
|
@@ -1861,11 +1864,11 @@ function ar(e, r, t, a) {
|
|
|
1861
1864
|
})
|
|
1862
1865
|
), s += c.move(i), u()), s += c.move(")"), n(), s;
|
|
1863
1866
|
}
|
|
1864
|
-
function
|
|
1867
|
+
function On() {
|
|
1865
1868
|
return "!";
|
|
1866
1869
|
}
|
|
1867
|
-
|
|
1868
|
-
function
|
|
1870
|
+
ir.peek = Un;
|
|
1871
|
+
function ir(e, r, t, a) {
|
|
1869
1872
|
const i = e.referenceType, o = t.enter("imageReference");
|
|
1870
1873
|
let n = t.enter("label");
|
|
1871
1874
|
const u = t.createTracker(a);
|
|
@@ -1885,11 +1888,11 @@ function nr(e, r, t, a) {
|
|
|
1885
1888
|
});
|
|
1886
1889
|
return n(), t.stack = f, o(), i === "full" || !s || s !== l ? c += u.move(l + "]") : i === "shortcut" ? c = c.slice(0, -1) : c += u.move("]"), c;
|
|
1887
1890
|
}
|
|
1888
|
-
function
|
|
1891
|
+
function Un() {
|
|
1889
1892
|
return "!";
|
|
1890
1893
|
}
|
|
1891
|
-
|
|
1892
|
-
function
|
|
1894
|
+
or.peek = Bn;
|
|
1895
|
+
function or(e, r, t) {
|
|
1893
1896
|
let a = e.value || "", i = "`", o = -1;
|
|
1894
1897
|
for (; new RegExp("(^|[^`])" + i + "([^`]|$)").test(a); )
|
|
1895
1898
|
i += "`";
|
|
@@ -1904,11 +1907,11 @@ function ir(e, r, t) {
|
|
|
1904
1907
|
}
|
|
1905
1908
|
return i + a + i;
|
|
1906
1909
|
}
|
|
1907
|
-
function
|
|
1910
|
+
function Bn() {
|
|
1908
1911
|
return "`";
|
|
1909
1912
|
}
|
|
1910
|
-
function
|
|
1911
|
-
const t =
|
|
1913
|
+
function cr(e, r) {
|
|
1914
|
+
const t = tr(e);
|
|
1912
1915
|
return !!(!r.options.resourceLink && // If there’s a url…
|
|
1913
1916
|
e.url && // And there’s a no title…
|
|
1914
1917
|
!e.title && // And the content of `node` is a single text node…
|
|
@@ -1918,11 +1921,11 @@ function or(e, r) {
|
|
|
1918
1921
|
// references don’t work), space, or angle brackets…
|
|
1919
1922
|
!/[\0- <>\u007F]/.test(e.url));
|
|
1920
1923
|
}
|
|
1921
|
-
|
|
1922
|
-
function
|
|
1923
|
-
const i =
|
|
1924
|
+
ur.peek = Wn;
|
|
1925
|
+
function ur(e, r, t, a) {
|
|
1926
|
+
const i = ot(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.createTracker(a);
|
|
1924
1927
|
let u, c;
|
|
1925
|
-
if (
|
|
1928
|
+
if (cr(e, t)) {
|
|
1926
1929
|
const f = t.stack;
|
|
1927
1930
|
t.stack = [], u = t.enter("autolink");
|
|
1928
1931
|
let l = n.move("<");
|
|
@@ -1960,11 +1963,11 @@ function cr(e, r, t, a) {
|
|
|
1960
1963
|
})
|
|
1961
1964
|
), s += n.move(i), c()), s += n.move(")"), u(), s;
|
|
1962
1965
|
}
|
|
1963
|
-
function
|
|
1964
|
-
return
|
|
1966
|
+
function Wn(e, r, t) {
|
|
1967
|
+
return cr(e, t) ? "<" : "[";
|
|
1965
1968
|
}
|
|
1966
|
-
|
|
1967
|
-
function
|
|
1969
|
+
sr.peek = Hn;
|
|
1970
|
+
function sr(e, r, t, a) {
|
|
1968
1971
|
const i = e.referenceType, o = t.enter("linkReference");
|
|
1969
1972
|
let n = t.enter("label");
|
|
1970
1973
|
const u = t.createTracker(a);
|
|
@@ -1987,7 +1990,7 @@ function ur(e, r, t, a) {
|
|
|
1987
1990
|
function Hn() {
|
|
1988
1991
|
return "[";
|
|
1989
1992
|
}
|
|
1990
|
-
function
|
|
1993
|
+
function ct(e) {
|
|
1991
1994
|
const r = e.options.bullet || "*";
|
|
1992
1995
|
if (r !== "*" && r !== "+" && r !== "-")
|
|
1993
1996
|
throw new Error(
|
|
@@ -1995,8 +1998,8 @@ function it(e) {
|
|
|
1995
1998
|
);
|
|
1996
1999
|
return r;
|
|
1997
2000
|
}
|
|
1998
|
-
function
|
|
1999
|
-
const r =
|
|
2001
|
+
function qn(e) {
|
|
2002
|
+
const r = ct(e), t = e.options.bulletOther;
|
|
2000
2003
|
if (!t)
|
|
2001
2004
|
return r === "*" ? "-" : "*";
|
|
2002
2005
|
if (t !== "*" && t !== "+" && t !== "-")
|
|
@@ -2009,7 +2012,7 @@ function Vn(e) {
|
|
|
2009
2012
|
);
|
|
2010
2013
|
return t;
|
|
2011
2014
|
}
|
|
2012
|
-
function
|
|
2015
|
+
function Vn(e) {
|
|
2013
2016
|
const r = e.options.bulletOrdered || ".";
|
|
2014
2017
|
if (r !== "." && r !== ")")
|
|
2015
2018
|
throw new Error(
|
|
@@ -2017,7 +2020,7 @@ function Xn(e) {
|
|
|
2017
2020
|
);
|
|
2018
2021
|
return r;
|
|
2019
2022
|
}
|
|
2020
|
-
function
|
|
2023
|
+
function lr(e) {
|
|
2021
2024
|
const r = e.options.rule || "*";
|
|
2022
2025
|
if (r !== "*" && r !== "-" && r !== "_")
|
|
2023
2026
|
throw new Error(
|
|
@@ -2025,10 +2028,10 @@ function sr(e) {
|
|
|
2025
2028
|
);
|
|
2026
2029
|
return r;
|
|
2027
2030
|
}
|
|
2028
|
-
function
|
|
2031
|
+
function Xn(e, r, t, a) {
|
|
2029
2032
|
const i = t.enter("list"), o = t.bulletCurrent;
|
|
2030
|
-
let n = e.ordered ?
|
|
2031
|
-
const u = e.ordered ? n === "." ? ")" : "." :
|
|
2033
|
+
let n = e.ordered ? Vn(t) : ct(t);
|
|
2034
|
+
const u = e.ordered ? n === "." ? ")" : "." : qn(t);
|
|
2032
2035
|
let c = r && t.bulletLastUsed ? n === t.bulletLastUsed : !1;
|
|
2033
2036
|
if (!e.ordered) {
|
|
2034
2037
|
const f = e.children ? e.children[0] : void 0;
|
|
@@ -2037,7 +2040,7 @@ function Kn(e, r, t, a) {
|
|
|
2037
2040
|
(n === "*" || n === "-") && // Empty first list item:
|
|
2038
2041
|
f && (!f.children || !f.children[0]) && // Directly in two other list items:
|
|
2039
2042
|
t.stack[t.stack.length - 1] === "list" && t.stack[t.stack.length - 2] === "listItem" && t.stack[t.stack.length - 3] === "list" && t.stack[t.stack.length - 4] === "listItem" && // That are each the first child.
|
|
2040
|
-
t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (c = !0),
|
|
2043
|
+
t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (c = !0), lr(t) === n && f
|
|
2041
2044
|
) {
|
|
2042
2045
|
let l = -1;
|
|
2043
2046
|
for (; ++l < e.children.length; ) {
|
|
@@ -2053,7 +2056,7 @@ function Kn(e, r, t, a) {
|
|
|
2053
2056
|
const s = t.containerFlow(e, a);
|
|
2054
2057
|
return t.bulletLastUsed = n, t.bulletCurrent = o, i(), s;
|
|
2055
2058
|
}
|
|
2056
|
-
function
|
|
2059
|
+
function Kn(e) {
|
|
2057
2060
|
const r = e.options.listItemIndent || "one";
|
|
2058
2061
|
if (r !== "tab" && r !== "one" && r !== "mixed")
|
|
2059
2062
|
throw new Error(
|
|
@@ -2061,9 +2064,9 @@ function Qn(e) {
|
|
|
2061
2064
|
);
|
|
2062
2065
|
return r;
|
|
2063
2066
|
}
|
|
2064
|
-
function
|
|
2065
|
-
const i =
|
|
2066
|
-
let o = t.bulletCurrent ||
|
|
2067
|
+
function Qn(e, r, t, a) {
|
|
2068
|
+
const i = Kn(t);
|
|
2069
|
+
let o = t.bulletCurrent || ct(t);
|
|
2067
2070
|
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);
|
|
2068
2071
|
let n = o.length + 1;
|
|
2069
2072
|
(i === "tab" || i === "mixed" && (r && r.type === "list" && r.spread || e.spread)) && (n = Math.ceil(n / 4) * 4);
|
|
@@ -2074,17 +2077,17 @@ function Gn(e, r, t, a) {
|
|
|
2074
2077
|
f
|
|
2075
2078
|
);
|
|
2076
2079
|
return c(), s;
|
|
2077
|
-
function f(l, p,
|
|
2078
|
-
return p ? (
|
|
2080
|
+
function f(l, p, g) {
|
|
2081
|
+
return p ? (g ? "" : " ".repeat(n)) + l : (g ? o : o + " ".repeat(n - o.length)) + l;
|
|
2079
2082
|
}
|
|
2080
2083
|
}
|
|
2081
|
-
function
|
|
2084
|
+
function Gn(e, r, t, a) {
|
|
2082
2085
|
const i = t.enter("paragraph"), o = t.enter("phrasing"), n = t.containerPhrasing(e, a);
|
|
2083
2086
|
return o(), i(), n;
|
|
2084
2087
|
}
|
|
2085
|
-
const
|
|
2088
|
+
const Zn = (
|
|
2086
2089
|
/** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
|
|
2087
|
-
|
|
2090
|
+
je([
|
|
2088
2091
|
"break",
|
|
2089
2092
|
"delete",
|
|
2090
2093
|
"emphasis",
|
|
@@ -2108,12 +2111,12 @@ const Jn = (
|
|
|
2108
2111
|
"textDirective"
|
|
2109
2112
|
])
|
|
2110
2113
|
);
|
|
2111
|
-
function
|
|
2114
|
+
function Jn(e, r, t, a) {
|
|
2112
2115
|
return (e.children.some(function(n) {
|
|
2113
|
-
return
|
|
2116
|
+
return Zn(n);
|
|
2114
2117
|
}) ? t.containerPhrasing : t.containerFlow).call(t, e, a);
|
|
2115
2118
|
}
|
|
2116
|
-
function
|
|
2119
|
+
function Yn(e) {
|
|
2117
2120
|
const r = e.options.strong || "*";
|
|
2118
2121
|
if (r !== "*" && r !== "_")
|
|
2119
2122
|
throw new Error(
|
|
@@ -2121,9 +2124,9 @@ function ei(e) {
|
|
|
2121
2124
|
);
|
|
2122
2125
|
return r;
|
|
2123
2126
|
}
|
|
2124
|
-
|
|
2125
|
-
function
|
|
2126
|
-
const i =
|
|
2127
|
+
dr.peek = ei;
|
|
2128
|
+
function dr(e, r, t, a) {
|
|
2129
|
+
const i = Yn(t), o = t.enter("strong"), n = t.createTracker(a), u = n.move(i + i);
|
|
2127
2130
|
let c = n.move(
|
|
2128
2131
|
t.containerPhrasing(e, {
|
|
2129
2132
|
after: i,
|
|
@@ -2131,27 +2134,27 @@ function lr(e, r, t, a) {
|
|
|
2131
2134
|
...n.current()
|
|
2132
2135
|
})
|
|
2133
2136
|
);
|
|
2134
|
-
const s = c.charCodeAt(0), f =
|
|
2137
|
+
const s = c.charCodeAt(0), f = Ee(
|
|
2135
2138
|
a.before.charCodeAt(a.before.length - 1),
|
|
2136
2139
|
s,
|
|
2137
2140
|
i
|
|
2138
2141
|
);
|
|
2139
|
-
f.inside && (c =
|
|
2140
|
-
const l = c.charCodeAt(c.length - 1), p =
|
|
2141
|
-
p.inside && (c = c.slice(0, -1) +
|
|
2142
|
-
const
|
|
2142
|
+
f.inside && (c = we(s) + c.slice(1));
|
|
2143
|
+
const l = c.charCodeAt(c.length - 1), p = Ee(a.after.charCodeAt(0), l, i);
|
|
2144
|
+
p.inside && (c = c.slice(0, -1) + we(l));
|
|
2145
|
+
const g = n.move(i + i);
|
|
2143
2146
|
return o(), t.attentionEncodeSurroundingInfo = {
|
|
2144
2147
|
after: p.outside,
|
|
2145
2148
|
before: f.outside
|
|
2146
|
-
}, u + c +
|
|
2149
|
+
}, u + c + g;
|
|
2147
2150
|
}
|
|
2148
|
-
function
|
|
2151
|
+
function ei(e, r, t) {
|
|
2149
2152
|
return t.options.strong || "*";
|
|
2150
2153
|
}
|
|
2151
|
-
function
|
|
2154
|
+
function ti(e, r, t, a) {
|
|
2152
2155
|
return t.safe(e.value, a);
|
|
2153
2156
|
}
|
|
2154
|
-
function
|
|
2157
|
+
function ri(e) {
|
|
2155
2158
|
const r = e.options.ruleRepetition || 3;
|
|
2156
2159
|
if (r < 3)
|
|
2157
2160
|
throw new Error(
|
|
@@ -2159,50 +2162,50 @@ function ai(e) {
|
|
|
2159
2162
|
);
|
|
2160
2163
|
return r;
|
|
2161
2164
|
}
|
|
2162
|
-
function
|
|
2163
|
-
const a = (
|
|
2165
|
+
function ai(e, r, t) {
|
|
2166
|
+
const a = (lr(t) + (t.options.ruleSpaces ? " " : "")).repeat(ri(t));
|
|
2164
2167
|
return t.options.ruleSpaces ? a.slice(0, -1) : a;
|
|
2165
2168
|
}
|
|
2166
|
-
const
|
|
2167
|
-
blockquote:
|
|
2168
|
-
break:
|
|
2169
|
-
code:
|
|
2170
|
-
definition:
|
|
2171
|
-
emphasis:
|
|
2172
|
-
hardBreak:
|
|
2173
|
-
heading:
|
|
2174
|
-
html:
|
|
2175
|
-
image:
|
|
2176
|
-
imageReference:
|
|
2177
|
-
inlineCode:
|
|
2178
|
-
link:
|
|
2179
|
-
linkReference:
|
|
2180
|
-
list:
|
|
2181
|
-
listItem:
|
|
2182
|
-
paragraph:
|
|
2183
|
-
root:
|
|
2184
|
-
strong:
|
|
2185
|
-
text:
|
|
2186
|
-
thematicBreak:
|
|
2169
|
+
const fr = {
|
|
2170
|
+
blockquote: Cn,
|
|
2171
|
+
break: It,
|
|
2172
|
+
code: Sn,
|
|
2173
|
+
definition: Pn,
|
|
2174
|
+
emphasis: er,
|
|
2175
|
+
hardBreak: It,
|
|
2176
|
+
heading: jn,
|
|
2177
|
+
html: ar,
|
|
2178
|
+
image: nr,
|
|
2179
|
+
imageReference: ir,
|
|
2180
|
+
inlineCode: or,
|
|
2181
|
+
link: ur,
|
|
2182
|
+
linkReference: sr,
|
|
2183
|
+
list: Xn,
|
|
2184
|
+
listItem: Qn,
|
|
2185
|
+
paragraph: Gn,
|
|
2186
|
+
root: Jn,
|
|
2187
|
+
strong: dr,
|
|
2188
|
+
text: ti,
|
|
2189
|
+
thematicBreak: ai
|
|
2187
2190
|
};
|
|
2188
|
-
function
|
|
2191
|
+
function ni() {
|
|
2189
2192
|
return {
|
|
2190
2193
|
enter: {
|
|
2191
|
-
table:
|
|
2192
|
-
tableData:
|
|
2193
|
-
tableHeader:
|
|
2194
|
-
tableRow:
|
|
2194
|
+
table: ii,
|
|
2195
|
+
tableData: Lt,
|
|
2196
|
+
tableHeader: Lt,
|
|
2197
|
+
tableRow: ci
|
|
2195
2198
|
},
|
|
2196
2199
|
exit: {
|
|
2197
|
-
codeText:
|
|
2198
|
-
table:
|
|
2199
|
-
tableData:
|
|
2200
|
-
tableHeader:
|
|
2201
|
-
tableRow:
|
|
2200
|
+
codeText: ui,
|
|
2201
|
+
table: oi,
|
|
2202
|
+
tableData: Qe,
|
|
2203
|
+
tableHeader: Qe,
|
|
2204
|
+
tableRow: Qe
|
|
2202
2205
|
}
|
|
2203
2206
|
};
|
|
2204
2207
|
}
|
|
2205
|
-
function
|
|
2208
|
+
function ii(e) {
|
|
2206
2209
|
const r = e._align;
|
|
2207
2210
|
this.enter(
|
|
2208
2211
|
{
|
|
@@ -2215,28 +2218,28 @@ function oi(e) {
|
|
|
2215
2218
|
e
|
|
2216
2219
|
), this.data.inTable = !0;
|
|
2217
2220
|
}
|
|
2218
|
-
function
|
|
2221
|
+
function oi(e) {
|
|
2219
2222
|
this.exit(e), this.data.inTable = void 0;
|
|
2220
2223
|
}
|
|
2221
|
-
function
|
|
2224
|
+
function ci(e) {
|
|
2222
2225
|
this.enter({ type: "tableRow", children: [] }, e);
|
|
2223
2226
|
}
|
|
2224
|
-
function
|
|
2227
|
+
function Qe(e) {
|
|
2225
2228
|
this.exit(e);
|
|
2226
2229
|
}
|
|
2227
|
-
function
|
|
2230
|
+
function Lt(e) {
|
|
2228
2231
|
this.enter({ type: "tableCell", children: [] }, e);
|
|
2229
2232
|
}
|
|
2230
|
-
function
|
|
2233
|
+
function ui(e) {
|
|
2231
2234
|
let r = this.resume();
|
|
2232
|
-
this.data.inTable && (r = r.replace(/\\([\\|])/g,
|
|
2235
|
+
this.data.inTable && (r = r.replace(/\\([\\|])/g, si));
|
|
2233
2236
|
const t = this.stack[this.stack.length - 1];
|
|
2234
2237
|
t.type, t.value = r, this.exit(e);
|
|
2235
2238
|
}
|
|
2236
|
-
function
|
|
2239
|
+
function si(e, r) {
|
|
2237
2240
|
return r === "|" ? r : e;
|
|
2238
2241
|
}
|
|
2239
|
-
function
|
|
2242
|
+
function li(e) {
|
|
2240
2243
|
const r = e || {}, t = r.tableCellPadding, a = r.tablePipeAlign, i = r.stringLength, o = t ? " " : "|";
|
|
2241
2244
|
return {
|
|
2242
2245
|
unsafe: [
|
|
@@ -2265,24 +2268,24 @@ function di(e) {
|
|
|
2265
2268
|
tableRow: u
|
|
2266
2269
|
}
|
|
2267
2270
|
};
|
|
2268
|
-
function n(
|
|
2269
|
-
return s(f(
|
|
2271
|
+
function n(g, m, x, b) {
|
|
2272
|
+
return s(f(g, x, b), g.align);
|
|
2270
2273
|
}
|
|
2271
|
-
function u(
|
|
2272
|
-
const
|
|
2274
|
+
function u(g, m, x, b) {
|
|
2275
|
+
const y = l(g, x, b), k = s([y]);
|
|
2273
2276
|
return k.slice(0, k.indexOf(`
|
|
2274
2277
|
`));
|
|
2275
2278
|
}
|
|
2276
|
-
function c(
|
|
2277
|
-
const
|
|
2278
|
-
...
|
|
2279
|
+
function c(g, m, x, b) {
|
|
2280
|
+
const y = x.enter("tableCell"), k = x.enter("phrasing"), T = x.containerPhrasing(g, {
|
|
2281
|
+
...b,
|
|
2279
2282
|
before: o,
|
|
2280
2283
|
after: o
|
|
2281
2284
|
});
|
|
2282
|
-
return k(),
|
|
2285
|
+
return k(), y(), T;
|
|
2283
2286
|
}
|
|
2284
|
-
function s(
|
|
2285
|
-
return
|
|
2287
|
+
function s(g, m) {
|
|
2288
|
+
return wn(g, {
|
|
2286
2289
|
align: m,
|
|
2287
2290
|
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
2288
2291
|
alignDelimiters: a,
|
|
@@ -2292,47 +2295,47 @@ function di(e) {
|
|
|
2292
2295
|
stringLength: i
|
|
2293
2296
|
});
|
|
2294
2297
|
}
|
|
2295
|
-
function f(
|
|
2296
|
-
const
|
|
2297
|
-
let
|
|
2298
|
-
const k = [],
|
|
2299
|
-
for (; ++
|
|
2300
|
-
k[
|
|
2301
|
-
return
|
|
2298
|
+
function f(g, m, x) {
|
|
2299
|
+
const b = g.children;
|
|
2300
|
+
let y = -1;
|
|
2301
|
+
const k = [], T = m.enter("table");
|
|
2302
|
+
for (; ++y < b.length; )
|
|
2303
|
+
k[y] = l(b[y], m, x);
|
|
2304
|
+
return T(), k;
|
|
2302
2305
|
}
|
|
2303
|
-
function l(
|
|
2304
|
-
const
|
|
2305
|
-
let
|
|
2306
|
-
const k = [],
|
|
2307
|
-
for (; ++
|
|
2308
|
-
k[
|
|
2309
|
-
return
|
|
2306
|
+
function l(g, m, x) {
|
|
2307
|
+
const b = g.children;
|
|
2308
|
+
let y = -1;
|
|
2309
|
+
const k = [], T = m.enter("tableRow");
|
|
2310
|
+
for (; ++y < b.length; )
|
|
2311
|
+
k[y] = c(b[y], g, m, x);
|
|
2312
|
+
return T(), k;
|
|
2310
2313
|
}
|
|
2311
|
-
function p(
|
|
2312
|
-
let
|
|
2313
|
-
return x.stack.includes("tableCell") && (
|
|
2314
|
+
function p(g, m, x) {
|
|
2315
|
+
let b = fr.inlineCode(g, m, x);
|
|
2316
|
+
return x.stack.includes("tableCell") && (b = b.replace(/\|/g, "\\$&")), b;
|
|
2314
2317
|
}
|
|
2315
2318
|
}
|
|
2316
|
-
function
|
|
2319
|
+
function di() {
|
|
2317
2320
|
return {
|
|
2318
2321
|
exit: {
|
|
2319
|
-
taskListCheckValueChecked:
|
|
2320
|
-
taskListCheckValueUnchecked:
|
|
2321
|
-
paragraph:
|
|
2322
|
+
taskListCheckValueChecked: Pt,
|
|
2323
|
+
taskListCheckValueUnchecked: Pt,
|
|
2324
|
+
paragraph: hi
|
|
2322
2325
|
}
|
|
2323
2326
|
};
|
|
2324
2327
|
}
|
|
2325
|
-
function
|
|
2328
|
+
function fi() {
|
|
2326
2329
|
return {
|
|
2327
2330
|
unsafe: [{ atBreak: !0, character: "-", after: "[:|-]" }],
|
|
2328
|
-
handlers: { listItem:
|
|
2331
|
+
handlers: { listItem: mi }
|
|
2329
2332
|
};
|
|
2330
2333
|
}
|
|
2331
|
-
function
|
|
2334
|
+
function Pt(e) {
|
|
2332
2335
|
const r = this.stack[this.stack.length - 2];
|
|
2333
2336
|
r.type, r.checked = e.type === "taskListCheckValueChecked";
|
|
2334
2337
|
}
|
|
2335
|
-
function
|
|
2338
|
+
function hi(e) {
|
|
2336
2339
|
const r = this.stack[this.stack.length - 2];
|
|
2337
2340
|
if (r && r.type === "listItem" && typeof r.checked == "boolean") {
|
|
2338
2341
|
const t = this.stack[this.stack.length - 1];
|
|
@@ -2353,10 +2356,10 @@ function mi(e) {
|
|
|
2353
2356
|
}
|
|
2354
2357
|
this.exit(e);
|
|
2355
2358
|
}
|
|
2356
|
-
function
|
|
2359
|
+
function mi(e, r, t, a) {
|
|
2357
2360
|
const i = e.children[0], o = typeof e.checked == "boolean" && i && i.type === "paragraph", n = "[" + (e.checked ? "x" : " ") + "] ", u = t.createTracker(a);
|
|
2358
2361
|
o && u.move(n);
|
|
2359
|
-
let c =
|
|
2362
|
+
let c = fr.listItem(e, r, t, {
|
|
2360
2363
|
...a,
|
|
2361
2364
|
...u.current()
|
|
2362
2365
|
});
|
|
@@ -2365,27 +2368,27 @@ function pi(e, r, t, a) {
|
|
|
2365
2368
|
return f + n;
|
|
2366
2369
|
}
|
|
2367
2370
|
}
|
|
2368
|
-
function
|
|
2371
|
+
function pi() {
|
|
2369
2372
|
return [
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2373
|
+
Wa(),
|
|
2374
|
+
dn(),
|
|
2375
|
+
pn(),
|
|
2376
|
+
ni(),
|
|
2377
|
+
di()
|
|
2375
2378
|
];
|
|
2376
2379
|
}
|
|
2377
|
-
function
|
|
2380
|
+
function gi(e) {
|
|
2378
2381
|
return {
|
|
2379
2382
|
extensions: [
|
|
2380
2383
|
Ha(),
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2384
|
+
fn(e),
|
|
2385
|
+
gn(),
|
|
2386
|
+
li(e),
|
|
2387
|
+
fi()
|
|
2385
2388
|
]
|
|
2386
2389
|
};
|
|
2387
2390
|
}
|
|
2388
|
-
function
|
|
2391
|
+
function Re(e, r, t, a) {
|
|
2389
2392
|
const i = e.length;
|
|
2390
2393
|
let o = 0, n;
|
|
2391
2394
|
if (r < 0 ? r = -r > i ? 0 : i + r : r = r > i ? i : r, t = t > 0 ? t : 0, a.length < 1e4)
|
|
@@ -2394,24 +2397,24 @@ function Le(e, r, t, a) {
|
|
|
2394
2397
|
for (t && e.splice(r, t); o < a.length; )
|
|
2395
2398
|
n = a.slice(o, o + 1e4), n.unshift(r, 0), e.splice(...n), o += 1e4, r += 1e4;
|
|
2396
2399
|
}
|
|
2397
|
-
const
|
|
2398
|
-
function
|
|
2400
|
+
const Rt = {}.hasOwnProperty;
|
|
2401
|
+
function bi(e) {
|
|
2399
2402
|
const r = {};
|
|
2400
2403
|
let t = -1;
|
|
2401
2404
|
for (; ++t < e.length; )
|
|
2402
|
-
|
|
2405
|
+
yi(r, e[t]);
|
|
2403
2406
|
return r;
|
|
2404
2407
|
}
|
|
2405
|
-
function
|
|
2408
|
+
function yi(e, r) {
|
|
2406
2409
|
let t;
|
|
2407
2410
|
for (t in r) {
|
|
2408
|
-
const i = (
|
|
2411
|
+
const i = (Rt.call(e, t) ? e[t] : void 0) || (e[t] = {}), o = r[t];
|
|
2409
2412
|
let n;
|
|
2410
2413
|
if (o)
|
|
2411
2414
|
for (n in o) {
|
|
2412
|
-
|
|
2415
|
+
Rt.call(i, n) || (i[n] = []);
|
|
2413
2416
|
const u = o[n];
|
|
2414
|
-
|
|
2417
|
+
xi(
|
|
2415
2418
|
// @ts-expect-error Looks like a list.
|
|
2416
2419
|
i[n],
|
|
2417
2420
|
Array.isArray(u) ? u : u ? [u] : []
|
|
@@ -2419,96 +2422,96 @@ function xi(e, r) {
|
|
|
2419
2422
|
}
|
|
2420
2423
|
}
|
|
2421
2424
|
}
|
|
2422
|
-
function
|
|
2425
|
+
function xi(e, r) {
|
|
2423
2426
|
let t = -1;
|
|
2424
2427
|
const a = [];
|
|
2425
2428
|
for (; ++t < r.length; )
|
|
2426
2429
|
(r[t].add === "after" ? e : a).push(r[t]);
|
|
2427
|
-
|
|
2430
|
+
Re(e, 0, 0, a);
|
|
2428
2431
|
}
|
|
2429
|
-
const
|
|
2432
|
+
const ki = {
|
|
2433
|
+
tokenize: Ai,
|
|
2434
|
+
partial: !0
|
|
2435
|
+
}, hr = {
|
|
2430
2436
|
tokenize: Ni,
|
|
2431
2437
|
partial: !0
|
|
2432
|
-
},
|
|
2438
|
+
}, mr = {
|
|
2433
2439
|
tokenize: Ii,
|
|
2434
2440
|
partial: !0
|
|
2435
|
-
},
|
|
2441
|
+
}, pr = {
|
|
2436
2442
|
tokenize: Si,
|
|
2437
2443
|
partial: !0
|
|
2438
|
-
},
|
|
2444
|
+
}, wi = {
|
|
2439
2445
|
tokenize: Li,
|
|
2440
2446
|
partial: !0
|
|
2441
|
-
},
|
|
2442
|
-
tokenize: Pi,
|
|
2443
|
-
partial: !0
|
|
2444
|
-
}, pr = {
|
|
2447
|
+
}, gr = {
|
|
2445
2448
|
name: "wwwAutolink",
|
|
2446
2449
|
tokenize: Ti,
|
|
2447
|
-
previous: br
|
|
2448
|
-
}, gr = {
|
|
2449
|
-
name: "protocolAutolink",
|
|
2450
|
-
tokenize: Ai,
|
|
2451
2450
|
previous: yr
|
|
2452
|
-
},
|
|
2453
|
-
name: "
|
|
2451
|
+
}, br = {
|
|
2452
|
+
name: "protocolAutolink",
|
|
2454
2453
|
tokenize: Mi,
|
|
2455
2454
|
previous: xr
|
|
2456
|
-
},
|
|
2457
|
-
|
|
2455
|
+
}, Y = {
|
|
2456
|
+
name: "emailAutolink",
|
|
2457
|
+
tokenize: Ci,
|
|
2458
|
+
previous: kr
|
|
2459
|
+
}, K = {};
|
|
2460
|
+
function vi() {
|
|
2458
2461
|
return {
|
|
2459
|
-
text:
|
|
2462
|
+
text: K
|
|
2460
2463
|
};
|
|
2461
2464
|
}
|
|
2462
2465
|
let ne = 48;
|
|
2463
2466
|
for (; ne < 123; )
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
function
|
|
2467
|
+
K[ne] = Y, ne++, ne === 58 ? ne = 65 : ne === 91 && (ne = 97);
|
|
2468
|
+
K[43] = Y;
|
|
2469
|
+
K[45] = Y;
|
|
2470
|
+
K[46] = Y;
|
|
2471
|
+
K[95] = Y;
|
|
2472
|
+
K[72] = [Y, br];
|
|
2473
|
+
K[104] = [Y, br];
|
|
2474
|
+
K[87] = [Y, gr];
|
|
2475
|
+
K[119] = [Y, gr];
|
|
2476
|
+
function Ci(e, r, t) {
|
|
2474
2477
|
const a = this;
|
|
2475
2478
|
let i, o;
|
|
2476
2479
|
return n;
|
|
2477
2480
|
function n(l) {
|
|
2478
|
-
return !
|
|
2481
|
+
return !rt(l) || !kr.call(a, a.previous) || ut(a.events) ? t(l) : (e.enter("literalAutolink"), e.enter("literalAutolinkEmail"), u(l));
|
|
2479
2482
|
}
|
|
2480
2483
|
function u(l) {
|
|
2481
|
-
return
|
|
2484
|
+
return rt(l) ? (e.consume(l), u) : l === 64 ? (e.consume(l), c) : t(l);
|
|
2482
2485
|
}
|
|
2483
2486
|
function c(l) {
|
|
2484
|
-
return l === 46 ? e.check(
|
|
2487
|
+
return l === 46 ? e.check(wi, f, s)(l) : l === 45 || l === 95 || it(l) ? (o = !0, e.consume(l), c) : f(l);
|
|
2485
2488
|
}
|
|
2486
2489
|
function s(l) {
|
|
2487
2490
|
return e.consume(l), i = !0, c;
|
|
2488
2491
|
}
|
|
2489
2492
|
function f(l) {
|
|
2490
|
-
return o && i &&
|
|
2493
|
+
return o && i && ke(a.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(l)) : t(l);
|
|
2491
2494
|
}
|
|
2492
2495
|
}
|
|
2493
2496
|
function Ti(e, r, t) {
|
|
2494
2497
|
const a = this;
|
|
2495
2498
|
return i;
|
|
2496
2499
|
function i(n) {
|
|
2497
|
-
return n !== 87 && n !== 119 || !
|
|
2500
|
+
return n !== 87 && n !== 119 || !yr.call(a, a.previous) || ut(a.events) ? t(n) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(ki, e.attempt(hr, e.attempt(mr, o), t), t)(n));
|
|
2498
2501
|
}
|
|
2499
2502
|
function o(n) {
|
|
2500
2503
|
return e.exit("literalAutolinkWww"), e.exit("literalAutolink"), r(n);
|
|
2501
2504
|
}
|
|
2502
2505
|
}
|
|
2503
|
-
function
|
|
2506
|
+
function Mi(e, r, t) {
|
|
2504
2507
|
const a = this;
|
|
2505
2508
|
let i = "", o = !1;
|
|
2506
2509
|
return n;
|
|
2507
2510
|
function n(l) {
|
|
2508
|
-
return (l === 72 || l === 104) &&
|
|
2511
|
+
return (l === 72 || l === 104) && xr.call(a, a.previous) && !ut(a.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), i += String.fromCodePoint(l), e.consume(l), u) : t(l);
|
|
2509
2512
|
}
|
|
2510
2513
|
function u(l) {
|
|
2511
|
-
if (
|
|
2514
|
+
if (ke(l) && i.length < 5)
|
|
2512
2515
|
return i += String.fromCodePoint(l), e.consume(l), u;
|
|
2513
2516
|
if (l === 58) {
|
|
2514
2517
|
const p = i.toLowerCase();
|
|
@@ -2521,13 +2524,13 @@ function Ai(e, r, t) {
|
|
|
2521
2524
|
return l === 47 ? (e.consume(l), o ? s : (o = !0, c)) : t(l);
|
|
2522
2525
|
}
|
|
2523
2526
|
function s(l) {
|
|
2524
|
-
return l === null ||
|
|
2527
|
+
return l === null || Sa(l) || B(l) || oe(l) || Fe(l) ? t(l) : e.attempt(hr, e.attempt(mr, f), t)(l);
|
|
2525
2528
|
}
|
|
2526
2529
|
function f(l) {
|
|
2527
2530
|
return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(l);
|
|
2528
2531
|
}
|
|
2529
2532
|
}
|
|
2530
|
-
function
|
|
2533
|
+
function Ai(e, r, t) {
|
|
2531
2534
|
let a = 0;
|
|
2532
2535
|
return i;
|
|
2533
2536
|
function i(n) {
|
|
@@ -2537,11 +2540,11 @@ function Ni(e, r, t) {
|
|
|
2537
2540
|
return n === null ? t(n) : r(n);
|
|
2538
2541
|
}
|
|
2539
2542
|
}
|
|
2540
|
-
function
|
|
2543
|
+
function Ni(e, r, t) {
|
|
2541
2544
|
let a, i, o;
|
|
2542
2545
|
return n;
|
|
2543
2546
|
function n(s) {
|
|
2544
|
-
return s === 46 || s === 95 ? e.check(
|
|
2547
|
+
return s === 46 || s === 95 ? e.check(pr, c, u)(s) : s === null || B(s) || oe(s) || s !== 45 && Fe(s) ? c(s) : (o = !0, e.consume(s), n);
|
|
2545
2548
|
}
|
|
2546
2549
|
function u(s) {
|
|
2547
2550
|
return s === 95 ? a = !0 : (i = a, a = void 0), e.consume(s), n;
|
|
@@ -2550,17 +2553,17 @@ function Ii(e, r, t) {
|
|
|
2550
2553
|
return i || a || !o ? t(s) : r(s);
|
|
2551
2554
|
}
|
|
2552
2555
|
}
|
|
2553
|
-
function
|
|
2556
|
+
function Ii(e, r) {
|
|
2554
2557
|
let t = 0, a = 0;
|
|
2555
2558
|
return i;
|
|
2556
2559
|
function i(n) {
|
|
2557
|
-
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(
|
|
2560
|
+
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(pr, r, o)(n) : n === null || B(n) || oe(n) ? r(n) : (e.consume(n), i);
|
|
2558
2561
|
}
|
|
2559
2562
|
function o(n) {
|
|
2560
2563
|
return n === 41 && a++, e.consume(n), i;
|
|
2561
2564
|
}
|
|
2562
2565
|
}
|
|
2563
|
-
function
|
|
2566
|
+
function Si(e, r, t) {
|
|
2564
2567
|
return a;
|
|
2565
2568
|
function a(u) {
|
|
2566
2569
|
return u === 33 || u === 34 || u === 39 || u === 41 || u === 42 || u === 44 || u === 46 || u === 58 || u === 59 || u === 63 || u === 95 || u === 126 ? (e.consume(u), a) : u === 38 ? (e.consume(u), o) : u === 93 ? (e.consume(u), i) : (
|
|
@@ -2573,34 +2576,34 @@ function Li(e, r, t) {
|
|
|
2573
2576
|
return u === null || u === 40 || u === 91 || B(u) || oe(u) ? r(u) : a(u);
|
|
2574
2577
|
}
|
|
2575
2578
|
function o(u) {
|
|
2576
|
-
return
|
|
2579
|
+
return ke(u) ? n(u) : t(u);
|
|
2577
2580
|
}
|
|
2578
2581
|
function n(u) {
|
|
2579
|
-
return u === 59 ? (e.consume(u), a) :
|
|
2582
|
+
return u === 59 ? (e.consume(u), a) : ke(u) ? (e.consume(u), n) : t(u);
|
|
2580
2583
|
}
|
|
2581
2584
|
}
|
|
2582
|
-
function
|
|
2585
|
+
function Li(e, r, t) {
|
|
2583
2586
|
return a;
|
|
2584
2587
|
function a(o) {
|
|
2585
2588
|
return e.consume(o), i;
|
|
2586
2589
|
}
|
|
2587
2590
|
function i(o) {
|
|
2588
|
-
return
|
|
2591
|
+
return it(o) ? t(o) : r(o);
|
|
2589
2592
|
}
|
|
2590
2593
|
}
|
|
2591
|
-
function br(e) {
|
|
2592
|
-
return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || B(e);
|
|
2593
|
-
}
|
|
2594
2594
|
function yr(e) {
|
|
2595
|
-
return
|
|
2595
|
+
return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || B(e);
|
|
2596
2596
|
}
|
|
2597
2597
|
function xr(e) {
|
|
2598
|
-
return !(e
|
|
2598
|
+
return !ke(e);
|
|
2599
2599
|
}
|
|
2600
|
-
function
|
|
2601
|
-
return e ===
|
|
2600
|
+
function kr(e) {
|
|
2601
|
+
return !(e === 47 || rt(e));
|
|
2602
2602
|
}
|
|
2603
|
-
function
|
|
2603
|
+
function rt(e) {
|
|
2604
|
+
return e === 43 || e === 45 || e === 46 || e === 95 || it(e);
|
|
2605
|
+
}
|
|
2606
|
+
function ut(e) {
|
|
2604
2607
|
let r = e.length, t = !1;
|
|
2605
2608
|
for (; r--; ) {
|
|
2606
2609
|
const a = e[r][1];
|
|
@@ -2615,7 +2618,7 @@ function ot(e) {
|
|
|
2615
2618
|
}
|
|
2616
2619
|
return e.length > 0 && !t && (e[e.length - 1][1]._gfmAutolinkLiteralWalkedInto = !0), t;
|
|
2617
2620
|
}
|
|
2618
|
-
function
|
|
2621
|
+
function Pi(e, r, t) {
|
|
2619
2622
|
const a = [];
|
|
2620
2623
|
let i = -1;
|
|
2621
2624
|
for (; ++i < e.length; ) {
|
|
@@ -2635,7 +2638,7 @@ function Z(e, r, t, a) {
|
|
|
2635
2638
|
return G(c) && o++ < i ? (e.consume(c), u) : (e.exit(t), r(c));
|
|
2636
2639
|
}
|
|
2637
2640
|
}
|
|
2638
|
-
const
|
|
2641
|
+
const Ri = {
|
|
2639
2642
|
partial: !0,
|
|
2640
2643
|
tokenize: Di
|
|
2641
2644
|
};
|
|
@@ -2648,37 +2651,37 @@ function Di(e, r, t) {
|
|
|
2648
2651
|
return o === null || fe(o) ? r(o) : t(o);
|
|
2649
2652
|
}
|
|
2650
2653
|
}
|
|
2651
|
-
const
|
|
2652
|
-
tokenize:
|
|
2654
|
+
const _i = {
|
|
2655
|
+
tokenize: Bi,
|
|
2653
2656
|
partial: !0
|
|
2654
2657
|
};
|
|
2655
|
-
function
|
|
2658
|
+
function Ei() {
|
|
2656
2659
|
return {
|
|
2657
2660
|
document: {
|
|
2658
2661
|
91: {
|
|
2659
2662
|
name: "gfmFootnoteDefinition",
|
|
2660
|
-
tokenize:
|
|
2663
|
+
tokenize: $i,
|
|
2661
2664
|
continuation: {
|
|
2662
|
-
tokenize:
|
|
2665
|
+
tokenize: Oi
|
|
2663
2666
|
},
|
|
2664
|
-
exit:
|
|
2667
|
+
exit: Ui
|
|
2665
2668
|
}
|
|
2666
2669
|
},
|
|
2667
2670
|
text: {
|
|
2668
2671
|
91: {
|
|
2669
2672
|
name: "gfmFootnoteCall",
|
|
2670
|
-
tokenize:
|
|
2673
|
+
tokenize: ji
|
|
2671
2674
|
},
|
|
2672
2675
|
93: {
|
|
2673
2676
|
name: "gfmPotentialFootnoteCall",
|
|
2674
2677
|
add: "after",
|
|
2675
|
-
tokenize:
|
|
2676
|
-
resolveTo:
|
|
2678
|
+
tokenize: Fi,
|
|
2679
|
+
resolveTo: zi
|
|
2677
2680
|
}
|
|
2678
2681
|
}
|
|
2679
2682
|
};
|
|
2680
2683
|
}
|
|
2681
|
-
function
|
|
2684
|
+
function Fi(e, r, t) {
|
|
2682
2685
|
const a = this;
|
|
2683
2686
|
let i = a.events.length;
|
|
2684
2687
|
const o = a.parser.gfmFootnotes || (a.parser.gfmFootnotes = []);
|
|
@@ -2696,14 +2699,14 @@ function zi(e, r, t) {
|
|
|
2696
2699
|
function u(c) {
|
|
2697
2700
|
if (!n || !n._balanced)
|
|
2698
2701
|
return t(c);
|
|
2699
|
-
const s =
|
|
2702
|
+
const s = Ce(a.sliceSerialize({
|
|
2700
2703
|
start: n.end,
|
|
2701
2704
|
end: a.now()
|
|
2702
2705
|
}));
|
|
2703
2706
|
return s.codePointAt(0) !== 94 || !o.includes(s.slice(1)) ? t(c) : (e.enter("gfmFootnoteCallLabelMarker"), e.consume(c), e.exit("gfmFootnoteCallLabelMarker"), r(c));
|
|
2704
2707
|
}
|
|
2705
2708
|
}
|
|
2706
|
-
function
|
|
2709
|
+
function zi(e, r) {
|
|
2707
2710
|
let t = e.length;
|
|
2708
2711
|
for (; t--; )
|
|
2709
2712
|
if (e[t][1].type === "labelImage" && e[t][0] === "enter") {
|
|
@@ -2753,7 +2756,7 @@ function ji(e, r) {
|
|
|
2753
2756
|
];
|
|
2754
2757
|
return e.splice(t, e.length - t + 1, ...u), e;
|
|
2755
2758
|
}
|
|
2756
|
-
function
|
|
2759
|
+
function ji(e, r, t) {
|
|
2757
2760
|
const a = this, i = a.parser.gfmFootnotes || (a.parser.gfmFootnotes = []);
|
|
2758
2761
|
let o = 0, n;
|
|
2759
2762
|
return u;
|
|
@@ -2775,7 +2778,7 @@ function $i(e, r, t) {
|
|
|
2775
2778
|
if (l === 93) {
|
|
2776
2779
|
e.exit("chunkString");
|
|
2777
2780
|
const p = e.exit("gfmFootnoteCallString");
|
|
2778
|
-
return i.includes(
|
|
2781
|
+
return i.includes(Ce(a.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(l), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), r) : t(l);
|
|
2779
2782
|
}
|
|
2780
2783
|
return B(l) || (n = !0), o++, e.consume(l), l === 92 ? f : s;
|
|
2781
2784
|
}
|
|
@@ -2783,7 +2786,7 @@ function $i(e, r, t) {
|
|
|
2783
2786
|
return l === 91 || l === 92 || l === 93 ? (e.consume(l), o++, s) : s(l);
|
|
2784
2787
|
}
|
|
2785
2788
|
}
|
|
2786
|
-
function
|
|
2789
|
+
function $i(e, r, t) {
|
|
2787
2790
|
const a = this, i = a.parser.gfmFootnotes || (a.parser.gfmFootnotes = []);
|
|
2788
2791
|
let o, n = 0, u;
|
|
2789
2792
|
return c;
|
|
@@ -2805,7 +2808,7 @@ function Oi(e, r, t) {
|
|
|
2805
2808
|
if (m === 93) {
|
|
2806
2809
|
e.exit("chunkString");
|
|
2807
2810
|
const x = e.exit("gfmFootnoteDefinitionLabelString");
|
|
2808
|
-
return o =
|
|
2811
|
+
return o = Ce(a.sliceSerialize(x)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(m), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
|
|
2809
2812
|
}
|
|
2810
2813
|
return B(m) || (u = !0), n++, e.consume(m), m === 92 ? l : f;
|
|
2811
2814
|
}
|
|
@@ -2813,19 +2816,19 @@ function Oi(e, r, t) {
|
|
|
2813
2816
|
return m === 91 || m === 92 || m === 93 ? (e.consume(m), n++, f) : f(m);
|
|
2814
2817
|
}
|
|
2815
2818
|
function p(m) {
|
|
2816
|
-
return m === 58 ? (e.enter("definitionMarker"), e.consume(m), e.exit("definitionMarker"), i.includes(o) || i.push(o), Z(e,
|
|
2819
|
+
return m === 58 ? (e.enter("definitionMarker"), e.consume(m), e.exit("definitionMarker"), i.includes(o) || i.push(o), Z(e, g, "gfmFootnoteDefinitionWhitespace")) : t(m);
|
|
2817
2820
|
}
|
|
2818
|
-
function
|
|
2821
|
+
function g(m) {
|
|
2819
2822
|
return r(m);
|
|
2820
2823
|
}
|
|
2821
2824
|
}
|
|
2822
|
-
function
|
|
2823
|
-
return e.check(
|
|
2825
|
+
function Oi(e, r, t) {
|
|
2826
|
+
return e.check(Ri, r, e.attempt(_i, r, t));
|
|
2824
2827
|
}
|
|
2825
|
-
function
|
|
2828
|
+
function Ui(e) {
|
|
2826
2829
|
e.exit("gfmFootnoteDefinition");
|
|
2827
2830
|
}
|
|
2828
|
-
function
|
|
2831
|
+
function Bi(e, r, t) {
|
|
2829
2832
|
const a = this;
|
|
2830
2833
|
return Z(e, i, "gfmFootnoteDefinitionIndent", 5);
|
|
2831
2834
|
function i(o) {
|
|
@@ -2833,7 +2836,7 @@ function Wi(e, r, t) {
|
|
|
2833
2836
|
return n && n[1].type === "gfmFootnoteDefinitionIndent" && n[2].sliceSerialize(n[1], !0).length === 4 ? r(o) : t(o);
|
|
2834
2837
|
}
|
|
2835
2838
|
}
|
|
2836
|
-
function
|
|
2839
|
+
function Wi(e) {
|
|
2837
2840
|
let t = (e || {}).singleTilde;
|
|
2838
2841
|
const a = {
|
|
2839
2842
|
name: "strikethrough",
|
|
@@ -2868,8 +2871,8 @@ function qi(e) {
|
|
|
2868
2871
|
type: "strikethroughText",
|
|
2869
2872
|
start: Object.assign({}, n[s][1].end),
|
|
2870
2873
|
end: Object.assign({}, n[c][1].start)
|
|
2871
|
-
}, p = [["enter", f, u], ["enter", n[s][1], u], ["exit", n[s][1], u], ["enter", l, u]],
|
|
2872
|
-
|
|
2874
|
+
}, p = [["enter", f, u], ["enter", n[s][1], u], ["exit", n[s][1], u], ["enter", l, u]], g = u.parser.constructs.insideSpan.null;
|
|
2875
|
+
g && Re(p, p.length, 0, Pi(g, n.slice(s + 1, c), u)), Re(p, p.length, 0, [["exit", l, u], ["enter", n[c][1], u], ["exit", n[c][1], u], ["exit", f, u]]), Re(n, s - 1, c - s + 3, p), c = s + p.length - 2;
|
|
2873
2876
|
break;
|
|
2874
2877
|
}
|
|
2875
2878
|
}
|
|
@@ -2882,15 +2885,15 @@ function qi(e) {
|
|
|
2882
2885
|
let l = 0;
|
|
2883
2886
|
return p;
|
|
2884
2887
|
function p(m) {
|
|
2885
|
-
return s === 126 && f[f.length - 1][1].type !== "characterEscape" ? c(m) : (n.enter("strikethroughSequenceTemporary"),
|
|
2888
|
+
return s === 126 && f[f.length - 1][1].type !== "characterEscape" ? c(m) : (n.enter("strikethroughSequenceTemporary"), g(m));
|
|
2886
2889
|
}
|
|
2887
|
-
function
|
|
2888
|
-
const x =
|
|
2890
|
+
function g(m) {
|
|
2891
|
+
const x = _e(s);
|
|
2889
2892
|
if (m === 126)
|
|
2890
|
-
return l > 1 ? c(m) : (n.consume(m), l++,
|
|
2893
|
+
return l > 1 ? c(m) : (n.consume(m), l++, g);
|
|
2891
2894
|
if (l < 2 && !t) return c(m);
|
|
2892
|
-
const
|
|
2893
|
-
return
|
|
2895
|
+
const b = n.exit("strikethroughSequenceTemporary"), y = _e(m);
|
|
2896
|
+
return b._open = !y || y === 2 && !!x, b._close = !x || x === 2 && !!y, u(m);
|
|
2894
2897
|
}
|
|
2895
2898
|
}
|
|
2896
2899
|
}
|
|
@@ -2910,7 +2913,7 @@ class Hi {
|
|
|
2910
2913
|
* @returns {undefined}
|
|
2911
2914
|
*/
|
|
2912
2915
|
add(r, t, a) {
|
|
2913
|
-
|
|
2916
|
+
qi(this, r, t, a);
|
|
2914
2917
|
}
|
|
2915
2918
|
// To do: add this when moving to `micromark`.
|
|
2916
2919
|
// /**
|
|
@@ -2949,7 +2952,7 @@ class Hi {
|
|
|
2949
2952
|
this.map.length = 0;
|
|
2950
2953
|
}
|
|
2951
2954
|
}
|
|
2952
|
-
function
|
|
2955
|
+
function qi(e, r, t, a) {
|
|
2953
2956
|
let i = 0;
|
|
2954
2957
|
if (!(t === 0 && a.length === 0)) {
|
|
2955
2958
|
for (; i < e.map.length; ) {
|
|
@@ -2962,7 +2965,7 @@ function Vi(e, r, t, a) {
|
|
|
2962
2965
|
e.map.push([r, t, a]);
|
|
2963
2966
|
}
|
|
2964
2967
|
}
|
|
2965
|
-
function
|
|
2968
|
+
function Vi(e, r) {
|
|
2966
2969
|
let t = !1;
|
|
2967
2970
|
const a = [];
|
|
2968
2971
|
for (; r < e.length; ) {
|
|
@@ -2982,31 +2985,31 @@ function Xi(e, r) {
|
|
|
2982
2985
|
}
|
|
2983
2986
|
return a;
|
|
2984
2987
|
}
|
|
2985
|
-
function
|
|
2988
|
+
function Xi() {
|
|
2986
2989
|
return {
|
|
2987
2990
|
flow: {
|
|
2988
2991
|
null: {
|
|
2989
2992
|
name: "table",
|
|
2990
|
-
tokenize:
|
|
2991
|
-
resolveAll:
|
|
2993
|
+
tokenize: Ki,
|
|
2994
|
+
resolveAll: Qi
|
|
2992
2995
|
}
|
|
2993
2996
|
}
|
|
2994
2997
|
};
|
|
2995
2998
|
}
|
|
2996
|
-
function
|
|
2999
|
+
function Ki(e, r, t) {
|
|
2997
3000
|
const a = this;
|
|
2998
3001
|
let i = 0, o = 0, n;
|
|
2999
3002
|
return u;
|
|
3000
3003
|
function u(h) {
|
|
3001
|
-
let
|
|
3002
|
-
for (;
|
|
3003
|
-
const
|
|
3004
|
-
if (
|
|
3005
|
-
|
|
3004
|
+
let _ = a.events.length - 1;
|
|
3005
|
+
for (; _ > -1; ) {
|
|
3006
|
+
const te = a.events[_][1].type;
|
|
3007
|
+
if (te === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
|
|
3008
|
+
te === "linePrefix") _--;
|
|
3006
3009
|
else break;
|
|
3007
3010
|
}
|
|
3008
|
-
const
|
|
3009
|
-
return
|
|
3011
|
+
const H = _ > -1 ? a.events[_][1].type : null, W = H === "tableHead" || H === "tableRow" ? C : c;
|
|
3012
|
+
return W === C && a.parser.lazy[a.now().line] ? t(h) : W(h);
|
|
3010
3013
|
}
|
|
3011
3014
|
function c(h) {
|
|
3012
3015
|
return e.enter("tableHead"), e.enter("tableRow"), s(h);
|
|
@@ -3015,7 +3018,7 @@ function Qi(e, r, t) {
|
|
|
3015
3018
|
return h === 124 || (n = !0, o += 1), f(h);
|
|
3016
3019
|
}
|
|
3017
3020
|
function f(h) {
|
|
3018
|
-
return h === null ? t(h) : fe(h) ? o > 1 ? (o = 0, a.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(h), e.exit("lineEnding"),
|
|
3021
|
+
return h === null ? t(h) : fe(h) ? o > 1 ? (o = 0, a.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(h), e.exit("lineEnding"), g) : t(h) : G(h) ? Z(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)));
|
|
3019
3022
|
}
|
|
3020
3023
|
function l(h) {
|
|
3021
3024
|
return h === null || h === 124 || B(h) ? (e.exit("data"), f(h)) : (e.consume(h), h === 92 ? p : l);
|
|
@@ -3023,52 +3026,52 @@ function Qi(e, r, t) {
|
|
|
3023
3026
|
function p(h) {
|
|
3024
3027
|
return h === 92 || h === 124 ? (e.consume(h), l) : l(h);
|
|
3025
3028
|
}
|
|
3026
|
-
function
|
|
3029
|
+
function g(h) {
|
|
3027
3030
|
return a.interrupt = !1, a.parser.lazy[a.now().line] ? t(h) : (e.enter("tableDelimiterRow"), n = !1, G(h) ? Z(e, m, "linePrefix", a.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(h) : m(h));
|
|
3028
3031
|
}
|
|
3029
3032
|
function m(h) {
|
|
3030
|
-
return h === 45 || h === 58 ?
|
|
3033
|
+
return h === 45 || h === 58 ? b(h) : h === 124 ? (n = !0, e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), x) : I(h);
|
|
3031
3034
|
}
|
|
3032
3035
|
function x(h) {
|
|
3033
|
-
return G(h) ? Z(e,
|
|
3034
|
-
}
|
|
3035
|
-
function g(h) {
|
|
3036
|
-
return h === 58 ? (o += 1, n = !0, e.enter("tableDelimiterMarker"), e.consume(h), e.exit("tableDelimiterMarker"), b) : h === 45 ? (o += 1, b(h)) : h === null || fe(h) ? S(h) : L(h);
|
|
3036
|
+
return G(h) ? Z(e, b, "whitespace")(h) : b(h);
|
|
3037
3037
|
}
|
|
3038
3038
|
function b(h) {
|
|
3039
|
-
return h ===
|
|
3039
|
+
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 || fe(h) ? L(h) : I(h);
|
|
3040
3040
|
}
|
|
3041
|
-
function
|
|
3042
|
-
return h === 45 ? (e.
|
|
3041
|
+
function y(h) {
|
|
3042
|
+
return h === 45 ? (e.enter("tableDelimiterFiller"), k(h)) : I(h);
|
|
3043
3043
|
}
|
|
3044
|
-
function
|
|
3045
|
-
return
|
|
3044
|
+
function k(h) {
|
|
3045
|
+
return h === 45 ? (e.consume(h), k) : h === 58 ? (n = !0, e.exit("tableDelimiterFiller"), e.enter("tableDelimiterMarker"), e.consume(h), e.exit("tableDelimiterMarker"), T) : (e.exit("tableDelimiterFiller"), T(h));
|
|
3046
3046
|
}
|
|
3047
|
-
function
|
|
3048
|
-
return
|
|
3047
|
+
function T(h) {
|
|
3048
|
+
return G(h) ? Z(e, L, "whitespace")(h) : L(h);
|
|
3049
3049
|
}
|
|
3050
3050
|
function L(h) {
|
|
3051
|
+
return h === 124 ? m(h) : h === null || fe(h) ? !n || i !== o ? I(h) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), r(h)) : I(h);
|
|
3052
|
+
}
|
|
3053
|
+
function I(h) {
|
|
3051
3054
|
return t(h);
|
|
3052
3055
|
}
|
|
3053
3056
|
function C(h) {
|
|
3054
|
-
return e.enter("tableRow"),
|
|
3057
|
+
return e.enter("tableRow"), D(h);
|
|
3058
|
+
}
|
|
3059
|
+
function D(h) {
|
|
3060
|
+
return h === 124 ? (e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), D) : h === null || fe(h) ? (e.exit("tableRow"), r(h)) : G(h) ? Z(e, D, "whitespace")(h) : (e.enter("data"), A(h));
|
|
3055
3061
|
}
|
|
3056
3062
|
function A(h) {
|
|
3057
|
-
return h ===
|
|
3063
|
+
return h === null || h === 124 || B(h) ? (e.exit("data"), D(h)) : (e.consume(h), h === 92 ? N : A);
|
|
3058
3064
|
}
|
|
3059
3065
|
function N(h) {
|
|
3060
|
-
return h ===
|
|
3061
|
-
}
|
|
3062
|
-
function _(h) {
|
|
3063
|
-
return h === 92 || h === 124 ? (e.consume(h), N) : N(h);
|
|
3066
|
+
return h === 92 || h === 124 ? (e.consume(h), A) : A(h);
|
|
3064
3067
|
}
|
|
3065
3068
|
}
|
|
3066
|
-
function
|
|
3069
|
+
function Qi(e, r) {
|
|
3067
3070
|
let t = -1, a = !0, i = 0, o = [0, 0, 0, 0], n = [0, 0, 0, 0], u = !1, c = 0, s, f, l;
|
|
3068
3071
|
const p = new Hi();
|
|
3069
3072
|
for (; ++t < e.length; ) {
|
|
3070
|
-
const
|
|
3071
|
-
|
|
3073
|
+
const g = e[t], m = g[1];
|
|
3074
|
+
g[0] === "enter" ? m.type === "tableHead" ? (u = !1, c !== 0 && (Dt(p, r, c, s, f), f = void 0, c = 0), s = {
|
|
3072
3075
|
type: "table",
|
|
3073
3076
|
start: Object.assign({}, m.start),
|
|
3074
3077
|
// Note: correct end is set later.
|
|
@@ -3078,15 +3081,15 @@ function Gi(e, r) {
|
|
|
3078
3081
|
start: Object.assign({}, m.start),
|
|
3079
3082
|
// Note: correct end is set later.
|
|
3080
3083
|
end: Object.assign({}, m.end)
|
|
3081
|
-
}, 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 =
|
|
3084
|
+
}, 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 = Pe(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 = Pe(p, r, o, i, void 0, l)), o = n, n = [o[1], t, 0, 0])) : m.type === "tableHead" ? (u = !0, c = t) : m.type === "tableRow" || m.type === "tableDelimiterRow" ? (c = t, o[1] !== 0 ? (n[0] = n[1], l = Pe(p, r, o, i, t, l)) : n[1] !== 0 && (l = Pe(p, r, n, i, t, l)), i = 0) : i && (m.type === "data" || m.type === "tableDelimiterMarker" || m.type === "tableDelimiterFiller") && (n[3] = t);
|
|
3082
3085
|
}
|
|
3083
|
-
for (c !== 0 &&
|
|
3084
|
-
const
|
|
3085
|
-
|
|
3086
|
+
for (c !== 0 && Dt(p, r, c, s, f), p.consume(r.events), t = -1; ++t < r.events.length; ) {
|
|
3087
|
+
const g = r.events[t];
|
|
3088
|
+
g[0] === "enter" && g[1].type === "table" && (g[1]._align = Vi(r.events, t));
|
|
3086
3089
|
}
|
|
3087
3090
|
return e;
|
|
3088
3091
|
}
|
|
3089
|
-
function
|
|
3092
|
+
function Pe(e, r, t, a, i, o) {
|
|
3090
3093
|
const n = a === 1 ? "tableHeader" : a === 2 ? "tableDelimiter" : "tableData", u = "tableContent";
|
|
3091
3094
|
t[0] !== 0 && (o.end = Object.assign({}, le(r.events, t[0])), e.add(t[0], 0, [["exit", o, r]]));
|
|
3092
3095
|
const c = le(r.events, t[1]);
|
|
@@ -3102,8 +3105,8 @@ function Se(e, r, t, a, i, o) {
|
|
|
3102
3105
|
end: Object.assign({}, f)
|
|
3103
3106
|
};
|
|
3104
3107
|
if (e.add(t[2], 0, [["enter", l, r]]), a !== 2) {
|
|
3105
|
-
const p = r.events[t[2]],
|
|
3106
|
-
if (p[1].end = Object.assign({},
|
|
3108
|
+
const p = r.events[t[2]], g = r.events[t[3]];
|
|
3109
|
+
if (p[1].end = Object.assign({}, g[1].end), p[1].type = "chunkText", p[1].contentType = "text", t[3] > t[2] + 1) {
|
|
3107
3110
|
const m = t[2] + 1, x = t[3] - t[2] - 1;
|
|
3108
3111
|
e.add(m, x, []);
|
|
3109
3112
|
}
|
|
@@ -3112,7 +3115,7 @@ function Se(e, r, t, a, i, o) {
|
|
|
3112
3115
|
}
|
|
3113
3116
|
return i !== void 0 && (o.end = Object.assign({}, le(r.events, i)), e.add(i, 0, [["exit", o, r]]), o = void 0), o;
|
|
3114
3117
|
}
|
|
3115
|
-
function
|
|
3118
|
+
function Dt(e, r, t, a, i) {
|
|
3116
3119
|
const o = [], n = le(r.events, t);
|
|
3117
3120
|
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);
|
|
3118
3121
|
}
|
|
@@ -3120,18 +3123,18 @@ function le(e, r) {
|
|
|
3120
3123
|
const t = e[r], a = t[0] === "enter" ? "start" : "end";
|
|
3121
3124
|
return t[1][a];
|
|
3122
3125
|
}
|
|
3123
|
-
const
|
|
3126
|
+
const Gi = {
|
|
3124
3127
|
name: "tasklistCheck",
|
|
3125
|
-
tokenize:
|
|
3128
|
+
tokenize: Ji
|
|
3126
3129
|
};
|
|
3127
|
-
function
|
|
3130
|
+
function Zi() {
|
|
3128
3131
|
return {
|
|
3129
3132
|
text: {
|
|
3130
|
-
91:
|
|
3133
|
+
91: Gi
|
|
3131
3134
|
}
|
|
3132
3135
|
};
|
|
3133
3136
|
}
|
|
3134
|
-
function
|
|
3137
|
+
function Ji(e, r, t) {
|
|
3135
3138
|
const a = this;
|
|
3136
3139
|
return i;
|
|
3137
3140
|
function i(c) {
|
|
@@ -3150,46 +3153,46 @@ function Yi(e, r, t) {
|
|
|
3150
3153
|
}
|
|
3151
3154
|
function u(c) {
|
|
3152
3155
|
return fe(c) ? r(c) : G(c) ? e.check({
|
|
3153
|
-
tokenize:
|
|
3156
|
+
tokenize: Yi
|
|
3154
3157
|
}, r, t)(c) : t(c);
|
|
3155
3158
|
}
|
|
3156
3159
|
}
|
|
3157
|
-
function
|
|
3160
|
+
function Yi(e, r, t) {
|
|
3158
3161
|
return Z(e, a, "whitespace");
|
|
3159
3162
|
function a(i) {
|
|
3160
3163
|
return i === null ? t(i) : r(i);
|
|
3161
3164
|
}
|
|
3162
3165
|
}
|
|
3163
|
-
function
|
|
3164
|
-
return
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3166
|
+
function eo(e) {
|
|
3167
|
+
return bi([
|
|
3168
|
+
vi(),
|
|
3169
|
+
Ei(),
|
|
3170
|
+
Wi(e),
|
|
3171
|
+
Xi(),
|
|
3172
|
+
Zi()
|
|
3170
3173
|
]);
|
|
3171
3174
|
}
|
|
3172
|
-
const
|
|
3173
|
-
function
|
|
3175
|
+
const to = {};
|
|
3176
|
+
function ro(e) {
|
|
3174
3177
|
const r = (
|
|
3175
3178
|
/** @type {Processor<Root>} */
|
|
3176
3179
|
this
|
|
3177
|
-
), t = e ||
|
|
3178
|
-
i.push(
|
|
3180
|
+
), t = e || to, a = r.data(), i = a.micromarkExtensions || (a.micromarkExtensions = []), o = a.fromMarkdownExtensions || (a.fromMarkdownExtensions = []), n = a.toMarkdownExtensions || (a.toMarkdownExtensions = []);
|
|
3181
|
+
i.push(eo(t)), o.push(pi()), n.push(gi(t));
|
|
3179
3182
|
}
|
|
3180
|
-
function
|
|
3183
|
+
function j(...e) {
|
|
3181
3184
|
return e.filter(Boolean).join(" ");
|
|
3182
3185
|
}
|
|
3183
|
-
const
|
|
3184
|
-
|
|
3186
|
+
const ao = ({ content: e }) => /* @__PURE__ */ d(
|
|
3187
|
+
Br,
|
|
3185
3188
|
{
|
|
3186
|
-
remarkPlugins: [
|
|
3189
|
+
remarkPlugins: [ro],
|
|
3187
3190
|
className: "cuadra-aui-md",
|
|
3188
|
-
components:
|
|
3191
|
+
components: oo,
|
|
3189
3192
|
children: e
|
|
3190
3193
|
}
|
|
3191
|
-
),
|
|
3192
|
-
const { isCopied: t, copyToClipboard: a } =
|
|
3194
|
+
), st = Pr(ao), no = ({ language: e, code: r }) => {
|
|
3195
|
+
const { isCopied: t, copyToClipboard: a } = io();
|
|
3193
3196
|
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: [
|
|
3194
3197
|
/* @__PURE__ */ d("span", { className: "cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand", children: e }),
|
|
3195
3198
|
/* @__PURE__ */ w(
|
|
@@ -3201,33 +3204,33 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3201
3204
|
className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-muted cuadra-transition-colors",
|
|
3202
3205
|
"aria-label": "Copy code",
|
|
3203
3206
|
children: [
|
|
3204
|
-
!t && /* @__PURE__ */ d(
|
|
3205
|
-
t && /* @__PURE__ */ d(
|
|
3207
|
+
!t && /* @__PURE__ */ d(aa, { className: "cuadra-h-4 cuadra-w-4" }),
|
|
3208
|
+
t && /* @__PURE__ */ d(Jr, { className: "cuadra-h-4 cuadra-w-4" })
|
|
3206
3209
|
]
|
|
3207
3210
|
}
|
|
3208
3211
|
)
|
|
3209
3212
|
] });
|
|
3210
|
-
},
|
|
3213
|
+
}, io = ({
|
|
3211
3214
|
copiedDuration: e = 3e3
|
|
3212
3215
|
} = {}) => {
|
|
3213
|
-
const [r, t] =
|
|
3216
|
+
const [r, t] = R(!1);
|
|
3214
3217
|
return { isCopied: r, copyToClipboard: (i) => {
|
|
3215
3218
|
i && navigator.clipboard.writeText(i).then(() => {
|
|
3216
3219
|
t(!0), setTimeout(() => t(!1), e);
|
|
3217
3220
|
});
|
|
3218
3221
|
} };
|
|
3219
|
-
},
|
|
3222
|
+
}, oo = Or({
|
|
3220
3223
|
h1: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3221
3224
|
"h1",
|
|
3222
3225
|
{
|
|
3223
|
-
className:
|
|
3226
|
+
className: j("cuadra-mb-6 cuadra-scroll-m-20 cuadra-text-2xl cuadra-font-normal cuadra-tracking-tight last:cuadra-mb-0 font-brand", e),
|
|
3224
3227
|
...r
|
|
3225
3228
|
}
|
|
3226
3229
|
),
|
|
3227
3230
|
h2: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3228
3231
|
"h2",
|
|
3229
3232
|
{
|
|
3230
|
-
className:
|
|
3233
|
+
className: j(
|
|
3231
3234
|
"cuadra-mb-4 cuadra-mt-6 cuadra-scroll-m-20 cuadra-text-xl cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",
|
|
3232
3235
|
e
|
|
3233
3236
|
),
|
|
@@ -3237,7 +3240,7 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3237
3240
|
h3: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3238
3241
|
"h3",
|
|
3239
3242
|
{
|
|
3240
|
-
className:
|
|
3243
|
+
className: j(
|
|
3241
3244
|
"cuadra-mb-3 cuadra-mt-5 cuadra-scroll-m-20 cuadra-text-lg cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",
|
|
3242
3245
|
e
|
|
3243
3246
|
),
|
|
@@ -3247,38 +3250,38 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3247
3250
|
h4: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3248
3251
|
"h4",
|
|
3249
3252
|
{
|
|
3250
|
-
className:
|
|
3253
|
+
className: j(
|
|
3251
3254
|
"cuadra-mb-4 cuadra-mt-6 cuadra-scroll-m-20 cuadra-text-xl cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",
|
|
3252
3255
|
e
|
|
3253
3256
|
),
|
|
3254
3257
|
...r
|
|
3255
3258
|
}
|
|
3256
3259
|
),
|
|
3257
|
-
h5: ({ className: e, ...r }) => /* @__PURE__ */ d("h5", { className:
|
|
3258
|
-
h6: ({ className: e, ...r }) => /* @__PURE__ */ d("h6", { className:
|
|
3259
|
-
p: ({ className: e, ...r }) => /* @__PURE__ */ d("p", { className:
|
|
3260
|
+
h5: ({ className: e, ...r }) => /* @__PURE__ */ d("h5", { className: j("cuadra-my-4 cuadra-text-lg cuadra-font-normal first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
|
|
3261
|
+
h6: ({ className: e, ...r }) => /* @__PURE__ */ d("h6", { className: j("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand", e), ...r }),
|
|
3262
|
+
p: ({ className: e, ...r }) => /* @__PURE__ */ d("p", { className: j("cuadra-mb-5 cuadra-mt-5 cuadra-leading-7 first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
|
|
3260
3263
|
a: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3261
3264
|
"a",
|
|
3262
3265
|
{
|
|
3263
|
-
className:
|
|
3266
|
+
className: j("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand", e),
|
|
3264
3267
|
...r
|
|
3265
3268
|
}
|
|
3266
3269
|
),
|
|
3267
|
-
blockquote: ({ className: e, ...r }) => /* @__PURE__ */ d("blockquote", { className:
|
|
3268
|
-
ul: ({ className: e, ...r }) => /* @__PURE__ */ d("ul", { className:
|
|
3269
|
-
ol: ({ className: e, ...r }) => /* @__PURE__ */ d("ol", { className:
|
|
3270
|
-
hr: ({ className: e, ...r }) => /* @__PURE__ */ d("hr", { className:
|
|
3270
|
+
blockquote: ({ className: e, ...r }) => /* @__PURE__ */ d("blockquote", { className: j("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand", e), ...r }),
|
|
3271
|
+
ul: ({ className: e, ...r }) => /* @__PURE__ */ d("ul", { className: j("cuadra-my-5 cuadra-ml-6 cuadra-list-disc [&>li]:cuadra-mt-2 font-brand", e), ...r }),
|
|
3272
|
+
ol: ({ className: e, ...r }) => /* @__PURE__ */ d("ol", { className: j("cuadra-my-5 cuadra-ml-6 cuadra-list-decimal [&>li]:cuadra-mt-2 font-brand", e), ...r }),
|
|
3273
|
+
hr: ({ className: e, ...r }) => /* @__PURE__ */ d("hr", { className: j("cuadra-my-5 cuadra-border-b", e), ...r }),
|
|
3271
3274
|
table: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3272
3275
|
"table",
|
|
3273
3276
|
{
|
|
3274
|
-
className:
|
|
3277
|
+
className: j("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand", e),
|
|
3275
3278
|
...r
|
|
3276
3279
|
}
|
|
3277
3280
|
),
|
|
3278
3281
|
th: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3279
3282
|
"th",
|
|
3280
3283
|
{
|
|
3281
|
-
className:
|
|
3284
|
+
className: j(
|
|
3282
3285
|
"cuadra-bg-muted cuadra-px-4 cuadra-py-2 cuadra-text-left cuadra-font-normal first:cuadra-rounded-tl-lg last:cuadra-rounded-tr-lg [&[align=center]]:cuadra-text-center [&[align=right]]:cuadra-text-right font-brand",
|
|
3283
3286
|
e
|
|
3284
3287
|
),
|
|
@@ -3288,7 +3291,7 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3288
3291
|
td: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3289
3292
|
"td",
|
|
3290
3293
|
{
|
|
3291
|
-
className:
|
|
3294
|
+
className: j(
|
|
3292
3295
|
"cuadra-border-b cuadra-border-l cuadra-px-4 cuadra-py-2 cuadra-text-left last:cuadra-border-r [&[align=center]]:cuadra-text-center [&[align=right]]:cuadra-text-right font-brand",
|
|
3293
3296
|
e
|
|
3294
3297
|
),
|
|
@@ -3298,18 +3301,18 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3298
3301
|
tr: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3299
3302
|
"tr",
|
|
3300
3303
|
{
|
|
3301
|
-
className:
|
|
3304
|
+
className: j(
|
|
3302
3305
|
"cuadra-m-0 cuadra-border-b cuadra-p-0 first:cuadra-border-t [&:last-child>td:first-child]:cuadra-rounded-bl-lg [&:last-child>td:last-child]:cuadra-rounded-br-lg",
|
|
3303
3306
|
e
|
|
3304
3307
|
),
|
|
3305
3308
|
...r
|
|
3306
3309
|
}
|
|
3307
3310
|
),
|
|
3308
|
-
sup: ({ className: e, ...r }) => /* @__PURE__ */ d("sup", { className:
|
|
3311
|
+
sup: ({ className: e, ...r }) => /* @__PURE__ */ d("sup", { className: j("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand", e), ...r }),
|
|
3309
3312
|
pre: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3310
3313
|
"pre",
|
|
3311
3314
|
{
|
|
3312
|
-
className:
|
|
3315
|
+
className: j(
|
|
3313
3316
|
"cuadra-overflow-x-auto cuadra-rounded-b-lg !cuadra-rounded-t-none cuadra-bg-muted cuadra-p-4 cuadra-text-foreground font-brand",
|
|
3314
3317
|
e
|
|
3315
3318
|
),
|
|
@@ -3317,18 +3320,18 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3317
3320
|
}
|
|
3318
3321
|
),
|
|
3319
3322
|
code: function({ className: r, ...t }) {
|
|
3320
|
-
const a =
|
|
3323
|
+
const a = Ur();
|
|
3321
3324
|
return /* @__PURE__ */ d(
|
|
3322
3325
|
"code",
|
|
3323
3326
|
{
|
|
3324
|
-
className:
|
|
3327
|
+
className: j(!a && "cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand", r),
|
|
3325
3328
|
...t
|
|
3326
3329
|
}
|
|
3327
3330
|
);
|
|
3328
3331
|
},
|
|
3329
|
-
CodeHeader:
|
|
3332
|
+
CodeHeader: no
|
|
3330
3333
|
});
|
|
3331
|
-
function
|
|
3334
|
+
function wr({ className: e = "", variant: r = "default", ...t }) {
|
|
3332
3335
|
const a = "cuadra-inline-flex cuadra-items-center cuadra-rounded-md cuadra-px-3 cuadra-py-1.5 cuadra-text-xs cuadra-font-medium font-brand", i = {
|
|
3333
3336
|
default: "cuadra-border cuadra-border-border cuadra-bg-muted cuadra-text-muted-foreground",
|
|
3334
3337
|
subtle: "cuadra-border cuadra-border-border/50 cuadra-bg-muted/50 cuadra-text-muted-foreground",
|
|
@@ -3343,7 +3346,7 @@ function kr({ className: e = "", variant: r = "default", ...t }) {
|
|
|
3343
3346
|
}
|
|
3344
3347
|
);
|
|
3345
3348
|
}
|
|
3346
|
-
function
|
|
3349
|
+
function co(e) {
|
|
3347
3350
|
const r = /* @__PURE__ */ new Map();
|
|
3348
3351
|
for (const t of e) {
|
|
3349
3352
|
const a = r.get(t.filename);
|
|
@@ -3351,20 +3354,20 @@ function uo(e) {
|
|
|
3351
3354
|
}
|
|
3352
3355
|
return Array.from(r.values()).sort((t, a) => a.score - t.score);
|
|
3353
3356
|
}
|
|
3354
|
-
function
|
|
3357
|
+
function uo({
|
|
3355
3358
|
sources: e,
|
|
3356
3359
|
maxVisible: r = 3
|
|
3357
3360
|
}) {
|
|
3358
3361
|
if (!e || e.length === 0) return null;
|
|
3359
|
-
const t =
|
|
3362
|
+
const t = co(e), a = t.slice(0, r), i = t.length - r;
|
|
3360
3363
|
return /* @__PURE__ */ w("div", { className: "cuadra-mt-4 cuadra-pt-3 cuadra-border-t cuadra-border-border", children: [
|
|
3361
3364
|
/* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-1.5 cuadra-mb-2.5", children: [
|
|
3362
|
-
/* @__PURE__ */ d(
|
|
3365
|
+
/* @__PURE__ */ d(Ut, { className: "cuadra-h-3.5 cuadra-w-3.5 cuadra-text-muted-foreground" }),
|
|
3363
3366
|
/* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-font-medium cuadra-text-muted-foreground font-brand", children: "Sources" })
|
|
3364
3367
|
] }),
|
|
3365
3368
|
/* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-flex-wrap cuadra-gap-2", children: [
|
|
3366
|
-
a.map((o, n) => /* @__PURE__ */ d(
|
|
3367
|
-
i > 0 && /* @__PURE__ */ w(
|
|
3369
|
+
a.map((o, n) => /* @__PURE__ */ d(lo, { source: o }, o.sourceId || n)),
|
|
3370
|
+
i > 0 && /* @__PURE__ */ w(wr, { variant: "subtle", children: [
|
|
3368
3371
|
"+",
|
|
3369
3372
|
i,
|
|
3370
3373
|
" more"
|
|
@@ -3372,23 +3375,23 @@ function so({
|
|
|
3372
3375
|
] })
|
|
3373
3376
|
] });
|
|
3374
3377
|
}
|
|
3375
|
-
function
|
|
3378
|
+
function so(e) {
|
|
3376
3379
|
switch (e.split(".").pop()?.toLowerCase()) {
|
|
3377
3380
|
case "csv":
|
|
3378
3381
|
case "xlsx":
|
|
3379
3382
|
case "xls":
|
|
3380
|
-
return
|
|
3383
|
+
return ca;
|
|
3381
3384
|
case "md":
|
|
3382
3385
|
case "txt":
|
|
3383
|
-
return
|
|
3386
|
+
return la;
|
|
3384
3387
|
default:
|
|
3385
|
-
return
|
|
3388
|
+
return Ut;
|
|
3386
3389
|
}
|
|
3387
3390
|
}
|
|
3388
|
-
function
|
|
3389
|
-
const { filename: r, score: t } = e, a =
|
|
3391
|
+
function lo({ source: e }) {
|
|
3392
|
+
const { filename: r, score: t } = e, a = so(r);
|
|
3390
3393
|
return /* @__PURE__ */ w(
|
|
3391
|
-
|
|
3394
|
+
wr,
|
|
3392
3395
|
{
|
|
3393
3396
|
className: "cuadra-gap-2 cuadra-cursor-default",
|
|
3394
3397
|
title: t < 1 ? `${Math.round(t * 100)}% relevant` : void 0,
|
|
@@ -3403,7 +3406,7 @@ function fo({ source: e }) {
|
|
|
3403
3406
|
}
|
|
3404
3407
|
);
|
|
3405
3408
|
}
|
|
3406
|
-
const
|
|
3409
|
+
const _t = ve(
|
|
3407
3410
|
function({
|
|
3408
3411
|
welcomeTitle: r = "Hi, how can I help you today?",
|
|
3409
3412
|
welcomeSubtitle: t = "Start exploring our platform and discover what you can build.",
|
|
@@ -3414,96 +3417,96 @@ const Rt = we(
|
|
|
3414
3417
|
preMadeResponseDelay: u = 1e3,
|
|
3415
3418
|
streamingSpeed: c = 50
|
|
3416
3419
|
}, s) {
|
|
3417
|
-
const f =
|
|
3418
|
-
if (!
|
|
3420
|
+
const f = Fr(), l = zr(), [p, g] = R(!1), [m, x] = R(null), [b, y] = R(!1), k = X((C, D, A) => {
|
|
3421
|
+
if (!b)
|
|
3419
3422
|
try {
|
|
3420
|
-
const
|
|
3421
|
-
|
|
3423
|
+
const N = A?.streamingSpeed ?? c, h = A?.delay ?? u;
|
|
3424
|
+
Ma(C, D, N, h), l.composer().setText(C), setTimeout(() => {
|
|
3422
3425
|
l.composer().send();
|
|
3423
3426
|
}, 10);
|
|
3424
3427
|
} catch {
|
|
3425
3428
|
}
|
|
3426
|
-
}, [
|
|
3429
|
+
}, [b, c, u, l]), T = X((C) => {
|
|
3427
3430
|
try {
|
|
3428
3431
|
l.composer().setText(C), setTimeout(() => {
|
|
3429
3432
|
l.composer().send();
|
|
3430
3433
|
}, 10);
|
|
3431
3434
|
} catch {
|
|
3432
3435
|
}
|
|
3433
|
-
}, [l]),
|
|
3434
|
-
if (!(
|
|
3436
|
+
}, [l]), L = X(async (C) => {
|
|
3437
|
+
if (!(b || !f))
|
|
3435
3438
|
try {
|
|
3436
3439
|
if (C.response) {
|
|
3437
|
-
const
|
|
3440
|
+
const D = C.responseDelay ?? u;
|
|
3438
3441
|
await k(C.prompt, C.response, {
|
|
3439
|
-
delay:
|
|
3442
|
+
delay: D,
|
|
3440
3443
|
streamingSpeed: c
|
|
3441
3444
|
});
|
|
3442
3445
|
} else
|
|
3443
|
-
|
|
3446
|
+
T(C.prompt);
|
|
3444
3447
|
} catch {
|
|
3445
3448
|
}
|
|
3446
|
-
}, [f,
|
|
3449
|
+
}, [f, b, u, c, k, T]), I = X(() => {
|
|
3447
3450
|
try {
|
|
3448
3451
|
const C = window.__cuadraThreadListRuntime;
|
|
3449
3452
|
C?.switchToNewThread && C.switchToNewThread();
|
|
3450
3453
|
} catch {
|
|
3451
3454
|
}
|
|
3452
3455
|
}, []);
|
|
3453
|
-
return
|
|
3454
|
-
sendMessage:
|
|
3456
|
+
return at(s, () => ({
|
|
3457
|
+
sendMessage: T,
|
|
3455
3458
|
sendPreMadeQA: k,
|
|
3456
|
-
clearChat:
|
|
3457
|
-
}), [
|
|
3459
|
+
clearChat: I
|
|
3460
|
+
}), [T, k, I]), O(() => {
|
|
3458
3461
|
if (!f) {
|
|
3459
|
-
|
|
3462
|
+
g(!1);
|
|
3460
3463
|
return;
|
|
3461
3464
|
}
|
|
3462
3465
|
try {
|
|
3463
3466
|
const C = f?.store;
|
|
3464
3467
|
if (!C) {
|
|
3465
|
-
|
|
3468
|
+
g(!1);
|
|
3466
3469
|
return;
|
|
3467
3470
|
}
|
|
3468
|
-
const
|
|
3469
|
-
const h =
|
|
3470
|
-
h && h !== m && x(h),
|
|
3471
|
-
}),
|
|
3472
|
-
if (
|
|
3473
|
-
const
|
|
3474
|
-
|
|
3471
|
+
const D = C.subscribe?.((N) => {
|
|
3472
|
+
const h = N?.threadId, _ = N?.messages || [], H = N?.isLoadingHistory || !1, W = _.length;
|
|
3473
|
+
h && h !== m && x(h), g(H && W === 0);
|
|
3474
|
+
}), A = C.getState?.();
|
|
3475
|
+
if (A) {
|
|
3476
|
+
const N = A?.threadId, h = A?.messages || [], _ = A?.isLoadingHistory || !1, H = h.length;
|
|
3477
|
+
N && N !== m && x(N), g(_ && H === 0);
|
|
3475
3478
|
}
|
|
3476
3479
|
return () => {
|
|
3477
|
-
|
|
3480
|
+
D && D();
|
|
3478
3481
|
};
|
|
3479
3482
|
} catch {
|
|
3480
|
-
|
|
3483
|
+
g(!1);
|
|
3481
3484
|
}
|
|
3482
|
-
}, [f, m]), /* @__PURE__ */ w(
|
|
3485
|
+
}, [f, m]), /* @__PURE__ */ w(Se.Root, { className: "cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full", children: [
|
|
3483
3486
|
/* @__PURE__ */ d(
|
|
3484
|
-
|
|
3487
|
+
Se.Viewport,
|
|
3485
3488
|
{
|
|
3486
3489
|
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",
|
|
3487
3490
|
style: a ? { paddingTop: a } : void 0,
|
|
3488
3491
|
children: p ? /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-inset-0 cuadra-flex cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: [
|
|
3489
|
-
/* @__PURE__ */ d(
|
|
3492
|
+
/* @__PURE__ */ d(Bt, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }),
|
|
3490
3493
|
/* @__PURE__ */ d("p", { className: "cuadra-text-sm cuadra-text-muted-foreground font-brand", children: "Loading messages..." })
|
|
3491
3494
|
] }) }) : /* @__PURE__ */ w(J, { children: [
|
|
3492
|
-
/* @__PURE__ */ d(
|
|
3493
|
-
|
|
3495
|
+
/* @__PURE__ */ d(Se.Empty, { children: /* @__PURE__ */ d(
|
|
3496
|
+
fo,
|
|
3494
3497
|
{
|
|
3495
3498
|
title: r,
|
|
3496
3499
|
subtitle: t,
|
|
3497
3500
|
suggestions: i,
|
|
3498
|
-
onSuggestionClick:
|
|
3499
|
-
isProcessing:
|
|
3501
|
+
onSuggestionClick: L,
|
|
3502
|
+
isProcessing: b
|
|
3500
3503
|
}
|
|
3501
3504
|
) }),
|
|
3502
3505
|
/* @__PURE__ */ d(
|
|
3503
|
-
|
|
3506
|
+
Se.Messages,
|
|
3504
3507
|
{
|
|
3505
3508
|
components: {
|
|
3506
|
-
UserMessage:
|
|
3509
|
+
UserMessage: ho,
|
|
3507
3510
|
AssistantMessage: go
|
|
3508
3511
|
}
|
|
3509
3512
|
}
|
|
@@ -3517,16 +3520,16 @@ const Rt = we(
|
|
|
3517
3520
|
{
|
|
3518
3521
|
components: {
|
|
3519
3522
|
Attachment: () => {
|
|
3520
|
-
const C =
|
|
3523
|
+
const C = xe(({ attachment: D }) => D);
|
|
3521
3524
|
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: [
|
|
3522
3525
|
/* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-text-muted-foreground font-brand", children: C.name || "Attachment" }),
|
|
3523
|
-
/* @__PURE__ */ d(
|
|
3526
|
+
/* @__PURE__ */ d(jr.Remove, { asChild: !0, children: /* @__PURE__ */ d(
|
|
3524
3527
|
"button",
|
|
3525
3528
|
{
|
|
3526
3529
|
type: "button",
|
|
3527
3530
|
className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-size-4 cuadra-rounded hover:cuadra-bg-background cuadra-transition-colors",
|
|
3528
3531
|
"aria-label": "Remove attachment",
|
|
3529
|
-
children: /* @__PURE__ */ d(
|
|
3532
|
+
children: /* @__PURE__ */ d(nt, { className: "cuadra-h-3 cuadra-w-3 cuadra-text-muted-foreground" })
|
|
3530
3533
|
}
|
|
3531
3534
|
) })
|
|
3532
3535
|
] }) : null;
|
|
@@ -3570,7 +3573,7 @@ const Rt = we(
|
|
|
3570
3573
|
right: "3rem"
|
|
3571
3574
|
},
|
|
3572
3575
|
"aria-label": "Attach file",
|
|
3573
|
-
children: /* @__PURE__ */ d(
|
|
3576
|
+
children: /* @__PURE__ */ d(Wt, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground", strokeWidth: 1.5 })
|
|
3574
3577
|
}
|
|
3575
3578
|
)
|
|
3576
3579
|
}
|
|
@@ -3588,7 +3591,7 @@ const Rt = we(
|
|
|
3588
3591
|
},
|
|
3589
3592
|
"aria-label": "Send message",
|
|
3590
3593
|
type: "button",
|
|
3591
|
-
children: /* @__PURE__ */ d(
|
|
3594
|
+
children: /* @__PURE__ */ d(Gr, { className: "cuadra-h-4 cuadra-w-4" })
|
|
3592
3595
|
}
|
|
3593
3596
|
) })
|
|
3594
3597
|
] })
|
|
@@ -3596,7 +3599,7 @@ const Rt = we(
|
|
|
3596
3599
|
] });
|
|
3597
3600
|
}
|
|
3598
3601
|
);
|
|
3599
|
-
function
|
|
3602
|
+
function fo({ title: e, subtitle: r, suggestions: t, onSuggestionClick: a, isProcessing: i }) {
|
|
3600
3603
|
return /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-h-full cuadra-py-12 cuadra-px-4 cuadra-overflow-y-auto scrollbar-hide", children: /* @__PURE__ */ w("div", { className: "cuadra-text-center cuadra-max-w-3xl cuadra-w-full cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-min-h-full", children: [
|
|
3601
3604
|
/* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8", children: [
|
|
3602
3605
|
/* @__PURE__ */ d("h2", { className: "cuadra-text-lg cuadra-font-normal cuadra-text-foreground cuadra-mb-2 font-brand", children: e }),
|
|
@@ -3616,14 +3619,14 @@ function ho({ title: e, subtitle: r, suggestions: t, onSuggestionClick: a, isPro
|
|
|
3616
3619
|
)) })
|
|
3617
3620
|
] }) });
|
|
3618
3621
|
}
|
|
3619
|
-
function
|
|
3622
|
+
function ho() {
|
|
3620
3623
|
return /* @__PURE__ */ w(be.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: [
|
|
3621
3624
|
/* @__PURE__ */ d(
|
|
3622
3625
|
be.Attachments,
|
|
3623
3626
|
{
|
|
3624
3627
|
components: {
|
|
3625
3628
|
Attachment: () => {
|
|
3626
|
-
const e =
|
|
3629
|
+
const e = xe(({ attachment: o }) => o);
|
|
3627
3630
|
if (!e) return null;
|
|
3628
3631
|
const r = e.type === "image", t = e.file, a = e.content?.find((o) => o.type === "image"), i = t ? URL.createObjectURL(t) : a?.image;
|
|
3629
3632
|
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(
|
|
@@ -3635,7 +3638,7 @@ function mo() {
|
|
|
3635
3638
|
style: { borderWidth: "1px" }
|
|
3636
3639
|
}
|
|
3637
3640
|
) : /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 cuadra-rounded-lg cuadra-border cuadra-border-border cuadra-bg-muted cuadra-px-3 cuadra-py-2", children: [
|
|
3638
|
-
/* @__PURE__ */ d(
|
|
3641
|
+
/* @__PURE__ */ d(Wt, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
|
|
3639
3642
|
/* @__PURE__ */ d("span", { className: "cuadra-text-sm cuadra-text-foreground font-brand", children: e.name || "Attachment" })
|
|
3640
3643
|
] }) });
|
|
3641
3644
|
}
|
|
@@ -3662,7 +3665,7 @@ function mo() {
|
|
|
3662
3665
|
be.Parts,
|
|
3663
3666
|
{
|
|
3664
3667
|
components: {
|
|
3665
|
-
Text: ({ text: e }) => /* @__PURE__ */ d(
|
|
3668
|
+
Text: ({ text: e }) => /* @__PURE__ */ d(st, { content: e || "" })
|
|
3666
3669
|
}
|
|
3667
3670
|
}
|
|
3668
3671
|
)
|
|
@@ -3670,37 +3673,55 @@ function mo() {
|
|
|
3670
3673
|
)
|
|
3671
3674
|
] });
|
|
3672
3675
|
}
|
|
3673
|
-
function
|
|
3674
|
-
const [r, t] =
|
|
3675
|
-
return e ? /* @__PURE__ */
|
|
3676
|
+
function mo({ text: e }) {
|
|
3677
|
+
const [r, t] = R(!1), a = xe(({ message: i }) => i?.status?.type === "running");
|
|
3678
|
+
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: [
|
|
3676
3679
|
/* @__PURE__ */ w(
|
|
3677
3680
|
"button",
|
|
3678
3681
|
{
|
|
3679
3682
|
type: "button",
|
|
3680
3683
|
onClick: () => t(!r),
|
|
3681
|
-
className: "cuadra-
|
|
3684
|
+
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",
|
|
3682
3685
|
children: [
|
|
3683
3686
|
/* @__PURE__ */ d(
|
|
3684
|
-
|
|
3687
|
+
et,
|
|
3685
3688
|
{
|
|
3686
|
-
className: `cuadra-h-
|
|
3689
|
+
className: `cuadra-h-3.5 cuadra-w-3.5 cuadra-shrink-0 cuadra-transition-transform cuadra-duration-200 ${r ? "" : "cuadra--rotate-90"}`
|
|
3687
3690
|
}
|
|
3688
3691
|
),
|
|
3689
|
-
/* @__PURE__ */ d(Zr, { className: "cuadra-h-4 cuadra-w-4 cuadra-shrink-0" }),
|
|
3690
3692
|
/* @__PURE__ */ d("span", { children: "Reasoning" })
|
|
3691
3693
|
]
|
|
3692
3694
|
}
|
|
3693
3695
|
),
|
|
3694
|
-
|
|
3696
|
+
/* @__PURE__ */ d(
|
|
3697
|
+
"div",
|
|
3698
|
+
{
|
|
3699
|
+
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"}`,
|
|
3700
|
+
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(st, { content: e }) })
|
|
3701
|
+
}
|
|
3702
|
+
)
|
|
3695
3703
|
] }) : null;
|
|
3696
3704
|
}
|
|
3705
|
+
function po() {
|
|
3706
|
+
return /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 cuadra-text-muted-foreground cuadra-text-sm font-brand cuadra-py-2", children: [
|
|
3707
|
+
/* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-1", children: [
|
|
3708
|
+
/* @__PURE__ */ d("span", { className: "cuadra-inline-block cuadra-w-1.5 cuadra-h-1.5 cuadra-bg-current cuadra-rounded-full cuadra-animate-bounce", style: { animationDelay: "0ms" } }),
|
|
3709
|
+
/* @__PURE__ */ d("span", { className: "cuadra-inline-block cuadra-w-1.5 cuadra-h-1.5 cuadra-bg-current cuadra-rounded-full cuadra-animate-bounce", style: { animationDelay: "150ms" } }),
|
|
3710
|
+
/* @__PURE__ */ d("span", { className: "cuadra-inline-block cuadra-w-1.5 cuadra-h-1.5 cuadra-bg-current cuadra-rounded-full cuadra-animate-bounce", style: { animationDelay: "300ms" } })
|
|
3711
|
+
] }),
|
|
3712
|
+
/* @__PURE__ */ d("span", { children: "Thinking..." })
|
|
3713
|
+
] });
|
|
3714
|
+
}
|
|
3697
3715
|
function go() {
|
|
3698
|
-
const [e] =
|
|
3699
|
-
|
|
3716
|
+
const [e] = R(() => ie.getCurrentMessageId()), r = xe(({ message: i }) => i?.status?.type === "running"), t = xe(({ message: i }) => {
|
|
3717
|
+
const o = i?.content;
|
|
3718
|
+
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));
|
|
3719
|
+
}), a = Rr(
|
|
3720
|
+
(i) => ie.subscribe(i),
|
|
3700
3721
|
() => {
|
|
3701
3722
|
if (e) {
|
|
3702
|
-
const
|
|
3703
|
-
if (
|
|
3723
|
+
const i = ie.getForMessage(e);
|
|
3724
|
+
if (i.sources?.length) return i.sources;
|
|
3704
3725
|
}
|
|
3705
3726
|
return ie.get().sources || null;
|
|
3706
3727
|
},
|
|
@@ -3720,17 +3741,18 @@ function go() {
|
|
|
3720
3741
|
be.Parts,
|
|
3721
3742
|
{
|
|
3722
3743
|
components: {
|
|
3723
|
-
Text: ({ text:
|
|
3724
|
-
Reasoning: ({ text:
|
|
3744
|
+
Text: ({ text: i }) => /* @__PURE__ */ d(st, { content: i || "" }),
|
|
3745
|
+
Reasoning: ({ text: i }) => /* @__PURE__ */ d(mo, { text: i || "" })
|
|
3725
3746
|
}
|
|
3726
3747
|
}
|
|
3727
3748
|
),
|
|
3728
|
-
r &&
|
|
3749
|
+
r && !t && /* @__PURE__ */ d(po, {}),
|
|
3750
|
+
a && a.length > 0 && /* @__PURE__ */ d(uo, { sources: a })
|
|
3729
3751
|
]
|
|
3730
3752
|
}
|
|
3731
3753
|
) });
|
|
3732
3754
|
}
|
|
3733
|
-
const
|
|
3755
|
+
const vr = ({ className: e = "", theme: r = "system" }) => {
|
|
3734
3756
|
const t = () => {
|
|
3735
3757
|
if (typeof window > "u") return "light";
|
|
3736
3758
|
if (r === "system") {
|
|
@@ -3738,10 +3760,10 @@ const wr = ({ className: e = "", theme: r = "system" }) => {
|
|
|
3738
3760
|
return n || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
|
|
3739
3761
|
}
|
|
3740
3762
|
return r;
|
|
3741
|
-
}, [a, i] =
|
|
3742
|
-
return
|
|
3763
|
+
}, [a, i] = R(t);
|
|
3764
|
+
return O(() => {
|
|
3743
3765
|
r !== "system" && i(r);
|
|
3744
|
-
}, [r]),
|
|
3766
|
+
}, [r]), O(() => {
|
|
3745
3767
|
const n = document.documentElement;
|
|
3746
3768
|
n.classList.remove("light", "dark"), n.classList.add(a), r === "system" && localStorage.setItem("theme", a);
|
|
3747
3769
|
}, [a, r]), /* @__PURE__ */ d(
|
|
@@ -3755,7 +3777,7 @@ const wr = ({ className: e = "", theme: r = "system" }) => {
|
|
|
3755
3777
|
disabled: r !== "system",
|
|
3756
3778
|
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 disabled:cuadra-opacity-50 disabled:cuadra-cursor-not-allowed ${e}`,
|
|
3757
3779
|
children: /* @__PURE__ */ d(
|
|
3758
|
-
|
|
3780
|
+
ta,
|
|
3759
3781
|
{
|
|
3760
3782
|
className: `cuadra-h-4 cuadra-w-4 cuadra-transition-colors ${a === "dark" ? "cuadra-text-primary" : "cuadra-text-gray-400"}`
|
|
3761
3783
|
}
|
|
@@ -3764,25 +3786,25 @@ const wr = ({ className: e = "", theme: r = "system" }) => {
|
|
|
3764
3786
|
);
|
|
3765
3787
|
};
|
|
3766
3788
|
function bo({ onThreadSelect: e }) {
|
|
3767
|
-
const r =
|
|
3789
|
+
const r = zt(), t = $r((b) => b.threadId), [a, i] = R(null), o = r?.id === t, n = a === r?.id, [u, c] = R(!1), [s, f] = R(r?.title || ""), [l, p] = R(!1), [g, m] = R(!1), x = async () => {
|
|
3768
3790
|
if (!r?.remoteId || !s || s === r.title) {
|
|
3769
3791
|
c(!1);
|
|
3770
3792
|
return;
|
|
3771
3793
|
}
|
|
3772
3794
|
try {
|
|
3773
3795
|
m(!0);
|
|
3774
|
-
const
|
|
3775
|
-
|
|
3796
|
+
const b = window.__cuadraThreadListAdapter;
|
|
3797
|
+
b && typeof b.rename == "function" && await b.rename(r.remoteId, s), c(!1), p(!1);
|
|
3776
3798
|
} catch {
|
|
3777
3799
|
c(!1), p(!1);
|
|
3778
3800
|
} finally {
|
|
3779
3801
|
m(!1);
|
|
3780
3802
|
}
|
|
3781
3803
|
};
|
|
3782
|
-
return
|
|
3804
|
+
return O(() => {
|
|
3783
3805
|
r?.title && !u && f(r.title);
|
|
3784
3806
|
}, [r?.title, u]), r ? /* @__PURE__ */ w(
|
|
3785
|
-
|
|
3807
|
+
qe.Root,
|
|
3786
3808
|
{
|
|
3787
3809
|
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"}`,
|
|
3788
3810
|
style: { marginBottom: "0.5rem" },
|
|
@@ -3790,7 +3812,7 @@ function bo({ onThreadSelect: e }) {
|
|
|
3790
3812
|
onMouseLeave: () => i(null),
|
|
3791
3813
|
children: [
|
|
3792
3814
|
/* @__PURE__ */ d(
|
|
3793
|
-
|
|
3815
|
+
qe.Trigger,
|
|
3794
3816
|
{
|
|
3795
3817
|
className: "cuadra-p-3 cuadra-flex-1 cuadra-flex cuadra-items-center cuadra-min-w-0 cuadra-cursor-pointer",
|
|
3796
3818
|
onClick: () => e?.(),
|
|
@@ -3799,13 +3821,13 @@ function bo({ onThreadSelect: e }) {
|
|
|
3799
3821
|
{
|
|
3800
3822
|
className: "cuadra-flex cuadra-w-full 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-visible:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 font-brand",
|
|
3801
3823
|
value: s,
|
|
3802
|
-
onChange: (
|
|
3803
|
-
onKeyDown: (
|
|
3804
|
-
|
|
3824
|
+
onChange: (b) => f(b.target.value),
|
|
3825
|
+
onKeyDown: (b) => {
|
|
3826
|
+
b.key === "Enter" && x(), b.key === "Escape" && (c(!1), f(r.title || ""));
|
|
3805
3827
|
},
|
|
3806
|
-
disabled:
|
|
3828
|
+
disabled: g,
|
|
3807
3829
|
autoFocus: !0,
|
|
3808
|
-
onClick: (
|
|
3830
|
+
onClick: (b) => b.stopPropagation()
|
|
3809
3831
|
}
|
|
3810
3832
|
) : /* @__PURE__ */ w(J, { children: [
|
|
3811
3833
|
/* @__PURE__ */ d("span", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-truncate font-brand", children: (r.title?.length || 0) > 60 ? `${r.title?.slice(0, 60)}…` : r.title || "Chat" }),
|
|
@@ -3819,11 +3841,11 @@ function bo({ onThreadSelect: e }) {
|
|
|
3819
3841
|
{
|
|
3820
3842
|
type: "button",
|
|
3821
3843
|
className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-background/50 cuadra-transition-colors",
|
|
3822
|
-
onClick: (
|
|
3823
|
-
|
|
3844
|
+
onClick: (b) => {
|
|
3845
|
+
b.stopPropagation(), p(!l);
|
|
3824
3846
|
},
|
|
3825
3847
|
"aria-label": "Thread options",
|
|
3826
|
-
children: /* @__PURE__ */ d(
|
|
3848
|
+
children: /* @__PURE__ */ d(ia, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" })
|
|
3827
3849
|
}
|
|
3828
3850
|
),
|
|
3829
3851
|
l && /* @__PURE__ */ w(J, { children: [
|
|
@@ -3839,10 +3861,10 @@ function bo({ onThreadSelect: e }) {
|
|
|
3839
3861
|
{
|
|
3840
3862
|
type: "button",
|
|
3841
3863
|
className: "cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left hover:cuadra-bg-muted cuadra-transition-colors font-brand",
|
|
3842
|
-
onClick: (
|
|
3843
|
-
|
|
3864
|
+
onClick: (b) => {
|
|
3865
|
+
b.stopPropagation(), x();
|
|
3844
3866
|
},
|
|
3845
|
-
disabled:
|
|
3867
|
+
disabled: g,
|
|
3846
3868
|
children: "Save"
|
|
3847
3869
|
}
|
|
3848
3870
|
) : /* @__PURE__ */ w(J, { children: [
|
|
@@ -3851,20 +3873,20 @@ function bo({ onThreadSelect: e }) {
|
|
|
3851
3873
|
{
|
|
3852
3874
|
type: "button",
|
|
3853
3875
|
className: "cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left hover:cuadra-bg-muted cuadra-transition-colors font-brand",
|
|
3854
|
-
onClick: (
|
|
3855
|
-
|
|
3876
|
+
onClick: (b) => {
|
|
3877
|
+
b.stopPropagation(), c(!0), f(r.title || ""), p(!1);
|
|
3856
3878
|
},
|
|
3857
3879
|
children: "Rename"
|
|
3858
3880
|
}
|
|
3859
3881
|
),
|
|
3860
3882
|
/* @__PURE__ */ d("div", { className: "cuadra-border-t cuadra-border-border" }),
|
|
3861
|
-
/* @__PURE__ */ d(
|
|
3883
|
+
/* @__PURE__ */ d(qe.Delete, { asChild: !0, children: /* @__PURE__ */ d(
|
|
3862
3884
|
"button",
|
|
3863
3885
|
{
|
|
3864
3886
|
type: "button",
|
|
3865
3887
|
className: "cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left cuadra-text-destructive hover:cuadra-bg-muted cuadra-transition-colors font-brand",
|
|
3866
|
-
onClick: (
|
|
3867
|
-
|
|
3888
|
+
onClick: (b) => {
|
|
3889
|
+
b.stopPropagation(), p(!1);
|
|
3868
3890
|
},
|
|
3869
3891
|
children: "Delete"
|
|
3870
3892
|
}
|
|
@@ -3876,13 +3898,13 @@ function bo({ onThreadSelect: e }) {
|
|
|
3876
3898
|
}
|
|
3877
3899
|
) : null;
|
|
3878
3900
|
}
|
|
3879
|
-
function
|
|
3901
|
+
function Et({
|
|
3880
3902
|
onThreadSelect: e,
|
|
3881
3903
|
showThemeToggle: r,
|
|
3882
3904
|
theme: t,
|
|
3883
3905
|
onLogout: a
|
|
3884
3906
|
}) {
|
|
3885
|
-
return /* @__PURE__ */ w(
|
|
3907
|
+
return /* @__PURE__ */ w(He.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: [
|
|
3886
3908
|
/* @__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(
|
|
3887
3909
|
"button",
|
|
3888
3910
|
{
|
|
@@ -3890,24 +3912,24 @@ function _t({
|
|
|
3890
3912
|
onClick: e,
|
|
3891
3913
|
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",
|
|
3892
3914
|
"aria-label": "Close",
|
|
3893
|
-
children: /* @__PURE__ */ d(
|
|
3915
|
+
children: /* @__PURE__ */ d(nt, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
|
|
3894
3916
|
}
|
|
3895
3917
|
) }),
|
|
3896
3918
|
/* @__PURE__ */ w("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin", children: [
|
|
3897
3919
|
/* @__PURE__ */ d(
|
|
3898
|
-
|
|
3920
|
+
He.New,
|
|
3899
3921
|
{
|
|
3900
3922
|
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",
|
|
3901
3923
|
onClick: () => e?.(),
|
|
3902
3924
|
children: /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-min-w-0", children: /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
|
|
3903
|
-
/* @__PURE__ */ d(
|
|
3925
|
+
/* @__PURE__ */ d(ya, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
|
|
3904
3926
|
/* @__PURE__ */ d("h4", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground font-brand", children: "New Chat" })
|
|
3905
3927
|
] }) })
|
|
3906
3928
|
}
|
|
3907
3929
|
),
|
|
3908
3930
|
/* @__PURE__ */ d("div", { className: "cuadra-my-2 cuadra-border-t cuadra-border-border" }),
|
|
3909
3931
|
/* @__PURE__ */ d(
|
|
3910
|
-
|
|
3932
|
+
He.Items,
|
|
3911
3933
|
{
|
|
3912
3934
|
components: {
|
|
3913
3935
|
ThreadListItem: (i) => /* @__PURE__ */ d(bo, { ...i, onThreadSelect: e })
|
|
@@ -3923,10 +3945,10 @@ function _t({
|
|
|
3923
3945
|
onClick: a,
|
|
3924
3946
|
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",
|
|
3925
3947
|
"aria-label": "Logout",
|
|
3926
|
-
children: /* @__PURE__ */ d(
|
|
3948
|
+
children: /* @__PURE__ */ d(ha, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
|
|
3927
3949
|
}
|
|
3928
3950
|
),
|
|
3929
|
-
r && /* @__PURE__ */ d(
|
|
3951
|
+
r && /* @__PURE__ */ d(vr, { theme: t })
|
|
3930
3952
|
] })
|
|
3931
3953
|
] });
|
|
3932
3954
|
}
|
|
@@ -3934,7 +3956,7 @@ const yo = `
|
|
|
3934
3956
|
@keyframes rotate {
|
|
3935
3957
|
100% { transform: rotate(1turn); }
|
|
3936
3958
|
}
|
|
3937
|
-
`,
|
|
3959
|
+
`, Ge = ({
|
|
3938
3960
|
children: e,
|
|
3939
3961
|
className: r = "",
|
|
3940
3962
|
paddingX: t = "px-0",
|
|
@@ -3989,7 +4011,7 @@ const yo = `
|
|
|
3989
4011
|
]
|
|
3990
4012
|
}
|
|
3991
4013
|
)
|
|
3992
|
-
] }),
|
|
4014
|
+
] }), Ft = ({
|
|
3993
4015
|
currentModel: e,
|
|
3994
4016
|
models: r,
|
|
3995
4017
|
modelsLoading: t,
|
|
@@ -4001,17 +4023,17 @@ const yo = `
|
|
|
4001
4023
|
onMobileMenuClick: c,
|
|
4002
4024
|
showMobileMenuButton: s = !1
|
|
4003
4025
|
}) => {
|
|
4004
|
-
const [f, l] =
|
|
4005
|
-
|
|
4006
|
-
const
|
|
4026
|
+
const [f, l] = R(!1), [p, g] = R(!1), m = de(null);
|
|
4027
|
+
O(() => {
|
|
4028
|
+
const y = (k) => {
|
|
4007
4029
|
m.current && !m.current.contains(k.target) && l(!1);
|
|
4008
4030
|
};
|
|
4009
|
-
return f && document.addEventListener("mousedown",
|
|
4010
|
-
document.removeEventListener("mousedown",
|
|
4031
|
+
return f && document.addEventListener("mousedown", y), () => {
|
|
4032
|
+
document.removeEventListener("mousedown", y);
|
|
4011
4033
|
};
|
|
4012
4034
|
}, [f]);
|
|
4013
|
-
const x = r.find((
|
|
4014
|
-
i(
|
|
4035
|
+
const x = r.find((y) => y.id === e), b = (y) => {
|
|
4036
|
+
i(y), l(!1), g(!1);
|
|
4015
4037
|
};
|
|
4016
4038
|
return /* @__PURE__ */ w("div", { className: "cuadra-h-16 cuadra-px-4 cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-between cuadra-bg-background", children: [
|
|
4017
4039
|
/* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
|
|
@@ -4022,10 +4044,10 @@ const yo = `
|
|
|
4022
4044
|
onClick: c,
|
|
4023
4045
|
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 disabled:cuadra-opacity-50 disabled:cuadra-cursor-not-allowed md:cuadra-hidden",
|
|
4024
4046
|
"aria-label": "Toggle thread list",
|
|
4025
|
-
children: /* @__PURE__ */ d(
|
|
4047
|
+
children: /* @__PURE__ */ d(pa, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
|
|
4026
4048
|
}
|
|
4027
4049
|
),
|
|
4028
|
-
n && /* @__PURE__ */ d("div", { className: "cuadra-hidden md:cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d(
|
|
4050
|
+
n && /* @__PURE__ */ d("div", { className: "cuadra-hidden md:cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d(vr, { theme: u }) })
|
|
4029
4051
|
] }),
|
|
4030
4052
|
/* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 md:cuadra-ml-0 cuadra-ml-auto", children: [
|
|
4031
4053
|
!o && /* @__PURE__ */ d("label", { className: "cuadra-hidden md:cuadra-inline cuadra-text-sm cuadra-text-muted-foreground cuadra-font-brand", children: "Model" }),
|
|
@@ -4040,18 +4062,18 @@ const yo = `
|
|
|
4040
4062
|
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",
|
|
4041
4063
|
children: [
|
|
4042
4064
|
/* @__PURE__ */ d("span", { className: x ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: x?.name || "Select model" }),
|
|
4043
|
-
/* @__PURE__ */ d(
|
|
4065
|
+
/* @__PURE__ */ d(et, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
|
|
4044
4066
|
]
|
|
4045
4067
|
}
|
|
4046
4068
|
),
|
|
4047
|
-
f && r.length > 0 && /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-z-50 cuadra-mt-1 cuadra-w-full cuadra-min-w-[8rem] cuadra-overflow-hidden cuadra-rounded-md glass-popover cuadra-text-popover-foreground cuadra-animate-in fade-in-80 cuadra-border cuadra-border-border cuadra-bg-popover cuadra-shadow-md", children: /* @__PURE__ */ d("div", { className: "cuadra-p-1", children: r.map((
|
|
4069
|
+
f && r.length > 0 && /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-z-50 cuadra-mt-1 cuadra-w-full cuadra-min-w-[8rem] cuadra-overflow-hidden cuadra-rounded-md glass-popover cuadra-text-popover-foreground cuadra-animate-in fade-in-80 cuadra-border cuadra-border-border cuadra-bg-popover cuadra-shadow-md", children: /* @__PURE__ */ d("div", { className: "cuadra-p-1", children: r.map((y) => /* @__PURE__ */ w(
|
|
4048
4070
|
"button",
|
|
4049
4071
|
{
|
|
4050
4072
|
type: "button",
|
|
4051
|
-
onClick: () =>
|
|
4052
|
-
className: `cuadra-relative cuadra-flex cuadra-w-full cuadra-cursor-pointer cuadra-select-none cuadra-items-center cuadra-rounded-sm cuadra-py-1.5 cuadra-pl-8 cuadra-pr-2 cuadra-text-sm cuadra-outline-none focus:cuadra-bg-secondary focus:cuadra-text-secondary-foreground font-brand cuadra-transition-colors ${e ===
|
|
4073
|
+
onClick: () => b(y.id),
|
|
4074
|
+
className: `cuadra-relative cuadra-flex cuadra-w-full cuadra-cursor-pointer cuadra-select-none cuadra-items-center cuadra-rounded-sm cuadra-py-1.5 cuadra-pl-8 cuadra-pr-2 cuadra-text-sm cuadra-outline-none focus:cuadra-bg-secondary focus:cuadra-text-secondary-foreground font-brand cuadra-transition-colors ${e === y.id ? "cuadra-bg-secondary cuadra-text-secondary-foreground" : "hover:cuadra-bg-secondary/50"}`,
|
|
4053
4075
|
children: [
|
|
4054
|
-
e ===
|
|
4076
|
+
e === y.id && /* @__PURE__ */ d("span", { className: "cuadra-absolute cuadra-left-2 cuadra-flex cuadra-h-3.5 cuadra-w-3.5 cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ d(
|
|
4055
4077
|
"svg",
|
|
4056
4078
|
{
|
|
4057
4079
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4070,32 +4092,32 @@ const yo = `
|
|
|
4070
4092
|
)
|
|
4071
4093
|
}
|
|
4072
4094
|
) }),
|
|
4073
|
-
/* @__PURE__ */ d("span", { children:
|
|
4095
|
+
/* @__PURE__ */ d("span", { children: y.name })
|
|
4074
4096
|
]
|
|
4075
4097
|
},
|
|
4076
|
-
|
|
4098
|
+
y.id
|
|
4077
4099
|
)) }) })
|
|
4078
4100
|
] }),
|
|
4079
4101
|
/* @__PURE__ */ w(
|
|
4080
4102
|
"button",
|
|
4081
4103
|
{
|
|
4082
4104
|
type: "button",
|
|
4083
|
-
onClick: () =>
|
|
4105
|
+
onClick: () => g(!0),
|
|
4084
4106
|
disabled: t || r.length === 0 || !!a,
|
|
4085
4107
|
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",
|
|
4086
4108
|
children: [
|
|
4087
4109
|
/* @__PURE__ */ d("span", { className: x ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: x?.name || "Select model" }),
|
|
4088
|
-
/* @__PURE__ */ d(
|
|
4110
|
+
/* @__PURE__ */ d(et, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
|
|
4089
4111
|
]
|
|
4090
4112
|
}
|
|
4091
4113
|
),
|
|
4092
|
-
p && typeof document < "u" &&
|
|
4114
|
+
p && typeof document < "u" && Ye(
|
|
4093
4115
|
/* @__PURE__ */ w(J, { children: [
|
|
4094
4116
|
/* @__PURE__ */ d(
|
|
4095
4117
|
"div",
|
|
4096
4118
|
{
|
|
4097
4119
|
className: "cuadra-fixed cuadra-inset-0 cuadra-bg-black/50 cuadra-z-50 md:cuadra-hidden",
|
|
4098
|
-
onClick: () =>
|
|
4120
|
+
onClick: () => g(!1)
|
|
4099
4121
|
}
|
|
4100
4122
|
),
|
|
4101
4123
|
/* @__PURE__ */ w("div", { className: "cuadra-fixed cuadra-inset-0 cuadra-z-50 cuadra-flex cuadra-flex-col cuadra-bg-background md:cuadra-hidden", children: [
|
|
@@ -4105,22 +4127,22 @@ const yo = `
|
|
|
4105
4127
|
"button",
|
|
4106
4128
|
{
|
|
4107
4129
|
type: "button",
|
|
4108
|
-
onClick: () =>
|
|
4130
|
+
onClick: () => g(!1),
|
|
4109
4131
|
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",
|
|
4110
4132
|
"aria-label": "Close",
|
|
4111
|
-
children: /* @__PURE__ */ d(
|
|
4133
|
+
children: /* @__PURE__ */ d(nt, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
|
|
4112
4134
|
}
|
|
4113
4135
|
)
|
|
4114
4136
|
] }),
|
|
4115
|
-
/* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-4", children: t ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading models..." }) }) : a ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : r.length === 0 ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "No models available" }) }) : /* @__PURE__ */ d("div", { className: "cuadra-space-y-2", children: r.map((
|
|
4137
|
+
/* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-4", children: t ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading models..." }) }) : a ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : r.length === 0 ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "No models available" }) }) : /* @__PURE__ */ d("div", { className: "cuadra-space-y-2", children: r.map((y) => /* @__PURE__ */ w(
|
|
4116
4138
|
"button",
|
|
4117
4139
|
{
|
|
4118
4140
|
type: "button",
|
|
4119
|
-
onClick: () =>
|
|
4120
|
-
className: `cuadra-w-full cuadra-flex cuadra-items-center cuadra-justify-between cuadra-rounded-lg cuadra-border cuadra-px-4 cuadra-py-4 cuadra-text-left cuadra-transition-colors font-brand cuadra-bg-background cuadra-text-foreground cuadra-border-border hover:cuadra-bg-muted ${e ===
|
|
4141
|
+
onClick: () => b(y.id),
|
|
4142
|
+
className: `cuadra-w-full cuadra-flex cuadra-items-center cuadra-justify-between cuadra-rounded-lg cuadra-border cuadra-px-4 cuadra-py-4 cuadra-text-left cuadra-transition-colors font-brand cuadra-bg-background cuadra-text-foreground cuadra-border-border hover:cuadra-bg-muted ${e === y.id ? "cuadra-border-primary" : ""}`,
|
|
4121
4143
|
children: [
|
|
4122
|
-
/* @__PURE__ */ d("span", { className: "cuadra-text-base cuadra-font-normal", children:
|
|
4123
|
-
e ===
|
|
4144
|
+
/* @__PURE__ */ d("span", { className: "cuadra-text-base cuadra-font-normal", children: y.name }),
|
|
4145
|
+
e === y.id && /* @__PURE__ */ d(
|
|
4124
4146
|
"svg",
|
|
4125
4147
|
{
|
|
4126
4148
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4142,7 +4164,7 @@ const yo = `
|
|
|
4142
4164
|
)
|
|
4143
4165
|
]
|
|
4144
4166
|
},
|
|
4145
|
-
|
|
4167
|
+
y.id
|
|
4146
4168
|
)) }) })
|
|
4147
4169
|
] })
|
|
4148
4170
|
] }),
|
|
@@ -4151,9 +4173,9 @@ const yo = `
|
|
|
4151
4173
|
] })
|
|
4152
4174
|
] })
|
|
4153
4175
|
] });
|
|
4154
|
-
}, xo =
|
|
4176
|
+
}, xo = Dr(void 0), Ze = ({ children: e, value: r }) => /* @__PURE__ */ d(xo.Provider, { value: r, children: e });
|
|
4155
4177
|
function ko() {
|
|
4156
|
-
|
|
4178
|
+
O(() => {
|
|
4157
4179
|
if (document.querySelector("style[data-cuadra-uikit]"))
|
|
4158
4180
|
return;
|
|
4159
4181
|
const r = document.createElement("div");
|
|
@@ -4175,7 +4197,7 @@ function ko() {
|
|
|
4175
4197
|
}, document.head.appendChild(a), o) break;
|
|
4176
4198
|
}, []);
|
|
4177
4199
|
}
|
|
4178
|
-
const wo =
|
|
4200
|
+
const wo = ve(
|
|
4179
4201
|
function({ config: r }, t) {
|
|
4180
4202
|
ko();
|
|
4181
4203
|
const a = de(null), i = de(!1), {
|
|
@@ -4187,181 +4209,183 @@ const wo = we(
|
|
|
4187
4209
|
modelId: f,
|
|
4188
4210
|
onModelChange: l,
|
|
4189
4211
|
ephemeral: p = !1,
|
|
4190
|
-
systemPrompt:
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4212
|
+
systemPrompt: g,
|
|
4213
|
+
enableReasoning: m = !1,
|
|
4214
|
+
initialThreadId: x,
|
|
4215
|
+
welcomeTitle: b,
|
|
4216
|
+
welcomeSubtitle: y,
|
|
4217
|
+
extraTopPadding: k,
|
|
4218
|
+
suggestions: T,
|
|
4219
|
+
inputPlaceholder: L,
|
|
4220
|
+
preMadeResponseDelay: I = 1e3,
|
|
4221
|
+
streamingSpeed: C = 50,
|
|
4222
|
+
showThemeToggle: D = !0,
|
|
4200
4223
|
initialMessage: A,
|
|
4201
4224
|
initialPreMadeQA: N,
|
|
4202
|
-
theme:
|
|
4203
|
-
onError:
|
|
4204
|
-
onChatCreated:
|
|
4225
|
+
theme: h = "system",
|
|
4226
|
+
onError: _,
|
|
4227
|
+
onChatCreated: H,
|
|
4205
4228
|
onUserMessage: W,
|
|
4206
|
-
onThreadIdUpdate:
|
|
4207
|
-
onLogout:
|
|
4208
|
-
enableAttachments:
|
|
4229
|
+
onThreadIdUpdate: te,
|
|
4230
|
+
onLogout: Te,
|
|
4231
|
+
enableAttachments: q = !1,
|
|
4209
4232
|
onBeforeRequest: v
|
|
4210
4233
|
} = r;
|
|
4211
|
-
|
|
4212
|
-
sendMessage: (
|
|
4213
|
-
a.current?.sendMessage(
|
|
4234
|
+
at(t, () => ({
|
|
4235
|
+
sendMessage: (M) => {
|
|
4236
|
+
a.current?.sendMessage(M);
|
|
4214
4237
|
},
|
|
4215
|
-
sendPreMadeQA: (
|
|
4216
|
-
a.current?.sendPreMadeQA(
|
|
4238
|
+
sendPreMadeQA: (M, F, z) => {
|
|
4239
|
+
a.current?.sendPreMadeQA(M, F, z);
|
|
4217
4240
|
},
|
|
4218
4241
|
clearChat: () => {
|
|
4219
4242
|
a.current?.clearChat();
|
|
4220
4243
|
}
|
|
4221
|
-
}), []),
|
|
4244
|
+
}), []), O(() => {
|
|
4222
4245
|
if (i.current) return;
|
|
4223
|
-
const
|
|
4246
|
+
const M = setTimeout(() => {
|
|
4224
4247
|
N ? (i.current = !0, a.current?.sendPreMadeQA(
|
|
4225
4248
|
N.question,
|
|
4226
4249
|
N.answer,
|
|
4227
|
-
{ delay:
|
|
4250
|
+
{ delay: I, streamingSpeed: C }
|
|
4228
4251
|
)) : A && (i.current = !0, a.current?.sendMessage(A));
|
|
4229
4252
|
}, 500);
|
|
4230
|
-
return () => clearTimeout(
|
|
4231
|
-
}, [A, N,
|
|
4232
|
-
const [
|
|
4233
|
-
if (
|
|
4234
|
-
if (
|
|
4235
|
-
const
|
|
4236
|
-
if (
|
|
4253
|
+
return () => clearTimeout(M);
|
|
4254
|
+
}, [A, N, I, C]);
|
|
4255
|
+
const [S, $] = R(!1), [E, ee] = R(null), [P, re] = R(null), [ce, Oe] = R(!1), Ue = de(null), Me = (M) => {
|
|
4256
|
+
if (M < 30) return !0;
|
|
4257
|
+
if (Ue.current) {
|
|
4258
|
+
const F = Ue.current.getBoundingClientRect();
|
|
4259
|
+
if (M - F.left < 30) return !0;
|
|
4237
4260
|
}
|
|
4238
4261
|
return !1;
|
|
4239
|
-
},
|
|
4240
|
-
const
|
|
4241
|
-
(
|
|
4242
|
-
},
|
|
4243
|
-
if (
|
|
4244
|
-
const
|
|
4245
|
-
re(
|
|
4246
|
-
},
|
|
4247
|
-
if (
|
|
4248
|
-
|
|
4262
|
+
}, lt = (M) => {
|
|
4263
|
+
const z = M.touches[0].clientX;
|
|
4264
|
+
(Me(z) || S) && (ee(z), re(z), Oe(!0));
|
|
4265
|
+
}, dt = (M) => {
|
|
4266
|
+
if (E === null || !ce) return;
|
|
4267
|
+
const F = M.touches[0];
|
|
4268
|
+
re(F.clientX);
|
|
4269
|
+
}, ft = () => {
|
|
4270
|
+
if (E === null || P === null) {
|
|
4271
|
+
Oe(!1);
|
|
4249
4272
|
return;
|
|
4250
4273
|
}
|
|
4251
|
-
const
|
|
4252
|
-
|
|
4253
|
-
},
|
|
4254
|
-
if (ce &&
|
|
4255
|
-
const
|
|
4256
|
-
if (
|
|
4257
|
-
return `translateX(${Math.min(0,
|
|
4258
|
-
if (
|
|
4259
|
-
return `translateX(${Math.min(0, -320 +
|
|
4274
|
+
const M = P - E, F = 50, z = 0.3, xt = Math.abs(M) / 300;
|
|
4275
|
+
M > F && !S && E !== null ? Me(E) && $(!0) : ((M < -F || M < 0 && xt > z) && S || S && M < -20 && xt > z) && $(!1), ee(null), re(null), Oe(!1);
|
|
4276
|
+
}, Tr = () => {
|
|
4277
|
+
if (ce && E !== null && P !== null) {
|
|
4278
|
+
const M = P - E;
|
|
4279
|
+
if (S)
|
|
4280
|
+
return `translateX(${Math.min(0, M)}px)`;
|
|
4281
|
+
if (E !== null && Me(E))
|
|
4282
|
+
return `translateX(${Math.min(0, -320 + M)}px)`;
|
|
4260
4283
|
}
|
|
4261
|
-
return
|
|
4284
|
+
return S ? "translateX(0)" : "translateX(-100%)";
|
|
4262
4285
|
}, Mr = () => {
|
|
4263
|
-
if (!ce ||
|
|
4264
|
-
return
|
|
4265
|
-
const
|
|
4266
|
-
return
|
|
4267
|
-
},
|
|
4268
|
-
() => new
|
|
4269
|
-
[
|
|
4270
|
-
), [ue,
|
|
4271
|
-
|
|
4272
|
-
c === "multiChat" &&
|
|
4286
|
+
if (!ce || E === null || P === null)
|
|
4287
|
+
return S ? 0.5 : 0;
|
|
4288
|
+
const F = P - E;
|
|
4289
|
+
return S ? Math.max(0, Math.min(1, (320 + F) / 320)) * 0.5 : E !== null && Me(E) ? Math.max(0, Math.min(1, (F + 320) / 320)) * 0.5 : 0;
|
|
4290
|
+
}, Ae = n || o || "", Ne = !!n, ht = V(
|
|
4291
|
+
() => new Ht(Ae, u || void 0, Ne),
|
|
4292
|
+
[Ae, u, Ne]
|
|
4293
|
+
), [ue, Ar] = R(null), [he, mt] = R(!1), [me, pt] = R(null), [Nr, gt] = R(!1);
|
|
4294
|
+
O(() => {
|
|
4295
|
+
c === "multiChat" && gt(!0);
|
|
4273
4296
|
}, [c]);
|
|
4274
|
-
const se =
|
|
4297
|
+
const se = X(async () => {
|
|
4275
4298
|
if (s === "selector") {
|
|
4276
|
-
|
|
4299
|
+
mt(!0), pt(null);
|
|
4277
4300
|
try {
|
|
4278
|
-
const
|
|
4279
|
-
|
|
4280
|
-
} catch (
|
|
4281
|
-
|
|
4301
|
+
const M = await ht.listModels();
|
|
4302
|
+
Ar(M);
|
|
4303
|
+
} catch (M) {
|
|
4304
|
+
pt(M instanceof Error ? M : new Error("Failed to load models"));
|
|
4282
4305
|
} finally {
|
|
4283
|
-
|
|
4306
|
+
mt(!1);
|
|
4284
4307
|
}
|
|
4285
4308
|
}
|
|
4286
|
-
}, [
|
|
4287
|
-
|
|
4309
|
+
}, [ht, s]);
|
|
4310
|
+
O(() => {
|
|
4288
4311
|
s === "selector" && se();
|
|
4289
|
-
}, [s, se]),
|
|
4312
|
+
}, [s, se]), O(() => (typeof window < "u" && (window.__cuadraUIKitRefetchModels = se), () => {
|
|
4290
4313
|
typeof window < "u" && delete window.__cuadraUIKitRefetchModels;
|
|
4291
4314
|
}), [se]);
|
|
4292
|
-
const [Q,
|
|
4315
|
+
const [Q, bt] = R(
|
|
4293
4316
|
s === "fixed" && f || null
|
|
4294
|
-
),
|
|
4295
|
-
(
|
|
4296
|
-
const
|
|
4297
|
-
|
|
4298
|
-
const
|
|
4299
|
-
if (
|
|
4317
|
+
), yt = de(Q), pe = X(
|
|
4318
|
+
(M) => {
|
|
4319
|
+
const F = yt.current;
|
|
4320
|
+
bt(M), yt.current = M, l?.(M), F !== null && F !== M && c === "multiChat" && setTimeout(() => {
|
|
4321
|
+
const z = window.__cuadraThreadListRuntime;
|
|
4322
|
+
if (z?.threads?.switchToNewThread)
|
|
4300
4323
|
try {
|
|
4301
|
-
|
|
4324
|
+
z.threads.switchToNewThread();
|
|
4302
4325
|
} catch {
|
|
4303
4326
|
}
|
|
4304
|
-
else if (
|
|
4327
|
+
else if (z?.threads?.createThread)
|
|
4305
4328
|
try {
|
|
4306
|
-
|
|
4329
|
+
z.threads.createThread();
|
|
4307
4330
|
} catch {
|
|
4308
4331
|
}
|
|
4309
|
-
else if (
|
|
4332
|
+
else if (z?.switchToNewThread)
|
|
4310
4333
|
try {
|
|
4311
|
-
|
|
4334
|
+
z.switchToNewThread();
|
|
4312
4335
|
} catch {
|
|
4313
4336
|
}
|
|
4314
4337
|
}, 100);
|
|
4315
4338
|
},
|
|
4316
4339
|
[l, c]
|
|
4317
4340
|
);
|
|
4318
|
-
|
|
4341
|
+
O(() => {
|
|
4319
4342
|
if (s === "selector" && ue?.items && ue.items.length > 0 && !Q) {
|
|
4320
|
-
const
|
|
4321
|
-
if (
|
|
4322
|
-
const
|
|
4323
|
-
|
|
4343
|
+
const M = ue.items[0];
|
|
4344
|
+
if (M?.id) {
|
|
4345
|
+
const F = M.id;
|
|
4346
|
+
bt(F), l?.(F);
|
|
4324
4347
|
}
|
|
4325
4348
|
}
|
|
4326
4349
|
}, [s, ue?.items, Q, l]);
|
|
4327
|
-
const
|
|
4328
|
-
() => (ue?.items || []).filter((
|
|
4350
|
+
const Ir = s === "fixed" ? !!f : !!Q, Ie = V(
|
|
4351
|
+
() => (ue?.items || []).filter((M) => M?.id && M?.displayName).map((M) => ({ id: M.id, name: M.displayName })),
|
|
4329
4352
|
[ue]
|
|
4330
|
-
),
|
|
4353
|
+
), Be = V(
|
|
4331
4354
|
() => ({
|
|
4332
4355
|
currentModelId: Q || "",
|
|
4333
|
-
models:
|
|
4356
|
+
models: Ie,
|
|
4334
4357
|
modelsLoading: he,
|
|
4335
4358
|
modelsError: me,
|
|
4336
4359
|
onModelChange: pe,
|
|
4337
4360
|
refetchModels: se
|
|
4338
4361
|
}),
|
|
4339
|
-
[Q,
|
|
4362
|
+
[Q, Ie, he, me, pe, se]
|
|
4340
4363
|
);
|
|
4341
|
-
return s === "selector" && he || c === "multiChat" &&
|
|
4342
|
-
|
|
4364
|
+
return s === "selector" && he || c === "multiChat" && Nr ? /* @__PURE__ */ d(Ze, { value: Be, children: /* @__PURE__ */ d(Ge, { 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(Bt, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }) }) }) }) : s === "selector" && !Ir && me ? /* @__PURE__ */ d(Ze, { value: Be, children: /* @__PURE__ */ d(Ge, { 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(Ze, { value: Be, children: /* @__PURE__ */ d(
|
|
4365
|
+
Aa,
|
|
4343
4366
|
{
|
|
4344
|
-
baseUrl:
|
|
4367
|
+
baseUrl: Ne ? Ae : o || Ae,
|
|
4345
4368
|
sessionToken: u,
|
|
4346
|
-
isProxyMode:
|
|
4369
|
+
isProxyMode: Ne,
|
|
4347
4370
|
mode: c,
|
|
4348
4371
|
modelMode: s,
|
|
4349
4372
|
modelId: Q || f || void 0,
|
|
4350
4373
|
onModelChange: pe,
|
|
4351
4374
|
ephemeral: p,
|
|
4352
|
-
systemPrompt:
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4375
|
+
systemPrompt: g,
|
|
4376
|
+
enableReasoning: m,
|
|
4377
|
+
initialThreadId: x,
|
|
4378
|
+
enableAttachments: q,
|
|
4379
|
+
onError: _,
|
|
4380
|
+
onChatCreated: H,
|
|
4357
4381
|
onUserMessage: W,
|
|
4358
|
-
onThreadIdUpdate:
|
|
4382
|
+
onThreadIdUpdate: te,
|
|
4359
4383
|
onBeforeRequest: v,
|
|
4360
4384
|
onChatsLoaded: () => {
|
|
4361
|
-
c === "multiChat" &&
|
|
4385
|
+
c === "multiChat" && gt(!1);
|
|
4362
4386
|
},
|
|
4363
4387
|
children: /* @__PURE__ */ d(
|
|
4364
|
-
|
|
4388
|
+
Ge,
|
|
4365
4389
|
{
|
|
4366
4390
|
paddingX: "cuadra-px-0",
|
|
4367
4391
|
paddingY: "cuadra-py-0",
|
|
@@ -4373,17 +4397,17 @@ const wo = we(
|
|
|
4373
4397
|
{
|
|
4374
4398
|
className: "cuadra-h-full cuadra-flex cuadra-relative",
|
|
4375
4399
|
style: { height: "100%" },
|
|
4376
|
-
onTouchStart:
|
|
4377
|
-
onTouchMove:
|
|
4378
|
-
onTouchEnd:
|
|
4400
|
+
onTouchStart: lt,
|
|
4401
|
+
onTouchMove: dt,
|
|
4402
|
+
onTouchEnd: ft,
|
|
4379
4403
|
children: c === "multiChat" ? /* @__PURE__ */ w(J, { children: [
|
|
4380
|
-
typeof document < "u" &&
|
|
4404
|
+
typeof document < "u" && Ye(
|
|
4381
4405
|
/* @__PURE__ */ d(
|
|
4382
4406
|
"div",
|
|
4383
4407
|
{
|
|
4384
|
-
className: `cuadra-fixed cuadra-inset-0 cuadra-bg-black cuadra-z-40 md:cuadra-hidden cuadra-transition-opacity cuadra-duration-300 ${
|
|
4408
|
+
className: `cuadra-fixed cuadra-inset-0 cuadra-bg-black cuadra-z-40 md:cuadra-hidden cuadra-transition-opacity cuadra-duration-300 ${S || ce ? "" : "cuadra-pointer-events-none"}`,
|
|
4385
4409
|
style: { opacity: Mr() },
|
|
4386
|
-
onClick: () =>
|
|
4410
|
+
onClick: () => $(!1)
|
|
4387
4411
|
}
|
|
4388
4412
|
),
|
|
4389
4413
|
document.body
|
|
@@ -4395,36 +4419,36 @@ const wo = we(
|
|
|
4395
4419
|
className: "cuadra-hidden md:cuadra-block !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 cuadra-relative",
|
|
4396
4420
|
style: { borderRightWidth: "1px", height: "100%" },
|
|
4397
4421
|
children: /* @__PURE__ */ d(
|
|
4398
|
-
|
|
4422
|
+
Et,
|
|
4399
4423
|
{
|
|
4400
|
-
onThreadSelect: () =>
|
|
4401
|
-
showThemeToggle:
|
|
4402
|
-
theme:
|
|
4403
|
-
onLogout:
|
|
4424
|
+
onThreadSelect: () => $(!1),
|
|
4425
|
+
showThemeToggle: D,
|
|
4426
|
+
theme: h,
|
|
4427
|
+
onLogout: Te
|
|
4404
4428
|
}
|
|
4405
4429
|
)
|
|
4406
4430
|
}
|
|
4407
4431
|
),
|
|
4408
|
-
typeof document < "u" &&
|
|
4432
|
+
typeof document < "u" && Ye(
|
|
4409
4433
|
/* @__PURE__ */ d(
|
|
4410
4434
|
"div",
|
|
4411
4435
|
{
|
|
4412
|
-
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 ${
|
|
4436
|
+
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 ${S || ce ? "" : "cuadra-pointer-events-none"}`,
|
|
4413
4437
|
style: {
|
|
4414
4438
|
borderRightWidth: "1px",
|
|
4415
|
-
transform:
|
|
4439
|
+
transform: Tr(),
|
|
4416
4440
|
transition: ce ? "none" : "transform 0.3s ease-in-out"
|
|
4417
4441
|
},
|
|
4418
|
-
onTouchStart:
|
|
4419
|
-
onTouchMove:
|
|
4420
|
-
onTouchEnd:
|
|
4442
|
+
onTouchStart: lt,
|
|
4443
|
+
onTouchMove: dt,
|
|
4444
|
+
onTouchEnd: ft,
|
|
4421
4445
|
children: /* @__PURE__ */ d(
|
|
4422
|
-
|
|
4446
|
+
Et,
|
|
4423
4447
|
{
|
|
4424
|
-
onThreadSelect: () =>
|
|
4425
|
-
showThemeToggle:
|
|
4426
|
-
theme:
|
|
4427
|
-
onLogout:
|
|
4448
|
+
onThreadSelect: () => $(!1),
|
|
4449
|
+
showThemeToggle: D,
|
|
4450
|
+
theme: h,
|
|
4451
|
+
onLogout: Te
|
|
4428
4452
|
}
|
|
4429
4453
|
)
|
|
4430
4454
|
}
|
|
@@ -4432,60 +4456,60 @@ const wo = we(
|
|
|
4432
4456
|
document.body
|
|
4433
4457
|
)
|
|
4434
4458
|
] }),
|
|
4435
|
-
/* @__PURE__ */ w("div", { ref:
|
|
4459
|
+
/* @__PURE__ */ w("div", { ref: Ue, className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
|
|
4436
4460
|
s === "selector" && /* @__PURE__ */ d(
|
|
4437
|
-
|
|
4461
|
+
Ft,
|
|
4438
4462
|
{
|
|
4439
4463
|
currentModel: Q || "",
|
|
4440
|
-
models:
|
|
4464
|
+
models: Ie,
|
|
4441
4465
|
modelsLoading: he,
|
|
4442
4466
|
modelsError: me,
|
|
4443
4467
|
onModelChange: pe,
|
|
4444
|
-
showThemeToggle:
|
|
4445
|
-
theme:
|
|
4446
|
-
onMobileMenuClick: () =>
|
|
4468
|
+
showThemeToggle: D,
|
|
4469
|
+
theme: h,
|
|
4470
|
+
onMobileMenuClick: () => $(!S),
|
|
4447
4471
|
showMobileMenuButton: c === "multiChat"
|
|
4448
4472
|
}
|
|
4449
4473
|
),
|
|
4450
4474
|
/* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
|
|
4451
|
-
|
|
4475
|
+
_t,
|
|
4452
4476
|
{
|
|
4453
4477
|
ref: a,
|
|
4454
|
-
welcomeTitle:
|
|
4455
|
-
welcomeSubtitle:
|
|
4456
|
-
extraTopPadding:
|
|
4457
|
-
suggestions:
|
|
4458
|
-
inputPlaceholder:
|
|
4459
|
-
enableAttachments:
|
|
4460
|
-
preMadeResponseDelay:
|
|
4461
|
-
streamingSpeed:
|
|
4478
|
+
welcomeTitle: b,
|
|
4479
|
+
welcomeSubtitle: y,
|
|
4480
|
+
extraTopPadding: k,
|
|
4481
|
+
suggestions: T,
|
|
4482
|
+
inputPlaceholder: L,
|
|
4483
|
+
enableAttachments: q,
|
|
4484
|
+
preMadeResponseDelay: I,
|
|
4485
|
+
streamingSpeed: C
|
|
4462
4486
|
}
|
|
4463
4487
|
) })
|
|
4464
4488
|
] })
|
|
4465
4489
|
] }) : /* @__PURE__ */ w("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
|
|
4466
4490
|
s === "selector" && /* @__PURE__ */ d(
|
|
4467
|
-
|
|
4491
|
+
Ft,
|
|
4468
4492
|
{
|
|
4469
4493
|
currentModel: Q || "",
|
|
4470
|
-
models:
|
|
4494
|
+
models: Ie,
|
|
4471
4495
|
modelsLoading: he,
|
|
4472
4496
|
modelsError: me,
|
|
4473
4497
|
onModelChange: pe,
|
|
4474
|
-
showThemeToggle:
|
|
4475
|
-
theme:
|
|
4498
|
+
showThemeToggle: D,
|
|
4499
|
+
theme: h
|
|
4476
4500
|
}
|
|
4477
4501
|
),
|
|
4478
4502
|
/* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
|
|
4479
|
-
|
|
4503
|
+
_t,
|
|
4480
4504
|
{
|
|
4481
4505
|
ref: a,
|
|
4482
|
-
welcomeTitle:
|
|
4483
|
-
welcomeSubtitle:
|
|
4484
|
-
extraTopPadding:
|
|
4485
|
-
suggestions:
|
|
4486
|
-
inputPlaceholder:
|
|
4487
|
-
preMadeResponseDelay:
|
|
4488
|
-
streamingSpeed:
|
|
4506
|
+
welcomeTitle: b,
|
|
4507
|
+
welcomeSubtitle: y,
|
|
4508
|
+
extraTopPadding: k,
|
|
4509
|
+
suggestions: T,
|
|
4510
|
+
inputPlaceholder: L,
|
|
4511
|
+
preMadeResponseDelay: I,
|
|
4512
|
+
streamingSpeed: C
|
|
4489
4513
|
}
|
|
4490
4514
|
) })
|
|
4491
4515
|
] })
|
|
@@ -4501,10 +4525,10 @@ function vo(e, r = ":root") {
|
|
|
4501
4525
|
if (typeof document > "u")
|
|
4502
4526
|
return;
|
|
4503
4527
|
const t = document.documentElement;
|
|
4504
|
-
if (e.light &&
|
|
4528
|
+
if (e.light && To(e.light, t), e.dark) {
|
|
4505
4529
|
let a = document.getElementById("cuadra-theme-dark");
|
|
4506
4530
|
a || (a = document.createElement("style"), a.id = "cuadra-theme-dark", document.head.appendChild(a));
|
|
4507
|
-
const i =
|
|
4531
|
+
const i = Mo(e.dark);
|
|
4508
4532
|
a.textContent = `.dark { ${i} }`;
|
|
4509
4533
|
}
|
|
4510
4534
|
}
|
|
@@ -4537,22 +4561,22 @@ const Co = {
|
|
|
4537
4561
|
warning: "warning",
|
|
4538
4562
|
warningForeground: "warning-foreground"
|
|
4539
4563
|
};
|
|
4540
|
-
function
|
|
4564
|
+
function Cr(e) {
|
|
4541
4565
|
const r = Co[e];
|
|
4542
4566
|
return r ? `--cuadra-${r}` : `--cuadra-${e.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
|
|
4543
4567
|
}
|
|
4544
|
-
function
|
|
4568
|
+
function To(e, r) {
|
|
4545
4569
|
Object.entries(e).forEach(([t, a]) => {
|
|
4546
4570
|
if (a) {
|
|
4547
|
-
const i =
|
|
4571
|
+
const i = Cr(t);
|
|
4548
4572
|
r.style.setProperty(i, a);
|
|
4549
4573
|
}
|
|
4550
4574
|
});
|
|
4551
4575
|
}
|
|
4552
|
-
function
|
|
4553
|
-
return Object.entries(e).map(([r, t]) => t ? `${
|
|
4576
|
+
function Mo(e) {
|
|
4577
|
+
return Object.entries(e).map(([r, t]) => t ? `${Cr(r)}: ${t};` : "").filter(Boolean).join(" ");
|
|
4554
4578
|
}
|
|
4555
|
-
function
|
|
4579
|
+
function Do() {
|
|
4556
4580
|
if (typeof document > "u")
|
|
4557
4581
|
return;
|
|
4558
4582
|
const e = document.documentElement;
|
|
@@ -4560,12 +4584,12 @@ function _o() {
|
|
|
4560
4584
|
const t = document.getElementById("cuadra-theme-dark");
|
|
4561
4585
|
t && t.remove();
|
|
4562
4586
|
}
|
|
4563
|
-
const
|
|
4587
|
+
const _o = ve(
|
|
4564
4588
|
function(r, t) {
|
|
4565
4589
|
const a = de(null);
|
|
4566
|
-
|
|
4590
|
+
O(() => {
|
|
4567
4591
|
r.customTheme && vo(r.customTheme);
|
|
4568
|
-
}, [r.customTheme]),
|
|
4592
|
+
}, [r.customTheme]), at(t, () => ({
|
|
4569
4593
|
sendMessage: (o) => {
|
|
4570
4594
|
a.current?.sendMessage(o);
|
|
4571
4595
|
},
|
|
@@ -4575,7 +4599,7 @@ const Do = we(
|
|
|
4575
4599
|
clearChat: () => {
|
|
4576
4600
|
a.current?.clearChat();
|
|
4577
4601
|
}
|
|
4578
|
-
}), []),
|
|
4602
|
+
}), []), O(() => (typeof window < "u" && (window.__cuadraChatControls = {
|
|
4579
4603
|
sendMessage: (o) => a.current?.sendMessage(o),
|
|
4580
4604
|
sendPreMadeQA: (o, n, u) => a.current?.sendPreMadeQA(o, n, u),
|
|
4581
4605
|
clearChat: () => a.current?.clearChat()
|
|
@@ -4592,6 +4616,7 @@ const Do = we(
|
|
|
4592
4616
|
onModelChange: r.onModelChange,
|
|
4593
4617
|
ephemeral: r.ephemeral,
|
|
4594
4618
|
systemPrompt: r.systemPrompt,
|
|
4619
|
+
enableReasoning: r.enableReasoning,
|
|
4595
4620
|
initialThreadId: r.initialThreadId,
|
|
4596
4621
|
language: r.language,
|
|
4597
4622
|
welcomeTitle: r.welcomeTitle,
|
|
@@ -4618,11 +4643,11 @@ const Do = we(
|
|
|
4618
4643
|
}
|
|
4619
4644
|
);
|
|
4620
4645
|
export {
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4646
|
+
wr as Badge,
|
|
4647
|
+
_o as CuadraChat,
|
|
4648
|
+
uo as SourceCitations,
|
|
4624
4649
|
vo as applyTheme,
|
|
4625
|
-
|
|
4650
|
+
Do as removeTheme,
|
|
4626
4651
|
ie as streamingMetadataStore
|
|
4627
4652
|
};
|
|
4628
4653
|
//# sourceMappingURL=index.mjs.map
|