// src/stores/gitStore.ts
import { create as create8 } from "zustand";

// src/stores/sessionFilesStore.ts
import { create as create7 } from "zustand";

// src/stores/researchStore.ts
import { create as create6 } from "zustand";

// src/stores/settingsStore.ts
import { create as create5 } from "zustand";

// src/stores/tunnelStore.ts
import { create as create4 } from "zustand";

// src/stores/fileBrowserStore.ts
import { create as create3 } from "zustand";

// src/stores/mcpStore.ts
import { create as create2 } from "zustand";

// src/stores/skillsStore.ts
import { create } from "zustand";
var useSkillsStore = create((set) => ({
  isExpanded: false,
  skills: [],
  globalEnabled: true,
  totalCount: 0,
  enabledCount: 0,
  selectedSkill: null,
  isViewerOpen: false,
  viewingFile: null,
  toggleSidebar: () => {
    set((state) => {
      const newExpanded = !state.isExpanded;
      if (newExpanded) {
        useGitStore.getState().collapseSidebar();
        useSessionFilesStore.getState().collapseSidebar();
        useResearchStore.getState().collapseSidebar();
        useSettingsStore.getState().collapseSidebar();
        useTunnelStore.getState().collapseSidebar();
        useFileBrowserStore.getState().collapseSidebar();
        useMCPStore.getState().collapseSidebar();
      }
      return { isExpanded: newExpanded };
    });
  },
  expandSidebar: () => {
    useGitStore.getState().collapseSidebar();
    useSessionFilesStore.getState().collapseSidebar();
    useResearchStore.getState().collapseSidebar();
    useSettingsStore.getState().collapseSidebar();
    useTunnelStore.getState().collapseSidebar();
    useFileBrowserStore.getState().collapseSidebar();
    useMCPStore.getState().collapseSidebar();
    set({ isExpanded: true });
  },
  collapseSidebar: () => set({ isExpanded: false }),
  setSkills: (skills) => set({ skills }),
  setSkillsConfig: ({ skills, globalEnabled, totalCount, enabledCount }) => set({ skills, globalEnabled, totalCount, enabledCount }),
  selectSkill: (name) => set({ selectedSkill: name, isViewerOpen: false, viewingFile: null }),
  openViewer: (file) => set({ isViewerOpen: true, viewingFile: file }),
  closeViewer: () => set({ isViewerOpen: false, viewingFile: null })
}));

// src/stores/mcpStore.ts
var useMCPStore = create2((set) => ({
  isExpanded: false,
  servers: [],
  loading: new Set,
  authUrls: new Map,
  copilotDevice: null,
  toggleSidebar: () => {
    set((state) => {
      const newExpanded = !state.isExpanded;
      if (newExpanded) {
        useGitStore.getState().collapseSidebar();
        useSessionFilesStore.getState().collapseSidebar();
        useResearchStore.getState().collapseSidebar();
        useSettingsStore.getState().collapseSidebar();
        useTunnelStore.getState().collapseSidebar();
        useFileBrowserStore.getState().collapseSidebar();
        useSkillsStore.getState().collapseSidebar();
      }
      return { isExpanded: newExpanded };
    });
  },
  expandSidebar: () => {
    useGitStore.getState().collapseSidebar();
    useSessionFilesStore.getState().collapseSidebar();
    useResearchStore.getState().collapseSidebar();
    useSettingsStore.getState().collapseSidebar();
    useTunnelStore.getState().collapseSidebar();
    useFileBrowserStore.getState().collapseSidebar();
    useSkillsStore.getState().collapseSidebar();
    set({ isExpanded: true });
  },
  collapseSidebar: () => set({ isExpanded: false }),
  setServers: (servers) => set({ servers }),
  setLoading: (name, loading) => set((state) => {
    const next = new Set(state.loading);
    if (loading)
      next.add(name);
    else
      next.delete(name);
    return { loading: next };
  }),
  updateServer: (name, updates) => set((state) => ({
    servers: state.servers.map((s) => s.name === name ? { ...s, ...updates } : s)
  })),
  setAuthUrl: (name, url) => set((state) => {
    const next = new Map(state.authUrls);
    if (url)
      next.set(name, url);
    else
      next.delete(name);
    return { authUrls: next };
  }),
  setCopilotDevice: (info) => set({ copilotDevice: info })
}));

