@roudanio/awesome-comment 0.10.4 → 0.10.6
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/awesome-comment.js +519 -501
- package/dist/{vendor-auth0-DkqbqvnH.js → vendor-auth0-FyrIO3oS.js} +1 -1
- package/dist/{vendor-i18n-B4UB934p.js → vendor-i18n--NfXv8rP.js} +34 -34
- package/dist/{vendor-lucide-Cl8oS5sQ.js → vendor-lucide-C7toM1hZ.js} +1 -1
- package/dist/{vendor-pinia-Dzo8X_0B.js → vendor-pinia-DRSupkuV.js} +43 -43
- package/dist/{vendor-vue-BTtW1k2s.js → vendor-vue-njoJvG0v.js} +388 -375
- package/package.json +1 -1
package/dist/awesome-comment.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import { d as
|
|
3
|
-
import { E as
|
|
4
|
-
import { u as
|
|
5
|
-
import { o as
|
|
6
|
-
import { T as
|
|
7
|
-
import { d as
|
|
8
|
-
const
|
|
9
|
-
de:
|
|
1
|
+
import { i as N, r as $, w as G, f as Y, j as D, p as se, n as de, v, x as ce, y as A, z as I, A as m, B as Me, C as Pe, D as we, E as me, G as E, F as M, H, I as f, J as j, u as B, K as je, L as Be, M as De, N as Se, O as Ue } from "./vendor-vue-njoJvG0v.js";
|
|
2
|
+
import { d as Te, c as Fe } from "./vendor-pinia-DRSupkuV.js";
|
|
3
|
+
import { E as Ke, G as Le } from "./vendor-auth0-FyrIO3oS.js";
|
|
4
|
+
import { u as U, c as ze } from "./vendor-i18n--NfXv8rP.js";
|
|
5
|
+
import { o as Ve } from "./vendor-lodash-CKuyBgAy.js";
|
|
6
|
+
import { T as Ge, a as He, R as Je, B as We } from "./vendor-lucide-C7toM1hZ.js";
|
|
7
|
+
import { d as Ye } from "./vendor-marked-B6IoMkOX.js";
|
|
8
|
+
const Ze = { admin: "Admin", anonymous: "Anonym", approve_hint: "Wir werden Ihren Kommentar innerhalb von 24 Stunden beantworten, ohne Ihre E-Mail zu spammen. Schauen Sie bitte bald wieder vorbei. :)", discussion: "Diskussion", edit: "Bearbeiten", load_more: "Mehr laden", login: "Anmelden", logout: "Abmelden", placeholder: "Schreiben Sie ein Kommentar...", post_comment: "Kommentar absenden", post_reply: "Antwort absenden", reply: "Antwort", reply_to: "Antwort auf", save_editing: "Speichern", ui_texts: ["Seien Sie der Erste, der die Diskussion beginnt!", "Beteiligen Sie sich an der Konversation (#)", "Laden...", "Kommentare laden"], your_comment: "Dein Kommentar" }, qe = { admin: "Admin", anonymous: "Anonymous", approve_hint: "We’ll reply to your comment within 24 hours without spamming your email, so please check back soon :)", discussion: "Discussion", edit: "Edit", load_more: "Load More", login: "LOGIN", login_or_verify: "Please log in or complete the verification to post.", logout: "Logout", placeholder: "Write a comment...", post_comment: "POST COMMENT", post_reply: "POST REPLY", reply: "Reply", reply_to: "reply to", save_editing: "Save", ui_texts: ["Be the first to start the discussion!", "Join the Conversation (#)", "Loading...", "Load Comments"], your_comment: "Your comment" }, Xe = { admin: "Administrador", anonymous: "Anónimo", approve_hint: "los comentarios son normalmente aprobados dentro de 24 horas", discussion: "Discusión", edit: "Editar", load_more: "Cargar Más", login: "INICIAR SESIÓN", logout: "Cerrar Sesión", placeholder: "Escribe un comentario...", post_comment: "PUBLICAR COMENTARIO", post_reply: "PUBLICAR RESPUESTA", reply: "Responder", reply_to: "Responder a", save_editing: "Guardar", ui_texts: ["¡Sé el primero en iniciar la discusión!", "Únete a la Conversación (#)", "Cargando...", "Cargar Comentarios"], your_comment: "Tu comentario" }, Qe = { admin: "Admin", anonymous: "Anonyme", approve_hint: "Nous répondrons à votre commentaire dans les 24 heures sans vous spammer par e-mail, alors revenez bientôt :)", discussion: "Discussion", edit: "Modifier", load_more: "Charger plus", login: "CONNEXION", logout: "Déconnexion", placeholder: "Écrivez un commentaire...", post_comment: "POSTER UN COMMENTAIRE", post_reply: "POSTER UNE RÉPONSE", reply: "Répondre", reply_to: "répondre à", save_editing: "Enregistrer", ui_texts: ["Soyez le premier à lancer la discussion !", "Rejoignez la conversation (#)", "Chargement...", "Charger les commentaires"], your_comment: "Votre commentaire" }, et = { admin: "Admin", anonymous: "Anonim", approve_hint: "komentar biasanya disetujui dalam waktu 24 jam", discussion: "Diskusi", edit: "Edit", load_more: "Muat Lebih Banyak", login: "MASUK", logout: "Keluar", placeholder: "Tulis komentar...", post_comment: "KIRIM KOMENTAR", post_reply: "KIRIM BALASAN", reply: "Balas", reply_to: "balas ke", save_editing: "Simpan", your_comment: "Komentar Anda" }, tt = { admin: "Amministratore", anonymous: "Anonimo", approve_hint: "i commenti vengono normalmente approvati entro 24 ore", discussion: "Discussione", edit: "Modifica", load_more: "Carica Altri", login: "ACCEDI", logout: "Esci", placeholder: "Scrivi un commento...", post_comment: "INVIA COMMENTO", post_reply: "INVIA RISPOSTA", reply: "Risposta", reply_to: "rispondi a", save_editing: "Salva", your_comment: "Il tuo commento" }, nt = { admin: "管理者", anonymous: "匿名", approve_hint: "コメントは通常24時間以内に承認されます", discussion: "ディスカッション", edit: "編集", load_more: "もっと読み込む", login: "ログイン", logout: "ログアウト", placeholder: "コメントを書く...", post_comment: "コメントを投稿", post_reply: "返信を投稿", reply: "返信", reply_to: "返信先", save_editing: "保存", your_comment: "あなたのコメント" }, ot = { admin: "관리자", anonymous: "익명", approve_hint: "댓글은 보통 24시간 내에 승인됩니다", discussion: "토론", edit: "편집", load_more: "더 보기", login: "로그인", logout: "로그아웃", placeholder: "댓글을 입력하세요...", post_comment: "댓글 게시", post_reply: "답글 게시", reply: "답장", reply_to: "답장 대상", save_editing: "저장", your_comment: "당신의 댓글" }, st = { admin: "Administrador", anonymous: "Anônimo", approve_hint: "os comentários são normalmente aprovados dentro de 24 horas", discussion: "Discussão", edit: "Editar", load_more: "Carregar Mais", login: "ENTRAR", logout: "Sair", placeholder: "Escreva um comentário...", post_comment: "PUBLICAR COMENTÁRIO", post_reply: "PUBLICAR RESPOSTA", reply: "Responder", reply_to: "responder a", save_editing: "Salvar", your_comment: "Seu comentário" }, at = { admin: "แอดมิน", anonymous: "นิรนาม", approve_hint: "โดยปกติความคิดเห็นจะได้รับการอนุมัติภายใน 24 ชั่วโมง", discussion: "การอภิปราย", edit: "แก้ไข", load_more: "โหลดเพิ่ม", login: "ลงชื่อเข้าใช้", logout: "ลงชื่อออก", placeholder: "เขียนความคิดเห็น...", post_comment: "โพสต์ความคิดเห็น", post_reply: "โพสต์การตอบกลับ", reply: "ตอบกลับ", reply_to: "ตอบกลับถึง", save_editing: "บันทึก", ui_texts: ["เป็นคนแรกที่เริ่มการอภิปราย", "เข้าร่วมการสนทนา (#)", "กำลังโหลด...", "โหลดความคิดเห็น"], your_comment: "ความคิดเห็นของคุณ" }, rt = { admin: "管理員", anonymous: "匿名", approve_hint: "評論通常在24小時內獲得批準,並且每壹條評論都會獲得回復", discussion: "討論", edit: "修改", load_more: "加載更多", login: "登錄", login_or_verify: "請登錄或完成驗證碼後再發表評論。", logout: "登出", placeholder: "寫評論...", post_comment: "發表評論", post_reply: "發表回複", reply: "回複", reply_to: "回複給", save_editing: "保存", your_comment: "您的評論" }, it = { admin: "管理员", anonymous: "匿名", approve_hint: "评论通常在24小时内公开(我们也会回复您)", discussion: "讨论", edit: "编辑", load_more: "加载更多", login: "登录", login_or_verify: "请登录或完成验证码后再发表评论。", logout: "登出", placeholder: "写评论...", post_comment: "发表评论", post_reply: "发表回复", reply: "回复", reply_to: "回复给", save_editing: "保存", your_comment: "您的评论" }, ke = {
|
|
9
|
+
de: Ze,
|
|
10
10
|
en: qe,
|
|
11
|
-
es:
|
|
12
|
-
fr:
|
|
13
|
-
id:
|
|
14
|
-
it:
|
|
15
|
-
ja:
|
|
16
|
-
ko:
|
|
17
|
-
pt:
|
|
18
|
-
th:
|
|
19
|
-
zh:
|
|
20
|
-
cn:
|
|
11
|
+
es: Xe,
|
|
12
|
+
fr: Qe,
|
|
13
|
+
id: et,
|
|
14
|
+
it: tt,
|
|
15
|
+
ja: nt,
|
|
16
|
+
ko: ot,
|
|
17
|
+
pt: st,
|
|
18
|
+
th: at,
|
|
19
|
+
zh: rt,
|
|
20
|
+
cn: it
|
|
21
21
|
};
|
|
22
|
-
function
|
|
22
|
+
function ct() {
|
|
23
23
|
return !!navigator.userAgent.match(/Macintosh/);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return (
|
|
25
|
+
function lt(e, s) {
|
|
26
|
+
return (ct() ? e.metaKey : e.ctrlKey) && e.key === s;
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const ut = {
|
|
29
29
|
maxConsecutivePunctuation: 5,
|
|
30
30
|
maxConsecutiveSpaces: 3,
|
|
31
31
|
maxConsecutiveNewlines: 3,
|
|
@@ -35,48 +35,48 @@ const lt = {
|
|
|
35
35
|
allowedPunctuation: [],
|
|
36
36
|
blockPatterns: []
|
|
37
37
|
};
|
|
38
|
-
function
|
|
39
|
-
const t = { ...
|
|
38
|
+
function dt(e, s = {}) {
|
|
39
|
+
const t = { ...ut, ...s }, n = [];
|
|
40
40
|
if (!e || typeof e != "string")
|
|
41
41
|
return { valid: !1, errors: ["Content is required"] };
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const d =
|
|
45
|
-
d.valid || n.push(...d.errors), /^\w{35,}$/.test(
|
|
46
|
-
const u =
|
|
42
|
+
const i = e.trim();
|
|
43
|
+
i.length < t.minLength && n.push(`Content must be at least ${t.minLength} characters`), i.length > t.maxLength && n.push(`Content must not exceed ${t.maxLength} characters`);
|
|
44
|
+
const d = mt(i, t.maxConsecutivePunctuation);
|
|
45
|
+
d.valid || n.push(...d.errors), /^\w{35,}$/.test(i) && n.push("Content contains too many consecutive letters");
|
|
46
|
+
const u = pt(i, t.maxConsecutiveSpaces);
|
|
47
47
|
u.valid || n.push(...u.errors);
|
|
48
|
-
const l =
|
|
48
|
+
const l = ft(i, t.maxConsecutiveNewlines);
|
|
49
49
|
l.valid || n.push(...l.errors);
|
|
50
|
-
const o =
|
|
50
|
+
const o = ht(i, t.minWords);
|
|
51
51
|
if (o.valid || n.push(...o.errors), t.blockPatterns.length > 0) {
|
|
52
|
-
const
|
|
53
|
-
|
|
52
|
+
const r = vt(i, t.blockPatterns);
|
|
53
|
+
r.valid || n.push(...r.errors);
|
|
54
54
|
}
|
|
55
55
|
return {
|
|
56
56
|
valid: n.length === 0,
|
|
57
57
|
errors: n
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function mt(e, s) {
|
|
61
61
|
const t = [], n = ["!", "?", ".", ",", ";", ":", "!", "?", "。", ",", ";", ":", "…", "~", "~"];
|
|
62
62
|
for (const u of n) {
|
|
63
63
|
const l = new RegExp(`\\${u}{${s + 1},}`, "g"), o = e.match(l);
|
|
64
64
|
o && t.push(`Too many consecutive "${u}" (max ${s}). Found: ${o[0]}`);
|
|
65
65
|
}
|
|
66
|
-
const
|
|
66
|
+
const i = new RegExp(`[${n.join("")}]{${s + 1},}`, "g"), d = e.match(i);
|
|
67
67
|
return d && t.push(`Too many consecutive punctuation marks (max ${s}). Found: ${d[0]}`), {
|
|
68
68
|
valid: t.length === 0,
|
|
69
69
|
errors: t
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function pt(e, s) {
|
|
73
73
|
const t = new RegExp(` {${s + 1},}`, "g");
|
|
74
74
|
return e.match(t) ? {
|
|
75
75
|
valid: !1,
|
|
76
76
|
errors: [`Too many consecutive spaces (max ${s})`]
|
|
77
77
|
} : { valid: !0, errors: [] };
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function ft(e, s) {
|
|
80
80
|
const t = new RegExp(`
|
|
81
81
|
{${s + 1},}`, "g");
|
|
82
82
|
return e.match(t) ? {
|
|
@@ -84,7 +84,7 @@ function pt(e, s) {
|
|
|
84
84
|
errors: [`Too many consecutive line breaks (max ${s})`]
|
|
85
85
|
} : { valid: !0, errors: [] };
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function ht(e, s) {
|
|
88
88
|
const t = e.replace(/[^\p{L}\p{N}\s]/gu, " ").trim(), n = t.match(/[\u4e00-\u9fa5]/g);
|
|
89
89
|
if (n && n.length > t.length * 0.3) {
|
|
90
90
|
if (t.replace(/\s+/g, "").length < s)
|
|
@@ -99,7 +99,7 @@ function ft(e, s) {
|
|
|
99
99
|
};
|
|
100
100
|
return { valid: !0, errors: [] };
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function vt(e, s) {
|
|
103
103
|
const t = [];
|
|
104
104
|
for (const n of s)
|
|
105
105
|
n.test(e) && t.push(`Content contains blocked pattern: ${n.source}`);
|
|
@@ -109,32 +109,32 @@ function ht(e, s) {
|
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
var te = /* @__PURE__ */ ((e) => (e[e.Pending = 0] = "Pending", e[e.Approved = 1] = "Approved", e[e.Rejected = 2] = "Rejected", e[e.UnReplied = 255] = "UnReplied", e[e["Replied to Admin"] = 256] = "Replied to Admin", e))(te || {});
|
|
112
|
-
const
|
|
112
|
+
const gt = /@([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/;
|
|
113
113
|
function ne(e) {
|
|
114
114
|
return e < 10 ? `0${e}` : `${e}`;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function Ne(e) {
|
|
117
117
|
return e = `${e.substring(0, 10)}T${e.substring(11, 19)}Z`, new Date(e);
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function xe(e) {
|
|
120
120
|
const s = e.getFullYear(), t = e.getMonth() + 1, n = e.getDate();
|
|
121
121
|
return `${s}-${ne(t)}-${ne(n)}`;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
e instanceof Date || (e =
|
|
125
|
-
const s = /* @__PURE__ */ new Date(), t =
|
|
126
|
-
if (
|
|
127
|
-
const n = e.getHours(),
|
|
128
|
-
return `${ne(n)}:${ne(
|
|
123
|
+
function Ae(e) {
|
|
124
|
+
e instanceof Date || (e = Ne(e));
|
|
125
|
+
const s = /* @__PURE__ */ new Date(), t = xe(e);
|
|
126
|
+
if (xe(s) === t) {
|
|
127
|
+
const n = e.getHours(), i = e.getMinutes();
|
|
128
|
+
return `${ne(n)}:${ne(i)}`;
|
|
129
129
|
}
|
|
130
130
|
return t;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function yt(e) {
|
|
133
133
|
const {
|
|
134
134
|
id: s,
|
|
135
135
|
created_at: t,
|
|
136
136
|
parent_id: n,
|
|
137
|
-
ancestor_id:
|
|
137
|
+
ancestor_id: i,
|
|
138
138
|
post_id: d,
|
|
139
139
|
user_id: u,
|
|
140
140
|
...l
|
|
@@ -147,263 +147,263 @@ function gt(e) {
|
|
|
147
147
|
parentId: Number(n),
|
|
148
148
|
post_id: d,
|
|
149
149
|
postId: d,
|
|
150
|
-
ancestorId: Number(
|
|
150
|
+
ancestorId: Number(i),
|
|
151
151
|
status: Number(e.status),
|
|
152
|
-
createdAt:
|
|
152
|
+
createdAt: Ne(t || l.createdAt || "")
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
const
|
|
156
|
-
const e =
|
|
157
|
-
function
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
!
|
|
155
|
+
const pe = "awesome-comment-comments", Ie = localStorage.getItem(pe), V = Ie ? JSON.parse(Ie) : {}, J = Te("store", () => {
|
|
156
|
+
const e = N("postId"), s = N("siteId"), t = N("comments"), n = N("total"), i = $(!!t?.length), d = $(0), u = $(""), l = $([]), o = $(n || 0), r = N("ApiBaseUrl"), a = $(!1), c = $(!1);
|
|
157
|
+
function k(b) {
|
|
158
|
+
const h = {}, x = [];
|
|
159
|
+
b.forEach((w) => {
|
|
160
|
+
p(Number(w.id));
|
|
161
|
+
const C = yt(w);
|
|
162
|
+
!w.ancestor_id || Number(w.ancestor_id) === 0 ? h[w.id] = C : x.push(C);
|
|
163
163
|
});
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
if (
|
|
167
|
-
const
|
|
168
|
-
|
|
164
|
+
const y = V[e];
|
|
165
|
+
y && (y.createdAt = new Date(y.createdAt), !y.ancestorId || Number(y.ancestorId) === 0 ? h[y.id] = y : x.push(y)), x.forEach((w) => {
|
|
166
|
+
if (w.ancestorId in h) {
|
|
167
|
+
const C = h[w.ancestorId];
|
|
168
|
+
C.children = [w, ...C.children || []];
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
|
-
for (const
|
|
172
|
-
const
|
|
173
|
-
|
|
171
|
+
for (const w in h) {
|
|
172
|
+
const C = h[w];
|
|
173
|
+
C.children && (C.children = C.children.sort((F, K) => F.id - K.id));
|
|
174
174
|
}
|
|
175
|
-
return
|
|
175
|
+
return h;
|
|
176
176
|
}
|
|
177
|
-
async function g(
|
|
178
|
-
if (
|
|
179
|
-
u.value = "",
|
|
180
|
-
let
|
|
181
|
-
if (
|
|
182
|
-
|
|
177
|
+
async function g(b = !1) {
|
|
178
|
+
if (a.value) return;
|
|
179
|
+
u.value = "", a.value = !0;
|
|
180
|
+
let h;
|
|
181
|
+
if (b && t?.length)
|
|
182
|
+
h = k(t);
|
|
183
183
|
else {
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
if (!
|
|
188
|
-
u.value = "Load comments failed. " +
|
|
184
|
+
const x = new URLSearchParams();
|
|
185
|
+
x.append("postId", e), s && x.append("siteId", s), x.append("start", d.value.toString());
|
|
186
|
+
const y = await fetch(`${r}/api/comments?${x}`);
|
|
187
|
+
if (!y.ok) {
|
|
188
|
+
u.value = "Load comments failed. " + y.statusText, i.value = !0, a.value = !1;
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
|
-
const
|
|
192
|
-
if (
|
|
193
|
-
u.value = "Load comments failed. " +
|
|
191
|
+
const w = await y.json();
|
|
192
|
+
if (w.code !== 0) {
|
|
193
|
+
u.value = "Load comments failed. " + w.message, i.value = !0, a.value = !1;
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
|
-
|
|
196
|
+
h = k(w.data || []), o.value = w.meta?.total || w.data?.length || 0;
|
|
197
197
|
}
|
|
198
|
-
|
|
198
|
+
c.value = Object.keys(h).length > 20, c.value && delete h[Object.keys(h)[0]], Object.assign(l.value, h), i.value = !0, a.value = !1;
|
|
199
199
|
}
|
|
200
|
-
function
|
|
201
|
-
const { sub:
|
|
202
|
-
id:
|
|
200
|
+
function _(b, h, x, y = te.Pending, w, C) {
|
|
201
|
+
const { sub: F = "", name: K = "", picture: Z = "", email: ae = "", nickname: q = "" } = x, O = {
|
|
202
|
+
id: b,
|
|
203
203
|
post_id: e,
|
|
204
204
|
postId: e,
|
|
205
|
-
content:
|
|
205
|
+
content: h,
|
|
206
206
|
createdAt: /* @__PURE__ */ new Date(),
|
|
207
207
|
user: {
|
|
208
|
-
avatar:
|
|
209
|
-
email:
|
|
210
|
-
name:
|
|
208
|
+
avatar: Z,
|
|
209
|
+
email: ae,
|
|
210
|
+
name: q || K
|
|
211
211
|
},
|
|
212
|
-
user_id:
|
|
213
|
-
userId:
|
|
214
|
-
status:
|
|
212
|
+
user_id: F,
|
|
213
|
+
userId: F,
|
|
214
|
+
status: y,
|
|
215
215
|
isNew: !0
|
|
216
216
|
};
|
|
217
|
-
if (
|
|
218
|
-
O.ancestorId =
|
|
219
|
-
const
|
|
220
|
-
if (
|
|
221
|
-
|
|
217
|
+
if (w || C) {
|
|
218
|
+
O.ancestorId = w, O.parentId = C;
|
|
219
|
+
const P = l.value[w];
|
|
220
|
+
if (P.children || (P.children = []), w === C)
|
|
221
|
+
P.children.unshift(O);
|
|
222
222
|
else {
|
|
223
|
-
const
|
|
224
|
-
|
|
223
|
+
const re = P.children.findIndex((T) => Number(T.id) === C);
|
|
224
|
+
P.children.splice(re + 1, 0, O);
|
|
225
225
|
}
|
|
226
226
|
} else
|
|
227
|
-
O.ancestorId = 0, O.parentId = 0, l.value = { [
|
|
228
|
-
o.value++,
|
|
227
|
+
O.ancestorId = 0, O.parentId = 0, l.value = { [b]: O, ...l.value };
|
|
228
|
+
o.value++, y !== te.Approved && (V[e] = O, localStorage.setItem(pe, JSON.stringify(V)));
|
|
229
229
|
}
|
|
230
|
-
function
|
|
231
|
-
V[e]?.id ===
|
|
230
|
+
function p(b) {
|
|
231
|
+
V[e]?.id === b && (delete V[e], localStorage.setItem(pe, JSON.stringify(V)));
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
let
|
|
235
|
-
if (!
|
|
236
|
-
for (const
|
|
237
|
-
if (
|
|
233
|
+
function S(b, h) {
|
|
234
|
+
let x = l.value[b];
|
|
235
|
+
if (!x) {
|
|
236
|
+
for (const y of Object.values(l.value))
|
|
237
|
+
if (y.children && (x = y.children.find((w) => Number(w.id) === b), x))
|
|
238
238
|
break;
|
|
239
239
|
}
|
|
240
|
-
|
|
240
|
+
x && Object.assign(x, h);
|
|
241
241
|
}
|
|
242
242
|
return {
|
|
243
|
-
isLoaded:
|
|
243
|
+
isLoaded: i,
|
|
244
244
|
message: u,
|
|
245
245
|
postId: e,
|
|
246
246
|
comments: l,
|
|
247
247
|
total: o,
|
|
248
248
|
start: d,
|
|
249
|
-
hasMore:
|
|
250
|
-
loadingMore:
|
|
249
|
+
hasMore: c,
|
|
250
|
+
loadingMore: a,
|
|
251
251
|
loadComments: g,
|
|
252
|
-
addComment:
|
|
253
|
-
updateComment:
|
|
252
|
+
addComment: _,
|
|
253
|
+
updateComment: S
|
|
254
254
|
};
|
|
255
255
|
});
|
|
256
|
-
var
|
|
257
|
-
function
|
|
258
|
-
return
|
|
256
|
+
var $e = { exports: {} }, Ce;
|
|
257
|
+
function bt() {
|
|
258
|
+
return Ce || (Ce = 1, (function(e) {
|
|
259
259
|
var s = Object.prototype.hasOwnProperty, t = "~";
|
|
260
260
|
function n() {
|
|
261
261
|
}
|
|
262
262
|
Object.create && (n.prototype = /* @__PURE__ */ Object.create(null), new n().__proto__ || (t = !1));
|
|
263
|
-
function
|
|
264
|
-
this.fn = o, this.context =
|
|
263
|
+
function i(o, r, a) {
|
|
264
|
+
this.fn = o, this.context = r, this.once = a || !1;
|
|
265
265
|
}
|
|
266
|
-
function d(o, a, c,
|
|
267
|
-
if (typeof
|
|
266
|
+
function d(o, r, a, c, k) {
|
|
267
|
+
if (typeof a != "function")
|
|
268
268
|
throw new TypeError("The listener must be a function");
|
|
269
|
-
var g = new
|
|
270
|
-
return o._events[
|
|
269
|
+
var g = new i(a, c || o, k), _ = t ? t + r : r;
|
|
270
|
+
return o._events[_] ? o._events[_].fn ? o._events[_] = [o._events[_], g] : o._events[_].push(g) : (o._events[_] = g, o._eventsCount++), o;
|
|
271
271
|
}
|
|
272
|
-
function u(o,
|
|
273
|
-
--o._eventsCount === 0 ? o._events = new n() : delete o._events[
|
|
272
|
+
function u(o, r) {
|
|
273
|
+
--o._eventsCount === 0 ? o._events = new n() : delete o._events[r];
|
|
274
274
|
}
|
|
275
275
|
function l() {
|
|
276
276
|
this._events = new n(), this._eventsCount = 0;
|
|
277
277
|
}
|
|
278
278
|
l.prototype.eventNames = function() {
|
|
279
|
-
var o = [],
|
|
279
|
+
var o = [], r, a;
|
|
280
280
|
if (this._eventsCount === 0) return o;
|
|
281
|
-
for (
|
|
282
|
-
s.call(
|
|
283
|
-
return Object.getOwnPropertySymbols ? o.concat(Object.getOwnPropertySymbols(
|
|
281
|
+
for (a in r = this._events)
|
|
282
|
+
s.call(r, a) && o.push(t ? a.slice(1) : a);
|
|
283
|
+
return Object.getOwnPropertySymbols ? o.concat(Object.getOwnPropertySymbols(r)) : o;
|
|
284
284
|
}, l.prototype.listeners = function(o) {
|
|
285
|
-
var
|
|
286
|
-
if (!
|
|
287
|
-
if (
|
|
288
|
-
for (var
|
|
289
|
-
g[
|
|
285
|
+
var r = t ? t + o : o, a = this._events[r];
|
|
286
|
+
if (!a) return [];
|
|
287
|
+
if (a.fn) return [a.fn];
|
|
288
|
+
for (var c = 0, k = a.length, g = new Array(k); c < k; c++)
|
|
289
|
+
g[c] = a[c].fn;
|
|
290
290
|
return g;
|
|
291
291
|
}, l.prototype.listenerCount = function(o) {
|
|
292
|
-
var
|
|
293
|
-
return
|
|
294
|
-
}, l.prototype.emit = function(o, a, c,
|
|
295
|
-
var
|
|
296
|
-
if (!this._events[
|
|
297
|
-
var
|
|
298
|
-
if (
|
|
299
|
-
switch (
|
|
292
|
+
var r = t ? t + o : o, a = this._events[r];
|
|
293
|
+
return a ? a.fn ? 1 : a.length : 0;
|
|
294
|
+
}, l.prototype.emit = function(o, r, a, c, k, g) {
|
|
295
|
+
var _ = t ? t + o : o;
|
|
296
|
+
if (!this._events[_]) return !1;
|
|
297
|
+
var p = this._events[_], S = arguments.length, b, h;
|
|
298
|
+
if (p.fn) {
|
|
299
|
+
switch (p.once && this.removeListener(o, p.fn, void 0, !0), S) {
|
|
300
300
|
case 1:
|
|
301
|
-
return
|
|
301
|
+
return p.fn.call(p.context), !0;
|
|
302
302
|
case 2:
|
|
303
|
-
return
|
|
303
|
+
return p.fn.call(p.context, r), !0;
|
|
304
304
|
case 3:
|
|
305
|
-
return
|
|
305
|
+
return p.fn.call(p.context, r, a), !0;
|
|
306
306
|
case 4:
|
|
307
|
-
return
|
|
307
|
+
return p.fn.call(p.context, r, a, c), !0;
|
|
308
308
|
case 5:
|
|
309
|
-
return
|
|
309
|
+
return p.fn.call(p.context, r, a, c, k), !0;
|
|
310
310
|
case 6:
|
|
311
|
-
return
|
|
311
|
+
return p.fn.call(p.context, r, a, c, k, g), !0;
|
|
312
312
|
}
|
|
313
|
-
for (
|
|
314
|
-
|
|
315
|
-
|
|
313
|
+
for (h = 1, b = new Array(S - 1); h < S; h++)
|
|
314
|
+
b[h - 1] = arguments[h];
|
|
315
|
+
p.fn.apply(p.context, b);
|
|
316
316
|
} else {
|
|
317
|
-
var
|
|
318
|
-
for (
|
|
319
|
-
switch (h
|
|
317
|
+
var x = p.length, y;
|
|
318
|
+
for (h = 0; h < x; h++)
|
|
319
|
+
switch (p[h].once && this.removeListener(o, p[h].fn, void 0, !0), S) {
|
|
320
320
|
case 1:
|
|
321
|
-
h
|
|
321
|
+
p[h].fn.call(p[h].context);
|
|
322
322
|
break;
|
|
323
323
|
case 2:
|
|
324
|
-
h
|
|
324
|
+
p[h].fn.call(p[h].context, r);
|
|
325
325
|
break;
|
|
326
326
|
case 3:
|
|
327
|
-
h
|
|
327
|
+
p[h].fn.call(p[h].context, r, a);
|
|
328
328
|
break;
|
|
329
329
|
case 4:
|
|
330
|
-
h
|
|
330
|
+
p[h].fn.call(p[h].context, r, a, c);
|
|
331
331
|
break;
|
|
332
332
|
default:
|
|
333
|
-
if (!
|
|
334
|
-
|
|
335
|
-
h
|
|
333
|
+
if (!b) for (y = 1, b = new Array(S - 1); y < S; y++)
|
|
334
|
+
b[y - 1] = arguments[y];
|
|
335
|
+
p[h].fn.apply(p[h].context, b);
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
return !0;
|
|
339
|
-
}, l.prototype.on = function(o,
|
|
340
|
-
return d(this, o,
|
|
341
|
-
}, l.prototype.once = function(o,
|
|
342
|
-
return d(this, o,
|
|
343
|
-
}, l.prototype.removeListener = function(o, a, c
|
|
344
|
-
var
|
|
345
|
-
if (!this._events[
|
|
346
|
-
if (!
|
|
347
|
-
return u(this,
|
|
348
|
-
var g = this._events[
|
|
339
|
+
}, l.prototype.on = function(o, r, a) {
|
|
340
|
+
return d(this, o, r, a, !1);
|
|
341
|
+
}, l.prototype.once = function(o, r, a) {
|
|
342
|
+
return d(this, o, r, a, !0);
|
|
343
|
+
}, l.prototype.removeListener = function(o, r, a, c) {
|
|
344
|
+
var k = t ? t + o : o;
|
|
345
|
+
if (!this._events[k]) return this;
|
|
346
|
+
if (!r)
|
|
347
|
+
return u(this, k), this;
|
|
348
|
+
var g = this._events[k];
|
|
349
349
|
if (g.fn)
|
|
350
|
-
g.fn ===
|
|
350
|
+
g.fn === r && (!c || g.once) && (!a || g.context === a) && u(this, k);
|
|
351
351
|
else {
|
|
352
|
-
for (var
|
|
353
|
-
(g[
|
|
354
|
-
|
|
352
|
+
for (var _ = 0, p = [], S = g.length; _ < S; _++)
|
|
353
|
+
(g[_].fn !== r || c && !g[_].once || a && g[_].context !== a) && p.push(g[_]);
|
|
354
|
+
p.length ? this._events[k] = p.length === 1 ? p[0] : p : u(this, k);
|
|
355
355
|
}
|
|
356
356
|
return this;
|
|
357
357
|
}, l.prototype.removeAllListeners = function(o) {
|
|
358
|
-
var
|
|
359
|
-
return o ? (
|
|
358
|
+
var r;
|
|
359
|
+
return o ? (r = t ? t + o : o, this._events[r] && u(this, r)) : (this._events = new n(), this._eventsCount = 0), this;
|
|
360
360
|
}, l.prototype.off = l.prototype.removeListener, l.prototype.addListener = l.prototype.on, l.prefixed = t, l.EventEmitter = l, e.exports = l;
|
|
361
|
-
})(
|
|
361
|
+
})($e)), $e.exports;
|
|
362
362
|
}
|
|
363
|
-
|
|
364
|
-
class
|
|
363
|
+
bt();
|
|
364
|
+
class _t extends Error {
|
|
365
365
|
}
|
|
366
|
-
|
|
367
|
-
var
|
|
366
|
+
_t.prototype.name = "InvalidTokenError";
|
|
367
|
+
var wt = typeof global == "object" && global && global.Object === Object && global, kt = typeof self == "object" && self && self.Object === Object && self, xt = wt || kt || Function("return this")(), oe = xt.Symbol;
|
|
368
368
|
oe && oe.toStringTag;
|
|
369
369
|
oe && oe.toStringTag;
|
|
370
370
|
var Q = /* @__PURE__ */ ((e) => (e.INIT = "init", e.VERIFYING = "verifying", e.VERIFIED = "verified", e.REFRESH = "refresh", e.ERROR = "error", e))(Q || {});
|
|
371
|
-
const
|
|
372
|
-
const e =
|
|
371
|
+
const he = Te("auth", () => {
|
|
372
|
+
const e = N("awesomeAuth"), s = !e && Ke(), t = $(!1), n = $(!1), i = $(), d = !!e, u = Y(() => e ? e.root : "");
|
|
373
373
|
async function l() {
|
|
374
374
|
return e ? e.accessToken : s ? await s.getAccessTokenSilently() : "";
|
|
375
375
|
}
|
|
376
376
|
function o() {
|
|
377
377
|
e ? e.doSignIn() : s && s.loginWithPopup();
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
e ? e.doSignOut() : s && s.logout(
|
|
379
|
+
function r(c) {
|
|
380
|
+
e ? e.doSignOut() : s && s.logout(c);
|
|
381
381
|
}
|
|
382
|
-
async function c
|
|
383
|
-
e && await e.renderButton(
|
|
382
|
+
async function a(c, k) {
|
|
383
|
+
e && await e.renderButton(c, k);
|
|
384
384
|
}
|
|
385
|
-
return e ? (e.on(Q.INIT, (
|
|
386
|
-
n.value =
|
|
387
|
-
}), e.on(Q.VERIFYING, (
|
|
388
|
-
n.value =
|
|
389
|
-
}), e.on(Q.VERIFIED, (
|
|
390
|
-
t.value =
|
|
391
|
-
}), n.value = e.isVerifying, t.value = e.isVerified,
|
|
385
|
+
return e ? (e.on(Q.INIT, (c) => {
|
|
386
|
+
n.value = c, c && (t.value = !1);
|
|
387
|
+
}), e.on(Q.VERIFYING, (c) => {
|
|
388
|
+
n.value = c;
|
|
389
|
+
}), e.on(Q.VERIFIED, (c) => {
|
|
390
|
+
t.value = c, i.value = c ? e.user : void 0;
|
|
391
|
+
}), n.value = e.isVerifying, t.value = e.isVerified, i.value = e.user) : s && (G(
|
|
392
392
|
s.isLoading,
|
|
393
|
-
(
|
|
394
|
-
n.value =
|
|
393
|
+
(c) => {
|
|
394
|
+
n.value = c;
|
|
395
395
|
},
|
|
396
396
|
{ immediate: !0 }
|
|
397
397
|
), G(
|
|
398
398
|
s.isAuthenticated,
|
|
399
|
-
(
|
|
400
|
-
t.value =
|
|
399
|
+
(c) => {
|
|
400
|
+
t.value = c;
|
|
401
401
|
},
|
|
402
402
|
{ immediate: !0 }
|
|
403
403
|
), G(
|
|
404
404
|
s.user,
|
|
405
|
-
(
|
|
406
|
-
|
|
405
|
+
(c) => {
|
|
406
|
+
i.value = c;
|
|
407
407
|
},
|
|
408
408
|
{ immediate: !0 }
|
|
409
409
|
)), {
|
|
@@ -411,25 +411,25 @@ const fe = Se("auth", () => {
|
|
|
411
411
|
isAwesomeAuth: d,
|
|
412
412
|
isLoading: n,
|
|
413
413
|
authEndpoint: u,
|
|
414
|
-
user:
|
|
414
|
+
user: i,
|
|
415
415
|
getAccessToken: l,
|
|
416
|
-
renderGoogleButton:
|
|
416
|
+
renderGoogleButton: a,
|
|
417
417
|
login: o,
|
|
418
|
-
logout:
|
|
418
|
+
logout: r
|
|
419
419
|
};
|
|
420
|
-
}),
|
|
420
|
+
}), At = { class: "ac-form-control bg-base-200 rounded-lg" }, It = {
|
|
421
421
|
class: "sr-only",
|
|
422
422
|
for: "ac-comment"
|
|
423
|
-
},
|
|
423
|
+
}, $t = ["placeholder"], Ct = { class: "p-2 rounded-b-lg bg-base-300 flex items-center relative" }, Et = {
|
|
424
424
|
key: 1,
|
|
425
425
|
class: "ac-alert ac-alert-error ms-4 me-auto py-1"
|
|
426
|
-
},
|
|
426
|
+
}, St = ["disabled"], Tt = {
|
|
427
427
|
key: 0,
|
|
428
428
|
class: "ac-loading ac-loading-spinner"
|
|
429
|
-
},
|
|
429
|
+
}, Lt = {
|
|
430
430
|
name: "CommentForm"
|
|
431
|
-
}, ee = /* @__PURE__ */
|
|
432
|
-
...
|
|
431
|
+
}, ee = /* @__PURE__ */ D({
|
|
432
|
+
...Lt,
|
|
433
433
|
props: {
|
|
434
434
|
noVersion: { type: Boolean },
|
|
435
435
|
currentId: {},
|
|
@@ -440,65 +440,65 @@ const fe = Se("auth", () => {
|
|
|
440
440
|
},
|
|
441
441
|
emits: ["close", "update"],
|
|
442
442
|
setup(e, { emit: s }) {
|
|
443
|
-
const t = e, n = s,
|
|
444
|
-
let
|
|
445
|
-
function
|
|
443
|
+
const t = e, n = s, i = he(), d = J(), { t: u } = U(), l = N("ApiBaseUrl"), o = N("Auth0Domain"), r = N("siteId"), a = N("TurnstileSiteKey"), c = N("AutoFocus"), k = "0.10.6", g = $(), _ = $(), p = $(!1), S = $(t.content || ""), b = $(""), h = $(!1), x = $(""), y = $(""), w = Y(() => !i.isAuthenticated);
|
|
444
|
+
let C = null;
|
|
445
|
+
function F() {
|
|
446
446
|
if (typeof window > "u") return Promise.reject(new Error("Turnstile 仅支持浏览器环境"));
|
|
447
447
|
if (window.turnstile) return Promise.resolve();
|
|
448
|
-
if (
|
|
449
|
-
const
|
|
450
|
-
return
|
|
451
|
-
const W = document.querySelector(`script[src="${
|
|
452
|
-
function
|
|
453
|
-
|
|
448
|
+
if (C) return C;
|
|
449
|
+
const T = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit";
|
|
450
|
+
return C = new Promise((L, z) => {
|
|
451
|
+
const W = document.querySelector(`script[src="${T}"]`), R = W || document.createElement("script");
|
|
452
|
+
function ve() {
|
|
453
|
+
L();
|
|
454
454
|
}
|
|
455
455
|
function X() {
|
|
456
456
|
z(new Error("Failed to load Turnstile script"));
|
|
457
457
|
}
|
|
458
|
-
|
|
459
|
-
}),
|
|
460
|
-
|
|
461
|
-
}),
|
|
458
|
+
R.addEventListener("load", ve, { once: !0 }), R.addEventListener("error", X, { once: !0 }), W || (R.src = T, R.async = !0, R.defer = !0, document.head.appendChild(R));
|
|
459
|
+
}), C.catch(() => {
|
|
460
|
+
C = null;
|
|
461
|
+
}), C;
|
|
462
462
|
}
|
|
463
|
-
async function
|
|
464
|
-
if (!(!
|
|
465
|
-
if (await
|
|
466
|
-
|
|
463
|
+
async function K() {
|
|
464
|
+
if (!(!a || !_.value)) {
|
|
465
|
+
if (await F(), !window.turnstile) {
|
|
466
|
+
b.value = "Turnstile initialization failed";
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
|
-
if (
|
|
470
|
-
window.turnstile.reset(
|
|
469
|
+
if (y.value) {
|
|
470
|
+
window.turnstile.reset(y.value);
|
|
471
471
|
return;
|
|
472
472
|
}
|
|
473
|
-
|
|
474
|
-
sitekey:
|
|
473
|
+
y.value = window.turnstile.render(_.value, {
|
|
474
|
+
sitekey: a,
|
|
475
475
|
size: "compact",
|
|
476
|
-
callback: (
|
|
477
|
-
|
|
476
|
+
callback: (T) => {
|
|
477
|
+
x.value = T, b.value = "";
|
|
478
478
|
},
|
|
479
479
|
"expired-callback": () => {
|
|
480
|
-
|
|
480
|
+
x.value = "";
|
|
481
481
|
},
|
|
482
482
|
"error-callback": () => {
|
|
483
|
-
|
|
483
|
+
x.value = "", b.value = "Turnstile validation failed, please try again.";
|
|
484
484
|
}
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
-
function
|
|
489
|
-
if (!
|
|
490
|
-
|
|
488
|
+
function Z() {
|
|
489
|
+
if (!y.value || !window.turnstile) {
|
|
490
|
+
x.value = "";
|
|
491
491
|
return;
|
|
492
492
|
}
|
|
493
493
|
try {
|
|
494
|
-
window.turnstile.remove(
|
|
494
|
+
window.turnstile.remove(y.value);
|
|
495
495
|
} catch {
|
|
496
|
-
window.turnstile.reset(
|
|
496
|
+
window.turnstile.reset(y.value);
|
|
497
497
|
}
|
|
498
|
-
|
|
498
|
+
y.value = "", x.value = "";
|
|
499
499
|
}
|
|
500
500
|
function ae() {
|
|
501
|
-
return
|
|
501
|
+
return i.user ? i.user : {
|
|
502
502
|
sub: "anonymous",
|
|
503
503
|
name: "anonymous",
|
|
504
504
|
nickname: "anonymous",
|
|
@@ -506,251 +506,251 @@ const fe = Se("auth", () => {
|
|
|
506
506
|
email: ""
|
|
507
507
|
};
|
|
508
508
|
}
|
|
509
|
-
async function q(
|
|
510
|
-
if (!
|
|
511
|
-
if (!
|
|
512
|
-
return
|
|
513
|
-
if (
|
|
514
|
-
await
|
|
509
|
+
async function q(T) {
|
|
510
|
+
if (!i.isAuthenticated) {
|
|
511
|
+
if (!a)
|
|
512
|
+
return O();
|
|
513
|
+
if (h.value = !0, !x.value) {
|
|
514
|
+
await de(), await K();
|
|
515
515
|
return;
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
if (
|
|
519
|
-
const
|
|
520
|
-
if (!
|
|
521
|
-
if (!
|
|
522
|
-
|
|
518
|
+
if (T.target.matches(":invalid")) return;
|
|
519
|
+
const L = S.value.trim();
|
|
520
|
+
if (!L) return;
|
|
521
|
+
if (!dt(L).valid) {
|
|
522
|
+
b.value = "We encourage meaningful contributions to foster a positive community. Thank you for your understanding!";
|
|
523
523
|
return;
|
|
524
524
|
}
|
|
525
|
-
|
|
525
|
+
p.value = !0, b.value = "";
|
|
526
526
|
let z = l + "/api/comment", W = "POST";
|
|
527
527
|
t.currentId && (z += "/" + t.currentId, W = "PATCH");
|
|
528
528
|
try {
|
|
529
|
-
const
|
|
529
|
+
const R = i.isAuthenticated ? await i.getAccessToken() : "", X = {
|
|
530
530
|
"Content-Type": "application/json",
|
|
531
|
-
"Auth-Endpoint":
|
|
531
|
+
"Auth-Endpoint": i.authEndpoint
|
|
532
532
|
};
|
|
533
|
-
|
|
534
|
-
const
|
|
533
|
+
R && (X.Authorization = `Bearer ${R}`);
|
|
534
|
+
const Re = w.value ? {
|
|
535
535
|
referrer: document.referrer || "",
|
|
536
536
|
language: navigator.language || "",
|
|
537
537
|
languages: navigator.languages || [],
|
|
538
538
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone || "",
|
|
539
539
|
platform: navigator.platform || ""
|
|
540
|
-
} : null,
|
|
540
|
+
} : null, Oe = w.value ? {
|
|
541
541
|
custom: window.custom_comment_data ?? null,
|
|
542
|
-
anonymous:
|
|
543
|
-
} : window.custom_comment_data,
|
|
542
|
+
anonymous: Re
|
|
543
|
+
} : window.custom_comment_data, ge = await fetch(z, {
|
|
544
544
|
method: W,
|
|
545
545
|
headers: X,
|
|
546
546
|
body: JSON.stringify({
|
|
547
|
-
comment:
|
|
547
|
+
comment: L,
|
|
548
548
|
postId: d.postId,
|
|
549
|
-
siteId:
|
|
549
|
+
siteId: r,
|
|
550
550
|
domain: o,
|
|
551
551
|
ancestorId: t.ancestorId ? Number(t.ancestorId) : void 0,
|
|
552
552
|
parentId: t.parentId ? Number(t.parentId) : void 0,
|
|
553
553
|
status: t.status,
|
|
554
554
|
window: `${window.innerWidth}x${window.innerHeight} / ${screen.width, screen.height}`,
|
|
555
|
-
customData:
|
|
555
|
+
customData: Oe,
|
|
556
556
|
extraData: `${window.BM_LEVEL}:${window.BM_VALUE}`,
|
|
557
|
-
turnstileToken:
|
|
557
|
+
turnstileToken: w.value ? x.value : void 0
|
|
558
558
|
})
|
|
559
|
-
}),
|
|
560
|
-
if (!
|
|
561
|
-
|
|
559
|
+
}), ie = await ge.json();
|
|
560
|
+
if (!ge.ok || ie.message) {
|
|
561
|
+
b.value = "Failed to post comment: " + (ie.message || "Unknown"), p.value = !1;
|
|
562
562
|
return;
|
|
563
563
|
}
|
|
564
|
-
const { id:
|
|
565
|
-
t.ancestorId || t.parentId ? d.addComment(
|
|
566
|
-
} catch (
|
|
567
|
-
|
|
564
|
+
const { id: ye, status: be } = ie.data, _e = ae();
|
|
565
|
+
t.ancestorId || t.parentId ? d.addComment(ye, L, _e, be, t.ancestorId, t.parentId) : t.currentId ? n("update", L) : d.addComment(ye, L, _e, be), S.value = "", n("close"), w.value && (Z(), h.value = !1);
|
|
566
|
+
} catch (R) {
|
|
567
|
+
b.value = R.message || String(R);
|
|
568
568
|
}
|
|
569
|
-
|
|
569
|
+
p.value = !1;
|
|
570
570
|
}
|
|
571
|
-
function
|
|
572
|
-
|
|
571
|
+
function O() {
|
|
572
|
+
i.login();
|
|
573
573
|
}
|
|
574
|
-
function
|
|
575
|
-
|
|
574
|
+
function P(T) {
|
|
575
|
+
lt(T, "Enter") && q(T);
|
|
576
576
|
}
|
|
577
|
-
function
|
|
577
|
+
function re() {
|
|
578
578
|
n("close");
|
|
579
579
|
}
|
|
580
580
|
return se(() => {
|
|
581
|
-
|
|
581
|
+
(c || t.currentId) && g.value?.focus();
|
|
582
582
|
}), G(
|
|
583
|
-
() =>
|
|
584
|
-
async (
|
|
585
|
-
!
|
|
583
|
+
() => h.value,
|
|
584
|
+
async (T) => {
|
|
585
|
+
!T || i.isAuthenticated || (await de(), await K());
|
|
586
586
|
}
|
|
587
587
|
), G(
|
|
588
|
-
() =>
|
|
589
|
-
(
|
|
590
|
-
|
|
588
|
+
() => i.isAuthenticated,
|
|
589
|
+
(T) => {
|
|
590
|
+
T && (h.value = !1, Z());
|
|
591
591
|
}
|
|
592
|
-
), (
|
|
592
|
+
), (T, L) => (f(), v("form", {
|
|
593
593
|
class: "mb-6",
|
|
594
|
-
onSubmit:
|
|
594
|
+
onSubmit: ce(q, ["prevent"])
|
|
595
595
|
}, [
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
596
|
+
A("div", At, [
|
|
597
|
+
A("label", It, I(m(u)("your_comment")), 1),
|
|
598
|
+
Me(A("textarea", {
|
|
599
599
|
id: "ac-comment",
|
|
600
600
|
ref_key: "textarea",
|
|
601
|
-
ref:
|
|
602
|
-
"onUpdate:modelValue":
|
|
601
|
+
ref: g,
|
|
602
|
+
"onUpdate:modelValue": L[0] || (L[0] = (z) => S.value = z),
|
|
603
603
|
placeholder: m(u)("placeholder"),
|
|
604
604
|
class: "ac-textarea ac-textarea-bordered bg-base-200 rounded-b-none focus:outline-none",
|
|
605
605
|
required: "",
|
|
606
606
|
rows: "3",
|
|
607
607
|
onKeydown: [
|
|
608
|
-
|
|
608
|
+
L[1] || (L[1] = ce(() => {
|
|
609
609
|
}, ["stop"])),
|
|
610
|
-
|
|
611
|
-
|
|
610
|
+
we(P, ["enter"]),
|
|
611
|
+
we(re, ["esc"])
|
|
612
612
|
],
|
|
613
|
-
onKeyup:
|
|
613
|
+
onKeyup: L[2] || (L[2] = ce(() => {
|
|
614
614
|
}, ["stop"]))
|
|
615
|
-
}, null, 40,
|
|
616
|
-
[
|
|
615
|
+
}, null, 40, $t), [
|
|
616
|
+
[Pe, S.value]
|
|
617
617
|
]),
|
|
618
|
-
|
|
618
|
+
A("div", Ct, [
|
|
619
619
|
e.noVersion ? E("", !0) : (f(), v("div", {
|
|
620
620
|
key: 0,
|
|
621
|
-
class:
|
|
622
|
-
}, " v" +
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
m(
|
|
621
|
+
class: me(["text-xs text-neutral-400/40", { "me-auto": !b.value }])
|
|
622
|
+
}, " v" + I(m(k)), 3)),
|
|
623
|
+
b.value ? (f(), v("div", Et, I(b.value), 1)) : E("", !0),
|
|
624
|
+
h.value && !m(i).isAuthenticated ? (f(), v(M, { key: 2 }, [
|
|
625
|
+
m(i).isAwesomeAuth ? E("", !0) : (f(), v("button", {
|
|
626
626
|
key: 0,
|
|
627
627
|
class: "ac-btn ac-btn-secondary ac-btn-xs mx-4",
|
|
628
628
|
type: "button",
|
|
629
|
-
onClick:
|
|
630
|
-
},
|
|
631
|
-
m(
|
|
629
|
+
onClick: O
|
|
630
|
+
}, I(m(u)("login")), 1)),
|
|
631
|
+
m(a) ? (f(), v("div", {
|
|
632
632
|
key: 1,
|
|
633
633
|
ref_key: "turnstileContainer",
|
|
634
|
-
ref:
|
|
634
|
+
ref: _,
|
|
635
635
|
class: "absolute right-2 top-10"
|
|
636
636
|
}, null, 512)) : E("", !0)
|
|
637
637
|
], 64)) : E("", !0),
|
|
638
|
-
|
|
639
|
-
disabled:
|
|
638
|
+
A("button", {
|
|
639
|
+
disabled: p.value || h.value && !m(i).isAuthenticated && !x.value,
|
|
640
640
|
class: "ac-btn ac-btn-primary ac-btn-sm"
|
|
641
641
|
}, [
|
|
642
|
-
|
|
642
|
+
p.value ? (f(), v("span", Tt)) : E("", !0),
|
|
643
643
|
e.currentId ? (f(), v(M, { key: 1 }, [
|
|
644
|
-
H(
|
|
644
|
+
H(I(m(u)("save_editing")), 1)
|
|
645
645
|
], 64)) : e.parentId ? (f(), v(M, { key: 2 }, [
|
|
646
|
-
H(
|
|
646
|
+
H(I(m(u)("post_reply")), 1)
|
|
647
647
|
], 64)) : (f(), v(M, { key: 3 }, [
|
|
648
|
-
H(
|
|
648
|
+
H(I(m(u)("post_comment")), 1)
|
|
649
649
|
], 64))
|
|
650
|
-
], 8,
|
|
650
|
+
], 8, St)
|
|
651
651
|
])
|
|
652
652
|
])
|
|
653
653
|
], 32));
|
|
654
654
|
}
|
|
655
|
-
}),
|
|
655
|
+
}), Nt = { class: "flex items-center gap-2" }, Rt = ["aria-label", "title", "disabled"], Ot = {
|
|
656
656
|
key: 0,
|
|
657
657
|
class: "ac-loading ac-loading-spinner"
|
|
658
|
-
},
|
|
658
|
+
}, Mt = { class: "text-sm text-gray-500 dark:text-gray-400" }, Pt = ["aria-label", "title", "disabled"], jt = {
|
|
659
659
|
key: 0,
|
|
660
660
|
class: "ac-loading ac-loading-spinner"
|
|
661
|
-
},
|
|
661
|
+
}, Bt = ["aria-label", "title"], le = "awesome-comment-likes", Dt = /* @__PURE__ */ D({
|
|
662
662
|
__name: "comment-actions",
|
|
663
663
|
props: {
|
|
664
664
|
comment: {}
|
|
665
665
|
},
|
|
666
666
|
emits: ["reply"],
|
|
667
667
|
setup(e, { emit: s }) {
|
|
668
|
-
const t = e, n = s,
|
|
669
|
-
async function a
|
|
668
|
+
const t = e, n = s, i = J(), { t: d } = U(), u = N("ApiBaseUrl"), l = N("siteId"), o = $(0);
|
|
669
|
+
async function r(a = !0) {
|
|
670
670
|
if (o.value) return;
|
|
671
|
-
const
|
|
672
|
-
if (
|
|
673
|
-
const
|
|
674
|
-
if (
|
|
675
|
-
|
|
676
|
-
like: Math.max((t.comment.like || 0) + (
|
|
671
|
+
const c = localStorage.getItem(le);
|
|
672
|
+
if (c) {
|
|
673
|
+
const _ = JSON.parse(c), p = Date.now(), S = _[t.comment.id];
|
|
674
|
+
if (_[t.comment.id] = p, localStorage.setItem(le, JSON.stringify(_)), S && p - S < 6e4) {
|
|
675
|
+
i.updateComment(t.comment.id, {
|
|
676
|
+
like: Math.max((t.comment.like || 0) + (a ? 1 : -1), 0)
|
|
677
677
|
});
|
|
678
678
|
return;
|
|
679
679
|
}
|
|
680
680
|
} else
|
|
681
|
-
localStorage.setItem(
|
|
682
|
-
o.value =
|
|
681
|
+
localStorage.setItem(le, JSON.stringify({ [t.comment.id]: Date.now() }));
|
|
682
|
+
o.value = a ? 1 : -1;
|
|
683
683
|
const g = await (await fetch(`${u}/api/like/${t.comment.id}`, {
|
|
684
684
|
method: "POST",
|
|
685
685
|
headers: {
|
|
686
686
|
"Content-Type": "application/json"
|
|
687
687
|
},
|
|
688
688
|
body: JSON.stringify({
|
|
689
|
-
like:
|
|
689
|
+
like: a,
|
|
690
690
|
postId: t.comment.postId,
|
|
691
691
|
siteId: l
|
|
692
692
|
})
|
|
693
693
|
})).json();
|
|
694
|
-
|
|
694
|
+
i.updateComment(t.comment.id, {
|
|
695
695
|
like: g.data?.like || 0
|
|
696
696
|
}), o.value = 0;
|
|
697
697
|
}
|
|
698
|
-
return (
|
|
699
|
-
|
|
698
|
+
return (a, c) => (f(), v("div", Nt, [
|
|
699
|
+
A("button", {
|
|
700
700
|
"aria-label": m(d)("like"),
|
|
701
701
|
title: m(d)("like"),
|
|
702
702
|
class: "ac-btn ac-btn-sm ac-btn-circle border-0 shadow-none",
|
|
703
703
|
disabled: o.value !== 0,
|
|
704
704
|
type: "button",
|
|
705
|
-
onClick:
|
|
705
|
+
onClick: c[0] || (c[0] = (k) => r())
|
|
706
706
|
}, [
|
|
707
|
-
o.value > 0 ? (f(), v("span",
|
|
707
|
+
o.value > 0 ? (f(), v("span", Ot)) : (f(), j(m(Ge), {
|
|
708
708
|
key: 1,
|
|
709
709
|
size: 16
|
|
710
710
|
}))
|
|
711
|
-
], 8,
|
|
712
|
-
|
|
713
|
-
|
|
711
|
+
], 8, Rt),
|
|
712
|
+
A("span", Mt, I(e.comment.like || 0), 1),
|
|
713
|
+
A("button", {
|
|
714
714
|
"aria-label": m(d)("dislike"),
|
|
715
715
|
title: m(d)("dislike"),
|
|
716
716
|
class: "ac-btn ac-btn-sm ac-btn-circle border-0 shadow-none",
|
|
717
717
|
disabled: o.value !== 0,
|
|
718
718
|
type: "button",
|
|
719
|
-
onClick:
|
|
719
|
+
onClick: c[1] || (c[1] = (k) => r(!1))
|
|
720
720
|
}, [
|
|
721
|
-
o.value < 0 ? (f(), v("span",
|
|
721
|
+
o.value < 0 ? (f(), v("span", jt)) : (f(), j(m(He), {
|
|
722
722
|
key: 1,
|
|
723
723
|
size: 16
|
|
724
724
|
}))
|
|
725
|
-
], 8,
|
|
726
|
-
|
|
725
|
+
], 8, Pt),
|
|
726
|
+
A("button", {
|
|
727
727
|
"aria-label": m(d)("reply"),
|
|
728
728
|
title: m(d)("reply"),
|
|
729
729
|
class: "ac-btn ac-btn-sm ac-btn-circle border-0 shadow-none -me-1.5",
|
|
730
730
|
type: "button",
|
|
731
|
-
onClick:
|
|
731
|
+
onClick: c[2] || (c[2] = (k) => n("reply"))
|
|
732
732
|
}, [
|
|
733
|
-
|
|
734
|
-
], 8,
|
|
733
|
+
B(m(Je), { size: 16 })
|
|
734
|
+
], 8, Bt)
|
|
735
735
|
]));
|
|
736
736
|
}
|
|
737
|
-
}),
|
|
737
|
+
}), Ut = ["href"], Ft = ["innerHTML"], Kt = {
|
|
738
738
|
key: 1,
|
|
739
739
|
class: "text-gray-500 break-words overflow-x-auto whitespace-pre-line pb-3 mb-0 dark:text-gray-400"
|
|
740
|
-
},
|
|
740
|
+
}, zt = ["href"], Vt = /* @__PURE__ */ D({
|
|
741
741
|
__name: "comment-content",
|
|
742
742
|
props: {
|
|
743
743
|
ancestorId: {},
|
|
744
744
|
comment: {}
|
|
745
745
|
},
|
|
746
746
|
setup(e) {
|
|
747
|
-
const s = e, { t } =
|
|
748
|
-
function
|
|
749
|
-
return
|
|
747
|
+
const s = e, { t } = U(), n = J();
|
|
748
|
+
function i(u) {
|
|
749
|
+
return Ye(u).replace(/<a/g, '<a target="_blank"');
|
|
750
750
|
}
|
|
751
751
|
function d(u) {
|
|
752
752
|
if (s.ancestorId) {
|
|
753
|
-
const o = n.comments[s.ancestorId]?.children?.find((
|
|
753
|
+
const o = n.comments[s.ancestorId]?.children?.find((r) => Number(r.id) === Number(u));
|
|
754
754
|
return o?.isAdmin ? t("admin") : o?.user?.name || o?.user?.email || "";
|
|
755
755
|
}
|
|
756
756
|
return "";
|
|
@@ -761,37 +761,37 @@ const fe = Se("auth", () => {
|
|
|
761
761
|
href: `#awcm-${e.comment.parentId}`,
|
|
762
762
|
class: "inline-block px-2 py-1 rounded-lg mt-2 bg-base-300 text-gray-500 dark:bg-neutral-400/20 dark:text-gray-400",
|
|
763
763
|
target: "_self"
|
|
764
|
-
}, "@" +
|
|
765
|
-
|
|
764
|
+
}, "@" + I(d(e.comment.parentId)), 9, Ut)) : E("", !0),
|
|
765
|
+
A("article", {
|
|
766
766
|
class: "text-gray-500 break-words overflow-x-auto dark:text-gray-400",
|
|
767
|
-
innerHTML:
|
|
768
|
-
}, null, 8,
|
|
769
|
-
], 64)) : (f(), v("p",
|
|
767
|
+
innerHTML: i(e.comment.content)
|
|
768
|
+
}, null, 8, Ft)
|
|
769
|
+
], 64)) : (f(), v("p", Kt, [
|
|
770
770
|
e.comment.parentId && e.comment.parentId !== e.comment.ancestorId ? (f(), v("a", {
|
|
771
771
|
key: 0,
|
|
772
772
|
href: `#awcm-${e.comment.parentId}`,
|
|
773
773
|
class: "inline-block px-2 py-1 rounded-lg me-1 bg-base-300 text-gray-500 dark:bg-neutral-400/20 dark:text-gray-400",
|
|
774
774
|
target: "_self"
|
|
775
|
-
}, "@" +
|
|
776
|
-
H(
|
|
775
|
+
}, "@" + I(d(e.comment.parentId)), 9, zt)) : E("", !0),
|
|
776
|
+
H(I(e.comment.content), 1)
|
|
777
777
|
]));
|
|
778
778
|
}
|
|
779
779
|
});
|
|
780
|
-
function
|
|
780
|
+
function Gt(e) {
|
|
781
781
|
let s = 0;
|
|
782
782
|
for (let n = 0; n < e.length; n++)
|
|
783
783
|
s = e.charCodeAt(n) + ((s << 5) - s);
|
|
784
784
|
let t = "#";
|
|
785
785
|
for (let n = 0; n < 3; n++) {
|
|
786
|
-
const
|
|
787
|
-
t += ("00" +
|
|
786
|
+
const i = s >> n * 8 & 255;
|
|
787
|
+
t += ("00" + i.toString(16)).slice(-2);
|
|
788
788
|
}
|
|
789
789
|
return t;
|
|
790
790
|
}
|
|
791
|
-
const
|
|
791
|
+
const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text-white" }, Jt = { class: "ac-avatar" }, Wt = {
|
|
792
792
|
key: 0,
|
|
793
793
|
class: "w-6 h-6"
|
|
794
|
-
},
|
|
794
|
+
}, Yt = ["alt", "src"], Zt = { class: "text-neutral-content mix-blend-color-dodge uppercase font-bold leading-6" }, qt = ["data-tip"], Xt = ["href"], Qt = ["datetime", "title"], en = /* @__PURE__ */ D({
|
|
795
795
|
__name: "comment-header",
|
|
796
796
|
props: {
|
|
797
797
|
comment: {},
|
|
@@ -800,66 +800,66 @@ const Gt = { class: "flex items-center gap-2 text-sm text-base-content dark:text
|
|
|
800
800
|
},
|
|
801
801
|
emits: ["edit"],
|
|
802
802
|
setup(e, { emit: s }) {
|
|
803
|
-
const t = e, n = s, { t:
|
|
804
|
-
if (t.comment.isAdmin) return
|
|
805
|
-
let l = t.comment.user?.name ||
|
|
806
|
-
return l = l.replace(
|
|
803
|
+
const t = e, n = s, { t: i } = U(), d = Y(() => {
|
|
804
|
+
if (t.comment.isAdmin) return i("admin");
|
|
805
|
+
let l = t.comment.user?.name || i("anonymous");
|
|
806
|
+
return l = l.replace(gt, ""), l;
|
|
807
807
|
});
|
|
808
808
|
function u(l) {
|
|
809
809
|
return `${location.origin}${location.pathname}#awcm-${l}`;
|
|
810
810
|
}
|
|
811
|
-
return (l, o) => (f(), v("div",
|
|
812
|
-
|
|
813
|
-
e.comment.user?.avatar ? (f(), v("div",
|
|
814
|
-
|
|
811
|
+
return (l, o) => (f(), v("div", Ht, [
|
|
812
|
+
A("div", Jt, [
|
|
813
|
+
e.comment.user?.avatar ? (f(), v("div", Wt, [
|
|
814
|
+
A("img", {
|
|
815
815
|
alt: d.value,
|
|
816
816
|
src: e.comment.user?.avatar,
|
|
817
817
|
class: "rounded-full max-w-full max-h-full"
|
|
818
|
-
}, null, 8,
|
|
818
|
+
}, null, 8, Yt)
|
|
819
819
|
])) : (f(), v("div", {
|
|
820
820
|
key: 1,
|
|
821
|
-
style:
|
|
821
|
+
style: je({ "background-color": m(Gt)(d.value) }),
|
|
822
822
|
class: "avatar-char rounded-full w-6 h-6 text-center"
|
|
823
823
|
}, [
|
|
824
|
-
|
|
824
|
+
A("span", Zt, I(d.value.substring(0, 1)), 1)
|
|
825
825
|
], 4))
|
|
826
826
|
]),
|
|
827
|
-
H(" " +
|
|
827
|
+
H(" " + I(d.value) + " ", 1),
|
|
828
828
|
e.comment.isAdmin ? (f(), v("div", {
|
|
829
829
|
key: 0,
|
|
830
|
-
"data-tip": m(
|
|
830
|
+
"data-tip": m(i)("admin"),
|
|
831
831
|
class: "ac-tooltip text-success"
|
|
832
832
|
}, [
|
|
833
|
-
|
|
833
|
+
B(m(We), {
|
|
834
834
|
class: "block",
|
|
835
835
|
size: 18
|
|
836
836
|
})
|
|
837
837
|
], 8, qt)) : E("", !0),
|
|
838
|
-
|
|
838
|
+
A("a", {
|
|
839
839
|
href: u(e.comment.id),
|
|
840
840
|
class: "no-underline hover:underline hover:decoration-green-middle"
|
|
841
841
|
}, [
|
|
842
|
-
|
|
842
|
+
A("time", {
|
|
843
843
|
datetime: e.comment.createdAt.toISOString(),
|
|
844
|
-
title: m(
|
|
844
|
+
title: m(Ae)(e.comment.createdAt),
|
|
845
845
|
class: "text-xs text-gray-600 dark:text-gray-400"
|
|
846
|
-
},
|
|
847
|
-
], 8,
|
|
846
|
+
}, I(m(Ae)(e.comment.createdAt)), 9, Qt)
|
|
847
|
+
], 8, Xt),
|
|
848
848
|
e.isEditable ? (f(), v("button", {
|
|
849
849
|
key: 1,
|
|
850
850
|
class: "ac-btn ac-btn-link ac-btn-xs hover:no-underline",
|
|
851
851
|
type: "button",
|
|
852
|
-
onClick: o[0] || (o[0] = (
|
|
853
|
-
},
|
|
852
|
+
onClick: o[0] || (o[0] = (r) => n("edit"))
|
|
853
|
+
}, I(m(i)("edit")), 1)) : E("", !0)
|
|
854
854
|
]));
|
|
855
855
|
}
|
|
856
|
-
}),
|
|
856
|
+
}), tn = ["id"], nn = { class: "flex justify-between items-center font-sans" }, on = {
|
|
857
857
|
key: 0,
|
|
858
858
|
class: "italic mt-4 text-emerald-600 mb-0 text-sm dark:text-emerald-300"
|
|
859
|
-
},
|
|
859
|
+
}, sn = {
|
|
860
860
|
name: "CommentItem"
|
|
861
|
-
},
|
|
862
|
-
...
|
|
861
|
+
}, an = /* @__PURE__ */ D({
|
|
862
|
+
...sn,
|
|
863
863
|
props: {
|
|
864
864
|
comment: {},
|
|
865
865
|
isFirst: { type: Boolean },
|
|
@@ -868,103 +868,103 @@ const Gt = { class: "flex items-center gap-2 text-sm text-base-content dark:text
|
|
|
868
868
|
ancestorId: {}
|
|
869
869
|
},
|
|
870
870
|
setup(e) {
|
|
871
|
-
const s = e, { t } =
|
|
871
|
+
const s = e, { t } = U(), n = J(), i = he();
|
|
872
872
|
let d;
|
|
873
|
-
const u =
|
|
873
|
+
const u = $(Date.now()), l = $(!1), o = $(!1), r = Y(() => s.comment.userId === i.user?.sub && u.value - s.comment.createdAt.getTime() < 36e5);
|
|
874
874
|
return se(() => {
|
|
875
|
-
|
|
876
|
-
u.value = Date.now(),
|
|
875
|
+
r.value && (d = setInterval(() => {
|
|
876
|
+
u.value = Date.now(), r.value || clearInterval(d);
|
|
877
877
|
}, 1e3));
|
|
878
|
-
}),
|
|
878
|
+
}), Be(() => {
|
|
879
879
|
clearInterval(d);
|
|
880
|
-
}), (
|
|
881
|
-
const
|
|
880
|
+
}), (a, c) => {
|
|
881
|
+
const k = De("comment-item", !0);
|
|
882
882
|
return f(), v("div", {
|
|
883
883
|
id: "awcm-" + e.comment.id,
|
|
884
|
-
class:
|
|
885
|
-
onAnimationend:
|
|
884
|
+
class: me([[{ "animated flash": e.comment.isNew }, e.isFirstLevel ? "mb-4" : e.isFirst ? "-mt-4" : "mt-1"], "comment-item target:outline target:outline-green-500 target:outline-2 dark:target:outline-1"]),
|
|
885
|
+
onAnimationend: c[6] || (c[6] = (g) => m(n).updateComment(e.comment.id, { isNew: !1 }))
|
|
886
886
|
}, [
|
|
887
|
-
|
|
888
|
-
class:
|
|
887
|
+
A("div", {
|
|
888
|
+
class: me(["pt-2 px-4 text-base bg-base-200 dark:bg-gray-900", [{ "rounded-lg": e.isFirstLevel, "rounded-b-lg": e.isLast, "rounded-t-lg shadow-outline-md": e.isFirst }, e.comment.children?.length ? "pb-6" : "pb-3"]])
|
|
889
889
|
}, [
|
|
890
|
-
|
|
891
|
-
|
|
890
|
+
A("header", nn, [
|
|
891
|
+
B(en, {
|
|
892
892
|
comment: e.comment,
|
|
893
|
-
"is-editable":
|
|
893
|
+
"is-editable": r.value,
|
|
894
894
|
"is-editing": l.value,
|
|
895
|
-
onEdit:
|
|
895
|
+
onEdit: c[0] || (c[0] = (g) => l.value = !l.value)
|
|
896
896
|
}, null, 8, ["comment", "is-editable", "is-editing"]),
|
|
897
|
-
|
|
897
|
+
B(Dt, {
|
|
898
898
|
comment: e.comment,
|
|
899
|
-
onReply:
|
|
899
|
+
onReply: c[1] || (c[1] = (g) => o.value = !o.value)
|
|
900
900
|
}, null, 8, ["comment"])
|
|
901
901
|
]),
|
|
902
|
-
|
|
902
|
+
B(Vt, {
|
|
903
903
|
"ancestor-id": e.ancestorId,
|
|
904
904
|
comment: e.comment
|
|
905
905
|
}, null, 8, ["ancestor-id", "comment"]),
|
|
906
|
-
e.comment.status === m(te).Pending ? (f(), v("p",
|
|
906
|
+
e.comment.status === m(te).Pending ? (f(), v("p", on, I(m(t)("approve_hint")), 1)) : E("", !0)
|
|
907
907
|
], 2),
|
|
908
|
-
l.value ? (f(),
|
|
908
|
+
l.value ? (f(), j(ee, {
|
|
909
909
|
key: 0,
|
|
910
910
|
content: e.comment.content,
|
|
911
911
|
"current-id": e.comment.id,
|
|
912
912
|
status: e.comment.status,
|
|
913
913
|
class: "mt-3",
|
|
914
914
|
"no-version": "",
|
|
915
|
-
onClose:
|
|
916
|
-
onUpdate:
|
|
915
|
+
onClose: c[2] || (c[2] = (g) => l.value = !1),
|
|
916
|
+
onUpdate: c[3] || (c[3] = (g) => m(n).updateComment(e.comment.id, { content: g }))
|
|
917
917
|
}, null, 8, ["content", "current-id", "status"])) : E("", !0),
|
|
918
|
-
o.value && e.isFirstLevel ? (f(),
|
|
918
|
+
o.value && e.isFirstLevel ? (f(), j(ee, {
|
|
919
919
|
key: 1,
|
|
920
920
|
"ancestor-id": e.ancestorId,
|
|
921
921
|
"parent-id": Number(e.comment.id),
|
|
922
922
|
class: "mt-2 ms-7",
|
|
923
923
|
"no-version": "",
|
|
924
|
-
onClose:
|
|
924
|
+
onClose: c[4] || (c[4] = (g) => o.value = !1)
|
|
925
925
|
}, null, 8, ["ancestor-id", "parent-id"])) : E("", !0),
|
|
926
|
-
e.comment.children?.length ? (f(!0), v(M, { key: 2 },
|
|
926
|
+
e.comment.children?.length ? (f(!0), v(M, { key: 2 }, Se(e.comment.children, (g, _) => (f(), j(k, {
|
|
927
927
|
key: g.id,
|
|
928
928
|
"ancestor-id": e.ancestorId,
|
|
929
929
|
comment: g,
|
|
930
|
-
"is-first":
|
|
930
|
+
"is-first": _ === 0,
|
|
931
931
|
"is-first-level": !1,
|
|
932
|
-
"is-last":
|
|
932
|
+
"is-last": _ === e.comment.children.length - 1,
|
|
933
933
|
class: "ms-7"
|
|
934
934
|
}, null, 8, ["ancestor-id", "comment", "is-first", "is-last"]))), 128)) : E("", !0),
|
|
935
|
-
o.value && !e.isFirstLevel ? (f(),
|
|
935
|
+
o.value && !e.isFirstLevel ? (f(), j(ee, {
|
|
936
936
|
key: 3,
|
|
937
937
|
"ancestor-id": e.ancestorId,
|
|
938
938
|
"parent-id": e.comment.id,
|
|
939
939
|
class: "mt-2 ms-7",
|
|
940
940
|
"no-version": "",
|
|
941
|
-
onClose:
|
|
941
|
+
onClose: c[5] || (c[5] = (g) => o.value = !1)
|
|
942
942
|
}, null, 8, ["ancestor-id", "parent-id"])) : E("", !0)
|
|
943
|
-
], 42,
|
|
943
|
+
], 42, tn);
|
|
944
944
|
};
|
|
945
945
|
}
|
|
946
|
-
}),
|
|
946
|
+
}), rn = {
|
|
947
947
|
key: 0,
|
|
948
948
|
class: "comments-wrapper"
|
|
949
|
-
},
|
|
949
|
+
}, cn = ["disabled"], ln = {
|
|
950
950
|
key: 0,
|
|
951
951
|
class: "ac-loading ac-loading-xs ac-loading-spinner"
|
|
952
|
-
},
|
|
952
|
+
}, un = {
|
|
953
953
|
key: 1,
|
|
954
954
|
class: "py-8 text-center"
|
|
955
|
-
},
|
|
955
|
+
}, dn = {
|
|
956
956
|
name: "CommentSections"
|
|
957
|
-
},
|
|
958
|
-
...
|
|
957
|
+
}, mn = /* @__PURE__ */ D({
|
|
958
|
+
...dn,
|
|
959
959
|
setup(e) {
|
|
960
|
-
const { t: s } =
|
|
960
|
+
const { t: s } = U(), t = J();
|
|
961
961
|
function n() {
|
|
962
962
|
t.start += 20, t.loadComments();
|
|
963
963
|
}
|
|
964
964
|
return se(() => {
|
|
965
965
|
t.isLoaded || t.loadComments();
|
|
966
|
-
}), (
|
|
967
|
-
(f(!0), v(M, null,
|
|
966
|
+
}), (i, d) => m(t).isLoaded ? (f(), v("div", rn, [
|
|
967
|
+
(f(!0), v(M, null, Se(Object.values(m(t).comments).reverse(), (u) => (f(), j(an, {
|
|
968
968
|
key: u.id,
|
|
969
969
|
"ancestor-id": u.id,
|
|
970
970
|
comment: u,
|
|
@@ -978,48 +978,48 @@ const Gt = { class: "flex items-center gap-2 text-sm text-base-content dark:text
|
|
|
978
978
|
type: "button",
|
|
979
979
|
onClick: n
|
|
980
980
|
}, [
|
|
981
|
-
m(t).loadingMore ? (f(), v("span",
|
|
982
|
-
H(" " +
|
|
983
|
-
], 8,
|
|
984
|
-
])) : (f(), v("div",
|
|
985
|
-
|
|
981
|
+
m(t).loadingMore ? (f(), v("span", ln)) : E("", !0),
|
|
982
|
+
H(" " + I(m(s)("load_more")), 1)
|
|
983
|
+
], 8, cn)) : E("", !0)
|
|
984
|
+
])) : (f(), v("div", un, [...d[0] || (d[0] = [
|
|
985
|
+
A("span", { class: "ac-loading ac-loading-spinner text-base-content" }, null, -1)
|
|
986
986
|
])]));
|
|
987
987
|
}
|
|
988
|
-
}),
|
|
988
|
+
}), pn = { class: "awesome-comment" }, fn = {
|
|
989
989
|
key: 0,
|
|
990
990
|
class: "ac-alert ac-alert-error mb-4"
|
|
991
|
-
},
|
|
991
|
+
}, hn = { class: "flex justify-between items-center py-2" }, vn = { class: "text-lg font-bold text-base-content my-0" }, gn = {
|
|
992
992
|
key: 0,
|
|
993
993
|
class: "ac-loading ac-loading-spinner"
|
|
994
|
-
},
|
|
994
|
+
}, yn = {
|
|
995
995
|
key: 1,
|
|
996
996
|
class: "ac-dropdown ac-dropdown-end"
|
|
997
|
-
},
|
|
997
|
+
}, bn = {
|
|
998
998
|
key: 0,
|
|
999
999
|
class: "ac-avatar flex",
|
|
1000
1000
|
tabindex: "0"
|
|
1001
|
-
},
|
|
1001
|
+
}, _n = { class: "block w-6 h-6 rounded-full" }, wn = ["alt", "src"], kn = {
|
|
1002
1002
|
key: 1,
|
|
1003
1003
|
class: "ac-btn ac-btn-ghost",
|
|
1004
1004
|
tabindex: "0"
|
|
1005
|
-
},
|
|
1005
|
+
}, xn = {
|
|
1006
1006
|
class: "ac-dropdown-content z-10 ac-menu p-2 shadow bg-base-100 rounded-box w-52",
|
|
1007
1007
|
tabindex: "0"
|
|
1008
|
-
},
|
|
1008
|
+
}, An = {
|
|
1009
1009
|
key: 0,
|
|
1010
1010
|
class: "border-b border-neutral pb-2 mb-2 pointer-events-none"
|
|
1011
|
-
},
|
|
1011
|
+
}, In = { class: "text-base-content" }, $n = ["disabled"], Cn = ["disabled"], En = /* @__PURE__ */ D({
|
|
1012
1012
|
__name: "App",
|
|
1013
1013
|
setup(e) {
|
|
1014
|
-
const s = J(), { t } =
|
|
1015
|
-
const
|
|
1014
|
+
const s = J(), { t } = U(), n = he(), i = $(), d = Y(() => {
|
|
1015
|
+
const r = s.hasMore ? s.total + "+" : s.total;
|
|
1016
1016
|
if (s.total === 0) return "0";
|
|
1017
|
-
const
|
|
1017
|
+
const a = new CustomEvent("AwesomeComment:total", {
|
|
1018
1018
|
bubbles: !0,
|
|
1019
1019
|
cancelable: !0,
|
|
1020
1020
|
detail: s.total
|
|
1021
1021
|
});
|
|
1022
|
-
return document.body.dispatchEvent(
|
|
1022
|
+
return document.body.dispatchEvent(a), r;
|
|
1023
1023
|
});
|
|
1024
1024
|
function u() {
|
|
1025
1025
|
n.login();
|
|
@@ -1031,13 +1031,13 @@ const Gt = { class: "flex items-center gap-2 text-sm text-base-content dark:text
|
|
|
1031
1031
|
}
|
|
1032
1032
|
async function o() {
|
|
1033
1033
|
if (!n.isAwesomeAuth || n.isAuthenticated) return;
|
|
1034
|
-
await
|
|
1035
|
-
const
|
|
1036
|
-
if (!
|
|
1037
|
-
|
|
1038
|
-
const
|
|
1039
|
-
await n.renderGoogleButton(
|
|
1040
|
-
theme:
|
|
1034
|
+
await de();
|
|
1035
|
+
const r = i.value;
|
|
1036
|
+
if (!r) return;
|
|
1037
|
+
r.innerHTML = "";
|
|
1038
|
+
const a = window.matchMedia?.("(prefers-color-scheme: dark)").matches;
|
|
1039
|
+
await n.renderGoogleButton(r, {
|
|
1040
|
+
theme: a ? "filled_black" : "outline",
|
|
1041
1041
|
size: "medium",
|
|
1042
1042
|
text: "signin_with",
|
|
1043
1043
|
shape: "pill"
|
|
@@ -1047,43 +1047,43 @@ const Gt = { class: "flex items-center gap-2 text-sm text-base-content dark:text
|
|
|
1047
1047
|
o();
|
|
1048
1048
|
}), G(
|
|
1049
1049
|
() => n.isAuthenticated,
|
|
1050
|
-
(
|
|
1051
|
-
|
|
1050
|
+
(r) => {
|
|
1051
|
+
r || o();
|
|
1052
1052
|
}
|
|
1053
|
-
), (
|
|
1054
|
-
m(s).message ? (f(), v("div",
|
|
1055
|
-
|
|
1053
|
+
), (r, a) => (f(), v("div", pn, [
|
|
1054
|
+
m(s).message ? (f(), v("div", fn, [
|
|
1055
|
+
A("p", null, I(m(s).message), 1)
|
|
1056
1056
|
])) : E("", !0),
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
m(n).isLoading ? (f(), v("span",
|
|
1060
|
-
m(n).user.picture ? (f(), v("label",
|
|
1061
|
-
|
|
1062
|
-
|
|
1057
|
+
A("header", hn, [
|
|
1058
|
+
A("h2", vn, I(m(t)("discussion")) + " (" + I(d.value) + ") ", 1),
|
|
1059
|
+
m(n).isLoading ? (f(), v("span", gn)) : m(n).isAuthenticated && m(n).user ? (f(), v("div", yn, [
|
|
1060
|
+
m(n).user.picture ? (f(), v("label", bn, [
|
|
1061
|
+
A("span", _n, [
|
|
1062
|
+
A("img", {
|
|
1063
1063
|
alt: m(n).user.name || m(n).user.email,
|
|
1064
1064
|
src: m(n).user.picture,
|
|
1065
1065
|
class: "w-full h-full block"
|
|
1066
|
-
}, null, 8,
|
|
1066
|
+
}, null, 8, wn)
|
|
1067
1067
|
])
|
|
1068
|
-
])) : (f(), v("label",
|
|
1069
|
-
|
|
1070
|
-
m(n).user.picture ? (f(), v("li",
|
|
1071
|
-
|
|
1068
|
+
])) : (f(), v("label", kn, I(m(n).user.email), 1)),
|
|
1069
|
+
A("ul", xn, [
|
|
1070
|
+
m(n).user.picture ? (f(), v("li", An, [
|
|
1071
|
+
A("span", In, I(m(n).user.email), 1)
|
|
1072
1072
|
])) : E("", !0),
|
|
1073
|
-
|
|
1074
|
-
|
|
1073
|
+
A("li", null, [
|
|
1074
|
+
A("button", {
|
|
1075
1075
|
disabled: m(n).isLoading,
|
|
1076
1076
|
class: "border-0 bg-base-100",
|
|
1077
1077
|
type: "button",
|
|
1078
1078
|
onClick: l
|
|
1079
|
-
},
|
|
1079
|
+
}, I(m(t)("logout")), 9, $n)
|
|
1080
1080
|
])
|
|
1081
1081
|
])
|
|
1082
1082
|
])) : (f(), v(M, { key: 2 }, [
|
|
1083
1083
|
m(n).isAwesomeAuth ? (f(), v("div", {
|
|
1084
1084
|
key: 0,
|
|
1085
1085
|
ref_key: "googleButton",
|
|
1086
|
-
ref:
|
|
1086
|
+
ref: i,
|
|
1087
1087
|
class: "g-id-signin"
|
|
1088
1088
|
}, null, 512)) : (f(), v("button", {
|
|
1089
1089
|
key: 1,
|
|
@@ -1091,38 +1091,38 @@ const Gt = { class: "flex items-center gap-2 text-sm text-base-content dark:text
|
|
|
1091
1091
|
class: "ac-btn ac-btn-secondary ac-btn-xs",
|
|
1092
1092
|
type: "button",
|
|
1093
1093
|
onClick: u
|
|
1094
|
-
},
|
|
1094
|
+
}, I(m(t)("login")), 9, Cn))
|
|
1095
1095
|
], 64))
|
|
1096
1096
|
]),
|
|
1097
|
-
|
|
1098
|
-
|
|
1097
|
+
B(ee),
|
|
1098
|
+
B(mn)
|
|
1099
1099
|
]));
|
|
1100
1100
|
}
|
|
1101
|
-
}),
|
|
1102
|
-
let
|
|
1103
|
-
function
|
|
1101
|
+
}), Ee = [];
|
|
1102
|
+
let ue = 0, fe = null;
|
|
1103
|
+
function Sn({
|
|
1104
1104
|
domain: e,
|
|
1105
1105
|
clientId: s,
|
|
1106
1106
|
locale: t = navigator.language
|
|
1107
1107
|
}) {
|
|
1108
|
-
const n =
|
|
1108
|
+
const n = Ue(En), i = Fe(), d = fe || e && s && Le({
|
|
1109
1109
|
domain: e,
|
|
1110
1110
|
clientId: s,
|
|
1111
1111
|
authorizationParams: {
|
|
1112
1112
|
redirect_uri: location.origin
|
|
1113
1113
|
}
|
|
1114
|
-
}), u =
|
|
1114
|
+
}), u = ze({
|
|
1115
1115
|
legacy: !1,
|
|
1116
1116
|
locale: t,
|
|
1117
1117
|
fallbackLocale: "en",
|
|
1118
1118
|
messages: {
|
|
1119
|
-
...
|
|
1120
|
-
"zh-CN":
|
|
1119
|
+
...Ve(ke, "cn"),
|
|
1120
|
+
"zh-CN": ke.cn
|
|
1121
1121
|
}
|
|
1122
1122
|
});
|
|
1123
|
-
return d && n.use(d), n.use(
|
|
1123
|
+
return d && n.use(d), n.use(i), n.use(u), n;
|
|
1124
1124
|
}
|
|
1125
|
-
const
|
|
1125
|
+
const jn = {
|
|
1126
1126
|
postId: "",
|
|
1127
1127
|
apiUrl: "",
|
|
1128
1128
|
domain: "",
|
|
@@ -1130,37 +1130,55 @@ const Pn = {
|
|
|
1130
1130
|
locale: "",
|
|
1131
1131
|
awesomeAuth: void 0,
|
|
1132
1132
|
turnstileSiteKey: "",
|
|
1133
|
-
init(e, {
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1133
|
+
init(e, {
|
|
1134
|
+
postId: s,
|
|
1135
|
+
apiUrl: t,
|
|
1136
|
+
domain: n,
|
|
1137
|
+
clientId: i,
|
|
1138
|
+
awesomeAuth: d,
|
|
1139
|
+
turnstileSiteKey: u,
|
|
1140
|
+
locale: l = navigator.language,
|
|
1141
|
+
siteId: o,
|
|
1142
|
+
autoFocus: r
|
|
1143
|
+
} = {}) {
|
|
1144
|
+
s ??= this.postId, t ??= this.apiUrl, n ??= this.domain || "", i ??= this.clientId, d ??= this.awesomeAuth, u ??= this.turnstileSiteKey, o ??= this.siteId;
|
|
1145
|
+
const a = Sn({ domain: n, clientId: i, locale: l });
|
|
1146
|
+
a.provide("ApiBaseUrl", t), a.provide("postId", s), a.provide("Auth0Domain", n), a.provide("comments", Ee), a.provide("total", ue), a.provide("awesomeAuth", d), a.provide("TurnstileSiteKey", u), a.provide("siteId", o), a.provide("AutoFocus", r || !1), a.mount(e);
|
|
1137
1147
|
},
|
|
1138
|
-
async preload({
|
|
1139
|
-
|
|
1148
|
+
async preload({
|
|
1149
|
+
postId: e,
|
|
1150
|
+
apiUrl: s,
|
|
1151
|
+
domain: t,
|
|
1152
|
+
clientId: n,
|
|
1153
|
+
awesomeAuth: i,
|
|
1154
|
+
turnstileSiteKey: d,
|
|
1155
|
+
siteId: u
|
|
1156
|
+
}) {
|
|
1157
|
+
if (this.postId = e || "", this.apiUrl = s || "", this.domain = t || "", this.clientId = n || "", this.turnstileSiteKey = d || "", this.siteId = u || "", t && n && (fe = Le({
|
|
1140
1158
|
domain: t,
|
|
1141
1159
|
clientId: n,
|
|
1142
1160
|
authorizationParams: {
|
|
1143
1161
|
redirect_uri: window.location.origin
|
|
1144
1162
|
}
|
|
1145
|
-
})), !
|
|
1163
|
+
})), !fe && !i)
|
|
1146
1164
|
throw new Error("You need at least 1 Auth provider.");
|
|
1147
|
-
this.awesomeAuth =
|
|
1165
|
+
this.awesomeAuth = i;
|
|
1148
1166
|
const l = new URLSearchParams();
|
|
1149
1167
|
l.set("postId", e), u && l.set("siteId", u);
|
|
1150
1168
|
const o = await fetch(`${s}/api/comments?${l.toString()}`);
|
|
1151
1169
|
o.ok || console.log("[Awesome comment] Failed to preload comments.");
|
|
1152
|
-
const
|
|
1153
|
-
if (
|
|
1154
|
-
|
|
1155
|
-
const
|
|
1170
|
+
const r = await o.json();
|
|
1171
|
+
if (r.data) {
|
|
1172
|
+
Ee.push(...r.data), ue = r.meta?.total || r.data.length;
|
|
1173
|
+
const a = new CustomEvent("AwesomeComment:total", {
|
|
1156
1174
|
bubbles: !0,
|
|
1157
1175
|
cancelable: !0,
|
|
1158
|
-
detail:
|
|
1176
|
+
detail: ue
|
|
1159
1177
|
});
|
|
1160
|
-
document.body.dispatchEvent(
|
|
1178
|
+
document.body.dispatchEvent(a);
|
|
1161
1179
|
}
|
|
1162
1180
|
}
|
|
1163
1181
|
};
|
|
1164
1182
|
export {
|
|
1165
|
-
|
|
1183
|
+
jn as default
|
|
1166
1184
|
};
|