mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-08-30 02:29:18 +02:00
Compare commits
65 Commits
3.0.10-and
...
gen_stack
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb42a2e1a4 | ||
|
|
12c5b6d227 | ||
|
|
364ae51e36 | ||
|
|
18947e0c93 | ||
|
|
3880db4339 | ||
|
|
ae5b0b6fcc | ||
|
|
2c729f90cc | ||
|
|
800514d769 | ||
|
|
b03b9482dc | ||
|
|
9019490dbd | ||
|
|
4a3e23c288 | ||
|
|
1800ebea2d | ||
|
|
a708c9e9eb | ||
|
|
2aeb875fec | ||
|
|
a8164e9f6c | ||
|
|
0ee8e738e5 | ||
|
|
8fdef2ac7d | ||
|
|
920b1d91f3 | ||
|
|
0ad382aced | ||
|
|
c8aa8e37cf | ||
|
|
9a37f7c506 | ||
|
|
717750d5d4 | ||
|
|
1274ecc3b5 | ||
|
|
4c2ad4567c | ||
|
|
ebc01af34a | ||
|
|
e66d8eee13 | ||
|
|
55e6a4b65a | ||
|
|
0aa1db584d | ||
|
|
a0e6266d28 | ||
|
|
bd0aaed863 | ||
|
|
9410c42f29 | ||
|
|
80186c1812 | ||
|
|
37dfda5c54 | ||
|
|
ec83517dc5 | ||
|
|
2eb4911592 | ||
|
|
cd0a6a8fcb | ||
|
|
b15f192244 | ||
|
|
406cb663c9 | ||
|
|
301a30a50a | ||
|
|
81e3432143 | ||
|
|
c43c2936ac | ||
|
|
fdea1807d2 | ||
|
|
5439578fcf | ||
|
|
e05e52f870 | ||
|
|
1c6243d12e | ||
|
|
a51dfb5b6e | ||
|
|
c98bddd35b | ||
|
|
1eb80ccc88 | ||
|
|
5a346aa7de | ||
|
|
910095a769 | ||
|
|
119059befa | ||
|
|
a8f5dea315 | ||
|
|
ca0a4cb02c | ||
|
|
a04cd6b8dc | ||
|
|
3e4ab0f6df | ||
|
|
a7fe1aca44 | ||
|
|
ff0188f602 | ||
|
|
c846f8abc8 | ||
|
|
8d8acfb99d | ||
|
|
3a5b5772ad | ||
|
|
8046932e4e | ||
|
|
c45aa84739 | ||
|
|
d98be849e3 | ||
|
|
727ac6d907 | ||
|
|
8302f8ba4c |
14
.github/workflows/ios.publish.yml
vendored
14
.github/workflows/ios.publish.yml
vendored
@@ -89,13 +89,13 @@ jobs:
|
||||
- name: CCache Stats After Build
|
||||
run: ccache -sv
|
||||
|
||||
- name: "Upload app to TestFlight"
|
||||
uses: apple-actions/upload-testflight-build@v1
|
||||
with:
|
||||
app-path: Notesnook.ipa
|
||||
issuer-id: ${{ secrets.API_KEY_ISSUER_ID }}
|
||||
api-key-id: ${{ secrets.API_KEY_ID }}
|
||||
api-private-key: ${{ secrets.API_KEY }}
|
||||
# - name: "Upload app to TestFlight"
|
||||
# uses: apple-actions/upload-testflight-build@v1
|
||||
# with:
|
||||
# app-path: Notesnook.ipa
|
||||
# issuer-id: ${{ secrets.API_KEY_ISSUER_ID }}
|
||||
# api-key-id: ${{ secrets.API_KEY_ID }}
|
||||
# api-private-key: ${{ secrets.API_KEY }}
|
||||
|
||||
- name: Upload Notesnook.ipa to Github
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
owner: streetwriters
|
||||
repo: notesnook
|
||||
provider: github
|
||||
updaterCacheDirName: Notesnook
|
||||
1819
apps/desktop/package-lock.json
generated
1819
apps/desktop/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
"name": "@notesnook/desktop",
|
||||
"productName": "Notesnook",
|
||||
"description": "Your private note taking space",
|
||||
"version": "3.0.9",
|
||||
"version": "3.0.13",
|
||||
"appAppleId": "1544027013",
|
||||
"private": true,
|
||||
"main": "./dist/index.js",
|
||||
@@ -16,7 +16,7 @@
|
||||
"@trpc/server": "10.38.3",
|
||||
"better-sqlite3-multiple-ciphers": "^9.5.0",
|
||||
"electron-trpc": "0.5.2",
|
||||
"electron-updater": "6.1.4",
|
||||
"electron-updater": "^6.2.1",
|
||||
"icojs": "^0.17.1",
|
||||
"sodium-native": "^4.1.1",
|
||||
"typed-emitter": "^2.1.0",
|
||||
@@ -28,8 +28,8 @@
|
||||
"@types/yargs": "^17.0.24",
|
||||
"chokidar": "^3.5.3",
|
||||
"electron": "^29.3.1",
|
||||
"electron-builder": "^25.0.0-alpha.11",
|
||||
"esbuild": "^0.20.0",
|
||||
"electron-builder": "^24.13.3",
|
||||
"esbuild": "^0.23.0",
|
||||
"kysely": "^0.27.3",
|
||||
"node-gyp-build": "^4.8.0",
|
||||
"prebuildify": "^6.0.1",
|
||||
|
||||
@@ -46,11 +46,11 @@ if (args.rebuild || !existsSync(path.join(webAppPath, "build"))) {
|
||||
// temporary until there's support for prebuilt binaries for linux ARM
|
||||
if (os.platform() === "linux") await patchBetterSQLite3();
|
||||
|
||||
if (os.platform() === "win32")
|
||||
await exec(
|
||||
`npx prebuildify --arch=arm64 --strip -t electron@${packageJson.devDependencies.electron}`,
|
||||
path.join(__dirname, "..", "node_modules", "sodium-native")
|
||||
);
|
||||
// if (os.platform() === "win32")
|
||||
// await exec(
|
||||
// `npx prebuildify --arch=arm64 --strip -t electron@${packageJson.devDependencies.electron}`,
|
||||
// path.join(__dirname, "..", "node_modules", "sodium-native")
|
||||
// );
|
||||
|
||||
await fs.cp(path.join(webAppPath, "build"), "build", {
|
||||
recursive: true,
|
||||
|
||||
@@ -61,7 +61,18 @@ export const updaterRouter = t.router({
|
||||
"update-not-available"
|
||||
),
|
||||
onAvailable: createSubscription<"update-available", UpdateInfo>(
|
||||
"update-available"
|
||||
"update-available",
|
||||
() => {
|
||||
if (!config.automaticUpdates) return false;
|
||||
autoUpdater.emit("download-progress", {
|
||||
bytesPerSecond: 0,
|
||||
delta: 0,
|
||||
percent: 0,
|
||||
total: 100,
|
||||
transferred: 0
|
||||
});
|
||||
return true;
|
||||
}
|
||||
),
|
||||
onError: createSubscription("error")
|
||||
});
|
||||
@@ -69,10 +80,11 @@ export const updaterRouter = t.router({
|
||||
function createSubscription<
|
||||
TName extends keyof AppUpdaterEvents,
|
||||
TReturnType = Parameters<AppUpdaterEvents[TName]>[0]
|
||||
>(eventName: TName) {
|
||||
>(eventName: TName, handler?: (args: TReturnType) => boolean) {
|
||||
return t.procedure.subscription(() => {
|
||||
return observable<TReturnType>((emit) => {
|
||||
const listener: AppUpdaterEvents[TName] = (...args: any[]) => {
|
||||
if (handler?.(args[0])) return;
|
||||
emit.next(args[0]);
|
||||
};
|
||||
autoUpdater.removeAllListeners(eventName);
|
||||
|
||||
@@ -35,6 +35,7 @@ async function configureAutoUpdater() {
|
||||
autoUpdater.allowDowngrade = false;
|
||||
autoUpdater.allowPrerelease = false;
|
||||
autoUpdater.autoInstallOnAppQuit = true;
|
||||
autoUpdater.disableWebInstaller = true;
|
||||
}
|
||||
|
||||
export { configureAutoUpdater };
|
||||
|
||||
@@ -25,7 +25,6 @@ import { I18nManager, View } from "react-native";
|
||||
import "react-native-gesture-handler";
|
||||
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
||||
import { SafeAreaProvider } from "react-native-safe-area-context";
|
||||
import { initializeLogger } from "./common/database/logger";
|
||||
import AppLockedOverlay from "./components/app-lock-overlay";
|
||||
import { withErrorBoundry } from "./components/exception-handler";
|
||||
import GlobalSafeAreaProvider from "./components/globalsafearea";
|
||||
@@ -41,33 +40,24 @@ import { useUserStore } from "./stores/use-user-store";
|
||||
I18nManager.allowRTL(false);
|
||||
I18nManager.forceRTL(false);
|
||||
I18nManager.swapLeftAndRightInRTL(false);
|
||||
const { appLockEnabled, appLockMode } = SettingsService.get();
|
||||
if (appLockEnabled || appLockMode !== "none") {
|
||||
useUserStore.getState().lockApp(true);
|
||||
}
|
||||
|
||||
const App = () => {
|
||||
const init = useAppEvents();
|
||||
useAppEvents();
|
||||
//@ts-ignore
|
||||
globalThis["IS_MAIN_APP_RUNNING"] = true;
|
||||
useEffect(() => {
|
||||
initializeLogger()
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
const { appLockEnabled, appLockMode } = SettingsService.get();
|
||||
if (appLockEnabled || appLockMode !== "none") {
|
||||
useUserStore.getState().lockApp(true);
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
globalThis["IS_MAIN_APP_RUNNING"] = true;
|
||||
init();
|
||||
setTimeout(async () => {
|
||||
SettingsService.onFirstLaunch();
|
||||
await Notifications.get();
|
||||
if (SettingsService.get().notifNotes) {
|
||||
Notifications.pinQuickNote(true);
|
||||
}
|
||||
TipManager.init();
|
||||
}, 100);
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
SettingsService.onFirstLaunch();
|
||||
setTimeout(async () => {
|
||||
await Notifications.get();
|
||||
if (SettingsService.get().notifNotes) {
|
||||
Notifications.pinQuickNote(true);
|
||||
}
|
||||
TipManager.init();
|
||||
}, 100);
|
||||
}, []);
|
||||
return (
|
||||
<View
|
||||
|
||||
@@ -23,7 +23,9 @@ import { Platform } from "react-native";
|
||||
import { setLogger } from ".";
|
||||
import { RNSqliteDriver } from "./sqlite.kysely";
|
||||
|
||||
let loggerLoaded = false;
|
||||
const initializeLogger = async () => {
|
||||
if (loggerLoaded) return;
|
||||
await initialize({
|
||||
dialect: (name) => ({
|
||||
createDriver: () => {
|
||||
@@ -37,6 +39,7 @@ const initializeLogger = async () => {
|
||||
journalMode: Platform.OS === "ios" ? "DELETE" : "WAL"
|
||||
});
|
||||
setLogger();
|
||||
loggerLoaded = true;
|
||||
};
|
||||
|
||||
export { initializeLogger };
|
||||
|
||||
@@ -18,7 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import React, { useCallback, useEffect, useRef } from "react";
|
||||
import { AppStateStatus, Platform, TextInput, View } from "react-native";
|
||||
import {
|
||||
AppStateStatus,
|
||||
Platform,
|
||||
TextInput,
|
||||
useWindowDimensions,
|
||||
View
|
||||
} from "react-native";
|
||||
//@ts-ignore
|
||||
import { useThemeColors } from "@notesnook/theme";
|
||||
import { DatabaseLogger } from "../../common/database";
|
||||
@@ -46,6 +52,7 @@ import Input from "../ui/input";
|
||||
import Seperator from "../ui/seperator";
|
||||
import Heading from "../ui/typography/heading";
|
||||
import Paragraph from "../ui/typography/paragraph";
|
||||
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
|
||||
|
||||
const getUser = () => {
|
||||
const user = MMKV.getString("user");
|
||||
@@ -86,6 +93,7 @@ const AppLockedOverlay = () => {
|
||||
const appState = useAppState();
|
||||
const lastAppState = useRef<AppStateStatus>(appState);
|
||||
const biometricUnlockAwaitingUserInput = useRef(false);
|
||||
const { height } = useWindowDimensions();
|
||||
const keyboardType = useSettingStore(
|
||||
(state) => state.settings.applockKeyboardType
|
||||
);
|
||||
@@ -191,15 +199,20 @@ const AppLockedOverlay = () => {
|
||||
}, [appState, onUnlockAppRequested, appLocked]);
|
||||
|
||||
return appLocked ? (
|
||||
<View
|
||||
<KeyboardAwareScrollView
|
||||
style={{
|
||||
backgroundColor: colors.primary.background,
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
position: "absolute",
|
||||
zIndex: 999,
|
||||
justifyContent: "center"
|
||||
zIndex: 999
|
||||
}}
|
||||
contentContainerStyle={{
|
||||
justifyContent: "center",
|
||||
minHeight: height
|
||||
}}
|
||||
keyboardDismissMode="interactive"
|
||||
keyboardShouldPersistTaps="handled"
|
||||
>
|
||||
<Toast context="local" />
|
||||
<View
|
||||
@@ -314,7 +327,7 @@ const AppLockedOverlay = () => {
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</KeyboardAwareScrollView>
|
||||
) : null;
|
||||
};
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ import {
|
||||
import { getGithubVersion } from "../utils/github-version";
|
||||
import { tabBarRef } from "../utils/global-refs";
|
||||
import { sleep } from "../utils/time";
|
||||
import { initializeLogger } from "../common/database/logger";
|
||||
|
||||
const onCheckSyncStatus = async (type: SyncStatusEvent) => {
|
||||
const { disableSync, disableAutoSync } = SettingsService.get();
|
||||
@@ -280,8 +281,108 @@ const onSubscriptionError = async (error: RNIap.PurchaseError) => {
|
||||
|
||||
const SodiumEventEmitter = new NativeEventEmitter(NativeModules.Sodium);
|
||||
|
||||
const doAppLoadActions = async () => {
|
||||
if (SettingsService.get().sessionExpired) {
|
||||
eSendEvent(eLoginSessionExpired);
|
||||
return;
|
||||
}
|
||||
notifee.setBadgeCount(0);
|
||||
|
||||
if (!(await db.user.getUser())) {
|
||||
setLoginMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
await useMessageStore.getState().setAnnouncement();
|
||||
if (NewFeature.present()) return;
|
||||
if (await checkAppUpdateAvailable()) return;
|
||||
if (await checkForRateAppRequest()) return;
|
||||
if (await PremiumService.getRemainingTrialDaysStatus()) return;
|
||||
if (SettingsService.get().introCompleted) {
|
||||
useMessageStore.subscribe((state) => {
|
||||
const dialogs = state.dialogs;
|
||||
if (dialogs.length > 0) {
|
||||
eSendEvent(eOpenAnnouncementDialog, dialogs[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const checkAppUpdateAvailable = async () => {
|
||||
if (__DEV__ || Config.isTesting === "true" || Config.FDROID_BUILD || BETA)
|
||||
return;
|
||||
try {
|
||||
const version =
|
||||
Config.GITHUB_RELEASE === "true"
|
||||
? await getGithubVersion()
|
||||
: await checkVersion();
|
||||
if (!version || !version?.needsUpdate) return false;
|
||||
|
||||
setUpdateAvailableMessage(version);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const checkForRateAppRequest = async () => {
|
||||
const rateApp = SettingsService.get().rateApp as number;
|
||||
if (
|
||||
rateApp &&
|
||||
rateApp < Date.now() &&
|
||||
!useMessageStore.getState().message?.visible
|
||||
) {
|
||||
setRateAppMessage();
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const IsDatabaseMigrationRequired = () => {
|
||||
if (!db.migrations.required() || useUserStore.getState().appLocked)
|
||||
return false;
|
||||
|
||||
presentSheet({
|
||||
component: <Migrate />,
|
||||
onClose: () => {
|
||||
if (!db.migrations.required()) {
|
||||
initializeDatabase();
|
||||
}
|
||||
},
|
||||
disableClosing: true
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
const initializeDatabase = async (password?: string) => {
|
||||
if (useUserStore.getState().appLocked) return;
|
||||
if (!db.isInitialized) {
|
||||
RNBootSplash.hide({ fade: true });
|
||||
DatabaseLogger.info("Initializing database");
|
||||
try {
|
||||
await setupDatabase(password);
|
||||
await db.init();
|
||||
} catch (e) {
|
||||
DatabaseLogger.error(e as Error);
|
||||
ToastManager.error(e as Error, "Error initializing database", "global");
|
||||
}
|
||||
}
|
||||
|
||||
if (IsDatabaseMigrationRequired()) return;
|
||||
|
||||
if (db.isInitialized) {
|
||||
Notifications.setupReminders(true);
|
||||
if (SettingsService.get().notifNotes) {
|
||||
Notifications.pinQuickNote(false);
|
||||
}
|
||||
useSettingStore.getState().setAppLoading(false);
|
||||
DatabaseLogger.info("Database initialized");
|
||||
}
|
||||
Walkthrough.init();
|
||||
};
|
||||
|
||||
export const useAppEvents = () => {
|
||||
const loading = useSettingStore((state) => state.isAppLoading);
|
||||
const isAppLoading = useSettingStore((state) => state.isAppLoading);
|
||||
const [setLastSynced, setUser, appLocked, syncing] = useUserStore((state) => [
|
||||
state.setLastSynced,
|
||||
state.setUser,
|
||||
@@ -312,7 +413,7 @@ export const useAppEvents = () => {
|
||||
}, [setLastSynced]);
|
||||
|
||||
useEffect(() => {
|
||||
if (loading) return;
|
||||
if (isAppLoading) return;
|
||||
|
||||
let subscriptions: EventManagerSubscription[] = [];
|
||||
const eventManager = db.eventManager;
|
||||
@@ -327,7 +428,7 @@ export const useAppEvents = () => {
|
||||
return () => {
|
||||
subscriptions.forEach((sub) => sub?.unsubscribe?.());
|
||||
};
|
||||
}, [loading, onSyncComplete]);
|
||||
}, [isAppLoading, onSyncComplete]);
|
||||
|
||||
const subscribeToPurchaseListeners = useCallback(async () => {
|
||||
if (Platform.OS === "android") {
|
||||
@@ -572,7 +673,7 @@ export const useAppEvents = () => {
|
||||
});
|
||||
}
|
||||
let sub: NativeEventSubscription;
|
||||
if (!loading && !appLocked) {
|
||||
if (!isAppLoading && !appLocked) {
|
||||
setTimeout(() => {
|
||||
sub = AppState.addEventListener("change", onAppStateChanged);
|
||||
if (
|
||||
@@ -594,7 +695,7 @@ export const useAppEvents = () => {
|
||||
sub?.remove();
|
||||
unsubscribePurchaseListeners();
|
||||
};
|
||||
}, [loading, appLocked, checkAutoBackup]);
|
||||
}, [isAppLoading, appLocked, checkAutoBackup]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!appLocked && !syncing && refValues.current.backupDidWait) {
|
||||
@@ -643,127 +744,22 @@ export const useAppEvents = () => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!loading) {
|
||||
if (!isAppLoading) {
|
||||
onUserUpdated();
|
||||
doAppLoadActions();
|
||||
}
|
||||
}, [loading, onUserUpdated]);
|
||||
|
||||
const initializeDatabase = useCallback(async (password?: string) => {
|
||||
const IsDatabaseMigrationRequired = () => {
|
||||
if (!db.migrations.required() || useUserStore.getState().appLocked)
|
||||
return false;
|
||||
|
||||
presentSheet({
|
||||
component: <Migrate />,
|
||||
onClose: () => {
|
||||
if (!db.migrations.required()) {
|
||||
initializeDatabase();
|
||||
}
|
||||
},
|
||||
disableClosing: true
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
if (useUserStore.getState().appLocked) return;
|
||||
if (!db.isInitialized) {
|
||||
RNBootSplash.hide({ fade: true });
|
||||
DatabaseLogger.info("Initializing database");
|
||||
try {
|
||||
await setupDatabase(password);
|
||||
await db.init();
|
||||
} catch (e) {
|
||||
DatabaseLogger.error(e as Error);
|
||||
ToastManager.error(e as Error, "Error initializing database", "global");
|
||||
}
|
||||
}
|
||||
|
||||
if (IsDatabaseMigrationRequired()) return;
|
||||
|
||||
if (db.isInitialized) {
|
||||
Notifications.setupReminders(true);
|
||||
if (SettingsService.get().notifNotes) {
|
||||
Notifications.pinQuickNote(false);
|
||||
}
|
||||
useSettingStore.getState().setAppLoading(false);
|
||||
DatabaseLogger.info("Database initialized");
|
||||
}
|
||||
Walkthrough.init();
|
||||
}, []);
|
||||
}, [isAppLoading, onUserUpdated]);
|
||||
|
||||
useEffect(() => {
|
||||
let sub: () => void;
|
||||
if (appLocked) {
|
||||
const sub = useUserStore.subscribe((state) => {
|
||||
if (!state.appLocked && useSettingStore.getState().isAppLoading) {
|
||||
console.log("DB initialized");
|
||||
if (!appLocked && isAppLoading) {
|
||||
initializeLogger()
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
//@ts-ignore
|
||||
initializeDatabase();
|
||||
sub();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return () => {
|
||||
sub?.();
|
||||
};
|
||||
}, [appLocked, initializeDatabase]);
|
||||
|
||||
return initializeDatabase;
|
||||
};
|
||||
|
||||
const doAppLoadActions = async () => {
|
||||
if (SettingsService.get().sessionExpired) {
|
||||
eSendEvent(eLoginSessionExpired);
|
||||
return;
|
||||
}
|
||||
notifee.setBadgeCount(0);
|
||||
|
||||
if (!(await db.user.getUser())) {
|
||||
setLoginMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
await useMessageStore.getState().setAnnouncement();
|
||||
if (NewFeature.present()) return;
|
||||
if (await checkAppUpdateAvailable()) return;
|
||||
if (await checkForRateAppRequest()) return;
|
||||
if (await PremiumService.getRemainingTrialDaysStatus()) return;
|
||||
if (SettingsService.get().introCompleted) {
|
||||
useMessageStore.subscribe((state) => {
|
||||
const dialogs = state.dialogs;
|
||||
if (dialogs.length > 0) {
|
||||
eSendEvent(eOpenAnnouncementDialog, dialogs[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const checkAppUpdateAvailable = async () => {
|
||||
if (__DEV__ || Config.isTesting === "true" || Config.FDROID_BUILD || BETA)
|
||||
return;
|
||||
try {
|
||||
const version =
|
||||
Config.GITHUB_RELEASE === "true"
|
||||
? await getGithubVersion()
|
||||
: await checkVersion();
|
||||
if (!version || !version?.needsUpdate) return false;
|
||||
|
||||
setUpdateAvailableMessage(version);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const checkForRateAppRequest = async () => {
|
||||
const rateApp = SettingsService.get().rateApp as number;
|
||||
if (
|
||||
rateApp &&
|
||||
rateApp < Date.now() &&
|
||||
!useMessageStore.getState().message?.visible
|
||||
) {
|
||||
setRateAppMessage();
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}, [appLocked, isAppLoading]);
|
||||
};
|
||||
|
||||
@@ -62,7 +62,6 @@ import {
|
||||
} from "../services/event-manager";
|
||||
import { useSettingStore } from "../stores/use-setting-store";
|
||||
import {
|
||||
eClearEditor,
|
||||
eCloseFullscreenEditor,
|
||||
eOnEnterEditor,
|
||||
eOnExitEditor,
|
||||
@@ -286,9 +285,10 @@ const _TabsHolder = () => {
|
||||
break;
|
||||
case "mobile":
|
||||
if (
|
||||
state &&
|
||||
!state?.movedAway &&
|
||||
useTabStore.getState().getCurrentNoteId()
|
||||
(state &&
|
||||
!state?.movedAway &&
|
||||
useTabStore.getState().getCurrentNoteId()) ||
|
||||
editorState().movedAway === false
|
||||
) {
|
||||
tabBarRef.current?.goToIndex(2, false);
|
||||
} else {
|
||||
|
||||
@@ -475,7 +475,7 @@ export const settingsGroups: SettingSection[] = [
|
||||
{
|
||||
id: "pull-sync",
|
||||
name: "Force pull changes",
|
||||
description: `Use this if some changes are not appearing on this device from other devices. This will pull everything from the server and overwrite with whatever is one this device.\n\nThese must only be used for troubleshooting. Using them regularly for sync is not recommended and will lead to unexpected data loss and other issues. If you are having persistent issues with sync, please report them to us at support@streetwriters.co.`,
|
||||
description: `Use this if changes from other devices are not appearing on this device. This will overwrite the data on this device with the latest data from the server.\n\nThis must only be used for troubleshooting. Using it regularly for sync is not recommended and will lead to unexpected data loss and other issues. If you are having persistent issues with sync, please report them to us at support@streetwriters.co.`,
|
||||
modifer: () => {
|
||||
presentDialog({
|
||||
title: "Force Pull changes",
|
||||
@@ -497,7 +497,7 @@ export const settingsGroups: SettingSection[] = [
|
||||
{
|
||||
id: "push-sync",
|
||||
name: "Force push changes",
|
||||
description: `Use this if some changes are not appearing on this device from other devices. This will pull everything from the server and overwrite with whatever is one this device.`,
|
||||
description: `Use this if changes made on this device are not appearing on other devices. This will overwrite the data on the server with the data from this device.\n\nThis must only be used for troubleshooting. Using it regularly for sync is not recommended and will lead to unexpected data loss and other issues. If you are having persistent issues with sync, please report them to us at support@streetwriters.co.`,
|
||||
modifer: () => {
|
||||
presentDialog({
|
||||
title: "Force Push changes",
|
||||
|
||||
@@ -141,7 +141,6 @@ const onBoot = async () => {
|
||||
}
|
||||
|
||||
await Notifications.setupReminders();
|
||||
SettingsService.init();
|
||||
if (SettingsService.get().notifNotes) {
|
||||
Notifications.pinQuickNote(false);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,6 @@ async function run(progress = false, context) {
|
||||
}
|
||||
|
||||
let path;
|
||||
let backupFilePath;
|
||||
let backupFileName = "notesnook_backup_" + Date.now();
|
||||
|
||||
if (Platform.OS === "ios") {
|
||||
@@ -236,7 +235,7 @@ async function run(progress = false, context) {
|
||||
await sleep(300);
|
||||
|
||||
if (showBackupCompleteSheet) {
|
||||
presentBackupCompleteSheet(backupFilePath);
|
||||
presentBackupCompleteSheet(path);
|
||||
} else {
|
||||
progress && eSendEvent(eCloseSheet);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Platform } from "react-native";
|
||||
import { NativeModules, Platform } from "react-native";
|
||||
import { enabled } from "react-native-privacy-snapshot";
|
||||
import { MMKV } from "../common/database/mmkv";
|
||||
import {
|
||||
@@ -118,14 +118,18 @@ function setPrivacyScreen(settings: SettingStore["settings"]) {
|
||||
NotesnookModule.setSecureMode(true);
|
||||
} else {
|
||||
enabled(true);
|
||||
ScreenGuardModule.register({ backgroundColor: "#000000" });
|
||||
if (NativeModules.ScreenGuard) {
|
||||
ScreenGuardModule.register({ backgroundColor: "#000000" });
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Platform.OS === "android") {
|
||||
NotesnookModule.setSecureMode(false);
|
||||
} else {
|
||||
enabled(false);
|
||||
ScreenGuardModule.unregister();
|
||||
if (NativeModules.ScreenGuard) {
|
||||
ScreenGuardModule.unregister();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Profile } from "@notesnook/core";
|
||||
import { User } from "@notesnook/core";
|
||||
import { Profile, User } from "@notesnook/core";
|
||||
import create, { State } from "zustand";
|
||||
|
||||
export enum SyncStatus {
|
||||
@@ -56,7 +55,9 @@ export const useUserStore = create<UserStore>((set) => ({
|
||||
set({ syncing: syncing, lastSyncStatus: status });
|
||||
},
|
||||
setLastSynced: (lastSynced) => set({ lastSynced: lastSynced }),
|
||||
lockApp: (appLocked) => set({ appLocked }),
|
||||
lockApp: (appLocked) => {
|
||||
set({ appLocked });
|
||||
},
|
||||
lastSyncStatus: SyncStatus.Never,
|
||||
disableAppLockRequests: false,
|
||||
setDisableAppLockRequests: (disableAppLockRequests) => {
|
||||
|
||||
@@ -111,7 +111,7 @@ android {
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
multiDexEnabled true
|
||||
versionCode 3018
|
||||
versionCode 3020
|
||||
versionName getNpmVersion()
|
||||
testBuildType System.getProperty('testBuildType', 'debug')
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
- Fixed realtime sync issues
|
||||
- Fixed color popups not opening from main toolbar
|
||||
- Bug fixes and performance improvements
|
||||
|
||||
Thank you for using Notesnook!
|
||||
@@ -21,9 +21,9 @@
|
||||
6517B7C32B6838EB0079FF37 /* OpenSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7C02B6838EB0079FF37 /* OpenSans-Bold.ttf */; };
|
||||
6529A13E279BC4C70048D4A8 /* BootSplash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6529A13D279BC4C70048D4A8 /* BootSplash.storyboard */; };
|
||||
656835812BB29A9800144BAB /* OpenSans-Italic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 656835802BB29A8300144BAB /* OpenSans-Italic.ttf */; };
|
||||
656DD2AB2B1891DF00A362EA /* BuildFile in Resources */ = {isa = PBXBuildFile; };
|
||||
656DD2AC2B1891DF00A362EA /* BuildFile in Resources */ = {isa = PBXBuildFile; };
|
||||
656DD2AD2B1891DF00A362EA /* BuildFile in Resources */ = {isa = PBXBuildFile; };
|
||||
6569927F2C5754F10041CD41 /* OpenSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7C02B6838EB0079FF37 /* OpenSans-Bold.ttf */; };
|
||||
656992802C5754F10041CD41 /* OpenSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7BE2B6838EB0079FF37 /* OpenSans-Regular.ttf */; };
|
||||
656992812C5754F10041CD41 /* OpenSans-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7BF2B6838EB0079FF37 /* OpenSans-SemiBold.ttf */; };
|
||||
6593E4A3281C345400492C50 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6593E4A2281C345400492C50 /* AppDelegate.mm */; };
|
||||
659BE46725E11A5100E05671 /* notesnook-text.png in Resources */ = {isa = PBXBuildFile; fileRef = 659BE46625E11A5100E05671 /* notesnook-text.png */; };
|
||||
65AA857925E6DDEC00772A01 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65AA857825E6DDEC00772A01 /* WidgetKit.framework */; };
|
||||
@@ -586,9 +586,9 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
656DD2AB2B1891DF00A362EA /* BuildFile in Resources */,
|
||||
656DD2AC2B1891DF00A362EA /* BuildFile in Resources */,
|
||||
656DD2AD2B1891DF00A362EA /* BuildFile in Resources */,
|
||||
6569927F2C5754F10041CD41 /* OpenSans-Bold.ttf in Resources */,
|
||||
656992802C5754F10041CD41 /* OpenSans-Regular.ttf in Resources */,
|
||||
656992812C5754F10041CD41 /* OpenSans-SemiBold.ttf in Resources */,
|
||||
65C400DF2A80B6B600AA3DF5 /* MaterialCommunityIcons.ttf in Resources */,
|
||||
65C149872A61151B005C40F1 /* extension.bundle in Resources */,
|
||||
65B5014725A672B200E2D264 /* MainInterface.storyboard in Resources */,
|
||||
@@ -1015,7 +1015,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 2107;
|
||||
CURRENT_PROJECT_VERSION = 2109;
|
||||
DEVELOPMENT_TEAM = 53CWBG3QUC;
|
||||
ENABLE_BITCODE = NO;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
|
||||
@@ -1089,7 +1089,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 3.0.10;
|
||||
MARKETING_VERSION = 3.0.12;
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
"-ObjC",
|
||||
@@ -1120,7 +1120,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
CURRENT_PROJECT_VERSION = 2107;
|
||||
CURRENT_PROJECT_VERSION = 2109;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
|
||||
@@ -1194,7 +1194,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 3.0.10;
|
||||
MARKETING_VERSION = 3.0.12;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
@@ -1353,7 +1353,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 2107;
|
||||
CURRENT_PROJECT_VERSION = 2109;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = 53CWBG3QUC;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
|
||||
@@ -1365,7 +1365,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 3.0.10;
|
||||
MARKETING_VERSION = 3.0.12;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.notewidget;
|
||||
@@ -1396,7 +1396,7 @@
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 2107;
|
||||
CURRENT_PROJECT_VERSION = 2109;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = "";
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;
|
||||
@@ -1409,7 +1409,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 3.0.10;
|
||||
MARKETING_VERSION = 3.0.12;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.notewidget;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -1439,7 +1439,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = "Make Note/Make Note.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 2107;
|
||||
CURRENT_PROJECT_VERSION = 2109;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = 53CWBG3QUC;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
|
||||
@@ -1513,7 +1513,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 3.0.10;
|
||||
MARKETING_VERSION = 3.0.12;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.share;
|
||||
@@ -1544,7 +1544,7 @@
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 2107;
|
||||
CURRENT_PROJECT_VERSION = 2109;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = "";
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;
|
||||
@@ -1619,7 +1619,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 3.0.10;
|
||||
MARKETING_VERSION = 3.0.12;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.share;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
||||
@@ -971,4 +971,4 @@ SPEC CHECKSUMS:
|
||||
|
||||
PODFILE CHECKSUM: 2b8b28a341b202bf3ca5f231b75bb05893486ed8
|
||||
|
||||
COCOAPODS: 1.14.2
|
||||
COCOAPODS: 1.15.2
|
||||
|
||||
118
apps/mobile/package-lock.json
generated
118
apps/mobile/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@notesnook/mobile",
|
||||
"version": "3.0.9",
|
||||
"version": "3.0.11",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@notesnook/mobile",
|
||||
"version": "3.0.9",
|
||||
"version": "3.0.11",
|
||||
"hasInstallScript": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"workspaces": [
|
||||
@@ -34,7 +34,7 @@
|
||||
},
|
||||
"../../packages/common": {
|
||||
"name": "@notesnook/common",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.7",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@notesnook/core": "^8.0.0",
|
||||
@@ -114,7 +114,7 @@
|
||||
},
|
||||
"../../packages/core": {
|
||||
"name": "@notesnook/core",
|
||||
"version": "8.0.2",
|
||||
"version": "8.0.8",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
@@ -3121,7 +3121,7 @@
|
||||
},
|
||||
"../../packages/crypto": {
|
||||
"name": "@notesnook/crypto",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.7",
|
||||
"dev": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
@@ -3135,7 +3135,7 @@
|
||||
},
|
||||
"../../packages/editor": {
|
||||
"name": "@notesnook/editor",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.7",
|
||||
"hasInstallScript": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
@@ -7163,7 +7163,7 @@
|
||||
},
|
||||
"../../packages/editor-mobile/node_modules/@types/prop-types": {
|
||||
"version": "15.7.11",
|
||||
"devOptional": true,
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"../../packages/editor-mobile/node_modules/@types/q": {
|
||||
@@ -7183,7 +7183,7 @@
|
||||
},
|
||||
"../../packages/editor-mobile/node_modules/@types/react": {
|
||||
"version": "18.2.39",
|
||||
"devOptional": true,
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/prop-types": "*",
|
||||
@@ -7214,7 +7214,7 @@
|
||||
},
|
||||
"../../packages/editor-mobile/node_modules/@types/scheduler": {
|
||||
"version": "0.16.8",
|
||||
"devOptional": true,
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"../../packages/editor-mobile/node_modules/@types/semver": {
|
||||
@@ -12072,7 +12072,7 @@
|
||||
},
|
||||
"../../packages/editor-mobile/node_modules/immer": {
|
||||
"version": "9.0.21",
|
||||
"devOptional": true,
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
@@ -22461,6 +22461,7 @@
|
||||
},
|
||||
"../../packages/editor/node_modules/js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"../../packages/editor/node_modules/json-parse-even-better-errors": {
|
||||
@@ -22516,6 +22517,7 @@
|
||||
},
|
||||
"../../packages/editor/node_modules/loose-envify": {
|
||||
"version": "1.4.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"js-tokens": "^3.0.0 || ^4.0.0"
|
||||
@@ -23037,6 +23039,7 @@
|
||||
},
|
||||
"../../packages/editor/node_modules/react": {
|
||||
"version": "18.2.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.1.0"
|
||||
@@ -23055,6 +23058,7 @@
|
||||
},
|
||||
"../../packages/editor/node_modules/react-dom": {
|
||||
"version": "18.2.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.1.0",
|
||||
@@ -23174,6 +23178,7 @@
|
||||
},
|
||||
"../../packages/editor/node_modules/scheduler": {
|
||||
"version": "0.23.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.1.0"
|
||||
@@ -23795,13 +23800,13 @@
|
||||
},
|
||||
"../../packages/logger": {
|
||||
"name": "@notesnook/logger",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.7",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"devDependencies": {}
|
||||
},
|
||||
"../../packages/sodium": {
|
||||
"name": "@notesnook/sodium",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.7",
|
||||
"dev": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"devDependencies": {
|
||||
@@ -25173,7 +25178,7 @@
|
||||
},
|
||||
"../../packages/theme": {
|
||||
"name": "@notesnook/theme",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.7",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"devDependencies": {
|
||||
"@emotion/react": "11.11.1",
|
||||
@@ -26240,7 +26245,7 @@
|
||||
},
|
||||
"../../packages/ui": {
|
||||
"name": "@notesnook/ui",
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.8",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@notesnook/theme": "file:../theme"
|
||||
@@ -30892,6 +30897,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
@@ -30905,6 +30911,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
@@ -31051,6 +31058,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-proposal-private-property-in-object": {
|
||||
"version": "7.21.0-placeholder-for-preset-env.2",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -31061,6 +31069,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-proposal-unicode-property-regex": {
|
||||
"version": "7.18.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-create-regexp-features-plugin": "^7.18.6",
|
||||
@@ -31106,6 +31115,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-syntax-class-static-block": {
|
||||
"version": "7.14.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.14.5"
|
||||
@@ -31142,6 +31152,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-syntax-export-namespace-from": {
|
||||
"version": "7.8.3",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.8.3"
|
||||
@@ -31165,6 +31176,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-syntax-import-assertions": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
@@ -31178,6 +31190,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-syntax-import-attributes": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
@@ -31191,6 +31204,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-syntax-import-meta": {
|
||||
"version": "7.10.4",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.10.4"
|
||||
@@ -31201,6 +31215,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-syntax-json-strings": {
|
||||
"version": "7.8.3",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.8.0"
|
||||
@@ -31224,6 +31239,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-syntax-logical-assignment-operators": {
|
||||
"version": "7.10.4",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.10.4"
|
||||
@@ -31284,6 +31300,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-syntax-private-property-in-object": {
|
||||
"version": "7.14.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.14.5"
|
||||
@@ -31297,6 +31314,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-syntax-top-level-await": {
|
||||
"version": "7.14.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.14.5"
|
||||
@@ -31323,6 +31341,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-syntax-unicode-sets-regex": {
|
||||
"version": "7.18.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-create-regexp-features-plugin": "^7.18.6",
|
||||
@@ -31350,6 +31369,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-async-generator-functions": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-environment-visitor": "^7.22.5",
|
||||
@@ -31407,6 +31427,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-class-properties": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-create-class-features-plugin": "^7.22.5",
|
||||
@@ -31421,6 +31442,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-class-static-block": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-create-class-features-plugin": "^7.22.5",
|
||||
@@ -31484,6 +31506,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-dotall-regex": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-create-regexp-features-plugin": "^7.22.5",
|
||||
@@ -31498,6 +31521,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-duplicate-keys": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
@@ -31511,6 +31535,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-dynamic-import": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
@@ -31539,6 +31564,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-export-namespace-from": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
@@ -31595,6 +31621,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-json-strings": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
@@ -31622,6 +31649,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-logical-assignment-operators": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
@@ -31649,6 +31677,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-modules-amd": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-module-transforms": "^7.22.5",
|
||||
@@ -31678,6 +31707,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-modules-systemjs": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-hoist-variables": "^7.22.5",
|
||||
@@ -31694,6 +31724,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-modules-umd": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-module-transforms": "^7.22.5",
|
||||
@@ -31722,6 +31753,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-new-target": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
@@ -31735,6 +31767,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-nullish-coalescing-operator": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
@@ -31749,6 +31782,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-numeric-separator": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
@@ -31776,6 +31810,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-object-rest-spread": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/compat-data": "^7.22.5",
|
||||
@@ -31807,6 +31842,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-optional-catch-binding": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
@@ -31821,6 +31857,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-optional-chaining": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
@@ -31849,6 +31886,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-private-methods": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-create-class-features-plugin": "^7.22.5",
|
||||
@@ -31863,6 +31901,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-private-property-in-object": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-annotate-as-pure": "^7.22.5",
|
||||
@@ -31962,6 +32001,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-reserved-words": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
@@ -32053,6 +32093,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-typeof-symbol": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
@@ -32082,6 +32123,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-unicode-escapes": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
@@ -32095,6 +32137,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-unicode-property-regex": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-create-regexp-features-plugin": "^7.22.5",
|
||||
@@ -32123,6 +32166,7 @@
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-unicode-sets-regex": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-create-regexp-features-plugin": "^7.22.5",
|
||||
@@ -32137,6 +32181,7 @@
|
||||
},
|
||||
"node_modules/@babel/preset-env": {
|
||||
"version": "7.22.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/compat-data": "^7.22.5",
|
||||
@@ -32229,6 +32274,7 @@
|
||||
},
|
||||
"node_modules/@babel/preset-env/node_modules/semver": {
|
||||
"version": "6.3.0",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
@@ -32251,6 +32297,7 @@
|
||||
},
|
||||
"node_modules/@babel/preset-modules": {
|
||||
"version": "0.1.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.0.0",
|
||||
@@ -34900,6 +34947,7 @@
|
||||
},
|
||||
"node_modules/@types/eslint": {
|
||||
"version": "8.40.2",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/estree": "*",
|
||||
@@ -34908,6 +34956,7 @@
|
||||
},
|
||||
"node_modules/@types/eslint-scope": {
|
||||
"version": "3.7.4",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/eslint": "*",
|
||||
@@ -34916,6 +34965,7 @@
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.1",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/graceful-fs": {
|
||||
@@ -35364,6 +35414,7 @@
|
||||
},
|
||||
"node_modules/@webassemblyjs/ast": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/helper-numbers": "1.11.6",
|
||||
@@ -35372,18 +35423,22 @@
|
||||
},
|
||||
"node_modules/@webassemblyjs/floating-point-hex-parser": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@webassemblyjs/helper-api-error": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@webassemblyjs/helper-buffer": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@webassemblyjs/helper-numbers": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/floating-point-hex-parser": "1.11.6",
|
||||
@@ -35393,10 +35448,12 @@
|
||||
},
|
||||
"node_modules/@webassemblyjs/helper-wasm-bytecode": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@webassemblyjs/helper-wasm-section": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.11.6",
|
||||
@@ -35407,6 +35464,7 @@
|
||||
},
|
||||
"node_modules/@webassemblyjs/ieee754": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@xtuc/ieee754": "^1.2.0"
|
||||
@@ -35414,6 +35472,7 @@
|
||||
},
|
||||
"node_modules/@webassemblyjs/leb128": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@xtuc/long": "4.2.2"
|
||||
@@ -35421,10 +35480,12 @@
|
||||
},
|
||||
"node_modules/@webassemblyjs/utf8": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@webassemblyjs/wasm-edit": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.11.6",
|
||||
@@ -35439,6 +35500,7 @@
|
||||
},
|
||||
"node_modules/@webassemblyjs/wasm-gen": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.11.6",
|
||||
@@ -35450,6 +35512,7 @@
|
||||
},
|
||||
"node_modules/@webassemblyjs/wasm-opt": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.11.6",
|
||||
@@ -35460,6 +35523,7 @@
|
||||
},
|
||||
"node_modules/@webassemblyjs/wasm-parser": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.11.6",
|
||||
@@ -35472,6 +35536,7 @@
|
||||
},
|
||||
"node_modules/@webassemblyjs/wast-printer": {
|
||||
"version": "1.11.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.11.6",
|
||||
@@ -35529,10 +35594,12 @@
|
||||
},
|
||||
"node_modules/@xtuc/ieee754": {
|
||||
"version": "1.2.0",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/@xtuc/long": {
|
||||
"version": "4.2.2",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/@yarnpkg/lockfile": {
|
||||
@@ -35588,6 +35655,7 @@
|
||||
},
|
||||
"node_modules/acorn-import-assertions": {
|
||||
"version": "1.9.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"acorn": "^8"
|
||||
@@ -36692,6 +36760,7 @@
|
||||
},
|
||||
"node_modules/chrome-trace-event": {
|
||||
"version": "1.0.3",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
@@ -37792,6 +37861,7 @@
|
||||
},
|
||||
"node_modules/enhanced-resolve": {
|
||||
"version": "5.15.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.2.4",
|
||||
@@ -37904,6 +37974,7 @@
|
||||
},
|
||||
"node_modules/es-module-lexer": {
|
||||
"version": "1.3.0",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/es-set-tostringtag": {
|
||||
@@ -38234,6 +38305,7 @@
|
||||
},
|
||||
"node_modules/eslint-scope": {
|
||||
"version": "5.1.1",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"esrecurse": "^4.3.0",
|
||||
@@ -38245,6 +38317,7 @@
|
||||
},
|
||||
"node_modules/eslint-scope/node_modules/estraverse": {
|
||||
"version": "4.3.0",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
@@ -38430,6 +38503,7 @@
|
||||
},
|
||||
"node_modules/esrecurse": {
|
||||
"version": "4.3.0",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"estraverse": "^5.2.0"
|
||||
@@ -38440,6 +38514,7 @@
|
||||
},
|
||||
"node_modules/estraverse": {
|
||||
"version": "5.3.0",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
@@ -38447,6 +38522,7 @@
|
||||
},
|
||||
"node_modules/esutils": {
|
||||
"version": "2.0.3",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
@@ -39503,6 +39579,7 @@
|
||||
},
|
||||
"node_modules/glob-to-regexp": {
|
||||
"version": "0.4.1",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause"
|
||||
},
|
||||
"node_modules/global": {
|
||||
@@ -41746,6 +41823,7 @@
|
||||
},
|
||||
"node_modules/json-parse-even-better-errors": {
|
||||
"version": "2.3.1",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/json-schema-traverse": {
|
||||
@@ -42013,6 +42091,7 @@
|
||||
},
|
||||
"node_modules/loader-runner": {
|
||||
"version": "4.3.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.11.5"
|
||||
@@ -44664,6 +44743,7 @@
|
||||
},
|
||||
"node_modules/randombytes": {
|
||||
"version": "2.1.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.1.0"
|
||||
@@ -45448,6 +45528,7 @@
|
||||
},
|
||||
"node_modules/react-test-renderer": {
|
||||
"version": "18.2.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"react-is": "^18.2.0",
|
||||
@@ -45460,10 +45541,12 @@
|
||||
},
|
||||
"node_modules/react-test-renderer/node_modules/react-is": {
|
||||
"version": "18.2.0",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/react-test-renderer/node_modules/scheduler": {
|
||||
"version": "0.23.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.1.0"
|
||||
@@ -46299,6 +46382,7 @@
|
||||
},
|
||||
"node_modules/serialize-javascript": {
|
||||
"version": "6.0.1",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"randombytes": "^2.1.0"
|
||||
@@ -47354,6 +47438,7 @@
|
||||
},
|
||||
"node_modules/terser-webpack-plugin": {
|
||||
"version": "5.3.9",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "^0.3.17",
|
||||
@@ -47386,6 +47471,7 @@
|
||||
},
|
||||
"node_modules/terser-webpack-plugin/node_modules/jest-worker": {
|
||||
"version": "27.5.1",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
@@ -47398,6 +47484,7 @@
|
||||
},
|
||||
"node_modules/terser-webpack-plugin/node_modules/supports-color": {
|
||||
"version": "8.1.1",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
@@ -48142,6 +48229,7 @@
|
||||
},
|
||||
"node_modules/watchpack": {
|
||||
"version": "2.4.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"glob-to-regexp": "^0.4.1",
|
||||
@@ -48164,6 +48252,7 @@
|
||||
},
|
||||
"node_modules/webpack": {
|
||||
"version": "5.88.2",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/eslint-scope": "^3.7.3",
|
||||
@@ -48278,6 +48367,7 @@
|
||||
},
|
||||
"node_modules/webpack-sources": {
|
||||
"version": "3.2.3",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@notesnook/mobile",
|
||||
"version": "3.0.10",
|
||||
"version": "3.0.12",
|
||||
"private": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"workspaces": [
|
||||
|
||||
46
apps/theme-builder/package-lock.json
generated
46
apps/theme-builder/package-lock.json
generated
@@ -134,15 +134,15 @@
|
||||
},
|
||||
"../../packages/common": {
|
||||
"name": "@notesnook/common",
|
||||
"version": "1.0.0",
|
||||
"version": "2.0.7",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@notesnook/core": "file:../core",
|
||||
"@notesnook/core": "^8.0.0",
|
||||
"pathe": "^1.1.2",
|
||||
"timeago.js": "4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@notesnook/core": "file:../core",
|
||||
"@notesnook/core": "^8.0.0",
|
||||
"@types/react": "^18.2.39",
|
||||
"react": "18.2.0",
|
||||
"vitest": "^1.4.0"
|
||||
@@ -330,7 +330,7 @@
|
||||
},
|
||||
"../../packages/theme": {
|
||||
"name": "@notesnook/theme",
|
||||
"version": "1.2.0",
|
||||
"version": "2.0.7",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"devDependencies": {
|
||||
"@emotion/react": "11.11.1",
|
||||
@@ -979,7 +979,7 @@
|
||||
},
|
||||
"../web": {
|
||||
"name": "@notesnook/web",
|
||||
"version": "3.0.6",
|
||||
"version": "3.0.13",
|
||||
"hasInstallScript": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
@@ -1029,12 +1029,12 @@
|
||||
"framer-motion": "^10.16.8",
|
||||
"hash-wasm": "^4.9.0",
|
||||
"hotkeys-js": "^3.8.3",
|
||||
"immer": "^10.0.3",
|
||||
"katex": "0.16.2",
|
||||
"kysely": "^0.26.3",
|
||||
"libsodium-wrappers": "^0.7.13",
|
||||
"mac-scrollbar": "^0.13.5",
|
||||
"marked": "^4.1.0",
|
||||
"mutative": "^1.0.6",
|
||||
"pdfjs-dist": "3.6.172",
|
||||
"phone": "^3.1.14",
|
||||
"platform": "^1.3.6",
|
||||
@@ -1059,12 +1059,14 @@
|
||||
"w3c-keyname": "^2.2.6",
|
||||
"web-streams-polyfill": "^3.1.1",
|
||||
"wouter": "2.12.1",
|
||||
"zustand": "4.4.7"
|
||||
"zustand": "4.4.7",
|
||||
"zustand-mutative": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.22.5",
|
||||
"@playwright/test": "^1.43.1",
|
||||
"@swc/core": "1.3.61",
|
||||
"@swc/core": "^1.5.24",
|
||||
"@swc/plugin-react-remove-properties": "^2.0.4",
|
||||
"@trpc/server": "10.38.3",
|
||||
"@types/babel__core": "^7.20.1",
|
||||
"@types/event-source-polyfill": "^1.0.1",
|
||||
@@ -1079,8 +1081,8 @@
|
||||
"@types/react-scroll-sync": "^0.9.0",
|
||||
"@types/tinycolor2": "^1.4.3",
|
||||
"@types/wicg-file-system-access": "^2020.9.6",
|
||||
"@vitejs/plugin-react-swc": "3.3.2",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"@vitejs/plugin-react-swc": "^3.7.0",
|
||||
"autoprefixer": "^10.4.19",
|
||||
"better-sqlite3-multiple-ciphers": "^9.4.0",
|
||||
"buffer": "^6.0.3",
|
||||
"chalk": "^4.1.0",
|
||||
@@ -1091,14 +1093,13 @@
|
||||
"ip": "^1.1.8",
|
||||
"lorem-ipsum": "^2.0.4",
|
||||
"otplib": "^12.0.1",
|
||||
"rollup": "^3.29.4",
|
||||
"rollup-plugin-visualizer": "^5.9.2",
|
||||
"swc-plugin-react-remove-properties": "^0.1.4",
|
||||
"vite": "^4.5.0",
|
||||
"vite-plugin-env-compatible": "^1.1.1",
|
||||
"vite-plugin-pwa": "^0.16.3",
|
||||
"vite-plugin-svgr": "^3.2.0",
|
||||
"vitest": "^0.34.6",
|
||||
"rollup": "^4.18.0",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"vite": "^5.2.12",
|
||||
"vite-plugin-env-compatible": "^2.0.1",
|
||||
"vite-plugin-pwa": "^0.20.0",
|
||||
"vite-plugin-svgr": "^4.2.0",
|
||||
"vitest": "^1.6.0",
|
||||
"workbox-core": "^7.0.0",
|
||||
"workbox-expiration": "^7.0.0",
|
||||
"workbox-precaching": "^7.0.0",
|
||||
@@ -2027,15 +2028,6 @@
|
||||
"@trpc/server": "10.38.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@trpc/server": {
|
||||
"version": "10.38.3",
|
||||
"resolved": "https://registry.npmjs.org/@trpc/server/-/server-10.38.3.tgz",
|
||||
"integrity": "sha512-9s8/kwo2IDB5hwB2SKZZrfevRhdb1f9fdXtIYd3lbQuf2jQaC/LyQuHaIQjDQoUx9updBfsHXcFFPiCP1DL6pg==",
|
||||
"funding": [
|
||||
"https://trpc.io/sponsor"
|
||||
],
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@types/babel__core": {
|
||||
"version": "7.20.1",
|
||||
"dev": true,
|
||||
|
||||
2
apps/vericrypt/package-lock.json
generated
2
apps/vericrypt/package-lock.json
generated
@@ -33,7 +33,7 @@
|
||||
},
|
||||
"../../packages/crypto": {
|
||||
"name": "@notesnook/crypto",
|
||||
"version": "1.1.1",
|
||||
"version": "2.0.7",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@notesnook/sodium": "file:../sodium"
|
||||
|
||||
1266
apps/web/package-lock.json
generated
1266
apps/web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@notesnook/web",
|
||||
"description": "Your private note taking space",
|
||||
"version": "3.0.9",
|
||||
"version": "3.0.13",
|
||||
"private": true,
|
||||
"main": "./src/app.js",
|
||||
"homepage": "https://notesnook.com/",
|
||||
@@ -54,12 +54,12 @@
|
||||
"framer-motion": "^10.16.8",
|
||||
"hash-wasm": "^4.9.0",
|
||||
"hotkeys-js": "^3.8.3",
|
||||
"immer": "^10.0.3",
|
||||
"katex": "0.16.2",
|
||||
"kysely": "^0.26.3",
|
||||
"libsodium-wrappers": "^0.7.13",
|
||||
"mac-scrollbar": "^0.13.5",
|
||||
"marked": "^4.1.0",
|
||||
"mutative": "^1.0.6",
|
||||
"pdfjs-dist": "3.6.172",
|
||||
"phone": "^3.1.14",
|
||||
"platform": "^1.3.6",
|
||||
@@ -84,7 +84,8 @@
|
||||
"w3c-keyname": "^2.2.6",
|
||||
"web-streams-polyfill": "^3.1.1",
|
||||
"wouter": "2.12.1",
|
||||
"zustand": "4.4.7"
|
||||
"zustand": "4.4.7",
|
||||
"zustand-mutative": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.22.5",
|
||||
|
||||
@@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import React, { useEffect } from "react";
|
||||
import { useStore } from "./stores/app-store";
|
||||
import { useStore as useUserStore } from "./stores/user-store";
|
||||
import { useStore as useAttachmentStore } from "./stores/attachment-store";
|
||||
import { useEditorStore } from "./stores/editor-store";
|
||||
import { useStore as useAnnouncementStore } from "./stores/announcement-store";
|
||||
import { resetNotices, scheduleBackups } from "./common/notices";
|
||||
@@ -30,17 +29,17 @@ import { db } from "./common/db";
|
||||
import { EV, EVENTS } from "@notesnook/core/dist/common";
|
||||
import { registerKeyMap } from "./common/key-map";
|
||||
import { isUserPremium } from "./hooks/use-is-user-premium";
|
||||
import {
|
||||
showAnnouncementDialog,
|
||||
showBuyDialog,
|
||||
showFeatureDialog,
|
||||
showOnboardingDialog
|
||||
} from "./common/dialog-controller";
|
||||
import { updateStatus, removeStatus, getStatus } from "./hooks/use-status";
|
||||
import { showToast } from "./utils/toast";
|
||||
import { interruptedOnboarding } from "./dialogs/onboarding-dialog";
|
||||
import {
|
||||
interruptedOnboarding,
|
||||
OnboardingDialog
|
||||
} from "./dialogs/onboarding-dialog";
|
||||
import { hashNavigate } from "./navigation";
|
||||
import { desktop } from "./common/desktop-bridge";
|
||||
import { BuyDialog } from "./dialogs/buy-dialog";
|
||||
import { FeatureDialog } from "./dialogs/feature-dialog";
|
||||
import { AnnouncementDialog } from "./dialogs/announcement-dialog";
|
||||
|
||||
type AppEffectsProps = {
|
||||
setShow: (show: boolean) => void;
|
||||
@@ -51,7 +50,6 @@ export default function AppEffects({ setShow }: AppEffectsProps) {
|
||||
const isFocusMode = useStore((store) => store.isFocusMode);
|
||||
const initUser = useUserStore((store) => store.init);
|
||||
const initStore = useStore((store) => store.init);
|
||||
const initAttachments = useAttachmentStore((store) => store.init);
|
||||
const setIsVaultCreated = useStore((store) => store.setIsVaultCreated);
|
||||
const initEditorStore = useEditorStore((store) => store.init);
|
||||
const dialogAnnouncements = useAnnouncementStore(
|
||||
@@ -69,7 +67,7 @@ export default function AppEffects({ setShow }: AppEffectsProps) {
|
||||
showToast(
|
||||
"error",
|
||||
"Please upgrade your account to Pro to use this feature.",
|
||||
[{ text: "Upgrade now", onClick: () => showBuyDialog() }]
|
||||
[{ text: "Upgrade now", onClick: () => BuyDialog.show({}) }]
|
||||
);
|
||||
return { type, result: false };
|
||||
}
|
||||
@@ -77,7 +75,6 @@ export default function AppEffects({ setShow }: AppEffectsProps) {
|
||||
);
|
||||
|
||||
initStore();
|
||||
initAttachments();
|
||||
initEditorStore();
|
||||
|
||||
(async function () {
|
||||
@@ -89,8 +86,9 @@ export default function AppEffects({ setShow }: AppEffectsProps) {
|
||||
await resetNotices();
|
||||
setIsVaultCreated(await db.vault.exists());
|
||||
|
||||
await showOnboardingDialog(interruptedOnboarding());
|
||||
await showFeatureDialog("highlights");
|
||||
const onboardingKey = interruptedOnboarding();
|
||||
if (onboardingKey) await OnboardingDialog.show({ type: onboardingKey });
|
||||
await FeatureDialog.show({ featureName: "highlights" });
|
||||
await scheduleBackups();
|
||||
})();
|
||||
|
||||
@@ -101,7 +99,6 @@ export default function AppEffects({ setShow }: AppEffectsProps) {
|
||||
[
|
||||
initEditorStore,
|
||||
initStore,
|
||||
initAttachments,
|
||||
updateLastSynced,
|
||||
refreshNavItems,
|
||||
initUser,
|
||||
@@ -224,7 +221,7 @@ export default function AppEffects({ setShow }: AppEffectsProps) {
|
||||
useEffect(() => {
|
||||
if (!dialogAnnouncements.length || IS_TESTING) return;
|
||||
(async () => {
|
||||
await showAnnouncementDialog(dialogAnnouncements[0]);
|
||||
await AnnouncementDialog.show({ announcement: dialogAnnouncements[0] });
|
||||
})();
|
||||
}, [dialogAnnouncements]);
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import { EventSourcePolyfill as EventSource } from "event-source-polyfill";
|
||||
import { DatabasePersistence, NNStorage } from "../interfaces/storage";
|
||||
import { logger } from "../utils/logger";
|
||||
import { showMigrationDialog } from "./dialog-controller";
|
||||
import { database } from "@notesnook/common";
|
||||
import { createDialect } from "./sqlite";
|
||||
import { isFeatureSupported } from "../utils/feature-check";
|
||||
@@ -56,22 +55,29 @@ async function initializeDatabase(persistence: DatabasePersistence) {
|
||||
);
|
||||
await storage.migrate();
|
||||
|
||||
const multiTab = !!globalThis.SharedWorker && isFeatureSupported("opfs");
|
||||
database.setup({
|
||||
sqliteOptions: {
|
||||
dialect: (name, init) =>
|
||||
createDialect(persistence === "memory" ? ":memory:" : name, true, init),
|
||||
createDialect({
|
||||
name: persistence === "memory" ? ":memory:" : name,
|
||||
encrypted: true,
|
||||
async: !isFeatureSupported("opfs"),
|
||||
init,
|
||||
multiTab
|
||||
}),
|
||||
...(IS_DESKTOP_APP || isFeatureSupported("opfs")
|
||||
? { journalMode: "WAL", lockingMode: "exclusive" }
|
||||
: {
|
||||
journalMode: "MEMORY",
|
||||
lockingMode: "exclusive"
|
||||
lockingMode: "normal"
|
||||
}),
|
||||
tempStore: "memory",
|
||||
synchronous: "normal",
|
||||
pageSize: 8192,
|
||||
cacheSize: -32000,
|
||||
password: Buffer.from(databaseKey).toString("hex"),
|
||||
skipInitialization: !IS_DESKTOP_APP && !!globalThis.SharedWorker
|
||||
skipInitialization: !IS_DESKTOP_APP && multiTab
|
||||
},
|
||||
storage: storage,
|
||||
eventsource: EventSource,
|
||||
@@ -112,7 +118,9 @@ async function initializeDatabase(persistence: DatabasePersistence) {
|
||||
logger.measure("Database initialization");
|
||||
|
||||
if (db.migrations?.required()) {
|
||||
await showMigrationDialog();
|
||||
await import("../dialogs/migration-dialog").then(({ MigrationDialog }) =>
|
||||
MigrationDialog.show({})
|
||||
);
|
||||
}
|
||||
|
||||
return db;
|
||||
|
||||
@@ -28,7 +28,10 @@ export const desktop = createTRPCProxyClient<AppRouter>({
|
||||
links: [ipcLink()]
|
||||
});
|
||||
|
||||
document.addEventListener("readystatechange", async () => {
|
||||
attachListeners();
|
||||
function attachListeners() {
|
||||
console.log("attaching listeners");
|
||||
|
||||
desktop.updater.onChecking.subscribe(
|
||||
undefined,
|
||||
attachListener(AppEvents.checkingForUpdate)
|
||||
@@ -62,7 +65,7 @@ document.addEventListener("readystatechange", async () => {
|
||||
TaskScheduler.register("updateCheck", "0 0 */12 * * * *", () => {
|
||||
checkForUpdate();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function attachListener(event: string) {
|
||||
return {
|
||||
|
||||
@@ -1,577 +0,0 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Dialogs } from "../dialogs";
|
||||
import { store as tagStore } from "../stores/tag-store";
|
||||
import { store as appStore } from "../stores/app-store";
|
||||
import { useEditorStore } from "../stores/editor-store";
|
||||
import { store as noteStore } from "../stores/note-store";
|
||||
import { db } from "./db";
|
||||
import { showToast } from "../utils/toast";
|
||||
import Config from "../utils/config";
|
||||
import { AppVersion, getChangelog } from "../utils/version";
|
||||
import { Period } from "../dialogs/buy-dialog/types";
|
||||
import { FeatureKeys } from "../dialogs/feature-dialog";
|
||||
import { Suspense } from "react";
|
||||
import { ConfirmDialogProps } from "../dialogs/confirm";
|
||||
import { getFormattedDate } from "@notesnook/common";
|
||||
import { downloadUpdate } from "../utils/updater";
|
||||
import { ThemeMetadata } from "@notesnook/themes-server";
|
||||
import {
|
||||
Color,
|
||||
Profile,
|
||||
Reminder,
|
||||
Tag,
|
||||
AuthenticatorType
|
||||
} from "@notesnook/core";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { PasswordDialogProps } from "../dialogs/password-dialog";
|
||||
import { LinkAttributes } from "@notesnook/editor/dist/extensions/link";
|
||||
|
||||
type DialogTypes = typeof Dialogs;
|
||||
type DialogIds = keyof DialogTypes;
|
||||
export type Perform<T = boolean> = (result: T) => void;
|
||||
type RenderDialog<TId extends DialogIds, TReturnType> = (
|
||||
dialog: DialogTypes[TId],
|
||||
perform: (result: TReturnType) => void
|
||||
) => JSX.Element;
|
||||
|
||||
let openDialogs: Partial<Record<DialogIds, boolean>> = {};
|
||||
function showDialog<TId extends DialogIds, TReturnType>(
|
||||
id: TId,
|
||||
render: RenderDialog<TId, TReturnType>
|
||||
): Promise<TReturnType> {
|
||||
return new Promise((resolve) => {
|
||||
if (openDialogs[id]) return false;
|
||||
|
||||
const container = document.createElement("div");
|
||||
container.id = id;
|
||||
const root = createRoot(container);
|
||||
|
||||
const perform = (result: TReturnType) => {
|
||||
openDialogs[id] = false;
|
||||
root.unmount();
|
||||
container.remove();
|
||||
resolve(result);
|
||||
};
|
||||
const PropDialog = () => render(Dialogs[id], perform);
|
||||
root.render(
|
||||
<Suspense fallback={<div />}>
|
||||
<PropDialog />
|
||||
</Suspense>
|
||||
);
|
||||
openDialogs[id] = true;
|
||||
});
|
||||
}
|
||||
|
||||
export function closeOpenedDialog() {
|
||||
openDialogs = {};
|
||||
const dialogs = document.querySelectorAll(
|
||||
".ReactModalPortal,[data-react-modal-body-trap]"
|
||||
);
|
||||
dialogs.forEach((elem) => elem.remove());
|
||||
}
|
||||
|
||||
export function showAddTagsDialog(noteIds: string[]) {
|
||||
return showDialog("AddTagsDialog", (Dialog, perform) => (
|
||||
<Dialog onClose={(res: any) => perform(res)} noteIds={noteIds} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showCreateColorDialog() {
|
||||
return showDialog<"CreateColorDialog", string | undefined>(
|
||||
"CreateColorDialog",
|
||||
(Dialog, perform) => (
|
||||
<Dialog onClose={() => perform(undefined)} onDone={(id) => perform(id)} />
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function showAddNotebookDialog(parentId?: string) {
|
||||
return showDialog("AddNotebookDialog", (Dialog, perform) => (
|
||||
<Dialog
|
||||
parentId={parentId}
|
||||
onClose={() => {
|
||||
perform(false);
|
||||
}}
|
||||
/>
|
||||
));
|
||||
}
|
||||
|
||||
export function showNoteLinkingDialog(attr?: LinkAttributes) {
|
||||
return showDialog<"NoteLinkingDialog", LinkAttributes | undefined>(
|
||||
"NoteLinkingDialog",
|
||||
(Dialog, perform) => (
|
||||
<Dialog
|
||||
attributes={attr}
|
||||
onDone={(link) => perform(link)}
|
||||
onClose={() => perform(undefined)}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export async function showEditNotebookDialog(notebookId: string) {
|
||||
const notebook = await db.notebooks.notebook(notebookId);
|
||||
if (!notebook) return;
|
||||
return await showDialog("AddNotebookDialog", (Dialog, perform) => (
|
||||
<Dialog
|
||||
notebook={notebook}
|
||||
edit={true}
|
||||
onClose={() => {
|
||||
perform(false);
|
||||
}}
|
||||
/>
|
||||
));
|
||||
}
|
||||
|
||||
export function showBuyDialog(plan?: Period, couponCode?: string) {
|
||||
return showDialog("BuyDialog", (Dialog, perform) => (
|
||||
<Dialog
|
||||
plan={plan}
|
||||
couponCode={couponCode}
|
||||
onClose={() => perform(false)}
|
||||
/>
|
||||
));
|
||||
}
|
||||
|
||||
export function confirm<TCheckId extends string>(
|
||||
props: Omit<ConfirmDialogProps<TCheckId>, "onClose">
|
||||
) {
|
||||
return showDialog<"Confirm", false | Record<TCheckId, boolean>>(
|
||||
"Confirm",
|
||||
(Dialog, perform) => (
|
||||
<Dialog {...props} onClose={(result) => perform(result)} />
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function showPromptDialog(props: {
|
||||
title: string;
|
||||
description?: string;
|
||||
defaultValue?: string;
|
||||
}) {
|
||||
return showDialog<"Prompt", string | null>("Prompt", (Dialog, perform) => (
|
||||
<Dialog
|
||||
{...props}
|
||||
onClose={() => perform(null)}
|
||||
onSave={(text) => {
|
||||
perform(text);
|
||||
}}
|
||||
/>
|
||||
));
|
||||
}
|
||||
|
||||
export function showEmailChangeDialog() {
|
||||
return showDialog("EmailChangeDialog", (Dialog, perform) => (
|
||||
<Dialog onClose={() => perform(null)} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showError(title: string, message: string) {
|
||||
return confirm({ title, message, positiveButtonText: "Okay" });
|
||||
}
|
||||
|
||||
export function showMultiDeleteConfirmation(length: number) {
|
||||
return confirm({
|
||||
title: `Delete ${length} items?`,
|
||||
message: `These items will be **kept in your Trash for ${
|
||||
db.settings.getTrashCleanupInterval() || 7
|
||||
} days** after which they will be permanently deleted.`,
|
||||
positiveButtonText: "Yes",
|
||||
negativeButtonText: "No"
|
||||
});
|
||||
}
|
||||
|
||||
export function showMultiPermanentDeleteConfirmation(length: number) {
|
||||
return confirm({
|
||||
title: `Permanently delete ${length} items?`,
|
||||
message:
|
||||
"These items will be **permanently deleted**. This is IRREVERSIBLE.",
|
||||
positiveButtonText: "Yes",
|
||||
negativeButtonText: "No"
|
||||
});
|
||||
}
|
||||
|
||||
export function showLogoutConfirmation() {
|
||||
return confirm({
|
||||
title: `Logout?`,
|
||||
message:
|
||||
"Logging out will clear all data stored on THIS DEVICE. Make sure you have synced all your changes before logging out.",
|
||||
positiveButtonText: "Yes",
|
||||
negativeButtonText: "No"
|
||||
});
|
||||
}
|
||||
|
||||
export function showClearSessionsConfirmation() {
|
||||
return confirm({
|
||||
title: `Logout from other devices?`,
|
||||
message:
|
||||
"All other logged-in devices will be forced to logout stopping sync. Use with care lest you lose important notes.",
|
||||
positiveButtonText: "Yes",
|
||||
negativeButtonText: "No"
|
||||
});
|
||||
}
|
||||
|
||||
export function showAccountLoggedOutNotice(reason?: string) {
|
||||
return confirm({
|
||||
title: "You were logged out",
|
||||
message: reason,
|
||||
negativeButtonText: "Okay"
|
||||
});
|
||||
}
|
||||
|
||||
export function showAppUpdatedNotice(
|
||||
version: AppVersion & { changelog?: string }
|
||||
) {
|
||||
return confirm({
|
||||
title: `Welcome to v${version.formatted}`,
|
||||
message: `## Changelog:
|
||||
|
||||
\`\`\`
|
||||
${version.changelog || "No change log."}
|
||||
\`\`\`
|
||||
`,
|
||||
positiveButtonText: `Continue`
|
||||
});
|
||||
}
|
||||
|
||||
export function showEmailVerificationDialog() {
|
||||
return showDialog("EmailVerificationDialog", (Dialog, perform) => (
|
||||
<Dialog onCancel={() => perform(false)} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showMigrationDialog() {
|
||||
return showDialog("MigrationDialog", (Dialog, perform) => (
|
||||
<Dialog onClose={() => perform(false)} />
|
||||
));
|
||||
}
|
||||
|
||||
type LoadingDialogProps<T> = {
|
||||
title: string;
|
||||
message?: string;
|
||||
subtitle: string;
|
||||
action: () => T | Promise<T>;
|
||||
};
|
||||
export function showLoadingDialog<T>(dialogData: LoadingDialogProps<T>) {
|
||||
const { title, message, subtitle, action } = dialogData;
|
||||
return showDialog<"LoadingDialog", T | boolean>(
|
||||
"LoadingDialog",
|
||||
(Dialog, perform) => (
|
||||
<Dialog
|
||||
title={title}
|
||||
description={subtitle}
|
||||
message={message}
|
||||
action={action}
|
||||
onClose={(e) => perform(e as T | boolean)}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
type ProgressDialogProps = {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
action: (...args: never[]) => void;
|
||||
};
|
||||
export function showProgressDialog<T>(dialogData: ProgressDialogProps) {
|
||||
const { title, subtitle, action } = dialogData;
|
||||
return showDialog<"ProgressDialog", T>(
|
||||
"ProgressDialog",
|
||||
(Dialog, perform) => (
|
||||
<Dialog
|
||||
title={title}
|
||||
subtitle={subtitle}
|
||||
action={action}
|
||||
onDone={(e: T) => perform(e)}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function showThemeDetails(theme: ThemeMetadata) {
|
||||
return showDialog("ThemeDetailsDialog", (Dialog, perform) => (
|
||||
<Dialog theme={theme} onClose={(res: boolean) => perform(res)} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showMoveNoteDialog(noteIds: string[]) {
|
||||
return showDialog("MoveDialog", (Dialog, perform) => (
|
||||
<Dialog noteIds={noteIds} onClose={(res: boolean) => perform(res)} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showPasswordDialog<
|
||||
TInputId extends string,
|
||||
TCheckId extends string
|
||||
>(props: Omit<PasswordDialogProps<TInputId, TCheckId>, "onClose">) {
|
||||
return showDialog<
|
||||
"PasswordDialog",
|
||||
string extends TCheckId ? boolean : false | Record<TCheckId, boolean>
|
||||
>("PasswordDialog", (Dialog, perform) => (
|
||||
<Dialog
|
||||
{...props}
|
||||
onClose={(result) =>
|
||||
perform(
|
||||
result as string extends TCheckId
|
||||
? boolean
|
||||
: false | Record<TCheckId, boolean>
|
||||
)
|
||||
}
|
||||
/>
|
||||
));
|
||||
}
|
||||
|
||||
export function showBackupPasswordDialog(
|
||||
validate: (outputs: {
|
||||
password?: string;
|
||||
key?: string;
|
||||
}) => boolean | Promise<boolean>
|
||||
) {
|
||||
return showDialog("BackupPasswordDialog", (Dialog, perform) => (
|
||||
<Dialog onClose={() => perform(false)} validate={validate} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showRecoveryKeyDialog() {
|
||||
return showDialog("RecoveryKeyDialog", (Dialog, perform) => (
|
||||
<Dialog onDone={() => perform(true)} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showCreateTagDialog() {
|
||||
return showDialog("ItemDialog", (Dialog, perform) => (
|
||||
<Dialog
|
||||
title={"Create tag"}
|
||||
subtitle={"You can create as many tags as you want."}
|
||||
onClose={() => {
|
||||
perform(false);
|
||||
}}
|
||||
onAction={async (title: string) => {
|
||||
await db.tags.add({ title });
|
||||
showToast("success", "Tag created!");
|
||||
tagStore.refresh();
|
||||
perform(true);
|
||||
}}
|
||||
/>
|
||||
));
|
||||
}
|
||||
|
||||
export function showEditTagDialog(tag: Tag) {
|
||||
return showDialog("ItemDialog", (Dialog, perform) => (
|
||||
<Dialog
|
||||
title={"Edit tag"}
|
||||
subtitle={`You are editing #${tag.title}.`}
|
||||
defaultValue={tag.title}
|
||||
onClose={() => perform(false)}
|
||||
onAction={async (title: string) => {
|
||||
await db.tags.add({ id: tag.id, title });
|
||||
showToast("success", "Tag edited!");
|
||||
await tagStore.refresh();
|
||||
await useEditorStore.getState().refreshTags();
|
||||
await noteStore.refresh();
|
||||
await appStore.refreshNavItems();
|
||||
perform(true);
|
||||
}}
|
||||
/>
|
||||
));
|
||||
}
|
||||
|
||||
export function showRenameColorDialog(color: Color) {
|
||||
return showDialog("ItemDialog", (Dialog, perform) => (
|
||||
<Dialog
|
||||
title={"Rename color"}
|
||||
subtitle={`You are renaming color ${color.title}.`}
|
||||
defaultValue={color.title}
|
||||
onClose={() => perform(false)}
|
||||
onAction={async (title: string) => {
|
||||
if (!title) return;
|
||||
await db.colors.add({ id: color.id, title });
|
||||
showToast("success", "Color renamed!");
|
||||
appStore.refreshNavItems();
|
||||
perform(true);
|
||||
}}
|
||||
/>
|
||||
));
|
||||
}
|
||||
|
||||
export function showFeatureDialog(featureName: FeatureKeys) {
|
||||
return showDialog("FeatureDialog", (Dialog, perform) => (
|
||||
<Dialog featureName={featureName} onClose={(res) => perform(res)} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showReminderDialog(reminderKey: string) {
|
||||
if (Config.get(reminderKey, false)) return;
|
||||
|
||||
return showDialog("ReminderDialog", (Dialog, perform) => (
|
||||
<Dialog
|
||||
reminderKey={reminderKey}
|
||||
onClose={(res: boolean) => {
|
||||
Config.set(reminderKey, true);
|
||||
perform(res);
|
||||
}}
|
||||
/>
|
||||
));
|
||||
}
|
||||
|
||||
export function showReminderPreviewDialog(reminder: Reminder) {
|
||||
return showDialog("ReminderPreviewDialog", (Dialog, perform) => (
|
||||
<Dialog reminder={reminder} onClose={perform} />
|
||||
));
|
||||
}
|
||||
|
||||
export async function showAddReminderDialog(noteId?: string) {
|
||||
const note = noteId ? await db.notes.note(noteId) : undefined;
|
||||
return showDialog("AddReminderDialog", (Dialog, perform) => (
|
||||
<Dialog onClose={(res: boolean) => perform(res)} note={note} />
|
||||
));
|
||||
}
|
||||
|
||||
export async function showEditReminderDialog(reminderId: string) {
|
||||
const reminder = await db.reminders.reminder(reminderId);
|
||||
if (!reminder) return null;
|
||||
return showDialog("AddReminderDialog", (Dialog, perform) => (
|
||||
<Dialog onClose={(res: boolean) => perform(res)} reminder={reminder} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showAnnouncementDialog(announcement: any) {
|
||||
return showDialog("AnnouncementDialog", (Dialog, perform) => (
|
||||
<Dialog
|
||||
announcement={announcement}
|
||||
onClose={(res: boolean) => perform(res)}
|
||||
/>
|
||||
));
|
||||
}
|
||||
|
||||
export function showIssueDialog() {
|
||||
return showDialog("IssueDialog", (Dialog, perform) => (
|
||||
<Dialog
|
||||
onClose={(res: boolean) => {
|
||||
perform(res);
|
||||
}}
|
||||
/>
|
||||
));
|
||||
}
|
||||
|
||||
export function showMultifactorDialog(primaryMethod?: AuthenticatorType) {
|
||||
return showDialog("MultifactorDialog", (Dialog, perform) => (
|
||||
<Dialog onClose={(res) => perform(res)} primaryMethod={primaryMethod} />
|
||||
));
|
||||
}
|
||||
|
||||
export function show2FARecoveryCodesDialog(primaryMethod: AuthenticatorType) {
|
||||
return showDialog("RecoveryCodesDialog", (Dialog, perform) => (
|
||||
<Dialog onClose={(res) => perform(res)} primaryMethod={primaryMethod} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showAttachmentsDialog() {
|
||||
return showDialog("AttachmentsDialog", (Dialog, perform) => (
|
||||
<Dialog onClose={(res: boolean) => perform(res)} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showEditProfilePictureDialog(profile?: Profile) {
|
||||
return showDialog("EditProfilePictureDialog", (Dialog, perform) => (
|
||||
<Dialog onClose={(res: boolean) => perform(res)} profile={profile} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showImagePickerDialog(images: File[]): Promise<false | File[]> {
|
||||
if (images.length <= 0) return Promise.resolve(false);
|
||||
|
||||
return showDialog("ImagePickerDialog", (Dialog, perform) => (
|
||||
<Dialog onClose={(res) => perform(res)} images={images} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showSettings() {
|
||||
return showDialog("SettingsDialog", (Dialog, perform) => (
|
||||
<Dialog onClose={(res: boolean) => perform(res)} />
|
||||
));
|
||||
}
|
||||
|
||||
export function showOnboardingDialog(type?: string) {
|
||||
if (!type) return;
|
||||
return showDialog("OnboardingDialog", (Dialog, perform) => (
|
||||
<Dialog type={type} onClose={(res: boolean) => perform(res)} />
|
||||
));
|
||||
}
|
||||
|
||||
export async function showInvalidSystemTimeDialog({
|
||||
serverTime,
|
||||
localTime
|
||||
}: {
|
||||
serverTime: number;
|
||||
localTime: number;
|
||||
}) {
|
||||
const result = await confirm({
|
||||
title: "Your system clock is out of sync",
|
||||
subtitle:
|
||||
"Please correct your system date & time and reload the app to avoid syncing issues.",
|
||||
message: `Server time: ${getFormattedDate(serverTime)}
|
||||
Local time: ${getFormattedDate(localTime)}
|
||||
Please sync your system time with [https://time.is](https://time.is).`,
|
||||
positiveButtonText: "Reload app"
|
||||
});
|
||||
if (result) window.location.reload();
|
||||
}
|
||||
|
||||
export async function showUpdateAvailableNotice({
|
||||
version
|
||||
}: {
|
||||
version: string;
|
||||
}) {
|
||||
const changelog = await getChangelog(version);
|
||||
|
||||
return showUpdateDialog({
|
||||
title: `New version available`,
|
||||
subtitle: `v${version} is available for download`,
|
||||
changelog,
|
||||
action: { text: `Update now`, onClick: () => downloadUpdate() }
|
||||
});
|
||||
}
|
||||
|
||||
type UpdateDialogProps = {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
changelog: string;
|
||||
action: {
|
||||
text: string;
|
||||
onClick: () => void;
|
||||
};
|
||||
};
|
||||
async function showUpdateDialog({
|
||||
title,
|
||||
subtitle,
|
||||
changelog,
|
||||
action
|
||||
}: UpdateDialogProps) {
|
||||
const result = await confirm({
|
||||
title,
|
||||
subtitle,
|
||||
message: changelog,
|
||||
width: 500,
|
||||
positiveButtonText: action.text
|
||||
});
|
||||
if (result && action.onClick) action.onClick();
|
||||
}
|
||||
88
apps/web/src/common/dialog-manager.tsx
Normal file
88
apps/web/src/common/dialog-manager.tsx
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
|
||||
export interface BaseDialogProps<T = unknown> {
|
||||
onClose: (result: T) => void;
|
||||
}
|
||||
|
||||
class _DialogManager {
|
||||
private openedDialogs: Set<React.JSXElementConstructor<any>> = new Set();
|
||||
|
||||
open<
|
||||
Props extends BaseDialogProps<any>,
|
||||
Result extends Props extends BaseDialogProps<infer T> ? T : unknown
|
||||
>(
|
||||
component: React.ComponentType<Props>,
|
||||
props: Omit<Props, "onClose">
|
||||
): Promise<Result | false> {
|
||||
if (this.openedDialogs.has(component)) return Promise.resolve(false);
|
||||
|
||||
const container = document.createElement("div");
|
||||
const root = createRoot(container);
|
||||
|
||||
const close = () => {
|
||||
this.openedDialogs.delete(component);
|
||||
root.unmount();
|
||||
container.remove();
|
||||
};
|
||||
|
||||
const Dialog = component as React.FunctionComponent<
|
||||
Omit<Props, "onClose"> & {
|
||||
onClose: (result: any) => void;
|
||||
}
|
||||
>;
|
||||
this.openedDialogs.add(component);
|
||||
return new Promise<Result>((resolve, reject) =>
|
||||
root.render(
|
||||
<Dialog
|
||||
{...props}
|
||||
onClose={(result: Result) => {
|
||||
try {
|
||||
close();
|
||||
resolve(result);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
closeAll() {
|
||||
this.openedDialogs.clear();
|
||||
const dialogs = document.querySelectorAll(
|
||||
".ReactModalPortal,[data-react-modal-body-trap]"
|
||||
);
|
||||
dialogs.forEach((elem) => elem.remove());
|
||||
}
|
||||
|
||||
register<Props extends BaseDialogProps<any>>(
|
||||
component: React.ComponentType<Props>
|
||||
) {
|
||||
return {
|
||||
show: (props: Omit<Props, "onClose">) => this.open(component, props)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export const DialogManager = new _DialogManager();
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
import Vault from "./vault";
|
||||
import { ExportStream } from "../utils/streams/export-stream";
|
||||
import { showToast } from "../utils/toast";
|
||||
import { confirm } from "./dialog-controller";
|
||||
import { ConfirmDialog } from "../dialogs/confirm";
|
||||
|
||||
export async function exportToPDF(
|
||||
title: string,
|
||||
@@ -101,14 +101,14 @@ export async function exportNotes(
|
||||
}
|
||||
});
|
||||
if (result instanceof Error) {
|
||||
confirm({
|
||||
ConfirmDialog.show({
|
||||
title: `Export failed`,
|
||||
message: result.stack || result.message,
|
||||
positiveButtonText: "Okay"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
confirm({
|
||||
ConfirmDialog.show({
|
||||
title: `Exported ${result.count} notes`,
|
||||
message:
|
||||
result.errors.length > 0
|
||||
|
||||
@@ -17,12 +17,6 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
showBackupPasswordDialog,
|
||||
showFeatureDialog,
|
||||
showPasswordDialog,
|
||||
showReminderDialog
|
||||
} from "./dialog-controller";
|
||||
import Config from "../utils/config";
|
||||
import { hashNavigate, getCurrentHash } from "../navigation";
|
||||
import { db } from "./db";
|
||||
@@ -38,12 +32,15 @@ import { TaskManager } from "./task-manager";
|
||||
import { EVENTS } from "@notesnook/core/dist/common";
|
||||
import { createWritableStream } from "./desktop-bridge";
|
||||
import { createZipStream } from "../utils/streams/zip-stream";
|
||||
import { FeatureKeys } from "../dialogs/feature-dialog";
|
||||
import { FeatureDialog, FeatureKeys } from "../dialogs/feature-dialog";
|
||||
import { ZipEntry, createUnzipIterator } from "../utils/streams/unzip-stream";
|
||||
import { User } from "@notesnook/core";
|
||||
import { LegacyBackupFile } from "@notesnook/core";
|
||||
import { useEditorStore } from "../stores/editor-store";
|
||||
import { formatDate } from "@notesnook/core/dist/utils/date";
|
||||
import { showPasswordDialog } from "../dialogs/password-dialog";
|
||||
import { BackupPasswordDialog } from "../dialogs/backup-password-dialog";
|
||||
import { ReminderDialog } from "../dialogs/reminder-dialog";
|
||||
|
||||
export const CREATE_BUTTON_MAP = {
|
||||
notes: {
|
||||
@@ -70,7 +67,7 @@ export async function introduceFeatures() {
|
||||
const features: FeatureKeys[] = [];
|
||||
for (const feature of features) {
|
||||
if (!Config.get(`feature:${feature}`)) {
|
||||
await showFeatureDialog(feature);
|
||||
await FeatureDialog.show({ featureName: feature });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,10 +170,12 @@ export async function restoreBackupFile(backupFile: File) {
|
||||
const backup = JSON.parse(await readFile(backupFile));
|
||||
|
||||
if (backup.data.iv && backup.data.salt) {
|
||||
await showBackupPasswordDialog(async ({ password, key }) => {
|
||||
if (!password && !key) return false;
|
||||
const error = await restoreWithProgress(backup, password, key);
|
||||
return !error;
|
||||
await BackupPasswordDialog.show({
|
||||
validate: async ({ password, key }) => {
|
||||
if (!password && !key) return false;
|
||||
const error = await restoreWithProgress(backup, password, key);
|
||||
return !error;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
await restoreWithProgress(backup);
|
||||
@@ -212,15 +211,15 @@ export async function restoreBackupFile(backupFile: File) {
|
||||
const backup = JSON.parse(await entry.text());
|
||||
if (backup.encrypted) {
|
||||
if (!cachedPassword && !cachedKey) {
|
||||
const result = await showBackupPasswordDialog(
|
||||
async ({ password, key }) => {
|
||||
const result = await BackupPasswordDialog.show({
|
||||
validate: async ({ password, key }) => {
|
||||
if (!password && !key) return false;
|
||||
await db.backup?.import(backup, password, key);
|
||||
cachedPassword = password;
|
||||
cachedKey = key;
|
||||
return true;
|
||||
}
|
||||
);
|
||||
});
|
||||
if (!result) break;
|
||||
} else await db.backup?.import(backup, cachedPassword, cachedKey);
|
||||
} else {
|
||||
@@ -318,9 +317,9 @@ export async function showUpgradeReminderDialogs() {
|
||||
const isTrial = user.subscription?.type === SUBSCRIPTION_STATUS.TRIAL;
|
||||
const isBasic = user.subscription?.type === SUBSCRIPTION_STATUS.BASIC;
|
||||
if (isBasic && consumed >= 100) {
|
||||
await showReminderDialog("trialexpired");
|
||||
await ReminderDialog.show({ reminderKey: "trialexpired" });
|
||||
} else if (isTrial && consumed >= 75) {
|
||||
await showReminderDialog("trialexpiring");
|
||||
await ReminderDialog.show({ reminderKey: "trialexpiring" });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { confirm, showMultiDeleteConfirmation } from "./dialog-controller";
|
||||
import { store as noteStore } from "../stores/note-store";
|
||||
import { store as notebookStore } from "../stores/notebook-store";
|
||||
import { store as attachmentStore } from "../stores/attachment-store";
|
||||
@@ -27,6 +26,7 @@ import { showToast } from "../utils/toast";
|
||||
import Vault from "./vault";
|
||||
import { TaskManager } from "./task-manager";
|
||||
import { pluralize } from "@notesnook/common";
|
||||
import { ConfirmDialog, showMultiDeleteConfirmation } from "../dialogs/confirm";
|
||||
|
||||
async function moveNotesToTrash(ids: string[], confirm = true) {
|
||||
if (confirm && !(await showMultiDeleteConfirmation(ids.length))) return;
|
||||
@@ -79,7 +79,7 @@ async function moveNotebooksToTrash(ids: string[]) {
|
||||
|
||||
async function deleteAttachments(ids: string[]) {
|
||||
if (
|
||||
!(await confirm({
|
||||
!(await ConfirmDialog.show({
|
||||
title: "Are you sure?",
|
||||
message:
|
||||
"Are you sure you want to permanently delete these attachments? This action is IRREVERSIBLE.",
|
||||
|
||||
@@ -23,12 +23,12 @@ import { db } from "./db";
|
||||
import { store as appStore } from "../stores/app-store";
|
||||
import { Backup, User, Email, Warn, Icon } from "../components/icons";
|
||||
import dayjs from "dayjs";
|
||||
import { showBuyDialog, showRecoveryKeyDialog } from "./dialog-controller";
|
||||
import { hardNavigate, hashNavigate } from "../navigation";
|
||||
|
||||
import { isUserPremium } from "../hooks/use-is-user-premium";
|
||||
import { showToast } from "../utils/toast";
|
||||
import { TaskScheduler } from "../utils/task-scheduler";
|
||||
import { BuyDialog } from "../dialogs/buy-dialog";
|
||||
import { RecoveryKeyDialog } from "../dialogs/recovery-key-dialog";
|
||||
|
||||
export type NoticeType = "autoBackupsOff" | "login" | "email" | "recoverykey";
|
||||
|
||||
@@ -119,7 +119,7 @@ export const NoticesData: Record<NoticeType, NoticeData> = {
|
||||
key: "autoBackupsOff",
|
||||
title: "Automatic backups disabled",
|
||||
subtitle: "Please upgrade to Pro to enable automatic backups.",
|
||||
action: () => showBuyDialog(),
|
||||
action: () => BuyDialog.show({}),
|
||||
dismissable: true,
|
||||
icon: Backup
|
||||
},
|
||||
@@ -143,7 +143,7 @@ export const NoticesData: Record<NoticeType, NoticeData> = {
|
||||
subtitle: "Keep your recovery key safe",
|
||||
dismissable: true,
|
||||
action: async () => {
|
||||
if (await verifyAccount()) await showRecoveryKeyDialog();
|
||||
if (await verifyAccount()) await RecoveryKeyDialog.show({});
|
||||
},
|
||||
icon: Warn
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ export class AccessHandlePoolVFS extends VFS.Base {
|
||||
}
|
||||
|
||||
async delete() {
|
||||
for await (const [name] of this.#directoryHandle) {
|
||||
for await (const [name] of await this.#directoryHandle.entries()) {
|
||||
await this.#directoryHandle.removeEntry(name, { recursive: true });
|
||||
}
|
||||
}
|
||||
@@ -300,7 +300,7 @@ export class AccessHandlePoolVFS extends VFS.Base {
|
||||
async #acquireAccessHandles() {
|
||||
// Enumerate all the files in the directory.
|
||||
const files = [];
|
||||
for await (const [name, handle] of this.#directoryHandle) {
|
||||
for await (const [name, handle] of await this.#directoryHandle.entries()) {
|
||||
if (handle.kind === "file") {
|
||||
files.push([name, handle]);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
// Copyright 2022 Roy T. Hashimoto. All Rights Reserved.
|
||||
import * as VFS from "./VFS.js";
|
||||
import { WebLocksExclusive as WebLocks } from "./WebLocks.js";
|
||||
import { WebLocksShared as WebLocks } from "./WebLocks.js";
|
||||
import { IDBContext } from "./IDBContext.js";
|
||||
|
||||
const SECTOR_SIZE = 512;
|
||||
|
||||
@@ -32,6 +32,7 @@ import Worker from "./sqlite.worker.desktop.ts?worker";
|
||||
import type { SQLiteWorker } from "./sqlite.worker.desktop";
|
||||
import { wrap, Remote } from "comlink";
|
||||
import { Mutex } from "async-mutex";
|
||||
import { DialectOptions } from ".";
|
||||
|
||||
class SqliteDriver implements Driver {
|
||||
connection?: DatabaseConnection;
|
||||
@@ -100,11 +101,11 @@ class SqliteWorkerConnection implements DatabaseConnection {
|
||||
}
|
||||
}
|
||||
|
||||
export const createDialect = (name: string, _encrypted: boolean): Dialect => {
|
||||
export const createDialect = (options: DialectOptions): Dialect => {
|
||||
return {
|
||||
createDriver: () =>
|
||||
new SqliteDriver({
|
||||
name
|
||||
name: options.name
|
||||
}),
|
||||
createAdapter: () => new SqliteAdapter(),
|
||||
createIntrospector: (db) => new SqliteIntrospector(db),
|
||||
|
||||
@@ -27,7 +27,6 @@ import {
|
||||
WaSqliteWorkerMultipleTabDriver,
|
||||
WaSqliteWorkerSingleTabDriver
|
||||
} from "./wa-sqlite-kysely-driver";
|
||||
import { isFeatureSupported } from "../../utils/feature-check";
|
||||
|
||||
declare module "kysely" {
|
||||
interface Driver {
|
||||
@@ -35,22 +34,26 @@ declare module "kysely" {
|
||||
}
|
||||
}
|
||||
|
||||
export const createDialect = (
|
||||
name: string,
|
||||
encrypted: boolean,
|
||||
init?: () => Promise<void>
|
||||
): Dialect => {
|
||||
export type DialectOptions = {
|
||||
name: string;
|
||||
encrypted: boolean;
|
||||
async: boolean;
|
||||
multiTab: boolean;
|
||||
init?: () => Promise<void>;
|
||||
};
|
||||
export const createDialect = (options: DialectOptions): Dialect => {
|
||||
const { async, encrypted, multiTab, name, init } = options;
|
||||
return {
|
||||
createDriver: () =>
|
||||
globalThis.SharedWorker
|
||||
multiTab
|
||||
? new WaSqliteWorkerMultipleTabDriver({
|
||||
async: !isFeatureSupported("opfs"),
|
||||
async,
|
||||
dbName: name,
|
||||
encrypted,
|
||||
init
|
||||
})
|
||||
: new WaSqliteWorkerSingleTabDriver({
|
||||
async: !isFeatureSupported("opfs"),
|
||||
async,
|
||||
dbName: name,
|
||||
encrypted
|
||||
}),
|
||||
|
||||
@@ -7,140 +7,139 @@ function(moduleArg = {}) {
|
||||
|
||||
var d=moduleArg,aa,ba;d.ready=new Promise((a,b)=>{aa=a;ba=b});var ca=Object.assign({},d),da="./this.program",ea=(a,b)=>{throw b;},fa="object"==typeof window,ha="function"==typeof importScripts,g="",ia;
|
||||
if(fa||ha)ha?g=self.location.href:"undefined"!=typeof document&&document.currentScript&&(g=document.currentScript.src),_scriptDir&&(g=_scriptDir),0!==g.indexOf("blob:")?g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1):g="",ha&&(ia=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ja=d.print||console.log.bind(console),r=d.printErr||console.error.bind(console);Object.assign(d,ca);ca=null;d.thisProgram&&(da=d.thisProgram);
|
||||
d.quit&&(ea=d.quit);var ka;d.wasmBinary&&(ka=d.wasmBinary);"object"!=typeof WebAssembly&&u("no native wasm support detected");var ma,na=!1,oa,v,w,x,pa,z,A,qa,ra;function sa(){var a=ma.buffer;d.HEAP8=v=new Int8Array(a);d.HEAP16=x=new Int16Array(a);d.HEAPU8=w=new Uint8Array(a);d.HEAPU16=pa=new Uint16Array(a);d.HEAP32=z=new Int32Array(a);d.HEAPU32=A=new Uint32Array(a);d.HEAPF32=qa=new Float32Array(a);d.HEAPF64=ra=new Float64Array(a)}var ta=[],ua=[],va=[],wa=[];
|
||||
function xa(){var a=d.preRun.shift();ta.unshift(a)}var ya=0,za=null,Aa=null;function u(a){if(d.onAbort)d.onAbort(a);a="Aborted("+a+")";r(a);na=!0;oa=1;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");ba(a);throw a;}var Ba=a=>a.startsWith("data:application/octet-stream;base64,"),Ca;if(d.locateFile){if(Ca="wa-sqlite-async.wasm",!Ba(Ca)){var Da=Ca;Ca=d.locateFile?d.locateFile(Da,g):g+Da}}else Ca=(new URL("wa-sqlite-async.wasm",import.meta.url)).href;
|
||||
function Ea(a){if(a==Ca&&ka)return new Uint8Array(ka);if(ia)return ia(a);throw"both async and sync fetching of the wasm failed";}function Fa(a){return ka||!fa&&!ha||"function"!=typeof fetch?Promise.resolve().then(()=>Ea(a)):fetch(a,{credentials:"same-origin"}).then(b=>{if(!b.ok)throw"failed to load wasm binary file at '"+a+"'";return b.arrayBuffer()}).catch(()=>Ea(a))}
|
||||
function Ga(a,b,c){return Fa(a).then(e=>WebAssembly.instantiate(e,b)).then(e=>e).then(c,e=>{r(`failed to asynchronously prepare wasm: ${e}`);u(e)})}function Ha(a,b){var c=Ca;return ka||"function"!=typeof WebAssembly.instantiateStreaming||Ba(c)||"function"!=typeof fetch?Ga(c,a,b):fetch(c,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,a).then(b,function(f){r(`wasm streaming compile failed: ${f}`);r("falling back to ArrayBuffer instantiation");return Ga(c,a,b)}))}var C,D;
|
||||
function Ia(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}var Ja=a=>{for(;0<a.length;)a.shift()(d)};function F(a,b="i8"){b.endsWith("*")&&(b="*");switch(b){case "i1":return v[a>>0];case "i8":return v[a>>0];case "i16":return x[a>>1];case "i32":return z[a>>2];case "i64":u("to do getValue(i64) use WASM_BIGINT");case "float":return qa[a>>2];case "double":return ra[a>>3];case "*":return A[a>>2];default:u(`invalid type for getValue: ${b}`)}}
|
||||
var Ka=d.noExitRuntime||!0;function H(a,b,c="i8"){c.endsWith("*")&&(c="*");switch(c){case "i1":v[a>>0]=b;break;case "i8":v[a>>0]=b;break;case "i16":x[a>>1]=b;break;case "i32":z[a>>2]=b;break;case "i64":u("to do setValue(i64) use WASM_BIGINT");case "float":qa[a>>2]=b;break;case "double":ra[a>>3]=b;break;case "*":A[a>>2]=b;break;default:u(`invalid type for setValue: ${c}`)}}
|
||||
var La="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,J=(a,b,c)=>{var e=b+c;for(c=b;a[c]&&!(c>=e);)++c;if(16<c-b&&a.buffer&&La)return La.decode(a.subarray(b,c));for(e="";b<c;){var f=a[b++];if(f&128){var h=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|h);else{var k=a[b++]&63;f=224==(f&240)?(f&15)<<12|h<<6|k:(f&7)<<18|h<<12|k<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e},
|
||||
Ma=(a,b)=>{for(var c=0,e=a.length-1;0<=e;e--){var f=a[e];"."===f?a.splice(e,1):".."===f?(a.splice(e,1),c++):c&&(a.splice(e,1),c--)}if(b)for(;c;c--)a.unshift("..");return a},K=a=>{var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=Ma(a.split("/").filter(e=>!!e),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},Na=a=>{var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b},Oa=a=>{if("/"===
|
||||
a)return"/";a=K(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)},Pa=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return a=>crypto.getRandomValues(a);u("initRandomDevice")},Qa=a=>(Qa=Pa())(a);
|
||||
function Ra(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!=typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=Ma(a.split("/").filter(e=>!!e),!b).join("/");return(b?"/":"")+a||"."}
|
||||
var Sa=[],Ta=a=>{for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++c):b+=3}return b},Ua=(a,b,c,e)=>{if(!(0<e))return 0;var f=c;e=c+e-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var n=a.charCodeAt(++h);k=65536+((k&1023)<<10)|n&1023}if(127>=k){if(c>=e)break;b[c++]=k}else{if(2047>=k){if(c+1>=e)break;b[c++]=192|k>>6}else{if(65535>=k){if(c+2>=e)break;b[c++]=224|k>>12}else{if(c+3>=e)break;b[c++]=240|k>>18;b[c++]=128|k>>
|
||||
12&63}b[c++]=128|k>>6&63}b[c++]=128|k&63}}b[c]=0;return c-f};function Va(a,b,c){c=Array(0<c?c:Ta(a)+1);a=Ua(a,c,0,c.length);b&&(c.length=a);return c}var Wa=[];function Xa(a,b){Wa[a]={input:[],Qf:[],ag:b};Ya(a,Za)}
|
||||
var Za={open(a){var b=Wa[a.node.dg];if(!b)throw new M(43);a.Rf=b;a.seekable=!1},close(a){a.Rf.ag.gg(a.Rf)},gg(a){a.Rf.ag.gg(a.Rf)},read(a,b,c,e){if(!a.Rf||!a.Rf.ag.vg)throw new M(60);for(var f=0,h=0;h<e;h++){try{var k=a.Rf.ag.vg(a.Rf)}catch(n){throw new M(29);}if(void 0===k&&0===f)throw new M(6);if(null===k||void 0===k)break;f++;b[c+h]=k}f&&(a.node.timestamp=Date.now());return f},write(a,b,c,e){if(!a.Rf||!a.Rf.ag.pg)throw new M(60);try{for(var f=0;f<e;f++)a.Rf.ag.pg(a.Rf,b[c+f])}catch(h){throw new M(29);
|
||||
}e&&(a.node.timestamp=Date.now());return f}},$a={vg(){a:{if(!Sa.length){var a=null;"undefined"!=typeof window&&"function"==typeof window.prompt?(a=window.prompt("Input: "),null!==a&&(a+="\n")):"function"==typeof readline&&(a=readline(),null!==a&&(a+="\n"));if(!a){a=null;break a}Sa=Va(a,!0)}a=Sa.shift()}return a},pg(a,b){null===b||10===b?(ja(J(a.Qf,0)),a.Qf=[]):0!=b&&a.Qf.push(b)},gg(a){a.Qf&&0<a.Qf.length&&(ja(J(a.Qf,0)),a.Qf=[])},Wg(){return{Sg:25856,Ug:5,Rg:191,Tg:35387,Qg:[3,28,127,21,4,0,1,0,
|
||||
17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},Xg(){return 0},Yg(){return[24,80]}},ab={pg(a,b){null===b||10===b?(r(J(a.Qf,0)),a.Qf=[]):0!=b&&a.Qf.push(b)},gg(a){a.Qf&&0<a.Qf.length&&(r(J(a.Qf,0)),a.Qf=[])}};function bb(a,b){var c=a.Mf?a.Mf.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Mf,a.Mf=new Uint8Array(b),0<a.Of&&a.Mf.set(c.subarray(0,a.Of),0))}
|
||||
var N={Uf:null,Tf(){return N.createNode(null,"/",16895,0)},createNode(a,b,c,e){if(24576===(c&61440)||4096===(c&61440))throw new M(63);N.Uf||(N.Uf={dir:{node:{Sf:N.Kf.Sf,Pf:N.Kf.Pf,bg:N.Kf.bg,hg:N.Kf.hg,zg:N.Kf.zg,mg:N.Kf.mg,kg:N.Kf.kg,yg:N.Kf.yg,lg:N.Kf.lg},stream:{Yf:N.Lf.Yf}},file:{node:{Sf:N.Kf.Sf,Pf:N.Kf.Pf},stream:{Yf:N.Lf.Yf,read:N.Lf.read,write:N.Lf.write,sg:N.Lf.sg,ig:N.Lf.ig,jg:N.Lf.jg}},link:{node:{Sf:N.Kf.Sf,Pf:N.Kf.Pf,eg:N.Kf.eg},stream:{}},tg:{node:{Sf:N.Kf.Sf,Pf:N.Kf.Pf},stream:cb}});
|
||||
c=db(a,b,c,e);O(c.mode)?(c.Kf=N.Uf.dir.node,c.Lf=N.Uf.dir.stream,c.Mf={}):32768===(c.mode&61440)?(c.Kf=N.Uf.file.node,c.Lf=N.Uf.file.stream,c.Of=0,c.Mf=null):40960===(c.mode&61440)?(c.Kf=N.Uf.link.node,c.Lf=N.Uf.link.stream):8192===(c.mode&61440)&&(c.Kf=N.Uf.tg.node,c.Lf=N.Uf.tg.stream);c.timestamp=Date.now();a&&(a.Mf[b]=c,a.timestamp=c.timestamp);return c},Vg(a){return a.Mf?a.Mf.subarray?a.Mf.subarray(0,a.Of):new Uint8Array(a.Mf):new Uint8Array(0)},Kf:{Sf(a){var b={};b.Fg=8192===(a.mode&61440)?a.id:
|
||||
1;b.wg=a.id;b.mode=a.mode;b.Lg=1;b.uid=0;b.Ig=0;b.dg=a.dg;O(a.mode)?b.size=4096:32768===(a.mode&61440)?b.size=a.Of:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.Bg=new Date(a.timestamp);b.Kg=new Date(a.timestamp);b.Eg=new Date(a.timestamp);b.Cg=4096;b.Dg=Math.ceil(b.size/b.Cg);return b},Pf(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&(a.timestamp=b.timestamp);if(void 0!==b.size&&(b=b.size,a.Of!=b))if(0==b)a.Mf=null,a.Of=0;else{var c=a.Mf;a.Mf=new Uint8Array(b);c&&a.Mf.set(c.subarray(0,
|
||||
Math.min(b,a.Of)));a.Of=b}},bg(){throw eb[44];},hg(a,b,c,e){return N.createNode(a,b,c,e)},zg(a,b,c){if(O(a.mode)){try{var e=fb(b,c)}catch(h){}if(e)for(var f in e.Mf)throw new M(55);}delete a.parent.Mf[a.name];a.parent.timestamp=Date.now();a.name=c;b.Mf[c]=a;b.timestamp=a.parent.timestamp;a.parent=b},mg(a,b){delete a.Mf[b];a.timestamp=Date.now()},kg(a,b){var c=fb(a,b),e;for(e in c.Mf)throw new M(55);delete a.Mf[b];a.timestamp=Date.now()},yg(a){var b=[".",".."],c;for(c in a.Mf)a.Mf.hasOwnProperty(c)&&
|
||||
b.push(c);return b},lg(a,b,c){a=N.createNode(a,b,41471,0);a.link=c;return a},eg(a){if(40960!==(a.mode&61440))throw new M(28);return a.link}},Lf:{read(a,b,c,e,f){var h=a.node.Mf;if(f>=a.node.Of)return 0;a=Math.min(a.node.Of-f,e);if(8<a&&h.subarray)b.set(h.subarray(f,f+a),c);else for(e=0;e<a;e++)b[c+e]=h[f+e];return a},write(a,b,c,e,f,h){b.buffer===v.buffer&&(h=!1);if(!e)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.Mf||a.Mf.subarray)){if(h)return a.Mf=b.subarray(c,c+e),a.Of=e;if(0===
|
||||
a.Of&&0===f)return a.Mf=b.slice(c,c+e),a.Of=e;if(f+e<=a.Of)return a.Mf.set(b.subarray(c,c+e),f),e}bb(a,f+e);if(a.Mf.subarray&&b.subarray)a.Mf.set(b.subarray(c,c+e),f);else for(h=0;h<e;h++)a.Mf[f+h]=b[c+h];a.Of=Math.max(a.Of,f+e);return e},Yf(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.Of);if(0>b)throw new M(28);return b},sg(a,b,c){bb(a.node,b+c);a.node.Of=Math.max(a.node.Of,b+c)},ig(a,b,c,e,f){if(32768!==(a.node.mode&61440))throw new M(43);a=a.node.Mf;if(f&2||a.buffer!==
|
||||
v.buffer){if(0<c||c+b<a.length)a.subarray?a=a.subarray(c,c+b):a=Array.prototype.slice.call(a,c,c+b);c=!0;b=65536*Math.ceil(b/65536);(f=gb(65536,b))?(w.fill(0,f,f+b),b=f):b=0;if(!b)throw new M(48);v.set(a,b)}else c=!1,b=a.byteOffset;return{Mg:b,Ag:c}},jg(a,b,c,e){N.Lf.write(a,b,0,e,c,!1);return 0}}},hb=(a,b)=>{var c=0;a&&(c|=365);b&&(c|=146);return c},ib=null,jb={},kb=[],lb=1,P=null,mb=!0,M=null,eb={};
|
||||
function Q(a,b={}){a=Ra(a);if(!a)return{path:"",node:null};b=Object.assign({ug:!0,qg:0},b);if(8<b.qg)throw new M(32);a=a.split("/").filter(k=>!!k);for(var c=ib,e="/",f=0;f<a.length;f++){var h=f===a.length-1;if(h&&b.parent)break;c=fb(c,a[f]);e=K(e+"/"+a[f]);c.Zf&&(!h||h&&b.ug)&&(c=c.Zf.root);if(!h||b.Xf)for(h=0;40960===(c.mode&61440);)if(c=nb(e),e=Ra(Na(e),c),c=Q(e,{qg:b.qg+1}).node,40<h++)throw new M(32);}return{path:e,node:c}}
|
||||
function ob(a){for(var b;;){if(a===a.parent)return a=a.Tf.xg,b?"/"!==a[a.length-1]?`${a}/${b}`:a+b:a;b=b?`${a.name}/${b}`:a.name;a=a.parent}}function pb(a,b){for(var c=0,e=0;e<b.length;e++)c=(c<<5)-c+b.charCodeAt(e)|0;return(a+c>>>0)%P.length}function qb(a){var b=pb(a.parent.id,a.name);if(P[b]===a)P[b]=a.$f;else for(b=P[b];b;){if(b.$f===a){b.$f=a.$f;break}b=b.$f}}
|
||||
function fb(a,b){var c;if(c=(c=rb(a,"x"))?c:a.Kf.bg?0:2)throw new M(c,a);for(c=P[pb(a.id,b)];c;c=c.$f){var e=c.name;if(c.parent.id===a.id&&e===b)return c}return a.Kf.bg(a,b)}function db(a,b,c,e){a=new sb(a,b,c,e);b=pb(a.parent.id,a.name);a.$f=P[b];return P[b]=a}function O(a){return 16384===(a&61440)}function tb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}
|
||||
function rb(a,b){if(mb)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function ub(a,b){try{return fb(a,b),20}catch(c){}return rb(a,"wx")}function vb(a,b,c){try{var e=fb(a,b)}catch(f){return f.Nf}if(a=rb(a,"wx"))return a;if(c){if(!O(e.mode))return 54;if(e===e.parent||"/"===ob(e))return 10}else if(O(e.mode))return 31;return 0}function wb(){for(var a=0;4096>=a;a++)if(!kb[a])return a;throw new M(33);}
|
||||
function R(a){a=kb[a];if(!a)throw new M(8);return a}function xb(a,b=-1){yb||(yb=function(){this.fg={}},yb.prototype={},Object.defineProperties(yb.prototype,{object:{get(){return this.node},set(c){this.node=c}},flags:{get(){return this.fg.flags},set(c){this.fg.flags=c}},position:{get(){return this.fg.position},set(c){this.fg.position=c}}}));a=Object.assign(new yb,a);-1==b&&(b=wb());a.Vf=b;return kb[b]=a}var cb={open(a){a.Lf=jb[a.node.dg].Lf;a.Lf.open&&a.Lf.open(a)},Yf(){throw new M(70);}};
|
||||
function Ya(a,b){jb[a]={Lf:b}}function zb(a,b){var c="/"===b,e=!b;if(c&&ib)throw new M(10);if(!c&&!e){var f=Q(b,{ug:!1});b=f.path;f=f.node;if(f.Zf)throw new M(10);if(!O(f.mode))throw new M(54);}b={type:a,$g:{},xg:b,Jg:[]};a=a.Tf(b);a.Tf=b;b.root=a;c?ib=a:f&&(f.Zf=b,f.Tf&&f.Tf.Jg.push(b))}function Ab(a,b,c){var e=Q(a,{parent:!0}).node;a=Oa(a);if(!a||"."===a||".."===a)throw new M(28);var f=ub(e,a);if(f)throw new M(f);if(!e.Kf.hg)throw new M(63);return e.Kf.hg(e,a,b,c)}
|
||||
function S(a,b){return Ab(a,(void 0!==b?b:511)&1023|16384,0)}function Bb(a,b,c){"undefined"==typeof c&&(c=b,b=438);Ab(a,b|8192,c)}function Cb(a,b){if(!Ra(a))throw new M(44);var c=Q(b,{parent:!0}).node;if(!c)throw new M(44);b=Oa(b);var e=ub(c,b);if(e)throw new M(e);if(!c.Kf.lg)throw new M(63);c.Kf.lg(c,b,a)}function Db(a){var b=Q(a,{parent:!0}).node;a=Oa(a);var c=fb(b,a),e=vb(b,a,!0);if(e)throw new M(e);if(!b.Kf.kg)throw new M(63);if(c.Zf)throw new M(10);b.Kf.kg(b,a);qb(c)}
|
||||
function nb(a){a=Q(a).node;if(!a)throw new M(44);if(!a.Kf.eg)throw new M(28);return Ra(ob(a.parent),a.Kf.eg(a))}function Eb(a,b){a=Q(a,{Xf:!b}).node;if(!a)throw new M(44);if(!a.Kf.Sf)throw new M(63);return a.Kf.Sf(a)}function Fb(a){return Eb(a,!0)}function Gb(a,b){a="string"==typeof a?Q(a,{Xf:!0}).node:a;if(!a.Kf.Pf)throw new M(63);a.Kf.Pf(a,{mode:b&4095|a.mode&-4096,timestamp:Date.now()})}
|
||||
function Hb(a,b){if(0>b)throw new M(28);a="string"==typeof a?Q(a,{Xf:!0}).node:a;if(!a.Kf.Pf)throw new M(63);if(O(a.mode))throw new M(31);if(32768!==(a.mode&61440))throw new M(28);var c=rb(a,"w");if(c)throw new M(c);a.Kf.Pf(a,{size:b,timestamp:Date.now()})}
|
||||
function Ib(a,b,c){if(""===a)throw new M(44);if("string"==typeof b){var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[b];if("undefined"==typeof e)throw Error(`Unknown file open mode: ${b}`);b=e}c=b&64?("undefined"==typeof c?438:c)&4095|32768:0;if("object"==typeof a)var f=a;else{a=K(a);try{f=Q(a,{Xf:!(b&131072)}).node}catch(h){}}e=!1;if(b&64)if(f){if(b&128)throw new M(20);}else f=Ab(a,c,0),e=!0;if(!f)throw new M(44);8192===(f.mode&61440)&&(b&=-513);if(b&65536&&!O(f.mode))throw new M(54);if(!e&&(c=
|
||||
f?40960===(f.mode&61440)?32:O(f.mode)&&("r"!==tb(b)||b&512)?31:rb(f,tb(b)):44))throw new M(c);b&512&&!e&&Hb(f,0);b&=-131713;f=xb({node:f,path:ob(f),flags:b,seekable:!0,position:0,Lf:f.Lf,Pg:[],error:!1});f.Lf.open&&f.Lf.open(f);!d.logReadFiles||b&1||(Jb||(Jb={}),a in Jb||(Jb[a]=1));return f}function Kb(a,b,c){if(null===a.Vf)throw new M(8);if(!a.seekable||!a.Lf.Yf)throw new M(70);if(0!=c&&1!=c&&2!=c)throw new M(28);a.position=a.Lf.Yf(a,b,c);a.Pg=[]}
|
||||
function Lb(){M||(M=function(a,b){this.name="ErrnoError";this.node=b;this.Ng=function(c){this.Nf=c};this.Ng(a);this.message="FS error"},M.prototype=Error(),M.prototype.constructor=M,[44].forEach(a=>{eb[a]=new M(a);eb[a].stack="<generic error, no stack>"}))}var Mb;
|
||||
function Nb(a,b,c){a=K("/dev/"+a);var e=hb(!!b,!!c);Ob||(Ob=64);var f=Ob++<<8|0;Ya(f,{open(h){h.seekable=!1},close(){c&&c.buffer&&c.buffer.length&&c(10)},read(h,k,n,l){for(var m=0,q=0;q<l;q++){try{var p=b()}catch(t){throw new M(29);}if(void 0===p&&0===m)throw new M(6);if(null===p||void 0===p)break;m++;k[n+q]=p}m&&(h.node.timestamp=Date.now());return m},write(h,k,n,l){for(var m=0;m<l;m++)try{c(k[n+m])}catch(q){throw new M(29);}l&&(h.node.timestamp=Date.now());return m}});Bb(a,e,f)}var Ob,T={},yb,Jb;
|
||||
function Pb(a,b,c){if("/"===b.charAt(0))return b;a=-100===a?"/":R(a).path;if(0==b.length){if(!c)throw new M(44);return a}return K(a+"/"+b)}
|
||||
function Qb(a,b,c){try{var e=a(b)}catch(h){if(h&&h.node&&K(b)!==K(ob(h.node)))return-54;throw h;}z[c>>2]=e.Fg;z[c+4>>2]=e.mode;A[c+8>>2]=e.Lg;z[c+12>>2]=e.uid;z[c+16>>2]=e.Ig;z[c+20>>2]=e.dg;D=[e.size>>>0,(C=e.size,1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];z[c+24>>2]=D[0];z[c+28>>2]=D[1];z[c+32>>2]=4096;z[c+36>>2]=e.Dg;a=e.Bg.getTime();b=e.Kg.getTime();var f=e.Eg.getTime();D=[Math.floor(a/1E3)>>>0,(C=Math.floor(a/1E3),1<=+Math.abs(C)?0<C?+Math.floor(C/
|
||||
4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];z[c+40>>2]=D[0];z[c+44>>2]=D[1];A[c+48>>2]=a%1E3*1E3;D=[Math.floor(b/1E3)>>>0,(C=Math.floor(b/1E3),1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];z[c+56>>2]=D[0];z[c+60>>2]=D[1];A[c+64>>2]=b%1E3*1E3;D=[Math.floor(f/1E3)>>>0,(C=Math.floor(f/1E3),1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];z[c+72>>2]=D[0];z[c+76>>2]=D[1];A[c+80>>2]=
|
||||
f%1E3*1E3;D=[e.wg>>>0,(C=e.wg,1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];z[c+88>>2]=D[0];z[c+92>>2]=D[1];return 0}var Rb=void 0;function Sb(){var a=z[+Rb>>2];Rb+=4;return a}
|
||||
var Tb=(a,b)=>b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN,Ub=[0,31,60,91,121,152,182,213,244,274,305,335],Vb=[0,31,59,90,120,151,181,212,243,273,304,334],Xb=a=>{var b=Ta(a)+1,c=Wb(b);c&&Ua(a,w,c,b);return c},Yb={},$b=()=>{if(!Zb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:da||"./this.program"},b;for(b in Yb)void 0===Yb[b]?delete a[b]:a[b]=Yb[b];
|
||||
var c=[];for(b in a)c.push(`${b}=${a[b]}`);Zb=c}return Zb},Zb;function ac(){}function bc(){}function cc(){}function dc(){}function ec(){}function fc(){}function gc(){}function hc(){}function ic(){}function jc(){}function kc(){}function lc(){}function mc(){}function nc(){}function oc(){}function pc(){}function qc(){}function rc(){}function sc(){}function tc(){}function uc(){}function vc(){}function wc(){}function xc(){}function yc(){}function zc(){}function Ac(){}function Bc(){}function Cc(){}
|
||||
function Dc(){}function Ec(){}function Fc(){}function Gc(){}function Hc(){}function Ic(){}function Jc(){}function Kc(){}function Lc(){}function Mc(){}var Nc=0,Oc=a=>{oa=a;if(!(Ka||0<Nc)){if(d.onExit)d.onExit(a);na=!0}ea(a,new Ia(a))},Pc=a=>{a instanceof Ia||"unwind"==a||ea(1,a)},Qc=a=>{try{a()}catch(b){u(b)}};
|
||||
function Rc(){var a=U,b={},c;for(c in a)(function(e){var f=a[e];b[e]="function"==typeof f?function(){Sc.push(e);try{return f.apply(null,arguments)}finally{na||(Sc.pop()===e||u(),V&&1===W&&0===Sc.length&&(W=0,Qc(Tc),"undefined"!=typeof Fibers&&Fibers.ah()))}}:f})(c);return b}var W=0,V=null,Uc=0,Sc=[],Vc={},Wc={},Xc=0,Yc=null,Zc=[];function $c(){return new Promise((a,b)=>{Yc={resolve:a,reject:b}})}
|
||||
function ad(){var a=Wb(16396),b=a+12;A[a>>2]=b;A[a+4>>2]=b+16384;b=Sc[0];var c=Vc[b];void 0===c&&(c=Xc++,Vc[b]=c,Wc[c]=b);z[a+8>>2]=c;return a}
|
||||
function bd(a){if(!na){if(0===W){var b=!1,c=!1;a((e=0)=>{if(!na&&(Uc=e,b=!0,c)){W=2;Qc(()=>cd(V));"undefined"!=typeof Browser&&Browser.og.Hg&&Browser.og.resume();e=!1;try{var f=(0,U[Wc[z[V+8>>2]]])()}catch(n){f=n,e=!0}var h=!1;if(!V){var k=Yc;k&&(Yc=null,(e?k.reject:k.resolve)(f),h=!0)}if(e&&!h)throw f;}});c=!0;b||(W=1,V=ad(),"undefined"!=typeof Browser&&Browser.og.Hg&&Browser.og.pause(),Qc(()=>dd(V)))}else 2===W?(W=0,Qc(ed),fd(V),V=null,Zc.forEach(e=>{if(!na)try{if(e(),!(Ka||0<Nc))try{oa=e=oa,Oc(e)}catch(f){Pc(f)}}catch(f){Pc(f)}})):
|
||||
u(`invalid state: ${W}`);return Uc}}function gd(a){return bd(b=>{a().then(b)})}
|
||||
var hd={},jd=[],X,kd,ld=[],Z=(a,b,c,e,f)=>{function h(p){--Nc;0!==l&&md(l);return"string"===b?p?J(w,p):"":"boolean"===b?!!p:p}var k={string:p=>{var t=0;if(null!==p&&void 0!==p&&0!==p){t=Ta(p)+1;var y=nd(t);Ua(p,w,y,t);t=y}return t},array:p=>{var t=nd(p.length);v.set(p,t);return t}};a=d["_"+a];var n=[],l=0;if(e)for(var m=0;m<e.length;m++){var q=k[c[m]];q?(0===l&&(l=od()),n[m]=q(e[m])):n[m]=e[m]}c=V;e=a.apply(null,n);f=f&&f.async;Nc+=1;if(V!=c)return $c().then(h);e=h(e);return f?Promise.resolve(e):
|
||||
e},pd="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function sb(a,b,c,e){a||(a=this);this.parent=a;this.Tf=a.Tf;this.Zf=null;this.id=lb++;this.name=b;this.mode=c;this.Kf={};this.Lf={};this.dg=e}Object.defineProperties(sb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});Lb();P=Array(4096);zb(N,"/");S("/tmp");S("/home");
|
||||
S("/home/web_user");(function(){S("/dev");Ya(259,{read:()=>0,write:(e,f,h,k)=>k});Bb("/dev/null",259);Xa(1280,$a);Xa(1536,ab);Bb("/dev/tty",1280);Bb("/dev/tty1",1536);var a=new Uint8Array(1024),b=0,c=()=>{0===b&&(b=Qa(a).byteLength);return a[--b]};Nb("random",c);Nb("urandom",c);S("/dev/shm");S("/dev/shm/tmp")})();
|
||||
(function(){S("/proc");var a=S("/proc/self");S("/proc/self/fd");zb({Tf(){var b=db(a,"fd",16895,73);b.Kf={bg(c,e){var f=R(+e);c={parent:null,Tf:{xg:"fake"},Kf:{eg:()=>f.path}};return c.parent=c}};return b}},"/proc/self/fd")})();
|
||||
(function(){const a=new Map;d.setAuthorizer=function(b,c,e){c?a.set(b,{f:c,rg:e}):a.delete(b);return Z("set_authorizer","number",["number"],[b])};ac=function(b,c,e,f,h,k){if(a.has(b)){const {f:n,rg:l}=a.get(b);return n(l,c,e?e?J(w,e):"":null,f?f?J(w,f):"":null,h?h?J(w,h):"":null,k?k?J(w,k):"":null)}return 0}})();
|
||||
(function(){const a=new Map,b=new Map;d.createFunction=function(c,e,f,h,k,n){const l=a.size;a.set(l,{f:n,Wf:k});return Z("create_function","number","number string number number number number".split(" "),[c,e,f,h,l,0])};d.createAggregate=function(c,e,f,h,k,n,l){const m=a.size;a.set(m,{step:n,Gg:l,Wf:k});return Z("create_function","number","number string number number number number".split(" "),[c,e,f,h,m,1])};d.getFunctionUserData=function(c){return b.get(c)};cc=function(c,e,f,h){c=a.get(c);b.set(e,
|
||||
c.Wf);c.f(e,new Uint32Array(w.buffer,h,f));b.delete(e)};ec=function(c,e,f,h){c=a.get(c);b.set(e,c.Wf);c.step(e,new Uint32Array(w.buffer,h,f));b.delete(e)};bc=function(c,e){c=a.get(c);b.set(e,c.Wf);c.Gg(e);b.delete(e)}})();(function(){const a=new Map;d.progressHandler=function(b,c,e,f){e?a.set(b,{f:e,rg:f}):a.delete(b);return Z("progress_handler",null,["number","number"],[b,c])};dc=function(b){if(a.has(b)){const {f:c,rg:e}=a.get(b);return c(e)}return 0}})();
|
||||
(function(){function a(l,m){const q=`get${l}`,p=`set${l}`;return new Proxy(new DataView(w.buffer,m,"Int32"===l?4:8),{get(t,y){if(y===q)return function(B,G){if(!G)throw Error("must be little endian");return t[y](B,G)};if(y===p)return function(B,G,E){if(!E)throw Error("must be little endian");return t[y](B,G,E)};if("string"===typeof y&&y.match(/^(get)|(set)/))throw Error("invalid type");return t[y]}})}const b="object"===typeof hd,c=new Map,e=new Map,f=new Map,h=b?new Set:null,k=b?new Set:null,n=new Map;
|
||||
vc=function(l,m,q,p){n.set(l?J(w,l):"",{size:m,cg:Array.from(new Uint32Array(w.buffer,p,q))})};d.createModule=function(l,m,q,p){b&&(q.handleAsync=gd);const t=c.size;c.set(t,{module:q,Wf:p});p=0;q.xCreate&&(p|=1);q.xConnect&&(p|=2);q.xBestIndex&&(p|=4);q.xDisconnect&&(p|=8);q.xDestroy&&(p|=16);q.xOpen&&(p|=32);q.xClose&&(p|=64);q.xFilter&&(p|=128);q.xNext&&(p|=256);q.xEof&&(p|=512);q.xColumn&&(p|=1024);q.xRowid&&(p|=2048);q.xUpdate&&(p|=4096);q.xBegin&&(p|=8192);q.xSync&&(p|=16384);q.xCommit&&(p|=
|
||||
32768);q.xRollback&&(p|=65536);q.xFindFunction&&(p|=131072);q.xRename&&(p|=262144);return Z("create_module","number",["number","string","number","number"],[l,m,t,p])};lc=function(l,m,q,p,t,y){m=c.get(m);e.set(t,m);if(b){h.delete(t);for(const B of h)e.delete(B)}p=Array.from(new Uint32Array(w.buffer,p,q)).map(B=>B?J(w,B):"");return m.module.xCreate(l,m.Wf,p,t,a("Int32",y))};kc=function(l,m,q,p,t,y){m=c.get(m);e.set(t,m);if(b){h.delete(t);for(const B of h)e.delete(B)}p=Array.from(new Uint32Array(w.buffer,
|
||||
p,q)).map(B=>B?J(w,B):"");return m.module.xConnect(l,m.Wf,p,t,a("Int32",y))};gc=function(l,m){var q=e.get(l),p=n.get("sqlite3_index_info").cg;const t={};t.nConstraint=F(m+p[0],"i32");t.aConstraint=[];var y=F(m+p[1],"*"),B=n.get("sqlite3_index_constraint").size;for(var G=0;G<t.nConstraint;++G){var E=t.aConstraint,L=E.push,I=y+G*B,la=n.get("sqlite3_index_constraint").cg,Y={};Y.iColumn=F(I+la[0],"i32");Y.op=F(I+la[1],"i8");Y.usable=!!F(I+la[2],"i8");L.call(E,Y)}t.nOrderBy=F(m+p[2],"i32");t.aOrderBy=
|
||||
[];y=F(m+p[3],"*");B=n.get("sqlite3_index_orderby").size;for(G=0;G<t.nOrderBy;++G)E=t.aOrderBy,L=E.push,I=y+G*B,la=n.get("sqlite3_index_orderby").cg,Y={},Y.iColumn=F(I+la[0],"i32"),Y.desc=!!F(I+la[1],"i8"),L.call(E,Y);t.aConstraintUsage=[];for(y=0;y<t.nConstraint;++y)t.aConstraintUsage.push({argvIndex:0,omit:!1});t.idxNum=F(m+p[5],"i32");t.idxStr=null;t.orderByConsumed=!!F(m+p[8],"i8");t.estimatedCost=F(m+p[9],"double");t.estimatedRows=F(m+p[10],"i32");t.idxFlags=F(m+p[11],"i32");t.colUsed=F(m+p[12],
|
||||
"i32");l=q.module.xBestIndex(l,t);q=n.get("sqlite3_index_info").cg;p=F(m+q[4],"*");y=n.get("sqlite3_index_constraint_usage").size;for(L=0;L<t.nConstraint;++L)B=p+L*y,E=t.aConstraintUsage[L],I=n.get("sqlite3_index_constraint_usage").cg,H(B+I[0],E.argvIndex,"i32"),H(B+I[1],E.omit?1:0,"i8");H(m+q[5],t.idxNum,"i32");"string"===typeof t.idxStr&&(p=Ta(t.idxStr),y=Z("sqlite3_malloc","number",["number"],[p+1]),Ua(t.idxStr,w,y,p+1),H(m+q[6],y,"*"),H(m+q[7],1,"i32"));H(m+q[8],t.orderByConsumed,"i32");H(m+q[9],
|
||||
t.estimatedCost,"double");H(m+q[10],t.estimatedRows,"i32");H(m+q[11],t.idxFlags,"i32");return l};nc=function(l){const m=e.get(l);b?h.add(l):e.delete(l);return m.module.xDisconnect(l)};mc=function(l){const m=e.get(l);b?h.add(l):e.delete(l);return m.module.xDestroy(l)};rc=function(l,m){const q=e.get(l);f.set(m,q);if(b){k.delete(m);for(const p of k)f.delete(p)}return q.module.xOpen(l,m)};hc=function(l){const m=f.get(l);b?k.add(l):f.delete(l);return m.module.xClose(l)};oc=function(l){return f.get(l).module.xEof(l)?
|
||||
1:0};pc=function(l,m,q,p,t){const y=f.get(l);q=q?q?J(w,q):"":null;t=new Uint32Array(w.buffer,t,p);return y.module.xFilter(l,m,q,t)};qc=function(l){return f.get(l).module.xNext(l)};ic=function(l,m,q){return f.get(l).module.xColumn(l,m,q)};uc=function(l,m){return f.get(l).module.xRowid(l,a("BigInt64",m))};xc=function(l,m,q,p){const t=e.get(l);q=new Uint32Array(w.buffer,q,m);return t.module.xUpdate(l,q,a("BigInt64",p))};fc=function(l){return e.get(l).module.xBegin(l)};wc=function(l){return e.get(l).module.xSync(l)};
|
||||
jc=function(l){return e.get(l).module.xCommit(l)};tc=function(l){return e.get(l).module.xRollback(l)};sc=function(l,m){const q=e.get(l);m=m?J(w,m):"";return q.module.xRename(l,m)}})();
|
||||
(function(){function a(h,k){const n=`get${h}`,l=`set${h}`;return new Proxy(new DataView(w.buffer,k,"Int32"===h?4:8),{get(m,q){if(q===n)return function(p,t){if(!t)throw Error("must be little endian");return m[q](p,t)};if(q===l)return function(p,t,y){if(!y)throw Error("must be little endian");return m[q](p,t,y)};if("string"===typeof q&&q.match(/^(get)|(set)/))throw Error("invalid type");return m[q]}})}const b="object"===typeof hd;b&&(d.handleAsync=gd);const c=new Map,e=new Map;d.registerVFS=function(h,
|
||||
k){if(Z("sqlite3_vfs_find","number",["string"],[h.name]))throw Error(`VFS '${h.name}' already registered`);b&&(h.handleAsync=gd);var n=h.Zg??64;const l=d._malloc(4);k=Z("register_vfs","number",["string","number","number","number"],[h.name,n,k?1:0,l]);k||(n=F(l,"*"),c.set(n,h));d._free(l);return k};const f=b?new Set:null;Ac=function(h){const k=e.get(h);b?f.add(h):e.delete(h);return k.xClose(h)};Hc=function(h,k,n,l,m){return e.get(h).xRead(h,w.subarray(k,k+n),4294967296*m+l+(0>l?2**32:0))};Mc=function(h,
|
||||
k,n,l,m){return e.get(h).xWrite(h,w.subarray(k,k+n),4294967296*m+l+(0>l?2**32:0))};Kc=function(h,k,n){return e.get(h).xTruncate(h,4294967296*n+k+(0>k?2**32:0))};Jc=function(h,k){return e.get(h).xSync(h,k)};Ec=function(h,k){const n=e.get(h);k=a("BigInt64",k);return n.xFileSize(h,k)};Fc=function(h,k){return e.get(h).xLock(h,k)};Lc=function(h,k){return e.get(h).xUnlock(h,k)};zc=function(h,k){const n=e.get(h);k=a("Int32",k);return n.xCheckReservedLock(h,k)};Dc=function(h,k,n){const l=e.get(h);n=new DataView(w.buffer,
|
||||
n);return l.xFileControl(h,k,n)};Ic=function(h){return e.get(h).xSectorSize(h)};Cc=function(h){return e.get(h).xDeviceCharacteristics(h)};Gc=function(h,k,n,l,m){h=c.get(h);e.set(n,h);if(b){f.delete(n);for(var q of f)e.delete(q)}q=null;if(l&64){q=1;const p=[];for(;q;){const t=w[k++];if(t)p.push(t);else switch(w[k]||(q=null),q){case 1:p.push(63);q=2;break;case 2:p.push(61);q=3;break;case 3:p.push(38),q=2}}q=(new TextDecoder).decode(new Uint8Array(p))}else k&&(q=k?J(w,k):"");m=a("Int32",m);return h.xOpen(q,
|
||||
n,l,m)};Bc=function(h,k,n){return c.get(h).xDelete(k?J(w,k):"",n)};yc=function(h,k,n,l){h=c.get(h);l=a("Int32",l);return h.xAccess(k?J(w,k):"",n,l)}})();
|
||||
var rd={a:(a,b,c,e)=>{u(`Assertion failed: ${a?J(w,a):""}, at: `+[b?b?J(w,b):"":"unknown filename",c,e?e?J(w,e):"":"unknown function"])},P:function(a,b){try{return a=a?J(w,a):"",Gb(a,b),0}catch(c){if("undefined"==typeof T||"ErrnoError"!==c.name)throw c;return-c.Nf}},S:function(a,b,c){try{b=b?J(w,b):"";b=Pb(a,b);if(c&-8)return-28;var e=Q(b,{Xf:!0}).node;if(!e)return-44;a="";c&4&&(a+="r");c&2&&(a+="w");c&1&&(a+="x");return a&&rb(e,a)?-2:0}catch(f){if("undefined"==typeof T||"ErrnoError"!==f.name)throw f;
|
||||
return-f.Nf}},Q:function(a,b){try{var c=R(a);Gb(c.node,b);return 0}catch(e){if("undefined"==typeof T||"ErrnoError"!==e.name)throw e;return-e.Nf}},O:function(a){try{var b=R(a).node;var c="string"==typeof b?Q(b,{Xf:!0}).node:b;if(!c.Kf.Pf)throw new M(63);c.Kf.Pf(c,{timestamp:Date.now()});return 0}catch(e){if("undefined"==typeof T||"ErrnoError"!==e.name)throw e;return-e.Nf}},b:function(a,b,c){Rb=c;try{var e=R(a);switch(b){case 0:var f=Sb();if(0>f)return-28;for(;kb[f];)f++;return xb(e,f).Vf;case 1:case 2:return 0;
|
||||
case 3:return e.flags;case 4:return f=Sb(),e.flags|=f,0;case 5:return f=Sb(),x[f+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return z[qd()>>2]=28,-1;default:return-28}}catch(h){if("undefined"==typeof T||"ErrnoError"!==h.name)throw h;return-h.Nf}},N:function(a,b){try{var c=R(a);return Qb(Eb,c.path,b)}catch(e){if("undefined"==typeof T||"ErrnoError"!==e.name)throw e;return-e.Nf}},n:function(a,b,c){b=Tb(b,c);try{if(isNaN(b))return 61;var e=R(a);if(0===(e.flags&2097155))throw new M(28);
|
||||
Hb(e.node,b);return 0}catch(f){if("undefined"==typeof T||"ErrnoError"!==f.name)throw f;return-f.Nf}},H:function(a,b){try{if(0===b)return-28;var c=Ta("/")+1;if(b<c)return-68;Ua("/",w,a,b);return c}catch(e){if("undefined"==typeof T||"ErrnoError"!==e.name)throw e;return-e.Nf}},L:function(a,b){try{return a=a?J(w,a):"",Qb(Fb,a,b)}catch(c){if("undefined"==typeof T||"ErrnoError"!==c.name)throw c;return-c.Nf}},E:function(a,b,c){try{return b=b?J(w,b):"",b=Pb(a,b),b=K(b),"/"===b[b.length-1]&&(b=b.substr(0,
|
||||
b.length-1)),S(b,c),0}catch(e){if("undefined"==typeof T||"ErrnoError"!==e.name)throw e;return-e.Nf}},J:function(a,b,c,e){try{b=b?J(w,b):"";var f=e&256;b=Pb(a,b,e&4096);return Qb(f?Fb:Eb,b,c)}catch(h){if("undefined"==typeof T||"ErrnoError"!==h.name)throw h;return-h.Nf}},D:function(a,b,c,e){Rb=e;try{b=b?J(w,b):"";b=Pb(a,b);var f=e?Sb():0;return Ib(b,c,f).Vf}catch(h){if("undefined"==typeof T||"ErrnoError"!==h.name)throw h;return-h.Nf}},B:function(a,b,c,e){try{b=b?J(w,b):"";b=Pb(a,b);if(0>=e)return-28;
|
||||
var f=nb(b),h=Math.min(e,Ta(f)),k=v[c+h];Ua(f,w,c,e+1);v[c+h]=k;return h}catch(n){if("undefined"==typeof T||"ErrnoError"!==n.name)throw n;return-n.Nf}},A:function(a){try{return a=a?J(w,a):"",Db(a),0}catch(b){if("undefined"==typeof T||"ErrnoError"!==b.name)throw b;return-b.Nf}},M:function(a,b){try{return a=a?J(w,a):"",Qb(Eb,a,b)}catch(c){if("undefined"==typeof T||"ErrnoError"!==c.name)throw c;return-c.Nf}},v:function(a,b,c){try{b=b?J(w,b):"";b=Pb(a,b);if(0===c){a=b;var e=Q(a,{parent:!0}).node;if(!e)throw new M(44);
|
||||
var f=Oa(a),h=fb(e,f),k=vb(e,f,!1);if(k)throw new M(k);if(!e.Kf.mg)throw new M(63);if(h.Zf)throw new M(10);e.Kf.mg(e,f);qb(h)}else 512===c?Db(b):u("Invalid flags passed to unlinkat");return 0}catch(n){if("undefined"==typeof T||"ErrnoError"!==n.name)throw n;return-n.Nf}},u:function(a,b,c){try{b=b?J(w,b):"";b=Pb(a,b,!0);if(c){var e=A[c>>2]+4294967296*z[c+4>>2],f=z[c+8>>2];h=1E3*e+f/1E6;c+=16;e=A[c>>2]+4294967296*z[c+4>>2];f=z[c+8>>2];k=1E3*e+f/1E6}else var h=Date.now(),k=h;a=h;var n=Q(b,{Xf:!0}).node;
|
||||
n.Kf.Pf(n,{timestamp:Math.max(a,k)});return 0}catch(l){if("undefined"==typeof T||"ErrnoError"!==l.name)throw l;return-l.Nf}},l:function(a,b,c){a=new Date(1E3*Tb(a,b));z[c>>2]=a.getSeconds();z[c+4>>2]=a.getMinutes();z[c+8>>2]=a.getHours();z[c+12>>2]=a.getDate();z[c+16>>2]=a.getMonth();z[c+20>>2]=a.getFullYear()-1900;z[c+24>>2]=a.getDay();b=a.getFullYear();z[c+28>>2]=(0!==b%4||0===b%100&&0!==b%400?Vb:Ub)[a.getMonth()]+a.getDate()-1|0;z[c+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),
|
||||
6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();z[c+32>>2]=(b!=e&&a.getTimezoneOffset()==Math.min(e,b))|0},j:function(a,b,c,e,f,h,k,n){f=Tb(f,h);try{if(isNaN(f))return 61;var l=R(e);if(0!==(b&2)&&0===(c&2)&&2!==(l.flags&2097155))throw new M(2);if(1===(l.flags&2097155))throw new M(2);if(!l.Lf.ig)throw new M(43);var m=l.Lf.ig(l,a,f,b,c);var q=m.Mg;z[k>>2]=m.Ag;A[n>>2]=q;return 0}catch(p){if("undefined"==typeof T||"ErrnoError"!==p.name)throw p;return-p.Nf}},k:function(a,
|
||||
b,c,e,f,h,k){h=Tb(h,k);try{if(isNaN(h))return 61;var n=R(f);if(c&2){if(32768!==(n.node.mode&61440))throw new M(43);e&2||n.Lf.jg&&n.Lf.jg(n,w.slice(a,a+b),h,b,e)}}catch(l){if("undefined"==typeof T||"ErrnoError"!==l.name)throw l;return-l.Nf}},w:(a,b,c)=>{function e(l){return(l=l.toTimeString().match(/\(([A-Za-z ]+)\)$/))?l[1]:"GMT"}var f=(new Date).getFullYear(),h=new Date(f,0,1),k=new Date(f,6,1);f=h.getTimezoneOffset();var n=k.getTimezoneOffset();A[a>>2]=60*Math.max(f,n);z[b>>2]=Number(f!=n);a=e(h);
|
||||
b=e(k);a=Xb(a);b=Xb(b);n<f?(A[c>>2]=a,A[c+4>>2]=b):(A[c>>2]=b,A[c+4>>2]=a)},ua:()=>{u("")},e:()=>Date.now(),d:()=>performance.now(),x:(a,b,c)=>w.copyWithin(a,b,b+c),s:a=>{var b=w.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);var f=Math;e=Math.max(a,e);a:{f=(f.min.call(f,2147483648,e+(65536-e%65536)%65536)-ma.buffer.byteLength+65535)/65536;try{ma.grow(f);sa();var h=1;break a}catch(k){}h=void 0}if(h)return!0}return!1},F:(a,b)=>{var c=0;$b().forEach((e,
|
||||
f)=>{var h=b+c;f=A[a+4*f>>2]=h;for(h=0;h<e.length;++h)v[f++>>0]=e.charCodeAt(h);v[f>>0]=0;c+=e.length+1});return 0},G:(a,b)=>{var c=$b();A[a>>2]=c.length;var e=0;c.forEach(f=>e+=f.length+1);A[b>>2]=e;return 0},f:function(a){try{var b=R(a);if(null===b.Vf)throw new M(8);b.ng&&(b.ng=null);try{b.Lf.close&&b.Lf.close(b)}catch(c){throw c;}finally{kb[b.Vf]=null}b.Vf=null;return 0}catch(c){if("undefined"==typeof T||"ErrnoError"!==c.name)throw c;return c.Nf}},t:function(a,b){try{var c=R(a);v[b>>0]=c.Rf?2:
|
||||
O(c.mode)?3:40960===(c.mode&61440)?7:4;x[b+2>>1]=0;D=[0,(C=0,1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];z[b+8>>2]=D[0];z[b+12>>2]=D[1];D=[0,(C=0,1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];z[b+16>>2]=D[0];z[b+20>>2]=D[1];return 0}catch(e){if("undefined"==typeof T||"ErrnoError"!==e.name)throw e;return e.Nf}},C:function(a,b,c,e){try{a:{var f=R(a);a=b;for(var h,k=b=0;k<c;k++){var n=A[a>>2],l=
|
||||
A[a+4>>2];a+=8;var m=f,q=n,p=l,t=h,y=v;if(0>p||0>t)throw new M(28);if(null===m.Vf)throw new M(8);if(1===(m.flags&2097155))throw new M(8);if(O(m.node.mode))throw new M(31);if(!m.Lf.read)throw new M(28);var B="undefined"!=typeof t;if(!B)t=m.position;else if(!m.seekable)throw new M(70);var G=m.Lf.read(m,y,q,p,t);B||(m.position+=G);var E=G;if(0>E){var L=-1;break a}b+=E;if(E<l)break;"undefined"!==typeof h&&(h+=E)}L=b}A[e>>2]=L;return 0}catch(I){if("undefined"==typeof T||"ErrnoError"!==I.name)throw I;return I.Nf}},
|
||||
m:function(a,b,c,e,f){b=Tb(b,c);try{if(isNaN(b))return 61;var h=R(a);Kb(h,b,e);D=[h.position>>>0,(C=h.position,1<=+Math.abs(C)?0<C?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)];z[f>>2]=D[0];z[f+4>>2]=D[1];h.ng&&0===b&&0===e&&(h.ng=null);return 0}catch(k){if("undefined"==typeof T||"ErrnoError"!==k.name)throw k;return k.Nf}},I:function(a){try{var b=R(a);return bd(c=>{var e=b.node.Tf;e.type.Og?e.type.Og(e,!1,f=>{f?c(29):c(0)}):c(0)})}catch(c){if("undefined"==typeof T||
|
||||
"ErrnoError"!==c.name)throw c;return c.Nf}},y:function(a,b,c,e){try{a:{var f=R(a);a=b;for(var h,k=b=0;k<c;k++){var n=A[a>>2],l=A[a+4>>2];a+=8;var m=f,q=n,p=l,t=h,y=v;if(0>p||0>t)throw new M(28);if(null===m.Vf)throw new M(8);if(0===(m.flags&2097155))throw new M(8);if(O(m.node.mode))throw new M(31);if(!m.Lf.write)throw new M(28);m.seekable&&m.flags&1024&&Kb(m,0,2);var B="undefined"!=typeof t;if(!B)t=m.position;else if(!m.seekable)throw new M(70);var G=m.Lf.write(m,y,q,p,t,void 0);B||(m.position+=G);
|
||||
var E=G;if(0>E){var L=-1;break a}b+=E;"undefined"!==typeof h&&(h+=E)}L=b}A[e>>2]=L;return 0}catch(I){if("undefined"==typeof T||"ErrnoError"!==I.name)throw I;return I.Nf}},g:(a,b)=>{Qa(w.subarray(a,a+b));return 0},aa:ac,z:bc,R:cc,ea:dc,K:ec,ma:fc,o:gc,ta:hc,pa:ic,ka:jc,ga:kc,ha:lc,h:mc,i:nc,qa:oc,sa:pc,ra:qc,fa:rc,ia:sc,ja:tc,oa:uc,c:vc,la:wc,na:xc,ca:yc,X:zc,ba:Ac,da:Bc,U:Cc,W:Dc,_:Ec,Z:Fc,T:Gc,r:Hc,V:Ic,$:Jc,p:Kc,Y:Lc,q:Mc},U=function(){function a(c){U=c.exports;U=Rc();ma=U.va;sa();X=U.Af;ua.unshift(U.wa);
|
||||
ya--;d.monitorRunDependencies&&d.monitorRunDependencies(ya);0==ya&&(null!==za&&(clearInterval(za),za=null),Aa&&(c=Aa,Aa=null,c()));return U}var b={a:rd};ya++;d.monitorRunDependencies&&d.monitorRunDependencies(ya);if(d.instantiateWasm)try{return d.instantiateWasm(b,a)}catch(c){r(`Module.instantiateWasm callback failed with error: ${c}`),ba(c)}Ha(b,function(c){a(c.instance)}).catch(ba);return{}}();d._sqlite3_status64=(a,b,c,e)=>(d._sqlite3_status64=U.xa)(a,b,c,e);
|
||||
d._sqlite3_status=(a,b,c,e)=>(d._sqlite3_status=U.ya)(a,b,c,e);d._sqlite3_db_status=(a,b,c,e,f)=>(d._sqlite3_db_status=U.za)(a,b,c,e,f);d._sqlite3_msize=a=>(d._sqlite3_msize=U.Aa)(a);d._sqlite3_vfs_find=a=>(d._sqlite3_vfs_find=U.Ba)(a);d._sqlite3_vfs_register=(a,b)=>(d._sqlite3_vfs_register=U.Ca)(a,b);d._sqlite3_vfs_unregister=a=>(d._sqlite3_vfs_unregister=U.Da)(a);d._sqlite3_release_memory=a=>(d._sqlite3_release_memory=U.Ea)(a);
|
||||
d._sqlite3_soft_heap_limit64=(a,b)=>(d._sqlite3_soft_heap_limit64=U.Fa)(a,b);d._sqlite3_memory_used=()=>(d._sqlite3_memory_used=U.Ga)();d._sqlite3_hard_heap_limit64=(a,b)=>(d._sqlite3_hard_heap_limit64=U.Ha)(a,b);d._sqlite3_memory_highwater=a=>(d._sqlite3_memory_highwater=U.Ia)(a);d._sqlite3_malloc=a=>(d._sqlite3_malloc=U.Ja)(a);d._sqlite3_malloc64=(a,b)=>(d._sqlite3_malloc64=U.Ka)(a,b);d._sqlite3_free=a=>(d._sqlite3_free=U.La)(a);d._sqlite3_realloc=(a,b)=>(d._sqlite3_realloc=U.Ma)(a,b);
|
||||
d._sqlite3_realloc64=(a,b,c)=>(d._sqlite3_realloc64=U.Na)(a,b,c);d._sqlite3_str_vappendf=(a,b,c)=>(d._sqlite3_str_vappendf=U.Oa)(a,b,c);d._sqlite3_str_append=(a,b,c)=>(d._sqlite3_str_append=U.Pa)(a,b,c);d._sqlite3_str_appendchar=(a,b,c)=>(d._sqlite3_str_appendchar=U.Qa)(a,b,c);d._sqlite3_str_appendall=(a,b)=>(d._sqlite3_str_appendall=U.Ra)(a,b);d._sqlite3_str_appendf=(a,b,c)=>(d._sqlite3_str_appendf=U.Sa)(a,b,c);d._sqlite3_str_finish=a=>(d._sqlite3_str_finish=U.Ta)(a);
|
||||
d._sqlite3_str_errcode=a=>(d._sqlite3_str_errcode=U.Ua)(a);d._sqlite3_str_length=a=>(d._sqlite3_str_length=U.Va)(a);d._sqlite3_str_value=a=>(d._sqlite3_str_value=U.Wa)(a);d._sqlite3_str_reset=a=>(d._sqlite3_str_reset=U.Xa)(a);d._sqlite3_str_new=a=>(d._sqlite3_str_new=U.Ya)(a);d._sqlite3_vmprintf=(a,b)=>(d._sqlite3_vmprintf=U.Za)(a,b);d._sqlite3_mprintf=(a,b)=>(d._sqlite3_mprintf=U._a)(a,b);d._sqlite3_vsnprintf=(a,b,c,e)=>(d._sqlite3_vsnprintf=U.$a)(a,b,c,e);
|
||||
d._sqlite3_snprintf=(a,b,c,e)=>(d._sqlite3_snprintf=U.ab)(a,b,c,e);d._sqlite3_log=(a,b,c)=>(d._sqlite3_log=U.bb)(a,b,c);d._sqlite3_randomness=(a,b)=>(d._sqlite3_randomness=U.cb)(a,b);d._sqlite3_stricmp=(a,b)=>(d._sqlite3_stricmp=U.db)(a,b);d._sqlite3_strnicmp=(a,b,c)=>(d._sqlite3_strnicmp=U.eb)(a,b,c);d._sqlite3_os_init=()=>(d._sqlite3_os_init=U.fb)();d._sqlite3_os_end=()=>(d._sqlite3_os_end=U.gb)();d._sqlite3_serialize=(a,b,c,e)=>(d._sqlite3_serialize=U.hb)(a,b,c,e);
|
||||
d._sqlite3_prepare_v2=(a,b,c,e,f)=>(d._sqlite3_prepare_v2=U.ib)(a,b,c,e,f);d._sqlite3_step=a=>(d._sqlite3_step=U.jb)(a);d._sqlite3_column_int64=(a,b)=>(d._sqlite3_column_int64=U.kb)(a,b);d._sqlite3_column_int=(a,b)=>(d._sqlite3_column_int=U.lb)(a,b);d._sqlite3_finalize=a=>(d._sqlite3_finalize=U.mb)(a);d._sqlite3_deserialize=(a,b,c,e,f,h,k,n)=>(d._sqlite3_deserialize=U.nb)(a,b,c,e,f,h,k,n);d._sqlite3_database_file_object=a=>(d._sqlite3_database_file_object=U.ob)(a);
|
||||
d._sqlite3_backup_init=(a,b,c,e)=>(d._sqlite3_backup_init=U.pb)(a,b,c,e);d._sqlite3_backup_step=(a,b)=>(d._sqlite3_backup_step=U.qb)(a,b);d._sqlite3_backup_finish=a=>(d._sqlite3_backup_finish=U.rb)(a);d._sqlite3_backup_remaining=a=>(d._sqlite3_backup_remaining=U.sb)(a);d._sqlite3_backup_pagecount=a=>(d._sqlite3_backup_pagecount=U.tb)(a);d._sqlite3_reset=a=>(d._sqlite3_reset=U.ub)(a);d._sqlite3_clear_bindings=a=>(d._sqlite3_clear_bindings=U.vb)(a);d._sqlite3_value_blob=a=>(d._sqlite3_value_blob=U.wb)(a);
|
||||
d._sqlite3_value_text=a=>(d._sqlite3_value_text=U.xb)(a);d._sqlite3_value_bytes=a=>(d._sqlite3_value_bytes=U.yb)(a);d._sqlite3_value_bytes16=a=>(d._sqlite3_value_bytes16=U.zb)(a);d._sqlite3_value_double=a=>(d._sqlite3_value_double=U.Ab)(a);d._sqlite3_value_int=a=>(d._sqlite3_value_int=U.Bb)(a);d._sqlite3_value_int64=a=>(d._sqlite3_value_int64=U.Cb)(a);d._sqlite3_value_subtype=a=>(d._sqlite3_value_subtype=U.Db)(a);d._sqlite3_value_pointer=(a,b)=>(d._sqlite3_value_pointer=U.Eb)(a,b);
|
||||
d._sqlite3_value_text16=a=>(d._sqlite3_value_text16=U.Fb)(a);d._sqlite3_value_text16be=a=>(d._sqlite3_value_text16be=U.Gb)(a);d._sqlite3_value_text16le=a=>(d._sqlite3_value_text16le=U.Hb)(a);d._sqlite3_value_type=a=>(d._sqlite3_value_type=U.Ib)(a);d._sqlite3_value_encoding=a=>(d._sqlite3_value_encoding=U.Jb)(a);d._sqlite3_value_nochange=a=>(d._sqlite3_value_nochange=U.Kb)(a);d._sqlite3_value_frombind=a=>(d._sqlite3_value_frombind=U.Lb)(a);d._sqlite3_value_dup=a=>(d._sqlite3_value_dup=U.Mb)(a);
|
||||
d._sqlite3_value_free=a=>(d._sqlite3_value_free=U.Nb)(a);d._sqlite3_result_blob=(a,b,c,e)=>(d._sqlite3_result_blob=U.Ob)(a,b,c,e);d._sqlite3_result_blob64=(a,b,c,e,f)=>(d._sqlite3_result_blob64=U.Pb)(a,b,c,e,f);d._sqlite3_result_double=(a,b)=>(d._sqlite3_result_double=U.Qb)(a,b);d._sqlite3_result_error=(a,b,c)=>(d._sqlite3_result_error=U.Rb)(a,b,c);d._sqlite3_result_error16=(a,b,c)=>(d._sqlite3_result_error16=U.Sb)(a,b,c);d._sqlite3_result_int=(a,b)=>(d._sqlite3_result_int=U.Tb)(a,b);
|
||||
d._sqlite3_result_int64=(a,b,c)=>(d._sqlite3_result_int64=U.Ub)(a,b,c);d._sqlite3_result_null=a=>(d._sqlite3_result_null=U.Vb)(a);d._sqlite3_result_pointer=(a,b,c,e)=>(d._sqlite3_result_pointer=U.Wb)(a,b,c,e);d._sqlite3_result_subtype=(a,b)=>(d._sqlite3_result_subtype=U.Xb)(a,b);d._sqlite3_result_text=(a,b,c,e)=>(d._sqlite3_result_text=U.Yb)(a,b,c,e);d._sqlite3_result_text64=(a,b,c,e,f,h)=>(d._sqlite3_result_text64=U.Zb)(a,b,c,e,f,h);
|
||||
d._sqlite3_result_text16=(a,b,c,e)=>(d._sqlite3_result_text16=U._b)(a,b,c,e);d._sqlite3_result_text16be=(a,b,c,e)=>(d._sqlite3_result_text16be=U.$b)(a,b,c,e);d._sqlite3_result_text16le=(a,b,c,e)=>(d._sqlite3_result_text16le=U.ac)(a,b,c,e);d._sqlite3_result_value=(a,b)=>(d._sqlite3_result_value=U.bc)(a,b);d._sqlite3_result_error_toobig=a=>(d._sqlite3_result_error_toobig=U.cc)(a);d._sqlite3_result_zeroblob=(a,b)=>(d._sqlite3_result_zeroblob=U.dc)(a,b);
|
||||
d._sqlite3_result_zeroblob64=(a,b,c)=>(d._sqlite3_result_zeroblob64=U.ec)(a,b,c);d._sqlite3_result_error_code=(a,b)=>(d._sqlite3_result_error_code=U.fc)(a,b);d._sqlite3_result_error_nomem=a=>(d._sqlite3_result_error_nomem=U.gc)(a);d._sqlite3_user_data=a=>(d._sqlite3_user_data=U.hc)(a);d._sqlite3_context_db_handle=a=>(d._sqlite3_context_db_handle=U.ic)(a);d._sqlite3_vtab_nochange=a=>(d._sqlite3_vtab_nochange=U.jc)(a);d._sqlite3_vtab_in_first=(a,b)=>(d._sqlite3_vtab_in_first=U.kc)(a,b);
|
||||
d._sqlite3_vtab_in_next=(a,b)=>(d._sqlite3_vtab_in_next=U.lc)(a,b);d._sqlite3_aggregate_context=(a,b)=>(d._sqlite3_aggregate_context=U.mc)(a,b);d._sqlite3_get_auxdata=(a,b)=>(d._sqlite3_get_auxdata=U.nc)(a,b);d._sqlite3_set_auxdata=(a,b,c,e)=>(d._sqlite3_set_auxdata=U.oc)(a,b,c,e);d._sqlite3_column_count=a=>(d._sqlite3_column_count=U.pc)(a);d._sqlite3_data_count=a=>(d._sqlite3_data_count=U.qc)(a);d._sqlite3_column_blob=(a,b)=>(d._sqlite3_column_blob=U.rc)(a,b);
|
||||
d._sqlite3_column_bytes=(a,b)=>(d._sqlite3_column_bytes=U.sc)(a,b);d._sqlite3_column_bytes16=(a,b)=>(d._sqlite3_column_bytes16=U.tc)(a,b);d._sqlite3_column_double=(a,b)=>(d._sqlite3_column_double=U.uc)(a,b);d._sqlite3_column_text=(a,b)=>(d._sqlite3_column_text=U.vc)(a,b);d._sqlite3_column_value=(a,b)=>(d._sqlite3_column_value=U.wc)(a,b);d._sqlite3_column_text16=(a,b)=>(d._sqlite3_column_text16=U.xc)(a,b);d._sqlite3_column_type=(a,b)=>(d._sqlite3_column_type=U.yc)(a,b);
|
||||
d._sqlite3_column_name=(a,b)=>(d._sqlite3_column_name=U.zc)(a,b);d._sqlite3_column_name16=(a,b)=>(d._sqlite3_column_name16=U.Ac)(a,b);d._sqlite3_bind_blob=(a,b,c,e,f)=>(d._sqlite3_bind_blob=U.Bc)(a,b,c,e,f);d._sqlite3_bind_blob64=(a,b,c,e,f,h)=>(d._sqlite3_bind_blob64=U.Cc)(a,b,c,e,f,h);d._sqlite3_bind_double=(a,b,c)=>(d._sqlite3_bind_double=U.Dc)(a,b,c);d._sqlite3_bind_int=(a,b,c)=>(d._sqlite3_bind_int=U.Ec)(a,b,c);d._sqlite3_bind_int64=(a,b,c,e)=>(d._sqlite3_bind_int64=U.Fc)(a,b,c,e);
|
||||
d._sqlite3_bind_null=(a,b)=>(d._sqlite3_bind_null=U.Gc)(a,b);d._sqlite3_bind_pointer=(a,b,c,e,f)=>(d._sqlite3_bind_pointer=U.Hc)(a,b,c,e,f);d._sqlite3_bind_text=(a,b,c,e,f)=>(d._sqlite3_bind_text=U.Ic)(a,b,c,e,f);d._sqlite3_bind_text64=(a,b,c,e,f,h,k)=>(d._sqlite3_bind_text64=U.Jc)(a,b,c,e,f,h,k);d._sqlite3_bind_text16=(a,b,c,e,f)=>(d._sqlite3_bind_text16=U.Kc)(a,b,c,e,f);d._sqlite3_bind_value=(a,b,c)=>(d._sqlite3_bind_value=U.Lc)(a,b,c);
|
||||
d._sqlite3_bind_zeroblob=(a,b,c)=>(d._sqlite3_bind_zeroblob=U.Mc)(a,b,c);d._sqlite3_bind_zeroblob64=(a,b,c,e)=>(d._sqlite3_bind_zeroblob64=U.Nc)(a,b,c,e);d._sqlite3_bind_parameter_count=a=>(d._sqlite3_bind_parameter_count=U.Oc)(a);d._sqlite3_bind_parameter_name=(a,b)=>(d._sqlite3_bind_parameter_name=U.Pc)(a,b);d._sqlite3_bind_parameter_index=(a,b)=>(d._sqlite3_bind_parameter_index=U.Qc)(a,b);d._sqlite3_db_handle=a=>(d._sqlite3_db_handle=U.Rc)(a);
|
||||
d._sqlite3_stmt_readonly=a=>(d._sqlite3_stmt_readonly=U.Sc)(a);d._sqlite3_stmt_isexplain=a=>(d._sqlite3_stmt_isexplain=U.Tc)(a);d._sqlite3_stmt_explain=(a,b)=>(d._sqlite3_stmt_explain=U.Uc)(a,b);d._sqlite3_stmt_busy=a=>(d._sqlite3_stmt_busy=U.Vc)(a);d._sqlite3_next_stmt=(a,b)=>(d._sqlite3_next_stmt=U.Wc)(a,b);d._sqlite3_stmt_status=(a,b,c)=>(d._sqlite3_stmt_status=U.Xc)(a,b,c);d._sqlite3_sql=a=>(d._sqlite3_sql=U.Yc)(a);d._sqlite3_expanded_sql=a=>(d._sqlite3_expanded_sql=U.Zc)(a);
|
||||
d._sqlite3_value_numeric_type=a=>(d._sqlite3_value_numeric_type=U._c)(a);d._sqlite3_blob_open=(a,b,c,e,f,h,k,n)=>(d._sqlite3_blob_open=U.$c)(a,b,c,e,f,h,k,n);d._sqlite3_blob_close=a=>(d._sqlite3_blob_close=U.ad)(a);d._sqlite3_blob_read=(a,b,c,e)=>(d._sqlite3_blob_read=U.bd)(a,b,c,e);d._sqlite3_blob_write=(a,b,c,e)=>(d._sqlite3_blob_write=U.cd)(a,b,c,e);d._sqlite3_blob_bytes=a=>(d._sqlite3_blob_bytes=U.dd)(a);d._sqlite3_blob_reopen=(a,b,c)=>(d._sqlite3_blob_reopen=U.ed)(a,b,c);
|
||||
d._sqlite3_set_authorizer=(a,b,c)=>(d._sqlite3_set_authorizer=U.fd)(a,b,c);d._sqlite3_strglob=(a,b)=>(d._sqlite3_strglob=U.gd)(a,b);d._sqlite3_strlike=(a,b,c)=>(d._sqlite3_strlike=U.hd)(a,b,c);d._sqlite3_exec=(a,b,c,e,f)=>(d._sqlite3_exec=U.id)(a,b,c,e,f);d._sqlite3_errmsg=a=>(d._sqlite3_errmsg=U.jd)(a);d._sqlite3_auto_extension=a=>(d._sqlite3_auto_extension=U.kd)(a);d._sqlite3_cancel_auto_extension=a=>(d._sqlite3_cancel_auto_extension=U.ld)(a);
|
||||
d._sqlite3_reset_auto_extension=()=>(d._sqlite3_reset_auto_extension=U.md)();d._sqlite3_prepare=(a,b,c,e,f)=>(d._sqlite3_prepare=U.nd)(a,b,c,e,f);d._sqlite3_prepare_v3=(a,b,c,e,f,h)=>(d._sqlite3_prepare_v3=U.od)(a,b,c,e,f,h);d._sqlite3_prepare16=(a,b,c,e,f)=>(d._sqlite3_prepare16=U.pd)(a,b,c,e,f);d._sqlite3_prepare16_v2=(a,b,c,e,f)=>(d._sqlite3_prepare16_v2=U.qd)(a,b,c,e,f);d._sqlite3_prepare16_v3=(a,b,c,e,f,h)=>(d._sqlite3_prepare16_v3=U.rd)(a,b,c,e,f,h);
|
||||
d._sqlite3_get_table=(a,b,c,e,f,h)=>(d._sqlite3_get_table=U.sd)(a,b,c,e,f,h);d._sqlite3_free_table=a=>(d._sqlite3_free_table=U.td)(a);d._sqlite3_create_module=(a,b,c,e)=>(d._sqlite3_create_module=U.ud)(a,b,c,e);d._sqlite3_create_module_v2=(a,b,c,e,f)=>(d._sqlite3_create_module_v2=U.vd)(a,b,c,e,f);d._sqlite3_drop_modules=(a,b)=>(d._sqlite3_drop_modules=U.wd)(a,b);d._sqlite3_declare_vtab=(a,b)=>(d._sqlite3_declare_vtab=U.xd)(a,b);d._sqlite3_vtab_on_conflict=a=>(d._sqlite3_vtab_on_conflict=U.yd)(a);
|
||||
d._sqlite3_vtab_config=(a,b,c)=>(d._sqlite3_vtab_config=U.zd)(a,b,c);d._sqlite3_vtab_collation=(a,b)=>(d._sqlite3_vtab_collation=U.Ad)(a,b);d._sqlite3_vtab_in=(a,b,c)=>(d._sqlite3_vtab_in=U.Bd)(a,b,c);d._sqlite3_vtab_rhs_value=(a,b,c)=>(d._sqlite3_vtab_rhs_value=U.Cd)(a,b,c);d._sqlite3_vtab_distinct=a=>(d._sqlite3_vtab_distinct=U.Dd)(a);d._sqlite3_keyword_name=(a,b,c)=>(d._sqlite3_keyword_name=U.Ed)(a,b,c);d._sqlite3_keyword_count=()=>(d._sqlite3_keyword_count=U.Fd)();
|
||||
d._sqlite3_keyword_check=(a,b)=>(d._sqlite3_keyword_check=U.Gd)(a,b);d._sqlite3_complete=a=>(d._sqlite3_complete=U.Hd)(a);d._sqlite3_complete16=a=>(d._sqlite3_complete16=U.Id)(a);d._sqlite3_libversion=()=>(d._sqlite3_libversion=U.Jd)();d._sqlite3_libversion_number=()=>(d._sqlite3_libversion_number=U.Kd)();d._sqlite3_threadsafe=()=>(d._sqlite3_threadsafe=U.Ld)();d._sqlite3_initialize=()=>(d._sqlite3_initialize=U.Md)();d._sqlite3_shutdown=()=>(d._sqlite3_shutdown=U.Nd)();
|
||||
d._sqlite3_config=(a,b)=>(d._sqlite3_config=U.Od)(a,b);d._sqlite3_db_mutex=a=>(d._sqlite3_db_mutex=U.Pd)(a);d._sqlite3_db_release_memory=a=>(d._sqlite3_db_release_memory=U.Qd)(a);d._sqlite3_db_cacheflush=a=>(d._sqlite3_db_cacheflush=U.Rd)(a);d._sqlite3_db_config=(a,b,c)=>(d._sqlite3_db_config=U.Sd)(a,b,c);d._sqlite3_last_insert_rowid=a=>(d._sqlite3_last_insert_rowid=U.Td)(a);d._sqlite3_set_last_insert_rowid=(a,b,c)=>(d._sqlite3_set_last_insert_rowid=U.Ud)(a,b,c);
|
||||
d._sqlite3_changes64=a=>(d._sqlite3_changes64=U.Vd)(a);d._sqlite3_changes=a=>(d._sqlite3_changes=U.Wd)(a);d._sqlite3_total_changes64=a=>(d._sqlite3_total_changes64=U.Xd)(a);d._sqlite3_total_changes=a=>(d._sqlite3_total_changes=U.Yd)(a);d._sqlite3_txn_state=(a,b)=>(d._sqlite3_txn_state=U.Zd)(a,b);d._sqlite3_close=a=>(d._sqlite3_close=U._d)(a);d._sqlite3_close_v2=a=>(d._sqlite3_close_v2=U.$d)(a);d._sqlite3_busy_handler=(a,b,c)=>(d._sqlite3_busy_handler=U.ae)(a,b,c);
|
||||
d._sqlite3_progress_handler=(a,b,c,e)=>(d._sqlite3_progress_handler=U.be)(a,b,c,e);d._sqlite3_busy_timeout=(a,b)=>(d._sqlite3_busy_timeout=U.ce)(a,b);d._sqlite3_interrupt=a=>(d._sqlite3_interrupt=U.de)(a);d._sqlite3_is_interrupted=a=>(d._sqlite3_is_interrupted=U.ee)(a);d._sqlite3_create_function=(a,b,c,e,f,h,k,n)=>(d._sqlite3_create_function=U.fe)(a,b,c,e,f,h,k,n);d._sqlite3_create_function_v2=(a,b,c,e,f,h,k,n,l)=>(d._sqlite3_create_function_v2=U.ge)(a,b,c,e,f,h,k,n,l);
|
||||
d._sqlite3_create_window_function=(a,b,c,e,f,h,k,n,l,m)=>(d._sqlite3_create_window_function=U.he)(a,b,c,e,f,h,k,n,l,m);d._sqlite3_create_function16=(a,b,c,e,f,h,k,n)=>(d._sqlite3_create_function16=U.ie)(a,b,c,e,f,h,k,n);d._sqlite3_overload_function=(a,b,c)=>(d._sqlite3_overload_function=U.je)(a,b,c);d._sqlite3_trace_v2=(a,b,c,e)=>(d._sqlite3_trace_v2=U.ke)(a,b,c,e);d._sqlite3_commit_hook=(a,b,c)=>(d._sqlite3_commit_hook=U.le)(a,b,c);
|
||||
d._sqlite3_update_hook=(a,b,c)=>(d._sqlite3_update_hook=U.me)(a,b,c);d._sqlite3_rollback_hook=(a,b,c)=>(d._sqlite3_rollback_hook=U.ne)(a,b,c);d._sqlite3_autovacuum_pages=(a,b,c,e)=>(d._sqlite3_autovacuum_pages=U.oe)(a,b,c,e);d._sqlite3_wal_autocheckpoint=(a,b)=>(d._sqlite3_wal_autocheckpoint=U.pe)(a,b);d._sqlite3_wal_hook=(a,b,c)=>(d._sqlite3_wal_hook=U.qe)(a,b,c);d._sqlite3_wal_checkpoint_v2=(a,b,c,e,f)=>(d._sqlite3_wal_checkpoint_v2=U.re)(a,b,c,e,f);
|
||||
d._sqlite3_wal_checkpoint=(a,b)=>(d._sqlite3_wal_checkpoint=U.se)(a,b);d._sqlite3_error_offset=a=>(d._sqlite3_error_offset=U.te)(a);d._sqlite3_errmsg16=a=>(d._sqlite3_errmsg16=U.ue)(a);d._sqlite3_errcode=a=>(d._sqlite3_errcode=U.ve)(a);d._sqlite3_extended_errcode=a=>(d._sqlite3_extended_errcode=U.we)(a);d._sqlite3_system_errno=a=>(d._sqlite3_system_errno=U.xe)(a);d._sqlite3_errstr=a=>(d._sqlite3_errstr=U.ye)(a);d._sqlite3_limit=(a,b,c)=>(d._sqlite3_limit=U.ze)(a,b,c);
|
||||
d._sqlite3_open=(a,b)=>(d._sqlite3_open=U.Ae)(a,b);d._sqlite3_open_v2=(a,b,c,e)=>(d._sqlite3_open_v2=U.Be)(a,b,c,e);d._sqlite3_open16=(a,b)=>(d._sqlite3_open16=U.Ce)(a,b);d._sqlite3_create_collation=(a,b,c,e,f)=>(d._sqlite3_create_collation=U.De)(a,b,c,e,f);d._sqlite3_create_collation_v2=(a,b,c,e,f,h)=>(d._sqlite3_create_collation_v2=U.Ee)(a,b,c,e,f,h);d._sqlite3_create_collation16=(a,b,c,e,f)=>(d._sqlite3_create_collation16=U.Fe)(a,b,c,e,f);
|
||||
d._sqlite3_collation_needed=(a,b,c)=>(d._sqlite3_collation_needed=U.Ge)(a,b,c);d._sqlite3_collation_needed16=(a,b,c)=>(d._sqlite3_collation_needed16=U.He)(a,b,c);d._sqlite3_get_clientdata=(a,b)=>(d._sqlite3_get_clientdata=U.Ie)(a,b);d._sqlite3_set_clientdata=(a,b,c,e)=>(d._sqlite3_set_clientdata=U.Je)(a,b,c,e);d._sqlite3_get_autocommit=a=>(d._sqlite3_get_autocommit=U.Ke)(a);d._sqlite3_table_column_metadata=(a,b,c,e,f,h,k,n,l)=>(d._sqlite3_table_column_metadata=U.Le)(a,b,c,e,f,h,k,n,l);
|
||||
d._sqlite3_sleep=a=>(d._sqlite3_sleep=U.Me)(a);d._sqlite3_extended_result_codes=(a,b)=>(d._sqlite3_extended_result_codes=U.Ne)(a,b);d._sqlite3_file_control=(a,b,c,e)=>(d._sqlite3_file_control=U.Oe)(a,b,c,e);d._sqlite3_test_control=(a,b)=>(d._sqlite3_test_control=U.Pe)(a,b);d._sqlite3_create_filename=(a,b,c,e,f)=>(d._sqlite3_create_filename=U.Qe)(a,b,c,e,f);d._sqlite3_free_filename=a=>(d._sqlite3_free_filename=U.Re)(a);d._sqlite3_uri_parameter=(a,b)=>(d._sqlite3_uri_parameter=U.Se)(a,b);
|
||||
d._sqlite3_uri_key=(a,b)=>(d._sqlite3_uri_key=U.Te)(a,b);d._sqlite3_uri_boolean=(a,b,c)=>(d._sqlite3_uri_boolean=U.Ue)(a,b,c);d._sqlite3_uri_int64=(a,b,c,e)=>(d._sqlite3_uri_int64=U.Ve)(a,b,c,e);d._sqlite3_filename_database=a=>(d._sqlite3_filename_database=U.We)(a);d._sqlite3_filename_journal=a=>(d._sqlite3_filename_journal=U.Xe)(a);d._sqlite3_filename_wal=a=>(d._sqlite3_filename_wal=U.Ye)(a);d._sqlite3_db_name=(a,b)=>(d._sqlite3_db_name=U.Ze)(a,b);
|
||||
d._sqlite3_db_filename=(a,b)=>(d._sqlite3_db_filename=U._e)(a,b);d._sqlite3_db_readonly=(a,b)=>(d._sqlite3_db_readonly=U.$e)(a,b);d._sqlite3_compileoption_used=a=>(d._sqlite3_compileoption_used=U.af)(a);d._sqlite3_compileoption_get=a=>(d._sqlite3_compileoption_get=U.bf)(a);d._sqlite3_sourceid=()=>(d._sqlite3_sourceid=U.cf)();d._sqlite3mc_config=(a,b,c)=>(d._sqlite3mc_config=U.df)(a,b,c);d._sqlite3mc_cipher_count=()=>(d._sqlite3mc_cipher_count=U.ef)();
|
||||
d._sqlite3mc_cipher_index=a=>(d._sqlite3mc_cipher_index=U.ff)(a);d._sqlite3mc_cipher_name=a=>(d._sqlite3mc_cipher_name=U.gf)(a);d._sqlite3mc_config_cipher=(a,b,c,e)=>(d._sqlite3mc_config_cipher=U.hf)(a,b,c,e);d._sqlite3mc_codec_data=(a,b,c)=>(d._sqlite3mc_codec_data=U.jf)(a,b,c);d._sqlite3_key=(a,b,c)=>(d._sqlite3_key=U.kf)(a,b,c);d._sqlite3_key_v2=(a,b,c,e)=>(d._sqlite3_key_v2=U.lf)(a,b,c,e);d._sqlite3_rekey_v2=(a,b,c,e)=>(d._sqlite3_rekey_v2=U.mf)(a,b,c,e);
|
||||
d._sqlite3_rekey=(a,b,c)=>(d._sqlite3_rekey=U.nf)(a,b,c);d._sqlite3mc_register_cipher=(a,b,c)=>(d._sqlite3mc_register_cipher=U.of)(a,b,c);var qd=()=>(qd=U.pf)(),Wb=d._malloc=a=>(Wb=d._malloc=U.qf)(a),fd=d._free=a=>(fd=d._free=U.rf)(a);d._RegisterExtensionFunctions=a=>(d._RegisterExtensionFunctions=U.sf)(a);d._set_authorizer=a=>(d._set_authorizer=U.tf)(a);d._create_function=(a,b,c,e,f,h)=>(d._create_function=U.uf)(a,b,c,e,f,h);d._create_module=(a,b,c,e)=>(d._create_module=U.vf)(a,b,c,e);
|
||||
d._progress_handler=(a,b)=>(d._progress_handler=U.wf)(a,b);d._register_vfs=(a,b,c,e)=>(d._register_vfs=U.xf)(a,b,c,e);d._getSqliteFree=()=>(d._getSqliteFree=U.yf)();var sd=d._main=(a,b)=>(sd=d._main=U.zf)(a,b),gb=(a,b)=>(gb=U.Bf)(a,b),td=()=>(td=U.Cf)(),od=()=>(od=U.Df)(),md=a=>(md=U.Ef)(a),nd=a=>(nd=U.Ff)(a),dd=a=>(dd=U.Gf)(a),Tc=()=>(Tc=U.Hf)(),cd=a=>(cd=U.If)(a),ed=()=>(ed=U.Jf)();d._sqlite3_version=11592;d.getTempRet0=td;d.ccall=Z;
|
||||
d.quit&&(ea=d.quit);var la;d.wasmBinary&&(la=d.wasmBinary);"object"!=typeof WebAssembly&&u("no native wasm support detected");var ma,v=!1,na,w,x,z,oa,A,C,pa,qa;function ra(){var a=ma.buffer;d.HEAP8=w=new Int8Array(a);d.HEAP16=z=new Int16Array(a);d.HEAPU8=x=new Uint8Array(a);d.HEAPU16=oa=new Uint16Array(a);d.HEAP32=A=new Int32Array(a);d.HEAPU32=C=new Uint32Array(a);d.HEAPF32=pa=new Float32Array(a);d.HEAPF64=qa=new Float64Array(a)}var sa=[],ta=[],ua=[],va=[];
|
||||
function wa(){var a=d.preRun.shift();sa.unshift(a)}var xa=0,ya=null,za=null;function u(a){if(d.onAbort)d.onAbort(a);a="Aborted("+a+")";r(a);v=!0;na=1;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");ba(a);throw a;}var Aa=a=>a.startsWith("data:application/octet-stream;base64,"),Ba;if(d.locateFile){if(Ba="wa-sqlite-async.wasm",!Aa(Ba)){var Ca=Ba;Ba=d.locateFile?d.locateFile(Ca,g):g+Ca}}else Ba=(new URL("wa-sqlite-async.wasm",import.meta.url)).href;
|
||||
function Da(a){if(a==Ba&&la)return new Uint8Array(la);if(ia)return ia(a);throw"both async and sync fetching of the wasm failed";}function Ea(a){return la||!fa&&!ha||"function"!=typeof fetch?Promise.resolve().then(()=>Da(a)):fetch(a,{credentials:"same-origin"}).then(b=>{if(!b.ok)throw"failed to load wasm binary file at '"+a+"'";return b.arrayBuffer()}).catch(()=>Da(a))}
|
||||
function Fa(a,b,c){return Ea(a).then(e=>WebAssembly.instantiate(e,b)).then(e=>e).then(c,e=>{r(`failed to asynchronously prepare wasm: ${e}`);u(e)})}function Ga(a,b){var c=Ba;return la||"function"!=typeof WebAssembly.instantiateStreaming||Aa(c)||"function"!=typeof fetch?Fa(c,a,b):fetch(c,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,a).then(b,function(f){r(`wasm streaming compile failed: ${f}`);r("falling back to ArrayBuffer instantiation");return Fa(c,a,b)}))}var D,F;
|
||||
function Ha(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}var Ia=a=>{for(;0<a.length;)a.shift()(d)};function H(a,b="i8"){b.endsWith("*")&&(b="*");switch(b){case "i1":return w[a>>0];case "i8":return w[a>>0];case "i16":return z[a>>1];case "i32":return A[a>>2];case "i64":u("to do getValue(i64) use WASM_BIGINT");case "float":return pa[a>>2];case "double":return qa[a>>3];case "*":return C[a>>2];default:u(`invalid type for getValue: ${b}`)}}
|
||||
var Ja=d.noExitRuntime||!0;function J(a,b,c="i8"){c.endsWith("*")&&(c="*");switch(c){case "i1":w[a>>0]=b;break;case "i8":w[a>>0]=b;break;case "i16":z[a>>1]=b;break;case "i32":A[a>>2]=b;break;case "i64":u("to do setValue(i64) use WASM_BIGINT");case "float":pa[a>>2]=b;break;case "double":qa[a>>3]=b;break;case "*":C[a>>2]=b;break;default:u(`invalid type for setValue: ${c}`)}}
|
||||
var Ka="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,K=(a,b,c)=>{var e=b+c;for(c=b;a[c]&&!(c>=e);)++c;if(16<c-b&&a.buffer&&Ka)return Ka.decode(a.subarray(b,c));for(e="";b<c;){var f=a[b++];if(f&128){var h=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|h);else{var k=a[b++]&63;f=224==(f&240)?(f&15)<<12|h<<6|k:(f&7)<<18|h<<12|k<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e},
|
||||
La=(a,b)=>{for(var c=0,e=a.length-1;0<=e;e--){var f=a[e];"."===f?a.splice(e,1):".."===f?(a.splice(e,1),c++):c&&(a.splice(e,1),c--)}if(b)for(;c;c--)a.unshift("..");return a},M=a=>{var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=La(a.split("/").filter(e=>!!e),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},Ma=a=>{var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b},Na=a=>{if("/"===
|
||||
a)return"/";a=M(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)},Oa=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return a=>crypto.getRandomValues(a);u("initRandomDevice")},Pa=a=>(Pa=Oa())(a);
|
||||
function Qa(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!=typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=La(a.split("/").filter(e=>!!e),!b).join("/");return(b?"/":"")+a||"."}
|
||||
var Ra=[],Sa=a=>{for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++c):b+=3}return b},Ta=(a,b,c,e)=>{if(!(0<e))return 0;var f=c;e=c+e-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var n=a.charCodeAt(++h);k=65536+((k&1023)<<10)|n&1023}if(127>=k){if(c>=e)break;b[c++]=k}else{if(2047>=k){if(c+1>=e)break;b[c++]=192|k>>6}else{if(65535>=k){if(c+2>=e)break;b[c++]=224|k>>12}else{if(c+3>=e)break;b[c++]=240|k>>18;b[c++]=128|k>>
|
||||
12&63}b[c++]=128|k>>6&63}b[c++]=128|k&63}}b[c]=0;return c-f};function Ua(a,b,c){c=Array(0<c?c:Sa(a)+1);a=Ta(a,c,0,c.length);b&&(c.length=a);return c}var Va=[];function Wa(a,b){Va[a]={input:[],Pf:[],$f:b};Xa(a,Ya)}
|
||||
var Ya={open(a){var b=Va[a.node.cg];if(!b)throw new N(43);a.Qf=b;a.seekable=!1},close(a){a.Qf.$f.fg(a.Qf)},fg(a){a.Qf.$f.fg(a.Qf)},read(a,b,c,e){if(!a.Qf||!a.Qf.$f.ug)throw new N(60);for(var f=0,h=0;h<e;h++){try{var k=a.Qf.$f.ug(a.Qf)}catch(n){throw new N(29);}if(void 0===k&&0===f)throw new N(6);if(null===k||void 0===k)break;f++;b[c+h]=k}f&&(a.node.timestamp=Date.now());return f},write(a,b,c,e){if(!a.Qf||!a.Qf.$f.og)throw new N(60);try{for(var f=0;f<e;f++)a.Qf.$f.og(a.Qf,b[c+f])}catch(h){throw new N(29);
|
||||
}e&&(a.node.timestamp=Date.now());return f}},Za={ug(){a:{if(!Ra.length){var a=null;"undefined"!=typeof window&&"function"==typeof window.prompt?(a=window.prompt("Input: "),null!==a&&(a+="\n")):"function"==typeof readline&&(a=readline(),null!==a&&(a+="\n"));if(!a){a=null;break a}Ra=Ua(a,!0)}a=Ra.shift()}return a},og(a,b){null===b||10===b?(ja(K(a.Pf,0)),a.Pf=[]):0!=b&&a.Pf.push(b)},fg(a){a.Pf&&0<a.Pf.length&&(ja(K(a.Pf,0)),a.Pf=[])},Vg(){return{Rg:25856,Tg:5,Qg:191,Sg:35387,Pg:[3,28,127,21,4,0,1,0,
|
||||
17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},Wg(){return 0},Xg(){return[24,80]}},$a={og(a,b){null===b||10===b?(r(K(a.Pf,0)),a.Pf=[]):0!=b&&a.Pf.push(b)},fg(a){a.Pf&&0<a.Pf.length&&(r(K(a.Pf,0)),a.Pf=[])}};function ab(a,b){var c=a.Lf?a.Lf.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Lf,a.Lf=new Uint8Array(b),0<a.Nf&&a.Lf.set(c.subarray(0,a.Nf),0))}
|
||||
var O={Tf:null,Sf(){return O.createNode(null,"/",16895,0)},createNode(a,b,c,e){if(24576===(c&61440)||4096===(c&61440))throw new N(63);O.Tf||(O.Tf={dir:{node:{Rf:O.Jf.Rf,Of:O.Jf.Of,ag:O.Jf.ag,gg:O.Jf.gg,yg:O.Jf.yg,lg:O.Jf.lg,jg:O.Jf.jg,xg:O.Jf.xg,kg:O.Jf.kg},stream:{Xf:O.Kf.Xf}},file:{node:{Rf:O.Jf.Rf,Of:O.Jf.Of},stream:{Xf:O.Kf.Xf,read:O.Kf.read,write:O.Kf.write,rg:O.Kf.rg,hg:O.Kf.hg,ig:O.Kf.ig}},link:{node:{Rf:O.Jf.Rf,Of:O.Jf.Of,dg:O.Jf.dg},stream:{}},sg:{node:{Rf:O.Jf.Rf,Of:O.Jf.Of},stream:bb}});
|
||||
c=cb(a,b,c,e);P(c.mode)?(c.Jf=O.Tf.dir.node,c.Kf=O.Tf.dir.stream,c.Lf={}):32768===(c.mode&61440)?(c.Jf=O.Tf.file.node,c.Kf=O.Tf.file.stream,c.Nf=0,c.Lf=null):40960===(c.mode&61440)?(c.Jf=O.Tf.link.node,c.Kf=O.Tf.link.stream):8192===(c.mode&61440)&&(c.Jf=O.Tf.sg.node,c.Kf=O.Tf.sg.stream);c.timestamp=Date.now();a&&(a.Lf[b]=c,a.timestamp=c.timestamp);return c},Ug(a){return a.Lf?a.Lf.subarray?a.Lf.subarray(0,a.Nf):new Uint8Array(a.Lf):new Uint8Array(0)},Jf:{Rf(a){var b={};b.Eg=8192===(a.mode&61440)?a.id:
|
||||
1;b.vg=a.id;b.mode=a.mode;b.Kg=1;b.uid=0;b.Hg=0;b.cg=a.cg;P(a.mode)?b.size=4096:32768===(a.mode&61440)?b.size=a.Nf:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.Ag=new Date(a.timestamp);b.Jg=new Date(a.timestamp);b.Dg=new Date(a.timestamp);b.Bg=4096;b.Cg=Math.ceil(b.size/b.Bg);return b},Of(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&(a.timestamp=b.timestamp);if(void 0!==b.size&&(b=b.size,a.Nf!=b))if(0==b)a.Lf=null,a.Nf=0;else{var c=a.Lf;a.Lf=new Uint8Array(b);c&&a.Lf.set(c.subarray(0,
|
||||
Math.min(b,a.Nf)));a.Nf=b}},ag(){throw db[44];},gg(a,b,c,e){return O.createNode(a,b,c,e)},yg(a,b,c){if(P(a.mode)){try{var e=eb(b,c)}catch(h){}if(e)for(var f in e.Lf)throw new N(55);}delete a.parent.Lf[a.name];a.parent.timestamp=Date.now();a.name=c;b.Lf[c]=a;b.timestamp=a.parent.timestamp;a.parent=b},lg(a,b){delete a.Lf[b];a.timestamp=Date.now()},jg(a,b){var c=eb(a,b),e;for(e in c.Lf)throw new N(55);delete a.Lf[b];a.timestamp=Date.now()},xg(a){var b=[".",".."],c;for(c in a.Lf)a.Lf.hasOwnProperty(c)&&
|
||||
b.push(c);return b},kg(a,b,c){a=O.createNode(a,b,41471,0);a.link=c;return a},dg(a){if(40960!==(a.mode&61440))throw new N(28);return a.link}},Kf:{read(a,b,c,e,f){var h=a.node.Lf;if(f>=a.node.Nf)return 0;a=Math.min(a.node.Nf-f,e);if(8<a&&h.subarray)b.set(h.subarray(f,f+a),c);else for(e=0;e<a;e++)b[c+e]=h[f+e];return a},write(a,b,c,e,f,h){b.buffer===w.buffer&&(h=!1);if(!e)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.Lf||a.Lf.subarray)){if(h)return a.Lf=b.subarray(c,c+e),a.Nf=e;if(0===
|
||||
a.Nf&&0===f)return a.Lf=b.slice(c,c+e),a.Nf=e;if(f+e<=a.Nf)return a.Lf.set(b.subarray(c,c+e),f),e}ab(a,f+e);if(a.Lf.subarray&&b.subarray)a.Lf.set(b.subarray(c,c+e),f);else for(h=0;h<e;h++)a.Lf[f+h]=b[c+h];a.Nf=Math.max(a.Nf,f+e);return e},Xf(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.Nf);if(0>b)throw new N(28);return b},rg(a,b,c){ab(a.node,b+c);a.node.Nf=Math.max(a.node.Nf,b+c)},hg(a,b,c,e,f){if(32768!==(a.node.mode&61440))throw new N(43);a=a.node.Lf;if(f&2||a.buffer!==
|
||||
w.buffer){if(0<c||c+b<a.length)a.subarray?a=a.subarray(c,c+b):a=Array.prototype.slice.call(a,c,c+b);c=!0;b=65536*Math.ceil(b/65536);(f=fb(65536,b))?(x.fill(0,f,f+b),b=f):b=0;if(!b)throw new N(48);w.set(a,b)}else c=!1,b=a.byteOffset;return{Lg:b,zg:c}},ig(a,b,c,e){O.Kf.write(a,b,0,e,c,!1);return 0}}},gb=(a,b)=>{var c=0;a&&(c|=365);b&&(c|=146);return c},hb=null,ib={},jb=[],kb=1,Q=null,lb=!0,N=null,db={};
|
||||
function R(a,b={}){a=Qa(a);if(!a)return{path:"",node:null};b=Object.assign({tg:!0,pg:0},b);if(8<b.pg)throw new N(32);a=a.split("/").filter(k=>!!k);for(var c=hb,e="/",f=0;f<a.length;f++){var h=f===a.length-1;if(h&&b.parent)break;c=eb(c,a[f]);e=M(e+"/"+a[f]);c.Yf&&(!h||h&&b.tg)&&(c=c.Yf.root);if(!h||b.Wf)for(h=0;40960===(c.mode&61440);)if(c=mb(e),e=Qa(Ma(e),c),c=R(e,{pg:b.pg+1}).node,40<h++)throw new N(32);}return{path:e,node:c}}
|
||||
function nb(a){for(var b;;){if(a===a.parent)return a=a.Sf.wg,b?"/"!==a[a.length-1]?`${a}/${b}`:a+b:a;b=b?`${a.name}/${b}`:a.name;a=a.parent}}function ob(a,b){for(var c=0,e=0;e<b.length;e++)c=(c<<5)-c+b.charCodeAt(e)|0;return(a+c>>>0)%Q.length}function pb(a){var b=ob(a.parent.id,a.name);if(Q[b]===a)Q[b]=a.Zf;else for(b=Q[b];b;){if(b.Zf===a){b.Zf=a.Zf;break}b=b.Zf}}
|
||||
function eb(a,b){var c;if(c=(c=qb(a,"x"))?c:a.Jf.ag?0:2)throw new N(c,a);for(c=Q[ob(a.id,b)];c;c=c.Zf){var e=c.name;if(c.parent.id===a.id&&e===b)return c}return a.Jf.ag(a,b)}function cb(a,b,c,e){a=new rb(a,b,c,e);b=ob(a.parent.id,a.name);a.Zf=Q[b];return Q[b]=a}function P(a){return 16384===(a&61440)}function sb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}
|
||||
function qb(a,b){if(lb)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function tb(a,b){try{return eb(a,b),20}catch(c){}return qb(a,"wx")}function ub(a,b,c){try{var e=eb(a,b)}catch(f){return f.Mf}if(a=qb(a,"wx"))return a;if(c){if(!P(e.mode))return 54;if(e===e.parent||"/"===nb(e))return 10}else if(P(e.mode))return 31;return 0}function vb(){for(var a=0;4096>=a;a++)if(!jb[a])return a;throw new N(33);}
|
||||
function S(a){a=jb[a];if(!a)throw new N(8);return a}function wb(a,b=-1){xb||(xb=function(){this.eg={}},xb.prototype={},Object.defineProperties(xb.prototype,{object:{get(){return this.node},set(c){this.node=c}},flags:{get(){return this.eg.flags},set(c){this.eg.flags=c}},position:{get(){return this.eg.position},set(c){this.eg.position=c}}}));a=Object.assign(new xb,a);-1==b&&(b=vb());a.Uf=b;return jb[b]=a}var bb={open(a){a.Kf=ib[a.node.cg].Kf;a.Kf.open&&a.Kf.open(a)},Xf(){throw new N(70);}};
|
||||
function Xa(a,b){ib[a]={Kf:b}}function yb(a,b){var c="/"===b,e=!b;if(c&&hb)throw new N(10);if(!c&&!e){var f=R(b,{tg:!1});b=f.path;f=f.node;if(f.Yf)throw new N(10);if(!P(f.mode))throw new N(54);}b={type:a,Zg:{},wg:b,Ig:[]};a=a.Sf(b);a.Sf=b;b.root=a;c?hb=a:f&&(f.Yf=b,f.Sf&&f.Sf.Ig.push(b))}function zb(a,b,c){var e=R(a,{parent:!0}).node;a=Na(a);if(!a||"."===a||".."===a)throw new N(28);var f=tb(e,a);if(f)throw new N(f);if(!e.Jf.gg)throw new N(63);return e.Jf.gg(e,a,b,c)}
|
||||
function T(a,b){return zb(a,(void 0!==b?b:511)&1023|16384,0)}function Ab(a,b,c){"undefined"==typeof c&&(c=b,b=438);zb(a,b|8192,c)}function Bb(a,b){if(!Qa(a))throw new N(44);var c=R(b,{parent:!0}).node;if(!c)throw new N(44);b=Na(b);var e=tb(c,b);if(e)throw new N(e);if(!c.Jf.kg)throw new N(63);c.Jf.kg(c,b,a)}function Cb(a){var b=R(a,{parent:!0}).node;a=Na(a);var c=eb(b,a),e=ub(b,a,!0);if(e)throw new N(e);if(!b.Jf.jg)throw new N(63);if(c.Yf)throw new N(10);b.Jf.jg(b,a);pb(c)}
|
||||
function mb(a){a=R(a).node;if(!a)throw new N(44);if(!a.Jf.dg)throw new N(28);return Qa(nb(a.parent),a.Jf.dg(a))}function Db(a,b){a=R(a,{Wf:!b}).node;if(!a)throw new N(44);if(!a.Jf.Rf)throw new N(63);return a.Jf.Rf(a)}function Eb(a){return Db(a,!0)}function Fb(a,b){a="string"==typeof a?R(a,{Wf:!0}).node:a;if(!a.Jf.Of)throw new N(63);a.Jf.Of(a,{mode:b&4095|a.mode&-4096,timestamp:Date.now()})}
|
||||
function Gb(a,b){if(0>b)throw new N(28);a="string"==typeof a?R(a,{Wf:!0}).node:a;if(!a.Jf.Of)throw new N(63);if(P(a.mode))throw new N(31);if(32768!==(a.mode&61440))throw new N(28);var c=qb(a,"w");if(c)throw new N(c);a.Jf.Of(a,{size:b,timestamp:Date.now()})}
|
||||
function Hb(a,b,c){if(""===a)throw new N(44);if("string"==typeof b){var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[b];if("undefined"==typeof e)throw Error(`Unknown file open mode: ${b}`);b=e}c=b&64?("undefined"==typeof c?438:c)&4095|32768:0;if("object"==typeof a)var f=a;else{a=M(a);try{f=R(a,{Wf:!(b&131072)}).node}catch(h){}}e=!1;if(b&64)if(f){if(b&128)throw new N(20);}else f=zb(a,c,0),e=!0;if(!f)throw new N(44);8192===(f.mode&61440)&&(b&=-513);if(b&65536&&!P(f.mode))throw new N(54);if(!e&&(c=
|
||||
f?40960===(f.mode&61440)?32:P(f.mode)&&("r"!==sb(b)||b&512)?31:qb(f,sb(b)):44))throw new N(c);b&512&&!e&&Gb(f,0);b&=-131713;f=wb({node:f,path:nb(f),flags:b,seekable:!0,position:0,Kf:f.Kf,Og:[],error:!1});f.Kf.open&&f.Kf.open(f);!d.logReadFiles||b&1||(Ib||(Ib={}),a in Ib||(Ib[a]=1));return f}function Jb(a,b,c){if(null===a.Uf)throw new N(8);if(!a.seekable||!a.Kf.Xf)throw new N(70);if(0!=c&&1!=c&&2!=c)throw new N(28);a.position=a.Kf.Xf(a,b,c);a.Og=[]}
|
||||
function Kb(){N||(N=function(a,b){this.name="ErrnoError";this.node=b;this.Mg=function(c){this.Mf=c};this.Mg(a);this.message="FS error"},N.prototype=Error(),N.prototype.constructor=N,[44].forEach(a=>{db[a]=new N(a);db[a].stack="<generic error, no stack>"}))}var Lb;
|
||||
function Mb(a,b,c){a=M("/dev/"+a);var e=gb(!!b,!!c);Nb||(Nb=64);var f=Nb++<<8|0;Xa(f,{open(h){h.seekable=!1},close(){c&&c.buffer&&c.buffer.length&&c(10)},read(h,k,n,l){for(var m=0,q=0;q<l;q++){try{var p=b()}catch(t){throw new N(29);}if(void 0===p&&0===m)throw new N(6);if(null===p||void 0===p)break;m++;k[n+q]=p}m&&(h.node.timestamp=Date.now());return m},write(h,k,n,l){for(var m=0;m<l;m++)try{c(k[n+m])}catch(q){throw new N(29);}l&&(h.node.timestamp=Date.now());return m}});Ab(a,e,f)}var Nb,U={},xb,Ib;
|
||||
function Ob(a,b,c){if("/"===b.charAt(0))return b;a=-100===a?"/":S(a).path;if(0==b.length){if(!c)throw new N(44);return a}return M(a+"/"+b)}
|
||||
function Pb(a,b,c){try{var e=a(b)}catch(h){if(h&&h.node&&M(b)!==M(nb(h.node)))return-54;throw h;}A[c>>2]=e.Eg;A[c+4>>2]=e.mode;C[c+8>>2]=e.Kg;A[c+12>>2]=e.uid;A[c+16>>2]=e.Hg;A[c+20>>2]=e.cg;F=[e.size>>>0,(D=e.size,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];A[c+24>>2]=F[0];A[c+28>>2]=F[1];A[c+32>>2]=4096;A[c+36>>2]=e.Cg;a=e.Ag.getTime();b=e.Jg.getTime();var f=e.Dg.getTime();F=[Math.floor(a/1E3)>>>0,(D=Math.floor(a/1E3),1<=+Math.abs(D)?0<D?+Math.floor(D/
|
||||
4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];A[c+40>>2]=F[0];A[c+44>>2]=F[1];C[c+48>>2]=a%1E3*1E3;F=[Math.floor(b/1E3)>>>0,(D=Math.floor(b/1E3),1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];A[c+56>>2]=F[0];A[c+60>>2]=F[1];C[c+64>>2]=b%1E3*1E3;F=[Math.floor(f/1E3)>>>0,(D=Math.floor(f/1E3),1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];A[c+72>>2]=F[0];A[c+76>>2]=F[1];C[c+80>>2]=
|
||||
f%1E3*1E3;F=[e.vg>>>0,(D=e.vg,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];A[c+88>>2]=F[0];A[c+92>>2]=F[1];return 0}var Qb=void 0;function Rb(){var a=A[+Qb>>2];Qb+=4;return a}
|
||||
var Sb=(a,b)=>b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN,Tb=[0,31,60,91,121,152,182,213,244,274,305,335],Ub=[0,31,59,90,120,151,181,212,243,273,304,334],Wb=a=>{var b=Sa(a)+1,c=Vb(b);c&&Ta(a,x,c,b);return c},Xb={},Zb=()=>{if(!Yb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:da||"./this.program"},b;for(b in Xb)void 0===Xb[b]?delete a[b]:a[b]=Xb[b];
|
||||
var c=[];for(b in a)c.push(`${b}=${a[b]}`);Yb=c}return Yb},Yb;function $b(){}function ac(){}function bc(){}function cc(){}function dc(){}function ec(){}function fc(){}function gc(){}function hc(){}function ic(){}function jc(){}function kc(){}function lc(){}function mc(){}function nc(){}function oc(){}function pc(){}function qc(){}function rc(){}function sc(){}function tc(){}function uc(){}function vc(){}function wc(){}function xc(){}function yc(){}function zc(){}function Ac(){}function Bc(){}
|
||||
function Cc(){}function Dc(){}function Ec(){}function Fc(){}function Gc(){}function Hc(){}function Ic(){}function Jc(){}function Kc(){}function Lc(){}var Mc=0,Nc=a=>{na=a;if(!(Ja||0<Mc)){if(d.onExit)d.onExit(a);v=!0}ea(a,new Ha(a))},Oc=a=>{a instanceof Ha||"unwind"==a||ea(1,a)},Pc=a=>{try{a()}catch(b){u(b)}};
|
||||
function Qc(){var a=V,b={},c;for(c in a)(function(e){var f=a[e];b[e]="function"==typeof f?function(){Rc.push(e);try{return f.apply(null,arguments)}finally{v||(Rc.pop()===e||u(),W&&1===Y&&0===Rc.length&&(Y=0,Pc(Sc),"undefined"!=typeof Fibers&&Fibers.$g()))}}:f})(c);return b}var Y=0,W=null,Tc=0,Rc=[],Uc={},Vc={},Wc=0,Xc=null,Yc=[];function Zc(){return new Promise((a,b)=>{Xc={resolve:a,reject:b}})}
|
||||
function $c(){var a=Vb(16396),b=a+12;C[a>>2]=b;C[a+4>>2]=b+16384;b=Rc[0];var c=Uc[b];void 0===c&&(c=Wc++,Uc[b]=c,Vc[c]=b);A[a+8>>2]=c;return a}
|
||||
function ad(a){if(!v){if(0===Y){var b=!1,c=!1;a((e=0)=>{if(!v&&(Tc=e,b=!0,c)){Y=2;Pc(()=>bd(W));"undefined"!=typeof Browser&&Browser.ng.Gg&&Browser.ng.resume();e=!1;try{var f=(0,V[Vc[A[W+8>>2]]])()}catch(n){f=n,e=!0}var h=!1;if(!W){var k=Xc;k&&(Xc=null,(e?k.reject:k.resolve)(f),h=!0)}if(e&&!h)throw f;}});c=!0;b||(Y=1,W=$c(),"undefined"!=typeof Browser&&Browser.ng.Gg&&Browser.ng.pause(),Pc(()=>cd(W)))}else 2===Y?(Y=0,Pc(dd),ed(W),W=null,Yc.forEach(e=>{if(!v)try{if(e(),!(Ja||0<Mc))try{na=e=na,Nc(e)}catch(f){Oc(f)}}catch(f){Oc(f)}})):
|
||||
u(`invalid state: ${Y}`);return Tc}}function fd(a){return ad(b=>{a().then(b)})}
|
||||
var gd={},hd,jd,kd=[],Z=(a,b,c,e,f)=>{function h(p){--Mc;0!==l&&ld(l);return"string"===b?p?K(x,p):"":"boolean"===b?!!p:p}var k={string:p=>{var t=0;if(null!==p&&void 0!==p&&0!==p){t=Sa(p)+1;var y=md(t);Ta(p,x,y,t);t=y}return t},array:p=>{var t=md(p.length);w.set(p,t);return t}};a=d["_"+a];var n=[],l=0;if(e)for(var m=0;m<e.length;m++){var q=k[c[m]];q?(0===l&&(l=nd()),n[m]=q(e[m])):n[m]=e[m]}c=W;e=a.apply(null,n);f=f&&f.async;Mc+=1;if(W!=c)return Zc().then(h);e=h(e);return f?Promise.resolve(e):e},od=
|
||||
"undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function rb(a,b,c,e){a||(a=this);this.parent=a;this.Sf=a.Sf;this.Yf=null;this.id=kb++;this.name=b;this.mode=c;this.Jf={};this.Kf={};this.cg=e}Object.defineProperties(rb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});Kb();Q=Array(4096);yb(O,"/");T("/tmp");T("/home");
|
||||
T("/home/web_user");(function(){T("/dev");Xa(259,{read:()=>0,write:(e,f,h,k)=>k});Ab("/dev/null",259);Wa(1280,Za);Wa(1536,$a);Ab("/dev/tty",1280);Ab("/dev/tty1",1536);var a=new Uint8Array(1024),b=0,c=()=>{0===b&&(b=Pa(a).byteLength);return a[--b]};Mb("random",c);Mb("urandom",c);T("/dev/shm");T("/dev/shm/tmp")})();
|
||||
(function(){T("/proc");var a=T("/proc/self");T("/proc/self/fd");yb({Sf(){var b=cb(a,"fd",16895,73);b.Jf={ag(c,e){var f=S(+e);c={parent:null,Sf:{wg:"fake"},Jf:{dg:()=>f.path}};return c.parent=c}};return b}},"/proc/self/fd")})();
|
||||
(function(){const a=new Map;d.setAuthorizer=function(b,c,e){c?a.set(b,{f:c,qg:e}):a.delete(b);return Z("set_authorizer","number",["number"],[b])};$b=function(b,c,e,f,h,k){if(a.has(b)){const {f:n,qg:l}=a.get(b);return n(l,c,e?e?K(x,e):"":null,f?f?K(x,f):"":null,h?h?K(x,h):"":null,k?k?K(x,k):"":null)}return 0}})();
|
||||
(function(){const a=new Map,b=new Map;d.createFunction=function(c,e,f,h,k,n){const l=a.size;a.set(l,{f:n,Vf:k});return Z("create_function","number","number string number number number number".split(" "),[c,e,f,h,l,0])};d.createAggregate=function(c,e,f,h,k,n,l){const m=a.size;a.set(m,{step:n,Fg:l,Vf:k});return Z("create_function","number","number string number number number number".split(" "),[c,e,f,h,m,1])};d.getFunctionUserData=function(c){return b.get(c)};bc=function(c,e,f,h){c=a.get(c);b.set(e,
|
||||
c.Vf);c.f(e,new Uint32Array(x.buffer,h,f));b.delete(e)};dc=function(c,e,f,h){c=a.get(c);b.set(e,c.Vf);c.step(e,new Uint32Array(x.buffer,h,f));b.delete(e)};ac=function(c,e){c=a.get(c);b.set(e,c.Vf);c.Fg(e);b.delete(e)}})();(function(){const a=new Map;d.progressHandler=function(b,c,e,f){e?a.set(b,{f:e,qg:f}):a.delete(b);return Z("progress_handler",null,["number","number"],[b,c])};cc=function(b){if(a.has(b)){const {f:c,qg:e}=a.get(b);return c(e)}return 0}})();
|
||||
(function(){function a(l,m){const q=`get${l}`,p=`set${l}`;return new Proxy(new DataView(x.buffer,m,"Int32"===l?4:8),{get(t,y){if(y===q)return function(B,G){if(!G)throw Error("must be little endian");return t[y](B,G)};if(y===p)return function(B,G,E){if(!E)throw Error("must be little endian");return t[y](B,G,E)};if("string"===typeof y&&y.match(/^(get)|(set)/))throw Error("invalid type");return t[y]}})}const b="object"===typeof gd,c=new Map,e=new Map,f=new Map,h=b?new Set:null,k=b?new Set:null,n=new Map;
|
||||
uc=function(l,m,q,p){n.set(l?K(x,l):"",{size:m,bg:Array.from(new Uint32Array(x.buffer,p,q))})};d.createModule=function(l,m,q,p){b&&(q.handleAsync=fd);const t=c.size;c.set(t,{module:q,Vf:p});p=0;q.xCreate&&(p|=1);q.xConnect&&(p|=2);q.xBestIndex&&(p|=4);q.xDisconnect&&(p|=8);q.xDestroy&&(p|=16);q.xOpen&&(p|=32);q.xClose&&(p|=64);q.xFilter&&(p|=128);q.xNext&&(p|=256);q.xEof&&(p|=512);q.xColumn&&(p|=1024);q.xRowid&&(p|=2048);q.xUpdate&&(p|=4096);q.xBegin&&(p|=8192);q.xSync&&(p|=16384);q.xCommit&&(p|=
|
||||
32768);q.xRollback&&(p|=65536);q.xFindFunction&&(p|=131072);q.xRename&&(p|=262144);return Z("create_module","number",["number","string","number","number"],[l,m,t,p])};kc=function(l,m,q,p,t,y){m=c.get(m);e.set(t,m);if(b){h.delete(t);for(const B of h)e.delete(B)}p=Array.from(new Uint32Array(x.buffer,p,q)).map(B=>B?K(x,B):"");return m.module.xCreate(l,m.Vf,p,t,a("Int32",y))};jc=function(l,m,q,p,t,y){m=c.get(m);e.set(t,m);if(b){h.delete(t);for(const B of h)e.delete(B)}p=Array.from(new Uint32Array(x.buffer,
|
||||
p,q)).map(B=>B?K(x,B):"");return m.module.xConnect(l,m.Vf,p,t,a("Int32",y))};fc=function(l,m){var q=e.get(l),p=n.get("sqlite3_index_info").bg;const t={};t.nConstraint=H(m+p[0],"i32");t.aConstraint=[];var y=H(m+p[1],"*"),B=n.get("sqlite3_index_constraint").size;for(var G=0;G<t.nConstraint;++G){var E=t.aConstraint,L=E.push,I=y+G*B,ka=n.get("sqlite3_index_constraint").bg,X={};X.iColumn=H(I+ka[0],"i32");X.op=H(I+ka[1],"i8");X.usable=!!H(I+ka[2],"i8");L.call(E,X)}t.nOrderBy=H(m+p[2],"i32");t.aOrderBy=
|
||||
[];y=H(m+p[3],"*");B=n.get("sqlite3_index_orderby").size;for(G=0;G<t.nOrderBy;++G)E=t.aOrderBy,L=E.push,I=y+G*B,ka=n.get("sqlite3_index_orderby").bg,X={},X.iColumn=H(I+ka[0],"i32"),X.desc=!!H(I+ka[1],"i8"),L.call(E,X);t.aConstraintUsage=[];for(y=0;y<t.nConstraint;++y)t.aConstraintUsage.push({argvIndex:0,omit:!1});t.idxNum=H(m+p[5],"i32");t.idxStr=null;t.orderByConsumed=!!H(m+p[8],"i8");t.estimatedCost=H(m+p[9],"double");t.estimatedRows=H(m+p[10],"i32");t.idxFlags=H(m+p[11],"i32");t.colUsed=H(m+p[12],
|
||||
"i32");l=q.module.xBestIndex(l,t);q=n.get("sqlite3_index_info").bg;p=H(m+q[4],"*");y=n.get("sqlite3_index_constraint_usage").size;for(L=0;L<t.nConstraint;++L)B=p+L*y,E=t.aConstraintUsage[L],I=n.get("sqlite3_index_constraint_usage").bg,J(B+I[0],E.argvIndex,"i32"),J(B+I[1],E.omit?1:0,"i8");J(m+q[5],t.idxNum,"i32");"string"===typeof t.idxStr&&(p=Sa(t.idxStr),y=Z("sqlite3_malloc","number",["number"],[p+1]),Ta(t.idxStr,x,y,p+1),J(m+q[6],y,"*"),J(m+q[7],1,"i32"));J(m+q[8],t.orderByConsumed,"i32");J(m+q[9],
|
||||
t.estimatedCost,"double");J(m+q[10],t.estimatedRows,"i32");J(m+q[11],t.idxFlags,"i32");return l};mc=function(l){const m=e.get(l);b?h.add(l):e.delete(l);return m.module.xDisconnect(l)};lc=function(l){const m=e.get(l);b?h.add(l):e.delete(l);return m.module.xDestroy(l)};qc=function(l,m){const q=e.get(l);f.set(m,q);if(b){k.delete(m);for(const p of k)f.delete(p)}return q.module.xOpen(l,m)};gc=function(l){const m=f.get(l);b?k.add(l):f.delete(l);return m.module.xClose(l)};nc=function(l){return f.get(l).module.xEof(l)?
|
||||
1:0};oc=function(l,m,q,p,t){const y=f.get(l);q=q?q?K(x,q):"":null;t=new Uint32Array(x.buffer,t,p);return y.module.xFilter(l,m,q,t)};pc=function(l){return f.get(l).module.xNext(l)};hc=function(l,m,q){return f.get(l).module.xColumn(l,m,q)};tc=function(l,m){return f.get(l).module.xRowid(l,a("BigInt64",m))};wc=function(l,m,q,p){const t=e.get(l);q=new Uint32Array(x.buffer,q,m);return t.module.xUpdate(l,q,a("BigInt64",p))};ec=function(l){return e.get(l).module.xBegin(l)};vc=function(l){return e.get(l).module.xSync(l)};
|
||||
ic=function(l){return e.get(l).module.xCommit(l)};sc=function(l){return e.get(l).module.xRollback(l)};rc=function(l,m){const q=e.get(l);m=m?K(x,m):"";return q.module.xRename(l,m)}})();
|
||||
(function(){function a(h,k){const n=`get${h}`,l=`set${h}`;return new Proxy(new DataView(x.buffer,k,"Int32"===h?4:8),{get(m,q){if(q===n)return function(p,t){if(!t)throw Error("must be little endian");return m[q](p,t)};if(q===l)return function(p,t,y){if(!y)throw Error("must be little endian");return m[q](p,t,y)};if("string"===typeof q&&q.match(/^(get)|(set)/))throw Error("invalid type");return m[q]}})}const b="object"===typeof gd;b&&(d.handleAsync=fd);const c=new Map,e=new Map;d.registerVFS=function(h,
|
||||
k){if(Z("sqlite3_vfs_find","number",["string"],[h.name]))throw Error(`VFS '${h.name}' already registered`);b&&(h.handleAsync=fd);var n=h.Yg??64;const l=d._malloc(4);k=Z("register_vfs","number",["string","number","number","number"],[h.name,n,k?1:0,l]);k||(n=H(l,"*"),c.set(n,h));d._free(l);return k};const f=b?new Set:null;zc=function(h){const k=e.get(h);b?f.add(h):e.delete(h);return k.xClose(h)};Gc=function(h,k,n,l,m){return e.get(h).xRead(h,x.subarray(k,k+n),4294967296*m+l+(0>l?2**32:0))};Lc=function(h,
|
||||
k,n,l,m){return e.get(h).xWrite(h,x.subarray(k,k+n),4294967296*m+l+(0>l?2**32:0))};Jc=function(h,k,n){return e.get(h).xTruncate(h,4294967296*n+k+(0>k?2**32:0))};Ic=function(h,k){return e.get(h).xSync(h,k)};Dc=function(h,k){const n=e.get(h);k=a("BigInt64",k);return n.xFileSize(h,k)};Ec=function(h,k){return e.get(h).xLock(h,k)};Kc=function(h,k){return e.get(h).xUnlock(h,k)};yc=function(h,k){const n=e.get(h);k=a("Int32",k);return n.xCheckReservedLock(h,k)};Cc=function(h,k,n){const l=e.get(h);n=new DataView(x.buffer,
|
||||
n);return l.xFileControl(h,k,n)};Hc=function(h){return e.get(h).xSectorSize(h)};Bc=function(h){return e.get(h).xDeviceCharacteristics(h)};Fc=function(h,k,n,l,m){h=c.get(h);e.set(n,h);if(b){f.delete(n);for(var q of f)e.delete(q)}q=null;if(l&64){q=1;const p=[];for(;q;){const t=x[k++];if(t)p.push(t);else switch(x[k]||(q=null),q){case 1:p.push(63);q=2;break;case 2:p.push(61);q=3;break;case 3:p.push(38),q=2}}q=(new TextDecoder).decode(new Uint8Array(p))}else k&&(q=k?K(x,k):"");m=a("Int32",m);return h.xOpen(q,
|
||||
n,l,m)};Ac=function(h,k,n){return c.get(h).xDelete(k?K(x,k):"",n)};xc=function(h,k,n,l){h=c.get(h);l=a("Int32",l);return h.xAccess(k?K(x,k):"",n,l)}})();
|
||||
var qd={a:(a,b,c,e)=>{u(`Assertion failed: ${a?K(x,a):""}, at: `+[b?b?K(x,b):"":"unknown filename",c,e?e?K(x,e):"":"unknown function"])},N:function(a,b){try{return a=a?K(x,a):"",Fb(a,b),0}catch(c){if("undefined"==typeof U||"ErrnoError"!==c.name)throw c;return-c.Mf}},Q:function(a,b,c){try{b=b?K(x,b):"";b=Ob(a,b);if(c&-8)return-28;var e=R(b,{Wf:!0}).node;if(!e)return-44;a="";c&4&&(a+="r");c&2&&(a+="w");c&1&&(a+="x");return a&&qb(e,a)?-2:0}catch(f){if("undefined"==typeof U||"ErrnoError"!==f.name)throw f;
|
||||
return-f.Mf}},O:function(a,b){try{var c=S(a);Fb(c.node,b);return 0}catch(e){if("undefined"==typeof U||"ErrnoError"!==e.name)throw e;return-e.Mf}},M:function(a){try{var b=S(a).node;var c="string"==typeof b?R(b,{Wf:!0}).node:b;if(!c.Jf.Of)throw new N(63);c.Jf.Of(c,{timestamp:Date.now()});return 0}catch(e){if("undefined"==typeof U||"ErrnoError"!==e.name)throw e;return-e.Mf}},b:function(a,b,c){Qb=c;try{var e=S(a);switch(b){case 0:var f=Rb();if(0>f)return-28;for(;jb[f];)f++;return wb(e,f).Uf;case 1:case 2:return 0;
|
||||
case 3:return e.flags;case 4:return f=Rb(),e.flags|=f,0;case 5:return f=Rb(),z[f+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return A[pd()>>2]=28,-1;default:return-28}}catch(h){if("undefined"==typeof U||"ErrnoError"!==h.name)throw h;return-h.Mf}},L:function(a,b){try{var c=S(a);return Pb(Db,c.path,b)}catch(e){if("undefined"==typeof U||"ErrnoError"!==e.name)throw e;return-e.Mf}},n:function(a,b,c){b=Sb(b,c);try{if(isNaN(b))return 61;var e=S(a);if(0===(e.flags&2097155))throw new N(28);
|
||||
Gb(e.node,b);return 0}catch(f){if("undefined"==typeof U||"ErrnoError"!==f.name)throw f;return-f.Mf}},F:function(a,b){try{if(0===b)return-28;var c=Sa("/")+1;if(b<c)return-68;Ta("/",x,a,b);return c}catch(e){if("undefined"==typeof U||"ErrnoError"!==e.name)throw e;return-e.Mf}},J:function(a,b){try{return a=a?K(x,a):"",Pb(Eb,a,b)}catch(c){if("undefined"==typeof U||"ErrnoError"!==c.name)throw c;return-c.Mf}},C:function(a,b,c){try{return b=b?K(x,b):"",b=Ob(a,b),b=M(b),"/"===b[b.length-1]&&(b=b.substr(0,
|
||||
b.length-1)),T(b,c),0}catch(e){if("undefined"==typeof U||"ErrnoError"!==e.name)throw e;return-e.Mf}},H:function(a,b,c,e){try{b=b?K(x,b):"";var f=e&256;b=Ob(a,b,e&4096);return Pb(f?Eb:Db,b,c)}catch(h){if("undefined"==typeof U||"ErrnoError"!==h.name)throw h;return-h.Mf}},B:function(a,b,c,e){Qb=e;try{b=b?K(x,b):"";b=Ob(a,b);var f=e?Rb():0;return Hb(b,c,f).Uf}catch(h){if("undefined"==typeof U||"ErrnoError"!==h.name)throw h;return-h.Mf}},z:function(a,b,c,e){try{b=b?K(x,b):"";b=Ob(a,b);if(0>=e)return-28;
|
||||
var f=mb(b),h=Math.min(e,Sa(f)),k=w[c+h];Ta(f,x,c,e+1);w[c+h]=k;return h}catch(n){if("undefined"==typeof U||"ErrnoError"!==n.name)throw n;return-n.Mf}},y:function(a){try{return a=a?K(x,a):"",Cb(a),0}catch(b){if("undefined"==typeof U||"ErrnoError"!==b.name)throw b;return-b.Mf}},K:function(a,b){try{return a=a?K(x,a):"",Pb(Db,a,b)}catch(c){if("undefined"==typeof U||"ErrnoError"!==c.name)throw c;return-c.Mf}},u:function(a,b,c){try{b=b?K(x,b):"";b=Ob(a,b);if(0===c){a=b;var e=R(a,{parent:!0}).node;if(!e)throw new N(44);
|
||||
var f=Na(a),h=eb(e,f),k=ub(e,f,!1);if(k)throw new N(k);if(!e.Jf.lg)throw new N(63);if(h.Yf)throw new N(10);e.Jf.lg(e,f);pb(h)}else 512===c?Cb(b):u("Invalid flags passed to unlinkat");return 0}catch(n){if("undefined"==typeof U||"ErrnoError"!==n.name)throw n;return-n.Mf}},t:function(a,b,c){try{b=b?K(x,b):"";b=Ob(a,b,!0);if(c){var e=C[c>>2]+4294967296*A[c+4>>2],f=A[c+8>>2];h=1E3*e+f/1E6;c+=16;e=C[c>>2]+4294967296*A[c+4>>2];f=A[c+8>>2];k=1E3*e+f/1E6}else var h=Date.now(),k=h;a=h;var n=R(b,{Wf:!0}).node;
|
||||
n.Jf.Of(n,{timestamp:Math.max(a,k)});return 0}catch(l){if("undefined"==typeof U||"ErrnoError"!==l.name)throw l;return-l.Mf}},k:function(a,b,c){a=new Date(1E3*Sb(a,b));A[c>>2]=a.getSeconds();A[c+4>>2]=a.getMinutes();A[c+8>>2]=a.getHours();A[c+12>>2]=a.getDate();A[c+16>>2]=a.getMonth();A[c+20>>2]=a.getFullYear()-1900;A[c+24>>2]=a.getDay();b=a.getFullYear();A[c+28>>2]=(0!==b%4||0===b%100&&0!==b%400?Ub:Tb)[a.getMonth()]+a.getDate()-1|0;A[c+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),
|
||||
6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();A[c+32>>2]=(b!=e&&a.getTimezoneOffset()==Math.min(e,b))|0},i:function(a,b,c,e,f,h,k,n){f=Sb(f,h);try{if(isNaN(f))return 61;var l=S(e);if(0!==(b&2)&&0===(c&2)&&2!==(l.flags&2097155))throw new N(2);if(1===(l.flags&2097155))throw new N(2);if(!l.Kf.hg)throw new N(43);var m=l.Kf.hg(l,a,f,b,c);var q=m.Lg;A[k>>2]=m.zg;C[n>>2]=q;return 0}catch(p){if("undefined"==typeof U||"ErrnoError"!==p.name)throw p;return-p.Mf}},j:function(a,
|
||||
b,c,e,f,h,k){h=Sb(h,k);try{if(isNaN(h))return 61;var n=S(f);if(c&2){if(32768!==(n.node.mode&61440))throw new N(43);e&2||n.Kf.ig&&n.Kf.ig(n,x.slice(a,a+b),h,b,e)}}catch(l){if("undefined"==typeof U||"ErrnoError"!==l.name)throw l;return-l.Mf}},v:(a,b,c)=>{function e(l){return(l=l.toTimeString().match(/\(([A-Za-z ]+)\)$/))?l[1]:"GMT"}var f=(new Date).getFullYear(),h=new Date(f,0,1),k=new Date(f,6,1);f=h.getTimezoneOffset();var n=k.getTimezoneOffset();C[a>>2]=60*Math.max(f,n);A[b>>2]=Number(f!=n);a=e(h);
|
||||
b=e(k);a=Wb(a);b=Wb(b);n<f?(C[c>>2]=a,C[c+4>>2]=b):(C[c>>2]=b,C[c+4>>2]=a)},ta:()=>{u("")},e:()=>Date.now(),d:()=>performance.now(),r:a=>{var b=x.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);var f=Math;e=Math.max(a,e);a:{f=(f.min.call(f,2147483648,e+(65536-e%65536)%65536)-ma.buffer.byteLength+65535)/65536;try{ma.grow(f);ra();var h=1;break a}catch(k){}h=void 0}if(h)return!0}return!1},D:(a,b)=>{var c=0;Zb().forEach((e,f)=>{var h=b+c;f=C[a+
|
||||
4*f>>2]=h;for(h=0;h<e.length;++h)w[f++>>0]=e.charCodeAt(h);w[f>>0]=0;c+=e.length+1});return 0},E:(a,b)=>{var c=Zb();C[a>>2]=c.length;var e=0;c.forEach(f=>e+=f.length+1);C[b>>2]=e;return 0},f:function(a){try{var b=S(a);if(null===b.Uf)throw new N(8);b.mg&&(b.mg=null);try{b.Kf.close&&b.Kf.close(b)}catch(c){throw c;}finally{jb[b.Uf]=null}b.Uf=null;return 0}catch(c){if("undefined"==typeof U||"ErrnoError"!==c.name)throw c;return c.Mf}},s:function(a,b){try{var c=S(a);w[b>>0]=c.Qf?2:P(c.mode)?3:40960===(c.mode&
|
||||
61440)?7:4;z[b+2>>1]=0;F=[0,(D=0,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];A[b+8>>2]=F[0];A[b+12>>2]=F[1];F=[0,(D=0,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];A[b+16>>2]=F[0];A[b+20>>2]=F[1];return 0}catch(e){if("undefined"==typeof U||"ErrnoError"!==e.name)throw e;return e.Mf}},A:function(a,b,c,e){try{a:{var f=S(a);a=b;for(var h,k=b=0;k<c;k++){var n=C[a>>2],l=C[a+4>>2];a+=8;var m=f,q=n,p=
|
||||
l,t=h,y=w;if(0>p||0>t)throw new N(28);if(null===m.Uf)throw new N(8);if(1===(m.flags&2097155))throw new N(8);if(P(m.node.mode))throw new N(31);if(!m.Kf.read)throw new N(28);var B="undefined"!=typeof t;if(!B)t=m.position;else if(!m.seekable)throw new N(70);var G=m.Kf.read(m,y,q,p,t);B||(m.position+=G);var E=G;if(0>E){var L=-1;break a}b+=E;if(E<l)break;"undefined"!==typeof h&&(h+=E)}L=b}C[e>>2]=L;return 0}catch(I){if("undefined"==typeof U||"ErrnoError"!==I.name)throw I;return I.Mf}},l:function(a,b,c,
|
||||
e,f){b=Sb(b,c);try{if(isNaN(b))return 61;var h=S(a);Jb(h,b,e);F=[h.position>>>0,(D=h.position,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];A[f>>2]=F[0];A[f+4>>2]=F[1];h.mg&&0===b&&0===e&&(h.mg=null);return 0}catch(k){if("undefined"==typeof U||"ErrnoError"!==k.name)throw k;return k.Mf}},G:function(a){try{var b=S(a);return ad(c=>{var e=b.node.Sf;e.type.Ng?e.type.Ng(e,!1,f=>{f?c(29):c(0)}):c(0)})}catch(c){if("undefined"==typeof U||"ErrnoError"!==c.name)throw c;
|
||||
return c.Mf}},w:function(a,b,c,e){try{a:{var f=S(a);a=b;for(var h,k=b=0;k<c;k++){var n=C[a>>2],l=C[a+4>>2];a+=8;var m=f,q=n,p=l,t=h,y=w;if(0>p||0>t)throw new N(28);if(null===m.Uf)throw new N(8);if(0===(m.flags&2097155))throw new N(8);if(P(m.node.mode))throw new N(31);if(!m.Kf.write)throw new N(28);m.seekable&&m.flags&1024&&Jb(m,0,2);var B="undefined"!=typeof t;if(!B)t=m.position;else if(!m.seekable)throw new N(70);var G=m.Kf.write(m,y,q,p,t,void 0);B||(m.position+=G);var E=G;if(0>E){var L=-1;break a}b+=
|
||||
E;"undefined"!==typeof h&&(h+=E)}L=b}C[e>>2]=L;return 0}catch(I){if("undefined"==typeof U||"ErrnoError"!==I.name)throw I;return I.Mf}},sa:(a,b)=>{Pa(x.subarray(a,a+b));return 0},_:$b,x:ac,P:bc,ca:cc,I:dc,ka:ec,m:fc,ra:gc,na:hc,ia:ic,ea:jc,fa:kc,g:lc,h:mc,oa:nc,qa:oc,pa:pc,da:qc,ga:rc,ha:sc,ma:tc,c:uc,ja:vc,la:wc,aa:xc,V:yc,$:zc,ba:Ac,S:Bc,U:Cc,Y:Dc,X:Ec,R:Fc,q:Gc,T:Hc,Z:Ic,o:Jc,W:Kc,p:Lc},V=function(){function a(c){V=c.exports;V=Qc();ma=V.ua;ra();hd=V.zf;ta.unshift(V.va);xa--;d.monitorRunDependencies&&
|
||||
d.monitorRunDependencies(xa);0==xa&&(null!==ya&&(clearInterval(ya),ya=null),za&&(c=za,za=null,c()));return V}var b={a:qd};xa++;d.monitorRunDependencies&&d.monitorRunDependencies(xa);if(d.instantiateWasm)try{return d.instantiateWasm(b,a)}catch(c){r(`Module.instantiateWasm callback failed with error: ${c}`),ba(c)}Ga(b,function(c){a(c.instance)}).catch(ba);return{}}();d._sqlite3_status64=(a,b,c,e)=>(d._sqlite3_status64=V.wa)(a,b,c,e);d._sqlite3_status=(a,b,c,e)=>(d._sqlite3_status=V.xa)(a,b,c,e);
|
||||
d._sqlite3_db_status=(a,b,c,e,f)=>(d._sqlite3_db_status=V.ya)(a,b,c,e,f);d._sqlite3_msize=a=>(d._sqlite3_msize=V.za)(a);d._sqlite3_vfs_find=a=>(d._sqlite3_vfs_find=V.Aa)(a);d._sqlite3_vfs_register=(a,b)=>(d._sqlite3_vfs_register=V.Ba)(a,b);d._sqlite3_vfs_unregister=a=>(d._sqlite3_vfs_unregister=V.Ca)(a);d._sqlite3_release_memory=a=>(d._sqlite3_release_memory=V.Da)(a);d._sqlite3_soft_heap_limit64=(a,b)=>(d._sqlite3_soft_heap_limit64=V.Ea)(a,b);d._sqlite3_memory_used=()=>(d._sqlite3_memory_used=V.Fa)();
|
||||
d._sqlite3_hard_heap_limit64=(a,b)=>(d._sqlite3_hard_heap_limit64=V.Ga)(a,b);d._sqlite3_memory_highwater=a=>(d._sqlite3_memory_highwater=V.Ha)(a);d._sqlite3_malloc=a=>(d._sqlite3_malloc=V.Ia)(a);d._sqlite3_malloc64=(a,b)=>(d._sqlite3_malloc64=V.Ja)(a,b);d._sqlite3_free=a=>(d._sqlite3_free=V.Ka)(a);d._sqlite3_realloc=(a,b)=>(d._sqlite3_realloc=V.La)(a,b);d._sqlite3_realloc64=(a,b,c)=>(d._sqlite3_realloc64=V.Ma)(a,b,c);d._sqlite3_str_vappendf=(a,b,c)=>(d._sqlite3_str_vappendf=V.Na)(a,b,c);
|
||||
d._sqlite3_str_append=(a,b,c)=>(d._sqlite3_str_append=V.Oa)(a,b,c);d._sqlite3_str_appendchar=(a,b,c)=>(d._sqlite3_str_appendchar=V.Pa)(a,b,c);d._sqlite3_str_appendall=(a,b)=>(d._sqlite3_str_appendall=V.Qa)(a,b);d._sqlite3_str_appendf=(a,b,c)=>(d._sqlite3_str_appendf=V.Ra)(a,b,c);d._sqlite3_str_finish=a=>(d._sqlite3_str_finish=V.Sa)(a);d._sqlite3_str_errcode=a=>(d._sqlite3_str_errcode=V.Ta)(a);d._sqlite3_str_length=a=>(d._sqlite3_str_length=V.Ua)(a);d._sqlite3_str_value=a=>(d._sqlite3_str_value=V.Va)(a);
|
||||
d._sqlite3_str_reset=a=>(d._sqlite3_str_reset=V.Wa)(a);d._sqlite3_str_new=a=>(d._sqlite3_str_new=V.Xa)(a);d._sqlite3_vmprintf=(a,b)=>(d._sqlite3_vmprintf=V.Ya)(a,b);d._sqlite3_mprintf=(a,b)=>(d._sqlite3_mprintf=V.Za)(a,b);d._sqlite3_vsnprintf=(a,b,c,e)=>(d._sqlite3_vsnprintf=V._a)(a,b,c,e);d._sqlite3_snprintf=(a,b,c,e)=>(d._sqlite3_snprintf=V.$a)(a,b,c,e);d._sqlite3_log=(a,b,c)=>(d._sqlite3_log=V.ab)(a,b,c);d._sqlite3_randomness=(a,b)=>(d._sqlite3_randomness=V.bb)(a,b);
|
||||
d._sqlite3_stricmp=(a,b)=>(d._sqlite3_stricmp=V.cb)(a,b);d._sqlite3_strnicmp=(a,b,c)=>(d._sqlite3_strnicmp=V.db)(a,b,c);d._sqlite3_os_init=()=>(d._sqlite3_os_init=V.eb)();d._sqlite3_os_end=()=>(d._sqlite3_os_end=V.fb)();d._sqlite3_serialize=(a,b,c,e)=>(d._sqlite3_serialize=V.gb)(a,b,c,e);d._sqlite3_prepare_v2=(a,b,c,e,f)=>(d._sqlite3_prepare_v2=V.hb)(a,b,c,e,f);d._sqlite3_step=a=>(d._sqlite3_step=V.ib)(a);d._sqlite3_column_int64=(a,b)=>(d._sqlite3_column_int64=V.jb)(a,b);
|
||||
d._sqlite3_reset=a=>(d._sqlite3_reset=V.kb)(a);d._sqlite3_exec=(a,b,c,e,f)=>(d._sqlite3_exec=V.lb)(a,b,c,e,f);d._sqlite3_column_int=(a,b)=>(d._sqlite3_column_int=V.mb)(a,b);d._sqlite3_finalize=a=>(d._sqlite3_finalize=V.nb)(a);d._sqlite3_deserialize=(a,b,c,e,f,h,k,n)=>(d._sqlite3_deserialize=V.ob)(a,b,c,e,f,h,k,n);d._sqlite3_database_file_object=a=>(d._sqlite3_database_file_object=V.pb)(a);d._sqlite3_backup_init=(a,b,c,e)=>(d._sqlite3_backup_init=V.qb)(a,b,c,e);
|
||||
d._sqlite3_backup_step=(a,b)=>(d._sqlite3_backup_step=V.rb)(a,b);d._sqlite3_backup_finish=a=>(d._sqlite3_backup_finish=V.sb)(a);d._sqlite3_backup_remaining=a=>(d._sqlite3_backup_remaining=V.tb)(a);d._sqlite3_backup_pagecount=a=>(d._sqlite3_backup_pagecount=V.ub)(a);d._sqlite3_clear_bindings=a=>(d._sqlite3_clear_bindings=V.vb)(a);d._sqlite3_value_blob=a=>(d._sqlite3_value_blob=V.wb)(a);d._sqlite3_value_text=a=>(d._sqlite3_value_text=V.xb)(a);d._sqlite3_value_bytes=a=>(d._sqlite3_value_bytes=V.yb)(a);
|
||||
d._sqlite3_value_bytes16=a=>(d._sqlite3_value_bytes16=V.zb)(a);d._sqlite3_value_double=a=>(d._sqlite3_value_double=V.Ab)(a);d._sqlite3_value_int=a=>(d._sqlite3_value_int=V.Bb)(a);d._sqlite3_value_int64=a=>(d._sqlite3_value_int64=V.Cb)(a);d._sqlite3_value_subtype=a=>(d._sqlite3_value_subtype=V.Db)(a);d._sqlite3_value_pointer=(a,b)=>(d._sqlite3_value_pointer=V.Eb)(a,b);d._sqlite3_value_text16=a=>(d._sqlite3_value_text16=V.Fb)(a);d._sqlite3_value_text16be=a=>(d._sqlite3_value_text16be=V.Gb)(a);
|
||||
d._sqlite3_value_text16le=a=>(d._sqlite3_value_text16le=V.Hb)(a);d._sqlite3_value_type=a=>(d._sqlite3_value_type=V.Ib)(a);d._sqlite3_value_encoding=a=>(d._sqlite3_value_encoding=V.Jb)(a);d._sqlite3_value_nochange=a=>(d._sqlite3_value_nochange=V.Kb)(a);d._sqlite3_value_frombind=a=>(d._sqlite3_value_frombind=V.Lb)(a);d._sqlite3_value_dup=a=>(d._sqlite3_value_dup=V.Mb)(a);d._sqlite3_value_free=a=>(d._sqlite3_value_free=V.Nb)(a);d._sqlite3_result_blob=(a,b,c,e)=>(d._sqlite3_result_blob=V.Ob)(a,b,c,e);
|
||||
d._sqlite3_result_blob64=(a,b,c,e,f)=>(d._sqlite3_result_blob64=V.Pb)(a,b,c,e,f);d._sqlite3_result_double=(a,b)=>(d._sqlite3_result_double=V.Qb)(a,b);d._sqlite3_result_error=(a,b,c)=>(d._sqlite3_result_error=V.Rb)(a,b,c);d._sqlite3_result_error16=(a,b,c)=>(d._sqlite3_result_error16=V.Sb)(a,b,c);d._sqlite3_result_int=(a,b)=>(d._sqlite3_result_int=V.Tb)(a,b);d._sqlite3_result_int64=(a,b,c)=>(d._sqlite3_result_int64=V.Ub)(a,b,c);d._sqlite3_result_null=a=>(d._sqlite3_result_null=V.Vb)(a);
|
||||
d._sqlite3_result_pointer=(a,b,c,e)=>(d._sqlite3_result_pointer=V.Wb)(a,b,c,e);d._sqlite3_result_subtype=(a,b)=>(d._sqlite3_result_subtype=V.Xb)(a,b);d._sqlite3_result_text=(a,b,c,e)=>(d._sqlite3_result_text=V.Yb)(a,b,c,e);d._sqlite3_result_text64=(a,b,c,e,f,h)=>(d._sqlite3_result_text64=V.Zb)(a,b,c,e,f,h);d._sqlite3_result_text16=(a,b,c,e)=>(d._sqlite3_result_text16=V._b)(a,b,c,e);d._sqlite3_result_text16be=(a,b,c,e)=>(d._sqlite3_result_text16be=V.$b)(a,b,c,e);
|
||||
d._sqlite3_result_text16le=(a,b,c,e)=>(d._sqlite3_result_text16le=V.ac)(a,b,c,e);d._sqlite3_result_value=(a,b)=>(d._sqlite3_result_value=V.bc)(a,b);d._sqlite3_result_error_toobig=a=>(d._sqlite3_result_error_toobig=V.cc)(a);d._sqlite3_result_zeroblob=(a,b)=>(d._sqlite3_result_zeroblob=V.dc)(a,b);d._sqlite3_result_zeroblob64=(a,b,c)=>(d._sqlite3_result_zeroblob64=V.ec)(a,b,c);d._sqlite3_result_error_code=(a,b)=>(d._sqlite3_result_error_code=V.fc)(a,b);
|
||||
d._sqlite3_result_error_nomem=a=>(d._sqlite3_result_error_nomem=V.gc)(a);d._sqlite3_user_data=a=>(d._sqlite3_user_data=V.hc)(a);d._sqlite3_context_db_handle=a=>(d._sqlite3_context_db_handle=V.ic)(a);d._sqlite3_vtab_nochange=a=>(d._sqlite3_vtab_nochange=V.jc)(a);d._sqlite3_vtab_in_first=(a,b)=>(d._sqlite3_vtab_in_first=V.kc)(a,b);d._sqlite3_vtab_in_next=(a,b)=>(d._sqlite3_vtab_in_next=V.lc)(a,b);d._sqlite3_aggregate_context=(a,b)=>(d._sqlite3_aggregate_context=V.mc)(a,b);
|
||||
d._sqlite3_get_auxdata=(a,b)=>(d._sqlite3_get_auxdata=V.nc)(a,b);d._sqlite3_set_auxdata=(a,b,c,e)=>(d._sqlite3_set_auxdata=V.oc)(a,b,c,e);d._sqlite3_column_count=a=>(d._sqlite3_column_count=V.pc)(a);d._sqlite3_data_count=a=>(d._sqlite3_data_count=V.qc)(a);d._sqlite3_column_blob=(a,b)=>(d._sqlite3_column_blob=V.rc)(a,b);d._sqlite3_column_bytes=(a,b)=>(d._sqlite3_column_bytes=V.sc)(a,b);d._sqlite3_column_bytes16=(a,b)=>(d._sqlite3_column_bytes16=V.tc)(a,b);
|
||||
d._sqlite3_column_double=(a,b)=>(d._sqlite3_column_double=V.uc)(a,b);d._sqlite3_column_text=(a,b)=>(d._sqlite3_column_text=V.vc)(a,b);d._sqlite3_column_value=(a,b)=>(d._sqlite3_column_value=V.wc)(a,b);d._sqlite3_column_text16=(a,b)=>(d._sqlite3_column_text16=V.xc)(a,b);d._sqlite3_column_type=(a,b)=>(d._sqlite3_column_type=V.yc)(a,b);d._sqlite3_column_name=(a,b)=>(d._sqlite3_column_name=V.zc)(a,b);d._sqlite3_column_name16=(a,b)=>(d._sqlite3_column_name16=V.Ac)(a,b);
|
||||
d._sqlite3_bind_blob=(a,b,c,e,f)=>(d._sqlite3_bind_blob=V.Bc)(a,b,c,e,f);d._sqlite3_bind_blob64=(a,b,c,e,f,h)=>(d._sqlite3_bind_blob64=V.Cc)(a,b,c,e,f,h);d._sqlite3_bind_double=(a,b,c)=>(d._sqlite3_bind_double=V.Dc)(a,b,c);d._sqlite3_bind_int=(a,b,c)=>(d._sqlite3_bind_int=V.Ec)(a,b,c);d._sqlite3_bind_int64=(a,b,c,e)=>(d._sqlite3_bind_int64=V.Fc)(a,b,c,e);d._sqlite3_bind_null=(a,b)=>(d._sqlite3_bind_null=V.Gc)(a,b);d._sqlite3_bind_pointer=(a,b,c,e,f)=>(d._sqlite3_bind_pointer=V.Hc)(a,b,c,e,f);
|
||||
d._sqlite3_bind_text=(a,b,c,e,f)=>(d._sqlite3_bind_text=V.Ic)(a,b,c,e,f);d._sqlite3_bind_text64=(a,b,c,e,f,h,k)=>(d._sqlite3_bind_text64=V.Jc)(a,b,c,e,f,h,k);d._sqlite3_bind_text16=(a,b,c,e,f)=>(d._sqlite3_bind_text16=V.Kc)(a,b,c,e,f);d._sqlite3_bind_value=(a,b,c)=>(d._sqlite3_bind_value=V.Lc)(a,b,c);d._sqlite3_bind_zeroblob=(a,b,c)=>(d._sqlite3_bind_zeroblob=V.Mc)(a,b,c);d._sqlite3_bind_zeroblob64=(a,b,c,e)=>(d._sqlite3_bind_zeroblob64=V.Nc)(a,b,c,e);
|
||||
d._sqlite3_bind_parameter_count=a=>(d._sqlite3_bind_parameter_count=V.Oc)(a);d._sqlite3_bind_parameter_name=(a,b)=>(d._sqlite3_bind_parameter_name=V.Pc)(a,b);d._sqlite3_bind_parameter_index=(a,b)=>(d._sqlite3_bind_parameter_index=V.Qc)(a,b);d._sqlite3_db_handle=a=>(d._sqlite3_db_handle=V.Rc)(a);d._sqlite3_stmt_readonly=a=>(d._sqlite3_stmt_readonly=V.Sc)(a);d._sqlite3_stmt_isexplain=a=>(d._sqlite3_stmt_isexplain=V.Tc)(a);d._sqlite3_stmt_explain=(a,b)=>(d._sqlite3_stmt_explain=V.Uc)(a,b);
|
||||
d._sqlite3_stmt_busy=a=>(d._sqlite3_stmt_busy=V.Vc)(a);d._sqlite3_next_stmt=(a,b)=>(d._sqlite3_next_stmt=V.Wc)(a,b);d._sqlite3_stmt_status=(a,b,c)=>(d._sqlite3_stmt_status=V.Xc)(a,b,c);d._sqlite3_sql=a=>(d._sqlite3_sql=V.Yc)(a);d._sqlite3_expanded_sql=a=>(d._sqlite3_expanded_sql=V.Zc)(a);d._sqlite3_value_numeric_type=a=>(d._sqlite3_value_numeric_type=V._c)(a);d._sqlite3_blob_open=(a,b,c,e,f,h,k,n)=>(d._sqlite3_blob_open=V.$c)(a,b,c,e,f,h,k,n);d._sqlite3_blob_close=a=>(d._sqlite3_blob_close=V.ad)(a);
|
||||
d._sqlite3_blob_read=(a,b,c,e)=>(d._sqlite3_blob_read=V.bd)(a,b,c,e);d._sqlite3_blob_write=(a,b,c,e)=>(d._sqlite3_blob_write=V.cd)(a,b,c,e);d._sqlite3_blob_bytes=a=>(d._sqlite3_blob_bytes=V.dd)(a);d._sqlite3_blob_reopen=(a,b,c)=>(d._sqlite3_blob_reopen=V.ed)(a,b,c);d._sqlite3_set_authorizer=(a,b,c)=>(d._sqlite3_set_authorizer=V.fd)(a,b,c);d._sqlite3_strglob=(a,b)=>(d._sqlite3_strglob=V.gd)(a,b);d._sqlite3_strlike=(a,b,c)=>(d._sqlite3_strlike=V.hd)(a,b,c);d._sqlite3_errmsg=a=>(d._sqlite3_errmsg=V.id)(a);
|
||||
d._sqlite3_auto_extension=a=>(d._sqlite3_auto_extension=V.jd)(a);d._sqlite3_cancel_auto_extension=a=>(d._sqlite3_cancel_auto_extension=V.kd)(a);d._sqlite3_reset_auto_extension=()=>(d._sqlite3_reset_auto_extension=V.ld)();d._sqlite3_prepare=(a,b,c,e,f)=>(d._sqlite3_prepare=V.md)(a,b,c,e,f);d._sqlite3_prepare_v3=(a,b,c,e,f,h)=>(d._sqlite3_prepare_v3=V.nd)(a,b,c,e,f,h);d._sqlite3_prepare16=(a,b,c,e,f)=>(d._sqlite3_prepare16=V.od)(a,b,c,e,f);
|
||||
d._sqlite3_prepare16_v2=(a,b,c,e,f)=>(d._sqlite3_prepare16_v2=V.pd)(a,b,c,e,f);d._sqlite3_prepare16_v3=(a,b,c,e,f,h)=>(d._sqlite3_prepare16_v3=V.qd)(a,b,c,e,f,h);d._sqlite3_get_table=(a,b,c,e,f,h)=>(d._sqlite3_get_table=V.rd)(a,b,c,e,f,h);d._sqlite3_free_table=a=>(d._sqlite3_free_table=V.sd)(a);d._sqlite3_create_module=(a,b,c,e)=>(d._sqlite3_create_module=V.td)(a,b,c,e);d._sqlite3_create_module_v2=(a,b,c,e,f)=>(d._sqlite3_create_module_v2=V.ud)(a,b,c,e,f);
|
||||
d._sqlite3_drop_modules=(a,b)=>(d._sqlite3_drop_modules=V.vd)(a,b);d._sqlite3_declare_vtab=(a,b)=>(d._sqlite3_declare_vtab=V.wd)(a,b);d._sqlite3_vtab_on_conflict=a=>(d._sqlite3_vtab_on_conflict=V.xd)(a);d._sqlite3_vtab_config=(a,b,c)=>(d._sqlite3_vtab_config=V.yd)(a,b,c);d._sqlite3_vtab_collation=(a,b)=>(d._sqlite3_vtab_collation=V.zd)(a,b);d._sqlite3_vtab_in=(a,b,c)=>(d._sqlite3_vtab_in=V.Ad)(a,b,c);d._sqlite3_vtab_rhs_value=(a,b,c)=>(d._sqlite3_vtab_rhs_value=V.Bd)(a,b,c);
|
||||
d._sqlite3_vtab_distinct=a=>(d._sqlite3_vtab_distinct=V.Cd)(a);d._sqlite3_keyword_name=(a,b,c)=>(d._sqlite3_keyword_name=V.Dd)(a,b,c);d._sqlite3_keyword_count=()=>(d._sqlite3_keyword_count=V.Ed)();d._sqlite3_keyword_check=(a,b)=>(d._sqlite3_keyword_check=V.Fd)(a,b);d._sqlite3_complete=a=>(d._sqlite3_complete=V.Gd)(a);d._sqlite3_complete16=a=>(d._sqlite3_complete16=V.Hd)(a);d._sqlite3_libversion=()=>(d._sqlite3_libversion=V.Id)();d._sqlite3_libversion_number=()=>(d._sqlite3_libversion_number=V.Jd)();
|
||||
d._sqlite3_threadsafe=()=>(d._sqlite3_threadsafe=V.Kd)();d._sqlite3_initialize=()=>(d._sqlite3_initialize=V.Ld)();d._sqlite3_shutdown=()=>(d._sqlite3_shutdown=V.Md)();d._sqlite3_config=(a,b)=>(d._sqlite3_config=V.Nd)(a,b);d._sqlite3_db_mutex=a=>(d._sqlite3_db_mutex=V.Od)(a);d._sqlite3_db_release_memory=a=>(d._sqlite3_db_release_memory=V.Pd)(a);d._sqlite3_db_cacheflush=a=>(d._sqlite3_db_cacheflush=V.Qd)(a);d._sqlite3_db_config=(a,b,c)=>(d._sqlite3_db_config=V.Rd)(a,b,c);
|
||||
d._sqlite3_last_insert_rowid=a=>(d._sqlite3_last_insert_rowid=V.Sd)(a);d._sqlite3_set_last_insert_rowid=(a,b,c)=>(d._sqlite3_set_last_insert_rowid=V.Td)(a,b,c);d._sqlite3_changes64=a=>(d._sqlite3_changes64=V.Ud)(a);d._sqlite3_changes=a=>(d._sqlite3_changes=V.Vd)(a);d._sqlite3_total_changes64=a=>(d._sqlite3_total_changes64=V.Wd)(a);d._sqlite3_total_changes=a=>(d._sqlite3_total_changes=V.Xd)(a);d._sqlite3_txn_state=(a,b)=>(d._sqlite3_txn_state=V.Yd)(a,b);d._sqlite3_close=a=>(d._sqlite3_close=V.Zd)(a);
|
||||
d._sqlite3_close_v2=a=>(d._sqlite3_close_v2=V._d)(a);d._sqlite3_busy_handler=(a,b,c)=>(d._sqlite3_busy_handler=V.$d)(a,b,c);d._sqlite3_progress_handler=(a,b,c,e)=>(d._sqlite3_progress_handler=V.ae)(a,b,c,e);d._sqlite3_busy_timeout=(a,b)=>(d._sqlite3_busy_timeout=V.be)(a,b);d._sqlite3_interrupt=a=>(d._sqlite3_interrupt=V.ce)(a);d._sqlite3_is_interrupted=a=>(d._sqlite3_is_interrupted=V.de)(a);d._sqlite3_create_function=(a,b,c,e,f,h,k,n)=>(d._sqlite3_create_function=V.ee)(a,b,c,e,f,h,k,n);
|
||||
d._sqlite3_create_function_v2=(a,b,c,e,f,h,k,n,l)=>(d._sqlite3_create_function_v2=V.fe)(a,b,c,e,f,h,k,n,l);d._sqlite3_create_window_function=(a,b,c,e,f,h,k,n,l,m)=>(d._sqlite3_create_window_function=V.ge)(a,b,c,e,f,h,k,n,l,m);d._sqlite3_create_function16=(a,b,c,e,f,h,k,n)=>(d._sqlite3_create_function16=V.he)(a,b,c,e,f,h,k,n);d._sqlite3_overload_function=(a,b,c)=>(d._sqlite3_overload_function=V.ie)(a,b,c);d._sqlite3_trace_v2=(a,b,c,e)=>(d._sqlite3_trace_v2=V.je)(a,b,c,e);
|
||||
d._sqlite3_commit_hook=(a,b,c)=>(d._sqlite3_commit_hook=V.ke)(a,b,c);d._sqlite3_update_hook=(a,b,c)=>(d._sqlite3_update_hook=V.le)(a,b,c);d._sqlite3_rollback_hook=(a,b,c)=>(d._sqlite3_rollback_hook=V.me)(a,b,c);d._sqlite3_autovacuum_pages=(a,b,c,e)=>(d._sqlite3_autovacuum_pages=V.ne)(a,b,c,e);d._sqlite3_wal_autocheckpoint=(a,b)=>(d._sqlite3_wal_autocheckpoint=V.oe)(a,b);d._sqlite3_wal_hook=(a,b,c)=>(d._sqlite3_wal_hook=V.pe)(a,b,c);
|
||||
d._sqlite3_wal_checkpoint_v2=(a,b,c,e,f)=>(d._sqlite3_wal_checkpoint_v2=V.qe)(a,b,c,e,f);d._sqlite3_wal_checkpoint=(a,b)=>(d._sqlite3_wal_checkpoint=V.re)(a,b);d._sqlite3_error_offset=a=>(d._sqlite3_error_offset=V.se)(a);d._sqlite3_errmsg16=a=>(d._sqlite3_errmsg16=V.te)(a);d._sqlite3_errcode=a=>(d._sqlite3_errcode=V.ue)(a);d._sqlite3_extended_errcode=a=>(d._sqlite3_extended_errcode=V.ve)(a);d._sqlite3_system_errno=a=>(d._sqlite3_system_errno=V.we)(a);d._sqlite3_errstr=a=>(d._sqlite3_errstr=V.xe)(a);
|
||||
d._sqlite3_limit=(a,b,c)=>(d._sqlite3_limit=V.ye)(a,b,c);d._sqlite3_open=(a,b)=>(d._sqlite3_open=V.ze)(a,b);d._sqlite3_open_v2=(a,b,c,e)=>(d._sqlite3_open_v2=V.Ae)(a,b,c,e);d._sqlite3_open16=(a,b)=>(d._sqlite3_open16=V.Be)(a,b);d._sqlite3_create_collation=(a,b,c,e,f)=>(d._sqlite3_create_collation=V.Ce)(a,b,c,e,f);d._sqlite3_create_collation_v2=(a,b,c,e,f,h)=>(d._sqlite3_create_collation_v2=V.De)(a,b,c,e,f,h);d._sqlite3_create_collation16=(a,b,c,e,f)=>(d._sqlite3_create_collation16=V.Ee)(a,b,c,e,f);
|
||||
d._sqlite3_collation_needed=(a,b,c)=>(d._sqlite3_collation_needed=V.Fe)(a,b,c);d._sqlite3_collation_needed16=(a,b,c)=>(d._sqlite3_collation_needed16=V.Ge)(a,b,c);d._sqlite3_get_clientdata=(a,b)=>(d._sqlite3_get_clientdata=V.He)(a,b);d._sqlite3_set_clientdata=(a,b,c,e)=>(d._sqlite3_set_clientdata=V.Ie)(a,b,c,e);d._sqlite3_get_autocommit=a=>(d._sqlite3_get_autocommit=V.Je)(a);d._sqlite3_table_column_metadata=(a,b,c,e,f,h,k,n,l)=>(d._sqlite3_table_column_metadata=V.Ke)(a,b,c,e,f,h,k,n,l);
|
||||
d._sqlite3_sleep=a=>(d._sqlite3_sleep=V.Le)(a);d._sqlite3_extended_result_codes=(a,b)=>(d._sqlite3_extended_result_codes=V.Me)(a,b);d._sqlite3_file_control=(a,b,c,e)=>(d._sqlite3_file_control=V.Ne)(a,b,c,e);d._sqlite3_test_control=(a,b)=>(d._sqlite3_test_control=V.Oe)(a,b);d._sqlite3_create_filename=(a,b,c,e,f)=>(d._sqlite3_create_filename=V.Pe)(a,b,c,e,f);d._sqlite3_free_filename=a=>(d._sqlite3_free_filename=V.Qe)(a);d._sqlite3_uri_parameter=(a,b)=>(d._sqlite3_uri_parameter=V.Re)(a,b);
|
||||
d._sqlite3_uri_key=(a,b)=>(d._sqlite3_uri_key=V.Se)(a,b);d._sqlite3_uri_boolean=(a,b,c)=>(d._sqlite3_uri_boolean=V.Te)(a,b,c);d._sqlite3_uri_int64=(a,b,c,e)=>(d._sqlite3_uri_int64=V.Ue)(a,b,c,e);d._sqlite3_filename_database=a=>(d._sqlite3_filename_database=V.Ve)(a);d._sqlite3_filename_journal=a=>(d._sqlite3_filename_journal=V.We)(a);d._sqlite3_filename_wal=a=>(d._sqlite3_filename_wal=V.Xe)(a);d._sqlite3_db_name=(a,b)=>(d._sqlite3_db_name=V.Ye)(a,b);
|
||||
d._sqlite3_db_filename=(a,b)=>(d._sqlite3_db_filename=V.Ze)(a,b);d._sqlite3_db_readonly=(a,b)=>(d._sqlite3_db_readonly=V._e)(a,b);d._sqlite3_compileoption_used=a=>(d._sqlite3_compileoption_used=V.$e)(a);d._sqlite3_compileoption_get=a=>(d._sqlite3_compileoption_get=V.af)(a);d._sqlite3_sourceid=()=>(d._sqlite3_sourceid=V.bf)();d._sqlite3mc_config=(a,b,c)=>(d._sqlite3mc_config=V.cf)(a,b,c);d._sqlite3mc_cipher_count=()=>(d._sqlite3mc_cipher_count=V.df)();
|
||||
d._sqlite3mc_cipher_index=a=>(d._sqlite3mc_cipher_index=V.ef)(a);d._sqlite3mc_cipher_name=a=>(d._sqlite3mc_cipher_name=V.ff)(a);d._sqlite3mc_config_cipher=(a,b,c,e)=>(d._sqlite3mc_config_cipher=V.gf)(a,b,c,e);d._sqlite3mc_codec_data=(a,b,c)=>(d._sqlite3mc_codec_data=V.hf)(a,b,c);d._sqlite3_key=(a,b,c)=>(d._sqlite3_key=V.jf)(a,b,c);d._sqlite3_key_v2=(a,b,c,e)=>(d._sqlite3_key_v2=V.kf)(a,b,c,e);d._sqlite3_rekey_v2=(a,b,c,e)=>(d._sqlite3_rekey_v2=V.lf)(a,b,c,e);
|
||||
d._sqlite3_rekey=(a,b,c)=>(d._sqlite3_rekey=V.mf)(a,b,c);d._sqlite3mc_register_cipher=(a,b,c)=>(d._sqlite3mc_register_cipher=V.nf)(a,b,c);var pd=()=>(pd=V.of)(),Vb=d._malloc=a=>(Vb=d._malloc=V.pf)(a),ed=d._free=a=>(ed=d._free=V.qf)(a);d._RegisterExtensionFunctions=a=>(d._RegisterExtensionFunctions=V.rf)(a);d._set_authorizer=a=>(d._set_authorizer=V.sf)(a);d._create_function=(a,b,c,e,f,h)=>(d._create_function=V.tf)(a,b,c,e,f,h);d._create_module=(a,b,c,e)=>(d._create_module=V.uf)(a,b,c,e);
|
||||
d._progress_handler=(a,b)=>(d._progress_handler=V.vf)(a,b);d._register_vfs=(a,b,c,e)=>(d._register_vfs=V.wf)(a,b,c,e);d._getSqliteFree=()=>(d._getSqliteFree=V.xf)();var rd=d._main=(a,b)=>(rd=d._main=V.yf)(a,b),fb=(a,b)=>(fb=V.Af)(a,b),sd=()=>(sd=V.Bf)(),nd=()=>(nd=V.Cf)(),ld=a=>(ld=V.Df)(a),md=a=>(md=V.Ef)(a),cd=a=>(cd=V.Ff)(a),Sc=()=>(Sc=V.Gf)(),bd=a=>(bd=V.Hf)(a),dd=()=>(dd=V.If)();d._sqlite3_version=3232;d.getTempRet0=sd;d.ccall=Z;
|
||||
d.cwrap=(a,b,c,e)=>{var f=!c||c.every(h=>"number"===h||"boolean"===h);return"string"!==b&&f&&!e?d["_"+a]:function(){return Z(a,b,c,arguments,e)}};
|
||||
d.addFunction=(a,b)=>{if(!kd){kd=new WeakMap;var c=X.length;if(kd)for(var e=0;e<0+c;e++){var f=e;var h=jd[f];h||(f>=jd.length&&(jd.length=f+1),jd[f]=h=X.get(f));(f=h)&&kd.set(f,e)}}if(c=kd.get(a)||0)return c;if(ld.length)c=ld.pop();else{try{X.grow(1)}catch(n){if(!(n instanceof RangeError))throw n;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";}c=X.length-1}try{e=c,X.set(e,a),jd[e]=X.get(e)}catch(n){if(!(n instanceof TypeError))throw n;if("function"==typeof WebAssembly.Function){e=WebAssembly.Function;
|
||||
f={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"};h={parameters:[],results:"v"==b[0]?[]:[f[b[0]]]};for(var k=1;k<b.length;++k)h.parameters.push(f[b[k]]);b=new e(h,a)}else{e=[1];f=b.slice(0,1);b=b.slice(1);h={i:127,p:127,j:126,f:125,d:124,e:111};e.push(96);k=b.length;128>k?e.push(k):e.push(k%128|128,k>>7);for(k=0;k<b.length;++k)e.push(h[b[k]]);"v"==f?e.push(0):e.push(1,h[f]);b=[0,97,115,109,1,0,0,0,1];f=e.length;128>f?b.push(f):b.push(f%128|128,f>>7);b.push.apply(b,e);b.push(2,7,1,1,101,1,
|
||||
102,0,0,7,5,1,1,102,0,0);b=new WebAssembly.Module(new Uint8Array(b));b=(new WebAssembly.Instance(b,{e:{f:a}})).exports.f}e=c;X.set(e,b);jd[e]=X.get(e)}kd.set(a,c);return c};d.setValue=H;d.getValue=F;d.UTF8ToString=(a,b)=>a?J(w,a,b):"";d.stringToUTF8=(a,b,c)=>Ua(a,w,b,c);d.lengthBytesUTF8=Ta;d.intArrayFromString=Va;d.intArrayToString=function(a){for(var b=[],c=0;c<a.length;c++){var e=a[c];255<e&&(e&=255);b.push(String.fromCharCode(e))}return b.join("")};
|
||||
d.AsciiToString=a=>{for(var b="";;){var c=w[a++>>0];if(!c)return b;b+=String.fromCharCode(c)}};d.UTF16ToString=(a,b)=>{var c=a>>1;for(var e=c+b/2;!(c>=e)&&pa[c];)++c;c<<=1;if(32<c-a&&pd)return pd.decode(w.subarray(a,c));c="";for(e=0;!(e>=b/2);++e){var f=x[a+2*e>>1];if(0==f)break;c+=String.fromCharCode(f)}return c};d.stringToUTF16=(a,b,c)=>{void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)x[b>>1]=a.charCodeAt(f),b+=2;x[b>>1]=0;return b-e};
|
||||
d.UTF32ToString=(a,b)=>{for(var c=0,e="";!(c>=b/4);){var f=z[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e};d.stringToUTF32=(a,b,c)=>{void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var h=a.charCodeAt(f);if(55296<=h&&57343>=h){var k=a.charCodeAt(++f);h=65536+((h&1023)<<10)|k&1023}z[b>>2]=h;b+=4;if(b+4>c)break}z[b>>2]=0;return b-e};d.writeArrayToMemory=(a,b)=>{v.set(a,b)};var ud;
|
||||
Aa=function vd(){ud||wd();ud||(Aa=vd)};
|
||||
function wd(){function a(){if(!ud&&(ud=!0,d.calledRun=!0,!na)){d.noFSInit||Mb||(Mb=!0,Lb(),d.stdin=d.stdin,d.stdout=d.stdout,d.stderr=d.stderr,d.stdin?Nb("stdin",d.stdin):Cb("/dev/tty","/dev/stdin"),d.stdout?Nb("stdout",null,d.stdout):Cb("/dev/tty","/dev/stdout"),d.stderr?Nb("stderr",null,d.stderr):Cb("/dev/tty1","/dev/stderr"),Ib("/dev/stdin",0),Ib("/dev/stdout",1),Ib("/dev/stderr",1));mb=!1;Ja(ua);Ja(va);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(xd){var b=sd;try{var c=b(0,0);oa=
|
||||
c;Oc(c)}catch(e){Pc(e)}}if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;)b=d.postRun.shift(),wa.unshift(b);Ja(wa)}}if(!(0<ya)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)xa();Ja(ta);0<ya||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();
|
||||
var xd=!0;d.noInitialRun&&(xd=!1);wd();
|
||||
d.addFunction=(a,b)=>{if(!jd){jd=new WeakMap;var c=hd.length;if(jd)for(var e=0;e<0+c;e++){var f=hd.get(e);f&&jd.set(f,e)}}if(c=jd.get(a)||0)return c;if(kd.length)c=kd.pop();else{try{hd.grow(1)}catch(n){if(!(n instanceof RangeError))throw n;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";}c=hd.length-1}try{hd.set(c,a)}catch(n){if(!(n instanceof TypeError))throw n;if("function"==typeof WebAssembly.Function){e=WebAssembly.Function;f={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"};for(var h=
|
||||
{parameters:[],results:"v"==b[0]?[]:[f[b[0]]]},k=1;k<b.length;++k)h.parameters.push(f[b[k]]);b=new e(h,a)}else{e=[1];f=b.slice(0,1);b=b.slice(1);h={i:127,p:127,j:126,f:125,d:124,e:111};e.push(96);k=b.length;128>k?e.push(k):e.push(k%128|128,k>>7);for(k=0;k<b.length;++k)e.push(h[b[k]]);"v"==f?e.push(0):e.push(1,h[f]);b=[0,97,115,109,1,0,0,0,1];f=e.length;128>f?b.push(f):b.push(f%128|128,f>>7);b.push.apply(b,e);b.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);b=new WebAssembly.Module(new Uint8Array(b));
|
||||
b=(new WebAssembly.Instance(b,{e:{f:a}})).exports.f}hd.set(c,b)}jd.set(a,c);return c};d.setValue=J;d.getValue=H;d.UTF8ToString=(a,b)=>a?K(x,a,b):"";d.stringToUTF8=(a,b,c)=>Ta(a,x,b,c);d.lengthBytesUTF8=Sa;d.intArrayFromString=Ua;d.intArrayToString=function(a){for(var b=[],c=0;c<a.length;c++){var e=a[c];255<e&&(e&=255);b.push(String.fromCharCode(e))}return b.join("")};d.AsciiToString=a=>{for(var b="";;){var c=x[a++>>0];if(!c)return b;b+=String.fromCharCode(c)}};
|
||||
d.UTF16ToString=(a,b)=>{var c=a>>1;for(var e=c+b/2;!(c>=e)&&oa[c];)++c;c<<=1;if(32<c-a&&od)return od.decode(x.subarray(a,c));c="";for(e=0;!(e>=b/2);++e){var f=z[a+2*e>>1];if(0==f)break;c+=String.fromCharCode(f)}return c};d.stringToUTF16=(a,b,c)=>{void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)z[b>>1]=a.charCodeAt(f),b+=2;z[b>>1]=0;return b-e};
|
||||
d.UTF32ToString=(a,b)=>{for(var c=0,e="";!(c>=b/4);){var f=A[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e};d.stringToUTF32=(a,b,c)=>{void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var h=a.charCodeAt(f);if(55296<=h&&57343>=h){var k=a.charCodeAt(++f);h=65536+((h&1023)<<10)|k&1023}A[b>>2]=h;b+=4;if(b+4>c)break}A[b>>2]=0;return b-e};d.writeArrayToMemory=(a,b)=>{w.set(a,b)};var td;
|
||||
za=function ud(){td||vd();td||(za=ud)};
|
||||
function vd(){function a(){if(!td&&(td=!0,d.calledRun=!0,!v)){d.noFSInit||Lb||(Lb=!0,Kb(),d.stdin=d.stdin,d.stdout=d.stdout,d.stderr=d.stderr,d.stdin?Mb("stdin",d.stdin):Bb("/dev/tty","/dev/stdin"),d.stdout?Mb("stdout",null,d.stdout):Bb("/dev/tty","/dev/stdout"),d.stderr?Mb("stderr",null,d.stderr):Bb("/dev/tty1","/dev/stderr"),Hb("/dev/stdin",0),Hb("/dev/stdout",1),Hb("/dev/stderr",1));lb=!1;Ia(ta);Ia(ua);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(wd){var b=rd;try{var c=b(0,0);na=
|
||||
c;Nc(c)}catch(e){Oc(e)}}if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;)b=d.postRun.shift(),va.unshift(b);Ia(va)}}if(!(0<xa)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)wa();Ia(sa);0<xa||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();
|
||||
var wd=!0;d.noInitialRun&&(wd=!1);vd();
|
||||
|
||||
|
||||
return moduleArg.ready
|
||||
|
||||
Binary file not shown.
@@ -5,11 +5,11 @@ var Module = (() => {
|
||||
return (
|
||||
function(moduleArg = {}) {
|
||||
|
||||
var d=moduleArg,aa,ba;d.ready=new Promise((a,b)=>{aa=a;ba=b});var ca=Object.assign({},d),da="./this.program",ea=(a,b)=>{throw b;},fa="object"==typeof window,ha="function"==typeof importScripts,g="",ja;
|
||||
if(fa||ha)ha?g=self.location.href:"undefined"!=typeof document&&document.currentScript&&(g=document.currentScript.src),_scriptDir&&(g=_scriptDir),0!==g.indexOf("blob:")?g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1):g="",ha&&(ja=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ka=d.print||console.log.bind(console),r=d.printErr||console.error.bind(console);Object.assign(d,ca);ca=null;d.thisProgram&&(da=d.thisProgram);
|
||||
var d=moduleArg,aa,ba;d.ready=new Promise((a,b)=>{aa=a;ba=b});var ca=Object.assign({},d),da="./this.program",ea=(a,b)=>{throw b;},fa="object"==typeof window,ia="function"==typeof importScripts,g="",ja;
|
||||
if(fa||ia)ia?g=self.location.href:"undefined"!=typeof document&&document.currentScript&&(g=document.currentScript.src),_scriptDir&&(g=_scriptDir),0!==g.indexOf("blob:")?g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1):g="",ia&&(ja=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ka=d.print||console.log.bind(console),r=d.printErr||console.error.bind(console);Object.assign(d,ca);ca=null;d.thisProgram&&(da=d.thisProgram);
|
||||
d.quit&&(ea=d.quit);var la;d.wasmBinary&&(la=d.wasmBinary);"object"!=typeof WebAssembly&&u("no native wasm support detected");var ma,na=!1,v,w,x,oa,y,B,pa,qa;function ra(){var a=ma.buffer;d.HEAP8=v=new Int8Array(a);d.HEAP16=x=new Int16Array(a);d.HEAPU8=w=new Uint8Array(a);d.HEAPU16=oa=new Uint16Array(a);d.HEAP32=y=new Int32Array(a);d.HEAPU32=B=new Uint32Array(a);d.HEAPF32=pa=new Float32Array(a);d.HEAPF64=qa=new Float64Array(a)}var sa=[],ta=[],ua=[],va=[];
|
||||
function wa(){var a=d.preRun.shift();sa.unshift(a)}var C=0,xa=null,ya=null;function u(a){if(d.onAbort)d.onAbort(a);a="Aborted("+a+")";r(a);na=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");ba(a);throw a;}var za=a=>a.startsWith("data:application/octet-stream;base64,"),D;if(d.locateFile){if(D="wa-sqlite.wasm",!za(D)){var Aa=D;D=d.locateFile?d.locateFile(Aa,g):g+Aa}}else D=(new URL("wa-sqlite.wasm",import.meta.url)).href;
|
||||
function Ba(a){if(a==D&&la)return new Uint8Array(la);if(ja)return ja(a);throw"both async and sync fetching of the wasm failed";}function Ca(a){return la||!fa&&!ha||"function"!=typeof fetch?Promise.resolve().then(()=>Ba(a)):fetch(a,{credentials:"same-origin"}).then(b=>{if(!b.ok)throw"failed to load wasm binary file at '"+a+"'";return b.arrayBuffer()}).catch(()=>Ba(a))}
|
||||
function Ba(a){if(a==D&&la)return new Uint8Array(la);if(ja)return ja(a);throw"both async and sync fetching of the wasm failed";}function Ca(a){return la||!fa&&!ia||"function"!=typeof fetch?Promise.resolve().then(()=>Ba(a)):fetch(a,{credentials:"same-origin"}).then(b=>{if(!b.ok)throw"failed to load wasm binary file at '"+a+"'";return b.arrayBuffer()}).catch(()=>Ba(a))}
|
||||
function Da(a,b,c){return Ca(a).then(e=>WebAssembly.instantiate(e,b)).then(e=>e).then(c,e=>{r(`failed to asynchronously prepare wasm: ${e}`);u(e)})}function Ea(a,b){var c=D;return la||"function"!=typeof WebAssembly.instantiateStreaming||za(c)||"function"!=typeof fetch?Da(c,a,b):fetch(c,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,a).then(b,function(f){r(`wasm streaming compile failed: ${f}`);r("falling back to ArrayBuffer instantiation");return Da(c,a,b)}))}var F,H;
|
||||
function Fa(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}var Ga=a=>{for(;0<a.length;)a.shift()(d)};function J(a,b="i8"){b.endsWith("*")&&(b="*");switch(b){case "i1":return v[a>>0];case "i8":return v[a>>0];case "i16":return x[a>>1];case "i32":return y[a>>2];case "i64":u("to do getValue(i64) use WASM_BIGINT");case "float":return pa[a>>2];case "double":return qa[a>>3];case "*":return B[a>>2];default:u(`invalid type for getValue: ${b}`)}}
|
||||
var Ha=d.noExitRuntime||!0;function K(a,b,c="i8"){c.endsWith("*")&&(c="*");switch(c){case "i1":v[a>>0]=b;break;case "i8":v[a>>0]=b;break;case "i16":x[a>>1]=b;break;case "i32":y[a>>2]=b;break;case "i64":u("to do setValue(i64) use WASM_BIGINT");case "float":pa[a>>2]=b;break;case "double":qa[a>>3]=b;break;case "*":B[a>>2]=b;break;default:u(`invalid type for setValue: ${c}`)}}
|
||||
@@ -17,86 +17,86 @@ var Ia="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,M=(a,b,c)=
|
||||
Ja=(a,b)=>{for(var c=0,e=a.length-1;0<=e;e--){var f=a[e];"."===f?a.splice(e,1):".."===f?(a.splice(e,1),c++):c&&(a.splice(e,1),c--)}if(b)for(;c;c--)a.unshift("..");return a},N=a=>{var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=Ja(a.split("/").filter(e=>!!e),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},Ka=a=>{var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b},La=a=>{if("/"===
|
||||
a)return"/";a=N(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)},Ma=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return a=>crypto.getRandomValues(a);u("initRandomDevice")},Na=a=>(Na=Ma())(a);
|
||||
function Oa(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!=typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=Ja(a.split("/").filter(e=>!!e),!b).join("/");return(b?"/":"")+a||"."}
|
||||
var Pa=[],Qa=a=>{for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++c):b+=3}return b},Ra=(a,b,c,e)=>{if(!(0<e))return 0;var f=c;e=c+e-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var n=a.charCodeAt(++h);k=65536+((k&1023)<<10)|n&1023}if(127>=k){if(c>=e)break;b[c++]=k}else{if(2047>=k){if(c+1>=e)break;b[c++]=192|k>>6}else{if(65535>=k){if(c+2>=e)break;b[c++]=224|k>>12}else{if(c+3>=e)break;b[c++]=240|k>>18;b[c++]=128|k>>
|
||||
12&63}b[c++]=128|k>>6&63}b[c++]=128|k&63}}b[c]=0;return c-f};function Sa(a,b,c){c=Array(0<c?c:Qa(a)+1);a=Ra(a,c,0,c.length);b&&(c.length=a);return c}var Ta=[];function Ua(a,b){Ta[a]={input:[],Mf:[],Yf:b};Va(a,Wa)}
|
||||
var Wa={open(a){var b=Ta[a.node.ag];if(!b)throw new O(43);a.Nf=b;a.seekable=!1},close(a){a.Nf.Yf.Vf(a.Nf)},Vf(a){a.Nf.Yf.Vf(a.Nf)},read(a,b,c,e){if(!a.Nf||!a.Nf.Yf.qg)throw new O(60);for(var f=0,h=0;h<e;h++){try{var k=a.Nf.Yf.qg(a.Nf)}catch(n){throw new O(29);}if(void 0===k&&0===f)throw new O(6);if(null===k||void 0===k)break;f++;b[c+h]=k}f&&(a.node.timestamp=Date.now());return f},write(a,b,c,e){if(!a.Nf||!a.Nf.Yf.kg)throw new O(60);try{for(var f=0;f<e;f++)a.Nf.Yf.kg(a.Nf,b[c+f])}catch(h){throw new O(29);
|
||||
}e&&(a.node.timestamp=Date.now());return f}},Xa={qg(){a:{if(!Pa.length){var a=null;"undefined"!=typeof window&&"function"==typeof window.prompt?(a=window.prompt("Input: "),null!==a&&(a+="\n")):"function"==typeof readline&&(a=readline(),null!==a&&(a+="\n"));if(!a){a=null;break a}Pa=Sa(a,!0)}a=Pa.shift()}return a},kg(a,b){null===b||10===b?(ka(M(a.Mf,0)),a.Mf=[]):0!=b&&a.Mf.push(b)},Vf(a){a.Mf&&0<a.Mf.length&&(ka(M(a.Mf,0)),a.Mf=[])},Qg(){return{Mg:25856,Og:5,Lg:191,Ng:35387,Kg:[3,28,127,21,4,0,1,0,
|
||||
17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},Rg(){return 0},Sg(){return[24,80]}},Ya={kg(a,b){null===b||10===b?(r(M(a.Mf,0)),a.Mf=[]):0!=b&&a.Mf.push(b)},Vf(a){a.Mf&&0<a.Mf.length&&(r(M(a.Mf,0)),a.Mf=[])}};function Za(a,b){var c=a.If?a.If.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.If,a.If=new Uint8Array(b),0<a.Kf&&a.If.set(c.subarray(0,a.Kf),0))}
|
||||
var P={Pf:null,Qf(){return P.createNode(null,"/",16895,0)},createNode(a,b,c,e){if(24576===(c&61440)||4096===(c&61440))throw new O(63);P.Pf||(P.Pf={dir:{node:{Of:P.Gf.Of,Lf:P.Gf.Lf,Zf:P.Gf.Zf,dg:P.Gf.dg,vg:P.Gf.vg,ig:P.Gf.ig,gg:P.Gf.gg,ug:P.Gf.ug,hg:P.Gf.hg},stream:{Uf:P.Hf.Uf}},file:{node:{Of:P.Gf.Of,Lf:P.Gf.Lf},stream:{Uf:P.Hf.Uf,read:P.Hf.read,write:P.Hf.write,ng:P.Hf.ng,eg:P.Hf.eg,fg:P.Hf.fg}},link:{node:{Of:P.Gf.Of,Lf:P.Gf.Lf,bg:P.Gf.bg},stream:{}},og:{node:{Of:P.Gf.Of,Lf:P.Gf.Lf},stream:$a}});
|
||||
c=ab(a,b,c,e);Q(c.mode)?(c.Gf=P.Pf.dir.node,c.Hf=P.Pf.dir.stream,c.If={}):32768===(c.mode&61440)?(c.Gf=P.Pf.file.node,c.Hf=P.Pf.file.stream,c.Kf=0,c.If=null):40960===(c.mode&61440)?(c.Gf=P.Pf.link.node,c.Hf=P.Pf.link.stream):8192===(c.mode&61440)&&(c.Gf=P.Pf.og.node,c.Hf=P.Pf.og.stream);c.timestamp=Date.now();a&&(a.If[b]=c,a.timestamp=c.timestamp);return c},Pg(a){return a.If?a.If.subarray?a.If.subarray(0,a.Kf):new Uint8Array(a.If):new Uint8Array(0)},Gf:{Of(a){var b={};b.Bg=8192===(a.mode&61440)?a.id:
|
||||
1;b.sg=a.id;b.mode=a.mode;b.Gg=1;b.uid=0;b.Dg=0;b.ag=a.ag;Q(a.mode)?b.size=4096:32768===(a.mode&61440)?b.size=a.Kf:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.xg=new Date(a.timestamp);b.Fg=new Date(a.timestamp);b.Ag=new Date(a.timestamp);b.yg=4096;b.zg=Math.ceil(b.size/b.yg);return b},Lf(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&(a.timestamp=b.timestamp);if(void 0!==b.size&&(b=b.size,a.Kf!=b))if(0==b)a.If=null,a.Kf=0;else{var c=a.If;a.If=new Uint8Array(b);c&&a.If.set(c.subarray(0,
|
||||
Math.min(b,a.Kf)));a.Kf=b}},Zf(){throw bb[44];},dg(a,b,c,e){return P.createNode(a,b,c,e)},vg(a,b,c){if(Q(a.mode)){try{var e=cb(b,c)}catch(h){}if(e)for(var f in e.If)throw new O(55);}delete a.parent.If[a.name];a.parent.timestamp=Date.now();a.name=c;b.If[c]=a;b.timestamp=a.parent.timestamp;a.parent=b},ig(a,b){delete a.If[b];a.timestamp=Date.now()},gg(a,b){var c=cb(a,b),e;for(e in c.If)throw new O(55);delete a.If[b];a.timestamp=Date.now()},ug(a){var b=[".",".."],c;for(c in a.If)a.If.hasOwnProperty(c)&&
|
||||
b.push(c);return b},hg(a,b,c){a=P.createNode(a,b,41471,0);a.link=c;return a},bg(a){if(40960!==(a.mode&61440))throw new O(28);return a.link}},Hf:{read(a,b,c,e,f){var h=a.node.If;if(f>=a.node.Kf)return 0;a=Math.min(a.node.Kf-f,e);if(8<a&&h.subarray)b.set(h.subarray(f,f+a),c);else for(e=0;e<a;e++)b[c+e]=h[f+e];return a},write(a,b,c,e,f,h){b.buffer===v.buffer&&(h=!1);if(!e)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.If||a.If.subarray)){if(h)return a.If=b.subarray(c,c+e),a.Kf=e;if(0===
|
||||
a.Kf&&0===f)return a.If=b.slice(c,c+e),a.Kf=e;if(f+e<=a.Kf)return a.If.set(b.subarray(c,c+e),f),e}Za(a,f+e);if(a.If.subarray&&b.subarray)a.If.set(b.subarray(c,c+e),f);else for(h=0;h<e;h++)a.If[f+h]=b[c+h];a.Kf=Math.max(a.Kf,f+e);return e},Uf(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.Kf);if(0>b)throw new O(28);return b},ng(a,b,c){Za(a.node,b+c);a.node.Kf=Math.max(a.node.Kf,b+c)},eg(a,b,c,e,f){if(32768!==(a.node.mode&61440))throw new O(43);a=a.node.If;if(f&2||a.buffer!==
|
||||
v.buffer){if(0<c||c+b<a.length)a.subarray?a=a.subarray(c,c+b):a=Array.prototype.slice.call(a,c,c+b);c=!0;b=65536*Math.ceil(b/65536);(f=db(65536,b))?(w.fill(0,f,f+b),b=f):b=0;if(!b)throw new O(48);v.set(a,b)}else c=!1,b=a.byteOffset;return{Hg:b,wg:c}},fg(a,b,c,e){P.Hf.write(a,b,0,e,c,!1);return 0}}},eb=(a,b)=>{var c=0;a&&(c|=365);b&&(c|=146);return c},fb=null,gb={},hb=[],ib=1,R=null,jb=!0,O=null,bb={};
|
||||
function S(a,b={}){a=Oa(a);if(!a)return{path:"",node:null};b=Object.assign({pg:!0,lg:0},b);if(8<b.lg)throw new O(32);a=a.split("/").filter(k=>!!k);for(var c=fb,e="/",f=0;f<a.length;f++){var h=f===a.length-1;if(h&&b.parent)break;c=cb(c,a[f]);e=N(e+"/"+a[f]);c.Wf&&(!h||h&&b.pg)&&(c=c.Wf.root);if(!h||b.Tf)for(h=0;40960===(c.mode&61440);)if(c=kb(e),e=Oa(Ka(e),c),c=S(e,{lg:b.lg+1}).node,40<h++)throw new O(32);}return{path:e,node:c}}
|
||||
function lb(a){for(var b;;){if(a===a.parent)return a=a.Qf.tg,b?"/"!==a[a.length-1]?`${a}/${b}`:a+b:a;b=b?`${a.name}/${b}`:a.name;a=a.parent}}function mb(a,b){for(var c=0,e=0;e<b.length;e++)c=(c<<5)-c+b.charCodeAt(e)|0;return(a+c>>>0)%R.length}function nb(a){var b=mb(a.parent.id,a.name);if(R[b]===a)R[b]=a.Xf;else for(b=R[b];b;){if(b.Xf===a){b.Xf=a.Xf;break}b=b.Xf}}
|
||||
function cb(a,b){var c;if(c=(c=ob(a,"x"))?c:a.Gf.Zf?0:2)throw new O(c,a);for(c=R[mb(a.id,b)];c;c=c.Xf){var e=c.name;if(c.parent.id===a.id&&e===b)return c}return a.Gf.Zf(a,b)}function ab(a,b,c,e){a=new pb(a,b,c,e);b=mb(a.parent.id,a.name);a.Xf=R[b];return R[b]=a}function Q(a){return 16384===(a&61440)}function qb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}
|
||||
function ob(a,b){if(jb)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function rb(a,b){try{return cb(a,b),20}catch(c){}return ob(a,"wx")}function sb(a,b,c){try{var e=cb(a,b)}catch(f){return f.Jf}if(a=ob(a,"wx"))return a;if(c){if(!Q(e.mode))return 54;if(e===e.parent||"/"===lb(e))return 10}else if(Q(e.mode))return 31;return 0}function tb(){for(var a=0;4096>=a;a++)if(!hb[a])return a;throw new O(33);}
|
||||
function T(a){a=hb[a];if(!a)throw new O(8);return a}function ub(a,b=-1){vb||(vb=function(){this.cg={}},vb.prototype={},Object.defineProperties(vb.prototype,{object:{get(){return this.node},set(c){this.node=c}},flags:{get(){return this.cg.flags},set(c){this.cg.flags=c}},position:{get(){return this.cg.position},set(c){this.cg.position=c}}}));a=Object.assign(new vb,a);-1==b&&(b=tb());a.Rf=b;return hb[b]=a}var $a={open(a){a.Hf=gb[a.node.ag].Hf;a.Hf.open&&a.Hf.open(a)},Uf(){throw new O(70);}};
|
||||
function Va(a,b){gb[a]={Hf:b}}function wb(a,b){var c="/"===b,e=!b;if(c&&fb)throw new O(10);if(!c&&!e){var f=S(b,{pg:!1});b=f.path;f=f.node;if(f.Wf)throw new O(10);if(!Q(f.mode))throw new O(54);}b={type:a,Ug:{},tg:b,Eg:[]};a=a.Qf(b);a.Qf=b;b.root=a;c?fb=a:f&&(f.Wf=b,f.Qf&&f.Qf.Eg.push(b))}function xb(a,b,c){var e=S(a,{parent:!0}).node;a=La(a);if(!a||"."===a||".."===a)throw new O(28);var f=rb(e,a);if(f)throw new O(f);if(!e.Gf.dg)throw new O(63);return e.Gf.dg(e,a,b,c)}
|
||||
function U(a,b){return xb(a,(void 0!==b?b:511)&1023|16384,0)}function yb(a,b,c){"undefined"==typeof c&&(c=b,b=438);xb(a,b|8192,c)}function zb(a,b){if(!Oa(a))throw new O(44);var c=S(b,{parent:!0}).node;if(!c)throw new O(44);b=La(b);var e=rb(c,b);if(e)throw new O(e);if(!c.Gf.hg)throw new O(63);c.Gf.hg(c,b,a)}function Ab(a){var b=S(a,{parent:!0}).node;a=La(a);var c=cb(b,a),e=sb(b,a,!0);if(e)throw new O(e);if(!b.Gf.gg)throw new O(63);if(c.Wf)throw new O(10);b.Gf.gg(b,a);nb(c)}
|
||||
function kb(a){a=S(a).node;if(!a)throw new O(44);if(!a.Gf.bg)throw new O(28);return Oa(lb(a.parent),a.Gf.bg(a))}function Bb(a,b){a=S(a,{Tf:!b}).node;if(!a)throw new O(44);if(!a.Gf.Of)throw new O(63);return a.Gf.Of(a)}function Cb(a){return Bb(a,!0)}function Db(a,b){a="string"==typeof a?S(a,{Tf:!0}).node:a;if(!a.Gf.Lf)throw new O(63);a.Gf.Lf(a,{mode:b&4095|a.mode&-4096,timestamp:Date.now()})}
|
||||
function Eb(a,b){if(0>b)throw new O(28);a="string"==typeof a?S(a,{Tf:!0}).node:a;if(!a.Gf.Lf)throw new O(63);if(Q(a.mode))throw new O(31);if(32768!==(a.mode&61440))throw new O(28);var c=ob(a,"w");if(c)throw new O(c);a.Gf.Lf(a,{size:b,timestamp:Date.now()})}
|
||||
function Fb(a,b,c){if(""===a)throw new O(44);if("string"==typeof b){var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[b];if("undefined"==typeof e)throw Error(`Unknown file open mode: ${b}`);b=e}c=b&64?("undefined"==typeof c?438:c)&4095|32768:0;if("object"==typeof a)var f=a;else{a=N(a);try{f=S(a,{Tf:!(b&131072)}).node}catch(h){}}e=!1;if(b&64)if(f){if(b&128)throw new O(20);}else f=xb(a,c,0),e=!0;if(!f)throw new O(44);8192===(f.mode&61440)&&(b&=-513);if(b&65536&&!Q(f.mode))throw new O(54);if(!e&&(c=
|
||||
f?40960===(f.mode&61440)?32:Q(f.mode)&&("r"!==qb(b)||b&512)?31:ob(f,qb(b)):44))throw new O(c);b&512&&!e&&Eb(f,0);b&=-131713;f=ub({node:f,path:lb(f),flags:b,seekable:!0,position:0,Hf:f.Hf,Jg:[],error:!1});f.Hf.open&&f.Hf.open(f);!d.logReadFiles||b&1||(Gb||(Gb={}),a in Gb||(Gb[a]=1));return f}function Hb(a,b,c){if(null===a.Rf)throw new O(8);if(!a.seekable||!a.Hf.Uf)throw new O(70);if(0!=c&&1!=c&&2!=c)throw new O(28);a.position=a.Hf.Uf(a,b,c);a.Jg=[]}
|
||||
function Ib(){O||(O=function(a,b){this.name="ErrnoError";this.node=b;this.Ig=function(c){this.Jf=c};this.Ig(a);this.message="FS error"},O.prototype=Error(),O.prototype.constructor=O,[44].forEach(a=>{bb[a]=new O(a);bb[a].stack="<generic error, no stack>"}))}var Jb;
|
||||
function Kb(a,b,c){a=N("/dev/"+a);var e=eb(!!b,!!c);Lb||(Lb=64);var f=Lb++<<8|0;Va(f,{open(h){h.seekable=!1},close(){c&&c.buffer&&c.buffer.length&&c(10)},read(h,k,n,l){for(var m=0,p=0;p<l;p++){try{var q=b()}catch(t){throw new O(29);}if(void 0===q&&0===m)throw new O(6);if(null===q||void 0===q)break;m++;k[n+p]=q}m&&(h.node.timestamp=Date.now());return m},write(h,k,n,l){for(var m=0;m<l;m++)try{c(k[n+m])}catch(p){throw new O(29);}l&&(h.node.timestamp=Date.now());return m}});yb(a,e,f)}var Lb,V={},vb,Gb;
|
||||
function Mb(a,b,c){if("/"===b.charAt(0))return b;a=-100===a?"/":T(a).path;if(0==b.length){if(!c)throw new O(44);return a}return N(a+"/"+b)}
|
||||
function Nb(a,b,c){try{var e=a(b)}catch(h){if(h&&h.node&&N(b)!==N(lb(h.node)))return-54;throw h;}y[c>>2]=e.Bg;y[c+4>>2]=e.mode;B[c+8>>2]=e.Gg;y[c+12>>2]=e.uid;y[c+16>>2]=e.Dg;y[c+20>>2]=e.ag;H=[e.size>>>0,(F=e.size,1<=+Math.abs(F)?0<F?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)];y[c+24>>2]=H[0];y[c+28>>2]=H[1];y[c+32>>2]=4096;y[c+36>>2]=e.zg;a=e.xg.getTime();b=e.Fg.getTime();var f=e.Ag.getTime();H=[Math.floor(a/1E3)>>>0,(F=Math.floor(a/1E3),1<=+Math.abs(F)?0<F?+Math.floor(F/
|
||||
var Pa=[],O=a=>{for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++c):b+=3}return b},Qa=(a,b,c,e)=>{if(!(0<e))return 0;var f=c;e=c+e-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var n=a.charCodeAt(++h);k=65536+((k&1023)<<10)|n&1023}if(127>=k){if(c>=e)break;b[c++]=k}else{if(2047>=k){if(c+1>=e)break;b[c++]=192|k>>6}else{if(65535>=k){if(c+2>=e)break;b[c++]=224|k>>12}else{if(c+3>=e)break;b[c++]=240|k>>18;b[c++]=128|k>>
|
||||
12&63}b[c++]=128|k>>6&63}b[c++]=128|k&63}}b[c]=0;return c-f};function Ra(a,b,c){c=Array(0<c?c:O(a)+1);a=Qa(a,c,0,c.length);b&&(c.length=a);return c}var Sa=[];function Ta(a,b){Sa[a]={input:[],Lf:[],Xf:b};Ua(a,Va)}
|
||||
var Va={open(a){var b=Sa[a.node.$f];if(!b)throw new P(43);a.Mf=b;a.seekable=!1},close(a){a.Mf.Xf.Uf(a.Mf)},Uf(a){a.Mf.Xf.Uf(a.Mf)},read(a,b,c,e){if(!a.Mf||!a.Mf.Xf.pg)throw new P(60);for(var f=0,h=0;h<e;h++){try{var k=a.Mf.Xf.pg(a.Mf)}catch(n){throw new P(29);}if(void 0===k&&0===f)throw new P(6);if(null===k||void 0===k)break;f++;b[c+h]=k}f&&(a.node.timestamp=Date.now());return f},write(a,b,c,e){if(!a.Mf||!a.Mf.Xf.jg)throw new P(60);try{for(var f=0;f<e;f++)a.Mf.Xf.jg(a.Mf,b[c+f])}catch(h){throw new P(29);
|
||||
}e&&(a.node.timestamp=Date.now());return f}},Wa={pg(){a:{if(!Pa.length){var a=null;"undefined"!=typeof window&&"function"==typeof window.prompt?(a=window.prompt("Input: "),null!==a&&(a+="\n")):"function"==typeof readline&&(a=readline(),null!==a&&(a+="\n"));if(!a){a=null;break a}Pa=Ra(a,!0)}a=Pa.shift()}return a},jg(a,b){null===b||10===b?(ka(M(a.Lf,0)),a.Lf=[]):0!=b&&a.Lf.push(b)},Uf(a){a.Lf&&0<a.Lf.length&&(ka(M(a.Lf,0)),a.Lf=[])},Pg(){return{Lg:25856,Ng:5,Kg:191,Mg:35387,Jg:[3,28,127,21,4,0,1,0,
|
||||
17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},Qg(){return 0},Rg(){return[24,80]}},Xa={jg(a,b){null===b||10===b?(r(M(a.Lf,0)),a.Lf=[]):0!=b&&a.Lf.push(b)},Uf(a){a.Lf&&0<a.Lf.length&&(r(M(a.Lf,0)),a.Lf=[])}};function Ya(a,b){var c=a.Hf?a.Hf.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Hf,a.Hf=new Uint8Array(b),0<a.Jf&&a.Hf.set(c.subarray(0,a.Jf),0))}
|
||||
var Q={Of:null,Pf(){return Q.createNode(null,"/",16895,0)},createNode(a,b,c,e){if(24576===(c&61440)||4096===(c&61440))throw new P(63);Q.Of||(Q.Of={dir:{node:{Nf:Q.Ff.Nf,Kf:Q.Ff.Kf,Yf:Q.Ff.Yf,cg:Q.Ff.cg,ug:Q.Ff.ug,hg:Q.Ff.hg,fg:Q.Ff.fg,tg:Q.Ff.tg,gg:Q.Ff.gg},stream:{Tf:Q.Gf.Tf}},file:{node:{Nf:Q.Ff.Nf,Kf:Q.Ff.Kf},stream:{Tf:Q.Gf.Tf,read:Q.Gf.read,write:Q.Gf.write,mg:Q.Gf.mg,dg:Q.Gf.dg,eg:Q.Gf.eg}},link:{node:{Nf:Q.Ff.Nf,Kf:Q.Ff.Kf,ag:Q.Ff.ag},stream:{}},ng:{node:{Nf:Q.Ff.Nf,Kf:Q.Ff.Kf},stream:Za}});
|
||||
c=$a(a,b,c,e);R(c.mode)?(c.Ff=Q.Of.dir.node,c.Gf=Q.Of.dir.stream,c.Hf={}):32768===(c.mode&61440)?(c.Ff=Q.Of.file.node,c.Gf=Q.Of.file.stream,c.Jf=0,c.Hf=null):40960===(c.mode&61440)?(c.Ff=Q.Of.link.node,c.Gf=Q.Of.link.stream):8192===(c.mode&61440)&&(c.Ff=Q.Of.ng.node,c.Gf=Q.Of.ng.stream);c.timestamp=Date.now();a&&(a.Hf[b]=c,a.timestamp=c.timestamp);return c},Og(a){return a.Hf?a.Hf.subarray?a.Hf.subarray(0,a.Jf):new Uint8Array(a.Hf):new Uint8Array(0)},Ff:{Nf(a){var b={};b.Ag=8192===(a.mode&61440)?a.id:
|
||||
1;b.rg=a.id;b.mode=a.mode;b.Fg=1;b.uid=0;b.Cg=0;b.$f=a.$f;R(a.mode)?b.size=4096:32768===(a.mode&61440)?b.size=a.Jf:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.wg=new Date(a.timestamp);b.Eg=new Date(a.timestamp);b.zg=new Date(a.timestamp);b.xg=4096;b.yg=Math.ceil(b.size/b.xg);return b},Kf(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&(a.timestamp=b.timestamp);if(void 0!==b.size&&(b=b.size,a.Jf!=b))if(0==b)a.Hf=null,a.Jf=0;else{var c=a.Hf;a.Hf=new Uint8Array(b);c&&a.Hf.set(c.subarray(0,
|
||||
Math.min(b,a.Jf)));a.Jf=b}},Yf(){throw ab[44];},cg(a,b,c,e){return Q.createNode(a,b,c,e)},ug(a,b,c){if(R(a.mode)){try{var e=bb(b,c)}catch(h){}if(e)for(var f in e.Hf)throw new P(55);}delete a.parent.Hf[a.name];a.parent.timestamp=Date.now();a.name=c;b.Hf[c]=a;b.timestamp=a.parent.timestamp;a.parent=b},hg(a,b){delete a.Hf[b];a.timestamp=Date.now()},fg(a,b){var c=bb(a,b),e;for(e in c.Hf)throw new P(55);delete a.Hf[b];a.timestamp=Date.now()},tg(a){var b=[".",".."],c;for(c in a.Hf)a.Hf.hasOwnProperty(c)&&
|
||||
b.push(c);return b},gg(a,b,c){a=Q.createNode(a,b,41471,0);a.link=c;return a},ag(a){if(40960!==(a.mode&61440))throw new P(28);return a.link}},Gf:{read(a,b,c,e,f){var h=a.node.Hf;if(f>=a.node.Jf)return 0;a=Math.min(a.node.Jf-f,e);if(8<a&&h.subarray)b.set(h.subarray(f,f+a),c);else for(e=0;e<a;e++)b[c+e]=h[f+e];return a},write(a,b,c,e,f,h){b.buffer===v.buffer&&(h=!1);if(!e)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.Hf||a.Hf.subarray)){if(h)return a.Hf=b.subarray(c,c+e),a.Jf=e;if(0===
|
||||
a.Jf&&0===f)return a.Hf=b.slice(c,c+e),a.Jf=e;if(f+e<=a.Jf)return a.Hf.set(b.subarray(c,c+e),f),e}Ya(a,f+e);if(a.Hf.subarray&&b.subarray)a.Hf.set(b.subarray(c,c+e),f);else for(h=0;h<e;h++)a.Hf[f+h]=b[c+h];a.Jf=Math.max(a.Jf,f+e);return e},Tf(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.Jf);if(0>b)throw new P(28);return b},mg(a,b,c){Ya(a.node,b+c);a.node.Jf=Math.max(a.node.Jf,b+c)},dg(a,b,c,e,f){if(32768!==(a.node.mode&61440))throw new P(43);a=a.node.Hf;if(f&2||a.buffer!==
|
||||
v.buffer){if(0<c||c+b<a.length)a.subarray?a=a.subarray(c,c+b):a=Array.prototype.slice.call(a,c,c+b);c=!0;b=65536*Math.ceil(b/65536);(f=cb(65536,b))?(w.fill(0,f,f+b),b=f):b=0;if(!b)throw new P(48);v.set(a,b)}else c=!1,b=a.byteOffset;return{Gg:b,vg:c}},eg(a,b,c,e){Q.Gf.write(a,b,0,e,c,!1);return 0}}},db=(a,b)=>{var c=0;a&&(c|=365);b&&(c|=146);return c},eb=null,fb={},gb=[],hb=1,S=null,ib=!0,P=null,ab={};
|
||||
function T(a,b={}){a=Oa(a);if(!a)return{path:"",node:null};b=Object.assign({og:!0,kg:0},b);if(8<b.kg)throw new P(32);a=a.split("/").filter(k=>!!k);for(var c=eb,e="/",f=0;f<a.length;f++){var h=f===a.length-1;if(h&&b.parent)break;c=bb(c,a[f]);e=N(e+"/"+a[f]);c.Vf&&(!h||h&&b.og)&&(c=c.Vf.root);if(!h||b.Sf)for(h=0;40960===(c.mode&61440);)if(c=jb(e),e=Oa(Ka(e),c),c=T(e,{kg:b.kg+1}).node,40<h++)throw new P(32);}return{path:e,node:c}}
|
||||
function kb(a){for(var b;;){if(a===a.parent)return a=a.Pf.sg,b?"/"!==a[a.length-1]?`${a}/${b}`:a+b:a;b=b?`${a.name}/${b}`:a.name;a=a.parent}}function lb(a,b){for(var c=0,e=0;e<b.length;e++)c=(c<<5)-c+b.charCodeAt(e)|0;return(a+c>>>0)%S.length}function mb(a){var b=lb(a.parent.id,a.name);if(S[b]===a)S[b]=a.Wf;else for(b=S[b];b;){if(b.Wf===a){b.Wf=a.Wf;break}b=b.Wf}}
|
||||
function bb(a,b){var c;if(c=(c=nb(a,"x"))?c:a.Ff.Yf?0:2)throw new P(c,a);for(c=S[lb(a.id,b)];c;c=c.Wf){var e=c.name;if(c.parent.id===a.id&&e===b)return c}return a.Ff.Yf(a,b)}function $a(a,b,c,e){a=new ob(a,b,c,e);b=lb(a.parent.id,a.name);a.Wf=S[b];return S[b]=a}function R(a){return 16384===(a&61440)}function pb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}
|
||||
function nb(a,b){if(ib)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function qb(a,b){try{return bb(a,b),20}catch(c){}return nb(a,"wx")}function rb(a,b,c){try{var e=bb(a,b)}catch(f){return f.If}if(a=nb(a,"wx"))return a;if(c){if(!R(e.mode))return 54;if(e===e.parent||"/"===kb(e))return 10}else if(R(e.mode))return 31;return 0}function sb(){for(var a=0;4096>=a;a++)if(!gb[a])return a;throw new P(33);}
|
||||
function U(a){a=gb[a];if(!a)throw new P(8);return a}function tb(a,b=-1){ub||(ub=function(){this.bg={}},ub.prototype={},Object.defineProperties(ub.prototype,{object:{get(){return this.node},set(c){this.node=c}},flags:{get(){return this.bg.flags},set(c){this.bg.flags=c}},position:{get(){return this.bg.position},set(c){this.bg.position=c}}}));a=Object.assign(new ub,a);-1==b&&(b=sb());a.Qf=b;return gb[b]=a}var Za={open(a){a.Gf=fb[a.node.$f].Gf;a.Gf.open&&a.Gf.open(a)},Tf(){throw new P(70);}};
|
||||
function Ua(a,b){fb[a]={Gf:b}}function vb(a,b){var c="/"===b,e=!b;if(c&&eb)throw new P(10);if(!c&&!e){var f=T(b,{og:!1});b=f.path;f=f.node;if(f.Vf)throw new P(10);if(!R(f.mode))throw new P(54);}b={type:a,Tg:{},sg:b,Dg:[]};a=a.Pf(b);a.Pf=b;b.root=a;c?eb=a:f&&(f.Vf=b,f.Pf&&f.Pf.Dg.push(b))}function wb(a,b,c){var e=T(a,{parent:!0}).node;a=La(a);if(!a||"."===a||".."===a)throw new P(28);var f=qb(e,a);if(f)throw new P(f);if(!e.Ff.cg)throw new P(63);return e.Ff.cg(e,a,b,c)}
|
||||
function W(a,b){return wb(a,(void 0!==b?b:511)&1023|16384,0)}function xb(a,b,c){"undefined"==typeof c&&(c=b,b=438);wb(a,b|8192,c)}function yb(a,b){if(!Oa(a))throw new P(44);var c=T(b,{parent:!0}).node;if(!c)throw new P(44);b=La(b);var e=qb(c,b);if(e)throw new P(e);if(!c.Ff.gg)throw new P(63);c.Ff.gg(c,b,a)}function zb(a){var b=T(a,{parent:!0}).node;a=La(a);var c=bb(b,a),e=rb(b,a,!0);if(e)throw new P(e);if(!b.Ff.fg)throw new P(63);if(c.Vf)throw new P(10);b.Ff.fg(b,a);mb(c)}
|
||||
function jb(a){a=T(a).node;if(!a)throw new P(44);if(!a.Ff.ag)throw new P(28);return Oa(kb(a.parent),a.Ff.ag(a))}function Ab(a,b){a=T(a,{Sf:!b}).node;if(!a)throw new P(44);if(!a.Ff.Nf)throw new P(63);return a.Ff.Nf(a)}function Bb(a){return Ab(a,!0)}function Cb(a,b){a="string"==typeof a?T(a,{Sf:!0}).node:a;if(!a.Ff.Kf)throw new P(63);a.Ff.Kf(a,{mode:b&4095|a.mode&-4096,timestamp:Date.now()})}
|
||||
function Db(a,b){if(0>b)throw new P(28);a="string"==typeof a?T(a,{Sf:!0}).node:a;if(!a.Ff.Kf)throw new P(63);if(R(a.mode))throw new P(31);if(32768!==(a.mode&61440))throw new P(28);var c=nb(a,"w");if(c)throw new P(c);a.Ff.Kf(a,{size:b,timestamp:Date.now()})}
|
||||
function Eb(a,b,c){if(""===a)throw new P(44);if("string"==typeof b){var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[b];if("undefined"==typeof e)throw Error(`Unknown file open mode: ${b}`);b=e}c=b&64?("undefined"==typeof c?438:c)&4095|32768:0;if("object"==typeof a)var f=a;else{a=N(a);try{f=T(a,{Sf:!(b&131072)}).node}catch(h){}}e=!1;if(b&64)if(f){if(b&128)throw new P(20);}else f=wb(a,c,0),e=!0;if(!f)throw new P(44);8192===(f.mode&61440)&&(b&=-513);if(b&65536&&!R(f.mode))throw new P(54);if(!e&&(c=
|
||||
f?40960===(f.mode&61440)?32:R(f.mode)&&("r"!==pb(b)||b&512)?31:nb(f,pb(b)):44))throw new P(c);b&512&&!e&&Db(f,0);b&=-131713;f=tb({node:f,path:kb(f),flags:b,seekable:!0,position:0,Gf:f.Gf,Ig:[],error:!1});f.Gf.open&&f.Gf.open(f);!d.logReadFiles||b&1||(Fb||(Fb={}),a in Fb||(Fb[a]=1));return f}function Gb(a,b,c){if(null===a.Qf)throw new P(8);if(!a.seekable||!a.Gf.Tf)throw new P(70);if(0!=c&&1!=c&&2!=c)throw new P(28);a.position=a.Gf.Tf(a,b,c);a.Ig=[]}
|
||||
function Hb(){P||(P=function(a,b){this.name="ErrnoError";this.node=b;this.Hg=function(c){this.If=c};this.Hg(a);this.message="FS error"},P.prototype=Error(),P.prototype.constructor=P,[44].forEach(a=>{ab[a]=new P(a);ab[a].stack="<generic error, no stack>"}))}var Ib;
|
||||
function Jb(a,b,c){a=N("/dev/"+a);var e=db(!!b,!!c);Kb||(Kb=64);var f=Kb++<<8|0;Ua(f,{open(h){h.seekable=!1},close(){c&&c.buffer&&c.buffer.length&&c(10)},read(h,k,n,l){for(var m=0,p=0;p<l;p++){try{var q=b()}catch(t){throw new P(29);}if(void 0===q&&0===m)throw new P(6);if(null===q||void 0===q)break;m++;k[n+p]=q}m&&(h.node.timestamp=Date.now());return m},write(h,k,n,l){for(var m=0;m<l;m++)try{c(k[n+m])}catch(p){throw new P(29);}l&&(h.node.timestamp=Date.now());return m}});xb(a,e,f)}var Kb,X={},ub,Fb;
|
||||
function Lb(a,b,c){if("/"===b.charAt(0))return b;a=-100===a?"/":U(a).path;if(0==b.length){if(!c)throw new P(44);return a}return N(a+"/"+b)}
|
||||
function Mb(a,b,c){try{var e=a(b)}catch(h){if(h&&h.node&&N(b)!==N(kb(h.node)))return-54;throw h;}y[c>>2]=e.Ag;y[c+4>>2]=e.mode;B[c+8>>2]=e.Fg;y[c+12>>2]=e.uid;y[c+16>>2]=e.Cg;y[c+20>>2]=e.$f;H=[e.size>>>0,(F=e.size,1<=+Math.abs(F)?0<F?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)];y[c+24>>2]=H[0];y[c+28>>2]=H[1];y[c+32>>2]=4096;y[c+36>>2]=e.yg;a=e.wg.getTime();b=e.Eg.getTime();var f=e.zg.getTime();H=[Math.floor(a/1E3)>>>0,(F=Math.floor(a/1E3),1<=+Math.abs(F)?0<F?+Math.floor(F/
|
||||
4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)];y[c+40>>2]=H[0];y[c+44>>2]=H[1];B[c+48>>2]=a%1E3*1E3;H=[Math.floor(b/1E3)>>>0,(F=Math.floor(b/1E3),1<=+Math.abs(F)?0<F?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)];y[c+56>>2]=H[0];y[c+60>>2]=H[1];B[c+64>>2]=b%1E3*1E3;H=[Math.floor(f/1E3)>>>0,(F=Math.floor(f/1E3),1<=+Math.abs(F)?0<F?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)];y[c+72>>2]=H[0];y[c+76>>2]=H[1];B[c+80>>2]=
|
||||
f%1E3*1E3;H=[e.sg>>>0,(F=e.sg,1<=+Math.abs(F)?0<F?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)];y[c+88>>2]=H[0];y[c+92>>2]=H[1];return 0}var Ob=void 0;function Pb(){var a=y[+Ob>>2];Ob+=4;return a}
|
||||
var Qb=(a,b)=>b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN,Rb=[0,31,60,91,121,152,182,213,244,274,305,335],Sb=[0,31,59,90,120,151,181,212,243,273,304,334],Ub=a=>{var b=Qa(a)+1,c=Tb(b);c&&Ra(a,w,c,b);return c},Vb={},Xb=()=>{if(!Wb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:da||"./this.program"},b;for(b in Vb)void 0===Vb[b]?delete a[b]:a[b]=Vb[b];
|
||||
var c=[];for(b in a)c.push(`${b}=${a[b]}`);Wb=c}return Wb},Wb;function Yb(){}function Zb(){}function $b(){}function ac(){}function bc(){}function cc(){}function dc(){}function ec(){}function fc(){}function gc(){}function hc(){}function ic(){}function jc(){}function kc(){}function lc(){}function mc(){}function nc(){}function oc(){}function pc(){}function qc(){}function rc(){}function sc(){}function tc(){}function uc(){}function vc(){}function wc(){}function xc(){}function yc(){}function zc(){}
|
||||
function Ac(){}function Bc(){}function Cc(){}function Dc(){}function Ec(){}function Fc(){}function Gc(){}function Hc(){}function Ic(){}function Jc(){}
|
||||
var Kc=[],X,Lc,Mc=[],Y=(a,b,c,e)=>{var f={string:m=>{var p=0;if(null!==m&&void 0!==m&&0!==m){p=Qa(m)+1;var q=Nc(p);Ra(m,w,q,p);p=q}return p},array:m=>{var p=Nc(m.length);v.set(m,p);return p}};a=d["_"+a];var h=[],k=0;if(e)for(var n=0;n<e.length;n++){var l=f[c[n]];l?(0===k&&(k=Oc()),h[n]=l(e[n])):h[n]=e[n]}c=a.apply(null,h);return c=function(m){0!==k&&Pc(k);return"string"===b?m?M(w,m):"":"boolean"===b?!!m:m}(c)},Qc="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||
function pb(a,b,c,e){a||(a=this);this.parent=a;this.Qf=a.Qf;this.Wf=null;this.id=ib++;this.name=b;this.mode=c;this.Gf={};this.Hf={};this.ag=e}Object.defineProperties(pb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});Ib();R=Array(4096);wb(P,"/");U("/tmp");U("/home");U("/home/web_user");
|
||||
(function(){U("/dev");Va(259,{read:()=>0,write:(e,f,h,k)=>k});yb("/dev/null",259);Ua(1280,Xa);Ua(1536,Ya);yb("/dev/tty",1280);yb("/dev/tty1",1536);var a=new Uint8Array(1024),b=0,c=()=>{0===b&&(b=Na(a).byteLength);return a[--b]};Kb("random",c);Kb("urandom",c);U("/dev/shm");U("/dev/shm/tmp")})();
|
||||
(function(){U("/proc");var a=U("/proc/self");U("/proc/self/fd");wb({Qf(){var b=ab(a,"fd",16895,73);b.Gf={Zf(c,e){var f=T(+e);c={parent:null,Qf:{tg:"fake"},Gf:{bg:()=>f.path}};return c.parent=c}};return b}},"/proc/self/fd")})();
|
||||
(function(){const a=new Map;d.setAuthorizer=function(b,c,e){c?a.set(b,{f:c,mg:e}):a.delete(b);return Y("set_authorizer","number",["number"],[b])};Yb=function(b,c,e,f,h,k){if(a.has(b)){const {f:n,mg:l}=a.get(b);return n(l,c,e?e?M(w,e):"":null,f?f?M(w,f):"":null,h?h?M(w,h):"":null,k?k?M(w,k):"":null)}return 0}})();
|
||||
(function(){const a=new Map,b=new Map;d.createFunction=function(c,e,f,h,k,n){const l=a.size;a.set(l,{f:n,Sf:k});return Y("create_function","number","number string number number number number".split(" "),[c,e,f,h,l,0])};d.createAggregate=function(c,e,f,h,k,n,l){const m=a.size;a.set(m,{step:n,Cg:l,Sf:k});return Y("create_function","number","number string number number number number".split(" "),[c,e,f,h,m,1])};d.getFunctionUserData=function(c){return b.get(c)};$b=function(c,e,f,h){c=a.get(c);b.set(e,
|
||||
c.Sf);c.f(e,new Uint32Array(w.buffer,h,f));b.delete(e)};bc=function(c,e,f,h){c=a.get(c);b.set(e,c.Sf);c.step(e,new Uint32Array(w.buffer,h,f));b.delete(e)};Zb=function(c,e){c=a.get(c);b.set(e,c.Sf);c.Cg(e);b.delete(e)}})();(function(){const a=new Map;d.progressHandler=function(b,c,e,f){e?a.set(b,{f:e,mg:f}):a.delete(b);return Y("progress_handler",null,["number","number"],[b,c])};ac=function(b){if(a.has(b)){const {f:c,mg:e}=a.get(b);return c(e)}return 0}})();
|
||||
f%1E3*1E3;H=[e.rg>>>0,(F=e.rg,1<=+Math.abs(F)?0<F?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)];y[c+88>>2]=H[0];y[c+92>>2]=H[1];return 0}var Nb=void 0;function Ob(){var a=y[+Nb>>2];Nb+=4;return a}
|
||||
var Pb=(a,b)=>b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN,Qb=[0,31,60,91,121,152,182,213,244,274,305,335],Rb=[0,31,59,90,120,151,181,212,243,273,304,334],Tb=a=>{var b=O(a)+1,c=Sb(b);c&&Qa(a,w,c,b);return c},Ub={},Wb=()=>{if(!Vb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:da||"./this.program"},b;for(b in Ub)void 0===Ub[b]?delete a[b]:a[b]=Ub[b];
|
||||
var c=[];for(b in a)c.push(`${b}=${a[b]}`);Vb=c}return Vb},Vb;function Xb(){}function Yb(){}function Zb(){}function $b(){}function ac(){}function bc(){}function cc(){}function dc(){}function ec(){}function fc(){}function gc(){}function hc(){}function ic(){}function jc(){}function kc(){}function lc(){}function mc(){}function nc(){}function oc(){}function pc(){}function qc(){}function rc(){}function sc(){}function tc(){}function uc(){}function vc(){}function wc(){}function xc(){}function yc(){}
|
||||
function zc(){}function Ac(){}function Bc(){}function Cc(){}function Dc(){}function Ec(){}function Fc(){}function Gc(){}function Hc(){}function Ic(){}
|
||||
var Jc,Kc,Lc=[],Y=(a,b,c,e)=>{var f={string:m=>{var p=0;if(null!==m&&void 0!==m&&0!==m){p=O(m)+1;var q=Mc(p);Qa(m,w,q,p);p=q}return p},array:m=>{var p=Mc(m.length);v.set(m,p);return p}};a=d["_"+a];var h=[],k=0;if(e)for(var n=0;n<e.length;n++){var l=f[c[n]];l?(0===k&&(k=Nc()),h[n]=l(e[n])):h[n]=e[n]}c=a.apply(null,h);return c=function(m){0!==k&&Oc(k);return"string"===b?m?M(w,m):"":"boolean"===b?!!m:m}(c)},Pc="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||
function ob(a,b,c,e){a||(a=this);this.parent=a;this.Pf=a.Pf;this.Vf=null;this.id=hb++;this.name=b;this.mode=c;this.Ff={};this.Gf={};this.$f=e}Object.defineProperties(ob.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});Hb();S=Array(4096);vb(Q,"/");W("/tmp");W("/home");W("/home/web_user");
|
||||
(function(){W("/dev");Ua(259,{read:()=>0,write:(e,f,h,k)=>k});xb("/dev/null",259);Ta(1280,Wa);Ta(1536,Xa);xb("/dev/tty",1280);xb("/dev/tty1",1536);var a=new Uint8Array(1024),b=0,c=()=>{0===b&&(b=Na(a).byteLength);return a[--b]};Jb("random",c);Jb("urandom",c);W("/dev/shm");W("/dev/shm/tmp")})();
|
||||
(function(){W("/proc");var a=W("/proc/self");W("/proc/self/fd");vb({Pf(){var b=$a(a,"fd",16895,73);b.Ff={Yf(c,e){var f=U(+e);c={parent:null,Pf:{sg:"fake"},Ff:{ag:()=>f.path}};return c.parent=c}};return b}},"/proc/self/fd")})();
|
||||
(function(){const a=new Map;d.setAuthorizer=function(b,c,e){c?a.set(b,{f:c,lg:e}):a.delete(b);return Y("set_authorizer","number",["number"],[b])};Xb=function(b,c,e,f,h,k){if(a.has(b)){const {f:n,lg:l}=a.get(b);return n(l,c,e?e?M(w,e):"":null,f?f?M(w,f):"":null,h?h?M(w,h):"":null,k?k?M(w,k):"":null)}return 0}})();
|
||||
(function(){const a=new Map,b=new Map;d.createFunction=function(c,e,f,h,k,n){const l=a.size;a.set(l,{f:n,Rf:k});return Y("create_function","number","number string number number number number".split(" "),[c,e,f,h,l,0])};d.createAggregate=function(c,e,f,h,k,n,l){const m=a.size;a.set(m,{step:n,Bg:l,Rf:k});return Y("create_function","number","number string number number number number".split(" "),[c,e,f,h,m,1])};d.getFunctionUserData=function(c){return b.get(c)};Zb=function(c,e,f,h){c=a.get(c);b.set(e,
|
||||
c.Rf);c.f(e,new Uint32Array(w.buffer,h,f));b.delete(e)};ac=function(c,e,f,h){c=a.get(c);b.set(e,c.Rf);c.step(e,new Uint32Array(w.buffer,h,f));b.delete(e)};Yb=function(c,e){c=a.get(c);b.set(e,c.Rf);c.Bg(e);b.delete(e)}})();(function(){const a=new Map;d.progressHandler=function(b,c,e,f){e?a.set(b,{f:e,lg:f}):a.delete(b);return Y("progress_handler",null,["number","number"],[b,c])};$b=function(b){if(a.has(b)){const {f:c,lg:e}=a.get(b);return c(e)}return 0}})();
|
||||
(function(){function a(l,m){const p=`get${l}`,q=`set${l}`;return new Proxy(new DataView(w.buffer,m,"Int32"===l?4:8),{get(t,z){if(z===p)return function(A,G){if(!G)throw Error("must be little endian");return t[z](A,G)};if(z===q)return function(A,G,E){if(!E)throw Error("must be little endian");return t[z](A,G,E)};if("string"===typeof z&&z.match(/^(get)|(set)/))throw Error("invalid type");return t[z]}})}const b="object"===typeof Asyncify,c=new Map,e=new Map,f=new Map,h=b?new Set:null,k=b?new Set:null,
|
||||
n=new Map;sc=function(l,m,p,q){n.set(l?M(w,l):"",{size:m,$f:Array.from(new Uint32Array(w.buffer,q,p))})};d.createModule=function(l,m,p,q){b&&(p.handleAsync=Asyncify.rg);const t=c.size;c.set(t,{module:p,Sf:q});q=0;p.xCreate&&(q|=1);p.xConnect&&(q|=2);p.xBestIndex&&(q|=4);p.xDisconnect&&(q|=8);p.xDestroy&&(q|=16);p.xOpen&&(q|=32);p.xClose&&(q|=64);p.xFilter&&(q|=128);p.xNext&&(q|=256);p.xEof&&(q|=512);p.xColumn&&(q|=1024);p.xRowid&&(q|=2048);p.xUpdate&&(q|=4096);p.xBegin&&(q|=8192);p.xSync&&(q|=16384);
|
||||
p.xCommit&&(q|=32768);p.xRollback&&(q|=65536);p.xFindFunction&&(q|=131072);p.xRename&&(q|=262144);return Y("create_module","number",["number","string","number","number"],[l,m,t,q])};ic=function(l,m,p,q,t,z){m=c.get(m);e.set(t,m);if(b){h.delete(t);for(const A of h)e.delete(A)}q=Array.from(new Uint32Array(w.buffer,q,p)).map(A=>A?M(w,A):"");return m.module.xCreate(l,m.Sf,q,t,a("Int32",z))};hc=function(l,m,p,q,t,z){m=c.get(m);e.set(t,m);if(b){h.delete(t);for(const A of h)e.delete(A)}q=Array.from(new Uint32Array(w.buffer,
|
||||
q,p)).map(A=>A?M(w,A):"");return m.module.xConnect(l,m.Sf,q,t,a("Int32",z))};dc=function(l,m){var p=e.get(l),q=n.get("sqlite3_index_info").$f;const t={};t.nConstraint=J(m+q[0],"i32");t.aConstraint=[];var z=J(m+q[1],"*"),A=n.get("sqlite3_index_constraint").size;for(var G=0;G<t.nConstraint;++G){var E=t.aConstraint,L=E.push,I=z+G*A,ia=n.get("sqlite3_index_constraint").$f,W={};W.iColumn=J(I+ia[0],"i32");W.op=J(I+ia[1],"i8");W.usable=!!J(I+ia[2],"i8");L.call(E,W)}t.nOrderBy=J(m+q[2],"i32");t.aOrderBy=
|
||||
[];z=J(m+q[3],"*");A=n.get("sqlite3_index_orderby").size;for(G=0;G<t.nOrderBy;++G)E=t.aOrderBy,L=E.push,I=z+G*A,ia=n.get("sqlite3_index_orderby").$f,W={},W.iColumn=J(I+ia[0],"i32"),W.desc=!!J(I+ia[1],"i8"),L.call(E,W);t.aConstraintUsage=[];for(z=0;z<t.nConstraint;++z)t.aConstraintUsage.push({argvIndex:0,omit:!1});t.idxNum=J(m+q[5],"i32");t.idxStr=null;t.orderByConsumed=!!J(m+q[8],"i8");t.estimatedCost=J(m+q[9],"double");t.estimatedRows=J(m+q[10],"i32");t.idxFlags=J(m+q[11],"i32");t.colUsed=J(m+q[12],
|
||||
"i32");l=p.module.xBestIndex(l,t);p=n.get("sqlite3_index_info").$f;q=J(m+p[4],"*");z=n.get("sqlite3_index_constraint_usage").size;for(L=0;L<t.nConstraint;++L)A=q+L*z,E=t.aConstraintUsage[L],I=n.get("sqlite3_index_constraint_usage").$f,K(A+I[0],E.argvIndex,"i32"),K(A+I[1],E.omit?1:0,"i8");K(m+p[5],t.idxNum,"i32");"string"===typeof t.idxStr&&(q=Qa(t.idxStr),z=Y("sqlite3_malloc","number",["number"],[q+1]),Ra(t.idxStr,w,z,q+1),K(m+p[6],z,"*"),K(m+p[7],1,"i32"));K(m+p[8],t.orderByConsumed,"i32");K(m+p[9],
|
||||
t.estimatedCost,"double");K(m+p[10],t.estimatedRows,"i32");K(m+p[11],t.idxFlags,"i32");return l};kc=function(l){const m=e.get(l);b?h.add(l):e.delete(l);return m.module.xDisconnect(l)};jc=function(l){const m=e.get(l);b?h.add(l):e.delete(l);return m.module.xDestroy(l)};oc=function(l,m){const p=e.get(l);f.set(m,p);if(b){k.delete(m);for(const q of k)f.delete(q)}return p.module.xOpen(l,m)};ec=function(l){const m=f.get(l);b?k.add(l):f.delete(l);return m.module.xClose(l)};lc=function(l){return f.get(l).module.xEof(l)?
|
||||
1:0};mc=function(l,m,p,q,t){const z=f.get(l);p=p?p?M(w,p):"":null;t=new Uint32Array(w.buffer,t,q);return z.module.xFilter(l,m,p,t)};nc=function(l){return f.get(l).module.xNext(l)};fc=function(l,m,p){return f.get(l).module.xColumn(l,m,p)};rc=function(l,m){return f.get(l).module.xRowid(l,a("BigInt64",m))};uc=function(l,m,p,q){const t=e.get(l);p=new Uint32Array(w.buffer,p,m);return t.module.xUpdate(l,p,a("BigInt64",q))};cc=function(l){return e.get(l).module.xBegin(l)};tc=function(l){return e.get(l).module.xSync(l)};
|
||||
gc=function(l){return e.get(l).module.xCommit(l)};qc=function(l){return e.get(l).module.xRollback(l)};pc=function(l,m){const p=e.get(l);m=m?M(w,m):"";return p.module.xRename(l,m)}})();
|
||||
(function(){function a(h,k){const n=`get${h}`,l=`set${h}`;return new Proxy(new DataView(w.buffer,k,"Int32"===h?4:8),{get(m,p){if(p===n)return function(q,t){if(!t)throw Error("must be little endian");return m[p](q,t)};if(p===l)return function(q,t,z){if(!z)throw Error("must be little endian");return m[p](q,t,z)};if("string"===typeof p&&p.match(/^(get)|(set)/))throw Error("invalid type");return m[p]}})}const b="object"===typeof Asyncify;b&&(d.handleAsync=Asyncify.rg);const c=new Map,e=new Map;d.registerVFS=
|
||||
function(h,k){if(Y("sqlite3_vfs_find","number",["string"],[h.name]))throw Error(`VFS '${h.name}' already registered`);b&&(h.handleAsync=Asyncify.rg);var n=h.Tg??64;const l=d._malloc(4);k=Y("register_vfs","number",["string","number","number","number"],[h.name,n,k?1:0,l]);k||(n=J(l,"*"),c.set(n,h));d._free(l);return k};const f=b?new Set:null;xc=function(h){const k=e.get(h);b?f.add(h):e.delete(h);return k.xClose(h)};Ec=function(h,k,n,l,m){return e.get(h).xRead(h,w.subarray(k,k+n),4294967296*m+l+(0>l?
|
||||
2**32:0))};Jc=function(h,k,n,l,m){return e.get(h).xWrite(h,w.subarray(k,k+n),4294967296*m+l+(0>l?2**32:0))};Hc=function(h,k,n){return e.get(h).xTruncate(h,4294967296*n+k+(0>k?2**32:0))};Gc=function(h,k){return e.get(h).xSync(h,k)};Bc=function(h,k){const n=e.get(h);k=a("BigInt64",k);return n.xFileSize(h,k)};Cc=function(h,k){return e.get(h).xLock(h,k)};Ic=function(h,k){return e.get(h).xUnlock(h,k)};wc=function(h,k){const n=e.get(h);k=a("Int32",k);return n.xCheckReservedLock(h,k)};Ac=function(h,k,n){const l=
|
||||
e.get(h);n=new DataView(w.buffer,n);return l.xFileControl(h,k,n)};Fc=function(h){return e.get(h).xSectorSize(h)};zc=function(h){return e.get(h).xDeviceCharacteristics(h)};Dc=function(h,k,n,l,m){h=c.get(h);e.set(n,h);if(b){f.delete(n);for(var p of f)e.delete(p)}p=null;if(l&64){p=1;const q=[];for(;p;){const t=w[k++];if(t)q.push(t);else switch(w[k]||(p=null),p){case 1:q.push(63);p=2;break;case 2:q.push(61);p=3;break;case 3:q.push(38),p=2}}p=(new TextDecoder).decode(new Uint8Array(q))}else k&&(p=k?M(w,
|
||||
k):"");m=a("Int32",m);return h.xOpen(p,n,l,m)};yc=function(h,k,n){return c.get(h).xDelete(k?M(w,k):"",n)};vc=function(h,k,n,l){h=c.get(h);l=a("Int32",l);return h.xAccess(k?M(w,k):"",n,l)}})();
|
||||
var Sc={a:(a,b,c,e)=>{u(`Assertion failed: ${a?M(w,a):""}, at: `+[b?b?M(w,b):"":"unknown filename",c,e?e?M(w,e):"":"unknown function"])},P:function(a,b){try{return a=a?M(w,a):"",Db(a,b),0}catch(c){if("undefined"==typeof V||"ErrnoError"!==c.name)throw c;return-c.Jf}},S:function(a,b,c){try{b=b?M(w,b):"";b=Mb(a,b);if(c&-8)return-28;var e=S(b,{Tf:!0}).node;if(!e)return-44;a="";c&4&&(a+="r");c&2&&(a+="w");c&1&&(a+="x");return a&&ob(e,a)?-2:0}catch(f){if("undefined"==typeof V||"ErrnoError"!==f.name)throw f;
|
||||
return-f.Jf}},Q:function(a,b){try{var c=T(a);Db(c.node,b);return 0}catch(e){if("undefined"==typeof V||"ErrnoError"!==e.name)throw e;return-e.Jf}},O:function(a){try{var b=T(a).node;var c="string"==typeof b?S(b,{Tf:!0}).node:b;if(!c.Gf.Lf)throw new O(63);c.Gf.Lf(c,{timestamp:Date.now()});return 0}catch(e){if("undefined"==typeof V||"ErrnoError"!==e.name)throw e;return-e.Jf}},b:function(a,b,c){Ob=c;try{var e=T(a);switch(b){case 0:var f=Pb();if(0>f)return-28;for(;hb[f];)f++;return ub(e,f).Rf;case 1:case 2:return 0;
|
||||
case 3:return e.flags;case 4:return f=Pb(),e.flags|=f,0;case 5:return f=Pb(),x[f+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return y[Rc()>>2]=28,-1;default:return-28}}catch(h){if("undefined"==typeof V||"ErrnoError"!==h.name)throw h;return-h.Jf}},N:function(a,b){try{var c=T(a);return Nb(Bb,c.path,b)}catch(e){if("undefined"==typeof V||"ErrnoError"!==e.name)throw e;return-e.Jf}},n:function(a,b,c){b=Qb(b,c);try{if(isNaN(b))return 61;var e=T(a);if(0===(e.flags&2097155))throw new O(28);
|
||||
Eb(e.node,b);return 0}catch(f){if("undefined"==typeof V||"ErrnoError"!==f.name)throw f;return-f.Jf}},H:function(a,b){try{if(0===b)return-28;var c=Qa("/")+1;if(b<c)return-68;Ra("/",w,a,b);return c}catch(e){if("undefined"==typeof V||"ErrnoError"!==e.name)throw e;return-e.Jf}},L:function(a,b){try{return a=a?M(w,a):"",Nb(Cb,a,b)}catch(c){if("undefined"==typeof V||"ErrnoError"!==c.name)throw c;return-c.Jf}},E:function(a,b,c){try{return b=b?M(w,b):"",b=Mb(a,b),b=N(b),"/"===b[b.length-1]&&(b=b.substr(0,
|
||||
b.length-1)),U(b,c),0}catch(e){if("undefined"==typeof V||"ErrnoError"!==e.name)throw e;return-e.Jf}},J:function(a,b,c,e){try{b=b?M(w,b):"";var f=e&256;b=Mb(a,b,e&4096);return Nb(f?Cb:Bb,b,c)}catch(h){if("undefined"==typeof V||"ErrnoError"!==h.name)throw h;return-h.Jf}},D:function(a,b,c,e){Ob=e;try{b=b?M(w,b):"";b=Mb(a,b);var f=e?Pb():0;return Fb(b,c,f).Rf}catch(h){if("undefined"==typeof V||"ErrnoError"!==h.name)throw h;return-h.Jf}},B:function(a,b,c,e){try{b=b?M(w,b):"";b=Mb(a,b);if(0>=e)return-28;
|
||||
var f=kb(b),h=Math.min(e,Qa(f)),k=v[c+h];Ra(f,w,c,e+1);v[c+h]=k;return h}catch(n){if("undefined"==typeof V||"ErrnoError"!==n.name)throw n;return-n.Jf}},A:function(a){try{return a=a?M(w,a):"",Ab(a),0}catch(b){if("undefined"==typeof V||"ErrnoError"!==b.name)throw b;return-b.Jf}},M:function(a,b){try{return a=a?M(w,a):"",Nb(Bb,a,b)}catch(c){if("undefined"==typeof V||"ErrnoError"!==c.name)throw c;return-c.Jf}},v:function(a,b,c){try{b=b?M(w,b):"";b=Mb(a,b);if(0===c){a=b;var e=S(a,{parent:!0}).node;if(!e)throw new O(44);
|
||||
var f=La(a),h=cb(e,f),k=sb(e,f,!1);if(k)throw new O(k);if(!e.Gf.ig)throw new O(63);if(h.Wf)throw new O(10);e.Gf.ig(e,f);nb(h)}else 512===c?Ab(b):u("Invalid flags passed to unlinkat");return 0}catch(n){if("undefined"==typeof V||"ErrnoError"!==n.name)throw n;return-n.Jf}},u:function(a,b,c){try{b=b?M(w,b):"";b=Mb(a,b,!0);if(c){var e=B[c>>2]+4294967296*y[c+4>>2],f=y[c+8>>2];h=1E3*e+f/1E6;c+=16;e=B[c>>2]+4294967296*y[c+4>>2];f=y[c+8>>2];k=1E3*e+f/1E6}else var h=Date.now(),k=h;a=h;var n=S(b,{Tf:!0}).node;
|
||||
n.Gf.Lf(n,{timestamp:Math.max(a,k)});return 0}catch(l){if("undefined"==typeof V||"ErrnoError"!==l.name)throw l;return-l.Jf}},l:function(a,b,c){a=new Date(1E3*Qb(a,b));y[c>>2]=a.getSeconds();y[c+4>>2]=a.getMinutes();y[c+8>>2]=a.getHours();y[c+12>>2]=a.getDate();y[c+16>>2]=a.getMonth();y[c+20>>2]=a.getFullYear()-1900;y[c+24>>2]=a.getDay();b=a.getFullYear();y[c+28>>2]=(0!==b%4||0===b%100&&0!==b%400?Sb:Rb)[a.getMonth()]+a.getDate()-1|0;y[c+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),
|
||||
6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();y[c+32>>2]=(b!=e&&a.getTimezoneOffset()==Math.min(e,b))|0},j:function(a,b,c,e,f,h,k,n){f=Qb(f,h);try{if(isNaN(f))return 61;var l=T(e);if(0!==(b&2)&&0===(c&2)&&2!==(l.flags&2097155))throw new O(2);if(1===(l.flags&2097155))throw new O(2);if(!l.Hf.eg)throw new O(43);var m=l.Hf.eg(l,a,f,b,c);var p=m.Hg;y[k>>2]=m.wg;B[n>>2]=p;return 0}catch(q){if("undefined"==typeof V||"ErrnoError"!==q.name)throw q;return-q.Jf}},k:function(a,
|
||||
b,c,e,f,h,k){h=Qb(h,k);try{if(isNaN(h))return 61;var n=T(f);if(c&2){if(32768!==(n.node.mode&61440))throw new O(43);e&2||n.Hf.fg&&n.Hf.fg(n,w.slice(a,a+b),h,b,e)}}catch(l){if("undefined"==typeof V||"ErrnoError"!==l.name)throw l;return-l.Jf}},w:(a,b,c)=>{function e(l){return(l=l.toTimeString().match(/\(([A-Za-z ]+)\)$/))?l[1]:"GMT"}var f=(new Date).getFullYear(),h=new Date(f,0,1),k=new Date(f,6,1);f=h.getTimezoneOffset();var n=k.getTimezoneOffset();B[a>>2]=60*Math.max(f,n);y[b>>2]=Number(f!=n);a=e(h);
|
||||
b=e(k);a=Ub(a);b=Ub(b);n<f?(B[c>>2]=a,B[c+4>>2]=b):(B[c>>2]=b,B[c+4>>2]=a)},ua:()=>{u("")},e:()=>Date.now(),d:()=>performance.now(),x:(a,b,c)=>w.copyWithin(a,b,b+c),s:a=>{var b=w.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);var f=Math;e=Math.max(a,e);a:{f=(f.min.call(f,2147483648,e+(65536-e%65536)%65536)-ma.buffer.byteLength+65535)/65536;try{ma.grow(f);ra();var h=1;break a}catch(k){}h=void 0}if(h)return!0}return!1},F:(a,b)=>{var c=0;Xb().forEach((e,
|
||||
f)=>{var h=b+c;f=B[a+4*f>>2]=h;for(h=0;h<e.length;++h)v[f++>>0]=e.charCodeAt(h);v[f>>0]=0;c+=e.length+1});return 0},G:(a,b)=>{var c=Xb();B[a>>2]=c.length;var e=0;c.forEach(f=>e+=f.length+1);B[b>>2]=e;return 0},f:function(a){try{var b=T(a);if(null===b.Rf)throw new O(8);b.jg&&(b.jg=null);try{b.Hf.close&&b.Hf.close(b)}catch(c){throw c;}finally{hb[b.Rf]=null}b.Rf=null;return 0}catch(c){if("undefined"==typeof V||"ErrnoError"!==c.name)throw c;return c.Jf}},t:function(a,b){try{var c=T(a);v[b>>0]=c.Nf?2:
|
||||
Q(c.mode)?3:40960===(c.mode&61440)?7:4;x[b+2>>1]=0;H=[0,(F=0,1<=+Math.abs(F)?0<F?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)];y[b+8>>2]=H[0];y[b+12>>2]=H[1];H=[0,(F=0,1<=+Math.abs(F)?0<F?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)];y[b+16>>2]=H[0];y[b+20>>2]=H[1];return 0}catch(e){if("undefined"==typeof V||"ErrnoError"!==e.name)throw e;return e.Jf}},C:function(a,b,c,e){try{a:{var f=T(a);a=b;for(var h,k=b=0;k<c;k++){var n=B[a>>2],l=
|
||||
B[a+4>>2];a+=8;var m=f,p=n,q=l,t=h,z=v;if(0>q||0>t)throw new O(28);if(null===m.Rf)throw new O(8);if(1===(m.flags&2097155))throw new O(8);if(Q(m.node.mode))throw new O(31);if(!m.Hf.read)throw new O(28);var A="undefined"!=typeof t;if(!A)t=m.position;else if(!m.seekable)throw new O(70);var G=m.Hf.read(m,z,p,q,t);A||(m.position+=G);var E=G;if(0>E){var L=-1;break a}b+=E;if(E<l)break;"undefined"!==typeof h&&(h+=E)}L=b}B[e>>2]=L;return 0}catch(I){if("undefined"==typeof V||"ErrnoError"!==I.name)throw I;return I.Jf}},
|
||||
m:function(a,b,c,e,f){b=Qb(b,c);try{if(isNaN(b))return 61;var h=T(a);Hb(h,b,e);H=[h.position>>>0,(F=h.position,1<=+Math.abs(F)?0<F?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)];y[f>>2]=H[0];y[f+4>>2]=H[1];h.jg&&0===b&&0===e&&(h.jg=null);return 0}catch(k){if("undefined"==typeof V||"ErrnoError"!==k.name)throw k;return k.Jf}},I:function(a){try{var b=T(a);return b.Hf&&b.Hf.Vf?b.Hf.Vf(b):0}catch(c){if("undefined"==typeof V||"ErrnoError"!==c.name)throw c;return c.Jf}},y:function(a,
|
||||
b,c,e){try{a:{var f=T(a);a=b;for(var h,k=b=0;k<c;k++){var n=B[a>>2],l=B[a+4>>2];a+=8;var m=f,p=n,q=l,t=h,z=v;if(0>q||0>t)throw new O(28);if(null===m.Rf)throw new O(8);if(0===(m.flags&2097155))throw new O(8);if(Q(m.node.mode))throw new O(31);if(!m.Hf.write)throw new O(28);m.seekable&&m.flags&1024&&Hb(m,0,2);var A="undefined"!=typeof t;if(!A)t=m.position;else if(!m.seekable)throw new O(70);var G=m.Hf.write(m,z,p,q,t,void 0);A||(m.position+=G);var E=G;if(0>E){var L=-1;break a}b+=E;"undefined"!==typeof h&&
|
||||
(h+=E)}L=b}B[e>>2]=L;return 0}catch(I){if("undefined"==typeof V||"ErrnoError"!==I.name)throw I;return I.Jf}},g:(a,b)=>{Na(w.subarray(a,a+b));return 0},aa:Yb,z:Zb,R:$b,ea:ac,K:bc,ma:cc,o:dc,ta:ec,pa:fc,ka:gc,ga:hc,ha:ic,h:jc,i:kc,qa:lc,sa:mc,ra:nc,fa:oc,ia:pc,ja:qc,oa:rc,c:sc,la:tc,na:uc,ca:vc,X:wc,ba:xc,da:yc,U:zc,W:Ac,_:Bc,Z:Cc,T:Dc,r:Ec,V:Fc,$:Gc,p:Hc,Y:Ic,q:Jc},Z=function(){function a(c){Z=c.exports;ma=Z.va;ra();X=Z.Af;ta.unshift(Z.wa);C--;d.monitorRunDependencies&&d.monitorRunDependencies(C);
|
||||
0==C&&(null!==xa&&(clearInterval(xa),xa=null),ya&&(c=ya,ya=null,c()));return Z}var b={a:Sc};C++;d.monitorRunDependencies&&d.monitorRunDependencies(C);if(d.instantiateWasm)try{return d.instantiateWasm(b,a)}catch(c){r(`Module.instantiateWasm callback failed with error: ${c}`),ba(c)}Ea(b,function(c){a(c.instance)}).catch(ba);return{}}();d._sqlite3_status64=(a,b,c,e)=>(d._sqlite3_status64=Z.xa)(a,b,c,e);d._sqlite3_status=(a,b,c,e)=>(d._sqlite3_status=Z.ya)(a,b,c,e);
|
||||
d._sqlite3_db_status=(a,b,c,e,f)=>(d._sqlite3_db_status=Z.za)(a,b,c,e,f);d._sqlite3_msize=a=>(d._sqlite3_msize=Z.Aa)(a);d._sqlite3_vfs_find=a=>(d._sqlite3_vfs_find=Z.Ba)(a);d._sqlite3_vfs_register=(a,b)=>(d._sqlite3_vfs_register=Z.Ca)(a,b);d._sqlite3_vfs_unregister=a=>(d._sqlite3_vfs_unregister=Z.Da)(a);d._sqlite3_release_memory=a=>(d._sqlite3_release_memory=Z.Ea)(a);d._sqlite3_soft_heap_limit64=(a,b)=>(d._sqlite3_soft_heap_limit64=Z.Fa)(a,b);d._sqlite3_memory_used=()=>(d._sqlite3_memory_used=Z.Ga)();
|
||||
d._sqlite3_hard_heap_limit64=(a,b)=>(d._sqlite3_hard_heap_limit64=Z.Ha)(a,b);d._sqlite3_memory_highwater=a=>(d._sqlite3_memory_highwater=Z.Ia)(a);d._sqlite3_malloc=a=>(d._sqlite3_malloc=Z.Ja)(a);d._sqlite3_malloc64=(a,b)=>(d._sqlite3_malloc64=Z.Ka)(a,b);d._sqlite3_free=a=>(d._sqlite3_free=Z.La)(a);d._sqlite3_realloc=(a,b)=>(d._sqlite3_realloc=Z.Ma)(a,b);d._sqlite3_realloc64=(a,b,c)=>(d._sqlite3_realloc64=Z.Na)(a,b,c);d._sqlite3_str_vappendf=(a,b,c)=>(d._sqlite3_str_vappendf=Z.Oa)(a,b,c);
|
||||
d._sqlite3_str_append=(a,b,c)=>(d._sqlite3_str_append=Z.Pa)(a,b,c);d._sqlite3_str_appendchar=(a,b,c)=>(d._sqlite3_str_appendchar=Z.Qa)(a,b,c);d._sqlite3_str_appendall=(a,b)=>(d._sqlite3_str_appendall=Z.Ra)(a,b);d._sqlite3_str_appendf=(a,b,c)=>(d._sqlite3_str_appendf=Z.Sa)(a,b,c);d._sqlite3_str_finish=a=>(d._sqlite3_str_finish=Z.Ta)(a);d._sqlite3_str_errcode=a=>(d._sqlite3_str_errcode=Z.Ua)(a);d._sqlite3_str_length=a=>(d._sqlite3_str_length=Z.Va)(a);d._sqlite3_str_value=a=>(d._sqlite3_str_value=Z.Wa)(a);
|
||||
d._sqlite3_str_reset=a=>(d._sqlite3_str_reset=Z.Xa)(a);d._sqlite3_str_new=a=>(d._sqlite3_str_new=Z.Ya)(a);d._sqlite3_vmprintf=(a,b)=>(d._sqlite3_vmprintf=Z.Za)(a,b);d._sqlite3_mprintf=(a,b)=>(d._sqlite3_mprintf=Z._a)(a,b);d._sqlite3_vsnprintf=(a,b,c,e)=>(d._sqlite3_vsnprintf=Z.$a)(a,b,c,e);d._sqlite3_snprintf=(a,b,c,e)=>(d._sqlite3_snprintf=Z.ab)(a,b,c,e);d._sqlite3_log=(a,b,c)=>(d._sqlite3_log=Z.bb)(a,b,c);d._sqlite3_randomness=(a,b)=>(d._sqlite3_randomness=Z.cb)(a,b);
|
||||
d._sqlite3_stricmp=(a,b)=>(d._sqlite3_stricmp=Z.db)(a,b);d._sqlite3_strnicmp=(a,b,c)=>(d._sqlite3_strnicmp=Z.eb)(a,b,c);d._sqlite3_os_init=()=>(d._sqlite3_os_init=Z.fb)();d._sqlite3_os_end=()=>(d._sqlite3_os_end=Z.gb)();d._sqlite3_serialize=(a,b,c,e)=>(d._sqlite3_serialize=Z.hb)(a,b,c,e);d._sqlite3_prepare_v2=(a,b,c,e,f)=>(d._sqlite3_prepare_v2=Z.ib)(a,b,c,e,f);d._sqlite3_step=a=>(d._sqlite3_step=Z.jb)(a);d._sqlite3_column_int64=(a,b)=>(d._sqlite3_column_int64=Z.kb)(a,b);
|
||||
d._sqlite3_column_int=(a,b)=>(d._sqlite3_column_int=Z.lb)(a,b);d._sqlite3_finalize=a=>(d._sqlite3_finalize=Z.mb)(a);d._sqlite3_deserialize=(a,b,c,e,f,h,k,n)=>(d._sqlite3_deserialize=Z.nb)(a,b,c,e,f,h,k,n);d._sqlite3_database_file_object=a=>(d._sqlite3_database_file_object=Z.ob)(a);d._sqlite3_backup_init=(a,b,c,e)=>(d._sqlite3_backup_init=Z.pb)(a,b,c,e);d._sqlite3_backup_step=(a,b)=>(d._sqlite3_backup_step=Z.qb)(a,b);d._sqlite3_backup_finish=a=>(d._sqlite3_backup_finish=Z.rb)(a);
|
||||
d._sqlite3_backup_remaining=a=>(d._sqlite3_backup_remaining=Z.sb)(a);d._sqlite3_backup_pagecount=a=>(d._sqlite3_backup_pagecount=Z.tb)(a);d._sqlite3_reset=a=>(d._sqlite3_reset=Z.ub)(a);d._sqlite3_clear_bindings=a=>(d._sqlite3_clear_bindings=Z.vb)(a);d._sqlite3_value_blob=a=>(d._sqlite3_value_blob=Z.wb)(a);d._sqlite3_value_text=a=>(d._sqlite3_value_text=Z.xb)(a);d._sqlite3_value_bytes=a=>(d._sqlite3_value_bytes=Z.yb)(a);d._sqlite3_value_bytes16=a=>(d._sqlite3_value_bytes16=Z.zb)(a);
|
||||
d._sqlite3_value_double=a=>(d._sqlite3_value_double=Z.Ab)(a);d._sqlite3_value_int=a=>(d._sqlite3_value_int=Z.Bb)(a);d._sqlite3_value_int64=a=>(d._sqlite3_value_int64=Z.Cb)(a);d._sqlite3_value_subtype=a=>(d._sqlite3_value_subtype=Z.Db)(a);d._sqlite3_value_pointer=(a,b)=>(d._sqlite3_value_pointer=Z.Eb)(a,b);d._sqlite3_value_text16=a=>(d._sqlite3_value_text16=Z.Fb)(a);d._sqlite3_value_text16be=a=>(d._sqlite3_value_text16be=Z.Gb)(a);d._sqlite3_value_text16le=a=>(d._sqlite3_value_text16le=Z.Hb)(a);
|
||||
d._sqlite3_value_type=a=>(d._sqlite3_value_type=Z.Ib)(a);d._sqlite3_value_encoding=a=>(d._sqlite3_value_encoding=Z.Jb)(a);d._sqlite3_value_nochange=a=>(d._sqlite3_value_nochange=Z.Kb)(a);d._sqlite3_value_frombind=a=>(d._sqlite3_value_frombind=Z.Lb)(a);d._sqlite3_value_dup=a=>(d._sqlite3_value_dup=Z.Mb)(a);d._sqlite3_value_free=a=>(d._sqlite3_value_free=Z.Nb)(a);d._sqlite3_result_blob=(a,b,c,e)=>(d._sqlite3_result_blob=Z.Ob)(a,b,c,e);
|
||||
n=new Map;rc=function(l,m,p,q){n.set(l?M(w,l):"",{size:m,Zf:Array.from(new Uint32Array(w.buffer,q,p))})};d.createModule=function(l,m,p,q){b&&(p.handleAsync=Asyncify.qg);const t=c.size;c.set(t,{module:p,Rf:q});q=0;p.xCreate&&(q|=1);p.xConnect&&(q|=2);p.xBestIndex&&(q|=4);p.xDisconnect&&(q|=8);p.xDestroy&&(q|=16);p.xOpen&&(q|=32);p.xClose&&(q|=64);p.xFilter&&(q|=128);p.xNext&&(q|=256);p.xEof&&(q|=512);p.xColumn&&(q|=1024);p.xRowid&&(q|=2048);p.xUpdate&&(q|=4096);p.xBegin&&(q|=8192);p.xSync&&(q|=16384);
|
||||
p.xCommit&&(q|=32768);p.xRollback&&(q|=65536);p.xFindFunction&&(q|=131072);p.xRename&&(q|=262144);return Y("create_module","number",["number","string","number","number"],[l,m,t,q])};hc=function(l,m,p,q,t,z){m=c.get(m);e.set(t,m);if(b){h.delete(t);for(const A of h)e.delete(A)}q=Array.from(new Uint32Array(w.buffer,q,p)).map(A=>A?M(w,A):"");return m.module.xCreate(l,m.Rf,q,t,a("Int32",z))};gc=function(l,m,p,q,t,z){m=c.get(m);e.set(t,m);if(b){h.delete(t);for(const A of h)e.delete(A)}q=Array.from(new Uint32Array(w.buffer,
|
||||
q,p)).map(A=>A?M(w,A):"");return m.module.xConnect(l,m.Rf,q,t,a("Int32",z))};cc=function(l,m){var p=e.get(l),q=n.get("sqlite3_index_info").Zf;const t={};t.nConstraint=J(m+q[0],"i32");t.aConstraint=[];var z=J(m+q[1],"*"),A=n.get("sqlite3_index_constraint").size;for(var G=0;G<t.nConstraint;++G){var E=t.aConstraint,L=E.push,I=z+G*A,ha=n.get("sqlite3_index_constraint").Zf,V={};V.iColumn=J(I+ha[0],"i32");V.op=J(I+ha[1],"i8");V.usable=!!J(I+ha[2],"i8");L.call(E,V)}t.nOrderBy=J(m+q[2],"i32");t.aOrderBy=
|
||||
[];z=J(m+q[3],"*");A=n.get("sqlite3_index_orderby").size;for(G=0;G<t.nOrderBy;++G)E=t.aOrderBy,L=E.push,I=z+G*A,ha=n.get("sqlite3_index_orderby").Zf,V={},V.iColumn=J(I+ha[0],"i32"),V.desc=!!J(I+ha[1],"i8"),L.call(E,V);t.aConstraintUsage=[];for(z=0;z<t.nConstraint;++z)t.aConstraintUsage.push({argvIndex:0,omit:!1});t.idxNum=J(m+q[5],"i32");t.idxStr=null;t.orderByConsumed=!!J(m+q[8],"i8");t.estimatedCost=J(m+q[9],"double");t.estimatedRows=J(m+q[10],"i32");t.idxFlags=J(m+q[11],"i32");t.colUsed=J(m+q[12],
|
||||
"i32");l=p.module.xBestIndex(l,t);p=n.get("sqlite3_index_info").Zf;q=J(m+p[4],"*");z=n.get("sqlite3_index_constraint_usage").size;for(L=0;L<t.nConstraint;++L)A=q+L*z,E=t.aConstraintUsage[L],I=n.get("sqlite3_index_constraint_usage").Zf,K(A+I[0],E.argvIndex,"i32"),K(A+I[1],E.omit?1:0,"i8");K(m+p[5],t.idxNum,"i32");"string"===typeof t.idxStr&&(q=O(t.idxStr),z=Y("sqlite3_malloc","number",["number"],[q+1]),Qa(t.idxStr,w,z,q+1),K(m+p[6],z,"*"),K(m+p[7],1,"i32"));K(m+p[8],t.orderByConsumed,"i32");K(m+p[9],
|
||||
t.estimatedCost,"double");K(m+p[10],t.estimatedRows,"i32");K(m+p[11],t.idxFlags,"i32");return l};jc=function(l){const m=e.get(l);b?h.add(l):e.delete(l);return m.module.xDisconnect(l)};ic=function(l){const m=e.get(l);b?h.add(l):e.delete(l);return m.module.xDestroy(l)};nc=function(l,m){const p=e.get(l);f.set(m,p);if(b){k.delete(m);for(const q of k)f.delete(q)}return p.module.xOpen(l,m)};dc=function(l){const m=f.get(l);b?k.add(l):f.delete(l);return m.module.xClose(l)};kc=function(l){return f.get(l).module.xEof(l)?
|
||||
1:0};lc=function(l,m,p,q,t){const z=f.get(l);p=p?p?M(w,p):"":null;t=new Uint32Array(w.buffer,t,q);return z.module.xFilter(l,m,p,t)};mc=function(l){return f.get(l).module.xNext(l)};ec=function(l,m,p){return f.get(l).module.xColumn(l,m,p)};qc=function(l,m){return f.get(l).module.xRowid(l,a("BigInt64",m))};tc=function(l,m,p,q){const t=e.get(l);p=new Uint32Array(w.buffer,p,m);return t.module.xUpdate(l,p,a("BigInt64",q))};bc=function(l){return e.get(l).module.xBegin(l)};sc=function(l){return e.get(l).module.xSync(l)};
|
||||
fc=function(l){return e.get(l).module.xCommit(l)};pc=function(l){return e.get(l).module.xRollback(l)};oc=function(l,m){const p=e.get(l);m=m?M(w,m):"";return p.module.xRename(l,m)}})();
|
||||
(function(){function a(h,k){const n=`get${h}`,l=`set${h}`;return new Proxy(new DataView(w.buffer,k,"Int32"===h?4:8),{get(m,p){if(p===n)return function(q,t){if(!t)throw Error("must be little endian");return m[p](q,t)};if(p===l)return function(q,t,z){if(!z)throw Error("must be little endian");return m[p](q,t,z)};if("string"===typeof p&&p.match(/^(get)|(set)/))throw Error("invalid type");return m[p]}})}const b="object"===typeof Asyncify;b&&(d.handleAsync=Asyncify.qg);const c=new Map,e=new Map;d.registerVFS=
|
||||
function(h,k){if(Y("sqlite3_vfs_find","number",["string"],[h.name]))throw Error(`VFS '${h.name}' already registered`);b&&(h.handleAsync=Asyncify.qg);var n=h.Sg??64;const l=d._malloc(4);k=Y("register_vfs","number",["string","number","number","number"],[h.name,n,k?1:0,l]);k||(n=J(l,"*"),c.set(n,h));d._free(l);return k};const f=b?new Set:null;wc=function(h){const k=e.get(h);b?f.add(h):e.delete(h);return k.xClose(h)};Dc=function(h,k,n,l,m){return e.get(h).xRead(h,w.subarray(k,k+n),4294967296*m+l+(0>l?
|
||||
2**32:0))};Ic=function(h,k,n,l,m){return e.get(h).xWrite(h,w.subarray(k,k+n),4294967296*m+l+(0>l?2**32:0))};Gc=function(h,k,n){return e.get(h).xTruncate(h,4294967296*n+k+(0>k?2**32:0))};Fc=function(h,k){return e.get(h).xSync(h,k)};Ac=function(h,k){const n=e.get(h);k=a("BigInt64",k);return n.xFileSize(h,k)};Bc=function(h,k){return e.get(h).xLock(h,k)};Hc=function(h,k){return e.get(h).xUnlock(h,k)};vc=function(h,k){const n=e.get(h);k=a("Int32",k);return n.xCheckReservedLock(h,k)};zc=function(h,k,n){const l=
|
||||
e.get(h);n=new DataView(w.buffer,n);return l.xFileControl(h,k,n)};Ec=function(h){return e.get(h).xSectorSize(h)};yc=function(h){return e.get(h).xDeviceCharacteristics(h)};Cc=function(h,k,n,l,m){h=c.get(h);e.set(n,h);if(b){f.delete(n);for(var p of f)e.delete(p)}p=null;if(l&64){p=1;const q=[];for(;p;){const t=w[k++];if(t)q.push(t);else switch(w[k]||(p=null),p){case 1:q.push(63);p=2;break;case 2:q.push(61);p=3;break;case 3:q.push(38),p=2}}p=(new TextDecoder).decode(new Uint8Array(q))}else k&&(p=k?M(w,
|
||||
k):"");m=a("Int32",m);return h.xOpen(p,n,l,m)};xc=function(h,k,n){return c.get(h).xDelete(k?M(w,k):"",n)};uc=function(h,k,n,l){h=c.get(h);l=a("Int32",l);return h.xAccess(k?M(w,k):"",n,l)}})();
|
||||
var Rc={a:(a,b,c,e)=>{u(`Assertion failed: ${a?M(w,a):""}, at: `+[b?b?M(w,b):"":"unknown filename",c,e?e?M(w,e):"":"unknown function"])},N:function(a,b){try{return a=a?M(w,a):"",Cb(a,b),0}catch(c){if("undefined"==typeof X||"ErrnoError"!==c.name)throw c;return-c.If}},Q:function(a,b,c){try{b=b?M(w,b):"";b=Lb(a,b);if(c&-8)return-28;var e=T(b,{Sf:!0}).node;if(!e)return-44;a="";c&4&&(a+="r");c&2&&(a+="w");c&1&&(a+="x");return a&&nb(e,a)?-2:0}catch(f){if("undefined"==typeof X||"ErrnoError"!==f.name)throw f;
|
||||
return-f.If}},O:function(a,b){try{var c=U(a);Cb(c.node,b);return 0}catch(e){if("undefined"==typeof X||"ErrnoError"!==e.name)throw e;return-e.If}},M:function(a){try{var b=U(a).node;var c="string"==typeof b?T(b,{Sf:!0}).node:b;if(!c.Ff.Kf)throw new P(63);c.Ff.Kf(c,{timestamp:Date.now()});return 0}catch(e){if("undefined"==typeof X||"ErrnoError"!==e.name)throw e;return-e.If}},b:function(a,b,c){Nb=c;try{var e=U(a);switch(b){case 0:var f=Ob();if(0>f)return-28;for(;gb[f];)f++;return tb(e,f).Qf;case 1:case 2:return 0;
|
||||
case 3:return e.flags;case 4:return f=Ob(),e.flags|=f,0;case 5:return f=Ob(),x[f+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return y[Qc()>>2]=28,-1;default:return-28}}catch(h){if("undefined"==typeof X||"ErrnoError"!==h.name)throw h;return-h.If}},L:function(a,b){try{var c=U(a);return Mb(Ab,c.path,b)}catch(e){if("undefined"==typeof X||"ErrnoError"!==e.name)throw e;return-e.If}},n:function(a,b,c){b=Pb(b,c);try{if(isNaN(b))return 61;var e=U(a);if(0===(e.flags&2097155))throw new P(28);
|
||||
Db(e.node,b);return 0}catch(f){if("undefined"==typeof X||"ErrnoError"!==f.name)throw f;return-f.If}},F:function(a,b){try{if(0===b)return-28;var c=O("/")+1;if(b<c)return-68;Qa("/",w,a,b);return c}catch(e){if("undefined"==typeof X||"ErrnoError"!==e.name)throw e;return-e.If}},J:function(a,b){try{return a=a?M(w,a):"",Mb(Bb,a,b)}catch(c){if("undefined"==typeof X||"ErrnoError"!==c.name)throw c;return-c.If}},C:function(a,b,c){try{return b=b?M(w,b):"",b=Lb(a,b),b=N(b),"/"===b[b.length-1]&&(b=b.substr(0,b.length-
|
||||
1)),W(b,c),0}catch(e){if("undefined"==typeof X||"ErrnoError"!==e.name)throw e;return-e.If}},H:function(a,b,c,e){try{b=b?M(w,b):"";var f=e&256;b=Lb(a,b,e&4096);return Mb(f?Bb:Ab,b,c)}catch(h){if("undefined"==typeof X||"ErrnoError"!==h.name)throw h;return-h.If}},B:function(a,b,c,e){Nb=e;try{b=b?M(w,b):"";b=Lb(a,b);var f=e?Ob():0;return Eb(b,c,f).Qf}catch(h){if("undefined"==typeof X||"ErrnoError"!==h.name)throw h;return-h.If}},z:function(a,b,c,e){try{b=b?M(w,b):"";b=Lb(a,b);if(0>=e)return-28;var f=jb(b),
|
||||
h=Math.min(e,O(f)),k=v[c+h];Qa(f,w,c,e+1);v[c+h]=k;return h}catch(n){if("undefined"==typeof X||"ErrnoError"!==n.name)throw n;return-n.If}},y:function(a){try{return a=a?M(w,a):"",zb(a),0}catch(b){if("undefined"==typeof X||"ErrnoError"!==b.name)throw b;return-b.If}},K:function(a,b){try{return a=a?M(w,a):"",Mb(Ab,a,b)}catch(c){if("undefined"==typeof X||"ErrnoError"!==c.name)throw c;return-c.If}},u:function(a,b,c){try{b=b?M(w,b):"";b=Lb(a,b);if(0===c){a=b;var e=T(a,{parent:!0}).node;if(!e)throw new P(44);
|
||||
var f=La(a),h=bb(e,f),k=rb(e,f,!1);if(k)throw new P(k);if(!e.Ff.hg)throw new P(63);if(h.Vf)throw new P(10);e.Ff.hg(e,f);mb(h)}else 512===c?zb(b):u("Invalid flags passed to unlinkat");return 0}catch(n){if("undefined"==typeof X||"ErrnoError"!==n.name)throw n;return-n.If}},t:function(a,b,c){try{b=b?M(w,b):"";b=Lb(a,b,!0);if(c){var e=B[c>>2]+4294967296*y[c+4>>2],f=y[c+8>>2];h=1E3*e+f/1E6;c+=16;e=B[c>>2]+4294967296*y[c+4>>2];f=y[c+8>>2];k=1E3*e+f/1E6}else var h=Date.now(),k=h;a=h;var n=T(b,{Sf:!0}).node;
|
||||
n.Ff.Kf(n,{timestamp:Math.max(a,k)});return 0}catch(l){if("undefined"==typeof X||"ErrnoError"!==l.name)throw l;return-l.If}},k:function(a,b,c){a=new Date(1E3*Pb(a,b));y[c>>2]=a.getSeconds();y[c+4>>2]=a.getMinutes();y[c+8>>2]=a.getHours();y[c+12>>2]=a.getDate();y[c+16>>2]=a.getMonth();y[c+20>>2]=a.getFullYear()-1900;y[c+24>>2]=a.getDay();b=a.getFullYear();y[c+28>>2]=(0!==b%4||0===b%100&&0!==b%400?Rb:Qb)[a.getMonth()]+a.getDate()-1|0;y[c+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),
|
||||
6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();y[c+32>>2]=(b!=e&&a.getTimezoneOffset()==Math.min(e,b))|0},i:function(a,b,c,e,f,h,k,n){f=Pb(f,h);try{if(isNaN(f))return 61;var l=U(e);if(0!==(b&2)&&0===(c&2)&&2!==(l.flags&2097155))throw new P(2);if(1===(l.flags&2097155))throw new P(2);if(!l.Gf.dg)throw new P(43);var m=l.Gf.dg(l,a,f,b,c);var p=m.Gg;y[k>>2]=m.vg;B[n>>2]=p;return 0}catch(q){if("undefined"==typeof X||"ErrnoError"!==q.name)throw q;return-q.If}},j:function(a,
|
||||
b,c,e,f,h,k){h=Pb(h,k);try{if(isNaN(h))return 61;var n=U(f);if(c&2){if(32768!==(n.node.mode&61440))throw new P(43);e&2||n.Gf.eg&&n.Gf.eg(n,w.slice(a,a+b),h,b,e)}}catch(l){if("undefined"==typeof X||"ErrnoError"!==l.name)throw l;return-l.If}},v:(a,b,c)=>{function e(l){return(l=l.toTimeString().match(/\(([A-Za-z ]+)\)$/))?l[1]:"GMT"}var f=(new Date).getFullYear(),h=new Date(f,0,1),k=new Date(f,6,1);f=h.getTimezoneOffset();var n=k.getTimezoneOffset();B[a>>2]=60*Math.max(f,n);y[b>>2]=Number(f!=n);a=e(h);
|
||||
b=e(k);a=Tb(a);b=Tb(b);n<f?(B[c>>2]=a,B[c+4>>2]=b):(B[c>>2]=b,B[c+4>>2]=a)},ta:()=>{u("")},e:()=>Date.now(),d:()=>performance.now(),r:a=>{var b=w.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);var f=Math;e=Math.max(a,e);a:{f=(f.min.call(f,2147483648,e+(65536-e%65536)%65536)-ma.buffer.byteLength+65535)/65536;try{ma.grow(f);ra();var h=1;break a}catch(k){}h=void 0}if(h)return!0}return!1},D:(a,b)=>{var c=0;Wb().forEach((e,f)=>{var h=b+c;f=B[a+
|
||||
4*f>>2]=h;for(h=0;h<e.length;++h)v[f++>>0]=e.charCodeAt(h);v[f>>0]=0;c+=e.length+1});return 0},E:(a,b)=>{var c=Wb();B[a>>2]=c.length;var e=0;c.forEach(f=>e+=f.length+1);B[b>>2]=e;return 0},f:function(a){try{var b=U(a);if(null===b.Qf)throw new P(8);b.ig&&(b.ig=null);try{b.Gf.close&&b.Gf.close(b)}catch(c){throw c;}finally{gb[b.Qf]=null}b.Qf=null;return 0}catch(c){if("undefined"==typeof X||"ErrnoError"!==c.name)throw c;return c.If}},s:function(a,b){try{var c=U(a);v[b>>0]=c.Mf?2:R(c.mode)?3:40960===(c.mode&
|
||||
61440)?7:4;x[b+2>>1]=0;H=[0,(F=0,1<=+Math.abs(F)?0<F?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)];y[b+8>>2]=H[0];y[b+12>>2]=H[1];H=[0,(F=0,1<=+Math.abs(F)?0<F?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)];y[b+16>>2]=H[0];y[b+20>>2]=H[1];return 0}catch(e){if("undefined"==typeof X||"ErrnoError"!==e.name)throw e;return e.If}},A:function(a,b,c,e){try{a:{var f=U(a);a=b;for(var h,k=b=0;k<c;k++){var n=B[a>>2],l=B[a+4>>2];a+=8;var m=f,p=n,q=
|
||||
l,t=h,z=v;if(0>q||0>t)throw new P(28);if(null===m.Qf)throw new P(8);if(1===(m.flags&2097155))throw new P(8);if(R(m.node.mode))throw new P(31);if(!m.Gf.read)throw new P(28);var A="undefined"!=typeof t;if(!A)t=m.position;else if(!m.seekable)throw new P(70);var G=m.Gf.read(m,z,p,q,t);A||(m.position+=G);var E=G;if(0>E){var L=-1;break a}b+=E;if(E<l)break;"undefined"!==typeof h&&(h+=E)}L=b}B[e>>2]=L;return 0}catch(I){if("undefined"==typeof X||"ErrnoError"!==I.name)throw I;return I.If}},l:function(a,b,c,
|
||||
e,f){b=Pb(b,c);try{if(isNaN(b))return 61;var h=U(a);Gb(h,b,e);H=[h.position>>>0,(F=h.position,1<=+Math.abs(F)?0<F?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)];y[f>>2]=H[0];y[f+4>>2]=H[1];h.ig&&0===b&&0===e&&(h.ig=null);return 0}catch(k){if("undefined"==typeof X||"ErrnoError"!==k.name)throw k;return k.If}},G:function(a){try{var b=U(a);return b.Gf&&b.Gf.Uf?b.Gf.Uf(b):0}catch(c){if("undefined"==typeof X||"ErrnoError"!==c.name)throw c;return c.If}},w:function(a,b,c,e){try{a:{var f=
|
||||
U(a);a=b;for(var h,k=b=0;k<c;k++){var n=B[a>>2],l=B[a+4>>2];a+=8;var m=f,p=n,q=l,t=h,z=v;if(0>q||0>t)throw new P(28);if(null===m.Qf)throw new P(8);if(0===(m.flags&2097155))throw new P(8);if(R(m.node.mode))throw new P(31);if(!m.Gf.write)throw new P(28);m.seekable&&m.flags&1024&&Gb(m,0,2);var A="undefined"!=typeof t;if(!A)t=m.position;else if(!m.seekable)throw new P(70);var G=m.Gf.write(m,z,p,q,t,void 0);A||(m.position+=G);var E=G;if(0>E){var L=-1;break a}b+=E;"undefined"!==typeof h&&(h+=E)}L=b}B[e>>
|
||||
2]=L;return 0}catch(I){if("undefined"==typeof X||"ErrnoError"!==I.name)throw I;return I.If}},sa:(a,b)=>{Na(w.subarray(a,a+b));return 0},_:Xb,x:Yb,P:Zb,ca:$b,I:ac,ka:bc,m:cc,ra:dc,na:ec,ia:fc,ea:gc,fa:hc,g:ic,h:jc,oa:kc,qa:lc,pa:mc,da:nc,ga:oc,ha:pc,ma:qc,c:rc,ja:sc,la:tc,aa:uc,V:vc,$:wc,ba:xc,S:yc,U:zc,Y:Ac,X:Bc,R:Cc,q:Dc,T:Ec,Z:Fc,o:Gc,W:Hc,p:Ic},Z=function(){function a(c){Z=c.exports;ma=Z.ua;ra();Jc=Z.zf;ta.unshift(Z.va);C--;d.monitorRunDependencies&&d.monitorRunDependencies(C);0==C&&(null!==xa&&
|
||||
(clearInterval(xa),xa=null),ya&&(c=ya,ya=null,c()));return Z}var b={a:Rc};C++;d.monitorRunDependencies&&d.monitorRunDependencies(C);if(d.instantiateWasm)try{return d.instantiateWasm(b,a)}catch(c){r(`Module.instantiateWasm callback failed with error: ${c}`),ba(c)}Ea(b,function(c){a(c.instance)}).catch(ba);return{}}();d._sqlite3_status64=(a,b,c,e)=>(d._sqlite3_status64=Z.wa)(a,b,c,e);d._sqlite3_status=(a,b,c,e)=>(d._sqlite3_status=Z.xa)(a,b,c,e);
|
||||
d._sqlite3_db_status=(a,b,c,e,f)=>(d._sqlite3_db_status=Z.ya)(a,b,c,e,f);d._sqlite3_msize=a=>(d._sqlite3_msize=Z.za)(a);d._sqlite3_vfs_find=a=>(d._sqlite3_vfs_find=Z.Aa)(a);d._sqlite3_vfs_register=(a,b)=>(d._sqlite3_vfs_register=Z.Ba)(a,b);d._sqlite3_vfs_unregister=a=>(d._sqlite3_vfs_unregister=Z.Ca)(a);d._sqlite3_release_memory=a=>(d._sqlite3_release_memory=Z.Da)(a);d._sqlite3_soft_heap_limit64=(a,b)=>(d._sqlite3_soft_heap_limit64=Z.Ea)(a,b);d._sqlite3_memory_used=()=>(d._sqlite3_memory_used=Z.Fa)();
|
||||
d._sqlite3_hard_heap_limit64=(a,b)=>(d._sqlite3_hard_heap_limit64=Z.Ga)(a,b);d._sqlite3_memory_highwater=a=>(d._sqlite3_memory_highwater=Z.Ha)(a);d._sqlite3_malloc=a=>(d._sqlite3_malloc=Z.Ia)(a);d._sqlite3_malloc64=(a,b)=>(d._sqlite3_malloc64=Z.Ja)(a,b);d._sqlite3_free=a=>(d._sqlite3_free=Z.Ka)(a);d._sqlite3_realloc=(a,b)=>(d._sqlite3_realloc=Z.La)(a,b);d._sqlite3_realloc64=(a,b,c)=>(d._sqlite3_realloc64=Z.Ma)(a,b,c);d._sqlite3_str_vappendf=(a,b,c)=>(d._sqlite3_str_vappendf=Z.Na)(a,b,c);
|
||||
d._sqlite3_str_append=(a,b,c)=>(d._sqlite3_str_append=Z.Oa)(a,b,c);d._sqlite3_str_appendchar=(a,b,c)=>(d._sqlite3_str_appendchar=Z.Pa)(a,b,c);d._sqlite3_str_appendall=(a,b)=>(d._sqlite3_str_appendall=Z.Qa)(a,b);d._sqlite3_str_appendf=(a,b,c)=>(d._sqlite3_str_appendf=Z.Ra)(a,b,c);d._sqlite3_str_finish=a=>(d._sqlite3_str_finish=Z.Sa)(a);d._sqlite3_str_errcode=a=>(d._sqlite3_str_errcode=Z.Ta)(a);d._sqlite3_str_length=a=>(d._sqlite3_str_length=Z.Ua)(a);d._sqlite3_str_value=a=>(d._sqlite3_str_value=Z.Va)(a);
|
||||
d._sqlite3_str_reset=a=>(d._sqlite3_str_reset=Z.Wa)(a);d._sqlite3_str_new=a=>(d._sqlite3_str_new=Z.Xa)(a);d._sqlite3_vmprintf=(a,b)=>(d._sqlite3_vmprintf=Z.Ya)(a,b);d._sqlite3_mprintf=(a,b)=>(d._sqlite3_mprintf=Z.Za)(a,b);d._sqlite3_vsnprintf=(a,b,c,e)=>(d._sqlite3_vsnprintf=Z._a)(a,b,c,e);d._sqlite3_snprintf=(a,b,c,e)=>(d._sqlite3_snprintf=Z.$a)(a,b,c,e);d._sqlite3_log=(a,b,c)=>(d._sqlite3_log=Z.ab)(a,b,c);d._sqlite3_randomness=(a,b)=>(d._sqlite3_randomness=Z.bb)(a,b);
|
||||
d._sqlite3_stricmp=(a,b)=>(d._sqlite3_stricmp=Z.cb)(a,b);d._sqlite3_strnicmp=(a,b,c)=>(d._sqlite3_strnicmp=Z.db)(a,b,c);d._sqlite3_os_init=()=>(d._sqlite3_os_init=Z.eb)();d._sqlite3_os_end=()=>(d._sqlite3_os_end=Z.fb)();d._sqlite3_serialize=(a,b,c,e)=>(d._sqlite3_serialize=Z.gb)(a,b,c,e);d._sqlite3_prepare_v2=(a,b,c,e,f)=>(d._sqlite3_prepare_v2=Z.hb)(a,b,c,e,f);d._sqlite3_step=a=>(d._sqlite3_step=Z.ib)(a);d._sqlite3_column_int64=(a,b)=>(d._sqlite3_column_int64=Z.jb)(a,b);
|
||||
d._sqlite3_reset=a=>(d._sqlite3_reset=Z.kb)(a);d._sqlite3_exec=(a,b,c,e,f)=>(d._sqlite3_exec=Z.lb)(a,b,c,e,f);d._sqlite3_column_int=(a,b)=>(d._sqlite3_column_int=Z.mb)(a,b);d._sqlite3_finalize=a=>(d._sqlite3_finalize=Z.nb)(a);d._sqlite3_deserialize=(a,b,c,e,f,h,k,n)=>(d._sqlite3_deserialize=Z.ob)(a,b,c,e,f,h,k,n);d._sqlite3_database_file_object=a=>(d._sqlite3_database_file_object=Z.pb)(a);d._sqlite3_backup_init=(a,b,c,e)=>(d._sqlite3_backup_init=Z.qb)(a,b,c,e);
|
||||
d._sqlite3_backup_step=(a,b)=>(d._sqlite3_backup_step=Z.rb)(a,b);d._sqlite3_backup_finish=a=>(d._sqlite3_backup_finish=Z.sb)(a);d._sqlite3_backup_remaining=a=>(d._sqlite3_backup_remaining=Z.tb)(a);d._sqlite3_backup_pagecount=a=>(d._sqlite3_backup_pagecount=Z.ub)(a);d._sqlite3_clear_bindings=a=>(d._sqlite3_clear_bindings=Z.vb)(a);d._sqlite3_value_blob=a=>(d._sqlite3_value_blob=Z.wb)(a);d._sqlite3_value_text=a=>(d._sqlite3_value_text=Z.xb)(a);d._sqlite3_value_bytes=a=>(d._sqlite3_value_bytes=Z.yb)(a);
|
||||
d._sqlite3_value_bytes16=a=>(d._sqlite3_value_bytes16=Z.zb)(a);d._sqlite3_value_double=a=>(d._sqlite3_value_double=Z.Ab)(a);d._sqlite3_value_int=a=>(d._sqlite3_value_int=Z.Bb)(a);d._sqlite3_value_int64=a=>(d._sqlite3_value_int64=Z.Cb)(a);d._sqlite3_value_subtype=a=>(d._sqlite3_value_subtype=Z.Db)(a);d._sqlite3_value_pointer=(a,b)=>(d._sqlite3_value_pointer=Z.Eb)(a,b);d._sqlite3_value_text16=a=>(d._sqlite3_value_text16=Z.Fb)(a);d._sqlite3_value_text16be=a=>(d._sqlite3_value_text16be=Z.Gb)(a);
|
||||
d._sqlite3_value_text16le=a=>(d._sqlite3_value_text16le=Z.Hb)(a);d._sqlite3_value_type=a=>(d._sqlite3_value_type=Z.Ib)(a);d._sqlite3_value_encoding=a=>(d._sqlite3_value_encoding=Z.Jb)(a);d._sqlite3_value_nochange=a=>(d._sqlite3_value_nochange=Z.Kb)(a);d._sqlite3_value_frombind=a=>(d._sqlite3_value_frombind=Z.Lb)(a);d._sqlite3_value_dup=a=>(d._sqlite3_value_dup=Z.Mb)(a);d._sqlite3_value_free=a=>(d._sqlite3_value_free=Z.Nb)(a);d._sqlite3_result_blob=(a,b,c,e)=>(d._sqlite3_result_blob=Z.Ob)(a,b,c,e);
|
||||
d._sqlite3_result_blob64=(a,b,c,e,f)=>(d._sqlite3_result_blob64=Z.Pb)(a,b,c,e,f);d._sqlite3_result_double=(a,b)=>(d._sqlite3_result_double=Z.Qb)(a,b);d._sqlite3_result_error=(a,b,c)=>(d._sqlite3_result_error=Z.Rb)(a,b,c);d._sqlite3_result_error16=(a,b,c)=>(d._sqlite3_result_error16=Z.Sb)(a,b,c);d._sqlite3_result_int=(a,b)=>(d._sqlite3_result_int=Z.Tb)(a,b);d._sqlite3_result_int64=(a,b,c)=>(d._sqlite3_result_int64=Z.Ub)(a,b,c);d._sqlite3_result_null=a=>(d._sqlite3_result_null=Z.Vb)(a);
|
||||
d._sqlite3_result_pointer=(a,b,c,e)=>(d._sqlite3_result_pointer=Z.Wb)(a,b,c,e);d._sqlite3_result_subtype=(a,b)=>(d._sqlite3_result_subtype=Z.Xb)(a,b);d._sqlite3_result_text=(a,b,c,e)=>(d._sqlite3_result_text=Z.Yb)(a,b,c,e);d._sqlite3_result_text64=(a,b,c,e,f,h)=>(d._sqlite3_result_text64=Z.Zb)(a,b,c,e,f,h);d._sqlite3_result_text16=(a,b,c,e)=>(d._sqlite3_result_text16=Z._b)(a,b,c,e);d._sqlite3_result_text16be=(a,b,c,e)=>(d._sqlite3_result_text16be=Z.$b)(a,b,c,e);
|
||||
d._sqlite3_result_text16le=(a,b,c,e)=>(d._sqlite3_result_text16le=Z.ac)(a,b,c,e);d._sqlite3_result_value=(a,b)=>(d._sqlite3_result_value=Z.bc)(a,b);d._sqlite3_result_error_toobig=a=>(d._sqlite3_result_error_toobig=Z.cc)(a);d._sqlite3_result_zeroblob=(a,b)=>(d._sqlite3_result_zeroblob=Z.dc)(a,b);d._sqlite3_result_zeroblob64=(a,b,c)=>(d._sqlite3_result_zeroblob64=Z.ec)(a,b,c);d._sqlite3_result_error_code=(a,b)=>(d._sqlite3_result_error_code=Z.fc)(a,b);
|
||||
@@ -107,35 +107,35 @@ d._sqlite3_bind_blob=(a,b,c,e,f)=>(d._sqlite3_bind_blob=Z.Bc)(a,b,c,e,f);d._sqli
|
||||
d._sqlite3_bind_text=(a,b,c,e,f)=>(d._sqlite3_bind_text=Z.Ic)(a,b,c,e,f);d._sqlite3_bind_text64=(a,b,c,e,f,h,k)=>(d._sqlite3_bind_text64=Z.Jc)(a,b,c,e,f,h,k);d._sqlite3_bind_text16=(a,b,c,e,f)=>(d._sqlite3_bind_text16=Z.Kc)(a,b,c,e,f);d._sqlite3_bind_value=(a,b,c)=>(d._sqlite3_bind_value=Z.Lc)(a,b,c);d._sqlite3_bind_zeroblob=(a,b,c)=>(d._sqlite3_bind_zeroblob=Z.Mc)(a,b,c);d._sqlite3_bind_zeroblob64=(a,b,c,e)=>(d._sqlite3_bind_zeroblob64=Z.Nc)(a,b,c,e);
|
||||
d._sqlite3_bind_parameter_count=a=>(d._sqlite3_bind_parameter_count=Z.Oc)(a);d._sqlite3_bind_parameter_name=(a,b)=>(d._sqlite3_bind_parameter_name=Z.Pc)(a,b);d._sqlite3_bind_parameter_index=(a,b)=>(d._sqlite3_bind_parameter_index=Z.Qc)(a,b);d._sqlite3_db_handle=a=>(d._sqlite3_db_handle=Z.Rc)(a);d._sqlite3_stmt_readonly=a=>(d._sqlite3_stmt_readonly=Z.Sc)(a);d._sqlite3_stmt_isexplain=a=>(d._sqlite3_stmt_isexplain=Z.Tc)(a);d._sqlite3_stmt_explain=(a,b)=>(d._sqlite3_stmt_explain=Z.Uc)(a,b);
|
||||
d._sqlite3_stmt_busy=a=>(d._sqlite3_stmt_busy=Z.Vc)(a);d._sqlite3_next_stmt=(a,b)=>(d._sqlite3_next_stmt=Z.Wc)(a,b);d._sqlite3_stmt_status=(a,b,c)=>(d._sqlite3_stmt_status=Z.Xc)(a,b,c);d._sqlite3_sql=a=>(d._sqlite3_sql=Z.Yc)(a);d._sqlite3_expanded_sql=a=>(d._sqlite3_expanded_sql=Z.Zc)(a);d._sqlite3_value_numeric_type=a=>(d._sqlite3_value_numeric_type=Z._c)(a);d._sqlite3_blob_open=(a,b,c,e,f,h,k,n)=>(d._sqlite3_blob_open=Z.$c)(a,b,c,e,f,h,k,n);d._sqlite3_blob_close=a=>(d._sqlite3_blob_close=Z.ad)(a);
|
||||
d._sqlite3_blob_read=(a,b,c,e)=>(d._sqlite3_blob_read=Z.bd)(a,b,c,e);d._sqlite3_blob_write=(a,b,c,e)=>(d._sqlite3_blob_write=Z.cd)(a,b,c,e);d._sqlite3_blob_bytes=a=>(d._sqlite3_blob_bytes=Z.dd)(a);d._sqlite3_blob_reopen=(a,b,c)=>(d._sqlite3_blob_reopen=Z.ed)(a,b,c);d._sqlite3_set_authorizer=(a,b,c)=>(d._sqlite3_set_authorizer=Z.fd)(a,b,c);d._sqlite3_strglob=(a,b)=>(d._sqlite3_strglob=Z.gd)(a,b);d._sqlite3_strlike=(a,b,c)=>(d._sqlite3_strlike=Z.hd)(a,b,c);
|
||||
d._sqlite3_exec=(a,b,c,e,f)=>(d._sqlite3_exec=Z.id)(a,b,c,e,f);d._sqlite3_errmsg=a=>(d._sqlite3_errmsg=Z.jd)(a);d._sqlite3_auto_extension=a=>(d._sqlite3_auto_extension=Z.kd)(a);d._sqlite3_cancel_auto_extension=a=>(d._sqlite3_cancel_auto_extension=Z.ld)(a);d._sqlite3_reset_auto_extension=()=>(d._sqlite3_reset_auto_extension=Z.md)();d._sqlite3_prepare=(a,b,c,e,f)=>(d._sqlite3_prepare=Z.nd)(a,b,c,e,f);d._sqlite3_prepare_v3=(a,b,c,e,f,h)=>(d._sqlite3_prepare_v3=Z.od)(a,b,c,e,f,h);
|
||||
d._sqlite3_prepare16=(a,b,c,e,f)=>(d._sqlite3_prepare16=Z.pd)(a,b,c,e,f);d._sqlite3_prepare16_v2=(a,b,c,e,f)=>(d._sqlite3_prepare16_v2=Z.qd)(a,b,c,e,f);d._sqlite3_prepare16_v3=(a,b,c,e,f,h)=>(d._sqlite3_prepare16_v3=Z.rd)(a,b,c,e,f,h);d._sqlite3_get_table=(a,b,c,e,f,h)=>(d._sqlite3_get_table=Z.sd)(a,b,c,e,f,h);d._sqlite3_free_table=a=>(d._sqlite3_free_table=Z.td)(a);d._sqlite3_create_module=(a,b,c,e)=>(d._sqlite3_create_module=Z.ud)(a,b,c,e);
|
||||
d._sqlite3_create_module_v2=(a,b,c,e,f)=>(d._sqlite3_create_module_v2=Z.vd)(a,b,c,e,f);d._sqlite3_drop_modules=(a,b)=>(d._sqlite3_drop_modules=Z.wd)(a,b);d._sqlite3_declare_vtab=(a,b)=>(d._sqlite3_declare_vtab=Z.xd)(a,b);d._sqlite3_vtab_on_conflict=a=>(d._sqlite3_vtab_on_conflict=Z.yd)(a);d._sqlite3_vtab_config=(a,b,c)=>(d._sqlite3_vtab_config=Z.zd)(a,b,c);d._sqlite3_vtab_collation=(a,b)=>(d._sqlite3_vtab_collation=Z.Ad)(a,b);d._sqlite3_vtab_in=(a,b,c)=>(d._sqlite3_vtab_in=Z.Bd)(a,b,c);
|
||||
d._sqlite3_vtab_rhs_value=(a,b,c)=>(d._sqlite3_vtab_rhs_value=Z.Cd)(a,b,c);d._sqlite3_vtab_distinct=a=>(d._sqlite3_vtab_distinct=Z.Dd)(a);d._sqlite3_keyword_name=(a,b,c)=>(d._sqlite3_keyword_name=Z.Ed)(a,b,c);d._sqlite3_keyword_count=()=>(d._sqlite3_keyword_count=Z.Fd)();d._sqlite3_keyword_check=(a,b)=>(d._sqlite3_keyword_check=Z.Gd)(a,b);d._sqlite3_complete=a=>(d._sqlite3_complete=Z.Hd)(a);d._sqlite3_complete16=a=>(d._sqlite3_complete16=Z.Id)(a);d._sqlite3_libversion=()=>(d._sqlite3_libversion=Z.Jd)();
|
||||
d._sqlite3_libversion_number=()=>(d._sqlite3_libversion_number=Z.Kd)();d._sqlite3_threadsafe=()=>(d._sqlite3_threadsafe=Z.Ld)();d._sqlite3_initialize=()=>(d._sqlite3_initialize=Z.Md)();d._sqlite3_shutdown=()=>(d._sqlite3_shutdown=Z.Nd)();d._sqlite3_config=(a,b)=>(d._sqlite3_config=Z.Od)(a,b);d._sqlite3_db_mutex=a=>(d._sqlite3_db_mutex=Z.Pd)(a);d._sqlite3_db_release_memory=a=>(d._sqlite3_db_release_memory=Z.Qd)(a);d._sqlite3_db_cacheflush=a=>(d._sqlite3_db_cacheflush=Z.Rd)(a);
|
||||
d._sqlite3_db_config=(a,b,c)=>(d._sqlite3_db_config=Z.Sd)(a,b,c);d._sqlite3_last_insert_rowid=a=>(d._sqlite3_last_insert_rowid=Z.Td)(a);d._sqlite3_set_last_insert_rowid=(a,b,c)=>(d._sqlite3_set_last_insert_rowid=Z.Ud)(a,b,c);d._sqlite3_changes64=a=>(d._sqlite3_changes64=Z.Vd)(a);d._sqlite3_changes=a=>(d._sqlite3_changes=Z.Wd)(a);d._sqlite3_total_changes64=a=>(d._sqlite3_total_changes64=Z.Xd)(a);d._sqlite3_total_changes=a=>(d._sqlite3_total_changes=Z.Yd)(a);
|
||||
d._sqlite3_txn_state=(a,b)=>(d._sqlite3_txn_state=Z.Zd)(a,b);d._sqlite3_close=a=>(d._sqlite3_close=Z._d)(a);d._sqlite3_close_v2=a=>(d._sqlite3_close_v2=Z.$d)(a);d._sqlite3_busy_handler=(a,b,c)=>(d._sqlite3_busy_handler=Z.ae)(a,b,c);d._sqlite3_progress_handler=(a,b,c,e)=>(d._sqlite3_progress_handler=Z.be)(a,b,c,e);d._sqlite3_busy_timeout=(a,b)=>(d._sqlite3_busy_timeout=Z.ce)(a,b);d._sqlite3_interrupt=a=>(d._sqlite3_interrupt=Z.de)(a);d._sqlite3_is_interrupted=a=>(d._sqlite3_is_interrupted=Z.ee)(a);
|
||||
d._sqlite3_create_function=(a,b,c,e,f,h,k,n)=>(d._sqlite3_create_function=Z.fe)(a,b,c,e,f,h,k,n);d._sqlite3_create_function_v2=(a,b,c,e,f,h,k,n,l)=>(d._sqlite3_create_function_v2=Z.ge)(a,b,c,e,f,h,k,n,l);d._sqlite3_create_window_function=(a,b,c,e,f,h,k,n,l,m)=>(d._sqlite3_create_window_function=Z.he)(a,b,c,e,f,h,k,n,l,m);d._sqlite3_create_function16=(a,b,c,e,f,h,k,n)=>(d._sqlite3_create_function16=Z.ie)(a,b,c,e,f,h,k,n);
|
||||
d._sqlite3_overload_function=(a,b,c)=>(d._sqlite3_overload_function=Z.je)(a,b,c);d._sqlite3_trace_v2=(a,b,c,e)=>(d._sqlite3_trace_v2=Z.ke)(a,b,c,e);d._sqlite3_commit_hook=(a,b,c)=>(d._sqlite3_commit_hook=Z.le)(a,b,c);d._sqlite3_update_hook=(a,b,c)=>(d._sqlite3_update_hook=Z.me)(a,b,c);d._sqlite3_rollback_hook=(a,b,c)=>(d._sqlite3_rollback_hook=Z.ne)(a,b,c);d._sqlite3_autovacuum_pages=(a,b,c,e)=>(d._sqlite3_autovacuum_pages=Z.oe)(a,b,c,e);
|
||||
d._sqlite3_wal_autocheckpoint=(a,b)=>(d._sqlite3_wal_autocheckpoint=Z.pe)(a,b);d._sqlite3_wal_hook=(a,b,c)=>(d._sqlite3_wal_hook=Z.qe)(a,b,c);d._sqlite3_wal_checkpoint_v2=(a,b,c,e,f)=>(d._sqlite3_wal_checkpoint_v2=Z.re)(a,b,c,e,f);d._sqlite3_wal_checkpoint=(a,b)=>(d._sqlite3_wal_checkpoint=Z.se)(a,b);d._sqlite3_error_offset=a=>(d._sqlite3_error_offset=Z.te)(a);d._sqlite3_errmsg16=a=>(d._sqlite3_errmsg16=Z.ue)(a);d._sqlite3_errcode=a=>(d._sqlite3_errcode=Z.ve)(a);
|
||||
d._sqlite3_extended_errcode=a=>(d._sqlite3_extended_errcode=Z.we)(a);d._sqlite3_system_errno=a=>(d._sqlite3_system_errno=Z.xe)(a);d._sqlite3_errstr=a=>(d._sqlite3_errstr=Z.ye)(a);d._sqlite3_limit=(a,b,c)=>(d._sqlite3_limit=Z.ze)(a,b,c);d._sqlite3_open=(a,b)=>(d._sqlite3_open=Z.Ae)(a,b);d._sqlite3_open_v2=(a,b,c,e)=>(d._sqlite3_open_v2=Z.Be)(a,b,c,e);d._sqlite3_open16=(a,b)=>(d._sqlite3_open16=Z.Ce)(a,b);d._sqlite3_create_collation=(a,b,c,e,f)=>(d._sqlite3_create_collation=Z.De)(a,b,c,e,f);
|
||||
d._sqlite3_create_collation_v2=(a,b,c,e,f,h)=>(d._sqlite3_create_collation_v2=Z.Ee)(a,b,c,e,f,h);d._sqlite3_create_collation16=(a,b,c,e,f)=>(d._sqlite3_create_collation16=Z.Fe)(a,b,c,e,f);d._sqlite3_collation_needed=(a,b,c)=>(d._sqlite3_collation_needed=Z.Ge)(a,b,c);d._sqlite3_collation_needed16=(a,b,c)=>(d._sqlite3_collation_needed16=Z.He)(a,b,c);d._sqlite3_get_clientdata=(a,b)=>(d._sqlite3_get_clientdata=Z.Ie)(a,b);d._sqlite3_set_clientdata=(a,b,c,e)=>(d._sqlite3_set_clientdata=Z.Je)(a,b,c,e);
|
||||
d._sqlite3_get_autocommit=a=>(d._sqlite3_get_autocommit=Z.Ke)(a);d._sqlite3_table_column_metadata=(a,b,c,e,f,h,k,n,l)=>(d._sqlite3_table_column_metadata=Z.Le)(a,b,c,e,f,h,k,n,l);d._sqlite3_sleep=a=>(d._sqlite3_sleep=Z.Me)(a);d._sqlite3_extended_result_codes=(a,b)=>(d._sqlite3_extended_result_codes=Z.Ne)(a,b);d._sqlite3_file_control=(a,b,c,e)=>(d._sqlite3_file_control=Z.Oe)(a,b,c,e);d._sqlite3_test_control=(a,b)=>(d._sqlite3_test_control=Z.Pe)(a,b);
|
||||
d._sqlite3_create_filename=(a,b,c,e,f)=>(d._sqlite3_create_filename=Z.Qe)(a,b,c,e,f);d._sqlite3_free_filename=a=>(d._sqlite3_free_filename=Z.Re)(a);d._sqlite3_uri_parameter=(a,b)=>(d._sqlite3_uri_parameter=Z.Se)(a,b);d._sqlite3_uri_key=(a,b)=>(d._sqlite3_uri_key=Z.Te)(a,b);d._sqlite3_uri_boolean=(a,b,c)=>(d._sqlite3_uri_boolean=Z.Ue)(a,b,c);d._sqlite3_uri_int64=(a,b,c,e)=>(d._sqlite3_uri_int64=Z.Ve)(a,b,c,e);d._sqlite3_filename_database=a=>(d._sqlite3_filename_database=Z.We)(a);
|
||||
d._sqlite3_filename_journal=a=>(d._sqlite3_filename_journal=Z.Xe)(a);d._sqlite3_filename_wal=a=>(d._sqlite3_filename_wal=Z.Ye)(a);d._sqlite3_db_name=(a,b)=>(d._sqlite3_db_name=Z.Ze)(a,b);d._sqlite3_db_filename=(a,b)=>(d._sqlite3_db_filename=Z._e)(a,b);d._sqlite3_db_readonly=(a,b)=>(d._sqlite3_db_readonly=Z.$e)(a,b);d._sqlite3_compileoption_used=a=>(d._sqlite3_compileoption_used=Z.af)(a);d._sqlite3_compileoption_get=a=>(d._sqlite3_compileoption_get=Z.bf)(a);
|
||||
d._sqlite3_sourceid=()=>(d._sqlite3_sourceid=Z.cf)();d._sqlite3mc_config=(a,b,c)=>(d._sqlite3mc_config=Z.df)(a,b,c);d._sqlite3mc_cipher_count=()=>(d._sqlite3mc_cipher_count=Z.ef)();d._sqlite3mc_cipher_index=a=>(d._sqlite3mc_cipher_index=Z.ff)(a);d._sqlite3mc_cipher_name=a=>(d._sqlite3mc_cipher_name=Z.gf)(a);d._sqlite3mc_config_cipher=(a,b,c,e)=>(d._sqlite3mc_config_cipher=Z.hf)(a,b,c,e);d._sqlite3mc_codec_data=(a,b,c)=>(d._sqlite3mc_codec_data=Z.jf)(a,b,c);
|
||||
d._sqlite3_key=(a,b,c)=>(d._sqlite3_key=Z.kf)(a,b,c);d._sqlite3_key_v2=(a,b,c,e)=>(d._sqlite3_key_v2=Z.lf)(a,b,c,e);d._sqlite3_rekey_v2=(a,b,c,e)=>(d._sqlite3_rekey_v2=Z.mf)(a,b,c,e);d._sqlite3_rekey=(a,b,c)=>(d._sqlite3_rekey=Z.nf)(a,b,c);d._sqlite3mc_register_cipher=(a,b,c)=>(d._sqlite3mc_register_cipher=Z.of)(a,b,c);var Rc=()=>(Rc=Z.pf)(),Tb=d._malloc=a=>(Tb=d._malloc=Z.qf)(a);d._free=a=>(d._free=Z.rf)(a);d._RegisterExtensionFunctions=a=>(d._RegisterExtensionFunctions=Z.sf)(a);
|
||||
d._set_authorizer=a=>(d._set_authorizer=Z.tf)(a);d._create_function=(a,b,c,e,f,h)=>(d._create_function=Z.uf)(a,b,c,e,f,h);d._create_module=(a,b,c,e)=>(d._create_module=Z.vf)(a,b,c,e);d._progress_handler=(a,b)=>(d._progress_handler=Z.wf)(a,b);d._register_vfs=(a,b,c,e)=>(d._register_vfs=Z.xf)(a,b,c,e);d._getSqliteFree=()=>(d._getSqliteFree=Z.yf)();var Tc=d._main=(a,b)=>(Tc=d._main=Z.zf)(a,b),db=(a,b)=>(db=Z.Bf)(a,b),Uc=()=>(Uc=Z.Cf)(),Oc=()=>(Oc=Z.Df)(),Pc=a=>(Pc=Z.Ef)(a),Nc=a=>(Nc=Z.Ff)(a);
|
||||
d._sqlite3_version=11592;d.getTempRet0=Uc;d.ccall=Y;d.cwrap=(a,b,c,e)=>{var f=!c||c.every(h=>"number"===h||"boolean"===h);return"string"!==b&&f&&!e?d["_"+a]:function(){return Y(a,b,c,arguments,e)}};
|
||||
d.addFunction=(a,b)=>{if(!Lc){Lc=new WeakMap;var c=X.length;if(Lc)for(var e=0;e<0+c;e++){var f=e;var h=Kc[f];h||(f>=Kc.length&&(Kc.length=f+1),Kc[f]=h=X.get(f));(f=h)&&Lc.set(f,e)}}if(c=Lc.get(a)||0)return c;if(Mc.length)c=Mc.pop();else{try{X.grow(1)}catch(n){if(!(n instanceof RangeError))throw n;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";}c=X.length-1}try{e=c,X.set(e,a),Kc[e]=X.get(e)}catch(n){if(!(n instanceof TypeError))throw n;if("function"==typeof WebAssembly.Function){e=WebAssembly.Function;
|
||||
f={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"};h={parameters:[],results:"v"==b[0]?[]:[f[b[0]]]};for(var k=1;k<b.length;++k)h.parameters.push(f[b[k]]);b=new e(h,a)}else{e=[1];f=b.slice(0,1);b=b.slice(1);h={i:127,p:127,j:126,f:125,d:124,e:111};e.push(96);k=b.length;128>k?e.push(k):e.push(k%128|128,k>>7);for(k=0;k<b.length;++k)e.push(h[b[k]]);"v"==f?e.push(0):e.push(1,h[f]);b=[0,97,115,109,1,0,0,0,1];f=e.length;128>f?b.push(f):b.push(f%128|128,f>>7);b.push.apply(b,e);b.push(2,7,1,1,101,1,
|
||||
102,0,0,7,5,1,1,102,0,0);b=new WebAssembly.Module(new Uint8Array(b));b=(new WebAssembly.Instance(b,{e:{f:a}})).exports.f}e=c;X.set(e,b);Kc[e]=X.get(e)}Lc.set(a,c);return c};d.setValue=K;d.getValue=J;d.UTF8ToString=(a,b)=>a?M(w,a,b):"";d.stringToUTF8=(a,b,c)=>Ra(a,w,b,c);d.lengthBytesUTF8=Qa;d.intArrayFromString=Sa;d.intArrayToString=function(a){for(var b=[],c=0;c<a.length;c++){var e=a[c];255<e&&(e&=255);b.push(String.fromCharCode(e))}return b.join("")};
|
||||
d.AsciiToString=a=>{for(var b="";;){var c=w[a++>>0];if(!c)return b;b+=String.fromCharCode(c)}};d.UTF16ToString=(a,b)=>{var c=a>>1;for(var e=c+b/2;!(c>=e)&&oa[c];)++c;c<<=1;if(32<c-a&&Qc)return Qc.decode(w.subarray(a,c));c="";for(e=0;!(e>=b/2);++e){var f=x[a+2*e>>1];if(0==f)break;c+=String.fromCharCode(f)}return c};d.stringToUTF16=(a,b,c)=>{void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)x[b>>1]=a.charCodeAt(f),b+=2;x[b>>1]=0;return b-e};
|
||||
d.UTF32ToString=(a,b)=>{for(var c=0,e="";!(c>=b/4);){var f=y[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e};d.stringToUTF32=(a,b,c)=>{void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var h=a.charCodeAt(f);if(55296<=h&&57343>=h){var k=a.charCodeAt(++f);h=65536+((h&1023)<<10)|k&1023}y[b>>2]=h;b+=4;if(b+4>c)break}y[b>>2]=0;return b-e};d.writeArrayToMemory=(a,b)=>{v.set(a,b)};var Vc;
|
||||
ya=function Wc(){Vc||Xc();Vc||(ya=Wc)};
|
||||
function Xc(){function a(){if(!Vc&&(Vc=!0,d.calledRun=!0,!na)){d.noFSInit||Jb||(Jb=!0,Ib(),d.stdin=d.stdin,d.stdout=d.stdout,d.stderr=d.stderr,d.stdin?Kb("stdin",d.stdin):zb("/dev/tty","/dev/stdin"),d.stdout?Kb("stdout",null,d.stdout):zb("/dev/tty","/dev/stdout"),d.stderr?Kb("stderr",null,d.stderr):zb("/dev/tty1","/dev/stderr"),Fb("/dev/stdin",0),Fb("/dev/stdout",1),Fb("/dev/stderr",1));jb=!1;Ga(ta);Ga(ua);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(Yc){var b=Tc;try{var c=b(0,0);if(!Ha){if(d.onExit)d.onExit(c);
|
||||
d._sqlite3_blob_read=(a,b,c,e)=>(d._sqlite3_blob_read=Z.bd)(a,b,c,e);d._sqlite3_blob_write=(a,b,c,e)=>(d._sqlite3_blob_write=Z.cd)(a,b,c,e);d._sqlite3_blob_bytes=a=>(d._sqlite3_blob_bytes=Z.dd)(a);d._sqlite3_blob_reopen=(a,b,c)=>(d._sqlite3_blob_reopen=Z.ed)(a,b,c);d._sqlite3_set_authorizer=(a,b,c)=>(d._sqlite3_set_authorizer=Z.fd)(a,b,c);d._sqlite3_strglob=(a,b)=>(d._sqlite3_strglob=Z.gd)(a,b);d._sqlite3_strlike=(a,b,c)=>(d._sqlite3_strlike=Z.hd)(a,b,c);d._sqlite3_errmsg=a=>(d._sqlite3_errmsg=Z.id)(a);
|
||||
d._sqlite3_auto_extension=a=>(d._sqlite3_auto_extension=Z.jd)(a);d._sqlite3_cancel_auto_extension=a=>(d._sqlite3_cancel_auto_extension=Z.kd)(a);d._sqlite3_reset_auto_extension=()=>(d._sqlite3_reset_auto_extension=Z.ld)();d._sqlite3_prepare=(a,b,c,e,f)=>(d._sqlite3_prepare=Z.md)(a,b,c,e,f);d._sqlite3_prepare_v3=(a,b,c,e,f,h)=>(d._sqlite3_prepare_v3=Z.nd)(a,b,c,e,f,h);d._sqlite3_prepare16=(a,b,c,e,f)=>(d._sqlite3_prepare16=Z.od)(a,b,c,e,f);
|
||||
d._sqlite3_prepare16_v2=(a,b,c,e,f)=>(d._sqlite3_prepare16_v2=Z.pd)(a,b,c,e,f);d._sqlite3_prepare16_v3=(a,b,c,e,f,h)=>(d._sqlite3_prepare16_v3=Z.qd)(a,b,c,e,f,h);d._sqlite3_get_table=(a,b,c,e,f,h)=>(d._sqlite3_get_table=Z.rd)(a,b,c,e,f,h);d._sqlite3_free_table=a=>(d._sqlite3_free_table=Z.sd)(a);d._sqlite3_create_module=(a,b,c,e)=>(d._sqlite3_create_module=Z.td)(a,b,c,e);d._sqlite3_create_module_v2=(a,b,c,e,f)=>(d._sqlite3_create_module_v2=Z.ud)(a,b,c,e,f);
|
||||
d._sqlite3_drop_modules=(a,b)=>(d._sqlite3_drop_modules=Z.vd)(a,b);d._sqlite3_declare_vtab=(a,b)=>(d._sqlite3_declare_vtab=Z.wd)(a,b);d._sqlite3_vtab_on_conflict=a=>(d._sqlite3_vtab_on_conflict=Z.xd)(a);d._sqlite3_vtab_config=(a,b,c)=>(d._sqlite3_vtab_config=Z.yd)(a,b,c);d._sqlite3_vtab_collation=(a,b)=>(d._sqlite3_vtab_collation=Z.zd)(a,b);d._sqlite3_vtab_in=(a,b,c)=>(d._sqlite3_vtab_in=Z.Ad)(a,b,c);d._sqlite3_vtab_rhs_value=(a,b,c)=>(d._sqlite3_vtab_rhs_value=Z.Bd)(a,b,c);
|
||||
d._sqlite3_vtab_distinct=a=>(d._sqlite3_vtab_distinct=Z.Cd)(a);d._sqlite3_keyword_name=(a,b,c)=>(d._sqlite3_keyword_name=Z.Dd)(a,b,c);d._sqlite3_keyword_count=()=>(d._sqlite3_keyword_count=Z.Ed)();d._sqlite3_keyword_check=(a,b)=>(d._sqlite3_keyword_check=Z.Fd)(a,b);d._sqlite3_complete=a=>(d._sqlite3_complete=Z.Gd)(a);d._sqlite3_complete16=a=>(d._sqlite3_complete16=Z.Hd)(a);d._sqlite3_libversion=()=>(d._sqlite3_libversion=Z.Id)();d._sqlite3_libversion_number=()=>(d._sqlite3_libversion_number=Z.Jd)();
|
||||
d._sqlite3_threadsafe=()=>(d._sqlite3_threadsafe=Z.Kd)();d._sqlite3_initialize=()=>(d._sqlite3_initialize=Z.Ld)();d._sqlite3_shutdown=()=>(d._sqlite3_shutdown=Z.Md)();d._sqlite3_config=(a,b)=>(d._sqlite3_config=Z.Nd)(a,b);d._sqlite3_db_mutex=a=>(d._sqlite3_db_mutex=Z.Od)(a);d._sqlite3_db_release_memory=a=>(d._sqlite3_db_release_memory=Z.Pd)(a);d._sqlite3_db_cacheflush=a=>(d._sqlite3_db_cacheflush=Z.Qd)(a);d._sqlite3_db_config=(a,b,c)=>(d._sqlite3_db_config=Z.Rd)(a,b,c);
|
||||
d._sqlite3_last_insert_rowid=a=>(d._sqlite3_last_insert_rowid=Z.Sd)(a);d._sqlite3_set_last_insert_rowid=(a,b,c)=>(d._sqlite3_set_last_insert_rowid=Z.Td)(a,b,c);d._sqlite3_changes64=a=>(d._sqlite3_changes64=Z.Ud)(a);d._sqlite3_changes=a=>(d._sqlite3_changes=Z.Vd)(a);d._sqlite3_total_changes64=a=>(d._sqlite3_total_changes64=Z.Wd)(a);d._sqlite3_total_changes=a=>(d._sqlite3_total_changes=Z.Xd)(a);d._sqlite3_txn_state=(a,b)=>(d._sqlite3_txn_state=Z.Yd)(a,b);d._sqlite3_close=a=>(d._sqlite3_close=Z.Zd)(a);
|
||||
d._sqlite3_close_v2=a=>(d._sqlite3_close_v2=Z._d)(a);d._sqlite3_busy_handler=(a,b,c)=>(d._sqlite3_busy_handler=Z.$d)(a,b,c);d._sqlite3_progress_handler=(a,b,c,e)=>(d._sqlite3_progress_handler=Z.ae)(a,b,c,e);d._sqlite3_busy_timeout=(a,b)=>(d._sqlite3_busy_timeout=Z.be)(a,b);d._sqlite3_interrupt=a=>(d._sqlite3_interrupt=Z.ce)(a);d._sqlite3_is_interrupted=a=>(d._sqlite3_is_interrupted=Z.de)(a);d._sqlite3_create_function=(a,b,c,e,f,h,k,n)=>(d._sqlite3_create_function=Z.ee)(a,b,c,e,f,h,k,n);
|
||||
d._sqlite3_create_function_v2=(a,b,c,e,f,h,k,n,l)=>(d._sqlite3_create_function_v2=Z.fe)(a,b,c,e,f,h,k,n,l);d._sqlite3_create_window_function=(a,b,c,e,f,h,k,n,l,m)=>(d._sqlite3_create_window_function=Z.ge)(a,b,c,e,f,h,k,n,l,m);d._sqlite3_create_function16=(a,b,c,e,f,h,k,n)=>(d._sqlite3_create_function16=Z.he)(a,b,c,e,f,h,k,n);d._sqlite3_overload_function=(a,b,c)=>(d._sqlite3_overload_function=Z.ie)(a,b,c);d._sqlite3_trace_v2=(a,b,c,e)=>(d._sqlite3_trace_v2=Z.je)(a,b,c,e);
|
||||
d._sqlite3_commit_hook=(a,b,c)=>(d._sqlite3_commit_hook=Z.ke)(a,b,c);d._sqlite3_update_hook=(a,b,c)=>(d._sqlite3_update_hook=Z.le)(a,b,c);d._sqlite3_rollback_hook=(a,b,c)=>(d._sqlite3_rollback_hook=Z.me)(a,b,c);d._sqlite3_autovacuum_pages=(a,b,c,e)=>(d._sqlite3_autovacuum_pages=Z.ne)(a,b,c,e);d._sqlite3_wal_autocheckpoint=(a,b)=>(d._sqlite3_wal_autocheckpoint=Z.oe)(a,b);d._sqlite3_wal_hook=(a,b,c)=>(d._sqlite3_wal_hook=Z.pe)(a,b,c);
|
||||
d._sqlite3_wal_checkpoint_v2=(a,b,c,e,f)=>(d._sqlite3_wal_checkpoint_v2=Z.qe)(a,b,c,e,f);d._sqlite3_wal_checkpoint=(a,b)=>(d._sqlite3_wal_checkpoint=Z.re)(a,b);d._sqlite3_error_offset=a=>(d._sqlite3_error_offset=Z.se)(a);d._sqlite3_errmsg16=a=>(d._sqlite3_errmsg16=Z.te)(a);d._sqlite3_errcode=a=>(d._sqlite3_errcode=Z.ue)(a);d._sqlite3_extended_errcode=a=>(d._sqlite3_extended_errcode=Z.ve)(a);d._sqlite3_system_errno=a=>(d._sqlite3_system_errno=Z.we)(a);d._sqlite3_errstr=a=>(d._sqlite3_errstr=Z.xe)(a);
|
||||
d._sqlite3_limit=(a,b,c)=>(d._sqlite3_limit=Z.ye)(a,b,c);d._sqlite3_open=(a,b)=>(d._sqlite3_open=Z.ze)(a,b);d._sqlite3_open_v2=(a,b,c,e)=>(d._sqlite3_open_v2=Z.Ae)(a,b,c,e);d._sqlite3_open16=(a,b)=>(d._sqlite3_open16=Z.Be)(a,b);d._sqlite3_create_collation=(a,b,c,e,f)=>(d._sqlite3_create_collation=Z.Ce)(a,b,c,e,f);d._sqlite3_create_collation_v2=(a,b,c,e,f,h)=>(d._sqlite3_create_collation_v2=Z.De)(a,b,c,e,f,h);d._sqlite3_create_collation16=(a,b,c,e,f)=>(d._sqlite3_create_collation16=Z.Ee)(a,b,c,e,f);
|
||||
d._sqlite3_collation_needed=(a,b,c)=>(d._sqlite3_collation_needed=Z.Fe)(a,b,c);d._sqlite3_collation_needed16=(a,b,c)=>(d._sqlite3_collation_needed16=Z.Ge)(a,b,c);d._sqlite3_get_clientdata=(a,b)=>(d._sqlite3_get_clientdata=Z.He)(a,b);d._sqlite3_set_clientdata=(a,b,c,e)=>(d._sqlite3_set_clientdata=Z.Ie)(a,b,c,e);d._sqlite3_get_autocommit=a=>(d._sqlite3_get_autocommit=Z.Je)(a);d._sqlite3_table_column_metadata=(a,b,c,e,f,h,k,n,l)=>(d._sqlite3_table_column_metadata=Z.Ke)(a,b,c,e,f,h,k,n,l);
|
||||
d._sqlite3_sleep=a=>(d._sqlite3_sleep=Z.Le)(a);d._sqlite3_extended_result_codes=(a,b)=>(d._sqlite3_extended_result_codes=Z.Me)(a,b);d._sqlite3_file_control=(a,b,c,e)=>(d._sqlite3_file_control=Z.Ne)(a,b,c,e);d._sqlite3_test_control=(a,b)=>(d._sqlite3_test_control=Z.Oe)(a,b);d._sqlite3_create_filename=(a,b,c,e,f)=>(d._sqlite3_create_filename=Z.Pe)(a,b,c,e,f);d._sqlite3_free_filename=a=>(d._sqlite3_free_filename=Z.Qe)(a);d._sqlite3_uri_parameter=(a,b)=>(d._sqlite3_uri_parameter=Z.Re)(a,b);
|
||||
d._sqlite3_uri_key=(a,b)=>(d._sqlite3_uri_key=Z.Se)(a,b);d._sqlite3_uri_boolean=(a,b,c)=>(d._sqlite3_uri_boolean=Z.Te)(a,b,c);d._sqlite3_uri_int64=(a,b,c,e)=>(d._sqlite3_uri_int64=Z.Ue)(a,b,c,e);d._sqlite3_filename_database=a=>(d._sqlite3_filename_database=Z.Ve)(a);d._sqlite3_filename_journal=a=>(d._sqlite3_filename_journal=Z.We)(a);d._sqlite3_filename_wal=a=>(d._sqlite3_filename_wal=Z.Xe)(a);d._sqlite3_db_name=(a,b)=>(d._sqlite3_db_name=Z.Ye)(a,b);
|
||||
d._sqlite3_db_filename=(a,b)=>(d._sqlite3_db_filename=Z.Ze)(a,b);d._sqlite3_db_readonly=(a,b)=>(d._sqlite3_db_readonly=Z._e)(a,b);d._sqlite3_compileoption_used=a=>(d._sqlite3_compileoption_used=Z.$e)(a);d._sqlite3_compileoption_get=a=>(d._sqlite3_compileoption_get=Z.af)(a);d._sqlite3_sourceid=()=>(d._sqlite3_sourceid=Z.bf)();d._sqlite3mc_config=(a,b,c)=>(d._sqlite3mc_config=Z.cf)(a,b,c);d._sqlite3mc_cipher_count=()=>(d._sqlite3mc_cipher_count=Z.df)();
|
||||
d._sqlite3mc_cipher_index=a=>(d._sqlite3mc_cipher_index=Z.ef)(a);d._sqlite3mc_cipher_name=a=>(d._sqlite3mc_cipher_name=Z.ff)(a);d._sqlite3mc_config_cipher=(a,b,c,e)=>(d._sqlite3mc_config_cipher=Z.gf)(a,b,c,e);d._sqlite3mc_codec_data=(a,b,c)=>(d._sqlite3mc_codec_data=Z.hf)(a,b,c);d._sqlite3_key=(a,b,c)=>(d._sqlite3_key=Z.jf)(a,b,c);d._sqlite3_key_v2=(a,b,c,e)=>(d._sqlite3_key_v2=Z.kf)(a,b,c,e);d._sqlite3_rekey_v2=(a,b,c,e)=>(d._sqlite3_rekey_v2=Z.lf)(a,b,c,e);
|
||||
d._sqlite3_rekey=(a,b,c)=>(d._sqlite3_rekey=Z.mf)(a,b,c);d._sqlite3mc_register_cipher=(a,b,c)=>(d._sqlite3mc_register_cipher=Z.nf)(a,b,c);var Qc=()=>(Qc=Z.of)(),Sb=d._malloc=a=>(Sb=d._malloc=Z.pf)(a);d._free=a=>(d._free=Z.qf)(a);d._RegisterExtensionFunctions=a=>(d._RegisterExtensionFunctions=Z.rf)(a);d._set_authorizer=a=>(d._set_authorizer=Z.sf)(a);d._create_function=(a,b,c,e,f,h)=>(d._create_function=Z.tf)(a,b,c,e,f,h);d._create_module=(a,b,c,e)=>(d._create_module=Z.uf)(a,b,c,e);
|
||||
d._progress_handler=(a,b)=>(d._progress_handler=Z.vf)(a,b);d._register_vfs=(a,b,c,e)=>(d._register_vfs=Z.wf)(a,b,c,e);d._getSqliteFree=()=>(d._getSqliteFree=Z.xf)();var Sc=d._main=(a,b)=>(Sc=d._main=Z.yf)(a,b),cb=(a,b)=>(cb=Z.Af)(a,b),Tc=()=>(Tc=Z.Bf)(),Nc=()=>(Nc=Z.Cf)(),Oc=a=>(Oc=Z.Df)(a),Mc=a=>(Mc=Z.Ef)(a);d._sqlite3_version=3232;d.getTempRet0=Tc;d.ccall=Y;
|
||||
d.cwrap=(a,b,c,e)=>{var f=!c||c.every(h=>"number"===h||"boolean"===h);return"string"!==b&&f&&!e?d["_"+a]:function(){return Y(a,b,c,arguments,e)}};
|
||||
d.addFunction=(a,b)=>{if(!Kc){Kc=new WeakMap;var c=Jc.length;if(Kc)for(var e=0;e<0+c;e++){var f=Jc.get(e);f&&Kc.set(f,e)}}if(c=Kc.get(a)||0)return c;if(Lc.length)c=Lc.pop();else{try{Jc.grow(1)}catch(n){if(!(n instanceof RangeError))throw n;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";}c=Jc.length-1}try{Jc.set(c,a)}catch(n){if(!(n instanceof TypeError))throw n;if("function"==typeof WebAssembly.Function){e=WebAssembly.Function;f={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"};for(var h=
|
||||
{parameters:[],results:"v"==b[0]?[]:[f[b[0]]]},k=1;k<b.length;++k)h.parameters.push(f[b[k]]);b=new e(h,a)}else{e=[1];f=b.slice(0,1);b=b.slice(1);h={i:127,p:127,j:126,f:125,d:124,e:111};e.push(96);k=b.length;128>k?e.push(k):e.push(k%128|128,k>>7);for(k=0;k<b.length;++k)e.push(h[b[k]]);"v"==f?e.push(0):e.push(1,h[f]);b=[0,97,115,109,1,0,0,0,1];f=e.length;128>f?b.push(f):b.push(f%128|128,f>>7);b.push.apply(b,e);b.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);b=new WebAssembly.Module(new Uint8Array(b));
|
||||
b=(new WebAssembly.Instance(b,{e:{f:a}})).exports.f}Jc.set(c,b)}Kc.set(a,c);return c};d.setValue=K;d.getValue=J;d.UTF8ToString=(a,b)=>a?M(w,a,b):"";d.stringToUTF8=(a,b,c)=>Qa(a,w,b,c);d.lengthBytesUTF8=O;d.intArrayFromString=Ra;d.intArrayToString=function(a){for(var b=[],c=0;c<a.length;c++){var e=a[c];255<e&&(e&=255);b.push(String.fromCharCode(e))}return b.join("")};d.AsciiToString=a=>{for(var b="";;){var c=w[a++>>0];if(!c)return b;b+=String.fromCharCode(c)}};
|
||||
d.UTF16ToString=(a,b)=>{var c=a>>1;for(var e=c+b/2;!(c>=e)&&oa[c];)++c;c<<=1;if(32<c-a&&Pc)return Pc.decode(w.subarray(a,c));c="";for(e=0;!(e>=b/2);++e){var f=x[a+2*e>>1];if(0==f)break;c+=String.fromCharCode(f)}return c};d.stringToUTF16=(a,b,c)=>{void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)x[b>>1]=a.charCodeAt(f),b+=2;x[b>>1]=0;return b-e};
|
||||
d.UTF32ToString=(a,b)=>{for(var c=0,e="";!(c>=b/4);){var f=y[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e};d.stringToUTF32=(a,b,c)=>{void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var h=a.charCodeAt(f);if(55296<=h&&57343>=h){var k=a.charCodeAt(++f);h=65536+((h&1023)<<10)|k&1023}y[b>>2]=h;b+=4;if(b+4>c)break}y[b>>2]=0;return b-e};d.writeArrayToMemory=(a,b)=>{v.set(a,b)};var Uc;
|
||||
ya=function Vc(){Uc||Wc();Uc||(ya=Vc)};
|
||||
function Wc(){function a(){if(!Uc&&(Uc=!0,d.calledRun=!0,!na)){d.noFSInit||Ib||(Ib=!0,Hb(),d.stdin=d.stdin,d.stdout=d.stdout,d.stderr=d.stderr,d.stdin?Jb("stdin",d.stdin):yb("/dev/tty","/dev/stdin"),d.stdout?Jb("stdout",null,d.stdout):yb("/dev/tty","/dev/stdout"),d.stderr?Jb("stderr",null,d.stderr):yb("/dev/tty1","/dev/stderr"),Eb("/dev/stdin",0),Eb("/dev/stdout",1),Eb("/dev/stderr",1));ib=!1;Ga(ta);Ga(ua);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(Xc){var b=Sc;try{var c=b(0,0);if(!Ha){if(d.onExit)d.onExit(c);
|
||||
na=!0}ea(c,new Fa(c))}catch(e){e instanceof Fa||"unwind"==e||ea(1,e)}}if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;)b=d.postRun.shift(),va.unshift(b);Ga(va)}}if(!(0<C)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)wa();Ga(sa);0<C||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}
|
||||
if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();var Yc=!0;d.noInitialRun&&(Yc=!1);Xc();
|
||||
if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();var Xc=!0;d.noInitialRun&&(Xc=!1);Wc();
|
||||
|
||||
|
||||
return moduleArg.ready
|
||||
|
||||
Binary file not shown.
@@ -16,30 +16,37 @@ GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { immerable, setAutoFreeze } from "immer";
|
||||
|
||||
import { create } from "zustand";
|
||||
import {
|
||||
subscribeWithSelector,
|
||||
persist,
|
||||
PersistOptions
|
||||
} from "zustand/middleware";
|
||||
import { immer } from "zustand/middleware/immer";
|
||||
import { GetState, IStore, SetState } from "../stores";
|
||||
setAutoFreeze(false);
|
||||
import { mutative } from "zustand-mutative";
|
||||
|
||||
export function createStore<T>(
|
||||
getStore: (set: SetState<T>, get: GetState<T>) => T
|
||||
) {
|
||||
const store = create<
|
||||
T,
|
||||
[["zustand/subscribeWithSelector", never], ["zustand/immer", never]]
|
||||
[["zustand/subscribeWithSelector", never], ["zustand/mutative", never]]
|
||||
>(
|
||||
subscribeWithSelector(
|
||||
immer((set, get) => {
|
||||
const store = getStore(set, get);
|
||||
(store as any)[immerable] = true;
|
||||
return store;
|
||||
})
|
||||
mutative(
|
||||
(set, get) => {
|
||||
const store = getStore(set, get);
|
||||
return store;
|
||||
},
|
||||
{
|
||||
strict: import.meta.env.DEV,
|
||||
mark: (target, { mutable, immutable }) => {
|
||||
if (!target || typeof target !== "object") return mutable;
|
||||
return immutable;
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
return [store, store.getState()] as const;
|
||||
@@ -54,16 +61,24 @@ export function createPersistedStore<T extends object>(
|
||||
[
|
||||
["zustand/persist", Partial<T>],
|
||||
["zustand/subscribeWithSelector", never],
|
||||
["zustand/immer", never]
|
||||
["zustand/mutative", never]
|
||||
]
|
||||
>(
|
||||
persist(
|
||||
subscribeWithSelector(
|
||||
immer((set, get) => {
|
||||
const store = new Store(set, get);
|
||||
(store as any)[immerable] = true;
|
||||
return store;
|
||||
})
|
||||
mutative(
|
||||
(set, get) => {
|
||||
const store = new Store(set, get);
|
||||
return store;
|
||||
},
|
||||
{
|
||||
strict: import.meta.env.DEV,
|
||||
mark: (target, { mutable, immutable }) => {
|
||||
if (!target || typeof target !== "object") return mutable;
|
||||
return immutable;
|
||||
}
|
||||
}
|
||||
)
|
||||
),
|
||||
options
|
||||
)
|
||||
|
||||
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ProgressDialog } from "../dialogs/progress-dialog";
|
||||
import { removeStatus, updateStatus } from "../hooks/use-status";
|
||||
import { showProgressDialog } from "./dialog-controller";
|
||||
|
||||
type TaskType = "status" | "modal";
|
||||
type TaskAction<T> = (report: ProgressReportCallback) => T | Promise<T>;
|
||||
@@ -74,11 +74,11 @@ export class TaskManager {
|
||||
return result;
|
||||
}
|
||||
case "modal": {
|
||||
return await showProgressDialog<T | Error>({
|
||||
return (await ProgressDialog.show({
|
||||
title: task.title,
|
||||
subtitle: task.subtitle,
|
||||
action: task.action
|
||||
});
|
||||
})) as T;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { db } from "./db";
|
||||
import { showPasswordDialog } from "./dialog-controller";
|
||||
import { showPasswordDialog } from "../dialogs/password-dialog";
|
||||
import { showToast } from "../utils/toast";
|
||||
import { VAULT_ERRORS } from "@notesnook/core/dist/api/vault";
|
||||
|
||||
|
||||
@@ -24,10 +24,6 @@ import {
|
||||
Image as RebassImage,
|
||||
Text as RebassText
|
||||
} from "@theme-ui/components";
|
||||
import {
|
||||
closeOpenedDialog,
|
||||
showBuyDialog
|
||||
} from "../../common/dialog-controller";
|
||||
import { ANALYTICS_EVENTS, trackEvent } from "../../utils/analytics";
|
||||
import {
|
||||
Sync,
|
||||
@@ -43,6 +39,8 @@ import { store as appStore } from "../../stores/app-store";
|
||||
import { createBackup } from "../../common";
|
||||
import { allowedPlatforms } from "../../stores/announcement-store";
|
||||
import { alpha } from "@theme-ui/color";
|
||||
import { BuyDialog } from "../../dialogs/buy-dialog/buy-dialog";
|
||||
import { DialogManager } from "../../common/dialog-manager";
|
||||
|
||||
var margins = [0, 2];
|
||||
var HORIZONTAL_MARGIN = 3;
|
||||
@@ -285,7 +283,7 @@ function CalltoAction({ action, variant, sx, dismissAnnouncement }) {
|
||||
sx={sx}
|
||||
onClick={async () => {
|
||||
if (dismissAnnouncement) dismissAnnouncement();
|
||||
closeOpenedDialog();
|
||||
DialogManager.closeAll();
|
||||
trackEvent(ANALYTICS_EVENTS.announcementCta, action);
|
||||
switch (action.type) {
|
||||
case "link": {
|
||||
@@ -299,7 +297,7 @@ function CalltoAction({ action, variant, sx, dismissAnnouncement }) {
|
||||
}
|
||||
case "promo": {
|
||||
const [coupon, plan] = action.data.split(":");
|
||||
await showBuyDialog(plan, coupon);
|
||||
await BuyDialog.show({ plan, coupon });
|
||||
break;
|
||||
}
|
||||
case "force-sync": {
|
||||
|
||||
@@ -38,10 +38,6 @@ import {
|
||||
Reupload,
|
||||
Uploading
|
||||
} from "../icons";
|
||||
import {
|
||||
closeOpenedDialog,
|
||||
showPromptDialog
|
||||
} from "../../common/dialog-controller";
|
||||
import { store, useStore } from "../../stores/attachment-store";
|
||||
import { db } from "../../common/db";
|
||||
import { saveAttachment } from "../../common/attachments";
|
||||
@@ -59,6 +55,8 @@ import { getFormattedDate } from "@notesnook/common";
|
||||
import { MenuItem } from "@notesnook/ui";
|
||||
import { Attachment as AttachmentType } from "@notesnook/core";
|
||||
import { useEditorStore } from "../../stores/editor-store";
|
||||
import { PromptDialog } from "../../dialogs/prompt";
|
||||
import { DialogManager } from "../../common/dialog-manager";
|
||||
|
||||
const FILE_ICONS: Record<string, Icon> = {
|
||||
"image/": FileImage,
|
||||
@@ -158,8 +156,7 @@ export function Attachment({
|
||||
<td>
|
||||
<Flex
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
maxWidth: compact ? 180 : "95%"
|
||||
alignItems: "center"
|
||||
}}
|
||||
>
|
||||
{status ? (
|
||||
@@ -211,7 +208,12 @@ export function Attachment({
|
||||
<Text
|
||||
as="td"
|
||||
variant="body"
|
||||
sx={{ color: status ? "accent" : "paragraph" }}
|
||||
sx={{
|
||||
color: status ? "accent" : "paragraph",
|
||||
whiteSpace: "nowrap",
|
||||
overflow: "hidden",
|
||||
textOverflow: "ellipsis"
|
||||
}}
|
||||
>
|
||||
{status ? (
|
||||
<>
|
||||
@@ -259,7 +261,7 @@ const AttachmentMenuItems: (
|
||||
title: note.title,
|
||||
onClick: () => {
|
||||
useEditorStore.getState().openSession(note.id);
|
||||
closeOpenedDialog();
|
||||
DialogManager.closeAll();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -291,7 +293,7 @@ const AttachmentMenuItems: (
|
||||
title: "Rename",
|
||||
icon: Rename.path,
|
||||
onClick: async () => {
|
||||
const newName = await showPromptDialog({
|
||||
const newName = await PromptDialog.show({
|
||||
title: "Rename attachment",
|
||||
description: attachment.filename,
|
||||
defaultValue: attachment.filename
|
||||
|
||||
@@ -281,21 +281,21 @@ function TabStrip() {
|
||||
items={sessions}
|
||||
moveItem={(from, to) => {
|
||||
if (from === to) return;
|
||||
useEditorStore.setState((state) => {
|
||||
const isToPinned = state.sessions[to].pinned;
|
||||
const [fromTab] = state.sessions.splice(from, 1);
|
||||
const sessions = useEditorStore.getState().sessions.slice();
|
||||
const isToPinned = sessions[to].pinned;
|
||||
const [fromTab] = sessions.splice(from, 1);
|
||||
|
||||
// if the tab where this tab is being dropped is pinned,
|
||||
// let's pin our tab too.
|
||||
if (isToPinned) {
|
||||
fromTab.pinned = true;
|
||||
fromTab.preview = false;
|
||||
}
|
||||
// unpin the tab if it is moved.
|
||||
else if (fromTab.pinned) fromTab.pinned = false;
|
||||
// if the tab where this tab is being dropped is pinned,
|
||||
// let's pin our tab too.
|
||||
if (isToPinned) {
|
||||
fromTab.pinned = true;
|
||||
fromTab.preview = false;
|
||||
}
|
||||
// unpin the tab if it is moved.
|
||||
else if (fromTab.pinned) fromTab.pinned = false;
|
||||
|
||||
state.sessions.splice(to, 0, fromTab);
|
||||
});
|
||||
sessions.splice(to, 0, fromTab);
|
||||
useEditorStore.setState({ sessions });
|
||||
}}
|
||||
renderItem={({ item: session, index: i }) => (
|
||||
<Tab
|
||||
|
||||
@@ -34,36 +34,28 @@ import { Tag } from "@notesnook/core";
|
||||
type HeaderProps = { readonly: boolean; id: string };
|
||||
function Header(props: HeaderProps) {
|
||||
const { readonly, id } = props;
|
||||
const session = useEditorStore((store) =>
|
||||
store.getActiveSession(["default", "readonly"])
|
||||
const tags = useEditorStore(
|
||||
(store) => store.getActiveSession(["default", "readonly"])?.tags
|
||||
);
|
||||
const tags = session?.tags || [];
|
||||
const refreshTags = useEditorStore((store) => store.refreshTags);
|
||||
|
||||
useEffect(() => {
|
||||
refreshTags();
|
||||
}, [id, refreshTags, session?.type]);
|
||||
|
||||
const setTag = useCallback(
|
||||
async function (noteId: string, tags: Tag[], value: string) {
|
||||
const oldTag = tags.find((t) => t.title === value);
|
||||
if (oldTag) {
|
||||
await db.relations.unlink(oldTag, { type: "note", id: noteId });
|
||||
} else {
|
||||
const id =
|
||||
(await db.tags.find(value))?.id ??
|
||||
(await db.tags.add({ title: value }));
|
||||
await db.relations.add(
|
||||
{ id, type: "tag" },
|
||||
{ type: "note", id: noteId }
|
||||
);
|
||||
await useTagStore.getState().refresh();
|
||||
}
|
||||
await refreshTags();
|
||||
await useNoteStore.getState().refresh();
|
||||
},
|
||||
[refreshTags]
|
||||
);
|
||||
const setTag = useCallback(async function (
|
||||
noteId: string,
|
||||
tags: Tag[],
|
||||
value: string
|
||||
) {
|
||||
const oldTag = tags.find((t) => t.title === value);
|
||||
if (oldTag) {
|
||||
await db.relations.unlink(oldTag, { type: "note", id: noteId });
|
||||
} else {
|
||||
const id =
|
||||
(await db.tags.find(value))?.id ??
|
||||
(await db.tags.add({ title: value }));
|
||||
await db.relations.add({ id, type: "tag" }, { type: "note", id: noteId });
|
||||
await useTagStore.getState().refresh();
|
||||
}
|
||||
await useNoteStore.getState().refresh();
|
||||
},
|
||||
[]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -82,7 +74,7 @@ function Header(props: HeaderProps) {
|
||||
styles={{ container: { mr: 1 }, text: { fontSize: "body" } }}
|
||||
/>
|
||||
))}
|
||||
{!!session && !readonly && tags ? (
|
||||
{!readonly && tags ? (
|
||||
<Autosuggest
|
||||
sessionId={id}
|
||||
filter={(query) => db.lookup.tags(query).items(10)}
|
||||
|
||||
@@ -64,12 +64,12 @@ import { Freeze } from "react-freeze";
|
||||
import { UnlockView } from "../unlock";
|
||||
import DiffViewer from "../diff-viewer";
|
||||
import TableOfContents from "./table-of-contents";
|
||||
import { showNoteLinkingDialog } from "../../common/dialog-controller";
|
||||
import { scrollIntoViewById } from "@notesnook/editor";
|
||||
import { IEditor } from "./types";
|
||||
import { EditorActionBar } from "./action-bar";
|
||||
import { logger } from "../../utils/logger";
|
||||
import { PanelGroup, Panel, PanelResizeHandle } from "react-resizable-panels";
|
||||
import { NoteLinkingDialog } from "../../dialogs/note-linking-dialog";
|
||||
|
||||
const PDFPreview = React.lazy(() => import("../pdf-preview"));
|
||||
|
||||
@@ -545,8 +545,8 @@ export function Editor(props: EditorProps) {
|
||||
result.forEach((attachment) => editor?.attachFile(attachment));
|
||||
}}
|
||||
onInsertInternalLink={async (attributes) => {
|
||||
const link = await showNoteLinkingDialog(attributes);
|
||||
return link;
|
||||
const link = await NoteLinkingDialog.show({ attributes });
|
||||
return link || undefined;
|
||||
}}
|
||||
>
|
||||
{headless ? null : (
|
||||
@@ -763,13 +763,23 @@ function restoreScrollPosition(session: EditorSession) {
|
||||
const scrollContainer = document.getElementById(`editorScroll_${session.id}`);
|
||||
const scrollPosition = Config.get(`${session.id}:scroll-position`, 0);
|
||||
if (scrollContainer) {
|
||||
setTimeout(() => {
|
||||
requestAnimationFrame(() => {
|
||||
if (scrollContainer.scrollHeight < scrollPosition)
|
||||
scrollContainer.style.minHeight = `${scrollPosition + 100}px`;
|
||||
scrollContainer.scrollTop = scrollPosition;
|
||||
if (scrollContainer.scrollHeight < scrollPosition) {
|
||||
const observer = new ResizeObserver(() => {
|
||||
if (scrollContainer.scrollHeight >= scrollPosition) {
|
||||
observer.disconnect();
|
||||
requestAnimationFrame(
|
||||
() => (scrollContainer.scrollTop = scrollPosition)
|
||||
);
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
});
|
||||
});
|
||||
observer.observe(scrollContainer);
|
||||
// eslint-disable-next-line no-var
|
||||
var timeout = setTimeout(() => {
|
||||
observer.disconnect();
|
||||
}, 30 * 1000);
|
||||
} else
|
||||
requestAnimationFrame(() => (scrollContainer.scrollTop = scrollPosition));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,22 +20,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import { SerializedKey } from "@notesnook/crypto/dist/src/types";
|
||||
import { AppEventManager, AppEvents } from "../../common/app-events";
|
||||
import { db } from "../../common/db";
|
||||
import {
|
||||
showBuyDialog,
|
||||
showImagePickerDialog
|
||||
} from "../../common/dialog-controller";
|
||||
import { TaskManager } from "../../common/task-manager";
|
||||
import { isUserPremium } from "../../hooks/use-is-user-premium";
|
||||
import { showToast } from "../../utils/toast";
|
||||
import { showFilePicker } from "../../utils/file-picker";
|
||||
import { Attachment } from "@notesnook/editor";
|
||||
import { ImagePickerDialog } from "../../dialogs/image-picker-dialog";
|
||||
import { BuyDialog } from "../../dialogs/buy-dialog";
|
||||
|
||||
const FILE_SIZE_LIMIT = 500 * 1024 * 1024;
|
||||
const IMAGE_SIZE_LIMIT = 50 * 1024 * 1024;
|
||||
|
||||
export async function insertAttachments(type = "*/*") {
|
||||
if (!isUserPremium()) {
|
||||
await showBuyDialog();
|
||||
await BuyDialog.show({});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -49,14 +47,17 @@ export async function insertAttachments(type = "*/*") {
|
||||
|
||||
export async function attachFiles(files: File[]) {
|
||||
if (!isUserPremium()) {
|
||||
await showBuyDialog();
|
||||
await BuyDialog.show({});
|
||||
return;
|
||||
}
|
||||
|
||||
const images =
|
||||
(await showImagePickerDialog(
|
||||
files.filter((f) => f.type.startsWith("image/"))
|
||||
)) || [];
|
||||
let images = files.filter((f) => f.type.startsWith("image/"));
|
||||
images =
|
||||
images.length > 0
|
||||
? (await ImagePickerDialog.show({
|
||||
images
|
||||
})) || []
|
||||
: [];
|
||||
const documents = files.filter((f) => !f.type.startsWith("image/"));
|
||||
const attachments: Attachment[] = [];
|
||||
for (const file of [...images, ...documents]) {
|
||||
|
||||
@@ -48,7 +48,6 @@ import {
|
||||
import { IEditor, MAX_AUTO_SAVEABLE_WORDS } from "./types";
|
||||
import { useEditorConfig, useToolbarConfig, useEditorManager } from "./manager";
|
||||
import { useIsUserPremium } from "../../hooks/use-is-user-premium";
|
||||
import { showBuyDialog } from "../../common/dialog-controller";
|
||||
import { useStore as useSettingsStore } from "../../stores/setting-store";
|
||||
import { debounce } from "@notesnook/common";
|
||||
import { ScopedThemeProvider } from "../theme-provider";
|
||||
@@ -61,6 +60,8 @@ import { parseInternalLink } from "@notesnook/core";
|
||||
import Skeleton from "react-loading-skeleton";
|
||||
import useMobile from "../../hooks/use-mobile";
|
||||
import useTablet from "../../hooks/use-tablet";
|
||||
import { TimeFormat } from "@notesnook/core/dist/utils/date";
|
||||
import { BuyDialog } from "../../dialogs/buy-dialog";
|
||||
|
||||
export type OnChangeHandler = (
|
||||
content: () => string,
|
||||
@@ -95,6 +96,11 @@ type TipTapProps = {
|
||||
downloadOptions?: DownloadOptions;
|
||||
fontSize: number;
|
||||
fontFamily: string;
|
||||
|
||||
doubleSpacedLines: boolean;
|
||||
dateFormat: string;
|
||||
timeFormat: TimeFormat;
|
||||
markdownShortcuts: boolean;
|
||||
};
|
||||
|
||||
function updateWordCount(id: string, content: () => Fragment) {
|
||||
@@ -133,19 +139,15 @@ function TipTap(props: TipTapProps) {
|
||||
isTablet,
|
||||
downloadOptions,
|
||||
fontSize,
|
||||
fontFamily
|
||||
fontFamily,
|
||||
doubleSpacedLines,
|
||||
dateFormat,
|
||||
timeFormat,
|
||||
markdownShortcuts
|
||||
} = props;
|
||||
|
||||
const isUserPremium = useIsUserPremium();
|
||||
const autoSave = useRef(true);
|
||||
const doubleSpacedLines = useSettingsStore(
|
||||
(store) => store.doubleSpacedParagraphs
|
||||
);
|
||||
const dateFormat = useSettingsStore((store) => store.dateFormat);
|
||||
const timeFormat = useSettingsStore((store) => store.timeFormat);
|
||||
const markdownShortcuts = useSettingsStore(
|
||||
(store) => store.markdownShortcuts
|
||||
);
|
||||
const { toolbarConfig } = useToolbarConfig();
|
||||
|
||||
usePermissionHandler({
|
||||
@@ -153,7 +155,7 @@ function TipTap(props: TipTapProps) {
|
||||
premium: isUserPremium
|
||||
},
|
||||
onPermissionDenied: (claim) => {
|
||||
if (claim === "premium") showBuyDialog();
|
||||
if (claim === "premium") BuyDialog.show({});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -382,7 +384,17 @@ function TipTap(props: TipTapProps) {
|
||||
|
||||
function TiptapWrapper(
|
||||
props: PropsWithChildren<
|
||||
Omit<TipTapProps, "editorContainer" | "theme" | "fontSize" | "fontFamily">
|
||||
Omit<
|
||||
TipTapProps,
|
||||
| "editorContainer"
|
||||
| "theme"
|
||||
| "fontSize"
|
||||
| "fontFamily"
|
||||
| "doubleSpacedLines"
|
||||
| "dateFormat"
|
||||
| "timeFormat"
|
||||
| "markdownShortcuts"
|
||||
>
|
||||
> & {
|
||||
isHydrating?: boolean;
|
||||
}
|
||||
@@ -391,6 +403,14 @@ function TiptapWrapper(
|
||||
const theme = useThemeStore((store) =>
|
||||
store.colorScheme === "dark" ? store.darkTheme : store.lightTheme
|
||||
);
|
||||
const doubleSpacedLines = useSettingsStore(
|
||||
(store) => store.doubleSpacedParagraphs
|
||||
);
|
||||
const dateFormat = useSettingsStore((store) => store.dateFormat);
|
||||
const timeFormat = useSettingsStore((store) => store.timeFormat);
|
||||
const markdownShortcuts = useSettingsStore(
|
||||
(store) => store.markdownShortcuts
|
||||
);
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const editorContainerRef = useRef<HTMLDivElement>();
|
||||
const { editorConfig } = useEditorConfig();
|
||||
@@ -435,9 +455,14 @@ function TiptapWrapper(
|
||||
}}
|
||||
>
|
||||
<TipTap
|
||||
key={`tiptap-${props.id}-${doubleSpacedLines}-${dateFormat}-${timeFormat}-${markdownShortcuts}`}
|
||||
{...props}
|
||||
isMobile={isMobile}
|
||||
isTablet={isTablet}
|
||||
doubleSpacedLines={doubleSpacedLines}
|
||||
dateFormat={dateFormat}
|
||||
timeFormat={timeFormat}
|
||||
markdownShortcuts={markdownShortcuts}
|
||||
onLoad={(editor) => {
|
||||
if (!isHydrating) {
|
||||
onLoad?.(editor);
|
||||
|
||||
@@ -23,7 +23,7 @@ import { useEditorStore } from "../../stores/editor-store";
|
||||
import { debounceWithId } from "@notesnook/common";
|
||||
import useMobile from "../../hooks/use-mobile";
|
||||
import useTablet from "../../hooks/use-tablet";
|
||||
import { useEditorConfig } from "./manager";
|
||||
import { useEditorConfig, useEditorManager } from "./manager";
|
||||
import { getFontById } from "@notesnook/editor";
|
||||
import { replaceDateTime } from "@notesnook/editor/dist/extensions/date-time";
|
||||
import { useStore as useSettingsStore } from "../../stores/setting-store";
|
||||
@@ -131,6 +131,13 @@ function TitleBox(props: TitleBoxProps) {
|
||||
color: "placeholder"
|
||||
}
|
||||
}}
|
||||
onKeyUp={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
const context = useEditorManager.getState().getEditor(id);
|
||||
if (!context) return;
|
||||
context.editor?.focus({ scrollIntoView: true });
|
||||
}
|
||||
}}
|
||||
onChange={(e) => {
|
||||
pendingChanges.current = true;
|
||||
e.target.value = replaceDateTime(
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
useErrorBoundary
|
||||
} from "react-error-boundary";
|
||||
import { useKeyStore } from "../../interfaces/key-store";
|
||||
import { isFeatureSupported } from "../../utils/feature-check";
|
||||
|
||||
export function GlobalErrorHandler(props: PropsWithChildren) {
|
||||
const { showBoundary } = useErrorBoundary();
|
||||
@@ -199,11 +200,7 @@ function getErrorHelp(props: FallbackProps) {
|
||||
action:
|
||||
"This error can only be fixed by wiping & reseting the database. Beware that this will wipe all your data inside the database with no way to recover it later on. This WILL NOT change/affect/delete/wipe your data on the server but ONLY on this device.",
|
||||
fix: async () => {
|
||||
const { createDialect } = await import("../../common/sqlite");
|
||||
await useKeyStore.getState().clear();
|
||||
const dialect = createDialect("notesnook", true);
|
||||
const driver = dialect.createDriver();
|
||||
await driver.delete();
|
||||
await resetDatabase();
|
||||
resetErrorBoundary();
|
||||
}
|
||||
};
|
||||
@@ -213,11 +210,7 @@ function getErrorHelp(props: FallbackProps) {
|
||||
action:
|
||||
"This error can only be fixed by wiping & reseting the Key Store and the database. This WILL NOT change/affect/delete/wipe your data on the server but ONLY on this device.",
|
||||
fix: async () => {
|
||||
const { createDialect } = await import("../../common/sqlite");
|
||||
await useKeyStore.getState().clear();
|
||||
const dialect = createDialect("notesnook", true);
|
||||
const driver = dialect.createDriver();
|
||||
await driver.delete();
|
||||
await resetDatabase();
|
||||
resetErrorBoundary();
|
||||
}
|
||||
};
|
||||
@@ -242,3 +235,17 @@ function errorToString(error: unknown) {
|
||||
? error
|
||||
: JSON.stringify(error);
|
||||
}
|
||||
|
||||
async function resetDatabase() {
|
||||
const { createDialect } = await import("../../common/sqlite");
|
||||
const multiTab = !!globalThis.SharedWorker && isFeatureSupported("opfs");
|
||||
await useKeyStore.getState().clear();
|
||||
const dialect = createDialect({
|
||||
name: "notesnook",
|
||||
encrypted: true,
|
||||
async: !isFeatureSupported("opfs"),
|
||||
multiTab
|
||||
});
|
||||
const driver = dialect.createDriver();
|
||||
await driver.delete();
|
||||
}
|
||||
|
||||
@@ -213,7 +213,8 @@ import {
|
||||
mdiFormatListBulleted,
|
||||
mdiLink,
|
||||
mdiWindowClose,
|
||||
mdiFileMusicOutline
|
||||
mdiFileMusicOutline,
|
||||
mdiBroom
|
||||
} from "@mdi/js";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { Theme } from "@notesnook/theme";
|
||||
@@ -548,3 +549,4 @@ export const WindowRestore = createIcon(
|
||||
"M8 16V4h12v12Zm2-2h8V6h-8Zm-6 6V8.525h2V18h9.475v2Zm6-6V6v8Z"
|
||||
);
|
||||
export const WindowClose = createIcon(mdiWindowClose);
|
||||
export const ClearCache = createIcon(mdiBroom);
|
||||
|
||||
@@ -31,7 +31,11 @@ import {
|
||||
store as selectionStore
|
||||
} from "../../stores/selection-store";
|
||||
import GroupHeader from "../group-header";
|
||||
import { DEFAULT_ITEM_HEIGHT, ListItemWrapper } from "./list-profiles";
|
||||
import {
|
||||
ListItemWrapper,
|
||||
getListItemDefaultHeight,
|
||||
getListItemPlaceholderData
|
||||
} from "./list-profiles";
|
||||
import Announcements from "../announcements";
|
||||
import { ListLoader } from "../loaders/list-loader";
|
||||
import ScrollContainer from "../scroll-container";
|
||||
@@ -44,7 +48,7 @@ import {
|
||||
Virtuoso,
|
||||
VirtuosoHandle
|
||||
} from "react-virtuoso";
|
||||
import { useResolvedItem } from "@notesnook/common";
|
||||
import { getRandom, useResolvedItem } from "@notesnook/common";
|
||||
import { Context } from "./types";
|
||||
import { AppEventManager, AppEvents } from "../../common/app-events";
|
||||
|
||||
@@ -207,7 +211,7 @@ function ListContainer(props: ListContainerProps) {
|
||||
<Virtuoso
|
||||
ref={listRef}
|
||||
computeItemKey={(index) => items.key(index)}
|
||||
defaultItemHeight={DEFAULT_ITEM_HEIGHT}
|
||||
defaultItemHeight={getListItemDefaultHeight(group, compact)}
|
||||
totalCount={items.length}
|
||||
onBlur={() => setFocusedGroupIndex(-1)}
|
||||
onKeyDown={(e) => onKeyDown(e.nativeEvent)}
|
||||
@@ -216,7 +220,7 @@ function ListContainer(props: ListContainerProps) {
|
||||
Item: VirtuosoItem,
|
||||
Header: ListHeader
|
||||
}}
|
||||
increaseViewportBy={{ top: 10, bottom: 10 }}
|
||||
increaseViewportBy={{ top: 200, bottom: 200 }}
|
||||
context={{
|
||||
header,
|
||||
items,
|
||||
@@ -301,78 +305,32 @@ function ItemRenderer({
|
||||
} = context;
|
||||
const resolvedItem = useResolvedItem({ index, items });
|
||||
if (!resolvedItem || !resolvedItem.item) {
|
||||
if (compact)
|
||||
return (
|
||||
<div
|
||||
key="list-item-skeleton"
|
||||
style={{
|
||||
padding: 5,
|
||||
height: 12,
|
||||
width: "50%",
|
||||
backgroundColor: "var(--background-secondary)"
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
const placeholderData = getListItemPlaceholderData(group, compact);
|
||||
return (
|
||||
<div
|
||||
key="list-item-skeleton"
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
paddingTop: 10,
|
||||
paddingBottom: 10,
|
||||
paddingLeft: 5,
|
||||
paddingRight: 5,
|
||||
gap: 5
|
||||
paddingTop: placeholderData.padding[0],
|
||||
paddingRight: placeholderData.padding[1],
|
||||
paddingBottom: placeholderData.padding[2],
|
||||
paddingLeft: placeholderData.padding[3],
|
||||
gap: placeholderData.gap
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
height: 16,
|
||||
width: "50%",
|
||||
backgroundColor: "var(--background-secondary)"
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
height: 12,
|
||||
width: "100%",
|
||||
backgroundColor: "var(--background-secondary)"
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
height: 12,
|
||||
width: "100%",
|
||||
backgroundColor: "var(--background-secondary)"
|
||||
}}
|
||||
/>
|
||||
<div style={{ display: "flex", gap: 5 }}>
|
||||
<span
|
||||
{placeholderData.lines.map((line, index) => (
|
||||
<div
|
||||
key={`${index}`}
|
||||
style={{
|
||||
height: 10,
|
||||
width: "50px",
|
||||
backgroundColor: "var(--background-secondary)"
|
||||
height: line.height,
|
||||
width:
|
||||
line.width === "random" ? `${getRandom(20, 60)}%` : line.width,
|
||||
backgroundColor: "var(--background-secondary)",
|
||||
borderRadius: line.height / 4
|
||||
}}
|
||||
/>
|
||||
<span
|
||||
style={{
|
||||
height: 10,
|
||||
width: 10,
|
||||
borderRadius: 50,
|
||||
backgroundColor: "var(--background-secondary)"
|
||||
}}
|
||||
/>
|
||||
<span
|
||||
style={{
|
||||
height: 10,
|
||||
width: 10,
|
||||
borderRadius: 50,
|
||||
backgroundColor: "var(--background-secondary)"
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -40,11 +40,10 @@ type ListItemWrapperProps = {
|
||||
data?: unknown;
|
||||
context?: Context;
|
||||
compact?: boolean;
|
||||
simplified?: boolean;
|
||||
};
|
||||
|
||||
export function ListItemWrapper(props: ListItemWrapperProps) {
|
||||
const { group, compact, context, simplified, item, data } = props;
|
||||
const { group, compact, context, item, data } = props;
|
||||
|
||||
switch (item.type) {
|
||||
case "note": {
|
||||
@@ -64,13 +63,13 @@ export function ListItemWrapper(props: ListItemWrapperProps) {
|
||||
item={item}
|
||||
totalNotes={typeof data === "number" ? data : 0}
|
||||
date={getDate(item, group)}
|
||||
simplified={simplified}
|
||||
compact={compact}
|
||||
/>
|
||||
);
|
||||
case "trash":
|
||||
return <TrashItem item={item} date={getDate(item, group)} />;
|
||||
case "reminder":
|
||||
return <Reminder item={item} simplified={simplified} />;
|
||||
return <Reminder item={item} compact={compact} />;
|
||||
case "tag":
|
||||
return (
|
||||
<Tag item={item} totalNotes={typeof data === "number" ? data : 0} />
|
||||
@@ -82,6 +81,66 @@ export function ListItemWrapper(props: ListItemWrapperProps) {
|
||||
}
|
||||
}
|
||||
|
||||
type PlaceholderData = {
|
||||
padding: [number, number, number, number];
|
||||
lines: { height: number; width: "random" | string | number }[];
|
||||
gap?: number;
|
||||
};
|
||||
const COMPACT_PLACEHOLDER_ITEM_DATA: PlaceholderData = {
|
||||
padding: [6, 5, 6, 5],
|
||||
lines: [{ height: 16, width: `random` }]
|
||||
};
|
||||
const FULL_PLACEHOLDER_ITEM_DATA: PlaceholderData = {
|
||||
padding: [10, 5, 10, 5],
|
||||
gap: 5,
|
||||
lines: [
|
||||
{
|
||||
height: 16,
|
||||
width: "50%"
|
||||
},
|
||||
{
|
||||
height: 12,
|
||||
width: "100%"
|
||||
},
|
||||
{
|
||||
height: 12,
|
||||
width: "70%"
|
||||
},
|
||||
{
|
||||
height: 10,
|
||||
width: 30
|
||||
}
|
||||
]
|
||||
};
|
||||
export function getListItemDefaultHeight(
|
||||
group: GroupingKey | undefined,
|
||||
compact: boolean | undefined
|
||||
) {
|
||||
const data = getListItemPlaceholderData(group, compact);
|
||||
let height = data.padding[0] + data.padding[2];
|
||||
if (data.gap) height += data.gap * data.lines.length - 1;
|
||||
data.lines.forEach((line) => (height += line.height));
|
||||
return height;
|
||||
}
|
||||
export function getListItemPlaceholderData(
|
||||
group: GroupingKey | undefined,
|
||||
compact: boolean | undefined
|
||||
): PlaceholderData {
|
||||
switch (group) {
|
||||
case "home":
|
||||
case "favorites":
|
||||
case "notes":
|
||||
case "notebooks":
|
||||
case "trash":
|
||||
case "reminders":
|
||||
if (compact) return COMPACT_PLACEHOLDER_ITEM_DATA;
|
||||
return FULL_PLACEHOLDER_ITEM_DATA;
|
||||
case "tags":
|
||||
default:
|
||||
return COMPACT_PLACEHOLDER_ITEM_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
function getDate(item: Item, groupType?: GroupingKey): number {
|
||||
return (
|
||||
getSortValue(
|
||||
|
||||
@@ -40,7 +40,6 @@ type ListItemProps<TItem extends Item, TContext> = {
|
||||
isFocused?: boolean;
|
||||
isCompact?: boolean;
|
||||
isDisabled?: boolean;
|
||||
isSimple?: boolean;
|
||||
item: TItem;
|
||||
draggable?: boolean;
|
||||
|
||||
@@ -76,7 +75,6 @@ function ListItem<TItem extends Item, TContext>(
|
||||
isFocused,
|
||||
isCompact,
|
||||
isDisabled,
|
||||
isSimple,
|
||||
item,
|
||||
sx,
|
||||
context,
|
||||
@@ -203,12 +201,12 @@ function ListItem<TItem extends Item, TContext>(
|
||||
<Text
|
||||
dir="auto"
|
||||
data-test-id={`title`}
|
||||
variant={isSimple || isCompact ? "body" : "subtitle"}
|
||||
variant={isCompact ? "body" : "subtitle"}
|
||||
sx={{
|
||||
whiteSpace: "nowrap",
|
||||
overflow: "hidden",
|
||||
textOverflow: "ellipsis",
|
||||
fontWeight: isCompact || isSimple ? "body" : "bold",
|
||||
fontWeight: isCompact ? "body" : "bold",
|
||||
color:
|
||||
selected && heading === "heading"
|
||||
? `${heading}-selected`
|
||||
@@ -222,7 +220,7 @@ function ListItem<TItem extends Item, TContext>(
|
||||
props.title
|
||||
)}
|
||||
|
||||
{!isSimple && !isCompact && props.body && (
|
||||
{!isCompact && props.body && (
|
||||
<Text
|
||||
as="p"
|
||||
variant="body"
|
||||
|
||||
@@ -43,7 +43,6 @@ import NavigationItem, { SortableNavigationItem } from "./navigation-item";
|
||||
import { hardNavigate, hashNavigate, navigate } from "../../navigation";
|
||||
import { db } from "../../common/db";
|
||||
import useMobile from "../../hooks/use-mobile";
|
||||
import { showRenameColorDialog } from "../../common/dialog-controller";
|
||||
import { useStore as useAppStore } from "../../stores/app-store";
|
||||
import { useStore as useUserStore } from "../../stores/user-store";
|
||||
import { useStore as useThemeStore } from "../../stores/theme-store";
|
||||
@@ -72,6 +71,7 @@ import { MenuItem } from "@notesnook/ui";
|
||||
import { Notebook, Tag } from "@notesnook/core";
|
||||
import { handleDrop } from "../../common/drop-handler";
|
||||
import { Menu } from "../../hooks/use-menu";
|
||||
import { RenameColorDialog } from "../../dialogs/item-dialog";
|
||||
|
||||
type Route = {
|
||||
id: string;
|
||||
@@ -368,7 +368,7 @@ function NavigationMenu(props: NavigationMenuProps) {
|
||||
type: "button",
|
||||
key: "rename-color",
|
||||
title: "Rename color",
|
||||
onClick: () => showRenameColorDialog(color)
|
||||
onClick: () => RenameColorDialog.show(color)
|
||||
},
|
||||
{
|
||||
type: "button",
|
||||
|
||||
@@ -54,13 +54,6 @@ import {
|
||||
} from "../icons";
|
||||
import TimeAgo from "../time-ago";
|
||||
import ListItem from "../list-item";
|
||||
import {
|
||||
confirm,
|
||||
showAddReminderDialog,
|
||||
showAddTagsDialog,
|
||||
showCreateColorDialog,
|
||||
showMoveNoteDialog
|
||||
} from "../../common/dialog-controller";
|
||||
import { store } from "../../stores/note-store";
|
||||
import { store as userstore } from "../../stores/user-store";
|
||||
import { useEditorStore } from "../../stores/editor-store";
|
||||
@@ -97,12 +90,16 @@ import { SchemeColors } from "@notesnook/theme";
|
||||
import { writeToClipboard } from "../../utils/clipboard";
|
||||
import Vault from "../../common/vault";
|
||||
import { isUserPremium } from "../../hooks/use-is-user-premium";
|
||||
import { AddTagsDialog } from "../../dialogs/add-tags-dialog";
|
||||
import { CreateColorDialog } from "../../dialogs/create-color-dialog";
|
||||
import { ConfirmDialog } from "../../dialogs/confirm";
|
||||
import { MoveNoteDialog } from "../../dialogs/move-note-dialog";
|
||||
import { AddReminderDialog } from "../../dialogs/add-reminder-dialog";
|
||||
|
||||
type NoteProps = NoteResolvedData & {
|
||||
item: NoteType;
|
||||
context?: Context;
|
||||
date: number;
|
||||
simplified?: boolean;
|
||||
compact?: boolean;
|
||||
};
|
||||
|
||||
@@ -116,7 +113,6 @@ function Note(props: NoteProps) {
|
||||
item,
|
||||
date,
|
||||
reminder,
|
||||
simplified,
|
||||
compact,
|
||||
context
|
||||
} = props;
|
||||
@@ -130,7 +126,6 @@ function Note(props: NoteProps) {
|
||||
draggable={true}
|
||||
isFocused={isOpened}
|
||||
isCompact={compact}
|
||||
isSimple={simplified}
|
||||
item={note}
|
||||
title={note.title}
|
||||
body={note.headline as string}
|
||||
@@ -391,7 +386,7 @@ const menuItems: (
|
||||
title: "Remind me",
|
||||
icon: AddReminder.path,
|
||||
onClick: async () => {
|
||||
await showAddReminderDialog(note.id);
|
||||
await AddReminderDialog.show({ note });
|
||||
}
|
||||
},
|
||||
{ key: "sep1", type: "separator" },
|
||||
@@ -541,7 +536,7 @@ const menuItems: (
|
||||
onClick: async () => {
|
||||
if (
|
||||
note.localOnly ||
|
||||
(await confirm({
|
||||
(await ConfirmDialog.show({
|
||||
title: `Prevent ${pluralize(ids.length, "note")} from syncing?`,
|
||||
message: `${pluralize(
|
||||
ids.length,
|
||||
@@ -580,7 +575,7 @@ function colorsToMenuItems(
|
||||
title: "Add new color",
|
||||
icon: Plus.path,
|
||||
onClick: async () => {
|
||||
const id = await showCreateColorDialog();
|
||||
const id = await CreateColorDialog.show({});
|
||||
if (!id) return;
|
||||
await store.get().setColor(id, noteColor?.id === id, ...ids);
|
||||
}
|
||||
@@ -620,7 +615,7 @@ function notebooksMenuItems(ids: string[]): MenuItem[] {
|
||||
key: "link-notebooks",
|
||||
title: "Link to...",
|
||||
icon: AddToNotebook.path,
|
||||
onClick: () => showMoveNoteDialog(ids)
|
||||
onClick: () => MoveNoteDialog.show({ noteIds: ids })
|
||||
},
|
||||
{
|
||||
type: "lazy-loader",
|
||||
@@ -700,7 +695,7 @@ function tagsMenuItems(ids: string[]): MenuItem[] {
|
||||
key: "assign-tags",
|
||||
title: "Assign to...",
|
||||
icon: Plus.path,
|
||||
onClick: () => showAddTagsDialog(ids)
|
||||
onClick: () => AddTagsDialog.show({ noteIds: ids })
|
||||
},
|
||||
{
|
||||
type: "lazy-loader",
|
||||
@@ -732,7 +727,6 @@ function tagsMenuItems(ids: string[]): MenuItem[] {
|
||||
await db.relations.to({ id, type: "note" }, "tag").unlink();
|
||||
}
|
||||
tagStore.get().refresh();
|
||||
await useEditorStore.getState().refreshTags();
|
||||
await store.get().refresh();
|
||||
}
|
||||
},
|
||||
@@ -753,7 +747,6 @@ function tagsMenuItems(ids: string[]): MenuItem[] {
|
||||
await db.relations.add(tag, { id, type: "note" });
|
||||
}
|
||||
await tagStore.get().refresh();
|
||||
await useEditorStore.getState().refreshTags();
|
||||
await store.get().refresh();
|
||||
}
|
||||
});
|
||||
@@ -774,7 +767,6 @@ function tagsMenuItems(ids: string[]): MenuItem[] {
|
||||
await db.relations.unlink(tag, { id, type: "note" });
|
||||
}
|
||||
await tagStore.get().refresh();
|
||||
await useEditorStore.getState().refreshTags();
|
||||
await store.get().refresh();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import React, { useRef } from "react";
|
||||
import { Flex, Text } from "@theme-ui/components";
|
||||
import ListItem from "../list-item";
|
||||
import { useStore, store } from "../../stores/notebook-store";
|
||||
import { store } from "../../stores/notebook-store";
|
||||
import { useStore as useNotesStore } from "../../stores/note-store";
|
||||
import { store as appStore } from "../../stores/app-store";
|
||||
import { db } from "../../common/db";
|
||||
@@ -38,31 +38,29 @@ import { hashNavigate, navigate } from "../../navigation";
|
||||
import IconTag from "../icon-tag";
|
||||
import { Multiselect } from "../../common/multi-select";
|
||||
import { pluralize } from "@notesnook/common";
|
||||
import { confirm } from "../../common/dialog-controller";
|
||||
import { getFormattedDate } from "@notesnook/common";
|
||||
import { MenuItem } from "@notesnook/ui";
|
||||
import { Notebook as NotebookType } from "@notesnook/core";
|
||||
import { handleDrop } from "../../common/drop-handler";
|
||||
import { useDragHandler } from "../../hooks/use-drag-handler";
|
||||
import { ConfirmDialog } from "../../dialogs/confirm";
|
||||
|
||||
type NotebookProps = {
|
||||
item: NotebookType;
|
||||
totalNotes: number;
|
||||
date: number;
|
||||
simplified?: boolean;
|
||||
compact?: boolean;
|
||||
};
|
||||
function Notebook(props: NotebookProps) {
|
||||
const { item, totalNotes, date, simplified } = props;
|
||||
const { item, totalNotes, date, compact } = props;
|
||||
const notebook = item;
|
||||
const isCompact = useStore((store) => store.viewMode === "compact");
|
||||
const dragTimeout = useRef(0);
|
||||
const { isDragEntering, isDragLeaving } = useDragHandler(`id_${notebook.id}`);
|
||||
|
||||
return (
|
||||
<ListItem
|
||||
draggable
|
||||
isCompact={isCompact}
|
||||
isSimple={simplified}
|
||||
isCompact={compact}
|
||||
item={notebook}
|
||||
onClick={() => openNotebook(notebook, totalNotes)}
|
||||
onDragEnter={(e) => {
|
||||
@@ -87,7 +85,7 @@ function Notebook(props: NotebookProps) {
|
||||
menuItems={notebookMenuItems}
|
||||
footer={
|
||||
<>
|
||||
{isCompact ? (
|
||||
{compact ? (
|
||||
<>
|
||||
<Text variant="subBody">{pluralize(totalNotes, "note")}</Text>
|
||||
</>
|
||||
@@ -143,7 +141,8 @@ export default React.memo(Notebook, (prev, next) => {
|
||||
prevItem.pinned === nextItem.pinned &&
|
||||
prevItem.title === nextItem.title &&
|
||||
prevItem.description === nextItem.description &&
|
||||
prev.totalNotes === next.totalNotes
|
||||
prev.totalNotes === next.totalNotes &&
|
||||
prev.compact === next.compact
|
||||
);
|
||||
});
|
||||
|
||||
@@ -203,7 +202,7 @@ export const notebookMenuItems: (
|
||||
variant: "dangerous",
|
||||
icon: Trash.path,
|
||||
onClick: async () => {
|
||||
const result = await confirm({
|
||||
const result = await ConfirmDialog.show({
|
||||
title: `Delete ${pluralize(ids.length, "notebook")}?`,
|
||||
positiveButtonText: `Yes`,
|
||||
negativeButtonText: "No",
|
||||
|
||||
@@ -606,7 +606,7 @@ function Notebooks({ noteId }: { noteId: string }) {
|
||||
renderItem={({ index }) => (
|
||||
<ResolvedItem index={index} items={result.value} type="notebook">
|
||||
{({ item, data }) => (
|
||||
<ListItemWrapper item={item} data={data} simplified />
|
||||
<ListItemWrapper item={item} data={data} compact />
|
||||
)}
|
||||
</ResolvedItem>
|
||||
)}
|
||||
@@ -635,7 +635,7 @@ function Reminders({ noteId }: { noteId: string }) {
|
||||
renderItem={({ index }) => (
|
||||
<ResolvedItem index={index} items={result.value} type="reminder">
|
||||
{({ item, data }) => (
|
||||
<ListItemWrapper item={item} data={data} simplified />
|
||||
<ListItemWrapper item={item} data={data} compact />
|
||||
)}
|
||||
</ResolvedItem>
|
||||
)}
|
||||
@@ -659,6 +659,7 @@ function Attachments({ noteId }: { noteId: string }) {
|
||||
estimatedSize={30}
|
||||
getItemKey={(index) => result.value.key(index)}
|
||||
items={result.value.placeholders}
|
||||
style={{ tableLayout: "fixed", width: "100%" }}
|
||||
header={
|
||||
<tr>
|
||||
<th style={{ width: "75%" }} />
|
||||
@@ -666,7 +667,6 @@ function Attachments({ noteId }: { noteId: string }) {
|
||||
<th style={{ width: "20%" }} />
|
||||
</tr>
|
||||
}
|
||||
headerSize={0}
|
||||
renderRow={({ index }) => (
|
||||
<ResolvedItem index={index} type="attachment" items={result.value}>
|
||||
{({ item }) => <ListItemWrapper item={item} compact />}
|
||||
|
||||
@@ -37,14 +37,12 @@ import { hashNavigate } from "../../navigation";
|
||||
import { Multiselect } from "../../common/multi-select";
|
||||
import { store } from "../../stores/reminder-store";
|
||||
import { db } from "../../common/db";
|
||||
import {
|
||||
confirm,
|
||||
showEditReminderDialog
|
||||
} from "../../common/dialog-controller";
|
||||
import { pluralize } from "@notesnook/common";
|
||||
import { getFormattedReminderTime } from "@notesnook/common";
|
||||
import { MenuItem } from "@notesnook/ui";
|
||||
import { Reminder as ReminderType } from "@notesnook/core/dist/types";
|
||||
import { ConfirmDialog } from "../../dialogs/confirm";
|
||||
import { EditReminderDialog } from "../../dialogs/add-reminder-dialog";
|
||||
|
||||
const RECURRING_MODE_MAP = {
|
||||
week: "Weekly",
|
||||
@@ -61,11 +59,11 @@ const PRIORITY_ICON_MAP = {
|
||||
|
||||
type ReminderProps = {
|
||||
item: ReminderType;
|
||||
simplified?: boolean;
|
||||
compact?: boolean;
|
||||
};
|
||||
|
||||
function Reminder(props: ReminderProps) {
|
||||
const { item, simplified } = props;
|
||||
const { item, compact } = props;
|
||||
const reminder = item as unknown as ReminderType;
|
||||
const PriorityIcon = PRIORITY_ICON_MAP[reminder.priority];
|
||||
return (
|
||||
@@ -74,8 +72,8 @@ function Reminder(props: ReminderProps) {
|
||||
title={reminder.title}
|
||||
body={reminder.description}
|
||||
isDisabled={reminder.disabled}
|
||||
isSimple={simplified}
|
||||
onClick={() => showEditReminderDialog(reminder.id)}
|
||||
isCompact={compact}
|
||||
onClick={() => EditReminderDialog.show({ reminderId: reminder.id })}
|
||||
footer={
|
||||
<Flex
|
||||
sx={{
|
||||
@@ -145,7 +143,7 @@ const menuItems: (reminder: ReminderType, items?: string[]) => MenuItem[] = (
|
||||
variant: "dangerous",
|
||||
icon: Trash.path,
|
||||
onClick: async () => {
|
||||
confirm({
|
||||
ConfirmDialog.show({
|
||||
title: `Delete ${pluralize(items.length, "reminder")}`,
|
||||
message: `Are you sure you want to proceed? **This action is IRREVERSIBLE**.`,
|
||||
positiveButtonText: "Yes",
|
||||
|
||||
@@ -117,7 +117,14 @@ function Header(props: RouteContainerProps) {
|
||||
height: 42.8
|
||||
}}
|
||||
>
|
||||
<Flex py={1} sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||
<Flex
|
||||
py={1}
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
overflow: "hidden"
|
||||
}}
|
||||
>
|
||||
{buttons?.back ? (
|
||||
<ArrowLeft
|
||||
size={24}
|
||||
|
||||
@@ -34,15 +34,13 @@ import { useStore as useUserStore } from "../../stores/user-store";
|
||||
import { useStore as useAppStore } from "../../stores/app-store";
|
||||
import { hardNavigate, hashNavigate } from "../../navigation";
|
||||
import { useAutoUpdater, UpdateStatus } from "../../hooks/use-auto-updater";
|
||||
import {
|
||||
showIssueDialog,
|
||||
showUpdateAvailableNotice
|
||||
} from "../../common/dialog-controller";
|
||||
import useStatus, { statusToString } from "../../hooks/use-status";
|
||||
import { ScopedThemeProvider } from "../theme-provider";
|
||||
import { checkForUpdate, installUpdate } from "../../utils/updater";
|
||||
import { getTimeAgo, toTitleCase } from "@notesnook/common";
|
||||
import { User } from "@notesnook/core";
|
||||
import { showUpdateAvailableNotice } from "../../dialogs/confirm";
|
||||
import { IssueDialog } from "../../dialogs/issue-dialog";
|
||||
|
||||
function StatusBar() {
|
||||
const user = useUserStore((state) => state.user);
|
||||
@@ -114,7 +112,7 @@ function StatusBar() {
|
||||
) : null}
|
||||
<Button
|
||||
variant="statusitem"
|
||||
onClick={() => showIssueDialog()}
|
||||
onClick={() => IssueDialog.show({})}
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
|
||||
@@ -24,11 +24,11 @@ import { Notebook } from "@notesnook/core";
|
||||
import { notebookMenuItems } from "../notebook";
|
||||
import { ChevronDown, ChevronRight, Plus } from "../icons";
|
||||
import { MenuItem } from "@notesnook/ui";
|
||||
import { showAddNotebookDialog } from "../../common/dialog-controller";
|
||||
import { navigate } from "../../navigation";
|
||||
import { useCallback, useRef } from "react";
|
||||
import { handleDrop } from "../../common/drop-handler";
|
||||
import { useDragHandler } from "../../hooks/use-drag-handler";
|
||||
import { AddNotebookDialog } from "../../dialogs/add-notebook-dialog";
|
||||
|
||||
type SubNotebookProps = {
|
||||
item: Notebook;
|
||||
@@ -173,7 +173,6 @@ const subNotebookMenuItems: (
|
||||
context?: { refresh?: () => void }
|
||||
) => MenuItem[] = (notebook, ids = [], context) => {
|
||||
const menuItems = notebookMenuItems(notebook, ids);
|
||||
console.log("ITEMS", context);
|
||||
return [
|
||||
{
|
||||
type: "button",
|
||||
@@ -181,7 +180,9 @@ const subNotebookMenuItems: (
|
||||
title: "New notebook",
|
||||
icon: Plus.path,
|
||||
onClick: () =>
|
||||
showAddNotebookDialog(notebook.id).then(() => context?.refresh?.())
|
||||
AddNotebookDialog.show({ parentId: notebook.id }).then((res) =>
|
||||
res ? context?.refresh?.() : null
|
||||
)
|
||||
},
|
||||
{ type: "separator", key: "sepep2" },
|
||||
...menuItems
|
||||
|
||||
@@ -23,15 +23,14 @@ import { Text } from "@theme-ui/components";
|
||||
import { store as appStore } from "../../stores/app-store";
|
||||
import { store as tagStore } from "../../stores/tag-store";
|
||||
import { store as noteStore } from "../../stores/note-store";
|
||||
import { useEditorStore } from "../../stores/editor-store";
|
||||
import { db } from "../../common/db";
|
||||
import { Edit, Shortcut, DeleteForver } from "../icons";
|
||||
import { showToast } from "../../utils/toast";
|
||||
import { pluralize } from "@notesnook/common";
|
||||
import { MenuItem } from "@notesnook/ui";
|
||||
import { Tag as TagType } from "@notesnook/core";
|
||||
import { showEditTagDialog } from "../../common/dialog-controller";
|
||||
import { handleDrop } from "../../common/drop-handler";
|
||||
import { EditTagDialog } from "../../dialogs/item-dialog";
|
||||
|
||||
type TagProps = { item: TagType; totalNotes: number };
|
||||
function Tag(props: TagProps) {
|
||||
@@ -78,9 +77,7 @@ const menuItems: (tag: TagType, ids?: string[]) => MenuItem[] = (
|
||||
key: "edit",
|
||||
title: "Rename tag",
|
||||
icon: Edit.path,
|
||||
onClick: () => {
|
||||
showEditTagDialog(tag);
|
||||
}
|
||||
onClick: () => EditTagDialog.show(tag)
|
||||
},
|
||||
{
|
||||
type: "button",
|
||||
@@ -102,7 +99,6 @@ const menuItems: (tag: TagType, ids?: string[]) => MenuItem[] = (
|
||||
await db.tags.remove(...ids);
|
||||
showToast("success", `${pluralize(ids.length, "tag")} deleted`);
|
||||
await appStore.refreshNavItems();
|
||||
await useEditorStore.getState().refreshTags();
|
||||
await tagStore.refresh();
|
||||
await noteStore.refresh();
|
||||
},
|
||||
|
||||
@@ -18,11 +18,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { useCallback, useState } from "react";
|
||||
import { showBuyDialog } from "../../common/dialog-controller";
|
||||
import Tip from "../tip";
|
||||
import { isUserPremium } from "../../hooks/use-is-user-premium";
|
||||
import { Flex, Switch } from "@theme-ui/components";
|
||||
import { Loading } from "../icons";
|
||||
import { BuyDialog } from "../../dialogs/buy-dialog/buy-dialog";
|
||||
|
||||
function Toggle(props) {
|
||||
const {
|
||||
@@ -46,7 +46,7 @@ function Toggle(props) {
|
||||
setIsLoading(false);
|
||||
}
|
||||
} else {
|
||||
await showBuyDialog();
|
||||
await BuyDialog.show({});
|
||||
}
|
||||
}, [onToggled, premium, isToggled]);
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import ListItem from "../list-item";
|
||||
import { showMultiPermanentDeleteConfirmation } from "../../common/dialog-controller";
|
||||
import { Restore, DeleteForver } from "../icons";
|
||||
import { store } from "../../stores/trash-store";
|
||||
import { Flex, Text } from "@theme-ui/components";
|
||||
@@ -28,6 +27,7 @@ import { showToast } from "../../utils/toast";
|
||||
import { MenuItem } from "@notesnook/ui";
|
||||
import { TrashItem as TrashItemType } from "@notesnook/core/dist/types";
|
||||
import { useEditorStore } from "../../stores/editor-store";
|
||||
import { showMultiPermanentDeleteConfirmation } from "../../dialogs/confirm";
|
||||
|
||||
type TrashItemProps = { item: TrashItemType; date: number };
|
||||
function TrashItem(props: TrashItemProps) {
|
||||
|
||||
@@ -17,9 +17,10 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Virtualizer, useVirtualizer } from "@tanstack/react-virtual";
|
||||
import { Box } from "@theme-ui/components";
|
||||
import { Virtualizer } from "@tanstack/react-virtual";
|
||||
import { Flex } from "@theme-ui/components";
|
||||
import React, { useRef } from "react";
|
||||
import { TableVirtuoso } from "react-virtuoso";
|
||||
|
||||
export type VirtualizedTableRowProps<T, C> = {
|
||||
item: T;
|
||||
@@ -36,12 +37,10 @@ type VirtualizedTableProps<T, C> = {
|
||||
mode?: "fixed" | "dynamic";
|
||||
items: T[];
|
||||
estimatedSize: number;
|
||||
headerSize: number;
|
||||
getItemKey: (index: number) => string;
|
||||
scrollElement?: Element | null;
|
||||
scrollElement?: HTMLElement | null;
|
||||
context?: C;
|
||||
renderRow: (props: VirtualizedTableRowProps<T, C>) => JSX.Element | null;
|
||||
scrollMargin?: number;
|
||||
header: React.ReactNode;
|
||||
style?: React.CSSProperties;
|
||||
};
|
||||
@@ -50,59 +49,95 @@ export function VirtualizedTable<T, C>(props: VirtualizedTableProps<T, C>) {
|
||||
items,
|
||||
getItemKey,
|
||||
scrollElement,
|
||||
scrollMargin,
|
||||
headerSize,
|
||||
renderRow: Row,
|
||||
estimatedSize,
|
||||
mode,
|
||||
virtualizerRef,
|
||||
header,
|
||||
style,
|
||||
context
|
||||
context,
|
||||
style
|
||||
} = props;
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const virtualizer = useVirtualizer({
|
||||
count: items.length,
|
||||
estimateSize: () => estimatedSize,
|
||||
getItemKey,
|
||||
getScrollElement: () =>
|
||||
scrollElement || containerRef.current?.closest(".ms-container") || null,
|
||||
scrollMargin: scrollMargin || containerRef.current?.offsetTop || 0
|
||||
});
|
||||
|
||||
if (virtualizerRef) virtualizerRef.current = virtualizer;
|
||||
|
||||
const virtualItems = virtualizer.getVirtualItems();
|
||||
return (
|
||||
<Box
|
||||
<Flex
|
||||
ref={containerRef}
|
||||
sx={{
|
||||
height: virtualizer.getTotalSize() + headerSize
|
||||
}}
|
||||
variant="columnFill"
|
||||
sx={{ height: estimatedSize * items.length }}
|
||||
>
|
||||
<table style={style}>
|
||||
<thead>{header}</thead>
|
||||
<tbody>
|
||||
{virtualItems.map((row, index) => (
|
||||
<Row
|
||||
key={row.key}
|
||||
item={items[row.index]}
|
||||
index={row.index}
|
||||
rowRef={mode === "dynamic" ? virtualizer.measureElement : null}
|
||||
context={context}
|
||||
style={{
|
||||
height: mode === "dynamic" ? "unset" : `${row.size}px`,
|
||||
transform: `translateY(${
|
||||
row.start -
|
||||
index * row.size -
|
||||
virtualizer.options.scrollMargin
|
||||
}px)`
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</Box>
|
||||
<TableVirtuoso
|
||||
data={items}
|
||||
context={context}
|
||||
customScrollParent={
|
||||
scrollElement ||
|
||||
containerRef.current?.closest(".ms-container") ||
|
||||
undefined
|
||||
}
|
||||
computeItemKey={(index) => getItemKey(index)}
|
||||
defaultItemHeight={estimatedSize}
|
||||
fixedHeaderContent={() => <>{header}</>}
|
||||
fixedItemHeight={mode === "fixed" ? estimatedSize : undefined}
|
||||
components={{
|
||||
Table: (props) => (
|
||||
<table {...props} style={{ ...style, ...props.style }} />
|
||||
),
|
||||
TableRow: (props) => {
|
||||
return (
|
||||
<Row
|
||||
index={props["data-item-index"]}
|
||||
item={props.item}
|
||||
style={props.style || {}}
|
||||
context={props.context}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</Flex>
|
||||
);
|
||||
|
||||
//
|
||||
|
||||
// const virtualizer = useVirtualizer({
|
||||
// count: items.length,
|
||||
// estimateSize: () => estimatedSize,
|
||||
// getItemKey,
|
||||
// getScrollElement: () =>
|
||||
// scrollElement || containerRef.current?.closest(".ms-container") || null,
|
||||
// scrollMargin: scrollMargin || containerRef.current?.offsetTop || 0
|
||||
// });
|
||||
|
||||
// if (virtualizerRef) virtualizerRef.current = virtualizer;
|
||||
|
||||
// const virtualItems = virtualizer.getVirtualItems();
|
||||
// return (
|
||||
// <Box
|
||||
// ref={containerRef}
|
||||
// sx={{
|
||||
// height: virtualizer.getTotalSize() + headerSize
|
||||
// }}
|
||||
// >
|
||||
// <table style={style}>
|
||||
// <thead>{header}</thead>
|
||||
// <tbody>
|
||||
// {virtualItems.map((row, index) => (
|
||||
// <Row
|
||||
// key={row.key}
|
||||
// item={items[row.index]}
|
||||
// index={row.index}
|
||||
// rowRef={mode === "dynamic" ? virtualizer.measureElement : null}
|
||||
// context={context}
|
||||
// style={{
|
||||
// height: mode === "dynamic" ? "unset" : `${row.size}px`,
|
||||
// transform: `translateY(${
|
||||
// row.start -
|
||||
// index * row.size -
|
||||
// virtualizer.options.scrollMargin
|
||||
// }px)`
|
||||
// }}
|
||||
// />
|
||||
// ))}
|
||||
// </tbody>
|
||||
// </table>
|
||||
// </Box>
|
||||
// );
|
||||
}
|
||||
|
||||
@@ -22,96 +22,104 @@ import Dialog from "../components/dialog";
|
||||
import Field from "../components/field";
|
||||
import { showToast } from "../utils/toast";
|
||||
import { Notebook } from "@notesnook/core";
|
||||
import { Perform } from "../common/dialog-controller";
|
||||
import { store as noteStore } from "../stores/note-store";
|
||||
import { store as notebookStore } from "../stores/notebook-store";
|
||||
import { store as appStore } from "../stores/app-store";
|
||||
import { db } from "../common/db";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
type AddNotebookDialogProps = {
|
||||
type AddNotebookDialogProps = BaseDialogProps<boolean> & {
|
||||
parentId?: string;
|
||||
edit?: boolean;
|
||||
notebook?: Notebook;
|
||||
onClose: Perform;
|
||||
};
|
||||
|
||||
function AddNotebookDialog(props: AddNotebookDialogProps) {
|
||||
const { notebook, onClose, parentId } = props;
|
||||
const title = useRef<string>(notebook?.title || "");
|
||||
const description = useRef<string>(notebook?.description || "");
|
||||
export const AddNotebookDialog = DialogManager.register(
|
||||
function AddNotebookDialog(props: AddNotebookDialogProps) {
|
||||
const { notebook, onClose, parentId } = props;
|
||||
const title = useRef<string>(notebook?.title || "");
|
||||
const description = useRef<string>(notebook?.description || "");
|
||||
|
||||
const onSubmit = useCallback(async () => {
|
||||
if (!title.current.trim())
|
||||
return showToast("error", "Notebook title cannot be empty.");
|
||||
const onSubmit = useCallback(async () => {
|
||||
if (!title.current.trim())
|
||||
return showToast("error", "Notebook title cannot be empty.");
|
||||
|
||||
const id = await db.notebooks.add({
|
||||
id: props.notebook?.id,
|
||||
title: title.current,
|
||||
description: description.current
|
||||
});
|
||||
if (parentId) {
|
||||
await db.relations.add(
|
||||
{ type: "notebook", id: parentId },
|
||||
{ type: "notebook", id }
|
||||
);
|
||||
}
|
||||
|
||||
await notebookStore.refresh();
|
||||
await noteStore.refresh();
|
||||
await appStore.refreshNavItems();
|
||||
|
||||
showToast(
|
||||
"success",
|
||||
props.edit
|
||||
? "Notebook edited successfully!"
|
||||
: "Notebook created successfully"
|
||||
);
|
||||
onClose(true);
|
||||
}, [props.notebook?.id, props.edit, onClose, parentId]);
|
||||
return (
|
||||
<Dialog
|
||||
testId="add-notebook-dialog"
|
||||
isOpen={true}
|
||||
title={props.edit ? "Edit Notebook" : "Create a Notebook"}
|
||||
description={
|
||||
props.edit
|
||||
? `You are editing "${notebook?.title}".`
|
||||
: "Notebooks are the best way to organize your notes."
|
||||
const id = await db.notebooks.add({
|
||||
id: props.notebook?.id,
|
||||
title: title.current,
|
||||
description: description.current
|
||||
});
|
||||
if (parentId) {
|
||||
await db.relations.add(
|
||||
{ type: "notebook", id: parentId },
|
||||
{ type: "notebook", id }
|
||||
);
|
||||
}
|
||||
onClose={() => onClose(false)}
|
||||
positiveButton={{
|
||||
text: props.edit ? "Save" : "Create",
|
||||
onClick: onSubmit
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => onClose(false) }}
|
||||
>
|
||||
<Field
|
||||
defaultValue={title.current}
|
||||
data-test-id="title-input"
|
||||
autoFocus
|
||||
required
|
||||
label="Title"
|
||||
name="title"
|
||||
id="title"
|
||||
onChange={(e) => (title.current = e.target.value)}
|
||||
onKeyUp={async (e) => {
|
||||
if (e.key === "Enter") {
|
||||
await onSubmit();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Field
|
||||
data-test-id="description-input"
|
||||
label="Description"
|
||||
name="description"
|
||||
id="description"
|
||||
onChange={(e) => (description.current = e.target.value)}
|
||||
defaultValue={description.current}
|
||||
helpText="Optional"
|
||||
sx={{ mt: 1 }}
|
||||
/>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export default AddNotebookDialog;
|
||||
await notebookStore.refresh();
|
||||
await noteStore.refresh();
|
||||
await appStore.refreshNavItems();
|
||||
|
||||
showToast(
|
||||
"success",
|
||||
props.edit
|
||||
? "Notebook edited successfully!"
|
||||
: "Notebook created successfully"
|
||||
);
|
||||
onClose(true);
|
||||
}, [props.notebook?.id, props.edit, onClose, parentId]);
|
||||
return (
|
||||
<Dialog
|
||||
testId="add-notebook-dialog"
|
||||
isOpen={true}
|
||||
title={props.edit ? "Edit Notebook" : "Create a Notebook"}
|
||||
description={
|
||||
props.edit
|
||||
? `You are editing "${notebook?.title}".`
|
||||
: "Notebooks are the best way to organize your notes."
|
||||
}
|
||||
onClose={() => onClose(false)}
|
||||
positiveButton={{
|
||||
text: props.edit ? "Save" : "Create",
|
||||
onClick: onSubmit
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => onClose(false) }}
|
||||
>
|
||||
<Field
|
||||
defaultValue={title.current}
|
||||
data-test-id="title-input"
|
||||
autoFocus
|
||||
required
|
||||
label="Title"
|
||||
name="title"
|
||||
id="title"
|
||||
onChange={(e) => (title.current = e.target.value)}
|
||||
onKeyUp={async (e) => {
|
||||
if (e.key === "Enter") {
|
||||
await onSubmit();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Field
|
||||
data-test-id="description-input"
|
||||
label="Description"
|
||||
name="description"
|
||||
id="description"
|
||||
onChange={(e) => (description.current = e.target.value)}
|
||||
defaultValue={description.current}
|
||||
helpText="Optional"
|
||||
sx={{ mt: 1 }}
|
||||
/>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
type EditNotebookDialogProps = { notebookId: string };
|
||||
export const EditNotebookDialog = {
|
||||
show: async (props: EditNotebookDialogProps) => {
|
||||
const notebook = await db.notebooks.notebook(props.notebookId);
|
||||
if (!notebook) return;
|
||||
return AddNotebookDialog.show({ edit: true, notebook });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Perform } from "../common/dialog-controller";
|
||||
import Dialog from "../components/dialog";
|
||||
import Field from "../components/field";
|
||||
import { Box, Button, Flex, Label, Radio, Text } from "@theme-ui/components";
|
||||
@@ -37,11 +36,11 @@ import { useStore as useThemeStore } from "../stores/theme-store";
|
||||
import { getFormattedDate } from "@notesnook/common";
|
||||
import { MONTHS_FULL, getTimeFormat } from "@notesnook/core/dist/utils/date";
|
||||
import { Note, Reminder } from "@notesnook/core";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
dayjs.extend(customParseFormat);
|
||||
|
||||
export type AddReminderDialogProps = {
|
||||
onClose: Perform;
|
||||
export type AddReminderDialogProps = BaseDialogProps<boolean> & {
|
||||
reminder?: Reminder;
|
||||
note?: Note;
|
||||
};
|
||||
@@ -116,419 +115,425 @@ const recurringModes = [
|
||||
}
|
||||
];
|
||||
|
||||
export default function AddReminderDialog(props: AddReminderDialogProps) {
|
||||
const { reminder, note } = props;
|
||||
export const AddReminderDialog = DialogManager.register(
|
||||
function AddReminderDialog(props: AddReminderDialogProps) {
|
||||
const { reminder, note } = props;
|
||||
|
||||
const [selectedDays, setSelectedDays] = useState<number[]>(
|
||||
reminder?.selectedDays ?? []
|
||||
);
|
||||
const [recurringMode, setRecurringMode] = useState<
|
||||
ValueOf<typeof RecurringModes>
|
||||
>(reminder?.recurringMode ?? RecurringModes.DAY);
|
||||
const [mode, setMode] = useState<ValueOf<typeof Modes>>(
|
||||
reminder?.mode ?? Modes.ONCE
|
||||
);
|
||||
const [priority, setPriority] = usePersistentState<
|
||||
ValueOf<typeof Priorities>
|
||||
>("reminders:default_priority", reminder?.priority ?? Priorities.VIBRATE);
|
||||
const [date, setDate] = useState(dayjs(reminder?.date));
|
||||
const [title, setTitle] = useState<string>(
|
||||
note?.title ?? reminder?.title ?? ""
|
||||
);
|
||||
const [description, setDescription] = useState<string>(
|
||||
note?.headline ?? reminder?.description ?? ""
|
||||
);
|
||||
const [showCalendar, setShowCalendar] = useState(false);
|
||||
const refresh = useStore((state) => state.refresh);
|
||||
const isUserPremium = useIsUserPremium();
|
||||
const theme = useThemeStore((store) => store.colorScheme);
|
||||
const dateInputRef = useRef<HTMLInputElement>(null);
|
||||
const [selectedDays, setSelectedDays] = useState<number[]>(
|
||||
reminder?.selectedDays ?? []
|
||||
);
|
||||
const [recurringMode, setRecurringMode] = useState<
|
||||
ValueOf<typeof RecurringModes>
|
||||
>(reminder?.recurringMode ?? RecurringModes.DAY);
|
||||
const [mode, setMode] = useState<ValueOf<typeof Modes>>(
|
||||
reminder?.mode ?? Modes.ONCE
|
||||
);
|
||||
const [priority, setPriority] = usePersistentState<
|
||||
ValueOf<typeof Priorities>
|
||||
>("reminders:default_priority", reminder?.priority ?? Priorities.VIBRATE);
|
||||
const [date, setDate] = useState(dayjs(reminder?.date));
|
||||
const [title, setTitle] = useState<string>(
|
||||
note?.title ?? reminder?.title ?? ""
|
||||
);
|
||||
const [description, setDescription] = useState<string>(
|
||||
note?.headline ?? reminder?.description ?? ""
|
||||
);
|
||||
const [showCalendar, setShowCalendar] = useState(false);
|
||||
const refresh = useStore((state) => state.refresh);
|
||||
const isUserPremium = useIsUserPremium();
|
||||
const theme = useThemeStore((store) => store.colorScheme);
|
||||
const dateInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const repeatsDaily =
|
||||
(selectedDays.length === 7 && recurringMode === RecurringModes.WEEK) ||
|
||||
(selectedDays.length === 31 && recurringMode === RecurringModes.MONTH) ||
|
||||
recurringMode === RecurringModes.DAY;
|
||||
const repeatsDaily =
|
||||
(selectedDays.length === 7 && recurringMode === RecurringModes.WEEK) ||
|
||||
(selectedDays.length === 31 && recurringMode === RecurringModes.MONTH) ||
|
||||
recurringMode === RecurringModes.DAY;
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={reminder ? "Edit reminder" : "Add a reminder"}
|
||||
testId="add-reminder-dialog"
|
||||
onClose={() => props.onClose(false)}
|
||||
sx={{ fontFamily: "body" }}
|
||||
positiveButton={{
|
||||
text: reminder ? "Save" : "Add",
|
||||
disabled:
|
||||
!title ||
|
||||
(mode !== Modes.ONCE &&
|
||||
recurringMode !== RecurringModes.DAY &&
|
||||
recurringMode !== RecurringModes.YEAR &&
|
||||
!selectedDays.length),
|
||||
onClick: async () => {
|
||||
if (!("Notification" in window))
|
||||
showToast(
|
||||
"warn",
|
||||
"Reminders will not be active on this device as it does not support notifications."
|
||||
);
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={reminder ? "Edit reminder" : "Add a reminder"}
|
||||
testId="add-reminder-dialog"
|
||||
onClose={() => props.onClose(false)}
|
||||
sx={{ fontFamily: "body" }}
|
||||
positiveButton={{
|
||||
text: reminder ? "Save" : "Add",
|
||||
disabled:
|
||||
!title ||
|
||||
(mode !== Modes.ONCE &&
|
||||
recurringMode !== RecurringModes.DAY &&
|
||||
recurringMode !== RecurringModes.YEAR &&
|
||||
!selectedDays.length),
|
||||
onClick: async () => {
|
||||
if (!("Notification" in window))
|
||||
showToast(
|
||||
"warn",
|
||||
"Reminders will not be active on this device as it does not support notifications."
|
||||
);
|
||||
|
||||
const permissionResult = await Notification.requestPermission();
|
||||
if (!IS_TESTING && permissionResult !== "granted") {
|
||||
showToast(
|
||||
"error",
|
||||
"Please grant notifications permission to add new reminders."
|
||||
);
|
||||
return;
|
||||
}
|
||||
const permissionResult = await Notification.requestPermission();
|
||||
if (!IS_TESTING && permissionResult !== "granted") {
|
||||
showToast(
|
||||
"error",
|
||||
"Please grant notifications permission to add new reminders."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode !== Modes.REPEAT && date.isBefore(dayjs())) {
|
||||
showToast(
|
||||
"error",
|
||||
"Reminder time cannot be earlier than the current time."
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (mode !== Modes.REPEAT && date.isBefore(dayjs())) {
|
||||
showToast(
|
||||
"error",
|
||||
"Reminder time cannot be earlier than the current time."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const id = await db.reminders.add({
|
||||
id: reminder?.id,
|
||||
recurringMode,
|
||||
mode,
|
||||
priority,
|
||||
selectedDays,
|
||||
date: date.valueOf(),
|
||||
title,
|
||||
description,
|
||||
disabled: false,
|
||||
...(date.isAfter(dayjs()) ? { snoozeUntil: 0 } : {})
|
||||
});
|
||||
const id = await db.reminders.add({
|
||||
id: reminder?.id,
|
||||
recurringMode,
|
||||
mode,
|
||||
priority,
|
||||
selectedDays,
|
||||
date: date.valueOf(),
|
||||
title,
|
||||
description,
|
||||
disabled: false,
|
||||
...(date.isAfter(dayjs()) ? { snoozeUntil: 0 } : {})
|
||||
});
|
||||
|
||||
if (id && note) {
|
||||
await db.relations.add(note, { id, type: "reminder" });
|
||||
}
|
||||
if (id && note) {
|
||||
await db.relations.add(note, { id, type: "reminder" });
|
||||
}
|
||||
|
||||
refresh();
|
||||
props.onClose(true);
|
||||
}
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}
|
||||
>
|
||||
<Field
|
||||
id="title"
|
||||
label="Title"
|
||||
required
|
||||
value={title}
|
||||
data-test-id="title-input"
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
||||
setTitle(e.target.value)
|
||||
}
|
||||
/>
|
||||
<Field
|
||||
as="textarea"
|
||||
id="description"
|
||||
label="Description"
|
||||
data-test-id="description-input"
|
||||
helpText="Optional"
|
||||
value={description}
|
||||
styles={{
|
||||
input: {
|
||||
height: 100
|
||||
refresh();
|
||||
props.onClose(true);
|
||||
}
|
||||
}}
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
||||
setDescription(e.target.value)
|
||||
}
|
||||
/>
|
||||
<Flex sx={{ gap: 2, mt: 2 }}>
|
||||
{modes.map((m) => (
|
||||
<Label
|
||||
key={m.id}
|
||||
variant="text.body"
|
||||
data-test-id={`mode-${m.id}`}
|
||||
sx={{
|
||||
width: "auto",
|
||||
justifyContent: "center",
|
||||
alignItems: "center"
|
||||
}}
|
||||
>
|
||||
<Radio
|
||||
id="mode"
|
||||
name="mode"
|
||||
defaultChecked={m.id === Modes.ONCE}
|
||||
checked={m.id === mode}
|
||||
disabled={m.premium && !isUserPremium}
|
||||
sx={{ color: m.id === mode ? "accent" : "icon" }}
|
||||
onChange={() => {
|
||||
if (m.premium && !isUserPremium) return;
|
||||
setMode(m.id);
|
||||
setRecurringMode(RecurringModes.DAY);
|
||||
setSelectedDays([]);
|
||||
}}
|
||||
/>
|
||||
{m.title}
|
||||
{m.premium && !isUserPremium && (
|
||||
<Pro size={18} color="accent" sx={{ ml: 1 }} />
|
||||
)}
|
||||
</Label>
|
||||
))}
|
||||
</Flex>
|
||||
{mode === Modes.REPEAT ? (
|
||||
<Flex
|
||||
sx={{
|
||||
mt: 2,
|
||||
bg: "var(--background-secondary)",
|
||||
borderRadius: "default",
|
||||
p: 1,
|
||||
flexDirection: "column"
|
||||
negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}
|
||||
>
|
||||
<Field
|
||||
id="title"
|
||||
label="Title"
|
||||
required
|
||||
value={title}
|
||||
data-test-id="title-input"
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
||||
setTitle(e.target.value)
|
||||
}
|
||||
/>
|
||||
<Field
|
||||
as="textarea"
|
||||
id="description"
|
||||
label="Description"
|
||||
data-test-id="description-input"
|
||||
helpText="Optional"
|
||||
value={description}
|
||||
styles={{
|
||||
input: {
|
||||
height: 100
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Flex sx={{ alignItems: "center", gap: 1 }}>
|
||||
{recurringModes.map((mode) => (
|
||||
<Button
|
||||
key={mode.id}
|
||||
variant="secondary"
|
||||
data-test-id={`recurring-mode-${mode.id}`}
|
||||
onClick={() => {
|
||||
setRecurringMode(mode.id);
|
||||
setSelectedDays([]);
|
||||
}}
|
||||
sx={{
|
||||
borderRadius: 100,
|
||||
py: 1,
|
||||
px: 2,
|
||||
flexShrink: 0,
|
||||
bg:
|
||||
mode.id === recurringMode
|
||||
? "background-selected"
|
||||
: "transparent",
|
||||
color:
|
||||
mode.id === recurringMode
|
||||
? "paragraph-selected"
|
||||
: "paragraph"
|
||||
}}
|
||||
>
|
||||
{mode.title}
|
||||
</Button>
|
||||
))}
|
||||
</Flex>
|
||||
{recurringModes.map((mode) =>
|
||||
mode.id === recurringMode ? (
|
||||
<Box
|
||||
key={mode.id}
|
||||
sx={{
|
||||
display: "grid",
|
||||
gridTemplateColumns:
|
||||
mode.id === RecurringModes.WEEK
|
||||
? "1fr 1fr 1fr 1fr 1fr 1fr 1fr"
|
||||
: "1fr 1fr 1fr 1fr 1fr 1fr 1fr",
|
||||
mt: mode.options.length > 0 ? 1 : 0,
|
||||
maxHeight: 150,
|
||||
overflowY: "auto",
|
||||
gap: 1
|
||||
}}
|
||||
>
|
||||
{mode.options.map((day, i) => (
|
||||
<Button
|
||||
key={day}
|
||||
variant="secondary"
|
||||
data-test-id={`day-${day}`}
|
||||
onClick={() => {
|
||||
setSelectedDays((days) => {
|
||||
const clone = days.slice();
|
||||
if (clone.indexOf(day) > -1)
|
||||
clone.splice(clone.indexOf(day), 1);
|
||||
else clone.push(day);
|
||||
return clone;
|
||||
});
|
||||
}}
|
||||
sx={{
|
||||
borderRadius: "default",
|
||||
py: 1,
|
||||
px: 2,
|
||||
flexShrink: 0,
|
||||
textAlign: "left",
|
||||
bg: selectedDays.includes(day)
|
||||
? "background-selected"
|
||||
: "transparent",
|
||||
color: selectedDays.includes(day)
|
||||
? "paragraph-selected"
|
||||
: "paragraph"
|
||||
}}
|
||||
>
|
||||
{mode.id === "week" ? WEEK_DAYS[i] : day}
|
||||
</Button>
|
||||
))}
|
||||
</Box>
|
||||
) : null
|
||||
)}
|
||||
</Flex>
|
||||
) : null}
|
||||
|
||||
<Flex sx={{ gap: 2, overflowX: "auto", mt: 2 }}>
|
||||
{mode === Modes.ONCE ? (
|
||||
<>
|
||||
<Field
|
||||
id="date"
|
||||
label="Date"
|
||||
required
|
||||
inputRef={dateInputRef}
|
||||
data-test-id="date-input"
|
||||
helpText={`${db.settings.getDateFormat()}`}
|
||||
action={{
|
||||
icon: Calendar,
|
||||
onClick() {
|
||||
setShowCalendar(true);
|
||||
}
|
||||
}}
|
||||
validate={(t) =>
|
||||
dayjs(t, db.settings.getDateFormat(), true).isValid()
|
||||
}
|
||||
defaultValue={date.format(db.settings.getDateFormat())}
|
||||
onChange={(e) => setDate((d) => setDateOnly(e.target.value, d))}
|
||||
/>
|
||||
<PopupPresenter
|
||||
isOpen={showCalendar}
|
||||
onClose={() => setShowCalendar(false)}
|
||||
position={{
|
||||
isTargetAbsolute: true,
|
||||
target: dateInputRef.current,
|
||||
location: "top"
|
||||
}}
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
||||
setDescription(e.target.value)
|
||||
}
|
||||
/>
|
||||
<Flex sx={{ gap: 2, mt: 2 }}>
|
||||
{modes.map((m) => (
|
||||
<Label
|
||||
key={m.id}
|
||||
variant="text.body"
|
||||
data-test-id={`mode-${m.id}`}
|
||||
sx={{
|
||||
".rdp": {
|
||||
bg: "background",
|
||||
p: 1,
|
||||
boxShadow: `0px 0px 25px 5px ${
|
||||
theme === "dark" ? "#000000aa" : "#0000004e"
|
||||
}`,
|
||||
borderRadius: "dialog",
|
||||
fontFamily: "body",
|
||||
"--rdp-accent-color": "var(--accent)",
|
||||
"--rdp-background-color": "var(--background)",
|
||||
"--rdp-background-color-dark": "var(--background)",
|
||||
"--rdp-selected-color": "var(--paragraph-selected)",
|
||||
color: "paragraph"
|
||||
},
|
||||
".rdp-caption_label": { fontWeight: "heading" }
|
||||
width: "auto",
|
||||
justifyContent: "center",
|
||||
alignItems: "center"
|
||||
}}
|
||||
>
|
||||
<DayPicker
|
||||
mode="single"
|
||||
captionLayout="dropdown-buttons"
|
||||
fromYear={new Date().getFullYear()}
|
||||
toYear={new Date().getFullYear() + 99}
|
||||
modifiers={{
|
||||
disabled: { before: new Date() }
|
||||
}}
|
||||
selected={dayjs(date).toDate()}
|
||||
onSelect={(day) => {
|
||||
if (!day) return;
|
||||
const date = getFormattedDate(day, "date");
|
||||
setDate((d) => setDateOnly(date, d));
|
||||
if (dateInputRef.current) dateInputRef.current.value = date;
|
||||
}}
|
||||
styles={{
|
||||
day: {
|
||||
fontFamily: "inherit",
|
||||
fontSize: 14
|
||||
}
|
||||
<Radio
|
||||
id="mode"
|
||||
name="mode"
|
||||
defaultChecked={m.id === Modes.ONCE}
|
||||
checked={m.id === mode}
|
||||
disabled={m.premium && !isUserPremium}
|
||||
sx={{ color: m.id === mode ? "accent" : "icon" }}
|
||||
onChange={() => {
|
||||
if (m.premium && !isUserPremium) return;
|
||||
setMode(m.id);
|
||||
setRecurringMode(RecurringModes.DAY);
|
||||
setSelectedDays([]);
|
||||
}}
|
||||
/>
|
||||
</PopupPresenter>
|
||||
</>
|
||||
) : recurringMode === RecurringModes.YEAR ? (
|
||||
<>
|
||||
<LabeledSelect
|
||||
id="month"
|
||||
label="Month"
|
||||
value={`${dayjs(date).month()}`}
|
||||
options={MONTHS_FULL.map((month, index) => ({
|
||||
value: `${index}`,
|
||||
title: month
|
||||
}))}
|
||||
onSelectionChanged={(month) => {
|
||||
setDate((d) => d.month(parseInt(month)));
|
||||
}}
|
||||
/>
|
||||
<LabeledSelect
|
||||
id="day"
|
||||
label="Day"
|
||||
value={`${dayjs(date).date()}`}
|
||||
options={new Array(dayjs(date).daysInMonth())
|
||||
.fill("0")
|
||||
.map((_, day) => ({
|
||||
value: `${day + 1}`,
|
||||
title: `${day + 1}`
|
||||
}))}
|
||||
onSelectionChanged={(day) => {
|
||||
setDate((d) => d.date(parseInt(day)));
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
) : null}
|
||||
<Field
|
||||
id="time"
|
||||
label="Time"
|
||||
required
|
||||
data-test-id="time-input"
|
||||
helpText={`${
|
||||
db.settings.getTimeFormat() === "12-hour" ? "hh:mm AM/PM" : "hh:mm"
|
||||
}`}
|
||||
validate={(t) => {
|
||||
const format =
|
||||
db.settings.getTimeFormat() === "12-hour" ? "hh:mm a" : "HH:mm";
|
||||
return dayjs(t.toLowerCase(), format, true).isValid();
|
||||
}}
|
||||
defaultValue={date.format(getTimeFormat(db.settings.getTimeFormat()))}
|
||||
onChange={(e) => setDate((d) => setTimeOnly(e.target.value, d))}
|
||||
/>
|
||||
</Flex>
|
||||
<Flex sx={{ gap: 2, mt: 2 }}>
|
||||
{priorities.map((p) => (
|
||||
<Label
|
||||
key={p.id}
|
||||
variant="text.body"
|
||||
data-test-id={`priority-${p.id}`}
|
||||
{m.title}
|
||||
{m.premium && !isUserPremium && (
|
||||
<Pro size={18} color="accent" sx={{ ml: 1 }} />
|
||||
)}
|
||||
</Label>
|
||||
))}
|
||||
</Flex>
|
||||
{mode === Modes.REPEAT ? (
|
||||
<Flex
|
||||
sx={{
|
||||
width: "auto",
|
||||
justifyContent: "center",
|
||||
alignItems: "center"
|
||||
mt: 2,
|
||||
bg: "var(--background-secondary)",
|
||||
borderRadius: "default",
|
||||
p: 1,
|
||||
flexDirection: "column"
|
||||
}}
|
||||
>
|
||||
<Radio
|
||||
id="priority"
|
||||
name="priority"
|
||||
sx={{ color: p.id === priority ? "accent" : "icon" }}
|
||||
defaultChecked={p.id === Priorities.VIBRATE}
|
||||
checked={p.id === priority}
|
||||
onChange={() => setPriority(p.id)}
|
||||
/>
|
||||
{p.title}
|
||||
</Label>
|
||||
))}
|
||||
</Flex>
|
||||
<Flex sx={{ alignItems: "center", gap: 1 }}>
|
||||
{recurringModes.map((mode) => (
|
||||
<Button
|
||||
key={mode.id}
|
||||
variant="secondary"
|
||||
data-test-id={`recurring-mode-${mode.id}`}
|
||||
onClick={() => {
|
||||
setRecurringMode(mode.id);
|
||||
setSelectedDays([]);
|
||||
}}
|
||||
sx={{
|
||||
borderRadius: 100,
|
||||
py: 1,
|
||||
px: 2,
|
||||
flexShrink: 0,
|
||||
bg:
|
||||
mode.id === recurringMode
|
||||
? "background-selected"
|
||||
: "transparent",
|
||||
color:
|
||||
mode.id === recurringMode
|
||||
? "paragraph-selected"
|
||||
: "paragraph"
|
||||
}}
|
||||
>
|
||||
{mode.title}
|
||||
</Button>
|
||||
))}
|
||||
</Flex>
|
||||
{recurringModes.map((mode) =>
|
||||
mode.id === recurringMode ? (
|
||||
<Box
|
||||
key={mode.id}
|
||||
sx={{
|
||||
display: "grid",
|
||||
gridTemplateColumns:
|
||||
mode.id === RecurringModes.WEEK
|
||||
? "1fr 1fr 1fr 1fr 1fr 1fr 1fr"
|
||||
: "1fr 1fr 1fr 1fr 1fr 1fr 1fr",
|
||||
mt: mode.options.length > 0 ? 1 : 0,
|
||||
maxHeight: 150,
|
||||
overflowY: "auto",
|
||||
gap: 1
|
||||
}}
|
||||
>
|
||||
{mode.options.map((day, i) => (
|
||||
<Button
|
||||
key={day}
|
||||
variant="secondary"
|
||||
data-test-id={`day-${day}`}
|
||||
onClick={() => {
|
||||
setSelectedDays((days) => {
|
||||
const clone = days.slice();
|
||||
if (clone.indexOf(day) > -1)
|
||||
clone.splice(clone.indexOf(day), 1);
|
||||
else clone.push(day);
|
||||
return clone;
|
||||
});
|
||||
}}
|
||||
sx={{
|
||||
borderRadius: "default",
|
||||
py: 1,
|
||||
px: 2,
|
||||
flexShrink: 0,
|
||||
textAlign: "left",
|
||||
bg: selectedDays.includes(day)
|
||||
? "background-selected"
|
||||
: "transparent",
|
||||
color: selectedDays.includes(day)
|
||||
? "paragraph-selected"
|
||||
: "paragraph"
|
||||
}}
|
||||
>
|
||||
{mode.id === "week" ? WEEK_DAYS[i] : day}
|
||||
</Button>
|
||||
))}
|
||||
</Box>
|
||||
) : null
|
||||
)}
|
||||
</Flex>
|
||||
) : null}
|
||||
|
||||
{mode === Modes.REPEAT ? (
|
||||
<Text variant="subBody" sx={{ mt: 1 }}>
|
||||
{selectedDays.length === 0 && recurringMode !== RecurringModes.DAY
|
||||
? recurringMode === RecurringModes.WEEK
|
||||
? "Select day of the week to repeat the reminder."
|
||||
: "Select nth day(s) of the month to repeat the reminder."
|
||||
: repeatsDaily
|
||||
? `Repeats daily at ${date.format(timeFormat())}.`
|
||||
: `Repeats every ${recurringMode} on ${getSelectedDaysText(
|
||||
selectedDays,
|
||||
recurringMode
|
||||
)} at ${date.format(timeFormat())}.`}
|
||||
</Text>
|
||||
) : (
|
||||
<Text variant="subBody" sx={{ mt: 1 }}>
|
||||
{`The reminder will start on ${date} at ${date.format(
|
||||
timeFormat()
|
||||
)}.`}
|
||||
</Text>
|
||||
)}
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
<Flex sx={{ gap: 2, overflowX: "auto", mt: 2 }}>
|
||||
{mode === Modes.ONCE ? (
|
||||
<>
|
||||
<Field
|
||||
id="date"
|
||||
label="Date"
|
||||
required
|
||||
inputRef={dateInputRef}
|
||||
data-test-id="date-input"
|
||||
helpText={`${db.settings.getDateFormat()}`}
|
||||
action={{
|
||||
icon: Calendar,
|
||||
onClick() {
|
||||
setShowCalendar(true);
|
||||
}
|
||||
}}
|
||||
validate={(t) =>
|
||||
dayjs(t, db.settings.getDateFormat(), true).isValid()
|
||||
}
|
||||
defaultValue={date.format(db.settings.getDateFormat())}
|
||||
onChange={(e) => setDate((d) => setDateOnly(e.target.value, d))}
|
||||
/>
|
||||
<PopupPresenter
|
||||
isOpen={showCalendar}
|
||||
onClose={() => setShowCalendar(false)}
|
||||
position={{
|
||||
isTargetAbsolute: true,
|
||||
target: dateInputRef.current,
|
||||
location: "top"
|
||||
}}
|
||||
sx={{
|
||||
".rdp": {
|
||||
bg: "background",
|
||||
p: 1,
|
||||
boxShadow: `0px 0px 25px 5px ${
|
||||
theme === "dark" ? "#000000aa" : "#0000004e"
|
||||
}`,
|
||||
borderRadius: "dialog",
|
||||
fontFamily: "body",
|
||||
"--rdp-accent-color": "var(--accent)",
|
||||
"--rdp-background-color": "var(--background)",
|
||||
"--rdp-background-color-dark": "var(--background)",
|
||||
"--rdp-selected-color": "var(--paragraph-selected)",
|
||||
color: "paragraph"
|
||||
},
|
||||
".rdp-caption_label": { fontWeight: "heading" }
|
||||
}}
|
||||
>
|
||||
<DayPicker
|
||||
mode="single"
|
||||
captionLayout="dropdown-buttons"
|
||||
fromYear={new Date().getFullYear()}
|
||||
toYear={new Date().getFullYear() + 99}
|
||||
modifiers={{
|
||||
disabled: { before: new Date() }
|
||||
}}
|
||||
selected={dayjs(date).toDate()}
|
||||
onSelect={(day) => {
|
||||
if (!day) return;
|
||||
const date = getFormattedDate(day, "date");
|
||||
setDate((d) => setDateOnly(date, d));
|
||||
if (dateInputRef.current) dateInputRef.current.value = date;
|
||||
}}
|
||||
styles={{
|
||||
day: {
|
||||
fontFamily: "inherit",
|
||||
fontSize: 14
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</PopupPresenter>
|
||||
</>
|
||||
) : recurringMode === RecurringModes.YEAR ? (
|
||||
<>
|
||||
<LabeledSelect
|
||||
id="month"
|
||||
label="Month"
|
||||
value={`${dayjs(date).month()}`}
|
||||
options={MONTHS_FULL.map((month, index) => ({
|
||||
value: `${index}`,
|
||||
title: month
|
||||
}))}
|
||||
onSelectionChanged={(month) => {
|
||||
setDate((d) => d.month(parseInt(month)));
|
||||
}}
|
||||
/>
|
||||
<LabeledSelect
|
||||
id="day"
|
||||
label="Day"
|
||||
value={`${dayjs(date).date()}`}
|
||||
options={new Array(dayjs(date).daysInMonth())
|
||||
.fill("0")
|
||||
.map((_, day) => ({
|
||||
value: `${day + 1}`,
|
||||
title: `${day + 1}`
|
||||
}))}
|
||||
onSelectionChanged={(day) => {
|
||||
setDate((d) => d.date(parseInt(day)));
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
) : null}
|
||||
<Field
|
||||
id="time"
|
||||
label="Time"
|
||||
required
|
||||
data-test-id="time-input"
|
||||
helpText={`${
|
||||
db.settings.getTimeFormat() === "12-hour"
|
||||
? "hh:mm AM/PM"
|
||||
: "hh:mm"
|
||||
}`}
|
||||
validate={(t) => {
|
||||
const format =
|
||||
db.settings.getTimeFormat() === "12-hour" ? "hh:mm a" : "HH:mm";
|
||||
return dayjs(t.toLowerCase(), format, true).isValid();
|
||||
}}
|
||||
defaultValue={date.format(
|
||||
getTimeFormat(db.settings.getTimeFormat())
|
||||
)}
|
||||
onChange={(e) => setDate((d) => setTimeOnly(e.target.value, d))}
|
||||
/>
|
||||
</Flex>
|
||||
<Flex sx={{ gap: 2, mt: 2 }}>
|
||||
{priorities.map((p) => (
|
||||
<Label
|
||||
key={p.id}
|
||||
variant="text.body"
|
||||
data-test-id={`priority-${p.id}`}
|
||||
sx={{
|
||||
width: "auto",
|
||||
justifyContent: "center",
|
||||
alignItems: "center"
|
||||
}}
|
||||
>
|
||||
<Radio
|
||||
id="priority"
|
||||
name="priority"
|
||||
sx={{ color: p.id === priority ? "accent" : "icon" }}
|
||||
defaultChecked={p.id === Priorities.VIBRATE}
|
||||
checked={p.id === priority}
|
||||
onChange={() => setPriority(p.id)}
|
||||
/>
|
||||
{p.title}
|
||||
</Label>
|
||||
))}
|
||||
</Flex>
|
||||
|
||||
{mode === Modes.REPEAT ? (
|
||||
<Text variant="subBody" sx={{ mt: 1 }}>
|
||||
{selectedDays.length === 0 && recurringMode !== RecurringModes.DAY
|
||||
? recurringMode === RecurringModes.WEEK
|
||||
? "Select day of the week to repeat the reminder."
|
||||
: "Select nth day(s) of the month to repeat the reminder."
|
||||
: repeatsDaily
|
||||
? `Repeats daily at ${date.format(timeFormat())}.`
|
||||
: `Repeats every ${recurringMode} on ${getSelectedDaysText(
|
||||
selectedDays,
|
||||
recurringMode
|
||||
)} at ${date.format(timeFormat())}.`}
|
||||
</Text>
|
||||
) : (
|
||||
<Text variant="subBody" sx={{ mt: 1 }}>
|
||||
{`The reminder will start on ${date} at ${date.format(
|
||||
timeFormat()
|
||||
)}.`}
|
||||
</Text>
|
||||
)}
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
function setTimeOnly(str: string, date: dayjs.Dayjs) {
|
||||
const value = dayjs(str, timeFormat(), true);
|
||||
@@ -619,3 +624,12 @@ function LabeledSelect(props: LabeledSelectProps) {
|
||||
</Label>
|
||||
);
|
||||
}
|
||||
|
||||
type EditReminderDialogProps = { reminderId: string };
|
||||
export const EditReminderDialog = {
|
||||
show: async (props: EditReminderDialogProps) => {
|
||||
const reminder = await db.reminders.reminder(props.reminderId);
|
||||
if (!reminder) return;
|
||||
return AddReminderDialog.show({ reminder });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -29,12 +29,12 @@ import Dialog from "../components/dialog";
|
||||
import { useStore, store } from "../stores/tag-store";
|
||||
import { store as notestore } from "../stores/note-store";
|
||||
import { useEditorStore } from "../stores/editor-store";
|
||||
import { Perform } from "../common/dialog-controller";
|
||||
import { FilteredList } from "../components/filtered-list";
|
||||
import { ItemReference, Tag } from "@notesnook/core/dist/types";
|
||||
import { create } from "zustand";
|
||||
import { VirtualizedGrouping } from "@notesnook/core";
|
||||
import { ResolvedItem } from "@notesnook/common";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
type SelectedReference = {
|
||||
id: string;
|
||||
@@ -51,12 +51,10 @@ export const useSelectionStore = create<ISelectionStore>((set) => ({
|
||||
setSelected: (selected) => set({ selected: selected.slice() })
|
||||
}));
|
||||
|
||||
export type AddTagsDialogProps = {
|
||||
onClose: Perform;
|
||||
noteIds: string[];
|
||||
};
|
||||
|
||||
function AddTagsDialog(props: AddTagsDialogProps) {
|
||||
type AddTagsDialogProps = BaseDialogProps<boolean> & { noteIds: string[] };
|
||||
export const AddTagsDialog = DialogManager.register(function AddTagsDialog(
|
||||
props: AddTagsDialogProps
|
||||
) {
|
||||
const { onClose, noteIds } = props;
|
||||
|
||||
const [tags, setTags] = useState<VirtualizedGrouping<Tag> | undefined>(
|
||||
@@ -101,7 +99,6 @@ function AddTagsDialog(props: AddTagsDialogProps) {
|
||||
else await db.relations.unlink(tagRef, noteRef);
|
||||
}
|
||||
}
|
||||
await useEditorStore.getState().refreshTags();
|
||||
await store.get().refresh();
|
||||
await notestore.get().refresh();
|
||||
onClose(true);
|
||||
@@ -150,7 +147,7 @@ function AddTagsDialog(props: AddTagsDialogProps) {
|
||||
)}
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
function TagItem(props: { tag: Tag }) {
|
||||
const { tag } = props;
|
||||
@@ -201,8 +198,6 @@ function TagItem(props: { tag: Tag }) {
|
||||
);
|
||||
}
|
||||
|
||||
export default AddTagsDialog;
|
||||
|
||||
function SelectedCheck({ id, size = 20 }: { id: string; size?: number }) {
|
||||
const selected = useSelectionStore((store) => store.selected);
|
||||
const selectedTag = selected.find((item) => item.id === id);
|
||||
|
||||
@@ -22,31 +22,36 @@ import AnnouncementBody from "../components/announcements/body";
|
||||
import { store as announcementStore } from "../stores/announcement-store";
|
||||
import { useCallback } from "react";
|
||||
import BaseDialog from "../components/dialog";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
function AnnouncementDialog(props) {
|
||||
const { announcement, onClose } = props;
|
||||
type AnnouncementDialogProps = BaseDialogProps<boolean> & {
|
||||
announcement: any;
|
||||
};
|
||||
export const AnnouncementDialog = DialogManager.register(
|
||||
function AnnouncementDialog(props: AnnouncementDialogProps) {
|
||||
const { announcement, onClose } = props;
|
||||
|
||||
const dismiss = useCallback(() => {
|
||||
announcementStore.get().dismiss(announcement.id);
|
||||
onClose(true);
|
||||
}, [announcement, onClose]);
|
||||
const dismiss = useCallback(() => {
|
||||
announcementStore.get().dismiss(announcement.id);
|
||||
onClose(true);
|
||||
}, [announcement, onClose]);
|
||||
|
||||
return (
|
||||
<BaseDialog isOpen onClose={props.onClose} width={"30%"}>
|
||||
<Flex
|
||||
bg="background"
|
||||
sx={{
|
||||
position: "relative",
|
||||
flexDirection: "column"
|
||||
}}
|
||||
>
|
||||
<AnnouncementBody
|
||||
dismiss={dismiss}
|
||||
components={announcement.body}
|
||||
type="dialog"
|
||||
/>
|
||||
</Flex>
|
||||
</BaseDialog>
|
||||
);
|
||||
}
|
||||
export default AnnouncementDialog;
|
||||
return (
|
||||
<BaseDialog isOpen onClose={() => onClose(false)} width={"30%"}>
|
||||
<Flex
|
||||
bg="background"
|
||||
sx={{
|
||||
position: "relative",
|
||||
flexDirection: "column"
|
||||
}}
|
||||
>
|
||||
<AnnouncementBody
|
||||
dismiss={dismiss}
|
||||
components={announcement.body}
|
||||
type="dialog"
|
||||
/>
|
||||
</Flex>
|
||||
</BaseDialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { useEffect, useState, memo, useRef } from "react";
|
||||
import { useEffect, useState, memo, useRef, startTransition } from "react";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
@@ -29,11 +29,12 @@ import {
|
||||
Text
|
||||
} from "@theme-ui/components";
|
||||
import { store, useStore } from "../stores/attachment-store";
|
||||
import { ResolvedItem, formatBytes, usePromise } from "@notesnook/common";
|
||||
import { formatBytes, usePromise, useResolvedItem } from "@notesnook/common";
|
||||
import Dialog from "../components/dialog";
|
||||
import {
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
ClearCache,
|
||||
Close,
|
||||
DoubleCheckmark,
|
||||
Download,
|
||||
@@ -50,7 +51,6 @@ import {
|
||||
import NavigationItem from "../components/navigation-menu/navigation-item";
|
||||
import { pluralize } from "@notesnook/common";
|
||||
import { db } from "../common/db";
|
||||
import { Perform } from "../common/dialog-controller";
|
||||
import { Attachment } from "../components/attachment";
|
||||
import { ScopedThemeProvider } from "../components/theme-provider";
|
||||
import {
|
||||
@@ -63,6 +63,10 @@ import {
|
||||
VirtualizedTableRowProps
|
||||
} from "../components/virtualized-table";
|
||||
import { FlexScrollContainer } from "../components/scroll-container";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
import { ConfirmDialog } from "./confirm";
|
||||
import { showToast } from "../utils/toast";
|
||||
import { Loader } from "../components/loader";
|
||||
|
||||
type ToolbarAction = {
|
||||
title: string;
|
||||
@@ -101,122 +105,114 @@ type SortOptions = {
|
||||
id: "filename" | "size" | "dateUploaded";
|
||||
direction: "asc" | "desc";
|
||||
};
|
||||
type AttachmentsDialogProps = { onClose: Perform };
|
||||
function AttachmentsDialog({ onClose }: AttachmentsDialogProps) {
|
||||
const allAttachments = useStore((store) => store.attachments);
|
||||
const [attachments, setAttachments] =
|
||||
useState<VirtualizedGrouping<AttachmentType>>();
|
||||
const [counts, setCounts] = useState<Record<Route, number>>({
|
||||
all: 0,
|
||||
documents: 0,
|
||||
images: 0,
|
||||
orphaned: 0,
|
||||
uploads: 0,
|
||||
videos: 0,
|
||||
audio: 0
|
||||
});
|
||||
const [selected, setSelected] = useState<string[]>([]);
|
||||
const [sortBy, setSortBy] = useState<SortOptions>({
|
||||
id: "filename",
|
||||
direction: "asc"
|
||||
});
|
||||
const currentRoute = useRef<Route>("all");
|
||||
const refresh = useStore((store) => store.refresh);
|
||||
const download = useStore((store) => store.download);
|
||||
type AttachmentsDialogProps = BaseDialogProps<false>;
|
||||
export const AttachmentsDialog = DialogManager.register(
|
||||
function AttachmentsDialog({ onClose }: AttachmentsDialogProps) {
|
||||
const nonce = useStore((store) => store.nonce);
|
||||
const [attachments, setAttachments] =
|
||||
useState<VirtualizedGrouping<AttachmentType>>();
|
||||
const [counts, setCounts] = useState<Record<Route, number>>({
|
||||
all: 0,
|
||||
documents: 0,
|
||||
images: 0,
|
||||
orphaned: 0,
|
||||
uploads: 0,
|
||||
videos: 0,
|
||||
audio: 0
|
||||
});
|
||||
const [selected, setSelected] = useState<string[]>([]);
|
||||
const [sortBy, setSortBy] = useState<SortOptions>({
|
||||
id: "filename",
|
||||
direction: "asc"
|
||||
});
|
||||
const currentRoute = useRef<Route>("all");
|
||||
const download = useStore((store) => store.download);
|
||||
|
||||
useEffect(() => {
|
||||
refresh();
|
||||
}, [refresh]);
|
||||
|
||||
useEffect(() => {
|
||||
(async function () {
|
||||
setAttachments(
|
||||
await filterAttachments(currentRoute.current).sorted({
|
||||
useEffect(() => {
|
||||
filterAttachments(currentRoute.current)
|
||||
.sorted({
|
||||
sortBy: sortBy.id,
|
||||
sortDirection: sortBy.direction
|
||||
})
|
||||
);
|
||||
})();
|
||||
}, [sortBy, allAttachments]);
|
||||
.then((value) => startTransition(() => setAttachments(value)));
|
||||
}, [sortBy, nonce]);
|
||||
|
||||
useEffect(() => {
|
||||
(async function () {
|
||||
setCounts(await getCounts());
|
||||
})();
|
||||
}, [allAttachments]);
|
||||
useEffect(() => {
|
||||
getCounts().then((counts) => startTransition(() => setCounts(counts)));
|
||||
}, [nonce]);
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
width={"70%"}
|
||||
onClose={() => onClose(false)}
|
||||
noScroll
|
||||
sx={{ bg: "transparent" }}
|
||||
>
|
||||
<Flex
|
||||
sx={{
|
||||
height: "80vw",
|
||||
overflow: "hidden"
|
||||
}}
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
width={"70%"}
|
||||
onClose={() => onClose(false)}
|
||||
noScroll
|
||||
sx={{ bg: "transparent" }}
|
||||
>
|
||||
<Sidebar
|
||||
onDownloadAll={async () =>
|
||||
download(
|
||||
await db.attachments.all.ids({
|
||||
sortBy: "dateCreated",
|
||||
sortDirection: "desc"
|
||||
})
|
||||
)
|
||||
}
|
||||
filter={async (query) => {
|
||||
setAttachments(await db.lookup.attachments(query).sorted());
|
||||
}}
|
||||
counts={counts}
|
||||
onRouteChange={async (route) => {
|
||||
currentRoute.current = route;
|
||||
setSelected([]);
|
||||
setAttachments(
|
||||
await filterAttachments(currentRoute.current).sorted({
|
||||
sortBy: sortBy.id,
|
||||
sortDirection: sortBy.direction
|
||||
})
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<Flex
|
||||
variant="columnFill"
|
||||
sx={{
|
||||
bg: "background",
|
||||
flexDirection: "column",
|
||||
pl: 4,
|
||||
pt: 2,
|
||||
height: "80vw",
|
||||
overflow: "hidden"
|
||||
}}
|
||||
>
|
||||
<FlexScrollContainer>
|
||||
<Flex sx={{ justifyContent: "space-between" }}>
|
||||
<Flex sx={{ gap: 1 }}>
|
||||
{TOOLBAR_ACTIONS.map((tool) => (
|
||||
<Button
|
||||
variant="secondary"
|
||||
key={tool.title}
|
||||
title={tool.title}
|
||||
onClick={() =>
|
||||
tool.onClick({
|
||||
selected
|
||||
// : attachments.filter(
|
||||
// (a) => selected.indexOf(a.id) > -1
|
||||
// )
|
||||
})
|
||||
}
|
||||
disabled={!selected.length}
|
||||
sx={{ bg: "transparent", p: 1 }}
|
||||
>
|
||||
<tool.icon size={18} />
|
||||
</Button>
|
||||
))}
|
||||
</Flex>
|
||||
{/* <Button
|
||||
<Sidebar
|
||||
onDownloadAll={async () =>
|
||||
download(
|
||||
await db.attachments.all.ids({
|
||||
sortBy: "dateCreated",
|
||||
sortDirection: "desc"
|
||||
})
|
||||
)
|
||||
}
|
||||
filter={async (query) => {
|
||||
setAttachments(await db.lookup.attachments(query).sorted());
|
||||
}}
|
||||
counts={counts}
|
||||
onRouteChange={async (route) => {
|
||||
currentRoute.current = route;
|
||||
setSelected([]);
|
||||
setAttachments(
|
||||
await filterAttachments(currentRoute.current).sorted({
|
||||
sortBy: sortBy.id,
|
||||
sortDirection: sortBy.direction
|
||||
})
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<Flex
|
||||
variant="columnFill"
|
||||
sx={{
|
||||
bg: "background",
|
||||
flexDirection: "column",
|
||||
pl: 4,
|
||||
pt: 2,
|
||||
overflow: "hidden"
|
||||
}}
|
||||
>
|
||||
<FlexScrollContainer>
|
||||
<Flex sx={{ justifyContent: "space-between" }}>
|
||||
<Flex sx={{ gap: 1 }}>
|
||||
{TOOLBAR_ACTIONS.map((tool) => (
|
||||
<Button
|
||||
variant="secondary"
|
||||
key={tool.title}
|
||||
title={tool.title}
|
||||
onClick={() =>
|
||||
tool.onClick({
|
||||
selected
|
||||
// : attachments.filter(
|
||||
// (a) => selected.indexOf(a.id) > -1
|
||||
// )
|
||||
})
|
||||
}
|
||||
disabled={!selected.length}
|
||||
sx={{ bg: "transparent", p: 1 }}
|
||||
>
|
||||
<tool.icon size={18} />
|
||||
</Button>
|
||||
))}
|
||||
</Flex>
|
||||
{/* <Button
|
||||
variant="tool"
|
||||
sx={{ p: 1, display: "flex" }}
|
||||
onClick={async () => {
|
||||
@@ -229,123 +225,127 @@ function AttachmentsDialog({ onClose }: AttachmentsDialogProps) {
|
||||
Upload
|
||||
</Text>
|
||||
</Button> */}
|
||||
</Flex>
|
||||
{attachments && (
|
||||
<VirtualizedTable
|
||||
style={{ tableLayout: "fixed", borderCollapse: "collapse" }}
|
||||
header={
|
||||
<Box
|
||||
as="tr"
|
||||
sx={{
|
||||
height: 40,
|
||||
th: { borderBottom: "1px solid var(--separator)" },
|
||||
bg: "background"
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
as="th"
|
||||
variant="body"
|
||||
</Flex>
|
||||
{attachments ? (
|
||||
<VirtualizedTable
|
||||
style={{
|
||||
tableLayout: "fixed",
|
||||
width: "100%",
|
||||
borderCollapse: "collapse"
|
||||
}}
|
||||
header={
|
||||
<Box
|
||||
as="tr"
|
||||
sx={{
|
||||
width: 24,
|
||||
textAlign: "left",
|
||||
fontWeight: "normal",
|
||||
mb: 2
|
||||
height: 40,
|
||||
th: { borderBottom: "1px solid var(--separator)" },
|
||||
bg: "background"
|
||||
}}
|
||||
>
|
||||
<Label>
|
||||
<Checkbox
|
||||
sx={{ width: 18, height: 18 }}
|
||||
onChange={async (e) => {
|
||||
setSelected(
|
||||
e.currentTarget.checked
|
||||
? await filterAttachments(
|
||||
currentRoute.current
|
||||
).ids()
|
||||
: []
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</Label>
|
||||
</Text>
|
||||
{COLUMNS.map((column) =>
|
||||
!column.title ? (
|
||||
<th key={column.id} />
|
||||
) : (
|
||||
<Box
|
||||
as="th"
|
||||
key={column.id}
|
||||
sx={{
|
||||
width: column.width,
|
||||
cursor: "pointer",
|
||||
px: 1,
|
||||
mb: 2,
|
||||
":hover": { bg: "hover" }
|
||||
}}
|
||||
onClick={() => {
|
||||
setSortBy((sortBy) => ({
|
||||
direction:
|
||||
sortBy.id === column.id &&
|
||||
sortBy.direction === "asc"
|
||||
? "desc"
|
||||
: "asc",
|
||||
id: column.id
|
||||
}));
|
||||
}}
|
||||
>
|
||||
<Flex
|
||||
<Text
|
||||
as="th"
|
||||
variant="body"
|
||||
sx={{
|
||||
width: 24,
|
||||
textAlign: "left",
|
||||
fontWeight: "normal",
|
||||
mb: 2
|
||||
}}
|
||||
>
|
||||
<Label>
|
||||
<Checkbox
|
||||
sx={{ width: 18, height: 18 }}
|
||||
onChange={async (e) => {
|
||||
setSelected(
|
||||
e.currentTarget.checked
|
||||
? await filterAttachments(
|
||||
currentRoute.current
|
||||
).ids()
|
||||
: []
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</Label>
|
||||
</Text>
|
||||
{COLUMNS.map((column) =>
|
||||
!column.title ? (
|
||||
<th key={column.id} />
|
||||
) : (
|
||||
<Box
|
||||
as="th"
|
||||
key={column.id}
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between"
|
||||
width: column.width,
|
||||
cursor: "pointer",
|
||||
px: 1,
|
||||
mb: 2,
|
||||
":hover": { bg: "hover" }
|
||||
}}
|
||||
onClick={() => {
|
||||
setSortBy((sortBy) => ({
|
||||
direction:
|
||||
sortBy.id === column.id &&
|
||||
sortBy.direction === "asc"
|
||||
? "desc"
|
||||
: "asc",
|
||||
id: column.id
|
||||
}));
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
variant="body"
|
||||
sx={{ textAlign: "left", fontWeight: "normal" }}
|
||||
<Flex
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between"
|
||||
}}
|
||||
>
|
||||
{column.title}
|
||||
</Text>
|
||||
{sortBy.id === column.id ? (
|
||||
sortBy.direction === "asc" ? (
|
||||
<ChevronUp size={16} />
|
||||
) : (
|
||||
<ChevronDown size={16} />
|
||||
)
|
||||
) : null}
|
||||
</Flex>
|
||||
</Box>
|
||||
)
|
||||
)}
|
||||
</Box>
|
||||
}
|
||||
mode="fixed"
|
||||
estimatedSize={30}
|
||||
headerSize={40}
|
||||
getItemKey={(index) => attachments.key(index)}
|
||||
items={attachments.placeholders}
|
||||
context={{
|
||||
isSelected: (id: string) => selected.indexOf(id) > -1,
|
||||
select: (id: string) => {
|
||||
setSelected((s) => {
|
||||
const copy = s.slice();
|
||||
const index = copy.indexOf(id);
|
||||
if (index > -1) copy.splice(index, 1);
|
||||
else copy.push(id);
|
||||
return copy;
|
||||
});
|
||||
},
|
||||
attachments
|
||||
}}
|
||||
renderRow={AttachmentRow}
|
||||
/>
|
||||
)}
|
||||
</FlexScrollContainer>
|
||||
<Text
|
||||
variant="body"
|
||||
sx={{ textAlign: "left", fontWeight: "normal" }}
|
||||
>
|
||||
{column.title}
|
||||
</Text>
|
||||
{sortBy.id === column.id ? (
|
||||
sortBy.direction === "asc" ? (
|
||||
<ChevronUp size={16} />
|
||||
) : (
|
||||
<ChevronDown size={16} />
|
||||
)
|
||||
) : null}
|
||||
</Flex>
|
||||
</Box>
|
||||
)
|
||||
)}
|
||||
</Box>
|
||||
}
|
||||
mode="fixed"
|
||||
estimatedSize={30}
|
||||
getItemKey={(index) => attachments.key(index)}
|
||||
items={attachments.placeholders}
|
||||
context={{
|
||||
isSelected: (id: string) => selected.indexOf(id) > -1,
|
||||
select: (id: string) => {
|
||||
setSelected((s) => {
|
||||
const copy = s.slice();
|
||||
const index = copy.indexOf(id);
|
||||
if (index > -1) copy.splice(index, 1);
|
||||
else copy.push(id);
|
||||
return copy;
|
||||
});
|
||||
},
|
||||
attachments
|
||||
}}
|
||||
renderRow={AttachmentRow}
|
||||
/>
|
||||
) : (
|
||||
<Loader title="Loading attachments..." />
|
||||
)}
|
||||
</FlexScrollContainer>
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export default AttachmentsDialog;
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
function AttachmentRow(
|
||||
props: VirtualizedTableRowProps<
|
||||
@@ -357,23 +357,21 @@ function AttachmentRow(
|
||||
}
|
||||
>
|
||||
) {
|
||||
if (!props.context) return null;
|
||||
const item = useResolvedItem({
|
||||
index: props.index,
|
||||
items: props.context!.attachments,
|
||||
type: "attachment"
|
||||
});
|
||||
if (!item) return null;
|
||||
return (
|
||||
<ResolvedItem
|
||||
index={props.index}
|
||||
items={props.context.attachments}
|
||||
type="attachment"
|
||||
>
|
||||
{({ item }) => (
|
||||
<Attachment
|
||||
rowRef={props.rowRef}
|
||||
style={props.style}
|
||||
item={item}
|
||||
isSelected={props.context?.isSelected(item.id)}
|
||||
onSelected={() => props.context?.select(item.id)}
|
||||
/>
|
||||
)}
|
||||
</ResolvedItem>
|
||||
<Attachment
|
||||
key={item.item.id}
|
||||
rowRef={props.rowRef}
|
||||
style={props.style}
|
||||
item={item?.item}
|
||||
isSelected={props.context?.isSelected(item.item.id)}
|
||||
onSelected={() => props.context?.select(item.item.id)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -443,6 +441,7 @@ const Sidebar = memo(
|
||||
<Flex
|
||||
className="theme-scope-navigationMenu"
|
||||
sx={{
|
||||
flexShrink: 0,
|
||||
flexDirection: "column",
|
||||
justifyContent: "space-between",
|
||||
width: 240,
|
||||
@@ -484,40 +483,83 @@ const Sidebar = memo(
|
||||
</Text>
|
||||
)}
|
||||
</Flex>
|
||||
<Button
|
||||
variant="secondary"
|
||||
sx={{
|
||||
bg: "transparent",
|
||||
borderRadius: 100,
|
||||
position: "relative",
|
||||
width: 38,
|
||||
height: 38
|
||||
}}
|
||||
title="Download all attachments"
|
||||
onClick={async () => {
|
||||
if (downloadStatus) {
|
||||
await cancelDownload();
|
||||
} else {
|
||||
onDownloadAll();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{downloadStatus ? <Close size={18} /> : <Download size={18} />}
|
||||
{downloadStatus ? (
|
||||
<Donut
|
||||
value={
|
||||
(downloadStatus.current / downloadStatus.total) * 100
|
||||
<Flex>
|
||||
<Button
|
||||
variant="secondary"
|
||||
sx={{
|
||||
bg: "transparent",
|
||||
borderRadius: 100,
|
||||
position: "relative",
|
||||
width: 38,
|
||||
height: 38
|
||||
}}
|
||||
disabled={!!downloadStatus}
|
||||
title="Clear cache"
|
||||
onClick={async () => {
|
||||
if (
|
||||
await ConfirmDialog.show({
|
||||
title: "Clear attachments cache?",
|
||||
message: `Clearing attachments cache will perform the following actions:
|
||||
|
||||
- Downloaded images & files: **cleared**
|
||||
- Pending uploads: **cleared**
|
||||
- Uploaded images & files: _unaffected_
|
||||
|
||||
All attachments will be downloaded & cached again on access.
|
||||
|
||||
---
|
||||
|
||||
**Only use this for troubleshooting purposes. If you are having persistent issues, it is recommended that you reach out to us via support@streetwriters.co so we can help you resolve it permanently.**`,
|
||||
negativeButtonText: "No",
|
||||
positiveButtonText: "Yes"
|
||||
})
|
||||
) {
|
||||
await db.fs().clear();
|
||||
showToast("success", "Attachments cache cleared!");
|
||||
}
|
||||
max={100}
|
||||
size={38}
|
||||
sx={{
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
</Button>
|
||||
}}
|
||||
>
|
||||
<ClearCache />
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
sx={{
|
||||
bg: "transparent",
|
||||
borderRadius: 100,
|
||||
position: "relative",
|
||||
width: 38,
|
||||
height: 38
|
||||
}}
|
||||
title="Download all attachments"
|
||||
onClick={async () => {
|
||||
if (downloadStatus) {
|
||||
await cancelDownload();
|
||||
} else {
|
||||
onDownloadAll();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{downloadStatus ? (
|
||||
<Close size={18} />
|
||||
) : (
|
||||
<Download size={18} />
|
||||
)}
|
||||
{downloadStatus ? (
|
||||
<Donut
|
||||
value={
|
||||
(downloadStatus.current / downloadStatus.total) * 100
|
||||
}
|
||||
max={100}
|
||||
size={38}
|
||||
sx={{
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
</Button>
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
@@ -18,105 +18,106 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { useState } from "react";
|
||||
import { Perform } from "../common/dialog-controller";
|
||||
import Field from "../components/field";
|
||||
import Dialog from "../components/dialog";
|
||||
import { Box, Button, Text } from "@theme-ui/components";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
export type PromptDialogProps = {
|
||||
onClose: Perform;
|
||||
export type BackupPasswordDialogProps = BaseDialogProps<boolean> & {
|
||||
validate: (outputs: {
|
||||
password?: string;
|
||||
key?: string;
|
||||
}) => boolean | Promise<boolean>;
|
||||
};
|
||||
|
||||
export default function BackupPasswordDialog(props: PromptDialogProps) {
|
||||
const { onClose, validate } = props;
|
||||
export const BackupPasswordDialog = DialogManager.register(
|
||||
function BackupPasswordDialog(props: BackupPasswordDialogProps) {
|
||||
const { onClose, validate } = props;
|
||||
|
||||
const [error, setError] = useState<string>();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isEncryptionKey, setIsEncryptionKey] = useState(false);
|
||||
const [error, setError] = useState<string>();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isEncryptionKey, setIsEncryptionKey] = useState(false);
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
testId="password-dialog"
|
||||
title={"Encrypted backup"}
|
||||
description={
|
||||
"Please enter the password to decrypt and restore this backup."
|
||||
}
|
||||
onClose={() => onClose(false)}
|
||||
positiveButton={{
|
||||
form: "backupPasswordForm",
|
||||
type: "submit",
|
||||
loading: isLoading,
|
||||
disabled: isLoading,
|
||||
text: "Restore"
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => onClose(false) }}
|
||||
>
|
||||
<Box
|
||||
id="backupPasswordForm"
|
||||
as="form"
|
||||
onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
const formData = new FormData(e.target as HTMLFormElement);
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
setError(undefined);
|
||||
|
||||
const key = formData.get("key") as string;
|
||||
const password = formData.get("password") as string;
|
||||
if (!key && !password) return;
|
||||
|
||||
if (await validate({ key, password })) {
|
||||
onClose(true);
|
||||
} else {
|
||||
setError("Wrong password.");
|
||||
}
|
||||
} catch (e) {
|
||||
setError((e as Error).message);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
testId="password-dialog"
|
||||
title={"Encrypted backup"}
|
||||
description={
|
||||
"Please enter the password to decrypt and restore this backup."
|
||||
}
|
||||
onClose={() => onClose(false)}
|
||||
positiveButton={{
|
||||
form: "backupPasswordForm",
|
||||
type: "submit",
|
||||
loading: isLoading,
|
||||
disabled: isLoading,
|
||||
text: "Restore"
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => onClose(false) }}
|
||||
>
|
||||
{isEncryptionKey ? (
|
||||
<Field
|
||||
required
|
||||
autoFocus
|
||||
data-test-id="encryption-key"
|
||||
label="Encryption key"
|
||||
type="password"
|
||||
id="key"
|
||||
name="key"
|
||||
/>
|
||||
) : (
|
||||
<Field
|
||||
required
|
||||
autoFocus
|
||||
data-test-id="password"
|
||||
label="Password"
|
||||
type="password"
|
||||
autoComplete="current-password"
|
||||
id="password"
|
||||
name="password"
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
<Button variant="anchor" onClick={() => setIsEncryptionKey((s) => !s)}>
|
||||
{isEncryptionKey
|
||||
? "Don't have encryption key? Use password."
|
||||
: "Forgot password? Use encryption key."}
|
||||
</Button>
|
||||
<Box
|
||||
id="backupPasswordForm"
|
||||
as="form"
|
||||
onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
const formData = new FormData(e.target as HTMLFormElement);
|
||||
|
||||
{error && (
|
||||
<Text as="div" mt={1} variant={"error"}>
|
||||
{error}
|
||||
</Text>
|
||||
)}
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
try {
|
||||
setIsLoading(true);
|
||||
setError(undefined);
|
||||
|
||||
const key = formData.get("key") as string;
|
||||
const password = formData.get("password") as string;
|
||||
if (!key && !password) return;
|
||||
|
||||
if (await validate({ key, password })) {
|
||||
onClose(true);
|
||||
} else {
|
||||
setError("Wrong password.");
|
||||
}
|
||||
} catch (e) {
|
||||
setError((e as Error).message);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{isEncryptionKey ? (
|
||||
<Field
|
||||
required
|
||||
autoFocus
|
||||
data-test-id="encryption-key"
|
||||
label="Encryption key"
|
||||
type="password"
|
||||
id="key"
|
||||
name="key"
|
||||
/>
|
||||
) : (
|
||||
<Field
|
||||
required
|
||||
autoFocus
|
||||
data-test-id="password"
|
||||
label="Password"
|
||||
type="password"
|
||||
autoComplete="current-password"
|
||||
id="password"
|
||||
name="password"
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
<Button variant="anchor" onClick={() => setIsEncryptionKey((s) => !s)}>
|
||||
{isEncryptionKey
|
||||
? "Don't have encryption key? Use password."
|
||||
: "Forgot password? Use encryption key."}
|
||||
</Button>
|
||||
|
||||
{error && (
|
||||
<Text as="div" mt={1} variant={"error"}>
|
||||
{error}
|
||||
</Text>
|
||||
)}
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -45,14 +45,16 @@ import { SUBSCRIPTION_STATUS } from "../../common/constants";
|
||||
import BaseDialog from "../../components/dialog";
|
||||
import { ScopedThemeProvider } from "../../components/theme-provider";
|
||||
import { User } from "@notesnook/core";
|
||||
import { BaseDialogProps, DialogManager } from "../../common/dialog-manager";
|
||||
|
||||
type BuyDialogProps = {
|
||||
type BuyDialogProps = BaseDialogProps<false> & {
|
||||
couponCode?: string;
|
||||
plan?: "monthly" | "yearly" | "education";
|
||||
onClose: () => void;
|
||||
};
|
||||
|
||||
export function BuyDialog(props: BuyDialogProps) {
|
||||
export const BuyDialog = DialogManager.register(function BuyDialog(
|
||||
props: BuyDialogProps
|
||||
) {
|
||||
const { onClose, couponCode, plan } = props;
|
||||
const theme = useTheme() as Theme;
|
||||
|
||||
@@ -73,7 +75,7 @@ export function BuyDialog(props: BuyDialogProps) {
|
||||
<BaseDialog
|
||||
isOpen={true}
|
||||
width={"868px"}
|
||||
onClose={() => props.onClose()}
|
||||
onClose={() => props.onClose(false)}
|
||||
noScroll
|
||||
sx={{
|
||||
bg: "transparent",
|
||||
@@ -107,13 +109,13 @@ export function BuyDialog(props: BuyDialogProps) {
|
||||
py: 50
|
||||
}}
|
||||
>
|
||||
<SideBar onClose={onClose} initialPlan={plan} />
|
||||
<SideBar onClose={() => onClose(false)} initialPlan={plan} />
|
||||
</ScopedThemeProvider>
|
||||
<Details />
|
||||
</Flex>
|
||||
</BaseDialog>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
type SideBarProps = {
|
||||
initialPlan?: Period;
|
||||
|
||||
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export { BuyDialog as default } from "./buy-dialog";
|
||||
export * from "./buy-dialog";
|
||||
|
||||
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { Plan, PricingInfo } from "./types";
|
||||
import { create } from "zustand";
|
||||
import { produce } from "immer";
|
||||
import { create as produce } from "mutative";
|
||||
|
||||
interface ICheckoutStore {
|
||||
isCompleted: boolean;
|
||||
|
||||
@@ -19,15 +19,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { Box, Checkbox, Label, Text } from "@theme-ui/components";
|
||||
import { useRef } from "react";
|
||||
import { Perform } from "../common/dialog-controller";
|
||||
import { mdToHtml } from "../utils/md";
|
||||
import Dialog from "../components/dialog";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
import { db } from "../common/db";
|
||||
import { AppVersion, getChangelog } from "../utils/version";
|
||||
import { downloadUpdate } from "../utils/updater";
|
||||
|
||||
type Check = { text: string; default?: boolean };
|
||||
export type ConfirmDialogProps<TCheckId extends string> = {
|
||||
export type ConfirmDialogProps<TCheckId extends string> = BaseDialogProps<
|
||||
false | Record<TCheckId, boolean>
|
||||
> & {
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
onClose: Perform<false | Record<TCheckId, boolean>>;
|
||||
width?: number;
|
||||
positiveButtonText?: string;
|
||||
negativeButtonText?: string;
|
||||
@@ -35,9 +39,9 @@ export type ConfirmDialogProps<TCheckId extends string> = {
|
||||
checks?: Partial<Record<TCheckId, Check>>;
|
||||
};
|
||||
|
||||
function ConfirmDialog<TCheckId extends string>(
|
||||
props: ConfirmDialogProps<TCheckId>
|
||||
) {
|
||||
export const ConfirmDialog = DialogManager.register(function ConfirmDialog<
|
||||
TCheckId extends string
|
||||
>(props: ConfirmDialogProps<TCheckId>) {
|
||||
const {
|
||||
onClose,
|
||||
title,
|
||||
@@ -116,6 +120,85 @@ function ConfirmDialog<TCheckId extends string>(
|
||||
</Box>
|
||||
</Dialog>
|
||||
);
|
||||
});
|
||||
|
||||
export function showMultiDeleteConfirmation(length: number) {
|
||||
return ConfirmDialog.show({
|
||||
title: `Delete ${length} items?`,
|
||||
message: `These items will be **kept in your Trash for ${
|
||||
db.settings.getTrashCleanupInterval() || 7
|
||||
} days** after which they will be permanently deleted.`,
|
||||
positiveButtonText: "Yes",
|
||||
negativeButtonText: "No"
|
||||
});
|
||||
}
|
||||
|
||||
export default ConfirmDialog;
|
||||
export function showMultiPermanentDeleteConfirmation(length: number) {
|
||||
return ConfirmDialog.show({
|
||||
title: `Permanently delete ${length} items?`,
|
||||
message:
|
||||
"These items will be **permanently deleted**. This is IRREVERSIBLE.",
|
||||
positiveButtonText: "Yes",
|
||||
negativeButtonText: "No"
|
||||
});
|
||||
}
|
||||
|
||||
export function showLogoutConfirmation() {
|
||||
return ConfirmDialog.show({
|
||||
title: `Logout?`,
|
||||
message:
|
||||
"Logging out will clear all data stored on THIS DEVICE. Make sure you have synced all your changes before logging out.",
|
||||
positiveButtonText: "Yes",
|
||||
negativeButtonText: "No"
|
||||
});
|
||||
}
|
||||
|
||||
export function showClearSessionsConfirmation() {
|
||||
return ConfirmDialog.show({
|
||||
title: `Logout from other devices?`,
|
||||
message:
|
||||
"All other logged-in devices will be forced to logout stopping sync. Use with care lest you lose important notes.",
|
||||
positiveButtonText: "Yes",
|
||||
negativeButtonText: "No"
|
||||
});
|
||||
}
|
||||
|
||||
export async function showUpdateAvailableNotice({
|
||||
version
|
||||
}: {
|
||||
version: string;
|
||||
}) {
|
||||
const changelog = await getChangelog(version);
|
||||
|
||||
return showUpdateDialog({
|
||||
title: `New version available`,
|
||||
subtitle: `v${version} is available for download`,
|
||||
changelog,
|
||||
action: { text: `Update now`, onClick: () => downloadUpdate() }
|
||||
});
|
||||
}
|
||||
|
||||
type UpdateDialogProps = {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
changelog: string;
|
||||
action: {
|
||||
text: string;
|
||||
onClick: () => void;
|
||||
};
|
||||
};
|
||||
async function showUpdateDialog({
|
||||
title,
|
||||
subtitle,
|
||||
changelog,
|
||||
action
|
||||
}: UpdateDialogProps) {
|
||||
const result = await ConfirmDialog.show({
|
||||
title,
|
||||
subtitle,
|
||||
message: changelog,
|
||||
width: 500,
|
||||
positiveButtonText: action.text
|
||||
});
|
||||
if (result && action.onClick) action.onClick();
|
||||
}
|
||||
|
||||
@@ -20,91 +20,91 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import { Box, Flex } from "@theme-ui/components";
|
||||
import Dialog from "../components/dialog";
|
||||
import Field from "../components/field";
|
||||
import { Perform } from "../common/dialog-controller";
|
||||
import { useRef } from "react";
|
||||
import tinycolor from "tinycolor2";
|
||||
import { db } from "../common/db";
|
||||
import { showToast } from "../utils/toast";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
type CreateColorDialogProps = {
|
||||
onClose: Perform;
|
||||
onDone: Perform<string>;
|
||||
};
|
||||
function CreateColorDialog(props: CreateColorDialogProps) {
|
||||
const colorRef = useRef<HTMLInputElement>(null);
|
||||
const colorPickerRef = useRef<HTMLInputElement>(null);
|
||||
return (
|
||||
<Dialog
|
||||
testId="new-color-dialog"
|
||||
isOpen={true}
|
||||
title={"Create a new color"}
|
||||
onClose={() => props.onClose(false)}
|
||||
positiveButton={{
|
||||
form: "colorForm",
|
||||
type: "submit",
|
||||
text: "Create"
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}
|
||||
>
|
||||
<Box
|
||||
as="form"
|
||||
id="colorForm"
|
||||
onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
const form = Object.fromEntries(
|
||||
new FormData(e.target as HTMLFormElement).entries()
|
||||
) as { color: string; title: string };
|
||||
if (!tinycolor(form.color, { format: "hex" }).isValid()) {
|
||||
showToast("error", "Please enter a valid hex color (e.g. #ffffff)");
|
||||
return;
|
||||
}
|
||||
const colorId = await db.colors.add({
|
||||
colorCode: form.color,
|
||||
title: form.title
|
||||
});
|
||||
props.onDone(colorId);
|
||||
type CreateColorDialogProps = BaseDialogProps<string | false>;
|
||||
export const CreateColorDialog = DialogManager.register(
|
||||
function CreateColorDialog(props: CreateColorDialogProps) {
|
||||
const colorRef = useRef<HTMLInputElement>(null);
|
||||
const colorPickerRef = useRef<HTMLInputElement>(null);
|
||||
return (
|
||||
<Dialog
|
||||
testId="new-color-dialog"
|
||||
isOpen={true}
|
||||
title={"Create a new color"}
|
||||
onClose={() => props.onClose(false)}
|
||||
positiveButton={{
|
||||
form: "colorForm",
|
||||
type: "submit",
|
||||
text: "Create"
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}
|
||||
>
|
||||
<Field
|
||||
required
|
||||
label="Title"
|
||||
id="title"
|
||||
name="title"
|
||||
autoFocus
|
||||
data-test-id="title-input"
|
||||
/>
|
||||
<Flex sx={{ alignItems: "end" }}>
|
||||
<Box
|
||||
as="form"
|
||||
id="colorForm"
|
||||
onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
const form = Object.fromEntries(
|
||||
new FormData(e.target as HTMLFormElement).entries()
|
||||
) as { color: string; title: string };
|
||||
if (!tinycolor(form.color, { format: "hex" }).isValid()) {
|
||||
showToast(
|
||||
"error",
|
||||
"Please enter a valid hex color (e.g. #ffffff)"
|
||||
);
|
||||
return;
|
||||
}
|
||||
const colorId = await db.colors.add({
|
||||
colorCode: form.color,
|
||||
title: form.title
|
||||
});
|
||||
props.onClose(colorId);
|
||||
}}
|
||||
>
|
||||
<Field
|
||||
inputRef={colorRef}
|
||||
required
|
||||
label="Color"
|
||||
id="color"
|
||||
name="color"
|
||||
data-test-id="color-input"
|
||||
sx={{ flex: 1 }}
|
||||
onChange={(e) => {
|
||||
const color = tinycolor(e.target.value);
|
||||
if (colorPickerRef.current && color.isValid())
|
||||
colorPickerRef.current.value = color.toHexString();
|
||||
}}
|
||||
label="Title"
|
||||
id="title"
|
||||
name="title"
|
||||
autoFocus
|
||||
data-test-id="title-input"
|
||||
/>
|
||||
<input
|
||||
ref={colorPickerRef}
|
||||
type="color"
|
||||
style={{
|
||||
height: 41,
|
||||
backgroundColor: "transparent",
|
||||
border: "1px solid var(--border)",
|
||||
borderRadius: 5
|
||||
}}
|
||||
onChange={(e) => {
|
||||
if (colorRef.current) colorRef.current.value = e.target.value;
|
||||
}}
|
||||
/>
|
||||
</Flex>
|
||||
</Box>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export default CreateColorDialog;
|
||||
<Flex sx={{ alignItems: "end" }}>
|
||||
<Field
|
||||
inputRef={colorRef}
|
||||
required
|
||||
label="Color"
|
||||
id="color"
|
||||
name="color"
|
||||
data-test-id="color-input"
|
||||
sx={{ flex: 1 }}
|
||||
onChange={(e) => {
|
||||
const color = tinycolor(e.target.value);
|
||||
if (colorPickerRef.current && color.isValid())
|
||||
colorPickerRef.current.value = color.toHexString();
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
ref={colorPickerRef}
|
||||
type="color"
|
||||
style={{
|
||||
height: 41,
|
||||
backgroundColor: "transparent",
|
||||
border: "1px solid var(--border)",
|
||||
borderRadius: 5
|
||||
}}
|
||||
onChange={(e) => {
|
||||
if (colorRef.current) colorRef.current.value = e.target.value;
|
||||
}}
|
||||
/>
|
||||
</Flex>
|
||||
</Box>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Perform } from "../common/dialog-controller";
|
||||
import Dialog from "../components/dialog";
|
||||
import { Profile } from "@notesnook/core";
|
||||
import AvatarEditor from "react-avatar-editor";
|
||||
@@ -28,139 +27,139 @@ import { showFilePicker } from "../utils/file-picker";
|
||||
import { db } from "../common/db";
|
||||
import { showToast } from "../utils/toast";
|
||||
import { useStore as useSettingStore } from "../stores/setting-store";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
export type EditProfilePictureDialogProps = {
|
||||
onClose: Perform;
|
||||
export type EditProfilePictureDialogProps = BaseDialogProps<boolean> & {
|
||||
profile?: Profile;
|
||||
};
|
||||
|
||||
export default function EditProfilePictureDialog(
|
||||
props: EditProfilePictureDialogProps
|
||||
) {
|
||||
const { profile } = props;
|
||||
const [profilePicture, setProfilePicture] = useState<
|
||||
File | string | undefined
|
||||
>(profile?.profilePicture);
|
||||
const profileRef = useRef<AvatarEditor>(null);
|
||||
const [scale, setScale] = useState(1);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [clearProfilePicture, setClearProfilePicture] = useState(false);
|
||||
export const EditProfilePictureDialog = DialogManager.register(
|
||||
function EditProfilePictureDialog(props: EditProfilePictureDialogProps) {
|
||||
const { profile } = props;
|
||||
const [profilePicture, setProfilePicture] = useState<
|
||||
File | string | undefined
|
||||
>(profile?.profilePicture);
|
||||
const profileRef = useRef<AvatarEditor>(null);
|
||||
const [scale, setScale] = useState(1);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [clearProfilePicture, setClearProfilePicture] = useState(false);
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={"Edit profile picture"}
|
||||
description="Your profile data is stored 100% end-to-end encrypted."
|
||||
onClose={() => props.onClose(false)}
|
||||
positiveButton={{
|
||||
loading: isLoading,
|
||||
disabled: isLoading,
|
||||
text: "Save",
|
||||
onClick: async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const pic = profileRef.current
|
||||
? profileRef.current
|
||||
.getImageScaledToCanvas()
|
||||
.toDataURL("image/jpeg", 0.8)
|
||||
: clearProfilePicture
|
||||
? undefined
|
||||
: profile?.profilePicture;
|
||||
await db.settings.setProfile({
|
||||
profilePicture: pic
|
||||
});
|
||||
await useSettingStore.getState().refresh();
|
||||
showToast("success", "Profile updated!");
|
||||
props.onClose(true);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
showToast("error", (e as Error).message);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}
|
||||
>
|
||||
<Flex
|
||||
sx={{
|
||||
flexDirection: "column"
|
||||
}}
|
||||
>
|
||||
{profilePicture ? (
|
||||
<AvatarEditor
|
||||
ref={profileRef}
|
||||
image={profilePicture}
|
||||
width={256}
|
||||
height={256}
|
||||
border={1}
|
||||
color={[255, 255, 255]}
|
||||
borderRadius={256}
|
||||
scale={scale}
|
||||
style={{
|
||||
width: 150,
|
||||
height: 150,
|
||||
alignSelf: "center"
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<Flex
|
||||
variant="columnCenter"
|
||||
sx={{
|
||||
bg: "shade",
|
||||
mr: 2,
|
||||
size: 150,
|
||||
borderRadius: 200,
|
||||
alignSelf: "center"
|
||||
}}
|
||||
>
|
||||
<User size={60} />
|
||||
</Flex>
|
||||
)}
|
||||
<Flex sx={{ gap: 1, alignItems: "center", mt: 2 }}>
|
||||
<Button
|
||||
sx={{ flex: 1 }}
|
||||
variant="secondary"
|
||||
onClick={async () => {
|
||||
const [file] = await showFilePicker({
|
||||
acceptedFileTypes: "image/*"
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={"Edit profile picture"}
|
||||
description="Your profile data is stored 100% end-to-end encrypted."
|
||||
onClose={() => props.onClose(false)}
|
||||
positiveButton={{
|
||||
loading: isLoading,
|
||||
disabled: isLoading,
|
||||
text: "Save",
|
||||
onClick: async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const pic = profileRef.current
|
||||
? profileRef.current
|
||||
.getImageScaledToCanvas()
|
||||
.toDataURL("image/jpeg", 0.8)
|
||||
: clearProfilePicture
|
||||
? undefined
|
||||
: profile?.profilePicture;
|
||||
await db.settings.setProfile({
|
||||
profilePicture: pic
|
||||
});
|
||||
if (!file) return;
|
||||
setProfilePicture(file);
|
||||
setScale(1);
|
||||
}}
|
||||
>
|
||||
{profilePicture
|
||||
? "Change profile picture"
|
||||
: "Select profile picture"}
|
||||
</Button>
|
||||
await useSettingStore.getState().refresh();
|
||||
showToast("success", "Profile updated!");
|
||||
props.onClose(true);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
showToast("error", (e as Error).message);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}
|
||||
>
|
||||
<Flex
|
||||
sx={{
|
||||
flexDirection: "column"
|
||||
}}
|
||||
>
|
||||
{profilePicture ? (
|
||||
<AvatarEditor
|
||||
ref={profileRef}
|
||||
image={profilePicture}
|
||||
width={256}
|
||||
height={256}
|
||||
border={1}
|
||||
color={[255, 255, 255]}
|
||||
borderRadius={256}
|
||||
scale={scale}
|
||||
style={{
|
||||
width: 150,
|
||||
height: 150,
|
||||
alignSelf: "center"
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<Flex
|
||||
variant="columnCenter"
|
||||
sx={{
|
||||
bg: "shade",
|
||||
mr: 2,
|
||||
size: 150,
|
||||
borderRadius: 200,
|
||||
alignSelf: "center"
|
||||
}}
|
||||
>
|
||||
<User size={60} />
|
||||
</Flex>
|
||||
)}
|
||||
<Flex sx={{ gap: 1, alignItems: "center", mt: 2 }}>
|
||||
<Button
|
||||
sx={{ flex: 1 }}
|
||||
variant="secondary"
|
||||
onClick={async () => {
|
||||
if (typeof profilePicture === "string") {
|
||||
setClearProfilePicture(true);
|
||||
setProfilePicture(undefined);
|
||||
} else setProfilePicture(profile?.profilePicture);
|
||||
const [file] = await showFilePicker({
|
||||
acceptedFileTypes: "image/*"
|
||||
});
|
||||
if (!file) return;
|
||||
setProfilePicture(file);
|
||||
setScale(1);
|
||||
}}
|
||||
>
|
||||
{typeof profilePicture === "string" ? "Clear" : "Reset"}
|
||||
{profilePicture
|
||||
? "Change profile picture"
|
||||
: "Select profile picture"}
|
||||
</Button>
|
||||
{profilePicture ? (
|
||||
<Button
|
||||
sx={{ flex: 1 }}
|
||||
variant="secondary"
|
||||
onClick={async () => {
|
||||
if (typeof profilePicture === "string") {
|
||||
setClearProfilePicture(true);
|
||||
setProfilePicture(undefined);
|
||||
} else setProfilePicture(profile?.profilePicture);
|
||||
setScale(1);
|
||||
}}
|
||||
>
|
||||
{typeof profilePicture === "string" ? "Clear" : "Reset"}
|
||||
</Button>
|
||||
) : null}
|
||||
</Flex>
|
||||
{profilePicture ? (
|
||||
<Slider
|
||||
max={5}
|
||||
min={1}
|
||||
step={0.1}
|
||||
value={scale}
|
||||
sx={{ color: "accent" }}
|
||||
onChange={(e) => setScale(e.target.valueAsNumber)}
|
||||
/>
|
||||
) : null}
|
||||
</Flex>
|
||||
{profilePicture ? (
|
||||
<Slider
|
||||
max={5}
|
||||
min={1}
|
||||
step={0.1}
|
||||
value={scale}
|
||||
sx={{ color: "accent" }}
|
||||
onChange={(e) => setScale(e.target.valueAsNumber)}
|
||||
/>
|
||||
) : null}
|
||||
</Flex>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -20,162 +20,162 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import { Flex, Text } from "@theme-ui/components";
|
||||
import { useCallback, useRef, useState } from "react";
|
||||
import { db } from "../common/db";
|
||||
import { Perform } from "../common/dialog-controller";
|
||||
import { useTimer } from "../hooks/use-timer";
|
||||
import Field from "../components/field";
|
||||
import { Loading } from "../components/icons";
|
||||
import Dialog from "../components/dialog";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
type EmailChangeState = {
|
||||
newEmail: string;
|
||||
password: string;
|
||||
};
|
||||
export type EmailChangeDialogProps = {
|
||||
onClose: Perform;
|
||||
};
|
||||
export type EmailChangeDialogProps = BaseDialogProps<boolean>;
|
||||
export const EmailChangeDialog = DialogManager.register(
|
||||
function EmailChangeDialog(props: EmailChangeDialogProps) {
|
||||
const [error, setError] = useState<string>();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [emailChangeState, setEmailChangeState] =
|
||||
useState<EmailChangeState>();
|
||||
const [isSending, setIsSending] = useState(false);
|
||||
const { elapsed, enabled, setEnabled } = useTimer(`email_change_code`, 60);
|
||||
|
||||
export default function EmailChangeDialog(props: EmailChangeDialogProps) {
|
||||
const [error, setError] = useState<string>();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [emailChangeState, setEmailChangeState] = useState<EmailChangeState>();
|
||||
const [isSending, setIsSending] = useState(false);
|
||||
const { elapsed, enabled, setEnabled } = useTimer(`email_change_code`, 60);
|
||||
const emailRef = useRef<HTMLInputElement>(null);
|
||||
const passwordRef = useRef<HTMLInputElement>(null);
|
||||
const codeRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const emailRef = useRef<HTMLInputElement>(null);
|
||||
const passwordRef = useRef<HTMLInputElement>(null);
|
||||
const codeRef = useRef<HTMLInputElement>(null);
|
||||
const sendCode = useCallback(
|
||||
async (emailChangeState: EmailChangeState) => {
|
||||
setIsSending(true);
|
||||
try {
|
||||
await db.user.sendVerificationEmail(emailChangeState.newEmail);
|
||||
|
||||
const sendCode = useCallback(
|
||||
async (emailChangeState: EmailChangeState) => {
|
||||
setIsSending(true);
|
||||
try {
|
||||
await db.user.sendVerificationEmail(emailChangeState.newEmail);
|
||||
setEnabled(false);
|
||||
} catch (e) {
|
||||
const error = e as Error;
|
||||
setError(error.message);
|
||||
} finally {
|
||||
setIsSending(false);
|
||||
}
|
||||
},
|
||||
[setEnabled]
|
||||
);
|
||||
|
||||
setEnabled(false);
|
||||
} catch (e) {
|
||||
const error = e as Error;
|
||||
setError(error.message);
|
||||
} finally {
|
||||
setIsSending(false);
|
||||
}
|
||||
},
|
||||
[setEnabled]
|
||||
);
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={"Change account email"}
|
||||
description={
|
||||
"Your account email will be changed without affecting your subscription or any other settings."
|
||||
}
|
||||
onClose={() => props.onClose(false)}
|
||||
positiveButton={{
|
||||
text: "Next",
|
||||
disabled: isLoading,
|
||||
loading: isLoading,
|
||||
form: "changeEmailForm"
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}
|
||||
>
|
||||
<Flex
|
||||
id="changeEmailForm"
|
||||
as="form"
|
||||
onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
try {
|
||||
setIsLoading(true);
|
||||
setError(undefined);
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={"Change account email"}
|
||||
description={
|
||||
"Your account email will be changed without affecting your subscription or any other settings."
|
||||
}
|
||||
onClose={() => props.onClose(false)}
|
||||
positiveButton={{
|
||||
text: "Next",
|
||||
disabled: isLoading,
|
||||
loading: isLoading,
|
||||
form: "changeEmailForm"
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}
|
||||
>
|
||||
<Flex
|
||||
id="changeEmailForm"
|
||||
as="form"
|
||||
onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
try {
|
||||
setIsLoading(true);
|
||||
setError(undefined);
|
||||
const formData = new FormData(e.target as HTMLFormElement);
|
||||
const { password, newEmail, code } = Object.fromEntries(
|
||||
formData.entries() as IterableIterator<[string, string]>
|
||||
);
|
||||
|
||||
const formData = new FormData(e.target as HTMLFormElement);
|
||||
const { password, newEmail, code } = Object.fromEntries(
|
||||
formData.entries() as IterableIterator<[string, string]>
|
||||
);
|
||||
if (emailChangeState) {
|
||||
if (!code || code.length < 6) {
|
||||
setError("Please enter a valid verification code.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (emailChangeState) {
|
||||
if (!code || code.length < 6) {
|
||||
setError("Please enter a valid verification code.");
|
||||
await db.user.changeEmail(
|
||||
emailChangeState.newEmail,
|
||||
emailChangeState.password,
|
||||
code
|
||||
);
|
||||
props.onClose(true);
|
||||
return;
|
||||
}
|
||||
|
||||
await db.user.changeEmail(
|
||||
emailChangeState.newEmail,
|
||||
emailChangeState.password,
|
||||
code
|
||||
);
|
||||
props.onClose(true);
|
||||
return;
|
||||
}
|
||||
if (!newEmail.trim() || !password.trim()) return;
|
||||
|
||||
if (!newEmail.trim() || !password.trim()) return;
|
||||
|
||||
if (!password || !(await db.user.verifyPassword(password))) {
|
||||
setError("Password is not correct.");
|
||||
return;
|
||||
}
|
||||
|
||||
await db.user.sendVerificationEmail(newEmail);
|
||||
setEmailChangeState({ newEmail, password });
|
||||
} catch (e) {
|
||||
if (e instanceof Error) setError(e.message);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}}
|
||||
sx={{ flexDirection: "column" }}
|
||||
>
|
||||
{emailChangeState ? (
|
||||
<Field
|
||||
inputRef={codeRef}
|
||||
id="code"
|
||||
name="code"
|
||||
label="6-digit code"
|
||||
helpText={`Enter 6-digit code sent to ${emailChangeState.newEmail}`}
|
||||
type="text"
|
||||
required
|
||||
action={{
|
||||
disabled: isSending || !enabled,
|
||||
component: (
|
||||
<Text variant={"body"}>
|
||||
{isSending ? (
|
||||
<Loading size={18} />
|
||||
) : enabled ? (
|
||||
`Resend code`
|
||||
) : (
|
||||
`Resend in ${elapsed}`
|
||||
)}
|
||||
</Text>
|
||||
),
|
||||
onClick: async () => {
|
||||
await sendCode(emailChangeState);
|
||||
if (!password || !(await db.user.verifyPassword(password))) {
|
||||
setError("Password is not correct.");
|
||||
return;
|
||||
}
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
|
||||
await db.user.sendVerificationEmail(newEmail);
|
||||
setEmailChangeState({ newEmail, password });
|
||||
} catch (e) {
|
||||
if (e instanceof Error) setError(e.message);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}}
|
||||
sx={{ flexDirection: "column" }}
|
||||
>
|
||||
{emailChangeState ? (
|
||||
<Field
|
||||
inputRef={emailRef}
|
||||
id="newEmail"
|
||||
name="newEmail"
|
||||
label="New email"
|
||||
type="email"
|
||||
inputRef={codeRef}
|
||||
id="code"
|
||||
name="code"
|
||||
label="6-digit code"
|
||||
helpText={`Enter 6-digit code sent to ${emailChangeState.newEmail}`}
|
||||
type="text"
|
||||
required
|
||||
action={{
|
||||
disabled: isSending || !enabled,
|
||||
component: (
|
||||
<Text variant={"body"}>
|
||||
{isSending ? (
|
||||
<Loading size={18} />
|
||||
) : enabled ? (
|
||||
`Resend code`
|
||||
) : (
|
||||
`Resend in ${elapsed}`
|
||||
)}
|
||||
</Text>
|
||||
),
|
||||
onClick: async () => {
|
||||
await sendCode(emailChangeState);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Field
|
||||
inputRef={passwordRef}
|
||||
id="password"
|
||||
name="password"
|
||||
label="Your account password"
|
||||
type="password"
|
||||
required
|
||||
/>
|
||||
<Text variant="subBody" sx={{ mt: 1 }}>
|
||||
You will be logged out from all your other devices.
|
||||
</Text>
|
||||
</>
|
||||
)}
|
||||
{error && <Text variant="error">{error}</Text>}
|
||||
</Flex>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
) : (
|
||||
<>
|
||||
<Field
|
||||
inputRef={emailRef}
|
||||
id="newEmail"
|
||||
name="newEmail"
|
||||
label="New email"
|
||||
type="email"
|
||||
required
|
||||
/>
|
||||
<Field
|
||||
inputRef={passwordRef}
|
||||
id="password"
|
||||
name="password"
|
||||
label="Your account password"
|
||||
type="password"
|
||||
required
|
||||
/>
|
||||
<Text variant="subBody" sx={{ mt: 1 }}>
|
||||
You will be logged out from all your other devices.
|
||||
</Text>
|
||||
</>
|
||||
)}
|
||||
{error && <Text variant="error">{error}</Text>}
|
||||
</Flex>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { Flex, Text } from "@theme-ui/components";
|
||||
import Dialog from "../components/dialog";
|
||||
import { useStore as useUserStore } from "../stores/user-store";
|
||||
import { db } from "../common/db";
|
||||
import { useState } from "react";
|
||||
import { useSessionState } from "../hooks/use-session-state";
|
||||
import Accordion from "../components/accordion";
|
||||
|
||||
var interval = 0;
|
||||
function EmailVerificationDialog(props) {
|
||||
const user = useUserStore((store) => store.user);
|
||||
const [isSending, setIsSending] = useState(false);
|
||||
const [canSendAgain, setCanSendAgain] = useSessionState("canSendAgain", true);
|
||||
const [resetTimer, setResetTimer] = useSessionState("resetTimer", 60);
|
||||
|
||||
useEffect(() => {
|
||||
if (!canSendAgain) {
|
||||
interval = setInterval(() => {
|
||||
setResetTimer((s) => {
|
||||
--s;
|
||||
if (s <= 0) {
|
||||
setCanSendAgain(true);
|
||||
clearInterval(interval);
|
||||
return 60;
|
||||
}
|
||||
return s;
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
return () => {
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, [canSendAgain, setResetTimer, setCanSendAgain]);
|
||||
|
||||
if (!user) {
|
||||
props.onCancel();
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={"Confirm your email"}
|
||||
description={
|
||||
"Check your spam folder if you haven't received an email yet."
|
||||
}
|
||||
onClose={() => props.onCancel(false)}
|
||||
positiveButton={{
|
||||
text: canSendAgain || isSending ? "Resend" : `Resend (${resetTimer})`,
|
||||
onClick: async () => {
|
||||
setIsSending(true);
|
||||
try {
|
||||
await db.user.sendVerificationEmail();
|
||||
setCanSendAgain(false);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} finally {
|
||||
setIsSending(false);
|
||||
}
|
||||
},
|
||||
loading: isSending,
|
||||
disabled: isSending || !canSendAgain
|
||||
}}
|
||||
negativeButton={{
|
||||
text: "Cancel",
|
||||
onClick: () => props.onCancel(true),
|
||||
disabled: isSending
|
||||
}}
|
||||
>
|
||||
<Flex sx={{ flexDirection: "column" }}>
|
||||
<Text
|
||||
as="span"
|
||||
variant="body"
|
||||
sx={{ borderRadius: "default", alignSelf: "stretch" }}
|
||||
>
|
||||
We have sent the email confirmation link at{" "}
|
||||
<Text as="b" sx={{ color: "accent" }}>
|
||||
{user.email}
|
||||
</Text>
|
||||
.
|
||||
</Text>
|
||||
<Accordion
|
||||
title={"What do I do if I am not getting the email?"}
|
||||
sx={{
|
||||
mt: 2,
|
||||
bg: "var(--background-secondary)",
|
||||
borderRadius: "default"
|
||||
}}
|
||||
>
|
||||
<Text variant={"body"} px={1} pb={1}>
|
||||
{`If you didn't get an email from us or the confirmation link isn't
|
||||
working,`}{" "}
|
||||
<b>please send us an email from your registered email address</b>{" "}
|
||||
and we will manually confirm your account.
|
||||
</Text>
|
||||
</Accordion>
|
||||
</Flex>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
export default EmailVerificationDialog;
|
||||
127
apps/web/src/dialogs/email-verification-dialog.tsx
Normal file
127
apps/web/src/dialogs/email-verification-dialog.tsx
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { Flex, Text } from "@theme-ui/components";
|
||||
import Dialog from "../components/dialog";
|
||||
import { useStore as useUserStore } from "../stores/user-store";
|
||||
import { db } from "../common/db";
|
||||
import { useState } from "react";
|
||||
import { useSessionState } from "../hooks/use-session-state";
|
||||
import Accordion from "../components/accordion";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
let interval = 0;
|
||||
type EmailVerificationDialogProps = BaseDialogProps<boolean>;
|
||||
export const EmailVerificationDialog = DialogManager.register(
|
||||
function EmailVerificationDialog(props: EmailVerificationDialogProps) {
|
||||
const user = useUserStore((store) => store.user);
|
||||
const [isSending, setIsSending] = useState(false);
|
||||
const [canSendAgain, setCanSendAgain] = useSessionState(
|
||||
"canSendAgain",
|
||||
true
|
||||
);
|
||||
const [resetTimer, setResetTimer] = useSessionState("resetTimer", 60);
|
||||
|
||||
useEffect(() => {
|
||||
if (!canSendAgain) {
|
||||
interval = setInterval(() => {
|
||||
setResetTimer((s) => {
|
||||
--s;
|
||||
if (s <= 0) {
|
||||
setCanSendAgain(true);
|
||||
clearInterval(interval);
|
||||
return 60;
|
||||
}
|
||||
return s;
|
||||
});
|
||||
}, 1000) as unknown as number;
|
||||
}
|
||||
return () => {
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, [canSendAgain, setResetTimer, setCanSendAgain]);
|
||||
|
||||
if (!user) {
|
||||
props.onClose(false);
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={"Confirm your email"}
|
||||
description={
|
||||
"Check your spam folder if you haven't received an email yet."
|
||||
}
|
||||
onClose={() => props.onClose(false)}
|
||||
positiveButton={{
|
||||
text: canSendAgain || isSending ? "Resend" : `Resend (${resetTimer})`,
|
||||
onClick: async () => {
|
||||
setIsSending(true);
|
||||
try {
|
||||
await db.user.sendVerificationEmail();
|
||||
setCanSendAgain(false);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} finally {
|
||||
setIsSending(false);
|
||||
}
|
||||
},
|
||||
loading: isSending,
|
||||
disabled: isSending || !canSendAgain
|
||||
}}
|
||||
negativeButton={{
|
||||
text: "Cancel",
|
||||
onClick: () => props.onClose(true),
|
||||
disabled: isSending
|
||||
}}
|
||||
>
|
||||
<Flex sx={{ flexDirection: "column" }}>
|
||||
<Text
|
||||
as="span"
|
||||
variant="body"
|
||||
sx={{ borderRadius: "default", alignSelf: "stretch" }}
|
||||
>
|
||||
We have sent the email confirmation link at{" "}
|
||||
<Text as="b" sx={{ color: "accent" }}>
|
||||
{user.email}
|
||||
</Text>
|
||||
.
|
||||
</Text>
|
||||
<Accordion
|
||||
isClosed
|
||||
title={"What do I do if I am not getting the email?"}
|
||||
sx={{
|
||||
mt: 2,
|
||||
bg: "var(--background-secondary)",
|
||||
borderRadius: "default"
|
||||
}}
|
||||
>
|
||||
<Text variant={"body"} px={1} pb={1}>
|
||||
{`If you didn't get an email from us or the confirmation link isn't
|
||||
working,`}{" "}
|
||||
<b>please send us an email from your registered email address</b>{" "}
|
||||
and we will manually confirm your account.
|
||||
</Text>
|
||||
</Accordion>
|
||||
</Flex>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -25,6 +25,7 @@ import Config from "../utils/config";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { ArrowRight, Checkmark, Icon, Warn } from "../components/icons";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
type CallToAction = {
|
||||
title: string;
|
||||
@@ -113,12 +114,13 @@ const features: Record<FeatureKeys, Feature> = {
|
||||
}
|
||||
};
|
||||
|
||||
type FeatureDialogProps = {
|
||||
type FeatureDialogProps = BaseDialogProps<boolean> & {
|
||||
featureName: FeatureKeys;
|
||||
onClose: (result: boolean) => void;
|
||||
};
|
||||
|
||||
function FeatureDialog(props: FeatureDialogProps) {
|
||||
export const FeatureDialog = DialogManager.register(function FeatureDialog(
|
||||
props: FeatureDialogProps
|
||||
) {
|
||||
const { featureName, onClose } = props;
|
||||
const feature = features[featureName];
|
||||
|
||||
@@ -178,8 +180,7 @@ function FeatureDialog(props: FeatureDialogProps) {
|
||||
</Flex>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
export default FeatureDialog;
|
||||
});
|
||||
|
||||
type CodeProps = { text: string; href?: string };
|
||||
export function Code(props: CodeProps) {
|
||||
|
||||
@@ -18,15 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { Perform } from "../common/dialog-controller";
|
||||
import Dialog from "../components/dialog";
|
||||
import { ScrollContainer } from "@notesnook/ui";
|
||||
import { Flex, Image, Label, Text } from "@theme-ui/components";
|
||||
import { formatBytes } from "@notesnook/common";
|
||||
import { compressImage } from "../utils/image-compressor";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
export type ImagePickerDialogProps = {
|
||||
onClose: Perform<false | File[]>;
|
||||
export type ImagePickerDialogProps = BaseDialogProps<false | File[]> & {
|
||||
images: File[];
|
||||
};
|
||||
class FileWithURI extends File {
|
||||
@@ -41,106 +40,110 @@ class FileWithURI extends File {
|
||||
}
|
||||
}
|
||||
|
||||
export default function ImagePickerDialog(props: ImagePickerDialogProps) {
|
||||
const [images, setImages] = useState<FileWithURI[]>([]);
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
const [compress, setCompress] = useState(true);
|
||||
const selectedImage = images[selectedIndex];
|
||||
export const ImagePickerDialog = DialogManager.register(
|
||||
function ImagePickerDialog(props: ImagePickerDialogProps) {
|
||||
const [images, setImages] = useState<FileWithURI[]>([]);
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
const [compress, setCompress] = useState(true);
|
||||
const selectedImage = images[selectedIndex];
|
||||
|
||||
useEffect(() => {
|
||||
(async function () {
|
||||
const images: FileWithURI[] = [];
|
||||
for (const image of props.images) {
|
||||
const compressed = compress
|
||||
? await compressImage(image, {
|
||||
maxWidth: (naturalWidth) => Math.min(1920, naturalWidth * 0.7),
|
||||
width: (naturalWidth) => naturalWidth,
|
||||
height: (_, naturalHeight) => naturalHeight,
|
||||
resize: "contain",
|
||||
quality: 0.7
|
||||
useEffect(() => {
|
||||
(async function () {
|
||||
const images: FileWithURI[] = [];
|
||||
for (const image of props.images) {
|
||||
const compressed = compress
|
||||
? await compressImage(image, {
|
||||
maxWidth: (naturalWidth) => Math.min(1920, naturalWidth * 0.7),
|
||||
width: (naturalWidth) => naturalWidth,
|
||||
height: (_, naturalHeight) => naturalHeight,
|
||||
resize: "contain",
|
||||
quality: 0.7
|
||||
})
|
||||
: image;
|
||||
images.push(
|
||||
new FileWithURI([compressed], image.name, {
|
||||
lastModified: image.lastModified,
|
||||
type: image.type
|
||||
})
|
||||
: image;
|
||||
images.push(
|
||||
new FileWithURI([compressed], image.name, {
|
||||
lastModified: image.lastModified,
|
||||
type: image.type
|
||||
})
|
||||
);
|
||||
}
|
||||
setImages(images);
|
||||
})();
|
||||
}, [props.images, compress]);
|
||||
);
|
||||
}
|
||||
setImages(images);
|
||||
})();
|
||||
}, [props.images, compress]);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
images.forEach((i) => URL.revokeObjectURL(i.uri));
|
||||
};
|
||||
}, [images]);
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
images.forEach((i) => URL.revokeObjectURL(i.uri));
|
||||
};
|
||||
}, [images]);
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
onClose={() => props.onClose(false)}
|
||||
positiveButton={{
|
||||
text: "Insert",
|
||||
onClick: () => props.onClose(images)
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}
|
||||
>
|
||||
{selectedImage && (
|
||||
<Flex sx={{ flexDirection: "column", alignItems: "center", mt: 4 }}>
|
||||
<Image
|
||||
src={selectedImage.uri}
|
||||
sx={{
|
||||
maxHeight: 250,
|
||||
objectFit: "contain",
|
||||
alignSelf: "center",
|
||||
borderRadius: "default"
|
||||
}}
|
||||
/>
|
||||
<Text variant="subBody" sx={{ my: 2 }}>
|
||||
{selectedImage.name} ({formatBytes(selectedImage.size)})
|
||||
</Text>
|
||||
</Flex>
|
||||
)}
|
||||
{images.length > 1 ? (
|
||||
<ScrollContainer style={{ display: "flex" }}>
|
||||
{images.map((image, index) => (
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
onClose={() => props.onClose(false)}
|
||||
positiveButton={{
|
||||
text: "Insert",
|
||||
onClick: () => props.onClose(images)
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}
|
||||
>
|
||||
{selectedImage && (
|
||||
<Flex sx={{ flexDirection: "column", alignItems: "center", mt: 4 }}>
|
||||
<Image
|
||||
key={image.name + image.size}
|
||||
src={image.uri}
|
||||
src={selectedImage.uri}
|
||||
sx={{
|
||||
flexShrink: 0,
|
||||
height: "55px",
|
||||
width: "55px",
|
||||
maxHeight: 250,
|
||||
objectFit: "contain",
|
||||
border:
|
||||
selectedIndex === index
|
||||
? "2px solid var(--accent)"
|
||||
: "2px solid transparent",
|
||||
alignSelf: "center",
|
||||
borderRadius: "default"
|
||||
}}
|
||||
onClick={() => setSelectedIndex(index)}
|
||||
/>
|
||||
))}
|
||||
</ScrollContainer>
|
||||
) : null}
|
||||
<Text variant="subBody" sx={{ my: 2 }}>
|
||||
{selectedImage.name} ({formatBytes(selectedImage.size)})
|
||||
</Text>
|
||||
</Flex>
|
||||
)}
|
||||
{images.length > 1 ? (
|
||||
<ScrollContainer style={{ display: "flex" }}>
|
||||
{images.map((image, index) => (
|
||||
<Image
|
||||
key={image.name + image.size}
|
||||
src={image.uri}
|
||||
sx={{
|
||||
flexShrink: 0,
|
||||
height: "55px",
|
||||
width: "55px",
|
||||
objectFit: "contain",
|
||||
border:
|
||||
selectedIndex === index
|
||||
? "2px solid var(--accent)"
|
||||
: "2px solid transparent",
|
||||
borderRadius: "default"
|
||||
}}
|
||||
onClick={() => setSelectedIndex(index)}
|
||||
/>
|
||||
))}
|
||||
</ScrollContainer>
|
||||
) : null}
|
||||
|
||||
<Label variant="text.body" sx={{ mt: 2 }}>
|
||||
<input
|
||||
type="checkbox"
|
||||
style={{
|
||||
accentColor: "var(--accent)",
|
||||
marginRight: 1,
|
||||
width: 14,
|
||||
height: 14
|
||||
}}
|
||||
defaultChecked={compress}
|
||||
checked={compress}
|
||||
onChange={() => setCompress((s) => !s)}
|
||||
/>
|
||||
<span style={{ marginLeft: 5 }}>Enable compression (recommended)</span>
|
||||
</Label>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
<Label variant="text.body" sx={{ mt: 2 }}>
|
||||
<input
|
||||
type="checkbox"
|
||||
style={{
|
||||
accentColor: "var(--accent)",
|
||||
marginRight: 1,
|
||||
width: 14,
|
||||
height: 14
|
||||
}}
|
||||
defaultChecked={compress}
|
||||
checked={compress}
|
||||
onChange={() => setCompress((s) => !s)}
|
||||
/>
|
||||
<span style={{ marginLeft: 5 }}>
|
||||
Enable compression (recommended)
|
||||
</span>
|
||||
</Label>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import SettingsDialog from "./settings";
|
||||
|
||||
const AddNotebookDialog = React.lazy(() => import("./add-notebook-dialog"));
|
||||
const BuyDialog = React.lazy(() => import("./buy-dialog"));
|
||||
const Confirm = React.lazy(() => import("./confirm"));
|
||||
const EmailVerificationDialog = React.lazy(
|
||||
() => import("./email-verification-dialog")
|
||||
);
|
||||
const LoadingDialog = React.lazy(() => import("./loading-dialog"));
|
||||
const ProgressDialog = React.lazy(() => import("./progress-dialog"));
|
||||
const MoveDialog = React.lazy(() => import("./move-note-dialog"));
|
||||
const PasswordDialog = React.lazy(() => import("./password-dialog"));
|
||||
const RecoveryKeyDialog = React.lazy(() => import("./recovery-key-dialog"));
|
||||
const ItemDialog = React.lazy(() => import("./item-dialog"));
|
||||
const FeatureDialog = React.lazy(() => import("./feature-dialog"));
|
||||
const ReminderDialog = React.lazy(() => import("./reminder-dialog"));
|
||||
const AddReminderDialog = React.lazy(() => import("./add-reminder-dialog"));
|
||||
const ReminderPreviewDialog = React.lazy(
|
||||
() => import("./reminder-preview-dialog")
|
||||
);
|
||||
const AnnouncementDialog = React.lazy(() => import("./announcement-dialog"));
|
||||
const IssueDialog = React.lazy(() => import("./issue-dialog"));
|
||||
const MultifactorDialog = React.lazy(() => import("./mfa/multi-factor-dialog"));
|
||||
const RecoveryCodesDialog = React.lazy(
|
||||
() => import("./mfa/recovery-code-dialog")
|
||||
);
|
||||
// import { MultifactorDialog, RecoveryCodesDialog } from "./multi-factor-dialog";
|
||||
const OnboardingDialog = React.lazy(() => import("./onboarding-dialog"));
|
||||
const AttachmentsDialog = React.lazy(() => import("./attachments-dialog"));
|
||||
const Prompt = React.lazy(() => import("./prompt"));
|
||||
const MigrationDialog = React.lazy(() => import("./migration-dialog"));
|
||||
const EmailChangeDialog = React.lazy(() => import("./email-change-dialog"));
|
||||
const AddTagsDialog = React.lazy(() => import("./add-tags-dialog"));
|
||||
const ThemeDetailsDialog = React.lazy(() => import("./theme-details-dialog"));
|
||||
const BackupPasswordDialog = React.lazy(
|
||||
() => import("./backup-password-dialog")
|
||||
);
|
||||
const CreateColorDialog = React.lazy(() => import("./create-color-dialog"));
|
||||
const EditProfilePictureDialog = React.lazy(
|
||||
() => import("./edit-profile-picture-dialog")
|
||||
);
|
||||
const ImagePickerDialog = React.lazy(() => import("./image-picker-dialog"));
|
||||
const NoteLinkingDialog = React.lazy(() => import("./note-linking-dialog"));
|
||||
|
||||
export const Dialogs = {
|
||||
AddNotebookDialog,
|
||||
BuyDialog,
|
||||
Confirm,
|
||||
Prompt,
|
||||
EmailVerificationDialog,
|
||||
LoadingDialog,
|
||||
MoveDialog,
|
||||
PasswordDialog,
|
||||
RecoveryKeyDialog,
|
||||
ItemDialog,
|
||||
FeatureDialog,
|
||||
ProgressDialog,
|
||||
ReminderDialog,
|
||||
AnnouncementDialog,
|
||||
IssueDialog,
|
||||
MultifactorDialog,
|
||||
RecoveryCodesDialog,
|
||||
OnboardingDialog,
|
||||
AttachmentsDialog,
|
||||
MigrationDialog,
|
||||
AddReminderDialog,
|
||||
ReminderPreviewDialog,
|
||||
EmailChangeDialog,
|
||||
AddTagsDialog,
|
||||
SettingsDialog,
|
||||
ThemeDetailsDialog,
|
||||
BackupPasswordDialog,
|
||||
CreateColorDialog,
|
||||
EditProfilePictureDialog,
|
||||
ImagePickerDialog,
|
||||
NoteLinkingDialog
|
||||
};
|
||||
@@ -23,13 +23,14 @@ import Field from "../components/field";
|
||||
import Dialog from "../components/dialog";
|
||||
import platform from "platform";
|
||||
import { useState } from "react";
|
||||
import { confirm, Perform } from "../common/dialog-controller";
|
||||
import { isUserPremium } from "../hooks/use-is-user-premium";
|
||||
import { writeText } from "clipboard-polyfill";
|
||||
import { store as userstore } from "../stores/user-store";
|
||||
|
||||
import { ErrorText } from "../components/error-text";
|
||||
import { Debug } from "@notesnook/core/dist/api/debug";
|
||||
import { ConfirmDialog } from "./confirm";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
const PLACEHOLDERS = {
|
||||
title: "Briefly describe what happened",
|
||||
@@ -43,10 +44,10 @@ For example things like:
|
||||
This is all optional, of course.`
|
||||
};
|
||||
|
||||
type IssueDialogProps = {
|
||||
onClose: Perform;
|
||||
};
|
||||
function IssueDialog(props: IssueDialogProps) {
|
||||
type IssueDialogProps = BaseDialogProps<boolean>;
|
||||
export const IssueDialog = DialogManager.register(function IssueDialog(
|
||||
props: IssueDialogProps
|
||||
) {
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [error, setError] = useState<string>();
|
||||
|
||||
@@ -143,12 +144,10 @@ function IssueDialog(props: IssueDialogProps) {
|
||||
</Flex>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export default IssueDialog;
|
||||
});
|
||||
|
||||
function showIssueReportedDialog({ url }: { url: string }) {
|
||||
return confirm({
|
||||
return ConfirmDialog.show({
|
||||
title: "Thank you for reporting!",
|
||||
positiveButtonText: "Copy link",
|
||||
message: `You can track your bug report at [${url}](${url}).
|
||||
|
||||
@@ -20,18 +20,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import { Box } from "@theme-ui/components";
|
||||
import Dialog from "../components/dialog";
|
||||
import Field from "../components/field";
|
||||
import { Perform } from "../common/dialog-controller";
|
||||
import { useState } from "react";
|
||||
import { ErrorText } from "../components/error-text";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
import { db } from "../common/db";
|
||||
import { showToast } from "../utils/toast";
|
||||
import { useStore as useTagStore } from "../stores/tag-store";
|
||||
import { useStore as useNoteStore } from "../stores/note-store";
|
||||
import { useStore as useAppStore } from "../stores/app-store";
|
||||
import { Color, Tag } from "@notesnook/core";
|
||||
|
||||
type ItemDialogProps = {
|
||||
type ItemDialogProps = BaseDialogProps<false | string> & {
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
onClose: Perform;
|
||||
onAction: (title: string) => Promise<void>;
|
||||
defaultValue?: string;
|
||||
};
|
||||
function ItemDialog(props: ItemDialogProps) {
|
||||
export const ItemDialog = DialogManager.register(function ItemDialog(
|
||||
props: ItemDialogProps
|
||||
) {
|
||||
const [error, setError] = useState<Error>();
|
||||
|
||||
return (
|
||||
@@ -58,7 +64,7 @@ function ItemDialog(props: ItemDialogProps) {
|
||||
const title = formData.get("title");
|
||||
if (!title) return;
|
||||
try {
|
||||
await props.onAction(title as string);
|
||||
await props.onClose(title as string);
|
||||
} catch (e) {
|
||||
if (e instanceof Error) {
|
||||
setError(e);
|
||||
@@ -79,6 +85,47 @@ function ItemDialog(props: ItemDialogProps) {
|
||||
</Box>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default ItemDialog;
|
||||
export const CreateTagDialog = {
|
||||
show: () =>
|
||||
ItemDialog.show({
|
||||
title: "Create tag",
|
||||
subtitle: "You can create as many tags as you want."
|
||||
}).then(async (title) => {
|
||||
if (!title) return;
|
||||
await db.tags.add({ title });
|
||||
showToast("success", "Tag created!");
|
||||
useTagStore.getState().refresh();
|
||||
})
|
||||
};
|
||||
|
||||
export const EditTagDialog = {
|
||||
show: (tag: Tag) =>
|
||||
ItemDialog.show({
|
||||
title: "Edit tag",
|
||||
subtitle: `You are editing #${tag.title}.`,
|
||||
defaultValue: tag.title
|
||||
}).then(async (title) => {
|
||||
if (!title) return;
|
||||
await db.tags.add({ id: tag.id, title });
|
||||
showToast("success", "Tag edited!");
|
||||
await useTagStore.getState().refresh();
|
||||
await useNoteStore.getState().refresh();
|
||||
await useAppStore.getState().refreshNavItems();
|
||||
})
|
||||
};
|
||||
|
||||
export const RenameColorDialog = {
|
||||
show: (color: Color) =>
|
||||
ItemDialog.show({
|
||||
title: "Rename color",
|
||||
subtitle: `You are renaming color ${color.title}.`,
|
||||
defaultValue: color.title
|
||||
}).then(async (title) => {
|
||||
if (!title) return;
|
||||
await db.colors.add({ id: color.id, title });
|
||||
showToast("success", "Color renamed!");
|
||||
useAppStore.getState().refreshNavItems();
|
||||
})
|
||||
};
|
||||
|
||||
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { useState } from "react";
|
||||
import { Perform } from "../../common/dialog-controller";
|
||||
import Dialog from "../../components/dialog";
|
||||
import {
|
||||
AuthenticatorOnNext,
|
||||
@@ -31,65 +30,67 @@ import {
|
||||
import { Authenticator, OnNextFunction } from "./types";
|
||||
import { ErrorText } from "../../components/error-text";
|
||||
import { AuthenticatorType } from "@notesnook/core";
|
||||
import { BaseDialogProps, DialogManager } from "../../common/dialog-manager";
|
||||
|
||||
type MultifactorDialogProps = {
|
||||
onClose: Perform;
|
||||
type MultifactorDialogProps = BaseDialogProps<boolean> & {
|
||||
primaryMethod?: AuthenticatorType;
|
||||
};
|
||||
|
||||
export default function MultifactorDialog(props: MultifactorDialogProps) {
|
||||
const { onClose, primaryMethod } = props;
|
||||
const [step, setStep] = useState<
|
||||
| Step<AuthenticatorOnNext>
|
||||
| Step<AuthenticatorTypeOnNext>
|
||||
| FallbackStep<OnNextFunction>
|
||||
>(primaryMethod ? fallbackSteps.choose(primaryMethod) : steps.choose());
|
||||
const [error, setError] = useState<string>();
|
||||
export const MultifactorDialog = DialogManager.register(
|
||||
function MultifactorDialog(props: MultifactorDialogProps) {
|
||||
const { onClose, primaryMethod } = props;
|
||||
const [step, setStep] = useState<
|
||||
| Step<AuthenticatorOnNext>
|
||||
| Step<AuthenticatorTypeOnNext>
|
||||
| FallbackStep<OnNextFunction>
|
||||
>(primaryMethod ? fallbackSteps.choose(primaryMethod) : steps.choose());
|
||||
const [error, setError] = useState<string>();
|
||||
|
||||
if (!step) return null;
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={step.title}
|
||||
description={step.description}
|
||||
width={500}
|
||||
positiveButton={
|
||||
step.next
|
||||
? {
|
||||
text: "Continue",
|
||||
form: "2faForm"
|
||||
}
|
||||
: null
|
||||
}
|
||||
negativeButton={
|
||||
step.cancellable
|
||||
? {
|
||||
text: "Cancel",
|
||||
onClick: () => props.onClose(false)
|
||||
}
|
||||
: null
|
||||
}
|
||||
>
|
||||
{step.component && (
|
||||
<step.component
|
||||
onNext={(arg: AuthenticatorType | Authenticator) => {
|
||||
if (!step.next) return onClose(true);
|
||||
if (!step) return null;
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={step.title}
|
||||
description={step.description}
|
||||
width={500}
|
||||
positiveButton={
|
||||
step.next
|
||||
? {
|
||||
text: "Continue",
|
||||
form: "2faForm"
|
||||
}
|
||||
: null
|
||||
}
|
||||
negativeButton={
|
||||
step.cancellable
|
||||
? {
|
||||
text: "Cancel",
|
||||
onClick: () => props.onClose(false)
|
||||
}
|
||||
: null
|
||||
}
|
||||
>
|
||||
{step.component && (
|
||||
<step.component
|
||||
onNext={(arg: AuthenticatorType | Authenticator) => {
|
||||
if (!step.next) return onClose(true);
|
||||
|
||||
const nextStep =
|
||||
step.next !== "recoveryCodes" && primaryMethod
|
||||
? fallbackSteps[step.next](
|
||||
arg as AuthenticatorType & Authenticator,
|
||||
primaryMethod
|
||||
)
|
||||
: steps[step.next](arg as AuthenticatorType & Authenticator);
|
||||
const nextStep =
|
||||
step.next !== "recoveryCodes" && primaryMethod
|
||||
? fallbackSteps[step.next](
|
||||
arg as AuthenticatorType & Authenticator,
|
||||
primaryMethod
|
||||
)
|
||||
: steps[step.next](arg as AuthenticatorType & Authenticator);
|
||||
|
||||
setStep(nextStep);
|
||||
}}
|
||||
onError={setError}
|
||||
onClose={onClose}
|
||||
/>
|
||||
)}
|
||||
<ErrorText error={error} />
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
setStep(nextStep);
|
||||
}}
|
||||
onError={setError}
|
||||
onClose={onClose}
|
||||
/>
|
||||
)}
|
||||
<ErrorText error={error} />
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -18,37 +18,38 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { useState } from "react";
|
||||
import { Perform } from "../../common/dialog-controller";
|
||||
import Dialog from "../../components/dialog";
|
||||
import { steps } from "./steps";
|
||||
import { ErrorText } from "../../components/error-text";
|
||||
import { AuthenticatorType } from "@notesnook/core";
|
||||
import { BaseDialogProps, DialogManager } from "../../common/dialog-manager";
|
||||
|
||||
type RecoveryCodesDialogProps = {
|
||||
onClose: Perform;
|
||||
type RecoveryCodesDialogProps = BaseDialogProps<boolean> & {
|
||||
primaryMethod: AuthenticatorType;
|
||||
};
|
||||
|
||||
export default function RecoveryCodesDialog(props: RecoveryCodesDialogProps) {
|
||||
const { onClose, primaryMethod } = props;
|
||||
const [error, setError] = useState<string>();
|
||||
const step = steps.recoveryCodes(primaryMethod);
|
||||
export const RecoveryCodesDialog = DialogManager.register(
|
||||
function RecoveryCodesDialog(props: RecoveryCodesDialogProps) {
|
||||
const { onClose, primaryMethod } = props;
|
||||
const [error, setError] = useState<string>();
|
||||
const step = steps.recoveryCodes(primaryMethod);
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={step.title}
|
||||
description={step.description}
|
||||
width={500}
|
||||
positiveButton={{
|
||||
text: "Okay",
|
||||
onClick: () => onClose(true)
|
||||
}}
|
||||
>
|
||||
{step.component && (
|
||||
<step.component onNext={() => {}} onError={setError} />
|
||||
)}
|
||||
<ErrorText error={error} />
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={step.title}
|
||||
description={step.description}
|
||||
width={500}
|
||||
positiveButton={{
|
||||
text: "Okay",
|
||||
onClick: () => onClose(true)
|
||||
}}
|
||||
>
|
||||
{step.component && (
|
||||
<step.component onNext={() => {}} onError={setError} />
|
||||
)}
|
||||
<ErrorText error={error} />
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -55,9 +55,9 @@ import {
|
||||
StepComponentProps,
|
||||
OnNextFunction
|
||||
} from "./types";
|
||||
import { showMultifactorDialog } from "../../common/dialog-controller";
|
||||
import { ErrorText } from "../../components/error-text";
|
||||
import { AuthenticatorType } from "@notesnook/core";
|
||||
import { MultifactorDialog } from "./multi-factor-dialog";
|
||||
|
||||
const QRCode = React.lazy(() => import("../../re-exports/react-qrcode-logo"));
|
||||
|
||||
@@ -734,7 +734,9 @@ function TwoFactorEnabled(props: TwoFactorEnabledProps) {
|
||||
onClick={() => {
|
||||
props.onClose && props.onClose(true);
|
||||
setTimeout(async () => {
|
||||
await showMultifactorDialog(props.authenticatorType);
|
||||
await MultifactorDialog.show({
|
||||
primaryMethod: props.authenticatorType
|
||||
});
|
||||
}, 100);
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { AuthenticatorType } from "@notesnook/core";
|
||||
import { Perform } from "../../common/dialog-controller";
|
||||
import { Icon } from "../../components/icons";
|
||||
|
||||
export type Authenticator = {
|
||||
@@ -31,7 +30,7 @@ export type Authenticator = {
|
||||
|
||||
export type StepComponentProps<T extends OnNextFunction> = {
|
||||
onNext: T;
|
||||
onClose?: Perform;
|
||||
onClose?: (result: boolean) => void;
|
||||
onError?: (error: string) => void;
|
||||
};
|
||||
|
||||
|
||||
@@ -22,11 +22,10 @@ import { Text } from "@theme-ui/components";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { createBackup } from "../common";
|
||||
import { db } from "../common/db";
|
||||
import { Perform } from "../common/dialog-controller";
|
||||
import { TaskManager } from "../common/task-manager";
|
||||
|
||||
import Dialog from "../components/dialog";
|
||||
import { ErrorText } from "../components/error-text";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
type MigrationProgressEvent = {
|
||||
collection: string;
|
||||
@@ -34,11 +33,10 @@ type MigrationProgressEvent = {
|
||||
current: number;
|
||||
};
|
||||
|
||||
export type MigrationDialogProps = {
|
||||
onClose: Perform;
|
||||
};
|
||||
|
||||
export default function MigrationDialog(props: MigrationDialogProps) {
|
||||
export type MigrationDialogProps = BaseDialogProps<boolean>;
|
||||
export const MigrationDialog = DialogManager.register(function MigrationDialog(
|
||||
props: MigrationDialogProps
|
||||
) {
|
||||
const [error, setError] = useState<Error>();
|
||||
const [isProcessing, setIsProcessing] = useState(false);
|
||||
|
||||
@@ -133,4 +131,4 @@ export default function MigrationDialog(props: MigrationDialogProps) {
|
||||
</Text>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,7 +34,6 @@ import Dialog from "../components/dialog";
|
||||
import { useStore } from "../stores/notebook-store";
|
||||
import { store as noteStore } from "../stores/note-store";
|
||||
import { store as notebookStore } from "../stores/notebook-store";
|
||||
import { Perform, showAddNotebookDialog } from "../common/dialog-controller";
|
||||
import { showToast } from "../utils/toast";
|
||||
import { isMac } from "../utils/platform";
|
||||
import { create } from "zustand";
|
||||
@@ -48,8 +47,10 @@ import {
|
||||
import { FlexScrollContainer } from "../components/scroll-container";
|
||||
import { pluralize } from "@notesnook/common";
|
||||
import Field from "../components/field";
|
||||
import { AddNotebookDialog } from "./add-notebook-dialog";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
type MoveDialogProps = { onClose: Perform; noteIds: string[] };
|
||||
type MoveNoteDialogProps = BaseDialogProps<boolean> & { noteIds: string[] };
|
||||
type NotebookReference = {
|
||||
id: string;
|
||||
new: boolean;
|
||||
@@ -69,7 +70,10 @@ export const useSelectionStore = create<ISelectionStore>((set) => ({
|
||||
setIsMultiselect: (isMultiselect) => set({ isMultiselect })
|
||||
}));
|
||||
|
||||
function MoveDialog({ onClose, noteIds }: MoveDialogProps) {
|
||||
export const MoveNoteDialog = DialogManager.register(function MoveNoteDialog({
|
||||
onClose,
|
||||
noteIds
|
||||
}: MoveNoteDialogProps) {
|
||||
const setSelected = useSelectionStore((store) => store.setSelected);
|
||||
const setIsMultiselect = useSelectionStore((store) => store.setIsMultiselect);
|
||||
const isMultiselect = useSelectionStore((store) => store.isMultiselect);
|
||||
@@ -284,6 +288,7 @@ function MoveDialog({ onClose, noteIds }: MoveDialogProps) {
|
||||
isExpanded={props.context.isExpanded || false}
|
||||
toggle={props.context.toggleExpandedState}
|
||||
onCreateItem={() => {
|
||||
console.log([props.item.index]);
|
||||
reloadItem.current?.([props.item.index]);
|
||||
treeRef.current?.expandItem(
|
||||
props.item.index,
|
||||
@@ -318,10 +323,12 @@ function MoveDialog({ onClose, noteIds }: MoveDialogProps) {
|
||||
variant="secondary"
|
||||
sx={{ mt: 2 }}
|
||||
onClick={() =>
|
||||
showAddNotebookDialog().then(() =>
|
||||
db.notebooks.roots
|
||||
.ids(db.settings.getGroupOptions("notebooks"))
|
||||
.then((ids) => setNotebooks(ids))
|
||||
AddNotebookDialog.show({}).then((res) =>
|
||||
res
|
||||
? db.notebooks.roots
|
||||
.ids(db.settings.getGroupOptions("notebooks"))
|
||||
.then((ids) => setNotebooks(ids))
|
||||
: null
|
||||
)
|
||||
}
|
||||
>
|
||||
@@ -331,7 +338,8 @@ function MoveDialog({ onClose, noteIds }: MoveDialogProps) {
|
||||
)}
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
function calculateIndentation(
|
||||
expandable: boolean,
|
||||
depth: number,
|
||||
@@ -443,7 +451,7 @@ function NotebookItem(props: {
|
||||
title="New notebook"
|
||||
onClick={async (e) => {
|
||||
e.stopPropagation();
|
||||
await showAddNotebookDialog(notebook.id);
|
||||
await AddNotebookDialog.show({ parentId: notebook.id });
|
||||
onCreateItem();
|
||||
}}
|
||||
/>
|
||||
@@ -462,8 +470,6 @@ function TopicSelectionIndicator({ notebook }: { notebook: Notebook }) {
|
||||
return <Circle size={8} color="accent" sx={{ mr: 1 }} />;
|
||||
}
|
||||
|
||||
export default MoveDialog;
|
||||
|
||||
function SelectedCheck({
|
||||
item,
|
||||
size = 20,
|
||||
|
||||
@@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Perform } from "../common/dialog-controller";
|
||||
import Field from "../components/field";
|
||||
import Dialog from "../components/dialog";
|
||||
import { useState } from "react";
|
||||
@@ -35,211 +34,212 @@ import { LinkAttributes } from "@notesnook/editor/dist/extensions/link";
|
||||
import { NoteResolvedData, ResolvedItem } from "@notesnook/common";
|
||||
import { Lock } from "../components/icons";
|
||||
import { ellipsize } from "@notesnook/core/dist/utils/content-block";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
export type NoteLinkingDialogProps = {
|
||||
export type NoteLinkingDialogProps = BaseDialogProps<LinkAttributes | false> & {
|
||||
attributes?: LinkAttributes;
|
||||
onClose: Perform;
|
||||
onDone: Perform<LinkAttributes>;
|
||||
};
|
||||
const HEADING_TYPES = ["h1", "h2", "h3", "h4", "h5", "h6"];
|
||||
|
||||
export default function NoteLinkingDialog(props: NoteLinkingDialogProps) {
|
||||
const { attributes } = props;
|
||||
const [notes, setNotes] = useState<VirtualizedGrouping<NoteType>>();
|
||||
const [selectedNote, setSelectedNote] = useState<NoteType>();
|
||||
const [isNoteLocked, setIsNoteLocked] = useState(false);
|
||||
const [blocks, setBlocks] = useState<ContentBlock[]>([]);
|
||||
const [filteredBlocks, setFilteredBlocks] = useState<
|
||||
ContentBlock[] | undefined
|
||||
>();
|
||||
export const NoteLinkingDialog = DialogManager.register(
|
||||
function NoteLinkingDialog(props: NoteLinkingDialogProps) {
|
||||
const { attributes } = props;
|
||||
const [notes, setNotes] = useState<VirtualizedGrouping<NoteType>>();
|
||||
const [selectedNote, setSelectedNote] = useState<NoteType>();
|
||||
const [isNoteLocked, setIsNoteLocked] = useState(false);
|
||||
const [blocks, setBlocks] = useState<ContentBlock[]>([]);
|
||||
const [filteredBlocks, setFilteredBlocks] = useState<
|
||||
ContentBlock[] | undefined
|
||||
>();
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={attributes ? "Edit internal link" : "Link to note"}
|
||||
width={500}
|
||||
onClose={() => props.onClose(false)}
|
||||
onOpen={async () => {
|
||||
setNotes(
|
||||
await db.notes.all.sorted(db.settings.getGroupOptions("home"))
|
||||
);
|
||||
}}
|
||||
positiveButton={{
|
||||
text: "Insert link",
|
||||
disabled: !selectedNote,
|
||||
onClick: () =>
|
||||
selectedNote
|
||||
? props.onDone({
|
||||
title: selectedNote.title,
|
||||
href: createInternalLink("note", selectedNote.id)
|
||||
})
|
||||
: null
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}
|
||||
noScroll
|
||||
>
|
||||
<Flex variant="columnFill" sx={{ mx: 3, overflow: "hidden" }}>
|
||||
{selectedNote ? (
|
||||
<>
|
||||
<Field
|
||||
autoFocus
|
||||
placeholder="Type # to only search headings"
|
||||
sx={{ mx: 0 }}
|
||||
onChange={async (e) => {
|
||||
const query = e.target.value.trim().toLowerCase();
|
||||
if (!query) {
|
||||
setFilteredBlocks(undefined);
|
||||
} else {
|
||||
setFilteredBlocks(
|
||||
query.startsWith("#")
|
||||
? blocks.filter(
|
||||
(v) =>
|
||||
HEADING_TYPES.includes(v.type) &&
|
||||
return (
|
||||
<Dialog
|
||||
isOpen={true}
|
||||
title={attributes ? "Edit internal link" : "Link to note"}
|
||||
width={500}
|
||||
onClose={() => props.onClose(false)}
|
||||
onOpen={async () => {
|
||||
setNotes(
|
||||
await db.notes.all.sorted(db.settings.getGroupOptions("home"))
|
||||
);
|
||||
}}
|
||||
positiveButton={{
|
||||
text: "Insert link",
|
||||
disabled: !selectedNote,
|
||||
onClick: () =>
|
||||
selectedNote
|
||||
? props.onClose({
|
||||
title: selectedNote.title,
|
||||
href: createInternalLink("note", selectedNote.id)
|
||||
})
|
||||
: null
|
||||
}}
|
||||
negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}
|
||||
noScroll
|
||||
>
|
||||
<Flex variant="columnFill" sx={{ mx: 3, overflow: "hidden" }}>
|
||||
{selectedNote ? (
|
||||
<>
|
||||
<Field
|
||||
autoFocus
|
||||
placeholder="Type # to only search headings"
|
||||
sx={{ mx: 0 }}
|
||||
onChange={async (e) => {
|
||||
const query = e.target.value.trim().toLowerCase();
|
||||
if (!query) {
|
||||
setFilteredBlocks(undefined);
|
||||
} else {
|
||||
setFilteredBlocks(
|
||||
query.startsWith("#")
|
||||
? blocks.filter(
|
||||
(v) =>
|
||||
HEADING_TYPES.includes(v.type) &&
|
||||
v.content.toLowerCase().includes(query)
|
||||
)
|
||||
: blocks.filter((v) =>
|
||||
v.content.toLowerCase().includes(query)
|
||||
)
|
||||
: blocks.filter((v) =>
|
||||
v.content.toLowerCase().includes(query)
|
||||
)
|
||||
);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
variant="accentSecondary"
|
||||
sx={{ mt: 1, textAlign: "left" }}
|
||||
onClick={() => {
|
||||
setSelectedNote(undefined);
|
||||
setIsNoteLocked(false);
|
||||
setFilteredBlocks(undefined);
|
||||
setBlocks([]);
|
||||
}}
|
||||
>
|
||||
Selected note: {selectedNote.title} (click to deselect)
|
||||
</Button>
|
||||
{isNoteLocked ? (
|
||||
<Text variant="body" sx={{ mt: 1 }}>
|
||||
Linking to a specific block is not available for locked notes.
|
||||
</Text>
|
||||
) : blocks.length <= 0 ? (
|
||||
<Text variant="body" sx={{ mt: 1 }}>
|
||||
There are no blocks in this note.
|
||||
</Text>
|
||||
) : null}
|
||||
<ScrollContainer>
|
||||
<VirtualizedList
|
||||
items={filteredBlocks || blocks}
|
||||
estimatedSize={34}
|
||||
mode="dynamic"
|
||||
itemGap={5}
|
||||
getItemKey={(i) => blocks[i].id}
|
||||
mt={1}
|
||||
renderItem={({ item }) => (
|
||||
<Button
|
||||
variant="menuitem"
|
||||
sx={{
|
||||
p: 1,
|
||||
width: "100%",
|
||||
textAlign: "left",
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
borderBottom: "1px solid var(--border)"
|
||||
}}
|
||||
onClick={() => {
|
||||
props.onDone({
|
||||
title: selectedNote.title,
|
||||
href: createInternalLink("note", selectedNote.id, {
|
||||
blockId: item.id
|
||||
})
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
variant="body"
|
||||
sx={{ fontFamily: "monospace", whiteSpace: "pre-wrap" }}
|
||||
>
|
||||
{ellipsize(item.content, 200, "end").trim() ||
|
||||
"(empty block)"}
|
||||
</Text>
|
||||
<Text
|
||||
variant="subBody"
|
||||
sx={{
|
||||
bg: "background-secondary",
|
||||
flexShrink: 0,
|
||||
p: "small",
|
||||
px: 1,
|
||||
borderRadius: "default",
|
||||
alignSelf: "flex-start"
|
||||
}}
|
||||
>
|
||||
{item.type.toUpperCase()}
|
||||
</Text>
|
||||
</Button>
|
||||
)}
|
||||
)
|
||||
);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</ScrollContainer>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Field
|
||||
autoFocus
|
||||
placeholder="Search for a note to link to..."
|
||||
sx={{ mx: 0 }}
|
||||
onChange={async (e) => {
|
||||
const query = e.target.value.trim();
|
||||
setNotes(
|
||||
query
|
||||
? await db.lookup.notes(e.target.value).sorted()
|
||||
: await db.notes.all.sorted(
|
||||
db.settings.getGroupOptions("home")
|
||||
)
|
||||
);
|
||||
}}
|
||||
/>
|
||||
{notes && (
|
||||
<Button
|
||||
variant="accentSecondary"
|
||||
sx={{ mt: 1, textAlign: "left" }}
|
||||
onClick={() => {
|
||||
setSelectedNote(undefined);
|
||||
setIsNoteLocked(false);
|
||||
setFilteredBlocks(undefined);
|
||||
setBlocks([]);
|
||||
}}
|
||||
>
|
||||
Selected note: {selectedNote.title} (click to deselect)
|
||||
</Button>
|
||||
{isNoteLocked ? (
|
||||
<Text variant="body" sx={{ mt: 1 }}>
|
||||
Linking to a specific block is not available for locked notes.
|
||||
</Text>
|
||||
) : blocks.length <= 0 ? (
|
||||
<Text variant="body" sx={{ mt: 1 }}>
|
||||
There are no blocks in this note.
|
||||
</Text>
|
||||
) : null}
|
||||
<ScrollContainer>
|
||||
<VirtualizedList
|
||||
items={notes.placeholders}
|
||||
estimatedSize={28}
|
||||
items={filteredBlocks || blocks}
|
||||
estimatedSize={34}
|
||||
mode="dynamic"
|
||||
itemGap={5}
|
||||
getItemKey={notes.key}
|
||||
getItemKey={(i) => blocks[i].id}
|
||||
mt={1}
|
||||
renderItem={({ index }) => (
|
||||
<ResolvedItem items={notes} index={index} type="note">
|
||||
{({ item: note, data }) => (
|
||||
<Button
|
||||
variant="menuitem"
|
||||
sx={{
|
||||
p: 1,
|
||||
width: "100%",
|
||||
textAlign: "left",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: 1,
|
||||
borderBottom: "1px solid var(--border)"
|
||||
}}
|
||||
onClick={async () => {
|
||||
setSelectedNote(note);
|
||||
setIsNoteLocked(
|
||||
!!(data as NoteResolvedData).locked
|
||||
);
|
||||
setBlocks(await db.notes.contentBlocks(note.id));
|
||||
}}
|
||||
>
|
||||
<Text variant="body">{note.title}</Text>
|
||||
{(data as NoteResolvedData).locked ? (
|
||||
<Lock size={14} />
|
||||
) : null}
|
||||
</Button>
|
||||
)}
|
||||
</ResolvedItem>
|
||||
renderItem={({ item }) => (
|
||||
<Button
|
||||
variant="menuitem"
|
||||
sx={{
|
||||
p: 1,
|
||||
width: "100%",
|
||||
textAlign: "left",
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
borderBottom: "1px solid var(--border)"
|
||||
}}
|
||||
onClick={() => {
|
||||
props.onClose({
|
||||
title: selectedNote.title,
|
||||
href: createInternalLink("note", selectedNote.id, {
|
||||
blockId: item.id
|
||||
})
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
variant="body"
|
||||
sx={{ fontFamily: "monospace", whiteSpace: "pre-wrap" }}
|
||||
>
|
||||
{ellipsize(item.content, 200, "end").trim() ||
|
||||
"(empty block)"}
|
||||
</Text>
|
||||
<Text
|
||||
variant="subBody"
|
||||
sx={{
|
||||
bg: "background-secondary",
|
||||
flexShrink: 0,
|
||||
p: "small",
|
||||
px: 1,
|
||||
borderRadius: "default",
|
||||
alignSelf: "flex-start"
|
||||
}}
|
||||
>
|
||||
{item.type.toUpperCase()}
|
||||
</Text>
|
||||
</Button>
|
||||
)}
|
||||
/>
|
||||
</ScrollContainer>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</Flex>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Field
|
||||
autoFocus
|
||||
placeholder="Search for a note to link to..."
|
||||
sx={{ mx: 0 }}
|
||||
onChange={async (e) => {
|
||||
const query = e.target.value.trim();
|
||||
setNotes(
|
||||
query
|
||||
? await db.lookup.notes(e.target.value).sorted()
|
||||
: await db.notes.all.sorted(
|
||||
db.settings.getGroupOptions("home")
|
||||
)
|
||||
);
|
||||
}}
|
||||
/>
|
||||
{notes && (
|
||||
<ScrollContainer>
|
||||
<VirtualizedList
|
||||
items={notes.placeholders}
|
||||
estimatedSize={28}
|
||||
itemGap={5}
|
||||
getItemKey={notes.key}
|
||||
mt={1}
|
||||
renderItem={({ index }) => (
|
||||
<ResolvedItem items={notes} index={index} type="note">
|
||||
{({ item: note, data }) => (
|
||||
<Button
|
||||
variant="menuitem"
|
||||
sx={{
|
||||
p: 1,
|
||||
width: "100%",
|
||||
textAlign: "left",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: 1,
|
||||
borderBottom: "1px solid var(--border)"
|
||||
}}
|
||||
onClick={async () => {
|
||||
setSelectedNote(note);
|
||||
setIsNoteLocked(
|
||||
!!(data as NoteResolvedData).locked
|
||||
);
|
||||
setBlocks(await db.notes.contentBlocks(note.id));
|
||||
}}
|
||||
>
|
||||
<Text variant="body">{note.title}</Text>
|
||||
{(data as NoteResolvedData).locked ? (
|
||||
<Lock size={14} />
|
||||
) : null}
|
||||
</Button>
|
||||
)}
|
||||
</ResolvedItem>
|
||||
)}
|
||||
/>
|
||||
</ScrollContainer>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</Flex>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -39,7 +39,6 @@ import AppleStore from "../assets/apple.png";
|
||||
import { useStore as useThemeStore } from "../stores/theme-store";
|
||||
import { Checkbox, Label } from "@theme-ui/components";
|
||||
import { Features } from "../components/announcements/body";
|
||||
import { showBuyDialog } from "../common/dialog-controller";
|
||||
import { TaskManager } from "../common/task-manager";
|
||||
import { db } from "../common/db";
|
||||
import { usePersistentState } from "../hooks/use-persistent-state";
|
||||
@@ -47,8 +46,20 @@ import { useCallback, useState } from "react";
|
||||
import Config from "../utils/config";
|
||||
import { isMacStoreApp } from "../utils/platform";
|
||||
import { ErrorText } from "../components/error-text";
|
||||
import { BuyDialog } from "./buy-dialog";
|
||||
import { BaseDialogProps, DialogManager } from "../common/dialog-manager";
|
||||
|
||||
const newUserSteps = [
|
||||
type Step = {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
buttonText?: string;
|
||||
image?: JSX.Element;
|
||||
component?:
|
||||
| (() => JSX.Element)
|
||||
| ((props: { onNext: () => void }) => JSX.Element)
|
||||
| ((props: { onClose: () => void }) => JSX.Element);
|
||||
};
|
||||
const newUserSteps: Step[] = [
|
||||
{
|
||||
title: "Safe & encrypted notes",
|
||||
subtitle: "Write with freedom. Never compromise on privacy again.",
|
||||
@@ -86,7 +97,7 @@ const newUserSteps = [
|
||||
}
|
||||
];
|
||||
|
||||
const proUserSteps = [
|
||||
const proUserSteps: Step[] = [
|
||||
{
|
||||
title: "Welcome to Notesnook Pro",
|
||||
subtitle: "Thank you. You are the proof that privacy always comes first.",
|
||||
@@ -112,7 +123,7 @@ const proUserSteps = [
|
||||
}
|
||||
];
|
||||
|
||||
const trialUserSteps = [
|
||||
const trialUserSteps: Step[] = [
|
||||
{
|
||||
title: "Congratulations!",
|
||||
subtitle: "You 14-day free trial has been activated.",
|
||||
@@ -125,93 +136,111 @@ const onboarding = {
|
||||
new: newUserSteps,
|
||||
pro: proUserSteps,
|
||||
trial: trialUserSteps
|
||||
};
|
||||
} as const;
|
||||
|
||||
export function interruptedOnboarding() {
|
||||
for (let key in onboarding) {
|
||||
export function interruptedOnboarding(): keyof typeof onboarding | undefined {
|
||||
for (const key in onboarding) {
|
||||
const index = Config.get(key, undefined);
|
||||
if (index === null || index === undefined) continue;
|
||||
if (index >= 0 && index < onboarding[key].length - 1) return key;
|
||||
if (
|
||||
index >= 0 &&
|
||||
index < onboarding[key as keyof typeof onboarding].length - 1
|
||||
)
|
||||
return key as keyof typeof onboarding;
|
||||
}
|
||||
}
|
||||
|
||||
function OnboardingDialog({ onClose: _onClose, type }) {
|
||||
const [step, setStep] = usePersistentState(type, 0);
|
||||
const steps = onboarding[type];
|
||||
type OnboardingDialogProps = BaseDialogProps<boolean> & {
|
||||
type: keyof typeof onboarding;
|
||||
};
|
||||
export const OnboardingDialog = DialogManager.register(
|
||||
function OnboardingDialog({
|
||||
onClose: _onClose,
|
||||
type
|
||||
}: OnboardingDialogProps) {
|
||||
const [step, setStep] = usePersistentState(type, 0);
|
||||
console.log("STEPS", type);
|
||||
const steps = onboarding[type];
|
||||
|
||||
const onClose = useCallback(() => {
|
||||
Config.set(type, steps.length);
|
||||
_onClose();
|
||||
}, [_onClose, type, steps]);
|
||||
const onClose = useCallback(
|
||||
(result: boolean) => {
|
||||
Config.set(type, steps.length);
|
||||
_onClose(result);
|
||||
},
|
||||
[_onClose, type, steps]
|
||||
);
|
||||
|
||||
const onNext = useCallback(() => {
|
||||
if (step === steps.length - 1) onClose();
|
||||
else setStep((s) => ++s);
|
||||
}, [onClose, setStep, step, steps.length]);
|
||||
const onNext = useCallback(() => {
|
||||
if (step === steps.length - 1) onClose(true);
|
||||
else setStep((s) => ++s);
|
||||
}, [onClose, setStep, step, steps.length]);
|
||||
|
||||
if (!steps || !steps[step] || !type) {
|
||||
onClose();
|
||||
return null;
|
||||
}
|
||||
if (!steps || !steps[step] || !type) {
|
||||
onClose(false);
|
||||
return null;
|
||||
}
|
||||
|
||||
const {
|
||||
title,
|
||||
subtitle,
|
||||
image,
|
||||
component: Component,
|
||||
buttonText
|
||||
} = steps[step];
|
||||
const {
|
||||
title,
|
||||
subtitle,
|
||||
image,
|
||||
component: Component,
|
||||
buttonText
|
||||
} = steps[step];
|
||||
|
||||
return (
|
||||
<Dialog isOpen={true} width={500}>
|
||||
<Flex
|
||||
sx={{
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
overflowY: "auto"
|
||||
}}
|
||||
>
|
||||
{image}
|
||||
<Text variant={"heading"} mt={2}>
|
||||
{title}
|
||||
</Text>
|
||||
<Text
|
||||
variant={"body"}
|
||||
return (
|
||||
<Dialog isOpen={true} width={500}>
|
||||
<Flex
|
||||
sx={{
|
||||
textAlign: "center",
|
||||
maxWidth: "70%",
|
||||
color: "var(--paragraph-secondary)"
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
overflowY: "auto"
|
||||
}}
|
||||
>
|
||||
{subtitle}
|
||||
</Text>
|
||||
{Component && <Component onClose={onClose} onNext={onNext} />}
|
||||
{buttonText && (
|
||||
<Button
|
||||
variant="accent"
|
||||
sx={{ borderRadius: 50, px: 30, mb: 4, mt: Component ? 0 : 4 }}
|
||||
onClick={onNext}
|
||||
{image}
|
||||
<Text variant={"heading"} mt={2}>
|
||||
{title}
|
||||
</Text>
|
||||
<Text
|
||||
variant={"body"}
|
||||
sx={{
|
||||
textAlign: "center",
|
||||
maxWidth: "70%",
|
||||
color: "var(--paragraph-secondary)"
|
||||
}}
|
||||
>
|
||||
{buttonText}
|
||||
</Button>
|
||||
)}
|
||||
</Flex>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
export default OnboardingDialog;
|
||||
{subtitle}
|
||||
</Text>
|
||||
{Component && (
|
||||
<Component onClose={() => onClose(true)} onNext={onNext} />
|
||||
)}
|
||||
{buttonText && (
|
||||
<Button
|
||||
variant="accent"
|
||||
sx={{ borderRadius: 50, px: 30, mb: 4, mt: Component ? 0 : 4 }}
|
||||
onClick={onNext}
|
||||
>
|
||||
{buttonText}
|
||||
</Button>
|
||||
)}
|
||||
</Flex>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
function JoinCause({ onNext }) {
|
||||
function JoinCause({ onNext }: { onNext: () => void }) {
|
||||
return (
|
||||
<Flex mb={4} sx={{ flexDirection: "column" }}>
|
||||
<Button
|
||||
as="a"
|
||||
href="https://discord.com/invite/zQBK97EE22"
|
||||
target="_blank"
|
||||
mt={4}
|
||||
variant="accent"
|
||||
sx={{ borderRadius: 50, alignSelf: "center", px: 30 }}
|
||||
onClick={() => onNext()}
|
||||
onClick={() => {
|
||||
window.open("https://go.notesnook.com/discord", "_blank");
|
||||
onNext();
|
||||
}}
|
||||
>
|
||||
Join the community
|
||||
</Button>
|
||||
@@ -235,7 +264,7 @@ const importers = [
|
||||
{ title: "Google Keep" },
|
||||
{ title: "Standard Notes" }
|
||||
];
|
||||
function Importer({ onClose }) {
|
||||
function Importer({ onClose }: { onClose: () => void }) {
|
||||
return (
|
||||
<Flex my={4} sx={{ flexDirection: "column" }}>
|
||||
<Box sx={{ display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 1 }}>
|
||||
@@ -260,12 +289,13 @@ function Importer({ onClose }) {
|
||||
</Box>
|
||||
<Button
|
||||
as="a"
|
||||
href="https://importer.notesnook.com/"
|
||||
target="_blank"
|
||||
mt={4}
|
||||
variant="accent"
|
||||
sx={{ borderRadius: 50, alignSelf: "center", px: 30 }}
|
||||
onClick={() => onClose()}
|
||||
onClick={() => {
|
||||
window.open("https://importer.notesnook.com/", "_blank");
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
Start importing now
|
||||
</Button>
|
||||
@@ -315,7 +345,6 @@ function Support() {
|
||||
<Button
|
||||
key={channel.key}
|
||||
as="a"
|
||||
href={channel.url}
|
||||
variant={"icon"}
|
||||
sx={{
|
||||
display: "flex",
|
||||
@@ -323,6 +352,7 @@ function Support() {
|
||||
borderRadius: "default",
|
||||
alignItems: "center"
|
||||
}}
|
||||
onClick={() => window.open(channel.url)}
|
||||
>
|
||||
<channel.icon size={16} />
|
||||
<Text variant={"body"} ml={1}>
|
||||
@@ -335,8 +365,8 @@ function Support() {
|
||||
}
|
||||
|
||||
const themes = [
|
||||
{ key: "light", name: "Light", image: LightUI },
|
||||
{ key: "dark", name: "Dark", image: DarkUI }
|
||||
{ key: "light" as const, name: "Light", image: LightUI },
|
||||
{ key: "dark" as const, name: "Dark", image: DarkUI }
|
||||
];
|
||||
|
||||
function ThemeSelector() {
|
||||
@@ -436,9 +466,9 @@ function CrossPlatform() {
|
||||
);
|
||||
}
|
||||
|
||||
function TrialOffer({ onClose }) {
|
||||
const [error, setError] = useState();
|
||||
const [loading, setLoading] = useState();
|
||||
function TrialOffer({ onClose }: { onClose: () => void }) {
|
||||
const [error, setError] = useState<string>();
|
||||
const [loading, setLoading] = useState<boolean>();
|
||||
return (
|
||||
<Flex
|
||||
my={4}
|
||||
@@ -469,7 +499,7 @@ function TrialOffer({ onClose }) {
|
||||
sx={{ borderRadius: 50, alignSelf: "center", mr: 2, width: "40%" }}
|
||||
onClick={() => {
|
||||
onClose();
|
||||
showBuyDialog("monthly", "TRIAL2PRO");
|
||||
BuyDialog.show({ plan: "monthly", couponCode: "TRIAL2PRO" });
|
||||
}}
|
||||
>
|
||||
Upgrade now
|
||||
@@ -493,7 +523,9 @@ function TrialOffer({ onClose }) {
|
||||
if (result) onClose();
|
||||
} catch (e) {
|
||||
setError(
|
||||
`Could not activate trial. Please try again. Error: ${e.message}`
|
||||
`Could not activate trial. Please try again. Error: ${
|
||||
(e as Error).message
|
||||
}`
|
||||
);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user