@cuadra-ai/uikit 0.1.12 → 0.1.13
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.map +1 -1
- package/dist/index.cjs +13 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +539 -543
- package/dist/index.mjs.map +1 -1
- package/dist/widget/cuadra-uikit.umd.js +15 -15
- package/dist/widget/cuadra-uikit.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var jt = Object.defineProperty;
|
|
2
2
|
var $t = (e, r, t) => r in e ? jt(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
3
|
var le = (e, r, t) => $t(e, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
-
import { jsx as
|
|
4
|
+
import { jsx as d, jsxs as v, Fragment as B } from "react/jsx-runtime";
|
|
5
5
|
import { forwardRef as tt, createElement as Ne, useMemo as W, useState as N, useEffect as M, useCallback as te, memo as Ot, useRef as rt, createContext as Ut } from "react";
|
|
6
6
|
import { createPortal as $e } from "react-dom";
|
|
7
7
|
import { useLocalRuntime as nt, AssistantRuntimeProvider as at, unstable_useRemoteThreadListRuntime as Bt, useThreadRuntime as Wt, ThreadPrimitive as ee, ComposerPrimitive as ke, useAssistantApi as Ht, MessagePrimitive as se, ThreadListPrimitive as xe, useThreadListItem as qt, useThread as Kt, ThreadListItemPrimitive as we } from "@assistant-ui/react";
|
|
@@ -52,7 +52,7 @@ const er = tt(
|
|
|
52
52
|
...u
|
|
53
53
|
},
|
|
54
54
|
[
|
|
55
|
-
...a.map(([
|
|
55
|
+
...a.map(([s, f]) => Ne(s, f)),
|
|
56
56
|
...Array.isArray(o) ? o : [o]
|
|
57
57
|
]
|
|
58
58
|
)
|
|
@@ -224,24 +224,24 @@ class lt {
|
|
|
224
224
|
body: JSON.stringify(t)
|
|
225
225
|
});
|
|
226
226
|
if (!l.ok) {
|
|
227
|
-
const
|
|
228
|
-
let
|
|
227
|
+
const f = await l.text();
|
|
228
|
+
let c = {};
|
|
229
229
|
try {
|
|
230
|
-
|
|
230
|
+
c = JSON.parse(f);
|
|
231
231
|
} catch {
|
|
232
|
-
|
|
232
|
+
c = { detail: f };
|
|
233
233
|
}
|
|
234
234
|
throw new Error(
|
|
235
|
-
|
|
235
|
+
c.detail || c.message || `API error: ${l.status} ${l.statusText}`
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
238
|
if (l.status === 204)
|
|
239
239
|
return {};
|
|
240
|
-
const
|
|
241
|
-
if (!
|
|
240
|
+
const s = await l.text();
|
|
241
|
+
if (!s)
|
|
242
242
|
return {};
|
|
243
243
|
try {
|
|
244
|
-
return JSON.parse(
|
|
244
|
+
return JSON.parse(s);
|
|
245
245
|
} catch {
|
|
246
246
|
return {};
|
|
247
247
|
}
|
|
@@ -329,13 +329,13 @@ async function* kr(e, r) {
|
|
|
329
329
|
i = u.pop() || "";
|
|
330
330
|
for (const l of u)
|
|
331
331
|
if (l.startsWith("data: ")) {
|
|
332
|
-
const
|
|
333
|
-
if (
|
|
332
|
+
const s = l.slice(6);
|
|
333
|
+
if (s.trim() === "[DONE]") {
|
|
334
334
|
yield { done: !0 };
|
|
335
335
|
continue;
|
|
336
336
|
}
|
|
337
337
|
try {
|
|
338
|
-
yield JSON.parse(
|
|
338
|
+
yield JSON.parse(s);
|
|
339
339
|
} catch {
|
|
340
340
|
}
|
|
341
341
|
}
|
|
@@ -361,47 +361,43 @@ function xr(e) {
|
|
|
361
361
|
}
|
|
362
362
|
function wr(e, r) {
|
|
363
363
|
const { modelId: t, systemPrompt: n, ephemeral: i, onChatCreated: o, onUserMessage: a } = r;
|
|
364
|
-
let u = null;
|
|
365
364
|
return {
|
|
366
|
-
async *run(
|
|
367
|
-
const { messages:
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}
|
|
372
|
-
const p = {
|
|
373
|
-
messages: xr(c),
|
|
365
|
+
async *run(u) {
|
|
366
|
+
const { messages: l, abortSignal: s } = u;
|
|
367
|
+
a?.();
|
|
368
|
+
const c = {
|
|
369
|
+
messages: xr(l),
|
|
374
370
|
chatId: null,
|
|
375
371
|
// Thread ID will be set by runtime if needed
|
|
376
372
|
systemPrompt: n,
|
|
377
373
|
ephemeral: i,
|
|
378
374
|
stream: !0
|
|
379
375
|
};
|
|
380
|
-
t && t.trim() !== "" && (
|
|
381
|
-
const
|
|
382
|
-
let
|
|
383
|
-
for await (const
|
|
384
|
-
if (
|
|
376
|
+
t && t.trim() !== "" && (c.modelId = t);
|
|
377
|
+
const p = await e.createOrContinueChat(c, s);
|
|
378
|
+
let g = "", h;
|
|
379
|
+
for await (const k of kr(p, s)) {
|
|
380
|
+
if (s?.aborted)
|
|
385
381
|
throw new Error("Request aborted");
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
390
|
-
const
|
|
391
|
-
|
|
382
|
+
const b = k.id;
|
|
383
|
+
b && !h && (h = b, o?.(b));
|
|
384
|
+
const x = k.delta;
|
|
385
|
+
if (x != null && (g += x), k.type === "message" || k.content) {
|
|
386
|
+
const y = k.content || "";
|
|
387
|
+
g += y;
|
|
392
388
|
}
|
|
393
|
-
if (
|
|
394
|
-
|
|
395
|
-
content: [{ type: "text", text:
|
|
389
|
+
if (k.message && (g += k.message.content || ""), k.tool_calls, k.finished) {
|
|
390
|
+
g && (yield {
|
|
391
|
+
content: [{ type: "text", text: g }]
|
|
396
392
|
});
|
|
397
393
|
break;
|
|
398
394
|
}
|
|
399
|
-
|
|
400
|
-
content: [{ type: "text", text:
|
|
395
|
+
g && (yield {
|
|
396
|
+
content: [{ type: "text", text: g }]
|
|
401
397
|
});
|
|
402
398
|
}
|
|
403
|
-
|
|
404
|
-
content: [{ type: "text", text:
|
|
399
|
+
g && (yield {
|
|
400
|
+
content: [{ type: "text", text: g }]
|
|
405
401
|
});
|
|
406
402
|
}
|
|
407
403
|
};
|
|
@@ -478,47 +474,47 @@ function Cr({
|
|
|
478
474
|
onModelChange: a,
|
|
479
475
|
ephemeral: u = !1,
|
|
480
476
|
systemPrompt: l,
|
|
481
|
-
initialThreadId:
|
|
482
|
-
onError:
|
|
483
|
-
onChatCreated:
|
|
477
|
+
initialThreadId: s,
|
|
478
|
+
onError: f,
|
|
479
|
+
onChatCreated: c,
|
|
484
480
|
onUserMessage: p,
|
|
485
|
-
onThreadIdUpdate:
|
|
486
|
-
onChatsLoaded:
|
|
481
|
+
onThreadIdUpdate: g,
|
|
482
|
+
onChatsLoaded: h
|
|
487
483
|
}) {
|
|
488
484
|
const k = W(
|
|
489
485
|
() => new lt(r, t || void 0, n),
|
|
490
486
|
[r, t, n]
|
|
491
|
-
), [
|
|
487
|
+
), [b, x] = N(o || null);
|
|
492
488
|
M(() => {
|
|
493
489
|
o && x(o);
|
|
494
490
|
}, [o]);
|
|
495
491
|
const w = te(
|
|
496
492
|
(C) => {
|
|
497
|
-
|
|
493
|
+
c?.(C);
|
|
498
494
|
},
|
|
499
|
-
[
|
|
495
|
+
[c]
|
|
500
496
|
), y = te(
|
|
501
497
|
(C, L) => {
|
|
502
|
-
|
|
498
|
+
g?.(C, L);
|
|
503
499
|
},
|
|
504
|
-
[
|
|
500
|
+
[g]
|
|
505
501
|
), A = W(() => wr(k, {
|
|
506
|
-
modelId:
|
|
502
|
+
modelId: b || void 0,
|
|
507
503
|
// Pass undefined if not set (backend resolves it)
|
|
508
504
|
systemPrompt: l,
|
|
509
505
|
ephemeral: u,
|
|
510
506
|
onChatCreated: w,
|
|
511
507
|
onUserMessage: p
|
|
512
|
-
}), [k,
|
|
513
|
-
return i === "singleChat" ? /* @__PURE__ */
|
|
508
|
+
}), [k, b, l, u, w, p]), T = nt(A);
|
|
509
|
+
return i === "singleChat" ? /* @__PURE__ */ d(at, { runtime: T, children: e }) : /* @__PURE__ */ d(
|
|
514
510
|
vr,
|
|
515
511
|
{
|
|
516
512
|
client: k,
|
|
517
513
|
modelAdapter: A,
|
|
518
|
-
initialThreadId:
|
|
519
|
-
onChatsLoaded:
|
|
514
|
+
initialThreadId: s,
|
|
515
|
+
onChatsLoaded: h,
|
|
520
516
|
onThreadIdUpdate: y,
|
|
521
|
-
onError:
|
|
517
|
+
onError: f,
|
|
522
518
|
children: e
|
|
523
519
|
}
|
|
524
520
|
);
|
|
@@ -532,25 +528,25 @@ function vr({
|
|
|
532
528
|
onError: o,
|
|
533
529
|
children: a
|
|
534
530
|
}) {
|
|
535
|
-
const u = W(() => yr(e, (
|
|
536
|
-
i?.(
|
|
531
|
+
const u = W(() => yr(e, (c, p) => {
|
|
532
|
+
i?.(c, p);
|
|
537
533
|
}), [e, i]), l = W(() => ({
|
|
538
534
|
...u,
|
|
539
535
|
async list() {
|
|
540
|
-
const
|
|
541
|
-
return n?.(),
|
|
536
|
+
const c = await u.list();
|
|
537
|
+
return n?.(), c;
|
|
542
538
|
}
|
|
543
539
|
}), [u, n]);
|
|
544
540
|
M(() => {
|
|
545
541
|
window.__cuadraThreadListAdapter = l, window.__cuadraThreadListRuntime = null;
|
|
546
542
|
}, [l]);
|
|
547
|
-
const
|
|
543
|
+
const s = te(() => nt(r), [r]), f = Bt({
|
|
548
544
|
adapter: l,
|
|
549
|
-
runtimeHook:
|
|
545
|
+
runtimeHook: s
|
|
550
546
|
});
|
|
551
547
|
return M(() => {
|
|
552
|
-
window.__cuadraThreadListRuntime =
|
|
553
|
-
}, [
|
|
548
|
+
window.__cuadraThreadListRuntime = f;
|
|
549
|
+
}, [f]), /* @__PURE__ */ d(at, { runtime: f, children: a });
|
|
554
550
|
}
|
|
555
551
|
function Be(e, r) {
|
|
556
552
|
const t = String(e);
|
|
@@ -684,42 +680,42 @@ function ct(e, r, t, n) {
|
|
|
684
680
|
typeof r == "function" && typeof t != "function" ? (n = t, t = r) : i = r;
|
|
685
681
|
const o = pe(i), a = n ? -1 : 1;
|
|
686
682
|
u(e, void 0, [])();
|
|
687
|
-
function u(l,
|
|
688
|
-
const
|
|
683
|
+
function u(l, s, f) {
|
|
684
|
+
const c = (
|
|
689
685
|
/** @type {Record<string, unknown>} */
|
|
690
686
|
l && typeof l == "object" ? l : {}
|
|
691
687
|
);
|
|
692
|
-
if (typeof
|
|
693
|
-
const
|
|
688
|
+
if (typeof c.type == "string") {
|
|
689
|
+
const g = (
|
|
694
690
|
// `hast`
|
|
695
|
-
typeof
|
|
691
|
+
typeof c.tagName == "string" ? c.tagName : (
|
|
696
692
|
// `xast`
|
|
697
|
-
typeof
|
|
693
|
+
typeof c.name == "string" ? c.name : void 0
|
|
698
694
|
)
|
|
699
695
|
);
|
|
700
696
|
Object.defineProperty(p, "name", {
|
|
701
|
-
value: "node (" + (l.type + (
|
|
697
|
+
value: "node (" + (l.type + (g ? "<" + g + ">" : "")) + ")"
|
|
702
698
|
});
|
|
703
699
|
}
|
|
704
700
|
return p;
|
|
705
701
|
function p() {
|
|
706
|
-
let
|
|
707
|
-
if ((!r || o(l,
|
|
708
|
-
return
|
|
702
|
+
let g = ut, h, k, b;
|
|
703
|
+
if ((!r || o(l, s, f[f.length - 1] || void 0)) && (g = Rr(t(l, f)), g[0] === Se))
|
|
704
|
+
return g;
|
|
709
705
|
if ("children" in l && l.children) {
|
|
710
706
|
const x = (
|
|
711
707
|
/** @type {UnistParent} */
|
|
712
708
|
l
|
|
713
709
|
);
|
|
714
|
-
if (x.children &&
|
|
715
|
-
for (k = (n ? x.children.length : -1) + a,
|
|
710
|
+
if (x.children && g[0] !== Pr)
|
|
711
|
+
for (k = (n ? x.children.length : -1) + a, b = f.concat(x); k > -1 && k < x.children.length; ) {
|
|
716
712
|
const w = x.children[k];
|
|
717
|
-
if (
|
|
718
|
-
return
|
|
719
|
-
k = typeof
|
|
713
|
+
if (h = u(w, k, b)(), h[0] === Se)
|
|
714
|
+
return h;
|
|
715
|
+
k = typeof h[1] == "number" ? h[1] : k + a;
|
|
720
716
|
}
|
|
721
717
|
}
|
|
722
|
-
return
|
|
718
|
+
return g;
|
|
723
719
|
}
|
|
724
720
|
}
|
|
725
721
|
}
|
|
@@ -731,43 +727,43 @@ function Er(e, r, t) {
|
|
|
731
727
|
let a = -1;
|
|
732
728
|
for (; ++a < o.length; )
|
|
733
729
|
ct(e, "text", u);
|
|
734
|
-
function u(
|
|
735
|
-
let
|
|
736
|
-
for (; ++
|
|
737
|
-
const
|
|
730
|
+
function u(s, f) {
|
|
731
|
+
let c = -1, p;
|
|
732
|
+
for (; ++c < f.length; ) {
|
|
733
|
+
const g = f[c], h = p ? p.children : void 0;
|
|
738
734
|
if (i(
|
|
739
|
-
|
|
740
|
-
|
|
735
|
+
g,
|
|
736
|
+
h ? h.indexOf(g) : void 0,
|
|
741
737
|
p
|
|
742
738
|
))
|
|
743
739
|
return;
|
|
744
|
-
p =
|
|
740
|
+
p = g;
|
|
745
741
|
}
|
|
746
742
|
if (p)
|
|
747
|
-
return l(
|
|
743
|
+
return l(s, f);
|
|
748
744
|
}
|
|
749
|
-
function l(
|
|
750
|
-
const
|
|
751
|
-
let
|
|
752
|
-
const
|
|
745
|
+
function l(s, f) {
|
|
746
|
+
const c = f[f.length - 1], p = o[a][0], g = o[a][1];
|
|
747
|
+
let h = 0;
|
|
748
|
+
const b = c.children.indexOf(s);
|
|
753
749
|
let x = !1, w = [];
|
|
754
750
|
p.lastIndex = 0;
|
|
755
|
-
let y = p.exec(
|
|
751
|
+
let y = p.exec(s.value);
|
|
756
752
|
for (; y; ) {
|
|
757
753
|
const A = y.index, T = {
|
|
758
754
|
index: y.index,
|
|
759
755
|
input: y.input,
|
|
760
|
-
stack: [...
|
|
756
|
+
stack: [...f, s]
|
|
761
757
|
};
|
|
762
|
-
let C =
|
|
763
|
-
if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex = A + 1 : (
|
|
758
|
+
let C = g(...y, T);
|
|
759
|
+
if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex = A + 1 : (h !== A && w.push({
|
|
764
760
|
type: "text",
|
|
765
|
-
value:
|
|
766
|
-
}), Array.isArray(C) ? w.push(...C) : C && w.push(C),
|
|
761
|
+
value: s.value.slice(h, A)
|
|
762
|
+
}), Array.isArray(C) ? w.push(...C) : C && w.push(C), h = A + y[0].length, x = !0), !p.global)
|
|
767
763
|
break;
|
|
768
|
-
y = p.exec(
|
|
764
|
+
y = p.exec(s.value);
|
|
769
765
|
}
|
|
770
|
-
return x ? (
|
|
766
|
+
return x ? (h < s.value.length && w.push({ type: "text", value: s.value.slice(h) }), c.children.splice(b, 1, ...w)) : w = [s], b + w.length;
|
|
771
767
|
}
|
|
772
768
|
}
|
|
773
769
|
function _r(e) {
|
|
@@ -986,16 +982,16 @@ function ln(e) {
|
|
|
986
982
|
function t(n, i, o, a) {
|
|
987
983
|
const u = o.createTracker(a);
|
|
988
984
|
let l = u.move("[^");
|
|
989
|
-
const
|
|
985
|
+
const s = o.enter("footnoteDefinition"), f = o.enter("label");
|
|
990
986
|
return l += u.move(
|
|
991
987
|
o.safe(o.associationId(n), { before: l, after: "]" })
|
|
992
|
-
),
|
|
988
|
+
), f(), l += u.move("]:"), n.children && n.children.length > 0 && (u.shift(4), l += u.move(
|
|
993
989
|
(r ? `
|
|
994
990
|
` : " ") + o.indentLines(
|
|
995
991
|
o.containerFlow(n, u.current()),
|
|
996
992
|
r ? ft : un
|
|
997
993
|
)
|
|
998
|
-
)),
|
|
994
|
+
)), s(), l;
|
|
999
995
|
}
|
|
1000
996
|
}
|
|
1001
997
|
function un(e, r, t) {
|
|
@@ -1055,64 +1051,64 @@ function pn(e) {
|
|
|
1055
1051
|
}
|
|
1056
1052
|
function gn(e, r) {
|
|
1057
1053
|
const t = r || {}, n = (t.align || []).concat(), i = t.stringLength || pn, o = [], a = [], u = [], l = [];
|
|
1058
|
-
let
|
|
1059
|
-
for (; ++
|
|
1060
|
-
const k = [],
|
|
1054
|
+
let s = 0, f = -1;
|
|
1055
|
+
for (; ++f < e.length; ) {
|
|
1056
|
+
const k = [], b = [];
|
|
1061
1057
|
let x = -1;
|
|
1062
|
-
for (e[
|
|
1063
|
-
const w = bn(e[
|
|
1058
|
+
for (e[f].length > s && (s = e[f].length); ++x < e[f].length; ) {
|
|
1059
|
+
const w = bn(e[f][x]);
|
|
1064
1060
|
if (t.alignDelimiters !== !1) {
|
|
1065
1061
|
const y = i(w);
|
|
1066
|
-
|
|
1062
|
+
b[x] = y, (l[x] === void 0 || y > l[x]) && (l[x] = y);
|
|
1067
1063
|
}
|
|
1068
1064
|
k.push(w);
|
|
1069
1065
|
}
|
|
1070
|
-
a[
|
|
1066
|
+
a[f] = k, u[f] = b;
|
|
1071
1067
|
}
|
|
1072
|
-
let
|
|
1068
|
+
let c = -1;
|
|
1073
1069
|
if (typeof n == "object" && "length" in n)
|
|
1074
|
-
for (; ++
|
|
1075
|
-
o[
|
|
1070
|
+
for (; ++c < s; )
|
|
1071
|
+
o[c] = We(n[c]);
|
|
1076
1072
|
else {
|
|
1077
1073
|
const k = We(n);
|
|
1078
|
-
for (; ++
|
|
1079
|
-
o[
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
const p = [],
|
|
1083
|
-
for (; ++
|
|
1084
|
-
const k = o[
|
|
1085
|
-
let
|
|
1086
|
-
k === 99 ? (
|
|
1074
|
+
for (; ++c < s; )
|
|
1075
|
+
o[c] = k;
|
|
1076
|
+
}
|
|
1077
|
+
c = -1;
|
|
1078
|
+
const p = [], g = [];
|
|
1079
|
+
for (; ++c < s; ) {
|
|
1080
|
+
const k = o[c];
|
|
1081
|
+
let b = "", x = "";
|
|
1082
|
+
k === 99 ? (b = ":", x = ":") : k === 108 ? b = ":" : k === 114 && (x = ":");
|
|
1087
1083
|
let w = t.alignDelimiters === !1 ? 1 : Math.max(
|
|
1088
1084
|
1,
|
|
1089
|
-
l[
|
|
1085
|
+
l[c] - b.length - x.length
|
|
1090
1086
|
);
|
|
1091
|
-
const y =
|
|
1092
|
-
t.alignDelimiters !== !1 && (w =
|
|
1093
|
-
}
|
|
1094
|
-
a.splice(1, 0, p), u.splice(1, 0,
|
|
1095
|
-
const
|
|
1096
|
-
for (; ++
|
|
1097
|
-
const k = a[
|
|
1098
|
-
|
|
1087
|
+
const y = b + "-".repeat(w) + x;
|
|
1088
|
+
t.alignDelimiters !== !1 && (w = b.length + w + x.length, w > l[c] && (l[c] = w), g[c] = w), p[c] = y;
|
|
1089
|
+
}
|
|
1090
|
+
a.splice(1, 0, p), u.splice(1, 0, g), f = -1;
|
|
1091
|
+
const h = [];
|
|
1092
|
+
for (; ++f < a.length; ) {
|
|
1093
|
+
const k = a[f], b = u[f];
|
|
1094
|
+
c = -1;
|
|
1099
1095
|
const x = [];
|
|
1100
|
-
for (; ++
|
|
1101
|
-
const w = k[
|
|
1096
|
+
for (; ++c < s; ) {
|
|
1097
|
+
const w = k[c] || "";
|
|
1102
1098
|
let y = "", A = "";
|
|
1103
1099
|
if (t.alignDelimiters !== !1) {
|
|
1104
|
-
const T = l[
|
|
1100
|
+
const T = l[c] - (b[c] || 0), C = o[c];
|
|
1105
1101
|
C === 114 ? y = " ".repeat(T) : C === 99 ? T % 2 ? (y = " ".repeat(T / 2 + 0.5), A = " ".repeat(T / 2 - 0.5)) : (y = " ".repeat(T / 2), A = y) : A = " ".repeat(T);
|
|
1106
1102
|
}
|
|
1107
|
-
t.delimiterStart !== !1 && !
|
|
1103
|
+
t.delimiterStart !== !1 && !c && x.push("|"), t.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is
|
|
1108
1104
|
// empty: there will be a closing space.
|
|
1109
|
-
!(t.alignDelimiters === !1 && w === "") && (t.delimiterStart !== !1 ||
|
|
1105
|
+
!(t.alignDelimiters === !1 && w === "") && (t.delimiterStart !== !1 || c) && x.push(" "), t.alignDelimiters !== !1 && x.push(y), x.push(w), t.alignDelimiters !== !1 && x.push(A), t.padding !== !1 && x.push(" "), (t.delimiterEnd !== !1 || c !== s - 1) && x.push("|");
|
|
1110
1106
|
}
|
|
1111
|
-
|
|
1107
|
+
h.push(
|
|
1112
1108
|
t.delimiterEnd === !1 ? x.join("").replace(/ +$/, "") : x.join("")
|
|
1113
1109
|
);
|
|
1114
1110
|
}
|
|
1115
|
-
return
|
|
1111
|
+
return h.join(`
|
|
1116
1112
|
`);
|
|
1117
1113
|
}
|
|
1118
1114
|
function bn(e) {
|
|
@@ -1181,37 +1177,37 @@ function vn(e) {
|
|
|
1181
1177
|
function Tn(e, r, t, n) {
|
|
1182
1178
|
const i = vn(t), o = e.value || "", a = i === "`" ? "GraveAccent" : "Tilde";
|
|
1183
1179
|
if (Cn(e, t)) {
|
|
1184
|
-
const
|
|
1185
|
-
return
|
|
1180
|
+
const c = t.enter("codeIndented"), p = t.indentLines(o, An);
|
|
1181
|
+
return c(), p;
|
|
1186
1182
|
}
|
|
1187
|
-
const u = t.createTracker(n), l = i.repeat(Math.max(yn(o, i) + 1, 3)),
|
|
1188
|
-
let
|
|
1183
|
+
const u = t.createTracker(n), l = i.repeat(Math.max(yn(o, i) + 1, 3)), s = t.enter("codeFenced");
|
|
1184
|
+
let f = u.move(l);
|
|
1189
1185
|
if (e.lang) {
|
|
1190
|
-
const
|
|
1191
|
-
|
|
1186
|
+
const c = t.enter(`codeFencedLang${a}`);
|
|
1187
|
+
f += u.move(
|
|
1192
1188
|
t.safe(e.lang, {
|
|
1193
|
-
before:
|
|
1189
|
+
before: f,
|
|
1194
1190
|
after: " ",
|
|
1195
1191
|
encode: ["`"],
|
|
1196
1192
|
...u.current()
|
|
1197
1193
|
})
|
|
1198
|
-
),
|
|
1194
|
+
), c();
|
|
1199
1195
|
}
|
|
1200
1196
|
if (e.lang && e.meta) {
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1197
|
+
const c = t.enter(`codeFencedMeta${a}`);
|
|
1198
|
+
f += u.move(" "), f += u.move(
|
|
1203
1199
|
t.safe(e.meta, {
|
|
1204
|
-
before:
|
|
1200
|
+
before: f,
|
|
1205
1201
|
after: `
|
|
1206
1202
|
`,
|
|
1207
1203
|
encode: ["`"],
|
|
1208
1204
|
...u.current()
|
|
1209
1205
|
})
|
|
1210
|
-
),
|
|
1206
|
+
), c();
|
|
1211
1207
|
}
|
|
1212
|
-
return
|
|
1213
|
-
`), o && (
|
|
1214
|
-
`)),
|
|
1208
|
+
return f += u.move(`
|
|
1209
|
+
`), o && (f += u.move(o + `
|
|
1210
|
+
`)), f += u.move(l), s(), f;
|
|
1215
1211
|
}
|
|
1216
1212
|
function An(e, r, t) {
|
|
1217
1213
|
return (t ? "" : " ") + e;
|
|
@@ -1228,31 +1224,31 @@ function In(e, r, t, n) {
|
|
|
1228
1224
|
const i = De(t), o = i === '"' ? "Quote" : "Apostrophe", a = t.enter("definition");
|
|
1229
1225
|
let u = t.enter("label");
|
|
1230
1226
|
const l = t.createTracker(n);
|
|
1231
|
-
let
|
|
1232
|
-
return
|
|
1227
|
+
let s = l.move("[");
|
|
1228
|
+
return s += l.move(
|
|
1233
1229
|
t.safe(t.associationId(e), {
|
|
1234
|
-
before:
|
|
1230
|
+
before: s,
|
|
1235
1231
|
after: "]",
|
|
1236
1232
|
...l.current()
|
|
1237
1233
|
})
|
|
1238
|
-
),
|
|
1234
|
+
), s += l.move("]: "), u(), // If there’s no url, or…
|
|
1239
1235
|
!e.url || // If there are control characters or whitespace.
|
|
1240
|
-
/[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"),
|
|
1241
|
-
t.safe(e.url, { before:
|
|
1242
|
-
),
|
|
1236
|
+
/[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"), s += l.move("<"), s += l.move(
|
|
1237
|
+
t.safe(e.url, { before: s, after: ">", ...l.current() })
|
|
1238
|
+
), s += l.move(">")) : (u = t.enter("destinationRaw"), s += l.move(
|
|
1243
1239
|
t.safe(e.url, {
|
|
1244
|
-
before:
|
|
1240
|
+
before: s,
|
|
1245
1241
|
after: e.title ? " " : `
|
|
1246
1242
|
`,
|
|
1247
1243
|
...l.current()
|
|
1248
1244
|
})
|
|
1249
|
-
)), u(), e.title && (u = t.enter(`title${o}`),
|
|
1245
|
+
)), u(), e.title && (u = t.enter(`title${o}`), s += l.move(" " + i), s += l.move(
|
|
1250
1246
|
t.safe(e.title, {
|
|
1251
|
-
before:
|
|
1247
|
+
before: s,
|
|
1252
1248
|
after: i,
|
|
1253
1249
|
...l.current()
|
|
1254
1250
|
})
|
|
1255
|
-
),
|
|
1251
|
+
), s += l.move(i), u()), a(), s;
|
|
1256
1252
|
}
|
|
1257
1253
|
function Nn(e) {
|
|
1258
1254
|
const r = e.options.emphasis || "*";
|
|
@@ -1314,19 +1310,19 @@ function mt(e, r, t, n) {
|
|
|
1314
1310
|
...a.current()
|
|
1315
1311
|
})
|
|
1316
1312
|
);
|
|
1317
|
-
const
|
|
1313
|
+
const s = l.charCodeAt(0), f = fe(
|
|
1318
1314
|
n.before.charCodeAt(n.before.length - 1),
|
|
1319
|
-
|
|
1315
|
+
s,
|
|
1320
1316
|
i
|
|
1321
1317
|
);
|
|
1322
|
-
|
|
1323
|
-
const
|
|
1324
|
-
p.inside && (l = l.slice(0, -1) + ne(
|
|
1325
|
-
const
|
|
1318
|
+
f.inside && (l = ne(s) + l.slice(1));
|
|
1319
|
+
const c = l.charCodeAt(l.length - 1), p = fe(n.after.charCodeAt(0), c, i);
|
|
1320
|
+
p.inside && (l = l.slice(0, -1) + ne(c));
|
|
1321
|
+
const g = a.move(i);
|
|
1326
1322
|
return o(), t.attentionEncodeSurroundingInfo = {
|
|
1327
1323
|
after: p.outside,
|
|
1328
|
-
before:
|
|
1329
|
-
}, u + l +
|
|
1324
|
+
before: f.outside
|
|
1325
|
+
}, u + l + g;
|
|
1330
1326
|
}
|
|
1331
1327
|
function Sn(e, r, t) {
|
|
1332
1328
|
return t.options.emphasis || "*";
|
|
@@ -1334,9 +1330,9 @@ function Sn(e, r, t) {
|
|
|
1334
1330
|
function Ln(e, r, t, n) {
|
|
1335
1331
|
let i, o, a;
|
|
1336
1332
|
typeof r == "function" && typeof t != "function" ? (o = void 0, a = r, i = t) : (o = r, a = t, i = n), ct(e, o, u, i);
|
|
1337
|
-
function u(l,
|
|
1338
|
-
const
|
|
1339
|
-
return a(l,
|
|
1333
|
+
function u(l, s) {
|
|
1334
|
+
const f = s[s.length - 1], c = f ? f.children.indexOf(l) : void 0;
|
|
1335
|
+
return a(l, c, f);
|
|
1340
1336
|
}
|
|
1341
1337
|
}
|
|
1342
1338
|
const Mn = {};
|
|
@@ -1375,14 +1371,14 @@ function Pn(e, r) {
|
|
|
1375
1371
|
function Rn(e, r, t, n) {
|
|
1376
1372
|
const i = Math.max(Math.min(6, e.depth || 1), 1), o = t.createTracker(n);
|
|
1377
1373
|
if (Pn(e, t)) {
|
|
1378
|
-
const
|
|
1374
|
+
const f = t.enter("headingSetext"), c = t.enter("phrasing"), p = t.containerPhrasing(e, {
|
|
1379
1375
|
...o.current(),
|
|
1380
1376
|
before: `
|
|
1381
1377
|
`,
|
|
1382
1378
|
after: `
|
|
1383
1379
|
`
|
|
1384
1380
|
});
|
|
1385
|
-
return
|
|
1381
|
+
return c(), f(), p + `
|
|
1386
1382
|
` + (i === 1 ? "=" : "-").repeat(
|
|
1387
1383
|
// The whole size…
|
|
1388
1384
|
p.length - // Minus the position of the character after the last EOL (or
|
|
@@ -1393,13 +1389,13 @@ function Rn(e, r, t, n) {
|
|
|
1393
1389
|
}
|
|
1394
1390
|
const a = "#".repeat(i), u = t.enter("headingAtx"), l = t.enter("phrasing");
|
|
1395
1391
|
o.move(a + " ");
|
|
1396
|
-
let
|
|
1392
|
+
let s = t.containerPhrasing(e, {
|
|
1397
1393
|
before: "# ",
|
|
1398
1394
|
after: `
|
|
1399
1395
|
`,
|
|
1400
1396
|
...o.current()
|
|
1401
1397
|
});
|
|
1402
|
-
return /^[\t ]/.test(
|
|
1398
|
+
return /^[\t ]/.test(s) && (s = ne(s.charCodeAt(0)) + s.slice(1)), s = s ? a + " " + s : a, t.options.closeAtx && (s += " " + a), l(), u(), s;
|
|
1403
1399
|
}
|
|
1404
1400
|
bt.peek = En;
|
|
1405
1401
|
function bt(e) {
|
|
@@ -1413,26 +1409,26 @@ function kt(e, r, t, n) {
|
|
|
1413
1409
|
const i = De(t), o = i === '"' ? "Quote" : "Apostrophe", a = t.enter("image");
|
|
1414
1410
|
let u = t.enter("label");
|
|
1415
1411
|
const l = t.createTracker(n);
|
|
1416
|
-
let
|
|
1417
|
-
return
|
|
1418
|
-
t.safe(e.alt, { before:
|
|
1419
|
-
),
|
|
1412
|
+
let s = l.move("![");
|
|
1413
|
+
return s += l.move(
|
|
1414
|
+
t.safe(e.alt, { before: s, after: "]", ...l.current() })
|
|
1415
|
+
), s += l.move("]("), u(), // If there’s no url but there is a title…
|
|
1420
1416
|
!e.url && e.title || // If there are control characters or whitespace.
|
|
1421
|
-
/[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"),
|
|
1422
|
-
t.safe(e.url, { before:
|
|
1423
|
-
),
|
|
1417
|
+
/[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"), s += l.move("<"), s += l.move(
|
|
1418
|
+
t.safe(e.url, { before: s, after: ">", ...l.current() })
|
|
1419
|
+
), s += l.move(">")) : (u = t.enter("destinationRaw"), s += l.move(
|
|
1424
1420
|
t.safe(e.url, {
|
|
1425
|
-
before:
|
|
1421
|
+
before: s,
|
|
1426
1422
|
after: e.title ? " " : ")",
|
|
1427
1423
|
...l.current()
|
|
1428
1424
|
})
|
|
1429
|
-
)), u(), e.title && (u = t.enter(`title${o}`),
|
|
1425
|
+
)), u(), e.title && (u = t.enter(`title${o}`), s += l.move(" " + i), s += l.move(
|
|
1430
1426
|
t.safe(e.title, {
|
|
1431
|
-
before:
|
|
1427
|
+
before: s,
|
|
1432
1428
|
after: i,
|
|
1433
1429
|
...l.current()
|
|
1434
1430
|
})
|
|
1435
|
-
),
|
|
1431
|
+
), s += l.move(i), u()), s += l.move(")"), a(), s;
|
|
1436
1432
|
}
|
|
1437
1433
|
function _n() {
|
|
1438
1434
|
return "!";
|
|
@@ -1443,20 +1439,20 @@ function xt(e, r, t, n) {
|
|
|
1443
1439
|
let a = t.enter("label");
|
|
1444
1440
|
const u = t.createTracker(n);
|
|
1445
1441
|
let l = u.move("![");
|
|
1446
|
-
const
|
|
1442
|
+
const s = t.safe(e.alt, {
|
|
1447
1443
|
before: l,
|
|
1448
1444
|
after: "]",
|
|
1449
1445
|
...u.current()
|
|
1450
1446
|
});
|
|
1451
|
-
l += u.move(
|
|
1452
|
-
const
|
|
1447
|
+
l += u.move(s + "]["), a();
|
|
1448
|
+
const f = t.stack;
|
|
1453
1449
|
t.stack = [], a = t.enter("reference");
|
|
1454
|
-
const
|
|
1450
|
+
const c = t.safe(t.associationId(e), {
|
|
1455
1451
|
before: l,
|
|
1456
1452
|
after: "]",
|
|
1457
1453
|
...u.current()
|
|
1458
1454
|
});
|
|
1459
|
-
return a(), t.stack =
|
|
1455
|
+
return a(), t.stack = f, o(), i === "full" || !s || s !== c ? l += u.move(c + "]") : i === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
|
|
1460
1456
|
}
|
|
1461
1457
|
function Fn() {
|
|
1462
1458
|
return "!";
|
|
@@ -1471,8 +1467,8 @@ function wt(e, r, t) {
|
|
|
1471
1467
|
let l;
|
|
1472
1468
|
if (a.atBreak)
|
|
1473
1469
|
for (; l = u.exec(n); ) {
|
|
1474
|
-
let
|
|
1475
|
-
n.charCodeAt(
|
|
1470
|
+
let s = l.index;
|
|
1471
|
+
n.charCodeAt(s) === 10 && n.charCodeAt(s - 1) === 13 && s--, n = n.slice(0, s) + " " + n.slice(l.index + 1);
|
|
1476
1472
|
}
|
|
1477
1473
|
}
|
|
1478
1474
|
return i + n + i;
|
|
@@ -1496,42 +1492,42 @@ function Ct(e, r, t, n) {
|
|
|
1496
1492
|
const i = De(t), o = i === '"' ? "Quote" : "Apostrophe", a = t.createTracker(n);
|
|
1497
1493
|
let u, l;
|
|
1498
1494
|
if (yt(e, t)) {
|
|
1499
|
-
const
|
|
1495
|
+
const f = t.stack;
|
|
1500
1496
|
t.stack = [], u = t.enter("autolink");
|
|
1501
|
-
let
|
|
1502
|
-
return
|
|
1497
|
+
let c = a.move("<");
|
|
1498
|
+
return c += a.move(
|
|
1503
1499
|
t.containerPhrasing(e, {
|
|
1504
|
-
before:
|
|
1500
|
+
before: c,
|
|
1505
1501
|
after: ">",
|
|
1506
1502
|
...a.current()
|
|
1507
1503
|
})
|
|
1508
|
-
),
|
|
1504
|
+
), c += a.move(">"), u(), t.stack = f, c;
|
|
1509
1505
|
}
|
|
1510
1506
|
u = t.enter("link"), l = t.enter("label");
|
|
1511
|
-
let
|
|
1512
|
-
return
|
|
1507
|
+
let s = a.move("[");
|
|
1508
|
+
return s += a.move(
|
|
1513
1509
|
t.containerPhrasing(e, {
|
|
1514
|
-
before:
|
|
1510
|
+
before: s,
|
|
1515
1511
|
after: "](",
|
|
1516
1512
|
...a.current()
|
|
1517
1513
|
})
|
|
1518
|
-
),
|
|
1514
|
+
), s += a.move("]("), l(), // If there’s no url but there is a title…
|
|
1519
1515
|
!e.url && e.title || // If there are control characters or whitespace.
|
|
1520
|
-
/[\0- \u007F]/.test(e.url) ? (l = t.enter("destinationLiteral"),
|
|
1521
|
-
t.safe(e.url, { before:
|
|
1522
|
-
),
|
|
1516
|
+
/[\0- \u007F]/.test(e.url) ? (l = t.enter("destinationLiteral"), s += a.move("<"), s += a.move(
|
|
1517
|
+
t.safe(e.url, { before: s, after: ">", ...a.current() })
|
|
1518
|
+
), s += a.move(">")) : (l = t.enter("destinationRaw"), s += a.move(
|
|
1523
1519
|
t.safe(e.url, {
|
|
1524
|
-
before:
|
|
1520
|
+
before: s,
|
|
1525
1521
|
after: e.title ? " " : ")",
|
|
1526
1522
|
...a.current()
|
|
1527
1523
|
})
|
|
1528
|
-
)), l(), e.title && (l = t.enter(`title${o}`),
|
|
1524
|
+
)), l(), e.title && (l = t.enter(`title${o}`), s += a.move(" " + i), s += a.move(
|
|
1529
1525
|
t.safe(e.title, {
|
|
1530
|
-
before:
|
|
1526
|
+
before: s,
|
|
1531
1527
|
after: i,
|
|
1532
1528
|
...a.current()
|
|
1533
1529
|
})
|
|
1534
|
-
),
|
|
1530
|
+
), s += a.move(i), l()), s += a.move(")"), u(), s;
|
|
1535
1531
|
}
|
|
1536
1532
|
function jn(e, r, t) {
|
|
1537
1533
|
return yt(e, t) ? "<" : "[";
|
|
@@ -1542,20 +1538,20 @@ function vt(e, r, t, n) {
|
|
|
1542
1538
|
let a = t.enter("label");
|
|
1543
1539
|
const u = t.createTracker(n);
|
|
1544
1540
|
let l = u.move("[");
|
|
1545
|
-
const
|
|
1541
|
+
const s = t.containerPhrasing(e, {
|
|
1546
1542
|
before: l,
|
|
1547
1543
|
after: "]",
|
|
1548
1544
|
...u.current()
|
|
1549
1545
|
});
|
|
1550
|
-
l += u.move(
|
|
1551
|
-
const
|
|
1546
|
+
l += u.move(s + "]["), a();
|
|
1547
|
+
const f = t.stack;
|
|
1552
1548
|
t.stack = [], a = t.enter("reference");
|
|
1553
|
-
const
|
|
1549
|
+
const c = t.safe(t.associationId(e), {
|
|
1554
1550
|
before: l,
|
|
1555
1551
|
after: "]",
|
|
1556
1552
|
...u.current()
|
|
1557
1553
|
});
|
|
1558
|
-
return a(), t.stack =
|
|
1554
|
+
return a(), t.stack = f, o(), i === "full" || !s || s !== c ? l += u.move(c + "]") : i === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
|
|
1559
1555
|
}
|
|
1560
1556
|
function $n() {
|
|
1561
1557
|
return "[";
|
|
@@ -1604,17 +1600,17 @@ function Bn(e, r, t, n) {
|
|
|
1604
1600
|
const u = e.ordered ? a === "." ? ")" : "." : On(t);
|
|
1605
1601
|
let l = r && t.bulletLastUsed ? a === t.bulletLastUsed : !1;
|
|
1606
1602
|
if (!e.ordered) {
|
|
1607
|
-
const
|
|
1603
|
+
const f = e.children ? e.children[0] : void 0;
|
|
1608
1604
|
if (
|
|
1609
1605
|
// Bullet could be used as a thematic break marker:
|
|
1610
1606
|
(a === "*" || a === "-") && // Empty first list item:
|
|
1611
|
-
|
|
1607
|
+
f && (!f.children || !f.children[0]) && // Directly in two other list items:
|
|
1612
1608
|
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.
|
|
1613
|
-
t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (l = !0), Tt(t) === a &&
|
|
1609
|
+
t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (l = !0), Tt(t) === a && f
|
|
1614
1610
|
) {
|
|
1615
|
-
let
|
|
1616
|
-
for (; ++
|
|
1617
|
-
const p = e.children[
|
|
1611
|
+
let c = -1;
|
|
1612
|
+
for (; ++c < e.children.length; ) {
|
|
1613
|
+
const p = e.children[c];
|
|
1618
1614
|
if (p && p.type === "listItem" && p.children && p.children[0] && p.children[0].type === "thematicBreak") {
|
|
1619
1615
|
l = !0;
|
|
1620
1616
|
break;
|
|
@@ -1623,8 +1619,8 @@ function Bn(e, r, t, n) {
|
|
|
1623
1619
|
}
|
|
1624
1620
|
}
|
|
1625
1621
|
l && (a = u), t.bulletCurrent = a;
|
|
1626
|
-
const
|
|
1627
|
-
return t.bulletLastUsed = a, t.bulletCurrent = o, i(),
|
|
1622
|
+
const s = t.containerFlow(e, n);
|
|
1623
|
+
return t.bulletLastUsed = a, t.bulletCurrent = o, i(), s;
|
|
1628
1624
|
}
|
|
1629
1625
|
function Wn(e) {
|
|
1630
1626
|
const r = e.options.listItemIndent || "one";
|
|
@@ -1642,13 +1638,13 @@ function Hn(e, r, t, n) {
|
|
|
1642
1638
|
(i === "tab" || i === "mixed" && (r && r.type === "list" && r.spread || e.spread)) && (a = Math.ceil(a / 4) * 4);
|
|
1643
1639
|
const u = t.createTracker(n);
|
|
1644
1640
|
u.move(o + " ".repeat(a - o.length)), u.shift(a);
|
|
1645
|
-
const l = t.enter("listItem"),
|
|
1641
|
+
const l = t.enter("listItem"), s = t.indentLines(
|
|
1646
1642
|
t.containerFlow(e, u.current()),
|
|
1647
|
-
|
|
1643
|
+
f
|
|
1648
1644
|
);
|
|
1649
|
-
return l(),
|
|
1650
|
-
function
|
|
1651
|
-
return p ? (
|
|
1645
|
+
return l(), s;
|
|
1646
|
+
function f(c, p, g) {
|
|
1647
|
+
return p ? (g ? "" : " ".repeat(a)) + c : (g ? o : o + " ".repeat(a - o.length)) + c;
|
|
1652
1648
|
}
|
|
1653
1649
|
}
|
|
1654
1650
|
function qn(e, r, t, n) {
|
|
@@ -1704,19 +1700,19 @@ function At(e, r, t, n) {
|
|
|
1704
1700
|
...a.current()
|
|
1705
1701
|
})
|
|
1706
1702
|
);
|
|
1707
|
-
const
|
|
1703
|
+
const s = l.charCodeAt(0), f = fe(
|
|
1708
1704
|
n.before.charCodeAt(n.before.length - 1),
|
|
1709
|
-
|
|
1705
|
+
s,
|
|
1710
1706
|
i
|
|
1711
1707
|
);
|
|
1712
|
-
|
|
1713
|
-
const
|
|
1714
|
-
p.inside && (l = l.slice(0, -1) + ne(
|
|
1715
|
-
const
|
|
1708
|
+
f.inside && (l = ne(s) + l.slice(1));
|
|
1709
|
+
const c = l.charCodeAt(l.length - 1), p = fe(n.after.charCodeAt(0), c, i);
|
|
1710
|
+
p.inside && (l = l.slice(0, -1) + ne(c));
|
|
1711
|
+
const g = a.move(i + i);
|
|
1716
1712
|
return o(), t.attentionEncodeSurroundingInfo = {
|
|
1717
1713
|
after: p.outside,
|
|
1718
|
-
before:
|
|
1719
|
-
}, u + l +
|
|
1714
|
+
before: f.outside
|
|
1715
|
+
}, u + l + g;
|
|
1720
1716
|
}
|
|
1721
1717
|
function Zn(e, r, t) {
|
|
1722
1718
|
return t.options.strong || "*";
|
|
@@ -1838,25 +1834,25 @@ function ia(e) {
|
|
|
1838
1834
|
tableRow: u
|
|
1839
1835
|
}
|
|
1840
1836
|
};
|
|
1841
|
-
function a(
|
|
1842
|
-
return
|
|
1837
|
+
function a(g, h, k, b) {
|
|
1838
|
+
return s(f(g, k, b), g.align);
|
|
1843
1839
|
}
|
|
1844
|
-
function u(
|
|
1845
|
-
const x =
|
|
1840
|
+
function u(g, h, k, b) {
|
|
1841
|
+
const x = c(g, k, b), w = s([x]);
|
|
1846
1842
|
return w.slice(0, w.indexOf(`
|
|
1847
1843
|
`));
|
|
1848
1844
|
}
|
|
1849
|
-
function l(
|
|
1850
|
-
const x = k.enter("tableCell"), w = k.enter("phrasing"), y = k.containerPhrasing(
|
|
1851
|
-
...
|
|
1845
|
+
function l(g, h, k, b) {
|
|
1846
|
+
const x = k.enter("tableCell"), w = k.enter("phrasing"), y = k.containerPhrasing(g, {
|
|
1847
|
+
...b,
|
|
1852
1848
|
before: o,
|
|
1853
1849
|
after: o
|
|
1854
1850
|
});
|
|
1855
1851
|
return w(), x(), y;
|
|
1856
1852
|
}
|
|
1857
|
-
function
|
|
1858
|
-
return gn(
|
|
1859
|
-
align:
|
|
1853
|
+
function s(g, h) {
|
|
1854
|
+
return gn(g, {
|
|
1855
|
+
align: h,
|
|
1860
1856
|
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
1861
1857
|
alignDelimiters: n,
|
|
1862
1858
|
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
@@ -1865,25 +1861,25 @@ function ia(e) {
|
|
|
1865
1861
|
stringLength: i
|
|
1866
1862
|
});
|
|
1867
1863
|
}
|
|
1868
|
-
function
|
|
1869
|
-
const
|
|
1864
|
+
function f(g, h, k) {
|
|
1865
|
+
const b = g.children;
|
|
1870
1866
|
let x = -1;
|
|
1871
|
-
const w = [], y =
|
|
1872
|
-
for (; ++x <
|
|
1873
|
-
w[x] =
|
|
1867
|
+
const w = [], y = h.enter("table");
|
|
1868
|
+
for (; ++x < b.length; )
|
|
1869
|
+
w[x] = c(b[x], h, k);
|
|
1874
1870
|
return y(), w;
|
|
1875
1871
|
}
|
|
1876
|
-
function
|
|
1877
|
-
const
|
|
1872
|
+
function c(g, h, k) {
|
|
1873
|
+
const b = g.children;
|
|
1878
1874
|
let x = -1;
|
|
1879
|
-
const w = [], y =
|
|
1880
|
-
for (; ++x <
|
|
1881
|
-
w[x] = l(
|
|
1875
|
+
const w = [], y = h.enter("tableRow");
|
|
1876
|
+
for (; ++x < b.length; )
|
|
1877
|
+
w[x] = l(b[x], g, h, k);
|
|
1882
1878
|
return y(), w;
|
|
1883
1879
|
}
|
|
1884
|
-
function p(
|
|
1885
|
-
let
|
|
1886
|
-
return k.stack.includes("tableCell") && (
|
|
1880
|
+
function p(g, h, k) {
|
|
1881
|
+
let b = It.inlineCode(g, h, k);
|
|
1882
|
+
return k.stack.includes("tableCell") && (b = b.replace(/\|/g, "\\$&")), b;
|
|
1887
1883
|
}
|
|
1888
1884
|
}
|
|
1889
1885
|
function oa() {
|
|
@@ -1933,9 +1929,9 @@ function ca(e, r, t, n) {
|
|
|
1933
1929
|
...n,
|
|
1934
1930
|
...u.current()
|
|
1935
1931
|
});
|
|
1936
|
-
return o && (l = l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,
|
|
1937
|
-
function
|
|
1938
|
-
return
|
|
1932
|
+
return o && (l = l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, s)), l;
|
|
1933
|
+
function s(f) {
|
|
1934
|
+
return f + a;
|
|
1939
1935
|
}
|
|
1940
1936
|
}
|
|
1941
1937
|
function sa() {
|
|
@@ -2047,20 +2043,20 @@ function ka(e, r, t) {
|
|
|
2047
2043
|
const n = this;
|
|
2048
2044
|
let i, o;
|
|
2049
2045
|
return a;
|
|
2050
|
-
function a(
|
|
2051
|
-
return !Le(
|
|
2046
|
+
function a(c) {
|
|
2047
|
+
return !Le(c) || !Et.call(n, n.previous) || Re(n.events) ? t(c) : (e.enter("literalAutolink"), e.enter("literalAutolinkEmail"), u(c));
|
|
2052
2048
|
}
|
|
2053
|
-
function u(
|
|
2054
|
-
return Le(
|
|
2049
|
+
function u(c) {
|
|
2050
|
+
return Le(c) ? (e.consume(c), u) : c === 64 ? (e.consume(c), l) : t(c);
|
|
2055
2051
|
}
|
|
2056
|
-
function l(
|
|
2057
|
-
return
|
|
2052
|
+
function l(c) {
|
|
2053
|
+
return c === 46 ? e.check(ga, f, s)(c) : c === 45 || c === 95 || Me(c) ? (o = !0, e.consume(c), l) : f(c);
|
|
2058
2054
|
}
|
|
2059
|
-
function c
|
|
2060
|
-
return e.consume(
|
|
2055
|
+
function s(c) {
|
|
2056
|
+
return e.consume(c), i = !0, l;
|
|
2061
2057
|
}
|
|
2062
|
-
function
|
|
2063
|
-
return o && i && re(n.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(
|
|
2058
|
+
function f(c) {
|
|
2059
|
+
return o && i && re(n.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(c)) : t(c);
|
|
2064
2060
|
}
|
|
2065
2061
|
}
|
|
2066
2062
|
function xa(e, r, t) {
|
|
@@ -2077,27 +2073,27 @@ function wa(e, r, t) {
|
|
|
2077
2073
|
const n = this;
|
|
2078
2074
|
let i = "", o = !1;
|
|
2079
2075
|
return a;
|
|
2080
|
-
function a(
|
|
2081
|
-
return (
|
|
2076
|
+
function a(c) {
|
|
2077
|
+
return (c === 72 || c === 104) && Rt.call(n, n.previous) && !Re(n.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), i += String.fromCodePoint(c), e.consume(c), u) : t(c);
|
|
2082
2078
|
}
|
|
2083
|
-
function u(
|
|
2084
|
-
if (re(
|
|
2085
|
-
return i += String.fromCodePoint(
|
|
2086
|
-
if (
|
|
2079
|
+
function u(c) {
|
|
2080
|
+
if (re(c) && i.length < 5)
|
|
2081
|
+
return i += String.fromCodePoint(c), e.consume(c), u;
|
|
2082
|
+
if (c === 58) {
|
|
2087
2083
|
const p = i.toLowerCase();
|
|
2088
2084
|
if (p === "http" || p === "https")
|
|
2089
|
-
return e.consume(
|
|
2085
|
+
return e.consume(c), l;
|
|
2090
2086
|
}
|
|
2091
|
-
return t(
|
|
2087
|
+
return t(c);
|
|
2092
2088
|
}
|
|
2093
|
-
function l(
|
|
2094
|
-
return
|
|
2089
|
+
function l(c) {
|
|
2090
|
+
return c === 47 ? (e.consume(c), o ? s : (o = !0, l)) : t(c);
|
|
2095
2091
|
}
|
|
2096
|
-
function c
|
|
2097
|
-
return
|
|
2092
|
+
function s(c) {
|
|
2093
|
+
return c === null || Tr(c) || D(c) || H(c) || he(c) ? t(c) : e.attempt(Nt, e.attempt(St, f), t)(c);
|
|
2098
2094
|
}
|
|
2099
|
-
function
|
|
2100
|
-
return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(
|
|
2095
|
+
function f(c) {
|
|
2096
|
+
return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(c);
|
|
2101
2097
|
}
|
|
2102
2098
|
}
|
|
2103
2099
|
function ya(e, r, t) {
|
|
@@ -2113,14 +2109,14 @@ function ya(e, r, t) {
|
|
|
2113
2109
|
function Ca(e, r, t) {
|
|
2114
2110
|
let n, i, o;
|
|
2115
2111
|
return a;
|
|
2116
|
-
function a(
|
|
2117
|
-
return
|
|
2112
|
+
function a(s) {
|
|
2113
|
+
return s === 46 || s === 95 ? e.check(Lt, l, u)(s) : s === null || D(s) || H(s) || s !== 45 && he(s) ? l(s) : (o = !0, e.consume(s), a);
|
|
2118
2114
|
}
|
|
2119
|
-
function u(
|
|
2120
|
-
return
|
|
2115
|
+
function u(s) {
|
|
2116
|
+
return s === 95 ? n = !0 : (i = n, n = void 0), e.consume(s), a;
|
|
2121
2117
|
}
|
|
2122
|
-
function l(
|
|
2123
|
-
return i || n || !o ? t(
|
|
2118
|
+
function l(s) {
|
|
2119
|
+
return i || n || !o ? t(s) : r(s);
|
|
2124
2120
|
}
|
|
2125
2121
|
}
|
|
2126
2122
|
function va(e, r) {
|
|
@@ -2269,11 +2265,11 @@ function Da(e, r, t) {
|
|
|
2269
2265
|
function u(l) {
|
|
2270
2266
|
if (!a || !a._balanced)
|
|
2271
2267
|
return t(l);
|
|
2272
|
-
const
|
|
2268
|
+
const s = ae(n.sliceSerialize({
|
|
2273
2269
|
start: a.end,
|
|
2274
2270
|
end: n.now()
|
|
2275
2271
|
}));
|
|
2276
|
-
return
|
|
2272
|
+
return s.codePointAt(0) !== 94 || !o.includes(s.slice(1)) ? t(l) : (e.enter("gfmFootnoteCallLabelMarker"), e.consume(l), e.exit("gfmFootnoteCallLabelMarker"), r(l));
|
|
2277
2273
|
}
|
|
2278
2274
|
}
|
|
2279
2275
|
function Pa(e, r) {
|
|
@@ -2330,66 +2326,66 @@ function Ra(e, r, t) {
|
|
|
2330
2326
|
const n = this, i = n.parser.gfmFootnotes || (n.parser.gfmFootnotes = []);
|
|
2331
2327
|
let o = 0, a;
|
|
2332
2328
|
return u;
|
|
2333
|
-
function u(
|
|
2334
|
-
return e.enter("gfmFootnoteCall"), e.enter("gfmFootnoteCallLabelMarker"), e.consume(
|
|
2329
|
+
function u(c) {
|
|
2330
|
+
return e.enter("gfmFootnoteCall"), e.enter("gfmFootnoteCallLabelMarker"), e.consume(c), e.exit("gfmFootnoteCallLabelMarker"), l;
|
|
2335
2331
|
}
|
|
2336
|
-
function l(
|
|
2337
|
-
return
|
|
2332
|
+
function l(c) {
|
|
2333
|
+
return c !== 94 ? t(c) : (e.enter("gfmFootnoteCallMarker"), e.consume(c), e.exit("gfmFootnoteCallMarker"), e.enter("gfmFootnoteCallString"), e.enter("chunkString").contentType = "string", s);
|
|
2338
2334
|
}
|
|
2339
|
-
function c
|
|
2335
|
+
function s(c) {
|
|
2340
2336
|
if (
|
|
2341
2337
|
// Too long.
|
|
2342
2338
|
o > 999 || // Closing brace with nothing.
|
|
2343
|
-
|
|
2339
|
+
c === 93 && !a || // Space or tab is not supported by GFM for some reason.
|
|
2344
2340
|
// `\n` and `[` not being supported makes sense.
|
|
2345
|
-
|
|
2341
|
+
c === null || c === 91 || D(c)
|
|
2346
2342
|
)
|
|
2347
|
-
return t(
|
|
2348
|
-
if (
|
|
2343
|
+
return t(c);
|
|
2344
|
+
if (c === 93) {
|
|
2349
2345
|
e.exit("chunkString");
|
|
2350
2346
|
const p = e.exit("gfmFootnoteCallString");
|
|
2351
|
-
return i.includes(ae(n.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(
|
|
2347
|
+
return i.includes(ae(n.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(c), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), r) : t(c);
|
|
2352
2348
|
}
|
|
2353
|
-
return D(
|
|
2349
|
+
return D(c) || (a = !0), o++, e.consume(c), c === 92 ? f : s;
|
|
2354
2350
|
}
|
|
2355
|
-
function
|
|
2356
|
-
return
|
|
2351
|
+
function f(c) {
|
|
2352
|
+
return c === 91 || c === 92 || c === 93 ? (e.consume(c), o++, s) : s(c);
|
|
2357
2353
|
}
|
|
2358
2354
|
}
|
|
2359
2355
|
function Ea(e, r, t) {
|
|
2360
2356
|
const n = this, i = n.parser.gfmFootnotes || (n.parser.gfmFootnotes = []);
|
|
2361
2357
|
let o, a = 0, u;
|
|
2362
2358
|
return l;
|
|
2363
|
-
function l(
|
|
2364
|
-
return e.enter("gfmFootnoteDefinition")._container = !0, e.enter("gfmFootnoteDefinitionLabel"), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(
|
|
2359
|
+
function l(h) {
|
|
2360
|
+
return e.enter("gfmFootnoteDefinition")._container = !0, e.enter("gfmFootnoteDefinitionLabel"), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"), s;
|
|
2365
2361
|
}
|
|
2366
|
-
function
|
|
2367
|
-
return
|
|
2362
|
+
function s(h) {
|
|
2363
|
+
return h === 94 ? (e.enter("gfmFootnoteDefinitionMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionMarker"), e.enter("gfmFootnoteDefinitionLabelString"), e.enter("chunkString").contentType = "string", f) : t(h);
|
|
2368
2364
|
}
|
|
2369
|
-
function
|
|
2365
|
+
function f(h) {
|
|
2370
2366
|
if (
|
|
2371
2367
|
// Too long.
|
|
2372
2368
|
a > 999 || // Closing brace with nothing.
|
|
2373
|
-
|
|
2369
|
+
h === 93 && !u || // Space or tab is not supported by GFM for some reason.
|
|
2374
2370
|
// `\n` and `[` not being supported makes sense.
|
|
2375
|
-
|
|
2371
|
+
h === null || h === 91 || D(h)
|
|
2376
2372
|
)
|
|
2377
|
-
return t(
|
|
2378
|
-
if (
|
|
2373
|
+
return t(h);
|
|
2374
|
+
if (h === 93) {
|
|
2379
2375
|
e.exit("chunkString");
|
|
2380
2376
|
const k = e.exit("gfmFootnoteDefinitionLabelString");
|
|
2381
|
-
return o = ae(n.sliceSerialize(k)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(
|
|
2377
|
+
return o = ae(n.sliceSerialize(k)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
|
|
2382
2378
|
}
|
|
2383
|
-
return D(
|
|
2379
|
+
return D(h) || (u = !0), a++, e.consume(h), h === 92 ? c : f;
|
|
2384
2380
|
}
|
|
2385
|
-
function
|
|
2386
|
-
return
|
|
2381
|
+
function c(h) {
|
|
2382
|
+
return h === 91 || h === 92 || h === 93 ? (e.consume(h), a++, f) : f(h);
|
|
2387
2383
|
}
|
|
2388
|
-
function p(
|
|
2389
|
-
return
|
|
2384
|
+
function p(h) {
|
|
2385
|
+
return h === 58 ? (e.enter("definitionMarker"), e.consume(h), e.exit("definitionMarker"), i.includes(o) || i.push(o), z(e, g, "gfmFootnoteDefinitionWhitespace")) : t(h);
|
|
2390
2386
|
}
|
|
2391
|
-
function
|
|
2392
|
-
return r(
|
|
2387
|
+
function g(h) {
|
|
2388
|
+
return r(h);
|
|
2393
2389
|
}
|
|
2394
2390
|
}
|
|
2395
2391
|
function _a(e, r, t) {
|
|
@@ -2428,21 +2424,21 @@ function ja(e) {
|
|
|
2428
2424
|
let l = -1;
|
|
2429
2425
|
for (; ++l < a.length; )
|
|
2430
2426
|
if (a[l][0] === "enter" && a[l][1].type === "strikethroughSequenceTemporary" && a[l][1]._close) {
|
|
2431
|
-
let
|
|
2432
|
-
for (;
|
|
2433
|
-
if (a[
|
|
2434
|
-
a[l][1].end.offset - a[l][1].start.offset === a[
|
|
2435
|
-
a[l][1].type = "strikethroughSequence", a[
|
|
2436
|
-
const
|
|
2427
|
+
let s = l;
|
|
2428
|
+
for (; s--; )
|
|
2429
|
+
if (a[s][0] === "exit" && a[s][1].type === "strikethroughSequenceTemporary" && a[s][1]._open && // If the sizes are the same:
|
|
2430
|
+
a[l][1].end.offset - a[l][1].start.offset === a[s][1].end.offset - a[s][1].start.offset) {
|
|
2431
|
+
a[l][1].type = "strikethroughSequence", a[s][1].type = "strikethroughSequence";
|
|
2432
|
+
const f = {
|
|
2437
2433
|
type: "strikethrough",
|
|
2438
|
-
start: Object.assign({}, a[
|
|
2434
|
+
start: Object.assign({}, a[s][1].start),
|
|
2439
2435
|
end: Object.assign({}, a[l][1].end)
|
|
2440
|
-
},
|
|
2436
|
+
}, c = {
|
|
2441
2437
|
type: "strikethroughText",
|
|
2442
|
-
start: Object.assign({}, a[
|
|
2438
|
+
start: Object.assign({}, a[s][1].end),
|
|
2443
2439
|
end: Object.assign({}, a[l][1].start)
|
|
2444
|
-
}, p = [["enter",
|
|
2445
|
-
|
|
2440
|
+
}, p = [["enter", f, u], ["enter", a[s][1], u], ["exit", a[s][1], u], ["enter", c, u]], g = u.parser.constructs.insideSpan.null;
|
|
2441
|
+
g && ce(p, p.length, 0, Ia(g, a.slice(s + 1, l), u)), ce(p, p.length, 0, [["exit", c, u], ["enter", a[l][1], u], ["exit", a[l][1], u], ["exit", f, u]]), ce(a, s - 1, l - s + 3, p), l = s + p.length - 2;
|
|
2446
2442
|
break;
|
|
2447
2443
|
}
|
|
2448
2444
|
}
|
|
@@ -2451,19 +2447,19 @@ function ja(e) {
|
|
|
2451
2447
|
return a;
|
|
2452
2448
|
}
|
|
2453
2449
|
function o(a, u, l) {
|
|
2454
|
-
const
|
|
2455
|
-
let
|
|
2450
|
+
const s = this.previous, f = this.events;
|
|
2451
|
+
let c = 0;
|
|
2456
2452
|
return p;
|
|
2457
|
-
function p(
|
|
2458
|
-
return
|
|
2453
|
+
function p(h) {
|
|
2454
|
+
return s === 126 && f[f.length - 1][1].type !== "characterEscape" ? l(h) : (a.enter("strikethroughSequenceTemporary"), g(h));
|
|
2459
2455
|
}
|
|
2460
|
-
function
|
|
2461
|
-
const k = de(
|
|
2462
|
-
if (
|
|
2463
|
-
return
|
|
2464
|
-
if (
|
|
2465
|
-
const
|
|
2466
|
-
return
|
|
2456
|
+
function g(h) {
|
|
2457
|
+
const k = de(s);
|
|
2458
|
+
if (h === 126)
|
|
2459
|
+
return c > 1 ? l(h) : (a.consume(h), c++, g);
|
|
2460
|
+
if (c < 2 && !t) return l(h);
|
|
2461
|
+
const b = a.exit("strikethroughSequenceTemporary"), x = de(h);
|
|
2462
|
+
return b._open = !x || x === 2 && !!k, b._close = !k || k === 2 && !!x, u(h);
|
|
2467
2463
|
}
|
|
2468
2464
|
}
|
|
2469
2465
|
}
|
|
@@ -2582,30 +2578,30 @@ function Wa(e, r, t) {
|
|
|
2582
2578
|
return O === C && n.parser.lazy[n.now().line] ? t(m) : O(m);
|
|
2583
2579
|
}
|
|
2584
2580
|
function l(m) {
|
|
2585
|
-
return e.enter("tableHead"), e.enter("tableRow"),
|
|
2581
|
+
return e.enter("tableHead"), e.enter("tableRow"), s(m);
|
|
2586
2582
|
}
|
|
2587
|
-
function
|
|
2588
|
-
return m === 124 || (a = !0, o += 1),
|
|
2583
|
+
function s(m) {
|
|
2584
|
+
return m === 124 || (a = !0, o += 1), f(m);
|
|
2589
2585
|
}
|
|
2590
|
-
function
|
|
2591
|
-
return m === null ? t(m) : Z(m) ? o > 1 ? (o = 0, n.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(m), e.exit("lineEnding"),
|
|
2586
|
+
function f(m) {
|
|
2587
|
+
return m === null ? t(m) : Z(m) ? o > 1 ? (o = 0, n.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(m), e.exit("lineEnding"), g) : t(m) : F(m) ? z(e, f, "whitespace")(m) : (o += 1, a && (a = !1, i += 1), m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), a = !0, f) : (e.enter("data"), c(m)));
|
|
2592
2588
|
}
|
|
2593
|
-
function
|
|
2594
|
-
return m === null || m === 124 || D(m) ? (e.exit("data"),
|
|
2589
|
+
function c(m) {
|
|
2590
|
+
return m === null || m === 124 || D(m) ? (e.exit("data"), f(m)) : (e.consume(m), m === 92 ? p : c);
|
|
2595
2591
|
}
|
|
2596
2592
|
function p(m) {
|
|
2597
|
-
return m === 92 || m === 124 ? (e.consume(m),
|
|
2593
|
+
return m === 92 || m === 124 ? (e.consume(m), c) : c(m);
|
|
2598
2594
|
}
|
|
2599
|
-
function
|
|
2600
|
-
return n.interrupt = !1, n.parser.lazy[n.now().line] ? t(m) : (e.enter("tableDelimiterRow"), a = !1, F(m) ? z(e,
|
|
2595
|
+
function g(m) {
|
|
2596
|
+
return n.interrupt = !1, n.parser.lazy[n.now().line] ? t(m) : (e.enter("tableDelimiterRow"), a = !1, F(m) ? z(e, h, "linePrefix", n.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(m) : h(m));
|
|
2601
2597
|
}
|
|
2602
|
-
function
|
|
2603
|
-
return m === 45 || m === 58 ?
|
|
2598
|
+
function h(m) {
|
|
2599
|
+
return m === 45 || m === 58 ? b(m) : m === 124 ? (a = !0, e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), k) : T(m);
|
|
2604
2600
|
}
|
|
2605
2601
|
function k(m) {
|
|
2606
|
-
return F(m) ? z(e,
|
|
2602
|
+
return F(m) ? z(e, b, "whitespace")(m) : b(m);
|
|
2607
2603
|
}
|
|
2608
|
-
function
|
|
2604
|
+
function b(m) {
|
|
2609
2605
|
return m === 58 ? (o += 1, a = !0, e.enter("tableDelimiterMarker"), e.consume(m), e.exit("tableDelimiterMarker"), x) : m === 45 ? (o += 1, x(m)) : m === null || Z(m) ? A(m) : T(m);
|
|
2610
2606
|
}
|
|
2611
2607
|
function x(m) {
|
|
@@ -2618,7 +2614,7 @@ function Wa(e, r, t) {
|
|
|
2618
2614
|
return F(m) ? z(e, A, "whitespace")(m) : A(m);
|
|
2619
2615
|
}
|
|
2620
2616
|
function A(m) {
|
|
2621
|
-
return m === 124 ?
|
|
2617
|
+
return m === 124 ? h(m) : m === null || Z(m) ? !a || i !== o ? T(m) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), r(m)) : T(m);
|
|
2622
2618
|
}
|
|
2623
2619
|
function T(m) {
|
|
2624
2620
|
return t(m);
|
|
@@ -2637,25 +2633,25 @@ function Wa(e, r, t) {
|
|
|
2637
2633
|
}
|
|
2638
2634
|
}
|
|
2639
2635
|
function Ha(e, r) {
|
|
2640
|
-
let t = -1, n = !0, i = 0, o = [0, 0, 0, 0], a = [0, 0, 0, 0], u = !1, l = 0,
|
|
2636
|
+
let t = -1, n = !0, i = 0, o = [0, 0, 0, 0], a = [0, 0, 0, 0], u = !1, l = 0, s, f, c;
|
|
2641
2637
|
const p = new $a();
|
|
2642
2638
|
for (; ++t < e.length; ) {
|
|
2643
|
-
const
|
|
2644
|
-
|
|
2639
|
+
const g = e[t], h = g[1];
|
|
2640
|
+
g[0] === "enter" ? h.type === "tableHead" ? (u = !1, l !== 0 && (Je(p, r, l, s, f), f = void 0, l = 0), s = {
|
|
2645
2641
|
type: "table",
|
|
2646
|
-
start: Object.assign({},
|
|
2642
|
+
start: Object.assign({}, h.start),
|
|
2647
2643
|
// Note: correct end is set later.
|
|
2648
|
-
end: Object.assign({},
|
|
2649
|
-
}, p.add(t, 0, [["enter",
|
|
2644
|
+
end: Object.assign({}, h.end)
|
|
2645
|
+
}, p.add(t, 0, [["enter", s, r]])) : h.type === "tableRow" || h.type === "tableDelimiterRow" ? (n = !0, c = void 0, o = [0, 0, 0, 0], a = [0, t + 1, 0, 0], u && (u = !1, f = {
|
|
2650
2646
|
type: "tableBody",
|
|
2651
|
-
start: Object.assign({},
|
|
2647
|
+
start: Object.assign({}, h.start),
|
|
2652
2648
|
// Note: correct end is set later.
|
|
2653
|
-
end: Object.assign({},
|
|
2654
|
-
}, p.add(t, 0, [["enter",
|
|
2649
|
+
end: Object.assign({}, h.end)
|
|
2650
|
+
}, p.add(t, 0, [["enter", f, r]])), i = h.type === "tableDelimiterRow" ? 2 : f ? 3 : 1) : i && (h.type === "data" || h.type === "tableDelimiterMarker" || h.type === "tableDelimiterFiller") ? (n = !1, a[2] === 0 && (o[1] !== 0 && (a[0] = a[1], c = ue(p, r, o, i, void 0, c), o = [0, 0, 0, 0]), a[2] = t)) : h.type === "tableCellDivider" && (n ? n = !1 : (o[1] !== 0 && (a[0] = a[1], c = ue(p, r, o, i, void 0, c)), o = a, a = [o[1], t, 0, 0])) : h.type === "tableHead" ? (u = !0, l = t) : h.type === "tableRow" || h.type === "tableDelimiterRow" ? (l = t, o[1] !== 0 ? (a[0] = a[1], c = ue(p, r, o, i, t, c)) : a[1] !== 0 && (c = ue(p, r, a, i, t, c)), i = 0) : i && (h.type === "data" || h.type === "tableDelimiterMarker" || h.type === "tableDelimiterFiller") && (a[3] = t);
|
|
2655
2651
|
}
|
|
2656
|
-
for (l !== 0 && Je(p, r, l,
|
|
2657
|
-
const
|
|
2658
|
-
|
|
2652
|
+
for (l !== 0 && Je(p, r, l, s, f), p.consume(r.events), t = -1; ++t < r.events.length; ) {
|
|
2653
|
+
const g = r.events[t];
|
|
2654
|
+
g[0] === "enter" && g[1].type === "table" && (g[1]._align = Ua(r.events, t));
|
|
2659
2655
|
}
|
|
2660
2656
|
return e;
|
|
2661
2657
|
}
|
|
@@ -2669,19 +2665,19 @@ function ue(e, r, t, n, i, o) {
|
|
|
2669
2665
|
// Note: correct end is set later.
|
|
2670
2666
|
end: Object.assign({}, l)
|
|
2671
2667
|
}, e.add(t[1], 0, [["enter", o, r]]), t[2] !== 0) {
|
|
2672
|
-
const
|
|
2668
|
+
const s = G(r.events, t[2]), f = G(r.events, t[3]), c = {
|
|
2673
2669
|
type: u,
|
|
2674
|
-
start: Object.assign({},
|
|
2675
|
-
end: Object.assign({},
|
|
2670
|
+
start: Object.assign({}, s),
|
|
2671
|
+
end: Object.assign({}, f)
|
|
2676
2672
|
};
|
|
2677
|
-
if (e.add(t[2], 0, [["enter",
|
|
2678
|
-
const p = r.events[t[2]],
|
|
2679
|
-
if (p[1].end = Object.assign({},
|
|
2680
|
-
const
|
|
2681
|
-
e.add(
|
|
2673
|
+
if (e.add(t[2], 0, [["enter", c, r]]), n !== 2) {
|
|
2674
|
+
const p = r.events[t[2]], g = r.events[t[3]];
|
|
2675
|
+
if (p[1].end = Object.assign({}, g[1].end), p[1].type = "chunkText", p[1].contentType = "text", t[3] > t[2] + 1) {
|
|
2676
|
+
const h = t[2] + 1, k = t[3] - t[2] - 1;
|
|
2677
|
+
e.add(h, k, []);
|
|
2682
2678
|
}
|
|
2683
2679
|
}
|
|
2684
|
-
e.add(t[3] + 1, 0, [["exit",
|
|
2680
|
+
e.add(t[3] + 1, 0, [["exit", c, r]]);
|
|
2685
2681
|
}
|
|
2686
2682
|
return i !== void 0 && (o.end = Object.assign({}, G(r.events, i)), e.add(i, 0, [["exit", o, r]]), o = void 0), o;
|
|
2687
2683
|
}
|
|
@@ -2753,7 +2749,7 @@ function Qa(e) {
|
|
|
2753
2749
|
function I(...e) {
|
|
2754
2750
|
return e.filter(Boolean).join(" ");
|
|
2755
2751
|
}
|
|
2756
|
-
const Xa = ({ content: e }) => /* @__PURE__ */
|
|
2752
|
+
const Xa = ({ content: e }) => /* @__PURE__ */ d(
|
|
2757
2753
|
Zt,
|
|
2758
2754
|
{
|
|
2759
2755
|
remarkPlugins: [Qa],
|
|
@@ -2764,7 +2760,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ h(
|
|
|
2764
2760
|
), _t = Ot(Xa), Ya = ({ language: e, code: r }) => {
|
|
2765
2761
|
const { isCopied: t, copyToClipboard: n } = ei();
|
|
2766
2762
|
return /* @__PURE__ */ v("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: [
|
|
2767
|
-
/* @__PURE__ */
|
|
2763
|
+
/* @__PURE__ */ d("span", { className: "cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand", children: e }),
|
|
2768
2764
|
/* @__PURE__ */ v(
|
|
2769
2765
|
"button",
|
|
2770
2766
|
{
|
|
@@ -2774,8 +2770,8 @@ const Xa = ({ content: e }) => /* @__PURE__ */ h(
|
|
|
2774
2770
|
className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-muted cuadra-transition-colors",
|
|
2775
2771
|
"aria-label": "Copy code",
|
|
2776
2772
|
children: [
|
|
2777
|
-
!t && /* @__PURE__ */
|
|
2778
|
-
t && /* @__PURE__ */
|
|
2773
|
+
!t && /* @__PURE__ */ d(sr, { className: "cuadra-h-4 cuadra-w-4" }),
|
|
2774
|
+
t && /* @__PURE__ */ d(ar, { className: "cuadra-h-4 cuadra-w-4" })
|
|
2779
2775
|
]
|
|
2780
2776
|
}
|
|
2781
2777
|
)
|
|
@@ -2790,14 +2786,14 @@ const Xa = ({ content: e }) => /* @__PURE__ */ h(
|
|
|
2790
2786
|
});
|
|
2791
2787
|
} };
|
|
2792
2788
|
}, ti = Vt({
|
|
2793
|
-
h1: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2789
|
+
h1: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
2794
2790
|
"h1",
|
|
2795
2791
|
{
|
|
2796
2792
|
className: I("cuadra-mb-6 cuadra-scroll-m-20 cuadra-text-2xl cuadra-font-normal cuadra-tracking-tight last:cuadra-mb-0 font-brand", e),
|
|
2797
2793
|
...r
|
|
2798
2794
|
}
|
|
2799
2795
|
),
|
|
2800
|
-
h2: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2796
|
+
h2: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
2801
2797
|
"h2",
|
|
2802
2798
|
{
|
|
2803
2799
|
className: I(
|
|
@@ -2807,7 +2803,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ h(
|
|
|
2807
2803
|
...r
|
|
2808
2804
|
}
|
|
2809
2805
|
),
|
|
2810
|
-
h3: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2806
|
+
h3: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
2811
2807
|
"h3",
|
|
2812
2808
|
{
|
|
2813
2809
|
className: I(
|
|
@@ -2817,7 +2813,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ h(
|
|
|
2817
2813
|
...r
|
|
2818
2814
|
}
|
|
2819
2815
|
),
|
|
2820
|
-
h4: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2816
|
+
h4: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
2821
2817
|
"h4",
|
|
2822
2818
|
{
|
|
2823
2819
|
className: I(
|
|
@@ -2827,28 +2823,28 @@ const Xa = ({ content: e }) => /* @__PURE__ */ h(
|
|
|
2827
2823
|
...r
|
|
2828
2824
|
}
|
|
2829
2825
|
),
|
|
2830
|
-
h5: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2831
|
-
h6: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2832
|
-
p: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2833
|
-
a: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2826
|
+
h5: ({ className: e, ...r }) => /* @__PURE__ */ d("h5", { className: I("cuadra-my-4 cuadra-text-lg cuadra-font-normal first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
|
|
2827
|
+
h6: ({ className: e, ...r }) => /* @__PURE__ */ d("h6", { className: I("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand", e), ...r }),
|
|
2828
|
+
p: ({ className: e, ...r }) => /* @__PURE__ */ d("p", { className: I("cuadra-mb-5 cuadra-mt-5 cuadra-leading-7 first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
|
|
2829
|
+
a: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
2834
2830
|
"a",
|
|
2835
2831
|
{
|
|
2836
2832
|
className: I("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand", e),
|
|
2837
2833
|
...r
|
|
2838
2834
|
}
|
|
2839
2835
|
),
|
|
2840
|
-
blockquote: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2841
|
-
ul: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2842
|
-
ol: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2843
|
-
hr: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2844
|
-
table: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2836
|
+
blockquote: ({ className: e, ...r }) => /* @__PURE__ */ d("blockquote", { className: I("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand", e), ...r }),
|
|
2837
|
+
ul: ({ className: e, ...r }) => /* @__PURE__ */ d("ul", { className: I("cuadra-my-5 cuadra-ml-6 cuadra-list-disc [&>li]:cuadra-mt-2 font-brand", e), ...r }),
|
|
2838
|
+
ol: ({ className: e, ...r }) => /* @__PURE__ */ d("ol", { className: I("cuadra-my-5 cuadra-ml-6 cuadra-list-decimal [&>li]:cuadra-mt-2 font-brand", e), ...r }),
|
|
2839
|
+
hr: ({ className: e, ...r }) => /* @__PURE__ */ d("hr", { className: I("cuadra-my-5 cuadra-border-b", e), ...r }),
|
|
2840
|
+
table: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
2845
2841
|
"table",
|
|
2846
2842
|
{
|
|
2847
2843
|
className: I("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand", e),
|
|
2848
2844
|
...r
|
|
2849
2845
|
}
|
|
2850
2846
|
),
|
|
2851
|
-
th: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2847
|
+
th: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
2852
2848
|
"th",
|
|
2853
2849
|
{
|
|
2854
2850
|
className: I(
|
|
@@ -2858,7 +2854,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ h(
|
|
|
2858
2854
|
...r
|
|
2859
2855
|
}
|
|
2860
2856
|
),
|
|
2861
|
-
td: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2857
|
+
td: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
2862
2858
|
"td",
|
|
2863
2859
|
{
|
|
2864
2860
|
className: I(
|
|
@@ -2868,7 +2864,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ h(
|
|
|
2868
2864
|
...r
|
|
2869
2865
|
}
|
|
2870
2866
|
),
|
|
2871
|
-
tr: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2867
|
+
tr: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
2872
2868
|
"tr",
|
|
2873
2869
|
{
|
|
2874
2870
|
className: I(
|
|
@@ -2878,8 +2874,8 @@ const Xa = ({ content: e }) => /* @__PURE__ */ h(
|
|
|
2878
2874
|
...r
|
|
2879
2875
|
}
|
|
2880
2876
|
),
|
|
2881
|
-
sup: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2882
|
-
pre: ({ className: e, ...r }) => /* @__PURE__ */
|
|
2877
|
+
sup: ({ className: e, ...r }) => /* @__PURE__ */ d("sup", { className: I("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand", e), ...r }),
|
|
2878
|
+
pre: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
2883
2879
|
"pre",
|
|
2884
2880
|
{
|
|
2885
2881
|
className: I(
|
|
@@ -2891,7 +2887,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ h(
|
|
|
2891
2887
|
),
|
|
2892
2888
|
code: function({ className: r, ...t }) {
|
|
2893
2889
|
const n = Gt();
|
|
2894
|
-
return /* @__PURE__ */
|
|
2890
|
+
return /* @__PURE__ */ d(
|
|
2895
2891
|
"code",
|
|
2896
2892
|
{
|
|
2897
2893
|
className: I(!n && "cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand", r),
|
|
@@ -2930,7 +2926,7 @@ function Xe({
|
|
|
2930
2926
|
suggestions: n,
|
|
2931
2927
|
inputPlaceholder: i = "Type your message..."
|
|
2932
2928
|
} = {}) {
|
|
2933
|
-
const o = Wt(), [a, u] = N(!1), [l,
|
|
2929
|
+
const o = Wt(), [a, u] = N(!1), [l, s] = N(null), [f, c] = N(!1);
|
|
2934
2930
|
return M(() => {
|
|
2935
2931
|
if (!o) {
|
|
2936
2932
|
u(!1);
|
|
@@ -2942,39 +2938,39 @@ function Xe({
|
|
|
2942
2938
|
u(!1);
|
|
2943
2939
|
return;
|
|
2944
2940
|
}
|
|
2945
|
-
const
|
|
2946
|
-
const
|
|
2947
|
-
|
|
2941
|
+
const g = p.subscribe?.((k) => {
|
|
2942
|
+
const b = k?.threadId, x = k?.messages || [], w = k?.isLoadingHistory || !1, y = x.length;
|
|
2943
|
+
b && b !== l && s(b), u(w && y === 0);
|
|
2948
2944
|
const T = x.some(
|
|
2949
2945
|
(C) => C.role === "assistant" && !!C.content && (Array.isArray(C.content) ? C.content.some((L) => typeof L == "object" && L?.text ? L.text.trim().length > 0 : !1) : typeof C.content == "string" ? C.content.trim().length > 0 : !1)
|
|
2950
2946
|
);
|
|
2951
|
-
|
|
2952
|
-
}),
|
|
2953
|
-
if (
|
|
2954
|
-
const k =
|
|
2955
|
-
k && k !== l &&
|
|
2956
|
-
const A =
|
|
2947
|
+
c(T);
|
|
2948
|
+
}), h = p.getState?.();
|
|
2949
|
+
if (h) {
|
|
2950
|
+
const k = h?.threadId, b = h?.messages || [], x = h?.isLoadingHistory || !1, w = b.length;
|
|
2951
|
+
k && k !== l && s(k), u(x && w === 0);
|
|
2952
|
+
const A = b.some(
|
|
2957
2953
|
(T) => T.role === "assistant" && !!T.content && (Array.isArray(T.content) ? T.content.some((C) => typeof C == "object" && C?.text ? C.text.trim().length > 0 : !1) : typeof T.content == "string" ? T.content.trim().length > 0 : !1)
|
|
2958
2954
|
);
|
|
2959
|
-
|
|
2955
|
+
c(A);
|
|
2960
2956
|
}
|
|
2961
2957
|
return () => {
|
|
2962
|
-
|
|
2958
|
+
g && g();
|
|
2963
2959
|
};
|
|
2964
2960
|
} catch {
|
|
2965
2961
|
u(!1);
|
|
2966
2962
|
}
|
|
2967
2963
|
}, [o, l]), /* @__PURE__ */ v(ee.Root, { className: "cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full", children: [
|
|
2968
|
-
/* @__PURE__ */
|
|
2964
|
+
/* @__PURE__ */ d(
|
|
2969
2965
|
ee.Viewport,
|
|
2970
2966
|
{
|
|
2971
2967
|
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",
|
|
2972
2968
|
style: t ? { paddingTop: t } : void 0,
|
|
2973
|
-
children: a ? /* @__PURE__ */
|
|
2974
|
-
/* @__PURE__ */
|
|
2975
|
-
/* @__PURE__ */
|
|
2969
|
+
children: a ? /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-inset-0 cuadra-flex cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: [
|
|
2970
|
+
/* @__PURE__ */ d(ot, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }),
|
|
2971
|
+
/* @__PURE__ */ d("p", { className: "cuadra-text-sm cuadra-text-muted-foreground font-brand", children: "Loading messages..." })
|
|
2976
2972
|
] }) }) : /* @__PURE__ */ v(B, { children: [
|
|
2977
|
-
/* @__PURE__ */
|
|
2973
|
+
/* @__PURE__ */ d(ee.Empty, { children: /* @__PURE__ */ d(
|
|
2978
2974
|
ni,
|
|
2979
2975
|
{
|
|
2980
2976
|
title: e,
|
|
@@ -2982,7 +2978,7 @@ function Xe({
|
|
|
2982
2978
|
suggestions: n
|
|
2983
2979
|
}
|
|
2984
2980
|
) }),
|
|
2985
|
-
/* @__PURE__ */
|
|
2981
|
+
/* @__PURE__ */ d(
|
|
2986
2982
|
ee.Messages,
|
|
2987
2983
|
{
|
|
2988
2984
|
components: {
|
|
@@ -2991,16 +2987,16 @@ function Xe({
|
|
|
2991
2987
|
}
|
|
2992
2988
|
}
|
|
2993
2989
|
),
|
|
2994
|
-
/* @__PURE__ */
|
|
2990
|
+
/* @__PURE__ */ d(ee.If, { running: !0, children: !f && /* @__PURE__ */ d("div", { className: "cuadra-mt-2 cuadra-max-w-2xl", children: /* @__PURE__ */ d(ri, { active: !0 }) }) })
|
|
2995
2991
|
] })
|
|
2996
2992
|
}
|
|
2997
2993
|
),
|
|
2998
|
-
/* @__PURE__ */
|
|
2999
|
-
/* @__PURE__ */
|
|
2994
|
+
/* @__PURE__ */ d("div", { className: "cuadra-w-full cuadra-mt-3 cuadra-border-t cuadra-border-border cuadra-pt-4", children: /* @__PURE__ */ v(ke.Root, { className: "cuadra-relative !cuadra-relative cuadra-flex-1 cuadra-w-full", children: [
|
|
2995
|
+
/* @__PURE__ */ d(
|
|
3000
2996
|
ke.Input,
|
|
3001
2997
|
{
|
|
3002
2998
|
asChild: !0,
|
|
3003
|
-
children: /* @__PURE__ */
|
|
2999
|
+
children: /* @__PURE__ */ d(
|
|
3004
3000
|
"textarea",
|
|
3005
3001
|
{
|
|
3006
3002
|
rows: 3,
|
|
@@ -3011,14 +3007,14 @@ function Xe({
|
|
|
3011
3007
|
)
|
|
3012
3008
|
}
|
|
3013
3009
|
),
|
|
3014
|
-
/* @__PURE__ */
|
|
3010
|
+
/* @__PURE__ */ d(ke.Send, { asChild: !0, children: /* @__PURE__ */ d(
|
|
3015
3011
|
"button",
|
|
3016
3012
|
{
|
|
3017
3013
|
className: "!cuadra-absolute !cuadra-bottom-2 !cuadra-right-2 cuadra-size-8 cuadra-bg-secondary cuadra-text-secondary-foreground cuadra-rounded-md cuadra-shadow-sm hover:cuadra-bg-secondary/90 disabled:cuadra-opacity-50 disabled:cuadra-cursor-not-allowed cuadra-flex cuadra-items-center cuadra-justify-center",
|
|
3018
3014
|
style: { position: "absolute", bottom: "0.5rem", right: "0.5rem" },
|
|
3019
3015
|
"aria-label": "Send message",
|
|
3020
3016
|
type: "button",
|
|
3021
|
-
children: /* @__PURE__ */
|
|
3017
|
+
children: /* @__PURE__ */ d(rr, { className: "cuadra-h-4 cuadra-w-4" })
|
|
3022
3018
|
}
|
|
3023
3019
|
) })
|
|
3024
3020
|
] }) })
|
|
@@ -3031,12 +3027,12 @@ function ni({ title: e, subtitle: r, suggestions: t }) {
|
|
|
3031
3027
|
} catch {
|
|
3032
3028
|
}
|
|
3033
3029
|
};
|
|
3034
|
-
return /* @__PURE__ */
|
|
3030
|
+
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__ */ v("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: [
|
|
3035
3031
|
/* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8", children: [
|
|
3036
|
-
/* @__PURE__ */
|
|
3037
|
-
/* @__PURE__ */
|
|
3032
|
+
/* @__PURE__ */ d("h2", { className: "cuadra-text-lg cuadra-font-normal cuadra-text-foreground cuadra-mb-2 font-brand", children: e }),
|
|
3033
|
+
/* @__PURE__ */ d("p", { className: "cuadra-text-muted-foreground font-brand", children: r })
|
|
3038
3034
|
] }),
|
|
3039
|
-
t && t.length > 0 && /* @__PURE__ */
|
|
3035
|
+
t && t.length > 0 && /* @__PURE__ */ d("div", { className: "cuadra-grid cuadra-grid-cols-2 cuadra-gap-2 cuadra-pb-4 cuadra-w-full cuadra-max-w-2xl", children: t.map((o, a) => /* @__PURE__ */ d(
|
|
3040
3036
|
"button",
|
|
3041
3037
|
{
|
|
3042
3038
|
type: "button",
|
|
@@ -3050,7 +3046,7 @@ function ni({ title: e, subtitle: r, suggestions: t }) {
|
|
|
3050
3046
|
] }) });
|
|
3051
3047
|
}
|
|
3052
3048
|
function ai() {
|
|
3053
|
-
return /* @__PURE__ */
|
|
3049
|
+
return /* @__PURE__ */ d(se.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: /* @__PURE__ */ d(
|
|
3054
3050
|
"div",
|
|
3055
3051
|
{
|
|
3056
3052
|
className: "cuadra-bg-muted cuadra-text-foreground cuadra-col-start-2 cuadra-row-start-2 cuadra-max-w-[calc(42rem*0.8)] cuadra-break-words cuadra-rounded-3xl cuadra-px-5 cuadra-py-2.5 font-brand",
|
|
@@ -3065,11 +3061,11 @@ function ai() {
|
|
|
3065
3061
|
paddingBottom: "0.625rem",
|
|
3066
3062
|
wordBreak: "break-word"
|
|
3067
3063
|
},
|
|
3068
|
-
children: /* @__PURE__ */
|
|
3064
|
+
children: /* @__PURE__ */ d(
|
|
3069
3065
|
se.Parts,
|
|
3070
3066
|
{
|
|
3071
3067
|
components: {
|
|
3072
|
-
Text: ({ text: e }) => /* @__PURE__ */
|
|
3068
|
+
Text: ({ text: e }) => /* @__PURE__ */ d(_t, { content: e || "" })
|
|
3073
3069
|
}
|
|
3074
3070
|
}
|
|
3075
3071
|
)
|
|
@@ -3077,7 +3073,7 @@ function ai() {
|
|
|
3077
3073
|
) });
|
|
3078
3074
|
}
|
|
3079
3075
|
function ii() {
|
|
3080
|
-
return /* @__PURE__ */
|
|
3076
|
+
return /* @__PURE__ */ d(se.Root, { className: "cuadra-relative cuadra-grid cuadra-w-full cuadra-grid-cols-[auto_auto_1fr] cuadra-grid-rows-[auto_1fr] cuadra-py-3", children: /* @__PURE__ */ d(
|
|
3081
3077
|
"div",
|
|
3082
3078
|
{
|
|
3083
3079
|
className: "cuadra-text-foreground cuadra-col-span-2 cuadra-col-start-2 cuadra-row-start-1 cuadra-my-1.5 cuadra-max-w-[90%] cuadra-break-words cuadra-leading-7 font-brand",
|
|
@@ -3086,11 +3082,11 @@ function ii() {
|
|
|
3086
3082
|
marginTop: "0.375rem",
|
|
3087
3083
|
marginBottom: "0.375rem"
|
|
3088
3084
|
},
|
|
3089
|
-
children: /* @__PURE__ */
|
|
3085
|
+
children: /* @__PURE__ */ d(
|
|
3090
3086
|
se.Parts,
|
|
3091
3087
|
{
|
|
3092
3088
|
components: {
|
|
3093
|
-
Text: ({ text: e }) => /* @__PURE__ */
|
|
3089
|
+
Text: ({ text: e }) => /* @__PURE__ */ d(_t, { content: e || "" })
|
|
3094
3090
|
}
|
|
3095
3091
|
}
|
|
3096
3092
|
)
|
|
@@ -3098,24 +3094,24 @@ function ii() {
|
|
|
3098
3094
|
) });
|
|
3099
3095
|
}
|
|
3100
3096
|
function oi({ onThreadSelect: e }) {
|
|
3101
|
-
const r = qt(), t = Kt((
|
|
3102
|
-
if (!r?.remoteId || !
|
|
3097
|
+
const r = qt(), t = Kt((b) => b.threadId), [n, i] = N(null), o = r?.id === t, a = n === r?.id, [u, l] = N(!1), [s, f] = N(r?.title || ""), [c, p] = N(!1), [g, h] = N(!1), k = async () => {
|
|
3098
|
+
if (!r?.remoteId || !s || s === r.title) {
|
|
3103
3099
|
l(!1);
|
|
3104
3100
|
return;
|
|
3105
3101
|
}
|
|
3106
3102
|
try {
|
|
3107
|
-
|
|
3108
|
-
const
|
|
3109
|
-
|
|
3103
|
+
h(!0);
|
|
3104
|
+
const b = window.__cuadraThreadListAdapter;
|
|
3105
|
+
b && typeof b.rename == "function" && await b.rename(r.remoteId, s), l(!1), p(!1);
|
|
3110
3106
|
} catch {
|
|
3111
3107
|
l(!1), p(!1);
|
|
3112
3108
|
} finally {
|
|
3113
|
-
|
|
3109
|
+
h(!1);
|
|
3114
3110
|
}
|
|
3115
3111
|
};
|
|
3116
3112
|
return M(() => {
|
|
3117
|
-
r?.title && !u &&
|
|
3118
|
-
}, [r?.title, u]), r ? /* @__PURE__ */
|
|
3113
|
+
r?.title && !u && f(r.title);
|
|
3114
|
+
}, [r?.title, u]), r ? /* @__PURE__ */ d(
|
|
3119
3115
|
we.Root,
|
|
3120
3116
|
{
|
|
3121
3117
|
className: `group cuadra-relative cuadra-flex cuadra-items-center cuadra-gap-3 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"}`,
|
|
@@ -3128,71 +3124,71 @@ function oi({ onThreadSelect: e }) {
|
|
|
3128
3124
|
className: "cuadra-p-3 cuadra-flex-1 cuadra-flex cuadra-items-center cuadra-justify-between cuadra-w-full cuadra-min-w-0 cuadra-cursor-pointer",
|
|
3129
3125
|
onClick: () => e?.(),
|
|
3130
3126
|
children: [
|
|
3131
|
-
/* @__PURE__ */
|
|
3127
|
+
/* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-flex-col cuadra-min-w-0 cuadra-flex-1 cuadra-items-start cuadra-text-left", children: u ? /* @__PURE__ */ d(
|
|
3132
3128
|
"input",
|
|
3133
3129
|
{
|
|
3134
3130
|
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",
|
|
3135
|
-
value:
|
|
3136
|
-
onChange: (
|
|
3137
|
-
onKeyDown: (
|
|
3138
|
-
|
|
3131
|
+
value: s,
|
|
3132
|
+
onChange: (b) => f(b.target.value),
|
|
3133
|
+
onKeyDown: (b) => {
|
|
3134
|
+
b.key === "Enter" && k(), b.key === "Escape" && (l(!1), f(r.title || ""));
|
|
3139
3135
|
},
|
|
3140
|
-
disabled:
|
|
3136
|
+
disabled: g,
|
|
3141
3137
|
autoFocus: !0,
|
|
3142
|
-
onClick: (
|
|
3138
|
+
onClick: (b) => b.stopPropagation()
|
|
3143
3139
|
}
|
|
3144
3140
|
) : /* @__PURE__ */ v(B, { children: [
|
|
3145
|
-
/* @__PURE__ */
|
|
3146
|
-
r.updatedAt && /* @__PURE__ */
|
|
3141
|
+
/* @__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" }),
|
|
3142
|
+
r.updatedAt && /* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-mt-1 font-brand", children: new Date(r.updatedAt).toLocaleDateString() })
|
|
3147
3143
|
] }) }),
|
|
3148
|
-
/* @__PURE__ */
|
|
3149
|
-
/* @__PURE__ */
|
|
3144
|
+
/* @__PURE__ */ d("div", { className: "cuadra-ml-2 cuadra-flex-shrink-0 cuadra-w-6 cuadra-h-6 cuadra-flex cuadra-items-center cuadra-justify-center", children: (a || o || c) && /* @__PURE__ */ v("div", { className: "cuadra-relative", children: [
|
|
3145
|
+
/* @__PURE__ */ d(
|
|
3150
3146
|
"button",
|
|
3151
3147
|
{
|
|
3152
3148
|
className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-background/50 cuadra-transition-colors",
|
|
3153
|
-
onClick: (
|
|
3154
|
-
|
|
3149
|
+
onClick: (b) => {
|
|
3150
|
+
b.stopPropagation(), p(!c);
|
|
3155
3151
|
},
|
|
3156
3152
|
"aria-label": "Thread options",
|
|
3157
|
-
children: /* @__PURE__ */
|
|
3153
|
+
children: /* @__PURE__ */ d(fr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" })
|
|
3158
3154
|
}
|
|
3159
3155
|
),
|
|
3160
|
-
|
|
3161
|
-
/* @__PURE__ */
|
|
3156
|
+
c && /* @__PURE__ */ v(B, { children: [
|
|
3157
|
+
/* @__PURE__ */ d(
|
|
3162
3158
|
"div",
|
|
3163
3159
|
{
|
|
3164
3160
|
className: "cuadra-fixed cuadra-inset-0 cuadra-z-40",
|
|
3165
3161
|
onClick: () => p(!1)
|
|
3166
3162
|
}
|
|
3167
3163
|
),
|
|
3168
|
-
/* @__PURE__ */
|
|
3164
|
+
/* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-right-0 cuadra-top-8 cuadra-z-50 cuadra-bg-background cuadra-border cuadra-border-border cuadra-rounded-lg cuadra-shadow-lg cuadra-min-w-[120px] cuadra-overflow-hidden", children: u ? /* @__PURE__ */ d(
|
|
3169
3165
|
"button",
|
|
3170
3166
|
{
|
|
3171
3167
|
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",
|
|
3172
|
-
onClick: (
|
|
3173
|
-
|
|
3168
|
+
onClick: (b) => {
|
|
3169
|
+
b.stopPropagation(), k();
|
|
3174
3170
|
},
|
|
3175
|
-
disabled:
|
|
3171
|
+
disabled: g,
|
|
3176
3172
|
children: "Save"
|
|
3177
3173
|
}
|
|
3178
3174
|
) : /* @__PURE__ */ v(B, { children: [
|
|
3179
|
-
/* @__PURE__ */
|
|
3175
|
+
/* @__PURE__ */ d(
|
|
3180
3176
|
"button",
|
|
3181
3177
|
{
|
|
3182
3178
|
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",
|
|
3183
|
-
onClick: (
|
|
3184
|
-
|
|
3179
|
+
onClick: (b) => {
|
|
3180
|
+
b.stopPropagation(), l(!0), f(r.title || ""), p(!1);
|
|
3185
3181
|
},
|
|
3186
3182
|
children: "Rename"
|
|
3187
3183
|
}
|
|
3188
3184
|
),
|
|
3189
|
-
/* @__PURE__ */
|
|
3190
|
-
/* @__PURE__ */
|
|
3185
|
+
/* @__PURE__ */ d("div", { className: "cuadra-border-t cuadra-border-border" }),
|
|
3186
|
+
/* @__PURE__ */ d(we.Delete, { asChild: !0, children: /* @__PURE__ */ d(
|
|
3191
3187
|
"button",
|
|
3192
3188
|
{
|
|
3193
3189
|
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",
|
|
3194
|
-
onClick: (
|
|
3195
|
-
|
|
3190
|
+
onClick: (b) => {
|
|
3191
|
+
b.stopPropagation(), p(!1);
|
|
3196
3192
|
},
|
|
3197
3193
|
children: "Delete"
|
|
3198
3194
|
}
|
|
@@ -3208,25 +3204,25 @@ function oi({ onThreadSelect: e }) {
|
|
|
3208
3204
|
}
|
|
3209
3205
|
function Ye({ onThreadSelect: e }) {
|
|
3210
3206
|
return /* @__PURE__ */ v(xe.Root, { className: "!cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-transition-all cuadra-duration-300 cuadra-ease-in-out cuadra-h-full cuadra-w-80", style: { borderRightWidth: "1px" }, children: [
|
|
3211
|
-
/* @__PURE__ */
|
|
3207
|
+
/* @__PURE__ */ d("div", { className: "cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-between cuadra-transition-all cuadra-duration-300 cuadra-h-16 cuadra-px-4", children: /* @__PURE__ */ d("h3", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-text-nowrap font-brand", children: "Chat History" }) }),
|
|
3212
3208
|
/* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin", children: [
|
|
3213
|
-
/* @__PURE__ */
|
|
3209
|
+
/* @__PURE__ */ d(
|
|
3214
3210
|
xe.New,
|
|
3215
3211
|
{
|
|
3216
3212
|
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",
|
|
3217
3213
|
onClick: () => e?.(),
|
|
3218
|
-
children: /* @__PURE__ */
|
|
3219
|
-
/* @__PURE__ */
|
|
3220
|
-
/* @__PURE__ */
|
|
3214
|
+
children: /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-min-w-0", children: /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
|
|
3215
|
+
/* @__PURE__ */ d(br, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
|
|
3216
|
+
/* @__PURE__ */ d("h4", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground font-brand", children: "New Chat" })
|
|
3221
3217
|
] }) })
|
|
3222
3218
|
}
|
|
3223
3219
|
),
|
|
3224
|
-
/* @__PURE__ */
|
|
3225
|
-
/* @__PURE__ */
|
|
3220
|
+
/* @__PURE__ */ d("div", { className: "cuadra-my-2 cuadra-border-t cuadra-border-border" }),
|
|
3221
|
+
/* @__PURE__ */ d(
|
|
3226
3222
|
xe.Items,
|
|
3227
3223
|
{
|
|
3228
3224
|
components: {
|
|
3229
|
-
ThreadListItem: (r) => /* @__PURE__ */
|
|
3225
|
+
ThreadListItem: (r) => /* @__PURE__ */ d(oi, { ...r, onThreadSelect: e })
|
|
3230
3226
|
}
|
|
3231
3227
|
}
|
|
3232
3228
|
)
|
|
@@ -3247,14 +3243,14 @@ const li = `
|
|
|
3247
3243
|
contentStyle: a,
|
|
3248
3244
|
rotating: u = !1
|
|
3249
3245
|
}) => /* @__PURE__ */ v(B, { children: [
|
|
3250
|
-
/* @__PURE__ */
|
|
3246
|
+
/* @__PURE__ */ d("style", { children: li }),
|
|
3251
3247
|
/* @__PURE__ */ v(
|
|
3252
3248
|
"div",
|
|
3253
3249
|
{
|
|
3254
3250
|
className: `cuadra-relative cuadra-bg-background md:cuadra-rounded-xl cuadra-overflow-hidden ${r}`,
|
|
3255
3251
|
style: { padding: i, ...o },
|
|
3256
3252
|
children: [
|
|
3257
|
-
/* @__PURE__ */
|
|
3253
|
+
/* @__PURE__ */ d(
|
|
3258
3254
|
"div",
|
|
3259
3255
|
{
|
|
3260
3256
|
className: "cuadra-absolute md:cuadra-rounded-xl",
|
|
@@ -3280,7 +3276,7 @@ const li = `
|
|
|
3280
3276
|
}
|
|
3281
3277
|
}
|
|
3282
3278
|
),
|
|
3283
|
-
/* @__PURE__ */
|
|
3279
|
+
/* @__PURE__ */ d(
|
|
3284
3280
|
"div",
|
|
3285
3281
|
{
|
|
3286
3282
|
className: `cuadra-relative cuadra-bg-background cuadra-h-full cuadra-z-10 cuadra-flex cuadra-flex-col cuadra-overflow-hidden ${t} ${n}`,
|
|
@@ -3308,7 +3304,7 @@ const li = `
|
|
|
3308
3304
|
}, [r]), M(() => {
|
|
3309
3305
|
const a = document.documentElement;
|
|
3310
3306
|
a.classList.remove("light", "dark"), a.classList.add(n), r === "system" && localStorage.setItem("theme", n);
|
|
3311
|
-
}, [n, r]), /* @__PURE__ */
|
|
3307
|
+
}, [n, r]), /* @__PURE__ */ d(
|
|
3312
3308
|
"button",
|
|
3313
3309
|
{
|
|
3314
3310
|
type: "button",
|
|
@@ -3318,7 +3314,7 @@ const li = `
|
|
|
3318
3314
|
},
|
|
3319
3315
|
disabled: r !== "system",
|
|
3320
3316
|
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}`,
|
|
3321
|
-
children: /* @__PURE__ */
|
|
3317
|
+
children: /* @__PURE__ */ d(
|
|
3322
3318
|
ur,
|
|
3323
3319
|
{
|
|
3324
3320
|
className: `cuadra-h-4 cuadra-w-4 cuadra-transition-colors ${n === "dark" ? "cuadra-text-primary" : "cuadra-text-gray-400"}`
|
|
@@ -3336,58 +3332,58 @@ const li = `
|
|
|
3336
3332
|
showThemeToggle: a = !0,
|
|
3337
3333
|
theme: u = "system",
|
|
3338
3334
|
onMobileMenuClick: l,
|
|
3339
|
-
showMobileMenuButton:
|
|
3335
|
+
showMobileMenuButton: s = !1
|
|
3340
3336
|
}) => {
|
|
3341
|
-
const [
|
|
3337
|
+
const [f, c] = N(!1), p = rt(null);
|
|
3342
3338
|
M(() => {
|
|
3343
|
-
const
|
|
3344
|
-
p.current && !p.current.contains(k.target) &&
|
|
3339
|
+
const h = (k) => {
|
|
3340
|
+
p.current && !p.current.contains(k.target) && c(!1);
|
|
3345
3341
|
};
|
|
3346
|
-
return
|
|
3347
|
-
document.removeEventListener("mousedown",
|
|
3342
|
+
return f && document.addEventListener("mousedown", h), () => {
|
|
3343
|
+
document.removeEventListener("mousedown", h);
|
|
3348
3344
|
};
|
|
3349
|
-
}, [
|
|
3350
|
-
const
|
|
3345
|
+
}, [f]);
|
|
3346
|
+
const g = r.find((h) => h.id === e);
|
|
3351
3347
|
return /* @__PURE__ */ v("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: [
|
|
3352
3348
|
/* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
|
|
3353
|
-
|
|
3349
|
+
s && /* @__PURE__ */ d(
|
|
3354
3350
|
"button",
|
|
3355
3351
|
{
|
|
3356
3352
|
type: "button",
|
|
3357
3353
|
onClick: l,
|
|
3358
3354
|
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",
|
|
3359
3355
|
"aria-label": "Toggle thread list",
|
|
3360
|
-
children: /* @__PURE__ */
|
|
3356
|
+
children: /* @__PURE__ */ d(pr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
|
|
3361
3357
|
}
|
|
3362
3358
|
),
|
|
3363
|
-
a && /* @__PURE__ */
|
|
3359
|
+
a && /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d(ui, { theme: u }) })
|
|
3364
3360
|
] }),
|
|
3365
3361
|
/* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 md:cuadra-ml-0 cuadra-ml-auto", children: [
|
|
3366
|
-
!o && /* @__PURE__ */
|
|
3367
|
-
o ? null : t ? /* @__PURE__ */
|
|
3362
|
+
!o && /* @__PURE__ */ d("label", { className: "cuadra-hidden md:cuadra-inline cuadra-text-sm cuadra-text-muted-foreground cuadra-font-brand", children: "Model" }),
|
|
3363
|
+
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..." }) }) : n ? /* @__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__ */ v("div", { ref: p, className: "cuadra-relative cuadra-w-48", children: [
|
|
3368
3364
|
/* @__PURE__ */ v(
|
|
3369
3365
|
"button",
|
|
3370
3366
|
{
|
|
3371
3367
|
type: "button",
|
|
3372
|
-
onClick: () =>
|
|
3368
|
+
onClick: () => c(!f),
|
|
3373
3369
|
disabled: t || r.length === 0 || !!n,
|
|
3374
3370
|
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",
|
|
3375
3371
|
children: [
|
|
3376
|
-
/* @__PURE__ */
|
|
3377
|
-
/* @__PURE__ */
|
|
3372
|
+
/* @__PURE__ */ d("span", { className: g ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: g?.name || "Select model" }),
|
|
3373
|
+
/* @__PURE__ */ d(or, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
|
|
3378
3374
|
]
|
|
3379
3375
|
}
|
|
3380
3376
|
),
|
|
3381
|
-
|
|
3377
|
+
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((h) => /* @__PURE__ */ v(
|
|
3382
3378
|
"button",
|
|
3383
3379
|
{
|
|
3384
3380
|
type: "button",
|
|
3385
3381
|
onClick: () => {
|
|
3386
|
-
i(
|
|
3382
|
+
i(h.id), c(!1);
|
|
3387
3383
|
},
|
|
3388
|
-
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 ===
|
|
3384
|
+
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 === h.id ? "cuadra-bg-secondary cuadra-text-secondary-foreground" : "hover:cuadra-bg-secondary/50"}`,
|
|
3389
3385
|
children: [
|
|
3390
|
-
e ===
|
|
3386
|
+
e === h.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(
|
|
3391
3387
|
"svg",
|
|
3392
3388
|
{
|
|
3393
3389
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3395,7 +3391,7 @@ const li = `
|
|
|
3395
3391
|
height: "16",
|
|
3396
3392
|
fill: "none",
|
|
3397
3393
|
viewBox: "0 0 16 16",
|
|
3398
|
-
children: /* @__PURE__ */
|
|
3394
|
+
children: /* @__PURE__ */ d(
|
|
3399
3395
|
"path",
|
|
3400
3396
|
{
|
|
3401
3397
|
fill: "currentColor",
|
|
@@ -3406,15 +3402,15 @@ const li = `
|
|
|
3406
3402
|
)
|
|
3407
3403
|
}
|
|
3408
3404
|
) }),
|
|
3409
|
-
/* @__PURE__ */
|
|
3405
|
+
/* @__PURE__ */ d("span", { children: h.name })
|
|
3410
3406
|
]
|
|
3411
3407
|
},
|
|
3412
|
-
|
|
3408
|
+
h.id
|
|
3413
3409
|
)) }) })
|
|
3414
3410
|
] })
|
|
3415
3411
|
] })
|
|
3416
3412
|
] });
|
|
3417
|
-
}, ci = Ut(void 0), Ie = ({ children: e, value: r }) => /* @__PURE__ */
|
|
3413
|
+
}, ci = Ut(void 0), Ie = ({ children: e, value: r }) => /* @__PURE__ */ d(ci.Provider, { value: r, children: e });
|
|
3418
3414
|
function si() {
|
|
3419
3415
|
M(() => {
|
|
3420
3416
|
if (document.querySelector("style[data-cuadra-uikit]"))
|
|
@@ -3449,14 +3445,14 @@ const di = ({ config: e }) => {
|
|
|
3449
3445
|
modelId: a,
|
|
3450
3446
|
onModelChange: u,
|
|
3451
3447
|
ephemeral: l = !1,
|
|
3452
|
-
systemPrompt:
|
|
3453
|
-
initialThreadId:
|
|
3454
|
-
welcomeTitle:
|
|
3448
|
+
systemPrompt: s,
|
|
3449
|
+
initialThreadId: f,
|
|
3450
|
+
welcomeTitle: c,
|
|
3455
3451
|
welcomeSubtitle: p,
|
|
3456
|
-
extraTopPadding:
|
|
3457
|
-
suggestions:
|
|
3452
|
+
extraTopPadding: g,
|
|
3453
|
+
suggestions: h,
|
|
3458
3454
|
inputPlaceholder: k,
|
|
3459
|
-
showThemeToggle:
|
|
3455
|
+
showThemeToggle: b = !0,
|
|
3460
3456
|
theme: x = "system",
|
|
3461
3457
|
onError: w,
|
|
3462
3458
|
onChatCreated: y,
|
|
@@ -3536,7 +3532,7 @@ const di = ({ config: e }) => {
|
|
|
3536
3532
|
}),
|
|
3537
3533
|
[_, oe, O, Q, X, K]
|
|
3538
3534
|
);
|
|
3539
|
-
return o === "selector" && O || i === "multiChat" && Ft ? /* @__PURE__ */
|
|
3535
|
+
return o === "selector" && O || i === "multiChat" && Ft ? /* @__PURE__ */ d(Ie, { value: be, children: /* @__PURE__ */ d(Ae, { 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(ot, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }) }) }) }) : o === "selector" && !zt && Q ? /* @__PURE__ */ d(Ie, { value: be, children: /* @__PURE__ */ d(Ae, { 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(Ie, { value: be, children: /* @__PURE__ */ d(
|
|
3540
3536
|
Cr,
|
|
3541
3537
|
{
|
|
3542
3538
|
baseUrl: q ? E : r || E,
|
|
@@ -3547,8 +3543,8 @@ const di = ({ config: e }) => {
|
|
|
3547
3543
|
modelId: _ || a || void 0,
|
|
3548
3544
|
onModelChange: X,
|
|
3549
3545
|
ephemeral: l,
|
|
3550
|
-
systemPrompt:
|
|
3551
|
-
initialThreadId:
|
|
3546
|
+
systemPrompt: s,
|
|
3547
|
+
initialThreadId: f,
|
|
3552
3548
|
onError: w,
|
|
3553
3549
|
onChatCreated: y,
|
|
3554
3550
|
onUserMessage: A,
|
|
@@ -3556,7 +3552,7 @@ const di = ({ config: e }) => {
|
|
|
3556
3552
|
onChatsLoaded: () => {
|
|
3557
3553
|
i === "multiChat" && _e(!1);
|
|
3558
3554
|
},
|
|
3559
|
-
children: /* @__PURE__ */
|
|
3555
|
+
children: /* @__PURE__ */ d(
|
|
3560
3556
|
Ae,
|
|
3561
3557
|
{
|
|
3562
3558
|
paddingX: "cuadra-px-0",
|
|
@@ -3564,9 +3560,9 @@ const di = ({ config: e }) => {
|
|
|
3564
3560
|
className: `cuadra-h-full ${e.containerClass || ""}`,
|
|
3565
3561
|
borderSizePx: 4,
|
|
3566
3562
|
style: { height: "100%" },
|
|
3567
|
-
children: /* @__PURE__ */
|
|
3563
|
+
children: /* @__PURE__ */ d("div", { className: "cuadra-h-full cuadra-flex cuadra-relative", style: { height: "100%" }, children: i === "multiChat" ? /* @__PURE__ */ v(B, { children: [
|
|
3568
3564
|
C && typeof document < "u" && $e(
|
|
3569
|
-
/* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ d(
|
|
3570
3566
|
"div",
|
|
3571
3567
|
{
|
|
3572
3568
|
className: "cuadra-fixed cuadra-inset-0 cuadra-bg-black/50 cuadra-z-40 md:cuadra-hidden",
|
|
@@ -3576,28 +3572,28 @@ const di = ({ config: e }) => {
|
|
|
3576
3572
|
document.body
|
|
3577
3573
|
),
|
|
3578
3574
|
typeof document < "u" && /* @__PURE__ */ v(B, { children: [
|
|
3579
|
-
/* @__PURE__ */
|
|
3575
|
+
/* @__PURE__ */ d(
|
|
3580
3576
|
"div",
|
|
3581
3577
|
{
|
|
3582
3578
|
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",
|
|
3583
3579
|
style: { borderRightWidth: "1px", height: "100%" },
|
|
3584
|
-
children: /* @__PURE__ */
|
|
3580
|
+
children: /* @__PURE__ */ d(Ye, { onThreadSelect: () => L(!1) })
|
|
3585
3581
|
}
|
|
3586
3582
|
),
|
|
3587
3583
|
C && $e(
|
|
3588
|
-
/* @__PURE__ */
|
|
3584
|
+
/* @__PURE__ */ d(
|
|
3589
3585
|
"div",
|
|
3590
3586
|
{
|
|
3591
3587
|
className: "cuadra-block md:cuadra-hidden !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-screen cuadra-w-80 cuadra-fixed cuadra-z-50 cuadra-top-0 cuadra-left-0 cuadra-translate-x-0",
|
|
3592
3588
|
style: { borderRightWidth: "1px" },
|
|
3593
|
-
children: /* @__PURE__ */
|
|
3589
|
+
children: /* @__PURE__ */ d(Ye, { onThreadSelect: () => L(!1) })
|
|
3594
3590
|
}
|
|
3595
3591
|
),
|
|
3596
3592
|
document.body
|
|
3597
3593
|
)
|
|
3598
3594
|
] }),
|
|
3599
3595
|
/* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
|
|
3600
|
-
o === "selector" && /* @__PURE__ */
|
|
3596
|
+
o === "selector" && /* @__PURE__ */ d(
|
|
3601
3597
|
et,
|
|
3602
3598
|
{
|
|
3603
3599
|
currentModel: _ || "",
|
|
@@ -3605,25 +3601,25 @@ const di = ({ config: e }) => {
|
|
|
3605
3601
|
modelsLoading: O,
|
|
3606
3602
|
modelsError: Q,
|
|
3607
3603
|
onModelChange: X,
|
|
3608
|
-
showThemeToggle:
|
|
3604
|
+
showThemeToggle: b,
|
|
3609
3605
|
theme: x,
|
|
3610
3606
|
onMobileMenuClick: () => L(!C),
|
|
3611
3607
|
showMobileMenuButton: i === "multiChat"
|
|
3612
3608
|
}
|
|
3613
3609
|
),
|
|
3614
|
-
/* @__PURE__ */
|
|
3610
|
+
/* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
|
|
3615
3611
|
Xe,
|
|
3616
3612
|
{
|
|
3617
|
-
welcomeTitle:
|
|
3613
|
+
welcomeTitle: c,
|
|
3618
3614
|
welcomeSubtitle: p,
|
|
3619
|
-
extraTopPadding:
|
|
3620
|
-
suggestions:
|
|
3615
|
+
extraTopPadding: g,
|
|
3616
|
+
suggestions: h,
|
|
3621
3617
|
inputPlaceholder: k
|
|
3622
3618
|
}
|
|
3623
3619
|
) })
|
|
3624
3620
|
] })
|
|
3625
3621
|
] }) : /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
|
|
3626
|
-
o === "selector" && /* @__PURE__ */
|
|
3622
|
+
o === "selector" && /* @__PURE__ */ d(
|
|
3627
3623
|
et,
|
|
3628
3624
|
{
|
|
3629
3625
|
currentModel: _ || "",
|
|
@@ -3631,17 +3627,17 @@ const di = ({ config: e }) => {
|
|
|
3631
3627
|
modelsLoading: O,
|
|
3632
3628
|
modelsError: Q,
|
|
3633
3629
|
onModelChange: X,
|
|
3634
|
-
showThemeToggle:
|
|
3630
|
+
showThemeToggle: b,
|
|
3635
3631
|
theme: x
|
|
3636
3632
|
}
|
|
3637
3633
|
),
|
|
3638
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
|
|
3639
3635
|
Xe,
|
|
3640
3636
|
{
|
|
3641
|
-
welcomeTitle:
|
|
3637
|
+
welcomeTitle: c,
|
|
3642
3638
|
welcomeSubtitle: p,
|
|
3643
|
-
extraTopPadding:
|
|
3644
|
-
suggestions:
|
|
3639
|
+
extraTopPadding: g,
|
|
3640
|
+
suggestions: h
|
|
3645
3641
|
}
|
|
3646
3642
|
) })
|
|
3647
3643
|
] }) })
|
|
@@ -3676,7 +3672,7 @@ function xi(e) {
|
|
|
3676
3672
|
theme: e.theme,
|
|
3677
3673
|
containerClass: e.className
|
|
3678
3674
|
};
|
|
3679
|
-
return /* @__PURE__ */
|
|
3675
|
+
return /* @__PURE__ */ d(di, { config: r });
|
|
3680
3676
|
}
|
|
3681
3677
|
export {
|
|
3682
3678
|
xi as CuadraChat
|