// src/stores/fileBrowserStore.ts
var useFileBrowserStore = create3((set) => ({
  isExpanded: false,
  selectedFile: null,
  isViewerOpen: false,
  expandedDirs: new Set,
  toggleSidebar: () => {
    set((state) => {
      const newExpanded = !state.isExpanded;
      if (newExpanded) {
        useGitStore.getState().collapseSidebar();
        useSessionFilesStore.getState().collapseSidebar();
        useResearchStore.getState().collapseSidebar();
        useSettingsStore.getState().collapseSidebar();
        useTunnelStore.getState().collapseSidebar();
        useMCPStore.getState().collapseSidebar();
        useSkillsStore.getState().collapseSidebar();
      }
      return { isExpanded: newExpanded };
    });
  },
  expandSidebar: () => {
    useGitStore.getState().collapseSidebar();
    useSessionFilesStore.getState().collapseSidebar();
    useResearchStore.getState().collapseSidebar();
    useSettingsStore.getState().collapseSidebar();
    useTunnelStore.getState().collapseSidebar();
    useMCPStore.getState().collapseSidebar();
    useSkillsStore.getState().collapseSidebar();
    set({ isExpanded: true });
  },
  collapseSidebar: () => set({
    isExpanded: false,
    isViewerOpen: false,
    selectedFile: null
  }),
  openFile: (path) => set({
    selectedFile: path,
    isViewerOpen: true
  }),
  closeViewer: () => set({
    isViewerOpen: false,
    selectedFile: null
  }),
  toggleDir: (path) => set((state) => {
    const next = new Set(state.expandedDirs);
    if (next.has(path)) {
      next.delete(path);
    } else {
      next.add(path);
    }
    return { expandedDirs: next };
  })
}));

// src/stores/tunnelStore.ts
var useTunnelStore = create4((set) => ({
  isExpanded: false,
  status: "idle",
  url: null,
  qrCode: null,
  error: null,
  progress: null,
  toggleSidebar: () => {
    set((state) => {
      const newExpanded = !state.isExpanded;
      if (newExpanded) {
        useGitStore.getState().collapseSidebar();
        useSessionFilesStore.getState().collapseSidebar();
        useSettingsStore.getState().collapseSidebar();
        useResearchStore.getState().collapseSidebar();
        useFileBrowserStore.getState().collapseSidebar();
        useMCPStore.getState().collapseSidebar();
        useSkillsStore.getState().collapseSidebar();
      }
      return { isExpanded: newExpanded };
    });
  },
  expandSidebar: () => {
    useGitStore.getState().collapseSidebar();
    useSessionFilesStore.getState().collapseSidebar();
    useSettingsStore.getState().collapseSidebar();
    useResearchStore.getState().collapseSidebar();
    useFileBrowserStore.getState().collapseSidebar();
    useMCPStore.getState().collapseSidebar();
    useSkillsStore.getState().collapseSidebar();
    set({ isExpanded: true });
  },
  collapseSidebar: () => set({ isExpanded: false }),
  setStatus: (status) => set({ status }),
  setUrl: (url) => set({ url }),
  setQrCode: (qrCode) => set({ qrCode }),
  setError: (error) => set({ error }),
  setProgress: (progress) => set({ progress }),
  reset: () => set({
    status: "idle",
    url: null,
    qrCode: null,
    error: null,
    progress: null
  })
}));

// src/stores/settingsStore.ts
var useSettingsStore = create5((set) => ({
  isExpanded: false,
  toggleSidebar: () => {
    set((state) => {
      const newExpanded = !state.isExpanded;
      if (newExpanded) {
        useGitStore.getState().collapseSidebar();
        useSessionFilesStore.getState().collapseSidebar();
        useResearchStore.getState().collapseSidebar();
        useTunnelStore.getState().collapseSidebar();
        useFileBrowserStore.getState().collapseSidebar();
        useMCPStore.getState().collapseSidebar();
        useSkillsStore.getState().collapseSidebar();
      }
      return { isExpanded: newExpanded };
    });
  },
  expandSidebar: () => set({ isExpanded: true }),
  collapseSidebar: () => set({ isExpanded: false })
}));

