@athenaintel/react 0.9.22 → 0.9.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -24535,6 +24535,424 @@ const useAthenaRuntime = (config2) => {
24535
24535
  }, [isExistingThread, runtime, threadId, backendUrl]);
24536
24536
  return runtime;
24537
24537
  };
24538
+ function createJSONStorage(getStorage, options) {
24539
+ let storage;
24540
+ try {
24541
+ storage = getStorage();
24542
+ } catch (e) {
24543
+ return;
24544
+ }
24545
+ const persistStorage = {
24546
+ getItem: (name) => {
24547
+ var _a2;
24548
+ const parse2 = (str2) => {
24549
+ if (str2 === null) {
24550
+ return null;
24551
+ }
24552
+ return JSON.parse(str2, void 0);
24553
+ };
24554
+ const str = (_a2 = storage.getItem(name)) != null ? _a2 : null;
24555
+ if (str instanceof Promise) {
24556
+ return str.then(parse2);
24557
+ }
24558
+ return parse2(str);
24559
+ },
24560
+ setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, void 0)),
24561
+ removeItem: (name) => storage.removeItem(name)
24562
+ };
24563
+ return persistStorage;
24564
+ }
24565
+ const toThenable = (fn) => (input) => {
24566
+ try {
24567
+ const result = fn(input);
24568
+ if (result instanceof Promise) {
24569
+ return result;
24570
+ }
24571
+ return {
24572
+ then(onFulfilled) {
24573
+ return toThenable(onFulfilled)(result);
24574
+ },
24575
+ catch(_onRejected) {
24576
+ return this;
24577
+ }
24578
+ };
24579
+ } catch (e) {
24580
+ return {
24581
+ then(_onFulfilled) {
24582
+ return this;
24583
+ },
24584
+ catch(onRejected) {
24585
+ return toThenable(onRejected)(e);
24586
+ }
24587
+ };
24588
+ }
24589
+ };
24590
+ const persistImpl = (config2, baseOptions) => (set2, get2, api) => {
24591
+ let options = {
24592
+ storage: createJSONStorage(() => window.localStorage),
24593
+ partialize: (state) => state,
24594
+ version: 0,
24595
+ merge: (persistedState, currentState) => ({
24596
+ ...currentState,
24597
+ ...persistedState
24598
+ }),
24599
+ ...baseOptions
24600
+ };
24601
+ let hasHydrated = false;
24602
+ let hydrationVersion = 0;
24603
+ const hydrationListeners = /* @__PURE__ */ new Set();
24604
+ const finishHydrationListeners = /* @__PURE__ */ new Set();
24605
+ let storage = options.storage;
24606
+ if (!storage) {
24607
+ return config2(
24608
+ (...args) => {
24609
+ console.warn(
24610
+ `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
24611
+ );
24612
+ set2(...args);
24613
+ },
24614
+ get2,
24615
+ api
24616
+ );
24617
+ }
24618
+ const setItem = () => {
24619
+ const state = options.partialize({ ...get2() });
24620
+ return storage.setItem(options.name, {
24621
+ state,
24622
+ version: options.version
24623
+ });
24624
+ };
24625
+ const savedSetState = api.setState;
24626
+ api.setState = (state, replace2) => {
24627
+ savedSetState(state, replace2);
24628
+ return setItem();
24629
+ };
24630
+ const configResult = config2(
24631
+ (...args) => {
24632
+ set2(...args);
24633
+ return setItem();
24634
+ },
24635
+ get2,
24636
+ api
24637
+ );
24638
+ api.getInitialState = () => configResult;
24639
+ let stateFromStorage;
24640
+ const hydrate = () => {
24641
+ var _a2, _b;
24642
+ if (!storage) return;
24643
+ const currentVersion = ++hydrationVersion;
24644
+ hasHydrated = false;
24645
+ hydrationListeners.forEach((cb) => {
24646
+ var _a22;
24647
+ return cb((_a22 = get2()) != null ? _a22 : configResult);
24648
+ });
24649
+ const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a2 = get2()) != null ? _a2 : configResult)) || void 0;
24650
+ return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
24651
+ if (deserializedStorageValue) {
24652
+ if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
24653
+ if (options.migrate) {
24654
+ const migration = options.migrate(
24655
+ deserializedStorageValue.state,
24656
+ deserializedStorageValue.version
24657
+ );
24658
+ if (migration instanceof Promise) {
24659
+ return migration.then((result) => [true, result]);
24660
+ }
24661
+ return [true, migration];
24662
+ }
24663
+ console.error(
24664
+ `State loaded from storage couldn't be migrated since no migrate function was provided`
24665
+ );
24666
+ } else {
24667
+ return [false, deserializedStorageValue.state];
24668
+ }
24669
+ }
24670
+ return [false, void 0];
24671
+ }).then((migrationResult) => {
24672
+ var _a22;
24673
+ if (currentVersion !== hydrationVersion) {
24674
+ return;
24675
+ }
24676
+ const [migrated, migratedState] = migrationResult;
24677
+ stateFromStorage = options.merge(
24678
+ migratedState,
24679
+ (_a22 = get2()) != null ? _a22 : configResult
24680
+ );
24681
+ set2(stateFromStorage, true);
24682
+ if (migrated) {
24683
+ return setItem();
24684
+ }
24685
+ }).then(() => {
24686
+ if (currentVersion !== hydrationVersion) {
24687
+ return;
24688
+ }
24689
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
24690
+ stateFromStorage = get2();
24691
+ hasHydrated = true;
24692
+ finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
24693
+ }).catch((e) => {
24694
+ if (currentVersion !== hydrationVersion) {
24695
+ return;
24696
+ }
24697
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
24698
+ });
24699
+ };
24700
+ api.persist = {
24701
+ setOptions: (newOptions) => {
24702
+ options = {
24703
+ ...options,
24704
+ ...newOptions
24705
+ };
24706
+ if (newOptions.storage) {
24707
+ storage = newOptions.storage;
24708
+ }
24709
+ },
24710
+ clearStorage: () => {
24711
+ storage == null ? void 0 : storage.removeItem(options.name);
24712
+ },
24713
+ getOptions: () => options,
24714
+ rehydrate: () => hydrate(),
24715
+ hasHydrated: () => hasHydrated,
24716
+ onHydrate: (cb) => {
24717
+ hydrationListeners.add(cb);
24718
+ return () => {
24719
+ hydrationListeners.delete(cb);
24720
+ };
24721
+ },
24722
+ onFinishHydration: (cb) => {
24723
+ finishHydrationListeners.add(cb);
24724
+ return () => {
24725
+ finishHydrationListeners.delete(cb);
24726
+ };
24727
+ }
24728
+ };
24729
+ if (!options.skipHydration) {
24730
+ hydrate();
24731
+ }
24732
+ return stateFromStorage || configResult;
24733
+ };
24734
+ const persist = persistImpl;
24735
+ const useAssetPanelStore = create()(
24736
+ persist(
24737
+ (set2, get2) => ({
24738
+ isOpen: false,
24739
+ tabs: [],
24740
+ activeTabId: null,
24741
+ viewMode: "tabs",
24742
+ isFullscreen: false,
24743
+ assetPanelHostCount: 0,
24744
+ autoOpenGeneration: 0,
24745
+ autoOpenedAssets: /* @__PURE__ */ new Map(),
24746
+ registerAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),
24747
+ unregisterAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),
24748
+ openAsset: (assetId, meta) => set2((s) => {
24749
+ const existing = s.tabs.find((t) => t.id === assetId);
24750
+ if (existing) {
24751
+ const tabs = meta ? s.tabs.map(
24752
+ (t) => t.id === assetId ? { ...t, name: meta.name ?? t.name, type: meta.type ?? t.type } : t
24753
+ ) : s.tabs;
24754
+ return { isOpen: true, tabs, activeTabId: assetId };
24755
+ }
24756
+ const newTab = {
24757
+ id: assetId,
24758
+ name: (meta == null ? void 0 : meta.name) ?? null,
24759
+ type: (meta == null ? void 0 : meta.type) ?? "unknown"
24760
+ };
24761
+ return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
24762
+ }),
24763
+ closeTab: (assetId) => set2((s) => {
24764
+ var _a2;
24765
+ const tabs = s.tabs.filter((t) => t.id !== assetId);
24766
+ if (tabs.length === 0) {
24767
+ return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };
24768
+ }
24769
+ const activeTabId = s.activeTabId === assetId ? ((_a2 = tabs[Math.min(s.tabs.findIndex((t) => t.id === assetId), tabs.length - 1)]) == null ? void 0 : _a2.id) ?? null : s.activeTabId;
24770
+ return { tabs, activeTabId };
24771
+ }),
24772
+ setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
24773
+ setViewMode: (mode) => set2({ viewMode: mode }),
24774
+ closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
24775
+ toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
24776
+ resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
24777
+ markAutoOpened: (assetId) => {
24778
+ const state = get2();
24779
+ if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
24780
+ return false;
24781
+ }
24782
+ state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
24783
+ return true;
24784
+ }
24785
+ }),
24786
+ {
24787
+ name: "athena-react-asset-panel",
24788
+ partialize: ({
24789
+ isOpen,
24790
+ tabs,
24791
+ activeTabId,
24792
+ viewMode,
24793
+ isFullscreen
24794
+ }) => ({
24795
+ isOpen,
24796
+ tabs,
24797
+ activeTabId,
24798
+ viewMode,
24799
+ isFullscreen
24800
+ }),
24801
+ storage: createJSONStorage(() => sessionStorage)
24802
+ }
24803
+ )
24804
+ );
24805
+ const THREAD_SNAPSHOT_STORAGE_KEY = "athena-react-asset-panel-thread-snapshots";
24806
+ const DEFAULT_ASSET_PANEL_SNAPSHOT = {
24807
+ isOpen: false,
24808
+ tabs: [],
24809
+ activeTabId: null,
24810
+ viewMode: "tabs",
24811
+ isFullscreen: false
24812
+ };
24813
+ const useBrowserLayoutEffect = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;
24814
+ const selectAssetPanelSnapshot = (state) => ({
24815
+ isOpen: state.isOpen,
24816
+ tabs: state.tabs,
24817
+ activeTabId: state.activeTabId,
24818
+ viewMode: state.viewMode,
24819
+ isFullscreen: state.isFullscreen
24820
+ });
24821
+ const areSnapshotsEqual = (left, right) => {
24822
+ if (left.isOpen !== right.isOpen || left.activeTabId !== right.activeTabId || left.viewMode !== right.viewMode || left.isFullscreen !== right.isFullscreen || left.tabs.length !== right.tabs.length) {
24823
+ return false;
24824
+ }
24825
+ return left.tabs.every((tab, index2) => {
24826
+ const otherTab = right.tabs[index2];
24827
+ return otherTab !== void 0 && tab.id === otherTab.id && tab.name === otherTab.name && tab.type === otherTab.type;
24828
+ });
24829
+ };
24830
+ const getSessionStorage = () => {
24831
+ if (typeof window === "undefined") {
24832
+ return null;
24833
+ }
24834
+ try {
24835
+ return sessionStorage;
24836
+ } catch {
24837
+ return null;
24838
+ }
24839
+ };
24840
+ const readAllThreadSnapshots = () => {
24841
+ const storage = getSessionStorage();
24842
+ if (!storage) {
24843
+ return {};
24844
+ }
24845
+ try {
24846
+ const raw = storage.getItem(THREAD_SNAPSHOT_STORAGE_KEY);
24847
+ if (!raw) {
24848
+ return {};
24849
+ }
24850
+ const parsed = JSON.parse(raw);
24851
+ if (!parsed || typeof parsed !== "object") {
24852
+ return {};
24853
+ }
24854
+ return parsed;
24855
+ } catch {
24856
+ return {};
24857
+ }
24858
+ };
24859
+ const writeAllThreadSnapshots = (snapshots) => {
24860
+ const storage = getSessionStorage();
24861
+ if (!storage) {
24862
+ return;
24863
+ }
24864
+ try {
24865
+ storage.setItem(THREAD_SNAPSHOT_STORAGE_KEY, JSON.stringify(snapshots));
24866
+ } catch {
24867
+ }
24868
+ };
24869
+ const readThreadSnapshot = (threadInfo) => {
24870
+ const snapshots = readAllThreadSnapshots();
24871
+ if (threadInfo.remoteId && snapshots[threadInfo.remoteId]) {
24872
+ return snapshots[threadInfo.remoteId];
24873
+ }
24874
+ return snapshots[threadInfo.threadId] ?? DEFAULT_ASSET_PANEL_SNAPSHOT;
24875
+ };
24876
+ const writeThreadSnapshot = (threadInfo, snapshot) => {
24877
+ const keys2 = [threadInfo.threadId, threadInfo.remoteId].filter(
24878
+ (value) => Boolean(value)
24879
+ );
24880
+ if (keys2.length === 0) {
24881
+ return;
24882
+ }
24883
+ const snapshots = readAllThreadSnapshots();
24884
+ let didChange = false;
24885
+ for (const key of keys2) {
24886
+ if (areSnapshotsEqual(snapshots[key] ?? DEFAULT_ASSET_PANEL_SNAPSHOT, snapshot)) {
24887
+ continue;
24888
+ }
24889
+ snapshots[key] = snapshot;
24890
+ didChange = true;
24891
+ }
24892
+ if (didChange) {
24893
+ writeAllThreadSnapshots(snapshots);
24894
+ }
24895
+ };
24896
+ function AssetPanelThreadPersistence() {
24897
+ const mainThreadId = useAuiState((state) => state.threads.mainThreadId);
24898
+ const activeRemoteId = useAuiState((state) => {
24899
+ const activeThread = state.threads.threadItems.find(
24900
+ (thread) => thread.id === state.threads.mainThreadId
24901
+ );
24902
+ return (activeThread == null ? void 0 : activeThread.remoteId) ?? null;
24903
+ });
24904
+ const panelSnapshot = useAssetPanelStore(selectAssetPanelSnapshot);
24905
+ const previousThreadRef = React.useRef(null);
24906
+ const pendingPersistSkipKeyRef = React.useRef(null);
24907
+ useBrowserLayoutEffect(() => {
24908
+ if (!mainThreadId) {
24909
+ return;
24910
+ }
24911
+ const activeThread = {
24912
+ threadId: mainThreadId,
24913
+ remoteId: activeRemoteId
24914
+ };
24915
+ const previousThread = previousThreadRef.current;
24916
+ const didThreadChange = !previousThread || previousThread.threadId !== activeThread.threadId || previousThread.remoteId !== activeThread.remoteId;
24917
+ if (!didThreadChange) {
24918
+ return;
24919
+ }
24920
+ if (previousThread) {
24921
+ writeThreadSnapshot(
24922
+ previousThread,
24923
+ selectAssetPanelSnapshot(useAssetPanelStore.getState())
24924
+ );
24925
+ }
24926
+ previousThreadRef.current = activeThread;
24927
+ pendingPersistSkipKeyRef.current = activeThread.remoteId ?? activeThread.threadId;
24928
+ const snapshotToRestore = readThreadSnapshot(activeThread);
24929
+ const currentSnapshot = selectAssetPanelSnapshot(useAssetPanelStore.getState());
24930
+ if (!areSnapshotsEqual(currentSnapshot, snapshotToRestore)) {
24931
+ useAssetPanelStore.setState((state) => ({
24932
+ ...state,
24933
+ ...snapshotToRestore
24934
+ }));
24935
+ }
24936
+ }, [mainThreadId, activeRemoteId]);
24937
+ React.useEffect(() => {
24938
+ if (!mainThreadId) {
24939
+ return;
24940
+ }
24941
+ const activeThreadKey = activeRemoteId ?? mainThreadId;
24942
+ if (pendingPersistSkipKeyRef.current === activeThreadKey) {
24943
+ pendingPersistSkipKeyRef.current = null;
24944
+ return;
24945
+ }
24946
+ writeThreadSnapshot(
24947
+ {
24948
+ threadId: mainThreadId,
24949
+ remoteId: activeRemoteId
24950
+ },
24951
+ panelSnapshot
24952
+ );
24953
+ }, [mainThreadId, activeRemoteId, panelSnapshot]);
24954
+ return null;
24955
+ }
24538
24956
  function TooltipProvider({
24539
24957
  delayDuration = 0,
24540
24958
  ...props
@@ -25055,7 +25473,10 @@ function AthenaWithThreadList({
25055
25473
  linkClicks,
25056
25474
  citationLinks
25057
25475
  });
25058
- return /* @__PURE__ */ jsxRuntime.jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsxRuntime.jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsxRuntime.jsx(ThreadListRefreshContext.Provider, { value: handleRefresh, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children }) }) }) });
25476
+ return /* @__PURE__ */ jsxRuntime.jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsxRuntime.jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsxRuntime.jsx(ThreadListRefreshContext.Provider, { value: handleRefresh, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipProvider, { children: [
25477
+ /* @__PURE__ */ jsxRuntime.jsx(AssetPanelThreadPersistence, {}),
25478
+ children
25479
+ ] }) }) }) });
25059
25480
  }
