@bidding-group/ai-chat 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ai-chat.js CHANGED
@@ -1,100 +1,100 @@
1
- import { defineComponent as q, ref as E, computed as w, onMounted as Ce, onUnmounted as Ie, resolveComponent as z, openBlock as a, createElementBlock as u, normalizeStyle as Ae, normalizeClass as N, createVNode as i, withCtx as c, createElementVNode as g, unref as r, createBlock as V, Fragment as F, renderList as G, createCommentVNode as A, resolveDynamicComponent as Be, withDirectives as Ge, vShow as qe, toDisplayString as W, watch as we, nextTick as ne, Transition as ie, withModifiers as oe, createTextVNode as ae, withKeys as Ke } from "vue";
2
- import { ChatDotRound as Ye, Monitor as Ze, User as Qe, ArrowDown as et, ArrowRight as tt, Grid as st, Menu as nt, FullScreen as it, Plus as ot, Close as Se, Loading as at, List as lt, Promotion as rt } from "@element-plus/icons-vue";
3
- import { defineStore as ct } from "pinia";
4
- import { ElScrollbar as ye, ElMessage as O } from "element-plus";
5
- let re = null;
6
- function dt(t) {
7
- re = t;
8
- }
9
- function ce() {
10
- if (!re)
1
+ import { defineComponent as Ct, ref as ae, computed as Z, onMounted as us, onUnmounted as ps, resolveComponent as Re, openBlock as w, createElementBlock as v, normalizeStyle as hs, normalizeClass as st, createVNode as b, withCtx as R, createElementVNode as I, unref as A, createBlock as dt, Fragment as ve, renderList as Rt, createCommentVNode as ie, resolveDynamicComponent as $s, withDirectives as zs, vShow as Us, toDisplayString as Ee, watch as Un, nextTick as Zt, Transition as Yt, withModifiers as Qt, createTextVNode as Kt, withKeys as Fs } from "vue";
2
+ import { ChatDotRound as Hs, Monitor as Ws, User as Bs, ArrowDown as Gs, ArrowRight as js, Grid as qs, Menu as Xs, FullScreen as Vs, Plus as Zs, Close as Fn, Loading as Ys, List as Qs, Promotion as Ks } from "@element-plus/icons-vue";
3
+ import { defineStore as Js } from "pinia";
4
+ import { ElScrollbar as Hn, ElMessage as Ye } from "element-plus";
5
+ let an = null;
6
+ function er(t) {
7
+ an = t;
8
+ }
9
+ function hn() {
10
+ if (!an)
11
11
  throw new Error("[@cgs/ai-chat] 插件未安装,请先调用 app.use(AiChat, options)");
12
- return re;
12
+ return an;
13
13
  }
14
- function ut(t) {
14
+ function tr(t) {
15
15
  try {
16
16
  const e = t.split(".");
17
17
  if (e.length !== 3) return null;
18
- const d = e[1].replace(/-/g, "+").replace(/_/g, "/"), l = decodeURIComponent(
19
- atob(d).split("").map((o) => "%" + ("00" + o.charCodeAt(0).toString(16)).slice(-2)).join("")
18
+ const n = e[1].replace(/-/g, "+").replace(/_/g, "/"), r = decodeURIComponent(
19
+ atob(n).split("").map((s) => "%" + ("00" + s.charCodeAt(0).toString(16)).slice(-2)).join("")
20
20
  );
21
- return JSON.parse(l, (o, m) => typeof m == "number" && !Number.isSafeInteger(m) ? String(m) : m);
21
+ return JSON.parse(r, (s, i) => typeof i == "number" && !Number.isSafeInteger(i) ? String(i) : i);
22
22
  } catch {
23
23
  return null;
24
24
  }
25
25
  }
26
- function Me(t) {
27
- const e = ce(), d = { ...t };
26
+ function ds(t) {
27
+ const e = hn(), n = { ...t };
28
28
  if (e.getToken) {
29
- const l = e.getToken();
30
- if (l) {
31
- d["x-access-token"] = l;
32
- const o = ut(l);
33
- o && (o.details_user_id && (d.details_user_id = String(o.details_user_id)), o.details_username && (d.details_username = String(o.details_username)), o.details_tenant_id && (d.details_tenant_id = String(o.details_tenant_id)), o.details_app_id && (d.details_app_id = String(o.details_app_id)));
29
+ const r = e.getToken();
30
+ if (r) {
31
+ n["x-access-token"] = r;
32
+ const s = tr(r);
33
+ s && (s.details_user_id && (n.details_user_id = String(s.details_user_id)), s.details_username && (n.details_username = String(s.details_username)), s.details_tenant_id && (n.details_tenant_id = String(s.details_tenant_id)), s.details_app_id && (n.details_app_id = String(s.details_app_id)));
34
34
  }
35
35
  }
36
- return d;
36
+ return n;
37
37
  }
38
- async function X(t, e, d) {
39
- const l = ce(), o = Me({ "Content-Type": "application/json" });
40
- let m = d;
41
- d && typeof d == "object" ? (m = { ...d }, !m.tenantId && l.getTenantId && (m.tenantId = l.getTenantId()), !m.appId && l.getAppId && (m.appId = l.getAppId())) : (t === "POST" || t === "PUT") && !d && (m = {}, l.getTenantId && (m.tenantId = l.getTenantId()), l.getAppId && (m.appId = l.getAppId()));
42
- const h = await fetch(`${l.baseUrl}${e}`, {
38
+ async function ft(t, e, n) {
39
+ const r = hn(), s = ds({ "Content-Type": "application/json" });
40
+ let i = n;
41
+ n && typeof n == "object" ? (i = { ...n }, !i.tenantId && r.getTenantId && (i.tenantId = r.getTenantId()), !i.appId && r.getAppId && (i.appId = r.getAppId())) : (t === "POST" || t === "PUT") && !n && (i = {}, r.getTenantId && (i.tenantId = r.getTenantId()), r.getAppId && (i.appId = r.getAppId()));
42
+ const o = await fetch(`${r.baseUrl}${e}`, {
43
43
  method: t,
44
- headers: o,
45
- body: m !== void 0 ? JSON.stringify(m) : void 0
46
- }), P = await h.text(), v = JSON.parse(P, (L, k) => typeof k == "number" && !Number.isSafeInteger(k) ? String(k) : k);
47
- if (!h.ok) {
48
- const L = v?.msg || v?.message || v?.detail || "";
49
- throw new Error(`HTTP ${h.status}: ${e}${L ? ` — ${L}` : ""}`);
50
- }
51
- if (v?.code === 401)
52
- throw new Error(`AUTH_EXPIRED:${v.msg || "认证失败,请重新登录"}`);
53
- if (v?.code && v.code !== 200 && v.code !== 0)
54
- throw new Error(`${v.msg || v.message || "请求失败"} (code: ${v.code})`);
55
- return v.data;
56
- }
57
- const gt = () => X("POST", "/session/create"), Te = (t) => X("POST", "/session/page", t).then((e) => ({
44
+ headers: s,
45
+ body: i !== void 0 ? JSON.stringify(i) : void 0
46
+ }), c = await o.text(), p = JSON.parse(c, (l, g) => typeof g == "number" && !Number.isSafeInteger(g) ? String(g) : g);
47
+ if (!o.ok) {
48
+ const l = p?.msg || p?.message || p?.detail || "";
49
+ throw new Error(`HTTP ${o.status}: ${e}${l ? ` — ${l}` : ""}`);
50
+ }
51
+ if (p?.code === 401)
52
+ throw new Error(`AUTH_EXPIRED:${p.msg || "认证失败,请重新登录"}`);
53
+ if (p?.code && p.code !== 200 && p.code !== 0)
54
+ throw new Error(`${p.msg || p.message || "请求失败"} (code: ${p.code})`);
55
+ return p.data;
56
+ }
57
+ const nr = () => ft("POST", "/session/create"), Wn = (t) => ft("POST", "/session/page", t).then((e) => ({
58
58
  list: e?.records ?? [],
59
59
  total: e?.total ?? 0
60
- })), mt = (t) => X("GET", `/session/${t}/messages`), ht = (t) => X("DELETE", `/session/${t}`), ft = () => X("GET", "/usage/today");
61
- async function pt(t) {
62
- const e = ce(), d = Me({ "Content-Type": "application/json" }), l = { ...t };
63
- !l.tenantId && e.getTenantId && (l.tenantId = e.getTenantId()), !l.appId && e.getAppId && (l.appId = e.getAppId());
64
- const o = await fetch(`${e.baseUrl}/chat/stream`, {
60
+ })), sr = (t) => ft("GET", `/session/${t}/messages`), rr = (t) => ft("DELETE", `/session/${t}`), ir = () => ft("GET", "/usage/today");
61
+ async function ar(t) {
62
+ const e = hn(), n = ds({ "Content-Type": "application/json" }), r = { ...t };
63
+ !r.tenantId && e.getTenantId && (r.tenantId = e.getTenantId()), !r.appId && e.getAppId && (r.appId = e.getAppId());
64
+ const s = await fetch(`${e.baseUrl}/chat/stream`, {
65
65
  method: "POST",
66
- headers: d,
67
- body: JSON.stringify(l),
66
+ headers: n,
67
+ body: JSON.stringify(r),
68
68
  signal: t.signal
69
69
  });
70
- if (!o.ok)
71
- throw new Error(`流式请求失败: HTTP ${o.status}`);
72
- const m = o.clone();
70
+ if (!s.ok)
71
+ throw new Error(`流式请求失败: HTTP ${s.status}`);
72
+ const i = s.clone();
73
73
  try {
74
- const h = await m.json();
75
- if (h?.code === 401)
76
- throw new Error(`AUTH_EXPIRED:${h.msg || "认证失败,请重新登录"}`);
77
- if (h?.code && h.code !== 200 && h.code !== 0)
78
- throw new Error(`${h.msg || "请求失败"} (code: ${h.code})`);
79
- } catch (h) {
80
- if (h instanceof Error && h.message.startsWith("AUTH_EXPIRED:"))
81
- throw h;
82
- }
83
- return o;
84
- }
85
- const Ee = "cgs-ai-chat-state";
86
- function vt() {
74
+ const o = await i.json();
75
+ if (o?.code === 401)
76
+ throw new Error(`AUTH_EXPIRED:${o.msg || "认证失败,请重新登录"}`);
77
+ if (o?.code && o.code !== 200 && o.code !== 0)
78
+ throw new Error(`${o.msg || "请求失败"} (code: ${o.code})`);
79
+ } catch (o) {
80
+ if (o instanceof Error && o.message.startsWith("AUTH_EXPIRED:"))
81
+ throw o;
82
+ }
83
+ return s;
84
+ }
85
+ const fs = "cgs-ai-chat-state";
86
+ function or() {
87
87
  try {
88
- const t = localStorage.getItem(Ee);
88
+ const t = localStorage.getItem(fs);
89
89
  return t ? JSON.parse(t) : {};
90
90
  } catch {
91
91
  return {};
92
92
  }
93
93
  }
94
- function _t(t) {
94
+ function lr(t) {
95
95
  try {
96
96
  localStorage.setItem(
97
- Ee,
97
+ fs,
98
98
  JSON.stringify({
99
99
  currentSessionId: t.currentSessionId,
100
100
  panelWidth: t.panelWidth,
@@ -104,10 +104,10 @@ function _t(t) {
104
104
  } catch {
105
105
  }
106
106
  }
107
- const be = 15, le = vt(), de = ct("cgs-ai-chat", {
107
+ const Bn = 15, Jt = or(), dn = Js("cgs-ai-chat", {
108
108
  state: () => ({
109
109
  visible: !1,
110
- currentSessionId: le.currentSessionId ?? null,
110
+ currentSessionId: Jt.currentSessionId ?? null,
111
111
  sessions: [],
112
112
  sessionPage: 1,
113
113
  sessionTotal: 0,
@@ -115,8 +115,8 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
115
115
  messages: [],
116
116
  loading: !1,
117
117
  sending: !1,
118
- panelWidth: le.panelWidth ?? (typeof window < "u" ? Math.max(320, Math.round(window.innerWidth * 0.25)) : 420),
119
- isFullScreen: le.isFullScreen ?? !1,
118
+ panelWidth: Jt.panelWidth ?? (typeof window < "u" ? Math.max(320, Math.round(window.innerWidth * 0.25)) : 420),
119
+ isFullScreen: Jt.isFullScreen ?? !1,
120
120
  tokenUsage: null
121
121
  }),
122
122
  actions: {
@@ -155,7 +155,7 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
155
155
  async loadSessions() {
156
156
  this.loading = !0, this.sessionPage = 1;
157
157
  try {
158
- const t = await Te({ pageNum: 1, pageSize: be });
158
+ const t = await Wn({ pageNum: 1, pageSize: Bn });
159
159
  this.sessions = t.list, this.sessionTotal = t.total;
160
160
  } finally {
161
161
  this.loading = !1;
@@ -166,7 +166,7 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
166
166
  if (!(this.sessionLoadingMore || this.sessions.length >= this.sessionTotal)) {
167
167
  this.sessionLoadingMore = !0;
168
168
  try {
169
- const t = this.sessionPage + 1, e = await Te({ pageNum: t, pageSize: be });
169
+ const t = this.sessionPage + 1, e = await Wn({ pageNum: t, pageSize: Bn });
170
170
  this.sessions = [...this.sessions, ...e.list], this.sessionTotal = e.total, this.sessionPage = t;
171
171
  } finally {
172
172
  this.sessionLoadingMore = !1;
@@ -176,7 +176,7 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
176
176
  async loadMessages(t) {
177
177
  this.loading = !0;
178
178
  try {
179
- const e = await mt(t);
179
+ const e = await sr(t);
180
180
  this.currentSessionId === t && (this.messages = e);
181
181
  } finally {
182
182
  this.loading = !1;
@@ -184,7 +184,7 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
184
184
  },
185
185
  async createSession() {
186
186
  try {
187
- const t = await gt();
187
+ const t = await nr();
188
188
  return await this.loadSessions(), t;
189
189
  } catch (t) {
190
190
  return console.error("[@cgs/ai-chat] 创建会话失败", t), null;
@@ -192,7 +192,7 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
192
192
  },
193
193
  async deleteSession(t) {
194
194
  try {
195
- await ht(t), await this.loadSessions(), this.currentSessionId === t && (this.currentSessionId = null, this.messages = [], this._persist());
195
+ await rr(t), await this.loadSessions(), this.currentSessionId === t && (this.currentSessionId = null, this.messages = [], this._persist());
196
196
  } catch (e) {
197
197
  console.error("[@cgs/ai-chat] 删除会话失败", e);
198
198
  }
@@ -204,15 +204,15 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
204
204
  this.messages = [];
205
205
  },
206
206
  setPanelWidth(t) {
207
- const d = Math.floor(window.innerWidth * 0.9);
208
- this.panelWidth = Math.max(320, Math.min(d, t)), this.isFullScreen = !1, this._persist();
207
+ const n = Math.floor(window.innerWidth * 0.9);
208
+ this.panelWidth = Math.max(320, Math.min(n, t)), this.isFullScreen = !1, this._persist();
209
209
  },
210
210
  toggleFullScreen() {
211
211
  this.isFullScreen = !this.isFullScreen, this._persist();
212
212
  },
213
213
  async loadTokenUsage() {
214
214
  try {
215
- this.tokenUsage = await ft();
215
+ this.tokenUsage = await ir();
216
216
  } catch (t) {
217
217
  console.error("[@cgs/ai-chat] 加载 Token 用量失败", t);
218
218
  }
@@ -225,7 +225,7 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
225
225
  },
226
226
  // 内部方法:持久化关键状态到 localStorage
227
227
  _persist() {
228
- _t(this.$state);
228
+ lr(this.$state);
229
229
  }
230
230
  },
231
231
  getters: {
@@ -239,12 +239,12 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
239
239
  /** 是否还有更多会话可加载 */
240
240
  sessionHasMore: (t) => t.sessions.length < t.sessionTotal
241
241
  }
242
- }), kt = /* @__PURE__ */ q({
242
+ }), cr = /* @__PURE__ */ Ct({
243
243
  __name: "AiChatFloat",
244
244
  setup(t) {
245
- const e = de(), d = () => e.toggleVisible(), l = E(!1), o = () => {
246
- l.value = window.innerWidth < 768;
247
- }, m = w(() => l.value ? {
245
+ const e = dn(), n = () => e.toggleVisible(), r = ae(!1), s = () => {
246
+ r.value = window.innerWidth < 768;
247
+ }, i = Z(() => r.value ? {
248
248
  position: "fixed",
249
249
  right: "50%",
250
250
  bottom: "24px",
@@ -256,29 +256,29 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
256
256
  bottom: "80px",
257
257
  zIndex: "999"
258
258
  });
259
- return Ce(() => {
260
- o(), window.addEventListener("resize", o);
261
- }), Ie(() => {
262
- window.removeEventListener("resize", o);
263
- }), (h, P) => {
264
- const v = z("el-icon"), L = z("el-tooltip");
265
- return a(), u("div", {
266
- class: N(["ai-chat-float", { "is-mobile": l.value }]),
267
- style: Ae(m.value),
268
- onClick: d
259
+ return us(() => {
260
+ s(), window.addEventListener("resize", s);
261
+ }), ps(() => {
262
+ window.removeEventListener("resize", s);
263
+ }), (o, c) => {
264
+ const p = Re("el-icon"), l = Re("el-tooltip");
265
+ return w(), v("div", {
266
+ class: st(["ai-chat-float", { "is-mobile": r.value }]),
267
+ style: hs(i.value),
268
+ onClick: n
269
269
  }, [
270
- i(L, {
270
+ b(l, {
271
271
  content: "AI助手",
272
272
  placement: "left",
273
273
  "show-after": 300
274
274
  }, {
275
- default: c(() => [
276
- g("div", {
277
- class: N(["float-btn", { "is-active": r(e).visible }])
275
+ default: R(() => [
276
+ I("div", {
277
+ class: st(["float-btn", { "is-active": A(e).visible }])
278
278
  }, [
279
- i(v, { size: 24 }, {
280
- default: c(() => [
281
- i(r(Ye))
279
+ b(p, { size: 24 }, {
280
+ default: R(() => [
281
+ b(A(Hs))
282
282
  ]),
283
283
  _: 1
284
284
  })
@@ -289,291 +289,2043 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
289
289
  ], 6);
290
290
  };
291
291
  }
292
- }), K = (t, e) => {
293
- const d = t.__vccOpts || t;
294
- for (const [l, o] of e)
295
- d[l] = o;
296
- return d;
297
- }, $e = /* @__PURE__ */ K(kt, [["__scopeId", "data-v-fc7be81c"]]), wt = { class: "avatar" }, St = { class: "content" }, yt = {
292
+ }), Ot = (t, e) => {
293
+ const n = t.__vccOpts || t;
294
+ for (const [r, s] of e)
295
+ n[r] = s;
296
+ return n;
297
+ }, gs = /* @__PURE__ */ Ot(cr, [["__scopeId", "data-v-fc7be81c"]]);
298
+ function fn() {
299
+ return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
300
+ }
301
+ var We = fn();
302
+ function ms(t) {
303
+ We = t;
304
+ }
305
+ var Fe = { exec: () => null };
306
+ function Qe(t) {
307
+ let e = [];
308
+ return (n) => {
309
+ let r = Math.max(0, Math.min(3, n - 1)), s = e[r];
310
+ return s || (s = t(r), e[r] = s), s;
311
+ };
312
+ }
313
+ function E(t, e = "") {
314
+ let n = typeof t == "string" ? t : t.source, r = { replace: (s, i) => {
315
+ let o = typeof i == "string" ? i : i.source;
316
+ return o = o.replace(K.caret, "$1"), n = n.replace(s, o), r;
317
+ }, getRegex: () => new RegExp(n, e) };
318
+ return r;
319
+ }
320
+ var ur = ((t = "") => {
321
+ try {
322
+ return !!new RegExp("(?<=1)(?<!1)" + t);
323
+ } catch {
324
+ return !1;
325
+ }
326
+ })(), K = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (t) => new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: Qe((t) => new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: Qe((t) => new RegExp(`^ {0,${t}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)), fencesBeginRegex: Qe((t) => new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)), headingBeginRegex: Qe((t) => new RegExp(`^ {0,${t}}#`)), htmlBeginRegex: Qe((t) => new RegExp(`^ {0,${t}}<(?:[a-z].*>|!--)`, "i")), blockquoteBeginRegex: Qe((t) => new RegExp(`^ {0,${t}}>`)) }, pr = /^(?:[ \t]*(?:\n|$))+/, hr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, dr = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, gt = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, fr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, gn = / {0,3}(?:[*+-]|\d{1,9}[.)])/, ks = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, bs = E(ks).replace(/bull/g, gn).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/).replace(/\|table/g, "").getRegex(), gr = E(ks).replace(/bull/g, gn).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/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), mn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, mr = /^[^\n]+/, kn = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, kr = E(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", kn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), br = E(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, gn).getRegex(), Dt = "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", bn = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Tr = E("^ {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", bn).replace("tag", Dt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Ts = E(mn).replace("hr", gt).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[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Dt).getRegex(), _r = E(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Ts).getRegex(), Tn = { blockquote: _r, code: hr, def: kr, fences: dr, heading: fr, hr: gt, html: Tr, lheading: bs, list: br, newline: pr, paragraph: Ts, table: Fe, text: mr }, Gn = E("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", gt).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[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Dt).getRegex(), xr = { ...Tn, lheading: gr, table: Gn, paragraph: E(mn).replace("hr", gt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Gn).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Dt).getRegex() }, wr = { ...Tn, html: E(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", bn).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(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: Fe, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: E(mn).replace("hr", gt).replace("heading", ` *#{1,6} *[^
327
+ ]`).replace("lheading", bs).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Sr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, yr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, _s = /^( {2,}|\\)\n(?!\s*$)/, Ar = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, rt = /[\p{P}\p{S}]/u, Mt = /[\s\p{P}\p{S}]/u, _n = /[^\s\p{P}\p{S}]/u, Er = E(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Mt).getRegex(), xs = /(?!~)[\p{P}\p{S}]/u, Rr = /(?!~)[\s\p{P}\p{S}]/u, vr = /(?:[^\s\p{P}\p{S}]|~)/u, Ir = E(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ur ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ws = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Lr = E(ws, "u").replace(/punct/g, rt).getRegex(), Cr = E(ws, "u").replace(/punct/g, xs).getRegex(), Ss = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Or = E(Ss, "gu").replace(/notPunctSpace/g, _n).replace(/punctSpace/g, Mt).replace(/punct/g, rt).getRegex(), Dr = E(Ss, "gu").replace(/notPunctSpace/g, vr).replace(/punctSpace/g, Rr).replace(/punct/g, xs).getRegex(), Mr = E("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, _n).replace(/punctSpace/g, Mt).replace(/punct/g, rt).getRegex(), Nr = E(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, rt).getRegex(), Pr = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", $r = E(Pr, "gu").replace(/notPunctSpace/g, _n).replace(/punctSpace/g, Mt).replace(/punct/g, rt).getRegex(), zr = E(/\\(punct)/, "gu").replace(/punct/g, rt).getRegex(), Ur = E(/^<(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(), Fr = E(bn).replace("(?:-->|$)", "-->").getRegex(), Hr = E("^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", Fr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), vt = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Wr = E(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", vt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ys = E(/^!?\[(label)\]\[(ref)\]/).replace("label", vt).replace("ref", kn).getRegex(), As = E(/^!?\[(ref)\](?:\[\])?/).replace("ref", kn).getRegex(), Br = E("reflink|nolink(?!\\()", "g").replace("reflink", ys).replace("nolink", As).getRegex(), jn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, xn = { _backpedal: Fe, anyPunctuation: zr, autolink: Ur, blockSkip: Ir, br: _s, code: yr, del: Fe, delLDelim: Fe, delRDelim: Fe, emStrongLDelim: Lr, emStrongRDelimAst: Or, emStrongRDelimUnd: Mr, escape: Sr, link: Wr, nolink: As, punctuation: Er, reflink: ys, reflinkSearch: Br, tag: Hr, text: Ar, url: Fe }, Gr = { ...xn, link: E(/^!?\[(label)\]\((.*?)\)/).replace("label", vt).getRegex(), reflink: E(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", vt).getRegex() }, on = { ...xn, emStrongRDelimAst: Dr, emStrongLDelim: Cr, delLDelim: Nr, delRDelim: $r, url: E(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", jn).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: E(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", jn).getRegex() }, jr = { ...on, br: E(_s).replace("{2,}", "*").getRegex(), text: E(on.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, yt = { normal: Tn, gfm: xr, pedantic: wr }, ct = { normal: xn, gfm: on, breaks: jr, pedantic: Gr }, qr = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, qn = (t) => qr[t];
328
+ function ge(t, e) {
329
+ if (e) {
330
+ if (K.escapeTest.test(t)) return t.replace(K.escapeReplace, qn);
331
+ } else if (K.escapeTestNoEncode.test(t)) return t.replace(K.escapeReplaceNoEncode, qn);
332
+ return t;
333
+ }
334
+ function Xn(t) {
335
+ try {
336
+ t = encodeURI(t).replace(K.percentDecode, "%");
337
+ } catch {
338
+ return null;
339
+ }
340
+ return t;
341
+ }
342
+ function Vn(t, e) {
343
+ let n = t.replace(K.findPipe, (i, o, c) => {
344
+ let p = !1, l = o;
345
+ for (; --l >= 0 && c[l] === "\\"; ) p = !p;
346
+ return p ? "|" : " |";
347
+ }), r = n.split(K.splitPipe), s = 0;
348
+ if (r[0].trim() || r.shift(), r.length > 0 && !r.at(-1)?.trim() && r.pop(), e) if (r.length > e) r.splice(e);
349
+ else for (; r.length < e; ) r.push("");
350
+ for (; s < r.length; s++) r[s] = r[s].trim().replace(K.slashPipe, "|");
351
+ return r;
352
+ }
353
+ function Ae(t, e, n) {
354
+ let r = t.length;
355
+ if (r === 0) return "";
356
+ let s = 0;
357
+ for (; s < r && t.charAt(r - s - 1) === e; )
358
+ s++;
359
+ return t.slice(0, r - s);
360
+ }
361
+ function Zn(t) {
362
+ let e = t.split(`
363
+ `), n = e.length - 1;
364
+ for (; n >= 0 && K.blankLine.test(e[n]); ) n--;
365
+ return e.length - n <= 2 ? t : e.slice(0, n + 1).join(`
366
+ `);
367
+ }
368
+ function Xr(t, e) {
369
+ if (t.indexOf(e[1]) === -1) return -1;
370
+ let n = 0;
371
+ for (let r = 0; r < t.length; r++) if (t[r] === "\\") r++;
372
+ else if (t[r] === e[0]) n++;
373
+ else if (t[r] === e[1] && (n--, n < 0)) return r;
374
+ return n > 0 ? -2 : -1;
375
+ }
376
+ function Vr(t, e = 0) {
377
+ let n = e, r = "";
378
+ for (let s of t) if (s === " ") {
379
+ let i = 4 - n % 4;
380
+ r += " ".repeat(i), n += i;
381
+ } else r += s, n++;
382
+ return r;
383
+ }
384
+ function Yn(t, e, n, r, s) {
385
+ let i = e.href, o = e.title || null, c = t[1].replace(s.other.outputLinkReplace, "$1");
386
+ r.state.inLink = !0;
387
+ let p = { type: t[0].charAt(0) === "!" ? "image" : "link", raw: n, href: i, title: o, text: c, tokens: r.inlineTokens(c) };
388
+ return r.state.inLink = !1, p;
389
+ }
390
+ function Zr(t, e, n) {
391
+ let r = t.match(n.other.indentCodeCompensation);
392
+ if (r === null) return e;
393
+ let s = r[1];
394
+ return e.split(`
395
+ `).map((i) => {
396
+ let o = i.match(n.other.beginningSpace);
397
+ if (o === null) return i;
398
+ let [c] = o;
399
+ return c.length >= s.length ? i.slice(s.length) : i;
400
+ }).join(`
401
+ `);
402
+ }
403
+ var It = class {
404
+ options;
405
+ rules;
406
+ lexer;
407
+ constructor(t) {
408
+ this.options = t || We;
409
+ }
410
+ space(t) {
411
+ let e = this.rules.block.newline.exec(t);
412
+ if (e && e[0].length > 0) return { type: "space", raw: e[0] };
413
+ }
414
+ code(t) {
415
+ let e = this.rules.block.code.exec(t);
416
+ if (e) {
417
+ let n = this.options.pedantic ? e[0] : Zn(e[0]), r = n.replace(this.rules.other.codeRemoveIndent, "");
418
+ return { type: "code", raw: n, codeBlockStyle: "indented", text: r };
419
+ }
420
+ }
421
+ fences(t) {
422
+ let e = this.rules.block.fences.exec(t);
423
+ if (e) {
424
+ let n = e[0], r = Zr(n, e[3] || "", this.rules);
425
+ return { type: "code", raw: n, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: r };
426
+ }
427
+ }
428
+ heading(t) {
429
+ let e = this.rules.block.heading.exec(t);
430
+ if (e) {
431
+ let n = e[2].trim();
432
+ if (this.rules.other.endingHash.test(n)) {
433
+ let r = Ae(n, "#");
434
+ (this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
435
+ }
436
+ return { type: "heading", raw: Ae(e[0], `
437
+ `), depth: e[1].length, text: n, tokens: this.lexer.inline(n) };
438
+ }
439
+ }
440
+ hr(t) {
441
+ let e = this.rules.block.hr.exec(t);
442
+ if (e) return { type: "hr", raw: Ae(e[0], `
443
+ `) };
444
+ }
445
+ blockquote(t) {
446
+ let e = this.rules.block.blockquote.exec(t);
447
+ if (e) {
448
+ let n = Ae(e[0], `
449
+ `).split(`
450
+ `), r = "", s = "", i = [];
451
+ for (; n.length > 0; ) {
452
+ let o = !1, c = [], p;
453
+ for (p = 0; p < n.length; p++) if (this.rules.other.blockquoteStart.test(n[p])) c.push(n[p]), o = !0;
454
+ else if (!o) c.push(n[p]);
455
+ else break;
456
+ n = n.slice(p);
457
+ let l = c.join(`
458
+ `), g = l.replace(this.rules.other.blockquoteSetextReplace, `
459
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
460
+ r = r ? `${r}
461
+ ${l}` : l, s = s ? `${s}
462
+ ${g}` : g;
463
+ let h = this.lexer.state.top;
464
+ if (this.lexer.state.top = !0, this.lexer.blockTokens(g, i, !0), this.lexer.state.top = h, n.length === 0) break;
465
+ let T = i.at(-1);
466
+ if (T?.type === "code") break;
467
+ if (T?.type === "blockquote") {
468
+ let S = T, y = S.raw + `
469
+ ` + n.join(`
470
+ `), W = this.blockquote(y);
471
+ i[i.length - 1] = W, r = r.substring(0, r.length - S.raw.length) + W.raw, s = s.substring(0, s.length - S.text.length) + W.text;
472
+ break;
473
+ } else if (T?.type === "list") {
474
+ let S = T, y = S.raw + `
475
+ ` + n.join(`
476
+ `), W = this.list(y);
477
+ i[i.length - 1] = W, r = r.substring(0, r.length - T.raw.length) + W.raw, s = s.substring(0, s.length - S.raw.length) + W.raw, n = y.substring(i.at(-1).raw.length).split(`
478
+ `);
479
+ continue;
480
+ }
481
+ }
482
+ return { type: "blockquote", raw: r, tokens: i, text: s };
483
+ }
484
+ }
485
+ list(t) {
486
+ let e = this.rules.block.list.exec(t);
487
+ if (e) {
488
+ let n = e[1].trim(), r = n.length > 1, s = { type: "list", raw: "", ordered: r, start: r ? +n.slice(0, -1) : "", loose: !1, items: [] };
489
+ n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
490
+ let i = this.rules.other.listItemRegex(n), o = !1;
491
+ for (; t; ) {
492
+ let p = !1, l = "", g = "";
493
+ if (!(e = i.exec(t)) || this.rules.block.hr.test(t)) break;
494
+ l = e[0], t = t.substring(l.length);
495
+ let h = Vr(e[2].split(`
496
+ `, 1)[0], e[1].length), T = t.split(`
497
+ `, 1)[0], S = !h.trim(), y = 0;
498
+ if (this.options.pedantic ? (y = 2, g = h.trimStart()) : S ? y = e[1].length + 1 : (y = h.search(this.rules.other.nonSpaceChar), y = y > 4 ? 1 : y, g = h.slice(y), y += e[1].length), S && this.rules.other.blankLine.test(T) && (l += T + `
499
+ `, t = t.substring(T.length + 1), p = !0), !p) {
500
+ let W = this.rules.other.nextBulletRegex(y), me = this.rules.other.hrRegex(y), Ie = this.rules.other.fencesBeginRegex(y), Le = this.rules.other.headingBeginRegex(y), Be = this.rules.other.htmlBeginRegex(y), he = this.rules.other.blockquoteBeginRegex(y);
501
+ for (; t; ) {
502
+ let Te = t.split(`
503
+ `, 1)[0], D;
504
+ if (T = Te, this.options.pedantic ? (T = T.replace(this.rules.other.listReplaceNesting, " "), D = T) : D = T.replace(this.rules.other.tabCharGlobal, " "), Ie.test(T) || Le.test(T) || Be.test(T) || he.test(T) || W.test(T) || me.test(T)) break;
505
+ if (D.search(this.rules.other.nonSpaceChar) >= y || !T.trim()) g += `
506
+ ` + D.slice(y);
507
+ else {
508
+ if (S || h.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Ie.test(h) || Le.test(h) || me.test(h)) break;
509
+ g += `
510
+ ` + T;
511
+ }
512
+ S = !T.trim(), l += Te + `
513
+ `, t = t.substring(Te.length + 1), h = D.slice(y);
514
+ }
515
+ }
516
+ s.loose || (o ? s.loose = !0 : this.rules.other.doubleBlankLine.test(l) && (o = !0)), s.items.push({ type: "list_item", raw: l, task: !!this.options.gfm && this.rules.other.listIsTask.test(g), loose: !1, text: g, tokens: [] }), s.raw += l;
517
+ }
518
+ let c = s.items.at(-1);
519
+ if (c) c.raw = c.raw.trimEnd(), c.text = c.text.trimEnd();
520
+ else return;
521
+ s.raw = s.raw.trimEnd();
522
+ for (let p of s.items) {
523
+ this.lexer.state.top = !1, p.tokens = this.lexer.blockTokens(p.text, []);
524
+ let l = p.tokens[0];
525
+ if (p.task && (l?.type === "text" || l?.type === "paragraph")) {
526
+ p.text = p.text.replace(this.rules.other.listReplaceTask, ""), l.raw = l.raw.replace(this.rules.other.listReplaceTask, ""), l.text = l.text.replace(this.rules.other.listReplaceTask, "");
527
+ for (let h = this.lexer.inlineQueue.length - 1; h >= 0; h--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)) {
528
+ this.lexer.inlineQueue[h].src = this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask, "");
529
+ break;
530
+ }
531
+ let g = this.rules.other.listTaskCheckbox.exec(p.raw);
532
+ if (g) {
533
+ let h = { type: "checkbox", raw: g[0] + " ", checked: g[0] !== "[ ]" };
534
+ p.checked = h.checked, s.loose ? p.tokens[0] && ["paragraph", "text"].includes(p.tokens[0].type) && "tokens" in p.tokens[0] && p.tokens[0].tokens ? (p.tokens[0].raw = h.raw + p.tokens[0].raw, p.tokens[0].text = h.raw + p.tokens[0].text, p.tokens[0].tokens.unshift(h)) : p.tokens.unshift({ type: "paragraph", raw: h.raw, text: h.raw, tokens: [h] }) : p.tokens.unshift(h);
535
+ }
536
+ } else p.task && (p.task = !1);
537
+ if (!s.loose) {
538
+ let g = p.tokens.filter((T) => T.type === "space"), h = g.length > 0 && g.some((T) => this.rules.other.anyLine.test(T.raw));
539
+ s.loose = h;
540
+ }
541
+ }
542
+ if (s.loose) for (let p of s.items) {
543
+ p.loose = !0;
544
+ for (let l of p.tokens) l.type === "text" && (l.type = "paragraph");
545
+ }
546
+ return s;
547
+ }
548
+ }
549
+ html(t) {
550
+ let e = this.rules.block.html.exec(t);
551
+ if (e) {
552
+ let n = Zn(e[0]);
553
+ return { type: "html", block: !0, raw: n, pre: e[1] === "pre" || e[1] === "script" || e[1] === "style", text: n };
554
+ }
555
+ }
556
+ def(t) {
557
+ let e = this.rules.block.def.exec(t);
558
+ if (e) {
559
+ let n = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", s = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
560
+ return { type: "def", tag: n, raw: Ae(e[0], `
561
+ `), href: r, title: s };
562
+ }
563
+ }
564
+ table(t) {
565
+ let e = this.rules.block.table.exec(t);
566
+ if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
567
+ let n = Vn(e[1]), r = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), s = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
568
+ `) : [], i = { type: "table", raw: Ae(e[0], `
569
+ `), header: [], align: [], rows: [] };
570
+ if (n.length === r.length) {
571
+ for (let o of r) this.rules.other.tableAlignRight.test(o) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? i.align.push("left") : i.align.push(null);
572
+ for (let o = 0; o < n.length; o++) i.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: !0, align: i.align[o] });
573
+ for (let o of s) i.rows.push(Vn(o, i.header.length).map((c, p) => ({ text: c, tokens: this.lexer.inline(c), header: !1, align: i.align[p] })));
574
+ return i;
575
+ }
576
+ }
577
+ lheading(t) {
578
+ let e = this.rules.block.lheading.exec(t);
579
+ if (e) {
580
+ let n = e[1].trim();
581
+ return { type: "heading", raw: Ae(e[0], `
582
+ `), depth: e[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
583
+ }
584
+ }
585
+ paragraph(t) {
586
+ let e = this.rules.block.paragraph.exec(t);
587
+ if (e) {
588
+ let n = e[1].charAt(e[1].length - 1) === `
589
+ ` ? e[1].slice(0, -1) : e[1];
590
+ return { type: "paragraph", raw: e[0], text: n, tokens: this.lexer.inline(n) };
591
+ }
592
+ }
593
+ text(t) {
594
+ let e = this.rules.block.text.exec(t);
595
+ if (e) return { type: "text", raw: e[0], text: e[0], tokens: this.lexer.inline(e[0]) };
596
+ }
597
+ escape(t) {
598
+ let e = this.rules.inline.escape.exec(t);
599
+ if (e) return { type: "escape", raw: e[0], text: e[1] };
600
+ }
601
+ tag(t) {
602
+ let e = this.rules.inline.tag.exec(t);
603
+ if (e) return !this.lexer.state.inLink && this.rules.other.startATag.test(e[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(e[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(e[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(e[0]) && (this.lexer.state.inRawBlock = !1), { type: "html", raw: e[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: !1, text: e[0] };
604
+ }
605
+ link(t) {
606
+ let e = this.rules.inline.link.exec(t);
607
+ if (e) {
608
+ let n = e[2].trim();
609
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
610
+ if (!this.rules.other.endAngleBracket.test(n)) return;
611
+ let i = Ae(n.slice(0, -1), "\\");
612
+ if ((n.length - i.length) % 2 === 0) return;
613
+ } else {
614
+ let i = Xr(e[2], "()");
615
+ if (i === -2) return;
616
+ if (i > -1) {
617
+ let o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + i;
618
+ e[2] = e[2].substring(0, i), e[0] = e[0].substring(0, o).trim(), e[3] = "";
619
+ }
620
+ }
621
+ let r = e[2], s = "";
622
+ if (this.options.pedantic) {
623
+ let i = this.rules.other.pedanticHrefTitle.exec(r);
624
+ i && (r = i[1], s = i[3]);
625
+ } else s = e[3] ? e[3].slice(1, -1) : "";
626
+ return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), Yn(e, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: s && s.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
627
+ }
628
+ }
629
+ reflink(t, e) {
630
+ let n;
631
+ if ((n = this.rules.inline.reflink.exec(t)) || (n = this.rules.inline.nolink.exec(t))) {
632
+ let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), s = e[r.toLowerCase()];
633
+ if (!s) {
634
+ let i = n[0].charAt(0);
635
+ return { type: "text", raw: i, text: i };
636
+ }
637
+ return Yn(n, s, n[0], this.lexer, this.rules);
638
+ }
639
+ }
640
+ emStrong(t, e, n = "") {
641
+ let r = this.rules.inline.emStrongLDelim.exec(t);
642
+ if (!(!r || !r[1] && !r[2] && !r[3] && !r[4] || r[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(r[1] || r[3]) || !n || this.rules.inline.punctuation.exec(n))) {
643
+ let s = [...r[0]].length - 1, i, o, c = s, p = 0, l = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
644
+ for (l.lastIndex = 0, e = e.slice(-1 * t.length + s); (r = l.exec(e)) !== null; ) {
645
+ if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i) continue;
646
+ if (o = [...i].length, r[3] || r[4]) {
647
+ c += o;
648
+ continue;
649
+ } else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
650
+ p += o;
651
+ continue;
652
+ }
653
+ if (c -= o, c > 0) continue;
654
+ o = Math.min(o, o + c + p);
655
+ let g = [...r[0]][0].length, h = t.slice(0, s + r.index + g + o);
656
+ if (Math.min(s, o) % 2) {
657
+ let S = h.slice(1, -1);
658
+ return { type: "em", raw: h, text: S, tokens: this.lexer.inlineTokens(S) };
659
+ }
660
+ let T = h.slice(2, -2);
661
+ return { type: "strong", raw: h, text: T, tokens: this.lexer.inlineTokens(T) };
662
+ }
663
+ }
664
+ }
665
+ codespan(t) {
666
+ let e = this.rules.inline.code.exec(t);
667
+ if (e) {
668
+ let n = e[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), s = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
669
+ return r && s && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: e[0], text: n };
670
+ }
671
+ }
672
+ br(t) {
673
+ let e = this.rules.inline.br.exec(t);
674
+ if (e) return { type: "br", raw: e[0] };
675
+ }
676
+ del(t, e, n = "") {
677
+ let r = this.rules.inline.delLDelim.exec(t);
678
+ if (r && (!r[1] || !n || this.rules.inline.punctuation.exec(n))) {
679
+ let s = [...r[0]].length - 1, i, o, c = s, p = this.rules.inline.delRDelim;
680
+ for (p.lastIndex = 0, e = e.slice(-1 * t.length + s); (r = p.exec(e)) !== null; ) {
681
+ if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i || (o = [...i].length, o !== s)) continue;
682
+ if (r[3] || r[4]) {
683
+ c += o;
684
+ continue;
685
+ }
686
+ if (c -= o, c > 0) continue;
687
+ o = Math.min(o, o + c);
688
+ let l = [...r[0]][0].length, g = t.slice(0, s + r.index + l + o), h = g.slice(s, -s);
689
+ return { type: "del", raw: g, text: h, tokens: this.lexer.inlineTokens(h) };
690
+ }
691
+ }
692
+ }
693
+ autolink(t) {
694
+ let e = this.rules.inline.autolink.exec(t);
695
+ if (e) {
696
+ let n, r;
697
+ return e[2] === "@" ? (n = e[1], r = "mailto:" + n) : (n = e[1], r = n), { type: "link", raw: e[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
698
+ }
699
+ }
700
+ url(t) {
701
+ let e;
702
+ if (e = this.rules.inline.url.exec(t)) {
703
+ let n, r;
704
+ if (e[2] === "@") n = e[0], r = "mailto:" + n;
705
+ else {
706
+ let s;
707
+ do
708
+ s = e[0], e[0] = this.rules.inline._backpedal.exec(e[0])?.[0] ?? "";
709
+ while (s !== e[0]);
710
+ n = e[0], e[1] === "www." ? r = "http://" + e[0] : r = e[0];
711
+ }
712
+ return { type: "link", raw: e[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
713
+ }
714
+ }
715
+ inlineText(t) {
716
+ let e = this.rules.inline.text.exec(t);
717
+ if (e) {
718
+ let n = this.lexer.state.inRawBlock;
719
+ return { type: "text", raw: e[0], text: e[0], escaped: n };
720
+ }
721
+ }
722
+ }, ue = class ln {
723
+ tokens;
724
+ options;
725
+ state;
726
+ inlineQueue;
727
+ tokenizer;
728
+ constructor(e) {
729
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || We, this.options.tokenizer = this.options.tokenizer || new It(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
730
+ let n = { other: K, block: yt.normal, inline: ct.normal };
731
+ this.options.pedantic ? (n.block = yt.pedantic, n.inline = ct.pedantic) : this.options.gfm && (n.block = yt.gfm, this.options.breaks ? n.inline = ct.breaks : n.inline = ct.gfm), this.tokenizer.rules = n;
732
+ }
733
+ static get rules() {
734
+ return { block: yt, inline: ct };
735
+ }
736
+ static lex(e, n) {
737
+ return new ln(n).lex(e);
738
+ }
739
+ static lexInline(e, n) {
740
+ return new ln(n).inlineTokens(e);
741
+ }
742
+ lex(e) {
743
+ e = e.replace(K.carriageReturn, `
744
+ `), this.blockTokens(e, this.tokens);
745
+ for (let n = 0; n < this.inlineQueue.length; n++) {
746
+ let r = this.inlineQueue[n];
747
+ this.inlineTokens(r.src, r.tokens);
748
+ }
749
+ return this.inlineQueue = [], this.tokens;
750
+ }
751
+ blockTokens(e, n = [], r = !1) {
752
+ this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(K.tabCharGlobal, " ").replace(K.spaceLine, ""));
753
+ let s = 1 / 0;
754
+ for (; e; ) {
755
+ if (e.length < s) s = e.length;
756
+ else {
757
+ this.infiniteLoopError(e.charCodeAt(0));
758
+ break;
759
+ }
760
+ let i;
761
+ if (this.options.extensions?.block?.some((c) => (i = c.call({ lexer: this }, e, n)) ? (e = e.substring(i.raw.length), n.push(i), !0) : !1)) continue;
762
+ if (i = this.tokenizer.space(e)) {
763
+ e = e.substring(i.raw.length);
764
+ let c = n.at(-1);
765
+ i.raw.length === 1 && c !== void 0 ? c.raw += `
766
+ ` : n.push(i);
767
+ continue;
768
+ }
769
+ if (i = this.tokenizer.code(e)) {
770
+ e = e.substring(i.raw.length);
771
+ let c = n.at(-1);
772
+ c?.type === "paragraph" || c?.type === "text" ? (c.raw += (c.raw.endsWith(`
773
+ `) ? "" : `
774
+ `) + i.raw, c.text += `
775
+ ` + i.text, this.inlineQueue.at(-1).src = c.text) : n.push(i);
776
+ continue;
777
+ }
778
+ if (i = this.tokenizer.fences(e)) {
779
+ e = e.substring(i.raw.length), n.push(i);
780
+ continue;
781
+ }
782
+ if (i = this.tokenizer.heading(e)) {
783
+ e = e.substring(i.raw.length), n.push(i);
784
+ continue;
785
+ }
786
+ if (i = this.tokenizer.hr(e)) {
787
+ e = e.substring(i.raw.length), n.push(i);
788
+ continue;
789
+ }
790
+ if (i = this.tokenizer.blockquote(e)) {
791
+ e = e.substring(i.raw.length), n.push(i);
792
+ continue;
793
+ }
794
+ if (i = this.tokenizer.list(e)) {
795
+ e = e.substring(i.raw.length), n.push(i);
796
+ continue;
797
+ }
798
+ if (i = this.tokenizer.html(e)) {
799
+ e = e.substring(i.raw.length), n.push(i);
800
+ continue;
801
+ }
802
+ if (i = this.tokenizer.def(e)) {
803
+ e = e.substring(i.raw.length);
804
+ let c = n.at(-1);
805
+ c?.type === "paragraph" || c?.type === "text" ? (c.raw += (c.raw.endsWith(`
806
+ `) ? "" : `
807
+ `) + i.raw, c.text += `
808
+ ` + i.raw, this.inlineQueue.at(-1).src = c.text) : this.tokens.links[i.tag] || (this.tokens.links[i.tag] = { href: i.href, title: i.title }, n.push(i));
809
+ continue;
810
+ }
811
+ if (i = this.tokenizer.table(e)) {
812
+ e = e.substring(i.raw.length), n.push(i);
813
+ continue;
814
+ }
815
+ if (i = this.tokenizer.lheading(e)) {
816
+ e = e.substring(i.raw.length), n.push(i);
817
+ continue;
818
+ }
819
+ let o = e;
820
+ if (this.options.extensions?.startBlock) {
821
+ let c = 1 / 0, p = e.slice(1), l;
822
+ this.options.extensions.startBlock.forEach((g) => {
823
+ l = g.call({ lexer: this }, p), typeof l == "number" && l >= 0 && (c = Math.min(c, l));
824
+ }), c < 1 / 0 && c >= 0 && (o = e.substring(0, c + 1));
825
+ }
826
+ if (this.state.top && (i = this.tokenizer.paragraph(o))) {
827
+ let c = n.at(-1);
828
+ r && c?.type === "paragraph" ? (c.raw += (c.raw.endsWith(`
829
+ `) ? "" : `
830
+ `) + i.raw, c.text += `
831
+ ` + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = c.text) : n.push(i), r = o.length !== e.length, e = e.substring(i.raw.length);
832
+ continue;
833
+ }
834
+ if (i = this.tokenizer.text(e)) {
835
+ e = e.substring(i.raw.length);
836
+ let c = n.at(-1);
837
+ c?.type === "text" ? (c.raw += (c.raw.endsWith(`
838
+ `) ? "" : `
839
+ `) + i.raw, c.text += `
840
+ ` + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = c.text) : n.push(i);
841
+ continue;
842
+ }
843
+ if (e) {
844
+ this.infiniteLoopError(e.charCodeAt(0));
845
+ break;
846
+ }
847
+ }
848
+ return this.state.top = !0, n;
849
+ }
850
+ inline(e, n = []) {
851
+ return this.inlineQueue.push({ src: e, tokens: n }), n;
852
+ }
853
+ inlineTokens(e, n = []) {
854
+ this.tokenizer.lexer = this;
855
+ let r = e, s = null;
856
+ if (this.tokens.links) {
857
+ let l = Object.keys(this.tokens.links);
858
+ if (l.length > 0) for (; (s = this.tokenizer.rules.inline.reflinkSearch.exec(r)) !== null; ) l.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (r = r.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
859
+ }
860
+ for (; (s = this.tokenizer.rules.inline.anyPunctuation.exec(r)) !== null; ) r = r.slice(0, s.index) + "++" + r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
861
+ let i;
862
+ for (; (s = this.tokenizer.rules.inline.blockSkip.exec(r)) !== null; ) i = s[2] ? s[2].length : 0, r = r.slice(0, s.index + i) + "[" + "a".repeat(s[0].length - i - 2) + "]" + r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
863
+ r = this.options.hooks?.emStrongMask?.call({ lexer: this }, r) ?? r;
864
+ let o = !1, c = "", p = 1 / 0;
865
+ for (; e; ) {
866
+ if (e.length < p) p = e.length;
867
+ else {
868
+ this.infiniteLoopError(e.charCodeAt(0));
869
+ break;
870
+ }
871
+ o || (c = ""), o = !1;
872
+ let l;
873
+ if (this.options.extensions?.inline?.some((h) => (l = h.call({ lexer: this }, e, n)) ? (e = e.substring(l.raw.length), n.push(l), !0) : !1)) continue;
874
+ if (l = this.tokenizer.escape(e)) {
875
+ e = e.substring(l.raw.length), n.push(l);
876
+ continue;
877
+ }
878
+ if (l = this.tokenizer.tag(e)) {
879
+ e = e.substring(l.raw.length), n.push(l);
880
+ continue;
881
+ }
882
+ if (l = this.tokenizer.link(e)) {
883
+ e = e.substring(l.raw.length), n.push(l);
884
+ continue;
885
+ }
886
+ if (l = this.tokenizer.reflink(e, this.tokens.links)) {
887
+ e = e.substring(l.raw.length);
888
+ let h = n.at(-1);
889
+ l.type === "text" && h?.type === "text" ? (h.raw += l.raw, h.text += l.text) : n.push(l);
890
+ continue;
891
+ }
892
+ if (l = this.tokenizer.emStrong(e, r, c)) {
893
+ e = e.substring(l.raw.length), n.push(l);
894
+ continue;
895
+ }
896
+ if (l = this.tokenizer.codespan(e)) {
897
+ e = e.substring(l.raw.length), n.push(l);
898
+ continue;
899
+ }
900
+ if (l = this.tokenizer.br(e)) {
901
+ e = e.substring(l.raw.length), n.push(l);
902
+ continue;
903
+ }
904
+ if (l = this.tokenizer.del(e, r, c)) {
905
+ e = e.substring(l.raw.length), n.push(l);
906
+ continue;
907
+ }
908
+ if (l = this.tokenizer.autolink(e)) {
909
+ e = e.substring(l.raw.length), n.push(l);
910
+ continue;
911
+ }
912
+ if (!this.state.inLink && (l = this.tokenizer.url(e))) {
913
+ e = e.substring(l.raw.length), n.push(l);
914
+ continue;
915
+ }
916
+ let g = e;
917
+ if (this.options.extensions?.startInline) {
918
+ let h = 1 / 0, T = e.slice(1), S;
919
+ this.options.extensions.startInline.forEach((y) => {
920
+ S = y.call({ lexer: this }, T), typeof S == "number" && S >= 0 && (h = Math.min(h, S));
921
+ }), h < 1 / 0 && h >= 0 && (g = e.substring(0, h + 1));
922
+ }
923
+ if (l = this.tokenizer.inlineText(g)) {
924
+ e = e.substring(l.raw.length), l.raw.slice(-1) !== "_" && (c = l.raw.slice(-1)), o = !0;
925
+ let h = n.at(-1);
926
+ h?.type === "text" ? (h.raw += l.raw, h.text += l.text) : n.push(l);
927
+ continue;
928
+ }
929
+ if (e) {
930
+ this.infiniteLoopError(e.charCodeAt(0));
931
+ break;
932
+ }
933
+ }
934
+ return n;
935
+ }
936
+ infiniteLoopError(e) {
937
+ let n = "Infinite loop on byte: " + e;
938
+ if (this.options.silent) console.error(n);
939
+ else throw new Error(n);
940
+ }
941
+ }, Lt = class {
942
+ options;
943
+ parser;
944
+ constructor(t) {
945
+ this.options = t || We;
946
+ }
947
+ space(t) {
948
+ return "";
949
+ }
950
+ code({ text: t, lang: e, escaped: n }) {
951
+ let r = (e || "").match(K.notSpaceStart)?.[0], s = t.replace(K.endingNewline, "") + `
952
+ `;
953
+ return r ? '<pre><code class="language-' + ge(r) + '">' + (n ? s : ge(s, !0)) + `</code></pre>
954
+ ` : "<pre><code>" + (n ? s : ge(s, !0)) + `</code></pre>
955
+ `;
956
+ }
957
+ blockquote({ tokens: t }) {
958
+ return `<blockquote>
959
+ ${this.parser.parse(t)}</blockquote>
960
+ `;
961
+ }
962
+ html({ text: t }) {
963
+ return t;
964
+ }
965
+ def(t) {
966
+ return "";
967
+ }
968
+ heading({ tokens: t, depth: e }) {
969
+ return `<h${e}>${this.parser.parseInline(t)}</h${e}>
970
+ `;
971
+ }
972
+ hr(t) {
973
+ return `<hr>
974
+ `;
975
+ }
976
+ list(t) {
977
+ let e = t.ordered, n = t.start, r = "";
978
+ for (let o = 0; o < t.items.length; o++) {
979
+ let c = t.items[o];
980
+ r += this.listitem(c);
981
+ }
982
+ let s = e ? "ol" : "ul", i = e && n !== 1 ? ' start="' + n + '"' : "";
983
+ return "<" + s + i + `>
984
+ ` + r + "</" + s + `>
985
+ `;
986
+ }
987
+ listitem(t) {
988
+ return `<li>${this.parser.parse(t.tokens)}</li>
989
+ `;
990
+ }
991
+ checkbox({ checked: t }) {
992
+ return "<input " + (t ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
993
+ }
994
+ paragraph({ tokens: t }) {
995
+ return `<p>${this.parser.parseInline(t)}</p>
996
+ `;
997
+ }
998
+ table(t) {
999
+ let e = "", n = "";
1000
+ for (let s = 0; s < t.header.length; s++) n += this.tablecell(t.header[s]);
1001
+ e += this.tablerow({ text: n });
1002
+ let r = "";
1003
+ for (let s = 0; s < t.rows.length; s++) {
1004
+ let i = t.rows[s];
1005
+ n = "";
1006
+ for (let o = 0; o < i.length; o++) n += this.tablecell(i[o]);
1007
+ r += this.tablerow({ text: n });
1008
+ }
1009
+ return r && (r = `<tbody>${r}</tbody>`), `<table>
1010
+ <thead>
1011
+ ` + e + `</thead>
1012
+ ` + r + `</table>
1013
+ `;
1014
+ }
1015
+ tablerow({ text: t }) {
1016
+ return `<tr>
1017
+ ${t}</tr>
1018
+ `;
1019
+ }
1020
+ tablecell(t) {
1021
+ let e = this.parser.parseInline(t.tokens), n = t.header ? "th" : "td";
1022
+ return (t.align ? `<${n} align="${t.align}">` : `<${n}>`) + e + `</${n}>
1023
+ `;
1024
+ }
1025
+ strong({ tokens: t }) {
1026
+ return `<strong>${this.parser.parseInline(t)}</strong>`;
1027
+ }
1028
+ em({ tokens: t }) {
1029
+ return `<em>${this.parser.parseInline(t)}</em>`;
1030
+ }
1031
+ codespan({ text: t }) {
1032
+ return `<code>${ge(t, !0)}</code>`;
1033
+ }
1034
+ br(t) {
1035
+ return "<br>";
1036
+ }
1037
+ del({ tokens: t }) {
1038
+ return `<del>${this.parser.parseInline(t)}</del>`;
1039
+ }
1040
+ link({ href: t, title: e, tokens: n }) {
1041
+ let r = this.parser.parseInline(n), s = Xn(t);
1042
+ if (s === null) return r;
1043
+ t = s;
1044
+ let i = '<a href="' + t + '"';
1045
+ return e && (i += ' title="' + ge(e) + '"'), i += ">" + r + "</a>", i;
1046
+ }
1047
+ image({ href: t, title: e, text: n, tokens: r }) {
1048
+ r && (n = this.parser.parseInline(r, this.parser.textRenderer));
1049
+ let s = Xn(t);
1050
+ if (s === null) return ge(n);
1051
+ t = s;
1052
+ let i = `<img src="${t}" alt="${ge(n)}"`;
1053
+ return e && (i += ` title="${ge(e)}"`), i += ">", i;
1054
+ }
1055
+ text(t) {
1056
+ return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : ge(t.text);
1057
+ }
1058
+ }, wn = class {
1059
+ strong({ text: t }) {
1060
+ return t;
1061
+ }
1062
+ em({ text: t }) {
1063
+ return t;
1064
+ }
1065
+ codespan({ text: t }) {
1066
+ return t;
1067
+ }
1068
+ del({ text: t }) {
1069
+ return t;
1070
+ }
1071
+ html({ text: t }) {
1072
+ return t;
1073
+ }
1074
+ text({ text: t }) {
1075
+ return t;
1076
+ }
1077
+ link({ text: t }) {
1078
+ return "" + t;
1079
+ }
1080
+ image({ text: t }) {
1081
+ return "" + t;
1082
+ }
1083
+ br() {
1084
+ return "";
1085
+ }
1086
+ checkbox({ raw: t }) {
1087
+ return t;
1088
+ }
1089
+ }, pe = class cn {
1090
+ options;
1091
+ renderer;
1092
+ textRenderer;
1093
+ constructor(e) {
1094
+ this.options = e || We, this.options.renderer = this.options.renderer || new Lt(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new wn();
1095
+ }
1096
+ static parse(e, n) {
1097
+ return new cn(n).parse(e);
1098
+ }
1099
+ static parseInline(e, n) {
1100
+ return new cn(n).parseInline(e);
1101
+ }
1102
+ parse(e) {
1103
+ this.renderer.parser = this;
1104
+ let n = "";
1105
+ for (let r = 0; r < e.length; r++) {
1106
+ let s = e[r];
1107
+ if (this.options.extensions?.renderers?.[s.type]) {
1108
+ let o = s, c = this.options.extensions.renderers[o.type].call({ parser: this }, o);
1109
+ if (c !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(o.type)) {
1110
+ n += c || "";
1111
+ continue;
1112
+ }
1113
+ }
1114
+ let i = s;
1115
+ switch (i.type) {
1116
+ case "space": {
1117
+ n += this.renderer.space(i);
1118
+ break;
1119
+ }
1120
+ case "hr": {
1121
+ n += this.renderer.hr(i);
1122
+ break;
1123
+ }
1124
+ case "heading": {
1125
+ n += this.renderer.heading(i);
1126
+ break;
1127
+ }
1128
+ case "code": {
1129
+ n += this.renderer.code(i);
1130
+ break;
1131
+ }
1132
+ case "table": {
1133
+ n += this.renderer.table(i);
1134
+ break;
1135
+ }
1136
+ case "blockquote": {
1137
+ n += this.renderer.blockquote(i);
1138
+ break;
1139
+ }
1140
+ case "list": {
1141
+ n += this.renderer.list(i);
1142
+ break;
1143
+ }
1144
+ case "checkbox": {
1145
+ n += this.renderer.checkbox(i);
1146
+ break;
1147
+ }
1148
+ case "html": {
1149
+ n += this.renderer.html(i);
1150
+ break;
1151
+ }
1152
+ case "def": {
1153
+ n += this.renderer.def(i);
1154
+ break;
1155
+ }
1156
+ case "paragraph": {
1157
+ n += this.renderer.paragraph(i);
1158
+ break;
1159
+ }
1160
+ case "text": {
1161
+ n += this.renderer.text(i);
1162
+ break;
1163
+ }
1164
+ default: {
1165
+ let o = 'Token with "' + i.type + '" type was not found.';
1166
+ if (this.options.silent) return console.error(o), "";
1167
+ throw new Error(o);
1168
+ }
1169
+ }
1170
+ }
1171
+ return n;
1172
+ }
1173
+ parseInline(e, n = this.renderer) {
1174
+ this.renderer.parser = this;
1175
+ let r = "";
1176
+ for (let s = 0; s < e.length; s++) {
1177
+ let i = e[s];
1178
+ if (this.options.extensions?.renderers?.[i.type]) {
1179
+ let c = this.options.extensions.renderers[i.type].call({ parser: this }, i);
1180
+ if (c !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
1181
+ r += c || "";
1182
+ continue;
1183
+ }
1184
+ }
1185
+ let o = i;
1186
+ switch (o.type) {
1187
+ case "escape": {
1188
+ r += n.text(o);
1189
+ break;
1190
+ }
1191
+ case "html": {
1192
+ r += n.html(o);
1193
+ break;
1194
+ }
1195
+ case "link": {
1196
+ r += n.link(o);
1197
+ break;
1198
+ }
1199
+ case "image": {
1200
+ r += n.image(o);
1201
+ break;
1202
+ }
1203
+ case "checkbox": {
1204
+ r += n.checkbox(o);
1205
+ break;
1206
+ }
1207
+ case "strong": {
1208
+ r += n.strong(o);
1209
+ break;
1210
+ }
1211
+ case "em": {
1212
+ r += n.em(o);
1213
+ break;
1214
+ }
1215
+ case "codespan": {
1216
+ r += n.codespan(o);
1217
+ break;
1218
+ }
1219
+ case "br": {
1220
+ r += n.br(o);
1221
+ break;
1222
+ }
1223
+ case "del": {
1224
+ r += n.del(o);
1225
+ break;
1226
+ }
1227
+ case "text": {
1228
+ r += n.text(o);
1229
+ break;
1230
+ }
1231
+ default: {
1232
+ let c = 'Token with "' + o.type + '" type was not found.';
1233
+ if (this.options.silent) return console.error(c), "";
1234
+ throw new Error(c);
1235
+ }
1236
+ }
1237
+ }
1238
+ return r;
1239
+ }
1240
+ }, pt = class {
1241
+ options;
1242
+ block;
1243
+ constructor(t) {
1244
+ this.options = t || We;
1245
+ }
1246
+ static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
1247
+ static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
1248
+ preprocess(t) {
1249
+ return t;
1250
+ }
1251
+ postprocess(t) {
1252
+ return t;
1253
+ }
1254
+ processAllTokens(t) {
1255
+ return t;
1256
+ }
1257
+ emStrongMask(t) {
1258
+ return t;
1259
+ }
1260
+ provideLexer(t = this.block) {
1261
+ return t ? ue.lex : ue.lexInline;
1262
+ }
1263
+ provideParser(t = this.block) {
1264
+ return t ? pe.parse : pe.parseInline;
1265
+ }
1266
+ }, Yr = class {
1267
+ defaults = fn();
1268
+ options = this.setOptions;
1269
+ parse = this.parseMarkdown(!0);
1270
+ parseInline = this.parseMarkdown(!1);
1271
+ Parser = pe;
1272
+ Renderer = Lt;
1273
+ TextRenderer = wn;
1274
+ Lexer = ue;
1275
+ Tokenizer = It;
1276
+ Hooks = pt;
1277
+ constructor(...t) {
1278
+ this.use(...t);
1279
+ }
1280
+ walkTokens(t, e) {
1281
+ let n = [];
1282
+ for (let r of t) switch (n = n.concat(e.call(this, r)), r.type) {
1283
+ case "table": {
1284
+ let s = r;
1285
+ for (let i of s.header) n = n.concat(this.walkTokens(i.tokens, e));
1286
+ for (let i of s.rows) for (let o of i) n = n.concat(this.walkTokens(o.tokens, e));
1287
+ break;
1288
+ }
1289
+ case "list": {
1290
+ let s = r;
1291
+ n = n.concat(this.walkTokens(s.items, e));
1292
+ break;
1293
+ }
1294
+ default: {
1295
+ let s = r;
1296
+ this.defaults.extensions?.childTokens?.[s.type] ? this.defaults.extensions.childTokens[s.type].forEach((i) => {
1297
+ let o = s[i].flat(1 / 0);
1298
+ n = n.concat(this.walkTokens(o, e));
1299
+ }) : s.tokens && (n = n.concat(this.walkTokens(s.tokens, e)));
1300
+ }
1301
+ }
1302
+ return n;
1303
+ }
1304
+ use(...t) {
1305
+ let e = this.defaults.extensions || { renderers: {}, childTokens: {} };
1306
+ return t.forEach((n) => {
1307
+ let r = { ...n };
1308
+ if (r.async = this.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((s) => {
1309
+ if (!s.name) throw new Error("extension name required");
1310
+ if ("renderer" in s) {
1311
+ let i = e.renderers[s.name];
1312
+ i ? e.renderers[s.name] = function(...o) {
1313
+ let c = s.renderer.apply(this, o);
1314
+ return c === !1 && (c = i.apply(this, o)), c;
1315
+ } : e.renderers[s.name] = s.renderer;
1316
+ }
1317
+ if ("tokenizer" in s) {
1318
+ if (!s.level || s.level !== "block" && s.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
1319
+ let i = e[s.level];
1320
+ i ? i.unshift(s.tokenizer) : e[s.level] = [s.tokenizer], s.start && (s.level === "block" ? e.startBlock ? e.startBlock.push(s.start) : e.startBlock = [s.start] : s.level === "inline" && (e.startInline ? e.startInline.push(s.start) : e.startInline = [s.start]));
1321
+ }
1322
+ "childTokens" in s && s.childTokens && (e.childTokens[s.name] = s.childTokens);
1323
+ }), r.extensions = e), n.renderer) {
1324
+ let s = this.defaults.renderer || new Lt(this.defaults);
1325
+ for (let i in n.renderer) {
1326
+ if (!(i in s)) throw new Error(`renderer '${i}' does not exist`);
1327
+ if (["options", "parser"].includes(i)) continue;
1328
+ let o = i, c = n.renderer[o], p = s[o];
1329
+ s[o] = (...l) => {
1330
+ let g = c.apply(s, l);
1331
+ return g === !1 && (g = p.apply(s, l)), g || "";
1332
+ };
1333
+ }
1334
+ r.renderer = s;
1335
+ }
1336
+ if (n.tokenizer) {
1337
+ let s = this.defaults.tokenizer || new It(this.defaults);
1338
+ for (let i in n.tokenizer) {
1339
+ if (!(i in s)) throw new Error(`tokenizer '${i}' does not exist`);
1340
+ if (["options", "rules", "lexer"].includes(i)) continue;
1341
+ let o = i, c = n.tokenizer[o], p = s[o];
1342
+ s[o] = (...l) => {
1343
+ let g = c.apply(s, l);
1344
+ return g === !1 && (g = p.apply(s, l)), g;
1345
+ };
1346
+ }
1347
+ r.tokenizer = s;
1348
+ }
1349
+ if (n.hooks) {
1350
+ let s = this.defaults.hooks || new pt();
1351
+ for (let i in n.hooks) {
1352
+ if (!(i in s)) throw new Error(`hook '${i}' does not exist`);
1353
+ if (["options", "block"].includes(i)) continue;
1354
+ let o = i, c = n.hooks[o], p = s[o];
1355
+ pt.passThroughHooks.has(i) ? s[o] = (l) => {
1356
+ if (this.defaults.async && pt.passThroughHooksRespectAsync.has(i)) return (async () => {
1357
+ let h = await c.call(s, l);
1358
+ return p.call(s, h);
1359
+ })();
1360
+ let g = c.call(s, l);
1361
+ return p.call(s, g);
1362
+ } : s[o] = (...l) => {
1363
+ if (this.defaults.async) return (async () => {
1364
+ let h = await c.apply(s, l);
1365
+ return h === !1 && (h = await p.apply(s, l)), h;
1366
+ })();
1367
+ let g = c.apply(s, l);
1368
+ return g === !1 && (g = p.apply(s, l)), g;
1369
+ };
1370
+ }
1371
+ r.hooks = s;
1372
+ }
1373
+ if (n.walkTokens) {
1374
+ let s = this.defaults.walkTokens, i = n.walkTokens;
1375
+ r.walkTokens = function(o) {
1376
+ let c = [];
1377
+ return c.push(i.call(this, o)), s && (c = c.concat(s.call(this, o))), c;
1378
+ };
1379
+ }
1380
+ this.defaults = { ...this.defaults, ...r };
1381
+ }), this;
1382
+ }
1383
+ setOptions(t) {
1384
+ return this.defaults = { ...this.defaults, ...t }, this;
1385
+ }
1386
+ lexer(t, e) {
1387
+ return ue.lex(t, e ?? this.defaults);
1388
+ }
1389
+ parser(t, e) {
1390
+ return pe.parse(t, e ?? this.defaults);
1391
+ }
1392
+ parseMarkdown(t) {
1393
+ return (e, n) => {
1394
+ let r = { ...n }, s = { ...this.defaults, ...r }, i = this.onError(!!s.silent, !!s.async);
1395
+ if (this.defaults.async === !0 && r.async === !1) return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
1396
+ if (typeof e > "u" || e === null) return i(new Error("marked(): input parameter is undefined or null"));
1397
+ if (typeof e != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
1398
+ if (s.hooks && (s.hooks.options = s, s.hooks.block = t), s.async) return (async () => {
1399
+ let o = s.hooks ? await s.hooks.preprocess(e) : e, c = await (s.hooks ? await s.hooks.provideLexer(t) : t ? ue.lex : ue.lexInline)(o, s), p = s.hooks ? await s.hooks.processAllTokens(c) : c;
1400
+ s.walkTokens && await Promise.all(this.walkTokens(p, s.walkTokens));
1401
+ let l = await (s.hooks ? await s.hooks.provideParser(t) : t ? pe.parse : pe.parseInline)(p, s);
1402
+ return s.hooks ? await s.hooks.postprocess(l) : l;
1403
+ })().catch(i);
1404
+ try {
1405
+ s.hooks && (e = s.hooks.preprocess(e));
1406
+ let o = (s.hooks ? s.hooks.provideLexer(t) : t ? ue.lex : ue.lexInline)(e, s);
1407
+ s.hooks && (o = s.hooks.processAllTokens(o)), s.walkTokens && this.walkTokens(o, s.walkTokens);
1408
+ let c = (s.hooks ? s.hooks.provideParser(t) : t ? pe.parse : pe.parseInline)(o, s);
1409
+ return s.hooks && (c = s.hooks.postprocess(c)), c;
1410
+ } catch (o) {
1411
+ return i(o);
1412
+ }
1413
+ };
1414
+ }
1415
+ onError(t, e) {
1416
+ return (n) => {
1417
+ if (n.message += `
1418
+ Please report this to https://github.com/markedjs/marked.`, t) {
1419
+ let r = "<p>An error occurred:</p><pre>" + ge(n.message + "", !0) + "</pre>";
1420
+ return e ? Promise.resolve(r) : r;
1421
+ }
1422
+ if (e) return Promise.reject(n);
1423
+ throw n;
1424
+ };
1425
+ }
1426
+ }, He = new Yr();
1427
+ function L(t, e) {
1428
+ return He.parse(t, e);
1429
+ }
1430
+ L.options = L.setOptions = function(t) {
1431
+ return He.setOptions(t), L.defaults = He.defaults, ms(L.defaults), L;
1432
+ };
1433
+ L.getDefaults = fn;
1434
+ L.defaults = We;
1435
+ L.use = function(...t) {
1436
+ return He.use(...t), L.defaults = He.defaults, ms(L.defaults), L;
1437
+ };
1438
+ L.walkTokens = function(t, e) {
1439
+ return He.walkTokens(t, e);
1440
+ };
1441
+ L.parseInline = He.parseInline;
1442
+ L.Parser = pe;
1443
+ L.parser = pe.parse;
1444
+ L.Renderer = Lt;
1445
+ L.TextRenderer = wn;
1446
+ L.Lexer = ue;
1447
+ L.lexer = ue.lex;
1448
+ L.Tokenizer = It;
1449
+ L.Hooks = pt;
1450
+ L.parse = L;
1451
+ L.options;
1452
+ L.setOptions;
1453
+ L.use;
1454
+ L.walkTokens;
1455
+ L.parseInline;
1456
+ pe.parse;
1457
+ ue.lex;
1458
+ function Qn(t, e) {
1459
+ (e == null || e > t.length) && (e = t.length);
1460
+ for (var n = 0, r = Array(e); n < e; n++) r[n] = t[n];
1461
+ return r;
1462
+ }
1463
+ function Qr(t) {
1464
+ if (Array.isArray(t)) return t;
1465
+ }
1466
+ function Kr(t, e) {
1467
+ var n = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
1468
+ if (n != null) {
1469
+ var r, s, i, o, c = [], p = !0, l = !1;
1470
+ try {
1471
+ if (i = (n = n.call(t)).next, e !== 0) for (; !(p = (r = i.call(n)).done) && (c.push(r.value), c.length !== e); p = !0) ;
1472
+ } catch (g) {
1473
+ l = !0, s = g;
1474
+ } finally {
1475
+ try {
1476
+ if (!p && n.return != null && (o = n.return(), Object(o) !== o)) return;
1477
+ } finally {
1478
+ if (l) throw s;
1479
+ }
1480
+ }
1481
+ return c;
1482
+ }
1483
+ }
1484
+ function Jr() {
1485
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1486
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1487
+ }
1488
+ function ei(t, e) {
1489
+ return Qr(t) || Kr(t, e) || ti(t, e) || Jr();
1490
+ }
1491
+ function ti(t, e) {
1492
+ if (t) {
1493
+ if (typeof t == "string") return Qn(t, e);
1494
+ var n = {}.toString.call(t).slice(8, -1);
1495
+ return n === "Object" && t.constructor && (n = t.constructor.name), n === "Map" || n === "Set" ? Array.from(t) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Qn(t, e) : void 0;
1496
+ }
1497
+ }
1498
+ const Es = Object.entries, Kn = Object.setPrototypeOf, ni = Object.isFrozen, si = Object.getPrototypeOf, ri = Object.getOwnPropertyDescriptor;
1499
+ let te = Object.freeze, oe = Object.seal, nt = Object.create, Rs = typeof Reflect < "u" && Reflect, un = Rs.apply, pn = Rs.construct;
1500
+ te || (te = function(e) {
1501
+ return e;
1502
+ });
1503
+ oe || (oe = function(e) {
1504
+ return e;
1505
+ });
1506
+ un || (un = function(e, n) {
1507
+ for (var r = arguments.length, s = new Array(r > 2 ? r - 2 : 0), i = 2; i < r; i++)
1508
+ s[i - 2] = arguments[i];
1509
+ return e.apply(n, s);
1510
+ });
1511
+ pn || (pn = function(e) {
1512
+ for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), s = 1; s < n; s++)
1513
+ r[s - 1] = arguments[s];
1514
+ return new e(...r);
1515
+ });
1516
+ const Ke = F(Array.prototype.forEach), ii = F(Array.prototype.lastIndexOf), Jn = F(Array.prototype.pop), Je = F(Array.prototype.push), ai = F(Array.prototype.splice), ee = Array.isArray, ht = F(String.prototype.toLowerCase), en = F(String.prototype.toString), es = F(String.prototype.match), et = F(String.prototype.replace), ts = F(String.prototype.indexOf), oi = F(String.prototype.trim), li = F(Number.prototype.toString), ci = F(Boolean.prototype.toString), ns = typeof BigInt > "u" ? null : F(BigInt.prototype.toString), ss = typeof Symbol > "u" ? null : F(Symbol.prototype.toString), N = F(Object.prototype.hasOwnProperty), ut = F(Object.prototype.toString), V = F(RegExp.prototype.test), At = ui(TypeError);
1517
+ function F(t) {
1518
+ return function(e) {
1519
+ e instanceof RegExp && (e.lastIndex = 0);
1520
+ for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), s = 1; s < n; s++)
1521
+ r[s - 1] = arguments[s];
1522
+ return un(t, e, r);
1523
+ };
1524
+ }
1525
+ function ui(t) {
1526
+ return function() {
1527
+ for (var e = arguments.length, n = new Array(e), r = 0; r < e; r++)
1528
+ n[r] = arguments[r];
1529
+ return pn(t, n);
1530
+ };
1531
+ }
1532
+ function _(t, e) {
1533
+ let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ht;
1534
+ if (Kn && Kn(t, null), !ee(e))
1535
+ return t;
1536
+ let r = e.length;
1537
+ for (; r--; ) {
1538
+ let s = e[r];
1539
+ if (typeof s == "string") {
1540
+ const i = n(s);
1541
+ i !== s && (ni(e) || (e[r] = i), s = i);
1542
+ }
1543
+ t[s] = !0;
1544
+ }
1545
+ return t;
1546
+ }
1547
+ function pi(t) {
1548
+ for (let e = 0; e < t.length; e++)
1549
+ N(t, e) || (t[e] = null);
1550
+ return t;
1551
+ }
1552
+ function re(t) {
1553
+ const e = nt(null);
1554
+ for (const r of Es(t)) {
1555
+ var n = ei(r, 2);
1556
+ const s = n[0], i = n[1];
1557
+ N(t, s) && (ee(i) ? e[s] = pi(i) : i && typeof i == "object" && i.constructor === Object ? e[s] = re(i) : e[s] = i);
1558
+ }
1559
+ return e;
1560
+ }
1561
+ function hi(t) {
1562
+ switch (typeof t) {
1563
+ case "string":
1564
+ return t;
1565
+ case "number":
1566
+ return li(t);
1567
+ case "boolean":
1568
+ return ci(t);
1569
+ case "bigint":
1570
+ return ns ? ns(t) : "0";
1571
+ case "symbol":
1572
+ return ss ? ss(t) : "Symbol()";
1573
+ case "undefined":
1574
+ return ut(t);
1575
+ case "function":
1576
+ case "object": {
1577
+ if (t === null)
1578
+ return ut(t);
1579
+ const e = t, n = Ue(e, "toString");
1580
+ if (typeof n == "function") {
1581
+ const r = n(e);
1582
+ return typeof r == "string" ? r : ut(r);
1583
+ }
1584
+ return ut(t);
1585
+ }
1586
+ default:
1587
+ return ut(t);
1588
+ }
1589
+ }
1590
+ function Ue(t, e) {
1591
+ for (; t !== null; ) {
1592
+ const r = ri(t, e);
1593
+ if (r) {
1594
+ if (r.get)
1595
+ return F(r.get);
1596
+ if (typeof r.value == "function")
1597
+ return F(r.value);
1598
+ }
1599
+ t = si(t);
1600
+ }
1601
+ function n() {
1602
+ return null;
1603
+ }
1604
+ return n;
1605
+ }
1606
+ function di(t) {
1607
+ try {
1608
+ return V(t, ""), !0;
1609
+ } catch {
1610
+ return !1;
1611
+ }
1612
+ }
1613
+ const rs = te(["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"]), tn = te(["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"]), nn = te(["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"]), fi = te(["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"]), sn = te(["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"]), gi = te(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), is = te(["#text"]), as = te(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "command", "commandfor", "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"]), rn = te(["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"]), os = te(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "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"]), Et = te(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), mi = oe(/{{[\w\W]*|^[\w\W]*}}/g), ki = oe(/<%[\w\W]*|^[\w\W]*%>/g), bi = oe(/\${[\w\W]*/g), Ti = oe(/^data-[\-\w.\u00B7-\uFFFF]+$/), _i = oe(/^aria-[\-\w]+$/), ls = oe(
1614
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
1615
+ // eslint-disable-line no-useless-escape
1616
+ ), xi = oe(/^(?:\w+script|data):/i), wi = oe(
1617
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
1618
+ // eslint-disable-line no-control-regex
1619
+ ), Si = oe(/^html$/i), yi = oe(/^[a-z][.\w]*(-[.\w]+)+$/i), tt = {
1620
+ element: 1,
1621
+ text: 3,
1622
+ // Deprecated
1623
+ progressingInstruction: 7,
1624
+ comment: 8,
1625
+ document: 9
1626
+ }, Ai = function() {
1627
+ return typeof window > "u" ? null : window;
1628
+ }, Ei = function(e, n) {
1629
+ if (typeof e != "object" || typeof e.createPolicy != "function")
1630
+ return null;
1631
+ let r = null;
1632
+ const s = "data-tt-policy-suffix";
1633
+ n && n.hasAttribute(s) && (r = n.getAttribute(s));
1634
+ const i = "dompurify" + (r ? "#" + r : "");
1635
+ try {
1636
+ return e.createPolicy(i, {
1637
+ createHTML(o) {
1638
+ return o;
1639
+ },
1640
+ createScriptURL(o) {
1641
+ return o;
1642
+ }
1643
+ });
1644
+ } catch {
1645
+ return console.warn("TrustedTypes policy " + i + " could not be created."), null;
1646
+ }
1647
+ }, cs = function() {
1648
+ return {
1649
+ afterSanitizeAttributes: [],
1650
+ afterSanitizeElements: [],
1651
+ afterSanitizeShadowDOM: [],
1652
+ beforeSanitizeAttributes: [],
1653
+ beforeSanitizeElements: [],
1654
+ beforeSanitizeShadowDOM: [],
1655
+ uponSanitizeAttribute: [],
1656
+ uponSanitizeElement: [],
1657
+ uponSanitizeShadowNode: []
1658
+ };
1659
+ };
1660
+ function vs() {
1661
+ let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Ai();
1662
+ const e = (m) => vs(m);
1663
+ if (e.version = "3.4.5", e.removed = [], !t || !t.document || t.document.nodeType !== tt.document || !t.Element)
1664
+ return e.isSupported = !1, e;
1665
+ let n = t.document;
1666
+ const r = n, s = r.currentScript, i = t.DocumentFragment, o = t.HTMLTemplateElement, c = t.Node, p = t.Element, l = t.NodeFilter, g = t.NamedNodeMap, h = g === void 0 ? t.NamedNodeMap || t.MozNamedAttrMap : g, T = t.HTMLFormElement, S = t.DOMParser, y = t.trustedTypes, W = p.prototype, me = Ue(W, "cloneNode"), Ie = Ue(W, "remove"), Le = Ue(W, "nextSibling"), Be = Ue(W, "childNodes"), he = Ue(W, "parentNode"), Te = c && c.prototype ? Ue(c.prototype, "nodeType") : null;
1667
+ if (typeof o == "function") {
1668
+ const m = n.createElement("template");
1669
+ m.content && m.content.ownerDocument && (n = m.content.ownerDocument);
1670
+ }
1671
+ let D, Ce = "";
1672
+ const Ge = n, le = Ge.implementation, Oe = Ge.createNodeIterator, je = Ge.createDocumentFragment, Y = Ge.getElementsByTagName, Nt = r.importNode;
1673
+ let X = cs();
1674
+ e.isSupported = typeof Es == "function" && typeof he == "function" && le && le.createHTMLDocument !== void 0;
1675
+ const _e = mi, xe = ki, we = bi, it = Ti, mt = _i, Pt = xi, at = wi, $t = yi;
1676
+ let kt = ls, $ = null;
1677
+ const bt = _({}, [...rs, ...tn, ...nn, ...sn, ...is]);
1678
+ let P = null;
1679
+ const Tt = _({}, [...as, ...rn, ...os, ...Et]);
1680
+ let M = Object.seal(nt(null, {
1681
+ tagNameCheck: {
1682
+ writable: !0,
1683
+ configurable: !1,
1684
+ enumerable: !0,
1685
+ value: null
1686
+ },
1687
+ attributeNameCheck: {
1688
+ writable: !0,
1689
+ configurable: !1,
1690
+ enumerable: !0,
1691
+ value: null
1692
+ },
1693
+ allowCustomizedBuiltInElements: {
1694
+ writable: !0,
1695
+ configurable: !1,
1696
+ enumerable: !0,
1697
+ value: !1
1698
+ }
1699
+ })), De = null, Me = null;
1700
+ const f = Object.seal(nt(null, {
1701
+ tagCheck: {
1702
+ writable: !0,
1703
+ configurable: !1,
1704
+ enumerable: !0,
1705
+ value: null
1706
+ },
1707
+ attributeCheck: {
1708
+ writable: !0,
1709
+ configurable: !1,
1710
+ enumerable: !0,
1711
+ value: null
1712
+ }
1713
+ }));
1714
+ let k = !0, C = !0, B = !1, G = !0, j = !1, ne = !0, O = !1, J = !1, qe = !1, Se = !1, Ne = !1, Pe = !1, $e = !0, Q = !1;
1715
+ const Sn = "user-content-";
1716
+ let zt = !0, ot = !1, Xe = {}, de = null;
1717
+ const Ut = _({}, ["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"]);
1718
+ let yn = null;
1719
+ const An = _({}, ["audio", "video", "img", "source", "image", "track"]);
1720
+ let Ft = null;
1721
+ const En = _({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), _t = "http://www.w3.org/1998/Math/MathML", xt = "http://www.w3.org/2000/svg", fe = "http://www.w3.org/1999/xhtml";
1722
+ let Ve = fe, Ht = !1, Wt = null;
1723
+ const Ls = _({}, [_t, xt, fe], en);
1724
+ let Bt = _({}, ["mi", "mo", "mn", "ms", "mtext"]), Gt = _({}, ["annotation-xml"]);
1725
+ const Cs = _({}, ["title", "style", "font", "a", "script"]);
1726
+ let lt = null;
1727
+ const Os = ["application/xhtml+xml", "text/html"], Ds = "text/html";
1728
+ let H = null, Ze = null;
1729
+ const Ms = n.createElement("form"), Rn = function(a) {
1730
+ return a instanceof RegExp || a instanceof Function;
1731
+ }, jt = function() {
1732
+ let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1733
+ if (Ze && Ze === a)
1734
+ return;
1735
+ (!a || typeof a != "object") && (a = {}), a = re(a), lt = // eslint-disable-next-line unicorn/prefer-includes
1736
+ Os.indexOf(a.PARSER_MEDIA_TYPE) === -1 ? Ds : a.PARSER_MEDIA_TYPE, H = lt === "application/xhtml+xml" ? en : ht, $ = N(a, "ALLOWED_TAGS") && ee(a.ALLOWED_TAGS) ? _({}, a.ALLOWED_TAGS, H) : bt, P = N(a, "ALLOWED_ATTR") && ee(a.ALLOWED_ATTR) ? _({}, a.ALLOWED_ATTR, H) : Tt, Wt = N(a, "ALLOWED_NAMESPACES") && ee(a.ALLOWED_NAMESPACES) ? _({}, a.ALLOWED_NAMESPACES, en) : Ls, Ft = N(a, "ADD_URI_SAFE_ATTR") && ee(a.ADD_URI_SAFE_ATTR) ? _(re(En), a.ADD_URI_SAFE_ATTR, H) : En, yn = N(a, "ADD_DATA_URI_TAGS") && ee(a.ADD_DATA_URI_TAGS) ? _(re(An), a.ADD_DATA_URI_TAGS, H) : An, de = N(a, "FORBID_CONTENTS") && ee(a.FORBID_CONTENTS) ? _({}, a.FORBID_CONTENTS, H) : Ut, De = N(a, "FORBID_TAGS") && ee(a.FORBID_TAGS) ? _({}, a.FORBID_TAGS, H) : re({}), Me = N(a, "FORBID_ATTR") && ee(a.FORBID_ATTR) ? _({}, a.FORBID_ATTR, H) : re({}), Xe = N(a, "USE_PROFILES") ? a.USE_PROFILES && typeof a.USE_PROFILES == "object" ? re(a.USE_PROFILES) : a.USE_PROFILES : !1, k = a.ALLOW_ARIA_ATTR !== !1, C = a.ALLOW_DATA_ATTR !== !1, B = a.ALLOW_UNKNOWN_PROTOCOLS || !1, G = a.ALLOW_SELF_CLOSE_IN_ATTR !== !1, j = a.SAFE_FOR_TEMPLATES || !1, ne = a.SAFE_FOR_XML !== !1, O = a.WHOLE_DOCUMENT || !1, Se = a.RETURN_DOM || !1, Ne = a.RETURN_DOM_FRAGMENT || !1, Pe = a.RETURN_TRUSTED_TYPE || !1, qe = a.FORCE_BODY || !1, $e = a.SANITIZE_DOM !== !1, Q = a.SANITIZE_NAMED_PROPS || !1, zt = a.KEEP_CONTENT !== !1, ot = a.IN_PLACE || !1, kt = di(a.ALLOWED_URI_REGEXP) ? a.ALLOWED_URI_REGEXP : ls, Ve = typeof a.NAMESPACE == "string" ? a.NAMESPACE : fe, Bt = N(a, "MATHML_TEXT_INTEGRATION_POINTS") && a.MATHML_TEXT_INTEGRATION_POINTS && typeof a.MATHML_TEXT_INTEGRATION_POINTS == "object" ? re(a.MATHML_TEXT_INTEGRATION_POINTS) : _({}, ["mi", "mo", "mn", "ms", "mtext"]), Gt = N(a, "HTML_INTEGRATION_POINTS") && a.HTML_INTEGRATION_POINTS && typeof a.HTML_INTEGRATION_POINTS == "object" ? re(a.HTML_INTEGRATION_POINTS) : _({}, ["annotation-xml"]);
1737
+ const u = N(a, "CUSTOM_ELEMENT_HANDLING") && a.CUSTOM_ELEMENT_HANDLING && typeof a.CUSTOM_ELEMENT_HANDLING == "object" ? re(a.CUSTOM_ELEMENT_HANDLING) : nt(null);
1738
+ if (M = nt(null), N(u, "tagNameCheck") && Rn(u.tagNameCheck) && (M.tagNameCheck = u.tagNameCheck), N(u, "attributeNameCheck") && Rn(u.attributeNameCheck) && (M.attributeNameCheck = u.attributeNameCheck), N(u, "allowCustomizedBuiltInElements") && typeof u.allowCustomizedBuiltInElements == "boolean" && (M.allowCustomizedBuiltInElements = u.allowCustomizedBuiltInElements), j && (C = !1), Ne && (Se = !0), Xe && ($ = _({}, is), P = nt(null), Xe.html === !0 && (_($, rs), _(P, as)), Xe.svg === !0 && (_($, tn), _(P, rn), _(P, Et)), Xe.svgFilters === !0 && (_($, nn), _(P, rn), _(P, Et)), Xe.mathMl === !0 && (_($, sn), _(P, os), _(P, Et))), f.tagCheck = null, f.attributeCheck = null, N(a, "ADD_TAGS") && (typeof a.ADD_TAGS == "function" ? f.tagCheck = a.ADD_TAGS : ee(a.ADD_TAGS) && ($ === bt && ($ = re($)), _($, a.ADD_TAGS, H))), N(a, "ADD_ATTR") && (typeof a.ADD_ATTR == "function" ? f.attributeCheck = a.ADD_ATTR : ee(a.ADD_ATTR) && (P === Tt && (P = re(P)), _(P, a.ADD_ATTR, H))), N(a, "ADD_URI_SAFE_ATTR") && ee(a.ADD_URI_SAFE_ATTR) && _(Ft, a.ADD_URI_SAFE_ATTR, H), N(a, "FORBID_CONTENTS") && ee(a.FORBID_CONTENTS) && (de === Ut && (de = re(de)), _(de, a.FORBID_CONTENTS, H)), N(a, "ADD_FORBID_CONTENTS") && ee(a.ADD_FORBID_CONTENTS) && (de === Ut && (de = re(de)), _(de, a.ADD_FORBID_CONTENTS, H)), zt && ($["#text"] = !0), O && _($, ["html", "head", "body"]), $.table && (_($, ["tbody"]), delete De.tbody), a.TRUSTED_TYPES_POLICY) {
1739
+ if (typeof a.TRUSTED_TYPES_POLICY.createHTML != "function")
1740
+ throw At('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
1741
+ if (typeof a.TRUSTED_TYPES_POLICY.createScriptURL != "function")
1742
+ throw At('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
1743
+ D = a.TRUSTED_TYPES_POLICY, Ce = D.createHTML("");
1744
+ } else
1745
+ D === void 0 && (D = Ei(y, s)), D !== null && typeof Ce == "string" && (Ce = D.createHTML(""));
1746
+ te && te(a), Ze = a;
1747
+ }, vn = _({}, [...tn, ...nn, ...fi]), In = _({}, [...sn, ...gi]), Ns = function(a) {
1748
+ let u = he(a);
1749
+ (!u || !u.tagName) && (u = {
1750
+ namespaceURI: Ve,
1751
+ tagName: "template"
1752
+ });
1753
+ const d = ht(a.tagName), x = ht(u.tagName);
1754
+ return Wt[a.namespaceURI] ? a.namespaceURI === xt ? u.namespaceURI === fe ? d === "svg" : u.namespaceURI === _t ? d === "svg" && (x === "annotation-xml" || Bt[x]) : !!vn[d] : a.namespaceURI === _t ? u.namespaceURI === fe ? d === "math" : u.namespaceURI === xt ? d === "math" && Gt[x] : !!In[d] : a.namespaceURI === fe ? u.namespaceURI === xt && !Gt[x] || u.namespaceURI === _t && !Bt[x] ? !1 : !In[d] && (Cs[d] || !vn[d]) : !!(lt === "application/xhtml+xml" && Wt[a.namespaceURI]) : !1;
1755
+ }, ce = function(a) {
1756
+ Je(e.removed, {
1757
+ element: a
1758
+ });
1759
+ try {
1760
+ he(a).removeChild(a);
1761
+ } catch {
1762
+ Ie(a);
1763
+ }
1764
+ }, ze = function(a, u) {
1765
+ try {
1766
+ Je(e.removed, {
1767
+ attribute: u.getAttributeNode(a),
1768
+ from: u
1769
+ });
1770
+ } catch {
1771
+ Je(e.removed, {
1772
+ attribute: null,
1773
+ from: u
1774
+ });
1775
+ }
1776
+ if (u.removeAttribute(a), a === "is")
1777
+ if (Se || Ne)
1778
+ try {
1779
+ ce(u);
1780
+ } catch {
1781
+ }
1782
+ else
1783
+ try {
1784
+ u.setAttribute(a, "");
1785
+ } catch {
1786
+ }
1787
+ }, Ln = function(a) {
1788
+ let u = null, d = null;
1789
+ if (qe)
1790
+ a = "<remove></remove>" + a;
1791
+ else {
1792
+ const U = es(a, /^[\r\n\t ]+/);
1793
+ d = U && U[0];
1794
+ }
1795
+ lt === "application/xhtml+xml" && Ve === fe && (a = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + a + "</body></html>");
1796
+ const x = D ? D.createHTML(a) : a;
1797
+ if (Ve === fe)
1798
+ try {
1799
+ u = new S().parseFromString(x, lt);
1800
+ } catch {
1801
+ }
1802
+ if (!u || !u.documentElement) {
1803
+ u = le.createDocument(Ve, "template", null);
1804
+ try {
1805
+ u.documentElement.innerHTML = Ht ? Ce : x;
1806
+ } catch {
1807
+ }
1808
+ }
1809
+ const z = u.body || u.documentElement;
1810
+ return a && d && z.insertBefore(n.createTextNode(d), z.childNodes[0] || null), Ve === fe ? Y.call(u, O ? "html" : "body")[0] : O ? u.documentElement : z;
1811
+ }, Cn = function(a) {
1812
+ return Oe.call(
1813
+ a.ownerDocument || a,
1814
+ a,
1815
+ // eslint-disable-next-line no-bitwise
1816
+ l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT | l.SHOW_PROCESSING_INSTRUCTION | l.SHOW_CDATA_SECTION,
1817
+ null
1818
+ );
1819
+ }, On = function(a) {
1820
+ a.normalize();
1821
+ const u = Oe.call(
1822
+ a.ownerDocument || a,
1823
+ a,
1824
+ // eslint-disable-next-line no-bitwise
1825
+ l.SHOW_TEXT | l.SHOW_COMMENT | l.SHOW_CDATA_SECTION | l.SHOW_PROCESSING_INSTRUCTION,
1826
+ null
1827
+ );
1828
+ let d = u.nextNode();
1829
+ for (; d; ) {
1830
+ let x = d.data;
1831
+ Ke([_e, xe, we], (z) => {
1832
+ x = et(x, z, " ");
1833
+ }), d.data = x, d = u.nextNode();
1834
+ }
1835
+ }, qt = function(a) {
1836
+ return a instanceof T && (typeof a.nodeName != "string" || typeof a.textContent != "string" || typeof a.removeChild != "function" || !(a.attributes instanceof h) || typeof a.removeAttribute != "function" || typeof a.setAttribute != "function" || typeof a.namespaceURI != "string" || typeof a.insertBefore != "function" || typeof a.hasChildNodes != "function");
1837
+ }, wt = function(a) {
1838
+ if (!Te || typeof a != "object" || a === null)
1839
+ return !1;
1840
+ try {
1841
+ return typeof Te(a) == "number";
1842
+ } catch {
1843
+ return !1;
1844
+ }
1845
+ };
1846
+ function ke(m, a, u) {
1847
+ Ke(m, (d) => {
1848
+ d.call(e, a, u, Ze);
1849
+ });
1850
+ }
1851
+ const Dn = function(a) {
1852
+ let u = null;
1853
+ if (ke(X.beforeSanitizeElements, a, null), qt(a))
1854
+ return ce(a), !0;
1855
+ const d = H(a.nodeName);
1856
+ if (ke(X.uponSanitizeElement, a, {
1857
+ tagName: d,
1858
+ allowedTags: $
1859
+ }), ne && a.hasChildNodes() && !wt(a.firstElementChild) && V(/<[/\w!]/g, a.innerHTML) && V(/<[/\w!]/g, a.textContent) || ne && a.namespaceURI === fe && d === "style" && wt(a.firstElementChild) || a.nodeType === tt.progressingInstruction || ne && a.nodeType === tt.comment && V(/<[/\w]/g, a.data))
1860
+ return ce(a), !0;
1861
+ if (De[d] || !(f.tagCheck instanceof Function && f.tagCheck(d)) && !$[d]) {
1862
+ if (!De[d] && Nn(d) && (M.tagNameCheck instanceof RegExp && V(M.tagNameCheck, d) || M.tagNameCheck instanceof Function && M.tagNameCheck(d)))
1863
+ return !1;
1864
+ if (zt && !de[d]) {
1865
+ const x = he(a) || a.parentNode, z = Be(a) || a.childNodes;
1866
+ if (z && x) {
1867
+ const U = z.length;
1868
+ for (let se = U - 1; se >= 0; --se) {
1869
+ const ye = me(z[se], !0);
1870
+ x.insertBefore(ye, Le(a));
1871
+ }
1872
+ }
1873
+ }
1874
+ return ce(a), !0;
1875
+ }
1876
+ return a instanceof p && !Ns(a) || (d === "noscript" || d === "noembed" || d === "noframes") && V(/<\/no(script|embed|frames)/i, a.innerHTML) ? (ce(a), !0) : (j && a.nodeType === tt.text && (u = a.textContent, Ke([_e, xe, we], (x) => {
1877
+ u = et(u, x, " ");
1878
+ }), a.textContent !== u && (Je(e.removed, {
1879
+ element: a.cloneNode()
1880
+ }), a.textContent = u)), ke(X.afterSanitizeElements, a, null), !1);
1881
+ }, Mn = function(a, u, d) {
1882
+ if (Me[u] || $e && (u === "id" || u === "name") && (d in n || d in Ms))
1883
+ return !1;
1884
+ const x = P[u] || f.attributeCheck instanceof Function && f.attributeCheck(u, a);
1885
+ if (!(C && !Me[u] && V(it, u))) {
1886
+ if (!(k && V(mt, u))) {
1887
+ if (!x || Me[u]) {
1888
+ if (
1889
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1890
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1891
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1892
+ !(Nn(a) && (M.tagNameCheck instanceof RegExp && V(M.tagNameCheck, a) || M.tagNameCheck instanceof Function && M.tagNameCheck(a)) && (M.attributeNameCheck instanceof RegExp && V(M.attributeNameCheck, u) || M.attributeNameCheck instanceof Function && M.attributeNameCheck(u, a)) || // Alternative, second condition checks if it's an `is`-attribute, AND
1893
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1894
+ u === "is" && M.allowCustomizedBuiltInElements && (M.tagNameCheck instanceof RegExp && V(M.tagNameCheck, d) || M.tagNameCheck instanceof Function && M.tagNameCheck(d)))
1895
+ ) return !1;
1896
+ } else if (!Ft[u]) {
1897
+ if (!V(kt, et(d, at, ""))) {
1898
+ if (!((u === "src" || u === "xlink:href" || u === "href") && a !== "script" && ts(d, "data:") === 0 && yn[a])) {
1899
+ if (!(B && !V(Pt, et(d, at, "")))) {
1900
+ if (d)
1901
+ return !1;
1902
+ }
1903
+ }
1904
+ }
1905
+ }
1906
+ }
1907
+ }
1908
+ return !0;
1909
+ }, Ps = _({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), Nn = function(a) {
1910
+ return !Ps[ht(a)] && V($t, a);
1911
+ }, Pn = function(a) {
1912
+ ke(X.beforeSanitizeAttributes, a, null);
1913
+ const u = a.attributes;
1914
+ if (!u || qt(a))
1915
+ return;
1916
+ const d = {
1917
+ attrName: "",
1918
+ attrValue: "",
1919
+ keepAttr: !0,
1920
+ allowedAttributes: P,
1921
+ forceKeepAttr: void 0
1922
+ };
1923
+ let x = u.length;
1924
+ for (; x--; ) {
1925
+ const z = u[x], U = z.name, se = z.namespaceURI, ye = z.value, be = H(U), Vt = ye;
1926
+ let q = U === "value" ? Vt : oi(Vt);
1927
+ if (d.attrName = be, d.attrValue = q, d.keepAttr = !0, d.forceKeepAttr = void 0, ke(X.uponSanitizeAttribute, a, d), q = d.attrValue, Q && (be === "id" || be === "name") && ts(q, Sn) !== 0 && (ze(U, a), q = Sn + q), ne && V(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, q)) {
1928
+ ze(U, a);
1929
+ continue;
1930
+ }
1931
+ if (be === "attributename" && es(q, "href")) {
1932
+ ze(U, a);
1933
+ continue;
1934
+ }
1935
+ if (d.forceKeepAttr)
1936
+ continue;
1937
+ if (!d.keepAttr) {
1938
+ ze(U, a);
1939
+ continue;
1940
+ }
1941
+ if (!G && V(/\/>/i, q)) {
1942
+ ze(U, a);
1943
+ continue;
1944
+ }
1945
+ j && Ke([_e, xe, we], (zn) => {
1946
+ q = et(q, zn, " ");
1947
+ });
1948
+ const $n = H(a.nodeName);
1949
+ if (!Mn($n, be, q)) {
1950
+ ze(U, a);
1951
+ continue;
1952
+ }
1953
+ if (D && typeof y == "object" && typeof y.getAttributeType == "function" && !se)
1954
+ switch (y.getAttributeType($n, be)) {
1955
+ case "TrustedHTML": {
1956
+ q = D.createHTML(q);
1957
+ break;
1958
+ }
1959
+ case "TrustedScriptURL": {
1960
+ q = D.createScriptURL(q);
1961
+ break;
1962
+ }
1963
+ }
1964
+ if (q !== Vt)
1965
+ try {
1966
+ se ? a.setAttributeNS(se, U, q) : a.setAttribute(U, q), qt(a) ? ce(a) : Jn(e.removed);
1967
+ } catch {
1968
+ ze(U, a);
1969
+ }
1970
+ }
1971
+ ke(X.afterSanitizeAttributes, a, null);
1972
+ }, Xt = function(a) {
1973
+ let u = null;
1974
+ const d = Cn(a);
1975
+ for (ke(X.beforeSanitizeShadowDOM, a, null); u = d.nextNode(); )
1976
+ ke(X.uponSanitizeShadowNode, u, null), Dn(u), Pn(u), u.content instanceof i && Xt(u.content);
1977
+ ke(X.afterSanitizeShadowDOM, a, null);
1978
+ }, St = function(a) {
1979
+ if (a.nodeType === tt.element && a.shadowRoot instanceof i) {
1980
+ const x = a.shadowRoot;
1981
+ St(x), Xt(x);
1982
+ }
1983
+ const u = a.childNodes;
1984
+ if (!u)
1985
+ return;
1986
+ const d = [];
1987
+ Ke(u, (x) => {
1988
+ Je(d, x);
1989
+ });
1990
+ for (const x of d)
1991
+ St(x);
1992
+ };
1993
+ return e.sanitize = function(m) {
1994
+ let a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, d = null, x = null, z = null;
1995
+ if (Ht = !m, Ht && (m = "<!-->"), typeof m != "string" && !wt(m) && (m = hi(m), typeof m != "string"))
1996
+ throw At("dirty is not a string, aborting");
1997
+ if (!e.isSupported)
1998
+ return m;
1999
+ if (J || jt(a), e.removed = [], typeof m == "string" && (ot = !1), ot) {
2000
+ const ye = m.nodeName;
2001
+ if (typeof ye == "string") {
2002
+ const be = H(ye);
2003
+ if (!$[be] || De[be])
2004
+ throw At("root node is forbidden and cannot be sanitized in-place");
2005
+ }
2006
+ St(m);
2007
+ } else if (wt(m))
2008
+ u = Ln("<!---->"), d = u.ownerDocument.importNode(m, !0), d.nodeType === tt.element && d.nodeName === "BODY" || d.nodeName === "HTML" ? u = d : u.appendChild(d), St(d);
2009
+ else {
2010
+ if (!Se && !j && !O && // eslint-disable-next-line unicorn/prefer-includes
2011
+ m.indexOf("<") === -1)
2012
+ return D && Pe ? D.createHTML(m) : m;
2013
+ if (u = Ln(m), !u)
2014
+ return Se ? null : Pe ? Ce : "";
2015
+ }
2016
+ u && qe && ce(u.firstChild);
2017
+ const U = Cn(ot ? m : u);
2018
+ for (; x = U.nextNode(); )
2019
+ Dn(x), Pn(x), x.content instanceof i && Xt(x.content);
2020
+ if (ot)
2021
+ return j && On(m), m;
2022
+ if (Se) {
2023
+ if (j && On(u), Ne)
2024
+ for (z = je.call(u.ownerDocument); u.firstChild; )
2025
+ z.appendChild(u.firstChild);
2026
+ else
2027
+ z = u;
2028
+ return (P.shadowroot || P.shadowrootmode) && (z = Nt.call(r, z, !0)), z;
2029
+ }
2030
+ let se = O ? u.outerHTML : u.innerHTML;
2031
+ return O && $["!doctype"] && u.ownerDocument && u.ownerDocument.doctype && u.ownerDocument.doctype.name && V(Si, u.ownerDocument.doctype.name) && (se = "<!DOCTYPE " + u.ownerDocument.doctype.name + `>
2032
+ ` + se), j && Ke([_e, xe, we], (ye) => {
2033
+ se = et(se, ye, " ");
2034
+ }), D && Pe ? D.createHTML(se) : se;
2035
+ }, e.setConfig = function() {
2036
+ let m = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2037
+ jt(m), J = !0;
2038
+ }, e.clearConfig = function() {
2039
+ Ze = null, J = !1;
2040
+ }, e.isValidAttribute = function(m, a, u) {
2041
+ Ze || jt({});
2042
+ const d = H(m), x = H(a);
2043
+ return Mn(d, x, u);
2044
+ }, e.addHook = function(m, a) {
2045
+ typeof a == "function" && Je(X[m], a);
2046
+ }, e.removeHook = function(m, a) {
2047
+ if (a !== void 0) {
2048
+ const u = ii(X[m], a);
2049
+ return u === -1 ? void 0 : ai(X[m], u, 1)[0];
2050
+ }
2051
+ return Jn(X[m]);
2052
+ }, e.removeHooks = function(m) {
2053
+ X[m] = [];
2054
+ }, e.removeAllHooks = function() {
2055
+ X = cs();
2056
+ }, e;
2057
+ }
2058
+ var Ri = vs();
2059
+ const vi = { class: "avatar" }, Ii = { class: "content" }, Li = {
298
2060
  key: 0,
299
2061
  class: "message-images"
300
- }, Tt = ["src"], bt = ["innerHTML"], Ct = {
2062
+ }, Ci = ["src"], Oi = ["innerHTML"], Di = {
301
2063
  key: 0,
302
2064
  class: "reasoning-section"
303
- }, It = ["innerHTML"], At = ["innerHTML"], Mt = {
2065
+ }, Mi = ["innerHTML"], Ni = ["innerHTML"], Pi = {
304
2066
  key: 2,
305
2067
  class: "loading-placeholder"
306
- }, Et = {
2068
+ }, $i = {
307
2069
  key: 3,
308
2070
  class: "loading-placeholder"
309
- }, $t = { class: "time" }, xt = /* @__PURE__ */ q({
2071
+ }, zi = { class: "time" }, Ui = /* @__PURE__ */ Ct({
310
2072
  __name: "AiChatMessage",
311
2073
  props: {
312
2074
  message: {}
313
2075
  },
314
2076
  setup(t) {
315
- const e = t, d = de(), l = E(!1), o = w({
316
- get: () => d.sending ? !0 : l.value,
317
- set: (k) => {
318
- l.value = k;
2077
+ const e = t, n = dn(), r = ae(!1), s = Z({
2078
+ get: () => n.sending ? !0 : r.value,
2079
+ set: (l) => {
2080
+ r.value = l;
319
2081
  }
320
2082
  });
321
- function m(k) {
322
- if (!k) return "";
323
- const S = [], C = (M) => {
324
- const $ = S.length;
325
- return S.push(M), `\0PH${$}\0`;
326
- };
327
- let f = k;
328
- return f = f.replace(/```(\w*)\n([\s\S]*?)```/g, (M, $, H) => C(`<pre class="code-block"><code>${v(H)}</code></pre>`)), f = f.replace(/`([^`]+)`/g, (M, $) => C(`<code class="inline-code">${v($)}</code>`)), f = f.replace(/\*\*(.+?)\*\*/g, (M, $) => C(`<strong>${v($)}</strong>`)), f = v(f), f = f.replace(/\n/g, "<br>"), f = f.replace(/\x00PH(\d+)\x00/g, (M, $) => S[parseInt($)]), f;
329
- }
330
- const h = w(() => m(e.message.reasoningContent || "")), P = w(() => m(e.message.content || ""));
331
- function v(k) {
332
- return k.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
333
- }
334
- const L = (k) => k ? new Date(k).toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" }) : "";
335
- return (k, S) => {
336
- const C = z("el-icon");
337
- return a(), u("div", {
338
- class: N(["message-item", [t.message.role]])
2083
+ function i(l) {
2084
+ return l ? Ri.sanitize(L.parse(l)) : "";
2085
+ }
2086
+ const o = Z(() => i(e.message.reasoningContent || "")), c = Z(() => i(e.message.content || "")), p = (l) => l ? new Date(l).toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" }) : "";
2087
+ return (l, g) => {
2088
+ const h = Re("el-icon");
2089
+ return w(), v("div", {
2090
+ class: st(["message-item", [t.message.role]])
339
2091
  }, [
340
- g("div", wt, [
341
- t.message.role === "assistant" ? (a(), V(C, {
2092
+ I("div", vi, [
2093
+ t.message.role === "assistant" ? (w(), dt(h, {
342
2094
  key: 0,
343
2095
  size: 20
344
2096
  }, {
345
- default: c(() => [
346
- i(r(Ze))
2097
+ default: R(() => [
2098
+ b(A(Ws))
347
2099
  ]),
348
2100
  _: 1
349
- })) : (a(), V(C, {
2101
+ })) : (w(), dt(h, {
350
2102
  key: 1,
351
2103
  size: 20
352
2104
  }, {
353
- default: c(() => [
354
- i(r(Qe))
2105
+ default: R(() => [
2106
+ b(A(Bs))
355
2107
  ]),
356
2108
  _: 1
357
2109
  }))
358
2110
  ]),
359
- g("div", St, [
360
- t.message.role === "user" ? (a(), u(F, { key: 0 }, [
361
- t.message.images && t.message.images.length > 0 ? (a(), u("div", yt, [
362
- (a(!0), u(F, null, G(t.message.images, (f, M) => (a(), u("img", {
363
- key: M,
364
- src: f,
2111
+ I("div", Ii, [
2112
+ t.message.role === "user" ? (w(), v(ve, { key: 0 }, [
2113
+ t.message.images && t.message.images.length > 0 ? (w(), v("div", Li, [
2114
+ (w(!0), v(ve, null, Rt(t.message.images, (T, S) => (w(), v("img", {
2115
+ key: S,
2116
+ src: T,
365
2117
  class: "message-image",
366
2118
  alt: "图片"
367
- }, null, 8, Tt))), 128))
368
- ])) : A("", !0),
369
- t.message.content && t.message.content !== "[图片]" ? (a(), u("div", {
2119
+ }, null, 8, Ci))), 128))
2120
+ ])) : ie("", !0),
2121
+ t.message.content && t.message.content !== "[图片]" ? (w(), v("div", {
370
2122
  key: 1,
371
2123
  class: "text",
372
- innerHTML: P.value
373
- }, null, 8, bt)) : A("", !0)
374
- ], 64)) : (a(), u(F, { key: 1 }, [
375
- t.message.reasoningContent ? (a(), u("div", Ct, [
376
- g("div", {
2124
+ innerHTML: c.value
2125
+ }, null, 8, Oi)) : ie("", !0)
2126
+ ], 64)) : (w(), v(ve, { key: 1 }, [
2127
+ t.message.reasoningContent ? (w(), v("div", Di, [
2128
+ I("div", {
377
2129
  class: "reasoning-toggle",
378
- onClick: S[0] || (S[0] = (f) => !r(d).sending && (o.value = !o.value))
2130
+ onClick: g[0] || (g[0] = (T) => !A(n).sending && (s.value = !s.value))
379
2131
  }, [
380
- i(C, { size: 14 }, {
381
- default: c(() => [
382
- (a(), V(Be(o.value ? r(et) : r(tt))))
2132
+ b(h, { size: 14 }, {
2133
+ default: R(() => [
2134
+ (w(), dt($s(s.value ? A(Gs) : A(js))))
383
2135
  ]),
384
2136
  _: 1
385
2137
  }),
386
- S[1] || (S[1] = g("span", null, "AI 思考过程", -1))
2138
+ g[1] || (g[1] = I("span", null, "AI 思考过程", -1))
387
2139
  ]),
388
- Ge(g("div", {
2140
+ zs(I("div", {
389
2141
  class: "reasoning-body",
390
- innerHTML: h.value
391
- }, null, 8, It), [
392
- [qe, o.value]
2142
+ innerHTML: o.value
2143
+ }, null, 8, Mi), [
2144
+ [Us, s.value]
393
2145
  ])
394
- ])) : A("", !0),
395
- t.message.content ? (a(), u("div", {
2146
+ ])) : ie("", !0),
2147
+ t.message.content ? (w(), v("div", {
396
2148
  key: 1,
397
2149
  class: "text",
398
- innerHTML: P.value
399
- }, null, 8, At)) : t.message.reasoningContent ? (a(), u("div", Mt, "正在组织回答...")) : (a(), u("div", Et, "正在思考..."))
2150
+ innerHTML: c.value
2151
+ }, null, 8, Ni)) : t.message.reasoningContent ? (w(), v("div", Pi, "正在组织回答...")) : (w(), v("div", $i, "正在思考..."))
400
2152
  ], 64)),
401
- g("div", $t, W(L(t.message.createTime)), 1)
2153
+ I("div", zi, Ee(p(t.message.createTime)), 1)
402
2154
  ])
403
2155
  ], 2);
404
2156
  };
405
2157
  }
406
- }), Lt = /* @__PURE__ */ K(xt, [["__scopeId", "data-v-f5d45b2e"]]), Rt = {
2158
+ }), Fi = /* @__PURE__ */ Ot(Ui, [["__scopeId", "data-v-a07a2732"]]), Hi = {
407
2159
  key: 0,
408
2160
  class: "width-tooltip"
409
- }, Pt = { class: "panel-container" }, Ut = { class: "panel-header" }, Wt = { class: "header-left" }, zt = {
2161
+ }, Wi = { class: "panel-container" }, Bi = { class: "panel-header" }, Gi = { class: "header-left" }, ji = {
410
2162
  key: 0,
411
2163
  class: "token-usage"
412
- }, Ft = {
2164
+ }, qi = {
413
2165
  key: 1,
414
2166
  class: "preset-btns"
415
- }, Dt = { class: "header-right" }, Ht = { class: "chat-container" }, Ot = {
2167
+ }, Xi = { class: "header-right" }, Vi = { class: "chat-container" }, Zi = {
416
2168
  key: 0,
417
2169
  class: "session-list"
418
- }, Nt = { class: "session-header" }, Vt = ["onClick"], Xt = { class: "session-title" }, jt = { class: "session-meta" }, Jt = {
2170
+ }, Yi = { class: "session-header" }, Qi = ["onClick"], Ki = { class: "session-title" }, Ji = { class: "session-meta" }, ea = {
419
2171
  key: 0,
420
2172
  class: "session-load-more"
421
- }, Bt = {
2173
+ }, ta = {
422
2174
  key: 1,
423
2175
  class: "session-load-more session-no-more"
424
- }, Gt = { class: "messages-area" }, qt = { class: "messages-content" }, Kt = {
2176
+ }, na = { class: "messages-area" }, sa = { class: "messages-content" }, ra = {
425
2177
  key: 0,
426
2178
  class: "typing-indicator"
427
- }, Yt = {
2179
+ }, ia = {
428
2180
  key: 0,
429
2181
  class: "pending-images"
430
- }, Zt = { class: "image-index" }, Qt = ["src"], es = { class: "input-area" }, ts = 4, ss = 0.25, ns = 0.38, is = /* @__PURE__ */ q({
2182
+ }, aa = { class: "image-index" }, oa = ["src"], la = { class: "input-area" }, ca = 4, ua = 0.25, pa = 0.38, ha = /* @__PURE__ */ Ct({
431
2183
  __name: "AiChatDrawer",
432
2184
  setup(t) {
433
- const e = de();
434
- let d = new AbortController();
435
- const l = w({
2185
+ const e = dn();
2186
+ let n = new AbortController();
2187
+ const r = Z({
436
2188
  get: () => e.visible,
437
- set: (s) => e.setVisible(s)
438
- }), o = w(() => e.panelWidth), m = w(() => e.isFullScreen), h = E(!1), P = () => {
439
- h.value = window.innerWidth < 768;
440
- }, v = w(() => h.value ? { width: "100%" } : m.value ? { width: "100%" } : { width: `${o.value}px` }), L = w(() => {
441
- const s = e.tokenUsage;
442
- return s ? s.limitTokens === 0 ? `${s.usedTokens} tokens` : `${s.usedTokens}/${s.limitTokens}` : "";
443
- }), k = w(() => {
444
- const s = e.tokenUsage;
445
- return s ? s.limitTokens === 0 ? `今日已使用 ${s.usedTokens} tokens(不限制)` : s.limitReached ? "今日配额已用完,请明天再试" : `今日已使用 ${s.usedTokens}/${s.limitTokens} tokens,剩余 ${s.remainingTokens}` : "";
446
- }), S = E(""), C = E(!1), f = E([]), M = E(), $ = E(), H = E(window.innerWidth), ue = () => {
447
- H.value = window.innerWidth, P();
448
- }, ge = w(() => h.value ? window.innerWidth : Math.max(320, Math.round(H.value * ss))), me = w(() => h.value ? window.innerWidth : Math.max(420, Math.round(H.value * ns))), Y = w(() => o.value / H.value), Le = w(() => !m.value && Y.value <= 0.3), Re = w(() => !m.value && Y.value > 0.3 && Y.value <= 0.45), Pe = w(() => `窄 (${ge.value}px)`), Ue = w(() => `宽 (${me.value}px)`), D = E(!1), j = E(0), J = E(0);
449
- let b = null;
450
- const We = (s) => {
451
- D.value = !0, j.value = s.clientX, J.value = o.value, document.addEventListener("mousemove", Z), document.addEventListener("mouseup", ee), document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none";
452
- }, ze = (s) => {
453
- s.touches.length === 1 && (D.value = !0, j.value = s.touches[0].clientX, J.value = o.value, document.addEventListener("touchmove", Q), document.addEventListener("touchend", te));
454
- }, Z = (s) => {
455
- D.value && (b && cancelAnimationFrame(b), b = requestAnimationFrame(() => {
456
- const n = J.value + (j.value - s.clientX), p = Math.max(320, Math.min(window.innerWidth / 2, n));
457
- e.setPanelWidth(p);
2189
+ set: (f) => e.setVisible(f)
2190
+ }), s = Z(() => e.panelWidth), i = Z(() => e.isFullScreen), o = ae(!1), c = () => {
2191
+ o.value = window.innerWidth < 768;
2192
+ }, p = Z(() => o.value ? { width: "100%" } : i.value ? { width: "100%" } : { width: `${s.value}px` }), l = Z(() => {
2193
+ const f = e.tokenUsage;
2194
+ return f ? f.limitTokens === 0 ? `${f.usedTokens} tokens` : `${f.usedTokens}/${f.limitTokens}` : "";
2195
+ }), g = Z(() => {
2196
+ const f = e.tokenUsage;
2197
+ return f ? f.limitTokens === 0 ? `今日已使用 ${f.usedTokens} tokens(不限制)` : f.limitReached ? "今日配额已用完,请明天再试" : `今日已使用 ${f.usedTokens}/${f.limitTokens} tokens,剩余 ${f.remainingTokens}` : "";
2198
+ }), h = ae(""), T = ae(!1), S = ae([]), y = ae(), W = ae(), me = ae(window.innerWidth), Ie = () => {
2199
+ me.value = window.innerWidth, c();
2200
+ }, Le = Z(() => o.value ? window.innerWidth : Math.max(320, Math.round(me.value * ua))), Be = Z(() => o.value ? window.innerWidth : Math.max(420, Math.round(me.value * pa))), he = Z(() => s.value / me.value), Te = Z(() => !i.value && he.value <= 0.3), D = Z(() => !i.value && he.value > 0.3 && he.value <= 0.45), Ce = Z(() => `窄 (${Le.value}px)`), Ge = Z(() => `宽 (${Be.value}px)`), le = ae(!1), Oe = ae(0), je = ae(0);
2201
+ let Y = null;
2202
+ const Nt = (f) => {
2203
+ le.value = !0, Oe.value = f.clientX, je.value = s.value, document.addEventListener("mousemove", _e), document.addEventListener("mouseup", we), document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none";
2204
+ }, X = (f) => {
2205
+ f.touches.length === 1 && (le.value = !0, Oe.value = f.touches[0].clientX, je.value = s.value, document.addEventListener("touchmove", xe), document.addEventListener("touchend", it));
2206
+ }, _e = (f) => {
2207
+ le.value && (Y && cancelAnimationFrame(Y), Y = requestAnimationFrame(() => {
2208
+ const k = je.value + (Oe.value - f.clientX), C = Math.max(320, Math.min(window.innerWidth / 2, k));
2209
+ e.setPanelWidth(C);
458
2210
  }));
459
- }, Q = (s) => {
460
- !D.value || s.touches.length !== 1 || (b && cancelAnimationFrame(b), b = requestAnimationFrame(() => {
461
- const n = J.value + (j.value - s.touches[0].clientX), p = Math.max(320, Math.min(window.innerWidth / 2, n));
462
- e.setPanelWidth(p);
2211
+ }, xe = (f) => {
2212
+ !le.value || f.touches.length !== 1 || (Y && cancelAnimationFrame(Y), Y = requestAnimationFrame(() => {
2213
+ const k = je.value + (Oe.value - f.touches[0].clientX), C = Math.max(320, Math.min(window.innerWidth / 2, k));
2214
+ e.setPanelWidth(C);
463
2215
  }));
464
- }, ee = () => {
465
- D.value = !1, b && (cancelAnimationFrame(b), b = null), document.removeEventListener("mousemove", Z), document.removeEventListener("mouseup", ee), document.body.style.cursor = "", document.body.style.userSelect = "";
466
- }, te = () => {
467
- D.value = !1, b && (cancelAnimationFrame(b), b = null), document.removeEventListener("touchmove", Q), document.removeEventListener("touchend", te);
468
- }, he = (s) => e.setPanelWidth(s), Fe = () => e.toggleFullScreen(), fe = () => e.setVisible(!1), De = async (s) => {
469
- const n = s.clipboardData?.items;
470
- if (n)
471
- for (let p = 0; p < n.length; p++) {
472
- const y = n[p];
473
- if (y.type.startsWith("image/")) {
474
- if (s.preventDefault(), f.value.length >= ts) {
475
- O.warning("最多只能上传4张图片");
2216
+ }, we = () => {
2217
+ le.value = !1, Y && (cancelAnimationFrame(Y), Y = null), document.removeEventListener("mousemove", _e), document.removeEventListener("mouseup", we), document.body.style.cursor = "", document.body.style.userSelect = "";
2218
+ }, it = () => {
2219
+ le.value = !1, Y && (cancelAnimationFrame(Y), Y = null), document.removeEventListener("touchmove", xe), document.removeEventListener("touchend", it);
2220
+ }, mt = (f) => e.setPanelWidth(f), Pt = () => e.toggleFullScreen(), at = () => e.setVisible(!1), $t = async (f) => {
2221
+ const k = f.clipboardData?.items;
2222
+ if (k)
2223
+ for (let C = 0; C < k.length; C++) {
2224
+ const B = k[C];
2225
+ if (B.type.startsWith("image/")) {
2226
+ if (f.preventDefault(), S.value.length >= ca) {
2227
+ Ye.warning("最多只能上传4张图片");
476
2228
  return;
477
2229
  }
478
- const T = y.getAsFile();
479
- if (T) {
480
- const R = await He(T);
481
- f.value.push(R);
2230
+ const G = B.getAsFile();
2231
+ if (G) {
2232
+ const j = await kt(G);
2233
+ S.value.push(j);
482
2234
  }
483
2235
  }
484
2236
  }
485
- }, He = (s) => new Promise((n) => {
486
- const p = new FileReader();
487
- p.onload = (y) => n(y.target.result), p.readAsDataURL(s);
488
- }), Oe = (s) => s?.length > 30 ? s.substring(0, 30) + "..." : s, Ne = ({ scrollTop: s }) => {
489
- const n = $.value?.wrapRef;
490
- n && s + n.clientHeight >= n.scrollHeight - 150 && e.loadMoreSessions();
491
- }, se = () => {
492
- M.value?.wrapRef && (M.value.wrapRef.scrollTop = M.value.wrapRef.scrollHeight);
2237
+ }, kt = (f) => new Promise((k) => {
2238
+ const C = new FileReader();
2239
+ C.onload = (B) => k(B.target.result), C.readAsDataURL(f);
2240
+ }), $ = (f) => f?.length > 30 ? f.substring(0, 30) + "..." : f, bt = ({ scrollTop: f }) => {
2241
+ const k = W.value?.wrapRef;
2242
+ k && f + k.clientHeight >= k.scrollHeight - 150 && e.loadMoreSessions();
2243
+ }, P = () => {
2244
+ y.value?.wrapRef && (y.value.wrapRef.scrollTop = y.value.wrapRef.scrollHeight);
493
2245
  };
494
- we(() => e.messages.length, () => ne(se)), we(l, (s) => {
495
- s && (e.currentSessionId || e.loadSessions(), e.loadTokenUsage());
2246
+ Un(() => e.messages.length, () => Zt(P)), Un(r, (f) => {
2247
+ f && (e.currentSessionId || e.loadSessions(), e.loadTokenUsage());
496
2248
  });
497
- const Ve = async () => {
498
- const s = await e.createSession();
499
- s ? (e.setCurrentSession(s, !1), C.value = !1) : O.error("创建对话失败,请检查网络或重新登录");
500
- }, Xe = (s) => {
501
- e.setCurrentSession(s.id), C.value = !1;
502
- }, je = async (s) => {
503
- await e.deleteSession(s);
504
- }, pe = async () => {
505
- const s = S.value.trim(), n = [...f.value];
506
- if (!s && n.length === 0 || e.sending) return;
507
- S.value = "", f.value = [], e.setSending(!0), d = new AbortController();
508
- let p = e.currentSessionId;
509
- if (!p) {
510
- if (p = await e.createSession(), !p) {
511
- e.setSending(!1), S.value = s, f.value = n, O.error("创建对话失败,请检查网络或重新登录");
2249
+ const Tt = async () => {
2250
+ const f = await e.createSession();
2251
+ f ? (e.setCurrentSession(f, !1), T.value = !1) : Ye.error("创建对话失败,请检查网络或重新登录");
2252
+ }, M = (f) => {
2253
+ e.setCurrentSession(f.id), T.value = !1;
2254
+ }, De = async (f) => {
2255
+ await e.deleteSession(f);
2256
+ }, Me = async () => {
2257
+ const f = h.value.trim(), k = [...S.value];
2258
+ if (!f && k.length === 0 || e.sending) return;
2259
+ h.value = "", S.value = [], e.setSending(!0), n = new AbortController();
2260
+ let C = e.currentSessionId;
2261
+ if (!C) {
2262
+ if (C = await e.createSession(), !C) {
2263
+ e.setSending(!1), h.value = f, S.value = k, Ye.error("创建对话失败,请检查网络或重新登录");
512
2264
  return;
513
2265
  }
514
- e.setCurrentSession(p, !1);
2266
+ e.setCurrentSession(C, !1);
515
2267
  }
516
- const y = {
2268
+ const B = {
517
2269
  id: Date.now(),
518
- sessionId: p,
2270
+ sessionId: C,
519
2271
  role: "user",
520
- content: s || "[图片]",
521
- images: n.length > 0 ? n : void 0,
2272
+ content: f || "[图片]",
2273
+ images: k.length > 0 ? k : void 0,
522
2274
  createTime: (/* @__PURE__ */ new Date()).toISOString()
523
2275
  };
524
- e.addMessage(y);
525
- const T = {
2276
+ e.addMessage(B);
2277
+ const G = {
526
2278
  id: Date.now() + 1,
527
- sessionId: p,
2279
+ sessionId: C,
528
2280
  role: "assistant",
529
2281
  content: "",
530
2282
  createTime: (/* @__PURE__ */ new Date()).toISOString()
531
2283
  };
532
- e.addMessage(T);
2284
+ e.addMessage(G);
533
2285
  try {
534
- const U = (await pt({
535
- sessionId: p,
536
- message: s || "[图片]",
537
- images: n.length > 0 ? n : void 0,
538
- signal: d.signal
539
- })).body?.getReader(), _ = new TextDecoder();
540
- if (U) {
541
- let x = "";
2286
+ const ne = (await ar({
2287
+ sessionId: C,
2288
+ message: f || "[图片]",
2289
+ images: k.length > 0 ? k : void 0,
2290
+ signal: n.signal
2291
+ })).body?.getReader(), O = new TextDecoder();
2292
+ if (ne) {
2293
+ let J = "";
542
2294
  for (; ; ) {
543
- const { done: ve, value: Je } = await U.read();
544
- if (ve) break;
545
- x += _.decode(Je, { stream: !0 });
546
- const _e = x.split(`
2295
+ const { done: qe, value: Se } = await ne.read();
2296
+ if (qe) break;
2297
+ J += O.decode(Se, { stream: !0 });
2298
+ const Ne = J.split(`
547
2299
  `);
548
- x = _e.pop() ?? "";
549
- let ke = "";
550
- for (const B of _e)
551
- if (B.startsWith("event:"))
552
- ke = B.slice(6).trim();
553
- else if (B.startsWith("data:"))
2300
+ J = Ne.pop() ?? "";
2301
+ let Pe = "";
2302
+ for (const $e of Ne)
2303
+ if ($e.startsWith("event:"))
2304
+ Pe = $e.slice(6).trim();
2305
+ else if ($e.startsWith("data:"))
554
2306
  try {
555
- const I = JSON.parse(B.slice(5).trim());
556
- if (ke === "error" || I.error) {
557
- e.updateLastAssistantMessage(I.error || "服务异常,请重试。"), O.error(I.error || "服务异常,请重试");
2307
+ const Q = JSON.parse($e.slice(5).trim());
2308
+ if (Pe === "error" || Q.error) {
2309
+ e.updateLastAssistantMessage(Q.error || "服务异常,请重试。"), Ye.error(Q.error || "服务异常,请重试");
558
2310
  break;
559
2311
  }
560
- I.done || (I.reasoningContent && (e.updateLastAssistantReasoning(I.reasoningContent), ne(se)), I.content && (e.updateLastAssistantMessage(I.content), ne(se))), I.sessionId && !e.currentSessionId && e.setCurrentSession(I.sessionId), I.done && I.usage && e.updateTokenUsage(I.usage.totalTokens);
2312
+ Q.done || (Q.reasoningContent && (e.updateLastAssistantReasoning(Q.reasoningContent), Zt(P)), Q.content && (e.updateLastAssistantMessage(Q.content), Zt(P))), Q.sessionId && !e.currentSessionId && e.setCurrentSession(Q.sessionId), Q.done && Q.usage && e.updateTokenUsage(Q.usage.totalTokens);
561
2313
  } catch {
562
2314
  }
563
2315
  }
564
2316
  }
565
- } catch (R) {
566
- if (R.name === "AbortError")
2317
+ } catch (j) {
2318
+ if (j.name === "AbortError")
567
2319
  console.log("[@cgs/ai-chat] 请求已取消");
568
- else if (R.message?.startsWith("AUTH_EXPIRED:")) {
569
- const U = R.message.replace("AUTH_EXPIRED:", "");
570
- console.error("[@cgs/ai-chat] 认证过期", U), e.updateLastAssistantMessage(`认证失败:${U}`), O.error({
571
- message: U,
2320
+ else if (j.message?.startsWith("AUTH_EXPIRED:")) {
2321
+ const ne = j.message.replace("AUTH_EXPIRED:", "");
2322
+ console.error("[@cgs/ai-chat] 认证过期", ne), e.updateLastAssistantMessage(`认证失败:${ne}`), Ye.error({
2323
+ message: ne,
572
2324
  duration: 5e3,
573
2325
  showClose: !0
574
2326
  });
575
2327
  } else
576
- console.error("[@cgs/ai-chat] 发送消息失败", R), e.updateLastAssistantMessage("抱歉,发生了错误,请重试。"), O.error({
2328
+ console.error("[@cgs/ai-chat] 发送消息失败", j), e.updateLastAssistantMessage("抱歉,发生了错误,请重试。"), Ye.error({
577
2329
  message: "消息发送失败,请检查网络连接",
578
2330
  duration: 3e3,
579
2331
  showClose: !0
@@ -582,67 +2334,67 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
582
2334
  e.setSending(!1), e.loadSessions();
583
2335
  }
584
2336
  };
585
- return Ce(() => {
586
- window.addEventListener("resize", ue), P();
587
- }), Ie(() => {
588
- d.abort(), window.removeEventListener("resize", ue), document.removeEventListener("mousemove", Z), document.removeEventListener("mouseup", ee), document.removeEventListener("touchmove", Q), document.removeEventListener("touchend", te), b && cancelAnimationFrame(b);
589
- }), (s, n) => {
590
- const p = z("el-tooltip"), y = z("el-icon"), T = z("el-button"), R = z("el-empty"), U = z("el-input");
591
- return a(), u(F, null, [
592
- i(ie, { name: "slide" }, {
593
- default: c(() => [
594
- l.value ? (a(), u("div", {
2337
+ return us(() => {
2338
+ window.addEventListener("resize", Ie), c();
2339
+ }), ps(() => {
2340
+ n.abort(), window.removeEventListener("resize", Ie), document.removeEventListener("mousemove", _e), document.removeEventListener("mouseup", we), document.removeEventListener("touchmove", xe), document.removeEventListener("touchend", it), Y && cancelAnimationFrame(Y);
2341
+ }), (f, k) => {
2342
+ const C = Re("el-tooltip"), B = Re("el-icon"), G = Re("el-button"), j = Re("el-empty"), ne = Re("el-input");
2343
+ return w(), v(ve, null, [
2344
+ b(Yt, { name: "slide" }, {
2345
+ default: R(() => [
2346
+ r.value ? (w(), v("div", {
595
2347
  key: 0,
596
- class: N(["ai-chat-panel", { "full-screen": m.value, "is-mobile": h.value }]),
597
- style: Ae(v.value)
2348
+ class: st(["ai-chat-panel", { "full-screen": i.value, "is-mobile": o.value }]),
2349
+ style: hs(p.value)
598
2350
  }, [
599
- h.value ? A("", !0) : (a(), u("div", {
2351
+ o.value ? ie("", !0) : (w(), v("div", {
600
2352
  key: 0,
601
2353
  class: "resize-handle",
602
- onMousedown: We,
603
- onTouchstart: oe(ze, ["prevent"])
2354
+ onMousedown: Nt,
2355
+ onTouchstart: Qt(X, ["prevent"])
604
2356
  }, [
605
- n[5] || (n[5] = g("div", { class: "resize-bar" }, null, -1)),
606
- i(ie, { name: "fade" }, {
607
- default: c(() => [
608
- D.value ? (a(), u("div", Rt, W(Math.round(o.value)) + "px ", 1)) : A("", !0)
2357
+ k[5] || (k[5] = I("div", { class: "resize-bar" }, null, -1)),
2358
+ b(Yt, { name: "fade" }, {
2359
+ default: R(() => [
2360
+ le.value ? (w(), v("div", Hi, Ee(Math.round(s.value)) + "px ", 1)) : ie("", !0)
609
2361
  ]),
610
2362
  _: 1
611
2363
  })
612
2364
  ], 32)),
613
- g("div", Pt, [
614
- g("div", Ut, [
615
- g("div", Wt, [
616
- n[6] || (n[6] = g("span", { class: "title" }, "AI助手", -1)),
617
- r(e).tokenUsage ? (a(), u("div", zt, [
618
- i(p, {
619
- content: k.value,
2365
+ I("div", Wi, [
2366
+ I("div", Bi, [
2367
+ I("div", Gi, [
2368
+ k[6] || (k[6] = I("span", { class: "title" }, "AI助手", -1)),
2369
+ A(e).tokenUsage ? (w(), v("div", ji, [
2370
+ b(C, {
2371
+ content: g.value,
620
2372
  placement: "bottom"
621
2373
  }, {
622
- default: c(() => [
623
- g("span", {
624
- class: N({ "limit-warning": r(e).tokenUsage.limitReached })
625
- }, W(L.value), 3)
2374
+ default: R(() => [
2375
+ I("span", {
2376
+ class: st({ "limit-warning": A(e).tokenUsage.limitReached })
2377
+ }, Ee(l.value), 3)
626
2378
  ]),
627
2379
  _: 1
628
2380
  }, 8, ["content"])
629
- ])) : A("", !0),
630
- h.value ? A("", !0) : (a(), u("div", Ft, [
631
- i(p, {
632
- content: Pe.value,
2381
+ ])) : ie("", !0),
2382
+ o.value ? ie("", !0) : (w(), v("div", qi, [
2383
+ b(C, {
2384
+ content: Ce.value,
633
2385
  placement: "bottom"
634
2386
  }, {
635
- default: c(() => [
636
- i(T, {
2387
+ default: R(() => [
2388
+ b(G, {
637
2389
  size: "small",
638
- type: Le.value ? "primary" : "default",
2390
+ type: Te.value ? "primary" : "default",
639
2391
  link: "",
640
- onClick: n[0] || (n[0] = (_) => he(ge.value))
2392
+ onClick: k[0] || (k[0] = (O) => mt(Le.value))
641
2393
  }, {
642
- default: c(() => [
643
- i(y, null, {
644
- default: c(() => [
645
- i(r(st))
2394
+ default: R(() => [
2395
+ b(B, null, {
2396
+ default: R(() => [
2397
+ b(A(qs))
646
2398
  ]),
647
2399
  _: 1
648
2400
  })
@@ -652,21 +2404,21 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
652
2404
  ]),
653
2405
  _: 1
654
2406
  }, 8, ["content"]),
655
- i(p, {
656
- content: Ue.value,
2407
+ b(C, {
2408
+ content: Ge.value,
657
2409
  placement: "bottom"
658
2410
  }, {
659
- default: c(() => [
660
- i(T, {
2411
+ default: R(() => [
2412
+ b(G, {
661
2413
  size: "small",
662
- type: Re.value ? "primary" : "default",
2414
+ type: D.value ? "primary" : "default",
663
2415
  link: "",
664
- onClick: n[1] || (n[1] = (_) => he(me.value))
2416
+ onClick: k[1] || (k[1] = (O) => mt(Be.value))
665
2417
  }, {
666
- default: c(() => [
667
- i(y, null, {
668
- default: c(() => [
669
- i(r(nt))
2418
+ default: R(() => [
2419
+ b(B, null, {
2420
+ default: R(() => [
2421
+ b(A(Xs))
670
2422
  ]),
671
2423
  _: 1
672
2424
  })
@@ -676,21 +2428,21 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
676
2428
  ]),
677
2429
  _: 1
678
2430
  }, 8, ["content"]),
679
- i(p, {
680
- content: m.value ? "退出全屏" : "全屏",
2431
+ b(C, {
2432
+ content: i.value ? "退出全屏" : "全屏",
681
2433
  placement: "bottom"
682
2434
  }, {
683
- default: c(() => [
684
- i(T, {
2435
+ default: R(() => [
2436
+ b(G, {
685
2437
  size: "small",
686
- type: m.value ? "primary" : "default",
2438
+ type: i.value ? "primary" : "default",
687
2439
  link: "",
688
- onClick: Fe
2440
+ onClick: Pt
689
2441
  }, {
690
- default: c(() => [
691
- i(y, null, {
692
- default: c(() => [
693
- i(r(it))
2442
+ default: R(() => [
2443
+ b(B, null, {
2444
+ default: R(() => [
2445
+ b(A(Vs))
694
2446
  ]),
695
2447
  _: 1
696
2448
  })
@@ -702,32 +2454,32 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
702
2454
  }, 8, ["content"])
703
2455
  ]))
704
2456
  ]),
705
- g("div", Dt, [
706
- i(T, {
2457
+ I("div", Xi, [
2458
+ b(G, {
707
2459
  type: "primary",
708
2460
  link: "",
709
- onClick: Ve
2461
+ onClick: Tt
710
2462
  }, {
711
- default: c(() => [
712
- i(y, null, {
713
- default: c(() => [
714
- i(r(ot))
2463
+ default: R(() => [
2464
+ b(B, null, {
2465
+ default: R(() => [
2466
+ b(A(Zs))
715
2467
  ]),
716
2468
  _: 1
717
2469
  }),
718
- n[7] || (n[7] = ae("新对话 ", -1))
2470
+ k[7] || (k[7] = Kt("新对话 ", -1))
719
2471
  ]),
720
2472
  _: 1
721
2473
  }),
722
- i(T, {
2474
+ b(G, {
723
2475
  type: "default",
724
2476
  link: "",
725
- onClick: fe
2477
+ onClick: at
726
2478
  }, {
727
- default: c(() => [
728
- i(y, null, {
729
- default: c(() => [
730
- i(r(Se))
2479
+ default: R(() => [
2480
+ b(B, null, {
2481
+ default: R(() => [
2482
+ b(A(Fn))
731
2483
  ]),
732
2484
  _: 1
733
2485
  })
@@ -736,120 +2488,120 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
736
2488
  })
737
2489
  ])
738
2490
  ]),
739
- g("div", Ht, [
740
- C.value ? (a(), u("div", Ot, [
741
- g("div", Nt, [
742
- n[9] || (n[9] = g("span", null, "历史对话", -1)),
743
- i(T, {
2491
+ I("div", Vi, [
2492
+ T.value ? (w(), v("div", Zi, [
2493
+ I("div", Yi, [
2494
+ k[9] || (k[9] = I("span", null, "历史对话", -1)),
2495
+ b(G, {
744
2496
  type: "primary",
745
2497
  link: "",
746
2498
  size: "small",
747
- onClick: n[2] || (n[2] = (_) => C.value = !1)
2499
+ onClick: k[2] || (k[2] = (O) => T.value = !1)
748
2500
  }, {
749
- default: c(() => [...n[8] || (n[8] = [
750
- ae("返回聊天", -1)
2501
+ default: R(() => [...k[8] || (k[8] = [
2502
+ Kt("返回聊天", -1)
751
2503
  ])]),
752
2504
  _: 1
753
2505
  })
754
2506
  ]),
755
- i(r(ye), {
2507
+ b(A(Hn), {
756
2508
  ref_key: "sessionScrollbarRef",
757
- ref: $,
758
- height: (h.value, "calc(100vh - 200px)"),
759
- onScroll: Ne
2509
+ ref: W,
2510
+ height: (o.value, "calc(100vh - 200px)"),
2511
+ onScroll: bt
760
2512
  }, {
761
- default: c(() => [
762
- (a(!0), u(F, null, G(r(e).sessions, (_) => (a(), u("div", {
763
- key: _.id,
764
- class: N(["session-item", { active: _.id === r(e).currentSessionId }]),
765
- onClick: (x) => Xe(_)
2513
+ default: R(() => [
2514
+ (w(!0), v(ve, null, Rt(A(e).sessions, (O) => (w(), v("div", {
2515
+ key: O.id,
2516
+ class: st(["session-item", { active: O.id === A(e).currentSessionId }]),
2517
+ onClick: (J) => M(O)
766
2518
  }, [
767
- i(p, {
768
- content: _.title,
2519
+ b(C, {
2520
+ content: O.title,
769
2521
  placement: "left",
770
2522
  "show-after": 500
771
2523
  }, {
772
- default: c(() => [
773
- g("div", Xt, W(Oe(_.title)), 1)
2524
+ default: R(() => [
2525
+ I("div", Ki, Ee($(O.title)), 1)
774
2526
  ]),
775
2527
  _: 2
776
2528
  }, 1032, ["content"]),
777
- g("div", jt, [
778
- g("span", null, W(_.messageCount) + "条消息", 1),
779
- i(T, {
2529
+ I("div", Ji, [
2530
+ I("span", null, Ee(O.messageCount) + "条消息", 1),
2531
+ b(G, {
780
2532
  type: "danger",
781
2533
  link: "",
782
2534
  size: "small",
783
- onClick: oe((x) => je(_.id), ["stop"])
2535
+ onClick: Qt((J) => De(O.id), ["stop"])
784
2536
  }, {
785
- default: c(() => [...n[10] || (n[10] = [
786
- ae("删除", -1)
2537
+ default: R(() => [...k[10] || (k[10] = [
2538
+ Kt("删除", -1)
787
2539
  ])]),
788
2540
  _: 1
789
2541
  }, 8, ["onClick"])
790
2542
  ])
791
- ], 10, Vt))), 128)),
792
- r(e).sessionLoadingMore ? (a(), u("div", Jt, [
793
- i(y, { class: "is-loading" }, {
794
- default: c(() => [
795
- i(r(at))
2543
+ ], 10, Qi))), 128)),
2544
+ A(e).sessionLoadingMore ? (w(), v("div", ea, [
2545
+ b(B, { class: "is-loading" }, {
2546
+ default: R(() => [
2547
+ b(A(Ys))
796
2548
  ]),
797
2549
  _: 1
798
2550
  }),
799
- n[11] || (n[11] = g("span", null, "加载中...", -1))
800
- ])) : r(e).sessions.length > 0 && !r(e).sessionHasMore ? (a(), u("div", Bt, " 共 " + W(r(e).sessionTotal) + " 条对话 ", 1)) : A("", !0),
801
- r(e).sessions.length === 0 ? (a(), V(R, {
2551
+ k[11] || (k[11] = I("span", null, "加载中...", -1))
2552
+ ])) : A(e).sessions.length > 0 && !A(e).sessionHasMore ? (w(), v("div", ta, " 共 " + Ee(A(e).sessionTotal) + " 条对话 ", 1)) : ie("", !0),
2553
+ A(e).sessions.length === 0 ? (w(), dt(j, {
802
2554
  key: 2,
803
2555
  description: "暂无历史对话"
804
- })) : A("", !0)
2556
+ })) : ie("", !0)
805
2557
  ]),
806
2558
  _: 1
807
2559
  }, 8, ["height"])
808
- ])) : (a(), u(F, { key: 1 }, [
809
- g("div", Gt, [
810
- i(r(ye), {
2560
+ ])) : (w(), v(ve, { key: 1 }, [
2561
+ I("div", na, [
2562
+ b(A(Hn), {
811
2563
  ref_key: "scrollbarRef",
812
- ref: M,
2564
+ ref: y,
813
2565
  height: "100%"
814
2566
  }, {
815
- default: c(() => [
816
- g("div", qt, [
817
- (a(!0), u(F, null, G(r(e).messages, (_, x) => (a(), V(Lt, {
818
- key: x,
819
- message: _
2567
+ default: R(() => [
2568
+ I("div", sa, [
2569
+ (w(!0), v(ve, null, Rt(A(e).messages, (O, J) => (w(), dt(Fi, {
2570
+ key: J,
2571
+ message: O
820
2572
  }, null, 8, ["message"]))), 128)),
821
- r(e).sending ? (a(), u("div", Kt, [...n[12] || (n[12] = [
822
- g("span", null, null, -1),
823
- g("span", null, null, -1),
824
- g("span", null, null, -1)
825
- ])])) : A("", !0)
2573
+ A(e).sending ? (w(), v("div", ra, [...k[12] || (k[12] = [
2574
+ I("span", null, null, -1),
2575
+ I("span", null, null, -1),
2576
+ I("span", null, null, -1)
2577
+ ])])) : ie("", !0)
826
2578
  ])
827
2579
  ]),
828
2580
  _: 1
829
2581
  }, 512)
830
2582
  ]),
831
- f.value.length > 0 ? (a(), u("div", Yt, [
832
- (a(!0), u(F, null, G(f.value, (_, x) => (a(), u("div", {
833
- key: x,
2583
+ S.value.length > 0 ? (w(), v("div", ia, [
2584
+ (w(!0), v(ve, null, Rt(S.value, (O, J) => (w(), v("div", {
2585
+ key: J,
834
2586
  class: "pending-image-wrap"
835
2587
  }, [
836
- g("div", Zt, W(x + 1) + "/" + W(f.value.length), 1),
837
- g("img", {
838
- src: _,
2588
+ I("div", aa, Ee(J + 1) + "/" + Ee(S.value.length), 1),
2589
+ I("img", {
2590
+ src: O,
839
2591
  class: "pending-image",
840
2592
  alt: "待发送图片"
841
- }, null, 8, Qt),
842
- i(T, {
2593
+ }, null, 8, oa),
2594
+ b(G, {
843
2595
  type: "danger",
844
2596
  circle: "",
845
2597
  size: "small",
846
2598
  class: "remove-img",
847
- onClick: (ve) => f.value.splice(x, 1)
2599
+ onClick: (qe) => S.value.splice(J, 1)
848
2600
  }, {
849
- default: c(() => [
850
- i(y, null, {
851
- default: c(() => [
852
- i(r(Se))
2601
+ default: R(() => [
2602
+ b(B, null, {
2603
+ default: R(() => [
2604
+ b(A(Fn))
853
2605
  ]),
854
2606
  _: 1
855
2607
  })
@@ -857,83 +2609,83 @@ const be = 15, le = vt(), de = ct("cgs-ai-chat", {
857
2609
  _: 1
858
2610
  }, 8, ["onClick"])
859
2611
  ]))), 128))
860
- ])) : A("", !0),
861
- g("div", es, [
862
- i(T, {
2612
+ ])) : ie("", !0),
2613
+ I("div", la, [
2614
+ b(G, {
863
2615
  type: "primary",
864
2616
  link: "",
865
- onClick: n[3] || (n[3] = (_) => C.value = !0)
2617
+ onClick: k[3] || (k[3] = (O) => T.value = !0)
866
2618
  }, {
867
- default: c(() => [
868
- i(y, null, {
869
- default: c(() => [
870
- i(r(lt))
2619
+ default: R(() => [
2620
+ b(B, null, {
2621
+ default: R(() => [
2622
+ b(A(Qs))
871
2623
  ]),
872
2624
  _: 1
873
2625
  })
874
2626
  ]),
875
2627
  _: 1
876
2628
  }),
877
- i(U, {
878
- modelValue: S.value,
879
- "onUpdate:modelValue": n[4] || (n[4] = (_) => S.value = _),
2629
+ b(ne, {
2630
+ modelValue: h.value,
2631
+ "onUpdate:modelValue": k[4] || (k[4] = (O) => h.value = O),
880
2632
  type: "textarea",
881
2633
  rows: 2,
882
2634
  maxlength: "2000",
883
2635
  "show-word-limit": "",
884
2636
  placeholder: "输入消息... (Enter 发送,Shift+Enter 换行,Ctrl+V 粘贴截图)",
885
2637
  resize: "none",
886
- disabled: r(e).sending || r(e).tokenUsage?.limitReached,
887
- onKeydown: Ke(oe(pe, ["exact", "prevent"]), ["enter"]),
888
- onPaste: De
2638
+ disabled: A(e).sending || A(e).tokenUsage?.limitReached,
2639
+ onKeydown: Fs(Qt(Me, ["exact", "prevent"]), ["enter"]),
2640
+ onPaste: $t
889
2641
  }, null, 8, ["modelValue", "disabled", "onKeydown"]),
890
- i(T, {
2642
+ b(G, {
891
2643
  type: "primary",
892
- icon: r(rt),
2644
+ icon: A(Ks),
893
2645
  circle: "",
894
- loading: r(e).sending,
895
- disabled: !S.value.trim() && f.value.length === 0 || r(e).sending || r(e).tokenUsage?.limitReached,
896
- onClick: pe
2646
+ loading: A(e).sending,
2647
+ disabled: !h.value.trim() && S.value.length === 0 || A(e).sending || A(e).tokenUsage?.limitReached,
2648
+ onClick: Me
897
2649
  }, null, 8, ["icon", "loading", "disabled"])
898
2650
  ]),
899
- n[13] || (n[13] = g("div", { class: "ai-disclaimer" }, "内容由AI生成,请仔细甄别", -1))
2651
+ k[13] || (k[13] = I("div", { class: "ai-disclaimer" }, "内容由AI生成,请仔细甄别", -1))
900
2652
  ], 64))
901
2653
  ])
902
2654
  ])
903
- ], 6)) : A("", !0)
2655
+ ], 6)) : ie("", !0)
904
2656
  ]),
905
2657
  _: 1
906
2658
  }),
907
- i(ie, { name: "fade" }, {
908
- default: c(() => [
909
- l.value ? (a(), u("div", {
2659
+ b(Yt, { name: "fade" }, {
2660
+ default: R(() => [
2661
+ r.value ? (w(), v("div", {
910
2662
  key: 0,
911
2663
  class: "ai-panel-overlay",
912
- onClick: fe
913
- })) : A("", !0)
2664
+ onClick: at
2665
+ })) : ie("", !0)
914
2666
  ]),
915
2667
  _: 1
916
2668
  })
917
2669
  ], 64);
918
2670
  };
919
2671
  }
920
- }), xe = /* @__PURE__ */ K(is, [["__scopeId", "data-v-fde82f0b"]]), os = { class: "cgs-ai-chat-root" }, as = /* @__PURE__ */ q({
2672
+ }), Is = /* @__PURE__ */ Ot(ha, [["__scopeId", "data-v-fde82f0b"]]), da = { class: "cgs-ai-chat-root" }, fa = /* @__PURE__ */ Ct({
921
2673
  __name: "AiChat",
922
2674
  setup(t) {
923
- return (e, d) => (a(), u("div", os, [
924
- i($e),
925
- i(xe)
2675
+ return (e, n) => (w(), v("div", da, [
2676
+ b(gs),
2677
+ b(Is)
926
2678
  ]));
927
2679
  }
928
- }), ls = /* @__PURE__ */ K(as, [["__scopeId", "data-v-4f2a75e5"]]), gs = {
2680
+ }), ga = /* @__PURE__ */ Ot(fa, [["__scopeId", "data-v-4f2a75e5"]]), _a = {
929
2681
  install(t, e) {
930
- e?.baseUrl || console.warn("[@cgs/ai-chat] 警告:未提供 baseUrl,组件可能无法正常工作"), dt(e), t.component("AiChat", ls), t.component("AiChatFloat", $e), t.component("AiChatDrawer", xe);
2682
+ e?.baseUrl || console.warn("[@cgs/ai-chat] 警告:未提供 baseUrl,组件可能无法正常工作"), er(e), t.component("AiChat", ga), t.component("AiChatFloat", gs), t.component("AiChatDrawer", Is);
931
2683
  }
932
2684
  };
933
2685
  export {
934
- xe as AiChatDrawer,
935
- $e as AiChatFloat,
936
- Lt as AiChatMessage,
937
- gs as default,
938
- de as useAiStore
2686
+ Is as AiChatDrawer,
2687
+ gs as AiChatFloat,
2688
+ Fi as AiChatMessage,
2689
+ _a as default,
2690
+ dn as useAiStore
939
2691
  };