// src/stores/researchStore.ts
var useResearchStore = create6((set, get) => ({
  isExpanded: false,
  activeResearchSessionId: null,
  parentSessionId: null,
  toggleSidebar: () => {
    set((state) => {
      const newExpanded = !state.isExpanded;
      if (newExpanded) {
        useGitStore.getState().collapseSidebar();
        useSessionFilesStore.getState().collapseSidebar();
        useSettingsStore.getState().collapseSidebar();
        useTunnelStore.getState().collapseSidebar();
        useFileBrowserStore.getState().collapseSidebar();
        useMCPStore.getState().collapseSidebar();
        useSkillsStore.getState().collapseSidebar();
      }
      return { isExpanded: newExpanded };
    });
  },
  expandSidebar: () => {
    useGitStore.getState().collapseSidebar();
    useSessionFilesStore.getState().collapseSidebar();
    useSettingsStore.getState().collapseSidebar();
    useTunnelStore.getState().collapseSidebar();
    useFileBrowserStore.getState().collapseSidebar();
    useMCPStore.getState().collapseSidebar();
    useSkillsStore.getState().collapseSidebar();
    set({ isExpanded: true });
  },
  collapseSidebar: () => set({ isExpanded: false }),
  selectResearchSession: (id) => set({ activeResearchSessionId: id }),
  setParentSessionId: (id) => {
    const currentParentId = get().parentSessionId;
    if (currentParentId !== id) {
      set({
        parentSessionId: id,
        activeResearchSessionId: null
      });
    }
  },
  reset: () => set({
    activeResearchSessionId: null,
    parentSessionId: null
  })
}));

// src/stores/sessionFilesStore.ts
var useSessionFilesStore = create7((set) => ({
  isExpanded: false,
  selectedFile: null,
  allOperations: [],
  selectedOperationIndex: 0,
  isDiffOpen: false,
  toggleSidebar: () => {
    set((state) => {
      const newExpanded = !state.isExpanded;
      if (newExpanded) {
        useGitStore.getState().collapseSidebar();
        useResearchStore.getState().collapseSidebar();
        useSettingsStore.getState().collapseSidebar();
        useTunnelStore.getState().collapseSidebar();
        useFileBrowserStore.getState().collapseSidebar();
        useMCPStore.getState().collapseSidebar();
        useSkillsStore.getState().collapseSidebar();
      }
      return { isExpanded: newExpanded };
    });
  },
  expandSidebar: () => {
    useGitStore.getState().collapseSidebar();
    useResearchStore.getState().collapseSidebar();
    useSettingsStore.getState().collapseSidebar();
    useTunnelStore.getState().collapseSidebar();
    useFileBrowserStore.getState().collapseSidebar();
    useMCPStore.getState().collapseSidebar();
    useSkillsStore.getState().collapseSidebar();
    set({ isExpanded: true });
  },
  collapseSidebar: () => set({
    isExpanded: false,
    isDiffOpen: false,
    selectedFile: null,
    allOperations: [],
    selectedOperationIndex: 0
  }),
  openDiff: (file, operations) => set({
    selectedFile: file,
    allOperations: operations,
    selectedOperationIndex: operations.length - 1,
    isDiffOpen: true,
    isExpanded: true
  }),
  selectOperation: (index) => set({ selectedOperationIndex: index }),
  closeDiff: () => set({
    isDiffOpen: false,
    selectedFile: null,
    allOperations: [],
    selectedOperationIndex: 0
  })
}));