25060
25481
  function AthenaProvider({
25061
25482
  children,
@@ -58808,273 +59229,6 @@ const MentionExtension = Node3.create({
58808
59229
  };
58809
59230
  }
58810
59231
  });
58811
- function createJSONStorage(getStorage, options) {
58812
- let storage;
58813
- try {
58814
- storage = getStorage();
58815
- } catch (e) {
58816
- return;
58817
- }
58818
- const persistStorage = {
58819
- getItem: (name) => {
58820
- var _a2;
58821
- const parse2 = (str2) => {
58822
- if (str2 === null) {
58823
- return null;
58824
- }
58825
- return JSON.parse(str2, void 0);
58826
- };
58827
- const str = (_a2 = storage.getItem(name)) != null ? _a2 : null;
58828
- if (str instanceof Promise) {
58829
- return str.then(parse2);
58830
- }
58831
- return parse2(str);
58832
- },
58833
- setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, void 0)),
58834
- removeItem: (name) => storage.removeItem(name)
58835
- };
58836
- return persistStorage;
58837
- }
58838
- const toThenable = (fn) => (input) => {
58839
- try {
58840
- const result = fn(input);
58841
- if (result instanceof Promise) {
58842
- return result;
58843
- }
58844
- return {
58845
- then(onFulfilled) {
58846
- return toThenable(onFulfilled)(result);
58847
- },
58848
- catch(_onRejected) {
58849
- return this;
58850
- }
58851
- };
58852
- } catch (e) {
58853
- return {
58854
- then(_onFulfilled) {
58855
- return this;
58856
- },
58857
- catch(onRejected) {
58858
- return toThenable(onRejected)(e);
58859
- }
58860
- };
58861
- }
58862
- };
58863
- const persistImpl = (config2, baseOptions) => (set2, get2, api) => {
58864
- let options = {
58865
- storage: createJSONStorage(() => window.localStorage),
58866
- partialize: (state) => state,
58867
- version: 0,
58868
- merge: (persistedState, currentState) => ({
58869
- ...currentState,
58870
- ...persistedState
58871
- }),
58872
- ...baseOptions
58873
- };
58874
- let hasHydrated = false;
58875
- let hydrationVersion = 0;
58876
- const hydrationListeners = /* @__PURE__ */ new Set();
58877
- const finishHydrationListeners = /* @__PURE__ */ new Set();
58878
- let storage = options.storage;
58879
- if (!storage) {
58880
- return config2(
58881
- (...args) => {
58882
- console.warn(
58883
- `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
58884
- );
58885
- set2(...args);
58886
- },
58887
- get2,
58888
- api
58889
- );
58890
- }
58891
- const setItem = () => {
58892
- const state = options.partialize({ ...get2() });
58893
- return storage.setItem(options.name, {
58894
- state,
58895
- version: options.version
58896
- });
58897
- };
58898
- const savedSetState = api.setState;
58899
- api.setState = (state, replace2) => {
58900
- savedSetState(state, replace2);
58901
- return setItem();
58902
- };
58903
- const configResult = config2(
58904
- (...args) => {
58905
- set2(...args);
58906
- return setItem();
58907
- },
58908
- get2,
58909
- api
58910
- );
58911
- api.getInitialState = () => configResult;
58912
- let stateFromStorage;
58913
- const hydrate = () => {
58914
- var _a2, _b;
58915
- if (!storage) return;
58916
- const currentVersion = ++hydrationVersion;
58917
- hasHydrated = false;
58918
- hydrationListeners.forEach((cb) => {
58919
- var _a22;
58920
- return cb((_a22 = get2()) != null ? _a22 : configResult);
58921
- });
58922
- const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a2 = get2()) != null ? _a2 : configResult)) || void 0;
58923
- return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
58924
- if (deserializedStorageValue) {
58925
- if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
58926
- if (options.migrate) {
58927
- const migration = options.migrate(
58928
- deserializedStorageValue.state,
58929
- deserializedStorageValue.version
58930
- );
58931
- if (migration instanceof Promise) {
58932
- return migration.then((result) => [true, result]);
58933
- }
58934
- return [true, migration];
58935
- }
58936
- console.error(
58937
- `State loaded from storage couldn't be migrated since no migrate function was provided`
58938
- );
58939
- } else {
58940
- return [false, deserializedStorageValue.state];
58941
- }
58942
- }
58943
- return [false, void 0];
58944
- }).then((migrationResult) => {
58945
- var _a22;
58946
- if (currentVersion !== hydrationVersion) {
58947
- return;
58948
- }
58949
- const [migrated, migratedState] = migrationResult;
58950
- stateFromStorage = options.merge(
58951
- migratedState,
58952
- (_a22 = get2()) != null ? _a22 : configResult
58953
- );
58954
- set2(stateFromStorage, true);
58955
- if (migrated) {
58956
- return setItem();
58957
- }
58958
- }).then(() => {
58959
- if (currentVersion !== hydrationVersion) {
58960
- return;
58961
- }
58962
- postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
58963
- stateFromStorage = get2();
58964
- hasHydrated = true;
58965
- finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
58966
- }).catch((e) => {
58967
- if (currentVersion !== hydrationVersion) {
58968
- return;
58969
- }
58970
- postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
58971
- });
58972
- };
58973
- api.persist = {
58974
- setOptions: (newOptions) => {
58975
- options = {
58976
- ...options,
58977
- ...newOptions
58978
- };
58979
- if (newOptions.storage) {
58980
- storage = newOptions.storage;
58981
- }
58982
- },
58983
- clearStorage: () => {
58984
- storage == null ? void 0 : storage.removeItem(options.name);
58985
- },
58986
- getOptions: () => options,
58987
- rehydrate: () => hydrate(),
58988
- hasHydrated: () => hasHydrated,
58989
- onHydrate: (cb) => {
58990
- hydrationListeners.add(cb);
58991
- return () => {
58992
- hydrationListeners.delete(cb);
58993
- };
58994
- },
58995
- onFinishHydration: (cb) => {
58996
- finishHydrationListeners.add(cb);
58997
- return () => {
58998
- finishHydrationListeners.delete(cb);
58999
- };
59000
- }
59001
- };
59002
- if (!options.skipHydration) {
59003
- hydrate();
59004
- }
59005
- return stateFromStorage || configResult;
59006
- };
59007
- const persist = persistImpl;
59008
- const useAssetPanelStore = create()(
59009
- persist(
59010
- (set2, get2) => ({
59011
- isOpen: false,
59012
- tabs: [],
59013
- activeTabId: null,
59014
- viewMode: "tabs",
59015
- isFullscreen: false,
59016
- assetPanelHostCount: 0,
59017
- autoOpenGeneration: 0,
59018
- autoOpenedAssets: /* @__PURE__ */ new Map(),
59019
- registerAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),
59020
- unregisterAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),
59021
- openAsset: (assetId, meta) => set2((s) => {
59022
- const existing = s.tabs.find((t) => t.id === assetId);
59023
- if (existing) {
59024
- const tabs = meta ? s.tabs.map(
59025
- (t) => t.id === assetId ? { ...t, name: meta.name ?? t.name, type: meta.type ?? t.type } : t
59026
- ) : s.tabs;
59027
- return { isOpen: true, tabs, activeTabId: assetId };
59028
- }
59029
- const newTab = {
59030
- id: assetId,
59031
- name: (meta == null ? void 0 : meta.name) ?? null,
59032
- type: (meta == null ? void 0 : meta.type) ?? "unknown"
59033
- };
59034
- return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
59035
- }),
59036
- closeTab: (assetId) => set2((s) => {
59037
- var _a2;
59038
- const tabs = s.tabs.filter((t) => t.id !== assetId);
59039
- if (tabs.length === 0) {
59040
- return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };
59041
- }
59042
- const activeTabId = s.activeTabId === assetId ? ((_a2 = tabs[Math.min(s.tabs.findIndex((t) => t.id === assetId), tabs.length - 1)]) == null ? void 0 : _a2.id) ?? null : s.activeTabId;
59043
- return { tabs, activeTabId };
59044
- }),
59045
- setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
59046
- setViewMode: (mode) => set2({ viewMode: mode }),
59047
- closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
59048
- toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
59049
- resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
59050
- markAutoOpened: (assetId) => {
59051
- const state = get2();
59052
- if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
59053
- return false;
59054
- }
59055
- state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
59056
- return true;
59057
- }
59058
- }),
59059
- {
59060
- name: "athena-react-asset-panel",
59061
- partialize: ({
59062
- isOpen,
59063
- tabs,
59064
- activeTabId,
59065
- viewMode,
59066
- isFullscreen
59067
- }) => ({
59068
- isOpen,
59069
- tabs,
59070
- activeTabId,
59071
- viewMode,
59072
- isFullscreen
59073
- }),
59074
- storage: createJSONStorage(() => sessionStorage)
59075
- }
59076
- )
59077
- );
59078
59232
  const ATHENA_APP_HOSTNAMES = /* @__PURE__ */ new Set(["app.athenaintel.com", "staging-app.athenaintel.com"]);
59079
59233
  const ATHENA_PREVIEW_HOSTNAME_SUFFIX = ".previews.athenaintel.com";
59080
59234
  const ATHENA_WORKSPACE_HOSTNAME_SUFFIXES = [".app.athenaintel.com", ".staging-app.athenaintel.com"];
@@ -64923,9 +65077,9 @@ const DEFAULT_SUGGESTIONS = [
64923
65077
  prompt: "Search the web for the latest developments in enterprise AI adoption, then create a document summarizing the key trends, market data, and strategic implications."
64924
65078
  },
64925
65079
  {
64926
- icon: ChartColumn,
64927
- title: "Analyze data and visualize insights",
64928
- prompt: "Generate a sample quarterly sales dataset across 4 product categories, then create an interactive chart showing revenue trends and category performance over time."
65080
+ icon: Search,
65081
+ title: "Compare recent AI model launches",
65082
+ prompt: "Search the web for the latest major AI model launches from OpenAI, Anthropic, and Google, then summarize the release dates, standout capabilities, and practical tradeoffs in a concise comparison table."
64929
65083
  },
64930
65084
  {
64931
65085
  icon: Presentation,