@chrryai/chrry 1.5.3 → 1.5.5
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/Thread.module.scss +1 -0
- package/dist/index.js +136 -154
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +359 -377
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/Thread.module.scss
CHANGED
package/dist/index.js
CHANGED
|
@@ -1902,7 +1902,7 @@ var init_utils = __esm({
|
|
|
1902
1902
|
};
|
|
1903
1903
|
isFirefox = typeof navigator !== "undefined" && navigator?.userAgent?.includes("Firefox");
|
|
1904
1904
|
config = getSiteConfig(getClientHostname());
|
|
1905
|
-
VERSION = config.version || "1.5.
|
|
1905
|
+
VERSION = config.version || "1.5.5";
|
|
1906
1906
|
getSlugFromPathname = (path) => {
|
|
1907
1907
|
return getAppAndStoreSlugs(path, {
|
|
1908
1908
|
defaultAppSlug: config.slug,
|
|
@@ -5860,72 +5860,6 @@ var init_ThemeContext = __esm({
|
|
|
5860
5860
|
}
|
|
5861
5861
|
});
|
|
5862
5862
|
|
|
5863
|
-
// lib/db.ts
|
|
5864
|
-
var import_idb, dbInstance, getDB, cacheData, getCachedData, clearCache;
|
|
5865
|
-
var init_db = __esm({
|
|
5866
|
-
"lib/db.ts"() {
|
|
5867
|
-
"use strict";
|
|
5868
|
-
import_idb = require("idb");
|
|
5869
|
-
dbInstance = null;
|
|
5870
|
-
getDB = async () => {
|
|
5871
|
-
if (typeof indexedDB === "undefined") {
|
|
5872
|
-
return null;
|
|
5873
|
-
}
|
|
5874
|
-
if (dbInstance) return dbInstance;
|
|
5875
|
-
dbInstance = await (0, import_idb.openDB)("vex-cache", 1, {
|
|
5876
|
-
upgrade(db) {
|
|
5877
|
-
if (!db.objectStoreNames.contains("cache")) {
|
|
5878
|
-
db.createObjectStore("cache");
|
|
5879
|
-
}
|
|
5880
|
-
}
|
|
5881
|
-
});
|
|
5882
|
-
return dbInstance;
|
|
5883
|
-
};
|
|
5884
|
-
cacheData = async (key, data, ttl) => {
|
|
5885
|
-
try {
|
|
5886
|
-
const db = await getDB();
|
|
5887
|
-
if (!db) return;
|
|
5888
|
-
await db.put(
|
|
5889
|
-
"cache",
|
|
5890
|
-
{
|
|
5891
|
-
data,
|
|
5892
|
-
timestamp: Date.now(),
|
|
5893
|
-
ttl
|
|
5894
|
-
},
|
|
5895
|
-
key
|
|
5896
|
-
);
|
|
5897
|
-
} catch (error) {
|
|
5898
|
-
console.error("Failed to cache data:", error);
|
|
5899
|
-
}
|
|
5900
|
-
};
|
|
5901
|
-
getCachedData = async (key) => {
|
|
5902
|
-
try {
|
|
5903
|
-
const db = await getDB();
|
|
5904
|
-
if (!db) return null;
|
|
5905
|
-
const cached = await db.get("cache", key);
|
|
5906
|
-
if (!cached) return null;
|
|
5907
|
-
if (cached.ttl && Date.now() - cached.timestamp > cached.ttl) {
|
|
5908
|
-
await db.delete("cache", key);
|
|
5909
|
-
return null;
|
|
5910
|
-
}
|
|
5911
|
-
return cached.data;
|
|
5912
|
-
} catch (error) {
|
|
5913
|
-
console.error("Failed to get cached data:", error);
|
|
5914
|
-
return null;
|
|
5915
|
-
}
|
|
5916
|
-
};
|
|
5917
|
-
clearCache = async () => {
|
|
5918
|
-
try {
|
|
5919
|
-
const db = await getDB();
|
|
5920
|
-
if (!db) return;
|
|
5921
|
-
await db.clear("cache");
|
|
5922
|
-
} catch (error) {
|
|
5923
|
-
console.error("Failed to clear cache:", error);
|
|
5924
|
-
}
|
|
5925
|
-
};
|
|
5926
|
-
}
|
|
5927
|
-
});
|
|
5928
|
-
|
|
5929
5863
|
// locales/en.json
|
|
5930
5864
|
var en_default;
|
|
5931
5865
|
var init_en = __esm({
|
|
@@ -22981,13 +22915,7 @@ function AuthProvider({
|
|
|
22981
22915
|
...props
|
|
22982
22916
|
}) {
|
|
22983
22917
|
const [wasGifted, setWasGifted] = (0, import_react19.useState)(false);
|
|
22984
|
-
const [session2,
|
|
22985
|
-
props.session
|
|
22986
|
-
);
|
|
22987
|
-
const setSession = (session3, cache = false) => {
|
|
22988
|
-
setSessionInternal(session3);
|
|
22989
|
-
if (cache) cacheData(sessionCacheKey, session3, 1e3 * 60 * 60);
|
|
22990
|
-
};
|
|
22918
|
+
const [session2, setSession] = (0, import_react19.useState)(props.session);
|
|
22991
22919
|
const { searchParams, removeParams, pathname, addParams, ...router } = useNavigation();
|
|
22992
22920
|
(0, import_react19.useEffect)(() => {
|
|
22993
22921
|
if (error) {
|
|
@@ -23061,7 +22989,7 @@ function AuthProvider({
|
|
|
23061
22989
|
};
|
|
23062
22990
|
function processSession(sessionData2) {
|
|
23063
22991
|
if (sessionData2) {
|
|
23064
|
-
setSession(sessionData2
|
|
22992
|
+
setSession(sessionData2);
|
|
23065
22993
|
if (sessionData2.migratedFromGuest) {
|
|
23066
22994
|
migratedFromGuestRef.current = sessionData2.migratedFromGuest;
|
|
23067
22995
|
}
|
|
@@ -23181,12 +23109,7 @@ function AuthProvider({
|
|
|
23181
23109
|
}
|
|
23182
23110
|
return sessionResult;
|
|
23183
23111
|
} catch (error2) {
|
|
23184
|
-
|
|
23185
|
-
if (cached) {
|
|
23186
|
-
console.log("\u{1F4E6} Using cached session (offline mode)");
|
|
23187
|
-
return cached;
|
|
23188
|
-
}
|
|
23189
|
-
throw error2;
|
|
23112
|
+
import_react_hot_toast.default.error("Something went wrong");
|
|
23190
23113
|
}
|
|
23191
23114
|
},
|
|
23192
23115
|
{
|
|
@@ -23456,17 +23379,6 @@ function AuthProvider({
|
|
|
23456
23379
|
const vex = allApps?.find((app2) => app2.slug === "vex");
|
|
23457
23380
|
const sushi = allApps?.find((app2) => app2.slug === "sushi");
|
|
23458
23381
|
const focus = allApps?.find((app2) => app2.slug === "focus");
|
|
23459
|
-
(0, import_react19.useEffect)(() => {
|
|
23460
|
-
const loadCachedApps = async () => {
|
|
23461
|
-
if (!token || !loadingApp?.id && !app?.id) return;
|
|
23462
|
-
const key = `allApps-${loadingApp?.id || app?.id}-${user?.id || guest?.id}`;
|
|
23463
|
-
const cached = await getCachedData(key);
|
|
23464
|
-
if (cached && cached.length > 0) {
|
|
23465
|
-
mergeApps(cached);
|
|
23466
|
-
}
|
|
23467
|
-
};
|
|
23468
|
-
loadCachedApps();
|
|
23469
|
-
}, [token, loadingApp?.id, app?.id, user?.id, guest?.id, mergeApps]);
|
|
23470
23382
|
const {
|
|
23471
23383
|
data: allAppsSwr,
|
|
23472
23384
|
mutate: refetchApps,
|
|
@@ -23475,18 +23387,12 @@ function AuthProvider({
|
|
|
23475
23387
|
token && (loadingApp?.id || app?.id) ? ["allApps", token] : null,
|
|
23476
23388
|
async () => {
|
|
23477
23389
|
if (!token) return null;
|
|
23478
|
-
const key = `allApps-${loadingApp?.id || app?.id}-${user?.id || guest?.id}`;
|
|
23479
23390
|
try {
|
|
23480
23391
|
const apps2 = await getApps({ token, appId: loadingApp?.id || app?.id });
|
|
23481
|
-
await cacheData(key, apps2);
|
|
23482
23392
|
return apps2;
|
|
23483
23393
|
} catch (error2) {
|
|
23484
|
-
|
|
23485
|
-
|
|
23486
|
-
console.log("\u{1F4E6} Using cached apps (offline mode)");
|
|
23487
|
-
return cached;
|
|
23488
|
-
}
|
|
23489
|
-
throw error2;
|
|
23394
|
+
console.log(`\u{1F680} ~ file: AuthProvider.tsx:1002 ~ error:`, error2);
|
|
23395
|
+
import_react_hot_toast.default.error("Something went wrong");
|
|
23490
23396
|
}
|
|
23491
23397
|
}
|
|
23492
23398
|
);
|
|
@@ -23844,7 +23750,6 @@ function AuthProvider({
|
|
|
23844
23750
|
const bloom = allApps.find((app2) => app2.slug === "bloom");
|
|
23845
23751
|
const zarathustra = allApps.find((app2) => app2.slug === "zarathustra");
|
|
23846
23752
|
const signOut = async () => {
|
|
23847
|
-
await clearCache();
|
|
23848
23753
|
setShouldFetchSession(false);
|
|
23849
23754
|
setUser(void 0);
|
|
23850
23755
|
setGuest(void 0);
|
|
@@ -24022,7 +23927,6 @@ var init_AuthProvider = __esm({
|
|
|
24022
23927
|
init_ThemeContext();
|
|
24023
23928
|
import_react_hot_toast = __toESM(require("react-hot-toast"));
|
|
24024
23929
|
init_lib();
|
|
24025
|
-
init_db();
|
|
24026
23930
|
init_i18n();
|
|
24027
23931
|
init_hooks();
|
|
24028
23932
|
init_locales();
|
|
@@ -24091,7 +23995,7 @@ function DataProvider({ children, ...rest }) {
|
|
|
24091
23995
|
const [instructions, setInstructions] = (0, import_react21.useState)([]);
|
|
24092
23996
|
const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
|
|
24093
23997
|
const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
|
|
24094
|
-
const VERSION4 = "1.5.
|
|
23998
|
+
const VERSION4 = "1.5.5";
|
|
24095
23999
|
const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
|
|
24096
24000
|
const {
|
|
24097
24001
|
API_URL: API_URL2,
|
|
@@ -26125,17 +26029,6 @@ function ChatProvider({
|
|
|
26125
26029
|
const [collaborationStatus, setCollaborationStatusInternal] = (0, import_react31.useState)(
|
|
26126
26030
|
searchParams.get("collaborationStatus") ?? void 0
|
|
26127
26031
|
);
|
|
26128
|
-
(0, import_react31.useEffect)(() => {
|
|
26129
|
-
const loadCachedThreads = async () => {
|
|
26130
|
-
if (!app?.id || !(user?.id || guest?.id)) return;
|
|
26131
|
-
const key = `threads-${app.id}-${user?.id || guest?.id}`;
|
|
26132
|
-
const cached = await getCachedData(key);
|
|
26133
|
-
if (cached) {
|
|
26134
|
-
console.log("\u26A1 Loading cached threads instantly");
|
|
26135
|
-
}
|
|
26136
|
-
};
|
|
26137
|
-
loadCachedThreads();
|
|
26138
|
-
}, [app?.id, user?.id, guest?.id]);
|
|
26139
26032
|
(0, import_react31.useEffect)(() => {
|
|
26140
26033
|
if (user && migratedFromGuestRef.current) {
|
|
26141
26034
|
migratedFromGuestRef.current = false;
|
|
@@ -26168,15 +26061,10 @@ function ChatProvider({
|
|
|
26168
26061
|
(c) => user && c.user.id === user?.id
|
|
26169
26062
|
) || guest ? thread2?.id : void 0
|
|
26170
26063
|
});
|
|
26171
|
-
await cacheData(key, threads2, 1e3 * 60 * 30);
|
|
26172
26064
|
return threads2;
|
|
26173
26065
|
} catch (error2) {
|
|
26174
|
-
|
|
26175
|
-
|
|
26176
|
-
console.log("\u{1F4E6} Using cached threads (offline mode)");
|
|
26177
|
-
return cached;
|
|
26178
|
-
}
|
|
26179
|
-
throw error2;
|
|
26066
|
+
console.log(`\u{1F680} ~ file: ChatProvider.tsx:291 ~ error:`, error2);
|
|
26067
|
+
toast_default.error("Something went wrong");
|
|
26180
26068
|
}
|
|
26181
26069
|
},
|
|
26182
26070
|
{
|
|
@@ -26852,7 +26740,6 @@ var init_ChatProvider = __esm({
|
|
|
26852
26740
|
init_DataProvider();
|
|
26853
26741
|
init_utils();
|
|
26854
26742
|
init_url();
|
|
26855
|
-
init_db();
|
|
26856
26743
|
init_platform();
|
|
26857
26744
|
init_AppProvider();
|
|
26858
26745
|
init_getHourlyLimit();
|
|
@@ -29667,7 +29554,8 @@ var init_Thread_styles = __esm({
|
|
|
29667
29554
|
headers: {
|
|
29668
29555
|
display: "flex",
|
|
29669
29556
|
flexDirection: "column",
|
|
29670
|
-
gap: 10
|
|
29557
|
+
gap: 10,
|
|
29558
|
+
marginBottom: 5
|
|
29671
29559
|
},
|
|
29672
29560
|
header: {
|
|
29673
29561
|
display: "flex",
|
|
@@ -34918,10 +34806,7 @@ ${t5(`The more specific you are, the better AI can assist you!`)}`)
|
|
|
34918
34806
|
gap: isMobileDevice ? toRem(5) : toRem(7.5)
|
|
34919
34807
|
}
|
|
34920
34808
|
},
|
|
34921
|
-
instructions.slice(
|
|
34922
|
-
0,
|
|
34923
|
-
isMemoryConsentManageVisible ? 3 : visibleInstructionCount
|
|
34924
|
-
).map((instruction, index) => {
|
|
34809
|
+
instructions.slice(0, visibleInstructionCount).map((instruction, index) => {
|
|
34925
34810
|
return /* @__PURE__ */ import_react54.default.createElement(
|
|
34926
34811
|
MotiView,
|
|
34927
34812
|
{
|
|
@@ -39309,6 +39194,7 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
|
|
|
39309
39194
|
{
|
|
39310
39195
|
className: "link",
|
|
39311
39196
|
"data-testid": "image-generation-button",
|
|
39197
|
+
"data-enabled": isImageGenerationEnabled,
|
|
39312
39198
|
style: {
|
|
39313
39199
|
...utilities.link.style,
|
|
39314
39200
|
...styles4.imageGenerationButton.style
|
|
@@ -39316,11 +39202,7 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
|
|
|
39316
39202
|
title: isImageGenerationEnabled ? t5("Image Generation Enabled") : t5("Enable Image Generation"),
|
|
39317
39203
|
onClick: () => {
|
|
39318
39204
|
setIsImageGenerationEnabled(!isImageGenerationEnabled);
|
|
39319
|
-
|
|
39320
|
-
setSelectedAgent(void 0);
|
|
39321
|
-
} else {
|
|
39322
|
-
setSelectedAgent(sushiAgent);
|
|
39323
|
-
}
|
|
39205
|
+
setSelectedAgent(sushiAgent);
|
|
39324
39206
|
}
|
|
39325
39207
|
},
|
|
39326
39208
|
/* @__PURE__ */ React.createElement(
|
|
@@ -42299,6 +42181,39 @@ var init_Account = __esm({
|
|
|
42299
42181
|
}
|
|
42300
42182
|
});
|
|
42301
42183
|
|
|
42184
|
+
// lib/db.ts
|
|
42185
|
+
var import_idb, dbInstance, getDB, clearCache;
|
|
42186
|
+
var init_db = __esm({
|
|
42187
|
+
"lib/db.ts"() {
|
|
42188
|
+
"use strict";
|
|
42189
|
+
import_idb = require("idb");
|
|
42190
|
+
dbInstance = null;
|
|
42191
|
+
getDB = async () => {
|
|
42192
|
+
if (typeof indexedDB === "undefined") {
|
|
42193
|
+
return null;
|
|
42194
|
+
}
|
|
42195
|
+
if (dbInstance) return dbInstance;
|
|
42196
|
+
dbInstance = await (0, import_idb.openDB)("vex-cache", 1, {
|
|
42197
|
+
upgrade(db) {
|
|
42198
|
+
if (!db.objectStoreNames.contains("cache")) {
|
|
42199
|
+
db.createObjectStore("cache");
|
|
42200
|
+
}
|
|
42201
|
+
}
|
|
42202
|
+
});
|
|
42203
|
+
return dbInstance;
|
|
42204
|
+
};
|
|
42205
|
+
clearCache = async () => {
|
|
42206
|
+
try {
|
|
42207
|
+
const db = await getDB();
|
|
42208
|
+
if (!db) return;
|
|
42209
|
+
await db.clear("cache");
|
|
42210
|
+
} catch (error) {
|
|
42211
|
+
console.error("Failed to clear cache:", error);
|
|
42212
|
+
}
|
|
42213
|
+
};
|
|
42214
|
+
}
|
|
42215
|
+
});
|
|
42216
|
+
|
|
42302
42217
|
// SignIn.web.tsx
|
|
42303
42218
|
function SignIn({
|
|
42304
42219
|
className,
|
|
@@ -47734,16 +47649,17 @@ function MemoryConsent({
|
|
|
47734
47649
|
/* @__PURE__ */ React.createElement(icons_exports.LinkIcon, { size: 16 }),
|
|
47735
47650
|
" ",
|
|
47736
47651
|
t5("Privacy")
|
|
47737
|
-
), (user || guest)?.memoriesCount ? /* @__PURE__ */ React.createElement(
|
|
47652
|
+
), !(user || guest)?.memoriesCount ? /* @__PURE__ */ React.createElement(
|
|
47738
47653
|
ConfirmButton_default,
|
|
47739
47654
|
{
|
|
47740
|
-
|
|
47655
|
+
processing: isDeleting,
|
|
47741
47656
|
disabled: isDeleting,
|
|
47742
|
-
title: t5("
|
|
47657
|
+
title: t5("Delete"),
|
|
47743
47658
|
className: "transparent",
|
|
47744
47659
|
style: {
|
|
47745
47660
|
...utilities.transparent.style,
|
|
47746
|
-
...styles4.deleteButton.style
|
|
47661
|
+
...styles4.deleteButton.style,
|
|
47662
|
+
fontSize: 15
|
|
47747
47663
|
},
|
|
47748
47664
|
onConfirm: async () => {
|
|
47749
47665
|
if (!token) return;
|
|
@@ -47765,12 +47681,11 @@ function MemoryConsent({
|
|
|
47765
47681
|
}
|
|
47766
47682
|
}
|
|
47767
47683
|
},
|
|
47768
|
-
/* @__PURE__ */ React.createElement(icons_exports.Trash2, { size:
|
|
47769
|
-
t5("Delete")
|
|
47684
|
+
/* @__PURE__ */ React.createElement(icons_exports.Trash2, { size: 15, color: "var(--accent-0)" })
|
|
47770
47685
|
) : null) : /* @__PURE__ */ React.createElement(
|
|
47771
47686
|
ConfirmButton_default,
|
|
47772
47687
|
{
|
|
47773
|
-
confirm: /* @__PURE__ */ React.createElement(React.Fragment, null, isUpdatingMemories ? /* @__PURE__ */ React.createElement(Loading, { width: 18, height: 18 }) : /* @__PURE__ */ React.createElement(icons_exports.
|
|
47688
|
+
confirm: /* @__PURE__ */ React.createElement(React.Fragment, null, isUpdatingMemories ? /* @__PURE__ */ React.createElement(Loading, { width: 18, height: 18 }) : /* @__PURE__ */ React.createElement(icons_exports.Brain, { color: "#ef5350", size: 18 }), t5("Are you sure?")),
|
|
47774
47689
|
disabled: isUpdatingMemories,
|
|
47775
47690
|
title: t5("\u{1F4AD} We use conversation memory to improve responses."),
|
|
47776
47691
|
className: "transparent",
|
|
@@ -47802,7 +47717,7 @@ function MemoryConsent({
|
|
|
47802
47717
|
}
|
|
47803
47718
|
}
|
|
47804
47719
|
},
|
|
47805
|
-
isUpdatingMemories ? /* @__PURE__ */ React.createElement(Loading, { width: 18, height: 18 }) : /* @__PURE__ */ React.createElement(icons_exports.Brain, { color: "
|
|
47720
|
+
isUpdatingMemories ? /* @__PURE__ */ React.createElement(Loading, { width: 18, height: 18 }) : /* @__PURE__ */ React.createElement(icons_exports.Brain, { color: "var(--shade-5)", size: 18 }),
|
|
47806
47721
|
t5("Disable Memories")
|
|
47807
47722
|
) : /* @__PURE__ */ React.createElement(
|
|
47808
47723
|
Button,
|
|
@@ -47835,7 +47750,7 @@ function MemoryConsent({
|
|
|
47835
47750
|
}
|
|
47836
47751
|
}
|
|
47837
47752
|
},
|
|
47838
|
-
isUpdatingMemories ? /* @__PURE__ */ React.createElement(Loading, { color: "white", width: 18, height: 18 }) : /* @__PURE__ */ React.createElement(icons_exports.
|
|
47753
|
+
isUpdatingMemories ? /* @__PURE__ */ React.createElement(Loading, { color: "white", width: 18, height: 18 }) : /* @__PURE__ */ React.createElement(icons_exports.Brain, { size: 16 }),
|
|
47839
47754
|
t5("Enable Memories")
|
|
47840
47755
|
)))
|
|
47841
47756
|
);
|
|
@@ -81384,6 +81299,66 @@ var init_Hey = __esm({
|
|
|
81384
81299
|
}
|
|
81385
81300
|
});
|
|
81386
81301
|
|
|
81302
|
+
// lib/swrCacheProvider.ts
|
|
81303
|
+
function createMemoryCacheProvider() {
|
|
81304
|
+
const cache = /* @__PURE__ */ new Map();
|
|
81305
|
+
return () => cache;
|
|
81306
|
+
}
|
|
81307
|
+
async function createIDBCacheProvider() {
|
|
81308
|
+
try {
|
|
81309
|
+
const { default: createCacheProvider, timestampStorageHandler } = await import("@piotr-cz/swr-idb-cache");
|
|
81310
|
+
const gcStorageHandler = {
|
|
81311
|
+
...timestampStorageHandler,
|
|
81312
|
+
revive: (key, storeObject) => {
|
|
81313
|
+
if (storeObject.ts > Date.now() - CACHE_TTL) {
|
|
81314
|
+
return timestampStorageHandler.revive(key, storeObject);
|
|
81315
|
+
}
|
|
81316
|
+
return void 0;
|
|
81317
|
+
}
|
|
81318
|
+
};
|
|
81319
|
+
const provider = await createCacheProvider({
|
|
81320
|
+
dbName: "vex-swr-cache",
|
|
81321
|
+
storeName: "cache",
|
|
81322
|
+
storageHandler: gcStorageHandler
|
|
81323
|
+
});
|
|
81324
|
+
console.log("\u2705 IndexedDB SWR cache initialized");
|
|
81325
|
+
return provider;
|
|
81326
|
+
} catch (error) {
|
|
81327
|
+
console.error("Failed to create IDB cache provider:", error);
|
|
81328
|
+
return (() => /* @__PURE__ */ new Map());
|
|
81329
|
+
}
|
|
81330
|
+
}
|
|
81331
|
+
async function getCacheProvider() {
|
|
81332
|
+
if (typeof indexedDB !== "undefined") {
|
|
81333
|
+
return await createIDBCacheProvider();
|
|
81334
|
+
}
|
|
81335
|
+
console.warn("[SWR Cache] IndexedDB not available, using in-memory cache");
|
|
81336
|
+
return createMemoryCacheProvider();
|
|
81337
|
+
}
|
|
81338
|
+
function useSWRCacheProvider() {
|
|
81339
|
+
const [provider, setProvider] = (0, import_react117.useState)(null);
|
|
81340
|
+
(0, import_react117.useEffect)(() => {
|
|
81341
|
+
let mounted = true;
|
|
81342
|
+
getCacheProvider().then((p) => {
|
|
81343
|
+
if (mounted) {
|
|
81344
|
+
setProvider(() => p);
|
|
81345
|
+
}
|
|
81346
|
+
});
|
|
81347
|
+
return () => {
|
|
81348
|
+
mounted = false;
|
|
81349
|
+
};
|
|
81350
|
+
}, []);
|
|
81351
|
+
return provider;
|
|
81352
|
+
}
|
|
81353
|
+
var import_react117, CACHE_TTL;
|
|
81354
|
+
var init_swrCacheProvider = __esm({
|
|
81355
|
+
"lib/swrCacheProvider.ts"() {
|
|
81356
|
+
"use strict";
|
|
81357
|
+
import_react117 = require("react");
|
|
81358
|
+
CACHE_TTL = 60 * 60 * 1e3;
|
|
81359
|
+
}
|
|
81360
|
+
});
|
|
81361
|
+
|
|
81387
81362
|
// context/providers/index.tsx
|
|
81388
81363
|
function AppProviders({
|
|
81389
81364
|
children,
|
|
@@ -81399,8 +81374,14 @@ function AppProviders({
|
|
|
81399
81374
|
translations,
|
|
81400
81375
|
useExtensionIcon
|
|
81401
81376
|
}) {
|
|
81402
|
-
const [error, setError] = (0,
|
|
81377
|
+
const [error, setError] = (0, import_react118.useState)("");
|
|
81378
|
+
const cacheProvider = useSWRCacheProvider();
|
|
81403
81379
|
const swrConfig = {
|
|
81380
|
+
// Use persistent cache provider when ready (IndexedDB on web, MMKV on native)
|
|
81381
|
+
// If not ready yet, SWR uses its default in-memory cache
|
|
81382
|
+
...cacheProvider ? { provider: cacheProvider } : {},
|
|
81383
|
+
// Pre-populate cache with SSR session data
|
|
81384
|
+
fallback: session2 ? { session: { data: session2 } } : {},
|
|
81404
81385
|
onError: (error2) => {
|
|
81405
81386
|
if (error2?.status === 429) {
|
|
81406
81387
|
const lastShown = localStorage.getItem("last_rate_limit_toast");
|
|
@@ -81419,14 +81400,14 @@ function AppProviders({
|
|
|
81419
81400
|
setTimeout(() => revalidate({ retryCount }), 5e3);
|
|
81420
81401
|
}
|
|
81421
81402
|
};
|
|
81422
|
-
return /* @__PURE__ */
|
|
81403
|
+
return /* @__PURE__ */ import_react118.default.createElement(import_swr9.SWRConfig, { value: swrConfig }, /* @__PURE__ */ import_react118.default.createElement(
|
|
81423
81404
|
PlatformProvider,
|
|
81424
81405
|
{
|
|
81425
81406
|
viewPortWidth,
|
|
81426
81407
|
viewPortHeight,
|
|
81427
81408
|
session: session2
|
|
81428
81409
|
},
|
|
81429
|
-
/* @__PURE__ */
|
|
81410
|
+
/* @__PURE__ */ import_react118.default.createElement(ErrorProvider, null, /* @__PURE__ */ import_react118.default.createElement(ThemeProvider, { session: session2 }, /* @__PURE__ */ import_react118.default.createElement(
|
|
81430
81411
|
AuthProvider,
|
|
81431
81412
|
{
|
|
81432
81413
|
translations,
|
|
@@ -81439,11 +81420,11 @@ function AppProviders({
|
|
|
81439
81420
|
signOutContext,
|
|
81440
81421
|
session: session2
|
|
81441
81422
|
},
|
|
81442
|
-
/* @__PURE__ */
|
|
81423
|
+
/* @__PURE__ */ import_react118.default.createElement(DataProvider, null, /* @__PURE__ */ import_react118.default.createElement(AppProvider, null, /* @__PURE__ */ import_react118.default.createElement(ChatProvider, null, /* @__PURE__ */ import_react118.default.createElement(TimerContextProvider, null, /* @__PURE__ */ import_react118.default.createElement(NavigationProvider, null, /* @__PURE__ */ import_react118.default.createElement(AppContextProvider, null, /* @__PURE__ */ import_react118.default.createElement(StylesProvider, null, /* @__PURE__ */ import_react118.default.createElement(Hey, { useExtensionIcon }, children))))))))
|
|
81443
81424
|
)))
|
|
81444
81425
|
));
|
|
81445
81426
|
}
|
|
81446
|
-
var
|
|
81427
|
+
var import_react118, import_swr9;
|
|
81447
81428
|
var init_providers = __esm({
|
|
81448
81429
|
"context/providers/index.tsx"() {
|
|
81449
81430
|
"use strict";
|
|
@@ -81455,7 +81436,7 @@ var init_providers = __esm({
|
|
|
81455
81436
|
init_DataProvider();
|
|
81456
81437
|
init_AppProvider();
|
|
81457
81438
|
init_platform();
|
|
81458
|
-
|
|
81439
|
+
import_react118 = __toESM(require("react"));
|
|
81459
81440
|
init_platform();
|
|
81460
81441
|
init_ThemeContext();
|
|
81461
81442
|
init_StylesContext();
|
|
@@ -81469,6 +81450,7 @@ var init_providers = __esm({
|
|
|
81469
81450
|
import_swr9 = require("swr");
|
|
81470
81451
|
init_TimerContext();
|
|
81471
81452
|
init_Hey();
|
|
81453
|
+
init_swrCacheProvider();
|
|
81472
81454
|
}
|
|
81473
81455
|
});
|
|
81474
81456
|
|
|
@@ -81600,7 +81582,7 @@ init_agentSchema();
|
|
|
81600
81582
|
init_appSchema();
|
|
81601
81583
|
|
|
81602
81584
|
// Sidebar.tsx
|
|
81603
|
-
var
|
|
81585
|
+
var import_react119 = __toESM(require("react"));
|
|
81604
81586
|
|
|
81605
81587
|
// Providers.tsx
|
|
81606
81588
|
init_i18n();
|
|
@@ -81618,24 +81600,24 @@ init_Hey();
|
|
|
81618
81600
|
function Sidebar({
|
|
81619
81601
|
useExtensionIcon
|
|
81620
81602
|
}) {
|
|
81621
|
-
return /* @__PURE__ */
|
|
81603
|
+
return /* @__PURE__ */ import_react119.default.createElement(Providers, null, /* @__PURE__ */ import_react119.default.createElement(Hey, { useExtensionIcon }));
|
|
81622
81604
|
}
|
|
81623
81605
|
|
|
81624
81606
|
// index.ts
|
|
81625
81607
|
init_Store();
|
|
81626
81608
|
|
|
81627
81609
|
// context/providers/HistoryRouterProvider.tsx
|
|
81628
|
-
var
|
|
81610
|
+
var import_react120 = require("react");
|
|
81629
81611
|
init_useWindowHistory();
|
|
81630
|
-
var HistoryRouterContext = (0,
|
|
81612
|
+
var HistoryRouterContext = (0, import_react120.createContext)(
|
|
81631
81613
|
null
|
|
81632
81614
|
);
|
|
81633
81615
|
function HistoryRouterProvider({
|
|
81634
81616
|
children
|
|
81635
81617
|
}) {
|
|
81636
|
-
const [state, setState] = (0,
|
|
81637
|
-
const [updateTrigger, setUpdateTrigger] = (0,
|
|
81638
|
-
(0,
|
|
81618
|
+
const [state, setState] = (0, import_react120.useState)(() => clientRouter.getState());
|
|
81619
|
+
const [updateTrigger, setUpdateTrigger] = (0, import_react120.useState)(0);
|
|
81620
|
+
(0, import_react120.useEffect)(() => {
|
|
81639
81621
|
const unsubscribe = clientRouter.subscribe(() => {
|
|
81640
81622
|
const newState = clientRouter.getState();
|
|
81641
81623
|
setState(newState);
|