@doderasoftware/restify-ai 0.1.0-beta.10 → 0.1.0-beta.11

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.
@@ -1,9 +1,9 @@
1
1
  var Hs = Object.defineProperty;
2
2
  var Bs = (n, e, t) => e in n ? Hs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
3
  var K = (n, e, t) => Bs(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { ref as q, nextTick as Oe, onUnmounted as bt, computed as N, onMounted as vt, watch as Ne, isRef as Fs, onBeforeUnmount as Us, defineComponent as de, createElementBlock as v, openBlock as y, normalizeClass as b, renderSlot as ue, createElementVNode as h, createCommentVNode as B, Fragment as we, renderList as ze, toDisplayString as P, createBlock as Ee, resolveDynamicComponent as nn, withCtx as Ae, createVNode as me, normalizeStyle as cn, Transition as wt, withModifiers as Je, unref as D, withDirectives as qs, vModelText as js, createTextVNode as sn, createStaticVNode as _n, Teleport as Ws, normalizeProps as zn, guardReactiveProps as Hn, onErrorCaptured as Ks } from "vue";
4
+ import { ref as q, nextTick as Pe, onUnmounted as bt, computed as N, onMounted as vt, watch as _e, isRef as Fs, onBeforeUnmount as Us, defineComponent as he, createElementBlock as v, openBlock as x, normalizeClass as b, renderSlot as ce, createElementVNode as h, createCommentVNode as F, Fragment as be, renderList as Fe, toDisplayString as P, createBlock as Ee, resolveDynamicComponent as nn, withCtx as Ae, createVNode as ye, normalizeStyle as cn, Transition as wt, withModifiers as tt, unref as D, withDirectives as qs, vModelText as js, createTextVNode as sn, createStaticVNode as _n, Teleport as Ws, normalizeProps as zn, guardReactiveProps as Hn, onErrorCaptured as Ks } from "vue";
5
5
  import { defineStore as Vs } from "pinia";
6
- let qe = null;
6
+ let Ke = null;
7
7
  const Gs = q(null), os = {
8
8
  title: "AI Assistant",
9
9
  aiName: "AI Assistant",
@@ -59,23 +59,23 @@ const Gs = q(null), os = {
59
59
  setupCompleteTitle: "Setup Complete!"
60
60
  };
61
61
  function Qs(n) {
62
- qe = n, Gs.value = n;
62
+ Ke = n, Gs.value = n;
63
63
  }
64
- function J() {
65
- return qe;
64
+ function te() {
65
+ return Ke;
66
66
  }
67
67
  function Aa() {
68
- if (!qe)
68
+ if (!Ke)
69
69
  throw new Error(
70
70
  "[@doderasoftware/restify-ai] Plugin not initialized. Make sure to call app.use(RestifyAiPlugin, config) before using the components."
71
71
  );
72
- return qe;
72
+ return Ke;
73
73
  }
74
74
  function is() {
75
- return qe !== null;
75
+ return Ke !== null;
76
76
  }
77
- function ce(n, e) {
78
- const t = qe, s = (t == null ? void 0 : t.labels) || {}, r = t == null ? void 0 : t.translate;
77
+ function de(n, e) {
78
+ const t = Ke, s = (t == null ? void 0 : t.labels) || {}, r = t == null ? void 0 : t.translate;
79
79
  if (r) {
80
80
  const i = r(n, e);
81
81
  if (i !== n)
@@ -98,11 +98,11 @@ function Bn(n) {
98
98
  enableSupportMode: !1
99
99
  }[n];
100
100
  }
101
- function et(n) {
102
- const e = qe;
101
+ function Be(n) {
102
+ const e = Ke;
103
103
  return e ? e[n] ?? Bn(n) : Bn(n);
104
104
  }
105
- const tt = {
105
+ const nt = {
106
106
  Assistant: "assistant",
107
107
  User: "user",
108
108
  System: "system"
@@ -121,8 +121,8 @@ function Ys(n) {
121
121
  let u = 0;
122
122
  for (; t < a; ) {
123
123
  r && (e[t] === 10 && (u = ++t), r = !1);
124
- let c = -1;
125
- for (; t < a && c === -1; ++t)
124
+ let d = -1;
125
+ for (; t < a && d === -1; ++t)
126
126
  switch (e[t]) {
127
127
  case 58:
128
128
  s === -1 && (s = t - u);
@@ -130,12 +130,12 @@ function Ys(n) {
130
130
  case 13:
131
131
  r = !0;
132
132
  case 10:
133
- c = t;
133
+ d = t;
134
134
  break;
135
135
  }
136
- if (c === -1)
136
+ if (d === -1)
137
137
  break;
138
- n(e.subarray(u, c), s), u = t, s = -1;
138
+ n(e.subarray(u, d), s), u = t, s = -1;
139
139
  }
140
140
  u === a ? e = void 0 : u !== 0 && (e = e.subarray(u), t -= u);
141
141
  };
@@ -147,21 +147,21 @@ function Xs(n, e, t) {
147
147
  if (i.length === 0)
148
148
  t == null || t(s), s = Fn();
149
149
  else if (a > 0) {
150
- const u = r.decode(i.subarray(0, a)), c = a + (i[a + 1] === 32 ? 2 : 1), d = r.decode(i.subarray(c));
150
+ const u = r.decode(i.subarray(0, a)), d = a + (i[a + 1] === 32 ? 2 : 1), c = r.decode(i.subarray(d));
151
151
  switch (u) {
152
152
  case "data":
153
153
  s.data = s.data ? s.data + `
154
- ` + d : d;
154
+ ` + c : c;
155
155
  break;
156
156
  case "event":
157
- s.event = d;
157
+ s.event = c;
158
158
  break;
159
159
  case "id":
160
- n(s.id = d);
160
+ n(s.id = c);
161
161
  break;
162
162
  case "retry":
163
- const f = parseInt(d, 10);
164
- isNaN(f) || e(s.retry = f);
163
+ const g = parseInt(c, 10);
164
+ isNaN(g) || e(s.retry = g);
165
165
  break;
166
166
  }
167
167
  }
@@ -189,44 +189,44 @@ var er = function(n, e) {
189
189
  };
190
190
  const rn = "text/event-stream", tr = 1e3, Un = "last-event-id";
191
191
  function nr(n, e) {
192
- var { signal: t, headers: s, onopen: r, onmessage: o, onclose: i, onerror: a, openWhenHidden: u, fetch: c } = e, d = er(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
193
- return new Promise((f, k) => {
194
- const g = Object.assign({}, s);
195
- g.accept || (g.accept = rn);
192
+ var { signal: t, headers: s, onopen: r, onmessage: o, onclose: i, onerror: a, openWhenHidden: u, fetch: d } = e, c = er(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
193
+ return new Promise((g, m) => {
194
+ const f = Object.assign({}, s);
195
+ f.accept || (f.accept = rn);
196
196
  let p;
197
197
  function A() {
198
- p.abort(), document.hidden || _();
198
+ p.abort(), document.hidden || z();
199
199
  }
200
200
  u || document.addEventListener("visibilitychange", A);
201
- let x = tr, m = 0;
201
+ let k = tr, y = 0;
202
202
  function S() {
203
- document.removeEventListener("visibilitychange", A), window.clearTimeout(m), p.abort();
203
+ document.removeEventListener("visibilitychange", A), window.clearTimeout(y), p.abort();
204
204
  }
205
205
  t == null || t.addEventListener("abort", () => {
206
- S(), f();
206
+ S(), g();
207
207
  });
208
- const C = c ?? window.fetch, T = r ?? sr;
209
- async function _() {
210
- var F;
208
+ const E = d ?? window.fetch, T = r ?? sr;
209
+ async function z() {
210
+ var U;
211
211
  p = new AbortController();
212
212
  try {
213
- const V = await C(n, Object.assign(Object.assign({}, d), { headers: g, signal: p.signal }));
214
- await T(V), await Zs(V.body, Ys(Xs((E) => {
215
- E ? g[Un] = E : delete g[Un];
216
- }, (E) => {
217
- x = E;
218
- }, o))), i == null || i(), S(), f();
219
- } catch (V) {
213
+ const J = await E(n, Object.assign(Object.assign({}, c), { headers: f, signal: p.signal }));
214
+ await T(J), await Zs(J.body, Ys(Xs((C) => {
215
+ C ? f[Un] = C : delete f[Un];
216
+ }, (C) => {
217
+ k = C;
218
+ }, o))), i == null || i(), S(), g();
219
+ } catch (J) {
220
220
  if (!p.signal.aborted)
221
221
  try {
222
- const E = (F = a == null ? void 0 : a(V)) !== null && F !== void 0 ? F : x;
223
- window.clearTimeout(m), m = window.setTimeout(_, E);
224
- } catch (E) {
225
- S(), k(E);
222
+ const C = (U = a == null ? void 0 : a(J)) !== null && U !== void 0 ? U : k;
223
+ window.clearTimeout(y), y = window.setTimeout(z, C);
224
+ } catch (C) {
225
+ S(), m(C);
226
226
  }
227
227
  }
228
228
  }
229
- _();
229
+ z();
230
230
  });
231
231
  }
232
232
  function sr(n) {
@@ -237,7 +237,7 @@ function sr(n) {
237
237
  function It(n) {
238
238
  if (!n)
239
239
  throw console.error("[RestifyAi] Endpoint is undefined. Check your endpoints configuration."), new Error("AI service endpoint is not configured. Please contact support.");
240
- const e = J(), t = (e == null ? void 0 : e.baseUrl) || "";
240
+ const e = te(), t = (e == null ? void 0 : e.baseUrl) || "";
241
241
  if (!t || n.startsWith("http://") || n.startsWith("https://")) return n;
242
242
  const s = t.endsWith("/") ? t.slice(0, -1) : t, r = n.startsWith("/") ? n : `/${n}`;
243
243
  return `${s}${r}`;
@@ -246,12 +246,12 @@ function rr(n) {
246
246
  const t = (n instanceof Error ? n.message : String(n)).toLowerCase();
247
247
  return t.includes("failed to fetch") || t.includes("network") || t.includes("fetch") ? "Unable to connect to the AI service. Please check your internet connection and try again." : t.includes("500") || t.includes("internal server error") ? "The AI service is temporarily unavailable. Please try again in a few moments." : t.includes("timeout") || t.includes("timed out") ? "The request took too long. Please try again." : t.includes("401") || t.includes("unauthorized") || t.includes("authentication") ? "Your session has expired. Please refresh the page and try again." : t.includes("429") || t.includes("rate limit") || t.includes("too many requests") ? "Too many requests. Please wait a moment before trying again." : t.includes("cors") || t.includes("cross-origin") ? "Unable to connect to the AI service. Please contact support." : t.includes("endpoint is not configured") ? "AI service endpoint is not configured. Please contact support." : "Something went wrong. Please try again later.";
248
248
  }
249
- function or(n) {
250
- var e, t, s;
249
+ function or(n, e) {
250
+ var t, s, r;
251
251
  try {
252
- if (n === "[DONE]") return "[DONE]";
253
- const r = JSON.parse(n);
254
- return ((s = (t = (e = r == null ? void 0 : r.choices) == null ? void 0 : e[0]) == null ? void 0 : t.delta) == null ? void 0 : s.content) || "";
252
+ if (e === "done" || n === "[DONE]") return "[DONE]";
253
+ const o = JSON.parse(n);
254
+ return (o == null ? void 0 : o.content) !== void 0 ? o.content : ((r = (s = (t = o == null ? void 0 : o.choices) == null ? void 0 : t[0]) == null ? void 0 : s.delta) == null ? void 0 : r.content) || null;
255
255
  } catch {
256
256
  return null;
257
257
  }
@@ -268,31 +268,31 @@ function ar(n) {
268
268
  });
269
269
  }), e;
270
270
  }
271
- function He(n) {
272
- const e = J();
271
+ function Ue(n) {
272
+ const e = te();
273
273
  return n === "chatHistory" ? (e == null ? void 0 : e.chatHistoryKey) || "restify_ai_chat_history" : n === "setupComplete" ? "restify_ai_setup_complete" : (e == null ? void 0 : e.drawerStateKey) || "restify_ai_drawer_open";
274
274
  }
275
275
  function $t(n) {
276
276
  try {
277
- sessionStorage.setItem(He("chatHistory"), JSON.stringify(n));
277
+ sessionStorage.setItem(Ue("chatHistory"), JSON.stringify(n));
278
278
  } catch (e) {
279
279
  console.warn("[RestifyAi] Failed to save chat history:", e);
280
280
  }
281
281
  }
282
282
  function lr() {
283
283
  try {
284
- const n = sessionStorage.getItem(He("chatHistory"));
284
+ const n = sessionStorage.getItem(Ue("chatHistory"));
285
285
  if (n) {
286
286
  const e = JSON.parse(n), t = e.filter((o) => {
287
287
  var i;
288
- return !(o.role === tt.Assistant && o.loading || o.role === tt.Assistant && !((i = o.message) != null && i.trim()));
288
+ return !(o.role === nt.Assistant && o.loading || o.role === nt.Assistant && !((i = o.message) != null && i.trim()));
289
289
  }).map((o) => ({
290
290
  ...o,
291
291
  streaming: !1,
292
292
  loading: !1
293
293
  }));
294
- t.length !== e.length && sessionStorage.setItem(He("chatHistory"), JSON.stringify(t));
295
- const s = t[t.length - 1], r = (s == null ? void 0 : s.role) === tt.User;
294
+ t.length !== e.length && sessionStorage.setItem(Ue("chatHistory"), JSON.stringify(t));
295
+ const s = t[t.length - 1], r = (s == null ? void 0 : s.role) === nt.User;
296
296
  return {
297
297
  history: t,
298
298
  hasOrphanedUserMessage: r,
@@ -309,7 +309,7 @@ function lr() {
309
309
  }
310
310
  function ur() {
311
311
  try {
312
- sessionStorage.removeItem(He("chatHistory"));
312
+ sessionStorage.removeItem(Ue("chatHistory"));
313
313
  } catch (n) {
314
314
  console.warn("[RestifyAi] Failed to clear chat history:", n);
315
315
  }
@@ -340,14 +340,14 @@ function hr() {
340
340
  }
341
341
  function Qt(n) {
342
342
  try {
343
- localStorage.setItem(He("drawerState"), JSON.stringify(n));
343
+ localStorage.setItem(Ue("drawerState"), JSON.stringify(n));
344
344
  } catch (e) {
345
345
  console.warn("[RestifyAi] Failed to save drawer state:", e);
346
346
  }
347
347
  }
348
- function pr() {
348
+ function fr() {
349
349
  try {
350
- const n = localStorage.getItem(He("drawerState"));
350
+ const n = localStorage.getItem(Ue("drawerState"));
351
351
  if (n !== null)
352
352
  return JSON.parse(n);
353
353
  } catch (n) {
@@ -355,16 +355,16 @@ function pr() {
355
355
  }
356
356
  return !1;
357
357
  }
358
- function fr() {
358
+ function pr() {
359
359
  try {
360
- return localStorage.getItem(He("setupComplete")) === "true";
360
+ return localStorage.getItem(Ue("setupComplete")) === "true";
361
361
  } catch {
362
362
  return !1;
363
363
  }
364
364
  }
365
365
  function qn() {
366
366
  try {
367
- localStorage.setItem(He("setupComplete"), "true");
367
+ localStorage.setItem(Ue("setupComplete"), "true");
368
368
  } catch (n) {
369
369
  console.warn("[RestifyAi] Failed to mark setup complete:", n);
370
370
  }
@@ -380,7 +380,7 @@ function jn() {
380
380
  };
381
381
  }
382
382
  let ct = new AbortController();
383
- const We = Vs("restifyAiStore", {
383
+ const Ge = Vs("restifyAiStore", {
384
384
  state: () => {
385
385
  const n = lr(), e = dr();
386
386
  let t = {
@@ -403,18 +403,21 @@ const We = Vs("restifyAiStore", {
403
403
  timestamp: Date.now(),
404
404
  quotaExceeded: !1
405
405
  }), {
406
- chatHistoryLimit: et("chatHistoryLimit") || 20,
406
+ chatHistoryLimit: Be("chatHistoryLimit") || 20,
407
407
  chatHistory: n.history,
408
408
  uploadedFiles: ar(n.history),
409
409
  loading: !1,
410
- showChat: pr(),
410
+ showChat: fr(),
411
411
  isFullscreen: !1,
412
412
  sending: !1,
413
413
  pageContext: null,
414
- quota: { limit: 100, used: 0, remaining: 100 },
414
+ quota: (() => {
415
+ const s = Be("chatHistoryLimit") || 10, r = n.history.filter((o) => o.role === "user").length;
416
+ return { limit: s, used: r, remaining: Math.max(0, s - r) };
417
+ })(),
415
418
  error: t,
416
419
  supportRequestMode: !1,
417
- setupState: !is() && !fr() ? { ...jn(), isActive: !0 } : jn()
420
+ setupState: !is() && !pr() ? { ...jn(), isActive: !0 } : jn()
418
421
  };
419
422
  },
420
423
  getters: {
@@ -423,24 +426,24 @@ const We = Vs("restifyAiStore", {
423
426
  canChat: (n) => !n.setupState.isActive || n.setupState.connectionStatus === "connected"
424
427
  },
425
428
  actions: {
426
- async scrollToBottom() {
427
- await Oe();
428
- const n = document.getElementById("rai-chat-bottom");
429
- n && n.scrollIntoView({ behavior: "smooth" });
429
+ async scrollToBottom(n = 0) {
430
+ await Pe(), n > 0 && await new Promise((t) => setTimeout(t, n));
431
+ const e = document.getElementById("rai-chat-bottom");
432
+ e && e.scrollIntoView({ behavior: "smooth" });
430
433
  },
431
- parseStreamContent(n) {
432
- const e = J(), t = e == null ? void 0 : e.parseStreamContent;
433
- return t ? t(n.data) : or(n.data);
434
+ parseStreamContent(n, e) {
435
+ const t = te(), s = t == null ? void 0 : t.parseStreamContent;
436
+ return s ? s(e, n) : or(e, n);
434
437
  },
435
438
  async askQuestion(n, e = [], t = [], s = !1) {
436
- var g;
437
- const r = J();
439
+ var f;
440
+ const r = te();
438
441
  if (!r)
439
442
  return console.warn("[RestifyAi] Cannot ask question - plugin not configured"), !1;
440
443
  let o = "", i = !1;
441
- const a = r.retry || {}, u = a.maxRetries ?? 0, c = a.retryDelay ?? 1e3;
442
- let d = 0;
443
- const f = e.map((p) => ({
444
+ const a = r.retry || {}, u = a.maxRetries ?? 0, d = a.retryDelay ?? 1e3;
445
+ let c = 0;
446
+ const g = e.map((p) => ({
444
447
  id: p.id,
445
448
  name: p.name,
446
449
  url: p.url,
@@ -450,117 +453,133 @@ const We = Vs("restifyAiStore", {
450
453
  }));
451
454
  this.chatHistory.push({
452
455
  id: crypto.randomUUID(),
453
- role: tt.User,
456
+ role: nt.User,
454
457
  message: n,
455
458
  loading: !1,
456
- attachments: f,
459
+ attachments: g,
457
460
  mentions: t,
458
461
  timestamp: Date.now()
459
- }), f.forEach((p) => this.registerUploadedFile(p)), $t(this.chatHistory), this.sending = !0, this.chatHistory.length >= this.chatHistoryLimit && ((g = r.onError) == null || g.call(r, new Error("Chat history limit reached")));
460
- const k = async () => {
461
- var p, A, x;
462
+ }), g.forEach((p) => this.registerUploadedFile(p)), $t(this.chatHistory), this.sending = !0, this.quota.remaining > 0 && !s && (this.quota.remaining--, this.quota.used++), this.scrollToBottom(), this.chatHistory.length >= this.chatHistoryLimit && ((f = r.onError) == null || f.call(r, new Error("Chat history limit reached")));
463
+ const m = async () => {
464
+ var p, A, k;
462
465
  try {
463
- const m = this.chatHistory.map((L) => ({
464
- role: L.role,
465
- message: L.message,
466
- attachments: L.attachments ?? []
467
- })), S = {}, C = (L) => {
468
- L != null && L.id && (S[L.id] = {
469
- extracted_text: L.extractedText || "",
470
- file_name: L.name,
471
- mime_type: L.type || "",
472
- ...L.size ? { file_size: L.size } : {},
473
- ...L.url ? { file_url: L.url } : {}
466
+ const y = this.chatHistory.map((I) => ({
467
+ role: I.role,
468
+ content: I.message
469
+ })), S = {}, E = (I) => {
470
+ I != null && I.id && (S[I.id] = {
471
+ extracted_text: I.extractedText || "",
472
+ file_name: I.name,
473
+ mime_type: I.type || "",
474
+ ...I.size ? { file_size: I.size } : {},
475
+ ...I.url ? { file_url: I.url } : {}
474
476
  });
475
477
  };
476
- Object.values(this.uploadedFiles).forEach(C), this.chatHistory.forEach((L) => {
477
- var ee;
478
- return (ee = L.attachments) == null ? void 0 : ee.forEach(C);
479
- }), f.forEach(C);
480
- const T = Object.values(S), _ = this.chatHistory.length;
478
+ Object.values(this.uploadedFiles).forEach(E), this.chatHistory.forEach((I) => {
479
+ var V;
480
+ return (V = I.attachments) == null ? void 0 : V.forEach(E);
481
+ }), g.forEach(E);
482
+ const T = Object.values(S), z = this.chatHistory.length;
481
483
  this.chatHistory.push({
482
484
  id: crypto.randomUUID(),
483
- role: tt.Assistant,
485
+ role: nt.Assistant,
484
486
  message: "",
485
487
  loading: !0,
486
488
  timestamp: Date.now()
487
- }), $t(this.chatHistory), ct = new AbortController();
488
- const F = await r.getAuthToken(), E = {
489
+ }), $t(this.chatHistory), ct = new AbortController(), this.scrollToBottom();
490
+ const U = await r.getAuthToken(), C = {
489
491
  "Content-Type": "application/json",
490
492
  Accept: "application/vnd.api+json",
491
493
  ...r.getCustomHeaders ? await r.getCustomHeaders() : {}
492
494
  };
493
- this.setupState.isActive && this.setupState.testApiKey ? E["X-Test-Api-Key"] = this.setupState.testApiKey : F && (E.Authorization = `Bearer ${F}`);
494
- let M = {
495
- question: n,
496
- history: m,
495
+ this.setupState.isActive && this.setupState.testApiKey ? C["X-Test-Api-Key"] = this.setupState.testApiKey : U && (C.Authorization = `Bearer ${U}`);
496
+ const _ = {};
497
+ if (typeof window < "u") {
498
+ _.route = window.location.pathname;
499
+ const I = new URLSearchParams(window.location.search), V = {};
500
+ I.forEach((qe, Me) => {
501
+ V[Me] = qe;
502
+ }), Object.keys(V).length > 0 && (_.query = V), document.title && (_.pageTitle = document.title);
503
+ }
504
+ t.length > 0 && (_.mentionedEntities = t.map((I) => ({
505
+ type: I.type,
506
+ id: I.id,
507
+ displayName: I.name,
508
+ metadata: I.metadata
509
+ })));
510
+ let R = {
511
+ message: n,
512
+ history: y,
497
513
  stream: !0,
498
514
  ...T.length > 0 && { files: T },
499
- ...t.length > 0 && { mentions: t },
500
- ...this.supportRequestMode && { contact_support: !0 }
515
+ ...Object.keys(_).length > 0 && { context: _ },
516
+ ...this.supportRequestMode && { contact_support: !0 },
517
+ ...r.model && { model: r.model },
518
+ ...r.temperature && { temperature: r.temperature },
519
+ ...r.maxTokens && { max_tokens: r.maxTokens }
501
520
  };
502
- r.beforeSend && (M = await r.beforeSend(M)), r.buildRequest && (M = await r.buildRequest(M)), (p = r.onMessageSent) == null || p.call(r, this.chatHistory[_ - 1]);
503
- const I = It(r.endpoints.ask);
504
- let z = {
521
+ r.beforeSend && (R = await r.beforeSend(R)), r.buildRequest && (R = await r.buildRequest(R)), (p = r.onMessageSent) == null || p.call(r, this.chatHistory[z - 1]);
522
+ const M = It(r.endpoints.ask);
523
+ let Z = {
505
524
  method: "POST",
506
- body: JSON.stringify(M),
507
- headers: E
525
+ body: JSON.stringify(R),
526
+ headers: C
508
527
  };
509
- return r.requestInterceptor && (z = await r.requestInterceptor(I, z)), (A = r.onStreamStart) == null || A.call(r), await nr(I, {
528
+ return r.requestInterceptor && (Z = await r.requestInterceptor(M, Z)), (A = r.onStreamStart) == null || A.call(r), await nr(M, {
510
529
  method: "POST",
511
- body: JSON.stringify(M),
530
+ body: JSON.stringify(R),
512
531
  signal: ct.signal,
513
- headers: z.headers,
532
+ headers: Z.headers,
514
533
  openWhenHidden: !0,
515
- async onopen(L) {
516
- if (!L.ok) {
517
- if (L.status === 429) {
518
- const ee = We();
519
- throw ee.error = {
520
- message: ce("noQuota"),
534
+ async onopen(I) {
535
+ if (!I.ok) {
536
+ if (I.status === 429) {
537
+ const V = Ge();
538
+ throw V.error = {
539
+ message: de("noQuota"),
521
540
  failedQuestion: n,
522
- failedAttachments: f,
541
+ failedAttachments: g,
523
542
  timestamp: Date.now(),
524
543
  quotaExceeded: !0
525
- }, await ee.fetchQuota(), new Error("Quota exceeded");
544
+ }, await V.fetchQuota(), new Error("Quota exceeded");
526
545
  }
527
- throw new Error(`Failed to connect: ${L.status}`);
546
+ throw new Error(`Failed to connect: ${I.status}`);
528
547
  }
529
548
  },
530
- onmessage: async (L) => {
531
- var Ve, Be, Me;
532
- const ee = this.parseStreamContent(L);
533
- if (!ee) return;
534
- this.chatHistory[_].loading = !1;
535
- const Te = {
536
- content: ee,
537
- done: ee === "[DONE]",
538
- raw: L.data
549
+ onmessage: async (I) => {
550
+ var Me, Re, ze;
551
+ const V = this.parseStreamContent(I.event, I.data);
552
+ if (!V) return;
553
+ this.chatHistory[z].loading = !1;
554
+ const qe = {
555
+ content: V,
556
+ done: V === "[DONE]",
557
+ raw: I.data
539
558
  };
540
- (Ve = r.onStreamChunk) == null || Ve.call(r, Te), o ? ee === "[DONE]" ? (this.chatHistory[_].streaming = !1, $t(this.chatHistory), (Be = r.onStreamEnd) == null || Be.call(r, o), this.quota.remaining > 0 && !this.supportRequestMode && (this.quota.remaining--, this.quota.used++, this.quota.remaining === 0 && r.enableSupportMode !== !1 && (this.supportRequestMode = !0)), this.supportRequestMode && this.quota.remaining > 0 && (this.supportRequestMode = !1), r.afterResponse && await r.afterResponse(this.chatHistory[_]), (Me = r.onResponseReceived) == null || Me.call(r, this.chatHistory[_])) : (o += ee, this.chatHistory[_].message = o) : (o = ee, this.chatHistory[_].message = o, this.chatHistory[_].streaming = !0), await this.scrollToBottom();
559
+ (Me = r.onStreamChunk) == null || Me.call(r, qe), o ? V === "[DONE]" ? (this.chatHistory[z].streaming = !1, $t(this.chatHistory), (Re = r.onStreamEnd) == null || Re.call(r, o), this.quota.remaining === 0 && r.enableSupportMode !== !1 && (this.supportRequestMode = !0), this.supportRequestMode && this.quota.remaining > 0 && (this.supportRequestMode = !1), r.afterResponse && await r.afterResponse(this.chatHistory[z]), (ze = r.onResponseReceived) == null || ze.call(r, this.chatHistory[z])) : (o += V, this.chatHistory[z].message = o) : (o = V, this.chatHistory[z].message = o, this.chatHistory[z].streaming = !0), await this.scrollToBottom();
541
560
  },
542
- onerror(L) {
543
- throw i = !0, L;
561
+ onerror(I) {
562
+ throw i = !0, I;
544
563
  }
545
564
  }), !0;
546
- } catch (m) {
565
+ } catch (y) {
547
566
  i = !0;
548
567
  const S = this.chatHistory.length - 1;
549
- return this.chatHistory.splice(S, 1), m.name === "AbortError" ? !0 : d < u && (a.shouldRetry ? a.shouldRetry(m, d) : !0) ? (d++, await ir(c * d), k()) : (this.error = {
550
- message: rr(m),
568
+ return this.chatHistory.splice(S, 1), y.name === "AbortError" ? !0 : c < u && (a.shouldRetry ? a.shouldRetry(y, c) : !0) ? (c++, await ir(d * c), m()) : (this.error = {
569
+ message: rr(y),
551
570
  failedQuestion: n,
552
- failedAttachments: f,
571
+ failedAttachments: g,
553
572
  timestamp: Date.now()
554
573
  }, cr({
555
574
  message: this.error.message,
556
575
  failedQuestion: this.error.failedQuestion,
557
576
  failedAttachments: this.error.failedAttachments || null
558
- }), (x = r.onError) == null || x.call(r, m), !1);
577
+ }), (k = r.onError) == null || k.call(r, y), !1);
559
578
  } finally {
560
579
  this.sending = !1;
561
580
  }
562
581
  };
563
- return k();
582
+ return m();
564
583
  },
565
584
  cancelRequest() {
566
585
  ct == null || ct.abort(), this.chatHistory = this.chatHistory.map((n) => ({
@@ -570,14 +589,16 @@ const We = Vs("restifyAiStore", {
570
589
  })), this.sending = !1;
571
590
  },
572
591
  clearChatHistory() {
573
- var e;
574
- const n = J();
575
- this.chatHistory = [], this.sending = !1, this.uploadedFiles = {}, this.clearError(), this.quota.remaining > 0 && (this.supportRequestMode = !1), ur(), (e = n == null ? void 0 : n.onNewChat) == null || e.call(n);
592
+ var t;
593
+ const n = te();
594
+ this.chatHistory = [], this.sending = !1, this.uploadedFiles = {}, this.clearError(), this.quota.remaining > 0 && (this.supportRequestMode = !1);
595
+ const e = Be("chatHistoryLimit") || 10;
596
+ this.quota = { limit: e, used: 0, remaining: e }, ur(), (t = n == null ? void 0 : n.onNewChat) == null || t.call(n);
576
597
  },
577
598
  async retry() {
578
599
  if (!this.error.failedQuestion) return !1;
579
600
  const n = this.error.failedQuestion, e = this.error.failedAttachments || [], t = this.chatHistory[this.chatHistory.length - 1];
580
- return (t == null ? void 0 : t.role) === tt.User && t.message === n && (this.chatHistory.pop(), $t(this.chatHistory)), this.clearError(), await this.askQuestion(n, e);
601
+ return (t == null ? void 0 : t.role) === nt.User && t.message === n && (this.chatHistory.pop(), $t(this.chatHistory)), this.clearError(), await this.askQuestion(n, e);
581
602
  },
582
603
  clearError() {
583
604
  this.error = {
@@ -593,7 +614,7 @@ const We = Vs("restifyAiStore", {
593
614
  },
594
615
  async fetchQuota() {
595
616
  var e, t;
596
- const n = J();
617
+ const n = te();
597
618
  if ((e = n == null ? void 0 : n.endpoints) != null && e.quota)
598
619
  try {
599
620
  const s = await n.getAuthToken(), r = n.getCustomHeaders ? await n.getCustomHeaders() : {}, o = It(n.endpoints.quota), i = await fetch(o, {
@@ -617,7 +638,7 @@ const We = Vs("restifyAiStore", {
617
638
  },
618
639
  async uploadFile(n) {
619
640
  var r, o, i, a, u;
620
- const e = J();
641
+ const e = te();
621
642
  if (!((r = e == null ? void 0 : e.endpoints) != null && r.uploadFile))
622
643
  return console.warn("[RestifyAi] No uploadFile endpoint configured"), null;
623
644
  const s = {
@@ -630,24 +651,24 @@ const We = Vs("restifyAiStore", {
630
651
  };
631
652
  (o = e.onFileUploadStart) == null || o.call(e, s);
632
653
  try {
633
- const c = await e.getAuthToken(), d = e.getCustomHeaders ? await e.getCustomHeaders() : {}, f = It(e.endpoints.uploadFile), k = new FormData();
634
- k.append("file", n);
635
- const g = await new Promise((p, A) => {
636
- const x = new XMLHttpRequest();
637
- x.upload.addEventListener("progress", (m) => {
654
+ const d = await e.getAuthToken(), c = e.getCustomHeaders ? await e.getCustomHeaders() : {}, g = It(e.endpoints.uploadFile), m = new FormData();
655
+ m.append("file", n);
656
+ const f = await new Promise((p, A) => {
657
+ const k = new XMLHttpRequest();
658
+ k.upload.addEventListener("progress", (y) => {
638
659
  var S;
639
- if (m.lengthComputable) {
640
- const C = Math.round(m.loaded / m.total * 100);
641
- s.progress = C, (S = e.onFileUploadProgress) == null || S.call(e, s, C);
660
+ if (y.lengthComputable) {
661
+ const E = Math.round(y.loaded / y.total * 100);
662
+ s.progress = E, (S = e.onFileUploadProgress) == null || S.call(e, s, E);
642
663
  }
643
- }), x.addEventListener("load", () => {
644
- var m, S;
645
- if (x.status >= 200 && x.status < 300)
664
+ }), k.addEventListener("load", () => {
665
+ var y, S;
666
+ if (k.status >= 200 && k.status < 300)
646
667
  try {
647
- const C = JSON.parse(x.responseText), T = {
668
+ const E = JSON.parse(k.responseText), T = {
648
669
  ...s,
649
- url: C.url || ((m = C.data) == null ? void 0 : m.url),
650
- extractedText: C.extracted_text || ((S = C.data) == null ? void 0 : S.extracted_text),
670
+ url: E.url || ((y = E.data) == null ? void 0 : y.url),
671
+ extractedText: E.extracted_text || ((S = E.data) == null ? void 0 : S.extracted_text),
651
672
  uploading: !1,
652
673
  progress: 100
653
674
  };
@@ -656,13 +677,13 @@ const We = Vs("restifyAiStore", {
656
677
  A(new Error("Failed to parse upload response"));
657
678
  }
658
679
  else
659
- A(new Error(`Upload failed: ${x.status}`));
660
- }), x.addEventListener("error", () => A(new Error("Upload failed"))), x.open("POST", f), c && x.setRequestHeader("Authorization", `Bearer ${c}`), Object.entries(d).forEach(([m, S]) => x.setRequestHeader(m, S)), x.send(k);
680
+ A(new Error(`Upload failed: ${k.status}`));
681
+ }), k.addEventListener("error", () => A(new Error("Upload failed"))), k.open("POST", g), d && k.setRequestHeader("Authorization", `Bearer ${d}`), Object.entries(c).forEach(([y, S]) => k.setRequestHeader(y, S)), k.send(m);
661
682
  });
662
- return (i = e.onFileUploadComplete) == null || i.call(e, g), g;
663
- } catch (c) {
664
- const d = { ...s, uploading: !1 };
665
- return (a = e.onFileUploadError) == null || a.call(e, d, c), (u = e.onError) == null || u.call(e, c), null;
683
+ return (i = e.onFileUploadComplete) == null || i.call(e, f), f;
684
+ } catch (d) {
685
+ const c = { ...s, uploading: !1 };
686
+ return (a = e.onFileUploadError) == null || a.call(e, c, d), (u = e.onError) == null || u.call(e, d), null;
666
687
  }
667
688
  },
668
689
  setPageContext(n) {
@@ -670,15 +691,15 @@ const We = Vs("restifyAiStore", {
670
691
  },
671
692
  toggleDrawer() {
672
693
  var n, e;
673
- this.showChat = !this.showChat, Qt(this.showChat), (e = (n = J()) == null ? void 0 : n.onDrawerToggle) == null || e.call(n, this.showChat);
694
+ this.showChat = !this.showChat, Qt(this.showChat), (e = (n = te()) == null ? void 0 : n.onDrawerToggle) == null || e.call(n, this.showChat), this.showChat && this.scrollToBottom(100);
674
695
  },
675
696
  openDrawer() {
676
697
  var n, e;
677
- this.showChat = !0, Qt(!0), (e = (n = J()) == null ? void 0 : n.onDrawerToggle) == null || e.call(n, !0);
698
+ this.showChat = !0, Qt(!0), (e = (n = te()) == null ? void 0 : n.onDrawerToggle) == null || e.call(n, !0), this.scrollToBottom(100);
678
699
  },
679
700
  closeDrawer() {
680
701
  var n, e;
681
- this.showChat = !1, Qt(!1), (e = (n = J()) == null ? void 0 : n.onDrawerToggle) == null || e.call(n, !1);
702
+ this.showChat = !1, Qt(!1), (e = (n = te()) == null ? void 0 : n.onDrawerToggle) == null || e.call(n, !1);
682
703
  },
683
704
  startSupportRequest() {
684
705
  this.supportRequestMode = !0;
@@ -708,7 +729,7 @@ const We = Vs("restifyAiStore", {
708
729
  },
709
730
  async testConnection() {
710
731
  this.setupState.connectionStatus = "testing", this.setupState.lastError = null;
711
- const n = J();
732
+ const n = te();
712
733
  if (!n)
713
734
  return this.setupState.connectionStatus = "failed", this.setupState.lastError = "Plugin not configured", !1;
714
735
  try {
@@ -731,7 +752,7 @@ const We = Vs("restifyAiStore", {
731
752
  },
732
753
  completeSetup() {
733
754
  var n, e;
734
- this.setupState.isActive = !1, this.setupState.currentStep = "complete", qn(), (e = (n = J()) == null ? void 0 : n.onSetupComplete) == null || e.call(n);
755
+ this.setupState.isActive = !1, this.setupState.currentStep = "complete", qn(), (e = (n = te()) == null ? void 0 : n.onSetupComplete) == null || e.call(n);
735
756
  },
736
757
  skipSetup() {
737
758
  this.setupState.isActive = !1, qn();
@@ -742,9 +763,9 @@ function as(n) {
742
763
  const e = /@\[([^\]]+)\]\(([^)]+)\)/g, t = [];
743
764
  let s = n, r;
744
765
  for (; (r = e.exec(n)) !== null; ) {
745
- const [o, i, a] = r, [u, c] = a.includes(":") ? a.split(":") : ["default", a];
766
+ const [o, i, a] = r, [u, d] = a.includes(":") ? a.split(":") : ["default", a];
746
767
  t.push({
747
- id: c,
768
+ id: d,
748
769
  name: i,
749
770
  type: u
750
771
  }), s = s.replace(o, i);
@@ -789,11 +810,11 @@ function mr(n, e) {
789
810
  }
790
811
  function ds(n) {
791
812
  var t;
792
- const e = J();
813
+ const e = te();
793
814
  return (t = e == null ? void 0 : e.mentionProviders) == null ? void 0 : t.find((s) => s.type === n);
794
815
  }
795
816
  function hs(n) {
796
- const e = J(), t = (e == null ? void 0 : e.mentionProviders) || [];
817
+ const e = te(), t = (e == null ? void 0 : e.mentionProviders) || [];
797
818
  return n ? t.filter((s) => s.routes ? s.routes.some((r) => r.endsWith("*") ? n.startsWith(r.slice(0, -1)) : n === r || n.startsWith(r + "/")) : !0) : t;
798
819
  }
799
820
  function yr(n) {
@@ -838,20 +859,20 @@ function hn() {
838
859
  walkTokens: null
839
860
  };
840
861
  }
841
- let Ke = hn();
842
- function ps(n) {
843
- Ke = n;
862
+ let Qe = hn();
863
+ function fs(n) {
864
+ Qe = n;
844
865
  }
845
- const fs = /[&<>"']/, kr = new RegExp(fs.source, "g"), gs = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, wr = new RegExp(gs.source, "g"), br = {
866
+ const ps = /[&<>"']/, kr = new RegExp(ps.source, "g"), gs = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, wr = new RegExp(gs.source, "g"), br = {
846
867
  "&": "&amp;",
847
868
  "<": "&lt;",
848
869
  ">": "&gt;",
849
870
  '"': "&quot;",
850
871
  "'": "&#39;"
851
872
  }, Wn = (n) => br[n];
852
- function ye(n, e) {
873
+ function xe(n, e) {
853
874
  if (e) {
854
- if (fs.test(n))
875
+ if (ps.test(n))
855
876
  return n.replace(kr, Wn);
856
877
  } else if (gs.test(n))
857
878
  return n.replace(wr, Wn);
@@ -881,8 +902,8 @@ function Kn(n) {
881
902
  const xt = { exec: () => null };
882
903
  function Vn(n, e) {
883
904
  const t = n.replace(/\|/g, (o, i, a) => {
884
- let u = !1, c = i;
885
- for (; --c >= 0 && a[c] === "\\"; )
905
+ let u = !1, d = i;
906
+ for (; --d >= 0 && a[d] === "\\"; )
886
907
  u = !u;
887
908
  return u ? "|" : " |";
888
909
  }), s = t.split(/ \|/);
@@ -920,7 +941,7 @@ function Tr(n, e) {
920
941
  return -1;
921
942
  }
922
943
  function Gn(n, e, t, s) {
923
- const r = e.href, o = e.title ? ye(e.title) : null, i = n[1].replace(/\\([\[\]])/g, "$1");
944
+ const r = e.href, o = e.title ? xe(e.title) : null, i = n[1].replace(/\\([\[\]])/g, "$1");
924
945
  if (n[0].charAt(0) !== "!") {
925
946
  s.state.inLink = !0;
926
947
  const a = {
@@ -938,7 +959,7 @@ function Gn(n, e, t, s) {
938
959
  raw: t,
939
960
  href: r,
940
961
  title: o,
941
- text: ye(i)
962
+ text: xe(i)
942
963
  };
943
964
  }
944
965
  function Sr(n, e) {
@@ -963,7 +984,7 @@ class _t {
963
984
  K(this, "rules");
964
985
  // set by the lexer
965
986
  K(this, "lexer");
966
- this.options = e || Ke;
987
+ this.options = e || Qe;
967
988
  }
968
989
  space(e) {
969
990
  const t = this.rules.block.newline.exec(e);
@@ -1034,38 +1055,38 @@ class _t {
1034
1055
  for (; s.length > 0; ) {
1035
1056
  let a = !1;
1036
1057
  const u = [];
1037
- let c;
1038
- for (c = 0; c < s.length; c++)
1039
- if (/^ {0,3}>/.test(s[c]))
1040
- u.push(s[c]), a = !0;
1058
+ let d;
1059
+ for (d = 0; d < s.length; d++)
1060
+ if (/^ {0,3}>/.test(s[d]))
1061
+ u.push(s[d]), a = !0;
1041
1062
  else if (!a)
1042
- u.push(s[c]);
1063
+ u.push(s[d]);
1043
1064
  else
1044
1065
  break;
1045
- s = s.slice(c);
1046
- const d = u.join(`
1047
- `), f = d.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, `
1066
+ s = s.slice(d);
1067
+ const c = u.join(`
1068
+ `), g = c.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, `
1048
1069
  $1`).replace(/^ {0,3}>[ \t]?/gm, "");
1049
1070
  r = r ? `${r}
1050
- ${d}` : d, o = o ? `${o}
1051
- ${f}` : f;
1052
- const k = this.lexer.state.top;
1053
- if (this.lexer.state.top = !0, this.lexer.blockTokens(f, i, !0), this.lexer.state.top = k, s.length === 0)
1071
+ ${c}` : c, o = o ? `${o}
1072
+ ${g}` : g;
1073
+ const m = this.lexer.state.top;
1074
+ if (this.lexer.state.top = !0, this.lexer.blockTokens(g, i, !0), this.lexer.state.top = m, s.length === 0)
1054
1075
  break;
1055
- const g = i[i.length - 1];
1056
- if ((g == null ? void 0 : g.type) === "code")
1076
+ const f = i[i.length - 1];
1077
+ if ((f == null ? void 0 : f.type) === "code")
1057
1078
  break;
1058
- if ((g == null ? void 0 : g.type) === "blockquote") {
1059
- const p = g, A = p.raw + `
1079
+ if ((f == null ? void 0 : f.type) === "blockquote") {
1080
+ const p = f, A = p.raw + `
1060
1081
  ` + s.join(`
1061
- `), x = this.blockquote(A);
1062
- i[i.length - 1] = x, r = r.substring(0, r.length - p.raw.length) + x.raw, o = o.substring(0, o.length - p.text.length) + x.text;
1082
+ `), k = this.blockquote(A);
1083
+ i[i.length - 1] = k, r = r.substring(0, r.length - p.raw.length) + k.raw, o = o.substring(0, o.length - p.text.length) + k.text;
1063
1084
  break;
1064
- } else if ((g == null ? void 0 : g.type) === "list") {
1065
- const p = g, A = p.raw + `
1085
+ } else if ((f == null ? void 0 : f.type) === "list") {
1086
+ const p = f, A = p.raw + `
1066
1087
  ` + s.join(`
1067
- `), x = this.list(A);
1068
- i[i.length - 1] = x, r = r.substring(0, r.length - g.raw.length) + x.raw, o = o.substring(0, o.length - p.raw.length) + x.raw, s = A.substring(i[i.length - 1].raw.length).split(`
1088
+ `), k = this.list(A);
1089
+ i[i.length - 1] = k, r = r.substring(0, r.length - f.raw.length) + k.raw, o = o.substring(0, o.length - p.raw.length) + k.raw, s = A.substring(i[i.length - 1].raw.length).split(`
1069
1090
  `);
1070
1091
  continue;
1071
1092
  }
@@ -1094,52 +1115,52 @@ ${f}` : f;
1094
1115
  const i = new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`);
1095
1116
  let a = !1;
1096
1117
  for (; e; ) {
1097
- let u = !1, c = "", d = "";
1118
+ let u = !1, d = "", c = "";
1098
1119
  if (!(t = i.exec(e)) || this.rules.block.hr.test(e))
1099
1120
  break;
1100
- c = t[0], e = e.substring(c.length);
1101
- let f = t[2].split(`
1102
- `, 1)[0].replace(/^\t+/, (m) => " ".repeat(3 * m.length)), k = e.split(`
1103
- `, 1)[0], g = !f.trim(), p = 0;
1104
- if (this.options.pedantic ? (p = 2, d = f.trimStart()) : g ? p = t[1].length + 1 : (p = t[2].search(/[^ ]/), p = p > 4 ? 1 : p, d = f.slice(p), p += t[1].length), g && /^[ \t]*$/.test(k) && (c += k + `
1105
- `, e = e.substring(k.length + 1), u = !0), !u) {
1106
- const m = new RegExp(`^ {0,${Math.min(3, p - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), S = new RegExp(`^ {0,${Math.min(3, p - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), C = new RegExp(`^ {0,${Math.min(3, p - 1)}}(?:\`\`\`|~~~)`), T = new RegExp(`^ {0,${Math.min(3, p - 1)}}#`), _ = new RegExp(`^ {0,${Math.min(3, p - 1)}}<(?:[a-z].*>|!--)`, "i");
1121
+ d = t[0], e = e.substring(d.length);
1122
+ let g = t[2].split(`
1123
+ `, 1)[0].replace(/^\t+/, (y) => " ".repeat(3 * y.length)), m = e.split(`
1124
+ `, 1)[0], f = !g.trim(), p = 0;
1125
+ if (this.options.pedantic ? (p = 2, c = g.trimStart()) : f ? p = t[1].length + 1 : (p = t[2].search(/[^ ]/), p = p > 4 ? 1 : p, c = g.slice(p), p += t[1].length), f && /^[ \t]*$/.test(m) && (d += m + `
1126
+ `, e = e.substring(m.length + 1), u = !0), !u) {
1127
+ const y = new RegExp(`^ {0,${Math.min(3, p - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), S = new RegExp(`^ {0,${Math.min(3, p - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), E = new RegExp(`^ {0,${Math.min(3, p - 1)}}(?:\`\`\`|~~~)`), T = new RegExp(`^ {0,${Math.min(3, p - 1)}}#`), z = new RegExp(`^ {0,${Math.min(3, p - 1)}}<(?:[a-z].*>|!--)`, "i");
1107
1128
  for (; e; ) {
1108
- const F = e.split(`
1129
+ const U = e.split(`
1109
1130
  `, 1)[0];
1110
- let V;
1111
- if (k = F, this.options.pedantic ? (k = k.replace(/^ {1,4}(?=( {4})*[^ ])/g, " "), V = k) : V = k.replace(/\t/g, " "), C.test(k) || T.test(k) || _.test(k) || m.test(k) || S.test(k))
1131
+ let J;
1132
+ if (m = U, this.options.pedantic ? (m = m.replace(/^ {1,4}(?=( {4})*[^ ])/g, " "), J = m) : J = m.replace(/\t/g, " "), E.test(m) || T.test(m) || z.test(m) || y.test(m) || S.test(m))
1112
1133
  break;
1113
- if (V.search(/[^ ]/) >= p || !k.trim())
1114
- d += `
1115
- ` + V.slice(p);
1134
+ if (J.search(/[^ ]/) >= p || !m.trim())
1135
+ c += `
1136
+ ` + J.slice(p);
1116
1137
  else {
1117
- if (g || f.replace(/\t/g, " ").search(/[^ ]/) >= 4 || C.test(f) || T.test(f) || S.test(f))
1138
+ if (f || g.replace(/\t/g, " ").search(/[^ ]/) >= 4 || E.test(g) || T.test(g) || S.test(g))
1118
1139
  break;
1119
- d += `
1120
- ` + k;
1140
+ c += `
1141
+ ` + m;
1121
1142
  }
1122
- !g && !k.trim() && (g = !0), c += F + `
1123
- `, e = e.substring(F.length + 1), f = V.slice(p);
1143
+ !f && !m.trim() && (f = !0), d += U + `
1144
+ `, e = e.substring(U.length + 1), g = J.slice(p);
1124
1145
  }
1125
1146
  }
1126
- o.loose || (a ? o.loose = !0 : /\n[ \t]*\n[ \t]*$/.test(c) && (a = !0));
1127
- let A = null, x;
1128
- this.options.gfm && (A = /^\[[ xX]\] /.exec(d), A && (x = A[0] !== "[ ] ", d = d.replace(/^\[[ xX]\] +/, ""))), o.items.push({
1147
+ o.loose || (a ? o.loose = !0 : /\n[ \t]*\n[ \t]*$/.test(d) && (a = !0));
1148
+ let A = null, k;
1149
+ this.options.gfm && (A = /^\[[ xX]\] /.exec(c), A && (k = A[0] !== "[ ] ", c = c.replace(/^\[[ xX]\] +/, ""))), o.items.push({
1129
1150
  type: "list_item",
1130
- raw: c,
1151
+ raw: d,
1131
1152
  task: !!A,
1132
- checked: x,
1153
+ checked: k,
1133
1154
  loose: !1,
1134
- text: d,
1155
+ text: c,
1135
1156
  tokens: []
1136
- }), o.raw += c;
1157
+ }), o.raw += d;
1137
1158
  }
1138
1159
  o.items[o.items.length - 1].raw = o.items[o.items.length - 1].raw.trimEnd(), o.items[o.items.length - 1].text = o.items[o.items.length - 1].text.trimEnd(), o.raw = o.raw.trimEnd();
1139
1160
  for (let u = 0; u < o.items.length; u++)
1140
1161
  if (this.lexer.state.top = !1, o.items[u].tokens = this.lexer.blockTokens(o.items[u].text, []), !o.loose) {
1141
- const c = o.items[u].tokens.filter((f) => f.type === "space"), d = c.length > 0 && c.some((f) => /\n.*\n/.test(f.raw));
1142
- o.loose = d;
1162
+ const d = o.items[u].tokens.filter((g) => g.type === "space"), c = d.length > 0 && d.some((g) => /\n.*\n/.test(g.raw));
1163
+ o.loose = c;
1143
1164
  }
1144
1165
  if (o.loose)
1145
1166
  for (let u = 0; u < o.items.length; u++)
@@ -1194,11 +1215,11 @@ ${f}` : f;
1194
1215
  align: i.align[a]
1195
1216
  });
1196
1217
  for (const a of o)
1197
- i.rows.push(Vn(a, i.header.length).map((u, c) => ({
1218
+ i.rows.push(Vn(a, i.header.length).map((u, d) => ({
1198
1219
  text: u,
1199
1220
  tokens: this.lexer.inline(u),
1200
1221
  header: !1,
1201
- align: i.align[c]
1222
+ align: i.align[d]
1202
1223
  })));
1203
1224
  return i;
1204
1225
  }
@@ -1243,7 +1264,7 @@ ${f}` : f;
1243
1264
  return {
1244
1265
  type: "escape",
1245
1266
  raw: t[0],
1246
- text: ye(t[1])
1267
+ text: xe(t[1])
1247
1268
  };
1248
1269
  }
1249
1270
  tag(e) {
@@ -1308,35 +1329,35 @@ ${f}` : f;
1308
1329
  return;
1309
1330
  if (!(r[1] || r[2] || "") || !s || this.rules.inline.punctuation.exec(s)) {
1310
1331
  const i = [...r[0]].length - 1;
1311
- let a, u, c = i, d = 0;
1312
- const f = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
1313
- for (f.lastIndex = 0, t = t.slice(-1 * e.length + i); (r = f.exec(t)) != null; ) {
1332
+ let a, u, d = i, c = 0;
1333
+ const g = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
1334
+ for (g.lastIndex = 0, t = t.slice(-1 * e.length + i); (r = g.exec(t)) != null; ) {
1314
1335
  if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a)
1315
1336
  continue;
1316
1337
  if (u = [...a].length, r[3] || r[4]) {
1317
- c += u;
1338
+ d += u;
1318
1339
  continue;
1319
1340
  } else if ((r[5] || r[6]) && i % 3 && !((i + u) % 3)) {
1320
- d += u;
1341
+ c += u;
1321
1342
  continue;
1322
1343
  }
1323
- if (c -= u, c > 0)
1344
+ if (d -= u, d > 0)
1324
1345
  continue;
1325
- u = Math.min(u, u + c + d);
1326
- const k = [...r[0]][0].length, g = e.slice(0, i + r.index + k + u);
1346
+ u = Math.min(u, u + d + c);
1347
+ const m = [...r[0]][0].length, f = e.slice(0, i + r.index + m + u);
1327
1348
  if (Math.min(i, u) % 2) {
1328
- const A = g.slice(1, -1);
1349
+ const A = f.slice(1, -1);
1329
1350
  return {
1330
1351
  type: "em",
1331
- raw: g,
1352
+ raw: f,
1332
1353
  text: A,
1333
1354
  tokens: this.lexer.inlineTokens(A)
1334
1355
  };
1335
1356
  }
1336
- const p = g.slice(2, -2);
1357
+ const p = f.slice(2, -2);
1337
1358
  return {
1338
1359
  type: "strong",
1339
- raw: g,
1360
+ raw: f,
1340
1361
  text: p,
1341
1362
  tokens: this.lexer.inlineTokens(p)
1342
1363
  };
@@ -1348,7 +1369,7 @@ ${f}` : f;
1348
1369
  if (t) {
1349
1370
  let s = t[2].replace(/\n/g, " ");
1350
1371
  const r = /[^ ]/.test(s), o = /^ /.test(s) && / $/.test(s);
1351
- return r && o && (s = s.substring(1, s.length - 1)), s = ye(s, !0), {
1372
+ return r && o && (s = s.substring(1, s.length - 1)), s = xe(s, !0), {
1352
1373
  type: "codespan",
1353
1374
  raw: t[0],
1354
1375
  text: s
@@ -1377,7 +1398,7 @@ ${f}` : f;
1377
1398
  const t = this.rules.inline.autolink.exec(e);
1378
1399
  if (t) {
1379
1400
  let s, r;
1380
- return t[2] === "@" ? (s = ye(t[1]), r = "mailto:" + s) : (s = ye(t[1]), r = s), {
1401
+ return t[2] === "@" ? (s = xe(t[1]), r = "mailto:" + s) : (s = xe(t[1]), r = s), {
1381
1402
  type: "link",
1382
1403
  raw: t[0],
1383
1404
  text: s,
@@ -1398,13 +1419,13 @@ ${f}` : f;
1398
1419
  if (t = this.rules.inline.url.exec(e)) {
1399
1420
  let r, o;
1400
1421
  if (t[2] === "@")
1401
- r = ye(t[0]), o = "mailto:" + r;
1422
+ r = xe(t[0]), o = "mailto:" + r;
1402
1423
  else {
1403
1424
  let i;
1404
1425
  do
1405
1426
  i = t[0], t[0] = ((s = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : s[0]) ?? "";
1406
1427
  while (i !== t[0]);
1407
- r = ye(t[0]), t[1] === "www." ? o = "http://" + t[0] : o = t[0];
1428
+ r = xe(t[0]), t[1] === "www." ? o = "http://" + t[0] : o = t[0];
1408
1429
  }
1409
1430
  return {
1410
1431
  type: "link",
@@ -1425,7 +1446,7 @@ ${f}` : f;
1425
1446
  const t = this.rules.inline.text.exec(e);
1426
1447
  if (t) {
1427
1448
  let s;
1428
- return this.lexer.state.inRawBlock ? s = t[0] : s = ye(t[0]), {
1449
+ return this.lexer.state.inRawBlock ? s = t[0] : s = xe(t[0]), {
1429
1450
  type: "text",
1430
1451
  raw: t[0],
1431
1452
  text: s
@@ -1433,7 +1454,7 @@ ${f}` : f;
1433
1454
  }
1434
1455
  }
1435
1456
  }
1436
- const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Er = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, Tt = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Mr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, ms = /(?:[*+-]|\d{1,9}[.)])/, ys = W(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, ms).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex(), pn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Rr = /^[^\n]+/, fn = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Lr = W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", fn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ir = W(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, ms).getRegex(), Bt = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", gn = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, $r = W("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", gn).replace("tag", Bt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), xs = W(pn).replace("hr", Tt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Bt).getRegex(), Dr = W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", xs).getRegex(), mn = {
1457
+ const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Er = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, Tt = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Mr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, ms = /(?:[*+-]|\d{1,9}[.)])/, ys = W(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, ms).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex(), fn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Rr = /^[^\n]+/, pn = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Lr = W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", pn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ir = W(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, ms).getRegex(), Bt = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", gn = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, $r = W("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", gn).replace("tag", Bt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), xs = W(fn).replace("hr", Tt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Bt).getRegex(), Dr = W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", xs).getRegex(), mn = {
1437
1458
  blockquote: Dr,
1438
1459
  code: Cr,
1439
1460
  def: Lr,
@@ -1450,7 +1471,7 @@ const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*
1450
1471
  }, Qn = W("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", Tt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Bt).getRegex(), Or = {
1451
1472
  ...mn,
1452
1473
  table: Qn,
1453
- paragraph: W(pn).replace("hr", Tt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Qn).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Bt).getRegex()
1474
+ paragraph: W(fn).replace("hr", Tt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Qn).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Bt).getRegex()
1454
1475
  }, Nr = {
1455
1476
  ...mn,
1456
1477
  html: W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", gn).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
@@ -1459,9 +1480,9 @@ const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*
1459
1480
  fences: xt,
1460
1481
  // fences not supported
1461
1482
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
1462
- paragraph: W(pn).replace("hr", Tt).replace("heading", ` *#{1,6} *[^
1483
+ paragraph: W(fn).replace("hr", Tt).replace("heading", ` *#{1,6} *[^
1463
1484
  ]`).replace("lheading", ys).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
1464
- }, ks = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Pr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ws = /^( {2,}|\\)\n(?!\s*$)/, _r = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, St = "\\p{P}\\p{S}", zr = W(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, St).getRegex(), Hr = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, Br = W(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, St).getRegex(), Fr = W("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, St).getRegex(), Ur = W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, St).getRegex(), qr = W(/\\([punct])/, "gu").replace(/punct/g, St).getRegex(), jr = W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Wr = W(gn).replace("(?:-->|$)", "-->").getRegex(), Kr = W("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Wr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), zt = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Vr = W(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", zt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), bs = W(/^!?\[(label)\]\[(ref)\]/).replace("label", zt).replace("ref", fn).getRegex(), vs = W(/^!?\[(ref)\](?:\[\])?/).replace("ref", fn).getRegex(), Gr = W("reflink|nolink(?!\\()", "g").replace("reflink", bs).replace("nolink", vs).getRegex(), yn = {
1485
+ }, ks = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Pr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ws = /^( {2,}|\\)\n(?!\s*$)/, _r = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, St = "\\p{P}\\p{S}", zr = W(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, St).getRegex(), Hr = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, Br = W(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, St).getRegex(), Fr = W("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, St).getRegex(), Ur = W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, St).getRegex(), qr = W(/\\([punct])/, "gu").replace(/punct/g, St).getRegex(), jr = W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Wr = W(gn).replace("(?:-->|$)", "-->").getRegex(), Kr = W("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Wr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), zt = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Vr = W(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", zt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), bs = W(/^!?\[(label)\]\[(ref)\]/).replace("label", zt).replace("ref", pn).getRegex(), vs = W(/^!?\[(ref)\](?:\[\])?/).replace("ref", pn).getRegex(), Gr = W("reflink|nolink(?!\\()", "g").replace("reflink", bs).replace("nolink", vs).getRegex(), yn = {
1465
1486
  _backpedal: xt,
1466
1487
  // only used for GFM url
1467
1488
  anyPunctuation: qr,
@@ -1507,14 +1528,14 @@ const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*
1507
1528
  breaks: Zr,
1508
1529
  pedantic: Qr
1509
1530
  };
1510
- class xe {
1531
+ class ke {
1511
1532
  constructor(e) {
1512
1533
  K(this, "tokens");
1513
1534
  K(this, "options");
1514
1535
  K(this, "state");
1515
1536
  K(this, "tokenizer");
1516
1537
  K(this, "inlineQueue");
1517
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || Ke, this.options.tokenizer = this.options.tokenizer || new _t(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
1538
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || Qe, this.options.tokenizer = this.options.tokenizer || new _t(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
1518
1539
  inLink: !1,
1519
1540
  inRawBlock: !1,
1520
1541
  top: !0
@@ -1538,13 +1559,13 @@ class xe {
1538
1559
  * Static Lex Method
1539
1560
  */
1540
1561
  static lex(e, t) {
1541
- return new xe(t).lex(e);
1562
+ return new ke(t).lex(e);
1542
1563
  }
1543
1564
  /**
1544
1565
  * Static Lex Inline Method
1545
1566
  */
1546
1567
  static lexInline(e, t) {
1547
- return new xe(t).inlineTokens(e);
1568
+ return new ke(t).inlineTokens(e);
1548
1569
  }
1549
1570
  /**
1550
1571
  * Preprocessing
@@ -1618,9 +1639,9 @@ class xe {
1618
1639
  if (i = e, this.options.extensions && this.options.extensions.startBlock) {
1619
1640
  let a = 1 / 0;
1620
1641
  const u = e.slice(1);
1621
- let c;
1622
- this.options.extensions.startBlock.forEach((d) => {
1623
- c = d.call({ lexer: this }, u), typeof c == "number" && c >= 0 && (a = Math.min(a, c));
1642
+ let d;
1643
+ this.options.extensions.startBlock.forEach((c) => {
1644
+ d = c.call({ lexer: this }, u), typeof d == "number" && d >= 0 && (a = Math.min(a, d));
1624
1645
  }), a < 1 / 0 && a >= 0 && (i = e.substring(0, a + 1));
1625
1646
  }
1626
1647
  if (this.state.top && (r = this.tokenizer.paragraph(i))) {
@@ -1653,19 +1674,19 @@ class xe {
1653
1674
  * Lexing/Compiling
1654
1675
  */
1655
1676
  inlineTokens(e, t = []) {
1656
- let s, r, o, i = e, a, u, c;
1677
+ let s, r, o, i = e, a, u, d;
1657
1678
  if (this.tokens.links) {
1658
- const d = Object.keys(this.tokens.links);
1659
- if (d.length > 0)
1679
+ const c = Object.keys(this.tokens.links);
1680
+ if (c.length > 0)
1660
1681
  for (; (a = this.tokenizer.rules.inline.reflinkSearch.exec(i)) != null; )
1661
- d.includes(a[0].slice(a[0].lastIndexOf("[") + 1, -1)) && (i = i.slice(0, a.index) + "[" + "a".repeat(a[0].length - 2) + "]" + i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
1682
+ c.includes(a[0].slice(a[0].lastIndexOf("[") + 1, -1)) && (i = i.slice(0, a.index) + "[" + "a".repeat(a[0].length - 2) + "]" + i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
1662
1683
  }
1663
1684
  for (; (a = this.tokenizer.rules.inline.blockSkip.exec(i)) != null; )
1664
1685
  i = i.slice(0, a.index) + "[" + "a".repeat(a[0].length - 2) + "]" + i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1665
1686
  for (; (a = this.tokenizer.rules.inline.anyPunctuation.exec(i)) != null; )
1666
1687
  i = i.slice(0, a.index) + "++" + i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1667
1688
  for (; e; )
1668
- if (u || (c = ""), u = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((d) => (s = d.call({ lexer: this }, e, t)) ? (e = e.substring(s.raw.length), t.push(s), !0) : !1))) {
1689
+ if (u || (d = ""), u = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((c) => (s = c.call({ lexer: this }, e, t)) ? (e = e.substring(s.raw.length), t.push(s), !0) : !1))) {
1669
1690
  if (s = this.tokenizer.escape(e)) {
1670
1691
  e = e.substring(s.raw.length), t.push(s);
1671
1692
  continue;
@@ -1682,7 +1703,7 @@ class xe {
1682
1703
  e = e.substring(s.raw.length), r = t[t.length - 1], r && s.type === "text" && r.type === "text" ? (r.raw += s.raw, r.text += s.text) : t.push(s);
1683
1704
  continue;
1684
1705
  }
1685
- if (s = this.tokenizer.emStrong(e, i, c)) {
1706
+ if (s = this.tokenizer.emStrong(e, i, d)) {
1686
1707
  e = e.substring(s.raw.length), t.push(s);
1687
1708
  continue;
1688
1709
  }
@@ -1707,24 +1728,24 @@ class xe {
1707
1728
  continue;
1708
1729
  }
1709
1730
  if (o = e, this.options.extensions && this.options.extensions.startInline) {
1710
- let d = 1 / 0;
1711
- const f = e.slice(1);
1712
- let k;
1713
- this.options.extensions.startInline.forEach((g) => {
1714
- k = g.call({ lexer: this }, f), typeof k == "number" && k >= 0 && (d = Math.min(d, k));
1715
- }), d < 1 / 0 && d >= 0 && (o = e.substring(0, d + 1));
1731
+ let c = 1 / 0;
1732
+ const g = e.slice(1);
1733
+ let m;
1734
+ this.options.extensions.startInline.forEach((f) => {
1735
+ m = f.call({ lexer: this }, g), typeof m == "number" && m >= 0 && (c = Math.min(c, m));
1736
+ }), c < 1 / 0 && c >= 0 && (o = e.substring(0, c + 1));
1716
1737
  }
1717
1738
  if (s = this.tokenizer.inlineText(o)) {
1718
- e = e.substring(s.raw.length), s.raw.slice(-1) !== "_" && (c = s.raw.slice(-1)), u = !0, r = t[t.length - 1], r && r.type === "text" ? (r.raw += s.raw, r.text += s.text) : t.push(s);
1739
+ e = e.substring(s.raw.length), s.raw.slice(-1) !== "_" && (d = s.raw.slice(-1)), u = !0, r = t[t.length - 1], r && r.type === "text" ? (r.raw += s.raw, r.text += s.text) : t.push(s);
1719
1740
  continue;
1720
1741
  }
1721
1742
  if (e) {
1722
- const d = "Infinite loop on byte: " + e.charCodeAt(0);
1743
+ const c = "Infinite loop on byte: " + e.charCodeAt(0);
1723
1744
  if (this.options.silent) {
1724
- console.error(d);
1745
+ console.error(c);
1725
1746
  break;
1726
1747
  } else
1727
- throw new Error(d);
1748
+ throw new Error(c);
1728
1749
  }
1729
1750
  }
1730
1751
  return t;
@@ -1735,7 +1756,7 @@ class Ht {
1735
1756
  constructor(e) {
1736
1757
  K(this, "options");
1737
1758
  K(this, "parser");
1738
- this.options = e || Ke;
1759
+ this.options = e || Qe;
1739
1760
  }
1740
1761
  space(e) {
1741
1762
  return "";
@@ -1744,8 +1765,8 @@ class Ht {
1744
1765
  var i;
1745
1766
  const r = (i = (t || "").match(/^\S*/)) == null ? void 0 : i[0], o = e.replace(/\n$/, "") + `
1746
1767
  `;
1747
- return r ? '<pre><code class="language-' + ye(r) + '">' + (s ? o : ye(o, !0)) + `</code></pre>
1748
- ` : "<pre><code>" + (s ? o : ye(o, !0)) + `</code></pre>
1768
+ return r ? '<pre><code class="language-' + xe(r) + '">' + (s ? o : xe(o, !0)) + `</code></pre>
1769
+ ` : "<pre><code>" + (s ? o : xe(o, !0)) + `</code></pre>
1749
1770
  `;
1750
1771
  }
1751
1772
  blockquote({ tokens: e }) {
@@ -1893,24 +1914,24 @@ class xn {
1893
1914
  return "";
1894
1915
  }
1895
1916
  }
1896
- class ke {
1917
+ class we {
1897
1918
  constructor(e) {
1898
1919
  K(this, "options");
1899
1920
  K(this, "renderer");
1900
1921
  K(this, "textRenderer");
1901
- this.options = e || Ke, this.options.renderer = this.options.renderer || new Ht(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new xn();
1922
+ this.options = e || Qe, this.options.renderer = this.options.renderer || new Ht(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new xn();
1902
1923
  }
1903
1924
  /**
1904
1925
  * Static Parse Method
1905
1926
  */
1906
1927
  static parse(e, t) {
1907
- return new ke(t).parse(e);
1928
+ return new we(t).parse(e);
1908
1929
  }
1909
1930
  /**
1910
1931
  * Static Parse Inline Method
1911
1932
  */
1912
1933
  static parseInline(e, t) {
1913
- return new ke(t).parseInline(e);
1934
+ return new we(t).parseInline(e);
1914
1935
  }
1915
1936
  /**
1916
1937
  * Parse Loop
@@ -2059,7 +2080,7 @@ class kt {
2059
2080
  constructor(e) {
2060
2081
  K(this, "options");
2061
2082
  K(this, "block");
2062
- this.options = e || Ke;
2083
+ this.options = e || Qe;
2063
2084
  }
2064
2085
  /**
2065
2086
  * Process markdown before marked
@@ -2083,13 +2104,13 @@ class kt {
2083
2104
  * Provide function to tokenize markdown
2084
2105
  */
2085
2106
  provideLexer() {
2086
- return this.block ? xe.lex : xe.lexInline;
2107
+ return this.block ? ke.lex : ke.lexInline;
2087
2108
  }
2088
2109
  /**
2089
2110
  * Provide function to parse tokens
2090
2111
  */
2091
2112
  provideParser() {
2092
- return this.block ? ke.parse : ke.parseInline;
2113
+ return this.block ? we.parse : we.parseInline;
2093
2114
  }
2094
2115
  }
2095
2116
  K(kt, "passThroughHooks", /* @__PURE__ */ new Set([
@@ -2103,10 +2124,10 @@ class Yr {
2103
2124
  K(this, "options", this.setOptions);
2104
2125
  K(this, "parse", this.parseMarkdown(!0));
2105
2126
  K(this, "parseInline", this.parseMarkdown(!1));
2106
- K(this, "Parser", ke);
2127
+ K(this, "Parser", we);
2107
2128
  K(this, "Renderer", Ht);
2108
2129
  K(this, "TextRenderer", xn);
2109
- K(this, "Lexer", xe);
2130
+ K(this, "Lexer", ke);
2110
2131
  K(this, "Tokenizer", _t);
2111
2132
  K(this, "Hooks", kt);
2112
2133
  this.use(...e);
@@ -2124,8 +2145,8 @@ class Yr {
2124
2145
  for (const u of a.header)
2125
2146
  s = s.concat(this.walkTokens(u.tokens, t));
2126
2147
  for (const u of a.rows)
2127
- for (const c of u)
2128
- s = s.concat(this.walkTokens(c.tokens, t));
2148
+ for (const d of u)
2149
+ s = s.concat(this.walkTokens(d.tokens, t));
2129
2150
  break;
2130
2151
  }
2131
2152
  case "list": {
@@ -2136,8 +2157,8 @@ class Yr {
2136
2157
  default: {
2137
2158
  const a = i;
2138
2159
  (o = (r = this.defaults.extensions) == null ? void 0 : r.childTokens) != null && o[a.type] ? this.defaults.extensions.childTokens[a.type].forEach((u) => {
2139
- const c = a[u].flat(1 / 0);
2140
- s = s.concat(this.walkTokens(c, t));
2160
+ const d = a[u].flat(1 / 0);
2161
+ s = s.concat(this.walkTokens(d, t));
2141
2162
  }) : a.tokens && (s = s.concat(this.walkTokens(a.tokens, t)));
2142
2163
  }
2143
2164
  }
@@ -2171,10 +2192,10 @@ class Yr {
2171
2192
  throw new Error(`renderer '${i}' does not exist`);
2172
2193
  if (["options", "parser"].includes(i))
2173
2194
  continue;
2174
- const a = i, u = s.renderer[a], c = o[a];
2175
- o[a] = (...d) => {
2176
- let f = u.apply(o, d);
2177
- return f === !1 && (f = c.apply(o, d)), f || "";
2195
+ const a = i, u = s.renderer[a], d = o[a];
2196
+ o[a] = (...c) => {
2197
+ let g = u.apply(o, c);
2198
+ return g === !1 && (g = d.apply(o, c)), g || "";
2178
2199
  };
2179
2200
  }
2180
2201
  r.renderer = o;
@@ -2186,10 +2207,10 @@ class Yr {
2186
2207
  throw new Error(`tokenizer '${i}' does not exist`);
2187
2208
  if (["options", "rules", "lexer"].includes(i))
2188
2209
  continue;
2189
- const a = i, u = s.tokenizer[a], c = o[a];
2190
- o[a] = (...d) => {
2191
- let f = u.apply(o, d);
2192
- return f === !1 && (f = c.apply(o, d)), f;
2210
+ const a = i, u = s.tokenizer[a], d = o[a];
2211
+ o[a] = (...c) => {
2212
+ let g = u.apply(o, c);
2213
+ return g === !1 && (g = d.apply(o, c)), g;
2193
2214
  };
2194
2215
  }
2195
2216
  r.tokenizer = o;
@@ -2201,15 +2222,15 @@ class Yr {
2201
2222
  throw new Error(`hook '${i}' does not exist`);
2202
2223
  if (["options", "block"].includes(i))
2203
2224
  continue;
2204
- const a = i, u = s.hooks[a], c = o[a];
2205
- kt.passThroughHooks.has(i) ? o[a] = (d) => {
2225
+ const a = i, u = s.hooks[a], d = o[a];
2226
+ kt.passThroughHooks.has(i) ? o[a] = (c) => {
2206
2227
  if (this.defaults.async)
2207
- return Promise.resolve(u.call(o, d)).then((k) => c.call(o, k));
2208
- const f = u.call(o, d);
2209
- return c.call(o, f);
2210
- } : o[a] = (...d) => {
2211
- let f = u.apply(o, d);
2212
- return f === !1 && (f = c.apply(o, d)), f;
2228
+ return Promise.resolve(u.call(o, c)).then((m) => d.call(o, m));
2229
+ const g = u.call(o, c);
2230
+ return d.call(o, g);
2231
+ } : o[a] = (...c) => {
2232
+ let g = u.apply(o, c);
2233
+ return g === !1 && (g = d.apply(o, c)), g;
2213
2234
  };
2214
2235
  }
2215
2236
  r.hooks = o;
@@ -2228,10 +2249,10 @@ class Yr {
2228
2249
  return this.defaults = { ...this.defaults, ...e }, this;
2229
2250
  }
2230
2251
  lexer(e, t) {
2231
- return xe.lex(e, t ?? this.defaults);
2252
+ return ke.lex(e, t ?? this.defaults);
2232
2253
  }
2233
2254
  parser(e, t) {
2234
- return ke.parse(e, t ?? this.defaults);
2255
+ return we.parse(e, t ?? this.defaults);
2235
2256
  }
2236
2257
  parseMarkdown(e) {
2237
2258
  return (s, r) => {
@@ -2243,17 +2264,17 @@ class Yr {
2243
2264
  if (typeof s != "string")
2244
2265
  return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(s) + ", string expected"));
2245
2266
  i.hooks && (i.hooks.options = i, i.hooks.block = e);
2246
- const u = i.hooks ? i.hooks.provideLexer() : e ? xe.lex : xe.lexInline, c = i.hooks ? i.hooks.provideParser() : e ? ke.parse : ke.parseInline;
2267
+ const u = i.hooks ? i.hooks.provideLexer() : e ? ke.lex : ke.lexInline, d = i.hooks ? i.hooks.provideParser() : e ? we.parse : we.parseInline;
2247
2268
  if (i.async)
2248
- return Promise.resolve(i.hooks ? i.hooks.preprocess(s) : s).then((d) => u(d, i)).then((d) => i.hooks ? i.hooks.processAllTokens(d) : d).then((d) => i.walkTokens ? Promise.all(this.walkTokens(d, i.walkTokens)).then(() => d) : d).then((d) => c(d, i)).then((d) => i.hooks ? i.hooks.postprocess(d) : d).catch(a);
2269
+ return Promise.resolve(i.hooks ? i.hooks.preprocess(s) : s).then((c) => u(c, i)).then((c) => i.hooks ? i.hooks.processAllTokens(c) : c).then((c) => i.walkTokens ? Promise.all(this.walkTokens(c, i.walkTokens)).then(() => c) : c).then((c) => d(c, i)).then((c) => i.hooks ? i.hooks.postprocess(c) : c).catch(a);
2249
2270
  try {
2250
2271
  i.hooks && (s = i.hooks.preprocess(s));
2251
- let d = u(s, i);
2252
- i.hooks && (d = i.hooks.processAllTokens(d)), i.walkTokens && this.walkTokens(d, i.walkTokens);
2253
- let f = c(d, i);
2254
- return i.hooks && (f = i.hooks.postprocess(f)), f;
2255
- } catch (d) {
2256
- return a(d);
2272
+ let c = u(s, i);
2273
+ i.hooks && (c = i.hooks.processAllTokens(c)), i.walkTokens && this.walkTokens(c, i.walkTokens);
2274
+ let g = d(c, i);
2275
+ return i.hooks && (g = i.hooks.postprocess(g)), g;
2276
+ } catch (c) {
2277
+ return a(c);
2257
2278
  }
2258
2279
  };
2259
2280
  }
@@ -2261,7 +2282,7 @@ class Yr {
2261
2282
  return (s) => {
2262
2283
  if (s.message += `
2263
2284
  Please report this to https://github.com/markedjs/marked.`, e) {
2264
- const r = "<p>An error occurred:</p><pre>" + ye(s.message + "", !0) + "</pre>";
2285
+ const r = "<p>An error occurred:</p><pre>" + xe(s.message + "", !0) + "</pre>";
2265
2286
  return t ? Promise.resolve(r) : r;
2266
2287
  }
2267
2288
  if (t)
@@ -2270,28 +2291,28 @@ Please report this to https://github.com/markedjs/marked.`, e) {
2270
2291
  };
2271
2292
  }
2272
2293
  }
2273
- const je = new Yr();
2294
+ const Ve = new Yr();
2274
2295
  function j(n, e) {
2275
- return je.parse(n, e);
2296
+ return Ve.parse(n, e);
2276
2297
  }
2277
2298
  j.options = j.setOptions = function(n) {
2278
- return je.setOptions(n), j.defaults = je.defaults, ps(j.defaults), j;
2299
+ return Ve.setOptions(n), j.defaults = Ve.defaults, fs(j.defaults), j;
2279
2300
  };
2280
2301
  j.getDefaults = hn;
2281
- j.defaults = Ke;
2302
+ j.defaults = Qe;
2282
2303
  j.use = function(...n) {
2283
- return je.use(...n), j.defaults = je.defaults, ps(j.defaults), j;
2304
+ return Ve.use(...n), j.defaults = Ve.defaults, fs(j.defaults), j;
2284
2305
  };
2285
2306
  j.walkTokens = function(n, e) {
2286
- return je.walkTokens(n, e);
2307
+ return Ve.walkTokens(n, e);
2287
2308
  };
2288
- j.parseInline = je.parseInline;
2289
- j.Parser = ke;
2290
- j.parser = ke.parse;
2309
+ j.parseInline = Ve.parseInline;
2310
+ j.Parser = we;
2311
+ j.parser = we.parse;
2291
2312
  j.Renderer = Ht;
2292
2313
  j.TextRenderer = xn;
2293
- j.Lexer = xe;
2294
- j.lexer = xe.lex;
2314
+ j.Lexer = ke;
2315
+ j.lexer = ke.lex;
2295
2316
  j.Tokenizer = _t;
2296
2317
  j.Hooks = kt;
2297
2318
  j.parse = j;
@@ -2300,8 +2321,8 @@ j.setOptions;
2300
2321
  j.use;
2301
2322
  j.walkTokens;
2302
2323
  j.parseInline;
2303
- ke.parse;
2304
- xe.lex;
2324
+ we.parse;
2325
+ ke.lex;
2305
2326
  /*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
2306
2327
  const {
2307
2328
  entries: Ts,
@@ -2312,7 +2333,7 @@ const {
2312
2333
  } = Object;
2313
2334
  let {
2314
2335
  freeze: pe,
2315
- seal: be,
2336
+ seal: ve,
2316
2337
  create: an
2317
2338
  } = Object, {
2318
2339
  apply: ln,
@@ -2321,7 +2342,7 @@ let {
2321
2342
  pe || (pe = function(e) {
2322
2343
  return e;
2323
2344
  });
2324
- be || (be = function(e) {
2345
+ ve || (ve = function(e) {
2325
2346
  return e;
2326
2347
  });
2327
2348
  ln || (ln = function(e, t) {
@@ -2334,8 +2355,8 @@ un || (un = function(e) {
2334
2355
  s[r - 1] = arguments[r];
2335
2356
  return new e(...s);
2336
2357
  });
2337
- const Ot = fe(Array.prototype.forEach), to = fe(Array.prototype.lastIndexOf), Yn = fe(Array.prototype.pop), pt = fe(Array.prototype.push), no = fe(Array.prototype.splice), Pt = fe(String.prototype.toLowerCase), Zt = fe(String.prototype.toString), Yt = fe(String.prototype.match), ft = fe(String.prototype.replace), so = fe(String.prototype.indexOf), ro = fe(String.prototype.trim), ve = fe(Object.prototype.hasOwnProperty), he = fe(RegExp.prototype.test), gt = oo(TypeError);
2338
- function fe(n) {
2358
+ const Ot = ge(Array.prototype.forEach), to = ge(Array.prototype.lastIndexOf), Yn = ge(Array.prototype.pop), ft = ge(Array.prototype.push), no = ge(Array.prototype.splice), Pt = ge(String.prototype.toLowerCase), Zt = ge(String.prototype.toString), Yt = ge(String.prototype.match), pt = ge(String.prototype.replace), so = ge(String.prototype.indexOf), ro = ge(String.prototype.trim), Te = ge(Object.prototype.hasOwnProperty), fe = ge(RegExp.prototype.test), gt = oo(TypeError);
2359
+ function ge(n) {
2339
2360
  return function(e) {
2340
2361
  e instanceof RegExp && (e.lastIndex = 0);
2341
2362
  for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++)
@@ -2366,13 +2387,13 @@ function H(n, e) {
2366
2387
  }
2367
2388
  function io(n) {
2368
2389
  for (let e = 0; e < n.length; e++)
2369
- ve(n, e) || (n[e] = null);
2390
+ Te(n, e) || (n[e] = null);
2370
2391
  return n;
2371
2392
  }
2372
- function De(n) {
2393
+ function Ne(n) {
2373
2394
  const e = an(null);
2374
2395
  for (const [t, s] of Ts(n))
2375
- ve(n, t) && (Array.isArray(s) ? e[t] = io(s) : s && typeof s == "object" && s.constructor === Object ? e[t] = De(s) : e[t] = s);
2396
+ Te(n, t) && (Array.isArray(s) ? e[t] = io(s) : s && typeof s == "object" && s.constructor === Object ? e[t] = Ne(s) : e[t] = s);
2376
2397
  return e;
2377
2398
  }
2378
2399
  function mt(n, e) {
@@ -2380,9 +2401,9 @@ function mt(n, e) {
2380
2401
  const s = eo(n, e);
2381
2402
  if (s) {
2382
2403
  if (s.get)
2383
- return fe(s.get);
2404
+ return ge(s.get);
2384
2405
  if (typeof s.value == "function")
2385
- return fe(s.value);
2406
+ return ge(s.value);
2386
2407
  }
2387
2408
  n = Jr(n);
2388
2409
  }
@@ -2391,19 +2412,19 @@ function mt(n, e) {
2391
2412
  }
2392
2413
  return t;
2393
2414
  }
2394
- const Xn = pe(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Xt = pe(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Jt = pe(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), ao = pe(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), en = pe(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), lo = pe(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Jn = pe(["#text"]), es = pe(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), tn = pe(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), ts = pe(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Nt = pe(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), uo = be(/\{\{[\w\W]*|[\w\W]*\}\}/gm), co = be(/<%[\w\W]*|[\w\W]*%>/gm), ho = be(/\$\{[\w\W]*/gm), po = be(/^data-[\-\w.\u00B7-\uFFFF]+$/), fo = be(/^aria-[\-\w]+$/), Ss = be(
2415
+ const Xn = pe(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Xt = pe(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Jt = pe(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), ao = pe(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), en = pe(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), lo = pe(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Jn = pe(["#text"]), es = pe(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), tn = pe(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), ts = pe(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Nt = pe(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), uo = ve(/\{\{[\w\W]*|[\w\W]*\}\}/gm), co = ve(/<%[\w\W]*|[\w\W]*%>/gm), ho = ve(/\$\{[\w\W]*/gm), fo = ve(/^data-[\-\w.\u00B7-\uFFFF]+$/), po = ve(/^aria-[\-\w]+$/), Ss = ve(
2395
2416
  /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
2396
2417
  // eslint-disable-line no-useless-escape
2397
- ), go = be(/^(?:\w+script|data):/i), mo = be(
2418
+ ), go = ve(/^(?:\w+script|data):/i), mo = ve(
2398
2419
  /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
2399
2420
  // eslint-disable-line no-control-regex
2400
- ), As = be(/^html$/i), yo = be(/^[a-z][.\w]*(-[.\w]+)+$/i);
2421
+ ), As = ve(/^html$/i), yo = ve(/^[a-z][.\w]*(-[.\w]+)+$/i);
2401
2422
  var ns = /* @__PURE__ */ Object.freeze({
2402
2423
  __proto__: null,
2403
- ARIA_ATTR: fo,
2424
+ ARIA_ATTR: po,
2404
2425
  ATTR_WHITESPACE: mo,
2405
2426
  CUSTOM_ELEMENT: yo,
2406
- DATA_ATTR: po,
2427
+ DATA_ATTR: fo,
2407
2428
  DOCTYPE_NAME: As,
2408
2429
  ERB_EXPR: co,
2409
2430
  IS_ALLOWED_URI: Ss,
@@ -2465,44 +2486,44 @@ function Cs() {
2465
2486
  HTMLTemplateElement: i,
2466
2487
  Node: a,
2467
2488
  Element: u,
2468
- NodeFilter: c,
2469
- NamedNodeMap: d = n.NamedNodeMap || n.MozNamedAttrMap,
2470
- HTMLFormElement: f,
2471
- DOMParser: k,
2472
- trustedTypes: g
2473
- } = n, p = u.prototype, A = mt(p, "cloneNode"), x = mt(p, "remove"), m = mt(p, "nextSibling"), S = mt(p, "childNodes"), C = mt(p, "parentNode");
2489
+ NodeFilter: d,
2490
+ NamedNodeMap: c = n.NamedNodeMap || n.MozNamedAttrMap,
2491
+ HTMLFormElement: g,
2492
+ DOMParser: m,
2493
+ trustedTypes: f
2494
+ } = n, p = u.prototype, A = mt(p, "cloneNode"), k = mt(p, "remove"), y = mt(p, "nextSibling"), S = mt(p, "childNodes"), E = mt(p, "parentNode");
2474
2495
  if (typeof i == "function") {
2475
2496
  const $ = t.createElement("template");
2476
2497
  $.content && $.content.ownerDocument && (t = $.content.ownerDocument);
2477
2498
  }
2478
- let T, _ = "";
2499
+ let T, z = "";
2479
2500
  const {
2480
- implementation: F,
2481
- createNodeIterator: V,
2482
- createDocumentFragment: E,
2483
- getElementsByTagName: M
2501
+ implementation: U,
2502
+ createNodeIterator: J,
2503
+ createDocumentFragment: C,
2504
+ getElementsByTagName: _
2484
2505
  } = t, {
2485
- importNode: I
2506
+ importNode: R
2486
2507
  } = s;
2487
- let z = ss();
2488
- e.isSupported = typeof Ts == "function" && typeof C == "function" && F && F.createHTMLDocument !== void 0;
2508
+ let M = ss();
2509
+ e.isSupported = typeof Ts == "function" && typeof E == "function" && U && U.createHTMLDocument !== void 0;
2489
2510
  const {
2490
- MUSTACHE_EXPR: L,
2491
- ERB_EXPR: ee,
2492
- TMPLIT_EXPR: Te,
2493
- DATA_ATTR: Ve,
2494
- ARIA_ATTR: Be,
2495
- IS_SCRIPT_OR_DATA: Me,
2496
- ATTR_WHITESPACE: nt,
2511
+ MUSTACHE_EXPR: Z,
2512
+ ERB_EXPR: I,
2513
+ TMPLIT_EXPR: V,
2514
+ DATA_ATTR: qe,
2515
+ ARIA_ATTR: Me,
2516
+ IS_SCRIPT_OR_DATA: Re,
2517
+ ATTR_WHITESPACE: ze,
2497
2518
  CUSTOM_ELEMENT: Ft
2498
2519
  } = ns;
2499
2520
  let {
2500
2521
  IS_ALLOWED_URI: At
2501
- } = ns, te = null;
2502
- const Pe = H({}, [...Xn, ...Xt, ...Jt, ...en, ...Jn]);
2503
- let ne = null;
2522
+ } = ns, ne = null;
2523
+ const Le = H({}, [...Xn, ...Xt, ...Jt, ...en, ...Jn]);
2524
+ let se = null;
2504
2525
  const st = H({}, [...es, ...tn, ...ts, ...Nt]);
2505
- let Z = Object.seal(an(null, {
2526
+ let Y = Object.seal(an(null, {
2506
2527
  tagNameCheck: {
2507
2528
  writable: !0,
2508
2529
  configurable: !1,
@@ -2521,8 +2542,8 @@ function Cs() {
2521
2542
  enumerable: !0,
2522
2543
  value: !1
2523
2544
  }
2524
- })), Fe = null, rt = null;
2525
- const Re = Object.seal(an(null, {
2545
+ })), je = null, rt = null;
2546
+ const Ie = Object.seal(an(null, {
2526
2547
  tagCheck: {
2527
2548
  writable: !0,
2528
2549
  configurable: !1,
@@ -2536,68 +2557,68 @@ function Cs() {
2536
2557
  value: null
2537
2558
  }
2538
2559
  }));
2539
- let ot = !0, it = !0, at = !1, O = !0, U = !1, Y = !0, G = !1, re = !1, X = !1, oe = !1, _e = !1, Ct = !1, kn = !0, wn = !1;
2560
+ let ot = !0, it = !0, at = !1, O = !0, B = !1, X = !0, G = !1, oe = !1, ee = !1, ie = !1, He = !1, Ct = !1, kn = !0, wn = !1;
2540
2561
  const Is = "user-content-";
2541
- let Ut = !0, lt = !1, Ge = {}, Qe = null;
2562
+ let Ut = !0, lt = !1, Ze = {}, Ye = null;
2542
2563
  const bn = H({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
2543
2564
  let vn = null;
2544
2565
  const Tn = H({}, ["audio", "video", "img", "source", "image", "track"]);
2545
2566
  let qt = null;
2546
- const Sn = H({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Et = "http://www.w3.org/1998/Math/MathML", Mt = "http://www.w3.org/2000/svg", Le = "http://www.w3.org/1999/xhtml";
2547
- let Ze = Le, jt = !1, Wt = null;
2548
- const $s = H({}, [Et, Mt, Le], Zt);
2567
+ const Sn = H({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Et = "http://www.w3.org/1998/Math/MathML", Mt = "http://www.w3.org/2000/svg", $e = "http://www.w3.org/1999/xhtml";
2568
+ let Xe = $e, jt = !1, Wt = null;
2569
+ const $s = H({}, [Et, Mt, $e], Zt);
2549
2570
  let Rt = H({}, ["mi", "mo", "mn", "ms", "mtext"]), Lt = H({}, ["annotation-xml"]);
2550
2571
  const Ds = H({}, ["title", "style", "font", "a", "script"]);
2551
2572
  let ut = null;
2552
2573
  const Os = ["application/xhtml+xml", "text/html"], Ns = "text/html";
2553
- let ie = null, Ye = null;
2574
+ let ae = null, Je = null;
2554
2575
  const Ps = t.createElement("form"), An = function(l) {
2555
2576
  return l instanceof RegExp || l instanceof Function;
2556
2577
  }, Kt = function() {
2557
2578
  let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2558
- if (!(Ye && Ye === l)) {
2559
- if ((!l || typeof l != "object") && (l = {}), l = De(l), ut = // eslint-disable-next-line unicorn/prefer-includes
2560
- Os.indexOf(l.PARSER_MEDIA_TYPE) === -1 ? Ns : l.PARSER_MEDIA_TYPE, ie = ut === "application/xhtml+xml" ? Zt : Pt, te = ve(l, "ALLOWED_TAGS") ? H({}, l.ALLOWED_TAGS, ie) : Pe, ne = ve(l, "ALLOWED_ATTR") ? H({}, l.ALLOWED_ATTR, ie) : st, Wt = ve(l, "ALLOWED_NAMESPACES") ? H({}, l.ALLOWED_NAMESPACES, Zt) : $s, qt = ve(l, "ADD_URI_SAFE_ATTR") ? H(De(Sn), l.ADD_URI_SAFE_ATTR, ie) : Sn, vn = ve(l, "ADD_DATA_URI_TAGS") ? H(De(Tn), l.ADD_DATA_URI_TAGS, ie) : Tn, Qe = ve(l, "FORBID_CONTENTS") ? H({}, l.FORBID_CONTENTS, ie) : bn, Fe = ve(l, "FORBID_TAGS") ? H({}, l.FORBID_TAGS, ie) : De({}), rt = ve(l, "FORBID_ATTR") ? H({}, l.FORBID_ATTR, ie) : De({}), Ge = ve(l, "USE_PROFILES") ? l.USE_PROFILES : !1, ot = l.ALLOW_ARIA_ATTR !== !1, it = l.ALLOW_DATA_ATTR !== !1, at = l.ALLOW_UNKNOWN_PROTOCOLS || !1, O = l.ALLOW_SELF_CLOSE_IN_ATTR !== !1, U = l.SAFE_FOR_TEMPLATES || !1, Y = l.SAFE_FOR_XML !== !1, G = l.WHOLE_DOCUMENT || !1, oe = l.RETURN_DOM || !1, _e = l.RETURN_DOM_FRAGMENT || !1, Ct = l.RETURN_TRUSTED_TYPE || !1, X = l.FORCE_BODY || !1, kn = l.SANITIZE_DOM !== !1, wn = l.SANITIZE_NAMED_PROPS || !1, Ut = l.KEEP_CONTENT !== !1, lt = l.IN_PLACE || !1, At = l.ALLOWED_URI_REGEXP || Ss, Ze = l.NAMESPACE || Le, Rt = l.MATHML_TEXT_INTEGRATION_POINTS || Rt, Lt = l.HTML_INTEGRATION_POINTS || Lt, Z = l.CUSTOM_ELEMENT_HANDLING || {}, l.CUSTOM_ELEMENT_HANDLING && An(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (Z.tagNameCheck = l.CUSTOM_ELEMENT_HANDLING.tagNameCheck), l.CUSTOM_ELEMENT_HANDLING && An(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (Z.attributeNameCheck = l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), l.CUSTOM_ELEMENT_HANDLING && typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (Z.allowCustomizedBuiltInElements = l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), U && (it = !1), _e && (oe = !0), Ge && (te = H({}, Jn), ne = [], Ge.html === !0 && (H(te, Xn), H(ne, es)), Ge.svg === !0 && (H(te, Xt), H(ne, tn), H(ne, Nt)), Ge.svgFilters === !0 && (H(te, Jt), H(ne, tn), H(ne, Nt)), Ge.mathMl === !0 && (H(te, en), H(ne, ts), H(ne, Nt))), l.ADD_TAGS && (typeof l.ADD_TAGS == "function" ? Re.tagCheck = l.ADD_TAGS : (te === Pe && (te = De(te)), H(te, l.ADD_TAGS, ie))), l.ADD_ATTR && (typeof l.ADD_ATTR == "function" ? Re.attributeCheck = l.ADD_ATTR : (ne === st && (ne = De(ne)), H(ne, l.ADD_ATTR, ie))), l.ADD_URI_SAFE_ATTR && H(qt, l.ADD_URI_SAFE_ATTR, ie), l.FORBID_CONTENTS && (Qe === bn && (Qe = De(Qe)), H(Qe, l.FORBID_CONTENTS, ie)), Ut && (te["#text"] = !0), G && H(te, ["html", "head", "body"]), te.table && (H(te, ["tbody"]), delete Fe.tbody), l.TRUSTED_TYPES_POLICY) {
2579
+ if (!(Je && Je === l)) {
2580
+ if ((!l || typeof l != "object") && (l = {}), l = Ne(l), ut = // eslint-disable-next-line unicorn/prefer-includes
2581
+ Os.indexOf(l.PARSER_MEDIA_TYPE) === -1 ? Ns : l.PARSER_MEDIA_TYPE, ae = ut === "application/xhtml+xml" ? Zt : Pt, ne = Te(l, "ALLOWED_TAGS") ? H({}, l.ALLOWED_TAGS, ae) : Le, se = Te(l, "ALLOWED_ATTR") ? H({}, l.ALLOWED_ATTR, ae) : st, Wt = Te(l, "ALLOWED_NAMESPACES") ? H({}, l.ALLOWED_NAMESPACES, Zt) : $s, qt = Te(l, "ADD_URI_SAFE_ATTR") ? H(Ne(Sn), l.ADD_URI_SAFE_ATTR, ae) : Sn, vn = Te(l, "ADD_DATA_URI_TAGS") ? H(Ne(Tn), l.ADD_DATA_URI_TAGS, ae) : Tn, Ye = Te(l, "FORBID_CONTENTS") ? H({}, l.FORBID_CONTENTS, ae) : bn, je = Te(l, "FORBID_TAGS") ? H({}, l.FORBID_TAGS, ae) : Ne({}), rt = Te(l, "FORBID_ATTR") ? H({}, l.FORBID_ATTR, ae) : Ne({}), Ze = Te(l, "USE_PROFILES") ? l.USE_PROFILES : !1, ot = l.ALLOW_ARIA_ATTR !== !1, it = l.ALLOW_DATA_ATTR !== !1, at = l.ALLOW_UNKNOWN_PROTOCOLS || !1, O = l.ALLOW_SELF_CLOSE_IN_ATTR !== !1, B = l.SAFE_FOR_TEMPLATES || !1, X = l.SAFE_FOR_XML !== !1, G = l.WHOLE_DOCUMENT || !1, ie = l.RETURN_DOM || !1, He = l.RETURN_DOM_FRAGMENT || !1, Ct = l.RETURN_TRUSTED_TYPE || !1, ee = l.FORCE_BODY || !1, kn = l.SANITIZE_DOM !== !1, wn = l.SANITIZE_NAMED_PROPS || !1, Ut = l.KEEP_CONTENT !== !1, lt = l.IN_PLACE || !1, At = l.ALLOWED_URI_REGEXP || Ss, Xe = l.NAMESPACE || $e, Rt = l.MATHML_TEXT_INTEGRATION_POINTS || Rt, Lt = l.HTML_INTEGRATION_POINTS || Lt, Y = l.CUSTOM_ELEMENT_HANDLING || {}, l.CUSTOM_ELEMENT_HANDLING && An(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (Y.tagNameCheck = l.CUSTOM_ELEMENT_HANDLING.tagNameCheck), l.CUSTOM_ELEMENT_HANDLING && An(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (Y.attributeNameCheck = l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), l.CUSTOM_ELEMENT_HANDLING && typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (Y.allowCustomizedBuiltInElements = l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), B && (it = !1), He && (ie = !0), Ze && (ne = H({}, Jn), se = [], Ze.html === !0 && (H(ne, Xn), H(se, es)), Ze.svg === !0 && (H(ne, Xt), H(se, tn), H(se, Nt)), Ze.svgFilters === !0 && (H(ne, Jt), H(se, tn), H(se, Nt)), Ze.mathMl === !0 && (H(ne, en), H(se, ts), H(se, Nt))), l.ADD_TAGS && (typeof l.ADD_TAGS == "function" ? Ie.tagCheck = l.ADD_TAGS : (ne === Le && (ne = Ne(ne)), H(ne, l.ADD_TAGS, ae))), l.ADD_ATTR && (typeof l.ADD_ATTR == "function" ? Ie.attributeCheck = l.ADD_ATTR : (se === st && (se = Ne(se)), H(se, l.ADD_ATTR, ae))), l.ADD_URI_SAFE_ATTR && H(qt, l.ADD_URI_SAFE_ATTR, ae), l.FORBID_CONTENTS && (Ye === bn && (Ye = Ne(Ye)), H(Ye, l.FORBID_CONTENTS, ae)), Ut && (ne["#text"] = !0), G && H(ne, ["html", "head", "body"]), ne.table && (H(ne, ["tbody"]), delete je.tbody), l.TRUSTED_TYPES_POLICY) {
2561
2582
  if (typeof l.TRUSTED_TYPES_POLICY.createHTML != "function")
2562
2583
  throw gt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
2563
2584
  if (typeof l.TRUSTED_TYPES_POLICY.createScriptURL != "function")
2564
2585
  throw gt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
2565
- T = l.TRUSTED_TYPES_POLICY, _ = T.createHTML("");
2586
+ T = l.TRUSTED_TYPES_POLICY, z = T.createHTML("");
2566
2587
  } else
2567
- T === void 0 && (T = ko(g, r)), T !== null && typeof _ == "string" && (_ = T.createHTML(""));
2568
- pe && pe(l), Ye = l;
2588
+ T === void 0 && (T = ko(f, r)), T !== null && typeof z == "string" && (z = T.createHTML(""));
2589
+ pe && pe(l), Je = l;
2569
2590
  }
2570
2591
  }, Cn = H({}, [...Xt, ...Jt, ...ao]), En = H({}, [...en, ...lo]), _s = function(l) {
2571
- let w = C(l);
2592
+ let w = E(l);
2572
2593
  (!w || !w.tagName) && (w = {
2573
- namespaceURI: Ze,
2594
+ namespaceURI: Xe,
2574
2595
  tagName: "template"
2575
2596
  });
2576
- const R = Pt(l.tagName), Q = Pt(w.tagName);
2577
- return Wt[l.namespaceURI] ? l.namespaceURI === Mt ? w.namespaceURI === Le ? R === "svg" : w.namespaceURI === Et ? R === "svg" && (Q === "annotation-xml" || Rt[Q]) : !!Cn[R] : l.namespaceURI === Et ? w.namespaceURI === Le ? R === "math" : w.namespaceURI === Mt ? R === "math" && Lt[Q] : !!En[R] : l.namespaceURI === Le ? w.namespaceURI === Mt && !Lt[Q] || w.namespaceURI === Et && !Rt[Q] ? !1 : !En[R] && (Ds[R] || !Cn[R]) : !!(ut === "application/xhtml+xml" && Wt[l.namespaceURI]) : !1;
2597
+ const L = Pt(l.tagName), Q = Pt(w.tagName);
2598
+ return Wt[l.namespaceURI] ? l.namespaceURI === Mt ? w.namespaceURI === $e ? L === "svg" : w.namespaceURI === Et ? L === "svg" && (Q === "annotation-xml" || Rt[Q]) : !!Cn[L] : l.namespaceURI === Et ? w.namespaceURI === $e ? L === "math" : w.namespaceURI === Mt ? L === "math" && Lt[Q] : !!En[L] : l.namespaceURI === $e ? w.namespaceURI === Mt && !Lt[Q] || w.namespaceURI === Et && !Rt[Q] ? !1 : !En[L] && (Ds[L] || !Cn[L]) : !!(ut === "application/xhtml+xml" && Wt[l.namespaceURI]) : !1;
2578
2599
  }, Se = function(l) {
2579
- pt(e.removed, {
2600
+ ft(e.removed, {
2580
2601
  element: l
2581
2602
  });
2582
2603
  try {
2583
- C(l).removeChild(l);
2604
+ E(l).removeChild(l);
2584
2605
  } catch {
2585
- x(l);
2606
+ k(l);
2586
2607
  }
2587
- }, Ue = function(l, w) {
2608
+ }, We = function(l, w) {
2588
2609
  try {
2589
- pt(e.removed, {
2610
+ ft(e.removed, {
2590
2611
  attribute: w.getAttributeNode(l),
2591
2612
  from: w
2592
2613
  });
2593
2614
  } catch {
2594
- pt(e.removed, {
2615
+ ft(e.removed, {
2595
2616
  attribute: null,
2596
2617
  from: w
2597
2618
  });
2598
2619
  }
2599
2620
  if (w.removeAttribute(l), l === "is")
2600
- if (oe || _e)
2621
+ if (ie || He)
2601
2622
  try {
2602
2623
  Se(w);
2603
2624
  } catch {
@@ -2608,97 +2629,97 @@ function Cs() {
2608
2629
  } catch {
2609
2630
  }
2610
2631
  }, Mn = function(l) {
2611
- let w = null, R = null;
2612
- if (X)
2632
+ let w = null, L = null;
2633
+ if (ee)
2613
2634
  l = "<remove></remove>" + l;
2614
2635
  else {
2615
- const se = Yt(l, /^[\r\n\t ]+/);
2616
- R = se && se[0];
2636
+ const re = Yt(l, /^[\r\n\t ]+/);
2637
+ L = re && re[0];
2617
2638
  }
2618
- ut === "application/xhtml+xml" && Ze === Le && (l = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + l + "</body></html>");
2639
+ ut === "application/xhtml+xml" && Xe === $e && (l = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + l + "</body></html>");
2619
2640
  const Q = T ? T.createHTML(l) : l;
2620
- if (Ze === Le)
2641
+ if (Xe === $e)
2621
2642
  try {
2622
- w = new k().parseFromString(Q, ut);
2643
+ w = new m().parseFromString(Q, ut);
2623
2644
  } catch {
2624
2645
  }
2625
2646
  if (!w || !w.documentElement) {
2626
- w = F.createDocument(Ze, "template", null);
2647
+ w = U.createDocument(Xe, "template", null);
2627
2648
  try {
2628
- w.documentElement.innerHTML = jt ? _ : Q;
2649
+ w.documentElement.innerHTML = jt ? z : Q;
2629
2650
  } catch {
2630
2651
  }
2631
2652
  }
2632
- const le = w.body || w.documentElement;
2633
- return l && R && le.insertBefore(t.createTextNode(R), le.childNodes[0] || null), Ze === Le ? M.call(w, G ? "html" : "body")[0] : G ? w.documentElement : le;
2653
+ const ue = w.body || w.documentElement;
2654
+ return l && L && ue.insertBefore(t.createTextNode(L), ue.childNodes[0] || null), Xe === $e ? _.call(w, G ? "html" : "body")[0] : G ? w.documentElement : ue;
2634
2655
  }, Rn = function(l) {
2635
- return V.call(
2656
+ return J.call(
2636
2657
  l.ownerDocument || l,
2637
2658
  l,
2638
2659
  // eslint-disable-next-line no-bitwise
2639
- c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION,
2660
+ d.SHOW_ELEMENT | d.SHOW_COMMENT | d.SHOW_TEXT | d.SHOW_PROCESSING_INSTRUCTION | d.SHOW_CDATA_SECTION,
2640
2661
  null
2641
2662
  );
2642
2663
  }, Vt = function(l) {
2643
- return l instanceof f && (typeof l.nodeName != "string" || typeof l.textContent != "string" || typeof l.removeChild != "function" || !(l.attributes instanceof d) || typeof l.removeAttribute != "function" || typeof l.setAttribute != "function" || typeof l.namespaceURI != "string" || typeof l.insertBefore != "function" || typeof l.hasChildNodes != "function");
2664
+ return l instanceof g && (typeof l.nodeName != "string" || typeof l.textContent != "string" || typeof l.removeChild != "function" || !(l.attributes instanceof c) || typeof l.removeAttribute != "function" || typeof l.setAttribute != "function" || typeof l.namespaceURI != "string" || typeof l.insertBefore != "function" || typeof l.hasChildNodes != "function");
2644
2665
  }, Ln = function(l) {
2645
2666
  return typeof a == "function" && l instanceof a;
2646
2667
  };
2647
- function Ie($, l, w) {
2648
- Ot($, (R) => {
2649
- R.call(e, l, w, Ye);
2668
+ function De($, l, w) {
2669
+ Ot($, (L) => {
2670
+ L.call(e, l, w, Je);
2650
2671
  });
2651
2672
  }
2652
2673
  const In = function(l) {
2653
2674
  let w = null;
2654
- if (Ie(z.beforeSanitizeElements, l, null), Vt(l))
2675
+ if (De(M.beforeSanitizeElements, l, null), Vt(l))
2655
2676
  return Se(l), !0;
2656
- const R = ie(l.nodeName);
2657
- if (Ie(z.uponSanitizeElement, l, {
2658
- tagName: R,
2659
- allowedTags: te
2660
- }), Y && l.hasChildNodes() && !Ln(l.firstElementChild) && he(/<[/\w!]/g, l.innerHTML) && he(/<[/\w!]/g, l.textContent) || l.nodeType === yt.progressingInstruction || Y && l.nodeType === yt.comment && he(/<[/\w]/g, l.data))
2677
+ const L = ae(l.nodeName);
2678
+ if (De(M.uponSanitizeElement, l, {
2679
+ tagName: L,
2680
+ allowedTags: ne
2681
+ }), X && l.hasChildNodes() && !Ln(l.firstElementChild) && fe(/<[/\w!]/g, l.innerHTML) && fe(/<[/\w!]/g, l.textContent) || l.nodeType === yt.progressingInstruction || X && l.nodeType === yt.comment && fe(/<[/\w]/g, l.data))
2661
2682
  return Se(l), !0;
2662
- if (!(Re.tagCheck instanceof Function && Re.tagCheck(R)) && (!te[R] || Fe[R])) {
2663
- if (!Fe[R] && Dn(R) && (Z.tagNameCheck instanceof RegExp && he(Z.tagNameCheck, R) || Z.tagNameCheck instanceof Function && Z.tagNameCheck(R)))
2683
+ if (!(Ie.tagCheck instanceof Function && Ie.tagCheck(L)) && (!ne[L] || je[L])) {
2684
+ if (!je[L] && Dn(L) && (Y.tagNameCheck instanceof RegExp && fe(Y.tagNameCheck, L) || Y.tagNameCheck instanceof Function && Y.tagNameCheck(L)))
2664
2685
  return !1;
2665
- if (Ut && !Qe[R]) {
2666
- const Q = C(l) || l.parentNode, le = S(l) || l.childNodes;
2667
- if (le && Q) {
2668
- const se = le.length;
2669
- for (let ge = se - 1; ge >= 0; --ge) {
2670
- const $e = A(le[ge], !0);
2671
- $e.__removalCount = (l.__removalCount || 0) + 1, Q.insertBefore($e, m(l));
2686
+ if (Ut && !Ye[L]) {
2687
+ const Q = E(l) || l.parentNode, ue = S(l) || l.childNodes;
2688
+ if (ue && Q) {
2689
+ const re = ue.length;
2690
+ for (let me = re - 1; me >= 0; --me) {
2691
+ const Oe = A(ue[me], !0);
2692
+ Oe.__removalCount = (l.__removalCount || 0) + 1, Q.insertBefore(Oe, y(l));
2672
2693
  }
2673
2694
  }
2674
2695
  }
2675
2696
  return Se(l), !0;
2676
2697
  }
2677
- return l instanceof u && !_s(l) || (R === "noscript" || R === "noembed" || R === "noframes") && he(/<\/no(script|embed|frames)/i, l.innerHTML) ? (Se(l), !0) : (U && l.nodeType === yt.text && (w = l.textContent, Ot([L, ee, Te], (Q) => {
2678
- w = ft(w, Q, " ");
2679
- }), l.textContent !== w && (pt(e.removed, {
2698
+ return l instanceof u && !_s(l) || (L === "noscript" || L === "noembed" || L === "noframes") && fe(/<\/no(script|embed|frames)/i, l.innerHTML) ? (Se(l), !0) : (B && l.nodeType === yt.text && (w = l.textContent, Ot([Z, I, V], (Q) => {
2699
+ w = pt(w, Q, " ");
2700
+ }), l.textContent !== w && (ft(e.removed, {
2680
2701
  element: l.cloneNode()
2681
- }), l.textContent = w)), Ie(z.afterSanitizeElements, l, null), !1);
2682
- }, $n = function(l, w, R) {
2683
- if (kn && (w === "id" || w === "name") && (R in t || R in Ps))
2702
+ }), l.textContent = w)), De(M.afterSanitizeElements, l, null), !1);
2703
+ }, $n = function(l, w, L) {
2704
+ if (kn && (w === "id" || w === "name") && (L in t || L in Ps))
2684
2705
  return !1;
2685
- if (!(it && !rt[w] && he(Ve, w))) {
2686
- if (!(ot && he(Be, w))) {
2687
- if (!(Re.attributeCheck instanceof Function && Re.attributeCheck(w, l))) {
2688
- if (!ne[w] || rt[w]) {
2706
+ if (!(it && !rt[w] && fe(qe, w))) {
2707
+ if (!(ot && fe(Me, w))) {
2708
+ if (!(Ie.attributeCheck instanceof Function && Ie.attributeCheck(w, l))) {
2709
+ if (!se[w] || rt[w]) {
2689
2710
  if (
2690
2711
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
2691
2712
  // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
2692
2713
  // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
2693
- !(Dn(l) && (Z.tagNameCheck instanceof RegExp && he(Z.tagNameCheck, l) || Z.tagNameCheck instanceof Function && Z.tagNameCheck(l)) && (Z.attributeNameCheck instanceof RegExp && he(Z.attributeNameCheck, w) || Z.attributeNameCheck instanceof Function && Z.attributeNameCheck(w, l)) || // Alternative, second condition checks if it's an `is`-attribute, AND
2714
+ !(Dn(l) && (Y.tagNameCheck instanceof RegExp && fe(Y.tagNameCheck, l) || Y.tagNameCheck instanceof Function && Y.tagNameCheck(l)) && (Y.attributeNameCheck instanceof RegExp && fe(Y.attributeNameCheck, w) || Y.attributeNameCheck instanceof Function && Y.attributeNameCheck(w, l)) || // Alternative, second condition checks if it's an `is`-attribute, AND
2694
2715
  // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
2695
- w === "is" && Z.allowCustomizedBuiltInElements && (Z.tagNameCheck instanceof RegExp && he(Z.tagNameCheck, R) || Z.tagNameCheck instanceof Function && Z.tagNameCheck(R)))
2716
+ w === "is" && Y.allowCustomizedBuiltInElements && (Y.tagNameCheck instanceof RegExp && fe(Y.tagNameCheck, L) || Y.tagNameCheck instanceof Function && Y.tagNameCheck(L)))
2696
2717
  ) return !1;
2697
2718
  } else if (!qt[w]) {
2698
- if (!he(At, ft(R, nt, ""))) {
2699
- if (!((w === "src" || w === "xlink:href" || w === "href") && l !== "script" && so(R, "data:") === 0 && vn[l])) {
2700
- if (!(at && !he(Me, ft(R, nt, "")))) {
2701
- if (R)
2719
+ if (!fe(At, pt(L, ze, ""))) {
2720
+ if (!((w === "src" || w === "xlink:href" || w === "href") && l !== "script" && so(L, "data:") === 0 && vn[l])) {
2721
+ if (!(at && !fe(Re, pt(L, ze, "")))) {
2722
+ if (L)
2702
2723
  return !1;
2703
2724
  }
2704
2725
  }
@@ -2711,81 +2732,81 @@ function Cs() {
2711
2732
  }, Dn = function(l) {
2712
2733
  return l !== "annotation-xml" && Yt(l, Ft);
2713
2734
  }, On = function(l) {
2714
- Ie(z.beforeSanitizeAttributes, l, null);
2735
+ De(M.beforeSanitizeAttributes, l, null);
2715
2736
  const {
2716
2737
  attributes: w
2717
2738
  } = l;
2718
2739
  if (!w || Vt(l))
2719
2740
  return;
2720
- const R = {
2741
+ const L = {
2721
2742
  attrName: "",
2722
2743
  attrValue: "",
2723
2744
  keepAttr: !0,
2724
- allowedAttributes: ne,
2745
+ allowedAttributes: se,
2725
2746
  forceKeepAttr: void 0
2726
2747
  };
2727
2748
  let Q = w.length;
2728
2749
  for (; Q--; ) {
2729
- const le = w[Q], {
2730
- name: se,
2731
- namespaceURI: ge,
2732
- value: $e
2733
- } = le, Xe = ie(se), Gt = $e;
2734
- let ae = se === "value" ? Gt : ro(Gt);
2735
- if (R.attrName = Xe, R.attrValue = ae, R.keepAttr = !0, R.forceKeepAttr = void 0, Ie(z.uponSanitizeAttribute, l, R), ae = R.attrValue, wn && (Xe === "id" || Xe === "name") && (Ue(se, l), ae = Is + ae), Y && he(/((--!?|])>)|<\/(style|title|textarea)/i, ae)) {
2736
- Ue(se, l);
2750
+ const ue = w[Q], {
2751
+ name: re,
2752
+ namespaceURI: me,
2753
+ value: Oe
2754
+ } = ue, et = ae(re), Gt = Oe;
2755
+ let le = re === "value" ? Gt : ro(Gt);
2756
+ if (L.attrName = et, L.attrValue = le, L.keepAttr = !0, L.forceKeepAttr = void 0, De(M.uponSanitizeAttribute, l, L), le = L.attrValue, wn && (et === "id" || et === "name") && (We(re, l), le = Is + le), X && fe(/((--!?|])>)|<\/(style|title|textarea)/i, le)) {
2757
+ We(re, l);
2737
2758
  continue;
2738
2759
  }
2739
- if (Xe === "attributename" && Yt(ae, "href")) {
2740
- Ue(se, l);
2760
+ if (et === "attributename" && Yt(le, "href")) {
2761
+ We(re, l);
2741
2762
  continue;
2742
2763
  }
2743
- if (R.forceKeepAttr)
2764
+ if (L.forceKeepAttr)
2744
2765
  continue;
2745
- if (!R.keepAttr) {
2746
- Ue(se, l);
2766
+ if (!L.keepAttr) {
2767
+ We(re, l);
2747
2768
  continue;
2748
2769
  }
2749
- if (!O && he(/\/>/i, ae)) {
2750
- Ue(se, l);
2770
+ if (!O && fe(/\/>/i, le)) {
2771
+ We(re, l);
2751
2772
  continue;
2752
2773
  }
2753
- U && Ot([L, ee, Te], (Pn) => {
2754
- ae = ft(ae, Pn, " ");
2774
+ B && Ot([Z, I, V], (Pn) => {
2775
+ le = pt(le, Pn, " ");
2755
2776
  });
2756
- const Nn = ie(l.nodeName);
2757
- if (!$n(Nn, Xe, ae)) {
2758
- Ue(se, l);
2777
+ const Nn = ae(l.nodeName);
2778
+ if (!$n(Nn, et, le)) {
2779
+ We(re, l);
2759
2780
  continue;
2760
2781
  }
2761
- if (T && typeof g == "object" && typeof g.getAttributeType == "function" && !ge)
2762
- switch (g.getAttributeType(Nn, Xe)) {
2782
+ if (T && typeof f == "object" && typeof f.getAttributeType == "function" && !me)
2783
+ switch (f.getAttributeType(Nn, et)) {
2763
2784
  case "TrustedHTML": {
2764
- ae = T.createHTML(ae);
2785
+ le = T.createHTML(le);
2765
2786
  break;
2766
2787
  }
2767
2788
  case "TrustedScriptURL": {
2768
- ae = T.createScriptURL(ae);
2789
+ le = T.createScriptURL(le);
2769
2790
  break;
2770
2791
  }
2771
2792
  }
2772
- if (ae !== Gt)
2793
+ if (le !== Gt)
2773
2794
  try {
2774
- ge ? l.setAttributeNS(ge, se, ae) : l.setAttribute(se, ae), Vt(l) ? Se(l) : Yn(e.removed);
2795
+ me ? l.setAttributeNS(me, re, le) : l.setAttribute(re, le), Vt(l) ? Se(l) : Yn(e.removed);
2775
2796
  } catch {
2776
- Ue(se, l);
2797
+ We(re, l);
2777
2798
  }
2778
2799
  }
2779
- Ie(z.afterSanitizeAttributes, l, null);
2800
+ De(M.afterSanitizeAttributes, l, null);
2780
2801
  }, zs = function $(l) {
2781
2802
  let w = null;
2782
- const R = Rn(l);
2783
- for (Ie(z.beforeSanitizeShadowDOM, l, null); w = R.nextNode(); )
2784
- Ie(z.uponSanitizeShadowNode, w, null), In(w), On(w), w.content instanceof o && $(w.content);
2785
- Ie(z.afterSanitizeShadowDOM, l, null);
2803
+ const L = Rn(l);
2804
+ for (De(M.beforeSanitizeShadowDOM, l, null); w = L.nextNode(); )
2805
+ De(M.uponSanitizeShadowNode, w, null), In(w), On(w), w.content instanceof o && $(w.content);
2806
+ De(M.afterSanitizeShadowDOM, l, null);
2786
2807
  };
2787
2808
  return e.sanitize = function($) {
2788
- let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, w = null, R = null, Q = null, le = null;
2809
+ let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, w = null, L = null, Q = null, ue = null;
2789
2810
  if (jt = !$, jt && ($ = "<!-->"), typeof $ != "string" && !Ln($))
2790
2811
  if (typeof $.toString == "function") {
2791
2812
  if ($ = $.toString(), typeof $ != "string")
@@ -2794,61 +2815,61 @@ function Cs() {
2794
2815
  throw gt("toString is not a function");
2795
2816
  if (!e.isSupported)
2796
2817
  return $;
2797
- if (re || Kt(l), e.removed = [], typeof $ == "string" && (lt = !1), lt) {
2818
+ if (oe || Kt(l), e.removed = [], typeof $ == "string" && (lt = !1), lt) {
2798
2819
  if ($.nodeName) {
2799
- const $e = ie($.nodeName);
2800
- if (!te[$e] || Fe[$e])
2820
+ const Oe = ae($.nodeName);
2821
+ if (!ne[Oe] || je[Oe])
2801
2822
  throw gt("root node is forbidden and cannot be sanitized in-place");
2802
2823
  }
2803
2824
  } else if ($ instanceof a)
2804
- w = Mn("<!---->"), R = w.ownerDocument.importNode($, !0), R.nodeType === yt.element && R.nodeName === "BODY" || R.nodeName === "HTML" ? w = R : w.appendChild(R);
2825
+ w = Mn("<!---->"), L = w.ownerDocument.importNode($, !0), L.nodeType === yt.element && L.nodeName === "BODY" || L.nodeName === "HTML" ? w = L : w.appendChild(L);
2805
2826
  else {
2806
- if (!oe && !U && !G && // eslint-disable-next-line unicorn/prefer-includes
2827
+ if (!ie && !B && !G && // eslint-disable-next-line unicorn/prefer-includes
2807
2828
  $.indexOf("<") === -1)
2808
2829
  return T && Ct ? T.createHTML($) : $;
2809
2830
  if (w = Mn($), !w)
2810
- return oe ? null : Ct ? _ : "";
2831
+ return ie ? null : Ct ? z : "";
2811
2832
  }
2812
- w && X && Se(w.firstChild);
2813
- const se = Rn(lt ? $ : w);
2814
- for (; Q = se.nextNode(); )
2833
+ w && ee && Se(w.firstChild);
2834
+ const re = Rn(lt ? $ : w);
2835
+ for (; Q = re.nextNode(); )
2815
2836
  In(Q), On(Q), Q.content instanceof o && zs(Q.content);
2816
2837
  if (lt)
2817
2838
  return $;
2818
- if (oe) {
2819
- if (_e)
2820
- for (le = E.call(w.ownerDocument); w.firstChild; )
2821
- le.appendChild(w.firstChild);
2839
+ if (ie) {
2840
+ if (He)
2841
+ for (ue = C.call(w.ownerDocument); w.firstChild; )
2842
+ ue.appendChild(w.firstChild);
2822
2843
  else
2823
- le = w;
2824
- return (ne.shadowroot || ne.shadowrootmode) && (le = I.call(s, le, !0)), le;
2844
+ ue = w;
2845
+ return (se.shadowroot || se.shadowrootmode) && (ue = R.call(s, ue, !0)), ue;
2825
2846
  }
2826
- let ge = G ? w.outerHTML : w.innerHTML;
2827
- return G && te["!doctype"] && w.ownerDocument && w.ownerDocument.doctype && w.ownerDocument.doctype.name && he(As, w.ownerDocument.doctype.name) && (ge = "<!DOCTYPE " + w.ownerDocument.doctype.name + `>
2828
- ` + ge), U && Ot([L, ee, Te], ($e) => {
2829
- ge = ft(ge, $e, " ");
2830
- }), T && Ct ? T.createHTML(ge) : ge;
2847
+ let me = G ? w.outerHTML : w.innerHTML;
2848
+ return G && ne["!doctype"] && w.ownerDocument && w.ownerDocument.doctype && w.ownerDocument.doctype.name && fe(As, w.ownerDocument.doctype.name) && (me = "<!DOCTYPE " + w.ownerDocument.doctype.name + `>
2849
+ ` + me), B && Ot([Z, I, V], (Oe) => {
2850
+ me = pt(me, Oe, " ");
2851
+ }), T && Ct ? T.createHTML(me) : me;
2831
2852
  }, e.setConfig = function() {
2832
2853
  let $ = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2833
- Kt($), re = !0;
2854
+ Kt($), oe = !0;
2834
2855
  }, e.clearConfig = function() {
2835
- Ye = null, re = !1;
2856
+ Je = null, oe = !1;
2836
2857
  }, e.isValidAttribute = function($, l, w) {
2837
- Ye || Kt({});
2838
- const R = ie($), Q = ie(l);
2839
- return $n(R, Q, w);
2858
+ Je || Kt({});
2859
+ const L = ae($), Q = ae(l);
2860
+ return $n(L, Q, w);
2840
2861
  }, e.addHook = function($, l) {
2841
- typeof l == "function" && pt(z[$], l);
2862
+ typeof l == "function" && ft(M[$], l);
2842
2863
  }, e.removeHook = function($, l) {
2843
2864
  if (l !== void 0) {
2844
- const w = to(z[$], l);
2845
- return w === -1 ? void 0 : no(z[$], w, 1)[0];
2865
+ const w = to(M[$], l);
2866
+ return w === -1 ? void 0 : no(M[$], w, 1)[0];
2846
2867
  }
2847
- return Yn(z[$]);
2868
+ return Yn(M[$]);
2848
2869
  }, e.removeHooks = function($) {
2849
- z[$] = [];
2870
+ M[$] = [];
2850
2871
  }, e.removeAllHooks = function() {
2851
- z = ss();
2872
+ M = ss();
2852
2873
  }, e;
2853
2874
  }
2854
2875
  var wo = Cs();
@@ -2912,8 +2933,8 @@ function Ea() {
2912
2933
  });
2913
2934
  }
2914
2935
  function t(o, i = 100) {
2915
- const { scrollTop: a, scrollHeight: u, clientHeight: c } = o;
2916
- return u - a - c < i;
2936
+ const { scrollTop: a, scrollHeight: u, clientHeight: d } = o;
2937
+ return u - a - d < i;
2917
2938
  }
2918
2939
  function s(o) {
2919
2940
  o && (r(), n = new MutationObserver(() => {
@@ -2940,7 +2961,7 @@ function Ea() {
2940
2961
  };
2941
2962
  }
2942
2963
  function Ma() {
2943
- const n = We(), e = N(() => n.error), t = N(() => {
2964
+ const n = Ge(), e = N(() => n.error), t = N(() => {
2944
2965
  var o, i;
2945
2966
  return ((o = e.value) == null ? void 0 : o.message) !== null && ((i = e.value) == null ? void 0 : i.message) !== void 0;
2946
2967
  });
@@ -2954,7 +2975,7 @@ function Ma() {
2954
2975
  };
2955
2976
  }
2956
2977
  function Es() {
2957
- const n = We(), e = N(() => n.pageContext);
2978
+ const n = Ge(), e = N(() => n.pageContext);
2958
2979
  function t(o) {
2959
2980
  n.setPageContext(o);
2960
2981
  }
@@ -2984,13 +3005,13 @@ const Ce = [], Ms = {
2984
3005
  matcher: () => !0,
2985
3006
  priority: 0,
2986
3007
  getSuggestions: () => {
2987
- const n = J();
3008
+ const n = te();
2988
3009
  return (n == null ? void 0 : n.defaultSuggestions) || [];
2989
3010
  }
2990
3011
  };
2991
3012
  function vo() {
2992
3013
  Ce.length = 0;
2993
- const n = J();
3014
+ const n = te();
2994
3015
  n != null && n.suggestionProviders && Ce.push(...n.suggestionProviders), Ce.push(Ms);
2995
3016
  }
2996
3017
  function To(n, e) {
@@ -3022,23 +3043,23 @@ function Ao(n) {
3022
3043
  }
3023
3044
  const Ra = Ao;
3024
3045
  function Rs() {
3025
- const { context: n } = Es(), e = We(), t = N(() => {
3046
+ const { context: n } = Es(), e = Ge(), t = N(() => {
3026
3047
  var u;
3027
3048
  if (e.quota.remaining === 0) {
3028
- const c = J();
3029
- return (c == null ? void 0 : c.enableSupportMode) !== !1 ? [
3049
+ const d = te();
3050
+ return (d == null ? void 0 : d.enableSupportMode) !== !1 ? [
3030
3051
  {
3031
3052
  id: "contact-support-quota",
3032
- title: ce("contactSupport"),
3033
- description: ce("noQuota"),
3053
+ title: de("contactSupport"),
3054
+ description: de("noQuota"),
3034
3055
  prompt: "I need help with my account",
3035
3056
  className: "rai-suggestion--warning",
3036
3057
  isSupportRequest: !0
3037
3058
  }
3038
3059
  ] : [];
3039
3060
  }
3040
- const o = ((u = n.value) == null ? void 0 : u.routePath) || (typeof window < "u" ? window.location.pathname : "/"), i = So(o, n.value) || [], a = J();
3041
- return a != null && a.can ? i.filter((c) => !(c.permission && !a.can(c.permission))) : i;
3061
+ const o = ((u = n.value) == null ? void 0 : u.routePath) || (typeof window < "u" ? window.location.pathname : "/"), i = So(o, n.value) || [], a = te();
3062
+ return a != null && a.can ? i.filter((d) => !(d.permission && !a.can(d.permission))) : i;
3042
3063
  }), s = N(() => n.value !== null && n.value.pageType !== "default");
3043
3064
  function r(o) {
3044
3065
  return typeof o.prompt == "function" ? o.prompt(
@@ -3057,8 +3078,8 @@ function La(n, e) {
3057
3078
  if (!e)
3058
3079
  return {};
3059
3080
  const a = {};
3060
- for (const [u, c] of Object.entries(e))
3061
- a[u] = Fs(c) ? c.value : c;
3081
+ for (const [u, d] of Object.entries(e))
3082
+ a[u] = Fs(d) ? d.value : d;
3062
3083
  return a;
3063
3084
  }
3064
3085
  function i() {
@@ -3073,7 +3094,7 @@ function La(n, e) {
3073
3094
  i();
3074
3095
  }), bt(() => {
3075
3096
  s();
3076
- }), e && Ne(
3097
+ }), e && _e(
3077
3098
  () => o(),
3078
3099
  (a) => {
3079
3100
  r({ metadata: a });
@@ -3098,25 +3119,25 @@ function Co(n) {
3098
3119
  function Eo(n, e) {
3099
3120
  const t = n.key.toLowerCase();
3100
3121
  if (e.mod) {
3101
- const c = navigator.platform.toUpperCase().indexOf("MAC") >= 0 || navigator.userAgent.toUpperCase().indexOf("MAC") >= 0 ? n.metaKey : n.ctrlKey, d = e.shift ? n.shiftKey : !n.shiftKey, f = e.alt ? n.altKey : !n.altKey;
3102
- return t === e.key && c && d && f;
3122
+ const d = navigator.platform.toUpperCase().indexOf("MAC") >= 0 || navigator.userAgent.toUpperCase().indexOf("MAC") >= 0 ? n.metaKey : n.ctrlKey, c = e.shift ? n.shiftKey : !n.shiftKey, g = e.alt ? n.altKey : !n.altKey;
3123
+ return t === e.key && d && c && g;
3103
3124
  }
3104
3125
  const s = e.meta ? n.metaKey : !n.metaKey, r = e.ctrl ? n.ctrlKey : !n.ctrlKey, o = e.shift ? n.shiftKey : !n.shiftKey, i = e.alt ? n.altKey : !n.altKey;
3105
3126
  let a = s && r && o && i;
3106
3127
  return (e.meta && !e.ctrl || !e.meta && e.ctrl) && (a = (n.metaKey || n.ctrlKey) && o && i), t === e.key && a;
3107
3128
  }
3108
3129
  function Mo(n) {
3109
- const { onToggle: e, enabled: t = !0 } = n, s = q(!1), r = n.shortcut !== void 0 ? n.shortcut : et("keyboardShortcut") ?? "mod+g";
3130
+ const { onToggle: e, enabled: t = !0 } = n, s = q(!1), r = n.shortcut !== void 0 ? n.shortcut : Be("keyboardShortcut") ?? "mod+g";
3110
3131
  if (r === null)
3111
3132
  return { isActive: s };
3112
3133
  const o = Co(r);
3113
3134
  function i(a) {
3114
3135
  if (!t) return;
3115
- const u = a.target, c = u.tagName === "INPUT" || u.tagName === "TEXTAREA", d = u.isContentEditable, f = u.closest("[data-ai-input]");
3116
- if (!((c || d) && !f) && Eo(a, o)) {
3136
+ const u = a.target, d = u.tagName === "INPUT" || u.tagName === "TEXTAREA", c = u.isContentEditable, g = u.closest("[data-ai-input]");
3137
+ if (!((d || c) && !g) && Eo(a, o)) {
3117
3138
  a.preventDefault(), a.stopPropagation();
3118
- const k = J();
3119
- if (k != null && k.canToggle && !k.canToggle())
3139
+ const m = te();
3140
+ if (m != null && m.canToggle && !m.canToggle())
3120
3141
  return;
3121
3142
  s.value = !s.value, e();
3122
3143
  }
@@ -3128,7 +3149,7 @@ function Mo(n) {
3128
3149
  }), { isActive: s };
3129
3150
  }
3130
3151
  function Ia(n) {
3131
- const e = We();
3152
+ const e = Ge();
3132
3153
  return Mo({
3133
3154
  onToggle: () => {
3134
3155
  n ? n.value = !n.value : e.showChat = !e.showChat;
@@ -3136,36 +3157,36 @@ function Ia(n) {
3136
3157
  });
3137
3158
  }
3138
3159
  function Ro(n, e) {
3139
- const t = q(ce("loadingText"));
3160
+ const t = q(de("loadingText"));
3140
3161
  let s = [];
3141
3162
  function r() {
3142
3163
  return [
3143
- ce("loadingText"),
3144
- ce("analyzingText"),
3145
- ce("craftingText")
3164
+ de("loadingText"),
3165
+ de("analyzingText"),
3166
+ de("craftingText")
3146
3167
  ];
3147
3168
  }
3148
3169
  function o() {
3149
3170
  return [0, 2e3, 5e3];
3150
3171
  }
3151
3172
  function i() {
3152
- s.forEach((c) => clearTimeout(c)), s = [];
3173
+ s.forEach((d) => clearTimeout(d)), s = [];
3153
3174
  }
3154
3175
  function a() {
3155
3176
  i();
3156
- const c = e == null ? void 0 : e(), d = (c == null ? void 0 : c.messages) ?? r();
3157
- t.value = d[0] || ce("loadingText");
3177
+ const d = e == null ? void 0 : e(), c = (d == null ? void 0 : d.messages) ?? r();
3178
+ t.value = c[0] || de("loadingText");
3158
3179
  }
3159
3180
  function u() {
3160
3181
  i();
3161
- const c = e == null ? void 0 : e(), d = (c == null ? void 0 : c.messages) ?? r(), f = (c == null ? void 0 : c.intervals) ?? o();
3162
- t.value = d[0] || ce("loadingText");
3163
- let k = 0;
3164
- for (let g = 1; g < d.length; g++) {
3165
- k += f[g] || 2e3;
3166
- const p = g, A = window.setTimeout(() => {
3167
- n() && (t.value = d[p]);
3168
- }, k);
3182
+ const d = e == null ? void 0 : e(), c = (d == null ? void 0 : d.messages) ?? r(), g = (d == null ? void 0 : d.intervals) ?? o();
3183
+ t.value = c[0] || de("loadingText");
3184
+ let m = 0;
3185
+ for (let f = 1; f < c.length; f++) {
3186
+ m += g[f] || 2e3;
3187
+ const p = f, A = window.setTimeout(() => {
3188
+ n() && (t.value = c[p]);
3189
+ }, m);
3169
3190
  s.push(A);
3170
3191
  }
3171
3192
  }
@@ -3191,27 +3212,27 @@ function Lo(n) {
3191
3212
  isReached: !1,
3192
3213
  pendingMessage: null
3193
3214
  }), u = N(() => {
3194
- var C;
3195
- return ((C = s()) == null ? void 0 : C.limit) ?? t();
3196
- }), c = N(() => {
3197
- var C;
3198
- return ((C = s()) == null ? void 0 : C.showWarningAt) ?? u.value - 2;
3199
- }), d = N(() => Math.max(0, u.value - e())), f = N(
3200
- () => d.value <= u.value - c.value && d.value > 0
3201
- ), k = N(() => d.value === 0), g = N(() => {
3202
- var C, T;
3203
- return a.value.isReached ? ((C = r()) == null ? void 0 : C.historyLimitReachedTitle) ?? "Chat Limit Reached" : ((T = r()) == null ? void 0 : T.historyLimitWarningTitle) ?? "Approaching Chat Limit";
3215
+ var E;
3216
+ return ((E = s()) == null ? void 0 : E.limit) ?? t();
3217
+ }), d = N(() => {
3218
+ var E;
3219
+ return ((E = s()) == null ? void 0 : E.showWarningAt) ?? u.value - 2;
3220
+ }), c = N(() => Math.max(0, u.value - e())), g = N(
3221
+ () => c.value <= u.value - d.value && c.value > 0
3222
+ ), m = N(() => c.value === 0), f = N(() => {
3223
+ var E, T;
3224
+ return a.value.isReached || m.value ? ((E = r()) == null ? void 0 : E.historyLimitReachedTitle) ?? "Chat Limit Reached" : ((T = r()) == null ? void 0 : T.historyLimitWarningTitle) ?? "Approaching Chat Limit";
3204
3225
  }), p = N(() => {
3205
- var C, T, _, F;
3206
- return a.value.isReached ? ((C = s()) == null ? void 0 : C.limitMessage) ?? ((T = r()) == null ? void 0 : T.historyLimitReachedMessage) ?? "You have reached the maximum number of messages in this conversation. Start a new chat to continue." : ((_ = s()) == null ? void 0 : _.warningMessage) ?? ((F = r()) == null ? void 0 : F.historyLimitWarningMessage) ?? `You have ${d.value} message${d.value === 1 ? "" : "s"} remaining in this conversation.`;
3226
+ var E, T, z, U;
3227
+ return a.value.isReached || m.value ? ((E = s()) == null ? void 0 : E.limitMessage) ?? ((T = r()) == null ? void 0 : T.historyLimitReachedMessage) ?? "You have reached the maximum number of messages in this conversation. Start a new chat to continue." : ((z = s()) == null ? void 0 : z.warningMessage) ?? ((U = r()) == null ? void 0 : U.historyLimitWarningMessage) ?? `You have ${c.value} message${c.value === 1 ? "" : "s"} remaining in this conversation.`;
3207
3228
  });
3208
3229
  function A() {
3209
3230
  a.value.showWarning = !1, a.value.isReached = !1, a.value.pendingMessage = null;
3210
3231
  }
3211
- async function x() {
3232
+ async function k() {
3212
3233
  a.value.showWarning = !1;
3213
- const C = s();
3214
- if (C != null && C.onLimitReached && !await C.onLimitReached())
3234
+ const E = s();
3235
+ if (E != null && E.onLimitReached && !await E.onLimitReached())
3215
3236
  return a.value.isReached = !1, null;
3216
3237
  if (o(), i(), a.value.isReached = !1, a.value.pendingMessage) {
3217
3238
  const T = a.value.pendingMessage;
@@ -3219,11 +3240,11 @@ function Lo(n) {
3219
3240
  }
3220
3241
  return null;
3221
3242
  }
3222
- function m() {
3223
- return k.value ? (a.value.isReached = !0, a.value.showWarning = !0, !1) : (f.value && !a.value.showWarning && (a.value.showWarning = !0), !0);
3243
+ function y() {
3244
+ return m.value ? (a.value.isReached = !0, a.value.showWarning = !0, !1) : (g.value && !a.value.showWarning && (a.value.showWarning = !0), !0);
3224
3245
  }
3225
- function S(C) {
3226
- a.value.pendingMessage = C;
3246
+ function S(E) {
3247
+ a.value.pendingMessage = E;
3227
3248
  }
3228
3249
  return {
3229
3250
  // State
@@ -3231,108 +3252,108 @@ function Lo(n) {
3231
3252
  historyLimitReached: N(() => a.value.isReached),
3232
3253
  // Computed
3233
3254
  historyLimit: u,
3234
- remainingMessages: d,
3235
- historyLimitDialogTitle: g,
3255
+ remainingMessages: c,
3256
+ historyLimitDialogTitle: f,
3236
3257
  historyLimitDialogMessage: p,
3237
3258
  // Actions
3238
3259
  dismissHistoryLimitWarning: A,
3239
- handleHistoryLimitAction: x,
3240
- checkHistoryLimit: m,
3260
+ handleHistoryLimitAction: k,
3261
+ checkHistoryLimit: y,
3241
3262
  setPendingMessage: S
3242
3263
  };
3243
3264
  }
3244
3265
  function Io() {
3245
- const n = We(), e = q([]), t = q(!1), s = q(0), r = et("maxAttachments") || 5, o = et("maxFileSize") || 10 * 1024 * 1024, i = et("acceptedFileTypes") || "image/*,.pdf,.txt,.doc,.docx,.xls,.xlsx,.csv", a = N(() => e.value.length > 0), u = N(() => e.value.some((E) => E.uploading)), c = N(() => e.value.length < r);
3246
- function d(E) {
3247
- return (E.type || "").startsWith("image/") ? !0 : /(png|jpe?g|gif|webp)$/i.test(E.name);
3248
- }
3249
- function f(E) {
3250
- if (E == null) return "";
3251
- const M = typeof E == "string" ? parseInt(E, 10) : E;
3252
- return Number.isNaN(M) ? "" : M >= 1024 * 1024 ? `${(M / (1024 * 1024)).toFixed(1)} MB` : M >= 1024 ? `${Math.round(M / 1024)} KB` : `${M} B`;
3253
- }
3254
- function k(E) {
3255
- var Te;
3256
- const M = crypto.randomUUID(), I = E.type.startsWith("image/") ? URL.createObjectURL(E) : void 0, z = J(), L = !!((Te = z == null ? void 0 : z.endpoints) != null && Te.uploadFile), ee = {
3257
- id: M,
3258
- name: E.name,
3259
- type: E.type,
3260
- size: E.size,
3261
- uploading: L,
3262
- progress: L ? 0 : 100,
3263
- previewUrl: I
3266
+ const n = Ge(), e = q([]), t = q(!1), s = q(0), r = Be("maxAttachments") || 5, o = Be("maxFileSize") || 10 * 1024 * 1024, i = Be("acceptedFileTypes") || "image/*,.pdf,.txt,.doc,.docx,.xls,.xlsx,.csv", a = N(() => e.value.length > 0), u = N(() => e.value.some((C) => C.uploading)), d = N(() => e.value.length < r);
3267
+ function c(C) {
3268
+ return (C.type || "").startsWith("image/") ? !0 : /(png|jpe?g|gif|webp)$/i.test(C.name);
3269
+ }
3270
+ function g(C) {
3271
+ if (C == null) return "";
3272
+ const _ = typeof C == "string" ? parseInt(C, 10) : C;
3273
+ return Number.isNaN(_) ? "" : _ >= 1024 * 1024 ? `${(_ / (1024 * 1024)).toFixed(1)} MB` : _ >= 1024 ? `${Math.round(_ / 1024)} KB` : `${_} B`;
3274
+ }
3275
+ function m(C) {
3276
+ var V;
3277
+ const _ = crypto.randomUUID(), R = C.type.startsWith("image/") ? URL.createObjectURL(C) : void 0, M = te(), Z = !!((V = M == null ? void 0 : M.endpoints) != null && V.uploadFile), I = {
3278
+ id: _,
3279
+ name: C.name,
3280
+ type: C.type,
3281
+ size: C.size,
3282
+ uploading: Z,
3283
+ progress: Z ? 0 : 100,
3284
+ previewUrl: R
3264
3285
  };
3265
- e.value.push(ee), L && g(E, M);
3286
+ e.value.push(I), Z && f(C, _);
3266
3287
  }
3267
- async function g(E, M) {
3288
+ async function f(C, _) {
3268
3289
  try {
3269
- const I = await n.uploadFile(E), z = e.value.findIndex((L) => L.id === M);
3270
- if (z === -1) return;
3271
- if (I) {
3272
- const L = e.value[z].previewUrl;
3273
- e.value[z] = {
3274
- ...e.value[z],
3275
- id: I.id || M,
3276
- url: I.url,
3277
- extractedText: I.extractedText,
3290
+ const R = await n.uploadFile(C), M = e.value.findIndex((Z) => Z.id === _);
3291
+ if (M === -1) return;
3292
+ if (R) {
3293
+ const Z = e.value[M].previewUrl;
3294
+ e.value[M] = {
3295
+ ...e.value[M],
3296
+ id: R.id || _,
3297
+ url: R.url,
3298
+ extractedText: R.extractedText,
3278
3299
  uploading: !1,
3279
3300
  progress: 100,
3280
- previewUrl: L || I.previewUrl
3301
+ previewUrl: Z || R.previewUrl
3281
3302
  };
3282
3303
  } else
3283
- p(M);
3304
+ p(_);
3284
3305
  } catch {
3285
- p(M);
3306
+ p(_);
3286
3307
  }
3287
3308
  }
3288
- function p(E) {
3289
- const M = e.value.findIndex((z) => z.id === E);
3290
- if (M === -1) return;
3291
- const [I] = e.value.splice(M, 1);
3292
- I != null && I.previewUrl && URL.revokeObjectURL(I.previewUrl);
3309
+ function p(C) {
3310
+ const _ = e.value.findIndex((M) => M.id === C);
3311
+ if (_ === -1) return;
3312
+ const [R] = e.value.splice(_, 1);
3313
+ R != null && R.previewUrl && URL.revokeObjectURL(R.previewUrl);
3293
3314
  }
3294
3315
  function A() {
3295
- e.value.forEach((E) => {
3296
- E.previewUrl && URL.revokeObjectURL(E.previewUrl);
3316
+ e.value.forEach((C) => {
3317
+ C.previewUrl && URL.revokeObjectURL(C.previewUrl);
3297
3318
  }), e.value = [];
3298
3319
  }
3299
- function x() {
3300
- return e.value.filter((E) => !E.uploading).map((E) => ({
3301
- id: E.id,
3302
- name: E.name,
3303
- url: E.url,
3304
- type: E.type,
3305
- size: E.size
3320
+ function k() {
3321
+ return e.value.filter((C) => !C.uploading).map((C) => ({
3322
+ id: C.id,
3323
+ name: C.name,
3324
+ url: C.url,
3325
+ type: C.type,
3326
+ size: C.size
3306
3327
  }));
3307
3328
  }
3308
- function m(E) {
3309
- if (!E) return;
3310
- const M = Array.from(E);
3311
- for (const I of M) {
3329
+ function y(C) {
3330
+ if (!C) return;
3331
+ const _ = Array.from(C);
3332
+ for (const R of _) {
3312
3333
  if (e.value.length >= r) break;
3313
- I.size > o || k(I);
3334
+ R.size > o || m(R);
3314
3335
  }
3315
3336
  }
3316
- function S(E) {
3317
- var M;
3318
- return Array.from(((M = E.dataTransfer) == null ? void 0 : M.types) || []).includes("Files");
3337
+ function S(C) {
3338
+ var _;
3339
+ return Array.from(((_ = C.dataTransfer) == null ? void 0 : _.types) || []).includes("Files");
3319
3340
  }
3320
- function C(E) {
3321
- S(E) && (s.value += 1, t.value = !0);
3341
+ function E(C) {
3342
+ S(C) && (s.value += 1, t.value = !0);
3322
3343
  }
3323
- function T(E) {
3324
- S(E) || E.preventDefault();
3344
+ function T(C) {
3345
+ S(C) || C.preventDefault();
3325
3346
  }
3326
- function _(E) {
3327
- S(E) && (s.value = Math.max(0, s.value - 1), s.value === 0 && (t.value = !1));
3347
+ function z(C) {
3348
+ S(C) && (s.value = Math.max(0, s.value - 1), s.value === 0 && (t.value = !1));
3328
3349
  }
3329
- function F(E) {
3330
- var M;
3331
- S(E) && (s.value = 0, t.value = !1, m(((M = E.dataTransfer) == null ? void 0 : M.files) || null));
3350
+ function U(C) {
3351
+ var _;
3352
+ S(C) && (s.value = 0, t.value = !1, y(((_ = C.dataTransfer) == null ? void 0 : _.files) || null));
3332
3353
  }
3333
- function V(E) {
3334
- const M = E.target, I = M.files;
3335
- I && I.length && m(I), M.value = "";
3354
+ function J(C) {
3355
+ const _ = C.target, R = _.files;
3356
+ R && R.length && y(R), _.value = "";
3336
3357
  }
3337
3358
  return Us(() => {
3338
3359
  A();
@@ -3343,66 +3364,66 @@ function Io() {
3343
3364
  // Computed
3344
3365
  hasAttachments: a,
3345
3366
  isUploading: u,
3346
- canAddMore: c,
3367
+ canAddMore: d,
3347
3368
  acceptedFileTypes: i,
3348
3369
  // Utils
3349
- isImage: d,
3350
- formatFileSize: f,
3370
+ isImage: c,
3371
+ formatFileSize: g,
3351
3372
  // Actions
3352
3373
  removeAttachment: p,
3353
3374
  clearAttachments: A,
3354
- buildPayload: x,
3355
- processFiles: m,
3356
- handleFileSelect: V,
3375
+ buildPayload: k,
3376
+ processFiles: y,
3377
+ handleFileSelect: J,
3357
3378
  // Drag & Drop
3358
- handleDragEnter: C,
3379
+ handleDragEnter: E,
3359
3380
  handleDragOver: T,
3360
- handleDragLeave: _,
3361
- handleDrop: F
3381
+ handleDragLeave: z,
3382
+ handleDrop: U
3362
3383
  };
3363
3384
  }
3364
3385
  function $o(n, e, t) {
3365
3386
  const s = q(!1), r = q([]), o = q(0), i = q({ inMention: !1, query: "", startPos: 0 }), a = q([]), u = N(() => {
3366
- const A = J();
3387
+ const A = te();
3367
3388
  return (A == null ? void 0 : A.mentionProviders) || [];
3368
3389
  });
3369
- function c(A) {
3370
- const x = t();
3371
- if (!x) return;
3372
- const m = x.selectionStart, S = us(A, m);
3373
- i.value = S, S.inMention && S.query.length >= 0 ? d(S.query) : (s.value = !1, r.value = []);
3374
- }
3375
- async function d(A) {
3376
- const x = hs();
3377
- if (x.length === 0) {
3390
+ function d(A) {
3391
+ const k = t();
3392
+ if (!k) return;
3393
+ const y = k.selectionStart, S = us(A, y);
3394
+ i.value = S, S.inMention && S.query.length >= 0 ? c(S.query) : (s.value = !1, r.value = []);
3395
+ }
3396
+ async function c(A) {
3397
+ const k = hs();
3398
+ if (k.length === 0) {
3378
3399
  s.value = !1;
3379
3400
  return;
3380
3401
  }
3381
- const m = [];
3382
- for (const S of x)
3402
+ const y = [];
3403
+ for (const S of k)
3383
3404
  try {
3384
- const C = await S.search(A);
3385
- m.push(...C.map((T) => ({ ...T, type: S.type })));
3386
- } catch (C) {
3387
- console.warn(`Mention provider ${S.type} failed:`, C);
3405
+ const E = await S.search(A);
3406
+ y.push(...E.map((T) => ({ ...T, type: S.type })));
3407
+ } catch (E) {
3408
+ console.warn(`Mention provider ${S.type} failed:`, E);
3388
3409
  }
3389
- r.value = m.slice(0, 10), s.value = m.length > 0, o.value = 0;
3410
+ r.value = y.slice(0, 10), s.value = y.length > 0, o.value = 0;
3390
3411
  }
3391
- function f(A) {
3392
- const { startPos: x } = i.value, m = n(), S = t(), C = m.slice(0, x), T = m.slice((S == null ? void 0 : S.selectionStart) || x), _ = A.name || A.label || A.title || A.id;
3393
- e(`${C}@${_} ${T}`), a.value.push({
3412
+ function g(A) {
3413
+ const { startPos: k } = i.value, y = n(), S = t(), E = y.slice(0, k), T = y.slice((S == null ? void 0 : S.selectionStart) || k), z = A.name || A.label || A.title || A.id;
3414
+ e(`${E}@${z} ${T}`), a.value.push({
3394
3415
  id: A.id,
3395
- name: _,
3416
+ name: z,
3396
3417
  type: A.type,
3397
3418
  metadata: A.attributes
3398
3419
  }), s.value = !1, r.value = [], setTimeout(() => {
3399
- const F = t();
3400
- F == null || F.focus();
3401
- const V = C.length + _.length + 2;
3402
- F == null || F.setSelectionRange(V, V);
3420
+ const U = t();
3421
+ U == null || U.focus();
3422
+ const J = E.length + z.length + 2;
3423
+ U == null || U.setSelectionRange(J, J);
3403
3424
  }, 0);
3404
3425
  }
3405
- function k(A) {
3426
+ function m(A) {
3406
3427
  if (!s.value || r.value.length === 0)
3407
3428
  return !1;
3408
3429
  if (A.key === "ArrowDown")
@@ -3411,12 +3432,12 @@ function $o(n, e, t) {
3411
3432
  return A.preventDefault(), o.value = Math.max(o.value - 1, 0), !0;
3412
3433
  if (A.key === "Enter" || A.key === "Tab") {
3413
3434
  A.preventDefault();
3414
- const x = r.value[o.value];
3415
- return x && f(x), !0;
3435
+ const k = r.value[o.value];
3436
+ return k && g(k), !0;
3416
3437
  }
3417
3438
  return A.key === "Escape" ? (A.preventDefault(), s.value = !1, !0) : !1;
3418
3439
  }
3419
- function g() {
3440
+ function f() {
3420
3441
  a.value = [];
3421
3442
  }
3422
3443
  function p() {
@@ -3429,10 +3450,10 @@ function $o(n, e, t) {
3429
3450
  selectedMentionIndex: o,
3430
3451
  mentionProviders: u,
3431
3452
  // Actions
3432
- checkForMentions: c,
3433
- handleMentionSelect: f,
3434
- handleMentionKeyDown: k,
3435
- clearMentions: g,
3453
+ checkForMentions: d,
3454
+ handleMentionSelect: g,
3455
+ handleMentionKeyDown: m,
3456
+ clearMentions: f,
3436
3457
  getMentions: p
3437
3458
  };
3438
3459
  }
@@ -3440,45 +3461,45 @@ function Do(n, e, t, s, r) {
3440
3461
  const o = q(!1), i = q(-1), a = q(null);
3441
3462
  function u() {
3442
3463
  setTimeout(() => {
3443
- const g = a.value;
3444
- if (!g) return;
3445
- const p = g.querySelector(`li:nth-child(${i.value + 1})`);
3464
+ const f = a.value;
3465
+ if (!f) return;
3466
+ const p = f.querySelector(`li:nth-child(${i.value + 1})`);
3446
3467
  p && p.scrollIntoView({ block: "nearest", behavior: "smooth" });
3447
3468
  }, 0);
3448
3469
  }
3449
- function c(g) {
3470
+ function d(f) {
3450
3471
  const p = n();
3451
3472
  if (!o.value || p.length === 0)
3452
3473
  return !1;
3453
- if (g.key === "ArrowDown")
3454
- return g.preventDefault(), i.value = Math.min(i.value + 1, p.length - 1), u(), !0;
3455
- if (g.key === "ArrowUp")
3456
- return g.preventDefault(), i.value = Math.max(i.value - 1, 0), u(), !0;
3457
- if (g.key === "Enter" && i.value >= 0) {
3458
- g.preventDefault();
3474
+ if (f.key === "ArrowDown")
3475
+ return f.preventDefault(), i.value = Math.min(i.value + 1, p.length - 1), u(), !0;
3476
+ if (f.key === "ArrowUp")
3477
+ return f.preventDefault(), i.value = Math.max(i.value - 1, 0), u(), !0;
3478
+ if (f.key === "Enter" && i.value >= 0) {
3479
+ f.preventDefault();
3459
3480
  const A = p[i.value];
3460
- return A && d(A), !0;
3481
+ return A && c(A), !0;
3461
3482
  }
3462
- return g.key === "Escape" ? (g.preventDefault(), o.value = !1, i.value = -1, !0) : !1;
3483
+ return f.key === "Escape" ? (f.preventDefault(), o.value = !1, i.value = -1, !0) : !1;
3463
3484
  }
3464
- function d(g) {
3465
- r(g), o.value = !1, i.value = -1;
3485
+ function c(f) {
3486
+ r(f), o.value = !1, i.value = -1;
3466
3487
  }
3467
- function f() {
3468
- const g = s(), p = e(), A = t(), x = n();
3469
- g && !p && A && x.length > 0 ? o.value = !0 : o.value = !1;
3488
+ function g() {
3489
+ const f = s(), p = e(), A = t(), k = n();
3490
+ f && !p && A && k.length > 0 ? o.value = !0 : o.value = !1;
3470
3491
  }
3471
- function k() {
3492
+ function m() {
3472
3493
  o.value = !1, i.value = -1;
3473
3494
  }
3474
3495
  return {
3475
3496
  showSuggestions: o,
3476
3497
  selectedSuggestionIndex: i,
3477
3498
  dropdownRef: a,
3478
- handleSuggestionKeyDown: c,
3479
- handleSuggestionClick: d,
3480
- updateSuggestionsVisibility: f,
3481
- hideSuggestions: k
3499
+ handleSuggestionKeyDown: d,
3500
+ handleSuggestionClick: c,
3501
+ updateSuggestionsVisibility: g,
3502
+ hideSuggestions: m
3482
3503
  };
3483
3504
  }
3484
3505
  function Oo(n, e = 300) {
@@ -3495,7 +3516,7 @@ function Oo(n, e = 300) {
3495
3516
  adjustTextareaHeight: t
3496
3517
  };
3497
3518
  }
3498
- const No = /* @__PURE__ */ de({
3519
+ const No = /* @__PURE__ */ he({
3499
3520
  __name: "AiAvatar",
3500
3521
  props: {
3501
3522
  ui: {}
@@ -3503,13 +3524,13 @@ const No = /* @__PURE__ */ de({
3503
3524
  setup(n) {
3504
3525
  return (e, t) => {
3505
3526
  var s;
3506
- return y(), v("div", {
3527
+ return x(), v("div", {
3507
3528
  class: b(["w-6 h-6 min-w-[24px] flex items-center justify-center rounded-full border border-gray-300 dark:border-gray-600", (s = n.ui) == null ? void 0 : s.container])
3508
3529
  }, [
3509
- ue(e.$slots, "default", {}, () => {
3530
+ ce(e.$slots, "default", {}, () => {
3510
3531
  var r;
3511
3532
  return [
3512
- (y(), v("svg", {
3533
+ (x(), v("svg", {
3513
3534
  class: b(["w-4 h-4 text-gray-400 dark:text-gray-500", (r = n.ui) == null ? void 0 : r.icon]),
3514
3535
  fill: "none",
3515
3536
  viewBox: "0 0 24 24",
@@ -3527,7 +3548,7 @@ const No = /* @__PURE__ */ de({
3527
3548
  ], 2);
3528
3549
  };
3529
3550
  }
3530
- }), $a = /* @__PURE__ */ de({
3551
+ }), $a = /* @__PURE__ */ he({
3531
3552
  __name: "UserAvatar",
3532
3553
  props: {
3533
3554
  ui: {}
@@ -3535,13 +3556,13 @@ const No = /* @__PURE__ */ de({
3535
3556
  setup(n) {
3536
3557
  return (e, t) => {
3537
3558
  var s;
3538
- return y(), v("div", {
3559
+ return x(), v("div", {
3539
3560
  class: b(["w-8 h-8 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center flex-shrink-0", (s = n.ui) == null ? void 0 : s.container])
3540
3561
  }, [
3541
- ue(e.$slots, "default", {}, () => {
3562
+ ce(e.$slots, "default", {}, () => {
3542
3563
  var r;
3543
3564
  return [
3544
- (y(), v("svg", {
3565
+ (x(), v("svg", {
3545
3566
  xmlns: "http://www.w3.org/2000/svg",
3546
3567
  viewBox: "0 0 24 24",
3547
3568
  fill: "currentColor",
@@ -3558,7 +3579,7 @@ const No = /* @__PURE__ */ de({
3558
3579
  ], 2);
3559
3580
  };
3560
3581
  }
3561
- }), Po = ["onClick", "onMouseenter"], _o = /* @__PURE__ */ de({
3582
+ }), Po = ["onClick", "onMouseenter"], _o = /* @__PURE__ */ he({
3562
3583
  __name: "MentionList",
3563
3584
  props: {
3564
3585
  items: {},
@@ -3570,110 +3591,110 @@ const No = /* @__PURE__ */ de({
3570
3591
  emits: ["select", "update:selectedIndex"],
3571
3592
  setup(n, { emit: e }) {
3572
3593
  const t = n, s = N(() => t.ui || {}), r = e, o = q(t.selectedIndex);
3573
- Ne(() => t.selectedIndex, (x) => {
3574
- o.value = x;
3575
- }), Ne(o, (x) => {
3576
- r("update:selectedIndex", x);
3594
+ _e(() => t.selectedIndex, (k) => {
3595
+ o.value = k;
3596
+ }), _e(o, (k) => {
3597
+ r("update:selectedIndex", k);
3577
3598
  });
3578
3599
  const i = N(() => {
3579
- const x = {};
3580
- return t.items.forEach((m) => {
3581
- const S = m.type || "default";
3582
- x[S] || (x[S] = []), x[S].push(m);
3583
- }), x;
3600
+ const k = {};
3601
+ return t.items.forEach((y) => {
3602
+ const S = y.type || "default";
3603
+ k[S] || (k[S] = []), k[S].push(y);
3604
+ }), k;
3584
3605
  });
3585
- function a(x) {
3586
- return t.providers.find((m) => m.type === x) || ds(x);
3606
+ function a(k) {
3607
+ return t.providers.find((y) => y.type === k) || ds(k);
3587
3608
  }
3588
- function u(x) {
3589
- const m = a(x);
3590
- return (m == null ? void 0 : m.label) || x.charAt(0).toUpperCase() + x.slice(1) + "s";
3609
+ function u(k) {
3610
+ const y = a(k);
3611
+ return (y == null ? void 0 : y.label) || k.charAt(0).toUpperCase() + k.slice(1) + "s";
3591
3612
  }
3592
- function c(x, m) {
3613
+ function d(k, y) {
3593
3614
  let S = 0;
3594
- const C = Object.keys(i.value);
3595
- for (const T of C) {
3596
- if (T === x)
3597
- return S + m;
3615
+ const E = Object.keys(i.value);
3616
+ for (const T of E) {
3617
+ if (T === k)
3618
+ return S + y;
3598
3619
  S += i.value[T].length;
3599
3620
  }
3600
3621
  return S;
3601
3622
  }
3602
- function d(x) {
3603
- r("select", x);
3623
+ function c(k) {
3624
+ r("select", k);
3604
3625
  }
3605
- function f(x) {
3606
- o.value = x, r("update:selectedIndex", x);
3626
+ function g(k) {
3627
+ o.value = k, r("update:selectedIndex", k);
3607
3628
  }
3608
- function k(x) {
3609
- const m = a(x.type);
3610
- return dn(x, m);
3629
+ function m(k) {
3630
+ const y = a(k.type);
3631
+ return dn(k, y);
3611
3632
  }
3612
- function g(x) {
3613
- const m = a(x.type);
3614
- return cs(x, m);
3633
+ function f(k) {
3634
+ const y = a(k.type);
3635
+ return cs(k, y);
3615
3636
  }
3616
- function p(x) {
3617
- const m = {
3637
+ function p(k) {
3638
+ const y = {
3618
3639
  employee: "bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400",
3619
3640
  job: "bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400",
3620
3641
  candidate: "bg-purple-100 dark:bg-purple-900/30 text-purple-600 dark:text-purple-400",
3621
3642
  project: "bg-orange-100 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400",
3622
3643
  default: "bg-primary/10 text-primary"
3623
3644
  };
3624
- return m[x] || m.default;
3645
+ return y[k] || y.default;
3625
3646
  }
3626
- function A(x) {
3627
- return x.split(" ").map((m) => m[0]).join("").slice(0, 2).toUpperCase();
3647
+ function A(k) {
3648
+ return k.split(" ").map((y) => y[0]).join("").slice(0, 2).toUpperCase();
3628
3649
  }
3629
- return (x, m) => n.items.length > 0 ? (y(), v("div", {
3650
+ return (k, y) => n.items.length > 0 ? (x(), v("div", {
3630
3651
  key: 0,
3631
3652
  class: b(["absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-lg max-h-60 overflow-y-auto z-50", s.value.root])
3632
3653
  }, [
3633
3654
  h("div", {
3634
3655
  class: b(["p-2", s.value.container])
3635
3656
  }, [
3636
- (y(!0), v(we, null, ze(i.value, (S, C) => (y(), v(we, { key: C }, [
3637
- Object.keys(i.value).length > 1 ? (y(), v("div", {
3657
+ (x(!0), v(be, null, Fe(i.value, (S, E) => (x(), v(be, { key: E }, [
3658
+ Object.keys(i.value).length > 1 ? (x(), v("div", {
3638
3659
  key: 0,
3639
3660
  class: b(["px-3 py-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wide", s.value.groupHeader])
3640
- }, P(u(C)), 3)) : B("", !0),
3641
- (y(!0), v(we, null, ze(S, (T, _) => (y(), v("button", {
3661
+ }, P(u(E)), 3)) : F("", !0),
3662
+ (x(!0), v(be, null, Fe(S, (T, z) => (x(), v("button", {
3642
3663
  key: T.id,
3643
3664
  type: "button",
3644
3665
  class: b(["w-full flex items-center gap-3 px-3 py-2 rounded-lg text-left transition-colors mb-0.5", [
3645
3666
  s.value.item,
3646
3667
  {
3647
- [s.value.itemSelected || "bg-primary/10"]: c(C, _) === o.value,
3648
- "hover:bg-gray-50 dark:hover:bg-gray-700": c(C, _) !== o.value
3668
+ [s.value.itemSelected || "bg-primary/10"]: d(E, z) === o.value,
3669
+ "hover:bg-gray-50 dark:hover:bg-gray-700": d(E, z) !== o.value
3649
3670
  }
3650
3671
  ]]),
3651
- onClick: (F) => d(T),
3652
- onMouseenter: (F) => f(c(C, _))
3672
+ onClick: (U) => c(T),
3673
+ onMouseenter: (U) => g(d(E, z))
3653
3674
  }, [
3654
- ue(x.$slots, "item-icon", {
3675
+ ce(k.$slots, "item-icon", {
3655
3676
  item: T,
3656
- type: C
3677
+ type: E
3657
3678
  }, () => [
3658
3679
  h("span", {
3659
3680
  class: b(["w-8 h-8 flex items-center justify-center rounded-full text-xs font-semibold flex-shrink-0", [s.value.itemIcon, p(T.type)]])
3660
- }, P(A(k(T))), 3)
3681
+ }, P(A(m(T))), 3)
3661
3682
  ]),
3662
3683
  h("div", {
3663
3684
  class: b(["flex-1 min-w-0", s.value.itemContent])
3664
3685
  }, [
3665
3686
  h("p", {
3666
3687
  class: b(["text-sm font-medium text-gray-900 dark:text-gray-100 truncate", s.value.itemName])
3667
- }, P(k(T)), 3),
3668
- g(T) ? (y(), v("p", {
3688
+ }, P(m(T)), 3),
3689
+ f(T) ? (x(), v("p", {
3669
3690
  key: 0,
3670
3691
  class: b(["text-xs text-gray-500 dark:text-gray-400 truncate", s.value.itemSubtitle])
3671
- }, P(g(T)), 3)) : B("", !0)
3692
+ }, P(f(T)), 3)) : F("", !0)
3672
3693
  ], 2)
3673
3694
  ], 42, Po))), 128))
3674
3695
  ], 64))), 128))
3675
3696
  ], 2)
3676
- ], 2)) : B("", !0);
3697
+ ], 2)) : F("", !0);
3677
3698
  }
3678
3699
  }), zo = ["title"], Ho = {
3679
3700
  key: 0,
@@ -3681,7 +3702,7 @@ const No = /* @__PURE__ */ de({
3681
3702
  fill: "none",
3682
3703
  viewBox: "0 0 24 24",
3683
3704
  stroke: "currentColor"
3684
- }, Bo = /* @__PURE__ */ de({
3705
+ }, Bo = /* @__PURE__ */ he({
3685
3706
  __name: "ChatMessageActions",
3686
3707
  props: {
3687
3708
  message: {},
@@ -3691,8 +3712,8 @@ const No = /* @__PURE__ */ de({
3691
3712
  emits: ["copy"],
3692
3713
  setup(n, { emit: e }) {
3693
3714
  const t = n, s = e, r = (u) => {
3694
- var d;
3695
- return (d = t.texts) != null && d[u] ? t.texts[u] : ce({
3715
+ var c;
3716
+ return (c = t.texts) != null && c[u] ? t.texts[u] : de({
3696
3717
  copyToClipboard: "copyToClipboard",
3697
3718
  copied: "copied"
3698
3719
  }[u]);
@@ -3706,7 +3727,7 @@ const No = /* @__PURE__ */ de({
3706
3727
  console.error("Failed to copy:", u);
3707
3728
  }
3708
3729
  }
3709
- return (u, c) => (y(), v("div", {
3730
+ return (u, d) => (x(), v("div", {
3710
3731
  class: b(["flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity", o.value.container])
3711
3732
  }, [
3712
3733
  h("button", {
@@ -3715,20 +3736,20 @@ const No = /* @__PURE__ */ de({
3715
3736
  title: i.value ? r("copied") : r("copyToClipboard"),
3716
3737
  onClick: a
3717
3738
  }, [
3718
- i.value ? (y(), v("svg", {
3739
+ i.value ? (x(), v("svg", {
3719
3740
  key: 1,
3720
3741
  class: b(["w-4 h-4 text-green-500", o.value.successState]),
3721
3742
  fill: "none",
3722
3743
  viewBox: "0 0 24 24",
3723
3744
  stroke: "currentColor"
3724
- }, [...c[1] || (c[1] = [
3745
+ }, [...d[1] || (d[1] = [
3725
3746
  h("path", {
3726
3747
  "stroke-linecap": "round",
3727
3748
  "stroke-linejoin": "round",
3728
3749
  "stroke-width": "2",
3729
3750
  d: "M5 13l4 4L19 7"
3730
3751
  }, null, -1)
3731
- ])], 2)) : (y(), v("svg", Ho, [...c[0] || (c[0] = [
3752
+ ])], 2)) : (x(), v("svg", Ho, [...d[0] || (d[0] = [
3732
3753
  h("path", {
3733
3754
  "stroke-linecap": "round",
3734
3755
  "stroke-linejoin": "round",
@@ -3753,7 +3774,7 @@ const No = /* @__PURE__ */ de({
3753
3774
  class: "h-4 w-4 text-white",
3754
3775
  viewBox: "0 0 24 24",
3755
3776
  fill: "currentColor"
3756
- }, Zo = { class: "flex-shrink-0 mt-0.5" }, Yo = { class: "text-gray-600 dark:text-gray-400" }, Xo = ["id", "innerHTML"], Jo = { class: "h-12 w-12 flex items-center justify-center rounded-lg bg-white dark:bg-gray-800 overflow-hidden border border-gray-200 dark:border-gray-600" }, ei = ["src"], ti = {
3777
+ }, Zo = { class: "flex-shrink-0 group-hover:opacity-0 transition-opacity" }, Yo = { class: "text-gray-600 dark:text-gray-400" }, Xo = ["id", "innerHTML"], Jo = { class: "h-12 w-12 flex items-center justify-center rounded-lg bg-white dark:bg-gray-800 overflow-hidden border border-gray-200 dark:border-gray-600" }, ei = ["src"], ti = {
3757
3778
  key: 1,
3758
3779
  class: "w-5 h-5 text-gray-500 dark:text-gray-400",
3759
3780
  fill: "none",
@@ -3762,7 +3783,7 @@ const No = /* @__PURE__ */ de({
3762
3783
  }, ni = { class: "flex-1 min-w-0" }, si = { class: "text-sm font-semibold text-gray-800 dark:text-gray-200 truncate" }, ri = { class: "text-xs text-gray-500 dark:text-gray-400" }, oi = {
3763
3784
  key: 0,
3764
3785
  class: "text-xs font-medium text-primary"
3765
- }, ii = /* @__PURE__ */ de({
3786
+ }, ii = /* @__PURE__ */ he({
3766
3787
  __name: "ChatMessage",
3767
3788
  props: {
3768
3789
  message: {},
@@ -3773,50 +3794,50 @@ const No = /* @__PURE__ */ de({
3773
3794
  },
3774
3795
  emits: ["copy"],
3775
3796
  setup(n, { emit: e }) {
3776
- const t = n, s = e, r = (m) => {
3777
- var C;
3778
- return (C = t.texts) != null && C[m] ? t.texts[m] : {
3797
+ const t = n, s = e, r = (y) => {
3798
+ var E;
3799
+ return (E = t.texts) != null && E[y] ? t.texts[y] : {
3779
3800
  loadingText: "Gathering data...",
3780
3801
  showMore: "Show more",
3781
3802
  showLess: "Show less",
3782
3803
  openAttachment: "Open",
3783
3804
  attachment: "Attachment"
3784
- }[m] || m;
3785
- }, o = N(() => t.ui || {}), { parseMarkdown: i } = bo(), a = q(!1), u = N(() => t.message.attachments ?? []), c = N(() => u.value.length > 0), d = N(() => {
3805
+ }[y] || y;
3806
+ }, o = N(() => t.ui || {}), { parseMarkdown: i } = bo(), a = q(!1), u = N(() => t.message.attachments ?? []), d = N(() => u.value.length > 0), c = N(() => {
3786
3807
  if (t.message.role !== "user") return !1;
3787
- const m = t.message.message || "", S = m.split(`
3808
+ const y = t.message.message || "", S = y.split(`
3788
3809
  `).length;
3789
- return m.length > 200 || S > 4;
3810
+ return y.length > 200 || S > 4;
3790
3811
  });
3791
- function f() {
3812
+ function g() {
3792
3813
  a.value = !a.value;
3793
3814
  }
3794
- function k(m) {
3795
- return (m.type || "").startsWith("image/") ? !0 : /(png|jpe?g|gif|webp)$/i.test(m.name || "");
3815
+ function m(y) {
3816
+ return (y.type || "").startsWith("image/") ? !0 : /(png|jpe?g|gif|webp)$/i.test(y.name || "");
3796
3817
  }
3797
- const g = N(() => {
3798
- const m = J();
3799
- return m != null && m.userAvatar ? typeof m.userAvatar == "string" ? m.userAvatar : typeof m.userAvatar == "function" ? m.userAvatar() : null : null;
3818
+ const f = N(() => {
3819
+ const y = te();
3820
+ return y != null && y.userAvatar ? typeof y.userAvatar == "string" ? y.userAvatar : typeof y.userAvatar == "function" ? y.userAvatar() : null : null;
3800
3821
  });
3801
- function p(m) {
3802
- if (m == null) return "";
3803
- const S = typeof m == "string" ? parseInt(m, 10) : m;
3822
+ function p(y) {
3823
+ if (y == null) return "";
3824
+ const S = typeof y == "string" ? parseInt(y, 10) : y;
3804
3825
  return Number.isNaN(S) ? "" : S >= 1024 * 1024 ? `${(S / (1024 * 1024)).toFixed(1)} MB` : S >= 1024 ? `${Math.round(S / 1024)} KB` : `${S} B`;
3805
3826
  }
3806
3827
  const A = N(() => {
3807
3828
  if (t.message.role === "assistant") {
3808
- let m = t.message.message;
3809
- return m = m.replace(/\\n/g, `
3810
- `), i(m);
3829
+ let y = t.message.message;
3830
+ return y = y.replace(/\\n/g, `
3831
+ `), i(y);
3811
3832
  }
3812
3833
  return t.message.message;
3813
3834
  });
3814
- function x(m) {
3815
- s("copy", m);
3835
+ function k(y) {
3836
+ s("copy", y);
3816
3837
  }
3817
- return (m, S) => {
3818
- var C;
3819
- return y(), v("div", {
3838
+ return (y, S) => {
3839
+ var E;
3840
+ return x(), v("div", {
3820
3841
  class: b(["group relative animate-in fade-in slide-in-from-bottom-2 duration-300", [
3821
3842
  o.value.root,
3822
3843
  {
@@ -3825,27 +3846,27 @@ const No = /* @__PURE__ */ de({
3825
3846
  }
3826
3847
  ]])
3827
3848
  }, [
3828
- n.message.role === "user" ? (y(), v("div", {
3849
+ n.message.role === "user" ? (x(), v("div", {
3829
3850
  key: 0,
3830
3851
  class: b(["flex gap-3 justify-end", o.value.userMessage])
3831
3852
  }, [
3832
3853
  h("div", {
3833
3854
  class: b(["rounded-2xl px-4 py-3 bg-primary-500 text-white max-w-fit", o.value.userBubble])
3834
3855
  }, [
3835
- n.message.message ? (y(), v("p", {
3856
+ n.message.message ? (x(), v("p", {
3836
3857
  key: 0,
3837
- class: b(["text-sm whitespace-pre-wrap", [o.value.content, { "line-clamp-4": !a.value && d.value }]])
3838
- }, P(n.message.message), 3)) : B("", !0),
3839
- d.value ? (y(), v("button", {
3858
+ class: b(["text-sm whitespace-pre-wrap", [o.value.content, { "line-clamp-4": !a.value && c.value }]])
3859
+ }, P(n.message.message), 3)) : F("", !0),
3860
+ c.value ? (x(), v("button", {
3840
3861
  key: 1,
3841
3862
  class: b(["mt-2 text-xs text-white/80 hover:text-white underline", o.value.showMoreButton]),
3842
- onClick: f
3843
- }, P(a.value ? r("showLess") : r("showMore")), 3)) : B("", !0),
3844
- c.value ? (y(), v("div", {
3863
+ onClick: g
3864
+ }, P(a.value ? r("showLess") : r("showMore")), 3)) : F("", !0),
3865
+ d.value ? (x(), v("div", {
3845
3866
  key: 2,
3846
3867
  class: b(["mt-3 space-y-2", o.value.attachmentsContainer])
3847
3868
  }, [
3848
- (y(!0), v(we, null, ze(u.value, (T) => (y(), Ee(nn(T.url ? "a" : "div"), {
3869
+ (x(!0), v(be, null, Fe(u.value, (T) => (x(), Ee(nn(T.url ? "a" : "div"), {
3849
3870
  key: T.id,
3850
3871
  href: T.url || void 0,
3851
3872
  target: T.url ? "_blank" : void 0,
@@ -3854,12 +3875,12 @@ const No = /* @__PURE__ */ de({
3854
3875
  }, {
3855
3876
  default: Ae(() => [
3856
3877
  h("div", Fo, [
3857
- T.url && k(T) ? (y(), v("img", {
3878
+ T.url && m(T) ? (x(), v("img", {
3858
3879
  key: 0,
3859
3880
  src: T.url,
3860
3881
  class: "object-cover h-full w-full",
3861
3882
  alt: ""
3862
- }, null, 8, Uo)) : (y(), v("svg", qo, [...S[0] || (S[0] = [
3883
+ }, null, 8, Uo)) : (x(), v("svg", qo, [...S[0] || (S[0] = [
3863
3884
  h("path", {
3864
3885
  "stroke-linecap": "round",
3865
3886
  "stroke-linejoin": "round",
@@ -3872,21 +3893,21 @@ const No = /* @__PURE__ */ de({
3872
3893
  h("p", Wo, P(T.name || r("attachment")), 1),
3873
3894
  h("p", Ko, P(p(T.size)), 1)
3874
3895
  ]),
3875
- T.url ? (y(), v("span", Vo, P(r("openAttachment")), 1)) : B("", !0)
3896
+ T.url ? (x(), v("span", Vo, P(r("openAttachment")), 1)) : F("", !0)
3876
3897
  ]),
3877
3898
  _: 2
3878
3899
  }, 1032, ["href", "target", "class"]))), 128))
3879
- ], 2)) : B("", !0)
3900
+ ], 2)) : F("", !0)
3880
3901
  ], 2),
3881
3902
  h("div", {
3882
3903
  class: b(["flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary-500 overflow-hidden", o.value.userAvatar])
3883
3904
  }, [
3884
- g.value ? (y(), v("img", {
3905
+ f.value ? (x(), v("img", {
3885
3906
  key: 0,
3886
- src: g.value,
3907
+ src: f.value,
3887
3908
  alt: "User",
3888
3909
  class: "h-full w-full object-cover"
3889
- }, null, 8, Go)) : (y(), v("svg", Qo, [...S[1] || (S[1] = [
3910
+ }, null, 8, Go)) : (x(), v("svg", Qo, [...S[1] || (S[1] = [
3890
3911
  h("path", {
3891
3912
  "fill-rule": "evenodd",
3892
3913
  d: "M7.5 6a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM3.751 20.105a8.25 8.25 0 0 1 16.498 0 .75.75 0 0 1-.437.695A18.683 18.683 0 0 1 12 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 0 1-.437-.695Z",
@@ -3894,17 +3915,17 @@ const No = /* @__PURE__ */ de({
3894
3915
  }, null, -1)
3895
3916
  ])]))
3896
3917
  ], 2)
3897
- ], 2)) : (y(), v("div", {
3918
+ ], 2)) : (x(), v("div", {
3898
3919
  key: 1,
3899
3920
  class: b(["flex items-start gap-3", o.value.assistantMessage])
3900
3921
  }, [
3901
3922
  h("div", Zo, [
3902
- me(No)
3923
+ ye(No)
3903
3924
  ]),
3904
3925
  h("div", {
3905
- class: b(["bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 px-5 py-4 shadow-sm rounded-2xl transition-all duration-200 flex-1", o.value.assistantBubble])
3926
+ class: b(["bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 px-4 py-3 shadow-sm rounded-2xl transition-all duration-200 max-w-[85%]", o.value.assistantBubble])
3906
3927
  }, [
3907
- n.message.loading ? (y(), v("div", {
3928
+ n.message.loading ? (x(), v("div", {
3908
3929
  key: 0,
3909
3930
  class: b(["flex items-center gap-2 text-sm min-w-[150px]", o.value.loadingIndicator])
3910
3931
  }, [
@@ -3924,18 +3945,18 @@ const No = /* @__PURE__ */ de({
3924
3945
  style: { "animation-delay": "300ms" }
3925
3946
  }, null, -1)
3926
3947
  ])], 2),
3927
- h("span", Yo, P(((C = n.texts) == null ? void 0 : C.loadingText) || n.loadingText), 1)
3928
- ], 2)) : n.message.message ? (y(), v("div", {
3948
+ h("span", Yo, P(((E = n.texts) == null ? void 0 : E.loadingText) || n.loadingText), 1)
3949
+ ], 2)) : n.message.message ? (x(), v("div", {
3929
3950
  key: 1,
3930
3951
  id: n.message.id,
3931
- class: b(["prose prose-sm max-w-none prose-gray dark:prose-invert", o.value.content]),
3952
+ class: b(["text-sm text-gray-700 dark:text-gray-200 leading-relaxed", o.value.content]),
3932
3953
  innerHTML: A.value
3933
- }, null, 10, Xo)) : B("", !0),
3934
- !n.message.loading && c.value ? (y(), v("div", {
3954
+ }, null, 10, Xo)) : F("", !0),
3955
+ !n.message.loading && d.value ? (x(), v("div", {
3935
3956
  key: 2,
3936
3957
  class: b(["mt-4 space-y-2", o.value.attachmentsContainer])
3937
3958
  }, [
3938
- (y(!0), v(we, null, ze(u.value, (T) => (y(), Ee(nn(T.url ? "a" : "div"), {
3959
+ (x(!0), v(be, null, Fe(u.value, (T) => (x(), Ee(nn(T.url ? "a" : "div"), {
3939
3960
  key: T.id,
3940
3961
  href: T.url || void 0,
3941
3962
  target: T.url ? "_blank" : void 0,
@@ -3944,12 +3965,12 @@ const No = /* @__PURE__ */ de({
3944
3965
  }, {
3945
3966
  default: Ae(() => [
3946
3967
  h("div", Jo, [
3947
- T.url && k(T) ? (y(), v("img", {
3968
+ T.url && m(T) ? (x(), v("img", {
3948
3969
  key: 0,
3949
3970
  src: T.url,
3950
3971
  class: "object-cover h-full w-full",
3951
3972
  alt: ""
3952
- }, null, 8, ei)) : (y(), v("svg", ti, [...S[3] || (S[3] = [
3973
+ }, null, 8, ei)) : (x(), v("svg", ti, [...S[3] || (S[3] = [
3953
3974
  h("path", {
3954
3975
  "stroke-linecap": "round",
3955
3976
  "stroke-linejoin": "round",
@@ -3962,19 +3983,19 @@ const No = /* @__PURE__ */ de({
3962
3983
  h("p", si, P(T.name || r("attachment")), 1),
3963
3984
  h("p", ri, P(p(T.size)), 1)
3964
3985
  ]),
3965
- T.url ? (y(), v("span", oi, P(r("openAttachment")), 1)) : B("", !0)
3986
+ T.url ? (x(), v("span", oi, P(r("openAttachment")), 1)) : F("", !0)
3966
3987
  ]),
3967
3988
  _: 2
3968
3989
  }, 1032, ["href", "target", "class"]))), 128))
3969
- ], 2)) : B("", !0)
3990
+ ], 2)) : F("", !0)
3970
3991
  ], 2)
3971
3992
  ], 2)),
3972
- n.message.role === "assistant" && !n.message.loading && !n.message.streaming && n.showActions ? (y(), Ee(Bo, {
3993
+ n.message.role === "assistant" && !n.message.loading && !n.message.streaming && n.showActions ? (x(), Ee(Bo, {
3973
3994
  key: 2,
3974
3995
  message: n.message,
3975
- class: b(["absolute -bottom-8 left-14", o.value.actionsContainer]),
3976
- onCopy: x
3977
- }, null, 8, ["message", "class"])) : B("", !0)
3996
+ class: b(["absolute top-0 left-0", o.value.actionsContainer]),
3997
+ onCopy: k
3998
+ }, null, 8, ["message", "class"])) : F("", !0)
3978
3999
  ], 2);
3979
4000
  };
3980
4001
  }
@@ -3983,19 +4004,19 @@ const No = /* @__PURE__ */ de({
3983
4004
  for (const [s, r] of e)
3984
4005
  t[s] = r;
3985
4006
  return t;
3986
- }, ai = /* @__PURE__ */ Ls(ii, [["__scopeId", "data-v-5f7bccb0"]]), li = { class: "text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wide" }, ui = { class: "space-y-2" }, ci = ["src"], di = {
4007
+ }, ai = /* @__PURE__ */ Ls(ii, [["__scopeId", "data-v-d045bee3"]]), li = { class: "text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wide" }, ui = { class: "space-y-2" }, ci = ["src"], di = {
3987
4008
  key: 1,
3988
4009
  class: "w-5 h-5 text-gray-500 dark:text-gray-400",
3989
4010
  fill: "none",
3990
4011
  viewBox: "0 0 24 24",
3991
4012
  stroke: "currentColor"
3992
- }, hi = { class: "flex-1 min-w-0" }, pi = { class: "text-sm font-medium text-gray-800 dark:text-gray-200 truncate" }, fi = { class: "text-xs text-gray-500 dark:text-gray-400" }, gi = {
4013
+ }, hi = { class: "flex-1 min-w-0" }, fi = { class: "text-sm font-medium text-gray-800 dark:text-gray-200 truncate" }, pi = { class: "text-xs text-gray-500 dark:text-gray-400" }, gi = {
3993
4014
  key: 0,
3994
4015
  class: "mt-1 h-1 bg-gray-200 dark:bg-gray-600 rounded-full overflow-hidden"
3995
4016
  }, mi = {
3996
4017
  key: 0,
3997
4018
  class: "text-xs text-gray-400"
3998
- }, yi = ["disabled", "onClick"], xi = /* @__PURE__ */ de({
4019
+ }, yi = ["disabled", "onClick"], xi = /* @__PURE__ */ he({
3999
4020
  __name: "AttachmentsPreview",
4000
4021
  props: {
4001
4022
  attachments: {},
@@ -4008,24 +4029,24 @@ const No = /* @__PURE__ */ de({
4008
4029
  setup(n) {
4009
4030
  return (e, t) => {
4010
4031
  var s;
4011
- return y(), v("div", {
4032
+ return x(), v("div", {
4012
4033
  class: b(["border border-gray-200 dark:border-gray-700 rounded-2xl p-3 bg-gray-50 dark:bg-gray-800 space-y-3", n.ui.attachmentsContainer])
4013
4034
  }, [
4014
4035
  h("p", li, P(((s = n.texts) == null ? void 0 : s.attachedFiles) || "Attached files"), 1),
4015
4036
  h("ul", ui, [
4016
- (y(!0), v(we, null, ze(n.attachments, (r) => (y(), v("li", {
4037
+ (x(!0), v(be, null, Fe(n.attachments, (r) => (x(), v("li", {
4017
4038
  key: r.id,
4018
4039
  class: b(["flex items-center gap-3 rounded-xl bg-white dark:bg-gray-700 p-2 shadow-sm border border-gray-100 dark:border-gray-600", n.ui.attachmentItem])
4019
4040
  }, [
4020
4041
  h("div", {
4021
4042
  class: b(["h-10 w-10 flex items-center justify-center rounded-lg bg-gray-100 dark:bg-gray-600 overflow-hidden", n.ui.attachmentThumbnail])
4022
4043
  }, [
4023
- n.isImage(r) ? (y(), v("img", {
4044
+ n.isImage(r) ? (x(), v("img", {
4024
4045
  key: 0,
4025
4046
  src: r.previewUrl || r.url,
4026
4047
  class: "object-cover h-full w-full",
4027
4048
  alt: ""
4028
- }, null, 8, ci)) : (y(), v("svg", di, [...t[0] || (t[0] = [
4049
+ }, null, 8, ci)) : (x(), v("svg", di, [...t[0] || (t[0] = [
4029
4050
  h("path", {
4030
4051
  "stroke-linecap": "round",
4031
4052
  "stroke-linejoin": "round",
@@ -4035,16 +4056,16 @@ const No = /* @__PURE__ */ de({
4035
4056
  ])]))
4036
4057
  ], 2),
4037
4058
  h("div", hi, [
4038
- h("p", pi, P(r.name), 1),
4039
- h("p", fi, P(n.formatFileSize(r.size)), 1),
4040
- r.uploading ? (y(), v("div", gi, [
4059
+ h("p", fi, P(r.name), 1),
4060
+ h("p", pi, P(n.formatFileSize(r.size)), 1),
4061
+ r.uploading ? (x(), v("div", gi, [
4041
4062
  h("div", {
4042
4063
  class: "h-full bg-primary transition-all",
4043
4064
  style: cn({ width: `${r.progress ?? 10}%` })
4044
4065
  }, null, 4)
4045
- ])) : B("", !0)
4066
+ ])) : F("", !0)
4046
4067
  ]),
4047
- r.uploading ? (y(), v("span", mi, P(Math.round(r.progress ?? 0)) + "% ", 1)) : B("", !0),
4068
+ r.uploading ? (x(), v("span", mi, P(Math.round(r.progress ?? 0)) + "% ", 1)) : F("", !0),
4048
4069
  h("button", {
4049
4070
  type: "button",
4050
4071
  class: b(["p-1 rounded-full hover:bg-gray-100 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed", n.ui.attachmentRemove]),
@@ -4070,7 +4091,7 @@ const No = /* @__PURE__ */ de({
4070
4091
  ], 2);
4071
4092
  };
4072
4093
  }
4073
- }), ki = { class: "py-1" }, wi = ["onClick", "onMouseenter"], bi = { class: "flex items-start gap-3" }, vi = { class: "flex-1 min-w-0" }, Ti = { class: "text-sm font-medium text-gray-900 dark:text-gray-100" }, Si = { class: "text-xs text-gray-500 dark:text-gray-400 mt-0.5 line-clamp-2" }, Ai = /* @__PURE__ */ de({
4094
+ }), ki = { class: "py-1" }, wi = ["onClick", "onMouseenter"], bi = { class: "flex items-start gap-3" }, vi = { class: "flex-1 min-w-0" }, Ti = { class: "text-sm font-medium text-gray-900 dark:text-gray-100" }, Si = { class: "text-xs text-gray-500 dark:text-gray-400 mt-0.5 line-clamp-2" }, Ai = /* @__PURE__ */ he({
4074
4095
  __name: "SuggestionsDropdown",
4075
4096
  props: {
4076
4097
  suggestions: {},
@@ -4080,7 +4101,7 @@ const No = /* @__PURE__ */ de({
4080
4101
  emits: ["select", "hover"],
4081
4102
  setup(n, { expose: e }) {
4082
4103
  const t = q(null);
4083
- return e({ dropdownRef: t }), (s, r) => (y(), Ee(wt, {
4104
+ return e({ dropdownRef: t }), (s, r) => (x(), Ee(wt, {
4084
4105
  "enter-active-class": "transition ease-out duration-100",
4085
4106
  "enter-from-class": "transform opacity-0 scale-95",
4086
4107
  "enter-to-class": "transform opacity-100 scale-100",
@@ -4095,7 +4116,7 @@ const No = /* @__PURE__ */ de({
4095
4116
  class: b(["absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-lg max-h-80 overflow-y-auto z-10", n.ui.suggestionsDropdown])
4096
4117
  }, [
4097
4118
  h("ul", ki, [
4098
- (y(!0), v(we, null, ze(n.suggestions, (o, i) => (y(), v("li", {
4119
+ (x(!0), v(be, null, Fe(n.suggestions, (o, i) => (x(), v("li", {
4099
4120
  key: o.id,
4100
4121
  class: b(["px-4 py-3 cursor-pointer transition-colors border-b border-gray-100 dark:border-gray-700 last:border-b-0", [
4101
4122
  n.ui.suggestionItem,
@@ -4131,7 +4152,7 @@ const No = /* @__PURE__ */ de({
4131
4152
  class: "w-4 h-4",
4132
4153
  viewBox: "0 0 24 24",
4133
4154
  fill: "currentColor"
4134
- }, $i = /* @__PURE__ */ de({
4155
+ }, $i = /* @__PURE__ */ he({
4135
4156
  __name: "InputActions",
4136
4157
  props: {
4137
4158
  sending: { type: Boolean },
@@ -4146,8 +4167,8 @@ const No = /* @__PURE__ */ de({
4146
4167
  const e = n, t = N(() => e.sending ? [e.ui.stopButton || "bg-red-500 text-white hover:bg-red-600"] : e.canSend ? [e.ui.sendButtonActive || "bg-primary-500 text-white hover:bg-primary-600"] : [e.ui.sendButtonDisabled || "bg-gray-200 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed opacity-60"]);
4147
4168
  return (s, r) => {
4148
4169
  var o, i, a;
4149
- return y(), v("div", Ci, [
4150
- n.showSupportModeToggle && !n.supportRequestMode ? (y(), v("button", {
4170
+ return x(), v("div", Ci, [
4171
+ n.showSupportModeToggle && !n.supportRequestMode ? (x(), v("button", {
4151
4172
  key: 0,
4152
4173
  type: "button",
4153
4174
  class: b(["h-9 w-9 rounded-xl flex items-center justify-center text-gray-400 hover:text-primary hover:bg-gray-100 dark:hover:bg-gray-700 transition flex-shrink-0", n.ui.supportToggle]),
@@ -4167,8 +4188,8 @@ const No = /* @__PURE__ */ de({
4167
4188
  d: "M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"
4168
4189
  })
4169
4190
  ], -1)
4170
- ])], 10, Ei)) : B("", !0),
4171
- n.showSupportModeToggle && n.supportRequestMode ? (y(), v("button", {
4191
+ ])], 10, Ei)) : F("", !0),
4192
+ n.showSupportModeToggle && n.supportRequestMode ? (x(), v("button", {
4172
4193
  key: 1,
4173
4194
  type: "button",
4174
4195
  class: b(["h-7 px-2 rounded-lg flex items-center gap-1 text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 hover:bg-amber-200 dark:hover:bg-amber-900/50 transition flex-shrink-0", n.ui.supportBadge]),
@@ -4202,20 +4223,20 @@ const No = /* @__PURE__ */ de({
4202
4223
  d: "M6 18L18 6M6 6l12 12"
4203
4224
  })
4204
4225
  ], -1))
4205
- ], 10, Mi)) : B("", !0),
4226
+ ], 10, Mi)) : F("", !0),
4206
4227
  h("button", {
4207
4228
  disabled: !n.canSend && !n.sending,
4208
4229
  class: b(["h-9 w-9 rounded-xl flex items-center justify-center transition-all duration-200 flex-shrink-0", t.value]),
4209
4230
  type: "button",
4210
- onClick: r[2] || (r[2] = Je((u) => s.$emit("click"), ["prevent"]))
4231
+ onClick: r[2] || (r[2] = tt((u) => s.$emit("click"), ["prevent"]))
4211
4232
  }, [
4212
- n.sending ? (y(), v("svg", Ii, [...r[7] || (r[7] = [
4233
+ n.sending ? (x(), v("svg", Ii, [...r[7] || (r[7] = [
4213
4234
  h("path", {
4214
4235
  "fill-rule": "evenodd",
4215
4236
  d: "M4.5 7.5a3 3 0 013-3h9a3 3 0 013 3v9a3 3 0 01-3 3h-9a3 3 0 01-3-3v-9z",
4216
4237
  "clip-rule": "evenodd"
4217
4238
  }, null, -1)
4218
- ])])) : (y(), v("svg", Li, [...r[6] || (r[6] = [
4239
+ ])])) : (x(), v("svg", Li, [...r[6] || (r[6] = [
4219
4240
  h("path", {
4220
4241
  "stroke-linecap": "round",
4221
4242
  "stroke-linejoin": "round",
@@ -4230,7 +4251,7 @@ const No = /* @__PURE__ */ de({
4230
4251
  }), Di = { class: "max-w-3xl mx-auto space-y-3" }, Oi = ["accept"], Ni = ["title"], Pi = { class: "flex items-center" }, _i = ["placeholder", "disabled"], zi = {
4231
4252
  key: 0,
4232
4253
  class: "flex justify-center"
4233
- }, Hi = /* @__PURE__ */ de({
4254
+ }, Hi = /* @__PURE__ */ he({
4234
4255
  __name: "ChatInput",
4235
4256
  props: {
4236
4257
  modelValue: {},
@@ -4248,138 +4269,143 @@ const No = /* @__PURE__ */ de({
4248
4269
  texts: {}
4249
4270
  },
4250
4271
  emits: ["update:modelValue", "submit", "cancel", "suggestion-select", "toggle-support-mode", "context-link-click"],
4251
- setup(n, { emit: e }) {
4252
- const t = n, s = N(() => t.ui || {}), r = e, o = q(t.modelValue), i = q(null), a = q(null), u = q(!1), c = Io(), d = $o(
4253
- () => o.value,
4254
- (M) => {
4255
- o.value = M;
4272
+ setup(n, { expose: e, emit: t }) {
4273
+ const s = n, r = N(() => s.ui || {}), o = t, i = q(s.modelValue), a = q(null), u = q(null), d = q(!1), c = Io(), g = $o(
4274
+ () => i.value,
4275
+ (R) => {
4276
+ i.value = R;
4256
4277
  },
4257
- () => i.value
4258
- ), f = Do(
4259
- () => t.suggestions,
4260
- () => t.hasHistory,
4261
- () => u.value,
4262
- () => o.value,
4263
- (M) => {
4264
- r("suggestion-select", M), Oe(() => {
4265
- var I;
4266
- return (I = i.value) == null ? void 0 : I.focus();
4278
+ () => a.value
4279
+ ), m = Do(
4280
+ () => s.suggestions,
4281
+ () => s.hasHistory,
4282
+ () => d.value,
4283
+ () => i.value,
4284
+ (R) => {
4285
+ o("suggestion-select", R), Pe(() => {
4286
+ var M;
4287
+ return (M = a.value) == null ? void 0 : M.focus();
4267
4288
  });
4268
4289
  }
4269
- ), { adjustTextareaHeight: k } = Oo(() => i.value), g = N(() => t.supportRequestMode ? t.supportPlaceholder : t.placeholder), p = N(() => t.showSupportModeToggle ? t.supportRequestMode ? { paddingLeft: "3rem", paddingRight: "8rem" } : { paddingLeft: "3rem", paddingRight: "6rem" } : { paddingLeft: "3rem", paddingRight: "3.5rem" }), A = N(() => {
4270
- var I;
4271
- return (((I = o.value) == null ? void 0 : I.trim()) ?? "").length >= t.minLength ? !0 : c.hasAttachments.value;
4272
- }), x = N(
4273
- () => !t.disabled && !t.sending && A.value && !c.isUploading.value
4290
+ ), { adjustTextareaHeight: f } = Oo(() => a.value), p = N(() => s.supportRequestMode ? s.supportPlaceholder : s.placeholder), A = N(() => s.showSupportModeToggle ? s.supportRequestMode ? { paddingLeft: "3rem", paddingRight: "8rem" } : { paddingLeft: "3rem", paddingRight: "6rem" } : { paddingLeft: "3rem", paddingRight: "3.5rem" }), k = N(() => {
4291
+ var M;
4292
+ return (((M = i.value) == null ? void 0 : M.trim()) ?? "").length >= s.minLength ? !0 : c.hasAttachments.value;
4293
+ }), y = N(
4294
+ () => !s.disabled && !s.sending && k.value && !c.isUploading.value
4274
4295
  );
4275
- Ne(() => t.modelValue, (M) => {
4276
- o.value = M, Oe(k);
4277
- }), Ne(o, (M) => {
4278
- r("update:modelValue", M), Oe(k), d.checkForMentions(M), f.updateSuggestionsVisibility();
4279
- }), Ne(() => t.suggestions, () => {
4280
- f.updateSuggestionsVisibility();
4296
+ _e(() => s.modelValue, (R) => {
4297
+ i.value = R, Pe(f);
4298
+ }), _e(i, (R) => {
4299
+ o("update:modelValue", R), Pe(f), g.checkForMentions(R), m.updateSuggestionsVisibility();
4300
+ }), _e(() => s.suggestions, () => {
4301
+ m.updateSuggestionsVisibility();
4281
4302
  });
4282
- function m() {
4283
- k();
4303
+ function S() {
4304
+ f();
4284
4305
  }
4285
- function S(M) {
4286
- if (!d.handleMentionKeyDown(M) && !f.handleSuggestionKeyDown(M) && M.key === "Enter") {
4287
- if (M.shiftKey) return;
4288
- !t.sending && x.value && (M.preventDefault(), C());
4306
+ function E(R) {
4307
+ if (!g.handleMentionKeyDown(R) && !m.handleSuggestionKeyDown(R) && R.key === "Enter") {
4308
+ if (R.shiftKey) return;
4309
+ !s.sending && y.value && (R.preventDefault(), T());
4289
4310
  }
4290
4311
  }
4291
- function C() {
4292
- if (!x.value) return;
4293
- const M = c.buildPayload(), I = o.value.trim(), z = d.getMentions();
4294
- r("submit", {
4295
- message: I,
4296
- attachments: M,
4297
- mentions: z,
4298
- isSupportRequest: t.supportRequestMode
4299
- }), o.value = "", c.clearAttachments(), d.clearMentions(), Oe(k);
4300
- }
4301
4312
  function T() {
4302
- t.sending ? r("cancel") : x.value && C();
4313
+ if (!y.value) return;
4314
+ const R = c.buildPayload(), M = i.value.trim(), Z = g.getMentions();
4315
+ o("submit", {
4316
+ message: M,
4317
+ attachments: R,
4318
+ mentions: Z,
4319
+ isSupportRequest: s.supportRequestMode
4320
+ }), i.value = "", c.clearAttachments(), g.clearMentions(), Pe(f);
4303
4321
  }
4304
- function _() {
4305
- var M;
4306
- t.disabled || t.sending || c.canAddMore.value && ((M = a.value) == null || M.click());
4322
+ function z() {
4323
+ s.sending ? o("cancel") : y.value && T();
4307
4324
  }
4308
- function F(M) {
4309
- f.handleSuggestionClick(M);
4325
+ function U() {
4326
+ var R;
4327
+ s.disabled || s.sending || c.canAddMore.value && ((R = u.value) == null || R.click());
4310
4328
  }
4311
- function V() {
4312
- u.value = !0, f.updateSuggestionsVisibility();
4329
+ function J(R) {
4330
+ m.handleSuggestionClick(R);
4313
4331
  }
4314
- function E() {
4315
- u.value = !1, setTimeout(() => {
4316
- f.hideSuggestions(), d.showMentions.value = !1;
4332
+ function C() {
4333
+ d.value = !0, m.updateSuggestionsVisibility();
4334
+ }
4335
+ function _() {
4336
+ d.value = !1, setTimeout(() => {
4337
+ m.hideSuggestions(), g.showMentions.value = !1;
4317
4338
  }, 200);
4318
4339
  }
4319
- return vt(() => {
4320
- Oe(k);
4321
- }), (M, I) => {
4322
- var z;
4323
- return y(), v("div", {
4324
- class: b(["px-4 pb-4 bg-white dark:bg-gray-900 sticky bottom-0", s.value.root]),
4325
- onDragenter: I[6] || (I[6] = Je(
4340
+ return e({
4341
+ focus: () => {
4342
+ var R;
4343
+ return (R = a.value) == null ? void 0 : R.focus();
4344
+ }
4345
+ }), vt(() => {
4346
+ Pe(f);
4347
+ }), (R, M) => {
4348
+ var Z;
4349
+ return x(), v("div", {
4350
+ class: b(["px-4 pb-4 bg-white dark:bg-gray-900 sticky bottom-0", r.value.root]),
4351
+ onDragenter: M[6] || (M[6] = tt(
4326
4352
  //@ts-ignore
4327
- (...L) => D(c).handleDragEnter && D(c).handleDragEnter(...L),
4353
+ (...I) => D(c).handleDragEnter && D(c).handleDragEnter(...I),
4328
4354
  ["prevent"]
4329
4355
  )),
4330
- onDragover: I[7] || (I[7] = Je(
4356
+ onDragover: M[7] || (M[7] = tt(
4331
4357
  //@ts-ignore
4332
- (...L) => D(c).handleDragOver && D(c).handleDragOver(...L),
4358
+ (...I) => D(c).handleDragOver && D(c).handleDragOver(...I),
4333
4359
  ["prevent"]
4334
4360
  )),
4335
- onDragleave: I[8] || (I[8] = Je(
4361
+ onDragleave: M[8] || (M[8] = tt(
4336
4362
  //@ts-ignore
4337
- (...L) => D(c).handleDragLeave && D(c).handleDragLeave(...L),
4363
+ (...I) => D(c).handleDragLeave && D(c).handleDragLeave(...I),
4338
4364
  ["prevent"]
4339
4365
  )),
4340
- onDrop: I[9] || (I[9] = Je(
4366
+ onDrop: M[9] || (M[9] = tt(
4341
4367
  //@ts-ignore
4342
- (...L) => D(c).handleDrop && D(c).handleDrop(...L),
4368
+ (...I) => D(c).handleDrop && D(c).handleDrop(...I),
4343
4369
  ["prevent"]
4344
4370
  ))
4345
4371
  }, [
4346
4372
  h("form", {
4347
- class: b(s.value.form),
4348
- onSubmit: Je(C, ["prevent"])
4373
+ class: b(r.value.form),
4374
+ onSubmit: tt(T, ["prevent"])
4349
4375
  }, [
4350
4376
  h("div", Di, [
4351
4377
  h("input", {
4352
4378
  ref_key: "fileInputRef",
4353
- ref: a,
4379
+ ref: u,
4354
4380
  type: "file",
4355
4381
  class: "hidden",
4356
4382
  multiple: "",
4357
4383
  accept: D(c).acceptedFileTypes,
4358
- onChange: I[0] || (I[0] = //@ts-ignore
4359
- (...L) => D(c).handleFileSelect && D(c).handleFileSelect(...L))
4384
+ onChange: M[0] || (M[0] = //@ts-ignore
4385
+ (...I) => D(c).handleFileSelect && D(c).handleFileSelect(...I))
4360
4386
  }, null, 40, Oi),
4361
- D(c).hasAttachments.value ? (y(), Ee(xi, {
4387
+ D(c).hasAttachments.value ? (x(), Ee(xi, {
4362
4388
  key: 0,
4363
4389
  attachments: D(c).attachments.value,
4364
- ui: s.value,
4390
+ ui: r.value,
4365
4391
  texts: n.texts,
4366
4392
  "is-image": D(c).isImage,
4367
4393
  "format-file-size": D(c).formatFileSize,
4368
4394
  onRemove: D(c).removeAttachment
4369
- }, null, 8, ["attachments", "ui", "texts", "is-image", "format-file-size", "onRemove"])) : B("", !0),
4395
+ }, null, 8, ["attachments", "ui", "texts", "is-image", "format-file-size", "onRemove"])) : F("", !0),
4370
4396
  h("div", {
4371
- class: b(["relative", s.value.inputContainer])
4397
+ class: b(["relative", r.value.inputContainer])
4372
4398
  }, [
4373
- D(f).showSuggestions.value && n.suggestions.length > 0 ? (y(), Ee(Ai, {
4399
+ D(m).showSuggestions.value && n.suggestions.length > 0 ? (x(), Ee(Ai, {
4374
4400
  key: 0,
4375
4401
  ref: "suggestionsHandler.dropdownRef.value",
4376
4402
  suggestions: n.suggestions,
4377
- "selected-index": D(f).selectedSuggestionIndex.value,
4378
- ui: s.value,
4379
- onSelect: F,
4380
- onHover: I[1] || (I[1] = (L) => D(f).selectedSuggestionIndex.value = L)
4381
- }, null, 8, ["suggestions", "selected-index", "ui"])) : B("", !0),
4382
- me(wt, {
4403
+ "selected-index": D(m).selectedSuggestionIndex.value,
4404
+ ui: r.value,
4405
+ onSelect: J,
4406
+ onHover: M[1] || (M[1] = (I) => D(m).selectedSuggestionIndex.value = I)
4407
+ }, null, 8, ["suggestions", "selected-index", "ui"])) : F("", !0),
4408
+ ye(wt, {
4383
4409
  "enter-active-class": "transition ease-out duration-100",
4384
4410
  "enter-from-class": "transform opacity-0 scale-95",
4385
4411
  "enter-to-class": "transform opacity-100 scale-100",
@@ -4388,32 +4414,32 @@ const No = /* @__PURE__ */ de({
4388
4414
  "leave-to-class": "transform opacity-0 scale-95"
4389
4415
  }, {
4390
4416
  default: Ae(() => [
4391
- D(d).showMentions.value && D(d).mentionItems.value.length > 0 ? (y(), Ee(_o, {
4417
+ D(g).showMentions.value && D(g).mentionItems.value.length > 0 ? (x(), Ee(_o, {
4392
4418
  key: 0,
4393
- items: D(d).mentionItems.value,
4394
- "selected-index": D(d).selectedMentionIndex.value,
4395
- providers: D(d).mentionProviders.value,
4396
- onSelect: D(d).handleMentionSelect,
4397
- "onUpdate:selectedIndex": I[2] || (I[2] = (L) => D(d).selectedMentionIndex.value = L)
4398
- }, null, 8, ["items", "selected-index", "providers", "onSelect"])) : B("", !0)
4419
+ items: D(g).mentionItems.value,
4420
+ "selected-index": D(g).selectedMentionIndex.value,
4421
+ providers: D(g).mentionProviders.value,
4422
+ onSelect: D(g).handleMentionSelect,
4423
+ "onUpdate:selectedIndex": M[2] || (M[2] = (I) => D(g).selectedMentionIndex.value = I)
4424
+ }, null, 8, ["items", "selected-index", "providers", "onSelect"])) : F("", !0)
4399
4425
  ]),
4400
4426
  _: 1
4401
4427
  }),
4402
4428
  h("div", {
4403
4429
  class: b(["rounded-2xl border shadow-lg transition-all duration-200 bg-white dark:bg-gray-800", [
4404
- s.value.inputWrapper,
4430
+ r.value.inputWrapper,
4405
4431
  {
4406
- "border-primary shadow-primary/30": u.value || D(c).isDraggingFiles.value,
4407
- "border-gray-200 dark:border-gray-700 shadow-gray-100 dark:shadow-gray-900": !u.value && !D(c).isDraggingFiles.value
4432
+ "border-primary shadow-primary/30": d.value || D(c).isDraggingFiles.value,
4433
+ "border-gray-200 dark:border-gray-700 shadow-gray-100 dark:shadow-gray-900": !d.value && !D(c).isDraggingFiles.value
4408
4434
  }
4409
4435
  ]])
4410
4436
  }, [
4411
4437
  h("button", {
4412
4438
  type: "button",
4413
- class: b(["absolute left-3 top-1/2 -translate-y-1/2 h-9 w-9 rounded-xl flex items-center justify-center text-gray-500 dark:text-gray-400 hover:text-primary transition z-10", s.value.attachButton]),
4414
- title: ((z = n.texts) == null ? void 0 : z.attachFiles) || "Attach files",
4415
- onClick: _
4416
- }, [...I[10] || (I[10] = [
4439
+ class: b(["absolute left-3 top-1/2 -translate-y-1/2 h-9 w-9 rounded-xl flex items-center justify-center text-gray-500 dark:text-gray-400 hover:text-primary transition z-10", r.value.attachButton]),
4440
+ title: ((Z = n.texts) == null ? void 0 : Z.attachFiles) || "Attach files",
4441
+ onClick: U
4442
+ }, [...M[10] || (M[10] = [
4417
4443
  h("svg", {
4418
4444
  class: "w-5 h-5",
4419
4445
  fill: "none",
@@ -4431,49 +4457,49 @@ const No = /* @__PURE__ */ de({
4431
4457
  h("div", Pi, [
4432
4458
  qs(h("textarea", {
4433
4459
  ref_key: "textareaRef",
4434
- ref: i,
4435
- "onUpdate:modelValue": I[3] || (I[3] = (L) => o.value = L),
4460
+ ref: a,
4461
+ "onUpdate:modelValue": M[3] || (M[3] = (I) => i.value = I),
4436
4462
  rows: "1",
4437
4463
  "data-ai-input": "",
4438
- placeholder: g.value,
4464
+ placeholder: p.value,
4439
4465
  disabled: n.disabled,
4440
- class: b(["block w-full bg-transparent py-3 text-sm leading-5 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 dark:placeholder:text-gray-500 border-0 focus:outline-none focus-visible:outline-none resize-none", s.value.textarea]),
4441
- style: cn(p.value),
4442
- onInput: m,
4443
- onKeydown: S,
4444
- onFocus: V,
4445
- onBlur: E
4466
+ class: b(["block w-full bg-transparent py-3 text-sm leading-5 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 dark:placeholder:text-gray-500 border-0 focus:outline-none focus-visible:outline-none resize-none", r.value.textarea]),
4467
+ style: cn(A.value),
4468
+ onInput: S,
4469
+ onKeydown: E,
4470
+ onFocus: C,
4471
+ onBlur: _
4446
4472
  }, null, 46, _i), [
4447
- [js, o.value]
4473
+ [js, i.value]
4448
4474
  ])
4449
4475
  ]),
4450
- me($i, {
4476
+ ye($i, {
4451
4477
  sending: n.sending,
4452
- "can-send": x.value,
4478
+ "can-send": y.value,
4453
4479
  "support-request-mode": n.supportRequestMode,
4454
4480
  "show-support-mode-toggle": n.showSupportModeToggle,
4455
- ui: s.value,
4481
+ ui: r.value,
4456
4482
  texts: n.texts,
4457
- onToggleSupportMode: I[4] || (I[4] = (L) => M.$emit("toggle-support-mode")),
4458
- onClick: T
4483
+ onToggleSupportMode: M[4] || (M[4] = (I) => R.$emit("toggle-support-mode")),
4484
+ onClick: z
4459
4485
  }, null, 8, ["sending", "can-send", "support-request-mode", "show-support-mode-toggle", "ui", "texts"])
4460
4486
  ], 2)
4461
4487
  ], 2),
4462
- ue(M.$slots, "context-link", {}, () => [
4463
- n.contextLinkText ? (y(), v("div", zi, [
4488
+ ce(R.$slots, "context-link", {}, () => [
4489
+ n.contextLinkText ? (x(), v("div", zi, [
4464
4490
  h("button", {
4465
4491
  type: "button",
4466
- class: b(["text-xs text-gray-400 hover:text-primary transition-colors", s.value.contextLink]),
4467
- onClick: I[5] || (I[5] = (L) => M.$emit("context-link-click"))
4492
+ class: b(["text-xs text-gray-400 hover:text-primary transition-colors", r.value.contextLink]),
4493
+ onClick: M[5] || (M[5] = (I) => R.$emit("context-link-click"))
4468
4494
  }, P(n.contextLinkText), 3)
4469
- ])) : B("", !0)
4495
+ ])) : F("", !0)
4470
4496
  ])
4471
4497
  ])
4472
4498
  ], 34)
4473
4499
  ], 34);
4474
4500
  };
4475
4501
  }
4476
- }), Bi = ["onClick"], Fi = /* @__PURE__ */ de({
4502
+ }), Bi = ["onClick"], Fi = /* @__PURE__ */ he({
4477
4503
  __name: "AiEmptyState",
4478
4504
  props: {
4479
4505
  ui: {},
@@ -4481,45 +4507,45 @@ const No = /* @__PURE__ */ de({
4481
4507
  },
4482
4508
  emits: ["item-click"],
4483
4509
  setup(n, { emit: e }) {
4484
- const t = n, s = e, r = (k) => {
4510
+ const t = n, s = e, r = (m) => {
4485
4511
  var p;
4486
- return (p = t.texts) != null && p[k] ? t.texts[k] : ce({
4512
+ return (p = t.texts) != null && p[m] ? t.texts[m] : de({
4487
4513
  aiName: "aiName",
4488
4514
  title: "emptyStateTitle",
4489
4515
  description: "emptyStateDescription"
4490
- }[k]);
4516
+ }[m]);
4491
4517
  }, o = N(() => t.ui || {}), { suggestions: i, resolvePrompt: a } = Rs();
4492
- function u(k) {
4493
- const g = {
4494
- ...k,
4495
- prompt: a(k)
4518
+ function u(m) {
4519
+ const f = {
4520
+ ...m,
4521
+ prompt: a(m)
4496
4522
  };
4497
- s("item-click", g);
4523
+ s("item-click", f);
4498
4524
  }
4499
- function c(k) {
4500
- return k.gradientClass ? k.gradientClass : k.className ? k.className : "bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900";
4525
+ function d(m) {
4526
+ return m.gradientClass ? m.gradientClass : m.className ? m.className : "bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900";
4501
4527
  }
4502
- function d(k) {
4503
- const g = k.category || "default", p = {
4528
+ function c(m) {
4529
+ const f = m.category || "default", p = {
4504
4530
  hr: "bg-blue-100 dark:bg-blue-900/30",
4505
4531
  finance: "bg-green-100 dark:bg-green-900/30",
4506
4532
  analytics: "bg-purple-100 dark:bg-purple-900/30",
4507
4533
  support: "bg-amber-100 dark:bg-amber-900/30",
4508
4534
  default: "bg-primary/10"
4509
4535
  };
4510
- return p[g] || p.default;
4536
+ return p[f] || p.default;
4511
4537
  }
4512
- function f(k) {
4513
- const g = k.category || "default", p = {
4538
+ function g(m) {
4539
+ const f = m.category || "default", p = {
4514
4540
  hr: "text-blue-600 dark:text-blue-400",
4515
4541
  finance: "text-green-600 dark:text-green-400",
4516
4542
  analytics: "text-purple-600 dark:text-purple-400",
4517
4543
  support: "text-amber-600 dark:text-amber-400",
4518
4544
  default: "text-primary"
4519
4545
  };
4520
- return p[g] || p.default;
4546
+ return p[f] || p.default;
4521
4547
  }
4522
- return (k, g) => (y(), v("div", {
4548
+ return (m, f) => (x(), v("div", {
4523
4549
  class: b(["flex items-center justify-center p-4 h-full", o.value.root])
4524
4550
  }, [
4525
4551
  h("div", {
@@ -4531,7 +4557,7 @@ const No = /* @__PURE__ */ de({
4531
4557
  h("div", {
4532
4558
  class: b(["mb-3 inline-flex items-center gap-2 rounded-full bg-primary/10 px-4 py-2 text-sm font-medium text-primary", o.value.badge])
4533
4559
  }, [
4534
- g[0] || (g[0] = h("svg", {
4560
+ f[0] || (f[0] = h("svg", {
4535
4561
  class: "w-4 h-4",
4536
4562
  fill: "none",
4537
4563
  viewBox: "0 0 24 24",
@@ -4556,25 +4582,25 @@ const No = /* @__PURE__ */ de({
4556
4582
  h("div", {
4557
4583
  class: b(["mb-8 grid gap-3 sm:grid-cols-2 lg:grid-cols-3", o.value.grid])
4558
4584
  }, [
4559
- (y(!0), v(we, null, ze(D(i), (p, A) => (y(), v("button", {
4585
+ (x(!0), v(be, null, Fe(D(i), (p, A) => (x(), v("button", {
4560
4586
  key: p.id || A,
4561
- class: b(["group relative overflow-hidden rounded-xl border border-gray-300 dark:border-gray-600 p-4 text-left transition-all hover:shadow-md hover:scale-[1.02]", [o.value.suggestionCard, c(p)]]),
4562
- onClick: (x) => u(p)
4587
+ class: b(["group relative overflow-hidden rounded-xl border border-gray-300 dark:border-gray-600 p-4 text-left transition-all hover:shadow-md hover:scale-[1.02]", [o.value.suggestionCard, d(p)]]),
4588
+ onClick: (k) => u(p)
4563
4589
  }, [
4564
4590
  h("div", {
4565
- class: b(["mb-2 inline-flex h-10 w-10 items-center justify-center rounded-lg", [o.value.suggestionIconContainer, d(p)]])
4591
+ class: b(["mb-2 inline-flex h-10 w-10 items-center justify-center rounded-lg", [o.value.suggestionIconContainer, c(p)]])
4566
4592
  }, [
4567
- p.icon ? (y(), Ee(nn(p.icon), {
4593
+ p.icon ? (x(), Ee(nn(p.icon), {
4568
4594
  key: 0,
4569
- class: b(["h-5 w-5", [o.value.suggestionIcon, f(p)]])
4570
- }, null, 8, ["class"])) : (y(), v("svg", {
4595
+ class: b(["h-5 w-5", [o.value.suggestionIcon, g(p)]])
4596
+ }, null, 8, ["class"])) : (x(), v("svg", {
4571
4597
  key: 1,
4572
- class: b(["h-5 w-5", [o.value.suggestionIcon, f(p)]]),
4598
+ class: b(["h-5 w-5", [o.value.suggestionIcon, g(p)]]),
4573
4599
  fill: "none",
4574
4600
  viewBox: "0 0 24 24",
4575
4601
  stroke: "currentColor",
4576
4602
  "stroke-width": "1.5"
4577
- }, [...g[1] || (g[1] = [
4603
+ }, [...f[1] || (f[1] = [
4578
4604
  h("path", {
4579
4605
  "stroke-linecap": "round",
4580
4606
  "stroke-linejoin": "round",
@@ -4622,7 +4648,7 @@ const No = /* @__PURE__ */ de({
4622
4648
  viewBox: "0 0 24 24",
4623
4649
  stroke: "currentColor",
4624
4650
  "stroke-width": "1.5"
4625
- }, na = /* @__PURE__ */ de({
4651
+ }, na = /* @__PURE__ */ he({
4626
4652
  __name: "DrawerHeader",
4627
4653
  props: {
4628
4654
  ui: {},
@@ -4650,20 +4676,20 @@ const No = /* @__PURE__ */ de({
4650
4676
  return r >= 1 ? "text-red-500 dark:text-red-400" : r >= 0.8 ? "text-amber-500 dark:text-amber-400" : "text-gray-400 dark:text-gray-500";
4651
4677
  });
4652
4678
  return (r, o) => {
4653
- var i, a, u, c, d, f, k;
4654
- return y(), v("div", {
4679
+ var i, a, u, d, c, g, m;
4680
+ return x(), v("div", {
4655
4681
  class: b(["flex items-center justify-between px-4 sm:px-6 pt-4 border-b border-gray-200 dark:border-gray-700 pb-4", (i = n.ui) == null ? void 0 : i.header])
4656
4682
  }, [
4657
4683
  h("div", Ui, [
4658
- n.isSetupMode ? (y(), v("div", ji, [...o[5] || (o[5] = [
4684
+ n.isSetupMode ? (x(), v("div", ji, [...o[5] || (o[5] = [
4659
4685
  h("span", { class: "flex h-2 w-2 rounded-full bg-amber-500 animate-pulse" }, null, -1),
4660
4686
  h("span", { class: "text-sm font-medium text-gray-700 dark:text-gray-300" }, "Setup Required", -1)
4661
- ])])) : (y(), v(we, { key: 0 }, [
4662
- n.showNewChatButton && n.hasHistory ? (y(), v("button", {
4687
+ ])])) : (x(), v(be, { key: 0 }, [
4688
+ n.showNewChatButton && n.hasHistory ? (x(), v("button", {
4663
4689
  key: 0,
4664
4690
  type: "button",
4665
4691
  class: b(["inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-400 transition-all duration-200 shadow-sm", (a = n.ui) == null ? void 0 : a.newChatButton]),
4666
- onClick: o[0] || (o[0] = (g) => r.$emit("new-chat"))
4692
+ onClick: o[0] || (o[0] = (f) => r.$emit("new-chat"))
4667
4693
  }, [
4668
4694
  o[4] || (o[4] = h("svg", {
4669
4695
  class: "w-4 h-4",
@@ -4679,15 +4705,15 @@ const No = /* @__PURE__ */ de({
4679
4705
  })
4680
4706
  ], -1)),
4681
4707
  h("span", null, P(n.t("newChat")), 1)
4682
- ], 2)) : (y(), v("span", qi, P(n.t("keyboardShortcutHint")), 1))
4708
+ ], 2)) : (x(), v("span", qi, P(n.t("keyboardShortcutHint")), 1))
4683
4709
  ], 64))
4684
4710
  ]),
4685
- !n.isSetupMode && (n.showMessageCount || n.showQuota) ? (y(), v("div", Wi, [
4686
- n.showMessageCount && n.hasHistory ? (y(), v("div", {
4711
+ !n.isSetupMode && (n.showMessageCount || n.showQuota) ? (x(), v("div", Wi, [
4712
+ n.showMessageCount && n.hasHistory ? (x(), v("div", {
4687
4713
  key: 0,
4688
4714
  class: b(["flex items-center gap-1.5 px-2 py-1 rounded-md bg-gray-100 dark:bg-gray-800", (u = n.ui) == null ? void 0 : u.messageCountBadge])
4689
4715
  }, [
4690
- (y(), v("svg", {
4716
+ (x(), v("svg", {
4691
4717
  class: b(["w-3.5 h-3.5", s.value]),
4692
4718
  fill: "none",
4693
4719
  viewBox: "0 0 24 24",
@@ -4703,24 +4729,24 @@ const No = /* @__PURE__ */ de({
4703
4729
  h("span", {
4704
4730
  class: b(["text-xs font-medium tabular-nums", t.value])
4705
4731
  }, [
4706
- ue(r.$slots, "message-count", {}, () => [
4732
+ ce(r.$slots, "message-count", {}, () => [
4707
4733
  sn(P(n.messageCount), 1),
4708
4734
  o[7] || (o[7] = h("span", { class: "text-gray-400 dark:text-gray-500" }, "/", -1)),
4709
4735
  sn(P(n.messageLimit), 1)
4710
4736
  ])
4711
4737
  ], 2)
4712
- ], 2)) : B("", !0),
4713
- n.showMessageCount && n.hasHistory && n.showQuota && n.quota.remaining >= 0 ? (y(), v("span", Ki, " • ")) : B("", !0),
4714
- n.showQuota ? ue(r.$slots, "quota", { key: 2 }, () => {
4715
- var g;
4738
+ ], 2)) : F("", !0),
4739
+ n.showMessageCount && n.hasHistory && n.showQuota && n.quota.remaining >= 0 ? (x(), v("span", Ki, " • ")) : F("", !0),
4740
+ n.showQuota ? ce(r.$slots, "quota", { key: 2 }, () => {
4741
+ var f;
4716
4742
  return [
4717
- n.quota.remaining > 0 ? (y(), v("div", {
4743
+ n.quota.remaining > 0 ? (x(), v("div", {
4718
4744
  key: 0,
4719
- class: b(["flex items-center gap-1.5 text-xs", (g = n.ui) == null ? void 0 : g.quotaDisplay])
4745
+ class: b(["flex items-center gap-1.5 text-xs", (f = n.ui) == null ? void 0 : f.quotaDisplay])
4720
4746
  }, [
4721
4747
  h("span", Vi, P(n.quota.remaining), 1),
4722
4748
  h("span", Gi, P(n.t("quotaRemaining")), 1)
4723
- ], 2)) : n.quota.remaining === 0 ? (y(), v("div", Qi, [
4749
+ ], 2)) : n.quota.remaining === 0 ? (x(), v("div", Qi, [
4724
4750
  o[8] || (o[8] = h("svg", {
4725
4751
  class: "w-3.5 h-3.5 text-red-500",
4726
4752
  fill: "none",
@@ -4735,19 +4761,19 @@ const No = /* @__PURE__ */ de({
4735
4761
  })
4736
4762
  ], -1)),
4737
4763
  h("span", Zi, P(n.t("noQuota")), 1)
4738
- ])) : B("", !0)
4764
+ ])) : F("", !0)
4739
4765
  ];
4740
- }) : B("", !0)
4741
- ])) : B("", !0),
4766
+ }) : F("", !0)
4767
+ ])) : F("", !0),
4742
4768
  h("div", {
4743
- class: b(["flex items-center gap-1", (c = n.ui) == null ? void 0 : c.headerActions])
4769
+ class: b(["flex items-center gap-1", (d = n.ui) == null ? void 0 : d.headerActions])
4744
4770
  }, [
4745
- n.showCloseButton ? (y(), v("button", {
4771
+ n.showCloseButton ? (x(), v("button", {
4746
4772
  key: 0,
4747
4773
  type: "button",
4748
- class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (d = n.ui) == null ? void 0 : d.headerActionButton]),
4774
+ class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (c = n.ui) == null ? void 0 : c.headerActionButton]),
4749
4775
  title: n.t("close"),
4750
- onClick: o[1] || (o[1] = (g) => r.$emit("close"))
4776
+ onClick: o[1] || (o[1] = (f) => r.$emit("close"))
4751
4777
  }, [...o[9] || (o[9] = [
4752
4778
  h("svg", {
4753
4779
  class: "w-5 h-5 text-gray-600 dark:text-gray-400",
@@ -4762,13 +4788,13 @@ const No = /* @__PURE__ */ de({
4762
4788
  d: "M6 18L18 6M6 6l12 12"
4763
4789
  })
4764
4790
  ], -1)
4765
- ])], 10, Yi)) : B("", !0),
4766
- n.showMinimizeButton ? (y(), v("button", {
4791
+ ])], 10, Yi)) : F("", !0),
4792
+ n.showMinimizeButton ? (x(), v("button", {
4767
4793
  key: 1,
4768
4794
  type: "button",
4769
- class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (f = n.ui) == null ? void 0 : f.headerActionButton]),
4795
+ class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (g = n.ui) == null ? void 0 : g.headerActionButton]),
4770
4796
  title: n.t("minimize"),
4771
- onClick: o[2] || (o[2] = (g) => r.$emit("minimize"))
4797
+ onClick: o[2] || (o[2] = (f) => r.$emit("minimize"))
4772
4798
  }, [...o[10] || (o[10] = [
4773
4799
  h("svg", {
4774
4800
  class: "w-5 h-5 text-gray-600 dark:text-gray-400",
@@ -4783,28 +4809,28 @@ const No = /* @__PURE__ */ de({
4783
4809
  d: "M5 12h14"
4784
4810
  })
4785
4811
  ], -1)
4786
- ])], 10, Xi)) : B("", !0),
4787
- n.showFullscreenToggle ? (y(), v("button", {
4812
+ ])], 10, Xi)) : F("", !0),
4813
+ n.showFullscreenToggle ? (x(), v("button", {
4788
4814
  key: 2,
4789
4815
  type: "button",
4790
- class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (k = n.ui) == null ? void 0 : k.headerActionButton]),
4816
+ class: b(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (m = n.ui) == null ? void 0 : m.headerActionButton]),
4791
4817
  title: n.isFullscreen ? n.t("exitFullscreen") : n.t("fullscreen"),
4792
- onClick: o[3] || (o[3] = (g) => r.$emit("toggle-fullscreen"))
4818
+ onClick: o[3] || (o[3] = (f) => r.$emit("toggle-fullscreen"))
4793
4819
  }, [
4794
- n.isFullscreen ? (y(), v("svg", ta, [...o[12] || (o[12] = [
4820
+ n.isFullscreen ? (x(), v("svg", ta, [...o[12] || (o[12] = [
4795
4821
  h("path", {
4796
4822
  "stroke-linecap": "round",
4797
4823
  "stroke-linejoin": "round",
4798
4824
  d: "M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25"
4799
4825
  }, null, -1)
4800
- ])])) : (y(), v("svg", ea, [...o[11] || (o[11] = [
4826
+ ])])) : (x(), v("svg", ea, [...o[11] || (o[11] = [
4801
4827
  h("path", {
4802
4828
  "stroke-linecap": "round",
4803
4829
  "stroke-linejoin": "round",
4804
4830
  d: "M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"
4805
4831
  }, null, -1)
4806
4832
  ])]))
4807
- ], 10, Ji)) : B("", !0)
4833
+ ], 10, Ji)) : F("", !0)
4808
4834
  ], 2)
4809
4835
  ], 2);
4810
4836
  };
@@ -4812,7 +4838,7 @@ const No = /* @__PURE__ */ de({
4812
4838
  }), sa = { class: "max-w-3xl mx-auto px-4 space-y-6" }, ra = { class: "flex justify-center" }, oa = { class: "inline-flex items-center gap-2 rounded-full bg-primary/10 px-4 py-2 text-sm font-medium text-primary" }, ia = {
4813
4839
  key: 0,
4814
4840
  class: "flex justify-center"
4815
- }, aa = ["title"], la = /* @__PURE__ */ de({
4841
+ }, aa = ["title"], la = /* @__PURE__ */ he({
4816
4842
  __name: "DrawerMessageList",
4817
4843
  props: {
4818
4844
  messages: {},
@@ -4826,7 +4852,7 @@ const No = /* @__PURE__ */ de({
4826
4852
  setup(n) {
4827
4853
  return (e, t) => {
4828
4854
  var s, r, o;
4829
- return y(), v("div", sa, [
4855
+ return x(), v("div", sa, [
4830
4856
  h("div", ra, [
4831
4857
  h("div", oa, [
4832
4858
  t[3] || (t[3] = h("svg", {
@@ -4842,23 +4868,23 @@ const No = /* @__PURE__ */ de({
4842
4868
  d: "M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09Z"
4843
4869
  })
4844
4870
  ], -1)),
4845
- h("span", null, P(n.t("title") || D(ce)("aiName")), 1)
4871
+ h("span", null, P(n.t("title") || D(de)("aiName")), 1)
4846
4872
  ])
4847
4873
  ]),
4848
- (y(!0), v(we, null, ze(n.messages, (i, a) => ue(e.$slots, "message", {
4874
+ (x(!0), v(be, null, Fe(n.messages, (i, a) => ce(e.$slots, "message", {
4849
4875
  key: i.id || a,
4850
4876
  message: i,
4851
4877
  isUser: i.role === "user",
4852
4878
  isLoading: i.loading,
4853
4879
  isStreaming: i.streaming
4854
4880
  }, () => [
4855
- me(ai, {
4881
+ ye(ai, {
4856
4882
  message: i,
4857
4883
  "loading-text": n.loadingMessage,
4858
4884
  onCopy: t[0] || (t[0] = (u) => e.$emit("copy", u))
4859
4885
  }, null, 8, ["message", "loading-text"])
4860
4886
  ])), 128)),
4861
- n.quota.remaining === 0 ? (y(), v("div", ia, [
4887
+ n.quota.remaining === 0 ? (x(), v("div", ia, [
4862
4888
  h("button", {
4863
4889
  type: "button",
4864
4890
  class: "inline-flex items-center gap-2 px-6 py-3 bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-all shadow-sm",
@@ -4877,10 +4903,10 @@ const No = /* @__PURE__ */ de({
4877
4903
  d: "M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"
4878
4904
  })
4879
4905
  ], -1)),
4880
- h("span", null, P(D(ce)("contactSupport")), 1)
4906
+ h("span", null, P(D(de)("contactSupport")), 1)
4881
4907
  ])
4882
- ])) : B("", !0),
4883
- n.error.message ? (y(), v("div", {
4908
+ ])) : F("", !0),
4909
+ n.error.message ? (x(), v("div", {
4884
4910
  key: 1,
4885
4911
  class: b(["flex items-center gap-2 text-sm text-red-600 dark:text-red-400 px-2 py-1 pb-6", (s = n.ui) == null ? void 0 : s.errorContainer])
4886
4912
  }, [
@@ -4907,18 +4933,18 @@ const No = /* @__PURE__ */ de({
4907
4933
  })
4908
4934
  ], -1)
4909
4935
  ])], 10, aa)
4910
- ], 2)) : B("", !0)
4936
+ ], 2)) : F("", !0)
4911
4937
  ]);
4912
4938
  };
4913
4939
  }
4914
- }), ua = { class: "w-full max-w-md" }, ca = { class: "bg-gray-900 rounded-xl overflow-hidden" }, da = { class: "flex items-center justify-between px-4 py-2 bg-gray-800/50 border-b border-gray-700" }, ha = /* @__PURE__ */ de({
4940
+ }), ua = { class: "w-full max-w-md" }, ca = { class: "bg-gray-900 rounded-xl overflow-hidden" }, da = { class: "flex items-center justify-between px-4 py-2 bg-gray-800/50 border-b border-gray-700" }, ha = /* @__PURE__ */ he({
4915
4941
  __name: "SetupGuide",
4916
4942
  props: {
4917
4943
  copied: { type: Boolean }
4918
4944
  },
4919
4945
  emits: ["copy"],
4920
4946
  setup(n) {
4921
- return (e, t) => (y(), v(we, null, [
4947
+ return (e, t) => (x(), v(be, null, [
4922
4948
  t[4] || (t[4] = _n('<div class="w-14 h-14 rounded-2xl bg-primary/10 flex items-center justify-center mb-5"><svg class="w-7 h-7 text-primary" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09Z"></path></svg></div><h2 class="text-lg font-semibold text-gray-900 dark:text-white mb-1"> Almost there! </h2><p class="text-sm text-gray-500 dark:text-gray-400 mb-6 max-w-sm text-center"> Configure the plugin in your app entry file to start using AI. </p>', 3)),
4923
4949
  h("div", ua, [
4924
4950
  h("div", ca, [
@@ -4951,16 +4977,16 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
4951
4977
  ])
4952
4978
  ], 64));
4953
4979
  }
4954
- }), pa = {
4980
+ }), fa = {
4955
4981
  key: 0,
4956
4982
  class: "absolute inset-0 bg-black/50 flex items-center justify-center z-10"
4957
- }, fa = {
4983
+ }, pa = {
4958
4984
  key: 0,
4959
4985
  class: "flex items-center gap-3 mb-4"
4960
4986
  }, ga = { class: "text-lg font-semibold text-gray-900 dark:text-white" }, ma = {
4961
4987
  key: 1,
4962
4988
  class: "text-lg font-semibold text-gray-900 dark:text-white mb-2"
4963
- }, ya = { class: "text-sm text-gray-600 dark:text-gray-400 mb-6" }, xa = { class: "flex justify-end gap-3" }, rs = /* @__PURE__ */ de({
4989
+ }, ya = { class: "text-sm text-gray-600 dark:text-gray-400 mb-6" }, xa = { class: "flex justify-end gap-3" }, rs = /* @__PURE__ */ he({
4964
4990
  __name: "ConfirmDialog",
4965
4991
  props: {
4966
4992
  show: { type: Boolean },
@@ -4982,7 +5008,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
4982
5008
  const r = e.confirmVariant === "danger" ? "bg-red-600 hover:bg-red-700" : "bg-primary-500 hover:bg-primary-600", o = e.confirmVariant === "danger" ? (i = e.ui) == null ? void 0 : i.closeConfirmButton : (a = e.ui) == null ? void 0 : a.historyLimitButton;
4983
5009
  return [r, o];
4984
5010
  });
4985
- return (r, o) => (y(), Ee(wt, {
5011
+ return (r, o) => (x(), Ee(wt, {
4986
5012
  "enter-active-class": "transition ease-out duration-200",
4987
5013
  "enter-from-class": "opacity-0",
4988
5014
  "enter-to-class": "opacity-100",
@@ -4993,11 +5019,11 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
4993
5019
  default: Ae(() => {
4994
5020
  var i;
4995
5021
  return [
4996
- n.show ? (y(), v("div", pa, [
5022
+ n.show ? (x(), v("div", fa, [
4997
5023
  h("div", {
4998
5024
  class: b(["bg-white dark:bg-gray-800 rounded-xl p-6 m-4 max-w-sm w-full shadow-xl", t.value])
4999
5025
  }, [
5000
- n.icon === "warning" ? (y(), v("div", fa, [
5026
+ n.icon === "warning" ? (x(), v("div", pa, [
5001
5027
  o[2] || (o[2] = h("div", { class: "flex-shrink-0 w-10 h-10 rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center" }, [
5002
5028
  h("svg", {
5003
5029
  class: "w-5 h-5 text-amber-600 dark:text-amber-400",
@@ -5014,7 +5040,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
5014
5040
  ])
5015
5041
  ], -1)),
5016
5042
  h("h3", ga, P(n.title), 1)
5017
- ])) : (y(), v("h3", ma, P(n.title), 1)),
5043
+ ])) : (x(), v("h3", ma, P(n.title), 1)),
5018
5044
  h("p", ya, P(n.message), 1),
5019
5045
  h("div", xa, [
5020
5046
  h("button", {
@@ -5029,7 +5055,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
5029
5055
  }, P(n.confirmText), 3)
5030
5056
  ])
5031
5057
  ], 2)
5032
- ])) : B("", !0)
5058
+ ])) : F("", !0)
5033
5059
  ];
5034
5060
  }),
5035
5061
  _: 1
@@ -5041,7 +5067,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
5041
5067
  }, wa = {
5042
5068
  key: 0,
5043
5069
  class: "flex-1 flex flex-col overflow-y-auto"
5044
- }, ba = /* @__PURE__ */ de({
5070
+ }, ba = /* @__PURE__ */ he({
5045
5071
  __name: "AiChatDrawer",
5046
5072
  props: {
5047
5073
  modelValue: { type: Boolean },
@@ -5071,104 +5097,106 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
5071
5097
  get: () => t.modelValue,
5072
5098
  set: (O) => s("update:modelValue", O)
5073
5099
  });
5074
- function o(O, U) {
5100
+ function o(O, B) {
5075
5101
  var G;
5076
- const Y = (G = t.texts) == null ? void 0 : G[O];
5077
- if (Y) {
5078
- let re = Y;
5079
- if (U)
5080
- for (const [X, oe] of Object.entries(U))
5081
- re = re.replace(`{${X}}`, String(oe));
5082
- return re;
5102
+ const X = (G = t.texts) == null ? void 0 : G[O];
5103
+ if (X) {
5104
+ let oe = X;
5105
+ if (B)
5106
+ for (const [ee, ie] of Object.entries(B))
5107
+ oe = oe.replace(`{${ee}}`, String(ie));
5108
+ return oe;
5083
5109
  }
5084
- return ce(O, U);
5110
+ return de(O, B);
5085
5111
  }
5086
- const i = We(), a = q(""), u = q(null), c = q(!1), d = q(!1), f = q(!1), { loadingMessage: k, startLoadingText: g, resetLoadingText: p } = Ro(
5112
+ const i = Ge(), a = q(""), u = q(null), d = q(null), c = q(!1), g = q(!1), m = q(!1), { loadingMessage: f, startLoadingText: p, resetLoadingText: A } = Ro(
5087
5113
  () => i.sending,
5088
5114
  () => t.loadingText
5089
5115
  ), {
5090
- showHistoryLimitWarning: A,
5091
- historyLimitReached: x,
5092
- historyLimitDialogTitle: m,
5093
- historyLimitDialogMessage: S,
5094
- dismissHistoryLimitWarning: C,
5095
- handleHistoryLimitAction: T,
5096
- checkHistoryLimit: _,
5097
- setPendingMessage: F
5116
+ showHistoryLimitWarning: k,
5117
+ historyLimitReached: y,
5118
+ historyLimitDialogTitle: S,
5119
+ historyLimitDialogMessage: E,
5120
+ dismissHistoryLimitWarning: T,
5121
+ handleHistoryLimitAction: z,
5122
+ checkHistoryLimit: U,
5123
+ setPendingMessage: J
5098
5124
  } = Lo({
5099
- getHistoryLength: () => i.chatHistory.length,
5100
- getStoreLimit: () => i.chatHistoryLimit,
5125
+ getHistoryLength: () => i.quota.limit - i.quota.remaining,
5126
+ getStoreLimit: () => i.quota.limit,
5101
5127
  getConfig: () => t.historyLimit,
5102
5128
  getTexts: () => t.texts,
5103
5129
  onStartNewChat: () => i.clearChatHistory(),
5104
5130
  onNewChatEmit: () => s("new-chat")
5105
- }), V = N(() => !is()), E = N(() => et("enableSupportMode") ?? !1), { suggestions: M, resolvePrompt: I } = Rs(), z = N(() => i.chatHistory.filter((O) => O.role === "user").length), L = N(() => {
5106
- if (V.value) return [];
5107
- const O = a.value.toLowerCase().trim(), U = M.value || [];
5108
- let Y = U;
5131
+ }), C = N(() => !is()), _ = N(() => Be("enableSupportMode") ?? !1), { suggestions: R, resolvePrompt: M } = Rs();
5132
+ N(() => i.chatHistory.filter((O) => O.role === "user").length);
5133
+ const Z = N(() => {
5134
+ if (C.value) return [];
5135
+ const O = a.value.toLowerCase().trim(), B = R.value || [];
5136
+ let X = B;
5109
5137
  if (O) {
5110
- const G = /* @__PURE__ */ new Set(["a", "an", "the", "and", "or", "but", "in", "on", "at", "to", "for", "of", "with", "by"]), re = O.split(/\s+/).filter((X) => !G.has(X));
5111
- re.length > 0 && (Y = U.filter((X) => {
5112
- const oe = `${X.title} ${X.description || ""}`.toLowerCase();
5113
- return re.every((_e) => oe.includes(_e));
5138
+ const G = /* @__PURE__ */ new Set(["a", "an", "the", "and", "or", "but", "in", "on", "at", "to", "for", "of", "with", "by"]), oe = O.split(/\s+/).filter((ee) => !G.has(ee));
5139
+ oe.length > 0 && (X = B.filter((ee) => {
5140
+ const ie = `${ee.title} ${ee.description || ""}`.toLowerCase();
5141
+ return oe.every((He) => ie.includes(He));
5114
5142
  }));
5115
5143
  }
5116
- return Y.slice(0, 5).map((G) => ({
5144
+ return X.slice(0, 5).map((G) => ({
5117
5145
  id: G.id,
5118
5146
  title: G.title,
5119
5147
  description: G.description || ""
5120
5148
  }));
5121
- }), ee = N(() => ({
5149
+ }), I = N(() => ({
5122
5150
  quota: i.quota,
5123
5151
  isFullscreen: c.value,
5124
5152
  hasHistory: i.chatHistory.length > 0,
5125
5153
  onNewChat: st,
5126
- onClose: nt,
5127
- onMinimize: Me,
5128
- onToggleFullscreen: Be
5129
- })), Te = N(() => ({
5154
+ onClose: ze,
5155
+ onMinimize: Re,
5156
+ onToggleFullscreen: Me
5157
+ })), V = N(() => ({
5130
5158
  modelValue: a.value,
5131
5159
  sending: i.sending,
5132
5160
  disabled: !1,
5133
5161
  onSubmit: ot,
5134
5162
  onCancel: () => i.cancelRequest()
5135
5163
  }));
5136
- function Ve(O) {
5137
- const U = (M.value || []).find((Y) => Y.id === O.id);
5138
- U && (a.value = I(U));
5164
+ function qe(O) {
5165
+ const B = (R.value || []).find((X) => X.id === O.id);
5166
+ B && (a.value = M(B));
5139
5167
  }
5140
- function Be() {
5168
+ function Me() {
5141
5169
  c.value = !c.value;
5142
5170
  }
5143
- function Me() {
5171
+ function Re() {
5144
5172
  r.value = !1;
5145
5173
  }
5146
- function nt() {
5147
- t.confirmClose && !V.value && i.chatHistory.length > 0 ? f.value = !0 : (r.value = !1, s("close"));
5174
+ function ze() {
5175
+ t.confirmClose && !C.value && i.chatHistory.length > 0 ? m.value = !0 : (r.value = !1, s("close"));
5148
5176
  }
5149
5177
  function Ft() {
5150
- f.value = !1, i.clearChatHistory(), r.value = !1, s("close");
5178
+ m.value = !1, i.clearChatHistory(), r.value = !1, s("close");
5151
5179
  }
5152
5180
  function At() {
5153
5181
  s("contact-support");
5154
5182
  }
5155
- function te() {
5183
+ function ne() {
5156
5184
  i.toggleSupportMode();
5157
5185
  }
5158
- async function Pe() {
5159
- await Oe();
5160
- const O = document.getElementById("rai-chat-bottom");
5161
- O && O.scrollIntoView({ behavior: "smooth", block: "end" });
5186
+ async function Le() {
5187
+ await Pe();
5188
+ const O = u.value;
5189
+ O && (O.scrollTop = O.scrollHeight);
5162
5190
  }
5163
- function ne(O) {
5191
+ function se(O) {
5164
5192
  a.value = O.prompt, i.clearError();
5165
5193
  }
5166
5194
  function st() {
5167
5195
  i.clearChatHistory(), s("new-chat");
5168
5196
  }
5169
- function Z(O) {
5197
+ function Y(O) {
5170
5198
  }
5171
- function Fe() {
5199
+ function je() {
5172
5200
  navigator.clipboard.writeText(`import { RestifyAiPlugin } from '@doderasoftware/restify-ai'
5173
5201
 
5174
5202
  app.use(RestifyAiPlugin, {
@@ -5177,93 +5205,94 @@ app.use(RestifyAiPlugin, {
5177
5205
  quota: '/api/ai/quota', // optional
5178
5206
  },
5179
5207
  getAuthToken: () => getToken(),
5180
- })`), d.value = !0, setTimeout(() => {
5181
- d.value = !1;
5208
+ })`), g.value = !0, setTimeout(() => {
5209
+ g.value = !1;
5182
5210
  }, 2e3);
5183
5211
  }
5184
5212
  async function rt() {
5185
- const O = await T();
5186
- O && (await Oe(), await Re(O.message, O.attachments, O.mentions, O.isSupportRequest));
5213
+ const O = await z();
5214
+ O && (await Pe(), await Ie(O.message, O.attachments, O.mentions, O.isSupportRequest));
5187
5215
  }
5188
- async function Re(O, U, Y, G) {
5189
- i.clearError(), g(), await Oe(), Pe();
5190
- const re = await i.askQuestion(O, U, Y, G);
5191
- p(), re && Pe();
5216
+ async function Ie(O, B, X, G) {
5217
+ i.clearError(), p(), await Pe(), Le();
5218
+ const oe = await i.askQuestion(O, B, X, G);
5219
+ A(), oe && Le();
5192
5220
  }
5193
5221
  async function ot(O) {
5194
- const { message: U, attachments: Y, mentions: G, isSupportRequest: re } = O;
5222
+ const { message: B, attachments: X, mentions: G, isSupportRequest: oe } = O;
5195
5223
  if (i.sending) return;
5196
- const X = G.map((oe) => ({
5197
- id: oe.id,
5198
- name: oe.name,
5199
- type: oe.type || "unknown",
5200
- metadata: oe.metadata
5224
+ const ee = G.map((ie) => ({
5225
+ id: ie.id,
5226
+ name: ie.name,
5227
+ type: ie.type || "unknown",
5228
+ metadata: ie.metadata
5201
5229
  }));
5202
- if (!_()) {
5203
- F({ message: U, attachments: Y, mentions: X, isSupportRequest: re });
5230
+ if (!U()) {
5231
+ J({ message: B, attachments: X, mentions: ee, isSupportRequest: oe });
5204
5232
  return;
5205
5233
  }
5206
- await Re(U, Y, X, re);
5234
+ await Ie(B, X, ee, oe);
5207
5235
  }
5208
5236
  async function it() {
5209
- g();
5237
+ p();
5210
5238
  const O = await i.retry();
5211
- p(), O && Pe();
5239
+ A(), O && Le();
5212
5240
  }
5213
5241
  function at(O) {
5214
- t.closeOnEscape && O.key === "Escape" && r.value && (f.value ? f.value = !1 : Me());
5242
+ t.closeOnEscape && O.key === "Escape" && r.value && (m.value ? m.value = !1 : Re());
5215
5243
  }
5216
- return Ne(
5244
+ return _e(
5217
5245
  () => i.chatHistory.length,
5218
5246
  () => {
5219
- Pe();
5247
+ Le();
5220
5248
  }
5221
- ), Ne(
5249
+ ), _e(
5222
5250
  () => i.chatHistory.map((O) => O.message).join(""),
5223
5251
  () => {
5224
- Pe();
5252
+ Le();
5225
5253
  }
5226
- ), Ne(() => t.modelValue, (O) => {
5227
- O && t.autoFetchQuota && i.fetchQuota();
5254
+ ), _e(() => t.modelValue, async (O) => {
5255
+ var B;
5256
+ O && (await Le(), (B = d.value) == null || B.focus()), O && t.autoFetchQuota && i.fetchQuota();
5228
5257
  }, { immediate: !0 }), vt(() => {
5229
5258
  window.addEventListener("keydown", at);
5230
5259
  }), bt(() => {
5231
5260
  window.removeEventListener("keydown", at);
5232
- }), (O, U) => (y(), Ee(Ws, { to: "body" }, [
5233
- me(wt, { name: "rai-fade" }, {
5261
+ }), (O, B) => (x(), Ee(Ws, { to: "body" }, [
5262
+ ye(wt, { name: "rai-fade" }, {
5234
5263
  default: Ae(() => {
5235
- var Y;
5264
+ var X;
5236
5265
  return [
5237
- r.value && n.showBackdrop ? (y(), v("div", {
5266
+ r.value && n.showBackdrop ? (x(), v("div", {
5238
5267
  key: 0,
5239
- class: b(["fixed inset-0 bg-black/30 z-40", (Y = n.ui) == null ? void 0 : Y.backdrop]),
5240
- onClick: U[0] || (U[0] = (G) => n.closeOnBackdropClick && Me())
5241
- }, null, 2)) : B("", !0)
5268
+ class: b(["fixed inset-0 bg-black/30 z-40", (X = n.ui) == null ? void 0 : X.backdrop]),
5269
+ onClick: B[0] || (B[0] = (G) => n.closeOnBackdropClick && Re())
5270
+ }, null, 2)) : F("", !0)
5242
5271
  ];
5243
5272
  }),
5244
5273
  _: 1
5245
5274
  }),
5246
- me(wt, {
5275
+ ye(wt, {
5247
5276
  name: n.position === "left" ? "rai-slide-right" : "rai-slide-left"
5248
5277
  }, {
5249
5278
  default: Ae(() => {
5250
- var Y, G, re;
5279
+ var X, G, oe;
5251
5280
  return [
5252
- r.value ? (y(), v("aside", {
5281
+ r.value ? (x(), v("aside", {
5253
5282
  key: 0,
5254
5283
  class: b(["fixed bottom-0 z-50 flex-shrink-0 border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-2xl will-change-transform", [
5255
5284
  n.position === "left" ? "left-0 border-r" : "right-0 border-l",
5256
- (Y = n.ui) == null ? void 0 : Y.drawer
5285
+ (X = n.ui) == null ? void 0 : X.drawer
5257
5286
  ]]),
5258
5287
  style: cn({ width: c.value ? n.fullscreenWidth : n.width, top: n.topOffset, height: `calc(100vh - ${n.topOffset})` })
5259
5288
  }, [
5260
5289
  h("div", {
5261
5290
  class: b(["h-full flex flex-col relative bg-white dark:bg-gray-900", (G = n.ui) == null ? void 0 : G.panel])
5262
5291
  }, [
5263
- ue(O.$slots, "header", zn(Hn(ee.value)), () => [
5264
- me(na, {
5292
+ ce(O.$slots, "header", zn(Hn(I.value)), () => [
5293
+ ye(na, {
5265
5294
  ui: n.ui,
5266
- "is-setup-mode": V.value,
5295
+ "is-setup-mode": C.value,
5267
5296
  "show-new-chat-button": n.showNewChatButton,
5268
5297
  "has-history": D(i).chatHistory.length > 0,
5269
5298
  "show-quota": n.showQuota,
@@ -5273,16 +5302,16 @@ app.use(RestifyAiPlugin, {
5273
5302
  "show-fullscreen-toggle": n.showFullscreenToggle,
5274
5303
  "is-fullscreen": c.value,
5275
5304
  "show-message-count": n.showMessageCount,
5276
- "message-count": z.value,
5277
- "message-limit": D(i).chatHistoryLimit,
5305
+ "message-count": D(i).quota.used,
5306
+ "message-limit": D(i).quota.limit,
5278
5307
  t: o,
5279
5308
  onNewChat: st,
5280
- onClose: nt,
5281
- onMinimize: Me,
5282
- onToggleFullscreen: Be
5309
+ onClose: ze,
5310
+ onMinimize: Re,
5311
+ onToggleFullscreen: Me
5283
5312
  }, {
5284
5313
  quota: Ae(() => [
5285
- ue(O.$slots, "quota", {
5314
+ ce(O.$slots, "quota", {
5286
5315
  quota: D(i).quota
5287
5316
  }, void 0, !0)
5288
5317
  ]),
@@ -5290,75 +5319,77 @@ app.use(RestifyAiPlugin, {
5290
5319
  }, 8, ["ui", "is-setup-mode", "show-new-chat-button", "has-history", "show-quota", "quota", "show-close-button", "show-minimize-button", "show-fullscreen-toggle", "is-fullscreen", "show-message-count", "message-count", "message-limit"])
5291
5320
  ], !0),
5292
5321
  h("div", {
5293
- class: b(["h-full flex flex-col mx-auto w-full overflow-hidden", [{ "max-w-5xl": c.value }, (re = n.ui) == null ? void 0 : re.body]])
5322
+ class: b(["h-full flex flex-col mx-auto w-full overflow-hidden", [{ "max-w-5xl": c.value }, (oe = n.ui) == null ? void 0 : oe.body]])
5294
5323
  }, [
5295
- V.value ? (y(), v("div", ka, [
5296
- ue(O.$slots, "setup", {}, () => [
5297
- me(ha, {
5298
- copied: d.value,
5299
- onCopy: Fe
5324
+ C.value ? (x(), v("div", ka, [
5325
+ ce(O.$slots, "setup", {}, () => [
5326
+ ye(ha, {
5327
+ copied: g.value,
5328
+ onCopy: je
5300
5329
  }, null, 8, ["copied"])
5301
5330
  ], !0)
5302
- ])) : (y(), v(we, { key: 1 }, [
5303
- D(i).chatHistory.length === 0 ? (y(), v("div", wa, [
5304
- ue(O.$slots, "empty-state", {
5305
- suggestions: L.value,
5306
- onClick: ne
5331
+ ])) : (x(), v(be, { key: 1 }, [
5332
+ D(i).chatHistory.length === 0 ? (x(), v("div", wa, [
5333
+ ce(O.$slots, "empty-state", {
5334
+ suggestions: Z.value,
5335
+ onClick: se
5307
5336
  }, () => [
5308
- me(Fi, { onItemClick: ne })
5337
+ ye(Fi, { onItemClick: se })
5309
5338
  ], !0)
5310
- ])) : (y(), v("div", {
5339
+ ])) : (x(), v("div", {
5311
5340
  key: 1,
5312
5341
  ref_key: "chatContainer",
5313
5342
  ref: u,
5314
5343
  class: "flex-1 overflow-y-auto py-6 pb-24"
5315
5344
  }, [
5316
- me(la, {
5345
+ ye(la, {
5317
5346
  messages: D(i).chatHistory,
5318
- "loading-message": D(k),
5347
+ "loading-message": D(f),
5319
5348
  quota: D(i).quota,
5320
5349
  error: D(i).error,
5321
5350
  ui: n.ui,
5322
5351
  t: o,
5323
- onCopy: Z,
5352
+ onCopy: Y,
5324
5353
  onContactSupport: At,
5325
5354
  onRetry: it
5326
5355
  }, {
5327
- message: Ae((X) => [
5328
- ue(O.$slots, "message", {
5329
- message: X.message,
5330
- isUser: X.isUser,
5331
- isLoading: X.isLoading,
5332
- isStreaming: X.isStreaming
5356
+ message: Ae((ee) => [
5357
+ ce(O.$slots, "message", {
5358
+ message: ee.message,
5359
+ isUser: ee.isUser,
5360
+ isLoading: ee.isLoading,
5361
+ isStreaming: ee.isStreaming
5333
5362
  }, void 0, !0)
5334
5363
  ]),
5335
5364
  _: 3
5336
5365
  }, 8, ["messages", "loading-message", "quota", "error", "ui"])
5337
5366
  ], 512)),
5338
- U[3] || (U[3] = h("div", {
5367
+ B[3] || (B[3] = h("div", {
5339
5368
  id: "rai-chat-bottom",
5340
5369
  class: "h-8"
5341
5370
  }, null, -1)),
5342
- ue(O.$slots, "input", zn(Hn(Te.value)), () => {
5343
- var X, oe;
5371
+ ce(O.$slots, "input", zn(Hn(V.value)), () => {
5372
+ var ee, ie;
5344
5373
  return [
5345
- me(Hi, {
5374
+ ye(Hi, {
5375
+ ref_key: "chatInputRef",
5376
+ ref: d,
5346
5377
  modelValue: a.value,
5347
- "onUpdate:modelValue": U[1] || (U[1] = (_e) => a.value = _e),
5378
+ "onUpdate:modelValue": B[1] || (B[1] = (He) => a.value = He),
5348
5379
  sending: D(i).sending,
5349
- placeholder: ((X = t.texts) == null ? void 0 : X.placeholder) || D(ce)("inputPlaceholder"),
5350
- "support-placeholder": ((oe = t.texts) == null ? void 0 : oe.supportPlaceholder) || D(ce)("supportPlaceholder"),
5351
- suggestions: L.value,
5380
+ placeholder: ((ee = t.texts) == null ? void 0 : ee.placeholder) || D(de)("inputPlaceholder"),
5381
+ "support-placeholder": ((ie = t.texts) == null ? void 0 : ie.supportPlaceholder) || D(de)("supportPlaceholder"),
5382
+ suggestions: Z.value,
5352
5383
  "has-history": D(i).chatHistory.length > 0,
5353
5384
  "support-request-mode": D(i).supportRequestMode,
5354
- "show-support-mode-toggle": E.value,
5385
+ "show-support-mode-toggle": _.value,
5355
5386
  onSubmit: ot,
5356
5387
  onCancel: D(i).cancelRequest,
5357
- onSuggestionSelect: Ve,
5358
- onToggleSupportMode: te
5388
+ onSuggestionSelect: qe,
5389
+ onToggleSupportMode: ne
5359
5390
  }, {
5360
5391
  "context-link": Ae(() => [
5361
- ue(O.$slots, "context-link", {}, void 0, !0)
5392
+ ce(O.$slots, "context-link", {}, void 0, !0)
5362
5393
  ]),
5363
5394
  _: 3
5364
5395
  }, 8, ["modelValue", "sending", "placeholder", "support-placeholder", "suggestions", "has-history", "support-request-mode", "show-support-mode-toggle", "onCancel"])
@@ -5367,8 +5398,8 @@ app.use(RestifyAiPlugin, {
5367
5398
  ], 64))
5368
5399
  ], 2)
5369
5400
  ], 2),
5370
- me(rs, {
5371
- show: f.value,
5401
+ ye(rs, {
5402
+ show: m.value,
5372
5403
  title: o("closeConfirmTitle"),
5373
5404
  message: o("closeConfirmMessage"),
5374
5405
  "confirm-text": o("confirmClose"),
@@ -5376,28 +5407,28 @@ app.use(RestifyAiPlugin, {
5376
5407
  ui: n.ui,
5377
5408
  "confirm-variant": "danger",
5378
5409
  onConfirm: Ft,
5379
- onCancel: U[2] || (U[2] = (X) => f.value = !1)
5410
+ onCancel: B[2] || (B[2] = (ee) => m.value = !1)
5380
5411
  }, null, 8, ["show", "title", "message", "confirm-text", "cancel-text", "ui"]),
5381
- me(rs, {
5382
- show: D(A),
5383
- title: D(m),
5384
- message: D(S),
5412
+ ye(rs, {
5413
+ show: D(k),
5414
+ title: D(S),
5415
+ message: D(E),
5385
5416
  "confirm-text": o("startNewChat"),
5386
- "cancel-text": D(x) ? o("continueChat") : o("cancel"),
5417
+ "cancel-text": D(y) ? o("continueChat") : o("cancel"),
5387
5418
  ui: n.ui,
5388
5419
  icon: "warning",
5389
5420
  "confirm-variant": "primary",
5390
5421
  onConfirm: rt,
5391
- onCancel: D(C)
5422
+ onCancel: D(T)
5392
5423
  }, null, 8, ["show", "title", "message", "confirm-text", "cancel-text", "ui", "onCancel"])
5393
- ], 6)) : B("", !0)
5424
+ ], 6)) : F("", !0)
5394
5425
  ];
5395
5426
  }),
5396
5427
  _: 3
5397
5428
  }, 8, ["name"])
5398
5429
  ]));
5399
5430
  }
5400
- }), Da = /* @__PURE__ */ Ls(ba, [["__scopeId", "data-v-0dc9abc8"]]), Oa = /* @__PURE__ */ de({
5431
+ }), Da = /* @__PURE__ */ Ls(ba, [["__scopeId", "data-v-45532662"]]), Oa = /* @__PURE__ */ he({
5401
5432
  __name: "ErrorBoundary",
5402
5433
  props: {
5403
5434
  title: { default: "Something went wrong" },
@@ -5410,9 +5441,9 @@ app.use(RestifyAiPlugin, {
5410
5441
  emits: ["error", "reset"],
5411
5442
  setup(n, { expose: e, emit: t }) {
5412
5443
  const s = n, r = t, o = q(!1), i = q(null);
5413
- Ks((u, c, d) => {
5414
- var f;
5415
- return o.value = !0, i.value = u, (f = s.onError) == null || f.call(s, u, d), r("error", u, d), !1;
5444
+ Ks((u, d, c) => {
5445
+ var g;
5446
+ return o.value = !0, i.value = u, (g = s.onError) == null || g.call(s, u, c), r("error", u, c), !1;
5416
5447
  });
5417
5448
  function a() {
5418
5449
  o.value = !1, i.value = null, r("reset");
@@ -5421,19 +5452,19 @@ app.use(RestifyAiPlugin, {
5421
5452
  hasError: o,
5422
5453
  error: i,
5423
5454
  reset: a
5424
- }), (u, c) => o.value ? ue(u.$slots, "error", {
5455
+ }), (u, d) => o.value ? ce(u.$slots, "error", {
5425
5456
  key: 1,
5426
5457
  error: i.value,
5427
5458
  reset: a
5428
5459
  }, () => {
5429
- var d, f, k, g, p;
5460
+ var c, g, m, f, p;
5430
5461
  return [
5431
5462
  h("div", {
5432
- class: b(["flex flex-col items-center justify-center p-6 text-center", (d = n.ui) == null ? void 0 : d.container])
5463
+ class: b(["flex flex-col items-center justify-center p-6 text-center", (c = n.ui) == null ? void 0 : c.container])
5433
5464
  }, [
5434
5465
  h("div", {
5435
- class: b(["w-12 h-12 mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center", (f = n.ui) == null ? void 0 : f.iconContainer])
5436
- }, [...c[0] || (c[0] = [
5466
+ class: b(["w-12 h-12 mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center", (g = n.ui) == null ? void 0 : g.iconContainer])
5467
+ }, [...d[0] || (d[0] = [
5437
5468
  h("svg", {
5438
5469
  class: "w-6 h-6 text-red-600 dark:text-red-400",
5439
5470
  fill: "none",
@@ -5449,19 +5480,19 @@ app.use(RestifyAiPlugin, {
5449
5480
  ], -1)
5450
5481
  ])], 2),
5451
5482
  h("h3", {
5452
- class: b(["text-lg font-semibold text-gray-900 dark:text-white mb-2", (k = n.ui) == null ? void 0 : k.title])
5483
+ class: b(["text-lg font-semibold text-gray-900 dark:text-white mb-2", (m = n.ui) == null ? void 0 : m.title])
5453
5484
  }, P(n.title), 3),
5454
5485
  h("p", {
5455
- class: b(["text-sm text-gray-600 dark:text-gray-400 mb-4", (g = n.ui) == null ? void 0 : g.message])
5486
+ class: b(["text-sm text-gray-600 dark:text-gray-400 mb-4", (f = n.ui) == null ? void 0 : f.message])
5456
5487
  }, P(n.message), 3),
5457
- n.showRetry ? (y(), v("button", {
5488
+ n.showRetry ? (x(), v("button", {
5458
5489
  key: 0,
5459
5490
  class: b(["px-4 py-2 text-sm font-medium text-white bg-primary rounded-lg hover:bg-primary/90 transition-colors", (p = n.ui) == null ? void 0 : p.retryButton]),
5460
5491
  onClick: a
5461
- }, P(n.retryText), 3)) : B("", !0)
5492
+ }, P(n.retryText), 3)) : F("", !0)
5462
5493
  ], 2)
5463
5494
  ];
5464
- }) : ue(u.$slots, "default", { key: 0 });
5495
+ }) : ce(u.$slots, "default", { key: 0 });
5465
5496
  }
5466
5497
  }), Na = {
5467
5498
  install(n, e) {
@@ -5539,7 +5570,7 @@ export {
5539
5570
  Hi as ChatInput,
5540
5571
  ai as ChatMessage,
5541
5572
  Bo as ChatMessageActions,
5542
- tt as ChatRoles,
5573
+ nt as ChatRoles,
5543
5574
  Oa as ErrorBoundary,
5544
5575
  _o as MentionList,
5545
5576
  Na as RestifyAiPlugin,
@@ -5547,9 +5578,9 @@ export {
5547
5578
  Na as default,
5548
5579
  os as defaultLabels,
5549
5580
  yr as formatMentionsForApi,
5550
- et as getConfigValue,
5551
- ce as getLabel,
5552
- J as getRestifyAiConfig,
5581
+ Be as getConfigValue,
5582
+ de as getLabel,
5583
+ te as getRestifyAiConfig,
5553
5584
  Aa as getRestifyAiConfigOrThrow,
5554
5585
  So as getSuggestionsForPath,
5555
5586
  xr as groupMentionsByType,
@@ -5565,5 +5596,5 @@ export {
5565
5596
  Mo as useKeyboardShortcut,
5566
5597
  Ca as useMentionParsing,
5567
5598
  La as usePageAiContext,
5568
- We as useRestifyAiStore
5599
+ Ge as useRestifyAiStore
5569
5600
  };