@mounaji_npm/forum 0.1.0

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.
@@ -0,0 +1,1090 @@
1
+ "use client";
2
+ import { jsxs as a, jsx as r, Fragment as X } from "react/jsx-runtime";
3
+ import { useState as A, useMemo as Z } from "react";
4
+ function D({ categories: e = [], active: o = "all", onChange: t, isDark: n = !0, title: i = "Categories", style: d }) {
5
+ const l = n ? "var(--mn-color-card-dark, #0B0F23)" : "var(--mn-color-card-light, #FAFAF8)", p = n ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.08)", u = n ? "var(--mn-text-primary-dark, #F0F4FF)" : "var(--mn-text-primary-light, #1A1A2E)", b = n ? "var(--mn-text-secondary-dark, #94A3B8)" : "var(--mn-text-secondary-light, #64748B)";
6
+ return /* @__PURE__ */ a("div", { style: {
7
+ borderRadius: "var(--mn-radius-lg, 0.75rem)",
8
+ backgroundColor: l,
9
+ border: `1px solid ${p}`,
10
+ overflow: "hidden",
11
+ ...d
12
+ }, children: [
13
+ i && /* @__PURE__ */ r("div", { style: { padding: "12px 16px", borderBottom: `1px solid ${p}` }, children: /* @__PURE__ */ r("p", { style: { margin: 0, fontSize: "0.75rem", fontWeight: 600, color: b, textTransform: "uppercase", letterSpacing: "0.07em" }, children: i }) }),
14
+ /* @__PURE__ */ r("div", { style: { padding: "8px 0" }, children: e.map((f) => {
15
+ const s = o === f.id;
16
+ return /* @__PURE__ */ a(
17
+ "button",
18
+ {
19
+ onClick: () => t == null ? void 0 : t(f.id),
20
+ style: {
21
+ width: "100%",
22
+ display: "flex",
23
+ alignItems: "center",
24
+ justifyContent: "space-between",
25
+ padding: "7px 16px",
26
+ border: "none",
27
+ cursor: "pointer",
28
+ fontFamily: "inherit",
29
+ backgroundColor: s ? n ? "rgba(59,130,246,0.1)" : "rgba(59,130,246,0.07)" : "transparent",
30
+ borderLeft: `3px solid ${s ? "var(--mn-color-primary, #3B82F6)" : "transparent"}`,
31
+ transition: "all 100ms",
32
+ gap: 8
33
+ },
34
+ onMouseEnter: (m) => {
35
+ s || (m.currentTarget.style.backgroundColor = n ? "rgba(255,255,255,0.04)" : "rgba(0,0,0,0.03)");
36
+ },
37
+ onMouseLeave: (m) => {
38
+ s || (m.currentTarget.style.backgroundColor = "transparent");
39
+ },
40
+ children: [
41
+ /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [
42
+ f.icon && /* @__PURE__ */ r("span", { style: { fontSize: 14, flexShrink: 0 }, children: f.icon }),
43
+ /* @__PURE__ */ r("span", { style: {
44
+ fontSize: "0.875rem",
45
+ fontWeight: s ? 600 : 400,
46
+ color: s ? "var(--mn-color-primary, #3B82F6)" : u,
47
+ whiteSpace: "nowrap",
48
+ overflow: "hidden",
49
+ textOverflow: "ellipsis"
50
+ }, children: f.label })
51
+ ] }),
52
+ f.count != null && /* @__PURE__ */ r("span", { style: {
53
+ fontSize: "0.7rem",
54
+ fontWeight: 500,
55
+ padding: "1px 7px",
56
+ borderRadius: 9999,
57
+ backgroundColor: s ? "rgba(59,130,246,0.15)" : n ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.06)",
58
+ color: s ? "var(--mn-color-primary, #3B82F6)" : b,
59
+ flexShrink: 0
60
+ }, children: f.count })
61
+ ]
62
+ },
63
+ f.id
64
+ );
65
+ }) })
66
+ ] });
67
+ }
68
+ function q({ count: e = 0, userVote: o = 0, onChange: t, vertical: n = !1, isDark: i = !0, size: d = "md" }) {
69
+ const [l, p] = A(null), u = l ?? o, b = l !== null ? e + (l - o) : e, f = u === 1 ? "#10B981" : i ? "#64748B" : "#94A3B8", s = u === -1 ? "#EF4444" : i ? "#64748B" : "#94A3B8", m = u === 1 ? "#10B981" : u === -1 ? "#EF4444" : i ? "#F0F4FF" : "#1A1A2E", F = d === "sm" ? 22 : 28, h = d === "sm" ? 11 : 13;
70
+ function S(B) {
71
+ const w = u === B ? 0 : B;
72
+ p(w), t == null || t(w);
73
+ }
74
+ return /* @__PURE__ */ a("div", { style: n ? { display: "flex", flexDirection: "column", alignItems: "center", gap: 2 } : { display: "flex", alignItems: "center", gap: 4 }, children: [
75
+ /* @__PURE__ */ r(V, { size: F, icon: "▲", color: f, iconSz: h, onClick: () => S(1), title: "Upvote" }),
76
+ /* @__PURE__ */ r("span", { style: { fontSize: d === "sm" ? "0.75rem" : "0.875rem", fontWeight: 700, color: m, minWidth: 20, textAlign: "center" }, children: b }),
77
+ n && /* @__PURE__ */ r(V, { size: F, icon: "▼", color: s, iconSz: h, onClick: () => S(-1), title: "Downvote" })
78
+ ] });
79
+ }
80
+ function V({ size: e, icon: o, color: t, iconSz: n, onClick: i, title: d }) {
81
+ return /* @__PURE__ */ r(
82
+ "button",
83
+ {
84
+ onClick: i,
85
+ title: d,
86
+ style: {
87
+ width: e,
88
+ height: e,
89
+ borderRadius: 4,
90
+ border: "none",
91
+ cursor: "pointer",
92
+ backgroundColor: "transparent",
93
+ color: t,
94
+ fontSize: n,
95
+ display: "flex",
96
+ alignItems: "center",
97
+ justifyContent: "center",
98
+ transition: "background 100ms, color 100ms",
99
+ padding: 0,
100
+ fontFamily: "inherit"
101
+ },
102
+ onMouseEnter: (l) => {
103
+ l.currentTarget.style.backgroundColor = "rgba(255,255,255,0.07)";
104
+ },
105
+ onMouseLeave: (l) => {
106
+ l.currentTarget.style.backgroundColor = "transparent";
107
+ },
108
+ children: o
109
+ }
110
+ );
111
+ }
112
+ function j({ author: e, date: o, prefix: t = "", isDark: n = !0, size: i = "md" }) {
113
+ const d = n ? "#94A3B8" : "#64748B", l = n ? "#F0F4FF" : "#1A1A2E", p = i === "sm" ? 18 : 22, u = i === "sm" ? "0.75rem" : "0.8125rem";
114
+ return /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
115
+ /* @__PURE__ */ r(_, { name: (e == null ? void 0 : e.name) ?? "?", size: p, src: e == null ? void 0 : e.avatar }),
116
+ /* @__PURE__ */ r("span", { style: { fontSize: u, color: l, fontWeight: 500 }, children: (e == null ? void 0 : e.name) ?? "unknown" }),
117
+ (t || o) && /* @__PURE__ */ a("span", { style: { fontSize: u, color: d }, children: [
118
+ t && /* @__PURE__ */ a(X, { children: [
119
+ t,
120
+ " "
121
+ ] }),
122
+ o ? U(o) : ""
123
+ ] })
124
+ ] });
125
+ }
126
+ function Q({ label: e, onClick: o, isDark: t = !0 }) {
127
+ return /* @__PURE__ */ a(
128
+ "span",
129
+ {
130
+ onClick: o,
131
+ style: {
132
+ fontSize: "0.7rem",
133
+ padding: "2px 8px",
134
+ borderRadius: 9999,
135
+ backgroundColor: t ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.05)",
136
+ color: t ? "#94A3B8" : "#64748B",
137
+ border: `1px solid ${t ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.1)"}`,
138
+ cursor: o ? "pointer" : "default",
139
+ fontFamily: "inherit",
140
+ transition: "background 100ms"
141
+ },
142
+ children: [
143
+ "#",
144
+ e
145
+ ]
146
+ }
147
+ );
148
+ }
149
+ const G = {
150
+ announcements: { bg: "rgba(239,68,68,0.12)", text: "#F87171", border: "rgba(239,68,68,0.25)" },
151
+ general: { bg: "rgba(59,130,246,0.12)", text: "#60A5FA", border: "rgba(59,130,246,0.25)" },
152
+ questions: { bg: "rgba(245,158,11,0.12)", text: "#FCD34D", border: "rgba(245,158,11,0.25)" },
153
+ ideas: { bg: "rgba(139,92,246,0.12)", text: "#A78BFA", border: "rgba(139,92,246,0.25)" },
154
+ bugs: { bg: "rgba(239,68,68,0.12)", text: "#FCA5A5", border: "rgba(239,68,68,0.2)" },
155
+ default: { bg: "rgba(255,255,255,0.06)", text: "#94A3B8", border: "rgba(255,255,255,0.1)" }
156
+ };
157
+ function Y({ category: e }) {
158
+ const o = G[e == null ? void 0 : e.id] ?? G.default;
159
+ return /* @__PURE__ */ a("span", { style: { display: "inline-flex", alignItems: "center", gap: 4, fontSize: "0.7rem", fontWeight: 500, padding: "2px 8px", borderRadius: 9999, backgroundColor: o.bg, color: o.text, border: `1px solid ${o.border}` }, children: [
160
+ (e == null ? void 0 : e.icon) && /* @__PURE__ */ r("span", { children: e.icon }),
161
+ e == null ? void 0 : e.label
162
+ ] });
163
+ }
164
+ function _({ name: e, size: o = 24, src: t }) {
165
+ const n = (e ?? "?").slice(0, 1).toUpperCase(), d = `hsl(${[...e ?? ""].reduce((l, p) => (l * 31 + p.charCodeAt(0)) % 360, 0)}, 55%, 35%)`;
166
+ return t ? /* @__PURE__ */ r("img", { src: t, alt: e, style: { width: o, height: o, borderRadius: "50%", objectFit: "cover" } }) : /* @__PURE__ */ r("div", { style: { width: o, height: o, borderRadius: "50%", backgroundColor: d, display: "flex", alignItems: "center", justifyContent: "center", fontSize: o * 0.45, fontWeight: 700, color: "#fff", flexShrink: 0, userSelect: "none" }, children: n });
167
+ }
168
+ function U(e) {
169
+ const o = typeof e == "string" ? new Date(e) : e, t = (Date.now() - o.getTime()) / 1e3;
170
+ return t < 60 ? "just now" : t < 3600 ? `${Math.floor(t / 60)}m ago` : t < 86400 ? `${Math.floor(t / 3600)}h ago` : t < 604800 ? `${Math.floor(t / 86400)}d ago` : o.toLocaleDateString();
171
+ }
172
+ function ee({ post: e, onClick: o, onVote: t, isDark: n = !0, compact: i = !1, style: d }) {
173
+ var f;
174
+ const l = n ? "var(--mn-color-card-dark, #0B0F23)" : "var(--mn-color-card-light, #FAFAF8)", p = n ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.08)", u = n ? "var(--mn-text-primary-dark, #F0F4FF)" : "var(--mn-text-primary-light, #1A1A2E)", b = n ? "var(--mn-text-secondary-dark, #94A3B8)" : "var(--mn-text-secondary-light, #64748B)";
175
+ return /* @__PURE__ */ a(
176
+ "div",
177
+ {
178
+ onClick: o,
179
+ style: {
180
+ display: "flex",
181
+ gap: 14,
182
+ padding: i ? "12px 16px" : "16px 18px",
183
+ borderRadius: "var(--mn-radius-lg, 0.75rem)",
184
+ backgroundColor: l,
185
+ border: `1px solid ${p}`,
186
+ cursor: o ? "pointer" : "default",
187
+ transition: "border-color 120ms, background 120ms",
188
+ ...d
189
+ },
190
+ onMouseEnter: (s) => {
191
+ o && (s.currentTarget.style.borderColor = n ? "rgba(255,255,255,0.14)" : "rgba(0,0,0,0.16)");
192
+ },
193
+ onMouseLeave: (s) => {
194
+ s.currentTarget.style.borderColor = p;
195
+ },
196
+ children: [
197
+ /* @__PURE__ */ r(
198
+ "div",
199
+ {
200
+ onClick: (s) => s.stopPropagation(),
201
+ style: { flexShrink: 0, paddingTop: 2 },
202
+ children: /* @__PURE__ */ r(
203
+ q,
204
+ {
205
+ count: e.votes,
206
+ userVote: e.userVote ?? 0,
207
+ onChange: (s) => t == null ? void 0 : t(e.id, s),
208
+ vertical: !0,
209
+ isDark: n,
210
+ size: "sm"
211
+ }
212
+ )
213
+ }
214
+ ),
215
+ /* @__PURE__ */ a("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: 6 }, children: [
216
+ /* @__PURE__ */ a("div", { style: { display: "flex", gap: 6, flexWrap: "wrap", alignItems: "center" }, children: [
217
+ e.isPinned && /* @__PURE__ */ r("span", { style: { fontSize: "0.7rem", fontWeight: 600, padding: "2px 7px", borderRadius: 9999, backgroundColor: "rgba(245,158,11,0.12)", color: "#FCD34D", border: "1px solid rgba(245,158,11,0.25)" }, children: "📌 Pinned" }),
218
+ e.isSolved && /* @__PURE__ */ r("span", { style: { fontSize: "0.7rem", fontWeight: 600, padding: "2px 7px", borderRadius: 9999, backgroundColor: "rgba(16,185,129,0.12)", color: "#34D399", border: "1px solid rgba(16,185,129,0.25)" }, children: "✓ Solved" }),
219
+ /* @__PURE__ */ r(Y, { category: e.category })
220
+ ] }),
221
+ /* @__PURE__ */ r("h3", { style: { margin: 0, fontSize: i ? "0.9375rem" : "1rem", fontWeight: 600, color: u, lineHeight: 1.4 }, children: e.title }),
222
+ !i && e.body && /* @__PURE__ */ r("p", { style: { margin: 0, fontSize: "0.8125rem", color: b, lineHeight: 1.55, display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical", overflow: "hidden" }, children: e.body }),
223
+ ((f = e.tags) == null ? void 0 : f.length) > 0 && /* @__PURE__ */ r("div", { style: { display: "flex", gap: 5, flexWrap: "wrap" }, children: e.tags.map((s) => /* @__PURE__ */ r(Q, { label: s, isDark: n }, s)) }),
224
+ /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center", gap: 12, flexWrap: "wrap", marginTop: 2 }, children: [
225
+ /* @__PURE__ */ r(j, { author: e.author, date: e.createdAt, isDark: n, size: "sm" }),
226
+ /* @__PURE__ */ r(N, { icon: "💬", value: e.replyCount, label: "replies", isDark: n }),
227
+ /* @__PURE__ */ r(N, { icon: "👁", value: e.viewCount, label: "views", isDark: n })
228
+ ] })
229
+ ] })
230
+ ]
231
+ }
232
+ );
233
+ }
234
+ function N({ icon: e, value: o, label: t, isDark: n }) {
235
+ return /* @__PURE__ */ a("span", { style: { display: "flex", alignItems: "center", gap: 4, fontSize: "0.75rem", color: n ? "#64748B" : "#94A3B8" }, children: [
236
+ /* @__PURE__ */ r("span", { style: { fontSize: 12 }, children: e }),
237
+ o,
238
+ " ",
239
+ t
240
+ ] });
241
+ }
242
+ function re({ posts: e = [], onPostClick: o, onVote: t, isLoading: n = !1, isDark: i = !0 }) {
243
+ return n ? /* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: Array.from({ length: 4 }).map((d, l) => /* @__PURE__ */ r(ne, { isDark: i }, l)) }) : e.length === 0 ? /* @__PURE__ */ r(te, { isDark: i }) : /* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: e.map((d) => /* @__PURE__ */ r(
244
+ ee,
245
+ {
246
+ post: d,
247
+ onClick: () => o == null ? void 0 : o(d.id),
248
+ onVote: t,
249
+ isDark: i
250
+ },
251
+ d.id
252
+ )) });
253
+ }
254
+ function te({ isDark: e = !0, message: o = "No posts yet", cta: t, onCta: n }) {
255
+ return /* @__PURE__ */ a("div", { style: { textAlign: "center", padding: "64px 24px", display: "flex", flexDirection: "column", alignItems: "center", gap: 12 }, children: [
256
+ /* @__PURE__ */ r("p", { style: { fontSize: 40, margin: 0 }, children: "💬" }),
257
+ /* @__PURE__ */ r("p", { style: { margin: 0, fontSize: "1rem", fontWeight: 600, color: e ? "#F0F4FF" : "#1A1A2E" }, children: o }),
258
+ /* @__PURE__ */ r("p", { style: { margin: 0, fontSize: "0.875rem", color: e ? "#94A3B8" : "#64748B" }, children: "Be the first to start a discussion." }),
259
+ t && /* @__PURE__ */ r(
260
+ "button",
261
+ {
262
+ onClick: n,
263
+ style: { marginTop: 8, padding: "8px 20px", borderRadius: "var(--mn-radius-md, 0.5rem)", border: "none", cursor: "pointer", backgroundColor: "var(--mn-color-primary, #3B82F6)", color: "#fff", fontSize: "0.875rem", fontWeight: 600, fontFamily: "inherit" },
264
+ children: t
265
+ }
266
+ )
267
+ ] });
268
+ }
269
+ function ne({ isDark: e }) {
270
+ const o = e ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.05)", t = e ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.08)", n = (i, d = 12) => ({ width: i, height: d, borderRadius: 6, backgroundColor: o, animation: "mn-pulse 1.4s ease infinite" });
271
+ return /* @__PURE__ */ a("div", { style: { display: "flex", gap: 14, padding: "16px 18px", borderRadius: "var(--mn-radius-lg, 0.75rem)", backgroundColor: e ? "var(--mn-color-card-dark, #0B0F23)" : "var(--mn-color-card-light, #FAFAF8)", border: `1px solid ${t}` }, children: [
272
+ /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: 6, paddingTop: 2, flexShrink: 0 }, children: [
273
+ /* @__PURE__ */ r("div", { style: n(22, 10) }),
274
+ /* @__PURE__ */ r("div", { style: n(22, 10) })
275
+ ] }),
276
+ /* @__PURE__ */ a("div", { style: { flex: 1, display: "flex", flexDirection: "column", gap: 9 }, children: [
277
+ /* @__PURE__ */ r("div", { style: n("60%", 8) }),
278
+ /* @__PURE__ */ r("div", { style: n("85%", 14) }),
279
+ /* @__PURE__ */ r("div", { style: n("50%", 8) }),
280
+ /* @__PURE__ */ r("div", { style: n("40%", 8) })
281
+ ] }),
282
+ /* @__PURE__ */ r("style", { children: "@keyframes mn-pulse { 0%,100%{opacity:.5} 50%{opacity:1} }" })
283
+ ] });
284
+ }
285
+ const K = [
286
+ { id: "all", label: "All Posts", icon: "◉", count: 124 },
287
+ { id: "announcements", label: "Announcements", icon: "📣", count: 8, pinned: !0 },
288
+ { id: "general", label: "General", icon: "💬", count: 32 },
289
+ { id: "questions", label: "Questions", icon: "❓", count: 45 },
290
+ { id: "ideas", label: "Ideas", icon: "💡", count: 27 },
291
+ { id: "bugs", label: "Bug Reports", icon: "🐛", count: 12 }
292
+ ], J = [
293
+ {
294
+ id: "1",
295
+ title: "Introducing the new dark mode token system",
296
+ body: "We have completely overhauled the design token system to support seamless dark/light mode switching. The new system uses CSS custom properties under a `data-mn-theme` attribute, which means zero-JavaScript theme switching in most cases.",
297
+ author: { id: "u1", name: "alex_m", avatar: null },
298
+ category: { id: "announcements", label: "Announcements", icon: "📣" },
299
+ tags: ["design-system", "tokens", "dark-mode"],
300
+ votes: 87,
301
+ userVote: 0,
302
+ replyCount: 14,
303
+ viewCount: 420,
304
+ createdAt: new Date(Date.now() - 1e3 * 60 * 60 * 3).toISOString(),
305
+ isPinned: !0,
306
+ isSolved: !1
307
+ },
308
+ {
309
+ id: "2",
310
+ title: "How do I add custom categories to my forum?",
311
+ body: "I am setting up a community forum and want to add my own categories beyond the defaults. Is there a config option for this, or do I need to pass a custom categories array?",
312
+ author: { id: "u2", name: "sara_dev", avatar: null },
313
+ category: { id: "questions", label: "Questions", icon: "❓" },
314
+ tags: ["configuration", "categories"],
315
+ votes: 12,
316
+ userVote: 0,
317
+ replyCount: 5,
318
+ viewCount: 98,
319
+ createdAt: new Date(Date.now() - 1e3 * 60 * 60 * 6).toISOString(),
320
+ isSolved: !0
321
+ },
322
+ {
323
+ id: "3",
324
+ title: "Feature request: markdown support in replies",
325
+ body: "It would be great to have rich text / markdown support in the reply composer. Being able to add code blocks, links, and bold/italic text would make the forum much more useful for technical discussions.",
326
+ author: { id: "u3", name: "techwriter_k", avatar: null },
327
+ category: { id: "ideas", label: "Ideas", icon: "💡" },
328
+ tags: ["markdown", "editor", "replies"],
329
+ votes: 34,
330
+ userVote: 1,
331
+ replyCount: 9,
332
+ viewCount: 203,
333
+ createdAt: new Date(Date.now() - 1e3 * 60 * 60 * 12).toISOString()
334
+ },
335
+ {
336
+ id: "4",
337
+ title: "Vote count not updating in real-time",
338
+ body: "After clicking the upvote button, the vote count updates locally but does not sync back from the server on page refresh. Seems like the onVote callback is firing but the optimistic update is not being persisted.",
339
+ author: { id: "u4", name: "james_d", avatar: null },
340
+ category: { id: "bugs", label: "Bug Reports", icon: "🐛" },
341
+ tags: ["voting", "bug", "real-time"],
342
+ votes: 7,
343
+ userVote: 0,
344
+ replyCount: 3,
345
+ viewCount: 61,
346
+ createdAt: new Date(Date.now() - 1e3 * 60 * 60 * 18).toISOString()
347
+ },
348
+ {
349
+ id: "5",
350
+ title: "Best practices for organizing forum categories",
351
+ body: "We are launching a developer community and are unsure how to structure our categories. Should we go broad (3-5 categories) or granular (10+ sub-categories)? Looking for advice from people who have run communities before.",
352
+ author: { id: "u5", name: "community_lead", avatar: null },
353
+ category: { id: "general", label: "General", icon: "💬" },
354
+ tags: ["community", "organization", "best-practices"],
355
+ votes: 22,
356
+ userVote: 0,
357
+ replyCount: 17,
358
+ viewCount: 312,
359
+ createdAt: new Date(Date.now() - 1e3 * 60 * 60 * 24).toISOString()
360
+ },
361
+ {
362
+ id: "6",
363
+ title: "Building a searchable FAQ from pinned posts",
364
+ body: "One pattern I have found useful is using pinned posts as a structured FAQ. You can tag them with `faq` and surface them in a dedicated section. Here is how I set it up with the forum module.",
365
+ author: { id: "u1", name: "alex_m", avatar: null },
366
+ category: { id: "general", label: "General", icon: "💬" },
367
+ tags: ["faq", "pinned", "pattern"],
368
+ votes: 41,
369
+ userVote: 0,
370
+ replyCount: 6,
371
+ viewCount: 188,
372
+ createdAt: new Date(Date.now() - 1e3 * 60 * 60 * 36).toISOString()
373
+ }
374
+ ], oe = [
375
+ {
376
+ id: "r1",
377
+ body: "You can pass a `categories` prop directly to `<ForumPage>`. The shape is `{ id, label, icon, count }`. If you want a global default, set it in your `mn-config.js` under the `forum` key.",
378
+ author: { id: "u1", name: "alex_m", avatar: null },
379
+ votes: 15,
380
+ userVote: 1,
381
+ createdAt: new Date(Date.now() - 1e3 * 60 * 60 * 5).toISOString(),
382
+ isAccepted: !0
383
+ },
384
+ {
385
+ id: "r2",
386
+ body: "Also worth noting — you can use the `CategoryNav` component standalone if you want to place it somewhere other than the default sidebar.",
387
+ author: { id: "u3", name: "techwriter_k", avatar: null },
388
+ votes: 8,
389
+ userVote: 0,
390
+ createdAt: new Date(Date.now() - 1e3 * 60 * 60 * 4).toISOString()
391
+ },
392
+ {
393
+ id: "r3",
394
+ body: "Great question — I had the same issue when I first set up the forum. The docs example in the README shows the full config including custom categories.",
395
+ author: { id: "u5", name: "community_lead", avatar: null },
396
+ votes: 3,
397
+ userVote: 0,
398
+ createdAt: new Date(Date.now() - 1e3 * 60 * 60 * 3).toISOString()
399
+ }
400
+ ], ie = [
401
+ { id: "newest", label: "Newest" },
402
+ { id: "top", label: "Top Voted" },
403
+ { id: "unanswered", label: "Unanswered" }
404
+ ];
405
+ function fe({
406
+ categories: e = K,
407
+ posts: o = J,
408
+ activeCategory: t = "all",
409
+ searchQuery: n = "",
410
+ sortBy: i = "newest",
411
+ onCategoryChange: d,
412
+ onSearch: l,
413
+ onSortChange: p,
414
+ onPostClick: u,
415
+ onNewPost: b,
416
+ onVote: f,
417
+ isLoading: s = !1,
418
+ isDark: m = !0,
419
+ header: F,
420
+ title: h = "Forum",
421
+ subtitle: S = "Discussions, questions, and ideas from the community.",
422
+ style: x
423
+ }) {
424
+ const [B, w] = A(n), [k, $] = A(i), [C, W] = A(t), I = m ? "var(--mn-text-primary-dark, #F0F4FF)" : "var(--mn-text-primary-light, #1A1A2E)", R = m ? "var(--mn-text-secondary-dark, #94A3B8)" : "var(--mn-text-secondary-light, #64748B)", T = m ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.08)", L = m ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.04)";
425
+ function O(g) {
426
+ w(g), l == null || l(g);
427
+ }
428
+ function P(g) {
429
+ $(g), p == null || p(g);
430
+ }
431
+ function c(g) {
432
+ W(g), d == null || d(g);
433
+ }
434
+ const y = Z(() => {
435
+ let g = o;
436
+ if (C !== "all" && (g = g.filter((v) => {
437
+ var z;
438
+ return ((z = v.category) == null ? void 0 : z.id) === C;
439
+ })), B.trim()) {
440
+ const v = B.toLowerCase();
441
+ g = g.filter((z) => {
442
+ var H;
443
+ return z.title.toLowerCase().includes(v) || ((H = z.body) == null ? void 0 : H.toLowerCase().includes(v));
444
+ });
445
+ }
446
+ return k === "top" && (g = [...g].sort((v, z) => z.votes - v.votes)), k === "newest" && (g = [...g].sort((v, z) => new Date(z.createdAt) - new Date(v.createdAt))), k === "unanswered" && (g = g.filter((v) => !v.isSolved && (v.replyCount ?? 0) === 0)), [...g].sort((v, z) => (z.isPinned ? 1 : 0) - (v.isPinned ? 1 : 0));
447
+ }, [o, C, B, k]);
448
+ return /* @__PURE__ */ a("div", { style: {
449
+ padding: "var(--mn-spacing-xl, 32px)",
450
+ display: "flex",
451
+ flexDirection: "column",
452
+ gap: 24,
453
+ fontFamily: "var(--mn-font-family, system-ui, sans-serif)",
454
+ ...x
455
+ }, children: [
456
+ F ?? /* @__PURE__ */ a("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-end", flexWrap: "wrap", gap: 12 }, children: [
457
+ /* @__PURE__ */ a("div", { children: [
458
+ /* @__PURE__ */ r("h1", { style: { margin: 0, fontSize: "var(--mn-font-size-2xl, 1.5rem)", fontWeight: 700, color: I }, children: h }),
459
+ S && /* @__PURE__ */ r("p", { style: { margin: "4px 0 0", fontSize: "0.875rem", color: R }, children: S })
460
+ ] }),
461
+ /* @__PURE__ */ r(
462
+ "button",
463
+ {
464
+ onClick: b,
465
+ style: { padding: "8px 18px", borderRadius: "var(--mn-radius-md, 0.5rem)", border: "none", cursor: "pointer", backgroundColor: "var(--mn-color-primary, #3B82F6)", color: "#fff", fontSize: "0.875rem", fontWeight: 600, fontFamily: "inherit", display: "flex", alignItems: "center", gap: 6 },
466
+ children: "+ New Post"
467
+ }
468
+ )
469
+ ] }),
470
+ /* @__PURE__ */ a("div", { style: { display: "flex", gap: 20, alignItems: "flex-start" }, children: [
471
+ /* @__PURE__ */ r("div", { style: { width: 200, flexShrink: 0, position: "sticky", top: 80 }, children: /* @__PURE__ */ r(
472
+ D,
473
+ {
474
+ categories: e,
475
+ active: C,
476
+ onChange: c,
477
+ isDark: m
478
+ }
479
+ ) }),
480
+ /* @__PURE__ */ a("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: 14 }, children: [
481
+ /* @__PURE__ */ a("div", { style: { display: "flex", gap: 10, flexWrap: "wrap", alignItems: "center" }, children: [
482
+ /* @__PURE__ */ a("div", { style: { position: "relative", flex: "1 1 200px" }, children: [
483
+ /* @__PURE__ */ r("span", { style: { position: "absolute", left: 10, top: "50%", transform: "translateY(-50%)", color: R, pointerEvents: "none", fontSize: 14 }, children: "🔍" }),
484
+ /* @__PURE__ */ r(
485
+ "input",
486
+ {
487
+ value: B,
488
+ onChange: (g) => O(g.target.value),
489
+ placeholder: "Search posts…",
490
+ style: { width: "100%", boxSizing: "border-box", padding: "8px 10px 8px 32px", borderRadius: "var(--mn-radius-md, 0.5rem)", backgroundColor: L, border: `1px solid ${T}`, color: I, fontSize: "0.875rem", fontFamily: "inherit", outline: "none" },
491
+ onFocus: (g) => {
492
+ g.target.style.borderColor = "var(--mn-color-primary, #3B82F6)";
493
+ },
494
+ onBlur: (g) => {
495
+ g.target.style.borderColor = T;
496
+ }
497
+ }
498
+ )
499
+ ] }),
500
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: 2, backgroundColor: m ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.05)", padding: 3, borderRadius: "var(--mn-radius-md, 0.5rem)" }, children: ie.map((g) => {
501
+ const v = k === g.id;
502
+ return /* @__PURE__ */ r(
503
+ "button",
504
+ {
505
+ onClick: () => P(g.id),
506
+ style: {
507
+ padding: "4px 12px",
508
+ borderRadius: 6,
509
+ border: "none",
510
+ cursor: "pointer",
511
+ backgroundColor: v ? m ? "rgba(255,255,255,0.09)" : "#fff" : "transparent",
512
+ color: v ? I : R,
513
+ fontSize: "0.8125rem",
514
+ fontWeight: v ? 600 : 400,
515
+ fontFamily: "inherit",
516
+ transition: "all 100ms"
517
+ },
518
+ children: g.label
519
+ },
520
+ g.id
521
+ );
522
+ }) })
523
+ ] }),
524
+ !s && /* @__PURE__ */ a("p", { style: { margin: 0, fontSize: "0.8125rem", color: R }, children: [
525
+ y.length,
526
+ " ",
527
+ y.length === 1 ? "post" : "posts",
528
+ B ? ` matching "${B}"` : ""
529
+ ] }),
530
+ /* @__PURE__ */ r(
531
+ re,
532
+ {
533
+ posts: y,
534
+ onPostClick: u,
535
+ onVote: f,
536
+ isLoading: s,
537
+ isDark: m
538
+ }
539
+ )
540
+ ] })
541
+ ] })
542
+ ] });
543
+ }
544
+ function ae({ post: e, onVote: o, isDark: t = !0 }) {
545
+ var p;
546
+ const n = t ? "var(--mn-color-card-dark, #0B0F23)" : "var(--mn-color-card-light, #FAFAF8)", i = t ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.08)", d = t ? "var(--mn-text-primary-dark, #F0F4FF)" : "var(--mn-text-primary-light, #1A1A2E)", l = t ? "var(--mn-text-secondary-dark, #94A3B8)" : "var(--mn-text-secondary-light, #64748B)";
547
+ return /* @__PURE__ */ a("div", { style: { borderRadius: "var(--mn-radius-lg, 0.75rem)", backgroundColor: n, border: `1px solid ${i}`, overflow: "hidden" }, children: [
548
+ /* @__PURE__ */ a("div", { style: { padding: "20px 24px", borderBottom: `1px solid ${i}` }, children: [
549
+ /* @__PURE__ */ a("div", { style: { display: "flex", gap: 6, flexWrap: "wrap", marginBottom: 12 }, children: [
550
+ e.isPinned && /* @__PURE__ */ r(M, { color: "warning", children: "📌 Pinned" }),
551
+ e.isSolved && /* @__PURE__ */ r(M, { color: "success", children: "✓ Solved" }),
552
+ e.isLocked && /* @__PURE__ */ r(M, { color: "muted", children: "🔒 Locked" }),
553
+ /* @__PURE__ */ r(Y, { category: e.category })
554
+ ] }),
555
+ /* @__PURE__ */ r("h1", { style: { margin: "0 0 14px", fontSize: "var(--mn-font-size-xl, 1.25rem)", fontWeight: 700, color: d, lineHeight: 1.4 }, children: e.title }),
556
+ /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center", gap: 16, flexWrap: "wrap" }, children: [
557
+ /* @__PURE__ */ r(j, { author: e.author, date: e.createdAt, prefix: "posted", isDark: t }),
558
+ /* @__PURE__ */ a("span", { style: { fontSize: "0.8125rem", color: l }, children: [
559
+ "👁 ",
560
+ e.viewCount ?? 0,
561
+ " views"
562
+ ] }),
563
+ /* @__PURE__ */ a("span", { style: { fontSize: "0.8125rem", color: l }, children: [
564
+ "💬 ",
565
+ e.replyCount ?? 0,
566
+ " replies"
567
+ ] })
568
+ ] })
569
+ ] }),
570
+ /* @__PURE__ */ a("div", { style: { display: "flex", gap: 0 }, children: [
571
+ /* @__PURE__ */ r("div", { style: { padding: "20px 16px", borderRight: `1px solid ${i}`, display: "flex", flexDirection: "column", alignItems: "center", gap: 4, flexShrink: 0 }, children: /* @__PURE__ */ r(
572
+ q,
573
+ {
574
+ count: e.votes,
575
+ userVote: e.userVote ?? 0,
576
+ onChange: (u) => o == null ? void 0 : o(e.id, u),
577
+ vertical: !0,
578
+ isDark: t
579
+ }
580
+ ) }),
581
+ /* @__PURE__ */ a("div", { style: { flex: 1, padding: "20px 24px" }, children: [
582
+ /* @__PURE__ */ r("div", { style: { fontSize: "0.9375rem", color: d, lineHeight: 1.7, whiteSpace: "pre-wrap", wordBreak: "break-word" }, children: e.body }),
583
+ ((p = e.tags) == null ? void 0 : p.length) > 0 && /* @__PURE__ */ r("div", { style: { display: "flex", gap: 6, flexWrap: "wrap", marginTop: 18 }, children: e.tags.map((u) => /* @__PURE__ */ r(Q, { label: u, isDark: t }, u)) })
584
+ ] })
585
+ ] })
586
+ ] });
587
+ }
588
+ function M({ color: e, children: o }) {
589
+ const t = {
590
+ warning: { bg: "rgba(245,158,11,0.12)", text: "#FCD34D", border: "rgba(245,158,11,0.25)" },
591
+ success: { bg: "rgba(16,185,129,0.12)", text: "#34D399", border: "rgba(16,185,129,0.25)" },
592
+ muted: { bg: "rgba(107,114,128,0.12)", text: "#9CA3AF", border: "rgba(107,114,128,0.2)" }
593
+ }, n = t[e] ?? t.muted;
594
+ return /* @__PURE__ */ r("span", { style: { fontSize: "0.7rem", fontWeight: 600, padding: "2px 8px", borderRadius: 9999, backgroundColor: n.bg, color: n.text, border: `1px solid ${n.border}` }, children: o });
595
+ }
596
+ function le({ reply: e, onVote: o, onAccept: t, canAccept: n = !1, isDark: i = !0 }) {
597
+ const d = i ? "var(--mn-color-card-dark, #0B0F23)" : "var(--mn-color-card-light, #FAFAF8)", l = i ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.08)", p = i ? "var(--mn-text-primary-dark, #F0F4FF)" : "var(--mn-text-primary-light, #1A1A2E)", u = i ? "var(--mn-text-secondary-dark, #94A3B8)" : "var(--mn-text-secondary-light, #64748B)", b = e.isAccepted ? "rgba(16,185,129,0.35)" : l, f = e.isAccepted ? i ? "rgba(16,185,129,0.05)" : "rgba(16,185,129,0.04)" : d;
598
+ return /* @__PURE__ */ a("div", { style: { display: "flex", borderRadius: "var(--mn-radius-lg, 0.75rem)", backgroundColor: f, border: `1px solid ${b}`, overflow: "hidden" }, children: [
599
+ /* @__PURE__ */ a("div", { style: { padding: "16px 14px", borderRight: `1px solid ${l}`, display: "flex", flexDirection: "column", alignItems: "center", gap: 4, flexShrink: 0 }, children: [
600
+ /* @__PURE__ */ r(
601
+ q,
602
+ {
603
+ count: e.votes,
604
+ userVote: e.userVote ?? 0,
605
+ onChange: (s) => o == null ? void 0 : o(e.id, s),
606
+ vertical: !0,
607
+ isDark: i,
608
+ size: "sm"
609
+ }
610
+ ),
611
+ (e.isAccepted || n) && /* @__PURE__ */ r(
612
+ "button",
613
+ {
614
+ onClick: () => t == null ? void 0 : t(e.id),
615
+ title: e.isAccepted ? "Accepted answer" : "Mark as accepted",
616
+ style: {
617
+ marginTop: 6,
618
+ width: 28,
619
+ height: 28,
620
+ borderRadius: 6,
621
+ border: "none",
622
+ cursor: n ? "pointer" : "default",
623
+ backgroundColor: e.isAccepted ? "rgba(16,185,129,0.15)" : "transparent",
624
+ color: e.isAccepted ? "#10B981" : u,
625
+ display: "flex",
626
+ alignItems: "center",
627
+ justifyContent: "center",
628
+ fontSize: 14,
629
+ transition: "background 100ms"
630
+ },
631
+ onMouseEnter: (s) => {
632
+ n && !e.isAccepted && (s.currentTarget.style.backgroundColor = "rgba(16,185,129,0.1)");
633
+ },
634
+ onMouseLeave: (s) => {
635
+ e.isAccepted || (s.currentTarget.style.backgroundColor = "transparent");
636
+ },
637
+ children: "✓"
638
+ }
639
+ )
640
+ ] }),
641
+ /* @__PURE__ */ a("div", { style: { flex: 1, padding: "16px 18px", minWidth: 0 }, children: [
642
+ e.isAccepted && /* @__PURE__ */ a("div", { style: { display: "inline-flex", alignItems: "center", gap: 5, fontSize: "0.75rem", fontWeight: 600, color: "#10B981", marginBottom: 10 }, children: [
643
+ /* @__PURE__ */ r("span", { children: "✓" }),
644
+ " Accepted Answer"
645
+ ] }),
646
+ /* @__PURE__ */ r("div", { style: { fontSize: "0.9375rem", color: p, lineHeight: 1.65, whiteSpace: "pre-wrap", wordBreak: "break-word" }, children: e.body }),
647
+ /* @__PURE__ */ r("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ r(j, { author: e.author, date: e.createdAt, prefix: "replied", isDark: i, size: "sm" }) })
648
+ ] })
649
+ ] });
650
+ }
651
+ function de({ replies: e = [], onVote: o, onAccept: t, canAccept: n = !1, currentUser: i, onSubmit: d, isLocked: l = !1, isDark: p = !0 }) {
652
+ const u = p ? "#F0F4FF" : "#1A1A2E", b = p ? "#94A3B8" : "#64748B", f = p ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.08)", s = [...e].sort((m, F) => m.isAccepted && !F.isAccepted ? -1 : !m.isAccepted && F.isAccepted ? 1 : F.votes - m.votes);
653
+ return /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: 20 }, children: [
654
+ e.length > 0 && /* @__PURE__ */ r("div", { style: { paddingBottom: 12, borderBottom: `1px solid ${f}` }, children: /* @__PURE__ */ a("h2", { style: { margin: 0, fontSize: "1rem", fontWeight: 600, color: u }, children: [
655
+ e.length,
656
+ " ",
657
+ e.length === 1 ? "Reply" : "Replies"
658
+ ] }) }),
659
+ s.length > 0 && /* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: s.map((m) => /* @__PURE__ */ r(
660
+ le,
661
+ {
662
+ reply: m,
663
+ onVote: o,
664
+ onAccept: t,
665
+ canAccept: n,
666
+ isDark: p
667
+ },
668
+ m.id
669
+ )) }),
670
+ l ? /* @__PURE__ */ r("div", { style: { textAlign: "center", padding: "20px", color: b, fontSize: "0.875rem", backgroundColor: p ? "rgba(255,255,255,0.03)" : "rgba(0,0,0,0.03)", borderRadius: "var(--mn-radius-md, 0.5rem)", border: `1px solid ${f}` }, children: "🔒 This thread is locked — no new replies allowed." }) : /* @__PURE__ */ r(
671
+ se,
672
+ {
673
+ currentUser: i,
674
+ onSubmit: d,
675
+ isDark: p,
676
+ placeholder: e.length === 0 ? "Be the first to reply…" : "Write a reply…"
677
+ }
678
+ )
679
+ ] });
680
+ }
681
+ function se({ currentUser: e, onSubmit: o, placeholder: t = "Write a reply…", isDark: n = !0 }) {
682
+ const [i, d] = A(""), [l, p] = A(!1), [u, b] = A(""), f = n ? "var(--mn-color-card-dark, #0B0F23)" : "var(--mn-color-card-light, #FAFAF8)", s = n ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.08)", m = n ? "#F0F4FF" : "#1A1A2E", F = n ? "#94A3B8" : "#64748B", h = n ? "rgba(255,255,255,0.04)" : "rgba(0,0,0,0.03)";
683
+ async function S() {
684
+ const x = i.trim();
685
+ if (!x) {
686
+ b("Reply cannot be empty.");
687
+ return;
688
+ }
689
+ b(""), p(!0);
690
+ try {
691
+ await (o == null ? void 0 : o(x)), d("");
692
+ } finally {
693
+ p(!1);
694
+ }
695
+ }
696
+ return /* @__PURE__ */ a("div", { style: { borderRadius: "var(--mn-radius-lg, 0.75rem)", backgroundColor: f, border: `1px solid ${s}`, padding: "16px 18px", display: "flex", flexDirection: "column", gap: 12 }, children: [
697
+ /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
698
+ /* @__PURE__ */ r(_, { name: (e == null ? void 0 : e.name) ?? "?", size: 26, src: e == null ? void 0 : e.avatar }),
699
+ /* @__PURE__ */ r("span", { style: { fontSize: "0.8125rem", fontWeight: 600, color: m }, children: e ? e.name : "Reply as Guest" })
700
+ ] }),
701
+ /* @__PURE__ */ r(
702
+ "textarea",
703
+ {
704
+ value: i,
705
+ onChange: (x) => {
706
+ d(x.target.value), u && b("");
707
+ },
708
+ placeholder: t,
709
+ rows: 4,
710
+ style: {
711
+ width: "100%",
712
+ boxSizing: "border-box",
713
+ padding: "10px 12px",
714
+ borderRadius: "var(--mn-radius-md, 0.5rem)",
715
+ backgroundColor: h,
716
+ border: `1px solid ${u ? "rgba(239,68,68,0.4)" : s}`,
717
+ color: m,
718
+ fontSize: "0.9375rem",
719
+ lineHeight: 1.6,
720
+ resize: "vertical",
721
+ fontFamily: "var(--mn-font-family, system-ui, sans-serif)",
722
+ outline: "none",
723
+ transition: "border-color 120ms"
724
+ },
725
+ onFocus: (x) => {
726
+ x.target.style.borderColor = "var(--mn-color-primary, #3B82F6)";
727
+ },
728
+ onBlur: (x) => {
729
+ x.target.style.borderColor = u ? "rgba(239,68,68,0.4)" : s;
730
+ }
731
+ }
732
+ ),
733
+ u && /* @__PURE__ */ r("p", { style: { margin: 0, fontSize: "0.8125rem", color: "#F87171" }, children: u }),
734
+ /* @__PURE__ */ a("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
735
+ /* @__PURE__ */ a("span", { style: { fontSize: "0.75rem", color: F }, children: [
736
+ i.length,
737
+ " / 8000"
738
+ ] }),
739
+ /* @__PURE__ */ a(
740
+ "button",
741
+ {
742
+ onClick: S,
743
+ disabled: l || !i.trim(),
744
+ style: {
745
+ padding: "7px 18px",
746
+ borderRadius: "var(--mn-radius-md, 0.5rem)",
747
+ border: "none",
748
+ cursor: l || !i.trim() ? "not-allowed" : "pointer",
749
+ backgroundColor: l || !i.trim() ? "rgba(59,130,246,0.4)" : "var(--mn-color-primary, #3B82F6)",
750
+ color: "#fff",
751
+ fontSize: "0.875rem",
752
+ fontWeight: 600,
753
+ fontFamily: "inherit",
754
+ transition: "background 120ms",
755
+ display: "flex",
756
+ alignItems: "center",
757
+ gap: 7
758
+ },
759
+ children: [
760
+ l && /* @__PURE__ */ r(ce, {}),
761
+ l ? "Posting…" : "Post Reply"
762
+ ]
763
+ }
764
+ )
765
+ ] })
766
+ ] });
767
+ }
768
+ function ce() {
769
+ return /* @__PURE__ */ r("span", { style: { display: "inline-block", width: 12, height: 12, border: "2px solid rgba(255,255,255,0.3)", borderTopColor: "#fff", borderRadius: "50%", animation: "mn-spin 0.6s linear infinite" }, children: /* @__PURE__ */ r("style", { children: "@keyframes mn-spin { to { transform: rotate(360deg); } }" }) });
770
+ }
771
+ function be({
772
+ post: e = J[0],
773
+ replies: o = oe,
774
+ currentUser: t = null,
775
+ onBack: n,
776
+ onVotePost: i,
777
+ onVoteReply: d,
778
+ onAccept: l,
779
+ onSubmitReply: p,
780
+ isLoading: u = !1,
781
+ isDark: b = !0,
782
+ style: f
783
+ }) {
784
+ var h;
785
+ const s = b ? "var(--mn-text-primary-dark, #F0F4FF)" : "var(--mn-text-primary-light, #1A1A2E)", m = b ? "var(--mn-text-secondary-dark, #94A3B8)" : "var(--mn-text-secondary-light, #64748B)", F = t && ((h = e == null ? void 0 : e.author) == null ? void 0 : h.id) === (t == null ? void 0 : t.id);
786
+ return u ? /* @__PURE__ */ r("div", { style: { padding: "var(--mn-spacing-xl, 32px)", fontFamily: "var(--mn-font-family, system-ui, sans-serif)", ...f }, children: /* @__PURE__ */ r(ge, { isDark: b }) }) : e ? /* @__PURE__ */ a("div", { style: {
787
+ padding: "var(--mn-spacing-xl, 32px)",
788
+ display: "flex",
789
+ flexDirection: "column",
790
+ gap: 20,
791
+ maxWidth: 860,
792
+ fontFamily: "var(--mn-font-family, system-ui, sans-serif)",
793
+ ...f
794
+ }, children: [
795
+ /* @__PURE__ */ r(
796
+ "button",
797
+ {
798
+ onClick: n,
799
+ style: {
800
+ alignSelf: "flex-start",
801
+ display: "flex",
802
+ alignItems: "center",
803
+ gap: 6,
804
+ padding: "6px 12px",
805
+ borderRadius: "var(--mn-radius-md, 0.5rem)",
806
+ border: "none",
807
+ cursor: "pointer",
808
+ backgroundColor: b ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.06)",
809
+ color: m,
810
+ fontSize: "0.875rem",
811
+ fontFamily: "inherit",
812
+ transition: "background 100ms"
813
+ },
814
+ onMouseEnter: (S) => {
815
+ S.currentTarget.style.backgroundColor = b ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.1)";
816
+ },
817
+ onMouseLeave: (S) => {
818
+ S.currentTarget.style.backgroundColor = b ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.06)";
819
+ },
820
+ children: "← Back to Forum"
821
+ }
822
+ ),
823
+ /* @__PURE__ */ r(
824
+ ae,
825
+ {
826
+ post: e,
827
+ onVote: i,
828
+ isDark: b
829
+ }
830
+ ),
831
+ /* @__PURE__ */ r(
832
+ de,
833
+ {
834
+ replies: o,
835
+ onVote: d,
836
+ onAccept: l,
837
+ canAccept: F,
838
+ currentUser: t,
839
+ onSubmit: p,
840
+ isLocked: e.isLocked,
841
+ isDark: b
842
+ }
843
+ )
844
+ ] }) : /* @__PURE__ */ a("div", { style: { padding: "var(--mn-spacing-xl, 32px)", textAlign: "center", color: m, fontFamily: "var(--mn-font-family, system-ui, sans-serif)", ...f }, children: [
845
+ /* @__PURE__ */ r("p", { style: { fontSize: 32, margin: "0 0 12px" }, children: "🔍" }),
846
+ /* @__PURE__ */ r("p", { style: { margin: 0, fontWeight: 600, color: s }, children: "Post not found" })
847
+ ] });
848
+ }
849
+ function ge({ isDark: e }) {
850
+ const o = e ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.06)", t = e ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.08)", n = e ? "var(--mn-color-card-dark, #0B0F23)" : "var(--mn-color-card-light, #FAFAF8)", i = (d, l = 12) => ({ width: d, height: l, borderRadius: 6, backgroundColor: o, animation: "mn-pulse 1.4s ease infinite" });
851
+ return /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [
852
+ /* @__PURE__ */ r("div", { style: i(80) }),
853
+ /* @__PURE__ */ a("div", { style: { borderRadius: "var(--mn-radius-lg, 0.75rem)", backgroundColor: n, border: `1px solid ${t}`, padding: "20px 24px", display: "flex", flexDirection: "column", gap: 14 }, children: [
854
+ /* @__PURE__ */ r("div", { style: i("30%", 8) }),
855
+ /* @__PURE__ */ r("div", { style: i("70%", 20) }),
856
+ /* @__PURE__ */ r("div", { style: i("45%", 10) }),
857
+ /* @__PURE__ */ r("div", { style: { height: 80, borderRadius: 6, backgroundColor: o } })
858
+ ] }),
859
+ /* @__PURE__ */ r("style", { children: "@keyframes mn-pulse { 0%,100%{opacity:.5} 50%{opacity:1} }" })
860
+ ] });
861
+ }
862
+ function ye({
863
+ categories: e = K.filter((l) => l.id !== "all"),
864
+ onSubmit: o,
865
+ onCancel: t,
866
+ currentUser: n = null,
867
+ isDark: i = !0,
868
+ style: d
869
+ }) {
870
+ const [l, p] = A(""), [u, b] = A(""), [f, s] = A(""), [m, F] = A(""), [h, S] = A([]), [x, B] = A(!1), [w, k] = A({}), $ = i ? "var(--mn-color-card-dark, #0B0F23)" : "var(--mn-color-card-light, #FAFAF8)", C = i ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.08)", W = i ? "var(--mn-text-primary-dark, #F0F4FF)" : "var(--mn-text-primary-light, #1A1A2E)", I = i ? "var(--mn-text-secondary-dark, #94A3B8)" : "var(--mn-text-secondary-light, #64748B)", R = i ? "rgba(255,255,255,0.04)" : "rgba(0,0,0,0.03)";
871
+ function T() {
872
+ const c = {};
873
+ return l.trim() || (c.title = "Title is required."), l.length > 200 && (c.title = "Title must be under 200 characters."), u.trim() || (c.body = "Body is required."), f || (c.category = "Please choose a category."), c;
874
+ }
875
+ async function L(c) {
876
+ c.preventDefault();
877
+ const y = T();
878
+ if (Object.keys(y).length) {
879
+ k(y);
880
+ return;
881
+ }
882
+ k({}), B(!0);
883
+ try {
884
+ await (o == null ? void 0 : o({ title: l.trim(), body: u.trim(), categoryId: f, tags: h }));
885
+ } finally {
886
+ B(!1);
887
+ }
888
+ }
889
+ function O(c) {
890
+ if ((c.key === "Enter" || c.key === ",") && m.trim()) {
891
+ c.preventDefault();
892
+ const y = m.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-");
893
+ !h.includes(y) && h.length < 5 && S((g) => [...g, y]), F("");
894
+ }
895
+ c.key === "Backspace" && !m && h.length && S((y) => y.slice(0, -1));
896
+ }
897
+ const P = (c) => ({
898
+ width: "100%",
899
+ boxSizing: "border-box",
900
+ padding: "10px 12px",
901
+ borderRadius: "var(--mn-radius-md, 0.5rem)",
902
+ backgroundColor: R,
903
+ border: `1px solid ${c ? "rgba(239,68,68,0.4)" : C}`,
904
+ color: W,
905
+ fontSize: "0.9375rem",
906
+ fontFamily: "var(--mn-font-family, system-ui, sans-serif)",
907
+ outline: "none",
908
+ transition: "border-color 120ms"
909
+ });
910
+ return /* @__PURE__ */ a("div", { style: {
911
+ padding: "var(--mn-spacing-xl, 32px)",
912
+ display: "flex",
913
+ flexDirection: "column",
914
+ gap: 20,
915
+ maxWidth: 780,
916
+ fontFamily: "var(--mn-font-family, system-ui, sans-serif)",
917
+ ...d
918
+ }, children: [
919
+ /* @__PURE__ */ a("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", flexWrap: "wrap", gap: 12 }, children: [
920
+ /* @__PURE__ */ a("div", { children: [
921
+ /* @__PURE__ */ r("h1", { style: { margin: 0, fontSize: "var(--mn-font-size-xl, 1.25rem)", fontWeight: 700, color: W }, children: "New Post" }),
922
+ /* @__PURE__ */ r("p", { style: { margin: "4px 0 0", fontSize: "0.875rem", color: I }, children: "Share a question, idea, or discussion with the community." })
923
+ ] }),
924
+ t && /* @__PURE__ */ r(
925
+ "button",
926
+ {
927
+ onClick: t,
928
+ style: { padding: "6px 14px", borderRadius: "var(--mn-radius-md, 0.5rem)", border: `1px solid ${C}`, cursor: "pointer", backgroundColor: "transparent", color: I, fontSize: "0.875rem", fontFamily: "inherit" },
929
+ children: "Cancel"
930
+ }
931
+ )
932
+ ] }),
933
+ /* @__PURE__ */ a(
934
+ "form",
935
+ {
936
+ onSubmit: L,
937
+ style: { borderRadius: "var(--mn-radius-lg, 0.75rem)", backgroundColor: $, border: `1px solid ${C}`, padding: "24px", display: "flex", flexDirection: "column", gap: 20 },
938
+ children: [
939
+ n && /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center", gap: 8, padding: "8px 12px", borderRadius: "var(--mn-radius-md, 0.5rem)", backgroundColor: i ? "rgba(255,255,255,0.04)" : "rgba(0,0,0,0.03)", border: `1px solid ${C}` }, children: [
940
+ /* @__PURE__ */ r(_, { name: n.name, size: 24, src: n.avatar }),
941
+ /* @__PURE__ */ a("span", { style: { fontSize: "0.875rem", color: W }, children: [
942
+ "Posting as ",
943
+ /* @__PURE__ */ r("strong", { children: n.name })
944
+ ] })
945
+ ] }),
946
+ /* @__PURE__ */ a(E, { label: "Title", error: w.title, required: !0, children: [
947
+ /* @__PURE__ */ r(
948
+ "input",
949
+ {
950
+ value: l,
951
+ onChange: (c) => {
952
+ p(c.target.value), w.title && k((y) => ({ ...y, title: "" }));
953
+ },
954
+ placeholder: "What is your question or topic?",
955
+ style: P(w.title),
956
+ onFocus: (c) => {
957
+ c.target.style.borderColor = "var(--mn-color-primary, #3B82F6)";
958
+ },
959
+ onBlur: (c) => {
960
+ c.target.style.borderColor = w.title ? "rgba(239,68,68,0.4)" : C;
961
+ }
962
+ }
963
+ ),
964
+ /* @__PURE__ */ r("div", { style: { display: "flex", justifyContent: "flex-end", marginTop: 4 }, children: /* @__PURE__ */ a("span", { style: { fontSize: "0.75rem", color: l.length > 180 ? "#F87171" : I }, children: [
965
+ l.length,
966
+ "/200"
967
+ ] }) })
968
+ ] }),
969
+ /* @__PURE__ */ r(E, { label: "Category", error: w.category, required: !0, children: /* @__PURE__ */ r("div", { style: { display: "flex", gap: 8, flexWrap: "wrap" }, children: e.map((c) => {
970
+ const y = f === c.id;
971
+ return /* @__PURE__ */ a(
972
+ "button",
973
+ {
974
+ type: "button",
975
+ onClick: () => {
976
+ s(c.id), w.category && k((g) => ({ ...g, category: "" }));
977
+ },
978
+ style: {
979
+ display: "flex",
980
+ alignItems: "center",
981
+ gap: 6,
982
+ padding: "7px 14px",
983
+ borderRadius: "var(--mn-radius-md, 0.5rem)",
984
+ border: `1px solid ${y ? "var(--mn-color-primary, #3B82F6)" : C}`,
985
+ cursor: "pointer",
986
+ fontFamily: "inherit",
987
+ fontSize: "0.875rem",
988
+ backgroundColor: y ? "rgba(59,130,246,0.1)" : R,
989
+ color: y ? "var(--mn-color-primary, #3B82F6)" : W,
990
+ transition: "all 100ms",
991
+ fontWeight: y ? 600 : 400
992
+ },
993
+ children: [
994
+ c.icon && /* @__PURE__ */ r("span", { children: c.icon }),
995
+ c.label
996
+ ]
997
+ },
998
+ c.id
999
+ );
1000
+ }) }) }),
1001
+ /* @__PURE__ */ r(E, { label: "Body", error: w.body, required: !0, children: /* @__PURE__ */ r(
1002
+ "textarea",
1003
+ {
1004
+ value: u,
1005
+ onChange: (c) => {
1006
+ b(c.target.value), w.body && k((y) => ({ ...y, body: "" }));
1007
+ },
1008
+ placeholder: "Describe your question or topic in detail. The more context you provide, the better the community can help.",
1009
+ rows: 8,
1010
+ style: { ...P(w.body), resize: "vertical", lineHeight: 1.65 },
1011
+ onFocus: (c) => {
1012
+ c.target.style.borderColor = "var(--mn-color-primary, #3B82F6)";
1013
+ },
1014
+ onBlur: (c) => {
1015
+ c.target.style.borderColor = w.body ? "rgba(239,68,68,0.4)" : C;
1016
+ }
1017
+ }
1018
+ ) }),
1019
+ /* @__PURE__ */ r(E, { label: "Tags", hint: "Up to 5 tags. Press Enter or comma to add.", children: /* @__PURE__ */ a("div", { style: { display: "flex", gap: 6, flexWrap: "wrap", padding: "8px 10px", borderRadius: "var(--mn-radius-md, 0.5rem)", backgroundColor: R, border: `1px solid ${C}`, minHeight: 42, alignItems: "center" }, children: [
1020
+ h.map((c) => /* @__PURE__ */ a("span", { style: { display: "flex", alignItems: "center", gap: 4, fontSize: "0.75rem", padding: "2px 8px", borderRadius: 9999, backgroundColor: i ? "rgba(59,130,246,0.1)" : "rgba(59,130,246,0.07)", color: "#60A5FA", border: "1px solid rgba(59,130,246,0.2)" }, children: [
1021
+ "#",
1022
+ c,
1023
+ /* @__PURE__ */ r("button", { type: "button", onClick: () => S((y) => y.filter((g) => g !== c)), style: { background: "none", border: "none", cursor: "pointer", color: "inherit", padding: 0, fontSize: 12, lineHeight: 1, display: "flex", alignItems: "center" }, children: "×" })
1024
+ ] }, c)),
1025
+ h.length < 5 && /* @__PURE__ */ r(
1026
+ "input",
1027
+ {
1028
+ value: m,
1029
+ onChange: (c) => F(c.target.value),
1030
+ onKeyDown: O,
1031
+ placeholder: h.length === 0 ? "e.g. bug, question, feature" : "",
1032
+ style: { border: "none", outline: "none", backgroundColor: "transparent", color: W, fontSize: "0.875rem", fontFamily: "inherit", flex: 1, minWidth: 120 }
1033
+ }
1034
+ )
1035
+ ] }) }),
1036
+ /* @__PURE__ */ a("div", { style: { display: "flex", justifyContent: "flex-end", gap: 10, paddingTop: 4, borderTop: `1px solid ${C}`, marginTop: 4 }, children: [
1037
+ t && /* @__PURE__ */ r("button", { type: "button", onClick: t, style: { padding: "9px 20px", borderRadius: "var(--mn-radius-md, 0.5rem)", border: `1px solid ${C}`, cursor: "pointer", backgroundColor: "transparent", color: I, fontSize: "0.875rem", fontFamily: "inherit" }, children: "Cancel" }),
1038
+ /* @__PURE__ */ a(
1039
+ "button",
1040
+ {
1041
+ type: "submit",
1042
+ disabled: x,
1043
+ style: { padding: "9px 24px", borderRadius: "var(--mn-radius-md, 0.5rem)", border: "none", cursor: x ? "wait" : "pointer", backgroundColor: x ? "rgba(59,130,246,0.5)" : "var(--mn-color-primary, #3B82F6)", color: "#fff", fontSize: "0.875rem", fontWeight: 600, fontFamily: "inherit", display: "flex", alignItems: "center", gap: 8 },
1044
+ children: [
1045
+ x && /* @__PURE__ */ r(ue, {}),
1046
+ x ? "Publishing…" : "Publish Post"
1047
+ ]
1048
+ }
1049
+ )
1050
+ ] })
1051
+ ]
1052
+ }
1053
+ )
1054
+ ] });
1055
+ }
1056
+ function E({ label: e, children: o, error: t, hint: n, required: i }) {
1057
+ return /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: 7 }, children: [
1058
+ /* @__PURE__ */ a("label", { style: { fontSize: "0.875rem", fontWeight: 600, color: "var(--mn-text-primary-dark, #F0F4FF)", display: "flex", gap: 4 }, children: [
1059
+ e,
1060
+ i && /* @__PURE__ */ r("span", { style: { color: "#F87171" }, children: "*" })
1061
+ ] }),
1062
+ o,
1063
+ n && !t && /* @__PURE__ */ r("p", { style: { margin: 0, fontSize: "0.75rem", color: "var(--mn-text-secondary-dark, #94A3B8)" }, children: n }),
1064
+ t && /* @__PURE__ */ r("p", { style: { margin: 0, fontSize: "0.8125rem", color: "#F87171" }, children: t })
1065
+ ] });
1066
+ }
1067
+ function ue() {
1068
+ return /* @__PURE__ */ r("span", { style: { display: "inline-block", width: 12, height: 12, border: "2px solid rgba(255,255,255,0.3)", borderTopColor: "#fff", borderRadius: "50%", animation: "mn-spin 0.6s linear infinite" }, children: /* @__PURE__ */ r("style", { children: "@keyframes mn-spin { to { transform: rotate(360deg); } }" }) });
1069
+ }
1070
+ export {
1071
+ j as AuthorMeta,
1072
+ Y as CategoryBadge,
1073
+ D as CategoryNav,
1074
+ ye as CreatePostPage,
1075
+ K as DEMO_CATEGORIES,
1076
+ J as DEMO_POSTS,
1077
+ oe as DEMO_REPLIES,
1078
+ te as EmptyPostList,
1079
+ fe as ForumPage,
1080
+ ee as PostCard,
1081
+ ae as PostDetail,
1082
+ re as PostList,
1083
+ be as PostPage,
1084
+ le as ReplyCard,
1085
+ se as ReplyComposer,
1086
+ de as ReplyThread,
1087
+ Q as TagChip,
1088
+ q as VoteButton
1089
+ };
1090
+ //# sourceMappingURL=mounajiforum.es.js.map