@cuadra-ai/uikit 0.1.12 → 0.1.14

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/index.mjs CHANGED
@@ -1,23 +1,23 @@
1
- var jt = Object.defineProperty;
2
- var $t = (e, r, t) => r in e ? jt(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
- var le = (e, r, t) => $t(e, typeof r != "symbol" ? r + "" : r, t);
4
- import { jsx as h, jsxs as v, Fragment as B } from "react/jsx-runtime";
5
- import { forwardRef as tt, createElement as Ne, useMemo as W, useState as N, useEffect as M, useCallback as te, memo as Ot, useRef as rt, createContext as Ut } from "react";
6
- import { createPortal as $e } from "react-dom";
7
- import { useLocalRuntime as nt, AssistantRuntimeProvider as at, unstable_useRemoteThreadListRuntime as Bt, useThreadRuntime as Wt, ThreadPrimitive as ee, ComposerPrimitive as ke, useAssistantApi as Ht, MessagePrimitive as se, ThreadListPrimitive as xe, useThreadListItem as qt, useThread as Kt, ThreadListItemPrimitive as we } from "@assistant-ui/react";
8
- import { unstable_memoizeMarkdownComponents as Vt, useIsMarkdownCodeBlock as Gt, MarkdownTextPrimitive as Zt } from "@assistant-ui/react-markdown";
9
- const Jt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Qt = (e) => e.replace(
1
+ var Ut = Object.defineProperty;
2
+ var Bt = (e, r, t) => r in e ? Ut(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var le = (e, r, t) => Bt(e, typeof r != "symbol" ? r + "" : r, t);
4
+ import { jsx as d, Fragment as U, jsxs as T } from "react/jsx-runtime";
5
+ import $e, { forwardRef as rt, createElement as Ne, useMemo as B, useState as I, useEffect as L, useCallback as J, memo as Wt, useRef as nt, createContext as Ht } from "react";
6
+ import { createPortal as Oe } from "react-dom";
7
+ import { useThreadListItem as at, RuntimeAdapterProvider as qt, useLocalRuntime as it, AssistantRuntimeProvider as ot, unstable_useRemoteThreadListRuntime as Kt, useThreadRuntime as Vt, ThreadPrimitive as te, ComposerPrimitive as ke, useAssistantApi as Gt, MessagePrimitive as se, ThreadListPrimitive as xe, useThread as Zt, ThreadListItemPrimitive as we } from "@assistant-ui/react";
8
+ import { unstable_memoizeMarkdownComponents as Jt, useIsMarkdownCodeBlock as Qt, MarkdownTextPrimitive as Xt } from "@assistant-ui/react-markdown";
9
+ const Yt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), er = (e) => e.replace(
10
10
  /^([A-Z])|[\s-_]+(\w)/g,
11
11
  (r, t, n) => n ? n.toUpperCase() : t.toLowerCase()
12
- ), Oe = (e) => {
13
- const r = Qt(e);
12
+ ), Ue = (e) => {
13
+ const r = er(e);
14
14
  return r.charAt(0).toUpperCase() + r.slice(1);
15
- }, it = (...e) => e.filter((r, t, n) => !!r && r.trim() !== "" && n.indexOf(r) === t).join(" ").trim(), Xt = (e) => {
15
+ }, lt = (...e) => e.filter((r, t, n) => !!r && r.trim() !== "" && n.indexOf(r) === t).join(" ").trim(), tr = (e) => {
16
16
  for (const r in e)
17
17
  if (r.startsWith("aria-") || r === "role" || r === "title")
18
18
  return !0;
19
19
  };
20
- var Yt = {
20
+ var rr = {
21
21
  xmlns: "http://www.w3.org/2000/svg",
22
22
  width: 24,
23
23
  height: 24,
@@ -28,7 +28,7 @@ var Yt = {
28
28
  strokeLinecap: "round",
29
29
  strokeLinejoin: "round"
30
30
  };
31
- const er = tt(
31
+ const nr = rt(
32
32
  ({
33
33
  color: e = "currentColor",
34
34
  size: r = 24,
@@ -42,66 +42,66 @@ const er = tt(
42
42
  "svg",
43
43
  {
44
44
  ref: l,
45
- ...Yt,
45
+ ...rr,
46
46
  width: r,
47
47
  height: r,
48
48
  stroke: e,
49
49
  strokeWidth: n ? Number(t) * 24 / Number(r) : t,
50
- className: it("lucide", i),
51
- ...!o && !Xt(u) && { "aria-hidden": "true" },
50
+ className: lt("lucide", i),
51
+ ...!o && !tr(u) && { "aria-hidden": "true" },
52
52
  ...u
53
53
  },
54
54
  [
55
- ...a.map(([c, d]) => Ne(c, d)),
55
+ ...a.map(([c, f]) => Ne(c, f)),
56
56
  ...Array.isArray(o) ? o : [o]
57
57
  ]
58
58
  )
59
59
  );
60
60
  const j = (e, r) => {
61
- const t = tt(
62
- ({ className: n, ...i }, o) => Ne(er, {
61
+ const t = rt(
62
+ ({ className: n, ...i }, o) => Ne(nr, {
63
63
  ref: o,
64
64
  iconNode: r,
65
- className: it(
66
- `lucide-${Jt(Oe(e))}`,
65
+ className: lt(
66
+ `lucide-${Yt(Ue(e))}`,
67
67
  `lucide-${e}`,
68
68
  n
69
69
  ),
70
70
  ...i
71
71
  })
72
72
  );
73
- return t.displayName = Oe(e), t;
73
+ return t.displayName = Ue(e), t;
74
74
  };
75
- const tr = [
75
+ const ar = [
76
76
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
77
77
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
78
- ], rr = j("arrow-up", tr);
79
- const nr = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], ar = j("check", nr);
80
- const ir = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], or = j("chevron-down", ir);
81
- const lr = [
78
+ ], ir = j("arrow-up", ar);
79
+ const or = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], lr = j("check", or);
80
+ const ur = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], cr = j("chevron-down", ur);
81
+ const sr = [
82
82
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
83
83
  ["path", { d: "M12 18a6 6 0 0 0 0-12v12z", key: "j4l70d" }]
84
- ], ur = j("contrast", lr);
85
- const cr = [
84
+ ], dr = j("contrast", sr);
85
+ const fr = [
86
86
  ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
87
87
  ["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" }]
88
- ], sr = j("copy", cr);
89
- const dr = [
88
+ ], hr = j("copy", fr);
89
+ const mr = [
90
90
  ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
91
91
  ["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
92
92
  ["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
93
- ], fr = j("ellipsis-vertical", dr);
94
- const hr = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], ot = j("loader-circle", hr);
95
- const mr = [
93
+ ], pr = j("ellipsis-vertical", mr);
94
+ const gr = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], ut = j("loader-circle", gr);
95
+ const br = [
96
96
  ["path", { d: "M4 5h16", key: "1tepv9" }],
97
97
  ["path", { d: "M4 12h16", key: "1lakjw" }],
98
98
  ["path", { d: "M4 19h16", key: "1djgab" }]
99
- ], pr = j("menu", mr);
100
- const gr = [
99
+ ], kr = j("menu", br);
100
+ const xr = [
101
101
  ["path", { d: "M5 12h14", key: "1ays0h" }],
102
102
  ["path", { d: "M12 5v14", key: "s699le" }]
103
- ], br = j("plus", gr);
104
- class lt {
103
+ ], wr = j("plus", xr);
104
+ class ct {
105
105
  constructor(r, t, n = !1) {
106
106
  le(this, "baseUrl");
107
107
  le(this, "sessionToken", null);
@@ -224,12 +224,12 @@ class lt {
224
224
  body: JSON.stringify(t)
225
225
  });
226
226
  if (!l.ok) {
227
- const d = await l.text();
227
+ const f = await l.text();
228
228
  let s = {};
229
229
  try {
230
- s = JSON.parse(d);
230
+ s = JSON.parse(f);
231
231
  } catch {
232
- s = { detail: d };
232
+ s = { detail: f };
233
233
  }
234
234
  throw new Error(
235
235
  s.detail || s.message || `API error: ${l.status} ${l.statusText}`
@@ -311,7 +311,7 @@ class lt {
311
311
  return i.json();
312
312
  }
313
313
  }
314
- async function* kr(e, r) {
314
+ async function* yr(e, r) {
315
315
  const t = e.getReader(), n = new TextDecoder();
316
316
  let i = "";
317
317
  try {
@@ -344,7 +344,7 @@ async function* kr(e, r) {
344
344
  t.releaseLock();
345
345
  }
346
346
  }
347
- function xr(e) {
347
+ function Cr(e) {
348
348
  return e.map((r) => {
349
349
  let t = "";
350
350
  if (typeof r.content == "string")
@@ -359,55 +359,83 @@ function xr(e) {
359
359
  };
360
360
  });
361
361
  }
362
- function wr(e, r) {
363
- const { modelId: t, systemPrompt: n, ephemeral: i, onChatCreated: o, onUserMessage: a } = r;
364
- let u = null;
362
+ function vr(e) {
365
363
  return {
366
- async *run(l) {
367
- const { messages: c, abortSignal: d } = l;
368
- if (c.length > 0) {
369
- const g = c[c.length - 1], x = g.role, w = g.id;
370
- x === "user" && w !== u && (u = w, a?.());
364
+ id: e.id,
365
+ role: e.role,
366
+ content: [
367
+ {
368
+ type: "text",
369
+ text: e.content
370
+ }
371
+ ],
372
+ createdAt: new Date(e.createdAt),
373
+ metadata: {
374
+ custom: {}
375
+ },
376
+ ...e.role === "assistant" && {
377
+ status: {
378
+ type: "complete",
379
+ reason: "stop"
380
+ },
381
+ metadata: {
382
+ unstable_state: null,
383
+ unstable_annotations: [],
384
+ unstable_data: [],
385
+ steps: [],
386
+ custom: {}
371
387
  }
372
- const p = {
373
- messages: xr(c),
388
+ },
389
+ ...e.role === "user" && {
390
+ attachments: []
391
+ }
392
+ };
393
+ }
394
+ function st(e, r) {
395
+ const { modelId: t, systemPrompt: n, ephemeral: i, onChatCreated: o, onUserMessage: a, onThreadIdUpdate: u } = r;
396
+ return {
397
+ async *run(l) {
398
+ const { messages: c, abortSignal: f, context: s } = l, p = s?.threadId;
399
+ a?.();
400
+ const h = {
401
+ messages: Cr(c),
374
402
  chatId: null,
375
403
  // Thread ID will be set by runtime if needed
376
404
  systemPrompt: n,
377
405
  ephemeral: i,
378
406
  stream: !0
379
407
  };
380
- t && t.trim() !== "" && (p.modelId = t);
381
- const b = await e.createOrContinueChat(p, d);
382
- let f = "", k;
383
- for await (const g of kr(b, d)) {
384
- if (d?.aborted)
408
+ t && t.trim() !== "" && (h.modelId = t);
409
+ const k = await e.createOrContinueChat(h, f);
410
+ let g = "", x;
411
+ for await (const w of yr(k, f)) {
412
+ if (f?.aborted)
385
413
  throw new Error("Request aborted");
386
- const x = g.id;
387
- x && !k && (k = x, o?.(x));
388
- const w = g.delta;
389
- if (w != null && (f += w), g.type === "message" || g.content) {
390
- const A = g.content || "";
391
- f += A;
414
+ const y = w.id;
415
+ y && !x && (x = y, o?.(y), p && u && u(p, y));
416
+ const A = w.delta;
417
+ if (A != null && (g += A), w.type === "message" || w.content) {
418
+ const C = w.content || "";
419
+ g += C;
392
420
  }
393
- if (g.message && (f += g.message.content || ""), g.tool_calls, g.finished) {
394
- f && (yield {
395
- content: [{ type: "text", text: f }]
421
+ if (w.message && (g += w.message.content || ""), w.tool_calls, w.finished) {
422
+ g && (yield {
423
+ content: [{ type: "text", text: g }]
396
424
  });
397
425
  break;
398
426
  }
399
- f && (yield {
400
- content: [{ type: "text", text: f }]
427
+ g && (yield {
428
+ content: [{ type: "text", text: g }]
401
429
  });
402
430
  }
403
- f && (yield {
404
- content: [{ type: "text", text: f }]
431
+ g && (yield {
432
+ content: [{ type: "text", text: g }]
405
433
  });
406
434
  }
407
435
  };
408
436
  }
409
- const Ue = /* @__PURE__ */ new Map();
410
- function yr(e, r) {
437
+ const Be = /* @__PURE__ */ new Map();
438
+ function Tr(e, r) {
411
439
  return {
412
440
  async list() {
413
441
  const t = [];
@@ -428,7 +456,7 @@ function yr(e, r) {
428
456
  }).filter((u) => u !== null) };
429
457
  },
430
458
  async initialize(t) {
431
- return { remoteId: Ue.get(t) || t, externalId: void 0 };
459
+ return { remoteId: Be.get(t) || t, externalId: void 0 };
432
460
  },
433
461
  async rename(t, n) {
434
462
  await e.updateChat(t, { title: n });
@@ -464,11 +492,31 @@ function yr(e, r) {
464
492
  },
465
493
  // Add a method to update the remoteId mapping when chat ID is received
466
494
  updateRemoteId(t, n) {
467
- Ue.set(t, n), r?.(t, n);
495
+ Be.set(t, n), r?.(t, n);
496
+ },
497
+ // Provider component that adds thread-specific history adapter
498
+ unstable_Provider: ({ children: t }) => {
499
+ const i = at()?.remoteId, o = $e.useMemo(
500
+ () => ({
501
+ async load() {
502
+ if (!i) return { messages: [] };
503
+ try {
504
+ const u = await e.getChat(i);
505
+ return !u.messages || u.messages.length === 0 ? { messages: [] } : { messages: u.messages.map((c) => vr(c)) };
506
+ } catch (u) {
507
+ return console.error("Failed to load messages for thread:", i, u), { messages: [] };
508
+ }
509
+ },
510
+ async append(u) {
511
+ }
512
+ }),
513
+ [i, e]
514
+ ), a = $e.useMemo(() => ({ history: o }), [o]);
515
+ return /* @__PURE__ */ d(qt, { adapters: a, children: t });
468
516
  }
469
517
  };
470
518
  }
471
- function Cr({
519
+ function Ar({
472
520
  children: e,
473
521
  baseUrl: r,
474
522
  sessionToken: t,
@@ -479,80 +527,105 @@ function Cr({
479
527
  ephemeral: u = !1,
480
528
  systemPrompt: l,
481
529
  initialThreadId: c,
482
- onError: d,
530
+ onError: f,
483
531
  onChatCreated: s,
484
532
  onUserMessage: p,
485
533
  onThreadIdUpdate: b,
486
- onChatsLoaded: f
534
+ onChatsLoaded: h
487
535
  }) {
488
- const k = W(
489
- () => new lt(r, t || void 0, n),
536
+ const k = B(
537
+ () => new ct(r, t || void 0, n),
490
538
  [r, t, n]
491
- ), [g, x] = N(o || null);
492
- M(() => {
539
+ ), [g, x] = I(o || null);
540
+ L(() => {
493
541
  o && x(o);
494
542
  }, [o]);
495
- const w = te(
496
- (C) => {
497
- s?.(C);
543
+ const w = J(
544
+ (v) => {
545
+ s?.(v);
498
546
  },
499
547
  [s]
500
- ), y = te(
501
- (C, L) => {
502
- b?.(C, L);
548
+ ), y = J(
549
+ (v, C) => {
550
+ b?.(v, C);
503
551
  },
504
552
  [b]
505
- ), A = W(() => wr(k, {
553
+ ), A = B(() => st(k, {
506
554
  modelId: g || void 0,
507
555
  // Pass undefined if not set (backend resolves it)
508
556
  systemPrompt: l,
509
557
  ephemeral: u,
510
558
  onChatCreated: w,
511
559
  onUserMessage: p
512
- }), [k, g, l, u, w, p]), T = nt(A);
513
- return i === "singleChat" ? /* @__PURE__ */ h(at, { runtime: T, children: e }) : /* @__PURE__ */ h(
514
- vr,
560
+ }), [k, g, l, u, w, p]);
561
+ return i === "singleChat" ? /* @__PURE__ */ d(Ir, { modelAdapter: A, children: e }) : /* @__PURE__ */ d(
562
+ Nr,
515
563
  {
516
564
  client: k,
517
- modelAdapter: A,
565
+ modelAdapterOptions: {
566
+ modelId: g || void 0,
567
+ systemPrompt: l,
568
+ ephemeral: u,
569
+ onChatCreated: w,
570
+ onUserMessage: p
571
+ },
518
572
  initialThreadId: c,
519
- onChatsLoaded: f,
573
+ onChatsLoaded: h,
520
574
  onThreadIdUpdate: y,
521
- onError: d,
575
+ onError: f,
522
576
  children: e
523
577
  }
524
578
  );
525
579
  }
526
- function vr({
580
+ function Ir({
581
+ modelAdapter: e,
582
+ children: r
583
+ }) {
584
+ const [t, n] = I(!1);
585
+ L(() => {
586
+ n(!0);
587
+ }, []);
588
+ const i = it(e);
589
+ return t ? /* @__PURE__ */ d(ot, { runtime: i, children: r }) : /* @__PURE__ */ d(U, { children: r });
590
+ }
591
+ function Nr({
527
592
  client: e,
528
- modelAdapter: r,
593
+ modelAdapterOptions: r,
529
594
  initialThreadId: t,
530
595
  onChatsLoaded: n,
531
596
  onThreadIdUpdate: i,
532
597
  onError: o,
533
598
  children: a
534
599
  }) {
535
- const u = W(() => yr(e, (s, p) => {
536
- i?.(s, p);
537
- }), [e, i]), l = W(() => ({
600
+ const u = B(() => Tr(e, (b, h) => {
601
+ i?.(b, h);
602
+ }), [e, i]), l = J(
603
+ (b, h) => {
604
+ u.updateRemoteId && u.updateRemoteId(b, h), i?.(b, h);
605
+ },
606
+ [u, i]
607
+ ), c = B(() => ({
538
608
  ...u,
539
609
  async list() {
540
- const s = await u.list();
541
- return n?.(), s;
610
+ const b = await u.list();
611
+ return n?.(), b;
542
612
  }
543
613
  }), [u, n]);
544
- M(() => {
545
- window.__cuadraThreadListAdapter = l, window.__cuadraThreadListRuntime = null;
546
- }, [l]);
547
- const c = te(() => nt(r), [r]), d = Bt({
548
- adapter: l,
549
- runtimeHook: c
614
+ L(() => {
615
+ window.__cuadraThreadListAdapter = c, window.__cuadraThreadListRuntime = null;
616
+ }, [c]);
617
+ const f = B(() => st(e, {
618
+ ...r,
619
+ onThreadIdUpdate: l
620
+ }), [e, r, l]), s = J(() => it(f), [f]), p = Kt({
621
+ adapter: c,
622
+ runtimeHook: s
550
623
  });
551
- return M(() => {
552
- window.__cuadraThreadListRuntime = d;
553
- }, [d]), /* @__PURE__ */ h(at, { runtime: d, children: a });
624
+ return L(() => {
625
+ window.__cuadraThreadListRuntime = p;
626
+ }, [p]), /* @__PURE__ */ d(ot, { runtime: p, children: a });
554
627
  }
555
- function Be(e, r) {
628
+ function We(e, r) {
556
629
  const t = String(e);
557
630
  if (typeof r != "string")
558
631
  throw new TypeError("Expected character");
@@ -562,7 +635,7 @@ function Be(e, r) {
562
635
  return n;
563
636
  }
564
637
  const re = me(/[A-Za-z]/), Me = me(/[\dA-Za-z]/);
565
- function Tr(e) {
638
+ function Sr(e) {
566
639
  return (
567
640
  // Special whitespace codes (which have negative values), C0 and Control
568
641
  // character DEL
@@ -572,7 +645,7 @@ function Tr(e) {
572
645
  function Z(e) {
573
646
  return e !== null && e < -2;
574
647
  }
575
- function D(e) {
648
+ function M(e) {
576
649
  return e !== null && (e < 0 || e === 32);
577
650
  }
578
651
  function F(e) {
@@ -585,7 +658,7 @@ function me(e) {
585
658
  return t !== null && t > -1 && e.test(String.fromCharCode(t));
586
659
  }
587
660
  }
588
- function Ar(e) {
661
+ function Lr(e) {
589
662
  if (typeof e != "string")
590
663
  throw new TypeError("Expected a string");
591
664
  return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
@@ -607,24 +680,24 @@ const pe = (
607
680
  */
608
681
  (function(e) {
609
682
  if (e == null)
610
- return Lr;
683
+ return Rr;
611
684
  if (typeof e == "function")
612
685
  return ge(e);
613
686
  if (typeof e == "object")
614
- return Array.isArray(e) ? Ir(e) : (
687
+ return Array.isArray(e) ? Mr(e) : (
615
688
  // Cast because `ReadonlyArray` goes into the above but `isArray`
616
689
  // narrows to `Array`.
617
- Nr(
690
+ Dr(
618
691
  /** @type {Props} */
619
692
  e
620
693
  )
621
694
  );
622
695
  if (typeof e == "string")
623
- return Sr(e);
696
+ return Pr(e);
624
697
  throw new Error("Expected function, string, or object as test");
625
698
  })
626
699
  );
627
- function Ir(e) {
700
+ function Mr(e) {
628
701
  const r = [];
629
702
  let t = -1;
630
703
  for (; ++t < e.length; )
@@ -637,7 +710,7 @@ function Ir(e) {
637
710
  return !1;
638
711
  }
639
712
  }
640
- function Nr(e) {
713
+ function Dr(e) {
641
714
  const r = (
642
715
  /** @type {Record<string, unknown>} */
643
716
  e
@@ -655,7 +728,7 @@ function Nr(e) {
655
728
  return !0;
656
729
  }
657
730
  }
658
- function Sr(e) {
731
+ function Pr(e) {
659
732
  return ge(r);
660
733
  function r(t) {
661
734
  return t && t.type === e;
@@ -664,7 +737,7 @@ function Sr(e) {
664
737
  function ge(e) {
665
738
  return r;
666
739
  function r(t, n, i) {
667
- return !!(Mr(t) && e.call(
740
+ return !!(Er(t) && e.call(
668
741
  this,
669
742
  t,
670
743
  typeof n == "number" ? n : void 0,
@@ -672,19 +745,19 @@ function ge(e) {
672
745
  ));
673
746
  }
674
747
  }
675
- function Lr() {
748
+ function Rr() {
676
749
  return !0;
677
750
  }
678
- function Mr(e) {
751
+ function Er(e) {
679
752
  return e !== null && typeof e == "object" && "type" in e;
680
753
  }
681
- const ut = [], Dr = !0, Se = !1, Pr = "skip";
682
- function ct(e, r, t, n) {
754
+ const dt = [], _r = !0, Se = !1, Fr = "skip";
755
+ function ft(e, r, t, n) {
683
756
  let i;
684
757
  typeof r == "function" && typeof t != "function" ? (n = t, t = r) : i = r;
685
758
  const o = pe(i), a = n ? -1 : 1;
686
759
  u(e, void 0, [])();
687
- function u(l, c, d) {
760
+ function u(l, c, f) {
688
761
  const s = (
689
762
  /** @type {Record<string, unknown>} */
690
763
  l && typeof l == "object" ? l : {}
@@ -703,74 +776,74 @@ function ct(e, r, t, n) {
703
776
  }
704
777
  return p;
705
778
  function p() {
706
- let b = ut, f, k, g;
707
- if ((!r || o(l, c, d[d.length - 1] || void 0)) && (b = Rr(t(l, d)), b[0] === Se))
779
+ let b = dt, h, k, g;
780
+ if ((!r || o(l, c, f[f.length - 1] || void 0)) && (b = zr(t(l, f)), b[0] === Se))
708
781
  return b;
709
782
  if ("children" in l && l.children) {
710
783
  const x = (
711
784
  /** @type {UnistParent} */
712
785
  l
713
786
  );
714
- if (x.children && b[0] !== Pr)
715
- for (k = (n ? x.children.length : -1) + a, g = d.concat(x); k > -1 && k < x.children.length; ) {
787
+ if (x.children && b[0] !== Fr)
788
+ for (k = (n ? x.children.length : -1) + a, g = f.concat(x); k > -1 && k < x.children.length; ) {
716
789
  const w = x.children[k];
717
- if (f = u(w, k, g)(), f[0] === Se)
718
- return f;
719
- k = typeof f[1] == "number" ? f[1] : k + a;
790
+ if (h = u(w, k, g)(), h[0] === Se)
791
+ return h;
792
+ k = typeof h[1] == "number" ? h[1] : k + a;
720
793
  }
721
794
  }
722
795
  return b;
723
796
  }
724
797
  }
725
798
  }
726
- function Rr(e) {
727
- return Array.isArray(e) ? e : typeof e == "number" ? [Dr, e] : e == null ? ut : [e];
799
+ function zr(e) {
800
+ return Array.isArray(e) ? e : typeof e == "number" ? [_r, e] : e == null ? dt : [e];
728
801
  }
729
- function Er(e, r, t) {
730
- const i = pe((t || {}).ignore || []), o = _r(r);
802
+ function jr(e, r, t) {
803
+ const i = pe((t || {}).ignore || []), o = $r(r);
731
804
  let a = -1;
732
805
  for (; ++a < o.length; )
733
- ct(e, "text", u);
734
- function u(c, d) {
806
+ ft(e, "text", u);
807
+ function u(c, f) {
735
808
  let s = -1, p;
736
- for (; ++s < d.length; ) {
737
- const b = d[s], f = p ? p.children : void 0;
809
+ for (; ++s < f.length; ) {
810
+ const b = f[s], h = p ? p.children : void 0;
738
811
  if (i(
739
812
  b,
740
- f ? f.indexOf(b) : void 0,
813
+ h ? h.indexOf(b) : void 0,
741
814
  p
742
815
  ))
743
816
  return;
744
817
  p = b;
745
818
  }
746
819
  if (p)
747
- return l(c, d);
820
+ return l(c, f);
748
821
  }
749
- function l(c, d) {
750
- const s = d[d.length - 1], p = o[a][0], b = o[a][1];
751
- let f = 0;
822
+ function l(c, f) {
823
+ const s = f[f.length - 1], p = o[a][0], b = o[a][1];
824
+ let h = 0;
752
825
  const g = s.children.indexOf(c);
753
826
  let x = !1, w = [];
754
827
  p.lastIndex = 0;
755
828
  let y = p.exec(c.value);
756
829
  for (; y; ) {
757
- const A = y.index, T = {
830
+ const A = y.index, v = {
758
831
  index: y.index,
759
832
  input: y.input,
760
- stack: [...d, c]
833
+ stack: [...f, c]
761
834
  };
762
- let C = b(...y, T);
763
- if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex = A + 1 : (f !== A && w.push({
835
+ let C = b(...y, v);
836
+ if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex = A + 1 : (h !== A && w.push({
764
837
  type: "text",
765
- value: c.value.slice(f, A)
766
- }), Array.isArray(C) ? w.push(...C) : C && w.push(C), f = A + y[0].length, x = !0), !p.global)
838
+ value: c.value.slice(h, A)
839
+ }), Array.isArray(C) ? w.push(...C) : C && w.push(C), h = A + y[0].length, x = !0), !p.global)
767
840
  break;
768
841
  y = p.exec(c.value);
769
842
  }
770
- return x ? (f < c.value.length && w.push({ type: "text", value: c.value.slice(f) }), s.children.splice(g, 1, ...w)) : w = [c], g + w.length;
843
+ return x ? (h < c.value.length && w.push({ type: "text", value: c.value.slice(h) }), s.children.splice(g, 1, ...w)) : w = [c], g + w.length;
771
844
  }
772
845
  }
773
- function _r(e) {
846
+ function $r(e) {
774
847
  const r = [];
775
848
  if (!Array.isArray(e))
776
849
  throw new TypeError("Expected find and replace tuple or list of tuples");
@@ -778,37 +851,37 @@ function _r(e) {
778
851
  let n = -1;
779
852
  for (; ++n < t.length; ) {
780
853
  const i = t[n];
781
- r.push([Fr(i[0]), zr(i[1])]);
854
+ r.push([Or(i[0]), Ur(i[1])]);
782
855
  }
783
856
  return r;
784
857
  }
785
- function Fr(e) {
786
- return typeof e == "string" ? new RegExp(Ar(e), "g") : e;
858
+ function Or(e) {
859
+ return typeof e == "string" ? new RegExp(Lr(e), "g") : e;
787
860
  }
788
- function zr(e) {
861
+ function Ur(e) {
789
862
  return typeof e == "function" ? e : function() {
790
863
  return e;
791
864
  };
792
865
  }
793
866
  const ye = "phrasing", Ce = ["autolink", "link", "image", "label"];
794
- function jr() {
867
+ function Br() {
795
868
  return {
796
- transforms: [qr],
869
+ transforms: [Zr],
797
870
  enter: {
798
- literalAutolink: Or,
871
+ literalAutolink: Hr,
799
872
  literalAutolinkEmail: ve,
800
873
  literalAutolinkHttp: ve,
801
874
  literalAutolinkWww: ve
802
875
  },
803
876
  exit: {
804
- literalAutolink: Hr,
805
- literalAutolinkEmail: Wr,
806
- literalAutolinkHttp: Ur,
807
- literalAutolinkWww: Br
877
+ literalAutolink: Gr,
878
+ literalAutolinkEmail: Vr,
879
+ literalAutolinkHttp: qr,
880
+ literalAutolinkWww: Kr
808
881
  }
809
882
  };
810
883
  }
811
- function $r() {
884
+ function Wr() {
812
885
  return {
813
886
  unsafe: [
814
887
  {
@@ -835,41 +908,41 @@ function $r() {
835
908
  ]
836
909
  };
837
910
  }
838
- function Or(e) {
911
+ function Hr(e) {
839
912
  this.enter({ type: "link", title: null, url: "", children: [] }, e);
840
913
  }
841
914
  function ve(e) {
842
915
  this.config.enter.autolinkProtocol.call(this, e);
843
916
  }
844
- function Ur(e) {
917
+ function qr(e) {
845
918
  this.config.exit.autolinkProtocol.call(this, e);
846
919
  }
847
- function Br(e) {
920
+ function Kr(e) {
848
921
  this.config.exit.data.call(this, e);
849
922
  const r = this.stack[this.stack.length - 1];
850
923
  r.type, r.url = "http://" + this.sliceSerialize(e);
851
924
  }
852
- function Wr(e) {
925
+ function Vr(e) {
853
926
  this.config.exit.autolinkEmail.call(this, e);
854
927
  }
855
- function Hr(e) {
928
+ function Gr(e) {
856
929
  this.exit(e);
857
930
  }
858
- function qr(e) {
859
- Er(
931
+ function Zr(e) {
932
+ jr(
860
933
  e,
861
934
  [
862
- [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, Kr],
863
- [/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, Vr]
935
+ [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, Jr],
936
+ [/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, Qr]
864
937
  ],
865
938
  { ignore: ["link", "linkReference"] }
866
939
  );
867
940
  }
868
- function Kr(e, r, t, n, i) {
941
+ function Jr(e, r, t, n, i) {
869
942
  let o = "";
870
- if (!st(i) || (/^w/i.test(r) && (t = r + t, r = "", o = "http://"), !Gr(t)))
943
+ if (!ht(i) || (/^w/i.test(r) && (t = r + t, r = "", o = "http://"), !Xr(t)))
871
944
  return !1;
872
- const a = Zr(t + n);
945
+ const a = Yr(t + n);
873
946
  if (!a[0]) return !1;
874
947
  const u = {
875
948
  type: "link",
@@ -879,10 +952,10 @@ function Kr(e, r, t, n, i) {
879
952
  };
880
953
  return a[1] ? [u, { type: "text", value: a[1] }] : u;
881
954
  }
882
- function Vr(e, r, t, n) {
955
+ function Qr(e, r, t, n) {
883
956
  return (
884
957
  // Not an expected previous character.
885
- !st(n, !0) || // Label ends in not allowed character.
958
+ !ht(n, !0) || // Label ends in not allowed character.
886
959
  /[-\d_]$/.test(t) ? !1 : {
887
960
  type: "link",
888
961
  title: null,
@@ -891,23 +964,23 @@ function Vr(e, r, t, n) {
891
964
  }
892
965
  );
893
966
  }
894
- function Gr(e) {
967
+ function Xr(e) {
895
968
  const r = e.split(".");
896
969
  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])));
897
970
  }
898
- function Zr(e) {
971
+ function Yr(e) {
899
972
  const r = /[!"&'),.:;<>?\]}]+$/.exec(e);
900
973
  if (!r)
901
974
  return [e, void 0];
902
975
  e = e.slice(0, r.index);
903
976
  let t = r[0], n = t.indexOf(")");
904
- const i = Be(e, "(");
905
- let o = Be(e, ")");
977
+ const i = We(e, "(");
978
+ let o = We(e, ")");
906
979
  for (; n !== -1 && i > o; )
907
980
  e += t.slice(0, n + 1), t = t.slice(n + 1), n = t.indexOf(")"), o++;
908
981
  return [e, t];
909
982
  }
910
- function st(e, r) {
983
+ function ht(e, r) {
911
984
  const t = e.input.charCodeAt(e.index - 1);
912
985
  return (e.index === 0 || H(t) || he(t)) && // If it’s an email, the previous character should not be a slash.
913
986
  (!r || t !== 47);
@@ -915,44 +988,44 @@ function st(e, r) {
915
988
  function ae(e) {
916
989
  return e.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
917
990
  }
918
- dt.peek = an;
919
- function Jr() {
991
+ mt.peek = cn;
992
+ function en() {
920
993
  this.buffer();
921
994
  }
922
- function Qr(e) {
995
+ function tn(e) {
923
996
  this.enter({ type: "footnoteReference", identifier: "", label: "" }, e);
924
997
  }
925
- function Xr() {
998
+ function rn() {
926
999
  this.buffer();
927
1000
  }
928
- function Yr(e) {
1001
+ function nn(e) {
929
1002
  this.enter(
930
1003
  { type: "footnoteDefinition", identifier: "", label: "", children: [] },
931
1004
  e
932
1005
  );
933
1006
  }
934
- function en(e) {
1007
+ function an(e) {
935
1008
  const r = this.resume(), t = this.stack[this.stack.length - 1];
936
1009
  t.type, t.identifier = ae(
937
1010
  this.sliceSerialize(e)
938
1011
  ).toLowerCase(), t.label = r;
939
1012
  }
940
- function tn(e) {
1013
+ function on(e) {
941
1014
  this.exit(e);
942
1015
  }
943
- function rn(e) {
1016
+ function ln(e) {
944
1017
  const r = this.resume(), t = this.stack[this.stack.length - 1];
945
1018
  t.type, t.identifier = ae(
946
1019
  this.sliceSerialize(e)
947
1020
  ).toLowerCase(), t.label = r;
948
1021
  }
949
- function nn(e) {
1022
+ function un(e) {
950
1023
  this.exit(e);
951
1024
  }
952
- function an() {
1025
+ function cn() {
953
1026
  return "[";
954
1027
  }
955
- function dt(e, r, t, n) {
1028
+ function mt(e, r, t, n) {
956
1029
  const i = t.createTracker(n);
957
1030
  let o = i.move("[^");
958
1031
  const a = t.enter("footnoteReference"), u = t.enter("reference");
@@ -960,51 +1033,51 @@ function dt(e, r, t, n) {
960
1033
  t.safe(t.associationId(e), { after: "]", before: o })
961
1034
  ), u(), a(), o += i.move("]"), o;
962
1035
  }
963
- function on() {
1036
+ function sn() {
964
1037
  return {
965
1038
  enter: {
966
- gfmFootnoteCallString: Jr,
967
- gfmFootnoteCall: Qr,
968
- gfmFootnoteDefinitionLabelString: Xr,
969
- gfmFootnoteDefinition: Yr
970
- },
971
- exit: {
972
1039
  gfmFootnoteCallString: en,
973
1040
  gfmFootnoteCall: tn,
974
1041
  gfmFootnoteDefinitionLabelString: rn,
975
1042
  gfmFootnoteDefinition: nn
1043
+ },
1044
+ exit: {
1045
+ gfmFootnoteCallString: an,
1046
+ gfmFootnoteCall: on,
1047
+ gfmFootnoteDefinitionLabelString: ln,
1048
+ gfmFootnoteDefinition: un
976
1049
  }
977
1050
  };
978
1051
  }
979
- function ln(e) {
1052
+ function dn(e) {
980
1053
  let r = !1;
981
1054
  return e && e.firstLineBlank && (r = !0), {
982
- handlers: { footnoteDefinition: t, footnoteReference: dt },
1055
+ handlers: { footnoteDefinition: t, footnoteReference: mt },
983
1056
  // This is on by default already.
984
1057
  unsafe: [{ character: "[", inConstruct: ["label", "phrasing", "reference"] }]
985
1058
  };
986
1059
  function t(n, i, o, a) {
987
1060
  const u = o.createTracker(a);
988
1061
  let l = u.move("[^");
989
- const c = o.enter("footnoteDefinition"), d = o.enter("label");
1062
+ const c = o.enter("footnoteDefinition"), f = o.enter("label");
990
1063
  return l += u.move(
991
1064
  o.safe(o.associationId(n), { before: l, after: "]" })
992
- ), d(), l += u.move("]:"), n.children && n.children.length > 0 && (u.shift(4), l += u.move(
1065
+ ), f(), l += u.move("]:"), n.children && n.children.length > 0 && (u.shift(4), l += u.move(
993
1066
  (r ? `
994
1067
  ` : " ") + o.indentLines(
995
1068
  o.containerFlow(n, u.current()),
996
- r ? ft : un
1069
+ r ? pt : fn
997
1070
  )
998
1071
  )), c(), l;
999
1072
  }
1000
1073
  }
1001
- function un(e, r, t) {
1002
- return r === 0 ? e : ft(e, r, t);
1074
+ function fn(e, r, t) {
1075
+ return r === 0 ? e : pt(e, r, t);
1003
1076
  }
1004
- function ft(e, r, t) {
1077
+ function pt(e, r, t) {
1005
1078
  return (t ? "" : " ") + e;
1006
1079
  }
1007
- const cn = [
1080
+ const hn = [
1008
1081
  "autolink",
1009
1082
  "destinationLiteral",
1010
1083
  "destinationRaw",
@@ -1012,33 +1085,33 @@ const cn = [
1012
1085
  "titleQuote",
1013
1086
  "titleApostrophe"
1014
1087
  ];
1015
- ht.peek = mn;
1016
- function sn() {
1088
+ gt.peek = kn;
1089
+ function mn() {
1017
1090
  return {
1018
1091
  canContainEols: ["delete"],
1019
- enter: { strikethrough: fn },
1020
- exit: { strikethrough: hn }
1092
+ enter: { strikethrough: gn },
1093
+ exit: { strikethrough: bn }
1021
1094
  };
1022
1095
  }
1023
- function dn() {
1096
+ function pn() {
1024
1097
  return {
1025
1098
  unsafe: [
1026
1099
  {
1027
1100
  character: "~",
1028
1101
  inConstruct: "phrasing",
1029
- notInConstruct: cn
1102
+ notInConstruct: hn
1030
1103
  }
1031
1104
  ],
1032
- handlers: { delete: ht }
1105
+ handlers: { delete: gt }
1033
1106
  };
1034
1107
  }
1035
- function fn(e) {
1108
+ function gn(e) {
1036
1109
  this.enter({ type: "delete", children: [] }, e);
1037
1110
  }
1038
- function hn(e) {
1111
+ function bn(e) {
1039
1112
  this.exit(e);
1040
1113
  }
1041
- function ht(e, r, t, n) {
1114
+ function gt(e, r, t, n) {
1042
1115
  const i = t.createTracker(n), o = t.enter("strikethrough");
1043
1116
  let a = i.move("~~");
1044
1117
  return a += t.containerPhrasing(e, {
@@ -1047,34 +1120,34 @@ function ht(e, r, t, n) {
1047
1120
  after: "~"
1048
1121
  }), a += i.move("~~"), o(), a;
1049
1122
  }
1050
- function mn() {
1123
+ function kn() {
1051
1124
  return "~";
1052
1125
  }
1053
- function pn(e) {
1126
+ function xn(e) {
1054
1127
  return e.length;
1055
1128
  }
1056
- function gn(e, r) {
1057
- const t = r || {}, n = (t.align || []).concat(), i = t.stringLength || pn, o = [], a = [], u = [], l = [];
1058
- let c = 0, d = -1;
1059
- for (; ++d < e.length; ) {
1129
+ function wn(e, r) {
1130
+ const t = r || {}, n = (t.align || []).concat(), i = t.stringLength || xn, o = [], a = [], u = [], l = [];
1131
+ let c = 0, f = -1;
1132
+ for (; ++f < e.length; ) {
1060
1133
  const k = [], g = [];
1061
1134
  let x = -1;
1062
- for (e[d].length > c && (c = e[d].length); ++x < e[d].length; ) {
1063
- const w = bn(e[d][x]);
1135
+ for (e[f].length > c && (c = e[f].length); ++x < e[f].length; ) {
1136
+ const w = yn(e[f][x]);
1064
1137
  if (t.alignDelimiters !== !1) {
1065
1138
  const y = i(w);
1066
1139
  g[x] = y, (l[x] === void 0 || y > l[x]) && (l[x] = y);
1067
1140
  }
1068
1141
  k.push(w);
1069
1142
  }
1070
- a[d] = k, u[d] = g;
1143
+ a[f] = k, u[f] = g;
1071
1144
  }
1072
1145
  let s = -1;
1073
1146
  if (typeof n == "object" && "length" in n)
1074
1147
  for (; ++s < c; )
1075
- o[s] = We(n[s]);
1148
+ o[s] = He(n[s]);
1076
1149
  else {
1077
- const k = We(n);
1150
+ const k = He(n);
1078
1151
  for (; ++s < c; )
1079
1152
  o[s] = k;
1080
1153
  }
@@ -1091,53 +1164,53 @@ function gn(e, r) {
1091
1164
  const y = g + "-".repeat(w) + x;
1092
1165
  t.alignDelimiters !== !1 && (w = g.length + w + x.length, w > l[s] && (l[s] = w), b[s] = w), p[s] = y;
1093
1166
  }
1094
- a.splice(1, 0, p), u.splice(1, 0, b), d = -1;
1095
- const f = [];
1096
- for (; ++d < a.length; ) {
1097
- const k = a[d], g = u[d];
1167
+ a.splice(1, 0, p), u.splice(1, 0, b), f = -1;
1168
+ const h = [];
1169
+ for (; ++f < a.length; ) {
1170
+ const k = a[f], g = u[f];
1098
1171
  s = -1;
1099
1172
  const x = [];
1100
1173
  for (; ++s < c; ) {
1101
1174
  const w = k[s] || "";
1102
1175
  let y = "", A = "";
1103
1176
  if (t.alignDelimiters !== !1) {
1104
- const T = l[s] - (g[s] || 0), C = o[s];
1105
- C === 114 ? y = " ".repeat(T) : C === 99 ? T % 2 ? (y = " ".repeat(T / 2 + 0.5), A = " ".repeat(T / 2 - 0.5)) : (y = " ".repeat(T / 2), A = y) : A = " ".repeat(T);
1177
+ const v = l[s] - (g[s] || 0), C = o[s];
1178
+ C === 114 ? y = " ".repeat(v) : C === 99 ? v % 2 ? (y = " ".repeat(v / 2 + 0.5), A = " ".repeat(v / 2 - 0.5)) : (y = " ".repeat(v / 2), A = y) : A = " ".repeat(v);
1106
1179
  }
1107
1180
  t.delimiterStart !== !1 && !s && x.push("|"), t.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is
1108
1181
  // empty: there will be a closing space.
1109
1182
  !(t.alignDelimiters === !1 && w === "") && (t.delimiterStart !== !1 || s) && x.push(" "), t.alignDelimiters !== !1 && x.push(y), x.push(w), t.alignDelimiters !== !1 && x.push(A), t.padding !== !1 && x.push(" "), (t.delimiterEnd !== !1 || s !== c - 1) && x.push("|");
1110
1183
  }
1111
- f.push(
1184
+ h.push(
1112
1185
  t.delimiterEnd === !1 ? x.join("").replace(/ +$/, "") : x.join("")
1113
1186
  );
1114
1187
  }
1115
- return f.join(`
1188
+ return h.join(`
1116
1189
  `);
1117
1190
  }
1118
- function bn(e) {
1191
+ function yn(e) {
1119
1192
  return e == null ? "" : String(e);
1120
1193
  }
1121
- function We(e) {
1194
+ function He(e) {
1122
1195
  const r = typeof e == "string" ? e.codePointAt(0) : 0;
1123
1196
  return r === 67 || r === 99 ? 99 : r === 76 || r === 108 ? 108 : r === 82 || r === 114 ? 114 : 0;
1124
1197
  }
1125
- function kn(e, r, t, n) {
1198
+ function Cn(e, r, t, n) {
1126
1199
  const i = t.enter("blockquote"), o = t.createTracker(n);
1127
1200
  o.move("> "), o.shift(2);
1128
1201
  const a = t.indentLines(
1129
1202
  t.containerFlow(e, o.current()),
1130
- xn
1203
+ vn
1131
1204
  );
1132
1205
  return i(), a;
1133
1206
  }
1134
- function xn(e, r, t) {
1207
+ function vn(e, r, t) {
1135
1208
  return ">" + (t ? "" : " ") + e;
1136
1209
  }
1137
- function wn(e, r) {
1138
- return He(e, r.inConstruct, !0) && !He(e, r.notInConstruct, !1);
1210
+ function Tn(e, r) {
1211
+ return qe(e, r.inConstruct, !0) && !qe(e, r.notInConstruct, !1);
1139
1212
  }
1140
- function He(e, r, t) {
1213
+ function qe(e, r, t) {
1141
1214
  if (typeof r == "string" && (r = [r]), !r || r.length === 0)
1142
1215
  return t;
1143
1216
  let n = -1;
@@ -1146,16 +1219,16 @@ function He(e, r, t) {
1146
1219
  return !0;
1147
1220
  return !1;
1148
1221
  }
1149
- function qe(e, r, t, n) {
1222
+ function Ke(e, r, t, n) {
1150
1223
  let i = -1;
1151
1224
  for (; ++i < t.unsafe.length; )
1152
1225
  if (t.unsafe[i].character === `
1153
- ` && wn(t.stack, t.unsafe[i]))
1226
+ ` && Tn(t.stack, t.unsafe[i]))
1154
1227
  return /[ \t]/.test(n.before) ? "" : " ";
1155
1228
  return `\\
1156
1229
  `;
1157
1230
  }
1158
- function yn(e, r) {
1231
+ function An(e, r) {
1159
1232
  const t = String(e);
1160
1233
  let n = t.indexOf(r), i = n, o = 0, a = 0;
1161
1234
  if (typeof r != "string")
@@ -1164,13 +1237,13 @@ function yn(e, r) {
1164
1237
  n === i ? ++o > a && (a = o) : o = 1, i = n + r.length, n = t.indexOf(r, i);
1165
1238
  return a;
1166
1239
  }
1167
- function Cn(e, r) {
1240
+ function In(e, r) {
1168
1241
  return !!(r.options.fences === !1 && e.value && // If there’s no info…
1169
1242
  !e.lang && // And there’s a non-whitespace character…
1170
1243
  /[^ \r\n]/.test(e.value) && // And the value doesn’t start or end in a blank…
1171
1244
  !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value));
1172
1245
  }
1173
- function vn(e) {
1246
+ function Nn(e) {
1174
1247
  const r = e.options.fence || "`";
1175
1248
  if (r !== "`" && r !== "~")
1176
1249
  throw new Error(
@@ -1178,19 +1251,19 @@ function vn(e) {
1178
1251
  );
1179
1252
  return r;
1180
1253
  }
1181
- function Tn(e, r, t, n) {
1182
- const i = vn(t), o = e.value || "", a = i === "`" ? "GraveAccent" : "Tilde";
1183
- if (Cn(e, t)) {
1184
- const s = t.enter("codeIndented"), p = t.indentLines(o, An);
1254
+ function Sn(e, r, t, n) {
1255
+ const i = Nn(t), o = e.value || "", a = i === "`" ? "GraveAccent" : "Tilde";
1256
+ if (In(e, t)) {
1257
+ const s = t.enter("codeIndented"), p = t.indentLines(o, Ln);
1185
1258
  return s(), p;
1186
1259
  }
1187
- const u = t.createTracker(n), l = i.repeat(Math.max(yn(o, i) + 1, 3)), c = t.enter("codeFenced");
1188
- let d = u.move(l);
1260
+ const u = t.createTracker(n), l = i.repeat(Math.max(An(o, i) + 1, 3)), c = t.enter("codeFenced");
1261
+ let f = u.move(l);
1189
1262
  if (e.lang) {
1190
1263
  const s = t.enter(`codeFencedLang${a}`);
1191
- d += u.move(
1264
+ f += u.move(
1192
1265
  t.safe(e.lang, {
1193
- before: d,
1266
+ before: f,
1194
1267
  after: " ",
1195
1268
  encode: ["`"],
1196
1269
  ...u.current()
@@ -1199,9 +1272,9 @@ function Tn(e, r, t, n) {
1199
1272
  }
1200
1273
  if (e.lang && e.meta) {
1201
1274
  const s = t.enter(`codeFencedMeta${a}`);
1202
- d += u.move(" "), d += u.move(
1275
+ f += u.move(" "), f += u.move(
1203
1276
  t.safe(e.meta, {
1204
- before: d,
1277
+ before: f,
1205
1278
  after: `
1206
1279
  `,
1207
1280
  encode: ["`"],
@@ -1209,11 +1282,11 @@ function Tn(e, r, t, n) {
1209
1282
  })
1210
1283
  ), s();
1211
1284
  }
1212
- return d += u.move(`
1213
- `), o && (d += u.move(o + `
1214
- `)), d += u.move(l), c(), d;
1285
+ return f += u.move(`
1286
+ `), o && (f += u.move(o + `
1287
+ `)), f += u.move(l), c(), f;
1215
1288
  }
1216
- function An(e, r, t) {
1289
+ function Ln(e, r, t) {
1217
1290
  return (t ? "" : " ") + e;
1218
1291
  }
1219
1292
  function De(e) {
@@ -1224,7 +1297,7 @@ function De(e) {
1224
1297
  );
1225
1298
  return r;
1226
1299
  }
1227
- function In(e, r, t, n) {
1300
+ function Mn(e, r, t, n) {
1228
1301
  const i = De(t), o = i === '"' ? "Quote" : "Apostrophe", a = t.enter("definition");
1229
1302
  let u = t.enter("label");
1230
1303
  const l = t.createTracker(n);
@@ -1254,7 +1327,7 @@ function In(e, r, t, n) {
1254
1327
  })
1255
1328
  ), c += l.move(i), u()), a(), c;
1256
1329
  }
1257
- function Nn(e) {
1330
+ function Dn(e) {
1258
1331
  const r = e.options.emphasis || "*";
1259
1332
  if (r !== "*" && r !== "_")
1260
1333
  throw new Error(
@@ -1266,7 +1339,7 @@ function ne(e) {
1266
1339
  return "&#x" + e.toString(16).toUpperCase() + ";";
1267
1340
  }
1268
1341
  function de(e) {
1269
- if (e === null || D(e) || H(e))
1342
+ if (e === null || M(e) || H(e))
1270
1343
  return 1;
1271
1344
  if (he(e))
1272
1345
  return 2;
@@ -1304,9 +1377,9 @@ function fe(e, r, t) {
1304
1377
  { inside: !1, outside: !1 }
1305
1378
  );
1306
1379
  }
1307
- mt.peek = Sn;
1308
- function mt(e, r, t, n) {
1309
- const i = Nn(t), o = t.enter("emphasis"), a = t.createTracker(n), u = a.move(i);
1380
+ bt.peek = Pn;
1381
+ function bt(e, r, t, n) {
1382
+ const i = Dn(t), o = t.enter("emphasis"), a = t.createTracker(n), u = a.move(i);
1310
1383
  let l = a.move(
1311
1384
  t.containerPhrasing(e, {
1312
1385
  after: i,
@@ -1314,75 +1387,75 @@ function mt(e, r, t, n) {
1314
1387
  ...a.current()
1315
1388
  })
1316
1389
  );
1317
- const c = l.charCodeAt(0), d = fe(
1390
+ const c = l.charCodeAt(0), f = fe(
1318
1391
  n.before.charCodeAt(n.before.length - 1),
1319
1392
  c,
1320
1393
  i
1321
1394
  );
1322
- d.inside && (l = ne(c) + l.slice(1));
1395
+ f.inside && (l = ne(c) + l.slice(1));
1323
1396
  const s = l.charCodeAt(l.length - 1), p = fe(n.after.charCodeAt(0), s, i);
1324
1397
  p.inside && (l = l.slice(0, -1) + ne(s));
1325
1398
  const b = a.move(i);
1326
1399
  return o(), t.attentionEncodeSurroundingInfo = {
1327
1400
  after: p.outside,
1328
- before: d.outside
1401
+ before: f.outside
1329
1402
  }, u + l + b;
1330
1403
  }
1331
- function Sn(e, r, t) {
1404
+ function Pn(e, r, t) {
1332
1405
  return t.options.emphasis || "*";
1333
1406
  }
1334
- function Ln(e, r, t, n) {
1407
+ function Rn(e, r, t, n) {
1335
1408
  let i, o, a;
1336
- typeof r == "function" && typeof t != "function" ? (o = void 0, a = r, i = t) : (o = r, a = t, i = n), ct(e, o, u, i);
1409
+ typeof r == "function" && typeof t != "function" ? (o = void 0, a = r, i = t) : (o = r, a = t, i = n), ft(e, o, u, i);
1337
1410
  function u(l, c) {
1338
- const d = c[c.length - 1], s = d ? d.children.indexOf(l) : void 0;
1339
- return a(l, s, d);
1411
+ const f = c[c.length - 1], s = f ? f.children.indexOf(l) : void 0;
1412
+ return a(l, s, f);
1340
1413
  }
1341
1414
  }
1342
- const Mn = {};
1343
- function pt(e, r) {
1344
- const t = Mn, n = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, i = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
1345
- return gt(e, n, i);
1415
+ const En = {};
1416
+ function kt(e, r) {
1417
+ const t = En, n = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, i = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
1418
+ return xt(e, n, i);
1346
1419
  }
1347
- function gt(e, r, t) {
1348
- if (Dn(e)) {
1420
+ function xt(e, r, t) {
1421
+ if (_n(e)) {
1349
1422
  if ("value" in e)
1350
1423
  return e.type === "html" && !t ? "" : e.value;
1351
1424
  if (r && "alt" in e && e.alt)
1352
1425
  return e.alt;
1353
1426
  if ("children" in e)
1354
- return Ke(e.children, r, t);
1427
+ return Ve(e.children, r, t);
1355
1428
  }
1356
- return Array.isArray(e) ? Ke(e, r, t) : "";
1429
+ return Array.isArray(e) ? Ve(e, r, t) : "";
1357
1430
  }
1358
- function Ke(e, r, t) {
1431
+ function Ve(e, r, t) {
1359
1432
  const n = [];
1360
1433
  let i = -1;
1361
1434
  for (; ++i < e.length; )
1362
- n[i] = gt(e[i], r, t);
1435
+ n[i] = xt(e[i], r, t);
1363
1436
  return n.join("");
1364
1437
  }
1365
- function Dn(e) {
1438
+ function _n(e) {
1366
1439
  return !!(e && typeof e == "object");
1367
1440
  }
1368
- function Pn(e, r) {
1441
+ function Fn(e, r) {
1369
1442
  let t = !1;
1370
- return Ln(e, function(n) {
1443
+ return Rn(e, function(n) {
1371
1444
  if ("value" in n && /\r?\n|\r/.test(n.value) || n.type === "break")
1372
1445
  return t = !0, Se;
1373
- }), !!((!e.depth || e.depth < 3) && pt(e) && (r.options.setext || t));
1446
+ }), !!((!e.depth || e.depth < 3) && kt(e) && (r.options.setext || t));
1374
1447
  }
1375
- function Rn(e, r, t, n) {
1448
+ function zn(e, r, t, n) {
1376
1449
  const i = Math.max(Math.min(6, e.depth || 1), 1), o = t.createTracker(n);
1377
- if (Pn(e, t)) {
1378
- const d = t.enter("headingSetext"), s = t.enter("phrasing"), p = t.containerPhrasing(e, {
1450
+ if (Fn(e, t)) {
1451
+ const f = t.enter("headingSetext"), s = t.enter("phrasing"), p = t.containerPhrasing(e, {
1379
1452
  ...o.current(),
1380
1453
  before: `
1381
1454
  `,
1382
1455
  after: `
1383
1456
  `
1384
1457
  });
1385
- return s(), d(), p + `
1458
+ return s(), f(), p + `
1386
1459
  ` + (i === 1 ? "=" : "-").repeat(
1387
1460
  // The whole size…
1388
1461
  p.length - // Minus the position of the character after the last EOL (or
@@ -1401,15 +1474,15 @@ function Rn(e, r, t, n) {
1401
1474
  });
1402
1475
  return /^[\t ]/.test(c) && (c = ne(c.charCodeAt(0)) + c.slice(1)), c = c ? a + " " + c : a, t.options.closeAtx && (c += " " + a), l(), u(), c;
1403
1476
  }
1404
- bt.peek = En;
1405
- function bt(e) {
1477
+ wt.peek = jn;
1478
+ function wt(e) {
1406
1479
  return e.value || "";
1407
1480
  }
1408
- function En() {
1481
+ function jn() {
1409
1482
  return "<";
1410
1483
  }
1411
- kt.peek = _n;
1412
- function kt(e, r, t, n) {
1484
+ yt.peek = $n;
1485
+ function yt(e, r, t, n) {
1413
1486
  const i = De(t), o = i === '"' ? "Quote" : "Apostrophe", a = t.enter("image");
1414
1487
  let u = t.enter("label");
1415
1488
  const l = t.createTracker(n);
@@ -1434,11 +1507,11 @@ function kt(e, r, t, n) {
1434
1507
  })
1435
1508
  ), c += l.move(i), u()), c += l.move(")"), a(), c;
1436
1509
  }
1437
- function _n() {
1510
+ function $n() {
1438
1511
  return "!";
1439
1512
  }
1440
- xt.peek = Fn;
1441
- function xt(e, r, t, n) {
1513
+ Ct.peek = On;
1514
+ function Ct(e, r, t, n) {
1442
1515
  const i = e.referenceType, o = t.enter("imageReference");
1443
1516
  let a = t.enter("label");
1444
1517
  const u = t.createTracker(n);
@@ -1449,20 +1522,20 @@ function xt(e, r, t, n) {
1449
1522
  ...u.current()
1450
1523
  });
1451
1524
  l += u.move(c + "]["), a();
1452
- const d = t.stack;
1525
+ const f = t.stack;
1453
1526
  t.stack = [], a = t.enter("reference");
1454
1527
  const s = t.safe(t.associationId(e), {
1455
1528
  before: l,
1456
1529
  after: "]",
1457
1530
  ...u.current()
1458
1531
  });
1459
- return a(), t.stack = d, o(), i === "full" || !c || c !== s ? l += u.move(s + "]") : i === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
1532
+ return a(), t.stack = f, o(), i === "full" || !c || c !== s ? l += u.move(s + "]") : i === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
1460
1533
  }
1461
- function Fn() {
1534
+ function On() {
1462
1535
  return "!";
1463
1536
  }
1464
- wt.peek = zn;
1465
- function wt(e, r, t) {
1537
+ vt.peek = Un;
1538
+ function vt(e, r, t) {
1466
1539
  let n = e.value || "", i = "`", o = -1;
1467
1540
  for (; new RegExp("(^|[^`])" + i + "([^`]|$)").test(n); )
1468
1541
  i += "`";
@@ -1477,11 +1550,11 @@ function wt(e, r, t) {
1477
1550
  }
1478
1551
  return i + n + i;
1479
1552
  }
1480
- function zn() {
1553
+ function Un() {
1481
1554
  return "`";
1482
1555
  }
1483
- function yt(e, r) {
1484
- const t = pt(e);
1556
+ function Tt(e, r) {
1557
+ const t = kt(e);
1485
1558
  return !!(!r.options.resourceLink && // If there’s a url…
1486
1559
  e.url && // And there’s a no title…
1487
1560
  !e.title && // And the content of `node` is a single text node…
@@ -1491,12 +1564,12 @@ function yt(e, r) {
1491
1564
  // references don’t work), space, or angle brackets…
1492
1565
  !/[\0- <>\u007F]/.test(e.url));
1493
1566
  }
1494
- Ct.peek = jn;
1495
- function Ct(e, r, t, n) {
1567
+ At.peek = Bn;
1568
+ function At(e, r, t, n) {
1496
1569
  const i = De(t), o = i === '"' ? "Quote" : "Apostrophe", a = t.createTracker(n);
1497
1570
  let u, l;
1498
- if (yt(e, t)) {
1499
- const d = t.stack;
1571
+ if (Tt(e, t)) {
1572
+ const f = t.stack;
1500
1573
  t.stack = [], u = t.enter("autolink");
1501
1574
  let s = a.move("<");
1502
1575
  return s += a.move(
@@ -1505,7 +1578,7 @@ function Ct(e, r, t, n) {
1505
1578
  after: ">",
1506
1579
  ...a.current()
1507
1580
  })
1508
- ), s += a.move(">"), u(), t.stack = d, s;
1581
+ ), s += a.move(">"), u(), t.stack = f, s;
1509
1582
  }
1510
1583
  u = t.enter("link"), l = t.enter("label");
1511
1584
  let c = a.move("[");
@@ -1533,11 +1606,11 @@ function Ct(e, r, t, n) {
1533
1606
  })
1534
1607
  ), c += a.move(i), l()), c += a.move(")"), u(), c;
1535
1608
  }
1536
- function jn(e, r, t) {
1537
- return yt(e, t) ? "<" : "[";
1609
+ function Bn(e, r, t) {
1610
+ return Tt(e, t) ? "<" : "[";
1538
1611
  }
1539
- vt.peek = $n;
1540
- function vt(e, r, t, n) {
1612
+ It.peek = Wn;
1613
+ function It(e, r, t, n) {
1541
1614
  const i = e.referenceType, o = t.enter("linkReference");
1542
1615
  let a = t.enter("label");
1543
1616
  const u = t.createTracker(n);
@@ -1548,16 +1621,16 @@ function vt(e, r, t, n) {
1548
1621
  ...u.current()
1549
1622
  });
1550
1623
  l += u.move(c + "]["), a();
1551
- const d = t.stack;
1624
+ const f = t.stack;
1552
1625
  t.stack = [], a = t.enter("reference");
1553
1626
  const s = t.safe(t.associationId(e), {
1554
1627
  before: l,
1555
1628
  after: "]",
1556
1629
  ...u.current()
1557
1630
  });
1558
- return a(), t.stack = d, o(), i === "full" || !c || c !== s ? l += u.move(s + "]") : i === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
1631
+ return a(), t.stack = f, o(), i === "full" || !c || c !== s ? l += u.move(s + "]") : i === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
1559
1632
  }
1560
- function $n() {
1633
+ function Wn() {
1561
1634
  return "[";
1562
1635
  }
1563
1636
  function Pe(e) {
@@ -1568,7 +1641,7 @@ function Pe(e) {
1568
1641
  );
1569
1642
  return r;
1570
1643
  }
1571
- function On(e) {
1644
+ function Hn(e) {
1572
1645
  const r = Pe(e), t = e.options.bulletOther;
1573
1646
  if (!t)
1574
1647
  return r === "*" ? "-" : "*";
@@ -1582,7 +1655,7 @@ function On(e) {
1582
1655
  );
1583
1656
  return t;
1584
1657
  }
1585
- function Un(e) {
1658
+ function qn(e) {
1586
1659
  const r = e.options.bulletOrdered || ".";
1587
1660
  if (r !== "." && r !== ")")
1588
1661
  throw new Error(
@@ -1590,7 +1663,7 @@ function Un(e) {
1590
1663
  );
1591
1664
  return r;
1592
1665
  }
1593
- function Tt(e) {
1666
+ function Nt(e) {
1594
1667
  const r = e.options.rule || "*";
1595
1668
  if (r !== "*" && r !== "-" && r !== "_")
1596
1669
  throw new Error(
@@ -1598,19 +1671,19 @@ function Tt(e) {
1598
1671
  );
1599
1672
  return r;
1600
1673
  }
1601
- function Bn(e, r, t, n) {
1674
+ function Kn(e, r, t, n) {
1602
1675
  const i = t.enter("list"), o = t.bulletCurrent;
1603
- let a = e.ordered ? Un(t) : Pe(t);
1604
- const u = e.ordered ? a === "." ? ")" : "." : On(t);
1676
+ let a = e.ordered ? qn(t) : Pe(t);
1677
+ const u = e.ordered ? a === "." ? ")" : "." : Hn(t);
1605
1678
  let l = r && t.bulletLastUsed ? a === t.bulletLastUsed : !1;
1606
1679
  if (!e.ordered) {
1607
- const d = e.children ? e.children[0] : void 0;
1680
+ const f = e.children ? e.children[0] : void 0;
1608
1681
  if (
1609
1682
  // Bullet could be used as a thematic break marker:
1610
1683
  (a === "*" || a === "-") && // Empty first list item:
1611
- d && (!d.children || !d.children[0]) && // Directly in two other list items:
1684
+ f && (!f.children || !f.children[0]) && // Directly in two other list items:
1612
1685
  t.stack[t.stack.length - 1] === "list" && t.stack[t.stack.length - 2] === "listItem" && t.stack[t.stack.length - 3] === "list" && t.stack[t.stack.length - 4] === "listItem" && // That are each the first child.
1613
- t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (l = !0), Tt(t) === a && d
1686
+ t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (l = !0), Nt(t) === a && f
1614
1687
  ) {
1615
1688
  let s = -1;
1616
1689
  for (; ++s < e.children.length; ) {
@@ -1626,7 +1699,7 @@ function Bn(e, r, t, n) {
1626
1699
  const c = t.containerFlow(e, n);
1627
1700
  return t.bulletLastUsed = a, t.bulletCurrent = o, i(), c;
1628
1701
  }
1629
- function Wn(e) {
1702
+ function Vn(e) {
1630
1703
  const r = e.options.listItemIndent || "one";
1631
1704
  if (r !== "tab" && r !== "one" && r !== "mixed")
1632
1705
  throw new Error(
@@ -1634,8 +1707,8 @@ function Wn(e) {
1634
1707
  );
1635
1708
  return r;
1636
1709
  }
1637
- function Hn(e, r, t, n) {
1638
- const i = Wn(t);
1710
+ function Gn(e, r, t, n) {
1711
+ const i = Vn(t);
1639
1712
  let o = t.bulletCurrent || Pe(t);
1640
1713
  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);
1641
1714
  let a = o.length + 1;
@@ -1644,18 +1717,18 @@ function Hn(e, r, t, n) {
1644
1717
  u.move(o + " ".repeat(a - o.length)), u.shift(a);
1645
1718
  const l = t.enter("listItem"), c = t.indentLines(
1646
1719
  t.containerFlow(e, u.current()),
1647
- d
1720
+ f
1648
1721
  );
1649
1722
  return l(), c;
1650
- function d(s, p, b) {
1723
+ function f(s, p, b) {
1651
1724
  return p ? (b ? "" : " ".repeat(a)) + s : (b ? o : o + " ".repeat(a - o.length)) + s;
1652
1725
  }
1653
1726
  }
1654
- function qn(e, r, t, n) {
1727
+ function Zn(e, r, t, n) {
1655
1728
  const i = t.enter("paragraph"), o = t.enter("phrasing"), a = t.containerPhrasing(e, n);
1656
1729
  return o(), i(), a;
1657
1730
  }
1658
- const Kn = (
1731
+ const Jn = (
1659
1732
  /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
1660
1733
  pe([
1661
1734
  "break",
@@ -1681,12 +1754,12 @@ const Kn = (
1681
1754
  "textDirective"
1682
1755
  ])
1683
1756
  );
1684
- function Vn(e, r, t, n) {
1757
+ function Qn(e, r, t, n) {
1685
1758
  return (e.children.some(function(a) {
1686
- return Kn(a);
1759
+ return Jn(a);
1687
1760
  }) ? t.containerPhrasing : t.containerFlow).call(t, e, n);
1688
1761
  }
1689
- function Gn(e) {
1762
+ function Xn(e) {
1690
1763
  const r = e.options.strong || "*";
1691
1764
  if (r !== "*" && r !== "_")
1692
1765
  throw new Error(
@@ -1694,9 +1767,9 @@ function Gn(e) {
1694
1767
  );
1695
1768
  return r;
1696
1769
  }
1697
- At.peek = Zn;
1698
- function At(e, r, t, n) {
1699
- const i = Gn(t), o = t.enter("strong"), a = t.createTracker(n), u = a.move(i + i);
1770
+ St.peek = Yn;
1771
+ function St(e, r, t, n) {
1772
+ const i = Xn(t), o = t.enter("strong"), a = t.createTracker(n), u = a.move(i + i);
1700
1773
  let l = a.move(
1701
1774
  t.containerPhrasing(e, {
1702
1775
  after: i,
@@ -1704,27 +1777,27 @@ function At(e, r, t, n) {
1704
1777
  ...a.current()
1705
1778
  })
1706
1779
  );
1707
- const c = l.charCodeAt(0), d = fe(
1780
+ const c = l.charCodeAt(0), f = fe(
1708
1781
  n.before.charCodeAt(n.before.length - 1),
1709
1782
  c,
1710
1783
  i
1711
1784
  );
1712
- d.inside && (l = ne(c) + l.slice(1));
1785
+ f.inside && (l = ne(c) + l.slice(1));
1713
1786
  const s = l.charCodeAt(l.length - 1), p = fe(n.after.charCodeAt(0), s, i);
1714
1787
  p.inside && (l = l.slice(0, -1) + ne(s));
1715
1788
  const b = a.move(i + i);
1716
1789
  return o(), t.attentionEncodeSurroundingInfo = {
1717
1790
  after: p.outside,
1718
- before: d.outside
1791
+ before: f.outside
1719
1792
  }, u + l + b;
1720
1793
  }
1721
- function Zn(e, r, t) {
1794
+ function Yn(e, r, t) {
1722
1795
  return t.options.strong || "*";
1723
1796
  }
1724
- function Jn(e, r, t, n) {
1797
+ function ea(e, r, t, n) {
1725
1798
  return t.safe(e.value, n);
1726
1799
  }
1727
- function Qn(e) {
1800
+ function ta(e) {
1728
1801
  const r = e.options.ruleRepetition || 3;
1729
1802
  if (r < 3)
1730
1803
  throw new Error(
@@ -1732,50 +1805,50 @@ function Qn(e) {
1732
1805
  );
1733
1806
  return r;
1734
1807
  }
1735
- function Xn(e, r, t) {
1736
- const n = (Tt(t) + (t.options.ruleSpaces ? " " : "")).repeat(Qn(t));
1808
+ function ra(e, r, t) {
1809
+ const n = (Nt(t) + (t.options.ruleSpaces ? " " : "")).repeat(ta(t));
1737
1810
  return t.options.ruleSpaces ? n.slice(0, -1) : n;
1738
1811
  }
1739
- const It = {
1740
- blockquote: kn,
1741
- break: qe,
1742
- code: Tn,
1743
- definition: In,
1744
- emphasis: mt,
1745
- hardBreak: qe,
1746
- heading: Rn,
1747
- html: bt,
1748
- image: kt,
1749
- imageReference: xt,
1750
- inlineCode: wt,
1751
- link: Ct,
1752
- linkReference: vt,
1753
- list: Bn,
1754
- listItem: Hn,
1755
- paragraph: qn,
1756
- root: Vn,
1757
- strong: At,
1758
- text: Jn,
1759
- thematicBreak: Xn
1812
+ const Lt = {
1813
+ blockquote: Cn,
1814
+ break: Ke,
1815
+ code: Sn,
1816
+ definition: Mn,
1817
+ emphasis: bt,
1818
+ hardBreak: Ke,
1819
+ heading: zn,
1820
+ html: wt,
1821
+ image: yt,
1822
+ imageReference: Ct,
1823
+ inlineCode: vt,
1824
+ link: At,
1825
+ linkReference: It,
1826
+ list: Kn,
1827
+ listItem: Gn,
1828
+ paragraph: Zn,
1829
+ root: Qn,
1830
+ strong: St,
1831
+ text: ea,
1832
+ thematicBreak: ra
1760
1833
  };
1761
- function Yn() {
1834
+ function na() {
1762
1835
  return {
1763
1836
  enter: {
1764
- table: ea,
1765
- tableData: Ve,
1766
- tableHeader: Ve,
1767
- tableRow: ra
1837
+ table: aa,
1838
+ tableData: Ge,
1839
+ tableHeader: Ge,
1840
+ tableRow: oa
1768
1841
  },
1769
1842
  exit: {
1770
- codeText: na,
1771
- table: ta,
1843
+ codeText: la,
1844
+ table: ia,
1772
1845
  tableData: Te,
1773
1846
  tableHeader: Te,
1774
1847
  tableRow: Te
1775
1848
  }
1776
1849
  };
1777
1850
  }
1778
- function ea(e) {
1851
+ function aa(e) {
1779
1852
  const r = e._align;
1780
1853
  this.enter(
1781
1854
  {
@@ -1788,28 +1861,28 @@ function ea(e) {
1788
1861
  e
1789
1862
  ), this.data.inTable = !0;
1790
1863
  }
1791
- function ta(e) {
1864
+ function ia(e) {
1792
1865
  this.exit(e), this.data.inTable = void 0;
1793
1866
  }
1794
- function ra(e) {
1867
+ function oa(e) {
1795
1868
  this.enter({ type: "tableRow", children: [] }, e);
1796
1869
  }
1797
1870
  function Te(e) {
1798
1871
  this.exit(e);
1799
1872
  }
1800
- function Ve(e) {
1873
+ function Ge(e) {
1801
1874
  this.enter({ type: "tableCell", children: [] }, e);
1802
1875
  }
1803
- function na(e) {
1876
+ function la(e) {
1804
1877
  let r = this.resume();
1805
- this.data.inTable && (r = r.replace(/\\([\\|])/g, aa));
1878
+ this.data.inTable && (r = r.replace(/\\([\\|])/g, ua));
1806
1879
  const t = this.stack[this.stack.length - 1];
1807
1880
  t.type, t.value = r, this.exit(e);
1808
1881
  }
1809
- function aa(e, r) {
1882
+ function ua(e, r) {
1810
1883
  return r === "|" ? r : e;
1811
1884
  }
1812
- function ia(e) {
1885
+ function ca(e) {
1813
1886
  const r = e || {}, t = r.tableCellPadding, n = r.tablePipeAlign, i = r.stringLength, o = t ? " " : "|";
1814
1887
  return {
1815
1888
  unsafe: [
@@ -1838,15 +1911,15 @@ function ia(e) {
1838
1911
  tableRow: u
1839
1912
  }
1840
1913
  };
1841
- function a(b, f, k, g) {
1842
- return c(d(b, k, g), b.align);
1914
+ function a(b, h, k, g) {
1915
+ return c(f(b, k, g), b.align);
1843
1916
  }
1844
- function u(b, f, k, g) {
1917
+ function u(b, h, k, g) {
1845
1918
  const x = s(b, k, g), w = c([x]);
1846
1919
  return w.slice(0, w.indexOf(`
1847
1920
  `));
1848
1921
  }
1849
- function l(b, f, k, g) {
1922
+ function l(b, h, k, g) {
1850
1923
  const x = k.enter("tableCell"), w = k.enter("phrasing"), y = k.containerPhrasing(b, {
1851
1924
  ...g,
1852
1925
  before: o,
@@ -1854,9 +1927,9 @@ function ia(e) {
1854
1927
  });
1855
1928
  return w(), x(), y;
1856
1929
  }
1857
- function c(b, f) {
1858
- return gn(b, {
1859
- align: f,
1930
+ function c(b, h) {
1931
+ return wn(b, {
1932
+ align: h,
1860
1933
  // @ts-expect-error: `markdown-table` types should support `null`.
1861
1934
  alignDelimiters: n,
1862
1935
  // @ts-expect-error: `markdown-table` types should support `null`.
@@ -1865,47 +1938,47 @@ function ia(e) {
1865
1938
  stringLength: i
1866
1939
  });
1867
1940
  }
1868
- function d(b, f, k) {
1941
+ function f(b, h, k) {
1869
1942
  const g = b.children;
1870
1943
  let x = -1;
1871
- const w = [], y = f.enter("table");
1944
+ const w = [], y = h.enter("table");
1872
1945
  for (; ++x < g.length; )
1873
- w[x] = s(g[x], f, k);
1946
+ w[x] = s(g[x], h, k);
1874
1947
  return y(), w;
1875
1948
  }
1876
- function s(b, f, k) {
1949
+ function s(b, h, k) {
1877
1950
  const g = b.children;
1878
1951
  let x = -1;
1879
- const w = [], y = f.enter("tableRow");
1952
+ const w = [], y = h.enter("tableRow");
1880
1953
  for (; ++x < g.length; )
1881
- w[x] = l(g[x], b, f, k);
1954
+ w[x] = l(g[x], b, h, k);
1882
1955
  return y(), w;
1883
1956
  }
1884
- function p(b, f, k) {
1885
- let g = It.inlineCode(b, f, k);
1957
+ function p(b, h, k) {
1958
+ let g = Lt.inlineCode(b, h, k);
1886
1959
  return k.stack.includes("tableCell") && (g = g.replace(/\|/g, "\\$&")), g;
1887
1960
  }
1888
1961
  }
1889
- function oa() {
1962
+ function sa() {
1890
1963
  return {
1891
1964
  exit: {
1892
- taskListCheckValueChecked: Ge,
1893
- taskListCheckValueUnchecked: Ge,
1894
- paragraph: ua
1965
+ taskListCheckValueChecked: Ze,
1966
+ taskListCheckValueUnchecked: Ze,
1967
+ paragraph: fa
1895
1968
  }
1896
1969
  };
1897
1970
  }
1898
- function la() {
1971
+ function da() {
1899
1972
  return {
1900
1973
  unsafe: [{ atBreak: !0, character: "-", after: "[:|-]" }],
1901
- handlers: { listItem: ca }
1974
+ handlers: { listItem: ha }
1902
1975
  };
1903
1976
  }
1904
- function Ge(e) {
1977
+ function Ze(e) {
1905
1978
  const r = this.stack[this.stack.length - 2];
1906
1979
  r.type, r.checked = e.type === "taskListCheckValueChecked";
1907
1980
  }
1908
- function ua(e) {
1981
+ function fa(e) {
1909
1982
  const r = this.stack[this.stack.length - 2];
1910
1983
  if (r && r.type === "listItem" && typeof r.checked == "boolean") {
1911
1984
  const t = this.stack[this.stack.length - 1];
@@ -1926,35 +1999,35 @@ function ua(e) {
1926
1999
  }
1927
2000
  this.exit(e);
1928
2001
  }
1929
- function ca(e, r, t, n) {
2002
+ function ha(e, r, t, n) {
1930
2003
  const i = e.children[0], o = typeof e.checked == "boolean" && i && i.type === "paragraph", a = "[" + (e.checked ? "x" : " ") + "] ", u = t.createTracker(n);
1931
2004
  o && u.move(a);
1932
- let l = It.listItem(e, r, t, {
2005
+ let l = Lt.listItem(e, r, t, {
1933
2006
  ...n,
1934
2007
  ...u.current()
1935
2008
  });
1936
2009
  return o && (l = l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, c)), l;
1937
- function c(d) {
1938
- return d + a;
2010
+ function c(f) {
2011
+ return f + a;
1939
2012
  }
1940
2013
  }
1941
- function sa() {
2014
+ function ma() {
1942
2015
  return [
1943
- jr(),
1944
- on(),
2016
+ Br(),
1945
2017
  sn(),
1946
- Yn(),
1947
- oa()
2018
+ mn(),
2019
+ na(),
2020
+ sa()
1948
2021
  ];
1949
2022
  }
1950
- function da(e) {
2023
+ function pa(e) {
1951
2024
  return {
1952
2025
  extensions: [
1953
- $r(),
1954
- ln(e),
1955
- dn(),
1956
- ia(e),
1957
- la()
2026
+ Wr(),
2027
+ dn(e),
2028
+ pn(),
2029
+ ca(e),
2030
+ da()
1958
2031
  ]
1959
2032
  };
1960
2033
  }
@@ -1967,24 +2040,24 @@ function ce(e, r, t, n) {
1967
2040
  for (t && e.splice(r, t); o < n.length; )
1968
2041
  a = n.slice(o, o + 1e4), a.unshift(r, 0), e.splice(...a), o += 1e4, r += 1e4;
1969
2042
  }
1970
- const Ze = {}.hasOwnProperty;
1971
- function fa(e) {
2043
+ const Je = {}.hasOwnProperty;
2044
+ function ga(e) {
1972
2045
  const r = {};
1973
2046
  let t = -1;
1974
2047
  for (; ++t < e.length; )
1975
- ha(r, e[t]);
2048
+ ba(r, e[t]);
1976
2049
  return r;
1977
2050
  }
1978
- function ha(e, r) {
2051
+ function ba(e, r) {
1979
2052
  let t;
1980
2053
  for (t in r) {
1981
- const i = (Ze.call(e, t) ? e[t] : void 0) || (e[t] = {}), o = r[t];
2054
+ const i = (Je.call(e, t) ? e[t] : void 0) || (e[t] = {}), o = r[t];
1982
2055
  let a;
1983
2056
  if (o)
1984
2057
  for (a in o) {
1985
- Ze.call(i, a) || (i[a] = []);
2058
+ Je.call(i, a) || (i[a] = []);
1986
2059
  const u = o[a];
1987
- ma(
2060
+ ka(
1988
2061
  // @ts-expect-error Looks like a list.
1989
2062
  i[a],
1990
2063
  Array.isArray(u) ? u : u ? [u] : []
@@ -1992,93 +2065,93 @@ function ha(e, r) {
1992
2065
  }
1993
2066
  }
1994
2067
  }
1995
- function ma(e, r) {
2068
+ function ka(e, r) {
1996
2069
  let t = -1;
1997
2070
  const n = [];
1998
2071
  for (; ++t < r.length; )
1999
2072
  (r[t].add === "after" ? e : n).push(r[t]);
2000
2073
  ce(e, 0, 0, n);
2001
2074
  }
2002
- const pa = {
2003
- tokenize: ya,
2075
+ const xa = {
2076
+ tokenize: Aa,
2004
2077
  partial: !0
2005
- }, Nt = {
2006
- tokenize: Ca,
2078
+ }, Mt = {
2079
+ tokenize: Ia,
2007
2080
  partial: !0
2008
- }, St = {
2009
- tokenize: va,
2081
+ }, Dt = {
2082
+ tokenize: Na,
2010
2083
  partial: !0
2011
- }, Lt = {
2012
- tokenize: Ta,
2084
+ }, Pt = {
2085
+ tokenize: Sa,
2013
2086
  partial: !0
2014
- }, ga = {
2015
- tokenize: Aa,
2087
+ }, wa = {
2088
+ tokenize: La,
2016
2089
  partial: !0
2017
- }, Mt = {
2090
+ }, Rt = {
2018
2091
  name: "wwwAutolink",
2019
- tokenize: xa,
2020
- previous: Pt
2021
- }, Dt = {
2092
+ tokenize: va,
2093
+ previous: _t
2094
+ }, Et = {
2022
2095
  name: "protocolAutolink",
2023
- tokenize: wa,
2024
- previous: Rt
2096
+ tokenize: Ta,
2097
+ previous: Ft
2025
2098
  }, $ = {
2026
2099
  name: "emailAutolink",
2027
- tokenize: ka,
2028
- previous: Et
2100
+ tokenize: Ca,
2101
+ previous: zt
2029
2102
  }, R = {};
2030
- function ba() {
2103
+ function ya() {
2031
2104
  return {
2032
2105
  text: R
2033
2106
  };
2034
2107
  }
2035
- let U = 48;
2036
- for (; U < 123; )
2037
- R[U] = $, U++, U === 58 ? U = 65 : U === 91 && (U = 97);
2108
+ let W = 48;
2109
+ for (; W < 123; )
2110
+ R[W] = $, W++, W === 58 ? W = 65 : W === 91 && (W = 97);
2038
2111
  R[43] = $;
2039
2112
  R[45] = $;
2040
2113
  R[46] = $;
2041
2114
  R[95] = $;
2042
- R[72] = [$, Dt];
2043
- R[104] = [$, Dt];
2044
- R[87] = [$, Mt];
2045
- R[119] = [$, Mt];
2046
- function ka(e, r, t) {
2115
+ R[72] = [$, Et];
2116
+ R[104] = [$, Et];
2117
+ R[87] = [$, Rt];
2118
+ R[119] = [$, Rt];
2119
+ function Ca(e, r, t) {
2047
2120
  const n = this;
2048
2121
  let i, o;
2049
2122
  return a;
2050
2123
  function a(s) {
2051
- return !Le(s) || !Et.call(n, n.previous) || Re(n.events) ? t(s) : (e.enter("literalAutolink"), e.enter("literalAutolinkEmail"), u(s));
2124
+ return !Le(s) || !zt.call(n, n.previous) || Re(n.events) ? t(s) : (e.enter("literalAutolink"), e.enter("literalAutolinkEmail"), u(s));
2052
2125
  }
2053
2126
  function u(s) {
2054
2127
  return Le(s) ? (e.consume(s), u) : s === 64 ? (e.consume(s), l) : t(s);
2055
2128
  }
2056
2129
  function l(s) {
2057
- return s === 46 ? e.check(ga, d, c)(s) : s === 45 || s === 95 || Me(s) ? (o = !0, e.consume(s), l) : d(s);
2130
+ return s === 46 ? e.check(wa, f, c)(s) : s === 45 || s === 95 || Me(s) ? (o = !0, e.consume(s), l) : f(s);
2058
2131
  }
2059
2132
  function c(s) {
2060
2133
  return e.consume(s), i = !0, l;
2061
2134
  }
2062
- function d(s) {
2135
+ function f(s) {
2063
2136
  return o && i && re(n.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(s)) : t(s);
2064
2137
  }
2065
2138
  }
2066
- function xa(e, r, t) {
2139
+ function va(e, r, t) {
2067
2140
  const n = this;
2068
2141
  return i;
2069
2142
  function i(a) {
2070
- return a !== 87 && a !== 119 || !Pt.call(n, n.previous) || Re(n.events) ? t(a) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(pa, e.attempt(Nt, e.attempt(St, o), t), t)(a));
2143
+ return a !== 87 && a !== 119 || !_t.call(n, n.previous) || Re(n.events) ? t(a) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(xa, e.attempt(Mt, e.attempt(Dt, o), t), t)(a));
2071
2144
  }
2072
2145
  function o(a) {
2073
2146
  return e.exit("literalAutolinkWww"), e.exit("literalAutolink"), r(a);
2074
2147
  }
2075
2148
  }
2076
- function wa(e, r, t) {
2149
+ function Ta(e, r, t) {
2077
2150
  const n = this;
2078
2151
  let i = "", o = !1;
2079
2152
  return a;
2080
2153
  function a(s) {
2081
- return (s === 72 || s === 104) && Rt.call(n, n.previous) && !Re(n.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), i += String.fromCodePoint(s), e.consume(s), u) : t(s);
2154
+ return (s === 72 || s === 104) && Ft.call(n, n.previous) && !Re(n.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), i += String.fromCodePoint(s), e.consume(s), u) : t(s);
2082
2155
  }
2083
2156
  function u(s) {
2084
2157
  if (re(s) && i.length < 5)
@@ -2094,13 +2167,13 @@ function wa(e, r, t) {
2094
2167
  return s === 47 ? (e.consume(s), o ? c : (o = !0, l)) : t(s);
2095
2168
  }
2096
2169
  function c(s) {
2097
- return s === null || Tr(s) || D(s) || H(s) || he(s) ? t(s) : e.attempt(Nt, e.attempt(St, d), t)(s);
2170
+ return s === null || Sr(s) || M(s) || H(s) || he(s) ? t(s) : e.attempt(Mt, e.attempt(Dt, f), t)(s);
2098
2171
  }
2099
- function d(s) {
2172
+ function f(s) {
2100
2173
  return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(s);
2101
2174
  }
2102
2175
  }
2103
- function ya(e, r, t) {
2176
+ function Aa(e, r, t) {
2104
2177
  let n = 0;
2105
2178
  return i;
2106
2179
  function i(a) {
@@ -2110,11 +2183,11 @@ function ya(e, r, t) {
2110
2183
  return a === null ? t(a) : r(a);
2111
2184
  }
2112
2185
  }
2113
- function Ca(e, r, t) {
2186
+ function Ia(e, r, t) {
2114
2187
  let n, i, o;
2115
2188
  return a;
2116
2189
  function a(c) {
2117
- return c === 46 || c === 95 ? e.check(Lt, l, u)(c) : c === null || D(c) || H(c) || c !== 45 && he(c) ? l(c) : (o = !0, e.consume(c), a);
2190
+ return c === 46 || c === 95 ? e.check(Pt, l, u)(c) : c === null || M(c) || H(c) || c !== 45 && he(c) ? l(c) : (o = !0, e.consume(c), a);
2118
2191
  }
2119
2192
  function u(c) {
2120
2193
  return c === 95 ? n = !0 : (i = n, n = void 0), e.consume(c), a;
@@ -2123,27 +2196,27 @@ function Ca(e, r, t) {
2123
2196
  return i || n || !o ? t(c) : r(c);
2124
2197
  }
2125
2198
  }
2126
- function va(e, r) {
2199
+ function Na(e, r) {
2127
2200
  let t = 0, n = 0;
2128
2201
  return i;
2129
2202
  function i(a) {
2130
- return a === 40 ? (t++, e.consume(a), i) : a === 41 && n < t ? o(a) : a === 33 || a === 34 || a === 38 || a === 39 || a === 41 || a === 42 || a === 44 || a === 46 || a === 58 || a === 59 || a === 60 || a === 63 || a === 93 || a === 95 || a === 126 ? e.check(Lt, r, o)(a) : a === null || D(a) || H(a) ? r(a) : (e.consume(a), i);
2203
+ return a === 40 ? (t++, e.consume(a), i) : a === 41 && n < t ? o(a) : a === 33 || a === 34 || a === 38 || a === 39 || a === 41 || a === 42 || a === 44 || a === 46 || a === 58 || a === 59 || a === 60 || a === 63 || a === 93 || a === 95 || a === 126 ? e.check(Pt, r, o)(a) : a === null || M(a) || H(a) ? r(a) : (e.consume(a), i);
2131
2204
  }
2132
2205
  function o(a) {
2133
2206
  return a === 41 && n++, e.consume(a), i;
2134
2207
  }
2135
2208
  }
2136
- function Ta(e, r, t) {
2209
+ function Sa(e, r, t) {
2137
2210
  return n;
2138
2211
  function n(u) {
2139
2212
  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), n) : u === 38 ? (e.consume(u), o) : u === 93 ? (e.consume(u), i) : (
2140
2213
  // `<` is an end.
2141
2214
  u === 60 || // So is whitespace.
2142
- u === null || D(u) || H(u) ? r(u) : t(u)
2215
+ u === null || M(u) || H(u) ? r(u) : t(u)
2143
2216
  );
2144
2217
  }
2145
2218
  function i(u) {
2146
- return u === null || u === 40 || u === 91 || D(u) || H(u) ? r(u) : n(u);
2219
+ return u === null || u === 40 || u === 91 || M(u) || H(u) ? r(u) : n(u);
2147
2220
  }
2148
2221
  function o(u) {
2149
2222
  return re(u) ? a(u) : t(u);
@@ -2152,7 +2225,7 @@ function Ta(e, r, t) {
2152
2225
  return u === 59 ? (e.consume(u), n) : re(u) ? (e.consume(u), a) : t(u);
2153
2226
  }
2154
2227
  }
2155
- function Aa(e, r, t) {
2228
+ function La(e, r, t) {
2156
2229
  return n;
2157
2230
  function n(o) {
2158
2231
  return e.consume(o), i;
@@ -2161,13 +2234,13 @@ function Aa(e, r, t) {
2161
2234
  return Me(o) ? t(o) : r(o);
2162
2235
  }
2163
2236
  }
2164
- function Pt(e) {
2165
- return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || D(e);
2237
+ function _t(e) {
2238
+ return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || M(e);
2166
2239
  }
2167
- function Rt(e) {
2240
+ function Ft(e) {
2168
2241
  return !re(e);
2169
2242
  }
2170
- function Et(e) {
2243
+ function zt(e) {
2171
2244
  return !(e === 47 || Le(e));
2172
2245
  }
2173
2246
  function Le(e) {
@@ -2188,7 +2261,7 @@ function Re(e) {
2188
2261
  }
2189
2262
  return e.length > 0 && !t && (e[e.length - 1][1]._gfmAutolinkLiteralWalkedInto = !0), t;
2190
2263
  }
2191
- function Ia(e, r, t) {
2264
+ function Ma(e, r, t) {
2192
2265
  const n = [];
2193
2266
  let i = -1;
2194
2267
  for (; ++i < e.length; ) {
@@ -2208,11 +2281,11 @@ function z(e, r, t, n) {
2208
2281
  return F(l) && o++ < i ? (e.consume(l), u) : (e.exit(t), r(l));
2209
2282
  }
2210
2283
  }
2211
- const Na = {
2284
+ const Da = {
2212
2285
  partial: !0,
2213
- tokenize: Sa
2286
+ tokenize: Pa
2214
2287
  };
2215
- function Sa(e, r, t) {
2288
+ function Pa(e, r, t) {
2216
2289
  return n;
2217
2290
  function n(o) {
2218
2291
  return F(o) ? z(e, i, "linePrefix")(o) : i(o);
@@ -2221,37 +2294,37 @@ function Sa(e, r, t) {
2221
2294
  return o === null || Z(o) ? r(o) : t(o);
2222
2295
  }
2223
2296
  }
2224
- const La = {
2225
- tokenize: za,
2297
+ const Ra = {
2298
+ tokenize: Ua,
2226
2299
  partial: !0
2227
2300
  };
2228
- function Ma() {
2301
+ function Ea() {
2229
2302
  return {
2230
2303
  document: {
2231
2304
  91: {
2232
2305
  name: "gfmFootnoteDefinition",
2233
- tokenize: Ea,
2306
+ tokenize: ja,
2234
2307
  continuation: {
2235
- tokenize: _a
2308
+ tokenize: $a
2236
2309
  },
2237
- exit: Fa
2310
+ exit: Oa
2238
2311
  }
2239
2312
  },
2240
2313
  text: {
2241
2314
  91: {
2242
2315
  name: "gfmFootnoteCall",
2243
- tokenize: Ra
2316
+ tokenize: za
2244
2317
  },
2245
2318
  93: {
2246
2319
  name: "gfmPotentialFootnoteCall",
2247
2320
  add: "after",
2248
- tokenize: Da,
2249
- resolveTo: Pa
2321
+ tokenize: _a,
2322
+ resolveTo: Fa
2250
2323
  }
2251
2324
  }
2252
2325
  };
2253
2326
  }
2254
- function Da(e, r, t) {
2327
+ function _a(e, r, t) {
2255
2328
  const n = this;
2256
2329
  let i = n.events.length;
2257
2330
  const o = n.parser.gfmFootnotes || (n.parser.gfmFootnotes = []);
@@ -2276,7 +2349,7 @@ function Da(e, r, t) {
2276
2349
  return c.codePointAt(0) !== 94 || !o.includes(c.slice(1)) ? t(l) : (e.enter("gfmFootnoteCallLabelMarker"), e.consume(l), e.exit("gfmFootnoteCallLabelMarker"), r(l));
2277
2350
  }
2278
2351
  }
2279
- function Pa(e, r) {
2352
+ function Fa(e, r) {
2280
2353
  let t = e.length;
2281
2354
  for (; t--; )
2282
2355
  if (e[t][1].type === "labelImage" && e[t][0] === "enter") {
@@ -2326,7 +2399,7 @@ function Pa(e, r) {
2326
2399
  ];
2327
2400
  return e.splice(t, e.length - t + 1, ...u), e;
2328
2401
  }
2329
- function Ra(e, r, t) {
2402
+ function za(e, r, t) {
2330
2403
  const n = this, i = n.parser.gfmFootnotes || (n.parser.gfmFootnotes = []);
2331
2404
  let o = 0, a;
2332
2405
  return u;
@@ -2342,7 +2415,7 @@ function Ra(e, r, t) {
2342
2415
  o > 999 || // Closing brace with nothing.
2343
2416
  s === 93 && !a || // Space or tab is not supported by GFM for some reason.
2344
2417
  // `\n` and `[` not being supported makes sense.
2345
- s === null || s === 91 || D(s)
2418
+ s === null || s === 91 || M(s)
2346
2419
  )
2347
2420
  return t(s);
2348
2421
  if (s === 93) {
@@ -2350,55 +2423,55 @@ function Ra(e, r, t) {
2350
2423
  const p = e.exit("gfmFootnoteCallString");
2351
2424
  return i.includes(ae(n.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(s), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), r) : t(s);
2352
2425
  }
2353
- return D(s) || (a = !0), o++, e.consume(s), s === 92 ? d : c;
2426
+ return M(s) || (a = !0), o++, e.consume(s), s === 92 ? f : c;
2354
2427
  }
2355
- function d(s) {
2428
+ function f(s) {
2356
2429
  return s === 91 || s === 92 || s === 93 ? (e.consume(s), o++, c) : c(s);
2357
2430
  }
2358
2431
  }
2359
- function Ea(e, r, t) {
2432
+ function ja(e, r, t) {
2360
2433
  const n = this, i = n.parser.gfmFootnotes || (n.parser.gfmFootnotes = []);
2361
2434
  let o, a = 0, u;
2362
2435
  return l;
2363
- function l(f) {
2364
- return e.enter("gfmFootnoteDefinition")._container = !0, e.enter("gfmFootnoteDefinitionLabel"), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(f), e.exit("gfmFootnoteDefinitionLabelMarker"), c;
2436
+ function l(h) {
2437
+ return e.enter("gfmFootnoteDefinition")._container = !0, e.enter("gfmFootnoteDefinitionLabel"), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"), c;
2365
2438
  }
2366
- function c(f) {
2367
- return f === 94 ? (e.enter("gfmFootnoteDefinitionMarker"), e.consume(f), e.exit("gfmFootnoteDefinitionMarker"), e.enter("gfmFootnoteDefinitionLabelString"), e.enter("chunkString").contentType = "string", d) : t(f);
2439
+ function c(h) {
2440
+ return h === 94 ? (e.enter("gfmFootnoteDefinitionMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionMarker"), e.enter("gfmFootnoteDefinitionLabelString"), e.enter("chunkString").contentType = "string", f) : t(h);
2368
2441
  }
2369
- function d(f) {
2442
+ function f(h) {
2370
2443
  if (
2371
2444
  // Too long.
2372
2445
  a > 999 || // Closing brace with nothing.
2373
- f === 93 && !u || // Space or tab is not supported by GFM for some reason.
2446
+ h === 93 && !u || // Space or tab is not supported by GFM for some reason.
2374
2447
  // `\n` and `[` not being supported makes sense.
2375
- f === null || f === 91 || D(f)
2448
+ h === null || h === 91 || M(h)
2376
2449
  )
2377
- return t(f);
2378
- if (f === 93) {
2450
+ return t(h);
2451
+ if (h === 93) {
2379
2452
  e.exit("chunkString");
2380
2453
  const k = e.exit("gfmFootnoteDefinitionLabelString");
2381
- return o = ae(n.sliceSerialize(k)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(f), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
2454
+ return o = ae(n.sliceSerialize(k)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
2382
2455
  }
2383
- return D(f) || (u = !0), a++, e.consume(f), f === 92 ? s : d;
2456
+ return M(h) || (u = !0), a++, e.consume(h), h === 92 ? s : f;
2384
2457
  }
2385
- function s(f) {
2386
- return f === 91 || f === 92 || f === 93 ? (e.consume(f), a++, d) : d(f);
2458
+ function s(h) {
2459
+ return h === 91 || h === 92 || h === 93 ? (e.consume(h), a++, f) : f(h);
2387
2460
  }
2388
- function p(f) {
2389
- return f === 58 ? (e.enter("definitionMarker"), e.consume(f), e.exit("definitionMarker"), i.includes(o) || i.push(o), z(e, b, "gfmFootnoteDefinitionWhitespace")) : t(f);
2461
+ function p(h) {
2462
+ return h === 58 ? (e.enter("definitionMarker"), e.consume(h), e.exit("definitionMarker"), i.includes(o) || i.push(o), z(e, b, "gfmFootnoteDefinitionWhitespace")) : t(h);
2390
2463
  }
2391
- function b(f) {
2392
- return r(f);
2464
+ function b(h) {
2465
+ return r(h);
2393
2466
  }
2394
2467
  }
2395
- function _a(e, r, t) {
2396
- return e.check(Na, r, e.attempt(La, r, t));
2468
+ function $a(e, r, t) {
2469
+ return e.check(Da, r, e.attempt(Ra, r, t));
2397
2470
  }
2398
- function Fa(e) {
2471
+ function Oa(e) {
2399
2472
  e.exit("gfmFootnoteDefinition");
2400
2473
  }
2401
- function za(e, r, t) {
2474
+ function Ua(e, r, t) {
2402
2475
  const n = this;
2403
2476
  return z(e, i, "gfmFootnoteDefinitionIndent", 5);
2404
2477
  function i(o) {
@@ -2406,7 +2479,7 @@ function za(e, r, t) {
2406
2479
  return a && a[1].type === "gfmFootnoteDefinitionIndent" && a[2].sliceSerialize(a[1], !0).length === 4 ? r(o) : t(o);
2407
2480
  }
2408
2481
  }
2409
- function ja(e) {
2482
+ function Ba(e) {
2410
2483
  let t = (e || {}).singleTilde;
2411
2484
  const n = {
2412
2485
  name: "strikethrough",
@@ -2433,7 +2506,7 @@ function ja(e) {
2433
2506
  if (a[c][0] === "exit" && a[c][1].type === "strikethroughSequenceTemporary" && a[c][1]._open && // If the sizes are the same:
2434
2507
  a[l][1].end.offset - a[l][1].start.offset === a[c][1].end.offset - a[c][1].start.offset) {
2435
2508
  a[l][1].type = "strikethroughSequence", a[c][1].type = "strikethroughSequence";
2436
- const d = {
2509
+ const f = {
2437
2510
  type: "strikethrough",
2438
2511
  start: Object.assign({}, a[c][1].start),
2439
2512
  end: Object.assign({}, a[l][1].end)
@@ -2441,8 +2514,8 @@ function ja(e) {
2441
2514
  type: "strikethroughText",
2442
2515
  start: Object.assign({}, a[c][1].end),
2443
2516
  end: Object.assign({}, a[l][1].start)
2444
- }, p = [["enter", d, u], ["enter", a[c][1], u], ["exit", a[c][1], u], ["enter", s, u]], b = u.parser.constructs.insideSpan.null;
2445
- b && ce(p, p.length, 0, Ia(b, a.slice(c + 1, l), u)), ce(p, p.length, 0, [["exit", s, u], ["enter", a[l][1], u], ["exit", a[l][1], u], ["exit", d, u]]), ce(a, c - 1, l - c + 3, p), l = c + p.length - 2;
2517
+ }, p = [["enter", f, u], ["enter", a[c][1], u], ["exit", a[c][1], u], ["enter", s, u]], b = u.parser.constructs.insideSpan.null;
2518
+ b && ce(p, p.length, 0, Ma(b, a.slice(c + 1, l), u)), ce(p, p.length, 0, [["exit", s, u], ["enter", a[l][1], u], ["exit", a[l][1], u], ["exit", f, u]]), ce(a, c - 1, l - c + 3, p), l = c + p.length - 2;
2446
2519
  break;
2447
2520
  }
2448
2521
  }
@@ -2451,23 +2524,23 @@ function ja(e) {
2451
2524
  return a;
2452
2525
  }
2453
2526
  function o(a, u, l) {
2454
- const c = this.previous, d = this.events;
2527
+ const c = this.previous, f = this.events;
2455
2528
  let s = 0;
2456
2529
  return p;
2457
- function p(f) {
2458
- return c === 126 && d[d.length - 1][1].type !== "characterEscape" ? l(f) : (a.enter("strikethroughSequenceTemporary"), b(f));
2530
+ function p(h) {
2531
+ return c === 126 && f[f.length - 1][1].type !== "characterEscape" ? l(h) : (a.enter("strikethroughSequenceTemporary"), b(h));
2459
2532
  }
2460
- function b(f) {
2533
+ function b(h) {
2461
2534
  const k = de(c);
2462
- if (f === 126)
2463
- return s > 1 ? l(f) : (a.consume(f), s++, b);
2464
- if (s < 2 && !t) return l(f);
2465
- const g = a.exit("strikethroughSequenceTemporary"), x = de(f);
2466
- return g._open = !x || x === 2 && !!k, g._close = !k || k === 2 && !!x, u(f);
2535
+ if (h === 126)
2536
+ return s > 1 ? l(h) : (a.consume(h), s++, b);
2537
+ if (s < 2 && !t) return l(h);
2538
+ const g = a.exit("strikethroughSequenceTemporary"), x = de(h);
2539
+ return g._open = !x || x === 2 && !!k, g._close = !k || k === 2 && !!x, u(h);
2467
2540
  }
2468
2541
  }
2469
2542
  }
2470
- class $a {
2543
+ class Wa {
2471
2544
  /**
2472
2545
  * Create a new edit map.
2473
2546
  */
@@ -2483,7 +2556,7 @@ class $a {
2483
2556
  * @returns {undefined}
2484
2557
  */
2485
2558
  add(r, t, n) {
2486
- Oa(this, r, t, n);
2559
+ Ha(this, r, t, n);
2487
2560
  }
2488
2561
  // To do: add this when moving to `micromark`.
2489
2562
  // /**
@@ -2522,7 +2595,7 @@ class $a {
2522
2595
  this.map.length = 0;
2523
2596
  }
2524
2597
  }
2525
- function Oa(e, r, t, n) {
2598
+ function Ha(e, r, t, n) {
2526
2599
  let i = 0;
2527
2600
  if (!(t === 0 && n.length === 0)) {
2528
2601
  for (; i < e.map.length; ) {
@@ -2535,7 +2608,7 @@ function Oa(e, r, t, n) {
2535
2608
  e.map.push([r, t, n]);
2536
2609
  }
2537
2610
  }
2538
- function Ua(e, r) {
2611
+ function qa(e, r) {
2539
2612
  let t = !1;
2540
2613
  const n = [];
2541
2614
  for (; r < e.length; ) {
@@ -2555,27 +2628,27 @@ function Ua(e, r) {
2555
2628
  }
2556
2629
  return n;
2557
2630
  }
2558
- function Ba() {
2631
+ function Ka() {
2559
2632
  return {
2560
2633
  flow: {
2561
2634
  null: {
2562
2635
  name: "table",
2563
- tokenize: Wa,
2564
- resolveAll: Ha
2636
+ tokenize: Va,
2637
+ resolveAll: Ga
2565
2638
  }
2566
2639
  }
2567
2640
  };
2568
2641
  }
2569
- function Wa(e, r, t) {
2642
+ function Va(e, r, t) {
2570
2643
  const n = this;
2571
2644
  let i = 0, o = 0, a;
2572
2645
  return u;
2573
2646
  function u(m) {
2574
2647
  let P = n.events.length - 1;
2575
2648
  for (; P > -1; ) {
2576
- const J = n.events[P][1].type;
2577
- if (J === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
2578
- J === "linePrefix") P--;
2649
+ const Q = n.events[P][1].type;
2650
+ if (Q === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
2651
+ Q === "linePrefix") P--;
2579
2652
  else break;
2580
2653
  }
2581
2654
  const ie = P > -1 ? n.events[P][1].type : null, O = ie === "tableHead" || ie === "tableRow" ? C : l;
@@ -2585,31 +2658,31 @@ function Wa(e, r, t) {
2585
2658
  return e.enter("tableHead"), e.enter("tableRow"), c(m);
2586
2659
  }
2587
2660
  function c(m) {
2588
- return m === 124 || (a = !0, o += 1), d(m);
2661
+ return m === 124 || (a = !0, o += 1), f(m);
2589
2662
  }
2590
- function d(m) {
2591
- return m === null ? t(m) : Z(m) ? o > 1 ? (o = 0, n.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(m), e.exit("lineEnding"), b) : t(m) : F(m) ? z(e, d, "whitespace")(m) : (o += 1, a && (a = !1, i += 1), m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), a = !0, d) : (e.enter("data"), s(m)));
2663
+ function f(m) {
2664
+ return m === null ? t(m) : Z(m) ? o > 1 ? (o = 0, n.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(m), e.exit("lineEnding"), b) : t(m) : F(m) ? z(e, f, "whitespace")(m) : (o += 1, a && (a = !1, i += 1), m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), a = !0, f) : (e.enter("data"), s(m)));
2592
2665
  }
2593
2666
  function s(m) {
2594
- return m === null || m === 124 || D(m) ? (e.exit("data"), d(m)) : (e.consume(m), m === 92 ? p : s);
2667
+ return m === null || m === 124 || M(m) ? (e.exit("data"), f(m)) : (e.consume(m), m === 92 ? p : s);
2595
2668
  }
2596
2669
  function p(m) {
2597
2670
  return m === 92 || m === 124 ? (e.consume(m), s) : s(m);
2598
2671
  }
2599
2672
  function b(m) {
2600
- return n.interrupt = !1, n.parser.lazy[n.now().line] ? t(m) : (e.enter("tableDelimiterRow"), a = !1, F(m) ? z(e, f, "linePrefix", n.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(m) : f(m));
2673
+ return n.interrupt = !1, n.parser.lazy[n.now().line] ? t(m) : (e.enter("tableDelimiterRow"), a = !1, F(m) ? z(e, h, "linePrefix", n.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(m) : h(m));
2601
2674
  }
2602
- function f(m) {
2603
- return m === 45 || m === 58 ? g(m) : m === 124 ? (a = !0, e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), k) : T(m);
2675
+ function h(m) {
2676
+ return m === 45 || m === 58 ? g(m) : m === 124 ? (a = !0, e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), k) : v(m);
2604
2677
  }
2605
2678
  function k(m) {
2606
2679
  return F(m) ? z(e, g, "whitespace")(m) : g(m);
2607
2680
  }
2608
2681
  function g(m) {
2609
- return m === 58 ? (o += 1, a = !0, e.enter("tableDelimiterMarker"), e.consume(m), e.exit("tableDelimiterMarker"), x) : m === 45 ? (o += 1, x(m)) : m === null || Z(m) ? A(m) : T(m);
2682
+ return m === 58 ? (o += 1, a = !0, e.enter("tableDelimiterMarker"), e.consume(m), e.exit("tableDelimiterMarker"), x) : m === 45 ? (o += 1, x(m)) : m === null || Z(m) ? A(m) : v(m);
2610
2683
  }
2611
2684
  function x(m) {
2612
- return m === 45 ? (e.enter("tableDelimiterFiller"), w(m)) : T(m);
2685
+ return m === 45 ? (e.enter("tableDelimiterFiller"), w(m)) : v(m);
2613
2686
  }
2614
2687
  function w(m) {
2615
2688
  return m === 45 ? (e.consume(m), w) : m === 58 ? (a = !0, e.exit("tableDelimiterFiller"), e.enter("tableDelimiterMarker"), e.consume(m), e.exit("tableDelimiterMarker"), y) : (e.exit("tableDelimiterFiller"), y(m));
@@ -2618,44 +2691,44 @@ function Wa(e, r, t) {
2618
2691
  return F(m) ? z(e, A, "whitespace")(m) : A(m);
2619
2692
  }
2620
2693
  function A(m) {
2621
- return m === 124 ? f(m) : m === null || Z(m) ? !a || i !== o ? T(m) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), r(m)) : T(m);
2694
+ return m === 124 ? h(m) : m === null || Z(m) ? !a || i !== o ? v(m) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), r(m)) : v(m);
2622
2695
  }
2623
- function T(m) {
2696
+ function v(m) {
2624
2697
  return t(m);
2625
2698
  }
2626
2699
  function C(m) {
2627
- return e.enter("tableRow"), L(m);
2700
+ return e.enter("tableRow"), D(m);
2628
2701
  }
2629
- function L(m) {
2630
- return m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), L) : m === null || Z(m) ? (e.exit("tableRow"), r(m)) : F(m) ? z(e, L, "whitespace")(m) : (e.enter("data"), E(m));
2702
+ function D(m) {
2703
+ return m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), D) : m === null || Z(m) ? (e.exit("tableRow"), r(m)) : F(m) ? z(e, D, "whitespace")(m) : (e.enter("data"), E(m));
2631
2704
  }
2632
2705
  function E(m) {
2633
- return m === null || m === 124 || D(m) ? (e.exit("data"), L(m)) : (e.consume(m), m === 92 ? q : E);
2706
+ return m === null || m === 124 || M(m) ? (e.exit("data"), D(m)) : (e.consume(m), m === 92 ? q : E);
2634
2707
  }
2635
2708
  function q(m) {
2636
2709
  return m === 92 || m === 124 ? (e.consume(m), E) : E(m);
2637
2710
  }
2638
2711
  }
2639
- function Ha(e, r) {
2640
- let t = -1, n = !0, i = 0, o = [0, 0, 0, 0], a = [0, 0, 0, 0], u = !1, l = 0, c, d, s;
2641
- const p = new $a();
2712
+ function Ga(e, r) {
2713
+ let t = -1, n = !0, i = 0, o = [0, 0, 0, 0], a = [0, 0, 0, 0], u = !1, l = 0, c, f, s;
2714
+ const p = new Wa();
2642
2715
  for (; ++t < e.length; ) {
2643
- const b = e[t], f = b[1];
2644
- b[0] === "enter" ? f.type === "tableHead" ? (u = !1, l !== 0 && (Je(p, r, l, c, d), d = void 0, l = 0), c = {
2716
+ const b = e[t], h = b[1];
2717
+ b[0] === "enter" ? h.type === "tableHead" ? (u = !1, l !== 0 && (Qe(p, r, l, c, f), f = void 0, l = 0), c = {
2645
2718
  type: "table",
2646
- start: Object.assign({}, f.start),
2719
+ start: Object.assign({}, h.start),
2647
2720
  // Note: correct end is set later.
2648
- end: Object.assign({}, f.end)
2649
- }, p.add(t, 0, [["enter", c, r]])) : f.type === "tableRow" || f.type === "tableDelimiterRow" ? (n = !0, s = void 0, o = [0, 0, 0, 0], a = [0, t + 1, 0, 0], u && (u = !1, d = {
2721
+ end: Object.assign({}, h.end)
2722
+ }, p.add(t, 0, [["enter", c, r]])) : h.type === "tableRow" || h.type === "tableDelimiterRow" ? (n = !0, s = void 0, o = [0, 0, 0, 0], a = [0, t + 1, 0, 0], u && (u = !1, f = {
2650
2723
  type: "tableBody",
2651
- start: Object.assign({}, f.start),
2724
+ start: Object.assign({}, h.start),
2652
2725
  // Note: correct end is set later.
2653
- end: Object.assign({}, f.end)
2654
- }, p.add(t, 0, [["enter", d, r]])), i = f.type === "tableDelimiterRow" ? 2 : d ? 3 : 1) : i && (f.type === "data" || f.type === "tableDelimiterMarker" || f.type === "tableDelimiterFiller") ? (n = !1, a[2] === 0 && (o[1] !== 0 && (a[0] = a[1], s = ue(p, r, o, i, void 0, s), o = [0, 0, 0, 0]), a[2] = t)) : f.type === "tableCellDivider" && (n ? n = !1 : (o[1] !== 0 && (a[0] = a[1], s = ue(p, r, o, i, void 0, s)), o = a, a = [o[1], t, 0, 0])) : f.type === "tableHead" ? (u = !0, l = t) : f.type === "tableRow" || f.type === "tableDelimiterRow" ? (l = t, o[1] !== 0 ? (a[0] = a[1], s = ue(p, r, o, i, t, s)) : a[1] !== 0 && (s = ue(p, r, a, i, t, s)), i = 0) : i && (f.type === "data" || f.type === "tableDelimiterMarker" || f.type === "tableDelimiterFiller") && (a[3] = t);
2726
+ end: Object.assign({}, h.end)
2727
+ }, p.add(t, 0, [["enter", f, r]])), i = h.type === "tableDelimiterRow" ? 2 : f ? 3 : 1) : i && (h.type === "data" || h.type === "tableDelimiterMarker" || h.type === "tableDelimiterFiller") ? (n = !1, a[2] === 0 && (o[1] !== 0 && (a[0] = a[1], s = ue(p, r, o, i, void 0, s), o = [0, 0, 0, 0]), a[2] = t)) : h.type === "tableCellDivider" && (n ? n = !1 : (o[1] !== 0 && (a[0] = a[1], s = ue(p, r, o, i, void 0, s)), o = a, a = [o[1], t, 0, 0])) : h.type === "tableHead" ? (u = !0, l = t) : h.type === "tableRow" || h.type === "tableDelimiterRow" ? (l = t, o[1] !== 0 ? (a[0] = a[1], s = ue(p, r, o, i, t, s)) : a[1] !== 0 && (s = ue(p, r, a, i, t, s)), i = 0) : i && (h.type === "data" || h.type === "tableDelimiterMarker" || h.type === "tableDelimiterFiller") && (a[3] = t);
2655
2728
  }
2656
- for (l !== 0 && Je(p, r, l, c, d), p.consume(r.events), t = -1; ++t < r.events.length; ) {
2729
+ for (l !== 0 && Qe(p, r, l, c, f), p.consume(r.events), t = -1; ++t < r.events.length; ) {
2657
2730
  const b = r.events[t];
2658
- b[0] === "enter" && b[1].type === "table" && (b[1]._align = Ua(r.events, t));
2731
+ b[0] === "enter" && b[1].type === "table" && (b[1]._align = qa(r.events, t));
2659
2732
  }
2660
2733
  return e;
2661
2734
  }
@@ -2669,23 +2742,23 @@ function ue(e, r, t, n, i, o) {
2669
2742
  // Note: correct end is set later.
2670
2743
  end: Object.assign({}, l)
2671
2744
  }, e.add(t[1], 0, [["enter", o, r]]), t[2] !== 0) {
2672
- const c = G(r.events, t[2]), d = G(r.events, t[3]), s = {
2745
+ const c = G(r.events, t[2]), f = G(r.events, t[3]), s = {
2673
2746
  type: u,
2674
2747
  start: Object.assign({}, c),
2675
- end: Object.assign({}, d)
2748
+ end: Object.assign({}, f)
2676
2749
  };
2677
2750
  if (e.add(t[2], 0, [["enter", s, r]]), n !== 2) {
2678
2751
  const p = r.events[t[2]], b = r.events[t[3]];
2679
2752
  if (p[1].end = Object.assign({}, b[1].end), p[1].type = "chunkText", p[1].contentType = "text", t[3] > t[2] + 1) {
2680
- const f = t[2] + 1, k = t[3] - t[2] - 1;
2681
- e.add(f, k, []);
2753
+ const h = t[2] + 1, k = t[3] - t[2] - 1;
2754
+ e.add(h, k, []);
2682
2755
  }
2683
2756
  }
2684
2757
  e.add(t[3] + 1, 0, [["exit", s, r]]);
2685
2758
  }
2686
2759
  return i !== void 0 && (o.end = Object.assign({}, G(r.events, i)), e.add(i, 0, [["exit", o, r]]), o = void 0), o;
2687
2760
  }
2688
- function Je(e, r, t, n, i) {
2761
+ function Qe(e, r, t, n, i) {
2689
2762
  const o = [], a = G(r.events, t);
2690
2763
  i && (i.end = Object.assign({}, a), o.push(["exit", i, r])), n.end = Object.assign({}, a), o.push(["exit", n, r]), e.add(t + 1, 0, o);
2691
2764
  }
@@ -2693,18 +2766,18 @@ function G(e, r) {
2693
2766
  const t = e[r], n = t[0] === "enter" ? "start" : "end";
2694
2767
  return t[1][n];
2695
2768
  }
2696
- const qa = {
2769
+ const Za = {
2697
2770
  name: "tasklistCheck",
2698
- tokenize: Va
2771
+ tokenize: Qa
2699
2772
  };
2700
- function Ka() {
2773
+ function Ja() {
2701
2774
  return {
2702
2775
  text: {
2703
- 91: qa
2776
+ 91: Za
2704
2777
  }
2705
2778
  };
2706
2779
  }
2707
- function Va(e, r, t) {
2780
+ function Qa(e, r, t) {
2708
2781
  const n = this;
2709
2782
  return i;
2710
2783
  function i(l) {
@@ -2716,56 +2789,56 @@ function Va(e, r, t) {
2716
2789
  );
2717
2790
  }
2718
2791
  function o(l) {
2719
- return D(l) ? (e.enter("taskListCheckValueUnchecked"), e.consume(l), e.exit("taskListCheckValueUnchecked"), a) : l === 88 || l === 120 ? (e.enter("taskListCheckValueChecked"), e.consume(l), e.exit("taskListCheckValueChecked"), a) : t(l);
2792
+ return M(l) ? (e.enter("taskListCheckValueUnchecked"), e.consume(l), e.exit("taskListCheckValueUnchecked"), a) : l === 88 || l === 120 ? (e.enter("taskListCheckValueChecked"), e.consume(l), e.exit("taskListCheckValueChecked"), a) : t(l);
2720
2793
  }
2721
2794
  function a(l) {
2722
2795
  return l === 93 ? (e.enter("taskListCheckMarker"), e.consume(l), e.exit("taskListCheckMarker"), e.exit("taskListCheck"), u) : t(l);
2723
2796
  }
2724
2797
  function u(l) {
2725
2798
  return Z(l) ? r(l) : F(l) ? e.check({
2726
- tokenize: Ga
2799
+ tokenize: Xa
2727
2800
  }, r, t)(l) : t(l);
2728
2801
  }
2729
2802
  }
2730
- function Ga(e, r, t) {
2803
+ function Xa(e, r, t) {
2731
2804
  return z(e, n, "whitespace");
2732
2805
  function n(i) {
2733
2806
  return i === null ? t(i) : r(i);
2734
2807
  }
2735
2808
  }
2736
- function Za(e) {
2737
- return fa([
2738
- ba(),
2739
- Ma(),
2740
- ja(e),
2741
- Ba(),
2742
- Ka()
2809
+ function Ya(e) {
2810
+ return ga([
2811
+ ya(),
2812
+ Ea(),
2813
+ Ba(e),
2814
+ Ka(),
2815
+ Ja()
2743
2816
  ]);
2744
2817
  }
2745
- const Ja = {};
2746
- function Qa(e) {
2818
+ const ei = {};
2819
+ function ti(e) {
2747
2820
  const r = (
2748
2821
  /** @type {Processor<Root>} */
2749
2822
  this
2750
- ), t = e || Ja, n = r.data(), i = n.micromarkExtensions || (n.micromarkExtensions = []), o = n.fromMarkdownExtensions || (n.fromMarkdownExtensions = []), a = n.toMarkdownExtensions || (n.toMarkdownExtensions = []);
2751
- i.push(Za(t)), o.push(sa()), a.push(da(t));
2823
+ ), t = e || ei, n = r.data(), i = n.micromarkExtensions || (n.micromarkExtensions = []), o = n.fromMarkdownExtensions || (n.fromMarkdownExtensions = []), a = n.toMarkdownExtensions || (n.toMarkdownExtensions = []);
2824
+ i.push(Ya(t)), o.push(ma()), a.push(pa(t));
2752
2825
  }
2753
- function I(...e) {
2826
+ function N(...e) {
2754
2827
  return e.filter(Boolean).join(" ");
2755
2828
  }
2756
- const Xa = ({ content: e }) => /* @__PURE__ */ h(
2757
- Zt,
2829
+ const ri = ({ content: e }) => /* @__PURE__ */ d(
2830
+ Xt,
2758
2831
  {
2759
- remarkPlugins: [Qa],
2832
+ remarkPlugins: [ti],
2760
2833
  className: "cuadra-aui-md",
2761
- components: ti,
2834
+ components: ii,
2762
2835
  children: e
2763
2836
  }
2764
- ), _t = Ot(Xa), Ya = ({ language: e, code: r }) => {
2765
- const { isCopied: t, copyToClipboard: n } = ei();
2766
- return /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-between cuadra-gap-4 cuadra-mt-4 cuadra-rounded-t-lg cuadra-bg-muted/50 cuadra-border-b cuadra-border-border cuadra-px-4 cuadra-py-2 cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-font-brand", children: [
2767
- /* @__PURE__ */ h("span", { className: "cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand", children: e }),
2768
- /* @__PURE__ */ v(
2837
+ ), jt = Wt(ri), ni = ({ language: e, code: r }) => {
2838
+ const { isCopied: t, copyToClipboard: n } = ai();
2839
+ return /* @__PURE__ */ T("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: [
2840
+ /* @__PURE__ */ d("span", { className: "cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand", children: e }),
2841
+ /* @__PURE__ */ T(
2769
2842
  "button",
2770
2843
  {
2771
2844
  onClick: () => {
@@ -2774,115 +2847,115 @@ const Xa = ({ content: e }) => /* @__PURE__ */ h(
2774
2847
  className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-muted cuadra-transition-colors",
2775
2848
  "aria-label": "Copy code",
2776
2849
  children: [
2777
- !t && /* @__PURE__ */ h(sr, { className: "cuadra-h-4 cuadra-w-4" }),
2778
- t && /* @__PURE__ */ h(ar, { className: "cuadra-h-4 cuadra-w-4" })
2850
+ !t && /* @__PURE__ */ d(hr, { className: "cuadra-h-4 cuadra-w-4" }),
2851
+ t && /* @__PURE__ */ d(lr, { className: "cuadra-h-4 cuadra-w-4" })
2779
2852
  ]
2780
2853
  }
2781
2854
  )
2782
2855
  ] });
2783
- }, ei = ({
2856
+ }, ai = ({
2784
2857
  copiedDuration: e = 3e3
2785
2858
  } = {}) => {
2786
- const [r, t] = N(!1);
2859
+ const [r, t] = I(!1);
2787
2860
  return { isCopied: r, copyToClipboard: (i) => {
2788
2861
  i && navigator.clipboard.writeText(i).then(() => {
2789
2862
  t(!0), setTimeout(() => t(!1), e);
2790
2863
  });
2791
2864
  } };
2792
- }, ti = Vt({
2793
- h1: ({ className: e, ...r }) => /* @__PURE__ */ h(
2865
+ }, ii = Jt({
2866
+ h1: ({ className: e, ...r }) => /* @__PURE__ */ d(
2794
2867
  "h1",
2795
2868
  {
2796
- className: I("cuadra-mb-6 cuadra-scroll-m-20 cuadra-text-2xl cuadra-font-normal cuadra-tracking-tight last:cuadra-mb-0 font-brand", e),
2869
+ className: N("cuadra-mb-6 cuadra-scroll-m-20 cuadra-text-2xl cuadra-font-normal cuadra-tracking-tight last:cuadra-mb-0 font-brand", e),
2797
2870
  ...r
2798
2871
  }
2799
2872
  ),
2800
- h2: ({ className: e, ...r }) => /* @__PURE__ */ h(
2873
+ h2: ({ className: e, ...r }) => /* @__PURE__ */ d(
2801
2874
  "h2",
2802
2875
  {
2803
- className: I(
2876
+ className: N(
2804
2877
  "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",
2805
2878
  e
2806
2879
  ),
2807
2880
  ...r
2808
2881
  }
2809
2882
  ),
2810
- h3: ({ className: e, ...r }) => /* @__PURE__ */ h(
2883
+ h3: ({ className: e, ...r }) => /* @__PURE__ */ d(
2811
2884
  "h3",
2812
2885
  {
2813
- className: I(
2886
+ className: N(
2814
2887
  "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",
2815
2888
  e
2816
2889
  ),
2817
2890
  ...r
2818
2891
  }
2819
2892
  ),
2820
- h4: ({ className: e, ...r }) => /* @__PURE__ */ h(
2893
+ h4: ({ className: e, ...r }) => /* @__PURE__ */ d(
2821
2894
  "h4",
2822
2895
  {
2823
- className: I(
2896
+ className: N(
2824
2897
  "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",
2825
2898
  e
2826
2899
  ),
2827
2900
  ...r
2828
2901
  }
2829
2902
  ),
2830
- h5: ({ className: e, ...r }) => /* @__PURE__ */ h("h5", { className: I("cuadra-my-4 cuadra-text-lg cuadra-font-normal first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
2831
- h6: ({ className: e, ...r }) => /* @__PURE__ */ h("h6", { className: I("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand", e), ...r }),
2832
- p: ({ className: e, ...r }) => /* @__PURE__ */ h("p", { className: I("cuadra-mb-5 cuadra-mt-5 cuadra-leading-7 first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
2833
- a: ({ className: e, ...r }) => /* @__PURE__ */ h(
2903
+ h5: ({ className: e, ...r }) => /* @__PURE__ */ d("h5", { className: N("cuadra-my-4 cuadra-text-lg cuadra-font-normal first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
2904
+ h6: ({ className: e, ...r }) => /* @__PURE__ */ d("h6", { className: N("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand", e), ...r }),
2905
+ p: ({ className: e, ...r }) => /* @__PURE__ */ d("p", { className: N("cuadra-mb-5 cuadra-mt-5 cuadra-leading-7 first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
2906
+ a: ({ className: e, ...r }) => /* @__PURE__ */ d(
2834
2907
  "a",
2835
2908
  {
2836
- className: I("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand", e),
2909
+ className: N("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand", e),
2837
2910
  ...r
2838
2911
  }
2839
2912
  ),
2840
- blockquote: ({ className: e, ...r }) => /* @__PURE__ */ h("blockquote", { className: I("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand", e), ...r }),
2841
- ul: ({ className: e, ...r }) => /* @__PURE__ */ h("ul", { className: I("cuadra-my-5 cuadra-ml-6 cuadra-list-disc [&>li]:cuadra-mt-2 font-brand", e), ...r }),
2842
- ol: ({ className: e, ...r }) => /* @__PURE__ */ h("ol", { className: I("cuadra-my-5 cuadra-ml-6 cuadra-list-decimal [&>li]:cuadra-mt-2 font-brand", e), ...r }),
2843
- hr: ({ className: e, ...r }) => /* @__PURE__ */ h("hr", { className: I("cuadra-my-5 cuadra-border-b", e), ...r }),
2844
- table: ({ className: e, ...r }) => /* @__PURE__ */ h(
2913
+ blockquote: ({ className: e, ...r }) => /* @__PURE__ */ d("blockquote", { className: N("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand", e), ...r }),
2914
+ ul: ({ className: e, ...r }) => /* @__PURE__ */ d("ul", { className: N("cuadra-my-5 cuadra-ml-6 cuadra-list-disc [&>li]:cuadra-mt-2 font-brand", e), ...r }),
2915
+ ol: ({ className: e, ...r }) => /* @__PURE__ */ d("ol", { className: N("cuadra-my-5 cuadra-ml-6 cuadra-list-decimal [&>li]:cuadra-mt-2 font-brand", e), ...r }),
2916
+ hr: ({ className: e, ...r }) => /* @__PURE__ */ d("hr", { className: N("cuadra-my-5 cuadra-border-b", e), ...r }),
2917
+ table: ({ className: e, ...r }) => /* @__PURE__ */ d(
2845
2918
  "table",
2846
2919
  {
2847
- className: I("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand", e),
2920
+ className: N("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand", e),
2848
2921
  ...r
2849
2922
  }
2850
2923
  ),
2851
- th: ({ className: e, ...r }) => /* @__PURE__ */ h(
2924
+ th: ({ className: e, ...r }) => /* @__PURE__ */ d(
2852
2925
  "th",
2853
2926
  {
2854
- className: I(
2927
+ className: N(
2855
2928
  "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",
2856
2929
  e
2857
2930
  ),
2858
2931
  ...r
2859
2932
  }
2860
2933
  ),
2861
- td: ({ className: e, ...r }) => /* @__PURE__ */ h(
2934
+ td: ({ className: e, ...r }) => /* @__PURE__ */ d(
2862
2935
  "td",
2863
2936
  {
2864
- className: I(
2937
+ className: N(
2865
2938
  "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",
2866
2939
  e
2867
2940
  ),
2868
2941
  ...r
2869
2942
  }
2870
2943
  ),
2871
- tr: ({ className: e, ...r }) => /* @__PURE__ */ h(
2944
+ tr: ({ className: e, ...r }) => /* @__PURE__ */ d(
2872
2945
  "tr",
2873
2946
  {
2874
- className: I(
2947
+ className: N(
2875
2948
  "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",
2876
2949
  e
2877
2950
  ),
2878
2951
  ...r
2879
2952
  }
2880
2953
  ),
2881
- sup: ({ className: e, ...r }) => /* @__PURE__ */ h("sup", { className: I("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand", e), ...r }),
2882
- pre: ({ className: e, ...r }) => /* @__PURE__ */ h(
2954
+ sup: ({ className: e, ...r }) => /* @__PURE__ */ d("sup", { className: N("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand", e), ...r }),
2955
+ pre: ({ className: e, ...r }) => /* @__PURE__ */ d(
2883
2956
  "pre",
2884
2957
  {
2885
- className: I(
2958
+ className: N(
2886
2959
  "cuadra-overflow-x-auto cuadra-rounded-b-lg !cuadra-rounded-t-none cuadra-bg-muted cuadra-p-4 cuadra-text-foreground font-brand",
2887
2960
  e
2888
2961
  ),
@@ -2890,48 +2963,48 @@ const Xa = ({ content: e }) => /* @__PURE__ */ h(
2890
2963
  }
2891
2964
  ),
2892
2965
  code: function({ className: r, ...t }) {
2893
- const n = Gt();
2894
- return /* @__PURE__ */ h(
2966
+ const n = Qt();
2967
+ return /* @__PURE__ */ d(
2895
2968
  "code",
2896
2969
  {
2897
- className: I(!n && "cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand", r),
2970
+ className: N(!n && "cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand", r),
2898
2971
  ...t
2899
2972
  }
2900
2973
  );
2901
2974
  },
2902
- CodeHeader: Ya
2903
- }), Qe = [
2975
+ CodeHeader: ni
2976
+ }), Xe = [
2904
2977
  "Sending question…",
2905
2978
  "Understanding your need…",
2906
2979
  "Scanning data…",
2907
2980
  "Comparing results…",
2908
2981
  "Composing answer…"
2909
2982
  ];
2910
- function ri({ active: e }) {
2911
- const [r, t] = N(0);
2912
- return M(() => {
2983
+ function oi({ active: e }) {
2984
+ const [r, t] = I(0);
2985
+ return L(() => {
2913
2986
  if (!e) {
2914
2987
  t(0);
2915
2988
  return;
2916
2989
  }
2917
2990
  const n = window.setInterval(() => {
2918
- t((i) => i >= Qe.length - 1 ? (window.clearInterval(n), i) : i + 1);
2991
+ t((i) => i >= Xe.length - 1 ? (window.clearInterval(n), i) : i + 1);
2919
2992
  }, 2500);
2920
2993
  return () => window.clearInterval(n);
2921
- }, [e]), e ? /* @__PURE__ */ v("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-font-brand", children: [
2994
+ }, [e]), e ? /* @__PURE__ */ T("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-font-brand", children: [
2922
2995
  "Thinking… ",
2923
- Qe[r]
2996
+ Xe[r]
2924
2997
  ] }) : null;
2925
2998
  }
2926
- function Xe({
2999
+ function Ye({
2927
3000
  welcomeTitle: e = "Hi, how can I help you today?",
2928
3001
  welcomeSubtitle: r = "Start exploring our platform and discover what you can build.",
2929
3002
  extraTopPadding: t,
2930
3003
  suggestions: n,
2931
3004
  inputPlaceholder: i = "Type your message..."
2932
3005
  } = {}) {
2933
- const o = Wt(), [a, u] = N(!1), [l, c] = N(null), [d, s] = N(!1);
2934
- return M(() => {
3006
+ const o = Vt(), [a, u] = I(!1), [l, c] = I(null), [f, s] = I(!1);
3007
+ return L(() => {
2935
3008
  if (!o) {
2936
3009
  u(!1);
2937
3010
  return;
@@ -2945,16 +3018,16 @@ function Xe({
2945
3018
  const b = p.subscribe?.((k) => {
2946
3019
  const g = k?.threadId, x = k?.messages || [], w = k?.isLoadingHistory || !1, y = x.length;
2947
3020
  g && g !== l && c(g), u(w && y === 0);
2948
- const T = x.some(
2949
- (C) => C.role === "assistant" && !!C.content && (Array.isArray(C.content) ? C.content.some((L) => typeof L == "object" && L?.text ? L.text.trim().length > 0 : !1) : typeof C.content == "string" ? C.content.trim().length > 0 : !1)
3021
+ const v = x.some(
3022
+ (C) => C.role === "assistant" && !!C.content && (Array.isArray(C.content) ? C.content.some((D) => typeof D == "object" && D?.text ? D.text.trim().length > 0 : !1) : typeof C.content == "string" ? C.content.trim().length > 0 : !1)
2950
3023
  );
2951
- s(T);
2952
- }), f = p.getState?.();
2953
- if (f) {
2954
- const k = f?.threadId, g = f?.messages || [], x = f?.isLoadingHistory || !1, w = g.length;
3024
+ s(v);
3025
+ }), h = p.getState?.();
3026
+ if (h) {
3027
+ const k = h?.threadId, g = h?.messages || [], x = h?.isLoadingHistory || !1, w = g.length;
2955
3028
  k && k !== l && c(k), u(x && w === 0);
2956
3029
  const A = g.some(
2957
- (T) => T.role === "assistant" && !!T.content && (Array.isArray(T.content) ? T.content.some((C) => typeof C == "object" && C?.text ? C.text.trim().length > 0 : !1) : typeof T.content == "string" ? T.content.trim().length > 0 : !1)
3030
+ (v) => v.role === "assistant" && !!v.content && (Array.isArray(v.content) ? v.content.some((C) => typeof C == "object" && C?.text ? C.text.trim().length > 0 : !1) : typeof v.content == "string" ? v.content.trim().length > 0 : !1)
2958
3031
  );
2959
3032
  s(A);
2960
3033
  }
@@ -2964,43 +3037,43 @@ function Xe({
2964
3037
  } catch {
2965
3038
  u(!1);
2966
3039
  }
2967
- }, [o, l]), /* @__PURE__ */ v(ee.Root, { className: "cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full", children: [
2968
- /* @__PURE__ */ h(
2969
- ee.Viewport,
3040
+ }, [o, l]), /* @__PURE__ */ T(te.Root, { className: "cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full", children: [
3041
+ /* @__PURE__ */ d(
3042
+ te.Viewport,
2970
3043
  {
2971
3044
  className: "cuadra-w-full cuadra-bg-inherit cuadra-px-4 cuadra-flex-1 cuadra-min-h-0 cuadra-overflow-y-auto cuadra-relative scrollbar-thin cuadra-pt-4",
2972
3045
  style: t ? { paddingTop: t } : void 0,
2973
- children: a ? /* @__PURE__ */ h("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: [
2974
- /* @__PURE__ */ h(ot, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }),
2975
- /* @__PURE__ */ h("p", { className: "cuadra-text-sm cuadra-text-muted-foreground font-brand", children: "Loading messages..." })
2976
- ] }) }) : /* @__PURE__ */ v(B, { children: [
2977
- /* @__PURE__ */ h(ee.Empty, { children: /* @__PURE__ */ h(
2978
- ni,
3046
+ children: a ? /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-inset-0 cuadra-flex cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: [
3047
+ /* @__PURE__ */ d(ut, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }),
3048
+ /* @__PURE__ */ d("p", { className: "cuadra-text-sm cuadra-text-muted-foreground font-brand", children: "Loading messages..." })
3049
+ ] }) }) : /* @__PURE__ */ T(U, { children: [
3050
+ /* @__PURE__ */ d(te.Empty, { children: /* @__PURE__ */ d(
3051
+ li,
2979
3052
  {
2980
3053
  title: e,
2981
3054
  subtitle: r,
2982
3055
  suggestions: n
2983
3056
  }
2984
3057
  ) }),
2985
- /* @__PURE__ */ h(
2986
- ee.Messages,
3058
+ /* @__PURE__ */ d(
3059
+ te.Messages,
2987
3060
  {
2988
3061
  components: {
2989
- UserMessage: ai,
2990
- AssistantMessage: ii
3062
+ UserMessage: ui,
3063
+ AssistantMessage: ci
2991
3064
  }
2992
3065
  }
2993
3066
  ),
2994
- /* @__PURE__ */ h(ee.If, { running: !0, children: !d && /* @__PURE__ */ h("div", { className: "cuadra-mt-2 cuadra-max-w-2xl", children: /* @__PURE__ */ h(ri, { active: !0 }) }) })
3067
+ /* @__PURE__ */ d(te.If, { running: !0, children: !f && /* @__PURE__ */ d("div", { className: "cuadra-mt-2 cuadra-max-w-2xl", children: /* @__PURE__ */ d(oi, { active: !0 }) }) })
2995
3068
  ] })
2996
3069
  }
2997
3070
  ),
2998
- /* @__PURE__ */ h("div", { className: "cuadra-w-full cuadra-mt-3 cuadra-border-t cuadra-border-border cuadra-pt-4", children: /* @__PURE__ */ v(ke.Root, { className: "cuadra-relative !cuadra-relative cuadra-flex-1 cuadra-w-full", children: [
2999
- /* @__PURE__ */ h(
3071
+ /* @__PURE__ */ d("div", { className: "cuadra-w-full cuadra-mt-3 cuadra-border-t cuadra-border-border cuadra-pt-4", children: /* @__PURE__ */ T(ke.Root, { className: "cuadra-relative !cuadra-relative cuadra-flex-1 cuadra-w-full", children: [
3072
+ /* @__PURE__ */ d(
3000
3073
  ke.Input,
3001
3074
  {
3002
3075
  asChild: !0,
3003
- children: /* @__PURE__ */ h(
3076
+ children: /* @__PURE__ */ d(
3004
3077
  "textarea",
3005
3078
  {
3006
3079
  rows: 3,
@@ -3011,32 +3084,32 @@ function Xe({
3011
3084
  )
3012
3085
  }
3013
3086
  ),
3014
- /* @__PURE__ */ h(ke.Send, { asChild: !0, children: /* @__PURE__ */ h(
3087
+ /* @__PURE__ */ d(ke.Send, { asChild: !0, children: /* @__PURE__ */ d(
3015
3088
  "button",
3016
3089
  {
3017
3090
  className: "!cuadra-absolute !cuadra-bottom-2 !cuadra-right-2 cuadra-size-8 cuadra-bg-secondary cuadra-text-secondary-foreground cuadra-rounded-md cuadra-shadow-sm hover:cuadra-bg-secondary/90 disabled:cuadra-opacity-50 disabled:cuadra-cursor-not-allowed cuadra-flex cuadra-items-center cuadra-justify-center",
3018
3091
  style: { position: "absolute", bottom: "0.5rem", right: "0.5rem" },
3019
3092
  "aria-label": "Send message",
3020
3093
  type: "button",
3021
- children: /* @__PURE__ */ h(rr, { className: "cuadra-h-4 cuadra-w-4" })
3094
+ children: /* @__PURE__ */ d(ir, { className: "cuadra-h-4 cuadra-w-4" })
3022
3095
  }
3023
3096
  ) })
3024
3097
  ] }) })
3025
3098
  ] });
3026
3099
  }
3027
- function ni({ title: e, subtitle: r, suggestions: t }) {
3028
- const n = Ht(), i = async (o) => {
3100
+ function li({ title: e, subtitle: r, suggestions: t }) {
3101
+ const n = Gt(), i = async (o) => {
3029
3102
  try {
3030
3103
  n.composer().setText(o), await new Promise((a) => setTimeout(a, 10)), n.composer().send();
3031
3104
  } catch {
3032
3105
  }
3033
3106
  };
3034
- return /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-h-full cuadra-py-12 cuadra-px-4 cuadra-overflow-y-auto scrollbar-hide", children: /* @__PURE__ */ v("div", { className: "cuadra-text-center cuadra-max-w-3xl cuadra-w-full cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-min-h-full", children: [
3035
- /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8", children: [
3036
- /* @__PURE__ */ h("h2", { className: "cuadra-text-lg cuadra-font-normal cuadra-text-foreground cuadra-mb-2 font-brand", children: e }),
3037
- /* @__PURE__ */ h("p", { className: "cuadra-text-muted-foreground font-brand", children: r })
3107
+ 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__ */ T("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: [
3108
+ /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8", children: [
3109
+ /* @__PURE__ */ d("h2", { className: "cuadra-text-lg cuadra-font-normal cuadra-text-foreground cuadra-mb-2 font-brand", children: e }),
3110
+ /* @__PURE__ */ d("p", { className: "cuadra-text-muted-foreground font-brand", children: r })
3038
3111
  ] }),
3039
- t && t.length > 0 && /* @__PURE__ */ h("div", { className: "cuadra-grid cuadra-grid-cols-2 cuadra-gap-2 cuadra-pb-4 cuadra-w-full cuadra-max-w-2xl", children: t.map((o, a) => /* @__PURE__ */ h(
3112
+ t && t.length > 0 && /* @__PURE__ */ d("div", { className: "cuadra-grid cuadra-grid-cols-2 cuadra-gap-2 cuadra-pb-4 cuadra-w-full cuadra-max-w-2xl", children: t.map((o, a) => /* @__PURE__ */ d(
3040
3113
  "button",
3041
3114
  {
3042
3115
  type: "button",
@@ -3049,8 +3122,8 @@ function ni({ title: e, subtitle: r, suggestions: t }) {
3049
3122
  )) })
3050
3123
  ] }) });
3051
3124
  }
3052
- function ai() {
3053
- return /* @__PURE__ */ h(se.Root, { className: "cuadra-grid cuadra-w-full cuadra-auto-rows-auto cuadra-grid-cols-[minmax(72px,1fr)_auto] cuadra-gap-y-2 cuadra-py-3 [&:where(>*)]:cuadra-col-start-2", children: /* @__PURE__ */ h(
3125
+ function ui() {
3126
+ return /* @__PURE__ */ d(se.Root, { className: "cuadra-grid cuadra-w-full cuadra-auto-rows-auto cuadra-grid-cols-[minmax(72px,1fr)_auto] cuadra-gap-y-2 cuadra-py-3 [&:where(>*)]:cuadra-col-start-2", children: /* @__PURE__ */ d(
3054
3127
  "div",
3055
3128
  {
3056
3129
  className: "cuadra-bg-muted cuadra-text-foreground cuadra-col-start-2 cuadra-row-start-2 cuadra-max-w-[calc(42rem*0.8)] cuadra-break-words cuadra-rounded-3xl cuadra-px-5 cuadra-py-2.5 font-brand",
@@ -3065,19 +3138,19 @@ function ai() {
3065
3138
  paddingBottom: "0.625rem",
3066
3139
  wordBreak: "break-word"
3067
3140
  },
3068
- children: /* @__PURE__ */ h(
3141
+ children: /* @__PURE__ */ d(
3069
3142
  se.Parts,
3070
3143
  {
3071
3144
  components: {
3072
- Text: ({ text: e }) => /* @__PURE__ */ h(_t, { content: e || "" })
3145
+ Text: ({ text: e }) => /* @__PURE__ */ d(jt, { content: e || "" })
3073
3146
  }
3074
3147
  }
3075
3148
  )
3076
3149
  }
3077
3150
  ) });
3078
3151
  }
3079
- function ii() {
3080
- return /* @__PURE__ */ h(se.Root, { className: "cuadra-relative cuadra-grid cuadra-w-full cuadra-grid-cols-[auto_auto_1fr] cuadra-grid-rows-[auto_1fr] cuadra-py-3", children: /* @__PURE__ */ h(
3152
+ function ci() {
3153
+ return /* @__PURE__ */ d(se.Root, { className: "cuadra-relative cuadra-grid cuadra-w-full cuadra-grid-cols-[auto_auto_1fr] cuadra-grid-rows-[auto_1fr] cuadra-py-3", children: /* @__PURE__ */ d(
3081
3154
  "div",
3082
3155
  {
3083
3156
  className: "cuadra-text-foreground cuadra-col-span-2 cuadra-col-start-2 cuadra-row-start-1 cuadra-my-1.5 cuadra-max-w-[90%] cuadra-break-words cuadra-leading-7 font-brand",
@@ -3086,67 +3159,67 @@ function ii() {
3086
3159
  marginTop: "0.375rem",
3087
3160
  marginBottom: "0.375rem"
3088
3161
  },
3089
- children: /* @__PURE__ */ h(
3162
+ children: /* @__PURE__ */ d(
3090
3163
  se.Parts,
3091
3164
  {
3092
3165
  components: {
3093
- Text: ({ text: e }) => /* @__PURE__ */ h(_t, { content: e || "" })
3166
+ Text: ({ text: e }) => /* @__PURE__ */ d(jt, { content: e || "" })
3094
3167
  }
3095
3168
  }
3096
3169
  )
3097
3170
  }
3098
3171
  ) });
3099
3172
  }
3100
- function oi({ onThreadSelect: e }) {
3101
- const r = qt(), t = Kt((g) => g.threadId), [n, i] = N(null), o = r?.id === t, a = n === r?.id, [u, l] = N(!1), [c, d] = N(r?.title || ""), [s, p] = N(!1), [b, f] = N(!1), k = async () => {
3173
+ function si({ onThreadSelect: e }) {
3174
+ const r = at(), t = Zt((g) => g.threadId), [n, i] = I(null), o = r?.id === t, a = n === r?.id, [u, l] = I(!1), [c, f] = I(r?.title || ""), [s, p] = I(!1), [b, h] = I(!1), k = async () => {
3102
3175
  if (!r?.remoteId || !c || c === r.title) {
3103
3176
  l(!1);
3104
3177
  return;
3105
3178
  }
3106
3179
  try {
3107
- f(!0);
3180
+ h(!0);
3108
3181
  const g = window.__cuadraThreadListAdapter;
3109
3182
  g && typeof g.rename == "function" && await g.rename(r.remoteId, c), l(!1), p(!1);
3110
3183
  } catch {
3111
3184
  l(!1), p(!1);
3112
3185
  } finally {
3113
- f(!1);
3186
+ h(!1);
3114
3187
  }
3115
3188
  };
3116
- return M(() => {
3117
- r?.title && !u && d(r.title);
3118
- }, [r?.title, u]), r ? /* @__PURE__ */ h(
3189
+ return L(() => {
3190
+ r?.title && !u && f(r.title);
3191
+ }, [r?.title, u]), r ? /* @__PURE__ */ d(
3119
3192
  we.Root,
3120
3193
  {
3121
3194
  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"}`,
3122
3195
  style: { marginBottom: "0.5rem" },
3123
3196
  onMouseEnter: () => i(r.id),
3124
3197
  onMouseLeave: () => i(null),
3125
- children: /* @__PURE__ */ v(
3198
+ children: /* @__PURE__ */ T(
3126
3199
  we.Trigger,
3127
3200
  {
3128
3201
  className: "cuadra-p-3 cuadra-flex-1 cuadra-flex cuadra-items-center cuadra-justify-between cuadra-w-full cuadra-min-w-0 cuadra-cursor-pointer",
3129
3202
  onClick: () => e?.(),
3130
3203
  children: [
3131
- /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-flex-col cuadra-min-w-0 cuadra-flex-1 cuadra-items-start cuadra-text-left", children: u ? /* @__PURE__ */ h(
3204
+ /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-flex-col cuadra-min-w-0 cuadra-flex-1 cuadra-items-start cuadra-text-left", children: u ? /* @__PURE__ */ d(
3132
3205
  "input",
3133
3206
  {
3134
3207
  className: "cuadra-flex cuadra-w-full cuadra-rounded-md cuadra-border cuadra-border-input cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-sm placeholder:cuadra-text-muted-foreground focus-visible:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 font-brand",
3135
3208
  value: c,
3136
- onChange: (g) => d(g.target.value),
3209
+ onChange: (g) => f(g.target.value),
3137
3210
  onKeyDown: (g) => {
3138
- g.key === "Enter" && k(), g.key === "Escape" && (l(!1), d(r.title || ""));
3211
+ g.key === "Enter" && k(), g.key === "Escape" && (l(!1), f(r.title || ""));
3139
3212
  },
3140
3213
  disabled: b,
3141
3214
  autoFocus: !0,
3142
3215
  onClick: (g) => g.stopPropagation()
3143
3216
  }
3144
- ) : /* @__PURE__ */ v(B, { children: [
3145
- /* @__PURE__ */ h("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" }),
3146
- r.updatedAt && /* @__PURE__ */ h("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-mt-1 font-brand", children: new Date(r.updatedAt).toLocaleDateString() })
3217
+ ) : /* @__PURE__ */ T(U, { children: [
3218
+ /* @__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" }),
3219
+ r.updatedAt && /* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-mt-1 font-brand", children: new Date(r.updatedAt).toLocaleDateString() })
3147
3220
  ] }) }),
3148
- /* @__PURE__ */ h("div", { className: "cuadra-ml-2 cuadra-flex-shrink-0 cuadra-w-6 cuadra-h-6 cuadra-flex cuadra-items-center cuadra-justify-center", children: (a || o || s) && /* @__PURE__ */ v("div", { className: "cuadra-relative", children: [
3149
- /* @__PURE__ */ h(
3221
+ /* @__PURE__ */ d("div", { className: "cuadra-ml-2 cuadra-flex-shrink-0 cuadra-w-6 cuadra-h-6 cuadra-flex cuadra-items-center cuadra-justify-center", children: (a || o || s) && /* @__PURE__ */ T("div", { className: "cuadra-relative", children: [
3222
+ /* @__PURE__ */ d(
3150
3223
  "button",
3151
3224
  {
3152
3225
  className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-background/50 cuadra-transition-colors",
@@ -3154,18 +3227,18 @@ function oi({ onThreadSelect: e }) {
3154
3227
  g.stopPropagation(), p(!s);
3155
3228
  },
3156
3229
  "aria-label": "Thread options",
3157
- children: /* @__PURE__ */ h(fr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" })
3230
+ children: /* @__PURE__ */ d(pr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" })
3158
3231
  }
3159
3232
  ),
3160
- s && /* @__PURE__ */ v(B, { children: [
3161
- /* @__PURE__ */ h(
3233
+ s && /* @__PURE__ */ T(U, { children: [
3234
+ /* @__PURE__ */ d(
3162
3235
  "div",
3163
3236
  {
3164
3237
  className: "cuadra-fixed cuadra-inset-0 cuadra-z-40",
3165
3238
  onClick: () => p(!1)
3166
3239
  }
3167
3240
  ),
3168
- /* @__PURE__ */ h("div", { className: "cuadra-absolute cuadra-right-0 cuadra-top-8 cuadra-z-50 cuadra-bg-background cuadra-border cuadra-border-border cuadra-rounded-lg cuadra-shadow-lg cuadra-min-w-[120px] cuadra-overflow-hidden", children: u ? /* @__PURE__ */ h(
3241
+ /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-right-0 cuadra-top-8 cuadra-z-50 cuadra-bg-background cuadra-border cuadra-border-border cuadra-rounded-lg cuadra-shadow-lg cuadra-min-w-[120px] cuadra-overflow-hidden", children: u ? /* @__PURE__ */ d(
3169
3242
  "button",
3170
3243
  {
3171
3244
  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",
@@ -3175,19 +3248,19 @@ function oi({ onThreadSelect: e }) {
3175
3248
  disabled: b,
3176
3249
  children: "Save"
3177
3250
  }
3178
- ) : /* @__PURE__ */ v(B, { children: [
3179
- /* @__PURE__ */ h(
3251
+ ) : /* @__PURE__ */ T(U, { children: [
3252
+ /* @__PURE__ */ d(
3180
3253
  "button",
3181
3254
  {
3182
3255
  className: "cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left hover:cuadra-bg-muted cuadra-transition-colors font-brand",
3183
3256
  onClick: (g) => {
3184
- g.stopPropagation(), l(!0), d(r.title || ""), p(!1);
3257
+ g.stopPropagation(), l(!0), f(r.title || ""), p(!1);
3185
3258
  },
3186
3259
  children: "Rename"
3187
3260
  }
3188
3261
  ),
3189
- /* @__PURE__ */ h("div", { className: "cuadra-border-t cuadra-border-border" }),
3190
- /* @__PURE__ */ h(we.Delete, { asChild: !0, children: /* @__PURE__ */ h(
3262
+ /* @__PURE__ */ d("div", { className: "cuadra-border-t cuadra-border-border" }),
3263
+ /* @__PURE__ */ d(we.Delete, { asChild: !0, children: /* @__PURE__ */ d(
3191
3264
  "button",
3192
3265
  {
3193
3266
  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",
@@ -3206,34 +3279,34 @@ function oi({ onThreadSelect: e }) {
3206
3279
  }
3207
3280
  ) : null;
3208
3281
  }
3209
- function Ye({ onThreadSelect: e }) {
3210
- return /* @__PURE__ */ v(xe.Root, { className: "!cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-transition-all cuadra-duration-300 cuadra-ease-in-out cuadra-h-full cuadra-w-80", style: { borderRightWidth: "1px" }, children: [
3211
- /* @__PURE__ */ h("div", { className: "cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-between cuadra-transition-all cuadra-duration-300 cuadra-h-16 cuadra-px-4", children: /* @__PURE__ */ h("h3", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-text-nowrap font-brand", children: "Chat History" }) }),
3212
- /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin", children: [
3213
- /* @__PURE__ */ h(
3282
+ function et({ onThreadSelect: e }) {
3283
+ return /* @__PURE__ */ T(xe.Root, { className: "!cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-transition-all cuadra-duration-300 cuadra-ease-in-out cuadra-h-full cuadra-w-80", style: { borderRightWidth: "1px" }, children: [
3284
+ /* @__PURE__ */ d("div", { className: "cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-between cuadra-transition-all cuadra-duration-300 cuadra-h-16 cuadra-px-4", children: /* @__PURE__ */ d("h3", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-text-nowrap font-brand", children: "Chat History" }) }),
3285
+ /* @__PURE__ */ T("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin", children: [
3286
+ /* @__PURE__ */ d(
3214
3287
  xe.New,
3215
3288
  {
3216
3289
  className: "group cuadra-relative cuadra-flex cuadra-items-center cuadra-gap-3 cuadra-p-3 cuadra-rounded-lg cuadra-cursor-pointer cuadra-transition-colors cuadra-border cuadra-border-transparent hover:cuadra-bg-muted hover:cuadra-border-border",
3217
3290
  onClick: () => e?.(),
3218
- children: /* @__PURE__ */ h("div", { className: "cuadra-flex-1 cuadra-min-w-0", children: /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3219
- /* @__PURE__ */ h(br, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
3220
- /* @__PURE__ */ h("h4", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground font-brand", children: "New Chat" })
3291
+ children: /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-min-w-0", children: /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3292
+ /* @__PURE__ */ d(wr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
3293
+ /* @__PURE__ */ d("h4", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground font-brand", children: "New Chat" })
3221
3294
  ] }) })
3222
3295
  }
3223
3296
  ),
3224
- /* @__PURE__ */ h("div", { className: "cuadra-my-2 cuadra-border-t cuadra-border-border" }),
3225
- /* @__PURE__ */ h(
3297
+ /* @__PURE__ */ d("div", { className: "cuadra-my-2 cuadra-border-t cuadra-border-border" }),
3298
+ /* @__PURE__ */ d(
3226
3299
  xe.Items,
3227
3300
  {
3228
3301
  components: {
3229
- ThreadListItem: (r) => /* @__PURE__ */ h(oi, { ...r, onThreadSelect: e })
3302
+ ThreadListItem: (r) => /* @__PURE__ */ d(si, { ...r, onThreadSelect: e })
3230
3303
  }
3231
3304
  }
3232
3305
  )
3233
3306
  ] })
3234
3307
  ] });
3235
3308
  }
3236
- const li = `
3309
+ const di = `
3237
3310
  @keyframes rotate {
3238
3311
  100% { transform: rotate(1turn); }
3239
3312
  }
@@ -3246,15 +3319,15 @@ const li = `
3246
3319
  style: o,
3247
3320
  contentStyle: a,
3248
3321
  rotating: u = !1
3249
- }) => /* @__PURE__ */ v(B, { children: [
3250
- /* @__PURE__ */ h("style", { children: li }),
3251
- /* @__PURE__ */ v(
3322
+ }) => /* @__PURE__ */ T(U, { children: [
3323
+ /* @__PURE__ */ d("style", { children: di }),
3324
+ /* @__PURE__ */ T(
3252
3325
  "div",
3253
3326
  {
3254
3327
  className: `cuadra-relative cuadra-bg-background md:cuadra-rounded-xl cuadra-overflow-hidden ${r}`,
3255
3328
  style: { padding: i, ...o },
3256
3329
  children: [
3257
- /* @__PURE__ */ h(
3330
+ /* @__PURE__ */ d(
3258
3331
  "div",
3259
3332
  {
3260
3333
  className: "cuadra-absolute md:cuadra-rounded-xl",
@@ -3280,7 +3353,7 @@ const li = `
3280
3353
  }
3281
3354
  }
3282
3355
  ),
3283
- /* @__PURE__ */ h(
3356
+ /* @__PURE__ */ d(
3284
3357
  "div",
3285
3358
  {
3286
3359
  className: `cuadra-relative cuadra-bg-background cuadra-h-full cuadra-z-10 cuadra-flex cuadra-flex-col cuadra-overflow-hidden ${t} ${n}`,
@@ -3294,7 +3367,7 @@ const li = `
3294
3367
  ]
3295
3368
  }
3296
3369
  )
3297
- ] }), ui = ({ className: e = "", theme: r = "system" }) => {
3370
+ ] }), fi = ({ className: e = "", theme: r = "system" }) => {
3298
3371
  const t = () => {
3299
3372
  if (typeof window > "u") return "light";
3300
3373
  if (r === "system") {
@@ -3302,13 +3375,13 @@ const li = `
3302
3375
  return a || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
3303
3376
  }
3304
3377
  return r;
3305
- }, [n, i] = N(t);
3306
- return M(() => {
3378
+ }, [n, i] = I(t);
3379
+ return L(() => {
3307
3380
  r !== "system" && i(r);
3308
- }, [r]), M(() => {
3381
+ }, [r]), L(() => {
3309
3382
  const a = document.documentElement;
3310
3383
  a.classList.remove("light", "dark"), a.classList.add(n), r === "system" && localStorage.setItem("theme", n);
3311
- }, [n, r]), /* @__PURE__ */ h(
3384
+ }, [n, r]), /* @__PURE__ */ d(
3312
3385
  "button",
3313
3386
  {
3314
3387
  type: "button",
@@ -3318,15 +3391,15 @@ const li = `
3318
3391
  },
3319
3392
  disabled: r !== "system",
3320
3393
  className: `cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-8 cuadra-w-8 cuadra-rounded-full cuadra-bg-muted hover:cuadra-bg-muted/80 cuadra-transition-colors disabled:cuadra-opacity-50 disabled:cuadra-cursor-not-allowed ${e}`,
3321
- children: /* @__PURE__ */ h(
3322
- ur,
3394
+ children: /* @__PURE__ */ d(
3395
+ dr,
3323
3396
  {
3324
3397
  className: `cuadra-h-4 cuadra-w-4 cuadra-transition-colors ${n === "dark" ? "cuadra-text-primary" : "cuadra-text-gray-400"}`
3325
3398
  }
3326
3399
  )
3327
3400
  }
3328
3401
  );
3329
- }, et = ({
3402
+ }, tt = ({
3330
3403
  currentModel: e,
3331
3404
  models: r,
3332
3405
  modelsLoading: t,
@@ -3338,56 +3411,56 @@ const li = `
3338
3411
  onMobileMenuClick: l,
3339
3412
  showMobileMenuButton: c = !1
3340
3413
  }) => {
3341
- const [d, s] = N(!1), p = rt(null);
3342
- M(() => {
3343
- const f = (k) => {
3414
+ const [f, s] = I(!1), p = nt(null);
3415
+ L(() => {
3416
+ const h = (k) => {
3344
3417
  p.current && !p.current.contains(k.target) && s(!1);
3345
3418
  };
3346
- return d && document.addEventListener("mousedown", f), () => {
3347
- document.removeEventListener("mousedown", f);
3419
+ return f && document.addEventListener("mousedown", h), () => {
3420
+ document.removeEventListener("mousedown", h);
3348
3421
  };
3349
- }, [d]);
3350
- const b = r.find((f) => f.id === e);
3351
- return /* @__PURE__ */ v("div", { className: "cuadra-h-16 cuadra-px-4 cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-between cuadra-bg-background", children: [
3352
- /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3353
- c && /* @__PURE__ */ h(
3422
+ }, [f]);
3423
+ const b = r.find((h) => h.id === e);
3424
+ return /* @__PURE__ */ T("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: [
3425
+ /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3426
+ c && /* @__PURE__ */ d(
3354
3427
  "button",
3355
3428
  {
3356
3429
  type: "button",
3357
3430
  onClick: l,
3358
3431
  className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-8 cuadra-w-8 cuadra-rounded-full cuadra-bg-muted hover:cuadra-bg-muted/80 cuadra-transition-colors disabled:cuadra-opacity-50 disabled:cuadra-cursor-not-allowed md:cuadra-hidden",
3359
3432
  "aria-label": "Toggle thread list",
3360
- children: /* @__PURE__ */ h(pr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
3433
+ children: /* @__PURE__ */ d(kr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
3361
3434
  }
3362
3435
  ),
3363
- a && /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ h(ui, { theme: u }) })
3436
+ a && /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d(fi, { theme: u }) })
3364
3437
  ] }),
3365
- /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 md:cuadra-ml-0 cuadra-ml-auto", children: [
3366
- !o && /* @__PURE__ */ h("label", { className: "cuadra-hidden md:cuadra-inline cuadra-text-sm cuadra-text-muted-foreground cuadra-font-brand", children: "Model" }),
3367
- o ? null : t ? /* @__PURE__ */ h("div", { className: "cuadra-w-48 cuadra-rounded-md cuadra-border cuadra-border-border cuadra-px-3 cuadra-py-2 cuadra-bg-muted", children: /* @__PURE__ */ h("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading..." }) }) : n ? /* @__PURE__ */ h("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__ */ h("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : /* @__PURE__ */ v("div", { ref: p, className: "cuadra-relative cuadra-w-48", children: [
3368
- /* @__PURE__ */ v(
3438
+ /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 md:cuadra-ml-0 cuadra-ml-auto", children: [
3439
+ !o && /* @__PURE__ */ d("label", { className: "cuadra-hidden md:cuadra-inline cuadra-text-sm cuadra-text-muted-foreground cuadra-font-brand", children: "Model" }),
3440
+ o ? null : t ? /* @__PURE__ */ d("div", { className: "cuadra-w-48 cuadra-rounded-md cuadra-border cuadra-border-border cuadra-px-3 cuadra-py-2 cuadra-bg-muted", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading..." }) }) : n ? /* @__PURE__ */ d("div", { className: "cuadra-w-48 cuadra-rounded-md cuadra-border cuadra-border-destructive cuadra-px-3 cuadra-py-2 cuadra-bg-destructive/10", children: /* @__PURE__ */ d("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : /* @__PURE__ */ T("div", { ref: p, className: "cuadra-relative cuadra-w-48", children: [
3441
+ /* @__PURE__ */ T(
3369
3442
  "button",
3370
3443
  {
3371
3444
  type: "button",
3372
- onClick: () => s(!d),
3445
+ onClick: () => s(!f),
3373
3446
  disabled: t || r.length === 0 || !!n,
3374
3447
  className: "cuadra-flex cuadra-h-10 cuadra-w-full cuadra-items-center cuadra-justify-between cuadra-rounded-md cuadra-border cuadra-border-input cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-sm placeholder:cuadra-text-muted-foreground focus:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 cuadra-font-brand",
3375
3448
  children: [
3376
- /* @__PURE__ */ h("span", { className: b ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: b?.name || "Select model" }),
3377
- /* @__PURE__ */ h(or, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
3449
+ /* @__PURE__ */ d("span", { className: b ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: b?.name || "Select model" }),
3450
+ /* @__PURE__ */ d(cr, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
3378
3451
  ]
3379
3452
  }
3380
3453
  ),
3381
- d && r.length > 0 && /* @__PURE__ */ h("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__ */ h("div", { className: "cuadra-p-1", children: r.map((f) => /* @__PURE__ */ v(
3454
+ f && r.length > 0 && /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-z-50 cuadra-mt-1 cuadra-w-full cuadra-min-w-[8rem] cuadra-overflow-hidden cuadra-rounded-md glass-popover cuadra-text-popover-foreground cuadra-animate-in fade-in-80 cuadra-border cuadra-border-border cuadra-bg-popover cuadra-shadow-md", children: /* @__PURE__ */ d("div", { className: "cuadra-p-1", children: r.map((h) => /* @__PURE__ */ T(
3382
3455
  "button",
3383
3456
  {
3384
3457
  type: "button",
3385
3458
  onClick: () => {
3386
- i(f.id), s(!1);
3459
+ i(h.id), s(!1);
3387
3460
  },
3388
- className: `cuadra-relative cuadra-flex cuadra-w-full cuadra-cursor-pointer cuadra-select-none cuadra-items-center cuadra-rounded-sm cuadra-py-1.5 cuadra-pl-8 cuadra-pr-2 cuadra-text-sm cuadra-outline-none focus:cuadra-bg-secondary focus:cuadra-text-secondary-foreground font-brand cuadra-transition-colors ${e === f.id ? "cuadra-bg-secondary cuadra-text-secondary-foreground" : "hover:cuadra-bg-secondary/50"}`,
3461
+ className: `cuadra-relative cuadra-flex cuadra-w-full cuadra-cursor-pointer cuadra-select-none cuadra-items-center cuadra-rounded-sm cuadra-py-1.5 cuadra-pl-8 cuadra-pr-2 cuadra-text-sm cuadra-outline-none focus:cuadra-bg-secondary focus:cuadra-text-secondary-foreground font-brand cuadra-transition-colors ${e === h.id ? "cuadra-bg-secondary cuadra-text-secondary-foreground" : "hover:cuadra-bg-secondary/50"}`,
3389
3462
  children: [
3390
- e === f.id && /* @__PURE__ */ h("span", { className: "cuadra-absolute cuadra-left-2 cuadra-flex cuadra-h-3.5 cuadra-w-3.5 cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ h(
3463
+ e === h.id && /* @__PURE__ */ d("span", { className: "cuadra-absolute cuadra-left-2 cuadra-flex cuadra-h-3.5 cuadra-w-3.5 cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ d(
3391
3464
  "svg",
3392
3465
  {
3393
3466
  xmlns: "http://www.w3.org/2000/svg",
@@ -3395,7 +3468,7 @@ const li = `
3395
3468
  height: "16",
3396
3469
  fill: "none",
3397
3470
  viewBox: "0 0 16 16",
3398
- children: /* @__PURE__ */ h(
3471
+ children: /* @__PURE__ */ d(
3399
3472
  "path",
3400
3473
  {
3401
3474
  fill: "currentColor",
@@ -3406,17 +3479,17 @@ const li = `
3406
3479
  )
3407
3480
  }
3408
3481
  ) }),
3409
- /* @__PURE__ */ h("span", { children: f.name })
3482
+ /* @__PURE__ */ d("span", { children: h.name })
3410
3483
  ]
3411
3484
  },
3412
- f.id
3485
+ h.id
3413
3486
  )) }) })
3414
3487
  ] })
3415
3488
  ] })
3416
3489
  ] });
3417
- }, ci = Ut(void 0), Ie = ({ children: e, value: r }) => /* @__PURE__ */ h(ci.Provider, { value: r, children: e });
3418
- function si() {
3419
- M(() => {
3490
+ }, hi = Ht(void 0), Ie = ({ children: e, value: r }) => /* @__PURE__ */ d(hi.Provider, { value: r, children: e });
3491
+ function mi() {
3492
+ L(() => {
3420
3493
  if (document.querySelector("style[data-cuadra-uikit]"))
3421
3494
  return;
3422
3495
  const r = document.createElement("div");
@@ -3438,8 +3511,8 @@ function si() {
3438
3511
  }, document.head.appendChild(n), o) break;
3439
3512
  }, []);
3440
3513
  }
3441
- const di = ({ config: e }) => {
3442
- si();
3514
+ const pi = ({ config: e }) => {
3515
+ mi();
3443
3516
  const {
3444
3517
  baseUrl: r,
3445
3518
  proxyUrl: t,
@@ -3450,49 +3523,49 @@ const di = ({ config: e }) => {
3450
3523
  onModelChange: u,
3451
3524
  ephemeral: l = !1,
3452
3525
  systemPrompt: c,
3453
- initialThreadId: d,
3526
+ initialThreadId: f,
3454
3527
  welcomeTitle: s,
3455
3528
  welcomeSubtitle: p,
3456
3529
  extraTopPadding: b,
3457
- suggestions: f,
3530
+ suggestions: h,
3458
3531
  inputPlaceholder: k,
3459
3532
  showThemeToggle: g = !0,
3460
3533
  theme: x = "system",
3461
3534
  onError: w,
3462
3535
  onChatCreated: y,
3463
3536
  onUserMessage: A,
3464
- onThreadIdUpdate: T
3465
- } = e, [C, L] = N(!1), E = t || r || "", q = !!t, m = W(
3466
- () => new lt(E, n || void 0, q),
3537
+ onThreadIdUpdate: v
3538
+ } = e, [C, D] = I(!1), E = t || r || "", q = !!t, m = B(
3539
+ () => new ct(E, n || void 0, q),
3467
3540
  [E, n, q]
3468
- ), [P, ie] = N(null), [O, J] = N(!1), [Q, Ee] = N(null), [Ft, _e] = N(!1);
3469
- M(() => {
3541
+ ), [P, ie] = I(null), [O, Q] = I(!1), [X, Ee] = I(null), [$t, _e] = I(!1);
3542
+ L(() => {
3470
3543
  i === "multiChat" && _e(!0);
3471
3544
  }, [i]);
3472
- const K = te(async () => {
3545
+ const K = J(async () => {
3473
3546
  if (o === "selector") {
3474
- J(!0), Ee(null);
3547
+ Q(!0), Ee(null);
3475
3548
  try {
3476
3549
  const S = await m.listModels();
3477
3550
  ie(S);
3478
3551
  } catch (S) {
3479
3552
  Ee(S instanceof Error ? S : new Error("Failed to load models"));
3480
3553
  } finally {
3481
- J(!1);
3554
+ Q(!1);
3482
3555
  }
3483
3556
  }
3484
3557
  }, [m, o]);
3485
- M(() => {
3558
+ L(() => {
3486
3559
  o === "selector" && K();
3487
- }, [o, K]), M(() => (typeof window < "u" && (window.__cuadraUIKitRefetchModels = K), () => {
3560
+ }, [o, K]), L(() => (typeof window < "u" && (window.__cuadraUIKitRefetchModels = K), () => {
3488
3561
  typeof window < "u" && delete window.__cuadraUIKitRefetchModels;
3489
3562
  }), [K]);
3490
- const [_, Fe] = N(
3563
+ const [_, Fe] = I(
3491
3564
  o === "fixed" && a || null
3492
- ), ze = rt(_), X = te(
3565
+ ), ze = nt(_), Y = J(
3493
3566
  (S) => {
3494
- const Y = ze.current;
3495
- Fe(S), ze.current = S, u?.(S), Y !== null && Y !== S && i === "multiChat" && setTimeout(() => {
3567
+ const ee = ze.current;
3568
+ Fe(S), ze.current = S, u?.(S), ee !== null && ee !== S && i === "multiChat" && setTimeout(() => {
3496
3569
  const V = window.__cuadraThreadListRuntime;
3497
3570
  if (V?.threads?.switchToNewThread)
3498
3571
  try {
@@ -3513,31 +3586,31 @@ const di = ({ config: e }) => {
3513
3586
  },
3514
3587
  [u, i]
3515
3588
  );
3516
- M(() => {
3589
+ L(() => {
3517
3590
  if (o === "selector" && P?.items && P.items.length > 0 && !_) {
3518
3591
  const S = P.items[0];
3519
3592
  if (S?.id) {
3520
- const Y = S.id;
3521
- Fe(Y), u?.(Y);
3593
+ const ee = S.id;
3594
+ Fe(ee), u?.(ee);
3522
3595
  }
3523
3596
  }
3524
3597
  }, [o, P?.items, _, u]);
3525
- const zt = o === "fixed" ? !!a : !!_, oe = W(
3598
+ const Ot = o === "fixed" ? !!a : !!_, oe = B(
3526
3599
  () => (P?.items || []).filter((S) => S?.id && S?.displayName).map((S) => ({ id: S.id, name: S.displayName })),
3527
3600
  [P]
3528
- ), be = W(
3601
+ ), be = B(
3529
3602
  () => ({
3530
3603
  currentModelId: _ || "",
3531
3604
  models: oe,
3532
3605
  modelsLoading: O,
3533
- modelsError: Q,
3534
- onModelChange: X,
3606
+ modelsError: X,
3607
+ onModelChange: Y,
3535
3608
  refetchModels: K
3536
3609
  }),
3537
- [_, oe, O, Q, X, K]
3610
+ [_, oe, O, X, Y, K]
3538
3611
  );
3539
- return o === "selector" && O || i === "multiChat" && Ft ? /* @__PURE__ */ h(Ie, { value: be, children: /* @__PURE__ */ h(Ae, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ h(ot, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }) }) }) }) : o === "selector" && !zt && Q ? /* @__PURE__ */ h(Ie, { value: be, children: /* @__PURE__ */ h(Ae, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ h("p", { className: "cuadra-text-sm cuadra-text-destructive font-brand", children: "Failed to load models" }) }) }) }) }) : /* @__PURE__ */ h("div", { className: "cuadra-uikit cuadra-h-full cuadra-w-full", style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ h(Ie, { value: be, children: /* @__PURE__ */ h(
3540
- Cr,
3612
+ return o === "selector" && O || i === "multiChat" && $t ? /* @__PURE__ */ d(Ie, { value: be, children: /* @__PURE__ */ d(Ae, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ d(ut, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }) }) }) }) : o === "selector" && !Ot && X ? /* @__PURE__ */ d(Ie, { value: be, children: /* @__PURE__ */ d(Ae, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d("p", { className: "cuadra-text-sm cuadra-text-destructive font-brand", children: "Failed to load models" }) }) }) }) }) : /* @__PURE__ */ d("div", { className: "cuadra-uikit cuadra-h-full cuadra-w-full", style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ d(Ie, { value: be, children: /* @__PURE__ */ d(
3613
+ Ar,
3541
3614
  {
3542
3615
  baseUrl: q ? E : r || E,
3543
3616
  sessionToken: n,
@@ -3545,18 +3618,18 @@ const di = ({ config: e }) => {
3545
3618
  mode: i,
3546
3619
  modelMode: o,
3547
3620
  modelId: _ || a || void 0,
3548
- onModelChange: X,
3621
+ onModelChange: Y,
3549
3622
  ephemeral: l,
3550
3623
  systemPrompt: c,
3551
- initialThreadId: d,
3624
+ initialThreadId: f,
3552
3625
  onError: w,
3553
3626
  onChatCreated: y,
3554
3627
  onUserMessage: A,
3555
- onThreadIdUpdate: T,
3628
+ onThreadIdUpdate: v,
3556
3629
  onChatsLoaded: () => {
3557
3630
  i === "multiChat" && _e(!1);
3558
3631
  },
3559
- children: /* @__PURE__ */ h(
3632
+ children: /* @__PURE__ */ d(
3560
3633
  Ae,
3561
3634
  {
3562
3635
  paddingX: "cuadra-px-0",
@@ -3564,84 +3637,84 @@ const di = ({ config: e }) => {
3564
3637
  className: `cuadra-h-full ${e.containerClass || ""}`,
3565
3638
  borderSizePx: 4,
3566
3639
  style: { height: "100%" },
3567
- children: /* @__PURE__ */ h("div", { className: "cuadra-h-full cuadra-flex cuadra-relative", style: { height: "100%" }, children: i === "multiChat" ? /* @__PURE__ */ v(B, { children: [
3568
- C && typeof document < "u" && $e(
3569
- /* @__PURE__ */ h(
3640
+ children: /* @__PURE__ */ d("div", { className: "cuadra-h-full cuadra-flex cuadra-relative", style: { height: "100%" }, children: i === "multiChat" ? /* @__PURE__ */ T(U, { children: [
3641
+ C && typeof document < "u" && Oe(
3642
+ /* @__PURE__ */ d(
3570
3643
  "div",
3571
3644
  {
3572
3645
  className: "cuadra-fixed cuadra-inset-0 cuadra-bg-black/50 cuadra-z-40 md:cuadra-hidden",
3573
- onClick: () => L(!1)
3646
+ onClick: () => D(!1)
3574
3647
  }
3575
3648
  ),
3576
3649
  document.body
3577
3650
  ),
3578
- typeof document < "u" && /* @__PURE__ */ v(B, { children: [
3579
- /* @__PURE__ */ h(
3651
+ typeof document < "u" && /* @__PURE__ */ T(U, { children: [
3652
+ /* @__PURE__ */ d(
3580
3653
  "div",
3581
3654
  {
3582
3655
  className: "cuadra-hidden md:cuadra-block !cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-transition-all cuadra-duration-300 cuadra-ease-in-out cuadra-h-full cuadra-w-80 cuadra-relative",
3583
3656
  style: { borderRightWidth: "1px", height: "100%" },
3584
- children: /* @__PURE__ */ h(Ye, { onThreadSelect: () => L(!1) })
3657
+ children: /* @__PURE__ */ d(et, { onThreadSelect: () => D(!1) })
3585
3658
  }
3586
3659
  ),
3587
- C && $e(
3588
- /* @__PURE__ */ h(
3660
+ C && Oe(
3661
+ /* @__PURE__ */ d(
3589
3662
  "div",
3590
3663
  {
3591
3664
  className: "cuadra-block md:cuadra-hidden !cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-transition-all cuadra-duration-300 cuadra-ease-in-out cuadra-h-screen cuadra-w-80 cuadra-fixed cuadra-z-50 cuadra-top-0 cuadra-left-0 cuadra-translate-x-0",
3592
3665
  style: { borderRightWidth: "1px" },
3593
- children: /* @__PURE__ */ h(Ye, { onThreadSelect: () => L(!1) })
3666
+ children: /* @__PURE__ */ d(et, { onThreadSelect: () => D(!1) })
3594
3667
  }
3595
3668
  ),
3596
3669
  document.body
3597
3670
  )
3598
3671
  ] }),
3599
- /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3600
- o === "selector" && /* @__PURE__ */ h(
3601
- et,
3672
+ /* @__PURE__ */ T("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3673
+ o === "selector" && /* @__PURE__ */ d(
3674
+ tt,
3602
3675
  {
3603
3676
  currentModel: _ || "",
3604
3677
  models: oe,
3605
3678
  modelsLoading: O,
3606
- modelsError: Q,
3607
- onModelChange: X,
3679
+ modelsError: X,
3680
+ onModelChange: Y,
3608
3681
  showThemeToggle: g,
3609
3682
  theme: x,
3610
- onMobileMenuClick: () => L(!C),
3683
+ onMobileMenuClick: () => D(!C),
3611
3684
  showMobileMenuButton: i === "multiChat"
3612
3685
  }
3613
3686
  ),
3614
- /* @__PURE__ */ h("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ h(
3615
- Xe,
3687
+ /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
3688
+ Ye,
3616
3689
  {
3617
3690
  welcomeTitle: s,
3618
3691
  welcomeSubtitle: p,
3619
3692
  extraTopPadding: b,
3620
- suggestions: f,
3693
+ suggestions: h,
3621
3694
  inputPlaceholder: k
3622
3695
  }
3623
3696
  ) })
3624
3697
  ] })
3625
- ] }) : /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3626
- o === "selector" && /* @__PURE__ */ h(
3627
- et,
3698
+ ] }) : /* @__PURE__ */ T("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3699
+ o === "selector" && /* @__PURE__ */ d(
3700
+ tt,
3628
3701
  {
3629
3702
  currentModel: _ || "",
3630
3703
  models: oe,
3631
3704
  modelsLoading: O,
3632
- modelsError: Q,
3633
- onModelChange: X,
3705
+ modelsError: X,
3706
+ onModelChange: Y,
3634
3707
  showThemeToggle: g,
3635
3708
  theme: x
3636
3709
  }
3637
3710
  ),
3638
- /* @__PURE__ */ h("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ h(
3639
- Xe,
3711
+ /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
3712
+ Ye,
3640
3713
  {
3641
3714
  welcomeTitle: s,
3642
3715
  welcomeSubtitle: p,
3643
3716
  extraTopPadding: b,
3644
- suggestions: f
3717
+ suggestions: h
3645
3718
  }
3646
3719
  ) })
3647
3720
  ] }) })
@@ -3650,7 +3723,7 @@ const di = ({ config: e }) => {
3650
3723
  }
3651
3724
  ) }) });
3652
3725
  };
3653
- function xi(e) {
3726
+ function vi(e) {
3654
3727
  const r = {
3655
3728
  baseUrl: e.baseUrl,
3656
3729
  proxyUrl: e.proxyUrl,
@@ -3676,9 +3749,9 @@ function xi(e) {
3676
3749
  theme: e.theme,
3677
3750
  containerClass: e.className
3678
3751
  };
3679
- return /* @__PURE__ */ h(di, { config: r });
3752
+ return /* @__PURE__ */ d(pi, { config: r });
3680
3753
  }
3681
3754
  export {
3682
- xi as CuadraChat
3755
+ vi as CuadraChat
3683
3756
  };
3684
3757
  //# sourceMappingURL=index.mjs.map