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