@burtson-labs/bandit-engine 2.0.51 → 2.0.52

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.
Files changed (36) hide show
  1. package/dist/{chat-W5IFNEUC.mjs → chat-YWYLVKXX.mjs} +5 -5
  2. package/dist/chat-provider.js +225 -8
  3. package/dist/chat-provider.js.map +1 -1
  4. package/dist/chat-provider.mjs +3 -3
  5. package/dist/{chunk-EWUUF4GE.mjs → chunk-37PEP5JK.mjs} +2 -2
  6. package/dist/{chunk-HETIHZ42.mjs → chunk-M3BEAMCC.mjs} +2 -2
  7. package/dist/{chunk-QFSEZAG6.mjs → chunk-MH7WFWCP.mjs} +34 -3
  8. package/dist/chunk-MH7WFWCP.mjs.map +1 -0
  9. package/dist/{chunk-IDH2YOW3.mjs → chunk-QX6CO7TJ.mjs} +196 -9
  10. package/dist/chunk-QX6CO7TJ.mjs.map +1 -0
  11. package/dist/{chunk-LXD3IV6Z.mjs → chunk-RSSJADDD.mjs} +3 -3
  12. package/dist/{chunk-STMXPFAQ.mjs → chunk-TSQCNHOX.mjs} +4 -4
  13. package/dist/{chunk-JBXNXSAH.mjs → chunk-Y5N3NSTU.mjs} +459 -180
  14. package/dist/chunk-Y5N3NSTU.mjs.map +1 -0
  15. package/dist/{chunk-N7RMUOFB.mjs → chunk-YZ2HJFPQ.mjs} +2 -2
  16. package/dist/cli.js +1 -1
  17. package/dist/cli.js.map +1 -1
  18. package/dist/index.js +678 -183
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +8 -8
  21. package/dist/management/management.js +648 -183
  22. package/dist/management/management.js.map +1 -1
  23. package/dist/management/management.mjs +6 -6
  24. package/dist/modals/chat-modal/chat-modal.js +197 -8
  25. package/dist/modals/chat-modal/chat-modal.js.map +1 -1
  26. package/dist/modals/chat-modal/chat-modal.mjs +3 -3
  27. package/package.json +1 -1
  28. package/dist/chunk-IDH2YOW3.mjs.map +0 -1
  29. package/dist/chunk-JBXNXSAH.mjs.map +0 -1
  30. package/dist/chunk-QFSEZAG6.mjs.map +0 -1
  31. /package/dist/{chat-W5IFNEUC.mjs.map → chat-YWYLVKXX.mjs.map} +0 -0
  32. /package/dist/{chunk-EWUUF4GE.mjs.map → chunk-37PEP5JK.mjs.map} +0 -0
  33. /package/dist/{chunk-HETIHZ42.mjs.map → chunk-M3BEAMCC.mjs.map} +0 -0
  34. /package/dist/{chunk-LXD3IV6Z.mjs.map → chunk-RSSJADDD.mjs.map} +0 -0
  35. /package/dist/{chunk-STMXPFAQ.mjs.map → chunk-TSQCNHOX.mjs.map} +0 -0
  36. /package/dist/{chunk-N7RMUOFB.mjs.map → chunk-YZ2HJFPQ.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -210,13 +210,22 @@ var init_debugLogger = __esm({
210
210
  });
211
211
 
212
212
  // src/services/auth/authenticationService.ts
213
- var TOKEN_KEY2, AuthenticationService, authenticationService;
213
+ function emitAuthTokenChanged(token) {
214
+ if (typeof window === "undefined") {
215
+ return;
216
+ }
217
+ window.dispatchEvent(new CustomEvent(AUTH_TOKEN_CHANGED_EVENT, {
218
+ detail: { token }
219
+ }));
220
+ }
221
+ var TOKEN_KEY2, AUTH_TOKEN_CHANGED_EVENT, AuthenticationService, authenticationService;
214
222
  var init_authenticationService = __esm({
215
223
  "src/services/auth/authenticationService.ts"() {
216
224
  "use strict";
217
225
  init_authenticationStore();
218
226
  init_debugLogger();
219
227
  TOKEN_KEY2 = "authToken";
228
+ AUTH_TOKEN_CHANGED_EVENT = "bandit:auth-token-changed";
220
229
  AuthenticationService = class {
221
230
  getToken() {
222
231
  const token = localStorage.getItem(TOKEN_KEY2);
@@ -225,10 +234,12 @@ var init_authenticationService = __esm({
225
234
  setToken(token) {
226
235
  localStorage.setItem(TOKEN_KEY2, token);
227
236
  useAuthenticationStore.getState().setToken(token);
237
+ emitAuthTokenChanged(token);
228
238
  }
229
239
  clearToken() {
230
240
  localStorage.removeItem(TOKEN_KEY2);
231
241
  useAuthenticationStore.getState().clearToken();
242
+ emitAuthTokenChanged(null);
232
243
  }
233
244
  isAuthenticated() {
234
245
  const token = useAuthenticationStore.getState().token;
@@ -2183,9 +2194,99 @@ function ensureDeviceId() {
2183
2194
  return (0, import_uuid3.v4)();
2184
2195
  }
2185
2196
  }
2197
+ function getStoredSyncIdentity() {
2198
+ if (typeof window === "undefined") {
2199
+ return null;
2200
+ }
2201
+ try {
2202
+ return window.localStorage.getItem(SYNC_IDENTITY_STORAGE_KEY);
2203
+ } catch (error) {
2204
+ debugLogger.warn("conversationSyncStore: unable to read stored sync identity", { error });
2205
+ return null;
2206
+ }
2207
+ }
2208
+ function setStoredSyncIdentity(identity) {
2209
+ if (typeof window === "undefined") {
2210
+ return;
2211
+ }
2212
+ try {
2213
+ if (identity) {
2214
+ window.localStorage.setItem(SYNC_IDENTITY_STORAGE_KEY, identity);
2215
+ } else {
2216
+ window.localStorage.removeItem(SYNC_IDENTITY_STORAGE_KEY);
2217
+ }
2218
+ } catch (error) {
2219
+ debugLogger.warn("conversationSyncStore: unable to persist sync identity", { error });
2220
+ }
2221
+ }
2186
2222
  function getPackageDefaultAdvancedKnowledgeSync() {
2187
2223
  return usePackageSettingsStore.getState().settings?.advancedKnowledgeSyncDefaultEnabled;
2188
2224
  }
2225
+ function clearAutoSyncTimer() {
2226
+ if (autoSyncTimeout) {
2227
+ clearTimeout(autoSyncTimeout);
2228
+ autoSyncTimeout = null;
2229
+ }
2230
+ }
2231
+ function resolveAuthIdentity(token) {
2232
+ if (!token) {
2233
+ return null;
2234
+ }
2235
+ const claims = authenticationService.parseJwtClaims(token);
2236
+ if (claims?.sub) {
2237
+ return claims.sub;
2238
+ }
2239
+ if (claims?.email) {
2240
+ return `email:${claims.email.toLowerCase()}`;
2241
+ }
2242
+ return `token:${token.slice(0, 32)}`;
2243
+ }
2244
+ function buildQueueResetState() {
2245
+ return {
2246
+ pendingConversationUpserts: /* @__PURE__ */ new Set(),
2247
+ pendingConversationDeletes: /* @__PURE__ */ new Set(),
2248
+ pendingProjectUpserts: /* @__PURE__ */ new Set(),
2249
+ pendingProjectDeletes: /* @__PURE__ */ new Set(),
2250
+ conflicts: null,
2251
+ lastSyncAt: null,
2252
+ cursor: null,
2253
+ lastError: null,
2254
+ totalConversationsOnServer: void 0,
2255
+ totalProjectsOnServer: void 0,
2256
+ hasCompletedInitialUpload: false,
2257
+ warningConversations: [],
2258
+ oversizedConversations: []
2259
+ };
2260
+ }
2261
+ async function clearLocalStoresForIdentitySwitch(fromIdentity, toIdentity) {
2262
+ const conversationCount = useConversationStore.getState().conversations.length;
2263
+ const projectCount = useProjectStore.getState().projects.length;
2264
+ debugLogger.warn("conversationSyncStore: auth identity changed, clearing local conversation/project cache", {
2265
+ fromIdentity,
2266
+ toIdentity,
2267
+ conversationCount,
2268
+ projectCount
2269
+ });
2270
+ suppressTracking = true;
2271
+ try {
2272
+ await useConversationStore.getState().clearAllConversations();
2273
+ await indexedDBService_default.clear(
2274
+ PROJECT_DB_NAME,
2275
+ PROJECT_DB_VERSION,
2276
+ PROJECT_STORE_NAME,
2277
+ PROJECT_STORE_CONFIGS
2278
+ );
2279
+ useProjectStore.setState({ projects: [] });
2280
+ conversationsMeta = snapshotConversationMetaMap(useConversationStore.getState().conversations);
2281
+ projectsMeta = snapshotProjectMetaMap(useProjectStore.getState().projects);
2282
+ } catch (error) {
2283
+ debugLogger.error("conversationSyncStore: failed to clear local stores on auth switch", {
2284
+ error: error instanceof Error ? error.message : String(error)
2285
+ });
2286
+ } finally {
2287
+ suppressTracking = false;
2288
+ }
2289
+ }
2189
2290
  function mapConversationToDTO(conversation) {
2190
2291
  const updatedAtIso = (conversation.updatedAt ?? /* @__PURE__ */ new Date()).toISOString();
2191
2292
  const createdAtIso = conversation.createdAt ? conversation.createdAt.toISOString() : null;
@@ -2579,7 +2680,7 @@ function buildOversizedMessage(notices) {
2579
2680
  const names = notices.map((n) => `"${n.name || "Untitled"}"`).join(", ");
2580
2681
  return `Some conversations (${names}) are too large for Bandit Cloud. Start a new conversation or archive older turns to continue syncing.`;
2581
2682
  }
2582
- var import_zustand9, import_uuid3, DEVICE_STORAGE_KEY, PAYLOAD_VERSION, MAX_CONVERSATION_BYTES, WARN_CONVERSATION_BYTES, suppressTracking, conversationsMeta, projectsMeta, conversationUnsubscribe, projectUnsubscribe, autoSyncTimeout, AUTO_SYNC_DELAY_MS, useConversationSyncStore;
2683
+ var import_zustand9, import_uuid3, DEVICE_STORAGE_KEY, SYNC_IDENTITY_STORAGE_KEY, PAYLOAD_VERSION, MAX_CONVERSATION_BYTES, WARN_CONVERSATION_BYTES, PROJECT_DB_NAME, PROJECT_DB_VERSION, PROJECT_STORE_NAME, PROJECT_STORE_CONFIGS, suppressTracking, conversationsMeta, projectsMeta, conversationUnsubscribe, projectUnsubscribe, autoSyncTimeout, AUTO_SYNC_DELAY_MS, useConversationSyncStore;
2583
2684
  var init_conversationSyncStore = __esm({
2584
2685
  "src/store/conversationSyncStore.ts"() {
2585
2686
  "use strict";
@@ -2589,13 +2690,19 @@ var init_conversationSyncStore = __esm({
2589
2690
  init_projectStore();
2590
2691
  init_packageSettingsStore();
2591
2692
  init_authenticationService();
2693
+ init_indexedDBService();
2592
2694
  init_conversationSyncEvents();
2593
2695
  init_conversationSyncService();
2594
2696
  init_debugLogger();
2595
2697
  DEVICE_STORAGE_KEY = "banditConversationDeviceId";
2698
+ SYNC_IDENTITY_STORAGE_KEY = "banditConversationSyncIdentity";
2596
2699
  PAYLOAD_VERSION = 1;
2597
2700
  MAX_CONVERSATION_BYTES = 12 * 1024 * 1024;
2598
2701
  WARN_CONVERSATION_BYTES = 10 * 1024 * 1024;
2702
+ PROJECT_DB_NAME = "bandit-projects";
2703
+ PROJECT_DB_VERSION = 1;
2704
+ PROJECT_STORE_NAME = "projects";
2705
+ PROJECT_STORE_CONFIGS = [{ name: PROJECT_STORE_NAME, keyPath: "id" }];
2599
2706
  suppressTracking = false;
2600
2707
  conversationsMeta = /* @__PURE__ */ new Map();
2601
2708
  projectsMeta = /* @__PURE__ */ new Map();
@@ -2631,6 +2738,9 @@ var init_conversationSyncStore = __esm({
2631
2738
  }
2632
2739
  useConversationSyncStore = (0, import_zustand9.create)((set, get) => ({
2633
2740
  initialized: false,
2741
+ hasLoadedPreference: false,
2742
+ initializedForToken: null,
2743
+ initializedForIdentity: null,
2634
2744
  syncEnabled: false,
2635
2745
  status: "disabled",
2636
2746
  lastSyncAt: null,
@@ -2650,20 +2760,63 @@ var init_conversationSyncStore = __esm({
2650
2760
  warningConversations: [],
2651
2761
  oversizedConversations: [],
2652
2762
  async initialize() {
2653
- if (get().initialized) {
2654
- return;
2655
- }
2656
2763
  ensureTrackersInitialized();
2657
2764
  const gatewayUrl = usePackageSettingsStore.getState().settings?.gatewayApiUrl;
2765
+ const token = authenticationService.getToken();
2766
+ const tokenIdentity = resolveAuthIdentity(token);
2767
+ const current = get();
2768
+ const storedIdentity = getStoredSyncIdentity();
2769
+ const knownIdentity = current.initializedForIdentity ?? storedIdentity;
2770
+ if (current.initialized && current.hasLoadedPreference && knownIdentity && tokenIdentity && knownIdentity === tokenIdentity) {
2771
+ return;
2772
+ }
2773
+ const hasIdentitySwitch = Boolean(
2774
+ knownIdentity && tokenIdentity && knownIdentity !== tokenIdentity
2775
+ );
2776
+ if (hasIdentitySwitch) {
2777
+ clearAutoSyncTimer();
2778
+ set({
2779
+ ...buildQueueResetState(),
2780
+ syncEnabled: false,
2781
+ status: "disabled",
2782
+ hasLoadedPreference: false,
2783
+ initializedForToken: null,
2784
+ initializedForIdentity: tokenIdentity
2785
+ });
2786
+ await clearLocalStoresForIdentitySwitch(
2787
+ knownIdentity,
2788
+ tokenIdentity
2789
+ );
2790
+ setStoredSyncIdentity(tokenIdentity);
2791
+ }
2658
2792
  if (!gatewayUrl) {
2659
2793
  debugLogger.info("conversationSyncStore: gateway API URL not configured; sync disabled");
2660
- set({ initialized: true, status: "disabled", syncEnabled: false });
2794
+ if (tokenIdentity) {
2795
+ setStoredSyncIdentity(tokenIdentity);
2796
+ }
2797
+ set({
2798
+ ...buildQueueResetState(),
2799
+ initialized: true,
2800
+ hasLoadedPreference: false,
2801
+ initializedForToken: null,
2802
+ initializedForIdentity: tokenIdentity,
2803
+ status: "disabled",
2804
+ syncEnabled: false
2805
+ });
2661
2806
  return;
2662
2807
  }
2663
- const token = authenticationService.getToken();
2664
2808
  if (!token) {
2665
2809
  debugLogger.info("conversationSyncStore: no authentication token; sync disabled until login");
2666
- set({ initialized: true, status: "disabled", syncEnabled: false });
2810
+ clearAutoSyncTimer();
2811
+ set({
2812
+ ...buildQueueResetState(),
2813
+ initialized: true,
2814
+ hasLoadedPreference: false,
2815
+ initializedForToken: null,
2816
+ initializedForIdentity: null,
2817
+ status: "disabled",
2818
+ syncEnabled: false
2819
+ });
2667
2820
  return;
2668
2821
  }
2669
2822
  try {
@@ -2685,14 +2838,27 @@ var init_conversationSyncStore = __esm({
2685
2838
  isAdvancedVectorFeaturesEnabled: get().isAdvancedVectorFeaturesEnabled
2686
2839
  }
2687
2840
  });
2688
- set({ initialized: true });
2841
+ set({
2842
+ initialized: true,
2843
+ hasLoadedPreference: true,
2844
+ initializedForToken: token,
2845
+ initializedForIdentity: tokenIdentity
2846
+ });
2847
+ setStoredSyncIdentity(tokenIdentity);
2689
2848
  if (preference.syncEnabled) {
2690
2849
  await get().runSync({ force: true });
2691
2850
  }
2692
2851
  } catch (error) {
2693
2852
  const message = error instanceof Error ? error.message : "Failed to load conversation sync preference";
2694
2853
  debugLogger.error("conversationSyncStore: initialization failed", { error: message });
2695
- set({ initialized: true, status: "error", lastError: message });
2854
+ set({
2855
+ initialized: true,
2856
+ hasLoadedPreference: false,
2857
+ initializedForToken: null,
2858
+ initializedForIdentity: tokenIdentity,
2859
+ status: "error",
2860
+ lastError: message
2861
+ });
2696
2862
  }
2697
2863
  },
2698
2864
  async setSyncEnabled(enabled) {
@@ -2720,6 +2886,12 @@ var init_conversationSyncStore = __esm({
2720
2886
  isAdvancedVectorFeaturesEnabled
2721
2887
  }
2722
2888
  });
2889
+ set({
2890
+ hasLoadedPreference: true,
2891
+ initializedForToken: authenticationService.getToken(),
2892
+ initializedForIdentity: resolveAuthIdentity(authenticationService.getToken())
2893
+ });
2894
+ setStoredSyncIdentity(resolveAuthIdentity(authenticationService.getToken()));
2723
2895
  if (enabled) {
2724
2896
  set({ hasCompletedInitialUpload: false });
2725
2897
  }
@@ -2757,6 +2929,12 @@ var init_conversationSyncStore = __esm({
2757
2929
  isAdvancedVectorFeaturesEnabled: enabled
2758
2930
  }
2759
2931
  });
2932
+ set({
2933
+ hasLoadedPreference: true,
2934
+ initializedForToken: authenticationService.getToken(),
2935
+ initializedForIdentity: resolveAuthIdentity(authenticationService.getToken())
2936
+ });
2937
+ setStoredSyncIdentity(resolveAuthIdentity(authenticationService.getToken()));
2760
2938
  if (preference.syncEnabled && preference.isAdvancedVectorFeaturesEnabled) {
2761
2939
  await get().runSync({ force: true });
2762
2940
  }
@@ -2802,6 +2980,15 @@ var init_conversationSyncStore = __esm({
2802
2980
  debugLogger.error("conversationSyncStore: runSync error - missing auth token");
2803
2981
  return;
2804
2982
  }
2983
+ const tokenIdentity = resolveAuthIdentity(token);
2984
+ if (state.initializedForIdentity && tokenIdentity && state.initializedForIdentity !== tokenIdentity) {
2985
+ debugLogger.warn("conversationSyncStore: runSync aborted due auth identity mismatch; reinitializing", {
2986
+ initializedForIdentity: state.initializedForIdentity,
2987
+ tokenIdentity
2988
+ });
2989
+ await get().initialize();
2990
+ return;
2991
+ }
2805
2992
  const pendingConversationIds = Array.from(state.pendingConversationUpserts);
2806
2993
  const pendingConversationDeleteIds = Array.from(state.pendingConversationDeletes);
2807
2994
  const pendingProjectIds = Array.from(state.pendingProjectUpserts);
@@ -29845,6 +30032,36 @@ var ChatProvider = (props) => {
29845
30032
  };
29846
30033
  initializeAsync();
29847
30034
  }, [props.packageSettings, loadDocuments]);
30035
+ (0, import_react6.useEffect)(() => {
30036
+ const isPlaygroundRoute = typeof window !== "undefined" && window.location.pathname.includes("/playground");
30037
+ const isPlaygroundMode3 = isPlaygroundRoute || props.packageSettings.playgroundMode === true;
30038
+ if (isPlaygroundMode3 || !props.packageSettings.gatewayApiUrl) {
30039
+ return;
30040
+ }
30041
+ const initializeSyncState = async () => {
30042
+ try {
30043
+ await useConversationSyncStore.getState().initialize();
30044
+ } catch (error) {
30045
+ debugLogger.error("ChatProvider: deferred sync initialization failed", {
30046
+ error: error instanceof Error ? error.message : String(error)
30047
+ });
30048
+ }
30049
+ };
30050
+ if (typeof window === "undefined") {
30051
+ return;
30052
+ }
30053
+ const handleAuthTokenChange = () => {
30054
+ void initializeSyncState();
30055
+ };
30056
+ window.addEventListener(AUTH_TOKEN_CHANGED_EVENT, handleAuthTokenChange);
30057
+ window.addEventListener("pageshow", handleAuthTokenChange);
30058
+ window.addEventListener("focus", handleAuthTokenChange);
30059
+ return () => {
30060
+ window.removeEventListener(AUTH_TOKEN_CHANGED_EVENT, handleAuthTokenChange);
30061
+ window.removeEventListener("pageshow", handleAuthTokenChange);
30062
+ window.removeEventListener("focus", handleAuthTokenChange);
30063
+ };
30064
+ }, [props.packageSettings.gatewayApiUrl, props.packageSettings.playgroundMode]);
29848
30065
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FeatureFlagProvider, { config: featureFlagConfig, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(NotificationProvider, { children: props.children }) }) });
29849
30066
  };
29850
30067
  var chat_provider_default = ChatProvider;
@@ -33032,6 +33249,7 @@ var PersonalitiesTab = ({
33032
33249
  const [deleteDialogOpen, setDeleteDialogOpen] = (0, import_react44.useState)(false);
33033
33250
  const [personalityToDelete, setPersonalityToDelete] = (0, import_react44.useState)(null);
33034
33251
  const [clickedChips, setClickedChips] = (0, import_react44.useState)(/* @__PURE__ */ new Set());
33252
+ const [showTemplateHelp, setShowTemplateHelp] = (0, import_react44.useState)(false);
33035
33253
  const [cropperOpen, setCropperOpen] = (0, import_react44.useState)(false);
33036
33254
  const [selectedImageFile, setSelectedImageFile] = (0, import_react44.useState)(null);
33037
33255
  const promptTemplates = [
@@ -33285,28 +33503,15 @@ var PersonalitiesTab = ({
33285
33503
  }
33286
33504
  }
33287
33505
  ),
33288
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: {
33289
- height: "100%",
33290
- overflow: "auto",
33291
- p: { xs: 1.5, sm: 2 },
33292
- // Hide scrollbars while keeping scroll functionality
33293
- scrollbarWidth: "none",
33294
- // Firefox
33295
- "&::-webkit-scrollbar": {
33296
- display: "none"
33297
- // Chrome, Safari, Edge
33298
- },
33299
- "-ms-overflow-style": "none"
33300
- // IE and Edge
33301
- }, children: [
33506
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: { p: { xs: 1, sm: 2 } }, children: [
33302
33507
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: {
33303
33508
  display: "flex",
33304
33509
  flexDirection: { xs: "column", md: "row" },
33305
33510
  alignItems: { xs: "flex-start", md: "center" },
33306
33511
  justifyContent: "space-between",
33307
- mb: { xs: 2, md: 3 },
33512
+ mb: { xs: 1.25, md: 3 },
33308
33513
  flexWrap: "wrap",
33309
- gap: { xs: 1.5, md: 2 }
33514
+ gap: { xs: 1, md: 2 }
33310
33515
  }, children: [
33311
33516
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: {
33312
33517
  display: "flex",
@@ -33336,8 +33541,8 @@ var PersonalitiesTab = ({
33336
33541
  backgroundClip: "text",
33337
33542
  WebkitBackgroundClip: "text",
33338
33543
  WebkitTextFillColor: "transparent",
33339
- mb: 0.5,
33340
- fontSize: { xs: "1.55rem", sm: "1.75rem" }
33544
+ mb: { xs: 0.25, sm: 0.5 },
33545
+ fontSize: { xs: "1.35rem", sm: "1.75rem" }
33341
33546
  },
33342
33547
  children: "Quick Start Templates"
33343
33548
  }
@@ -33362,12 +33567,40 @@ var PersonalitiesTab = ({
33362
33567
  color: "white",
33363
33568
  fontWeight: 600,
33364
33569
  animation: "pulse 2s infinite",
33365
- alignSelf: { xs: "flex-start", md: "center" }
33570
+ alignSelf: { xs: "flex-start", md: "center" },
33571
+ display: { xs: "none", md: "inline-flex" }
33366
33572
  }
33367
33573
  }
33368
33574
  )
33369
33575
  ] }),
33370
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
33576
+ isMobile ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
33577
+ import_material36.Box,
33578
+ {
33579
+ sx: {
33580
+ mb: 1.75,
33581
+ borderRadius: 2,
33582
+ border: "1px solid rgba(25, 118, 210, 0.2)",
33583
+ background: "linear-gradient(135deg, rgba(25, 118, 210, 0.05) 0%, rgba(66, 165, 245, 0.05) 100%)",
33584
+ px: 1.25,
33585
+ py: 1
33586
+ },
33587
+ children: [
33588
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1 }, children: [
33589
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material36.Typography, { variant: "body2", sx: { fontWeight: 600, color: "primary.main", fontSize: "0.82rem" }, children: "Tap any template to pre-fill your form" }),
33590
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
33591
+ import_material36.Button,
33592
+ {
33593
+ size: "small",
33594
+ onClick: () => setShowTemplateHelp((prev) => !prev),
33595
+ sx: { minWidth: "auto", px: 1, fontSize: "0.72rem", whiteSpace: "nowrap" },
33596
+ children: showTemplateHelp ? "Hide" : "Details"
33597
+ }
33598
+ )
33599
+ ] }),
33600
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material36.Collapse, { in: showTemplateHelp, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material36.Typography, { variant: "body2", sx: { color: "text.secondary", fontSize: "0.8rem", lineHeight: 1.4, mt: 0.75 }, children: "Choose a setup you like, then tweak name, tone, and prompt details in the Create/Edit tab." }) })
33601
+ ]
33602
+ }
33603
+ ) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
33371
33604
  import_material36.Alert,
33372
33605
  {
33373
33606
  severity: "info",
@@ -33393,17 +33626,19 @@ var PersonalitiesTab = ({
33393
33626
  import_material36.Card,
33394
33627
  {
33395
33628
  sx: {
33396
- mb: { xs: 3, md: 4 },
33629
+ mb: { xs: 2, md: 4 },
33397
33630
  background: "linear-gradient(135deg, #1976d2 0%, #42a5f5 100%)",
33398
33631
  border: "2px solid transparent",
33399
- borderRadius: 3,
33632
+ borderRadius: { xs: 2.25, sm: 3 },
33400
33633
  cursor: "pointer",
33401
33634
  transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
33402
33635
  position: "relative",
33403
33636
  overflow: "hidden",
33404
- "&:hover": {
33405
- transform: "translateY(-4px) scale(1.02)",
33406
- boxShadow: "0 12px 40px rgba(25, 118, 210, 0.3)"
33637
+ ...isMobile ? {} : {
33638
+ "&:hover": {
33639
+ transform: "translateY(-4px) scale(1.02)",
33640
+ boxShadow: "0 12px 40px rgba(25, 118, 210, 0.3)"
33641
+ }
33407
33642
  },
33408
33643
  "&::before": {
33409
33644
  content: '""',
@@ -33428,41 +33663,70 @@ var PersonalitiesTab = ({
33428
33663
  setPersonalityTabIndex(1);
33429
33664
  },
33430
33665
  children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.CardContent, { sx: {
33431
- p: { xs: 3, sm: 4 },
33666
+ p: { xs: 1.75, sm: 4 },
33432
33667
  color: "white",
33433
- textAlign: "center",
33668
+ textAlign: { xs: "left", sm: "center" },
33434
33669
  position: "relative",
33435
- zIndex: 1
33670
+ zIndex: 1,
33671
+ display: "flex",
33672
+ flexDirection: { xs: "row", sm: "column" },
33673
+ alignItems: { xs: "center", sm: "center" },
33674
+ gap: { xs: 1.25, sm: 0 }
33436
33675
  }, children: [
33437
33676
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material36.Box, { sx: {
33438
33677
  display: "flex",
33439
33678
  alignItems: "center",
33440
33679
  justifyContent: "center",
33441
33680
  fontSize: 0,
33442
- mb: { xs: 1.5, sm: 2 }
33443
- }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_AutoAwesome.default, { sx: { fontSize: { xs: 36, sm: 44 }, color: "common.white", filter: "drop-shadow(0 4px 12px rgba(0,0,0,0.25))" } }) }),
33444
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
33445
- import_material36.Typography,
33446
- {
33447
- variant: "h5",
33448
- sx: {
33449
- fontWeight: 700,
33450
- mb: { xs: 0.75, sm: 1 },
33451
- textShadow: "0 2px 4px rgba(0,0,0,0.2)"
33452
- },
33453
- children: "Create from Scratch"
33454
- }
33455
- ),
33456
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
33457
- import_material36.Typography,
33681
+ mb: { xs: 0, sm: 2 },
33682
+ flexShrink: 0
33683
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_AutoAwesome.default, { sx: { fontSize: { xs: 28, sm: 44 }, color: "common.white", filter: "drop-shadow(0 4px 12px rgba(0,0,0,0.25))" } }) }),
33684
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: { flex: 1, minWidth: 0 }, children: [
33685
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
33686
+ import_material36.Typography,
33687
+ {
33688
+ variant: "h5",
33689
+ sx: {
33690
+ fontWeight: 700,
33691
+ mb: { xs: 0.25, sm: 1 },
33692
+ textShadow: "0 2px 4px rgba(0,0,0,0.2)",
33693
+ fontSize: { xs: "1.1rem", sm: "1.75rem" }
33694
+ },
33695
+ children: "Create from Scratch"
33696
+ }
33697
+ ),
33698
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
33699
+ import_material36.Typography,
33700
+ {
33701
+ variant: "body1",
33702
+ sx: {
33703
+ opacity: 0.9,
33704
+ fontWeight: 500,
33705
+ textShadow: "0 1px 2px rgba(0,0,0,0.2)",
33706
+ fontSize: { xs: "0.8rem", sm: "1rem" },
33707
+ lineHeight: { xs: 1.3, sm: 1.5 },
33708
+ display: "-webkit-box",
33709
+ WebkitLineClamp: { xs: 2, sm: "unset" },
33710
+ WebkitBoxOrient: "vertical",
33711
+ overflow: "hidden"
33712
+ },
33713
+ children: "Start with a blank canvas and build your perfect AI personality"
33714
+ }
33715
+ )
33716
+ ] }),
33717
+ isMobile && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
33718
+ import_material36.Chip,
33458
33719
  {
33459
- variant: "body1",
33720
+ label: "Start",
33721
+ size: "small",
33460
33722
  sx: {
33461
- opacity: 0.9,
33462
- fontWeight: 500,
33463
- textShadow: "0 1px 2px rgba(0,0,0,0.2)"
33464
- },
33465
- children: "Start with a blank canvas and build your perfect AI personality"
33723
+ backgroundColor: "rgba(255,255,255,0.2)",
33724
+ color: "common.white",
33725
+ border: "1px solid rgba(255,255,255,0.45)",
33726
+ fontWeight: 600,
33727
+ height: 28,
33728
+ flexShrink: 0
33729
+ }
33466
33730
  }
33467
33731
  )
33468
33732
  ] })
@@ -33477,7 +33741,7 @@ var PersonalitiesTab = ({
33477
33741
  lg: "repeat(4, 1fr)",
33478
33742
  xl: "repeat(4, 1fr)"
33479
33743
  },
33480
- gap: { xs: 2, sm: 2.5, md: 3 },
33744
+ gap: { xs: 1.25, sm: 2.5, md: 3 },
33481
33745
  alignItems: "stretch"
33482
33746
  }, children: promptTemplates.map((template, index) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
33483
33747
  import_material36.Card,
@@ -33490,7 +33754,7 @@ var PersonalitiesTab = ({
33490
33754
  border: "1px solid",
33491
33755
  borderColor: "rgba(255,255,255,0.1)",
33492
33756
  borderRadius: 3,
33493
- minHeight: { xs: "auto", md: "280px" },
33757
+ minHeight: { xs: "200px", md: "280px" },
33494
33758
  display: "flex",
33495
33759
  flexDirection: "column",
33496
33760
  overflow: "hidden",
@@ -33508,19 +33772,21 @@ var PersonalitiesTab = ({
33508
33772
  opacity: 0,
33509
33773
  transition: "opacity 0.3s ease"
33510
33774
  },
33511
- "&:hover": {
33512
- transform: "translateY(-8px) scale(1.02)",
33513
- boxShadow: "0 20px 40px rgba(0,0,0,0.15)",
33514
- borderColor: "primary.main",
33515
- "&::before": {
33516
- opacity: 1
33517
- },
33518
- "& .template-icon": {
33519
- transform: "scale(1.1) rotate(5deg)"
33520
- },
33521
- "& .template-chip": {
33522
- transform: "translateY(-2px)",
33523
- boxShadow: "0 4px 12px rgba(0,0,0,0.2)"
33775
+ ...isMobile ? {} : {
33776
+ "&:hover": {
33777
+ transform: "translateY(-8px) scale(1.02)",
33778
+ boxShadow: "0 20px 40px rgba(0,0,0,0.15)",
33779
+ borderColor: "primary.main",
33780
+ "&::before": {
33781
+ opacity: 1
33782
+ },
33783
+ "& .template-icon": {
33784
+ transform: "scale(1.1) rotate(5deg)"
33785
+ },
33786
+ "& .template-chip": {
33787
+ transform: "translateY(-2px)",
33788
+ boxShadow: "0 4px 12px rgba(0,0,0,0.2)"
33789
+ }
33524
33790
  }
33525
33791
  },
33526
33792
  "&:active": {
@@ -33529,7 +33795,7 @@ var PersonalitiesTab = ({
33529
33795
  },
33530
33796
  onClick: () => handleTemplateSelect(template),
33531
33797
  children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.CardContent, { sx: {
33532
- p: { xs: 2.5, sm: 3 },
33798
+ p: { xs: 2, sm: 3 },
33533
33799
  display: "flex",
33534
33800
  flexDirection: "column",
33535
33801
  height: "100%",
@@ -33539,7 +33805,7 @@ var PersonalitiesTab = ({
33539
33805
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: {
33540
33806
  display: "flex",
33541
33807
  alignItems: "center",
33542
- mb: { xs: 2, md: 2.5 },
33808
+ mb: { xs: 1.25, md: 2.5 },
33543
33809
  minHeight: { xs: "auto", md: "60px" }
33544
33810
  }, children: [
33545
33811
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
@@ -33548,9 +33814,9 @@ var PersonalitiesTab = ({
33548
33814
  src: template.avatar,
33549
33815
  alt: template.name,
33550
33816
  sx: {
33551
- width: { xs: 48, sm: 56, md: 60 },
33552
- height: { xs: 48, sm: 56, md: 60 },
33553
- mr: { xs: 1.5, md: 2 },
33817
+ width: { xs: 40, sm: 56, md: 60 },
33818
+ height: { xs: 40, sm: 56, md: 60 },
33819
+ mr: { xs: 1.2, md: 2 },
33554
33820
  transition: "transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
33555
33821
  boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
33556
33822
  border: "2px solid rgba(255,255,255,0.8)"
@@ -33604,10 +33870,10 @@ var PersonalitiesTab = ({
33604
33870
  lineHeight: 1.5,
33605
33871
  fontSize: { xs: "0.82rem", sm: "0.85rem", md: "0.875rem" },
33606
33872
  display: "-webkit-box",
33607
- WebkitLineClamp: 4,
33873
+ WebkitLineClamp: { xs: 2, sm: 4 },
33608
33874
  WebkitBoxOrient: "vertical",
33609
33875
  overflow: "hidden",
33610
- mb: { xs: 1.5, md: 2 },
33876
+ mb: { xs: 1.25, md: 2 },
33611
33877
  minHeight: { xs: "auto", md: "84px" }
33612
33878
  },
33613
33879
  children: template.description
@@ -33644,7 +33910,7 @@ var PersonalitiesTab = ({
33644
33910
  },
33645
33911
  index
33646
33912
  )) }),
33647
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
33913
+ !isMobile && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
33648
33914
  import_material36.Alert,
33649
33915
  {
33650
33916
  severity: "info",
@@ -33658,20 +33924,7 @@ var PersonalitiesTab = ({
33658
33924
  )
33659
33925
  ] })
33660
33926
  ] });
33661
- const renderCreateEditTab = () => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: {
33662
- height: "100%",
33663
- overflow: "auto",
33664
- p: { xs: 1.5, sm: 2 },
33665
- // Hide scrollbars while keeping scroll functionality
33666
- scrollbarWidth: "none",
33667
- // Firefox
33668
- "&::-webkit-scrollbar": {
33669
- display: "none"
33670
- // Chrome, Safari, Edge
33671
- },
33672
- "-ms-overflow-style": "none"
33673
- // IE and Edge
33674
- }, children: [
33927
+ const renderCreateEditTab = () => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: { p: { xs: 1.5, sm: 2 } }, children: [
33675
33928
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: { mb: { xs: 2.5, md: 4 } }, children: [
33676
33929
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
33677
33930
  import_material36.Typography,
@@ -34141,6 +34394,9 @@ var PersonalitiesTab = ({
34141
34394
  import_material36.Box,
34142
34395
  {
34143
34396
  sx: {
34397
+ position: { xs: "sticky", sm: "static" },
34398
+ bottom: { xs: 10, sm: "auto" },
34399
+ zIndex: { xs: 5, sm: "auto" },
34144
34400
  display: "flex",
34145
34401
  flexDirection: { xs: "column", sm: "row" },
34146
34402
  gap: { xs: 1.5, sm: 2 },
@@ -34148,8 +34404,15 @@ var PersonalitiesTab = ({
34148
34404
  // Changed from flex-end to flex-start
34149
34405
  mr: { xs: 0, sm: 10 },
34150
34406
  // Add right margin to avoid FAB
34151
- mb: { xs: 8, sm: 2 }
34407
+ mb: { xs: 8, sm: 2 },
34152
34408
  // Add bottom margin on mobile for FAB clearance
34409
+ mt: { xs: 1.5, sm: 0 },
34410
+ p: { xs: 1.1, sm: 0 },
34411
+ borderRadius: { xs: 2, sm: 0 },
34412
+ border: { xs: "1px solid", sm: "none" },
34413
+ borderColor: { xs: "divider", sm: "transparent" },
34414
+ bgcolor: { xs: "background.paper", sm: "transparent" },
34415
+ boxShadow: { xs: 3, sm: "none" }
34153
34416
  },
34154
34417
  children: [
34155
34418
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
@@ -34177,20 +34440,7 @@ var PersonalitiesTab = ({
34177
34440
  }
34178
34441
  )
34179
34442
  ] });
34180
- const renderManageTab = () => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: {
34181
- height: "100%",
34182
- overflow: "auto",
34183
- p: { xs: 1.5, sm: 2 },
34184
- // Hide scrollbars while keeping scroll functionality
34185
- scrollbarWidth: "none",
34186
- // Firefox
34187
- "&::-webkit-scrollbar": {
34188
- display: "none"
34189
- // Chrome, Safari, Edge
34190
- },
34191
- "-ms-overflow-style": "none"
34192
- // IE and Edge
34193
- }, children: [
34443
+ const renderManageTab = () => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: { p: { xs: 1.5, sm: 2 } }, children: [
34194
34444
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
34195
34445
  import_material36.Box,
34196
34446
  {
@@ -34439,7 +34689,7 @@ var PersonalitiesTab = ({
34439
34689
  ] })
34440
34690
  ] })
34441
34691
  ] });
34442
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: { height: "100%", display: "flex", flexDirection: "column" }, children: [
34692
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: { display: "flex", flexDirection: "column" }, children: [
34443
34693
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
34444
34694
  import_material36.Box,
34445
34695
  {
@@ -34565,7 +34815,7 @@ var PersonalitiesTab = ({
34565
34815
  ]
34566
34816
  }
34567
34817
  ) }),
34568
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: { flex: 1, overflow: "hidden" }, children: [
34818
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material36.Box, { sx: { minHeight: 0 }, children: [
34569
34819
  personalityTabIndex === 0 && renderTemplatesTab(),
34570
34820
  personalityTabIndex === 1 && renderCreateEditTab(),
34571
34821
  personalityTabIndex === 2 && renderManageTab()
@@ -38394,6 +38644,7 @@ var import_Add2 = __toESM(require("@mui/icons-material/Add"));
38394
38644
  var import_Archive = __toESM(require("@mui/icons-material/Archive"));
38395
38645
  var import_Delete6 = __toESM(require("@mui/icons-material/Delete"));
38396
38646
  var import_Description4 = __toESM(require("@mui/icons-material/Description"));
38647
+ var import_FolderOpen = __toESM(require("@mui/icons-material/FolderOpen"));
38397
38648
  var import_Group2 = __toESM(require("@mui/icons-material/Group"));
38398
38649
  var import_Person3 = __toESM(require("@mui/icons-material/Person"));
38399
38650
  var import_Publish = __toESM(require("@mui/icons-material/Publish"));
@@ -38673,6 +38924,22 @@ var archiveSeedPack = async (sid) => {
38673
38924
  throw error;
38674
38925
  }
38675
38926
  };
38927
+ var deleteSeedPack = async (sid) => {
38928
+ const url = buildUrl2(`/seed-packs/${encodeURIComponent(sid)}`);
38929
+ try {
38930
+ const response = await fetch(url, { method: "DELETE", headers: buildHeaders2() });
38931
+ if (response.status === 204) {
38932
+ return;
38933
+ }
38934
+ await handleJsonResponse2(response, "Failed to delete seed pack");
38935
+ } catch (error) {
38936
+ debugLogger.error("seedPackService: failed to delete seed pack", {
38937
+ sid,
38938
+ error: error instanceof Error ? error.message : String(error)
38939
+ });
38940
+ throw error;
38941
+ }
38942
+ };
38676
38943
 
38677
38944
  // src/management/components/SeedPacksTab.tsx
38678
38945
  var import_jsx_runtime42 = require("react/jsx-runtime");
@@ -38708,10 +38975,23 @@ var getPreviewSnippet = (content) => {
38708
38975
  }
38709
38976
  return trimmed.length > 120 ? `${trimmed.slice(0, 120)}...` : trimmed;
38710
38977
  };
38978
+ var getImportedFileKey = (file) => (file.relativePath ?? file.name).toLowerCase();
38979
+ var isMarkdownFileName = (name) => {
38980
+ const lower = name.toLowerCase();
38981
+ return lower.endsWith(".md") || lower.endsWith(".markdown");
38982
+ };
38983
+ var getWebkitRelativePath = (file) => {
38984
+ const relativePath = file.webkitRelativePath;
38985
+ if (!relativePath) {
38986
+ return void 0;
38987
+ }
38988
+ const trimmed = relativePath.trim().replace(/^\/+/, "");
38989
+ return trimmed.length > 0 ? trimmed : void 0;
38990
+ };
38711
38991
  var mergeMarkdownFiles = (existing, incoming) => {
38712
38992
  const next = [...existing];
38713
38993
  incoming.forEach((file) => {
38714
- const index = next.findIndex((item) => item.name === file.name);
38994
+ const index = next.findIndex((item) => getImportedFileKey(item) === getImportedFileKey(file));
38715
38995
  if (index >= 0) {
38716
38996
  next[index] = file;
38717
38997
  } else {
@@ -38723,17 +39003,22 @@ var mergeMarkdownFiles = (existing, incoming) => {
38723
39003
  var buildMarkdownContent = (files) => {
38724
39004
  return files.map((file) => file.content.trim()).filter((content) => content.length > 0).join("\n\n---\n\n");
38725
39005
  };
38726
- var readMarkdownFiles = async (files) => {
39006
+ var readMarkdownFiles = async (files, source = "local") => {
38727
39007
  const list = Array.from(files);
38728
- const markdownFiles = list.filter((file) => file.name.toLowerCase().endsWith(".md"));
39008
+ const markdownFiles = list.filter((file) => isMarkdownFileName(file.name));
38729
39009
  const imported = await Promise.all(
38730
- markdownFiles.map(async (file) => ({
38731
- id: `${file.name}-${file.lastModified}`,
38732
- name: file.name,
38733
- size: file.size,
38734
- content: await file.text(),
38735
- lastModified: file.lastModified
38736
- }))
39010
+ markdownFiles.map(async (file) => {
39011
+ const relativePath = getWebkitRelativePath(file);
39012
+ return {
39013
+ id: `${source}-${relativePath ?? file.name}-${file.lastModified}-${file.size}`,
39014
+ name: file.name,
39015
+ size: file.size,
39016
+ content: await file.text(),
39017
+ lastModified: file.lastModified,
39018
+ relativePath,
39019
+ source
39020
+ };
39021
+ })
38737
39022
  );
38738
39023
  return { imported, skipped: list.length - markdownFiles.length };
38739
39024
  };
@@ -38849,7 +39134,7 @@ var SeedPackFileCard = ({ file, onPreview, onRemove, isReadOnly }) => /* @__PURE
38849
39134
  )
38850
39135
  }
38851
39136
  ),
38852
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Tooltip, { title: file.name, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
39137
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Tooltip, { title: file.relativePath ?? file.name, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
38853
39138
  import_material42.Typography,
38854
39139
  {
38855
39140
  variant: "body2",
@@ -38866,6 +39151,21 @@ var SeedPackFileCard = ({ file, onPreview, onRemove, isReadOnly }) => /* @__PURE
38866
39151
  children: file.name
38867
39152
  }
38868
39153
  ) }),
39154
+ file.relativePath && file.relativePath !== file.name && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Tooltip, { title: file.relativePath, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
39155
+ import_material42.Typography,
39156
+ {
39157
+ variant: "caption",
39158
+ color: "text.secondary",
39159
+ sx: {
39160
+ display: "block",
39161
+ whiteSpace: "nowrap",
39162
+ overflow: "hidden",
39163
+ textOverflow: "ellipsis",
39164
+ mb: 1
39165
+ },
39166
+ children: file.relativePath
39167
+ }
39168
+ ) }),
38869
39169
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
38870
39170
  import_material42.Box,
38871
39171
  {
@@ -38882,7 +39182,7 @@ var SeedPackFileCard = ({ file, onPreview, onRemove, isReadOnly }) => /* @__PURE
38882
39182
  import_material42.Chip,
38883
39183
  {
38884
39184
  icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Person3.default, { sx: { fontSize: "0.9rem !important" } }),
38885
- label: "Local",
39185
+ label: file.source === "azure-wiki" ? "Azure Wiki" : "Local",
38886
39186
  size: "small",
38887
39187
  sx: {
38888
39188
  bgcolor: "#388e3c20",
@@ -38971,16 +39271,20 @@ var SeedPacksTab = () => {
38971
39271
  const [createImportedFiles, setCreateImportedFiles] = (0, import_react52.useState)([]);
38972
39272
  const [previewFile, setPreviewFile] = (0, import_react52.useState)(null);
38973
39273
  const fileInputRef = (0, import_react52.useRef)(null);
39274
+ const wikiFolderInputRef = (0, import_react52.useRef)(null);
38974
39275
  const createFileInputRef = (0, import_react52.useRef)(null);
39276
+ const createWikiFolderInputRef = (0, import_react52.useRef)(null);
38975
39277
  const [isLoadingList, setIsLoadingList] = (0, import_react52.useState)(false);
38976
39278
  const [isLoadingDetail, setIsLoadingDetail] = (0, import_react52.useState)(false);
38977
39279
  const [isSaving, setIsSaving] = (0, import_react52.useState)(false);
38978
39280
  const [isPublishing, setIsPublishing] = (0, import_react52.useState)(false);
38979
39281
  const [isArchiving, setIsArchiving] = (0, import_react52.useState)(false);
39282
+ const [isDeleting, setIsDeleting] = (0, import_react52.useState)(false);
38980
39283
  const [isCreating, setIsCreating] = (0, import_react52.useState)(false);
38981
39284
  const [createDialogOpen, setCreateDialogOpen] = (0, import_react52.useState)(false);
38982
39285
  const [publishDialogOpen, setPublishDialogOpen] = (0, import_react52.useState)(false);
38983
39286
  const [archiveDialogOpen, setArchiveDialogOpen] = (0, import_react52.useState)(false);
39287
+ const [deleteDialogOpen, setDeleteDialogOpen] = (0, import_react52.useState)(false);
38984
39288
  const [newPackName, setNewPackName] = (0, import_react52.useState)("");
38985
39289
  const [newPackDescription, setNewPackDescription] = (0, import_react52.useState)("");
38986
39290
  const [newPackTags, setNewPackTags] = (0, import_react52.useState)("");
@@ -39085,26 +39389,37 @@ var SeedPacksTab = () => {
39085
39389
  void loadSeedPackDetail(selectedSid);
39086
39390
  }
39087
39391
  }, [selectedSid, loadSeedPackDetail]);
39392
+ (0, import_react52.useEffect)(() => {
39393
+ const setDirectoryUploadAttributes = (input) => {
39394
+ if (!input) {
39395
+ return;
39396
+ }
39397
+ input.setAttribute("webkitdirectory", "");
39398
+ input.setAttribute("directory", "");
39399
+ };
39400
+ setDirectoryUploadAttributes(wikiFolderInputRef.current);
39401
+ setDirectoryUploadAttributes(createWikiFolderInputRef.current);
39402
+ }, [selectedSeedPack, createDialogOpen]);
39088
39403
  const handleSelectPack = (pack) => {
39089
39404
  setSelectedSid(pack.sid);
39090
39405
  setSelectedSeedPack(pack);
39091
39406
  hydrateDraft(pack);
39092
39407
  };
39093
39408
  const handleImportFiles = (0, import_react52.useCallback)(
39094
- async (files) => {
39409
+ async (files, source = "local") => {
39095
39410
  if (!files || files.length === 0) {
39096
39411
  return;
39097
39412
  }
39098
- const { imported, skipped } = await readMarkdownFiles(files);
39413
+ const { imported, skipped } = await readMarkdownFiles(files, source);
39099
39414
  if (skipped > 0) {
39100
- showSnackbar("Only .md files are supported for seed packs.", "error");
39415
+ showSnackbar("Only .md and .markdown files are supported for seed packs.", "error");
39101
39416
  }
39102
39417
  if (imported.length === 0) {
39103
39418
  return;
39104
39419
  }
39105
39420
  try {
39106
39421
  const newlyAdded = imported.filter(
39107
- (file) => !importedFiles.some((existing) => existing.name === file.name)
39422
+ (file) => !importedFiles.some((existing) => getImportedFileKey(existing) === getImportedFileKey(file))
39108
39423
  );
39109
39424
  setImportedFiles((prev) => mergeMarkdownFiles(prev, imported));
39110
39425
  const combined = buildMarkdownContent(newlyAdded);
@@ -39119,8 +39434,9 @@ ${combined}` : combined;
39119
39434
  return { ...prev, content: nextContent };
39120
39435
  });
39121
39436
  }
39437
+ const importLabel = source === "azure-wiki" ? "from Azure DevOps wiki folder into the editor" : "into the editor";
39122
39438
  showSnackbar(
39123
- `Imported ${imported.length} markdown file${imported.length === 1 ? "" : "s"} into the editor.`,
39439
+ `Imported ${imported.length} markdown file${imported.length === 1 ? "" : "s"} ${importLabel}.`,
39124
39440
  "success"
39125
39441
  );
39126
39442
  } catch (error) {
@@ -39134,7 +39450,14 @@ ${combined}` : combined;
39134
39450
  );
39135
39451
  const handleFileInputChange = (0, import_react52.useCallback)(
39136
39452
  async (event) => {
39137
- await handleImportFiles(event.target.files);
39453
+ await handleImportFiles(event.target.files, "local");
39454
+ event.target.value = "";
39455
+ },
39456
+ [handleImportFiles]
39457
+ );
39458
+ const handleWikiFolderInputChange = (0, import_react52.useCallback)(
39459
+ async (event) => {
39460
+ await handleImportFiles(event.target.files, "azure-wiki");
39138
39461
  event.target.value = "";
39139
39462
  },
39140
39463
  [handleImportFiles]
@@ -39143,20 +39466,21 @@ ${combined}` : combined;
39143
39466
  setImportedFiles((prev) => prev.filter((file) => file.id !== id));
39144
39467
  }, []);
39145
39468
  const handleCreateImportFiles = (0, import_react52.useCallback)(
39146
- async (files) => {
39469
+ async (files, source = "local") => {
39147
39470
  if (!files || files.length === 0) {
39148
39471
  return;
39149
39472
  }
39150
- const { imported, skipped } = await readMarkdownFiles(files);
39473
+ const { imported, skipped } = await readMarkdownFiles(files, source);
39151
39474
  if (skipped > 0) {
39152
- showSnackbar("Only .md files are supported for seed packs.", "error");
39475
+ showSnackbar("Only .md and .markdown files are supported for seed packs.", "error");
39153
39476
  }
39154
39477
  if (imported.length === 0) {
39155
39478
  return;
39156
39479
  }
39157
39480
  setCreateImportedFiles((prev) => mergeMarkdownFiles(prev, imported));
39481
+ const importLabel = source === "azure-wiki" ? "from Azure DevOps wiki folder for this seed pack" : "for this seed pack";
39158
39482
  showSnackbar(
39159
- `Imported ${imported.length} markdown file${imported.length === 1 ? "" : "s"} for this seed pack.`,
39483
+ `Imported ${imported.length} markdown file${imported.length === 1 ? "" : "s"} ${importLabel}.`,
39160
39484
  "success"
39161
39485
  );
39162
39486
  },
@@ -39164,7 +39488,14 @@ ${combined}` : combined;
39164
39488
  );
39165
39489
  const handleCreateFileInputChange = (0, import_react52.useCallback)(
39166
39490
  async (event) => {
39167
- await handleCreateImportFiles(event.target.files);
39491
+ await handleCreateImportFiles(event.target.files, "local");
39492
+ event.target.value = "";
39493
+ },
39494
+ [handleCreateImportFiles]
39495
+ );
39496
+ const handleCreateWikiFolderInputChange = (0, import_react52.useCallback)(
39497
+ async (event) => {
39498
+ await handleCreateImportFiles(event.target.files, "azure-wiki");
39168
39499
  event.target.value = "";
39169
39500
  },
39170
39501
  [handleCreateImportFiles]
@@ -39309,6 +39640,34 @@ ${combined}` : combined;
39309
39640
  setIsArchiving(false);
39310
39641
  }
39311
39642
  };
39643
+ const handleDelete = async () => {
39644
+ if (!selectedSeedPack) {
39645
+ return;
39646
+ }
39647
+ const deletingSid = selectedSeedPack.sid;
39648
+ const deletingName = selectedSeedPack.name;
39649
+ setDeleteDialogOpen(false);
39650
+ setIsDeleting(true);
39651
+ try {
39652
+ await deleteSeedPack(deletingSid);
39653
+ setSelectedSid(null);
39654
+ setSelectedSeedPack(null);
39655
+ setDraft({ name: "", description: "", content: "" });
39656
+ setTagsInput("");
39657
+ setImportedFiles([]);
39658
+ setPreviewFile(null);
39659
+ await refreshSeedPacks();
39660
+ showSnackbar(`Deleted seed pack "${deletingName}".`, "success");
39661
+ } catch (error) {
39662
+ showSnackbar("Failed to delete seed pack.", "error");
39663
+ debugLogger.error("SeedPacksTab: failed to delete seed pack", {
39664
+ sid: deletingSid,
39665
+ error: error instanceof Error ? error.message : String(error)
39666
+ });
39667
+ } finally {
39668
+ setIsDeleting(false);
39669
+ }
39670
+ };
39312
39671
  const previewContent = draft.content.trim().length > 0 ? draft.content : "Preview will appear here as you type.";
39313
39672
  const selectedStatus = selectedSeedPack?.status ?? "draft";
39314
39673
  const statusChip = getStatusChip(selectedStatus);
@@ -39510,32 +39869,56 @@ ${combined}` : combined;
39510
39869
  sx: { mb: 1 },
39511
39870
  children: [
39512
39871
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "subtitle2", children: "Markdown content" }),
39872
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: { xs: "column", sm: "row" }, spacing: 1, children: [
39873
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
39874
+ import_material42.Button,
39875
+ {
39876
+ size: "small",
39877
+ variant: "outlined",
39878
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_UploadFile2.default, {}),
39879
+ onClick: () => fileInputRef.current?.click(),
39880
+ disabled: isReadOnly,
39881
+ children: "Import .md"
39882
+ }
39883
+ ),
39884
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
39885
+ import_material42.Button,
39886
+ {
39887
+ size: "small",
39888
+ variant: "outlined",
39889
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_FolderOpen.default, {}),
39890
+ onClick: () => wikiFolderInputRef.current?.click(),
39891
+ disabled: isReadOnly,
39892
+ children: "Import wiki folder"
39893
+ }
39894
+ )
39895
+ ] }),
39513
39896
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
39514
- import_material42.Button,
39897
+ "input",
39515
39898
  {
39516
- size: "small",
39517
- variant: "outlined",
39518
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_UploadFile2.default, {}),
39519
- onClick: () => fileInputRef.current?.click(),
39520
- disabled: isReadOnly,
39521
- children: "Import .md"
39899
+ ref: fileInputRef,
39900
+ type: "file",
39901
+ accept: ".md,.markdown,text/markdown",
39902
+ multiple: true,
39903
+ onChange: handleFileInputChange,
39904
+ style: { display: "none" }
39522
39905
  }
39523
39906
  ),
39524
39907
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
39525
39908
  "input",
39526
39909
  {
39527
- ref: fileInputRef,
39910
+ ref: wikiFolderInputRef,
39528
39911
  type: "file",
39529
- accept: ".md",
39912
+ accept: ".md,.markdown,text/markdown",
39530
39913
  multiple: true,
39531
- onChange: handleFileInputChange,
39914
+ onChange: handleWikiFolderInputChange,
39532
39915
  style: { display: "none" }
39533
39916
  }
39534
39917
  )
39535
39918
  ]
39536
39919
  }
39537
39920
  ),
39538
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "caption", color: "text.secondary", sx: { mb: 1, display: "block" }, children: "Paste or import markdown files. Imports copy content into the editor." }),
39921
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "caption", color: "text.secondary", sx: { mb: 1, display: "block" }, children: "Paste or import markdown files. Use folder import for Azure DevOps wiki clones." }),
39539
39922
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
39540
39923
  import_material42.TextField,
39541
39924
  {
@@ -39634,6 +40017,17 @@ ${combined}` : combined;
39634
40017
  disabled: isReadOnly || isArchiving,
39635
40018
  children: isArchiving ? "Archiving..." : "Archive"
39636
40019
  }
40020
+ ),
40021
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
40022
+ import_material42.Button,
40023
+ {
40024
+ variant: "text",
40025
+ color: "error",
40026
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Delete6.default, {}),
40027
+ onClick: () => setDeleteDialogOpen(true),
40028
+ disabled: isDeleting,
40029
+ children: isDeleting ? "Deleting..." : "Delete"
40030
+ }
39637
40031
  )
39638
40032
  ] })
39639
40033
  ] })
@@ -39683,26 +40077,50 @@ ${combined}` : combined;
39683
40077
  ),
39684
40078
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Divider, {}),
39685
40079
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: { xs: "column", sm: "row" }, spacing: 1, alignItems: "center", children: [
40080
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: { xs: "column", sm: "row" }, spacing: 1, children: [
40081
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
40082
+ import_material42.Button,
40083
+ {
40084
+ size: "small",
40085
+ variant: "outlined",
40086
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_UploadFile2.default, {}),
40087
+ onClick: () => createFileInputRef.current?.click(),
40088
+ disabled: !canManage,
40089
+ children: "Import .md files"
40090
+ }
40091
+ ),
40092
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
40093
+ import_material42.Button,
40094
+ {
40095
+ size: "small",
40096
+ variant: "outlined",
40097
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_FolderOpen.default, {}),
40098
+ onClick: () => createWikiFolderInputRef.current?.click(),
40099
+ disabled: !canManage,
40100
+ children: "Import wiki folder"
40101
+ }
40102
+ )
40103
+ ] }),
40104
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "caption", color: "text.secondary", children: "Optional. Local files or cloned Azure DevOps wiki folders are merged into draft content." }),
39686
40105
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
39687
- import_material42.Button,
40106
+ "input",
39688
40107
  {
39689
- size: "small",
39690
- variant: "outlined",
39691
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_UploadFile2.default, {}),
39692
- onClick: () => createFileInputRef.current?.click(),
39693
- disabled: !canManage,
39694
- children: "Import .md files"
40108
+ ref: createFileInputRef,
40109
+ type: "file",
40110
+ accept: ".md,.markdown,text/markdown",
40111
+ multiple: true,
40112
+ onChange: handleCreateFileInputChange,
40113
+ style: { display: "none" }
39695
40114
  }
39696
40115
  ),
39697
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "caption", color: "text.secondary", children: "Optional. Files are merged into the draft content." }),
39698
40116
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
39699
40117
  "input",
39700
40118
  {
39701
- ref: createFileInputRef,
40119
+ ref: createWikiFolderInputRef,
39702
40120
  type: "file",
39703
- accept: ".md",
40121
+ accept: ".md,.markdown,text/markdown",
39704
40122
  multiple: true,
39705
- onChange: handleCreateFileInputChange,
40123
+ onChange: handleCreateWikiFolderInputChange,
39706
40124
  style: { display: "none" }
39707
40125
  }
39708
40126
  )
@@ -39767,6 +40185,21 @@ ${combined}` : combined;
39767
40185
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { variant: "contained", color: "error", onClick: handleArchive, disabled: isArchiving, children: isArchiving ? "Archiving..." : "Archive" })
39768
40186
  ] })
39769
40187
  ] }),
40188
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Dialog, { open: deleteDialogOpen, onClose: () => setDeleteDialogOpen(false), maxWidth: "sm", fullWidth: true, children: [
40189
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogTitle, { children: "Delete seed pack" }),
40190
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogContent, { children: [
40191
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogContentText, { children: [
40192
+ 'Delete "',
40193
+ selectedSeedPack?.name ?? "this seed pack",
40194
+ '" permanently from this scope. Published versions and draft content will no longer be available.'
40195
+ ] }),
40196
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Alert, { severity: "warning", sx: { mt: 2 }, children: "This action cannot be undone." })
40197
+ ] }),
40198
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogActions, { children: [
40199
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
40200
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { variant: "contained", color: "error", onClick: handleDelete, disabled: isDeleting, children: isDeleting ? "Deleting..." : "Delete" })
40201
+ ] })
40202
+ ] }),
39770
40203
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
39771
40204
  import_material42.Dialog,
39772
40205
  {
@@ -40525,15 +40958,7 @@ var StorageTab = ({ currentTheme }) => {
40525
40958
  ] }) })
40526
40959
  ] }),
40527
40960
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "h6", gutterBottom: true, sx: { mb: 2, fontWeight: 600, color: "text.primary" }, children: "Storage Categories" }),
40528
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: {
40529
- maxHeight: "60vh",
40530
- overflow: "auto",
40531
- "&::-webkit-scrollbar": {
40532
- display: "none"
40533
- },
40534
- msOverflowStyle: "none",
40535
- scrollbarWidth: "none"
40536
- }, children: storageCategories.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Alert, { severity: "info", sx: { mt: 2 }, children: [
40961
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { children: storageCategories.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Alert, { severity: "info", sx: { mt: 2 }, children: [
40537
40962
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body2", children: "No storage data found. This could mean:" }),
40538
40963
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "body2", component: "ul", sx: { mt: 1, pl: 2 }, children: [
40539
40964
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { children: "All databases are empty" }),
@@ -41775,7 +42200,7 @@ var Management = () => {
41775
42200
  const [modalOpen, setModalOpen] = (0, import_react57.useState)(false);
41776
42201
  const banditHead6 = "https://cdn.burtson.ai/images/bandit-head.png";
41777
42202
  const [fabLogo, setFabLogo] = (0, import_react57.useState)(banditHead6);
41778
- const [tabIndex, setTabIndex] = (0, import_react57.useState)(0);
42203
+ const [tabIndex, setTabIndex] = (0, import_react57.useState)(4);
41779
42204
  const [logoFile, setLogoFile] = (0, import_react57.useState)(null);
41780
42205
  const [logoBase64, setLogoBase64] = (0, import_react57.useState)(null);
41781
42206
  const [brandingText, setBrandingText] = (0, import_react57.useState)("");
@@ -42488,7 +42913,6 @@ var Management = () => {
42488
42913
  }
42489
42914
  });
42490
42915
  }, [theme]);
42491
- if (!brandingLoaded) return null;
42492
42916
  const allNavTabs = [
42493
42917
  {
42494
42918
  label: "Personalities",
@@ -42545,6 +42969,18 @@ var Management = () => {
42545
42969
  }
42546
42970
  return true;
42547
42971
  });
42972
+ const preferredDefaultTabIndex = navTabs.findIndex((tab) => tab.label === "Preferences");
42973
+ const defaultTabIndex = preferredDefaultTabIndex >= 0 ? preferredDefaultTabIndex : 0;
42974
+ (0, import_react57.useEffect)(() => {
42975
+ setTabIndex((current) => {
42976
+ if (current < 0 || current >= navTabs.length) {
42977
+ return defaultTabIndex;
42978
+ }
42979
+ return current;
42980
+ });
42981
+ }, [navTabs.length, defaultTabIndex]);
42982
+ const mobileQuickTabs = navTabs.slice(0, 5);
42983
+ const hasMobileOverflowTabs = navTabs.length > mobileQuickTabs.length;
42548
42984
  const navigationContent = /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
42549
42985
  import_material47.Box,
42550
42986
  {
@@ -42701,6 +43137,7 @@ var Management = () => {
42701
43137
  ]
42702
43138
  }
42703
43139
  );
43140
+ if (!brandingLoaded) return null;
42704
43141
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_material47.ThemeProvider, { theme: currentTheme, children: [
42705
43142
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.CssBaseline, {}),
42706
43143
  /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
@@ -42721,7 +43158,7 @@ var Management = () => {
42721
43158
  {
42722
43159
  sx: {
42723
43160
  width: "100%",
42724
- height: 64,
43161
+ minHeight: 64,
42725
43162
  display: "flex",
42726
43163
  alignItems: "center",
42727
43164
  justifyContent: "space-between",
@@ -42804,6 +43241,73 @@ var Management = () => {
42804
43241
  ]
42805
43242
  }
42806
43243
  ),
43244
+ isMobile && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
43245
+ import_material47.Box,
43246
+ {
43247
+ sx: {
43248
+ width: "100%",
43249
+ display: "flex",
43250
+ gap: 1,
43251
+ px: 1.5,
43252
+ py: 1,
43253
+ overflowX: "auto",
43254
+ borderBottom: (theme2) => `1px solid ${theme2.palette.divider}`,
43255
+ bgcolor: (theme2) => theme2.palette.mode === "dark" ? "rgba(24,28,40,0.95)" : "rgba(255,255,255,0.95)",
43256
+ backdropFilter: "blur(12px)"
43257
+ },
43258
+ children: [
43259
+ mobileQuickTabs.map((tab) => {
43260
+ const quickTabIndex = navTabs.findIndex((navTab) => navTab.label === tab.label);
43261
+ const selected = tabIndex === quickTabIndex;
43262
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
43263
+ import_material47.Button,
43264
+ {
43265
+ size: "small",
43266
+ onClick: () => setTabIndex(quickTabIndex),
43267
+ sx: {
43268
+ flexShrink: 0,
43269
+ textTransform: "none",
43270
+ borderRadius: 999,
43271
+ px: 1.5,
43272
+ py: 0.6,
43273
+ minHeight: 32,
43274
+ fontSize: "0.78rem",
43275
+ fontWeight: selected ? 700 : 600,
43276
+ bgcolor: selected ? (theme2) => theme2.palette.mode === "dark" ? "rgba(25,118,210,0.2)" : "rgba(25,118,210,0.12)" : "transparent",
43277
+ color: selected ? "primary.main" : "text.secondary",
43278
+ border: (theme2) => selected ? `1px solid ${theme2.palette.primary.main}66` : `1px solid ${(0, import_styles31.alpha)(theme2.palette.divider, 0.45)}`,
43279
+ "&:hover": {
43280
+ bgcolor: (theme2) => theme2.palette.mode === "dark" ? "rgba(25,118,210,0.16)" : "rgba(25,118,210,0.1)"
43281
+ }
43282
+ },
43283
+ children: tab.label
43284
+ },
43285
+ tab.label
43286
+ );
43287
+ }),
43288
+ hasMobileOverflowTabs && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
43289
+ import_material47.Button,
43290
+ {
43291
+ size: "small",
43292
+ onClick: () => setSidebarOpen(true),
43293
+ sx: {
43294
+ flexShrink: 0,
43295
+ textTransform: "none",
43296
+ borderRadius: 999,
43297
+ px: 1.5,
43298
+ py: 0.6,
43299
+ minHeight: 32,
43300
+ fontSize: "0.78rem",
43301
+ fontWeight: 600,
43302
+ color: "text.secondary",
43303
+ border: (theme2) => `1px dashed ${(0, import_styles31.alpha)(theme2.palette.divider, 0.6)}`
43304
+ },
43305
+ children: "More"
43306
+ }
43307
+ )
43308
+ ]
43309
+ }
43310
+ ),
42807
43311
  isMobile ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
42808
43312
  import_material47.SwipeableDrawer,
42809
43313
  {
@@ -42856,26 +43360,17 @@ var Management = () => {
42856
43360
  flex: 1,
42857
43361
  p: { xs: 1, sm: 3, md: 4 },
42858
43362
  overflowY: "auto",
42859
- height: isMobile ? "auto" : "100vh",
43363
+ overflowX: "hidden",
42860
43364
  maxWidth: "100vw",
42861
43365
  minWidth: 0,
43366
+ minHeight: 0,
42862
43367
  display: "flex",
42863
43368
  flexDirection: "column",
42864
43369
  bgcolor: "background.default",
42865
43370
  ml: isMobile ? 0 : "280px",
42866
43371
  // Fixed left margin only on desktop
42867
43372
  mt: 0,
42868
- transition: "margin-left 0.2s",
42869
- overflow: "auto",
42870
- // Hide scrollbars while keeping scroll functionality
42871
- scrollbarWidth: "none",
42872
- // Firefox
42873
- "&::-webkit-scrollbar": {
42874
- display: "none"
42875
- // Chrome, Safari, Edge
42876
- },
42877
- "-ms-overflow-style": "none"
42878
- // IE and Edge
43373
+ transition: "margin-left 0.2s"
42879
43374
  },
42880
43375
  children: [
42881
43376
  navTabs[tabIndex]?.label === "Personalities" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(