// src/stores/gitStore.ts
var useGitStore = create8((set) => ({
  isExpanded: false,
  activeSessionId: null,
  selectedFile: null,
  selectedFileStaged: false,
  isDiffOpen: false,
  isCommitModalOpen: false,
  commitSessionId: null,
  wasSessionListCollapsed: false,
  toggleSidebar: () => {
    set((state) => {
      const newExpanded = !state.isExpanded;
      if (newExpanded) {
        useSessionFilesStore.getState().collapseSidebar();
        useResearchStore.getState().collapseSidebar();
        useSettingsStore.getState().collapseSidebar();
        useTunnelStore.getState().collapseSidebar();
        useFileBrowserStore.getState().collapseSidebar();
        useMCPStore.getState().collapseSidebar();
        useSkillsStore.getState().collapseSidebar();
      }
      return { isExpanded: newExpanded };
    });
  },
  expandSidebar: () => set({ isExpanded: true }),
  collapseSidebar: () => set({ isExpanded: false, isDiffOpen: false, selectedFile: null }),
  openDiff: (file, staged) => set({
    selectedFile: file,
    selectedFileStaged: staged,
    isDiffOpen: true,
    isExpanded: true
  }),
  closeDiff: () => set({
    isDiffOpen: false,
    selectedFile: null
  }),
  switchFile: (file, staged) => set({
    selectedFile: file,
    selectedFileStaged: staged
  }),
  openCommitModal: () => set((state) => ({
    isCommitModalOpen: true,
    commitSessionId: state.activeSessionId
  })),
  openCommitModalForSession: (sessionId) => set({ isCommitModalOpen: true, commitSessionId: sessionId }),
  closeCommitModal: () => set({ isCommitModalOpen: false, commitSessionId: null }),
  setActiveSessionId: (sessionId) => set({ activeSessionId: sessionId }),
  setSessionListCollapsed: (collapsed) => set({ wasSessionListCollapsed: collapsed })
}));
// src/stores/sidebarStore.ts
import { create as create9 } from "zustand";
import { persist } from "zustand/middleware";
var useSidebarStore = create9()(persist((set) => ({
  isCollapsed: false,
  toggleCollapse: () => set((state) => ({ isCollapsed: !state.isCollapsed })),
  setCollapsed: (collapsed) => set({ isCollapsed: collapsed })
}), {
  name: "sidebar-storage"
}));
// src/stores/focusStore.ts
import { create as create10 } from "zustand";
var useFocusStore = create10((set) => ({
  currentFocus: null,
  sessionIndex: 0,
  gitFileIndex: 0,
  setFocus: (area) => set({ currentFocus: area }),
  setSessionIndex: (index) => set({ sessionIndex: index }),
  setGitFileIndex: (index) => set({ gitFileIndex: index }),
  resetGitFileIndex: () => set({ gitFileIndex: 0 }),
  resetSessionIndex: () => set({ sessionIndex: 0 })
}));
// src/stores/confirmationStore.ts
import { create as create11 } from "zustand";
var useConfirmationStore = create11((set) => ({
  isOpen: false,
  title: "Confirm Action",
  message: "",
  confirmLabel: "Confirm",
  cancelLabel: "Cancel",
  variant: "default",
  onConfirm: () => {},
  onCancel: undefined,
  openConfirmation: (options) => set({
    isOpen: true,
    title: options.title || "Confirm Action",
    message: options.message,
    confirmLabel: options.confirmLabel || "Confirm",
    cancelLabel: options.cancelLabel || "Cancel",
    variant: options.variant || "default",
    onConfirm: options.onConfirm,
    onCancel: options.onCancel
  }),
  closeConfirmation: () => set({
    isOpen: false,
    onConfirm: () => {},
    onCancel: undefined
  })
}));
// src/stores/queueStore.ts
import { create as create12 } from "zustand";
var useQueueStore = create12((set, get) => ({
  pendingRestoreText: null,
  setPendingRestoreText: (text) => set({ pendingRestoreText: text }),
  consumeRestoreText: () => {
    const text = get().pendingRestoreText;
    set({ pendingRestoreText: null });
    return text;
  }
}));
// src/stores/pendingResearchStore.ts
import { create as create13 } from "zustand";
var usePendingResearchStore = create13((set, get) => ({
  pendingContexts: new Map,
  addContext: (parentSessionId, context) => {
    set((state) => {
      const newMap = new Map(state.pendingContexts);
      const existing = newMap.get(parentSessionId) || [];
      if (!existing.some((c) => c.id === context.id)) {
        newMap.set(parentSessionId, [...existing, context]);
      }
      return { pendingContexts: newMap };
    });
  },
  removeContext: (parentSessionId, contextId) => {
    set((state) => {
      const newMap = new Map(state.pendingContexts);
      const existing = newMap.get(parentSessionId) || [];
      newMap.set(parentSessionId, existing.filter((c) => c.id !== contextId));
      return { pendingContexts: newMap };
    });
  },
  getContexts: (parentSessionId) => {
    return get().pendingContexts.get(parentSessionId) || [];
  },
  clearContexts: (parentSessionId) => {
    set((state) => {
      const newMap = new Map(state.pendingContexts);
      newMap.delete(parentSessionId);
      return { pendingContexts: newMap };
    });
  },
  consumeContexts: (parentSessionId) => {
    const contexts = get().getContexts(parentSessionId);
    get().clearContexts(parentSessionId);
    return contexts;
  }
}));
// src/stores/toastStore.ts
import { create as create14 } from "zustand";
var toastId = 0;
var useToastStore = create14((set) => ({
  toasts: [],
  addToast: (toast) => {
    const id = `toast-${++toastId}`;
    set((state) => ({
      toasts: [...state.toasts, { ...toast, id }]
    }));
    return id;
  },
  removeToast: (id) => set((state) => ({
    toasts: state.toasts.filter((t) => t.id !== id)
  })),
  updateToast: (id, updates) => set((state) => ({
    toasts: state.toasts.map((t) => t.id === id ? { ...t, ...updates } : t)
  })),
  clearToasts: () => set({ toasts: [] })
}));
function toast(message, type = "default", duration = 4000) {
  const id = useToastStore.getState().addToast({ message, type, duration });
  if (duration > 0) {
    setTimeout(() => {
      useToastStore.getState().removeToast(id);
    }, duration);
  }
  return id;
}
toast.success = (message, duration = 4000) => toast(message, "success", duration);
toast.error = (message, duration = 5000) => toast(message, "error", duration);
toast.info = (message, duration = 4000) => toast(message, "default", duration);
toast.loading = (message) => toast(message, "loading", 0);
toast.successWithAction = (message, action, duration = 6000) => {
  const id = useToastStore.getState().addToast({
    message,
    type: "success",
    duration,
    action
  });
  if (duration > 0) {
    setTimeout(() => {
      useToastStore.getState().removeToast(id);
    }, duration);
  }
  return id;
};
// src/stores/ottorouterStore.ts
import { create as create15 } from "zustand";
var useOttoRouterStore = create15((set) => ({
  balance: null,
  usdcBalance: null,
  network: "mainnet",
  isPaymentPending: false,
  lastPaymentAmount: null,
  walletAddress: null,
  isLoading: false,
  isTopupModalOpen: false,
  scope: null,
  payg: null,
  subscription: null,
  limits: null,
  setBalance: (balance) => set({ balance }),
  setUsdcBalance: (usdcBalance) => set({ usdcBalance }),
  setNetwork: (network) => set({ network }),
  setPaymentPending: (isPaymentPending) => set({ isPaymentPending }),
  setLastPaymentAmount: (lastPaymentAmount) => set({ lastPaymentAmount }),
  setWalletAddress: (walletAddress) => set({ walletAddress }),
  setLoading: (isLoading) => set({ isLoading }),
  openTopupModal: () => set({ isTopupModalOpen: true }),
  closeTopupModal: () => set({ isTopupModalOpen: false }),
  setScope: (scope) => set({ scope }),
  setPayg: (payg) => set({ payg }),
  setSubscription: (subscription) => set({ subscription }),
  setLimits: (limits) => set({ limits })
}));
// src/stores/toolApprovalStore.ts
import { create as create16 } from "zustand";
var useToolApprovalStore = create16((set) => ({
  pendingApprovals: [],
  addPendingApproval: (approval) => set((state) => ({
    pendingApprovals: [...state.pendingApprovals, approval]
  })),
  removePendingApproval: (callId) => set((state) => ({
    pendingApprovals: state.pendingApprovals.filter((a) => a.callId !== callId)
  })),
  updatePendingApproval: (callId, args) => set((state) => ({
    pendingApprovals: state.pendingApprovals.map((a) => a.callId === callId ? { ...a, args } : a)
  })),
  clearPendingApprovals: () => set({ pendingApprovals: [] }),
  setPendingApprovals: (approvals) => set({ pendingApprovals: approvals })
}));
// src/stores/topupApprovalStore.ts
import { create as create17 } from "zustand";
var useTopupApprovalStore = create17((set) => ({
  pendingTopup: null,
  isProcessing: false,
  selectedMethod: null,
  setPendingTopup: (pendingTopup) => set({ pendingTopup, isProcessing: false, selectedMethod: null }),
  setProcessing: (isProcessing) => set({ isProcessing }),
  setSelectedMethod: (selectedMethod) => set({ selectedMethod }),
  clearPendingTopup: () => set({ pendingTopup: null, isProcessing: false, selectedMethod: null })
}));
// src/stores/onboardingStore.ts
import { create as create18 } from "zustand";
var STEPS = ["wallet", "defaults"];
var useOnboardingStore = create18((set, get) => ({
  isOpen: false,
  currentStep: "wallet",
  manageMode: false,
  isLoading: false,
  error: null,
  authStatus: null,
  setOpen: (isOpen) => set({ isOpen }),
  setStep: (currentStep) => set({ currentStep }),
  setManageMode: (manageMode) => set({ manageMode }),
  setLoading: (isLoading) => set({ isLoading }),
  setError: (error) => set({ error }),
  setAuthStatus: (authStatus) => set({ authStatus }),
  nextStep: () => {
    const { currentStep } = get();
    const currentIndex = STEPS.indexOf(currentStep);
    if (currentIndex < STEPS.length - 1) {
      set({ currentStep: STEPS[currentIndex + 1] });
    }
  },
  prevStep: () => {
    const { currentStep } = get();
    const currentIndex = STEPS.indexOf(currentStep);
    if (currentIndex > 0) {
      set({ currentStep: STEPS[currentIndex - 1] });
    }
  },
  reset: () => set({
    isOpen: false,
    currentStep: "wallet",
    manageMode: false,
    isLoading: false,
    error: null
  })
}));
// src/stores/panelWidthStore.ts
import { create as create19 } from "zustand";
import { persist as persist2 } from "zustand/middleware";
var usePanelWidthStore = create19()(persist2((set, get) => ({
  widths: {},
  setWidth: (key, width) => set((state) => ({
    widths: { ...state.widths, [key]: width }
  })),
  getWidth: (key, defaultWidth) => get().widths[key] ?? defaultWidth
}), {
  name: "panel-widths"
}));
// src/stores/usageStore.ts
import { create as create20 } from "zustand";
var useUsageStore = create20((set) => ({
  usage: {},
  isLoading: {},
  lastFetched: {},
  isModalOpen: false,
  modalProvider: null,
  setUsage: (provider, data) => set((s) => ({ usage: { ...s.usage, [provider]: data } })),
  setLoading: (provider, loading) => set((s) => ({ isLoading: { ...s.isLoading, [provider]: loading } })),
  setLastFetched: (provider, time) => set((s) => ({ lastFetched: { ...s.lastFetched, [provider]: time } })),
  openModal: (provider) => set({ isModalOpen: true, modalProvider: provider }),
  closeModal: () => set({ isModalOpen: false, modalProvider: null })
}));
// src/stores/filePickerStore.ts
import { create as create21 } from "zustand";
var useFilePickerStore = create21((set) => ({
  isOpen: false,
  open: () => set({ isOpen: true }),
  close: () => set({ isOpen: false }),
  toggle: () => set((state) => ({ isOpen: !state.isOpen }))
}));
export {
  useUsageStore,
  useTunnelStore,
  useTopupApprovalStore,
  useToolApprovalStore,
  useToastStore,
  useSkillsStore,
  useSidebarStore,
  useSettingsStore,
  useSessionFilesStore,
  useResearchStore,
  useQueueStore,
  usePendingResearchStore,
  usePanelWidthStore,
  useOttoRouterStore,
  useOnboardingStore,
  useMCPStore,
  useGitStore,
  useFocusStore,
  useFilePickerStore,
  useFileBrowserStore,
  useConfirmationStore,
  toast
};

//# debugId=6B9694B684F7078B64756E2164756E21
