@cuadra-ai/uikit 0.1.19 → 0.1.20
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/components/CuadraChat.d.ts +6 -0
- package/dist/components/CuadraChat.d.ts.map +1 -1
- package/dist/index.cjs +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +927 -861
- package/dist/index.mjs.map +1 -1
- package/dist/types/theme.d.ts +134 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/uikit.css +1 -1
- package/dist/utils/applyTheme.d.ts +16 -0
- package/dist/utils/applyTheme.d.ts.map +1 -0
- package/dist/widget/cuadra-uikit.css +1 -1
- package/dist/widget/cuadra-uikit.umd.js +11 -11
- package/dist/widget/cuadra-uikit.umd.js.map +1 -1
- package/package.json +1 -2
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var pe = (e, r, t) =>
|
|
4
|
-
import { jsx as d, jsxs as
|
|
5
|
-
import rt, { forwardRef as wt, createElement as
|
|
6
|
-
import { createPortal as
|
|
7
|
-
import { useThreadListItem as
|
|
8
|
-
import { unstable_memoizeMarkdownComponents as Cr, useIsMarkdownCodeBlock as
|
|
1
|
+
var hr = Object.defineProperty;
|
|
2
|
+
var mr = (e, r, t) => r in e ? hr(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
|
+
var pe = (e, r, t) => mr(e, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { jsx as d, jsxs as v, Fragment as H } from "react/jsx-runtime";
|
|
5
|
+
import rt, { forwardRef as wt, createElement as Fe, useMemo as F, useState as N, useEffect as P, useCallback as ee, memo as pr, useRef as je, createContext as gr } from "react";
|
|
6
|
+
import { createPortal as ze } from "react-dom";
|
|
7
|
+
import { useThreadListItem as vt, RuntimeAdapterProvider as br, useLocalRuntime as Ct, AssistantRuntimeProvider as Tt, unstable_useRemoteThreadListRuntime as yr, useThreadRuntime as xr, ThreadPrimitive as ne, ComposerPrimitive as ie, useAssistantState as At, AttachmentPrimitive as kr, useAssistantApi as wr, MessagePrimitive as oe, ThreadListPrimitive as Se, useThread as vr, ThreadListItemPrimitive as Le } from "@assistant-ui/react";
|
|
8
|
+
import { unstable_memoizeMarkdownComponents as Cr, useIsMarkdownCodeBlock as Tr, MarkdownTextPrimitive as Ar } from "@assistant-ui/react-markdown";
|
|
9
9
|
let ce = !1, at = !1;
|
|
10
10
|
function nt() {
|
|
11
11
|
if (at || (at = !0, typeof document > "u" || typeof window > "u"))
|
|
@@ -25,9 +25,9 @@ function nt() {
|
|
|
25
25
|
}
|
|
26
26
|
} catch {
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
Nr();
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Nr() {
|
|
31
31
|
if (ce)
|
|
32
32
|
return;
|
|
33
33
|
const e = document.createElement("link");
|
|
@@ -55,13 +55,13 @@ function Ar() {
|
|
|
55
55
|
}, document.head.appendChild(e);
|
|
56
56
|
}
|
|
57
57
|
typeof document < "u" && typeof window < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", nt) : nt());
|
|
58
|
-
const
|
|
58
|
+
const Ir = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Sr = (e) => e.replace(
|
|
59
59
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
60
60
|
(r, t, a) => a ? a.toUpperCase() : t.toLowerCase()
|
|
61
61
|
), it = (e) => {
|
|
62
|
-
const r =
|
|
62
|
+
const r = Sr(e);
|
|
63
63
|
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
64
|
-
}, Nt = (...e) => e.filter((r, t, a) => !!r && r.trim() !== "" && a.indexOf(r) === t).join(" ").trim(),
|
|
64
|
+
}, Nt = (...e) => e.filter((r, t, a) => !!r && r.trim() !== "" && a.indexOf(r) === t).join(" ").trim(), Lr = (e) => {
|
|
65
65
|
for (const r in e)
|
|
66
66
|
if (r.startsWith("aria-") || r === "role" || r === "title")
|
|
67
67
|
return !0;
|
|
@@ -77,7 +77,7 @@ var Mr = {
|
|
|
77
77
|
strokeLinecap: "round",
|
|
78
78
|
strokeLinejoin: "round"
|
|
79
79
|
};
|
|
80
|
-
const
|
|
80
|
+
const Dr = wt(
|
|
81
81
|
({
|
|
82
82
|
color: e = "currentColor",
|
|
83
83
|
size: r = 24,
|
|
@@ -87,7 +87,7 @@ const Lr = wt(
|
|
|
87
87
|
children: o,
|
|
88
88
|
iconNode: n,
|
|
89
89
|
...u
|
|
90
|
-
}, c) =>
|
|
90
|
+
}, c) => Fe(
|
|
91
91
|
"svg",
|
|
92
92
|
{
|
|
93
93
|
ref: c,
|
|
@@ -97,22 +97,22 @@ const Lr = wt(
|
|
|
97
97
|
stroke: e,
|
|
98
98
|
strokeWidth: a ? Number(t) * 24 / Number(r) : t,
|
|
99
99
|
className: Nt("lucide", i),
|
|
100
|
-
...!o && !
|
|
100
|
+
...!o && !Lr(u) && { "aria-hidden": "true" },
|
|
101
101
|
...u
|
|
102
102
|
},
|
|
103
103
|
[
|
|
104
|
-
...n.map(([
|
|
104
|
+
...n.map(([s, f]) => Fe(s, f)),
|
|
105
105
|
...Array.isArray(o) ? o : [o]
|
|
106
106
|
]
|
|
107
107
|
)
|
|
108
108
|
);
|
|
109
109
|
const _ = (e, r) => {
|
|
110
110
|
const t = wt(
|
|
111
|
-
({ className: a, ...i }, o) =>
|
|
111
|
+
({ className: a, ...i }, o) => Fe(Dr, {
|
|
112
112
|
ref: o,
|
|
113
113
|
iconNode: r,
|
|
114
114
|
className: Nt(
|
|
115
|
-
`lucide-${
|
|
115
|
+
`lucide-${Ir(it(e))}`,
|
|
116
116
|
`lucide-${e}`,
|
|
117
117
|
a
|
|
118
118
|
),
|
|
@@ -121,36 +121,36 @@ const _ = (e, r) => {
|
|
|
121
121
|
);
|
|
122
122
|
return t.displayName = it(e), t;
|
|
123
123
|
};
|
|
124
|
-
const
|
|
124
|
+
const Rr = [
|
|
125
125
|
["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
|
|
126
126
|
["path", { d: "M12 19V5", key: "x0mq9r" }]
|
|
127
|
-
],
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
const
|
|
127
|
+
], Pr = _("arrow-up", Rr);
|
|
128
|
+
const Er = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], _r = _("check", Er);
|
|
129
|
+
const Fr = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], ot = _("chevron-down", Fr);
|
|
130
|
+
const jr = [
|
|
131
131
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
132
132
|
["path", { d: "M12 18a6 6 0 0 0 0-12v12z", key: "j4l70d" }]
|
|
133
|
-
], zr = _("contrast",
|
|
134
|
-
const
|
|
133
|
+
], zr = _("contrast", jr);
|
|
134
|
+
const $r = [
|
|
135
135
|
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
136
136
|
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
137
|
-
],
|
|
138
|
-
const
|
|
137
|
+
], Or = _("copy", $r);
|
|
138
|
+
const Ur = [
|
|
139
139
|
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
140
140
|
["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
|
|
141
141
|
["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
|
|
142
|
-
],
|
|
143
|
-
const
|
|
144
|
-
const
|
|
142
|
+
], Wr = _("ellipsis-vertical", Ur);
|
|
143
|
+
const Br = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], It = _("loader-circle", Br);
|
|
144
|
+
const Hr = [
|
|
145
145
|
["path", { d: "m16 17 5-5-5-5", key: "1bji2h" }],
|
|
146
146
|
["path", { d: "M21 12H9", key: "dn1m92" }],
|
|
147
147
|
["path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4", key: "1uf3rs" }]
|
|
148
|
-
],
|
|
149
|
-
const
|
|
148
|
+
], qr = _("log-out", Hr);
|
|
149
|
+
const Vr = [
|
|
150
150
|
["path", { d: "M4 5h16", key: "1tepv9" }],
|
|
151
151
|
["path", { d: "M4 12h16", key: "1lakjw" }],
|
|
152
152
|
["path", { d: "M4 19h16", key: "1djgab" }]
|
|
153
|
-
], Xr = _("menu",
|
|
153
|
+
], Xr = _("menu", Vr);
|
|
154
154
|
const Kr = [
|
|
155
155
|
[
|
|
156
156
|
"path",
|
|
@@ -160,15 +160,15 @@ const Kr = [
|
|
|
160
160
|
}
|
|
161
161
|
]
|
|
162
162
|
], St = _("paperclip", Kr);
|
|
163
|
-
const
|
|
163
|
+
const Gr = [
|
|
164
164
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
165
165
|
["path", { d: "M12 5v14", key: "s699le" }]
|
|
166
|
-
],
|
|
167
|
-
const
|
|
166
|
+
], Zr = _("plus", Gr);
|
|
167
|
+
const Jr = [
|
|
168
168
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
169
169
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
170
|
-
], Ue = _("x",
|
|
171
|
-
class
|
|
170
|
+
], Ue = _("x", Jr);
|
|
171
|
+
class Lt {
|
|
172
172
|
constructor(r, t, a = !1) {
|
|
173
173
|
pe(this, "baseUrl");
|
|
174
174
|
pe(this, "sessionToken", null);
|
|
@@ -292,23 +292,23 @@ class Mt {
|
|
|
292
292
|
});
|
|
293
293
|
if (!c.ok) {
|
|
294
294
|
const f = await c.text();
|
|
295
|
-
let
|
|
295
|
+
let l = {};
|
|
296
296
|
try {
|
|
297
|
-
|
|
297
|
+
l = JSON.parse(f);
|
|
298
298
|
} catch {
|
|
299
|
-
|
|
299
|
+
l = { detail: f };
|
|
300
300
|
}
|
|
301
301
|
throw new Error(
|
|
302
|
-
|
|
302
|
+
l.detail || l.message || `API error: ${c.status} ${c.statusText}`
|
|
303
303
|
);
|
|
304
304
|
}
|
|
305
305
|
if (c.status === 204)
|
|
306
306
|
return {};
|
|
307
|
-
const
|
|
308
|
-
if (!
|
|
307
|
+
const s = await c.text();
|
|
308
|
+
if (!s)
|
|
309
309
|
return {};
|
|
310
310
|
try {
|
|
311
|
-
return JSON.parse(
|
|
311
|
+
return JSON.parse(s);
|
|
312
312
|
} catch {
|
|
313
313
|
return {};
|
|
314
314
|
}
|
|
@@ -397,15 +397,15 @@ class Mt {
|
|
|
397
397
|
body: n
|
|
398
398
|
});
|
|
399
399
|
if (!c.ok) {
|
|
400
|
-
const
|
|
400
|
+
const s = await c.json().catch(() => ({}));
|
|
401
401
|
throw new Error(
|
|
402
|
-
|
|
402
|
+
s.detail || s.message || `API error: ${c.status} ${c.statusText}`
|
|
403
403
|
);
|
|
404
404
|
}
|
|
405
405
|
return c.json();
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
async function*
|
|
408
|
+
async function* Qr(e, r) {
|
|
409
409
|
const t = e.getReader(), a = new TextDecoder();
|
|
410
410
|
let i = "";
|
|
411
411
|
try {
|
|
@@ -423,13 +423,13 @@ async function* Jr(e, r) {
|
|
|
423
423
|
i = u.pop() || "";
|
|
424
424
|
for (const c of u)
|
|
425
425
|
if (c.startsWith("data: ")) {
|
|
426
|
-
const
|
|
427
|
-
if (
|
|
426
|
+
const s = c.slice(6);
|
|
427
|
+
if (s.trim() === "[DONE]") {
|
|
428
428
|
yield { done: !0 };
|
|
429
429
|
continue;
|
|
430
430
|
}
|
|
431
431
|
try {
|
|
432
|
-
yield JSON.parse(
|
|
432
|
+
yield JSON.parse(s);
|
|
433
433
|
} catch {
|
|
434
434
|
}
|
|
435
435
|
}
|
|
@@ -438,7 +438,7 @@ async function* Jr(e, r) {
|
|
|
438
438
|
t.releaseLock();
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function Yr(e) {
|
|
442
442
|
return e.map((r) => {
|
|
443
443
|
let t = "";
|
|
444
444
|
if (typeof r.content == "string")
|
|
@@ -454,7 +454,7 @@ function Qr(e) {
|
|
|
454
454
|
};
|
|
455
455
|
});
|
|
456
456
|
}
|
|
457
|
-
function
|
|
457
|
+
function ea(e) {
|
|
458
458
|
return {
|
|
459
459
|
id: e.id,
|
|
460
460
|
role: e.role,
|
|
@@ -486,14 +486,14 @@ function Yr(e) {
|
|
|
486
486
|
}
|
|
487
487
|
};
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function Mt(e, r) {
|
|
490
490
|
const { modelId: t, systemPrompt: a, ephemeral: i, onChatCreated: o, onUserMessage: n, onThreadIdUpdate: u } = r;
|
|
491
491
|
return {
|
|
492
492
|
async *run(c) {
|
|
493
|
-
const { messages:
|
|
493
|
+
const { messages: s, abortSignal: f, context: l } = c, p = l?.threadId;
|
|
494
494
|
n?.();
|
|
495
495
|
const h = {
|
|
496
|
-
messages:
|
|
496
|
+
messages: Yr(s),
|
|
497
497
|
chatId: null,
|
|
498
498
|
// Thread ID will be set by runtime if needed
|
|
499
499
|
systemPrompt: a,
|
|
@@ -501,9 +501,9 @@ function Lt(e, r) {
|
|
|
501
501
|
stream: !0
|
|
502
502
|
};
|
|
503
503
|
t && t.trim() !== "" && (h.modelId = t);
|
|
504
|
-
const
|
|
504
|
+
const x = await e.createOrContinueChat(h, f);
|
|
505
505
|
let g = "", b;
|
|
506
|
-
for await (const k of
|
|
506
|
+
for await (const k of Qr(x, f)) {
|
|
507
507
|
if (f?.aborted)
|
|
508
508
|
throw new Error("Request aborted");
|
|
509
509
|
const w = k.id;
|
|
@@ -530,7 +530,7 @@ function Lt(e, r) {
|
|
|
530
530
|
};
|
|
531
531
|
}
|
|
532
532
|
const ct = /* @__PURE__ */ new Map();
|
|
533
|
-
function
|
|
533
|
+
function ta(e, r) {
|
|
534
534
|
return {
|
|
535
535
|
async list() {
|
|
536
536
|
const t = [];
|
|
@@ -591,13 +591,13 @@ function ea(e, r) {
|
|
|
591
591
|
},
|
|
592
592
|
// Provider component that adds thread-specific history adapter
|
|
593
593
|
unstable_Provider: ({ children: t }) => {
|
|
594
|
-
const i =
|
|
594
|
+
const i = vt()?.remoteId, o = rt.useMemo(
|
|
595
595
|
() => ({
|
|
596
596
|
async load() {
|
|
597
597
|
if (!i) return { messages: [] };
|
|
598
598
|
try {
|
|
599
599
|
const u = await e.getChat(i);
|
|
600
|
-
return !u.messages || u.messages.length === 0 ? { messages: [] } : { messages: u.messages.map((
|
|
600
|
+
return !u.messages || u.messages.length === 0 ? { messages: [] } : { messages: u.messages.map((s) => ea(s)) };
|
|
601
601
|
} catch (u) {
|
|
602
602
|
return console.error("Failed to load messages for thread:", i, u), { messages: [] };
|
|
603
603
|
}
|
|
@@ -607,7 +607,7 @@ function ea(e, r) {
|
|
|
607
607
|
}),
|
|
608
608
|
[i, e]
|
|
609
609
|
), n = rt.useMemo(() => ({ history: o }), [o]);
|
|
610
|
-
return /* @__PURE__ */ d(
|
|
610
|
+
return /* @__PURE__ */ d(br, { adapters: n, children: t });
|
|
611
611
|
}
|
|
612
612
|
};
|
|
613
613
|
}
|
|
@@ -652,7 +652,7 @@ function Dt() {
|
|
|
652
652
|
}
|
|
653
653
|
};
|
|
654
654
|
}
|
|
655
|
-
function
|
|
655
|
+
function ra({
|
|
656
656
|
children: e,
|
|
657
657
|
baseUrl: r,
|
|
658
658
|
sessionToken: t,
|
|
@@ -662,16 +662,16 @@ function ta({
|
|
|
662
662
|
onModelChange: n,
|
|
663
663
|
ephemeral: u = !1,
|
|
664
664
|
systemPrompt: c,
|
|
665
|
-
initialThreadId:
|
|
665
|
+
initialThreadId: s,
|
|
666
666
|
onError: f,
|
|
667
|
-
onChatCreated:
|
|
667
|
+
onChatCreated: l,
|
|
668
668
|
onUserMessage: p,
|
|
669
|
-
onThreadIdUpdate:
|
|
669
|
+
onThreadIdUpdate: y,
|
|
670
670
|
onChatsLoaded: h,
|
|
671
|
-
enableAttachments:
|
|
671
|
+
enableAttachments: x = !1
|
|
672
672
|
}) {
|
|
673
|
-
const g =
|
|
674
|
-
() => new
|
|
673
|
+
const g = F(
|
|
674
|
+
() => new Lt(r, t || void 0, a),
|
|
675
675
|
[r, t, a]
|
|
676
676
|
), [b, k] = N(o || null);
|
|
677
677
|
P(() => {
|
|
@@ -679,15 +679,15 @@ function ta({
|
|
|
679
679
|
}, [o]);
|
|
680
680
|
const w = ee(
|
|
681
681
|
(T) => {
|
|
682
|
-
|
|
682
|
+
l?.(T);
|
|
683
683
|
},
|
|
684
|
-
[
|
|
684
|
+
[l]
|
|
685
685
|
), A = ee(
|
|
686
686
|
(T, S) => {
|
|
687
|
-
|
|
687
|
+
y?.(T, S);
|
|
688
688
|
},
|
|
689
|
-
[
|
|
690
|
-
), I =
|
|
689
|
+
[y]
|
|
690
|
+
), I = F(() => Mt(g, {
|
|
691
691
|
modelId: b || void 0,
|
|
692
692
|
// Pass undefined if not set (backend resolves it)
|
|
693
693
|
systemPrompt: c,
|
|
@@ -695,8 +695,8 @@ function ta({
|
|
|
695
695
|
onChatCreated: w,
|
|
696
696
|
onUserMessage: p
|
|
697
697
|
}), [g, b, c, u, w, p]);
|
|
698
|
-
return i === "singleChat" ? /* @__PURE__ */ d(
|
|
699
|
-
|
|
698
|
+
return i === "singleChat" ? /* @__PURE__ */ d(aa, { modelAdapter: I, enableAttachments: x, children: e }) : /* @__PURE__ */ d(
|
|
699
|
+
na,
|
|
700
700
|
{
|
|
701
701
|
client: g,
|
|
702
702
|
modelAdapterOptions: {
|
|
@@ -706,28 +706,28 @@ function ta({
|
|
|
706
706
|
onChatCreated: w,
|
|
707
707
|
onUserMessage: p
|
|
708
708
|
},
|
|
709
|
-
initialThreadId:
|
|
709
|
+
initialThreadId: s,
|
|
710
710
|
onChatsLoaded: h,
|
|
711
711
|
onThreadIdUpdate: A,
|
|
712
712
|
onError: f,
|
|
713
|
-
enableAttachments:
|
|
713
|
+
enableAttachments: x,
|
|
714
714
|
children: e
|
|
715
715
|
}
|
|
716
716
|
);
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function aa({
|
|
719
719
|
modelAdapter: e,
|
|
720
720
|
enableAttachments: r,
|
|
721
721
|
children: t
|
|
722
722
|
}) {
|
|
723
|
-
const a =
|
|
723
|
+
const a = F(() => r ? Dt() : void 0, [r]), i = Ct(e, {
|
|
724
724
|
adapters: {
|
|
725
725
|
...a && { attachments: a }
|
|
726
726
|
}
|
|
727
727
|
});
|
|
728
728
|
return /* @__PURE__ */ d(Tt, { runtime: i, children: t });
|
|
729
729
|
}
|
|
730
|
-
function
|
|
730
|
+
function na({
|
|
731
731
|
client: e,
|
|
732
732
|
modelAdapterOptions: r,
|
|
733
733
|
initialThreadId: t,
|
|
@@ -737,33 +737,33 @@ function aa({
|
|
|
737
737
|
enableAttachments: n,
|
|
738
738
|
children: u
|
|
739
739
|
}) {
|
|
740
|
-
const c =
|
|
741
|
-
i?.(
|
|
742
|
-
}), [e, i]),
|
|
743
|
-
(
|
|
744
|
-
c.updateRemoteId && c.updateRemoteId(
|
|
740
|
+
const c = F(() => ta(e, (x, g) => {
|
|
741
|
+
i?.(x, g);
|
|
742
|
+
}), [e, i]), s = ee(
|
|
743
|
+
(x, g) => {
|
|
744
|
+
c.updateRemoteId && c.updateRemoteId(x, g), i?.(x, g);
|
|
745
745
|
},
|
|
746
746
|
[c, i]
|
|
747
|
-
), f =
|
|
747
|
+
), f = F(() => ({
|
|
748
748
|
...c,
|
|
749
749
|
async list() {
|
|
750
|
-
const
|
|
751
|
-
return a?.(),
|
|
750
|
+
const x = await c.list();
|
|
751
|
+
return a?.(), x;
|
|
752
752
|
}
|
|
753
753
|
}), [c, a]);
|
|
754
754
|
P(() => {
|
|
755
755
|
window.__cuadraThreadListAdapter = f, window.__cuadraThreadListRuntime = null;
|
|
756
756
|
}, [f]);
|
|
757
|
-
const
|
|
757
|
+
const l = F(() => Mt(e, {
|
|
758
758
|
...r,
|
|
759
|
-
onThreadIdUpdate:
|
|
760
|
-
}), [e, r,
|
|
759
|
+
onThreadIdUpdate: s
|
|
760
|
+
}), [e, r, s]), p = F(() => n ? Dt() : void 0, [n]), y = ee(() => Ct(l, {
|
|
761
761
|
adapters: {
|
|
762
762
|
...p && { attachments: p }
|
|
763
763
|
}
|
|
764
|
-
}), [
|
|
764
|
+
}), [l, p]), h = yr({
|
|
765
765
|
adapter: f,
|
|
766
|
-
runtimeHook:
|
|
766
|
+
runtimeHook: y
|
|
767
767
|
});
|
|
768
768
|
return P(() => {
|
|
769
769
|
window.__cuadraThreadListRuntime = h;
|
|
@@ -779,7 +779,7 @@ function ut(e, r) {
|
|
|
779
779
|
return a;
|
|
780
780
|
}
|
|
781
781
|
const ue = we(/[A-Za-z]/), We = we(/[\dA-Za-z]/);
|
|
782
|
-
function
|
|
782
|
+
function ia(e) {
|
|
783
783
|
return (
|
|
784
784
|
// Special whitespace codes (which have negative values), C0 and Control
|
|
785
785
|
// character DEL
|
|
@@ -789,25 +789,25 @@ function na(e) {
|
|
|
789
789
|
function Y(e) {
|
|
790
790
|
return e !== null && e < -2;
|
|
791
791
|
}
|
|
792
|
-
function
|
|
792
|
+
function E(e) {
|
|
793
793
|
return e !== null && (e < 0 || e === 32);
|
|
794
794
|
}
|
|
795
795
|
function W(e) {
|
|
796
796
|
return e === -2 || e === -1 || e === 32;
|
|
797
797
|
}
|
|
798
|
-
const ke = we(/\p{P}|\p{S}/u),
|
|
798
|
+
const ke = we(/\p{P}|\p{S}/u), K = we(/\s/);
|
|
799
799
|
function we(e) {
|
|
800
800
|
return r;
|
|
801
801
|
function r(t) {
|
|
802
802
|
return t !== null && t > -1 && e.test(String.fromCharCode(t));
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
|
-
function
|
|
805
|
+
function oa(e) {
|
|
806
806
|
if (typeof e != "string")
|
|
807
807
|
throw new TypeError("Expected a string");
|
|
808
808
|
return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
809
809
|
}
|
|
810
|
-
const
|
|
810
|
+
const ve = (
|
|
811
811
|
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
|
812
812
|
/**
|
|
813
813
|
* @type {(
|
|
@@ -826,27 +826,27 @@ const Ce = (
|
|
|
826
826
|
if (e == null)
|
|
827
827
|
return la;
|
|
828
828
|
if (typeof e == "function")
|
|
829
|
-
return
|
|
829
|
+
return Ce(e);
|
|
830
830
|
if (typeof e == "object")
|
|
831
|
-
return Array.isArray(e) ?
|
|
831
|
+
return Array.isArray(e) ? ca(e) : (
|
|
832
832
|
// Cast because `ReadonlyArray` goes into the above but `isArray`
|
|
833
833
|
// narrows to `Array`.
|
|
834
|
-
|
|
834
|
+
ua(
|
|
835
835
|
/** @type {Props} */
|
|
836
836
|
e
|
|
837
837
|
)
|
|
838
838
|
);
|
|
839
839
|
if (typeof e == "string")
|
|
840
|
-
return
|
|
840
|
+
return sa(e);
|
|
841
841
|
throw new Error("Expected function, string, or object as test");
|
|
842
842
|
})
|
|
843
843
|
);
|
|
844
|
-
function
|
|
844
|
+
function ca(e) {
|
|
845
845
|
const r = [];
|
|
846
846
|
let t = -1;
|
|
847
847
|
for (; ++t < e.length; )
|
|
848
|
-
r[t] =
|
|
849
|
-
return
|
|
848
|
+
r[t] = ve(e[t]);
|
|
849
|
+
return Ce(a);
|
|
850
850
|
function a(...i) {
|
|
851
851
|
let o = -1;
|
|
852
852
|
for (; ++o < r.length; )
|
|
@@ -854,12 +854,12 @@ function oa(e) {
|
|
|
854
854
|
return !1;
|
|
855
855
|
}
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function ua(e) {
|
|
858
858
|
const r = (
|
|
859
859
|
/** @type {Record<string, unknown>} */
|
|
860
860
|
e
|
|
861
861
|
);
|
|
862
|
-
return
|
|
862
|
+
return Ce(t);
|
|
863
863
|
function t(a) {
|
|
864
864
|
const i = (
|
|
865
865
|
/** @type {Record<string, unknown>} */
|
|
@@ -872,16 +872,16 @@ function ca(e) {
|
|
|
872
872
|
return !0;
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
|
-
function
|
|
876
|
-
return
|
|
875
|
+
function sa(e) {
|
|
876
|
+
return Ce(r);
|
|
877
877
|
function r(t) {
|
|
878
878
|
return t && t.type === e;
|
|
879
879
|
}
|
|
880
880
|
}
|
|
881
|
-
function
|
|
881
|
+
function Ce(e) {
|
|
882
882
|
return r;
|
|
883
883
|
function r(t, a, i) {
|
|
884
|
-
return !!(
|
|
884
|
+
return !!(da(t) && e.call(
|
|
885
885
|
this,
|
|
886
886
|
t,
|
|
887
887
|
typeof a == "number" ? a : void 0,
|
|
@@ -892,102 +892,102 @@ function ve(e) {
|
|
|
892
892
|
function la() {
|
|
893
893
|
return !0;
|
|
894
894
|
}
|
|
895
|
-
function
|
|
895
|
+
function da(e) {
|
|
896
896
|
return e !== null && typeof e == "object" && "type" in e;
|
|
897
897
|
}
|
|
898
|
-
const Rt = [],
|
|
898
|
+
const Rt = [], fa = !0, $e = !1, ha = "skip";
|
|
899
899
|
function Pt(e, r, t, a) {
|
|
900
900
|
let i;
|
|
901
901
|
typeof r == "function" && typeof t != "function" ? (a = t, t = r) : i = r;
|
|
902
|
-
const o =
|
|
902
|
+
const o = ve(i), n = a ? -1 : 1;
|
|
903
903
|
u(e, void 0, [])();
|
|
904
|
-
function u(c,
|
|
905
|
-
const
|
|
904
|
+
function u(c, s, f) {
|
|
905
|
+
const l = (
|
|
906
906
|
/** @type {Record<string, unknown>} */
|
|
907
907
|
c && typeof c == "object" ? c : {}
|
|
908
908
|
);
|
|
909
|
-
if (typeof
|
|
910
|
-
const
|
|
909
|
+
if (typeof l.type == "string") {
|
|
910
|
+
const y = (
|
|
911
911
|
// `hast`
|
|
912
|
-
typeof
|
|
912
|
+
typeof l.tagName == "string" ? l.tagName : (
|
|
913
913
|
// `xast`
|
|
914
|
-
typeof
|
|
914
|
+
typeof l.name == "string" ? l.name : void 0
|
|
915
915
|
)
|
|
916
916
|
);
|
|
917
917
|
Object.defineProperty(p, "name", {
|
|
918
|
-
value: "node (" + (c.type + (
|
|
918
|
+
value: "node (" + (c.type + (y ? "<" + y + ">" : "")) + ")"
|
|
919
919
|
});
|
|
920
920
|
}
|
|
921
921
|
return p;
|
|
922
922
|
function p() {
|
|
923
|
-
let
|
|
924
|
-
if ((!r || o(c,
|
|
925
|
-
return
|
|
923
|
+
let y = Rt, h, x, g;
|
|
924
|
+
if ((!r || o(c, s, f[f.length - 1] || void 0)) && (y = ma(t(c, f)), y[0] === $e))
|
|
925
|
+
return y;
|
|
926
926
|
if ("children" in c && c.children) {
|
|
927
927
|
const b = (
|
|
928
928
|
/** @type {UnistParent} */
|
|
929
929
|
c
|
|
930
930
|
);
|
|
931
|
-
if (b.children &&
|
|
932
|
-
for (
|
|
933
|
-
const k = b.children[
|
|
934
|
-
if (h = u(k,
|
|
931
|
+
if (b.children && y[0] !== ha)
|
|
932
|
+
for (x = (a ? b.children.length : -1) + n, g = f.concat(b); x > -1 && x < b.children.length; ) {
|
|
933
|
+
const k = b.children[x];
|
|
934
|
+
if (h = u(k, x, g)(), h[0] === $e)
|
|
935
935
|
return h;
|
|
936
|
-
|
|
936
|
+
x = typeof h[1] == "number" ? h[1] : x + n;
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
|
-
return
|
|
939
|
+
return y;
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
942
|
}
|
|
943
|
-
function
|
|
944
|
-
return Array.isArray(e) ? e : typeof e == "number" ? [
|
|
943
|
+
function ma(e) {
|
|
944
|
+
return Array.isArray(e) ? e : typeof e == "number" ? [fa, e] : e == null ? Rt : [e];
|
|
945
945
|
}
|
|
946
|
-
function
|
|
947
|
-
const i =
|
|
946
|
+
function pa(e, r, t) {
|
|
947
|
+
const i = ve((t || {}).ignore || []), o = ga(r);
|
|
948
948
|
let n = -1;
|
|
949
949
|
for (; ++n < o.length; )
|
|
950
950
|
Pt(e, "text", u);
|
|
951
|
-
function u(
|
|
952
|
-
let
|
|
953
|
-
for (; ++
|
|
954
|
-
const
|
|
951
|
+
function u(s, f) {
|
|
952
|
+
let l = -1, p;
|
|
953
|
+
for (; ++l < f.length; ) {
|
|
954
|
+
const y = f[l], h = p ? p.children : void 0;
|
|
955
955
|
if (i(
|
|
956
|
-
|
|
957
|
-
h ? h.indexOf(
|
|
956
|
+
y,
|
|
957
|
+
h ? h.indexOf(y) : void 0,
|
|
958
958
|
p
|
|
959
959
|
))
|
|
960
960
|
return;
|
|
961
|
-
p =
|
|
961
|
+
p = y;
|
|
962
962
|
}
|
|
963
963
|
if (p)
|
|
964
|
-
return c(
|
|
964
|
+
return c(s, f);
|
|
965
965
|
}
|
|
966
|
-
function c(
|
|
967
|
-
const
|
|
966
|
+
function c(s, f) {
|
|
967
|
+
const l = f[f.length - 1], p = o[n][0], y = o[n][1];
|
|
968
968
|
let h = 0;
|
|
969
|
-
const g =
|
|
969
|
+
const g = l.children.indexOf(s);
|
|
970
970
|
let b = !1, k = [];
|
|
971
971
|
p.lastIndex = 0;
|
|
972
|
-
let w = p.exec(
|
|
972
|
+
let w = p.exec(s.value);
|
|
973
973
|
for (; w; ) {
|
|
974
974
|
const A = w.index, I = {
|
|
975
975
|
index: w.index,
|
|
976
976
|
input: w.input,
|
|
977
|
-
stack: [...f,
|
|
977
|
+
stack: [...f, s]
|
|
978
978
|
};
|
|
979
|
-
let T =
|
|
979
|
+
let T = y(...w, I);
|
|
980
980
|
if (typeof T == "string" && (T = T.length > 0 ? { type: "text", value: T } : void 0), T === !1 ? p.lastIndex = A + 1 : (h !== A && k.push({
|
|
981
981
|
type: "text",
|
|
982
|
-
value:
|
|
982
|
+
value: s.value.slice(h, A)
|
|
983
983
|
}), Array.isArray(T) ? k.push(...T) : T && k.push(T), h = A + w[0].length, b = !0), !p.global)
|
|
984
984
|
break;
|
|
985
|
-
w = p.exec(
|
|
985
|
+
w = p.exec(s.value);
|
|
986
986
|
}
|
|
987
|
-
return b ? (h <
|
|
987
|
+
return b ? (h < s.value.length && k.push({ type: "text", value: s.value.slice(h) }), l.children.splice(g, 1, ...k)) : k = [s], g + k.length;
|
|
988
988
|
}
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function ga(e) {
|
|
991
991
|
const r = [];
|
|
992
992
|
if (!Array.isArray(e))
|
|
993
993
|
throw new TypeError("Expected find and replace tuple or list of tuples");
|
|
@@ -995,70 +995,70 @@ function pa(e) {
|
|
|
995
995
|
let a = -1;
|
|
996
996
|
for (; ++a < t.length; ) {
|
|
997
997
|
const i = t[a];
|
|
998
|
-
r.push([
|
|
998
|
+
r.push([ba(i[0]), ya(i[1])]);
|
|
999
999
|
}
|
|
1000
1000
|
return r;
|
|
1001
1001
|
}
|
|
1002
|
-
function ga(e) {
|
|
1003
|
-
return typeof e == "string" ? new RegExp(ia(e), "g") : e;
|
|
1004
|
-
}
|
|
1005
1002
|
function ba(e) {
|
|
1003
|
+
return typeof e == "string" ? new RegExp(oa(e), "g") : e;
|
|
1004
|
+
}
|
|
1005
|
+
function ya(e) {
|
|
1006
1006
|
return typeof e == "function" ? e : function() {
|
|
1007
1007
|
return e;
|
|
1008
1008
|
};
|
|
1009
1009
|
}
|
|
1010
|
-
const
|
|
1010
|
+
const Me = "phrasing", De = ["autolink", "link", "image", "label"];
|
|
1011
1011
|
function xa() {
|
|
1012
1012
|
return {
|
|
1013
|
-
transforms: [
|
|
1013
|
+
transforms: [Na],
|
|
1014
1014
|
enter: {
|
|
1015
|
-
literalAutolink:
|
|
1015
|
+
literalAutolink: wa,
|
|
1016
1016
|
literalAutolinkEmail: Re,
|
|
1017
1017
|
literalAutolinkHttp: Re,
|
|
1018
1018
|
literalAutolinkWww: Re
|
|
1019
1019
|
},
|
|
1020
1020
|
exit: {
|
|
1021
|
-
literalAutolink:
|
|
1022
|
-
literalAutolinkEmail:
|
|
1023
|
-
literalAutolinkHttp:
|
|
1021
|
+
literalAutolink: Aa,
|
|
1022
|
+
literalAutolinkEmail: Ta,
|
|
1023
|
+
literalAutolinkHttp: va,
|
|
1024
1024
|
literalAutolinkWww: Ca
|
|
1025
1025
|
}
|
|
1026
1026
|
};
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1028
|
+
function ka() {
|
|
1029
1029
|
return {
|
|
1030
1030
|
unsafe: [
|
|
1031
1031
|
{
|
|
1032
1032
|
character: "@",
|
|
1033
1033
|
before: "[+\\-.\\w]",
|
|
1034
1034
|
after: "[\\-.\\w]",
|
|
1035
|
-
inConstruct:
|
|
1035
|
+
inConstruct: Me,
|
|
1036
1036
|
notInConstruct: De
|
|
1037
1037
|
},
|
|
1038
1038
|
{
|
|
1039
1039
|
character: ".",
|
|
1040
1040
|
before: "[Ww]",
|
|
1041
1041
|
after: "[\\-.\\w]",
|
|
1042
|
-
inConstruct:
|
|
1042
|
+
inConstruct: Me,
|
|
1043
1043
|
notInConstruct: De
|
|
1044
1044
|
},
|
|
1045
1045
|
{
|
|
1046
1046
|
character: ":",
|
|
1047
1047
|
before: "[ps]",
|
|
1048
1048
|
after: "\\/",
|
|
1049
|
-
inConstruct:
|
|
1049
|
+
inConstruct: Me,
|
|
1050
1050
|
notInConstruct: De
|
|
1051
1051
|
}
|
|
1052
1052
|
]
|
|
1053
1053
|
};
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function wa(e) {
|
|
1056
1056
|
this.enter({ type: "link", title: null, url: "", children: [] }, e);
|
|
1057
1057
|
}
|
|
1058
1058
|
function Re(e) {
|
|
1059
1059
|
this.config.enter.autolinkProtocol.call(this, e);
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1061
|
+
function va(e) {
|
|
1062
1062
|
this.config.exit.autolinkProtocol.call(this, e);
|
|
1063
1063
|
}
|
|
1064
1064
|
function Ca(e) {
|
|
@@ -1066,25 +1066,25 @@ function Ca(e) {
|
|
|
1066
1066
|
const r = this.stack[this.stack.length - 1];
|
|
1067
1067
|
r.type, r.url = "http://" + this.sliceSerialize(e);
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1069
|
+
function Ta(e) {
|
|
1070
1070
|
this.config.exit.autolinkEmail.call(this, e);
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function Aa(e) {
|
|
1073
1073
|
this.exit(e);
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1076
|
-
|
|
1075
|
+
function Na(e) {
|
|
1076
|
+
pa(
|
|
1077
1077
|
e,
|
|
1078
1078
|
[
|
|
1079
|
-
[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,
|
|
1080
|
-
[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,
|
|
1079
|
+
[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, Ia],
|
|
1080
|
+
[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, Sa]
|
|
1081
1081
|
],
|
|
1082
1082
|
{ ignore: ["link", "linkReference"] }
|
|
1083
1083
|
);
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1085
|
+
function Ia(e, r, t, a, i) {
|
|
1086
1086
|
let o = "";
|
|
1087
|
-
if (!
|
|
1087
|
+
if (!Et(i) || (/^w/i.test(r) && (t = r + t, r = "", o = "http://"), !La(t)))
|
|
1088
1088
|
return !1;
|
|
1089
1089
|
const n = Ma(t + a);
|
|
1090
1090
|
if (!n[0]) return !1;
|
|
@@ -1096,10 +1096,10 @@ function Na(e, r, t, a, i) {
|
|
|
1096
1096
|
};
|
|
1097
1097
|
return n[1] ? [u, { type: "text", value: n[1] }] : u;
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1099
|
+
function Sa(e, r, t, a) {
|
|
1100
1100
|
return (
|
|
1101
1101
|
// Not an expected previous character.
|
|
1102
|
-
!
|
|
1102
|
+
!Et(a, !0) || // Label ends in not allowed character.
|
|
1103
1103
|
/[-\d_]$/.test(t) ? !1 : {
|
|
1104
1104
|
type: "link",
|
|
1105
1105
|
title: null,
|
|
@@ -1108,7 +1108,7 @@ function Ia(e, r, t, a) {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
);
|
|
1110
1110
|
}
|
|
1111
|
-
function
|
|
1111
|
+
function La(e) {
|
|
1112
1112
|
const r = e.split(".");
|
|
1113
1113
|
return !(r.length < 2 || r[r.length - 1] && (/_/.test(r[r.length - 1]) || !/[a-zA-Z\d]/.test(r[r.length - 1])) || r[r.length - 2] && (/_/.test(r[r.length - 2]) || !/[a-zA-Z\d]/.test(r[r.length - 2])));
|
|
1114
1114
|
}
|
|
@@ -1124,49 +1124,49 @@ function Ma(e) {
|
|
|
1124
1124
|
e += t.slice(0, a + 1), t = t.slice(a + 1), a = t.indexOf(")"), o++;
|
|
1125
1125
|
return [e, t];
|
|
1126
1126
|
}
|
|
1127
|
-
function
|
|
1127
|
+
function Et(e, r) {
|
|
1128
1128
|
const t = e.input.charCodeAt(e.index - 1);
|
|
1129
|
-
return (e.index === 0 ||
|
|
1129
|
+
return (e.index === 0 || K(t) || ke(t)) && // If it’s an email, the previous character should not be a slash.
|
|
1130
1130
|
(!r || t !== 47);
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1132
|
+
function le(e) {
|
|
1133
1133
|
return e.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
|
|
1134
1134
|
}
|
|
1135
|
-
_t.peek =
|
|
1136
|
-
function
|
|
1135
|
+
_t.peek = $a;
|
|
1136
|
+
function Da() {
|
|
1137
1137
|
this.buffer();
|
|
1138
1138
|
}
|
|
1139
|
-
function
|
|
1139
|
+
function Ra(e) {
|
|
1140
1140
|
this.enter({ type: "footnoteReference", identifier: "", label: "" }, e);
|
|
1141
1141
|
}
|
|
1142
|
-
function
|
|
1142
|
+
function Pa() {
|
|
1143
1143
|
this.buffer();
|
|
1144
1144
|
}
|
|
1145
|
-
function
|
|
1145
|
+
function Ea(e) {
|
|
1146
1146
|
this.enter(
|
|
1147
1147
|
{ type: "footnoteDefinition", identifier: "", label: "", children: [] },
|
|
1148
1148
|
e
|
|
1149
1149
|
);
|
|
1150
1150
|
}
|
|
1151
|
-
function
|
|
1151
|
+
function _a(e) {
|
|
1152
1152
|
const r = this.resume(), t = this.stack[this.stack.length - 1];
|
|
1153
|
-
t.type, t.identifier =
|
|
1153
|
+
t.type, t.identifier = le(
|
|
1154
1154
|
this.sliceSerialize(e)
|
|
1155
1155
|
).toLowerCase(), t.label = r;
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1157
|
+
function Fa(e) {
|
|
1158
1158
|
this.exit(e);
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1160
|
+
function ja(e) {
|
|
1161
1161
|
const r = this.resume(), t = this.stack[this.stack.length - 1];
|
|
1162
|
-
t.type, t.identifier =
|
|
1162
|
+
t.type, t.identifier = le(
|
|
1163
1163
|
this.sliceSerialize(e)
|
|
1164
1164
|
).toLowerCase(), t.label = r;
|
|
1165
1165
|
}
|
|
1166
1166
|
function za(e) {
|
|
1167
1167
|
this.exit(e);
|
|
1168
1168
|
}
|
|
1169
|
-
function
|
|
1169
|
+
function $a() {
|
|
1170
1170
|
return "[";
|
|
1171
1171
|
}
|
|
1172
1172
|
function _t(e, r, t, a) {
|
|
@@ -1177,23 +1177,23 @@ function _t(e, r, t, a) {
|
|
|
1177
1177
|
t.safe(t.associationId(e), { after: "]", before: o })
|
|
1178
1178
|
), u(), n(), o += i.move("]"), o;
|
|
1179
1179
|
}
|
|
1180
|
-
function
|
|
1180
|
+
function Oa() {
|
|
1181
1181
|
return {
|
|
1182
1182
|
enter: {
|
|
1183
|
-
gfmFootnoteCallString:
|
|
1184
|
-
gfmFootnoteCall:
|
|
1185
|
-
gfmFootnoteDefinitionLabelString:
|
|
1186
|
-
gfmFootnoteDefinition:
|
|
1183
|
+
gfmFootnoteCallString: Da,
|
|
1184
|
+
gfmFootnoteCall: Ra,
|
|
1185
|
+
gfmFootnoteDefinitionLabelString: Pa,
|
|
1186
|
+
gfmFootnoteDefinition: Ea
|
|
1187
1187
|
},
|
|
1188
1188
|
exit: {
|
|
1189
|
-
gfmFootnoteCallString:
|
|
1190
|
-
gfmFootnoteCall:
|
|
1191
|
-
gfmFootnoteDefinitionLabelString:
|
|
1189
|
+
gfmFootnoteCallString: _a,
|
|
1190
|
+
gfmFootnoteCall: Fa,
|
|
1191
|
+
gfmFootnoteDefinitionLabelString: ja,
|
|
1192
1192
|
gfmFootnoteDefinition: za
|
|
1193
1193
|
}
|
|
1194
1194
|
};
|
|
1195
1195
|
}
|
|
1196
|
-
function
|
|
1196
|
+
function Ua(e) {
|
|
1197
1197
|
let r = !1;
|
|
1198
1198
|
return e && e.firstLineBlank && (r = !0), {
|
|
1199
1199
|
handlers: { footnoteDefinition: t, footnoteReference: _t },
|
|
@@ -1203,25 +1203,25 @@ function Oa(e) {
|
|
|
1203
1203
|
function t(a, i, o, n) {
|
|
1204
1204
|
const u = o.createTracker(n);
|
|
1205
1205
|
let c = u.move("[^");
|
|
1206
|
-
const
|
|
1206
|
+
const s = o.enter("footnoteDefinition"), f = o.enter("label");
|
|
1207
1207
|
return c += u.move(
|
|
1208
1208
|
o.safe(o.associationId(a), { before: c, after: "]" })
|
|
1209
1209
|
), f(), c += u.move("]:"), a.children && a.children.length > 0 && (u.shift(4), c += u.move(
|
|
1210
1210
|
(r ? `
|
|
1211
1211
|
` : " ") + o.indentLines(
|
|
1212
1212
|
o.containerFlow(a, u.current()),
|
|
1213
|
-
r ?
|
|
1213
|
+
r ? Ft : Wa
|
|
1214
1214
|
)
|
|
1215
|
-
)),
|
|
1215
|
+
)), s(), c;
|
|
1216
1216
|
}
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1219
|
-
return r === 0 ? e :
|
|
1218
|
+
function Wa(e, r, t) {
|
|
1219
|
+
return r === 0 ? e : Ft(e, r, t);
|
|
1220
1220
|
}
|
|
1221
|
-
function
|
|
1221
|
+
function Ft(e, r, t) {
|
|
1222
1222
|
return (t ? "" : " ") + e;
|
|
1223
1223
|
}
|
|
1224
|
-
const
|
|
1224
|
+
const Ba = [
|
|
1225
1225
|
"autolink",
|
|
1226
1226
|
"destinationLiteral",
|
|
1227
1227
|
"destinationRaw",
|
|
@@ -1229,33 +1229,33 @@ const Wa = [
|
|
|
1229
1229
|
"titleQuote",
|
|
1230
1230
|
"titleApostrophe"
|
|
1231
1231
|
];
|
|
1232
|
-
|
|
1233
|
-
function
|
|
1232
|
+
jt.peek = Ka;
|
|
1233
|
+
function Ha() {
|
|
1234
1234
|
return {
|
|
1235
1235
|
canContainEols: ["delete"],
|
|
1236
|
-
enter: { strikethrough:
|
|
1236
|
+
enter: { strikethrough: Va },
|
|
1237
1237
|
exit: { strikethrough: Xa }
|
|
1238
1238
|
};
|
|
1239
1239
|
}
|
|
1240
|
-
function
|
|
1240
|
+
function qa() {
|
|
1241
1241
|
return {
|
|
1242
1242
|
unsafe: [
|
|
1243
1243
|
{
|
|
1244
1244
|
character: "~",
|
|
1245
1245
|
inConstruct: "phrasing",
|
|
1246
|
-
notInConstruct:
|
|
1246
|
+
notInConstruct: Ba
|
|
1247
1247
|
}
|
|
1248
1248
|
],
|
|
1249
|
-
handlers: { delete:
|
|
1249
|
+
handlers: { delete: jt }
|
|
1250
1250
|
};
|
|
1251
1251
|
}
|
|
1252
|
-
function
|
|
1252
|
+
function Va(e) {
|
|
1253
1253
|
this.enter({ type: "delete", children: [] }, e);
|
|
1254
1254
|
}
|
|
1255
1255
|
function Xa(e) {
|
|
1256
1256
|
this.exit(e);
|
|
1257
1257
|
}
|
|
1258
|
-
function
|
|
1258
|
+
function jt(e, r, t, a) {
|
|
1259
1259
|
const i = t.createTracker(a), o = t.enter("strikethrough");
|
|
1260
1260
|
let n = i.move("~~");
|
|
1261
1261
|
return n += t.containerPhrasing(e, {
|
|
@@ -1267,63 +1267,63 @@ function zt(e, r, t, a) {
|
|
|
1267
1267
|
function Ka() {
|
|
1268
1268
|
return "~";
|
|
1269
1269
|
}
|
|
1270
|
-
function
|
|
1270
|
+
function Ga(e) {
|
|
1271
1271
|
return e.length;
|
|
1272
1272
|
}
|
|
1273
|
-
function
|
|
1274
|
-
const t = r || {}, a = (t.align || []).concat(), i = t.stringLength ||
|
|
1275
|
-
let
|
|
1273
|
+
function Za(e, r) {
|
|
1274
|
+
const t = r || {}, a = (t.align || []).concat(), i = t.stringLength || Ga, o = [], n = [], u = [], c = [];
|
|
1275
|
+
let s = 0, f = -1;
|
|
1276
1276
|
for (; ++f < e.length; ) {
|
|
1277
|
-
const
|
|
1277
|
+
const x = [], g = [];
|
|
1278
1278
|
let b = -1;
|
|
1279
|
-
for (e[f].length >
|
|
1280
|
-
const k =
|
|
1279
|
+
for (e[f].length > s && (s = e[f].length); ++b < e[f].length; ) {
|
|
1280
|
+
const k = Ja(e[f][b]);
|
|
1281
1281
|
if (t.alignDelimiters !== !1) {
|
|
1282
1282
|
const w = i(k);
|
|
1283
1283
|
g[b] = w, (c[b] === void 0 || w > c[b]) && (c[b] = w);
|
|
1284
1284
|
}
|
|
1285
|
-
|
|
1285
|
+
x.push(k);
|
|
1286
1286
|
}
|
|
1287
|
-
n[f] =
|
|
1287
|
+
n[f] = x, u[f] = g;
|
|
1288
1288
|
}
|
|
1289
|
-
let
|
|
1289
|
+
let l = -1;
|
|
1290
1290
|
if (typeof a == "object" && "length" in a)
|
|
1291
|
-
for (; ++
|
|
1292
|
-
o[
|
|
1291
|
+
for (; ++l < s; )
|
|
1292
|
+
o[l] = st(a[l]);
|
|
1293
1293
|
else {
|
|
1294
|
-
const
|
|
1295
|
-
for (; ++
|
|
1296
|
-
o[
|
|
1297
|
-
}
|
|
1298
|
-
|
|
1299
|
-
const p = [],
|
|
1300
|
-
for (; ++
|
|
1301
|
-
const
|
|
1294
|
+
const x = st(a);
|
|
1295
|
+
for (; ++l < s; )
|
|
1296
|
+
o[l] = x;
|
|
1297
|
+
}
|
|
1298
|
+
l = -1;
|
|
1299
|
+
const p = [], y = [];
|
|
1300
|
+
for (; ++l < s; ) {
|
|
1301
|
+
const x = o[l];
|
|
1302
1302
|
let g = "", b = "";
|
|
1303
|
-
|
|
1303
|
+
x === 99 ? (g = ":", b = ":") : x === 108 ? g = ":" : x === 114 && (b = ":");
|
|
1304
1304
|
let k = t.alignDelimiters === !1 ? 1 : Math.max(
|
|
1305
1305
|
1,
|
|
1306
|
-
c[
|
|
1306
|
+
c[l] - g.length - b.length
|
|
1307
1307
|
);
|
|
1308
1308
|
const w = g + "-".repeat(k) + b;
|
|
1309
|
-
t.alignDelimiters !== !1 && (k = g.length + k + b.length, k > c[
|
|
1309
|
+
t.alignDelimiters !== !1 && (k = g.length + k + b.length, k > c[l] && (c[l] = k), y[l] = k), p[l] = w;
|
|
1310
1310
|
}
|
|
1311
|
-
n.splice(1, 0, p), u.splice(1, 0,
|
|
1311
|
+
n.splice(1, 0, p), u.splice(1, 0, y), f = -1;
|
|
1312
1312
|
const h = [];
|
|
1313
1313
|
for (; ++f < n.length; ) {
|
|
1314
|
-
const
|
|
1315
|
-
|
|
1314
|
+
const x = n[f], g = u[f];
|
|
1315
|
+
l = -1;
|
|
1316
1316
|
const b = [];
|
|
1317
|
-
for (; ++
|
|
1318
|
-
const k =
|
|
1317
|
+
for (; ++l < s; ) {
|
|
1318
|
+
const k = x[l] || "";
|
|
1319
1319
|
let w = "", A = "";
|
|
1320
1320
|
if (t.alignDelimiters !== !1) {
|
|
1321
|
-
const I = c[
|
|
1321
|
+
const I = c[l] - (g[l] || 0), T = o[l];
|
|
1322
1322
|
T === 114 ? w = " ".repeat(I) : T === 99 ? I % 2 ? (w = " ".repeat(I / 2 + 0.5), A = " ".repeat(I / 2 - 0.5)) : (w = " ".repeat(I / 2), A = w) : A = " ".repeat(I);
|
|
1323
1323
|
}
|
|
1324
|
-
t.delimiterStart !== !1 && !
|
|
1324
|
+
t.delimiterStart !== !1 && !l && b.push("|"), t.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is
|
|
1325
1325
|
// empty: there will be a closing space.
|
|
1326
|
-
!(t.alignDelimiters === !1 && k === "") && (t.delimiterStart !== !1 ||
|
|
1326
|
+
!(t.alignDelimiters === !1 && k === "") && (t.delimiterStart !== !1 || l) && b.push(" "), t.alignDelimiters !== !1 && b.push(w), b.push(k), t.alignDelimiters !== !1 && b.push(A), t.padding !== !1 && b.push(" "), (t.delimiterEnd !== !1 || l !== s - 1) && b.push("|");
|
|
1327
1327
|
}
|
|
1328
1328
|
h.push(
|
|
1329
1329
|
t.delimiterEnd === !1 ? b.join("").replace(/ +$/, "") : b.join("")
|
|
@@ -1332,29 +1332,29 @@ function Ga(e, r) {
|
|
|
1332
1332
|
return h.join(`
|
|
1333
1333
|
`);
|
|
1334
1334
|
}
|
|
1335
|
-
function
|
|
1335
|
+
function Ja(e) {
|
|
1336
1336
|
return e == null ? "" : String(e);
|
|
1337
1337
|
}
|
|
1338
|
-
function
|
|
1338
|
+
function st(e) {
|
|
1339
1339
|
const r = typeof e == "string" ? e.codePointAt(0) : 0;
|
|
1340
1340
|
return r === 67 || r === 99 ? 99 : r === 76 || r === 108 ? 108 : r === 82 || r === 114 ? 114 : 0;
|
|
1341
1341
|
}
|
|
1342
|
-
function
|
|
1342
|
+
function Qa(e, r, t, a) {
|
|
1343
1343
|
const i = t.enter("blockquote"), o = t.createTracker(a);
|
|
1344
1344
|
o.move("> "), o.shift(2);
|
|
1345
1345
|
const n = t.indentLines(
|
|
1346
1346
|
t.containerFlow(e, o.current()),
|
|
1347
|
-
|
|
1347
|
+
Ya
|
|
1348
1348
|
);
|
|
1349
1349
|
return i(), n;
|
|
1350
1350
|
}
|
|
1351
|
-
function
|
|
1351
|
+
function Ya(e, r, t) {
|
|
1352
1352
|
return ">" + (t ? "" : " ") + e;
|
|
1353
1353
|
}
|
|
1354
|
-
function
|
|
1355
|
-
return
|
|
1354
|
+
function en(e, r) {
|
|
1355
|
+
return lt(e, r.inConstruct, !0) && !lt(e, r.notInConstruct, !1);
|
|
1356
1356
|
}
|
|
1357
|
-
function
|
|
1357
|
+
function lt(e, r, t) {
|
|
1358
1358
|
if (typeof r == "string" && (r = [r]), !r || r.length === 0)
|
|
1359
1359
|
return t;
|
|
1360
1360
|
let a = -1;
|
|
@@ -1367,12 +1367,12 @@ function dt(e, r, t, a) {
|
|
|
1367
1367
|
let i = -1;
|
|
1368
1368
|
for (; ++i < t.unsafe.length; )
|
|
1369
1369
|
if (t.unsafe[i].character === `
|
|
1370
|
-
` &&
|
|
1370
|
+
` && en(t.stack, t.unsafe[i]))
|
|
1371
1371
|
return /[ \t]/.test(a.before) ? "" : " ";
|
|
1372
1372
|
return `\\
|
|
1373
1373
|
`;
|
|
1374
1374
|
}
|
|
1375
|
-
function
|
|
1375
|
+
function tn(e, r) {
|
|
1376
1376
|
const t = String(e);
|
|
1377
1377
|
let a = t.indexOf(r), i = a, o = 0, n = 0;
|
|
1378
1378
|
if (typeof r != "string")
|
|
@@ -1381,13 +1381,13 @@ function en(e, r) {
|
|
|
1381
1381
|
a === i ? ++o > n && (n = o) : o = 1, i = a + r.length, a = t.indexOf(r, i);
|
|
1382
1382
|
return n;
|
|
1383
1383
|
}
|
|
1384
|
-
function
|
|
1384
|
+
function rn(e, r) {
|
|
1385
1385
|
return !!(r.options.fences === !1 && e.value && // If there’s no info…
|
|
1386
1386
|
!e.lang && // And there’s a non-whitespace character…
|
|
1387
1387
|
/[^ \r\n]/.test(e.value) && // And the value doesn’t start or end in a blank…
|
|
1388
1388
|
!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value));
|
|
1389
1389
|
}
|
|
1390
|
-
function
|
|
1390
|
+
function an(e) {
|
|
1391
1391
|
const r = e.options.fence || "`";
|
|
1392
1392
|
if (r !== "`" && r !== "~")
|
|
1393
1393
|
throw new Error(
|
|
@@ -1395,16 +1395,16 @@ function rn(e) {
|
|
|
1395
1395
|
);
|
|
1396
1396
|
return r;
|
|
1397
1397
|
}
|
|
1398
|
-
function
|
|
1399
|
-
const i =
|
|
1400
|
-
if (
|
|
1401
|
-
const
|
|
1402
|
-
return
|
|
1398
|
+
function nn(e, r, t, a) {
|
|
1399
|
+
const i = an(t), o = e.value || "", n = i === "`" ? "GraveAccent" : "Tilde";
|
|
1400
|
+
if (rn(e, t)) {
|
|
1401
|
+
const l = t.enter("codeIndented"), p = t.indentLines(o, on);
|
|
1402
|
+
return l(), p;
|
|
1403
1403
|
}
|
|
1404
|
-
const u = t.createTracker(a), c = i.repeat(Math.max(
|
|
1404
|
+
const u = t.createTracker(a), c = i.repeat(Math.max(tn(o, i) + 1, 3)), s = t.enter("codeFenced");
|
|
1405
1405
|
let f = u.move(c);
|
|
1406
1406
|
if (e.lang) {
|
|
1407
|
-
const
|
|
1407
|
+
const l = t.enter(`codeFencedLang${n}`);
|
|
1408
1408
|
f += u.move(
|
|
1409
1409
|
t.safe(e.lang, {
|
|
1410
1410
|
before: f,
|
|
@@ -1412,10 +1412,10 @@ function an(e, r, t, a) {
|
|
|
1412
1412
|
encode: ["`"],
|
|
1413
1413
|
...u.current()
|
|
1414
1414
|
})
|
|
1415
|
-
),
|
|
1415
|
+
), l();
|
|
1416
1416
|
}
|
|
1417
1417
|
if (e.lang && e.meta) {
|
|
1418
|
-
const
|
|
1418
|
+
const l = t.enter(`codeFencedMeta${n}`);
|
|
1419
1419
|
f += u.move(" "), f += u.move(
|
|
1420
1420
|
t.safe(e.meta, {
|
|
1421
1421
|
before: f,
|
|
@@ -1424,13 +1424,13 @@ function an(e, r, t, a) {
|
|
|
1424
1424
|
encode: ["`"],
|
|
1425
1425
|
...u.current()
|
|
1426
1426
|
})
|
|
1427
|
-
),
|
|
1427
|
+
), l();
|
|
1428
1428
|
}
|
|
1429
1429
|
return f += u.move(`
|
|
1430
1430
|
`), o && (f += u.move(o + `
|
|
1431
|
-
`)), f += u.move(c),
|
|
1431
|
+
`)), f += u.move(c), s(), f;
|
|
1432
1432
|
}
|
|
1433
|
-
function
|
|
1433
|
+
function on(e, r, t) {
|
|
1434
1434
|
return (t ? "" : " ") + e;
|
|
1435
1435
|
}
|
|
1436
1436
|
function Be(e) {
|
|
@@ -1441,37 +1441,37 @@ function Be(e) {
|
|
|
1441
1441
|
);
|
|
1442
1442
|
return r;
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1444
|
+
function cn(e, r, t, a) {
|
|
1445
1445
|
const i = Be(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.enter("definition");
|
|
1446
1446
|
let u = t.enter("label");
|
|
1447
1447
|
const c = t.createTracker(a);
|
|
1448
|
-
let
|
|
1449
|
-
return
|
|
1448
|
+
let s = c.move("[");
|
|
1449
|
+
return s += c.move(
|
|
1450
1450
|
t.safe(t.associationId(e), {
|
|
1451
|
-
before:
|
|
1451
|
+
before: s,
|
|
1452
1452
|
after: "]",
|
|
1453
1453
|
...c.current()
|
|
1454
1454
|
})
|
|
1455
|
-
),
|
|
1455
|
+
), s += c.move("]: "), u(), // If there’s no url, or…
|
|
1456
1456
|
!e.url || // If there are control characters or whitespace.
|
|
1457
|
-
/[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"),
|
|
1458
|
-
t.safe(e.url, { before:
|
|
1459
|
-
),
|
|
1457
|
+
/[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"), s += c.move("<"), s += c.move(
|
|
1458
|
+
t.safe(e.url, { before: s, after: ">", ...c.current() })
|
|
1459
|
+
), s += c.move(">")) : (u = t.enter("destinationRaw"), s += c.move(
|
|
1460
1460
|
t.safe(e.url, {
|
|
1461
|
-
before:
|
|
1461
|
+
before: s,
|
|
1462
1462
|
after: e.title ? " " : `
|
|
1463
1463
|
`,
|
|
1464
1464
|
...c.current()
|
|
1465
1465
|
})
|
|
1466
|
-
)), u(), e.title && (u = t.enter(`title${o}`),
|
|
1466
|
+
)), u(), e.title && (u = t.enter(`title${o}`), s += c.move(" " + i), s += c.move(
|
|
1467
1467
|
t.safe(e.title, {
|
|
1468
|
-
before:
|
|
1468
|
+
before: s,
|
|
1469
1469
|
after: i,
|
|
1470
1470
|
...c.current()
|
|
1471
1471
|
})
|
|
1472
|
-
),
|
|
1472
|
+
), s += c.move(i), u()), n(), s;
|
|
1473
1473
|
}
|
|
1474
|
-
function
|
|
1474
|
+
function un(e) {
|
|
1475
1475
|
const r = e.options.emphasis || "*";
|
|
1476
1476
|
if (r !== "*" && r !== "_")
|
|
1477
1477
|
throw new Error(
|
|
@@ -1479,17 +1479,17 @@ function cn(e) {
|
|
|
1479
1479
|
);
|
|
1480
1480
|
return r;
|
|
1481
1481
|
}
|
|
1482
|
-
function
|
|
1482
|
+
function se(e) {
|
|
1483
1483
|
return "&#x" + e.toString(16).toUpperCase() + ";";
|
|
1484
1484
|
}
|
|
1485
|
-
function
|
|
1486
|
-
if (e === null ||
|
|
1485
|
+
function ye(e) {
|
|
1486
|
+
if (e === null || E(e) || K(e))
|
|
1487
1487
|
return 1;
|
|
1488
1488
|
if (ke(e))
|
|
1489
1489
|
return 2;
|
|
1490
1490
|
}
|
|
1491
|
-
function
|
|
1492
|
-
const a =
|
|
1491
|
+
function xe(e, r, t) {
|
|
1492
|
+
const a = ye(e), i = ye(r);
|
|
1493
1493
|
return a === void 0 ? i === void 0 ? (
|
|
1494
1494
|
// Letter inside:
|
|
1495
1495
|
// we have to encode *both* letters for `_` as it is looser.
|
|
@@ -1521,9 +1521,9 @@ function ye(e, r, t) {
|
|
|
1521
1521
|
{ inside: !1, outside: !1 }
|
|
1522
1522
|
);
|
|
1523
1523
|
}
|
|
1524
|
-
|
|
1525
|
-
function
|
|
1526
|
-
const i =
|
|
1524
|
+
zt.peek = sn;
|
|
1525
|
+
function zt(e, r, t, a) {
|
|
1526
|
+
const i = un(t), o = t.enter("emphasis"), n = t.createTracker(a), u = n.move(i);
|
|
1527
1527
|
let c = n.move(
|
|
1528
1528
|
t.containerPhrasing(e, {
|
|
1529
1529
|
after: i,
|
|
@@ -1531,38 +1531,38 @@ function jt(e, r, t, a) {
|
|
|
1531
1531
|
...n.current()
|
|
1532
1532
|
})
|
|
1533
1533
|
);
|
|
1534
|
-
const
|
|
1534
|
+
const s = c.charCodeAt(0), f = xe(
|
|
1535
1535
|
a.before.charCodeAt(a.before.length - 1),
|
|
1536
|
-
|
|
1536
|
+
s,
|
|
1537
1537
|
i
|
|
1538
1538
|
);
|
|
1539
|
-
f.inside && (c =
|
|
1540
|
-
const
|
|
1541
|
-
p.inside && (c = c.slice(0, -1) +
|
|
1542
|
-
const
|
|
1539
|
+
f.inside && (c = se(s) + c.slice(1));
|
|
1540
|
+
const l = c.charCodeAt(c.length - 1), p = xe(a.after.charCodeAt(0), l, i);
|
|
1541
|
+
p.inside && (c = c.slice(0, -1) + se(l));
|
|
1542
|
+
const y = n.move(i);
|
|
1543
1543
|
return o(), t.attentionEncodeSurroundingInfo = {
|
|
1544
1544
|
after: p.outside,
|
|
1545
1545
|
before: f.outside
|
|
1546
|
-
}, u + c +
|
|
1546
|
+
}, u + c + y;
|
|
1547
1547
|
}
|
|
1548
|
-
function
|
|
1548
|
+
function sn(e, r, t) {
|
|
1549
1549
|
return t.options.emphasis || "*";
|
|
1550
1550
|
}
|
|
1551
1551
|
function ln(e, r, t, a) {
|
|
1552
1552
|
let i, o, n;
|
|
1553
1553
|
typeof r == "function" && typeof t != "function" ? (o = void 0, n = r, i = t) : (o = r, n = t, i = a), Pt(e, o, u, i);
|
|
1554
|
-
function u(c,
|
|
1555
|
-
const f =
|
|
1556
|
-
return n(c,
|
|
1554
|
+
function u(c, s) {
|
|
1555
|
+
const f = s[s.length - 1], l = f ? f.children.indexOf(c) : void 0;
|
|
1556
|
+
return n(c, l, f);
|
|
1557
1557
|
}
|
|
1558
1558
|
}
|
|
1559
|
-
const
|
|
1559
|
+
const dn = {};
|
|
1560
1560
|
function $t(e, r) {
|
|
1561
|
-
const t =
|
|
1561
|
+
const t = dn, a = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, i = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
|
|
1562
1562
|
return Ot(e, a, i);
|
|
1563
1563
|
}
|
|
1564
1564
|
function Ot(e, r, t) {
|
|
1565
|
-
if (
|
|
1565
|
+
if (fn(e)) {
|
|
1566
1566
|
if ("value" in e)
|
|
1567
1567
|
return e.type === "html" && !t ? "" : e.value;
|
|
1568
1568
|
if (r && "alt" in e && e.alt)
|
|
@@ -1579,27 +1579,27 @@ function ft(e, r, t) {
|
|
|
1579
1579
|
a[i] = Ot(e[i], r, t);
|
|
1580
1580
|
return a.join("");
|
|
1581
1581
|
}
|
|
1582
|
-
function
|
|
1582
|
+
function fn(e) {
|
|
1583
1583
|
return !!(e && typeof e == "object");
|
|
1584
1584
|
}
|
|
1585
|
-
function
|
|
1585
|
+
function hn(e, r) {
|
|
1586
1586
|
let t = !1;
|
|
1587
1587
|
return ln(e, function(a) {
|
|
1588
1588
|
if ("value" in a && /\r?\n|\r/.test(a.value) || a.type === "break")
|
|
1589
1589
|
return t = !0, $e;
|
|
1590
1590
|
}), !!((!e.depth || e.depth < 3) && $t(e) && (r.options.setext || t));
|
|
1591
1591
|
}
|
|
1592
|
-
function
|
|
1592
|
+
function mn(e, r, t, a) {
|
|
1593
1593
|
const i = Math.max(Math.min(6, e.depth || 1), 1), o = t.createTracker(a);
|
|
1594
|
-
if (
|
|
1595
|
-
const f = t.enter("headingSetext"),
|
|
1594
|
+
if (hn(e, t)) {
|
|
1595
|
+
const f = t.enter("headingSetext"), l = t.enter("phrasing"), p = t.containerPhrasing(e, {
|
|
1596
1596
|
...o.current(),
|
|
1597
1597
|
before: `
|
|
1598
1598
|
`,
|
|
1599
1599
|
after: `
|
|
1600
1600
|
`
|
|
1601
1601
|
});
|
|
1602
|
-
return
|
|
1602
|
+
return l(), f(), p + `
|
|
1603
1603
|
` + (i === 1 ? "=" : "-").repeat(
|
|
1604
1604
|
// The whole size…
|
|
1605
1605
|
p.length - // Minus the position of the character after the last EOL (or
|
|
@@ -1610,75 +1610,75 @@ function hn(e, r, t, a) {
|
|
|
1610
1610
|
}
|
|
1611
1611
|
const n = "#".repeat(i), u = t.enter("headingAtx"), c = t.enter("phrasing");
|
|
1612
1612
|
o.move(n + " ");
|
|
1613
|
-
let
|
|
1613
|
+
let s = t.containerPhrasing(e, {
|
|
1614
1614
|
before: "# ",
|
|
1615
1615
|
after: `
|
|
1616
1616
|
`,
|
|
1617
1617
|
...o.current()
|
|
1618
1618
|
});
|
|
1619
|
-
return /^[\t ]/.test(
|
|
1619
|
+
return /^[\t ]/.test(s) && (s = se(s.charCodeAt(0)) + s.slice(1)), s = s ? n + " " + s : n, t.options.closeAtx && (s += " " + n), c(), u(), s;
|
|
1620
1620
|
}
|
|
1621
|
-
Ut.peek =
|
|
1621
|
+
Ut.peek = pn;
|
|
1622
1622
|
function Ut(e) {
|
|
1623
1623
|
return e.value || "";
|
|
1624
1624
|
}
|
|
1625
|
-
function
|
|
1625
|
+
function pn() {
|
|
1626
1626
|
return "<";
|
|
1627
1627
|
}
|
|
1628
|
-
Wt.peek =
|
|
1628
|
+
Wt.peek = gn;
|
|
1629
1629
|
function Wt(e, r, t, a) {
|
|
1630
1630
|
const i = Be(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.enter("image");
|
|
1631
1631
|
let u = t.enter("label");
|
|
1632
1632
|
const c = t.createTracker(a);
|
|
1633
|
-
let
|
|
1634
|
-
return
|
|
1635
|
-
t.safe(e.alt, { before:
|
|
1636
|
-
),
|
|
1633
|
+
let s = c.move("![");
|
|
1634
|
+
return s += c.move(
|
|
1635
|
+
t.safe(e.alt, { before: s, after: "]", ...c.current() })
|
|
1636
|
+
), s += c.move("]("), u(), // If there’s no url but there is a title…
|
|
1637
1637
|
!e.url && e.title || // If there are control characters or whitespace.
|
|
1638
|
-
/[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"),
|
|
1639
|
-
t.safe(e.url, { before:
|
|
1640
|
-
),
|
|
1638
|
+
/[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"), s += c.move("<"), s += c.move(
|
|
1639
|
+
t.safe(e.url, { before: s, after: ">", ...c.current() })
|
|
1640
|
+
), s += c.move(">")) : (u = t.enter("destinationRaw"), s += c.move(
|
|
1641
1641
|
t.safe(e.url, {
|
|
1642
|
-
before:
|
|
1642
|
+
before: s,
|
|
1643
1643
|
after: e.title ? " " : ")",
|
|
1644
1644
|
...c.current()
|
|
1645
1645
|
})
|
|
1646
|
-
)), u(), e.title && (u = t.enter(`title${o}`),
|
|
1646
|
+
)), u(), e.title && (u = t.enter(`title${o}`), s += c.move(" " + i), s += c.move(
|
|
1647
1647
|
t.safe(e.title, {
|
|
1648
|
-
before:
|
|
1648
|
+
before: s,
|
|
1649
1649
|
after: i,
|
|
1650
1650
|
...c.current()
|
|
1651
1651
|
})
|
|
1652
|
-
),
|
|
1652
|
+
), s += c.move(i), u()), s += c.move(")"), n(), s;
|
|
1653
1653
|
}
|
|
1654
|
-
function
|
|
1654
|
+
function gn() {
|
|
1655
1655
|
return "!";
|
|
1656
1656
|
}
|
|
1657
|
-
Bt.peek =
|
|
1657
|
+
Bt.peek = bn;
|
|
1658
1658
|
function Bt(e, r, t, a) {
|
|
1659
1659
|
const i = e.referenceType, o = t.enter("imageReference");
|
|
1660
1660
|
let n = t.enter("label");
|
|
1661
1661
|
const u = t.createTracker(a);
|
|
1662
1662
|
let c = u.move("![");
|
|
1663
|
-
const
|
|
1663
|
+
const s = t.safe(e.alt, {
|
|
1664
1664
|
before: c,
|
|
1665
1665
|
after: "]",
|
|
1666
1666
|
...u.current()
|
|
1667
1667
|
});
|
|
1668
|
-
c += u.move(
|
|
1668
|
+
c += u.move(s + "]["), n();
|
|
1669
1669
|
const f = t.stack;
|
|
1670
1670
|
t.stack = [], n = t.enter("reference");
|
|
1671
|
-
const
|
|
1671
|
+
const l = t.safe(t.associationId(e), {
|
|
1672
1672
|
before: c,
|
|
1673
1673
|
after: "]",
|
|
1674
1674
|
...u.current()
|
|
1675
1675
|
});
|
|
1676
|
-
return n(), t.stack = f, o(), i === "full" || !
|
|
1676
|
+
return n(), t.stack = f, o(), i === "full" || !s || s !== l ? c += u.move(l + "]") : i === "shortcut" ? c = c.slice(0, -1) : c += u.move("]"), c;
|
|
1677
1677
|
}
|
|
1678
|
-
function
|
|
1678
|
+
function bn() {
|
|
1679
1679
|
return "!";
|
|
1680
1680
|
}
|
|
1681
|
-
Ht.peek =
|
|
1681
|
+
Ht.peek = yn;
|
|
1682
1682
|
function Ht(e, r, t) {
|
|
1683
1683
|
let a = e.value || "", i = "`", o = -1;
|
|
1684
1684
|
for (; new RegExp("(^|[^`])" + i + "([^`]|$)").test(a); )
|
|
@@ -1688,13 +1688,13 @@ function Ht(e, r, t) {
|
|
|
1688
1688
|
let c;
|
|
1689
1689
|
if (n.atBreak)
|
|
1690
1690
|
for (; c = u.exec(a); ) {
|
|
1691
|
-
let
|
|
1692
|
-
a.charCodeAt(
|
|
1691
|
+
let s = c.index;
|
|
1692
|
+
a.charCodeAt(s) === 10 && a.charCodeAt(s - 1) === 13 && s--, a = a.slice(0, s) + " " + a.slice(c.index + 1);
|
|
1693
1693
|
}
|
|
1694
1694
|
}
|
|
1695
1695
|
return i + a + i;
|
|
1696
1696
|
}
|
|
1697
|
-
function
|
|
1697
|
+
function yn() {
|
|
1698
1698
|
return "`";
|
|
1699
1699
|
}
|
|
1700
1700
|
function qt(e, r) {
|
|
@@ -1708,73 +1708,73 @@ function qt(e, r) {
|
|
|
1708
1708
|
// references don’t work), space, or angle brackets…
|
|
1709
1709
|
!/[\0- <>\u007F]/.test(e.url));
|
|
1710
1710
|
}
|
|
1711
|
-
|
|
1712
|
-
function
|
|
1711
|
+
Vt.peek = xn;
|
|
1712
|
+
function Vt(e, r, t, a) {
|
|
1713
1713
|
const i = Be(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.createTracker(a);
|
|
1714
1714
|
let u, c;
|
|
1715
1715
|
if (qt(e, t)) {
|
|
1716
1716
|
const f = t.stack;
|
|
1717
1717
|
t.stack = [], u = t.enter("autolink");
|
|
1718
|
-
let
|
|
1719
|
-
return
|
|
1718
|
+
let l = n.move("<");
|
|
1719
|
+
return l += n.move(
|
|
1720
1720
|
t.containerPhrasing(e, {
|
|
1721
|
-
before:
|
|
1721
|
+
before: l,
|
|
1722
1722
|
after: ">",
|
|
1723
1723
|
...n.current()
|
|
1724
1724
|
})
|
|
1725
|
-
),
|
|
1725
|
+
), l += n.move(">"), u(), t.stack = f, l;
|
|
1726
1726
|
}
|
|
1727
1727
|
u = t.enter("link"), c = t.enter("label");
|
|
1728
|
-
let
|
|
1729
|
-
return
|
|
1728
|
+
let s = n.move("[");
|
|
1729
|
+
return s += n.move(
|
|
1730
1730
|
t.containerPhrasing(e, {
|
|
1731
|
-
before:
|
|
1731
|
+
before: s,
|
|
1732
1732
|
after: "](",
|
|
1733
1733
|
...n.current()
|
|
1734
1734
|
})
|
|
1735
|
-
),
|
|
1735
|
+
), s += n.move("]("), c(), // If there’s no url but there is a title…
|
|
1736
1736
|
!e.url && e.title || // If there are control characters or whitespace.
|
|
1737
|
-
/[\0- \u007F]/.test(e.url) ? (c = t.enter("destinationLiteral"),
|
|
1738
|
-
t.safe(e.url, { before:
|
|
1739
|
-
),
|
|
1737
|
+
/[\0- \u007F]/.test(e.url) ? (c = t.enter("destinationLiteral"), s += n.move("<"), s += n.move(
|
|
1738
|
+
t.safe(e.url, { before: s, after: ">", ...n.current() })
|
|
1739
|
+
), s += n.move(">")) : (c = t.enter("destinationRaw"), s += n.move(
|
|
1740
1740
|
t.safe(e.url, {
|
|
1741
|
-
before:
|
|
1741
|
+
before: s,
|
|
1742
1742
|
after: e.title ? " " : ")",
|
|
1743
1743
|
...n.current()
|
|
1744
1744
|
})
|
|
1745
|
-
)), c(), e.title && (c = t.enter(`title${o}`),
|
|
1745
|
+
)), c(), e.title && (c = t.enter(`title${o}`), s += n.move(" " + i), s += n.move(
|
|
1746
1746
|
t.safe(e.title, {
|
|
1747
|
-
before:
|
|
1747
|
+
before: s,
|
|
1748
1748
|
after: i,
|
|
1749
1749
|
...n.current()
|
|
1750
1750
|
})
|
|
1751
|
-
),
|
|
1751
|
+
), s += n.move(i), c()), s += n.move(")"), u(), s;
|
|
1752
1752
|
}
|
|
1753
1753
|
function xn(e, r, t) {
|
|
1754
1754
|
return qt(e, t) ? "<" : "[";
|
|
1755
1755
|
}
|
|
1756
|
-
|
|
1757
|
-
function
|
|
1756
|
+
Xt.peek = kn;
|
|
1757
|
+
function Xt(e, r, t, a) {
|
|
1758
1758
|
const i = e.referenceType, o = t.enter("linkReference");
|
|
1759
1759
|
let n = t.enter("label");
|
|
1760
1760
|
const u = t.createTracker(a);
|
|
1761
1761
|
let c = u.move("[");
|
|
1762
|
-
const
|
|
1762
|
+
const s = t.containerPhrasing(e, {
|
|
1763
1763
|
before: c,
|
|
1764
1764
|
after: "]",
|
|
1765
1765
|
...u.current()
|
|
1766
1766
|
});
|
|
1767
|
-
c += u.move(
|
|
1767
|
+
c += u.move(s + "]["), n();
|
|
1768
1768
|
const f = t.stack;
|
|
1769
1769
|
t.stack = [], n = t.enter("reference");
|
|
1770
|
-
const
|
|
1770
|
+
const l = t.safe(t.associationId(e), {
|
|
1771
1771
|
before: c,
|
|
1772
1772
|
after: "]",
|
|
1773
1773
|
...u.current()
|
|
1774
1774
|
});
|
|
1775
|
-
return n(), t.stack = f, o(), i === "full" || !
|
|
1775
|
+
return n(), t.stack = f, o(), i === "full" || !s || s !== l ? c += u.move(l + "]") : i === "shortcut" ? c = c.slice(0, -1) : c += u.move("]"), c;
|
|
1776
1776
|
}
|
|
1777
|
-
function
|
|
1777
|
+
function kn() {
|
|
1778
1778
|
return "[";
|
|
1779
1779
|
}
|
|
1780
1780
|
function He(e) {
|
|
@@ -1785,7 +1785,7 @@ function He(e) {
|
|
|
1785
1785
|
);
|
|
1786
1786
|
return r;
|
|
1787
1787
|
}
|
|
1788
|
-
function
|
|
1788
|
+
function wn(e) {
|
|
1789
1789
|
const r = He(e), t = e.options.bulletOther;
|
|
1790
1790
|
if (!t)
|
|
1791
1791
|
return r === "*" ? "-" : "*";
|
|
@@ -1799,7 +1799,7 @@ function kn(e) {
|
|
|
1799
1799
|
);
|
|
1800
1800
|
return t;
|
|
1801
1801
|
}
|
|
1802
|
-
function
|
|
1802
|
+
function vn(e) {
|
|
1803
1803
|
const r = e.options.bulletOrdered || ".";
|
|
1804
1804
|
if (r !== "." && r !== ")")
|
|
1805
1805
|
throw new Error(
|
|
@@ -1807,7 +1807,7 @@ function wn(e) {
|
|
|
1807
1807
|
);
|
|
1808
1808
|
return r;
|
|
1809
1809
|
}
|
|
1810
|
-
function
|
|
1810
|
+
function Kt(e) {
|
|
1811
1811
|
const r = e.options.rule || "*";
|
|
1812
1812
|
if (r !== "*" && r !== "-" && r !== "_")
|
|
1813
1813
|
throw new Error(
|
|
@@ -1817,8 +1817,8 @@ function Vt(e) {
|
|
|
1817
1817
|
}
|
|
1818
1818
|
function Cn(e, r, t, a) {
|
|
1819
1819
|
const i = t.enter("list"), o = t.bulletCurrent;
|
|
1820
|
-
let n = e.ordered ?
|
|
1821
|
-
const u = e.ordered ? n === "." ? ")" : "." :
|
|
1820
|
+
let n = e.ordered ? vn(t) : He(t);
|
|
1821
|
+
const u = e.ordered ? n === "." ? ")" : "." : wn(t);
|
|
1822
1822
|
let c = r && t.bulletLastUsed ? n === t.bulletLastUsed : !1;
|
|
1823
1823
|
if (!e.ordered) {
|
|
1824
1824
|
const f = e.children ? e.children[0] : void 0;
|
|
@@ -1827,11 +1827,11 @@ function Cn(e, r, t, a) {
|
|
|
1827
1827
|
(n === "*" || n === "-") && // Empty first list item:
|
|
1828
1828
|
f && (!f.children || !f.children[0]) && // Directly in two other list items:
|
|
1829
1829
|
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.
|
|
1830
|
-
t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (c = !0),
|
|
1830
|
+
t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (c = !0), Kt(t) === n && f
|
|
1831
1831
|
) {
|
|
1832
|
-
let
|
|
1833
|
-
for (; ++
|
|
1834
|
-
const p = e.children[
|
|
1832
|
+
let l = -1;
|
|
1833
|
+
for (; ++l < e.children.length; ) {
|
|
1834
|
+
const p = e.children[l];
|
|
1835
1835
|
if (p && p.type === "listItem" && p.children && p.children[0] && p.children[0].type === "thematicBreak") {
|
|
1836
1836
|
c = !0;
|
|
1837
1837
|
break;
|
|
@@ -1840,10 +1840,10 @@ function Cn(e, r, t, a) {
|
|
|
1840
1840
|
}
|
|
1841
1841
|
}
|
|
1842
1842
|
c && (n = u), t.bulletCurrent = n;
|
|
1843
|
-
const
|
|
1844
|
-
return t.bulletLastUsed = n, t.bulletCurrent = o, i(),
|
|
1843
|
+
const s = t.containerFlow(e, a);
|
|
1844
|
+
return t.bulletLastUsed = n, t.bulletCurrent = o, i(), s;
|
|
1845
1845
|
}
|
|
1846
|
-
function
|
|
1846
|
+
function Tn(e) {
|
|
1847
1847
|
const r = e.options.listItemIndent || "one";
|
|
1848
1848
|
if (r !== "tab" && r !== "one" && r !== "mixed")
|
|
1849
1849
|
throw new Error(
|
|
@@ -1851,30 +1851,30 @@ function vn(e) {
|
|
|
1851
1851
|
);
|
|
1852
1852
|
return r;
|
|
1853
1853
|
}
|
|
1854
|
-
function
|
|
1855
|
-
const i =
|
|
1854
|
+
function An(e, r, t, a) {
|
|
1855
|
+
const i = Tn(t);
|
|
1856
1856
|
let o = t.bulletCurrent || He(t);
|
|
1857
1857
|
r && r.type === "list" && r.ordered && (o = (typeof r.start == "number" && r.start > -1 ? r.start : 1) + (t.options.incrementListMarker === !1 ? 0 : r.children.indexOf(e)) + o);
|
|
1858
1858
|
let n = o.length + 1;
|
|
1859
1859
|
(i === "tab" || i === "mixed" && (r && r.type === "list" && r.spread || e.spread)) && (n = Math.ceil(n / 4) * 4);
|
|
1860
1860
|
const u = t.createTracker(a);
|
|
1861
1861
|
u.move(o + " ".repeat(n - o.length)), u.shift(n);
|
|
1862
|
-
const c = t.enter("listItem"),
|
|
1862
|
+
const c = t.enter("listItem"), s = t.indentLines(
|
|
1863
1863
|
t.containerFlow(e, u.current()),
|
|
1864
1864
|
f
|
|
1865
1865
|
);
|
|
1866
|
-
return c(),
|
|
1867
|
-
function f(
|
|
1868
|
-
return p ? (
|
|
1866
|
+
return c(), s;
|
|
1867
|
+
function f(l, p, y) {
|
|
1868
|
+
return p ? (y ? "" : " ".repeat(n)) + l : (y ? o : o + " ".repeat(n - o.length)) + l;
|
|
1869
1869
|
}
|
|
1870
1870
|
}
|
|
1871
|
-
function
|
|
1871
|
+
function Nn(e, r, t, a) {
|
|
1872
1872
|
const i = t.enter("paragraph"), o = t.enter("phrasing"), n = t.containerPhrasing(e, a);
|
|
1873
1873
|
return o(), i(), n;
|
|
1874
1874
|
}
|
|
1875
|
-
const
|
|
1875
|
+
const In = (
|
|
1876
1876
|
/** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
|
|
1877
|
-
|
|
1877
|
+
ve([
|
|
1878
1878
|
"break",
|
|
1879
1879
|
"delete",
|
|
1880
1880
|
"emphasis",
|
|
@@ -1898,12 +1898,12 @@ const Nn = (
|
|
|
1898
1898
|
"textDirective"
|
|
1899
1899
|
])
|
|
1900
1900
|
);
|
|
1901
|
-
function
|
|
1901
|
+
function Sn(e, r, t, a) {
|
|
1902
1902
|
return (e.children.some(function(n) {
|
|
1903
|
-
return
|
|
1903
|
+
return In(n);
|
|
1904
1904
|
}) ? t.containerPhrasing : t.containerFlow).call(t, e, a);
|
|
1905
1905
|
}
|
|
1906
|
-
function
|
|
1906
|
+
function Ln(e) {
|
|
1907
1907
|
const r = e.options.strong || "*";
|
|
1908
1908
|
if (r !== "*" && r !== "_")
|
|
1909
1909
|
throw new Error(
|
|
@@ -1913,7 +1913,7 @@ function Sn(e) {
|
|
|
1913
1913
|
}
|
|
1914
1914
|
Gt.peek = Mn;
|
|
1915
1915
|
function Gt(e, r, t, a) {
|
|
1916
|
-
const i =
|
|
1916
|
+
const i = Ln(t), o = t.enter("strong"), n = t.createTracker(a), u = n.move(i + i);
|
|
1917
1917
|
let c = n.move(
|
|
1918
1918
|
t.containerPhrasing(e, {
|
|
1919
1919
|
after: i,
|
|
@@ -1921,27 +1921,27 @@ function Gt(e, r, t, a) {
|
|
|
1921
1921
|
...n.current()
|
|
1922
1922
|
})
|
|
1923
1923
|
);
|
|
1924
|
-
const
|
|
1924
|
+
const s = c.charCodeAt(0), f = xe(
|
|
1925
1925
|
a.before.charCodeAt(a.before.length - 1),
|
|
1926
|
-
|
|
1926
|
+
s,
|
|
1927
1927
|
i
|
|
1928
1928
|
);
|
|
1929
|
-
f.inside && (c =
|
|
1930
|
-
const
|
|
1931
|
-
p.inside && (c = c.slice(0, -1) +
|
|
1932
|
-
const
|
|
1929
|
+
f.inside && (c = se(s) + c.slice(1));
|
|
1930
|
+
const l = c.charCodeAt(c.length - 1), p = xe(a.after.charCodeAt(0), l, i);
|
|
1931
|
+
p.inside && (c = c.slice(0, -1) + se(l));
|
|
1932
|
+
const y = n.move(i + i);
|
|
1933
1933
|
return o(), t.attentionEncodeSurroundingInfo = {
|
|
1934
1934
|
after: p.outside,
|
|
1935
1935
|
before: f.outside
|
|
1936
|
-
}, u + c +
|
|
1936
|
+
}, u + c + y;
|
|
1937
1937
|
}
|
|
1938
1938
|
function Mn(e, r, t) {
|
|
1939
1939
|
return t.options.strong || "*";
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1941
|
+
function Dn(e, r, t, a) {
|
|
1942
1942
|
return t.safe(e.value, a);
|
|
1943
1943
|
}
|
|
1944
|
-
function
|
|
1944
|
+
function Rn(e) {
|
|
1945
1945
|
const r = e.options.ruleRepetition || 3;
|
|
1946
1946
|
if (r < 3)
|
|
1947
1947
|
throw new Error(
|
|
@@ -1949,50 +1949,50 @@ function Dn(e) {
|
|
|
1949
1949
|
);
|
|
1950
1950
|
return r;
|
|
1951
1951
|
}
|
|
1952
|
-
function
|
|
1953
|
-
const a = (
|
|
1952
|
+
function Pn(e, r, t) {
|
|
1953
|
+
const a = (Kt(t) + (t.options.ruleSpaces ? " " : "")).repeat(Rn(t));
|
|
1954
1954
|
return t.options.ruleSpaces ? a.slice(0, -1) : a;
|
|
1955
1955
|
}
|
|
1956
1956
|
const Zt = {
|
|
1957
|
-
blockquote:
|
|
1957
|
+
blockquote: Qa,
|
|
1958
1958
|
break: dt,
|
|
1959
|
-
code:
|
|
1960
|
-
definition:
|
|
1961
|
-
emphasis:
|
|
1959
|
+
code: nn,
|
|
1960
|
+
definition: cn,
|
|
1961
|
+
emphasis: zt,
|
|
1962
1962
|
hardBreak: dt,
|
|
1963
|
-
heading:
|
|
1963
|
+
heading: mn,
|
|
1964
1964
|
html: Ut,
|
|
1965
1965
|
image: Wt,
|
|
1966
1966
|
imageReference: Bt,
|
|
1967
1967
|
inlineCode: Ht,
|
|
1968
|
-
link:
|
|
1969
|
-
linkReference:
|
|
1968
|
+
link: Vt,
|
|
1969
|
+
linkReference: Xt,
|
|
1970
1970
|
list: Cn,
|
|
1971
|
-
listItem:
|
|
1972
|
-
paragraph:
|
|
1973
|
-
root:
|
|
1971
|
+
listItem: An,
|
|
1972
|
+
paragraph: Nn,
|
|
1973
|
+
root: Sn,
|
|
1974
1974
|
strong: Gt,
|
|
1975
|
-
text:
|
|
1976
|
-
thematicBreak:
|
|
1975
|
+
text: Dn,
|
|
1976
|
+
thematicBreak: Pn
|
|
1977
1977
|
};
|
|
1978
|
-
function
|
|
1978
|
+
function En() {
|
|
1979
1979
|
return {
|
|
1980
1980
|
enter: {
|
|
1981
|
-
table:
|
|
1981
|
+
table: _n,
|
|
1982
1982
|
tableData: ht,
|
|
1983
1983
|
tableHeader: ht,
|
|
1984
|
-
tableRow:
|
|
1984
|
+
tableRow: jn
|
|
1985
1985
|
},
|
|
1986
1986
|
exit: {
|
|
1987
1987
|
codeText: zn,
|
|
1988
|
-
table:
|
|
1988
|
+
table: Fn,
|
|
1989
1989
|
tableData: Pe,
|
|
1990
1990
|
tableHeader: Pe,
|
|
1991
1991
|
tableRow: Pe
|
|
1992
1992
|
}
|
|
1993
1993
|
};
|
|
1994
1994
|
}
|
|
1995
|
-
function
|
|
1995
|
+
function _n(e) {
|
|
1996
1996
|
const r = e._align;
|
|
1997
1997
|
this.enter(
|
|
1998
1998
|
{
|
|
@@ -2005,10 +2005,10 @@ function Fn(e) {
|
|
|
2005
2005
|
e
|
|
2006
2006
|
), this.data.inTable = !0;
|
|
2007
2007
|
}
|
|
2008
|
-
function
|
|
2008
|
+
function Fn(e) {
|
|
2009
2009
|
this.exit(e), this.data.inTable = void 0;
|
|
2010
2010
|
}
|
|
2011
|
-
function
|
|
2011
|
+
function jn(e) {
|
|
2012
2012
|
this.enter({ type: "tableRow", children: [] }, e);
|
|
2013
2013
|
}
|
|
2014
2014
|
function Pe(e) {
|
|
@@ -2019,14 +2019,14 @@ function ht(e) {
|
|
|
2019
2019
|
}
|
|
2020
2020
|
function zn(e) {
|
|
2021
2021
|
let r = this.resume();
|
|
2022
|
-
this.data.inTable && (r = r.replace(/\\([\\|])/g,
|
|
2022
|
+
this.data.inTable && (r = r.replace(/\\([\\|])/g, $n));
|
|
2023
2023
|
const t = this.stack[this.stack.length - 1];
|
|
2024
2024
|
t.type, t.value = r, this.exit(e);
|
|
2025
2025
|
}
|
|
2026
|
-
function
|
|
2026
|
+
function $n(e, r) {
|
|
2027
2027
|
return r === "|" ? r : e;
|
|
2028
2028
|
}
|
|
2029
|
-
function
|
|
2029
|
+
function On(e) {
|
|
2030
2030
|
const r = e || {}, t = r.tableCellPadding, a = r.tablePipeAlign, i = r.stringLength, o = t ? " " : "|";
|
|
2031
2031
|
return {
|
|
2032
2032
|
unsafe: [
|
|
@@ -2055,24 +2055,24 @@ function $n(e) {
|
|
|
2055
2055
|
tableRow: u
|
|
2056
2056
|
}
|
|
2057
2057
|
};
|
|
2058
|
-
function n(
|
|
2059
|
-
return
|
|
2058
|
+
function n(y, h, x, g) {
|
|
2059
|
+
return s(f(y, x, g), y.align);
|
|
2060
2060
|
}
|
|
2061
|
-
function u(
|
|
2062
|
-
const b =
|
|
2061
|
+
function u(y, h, x, g) {
|
|
2062
|
+
const b = l(y, x, g), k = s([b]);
|
|
2063
2063
|
return k.slice(0, k.indexOf(`
|
|
2064
2064
|
`));
|
|
2065
2065
|
}
|
|
2066
|
-
function c(
|
|
2067
|
-
const b =
|
|
2066
|
+
function c(y, h, x, g) {
|
|
2067
|
+
const b = x.enter("tableCell"), k = x.enter("phrasing"), w = x.containerPhrasing(y, {
|
|
2068
2068
|
...g,
|
|
2069
2069
|
before: o,
|
|
2070
2070
|
after: o
|
|
2071
2071
|
});
|
|
2072
2072
|
return k(), b(), w;
|
|
2073
2073
|
}
|
|
2074
|
-
function
|
|
2075
|
-
return
|
|
2074
|
+
function s(y, h) {
|
|
2075
|
+
return Za(y, {
|
|
2076
2076
|
align: h,
|
|
2077
2077
|
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
2078
2078
|
alignDelimiters: a,
|
|
@@ -2082,47 +2082,47 @@ function $n(e) {
|
|
|
2082
2082
|
stringLength: i
|
|
2083
2083
|
});
|
|
2084
2084
|
}
|
|
2085
|
-
function f(
|
|
2086
|
-
const g =
|
|
2085
|
+
function f(y, h, x) {
|
|
2086
|
+
const g = y.children;
|
|
2087
2087
|
let b = -1;
|
|
2088
2088
|
const k = [], w = h.enter("table");
|
|
2089
2089
|
for (; ++b < g.length; )
|
|
2090
|
-
k[b] =
|
|
2090
|
+
k[b] = l(g[b], h, x);
|
|
2091
2091
|
return w(), k;
|
|
2092
2092
|
}
|
|
2093
|
-
function
|
|
2094
|
-
const g =
|
|
2093
|
+
function l(y, h, x) {
|
|
2094
|
+
const g = y.children;
|
|
2095
2095
|
let b = -1;
|
|
2096
2096
|
const k = [], w = h.enter("tableRow");
|
|
2097
2097
|
for (; ++b < g.length; )
|
|
2098
|
-
k[b] = c(g[b],
|
|
2098
|
+
k[b] = c(g[b], y, h, x);
|
|
2099
2099
|
return w(), k;
|
|
2100
2100
|
}
|
|
2101
|
-
function p(
|
|
2102
|
-
let g = Zt.inlineCode(
|
|
2103
|
-
return
|
|
2101
|
+
function p(y, h, x) {
|
|
2102
|
+
let g = Zt.inlineCode(y, h, x);
|
|
2103
|
+
return x.stack.includes("tableCell") && (g = g.replace(/\|/g, "\\$&")), g;
|
|
2104
2104
|
}
|
|
2105
2105
|
}
|
|
2106
|
-
function
|
|
2106
|
+
function Un() {
|
|
2107
2107
|
return {
|
|
2108
2108
|
exit: {
|
|
2109
2109
|
taskListCheckValueChecked: mt,
|
|
2110
2110
|
taskListCheckValueUnchecked: mt,
|
|
2111
|
-
paragraph:
|
|
2111
|
+
paragraph: Bn
|
|
2112
2112
|
}
|
|
2113
2113
|
};
|
|
2114
2114
|
}
|
|
2115
|
-
function
|
|
2115
|
+
function Wn() {
|
|
2116
2116
|
return {
|
|
2117
2117
|
unsafe: [{ atBreak: !0, character: "-", after: "[:|-]" }],
|
|
2118
|
-
handlers: { listItem:
|
|
2118
|
+
handlers: { listItem: Hn }
|
|
2119
2119
|
};
|
|
2120
2120
|
}
|
|
2121
2121
|
function mt(e) {
|
|
2122
2122
|
const r = this.stack[this.stack.length - 2];
|
|
2123
2123
|
r.type, r.checked = e.type === "taskListCheckValueChecked";
|
|
2124
2124
|
}
|
|
2125
|
-
function
|
|
2125
|
+
function Bn(e) {
|
|
2126
2126
|
const r = this.stack[this.stack.length - 2];
|
|
2127
2127
|
if (r && r.type === "listItem" && typeof r.checked == "boolean") {
|
|
2128
2128
|
const t = this.stack[this.stack.length - 1];
|
|
@@ -2143,35 +2143,35 @@ function Wn(e) {
|
|
|
2143
2143
|
}
|
|
2144
2144
|
this.exit(e);
|
|
2145
2145
|
}
|
|
2146
|
-
function
|
|
2146
|
+
function Hn(e, r, t, a) {
|
|
2147
2147
|
const i = e.children[0], o = typeof e.checked == "boolean" && i && i.type === "paragraph", n = "[" + (e.checked ? "x" : " ") + "] ", u = t.createTracker(a);
|
|
2148
2148
|
o && u.move(n);
|
|
2149
2149
|
let c = Zt.listItem(e, r, t, {
|
|
2150
2150
|
...a,
|
|
2151
2151
|
...u.current()
|
|
2152
2152
|
});
|
|
2153
|
-
return o && (c = c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,
|
|
2154
|
-
function
|
|
2153
|
+
return o && (c = c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, s)), c;
|
|
2154
|
+
function s(f) {
|
|
2155
2155
|
return f + n;
|
|
2156
2156
|
}
|
|
2157
2157
|
}
|
|
2158
|
-
function
|
|
2158
|
+
function qn() {
|
|
2159
2159
|
return [
|
|
2160
2160
|
xa(),
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2161
|
+
Oa(),
|
|
2162
|
+
Ha(),
|
|
2163
|
+
En(),
|
|
2164
|
+
Un()
|
|
2165
2165
|
];
|
|
2166
2166
|
}
|
|
2167
|
-
function
|
|
2167
|
+
function Vn(e) {
|
|
2168
2168
|
return {
|
|
2169
2169
|
extensions: [
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2170
|
+
ka(),
|
|
2171
|
+
Ua(e),
|
|
2172
|
+
qa(),
|
|
2173
|
+
On(e),
|
|
2174
|
+
Wn()
|
|
2175
2175
|
]
|
|
2176
2176
|
};
|
|
2177
2177
|
}
|
|
@@ -2201,7 +2201,7 @@ function Kn(e, r) {
|
|
|
2201
2201
|
for (n in o) {
|
|
2202
2202
|
pt.call(i, n) || (i[n] = []);
|
|
2203
2203
|
const u = o[n];
|
|
2204
|
-
|
|
2204
|
+
Gn(
|
|
2205
2205
|
// @ts-expect-error Looks like a list.
|
|
2206
2206
|
i[n],
|
|
2207
2207
|
Array.isArray(u) ? u : u ? [u] : []
|
|
@@ -2209,115 +2209,115 @@ function Kn(e, r) {
|
|
|
2209
2209
|
}
|
|
2210
2210
|
}
|
|
2211
2211
|
}
|
|
2212
|
-
function
|
|
2212
|
+
function Gn(e, r) {
|
|
2213
2213
|
let t = -1;
|
|
2214
2214
|
const a = [];
|
|
2215
2215
|
for (; ++t < r.length; )
|
|
2216
2216
|
(r[t].add === "after" ? e : a).push(r[t]);
|
|
2217
2217
|
be(e, 0, 0, a);
|
|
2218
2218
|
}
|
|
2219
|
-
const
|
|
2220
|
-
tokenize: ti,
|
|
2221
|
-
partial: !0
|
|
2222
|
-
}, Jt = {
|
|
2219
|
+
const Zn = {
|
|
2223
2220
|
tokenize: ri,
|
|
2224
2221
|
partial: !0
|
|
2225
|
-
},
|
|
2222
|
+
}, Jt = {
|
|
2226
2223
|
tokenize: ai,
|
|
2227
2224
|
partial: !0
|
|
2228
|
-
},
|
|
2225
|
+
}, Qt = {
|
|
2229
2226
|
tokenize: ni,
|
|
2230
2227
|
partial: !0
|
|
2231
|
-
},
|
|
2228
|
+
}, Yt = {
|
|
2232
2229
|
tokenize: ii,
|
|
2233
2230
|
partial: !0
|
|
2231
|
+
}, Jn = {
|
|
2232
|
+
tokenize: oi,
|
|
2233
|
+
partial: !0
|
|
2234
2234
|
}, er = {
|
|
2235
2235
|
name: "wwwAutolink",
|
|
2236
|
-
tokenize:
|
|
2236
|
+
tokenize: ei,
|
|
2237
2237
|
previous: rr
|
|
2238
2238
|
}, tr = {
|
|
2239
2239
|
name: "protocolAutolink",
|
|
2240
|
-
tokenize:
|
|
2240
|
+
tokenize: ti,
|
|
2241
2241
|
previous: ar
|
|
2242
2242
|
}, q = {
|
|
2243
2243
|
name: "emailAutolink",
|
|
2244
|
-
tokenize:
|
|
2244
|
+
tokenize: Yn,
|
|
2245
2245
|
previous: nr
|
|
2246
|
-
},
|
|
2247
|
-
function
|
|
2246
|
+
}, j = {};
|
|
2247
|
+
function Qn() {
|
|
2248
2248
|
return {
|
|
2249
|
-
text:
|
|
2249
|
+
text: j
|
|
2250
2250
|
};
|
|
2251
2251
|
}
|
|
2252
|
-
let
|
|
2253
|
-
for (;
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
function
|
|
2252
|
+
let X = 48;
|
|
2253
|
+
for (; X < 123; )
|
|
2254
|
+
j[X] = q, X++, X === 58 ? X = 65 : X === 91 && (X = 97);
|
|
2255
|
+
j[43] = q;
|
|
2256
|
+
j[45] = q;
|
|
2257
|
+
j[46] = q;
|
|
2258
|
+
j[95] = q;
|
|
2259
|
+
j[72] = [q, tr];
|
|
2260
|
+
j[104] = [q, tr];
|
|
2261
|
+
j[87] = [q, er];
|
|
2262
|
+
j[119] = [q, er];
|
|
2263
|
+
function Yn(e, r, t) {
|
|
2264
2264
|
const a = this;
|
|
2265
2265
|
let i, o;
|
|
2266
2266
|
return n;
|
|
2267
|
-
function n(
|
|
2268
|
-
return !Oe(
|
|
2267
|
+
function n(l) {
|
|
2268
|
+
return !Oe(l) || !nr.call(a, a.previous) || qe(a.events) ? t(l) : (e.enter("literalAutolink"), e.enter("literalAutolinkEmail"), u(l));
|
|
2269
2269
|
}
|
|
2270
|
-
function u(
|
|
2271
|
-
return Oe(
|
|
2270
|
+
function u(l) {
|
|
2271
|
+
return Oe(l) ? (e.consume(l), u) : l === 64 ? (e.consume(l), c) : t(l);
|
|
2272
2272
|
}
|
|
2273
|
-
function c(
|
|
2274
|
-
return
|
|
2273
|
+
function c(l) {
|
|
2274
|
+
return l === 46 ? e.check(Jn, f, s)(l) : l === 45 || l === 95 || We(l) ? (o = !0, e.consume(l), c) : f(l);
|
|
2275
2275
|
}
|
|
2276
|
-
function l
|
|
2277
|
-
return e.consume(
|
|
2276
|
+
function s(l) {
|
|
2277
|
+
return e.consume(l), i = !0, c;
|
|
2278
2278
|
}
|
|
2279
|
-
function f(
|
|
2280
|
-
return o && i && ue(a.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(
|
|
2279
|
+
function f(l) {
|
|
2280
|
+
return o && i && ue(a.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(l)) : t(l);
|
|
2281
2281
|
}
|
|
2282
2282
|
}
|
|
2283
|
-
function
|
|
2283
|
+
function ei(e, r, t) {
|
|
2284
2284
|
const a = this;
|
|
2285
2285
|
return i;
|
|
2286
2286
|
function i(n) {
|
|
2287
|
-
return n !== 87 && n !== 119 || !rr.call(a, a.previous) || qe(a.events) ? t(n) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(
|
|
2287
|
+
return n !== 87 && n !== 119 || !rr.call(a, a.previous) || qe(a.events) ? t(n) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(Zn, e.attempt(Jt, e.attempt(Qt, o), t), t)(n));
|
|
2288
2288
|
}
|
|
2289
2289
|
function o(n) {
|
|
2290
2290
|
return e.exit("literalAutolinkWww"), e.exit("literalAutolink"), r(n);
|
|
2291
2291
|
}
|
|
2292
2292
|
}
|
|
2293
|
-
function
|
|
2293
|
+
function ti(e, r, t) {
|
|
2294
2294
|
const a = this;
|
|
2295
2295
|
let i = "", o = !1;
|
|
2296
2296
|
return n;
|
|
2297
|
-
function n(
|
|
2298
|
-
return (
|
|
2297
|
+
function n(l) {
|
|
2298
|
+
return (l === 72 || l === 104) && ar.call(a, a.previous) && !qe(a.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), i += String.fromCodePoint(l), e.consume(l), u) : t(l);
|
|
2299
2299
|
}
|
|
2300
|
-
function u(
|
|
2301
|
-
if (ue(
|
|
2302
|
-
return i += String.fromCodePoint(
|
|
2303
|
-
if (
|
|
2300
|
+
function u(l) {
|
|
2301
|
+
if (ue(l) && i.length < 5)
|
|
2302
|
+
return i += String.fromCodePoint(l), e.consume(l), u;
|
|
2303
|
+
if (l === 58) {
|
|
2304
2304
|
const p = i.toLowerCase();
|
|
2305
2305
|
if (p === "http" || p === "https")
|
|
2306
|
-
return e.consume(
|
|
2306
|
+
return e.consume(l), c;
|
|
2307
2307
|
}
|
|
2308
|
-
return t(
|
|
2308
|
+
return t(l);
|
|
2309
2309
|
}
|
|
2310
|
-
function c(
|
|
2311
|
-
return
|
|
2310
|
+
function c(l) {
|
|
2311
|
+
return l === 47 ? (e.consume(l), o ? s : (o = !0, c)) : t(l);
|
|
2312
2312
|
}
|
|
2313
|
-
function l
|
|
2314
|
-
return
|
|
2313
|
+
function s(l) {
|
|
2314
|
+
return l === null || ia(l) || E(l) || K(l) || ke(l) ? t(l) : e.attempt(Jt, e.attempt(Qt, f), t)(l);
|
|
2315
2315
|
}
|
|
2316
|
-
function f(
|
|
2317
|
-
return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(
|
|
2316
|
+
function f(l) {
|
|
2317
|
+
return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(l);
|
|
2318
2318
|
}
|
|
2319
2319
|
}
|
|
2320
|
-
function
|
|
2320
|
+
function ri(e, r, t) {
|
|
2321
2321
|
let a = 0;
|
|
2322
2322
|
return i;
|
|
2323
2323
|
function i(n) {
|
|
@@ -2327,40 +2327,40 @@ function ti(e, r, t) {
|
|
|
2327
2327
|
return n === null ? t(n) : r(n);
|
|
2328
2328
|
}
|
|
2329
2329
|
}
|
|
2330
|
-
function
|
|
2330
|
+
function ai(e, r, t) {
|
|
2331
2331
|
let a, i, o;
|
|
2332
2332
|
return n;
|
|
2333
|
-
function n(
|
|
2334
|
-
return
|
|
2333
|
+
function n(s) {
|
|
2334
|
+
return s === 46 || s === 95 ? e.check(Yt, c, u)(s) : s === null || E(s) || K(s) || s !== 45 && ke(s) ? c(s) : (o = !0, e.consume(s), n);
|
|
2335
2335
|
}
|
|
2336
|
-
function u(
|
|
2337
|
-
return
|
|
2336
|
+
function u(s) {
|
|
2337
|
+
return s === 95 ? a = !0 : (i = a, a = void 0), e.consume(s), n;
|
|
2338
2338
|
}
|
|
2339
|
-
function c(
|
|
2340
|
-
return i || a || !o ? t(
|
|
2339
|
+
function c(s) {
|
|
2340
|
+
return i || a || !o ? t(s) : r(s);
|
|
2341
2341
|
}
|
|
2342
2342
|
}
|
|
2343
|
-
function
|
|
2343
|
+
function ni(e, r) {
|
|
2344
2344
|
let t = 0, a = 0;
|
|
2345
2345
|
return i;
|
|
2346
2346
|
function i(n) {
|
|
2347
|
-
return n === 40 ? (t++, e.consume(n), i) : n === 41 && a < t ? o(n) : n === 33 || n === 34 || n === 38 || n === 39 || n === 41 || n === 42 || n === 44 || n === 46 || n === 58 || n === 59 || n === 60 || n === 63 || n === 93 || n === 95 || n === 126 ? e.check(Yt, r, o)(n) : n === null ||
|
|
2347
|
+
return n === 40 ? (t++, e.consume(n), i) : n === 41 && a < t ? o(n) : n === 33 || n === 34 || n === 38 || n === 39 || n === 41 || n === 42 || n === 44 || n === 46 || n === 58 || n === 59 || n === 60 || n === 63 || n === 93 || n === 95 || n === 126 ? e.check(Yt, r, o)(n) : n === null || E(n) || K(n) ? r(n) : (e.consume(n), i);
|
|
2348
2348
|
}
|
|
2349
2349
|
function o(n) {
|
|
2350
2350
|
return n === 41 && a++, e.consume(n), i;
|
|
2351
2351
|
}
|
|
2352
2352
|
}
|
|
2353
|
-
function
|
|
2353
|
+
function ii(e, r, t) {
|
|
2354
2354
|
return a;
|
|
2355
2355
|
function a(u) {
|
|
2356
2356
|
return u === 33 || u === 34 || u === 39 || u === 41 || u === 42 || u === 44 || u === 46 || u === 58 || u === 59 || u === 63 || u === 95 || u === 126 ? (e.consume(u), a) : u === 38 ? (e.consume(u), o) : u === 93 ? (e.consume(u), i) : (
|
|
2357
2357
|
// `<` is an end.
|
|
2358
2358
|
u === 60 || // So is whitespace.
|
|
2359
|
-
u === null ||
|
|
2359
|
+
u === null || E(u) || K(u) ? r(u) : t(u)
|
|
2360
2360
|
);
|
|
2361
2361
|
}
|
|
2362
2362
|
function i(u) {
|
|
2363
|
-
return u === null || u === 40 || u === 91 ||
|
|
2363
|
+
return u === null || u === 40 || u === 91 || E(u) || K(u) ? r(u) : a(u);
|
|
2364
2364
|
}
|
|
2365
2365
|
function o(u) {
|
|
2366
2366
|
return ue(u) ? n(u) : t(u);
|
|
@@ -2369,7 +2369,7 @@ function ni(e, r, t) {
|
|
|
2369
2369
|
return u === 59 ? (e.consume(u), a) : ue(u) ? (e.consume(u), n) : t(u);
|
|
2370
2370
|
}
|
|
2371
2371
|
}
|
|
2372
|
-
function
|
|
2372
|
+
function oi(e, r, t) {
|
|
2373
2373
|
return a;
|
|
2374
2374
|
function a(o) {
|
|
2375
2375
|
return e.consume(o), i;
|
|
@@ -2379,7 +2379,7 @@ function ii(e, r, t) {
|
|
|
2379
2379
|
}
|
|
2380
2380
|
}
|
|
2381
2381
|
function rr(e) {
|
|
2382
|
-
return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 ||
|
|
2382
|
+
return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || E(e);
|
|
2383
2383
|
}
|
|
2384
2384
|
function ar(e) {
|
|
2385
2385
|
return !ue(e);
|
|
@@ -2405,7 +2405,7 @@ function qe(e) {
|
|
|
2405
2405
|
}
|
|
2406
2406
|
return e.length > 0 && !t && (e[e.length - 1][1]._gfmAutolinkLiteralWalkedInto = !0), t;
|
|
2407
2407
|
}
|
|
2408
|
-
function
|
|
2408
|
+
function ci(e, r, t) {
|
|
2409
2409
|
const a = [];
|
|
2410
2410
|
let i = -1;
|
|
2411
2411
|
for (; ++i < e.length; ) {
|
|
@@ -2425,11 +2425,11 @@ function B(e, r, t, a) {
|
|
|
2425
2425
|
return W(c) && o++ < i ? (e.consume(c), u) : (e.exit(t), r(c));
|
|
2426
2426
|
}
|
|
2427
2427
|
}
|
|
2428
|
-
const
|
|
2428
|
+
const ui = {
|
|
2429
2429
|
partial: !0,
|
|
2430
|
-
tokenize:
|
|
2430
|
+
tokenize: si
|
|
2431
2431
|
};
|
|
2432
|
-
function
|
|
2432
|
+
function si(e, r, t) {
|
|
2433
2433
|
return a;
|
|
2434
2434
|
function a(o) {
|
|
2435
2435
|
return W(o) ? B(e, i, "linePrefix")(o) : i(o);
|
|
@@ -2439,36 +2439,36 @@ function ui(e, r, t) {
|
|
|
2439
2439
|
}
|
|
2440
2440
|
}
|
|
2441
2441
|
const li = {
|
|
2442
|
-
tokenize:
|
|
2442
|
+
tokenize: yi,
|
|
2443
2443
|
partial: !0
|
|
2444
2444
|
};
|
|
2445
|
-
function
|
|
2445
|
+
function di() {
|
|
2446
2446
|
return {
|
|
2447
2447
|
document: {
|
|
2448
2448
|
91: {
|
|
2449
2449
|
name: "gfmFootnoteDefinition",
|
|
2450
|
-
tokenize:
|
|
2450
|
+
tokenize: pi,
|
|
2451
2451
|
continuation: {
|
|
2452
|
-
tokenize:
|
|
2452
|
+
tokenize: gi
|
|
2453
2453
|
},
|
|
2454
|
-
exit:
|
|
2454
|
+
exit: bi
|
|
2455
2455
|
}
|
|
2456
2456
|
},
|
|
2457
2457
|
text: {
|
|
2458
2458
|
91: {
|
|
2459
2459
|
name: "gfmFootnoteCall",
|
|
2460
|
-
tokenize:
|
|
2460
|
+
tokenize: mi
|
|
2461
2461
|
},
|
|
2462
2462
|
93: {
|
|
2463
2463
|
name: "gfmPotentialFootnoteCall",
|
|
2464
2464
|
add: "after",
|
|
2465
|
-
tokenize:
|
|
2466
|
-
resolveTo:
|
|
2465
|
+
tokenize: fi,
|
|
2466
|
+
resolveTo: hi
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
2469
|
};
|
|
2470
2470
|
}
|
|
2471
|
-
function
|
|
2471
|
+
function fi(e, r, t) {
|
|
2472
2472
|
const a = this;
|
|
2473
2473
|
let i = a.events.length;
|
|
2474
2474
|
const o = a.parser.gfmFootnotes || (a.parser.gfmFootnotes = []);
|
|
@@ -2486,14 +2486,14 @@ function di(e, r, t) {
|
|
|
2486
2486
|
function u(c) {
|
|
2487
2487
|
if (!n || !n._balanced)
|
|
2488
2488
|
return t(c);
|
|
2489
|
-
const
|
|
2489
|
+
const s = le(a.sliceSerialize({
|
|
2490
2490
|
start: n.end,
|
|
2491
2491
|
end: a.now()
|
|
2492
2492
|
}));
|
|
2493
|
-
return
|
|
2493
|
+
return s.codePointAt(0) !== 94 || !o.includes(s.slice(1)) ? t(c) : (e.enter("gfmFootnoteCallLabelMarker"), e.consume(c), e.exit("gfmFootnoteCallLabelMarker"), r(c));
|
|
2494
2494
|
}
|
|
2495
2495
|
}
|
|
2496
|
-
function
|
|
2496
|
+
function hi(e, r) {
|
|
2497
2497
|
let t = e.length;
|
|
2498
2498
|
for (; t--; )
|
|
2499
2499
|
if (e[t][1].type === "labelImage" && e[t][0] === "enter") {
|
|
@@ -2543,44 +2543,44 @@ function fi(e, r) {
|
|
|
2543
2543
|
];
|
|
2544
2544
|
return e.splice(t, e.length - t + 1, ...u), e;
|
|
2545
2545
|
}
|
|
2546
|
-
function
|
|
2546
|
+
function mi(e, r, t) {
|
|
2547
2547
|
const a = this, i = a.parser.gfmFootnotes || (a.parser.gfmFootnotes = []);
|
|
2548
2548
|
let o = 0, n;
|
|
2549
2549
|
return u;
|
|
2550
|
-
function u(
|
|
2551
|
-
return e.enter("gfmFootnoteCall"), e.enter("gfmFootnoteCallLabelMarker"), e.consume(
|
|
2550
|
+
function u(l) {
|
|
2551
|
+
return e.enter("gfmFootnoteCall"), e.enter("gfmFootnoteCallLabelMarker"), e.consume(l), e.exit("gfmFootnoteCallLabelMarker"), c;
|
|
2552
2552
|
}
|
|
2553
|
-
function c(
|
|
2554
|
-
return
|
|
2553
|
+
function c(l) {
|
|
2554
|
+
return l !== 94 ? t(l) : (e.enter("gfmFootnoteCallMarker"), e.consume(l), e.exit("gfmFootnoteCallMarker"), e.enter("gfmFootnoteCallString"), e.enter("chunkString").contentType = "string", s);
|
|
2555
2555
|
}
|
|
2556
|
-
function l
|
|
2556
|
+
function s(l) {
|
|
2557
2557
|
if (
|
|
2558
2558
|
// Too long.
|
|
2559
2559
|
o > 999 || // Closing brace with nothing.
|
|
2560
|
-
|
|
2560
|
+
l === 93 && !n || // Space or tab is not supported by GFM for some reason.
|
|
2561
2561
|
// `\n` and `[` not being supported makes sense.
|
|
2562
|
-
|
|
2562
|
+
l === null || l === 91 || E(l)
|
|
2563
2563
|
)
|
|
2564
|
-
return t(
|
|
2565
|
-
if (
|
|
2564
|
+
return t(l);
|
|
2565
|
+
if (l === 93) {
|
|
2566
2566
|
e.exit("chunkString");
|
|
2567
2567
|
const p = e.exit("gfmFootnoteCallString");
|
|
2568
|
-
return i.includes(
|
|
2568
|
+
return i.includes(le(a.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(l), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), r) : t(l);
|
|
2569
2569
|
}
|
|
2570
|
-
return
|
|
2570
|
+
return E(l) || (n = !0), o++, e.consume(l), l === 92 ? f : s;
|
|
2571
2571
|
}
|
|
2572
|
-
function f(
|
|
2573
|
-
return
|
|
2572
|
+
function f(l) {
|
|
2573
|
+
return l === 91 || l === 92 || l === 93 ? (e.consume(l), o++, s) : s(l);
|
|
2574
2574
|
}
|
|
2575
2575
|
}
|
|
2576
|
-
function
|
|
2576
|
+
function pi(e, r, t) {
|
|
2577
2577
|
const a = this, i = a.parser.gfmFootnotes || (a.parser.gfmFootnotes = []);
|
|
2578
2578
|
let o, n = 0, u;
|
|
2579
2579
|
return c;
|
|
2580
2580
|
function c(h) {
|
|
2581
|
-
return e.enter("gfmFootnoteDefinition")._container = !0, e.enter("gfmFootnoteDefinitionLabel"), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"),
|
|
2581
|
+
return e.enter("gfmFootnoteDefinition")._container = !0, e.enter("gfmFootnoteDefinitionLabel"), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"), s;
|
|
2582
2582
|
}
|
|
2583
|
-
function
|
|
2583
|
+
function s(h) {
|
|
2584
2584
|
return h === 94 ? (e.enter("gfmFootnoteDefinitionMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionMarker"), e.enter("gfmFootnoteDefinitionLabelString"), e.enter("chunkString").contentType = "string", f) : t(h);
|
|
2585
2585
|
}
|
|
2586
2586
|
function f(h) {
|
|
@@ -2589,33 +2589,33 @@ function mi(e, r, t) {
|
|
|
2589
2589
|
n > 999 || // Closing brace with nothing.
|
|
2590
2590
|
h === 93 && !u || // Space or tab is not supported by GFM for some reason.
|
|
2591
2591
|
// `\n` and `[` not being supported makes sense.
|
|
2592
|
-
h === null || h === 91 ||
|
|
2592
|
+
h === null || h === 91 || E(h)
|
|
2593
2593
|
)
|
|
2594
2594
|
return t(h);
|
|
2595
2595
|
if (h === 93) {
|
|
2596
2596
|
e.exit("chunkString");
|
|
2597
|
-
const
|
|
2598
|
-
return o =
|
|
2597
|
+
const x = e.exit("gfmFootnoteDefinitionLabelString");
|
|
2598
|
+
return o = le(a.sliceSerialize(x)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
|
|
2599
2599
|
}
|
|
2600
|
-
return
|
|
2600
|
+
return E(h) || (u = !0), n++, e.consume(h), h === 92 ? l : f;
|
|
2601
2601
|
}
|
|
2602
|
-
function
|
|
2602
|
+
function l(h) {
|
|
2603
2603
|
return h === 91 || h === 92 || h === 93 ? (e.consume(h), n++, f) : f(h);
|
|
2604
2604
|
}
|
|
2605
2605
|
function p(h) {
|
|
2606
|
-
return h === 58 ? (e.enter("definitionMarker"), e.consume(h), e.exit("definitionMarker"), i.includes(o) || i.push(o), B(e,
|
|
2606
|
+
return h === 58 ? (e.enter("definitionMarker"), e.consume(h), e.exit("definitionMarker"), i.includes(o) || i.push(o), B(e, y, "gfmFootnoteDefinitionWhitespace")) : t(h);
|
|
2607
2607
|
}
|
|
2608
|
-
function
|
|
2608
|
+
function y(h) {
|
|
2609
2609
|
return r(h);
|
|
2610
2610
|
}
|
|
2611
2611
|
}
|
|
2612
|
-
function
|
|
2613
|
-
return e.check(
|
|
2612
|
+
function gi(e, r, t) {
|
|
2613
|
+
return e.check(ui, r, e.attempt(li, r, t));
|
|
2614
2614
|
}
|
|
2615
|
-
function
|
|
2615
|
+
function bi(e) {
|
|
2616
2616
|
e.exit("gfmFootnoteDefinition");
|
|
2617
2617
|
}
|
|
2618
|
-
function
|
|
2618
|
+
function yi(e, r, t) {
|
|
2619
2619
|
const a = this;
|
|
2620
2620
|
return B(e, i, "gfmFootnoteDefinitionIndent", 5);
|
|
2621
2621
|
function i(o) {
|
|
@@ -2645,21 +2645,21 @@ function xi(e) {
|
|
|
2645
2645
|
let c = -1;
|
|
2646
2646
|
for (; ++c < n.length; )
|
|
2647
2647
|
if (n[c][0] === "enter" && n[c][1].type === "strikethroughSequenceTemporary" && n[c][1]._close) {
|
|
2648
|
-
let
|
|
2649
|
-
for (;
|
|
2650
|
-
if (n[
|
|
2651
|
-
n[c][1].end.offset - n[c][1].start.offset === n[
|
|
2652
|
-
n[c][1].type = "strikethroughSequence", n[
|
|
2648
|
+
let s = c;
|
|
2649
|
+
for (; s--; )
|
|
2650
|
+
if (n[s][0] === "exit" && n[s][1].type === "strikethroughSequenceTemporary" && n[s][1]._open && // If the sizes are the same:
|
|
2651
|
+
n[c][1].end.offset - n[c][1].start.offset === n[s][1].end.offset - n[s][1].start.offset) {
|
|
2652
|
+
n[c][1].type = "strikethroughSequence", n[s][1].type = "strikethroughSequence";
|
|
2653
2653
|
const f = {
|
|
2654
2654
|
type: "strikethrough",
|
|
2655
|
-
start: Object.assign({}, n[
|
|
2655
|
+
start: Object.assign({}, n[s][1].start),
|
|
2656
2656
|
end: Object.assign({}, n[c][1].end)
|
|
2657
|
-
},
|
|
2657
|
+
}, l = {
|
|
2658
2658
|
type: "strikethroughText",
|
|
2659
|
-
start: Object.assign({}, n[
|
|
2659
|
+
start: Object.assign({}, n[s][1].end),
|
|
2660
2660
|
end: Object.assign({}, n[c][1].start)
|
|
2661
|
-
}, p = [["enter", f, u], ["enter", n[
|
|
2662
|
-
|
|
2661
|
+
}, p = [["enter", f, u], ["enter", n[s][1], u], ["exit", n[s][1], u], ["enter", l, u]], y = u.parser.constructs.insideSpan.null;
|
|
2662
|
+
y && be(p, p.length, 0, ci(y, n.slice(s + 1, c), u)), be(p, p.length, 0, [["exit", l, u], ["enter", n[c][1], u], ["exit", n[c][1], u], ["exit", f, u]]), be(n, s - 1, c - s + 3, p), c = s + p.length - 2;
|
|
2663
2663
|
break;
|
|
2664
2664
|
}
|
|
2665
2665
|
}
|
|
@@ -2668,23 +2668,23 @@ function xi(e) {
|
|
|
2668
2668
|
return n;
|
|
2669
2669
|
}
|
|
2670
2670
|
function o(n, u, c) {
|
|
2671
|
-
const
|
|
2672
|
-
let
|
|
2671
|
+
const s = this.previous, f = this.events;
|
|
2672
|
+
let l = 0;
|
|
2673
2673
|
return p;
|
|
2674
2674
|
function p(h) {
|
|
2675
|
-
return
|
|
2675
|
+
return s === 126 && f[f.length - 1][1].type !== "characterEscape" ? c(h) : (n.enter("strikethroughSequenceTemporary"), y(h));
|
|
2676
2676
|
}
|
|
2677
|
-
function
|
|
2678
|
-
const
|
|
2677
|
+
function y(h) {
|
|
2678
|
+
const x = ye(s);
|
|
2679
2679
|
if (h === 126)
|
|
2680
|
-
return
|
|
2681
|
-
if (
|
|
2682
|
-
const g = n.exit("strikethroughSequenceTemporary"), b =
|
|
2683
|
-
return g._open = !b || b === 2 && !!
|
|
2680
|
+
return l > 1 ? c(h) : (n.consume(h), l++, y);
|
|
2681
|
+
if (l < 2 && !t) return c(h);
|
|
2682
|
+
const g = n.exit("strikethroughSequenceTemporary"), b = ye(h);
|
|
2683
|
+
return g._open = !b || b === 2 && !!x, g._close = !x || x === 2 && !!b, u(h);
|
|
2684
2684
|
}
|
|
2685
2685
|
}
|
|
2686
2686
|
}
|
|
2687
|
-
class
|
|
2687
|
+
class ki {
|
|
2688
2688
|
/**
|
|
2689
2689
|
* Create a new edit map.
|
|
2690
2690
|
*/
|
|
@@ -2700,7 +2700,7 @@ class yi {
|
|
|
2700
2700
|
* @returns {undefined}
|
|
2701
2701
|
*/
|
|
2702
2702
|
add(r, t, a) {
|
|
2703
|
-
|
|
2703
|
+
wi(this, r, t, a);
|
|
2704
2704
|
}
|
|
2705
2705
|
// To do: add this when moving to `micromark`.
|
|
2706
2706
|
// /**
|
|
@@ -2739,7 +2739,7 @@ class yi {
|
|
|
2739
2739
|
this.map.length = 0;
|
|
2740
2740
|
}
|
|
2741
2741
|
}
|
|
2742
|
-
function
|
|
2742
|
+
function wi(e, r, t, a) {
|
|
2743
2743
|
let i = 0;
|
|
2744
2744
|
if (!(t === 0 && a.length === 0)) {
|
|
2745
2745
|
for (; i < e.map.length; ) {
|
|
@@ -2752,7 +2752,7 @@ function ki(e, r, t, a) {
|
|
|
2752
2752
|
e.map.push([r, t, a]);
|
|
2753
2753
|
}
|
|
2754
2754
|
}
|
|
2755
|
-
function
|
|
2755
|
+
function vi(e, r) {
|
|
2756
2756
|
let t = !1;
|
|
2757
2757
|
const a = [];
|
|
2758
2758
|
for (; r < e.length; ) {
|
|
@@ -2777,49 +2777,49 @@ function Ci() {
|
|
|
2777
2777
|
flow: {
|
|
2778
2778
|
null: {
|
|
2779
2779
|
name: "table",
|
|
2780
|
-
tokenize:
|
|
2781
|
-
resolveAll:
|
|
2780
|
+
tokenize: Ti,
|
|
2781
|
+
resolveAll: Ai
|
|
2782
2782
|
}
|
|
2783
2783
|
}
|
|
2784
2784
|
};
|
|
2785
2785
|
}
|
|
2786
|
-
function
|
|
2786
|
+
function Ti(e, r, t) {
|
|
2787
2787
|
const a = this;
|
|
2788
2788
|
let i = 0, o = 0, n;
|
|
2789
2789
|
return u;
|
|
2790
2790
|
function u(m) {
|
|
2791
|
-
let
|
|
2792
|
-
for (;
|
|
2793
|
-
const O = a.events[
|
|
2791
|
+
let V = a.events.length - 1;
|
|
2792
|
+
for (; V > -1; ) {
|
|
2793
|
+
const O = a.events[V][1].type;
|
|
2794
2794
|
if (O === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
|
|
2795
|
-
O === "linePrefix")
|
|
2795
|
+
O === "linePrefix") V--;
|
|
2796
2796
|
else break;
|
|
2797
2797
|
}
|
|
2798
|
-
const $ =
|
|
2798
|
+
const $ = V > -1 ? a.events[V][1].type : null, G = $ === "tableHead" || $ === "tableRow" ? T : c;
|
|
2799
2799
|
return G === T && a.parser.lazy[a.now().line] ? t(m) : G(m);
|
|
2800
2800
|
}
|
|
2801
2801
|
function c(m) {
|
|
2802
|
-
return e.enter("tableHead"), e.enter("tableRow"),
|
|
2802
|
+
return e.enter("tableHead"), e.enter("tableRow"), s(m);
|
|
2803
2803
|
}
|
|
2804
|
-
function
|
|
2804
|
+
function s(m) {
|
|
2805
2805
|
return m === 124 || (n = !0, o += 1), f(m);
|
|
2806
2806
|
}
|
|
2807
2807
|
function f(m) {
|
|
2808
|
-
return m === null ? t(m) : Y(m) ? o > 1 ? (o = 0, a.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(m), e.exit("lineEnding"),
|
|
2808
|
+
return m === null ? t(m) : Y(m) ? o > 1 ? (o = 0, a.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(m), e.exit("lineEnding"), y) : t(m) : W(m) ? B(e, f, "whitespace")(m) : (o += 1, n && (n = !1, i += 1), m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), n = !0, f) : (e.enter("data"), l(m)));
|
|
2809
2809
|
}
|
|
2810
|
-
function
|
|
2811
|
-
return m === null || m === 124 ||
|
|
2810
|
+
function l(m) {
|
|
2811
|
+
return m === null || m === 124 || E(m) ? (e.exit("data"), f(m)) : (e.consume(m), m === 92 ? p : l);
|
|
2812
2812
|
}
|
|
2813
2813
|
function p(m) {
|
|
2814
|
-
return m === 92 || m === 124 ? (e.consume(m),
|
|
2814
|
+
return m === 92 || m === 124 ? (e.consume(m), l) : l(m);
|
|
2815
2815
|
}
|
|
2816
|
-
function
|
|
2816
|
+
function y(m) {
|
|
2817
2817
|
return a.interrupt = !1, a.parser.lazy[a.now().line] ? t(m) : (e.enter("tableDelimiterRow"), n = !1, W(m) ? B(e, h, "linePrefix", a.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(m) : h(m));
|
|
2818
2818
|
}
|
|
2819
2819
|
function h(m) {
|
|
2820
|
-
return m === 45 || m === 58 ? g(m) : m === 124 ? (n = !0, e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"),
|
|
2820
|
+
return m === 45 || m === 58 ? g(m) : m === 124 ? (n = !0, e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), x) : I(m);
|
|
2821
2821
|
}
|
|
2822
|
-
function
|
|
2822
|
+
function x(m) {
|
|
2823
2823
|
return W(m) ? B(e, g, "whitespace")(m) : g(m);
|
|
2824
2824
|
}
|
|
2825
2825
|
function g(m) {
|
|
@@ -2844,35 +2844,35 @@ function vi(e, r, t) {
|
|
|
2844
2844
|
return e.enter("tableRow"), S(m);
|
|
2845
2845
|
}
|
|
2846
2846
|
function S(m) {
|
|
2847
|
-
return m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), S) : m === null || Y(m) ? (e.exit("tableRow"), r(m)) : W(m) ? B(e, S, "whitespace")(m) : (e.enter("data"),
|
|
2847
|
+
return m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), S) : m === null || Y(m) ? (e.exit("tableRow"), r(m)) : W(m) ? B(e, S, "whitespace")(m) : (e.enter("data"), L(m));
|
|
2848
2848
|
}
|
|
2849
|
-
function
|
|
2850
|
-
return m === null || m === 124 ||
|
|
2849
|
+
function L(m) {
|
|
2850
|
+
return m === null || m === 124 || E(m) ? (e.exit("data"), S(m)) : (e.consume(m), m === 92 ? z : L);
|
|
2851
2851
|
}
|
|
2852
|
-
function
|
|
2853
|
-
return m === 92 || m === 124 ? (e.consume(m),
|
|
2852
|
+
function z(m) {
|
|
2853
|
+
return m === 92 || m === 124 ? (e.consume(m), L) : L(m);
|
|
2854
2854
|
}
|
|
2855
2855
|
}
|
|
2856
|
-
function
|
|
2857
|
-
let t = -1, a = !0, i = 0, o = [0, 0, 0, 0], n = [0, 0, 0, 0], u = !1, c = 0,
|
|
2858
|
-
const p = new
|
|
2856
|
+
function Ai(e, r) {
|
|
2857
|
+
let t = -1, a = !0, i = 0, o = [0, 0, 0, 0], n = [0, 0, 0, 0], u = !1, c = 0, s, f, l;
|
|
2858
|
+
const p = new ki();
|
|
2859
2859
|
for (; ++t < e.length; ) {
|
|
2860
|
-
const
|
|
2861
|
-
|
|
2860
|
+
const y = e[t], h = y[1];
|
|
2861
|
+
y[0] === "enter" ? h.type === "tableHead" ? (u = !1, c !== 0 && (gt(p, r, c, s, f), f = void 0, c = 0), s = {
|
|
2862
2862
|
type: "table",
|
|
2863
2863
|
start: Object.assign({}, h.start),
|
|
2864
2864
|
// Note: correct end is set later.
|
|
2865
2865
|
end: Object.assign({}, h.end)
|
|
2866
|
-
}, p.add(t, 0, [["enter",
|
|
2866
|
+
}, p.add(t, 0, [["enter", s, r]])) : h.type === "tableRow" || h.type === "tableDelimiterRow" ? (a = !0, l = void 0, o = [0, 0, 0, 0], n = [0, t + 1, 0, 0], u && (u = !1, f = {
|
|
2867
2867
|
type: "tableBody",
|
|
2868
2868
|
start: Object.assign({}, h.start),
|
|
2869
2869
|
// Note: correct end is set later.
|
|
2870
2870
|
end: Object.assign({}, h.end)
|
|
2871
|
-
}, 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") ? (a = !1, n[2] === 0 && (o[1] !== 0 && (n[0] = n[1],
|
|
2871
|
+
}, 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") ? (a = !1, n[2] === 0 && (o[1] !== 0 && (n[0] = n[1], l = ge(p, r, o, i, void 0, l), o = [0, 0, 0, 0]), n[2] = t)) : h.type === "tableCellDivider" && (a ? a = !1 : (o[1] !== 0 && (n[0] = n[1], l = ge(p, r, o, i, void 0, l)), o = n, n = [o[1], t, 0, 0])) : h.type === "tableHead" ? (u = !0, c = t) : h.type === "tableRow" || h.type === "tableDelimiterRow" ? (c = t, o[1] !== 0 ? (n[0] = n[1], l = ge(p, r, o, i, t, l)) : n[1] !== 0 && (l = ge(p, r, n, i, t, l)), i = 0) : i && (h.type === "data" || h.type === "tableDelimiterMarker" || h.type === "tableDelimiterFiller") && (n[3] = t);
|
|
2872
2872
|
}
|
|
2873
|
-
for (c !== 0 && gt(p, r, c,
|
|
2874
|
-
const
|
|
2875
|
-
|
|
2873
|
+
for (c !== 0 && gt(p, r, c, s, f), p.consume(r.events), t = -1; ++t < r.events.length; ) {
|
|
2874
|
+
const y = r.events[t];
|
|
2875
|
+
y[0] === "enter" && y[1].type === "table" && (y[1]._align = vi(r.events, t));
|
|
2876
2876
|
}
|
|
2877
2877
|
return e;
|
|
2878
2878
|
}
|
|
@@ -2886,19 +2886,19 @@ function ge(e, r, t, a, i, o) {
|
|
|
2886
2886
|
// Note: correct end is set later.
|
|
2887
2887
|
end: Object.assign({}, c)
|
|
2888
2888
|
}, e.add(t[1], 0, [["enter", o, r]]), t[2] !== 0) {
|
|
2889
|
-
const
|
|
2889
|
+
const s = Q(r.events, t[2]), f = Q(r.events, t[3]), l = {
|
|
2890
2890
|
type: u,
|
|
2891
|
-
start: Object.assign({},
|
|
2891
|
+
start: Object.assign({}, s),
|
|
2892
2892
|
end: Object.assign({}, f)
|
|
2893
2893
|
};
|
|
2894
|
-
if (e.add(t[2], 0, [["enter",
|
|
2895
|
-
const p = r.events[t[2]],
|
|
2896
|
-
if (p[1].end = Object.assign({},
|
|
2897
|
-
const h = t[2] + 1,
|
|
2898
|
-
e.add(h,
|
|
2894
|
+
if (e.add(t[2], 0, [["enter", l, r]]), a !== 2) {
|
|
2895
|
+
const p = r.events[t[2]], y = r.events[t[3]];
|
|
2896
|
+
if (p[1].end = Object.assign({}, y[1].end), p[1].type = "chunkText", p[1].contentType = "text", t[3] > t[2] + 1) {
|
|
2897
|
+
const h = t[2] + 1, x = t[3] - t[2] - 1;
|
|
2898
|
+
e.add(h, x, []);
|
|
2899
2899
|
}
|
|
2900
2900
|
}
|
|
2901
|
-
e.add(t[3] + 1, 0, [["exit",
|
|
2901
|
+
e.add(t[3] + 1, 0, [["exit", l, r]]);
|
|
2902
2902
|
}
|
|
2903
2903
|
return i !== void 0 && (o.end = Object.assign({}, Q(r.events, i)), e.add(i, 0, [["exit", o, r]]), o = void 0), o;
|
|
2904
2904
|
}
|
|
@@ -2910,18 +2910,18 @@ function Q(e, r) {
|
|
|
2910
2910
|
const t = e[r], a = t[0] === "enter" ? "start" : "end";
|
|
2911
2911
|
return t[1][a];
|
|
2912
2912
|
}
|
|
2913
|
-
const
|
|
2913
|
+
const Ni = {
|
|
2914
2914
|
name: "tasklistCheck",
|
|
2915
|
-
tokenize:
|
|
2915
|
+
tokenize: Si
|
|
2916
2916
|
};
|
|
2917
|
-
function
|
|
2917
|
+
function Ii() {
|
|
2918
2918
|
return {
|
|
2919
2919
|
text: {
|
|
2920
|
-
91:
|
|
2920
|
+
91: Ni
|
|
2921
2921
|
}
|
|
2922
2922
|
};
|
|
2923
2923
|
}
|
|
2924
|
-
function
|
|
2924
|
+
function Si(e, r, t) {
|
|
2925
2925
|
const a = this;
|
|
2926
2926
|
return i;
|
|
2927
2927
|
function i(c) {
|
|
@@ -2933,18 +2933,18 @@ function Ii(e, r, t) {
|
|
|
2933
2933
|
);
|
|
2934
2934
|
}
|
|
2935
2935
|
function o(c) {
|
|
2936
|
-
return
|
|
2936
|
+
return E(c) ? (e.enter("taskListCheckValueUnchecked"), e.consume(c), e.exit("taskListCheckValueUnchecked"), n) : c === 88 || c === 120 ? (e.enter("taskListCheckValueChecked"), e.consume(c), e.exit("taskListCheckValueChecked"), n) : t(c);
|
|
2937
2937
|
}
|
|
2938
2938
|
function n(c) {
|
|
2939
2939
|
return c === 93 ? (e.enter("taskListCheckMarker"), e.consume(c), e.exit("taskListCheckMarker"), e.exit("taskListCheck"), u) : t(c);
|
|
2940
2940
|
}
|
|
2941
2941
|
function u(c) {
|
|
2942
2942
|
return Y(c) ? r(c) : W(c) ? e.check({
|
|
2943
|
-
tokenize:
|
|
2943
|
+
tokenize: Li
|
|
2944
2944
|
}, r, t)(c) : t(c);
|
|
2945
2945
|
}
|
|
2946
2946
|
}
|
|
2947
|
-
function
|
|
2947
|
+
function Li(e, r, t) {
|
|
2948
2948
|
return B(e, a, "whitespace");
|
|
2949
2949
|
function a(i) {
|
|
2950
2950
|
return i === null ? t(i) : r(i);
|
|
@@ -2952,37 +2952,37 @@ function Si(e, r, t) {
|
|
|
2952
2952
|
}
|
|
2953
2953
|
function Mi(e) {
|
|
2954
2954
|
return Xn([
|
|
2955
|
-
|
|
2956
|
-
|
|
2955
|
+
Qn(),
|
|
2956
|
+
di(),
|
|
2957
2957
|
xi(e),
|
|
2958
2958
|
Ci(),
|
|
2959
|
-
|
|
2959
|
+
Ii()
|
|
2960
2960
|
]);
|
|
2961
2961
|
}
|
|
2962
|
-
const
|
|
2963
|
-
function
|
|
2962
|
+
const Di = {};
|
|
2963
|
+
function Ri(e) {
|
|
2964
2964
|
const r = (
|
|
2965
2965
|
/** @type {Processor<Root>} */
|
|
2966
2966
|
this
|
|
2967
|
-
), t = e ||
|
|
2968
|
-
i.push(Mi(t)), o.push(
|
|
2967
|
+
), t = e || Di, a = r.data(), i = a.micromarkExtensions || (a.micromarkExtensions = []), o = a.fromMarkdownExtensions || (a.fromMarkdownExtensions = []), n = a.toMarkdownExtensions || (a.toMarkdownExtensions = []);
|
|
2968
|
+
i.push(Mi(t)), o.push(qn()), n.push(Vn(t));
|
|
2969
2969
|
}
|
|
2970
|
-
function
|
|
2970
|
+
function M(...e) {
|
|
2971
2971
|
return e.filter(Boolean).join(" ");
|
|
2972
2972
|
}
|
|
2973
|
-
const
|
|
2974
|
-
|
|
2973
|
+
const Pi = ({ content: e }) => /* @__PURE__ */ d(
|
|
2974
|
+
Ar,
|
|
2975
2975
|
{
|
|
2976
|
-
remarkPlugins: [
|
|
2976
|
+
remarkPlugins: [Ri],
|
|
2977
2977
|
className: "cuadra-aui-md",
|
|
2978
|
-
components:
|
|
2978
|
+
components: Fi,
|
|
2979
2979
|
children: e
|
|
2980
2980
|
}
|
|
2981
|
-
), ir =
|
|
2982
|
-
const { isCopied: t, copyToClipboard: a } =
|
|
2983
|
-
return /* @__PURE__ */
|
|
2981
|
+
), ir = pr(Pi), Ei = ({ language: e, code: r }) => {
|
|
2982
|
+
const { isCopied: t, copyToClipboard: a } = _i();
|
|
2983
|
+
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: [
|
|
2984
2984
|
/* @__PURE__ */ d("span", { className: "cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand", children: e }),
|
|
2985
|
-
/* @__PURE__ */
|
|
2985
|
+
/* @__PURE__ */ v(
|
|
2986
2986
|
"button",
|
|
2987
2987
|
{
|
|
2988
2988
|
onClick: () => {
|
|
@@ -2991,13 +2991,13 @@ const Ri = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
2991
2991
|
className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-muted cuadra-transition-colors",
|
|
2992
2992
|
"aria-label": "Copy code",
|
|
2993
2993
|
children: [
|
|
2994
|
-
!t && /* @__PURE__ */ d(
|
|
2995
|
-
t && /* @__PURE__ */ d(
|
|
2994
|
+
!t && /* @__PURE__ */ d(Or, { className: "cuadra-h-4 cuadra-w-4" }),
|
|
2995
|
+
t && /* @__PURE__ */ d(_r, { className: "cuadra-h-4 cuadra-w-4" })
|
|
2996
2996
|
]
|
|
2997
2997
|
}
|
|
2998
2998
|
)
|
|
2999
2999
|
] });
|
|
3000
|
-
},
|
|
3000
|
+
}, _i = ({
|
|
3001
3001
|
copiedDuration: e = 3e3
|
|
3002
3002
|
} = {}) => {
|
|
3003
3003
|
const [r, t] = N(!1);
|
|
@@ -3006,18 +3006,18 @@ const Ri = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3006
3006
|
t(!0), setTimeout(() => t(!1), e);
|
|
3007
3007
|
});
|
|
3008
3008
|
} };
|
|
3009
|
-
},
|
|
3009
|
+
}, Fi = Cr({
|
|
3010
3010
|
h1: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3011
3011
|
"h1",
|
|
3012
3012
|
{
|
|
3013
|
-
className:
|
|
3013
|
+
className: M("cuadra-mb-6 cuadra-scroll-m-20 cuadra-text-2xl cuadra-font-normal cuadra-tracking-tight last:cuadra-mb-0 font-brand", e),
|
|
3014
3014
|
...r
|
|
3015
3015
|
}
|
|
3016
3016
|
),
|
|
3017
3017
|
h2: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3018
3018
|
"h2",
|
|
3019
3019
|
{
|
|
3020
|
-
className:
|
|
3020
|
+
className: M(
|
|
3021
3021
|
"cuadra-mb-4 cuadra-mt-6 cuadra-scroll-m-20 cuadra-text-xl cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",
|
|
3022
3022
|
e
|
|
3023
3023
|
),
|
|
@@ -3027,7 +3027,7 @@ const Ri = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3027
3027
|
h3: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3028
3028
|
"h3",
|
|
3029
3029
|
{
|
|
3030
|
-
className:
|
|
3030
|
+
className: M(
|
|
3031
3031
|
"cuadra-mb-3 cuadra-mt-5 cuadra-scroll-m-20 cuadra-text-lg cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",
|
|
3032
3032
|
e
|
|
3033
3033
|
),
|
|
@@ -3037,38 +3037,38 @@ const Ri = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3037
3037
|
h4: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3038
3038
|
"h4",
|
|
3039
3039
|
{
|
|
3040
|
-
className:
|
|
3040
|
+
className: M(
|
|
3041
3041
|
"cuadra-mb-4 cuadra-mt-6 cuadra-scroll-m-20 cuadra-text-xl cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",
|
|
3042
3042
|
e
|
|
3043
3043
|
),
|
|
3044
3044
|
...r
|
|
3045
3045
|
}
|
|
3046
3046
|
),
|
|
3047
|
-
h5: ({ className: e, ...r }) => /* @__PURE__ */ d("h5", { className:
|
|
3048
|
-
h6: ({ className: e, ...r }) => /* @__PURE__ */ d("h6", { className:
|
|
3049
|
-
p: ({ className: e, ...r }) => /* @__PURE__ */ d("p", { className:
|
|
3047
|
+
h5: ({ className: e, ...r }) => /* @__PURE__ */ d("h5", { className: M("cuadra-my-4 cuadra-text-lg cuadra-font-normal first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
|
|
3048
|
+
h6: ({ className: e, ...r }) => /* @__PURE__ */ d("h6", { className: M("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand", e), ...r }),
|
|
3049
|
+
p: ({ className: e, ...r }) => /* @__PURE__ */ d("p", { className: M("cuadra-mb-5 cuadra-mt-5 cuadra-leading-7 first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
|
|
3050
3050
|
a: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3051
3051
|
"a",
|
|
3052
3052
|
{
|
|
3053
|
-
className:
|
|
3053
|
+
className: M("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand", e),
|
|
3054
3054
|
...r
|
|
3055
3055
|
}
|
|
3056
3056
|
),
|
|
3057
|
-
blockquote: ({ className: e, ...r }) => /* @__PURE__ */ d("blockquote", { className:
|
|
3058
|
-
ul: ({ className: e, ...r }) => /* @__PURE__ */ d("ul", { className:
|
|
3059
|
-
ol: ({ className: e, ...r }) => /* @__PURE__ */ d("ol", { className:
|
|
3060
|
-
hr: ({ className: e, ...r }) => /* @__PURE__ */ d("hr", { className:
|
|
3057
|
+
blockquote: ({ className: e, ...r }) => /* @__PURE__ */ d("blockquote", { className: M("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand", e), ...r }),
|
|
3058
|
+
ul: ({ className: e, ...r }) => /* @__PURE__ */ d("ul", { className: M("cuadra-my-5 cuadra-ml-6 cuadra-list-disc [&>li]:cuadra-mt-2 font-brand", e), ...r }),
|
|
3059
|
+
ol: ({ className: e, ...r }) => /* @__PURE__ */ d("ol", { className: M("cuadra-my-5 cuadra-ml-6 cuadra-list-decimal [&>li]:cuadra-mt-2 font-brand", e), ...r }),
|
|
3060
|
+
hr: ({ className: e, ...r }) => /* @__PURE__ */ d("hr", { className: M("cuadra-my-5 cuadra-border-b", e), ...r }),
|
|
3061
3061
|
table: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3062
3062
|
"table",
|
|
3063
3063
|
{
|
|
3064
|
-
className:
|
|
3064
|
+
className: M("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand", e),
|
|
3065
3065
|
...r
|
|
3066
3066
|
}
|
|
3067
3067
|
),
|
|
3068
3068
|
th: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3069
3069
|
"th",
|
|
3070
3070
|
{
|
|
3071
|
-
className:
|
|
3071
|
+
className: M(
|
|
3072
3072
|
"cuadra-bg-muted cuadra-px-4 cuadra-py-2 cuadra-text-left cuadra-font-normal first:cuadra-rounded-tl-lg last:cuadra-rounded-tr-lg [&[align=center]]:cuadra-text-center [&[align=right]]:cuadra-text-right font-brand",
|
|
3073
3073
|
e
|
|
3074
3074
|
),
|
|
@@ -3078,7 +3078,7 @@ const Ri = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3078
3078
|
td: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3079
3079
|
"td",
|
|
3080
3080
|
{
|
|
3081
|
-
className:
|
|
3081
|
+
className: M(
|
|
3082
3082
|
"cuadra-border-b cuadra-border-l cuadra-px-4 cuadra-py-2 cuadra-text-left last:cuadra-border-r [&[align=center]]:cuadra-text-center [&[align=right]]:cuadra-text-right font-brand",
|
|
3083
3083
|
e
|
|
3084
3084
|
),
|
|
@@ -3088,18 +3088,18 @@ const Ri = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3088
3088
|
tr: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3089
3089
|
"tr",
|
|
3090
3090
|
{
|
|
3091
|
-
className:
|
|
3091
|
+
className: M(
|
|
3092
3092
|
"cuadra-m-0 cuadra-border-b cuadra-p-0 first:cuadra-border-t [&:last-child>td:first-child]:cuadra-rounded-bl-lg [&:last-child>td:last-child]:cuadra-rounded-br-lg",
|
|
3093
3093
|
e
|
|
3094
3094
|
),
|
|
3095
3095
|
...r
|
|
3096
3096
|
}
|
|
3097
3097
|
),
|
|
3098
|
-
sup: ({ className: e, ...r }) => /* @__PURE__ */ d("sup", { className:
|
|
3098
|
+
sup: ({ className: e, ...r }) => /* @__PURE__ */ d("sup", { className: M("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand", e), ...r }),
|
|
3099
3099
|
pre: ({ className: e, ...r }) => /* @__PURE__ */ d(
|
|
3100
3100
|
"pre",
|
|
3101
3101
|
{
|
|
3102
|
-
className:
|
|
3102
|
+
className: M(
|
|
3103
3103
|
"cuadra-overflow-x-auto cuadra-rounded-b-lg !cuadra-rounded-t-none cuadra-bg-muted cuadra-p-4 cuadra-text-foreground font-brand",
|
|
3104
3104
|
e
|
|
3105
3105
|
),
|
|
@@ -3107,16 +3107,16 @@ const Ri = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3107
3107
|
}
|
|
3108
3108
|
),
|
|
3109
3109
|
code: function({ className: r, ...t }) {
|
|
3110
|
-
const a =
|
|
3110
|
+
const a = Tr();
|
|
3111
3111
|
return /* @__PURE__ */ d(
|
|
3112
3112
|
"code",
|
|
3113
3113
|
{
|
|
3114
|
-
className:
|
|
3114
|
+
className: M(!a && "cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand", r),
|
|
3115
3115
|
...t
|
|
3116
3116
|
}
|
|
3117
3117
|
);
|
|
3118
3118
|
},
|
|
3119
|
-
CodeHeader:
|
|
3119
|
+
CodeHeader: Ei
|
|
3120
3120
|
}), bt = [
|
|
3121
3121
|
"Sending question…",
|
|
3122
3122
|
"Understanding your need…",
|
|
@@ -3124,7 +3124,7 @@ const Ri = ({ content: e }) => /* @__PURE__ */ d(
|
|
|
3124
3124
|
"Comparing results…",
|
|
3125
3125
|
"Composing answer…"
|
|
3126
3126
|
];
|
|
3127
|
-
function
|
|
3127
|
+
function ji({ active: e }) {
|
|
3128
3128
|
const [r, t] = N(0);
|
|
3129
3129
|
return P(() => {
|
|
3130
3130
|
if (!e) {
|
|
@@ -3135,12 +3135,12 @@ function Ei({ active: e }) {
|
|
|
3135
3135
|
t((i) => i >= bt.length - 1 ? (window.clearInterval(a), i) : i + 1);
|
|
3136
3136
|
}, 2500);
|
|
3137
3137
|
return () => window.clearInterval(a);
|
|
3138
|
-
}, [e]), e ? /* @__PURE__ */
|
|
3138
|
+
}, [e]), e ? /* @__PURE__ */ v("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-font-brand", children: [
|
|
3139
3139
|
"Thinking… ",
|
|
3140
3140
|
bt[r]
|
|
3141
3141
|
] }) : null;
|
|
3142
3142
|
}
|
|
3143
|
-
function
|
|
3143
|
+
function yt({
|
|
3144
3144
|
welcomeTitle: e = "Hi, how can I help you today?",
|
|
3145
3145
|
welcomeSubtitle: r = "Start exploring our platform and discover what you can build.",
|
|
3146
3146
|
extraTopPadding: t,
|
|
@@ -3148,29 +3148,29 @@ function xt({
|
|
|
3148
3148
|
inputPlaceholder: i = "Type your message...",
|
|
3149
3149
|
enableAttachments: o = !1
|
|
3150
3150
|
} = {}) {
|
|
3151
|
-
const n = xr(), [u, c] = N(!1), [
|
|
3151
|
+
const n = xr(), [u, c] = N(!1), [s, f] = N(null), [l, p] = N(!1);
|
|
3152
3152
|
return P(() => {
|
|
3153
3153
|
if (!n) {
|
|
3154
3154
|
c(!1);
|
|
3155
3155
|
return;
|
|
3156
3156
|
}
|
|
3157
3157
|
try {
|
|
3158
|
-
const
|
|
3159
|
-
if (!
|
|
3158
|
+
const y = n?.store;
|
|
3159
|
+
if (!y) {
|
|
3160
3160
|
c(!1);
|
|
3161
3161
|
return;
|
|
3162
3162
|
}
|
|
3163
|
-
const h =
|
|
3163
|
+
const h = y.subscribe?.((g) => {
|
|
3164
3164
|
const b = g?.threadId, k = g?.messages || [], w = g?.isLoadingHistory || !1, A = k.length;
|
|
3165
|
-
b && b !==
|
|
3165
|
+
b && b !== s && f(b), c(w && A === 0);
|
|
3166
3166
|
const T = k.some(
|
|
3167
|
-
(S) => S.role === "assistant" && !!S.content && (Array.isArray(S.content) ? S.content.some((
|
|
3167
|
+
(S) => S.role === "assistant" && !!S.content && (Array.isArray(S.content) ? S.content.some((L) => typeof L == "object" && L?.text ? L.text.trim().length > 0 : !1) : typeof S.content == "string" ? S.content.trim().length > 0 : !1)
|
|
3168
3168
|
);
|
|
3169
3169
|
p(T);
|
|
3170
|
-
}),
|
|
3171
|
-
if (
|
|
3172
|
-
const g =
|
|
3173
|
-
g && g !==
|
|
3170
|
+
}), x = y.getState?.();
|
|
3171
|
+
if (x) {
|
|
3172
|
+
const g = x?.threadId, b = x?.messages || [], k = x?.isLoadingHistory || !1, w = b.length;
|
|
3173
|
+
g && g !== s && f(g), c(k && w === 0);
|
|
3174
3174
|
const I = b.some(
|
|
3175
3175
|
(T) => T.role === "assistant" && !!T.content && (Array.isArray(T.content) ? T.content.some((S) => typeof S == "object" && S?.text ? S.text.trim().length > 0 : !1) : typeof T.content == "string" ? T.content.trim().length > 0 : !1)
|
|
3176
3176
|
);
|
|
@@ -3182,16 +3182,16 @@ function xt({
|
|
|
3182
3182
|
} catch {
|
|
3183
3183
|
c(!1);
|
|
3184
3184
|
}
|
|
3185
|
-
}, [n,
|
|
3185
|
+
}, [n, s]), /* @__PURE__ */ v(ne.Root, { className: "cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full", children: [
|
|
3186
3186
|
/* @__PURE__ */ d(
|
|
3187
3187
|
ne.Viewport,
|
|
3188
3188
|
{
|
|
3189
3189
|
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",
|
|
3190
3190
|
style: t ? { paddingTop: t } : void 0,
|
|
3191
|
-
children: u ? /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-inset-0 cuadra-flex cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */
|
|
3191
|
+
children: u ? /* @__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: [
|
|
3192
3192
|
/* @__PURE__ */ d(It, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }),
|
|
3193
3193
|
/* @__PURE__ */ d("p", { className: "cuadra-text-sm cuadra-text-muted-foreground font-brand", children: "Loading messages..." })
|
|
3194
|
-
] }) }) : /* @__PURE__ */
|
|
3194
|
+
] }) }) : /* @__PURE__ */ v(H, { children: [
|
|
3195
3195
|
/* @__PURE__ */ d(ne.Empty, { children: /* @__PURE__ */ d(
|
|
3196
3196
|
zi,
|
|
3197
3197
|
{
|
|
@@ -3204,25 +3204,25 @@ function xt({
|
|
|
3204
3204
|
ne.Messages,
|
|
3205
3205
|
{
|
|
3206
3206
|
components: {
|
|
3207
|
-
UserMessage:
|
|
3208
|
-
AssistantMessage:
|
|
3207
|
+
UserMessage: $i,
|
|
3208
|
+
AssistantMessage: Oi
|
|
3209
3209
|
}
|
|
3210
3210
|
}
|
|
3211
3211
|
),
|
|
3212
|
-
/* @__PURE__ */ d(ne.If, { running: !0, children: !
|
|
3212
|
+
/* @__PURE__ */ d(ne.If, { running: !0, children: !l && /* @__PURE__ */ d("div", { className: "cuadra-mt-2 cuadra-max-w-2xl", children: /* @__PURE__ */ d(ji, { active: !0 }) }) })
|
|
3213
3213
|
] })
|
|
3214
3214
|
}
|
|
3215
3215
|
),
|
|
3216
|
-
/* @__PURE__ */
|
|
3216
|
+
/* @__PURE__ */ v("div", { className: "cuadra-w-full cuadra-mt-3 cuadra-border-t cuadra-border-border cuadra-pt-4", children: [
|
|
3217
3217
|
o && /* @__PURE__ */ d(
|
|
3218
3218
|
ie.Attachments,
|
|
3219
3219
|
{
|
|
3220
3220
|
components: {
|
|
3221
3221
|
Attachment: () => {
|
|
3222
|
-
const
|
|
3223
|
-
return
|
|
3224
|
-
/* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-text-muted-foreground font-brand", children:
|
|
3225
|
-
/* @__PURE__ */ d(
|
|
3222
|
+
const y = At(({ attachment: h }) => h);
|
|
3223
|
+
return y ? /* @__PURE__ */ v("div", { className: "cuadra-relative cuadra-inline-flex cuadra-items-center cuadra-gap-2 cuadra-mb-2 cuadra-px-2 cuadra-py-1 cuadra-rounded-md cuadra-bg-muted cuadra-border cuadra-border-border", children: [
|
|
3224
|
+
/* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-text-muted-foreground font-brand", children: y.name || "Attachment" }),
|
|
3225
|
+
/* @__PURE__ */ d(kr.Remove, { asChild: !0, children: /* @__PURE__ */ d(
|
|
3226
3226
|
"button",
|
|
3227
3227
|
{
|
|
3228
3228
|
type: "button",
|
|
@@ -3236,7 +3236,7 @@ function xt({
|
|
|
3236
3236
|
}
|
|
3237
3237
|
}
|
|
3238
3238
|
),
|
|
3239
|
-
/* @__PURE__ */
|
|
3239
|
+
/* @__PURE__ */ v(ie.Root, { className: "cuadra-relative !cuadra-relative cuadra-flex-1 cuadra-w-full", children: [
|
|
3240
3240
|
/* @__PURE__ */ d(
|
|
3241
3241
|
ie.Input,
|
|
3242
3242
|
{
|
|
@@ -3246,7 +3246,7 @@ function xt({
|
|
|
3246
3246
|
{
|
|
3247
3247
|
rows: 3,
|
|
3248
3248
|
placeholder: i,
|
|
3249
|
-
className: "cuadra-flex cuadra-min-h-[80px] cuadra-w-full cuadra-rounded-md cuadra-border cuadra-border-border cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-base placeholder:cuadra-text-muted-foreground focus-visible:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 cuadra-resize-none font-brand",
|
|
3249
|
+
className: "cuadra-flex cuadra-min-h-[80px] cuadra-w-full cuadra-rounded-md cuadra-border cuadra-border-border cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-base cuadra-text-foreground placeholder:cuadra-text-muted-foreground focus-visible:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 cuadra-resize-none font-brand",
|
|
3250
3250
|
style: {
|
|
3251
3251
|
paddingRight: o ? "5rem" : "3rem",
|
|
3252
3252
|
fontSize: "1rem",
|
|
@@ -3290,7 +3290,7 @@ function xt({
|
|
|
3290
3290
|
},
|
|
3291
3291
|
"aria-label": "Send message",
|
|
3292
3292
|
type: "button",
|
|
3293
|
-
children: /* @__PURE__ */ d(
|
|
3293
|
+
children: /* @__PURE__ */ d(Pr, { className: "cuadra-h-4 cuadra-w-4" })
|
|
3294
3294
|
}
|
|
3295
3295
|
) })
|
|
3296
3296
|
] })
|
|
@@ -3298,14 +3298,14 @@ function xt({
|
|
|
3298
3298
|
] });
|
|
3299
3299
|
}
|
|
3300
3300
|
function zi({ title: e, subtitle: r, suggestions: t }) {
|
|
3301
|
-
const a =
|
|
3301
|
+
const a = wr(), i = async (o) => {
|
|
3302
3302
|
try {
|
|
3303
3303
|
a.composer().setText(o), await new Promise((n) => setTimeout(n, 10)), a.composer().send();
|
|
3304
3304
|
} catch {
|
|
3305
3305
|
}
|
|
3306
3306
|
};
|
|
3307
|
-
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__ */
|
|
3308
|
-
/* @__PURE__ */
|
|
3307
|
+
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: [
|
|
3308
|
+
/* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8", children: [
|
|
3309
3309
|
/* @__PURE__ */ d("h2", { className: "cuadra-text-lg cuadra-font-normal cuadra-text-foreground cuadra-mb-2 font-brand", children: e }),
|
|
3310
3310
|
/* @__PURE__ */ d("p", { className: "cuadra-text-muted-foreground font-brand", children: r })
|
|
3311
3311
|
] }),
|
|
@@ -3314,7 +3314,7 @@ function zi({ title: e, subtitle: r, suggestions: t }) {
|
|
|
3314
3314
|
{
|
|
3315
3315
|
type: "button",
|
|
3316
3316
|
onClick: () => i(o.prompt),
|
|
3317
|
-
className: "cuadra-w-full cuadra-text-center cuadra-px-4 cuadra-py-3 cuadra-rounded-lg cuadra-border cuadra-border-border cuadra-bg-background cuadra-text-sm font-brand cuadra-cursor-pointer focus:cuadra-outline-none focus:cuadra-ring-0",
|
|
3317
|
+
className: "cuadra-w-full cuadra-text-center cuadra-px-4 cuadra-py-3 cuadra-rounded-lg cuadra-border cuadra-border-border cuadra-bg-background cuadra-text-sm cuadra-text-foreground font-brand cuadra-cursor-pointer focus:cuadra-outline-none focus:cuadra-ring-0",
|
|
3318
3318
|
style: { borderWidth: "1px" },
|
|
3319
3319
|
children: o.prompt
|
|
3320
3320
|
},
|
|
@@ -3322,8 +3322,8 @@ function zi({ title: e, subtitle: r, suggestions: t }) {
|
|
|
3322
3322
|
)) })
|
|
3323
3323
|
] }) });
|
|
3324
3324
|
}
|
|
3325
|
-
function
|
|
3326
|
-
return /* @__PURE__ */
|
|
3325
|
+
function $i() {
|
|
3326
|
+
return /* @__PURE__ */ v(oe.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: [
|
|
3327
3327
|
/* @__PURE__ */ d(
|
|
3328
3328
|
oe.Attachments,
|
|
3329
3329
|
{
|
|
@@ -3340,7 +3340,7 @@ function ji() {
|
|
|
3340
3340
|
className: "cuadra-rounded-lg cuadra-border cuadra-border-border cuadra-max-h-64 cuadra-max-w-full cuadra-object-contain",
|
|
3341
3341
|
style: { borderWidth: "1px" }
|
|
3342
3342
|
}
|
|
3343
|
-
) : /* @__PURE__ */
|
|
3343
|
+
) : /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 cuadra-rounded-lg cuadra-border cuadra-border-border cuadra-bg-muted cuadra-px-3 cuadra-py-2", children: [
|
|
3344
3344
|
/* @__PURE__ */ d(St, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
|
|
3345
3345
|
/* @__PURE__ */ d("span", { className: "cuadra-text-sm cuadra-text-foreground font-brand", children: e.name || "Attachment" })
|
|
3346
3346
|
] }) });
|
|
@@ -3376,7 +3376,7 @@ function ji() {
|
|
|
3376
3376
|
)
|
|
3377
3377
|
] });
|
|
3378
3378
|
}
|
|
3379
|
-
function
|
|
3379
|
+
function Oi() {
|
|
3380
3380
|
return /* @__PURE__ */ d(oe.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(
|
|
3381
3381
|
"div",
|
|
3382
3382
|
{
|
|
@@ -3430,16 +3430,16 @@ const or = ({ className: e = "", theme: r = "system" }) => {
|
|
|
3430
3430
|
}
|
|
3431
3431
|
);
|
|
3432
3432
|
};
|
|
3433
|
-
function
|
|
3434
|
-
const r =
|
|
3435
|
-
if (!r?.remoteId || !
|
|
3433
|
+
function Ui({ onThreadSelect: e }) {
|
|
3434
|
+
const r = vt(), t = vr((g) => g.threadId), [a, i] = N(null), o = r?.id === t, n = a === r?.id, [u, c] = N(!1), [s, f] = N(r?.title || ""), [l, p] = N(!1), [y, h] = N(!1), x = async () => {
|
|
3435
|
+
if (!r?.remoteId || !s || s === r.title) {
|
|
3436
3436
|
c(!1);
|
|
3437
3437
|
return;
|
|
3438
3438
|
}
|
|
3439
3439
|
try {
|
|
3440
3440
|
h(!0);
|
|
3441
3441
|
const g = window.__cuadraThreadListAdapter;
|
|
3442
|
-
g && typeof g.rename == "function" && await g.rename(r.remoteId,
|
|
3442
|
+
g && typeof g.rename == "function" && await g.rename(r.remoteId, s), c(!1), p(!1);
|
|
3443
3443
|
} catch {
|
|
3444
3444
|
c(!1), p(!1);
|
|
3445
3445
|
} finally {
|
|
@@ -3449,14 +3449,14 @@ function Oi({ onThreadSelect: e }) {
|
|
|
3449
3449
|
return P(() => {
|
|
3450
3450
|
r?.title && !u && f(r.title);
|
|
3451
3451
|
}, [r?.title, u]), r ? /* @__PURE__ */ d(
|
|
3452
|
-
|
|
3452
|
+
Le.Root,
|
|
3453
3453
|
{
|
|
3454
3454
|
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"}`,
|
|
3455
3455
|
style: { marginBottom: "0.5rem" },
|
|
3456
3456
|
onMouseEnter: () => i(r.id),
|
|
3457
3457
|
onMouseLeave: () => i(null),
|
|
3458
|
-
children: /* @__PURE__ */
|
|
3459
|
-
|
|
3458
|
+
children: /* @__PURE__ */ v(
|
|
3459
|
+
Le.Trigger,
|
|
3460
3460
|
{
|
|
3461
3461
|
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",
|
|
3462
3462
|
onClick: () => e?.(),
|
|
@@ -3465,32 +3465,32 @@ function Oi({ onThreadSelect: e }) {
|
|
|
3465
3465
|
"input",
|
|
3466
3466
|
{
|
|
3467
3467
|
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",
|
|
3468
|
-
value:
|
|
3468
|
+
value: s,
|
|
3469
3469
|
onChange: (g) => f(g.target.value),
|
|
3470
3470
|
onKeyDown: (g) => {
|
|
3471
|
-
g.key === "Enter" &&
|
|
3471
|
+
g.key === "Enter" && x(), g.key === "Escape" && (c(!1), f(r.title || ""));
|
|
3472
3472
|
},
|
|
3473
|
-
disabled:
|
|
3473
|
+
disabled: y,
|
|
3474
3474
|
autoFocus: !0,
|
|
3475
3475
|
onClick: (g) => g.stopPropagation()
|
|
3476
3476
|
}
|
|
3477
|
-
) : /* @__PURE__ */
|
|
3477
|
+
) : /* @__PURE__ */ v(H, { children: [
|
|
3478
3478
|
/* @__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" }),
|
|
3479
3479
|
r.updatedAt && /* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-mt-1 font-brand", children: new Date(r.updatedAt).toLocaleDateString() })
|
|
3480
3480
|
] }) }),
|
|
3481
|
-
/* @__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: (n || o ||
|
|
3481
|
+
/* @__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: (n || o || l) && /* @__PURE__ */ v("div", { className: "cuadra-relative", children: [
|
|
3482
3482
|
/* @__PURE__ */ d(
|
|
3483
3483
|
"button",
|
|
3484
3484
|
{
|
|
3485
3485
|
className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-background/50 cuadra-transition-colors",
|
|
3486
3486
|
onClick: (g) => {
|
|
3487
|
-
g.stopPropagation(), p(!
|
|
3487
|
+
g.stopPropagation(), p(!l);
|
|
3488
3488
|
},
|
|
3489
3489
|
"aria-label": "Thread options",
|
|
3490
|
-
children: /* @__PURE__ */ d(
|
|
3490
|
+
children: /* @__PURE__ */ d(Wr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" })
|
|
3491
3491
|
}
|
|
3492
3492
|
),
|
|
3493
|
-
|
|
3493
|
+
l && /* @__PURE__ */ v(H, { children: [
|
|
3494
3494
|
/* @__PURE__ */ d(
|
|
3495
3495
|
"div",
|
|
3496
3496
|
{
|
|
@@ -3503,12 +3503,12 @@ function Oi({ onThreadSelect: e }) {
|
|
|
3503
3503
|
{
|
|
3504
3504
|
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",
|
|
3505
3505
|
onClick: (g) => {
|
|
3506
|
-
g.stopPropagation(),
|
|
3506
|
+
g.stopPropagation(), x();
|
|
3507
3507
|
},
|
|
3508
|
-
disabled:
|
|
3508
|
+
disabled: y,
|
|
3509
3509
|
children: "Save"
|
|
3510
3510
|
}
|
|
3511
|
-
) : /* @__PURE__ */
|
|
3511
|
+
) : /* @__PURE__ */ v(H, { children: [
|
|
3512
3512
|
/* @__PURE__ */ d(
|
|
3513
3513
|
"button",
|
|
3514
3514
|
{
|
|
@@ -3520,7 +3520,7 @@ function Oi({ onThreadSelect: e }) {
|
|
|
3520
3520
|
}
|
|
3521
3521
|
),
|
|
3522
3522
|
/* @__PURE__ */ d("div", { className: "cuadra-border-t cuadra-border-border" }),
|
|
3523
|
-
/* @__PURE__ */ d(
|
|
3523
|
+
/* @__PURE__ */ d(Le.Delete, { asChild: !0, children: /* @__PURE__ */ d(
|
|
3524
3524
|
"button",
|
|
3525
3525
|
{
|
|
3526
3526
|
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",
|
|
@@ -3539,13 +3539,13 @@ function Oi({ onThreadSelect: e }) {
|
|
|
3539
3539
|
}
|
|
3540
3540
|
) : null;
|
|
3541
3541
|
}
|
|
3542
|
-
function
|
|
3542
|
+
function xt({
|
|
3543
3543
|
onThreadSelect: e,
|
|
3544
3544
|
showThemeToggle: r,
|
|
3545
3545
|
theme: t,
|
|
3546
3546
|
onLogout: a
|
|
3547
3547
|
}) {
|
|
3548
|
-
return /* @__PURE__ */
|
|
3548
|
+
return /* @__PURE__ */ v(Se.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: [
|
|
3549
3549
|
/* @__PURE__ */ d("div", { className: "cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-end cuadra-transition-all cuadra-duration-300 cuadra-h-16 cuadra-px-4", children: /* @__PURE__ */ d(
|
|
3550
3550
|
"button",
|
|
3551
3551
|
{
|
|
@@ -3556,14 +3556,14 @@ function yt({
|
|
|
3556
3556
|
children: /* @__PURE__ */ d(Ue, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
|
|
3557
3557
|
}
|
|
3558
3558
|
) }),
|
|
3559
|
-
/* @__PURE__ */
|
|
3559
|
+
/* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin", children: [
|
|
3560
3560
|
/* @__PURE__ */ d(
|
|
3561
3561
|
Se.New,
|
|
3562
3562
|
{
|
|
3563
3563
|
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",
|
|
3564
3564
|
onClick: () => e?.(),
|
|
3565
|
-
children: /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-min-w-0", children: /* @__PURE__ */
|
|
3566
|
-
/* @__PURE__ */ d(
|
|
3565
|
+
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: [
|
|
3566
|
+
/* @__PURE__ */ d(Zr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
|
|
3567
3567
|
/* @__PURE__ */ d("h4", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground font-brand", children: "New Chat" })
|
|
3568
3568
|
] }) })
|
|
3569
3569
|
}
|
|
@@ -3573,12 +3573,12 @@ function yt({
|
|
|
3573
3573
|
Se.Items,
|
|
3574
3574
|
{
|
|
3575
3575
|
components: {
|
|
3576
|
-
ThreadListItem: (i) => /* @__PURE__ */ d(
|
|
3576
|
+
ThreadListItem: (i) => /* @__PURE__ */ d(Ui, { ...i, onThreadSelect: e })
|
|
3577
3577
|
}
|
|
3578
3578
|
}
|
|
3579
3579
|
)
|
|
3580
3580
|
] }),
|
|
3581
|
-
(r || a) && /* @__PURE__ */
|
|
3581
|
+
(r || a) && /* @__PURE__ */ v("div", { className: "cuadra-border-t cuadra-border-border cuadra-flex md:cuadra-hidden cuadra-items-center cuadra-justify-between cuadra-px-4 cuadra-py-4", children: [
|
|
3582
3582
|
a && /* @__PURE__ */ d(
|
|
3583
3583
|
"button",
|
|
3584
3584
|
{
|
|
@@ -3586,18 +3586,18 @@ function yt({
|
|
|
3586
3586
|
onClick: a,
|
|
3587
3587
|
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",
|
|
3588
3588
|
"aria-label": "Logout",
|
|
3589
|
-
children: /* @__PURE__ */ d(
|
|
3589
|
+
children: /* @__PURE__ */ d(qr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
|
|
3590
3590
|
}
|
|
3591
3591
|
),
|
|
3592
3592
|
r && /* @__PURE__ */ d(or, { theme: t })
|
|
3593
3593
|
] })
|
|
3594
3594
|
] });
|
|
3595
3595
|
}
|
|
3596
|
-
const
|
|
3596
|
+
const Wi = `
|
|
3597
3597
|
@keyframes rotate {
|
|
3598
3598
|
100% { transform: rotate(1turn); }
|
|
3599
3599
|
}
|
|
3600
|
-
`,
|
|
3600
|
+
`, Ee = ({
|
|
3601
3601
|
children: e,
|
|
3602
3602
|
className: r = "",
|
|
3603
3603
|
paddingX: t = "px-0",
|
|
@@ -3606,9 +3606,9 @@ const Ui = `
|
|
|
3606
3606
|
style: o,
|
|
3607
3607
|
contentStyle: n,
|
|
3608
3608
|
rotating: u = !1
|
|
3609
|
-
}) => /* @__PURE__ */
|
|
3610
|
-
/* @__PURE__ */ d("style", { children:
|
|
3611
|
-
/* @__PURE__ */
|
|
3609
|
+
}) => /* @__PURE__ */ v(H, { children: [
|
|
3610
|
+
/* @__PURE__ */ d("style", { children: Wi }),
|
|
3611
|
+
/* @__PURE__ */ v(
|
|
3612
3612
|
"div",
|
|
3613
3613
|
{
|
|
3614
3614
|
className: `cuadra-relative cuadra-bg-background md:cuadra-rounded-xl cuadra-overflow-hidden ${r}`,
|
|
@@ -3617,19 +3617,17 @@ const Ui = `
|
|
|
3617
3617
|
/* @__PURE__ */ d(
|
|
3618
3618
|
"div",
|
|
3619
3619
|
{
|
|
3620
|
-
className:
|
|
3620
|
+
className: `cuadra-absolute md:cuadra-rounded-xl cuadra-textured-card-border ${u ? "cuadra-textured-card-border-rotating" : ""}`,
|
|
3621
3621
|
style: u ? {
|
|
3622
3622
|
left: "-100%",
|
|
3623
3623
|
top: "-100%",
|
|
3624
3624
|
width: "300%",
|
|
3625
3625
|
height: "300%",
|
|
3626
|
-
backgroundImage: "conic-gradient(#F4633A, #FF7A4D, #FF8C5C, #F4633A, #FF7A4D, #FF8C5C)",
|
|
3627
3626
|
backgroundRepeat: "no-repeat",
|
|
3628
3627
|
backgroundSize: "cover",
|
|
3629
3628
|
backgroundPosition: "center",
|
|
3630
3629
|
animation: "rotate 4s linear infinite"
|
|
3631
3630
|
} : {
|
|
3632
|
-
backgroundImage: "linear-gradient(to right, #F4633A, #FF7A4D, #FF8C5C, #F4633A)",
|
|
3633
3631
|
backgroundSize: "cover",
|
|
3634
3632
|
backgroundPosition: "center",
|
|
3635
3633
|
backgroundRepeat: "no-repeat",
|
|
@@ -3664,23 +3662,23 @@ const Ui = `
|
|
|
3664
3662
|
showThemeToggle: n = !0,
|
|
3665
3663
|
theme: u = "system",
|
|
3666
3664
|
onMobileMenuClick: c,
|
|
3667
|
-
showMobileMenuButton:
|
|
3665
|
+
showMobileMenuButton: s = !1
|
|
3668
3666
|
}) => {
|
|
3669
|
-
const [f,
|
|
3667
|
+
const [f, l] = N(!1), [p, y] = N(!1), h = je(null);
|
|
3670
3668
|
P(() => {
|
|
3671
3669
|
const b = (k) => {
|
|
3672
|
-
h.current && !h.current.contains(k.target) &&
|
|
3670
|
+
h.current && !h.current.contains(k.target) && l(!1);
|
|
3673
3671
|
};
|
|
3674
3672
|
return f && document.addEventListener("mousedown", b), () => {
|
|
3675
3673
|
document.removeEventListener("mousedown", b);
|
|
3676
3674
|
};
|
|
3677
3675
|
}, [f]);
|
|
3678
|
-
const
|
|
3679
|
-
i(b),
|
|
3676
|
+
const x = r.find((b) => b.id === e), g = (b) => {
|
|
3677
|
+
i(b), l(!1), y(!1);
|
|
3680
3678
|
};
|
|
3681
|
-
return /* @__PURE__ */
|
|
3682
|
-
/* @__PURE__ */
|
|
3683
|
-
|
|
3679
|
+
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: [
|
|
3680
|
+
/* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
|
|
3681
|
+
s && /* @__PURE__ */ d(
|
|
3684
3682
|
"button",
|
|
3685
3683
|
{
|
|
3686
3684
|
type: "button",
|
|
@@ -3692,24 +3690,24 @@ const Ui = `
|
|
|
3692
3690
|
),
|
|
3693
3691
|
n && /* @__PURE__ */ d("div", { className: "cuadra-hidden md:cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d(or, { theme: u }) })
|
|
3694
3692
|
] }),
|
|
3695
|
-
/* @__PURE__ */
|
|
3693
|
+
/* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 md:cuadra-ml-0 cuadra-ml-auto", children: [
|
|
3696
3694
|
!o && /* @__PURE__ */ d("label", { className: "cuadra-hidden md:cuadra-inline cuadra-text-sm cuadra-text-muted-foreground cuadra-font-brand", children: "Model" }),
|
|
3697
|
-
o ? null : t ? /* @__PURE__ */ d("div", { className: "cuadra-w-48 cuadra-rounded-md cuadra-border cuadra-border-border cuadra-px-3 cuadra-py-2 cuadra-bg-muted", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading..." }) }) : a ? /* @__PURE__ */ d("div", { className: "cuadra-w-48 cuadra-rounded-md cuadra-border cuadra-border-destructive cuadra-px-3 cuadra-py-2 cuadra-bg-destructive/10", children: /* @__PURE__ */ d("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : /* @__PURE__ */
|
|
3698
|
-
/* @__PURE__ */
|
|
3699
|
-
/* @__PURE__ */
|
|
3695
|
+
o ? null : t ? /* @__PURE__ */ d("div", { className: "cuadra-w-48 cuadra-rounded-md cuadra-border cuadra-border-border cuadra-px-3 cuadra-py-2 cuadra-bg-muted", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading..." }) }) : a ? /* @__PURE__ */ d("div", { className: "cuadra-w-48 cuadra-rounded-md cuadra-border cuadra-border-destructive cuadra-px-3 cuadra-py-2 cuadra-bg-destructive/10", children: /* @__PURE__ */ d("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : /* @__PURE__ */ v(H, { children: [
|
|
3696
|
+
/* @__PURE__ */ v("div", { ref: h, className: "cuadra-hidden md:cuadra-block cuadra-relative cuadra-w-48", children: [
|
|
3697
|
+
/* @__PURE__ */ v(
|
|
3700
3698
|
"button",
|
|
3701
3699
|
{
|
|
3702
3700
|
type: "button",
|
|
3703
|
-
onClick: () =>
|
|
3701
|
+
onClick: () => l(!f),
|
|
3704
3702
|
disabled: t || r.length === 0 || !!a,
|
|
3705
3703
|
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",
|
|
3706
3704
|
children: [
|
|
3707
|
-
/* @__PURE__ */ d("span", { className:
|
|
3705
|
+
/* @__PURE__ */ d("span", { className: x ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: x?.name || "Select model" }),
|
|
3708
3706
|
/* @__PURE__ */ d(ot, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
|
|
3709
3707
|
]
|
|
3710
3708
|
}
|
|
3711
3709
|
),
|
|
3712
|
-
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((b) => /* @__PURE__ */
|
|
3710
|
+
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((b) => /* @__PURE__ */ v(
|
|
3713
3711
|
"button",
|
|
3714
3712
|
{
|
|
3715
3713
|
type: "button",
|
|
@@ -3741,43 +3739,43 @@ const Ui = `
|
|
|
3741
3739
|
b.id
|
|
3742
3740
|
)) }) })
|
|
3743
3741
|
] }),
|
|
3744
|
-
/* @__PURE__ */
|
|
3742
|
+
/* @__PURE__ */ v(
|
|
3745
3743
|
"button",
|
|
3746
3744
|
{
|
|
3747
3745
|
type: "button",
|
|
3748
|
-
onClick: () =>
|
|
3746
|
+
onClick: () => y(!0),
|
|
3749
3747
|
disabled: t || r.length === 0 || !!a,
|
|
3750
3748
|
className: "cuadra-flex md:cuadra-hidden cuadra-h-10 cuadra-w-full cuadra-items-center cuadra-justify-between cuadra-rounded-md cuadra-border cuadra-border-input cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-sm placeholder:cuadra-text-muted-foreground focus:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 cuadra-font-brand",
|
|
3751
3749
|
children: [
|
|
3752
|
-
/* @__PURE__ */ d("span", { className:
|
|
3750
|
+
/* @__PURE__ */ d("span", { className: x ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: x?.name || "Select model" }),
|
|
3753
3751
|
/* @__PURE__ */ d(ot, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
|
|
3754
3752
|
]
|
|
3755
3753
|
}
|
|
3756
3754
|
),
|
|
3757
|
-
p && typeof document < "u" &&
|
|
3758
|
-
/* @__PURE__ */
|
|
3755
|
+
p && typeof document < "u" && ze(
|
|
3756
|
+
/* @__PURE__ */ v(H, { children: [
|
|
3759
3757
|
/* @__PURE__ */ d(
|
|
3760
3758
|
"div",
|
|
3761
3759
|
{
|
|
3762
3760
|
className: "cuadra-fixed cuadra-inset-0 cuadra-bg-black/50 cuadra-z-50 md:cuadra-hidden",
|
|
3763
|
-
onClick: () =>
|
|
3761
|
+
onClick: () => y(!1)
|
|
3764
3762
|
}
|
|
3765
3763
|
),
|
|
3766
|
-
/* @__PURE__ */
|
|
3767
|
-
/* @__PURE__ */
|
|
3764
|
+
/* @__PURE__ */ v("div", { className: "cuadra-fixed cuadra-inset-0 cuadra-z-50 cuadra-flex cuadra-flex-col cuadra-bg-background md:cuadra-hidden", children: [
|
|
3765
|
+
/* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-between cuadra-border-b cuadra-border-border cuadra-px-4 cuadra-py-4", children: [
|
|
3768
3766
|
/* @__PURE__ */ d("h2", { className: "cuadra-text-lg cuadra-font-normal cuadra-text-foreground font-brand", children: "Select Model" }),
|
|
3769
3767
|
/* @__PURE__ */ d(
|
|
3770
3768
|
"button",
|
|
3771
3769
|
{
|
|
3772
3770
|
type: "button",
|
|
3773
|
-
onClick: () =>
|
|
3771
|
+
onClick: () => y(!1),
|
|
3774
3772
|
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",
|
|
3775
3773
|
"aria-label": "Close",
|
|
3776
3774
|
children: /* @__PURE__ */ d(Ue, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
|
|
3777
3775
|
}
|
|
3778
3776
|
)
|
|
3779
3777
|
] }),
|
|
3780
|
-
/* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-4", children: t ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading models..." }) }) : a ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : r.length === 0 ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "No models available" }) }) : /* @__PURE__ */ d("div", { className: "cuadra-space-y-2", children: r.map((b) => /* @__PURE__ */
|
|
3778
|
+
/* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-4", children: t ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading models..." }) }) : a ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : r.length === 0 ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "No models available" }) }) : /* @__PURE__ */ d("div", { className: "cuadra-space-y-2", children: r.map((b) => /* @__PURE__ */ v(
|
|
3781
3779
|
"button",
|
|
3782
3780
|
{
|
|
3783
3781
|
type: "button",
|
|
@@ -3816,8 +3814,8 @@ const Ui = `
|
|
|
3816
3814
|
] })
|
|
3817
3815
|
] })
|
|
3818
3816
|
] });
|
|
3819
|
-
},
|
|
3820
|
-
function
|
|
3817
|
+
}, Bi = gr(void 0), _e = ({ children: e, value: r }) => /* @__PURE__ */ d(Bi.Provider, { value: r, children: e });
|
|
3818
|
+
function Hi() {
|
|
3821
3819
|
P(() => {
|
|
3822
3820
|
if (document.querySelector("style[data-cuadra-uikit]"))
|
|
3823
3821
|
return;
|
|
@@ -3840,8 +3838,8 @@ function Bi() {
|
|
|
3840
3838
|
}, document.head.appendChild(a), o) break;
|
|
3841
3839
|
}, []);
|
|
3842
3840
|
}
|
|
3843
|
-
const
|
|
3844
|
-
|
|
3841
|
+
const qi = ({ config: e }) => {
|
|
3842
|
+
Hi();
|
|
3845
3843
|
const {
|
|
3846
3844
|
baseUrl: r,
|
|
3847
3845
|
proxyUrl: t,
|
|
@@ -3851,13 +3849,13 @@ const Hi = ({ config: e }) => {
|
|
|
3851
3849
|
modelId: n,
|
|
3852
3850
|
onModelChange: u,
|
|
3853
3851
|
ephemeral: c = !1,
|
|
3854
|
-
systemPrompt:
|
|
3852
|
+
systemPrompt: s,
|
|
3855
3853
|
initialThreadId: f,
|
|
3856
|
-
welcomeTitle:
|
|
3854
|
+
welcomeTitle: l,
|
|
3857
3855
|
welcomeSubtitle: p,
|
|
3858
|
-
extraTopPadding:
|
|
3856
|
+
extraTopPadding: y,
|
|
3859
3857
|
suggestions: h,
|
|
3860
|
-
inputPlaceholder:
|
|
3858
|
+
inputPlaceholder: x,
|
|
3861
3859
|
showThemeToggle: g = !0,
|
|
3862
3860
|
theme: b = "system",
|
|
3863
3861
|
onError: k,
|
|
@@ -3866,45 +3864,45 @@ const Hi = ({ config: e }) => {
|
|
|
3866
3864
|
onThreadIdUpdate: I,
|
|
3867
3865
|
onLogout: T,
|
|
3868
3866
|
enableAttachments: S = !1
|
|
3869
|
-
} = e, [
|
|
3870
|
-
if (
|
|
3867
|
+
} = e, [L, z] = N(!1), [m, V] = N(null), [$, G] = N(null), [O, Te] = N(!1), Ae = je(null), de = (C) => {
|
|
3868
|
+
if (C < 30) return !0;
|
|
3871
3869
|
if (Ae.current) {
|
|
3872
3870
|
const D = Ae.current.getBoundingClientRect();
|
|
3873
|
-
if (
|
|
3871
|
+
if (C - D.left < 30) return !0;
|
|
3874
3872
|
}
|
|
3875
3873
|
return !1;
|
|
3876
|
-
},
|
|
3877
|
-
const R =
|
|
3878
|
-
(de(R) ||
|
|
3879
|
-
},
|
|
3874
|
+
}, Ve = (C) => {
|
|
3875
|
+
const R = C.touches[0].clientX;
|
|
3876
|
+
(de(R) || L) && (V(R), G(R), Te(!0));
|
|
3877
|
+
}, Xe = (C) => {
|
|
3880
3878
|
if (m === null || !O) return;
|
|
3881
|
-
const D =
|
|
3879
|
+
const D = C.touches[0];
|
|
3882
3880
|
G(D.clientX);
|
|
3883
|
-
},
|
|
3881
|
+
}, Ke = () => {
|
|
3884
3882
|
if (m === null || $ === null) {
|
|
3885
3883
|
Te(!1);
|
|
3886
3884
|
return;
|
|
3887
3885
|
}
|
|
3888
|
-
const
|
|
3889
|
-
|
|
3890
|
-
},
|
|
3886
|
+
const C = $ - m, D = 50, R = 0.3, tt = Math.abs(C) / 300;
|
|
3887
|
+
C > D && !L && m !== null ? de(m) && z(!0) : ((C < -D || C < 0 && tt > R) && L || L && C < -20 && tt > R) && z(!1), V(null), G(null), Te(!1);
|
|
3888
|
+
}, ur = () => {
|
|
3891
3889
|
if (O && m !== null && $ !== null) {
|
|
3892
|
-
const
|
|
3893
|
-
if (
|
|
3894
|
-
return `translateX(${Math.min(0,
|
|
3890
|
+
const C = $ - m;
|
|
3891
|
+
if (L)
|
|
3892
|
+
return `translateX(${Math.min(0, C)}px)`;
|
|
3895
3893
|
if (m !== null && de(m))
|
|
3896
|
-
return `translateX(${Math.min(0, -320 +
|
|
3894
|
+
return `translateX(${Math.min(0, -320 + C)}px)`;
|
|
3897
3895
|
}
|
|
3898
|
-
return
|
|
3899
|
-
},
|
|
3896
|
+
return L ? "translateX(0)" : "translateX(-100%)";
|
|
3897
|
+
}, sr = () => {
|
|
3900
3898
|
if (!O || m === null || $ === null)
|
|
3901
|
-
return
|
|
3899
|
+
return L ? 0.5 : 0;
|
|
3902
3900
|
const D = $ - m;
|
|
3903
|
-
return
|
|
3904
|
-
}, fe = t || r || "", he = !!t, Ge =
|
|
3905
|
-
() => new
|
|
3901
|
+
return L ? Math.max(0, Math.min(1, (320 + D) / 320)) * 0.5 : m !== null && de(m) ? Math.max(0, Math.min(1, (D + 320) / 320)) * 0.5 : 0;
|
|
3902
|
+
}, fe = t || r || "", he = !!t, Ge = F(
|
|
3903
|
+
() => new Lt(fe, a || void 0, he),
|
|
3906
3904
|
[fe, a, he]
|
|
3907
|
-
), [Z, lr] = N(null), [te, Ze] = N(!1), [re, Je] = N(null), [
|
|
3905
|
+
), [Z, lr] = N(null), [te, Ze] = N(!1), [re, Je] = N(null), [dr, Qe] = N(!1);
|
|
3908
3906
|
P(() => {
|
|
3909
3907
|
i === "multiChat" && Qe(!0);
|
|
3910
3908
|
}, [i]);
|
|
@@ -3912,10 +3910,10 @@ const Hi = ({ config: e }) => {
|
|
|
3912
3910
|
if (o === "selector") {
|
|
3913
3911
|
Ze(!0), Je(null);
|
|
3914
3912
|
try {
|
|
3915
|
-
const
|
|
3916
|
-
lr(
|
|
3917
|
-
} catch (
|
|
3918
|
-
Je(
|
|
3913
|
+
const C = await Ge.listModels();
|
|
3914
|
+
lr(C);
|
|
3915
|
+
} catch (C) {
|
|
3916
|
+
Je(C instanceof Error ? C : new Error("Failed to load models"));
|
|
3919
3917
|
} finally {
|
|
3920
3918
|
Ze(!1);
|
|
3921
3919
|
}
|
|
@@ -3928,10 +3926,10 @@ const Hi = ({ config: e }) => {
|
|
|
3928
3926
|
}), [J]);
|
|
3929
3927
|
const [U, Ye] = N(
|
|
3930
3928
|
o === "fixed" && n || null
|
|
3931
|
-
), et =
|
|
3932
|
-
(
|
|
3929
|
+
), et = je(U), ae = ee(
|
|
3930
|
+
(C) => {
|
|
3933
3931
|
const D = et.current;
|
|
3934
|
-
Ye(
|
|
3932
|
+
Ye(C), et.current = C, u?.(C), D !== null && D !== C && i === "multiChat" && setTimeout(() => {
|
|
3935
3933
|
const R = window.__cuadraThreadListRuntime;
|
|
3936
3934
|
if (R?.threads?.switchToNewThread)
|
|
3937
3935
|
try {
|
|
@@ -3954,17 +3952,17 @@ const Hi = ({ config: e }) => {
|
|
|
3954
3952
|
);
|
|
3955
3953
|
P(() => {
|
|
3956
3954
|
if (o === "selector" && Z?.items && Z.items.length > 0 && !U) {
|
|
3957
|
-
const
|
|
3958
|
-
if (
|
|
3959
|
-
const D =
|
|
3955
|
+
const C = Z.items[0];
|
|
3956
|
+
if (C?.id) {
|
|
3957
|
+
const D = C.id;
|
|
3960
3958
|
Ye(D), u?.(D);
|
|
3961
3959
|
}
|
|
3962
3960
|
}
|
|
3963
3961
|
}, [o, Z?.items, U, u]);
|
|
3964
|
-
const
|
|
3965
|
-
() => (Z?.items || []).filter((
|
|
3962
|
+
const fr = o === "fixed" ? !!n : !!U, me = F(
|
|
3963
|
+
() => (Z?.items || []).filter((C) => C?.id && C?.displayName).map((C) => ({ id: C.id, name: C.displayName })),
|
|
3966
3964
|
[Z]
|
|
3967
|
-
), Ne =
|
|
3965
|
+
), Ne = F(
|
|
3968
3966
|
() => ({
|
|
3969
3967
|
currentModelId: U || "",
|
|
3970
3968
|
models: me,
|
|
@@ -3975,8 +3973,8 @@ const Hi = ({ config: e }) => {
|
|
|
3975
3973
|
}),
|
|
3976
3974
|
[U, me, te, re, ae, J]
|
|
3977
3975
|
);
|
|
3978
|
-
return o === "selector" && te || i === "multiChat" &&
|
|
3979
|
-
|
|
3976
|
+
return o === "selector" && te || i === "multiChat" && dr ? /* @__PURE__ */ d(_e, { value: Ne, children: /* @__PURE__ */ d(Ee, { 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(It, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }) }) }) }) : o === "selector" && !fr && re ? /* @__PURE__ */ d(_e, { value: Ne, children: /* @__PURE__ */ d(Ee, { 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(_e, { value: Ne, children: /* @__PURE__ */ d(
|
|
3977
|
+
ra,
|
|
3980
3978
|
{
|
|
3981
3979
|
baseUrl: he ? fe : r || fe,
|
|
3982
3980
|
sessionToken: a,
|
|
@@ -3986,7 +3984,7 @@ const Hi = ({ config: e }) => {
|
|
|
3986
3984
|
modelId: U || n || void 0,
|
|
3987
3985
|
onModelChange: ae,
|
|
3988
3986
|
ephemeral: c,
|
|
3989
|
-
systemPrompt:
|
|
3987
|
+
systemPrompt: s,
|
|
3990
3988
|
initialThreadId: f,
|
|
3991
3989
|
enableAttachments: S,
|
|
3992
3990
|
onError: k,
|
|
@@ -3997,7 +3995,7 @@ const Hi = ({ config: e }) => {
|
|
|
3997
3995
|
i === "multiChat" && Qe(!1);
|
|
3998
3996
|
},
|
|
3999
3997
|
children: /* @__PURE__ */ d(
|
|
4000
|
-
|
|
3998
|
+
Ee,
|
|
4001
3999
|
{
|
|
4002
4000
|
paddingX: "cuadra-px-0",
|
|
4003
4001
|
paddingY: "cuadra-py-0",
|
|
@@ -4009,31 +4007,31 @@ const Hi = ({ config: e }) => {
|
|
|
4009
4007
|
{
|
|
4010
4008
|
className: "cuadra-h-full cuadra-flex cuadra-relative",
|
|
4011
4009
|
style: { height: "100%" },
|
|
4012
|
-
onTouchStart:
|
|
4013
|
-
onTouchMove:
|
|
4014
|
-
onTouchEnd:
|
|
4015
|
-
children: i === "multiChat" ? /* @__PURE__ */
|
|
4016
|
-
typeof document < "u" &&
|
|
4010
|
+
onTouchStart: Ve,
|
|
4011
|
+
onTouchMove: Xe,
|
|
4012
|
+
onTouchEnd: Ke,
|
|
4013
|
+
children: i === "multiChat" ? /* @__PURE__ */ v(H, { children: [
|
|
4014
|
+
typeof document < "u" && ze(
|
|
4017
4015
|
/* @__PURE__ */ d(
|
|
4018
4016
|
"div",
|
|
4019
4017
|
{
|
|
4020
|
-
className: `cuadra-fixed cuadra-inset-0 cuadra-bg-black cuadra-z-40 md:cuadra-hidden cuadra-transition-opacity cuadra-duration-300 ${
|
|
4021
|
-
style: { opacity:
|
|
4022
|
-
onClick: () =>
|
|
4018
|
+
className: `cuadra-fixed cuadra-inset-0 cuadra-bg-black cuadra-z-40 md:cuadra-hidden cuadra-transition-opacity cuadra-duration-300 ${L || O ? "" : "cuadra-pointer-events-none"}`,
|
|
4019
|
+
style: { opacity: sr() },
|
|
4020
|
+
onClick: () => z(!1)
|
|
4023
4021
|
}
|
|
4024
4022
|
),
|
|
4025
4023
|
document.body
|
|
4026
4024
|
),
|
|
4027
|
-
typeof document < "u" && /* @__PURE__ */
|
|
4025
|
+
typeof document < "u" && /* @__PURE__ */ v(H, { children: [
|
|
4028
4026
|
/* @__PURE__ */ d(
|
|
4029
4027
|
"div",
|
|
4030
4028
|
{
|
|
4031
4029
|
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",
|
|
4032
4030
|
style: { borderRightWidth: "1px", height: "100%" },
|
|
4033
4031
|
children: /* @__PURE__ */ d(
|
|
4034
|
-
|
|
4032
|
+
xt,
|
|
4035
4033
|
{
|
|
4036
|
-
onThreadSelect: () =>
|
|
4034
|
+
onThreadSelect: () => z(!1),
|
|
4037
4035
|
showThemeToggle: g,
|
|
4038
4036
|
theme: b,
|
|
4039
4037
|
onLogout: T
|
|
@@ -4041,23 +4039,23 @@ const Hi = ({ config: e }) => {
|
|
|
4041
4039
|
)
|
|
4042
4040
|
}
|
|
4043
4041
|
),
|
|
4044
|
-
typeof document < "u" &&
|
|
4042
|
+
typeof document < "u" && ze(
|
|
4045
4043
|
/* @__PURE__ */ d(
|
|
4046
4044
|
"div",
|
|
4047
4045
|
{
|
|
4048
|
-
className: `cuadra-block md:cuadra-hidden !cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-h-screen cuadra-w-80 cuadra-fixed cuadra-z-50 cuadra-top-0 cuadra-left-0 ${
|
|
4046
|
+
className: `cuadra-block md:cuadra-hidden !cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-h-screen cuadra-w-80 cuadra-fixed cuadra-z-50 cuadra-top-0 cuadra-left-0 ${L || O ? "" : "cuadra-pointer-events-none"}`,
|
|
4049
4047
|
style: {
|
|
4050
4048
|
borderRightWidth: "1px",
|
|
4051
|
-
transform:
|
|
4049
|
+
transform: ur(),
|
|
4052
4050
|
transition: O ? "none" : "transform 0.3s ease-in-out"
|
|
4053
4051
|
},
|
|
4054
|
-
onTouchStart:
|
|
4055
|
-
onTouchMove:
|
|
4056
|
-
onTouchEnd:
|
|
4052
|
+
onTouchStart: Ve,
|
|
4053
|
+
onTouchMove: Xe,
|
|
4054
|
+
onTouchEnd: Ke,
|
|
4057
4055
|
children: /* @__PURE__ */ d(
|
|
4058
|
-
|
|
4056
|
+
xt,
|
|
4059
4057
|
{
|
|
4060
|
-
onThreadSelect: () =>
|
|
4058
|
+
onThreadSelect: () => z(!1),
|
|
4061
4059
|
showThemeToggle: g,
|
|
4062
4060
|
theme: b,
|
|
4063
4061
|
onLogout: T
|
|
@@ -4068,7 +4066,7 @@ const Hi = ({ config: e }) => {
|
|
|
4068
4066
|
document.body
|
|
4069
4067
|
)
|
|
4070
4068
|
] }),
|
|
4071
|
-
/* @__PURE__ */
|
|
4069
|
+
/* @__PURE__ */ v("div", { ref: Ae, className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
|
|
4072
4070
|
o === "selector" && /* @__PURE__ */ d(
|
|
4073
4071
|
kt,
|
|
4074
4072
|
{
|
|
@@ -4079,23 +4077,23 @@ const Hi = ({ config: e }) => {
|
|
|
4079
4077
|
onModelChange: ae,
|
|
4080
4078
|
showThemeToggle: g,
|
|
4081
4079
|
theme: b,
|
|
4082
|
-
onMobileMenuClick: () =>
|
|
4080
|
+
onMobileMenuClick: () => z(!L),
|
|
4083
4081
|
showMobileMenuButton: i === "multiChat"
|
|
4084
4082
|
}
|
|
4085
4083
|
),
|
|
4086
4084
|
/* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
|
|
4087
|
-
|
|
4085
|
+
yt,
|
|
4088
4086
|
{
|
|
4089
|
-
welcomeTitle:
|
|
4087
|
+
welcomeTitle: l,
|
|
4090
4088
|
welcomeSubtitle: p,
|
|
4091
|
-
extraTopPadding:
|
|
4089
|
+
extraTopPadding: y,
|
|
4092
4090
|
suggestions: h,
|
|
4093
|
-
inputPlaceholder:
|
|
4091
|
+
inputPlaceholder: x,
|
|
4094
4092
|
enableAttachments: S
|
|
4095
4093
|
}
|
|
4096
4094
|
) })
|
|
4097
4095
|
] })
|
|
4098
|
-
] }) : /* @__PURE__ */
|
|
4096
|
+
] }) : /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
|
|
4099
4097
|
o === "selector" && /* @__PURE__ */ d(
|
|
4100
4098
|
kt,
|
|
4101
4099
|
{
|
|
@@ -4109,13 +4107,13 @@ const Hi = ({ config: e }) => {
|
|
|
4109
4107
|
}
|
|
4110
4108
|
),
|
|
4111
4109
|
/* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
|
|
4112
|
-
|
|
4110
|
+
yt,
|
|
4113
4111
|
{
|
|
4114
|
-
welcomeTitle:
|
|
4112
|
+
welcomeTitle: l,
|
|
4115
4113
|
welcomeSubtitle: p,
|
|
4116
|
-
extraTopPadding:
|
|
4114
|
+
extraTopPadding: y,
|
|
4117
4115
|
suggestions: h,
|
|
4118
|
-
inputPlaceholder:
|
|
4116
|
+
inputPlaceholder: x
|
|
4119
4117
|
}
|
|
4120
4118
|
) })
|
|
4121
4119
|
] })
|
|
@@ -4126,7 +4124,73 @@ const Hi = ({ config: e }) => {
|
|
|
4126
4124
|
}
|
|
4127
4125
|
) }) });
|
|
4128
4126
|
};
|
|
4129
|
-
function
|
|
4127
|
+
function Vi(e, r = ":root") {
|
|
4128
|
+
if (typeof document > "u")
|
|
4129
|
+
return;
|
|
4130
|
+
const t = document.documentElement;
|
|
4131
|
+
if (e.light && Ki(e.light, t), e.dark) {
|
|
4132
|
+
let a = document.getElementById("cuadra-theme-dark");
|
|
4133
|
+
a || (a = document.createElement("style"), a.id = "cuadra-theme-dark", document.head.appendChild(a));
|
|
4134
|
+
const i = Gi(e.dark);
|
|
4135
|
+
a.textContent = `.dark { ${i} }`;
|
|
4136
|
+
}
|
|
4137
|
+
}
|
|
4138
|
+
const Xi = {
|
|
4139
|
+
background: "background",
|
|
4140
|
+
foreground: "foreground",
|
|
4141
|
+
card: "card",
|
|
4142
|
+
cardForeground: "card-foreground",
|
|
4143
|
+
popover: "popover",
|
|
4144
|
+
popoverForeground: "popover-foreground",
|
|
4145
|
+
primary: "primary",
|
|
4146
|
+
primaryForeground: "primary-foreground",
|
|
4147
|
+
primaryLight: "primary-light",
|
|
4148
|
+
primaryLighter: "primary-lighter",
|
|
4149
|
+
secondary: "secondary",
|
|
4150
|
+
secondaryForeground: "secondary-foreground",
|
|
4151
|
+
muted: "muted",
|
|
4152
|
+
mutedForeground: "muted-foreground",
|
|
4153
|
+
accent: "accent",
|
|
4154
|
+
accentForeground: "accent-foreground",
|
|
4155
|
+
border: "border",
|
|
4156
|
+
input: "input",
|
|
4157
|
+
ring: "ring",
|
|
4158
|
+
destructive: "destructive",
|
|
4159
|
+
destructiveForeground: "destructive-foreground",
|
|
4160
|
+
success: "success",
|
|
4161
|
+
successForeground: "success-foreground",
|
|
4162
|
+
info: "info",
|
|
4163
|
+
infoForeground: "info-foreground",
|
|
4164
|
+
warning: "warning",
|
|
4165
|
+
warningForeground: "warning-foreground"
|
|
4166
|
+
};
|
|
4167
|
+
function cr(e) {
|
|
4168
|
+
const r = Xi[e];
|
|
4169
|
+
return r ? `--cuadra-${r}` : `--cuadra-${e.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
|
|
4170
|
+
}
|
|
4171
|
+
function Ki(e, r) {
|
|
4172
|
+
Object.entries(e).forEach(([t, a]) => {
|
|
4173
|
+
if (a) {
|
|
4174
|
+
const i = cr(t);
|
|
4175
|
+
r.style.setProperty(i, a);
|
|
4176
|
+
}
|
|
4177
|
+
});
|
|
4178
|
+
}
|
|
4179
|
+
function Gi(e) {
|
|
4180
|
+
return Object.entries(e).map(([r, t]) => t ? `${cr(r)}: ${t};` : "").filter(Boolean).join(" ");
|
|
4181
|
+
}
|
|
4182
|
+
function ao() {
|
|
4183
|
+
if (typeof document > "u")
|
|
4184
|
+
return;
|
|
4185
|
+
const e = document.documentElement;
|
|
4186
|
+
Array.from(e.style).filter((a) => a.startsWith("--cuadra-")).forEach((a) => e.style.removeProperty(a));
|
|
4187
|
+
const t = document.getElementById("cuadra-theme-dark");
|
|
4188
|
+
t && t.remove();
|
|
4189
|
+
}
|
|
4190
|
+
function no(e) {
|
|
4191
|
+
P(() => {
|
|
4192
|
+
e.customTheme && Vi(e.customTheme);
|
|
4193
|
+
}, [e.customTheme]);
|
|
4130
4194
|
const r = {
|
|
4131
4195
|
baseUrl: e.baseUrl,
|
|
4132
4196
|
proxyUrl: e.proxyUrl,
|
|
@@ -4154,9 +4218,11 @@ function Qi(e) {
|
|
|
4154
4218
|
enableAttachments: e.enableAttachments,
|
|
4155
4219
|
containerClass: e.className
|
|
4156
4220
|
};
|
|
4157
|
-
return /* @__PURE__ */ d(
|
|
4221
|
+
return /* @__PURE__ */ d(qi, { config: r });
|
|
4158
4222
|
}
|
|
4159
4223
|
export {
|
|
4160
|
-
|
|
4224
|
+
no as CuadraChat,
|
|
4225
|
+
Vi as applyTheme,
|
|
4226
|
+
ao as removeTheme
|
|
4161
4227
|
};
|
|
4162
4228
|
//# sourceMappingURL=index.mjs.map
|