@doderasoftware/restify-ai 0.1.0-beta.11 → 0.1.0-beta.12
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/composables/useChatInput.d.ts.map +1 -1
- package/dist/restify-ai.js +957 -948
- package/dist/restify-ai.umd.cjs +28 -28
- package/dist/store/store.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/restify-ai.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var Hs = Object.defineProperty;
|
|
2
2
|
var Bs = (n, e, t) => e in n ? Hs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
-
var
|
|
4
|
-
import { ref as
|
|
3
|
+
var V = (n, e, t) => Bs(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { ref as U, nextTick as Pe, onUnmounted as vt, computed as N, onMounted as Tt, watch as _e, isRef as Fs, onBeforeUnmount as Us, defineComponent as he, createElementBlock as T, openBlock as k, normalizeClass as v, renderSlot as ce, createElementVNode as h, createCommentVNode as F, Fragment as be, renderList as Fe, toDisplayString as P, createBlock as Ee, resolveDynamicComponent as nn, withCtx as Ae, createVNode as ye, normalizeStyle as cn, Transition as bt, withModifiers as tt, unref as $, withDirectives as qs, vModelText as js, createTextVNode as sn, createStaticVNode as _n, Teleport as Ws, normalizeProps as zn, guardReactiveProps as Hn, onErrorCaptured as Ks } from "vue";
|
|
5
5
|
import { defineStore as Vs } from "pinia";
|
|
6
6
|
let Ke = null;
|
|
7
|
-
const Gs =
|
|
7
|
+
const Gs = U(null), os = {
|
|
8
8
|
title: "AI Assistant",
|
|
9
9
|
aiName: "AI Assistant",
|
|
10
10
|
you: "You",
|
|
@@ -160,8 +160,8 @@ function Xs(n, e, t) {
|
|
|
160
160
|
n(s.id = c);
|
|
161
161
|
break;
|
|
162
162
|
case "retry":
|
|
163
|
-
const
|
|
164
|
-
isNaN(
|
|
163
|
+
const y = parseInt(c, 10);
|
|
164
|
+
isNaN(y) || e(s.retry = y);
|
|
165
165
|
break;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
@@ -190,39 +190,39 @@ var er = function(n, e) {
|
|
|
190
190
|
const rn = "text/event-stream", tr = 1e3, Un = "last-event-id";
|
|
191
191
|
function nr(n, e) {
|
|
192
192
|
var { signal: t, headers: s, onopen: r, onmessage: o, onclose: i, onerror: a, openWhenHidden: u, fetch: d } = e, c = er(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
193
|
-
return new Promise((
|
|
193
|
+
return new Promise((y, x) => {
|
|
194
194
|
const f = Object.assign({}, s);
|
|
195
195
|
f.accept || (f.accept = rn);
|
|
196
196
|
let p;
|
|
197
|
-
function
|
|
197
|
+
function D() {
|
|
198
198
|
p.abort(), document.hidden || z();
|
|
199
199
|
}
|
|
200
|
-
u || document.addEventListener("visibilitychange",
|
|
201
|
-
let
|
|
202
|
-
function
|
|
203
|
-
document.removeEventListener("visibilitychange",
|
|
200
|
+
u || document.addEventListener("visibilitychange", D);
|
|
201
|
+
let g = tr, m = 0;
|
|
202
|
+
function C() {
|
|
203
|
+
document.removeEventListener("visibilitychange", D), window.clearTimeout(m), p.abort();
|
|
204
204
|
}
|
|
205
205
|
t == null || t.addEventListener("abort", () => {
|
|
206
|
-
|
|
206
|
+
C(), y();
|
|
207
207
|
});
|
|
208
|
-
const
|
|
208
|
+
const S = d ?? window.fetch, b = r ?? sr;
|
|
209
209
|
async function z() {
|
|
210
|
-
var
|
|
210
|
+
var q;
|
|
211
211
|
p = new AbortController();
|
|
212
212
|
try {
|
|
213
|
-
const
|
|
214
|
-
await
|
|
215
|
-
|
|
216
|
-
}, (
|
|
217
|
-
|
|
218
|
-
}, o))), i == null || i(),
|
|
219
|
-
} catch (
|
|
213
|
+
const G = await S(n, Object.assign(Object.assign({}, c), { headers: f, signal: p.signal }));
|
|
214
|
+
await b(G), await Zs(G.body, Ys(Xs((A) => {
|
|
215
|
+
A ? f[Un] = A : delete f[Un];
|
|
216
|
+
}, (A) => {
|
|
217
|
+
g = A;
|
|
218
|
+
}, o))), i == null || i(), C(), y();
|
|
219
|
+
} catch (G) {
|
|
220
220
|
if (!p.signal.aborted)
|
|
221
221
|
try {
|
|
222
|
-
const
|
|
223
|
-
window.clearTimeout(
|
|
224
|
-
} catch (
|
|
225
|
-
|
|
222
|
+
const A = (q = a == null ? void 0 : a(G)) !== null && q !== void 0 ? q : g;
|
|
223
|
+
window.clearTimeout(m), m = window.setTimeout(z, A);
|
|
224
|
+
} catch (A) {
|
|
225
|
+
C(), x(A);
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
}
|
|
@@ -234,7 +234,7 @@ function sr(n) {
|
|
|
234
234
|
if (!(e != null && e.startsWith(rn)))
|
|
235
235
|
throw new Error(`Expected content-type to be ${rn}, Actual: ${e}`);
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function $t(n) {
|
|
238
238
|
if (!n)
|
|
239
239
|
throw console.error("[RestifyAi] Endpoint is undefined. Check your endpoints configuration."), new Error("AI service endpoint is not configured. Please contact support.");
|
|
240
240
|
const e = te(), t = (e == null ? void 0 : e.baseUrl) || "";
|
|
@@ -272,7 +272,7 @@ function Ue(n) {
|
|
|
272
272
|
const e = te();
|
|
273
273
|
return n === "chatHistory" ? (e == null ? void 0 : e.chatHistoryKey) || "restify_ai_chat_history" : n === "setupComplete" ? "restify_ai_setup_complete" : (e == null ? void 0 : e.drawerStateKey) || "restify_ai_drawer_open";
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function ct(n) {
|
|
276
276
|
try {
|
|
277
277
|
sessionStorage.setItem(Ue("chatHistory"), JSON.stringify(n));
|
|
278
278
|
} catch (e) {
|
|
@@ -379,7 +379,7 @@ function jn() {
|
|
|
379
379
|
lastError: null
|
|
380
380
|
};
|
|
381
381
|
}
|
|
382
|
-
let
|
|
382
|
+
let dt = new AbortController();
|
|
383
383
|
const Ge = Vs("restifyAiStore", {
|
|
384
384
|
state: () => {
|
|
385
385
|
const n = lr(), e = dr();
|
|
@@ -443,7 +443,7 @@ const Ge = Vs("restifyAiStore", {
|
|
|
443
443
|
let o = "", i = !1;
|
|
444
444
|
const a = r.retry || {}, u = a.maxRetries ?? 0, d = a.retryDelay ?? 1e3;
|
|
445
445
|
let c = 0;
|
|
446
|
-
const
|
|
446
|
+
const y = e.map((p) => ({
|
|
447
447
|
id: p.id,
|
|
448
448
|
name: p.name,
|
|
449
449
|
url: p.url,
|
|
@@ -456,62 +456,62 @@ const Ge = Vs("restifyAiStore", {
|
|
|
456
456
|
role: nt.User,
|
|
457
457
|
message: n,
|
|
458
458
|
loading: !1,
|
|
459
|
-
attachments:
|
|
459
|
+
attachments: y,
|
|
460
460
|
mentions: t,
|
|
461
461
|
timestamp: Date.now()
|
|
462
|
-
}),
|
|
463
|
-
const
|
|
464
|
-
var p,
|
|
462
|
+
}), y.forEach((p) => this.registerUploadedFile(p)), ct(this.chatHistory), this.sending = !0, this.quota.remaining > 0 && !s && (this.quota.remaining--, this.quota.used++), this.scrollToBottom(), this.chatHistory.length >= this.chatHistoryLimit && ((f = r.onError) == null || f.call(r, new Error("Chat history limit reached")));
|
|
463
|
+
const x = async () => {
|
|
464
|
+
var p, D, g;
|
|
465
465
|
try {
|
|
466
|
-
const
|
|
467
|
-
role:
|
|
468
|
-
content:
|
|
469
|
-
})),
|
|
470
|
-
|
|
471
|
-
extracted_text:
|
|
472
|
-
file_name:
|
|
473
|
-
mime_type:
|
|
474
|
-
...
|
|
475
|
-
...
|
|
466
|
+
const m = this.chatHistory.map((M) => ({
|
|
467
|
+
role: M.role,
|
|
468
|
+
content: M.message
|
|
469
|
+
})), C = {}, S = (M) => {
|
|
470
|
+
M != null && M.id && (C[M.id] = {
|
|
471
|
+
extracted_text: M.extractedText || "",
|
|
472
|
+
file_name: M.name,
|
|
473
|
+
mime_type: M.type || "",
|
|
474
|
+
...M.size ? { file_size: M.size } : {},
|
|
475
|
+
...M.url ? { file_url: M.url } : {}
|
|
476
476
|
});
|
|
477
477
|
};
|
|
478
|
-
Object.values(this.uploadedFiles).forEach(
|
|
479
|
-
var
|
|
480
|
-
return (
|
|
481
|
-
}),
|
|
482
|
-
const
|
|
478
|
+
Object.values(this.uploadedFiles).forEach(S), this.chatHistory.forEach((M) => {
|
|
479
|
+
var W;
|
|
480
|
+
return (W = M.attachments) == null ? void 0 : W.forEach(S);
|
|
481
|
+
}), y.forEach(S);
|
|
482
|
+
const b = Object.values(C), z = this.chatHistory.length;
|
|
483
483
|
this.chatHistory.push({
|
|
484
484
|
id: crypto.randomUUID(),
|
|
485
485
|
role: nt.Assistant,
|
|
486
486
|
message: "",
|
|
487
487
|
loading: !0,
|
|
488
488
|
timestamp: Date.now()
|
|
489
|
-
}),
|
|
490
|
-
const
|
|
489
|
+
}), ct(this.chatHistory), dt = new AbortController(), this.scrollToBottom();
|
|
490
|
+
const q = await r.getAuthToken(), A = {
|
|
491
491
|
"Content-Type": "application/json",
|
|
492
492
|
Accept: "application/vnd.api+json",
|
|
493
493
|
...r.getCustomHeaders ? await r.getCustomHeaders() : {}
|
|
494
494
|
};
|
|
495
|
-
this.setupState.isActive && this.setupState.testApiKey ?
|
|
495
|
+
this.setupState.isActive && this.setupState.testApiKey ? A["X-Test-Api-Key"] = this.setupState.testApiKey : q && (A.Authorization = `Bearer ${q}`);
|
|
496
496
|
const _ = {};
|
|
497
497
|
if (typeof window < "u") {
|
|
498
498
|
_.route = window.location.pathname;
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}), Object.keys(
|
|
499
|
+
const M = new URLSearchParams(window.location.search), W = {};
|
|
500
|
+
M.forEach((qe, Me) => {
|
|
501
|
+
W[Me] = qe;
|
|
502
|
+
}), Object.keys(W).length > 0 && (_.query = W), document.title && (_.pageTitle = document.title);
|
|
503
503
|
}
|
|
504
|
-
t.length > 0 && (_.mentionedEntities = t.map((
|
|
505
|
-
type:
|
|
506
|
-
id:
|
|
507
|
-
displayName:
|
|
508
|
-
metadata:
|
|
504
|
+
t.length > 0 && (_.mentionedEntities = t.map((M) => ({
|
|
505
|
+
type: M.type,
|
|
506
|
+
id: M.id,
|
|
507
|
+
displayName: M.name,
|
|
508
|
+
metadata: M.metadata
|
|
509
509
|
})));
|
|
510
510
|
let R = {
|
|
511
511
|
message: n,
|
|
512
|
-
history:
|
|
512
|
+
history: m,
|
|
513
513
|
stream: !0,
|
|
514
|
-
...
|
|
514
|
+
...b.length > 0 && { files: b },
|
|
515
515
|
...Object.keys(_).length > 0 && { context: _ },
|
|
516
516
|
...this.supportRequestMode && { contact_support: !0 },
|
|
517
517
|
...r.model && { model: r.model },
|
|
@@ -519,70 +519,75 @@ const Ge = Vs("restifyAiStore", {
|
|
|
519
519
|
...r.maxTokens && { max_tokens: r.maxTokens }
|
|
520
520
|
};
|
|
521
521
|
r.beforeSend && (R = await r.beforeSend(R)), r.buildRequest && (R = await r.buildRequest(R)), (p = r.onMessageSent) == null || p.call(r, this.chatHistory[z - 1]);
|
|
522
|
-
const
|
|
523
|
-
let
|
|
522
|
+
const E = $t(r.endpoints.ask);
|
|
523
|
+
let Y = {
|
|
524
524
|
method: "POST",
|
|
525
525
|
body: JSON.stringify(R),
|
|
526
|
-
headers:
|
|
526
|
+
headers: A
|
|
527
527
|
};
|
|
528
|
-
return r.requestInterceptor && (
|
|
528
|
+
return r.requestInterceptor && (Y = await r.requestInterceptor(E, Y)), (D = r.onStreamStart) == null || D.call(r), await nr(E, {
|
|
529
529
|
method: "POST",
|
|
530
530
|
body: JSON.stringify(R),
|
|
531
|
-
signal:
|
|
532
|
-
headers:
|
|
531
|
+
signal: dt.signal,
|
|
532
|
+
headers: Y.headers,
|
|
533
533
|
openWhenHidden: !0,
|
|
534
|
-
async onopen(
|
|
535
|
-
if (!
|
|
536
|
-
if (
|
|
537
|
-
const
|
|
538
|
-
throw
|
|
534
|
+
async onopen(M) {
|
|
535
|
+
if (!M.ok) {
|
|
536
|
+
if (M.status === 429) {
|
|
537
|
+
const W = Ge();
|
|
538
|
+
throw W.error = {
|
|
539
539
|
message: de("noQuota"),
|
|
540
540
|
failedQuestion: n,
|
|
541
|
-
failedAttachments:
|
|
541
|
+
failedAttachments: y,
|
|
542
542
|
timestamp: Date.now(),
|
|
543
543
|
quotaExceeded: !0
|
|
544
|
-
}, await
|
|
544
|
+
}, await W.fetchQuota(), new Error("Quota exceeded");
|
|
545
545
|
}
|
|
546
|
-
throw new Error(`Failed to connect: ${
|
|
546
|
+
throw new Error(`Failed to connect: ${M.status}`);
|
|
547
547
|
}
|
|
548
548
|
},
|
|
549
|
-
onmessage: async (
|
|
549
|
+
onmessage: async (M) => {
|
|
550
550
|
var Me, Re, ze;
|
|
551
|
-
const
|
|
552
|
-
if (!
|
|
551
|
+
const W = this.parseStreamContent(M.event, M.data);
|
|
552
|
+
if (!W) return;
|
|
553
553
|
this.chatHistory[z].loading = !1;
|
|
554
554
|
const qe = {
|
|
555
|
-
content:
|
|
556
|
-
done:
|
|
557
|
-
raw:
|
|
555
|
+
content: W,
|
|
556
|
+
done: W === "[DONE]",
|
|
557
|
+
raw: M.data
|
|
558
558
|
};
|
|
559
|
-
(Me = r.onStreamChunk) == null || Me.call(r, qe), o ?
|
|
559
|
+
(Me = r.onStreamChunk) == null || Me.call(r, qe), o ? W === "[DONE]" ? (this.chatHistory[z].streaming = !1, ct(this.chatHistory), (Re = r.onStreamEnd) == null || Re.call(r, o), this.quota.remaining === 0 && r.enableSupportMode !== !1 && (this.supportRequestMode = !0), this.supportRequestMode && this.quota.remaining > 0 && (this.supportRequestMode = !1), r.afterResponse && await r.afterResponse(this.chatHistory[z]), (ze = r.onResponseReceived) == null || ze.call(r, this.chatHistory[z])) : (o += W, this.chatHistory[z].message = o) : (o = W, this.chatHistory[z].message = o, this.chatHistory[z].streaming = !0), await this.scrollToBottom();
|
|
560
|
+
},
|
|
561
|
+
onclose: () => {
|
|
562
|
+
var M, W;
|
|
563
|
+
o && !i && (this.chatHistory[z].streaming = !1, this.chatHistory[z].loading = !1, ct(this.chatHistory), (M = r.onStreamEnd) == null || M.call(r, o), r.afterResponse && r.afterResponse(this.chatHistory[z]), (W = r.onResponseReceived) == null || W.call(r, this.chatHistory[z]));
|
|
560
564
|
},
|
|
561
|
-
onerror(
|
|
562
|
-
|
|
565
|
+
onerror: (M) => {
|
|
566
|
+
if (!o)
|
|
567
|
+
throw i = !0, M;
|
|
563
568
|
}
|
|
564
569
|
}), !0;
|
|
565
|
-
} catch (
|
|
570
|
+
} catch (m) {
|
|
566
571
|
i = !0;
|
|
567
|
-
const
|
|
568
|
-
return this.chatHistory.splice(
|
|
569
|
-
message: rr(
|
|
572
|
+
const C = this.chatHistory.length - 1;
|
|
573
|
+
return this.chatHistory.splice(C, 1), m.name === "AbortError" ? !0 : c < u && (a.shouldRetry ? a.shouldRetry(m, c) : !0) ? (c++, await ir(d * c), x()) : (this.error = {
|
|
574
|
+
message: rr(m),
|
|
570
575
|
failedQuestion: n,
|
|
571
|
-
failedAttachments:
|
|
576
|
+
failedAttachments: y,
|
|
572
577
|
timestamp: Date.now()
|
|
573
578
|
}, cr({
|
|
574
579
|
message: this.error.message,
|
|
575
580
|
failedQuestion: this.error.failedQuestion,
|
|
576
581
|
failedAttachments: this.error.failedAttachments || null
|
|
577
|
-
}), (
|
|
582
|
+
}), (g = r.onError) == null || g.call(r, m), !1);
|
|
578
583
|
} finally {
|
|
579
584
|
this.sending = !1;
|
|
580
585
|
}
|
|
581
586
|
};
|
|
582
|
-
return
|
|
587
|
+
return x();
|
|
583
588
|
},
|
|
584
589
|
cancelRequest() {
|
|
585
|
-
|
|
590
|
+
dt == null || dt.abort(), this.chatHistory = this.chatHistory.map((n) => ({
|
|
586
591
|
...n,
|
|
587
592
|
streaming: !1,
|
|
588
593
|
loading: !1
|
|
@@ -598,7 +603,7 @@ const Ge = Vs("restifyAiStore", {
|
|
|
598
603
|
async retry() {
|
|
599
604
|
if (!this.error.failedQuestion) return !1;
|
|
600
605
|
const n = this.error.failedQuestion, e = this.error.failedAttachments || [], t = this.chatHistory[this.chatHistory.length - 1];
|
|
601
|
-
return (t == null ? void 0 : t.role) === nt.User && t.message === n && (this.chatHistory.pop(),
|
|
606
|
+
return (t == null ? void 0 : t.role) === nt.User && t.message === n && (this.chatHistory.pop(), ct(this.chatHistory)), this.clearError(), await this.askQuestion(n, e);
|
|
602
607
|
},
|
|
603
608
|
clearError() {
|
|
604
609
|
this.error = {
|
|
@@ -617,7 +622,7 @@ const Ge = Vs("restifyAiStore", {
|
|
|
617
622
|
const n = te();
|
|
618
623
|
if ((e = n == null ? void 0 : n.endpoints) != null && e.quota)
|
|
619
624
|
try {
|
|
620
|
-
const s = await n.getAuthToken(), r = n.getCustomHeaders ? await n.getCustomHeaders() : {}, o =
|
|
625
|
+
const s = await n.getAuthToken(), r = n.getCustomHeaders ? await n.getCustomHeaders() : {}, o = $t(n.endpoints.quota), i = await fetch(o, {
|
|
621
626
|
headers: {
|
|
622
627
|
Accept: "application/json",
|
|
623
628
|
...s ? { Authorization: `Bearer ${s}` } : {},
|
|
@@ -651,34 +656,34 @@ const Ge = Vs("restifyAiStore", {
|
|
|
651
656
|
};
|
|
652
657
|
(o = e.onFileUploadStart) == null || o.call(e, s);
|
|
653
658
|
try {
|
|
654
|
-
const d = await e.getAuthToken(), c = e.getCustomHeaders ? await e.getCustomHeaders() : {},
|
|
655
|
-
|
|
656
|
-
const f = await new Promise((p,
|
|
657
|
-
const
|
|
658
|
-
|
|
659
|
-
var
|
|
660
|
-
if (
|
|
661
|
-
const
|
|
662
|
-
s.progress =
|
|
659
|
+
const d = await e.getAuthToken(), c = e.getCustomHeaders ? await e.getCustomHeaders() : {}, y = $t(e.endpoints.uploadFile), x = new FormData();
|
|
660
|
+
x.append("file", n);
|
|
661
|
+
const f = await new Promise((p, D) => {
|
|
662
|
+
const g = new XMLHttpRequest();
|
|
663
|
+
g.upload.addEventListener("progress", (m) => {
|
|
664
|
+
var C;
|
|
665
|
+
if (m.lengthComputable) {
|
|
666
|
+
const S = Math.round(m.loaded / m.total * 100);
|
|
667
|
+
s.progress = S, (C = e.onFileUploadProgress) == null || C.call(e, s, S);
|
|
663
668
|
}
|
|
664
|
-
}),
|
|
665
|
-
var
|
|
666
|
-
if (
|
|
669
|
+
}), g.addEventListener("load", () => {
|
|
670
|
+
var m, C;
|
|
671
|
+
if (g.status >= 200 && g.status < 300)
|
|
667
672
|
try {
|
|
668
|
-
const
|
|
673
|
+
const S = JSON.parse(g.responseText), b = {
|
|
669
674
|
...s,
|
|
670
|
-
url:
|
|
671
|
-
extractedText:
|
|
675
|
+
url: S.url || ((m = S.data) == null ? void 0 : m.url),
|
|
676
|
+
extractedText: S.extracted_text || ((C = S.data) == null ? void 0 : C.extracted_text),
|
|
672
677
|
uploading: !1,
|
|
673
678
|
progress: 100
|
|
674
679
|
};
|
|
675
|
-
p(
|
|
680
|
+
p(b);
|
|
676
681
|
} catch {
|
|
677
|
-
|
|
682
|
+
D(new Error("Failed to parse upload response"));
|
|
678
683
|
}
|
|
679
684
|
else
|
|
680
|
-
|
|
681
|
-
}),
|
|
685
|
+
D(new Error(`Upload failed: ${g.status}`));
|
|
686
|
+
}), g.addEventListener("error", () => D(new Error("Upload failed"))), g.open("POST", y), d && g.setRequestHeader("Authorization", `Bearer ${d}`), Object.entries(c).forEach(([m, C]) => g.setRequestHeader(m, C)), g.send(x);
|
|
682
687
|
});
|
|
683
688
|
return (i = e.onFileUploadComplete) == null || i.call(e, f), f;
|
|
684
689
|
} catch (d) {
|
|
@@ -738,7 +743,7 @@ const Ge = Vs("restifyAiStore", {
|
|
|
738
743
|
Accept: "application/json"
|
|
739
744
|
};
|
|
740
745
|
this.setupState.testApiKey && (e["X-Test-Api-Key"] = this.setupState.testApiKey);
|
|
741
|
-
const t = n.endpoints.quota || n.endpoints.ask, s =
|
|
746
|
+
const t = n.endpoints.quota || n.endpoints.ask, s = $t(t), r = await fetch(s, {
|
|
742
747
|
method: n.endpoints.quota ? "GET" : "POST",
|
|
743
748
|
headers: e,
|
|
744
749
|
...n.endpoints.quota ? {} : {
|
|
@@ -879,7 +884,7 @@ function xe(n, e) {
|
|
|
879
884
|
return n;
|
|
880
885
|
}
|
|
881
886
|
const vr = /(^|[^\[])\^/g;
|
|
882
|
-
function
|
|
887
|
+
function K(n, e) {
|
|
883
888
|
let t = typeof n == "string" ? n : n.source;
|
|
884
889
|
e = e || "";
|
|
885
890
|
const s = {
|
|
@@ -899,7 +904,7 @@ function Kn(n) {
|
|
|
899
904
|
}
|
|
900
905
|
return n;
|
|
901
906
|
}
|
|
902
|
-
const
|
|
907
|
+
const kt = { exec: () => null };
|
|
903
908
|
function Vn(n, e) {
|
|
904
909
|
const t = n.replace(/\|/g, (o, i, a) => {
|
|
905
910
|
let u = !1, d = i;
|
|
@@ -918,7 +923,7 @@ function Vn(n, e) {
|
|
|
918
923
|
s[r] = s[r].trim().replace(/\\\|/g, "|");
|
|
919
924
|
return s;
|
|
920
925
|
}
|
|
921
|
-
function
|
|
926
|
+
function ht(n, e, t) {
|
|
922
927
|
const s = n.length;
|
|
923
928
|
if (s === 0)
|
|
924
929
|
return "";
|
|
@@ -980,10 +985,10 @@ function Sr(n, e) {
|
|
|
980
985
|
class _t {
|
|
981
986
|
// set by the lexer
|
|
982
987
|
constructor(e) {
|
|
983
|
-
|
|
984
|
-
|
|
988
|
+
V(this, "options");
|
|
989
|
+
V(this, "rules");
|
|
985
990
|
// set by the lexer
|
|
986
|
-
|
|
991
|
+
V(this, "lexer");
|
|
987
992
|
this.options = e || Qe;
|
|
988
993
|
}
|
|
989
994
|
space(e) {
|
|
@@ -1002,7 +1007,7 @@ class _t {
|
|
|
1002
1007
|
type: "code",
|
|
1003
1008
|
raw: t[0],
|
|
1004
1009
|
codeBlockStyle: "indented",
|
|
1005
|
-
text: this.options.pedantic ? s :
|
|
1010
|
+
text: this.options.pedantic ? s : ht(s, `
|
|
1006
1011
|
`)
|
|
1007
1012
|
};
|
|
1008
1013
|
}
|
|
@@ -1024,7 +1029,7 @@ class _t {
|
|
|
1024
1029
|
if (t) {
|
|
1025
1030
|
let s = t[2].trim();
|
|
1026
1031
|
if (/#$/.test(s)) {
|
|
1027
|
-
const r =
|
|
1032
|
+
const r = ht(s, "#");
|
|
1028
1033
|
(this.options.pedantic || !r || / $/.test(r)) && (s = r.trim());
|
|
1029
1034
|
}
|
|
1030
1035
|
return {
|
|
@@ -1041,14 +1046,14 @@ class _t {
|
|
|
1041
1046
|
if (t)
|
|
1042
1047
|
return {
|
|
1043
1048
|
type: "hr",
|
|
1044
|
-
raw:
|
|
1049
|
+
raw: ht(t[0], `
|
|
1045
1050
|
`)
|
|
1046
1051
|
};
|
|
1047
1052
|
}
|
|
1048
1053
|
blockquote(e) {
|
|
1049
1054
|
const t = this.rules.block.blockquote.exec(e);
|
|
1050
1055
|
if (t) {
|
|
1051
|
-
let s =
|
|
1056
|
+
let s = ht(t[0], `
|
|
1052
1057
|
`).split(`
|
|
1053
1058
|
`), r = "", o = "";
|
|
1054
1059
|
const i = [];
|
|
@@ -1065,28 +1070,28 @@ class _t {
|
|
|
1065
1070
|
break;
|
|
1066
1071
|
s = s.slice(d);
|
|
1067
1072
|
const c = u.join(`
|
|
1068
|
-
`),
|
|
1073
|
+
`), y = c.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, `
|
|
1069
1074
|
$1`).replace(/^ {0,3}>[ \t]?/gm, "");
|
|
1070
1075
|
r = r ? `${r}
|
|
1071
1076
|
${c}` : c, o = o ? `${o}
|
|
1072
|
-
${
|
|
1073
|
-
const
|
|
1074
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(
|
|
1077
|
+
${y}` : y;
|
|
1078
|
+
const x = this.lexer.state.top;
|
|
1079
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(y, i, !0), this.lexer.state.top = x, s.length === 0)
|
|
1075
1080
|
break;
|
|
1076
1081
|
const f = i[i.length - 1];
|
|
1077
1082
|
if ((f == null ? void 0 : f.type) === "code")
|
|
1078
1083
|
break;
|
|
1079
1084
|
if ((f == null ? void 0 : f.type) === "blockquote") {
|
|
1080
|
-
const p = f,
|
|
1085
|
+
const p = f, D = p.raw + `
|
|
1081
1086
|
` + s.join(`
|
|
1082
|
-
`),
|
|
1083
|
-
i[i.length - 1] =
|
|
1087
|
+
`), g = this.blockquote(D);
|
|
1088
|
+
i[i.length - 1] = g, r = r.substring(0, r.length - p.raw.length) + g.raw, o = o.substring(0, o.length - p.text.length) + g.text;
|
|
1084
1089
|
break;
|
|
1085
1090
|
} else if ((f == null ? void 0 : f.type) === "list") {
|
|
1086
|
-
const p = f,
|
|
1091
|
+
const p = f, D = p.raw + `
|
|
1087
1092
|
` + s.join(`
|
|
1088
|
-
`),
|
|
1089
|
-
i[i.length - 1] =
|
|
1093
|
+
`), g = this.list(D);
|
|
1094
|
+
i[i.length - 1] = g, r = r.substring(0, r.length - f.raw.length) + g.raw, o = o.substring(0, o.length - p.raw.length) + g.raw, s = D.substring(i[i.length - 1].raw.length).split(`
|
|
1090
1095
|
`);
|
|
1091
1096
|
continue;
|
|
1092
1097
|
}
|
|
@@ -1119,38 +1124,38 @@ ${g}` : g;
|
|
|
1119
1124
|
if (!(t = i.exec(e)) || this.rules.block.hr.test(e))
|
|
1120
1125
|
break;
|
|
1121
1126
|
d = t[0], e = e.substring(d.length);
|
|
1122
|
-
let
|
|
1123
|
-
`, 1)[0].replace(/^\t+/, (
|
|
1124
|
-
`, 1)[0], f = !
|
|
1125
|
-
if (this.options.pedantic ? (p = 2, c =
|
|
1126
|
-
`, e = e.substring(
|
|
1127
|
-
const
|
|
1127
|
+
let y = t[2].split(`
|
|
1128
|
+
`, 1)[0].replace(/^\t+/, (m) => " ".repeat(3 * m.length)), x = e.split(`
|
|
1129
|
+
`, 1)[0], f = !y.trim(), p = 0;
|
|
1130
|
+
if (this.options.pedantic ? (p = 2, c = y.trimStart()) : f ? p = t[1].length + 1 : (p = t[2].search(/[^ ]/), p = p > 4 ? 1 : p, c = y.slice(p), p += t[1].length), f && /^[ \t]*$/.test(x) && (d += x + `
|
|
1131
|
+
`, e = e.substring(x.length + 1), u = !0), !u) {
|
|
1132
|
+
const m = new RegExp(`^ {0,${Math.min(3, p - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), C = new RegExp(`^ {0,${Math.min(3, p - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), S = new RegExp(`^ {0,${Math.min(3, p - 1)}}(?:\`\`\`|~~~)`), b = new RegExp(`^ {0,${Math.min(3, p - 1)}}#`), z = new RegExp(`^ {0,${Math.min(3, p - 1)}}<(?:[a-z].*>|!--)`, "i");
|
|
1128
1133
|
for (; e; ) {
|
|
1129
|
-
const
|
|
1134
|
+
const q = e.split(`
|
|
1130
1135
|
`, 1)[0];
|
|
1131
|
-
let
|
|
1132
|
-
if (
|
|
1136
|
+
let G;
|
|
1137
|
+
if (x = q, this.options.pedantic ? (x = x.replace(/^ {1,4}(?=( {4})*[^ ])/g, " "), G = x) : G = x.replace(/\t/g, " "), S.test(x) || b.test(x) || z.test(x) || m.test(x) || C.test(x))
|
|
1133
1138
|
break;
|
|
1134
|
-
if (
|
|
1139
|
+
if (G.search(/[^ ]/) >= p || !x.trim())
|
|
1135
1140
|
c += `
|
|
1136
|
-
` +
|
|
1141
|
+
` + G.slice(p);
|
|
1137
1142
|
else {
|
|
1138
|
-
if (f ||
|
|
1143
|
+
if (f || y.replace(/\t/g, " ").search(/[^ ]/) >= 4 || S.test(y) || b.test(y) || C.test(y))
|
|
1139
1144
|
break;
|
|
1140
1145
|
c += `
|
|
1141
|
-
` +
|
|
1146
|
+
` + x;
|
|
1142
1147
|
}
|
|
1143
|
-
!f && !
|
|
1144
|
-
`, e = e.substring(
|
|
1148
|
+
!f && !x.trim() && (f = !0), d += q + `
|
|
1149
|
+
`, e = e.substring(q.length + 1), y = G.slice(p);
|
|
1145
1150
|
}
|
|
1146
1151
|
}
|
|
1147
1152
|
o.loose || (a ? o.loose = !0 : /\n[ \t]*\n[ \t]*$/.test(d) && (a = !0));
|
|
1148
|
-
let
|
|
1149
|
-
this.options.gfm && (
|
|
1153
|
+
let D = null, g;
|
|
1154
|
+
this.options.gfm && (D = /^\[[ xX]\] /.exec(c), D && (g = D[0] !== "[ ] ", c = c.replace(/^\[[ xX]\] +/, ""))), o.items.push({
|
|
1150
1155
|
type: "list_item",
|
|
1151
1156
|
raw: d,
|
|
1152
|
-
task: !!
|
|
1153
|
-
checked:
|
|
1157
|
+
task: !!D,
|
|
1158
|
+
checked: g,
|
|
1154
1159
|
loose: !1,
|
|
1155
1160
|
text: c,
|
|
1156
1161
|
tokens: []
|
|
@@ -1159,7 +1164,7 @@ ${g}` : g;
|
|
|
1159
1164
|
o.items[o.items.length - 1].raw = o.items[o.items.length - 1].raw.trimEnd(), o.items[o.items.length - 1].text = o.items[o.items.length - 1].text.trimEnd(), o.raw = o.raw.trimEnd();
|
|
1160
1165
|
for (let u = 0; u < o.items.length; u++)
|
|
1161
1166
|
if (this.lexer.state.top = !1, o.items[u].tokens = this.lexer.blockTokens(o.items[u].text, []), !o.loose) {
|
|
1162
|
-
const d = o.items[u].tokens.filter((
|
|
1167
|
+
const d = o.items[u].tokens.filter((y) => y.type === "space"), c = d.length > 0 && d.some((y) => /\n.*\n/.test(y.raw));
|
|
1163
1168
|
o.loose = c;
|
|
1164
1169
|
}
|
|
1165
1170
|
if (o.loose)
|
|
@@ -1286,7 +1291,7 @@ ${g}` : g;
|
|
|
1286
1291
|
if (!this.options.pedantic && /^</.test(s)) {
|
|
1287
1292
|
if (!/>$/.test(s))
|
|
1288
1293
|
return;
|
|
1289
|
-
const i =
|
|
1294
|
+
const i = ht(s.slice(0, -1), "\\");
|
|
1290
1295
|
if ((s.length - i.length) % 2 === 0)
|
|
1291
1296
|
return;
|
|
1292
1297
|
} else {
|
|
@@ -1330,8 +1335,8 @@ ${g}` : g;
|
|
|
1330
1335
|
if (!(r[1] || r[2] || "") || !s || this.rules.inline.punctuation.exec(s)) {
|
|
1331
1336
|
const i = [...r[0]].length - 1;
|
|
1332
1337
|
let a, u, d = i, c = 0;
|
|
1333
|
-
const
|
|
1334
|
-
for (
|
|
1338
|
+
const y = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1339
|
+
for (y.lastIndex = 0, t = t.slice(-1 * e.length + i); (r = y.exec(t)) != null; ) {
|
|
1335
1340
|
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a)
|
|
1336
1341
|
continue;
|
|
1337
1342
|
if (u = [...a].length, r[3] || r[4]) {
|
|
@@ -1344,14 +1349,14 @@ ${g}` : g;
|
|
|
1344
1349
|
if (d -= u, d > 0)
|
|
1345
1350
|
continue;
|
|
1346
1351
|
u = Math.min(u, u + d + c);
|
|
1347
|
-
const
|
|
1352
|
+
const x = [...r[0]][0].length, f = e.slice(0, i + r.index + x + u);
|
|
1348
1353
|
if (Math.min(i, u) % 2) {
|
|
1349
|
-
const
|
|
1354
|
+
const D = f.slice(1, -1);
|
|
1350
1355
|
return {
|
|
1351
1356
|
type: "em",
|
|
1352
1357
|
raw: f,
|
|
1353
|
-
text:
|
|
1354
|
-
tokens: this.lexer.inlineTokens(
|
|
1358
|
+
text: D,
|
|
1359
|
+
tokens: this.lexer.inlineTokens(D)
|
|
1355
1360
|
};
|
|
1356
1361
|
}
|
|
1357
1362
|
const p = f.slice(2, -2);
|
|
@@ -1454,43 +1459,43 @@ ${g}` : g;
|
|
|
1454
1459
|
}
|
|
1455
1460
|
}
|
|
1456
1461
|
}
|
|
1457
|
-
const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Er = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
|
|
1462
|
+
const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Er = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, St = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Mr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, ms = /(?:[*+-]|\d{1,9}[.)])/, ys = K(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, ms).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex(), fn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Rr = /^[^\n]+/, pn = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Lr = K(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", pn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ir = K(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, ms).getRegex(), Bt = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", gn = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, $r = K("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", gn).replace("tag", Bt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), xs = K(fn).replace("hr", St).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Bt).getRegex(), Dr = K(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", xs).getRegex(), mn = {
|
|
1458
1463
|
blockquote: Dr,
|
|
1459
1464
|
code: Cr,
|
|
1460
1465
|
def: Lr,
|
|
1461
1466
|
fences: Er,
|
|
1462
1467
|
heading: Mr,
|
|
1463
|
-
hr:
|
|
1468
|
+
hr: St,
|
|
1464
1469
|
html: $r,
|
|
1465
1470
|
lheading: ys,
|
|
1466
1471
|
list: Ir,
|
|
1467
1472
|
newline: Ar,
|
|
1468
1473
|
paragraph: xs,
|
|
1469
|
-
table:
|
|
1474
|
+
table: kt,
|
|
1470
1475
|
text: Rr
|
|
1471
|
-
}, Qn =
|
|
1476
|
+
}, Qn = K("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", St).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Bt).getRegex(), Or = {
|
|
1472
1477
|
...mn,
|
|
1473
1478
|
table: Qn,
|
|
1474
|
-
paragraph:
|
|
1479
|
+
paragraph: K(fn).replace("hr", St).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Qn).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Bt).getRegex()
|
|
1475
1480
|
}, Nr = {
|
|
1476
1481
|
...mn,
|
|
1477
|
-
html:
|
|
1482
|
+
html: K(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", gn).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
1478
1483
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
1479
1484
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
1480
|
-
fences:
|
|
1485
|
+
fences: kt,
|
|
1481
1486
|
// fences not supported
|
|
1482
1487
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1483
|
-
paragraph:
|
|
1488
|
+
paragraph: K(fn).replace("hr", St).replace("heading", ` *#{1,6} *[^
|
|
1484
1489
|
]`).replace("lheading", ys).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
1485
|
-
}, ks = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Pr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ws = /^( {2,}|\\)\n(?!\s*$)/, _r = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
1486
|
-
_backpedal:
|
|
1490
|
+
}, ks = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Pr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ws = /^( {2,}|\\)\n(?!\s*$)/, _r = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, At = "\\p{P}\\p{S}", zr = K(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, At).getRegex(), Hr = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, Br = K(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, At).getRegex(), Fr = K("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, At).getRegex(), Ur = K("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, At).getRegex(), qr = K(/\\([punct])/, "gu").replace(/punct/g, At).getRegex(), jr = K(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Wr = K(gn).replace("(?:-->|$)", "-->").getRegex(), Kr = K("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Wr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), zt = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Vr = K(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", zt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), bs = K(/^!?\[(label)\]\[(ref)\]/).replace("label", zt).replace("ref", pn).getRegex(), vs = K(/^!?\[(ref)\](?:\[\])?/).replace("ref", pn).getRegex(), Gr = K("reflink|nolink(?!\\()", "g").replace("reflink", bs).replace("nolink", vs).getRegex(), yn = {
|
|
1491
|
+
_backpedal: kt,
|
|
1487
1492
|
// only used for GFM url
|
|
1488
1493
|
anyPunctuation: qr,
|
|
1489
1494
|
autolink: jr,
|
|
1490
1495
|
blockSkip: Hr,
|
|
1491
1496
|
br: ws,
|
|
1492
1497
|
code: Pr,
|
|
1493
|
-
del:
|
|
1498
|
+
del: kt,
|
|
1494
1499
|
emStrongLDelim: Br,
|
|
1495
1500
|
emStrongRDelimAst: Fr,
|
|
1496
1501
|
emStrongRDelimUnd: Ur,
|
|
@@ -1502,27 +1507,27 @@ const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*
|
|
|
1502
1507
|
reflinkSearch: Gr,
|
|
1503
1508
|
tag: Kr,
|
|
1504
1509
|
text: _r,
|
|
1505
|
-
url:
|
|
1510
|
+
url: kt
|
|
1506
1511
|
}, Qr = {
|
|
1507
1512
|
...yn,
|
|
1508
|
-
link:
|
|
1509
|
-
reflink:
|
|
1513
|
+
link: K(/^!?\[(label)\]\((.*?)\)/).replace("label", zt).getRegex(),
|
|
1514
|
+
reflink: K(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", zt).getRegex()
|
|
1510
1515
|
}, on = {
|
|
1511
1516
|
...yn,
|
|
1512
|
-
escape:
|
|
1513
|
-
url:
|
|
1517
|
+
escape: K(ks).replace("])", "~|])").getRegex(),
|
|
1518
|
+
url: K(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
1514
1519
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
1515
1520
|
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
1516
1521
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
1517
1522
|
}, Zr = {
|
|
1518
1523
|
...on,
|
|
1519
|
-
br:
|
|
1520
|
-
text:
|
|
1524
|
+
br: K(ws).replace("{2,}", "*").getRegex(),
|
|
1525
|
+
text: K(on.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
1521
1526
|
}, Dt = {
|
|
1522
1527
|
normal: mn,
|
|
1523
1528
|
gfm: Or,
|
|
1524
1529
|
pedantic: Nr
|
|
1525
|
-
},
|
|
1530
|
+
}, ft = {
|
|
1526
1531
|
normal: yn,
|
|
1527
1532
|
gfm: on,
|
|
1528
1533
|
breaks: Zr,
|
|
@@ -1530,11 +1535,11 @@ const Ar = /^(?:[ \t]*(?:\n|$))+/, Cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*
|
|
|
1530
1535
|
};
|
|
1531
1536
|
class ke {
|
|
1532
1537
|
constructor(e) {
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
+
V(this, "tokens");
|
|
1539
|
+
V(this, "options");
|
|
1540
|
+
V(this, "state");
|
|
1541
|
+
V(this, "tokenizer");
|
|
1542
|
+
V(this, "inlineQueue");
|
|
1538
1543
|
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || Qe, this.options.tokenizer = this.options.tokenizer || new _t(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
1539
1544
|
inLink: !1,
|
|
1540
1545
|
inRawBlock: !1,
|
|
@@ -1542,9 +1547,9 @@ class ke {
|
|
|
1542
1547
|
};
|
|
1543
1548
|
const t = {
|
|
1544
1549
|
block: Dt.normal,
|
|
1545
|
-
inline:
|
|
1550
|
+
inline: ft.normal
|
|
1546
1551
|
};
|
|
1547
|
-
this.options.pedantic ? (t.block = Dt.pedantic, t.inline =
|
|
1552
|
+
this.options.pedantic ? (t.block = Dt.pedantic, t.inline = ft.pedantic) : this.options.gfm && (t.block = Dt.gfm, this.options.breaks ? t.inline = ft.breaks : t.inline = ft.gfm), this.tokenizer.rules = t;
|
|
1548
1553
|
}
|
|
1549
1554
|
/**
|
|
1550
1555
|
* Expose Rules
|
|
@@ -1552,7 +1557,7 @@ class ke {
|
|
|
1552
1557
|
static get rules() {
|
|
1553
1558
|
return {
|
|
1554
1559
|
block: Dt,
|
|
1555
|
-
inline:
|
|
1560
|
+
inline: ft
|
|
1556
1561
|
};
|
|
1557
1562
|
}
|
|
1558
1563
|
/**
|
|
@@ -1729,10 +1734,10 @@ class ke {
|
|
|
1729
1734
|
}
|
|
1730
1735
|
if (o = e, this.options.extensions && this.options.extensions.startInline) {
|
|
1731
1736
|
let c = 1 / 0;
|
|
1732
|
-
const
|
|
1733
|
-
let
|
|
1737
|
+
const y = e.slice(1);
|
|
1738
|
+
let x;
|
|
1734
1739
|
this.options.extensions.startInline.forEach((f) => {
|
|
1735
|
-
|
|
1740
|
+
x = f.call({ lexer: this }, y), typeof x == "number" && x >= 0 && (c = Math.min(c, x));
|
|
1736
1741
|
}), c < 1 / 0 && c >= 0 && (o = e.substring(0, c + 1));
|
|
1737
1742
|
}
|
|
1738
1743
|
if (s = this.tokenizer.inlineText(o)) {
|
|
@@ -1754,8 +1759,8 @@ class ke {
|
|
|
1754
1759
|
class Ht {
|
|
1755
1760
|
// set by the parser
|
|
1756
1761
|
constructor(e) {
|
|
1757
|
-
|
|
1758
|
-
|
|
1762
|
+
V(this, "options");
|
|
1763
|
+
V(this, "parser");
|
|
1759
1764
|
this.options = e || Qe;
|
|
1760
1765
|
}
|
|
1761
1766
|
space(e) {
|
|
@@ -1916,9 +1921,9 @@ class xn {
|
|
|
1916
1921
|
}
|
|
1917
1922
|
class we {
|
|
1918
1923
|
constructor(e) {
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1924
|
+
V(this, "options");
|
|
1925
|
+
V(this, "renderer");
|
|
1926
|
+
V(this, "textRenderer");
|
|
1922
1927
|
this.options = e || Qe, this.options.renderer = this.options.renderer || new Ht(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new xn();
|
|
1923
1928
|
}
|
|
1924
1929
|
/**
|
|
@@ -2076,10 +2081,10 @@ class we {
|
|
|
2076
2081
|
return s;
|
|
2077
2082
|
}
|
|
2078
2083
|
}
|
|
2079
|
-
class
|
|
2084
|
+
class wt {
|
|
2080
2085
|
constructor(e) {
|
|
2081
|
-
|
|
2082
|
-
|
|
2086
|
+
V(this, "options");
|
|
2087
|
+
V(this, "block");
|
|
2083
2088
|
this.options = e || Qe;
|
|
2084
2089
|
}
|
|
2085
2090
|
/**
|
|
@@ -2113,23 +2118,23 @@ class kt {
|
|
|
2113
2118
|
return this.block ? we.parse : we.parseInline;
|
|
2114
2119
|
}
|
|
2115
2120
|
}
|
|
2116
|
-
|
|
2121
|
+
V(wt, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
2117
2122
|
"preprocess",
|
|
2118
2123
|
"postprocess",
|
|
2119
2124
|
"processAllTokens"
|
|
2120
2125
|
]));
|
|
2121
2126
|
class Yr {
|
|
2122
2127
|
constructor(...e) {
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2128
|
+
V(this, "defaults", hn());
|
|
2129
|
+
V(this, "options", this.setOptions);
|
|
2130
|
+
V(this, "parse", this.parseMarkdown(!0));
|
|
2131
|
+
V(this, "parseInline", this.parseMarkdown(!1));
|
|
2132
|
+
V(this, "Parser", we);
|
|
2133
|
+
V(this, "Renderer", Ht);
|
|
2134
|
+
V(this, "TextRenderer", xn);
|
|
2135
|
+
V(this, "Lexer", ke);
|
|
2136
|
+
V(this, "Tokenizer", _t);
|
|
2137
|
+
V(this, "Hooks", wt);
|
|
2133
2138
|
this.use(...e);
|
|
2134
2139
|
}
|
|
2135
2140
|
/**
|
|
@@ -2194,8 +2199,8 @@ class Yr {
|
|
|
2194
2199
|
continue;
|
|
2195
2200
|
const a = i, u = s.renderer[a], d = o[a];
|
|
2196
2201
|
o[a] = (...c) => {
|
|
2197
|
-
let
|
|
2198
|
-
return
|
|
2202
|
+
let y = u.apply(o, c);
|
|
2203
|
+
return y === !1 && (y = d.apply(o, c)), y || "";
|
|
2199
2204
|
};
|
|
2200
2205
|
}
|
|
2201
2206
|
r.renderer = o;
|
|
@@ -2209,28 +2214,28 @@ class Yr {
|
|
|
2209
2214
|
continue;
|
|
2210
2215
|
const a = i, u = s.tokenizer[a], d = o[a];
|
|
2211
2216
|
o[a] = (...c) => {
|
|
2212
|
-
let
|
|
2213
|
-
return
|
|
2217
|
+
let y = u.apply(o, c);
|
|
2218
|
+
return y === !1 && (y = d.apply(o, c)), y;
|
|
2214
2219
|
};
|
|
2215
2220
|
}
|
|
2216
2221
|
r.tokenizer = o;
|
|
2217
2222
|
}
|
|
2218
2223
|
if (s.hooks) {
|
|
2219
|
-
const o = this.defaults.hooks || new
|
|
2224
|
+
const o = this.defaults.hooks || new wt();
|
|
2220
2225
|
for (const i in s.hooks) {
|
|
2221
2226
|
if (!(i in o))
|
|
2222
2227
|
throw new Error(`hook '${i}' does not exist`);
|
|
2223
2228
|
if (["options", "block"].includes(i))
|
|
2224
2229
|
continue;
|
|
2225
2230
|
const a = i, u = s.hooks[a], d = o[a];
|
|
2226
|
-
|
|
2231
|
+
wt.passThroughHooks.has(i) ? o[a] = (c) => {
|
|
2227
2232
|
if (this.defaults.async)
|
|
2228
|
-
return Promise.resolve(u.call(o, c)).then((
|
|
2229
|
-
const
|
|
2230
|
-
return d.call(o,
|
|
2233
|
+
return Promise.resolve(u.call(o, c)).then((x) => d.call(o, x));
|
|
2234
|
+
const y = u.call(o, c);
|
|
2235
|
+
return d.call(o, y);
|
|
2231
2236
|
} : o[a] = (...c) => {
|
|
2232
|
-
let
|
|
2233
|
-
return
|
|
2237
|
+
let y = u.apply(o, c);
|
|
2238
|
+
return y === !1 && (y = d.apply(o, c)), y;
|
|
2234
2239
|
};
|
|
2235
2240
|
}
|
|
2236
2241
|
r.hooks = o;
|
|
@@ -2271,8 +2276,8 @@ class Yr {
|
|
|
2271
2276
|
i.hooks && (s = i.hooks.preprocess(s));
|
|
2272
2277
|
let c = u(s, i);
|
|
2273
2278
|
i.hooks && (c = i.hooks.processAllTokens(c)), i.walkTokens && this.walkTokens(c, i.walkTokens);
|
|
2274
|
-
let
|
|
2275
|
-
return i.hooks && (
|
|
2279
|
+
let y = d(c, i);
|
|
2280
|
+
return i.hooks && (y = i.hooks.postprocess(y)), y;
|
|
2276
2281
|
} catch (c) {
|
|
2277
2282
|
return a(c);
|
|
2278
2283
|
}
|
|
@@ -2314,7 +2319,7 @@ j.TextRenderer = xn;
|
|
|
2314
2319
|
j.Lexer = ke;
|
|
2315
2320
|
j.lexer = ke.lex;
|
|
2316
2321
|
j.Tokenizer = _t;
|
|
2317
|
-
j.Hooks =
|
|
2322
|
+
j.Hooks = wt;
|
|
2318
2323
|
j.parse = j;
|
|
2319
2324
|
j.options;
|
|
2320
2325
|
j.setOptions;
|
|
@@ -2355,7 +2360,7 @@ un || (un = function(e) {
|
|
|
2355
2360
|
s[r - 1] = arguments[r];
|
|
2356
2361
|
return new e(...s);
|
|
2357
2362
|
});
|
|
2358
|
-
const Ot = ge(Array.prototype.forEach), to = ge(Array.prototype.lastIndexOf), Yn = ge(Array.prototype.pop),
|
|
2363
|
+
const Ot = ge(Array.prototype.forEach), to = ge(Array.prototype.lastIndexOf), Yn = ge(Array.prototype.pop), pt = ge(Array.prototype.push), no = ge(Array.prototype.splice), Pt = ge(String.prototype.toLowerCase), Zt = ge(String.prototype.toString), Yt = ge(String.prototype.match), gt = ge(String.prototype.replace), so = ge(String.prototype.indexOf), ro = ge(String.prototype.trim), Te = ge(Object.prototype.hasOwnProperty), fe = ge(RegExp.prototype.test), mt = oo(TypeError);
|
|
2359
2364
|
function ge(n) {
|
|
2360
2365
|
return function(e) {
|
|
2361
2366
|
e instanceof RegExp && (e.lastIndex = 0);
|
|
@@ -2396,7 +2401,7 @@ function Ne(n) {
|
|
|
2396
2401
|
Te(n, t) && (Array.isArray(s) ? e[t] = io(s) : s && typeof s == "object" && s.constructor === Object ? e[t] = Ne(s) : e[t] = s);
|
|
2397
2402
|
return e;
|
|
2398
2403
|
}
|
|
2399
|
-
function
|
|
2404
|
+
function yt(n, e) {
|
|
2400
2405
|
for (; n !== null; ) {
|
|
2401
2406
|
const s = eo(n, e);
|
|
2402
2407
|
if (s) {
|
|
@@ -2432,7 +2437,7 @@ var ns = /* @__PURE__ */ Object.freeze({
|
|
|
2432
2437
|
MUSTACHE_EXPR: uo,
|
|
2433
2438
|
TMPLIT_EXPR: ho
|
|
2434
2439
|
});
|
|
2435
|
-
const
|
|
2440
|
+
const xt = {
|
|
2436
2441
|
element: 1,
|
|
2437
2442
|
text: 3,
|
|
2438
2443
|
// Deprecated
|
|
@@ -2475,8 +2480,8 @@ const yt = {
|
|
|
2475
2480
|
};
|
|
2476
2481
|
function Cs() {
|
|
2477
2482
|
let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : xo();
|
|
2478
|
-
const e = (
|
|
2479
|
-
if (e.version = "3.3.0", e.removed = [], !n || !n.document || n.document.nodeType !==
|
|
2483
|
+
const e = (I) => Cs(I);
|
|
2484
|
+
if (e.version = "3.3.0", e.removed = [], !n || !n.document || n.document.nodeType !== xt.document || !n.Element)
|
|
2480
2485
|
return e.isSupported = !1, e;
|
|
2481
2486
|
let {
|
|
2482
2487
|
document: t
|
|
@@ -2488,29 +2493,29 @@ function Cs() {
|
|
|
2488
2493
|
Element: u,
|
|
2489
2494
|
NodeFilter: d,
|
|
2490
2495
|
NamedNodeMap: c = n.NamedNodeMap || n.MozNamedAttrMap,
|
|
2491
|
-
HTMLFormElement:
|
|
2492
|
-
DOMParser:
|
|
2496
|
+
HTMLFormElement: y,
|
|
2497
|
+
DOMParser: x,
|
|
2493
2498
|
trustedTypes: f
|
|
2494
|
-
} = n, p = u.prototype,
|
|
2499
|
+
} = n, p = u.prototype, D = yt(p, "cloneNode"), g = yt(p, "remove"), m = yt(p, "nextSibling"), C = yt(p, "childNodes"), S = yt(p, "parentNode");
|
|
2495
2500
|
if (typeof i == "function") {
|
|
2496
|
-
const
|
|
2497
|
-
|
|
2501
|
+
const I = t.createElement("template");
|
|
2502
|
+
I.content && I.content.ownerDocument && (t = I.content.ownerDocument);
|
|
2498
2503
|
}
|
|
2499
|
-
let
|
|
2504
|
+
let b, z = "";
|
|
2500
2505
|
const {
|
|
2501
|
-
implementation:
|
|
2502
|
-
createNodeIterator:
|
|
2503
|
-
createDocumentFragment:
|
|
2506
|
+
implementation: q,
|
|
2507
|
+
createNodeIterator: G,
|
|
2508
|
+
createDocumentFragment: A,
|
|
2504
2509
|
getElementsByTagName: _
|
|
2505
2510
|
} = t, {
|
|
2506
2511
|
importNode: R
|
|
2507
2512
|
} = s;
|
|
2508
|
-
let
|
|
2509
|
-
e.isSupported = typeof Ts == "function" && typeof
|
|
2513
|
+
let E = ss();
|
|
2514
|
+
e.isSupported = typeof Ts == "function" && typeof S == "function" && q && q.createHTMLDocument !== void 0;
|
|
2510
2515
|
const {
|
|
2511
|
-
MUSTACHE_EXPR:
|
|
2512
|
-
ERB_EXPR:
|
|
2513
|
-
TMPLIT_EXPR:
|
|
2516
|
+
MUSTACHE_EXPR: Y,
|
|
2517
|
+
ERB_EXPR: M,
|
|
2518
|
+
TMPLIT_EXPR: W,
|
|
2514
2519
|
DATA_ATTR: qe,
|
|
2515
2520
|
ARIA_ATTR: Me,
|
|
2516
2521
|
IS_SCRIPT_OR_DATA: Re,
|
|
@@ -2518,12 +2523,12 @@ function Cs() {
|
|
|
2518
2523
|
CUSTOM_ELEMENT: Ft
|
|
2519
2524
|
} = ns;
|
|
2520
2525
|
let {
|
|
2521
|
-
IS_ALLOWED_URI:
|
|
2526
|
+
IS_ALLOWED_URI: Ct
|
|
2522
2527
|
} = ns, ne = null;
|
|
2523
2528
|
const Le = H({}, [...Xn, ...Xt, ...Jt, ...en, ...Jn]);
|
|
2524
2529
|
let se = null;
|
|
2525
2530
|
const st = H({}, [...es, ...tn, ...ts, ...Nt]);
|
|
2526
|
-
let
|
|
2531
|
+
let X = Object.seal(an(null, {
|
|
2527
2532
|
tagNameCheck: {
|
|
2528
2533
|
writable: !0,
|
|
2529
2534
|
configurable: !1,
|
|
@@ -2557,17 +2562,17 @@ function Cs() {
|
|
|
2557
2562
|
value: null
|
|
2558
2563
|
}
|
|
2559
2564
|
}));
|
|
2560
|
-
let ot = !0, it = !0, at = !1, O = !0, B = !1,
|
|
2565
|
+
let ot = !0, it = !0, at = !1, O = !0, B = !1, J = !0, Q = !1, oe = !1, ee = !1, ie = !1, He = !1, Et = !1, kn = !0, wn = !1;
|
|
2561
2566
|
const Is = "user-content-";
|
|
2562
2567
|
let Ut = !0, lt = !1, Ze = {}, Ye = null;
|
|
2563
2568
|
const bn = H({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
2564
2569
|
let vn = null;
|
|
2565
2570
|
const Tn = H({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
2566
2571
|
let qt = null;
|
|
2567
|
-
const Sn = H({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]),
|
|
2572
|
+
const Sn = H({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Mt = "http://www.w3.org/1998/Math/MathML", Rt = "http://www.w3.org/2000/svg", $e = "http://www.w3.org/1999/xhtml";
|
|
2568
2573
|
let Xe = $e, jt = !1, Wt = null;
|
|
2569
|
-
const $s = H({}, [
|
|
2570
|
-
let
|
|
2574
|
+
const $s = H({}, [Mt, Rt, $e], Zt);
|
|
2575
|
+
let Lt = H({}, ["mi", "mo", "mn", "ms", "mtext"]), It = H({}, ["annotation-xml"]);
|
|
2571
2576
|
const Ds = H({}, ["title", "style", "font", "a", "script"]);
|
|
2572
2577
|
let ut = null;
|
|
2573
2578
|
const Os = ["application/xhtml+xml", "text/html"], Ns = "text/html";
|
|
@@ -2578,41 +2583,41 @@ function Cs() {
|
|
|
2578
2583
|
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2579
2584
|
if (!(Je && Je === l)) {
|
|
2580
2585
|
if ((!l || typeof l != "object") && (l = {}), l = Ne(l), ut = // eslint-disable-next-line unicorn/prefer-includes
|
|
2581
|
-
Os.indexOf(l.PARSER_MEDIA_TYPE) === -1 ? Ns : l.PARSER_MEDIA_TYPE, ae = ut === "application/xhtml+xml" ? Zt : Pt, ne = Te(l, "ALLOWED_TAGS") ? H({}, l.ALLOWED_TAGS, ae) : Le, se = Te(l, "ALLOWED_ATTR") ? H({}, l.ALLOWED_ATTR, ae) : st, Wt = Te(l, "ALLOWED_NAMESPACES") ? H({}, l.ALLOWED_NAMESPACES, Zt) : $s, qt = Te(l, "ADD_URI_SAFE_ATTR") ? H(Ne(Sn), l.ADD_URI_SAFE_ATTR, ae) : Sn, vn = Te(l, "ADD_DATA_URI_TAGS") ? H(Ne(Tn), l.ADD_DATA_URI_TAGS, ae) : Tn, Ye = Te(l, "FORBID_CONTENTS") ? H({}, l.FORBID_CONTENTS, ae) : bn, je = Te(l, "FORBID_TAGS") ? H({}, l.FORBID_TAGS, ae) : Ne({}), rt = Te(l, "FORBID_ATTR") ? H({}, l.FORBID_ATTR, ae) : Ne({}), Ze = Te(l, "USE_PROFILES") ? l.USE_PROFILES : !1, ot = l.ALLOW_ARIA_ATTR !== !1, it = l.ALLOW_DATA_ATTR !== !1, at = l.ALLOW_UNKNOWN_PROTOCOLS || !1, O = l.ALLOW_SELF_CLOSE_IN_ATTR !== !1, B = l.SAFE_FOR_TEMPLATES || !1,
|
|
2586
|
+
Os.indexOf(l.PARSER_MEDIA_TYPE) === -1 ? Ns : l.PARSER_MEDIA_TYPE, ae = ut === "application/xhtml+xml" ? Zt : Pt, ne = Te(l, "ALLOWED_TAGS") ? H({}, l.ALLOWED_TAGS, ae) : Le, se = Te(l, "ALLOWED_ATTR") ? H({}, l.ALLOWED_ATTR, ae) : st, Wt = Te(l, "ALLOWED_NAMESPACES") ? H({}, l.ALLOWED_NAMESPACES, Zt) : $s, qt = Te(l, "ADD_URI_SAFE_ATTR") ? H(Ne(Sn), l.ADD_URI_SAFE_ATTR, ae) : Sn, vn = Te(l, "ADD_DATA_URI_TAGS") ? H(Ne(Tn), l.ADD_DATA_URI_TAGS, ae) : Tn, Ye = Te(l, "FORBID_CONTENTS") ? H({}, l.FORBID_CONTENTS, ae) : bn, je = Te(l, "FORBID_TAGS") ? H({}, l.FORBID_TAGS, ae) : Ne({}), rt = Te(l, "FORBID_ATTR") ? H({}, l.FORBID_ATTR, ae) : Ne({}), Ze = Te(l, "USE_PROFILES") ? l.USE_PROFILES : !1, ot = l.ALLOW_ARIA_ATTR !== !1, it = l.ALLOW_DATA_ATTR !== !1, at = l.ALLOW_UNKNOWN_PROTOCOLS || !1, O = l.ALLOW_SELF_CLOSE_IN_ATTR !== !1, B = l.SAFE_FOR_TEMPLATES || !1, J = l.SAFE_FOR_XML !== !1, Q = l.WHOLE_DOCUMENT || !1, ie = l.RETURN_DOM || !1, He = l.RETURN_DOM_FRAGMENT || !1, Et = l.RETURN_TRUSTED_TYPE || !1, ee = l.FORCE_BODY || !1, kn = l.SANITIZE_DOM !== !1, wn = l.SANITIZE_NAMED_PROPS || !1, Ut = l.KEEP_CONTENT !== !1, lt = l.IN_PLACE || !1, Ct = l.ALLOWED_URI_REGEXP || Ss, Xe = l.NAMESPACE || $e, Lt = l.MATHML_TEXT_INTEGRATION_POINTS || Lt, It = l.HTML_INTEGRATION_POINTS || It, X = l.CUSTOM_ELEMENT_HANDLING || {}, l.CUSTOM_ELEMENT_HANDLING && An(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (X.tagNameCheck = l.CUSTOM_ELEMENT_HANDLING.tagNameCheck), l.CUSTOM_ELEMENT_HANDLING && An(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (X.attributeNameCheck = l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), l.CUSTOM_ELEMENT_HANDLING && typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (X.allowCustomizedBuiltInElements = l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), B && (it = !1), He && (ie = !0), Ze && (ne = H({}, Jn), se = [], Ze.html === !0 && (H(ne, Xn), H(se, es)), Ze.svg === !0 && (H(ne, Xt), H(se, tn), H(se, Nt)), Ze.svgFilters === !0 && (H(ne, Jt), H(se, tn), H(se, Nt)), Ze.mathMl === !0 && (H(ne, en), H(se, ts), H(se, Nt))), l.ADD_TAGS && (typeof l.ADD_TAGS == "function" ? Ie.tagCheck = l.ADD_TAGS : (ne === Le && (ne = Ne(ne)), H(ne, l.ADD_TAGS, ae))), l.ADD_ATTR && (typeof l.ADD_ATTR == "function" ? Ie.attributeCheck = l.ADD_ATTR : (se === st && (se = Ne(se)), H(se, l.ADD_ATTR, ae))), l.ADD_URI_SAFE_ATTR && H(qt, l.ADD_URI_SAFE_ATTR, ae), l.FORBID_CONTENTS && (Ye === bn && (Ye = Ne(Ye)), H(Ye, l.FORBID_CONTENTS, ae)), Ut && (ne["#text"] = !0), Q && H(ne, ["html", "head", "body"]), ne.table && (H(ne, ["tbody"]), delete je.tbody), l.TRUSTED_TYPES_POLICY) {
|
|
2582
2587
|
if (typeof l.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
2583
|
-
throw
|
|
2588
|
+
throw mt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
2584
2589
|
if (typeof l.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
2585
|
-
throw
|
|
2586
|
-
|
|
2590
|
+
throw mt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
2591
|
+
b = l.TRUSTED_TYPES_POLICY, z = b.createHTML("");
|
|
2587
2592
|
} else
|
|
2588
|
-
|
|
2593
|
+
b === void 0 && (b = ko(f, r)), b !== null && typeof z == "string" && (z = b.createHTML(""));
|
|
2589
2594
|
pe && pe(l), Je = l;
|
|
2590
2595
|
}
|
|
2591
2596
|
}, Cn = H({}, [...Xt, ...Jt, ...ao]), En = H({}, [...en, ...lo]), _s = function(l) {
|
|
2592
|
-
let w =
|
|
2597
|
+
let w = S(l);
|
|
2593
2598
|
(!w || !w.tagName) && (w = {
|
|
2594
2599
|
namespaceURI: Xe,
|
|
2595
2600
|
tagName: "template"
|
|
2596
2601
|
});
|
|
2597
|
-
const L = Pt(l.tagName),
|
|
2598
|
-
return Wt[l.namespaceURI] ? l.namespaceURI ===
|
|
2602
|
+
const L = Pt(l.tagName), Z = Pt(w.tagName);
|
|
2603
|
+
return Wt[l.namespaceURI] ? l.namespaceURI === Rt ? w.namespaceURI === $e ? L === "svg" : w.namespaceURI === Mt ? L === "svg" && (Z === "annotation-xml" || Lt[Z]) : !!Cn[L] : l.namespaceURI === Mt ? w.namespaceURI === $e ? L === "math" : w.namespaceURI === Rt ? L === "math" && It[Z] : !!En[L] : l.namespaceURI === $e ? w.namespaceURI === Rt && !It[Z] || w.namespaceURI === Mt && !Lt[Z] ? !1 : !En[L] && (Ds[L] || !Cn[L]) : !!(ut === "application/xhtml+xml" && Wt[l.namespaceURI]) : !1;
|
|
2599
2604
|
}, Se = function(l) {
|
|
2600
|
-
|
|
2605
|
+
pt(e.removed, {
|
|
2601
2606
|
element: l
|
|
2602
2607
|
});
|
|
2603
2608
|
try {
|
|
2604
|
-
|
|
2609
|
+
S(l).removeChild(l);
|
|
2605
2610
|
} catch {
|
|
2606
|
-
|
|
2611
|
+
g(l);
|
|
2607
2612
|
}
|
|
2608
2613
|
}, We = function(l, w) {
|
|
2609
2614
|
try {
|
|
2610
|
-
|
|
2615
|
+
pt(e.removed, {
|
|
2611
2616
|
attribute: w.getAttributeNode(l),
|
|
2612
2617
|
from: w
|
|
2613
2618
|
});
|
|
2614
2619
|
} catch {
|
|
2615
|
-
|
|
2620
|
+
pt(e.removed, {
|
|
2616
2621
|
attribute: null,
|
|
2617
2622
|
from: w
|
|
2618
2623
|
});
|
|
@@ -2637,23 +2642,23 @@ function Cs() {
|
|
|
2637
2642
|
L = re && re[0];
|
|
2638
2643
|
}
|
|
2639
2644
|
ut === "application/xhtml+xml" && Xe === $e && (l = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + l + "</body></html>");
|
|
2640
|
-
const
|
|
2645
|
+
const Z = b ? b.createHTML(l) : l;
|
|
2641
2646
|
if (Xe === $e)
|
|
2642
2647
|
try {
|
|
2643
|
-
w = new
|
|
2648
|
+
w = new x().parseFromString(Z, ut);
|
|
2644
2649
|
} catch {
|
|
2645
2650
|
}
|
|
2646
2651
|
if (!w || !w.documentElement) {
|
|
2647
|
-
w =
|
|
2652
|
+
w = q.createDocument(Xe, "template", null);
|
|
2648
2653
|
try {
|
|
2649
|
-
w.documentElement.innerHTML = jt ? z :
|
|
2654
|
+
w.documentElement.innerHTML = jt ? z : Z;
|
|
2650
2655
|
} catch {
|
|
2651
2656
|
}
|
|
2652
2657
|
}
|
|
2653
2658
|
const ue = w.body || w.documentElement;
|
|
2654
|
-
return l && L && ue.insertBefore(t.createTextNode(L), ue.childNodes[0] || null), Xe === $e ? _.call(w,
|
|
2659
|
+
return l && L && ue.insertBefore(t.createTextNode(L), ue.childNodes[0] || null), Xe === $e ? _.call(w, Q ? "html" : "body")[0] : Q ? w.documentElement : ue;
|
|
2655
2660
|
}, Rn = function(l) {
|
|
2656
|
-
return
|
|
2661
|
+
return G.call(
|
|
2657
2662
|
l.ownerDocument || l,
|
|
2658
2663
|
l,
|
|
2659
2664
|
// eslint-disable-next-line no-bitwise
|
|
@@ -2661,45 +2666,45 @@ function Cs() {
|
|
|
2661
2666
|
null
|
|
2662
2667
|
);
|
|
2663
2668
|
}, Vt = function(l) {
|
|
2664
|
-
return l instanceof
|
|
2669
|
+
return l instanceof y && (typeof l.nodeName != "string" || typeof l.textContent != "string" || typeof l.removeChild != "function" || !(l.attributes instanceof c) || typeof l.removeAttribute != "function" || typeof l.setAttribute != "function" || typeof l.namespaceURI != "string" || typeof l.insertBefore != "function" || typeof l.hasChildNodes != "function");
|
|
2665
2670
|
}, Ln = function(l) {
|
|
2666
2671
|
return typeof a == "function" && l instanceof a;
|
|
2667
2672
|
};
|
|
2668
|
-
function De(
|
|
2669
|
-
Ot(
|
|
2673
|
+
function De(I, l, w) {
|
|
2674
|
+
Ot(I, (L) => {
|
|
2670
2675
|
L.call(e, l, w, Je);
|
|
2671
2676
|
});
|
|
2672
2677
|
}
|
|
2673
2678
|
const In = function(l) {
|
|
2674
2679
|
let w = null;
|
|
2675
|
-
if (De(
|
|
2680
|
+
if (De(E.beforeSanitizeElements, l, null), Vt(l))
|
|
2676
2681
|
return Se(l), !0;
|
|
2677
2682
|
const L = ae(l.nodeName);
|
|
2678
|
-
if (De(
|
|
2683
|
+
if (De(E.uponSanitizeElement, l, {
|
|
2679
2684
|
tagName: L,
|
|
2680
2685
|
allowedTags: ne
|
|
2681
|
-
}),
|
|
2686
|
+
}), J && l.hasChildNodes() && !Ln(l.firstElementChild) && fe(/<[/\w!]/g, l.innerHTML) && fe(/<[/\w!]/g, l.textContent) || l.nodeType === xt.progressingInstruction || J && l.nodeType === xt.comment && fe(/<[/\w]/g, l.data))
|
|
2682
2687
|
return Se(l), !0;
|
|
2683
2688
|
if (!(Ie.tagCheck instanceof Function && Ie.tagCheck(L)) && (!ne[L] || je[L])) {
|
|
2684
|
-
if (!je[L] && Dn(L) && (
|
|
2689
|
+
if (!je[L] && Dn(L) && (X.tagNameCheck instanceof RegExp && fe(X.tagNameCheck, L) || X.tagNameCheck instanceof Function && X.tagNameCheck(L)))
|
|
2685
2690
|
return !1;
|
|
2686
2691
|
if (Ut && !Ye[L]) {
|
|
2687
|
-
const
|
|
2688
|
-
if (ue &&
|
|
2692
|
+
const Z = S(l) || l.parentNode, ue = C(l) || l.childNodes;
|
|
2693
|
+
if (ue && Z) {
|
|
2689
2694
|
const re = ue.length;
|
|
2690
2695
|
for (let me = re - 1; me >= 0; --me) {
|
|
2691
|
-
const Oe =
|
|
2692
|
-
Oe.__removalCount = (l.__removalCount || 0) + 1,
|
|
2696
|
+
const Oe = D(ue[me], !0);
|
|
2697
|
+
Oe.__removalCount = (l.__removalCount || 0) + 1, Z.insertBefore(Oe, m(l));
|
|
2693
2698
|
}
|
|
2694
2699
|
}
|
|
2695
2700
|
}
|
|
2696
2701
|
return Se(l), !0;
|
|
2697
2702
|
}
|
|
2698
|
-
return l instanceof u && !_s(l) || (L === "noscript" || L === "noembed" || L === "noframes") && fe(/<\/no(script|embed|frames)/i, l.innerHTML) ? (Se(l), !0) : (B && l.nodeType ===
|
|
2699
|
-
w =
|
|
2700
|
-
}), l.textContent !== w && (
|
|
2703
|
+
return l instanceof u && !_s(l) || (L === "noscript" || L === "noembed" || L === "noframes") && fe(/<\/no(script|embed|frames)/i, l.innerHTML) ? (Se(l), !0) : (B && l.nodeType === xt.text && (w = l.textContent, Ot([Y, M, W], (Z) => {
|
|
2704
|
+
w = gt(w, Z, " ");
|
|
2705
|
+
}), l.textContent !== w && (pt(e.removed, {
|
|
2701
2706
|
element: l.cloneNode()
|
|
2702
|
-
}), l.textContent = w)), De(
|
|
2707
|
+
}), l.textContent = w)), De(E.afterSanitizeElements, l, null), !1);
|
|
2703
2708
|
}, $n = function(l, w, L) {
|
|
2704
2709
|
if (kn && (w === "id" || w === "name") && (L in t || L in Ps))
|
|
2705
2710
|
return !1;
|
|
@@ -2711,14 +2716,14 @@ function Cs() {
|
|
|
2711
2716
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
2712
2717
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
2713
2718
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
2714
|
-
!(Dn(l) && (
|
|
2719
|
+
!(Dn(l) && (X.tagNameCheck instanceof RegExp && fe(X.tagNameCheck, l) || X.tagNameCheck instanceof Function && X.tagNameCheck(l)) && (X.attributeNameCheck instanceof RegExp && fe(X.attributeNameCheck, w) || X.attributeNameCheck instanceof Function && X.attributeNameCheck(w, l)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
2715
2720
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
2716
|
-
w === "is" &&
|
|
2721
|
+
w === "is" && X.allowCustomizedBuiltInElements && (X.tagNameCheck instanceof RegExp && fe(X.tagNameCheck, L) || X.tagNameCheck instanceof Function && X.tagNameCheck(L)))
|
|
2717
2722
|
) return !1;
|
|
2718
2723
|
} else if (!qt[w]) {
|
|
2719
|
-
if (!fe(
|
|
2724
|
+
if (!fe(Ct, gt(L, ze, ""))) {
|
|
2720
2725
|
if (!((w === "src" || w === "xlink:href" || w === "href") && l !== "script" && so(L, "data:") === 0 && vn[l])) {
|
|
2721
|
-
if (!(at && !fe(Re,
|
|
2726
|
+
if (!(at && !fe(Re, gt(L, ze, "")))) {
|
|
2722
2727
|
if (L)
|
|
2723
2728
|
return !1;
|
|
2724
2729
|
}
|
|
@@ -2732,7 +2737,7 @@ function Cs() {
|
|
|
2732
2737
|
}, Dn = function(l) {
|
|
2733
2738
|
return l !== "annotation-xml" && Yt(l, Ft);
|
|
2734
2739
|
}, On = function(l) {
|
|
2735
|
-
De(
|
|
2740
|
+
De(E.beforeSanitizeAttributes, l, null);
|
|
2736
2741
|
const {
|
|
2737
2742
|
attributes: w
|
|
2738
2743
|
} = l;
|
|
@@ -2745,15 +2750,15 @@ function Cs() {
|
|
|
2745
2750
|
allowedAttributes: se,
|
|
2746
2751
|
forceKeepAttr: void 0
|
|
2747
2752
|
};
|
|
2748
|
-
let
|
|
2749
|
-
for (;
|
|
2750
|
-
const ue = w[
|
|
2753
|
+
let Z = w.length;
|
|
2754
|
+
for (; Z--; ) {
|
|
2755
|
+
const ue = w[Z], {
|
|
2751
2756
|
name: re,
|
|
2752
2757
|
namespaceURI: me,
|
|
2753
2758
|
value: Oe
|
|
2754
2759
|
} = ue, et = ae(re), Gt = Oe;
|
|
2755
2760
|
let le = re === "value" ? Gt : ro(Gt);
|
|
2756
|
-
if (L.attrName = et, L.attrValue = le, L.keepAttr = !0, L.forceKeepAttr = void 0, De(
|
|
2761
|
+
if (L.attrName = et, L.attrValue = le, L.keepAttr = !0, L.forceKeepAttr = void 0, De(E.uponSanitizeAttribute, l, L), le = L.attrValue, wn && (et === "id" || et === "name") && (We(re, l), le = Is + le), J && fe(/((--!?|])>)|<\/(style|title|textarea)/i, le)) {
|
|
2757
2762
|
We(re, l);
|
|
2758
2763
|
continue;
|
|
2759
2764
|
}
|
|
@@ -2771,22 +2776,22 @@ function Cs() {
|
|
|
2771
2776
|
We(re, l);
|
|
2772
2777
|
continue;
|
|
2773
2778
|
}
|
|
2774
|
-
B && Ot([
|
|
2775
|
-
le =
|
|
2779
|
+
B && Ot([Y, M, W], (Pn) => {
|
|
2780
|
+
le = gt(le, Pn, " ");
|
|
2776
2781
|
});
|
|
2777
2782
|
const Nn = ae(l.nodeName);
|
|
2778
2783
|
if (!$n(Nn, et, le)) {
|
|
2779
2784
|
We(re, l);
|
|
2780
2785
|
continue;
|
|
2781
2786
|
}
|
|
2782
|
-
if (
|
|
2787
|
+
if (b && typeof f == "object" && typeof f.getAttributeType == "function" && !me)
|
|
2783
2788
|
switch (f.getAttributeType(Nn, et)) {
|
|
2784
2789
|
case "TrustedHTML": {
|
|
2785
|
-
le =
|
|
2790
|
+
le = b.createHTML(le);
|
|
2786
2791
|
break;
|
|
2787
2792
|
}
|
|
2788
2793
|
case "TrustedScriptURL": {
|
|
2789
|
-
le =
|
|
2794
|
+
le = b.createScriptURL(le);
|
|
2790
2795
|
break;
|
|
2791
2796
|
}
|
|
2792
2797
|
}
|
|
@@ -2797,79 +2802,79 @@ function Cs() {
|
|
|
2797
2802
|
We(re, l);
|
|
2798
2803
|
}
|
|
2799
2804
|
}
|
|
2800
|
-
De(
|
|
2801
|
-
}, zs = function
|
|
2805
|
+
De(E.afterSanitizeAttributes, l, null);
|
|
2806
|
+
}, zs = function I(l) {
|
|
2802
2807
|
let w = null;
|
|
2803
2808
|
const L = Rn(l);
|
|
2804
|
-
for (De(
|
|
2805
|
-
De(
|
|
2806
|
-
De(
|
|
2809
|
+
for (De(E.beforeSanitizeShadowDOM, l, null); w = L.nextNode(); )
|
|
2810
|
+
De(E.uponSanitizeShadowNode, w, null), In(w), On(w), w.content instanceof o && I(w.content);
|
|
2811
|
+
De(E.afterSanitizeShadowDOM, l, null);
|
|
2807
2812
|
};
|
|
2808
|
-
return e.sanitize = function(
|
|
2809
|
-
let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, w = null, L = null,
|
|
2810
|
-
if (jt =
|
|
2811
|
-
if (typeof
|
|
2812
|
-
if (
|
|
2813
|
-
throw
|
|
2813
|
+
return e.sanitize = function(I) {
|
|
2814
|
+
let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, w = null, L = null, Z = null, ue = null;
|
|
2815
|
+
if (jt = !I, jt && (I = "<!-->"), typeof I != "string" && !Ln(I))
|
|
2816
|
+
if (typeof I.toString == "function") {
|
|
2817
|
+
if (I = I.toString(), typeof I != "string")
|
|
2818
|
+
throw mt("dirty is not a string, aborting");
|
|
2814
2819
|
} else
|
|
2815
|
-
throw
|
|
2820
|
+
throw mt("toString is not a function");
|
|
2816
2821
|
if (!e.isSupported)
|
|
2817
|
-
return
|
|
2818
|
-
if (oe || Kt(l), e.removed = [], typeof
|
|
2819
|
-
if (
|
|
2820
|
-
const Oe = ae(
|
|
2822
|
+
return I;
|
|
2823
|
+
if (oe || Kt(l), e.removed = [], typeof I == "string" && (lt = !1), lt) {
|
|
2824
|
+
if (I.nodeName) {
|
|
2825
|
+
const Oe = ae(I.nodeName);
|
|
2821
2826
|
if (!ne[Oe] || je[Oe])
|
|
2822
|
-
throw
|
|
2827
|
+
throw mt("root node is forbidden and cannot be sanitized in-place");
|
|
2823
2828
|
}
|
|
2824
|
-
} else if (
|
|
2825
|
-
w = Mn("<!---->"), L = w.ownerDocument.importNode(
|
|
2829
|
+
} else if (I instanceof a)
|
|
2830
|
+
w = Mn("<!---->"), L = w.ownerDocument.importNode(I, !0), L.nodeType === xt.element && L.nodeName === "BODY" || L.nodeName === "HTML" ? w = L : w.appendChild(L);
|
|
2826
2831
|
else {
|
|
2827
|
-
if (!ie && !B && !
|
|
2828
|
-
|
|
2829
|
-
return
|
|
2830
|
-
if (w = Mn(
|
|
2831
|
-
return ie ? null :
|
|
2832
|
+
if (!ie && !B && !Q && // eslint-disable-next-line unicorn/prefer-includes
|
|
2833
|
+
I.indexOf("<") === -1)
|
|
2834
|
+
return b && Et ? b.createHTML(I) : I;
|
|
2835
|
+
if (w = Mn(I), !w)
|
|
2836
|
+
return ie ? null : Et ? z : "";
|
|
2832
2837
|
}
|
|
2833
2838
|
w && ee && Se(w.firstChild);
|
|
2834
|
-
const re = Rn(lt ?
|
|
2835
|
-
for (;
|
|
2836
|
-
In(
|
|
2839
|
+
const re = Rn(lt ? I : w);
|
|
2840
|
+
for (; Z = re.nextNode(); )
|
|
2841
|
+
In(Z), On(Z), Z.content instanceof o && zs(Z.content);
|
|
2837
2842
|
if (lt)
|
|
2838
|
-
return
|
|
2843
|
+
return I;
|
|
2839
2844
|
if (ie) {
|
|
2840
2845
|
if (He)
|
|
2841
|
-
for (ue =
|
|
2846
|
+
for (ue = A.call(w.ownerDocument); w.firstChild; )
|
|
2842
2847
|
ue.appendChild(w.firstChild);
|
|
2843
2848
|
else
|
|
2844
2849
|
ue = w;
|
|
2845
2850
|
return (se.shadowroot || se.shadowrootmode) && (ue = R.call(s, ue, !0)), ue;
|
|
2846
2851
|
}
|
|
2847
|
-
let me =
|
|
2848
|
-
return
|
|
2849
|
-
` + me), B && Ot([
|
|
2850
|
-
me =
|
|
2851
|
-
}),
|
|
2852
|
+
let me = Q ? w.outerHTML : w.innerHTML;
|
|
2853
|
+
return Q && ne["!doctype"] && w.ownerDocument && w.ownerDocument.doctype && w.ownerDocument.doctype.name && fe(As, w.ownerDocument.doctype.name) && (me = "<!DOCTYPE " + w.ownerDocument.doctype.name + `>
|
|
2854
|
+
` + me), B && Ot([Y, M, W], (Oe) => {
|
|
2855
|
+
me = gt(me, Oe, " ");
|
|
2856
|
+
}), b && Et ? b.createHTML(me) : me;
|
|
2852
2857
|
}, e.setConfig = function() {
|
|
2853
|
-
let
|
|
2854
|
-
Kt(
|
|
2858
|
+
let I = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2859
|
+
Kt(I), oe = !0;
|
|
2855
2860
|
}, e.clearConfig = function() {
|
|
2856
2861
|
Je = null, oe = !1;
|
|
2857
|
-
}, e.isValidAttribute = function(
|
|
2862
|
+
}, e.isValidAttribute = function(I, l, w) {
|
|
2858
2863
|
Je || Kt({});
|
|
2859
|
-
const L = ae(
|
|
2860
|
-
return $n(L,
|
|
2861
|
-
}, e.addHook = function(
|
|
2862
|
-
typeof l == "function" &&
|
|
2863
|
-
}, e.removeHook = function(
|
|
2864
|
+
const L = ae(I), Z = ae(l);
|
|
2865
|
+
return $n(L, Z, w);
|
|
2866
|
+
}, e.addHook = function(I, l) {
|
|
2867
|
+
typeof l == "function" && pt(E[I], l);
|
|
2868
|
+
}, e.removeHook = function(I, l) {
|
|
2864
2869
|
if (l !== void 0) {
|
|
2865
|
-
const w = to(
|
|
2866
|
-
return w === -1 ? void 0 : no(
|
|
2870
|
+
const w = to(E[I], l);
|
|
2871
|
+
return w === -1 ? void 0 : no(E[I], w, 1)[0];
|
|
2867
2872
|
}
|
|
2868
|
-
return Yn(
|
|
2869
|
-
}, e.removeHooks = function(
|
|
2870
|
-
|
|
2873
|
+
return Yn(E[I]);
|
|
2874
|
+
}, e.removeHooks = function(I) {
|
|
2875
|
+
E[I] = [];
|
|
2871
2876
|
}, e.removeAllHooks = function() {
|
|
2872
|
-
|
|
2877
|
+
E = ss();
|
|
2873
2878
|
}, e;
|
|
2874
2879
|
}
|
|
2875
2880
|
var wo = Cs();
|
|
@@ -2952,7 +2957,7 @@ function Ea() {
|
|
|
2952
2957
|
function r() {
|
|
2953
2958
|
n && (n.disconnect(), n = null);
|
|
2954
2959
|
}
|
|
2955
|
-
return
|
|
2960
|
+
return vt(() => {
|
|
2956
2961
|
r();
|
|
2957
2962
|
}), {
|
|
2958
2963
|
scrollToBottom: e,
|
|
@@ -3090,9 +3095,9 @@ function La(n, e) {
|
|
|
3090
3095
|
};
|
|
3091
3096
|
t(a);
|
|
3092
3097
|
}
|
|
3093
|
-
return
|
|
3098
|
+
return Tt(() => {
|
|
3094
3099
|
i();
|
|
3095
|
-
}),
|
|
3100
|
+
}), vt(() => {
|
|
3096
3101
|
s();
|
|
3097
3102
|
}), e && _e(
|
|
3098
3103
|
() => o(),
|
|
@@ -3119,32 +3124,32 @@ function Co(n) {
|
|
|
3119
3124
|
function Eo(n, e) {
|
|
3120
3125
|
const t = n.key.toLowerCase();
|
|
3121
3126
|
if (e.mod) {
|
|
3122
|
-
const d = navigator.platform.toUpperCase().indexOf("MAC") >= 0 || navigator.userAgent.toUpperCase().indexOf("MAC") >= 0 ? n.metaKey : n.ctrlKey, c = e.shift ? n.shiftKey : !n.shiftKey,
|
|
3123
|
-
return t === e.key && d && c &&
|
|
3127
|
+
const d = navigator.platform.toUpperCase().indexOf("MAC") >= 0 || navigator.userAgent.toUpperCase().indexOf("MAC") >= 0 ? n.metaKey : n.ctrlKey, c = e.shift ? n.shiftKey : !n.shiftKey, y = e.alt ? n.altKey : !n.altKey;
|
|
3128
|
+
return t === e.key && d && c && y;
|
|
3124
3129
|
}
|
|
3125
3130
|
const s = e.meta ? n.metaKey : !n.metaKey, r = e.ctrl ? n.ctrlKey : !n.ctrlKey, o = e.shift ? n.shiftKey : !n.shiftKey, i = e.alt ? n.altKey : !n.altKey;
|
|
3126
3131
|
let a = s && r && o && i;
|
|
3127
3132
|
return (e.meta && !e.ctrl || !e.meta && e.ctrl) && (a = (n.metaKey || n.ctrlKey) && o && i), t === e.key && a;
|
|
3128
3133
|
}
|
|
3129
3134
|
function Mo(n) {
|
|
3130
|
-
const { onToggle: e, enabled: t = !0 } = n, s =
|
|
3135
|
+
const { onToggle: e, enabled: t = !0 } = n, s = U(!1), r = n.shortcut !== void 0 ? n.shortcut : Be("keyboardShortcut") ?? "mod+g";
|
|
3131
3136
|
if (r === null)
|
|
3132
3137
|
return { isActive: s };
|
|
3133
3138
|
const o = Co(r);
|
|
3134
3139
|
function i(a) {
|
|
3135
3140
|
if (!t) return;
|
|
3136
|
-
const u = a.target, d = u.tagName === "INPUT" || u.tagName === "TEXTAREA", c = u.isContentEditable,
|
|
3137
|
-
if (!((d || c) && !
|
|
3141
|
+
const u = a.target, d = u.tagName === "INPUT" || u.tagName === "TEXTAREA", c = u.isContentEditable, y = u.closest("[data-ai-input]");
|
|
3142
|
+
if (!((d || c) && !y) && Eo(a, o)) {
|
|
3138
3143
|
a.preventDefault(), a.stopPropagation();
|
|
3139
|
-
const
|
|
3140
|
-
if (
|
|
3144
|
+
const x = te();
|
|
3145
|
+
if (x != null && x.canToggle && !x.canToggle())
|
|
3141
3146
|
return;
|
|
3142
3147
|
s.value = !s.value, e();
|
|
3143
3148
|
}
|
|
3144
3149
|
}
|
|
3145
|
-
return
|
|
3150
|
+
return Tt(() => {
|
|
3146
3151
|
window.addEventListener("keydown", i, !0);
|
|
3147
|
-
}),
|
|
3152
|
+
}), vt(() => {
|
|
3148
3153
|
window.removeEventListener("keydown", i, !0);
|
|
3149
3154
|
}), { isActive: s };
|
|
3150
3155
|
}
|
|
@@ -3157,7 +3162,7 @@ function Ia(n) {
|
|
|
3157
3162
|
});
|
|
3158
3163
|
}
|
|
3159
3164
|
function Ro(n, e) {
|
|
3160
|
-
const t =
|
|
3165
|
+
const t = U(de("loadingText"));
|
|
3161
3166
|
let s = [];
|
|
3162
3167
|
function r() {
|
|
3163
3168
|
return [
|
|
@@ -3179,18 +3184,18 @@ function Ro(n, e) {
|
|
|
3179
3184
|
}
|
|
3180
3185
|
function u() {
|
|
3181
3186
|
i();
|
|
3182
|
-
const d = e == null ? void 0 : e(), c = (d == null ? void 0 : d.messages) ?? r(),
|
|
3187
|
+
const d = e == null ? void 0 : e(), c = (d == null ? void 0 : d.messages) ?? r(), y = (d == null ? void 0 : d.intervals) ?? o();
|
|
3183
3188
|
t.value = c[0] || de("loadingText");
|
|
3184
|
-
let
|
|
3189
|
+
let x = 0;
|
|
3185
3190
|
for (let f = 1; f < c.length; f++) {
|
|
3186
|
-
|
|
3187
|
-
const p = f,
|
|
3191
|
+
x += y[f] || 2e3;
|
|
3192
|
+
const p = f, D = window.setTimeout(() => {
|
|
3188
3193
|
n() && (t.value = c[p]);
|
|
3189
|
-
},
|
|
3190
|
-
s.push(
|
|
3194
|
+
}, x);
|
|
3195
|
+
s.push(D);
|
|
3191
3196
|
}
|
|
3192
3197
|
}
|
|
3193
|
-
return
|
|
3198
|
+
return vt(() => {
|
|
3194
3199
|
i();
|
|
3195
3200
|
}), {
|
|
3196
3201
|
loadingMessage: t,
|
|
@@ -3207,44 +3212,44 @@ function Lo(n) {
|
|
|
3207
3212
|
getTexts: r,
|
|
3208
3213
|
onStartNewChat: o,
|
|
3209
3214
|
onNewChatEmit: i
|
|
3210
|
-
} = n, a =
|
|
3215
|
+
} = n, a = U({
|
|
3211
3216
|
showWarning: !1,
|
|
3212
3217
|
isReached: !1,
|
|
3213
3218
|
pendingMessage: null
|
|
3214
3219
|
}), u = N(() => {
|
|
3215
|
-
var
|
|
3216
|
-
return ((
|
|
3220
|
+
var S;
|
|
3221
|
+
return ((S = s()) == null ? void 0 : S.limit) ?? t();
|
|
3217
3222
|
}), d = N(() => {
|
|
3218
|
-
var
|
|
3219
|
-
return ((
|
|
3220
|
-
}), c = N(() => Math.max(0, u.value - e())),
|
|
3223
|
+
var S;
|
|
3224
|
+
return ((S = s()) == null ? void 0 : S.showWarningAt) ?? u.value - 2;
|
|
3225
|
+
}), c = N(() => Math.max(0, u.value - e())), y = N(
|
|
3221
3226
|
() => c.value <= u.value - d.value && c.value > 0
|
|
3222
|
-
),
|
|
3223
|
-
var
|
|
3224
|
-
return a.value.isReached ||
|
|
3227
|
+
), x = N(() => c.value === 0), f = N(() => {
|
|
3228
|
+
var S, b;
|
|
3229
|
+
return a.value.isReached || x.value ? ((S = r()) == null ? void 0 : S.historyLimitReachedTitle) ?? "Chat Limit Reached" : ((b = r()) == null ? void 0 : b.historyLimitWarningTitle) ?? "Approaching Chat Limit";
|
|
3225
3230
|
}), p = N(() => {
|
|
3226
|
-
var
|
|
3227
|
-
return a.value.isReached ||
|
|
3231
|
+
var S, b, z, q;
|
|
3232
|
+
return a.value.isReached || x.value ? ((S = s()) == null ? void 0 : S.limitMessage) ?? ((b = r()) == null ? void 0 : b.historyLimitReachedMessage) ?? "You have reached the maximum number of messages in this conversation. Start a new chat to continue." : ((z = s()) == null ? void 0 : z.warningMessage) ?? ((q = r()) == null ? void 0 : q.historyLimitWarningMessage) ?? `You have ${c.value} message${c.value === 1 ? "" : "s"} remaining in this conversation.`;
|
|
3228
3233
|
});
|
|
3229
|
-
function
|
|
3234
|
+
function D() {
|
|
3230
3235
|
a.value.showWarning = !1, a.value.isReached = !1, a.value.pendingMessage = null;
|
|
3231
3236
|
}
|
|
3232
|
-
async function
|
|
3237
|
+
async function g() {
|
|
3233
3238
|
a.value.showWarning = !1;
|
|
3234
|
-
const
|
|
3235
|
-
if (
|
|
3239
|
+
const S = s();
|
|
3240
|
+
if (S != null && S.onLimitReached && !await S.onLimitReached())
|
|
3236
3241
|
return a.value.isReached = !1, null;
|
|
3237
3242
|
if (o(), i(), a.value.isReached = !1, a.value.pendingMessage) {
|
|
3238
|
-
const
|
|
3239
|
-
return a.value.pendingMessage = null,
|
|
3243
|
+
const b = a.value.pendingMessage;
|
|
3244
|
+
return a.value.pendingMessage = null, b;
|
|
3240
3245
|
}
|
|
3241
3246
|
return null;
|
|
3242
3247
|
}
|
|
3243
|
-
function
|
|
3244
|
-
return
|
|
3248
|
+
function m() {
|
|
3249
|
+
return x.value ? (a.value.isReached = !0, a.value.showWarning = !0, !1) : (y.value && !a.value.showWarning && (a.value.showWarning = !0), !0);
|
|
3245
3250
|
}
|
|
3246
|
-
function S
|
|
3247
|
-
a.value.pendingMessage =
|
|
3251
|
+
function C(S) {
|
|
3252
|
+
a.value.pendingMessage = S;
|
|
3248
3253
|
}
|
|
3249
3254
|
return {
|
|
3250
3255
|
// State
|
|
@@ -3256,49 +3261,49 @@ function Lo(n) {
|
|
|
3256
3261
|
historyLimitDialogTitle: f,
|
|
3257
3262
|
historyLimitDialogMessage: p,
|
|
3258
3263
|
// Actions
|
|
3259
|
-
dismissHistoryLimitWarning:
|
|
3260
|
-
handleHistoryLimitAction:
|
|
3261
|
-
checkHistoryLimit:
|
|
3262
|
-
setPendingMessage:
|
|
3264
|
+
dismissHistoryLimitWarning: D,
|
|
3265
|
+
handleHistoryLimitAction: g,
|
|
3266
|
+
checkHistoryLimit: m,
|
|
3267
|
+
setPendingMessage: C
|
|
3263
3268
|
};
|
|
3264
3269
|
}
|
|
3265
3270
|
function Io() {
|
|
3266
|
-
const n = Ge(), e =
|
|
3267
|
-
function c(
|
|
3268
|
-
return (
|
|
3271
|
+
const n = Ge(), e = U([]), t = U(!1), s = U(0), r = Be("maxAttachments") || 5, o = Be("maxFileSize") || 10 * 1024 * 1024, i = Be("acceptedFileTypes") || "image/*,.pdf,.txt,.doc,.docx,.xls,.xlsx,.csv", a = N(() => e.value.length > 0), u = N(() => e.value.some((A) => A.uploading)), d = N(() => e.value.length < r);
|
|
3272
|
+
function c(A) {
|
|
3273
|
+
return (A.type || "").startsWith("image/") ? !0 : /(png|jpe?g|gif|webp)$/i.test(A.name);
|
|
3269
3274
|
}
|
|
3270
|
-
function
|
|
3271
|
-
if (
|
|
3272
|
-
const _ = typeof
|
|
3275
|
+
function y(A) {
|
|
3276
|
+
if (A == null) return "";
|
|
3277
|
+
const _ = typeof A == "string" ? parseInt(A, 10) : A;
|
|
3273
3278
|
return Number.isNaN(_) ? "" : _ >= 1024 * 1024 ? `${(_ / (1024 * 1024)).toFixed(1)} MB` : _ >= 1024 ? `${Math.round(_ / 1024)} KB` : `${_} B`;
|
|
3274
3279
|
}
|
|
3275
|
-
function
|
|
3276
|
-
var
|
|
3277
|
-
const _ = crypto.randomUUID(), R =
|
|
3280
|
+
function x(A) {
|
|
3281
|
+
var W;
|
|
3282
|
+
const _ = crypto.randomUUID(), R = A.type.startsWith("image/") ? URL.createObjectURL(A) : void 0, E = te(), Y = !!((W = E == null ? void 0 : E.endpoints) != null && W.uploadFile), M = {
|
|
3278
3283
|
id: _,
|
|
3279
|
-
name:
|
|
3280
|
-
type:
|
|
3281
|
-
size:
|
|
3282
|
-
uploading:
|
|
3283
|
-
progress:
|
|
3284
|
+
name: A.name,
|
|
3285
|
+
type: A.type,
|
|
3286
|
+
size: A.size,
|
|
3287
|
+
uploading: Y,
|
|
3288
|
+
progress: Y ? 0 : 100,
|
|
3284
3289
|
previewUrl: R
|
|
3285
3290
|
};
|
|
3286
|
-
e.value.push(
|
|
3291
|
+
e.value.push(M), Y && f(A, _);
|
|
3287
3292
|
}
|
|
3288
|
-
async function f(
|
|
3293
|
+
async function f(A, _) {
|
|
3289
3294
|
try {
|
|
3290
|
-
const R = await n.uploadFile(
|
|
3291
|
-
if (
|
|
3295
|
+
const R = await n.uploadFile(A), E = e.value.findIndex((Y) => Y.id === _);
|
|
3296
|
+
if (E === -1) return;
|
|
3292
3297
|
if (R) {
|
|
3293
|
-
const
|
|
3294
|
-
e.value[
|
|
3295
|
-
...e.value[
|
|
3298
|
+
const Y = e.value[E].previewUrl;
|
|
3299
|
+
e.value[E] = {
|
|
3300
|
+
...e.value[E],
|
|
3296
3301
|
id: R.id || _,
|
|
3297
3302
|
url: R.url,
|
|
3298
3303
|
extractedText: R.extractedText,
|
|
3299
3304
|
uploading: !1,
|
|
3300
3305
|
progress: 100,
|
|
3301
|
-
previewUrl:
|
|
3306
|
+
previewUrl: Y || R.previewUrl
|
|
3302
3307
|
};
|
|
3303
3308
|
} else
|
|
3304
3309
|
p(_);
|
|
@@ -3306,57 +3311,57 @@ function Io() {
|
|
|
3306
3311
|
p(_);
|
|
3307
3312
|
}
|
|
3308
3313
|
}
|
|
3309
|
-
function p(
|
|
3310
|
-
const _ = e.value.findIndex((
|
|
3314
|
+
function p(A) {
|
|
3315
|
+
const _ = e.value.findIndex((E) => E.id === A);
|
|
3311
3316
|
if (_ === -1) return;
|
|
3312
3317
|
const [R] = e.value.splice(_, 1);
|
|
3313
3318
|
R != null && R.previewUrl && URL.revokeObjectURL(R.previewUrl);
|
|
3314
3319
|
}
|
|
3315
|
-
function
|
|
3316
|
-
e.value.forEach((
|
|
3317
|
-
|
|
3320
|
+
function D() {
|
|
3321
|
+
e.value.forEach((A) => {
|
|
3322
|
+
A.previewUrl && URL.revokeObjectURL(A.previewUrl);
|
|
3318
3323
|
}), e.value = [];
|
|
3319
3324
|
}
|
|
3320
|
-
function
|
|
3321
|
-
return e.value.filter((
|
|
3322
|
-
id:
|
|
3323
|
-
name:
|
|
3324
|
-
url:
|
|
3325
|
-
type:
|
|
3326
|
-
size:
|
|
3325
|
+
function g() {
|
|
3326
|
+
return e.value.filter((A) => !A.uploading).map((A) => ({
|
|
3327
|
+
id: A.id,
|
|
3328
|
+
name: A.name,
|
|
3329
|
+
url: A.url,
|
|
3330
|
+
type: A.type,
|
|
3331
|
+
size: A.size
|
|
3327
3332
|
}));
|
|
3328
3333
|
}
|
|
3329
|
-
function
|
|
3330
|
-
if (!
|
|
3331
|
-
const _ = Array.from(
|
|
3334
|
+
function m(A) {
|
|
3335
|
+
if (!A) return;
|
|
3336
|
+
const _ = Array.from(A);
|
|
3332
3337
|
for (const R of _) {
|
|
3333
3338
|
if (e.value.length >= r) break;
|
|
3334
|
-
R.size > o ||
|
|
3339
|
+
R.size > o || x(R);
|
|
3335
3340
|
}
|
|
3336
3341
|
}
|
|
3337
|
-
function
|
|
3342
|
+
function C(A) {
|
|
3338
3343
|
var _;
|
|
3339
|
-
return Array.from(((_ =
|
|
3344
|
+
return Array.from(((_ = A.dataTransfer) == null ? void 0 : _.types) || []).includes("Files");
|
|
3340
3345
|
}
|
|
3341
|
-
function
|
|
3342
|
-
|
|
3346
|
+
function S(A) {
|
|
3347
|
+
C(A) && (s.value += 1, t.value = !0);
|
|
3343
3348
|
}
|
|
3344
|
-
function
|
|
3345
|
-
|
|
3349
|
+
function b(A) {
|
|
3350
|
+
C(A) || A.preventDefault();
|
|
3346
3351
|
}
|
|
3347
|
-
function z(
|
|
3348
|
-
|
|
3352
|
+
function z(A) {
|
|
3353
|
+
C(A) && (s.value = Math.max(0, s.value - 1), s.value === 0 && (t.value = !1));
|
|
3349
3354
|
}
|
|
3350
|
-
function
|
|
3355
|
+
function q(A) {
|
|
3351
3356
|
var _;
|
|
3352
|
-
|
|
3357
|
+
C(A) && (s.value = 0, t.value = !1, m(((_ = A.dataTransfer) == null ? void 0 : _.files) || null));
|
|
3353
3358
|
}
|
|
3354
|
-
function
|
|
3355
|
-
const _ =
|
|
3356
|
-
R && R.length &&
|
|
3359
|
+
function G(A) {
|
|
3360
|
+
const _ = A.target, R = _.files;
|
|
3361
|
+
R && R.length && m(R), _.value = "";
|
|
3357
3362
|
}
|
|
3358
3363
|
return Us(() => {
|
|
3359
|
-
|
|
3364
|
+
D();
|
|
3360
3365
|
}), {
|
|
3361
3366
|
// State
|
|
3362
3367
|
attachments: e,
|
|
@@ -3368,97 +3373,101 @@ function Io() {
|
|
|
3368
3373
|
acceptedFileTypes: i,
|
|
3369
3374
|
// Utils
|
|
3370
3375
|
isImage: c,
|
|
3371
|
-
formatFileSize:
|
|
3376
|
+
formatFileSize: y,
|
|
3372
3377
|
// Actions
|
|
3373
3378
|
removeAttachment: p,
|
|
3374
|
-
clearAttachments:
|
|
3375
|
-
buildPayload:
|
|
3376
|
-
processFiles:
|
|
3377
|
-
handleFileSelect:
|
|
3379
|
+
clearAttachments: D,
|
|
3380
|
+
buildPayload: g,
|
|
3381
|
+
processFiles: m,
|
|
3382
|
+
handleFileSelect: G,
|
|
3378
3383
|
// Drag & Drop
|
|
3379
|
-
handleDragEnter:
|
|
3380
|
-
handleDragOver:
|
|
3384
|
+
handleDragEnter: S,
|
|
3385
|
+
handleDragOver: b,
|
|
3381
3386
|
handleDragLeave: z,
|
|
3382
|
-
handleDrop:
|
|
3387
|
+
handleDrop: q
|
|
3383
3388
|
};
|
|
3384
3389
|
}
|
|
3385
3390
|
function $o(n, e, t) {
|
|
3386
|
-
const s =
|
|
3387
|
-
const
|
|
3388
|
-
return (
|
|
3391
|
+
const s = U(!1), r = U([]), o = U(0), i = U({ inMention: !1, query: "", startPos: 0 }), a = U(!1), u = U([]), d = N(() => {
|
|
3392
|
+
const g = te();
|
|
3393
|
+
return (g == null ? void 0 : g.mentionProviders) || [];
|
|
3389
3394
|
});
|
|
3390
|
-
function
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
const
|
|
3398
|
-
|
|
3395
|
+
function c(g) {
|
|
3396
|
+
if (a.value) {
|
|
3397
|
+
a.value = !1;
|
|
3398
|
+
return;
|
|
3399
|
+
}
|
|
3400
|
+
const m = t();
|
|
3401
|
+
if (!m) return;
|
|
3402
|
+
const C = m.selectionStart, S = us(g, C);
|
|
3403
|
+
i.value = S, S.inMention && S.query.length >= 0 ? y(S.query) : (s.value = !1, r.value = []);
|
|
3404
|
+
}
|
|
3405
|
+
async function y(g) {
|
|
3406
|
+
const m = hs();
|
|
3407
|
+
if (m.length === 0) {
|
|
3399
3408
|
s.value = !1;
|
|
3400
3409
|
return;
|
|
3401
3410
|
}
|
|
3402
|
-
const
|
|
3403
|
-
for (const S of
|
|
3411
|
+
const C = [];
|
|
3412
|
+
for (const S of m)
|
|
3404
3413
|
try {
|
|
3405
|
-
const
|
|
3406
|
-
|
|
3407
|
-
} catch (
|
|
3408
|
-
console.warn(`Mention provider ${S.type} failed:`,
|
|
3414
|
+
const b = await S.search(g);
|
|
3415
|
+
C.push(...b.map((z) => ({ ...z, type: S.type })));
|
|
3416
|
+
} catch (b) {
|
|
3417
|
+
console.warn(`Mention provider ${S.type} failed:`, b);
|
|
3409
3418
|
}
|
|
3410
|
-
r.value =
|
|
3411
|
-
}
|
|
3412
|
-
function g
|
|
3413
|
-
const { startPos:
|
|
3414
|
-
e(`${
|
|
3415
|
-
id:
|
|
3416
|
-
name:
|
|
3417
|
-
type:
|
|
3418
|
-
metadata:
|
|
3419
|
+
r.value = C.slice(0, 10), s.value = C.length > 0, o.value = 0;
|
|
3420
|
+
}
|
|
3421
|
+
function x(g) {
|
|
3422
|
+
const { startPos: m } = i.value, C = n(), S = t(), b = C.slice(0, m), z = C.slice((S == null ? void 0 : S.selectionStart) || m), q = g.name || g.label || g.title || g.id;
|
|
3423
|
+
a.value = !0, e(`${b}@${q} ${z}`), u.value.push({
|
|
3424
|
+
id: g.id,
|
|
3425
|
+
name: q,
|
|
3426
|
+
type: g.type,
|
|
3427
|
+
metadata: g.attributes
|
|
3419
3428
|
}), s.value = !1, r.value = [], setTimeout(() => {
|
|
3420
|
-
const
|
|
3421
|
-
|
|
3422
|
-
const
|
|
3423
|
-
|
|
3429
|
+
const G = t();
|
|
3430
|
+
G == null || G.focus();
|
|
3431
|
+
const A = b.length + q.length + 2;
|
|
3432
|
+
G == null || G.setSelectionRange(A, A);
|
|
3424
3433
|
}, 0);
|
|
3425
3434
|
}
|
|
3426
|
-
function
|
|
3435
|
+
function f(g) {
|
|
3427
3436
|
if (!s.value || r.value.length === 0)
|
|
3428
3437
|
return !1;
|
|
3429
|
-
if (
|
|
3430
|
-
return
|
|
3431
|
-
if (
|
|
3432
|
-
return
|
|
3433
|
-
if (
|
|
3434
|
-
|
|
3435
|
-
const
|
|
3436
|
-
return
|
|
3438
|
+
if (g.key === "ArrowDown")
|
|
3439
|
+
return g.preventDefault(), o.value = Math.min(o.value + 1, r.value.length - 1), !0;
|
|
3440
|
+
if (g.key === "ArrowUp")
|
|
3441
|
+
return g.preventDefault(), o.value = Math.max(o.value - 1, 0), !0;
|
|
3442
|
+
if (g.key === "Enter" || g.key === "Tab") {
|
|
3443
|
+
g.preventDefault();
|
|
3444
|
+
const m = r.value[o.value];
|
|
3445
|
+
return m && x(m), !0;
|
|
3437
3446
|
}
|
|
3438
|
-
return
|
|
3439
|
-
}
|
|
3440
|
-
function f() {
|
|
3441
|
-
a.value = [];
|
|
3447
|
+
return g.key === "Escape" ? (g.preventDefault(), s.value = !1, !0) : !1;
|
|
3442
3448
|
}
|
|
3443
3449
|
function p() {
|
|
3444
|
-
|
|
3450
|
+
u.value = [];
|
|
3451
|
+
}
|
|
3452
|
+
function D() {
|
|
3453
|
+
return [...u.value];
|
|
3445
3454
|
}
|
|
3446
3455
|
return {
|
|
3447
3456
|
// State
|
|
3448
3457
|
showMentions: s,
|
|
3449
3458
|
mentionItems: r,
|
|
3450
3459
|
selectedMentionIndex: o,
|
|
3451
|
-
mentionProviders:
|
|
3460
|
+
mentionProviders: d,
|
|
3452
3461
|
// Actions
|
|
3453
|
-
checkForMentions:
|
|
3454
|
-
handleMentionSelect:
|
|
3455
|
-
handleMentionKeyDown:
|
|
3456
|
-
clearMentions:
|
|
3457
|
-
getMentions:
|
|
3462
|
+
checkForMentions: c,
|
|
3463
|
+
handleMentionSelect: x,
|
|
3464
|
+
handleMentionKeyDown: f,
|
|
3465
|
+
clearMentions: p,
|
|
3466
|
+
getMentions: D
|
|
3458
3467
|
};
|
|
3459
3468
|
}
|
|
3460
3469
|
function Do(n, e, t, s, r) {
|
|
3461
|
-
const o =
|
|
3470
|
+
const o = U(!1), i = U(-1), a = U(null);
|
|
3462
3471
|
function u() {
|
|
3463
3472
|
setTimeout(() => {
|
|
3464
3473
|
const f = a.value;
|
|
@@ -3477,19 +3486,19 @@ function Do(n, e, t, s, r) {
|
|
|
3477
3486
|
return f.preventDefault(), i.value = Math.max(i.value - 1, 0), u(), !0;
|
|
3478
3487
|
if (f.key === "Enter" && i.value >= 0) {
|
|
3479
3488
|
f.preventDefault();
|
|
3480
|
-
const
|
|
3481
|
-
return
|
|
3489
|
+
const D = p[i.value];
|
|
3490
|
+
return D && c(D), !0;
|
|
3482
3491
|
}
|
|
3483
3492
|
return f.key === "Escape" ? (f.preventDefault(), o.value = !1, i.value = -1, !0) : !1;
|
|
3484
3493
|
}
|
|
3485
3494
|
function c(f) {
|
|
3486
3495
|
r(f), o.value = !1, i.value = -1;
|
|
3487
3496
|
}
|
|
3488
|
-
function
|
|
3489
|
-
const f = s(), p = e(),
|
|
3490
|
-
f && !p &&
|
|
3497
|
+
function y() {
|
|
3498
|
+
const f = s(), p = e(), D = t(), g = n();
|
|
3499
|
+
f && !p && D && g.length > 0 ? o.value = !0 : o.value = !1;
|
|
3491
3500
|
}
|
|
3492
|
-
function
|
|
3501
|
+
function x() {
|
|
3493
3502
|
o.value = !1, i.value = -1;
|
|
3494
3503
|
}
|
|
3495
3504
|
return {
|
|
@@ -3498,8 +3507,8 @@ function Do(n, e, t, s, r) {
|
|
|
3498
3507
|
dropdownRef: a,
|
|
3499
3508
|
handleSuggestionKeyDown: d,
|
|
3500
3509
|
handleSuggestionClick: c,
|
|
3501
|
-
updateSuggestionsVisibility:
|
|
3502
|
-
hideSuggestions:
|
|
3510
|
+
updateSuggestionsVisibility: y,
|
|
3511
|
+
hideSuggestions: x
|
|
3503
3512
|
};
|
|
3504
3513
|
}
|
|
3505
3514
|
function Oo(n, e = 300) {
|
|
@@ -3510,7 +3519,7 @@ function Oo(n, e = 300) {
|
|
|
3510
3519
|
const r = Math.min(s.scrollHeight, e);
|
|
3511
3520
|
s.style.height = `${r}px`, s.style.overflowY = s.scrollHeight > e ? "auto" : "hidden";
|
|
3512
3521
|
}
|
|
3513
|
-
return
|
|
3522
|
+
return Tt(() => {
|
|
3514
3523
|
setTimeout(t, 0);
|
|
3515
3524
|
}), {
|
|
3516
3525
|
adjustTextareaHeight: t
|
|
@@ -3524,14 +3533,14 @@ const No = /* @__PURE__ */ he({
|
|
|
3524
3533
|
setup(n) {
|
|
3525
3534
|
return (e, t) => {
|
|
3526
3535
|
var s;
|
|
3527
|
-
return
|
|
3528
|
-
class:
|
|
3536
|
+
return k(), T("div", {
|
|
3537
|
+
class: v(["w-6 h-6 min-w-[24px] flex items-center justify-center rounded-full border border-gray-300 dark:border-gray-600", (s = n.ui) == null ? void 0 : s.container])
|
|
3529
3538
|
}, [
|
|
3530
3539
|
ce(e.$slots, "default", {}, () => {
|
|
3531
3540
|
var r;
|
|
3532
3541
|
return [
|
|
3533
|
-
(
|
|
3534
|
-
class:
|
|
3542
|
+
(k(), T("svg", {
|
|
3543
|
+
class: v(["w-4 h-4 text-gray-400 dark:text-gray-500", (r = n.ui) == null ? void 0 : r.icon]),
|
|
3535
3544
|
fill: "none",
|
|
3536
3545
|
viewBox: "0 0 24 24",
|
|
3537
3546
|
stroke: "currentColor",
|
|
@@ -3556,17 +3565,17 @@ const No = /* @__PURE__ */ he({
|
|
|
3556
3565
|
setup(n) {
|
|
3557
3566
|
return (e, t) => {
|
|
3558
3567
|
var s;
|
|
3559
|
-
return
|
|
3560
|
-
class:
|
|
3568
|
+
return k(), T("div", {
|
|
3569
|
+
class: v(["w-8 h-8 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center flex-shrink-0", (s = n.ui) == null ? void 0 : s.container])
|
|
3561
3570
|
}, [
|
|
3562
3571
|
ce(e.$slots, "default", {}, () => {
|
|
3563
3572
|
var r;
|
|
3564
3573
|
return [
|
|
3565
|
-
(
|
|
3574
|
+
(k(), T("svg", {
|
|
3566
3575
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3567
3576
|
viewBox: "0 0 24 24",
|
|
3568
3577
|
fill: "currentColor",
|
|
3569
|
-
class:
|
|
3578
|
+
class: v(["w-5 h-5 text-gray-500 dark:text-gray-400", (r = n.ui) == null ? void 0 : r.icon])
|
|
3570
3579
|
}, [...t[0] || (t[0] = [
|
|
3571
3580
|
h("path", {
|
|
3572
3581
|
"fill-rule": "evenodd",
|
|
@@ -3590,106 +3599,106 @@ const No = /* @__PURE__ */ he({
|
|
|
3590
3599
|
},
|
|
3591
3600
|
emits: ["select", "update:selectedIndex"],
|
|
3592
3601
|
setup(n, { emit: e }) {
|
|
3593
|
-
const t = n, s = N(() => t.ui || {}), r = e, o =
|
|
3594
|
-
_e(() => t.selectedIndex, (
|
|
3595
|
-
o.value =
|
|
3596
|
-
}), _e(o, (
|
|
3597
|
-
r("update:selectedIndex",
|
|
3602
|
+
const t = n, s = N(() => t.ui || {}), r = e, o = U(t.selectedIndex);
|
|
3603
|
+
_e(() => t.selectedIndex, (g) => {
|
|
3604
|
+
o.value = g;
|
|
3605
|
+
}), _e(o, (g) => {
|
|
3606
|
+
r("update:selectedIndex", g);
|
|
3598
3607
|
});
|
|
3599
3608
|
const i = N(() => {
|
|
3600
|
-
const
|
|
3601
|
-
return t.items.forEach((
|
|
3602
|
-
const
|
|
3603
|
-
|
|
3604
|
-
}),
|
|
3609
|
+
const g = {};
|
|
3610
|
+
return t.items.forEach((m) => {
|
|
3611
|
+
const C = m.type || "default";
|
|
3612
|
+
g[C] || (g[C] = []), g[C].push(m);
|
|
3613
|
+
}), g;
|
|
3605
3614
|
});
|
|
3606
|
-
function a(
|
|
3607
|
-
return t.providers.find((
|
|
3615
|
+
function a(g) {
|
|
3616
|
+
return t.providers.find((m) => m.type === g) || ds(g);
|
|
3608
3617
|
}
|
|
3609
|
-
function u(
|
|
3610
|
-
const
|
|
3611
|
-
return (
|
|
3618
|
+
function u(g) {
|
|
3619
|
+
const m = a(g);
|
|
3620
|
+
return (m == null ? void 0 : m.label) || g.charAt(0).toUpperCase() + g.slice(1) + "s";
|
|
3612
3621
|
}
|
|
3613
|
-
function d(
|
|
3614
|
-
let
|
|
3615
|
-
const
|
|
3616
|
-
for (const
|
|
3617
|
-
if (
|
|
3618
|
-
return
|
|
3619
|
-
|
|
3622
|
+
function d(g, m) {
|
|
3623
|
+
let C = 0;
|
|
3624
|
+
const S = Object.keys(i.value);
|
|
3625
|
+
for (const b of S) {
|
|
3626
|
+
if (b === g)
|
|
3627
|
+
return C + m;
|
|
3628
|
+
C += i.value[b].length;
|
|
3620
3629
|
}
|
|
3621
|
-
return
|
|
3630
|
+
return C;
|
|
3622
3631
|
}
|
|
3623
|
-
function c(
|
|
3624
|
-
r("select",
|
|
3632
|
+
function c(g) {
|
|
3633
|
+
r("select", g);
|
|
3625
3634
|
}
|
|
3626
|
-
function g
|
|
3627
|
-
o.value =
|
|
3635
|
+
function y(g) {
|
|
3636
|
+
o.value = g, r("update:selectedIndex", g);
|
|
3628
3637
|
}
|
|
3629
|
-
function
|
|
3630
|
-
const
|
|
3631
|
-
return dn(
|
|
3638
|
+
function x(g) {
|
|
3639
|
+
const m = a(g.type);
|
|
3640
|
+
return dn(g, m);
|
|
3632
3641
|
}
|
|
3633
|
-
function f(
|
|
3634
|
-
const
|
|
3635
|
-
return cs(
|
|
3642
|
+
function f(g) {
|
|
3643
|
+
const m = a(g.type);
|
|
3644
|
+
return cs(g, m);
|
|
3636
3645
|
}
|
|
3637
|
-
function p(
|
|
3638
|
-
const
|
|
3646
|
+
function p(g) {
|
|
3647
|
+
const m = {
|
|
3639
3648
|
employee: "bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400",
|
|
3640
3649
|
job: "bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400",
|
|
3641
3650
|
candidate: "bg-purple-100 dark:bg-purple-900/30 text-purple-600 dark:text-purple-400",
|
|
3642
3651
|
project: "bg-orange-100 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400",
|
|
3643
3652
|
default: "bg-primary/10 text-primary"
|
|
3644
3653
|
};
|
|
3645
|
-
return
|
|
3654
|
+
return m[g] || m.default;
|
|
3646
3655
|
}
|
|
3647
|
-
function
|
|
3648
|
-
return
|
|
3656
|
+
function D(g) {
|
|
3657
|
+
return g.split(" ").map((m) => m[0]).join("").slice(0, 2).toUpperCase();
|
|
3649
3658
|
}
|
|
3650
|
-
return (
|
|
3659
|
+
return (g, m) => n.items.length > 0 ? (k(), T("div", {
|
|
3651
3660
|
key: 0,
|
|
3652
|
-
class:
|
|
3661
|
+
class: v(["absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-lg max-h-60 overflow-y-auto z-50", s.value.root])
|
|
3653
3662
|
}, [
|
|
3654
3663
|
h("div", {
|
|
3655
|
-
class:
|
|
3664
|
+
class: v(["p-2", s.value.container])
|
|
3656
3665
|
}, [
|
|
3657
|
-
(
|
|
3658
|
-
Object.keys(i.value).length > 1 ? (
|
|
3666
|
+
(k(!0), T(be, null, Fe(i.value, (C, S) => (k(), T(be, { key: S }, [
|
|
3667
|
+
Object.keys(i.value).length > 1 ? (k(), T("div", {
|
|
3659
3668
|
key: 0,
|
|
3660
|
-
class:
|
|
3661
|
-
}, P(u(
|
|
3662
|
-
(
|
|
3663
|
-
key:
|
|
3669
|
+
class: v(["px-3 py-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wide", s.value.groupHeader])
|
|
3670
|
+
}, P(u(S)), 3)) : F("", !0),
|
|
3671
|
+
(k(!0), T(be, null, Fe(C, (b, z) => (k(), T("button", {
|
|
3672
|
+
key: b.id,
|
|
3664
3673
|
type: "button",
|
|
3665
|
-
class:
|
|
3674
|
+
class: v(["w-full flex items-center gap-3 px-3 py-2 rounded-lg text-left transition-colors mb-0.5", [
|
|
3666
3675
|
s.value.item,
|
|
3667
3676
|
{
|
|
3668
|
-
[s.value.itemSelected || "bg-primary/10"]: d(
|
|
3669
|
-
"hover:bg-gray-
|
|
3677
|
+
[s.value.itemSelected || "bg-primary/10"]: d(S, z) === o.value,
|
|
3678
|
+
"hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer": d(S, z) !== o.value
|
|
3670
3679
|
}
|
|
3671
3680
|
]]),
|
|
3672
|
-
onClick: (
|
|
3673
|
-
onMouseenter: (
|
|
3681
|
+
onClick: (q) => c(b),
|
|
3682
|
+
onMouseenter: (q) => y(d(S, z))
|
|
3674
3683
|
}, [
|
|
3675
|
-
ce(
|
|
3676
|
-
item:
|
|
3677
|
-
type:
|
|
3684
|
+
ce(g.$slots, "item-icon", {
|
|
3685
|
+
item: b,
|
|
3686
|
+
type: S
|
|
3678
3687
|
}, () => [
|
|
3679
3688
|
h("span", {
|
|
3680
|
-
class:
|
|
3681
|
-
}, P(
|
|
3689
|
+
class: v(["w-8 h-8 flex items-center justify-center rounded-full text-xs font-semibold flex-shrink-0", [s.value.itemIcon, p(b.type)]])
|
|
3690
|
+
}, P(D(x(b))), 3)
|
|
3682
3691
|
]),
|
|
3683
3692
|
h("div", {
|
|
3684
|
-
class:
|
|
3693
|
+
class: v(["flex-1 min-w-0", s.value.itemContent])
|
|
3685
3694
|
}, [
|
|
3686
3695
|
h("p", {
|
|
3687
|
-
class:
|
|
3688
|
-
}, P(
|
|
3689
|
-
f(
|
|
3696
|
+
class: v(["text-sm font-medium text-gray-900 dark:text-gray-100 truncate", s.value.itemName])
|
|
3697
|
+
}, P(x(b)), 3),
|
|
3698
|
+
f(b) ? (k(), T("p", {
|
|
3690
3699
|
key: 0,
|
|
3691
|
-
class:
|
|
3692
|
-
}, P(f(
|
|
3700
|
+
class: v(["text-xs text-gray-500 dark:text-gray-400 truncate", s.value.itemSubtitle])
|
|
3701
|
+
}, P(f(b)), 3)) : F("", !0)
|
|
3693
3702
|
], 2)
|
|
3694
3703
|
], 42, Po))), 128))
|
|
3695
3704
|
], 64))), 128))
|
|
@@ -3717,7 +3726,7 @@ const No = /* @__PURE__ */ he({
|
|
|
3717
3726
|
copyToClipboard: "copyToClipboard",
|
|
3718
3727
|
copied: "copied"
|
|
3719
3728
|
}[u]);
|
|
3720
|
-
}, o = N(() => t.ui || {}), i =
|
|
3729
|
+
}, o = N(() => t.ui || {}), i = U(!1);
|
|
3721
3730
|
async function a() {
|
|
3722
3731
|
try {
|
|
3723
3732
|
await navigator.clipboard.writeText(t.message.message), i.value = !0, s("copy", t.message), setTimeout(() => {
|
|
@@ -3727,18 +3736,18 @@ const No = /* @__PURE__ */ he({
|
|
|
3727
3736
|
console.error("Failed to copy:", u);
|
|
3728
3737
|
}
|
|
3729
3738
|
}
|
|
3730
|
-
return (u, d) => (
|
|
3731
|
-
class:
|
|
3739
|
+
return (u, d) => (k(), T("div", {
|
|
3740
|
+
class: v(["flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity", o.value.container])
|
|
3732
3741
|
}, [
|
|
3733
3742
|
h("button", {
|
|
3734
3743
|
type: "button",
|
|
3735
|
-
class:
|
|
3744
|
+
class: v(["p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors", [o.value.button, o.value.copyButton]]),
|
|
3736
3745
|
title: i.value ? r("copied") : r("copyToClipboard"),
|
|
3737
3746
|
onClick: a
|
|
3738
3747
|
}, [
|
|
3739
|
-
i.value ? (
|
|
3748
|
+
i.value ? (k(), T("svg", {
|
|
3740
3749
|
key: 1,
|
|
3741
|
-
class:
|
|
3750
|
+
class: v(["w-4 h-4 text-green-500", o.value.successState]),
|
|
3742
3751
|
fill: "none",
|
|
3743
3752
|
viewBox: "0 0 24 24",
|
|
3744
3753
|
stroke: "currentColor"
|
|
@@ -3749,7 +3758,7 @@ const No = /* @__PURE__ */ he({
|
|
|
3749
3758
|
"stroke-width": "2",
|
|
3750
3759
|
d: "M5 13l4 4L19 7"
|
|
3751
3760
|
}, null, -1)
|
|
3752
|
-
])], 2)) : (
|
|
3761
|
+
])], 2)) : (k(), T("svg", Ho, [...d[0] || (d[0] = [
|
|
3753
3762
|
h("path", {
|
|
3754
3763
|
"stroke-linecap": "round",
|
|
3755
3764
|
"stroke-linejoin": "round",
|
|
@@ -3794,51 +3803,51 @@ const No = /* @__PURE__ */ he({
|
|
|
3794
3803
|
},
|
|
3795
3804
|
emits: ["copy"],
|
|
3796
3805
|
setup(n, { emit: e }) {
|
|
3797
|
-
const t = n, s = e, r = (
|
|
3798
|
-
var
|
|
3799
|
-
return (
|
|
3806
|
+
const t = n, s = e, r = (m) => {
|
|
3807
|
+
var S;
|
|
3808
|
+
return (S = t.texts) != null && S[m] ? t.texts[m] : {
|
|
3800
3809
|
loadingText: "Gathering data...",
|
|
3801
3810
|
showMore: "Show more",
|
|
3802
3811
|
showLess: "Show less",
|
|
3803
3812
|
openAttachment: "Open",
|
|
3804
3813
|
attachment: "Attachment"
|
|
3805
|
-
}[
|
|
3806
|
-
}, o = N(() => t.ui || {}), { parseMarkdown: i } = bo(), a =
|
|
3814
|
+
}[m] || m;
|
|
3815
|
+
}, o = N(() => t.ui || {}), { parseMarkdown: i } = bo(), a = U(!1), u = N(() => t.message.attachments ?? []), d = N(() => u.value.length > 0), c = N(() => {
|
|
3807
3816
|
if (t.message.role !== "user") return !1;
|
|
3808
|
-
const
|
|
3817
|
+
const m = t.message.message || "", C = m.split(`
|
|
3809
3818
|
`).length;
|
|
3810
|
-
return
|
|
3819
|
+
return m.length > 200 || C > 4;
|
|
3811
3820
|
});
|
|
3812
|
-
function
|
|
3821
|
+
function y() {
|
|
3813
3822
|
a.value = !a.value;
|
|
3814
3823
|
}
|
|
3815
|
-
function m
|
|
3816
|
-
return (
|
|
3824
|
+
function x(m) {
|
|
3825
|
+
return (m.type || "").startsWith("image/") ? !0 : /(png|jpe?g|gif|webp)$/i.test(m.name || "");
|
|
3817
3826
|
}
|
|
3818
3827
|
const f = N(() => {
|
|
3819
|
-
const
|
|
3820
|
-
return
|
|
3828
|
+
const m = te();
|
|
3829
|
+
return m != null && m.userAvatar ? typeof m.userAvatar == "string" ? m.userAvatar : typeof m.userAvatar == "function" ? m.userAvatar() : null : null;
|
|
3821
3830
|
});
|
|
3822
|
-
function p(
|
|
3823
|
-
if (
|
|
3824
|
-
const
|
|
3825
|
-
return Number.isNaN(
|
|
3831
|
+
function p(m) {
|
|
3832
|
+
if (m == null) return "";
|
|
3833
|
+
const C = typeof m == "string" ? parseInt(m, 10) : m;
|
|
3834
|
+
return Number.isNaN(C) ? "" : C >= 1024 * 1024 ? `${(C / (1024 * 1024)).toFixed(1)} MB` : C >= 1024 ? `${Math.round(C / 1024)} KB` : `${C} B`;
|
|
3826
3835
|
}
|
|
3827
|
-
const
|
|
3836
|
+
const D = N(() => {
|
|
3828
3837
|
if (t.message.role === "assistant") {
|
|
3829
|
-
let
|
|
3830
|
-
return
|
|
3831
|
-
`), i(
|
|
3838
|
+
let m = t.message.message;
|
|
3839
|
+
return m = m.replace(/\\n/g, `
|
|
3840
|
+
`), i(m);
|
|
3832
3841
|
}
|
|
3833
3842
|
return t.message.message;
|
|
3834
3843
|
});
|
|
3835
|
-
function
|
|
3836
|
-
s("copy",
|
|
3844
|
+
function g(m) {
|
|
3845
|
+
s("copy", m);
|
|
3837
3846
|
}
|
|
3838
|
-
return (
|
|
3839
|
-
var
|
|
3840
|
-
return
|
|
3841
|
-
class:
|
|
3847
|
+
return (m, C) => {
|
|
3848
|
+
var S;
|
|
3849
|
+
return k(), T("div", {
|
|
3850
|
+
class: v(["group relative animate-in fade-in slide-in-from-bottom-2 duration-300", [
|
|
3842
3851
|
o.value.root,
|
|
3843
3852
|
{
|
|
3844
3853
|
"flex justify-end": n.message.role === "user",
|
|
@@ -3846,41 +3855,41 @@ const No = /* @__PURE__ */ he({
|
|
|
3846
3855
|
}
|
|
3847
3856
|
]])
|
|
3848
3857
|
}, [
|
|
3849
|
-
n.message.role === "user" ? (
|
|
3858
|
+
n.message.role === "user" ? (k(), T("div", {
|
|
3850
3859
|
key: 0,
|
|
3851
|
-
class:
|
|
3860
|
+
class: v(["flex gap-3 justify-end", o.value.userMessage])
|
|
3852
3861
|
}, [
|
|
3853
3862
|
h("div", {
|
|
3854
|
-
class:
|
|
3863
|
+
class: v(["rounded-2xl px-4 py-3 bg-primary-500 text-white max-w-fit", o.value.userBubble])
|
|
3855
3864
|
}, [
|
|
3856
|
-
n.message.message ? (
|
|
3865
|
+
n.message.message ? (k(), T("p", {
|
|
3857
3866
|
key: 0,
|
|
3858
|
-
class:
|
|
3867
|
+
class: v(["text-sm whitespace-pre-wrap", [o.value.content, { "line-clamp-4": !a.value && c.value }]])
|
|
3859
3868
|
}, P(n.message.message), 3)) : F("", !0),
|
|
3860
|
-
c.value ? (
|
|
3869
|
+
c.value ? (k(), T("button", {
|
|
3861
3870
|
key: 1,
|
|
3862
|
-
class:
|
|
3863
|
-
onClick:
|
|
3871
|
+
class: v(["mt-2 text-xs text-white/80 hover:text-white underline", o.value.showMoreButton]),
|
|
3872
|
+
onClick: y
|
|
3864
3873
|
}, P(a.value ? r("showLess") : r("showMore")), 3)) : F("", !0),
|
|
3865
|
-
d.value ? (
|
|
3874
|
+
d.value ? (k(), T("div", {
|
|
3866
3875
|
key: 2,
|
|
3867
|
-
class:
|
|
3876
|
+
class: v(["mt-3 space-y-2", o.value.attachmentsContainer])
|
|
3868
3877
|
}, [
|
|
3869
|
-
(
|
|
3870
|
-
key:
|
|
3871
|
-
href:
|
|
3872
|
-
target:
|
|
3878
|
+
(k(!0), T(be, null, Fe(u.value, (b) => (k(), Ee(nn(b.url ? "a" : "div"), {
|
|
3879
|
+
key: b.id,
|
|
3880
|
+
href: b.url || void 0,
|
|
3881
|
+
target: b.url ? "_blank" : void 0,
|
|
3873
3882
|
rel: "noopener noreferrer",
|
|
3874
|
-
class:
|
|
3883
|
+
class: v(["flex items-center gap-3 rounded-xl border border-white/20 bg-white/10 p-2 transition", [o.value.attachmentItem, b.url ? "hover:bg-white/20 cursor-pointer" : ""]])
|
|
3875
3884
|
}, {
|
|
3876
3885
|
default: Ae(() => [
|
|
3877
3886
|
h("div", Fo, [
|
|
3878
|
-
|
|
3887
|
+
b.url && x(b) ? (k(), T("img", {
|
|
3879
3888
|
key: 0,
|
|
3880
|
-
src:
|
|
3889
|
+
src: b.url,
|
|
3881
3890
|
class: "object-cover h-full w-full",
|
|
3882
3891
|
alt: ""
|
|
3883
|
-
}, null, 8, Uo)) : (
|
|
3892
|
+
}, null, 8, Uo)) : (k(), T("svg", qo, [...C[0] || (C[0] = [
|
|
3884
3893
|
h("path", {
|
|
3885
3894
|
"stroke-linecap": "round",
|
|
3886
3895
|
"stroke-linejoin": "round",
|
|
@@ -3890,24 +3899,24 @@ const No = /* @__PURE__ */ he({
|
|
|
3890
3899
|
])]))
|
|
3891
3900
|
]),
|
|
3892
3901
|
h("div", jo, [
|
|
3893
|
-
h("p", Wo, P(
|
|
3894
|
-
h("p", Ko, P(p(
|
|
3902
|
+
h("p", Wo, P(b.name || r("attachment")), 1),
|
|
3903
|
+
h("p", Ko, P(p(b.size)), 1)
|
|
3895
3904
|
]),
|
|
3896
|
-
|
|
3905
|
+
b.url ? (k(), T("span", Vo, P(r("openAttachment")), 1)) : F("", !0)
|
|
3897
3906
|
]),
|
|
3898
3907
|
_: 2
|
|
3899
3908
|
}, 1032, ["href", "target", "class"]))), 128))
|
|
3900
3909
|
], 2)) : F("", !0)
|
|
3901
3910
|
], 2),
|
|
3902
3911
|
h("div", {
|
|
3903
|
-
class:
|
|
3912
|
+
class: v(["flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary-500 overflow-hidden", o.value.userAvatar])
|
|
3904
3913
|
}, [
|
|
3905
|
-
f.value ? (
|
|
3914
|
+
f.value ? (k(), T("img", {
|
|
3906
3915
|
key: 0,
|
|
3907
3916
|
src: f.value,
|
|
3908
3917
|
alt: "User",
|
|
3909
3918
|
class: "h-full w-full object-cover"
|
|
3910
|
-
}, null, 8, Go)) : (
|
|
3919
|
+
}, null, 8, Go)) : (k(), T("svg", Qo, [...C[1] || (C[1] = [
|
|
3911
3920
|
h("path", {
|
|
3912
3921
|
"fill-rule": "evenodd",
|
|
3913
3922
|
d: "M7.5 6a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM3.751 20.105a8.25 8.25 0 0 1 16.498 0 .75.75 0 0 1-.437.695A18.683 18.683 0 0 1 12 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 0 1-.437-.695Z",
|
|
@@ -3915,23 +3924,23 @@ const No = /* @__PURE__ */ he({
|
|
|
3915
3924
|
}, null, -1)
|
|
3916
3925
|
])]))
|
|
3917
3926
|
], 2)
|
|
3918
|
-
], 2)) : (
|
|
3927
|
+
], 2)) : (k(), T("div", {
|
|
3919
3928
|
key: 1,
|
|
3920
|
-
class:
|
|
3929
|
+
class: v(["flex items-start gap-3", o.value.assistantMessage])
|
|
3921
3930
|
}, [
|
|
3922
3931
|
h("div", Zo, [
|
|
3923
3932
|
ye(No)
|
|
3924
3933
|
]),
|
|
3925
3934
|
h("div", {
|
|
3926
|
-
class:
|
|
3935
|
+
class: v(["bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 px-4 py-3 shadow-sm rounded-2xl transition-all duration-200 max-w-[85%]", o.value.assistantBubble])
|
|
3927
3936
|
}, [
|
|
3928
|
-
n.message.loading ? (
|
|
3937
|
+
n.message.loading ? (k(), T("div", {
|
|
3929
3938
|
key: 0,
|
|
3930
|
-
class:
|
|
3939
|
+
class: v(["flex items-center gap-2 text-sm min-w-[150px]", o.value.loadingIndicator])
|
|
3931
3940
|
}, [
|
|
3932
3941
|
h("div", {
|
|
3933
|
-
class:
|
|
3934
|
-
}, [...
|
|
3942
|
+
class: v(["flex space-x-1", o.value.loadingDots])
|
|
3943
|
+
}, [...C[2] || (C[2] = [
|
|
3935
3944
|
h("div", {
|
|
3936
3945
|
class: "w-2 h-2 bg-gray-400 rounded-full animate-bounce",
|
|
3937
3946
|
style: { "animation-delay": "0ms" }
|
|
@@ -3945,32 +3954,32 @@ const No = /* @__PURE__ */ he({
|
|
|
3945
3954
|
style: { "animation-delay": "300ms" }
|
|
3946
3955
|
}, null, -1)
|
|
3947
3956
|
])], 2),
|
|
3948
|
-
h("span", Yo, P(((
|
|
3949
|
-
], 2)) : n.message.message ? (
|
|
3957
|
+
h("span", Yo, P(((S = n.texts) == null ? void 0 : S.loadingText) || n.loadingText), 1)
|
|
3958
|
+
], 2)) : n.message.message ? (k(), T("div", {
|
|
3950
3959
|
key: 1,
|
|
3951
3960
|
id: n.message.id,
|
|
3952
|
-
class:
|
|
3953
|
-
innerHTML:
|
|
3961
|
+
class: v(["text-sm text-gray-700 dark:text-gray-200 leading-relaxed", o.value.content]),
|
|
3962
|
+
innerHTML: D.value
|
|
3954
3963
|
}, null, 10, Xo)) : F("", !0),
|
|
3955
|
-
!n.message.loading && d.value ? (
|
|
3964
|
+
!n.message.loading && d.value ? (k(), T("div", {
|
|
3956
3965
|
key: 2,
|
|
3957
|
-
class:
|
|
3966
|
+
class: v(["mt-4 space-y-2", o.value.attachmentsContainer])
|
|
3958
3967
|
}, [
|
|
3959
|
-
(
|
|
3960
|
-
key:
|
|
3961
|
-
href:
|
|
3962
|
-
target:
|
|
3968
|
+
(k(!0), T(be, null, Fe(u.value, (b) => (k(), Ee(nn(b.url ? "a" : "div"), {
|
|
3969
|
+
key: b.id,
|
|
3970
|
+
href: b.url || void 0,
|
|
3971
|
+
target: b.url ? "_blank" : void 0,
|
|
3963
3972
|
rel: "noopener noreferrer",
|
|
3964
|
-
class:
|
|
3973
|
+
class: v(["flex items-center gap-3 rounded-xl border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 p-3 transition", [o.value.attachmentItem, b.url ? "hover:bg-white dark:hover:bg-gray-600 cursor-pointer" : ""]])
|
|
3965
3974
|
}, {
|
|
3966
3975
|
default: Ae(() => [
|
|
3967
3976
|
h("div", Jo, [
|
|
3968
|
-
|
|
3977
|
+
b.url && x(b) ? (k(), T("img", {
|
|
3969
3978
|
key: 0,
|
|
3970
|
-
src:
|
|
3979
|
+
src: b.url,
|
|
3971
3980
|
class: "object-cover h-full w-full",
|
|
3972
3981
|
alt: ""
|
|
3973
|
-
}, null, 8, ei)) : (
|
|
3982
|
+
}, null, 8, ei)) : (k(), T("svg", ti, [...C[3] || (C[3] = [
|
|
3974
3983
|
h("path", {
|
|
3975
3984
|
"stroke-linecap": "round",
|
|
3976
3985
|
"stroke-linejoin": "round",
|
|
@@ -3980,21 +3989,21 @@ const No = /* @__PURE__ */ he({
|
|
|
3980
3989
|
])]))
|
|
3981
3990
|
]),
|
|
3982
3991
|
h("div", ni, [
|
|
3983
|
-
h("p", si, P(
|
|
3984
|
-
h("p", ri, P(p(
|
|
3992
|
+
h("p", si, P(b.name || r("attachment")), 1),
|
|
3993
|
+
h("p", ri, P(p(b.size)), 1)
|
|
3985
3994
|
]),
|
|
3986
|
-
|
|
3995
|
+
b.url ? (k(), T("span", oi, P(r("openAttachment")), 1)) : F("", !0)
|
|
3987
3996
|
]),
|
|
3988
3997
|
_: 2
|
|
3989
3998
|
}, 1032, ["href", "target", "class"]))), 128))
|
|
3990
3999
|
], 2)) : F("", !0)
|
|
3991
4000
|
], 2)
|
|
3992
4001
|
], 2)),
|
|
3993
|
-
n.message.role === "assistant" && !n.message.loading && !n.message.streaming && n.showActions ? (
|
|
4002
|
+
n.message.role === "assistant" && !n.message.loading && !n.message.streaming && n.showActions ? (k(), Ee(Bo, {
|
|
3994
4003
|
key: 2,
|
|
3995
4004
|
message: n.message,
|
|
3996
|
-
class:
|
|
3997
|
-
onCopy:
|
|
4005
|
+
class: v(["absolute top-0 left-0", o.value.actionsContainer]),
|
|
4006
|
+
onCopy: g
|
|
3998
4007
|
}, null, 8, ["message", "class"])) : F("", !0)
|
|
3999
4008
|
], 2);
|
|
4000
4009
|
};
|
|
@@ -4004,7 +4013,7 @@ const No = /* @__PURE__ */ he({
|
|
|
4004
4013
|
for (const [s, r] of e)
|
|
4005
4014
|
t[s] = r;
|
|
4006
4015
|
return t;
|
|
4007
|
-
}, ai = /* @__PURE__ */ Ls(ii, [["__scopeId", "data-v-
|
|
4016
|
+
}, ai = /* @__PURE__ */ Ls(ii, [["__scopeId", "data-v-1fd34583"]]), li = { class: "text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wide" }, ui = { class: "space-y-2" }, ci = ["src"], di = {
|
|
4008
4017
|
key: 1,
|
|
4009
4018
|
class: "w-5 h-5 text-gray-500 dark:text-gray-400",
|
|
4010
4019
|
fill: "none",
|
|
@@ -4029,24 +4038,24 @@ const No = /* @__PURE__ */ he({
|
|
|
4029
4038
|
setup(n) {
|
|
4030
4039
|
return (e, t) => {
|
|
4031
4040
|
var s;
|
|
4032
|
-
return
|
|
4033
|
-
class:
|
|
4041
|
+
return k(), T("div", {
|
|
4042
|
+
class: v(["border border-gray-200 dark:border-gray-700 rounded-2xl p-3 bg-gray-50 dark:bg-gray-800 space-y-3", n.ui.attachmentsContainer])
|
|
4034
4043
|
}, [
|
|
4035
4044
|
h("p", li, P(((s = n.texts) == null ? void 0 : s.attachedFiles) || "Attached files"), 1),
|
|
4036
4045
|
h("ul", ui, [
|
|
4037
|
-
(
|
|
4046
|
+
(k(!0), T(be, null, Fe(n.attachments, (r) => (k(), T("li", {
|
|
4038
4047
|
key: r.id,
|
|
4039
|
-
class:
|
|
4048
|
+
class: v(["flex items-center gap-3 rounded-xl bg-white dark:bg-gray-700 p-2 shadow-sm border border-gray-100 dark:border-gray-600", n.ui.attachmentItem])
|
|
4040
4049
|
}, [
|
|
4041
4050
|
h("div", {
|
|
4042
|
-
class:
|
|
4051
|
+
class: v(["h-10 w-10 flex items-center justify-center rounded-lg bg-gray-100 dark:bg-gray-600 overflow-hidden", n.ui.attachmentThumbnail])
|
|
4043
4052
|
}, [
|
|
4044
|
-
n.isImage(r) ? (
|
|
4053
|
+
n.isImage(r) ? (k(), T("img", {
|
|
4045
4054
|
key: 0,
|
|
4046
4055
|
src: r.previewUrl || r.url,
|
|
4047
4056
|
class: "object-cover h-full w-full",
|
|
4048
4057
|
alt: ""
|
|
4049
|
-
}, null, 8, ci)) : (
|
|
4058
|
+
}, null, 8, ci)) : (k(), T("svg", di, [...t[0] || (t[0] = [
|
|
4050
4059
|
h("path", {
|
|
4051
4060
|
"stroke-linecap": "round",
|
|
4052
4061
|
"stroke-linejoin": "round",
|
|
@@ -4058,17 +4067,17 @@ const No = /* @__PURE__ */ he({
|
|
|
4058
4067
|
h("div", hi, [
|
|
4059
4068
|
h("p", fi, P(r.name), 1),
|
|
4060
4069
|
h("p", pi, P(n.formatFileSize(r.size)), 1),
|
|
4061
|
-
r.uploading ? (
|
|
4070
|
+
r.uploading ? (k(), T("div", gi, [
|
|
4062
4071
|
h("div", {
|
|
4063
4072
|
class: "h-full bg-primary transition-all",
|
|
4064
4073
|
style: cn({ width: `${r.progress ?? 10}%` })
|
|
4065
4074
|
}, null, 4)
|
|
4066
4075
|
])) : F("", !0)
|
|
4067
4076
|
]),
|
|
4068
|
-
r.uploading ? (
|
|
4077
|
+
r.uploading ? (k(), T("span", mi, P(Math.round(r.progress ?? 0)) + "% ", 1)) : F("", !0),
|
|
4069
4078
|
h("button", {
|
|
4070
4079
|
type: "button",
|
|
4071
|
-
class:
|
|
4080
|
+
class: v(["p-1 rounded-full hover:bg-gray-100 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed", n.ui.attachmentRemove]),
|
|
4072
4081
|
disabled: r.uploading,
|
|
4073
4082
|
onClick: (o) => e.$emit("remove", r.id)
|
|
4074
4083
|
}, [...t[1] || (t[1] = [
|
|
@@ -4100,8 +4109,8 @@ const No = /* @__PURE__ */ he({
|
|
|
4100
4109
|
},
|
|
4101
4110
|
emits: ["select", "hover"],
|
|
4102
4111
|
setup(n, { expose: e }) {
|
|
4103
|
-
const t =
|
|
4104
|
-
return e({ dropdownRef: t }), (s, r) => (
|
|
4112
|
+
const t = U(null);
|
|
4113
|
+
return e({ dropdownRef: t }), (s, r) => (k(), Ee(bt, {
|
|
4105
4114
|
"enter-active-class": "transition ease-out duration-100",
|
|
4106
4115
|
"enter-from-class": "transform opacity-0 scale-95",
|
|
4107
4116
|
"enter-to-class": "transform opacity-100 scale-100",
|
|
@@ -4113,12 +4122,12 @@ const No = /* @__PURE__ */ he({
|
|
|
4113
4122
|
h("div", {
|
|
4114
4123
|
ref_key: "dropdownRef",
|
|
4115
4124
|
ref: t,
|
|
4116
|
-
class:
|
|
4125
|
+
class: v(["absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-lg max-h-80 overflow-y-auto z-10", n.ui.suggestionsDropdown])
|
|
4117
4126
|
}, [
|
|
4118
4127
|
h("ul", ki, [
|
|
4119
|
-
(
|
|
4128
|
+
(k(!0), T(be, null, Fe(n.suggestions, (o, i) => (k(), T("li", {
|
|
4120
4129
|
key: o.id,
|
|
4121
|
-
class:
|
|
4130
|
+
class: v(["px-4 py-3 cursor-pointer transition-colors border-b border-gray-100 dark:border-gray-700 last:border-b-0", [
|
|
4122
4131
|
n.ui.suggestionItem,
|
|
4123
4132
|
{
|
|
4124
4133
|
[n.ui.suggestionItemSelected || "bg-primary/10"]: i === n.selectedIndex,
|
|
@@ -4167,11 +4176,11 @@ const No = /* @__PURE__ */ he({
|
|
|
4167
4176
|
const e = n, t = N(() => e.sending ? [e.ui.stopButton || "bg-red-500 text-white hover:bg-red-600"] : e.canSend ? [e.ui.sendButtonActive || "bg-primary-500 text-white hover:bg-primary-600"] : [e.ui.sendButtonDisabled || "bg-gray-200 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed opacity-60"]);
|
|
4168
4177
|
return (s, r) => {
|
|
4169
4178
|
var o, i, a;
|
|
4170
|
-
return
|
|
4171
|
-
n.showSupportModeToggle && !n.supportRequestMode ? (
|
|
4179
|
+
return k(), T("div", Ci, [
|
|
4180
|
+
n.showSupportModeToggle && !n.supportRequestMode ? (k(), T("button", {
|
|
4172
4181
|
key: 0,
|
|
4173
4182
|
type: "button",
|
|
4174
|
-
class:
|
|
4183
|
+
class: v(["h-9 w-9 rounded-xl flex items-center justify-center text-gray-400 hover:text-primary hover:bg-gray-100 dark:hover:bg-gray-700 transition flex-shrink-0", n.ui.supportToggle]),
|
|
4175
4184
|
title: ((o = n.texts) == null ? void 0 : o.toggleSupportMode) || "Toggle support mode",
|
|
4176
4185
|
onClick: r[0] || (r[0] = (u) => s.$emit("toggle-support-mode"))
|
|
4177
4186
|
}, [...r[3] || (r[3] = [
|
|
@@ -4189,10 +4198,10 @@ const No = /* @__PURE__ */ he({
|
|
|
4189
4198
|
})
|
|
4190
4199
|
], -1)
|
|
4191
4200
|
])], 10, Ei)) : F("", !0),
|
|
4192
|
-
n.showSupportModeToggle && n.supportRequestMode ? (
|
|
4201
|
+
n.showSupportModeToggle && n.supportRequestMode ? (k(), T("button", {
|
|
4193
4202
|
key: 1,
|
|
4194
4203
|
type: "button",
|
|
4195
|
-
class:
|
|
4204
|
+
class: v(["h-7 px-2 rounded-lg flex items-center gap-1 text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 hover:bg-amber-200 dark:hover:bg-amber-900/50 transition flex-shrink-0", n.ui.supportBadge]),
|
|
4196
4205
|
title: ((i = n.texts) == null ? void 0 : i.exitSupportMode) || "Exit support mode",
|
|
4197
4206
|
onClick: r[1] || (r[1] = (u) => s.$emit("toggle-support-mode"))
|
|
4198
4207
|
}, [
|
|
@@ -4226,17 +4235,17 @@ const No = /* @__PURE__ */ he({
|
|
|
4226
4235
|
], 10, Mi)) : F("", !0),
|
|
4227
4236
|
h("button", {
|
|
4228
4237
|
disabled: !n.canSend && !n.sending,
|
|
4229
|
-
class:
|
|
4238
|
+
class: v(["h-9 w-9 rounded-xl flex items-center justify-center transition-all duration-200 flex-shrink-0", t.value]),
|
|
4230
4239
|
type: "button",
|
|
4231
4240
|
onClick: r[2] || (r[2] = tt((u) => s.$emit("click"), ["prevent"]))
|
|
4232
4241
|
}, [
|
|
4233
|
-
n.sending ? (
|
|
4242
|
+
n.sending ? (k(), T("svg", Ii, [...r[7] || (r[7] = [
|
|
4234
4243
|
h("path", {
|
|
4235
4244
|
"fill-rule": "evenodd",
|
|
4236
4245
|
d: "M4.5 7.5a3 3 0 013-3h9a3 3 0 013 3v9a3 3 0 01-3 3h-9a3 3 0 01-3-3v-9z",
|
|
4237
4246
|
"clip-rule": "evenodd"
|
|
4238
4247
|
}, null, -1)
|
|
4239
|
-
])])) : (
|
|
4248
|
+
])])) : (k(), T("svg", Li, [...r[6] || (r[6] = [
|
|
4240
4249
|
h("path", {
|
|
4241
4250
|
"stroke-linecap": "round",
|
|
4242
4251
|
"stroke-linejoin": "round",
|
|
@@ -4270,71 +4279,71 @@ const No = /* @__PURE__ */ he({
|
|
|
4270
4279
|
},
|
|
4271
4280
|
emits: ["update:modelValue", "submit", "cancel", "suggestion-select", "toggle-support-mode", "context-link-click"],
|
|
4272
4281
|
setup(n, { expose: e, emit: t }) {
|
|
4273
|
-
const s = n, r = N(() => s.ui || {}), o = t, i =
|
|
4282
|
+
const s = n, r = N(() => s.ui || {}), o = t, i = U(s.modelValue), a = U(null), u = U(null), d = U(!1), c = Io(), y = $o(
|
|
4274
4283
|
() => i.value,
|
|
4275
4284
|
(R) => {
|
|
4276
4285
|
i.value = R;
|
|
4277
4286
|
},
|
|
4278
4287
|
() => a.value
|
|
4279
|
-
),
|
|
4288
|
+
), x = Do(
|
|
4280
4289
|
() => s.suggestions,
|
|
4281
4290
|
() => s.hasHistory,
|
|
4282
4291
|
() => d.value,
|
|
4283
4292
|
() => i.value,
|
|
4284
4293
|
(R) => {
|
|
4285
4294
|
o("suggestion-select", R), Pe(() => {
|
|
4286
|
-
var
|
|
4287
|
-
return (
|
|
4295
|
+
var E;
|
|
4296
|
+
return (E = a.value) == null ? void 0 : E.focus();
|
|
4288
4297
|
});
|
|
4289
4298
|
}
|
|
4290
|
-
), { adjustTextareaHeight: f } = Oo(() => a.value), p = N(() => s.supportRequestMode ? s.supportPlaceholder : s.placeholder),
|
|
4291
|
-
var
|
|
4292
|
-
return (((
|
|
4293
|
-
}),
|
|
4294
|
-
() => !s.disabled && !s.sending &&
|
|
4299
|
+
), { adjustTextareaHeight: f } = Oo(() => a.value), p = N(() => s.supportRequestMode ? s.supportPlaceholder : s.placeholder), D = N(() => s.showSupportModeToggle ? s.supportRequestMode ? { paddingLeft: "3rem", paddingRight: "8rem" } : { paddingLeft: "3rem", paddingRight: "6rem" } : { paddingLeft: "3rem", paddingRight: "3.5rem" }), g = N(() => {
|
|
4300
|
+
var E;
|
|
4301
|
+
return (((E = i.value) == null ? void 0 : E.trim()) ?? "").length >= s.minLength ? !0 : c.hasAttachments.value;
|
|
4302
|
+
}), m = N(
|
|
4303
|
+
() => !s.disabled && !s.sending && g.value && !c.isUploading.value
|
|
4295
4304
|
);
|
|
4296
4305
|
_e(() => s.modelValue, (R) => {
|
|
4297
4306
|
i.value = R, Pe(f);
|
|
4298
4307
|
}), _e(i, (R) => {
|
|
4299
|
-
o("update:modelValue", R), Pe(f),
|
|
4308
|
+
o("update:modelValue", R), Pe(f), y.checkForMentions(R), x.updateSuggestionsVisibility();
|
|
4300
4309
|
}), _e(() => s.suggestions, () => {
|
|
4301
|
-
|
|
4310
|
+
x.updateSuggestionsVisibility();
|
|
4302
4311
|
});
|
|
4303
|
-
function
|
|
4312
|
+
function C() {
|
|
4304
4313
|
f();
|
|
4305
4314
|
}
|
|
4306
|
-
function
|
|
4307
|
-
if (!
|
|
4315
|
+
function S(R) {
|
|
4316
|
+
if (!y.handleMentionKeyDown(R) && !x.handleSuggestionKeyDown(R) && R.key === "Enter") {
|
|
4308
4317
|
if (R.shiftKey) return;
|
|
4309
|
-
!s.sending &&
|
|
4318
|
+
!s.sending && m.value && (R.preventDefault(), b());
|
|
4310
4319
|
}
|
|
4311
4320
|
}
|
|
4312
|
-
function
|
|
4313
|
-
if (!
|
|
4314
|
-
const R = c.buildPayload(),
|
|
4321
|
+
function b() {
|
|
4322
|
+
if (!m.value) return;
|
|
4323
|
+
const R = c.buildPayload(), E = i.value.trim(), Y = y.getMentions();
|
|
4315
4324
|
o("submit", {
|
|
4316
|
-
message:
|
|
4325
|
+
message: E,
|
|
4317
4326
|
attachments: R,
|
|
4318
|
-
mentions:
|
|
4327
|
+
mentions: Y,
|
|
4319
4328
|
isSupportRequest: s.supportRequestMode
|
|
4320
|
-
}), i.value = "", c.clearAttachments(),
|
|
4329
|
+
}), i.value = "", c.clearAttachments(), y.clearMentions(), Pe(f);
|
|
4321
4330
|
}
|
|
4322
4331
|
function z() {
|
|
4323
|
-
s.sending ? o("cancel") :
|
|
4332
|
+
s.sending ? o("cancel") : m.value && b();
|
|
4324
4333
|
}
|
|
4325
|
-
function
|
|
4334
|
+
function q() {
|
|
4326
4335
|
var R;
|
|
4327
4336
|
s.disabled || s.sending || c.canAddMore.value && ((R = u.value) == null || R.click());
|
|
4328
4337
|
}
|
|
4329
|
-
function
|
|
4330
|
-
|
|
4338
|
+
function G(R) {
|
|
4339
|
+
x.handleSuggestionClick(R);
|
|
4331
4340
|
}
|
|
4332
|
-
function
|
|
4333
|
-
d.value = !0,
|
|
4341
|
+
function A() {
|
|
4342
|
+
d.value = !0, x.updateSuggestionsVisibility();
|
|
4334
4343
|
}
|
|
4335
4344
|
function _() {
|
|
4336
4345
|
d.value = !1, setTimeout(() => {
|
|
4337
|
-
|
|
4346
|
+
x.hideSuggestions(), y.showMentions.value = !1;
|
|
4338
4347
|
}, 200);
|
|
4339
4348
|
}
|
|
4340
4349
|
return e({
|
|
@@ -4342,36 +4351,36 @@ const No = /* @__PURE__ */ he({
|
|
|
4342
4351
|
var R;
|
|
4343
4352
|
return (R = a.value) == null ? void 0 : R.focus();
|
|
4344
4353
|
}
|
|
4345
|
-
}),
|
|
4354
|
+
}), Tt(() => {
|
|
4346
4355
|
Pe(f);
|
|
4347
|
-
}), (R,
|
|
4348
|
-
var
|
|
4349
|
-
return
|
|
4350
|
-
class:
|
|
4351
|
-
onDragenter:
|
|
4356
|
+
}), (R, E) => {
|
|
4357
|
+
var Y;
|
|
4358
|
+
return k(), T("div", {
|
|
4359
|
+
class: v(["px-4 pb-4 bg-white dark:bg-gray-900 sticky bottom-0", r.value.root]),
|
|
4360
|
+
onDragenter: E[6] || (E[6] = tt(
|
|
4352
4361
|
//@ts-ignore
|
|
4353
|
-
(...
|
|
4362
|
+
(...M) => $(c).handleDragEnter && $(c).handleDragEnter(...M),
|
|
4354
4363
|
["prevent"]
|
|
4355
4364
|
)),
|
|
4356
|
-
onDragover:
|
|
4365
|
+
onDragover: E[7] || (E[7] = tt(
|
|
4357
4366
|
//@ts-ignore
|
|
4358
|
-
(...
|
|
4367
|
+
(...M) => $(c).handleDragOver && $(c).handleDragOver(...M),
|
|
4359
4368
|
["prevent"]
|
|
4360
4369
|
)),
|
|
4361
|
-
onDragleave:
|
|
4370
|
+
onDragleave: E[8] || (E[8] = tt(
|
|
4362
4371
|
//@ts-ignore
|
|
4363
|
-
(...
|
|
4372
|
+
(...M) => $(c).handleDragLeave && $(c).handleDragLeave(...M),
|
|
4364
4373
|
["prevent"]
|
|
4365
4374
|
)),
|
|
4366
|
-
onDrop:
|
|
4375
|
+
onDrop: E[9] || (E[9] = tt(
|
|
4367
4376
|
//@ts-ignore
|
|
4368
|
-
(...
|
|
4377
|
+
(...M) => $(c).handleDrop && $(c).handleDrop(...M),
|
|
4369
4378
|
["prevent"]
|
|
4370
4379
|
))
|
|
4371
4380
|
}, [
|
|
4372
4381
|
h("form", {
|
|
4373
|
-
class:
|
|
4374
|
-
onSubmit: tt(
|
|
4382
|
+
class: v(r.value.form),
|
|
4383
|
+
onSubmit: tt(b, ["prevent"])
|
|
4375
4384
|
}, [
|
|
4376
4385
|
h("div", Di, [
|
|
4377
4386
|
h("input", {
|
|
@@ -4380,32 +4389,32 @@ const No = /* @__PURE__ */ he({
|
|
|
4380
4389
|
type: "file",
|
|
4381
4390
|
class: "hidden",
|
|
4382
4391
|
multiple: "",
|
|
4383
|
-
accept:
|
|
4384
|
-
onChange:
|
|
4385
|
-
(...
|
|
4392
|
+
accept: $(c).acceptedFileTypes,
|
|
4393
|
+
onChange: E[0] || (E[0] = //@ts-ignore
|
|
4394
|
+
(...M) => $(c).handleFileSelect && $(c).handleFileSelect(...M))
|
|
4386
4395
|
}, null, 40, Oi),
|
|
4387
|
-
|
|
4396
|
+
$(c).hasAttachments.value ? (k(), Ee(xi, {
|
|
4388
4397
|
key: 0,
|
|
4389
|
-
attachments:
|
|
4398
|
+
attachments: $(c).attachments.value,
|
|
4390
4399
|
ui: r.value,
|
|
4391
4400
|
texts: n.texts,
|
|
4392
|
-
"is-image":
|
|
4393
|
-
"format-file-size":
|
|
4394
|
-
onRemove:
|
|
4401
|
+
"is-image": $(c).isImage,
|
|
4402
|
+
"format-file-size": $(c).formatFileSize,
|
|
4403
|
+
onRemove: $(c).removeAttachment
|
|
4395
4404
|
}, null, 8, ["attachments", "ui", "texts", "is-image", "format-file-size", "onRemove"])) : F("", !0),
|
|
4396
4405
|
h("div", {
|
|
4397
|
-
class:
|
|
4406
|
+
class: v(["relative", r.value.inputContainer])
|
|
4398
4407
|
}, [
|
|
4399
|
-
|
|
4408
|
+
$(x).showSuggestions.value && n.suggestions.length > 0 ? (k(), Ee(Ai, {
|
|
4400
4409
|
key: 0,
|
|
4401
4410
|
ref: "suggestionsHandler.dropdownRef.value",
|
|
4402
4411
|
suggestions: n.suggestions,
|
|
4403
|
-
"selected-index":
|
|
4412
|
+
"selected-index": $(x).selectedSuggestionIndex.value,
|
|
4404
4413
|
ui: r.value,
|
|
4405
|
-
onSelect:
|
|
4406
|
-
onHover:
|
|
4414
|
+
onSelect: G,
|
|
4415
|
+
onHover: E[1] || (E[1] = (M) => $(x).selectedSuggestionIndex.value = M)
|
|
4407
4416
|
}, null, 8, ["suggestions", "selected-index", "ui"])) : F("", !0),
|
|
4408
|
-
ye(
|
|
4417
|
+
ye(bt, {
|
|
4409
4418
|
"enter-active-class": "transition ease-out duration-100",
|
|
4410
4419
|
"enter-from-class": "transform opacity-0 scale-95",
|
|
4411
4420
|
"enter-to-class": "transform opacity-100 scale-100",
|
|
@@ -4414,32 +4423,32 @@ const No = /* @__PURE__ */ he({
|
|
|
4414
4423
|
"leave-to-class": "transform opacity-0 scale-95"
|
|
4415
4424
|
}, {
|
|
4416
4425
|
default: Ae(() => [
|
|
4417
|
-
|
|
4426
|
+
$(y).showMentions.value && $(y).mentionItems.value.length > 0 ? (k(), Ee(_o, {
|
|
4418
4427
|
key: 0,
|
|
4419
|
-
items:
|
|
4420
|
-
"selected-index":
|
|
4421
|
-
providers:
|
|
4422
|
-
onSelect:
|
|
4423
|
-
"onUpdate:selectedIndex":
|
|
4428
|
+
items: $(y).mentionItems.value,
|
|
4429
|
+
"selected-index": $(y).selectedMentionIndex.value,
|
|
4430
|
+
providers: $(y).mentionProviders.value,
|
|
4431
|
+
onSelect: $(y).handleMentionSelect,
|
|
4432
|
+
"onUpdate:selectedIndex": E[2] || (E[2] = (M) => $(y).selectedMentionIndex.value = M)
|
|
4424
4433
|
}, null, 8, ["items", "selected-index", "providers", "onSelect"])) : F("", !0)
|
|
4425
4434
|
]),
|
|
4426
4435
|
_: 1
|
|
4427
4436
|
}),
|
|
4428
4437
|
h("div", {
|
|
4429
|
-
class:
|
|
4438
|
+
class: v(["rounded-2xl border shadow-lg transition-all duration-200 bg-white dark:bg-gray-800", [
|
|
4430
4439
|
r.value.inputWrapper,
|
|
4431
4440
|
{
|
|
4432
|
-
"border-primary shadow-primary/30": d.value ||
|
|
4433
|
-
"border-gray-200 dark:border-gray-700 shadow-gray-100 dark:shadow-gray-900": !d.value &&
|
|
4441
|
+
"border-primary shadow-primary/30": d.value || $(c).isDraggingFiles.value,
|
|
4442
|
+
"border-gray-200 dark:border-gray-700 shadow-gray-100 dark:shadow-gray-900": !d.value && !$(c).isDraggingFiles.value
|
|
4434
4443
|
}
|
|
4435
4444
|
]])
|
|
4436
4445
|
}, [
|
|
4437
4446
|
h("button", {
|
|
4438
4447
|
type: "button",
|
|
4439
|
-
class:
|
|
4440
|
-
title: ((
|
|
4441
|
-
onClick:
|
|
4442
|
-
}, [...
|
|
4448
|
+
class: v(["absolute left-3 top-1/2 -translate-y-1/2 h-9 w-9 rounded-xl flex items-center justify-center text-gray-500 dark:text-gray-400 hover:text-primary transition z-10", r.value.attachButton]),
|
|
4449
|
+
title: ((Y = n.texts) == null ? void 0 : Y.attachFiles) || "Attach files",
|
|
4450
|
+
onClick: q
|
|
4451
|
+
}, [...E[10] || (E[10] = [
|
|
4443
4452
|
h("svg", {
|
|
4444
4453
|
class: "w-5 h-5",
|
|
4445
4454
|
fill: "none",
|
|
@@ -4458,16 +4467,16 @@ const No = /* @__PURE__ */ he({
|
|
|
4458
4467
|
qs(h("textarea", {
|
|
4459
4468
|
ref_key: "textareaRef",
|
|
4460
4469
|
ref: a,
|
|
4461
|
-
"onUpdate:modelValue":
|
|
4470
|
+
"onUpdate:modelValue": E[3] || (E[3] = (M) => i.value = M),
|
|
4462
4471
|
rows: "1",
|
|
4463
4472
|
"data-ai-input": "",
|
|
4464
4473
|
placeholder: p.value,
|
|
4465
4474
|
disabled: n.disabled,
|
|
4466
|
-
class:
|
|
4467
|
-
style: cn(
|
|
4468
|
-
onInput:
|
|
4469
|
-
onKeydown:
|
|
4470
|
-
onFocus:
|
|
4475
|
+
class: v(["block w-full bg-transparent py-3 text-sm leading-5 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 dark:placeholder:text-gray-500 border-0 focus:outline-none focus-visible:outline-none resize-none", r.value.textarea]),
|
|
4476
|
+
style: cn(D.value),
|
|
4477
|
+
onInput: C,
|
|
4478
|
+
onKeydown: S,
|
|
4479
|
+
onFocus: A,
|
|
4471
4480
|
onBlur: _
|
|
4472
4481
|
}, null, 46, _i), [
|
|
4473
4482
|
[js, i.value]
|
|
@@ -4475,22 +4484,22 @@ const No = /* @__PURE__ */ he({
|
|
|
4475
4484
|
]),
|
|
4476
4485
|
ye($i, {
|
|
4477
4486
|
sending: n.sending,
|
|
4478
|
-
"can-send":
|
|
4487
|
+
"can-send": m.value,
|
|
4479
4488
|
"support-request-mode": n.supportRequestMode,
|
|
4480
4489
|
"show-support-mode-toggle": n.showSupportModeToggle,
|
|
4481
4490
|
ui: r.value,
|
|
4482
4491
|
texts: n.texts,
|
|
4483
|
-
onToggleSupportMode:
|
|
4492
|
+
onToggleSupportMode: E[4] || (E[4] = (M) => R.$emit("toggle-support-mode")),
|
|
4484
4493
|
onClick: z
|
|
4485
4494
|
}, null, 8, ["sending", "can-send", "support-request-mode", "show-support-mode-toggle", "ui", "texts"])
|
|
4486
4495
|
], 2)
|
|
4487
4496
|
], 2),
|
|
4488
4497
|
ce(R.$slots, "context-link", {}, () => [
|
|
4489
|
-
n.contextLinkText ? (
|
|
4498
|
+
n.contextLinkText ? (k(), T("div", zi, [
|
|
4490
4499
|
h("button", {
|
|
4491
4500
|
type: "button",
|
|
4492
|
-
class:
|
|
4493
|
-
onClick:
|
|
4501
|
+
class: v(["text-xs text-gray-400 hover:text-primary transition-colors", r.value.contextLink]),
|
|
4502
|
+
onClick: E[5] || (E[5] = (M) => R.$emit("context-link-click"))
|
|
4494
4503
|
}, P(n.contextLinkText), 3)
|
|
4495
4504
|
])) : F("", !0)
|
|
4496
4505
|
])
|
|
@@ -4507,26 +4516,26 @@ const No = /* @__PURE__ */ he({
|
|
|
4507
4516
|
},
|
|
4508
4517
|
emits: ["item-click"],
|
|
4509
4518
|
setup(n, { emit: e }) {
|
|
4510
|
-
const t = n, s = e, r = (
|
|
4519
|
+
const t = n, s = e, r = (x) => {
|
|
4511
4520
|
var p;
|
|
4512
|
-
return (p = t.texts) != null && p[
|
|
4521
|
+
return (p = t.texts) != null && p[x] ? t.texts[x] : de({
|
|
4513
4522
|
aiName: "aiName",
|
|
4514
4523
|
title: "emptyStateTitle",
|
|
4515
4524
|
description: "emptyStateDescription"
|
|
4516
|
-
}[
|
|
4525
|
+
}[x]);
|
|
4517
4526
|
}, o = N(() => t.ui || {}), { suggestions: i, resolvePrompt: a } = Rs();
|
|
4518
|
-
function u(
|
|
4527
|
+
function u(x) {
|
|
4519
4528
|
const f = {
|
|
4520
|
-
...
|
|
4521
|
-
prompt: a(
|
|
4529
|
+
...x,
|
|
4530
|
+
prompt: a(x)
|
|
4522
4531
|
};
|
|
4523
4532
|
s("item-click", f);
|
|
4524
4533
|
}
|
|
4525
|
-
function d(
|
|
4526
|
-
return
|
|
4534
|
+
function d(x) {
|
|
4535
|
+
return x.gradientClass ? x.gradientClass : x.className ? x.className : "bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900";
|
|
4527
4536
|
}
|
|
4528
|
-
function c(
|
|
4529
|
-
const f =
|
|
4537
|
+
function c(x) {
|
|
4538
|
+
const f = x.category || "default", p = {
|
|
4530
4539
|
hr: "bg-blue-100 dark:bg-blue-900/30",
|
|
4531
4540
|
finance: "bg-green-100 dark:bg-green-900/30",
|
|
4532
4541
|
analytics: "bg-purple-100 dark:bg-purple-900/30",
|
|
@@ -4535,8 +4544,8 @@ const No = /* @__PURE__ */ he({
|
|
|
4535
4544
|
};
|
|
4536
4545
|
return p[f] || p.default;
|
|
4537
4546
|
}
|
|
4538
|
-
function
|
|
4539
|
-
const f =
|
|
4547
|
+
function y(x) {
|
|
4548
|
+
const f = x.category || "default", p = {
|
|
4540
4549
|
hr: "text-blue-600 dark:text-blue-400",
|
|
4541
4550
|
finance: "text-green-600 dark:text-green-400",
|
|
4542
4551
|
analytics: "text-purple-600 dark:text-purple-400",
|
|
@@ -4545,17 +4554,17 @@ const No = /* @__PURE__ */ he({
|
|
|
4545
4554
|
};
|
|
4546
4555
|
return p[f] || p.default;
|
|
4547
4556
|
}
|
|
4548
|
-
return (
|
|
4549
|
-
class:
|
|
4557
|
+
return (x, f) => (k(), T("div", {
|
|
4558
|
+
class: v(["flex items-center justify-center p-4 h-full", o.value.root])
|
|
4550
4559
|
}, [
|
|
4551
4560
|
h("div", {
|
|
4552
|
-
class:
|
|
4561
|
+
class: v(["w-full max-w-4xl", o.value.content])
|
|
4553
4562
|
}, [
|
|
4554
4563
|
h("div", {
|
|
4555
|
-
class:
|
|
4564
|
+
class: v(["mb-8 text-center", o.value.header])
|
|
4556
4565
|
}, [
|
|
4557
4566
|
h("div", {
|
|
4558
|
-
class:
|
|
4567
|
+
class: v(["mb-3 inline-flex items-center gap-2 rounded-full bg-primary/10 px-4 py-2 text-sm font-medium text-primary", o.value.badge])
|
|
4559
4568
|
}, [
|
|
4560
4569
|
f[0] || (f[0] = h("svg", {
|
|
4561
4570
|
class: "w-4 h-4",
|
|
@@ -4573,29 +4582,29 @@ const No = /* @__PURE__ */ he({
|
|
|
4573
4582
|
h("span", null, P(r("aiName")), 1)
|
|
4574
4583
|
], 2),
|
|
4575
4584
|
h("h1", {
|
|
4576
|
-
class:
|
|
4585
|
+
class: v(["mb-3 text-4xl font-bold tracking-tight text-gray-900 dark:text-white", o.value.title])
|
|
4577
4586
|
}, P(r("title")), 3),
|
|
4578
4587
|
h("p", {
|
|
4579
|
-
class:
|
|
4588
|
+
class: v(["text-gray-600 dark:text-gray-400", o.value.description])
|
|
4580
4589
|
}, P(r("description")), 3)
|
|
4581
4590
|
], 2),
|
|
4582
4591
|
h("div", {
|
|
4583
|
-
class:
|
|
4592
|
+
class: v(["mb-8 grid gap-3 sm:grid-cols-2 lg:grid-cols-3", o.value.grid])
|
|
4584
4593
|
}, [
|
|
4585
|
-
(
|
|
4586
|
-
key: p.id ||
|
|
4587
|
-
class:
|
|
4588
|
-
onClick: (
|
|
4594
|
+
(k(!0), T(be, null, Fe($(i), (p, D) => (k(), T("button", {
|
|
4595
|
+
key: p.id || D,
|
|
4596
|
+
class: v(["group relative overflow-hidden rounded-xl border border-gray-300 dark:border-gray-600 p-4 text-left transition-all hover:shadow-md hover:scale-[1.02]", [o.value.suggestionCard, d(p)]]),
|
|
4597
|
+
onClick: (g) => u(p)
|
|
4589
4598
|
}, [
|
|
4590
4599
|
h("div", {
|
|
4591
|
-
class:
|
|
4600
|
+
class: v(["mb-2 inline-flex h-10 w-10 items-center justify-center rounded-lg", [o.value.suggestionIconContainer, c(p)]])
|
|
4592
4601
|
}, [
|
|
4593
|
-
p.icon ? (
|
|
4602
|
+
p.icon ? (k(), Ee(nn(p.icon), {
|
|
4594
4603
|
key: 0,
|
|
4595
|
-
class:
|
|
4596
|
-
}, null, 8, ["class"])) : (
|
|
4604
|
+
class: v(["h-5 w-5", [o.value.suggestionIcon, y(p)]])
|
|
4605
|
+
}, null, 8, ["class"])) : (k(), T("svg", {
|
|
4597
4606
|
key: 1,
|
|
4598
|
-
class:
|
|
4607
|
+
class: v(["h-5 w-5", [o.value.suggestionIcon, y(p)]]),
|
|
4599
4608
|
fill: "none",
|
|
4600
4609
|
viewBox: "0 0 24 24",
|
|
4601
4610
|
stroke: "currentColor",
|
|
@@ -4609,10 +4618,10 @@ const No = /* @__PURE__ */ he({
|
|
|
4609
4618
|
])], 2))
|
|
4610
4619
|
], 2),
|
|
4611
4620
|
h("h3", {
|
|
4612
|
-
class:
|
|
4621
|
+
class: v(["mb-1 text-sm font-semibold text-gray-900 dark:text-white", o.value.suggestionTitle])
|
|
4613
4622
|
}, P(p.title), 3),
|
|
4614
4623
|
h("p", {
|
|
4615
|
-
class:
|
|
4624
|
+
class: v(["text-xs text-gray-600 dark:text-gray-400", o.value.suggestionDescription])
|
|
4616
4625
|
}, P(p.description), 3)
|
|
4617
4626
|
], 10, Bi))), 128))
|
|
4618
4627
|
], 2)
|
|
@@ -4676,19 +4685,19 @@ const No = /* @__PURE__ */ he({
|
|
|
4676
4685
|
return r >= 1 ? "text-red-500 dark:text-red-400" : r >= 0.8 ? "text-amber-500 dark:text-amber-400" : "text-gray-400 dark:text-gray-500";
|
|
4677
4686
|
});
|
|
4678
4687
|
return (r, o) => {
|
|
4679
|
-
var i, a, u, d, c,
|
|
4680
|
-
return
|
|
4681
|
-
class:
|
|
4688
|
+
var i, a, u, d, c, y, x;
|
|
4689
|
+
return k(), T("div", {
|
|
4690
|
+
class: v(["flex items-center justify-between px-4 sm:px-6 pt-4 border-b border-gray-200 dark:border-gray-700 pb-4", (i = n.ui) == null ? void 0 : i.header])
|
|
4682
4691
|
}, [
|
|
4683
4692
|
h("div", Ui, [
|
|
4684
|
-
n.isSetupMode ? (
|
|
4693
|
+
n.isSetupMode ? (k(), T("div", ji, [...o[5] || (o[5] = [
|
|
4685
4694
|
h("span", { class: "flex h-2 w-2 rounded-full bg-amber-500 animate-pulse" }, null, -1),
|
|
4686
4695
|
h("span", { class: "text-sm font-medium text-gray-700 dark:text-gray-300" }, "Setup Required", -1)
|
|
4687
|
-
])])) : (
|
|
4688
|
-
n.showNewChatButton && n.hasHistory ? (
|
|
4696
|
+
])])) : (k(), T(be, { key: 0 }, [
|
|
4697
|
+
n.showNewChatButton && n.hasHistory ? (k(), T("button", {
|
|
4689
4698
|
key: 0,
|
|
4690
4699
|
type: "button",
|
|
4691
|
-
class:
|
|
4700
|
+
class: v(["inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-400 transition-all duration-200 shadow-sm", (a = n.ui) == null ? void 0 : a.newChatButton]),
|
|
4692
4701
|
onClick: o[0] || (o[0] = (f) => r.$emit("new-chat"))
|
|
4693
4702
|
}, [
|
|
4694
4703
|
o[4] || (o[4] = h("svg", {
|
|
@@ -4705,16 +4714,16 @@ const No = /* @__PURE__ */ he({
|
|
|
4705
4714
|
})
|
|
4706
4715
|
], -1)),
|
|
4707
4716
|
h("span", null, P(n.t("newChat")), 1)
|
|
4708
|
-
], 2)) : (
|
|
4717
|
+
], 2)) : (k(), T("span", qi, P(n.t("keyboardShortcutHint")), 1))
|
|
4709
4718
|
], 64))
|
|
4710
4719
|
]),
|
|
4711
|
-
!n.isSetupMode && (n.showMessageCount || n.showQuota) ? (
|
|
4712
|
-
n.showMessageCount && n.hasHistory ? (
|
|
4720
|
+
!n.isSetupMode && (n.showMessageCount || n.showQuota) ? (k(), T("div", Wi, [
|
|
4721
|
+
n.showMessageCount && n.hasHistory ? (k(), T("div", {
|
|
4713
4722
|
key: 0,
|
|
4714
|
-
class:
|
|
4723
|
+
class: v(["flex items-center gap-1.5 px-2 py-1 rounded-md bg-gray-100 dark:bg-gray-800", (u = n.ui) == null ? void 0 : u.messageCountBadge])
|
|
4715
4724
|
}, [
|
|
4716
|
-
(
|
|
4717
|
-
class:
|
|
4725
|
+
(k(), T("svg", {
|
|
4726
|
+
class: v(["w-3.5 h-3.5", s.value]),
|
|
4718
4727
|
fill: "none",
|
|
4719
4728
|
viewBox: "0 0 24 24",
|
|
4720
4729
|
stroke: "currentColor",
|
|
@@ -4727,7 +4736,7 @@ const No = /* @__PURE__ */ he({
|
|
|
4727
4736
|
}, null, -1)
|
|
4728
4737
|
])], 2)),
|
|
4729
4738
|
h("span", {
|
|
4730
|
-
class:
|
|
4739
|
+
class: v(["text-xs font-medium tabular-nums", t.value])
|
|
4731
4740
|
}, [
|
|
4732
4741
|
ce(r.$slots, "message-count", {}, () => [
|
|
4733
4742
|
sn(P(n.messageCount), 1),
|
|
@@ -4736,17 +4745,17 @@ const No = /* @__PURE__ */ he({
|
|
|
4736
4745
|
])
|
|
4737
4746
|
], 2)
|
|
4738
4747
|
], 2)) : F("", !0),
|
|
4739
|
-
n.showMessageCount && n.hasHistory && n.showQuota && n.quota.remaining >= 0 ? (
|
|
4748
|
+
n.showMessageCount && n.hasHistory && n.showQuota && n.quota.remaining >= 0 ? (k(), T("span", Ki, " • ")) : F("", !0),
|
|
4740
4749
|
n.showQuota ? ce(r.$slots, "quota", { key: 2 }, () => {
|
|
4741
4750
|
var f;
|
|
4742
4751
|
return [
|
|
4743
|
-
n.quota.remaining > 0 ? (
|
|
4752
|
+
n.quota.remaining > 0 ? (k(), T("div", {
|
|
4744
4753
|
key: 0,
|
|
4745
|
-
class:
|
|
4754
|
+
class: v(["flex items-center gap-1.5 text-xs", (f = n.ui) == null ? void 0 : f.quotaDisplay])
|
|
4746
4755
|
}, [
|
|
4747
4756
|
h("span", Vi, P(n.quota.remaining), 1),
|
|
4748
4757
|
h("span", Gi, P(n.t("quotaRemaining")), 1)
|
|
4749
|
-
], 2)) : n.quota.remaining === 0 ? (
|
|
4758
|
+
], 2)) : n.quota.remaining === 0 ? (k(), T("div", Qi, [
|
|
4750
4759
|
o[8] || (o[8] = h("svg", {
|
|
4751
4760
|
class: "w-3.5 h-3.5 text-red-500",
|
|
4752
4761
|
fill: "none",
|
|
@@ -4766,12 +4775,12 @@ const No = /* @__PURE__ */ he({
|
|
|
4766
4775
|
}) : F("", !0)
|
|
4767
4776
|
])) : F("", !0),
|
|
4768
4777
|
h("div", {
|
|
4769
|
-
class:
|
|
4778
|
+
class: v(["flex items-center gap-1", (d = n.ui) == null ? void 0 : d.headerActions])
|
|
4770
4779
|
}, [
|
|
4771
|
-
n.showCloseButton ? (
|
|
4780
|
+
n.showCloseButton ? (k(), T("button", {
|
|
4772
4781
|
key: 0,
|
|
4773
4782
|
type: "button",
|
|
4774
|
-
class:
|
|
4783
|
+
class: v(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (c = n.ui) == null ? void 0 : c.headerActionButton]),
|
|
4775
4784
|
title: n.t("close"),
|
|
4776
4785
|
onClick: o[1] || (o[1] = (f) => r.$emit("close"))
|
|
4777
4786
|
}, [...o[9] || (o[9] = [
|
|
@@ -4789,10 +4798,10 @@ const No = /* @__PURE__ */ he({
|
|
|
4789
4798
|
})
|
|
4790
4799
|
], -1)
|
|
4791
4800
|
])], 10, Yi)) : F("", !0),
|
|
4792
|
-
n.showMinimizeButton ? (
|
|
4801
|
+
n.showMinimizeButton ? (k(), T("button", {
|
|
4793
4802
|
key: 1,
|
|
4794
4803
|
type: "button",
|
|
4795
|
-
class:
|
|
4804
|
+
class: v(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (y = n.ui) == null ? void 0 : y.headerActionButton]),
|
|
4796
4805
|
title: n.t("minimize"),
|
|
4797
4806
|
onClick: o[2] || (o[2] = (f) => r.$emit("minimize"))
|
|
4798
4807
|
}, [...o[10] || (o[10] = [
|
|
@@ -4810,20 +4819,20 @@ const No = /* @__PURE__ */ he({
|
|
|
4810
4819
|
})
|
|
4811
4820
|
], -1)
|
|
4812
4821
|
])], 10, Xi)) : F("", !0),
|
|
4813
|
-
n.showFullscreenToggle ? (
|
|
4822
|
+
n.showFullscreenToggle ? (k(), T("button", {
|
|
4814
4823
|
key: 2,
|
|
4815
4824
|
type: "button",
|
|
4816
|
-
class:
|
|
4825
|
+
class: v(["p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors", (x = n.ui) == null ? void 0 : x.headerActionButton]),
|
|
4817
4826
|
title: n.isFullscreen ? n.t("exitFullscreen") : n.t("fullscreen"),
|
|
4818
4827
|
onClick: o[3] || (o[3] = (f) => r.$emit("toggle-fullscreen"))
|
|
4819
4828
|
}, [
|
|
4820
|
-
n.isFullscreen ? (
|
|
4829
|
+
n.isFullscreen ? (k(), T("svg", ta, [...o[12] || (o[12] = [
|
|
4821
4830
|
h("path", {
|
|
4822
4831
|
"stroke-linecap": "round",
|
|
4823
4832
|
"stroke-linejoin": "round",
|
|
4824
4833
|
d: "M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25"
|
|
4825
4834
|
}, null, -1)
|
|
4826
|
-
])])) : (
|
|
4835
|
+
])])) : (k(), T("svg", ea, [...o[11] || (o[11] = [
|
|
4827
4836
|
h("path", {
|
|
4828
4837
|
"stroke-linecap": "round",
|
|
4829
4838
|
"stroke-linejoin": "round",
|
|
@@ -4852,7 +4861,7 @@ const No = /* @__PURE__ */ he({
|
|
|
4852
4861
|
setup(n) {
|
|
4853
4862
|
return (e, t) => {
|
|
4854
4863
|
var s, r, o;
|
|
4855
|
-
return
|
|
4864
|
+
return k(), T("div", sa, [
|
|
4856
4865
|
h("div", ra, [
|
|
4857
4866
|
h("div", oa, [
|
|
4858
4867
|
t[3] || (t[3] = h("svg", {
|
|
@@ -4868,10 +4877,10 @@ const No = /* @__PURE__ */ he({
|
|
|
4868
4877
|
d: "M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09Z"
|
|
4869
4878
|
})
|
|
4870
4879
|
], -1)),
|
|
4871
|
-
h("span", null, P(n.t("title") ||
|
|
4880
|
+
h("span", null, P(n.t("title") || $(de)("aiName")), 1)
|
|
4872
4881
|
])
|
|
4873
4882
|
]),
|
|
4874
|
-
(
|
|
4883
|
+
(k(!0), T(be, null, Fe(n.messages, (i, a) => ce(e.$slots, "message", {
|
|
4875
4884
|
key: i.id || a,
|
|
4876
4885
|
message: i,
|
|
4877
4886
|
isUser: i.role === "user",
|
|
@@ -4884,7 +4893,7 @@ const No = /* @__PURE__ */ he({
|
|
|
4884
4893
|
onCopy: t[0] || (t[0] = (u) => e.$emit("copy", u))
|
|
4885
4894
|
}, null, 8, ["message", "loading-text"])
|
|
4886
4895
|
])), 128)),
|
|
4887
|
-
n.quota.remaining === 0 ? (
|
|
4896
|
+
n.quota.remaining === 0 ? (k(), T("div", ia, [
|
|
4888
4897
|
h("button", {
|
|
4889
4898
|
type: "button",
|
|
4890
4899
|
class: "inline-flex items-center gap-2 px-6 py-3 bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-all shadow-sm",
|
|
@@ -4903,19 +4912,19 @@ const No = /* @__PURE__ */ he({
|
|
|
4903
4912
|
d: "M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"
|
|
4904
4913
|
})
|
|
4905
4914
|
], -1)),
|
|
4906
|
-
h("span", null, P(
|
|
4915
|
+
h("span", null, P($(de)("contactSupport")), 1)
|
|
4907
4916
|
])
|
|
4908
4917
|
])) : F("", !0),
|
|
4909
|
-
n.error.message ? (
|
|
4918
|
+
n.error.message ? (k(), T("div", {
|
|
4910
4919
|
key: 1,
|
|
4911
|
-
class:
|
|
4920
|
+
class: v(["flex items-center gap-2 text-sm text-red-600 dark:text-red-400 px-2 py-1 pb-6", (s = n.ui) == null ? void 0 : s.errorContainer])
|
|
4912
4921
|
}, [
|
|
4913
4922
|
h("span", {
|
|
4914
|
-
class:
|
|
4923
|
+
class: v((r = n.ui) == null ? void 0 : r.errorMessage)
|
|
4915
4924
|
}, P(n.error.message), 3),
|
|
4916
4925
|
h("button", {
|
|
4917
4926
|
type: "button",
|
|
4918
|
-
class:
|
|
4927
|
+
class: v(["inline-flex items-center gap-1 text-red-700 dark:text-red-300 hover:text-red-800 dark:hover:text-red-200 font-medium", (o = n.ui) == null ? void 0 : o.retryButton]),
|
|
4919
4928
|
title: n.t("retry"),
|
|
4920
4929
|
onClick: t[2] || (t[2] = (i) => e.$emit("retry"))
|
|
4921
4930
|
}, [...t[5] || (t[5] = [
|
|
@@ -4944,7 +4953,7 @@ const No = /* @__PURE__ */ he({
|
|
|
4944
4953
|
},
|
|
4945
4954
|
emits: ["copy"],
|
|
4946
4955
|
setup(n) {
|
|
4947
|
-
return (e, t) => (
|
|
4956
|
+
return (e, t) => (k(), T(be, null, [
|
|
4948
4957
|
t[4] || (t[4] = _n('<div class="w-14 h-14 rounded-2xl bg-primary/10 flex items-center justify-center mb-5"><svg class="w-7 h-7 text-primary" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09Z"></path></svg></div><h2 class="text-lg font-semibold text-gray-900 dark:text-white mb-1"> Almost there! </h2><p class="text-sm text-gray-500 dark:text-gray-400 mb-6 max-w-sm text-center"> Configure the plugin in your app entry file to start using AI. </p>', 3)),
|
|
4949
4958
|
h("div", ua, [
|
|
4950
4959
|
h("div", ca, [
|
|
@@ -5008,7 +5017,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5008
5017
|
const r = e.confirmVariant === "danger" ? "bg-red-600 hover:bg-red-700" : "bg-primary-500 hover:bg-primary-600", o = e.confirmVariant === "danger" ? (i = e.ui) == null ? void 0 : i.closeConfirmButton : (a = e.ui) == null ? void 0 : a.historyLimitButton;
|
|
5009
5018
|
return [r, o];
|
|
5010
5019
|
});
|
|
5011
|
-
return (r, o) => (
|
|
5020
|
+
return (r, o) => (k(), Ee(bt, {
|
|
5012
5021
|
"enter-active-class": "transition ease-out duration-200",
|
|
5013
5022
|
"enter-from-class": "opacity-0",
|
|
5014
5023
|
"enter-to-class": "opacity-100",
|
|
@@ -5019,11 +5028,11 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5019
5028
|
default: Ae(() => {
|
|
5020
5029
|
var i;
|
|
5021
5030
|
return [
|
|
5022
|
-
n.show ? (
|
|
5031
|
+
n.show ? (k(), T("div", fa, [
|
|
5023
5032
|
h("div", {
|
|
5024
|
-
class:
|
|
5033
|
+
class: v(["bg-white dark:bg-gray-800 rounded-xl p-6 m-4 max-w-sm w-full shadow-xl", t.value])
|
|
5025
5034
|
}, [
|
|
5026
|
-
n.icon === "warning" ? (
|
|
5035
|
+
n.icon === "warning" ? (k(), T("div", pa, [
|
|
5027
5036
|
o[2] || (o[2] = h("div", { class: "flex-shrink-0 w-10 h-10 rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center" }, [
|
|
5028
5037
|
h("svg", {
|
|
5029
5038
|
class: "w-5 h-5 text-amber-600 dark:text-amber-400",
|
|
@@ -5040,17 +5049,17 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5040
5049
|
])
|
|
5041
5050
|
], -1)),
|
|
5042
5051
|
h("h3", ga, P(n.title), 1)
|
|
5043
|
-
])) : (
|
|
5052
|
+
])) : (k(), T("h3", ma, P(n.title), 1)),
|
|
5044
5053
|
h("p", ya, P(n.message), 1),
|
|
5045
5054
|
h("div", xa, [
|
|
5046
5055
|
h("button", {
|
|
5047
5056
|
type: "button",
|
|
5048
|
-
class:
|
|
5057
|
+
class: v(["px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors", (i = n.ui) == null ? void 0 : i.cancelButton]),
|
|
5049
5058
|
onClick: o[0] || (o[0] = (a) => r.$emit("cancel"))
|
|
5050
5059
|
}, P(n.cancelText), 3),
|
|
5051
5060
|
h("button", {
|
|
5052
5061
|
type: "button",
|
|
5053
|
-
class:
|
|
5062
|
+
class: v(["px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors", s.value]),
|
|
5054
5063
|
onClick: o[1] || (o[1] = (a) => r.$emit("confirm"))
|
|
5055
5064
|
}, P(n.confirmText), 3)
|
|
5056
5065
|
])
|
|
@@ -5098,10 +5107,10 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5098
5107
|
set: (O) => s("update:modelValue", O)
|
|
5099
5108
|
});
|
|
5100
5109
|
function o(O, B) {
|
|
5101
|
-
var
|
|
5102
|
-
const
|
|
5103
|
-
if (
|
|
5104
|
-
let oe =
|
|
5110
|
+
var Q;
|
|
5111
|
+
const J = (Q = t.texts) == null ? void 0 : Q[O];
|
|
5112
|
+
if (J) {
|
|
5113
|
+
let oe = J;
|
|
5105
5114
|
if (B)
|
|
5106
5115
|
for (const [ee, ie] of Object.entries(B))
|
|
5107
5116
|
oe = oe.replace(`{${ee}}`, String(ie));
|
|
@@ -5109,18 +5118,18 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5109
5118
|
}
|
|
5110
5119
|
return de(O, B);
|
|
5111
5120
|
}
|
|
5112
|
-
const i = Ge(), a =
|
|
5121
|
+
const i = Ge(), a = U(""), u = U(null), d = U(null), c = U(!1), y = U(!1), x = U(!1), { loadingMessage: f, startLoadingText: p, resetLoadingText: D } = Ro(
|
|
5113
5122
|
() => i.sending,
|
|
5114
5123
|
() => t.loadingText
|
|
5115
5124
|
), {
|
|
5116
|
-
showHistoryLimitWarning:
|
|
5117
|
-
historyLimitReached:
|
|
5118
|
-
historyLimitDialogTitle:
|
|
5119
|
-
historyLimitDialogMessage:
|
|
5120
|
-
dismissHistoryLimitWarning:
|
|
5125
|
+
showHistoryLimitWarning: g,
|
|
5126
|
+
historyLimitReached: m,
|
|
5127
|
+
historyLimitDialogTitle: C,
|
|
5128
|
+
historyLimitDialogMessage: S,
|
|
5129
|
+
dismissHistoryLimitWarning: b,
|
|
5121
5130
|
handleHistoryLimitAction: z,
|
|
5122
|
-
checkHistoryLimit:
|
|
5123
|
-
setPendingMessage:
|
|
5131
|
+
checkHistoryLimit: q,
|
|
5132
|
+
setPendingMessage: G
|
|
5124
5133
|
} = Lo({
|
|
5125
5134
|
getHistoryLength: () => i.quota.limit - i.quota.remaining,
|
|
5126
5135
|
getStoreLimit: () => i.quota.limit,
|
|
@@ -5128,25 +5137,25 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5128
5137
|
getTexts: () => t.texts,
|
|
5129
5138
|
onStartNewChat: () => i.clearChatHistory(),
|
|
5130
5139
|
onNewChatEmit: () => s("new-chat")
|
|
5131
|
-
}),
|
|
5140
|
+
}), A = N(() => !is()), _ = N(() => Be("enableSupportMode") ?? !1), { suggestions: R, resolvePrompt: E } = Rs();
|
|
5132
5141
|
N(() => i.chatHistory.filter((O) => O.role === "user").length);
|
|
5133
|
-
const
|
|
5134
|
-
if (
|
|
5142
|
+
const Y = N(() => {
|
|
5143
|
+
if (A.value) return [];
|
|
5135
5144
|
const O = a.value.toLowerCase().trim(), B = R.value || [];
|
|
5136
|
-
let
|
|
5145
|
+
let J = B;
|
|
5137
5146
|
if (O) {
|
|
5138
|
-
const
|
|
5139
|
-
oe.length > 0 && (
|
|
5147
|
+
const Q = /* @__PURE__ */ new Set(["a", "an", "the", "and", "or", "but", "in", "on", "at", "to", "for", "of", "with", "by"]), oe = O.split(/\s+/).filter((ee) => !Q.has(ee));
|
|
5148
|
+
oe.length > 0 && (J = B.filter((ee) => {
|
|
5140
5149
|
const ie = `${ee.title} ${ee.description || ""}`.toLowerCase();
|
|
5141
5150
|
return oe.every((He) => ie.includes(He));
|
|
5142
5151
|
}));
|
|
5143
5152
|
}
|
|
5144
|
-
return
|
|
5145
|
-
id:
|
|
5146
|
-
title:
|
|
5147
|
-
description:
|
|
5153
|
+
return J.slice(0, 5).map((Q) => ({
|
|
5154
|
+
id: Q.id,
|
|
5155
|
+
title: Q.title,
|
|
5156
|
+
description: Q.description || ""
|
|
5148
5157
|
}));
|
|
5149
|
-
}),
|
|
5158
|
+
}), M = N(() => ({
|
|
5150
5159
|
quota: i.quota,
|
|
5151
5160
|
isFullscreen: c.value,
|
|
5152
5161
|
hasHistory: i.chatHistory.length > 0,
|
|
@@ -5154,7 +5163,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5154
5163
|
onClose: ze,
|
|
5155
5164
|
onMinimize: Re,
|
|
5156
5165
|
onToggleFullscreen: Me
|
|
5157
|
-
})),
|
|
5166
|
+
})), W = N(() => ({
|
|
5158
5167
|
modelValue: a.value,
|
|
5159
5168
|
sending: i.sending,
|
|
5160
5169
|
disabled: !1,
|
|
@@ -5162,8 +5171,8 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5162
5171
|
onCancel: () => i.cancelRequest()
|
|
5163
5172
|
}));
|
|
5164
5173
|
function qe(O) {
|
|
5165
|
-
const B = (R.value || []).find((
|
|
5166
|
-
B && (a.value =
|
|
5174
|
+
const B = (R.value || []).find((J) => J.id === O.id);
|
|
5175
|
+
B && (a.value = E(B));
|
|
5167
5176
|
}
|
|
5168
5177
|
function Me() {
|
|
5169
5178
|
c.value = !c.value;
|
|
@@ -5172,12 +5181,12 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5172
5181
|
r.value = !1;
|
|
5173
5182
|
}
|
|
5174
5183
|
function ze() {
|
|
5175
|
-
t.confirmClose && !
|
|
5184
|
+
t.confirmClose && !A.value && i.chatHistory.length > 0 ? x.value = !0 : (r.value = !1, s("close"));
|
|
5176
5185
|
}
|
|
5177
5186
|
function Ft() {
|
|
5178
|
-
|
|
5187
|
+
x.value = !1, i.clearChatHistory(), r.value = !1, s("close");
|
|
5179
5188
|
}
|
|
5180
|
-
function
|
|
5189
|
+
function Ct() {
|
|
5181
5190
|
s("contact-support");
|
|
5182
5191
|
}
|
|
5183
5192
|
function ne() {
|
|
@@ -5194,7 +5203,7 @@ app.<span class="text-yellow-300">use</span>(RestifyAiPlugin, {
|
|
|
5194
5203
|
function st() {
|
|
5195
5204
|
i.clearChatHistory(), s("new-chat");
|
|
5196
5205
|
}
|
|
5197
|
-
function
|
|
5206
|
+
function X(O) {
|
|
5198
5207
|
}
|
|
5199
5208
|
function je() {
|
|
5200
5209
|
navigator.clipboard.writeText(`import { RestifyAiPlugin } from '@doderasoftware/restify-ai'
|
|
@@ -5205,41 +5214,41 @@ app.use(RestifyAiPlugin, {
|
|
|
5205
5214
|
quota: '/api/ai/quota', // optional
|
|
5206
5215
|
},
|
|
5207
5216
|
getAuthToken: () => getToken(),
|
|
5208
|
-
})`),
|
|
5209
|
-
|
|
5217
|
+
})`), y.value = !0, setTimeout(() => {
|
|
5218
|
+
y.value = !1;
|
|
5210
5219
|
}, 2e3);
|
|
5211
5220
|
}
|
|
5212
5221
|
async function rt() {
|
|
5213
5222
|
const O = await z();
|
|
5214
5223
|
O && (await Pe(), await Ie(O.message, O.attachments, O.mentions, O.isSupportRequest));
|
|
5215
5224
|
}
|
|
5216
|
-
async function Ie(O, B,
|
|
5225
|
+
async function Ie(O, B, J, Q) {
|
|
5217
5226
|
i.clearError(), p(), await Pe(), Le();
|
|
5218
|
-
const oe = await i.askQuestion(O, B,
|
|
5219
|
-
|
|
5227
|
+
const oe = await i.askQuestion(O, B, J, Q);
|
|
5228
|
+
D(), oe && Le();
|
|
5220
5229
|
}
|
|
5221
5230
|
async function ot(O) {
|
|
5222
|
-
const { message: B, attachments:
|
|
5231
|
+
const { message: B, attachments: J, mentions: Q, isSupportRequest: oe } = O;
|
|
5223
5232
|
if (i.sending) return;
|
|
5224
|
-
const ee =
|
|
5233
|
+
const ee = Q.map((ie) => ({
|
|
5225
5234
|
id: ie.id,
|
|
5226
5235
|
name: ie.name,
|
|
5227
5236
|
type: ie.type || "unknown",
|
|
5228
5237
|
metadata: ie.metadata
|
|
5229
5238
|
}));
|
|
5230
|
-
if (!
|
|
5231
|
-
|
|
5239
|
+
if (!q()) {
|
|
5240
|
+
G({ message: B, attachments: J, mentions: ee, isSupportRequest: oe });
|
|
5232
5241
|
return;
|
|
5233
5242
|
}
|
|
5234
|
-
await Ie(B,
|
|
5243
|
+
await Ie(B, J, ee, oe);
|
|
5235
5244
|
}
|
|
5236
5245
|
async function it() {
|
|
5237
5246
|
p();
|
|
5238
5247
|
const O = await i.retry();
|
|
5239
|
-
|
|
5248
|
+
D(), O && Le();
|
|
5240
5249
|
}
|
|
5241
5250
|
function at(O) {
|
|
5242
|
-
t.closeOnEscape && O.key === "Escape" && r.value && (
|
|
5251
|
+
t.closeOnEscape && O.key === "Escape" && r.value && (x.value ? x.value = !1 : Re());
|
|
5243
5252
|
}
|
|
5244
5253
|
return _e(
|
|
5245
5254
|
() => i.chatHistory.length,
|
|
@@ -5254,56 +5263,56 @@ app.use(RestifyAiPlugin, {
|
|
|
5254
5263
|
), _e(() => t.modelValue, async (O) => {
|
|
5255
5264
|
var B;
|
|
5256
5265
|
O && (await Le(), (B = d.value) == null || B.focus()), O && t.autoFetchQuota && i.fetchQuota();
|
|
5257
|
-
}, { immediate: !0 }),
|
|
5266
|
+
}, { immediate: !0 }), Tt(() => {
|
|
5258
5267
|
window.addEventListener("keydown", at);
|
|
5259
|
-
}),
|
|
5268
|
+
}), vt(() => {
|
|
5260
5269
|
window.removeEventListener("keydown", at);
|
|
5261
|
-
}), (O, B) => (
|
|
5262
|
-
ye(
|
|
5270
|
+
}), (O, B) => (k(), Ee(Ws, { to: "body" }, [
|
|
5271
|
+
ye(bt, { name: "rai-fade" }, {
|
|
5263
5272
|
default: Ae(() => {
|
|
5264
|
-
var
|
|
5273
|
+
var J;
|
|
5265
5274
|
return [
|
|
5266
|
-
r.value && n.showBackdrop ? (
|
|
5275
|
+
r.value && n.showBackdrop ? (k(), T("div", {
|
|
5267
5276
|
key: 0,
|
|
5268
|
-
class:
|
|
5269
|
-
onClick: B[0] || (B[0] = (
|
|
5277
|
+
class: v(["fixed inset-0 bg-black/30 z-40", (J = n.ui) == null ? void 0 : J.backdrop]),
|
|
5278
|
+
onClick: B[0] || (B[0] = (Q) => n.closeOnBackdropClick && Re())
|
|
5270
5279
|
}, null, 2)) : F("", !0)
|
|
5271
5280
|
];
|
|
5272
5281
|
}),
|
|
5273
5282
|
_: 1
|
|
5274
5283
|
}),
|
|
5275
|
-
ye(
|
|
5284
|
+
ye(bt, {
|
|
5276
5285
|
name: n.position === "left" ? "rai-slide-right" : "rai-slide-left"
|
|
5277
5286
|
}, {
|
|
5278
5287
|
default: Ae(() => {
|
|
5279
|
-
var
|
|
5288
|
+
var J, Q, oe;
|
|
5280
5289
|
return [
|
|
5281
|
-
r.value ? (
|
|
5290
|
+
r.value ? (k(), T("aside", {
|
|
5282
5291
|
key: 0,
|
|
5283
|
-
class:
|
|
5292
|
+
class: v(["fixed bottom-0 z-50 flex-shrink-0 border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-2xl will-change-transform", [
|
|
5284
5293
|
n.position === "left" ? "left-0 border-r" : "right-0 border-l",
|
|
5285
|
-
(
|
|
5294
|
+
(J = n.ui) == null ? void 0 : J.drawer
|
|
5286
5295
|
]]),
|
|
5287
5296
|
style: cn({ width: c.value ? n.fullscreenWidth : n.width, top: n.topOffset, height: `calc(100vh - ${n.topOffset})` })
|
|
5288
5297
|
}, [
|
|
5289
5298
|
h("div", {
|
|
5290
|
-
class:
|
|
5299
|
+
class: v(["h-full flex flex-col relative bg-white dark:bg-gray-900", (Q = n.ui) == null ? void 0 : Q.panel])
|
|
5291
5300
|
}, [
|
|
5292
|
-
ce(O.$slots, "header", zn(Hn(
|
|
5301
|
+
ce(O.$slots, "header", zn(Hn(M.value)), () => [
|
|
5293
5302
|
ye(na, {
|
|
5294
5303
|
ui: n.ui,
|
|
5295
|
-
"is-setup-mode":
|
|
5304
|
+
"is-setup-mode": A.value,
|
|
5296
5305
|
"show-new-chat-button": n.showNewChatButton,
|
|
5297
|
-
"has-history":
|
|
5306
|
+
"has-history": $(i).chatHistory.length > 0,
|
|
5298
5307
|
"show-quota": n.showQuota,
|
|
5299
|
-
quota:
|
|
5308
|
+
quota: $(i).quota,
|
|
5300
5309
|
"show-close-button": n.showCloseButton,
|
|
5301
5310
|
"show-minimize-button": n.showMinimizeButton,
|
|
5302
5311
|
"show-fullscreen-toggle": n.showFullscreenToggle,
|
|
5303
5312
|
"is-fullscreen": c.value,
|
|
5304
5313
|
"show-message-count": n.showMessageCount,
|
|
5305
|
-
"message-count":
|
|
5306
|
-
"message-limit":
|
|
5314
|
+
"message-count": $(i).quota.used,
|
|
5315
|
+
"message-limit": $(i).quota.limit,
|
|
5307
5316
|
t: o,
|
|
5308
5317
|
onNewChat: st,
|
|
5309
5318
|
onClose: ze,
|
|
@@ -5312,45 +5321,45 @@ app.use(RestifyAiPlugin, {
|
|
|
5312
5321
|
}, {
|
|
5313
5322
|
quota: Ae(() => [
|
|
5314
5323
|
ce(O.$slots, "quota", {
|
|
5315
|
-
quota:
|
|
5324
|
+
quota: $(i).quota
|
|
5316
5325
|
}, void 0, !0)
|
|
5317
5326
|
]),
|
|
5318
5327
|
_: 3
|
|
5319
5328
|
}, 8, ["ui", "is-setup-mode", "show-new-chat-button", "has-history", "show-quota", "quota", "show-close-button", "show-minimize-button", "show-fullscreen-toggle", "is-fullscreen", "show-message-count", "message-count", "message-limit"])
|
|
5320
5329
|
], !0),
|
|
5321
5330
|
h("div", {
|
|
5322
|
-
class:
|
|
5331
|
+
class: v(["h-full flex flex-col mx-auto w-full overflow-hidden", [{ "max-w-5xl": c.value }, (oe = n.ui) == null ? void 0 : oe.body]])
|
|
5323
5332
|
}, [
|
|
5324
|
-
|
|
5333
|
+
A.value ? (k(), T("div", ka, [
|
|
5325
5334
|
ce(O.$slots, "setup", {}, () => [
|
|
5326
5335
|
ye(ha, {
|
|
5327
|
-
copied:
|
|
5336
|
+
copied: y.value,
|
|
5328
5337
|
onCopy: je
|
|
5329
5338
|
}, null, 8, ["copied"])
|
|
5330
5339
|
], !0)
|
|
5331
|
-
])) : (
|
|
5332
|
-
|
|
5340
|
+
])) : (k(), T(be, { key: 1 }, [
|
|
5341
|
+
$(i).chatHistory.length === 0 ? (k(), T("div", wa, [
|
|
5333
5342
|
ce(O.$slots, "empty-state", {
|
|
5334
|
-
suggestions:
|
|
5343
|
+
suggestions: Y.value,
|
|
5335
5344
|
onClick: se
|
|
5336
5345
|
}, () => [
|
|
5337
5346
|
ye(Fi, { onItemClick: se })
|
|
5338
5347
|
], !0)
|
|
5339
|
-
])) : (
|
|
5348
|
+
])) : (k(), T("div", {
|
|
5340
5349
|
key: 1,
|
|
5341
5350
|
ref_key: "chatContainer",
|
|
5342
5351
|
ref: u,
|
|
5343
5352
|
class: "flex-1 overflow-y-auto py-6 pb-24"
|
|
5344
5353
|
}, [
|
|
5345
5354
|
ye(la, {
|
|
5346
|
-
messages:
|
|
5347
|
-
"loading-message":
|
|
5348
|
-
quota:
|
|
5349
|
-
error:
|
|
5355
|
+
messages: $(i).chatHistory,
|
|
5356
|
+
"loading-message": $(f),
|
|
5357
|
+
quota: $(i).quota,
|
|
5358
|
+
error: $(i).error,
|
|
5350
5359
|
ui: n.ui,
|
|
5351
5360
|
t: o,
|
|
5352
|
-
onCopy:
|
|
5353
|
-
onContactSupport:
|
|
5361
|
+
onCopy: X,
|
|
5362
|
+
onContactSupport: Ct,
|
|
5354
5363
|
onRetry: it
|
|
5355
5364
|
}, {
|
|
5356
5365
|
message: Ae((ee) => [
|
|
@@ -5368,7 +5377,7 @@ app.use(RestifyAiPlugin, {
|
|
|
5368
5377
|
id: "rai-chat-bottom",
|
|
5369
5378
|
class: "h-8"
|
|
5370
5379
|
}, null, -1)),
|
|
5371
|
-
ce(O.$slots, "input", zn(Hn(
|
|
5380
|
+
ce(O.$slots, "input", zn(Hn(W.value)), () => {
|
|
5372
5381
|
var ee, ie;
|
|
5373
5382
|
return [
|
|
5374
5383
|
ye(Hi, {
|
|
@@ -5376,15 +5385,15 @@ app.use(RestifyAiPlugin, {
|
|
|
5376
5385
|
ref: d,
|
|
5377
5386
|
modelValue: a.value,
|
|
5378
5387
|
"onUpdate:modelValue": B[1] || (B[1] = (He) => a.value = He),
|
|
5379
|
-
sending:
|
|
5380
|
-
placeholder: ((ee = t.texts) == null ? void 0 : ee.placeholder) ||
|
|
5381
|
-
"support-placeholder": ((ie = t.texts) == null ? void 0 : ie.supportPlaceholder) ||
|
|
5382
|
-
suggestions:
|
|
5383
|
-
"has-history":
|
|
5384
|
-
"support-request-mode":
|
|
5388
|
+
sending: $(i).sending,
|
|
5389
|
+
placeholder: ((ee = t.texts) == null ? void 0 : ee.placeholder) || $(de)("inputPlaceholder"),
|
|
5390
|
+
"support-placeholder": ((ie = t.texts) == null ? void 0 : ie.supportPlaceholder) || $(de)("supportPlaceholder"),
|
|
5391
|
+
suggestions: Y.value,
|
|
5392
|
+
"has-history": $(i).chatHistory.length > 0,
|
|
5393
|
+
"support-request-mode": $(i).supportRequestMode,
|
|
5385
5394
|
"show-support-mode-toggle": _.value,
|
|
5386
5395
|
onSubmit: ot,
|
|
5387
|
-
onCancel:
|
|
5396
|
+
onCancel: $(i).cancelRequest,
|
|
5388
5397
|
onSuggestionSelect: qe,
|
|
5389
5398
|
onToggleSupportMode: ne
|
|
5390
5399
|
}, {
|
|
@@ -5399,7 +5408,7 @@ app.use(RestifyAiPlugin, {
|
|
|
5399
5408
|
], 2)
|
|
5400
5409
|
], 2),
|
|
5401
5410
|
ye(rs, {
|
|
5402
|
-
show:
|
|
5411
|
+
show: x.value,
|
|
5403
5412
|
title: o("closeConfirmTitle"),
|
|
5404
5413
|
message: o("closeConfirmMessage"),
|
|
5405
5414
|
"confirm-text": o("confirmClose"),
|
|
@@ -5407,19 +5416,19 @@ app.use(RestifyAiPlugin, {
|
|
|
5407
5416
|
ui: n.ui,
|
|
5408
5417
|
"confirm-variant": "danger",
|
|
5409
5418
|
onConfirm: Ft,
|
|
5410
|
-
onCancel: B[2] || (B[2] = (ee) =>
|
|
5419
|
+
onCancel: B[2] || (B[2] = (ee) => x.value = !1)
|
|
5411
5420
|
}, null, 8, ["show", "title", "message", "confirm-text", "cancel-text", "ui"]),
|
|
5412
5421
|
ye(rs, {
|
|
5413
|
-
show:
|
|
5414
|
-
title:
|
|
5415
|
-
message:
|
|
5422
|
+
show: $(g),
|
|
5423
|
+
title: $(C),
|
|
5424
|
+
message: $(S),
|
|
5416
5425
|
"confirm-text": o("startNewChat"),
|
|
5417
|
-
"cancel-text":
|
|
5426
|
+
"cancel-text": $(m) ? o("continueChat") : o("cancel"),
|
|
5418
5427
|
ui: n.ui,
|
|
5419
5428
|
icon: "warning",
|
|
5420
5429
|
"confirm-variant": "primary",
|
|
5421
5430
|
onConfirm: rt,
|
|
5422
|
-
onCancel:
|
|
5431
|
+
onCancel: $(b)
|
|
5423
5432
|
}, null, 8, ["show", "title", "message", "confirm-text", "cancel-text", "ui", "onCancel"])
|
|
5424
5433
|
], 6)) : F("", !0)
|
|
5425
5434
|
];
|
|
@@ -5440,10 +5449,10 @@ app.use(RestifyAiPlugin, {
|
|
|
5440
5449
|
},
|
|
5441
5450
|
emits: ["error", "reset"],
|
|
5442
5451
|
setup(n, { expose: e, emit: t }) {
|
|
5443
|
-
const s = n, r = t, o =
|
|
5452
|
+
const s = n, r = t, o = U(!1), i = U(null);
|
|
5444
5453
|
Ks((u, d, c) => {
|
|
5445
|
-
var
|
|
5446
|
-
return o.value = !0, i.value = u, (
|
|
5454
|
+
var y;
|
|
5455
|
+
return o.value = !0, i.value = u, (y = s.onError) == null || y.call(s, u, c), r("error", u, c), !1;
|
|
5447
5456
|
});
|
|
5448
5457
|
function a() {
|
|
5449
5458
|
o.value = !1, i.value = null, r("reset");
|
|
@@ -5457,13 +5466,13 @@ app.use(RestifyAiPlugin, {
|
|
|
5457
5466
|
error: i.value,
|
|
5458
5467
|
reset: a
|
|
5459
5468
|
}, () => {
|
|
5460
|
-
var c,
|
|
5469
|
+
var c, y, x, f, p;
|
|
5461
5470
|
return [
|
|
5462
5471
|
h("div", {
|
|
5463
|
-
class:
|
|
5472
|
+
class: v(["flex flex-col items-center justify-center p-6 text-center", (c = n.ui) == null ? void 0 : c.container])
|
|
5464
5473
|
}, [
|
|
5465
5474
|
h("div", {
|
|
5466
|
-
class:
|
|
5475
|
+
class: v(["w-12 h-12 mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center", (y = n.ui) == null ? void 0 : y.iconContainer])
|
|
5467
5476
|
}, [...d[0] || (d[0] = [
|
|
5468
5477
|
h("svg", {
|
|
5469
5478
|
class: "w-6 h-6 text-red-600 dark:text-red-400",
|
|
@@ -5480,14 +5489,14 @@ app.use(RestifyAiPlugin, {
|
|
|
5480
5489
|
], -1)
|
|
5481
5490
|
])], 2),
|
|
5482
5491
|
h("h3", {
|
|
5483
|
-
class:
|
|
5492
|
+
class: v(["text-lg font-semibold text-gray-900 dark:text-white mb-2", (x = n.ui) == null ? void 0 : x.title])
|
|
5484
5493
|
}, P(n.title), 3),
|
|
5485
5494
|
h("p", {
|
|
5486
|
-
class:
|
|
5495
|
+
class: v(["text-sm text-gray-600 dark:text-gray-400 mb-4", (f = n.ui) == null ? void 0 : f.message])
|
|
5487
5496
|
}, P(n.message), 3),
|
|
5488
|
-
n.showRetry ? (
|
|
5497
|
+
n.showRetry ? (k(), T("button", {
|
|
5489
5498
|
key: 0,
|
|
5490
|
-
class:
|
|
5499
|
+
class: v(["px-4 py-2 text-sm font-medium text-white bg-primary rounded-lg hover:bg-primary/90 transition-colors", (p = n.ui) == null ? void 0 : p.retryButton]),
|
|
5491
5500
|
onClick: a
|
|
5492
5501
|
}, P(n.retryText), 3)) : F("", !0)
|
|
5493
5502
|
], 2)
|