@timpel/forumkit-sdk-web 0.1.0 → 0.2.1

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.
@@ -17,6 +17,7 @@ import {
17
17
  ToolbarButton,
18
18
  VideoIcon,
19
19
  acceptAnswer,
20
+ askQuestionStreaming,
20
21
  authHeaders,
21
22
  authorAvatar,
22
23
  commentsToCommentTree,
@@ -61,6 +62,8 @@ import {
61
62
  socialPrefix,
62
63
  socialToSuffix,
63
64
  socialToUrl,
65
+ suggestStreaming,
66
+ summariseStreaming,
64
67
  threadToFeedRow,
65
68
  unacceptAnswer,
66
69
  unsaveComment,
@@ -73,14 +76,14 @@ import {
73
76
  uploadInline,
74
77
  voteOnComment,
75
78
  voteOnThread
76
- } from "./chunk-YICVG5QM.js";
79
+ } from "./chunk-2UVRYLED.js";
77
80
 
78
81
  // src/components/forum-kit.ts
79
82
  import { createElement } from "react";
80
83
  import { createRoot } from "react-dom/client";
81
84
 
82
85
  // src/views/hooks/use-forum-state.tsx
83
- import { createContext as createContext3, useContext as useContext2, useReducer, useCallback, useEffect as useEffect2, useRef } from "react";
86
+ import { createContext as createContext3, useContext as useContext2, useReducer, useCallback, useEffect as useEffect2, useRef as useRef2 } from "react";
84
87
 
85
88
  // src/views/api/search.ts
86
89
  var API_BASE = typeof window !== "undefined" ? window.FK_API_URL ?? "" : "";
@@ -203,48 +206,11 @@ import { createContext } from "react";
203
206
  var ThemeHostContext = createContext({ setThemeAttr: () => {
204
207
  } });
205
208
 
206
- // src/views/data/fixtures.ts
207
- var SUMMARY_POINTS = [
208
- "Warmth is specificity, not adjectives \u2014 name the cause, not the feeling.",
209
- "Use the read-aloud test: copy you would be embarrassed to say out loud is too precious.",
210
- "Give every warm line a job \u2014 reduce anxiety or clarify the next step, or cut it."
211
- ];
212
- var SUGGESTED_REPLY = "Building on Idris and Priya \u2014 a quick rule we could adopt: keep a warm line only if deleting it makes the next step less clear. Warmth that fails that test is ornament.";
213
-
214
209
  // src/views/api/ai.ts
215
210
  var API_BASE5 = typeof window !== "undefined" ? window.FK_API_URL ?? "" : "";
216
211
  function authHeaders4(token) {
217
212
  return token ? { Authorization: `Bearer ${token}` } : {};
218
213
  }
219
- async function callSummarise(threadId, token) {
220
- try {
221
- const res = await fetch(`${API_BASE5}/threads/${threadId}/ai/summarise`, {
222
- method: "POST",
223
- headers: authHeaders4(token)
224
- });
225
- if (!res.ok) throw new Error(`HTTP ${res.status}`);
226
- const data = await res.json();
227
- const points = data.summary?.keyPoints;
228
- if (Array.isArray(points) && points.length > 0) return points;
229
- throw new Error("empty response");
230
- } catch {
231
- return SUMMARY_POINTS;
232
- }
233
- }
234
- async function callSuggest(threadId, token) {
235
- try {
236
- const res = await fetch(`${API_BASE5}/threads/${threadId}/ai/suggest`, {
237
- method: "POST",
238
- headers: authHeaders4(token)
239
- });
240
- if (!res.ok) throw new Error(`HTTP ${res.status}`);
241
- const data = await res.json();
242
- if (data.suggestion?.suggestion) return data.suggestion.suggestion;
243
- throw new Error("empty response");
244
- } catch {
245
- return SUGGESTED_REPLY;
246
- }
247
- }
248
214
  async function callSurfaceRelated(threadId, token) {
249
215
  try {
250
216
  const res = await fetch(`${API_BASE5}/threads/${threadId}/ai/surface-related`, {
@@ -259,6 +225,16 @@ async function callSurfaceRelated(threadId, token) {
259
225
  return [];
260
226
  }
261
227
  }
228
+ async function callSummariseStreaming(threadId, onEvent, token) {
229
+ await summariseStreaming(API_BASE5, threadId, token, onEvent);
230
+ }
231
+ async function callSuggestStreaming(threadId, onEvent, token) {
232
+ await suggestStreaming(API_BASE5, threadId, token, onEvent);
233
+ }
234
+ async function callAskStreaming(forumId, q, token, onEvent) {
235
+ if (!token) throw new Error("Not authenticated");
236
+ await askQuestionStreaming(API_BASE5, forumId, q, token, onEvent);
237
+ }
262
238
  async function callSuggestMetadata(forumId, title, body, existingTags, token) {
263
239
  try {
264
240
  const res = await fetch(`${API_BASE5}/forums/${forumId}/ai/suggest-metadata`, {
@@ -363,7 +339,7 @@ function deleteDraft2(forumId, draftId, token) {
363
339
  }
364
340
 
365
341
  // src/views/hooks/use-session.tsx
366
- import { createContext as createContext2, useContext, useEffect, useState } from "react";
342
+ import { createContext as createContext2, useContext, useEffect, useRef, useState } from "react";
367
343
 
368
344
  // src/views/api/auth.ts
369
345
  var API_BASE10 = typeof window !== "undefined" ? window.FK_API_URL ?? "" : "";
@@ -386,6 +362,7 @@ function SessionProvider({ config, children }) {
386
362
  onLogout: config.onLogout,
387
363
  platform
388
364
  });
365
+ const expiresAtRef = useRef(0);
389
366
  useEffect(() => {
390
367
  let cancelled = false;
391
368
  let refreshTimer = null;
@@ -393,6 +370,7 @@ function SessionProvider({ config, children }) {
393
370
  const RETRY_DELAY_MS = 15e3;
394
371
  function scheduleRefresh(expiresIn) {
395
372
  if (cancelled) return;
373
+ expiresAtRef.current = Date.now() + expiresIn * 1e3;
396
374
  refreshTimer = setTimeout(() => {
397
375
  void refresh();
398
376
  }, expiresIn * 1e3 * 0.8);
@@ -411,10 +389,22 @@ function SessionProvider({ config, children }) {
411
389
  }, RETRY_DELAY_MS);
412
390
  });
413
391
  }
392
+ function handleVisibility() {
393
+ if (document.visibilityState !== "visible") return;
394
+ const msRemaining = expiresAtRef.current - Date.now();
395
+ if (msRemaining <= 0) {
396
+ void refresh();
397
+ } else {
398
+ if (refreshTimer) clearTimeout(refreshTimer);
399
+ scheduleRefresh(msRemaining / 1e3);
400
+ }
401
+ }
402
+ document.addEventListener("visibilitychange", handleVisibility);
414
403
  setState({ status: "loading", forumId: config.forumId, apiUrl, sessionToken: null, error: null, onLogout: config.onLogout, platform });
415
404
  void refresh();
416
405
  return () => {
417
406
  cancelled = true;
407
+ document.removeEventListener("visibilitychange", handleVisibility);
418
408
  if (refreshTimer) clearTimeout(refreshTimer);
419
409
  if (retryTimer) clearTimeout(retryTimer);
420
410
  };
@@ -594,7 +584,7 @@ var initialState = {
594
584
  draftId: null,
595
585
  savingDraft: false
596
586
  },
597
- asst: { summarizing: false, summary: null, suggested: false, surfacing: false, related: null },
587
+ asst: { summarizing: false, summary: null, suggested: false, suggestedText: null, surfacing: false, related: null },
598
588
  profile: {
599
589
  activeTab: "Overview",
600
590
  id: null,
@@ -619,6 +609,7 @@ var initialState = {
619
609
  viewedProfile: null,
620
610
  settings: { open: false },
621
611
  draftsModal: { open: false, items: [], loading: false, highlightedDraftId: null },
612
+ ask: { query: "" },
622
613
  search: { query: "", results: [], loading: false, open: false, resultsQuery: "", resultsSection: "all" },
623
614
  notifications: { unreadCount: 0 },
624
615
  shareModal: { open: false, threadId: null },
@@ -658,7 +649,8 @@ function reducer(state, action) {
658
649
  ...state,
659
650
  view: "thread",
660
651
  accountMenu: { open: false },
661
- thread: { ...state.thread, activePostId: action.postId },
652
+ thread: { ...state.thread, activePostId: action.postId, commentInput: "" },
653
+ asst: { summarizing: false, summary: null, suggested: false, suggestedText: null, surfacing: false, related: null },
662
654
  history: state.view === "thread" && state.thread.activePostId === action.postId ? state.history : [...state.history, buildNavEntry(state, action.fromScrollTop)]
663
655
  };
664
656
  // Pops the most recent nav entry and restores that page's identity
@@ -1011,6 +1003,15 @@ function reducer(state, action) {
1011
1003
  search: { ...state.search, open: false, resultsQuery: action.query, resultsSection: "all" },
1012
1004
  history: [...state.history, buildNavEntry(state, action.fromScrollTop)]
1013
1005
  };
1006
+ case "OPEN_ASK":
1007
+ return {
1008
+ ...state,
1009
+ view: "ask",
1010
+ ask: { query: action.query },
1011
+ search: { ...state.search, open: false },
1012
+ history: [...state.history, buildNavEntry(state, action.fromScrollTop)],
1013
+ pendingScrollTop: 0
1014
+ };
1014
1015
  // "Show all →" on a section, or GO_BACK returning into one — pushes
1015
1016
  // history too so the back button can step from a drilled-into section
1016
1017
  // back to the 'all' preview instead of leaving the results page.
@@ -1151,10 +1152,18 @@ function reducer(state, action) {
1151
1152
  return { ...state, viewedProfile: { ...state.viewedProfile, activityContentType: action.contentType, activityPage: 1 } };
1152
1153
  case "ASST_SUMMARIZING":
1153
1154
  return { ...state, asst: { ...state.asst, summarizing: true, summary: null } };
1155
+ case "ASST_SUMMARY_POINT": {
1156
+ const prev = state.asst.summary;
1157
+ return { ...state, asst: { ...state.asst, summary: { points: [...prev?.points ?? [], action.point], note: prev?.note ?? "" } } };
1158
+ }
1159
+ case "ASST_SUMMARY_DONE":
1160
+ return { ...state, asst: { ...state.asst, summarizing: false, summary: { points: state.asst.summary?.points ?? [], note: action.note } } };
1154
1161
  case "ASST_SUMMARY":
1155
1162
  return { ...state, asst: { ...state.asst, summarizing: false, summary: { points: action.points, note: action.note } } };
1163
+ case "ASST_SUGGEST_CHUNK":
1164
+ return { ...state, asst: { ...state.asst, suggestedText: action.text } };
1156
1165
  case "ASST_SUGGEST":
1157
- return { ...state, thread: { ...state.thread, commentInput: action.text }, asst: { ...state.asst, suggested: true } };
1166
+ return { ...state, asst: { ...state.asst, suggested: true, suggestedText: action.text } };
1158
1167
  case "ASST_SURFACING":
1159
1168
  return { ...state, asst: { ...state.asst, surfacing: true, related: null } };
1160
1169
  case "ASST_RELATED":
@@ -1173,7 +1182,7 @@ function useForumStateInternal() {
1173
1182
  const forumId = session.forumId;
1174
1183
  const sessionToken = session.sessionToken ?? void 0;
1175
1184
  const themeHost = useContext2(ThemeHostContext);
1176
- const scrollTopRef = useRef(0);
1185
+ const scrollTopRef = useRef2(0);
1177
1186
  const reportScroll = useCallback((y) => {
1178
1187
  scrollTopRef.current = y;
1179
1188
  }, []);
@@ -1518,6 +1527,10 @@ ${linkUrl}`.trim() : state.composer.body.trim();
1518
1527
  (section) => dispatch({ type: "SET_SEARCH_RESULTS_SECTION", section, fromScrollTop: scrollTopRef.current }),
1519
1528
  []
1520
1529
  );
1530
+ const openAsk = useCallback(
1531
+ (query) => dispatch({ type: "OPEN_ASK", query, fromScrollTop: scrollTopRef.current }),
1532
+ []
1533
+ );
1521
1534
  useEffect2(() => {
1522
1535
  const query = state.search.query.trim();
1523
1536
  if (!query || !sessionToken || !forumId) {
@@ -1667,14 +1680,34 @@ ${linkUrl}`.trim() : state.composer.body.trim();
1667
1680
  const summarize = useCallback(async () => {
1668
1681
  if (state.asst.summarizing || state.thread.activePostId === null) return;
1669
1682
  dispatch({ type: "ASST_SUMMARIZING" });
1670
- const points = await callSummarise(state.thread.activePostId, sessionToken);
1671
- const note = `Synthesized from ${state.comments.length} comment${state.comments.length !== 1 ? "s" : ""}`;
1672
- dispatch({ type: "ASST_SUMMARY", points, note });
1683
+ const threadId = state.thread.activePostId;
1684
+ let pointCount = 0;
1685
+ try {
1686
+ await callSummariseStreaming(threadId, (event) => {
1687
+ if (event.type === "keyPoint" || event.type === "conclusion" || event.type === "openQuestion") {
1688
+ pointCount++;
1689
+ dispatch({ type: "ASST_SUMMARY_POINT", point: event.text });
1690
+ }
1691
+ }, sessionToken);
1692
+ } catch {
1693
+ }
1694
+ const note = pointCount > 0 ? `Synthesized from ${state.comments.length} comment${state.comments.length !== 1 ? "s" : ""}` : "AI service unavailable";
1695
+ dispatch({ type: "ASST_SUMMARY_DONE", note });
1673
1696
  }, [state.asst.summarizing, state.thread.activePostId, state.comments.length, sessionToken]);
1674
1697
  const suggest = useCallback(async () => {
1675
1698
  if (state.thread.activePostId === null) return;
1676
- const text = await callSuggest(state.thread.activePostId, sessionToken);
1677
- dispatch({ type: "ASST_SUGGEST", text });
1699
+ const threadId = state.thread.activePostId;
1700
+ let finalText = "";
1701
+ try {
1702
+ await callSuggestStreaming(threadId, (event) => {
1703
+ if (event.type === "chunk") {
1704
+ finalText += event.text;
1705
+ dispatch({ type: "ASST_SUGGEST_CHUNK", text: finalText });
1706
+ }
1707
+ }, sessionToken);
1708
+ } catch {
1709
+ }
1710
+ dispatch({ type: "ASST_SUGGEST", text: finalText });
1678
1711
  }, [state.thread.activePostId, sessionToken]);
1679
1712
  const surfaceRelated = useCallback(async () => {
1680
1713
  if (state.asst.surfacing || state.thread.activePostId === null) return;
@@ -1934,7 +1967,7 @@ ${linkUrl}`.trim() : state.composer.body.trim();
1934
1967
  if (!threadId) throw new Error("No thread selected to share");
1935
1968
  await shareThreadWithUsers2(forumId, threadId, recipientUserIds, message, sessionToken);
1936
1969
  }, [state.shareModal.threadId, forumId, sessionToken]);
1937
- const firedThreadBootstrap = useRef(false);
1970
+ const firedThreadBootstrap = useRef2(false);
1938
1971
  useEffect2(() => {
1939
1972
  if (firedThreadBootstrap.current || !sessionToken || !forumId) return;
1940
1973
  const threadId = new URLSearchParams(window.location.search).get("fk_thread");
@@ -2059,6 +2092,7 @@ ${linkUrl}`.trim() : state.composer.body.trim();
2059
2092
  closeSearchDropdown,
2060
2093
  openSearchResults,
2061
2094
  openSearchResultsSection,
2095
+ openAsk,
2062
2096
  setProfileTab,
2063
2097
  setProfileSort,
2064
2098
  setProfileContentType,
@@ -2106,7 +2140,7 @@ function useForum() {
2106
2140
  }
2107
2141
 
2108
2142
  // src/views/components/layout/shell.tsx
2109
- import { useEffect as useEffect4, useRef as useRef3 } from "react";
2143
+ import { useEffect as useEffect4, useRef as useRef4, useState as useState5 } from "react";
2110
2144
 
2111
2145
  // src/views/components/layout/top-nav.tsx
2112
2146
  import { useState as useState3 } from "react";
@@ -2290,8 +2324,9 @@ function CheckIcon({ size = 18 }) {
2290
2324
  function HamburgerIcon({ size = 21 }) {
2291
2325
  return /* @__PURE__ */ jsx6("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", children: /* @__PURE__ */ jsx6("path", { d: "M4 6h16M4 12h16M4 18h16" }) });
2292
2326
  }
2293
- function HomeIcon({ size = 21 }) {
2294
- return /* @__PURE__ */ jsx6("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "currentColor", stroke: "none", children: /* @__PURE__ */ jsx6("path", { d: "M11.3 3.3a1 1 0 011.4 0l8 7.4a1 1 0 01-.7 1.7H19V20a1 1 0 01-1 1h-4v-6h-4v6H6a1 1 0 01-1-1v-7.6H3.9a1 1 0 01-.7-1.7z" }) });
2327
+ function HomeIcon({ size = 21, active = false }) {
2328
+ const d = "M11.3 3.3a1 1 0 011.4 0l8 7.4a1 1 0 01-.7 1.7H19V20a1 1 0 01-1 1h-4v-6h-4v6H6a1 1 0 01-1-1v-7.6H3.9a1 1 0 01-.7-1.7z";
2329
+ return active ? /* @__PURE__ */ jsx6("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "currentColor", stroke: "none", children: /* @__PURE__ */ jsx6("path", { d }) }) : /* @__PURE__ */ jsx6("svg", { width: size, height: size, ...base, children: /* @__PURE__ */ jsx6("path", { d }) });
2295
2330
  }
2296
2331
  function PopularIcon({ size = 21 }) {
2297
2332
  return /* @__PURE__ */ jsxs4("svg", { width: size, height: size, ...base, strokeWidth: 1.7, children: [
@@ -2418,6 +2453,12 @@ function TrashIcon({ size = 18 }) {
2418
2453
  /* @__PURE__ */ jsx6("path", { d: "M9 6V4a1 1 0 011-1h4a1 1 0 011 1v2" })
2419
2454
  ] });
2420
2455
  }
2456
+ function CopyIcon({ size = 16 }) {
2457
+ return /* @__PURE__ */ jsxs4("svg", { width: size, height: size, ...base, strokeWidth: 1.7, children: [
2458
+ /* @__PURE__ */ jsx6("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
2459
+ /* @__PURE__ */ jsx6("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" })
2460
+ ] });
2461
+ }
2421
2462
  function PencilIcon({ size = 14 }) {
2422
2463
  return /* @__PURE__ */ jsxs4("svg", { width: size, height: size, ...base, strokeWidth: 1.7, children: [
2423
2464
  /* @__PURE__ */ jsx6("path", { d: "M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" }),
@@ -2506,6 +2547,12 @@ function LinkIcon2({ size = 18 }) {
2506
2547
  /* @__PURE__ */ jsx6("path", { d: "M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71" })
2507
2548
  ] });
2508
2549
  }
2550
+ function ClockIcon({ size = 16 }) {
2551
+ return /* @__PURE__ */ jsxs4("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round", children: [
2552
+ /* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "8.5" }),
2553
+ /* @__PURE__ */ jsx6("path", { d: "M12 7.5V12l3 2" })
2554
+ ] });
2555
+ }
2509
2556
  function AiSparkleIcon({ size = 17, gradId }) {
2510
2557
  return /* @__PURE__ */ jsxs4("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: [
2511
2558
  /* @__PURE__ */ jsx6("defs", { children: /* @__PURE__ */ jsxs4("linearGradient", { id: gradId, x1: "3", y1: "3", x2: "22", y2: "20", gradientUnits: "userSpaceOnUse", children: [
@@ -2668,17 +2715,142 @@ function RenderedBody({ body, className }) {
2668
2715
 
2669
2716
  // src/views/components/layout/search-results-dropdown.tsx
2670
2717
  import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
2718
+ var HISTORY_KEY = "fk_search_history";
2719
+ var MAX_HISTORY = 10;
2720
+ function saveSearchHistory(query) {
2721
+ try {
2722
+ const raw = localStorage.getItem(HISTORY_KEY);
2723
+ const current = raw ? JSON.parse(raw) : [];
2724
+ const deduped = [query, ...current.filter((q) => q !== query)].slice(0, MAX_HISTORY);
2725
+ localStorage.setItem(HISTORY_KEY, JSON.stringify(deduped));
2726
+ } catch {
2727
+ }
2728
+ }
2729
+ function loadSearchHistory() {
2730
+ try {
2731
+ const raw = localStorage.getItem(HISTORY_KEY);
2732
+ return raw ? JSON.parse(raw) : [];
2733
+ } catch {
2734
+ return [];
2735
+ }
2736
+ }
2737
+ function removeFromSearchHistory(query) {
2738
+ try {
2739
+ const raw = localStorage.getItem(HISTORY_KEY);
2740
+ const current = raw ? JSON.parse(raw) : [];
2741
+ const next = current.filter((q) => q !== query);
2742
+ localStorage.setItem(HISTORY_KEY, JSON.stringify(next));
2743
+ return next;
2744
+ } catch {
2745
+ return [];
2746
+ }
2747
+ }
2671
2748
  function SearchResultsDropdown({
2672
2749
  loading,
2673
2750
  results,
2674
2751
  query,
2675
2752
  onClose,
2676
2753
  onSelectResult,
2677
- onSeeMore
2754
+ onSeeMore,
2755
+ latestPosts,
2756
+ featuredPosts,
2757
+ onOpenPost,
2758
+ onHistoryChange,
2759
+ history = [],
2760
+ onSelectHistory
2678
2761
  }) {
2762
+ const isEmpty = !query.trim();
2763
+ function handleRemoveHistory(q) {
2764
+ const next = removeFromSearchHistory(q);
2765
+ onHistoryChange?.(next);
2766
+ }
2767
+ function handleHistoryClick(q) {
2768
+ onSelectHistory?.(q);
2769
+ }
2679
2770
  return /* @__PURE__ */ jsxs6(Fragment2, { children: [
2680
2771
  /* @__PURE__ */ jsx10("div", { className: "fk-search-dropdown-backdrop", onClick: onClose }),
2681
- /* @__PURE__ */ jsx10("div", { className: "fk-search-dropdown-panel", children: loading && results.length === 0 ? /* @__PURE__ */ jsx10("div", { className: "fk-search-dropdown-status", children: "Searching\u2026" }) : results.length === 0 ? /* @__PURE__ */ jsxs6("div", { className: "fk-search-dropdown-status", children: [
2772
+ /* @__PURE__ */ jsx10("div", { className: "fk-search-dropdown-panel", children: isEmpty ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
2773
+ history.length > 0 && /* @__PURE__ */ jsxs6("div", { className: "fk-search-dropdown-section", children: [
2774
+ /* @__PURE__ */ jsx10("div", { className: "fk-search-dropdown-section-title", children: "Recent" }),
2775
+ history.map((q) => /* @__PURE__ */ jsxs6("div", { className: "fk-search-dropdown-history-row", children: [
2776
+ /* @__PURE__ */ jsxs6(
2777
+ "button",
2778
+ {
2779
+ type: "button",
2780
+ className: "fk-search-dropdown-history-main",
2781
+ onClick: () => handleHistoryClick(q),
2782
+ children: [
2783
+ /* @__PURE__ */ jsx10(ClockIcon, { size: 14 }),
2784
+ /* @__PURE__ */ jsx10("span", { className: "fk-search-dropdown-history-text", children: q })
2785
+ ]
2786
+ }
2787
+ ),
2788
+ /* @__PURE__ */ jsx10(
2789
+ "button",
2790
+ {
2791
+ type: "button",
2792
+ className: "fk-search-dropdown-history-clear",
2793
+ "aria-label": "Remove",
2794
+ onClick: () => handleRemoveHistory(q),
2795
+ children: "\u2715"
2796
+ }
2797
+ )
2798
+ ] }, q))
2799
+ ] }),
2800
+ latestPosts && latestPosts.length > 0 && /* @__PURE__ */ jsxs6("div", { className: "fk-search-dropdown-section", children: [
2801
+ /* @__PURE__ */ jsx10("div", { className: "fk-search-dropdown-section-title", children: "Latest" }),
2802
+ latestPosts.slice(0, 5).map((item) => /* @__PURE__ */ jsxs6(
2803
+ "button",
2804
+ {
2805
+ type: "button",
2806
+ className: "fk-search-dropdown-row",
2807
+ onClick: () => {
2808
+ onClose();
2809
+ onOpenPost?.(item.id);
2810
+ },
2811
+ children: [
2812
+ item.imageUrl && /* @__PURE__ */ jsx10(Thumbnail, { gradient: item.thumbGradient ?? "", imageUrl: item.imageUrl, width: 40, height: 40, radius: 8 }),
2813
+ /* @__PURE__ */ jsxs6("span", { className: "fk-search-dropdown-row-text", children: [
2814
+ /* @__PURE__ */ jsx10("span", { className: "fk-search-dropdown-row-title", children: item.title }),
2815
+ /* @__PURE__ */ jsxs6("span", { className: "fk-search-dropdown-row-snippet", children: [
2816
+ item.author,
2817
+ " \xB7 ",
2818
+ item.time
2819
+ ] })
2820
+ ] })
2821
+ ]
2822
+ },
2823
+ item.id
2824
+ ))
2825
+ ] }),
2826
+ featuredPosts && featuredPosts.length > 0 && /* @__PURE__ */ jsxs6("div", { className: "fk-search-dropdown-section", children: [
2827
+ /* @__PURE__ */ jsx10("div", { className: "fk-search-dropdown-section-title", children: "Featured" }),
2828
+ featuredPosts.slice(0, 4).map((item) => /* @__PURE__ */ jsxs6(
2829
+ "button",
2830
+ {
2831
+ type: "button",
2832
+ className: "fk-search-dropdown-row",
2833
+ onClick: () => {
2834
+ onClose();
2835
+ onOpenPost?.(item.id);
2836
+ },
2837
+ children: [
2838
+ item.imageUrl && /* @__PURE__ */ jsx10(Thumbnail, { gradient: item.thumbGradient ?? "", imageUrl: item.imageUrl, width: 40, height: 40, radius: 8 }),
2839
+ /* @__PURE__ */ jsxs6("span", { className: "fk-search-dropdown-row-text", children: [
2840
+ /* @__PURE__ */ jsx10("span", { className: "fk-search-dropdown-row-title", children: item.title }),
2841
+ /* @__PURE__ */ jsxs6("span", { className: "fk-search-dropdown-row-snippet", children: [
2842
+ item.author,
2843
+ " \xB7 ",
2844
+ item.time
2845
+ ] })
2846
+ ] })
2847
+ ]
2848
+ },
2849
+ item.id
2850
+ ))
2851
+ ] }),
2852
+ history.length === 0 && (!latestPosts || latestPosts.length === 0) && /* @__PURE__ */ jsx10("div", { className: "fk-search-dropdown-status", children: "Search posts, comments, and people" })
2853
+ ] }) : loading && results.length === 0 ? /* @__PURE__ */ jsx10("div", { className: "fk-search-dropdown-status", children: "Searching\u2026" }) : results.length === 0 ? /* @__PURE__ */ jsxs6("div", { className: "fk-search-dropdown-status", children: [
2682
2854
  "No results for \u201C",
2683
2855
  query,
2684
2856
  "\u201D"
@@ -2730,6 +2902,7 @@ function TopNav({
2730
2902
  onOpenNotifications,
2731
2903
  unreadCount,
2732
2904
  onAsk,
2905
+ askActive,
2733
2906
  compact,
2734
2907
  scopeTag,
2735
2908
  avatarUrl,
@@ -2743,20 +2916,29 @@ function TopNav({
2743
2916
  onSelectSearchResult,
2744
2917
  onSubmitSearch,
2745
2918
  theme,
2746
- onToggleTheme
2919
+ onToggleTheme,
2920
+ latestPosts,
2921
+ featuredPosts,
2922
+ onOpenPost
2747
2923
  }) {
2748
2924
  const { gradient, letter } = authorAvatar2(displayName || void 0, displayName || "You");
2749
2925
  const [menuOpen, setMenuOpen] = useState3(false);
2750
2926
  const [tagActive, setTagActive] = useState3(true);
2927
+ const [history, setHistory] = useState3(() => loadSearchHistory());
2751
2928
  const showTag = !!(scopeTag && tagActive);
2752
2929
  const placeholder = showTag ? `Search in u/${scopeTag}` : "Find anything";
2930
+ function handleSubmit(query) {
2931
+ saveSearchHistory(query);
2932
+ setHistory(loadSearchHistory());
2933
+ onSubmitSearch(query);
2934
+ }
2753
2935
  return /* @__PURE__ */ jsxs7("header", { className: "fk-topnav", children: [
2754
2936
  /* @__PURE__ */ jsxs7("button", { type: "button", className: "fk-topnav-brand", onClick: onHome, children: [
2755
2937
  /* @__PURE__ */ jsx12(MascotIcon, { size: 34 }),
2756
2938
  /* @__PURE__ */ jsx12("span", { className: "fk-topnav-wordmark", children: "FORUM KIT" })
2757
2939
  ] }),
2758
2940
  /* @__PURE__ */ jsxs7("div", { className: "fk-topnav-search-wrap", children: [
2759
- /* @__PURE__ */ jsxs7("div", { className: `fk-topnav-search${compact ? " fk-topnav-search--compact" : ""}`, children: [
2941
+ /* @__PURE__ */ jsxs7("div", { className: `fk-topnav-search${compact ? " fk-topnav-search--compact" : ""}${askActive ? " fk-topnav-search--ask-active" : ""}`, children: [
2760
2942
  /* @__PURE__ */ jsx12(SearchIcon, { size: compact ? 18 : 20 }),
2761
2943
  showTag && /* @__PURE__ */ jsxs7("span", { className: "fk-topnav-scope-tag", children: [
2762
2944
  "u/",
@@ -2780,7 +2962,7 @@ function TopNav({
2780
2962
  value: searchQuery,
2781
2963
  onChange: (e) => onSearchChange(e.target.value),
2782
2964
  onKeyDown: (e) => {
2783
- if (e.key === "Enter" && searchQuery.trim()) onSubmitSearch(searchQuery.trim());
2965
+ if (e.key === "Enter" && searchQuery.trim()) handleSubmit(searchQuery.trim());
2784
2966
  }
2785
2967
  }
2786
2968
  ),
@@ -2813,7 +2995,16 @@ function TopNav({
2813
2995
  query: searchQuery,
2814
2996
  onClose: onCloseSearchDropdown,
2815
2997
  onSelectResult: onSelectSearchResult,
2816
- onSeeMore: () => onSubmitSearch(searchQuery.trim())
2998
+ onSeeMore: () => handleSubmit(searchQuery.trim()),
2999
+ latestPosts,
3000
+ featuredPosts,
3001
+ onOpenPost,
3002
+ history,
3003
+ onHistoryChange: (next) => setHistory(next),
3004
+ onSelectHistory: (q) => {
3005
+ onSearchChange(q);
3006
+ handleSubmit(q);
3007
+ }
2817
3008
  }
2818
3009
  )
2819
3010
  ] }),
@@ -2846,13 +3037,13 @@ function TopNav({
2846
3037
  }
2847
3038
 
2848
3039
  // src/views/hooks/use-sidebar-hover.ts
2849
- import { useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
3040
+ import { useEffect as useEffect3, useRef as useRef3, useState as useState4 } from "react";
2850
3041
  var LEAVE_DEBOUNCE_MS = 140;
2851
3042
  function useSidebarHover() {
2852
3043
  const [hoverPreview, setHoverPreview] = useState4(false);
2853
- const hamburgerRef = useRef2(null);
2854
- const asideRef = useRef2(null);
2855
- const leaveTimer = useRef2(null);
3044
+ const hamburgerRef = useRef3(null);
3045
+ const asideRef = useRef3(null);
3046
+ const leaveTimer = useRef3(null);
2856
3047
  useEffect3(() => {
2857
3048
  const hamburger = hamburgerRef.current;
2858
3049
  const aside = asideRef.current;
@@ -2885,9 +3076,9 @@ function useSidebarHover() {
2885
3076
  // src/views/components/layout/sidebar.tsx
2886
3077
  import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
2887
3078
  var NAV_ITEMS = [
2888
- { label: "Home", icon: /* @__PURE__ */ jsx13(HomeIcon, {}), scope: "home" },
2889
- { label: "Popular", icon: /* @__PURE__ */ jsx13(PopularIcon, {}), scope: "popular" },
2890
- { label: "News", icon: /* @__PURE__ */ jsx13(NewsIcon, {}), scope: "news" }
3079
+ { label: "Home", icon: (active) => /* @__PURE__ */ jsx13(HomeIcon, { active }), scope: "home" },
3080
+ { label: "Popular", icon: () => /* @__PURE__ */ jsx13(PopularIcon, {}), scope: "popular" },
3081
+ { label: "News", icon: () => /* @__PURE__ */ jsx13(NewsIcon, {}), scope: "news" }
2891
3082
  // "Explore" (communities) removed for now — no backend concept exists
2892
3083
  // yet and it's planned as future work, not a stub worth showing today.
2893
3084
  ];
@@ -2917,7 +3108,7 @@ function Sidebar({ pinned, forceOpen, activeScope, onTogglePin, onSelectScope })
2917
3108
  onClick: item.scope ? () => onSelectScope(item.scope) : void 0,
2918
3109
  className: `fk-sidebar-item${active ? " fk-sidebar-item--active" : ""}`,
2919
3110
  children: [
2920
- item.icon,
3111
+ item.icon(active),
2921
3112
  item.label
2922
3113
  ]
2923
3114
  },
@@ -2933,6 +3124,7 @@ function Shell({
2933
3124
  children,
2934
3125
  rail,
2935
3126
  onAsk,
3127
+ askActive,
2936
3128
  compactSearch,
2937
3129
  scrollMain = true,
2938
3130
  scopeTag,
@@ -2948,17 +3140,27 @@ function Shell({
2948
3140
  setSearchQuery,
2949
3141
  closeSearchDropdown,
2950
3142
  openSearchResults,
3143
+ openAsk,
2951
3144
  reportScroll,
2952
3145
  clearPendingScroll,
2953
3146
  toggleTheme
2954
3147
  } = useForum();
2955
- const mainRef = useRef3(null);
3148
+ const mainRef = useRef4(null);
3149
+ const [isActivating, setIsActivating] = useState5(false);
3150
+ const activatingTimer = useRef4(null);
2956
3151
  const theme = state.profile.themePreference ?? (typeof window !== "undefined" && localStorage.getItem("fk_theme") === "light" ? "light" : "dark");
2957
3152
  useEffect4(() => {
2958
3153
  if (state.pendingScrollTop === null) return;
2959
3154
  mainRef.current?.scrollTo({ top: state.pendingScrollTop });
2960
3155
  clearPendingScroll();
2961
3156
  }, [state.pendingScrollTop, clearPendingScroll]);
3157
+ const baseAskHandler = onAsk ?? (!askActive ? () => openAsk(state.search.query ?? "") : void 0);
3158
+ const effectiveAskHandler = baseAskHandler ? () => {
3159
+ setIsActivating(true);
3160
+ if (activatingTimer.current) clearTimeout(activatingTimer.current);
3161
+ activatingTimer.current = setTimeout(() => setIsActivating(false), 1600);
3162
+ baseAskHandler();
3163
+ } : void 0;
2962
3164
  return /* @__PURE__ */ jsxs9("div", { className: "fk-shell", children: [
2963
3165
  /* @__PURE__ */ jsx14(
2964
3166
  TopNav,
@@ -2968,7 +3170,8 @@ function Shell({
2968
3170
  onViewProfile: () => setView("profile"),
2969
3171
  onOpenNotifications: () => setView("notifications"),
2970
3172
  unreadCount: state.notifications.unreadCount,
2971
- onAsk,
3173
+ onAsk: effectiveAskHandler,
3174
+ askActive: askActive || isActivating,
2972
3175
  compact: compactSearch,
2973
3176
  scopeTag,
2974
3177
  avatarUrl: state.profile.avatarUrl,
@@ -2985,7 +3188,10 @@ function Shell({
2985
3188
  },
2986
3189
  onSubmitSearch: openSearchResults,
2987
3190
  theme,
2988
- onToggleTheme: () => void toggleTheme()
3191
+ onToggleTheme: () => void toggleTheme(),
3192
+ latestPosts: state.rail.latest,
3193
+ featuredPosts: state.rail.featured,
3194
+ onOpenPost: openThread
2989
3195
  }
2990
3196
  ),
2991
3197
  /* @__PURE__ */ jsxs9("div", { className: "fk-shell-body", children: [
@@ -3166,7 +3372,7 @@ function FeedControls({
3166
3372
  }
3167
3373
 
3168
3374
  // src/views/components/feed/post-card.tsx
3169
- import { useLayoutEffect, useRef as useRef4, useState as useState8 } from "react";
3375
+ import { useLayoutEffect, useRef as useRef5, useState as useState9 } from "react";
3170
3376
 
3171
3377
  // src/views/components/shared/carousel.tsx
3172
3378
  import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
@@ -3235,10 +3441,10 @@ function Carousel({ items, index, onIndexChange, onItemClick }) {
3235
3441
  }
3236
3442
 
3237
3443
  // src/views/components/shared/lightbox.tsx
3238
- import { useState as useState5 } from "react";
3444
+ import { useState as useState6 } from "react";
3239
3445
  import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
3240
3446
  function Lightbox({ items, startIndex, onClose }) {
3241
- const [index, setIndex] = useState5(startIndex);
3447
+ const [index, setIndex] = useState6(startIndex);
3242
3448
  return /* @__PURE__ */ jsxs13("div", { className: "fk-lightbox-overlay", onClick: onClose, children: [
3243
3449
  /* @__PURE__ */ jsx18("button", { type: "button", className: "fk-lightbox-close", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx18(CloseIcon, { size: 20 }) }),
3244
3450
  /* @__PURE__ */ jsx18("div", { className: "fk-lightbox-stage", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx18(Carousel, { items, index, onIndexChange: setIndex }) })
@@ -3283,7 +3489,7 @@ function VotePill({ voteCounts, dir, onVote, variant = "pill", size = "md" }) {
3283
3489
  }
3284
3490
 
3285
3491
  // src/views/components/shared/confirm-dialog.tsx
3286
- import { useState as useState6 } from "react";
3492
+ import { useState as useState7 } from "react";
3287
3493
 
3288
3494
  // src/views/components/shared/modal.tsx
3289
3495
  import { jsx as jsx20 } from "react/jsx-runtime";
@@ -3323,8 +3529,8 @@ function PillButton({ children, onClick, variant = "surface", active, disabled,
3323
3529
  // src/views/components/shared/confirm-dialog.tsx
3324
3530
  import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
3325
3531
  function ConfirmDialog({ title, message, confirmLabel = "Delete", onConfirm, onCancel }) {
3326
- const [confirming, setConfirming] = useState6(false);
3327
- const [error, setError] = useState6(null);
3532
+ const [confirming, setConfirming] = useState7(false);
3533
+ const [error, setError] = useState7(null);
3328
3534
  async function handleConfirm() {
3329
3535
  if (confirming) return;
3330
3536
  setConfirming(true);
@@ -3353,11 +3559,11 @@ function ConfirmDialog({ title, message, confirmLabel = "Delete", onConfirm, onC
3353
3559
  }
3354
3560
 
3355
3561
  // src/views/hooks/use-share.ts
3356
- import { useState as useState7 } from "react";
3562
+ import { useState as useState8 } from "react";
3357
3563
  function useShare(threadId) {
3358
3564
  const { platform } = useSession();
3359
3565
  const { copyShareLink, openShareModal } = useForum();
3360
- const [menuOpen, setMenuOpen] = useState7(false);
3566
+ const [menuOpen, setMenuOpen] = useState8(false);
3361
3567
  function handleShareClick() {
3362
3568
  if (platform === "native") {
3363
3569
  openShareModal(threadId);
@@ -3402,12 +3608,12 @@ function PostCard({
3402
3608
  const share = useShare(post.id);
3403
3609
  const { openReportModal, currentUserId, state, deletePost } = useForum();
3404
3610
  const canDelete = currentUserId !== null && (post.authorId === currentUserId || state.profile.role === "moderator" || state.profile.role === "admin");
3405
- const [carouselIndex, setCarouselIndex] = useState8(0);
3406
- const [lightboxOpen, setLightboxOpen] = useState8(false);
3407
- const [snippetExpanded, setSnippetExpanded] = useState8(false);
3408
- const [snippetOverflowing, setSnippetOverflowing] = useState8(false);
3409
- const [deleteConfirmOpen, setDeleteConfirmOpen] = useState8(false);
3410
- const snippetRef = useRef4(null);
3611
+ const [carouselIndex, setCarouselIndex] = useState9(0);
3612
+ const [lightboxOpen, setLightboxOpen] = useState9(false);
3613
+ const [snippetExpanded, setSnippetExpanded] = useState9(false);
3614
+ const [snippetOverflowing, setSnippetOverflowing] = useState9(false);
3615
+ const [deleteConfirmOpen, setDeleteConfirmOpen] = useState9(false);
3616
+ const snippetRef = useRef5(null);
3411
3617
  const images = post.imageUrls ?? (post.imageUrl ? [post.imageUrl] : []);
3412
3618
  const media = [
3413
3619
  ...images.map((url) => ({ type: "image", url })),
@@ -3595,10 +3801,10 @@ function FeedEmptyState({ sort }) {
3595
3801
  }
3596
3802
 
3597
3803
  // src/views/hooks/use-infinite-scroll.ts
3598
- import { useEffect as useEffect5, useRef as useRef5 } from "react";
3804
+ import { useEffect as useEffect5, useRef as useRef6 } from "react";
3599
3805
  function useInfiniteScroll(onLoadMore, enabled) {
3600
- const sentinelRef = useRef5(null);
3601
- const onLoadMoreRef = useRef5(onLoadMore);
3806
+ const sentinelRef = useRef6(null);
3807
+ const onLoadMoreRef = useRef6(onLoadMore);
3602
3808
  onLoadMoreRef.current = onLoadMore;
3603
3809
  useEffect5(() => {
3604
3810
  if (!enabled) return;
@@ -3688,10 +3894,10 @@ function Feed() {
3688
3894
  }
3689
3895
 
3690
3896
  // src/views/routes/Thread.tsx
3691
- import { useState as useState13 } from "react";
3897
+ import { useState as useState14 } from "react";
3692
3898
 
3693
3899
  // src/views/components/thread/thread-view.tsx
3694
- import { useState as useState11 } from "react";
3900
+ import { useState as useState12, lazy as lazy2, Suspense as Suspense2 } from "react";
3695
3901
 
3696
3902
  // src/views/components/thread/comment-sort.tsx
3697
3903
  import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
@@ -3736,10 +3942,10 @@ function CommentSort({ sort, open, onToggle, onClose, onSelect, commentSearch, o
3736
3942
  }
3737
3943
 
3738
3944
  // src/views/components/thread/comment.tsx
3739
- import { useState as useState10 } from "react";
3945
+ import { useState as useState11, lazy, Suspense } from "react";
3740
3946
 
3741
3947
  // src/views/components/thread/comment-composer.tsx
3742
- import { useEffect as useEffect6, useRef as useRef6, useState as useState9 } from "react";
3948
+ import { useEffect as useEffect6, useRef as useRef7, useState as useState10 } from "react";
3743
3949
  import { useEditor, EditorContent } from "@tiptap/react";
3744
3950
 
3745
3951
  // src/views/api/gifs.ts
@@ -3760,17 +3966,17 @@ function CommentComposer({
3760
3966
  autoFocus,
3761
3967
  syncedValue
3762
3968
  }) {
3763
- const imageInputRef = useRef6(null);
3764
- const videoInputRef = useRef6(null);
3765
- const attachmentIdsRef = useRef6([]);
3766
- const [formattingOpen, setFormattingOpen] = useState9(false);
3767
- const [gifPanelOpen, setGifPanelOpen] = useState9(false);
3768
- const [gifQuery, setGifQuery] = useState9("");
3769
- const [gifResults, setGifResults] = useState9([]);
3770
- const [gifLoading, setGifLoading] = useState9(false);
3771
- const [gifNotConfigured, setGifNotConfigured] = useState9(false);
3772
- const [submitting, setSubmitting] = useState9(false);
3773
- const [error, setError] = useState9(null);
3969
+ const imageInputRef = useRef7(null);
3970
+ const videoInputRef = useRef7(null);
3971
+ const attachmentIdsRef = useRef7([]);
3972
+ const [formattingOpen, setFormattingOpen] = useState10(false);
3973
+ const [gifPanelOpen, setGifPanelOpen] = useState10(false);
3974
+ const [gifQuery, setGifQuery] = useState10("");
3975
+ const [gifResults, setGifResults] = useState10([]);
3976
+ const [gifLoading, setGifLoading] = useState10(false);
3977
+ const [gifNotConfigured, setGifNotConfigured] = useState10(false);
3978
+ const [submitting, setSubmitting] = useState10(false);
3979
+ const [error, setError] = useState10(null);
3774
3980
  useEffect6(() => {
3775
3981
  if (!gifPanelOpen || gifNotConfigured) return;
3776
3982
  const q = gifQuery.trim();
@@ -4043,6 +4249,7 @@ function CommentComposer({
4043
4249
 
4044
4250
  // src/views/components/thread/comment.tsx
4045
4251
  import { Fragment as Fragment9, jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
4252
+ var RichTextEditor = lazy(() => import("./rich-text-editor-6ICCYZSK.js"));
4046
4253
  function Comment({
4047
4254
  comment,
4048
4255
  threadId,
@@ -4065,13 +4272,13 @@ function Comment({
4065
4272
  const avatar = authorAvatar2(comment.authorId, comment.author);
4066
4273
  const share = useShare(threadId);
4067
4274
  const { openReportModal, forumId, sessionToken } = useForum();
4068
- const [menuOpen, setMenuOpen] = useState10(false);
4069
- const [deleteConfirmOpen, setDeleteConfirmOpen] = useState10(false);
4070
- const [replyOpen, setReplyOpen] = useState10(false);
4071
- const [editOpen, setEditOpen] = useState10(false);
4072
- const [editText, setEditText] = useState10(comment.body);
4073
- const [editSubmitting, setEditSubmitting] = useState10(false);
4074
- const [editError, setEditError] = useState10(null);
4275
+ const [menuOpen, setMenuOpen] = useState11(false);
4276
+ const [deleteConfirmOpen, setDeleteConfirmOpen] = useState11(false);
4277
+ const [replyOpen, setReplyOpen] = useState11(false);
4278
+ const [editOpen, setEditOpen] = useState11(false);
4279
+ const [editText, setEditText] = useState11(comment.body);
4280
+ const [editSubmitting, setEditSubmitting] = useState11(false);
4281
+ const [editError, setEditError] = useState11(null);
4075
4282
  async function handleSaveEdit() {
4076
4283
  const body = editText.trim();
4077
4284
  if (!body || editSubmitting) return;
@@ -4132,15 +4339,8 @@ function Comment({
4132
4339
  }
4133
4340
  ),
4134
4341
  editOpen ? /* @__PURE__ */ jsxs22("div", { className: "fk-comment-edit", children: [
4135
- /* @__PURE__ */ jsx27(
4136
- "textarea",
4137
- {
4138
- className: "fk-comment-edit-input",
4139
- value: editText,
4140
- onChange: (e) => setEditText(e.target.value),
4141
- rows: 3
4142
- }
4143
- ),
4342
+ /* @__PURE__ */ jsx27(Suspense, { fallback: /* @__PURE__ */ jsx27("textarea", { className: "fk-comment-edit-input", value: editText, onChange: (e) => setEditText(e.target.value), rows: 3 }), children: /* @__PURE__ */ jsx27(RichTextEditor, { content: editText, onChange: setEditText, forumId, sessionToken, onInlineUpload: () => {
4343
+ } }) }),
4144
4344
  editError && /* @__PURE__ */ jsx27("p", { className: "fk-comment-error", children: editError }),
4145
4345
  /* @__PURE__ */ jsxs22("div", { className: "fk-comment-edit-actions", children: [
4146
4346
  /* @__PURE__ */ jsx27("button", { type: "button", className: "fk-comment-action", onClick: handleSaveEdit, disabled: editSubmitting, children: editSubmitting ? "Saving\u2026" : "Save" }),
@@ -4173,23 +4373,6 @@ function Comment({
4173
4373
  ),
4174
4374
  /* @__PURE__ */ jsx27("button", { type: "button", className: "fk-comment-action", onClick: () => setReplyOpen((o) => !o), children: "Reply" }),
4175
4375
  isMine && !editOpen && /* @__PURE__ */ jsx27("button", { type: "button", className: "fk-comment-action", onClick: () => setEditOpen(true), children: "Edit" }),
4176
- /* @__PURE__ */ jsx27("button", { type: "button", className: "fk-comment-action", onClick: () => onSave(comment.id), children: comment.isSaved ? "Saved" : "Save" }),
4177
- depth === 0 && onAcceptAnswer && /* @__PURE__ */ jsx27(
4178
- "button",
4179
- {
4180
- type: "button",
4181
- className: `fk-comment-action${comment.isAcceptedAnswer ? " fk-comment-action--accepted" : ""}`,
4182
- onClick: () => onAcceptAnswer(comment.id),
4183
- children: comment.isAcceptedAnswer ? "Unmark answer" : "Mark as answer"
4184
- }
4185
- ),
4186
- depth === 0 && /* @__PURE__ */ jsxs22("div", { style: { position: "relative", display: "inline-block" }, children: [
4187
- /* @__PURE__ */ jsx27("button", { type: "button", className: "fk-comment-action", onClick: share.handleShareClick, children: "Share" }),
4188
- /* @__PURE__ */ jsxs22(DropdownMenu, { open: share.menuOpen, onClose: share.closeMenu, style: { top: 26, left: 0, width: 200, padding: 6 }, children: [
4189
- /* @__PURE__ */ jsx27(DropdownMenuItem, { icon: /* @__PURE__ */ jsx27(LinkIcon2, { size: 16 }), label: "Copy link", onClick: share.handleCopyLink }),
4190
- /* @__PURE__ */ jsx27(DropdownMenuItem, { icon: /* @__PURE__ */ jsx27(ShareIcon, {}), label: "Share with a member", onClick: share.handleShareWithMember })
4191
- ] })
4192
- ] }),
4193
4376
  /* @__PURE__ */ jsxs22("div", { className: "fk-post-card-menu-anchor", style: { marginLeft: "auto" }, children: [
4194
4377
  /* @__PURE__ */ jsx27(
4195
4378
  "button",
@@ -4202,7 +4385,39 @@ function Comment({
4202
4385
  children: /* @__PURE__ */ jsx27(EllipsisIcon, {})
4203
4386
  }
4204
4387
  ),
4205
- /* @__PURE__ */ jsxs22(DropdownMenu, { open: menuOpen, onClose: () => setMenuOpen(false), style: { top: 30, right: 0, width: 170, padding: 6 }, children: [
4388
+ /* @__PURE__ */ jsxs22(DropdownMenu, { open: menuOpen, onClose: () => setMenuOpen(false), style: { top: 30, right: 0, width: 200, padding: 6 }, children: [
4389
+ /* @__PURE__ */ jsx27(
4390
+ DropdownMenuItem,
4391
+ {
4392
+ icon: /* @__PURE__ */ jsx27(SaveIcon, { size: 16, filled: comment.isSaved }),
4393
+ label: comment.isSaved ? "Saved" : "Save",
4394
+ onClick: () => {
4395
+ setMenuOpen(false);
4396
+ onSave(comment.id);
4397
+ }
4398
+ }
4399
+ ),
4400
+ depth === 0 && onAcceptAnswer && /* @__PURE__ */ jsx27(
4401
+ DropdownMenuItem,
4402
+ {
4403
+ icon: /* @__PURE__ */ jsx27(CheckIcon, { size: 16 }),
4404
+ label: comment.isAcceptedAnswer ? "Unmark answer" : "Mark as answer",
4405
+ onClick: () => {
4406
+ setMenuOpen(false);
4407
+ onAcceptAnswer(comment.id);
4408
+ }
4409
+ }
4410
+ ),
4411
+ depth === 0 && /* @__PURE__ */ jsxs22(Fragment9, { children: [
4412
+ /* @__PURE__ */ jsx27(DropdownMenuItem, { icon: /* @__PURE__ */ jsx27(LinkIcon2, { size: 16 }), label: "Copy link", onClick: () => {
4413
+ setMenuOpen(false);
4414
+ share.handleCopyLink();
4415
+ } }),
4416
+ /* @__PURE__ */ jsx27(DropdownMenuItem, { icon: /* @__PURE__ */ jsx27(ShareIcon, { size: 16 }), label: "Share with a member", onClick: () => {
4417
+ setMenuOpen(false);
4418
+ share.handleShareWithMember();
4419
+ } })
4420
+ ] }),
4206
4421
  /* @__PURE__ */ jsx27(
4207
4422
  DropdownMenuItem,
4208
4423
  {
@@ -4283,6 +4498,7 @@ function MinusMark() {
4283
4498
 
4284
4499
  // src/views/components/thread/thread-view.tsx
4285
4500
  import { Fragment as Fragment10, jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
4501
+ var RichTextEditor2 = lazy2(() => import("./rich-text-editor-6ICCYZSK.js"));
4286
4502
  function ThreadView({ forum, onBack }) {
4287
4503
  const {
4288
4504
  state,
@@ -4306,17 +4522,19 @@ function ThreadView({ forum, onBack }) {
4306
4522
  summarize,
4307
4523
  suggest
4308
4524
  } = forum;
4309
- const [sortMenuOpen, setSortMenuOpen] = useState11(false);
4310
- const [commentSearch, setCommentSearch] = useState11("");
4311
- const [aiPanel, setAiPanel] = useState11(null);
4312
- const [deletePostConfirmOpen, setDeletePostConfirmOpen] = useState11(false);
4313
- const [postEditOpen, setPostEditOpen] = useState11(false);
4314
- const [postEditTitle, setPostEditTitle] = useState11("");
4315
- const [postEditBody, setPostEditBody] = useState11("");
4316
- const [postEditSubmitting, setPostEditSubmitting] = useState11(false);
4317
- const [carouselIndex, setCarouselIndex] = useState11(0);
4318
- const [lightboxOpen, setLightboxOpen] = useState11(false);
4319
- const [postEditError, setPostEditError] = useState11(null);
4525
+ const [sortMenuOpen, setSortMenuOpen] = useState12(false);
4526
+ const [commentSearch, setCommentSearch] = useState12("");
4527
+ const [aiPanel, setAiPanel] = useState12(null);
4528
+ const [deletePostConfirmOpen, setDeletePostConfirmOpen] = useState12(false);
4529
+ const [threadMenuOpen, setThreadMenuOpen] = useState12(false);
4530
+ const [suggestCopied, setSuggestCopied] = useState12(false);
4531
+ const [postEditOpen, setPostEditOpen] = useState12(false);
4532
+ const [postEditTitle, setPostEditTitle] = useState12("");
4533
+ const [postEditBody, setPostEditBody] = useState12("");
4534
+ const [postEditSubmitting, setPostEditSubmitting] = useState12(false);
4535
+ const [carouselIndex, setCarouselIndex] = useState12(0);
4536
+ const [lightboxOpen, setLightboxOpen] = useState12(false);
4537
+ const [postEditError, setPostEditError] = useState12(null);
4320
4538
  const share = useShare(activePost?.id ?? "");
4321
4539
  if (!activePost) return null;
4322
4540
  const avatar = authorAvatar2(activePost.authorId, activePost.author);
@@ -4387,15 +4605,8 @@ function ThreadView({ forum, onBack }) {
4387
4605
  style: { marginBottom: 8, fontWeight: 600 }
4388
4606
  }
4389
4607
  ),
4390
- /* @__PURE__ */ jsx28(
4391
- "textarea",
4392
- {
4393
- className: "fk-comment-edit-input",
4394
- value: postEditBody,
4395
- onChange: (e) => setPostEditBody(e.target.value),
4396
- rows: 5
4397
- }
4398
- ),
4608
+ /* @__PURE__ */ jsx28(Suspense2, { fallback: /* @__PURE__ */ jsx28("textarea", { className: "fk-comment-edit-input", value: postEditBody, onChange: (e) => setPostEditBody(e.target.value), rows: 5 }), children: /* @__PURE__ */ jsx28(RichTextEditor2, { content: postEditBody, onChange: setPostEditBody, forumId, sessionToken, onInlineUpload: () => {
4609
+ } }) }),
4399
4610
  postEditError && /* @__PURE__ */ jsx28("p", { className: "fk-comment-error", children: postEditError }),
4400
4611
  /* @__PURE__ */ jsxs23("div", { className: "fk-comment-edit-actions", children: [
4401
4612
  /* @__PURE__ */ jsx28("button", { type: "button", className: "fk-comment-action", onClick: handleSavePostEdit, disabled: postEditSubmitting, children: postEditSubmitting ? "Saving\u2026" : "Save" }),
@@ -4448,18 +4659,33 @@ function ThreadView({ forum, onBack }) {
4448
4659
  /* @__PURE__ */ jsx28(CommentIcon, { size: 18 }),
4449
4660
  activePost.commentCount
4450
4661
  ] }),
4662
+ isMyPost && !postEditOpen && /* @__PURE__ */ jsx28("button", { type: "button", className: "fk-thread-chip", onClick: openPostEdit, children: "Edit" }),
4451
4663
  /* @__PURE__ */ jsxs23("div", { style: { position: "relative" }, children: [
4452
- /* @__PURE__ */ jsxs23("button", { type: "button", className: "fk-thread-chip", onClick: share.handleShareClick, children: [
4453
- /* @__PURE__ */ jsx28(ShareIcon, { size: 18 }),
4454
- "Share"
4455
- ] }),
4456
- /* @__PURE__ */ jsxs23(DropdownMenu, { open: share.menuOpen, onClose: share.closeMenu, style: { top: 40, left: 0, width: 210, padding: 6 }, children: [
4457
- /* @__PURE__ */ jsx28(DropdownMenuItem, { icon: /* @__PURE__ */ jsx28(LinkIcon2, { size: 16 }), label: "Copy link", onClick: share.handleCopyLink }),
4458
- /* @__PURE__ */ jsx28(DropdownMenuItem, { icon: /* @__PURE__ */ jsx28(ShareIcon, {}), label: "Share with a member", onClick: share.handleShareWithMember })
4664
+ /* @__PURE__ */ jsx28(
4665
+ "button",
4666
+ {
4667
+ type: "button",
4668
+ className: "fk-thread-chip",
4669
+ "aria-label": "More actions",
4670
+ onClick: () => setThreadMenuOpen((o) => !o),
4671
+ children: /* @__PURE__ */ jsx28(EllipsisIcon, { size: 18 })
4672
+ }
4673
+ ),
4674
+ /* @__PURE__ */ jsxs23(DropdownMenu, { open: threadMenuOpen, onClose: () => setThreadMenuOpen(false), style: { top: 40, right: 0, width: 210, padding: 6 }, children: [
4675
+ /* @__PURE__ */ jsx28(DropdownMenuItem, { icon: /* @__PURE__ */ jsx28(LinkIcon2, { size: 16 }), label: "Copy link", onClick: () => {
4676
+ share.handleCopyLink();
4677
+ setThreadMenuOpen(false);
4678
+ } }),
4679
+ /* @__PURE__ */ jsx28(DropdownMenuItem, { icon: /* @__PURE__ */ jsx28(ShareIcon, { size: 16 }), label: "Share with a member", onClick: () => {
4680
+ share.handleShareWithMember();
4681
+ setThreadMenuOpen(false);
4682
+ } }),
4683
+ canDeletePost && /* @__PURE__ */ jsx28(DropdownMenuItem, { icon: /* @__PURE__ */ jsx28(TrashIcon, { size: 16 }), label: "Delete", onClick: () => {
4684
+ setThreadMenuOpen(false);
4685
+ setDeletePostConfirmOpen(true);
4686
+ } })
4459
4687
  ] })
4460
- ] }),
4461
- isMyPost && !postEditOpen && /* @__PURE__ */ jsx28("button", { type: "button", className: "fk-thread-chip", onClick: openPostEdit, children: "Edit" }),
4462
- canDeletePost && /* @__PURE__ */ jsx28("button", { type: "button", className: "fk-thread-chip", onClick: () => setDeletePostConfirmOpen(true), children: "Delete" })
4688
+ ] })
4463
4689
  ] }),
4464
4690
  deletePostConfirmOpen && /* @__PURE__ */ jsx28(
4465
4691
  ConfirmDialog,
@@ -4502,7 +4728,23 @@ function ThreadView({ forum, onBack }) {
4502
4728
  /* @__PURE__ */ jsx28("span", { children: aiPanel === "summary" ? "Thread summary" : "Suggested reply" }),
4503
4729
  /* @__PURE__ */ jsx28("button", { type: "button", onClick: () => setAiPanel(null), children: /* @__PURE__ */ jsx28(CloseIcon, { size: 16 }) })
4504
4730
  ] }),
4505
- /* @__PURE__ */ jsx28("div", { className: "fk-ai-panel-body", children: aiPanel === "summary" ? state.asst.summarizing ? "Summarising\u2026" : state.asst.summary ? state.asst.summary.points.map((p, i) => /* @__PURE__ */ jsx28("p", { children: p }, i)) : "No summary yet." : state.thread.commentInput || "Generating suggestion\u2026" })
4731
+ /* @__PURE__ */ jsx28("div", { className: "fk-ai-panel-body", children: aiPanel === "summary" ? state.asst.summarizing ? "Summarising\u2026" : state.asst.summary ? state.asst.summary.points.map((p, i) => /* @__PURE__ */ jsx28("p", { children: p }, i)) : "No summary yet." : state.asst.suggestedText ? /* @__PURE__ */ jsxs23("div", { className: "fk-ai-suggest-block", children: [
4732
+ /* @__PURE__ */ jsx28("p", { className: "fk-ai-suggest-text", children: state.asst.suggestedText }),
4733
+ /* @__PURE__ */ jsx28(
4734
+ "button",
4735
+ {
4736
+ type: "button",
4737
+ className: `fk-ai-copy-btn${suggestCopied ? " fk-ai-copy-btn--copied" : ""}`,
4738
+ title: suggestCopied ? "Copied!" : "Copy",
4739
+ onClick: () => {
4740
+ void navigator.clipboard.writeText(state.asst.suggestedText);
4741
+ setSuggestCopied(true);
4742
+ setTimeout(() => setSuggestCopied(false), 1500);
4743
+ },
4744
+ children: suggestCopied ? /* @__PURE__ */ jsx28(CheckIcon, { size: 14 }) : /* @__PURE__ */ jsx28(CopyIcon, { size: 14 })
4745
+ }
4746
+ )
4747
+ ] }) : "Generating suggestion\u2026" })
4506
4748
  ] }),
4507
4749
  /* @__PURE__ */ jsx28(
4508
4750
  CommentComposer,
@@ -4552,7 +4794,7 @@ function ThreadView({ forum, onBack }) {
4552
4794
  }
4553
4795
 
4554
4796
  // src/views/hooks/use-speech.ts
4555
- import { useState as useState12, useCallback as useCallback2, useEffect as useEffect7, useRef as useRef7 } from "react";
4797
+ import { useState as useState13, useCallback as useCallback2, useEffect as useEffect7, useRef as useRef8 } from "react";
4556
4798
  var PREFERRED_VOICE_RE = /samantha|karen|victoria|kate|fiona/i;
4557
4799
  function pickVoice() {
4558
4800
  const voices = window.speechSynthesis.getVoices();
@@ -4560,9 +4802,9 @@ function pickVoice() {
4560
4802
  }
4561
4803
  function useSpeech() {
4562
4804
  const supported = typeof window !== "undefined" && "speechSynthesis" in window;
4563
- const [speaking, setSpeaking] = useState12(false);
4564
- const [, setVoicesReady] = useState12(false);
4565
- const utteranceRef = useRef7(null);
4805
+ const [speaking, setSpeaking] = useState13(false);
4806
+ const [, setVoicesReady] = useState13(false);
4807
+ const utteranceRef = useRef8(null);
4566
4808
  useEffect7(() => {
4567
4809
  if (!supported) return;
4568
4810
  const onVoicesChanged = () => setVoicesReady(true);
@@ -4643,7 +4885,7 @@ import { Fragment as Fragment12, jsx as jsx30, jsxs as jsxs25 } from "react/jsx-
4643
4885
  function Thread() {
4644
4886
  const forum = useForum();
4645
4887
  const { state, openThread, summarize, suggest, surfaceRelated, goBack } = forum;
4646
- const [assistantOpen, setAssistantOpen] = useState13(false);
4888
+ const [assistantOpen, setAssistantOpen] = useState14(false);
4647
4889
  return /* @__PURE__ */ jsx30(
4648
4890
  Shell,
4649
4891
  {
@@ -4674,13 +4916,13 @@ function Thread() {
4674
4916
  }
4675
4917
 
4676
4918
  // src/views/routes/Profile.tsx
4677
- import { useState as useState16 } from "react";
4919
+ import { useState as useState17 } from "react";
4678
4920
 
4679
4921
  // src/views/components/profile/profile-header.tsx
4680
- import { useRef as useRef9, useState as useState15 } from "react";
4922
+ import { useRef as useRef10, useState as useState16 } from "react";
4681
4923
 
4682
4924
  // src/views/components/profile/image-editor-modal.tsx
4683
- import { useState as useState14, useCallback as useCallback3, useRef as useRef8 } from "react";
4925
+ import { useState as useState15, useCallback as useCallback3, useRef as useRef9 } from "react";
4684
4926
  import Cropper from "react-easy-crop";
4685
4927
 
4686
4928
  // src/views/utils/crop-image.ts
@@ -4776,21 +5018,21 @@ var FILTER_PRESETS = [
4776
5018
  { key: "warm", label: "Warm", css: "sepia(0.35) saturate(1.3) hue-rotate(-8deg)" }
4777
5019
  ];
4778
5020
  function ImageEditorModal({ file, aspect, targetWidth, targetHeight, onCancel, onConfirm }) {
4779
- const [imageSrc, setImageSrc] = useState14(() => URL.createObjectURL(file));
4780
- const pickAnotherInputRef = useRef8(null);
4781
- const imageSrcRef = useRef8(imageSrc);
5021
+ const [imageSrc, setImageSrc] = useState15(() => URL.createObjectURL(file));
5022
+ const pickAnotherInputRef = useRef9(null);
5023
+ const imageSrcRef = useRef9(imageSrc);
4782
5024
  imageSrcRef.current = imageSrc;
4783
- const [crop, setCrop] = useState14({ x: 0, y: 0 });
4784
- const [zoom, setZoom] = useState14(1);
4785
- const [rotation, setRotation] = useState14(0);
4786
- const [croppedAreaPixels, setCroppedAreaPixels] = useState14(null);
4787
- const [filterKey, setFilterKey] = useState14("none");
4788
- const [brightness, setBrightness] = useState14(100);
4789
- const [contrast, setContrast] = useState14(100);
4790
- const [saturation, setSaturation] = useState14(100);
4791
- const [vignette, setVignette] = useState14(0);
4792
- const [exporting, setExporting] = useState14(false);
4793
- const [error, setError] = useState14(null);
5025
+ const [crop, setCrop] = useState15({ x: 0, y: 0 });
5026
+ const [zoom, setZoom] = useState15(1);
5027
+ const [rotation, setRotation] = useState15(0);
5028
+ const [croppedAreaPixels, setCroppedAreaPixels] = useState15(null);
5029
+ const [filterKey, setFilterKey] = useState15("none");
5030
+ const [brightness, setBrightness] = useState15(100);
5031
+ const [contrast, setContrast] = useState15(100);
5032
+ const [saturation, setSaturation] = useState15(100);
5033
+ const [vignette, setVignette] = useState15(0);
5034
+ const [exporting, setExporting] = useState15(false);
5035
+ const [error, setError] = useState15(null);
4794
5036
  const filterPreset = FILTER_PRESETS.find((f) => f.key === filterKey) ?? FILTER_PRESETS[0];
4795
5037
  const filterString = [filterPreset.css, `brightness(${brightness}%)`, `contrast(${contrast}%)`, `saturate(${saturation}%)`].filter(Boolean).join(" ");
4796
5038
  const onCropComplete = useCallback3((_area, areaPixels) => {
@@ -4984,10 +5226,10 @@ import { Fragment as Fragment13, jsx as jsx32, jsxs as jsxs27 } from "react/jsx-
4984
5226
  function ProfileHeader({ username, handle, avatarUrl, bannerUrl, isOwnProfile = false }) {
4985
5227
  const { state, saveProfile } = useForum();
4986
5228
  const avatar = authorAvatar2(handle, username);
4987
- const [lightboxImage, setLightboxImage] = useState15(null);
4988
- const [editingImage, setEditingImage] = useState15(null);
4989
- const avatarInputRef = useRef9(null);
4990
- const bannerInputRef = useRef9(null);
5229
+ const [lightboxImage, setLightboxImage] = useState16(null);
5230
+ const [editingImage, setEditingImage] = useState16(null);
5231
+ const avatarInputRef = useRef10(null);
5232
+ const bannerInputRef = useRef10(null);
4991
5233
  function handleAvatarFile(e) {
4992
5234
  const file = e.target.files?.[0];
4993
5235
  e.target.value = "";
@@ -5299,8 +5541,8 @@ function Profile() {
5299
5541
  setPostMenu,
5300
5542
  goBack
5301
5543
  } = useForum();
5302
- const [contentMenuOpen, setContentMenuOpen] = useState16(false);
5303
- const [sortMenuOpen, setSortMenuOpen] = useState16(false);
5544
+ const [contentMenuOpen, setContentMenuOpen] = useState17(false);
5545
+ const [sortMenuOpen, setSortMenuOpen] = useState17(false);
5304
5546
  const isOwnProfile = state.viewedProfile === null;
5305
5547
  const profile = state.viewedProfile ?? state.profile;
5306
5548
  const setActiveTab = isOwnProfile ? setProfileTab : setViewedProfileTab;
@@ -5427,19 +5669,19 @@ function Profile() {
5427
5669
  }
5428
5670
 
5429
5671
  // src/views/components/composer/composer-modal.tsx
5430
- import { Suspense, lazy } from "react";
5672
+ import { Suspense as Suspense3, lazy as lazy3, useState as useState19 } from "react";
5431
5673
 
5432
5674
  // src/views/components/composer/media-gallery.tsx
5433
- import { useState as useState17, useRef as useRef10 } from "react";
5675
+ import { useState as useState18, useRef as useRef11 } from "react";
5434
5676
  import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
5435
5677
  function MediaGallery({ attachments, onAddFiles, onRemoveFile, onUpdateMeta }) {
5436
- const fileInputRef = useRef10(null);
5437
- const addMoreRef = useRef10(null);
5438
- const [carouselIdx, setCarouselIdx] = useState17(0);
5439
- const [view, setView] = useState17("carousel");
5440
- const [editIdx, setEditIdx] = useState17(0);
5441
- const [editCaption, setEditCaption] = useState17("");
5442
- const [editUrl, setEditUrl] = useState17("");
5678
+ const fileInputRef = useRef11(null);
5679
+ const addMoreRef = useRef11(null);
5680
+ const [carouselIdx, setCarouselIdx] = useState18(0);
5681
+ const [view, setView] = useState18("carousel");
5682
+ const [editIdx, setEditIdx] = useState18(0);
5683
+ const [editCaption, setEditCaption] = useState18("");
5684
+ const [editUrl, setEditUrl] = useState18("");
5443
5685
  const safeCarouselIdx = Math.min(carouselIdx, Math.max(0, attachments.length - 1));
5444
5686
  const current = attachments[safeCarouselIdx];
5445
5687
  function openEdit(idx) {
@@ -5679,8 +5921,16 @@ function MediaGallery({ attachments, onAddFiles, onRemoveFile, onUpdateMeta }) {
5679
5921
  }
5680
5922
 
5681
5923
  // src/views/components/composer/composer-modal.tsx
5682
- import { jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
5683
- var RichTextEditor = lazy(() => import("./rich-text-editor-T54NZOYU.js"));
5924
+ import { Fragment as Fragment15, jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
5925
+ function isValidUrl(s) {
5926
+ try {
5927
+ const u = new URL(s);
5928
+ return u.protocol === "http:" || u.protocol === "https:";
5929
+ } catch {
5930
+ return false;
5931
+ }
5932
+ }
5933
+ var RichTextEditor3 = lazy3(() => import("./rich-text-editor-6ICCYZSK.js"));
5684
5934
  var TABS = [
5685
5935
  { id: "text", label: "Text" },
5686
5936
  { id: "images", label: "Images & Video" },
@@ -5702,10 +5952,21 @@ function ComposerModal({
5702
5952
  onSaveDraft,
5703
5953
  onOpenDraftsList
5704
5954
  }) {
5955
+ const [suggestBodyHint, setSuggestBodyHint] = useState19(false);
5956
+ function handleSuggestMeta() {
5957
+ if (!composer.body.trim()) {
5958
+ setSuggestBodyHint(true);
5959
+ return;
5960
+ }
5961
+ setSuggestBodyHint(false);
5962
+ onSuggestMeta();
5963
+ }
5705
5964
  const hasTitle = composer.title.trim().length > 0;
5706
5965
  const hasUploadsInFlight = composer.attachments.some((a) => a.uploadStatus === "uploading");
5966
+ const linkTrimmed = composer.linkUrl.trim();
5967
+ const linkUrlValid = linkTrimmed.length === 0 || isValidUrl(linkTrimmed);
5707
5968
  const canSaveDraft = hasTitle && composer.body.trim().length > 0 && !composer.savingDraft;
5708
- const canPost = hasTitle && !composer.submitting && !hasUploadsInFlight && (composer.activeTab !== "images" || composer.attachments.length > 0) && (composer.activeTab !== "link" || composer.linkUrl.trim().length > 0);
5969
+ const canPost = hasTitle && !composer.submitting && !hasUploadsInFlight && (composer.activeTab !== "images" || composer.attachments.length > 0) && (composer.activeTab !== "link" || isValidUrl(linkTrimmed));
5709
5970
  return /* @__PURE__ */ jsxs33("div", { className: "fk-composer-modal", children: [
5710
5971
  /* @__PURE__ */ jsxs33("div", { className: "fk-composer-header", children: [
5711
5972
  /* @__PURE__ */ jsx39("h2", { className: "fk-composer-heading", children: "Create post" }),
@@ -5742,10 +6003,11 @@ function ComposerModal({
5742
6003
  ] })
5743
6004
  ] }),
5744
6005
  /* @__PURE__ */ jsxs33("div", { className: "fk-composer-title-row", children: [
5745
- /* @__PURE__ */ jsxs33("button", { type: "button", className: "fk-composer-suggest", onClick: onSuggestMeta, disabled: composer.genTitle || composer.genTags, children: [
6006
+ /* @__PURE__ */ jsxs33("button", { type: "button", className: "fk-composer-suggest", onClick: handleSuggestMeta, disabled: composer.genTitle || composer.genTags, children: [
5746
6007
  /* @__PURE__ */ jsx39(SparkleIcon, { size: 14 }),
5747
6008
  composer.genTitle || composer.genTags ? "Suggesting\u2026" : "Suggest title & tags"
5748
6009
  ] }),
6010
+ suggestBodyHint && /* @__PURE__ */ jsx39("span", { className: "fk-composer-suggest-hint", children: "Add some body text first, we need content to suggest from." }),
5749
6011
  /* @__PURE__ */ jsxs33("span", { className: "fk-composer-counter", children: [
5750
6012
  composer.title.length,
5751
6013
  "/300"
@@ -5763,8 +6025,8 @@ function ComposerModal({
5763
6025
  }
5764
6026
  )
5765
6027
  ] }),
5766
- composer.activeTab === "text" && /* @__PURE__ */ jsx39("div", { className: "fk-composer-textbox", children: /* @__PURE__ */ jsx39(Suspense, { fallback: /* @__PURE__ */ jsx39("div", { className: "fk-rte-loading", children: "Loading editor\u2026" }), children: /* @__PURE__ */ jsx39(
5767
- RichTextEditor,
6028
+ composer.activeTab === "text" && /* @__PURE__ */ jsx39("div", { className: "fk-composer-textbox", children: /* @__PURE__ */ jsx39(Suspense3, { fallback: /* @__PURE__ */ jsx39("div", { className: "fk-rte-loading", children: "Loading editor\u2026" }), children: /* @__PURE__ */ jsx39(
6029
+ RichTextEditor3,
5768
6030
  {
5769
6031
  content: composer.body,
5770
6032
  onChange: (body) => onSetField("body", body),
@@ -5782,21 +6044,25 @@ function ComposerModal({
5782
6044
  onUpdateMeta
5783
6045
  }
5784
6046
  ),
5785
- composer.activeTab === "link" && /* @__PURE__ */ jsxs33("div", { className: "fk-composer-title-wrap", children: [
5786
- /* @__PURE__ */ jsx39(
5787
- "input",
5788
- {
5789
- id: "composer-link",
5790
- className: "fk-composer-title-input fk-composer-title-input--light",
5791
- placeholder: " ",
5792
- value: composer.linkUrl,
5793
- onChange: (e) => onSetField("linkUrl", e.target.value)
5794
- }
5795
- ),
5796
- /* @__PURE__ */ jsxs33("label", { className: "fk-composer-title-label", htmlFor: "composer-link", children: [
5797
- "Link URL ",
5798
- /* @__PURE__ */ jsx39("span", { className: "fk-composer-required-mark", children: "*" })
5799
- ] })
6047
+ composer.activeTab === "link" && /* @__PURE__ */ jsxs33(Fragment15, { children: [
6048
+ /* @__PURE__ */ jsxs33("div", { className: "fk-composer-title-wrap", children: [
6049
+ /* @__PURE__ */ jsx39(
6050
+ "input",
6051
+ {
6052
+ id: "composer-link",
6053
+ className: "fk-composer-title-input fk-composer-title-input--light",
6054
+ placeholder: " ",
6055
+ type: "url",
6056
+ value: composer.linkUrl,
6057
+ onChange: (e) => onSetField("linkUrl", e.target.value)
6058
+ }
6059
+ ),
6060
+ /* @__PURE__ */ jsxs33("label", { className: "fk-composer-title-label", htmlFor: "composer-link", children: [
6061
+ "Link URL ",
6062
+ /* @__PURE__ */ jsx39("span", { className: "fk-composer-required-mark", children: "*" })
6063
+ ] })
6064
+ ] }),
6065
+ linkTrimmed.length > 0 && !linkUrlValid && /* @__PURE__ */ jsx39("p", { className: "fk-composer-link-hint", children: "Enter a valid URL starting with http:// or https://" })
5800
6066
  ] }),
5801
6067
  composer.error && /* @__PURE__ */ jsx39("p", { className: "fk-composer-error", children: composer.error }),
5802
6068
  /* @__PURE__ */ jsxs33("div", { className: "fk-composer-footer", children: [
@@ -5851,8 +6117,8 @@ function Compose() {
5851
6117
  }
5852
6118
 
5853
6119
  // src/views/routes/SearchResults.tsx
5854
- import { useEffect as useEffect8, useState as useState18 } from "react";
5855
- import { Fragment as Fragment15, jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
6120
+ import { useEffect as useEffect8, useState as useState20 } from "react";
6121
+ import { Fragment as Fragment16, jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
5856
6122
  var SECTION_PAGE_SIZE = 20;
5857
6123
  var PREVIEW_SIZE = 5;
5858
6124
  var SECTION_TABS = [
@@ -5959,7 +6225,7 @@ function CommentRow({ result, onOpen }) {
5959
6225
  }
5960
6226
  function MediaTile({ result, onOpen, onImageLoad }) {
5961
6227
  const avatar = authorAvatar2(result.authorId, result.authorDisplayName);
5962
- const [loaded, setLoaded] = useState18(false);
6228
+ const [loaded, setLoaded] = useState20(false);
5963
6229
  return /* @__PURE__ */ jsxs35("div", { className: "fk-search-results-media-tile", onClick: onOpen, children: [
5964
6230
  /* @__PURE__ */ jsxs35("div", { className: "fk-search-results-media-tile-image", children: [
5965
6231
  result.imageUrl && /* @__PURE__ */ jsx41(
@@ -5988,8 +6254,8 @@ function MediaTile({ result, onOpen, onImageLoad }) {
5988
6254
  ] });
5989
6255
  }
5990
6256
  function MediaGrid({ items, onOpen }) {
5991
- const [loadedIds, setLoadedIds] = useState18(/* @__PURE__ */ new Set());
5992
- const [everLoaded, setEverLoaded] = useState18(false);
6257
+ const [loadedIds, setLoadedIds] = useState20(/* @__PURE__ */ new Set());
6258
+ const [everLoaded, setEverLoaded] = useState20(false);
5993
6259
  const allLoaded = items.length > 0 && items.every((r) => loadedIds.has(r.threadId));
5994
6260
  useEffect8(() => {
5995
6261
  if (allLoaded) setEverLoaded(true);
@@ -6029,24 +6295,32 @@ function SearchResults() {
6029
6295
  openThread,
6030
6296
  openUserProfile,
6031
6297
  goBack,
6298
+ openSearchResults,
6299
+ openAsk,
6032
6300
  forumId: fid,
6033
6301
  sessionToken: token
6034
6302
  } = useForum();
6035
6303
  const query = state.search.resultsQuery;
6036
6304
  const section = state.search.resultsSection;
6037
- const [threads, setThreads] = useState18({ items: [], total: 0, loading: false });
6038
- const [comments, setComments] = useState18({ items: [], total: 0, loading: false });
6039
- const [people, setPeople] = useState18({ items: [], total: 0, loading: false });
6305
+ const [searchHistory, setSearchHistory] = useState20(() => loadSearchHistory());
6306
+ const [querySuggestion, setQuerySuggestion] = useState20({ query: null, isRelated: false });
6307
+ const [threads, setThreads] = useState20({ items: [], total: 0, loading: false });
6308
+ const [comments, setComments] = useState20({ items: [], total: 0, loading: false });
6309
+ const [people, setPeople] = useState20({ items: [], total: 0, loading: false });
6040
6310
  useEffect8(() => {
6041
6311
  if (!fid || !query) return;
6042
6312
  setThreads((s) => ({ ...s, loading: true }));
6043
- searchThreads2(fid, query, { limit: PREVIEW_SIZE }, token).then((r) => setThreads({ items: r.results, total: r.total, loading: false })).catch(() => setThreads({ items: [], total: 0, loading: false }));
6313
+ setQuerySuggestion({ query: null, isRelated: false });
6314
+ searchThreads2(fid, query, { limit: PREVIEW_SIZE }, token).then((r) => {
6315
+ setThreads({ items: r.results, total: r.total, loading: false });
6316
+ setQuerySuggestion({ query: r.suggestedQuery, isRelated: r.isRelated });
6317
+ }).catch(() => setThreads({ items: [], total: 0, loading: false }));
6044
6318
  setComments((s) => ({ ...s, loading: true }));
6045
6319
  searchComments(fid, query, { limit: PREVIEW_SIZE }, token).then((r) => setComments({ items: r.results, total: r.total, loading: false })).catch(() => setComments({ items: [], total: 0, loading: false }));
6046
6320
  setPeople((s) => ({ ...s, loading: true }));
6047
6321
  searchUsers2(fid, query, { limit: PREVIEW_SIZE }, token).then((r) => setPeople({ items: r.results, total: r.total, loading: false })).catch(() => setPeople({ items: [], total: 0, loading: false }));
6048
6322
  }, [fid, token, query]);
6049
- const [drillPage, setDrillPage] = useState18(1);
6323
+ const [drillPage, setDrillPage] = useState20(1);
6050
6324
  useEffect8(() => setDrillPage(1), [section, query]);
6051
6325
  useEffect8(() => {
6052
6326
  if (!fid || !query || section === "all") return;
@@ -6066,8 +6340,26 @@ function SearchResults() {
6066
6340
  const hasMore = section !== "all" && drillItems.items.length < drillItems.total;
6067
6341
  const sentinelRef = useInfiniteScroll(() => setDrillPage((p) => p + 1), hasMore && !drillItems.loading);
6068
6342
  const mediaItems = threads.items.filter((r) => r.imageUrl);
6069
- return /* @__PURE__ */ jsx41(Shell, { children: /* @__PURE__ */ jsxs35("div", { className: "fk-profile fk-search-results-wide", children: [
6343
+ return /* @__PURE__ */ jsx41(Shell, { onAsk: query ? () => openAsk(query) : void 0, children: /* @__PURE__ */ jsxs35("div", { className: "fk-profile fk-search-results-wide", children: [
6070
6344
  state.history.length > 0 && /* @__PURE__ */ jsx41(PillButton, { variant: "surface", icon: /* @__PURE__ */ jsx41(ChevronLeftIcon, {}), onClick: goBack, style: { marginBottom: 14 }, children: "Back" }),
6345
+ !query && searchHistory.length > 0 && /* @__PURE__ */ jsxs35("div", { children: [
6346
+ /* @__PURE__ */ jsx41("div", { className: "fk-profile-filter-row", children: /* @__PURE__ */ jsx41("div", { className: "fk-profile-filter-label", children: "Recent" }) }),
6347
+ searchHistory.map((q) => /* @__PURE__ */ jsxs35("div", { className: "fk-search-dropdown-history-row", children: [
6348
+ /* @__PURE__ */ jsxs35("button", { type: "button", className: "fk-search-dropdown-history-main", onClick: () => openSearchResults(q), children: [
6349
+ /* @__PURE__ */ jsx41(ClockIcon, { size: 14 }),
6350
+ q
6351
+ ] }),
6352
+ /* @__PURE__ */ jsx41(
6353
+ "button",
6354
+ {
6355
+ type: "button",
6356
+ className: "fk-search-dropdown-history-clear",
6357
+ onClick: () => setSearchHistory(removeFromSearchHistory(q)),
6358
+ children: "\xD7"
6359
+ }
6360
+ )
6361
+ ] }, q))
6362
+ ] }),
6071
6363
  /* @__PURE__ */ jsx41("div", { className: "fk-profile-tabs fk-search-results-tabs", children: SECTION_TABS.map((tab) => /* @__PURE__ */ jsx41(
6072
6364
  "button",
6073
6365
  {
@@ -6078,7 +6370,24 @@ function SearchResults() {
6078
6370
  },
6079
6371
  tab.key
6080
6372
  )) }),
6081
- section === "all" ? /* @__PURE__ */ jsxs35(Fragment15, { children: [
6373
+ query && querySuggestion.isRelated && querySuggestion.query && /* @__PURE__ */ jsxs35("div", { className: "fk-search-did-you-mean", children: [
6374
+ "No results for ",
6375
+ /* @__PURE__ */ jsxs35("strong", { children: [
6376
+ '"',
6377
+ query,
6378
+ '"'
6379
+ ] }),
6380
+ ". Showing related results for",
6381
+ " ",
6382
+ /* @__PURE__ */ jsx41("button", { type: "button", onClick: () => openSearchResults(querySuggestion.query), children: querySuggestion.query })
6383
+ ] }),
6384
+ query && !querySuggestion.isRelated && querySuggestion.query && querySuggestion.query.toLowerCase() !== query.toLowerCase() && /* @__PURE__ */ jsxs35("div", { className: "fk-search-did-you-mean", children: [
6385
+ "Did you mean:",
6386
+ " ",
6387
+ /* @__PURE__ */ jsx41("button", { type: "button", onClick: () => openSearchResults(querySuggestion.query), children: querySuggestion.query }),
6388
+ "?"
6389
+ ] }),
6390
+ section === "all" ? /* @__PURE__ */ jsxs35(Fragment16, { children: [
6082
6391
  /* @__PURE__ */ jsx41("div", { className: "fk-profile-filter-row", children: /* @__PURE__ */ jsx41("div", { className: "fk-profile-filter-label", children: "Threads" }) }),
6083
6392
  threads.loading && threads.items.length === 0 ? /* @__PURE__ */ jsx41("div", { className: "fk-search-dropdown-status", children: /* @__PURE__ */ jsx41(MascotIcon, { size: 32 }) }) : threads.items.length === 0 ? /* @__PURE__ */ jsx41("div", { className: "fk-search-dropdown-status", children: "No matching threads" }) : threads.items.map((r) => /* @__PURE__ */ jsx41(ThreadRow, { result: r, onOpen: () => openThread(r.threadId) }, r.threadId)),
6084
6393
  /* @__PURE__ */ jsx41("div", { className: "fk-profile-divider" }),
@@ -6090,7 +6399,7 @@ function SearchResults() {
6090
6399
  /* @__PURE__ */ jsx41("div", { className: "fk-profile-divider" }),
6091
6400
  /* @__PURE__ */ jsx41("div", { className: "fk-profile-filter-row", children: /* @__PURE__ */ jsx41("div", { className: "fk-profile-filter-label", children: "Media" }) }),
6092
6401
  threads.loading && threads.items.length === 0 ? /* @__PURE__ */ jsx41("div", { className: "fk-search-dropdown-status", children: /* @__PURE__ */ jsx41(MascotIcon, { size: 32 }) }) : mediaItems.length === 0 ? /* @__PURE__ */ jsx41("div", { className: "fk-search-dropdown-status", children: "No matching media" }) : /* @__PURE__ */ jsx41(MediaGrid, { items: mediaItems, onOpen: openThread }, query)
6093
- ] }) : /* @__PURE__ */ jsxs35(Fragment15, { children: [
6402
+ ] }) : /* @__PURE__ */ jsxs35(Fragment16, { children: [
6094
6403
  section === "threads" && threads.items.map((r) => /* @__PURE__ */ jsx41(ThreadRow, { result: r, onOpen: () => openThread(r.threadId) }, r.threadId)),
6095
6404
  section === "comments" && comments.items.map((r) => /* @__PURE__ */ jsx41(CommentRow, { result: r, onOpen: () => openThread(r.threadId) }, r.commentId)),
6096
6405
  section === "people" && people.items.map((r) => /* @__PURE__ */ jsx41(PersonRow, { result: r, onOpen: () => openUserProfile(r.id) }, r.id)),
@@ -6103,7 +6412,7 @@ function SearchResults() {
6103
6412
  }
6104
6413
 
6105
6414
  // src/views/routes/Notifications.tsx
6106
- import { useEffect as useEffect9, useState as useState19 } from "react";
6415
+ import { useEffect as useEffect9, useState as useState21 } from "react";
6107
6416
  import { jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
6108
6417
  var PAGE_SIZE = 20;
6109
6418
  function dim(hex) {
@@ -6190,10 +6499,10 @@ function Notifications() {
6190
6499
  sessionToken: token,
6191
6500
  refreshUnreadCount
6192
6501
  } = useForum();
6193
- const [items, setItems] = useState19([]);
6194
- const [total, setTotal] = useState19(0);
6195
- const [page, setPage] = useState19(1);
6196
- const [loading, setLoading] = useState19(false);
6502
+ const [items, setItems] = useState21([]);
6503
+ const [total, setTotal] = useState21(0);
6504
+ const [page, setPage] = useState21(1);
6505
+ const [loading, setLoading] = useState21(false);
6197
6506
  useEffect9(() => {
6198
6507
  if (!fid) return;
6199
6508
  let cancelled = false;
@@ -6278,7 +6587,7 @@ function Notifications() {
6278
6587
  }
6279
6588
 
6280
6589
  // src/views/routes/Moderation.tsx
6281
- import { useEffect as useEffect10, useState as useState20 } from "react";
6590
+ import { useEffect as useEffect10, useState as useState22 } from "react";
6282
6591
 
6283
6592
  // src/views/api/moderation.ts
6284
6593
  var API_BASE12 = typeof window !== "undefined" ? window.FK_API_URL ?? "" : "";
@@ -6366,11 +6675,11 @@ function Moderation() {
6366
6675
  forumId: fid,
6367
6676
  sessionToken: token
6368
6677
  } = useForum();
6369
- const [items, setItems] = useState20([]);
6370
- const [total, setTotal] = useState20(0);
6371
- const [page, setPage] = useState20(1);
6372
- const [loading, setLoading] = useState20(false);
6373
- const [resolvingId, setResolvingId] = useState20(null);
6678
+ const [items, setItems] = useState22([]);
6679
+ const [total, setTotal] = useState22(0);
6680
+ const [page, setPage] = useState22(1);
6681
+ const [loading, setLoading] = useState22(false);
6682
+ const [resolvingId, setResolvingId] = useState22(null);
6374
6683
  useEffect10(() => {
6375
6684
  if (!fid) return;
6376
6685
  let cancelled = false;
@@ -6436,9 +6745,215 @@ function Moderation() {
6436
6745
  ] }) });
6437
6746
  }
6438
6747
 
6748
+ // src/views/routes/AskResult.tsx
6749
+ import { useCallback as useCallback4, useEffect as useEffect11, useRef as useRef12, useState as useState23 } from "react";
6750
+ import { jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
6751
+ function SourcesModal({ sources, onClose, onOpenThread }) {
6752
+ return /* @__PURE__ */ jsxs38(Modal, { onClose, maxWidth: 560, children: [
6753
+ /* @__PURE__ */ jsx44("div", { className: "fk-ask-sources-modal-title", children: "Sources" }),
6754
+ /* @__PURE__ */ jsx44("div", { className: "fk-ask-sources-inner", children: sources.map((s, i) => {
6755
+ const avatar = authorAvatar2(s.authorId, s.authorDisplayName);
6756
+ return /* @__PURE__ */ jsxs38(
6757
+ "button",
6758
+ {
6759
+ type: "button",
6760
+ className: "fk-ask-source-card",
6761
+ onClick: () => {
6762
+ onClose();
6763
+ onOpenThread(s.threadId);
6764
+ },
6765
+ children: [
6766
+ /* @__PURE__ */ jsx44(Avatar, { size: 32, gradient: avatar.gradient, letter: avatar.letter, imageUrl: s.authorAvatarUrl }),
6767
+ /* @__PURE__ */ jsxs38("div", { className: "fk-ask-source-card-body", children: [
6768
+ /* @__PURE__ */ jsxs38("div", { className: "fk-ask-source-card-title", children: [
6769
+ "[",
6770
+ i + 1,
6771
+ "] ",
6772
+ s.title
6773
+ ] }),
6774
+ /* @__PURE__ */ jsxs38("div", { className: "fk-ask-source-card-meta", children: [
6775
+ s.authorDisplayName,
6776
+ " \xB7 ",
6777
+ fmtRelativeTime(s.createdAt)
6778
+ ] })
6779
+ ] })
6780
+ ]
6781
+ },
6782
+ s.threadId
6783
+ );
6784
+ }) })
6785
+ ] });
6786
+ }
6787
+ function TurnView({ turn, onOpenThread, onOpenSources, onSuggest, isLast }) {
6788
+ const mediaSources = turn.sources.filter((s) => s.imageUrl !== null);
6789
+ return /* @__PURE__ */ jsxs38("div", { className: "fk-ask-turn", children: [
6790
+ /* @__PURE__ */ jsx44("div", { className: "fk-ask-turn-query-row", children: /* @__PURE__ */ jsx44("div", { className: "fk-ask-turn-query-pill", children: turn.query }) }),
6791
+ turn.sources.length > 0 && /* @__PURE__ */ jsxs38("button", { type: "button", className: "fk-ask-source-pill", onClick: onOpenSources, children: [
6792
+ /* @__PURE__ */ jsx44("div", { className: "fk-ask-source-pill-avatars", children: turn.sources.slice(0, 3).map((s, i) => {
6793
+ const av = authorAvatar2(s.authorId, s.authorDisplayName);
6794
+ return /* @__PURE__ */ jsx44(Avatar, { size: 18, gradient: av.gradient, letter: av.letter, imageUrl: s.authorAvatarUrl }, i);
6795
+ }) }),
6796
+ /* @__PURE__ */ jsxs38("span", { className: "fk-ask-source-pill-text", children: [
6797
+ "From ",
6798
+ turn.sources[0].title.slice(0, 30),
6799
+ turn.sources[0].title.length > 30 ? "\u2026" : "",
6800
+ turn.sources.length > 1 ? ` +${turn.sources.length - 1} more` : ""
6801
+ ] }),
6802
+ /* @__PURE__ */ jsx44(ChevronRightIcon, { size: 12 })
6803
+ ] }),
6804
+ turn.loading && !turn.answer?.intro && /* @__PURE__ */ jsxs38("div", { className: "fk-ask-spinner", children: [
6805
+ /* @__PURE__ */ jsx44(MascotIcon, { size: 22, variant: "nav" }),
6806
+ "Thinking\u2026"
6807
+ ] }),
6808
+ turn.error && /* @__PURE__ */ jsx44("div", { className: "fk-ask-disclaimer", style: { fontStyle: "normal", color: "var(--text-2)" }, children: turn.error }),
6809
+ turn.answer?.intro && /* @__PURE__ */ jsx44("div", { className: "fk-ask-intro", children: turn.answer.intro }),
6810
+ turn.answer?.categories.map((cat, i) => /* @__PURE__ */ jsxs38("div", { className: "fk-ask-category", children: [
6811
+ /* @__PURE__ */ jsx44("div", { className: "fk-ask-category-title", children: cat.title }),
6812
+ cat.bullets.map((b, j) => /* @__PURE__ */ jsxs38("div", { className: "fk-ask-bullet", children: [
6813
+ /* @__PURE__ */ jsx44("div", { className: "fk-ask-bullet-fact", children: b.fact }),
6814
+ /* @__PURE__ */ jsxs38("div", { className: "fk-ask-bullet-quote", children: [
6815
+ '"',
6816
+ b.quote,
6817
+ '"'
6818
+ ] }),
6819
+ turn.sources[b.sourceIndex] && /* @__PURE__ */ jsxs38(
6820
+ "button",
6821
+ {
6822
+ type: "button",
6823
+ className: "fk-ask-attr-chip",
6824
+ onClick: () => onOpenThread(turn.sources[b.sourceIndex].threadId),
6825
+ children: [
6826
+ "[",
6827
+ b.sourceIndex + 1,
6828
+ "] ",
6829
+ turn.sources[b.sourceIndex].title.slice(0, 40),
6830
+ turn.sources[b.sourceIndex].title.length > 40 ? "\u2026" : ""
6831
+ ]
6832
+ }
6833
+ )
6834
+ ] }, j))
6835
+ ] }, i)),
6836
+ !turn.loading && turn.answer && mediaSources.length > 0 && /* @__PURE__ */ jsx44("div", { className: "fk-ask-media-row", children: mediaSources.map((s) => /* @__PURE__ */ jsx44("button", { type: "button", className: "fk-ask-media-thumb", onClick: () => onOpenThread(s.threadId), children: /* @__PURE__ */ jsx44("img", { src: s.imageUrl, alt: "" }) }, s.threadId)) }),
6837
+ isLast && !turn.loading && turn.answer && /* @__PURE__ */ jsx44("div", { className: "fk-ask-disclaimer", children: "Responses are AI-generated from threads and comments and may not be accurate." }),
6838
+ !turn.loading && (turn.answer?.suggestions.length ?? 0) > 0 && /* @__PURE__ */ jsx44("div", { className: "fk-ask-suggestions", children: turn.answer.suggestions.map((p, i) => /* @__PURE__ */ jsx44("button", { type: "button", className: "fk-ask-suggestion-chip", onClick: () => onSuggest(p), children: p }, i)) })
6839
+ ] });
6840
+ }
6841
+ function AskResult() {
6842
+ const { state, openThread, goBack, forumId, sessionToken } = useForum();
6843
+ const initialQuery = state.ask.query;
6844
+ const [turns, setTurns] = useState23([]);
6845
+ const [followUp, setFollowUp] = useState23("");
6846
+ const [sourcesModalTurnIdx, setSourcesModalTurnIdx] = useState23(null);
6847
+ const bottomRef = useRef12(null);
6848
+ const ask = useCallback4(async (q) => {
6849
+ const idx = turns.length;
6850
+ setTurns((prev) => [...prev, { query: q, answer: null, sources: [], loading: true, error: null }]);
6851
+ try {
6852
+ await callAskStreaming(forumId, q, sessionToken, (event) => {
6853
+ setTurns((prev) => prev.map((t, i) => {
6854
+ if (i !== idx) return t;
6855
+ if (event.type === "sources") return { ...t, sources: event.sources };
6856
+ if (event.type === "intro") {
6857
+ const existing = t.answer ?? { intro: "", categories: [], suggestions: [] };
6858
+ return { ...t, answer: { ...existing, intro: event.text } };
6859
+ }
6860
+ if (event.type === "category") {
6861
+ const existing = t.answer ?? { intro: "", categories: [], suggestions: [] };
6862
+ return { ...t, answer: { ...existing, categories: [...existing.categories, { title: event.title, bullets: event.bullets }] } };
6863
+ }
6864
+ if (event.type === "suggestions") {
6865
+ const existing = t.answer ?? { intro: "", categories: [], suggestions: [] };
6866
+ return { ...t, answer: { ...existing, suggestions: event.prompts } };
6867
+ }
6868
+ if (event.type === "error") return { ...t, error: event.message };
6869
+ return t;
6870
+ }));
6871
+ });
6872
+ } catch (err) {
6873
+ setTurns((prev) => prev.map(
6874
+ (t, i) => i === idx ? { ...t, error: err instanceof Error ? err.message : "Something went wrong" } : t
6875
+ ));
6876
+ } finally {
6877
+ setTurns((prev) => prev.map((t, i) => i === idx ? { ...t, loading: false } : t));
6878
+ }
6879
+ }, [forumId, sessionToken, turns.length]);
6880
+ const hasAsked = useRef12(false);
6881
+ useEffect11(() => {
6882
+ if (hasAsked.current || !initialQuery) return;
6883
+ hasAsked.current = true;
6884
+ void ask(initialQuery);
6885
+ }, [initialQuery, ask]);
6886
+ useEffect11(() => {
6887
+ bottomRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
6888
+ }, [turns]);
6889
+ function submitFollowUp() {
6890
+ const q = followUp.trim();
6891
+ if (!q) return;
6892
+ setFollowUp("");
6893
+ void ask(q);
6894
+ }
6895
+ function handleSuggest(p) {
6896
+ void ask(p);
6897
+ }
6898
+ const sourcesModalTurn = sourcesModalTurnIdx !== null ? turns[sourcesModalTurnIdx] : null;
6899
+ return /* @__PURE__ */ jsxs38(Shell, { askActive: true, children: [
6900
+ /* @__PURE__ */ jsxs38("div", { className: "fk-profile fk-ask-result-wide", children: [
6901
+ state.history.length > 0 && /* @__PURE__ */ jsx44(PillButton, { variant: "surface", icon: /* @__PURE__ */ jsx44(ChevronLeftIcon, {}), onClick: goBack, style: { marginBottom: 14 }, children: "Back" }),
6902
+ /* @__PURE__ */ jsxs38("div", { className: "fk-ask-result-header", children: [
6903
+ /* @__PURE__ */ jsx44(SparkleIcon, { size: 22 }),
6904
+ /* @__PURE__ */ jsx44("h1", { className: "fk-ask-result-title", children: "Ask AI" })
6905
+ ] }),
6906
+ /* @__PURE__ */ jsx44("div", { className: "fk-ask-result-turns", children: turns.map((turn, i) => /* @__PURE__ */ jsx44(
6907
+ TurnView,
6908
+ {
6909
+ turn,
6910
+ onOpenThread: openThread,
6911
+ onOpenSources: () => setSourcesModalTurnIdx(i),
6912
+ onSuggest: handleSuggest,
6913
+ isLast: i === turns.length - 1
6914
+ },
6915
+ i
6916
+ )) }),
6917
+ /* @__PURE__ */ jsx44("div", { ref: bottomRef }),
6918
+ /* @__PURE__ */ jsxs38("div", { className: "fk-ask-followup-bar", children: [
6919
+ /* @__PURE__ */ jsx44(
6920
+ "input",
6921
+ {
6922
+ className: "fk-ask-followup-input",
6923
+ placeholder: "Ask a follow-up\u2026",
6924
+ value: followUp,
6925
+ onChange: (e) => setFollowUp(e.target.value),
6926
+ onKeyDown: (e) => {
6927
+ if (e.key === "Enter") submitFollowUp();
6928
+ }
6929
+ }
6930
+ ),
6931
+ /* @__PURE__ */ jsx44(
6932
+ "button",
6933
+ {
6934
+ type: "button",
6935
+ className: "fk-ask-followup-btn",
6936
+ disabled: !followUp.trim(),
6937
+ onClick: submitFollowUp,
6938
+ children: /* @__PURE__ */ jsx44(ChevronRightIcon, { size: 16 })
6939
+ }
6940
+ )
6941
+ ] })
6942
+ ] }),
6943
+ sourcesModalTurn && /* @__PURE__ */ jsx44(
6944
+ SourcesModal,
6945
+ {
6946
+ sources: sourcesModalTurn.sources,
6947
+ onClose: () => setSourcesModalTurnIdx(null),
6948
+ onOpenThread: openThread
6949
+ }
6950
+ )
6951
+ ] });
6952
+ }
6953
+
6439
6954
  // src/views/components/profile/edit-profile-modal.tsx
6440
- import { useState as useState21, useRef as useRef11 } from "react";
6441
- import { Fragment as Fragment16, jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
6955
+ import { useState as useState24, useRef as useRef13 } from "react";
6956
+ import { Fragment as Fragment17, jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
6442
6957
  var PLATFORMS = SOCIAL_PLATFORMS;
6443
6958
  var toSuffix = socialToSuffix;
6444
6959
  var toUrl = socialToUrl;
@@ -6468,22 +6983,22 @@ function EditProfileModal({
6468
6983
  onClose
6469
6984
  }) {
6470
6985
  const isDark = themePreference !== "light";
6471
- const [draftName, setDraftName] = useState21(displayName);
6472
- const [draftBio, setDraftBio] = useState21(bio);
6473
- const [draftLinks, setDraftLinks] = useState21(
6986
+ const [draftName, setDraftName] = useState24(displayName);
6987
+ const [draftBio, setDraftBio] = useState24(bio);
6988
+ const [draftLinks, setDraftLinks] = useState24(
6474
6989
  () => socialLinks.map((l) => ({ id: l.id, platform: l.platform, suffix: toSuffix(l.platform, l.url) }))
6475
6990
  );
6476
- const [bannerPreview, setBannerPreview] = useState21(bannerUrl);
6477
- const [avatarPreview, setAvatarPreview] = useState21(avatarUrl);
6478
- const [bannerBlob, setBannerBlob] = useState21(null);
6479
- const [avatarBlob, setAvatarBlob] = useState21(null);
6480
- const [openPickerId, setOpenPickerId] = useState21(null);
6481
- const [saving, setSaving] = useState21(false);
6482
- const [saveError, setSaveError] = useState21(null);
6483
- const [editingImage, setEditingImage] = useState21(null);
6484
- const [lightboxImage, setLightboxImage] = useState21(null);
6485
- const bannerInputRef = useRef11(null);
6486
- const avatarInputRef = useRef11(null);
6991
+ const [bannerPreview, setBannerPreview] = useState24(bannerUrl);
6992
+ const [avatarPreview, setAvatarPreview] = useState24(avatarUrl);
6993
+ const [bannerBlob, setBannerBlob] = useState24(null);
6994
+ const [avatarBlob, setAvatarBlob] = useState24(null);
6995
+ const [openPickerId, setOpenPickerId] = useState24(null);
6996
+ const [saving, setSaving] = useState24(false);
6997
+ const [saveError, setSaveError] = useState24(null);
6998
+ const [editingImage, setEditingImage] = useState24(null);
6999
+ const [lightboxImage, setLightboxImage] = useState24(null);
7000
+ const bannerInputRef = useRef13(null);
7001
+ const avatarInputRef = useRef13(null);
6487
7002
  function handleBannerFile(e) {
6488
7003
  const file = e.target.files?.[0];
6489
7004
  if (!file) return;
@@ -6545,16 +7060,16 @@ function EditProfileModal({
6545
7060
  setSaving(false);
6546
7061
  }
6547
7062
  }
6548
- return /* @__PURE__ */ jsxs38(Fragment16, { children: [
6549
- /* @__PURE__ */ jsxs38(Modal, { onClose, maxWidth: 600, children: [
6550
- /* @__PURE__ */ jsxs38(
7063
+ return /* @__PURE__ */ jsxs39(Fragment17, { children: [
7064
+ /* @__PURE__ */ jsxs39(Modal, { onClose, maxWidth: 600, children: [
7065
+ /* @__PURE__ */ jsxs39(
6551
7066
  "div",
6552
7067
  {
6553
7068
  className: "fk-edit-modal-banner",
6554
7069
  style: bannerPreview ? { backgroundImage: `url(${bannerPreview})`, cursor: "zoom-in" } : void 0,
6555
7070
  onClick: bannerPreview ? () => setLightboxImage(bannerPreview) : void 0,
6556
7071
  children: [
6557
- /* @__PURE__ */ jsxs38(
7072
+ /* @__PURE__ */ jsxs39(
6558
7073
  "button",
6559
7074
  {
6560
7075
  type: "button",
@@ -6564,12 +7079,12 @@ function EditProfileModal({
6564
7079
  bannerInputRef.current?.click();
6565
7080
  },
6566
7081
  children: [
6567
- /* @__PURE__ */ jsx44(CameraIcon, { size: 13 }),
7082
+ /* @__PURE__ */ jsx45(CameraIcon, { size: 13 }),
6568
7083
  "Change Banner"
6569
7084
  ]
6570
7085
  }
6571
7086
  ),
6572
- /* @__PURE__ */ jsx44(
7087
+ /* @__PURE__ */ jsx45(
6573
7088
  "input",
6574
7089
  {
6575
7090
  ref: bannerInputRef,
@@ -6580,7 +7095,7 @@ function EditProfileModal({
6580
7095
  onClick: (e) => e.stopPropagation()
6581
7096
  }
6582
7097
  ),
6583
- /* @__PURE__ */ jsxs38(
7098
+ /* @__PURE__ */ jsxs39(
6584
7099
  "div",
6585
7100
  {
6586
7101
  className: "fk-edit-modal-avatar",
@@ -6589,8 +7104,8 @@ function EditProfileModal({
6589
7104
  setLightboxImage(avatarPreview);
6590
7105
  } : void 0,
6591
7106
  children: [
6592
- avatarPreview ? /* @__PURE__ */ jsx44("img", { src: avatarPreview, alt: "Avatar preview", className: "fk-edit-modal-avatar-img" }) : null,
6593
- /* @__PURE__ */ jsx44(
7107
+ avatarPreview ? /* @__PURE__ */ jsx45("img", { src: avatarPreview, alt: "Avatar preview", className: "fk-edit-modal-avatar-img" }) : null,
7108
+ /* @__PURE__ */ jsx45(
6594
7109
  "span",
6595
7110
  {
6596
7111
  className: "fk-edit-modal-avatar-badge",
@@ -6598,13 +7113,13 @@ function EditProfileModal({
6598
7113
  e.stopPropagation();
6599
7114
  avatarInputRef.current?.click();
6600
7115
  },
6601
- children: /* @__PURE__ */ jsx44(CameraIcon, { size: 13 })
7116
+ children: /* @__PURE__ */ jsx45(CameraIcon, { size: 13 })
6602
7117
  }
6603
7118
  )
6604
7119
  ]
6605
7120
  }
6606
7121
  ),
6607
- /* @__PURE__ */ jsx44(
7122
+ /* @__PURE__ */ jsx45(
6608
7123
  "input",
6609
7124
  {
6610
7125
  ref: avatarInputRef,
@@ -6618,15 +7133,15 @@ function EditProfileModal({
6618
7133
  ]
6619
7134
  }
6620
7135
  ),
6621
- /* @__PURE__ */ jsxs38("div", { className: "fk-edit-modal-body", children: [
6622
- /* @__PURE__ */ jsxs38("div", { className: "fk-edit-modal-title-row", children: [
6623
- /* @__PURE__ */ jsx44("h3", { className: "fk-edit-modal-title", children: "Settings" }),
6624
- /* @__PURE__ */ jsx44("button", { type: "button", className: "fk-edit-modal-close", onClick: onClose, children: /* @__PURE__ */ jsx44(CloseIcon, { size: 18 }) })
7136
+ /* @__PURE__ */ jsxs39("div", { className: "fk-edit-modal-body", children: [
7137
+ /* @__PURE__ */ jsxs39("div", { className: "fk-edit-modal-title-row", children: [
7138
+ /* @__PURE__ */ jsx45("h3", { className: "fk-edit-modal-title", children: "Settings" }),
7139
+ /* @__PURE__ */ jsx45("button", { type: "button", className: "fk-edit-modal-close", onClick: onClose, children: /* @__PURE__ */ jsx45(CloseIcon, { size: 18 }) })
6625
7140
  ] }),
6626
- /* @__PURE__ */ jsx44("span", { className: "fk-edit-modal-section-label", children: "Profile" }),
6627
- /* @__PURE__ */ jsxs38("div", { className: "fk-edit-modal-field", children: [
6628
- /* @__PURE__ */ jsx44("label", { className: "fk-edit-modal-label", children: "Display name" }),
6629
- /* @__PURE__ */ jsx44(
7141
+ /* @__PURE__ */ jsx45("span", { className: "fk-edit-modal-section-label", children: "Profile" }),
7142
+ /* @__PURE__ */ jsxs39("div", { className: "fk-edit-modal-field", children: [
7143
+ /* @__PURE__ */ jsx45("label", { className: "fk-edit-modal-label", children: "Display name" }),
7144
+ /* @__PURE__ */ jsx45(
6630
7145
  "input",
6631
7146
  {
6632
7147
  className: "fk-edit-modal-input",
@@ -6636,9 +7151,9 @@ function EditProfileModal({
6636
7151
  }
6637
7152
  )
6638
7153
  ] }),
6639
- /* @__PURE__ */ jsxs38("div", { className: "fk-edit-modal-field", children: [
6640
- /* @__PURE__ */ jsx44("label", { className: "fk-edit-modal-label", children: "Bio" }),
6641
- /* @__PURE__ */ jsx44(
7154
+ /* @__PURE__ */ jsxs39("div", { className: "fk-edit-modal-field", children: [
7155
+ /* @__PURE__ */ jsx45("label", { className: "fk-edit-modal-label", children: "Bio" }),
7156
+ /* @__PURE__ */ jsx45(
6642
7157
  "textarea",
6643
7158
  {
6644
7159
  className: "fk-edit-modal-textarea",
@@ -6649,17 +7164,17 @@ function EditProfileModal({
6649
7164
  }
6650
7165
  )
6651
7166
  ] }),
6652
- /* @__PURE__ */ jsx44("hr", { className: "fk-edit-modal-divider" }),
6653
- /* @__PURE__ */ jsxs38("div", { className: "fk-edit-modal-links-head", children: [
6654
- /* @__PURE__ */ jsx44("span", { className: "fk-edit-modal-links-title", children: "Social & professional links" }),
6655
- /* @__PURE__ */ jsx44("button", { type: "button", className: "fk-edit-modal-add-link", onClick: addLink, children: "+ Add link" })
7167
+ /* @__PURE__ */ jsx45("hr", { className: "fk-edit-modal-divider" }),
7168
+ /* @__PURE__ */ jsxs39("div", { className: "fk-edit-modal-links-head", children: [
7169
+ /* @__PURE__ */ jsx45("span", { className: "fk-edit-modal-links-title", children: "Social & professional links" }),
7170
+ /* @__PURE__ */ jsx45("button", { type: "button", className: "fk-edit-modal-add-link", onClick: addLink, children: "+ Add link" })
6656
7171
  ] }),
6657
- draftLinks.length === 0 ? /* @__PURE__ */ jsx44("p", { className: "fk-edit-modal-empty", children: "No links yet. Add one above." }) : /* @__PURE__ */ jsx44("div", { className: "fk-edit-modal-links-list", children: draftLinks.map((link) => {
7172
+ draftLinks.length === 0 ? /* @__PURE__ */ jsx45("p", { className: "fk-edit-modal-empty", children: "No links yet. Add one above." }) : /* @__PURE__ */ jsx45("div", { className: "fk-edit-modal-links-list", children: draftLinks.map((link) => {
6658
7173
  const Icon = PLATFORM_ICON2[link.platform];
6659
7174
  const prefix = socialPrefix(link.platform);
6660
- return /* @__PURE__ */ jsxs38("div", { className: "fk-edit-modal-link-row", children: [
6661
- /* @__PURE__ */ jsxs38("div", { className: "fk-edit-modal-platform-picker", children: [
6662
- /* @__PURE__ */ jsxs38(
7175
+ return /* @__PURE__ */ jsxs39("div", { className: "fk-edit-modal-link-row", children: [
7176
+ /* @__PURE__ */ jsxs39("div", { className: "fk-edit-modal-platform-picker", children: [
7177
+ /* @__PURE__ */ jsxs39(
6663
7178
  "button",
6664
7179
  {
6665
7180
  type: "button",
@@ -6667,14 +7182,14 @@ function EditProfileModal({
6667
7182
  onClick: () => setOpenPickerId(openPickerId === link.id ? null : link.id),
6668
7183
  title: link.platform,
6669
7184
  children: [
6670
- /* @__PURE__ */ jsx44(Icon, { size: 17 }),
6671
- /* @__PURE__ */ jsx44(ChevronDownIcon, { size: 11 })
7185
+ /* @__PURE__ */ jsx45(Icon, { size: 17 }),
7186
+ /* @__PURE__ */ jsx45(ChevronDownIcon, { size: 11 })
6672
7187
  ]
6673
7188
  }
6674
7189
  ),
6675
- openPickerId === link.id && /* @__PURE__ */ jsx44("div", { className: "fk-edit-modal-platform-dropdown", children: PLATFORMS.map((p) => {
7190
+ openPickerId === link.id && /* @__PURE__ */ jsx45("div", { className: "fk-edit-modal-platform-dropdown", children: PLATFORMS.map((p) => {
6676
7191
  const PIcon = PLATFORM_ICON2[p];
6677
- return /* @__PURE__ */ jsx44(
7192
+ return /* @__PURE__ */ jsx45(
6678
7193
  "button",
6679
7194
  {
6680
7195
  type: "button",
@@ -6684,15 +7199,15 @@ function EditProfileModal({
6684
7199
  updateLinkPlatform(link.id, p);
6685
7200
  setOpenPickerId(null);
6686
7201
  },
6687
- children: /* @__PURE__ */ jsx44(PIcon, { size: 17 })
7202
+ children: /* @__PURE__ */ jsx45(PIcon, { size: 17 })
6688
7203
  },
6689
7204
  p
6690
7205
  );
6691
7206
  }) })
6692
7207
  ] }),
6693
- /* @__PURE__ */ jsxs38("div", { className: "fk-edit-modal-link-url-wrap", children: [
6694
- prefix && /* @__PURE__ */ jsx44("span", { className: "fk-edit-modal-link-prefix", children: prefix.replace("https://", "") }),
6695
- /* @__PURE__ */ jsx44(
7208
+ /* @__PURE__ */ jsxs39("div", { className: "fk-edit-modal-link-url-wrap", children: [
7209
+ prefix && /* @__PURE__ */ jsx45("span", { className: "fk-edit-modal-link-prefix", children: prefix.replace("https://", "") }),
7210
+ /* @__PURE__ */ jsx45(
6696
7211
  "input",
6697
7212
  {
6698
7213
  className: "fk-edit-modal-link-suffix",
@@ -6702,26 +7217,26 @@ function EditProfileModal({
6702
7217
  }
6703
7218
  )
6704
7219
  ] }),
6705
- /* @__PURE__ */ jsx44("button", { type: "button", className: "fk-edit-modal-link-trash", onClick: () => removeLink(link.id), children: /* @__PURE__ */ jsx44(TrashIcon, { size: 16 }) })
7220
+ /* @__PURE__ */ jsx45("button", { type: "button", className: "fk-edit-modal-link-trash", onClick: () => removeLink(link.id), children: /* @__PURE__ */ jsx45(TrashIcon, { size: 16 }) })
6706
7221
  ] }, link.id);
6707
7222
  }) }),
6708
- /* @__PURE__ */ jsx44("hr", { className: "fk-edit-modal-divider" }),
6709
- /* @__PURE__ */ jsx44("span", { className: "fk-edit-modal-section-label", children: "Preferences" }),
6710
- /* @__PURE__ */ jsxs38("div", { className: "fk-edit-modal-preference-row", children: [
6711
- /* @__PURE__ */ jsxs38("div", { children: [
6712
- /* @__PURE__ */ jsx44("div", { className: "fk-edit-modal-preference-label", children: "Display Mode" }),
6713
- /* @__PURE__ */ jsx44("div", { className: "fk-edit-modal-preference-sub", children: isDark ? "Dark" : "Light" })
7223
+ /* @__PURE__ */ jsx45("hr", { className: "fk-edit-modal-divider" }),
7224
+ /* @__PURE__ */ jsx45("span", { className: "fk-edit-modal-section-label", children: "Preferences" }),
7225
+ /* @__PURE__ */ jsxs39("div", { className: "fk-edit-modal-preference-row", children: [
7226
+ /* @__PURE__ */ jsxs39("div", { children: [
7227
+ /* @__PURE__ */ jsx45("div", { className: "fk-edit-modal-preference-label", children: "Display Mode" }),
7228
+ /* @__PURE__ */ jsx45("div", { className: "fk-edit-modal-preference-sub", children: isDark ? "Dark" : "Light" })
6714
7229
  ] }),
6715
- /* @__PURE__ */ jsx44("button", { type: "button", className: "fk-edit-modal-theme-toggle", onClick: onToggleTheme, "aria-label": "Toggle display mode", children: isDark ? /* @__PURE__ */ jsx44(MoonIcon, { size: 17 }) : /* @__PURE__ */ jsx44(SunIcon, { size: 17 }) })
7230
+ /* @__PURE__ */ jsx45("button", { type: "button", className: "fk-edit-modal-theme-toggle", onClick: onToggleTheme, "aria-label": "Toggle display mode", children: isDark ? /* @__PURE__ */ jsx45(MoonIcon, { size: 17 }) : /* @__PURE__ */ jsx45(SunIcon, { size: 17 }) })
6716
7231
  ] }),
6717
- saveError && /* @__PURE__ */ jsx44("p", { className: "fk-edit-modal-save-error", children: saveError })
7232
+ saveError && /* @__PURE__ */ jsx45("p", { className: "fk-edit-modal-save-error", children: saveError })
6718
7233
  ] }),
6719
- /* @__PURE__ */ jsxs38("div", { className: "fk-edit-modal-footer", children: [
6720
- /* @__PURE__ */ jsx44(PillButton, { variant: "surface", onClick: onClose, disabled: saving, children: "Cancel" }),
6721
- /* @__PURE__ */ jsx44(PillButton, { variant: "accent", onClick: handleSave, disabled: saving, children: saving ? "Saving\u2026" : "Save" })
7234
+ /* @__PURE__ */ jsxs39("div", { className: "fk-edit-modal-footer", children: [
7235
+ /* @__PURE__ */ jsx45(PillButton, { variant: "surface", onClick: onClose, disabled: saving, children: "Cancel" }),
7236
+ /* @__PURE__ */ jsx45(PillButton, { variant: "accent", onClick: handleSave, disabled: saving, children: saving ? "Saving\u2026" : "Save" })
6722
7237
  ] })
6723
7238
  ] }),
6724
- editingImage && /* @__PURE__ */ jsx44(
7239
+ editingImage && /* @__PURE__ */ jsx45(
6725
7240
  ImageEditorModal,
6726
7241
  {
6727
7242
  file: editingImage.file,
@@ -6732,19 +7247,19 @@ function EditProfileModal({
6732
7247
  onConfirm: handleImageEditorConfirm
6733
7248
  }
6734
7249
  ),
6735
- lightboxImage && /* @__PURE__ */ jsx44(Lightbox, { items: [{ type: "image", url: lightboxImage }], startIndex: 0, onClose: () => setLightboxImage(null) })
7250
+ lightboxImage && /* @__PURE__ */ jsx45(Lightbox, { items: [{ type: "image", url: lightboxImage }], startIndex: 0, onClose: () => setLightboxImage(null) })
6736
7251
  ] });
6737
7252
  }
6738
7253
 
6739
7254
  // src/views/components/composer/drafts-list-modal.tsx
6740
- import { useState as useState22 } from "react";
6741
- import { jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
7255
+ import { useState as useState25 } from "react";
7256
+ import { jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
6742
7257
  function formatDraftUpdatedAt(updatedAt) {
6743
7258
  const relative = fmtRelativeTime(updatedAt);
6744
7259
  return relative === "now" ? "Updated just now" : `Updated ${relative} ago`;
6745
7260
  }
6746
7261
  function DraftsListModal({ items, loading, highlightedDraftId, onClose, onResume, onDelete }) {
6747
- const [deletingId, setDeletingId] = useState22(null);
7262
+ const [deletingId, setDeletingId] = useState25(null);
6748
7263
  async function handleDelete(e, draftId) {
6749
7264
  e.stopPropagation();
6750
7265
  setDeletingId(draftId);
@@ -6754,30 +7269,30 @@ function DraftsListModal({ items, loading, highlightedDraftId, onClose, onResume
6754
7269
  setDeletingId(null);
6755
7270
  }
6756
7271
  }
6757
- return /* @__PURE__ */ jsxs39(Modal, { onClose, maxWidth: 560, minHeight: items.length === 0 ? 320 : 660, blurBackground: true, children: [
6758
- /* @__PURE__ */ jsxs39("div", { className: "fk-drafts-modal-header", children: [
6759
- /* @__PURE__ */ jsx45("h3", { className: "fk-drafts-modal-title", children: "Drafts" }),
6760
- /* @__PURE__ */ jsx45("button", { type: "button", className: "fk-drafts-modal-close", onClick: onClose, children: /* @__PURE__ */ jsx45(CloseIcon, { size: 18 }) })
7272
+ return /* @__PURE__ */ jsxs40(Modal, { onClose, maxWidth: 560, minHeight: items.length === 0 ? 320 : 660, blurBackground: true, children: [
7273
+ /* @__PURE__ */ jsxs40("div", { className: "fk-drafts-modal-header", children: [
7274
+ /* @__PURE__ */ jsx46("h3", { className: "fk-drafts-modal-title", children: "Drafts" }),
7275
+ /* @__PURE__ */ jsx46("button", { type: "button", className: "fk-drafts-modal-close", onClick: onClose, children: /* @__PURE__ */ jsx46(CloseIcon, { size: 18 }) })
6761
7276
  ] }),
6762
- /* @__PURE__ */ jsx45("div", { className: "fk-drafts-modal-body", children: loading ? /* @__PURE__ */ jsx45("div", { className: "fk-drafts-modal-loading", children: /* @__PURE__ */ jsx45(MascotIcon, { size: 36 }) }) : items.length === 0 ? /* @__PURE__ */ jsxs39("div", { className: "fk-drafts-modal-empty", children: [
6763
- /* @__PURE__ */ jsx45(DraftIcon, { size: 48 }),
6764
- /* @__PURE__ */ jsx45("p", { children: "Nothing saved yet. Anything you start writing can land here so you never lose it." })
7277
+ /* @__PURE__ */ jsx46("div", { className: "fk-drafts-modal-body", children: loading ? /* @__PURE__ */ jsx46("div", { className: "fk-drafts-modal-loading", children: /* @__PURE__ */ jsx46(MascotIcon, { size: 36 }) }) : items.length === 0 ? /* @__PURE__ */ jsxs40("div", { className: "fk-drafts-modal-empty", children: [
7278
+ /* @__PURE__ */ jsx46(DraftIcon, { size: 48 }),
7279
+ /* @__PURE__ */ jsx46("p", { children: "Nothing saved yet. Anything you start writing can land here so you never lose it." })
6765
7280
  ] }) : items.map((draft) => {
6766
7281
  const thumb = draft.content.attachments[0];
6767
- return /* @__PURE__ */ jsxs39(
7282
+ return /* @__PURE__ */ jsxs40(
6768
7283
  "button",
6769
7284
  {
6770
7285
  type: "button",
6771
7286
  className: `fk-drafts-modal-row${draft.id === highlightedDraftId ? " fk-drafts-modal-row--highlighted" : ""}`,
6772
7287
  onClick: () => onResume(draft),
6773
7288
  children: [
6774
- thumb && /* @__PURE__ */ jsx45("div", { className: "fk-drafts-modal-row-thumb", children: thumb.kind === "video" ? /* @__PURE__ */ jsx45("video", { src: thumb.attachmentUrl, muted: true }) : /* @__PURE__ */ jsx45("img", { src: thumb.attachmentUrl, alt: thumb.name }) }),
6775
- /* @__PURE__ */ jsxs39("div", { className: "fk-drafts-modal-row-main", children: [
6776
- /* @__PURE__ */ jsx45("span", { className: "fk-drafts-modal-row-title", children: draft.title }),
6777
- /* @__PURE__ */ jsx45("span", { className: "fk-drafts-modal-row-snippet", children: draft.content.body || "No body yet" }),
6778
- /* @__PURE__ */ jsx45("span", { className: "fk-drafts-modal-row-time", children: formatDraftUpdatedAt(draft.updatedAt) })
7289
+ thumb && /* @__PURE__ */ jsx46("div", { className: "fk-drafts-modal-row-thumb", children: thumb.kind === "video" ? /* @__PURE__ */ jsx46("video", { src: thumb.attachmentUrl, muted: true }) : /* @__PURE__ */ jsx46("img", { src: thumb.attachmentUrl, alt: thumb.name }) }),
7290
+ /* @__PURE__ */ jsxs40("div", { className: "fk-drafts-modal-row-main", children: [
7291
+ /* @__PURE__ */ jsx46("span", { className: "fk-drafts-modal-row-title", children: draft.title }),
7292
+ /* @__PURE__ */ jsx46("span", { className: "fk-drafts-modal-row-snippet", children: draft.content.body || "No body yet" }),
7293
+ /* @__PURE__ */ jsx46("span", { className: "fk-drafts-modal-row-time", children: formatDraftUpdatedAt(draft.updatedAt) })
6779
7294
  ] }),
6780
- /* @__PURE__ */ jsx45(
7295
+ /* @__PURE__ */ jsx46(
6781
7296
  "button",
6782
7297
  {
6783
7298
  type: "button",
@@ -6785,7 +7300,7 @@ function DraftsListModal({ items, loading, highlightedDraftId, onClose, onResume
6785
7300
  "aria-label": "Delete draft",
6786
7301
  disabled: deletingId === draft.id,
6787
7302
  onClick: (e) => handleDelete(e, draft.id),
6788
- children: /* @__PURE__ */ jsx45(TrashIcon, { size: 16 })
7303
+ children: /* @__PURE__ */ jsx46(TrashIcon, { size: 16 })
6789
7304
  }
6790
7305
  )
6791
7306
  ]
@@ -6797,20 +7312,20 @@ function DraftsListModal({ items, loading, highlightedDraftId, onClose, onResume
6797
7312
  }
6798
7313
 
6799
7314
  // src/views/components/shared/share-modal.tsx
6800
- import { useEffect as useEffect11, useState as useState23 } from "react";
6801
- import { Fragment as Fragment17, jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
7315
+ import { useEffect as useEffect12, useState as useState26 } from "react";
7316
+ import { Fragment as Fragment18, jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
6802
7317
  var MAX_RECIPIENTS = 20;
6803
7318
  function ShareModal({ onClose }) {
6804
7319
  const { forumId: fid, sessionToken: token, shareThreadWithMembers } = useForum();
6805
- const [query, setQuery] = useState23("");
6806
- const [results, setResults] = useState23([]);
6807
- const [loading, setLoading] = useState23(false);
6808
- const [selected, setSelected] = useState23([]);
6809
- const [message, setMessage] = useState23("");
6810
- const [submitting, setSubmitting] = useState23(false);
6811
- const [error, setError] = useState23(null);
6812
- const [done, setDone] = useState23(false);
6813
- useEffect11(() => {
7320
+ const [query, setQuery] = useState26("");
7321
+ const [results, setResults] = useState26([]);
7322
+ const [loading, setLoading] = useState26(false);
7323
+ const [selected, setSelected] = useState26([]);
7324
+ const [message, setMessage] = useState26("");
7325
+ const [submitting, setSubmitting] = useState26(false);
7326
+ const [error, setError] = useState26(null);
7327
+ const [done, setDone] = useState26(false);
7328
+ useEffect12(() => {
6814
7329
  const q = query.trim();
6815
7330
  if (!q || !fid) {
6816
7331
  setResults([]);
@@ -6842,19 +7357,19 @@ function ShareModal({ onClose }) {
6842
7357
  setSubmitting(false);
6843
7358
  }
6844
7359
  }
6845
- return /* @__PURE__ */ jsxs40(Modal, { onClose, maxWidth: 540, minHeight: 440, blurBackground: true, children: [
6846
- /* @__PURE__ */ jsxs40("div", { className: "fk-drafts-modal-header", children: [
6847
- /* @__PURE__ */ jsx46("h3", { className: "fk-drafts-modal-title", children: "Share with a member" }),
6848
- /* @__PURE__ */ jsx46("button", { type: "button", className: "fk-drafts-modal-close", onClick: onClose, children: /* @__PURE__ */ jsx46(CloseIcon, { size: 18 }) })
7360
+ return /* @__PURE__ */ jsxs41(Modal, { onClose, maxWidth: 540, minHeight: 440, blurBackground: true, children: [
7361
+ /* @__PURE__ */ jsxs41("div", { className: "fk-drafts-modal-header", children: [
7362
+ /* @__PURE__ */ jsx47("h3", { className: "fk-drafts-modal-title", children: "Share with a member" }),
7363
+ /* @__PURE__ */ jsx47("button", { type: "button", className: "fk-drafts-modal-close", onClick: onClose, children: /* @__PURE__ */ jsx47(CloseIcon, { size: 18 }) })
6849
7364
  ] }),
6850
- /* @__PURE__ */ jsx46("div", { className: "fk-drafts-modal-body fk-share-modal-body", children: done ? /* @__PURE__ */ jsx46("div", { className: "fk-drafts-modal-empty", children: /* @__PURE__ */ jsxs40("p", { children: [
7365
+ /* @__PURE__ */ jsx47("div", { className: "fk-drafts-modal-body fk-share-modal-body", children: done ? /* @__PURE__ */ jsx47("div", { className: "fk-drafts-modal-empty", children: /* @__PURE__ */ jsxs41("p", { children: [
6851
7366
  "Shared with ",
6852
7367
  selected.length,
6853
7368
  " ",
6854
7369
  selected.length === 1 ? "person" : "people",
6855
7370
  "."
6856
- ] }) }) : /* @__PURE__ */ jsxs40(Fragment17, { children: [
6857
- selected.length > 0 && /* @__PURE__ */ jsx46("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 20 }, children: selected.map((u) => /* @__PURE__ */ jsxs40(
7371
+ ] }) }) : /* @__PURE__ */ jsxs41(Fragment18, { children: [
7372
+ selected.length > 0 && /* @__PURE__ */ jsx47("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 20 }, children: selected.map((u) => /* @__PURE__ */ jsxs41(
6858
7373
  "button",
6859
7374
  {
6860
7375
  type: "button",
@@ -6864,12 +7379,12 @@ function ShareModal({ onClose }) {
6864
7379
  children: [
6865
7380
  u.displayName,
6866
7381
  " ",
6867
- /* @__PURE__ */ jsx46(CloseIcon, { size: 11 })
7382
+ /* @__PURE__ */ jsx47(CloseIcon, { size: 11 })
6868
7383
  ]
6869
7384
  },
6870
7385
  u.id
6871
7386
  )) }),
6872
- /* @__PURE__ */ jsx46(
7387
+ /* @__PURE__ */ jsx47(
6873
7388
  "input",
6874
7389
  {
6875
7390
  className: "fk-edit-modal-input",
@@ -6879,30 +7394,30 @@ function ShareModal({ onClose }) {
6879
7394
  autoFocus: true
6880
7395
  }
6881
7396
  ),
6882
- /* @__PURE__ */ jsxs40("div", { style: { marginTop: 16, marginBottom: 24 }, children: [
6883
- loading && /* @__PURE__ */ jsx46("div", { className: "fk-search-dropdown-status", children: "Searching\u2026" }),
6884
- !loading && query.trim() && results.length === 0 && /* @__PURE__ */ jsx46("div", { className: "fk-search-dropdown-status", children: "No matching members" }),
7397
+ /* @__PURE__ */ jsxs41("div", { style: { marginTop: 16, marginBottom: 24 }, children: [
7398
+ loading && /* @__PURE__ */ jsx47("div", { className: "fk-search-dropdown-status", children: "Searching\u2026" }),
7399
+ !loading && query.trim() && results.length === 0 && /* @__PURE__ */ jsx47("div", { className: "fk-search-dropdown-status", children: "No matching members" }),
6885
7400
  results.map((u) => {
6886
7401
  const avatar = authorAvatar2(u.id, u.displayName);
6887
7402
  const isSelected = selected.some((s) => s.id === u.id);
6888
- return /* @__PURE__ */ jsxs40(
7403
+ return /* @__PURE__ */ jsxs41(
6889
7404
  "button",
6890
7405
  {
6891
7406
  type: "button",
6892
7407
  className: `fk-search-dropdown-row${isSelected ? " fk-search-dropdown-row--unread" : ""}`,
6893
7408
  onClick: () => toggleSelected(u),
6894
7409
  children: [
6895
- /* @__PURE__ */ jsx46(Avatar, { size: 30, gradient: avatar.gradient, letter: avatar.letter, imageUrl: u.avatarUrl }),
6896
- /* @__PURE__ */ jsx46("span", { className: "fk-search-dropdown-row-text", children: /* @__PURE__ */ jsx46("span", { className: "fk-search-dropdown-row-title", children: u.displayName }) }),
6897
- isSelected && /* @__PURE__ */ jsx46("span", { style: { color: "var(--accent)", fontSize: 13, fontWeight: 700 }, children: "\u2713" })
7410
+ /* @__PURE__ */ jsx47(Avatar, { size: 30, gradient: avatar.gradient, letter: avatar.letter, imageUrl: u.avatarUrl }),
7411
+ /* @__PURE__ */ jsx47("span", { className: "fk-search-dropdown-row-text", children: /* @__PURE__ */ jsx47("span", { className: "fk-search-dropdown-row-title", children: u.displayName }) }),
7412
+ isSelected && /* @__PURE__ */ jsx47("span", { style: { color: "var(--accent)", fontSize: 13, fontWeight: 700 }, children: "\u2713" })
6898
7413
  ]
6899
7414
  },
6900
7415
  u.id
6901
7416
  );
6902
7417
  })
6903
7418
  ] }),
6904
- /* @__PURE__ */ jsx46("label", { className: "fk-edit-modal-label", style: { marginBottom: 8, display: "block" }, children: "Message (optional)" }),
6905
- /* @__PURE__ */ jsx46(
7419
+ /* @__PURE__ */ jsx47("label", { className: "fk-edit-modal-label", style: { marginBottom: 8, display: "block" }, children: "Message (optional)" }),
7420
+ /* @__PURE__ */ jsx47(
6906
7421
  "textarea",
6907
7422
  {
6908
7423
  className: "fk-edit-modal-textarea",
@@ -6913,21 +7428,21 @@ function ShareModal({ onClose }) {
6913
7428
  placeholder: "Add a short note\u2026"
6914
7429
  }
6915
7430
  ),
6916
- error && /* @__PURE__ */ jsx46("div", { className: "fk-edit-modal-save-error", children: error }),
6917
- /* @__PURE__ */ jsx46("div", { style: { marginTop: 20, display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsx46(PillButton, { variant: "accent", disabled: selected.length === 0 || submitting, onClick: handleSubmit, children: submitting ? "Sharing\u2026" : `Share${selected.length > 0 ? ` (${selected.length})` : ""}` }) })
7431
+ error && /* @__PURE__ */ jsx47("div", { className: "fk-edit-modal-save-error", children: error }),
7432
+ /* @__PURE__ */ jsx47("div", { style: { marginTop: 20, display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsx47(PillButton, { variant: "accent", disabled: selected.length === 0 || submitting, onClick: handleSubmit, children: submitting ? "Sharing\u2026" : `Share${selected.length > 0 ? ` (${selected.length})` : ""}` }) })
6918
7433
  ] }) })
6919
7434
  ] });
6920
7435
  }
6921
7436
 
6922
7437
  // src/views/components/shared/report-modal.tsx
6923
- import { useState as useState24 } from "react";
6924
- import { Fragment as Fragment18, jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
7438
+ import { useState as useState27 } from "react";
7439
+ import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs42 } from "react/jsx-runtime";
6925
7440
  var MAX_REASON = 500;
6926
7441
  function ReportModal({ target, onClose, onSubmit }) {
6927
- const [reason, setReason] = useState24("");
6928
- const [submitting, setSubmitting] = useState24(false);
6929
- const [error, setError] = useState24(null);
6930
- const [done, setDone] = useState24(false);
7442
+ const [reason, setReason] = useState27("");
7443
+ const [submitting, setSubmitting] = useState27(false);
7444
+ const [error, setError] = useState27(null);
7445
+ const [done, setDone] = useState27(false);
6931
7446
  async function handleSubmit() {
6932
7447
  const trimmed = reason.trim();
6933
7448
  if (!trimmed || submitting) return;
@@ -6942,17 +7457,17 @@ function ReportModal({ target, onClose, onSubmit }) {
6942
7457
  setSubmitting(false);
6943
7458
  }
6944
7459
  }
6945
- return /* @__PURE__ */ jsxs41(Modal, { onClose, maxWidth: 480, blurBackground: true, children: [
6946
- /* @__PURE__ */ jsxs41("div", { className: "fk-drafts-modal-header", children: [
6947
- /* @__PURE__ */ jsxs41("h3", { className: "fk-drafts-modal-title", children: [
7460
+ return /* @__PURE__ */ jsxs42(Modal, { onClose, maxWidth: 480, blurBackground: true, children: [
7461
+ /* @__PURE__ */ jsxs42("div", { className: "fk-drafts-modal-header", children: [
7462
+ /* @__PURE__ */ jsxs42("h3", { className: "fk-drafts-modal-title", children: [
6948
7463
  "Report ",
6949
7464
  target.type === "thread" ? "thread" : "comment"
6950
7465
  ] }),
6951
- /* @__PURE__ */ jsx47("button", { type: "button", className: "fk-drafts-modal-close", onClick: onClose, children: /* @__PURE__ */ jsx47(CloseIcon, { size: 18 }) })
7466
+ /* @__PURE__ */ jsx48("button", { type: "button", className: "fk-drafts-modal-close", onClick: onClose, children: /* @__PURE__ */ jsx48(CloseIcon, { size: 18 }) })
6952
7467
  ] }),
6953
- /* @__PURE__ */ jsx47("div", { className: "fk-drafts-modal-body fk-report-modal-body", children: done ? /* @__PURE__ */ jsx47("div", { className: "fk-drafts-modal-empty", children: /* @__PURE__ */ jsx47("p", { children: "Thanks, this has been reported to the moderators." }) }) : /* @__PURE__ */ jsxs41(Fragment18, { children: [
6954
- /* @__PURE__ */ jsx47("label", { className: "fk-edit-modal-label", style: { display: "block", marginBottom: 6 }, children: "Why are you reporting this?" }),
6955
- /* @__PURE__ */ jsx47(
7468
+ /* @__PURE__ */ jsx48("div", { className: "fk-drafts-modal-body fk-report-modal-body", children: done ? /* @__PURE__ */ jsx48("div", { className: "fk-drafts-modal-empty", children: /* @__PURE__ */ jsx48("p", { children: "Thanks, this has been reported to the moderators." }) }) : /* @__PURE__ */ jsxs42(Fragment19, { children: [
7469
+ /* @__PURE__ */ jsx48("label", { className: "fk-edit-modal-label", style: { display: "block", marginBottom: 6 }, children: "Why are you reporting this?" }),
7470
+ /* @__PURE__ */ jsx48(
6956
7471
  "textarea",
6957
7472
  {
6958
7473
  className: "fk-edit-modal-textarea",
@@ -6964,19 +7479,19 @@ function ReportModal({ target, onClose, onSubmit }) {
6964
7479
  autoFocus: true
6965
7480
  }
6966
7481
  ),
6967
- /* @__PURE__ */ jsxs41("div", { style: { textAlign: "right", fontSize: 12, color: "var(--muted)", marginTop: 2 }, children: [
7482
+ /* @__PURE__ */ jsxs42("div", { style: { textAlign: "right", fontSize: 12, color: "var(--muted)", marginTop: 2 }, children: [
6968
7483
  reason.length,
6969
7484
  "/",
6970
7485
  MAX_REASON
6971
7486
  ] }),
6972
- error && /* @__PURE__ */ jsx47("div", { className: "fk-edit-modal-save-error", children: error }),
6973
- /* @__PURE__ */ jsx47("div", { style: { marginTop: 12, display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsx47(PillButton, { variant: "accent", disabled: !reason.trim() || submitting, onClick: handleSubmit, children: submitting ? "Submitting\u2026" : "Submit report" }) })
7487
+ error && /* @__PURE__ */ jsx48("div", { className: "fk-edit-modal-save-error", children: error }),
7488
+ /* @__PURE__ */ jsx48("div", { style: { marginTop: 12, display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsx48(PillButton, { variant: "accent", disabled: !reason.trim() || submitting, onClick: handleSubmit, children: submitting ? "Submitting\u2026" : "Submit report" }) })
6974
7489
  ] }) })
6975
7490
  ] });
6976
7491
  }
6977
7492
 
6978
7493
  // src/views/components/shared/notification-settings-modal.tsx
6979
- import { jsx as jsx48, jsxs as jsxs42 } from "react/jsx-runtime";
7494
+ import { jsx as jsx49, jsxs as jsxs43 } from "react/jsx-runtime";
6980
7495
  function NotificationSettingsModal({
6981
7496
  notificationPrefs,
6982
7497
  role,
@@ -6985,19 +7500,19 @@ function NotificationSettingsModal({
6985
7500
  }) {
6986
7501
  const canModerate = role === "admin" || role === "moderator";
6987
7502
  const rows = NOTIFICATION_PREF_ROWS.filter((row) => !row.modOnly || canModerate);
6988
- return /* @__PURE__ */ jsxs42(Modal, { onClose, maxWidth: 560, blurBackground: true, children: [
6989
- /* @__PURE__ */ jsxs42("div", { className: "fk-drafts-modal-header", children: [
6990
- /* @__PURE__ */ jsx48("h3", { className: "fk-drafts-modal-title", children: "Notification settings" }),
6991
- /* @__PURE__ */ jsx48("button", { type: "button", className: "fk-drafts-modal-close", onClick: onClose, children: /* @__PURE__ */ jsx48(CloseIcon, { size: 18 }) })
7503
+ return /* @__PURE__ */ jsxs43(Modal, { onClose, maxWidth: 560, blurBackground: true, children: [
7504
+ /* @__PURE__ */ jsxs43("div", { className: "fk-drafts-modal-header", children: [
7505
+ /* @__PURE__ */ jsx49("h3", { className: "fk-drafts-modal-title", children: "Notification settings" }),
7506
+ /* @__PURE__ */ jsx49("button", { type: "button", className: "fk-drafts-modal-close", onClick: onClose, children: /* @__PURE__ */ jsx49(CloseIcon, { size: 18 }) })
6992
7507
  ] }),
6993
- /* @__PURE__ */ jsx48("div", { className: "fk-drafts-modal-body fk-notification-settings-body", children: rows.map((row) => {
7508
+ /* @__PURE__ */ jsx49("div", { className: "fk-drafts-modal-body fk-notification-settings-body", children: rows.map((row) => {
6994
7509
  const enabled = notificationPrefs[row.key];
6995
- return /* @__PURE__ */ jsxs42("div", { className: "fk-edit-modal-preference-row", children: [
6996
- /* @__PURE__ */ jsxs42("div", { children: [
6997
- /* @__PURE__ */ jsx48("div", { className: "fk-edit-modal-preference-label", children: row.label }),
6998
- /* @__PURE__ */ jsx48("div", { className: "fk-edit-modal-preference-sub", children: row.sub })
7510
+ return /* @__PURE__ */ jsxs43("div", { className: "fk-edit-modal-preference-row", children: [
7511
+ /* @__PURE__ */ jsxs43("div", { children: [
7512
+ /* @__PURE__ */ jsx49("div", { className: "fk-edit-modal-preference-label", children: row.label }),
7513
+ /* @__PURE__ */ jsx49("div", { className: "fk-edit-modal-preference-sub", children: row.sub })
6999
7514
  ] }),
7000
- /* @__PURE__ */ jsx48(
7515
+ /* @__PURE__ */ jsx49(
7001
7516
  "button",
7002
7517
  {
7003
7518
  type: "button",
@@ -7006,7 +7521,7 @@ function NotificationSettingsModal({
7006
7521
  "aria-checked": enabled,
7007
7522
  "aria-label": row.label,
7008
7523
  onClick: () => onToggleNotificationPref(row.key, !enabled),
7009
- children: /* @__PURE__ */ jsx48("span", { className: "fk-edit-modal-switch-knob" })
7524
+ children: /* @__PURE__ */ jsx49("span", { className: "fk-edit-modal-switch-knob" })
7010
7525
  }
7011
7526
  )
7012
7527
  ] }, row.key);
@@ -7015,7 +7530,7 @@ function NotificationSettingsModal({
7015
7530
  }
7016
7531
 
7017
7532
  // src/views/App.tsx
7018
- import { Fragment as Fragment19, jsx as jsx49, jsxs as jsxs43 } from "react/jsx-runtime";
7533
+ import { Fragment as Fragment20, jsx as jsx50, jsxs as jsxs44 } from "react/jsx-runtime";
7019
7534
  function Router() {
7020
7535
  const {
7021
7536
  state,
@@ -7032,15 +7547,16 @@ function Router() {
7032
7547
  closeNotificationSettingsModal
7033
7548
  } = useForum();
7034
7549
  const { profile } = state;
7035
- return /* @__PURE__ */ jsxs43(Fragment19, { children: [
7036
- state.view === "feed" && /* @__PURE__ */ jsx49(Feed, {}),
7037
- state.view === "thread" && /* @__PURE__ */ jsx49(Thread, {}),
7038
- state.view === "profile" && /* @__PURE__ */ jsx49(Profile, {}),
7039
- state.view === "compose" && /* @__PURE__ */ jsx49(Compose, {}),
7040
- state.view === "search" && /* @__PURE__ */ jsx49(SearchResults, {}),
7041
- state.view === "notifications" && /* @__PURE__ */ jsx49(Notifications, {}),
7042
- state.view === "moderation" && /* @__PURE__ */ jsx49(Moderation, {}),
7043
- state.settings.open && /* @__PURE__ */ jsx49(
7550
+ return /* @__PURE__ */ jsxs44(Fragment20, { children: [
7551
+ state.view === "feed" && /* @__PURE__ */ jsx50(Feed, {}),
7552
+ state.view === "thread" && /* @__PURE__ */ jsx50(Thread, {}),
7553
+ state.view === "profile" && /* @__PURE__ */ jsx50(Profile, {}),
7554
+ state.view === "compose" && /* @__PURE__ */ jsx50(Compose, {}),
7555
+ state.view === "search" && /* @__PURE__ */ jsx50(SearchResults, {}),
7556
+ state.view === "notifications" && /* @__PURE__ */ jsx50(Notifications, {}),
7557
+ state.view === "moderation" && /* @__PURE__ */ jsx50(Moderation, {}),
7558
+ state.view === "ask" && /* @__PURE__ */ jsx50(AskResult, {}),
7559
+ state.settings.open && /* @__PURE__ */ jsx50(
7044
7560
  EditProfileModal,
7045
7561
  {
7046
7562
  displayName: profile.displayName,
@@ -7054,7 +7570,7 @@ function Router() {
7054
7570
  onClose: closeSettings
7055
7571
  }
7056
7572
  ),
7057
- state.draftsModal.open && /* @__PURE__ */ jsx49(
7573
+ state.draftsModal.open && /* @__PURE__ */ jsx50(
7058
7574
  DraftsListModal,
7059
7575
  {
7060
7576
  items: state.draftsModal.items,
@@ -7065,9 +7581,9 @@ function Router() {
7065
7581
  onDelete: deleteDraftFromList
7066
7582
  }
7067
7583
  ),
7068
- state.shareModal.open && /* @__PURE__ */ jsx49(ShareModal, { onClose: closeShareModal }),
7069
- state.reportModal.open && state.reportModal.target && /* @__PURE__ */ jsx49(ReportModal, { target: state.reportModal.target, onClose: closeReportModal, onSubmit: submitReport }),
7070
- state.notificationSettingsModal.open && /* @__PURE__ */ jsx49(
7584
+ state.shareModal.open && /* @__PURE__ */ jsx50(ShareModal, { onClose: closeShareModal }),
7585
+ state.reportModal.open && state.reportModal.target && /* @__PURE__ */ jsx50(ReportModal, { target: state.reportModal.target, onClose: closeReportModal, onSubmit: submitReport }),
7586
+ state.notificationSettingsModal.open && /* @__PURE__ */ jsx50(
7071
7587
  NotificationSettingsModal,
7072
7588
  {
7073
7589
  notificationPrefs: profile.notificationPrefs,
@@ -7081,18 +7597,18 @@ function Router() {
7081
7597
  function SessionGate({ children }) {
7082
7598
  const session = useSession();
7083
7599
  if (session.status === "loading") {
7084
- return /* @__PURE__ */ jsx49("div", { style: { position: "fixed", inset: 0 } });
7600
+ return /* @__PURE__ */ jsx50("div", { style: { position: "fixed", inset: 0 } });
7085
7601
  }
7086
7602
  if (session.status === "error") {
7087
- return /* @__PURE__ */ jsxs43("div", { style: { position: "fixed", inset: 0 }, children: [
7603
+ return /* @__PURE__ */ jsxs44("div", { style: { position: "fixed", inset: 0 }, children: [
7088
7604
  "Failed to connect: ",
7089
7605
  session.error
7090
7606
  ] });
7091
7607
  }
7092
- return /* @__PURE__ */ jsx49(Fragment19, { children });
7608
+ return /* @__PURE__ */ jsx50(Fragment20, { children });
7093
7609
  }
7094
7610
  function App({ config }) {
7095
- return /* @__PURE__ */ jsx49(SessionProvider, { config, children: /* @__PURE__ */ jsx49(SessionGate, { children: /* @__PURE__ */ jsx49(ForumProvider, { children: /* @__PURE__ */ jsx49("div", { style: { position: "fixed", inset: 0 }, children: /* @__PURE__ */ jsx49(Router, {}) }) }) }) });
7611
+ return /* @__PURE__ */ jsx50(SessionProvider, { config, children: /* @__PURE__ */ jsx50(SessionGate, { children: /* @__PURE__ */ jsx50(ForumProvider, { children: /* @__PURE__ */ jsx50("div", { style: { position: "fixed", inset: 0 }, children: /* @__PURE__ */ jsx50(Router, {}) }) }) }) });
7096
7612
  }
7097
7613
 
7098
7614
  // src/views/styles/all.css?inline
@@ -7105,6 +7621,21 @@ var ForumKitElement = class extends HTMLElement {
7105
7621
  _shadow;
7106
7622
  _mountPoint;
7107
7623
  _root = null;
7624
+ // A function can't be represented as an HTML attribute, so onLogout is set
7625
+ // as a JS property directly (el.onLogout = fn) rather than observed via
7626
+ // attributeChangedCallback — this is also why plain HTML usage has no way
7627
+ // to provide it, by design (see README's Customization section).
7628
+ _onLogout;
7629
+ get onLogout() {
7630
+ return this._onLogout;
7631
+ }
7632
+ set onLogout(fn) {
7633
+ this._onLogout = fn;
7634
+ if (this._config) {
7635
+ this._config = this._readConfig();
7636
+ this._render();
7637
+ }
7638
+ }
7108
7639
  static get observedAttributes() {
7109
7640
  return ["forum-id", "token", "theme", "api-url", "platform"];
7110
7641
  }
@@ -7148,7 +7679,8 @@ var ForumKitElement = class extends HTMLElement {
7148
7679
  token,
7149
7680
  theme,
7150
7681
  apiUrl: this.getAttribute("api-url") ?? DEFAULT_API_URL,
7151
- platform
7682
+ platform,
7683
+ ...this._onLogout ? { onLogout: this._onLogout } : {}
7152
7684
  };
7153
7685
  }
7154
7686
  /**
@@ -7201,4 +7733,4 @@ if (!customElements.get("forum-kit")) {
7201
7733
  export {
7202
7734
  ForumKitElement
7203
7735
  };
7204
- //# sourceMappingURL=chunk-FASHQ6GM.js.map
7736
+ //# sourceMappingURL=chunk-EJQY26NT.js.map