mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-08-30 18:48:27 +02:00
Compare commits
61 Commits
ai
...
3.0.11-and
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c846f8abc8 | ||
|
|
8d8acfb99d | ||
|
|
3a5b5772ad | ||
|
|
8046932e4e | ||
|
|
c45aa84739 | ||
|
|
d98be849e3 | ||
|
|
727ac6d907 | ||
|
|
8302f8ba4c | ||
|
|
4db8b0db01 | ||
|
|
3f1614ab9a | ||
|
|
909d8c35f8 | ||
|
|
a73780f0b0 | ||
|
|
286fdbeec0 | ||
|
|
59099552f8 | ||
|
|
0b6013be58 | ||
|
|
2d93a17f34 | ||
|
|
5ef7e39e17 | ||
|
|
f7de4c9084 | ||
|
|
0672c864f7 | ||
|
|
cb3706c150 | ||
|
|
08c6a99336 | ||
|
|
adf961fa08 | ||
|
|
0eb9ae47e9 | ||
|
|
aa706300a4 | ||
|
|
fd183a0e1e | ||
|
|
b27cd4be0f | ||
|
|
9575561832 | ||
|
|
02f96f8d14 | ||
|
|
3cf46e7ad1 | ||
|
|
93551aa0b7 | ||
|
|
d00c35bdaf | ||
|
|
6e6b793568 | ||
|
|
9e064d88c6 | ||
|
|
1658ad8d18 | ||
|
|
c94da3bdf0 | ||
|
|
1f0fc83a7c | ||
|
|
a6af92c330 | ||
|
|
ef93ecc481 | ||
|
|
039709822c | ||
|
|
25c861ce77 | ||
|
|
670f1570b5 | ||
|
|
c93d82d2d6 | ||
|
|
bced20031b | ||
|
|
f8bd089b51 | ||
|
|
2a4d04a26f | ||
|
|
a0c32191f9 | ||
|
|
662d59f60a | ||
|
|
13befe1947 | ||
|
|
21f8b6d557 | ||
|
|
aef53cace9 | ||
|
|
382b5b0240 | ||
|
|
a45b66d449 | ||
|
|
dd67b1a803 | ||
|
|
00568ae839 | ||
|
|
2b2ea5717c | ||
|
|
5672de8565 | ||
|
|
1c70ad8cec | ||
|
|
0c344a2146 | ||
|
|
38f69b514c | ||
|
|
b502f6a08f | ||
|
|
d68c3269d3 |
@@ -40,12 +40,35 @@ Once you are inside the `./notesnook` directory, run the preparation step:
|
||||
npm install
|
||||
```
|
||||
|
||||
Now you can finally start the desktop app:
|
||||
Now you can finally start the desktop app for development:
|
||||
|
||||
```bash
|
||||
npm run start:desktop
|
||||
```
|
||||
|
||||
To run the app in release mode:
|
||||
|
||||
```bash
|
||||
npm run staging -- --rebuild
|
||||
```
|
||||
|
||||
This will compile and run the app in production mode but it won't generate any packages. To create the final packages, you'll have to run the following commands:
|
||||
|
||||
```bash
|
||||
npm run release -- --rebuild
|
||||
|
||||
# For macOS
|
||||
npx electron-builder --mac dmg --arm64 --x64 -publish never
|
||||
|
||||
# For Linux (AppImage)
|
||||
npx electron-builder --linux AppImage:x64 AppImage:arm64 -publish never
|
||||
|
||||
# For Windows
|
||||
npx electron-builder --win --publish never
|
||||
```
|
||||
|
||||
Feel free to play around with the `electron-builder` command to get the packages you need. `npx electron-builder --help` is a great resource to learn different commands & platforms supported by `electron-builder`.
|
||||
|
||||
## Developer guide
|
||||
|
||||
### The tech stack
|
||||
|
||||
1311
apps/desktop/package-lock.json
generated
1311
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.6",
|
||||
"version": "3.0.10",
|
||||
"appAppleId": "1544027013",
|
||||
"private": true,
|
||||
"main": "./dist/index.js",
|
||||
@@ -28,7 +28,7 @@
|
||||
"@types/yargs": "^17.0.24",
|
||||
"chokidar": "^3.5.3",
|
||||
"electron": "^29.3.1",
|
||||
"electron-builder": "^24.13.3",
|
||||
"electron-builder": "^25.0.0-alpha.11",
|
||||
"esbuild": "^0.20.0",
|
||||
"kysely": "^0.27.3",
|
||||
"node-gyp-build": "^4.8.0",
|
||||
|
||||
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { initTRPC } from "@trpc/server";
|
||||
import { z } from "zod";
|
||||
import { dialog, nativeTheme, Notification, shell } from "electron";
|
||||
import { app, dialog, nativeTheme, Notification, shell } from "electron";
|
||||
import { AutoLaunch } from "../utils/autolaunch";
|
||||
import { config, DesktopIntegration } from "../utils/config";
|
||||
import { bringToFront } from "../utils/bring-to-front";
|
||||
@@ -152,6 +152,10 @@ export const osIntegrationRouter = t.router({
|
||||
await rm(input);
|
||||
}),
|
||||
|
||||
restart: t.procedure.query(() => {
|
||||
app.relaunch();
|
||||
app.exit();
|
||||
}),
|
||||
showNotification: t.procedure
|
||||
.input(NotificationOptions)
|
||||
.query(({ input }) => {
|
||||
@@ -191,7 +195,10 @@ export const osIntegrationRouter = t.router({
|
||||
({ input: { theme, windowControlsIconColor, backgroundColor } }) => {
|
||||
if (windowControlsIconColor) {
|
||||
config.windowControlsIconColor = windowControlsIconColor;
|
||||
if (process.platform === "win32")
|
||||
if (
|
||||
process.platform === "win32" &&
|
||||
!config.desktopSettings.nativeTitlebar
|
||||
)
|
||||
globalThis.window?.setTitleBarOverlay({
|
||||
symbolColor: windowControlsIconColor
|
||||
});
|
||||
|
||||
@@ -84,17 +84,21 @@ async function createWindow() {
|
||||
format: process.platform === "win32" ? "ico" : "png"
|
||||
}),
|
||||
|
||||
titleBarStyle: "hidden",
|
||||
frame: process.platform === "win32" || process.platform === "darwin",
|
||||
titleBarOverlay: {
|
||||
height: 37,
|
||||
color: "#00000000",
|
||||
symbolColor: config.windowControlsIconColor
|
||||
},
|
||||
trafficLightPosition: {
|
||||
x: 16,
|
||||
y: 12
|
||||
},
|
||||
...(config.desktopSettings.nativeTitlebar
|
||||
? {}
|
||||
: {
|
||||
titleBarStyle: "hidden",
|
||||
frame: process.platform === "win32" || process.platform === "darwin",
|
||||
titleBarOverlay: {
|
||||
height: 37,
|
||||
color: "#00000000",
|
||||
symbolColor: config.windowControlsIconColor
|
||||
},
|
||||
trafficLightPosition: {
|
||||
x: 16,
|
||||
y: 12
|
||||
}
|
||||
}),
|
||||
|
||||
webPreferences: {
|
||||
zoomFactor: config.zoomFactor,
|
||||
|
||||
@@ -25,7 +25,8 @@ export const DesktopIntegration = z.object({
|
||||
autoStart: z.boolean().optional(),
|
||||
startMinimized: z.boolean().optional(),
|
||||
minimizeToSystemTray: z.boolean().optional(),
|
||||
closeToSystemTray: z.boolean().optional()
|
||||
closeToSystemTray: z.boolean().optional(),
|
||||
nativeTitlebar: z.boolean().optional()
|
||||
});
|
||||
|
||||
export type DesktopIntegration = z.infer<typeof DesktopIntegration>;
|
||||
@@ -35,7 +36,8 @@ export const config = {
|
||||
autoStart: false,
|
||||
startMinimized: false,
|
||||
minimizeToSystemTray: false,
|
||||
closeToSystemTray: false
|
||||
closeToSystemTray: false,
|
||||
nativeTitlebar: false
|
||||
},
|
||||
privacyMode: false,
|
||||
isSpellCheckerEnabled: true,
|
||||
|
||||
@@ -69,7 +69,6 @@ const App = () => {
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
|
||||
@@ -26,6 +26,7 @@ import { Platform } from "react-native";
|
||||
import { IOS_APPGROUPID } from "../../utils/constants";
|
||||
import { createCacheDir } from "./io";
|
||||
import { getUploadedFileSize } from "./download";
|
||||
import { ToastManager } from "../../services/event-manager";
|
||||
|
||||
export async function uploadFile(filename, data, cancelToken) {
|
||||
if (!data) return false;
|
||||
@@ -50,9 +51,15 @@ export async function uploadFile(filename, data, cancelToken) {
|
||||
method: "PUT",
|
||||
headers
|
||||
});
|
||||
if (!res.ok) throw new Error(`${res.status}: Unable to resolve upload url`);
|
||||
const uploadUrl = await res.text();
|
||||
if (!uploadUrl) throw new Error("Unable to resolve attachment upload url");
|
||||
|
||||
const uploadUrl = res.ok ? await res.text() : await res.json();
|
||||
|
||||
if (typeof uploadUrl !== "string") {
|
||||
throw new Error(
|
||||
uploadUrl.error || "Unable to resolve attachment upload url."
|
||||
);
|
||||
}
|
||||
|
||||
let uploadFilePath = `${cacheDir}/${filename}`;
|
||||
|
||||
const iosAppGroup =
|
||||
@@ -125,8 +132,10 @@ export async function uploadFile(filename, data, cancelToken) {
|
||||
return result;
|
||||
} catch (e) {
|
||||
useAttachmentStore.getState().remove(filename);
|
||||
DatabaseLogger.info(`File upload error: ${filename}, ${e}`);
|
||||
DatabaseLogger.error(e);
|
||||
ToastManager.error(e, "File upload failed");
|
||||
DatabaseLogger.error(e, "File upload failed", {
|
||||
filename
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import React, { useCallback, useEffect, useRef } from "react";
|
||||
import { AppStateStatus, Platform, TextInput, View } from "react-native";
|
||||
//@ts-ignore
|
||||
import { useThemeColors } from "@notesnook/theme";
|
||||
import { enabled } from "react-native-privacy-snapshot";
|
||||
import { DatabaseLogger } from "../../common/database";
|
||||
import {
|
||||
decrypt,
|
||||
@@ -121,7 +120,6 @@ const AppLockedOverlay = () => {
|
||||
);
|
||||
if (unlocked) {
|
||||
lockApp(false);
|
||||
enabled(false);
|
||||
password.current = undefined;
|
||||
}
|
||||
biometricUnlockAwaitingUserInput.current = false;
|
||||
@@ -148,7 +146,6 @@ const AppLockedOverlay = () => {
|
||||
}
|
||||
|
||||
lockApp(false);
|
||||
enabled(false);
|
||||
password.current = undefined;
|
||||
} else {
|
||||
ToastManager.show({
|
||||
@@ -163,10 +160,6 @@ const AppLockedOverlay = () => {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (appState === "active") {
|
||||
enabled(false);
|
||||
}
|
||||
|
||||
const prevState = lastAppState.current;
|
||||
lastAppState.current = appState;
|
||||
|
||||
@@ -192,13 +185,8 @@ const AppLockedOverlay = () => {
|
||||
DatabaseLogger.info("Biometric unlock request");
|
||||
onUnlockAppRequested();
|
||||
}
|
||||
|
||||
enabled(false);
|
||||
} else {
|
||||
SettingsService.appEnteredBackground();
|
||||
if (SettingsService.get().privacyScreen) {
|
||||
enabled(true);
|
||||
}
|
||||
}
|
||||
}, [appState, onUnlockAppRequested, appLocked]);
|
||||
|
||||
|
||||
@@ -355,6 +355,7 @@ export const AttachmentDialog = ({ note }: { note?: Note }) => {
|
||||
|
||||
AttachmentDialog.present = (note?: Note) => {
|
||||
presentSheet({
|
||||
component: () => <AttachmentDialog note={note} />
|
||||
component: () => <AttachmentDialog note={note} />,
|
||||
keyboardHandlerDisabled: true
|
||||
});
|
||||
};
|
||||
|
||||
@@ -17,12 +17,16 @@ 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 { useThemeColors } from "@notesnook/theme";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { TouchableOpacity, View, useWindowDimensions } from "react-native";
|
||||
import { SheetManager } from "react-native-actions-sheet";
|
||||
import { DDS } from "../../services/device-detection";
|
||||
import { eSendEvent } from "../../services/event-manager";
|
||||
import { useThemeColors } from "@notesnook/theme";
|
||||
import Sync from "../../services/sync";
|
||||
import { useSettingStore } from "../../stores/use-setting-store";
|
||||
import { useUserStore } from "../../stores/use-user-store";
|
||||
import { eUserLoggedIn } from "../../utils/events";
|
||||
import { SIZE } from "../../utils/size";
|
||||
import { sleep } from "../../utils/time";
|
||||
import SheetProvider from "../sheet-provider";
|
||||
@@ -34,11 +38,6 @@ import Paragraph from "../ui/typography/paragraph";
|
||||
import { hideAuth } from "./common";
|
||||
import { ForgotPassword } from "./forgot-password";
|
||||
import { useLogin } from "./use-login";
|
||||
import { useSettingStore } from "../../stores/use-setting-store";
|
||||
import { eUserLoggedIn } from "../../utils/events";
|
||||
import { useUserStore } from "../../stores/use-user-store";
|
||||
import Sync from "../../services/sync";
|
||||
import { Notice } from "../ui/notice";
|
||||
|
||||
const LoginSteps = {
|
||||
emailAuth: 1,
|
||||
@@ -184,7 +183,11 @@ export const Login = ({ changeMode }) => {
|
||||
defaultValue={email.current}
|
||||
editable={step === LoginSteps.emailAuth && !loading}
|
||||
onSubmit={() => {
|
||||
passwordInputRef.current?.focus();
|
||||
if (step === LoginSteps.emailAuth) {
|
||||
login();
|
||||
} else {
|
||||
passwordInputRef.current?.focus();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -243,6 +246,7 @@ export const Login = ({ changeMode }) => {
|
||||
width: 250,
|
||||
borderRadius: 100
|
||||
}}
|
||||
height={50}
|
||||
fontSize={SIZE.md}
|
||||
type="accent"
|
||||
title={!loading ? "Continue" : null}
|
||||
|
||||
@@ -37,6 +37,7 @@ import Seperator from "../ui/seperator";
|
||||
import Heading from "../ui/typography/heading";
|
||||
import Paragraph from "../ui/typography/paragraph";
|
||||
import { useCallback } from "react";
|
||||
import { ScrollView } from "react-native-actions-sheet";
|
||||
|
||||
const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
||||
const { colors } = useThemeColors();
|
||||
@@ -143,7 +144,10 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
||||
}, [currentMethod.method, mfaInfo.token, seconds, sending, start]);
|
||||
|
||||
return (
|
||||
<View>
|
||||
<ScrollView
|
||||
keyboardShouldPersistTaps="handled"
|
||||
keyboardDismissMode="interactive"
|
||||
>
|
||||
<View
|
||||
style={{
|
||||
alignItems: "center",
|
||||
@@ -214,6 +218,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
||||
code.current = value;
|
||||
//onNext();
|
||||
}}
|
||||
onSubmitEditing={onNext}
|
||||
caretHidden
|
||||
inputStyle={{
|
||||
fontSize: SIZE.lg,
|
||||
@@ -225,6 +230,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
||||
keyboardType={
|
||||
currentMethod.method === "recoveryCode" ? "default" : "numeric"
|
||||
}
|
||||
enablesReturnKeyAutomatically
|
||||
containerStyle={{
|
||||
height: 60,
|
||||
borderWidth: 0,
|
||||
@@ -297,7 +303,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
||||
</>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -23,10 +23,7 @@ import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
|
||||
import { Dialog } from "../dialog";
|
||||
import { Issue } from "../sheets/github/issue";
|
||||
|
||||
const error = (
|
||||
stack: string,
|
||||
component: string
|
||||
) => `Please let us know what happened. What steps we can take to reproduce the issue here.
|
||||
const error = (stack: string, component: string) => `
|
||||
|
||||
_______________________________
|
||||
Stacktrace: In ${component}::${stack}`;
|
||||
@@ -39,9 +36,9 @@ class ExceptionHandler extends React.Component<{
|
||||
error: Error | null;
|
||||
hasError: boolean;
|
||||
} = {
|
||||
hasError: false,
|
||||
error: null
|
||||
};
|
||||
hasError: false,
|
||||
error: null
|
||||
};
|
||||
static getDerivedStateFromError(error: Error) {
|
||||
return { hasError: true, error: error };
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ export const Card = ({ color }: { color?: string }) => {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
paddingHorizontal: 0
|
||||
paddingHorizontal: 0,
|
||||
width: "100%"
|
||||
}}
|
||||
>
|
||||
<View
|
||||
@@ -91,7 +92,6 @@ export const Card = ({ color }: { color?: string }) => {
|
||||
<View
|
||||
style={{
|
||||
marginLeft: 10,
|
||||
flexShrink: 1,
|
||||
marginRight: 10
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -18,35 +18,33 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Debug } from "@notesnook/core/dist/api/debug";
|
||||
import { getModel, getBrand, getSystemVersion } from "react-native-device-info";
|
||||
import { useThemeColors } from "@notesnook/theme";
|
||||
import Clipboard from "@react-native-clipboard/clipboard";
|
||||
import React, { useRef, useState } from "react";
|
||||
import { Linking, Platform, Text, TextInput, View } from "react-native";
|
||||
import { getVersion } from "react-native-device-info";
|
||||
import { useStoredRef } from "../../../hooks/use-stored-ref";
|
||||
import { ToastManager, eSendEvent } from "../../../services/event-manager";
|
||||
import { ToastManager } from "../../../services/event-manager";
|
||||
import PremiumService from "../../../services/premium";
|
||||
import { useUserStore } from "../../../stores/use-user-store";
|
||||
import { eCloseSheet } from "../../../utils/events";
|
||||
import { openLinkInBrowser } from "../../../utils/functions";
|
||||
import { SIZE } from "../../../utils/size";
|
||||
import { sleep } from "../../../utils/time";
|
||||
import DialogHeader from "../../dialog/dialog-header";
|
||||
import { presentDialog } from "../../dialog/functions";
|
||||
import { Button } from "../../ui/button";
|
||||
import Seperator from "../../ui/seperator";
|
||||
import Heading from "../../ui/typography/heading";
|
||||
import Paragraph from "../../ui/typography/paragraph";
|
||||
|
||||
export const Issue = ({ defaultTitle, defaultBody, issueTitle }) => {
|
||||
const { colors } = useThemeColors();
|
||||
|
||||
const body = useStoredRef("issueBody", defaultBody);
|
||||
const body = useStoredRef("issueBody");
|
||||
const title = useStoredRef("issueTitle", defaultTitle);
|
||||
|
||||
const [done, setDone] = useState(false);
|
||||
const user = useUserStore((state) => state.user);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const bodyRef = useRef();
|
||||
const initialLayout = useRef(false);
|
||||
const issueUrl = useRef();
|
||||
|
||||
const onPress = async () => {
|
||||
if (loading) return;
|
||||
@@ -56,57 +54,24 @@ export const Issue = ({ defaultTitle, defaultBody, issueTitle }) => {
|
||||
|
||||
try {
|
||||
setLoading(true);
|
||||
let issue_url = await Debug.report({
|
||||
issueUrl.current = await Debug.report({
|
||||
title: title.current,
|
||||
body:
|
||||
body.current +
|
||||
`\n${defaultBody || ""}` +
|
||||
`\n_______________
|
||||
**Device information:**
|
||||
App version: ${getVersion()}
|
||||
Platform: ${Platform.OS}
|
||||
Model: ${Platform.constants.Brand || ""}-${Platform.constants.Model || ""}-${
|
||||
Platform.constants.Version || ""
|
||||
}
|
||||
Device: ${getBrand() || ""}-${getModel() || ""}-${getSystemVersion() || ""}
|
||||
Pro: ${PremiumService.get()}
|
||||
Logged in: ${user ? "yes" : "no"}`,
|
||||
userId: user?.id
|
||||
});
|
||||
setLoading(false);
|
||||
eSendEvent(eCloseSheet);
|
||||
body.reset();
|
||||
title.reset();
|
||||
await sleep(300);
|
||||
presentDialog({
|
||||
title: "Issue reported",
|
||||
paragraph: (
|
||||
<Text>
|
||||
You can track your issue at{" "}
|
||||
<Text
|
||||
style={{
|
||||
textDecorationLine: "underline",
|
||||
color: colors.primary.accent
|
||||
}}
|
||||
onPress={() => {
|
||||
Linking.openURL(issue_url);
|
||||
}}
|
||||
>
|
||||
{issue_url}.
|
||||
</Text>{" "}
|
||||
Please note that we will respond to your issue on the given link. We
|
||||
recommend that you save it.
|
||||
</Text>
|
||||
),
|
||||
positiveText: "Copy link",
|
||||
positivePress: () => {
|
||||
Clipboard.setString(issue_url);
|
||||
ToastManager.show({
|
||||
heading: "Issue url copied!",
|
||||
type: "success",
|
||||
context: "global"
|
||||
});
|
||||
},
|
||||
negativeText: "Close"
|
||||
});
|
||||
setDone(true);
|
||||
} catch (e) {
|
||||
setLoading(false);
|
||||
ToastManager.show({
|
||||
@@ -124,125 +89,177 @@ Logged in: ${user ? "yes" : "no"}`,
|
||||
width: "100%"
|
||||
}}
|
||||
>
|
||||
<DialogHeader
|
||||
title={issueTitle || "Report issue"}
|
||||
paragraph={
|
||||
issueTitle
|
||||
? "We are sorry, it seems that the app crashed due to an error. You can submit a bug report below so we can fix this asap."
|
||||
: "Let us know if you have faced any issue/bug while using Notesnook."
|
||||
}
|
||||
/>
|
||||
{done ? (
|
||||
<>
|
||||
<View
|
||||
style={{
|
||||
height: 250,
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
gap: 10
|
||||
}}
|
||||
>
|
||||
<Heading>Issue submitted</Heading>
|
||||
<Paragraph
|
||||
style={{
|
||||
textAlign: "center"
|
||||
}}
|
||||
selectable={true}
|
||||
>
|
||||
You can track your issue at{" "}
|
||||
<Paragraph
|
||||
style={{
|
||||
textDecorationLine: "underline",
|
||||
color: colors.primary.accent
|
||||
}}
|
||||
onPress={() => {
|
||||
Linking.openURL(issueUrl.current);
|
||||
}}
|
||||
>
|
||||
{issueUrl.current}
|
||||
</Paragraph>
|
||||
. Please note that we will respond to your issue on the given
|
||||
link. We recommend that you save it.
|
||||
</Paragraph>
|
||||
|
||||
<Seperator half />
|
||||
|
||||
<TextInput
|
||||
placeholder="Title"
|
||||
onChangeText={(v) => (title.current = v)}
|
||||
defaultValue={title.current}
|
||||
style={{
|
||||
borderWidth: 1,
|
||||
borderColor: colors.primary.border,
|
||||
borderRadius: 5,
|
||||
padding: 12,
|
||||
fontFamily: "OpenSans-Regular",
|
||||
marginBottom: 10,
|
||||
fontSize: SIZE.md,
|
||||
color: colors.primary.heading
|
||||
}}
|
||||
placeholderTextColor={colors.primary.placeholder}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
ref={bodyRef}
|
||||
placeholder={`Tell us more about the issue you are facing.
|
||||
|
||||
For example:
|
||||
- Steps to reproduce the issue
|
||||
- Things you have tried etc.`}
|
||||
multiline
|
||||
numberOfLines={5}
|
||||
textAlignVertical="top"
|
||||
onChangeText={(v) => (body.current = v)}
|
||||
onLayout={() => {
|
||||
if (initialLayout.current) return;
|
||||
initialLayout.current = true;
|
||||
if (body.current) {
|
||||
bodyRef.current?.setNativeProps({
|
||||
text: body.current,
|
||||
selection: {
|
||||
start: 0,
|
||||
end: 0
|
||||
}
|
||||
});
|
||||
}
|
||||
}}
|
||||
style={{
|
||||
borderWidth: 1,
|
||||
borderColor: colors.primary.border,
|
||||
borderRadius: 5,
|
||||
padding: 12,
|
||||
fontFamily: "OpenSans-Regular",
|
||||
maxHeight: 200,
|
||||
fontSize: SIZE.sm,
|
||||
marginBottom: 2.5,
|
||||
color: colors.primary.paragraph
|
||||
}}
|
||||
placeholderTextColor={colors.primary.placeholder}
|
||||
/>
|
||||
<Paragraph
|
||||
size={SIZE.xs}
|
||||
color={colors.secondary.paragraph}
|
||||
>{`App version: ${getVersion()} Platform: ${Platform.OS} Model: ${
|
||||
Platform.constants.Brand
|
||||
}-${Platform.constants.Model}-${Platform.constants.Version}`}</Paragraph>
|
||||
|
||||
<Seperator />
|
||||
<Button
|
||||
onPress={onPress}
|
||||
title={loading ? null : "Submit"}
|
||||
loading={loading}
|
||||
width="100%"
|
||||
type="accent"
|
||||
/>
|
||||
|
||||
<Paragraph
|
||||
color={colors.secondary.paragraph}
|
||||
size={SIZE.xs}
|
||||
style={{
|
||||
marginTop: 10,
|
||||
textAlign: "center"
|
||||
}}
|
||||
>
|
||||
The information above will be publically available at{" "}
|
||||
<Text
|
||||
onPress={() => {
|
||||
Linking.openURL("https://github.com/streetwriters/notesnook");
|
||||
}}
|
||||
style={{
|
||||
textDecorationLine: "underline",
|
||||
color: colors.primary.accent
|
||||
}}
|
||||
>
|
||||
github.com/streetwriters/notesnook.
|
||||
</Text>{" "}
|
||||
If you want to ask something in general or need some assistance, we
|
||||
would suggest that you{" "}
|
||||
<Text
|
||||
style={{
|
||||
textDecorationLine: "underline",
|
||||
color: colors.primary.accent
|
||||
}}
|
||||
onPress={async () => {
|
||||
try {
|
||||
await openLinkInBrowser("https://discord.gg/zQBK97EE22", colors);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
<Button
|
||||
title="Open issue"
|
||||
onPress={() => {
|
||||
Linking.openURL(issueUrl.current);
|
||||
}}
|
||||
type="accent"
|
||||
width="100%"
|
||||
/>
|
||||
</View>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<DialogHeader
|
||||
title={issueTitle || "Report issue"}
|
||||
paragraph={
|
||||
issueTitle
|
||||
? "We are sorry, it seems that the app crashed due to an error. You can submit a bug report below so we can fix this asap."
|
||||
: "Let us know if you have faced any issue/bug while using Notesnook."
|
||||
}
|
||||
}}
|
||||
>
|
||||
join our community on Discord.
|
||||
</Text>
|
||||
</Paragraph>
|
||||
/>
|
||||
|
||||
<Seperator half />
|
||||
|
||||
<TextInput
|
||||
placeholder="Title"
|
||||
onChangeText={(v) => (title.current = v)}
|
||||
defaultValue={title.current}
|
||||
style={{
|
||||
borderWidth: 1,
|
||||
borderColor: colors.primary.border,
|
||||
borderRadius: 5,
|
||||
padding: 12,
|
||||
fontFamily: "OpenSans-Regular",
|
||||
marginBottom: 10,
|
||||
fontSize: SIZE.md,
|
||||
color: colors.primary.heading
|
||||
}}
|
||||
placeholderTextColor={colors.primary.placeholder}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
ref={bodyRef}
|
||||
multiline
|
||||
placeholder={`Tell us more about the issue you are facing.
|
||||
|
||||
For example:
|
||||
- What were you trying to do in the app?
|
||||
- What did you expect to happen?
|
||||
- Steps to reproduce the issue
|
||||
- Things you have tried etc.`}
|
||||
numberOfLines={5}
|
||||
textAlignVertical="top"
|
||||
onChangeText={(v) => (body.current = v)}
|
||||
onLayout={() => {
|
||||
if (initialLayout.current) return;
|
||||
initialLayout.current = true;
|
||||
if (body.current) {
|
||||
bodyRef.current?.setNativeProps({
|
||||
text: body.current,
|
||||
selection: {
|
||||
start: 0,
|
||||
end: 0
|
||||
}
|
||||
});
|
||||
}
|
||||
}}
|
||||
style={{
|
||||
borderWidth: 1,
|
||||
borderColor: colors.primary.border,
|
||||
borderRadius: 5,
|
||||
padding: 12,
|
||||
fontFamily: "OpenSans-Regular",
|
||||
maxHeight: 200,
|
||||
fontSize: SIZE.sm,
|
||||
marginBottom: 2.5,
|
||||
color: colors.primary.paragraph
|
||||
}}
|
||||
placeholderTextColor={colors.primary.placeholder}
|
||||
/>
|
||||
<Paragraph
|
||||
size={SIZE.xs}
|
||||
color={colors.secondary.paragraph}
|
||||
>{`App version: ${getVersion()} Platform: ${
|
||||
Platform.OS
|
||||
} Model: ${getBrand()}-${getModel()}-${getSystemVersion()}`}</Paragraph>
|
||||
|
||||
<Seperator />
|
||||
<Button
|
||||
onPress={onPress}
|
||||
title={loading ? null : "Submit"}
|
||||
loading={loading}
|
||||
width="100%"
|
||||
type="accent"
|
||||
/>
|
||||
|
||||
<Paragraph
|
||||
color={colors.secondary.paragraph}
|
||||
size={SIZE.xs}
|
||||
style={{
|
||||
marginTop: 10,
|
||||
textAlign: "center"
|
||||
}}
|
||||
>
|
||||
The information above will be publically available at{" "}
|
||||
<Text
|
||||
onPress={() => {
|
||||
Linking.openURL("https://github.com/streetwriters/notesnook");
|
||||
}}
|
||||
style={{
|
||||
textDecorationLine: "underline",
|
||||
color: colors.primary.accent
|
||||
}}
|
||||
>
|
||||
github.com/streetwriters/notesnook.
|
||||
</Text>{" "}
|
||||
If you want to ask something in general or need some assistance, we
|
||||
would suggest that you{" "}
|
||||
<Text
|
||||
style={{
|
||||
textDecorationLine: "underline",
|
||||
color: colors.primary.accent
|
||||
}}
|
||||
onPress={async () => {
|
||||
try {
|
||||
await openLinkInBrowser(
|
||||
"https://discord.gg/zQBK97EE22",
|
||||
colors
|
||||
);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}}
|
||||
>
|
||||
join our community on Discord.
|
||||
</Text>
|
||||
</Paragraph>
|
||||
</>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -42,10 +42,7 @@ import { ProgressBarComponent } from "../../ui/svg/lazy";
|
||||
import Paragraph from "../../ui/typography/paragraph";
|
||||
import { Issue } from "../github/issue";
|
||||
|
||||
export const makeError = (
|
||||
stack: string,
|
||||
component: string
|
||||
) => `Please let us know what happened. What steps we can take to reproduce the issue here.
|
||||
export const makeError = (stack: string, component: string) => `
|
||||
|
||||
_______________________________
|
||||
Stacktrace: In ${component}::${stack}`;
|
||||
|
||||
@@ -25,7 +25,8 @@ import {
|
||||
DimensionValue,
|
||||
TextStyle,
|
||||
View,
|
||||
ViewStyle
|
||||
ViewStyle,
|
||||
useWindowDimensions
|
||||
} from "react-native";
|
||||
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
|
||||
import { useUserStore } from "../../../stores/use-user-store";
|
||||
@@ -92,6 +93,9 @@ export const Button = ({
|
||||
});
|
||||
const textColor = buttonType?.text ? buttonType.text : text;
|
||||
|
||||
const { fontScale } = useWindowDimensions();
|
||||
const growFactor = 1 + (fontScale - 1) / 10;
|
||||
|
||||
const Component = bold ? Heading : Paragraph;
|
||||
|
||||
return (
|
||||
@@ -117,8 +121,11 @@ export const Button = ({
|
||||
customOpacity={buttonType?.opacity}
|
||||
customAlpha={buttonType?.alpha}
|
||||
style={{
|
||||
height: height,
|
||||
width: (width as DimensionValue) || undefined,
|
||||
height: typeof height === "number" ? height * growFactor : height,
|
||||
width:
|
||||
typeof width === "number"
|
||||
? width * growFactor
|
||||
: (width as DimensionValue) || undefined,
|
||||
paddingHorizontal: 12,
|
||||
borderRadius: 5,
|
||||
alignSelf: "center",
|
||||
|
||||
@@ -21,11 +21,12 @@ import { VariantsWithStaticColors, useThemeColors } from "@notesnook/theme";
|
||||
import React, { RefObject, useCallback } from "react";
|
||||
import {
|
||||
ColorValue,
|
||||
PressableStateCallbackType,
|
||||
Pressable as RNPressable,
|
||||
PressableProps as RNPressableProps,
|
||||
PressableStateCallbackType,
|
||||
View,
|
||||
ViewStyle
|
||||
ViewStyle,
|
||||
useWindowDimensions
|
||||
} from "react-native";
|
||||
import {
|
||||
RGB_Linear_Shade,
|
||||
@@ -256,6 +257,8 @@ export const Pressable = ({
|
||||
? 1
|
||||
: colorOpacity;
|
||||
const alpha = customAlpha ? customAlpha : isDark ? 0.03 : -0.03;
|
||||
const { fontScale } = useWindowDimensions();
|
||||
const growFactor = 1 + (fontScale - 1) / 8;
|
||||
|
||||
const getStyle = useCallback(
|
||||
({ pressed }: PressableStateCallbackType): ViewStyle | ViewStyle[] => [
|
||||
@@ -276,7 +279,13 @@ export const Pressable = ({
|
||||
: borderColor || "transparent",
|
||||
borderWidth: borderWidth
|
||||
},
|
||||
style
|
||||
style,
|
||||
{
|
||||
height:
|
||||
typeof style.height === "number"
|
||||
? style.height * growFactor
|
||||
: style.height
|
||||
}
|
||||
],
|
||||
[
|
||||
alpha,
|
||||
@@ -288,7 +297,8 @@ export const Pressable = ({
|
||||
borderSelectedColor,
|
||||
borderColor,
|
||||
borderWidth,
|
||||
style
|
||||
style,
|
||||
growFactor
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"html-to-text": "9.0.5",
|
||||
"phone": "^3.1.14",
|
||||
"qclone": "^1.2.0",
|
||||
"react-native-actions-sheet": "0.9.3",
|
||||
"react-native-actions-sheet": "0.9.6",
|
||||
"react-native-check-version": "https://github.com/flexible-agency/react-native-check-version",
|
||||
"react-native-drax": "^0.10.2",
|
||||
"react-native-image-zoom-viewer": "^3.0.1",
|
||||
|
||||
@@ -569,7 +569,7 @@ export const useEditor = (
|
||||
return;
|
||||
}
|
||||
|
||||
lastContentChangeTime.current[item.id] = item.dateEdited;
|
||||
lastContentChangeTime.current[item.id] = 0;
|
||||
currentLoadingNoteId.current = item.id;
|
||||
currentNotes.current[item.id] = item;
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ import { useDragState } from "./editor/state";
|
||||
import { verifyUser, verifyUserWithApplock } from "./functions";
|
||||
import { SettingSection } from "./types";
|
||||
import { getTimeLeft } from "./user-section";
|
||||
import ScreenGuardModule from "react-native-screenguard";
|
||||
|
||||
type User = any;
|
||||
|
||||
@@ -333,12 +334,14 @@ export const settingsGroups: SettingSection[] = [
|
||||
{
|
||||
id: "logout",
|
||||
name: "Log out",
|
||||
description: "Clear all your data and reset the app.",
|
||||
description:
|
||||
"Logging out will clear all data stored on THIS DEVICE.",
|
||||
icon: "logout",
|
||||
modifer: () => {
|
||||
presentDialog({
|
||||
title: "Logout",
|
||||
paragraph: "Clear all your data and reset the app.",
|
||||
paragraph:
|
||||
"Logging out will clear all data stored on THIS DEVICE. Make sure you have synced all your changes before logging out.",
|
||||
positiveText: "Logout",
|
||||
positivePress: async () => {
|
||||
try {
|
||||
@@ -848,9 +851,18 @@ export const settingsGroups: SettingSection[] = [
|
||||
"Hide app contents when you switch to other apps. This will also disable screenshot taking in the app.",
|
||||
modifer: () => {
|
||||
const settings = SettingsService.get();
|
||||
Platform.OS === "android"
|
||||
? NotesnookModule.setSecureMode(!settings.privacyScreen)
|
||||
: enabled(true);
|
||||
if (Platform.OS === "ios") {
|
||||
enabled(!settings.privacyScreen);
|
||||
if (settings.privacyScreen) {
|
||||
ScreenGuardModule.unregister();
|
||||
} else {
|
||||
ScreenGuardModule.register({
|
||||
backgroundColor: "#000000"
|
||||
});
|
||||
}
|
||||
} else {
|
||||
NotesnookModule.setSecureMode(!settings.privacyScreen);
|
||||
}
|
||||
|
||||
SettingsService.set({ privacyScreen: !settings.privacyScreen });
|
||||
},
|
||||
|
||||
@@ -29,6 +29,7 @@ import { NotesnookModule } from "../utils/notesnook-module";
|
||||
import { scale, updateSize } from "../utils/size";
|
||||
import { DatabaseLogger } from "../common/database";
|
||||
import { useUserStore } from "../stores/use-user-store";
|
||||
import ScreenGuardModule from "react-native-screenguard";
|
||||
function reset() {
|
||||
const settings = get();
|
||||
if (settings.reminder !== "off" && settings.reminder !== "useroff") {
|
||||
@@ -117,12 +118,14 @@ function setPrivacyScreen(settings: SettingStore["settings"]) {
|
||||
NotesnookModule.setSecureMode(true);
|
||||
} else {
|
||||
enabled(true);
|
||||
ScreenGuardModule.register({ backgroundColor: "#000000" });
|
||||
}
|
||||
} else {
|
||||
if (Platform.OS === "android") {
|
||||
NotesnookModule.setSecureMode(false);
|
||||
} else {
|
||||
enabled(false);
|
||||
ScreenGuardModule.unregister();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ android {
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
multiDexEnabled true
|
||||
versionCode 3016
|
||||
versionCode 3019
|
||||
versionName getNpmVersion()
|
||||
testBuildType System.getProperty('testBuildType', 'debug')
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
- Fixed realtime sync issues
|
||||
- Fixed color popups not opening from main toolbar
|
||||
- Bug fixes and performance improvements
|
||||
|
||||
Thank you for using Notesnook!
|
||||
@@ -1015,7 +1015,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 2105;
|
||||
CURRENT_PROJECT_VERSION = 2108;
|
||||
DEVELOPMENT_TEAM = 53CWBG3QUC;
|
||||
ENABLE_BITCODE = NO;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
|
||||
@@ -1084,12 +1084,12 @@
|
||||
"${PODS_ROOT}/Headers/Public/#{s.name}/**",
|
||||
);
|
||||
INFOPLIST_FILE = Notesnook/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 3.0.8;
|
||||
MARKETING_VERSION = 3.0.11;
|
||||
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 = 2105;
|
||||
CURRENT_PROJECT_VERSION = 2108;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 53CWBG3QUC;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
|
||||
@@ -1189,12 +1189,12 @@
|
||||
"${PODS_ROOT}/Headers/Public/#{s.name}/**",
|
||||
);
|
||||
INFOPLIST_FILE = Notesnook/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 3.0.8;
|
||||
MARKETING_VERSION = 3.0.11;
|
||||
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 = 2105;
|
||||
CURRENT_PROJECT_VERSION = 2108;
|
||||
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.8;
|
||||
MARKETING_VERSION = 3.0.11;
|
||||
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 = 2105;
|
||||
CURRENT_PROJECT_VERSION = 2108;
|
||||
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.8;
|
||||
MARKETING_VERSION = 3.0.11;
|
||||
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 = 2105;
|
||||
CURRENT_PROJECT_VERSION = 2108;
|
||||
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.8;
|
||||
MARKETING_VERSION = 3.0.11;
|
||||
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 = 2105;
|
||||
CURRENT_PROJECT_VERSION = 2108;
|
||||
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.8;
|
||||
MARKETING_VERSION = 3.0.11;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.share;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
||||
@@ -343,6 +343,9 @@ PODS:
|
||||
- React-Core
|
||||
- react-native-safe-area-context (4.9.0):
|
||||
- React-Core
|
||||
- react-native-screenguard (1.0.0):
|
||||
- React-Core
|
||||
- SDWebImage (~> 5.11.1)
|
||||
- react-native-share-extension (3.0.0):
|
||||
- React
|
||||
- react-native-sodium (1.5.4):
|
||||
@@ -548,6 +551,9 @@ PODS:
|
||||
- RNZipArchive/Core (6.0.9):
|
||||
- React-Core
|
||||
- SSZipArchive (~> 2.2)
|
||||
- SDWebImage (5.11.1):
|
||||
- SDWebImage/Core (= 5.11.1)
|
||||
- SDWebImage/Core (5.11.1)
|
||||
- SexyTooltip (1.2.5):
|
||||
- pop (~> 1.0)
|
||||
- SocketRocket (0.6.0)
|
||||
@@ -606,6 +612,7 @@ DEPENDENCIES:
|
||||
- react-native-pdf (from `../../node_modules/react-native-pdf`)
|
||||
- react-native-quick-sqlite (from `../../node_modules/react-native-quick-sqlite`)
|
||||
- react-native-safe-area-context (from `../../node_modules/react-native-safe-area-context`)
|
||||
- react-native-screenguard (from `../../node_modules/react-native-screenguard`)
|
||||
- "react-native-share-extension (from `../../node_modules/@ammarahmed/react-native-share-extension`)"
|
||||
- "react-native-sodium (from `../../node_modules/@ammarahmed/react-native-sodium`)"
|
||||
- react-native-theme-switch-animation (from `../../node_modules/react-native-theme-switch-animation`)
|
||||
@@ -664,6 +671,7 @@ SPEC REPOS:
|
||||
- MMKV
|
||||
- MMKVCore
|
||||
- pop
|
||||
- SDWebImage
|
||||
- SocketRocket
|
||||
- SSZipArchive
|
||||
- SwiftyRSA
|
||||
@@ -754,6 +762,8 @@ EXTERNAL SOURCES:
|
||||
:path: "../../node_modules/react-native-quick-sqlite"
|
||||
react-native-safe-area-context:
|
||||
:path: "../../node_modules/react-native-safe-area-context"
|
||||
react-native-screenguard:
|
||||
:path: "../../node_modules/react-native-screenguard"
|
||||
react-native-share-extension:
|
||||
:path: "../../node_modules/@ammarahmed/react-native-share-extension"
|
||||
react-native-sodium:
|
||||
@@ -905,6 +915,7 @@ SPEC CHECKSUMS:
|
||||
react-native-pdf: 33c622cbdf776a649929e8b9d1ce2d313347c4fa
|
||||
react-native-quick-sqlite: e0e23b749382a85e4b57146f753de737a6c3a9e1
|
||||
react-native-safe-area-context: b97eb6f9e3b7f437806c2ce5983f479f8eb5de4b
|
||||
react-native-screenguard: 8b36a3df84c76cd2b82c477f71c26fa1c8cc14a0
|
||||
react-native-share-extension: faed334b1ddf165f1e576fcabd3dc1c9e748bfa9
|
||||
react-native-sodium: 955bb0dc3ea05f8ea06d5e96cb89d1be7b5d7681
|
||||
react-native-theme-switch-animation: 220f883f7be290e79f2ab022093ed1a7a5929e6d
|
||||
@@ -949,6 +960,7 @@ SPEC CHECKSUMS:
|
||||
RNSVG: d7d7bc8229af3842c9cfc3a723c815a52cdd1105
|
||||
RNTooltips: 5424d4bf0b3d441104127943b1115cc7f0616b1f
|
||||
RNZipArchive: 68a0c6db4b1c103f846f1559622050df254a3ade
|
||||
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
|
||||
SexyTooltip: 5c9b4dec52bfb317938cb0488efd9da3717bb6fd
|
||||
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
|
||||
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef
|
||||
@@ -959,4 +971,4 @@ SPEC CHECKSUMS:
|
||||
|
||||
PODFILE CHECKSUM: 2b8b28a341b202bf3ca5f231b75bb05893486ed8
|
||||
|
||||
COCOAPODS: 1.15.2
|
||||
COCOAPODS: 1.14.2
|
||||
|
||||
@@ -66,7 +66,8 @@
|
||||
"react-native-theme-switch-animation": "^0.6.0",
|
||||
"@ammarahmed/react-native-background-fetch": "^4.2.2",
|
||||
"react-native-image-crop-picker": "^0.40.2",
|
||||
"react-native-url-polyfill": "^2.0.0"
|
||||
"react-native-url-polyfill": "^2.0.0",
|
||||
"react-native-screenguard": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.0",
|
||||
|
||||
@@ -17,6 +17,12 @@ config.dependencies['react-native-vector-icons'] = {
|
||||
},
|
||||
}
|
||||
|
||||
config.dependencies['react-native-screenguard'] = {
|
||||
platforms: {
|
||||
android: null,
|
||||
},
|
||||
}
|
||||
|
||||
if (isGithubRelease) {
|
||||
config.dependencies["react-native-iap"] = {
|
||||
platforms: {
|
||||
|
||||
44
apps/mobile/package-lock.json
generated
44
apps/mobile/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@notesnook/mobile",
|
||||
"version": "3.0.4",
|
||||
"version": "3.0.9",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@notesnook/mobile",
|
||||
"version": "3.0.4",
|
||||
"version": "3.0.9",
|
||||
"hasInstallScript": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"workspaces": [
|
||||
@@ -34,15 +34,15 @@
|
||||
},
|
||||
"../../packages/common": {
|
||||
"name": "@notesnook/common",
|
||||
"version": "1.0.0",
|
||||
"version": "2.0.1",
|
||||
"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"
|
||||
@@ -114,7 +114,7 @@
|
||||
},
|
||||
"../../packages/core": {
|
||||
"name": "@notesnook/core",
|
||||
"version": "7.4.1",
|
||||
"version": "8.0.2",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
@@ -3121,7 +3121,7 @@
|
||||
},
|
||||
"../../packages/crypto": {
|
||||
"name": "@notesnook/crypto",
|
||||
"version": "1.1.1",
|
||||
"version": "2.0.1",
|
||||
"dev": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
@@ -3135,7 +3135,7 @@
|
||||
},
|
||||
"../../packages/editor": {
|
||||
"name": "@notesnook/editor",
|
||||
"version": "1.6.1",
|
||||
"version": "2.0.1",
|
||||
"hasInstallScript": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
@@ -23795,13 +23795,13 @@
|
||||
},
|
||||
"../../packages/logger": {
|
||||
"name": "@notesnook/logger",
|
||||
"version": "1.0.3",
|
||||
"version": "2.0.1",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"devDependencies": {}
|
||||
},
|
||||
"../../packages/sodium": {
|
||||
"name": "@notesnook/sodium",
|
||||
"version": "1.1.0",
|
||||
"version": "2.0.1",
|
||||
"dev": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"devDependencies": {
|
||||
@@ -25173,7 +25173,7 @@
|
||||
},
|
||||
"../../packages/theme": {
|
||||
"name": "@notesnook/theme",
|
||||
"version": "1.2.0",
|
||||
"version": "2.0.1",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"devDependencies": {
|
||||
"@emotion/react": "11.11.1",
|
||||
@@ -26240,7 +26240,7 @@
|
||||
},
|
||||
"../../packages/ui": {
|
||||
"name": "@notesnook/ui",
|
||||
"version": "1.0.0",
|
||||
"version": "2.0.2",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@notesnook/theme": "file:../theme"
|
||||
@@ -28412,7 +28412,7 @@
|
||||
"pathe": "1.1.2",
|
||||
"phone": "^3.1.14",
|
||||
"qclone": "^1.2.0",
|
||||
"react-native-actions-sheet": "0.9.3",
|
||||
"react-native-actions-sheet": "0.9.6",
|
||||
"react-native-check-version": "https://github.com/flexible-agency/react-native-check-version",
|
||||
"react-native-drax": "^0.10.2",
|
||||
"react-native-image-zoom-viewer": "^3.0.1",
|
||||
@@ -28487,6 +28487,7 @@
|
||||
"react-native-reanimated": "3.3.0",
|
||||
"react-native-safe-area-context": "^4.3.1",
|
||||
"react-native-scoped-storage": "^1.9.5",
|
||||
"react-native-screenguard": "^1.0.0",
|
||||
"react-native-screens": "^3.13.1",
|
||||
"react-native-securerandom": "^1.0.1",
|
||||
"react-native-share": "^7.2.0",
|
||||
@@ -44778,8 +44779,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/react-native-actions-sheet": {
|
||||
"version": "0.9.3",
|
||||
"license": "MIT",
|
||||
"version": "0.9.6",
|
||||
"resolved": "https://registry.npmjs.org/react-native-actions-sheet/-/react-native-actions-sheet-0.9.6.tgz",
|
||||
"integrity": "sha512-BMEFmJD29izbOxkH81HJWNCgrjdW5iz4gB+Eyov9xwUPz/Fbi53R6AFvF9N3ttYT8nEvzxj56nqP7uJZ6KuKuA==",
|
||||
"dependencies": {
|
||||
"react-native-safe-area-context": "^4.8.2"
|
||||
},
|
||||
@@ -45253,6 +45255,18 @@
|
||||
"react-native": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/react-native-screenguard": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/react-native-screenguard/-/react-native-screenguard-1.0.0.tgz",
|
||||
"integrity": "sha512-fqtoJI8TxszKqrntnHW48EMb4gNVA9VCAg5UG1FcIXEyv2W70kWoMxRRFoWuCRYlBWSAWqiXO+R6Xfk/0um0cw==",
|
||||
"engines": {
|
||||
"node": ">= 16.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "*",
|
||||
"react-native": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/react-native-screens": {
|
||||
"version": "3.21.1",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@notesnook/mobile",
|
||||
"version": "3.0.8",
|
||||
"version": "3.0.11",
|
||||
"private": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"workspaces": [
|
||||
|
||||
54
apps/mobile/patches/react-native-screenguard+1.0.0.patch
Normal file
54
apps/mobile/patches/react-native-screenguard+1.0.0.patch
Normal file
@@ -0,0 +1,54 @@
|
||||
diff --git a/node_modules/react-native-screenguard/ios/ScreenGuard.mm b/node_modules/react-native-screenguard/ios/ScreenGuard.mm
|
||||
index 9fa7d33..d2e6d68 100644
|
||||
--- a/node_modules/react-native-screenguard/ios/ScreenGuard.mm
|
||||
+++ b/node_modules/react-native-screenguard/ios/ScreenGuard.mm
|
||||
@@ -11,7 +11,7 @@
|
||||
@implementation ScreenGuard
|
||||
RCT_EXPORT_MODULE(ScreenGuard)
|
||||
|
||||
-bool hasListeners;
|
||||
+bool hasListeners_;
|
||||
|
||||
UITextField *textField;
|
||||
UIImageView *imageView;
|
||||
@@ -22,11 +22,11 @@ @implementation ScreenGuard
|
||||
}
|
||||
|
||||
- (void)startObserving {
|
||||
- hasListeners = YES;
|
||||
+ hasListeners_ = YES;
|
||||
}
|
||||
|
||||
- (void)stopObserving {
|
||||
- hasListeners = NO;
|
||||
+ hasListeners_ = NO;
|
||||
}
|
||||
|
||||
- (void)secureViewWithBackgroundColor: (NSString *)color {
|
||||
@@ -335,7 +335,7 @@ - (UIImage *)convertViewToImage:(UIView *)view {
|
||||
queue:mainQueue
|
||||
usingBlock:^(NSNotification *notification) {
|
||||
|
||||
- if (hasListeners && getScreenShotPath) {
|
||||
+ if (hasListeners_ && getScreenShotPath) {
|
||||
UIViewController *presentedViewController = RCTPresentedViewController();
|
||||
|
||||
UIImage *image = [self convertViewToImage:presentedViewController.view.superview];
|
||||
@@ -359,7 +359,7 @@ - (UIImage *)convertViewToImage:(UIView *)view {
|
||||
result = @{@"path": filePath, @"name": fileName, @"type": @"PNG"};
|
||||
}
|
||||
[self emit:SCREENSHOT_EVT body: result];
|
||||
- } else if (hasListeners) {
|
||||
+ } else if (hasListeners_) {
|
||||
[self emit:SCREENSHOT_EVT body: nil];
|
||||
}
|
||||
}];
|
||||
@@ -376,7 +376,7 @@ - (UIImage *)convertViewToImage:(UIView *)view {
|
||||
queue:mainQueue
|
||||
usingBlock:^(NSNotification *notification) {
|
||||
|
||||
- if (hasListeners) {
|
||||
+ if (hasListeners_) {
|
||||
[self emit:SCREEN_RECORDING_EVT body:nil];
|
||||
}
|
||||
}];
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=0">
|
||||
<link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=1690887574068">
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=0">
|
||||
<link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=1690887574068">
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=0">
|
||||
<link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=1690887574068">
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ test("logged in user should not be able to open unauthorized routes", async ({
|
||||
await page.goto(route);
|
||||
|
||||
await page.waitForURL(/\/notes/gm);
|
||||
await page.waitForTimeout(1000);
|
||||
expect(await app.navigation.findItem("Notes")).toBeDefined();
|
||||
}
|
||||
});
|
||||
|
||||
4990
apps/web/package-lock.json
generated
4990
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.6",
|
||||
"version": "3.0.10",
|
||||
"private": true,
|
||||
"main": "./src/app.js",
|
||||
"homepage": "https://notesnook.com/",
|
||||
@@ -89,7 +89,8 @@
|
||||
"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",
|
||||
@@ -104,8 +105,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",
|
||||
@@ -116,14 +117,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",
|
||||
|
||||
@@ -58,9 +58,8 @@ export default function MobileAppEffects({
|
||||
overlay.style.pointerEvents = "none";
|
||||
}
|
||||
},
|
||||
onChange: (e, { slide, lastSlide }) => {
|
||||
if (!lastSlide || !isMobile) return;
|
||||
toggleSideMenu(slide?.index === 1 ? true : false);
|
||||
onChange: (e, { slide }) => {
|
||||
toggleSideMenu(slide?.index === 0 ? true : false);
|
||||
setIsEditorOpen(slide?.index === 3 ? true : false);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -22,10 +22,8 @@ import { Box, Flex } from "@theme-ui/components";
|
||||
import { ScopedThemeProvider } from "./components/theme-provider";
|
||||
import useMobile from "./hooks/use-mobile";
|
||||
import useTablet from "./hooks/use-tablet";
|
||||
import useDatabase from "./hooks/use-database";
|
||||
import { useStore } from "./stores/app-store";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
import { ViewLoader } from "./components/loaders/view-loader";
|
||||
import NavigationMenu from "./components/navigation-menu";
|
||||
import StatusBar from "./components/status-bar";
|
||||
import { EditorLoader } from "./components/loaders/editor-loader";
|
||||
@@ -38,12 +36,13 @@ import {
|
||||
PanelResizeHandle,
|
||||
ImperativePanelHandle
|
||||
} from "react-resizable-panels";
|
||||
import GlobalMenuWrapper from "./components/global-menu-wrapper";
|
||||
|
||||
new WebExtensionRelay();
|
||||
|
||||
const GlobalMenuWrapper = React.lazy(
|
||||
() => import("./components/global-menu-wrapper")
|
||||
);
|
||||
// const GlobalMenuWrapper = React.lazy(
|
||||
// () => import("./components/global-menu-wrapper")
|
||||
// );
|
||||
const AppEffects = React.lazy(() => import("./app-effects"));
|
||||
const MobileAppEffects = React.lazy(() => import("./app-effects.mobile"));
|
||||
const HashRouter = React.lazy(() => import("./components/hash-router"));
|
||||
@@ -51,26 +50,24 @@ const HashRouter = React.lazy(() => import("./components/hash-router"));
|
||||
function App() {
|
||||
const isMobile = useMobile();
|
||||
const [show, setShow] = useState(true);
|
||||
const [isAppLoaded] = useDatabase();
|
||||
const isFocusMode = useStore((store) => store.isFocusMode);
|
||||
|
||||
return (
|
||||
<>
|
||||
{isAppLoaded && (
|
||||
<Suspense fallback={<div style={{ display: "none" }} />}>
|
||||
<div id="menu-wrapper">
|
||||
<GlobalMenuWrapper />
|
||||
</div>
|
||||
<AppEffects setShow={setShow} />
|
||||
{isMobile && (
|
||||
<MobileAppEffects
|
||||
sliderId="slider"
|
||||
overlayId="overlay"
|
||||
setShow={setShow}
|
||||
/>
|
||||
)}
|
||||
</Suspense>
|
||||
)}
|
||||
<Suspense fallback={<div style={{ display: "none" }} />}>
|
||||
<div id="menu-wrapper">
|
||||
<GlobalMenuWrapper />
|
||||
</div>
|
||||
<AppEffects setShow={setShow} />
|
||||
{isMobile && (
|
||||
<MobileAppEffects
|
||||
sliderId="slider"
|
||||
overlayId="overlay"
|
||||
setShow={setShow}
|
||||
/>
|
||||
)}
|
||||
</Suspense>
|
||||
|
||||
<Flex
|
||||
id="app"
|
||||
bg="background"
|
||||
@@ -78,13 +75,9 @@ function App() {
|
||||
sx={{ overflow: "hidden", flexDirection: "column", height: "100%" }}
|
||||
>
|
||||
{isMobile ? (
|
||||
<MobileAppContents isAppLoaded={isAppLoaded} />
|
||||
<MobileAppContents />
|
||||
) : (
|
||||
<DesktopAppContents
|
||||
isAppLoaded={isAppLoaded}
|
||||
setShow={setShow}
|
||||
show={show}
|
||||
/>
|
||||
<DesktopAppContents setShow={setShow} show={show} />
|
||||
)}
|
||||
<Toaster containerClassName="toasts-container" />
|
||||
</Flex>
|
||||
@@ -121,15 +114,10 @@ function SuspenseLoader<TComponent extends React.JSXElementConstructor<any>>({
|
||||
}
|
||||
|
||||
type DesktopAppContentsProps = {
|
||||
isAppLoaded: boolean;
|
||||
show: boolean;
|
||||
setShow: (show: boolean) => void;
|
||||
};
|
||||
function DesktopAppContents({
|
||||
isAppLoaded,
|
||||
show,
|
||||
setShow
|
||||
}: DesktopAppContentsProps) {
|
||||
function DesktopAppContents({ show, setShow }: DesktopAppContentsProps) {
|
||||
const isFocusMode = useStore((store) => store.isFocusMode);
|
||||
const isTablet = useTablet();
|
||||
const [isNarrow, setIsNarrow] = useState(isTablet || false);
|
||||
@@ -137,19 +125,23 @@ function DesktopAppContents({
|
||||
const middlePane = useRef<ImperativePanelHandle>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (show) middlePane.current?.expand();
|
||||
else middlePane.current?.collapse();
|
||||
}, [show]);
|
||||
setIsNarrow(isTablet);
|
||||
}, [isTablet]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isFocusMode) {
|
||||
const middlePaneSize = middlePane.current?.getSize() || 20;
|
||||
navPane.current?.collapse();
|
||||
// the middle pane has to be resized because collapsing the nav
|
||||
// pane increases the middle pane's size every time.
|
||||
middlePane.current?.resize(middlePaneSize);
|
||||
} else navPane.current?.expand();
|
||||
}, [isFocusMode]);
|
||||
// useEffect(() => {
|
||||
// if (show) middlePane.current?.expand();
|
||||
// else middlePane.current?.collapse();
|
||||
// }, [show]);
|
||||
|
||||
// useEffect(() => {
|
||||
// if (isFocusMode) {
|
||||
// const middlePaneSize = middlePane.current?.getSize() || 20;
|
||||
// navPane.current?.collapse();
|
||||
// // the middle pane has to be resized because collapsing the nav
|
||||
// // pane increases the middle pane's size every time.
|
||||
// middlePane.current?.resize(middlePaneSize);
|
||||
// } else navPane.current?.expand();
|
||||
// }, [isFocusMode]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -160,45 +152,67 @@ function DesktopAppContents({
|
||||
}}
|
||||
>
|
||||
<PanelGroup autoSaveId="global-panel-group" direction="horizontal">
|
||||
<Panel
|
||||
ref={navPane}
|
||||
className="nav-pane"
|
||||
defaultSize={10}
|
||||
minSize={3.5}
|
||||
onResize={(size) => setIsNarrow(size <= 5)}
|
||||
collapsible
|
||||
collapsedSize={3.5}
|
||||
>
|
||||
<NavigationMenu
|
||||
toggleNavigationContainer={(state) => {
|
||||
setShow(state || !show);
|
||||
}}
|
||||
isTablet={isNarrow}
|
||||
/>
|
||||
</Panel>
|
||||
<PanelResizeHandle className="panel-resize-handle" />
|
||||
<Panel
|
||||
ref={middlePane}
|
||||
className="middle-pane"
|
||||
collapsible
|
||||
defaultSize={20}
|
||||
>
|
||||
<ScopedThemeProvider
|
||||
className="listMenu"
|
||||
scope="list"
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
flex: 1,
|
||||
bg: "background",
|
||||
borderRight: "1px solid var(--separator)"
|
||||
}}
|
||||
>
|
||||
{isAppLoaded && <CachedRouter />}
|
||||
</ScopedThemeProvider>
|
||||
</Panel>
|
||||
<PanelResizeHandle className="panel-resize-handle" />
|
||||
<Panel className="editor-pane" defaultSize={70}>
|
||||
{!isFocusMode && isTablet ? (
|
||||
<Flex sx={{ width: 50 }}>
|
||||
<NavigationMenu
|
||||
toggleNavigationContainer={(state) => {
|
||||
setShow(state || !show);
|
||||
}}
|
||||
isTablet={isNarrow}
|
||||
/>
|
||||
</Flex>
|
||||
) : (
|
||||
!isFocusMode && (
|
||||
<>
|
||||
<Panel
|
||||
ref={navPane}
|
||||
order={1}
|
||||
className="nav-pane"
|
||||
defaultSize={10}
|
||||
minSize={3.5}
|
||||
// maxSize={isNarrow ? 5 : undefined}
|
||||
onResize={(size) => setIsNarrow(size <= 5)}
|
||||
collapsible
|
||||
collapsedSize={3.5}
|
||||
>
|
||||
<NavigationMenu
|
||||
toggleNavigationContainer={(state) => {
|
||||
setShow(state || !show);
|
||||
}}
|
||||
isTablet={isNarrow}
|
||||
/>
|
||||
</Panel>
|
||||
<PanelResizeHandle className="panel-resize-handle" />
|
||||
</>
|
||||
)
|
||||
)}
|
||||
{!isFocusMode && show && (
|
||||
<>
|
||||
<Panel
|
||||
ref={middlePane}
|
||||
className="middle-pane"
|
||||
order={2}
|
||||
collapsible
|
||||
defaultSize={20}
|
||||
>
|
||||
<ScopedThemeProvider
|
||||
className="listMenu"
|
||||
scope="list"
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
flex: 1,
|
||||
bg: "background",
|
||||
borderRight: "1px solid var(--separator)"
|
||||
}}
|
||||
>
|
||||
<CachedRouter />
|
||||
</ScopedThemeProvider>
|
||||
</Panel>
|
||||
<PanelResizeHandle className="panel-resize-handle" />
|
||||
</>
|
||||
)}
|
||||
<Panel className="editor-pane" order={3} defaultSize={70}>
|
||||
<Flex
|
||||
sx={{
|
||||
display: "flex",
|
||||
@@ -208,7 +222,7 @@ function DesktopAppContents({
|
||||
bg: "background"
|
||||
}}
|
||||
>
|
||||
{isAppLoaded && <HashRouter />}
|
||||
{<HashRouter />}
|
||||
</Flex>
|
||||
</Panel>
|
||||
</PanelGroup>
|
||||
@@ -218,7 +232,7 @@ function DesktopAppContents({
|
||||
);
|
||||
}
|
||||
|
||||
function MobileAppContents({ isAppLoaded }: { isAppLoaded: boolean }) {
|
||||
function MobileAppContents() {
|
||||
return (
|
||||
<FlexScrollContainer
|
||||
id="slider"
|
||||
@@ -257,11 +271,7 @@ function MobileAppContents({ isAppLoaded }: { isAppLoaded: boolean }) {
|
||||
width: "100vw"
|
||||
}}
|
||||
>
|
||||
<SuspenseLoader
|
||||
condition={isAppLoaded}
|
||||
component={CachedRouter}
|
||||
fallback={<ViewLoader />}
|
||||
/>
|
||||
<CachedRouter />
|
||||
<Box
|
||||
id="overlay"
|
||||
sx={{
|
||||
@@ -290,7 +300,7 @@ function MobileAppContents({ isAppLoaded }: { isAppLoaded: boolean }) {
|
||||
<SuspenseLoader
|
||||
fallback={<EditorLoader />}
|
||||
component={HashRouter}
|
||||
condition={isAppLoaded}
|
||||
condition={true}
|
||||
/>
|
||||
</Flex>
|
||||
</FlexScrollContainer>
|
||||
|
||||
@@ -18,11 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import "./polyfills";
|
||||
import "@notesnook/core/dist/types";
|
||||
import { getCurrentHash, getCurrentPath, makeURL } from "./navigation";
|
||||
import Config from "./utils/config";
|
||||
|
||||
import { initializeLogger, logger } from "./utils/logger";
|
||||
// import { initializeLogger, logger } from "./utils/logger";
|
||||
import type { AuthProps } from "./views/auth";
|
||||
import { initializeFeatureChecks } from "./utils/feature-check";
|
||||
|
||||
@@ -102,7 +101,7 @@ const sessionExpiryExceptions: Routes[] = [
|
||||
|
||||
function getRoute(): RouteWithPath<AuthProps> | RouteWithPath {
|
||||
const path = getCurrentPath() as Routes;
|
||||
logger.info(`Getting route for path: ${path}`);
|
||||
// logger.info(`Getting route for path: ${path}`);
|
||||
|
||||
const signup = redirectToRegistration(path);
|
||||
const sessionExpired = isSessionExpired(path);
|
||||
@@ -129,7 +128,7 @@ function redirectToRegistration(path: Routes): RouteWithPath<AuthProps> | null {
|
||||
function isSessionExpired(path: Routes): RouteWithPath<AuthProps> | null {
|
||||
const isSessionExpired = Config.get("sessionExpired", false);
|
||||
if (isSessionExpired && !sessionExpiryExceptions.includes(path)) {
|
||||
logger.info(`User session has expired. Routing to /sessionexpired`);
|
||||
// logger.info(`User session has expired. Routing to /sessionexpired`);
|
||||
|
||||
window.history.replaceState(
|
||||
{},
|
||||
@@ -143,7 +142,10 @@ function isSessionExpired(path: Routes): RouteWithPath<AuthProps> | null {
|
||||
|
||||
export async function init() {
|
||||
await initializeFeatureChecks();
|
||||
await initializeLogger();
|
||||
|
||||
await import("./utils/logger").then(({ initializeLogger }) =>
|
||||
initializeLogger()
|
||||
);
|
||||
|
||||
const { path, route } = getRoute();
|
||||
return { ...route, path };
|
||||
|
||||
@@ -25,7 +25,7 @@ import { database } from "@notesnook/common";
|
||||
import { createDialect } from "./sqlite";
|
||||
import { isFeatureSupported } from "../utils/feature-check";
|
||||
import { generatePassword } from "../utils/password-generator";
|
||||
import { deriveKey } from "../interfaces/key-store";
|
||||
import { deriveKey, useKeyStore } from "../interfaces/key-store";
|
||||
import { logManager } from "@notesnook/core/dist/logger";
|
||||
|
||||
const db = database;
|
||||
@@ -34,7 +34,6 @@ async function initializeDatabase(persistence: DatabasePersistence) {
|
||||
|
||||
const { FileStorage } = await import("../interfaces/fs");
|
||||
const { Compressor } = await import("../utils/compressor");
|
||||
const { useKeyStore } = await import("../interfaces/key-store");
|
||||
|
||||
let databaseKey = await useKeyStore.getState().getValue("databaseKey");
|
||||
if (!databaseKey) {
|
||||
@@ -57,21 +56,29 @@ async function initializeDatabase(persistence: DatabasePersistence) {
|
||||
);
|
||||
await storage.migrate();
|
||||
|
||||
const multiTab = !!globalThis.SharedWorker && isFeatureSupported("opfs");
|
||||
database.setup({
|
||||
sqliteOptions: {
|
||||
dialect: (name, init) => createDialect(name, true, init),
|
||||
dialect: (name, 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
|
||||
skipInitialization: !IS_DESKTOP_APP && multiTab
|
||||
},
|
||||
storage: storage,
|
||||
eventsource: EventSource,
|
||||
@@ -98,7 +105,9 @@ async function initializeDatabase(persistence: DatabasePersistence) {
|
||||
// });
|
||||
// }
|
||||
|
||||
console.log("loading db");
|
||||
await db.init();
|
||||
console.log("db loaded");
|
||||
|
||||
window.addEventListener("beforeunload", async () => {
|
||||
if (IS_DESKTOP_APP) {
|
||||
|
||||
@@ -213,7 +213,7 @@ export function showLogoutConfirmation() {
|
||||
return confirm({
|
||||
title: `Logout?`,
|
||||
message:
|
||||
"Logging out will delete all local data and reset the app. Make sure you have synced your data before logging out.",
|
||||
"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"
|
||||
});
|
||||
|
||||
@@ -100,17 +100,26 @@ export async function exportNotes(
|
||||
};
|
||||
}
|
||||
});
|
||||
confirm({
|
||||
title: `Exported ${result.count} notes`,
|
||||
message:
|
||||
result.errors.length > 0
|
||||
? `Export completed with ${result.errors.length} errors:
|
||||
if (result instanceof Error) {
|
||||
confirm({
|
||||
title: `Export failed`,
|
||||
message: result.stack || result.message,
|
||||
positiveButtonText: "Okay"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
confirm({
|
||||
title: `Exported ${result.count} notes`,
|
||||
message:
|
||||
result.errors.length > 0
|
||||
? `Export completed with ${result.errors.length} errors:
|
||||
|
||||
${result.errors.map((e, i) => `${i + 1}. ${e.message}`).join("\n")}`
|
||||
: "Export completed with 0 errors.",
|
||||
positiveButtonText: "Okay"
|
||||
});
|
||||
return true;
|
||||
: "Export completed with 0 errors.",
|
||||
positiveButtonText: "Okay"
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const FORMAT_TO_EXT = {
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -23,8 +23,10 @@ import {
|
||||
SqliteIntrospector,
|
||||
Dialect
|
||||
} from "kysely";
|
||||
import { WaSqliteWorkerDriver } from "./wa-sqlite-kysely-driver";
|
||||
import { isFeatureSupported } from "../../utils/feature-check";
|
||||
import {
|
||||
WaSqliteWorkerMultipleTabDriver,
|
||||
WaSqliteWorkerSingleTabDriver
|
||||
} from "./wa-sqlite-kysely-driver";
|
||||
|
||||
declare module "kysely" {
|
||||
interface Driver {
|
||||
@@ -32,19 +34,29 @@ 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: () =>
|
||||
new WaSqliteWorkerDriver({
|
||||
async: !isFeatureSupported("opfs"),
|
||||
dbName: name,
|
||||
encrypted,
|
||||
init
|
||||
}),
|
||||
multiTab
|
||||
? new WaSqliteWorkerMultipleTabDriver({
|
||||
async,
|
||||
dbName: name,
|
||||
encrypted,
|
||||
init
|
||||
})
|
||||
: new WaSqliteWorkerSingleTabDriver({
|
||||
async,
|
||||
dbName: name,
|
||||
encrypted
|
||||
}),
|
||||
createAdapter: () => new SqliteAdapter(),
|
||||
createIntrospector: (db) => new SqliteIntrospector(db),
|
||||
createQueryCompiler: () => new SqliteQueryCompiler()
|
||||
|
||||
@@ -182,7 +182,9 @@ export class SharedService<T extends object> extends EventTarget {
|
||||
}
|
||||
|
||||
#sendPortToClient(message: any, port: MessagePort) {
|
||||
sharedWorker?.port.postMessage(message, [port]);
|
||||
if (!sharedWorker)
|
||||
throw new Error("Shared worker is not supported in this environment.");
|
||||
sharedWorker.port.postMessage(message, [port]);
|
||||
}
|
||||
|
||||
async #getClientId() {
|
||||
|
||||
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import type { SQLiteAPI, SQLiteCompatibleType } from "./sqlite-types";
|
||||
import { Factory, SQLITE_ROW, SQLiteError } from "./sqlite-api";
|
||||
import { transfer } from "comlink";
|
||||
import { expose, transfer } from "comlink";
|
||||
import type { RunMode } from "./type";
|
||||
import { QueryResult } from "kysely";
|
||||
import { DatabaseSource } from "./sqlite-export";
|
||||
@@ -32,6 +32,12 @@ type PreparedStatement = {
|
||||
columns: string[];
|
||||
};
|
||||
|
||||
type SQLiteOptions = {
|
||||
async: boolean;
|
||||
url?: string;
|
||||
encrypted: boolean;
|
||||
};
|
||||
|
||||
class _SQLiteWorker {
|
||||
sqlite!: SQLiteAPI;
|
||||
db: number | undefined = undefined;
|
||||
@@ -39,21 +45,22 @@ class _SQLiteWorker {
|
||||
initialized = false;
|
||||
preparedStatements: Map<string, PreparedStatement> = new Map();
|
||||
retryCounter: Record<string, number> = {};
|
||||
constructor(
|
||||
private readonly dbName: string,
|
||||
private readonly encrypted: boolean
|
||||
) {
|
||||
console.log("new sqlite worker", dbName, encrypted);
|
||||
}
|
||||
encrypted = false;
|
||||
name = "";
|
||||
async = false;
|
||||
|
||||
async open(async: boolean, url?: string) {
|
||||
async open(name: string, options: SQLiteOptions) {
|
||||
if (this.db) {
|
||||
console.error("Database is already initialized", this.db);
|
||||
return;
|
||||
}
|
||||
|
||||
const option = url ? { locateFile: () => url } : {};
|
||||
const sqliteModule = async
|
||||
this.encrypted = options.encrypted;
|
||||
this.name = name;
|
||||
this.async = options.async;
|
||||
|
||||
const option = options.url ? { locateFile: () => options.url } : {};
|
||||
const sqliteModule = options.async
|
||||
? await import("./wa-sqlite-async").then(
|
||||
({ default: SQLiteAsyncESMFactory }) => SQLiteAsyncESMFactory(option)
|
||||
)
|
||||
@@ -61,11 +68,11 @@ class _SQLiteWorker {
|
||||
SQLiteSyncESMFactory(option)
|
||||
);
|
||||
this.sqlite = Factory(sqliteModule);
|
||||
this.vfs = await this.getVFS(this.dbName, async);
|
||||
this.vfs = await this.getVFS(name, options.async);
|
||||
|
||||
this.sqlite.vfs_register(this.vfs, false);
|
||||
this.db = await this.sqlite.open_v2(
|
||||
this.dbName,
|
||||
name,
|
||||
undefined,
|
||||
`multipleciphers-${this.vfs.name}`
|
||||
);
|
||||
@@ -163,7 +170,7 @@ class _SQLiteWorker {
|
||||
if (this.encrypted && !sql.startsWith("PRAGMA key")) {
|
||||
await this.waitForDatabase();
|
||||
}
|
||||
if (!this.db) throw new Error("No database is not opened.");
|
||||
if (!this.db) throw new Error("Database is not opened.");
|
||||
|
||||
const rows = (await this.exec(sql, mode, parameters)) as R[];
|
||||
if (mode === "query") return { rows };
|
||||
@@ -194,16 +201,16 @@ class _SQLiteWorker {
|
||||
this.initialized = false;
|
||||
}
|
||||
|
||||
async export(dbName: string, async: boolean) {
|
||||
const vfs = await this.getVFS(dbName, async);
|
||||
const stream = new ReadableStream(new DatabaseSource(vfs, dbName));
|
||||
async export() {
|
||||
const vfs = await this.getVFS(this.name, this.async);
|
||||
const stream = new ReadableStream(new DatabaseSource(vfs, this.name));
|
||||
return transfer(stream, [stream]);
|
||||
}
|
||||
|
||||
async delete(dbName: string, async: boolean) {
|
||||
async delete() {
|
||||
await this.close();
|
||||
if (this.vfs) await this.vfs.delete();
|
||||
else await (await this.getVFS(dbName, async)).delete();
|
||||
else await (await this.getVFS(this.name, this.async)).delete();
|
||||
}
|
||||
|
||||
async getVFS(dbName: string, async: boolean) {
|
||||
@@ -222,7 +229,7 @@ class _SQLiteWorker {
|
||||
async initialize() {
|
||||
self.dispatchEvent(
|
||||
new MessageEvent("message", {
|
||||
data: { type: "databaseInitialized", dbName: this.dbName }
|
||||
data: { type: "databaseInitialized", dbName: this.name }
|
||||
})
|
||||
);
|
||||
console.log("Database initialized", this.db);
|
||||
@@ -237,7 +244,7 @@ class _SQLiteWorker {
|
||||
self.addEventListener("message", (ev) => {
|
||||
if (
|
||||
ev.data.type === "databaseInitialized" &&
|
||||
ev.data.dbName === this.dbName
|
||||
ev.data.dbName === this.name
|
||||
)
|
||||
resolve(true);
|
||||
})
|
||||
@@ -251,11 +258,17 @@ export type SQLiteWorker = typeof _SQLiteWorker.prototype;
|
||||
|
||||
addEventListener("message", async (event) => {
|
||||
if (!event.data.type) {
|
||||
const worker = new _SQLiteWorker(event.data.dbName, event.data.encrypted);
|
||||
await worker.open(event.data.async, event.data.uri);
|
||||
const worker = new _SQLiteWorker();
|
||||
await worker.open(event.data.dbName, {
|
||||
async: event.data.async,
|
||||
encrypted: event.data.encrypted,
|
||||
url: event.data.uri
|
||||
});
|
||||
const providerPort = createSharedServicePort(worker);
|
||||
postMessage(null, [providerPort]);
|
||||
|
||||
self.addEventListener("beforeunload", () => worker.close());
|
||||
}
|
||||
});
|
||||
const worker = new _SQLiteWorker();
|
||||
expose(worker);
|
||||
|
||||
@@ -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.
@@ -25,6 +25,7 @@ import SQLiteSyncURI from "./wa-sqlite.wasm?url";
|
||||
import SQLiteAsyncURI from "./wa-sqlite-async.wasm?url";
|
||||
import { Mutex } from "async-mutex";
|
||||
import { SharedService } from "./shared-service";
|
||||
import { Remote, wrap } from "comlink";
|
||||
|
||||
type Config = {
|
||||
dbName: string;
|
||||
@@ -38,13 +39,14 @@ const servicePool = new Map<
|
||||
{ service: SharedService<SQLiteWorker>; activated: boolean; closed: boolean }
|
||||
>();
|
||||
|
||||
export class WaSqliteWorkerDriver implements Driver {
|
||||
export class WaSqliteWorkerMultipleTabDriver implements Driver {
|
||||
private connection?: DatabaseConnection;
|
||||
private connectionMutex = new Mutex();
|
||||
private initializationMutex = new Mutex();
|
||||
private readonly serviceName;
|
||||
|
||||
constructor(private readonly config: Config) {
|
||||
console.log("multi tab driver", config.dbName);
|
||||
this.serviceName = `${config.dbName}-service`;
|
||||
}
|
||||
|
||||
@@ -59,10 +61,11 @@ export class WaSqliteWorkerDriver implements Driver {
|
||||
if (activated) {
|
||||
if (closed) {
|
||||
console.log("Already activated. Reinitializing...");
|
||||
await service.proxy.open(
|
||||
this.config.async,
|
||||
this.config.async ? SQLiteAsyncURI : SQLiteSyncURI
|
||||
);
|
||||
await service.proxy.open(this.config.dbName, {
|
||||
async: this.config.async,
|
||||
encrypted: this.config.encrypted,
|
||||
url: this.config.async ? SQLiteAsyncURI : SQLiteSyncURI
|
||||
});
|
||||
this.needsInitialization = true;
|
||||
servicePool.set(this.serviceName, {
|
||||
service,
|
||||
@@ -193,19 +196,76 @@ export class WaSqliteWorkerDriver implements Driver {
|
||||
async delete() {
|
||||
const service = servicePool.get(this.serviceName);
|
||||
if (!service || !service.service) return;
|
||||
await service.service?.proxy?.delete(this.config.dbName, this.config.async);
|
||||
await service.service?.proxy?.delete();
|
||||
service.closed = true;
|
||||
}
|
||||
|
||||
async export() {
|
||||
return servicePool
|
||||
.get(this.serviceName)
|
||||
?.service?.proxy?.export(this.config.dbName, this.config.async);
|
||||
return servicePool.get(this.serviceName)?.service?.proxy?.export();
|
||||
}
|
||||
}
|
||||
|
||||
export class WaSqliteWorkerSingleTabDriver implements Driver {
|
||||
private connection?: DatabaseConnection;
|
||||
private connectionMutex = new Mutex();
|
||||
private readonly worker = wrap<SQLiteWorker>(
|
||||
new Worker({ name: this.config.dbName })
|
||||
);
|
||||
|
||||
constructor(private readonly config: Config) {
|
||||
console.log("single tab driver", config.dbName);
|
||||
}
|
||||
|
||||
async init(): Promise<void> {
|
||||
await this.worker.open(this.config.dbName, {
|
||||
async: this.config.async,
|
||||
encrypted: this.config.encrypted,
|
||||
url: this.config.async ? SQLiteAsyncURI : SQLiteSyncURI
|
||||
});
|
||||
this.connection = new WaSqliteWorkerConnection(this.worker);
|
||||
}
|
||||
|
||||
async acquireConnection(): Promise<DatabaseConnection> {
|
||||
if (!this.connection) throw new Error("Driver not initialized.");
|
||||
|
||||
// SQLite only has one single connection. We use a mutex here to wait
|
||||
// until the single connection has been released.
|
||||
await this.connectionMutex.waitForUnlock();
|
||||
await this.connectionMutex.acquire();
|
||||
return this.connection;
|
||||
}
|
||||
|
||||
async beginTransaction(connection: DatabaseConnection): Promise<void> {
|
||||
await connection.executeQuery(CompiledQuery.raw("begin"));
|
||||
}
|
||||
|
||||
async commitTransaction(connection: DatabaseConnection): Promise<void> {
|
||||
await connection.executeQuery(CompiledQuery.raw("commit"));
|
||||
}
|
||||
|
||||
async rollbackTransaction(connection: DatabaseConnection): Promise<void> {
|
||||
await connection.executeQuery(CompiledQuery.raw("rollback"));
|
||||
}
|
||||
|
||||
async releaseConnection(): Promise<void> {
|
||||
this.connectionMutex.release();
|
||||
}
|
||||
|
||||
async destroy(): Promise<void> {
|
||||
await this.worker.close();
|
||||
}
|
||||
|
||||
async delete() {
|
||||
await this.worker.delete();
|
||||
}
|
||||
|
||||
async export() {
|
||||
return await this.worker.export();
|
||||
}
|
||||
}
|
||||
|
||||
class WaSqliteWorkerConnection implements DatabaseConnection {
|
||||
constructor(private readonly worker: SQLiteWorker) {}
|
||||
constructor(private readonly worker: SQLiteWorker | Remote<SQLiteWorker>) {}
|
||||
|
||||
streamQuery<R>(): AsyncIterableIterator<QueryResult<R>> {
|
||||
throw new Error("wasqlite driver doesn't support streaming");
|
||||
@@ -221,6 +281,8 @@ class WaSqliteWorkerConnection implements DatabaseConnection {
|
||||
: query.kind === "RawNode"
|
||||
? "raw"
|
||||
: "exec";
|
||||
return this.worker.run(mode, sql, parameters as any);
|
||||
return this.worker.run(mode, sql, parameters as any) as Promise<
|
||||
QueryResult<R>
|
||||
>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
@@ -55,7 +55,7 @@ type TaskProgress = {
|
||||
type ProgressReportCallback = (progress: TaskProgress) => void;
|
||||
|
||||
export class TaskManager {
|
||||
static async startTask<T>(task: TaskDefinition<T>): Promise<T> {
|
||||
static async startTask<T>(task: TaskDefinition<T>): Promise<T | Error> {
|
||||
switch (task.type) {
|
||||
case "status": {
|
||||
const statusTask = task;
|
||||
@@ -74,7 +74,7 @@ export class TaskManager {
|
||||
return result;
|
||||
}
|
||||
case "modal": {
|
||||
return await showProgressDialog<T>({
|
||||
return await showProgressDialog<T | Error>({
|
||||
title: task.title,
|
||||
subtitle: task.subtitle,
|
||||
action: task.action
|
||||
|
||||
@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import { Button, Flex, Text } from "@theme-ui/components";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
ArrowLeft,
|
||||
Cross,
|
||||
EditorFullWidth,
|
||||
EditorNormalWidth,
|
||||
@@ -34,9 +35,11 @@ import {
|
||||
Publish,
|
||||
Published,
|
||||
Readonly,
|
||||
Redo,
|
||||
Search,
|
||||
TableOfContents,
|
||||
Trash,
|
||||
Undo,
|
||||
Unlock
|
||||
} from "../icons";
|
||||
import { ScrollContainer } from "@notesnook/ui";
|
||||
@@ -71,6 +74,8 @@ import { useStore as useMonographStore } from "../../stores/monograph-store";
|
||||
import { useStore as useUserStore } from "../../stores/user-store";
|
||||
import { db } from "../../common/db";
|
||||
import { showPublishView } from "../publish-view";
|
||||
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
|
||||
import useMobile from "../../hooks/use-mobile";
|
||||
|
||||
export function EditorActionBar() {
|
||||
const editorMargins = useEditorStore((store) => store.editorMargins);
|
||||
@@ -79,19 +84,34 @@ export function EditorActionBar() {
|
||||
const activeSession = useEditorStore((store) =>
|
||||
store.activeSessionId ? store.getSession(store.activeSessionId) : undefined
|
||||
);
|
||||
const editor = useEditorManager((store) =>
|
||||
activeSession?.id ? store.editors[activeSession?.id]?.editor : undefined
|
||||
const editorManager = useEditorManager((store) =>
|
||||
activeSession?.id ? store.editors[activeSession?.id] : undefined
|
||||
);
|
||||
const isLoggedIn = useUserStore((store) => store.isLoggedIn);
|
||||
const monographs = useMonographStore((store) => store.monographs);
|
||||
const isNotePublished =
|
||||
activeSession && db.monographs.isPublished(activeSession.id);
|
||||
const isMobile = useMobile();
|
||||
const setIsEditorOpen = useAppStore((store) => store.setIsEditorOpen);
|
||||
|
||||
const tools = [
|
||||
{
|
||||
title: "Undo",
|
||||
icon: Undo,
|
||||
enabled: editorManager?.canUndo,
|
||||
onClick: () => editorManager?.editor?.undo()
|
||||
},
|
||||
{
|
||||
title: "Redo",
|
||||
icon: Redo,
|
||||
enabled: editorManager?.canRedo,
|
||||
onClick: () => editorManager?.editor?.redo()
|
||||
},
|
||||
{
|
||||
title: isNotePublished ? "Published" : "Publish",
|
||||
icon: isNotePublished ? Published : Publish,
|
||||
hidden: !isLoggedIn,
|
||||
hideOnMobile: true,
|
||||
enabled:
|
||||
activeSession &&
|
||||
(activeSession.type === "default" || activeSession.type === "readonly"),
|
||||
@@ -105,6 +125,7 @@ export function EditorActionBar() {
|
||||
title: editorMargins ? "Disable editor margins" : "Enable editor margins",
|
||||
icon: editorMargins ? EditorNormalWidth : EditorFullWidth,
|
||||
enabled: true,
|
||||
hideOnMobile: true,
|
||||
onClick: () => useEditorStore.getState().toggleEditorMargins()
|
||||
},
|
||||
{
|
||||
@@ -154,7 +175,7 @@ export function EditorActionBar() {
|
||||
activeSession.type !== "locked" &&
|
||||
activeSession.type !== "diff" &&
|
||||
activeSession.type !== "conflicted",
|
||||
onClick: editor?.startSearch
|
||||
onClick: editorManager?.editor?.startSearch
|
||||
},
|
||||
{
|
||||
title: "Properties",
|
||||
@@ -172,7 +193,24 @@ export function EditorActionBar() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<TabStrip />
|
||||
{isMobile ? (
|
||||
<Flex sx={{ flex: 1 }}>
|
||||
<Button
|
||||
variant={"secondary"}
|
||||
sx={{
|
||||
height: "100%",
|
||||
bg: "transparent",
|
||||
borderRadius: 0,
|
||||
flexShrink: 0
|
||||
}}
|
||||
onClick={() => setIsEditorOpen(false)}
|
||||
>
|
||||
<ArrowLeft size={18} />
|
||||
</Button>
|
||||
</Flex>
|
||||
) : (
|
||||
<TabStrip />
|
||||
)}
|
||||
{tools.map((tool) => (
|
||||
<Button
|
||||
data-test-id={tool.title}
|
||||
@@ -484,15 +522,11 @@ function Tab(props: TabProps) {
|
||||
e.stopPropagation();
|
||||
if (isTemporary) onKeepOpen();
|
||||
}}
|
||||
onMouseDown={(e) => {
|
||||
if (e.button == 1) {
|
||||
e.preventDefault();
|
||||
onClose();
|
||||
}
|
||||
onAuxClick={(e) => {
|
||||
if (e.button == 1) onClose();
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onFocus();
|
||||
onMouseUp={(e) => {
|
||||
if (e.button == 0) onFocus();
|
||||
}}
|
||||
{...listeners}
|
||||
{...attributes}
|
||||
@@ -523,9 +557,11 @@ function Tab(props: TabProps) {
|
||||
flexShrink: 0
|
||||
}}
|
||||
size={14}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onPin();
|
||||
onMouseUp={(e) => {
|
||||
if (e.button == 0) {
|
||||
e.stopPropagation();
|
||||
onPin();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -536,9 +572,11 @@ function Tab(props: TabProps) {
|
||||
borderRadius: "default",
|
||||
flexShrink: 0
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onClose();
|
||||
onMouseUp={(e) => {
|
||||
if (e.button == 0) {
|
||||
e.stopPropagation();
|
||||
onClose();
|
||||
}
|
||||
}}
|
||||
className="closeTabButton"
|
||||
size={16}
|
||||
@@ -593,6 +631,7 @@ function ReorderableList<T extends { id: string }>(
|
||||
measuring={{
|
||||
droppable: { strategy: MeasuringStrategy.Always }
|
||||
}}
|
||||
modifiers={[restrictToHorizontalAxis]}
|
||||
>
|
||||
<SortableContext items={items} strategy={horizontalListSortingStrategy}>
|
||||
{items.map((item, index) => (
|
||||
|
||||
@@ -127,11 +127,8 @@ export default function TabsView() {
|
||||
|
||||
return (
|
||||
<>
|
||||
{IS_DESKTOP_APP ? (
|
||||
ReactDOM.createPortal(
|
||||
<EditorActionBar />,
|
||||
document.getElementById("titlebar-portal-container")!
|
||||
)
|
||||
{!hasNativeTitlebar ? (
|
||||
<EditorActionBarPortal />
|
||||
) : (
|
||||
<Flex sx={{ px: 1 }}>
|
||||
<EditorActionBar />
|
||||
@@ -153,12 +150,7 @@ export default function TabsView() {
|
||||
<PanelGroup direction="horizontal" autoSaveId={"editor-panels"}>
|
||||
<Panel id="editor-panel" className="editor-pane" order={1}>
|
||||
{sessions.map((session) => (
|
||||
<Freeze
|
||||
key={session.id}
|
||||
freeze={
|
||||
session.needsHydration || session.id !== activeSessionId
|
||||
}
|
||||
>
|
||||
<Freeze key={session.id} freeze={session.id !== activeSessionId}>
|
||||
{session.type === "locked" ? (
|
||||
<UnlockNoteView session={session} />
|
||||
) : session.type === "conflicted" || session.type === "diff" ? (
|
||||
@@ -233,7 +225,8 @@ const MemoizedEditorView = React.memo(
|
||||
EditorView,
|
||||
(prev, next) =>
|
||||
prev.session.id === next.session.id &&
|
||||
prev.session.type === next.session.type
|
||||
prev.session.type === next.session.type &&
|
||||
prev.session.needsHydration === next.session.needsHydration
|
||||
);
|
||||
function EditorView({
|
||||
session
|
||||
@@ -244,7 +237,7 @@ function EditorView({
|
||||
| ReadonlyEditorSession
|
||||
| DeletedEditorSession;
|
||||
}) {
|
||||
const lastChangedTime = useRef<number>(Date.now());
|
||||
const lastChangedTime = useRef<number>(0);
|
||||
const root = useRef<HTMLDivElement>(null);
|
||||
|
||||
const toggleProperties = useEditorStore((store) => store.toggleProperties);
|
||||
@@ -302,6 +295,12 @@ function EditorView({
|
||||
};
|
||||
}, [editor]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!session.needsHydration && session.content) {
|
||||
editor?.updateContent(session.content.data);
|
||||
}
|
||||
}, [editor, session.needsHydration]);
|
||||
|
||||
return (
|
||||
<Flex
|
||||
ref={root}
|
||||
@@ -459,6 +458,7 @@ export function Editor(props: EditorProps) {
|
||||
<EditorChrome {...props}>
|
||||
<Tiptap
|
||||
id={id}
|
||||
isHydrating={!!session.needsHydration}
|
||||
nonce={nonce}
|
||||
readonly={readonly}
|
||||
content={content}
|
||||
@@ -466,7 +466,8 @@ export function Editor(props: EditorProps) {
|
||||
corsHost: Config.get("corsProxy", "https://cors.notesnook.com")
|
||||
}}
|
||||
onLoad={(editor) => {
|
||||
restoreSelection(editor, id);
|
||||
editor = editor || useEditorManager.getState().getEditor(id)?.editor;
|
||||
if (editor) restoreSelection(editor, id);
|
||||
restoreScrollPosition(session);
|
||||
}}
|
||||
onSelectionChange={({ from, to }) =>
|
||||
@@ -629,8 +630,8 @@ function EditorChrome(props: PropsWithChildren<EditorProps>) {
|
||||
maxWidth: editorMargins ? "min(100%, 850px)" : "auto",
|
||||
width: "100%"
|
||||
}}
|
||||
pl={6}
|
||||
pr={6}
|
||||
pl={[2, 2, 6]}
|
||||
pr={[2, 2, 6]}
|
||||
onClick={onRequestFocus}
|
||||
>
|
||||
{children}
|
||||
@@ -773,8 +774,10 @@ function restoreScrollPosition(session: EditorSession) {
|
||||
}
|
||||
|
||||
function restoreSelection(editor: IEditor, id: string) {
|
||||
editor.focus({
|
||||
position: Config.get(`${id}:selection`, { from: 0, to: 0 })
|
||||
setTimeout(() => {
|
||||
editor.focus({
|
||||
position: Config.get(`${id}:selection`, { from: 0, to: 0 })
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -811,7 +814,7 @@ function UnlockNoteView(props: UnlockNoteViewProps) {
|
||||
throw new Error("note with this id does not exist.");
|
||||
|
||||
useEditorStore.getState().addSession({
|
||||
type: "default",
|
||||
type: session.note.readonly ? "readonly" : "default",
|
||||
locked: true,
|
||||
id: session.id,
|
||||
note: session.note,
|
||||
@@ -826,3 +829,9 @@ function UnlockNoteView(props: UnlockNoteViewProps) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function EditorActionBarPortal() {
|
||||
const container = document.getElementById("titlebar-portal-container");
|
||||
if (!container) return null;
|
||||
return ReactDOM.createPortal(<EditorActionBar />, container);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ function TableOfContents(props: TableOfContentsProps) {
|
||||
key={t.id}
|
||||
sx={{
|
||||
textAlign: "left",
|
||||
paddingLeft: `${t.level * 5}px`,
|
||||
paddingLeft: `${t.level * 5 + (t.level - 1) * 5}px`,
|
||||
py: 1,
|
||||
pr: 1,
|
||||
borderLeft: "5px solid transparent",
|
||||
|
||||
@@ -59,6 +59,9 @@ import { writeToClipboard } from "../../utils/clipboard";
|
||||
import { useEditorStore } from "../../stores/editor-store";
|
||||
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";
|
||||
|
||||
export type OnChangeHandler = (
|
||||
content: () => string,
|
||||
@@ -67,7 +70,7 @@ export type OnChangeHandler = (
|
||||
type TipTapProps = {
|
||||
id: string;
|
||||
editorContainer: () => HTMLElement | undefined;
|
||||
onLoad?: (editor: IEditor) => void;
|
||||
onLoad?: (editor?: IEditor) => void;
|
||||
onChange?: OnChangeHandler;
|
||||
onContentChange?: () => void;
|
||||
onSelectionChange?: (range: { from: number; to: number }) => void;
|
||||
@@ -89,9 +92,15 @@ type TipTapProps = {
|
||||
readonly?: boolean;
|
||||
nonce?: number;
|
||||
isMobile?: boolean;
|
||||
isTablet?: boolean;
|
||||
downloadOptions?: DownloadOptions;
|
||||
fontSize: number;
|
||||
fontFamily: string;
|
||||
|
||||
doubleSpacedLines: boolean;
|
||||
dateFormat: string;
|
||||
timeFormat: TimeFormat;
|
||||
markdownShortcuts: boolean;
|
||||
};
|
||||
|
||||
function updateWordCount(id: string, content: () => Fragment) {
|
||||
@@ -127,21 +136,18 @@ function TipTap(props: TipTapProps) {
|
||||
readonly,
|
||||
nonce,
|
||||
isMobile,
|
||||
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({
|
||||
@@ -245,10 +251,13 @@ function TipTap(props: TipTapProps) {
|
||||
onDestroy: () => {
|
||||
useEditorManager.getState().setEditor(id);
|
||||
},
|
||||
onTransaction: ({ editor }) => {
|
||||
onTransaction: ({ editor, transaction }) => {
|
||||
useEditorManager.getState().updateEditor(id, {
|
||||
canRedo: editor.can().redo(),
|
||||
canUndo: editor.can().undo()
|
||||
canUndo: editor.can().undo(),
|
||||
tableOfContents: transaction.getMeta("isUpdatingContent")
|
||||
? getTableOfContents(editor.view.dom)
|
||||
: useEditorManager.getState().getEditor(id)?.tableOfContents
|
||||
});
|
||||
},
|
||||
copyToClipboard(text, html) {
|
||||
@@ -358,7 +367,12 @@ function TipTap(props: TipTapProps) {
|
||||
>
|
||||
<Toolbar
|
||||
editor={editor}
|
||||
location={isMobile ? "bottom" : "top"}
|
||||
location={"top"}
|
||||
sx={
|
||||
isTablet || isMobile
|
||||
? { overflowX: "scroll", flexWrap: "nowrap" }
|
||||
: {}
|
||||
}
|
||||
tools={toolbarConfig}
|
||||
defaultFontFamily={fontFamily}
|
||||
defaultFontSize={fontSize}
|
||||
@@ -370,15 +384,38 @@ 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;
|
||||
}
|
||||
) {
|
||||
const { onLoad, isHydrating } = props;
|
||||
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();
|
||||
const isMobile = useMobile();
|
||||
const isTablet = useTablet();
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (
|
||||
@@ -397,22 +434,42 @@ function TiptapWrapper(
|
||||
theme.scopes.base.primary.paragraph;
|
||||
}, [theme]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isHydrating) {
|
||||
onLoad?.();
|
||||
containerRef.current
|
||||
?.querySelector(".editor-loading-container")
|
||||
?.classList.add("hidden");
|
||||
}
|
||||
}, [isHydrating]);
|
||||
|
||||
return (
|
||||
<Flex
|
||||
ref={containerRef}
|
||||
sx={{
|
||||
flex: 1,
|
||||
flexDirection: "column",
|
||||
".tiptap.ProseMirror": { pb: 150 }
|
||||
".tiptap.ProseMirror": { pb: 150 },
|
||||
".editor-container": { opacity: isHydrating ? 0 : 1 },
|
||||
".editor-loading-container.hidden": { display: "none" }
|
||||
}}
|
||||
>
|
||||
<TipTap
|
||||
key={`tiptap-${props.id}-${doubleSpacedLines}-${dateFormat}-${timeFormat}-${markdownShortcuts}`}
|
||||
{...props}
|
||||
isMobile={isMobile}
|
||||
isTablet={isTablet}
|
||||
doubleSpacedLines={doubleSpacedLines}
|
||||
dateFormat={dateFormat}
|
||||
timeFormat={timeFormat}
|
||||
markdownShortcuts={markdownShortcuts}
|
||||
onLoad={(editor) => {
|
||||
props.onLoad?.(editor);
|
||||
containerRef.current
|
||||
?.querySelector(".editor-loading-container")
|
||||
?.remove();
|
||||
if (!isHydrating) {
|
||||
onLoad?.(editor);
|
||||
containerRef.current
|
||||
?.querySelector(".editor-loading-container")
|
||||
?.classList.add("hidden");
|
||||
}
|
||||
}}
|
||||
editorContainer={() => {
|
||||
if (editorContainerRef.current) return editorContainerRef.current;
|
||||
@@ -471,6 +528,7 @@ function toIEditor(editor: Editor): IEditor {
|
||||
?.chain()
|
||||
.command(({ tr }) => {
|
||||
tr.setMeta("preventSave", true);
|
||||
tr.setMeta("isUpdatingContent", true);
|
||||
return true;
|
||||
})
|
||||
.setContent(content, false, { preserveWhitespace: true })
|
||||
|
||||
@@ -17,15 +17,42 @@ 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 { PropsWithChildren } from "react";
|
||||
import { PropsWithChildren, useEffect } from "react";
|
||||
import { ErrorText } from "../error-text";
|
||||
import { BaseThemeProvider } from "../theme-provider";
|
||||
import { Button, Flex, Text } from "@theme-ui/components";
|
||||
import {
|
||||
ErrorBoundary as RErrorBoundary,
|
||||
FallbackProps
|
||||
FallbackProps,
|
||||
useErrorBoundary
|
||||
} from "react-error-boundary";
|
||||
import { createDialect } from "../../common/sqlite";
|
||||
import { useKeyStore } from "../../interfaces/key-store";
|
||||
|
||||
export function GlobalErrorHandler(props: PropsWithChildren) {
|
||||
const { showBoundary } = useErrorBoundary();
|
||||
|
||||
useEffect(() => {
|
||||
function handleError(e: ErrorEvent) {
|
||||
const error = new Error(e.message);
|
||||
error.stack = `${e.filename}:${e.lineno}:${e.colno}`;
|
||||
showBoundary(e.error || error);
|
||||
}
|
||||
function handleUnhandledRejection(e: PromiseRejectionEvent) {
|
||||
showBoundary(e.reason);
|
||||
}
|
||||
window.addEventListener("unhandledrejection", handleUnhandledRejection);
|
||||
window.addEventListener("error", handleError);
|
||||
return () => {
|
||||
window.removeEventListener(
|
||||
"unhandledrejection",
|
||||
handleUnhandledRejection
|
||||
);
|
||||
window.removeEventListener("error", handleError);
|
||||
};
|
||||
}, [showBoundary]);
|
||||
|
||||
return <>{props.children}</>;
|
||||
}
|
||||
|
||||
export function ErrorBoundary(props: PropsWithChildren) {
|
||||
return (
|
||||
@@ -170,12 +197,11 @@ function getErrorHelp(props: FallbackProps) {
|
||||
return {
|
||||
explanation: `This error usually means the database file is either corrupt or it could not be decrypted.`,
|
||||
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 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 { useKeyStore } = await import("../../interfaces/key-store");
|
||||
|
||||
const { createDialect } = await import("../../common/sqlite");
|
||||
await useKeyStore.getState().clear();
|
||||
const dialect = createDialect("notesnook");
|
||||
const dialect = createDialect("notesnook", true);
|
||||
const driver = dialect.createDriver();
|
||||
await driver.delete();
|
||||
resetErrorBoundary();
|
||||
@@ -185,12 +211,11 @@ function getErrorHelp(props: FallbackProps) {
|
||||
return {
|
||||
explanation: `This error means the at rest encryption key could not be decrypted. This can be due to data corruption or implementation change.`,
|
||||
action:
|
||||
"This error can only be fixed by wiping & reseting the Key Store and the database.",
|
||||
"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 { useKeyStore } = await import("../../interfaces/key-store");
|
||||
|
||||
const { createDialect } = await import("../../common/sqlite");
|
||||
await useKeyStore.getState().clear();
|
||||
const dialect = createDialect("notesnook");
|
||||
const dialect = createDialect("notesnook", true);
|
||||
const driver = dialect.createDriver();
|
||||
await driver.delete();
|
||||
resetErrorBoundary();
|
||||
|
||||
@@ -340,9 +340,9 @@ export class Lightbox extends React.Component<LightboxProps> {
|
||||
overflow: "hidden",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-end",
|
||||
height: IS_DESKTOP_APP ? TITLE_BAR_HEIGHT : "auto",
|
||||
height: !hasNativeTitlebar ? TITLE_BAR_HEIGHT : "auto",
|
||||
pr:
|
||||
IS_DESKTOP_APP && getPlatform() !== "darwin"
|
||||
!hasNativeTitlebar && getPlatform() !== "darwin"
|
||||
? "calc(100vw - env(titlebar-area-width))"
|
||||
: 0
|
||||
}}
|
||||
|
||||
@@ -31,19 +31,24 @@ 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";
|
||||
import { useKeyboardListNavigation } from "../../hooks/use-keyboard-list-navigation";
|
||||
import { VirtualizedGrouping, GroupingKey, Item } from "@notesnook/core";
|
||||
import {
|
||||
FlatScrollIntoViewLocation,
|
||||
ItemProps,
|
||||
ScrollerProps,
|
||||
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";
|
||||
|
||||
@@ -76,7 +81,6 @@ type ListContainerProps = {
|
||||
onClick: () => void;
|
||||
};
|
||||
};
|
||||
var activeItem: { focus: boolean; id: string } | undefined = undefined;
|
||||
function ListContainer(props: ListContainerProps) {
|
||||
const { group, items, context, refresh, header, button, compact } = props;
|
||||
|
||||
@@ -92,6 +96,7 @@ function ListContainer(props: ListContainerProps) {
|
||||
|
||||
const listRef = useRef<VirtuosoHandle>(null);
|
||||
const listContainerRef = useRef(null);
|
||||
const activeItem = useRef<{ focus: boolean; id: string }>();
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
@@ -100,18 +105,18 @@ function ListContainer(props: ListContainerProps) {
|
||||
}, []);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (activeItem) {
|
||||
if (activeItem.current) {
|
||||
items
|
||||
.ids()
|
||||
.then(
|
||||
(ids) =>
|
||||
listRef.current &&
|
||||
activeItem &&
|
||||
activeItem.current &&
|
||||
revealItemInList(
|
||||
listRef.current,
|
||||
activeItem.id,
|
||||
activeItem.current.id,
|
||||
ids,
|
||||
activeItem.focus
|
||||
activeItem.current.focus
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -119,8 +124,8 @@ function ListContainer(props: ListContainerProps) {
|
||||
const event = AppEventManager.subscribe(
|
||||
AppEvents.revealItemInList,
|
||||
(id, focus) => {
|
||||
if (activeItem?.id === id) return;
|
||||
activeItem = { id, focus };
|
||||
if (activeItem.current?.id === id) return;
|
||||
activeItem.current = { id, focus };
|
||||
items
|
||||
.ids()
|
||||
.then(
|
||||
@@ -135,7 +140,7 @@ function ListContainer(props: ListContainerProps) {
|
||||
};
|
||||
}, [items]);
|
||||
|
||||
const { onFocus, onMouseDown, onKeyDown } = useKeyboardListNavigation({
|
||||
const { onMouseUp, onKeyDown } = useKeyboardListNavigation({
|
||||
length: items.length,
|
||||
reset: () => toggleSelection(false),
|
||||
deselect: (index) => {
|
||||
@@ -206,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)}
|
||||
@@ -215,7 +220,7 @@ function ListContainer(props: ListContainerProps) {
|
||||
Item: VirtuosoItem,
|
||||
Header: ListHeader
|
||||
}}
|
||||
increaseViewportBy={{ top: 10, bottom: 10 }}
|
||||
increaseViewportBy={{ top: 200, bottom: 200 }}
|
||||
context={{
|
||||
header,
|
||||
items,
|
||||
@@ -227,8 +232,7 @@ function ListContainer(props: ListContainerProps) {
|
||||
focusGroup: setFocusedGroupIndex,
|
||||
context,
|
||||
compact,
|
||||
onMouseDown,
|
||||
onFocus
|
||||
onMouseUp
|
||||
}}
|
||||
itemContent={(index, _data, context) => (
|
||||
<ItemRenderer context={context} index={index} />
|
||||
@@ -256,7 +260,7 @@ function ListContainer(props: ListContainerProps) {
|
||||
height: 45
|
||||
}}
|
||||
>
|
||||
<Plus color="static" />
|
||||
<Plus color="accentForeground" />
|
||||
</Button>
|
||||
)}
|
||||
</Flex>
|
||||
@@ -279,8 +283,7 @@ type ListContext = {
|
||||
context?: Context;
|
||||
compact?: boolean;
|
||||
|
||||
onMouseDown: (e: MouseEvent, itemIndex: number) => void;
|
||||
onFocus: (itemIndex: number) => void;
|
||||
onMouseUp: (e: MouseEvent, itemIndex: number) => void;
|
||||
};
|
||||
function ItemRenderer({
|
||||
index,
|
||||
@@ -302,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>
|
||||
);
|
||||
}
|
||||
@@ -436,9 +393,8 @@ function VirtuosoItem({
|
||||
return (
|
||||
<div
|
||||
{...props}
|
||||
onFocus={() => context?.onFocus(props["data-item-index"])}
|
||||
onMouseDown={(e) =>
|
||||
context?.onMouseDown(e.nativeEvent, props["data-item-index"])
|
||||
onMouseUp={(e) =>
|
||||
context?.onMouseUp(e.nativeEvent, props["data-item-index"])
|
||||
}
|
||||
>
|
||||
{props.children}
|
||||
@@ -461,11 +417,13 @@ function waitForElement(
|
||||
list: VirtuosoHandle,
|
||||
index: number,
|
||||
elementId: string,
|
||||
callback: (element: HTMLElement) => void
|
||||
callback: (element: HTMLElement) => void,
|
||||
options?: Partial<FlatScrollIntoViewLocation>
|
||||
) {
|
||||
let waitInterval = 0;
|
||||
let maxAttempts = 3;
|
||||
list.scrollIntoView({
|
||||
...options,
|
||||
index,
|
||||
done: function scrollDone() {
|
||||
if (!maxAttempts) return;
|
||||
@@ -497,6 +455,7 @@ function revealItemInList(
|
||||
list,
|
||||
index,
|
||||
`id_${itemId}`,
|
||||
(element) => focus && element.focus()
|
||||
(element) => focus && element.focus(),
|
||||
{ align: "center" }
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -27,28 +27,6 @@ const Lines = [1, 2].map(() => getRandomArbitrary(40, 90));
|
||||
export const ListLoader = memo(function ListLoader() {
|
||||
return (
|
||||
<>
|
||||
<Flex
|
||||
sx={{ py: 1, alignItems: "center", justifyContent: "center", px: 1 }}
|
||||
>
|
||||
<Box sx={{ height: 38 }}>
|
||||
<Skeleton enableAnimation={false} width={38} height={38} circle />
|
||||
</Box>
|
||||
<Flex
|
||||
sx={{
|
||||
flex: 1,
|
||||
ml: 1,
|
||||
flexDirection: "column",
|
||||
justifyContent: "center"
|
||||
}}
|
||||
>
|
||||
<Box sx={{ height: 14 }}>
|
||||
<Skeleton enableAnimation={false} inline height={14} />
|
||||
</Box>
|
||||
<Box sx={{ mt: 1, height: 10 }}>
|
||||
<Skeleton enableAnimation={false} inline height={10} />
|
||||
</Box>
|
||||
</Flex>
|
||||
</Flex>
|
||||
{Lines.map((width) => (
|
||||
<Box key={width} sx={{ py: 2, px: 1 }}>
|
||||
<Skeleton
|
||||
|
||||
@@ -71,6 +71,7 @@ import { usePersistentState } from "../../hooks/use-persistent-state";
|
||||
import { MenuItem } from "@notesnook/ui";
|
||||
import { Notebook, Tag } from "@notesnook/core";
|
||||
import { handleDrop } from "../../common/drop-handler";
|
||||
import { Menu } from "../../hooks/use-menu";
|
||||
|
||||
type Route = {
|
||||
id: string;
|
||||
@@ -172,6 +173,24 @@ function NavigationMenu(props: NavigationMenuProps) {
|
||||
|
||||
const getSidebarItems = useCallback(async () => {
|
||||
return [
|
||||
{
|
||||
key: "reset-sidebar",
|
||||
type: "button",
|
||||
title: "Reset sidebar",
|
||||
onClick: () => {
|
||||
db.settings
|
||||
.setSideBarHiddenItems("routes", [])
|
||||
.then(() => db.settings.setSideBarHiddenItems("colors", []))
|
||||
.then(() => db.settings.setSideBarOrder("colors", []))
|
||||
.then(() => db.settings.setSideBarOrder("routes", []))
|
||||
.then(() => db.settings.setSideBarOrder("shortcuts", []))
|
||||
.then(() => {
|
||||
setHiddenRoutes([]);
|
||||
setHiddenColors([]);
|
||||
});
|
||||
}
|
||||
},
|
||||
{ type: "separator", key: "sep" },
|
||||
...toMenuItems(
|
||||
orderItems(routes, db.settings.getSideBarOrder("routes")),
|
||||
hiddenRoutes,
|
||||
@@ -180,7 +199,7 @@ function NavigationMenu(props: NavigationMenuProps) {
|
||||
.setSideBarHiddenItems("routes", ids)
|
||||
.then(() => setHiddenRoutes(ids))
|
||||
),
|
||||
{ type: "separator", key: "sep" },
|
||||
{ type: "separator", key: "sep", isHidden: colors.length <= 0 },
|
||||
...toMenuItems(
|
||||
orderItems(colors, db.settings.getSideBarOrder("colors")),
|
||||
hiddenColors,
|
||||
@@ -225,6 +244,10 @@ function NavigationMenu(props: NavigationMenuProps) {
|
||||
justifyContent: "space-between"
|
||||
}}
|
||||
px={0}
|
||||
onContextMenu={async (e) => {
|
||||
e.preventDefault();
|
||||
Menu.openMenu(await getSidebarItems());
|
||||
}}
|
||||
>
|
||||
<FlexScrollContainer
|
||||
style={{
|
||||
|
||||
@@ -116,6 +116,7 @@ function NavigationItem(
|
||||
onContextMenu={(e) => {
|
||||
if (!menuItems) return;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
Menu.openMenu(menuItems);
|
||||
}}
|
||||
onClick={() => {
|
||||
|
||||
@@ -96,6 +96,7 @@ import { Context } from "../list-container/types";
|
||||
import { SchemeColors } from "@notesnook/theme";
|
||||
import { writeToClipboard } from "../../utils/clipboard";
|
||||
import Vault from "../../common/vault";
|
||||
import { isUserPremium } from "../../hooks/use-is-user-premium";
|
||||
|
||||
type NoteProps = NoteResolvedData & {
|
||||
item: NoteType;
|
||||
@@ -335,6 +336,7 @@ const menuItems: (
|
||||
ids?: string[],
|
||||
context?: { color?: Color; locked?: boolean }
|
||||
) => MenuItem[] = (note, ids = [], context) => {
|
||||
const isPro = isUserPremium();
|
||||
// const isSynced = db.notes.note(note.id)?.synced();
|
||||
|
||||
return [
|
||||
@@ -371,6 +373,7 @@ const menuItems: (
|
||||
//isDisabled: !isSynced,
|
||||
title: "Lock",
|
||||
isChecked: context?.locked,
|
||||
isDisabled: !isPro,
|
||||
icon: Lock.path,
|
||||
onClick: async () => {
|
||||
const { unlock, lock } = store.get();
|
||||
@@ -380,8 +383,7 @@ const menuItems: (
|
||||
} else if (await unlock(note.id)) {
|
||||
showToast("success", "Note unlocked successfully!");
|
||||
}
|
||||
},
|
||||
isPro: true
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "button",
|
||||
@@ -458,11 +460,12 @@ const menuItems: (
|
||||
title: format.title,
|
||||
tooltip: `Export as ${format.title} - ${format.subtitle}`,
|
||||
icon: format.icon.path,
|
||||
isDisabled: format.type === "pdf" && ids.length > 1,
|
||||
isDisabled:
|
||||
(format.type !== "txt" && !isPro) ||
|
||||
(format.type === "pdf" && ids.length > 1),
|
||||
// ? "Multiple notes cannot be exported as PDF."
|
||||
// : false,
|
||||
multiSelect: true,
|
||||
isPro: format.type !== "txt",
|
||||
onClick: async () => {
|
||||
if (ids.length === 1) {
|
||||
return await exportNote(note, {
|
||||
@@ -477,8 +480,7 @@ const menuItems: (
|
||||
}
|
||||
}))
|
||||
},
|
||||
multiSelect: true,
|
||||
isPro: true
|
||||
multiSelect: true
|
||||
},
|
||||
{
|
||||
type: "button",
|
||||
@@ -650,7 +652,8 @@ function notebooksMenuItems(ids: string[]): MenuItem[] {
|
||||
}
|
||||
});
|
||||
|
||||
menuItems.push({ key: "sep3", type: "separator" });
|
||||
if (notebookShortcuts.size > 0 || notebooks.size > 0)
|
||||
menuItems.push({ key: "sep3", type: "separator" });
|
||||
|
||||
if (notebookShortcuts.size > 0) {
|
||||
notebookShortcuts.forEach((notebook) => {
|
||||
|
||||
@@ -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";
|
||||
@@ -49,20 +49,18 @@ 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
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ function Notice() {
|
||||
if (!notices) return null;
|
||||
return notices.slice().sort((a, b) => a.priority - b.priority)[0];
|
||||
}, [notices]);
|
||||
|
||||
if (!notice) return null;
|
||||
const NoticeData = NoticesData[notice.type];
|
||||
return (
|
||||
@@ -39,8 +40,8 @@ function Notice() {
|
||||
cursor: "pointer",
|
||||
borderRadius: "default",
|
||||
":hover": { bg: "hover" },
|
||||
alignItems: "center",
|
||||
minWidth: 250
|
||||
alignItems: "center"
|
||||
// minWidth: 250
|
||||
}}
|
||||
p={1}
|
||||
onClick={() => NoticeData.action()}
|
||||
@@ -52,11 +53,30 @@ function Notice() {
|
||||
color="accent"
|
||||
sx={{ bg: "shade", mr: 2, p: 2, borderRadius: 80 }}
|
||||
/>
|
||||
<Flex variant="columnCenter" sx={{ alignItems: "flex-start" }}>
|
||||
<Text variant="body" sx={{ fontSize: "body" }}>
|
||||
<Flex
|
||||
variant="columnCenter"
|
||||
sx={{ alignItems: "flex-start", overflow: "hidden" }}
|
||||
>
|
||||
<Text
|
||||
variant="body"
|
||||
sx={{
|
||||
fontSize: "body",
|
||||
whiteSpace: "nowrap",
|
||||
overflow: "hidden",
|
||||
textOverflow: "ellipsis"
|
||||
}}
|
||||
>
|
||||
{NoticeData.title}
|
||||
</Text>
|
||||
<Text variant="subBody" sx={{ display: "block" }}>
|
||||
<Text
|
||||
variant="subBody"
|
||||
sx={{
|
||||
display: "block",
|
||||
whiteSpace: "nowrap",
|
||||
overflow: "hidden",
|
||||
textOverflow: "ellipsis"
|
||||
}}
|
||||
>
|
||||
{NoticeData.subtitle}
|
||||
</Text>
|
||||
</Flex>
|
||||
|
||||
@@ -239,6 +239,10 @@ export function PdfPreview(props: PdfPreviewProps) {
|
||||
onZoom={(e) => {
|
||||
if (hash) setPDFConfig(hash, { scale: e.scale });
|
||||
}}
|
||||
transformGetDocumentParams={(options) => {
|
||||
(options as any).isEvalSupported = false;
|
||||
return options;
|
||||
}}
|
||||
// onDocumentAskPassword={(e) => {
|
||||
// e.verifyPassword("failed");
|
||||
// }}
|
||||
|
||||
@@ -57,7 +57,7 @@ function Placeholder(props: PlaceholderProps) {
|
||||
</Flex>
|
||||
|
||||
<Text variant="subBody" sx={{ fontSize: "body", mt: 1 }}>
|
||||
{toTitleCase(syncStatus.type || "syncing")}ing {syncStatus.progress}{" "}
|
||||
{toTitleCase(syncStatus.type || "sync")}ing {syncStatus.progress}{" "}
|
||||
items
|
||||
</Text>
|
||||
</Flex>
|
||||
|
||||
@@ -61,11 +61,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,7 +74,7 @@ function Reminder(props: ReminderProps) {
|
||||
title={reminder.title}
|
||||
body={reminder.description}
|
||||
isDisabled={reminder.disabled}
|
||||
isSimple={simplified}
|
||||
isCompact={compact}
|
||||
onClick={() => showEditReminderDialog(reminder.id)}
|
||||
footer={
|
||||
<Flex
|
||||
|
||||
@@ -23,9 +23,9 @@ import { Cross, Check, Loading } from "../../components/icons";
|
||||
import { useStore as useUserStore } from "../../stores/user-store";
|
||||
import { useStore as useThemeStore } from "../../stores/theme-store";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { ReactComponent as Rocket } from "../../assets/rocket.svg";
|
||||
import { ReactComponent as WorkAnywhere } from "../../assets/workanywhere.svg";
|
||||
import { ReactComponent as WorkLate } from "../../assets/worklate.svg";
|
||||
import Rocket from "../../assets/rocket.svg?react";
|
||||
import WorkAnywhere from "../../assets/workanywhere.svg?react";
|
||||
import WorkLate from "../../assets/worklate.svg?react";
|
||||
import Field from "../../components/field";
|
||||
import { hardNavigate } from "../../navigation";
|
||||
import { Features } from "./features";
|
||||
|
||||
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { Text, Flex, Button } from "@theme-ui/components";
|
||||
import { Loading } from "../../components/icons";
|
||||
import { ReactComponent as Nomad } from "../../assets/nomad.svg";
|
||||
import Nomad from "../../assets/nomad.svg?react";
|
||||
import { Period, Plan } from "./types";
|
||||
import { PLAN_METADATA, usePlans } from "./plans";
|
||||
import { useEffect } from "react";
|
||||
|
||||
@@ -89,6 +89,8 @@ const features: Record<FeatureKeys, Feature> = {
|
||||
)
|
||||
}
|
||||
]
|
||||
: IS_DESKTOP_APP
|
||||
? []
|
||||
: [],
|
||||
cta: {
|
||||
title: "Got it",
|
||||
|
||||
@@ -46,8 +46,8 @@ import { phone } from "phone";
|
||||
import { db } from "../../common/db";
|
||||
import FileSaver from "file-saver";
|
||||
import { writeText } from "clipboard-polyfill";
|
||||
import { ReactComponent as MFA } from "../../assets/mfa.svg";
|
||||
import { ReactComponent as Fallback2FA } from "../../assets/fallback2fa.svg";
|
||||
import MFA from "../../assets/mfa.svg?react";
|
||||
import Fallback2FA from "../../assets/fallback2fa.svg?react";
|
||||
import {
|
||||
Authenticator,
|
||||
StepComponent,
|
||||
|
||||
@@ -27,11 +27,11 @@ import {
|
||||
Github,
|
||||
Loading
|
||||
} from "../components/icons";
|
||||
import { ReactComponent as E2E } from "../assets/e2e.svg";
|
||||
import { ReactComponent as Note } from "../assets/note2.svg";
|
||||
import { ReactComponent as Nomad } from "../assets/nomad.svg";
|
||||
import { ReactComponent as WorkAnywhere } from "../assets/workanywhere.svg";
|
||||
import { ReactComponent as Friends } from "../assets/cause.svg";
|
||||
import E2E from "../assets/e2e.svg?react";
|
||||
import Note from "../assets/note2.svg?react";
|
||||
import Nomad from "../assets/nomad.svg?react";
|
||||
import WorkAnywhere from "../assets/workanywhere.svg?react";
|
||||
import Friends from "../assets/cause.svg?react";
|
||||
import LightUI from "../assets/light1.png";
|
||||
import DarkUI from "../assets/dark1.png";
|
||||
import GooglePlay from "../assets/play.png";
|
||||
|
||||
@@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { SettingsGroup } from "./types";
|
||||
import { useStore as useSettingStore } from "../../stores/setting-store";
|
||||
import { showToast } from "../../utils/toast";
|
||||
import { desktop } from "../../common/desktop-bridge";
|
||||
|
||||
export const DesktopIntegrationSettings: SettingsGroup[] = [
|
||||
{
|
||||
@@ -126,6 +128,42 @@ export const DesktopIntegrationSettings: SettingsGroup[] = [
|
||||
})
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: "use-native-titlebar",
|
||||
title: "Use native titlebar",
|
||||
description:
|
||||
"Use native OS titlebar instead of replacing it with a custom one. Requires app restart for changes to take effect.",
|
||||
onStateChange: (listener) =>
|
||||
useSettingStore.subscribe(
|
||||
(s) => s.desktopIntegrationSettings,
|
||||
listener
|
||||
),
|
||||
components: [
|
||||
{
|
||||
type: "toggle",
|
||||
isToggled: () =>
|
||||
!!useSettingStore.getState().desktopIntegrationSettings
|
||||
?.nativeTitlebar,
|
||||
toggle: () => {
|
||||
useSettingStore.getState().setDesktopIntegration({
|
||||
nativeTitlebar:
|
||||
!useSettingStore.getState().desktopIntegrationSettings
|
||||
?.nativeTitlebar
|
||||
});
|
||||
showToast(
|
||||
"success",
|
||||
"Restart the app for changes to take effect.",
|
||||
[
|
||||
{
|
||||
text: "Restart now",
|
||||
onClick: () => desktop?.integration.restart.query()
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -135,7 +135,8 @@ export const ProfileSettings: SettingsGroup[] = [
|
||||
{
|
||||
key: "logout",
|
||||
title: "Logout",
|
||||
description: "Logging out will clear all data on this device.",
|
||||
description:
|
||||
"Logging out will clear all data stored on THIS DEVICE. Make sure you have synced all your changes before logging out.",
|
||||
keywords: [],
|
||||
components: [
|
||||
{
|
||||
|
||||
1
apps/web/src/global.d.ts
vendored
1
apps/web/src/global.d.ts
vendored
@@ -32,6 +32,7 @@ declare global {
|
||||
var IS_BETA: boolean;
|
||||
var APP_TITLE: string;
|
||||
var IS_THEME_BUILDER: boolean;
|
||||
var hasNativeTitlebar: boolean;
|
||||
|
||||
interface AuthenticationExtensionsClientInputs {
|
||||
prf?: {
|
||||
|
||||
@@ -17,50 +17,12 @@ 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 } from "react";
|
||||
import { initializeDatabase } from "../common/db";
|
||||
import { useErrorBoundary } from "react-error-boundary";
|
||||
import "../utils/analytics";
|
||||
import "../app.css";
|
||||
|
||||
// if (import.meta.env.PROD) {
|
||||
// console.log = () => {};
|
||||
// }
|
||||
|
||||
const memory = {
|
||||
isDatabaseLoaded: false
|
||||
};
|
||||
export default function useDatabase(persistence: "db" | "memory" = "db") {
|
||||
const [isAppLoaded, setIsAppLoaded] = useState(memory.isDatabaseLoaded);
|
||||
const { showBoundary } = useErrorBoundary();
|
||||
|
||||
useEffect(() => {
|
||||
loadDatabase(persistence)
|
||||
.then(() => setIsAppLoaded(true))
|
||||
.catch((e) => showBoundary(e));
|
||||
|
||||
function handleError(e: ErrorEvent) {
|
||||
const error = new Error(e.message);
|
||||
error.stack = `${e.filename}:${e.lineno}:${e.colno}`;
|
||||
showBoundary(e.error || error);
|
||||
}
|
||||
function handleUnhandledRejection(e: PromiseRejectionEvent) {
|
||||
showBoundary(e.reason);
|
||||
}
|
||||
window.addEventListener("unhandledrejection", handleUnhandledRejection);
|
||||
window.addEventListener("error", handleError);
|
||||
return () => {
|
||||
window.removeEventListener(
|
||||
"unhandledrejection",
|
||||
handleUnhandledRejection
|
||||
);
|
||||
window.removeEventListener("error", handleError);
|
||||
};
|
||||
}, [persistence]);
|
||||
|
||||
return [isAppLoaded];
|
||||
}
|
||||
|
||||
export async function loadDatabase(persistence: "db" | "memory" = "db") {
|
||||
if (memory.isDatabaseLoaded) return;
|
||||
|
||||
|
||||
@@ -62,10 +62,6 @@ export function useKeyboardListNavigation(
|
||||
: DIRECTION.UP;
|
||||
}, []);
|
||||
|
||||
const onFocus = useCallback((itemIndex: number) => {
|
||||
cursor.current = itemIndex;
|
||||
}, []);
|
||||
|
||||
const resetSelection = useCallback(() => {
|
||||
reset();
|
||||
anchor.current = -1;
|
||||
@@ -79,8 +75,9 @@ export function useKeyboardListNavigation(
|
||||
return true;
|
||||
}, [open, resetSelection, select]);
|
||||
|
||||
const onMouseDown = useCallback(
|
||||
const onMouseUp = useCallback(
|
||||
(e: MouseEvent, itemIndex: number) => {
|
||||
if (e.button !== 0) return;
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
select(itemIndex, true);
|
||||
} else if (e.shiftKey) {
|
||||
@@ -94,11 +91,12 @@ export function useKeyboardListNavigation(
|
||||
indices.push(i);
|
||||
}
|
||||
bulkSelect(indices);
|
||||
focusItemAt(endIndex);
|
||||
} else if (e.button === 0) {
|
||||
focusItemAt(itemIndex);
|
||||
} else {
|
||||
resetSelection();
|
||||
select(itemIndex);
|
||||
}
|
||||
cursor.current = itemIndex;
|
||||
},
|
||||
[select, resetSelection, bulkSelect, skip, focusItemAt]
|
||||
);
|
||||
@@ -117,6 +115,7 @@ export function useKeyboardListNavigation(
|
||||
while (skip && skip(nextIndex))
|
||||
nextIndex = moveUpCyclic(nextIndex, max);
|
||||
focusItemAt(nextIndex);
|
||||
cursor.current = nextIndex;
|
||||
return true;
|
||||
},
|
||||
ArrowDown: () => {
|
||||
@@ -126,6 +125,7 @@ export function useKeyboardListNavigation(
|
||||
while (skip && skip(nextIndex))
|
||||
nextIndex = moveDownCyclic(nextIndex, max);
|
||||
focusItemAt(nextIndex);
|
||||
cursor.current = nextIndex;
|
||||
return true;
|
||||
},
|
||||
"Mod-a": () => {
|
||||
@@ -148,9 +148,11 @@ export function useKeyboardListNavigation(
|
||||
if (nextIndex === cursor.current) return false;
|
||||
|
||||
focusItemAt(nextIndex);
|
||||
cursor.current = nextIndex;
|
||||
if (direction() === DIRECTION.UP) {
|
||||
select(nextIndex);
|
||||
}
|
||||
e.preventDefault();
|
||||
return false;
|
||||
},
|
||||
"Shift-ArrowDown": () => {
|
||||
@@ -168,9 +170,11 @@ export function useKeyboardListNavigation(
|
||||
if (nextIndex === cursor.current) return false;
|
||||
|
||||
focusItemAt(nextIndex);
|
||||
cursor.current = nextIndex;
|
||||
if (direction() === DIRECTION.DOWN) {
|
||||
select(nextIndex);
|
||||
}
|
||||
e.preventDefault();
|
||||
return false;
|
||||
},
|
||||
Escape: () => {
|
||||
@@ -185,13 +189,14 @@ export function useKeyboardListNavigation(
|
||||
resetSelection,
|
||||
skip,
|
||||
focusItemAt,
|
||||
select,
|
||||
bulkSelect,
|
||||
direction,
|
||||
select,
|
||||
deselect
|
||||
]
|
||||
);
|
||||
|
||||
return { onFocus, onMouseDown, onKeyDown };
|
||||
return { onMouseUp, onKeyDown };
|
||||
}
|
||||
|
||||
const moveDownCyclic = (i: number, max: number) => (i < max ? ++i : 0);
|
||||
|
||||
@@ -91,7 +91,6 @@ export default function useSlider(
|
||||
const slideToIndex = useCallback(
|
||||
(index: number) => {
|
||||
if (!slides || !ref.current || index >= slides.length) return;
|
||||
console.log(slides[index].offset, slides[index].width);
|
||||
const slider = ref.current;
|
||||
setTimeout(() => {
|
||||
slider.scrollTo({
|
||||
|
||||
@@ -50,6 +50,9 @@ export function useWindowControls() {
|
||||
isMaximized,
|
||||
isFullscreen,
|
||||
hasNativeWindowControls:
|
||||
!IS_DESKTOP_APP || getPlatform() === "darwin" || getPlatform() === "win32"
|
||||
!IS_DESKTOP_APP ||
|
||||
hasNativeTitlebar ||
|
||||
getPlatform() === "darwin" ||
|
||||
getPlatform() === "win32"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -38,28 +38,8 @@
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<title>Notesnook</title>
|
||||
|
||||
<style id="theme-colors">
|
||||
#splash {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<script type="module">
|
||||
import { themeToCSS } from "@notesnook/theme";
|
||||
|
||||
const colorScheme = JSON.parse(
|
||||
window.localStorage.getItem("colorScheme") || '"light"'
|
||||
);
|
||||
const root = document.querySelector("html");
|
||||
if (root) root.setAttribute("data-theme", colorScheme);
|
||||
|
||||
const theme = window.localStorage.getItem(`theme:${colorScheme}`);
|
||||
if (theme) {
|
||||
const css = themeToCSS(JSON.parse(theme));
|
||||
const stylesheet = document.getElementById("theme-colors");
|
||||
if (stylesheet) stylesheet.innerHTML = css;
|
||||
}
|
||||
</script>
|
||||
<script type="module" src="/index.tsx"></script>
|
||||
<style id="theme-colors"></style>
|
||||
<script type="module" src="./index.ts"></script>
|
||||
<style>
|
||||
html {
|
||||
overscroll-behavior: none;
|
||||
|
||||
68
apps/web/src/index.ts
Normal file
68
apps/web/src/index.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
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 "./app.css";
|
||||
import { AppEventManager, AppEvents } from "./common/app-events";
|
||||
import { register } from "./service-worker-registration";
|
||||
import { getServiceWorkerVersion } from "./utils/version";
|
||||
import { register as registerStreamSaver } from "./utils/stream-saver/mitm";
|
||||
import { ThemeDark, ThemeLight, themeToCSS } from "@notesnook/theme";
|
||||
import Config from "./utils/config";
|
||||
|
||||
const colorScheme = JSON.parse(
|
||||
window.localStorage.getItem("colorScheme") || '"light"'
|
||||
);
|
||||
const root = document.querySelector("html");
|
||||
if (root) root.setAttribute("data-theme", colorScheme);
|
||||
|
||||
const theme =
|
||||
colorScheme === "dark"
|
||||
? Config.get("theme:dark", ThemeDark)
|
||||
: Config.get("theme:light", ThemeLight);
|
||||
const stylesheet = document.getElementById("theme-colors");
|
||||
if (theme) {
|
||||
const css = themeToCSS(theme);
|
||||
if (stylesheet) stylesheet.innerHTML = css;
|
||||
} else stylesheet?.remove();
|
||||
|
||||
if (!IS_DESKTOP_APP && !IS_TESTING) {
|
||||
// logger.info("Initializing service worker...");
|
||||
|
||||
// If you want your app to work offline and load faster, you can change
|
||||
// unregister() to register() below. Note this comes with some pitfalls.
|
||||
// Learn more about service workers: https://bit.ly/CRA-PWA
|
||||
register({
|
||||
onUpdate: async (registration: ServiceWorkerRegistration) => {
|
||||
if (!registration.waiting) return;
|
||||
const { formatted } = await getServiceWorkerVersion(registration.waiting);
|
||||
AppEventManager.publish(AppEvents.updateDownloadCompleted, {
|
||||
version: formatted
|
||||
});
|
||||
},
|
||||
onSuccess() {
|
||||
registerStreamSaver();
|
||||
}
|
||||
});
|
||||
|
||||
// window.addEventListener("beforeinstallprompt", () => showInstallNotice());
|
||||
}
|
||||
|
||||
import("./root").then(({ startApp }) => {
|
||||
startApp();
|
||||
});
|
||||
@@ -1,103 +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 { createRoot } from "react-dom/client";
|
||||
import { Routes, init } from "./bootstrap";
|
||||
import { logger } from "./utils/logger";
|
||||
import { AppEventManager, AppEvents } from "./common/app-events";
|
||||
import { BaseThemeProvider } from "./components/theme-provider";
|
||||
import { register } from "./utils/stream-saver/mitm";
|
||||
import { getServiceWorkerVersion } from "./utils/version";
|
||||
import { ErrorBoundary, ErrorComponent } from "./components/error-boundary";
|
||||
import { TitleBar } from "./components/title-bar";
|
||||
|
||||
renderApp();
|
||||
|
||||
async function renderApp() {
|
||||
const rootElement = document.getElementById("root");
|
||||
if (!rootElement) return;
|
||||
const root = createRoot(rootElement);
|
||||
|
||||
try {
|
||||
const { component, props, path } = await init();
|
||||
|
||||
const { useKeyStore } = await import("./interfaces/key-store");
|
||||
await useKeyStore.getState().init();
|
||||
|
||||
if (serviceWorkerWhitelist.includes(path)) await initializeServiceWorker();
|
||||
|
||||
const { default: Component } = await component();
|
||||
const { default: AppLock } = await import("./views/app-lock");
|
||||
|
||||
root.render(
|
||||
<>
|
||||
{IS_DESKTOP_APP ? <TitleBar /> : null}
|
||||
<ErrorBoundary>
|
||||
<BaseThemeProvider
|
||||
onRender={() => document.getElementById("splash")?.remove()}
|
||||
sx={{ bg: "background", flex: 1, overflow: "hidden" }}
|
||||
>
|
||||
<AppLock>
|
||||
<Component route={props?.route || "login:email"} />
|
||||
</AppLock>
|
||||
</BaseThemeProvider>
|
||||
</ErrorBoundary>
|
||||
</>
|
||||
);
|
||||
} catch (e) {
|
||||
root.render(
|
||||
<>
|
||||
{IS_DESKTOP_APP ? <TitleBar /> : null}
|
||||
<ErrorComponent
|
||||
error={e}
|
||||
resetErrorBoundary={() => window.location.reload()}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const serviceWorkerWhitelist: Routes[] = ["default"];
|
||||
async function initializeServiceWorker() {
|
||||
if (!IS_DESKTOP_APP && !IS_TESTING) {
|
||||
logger.info("Initializing service worker...");
|
||||
const serviceWorker = await import("./service-worker-registration");
|
||||
|
||||
// If you want your app to work offline and load faster, you can change
|
||||
// unregister() to register() below. Note this comes with some pitfalls.
|
||||
// Learn more about service workers: https://bit.ly/CRA-PWA
|
||||
serviceWorker.register({
|
||||
onUpdate: async (registration: ServiceWorkerRegistration) => {
|
||||
if (!registration.waiting) return;
|
||||
const { formatted } = await getServiceWorkerVersion(
|
||||
registration.waiting
|
||||
);
|
||||
AppEventManager.publish(AppEvents.updateDownloadCompleted, {
|
||||
version: formatted
|
||||
});
|
||||
},
|
||||
onSuccess() {
|
||||
register();
|
||||
}
|
||||
});
|
||||
// window.addEventListener("beforeinstallprompt", () => showInstallNotice());
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.hot) import.meta.hot.accept();
|
||||
@@ -296,12 +296,15 @@ async function singlePartUploadFile(
|
||||
console.log("Streaming file upload!");
|
||||
const { url, headers, signal } = requestOptions;
|
||||
|
||||
const uploadUrl = await fetch(url, {
|
||||
const uploadUrl: string | { error?: string } = await fetch(url, {
|
||||
method: "PUT",
|
||||
headers,
|
||||
signal
|
||||
}).then((res) => (res.ok ? res.text() : null));
|
||||
if (!uploadUrl) throw new Error("Unable to resolve attachment upload url.");
|
||||
}).then((res) => (res.ok ? res.text() : res.json()));
|
||||
if (typeof uploadUrl !== "string")
|
||||
throw new Error(
|
||||
uploadUrl.error || "Unable to resolve attachment upload url."
|
||||
);
|
||||
|
||||
const response = await axios.request({
|
||||
url: uploadUrl,
|
||||
@@ -354,6 +357,9 @@ async function multiPartUploadFile(
|
||||
throw new WrappedError("Could not initiate multi-part upload.", e);
|
||||
});
|
||||
|
||||
if (initiateMultiPartUpload.data.error)
|
||||
throw new Error(initiateMultiPartUpload.data.error);
|
||||
|
||||
uploadId = initiateMultiPartUpload.data.uploadId;
|
||||
const { parts } = initiateMultiPartUpload.data;
|
||||
|
||||
|
||||
@@ -123,8 +123,8 @@ const decoder = new TextDecoder();
|
||||
*/
|
||||
|
||||
class KeyStore extends BaseStore<KeyStore> {
|
||||
#secretStore: IKVStore;
|
||||
#metadataStore: IKVStore;
|
||||
#secretStore!: IKVStore;
|
||||
#metadataStore!: IKVStore;
|
||||
#keyId = "key";
|
||||
#wrappingKeyId = "wrappingKey";
|
||||
#key?: CryptoKey;
|
||||
@@ -134,25 +134,25 @@ class KeyStore extends BaseStore<KeyStore> {
|
||||
isLocked = false;
|
||||
|
||||
constructor(
|
||||
dbName: string,
|
||||
private readonly dbName: string,
|
||||
setState: SetState<KeyStore>,
|
||||
get: GetState<KeyStore>
|
||||
) {
|
||||
super(setState, get);
|
||||
|
||||
this.#metadataStore =
|
||||
isFeatureSupported("indexedDB") && isFeatureSupported("clonableCryptoKey")
|
||||
? new IndexedDBKVStore(`${dbName}-metadata`, "metadata")
|
||||
: new MemoryKVStore();
|
||||
this.#secretStore =
|
||||
isFeatureSupported("indexedDB") && isFeatureSupported("clonableCryptoKey")
|
||||
? new IndexedDBKVStore(`${dbName}-secrets`, "secrets")
|
||||
: new MemoryKVStore();
|
||||
}
|
||||
|
||||
activeCredentials = () => this.get().credentials.filter((c) => c.active);
|
||||
|
||||
init = async () => {
|
||||
this.#metadataStore =
|
||||
isFeatureSupported("indexedDB") && isFeatureSupported("clonableCryptoKey")
|
||||
? new IndexedDBKVStore(`${this.dbName}-metadata`, "metadata")
|
||||
: new MemoryKVStore();
|
||||
this.#secretStore =
|
||||
isFeatureSupported("indexedDB") && isFeatureSupported("clonableCryptoKey")
|
||||
? new IndexedDBKVStore(`${this.dbName}-secrets`, "secrets")
|
||||
: new MemoryKVStore();
|
||||
|
||||
const credentials = await this.getCredentials();
|
||||
const secrets = Object.fromEntries(
|
||||
await this.#secretStore.entries<EncryptedData>()
|
||||
|
||||
@@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import { useState } from "react";
|
||||
import EventManager from "@notesnook/core/dist/utils/event-manager";
|
||||
import Config from "../utils/config";
|
||||
import { HashRoute } from "./hash-routes";
|
||||
import { ReplaceParametersInPath } from "./types";
|
||||
import type { HashRoute } from "./hash-routes";
|
||||
import type { ReplaceParametersInPath } from "./types";
|
||||
|
||||
export function navigate(
|
||||
url: string,
|
||||
|
||||
138
apps/web/src/root.tsx
Normal file
138
apps/web/src/root.tsx
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
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 { createRoot } from "react-dom/client";
|
||||
import { init, Routes } from "./bootstrap";
|
||||
import { BaseThemeProvider } from "./components/theme-provider";
|
||||
import {
|
||||
ErrorBoundary,
|
||||
ErrorComponent,
|
||||
GlobalErrorHandler
|
||||
} from "./components/error-boundary";
|
||||
import { TitleBar } from "./components/title-bar";
|
||||
import { desktop } from "./common/desktop-bridge";
|
||||
import { useKeyStore } from "./interfaces/key-store";
|
||||
import Config from "./utils/config";
|
||||
import { usePromise } from "@notesnook/common";
|
||||
import { AuthProps } from "./views/auth";
|
||||
|
||||
export async function startApp() {
|
||||
const rootElement = document.getElementById("root");
|
||||
if (!rootElement) return;
|
||||
const root = createRoot(rootElement);
|
||||
|
||||
window.hasNativeTitlebar =
|
||||
!IS_DESKTOP_APP ||
|
||||
!!(await desktop?.integration.desktopIntegration
|
||||
.query()
|
||||
?.then((s) => s.nativeTitlebar));
|
||||
|
||||
try {
|
||||
const { component, props, path } = await init();
|
||||
|
||||
await useKeyStore.getState().init();
|
||||
|
||||
const { default: AppLock } = await import("./views/app-lock");
|
||||
|
||||
root.render(
|
||||
<>
|
||||
{hasNativeTitlebar ? null : <TitleBar />}
|
||||
<ErrorBoundary>
|
||||
<GlobalErrorHandler>
|
||||
<BaseThemeProvider
|
||||
onRender={() => document.getElementById("splash")?.remove()}
|
||||
sx={{ bg: "background", flex: 1, overflow: "hidden" }}
|
||||
>
|
||||
<AppLock>
|
||||
<RouteWrapper
|
||||
component={component}
|
||||
path={path}
|
||||
routeProps={props}
|
||||
/>
|
||||
</AppLock>
|
||||
</BaseThemeProvider>
|
||||
</GlobalErrorHandler>
|
||||
</ErrorBoundary>
|
||||
</>
|
||||
);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
root.render(
|
||||
<>
|
||||
{hasNativeTitlebar ? null : <TitleBar />}
|
||||
<ErrorComponent
|
||||
error={e}
|
||||
resetErrorBoundary={() => window.location.reload()}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function RouteWrapper(props: {
|
||||
component: () => Promise<{
|
||||
default: (props: AuthProps) => JSX.Element;
|
||||
}>;
|
||||
path: Routes;
|
||||
routeProps: AuthProps | null;
|
||||
}) {
|
||||
const { component, path, routeProps } = props;
|
||||
const result = usePromise(async () => {
|
||||
await import("./hooks/use-database").then(({ loadDatabase }) =>
|
||||
loadDatabase(
|
||||
path !== "/sessionexpired" || Config.get("sessionExpired", false)
|
||||
? "db"
|
||||
: "memory"
|
||||
)
|
||||
);
|
||||
|
||||
const { default: Component } = await component();
|
||||
return Component;
|
||||
}, [component, path]);
|
||||
|
||||
if (result.status === "rejected") {
|
||||
throw result.reason instanceof Error
|
||||
? result.reason
|
||||
: new Error(result.reason);
|
||||
}
|
||||
if (result.status === "pending")
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
backgroundColor: "var(--background)",
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
alignItems: "center"
|
||||
}}
|
||||
>
|
||||
<svg style={{ height: 120 }}>
|
||||
<use href="#themed-logo" />
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
return <result.value route={routeProps?.route || "login:email"} />;
|
||||
}
|
||||
|
||||
if (import.meta.hot) import.meta.hot.accept();
|
||||
@@ -21,7 +21,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { clientsClaim } from "workbox-core";
|
||||
import { ExpirationPlugin } from "workbox-expiration";
|
||||
import { precacheAndRoute, createHandlerBoundToURL } from "workbox-precaching";
|
||||
import {
|
||||
precacheAndRoute,
|
||||
createHandlerBoundToURL,
|
||||
cleanupOutdatedCaches
|
||||
} from "workbox-precaching";
|
||||
import { registerRoute } from "workbox-routing";
|
||||
import { StaleWhileRevalidate } from "workbox-strategies";
|
||||
|
||||
@@ -29,15 +33,8 @@ declare var self: ServiceWorkerGlobalScope & typeof globalThis;
|
||||
|
||||
clientsClaim();
|
||||
|
||||
const precacheRoutes = self.__WB_MANIFEST;
|
||||
const filters = [/KaTeX/i, /hack/i, /code-lang-/i];
|
||||
precacheAndRoute(
|
||||
precacheRoutes.filter((route) => {
|
||||
return filters.every(
|
||||
(filter) => !filter.test(typeof route === "string" ? route : route.url)
|
||||
);
|
||||
})
|
||||
);
|
||||
cleanupOutdatedCaches();
|
||||
precacheAndRoute(self.__WB_MANIFEST);
|
||||
|
||||
// Set up App Shell-style routing, so that all navigation requests
|
||||
// are fulfilled with your index.html shell. Learn more at
|
||||
|
||||
@@ -198,10 +198,9 @@ class AppStore extends BaseStore<AppStore> {
|
||||
};
|
||||
|
||||
toggleSideMenu = (toggleState: boolean) => {
|
||||
console.log("toggling side menu");
|
||||
this.set(
|
||||
(state) =>
|
||||
(state.isSideMenuOpen =
|
||||
toggleState != null ? toggleState : !state.isSideMenuOpen)
|
||||
(state) => (state.isSideMenuOpen = toggleState ?? !state.isSideMenuOpen)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ export type ReadonlyEditorSession = BaseEditorSession & {
|
||||
content?: NoteContent<false>;
|
||||
color?: string;
|
||||
tags?: Tag[];
|
||||
locked?: boolean;
|
||||
};
|
||||
|
||||
export type DeletedEditorSession = BaseEditorSession & {
|
||||
|
||||
@@ -89,6 +89,21 @@ async function processAttachment(
|
||||
attachments[name] = { ...cipherData, key };
|
||||
}
|
||||
|
||||
const colorMap: Record<string, string | undefined> = {
|
||||
default: undefined,
|
||||
teal: "#00897B",
|
||||
red: "#D32F2F",
|
||||
purple: "#7B1FA2",
|
||||
blue: "#1976D2",
|
||||
cerulean: "#03A9F4",
|
||||
pink: "#C2185B",
|
||||
brown: "#795548",
|
||||
gray: "#9E9E9E",
|
||||
green: "#388E3C",
|
||||
orange: "#FFA000",
|
||||
yellow: "#FFC107"
|
||||
};
|
||||
|
||||
async function processNote(entry: ZipEntry, attachments: Record<string, any>) {
|
||||
const note = await fileToJson<Note>(entry);
|
||||
for (const attachment of note.attachments || []) {
|
||||
@@ -121,8 +136,49 @@ async function processNote(entry: ZipEntry, attachments: Record<string, any>) {
|
||||
content: { type: "tiptap", data: note.content?.data },
|
||||
notebooks: []
|
||||
});
|
||||
|
||||
if (!noteId) return;
|
||||
|
||||
for (const tag of note.tags || []) {
|
||||
const tagId =
|
||||
(await db.tags.find(tag))?.id ||
|
||||
(await db.tags.add({
|
||||
title: tag
|
||||
}));
|
||||
|
||||
await db.relations.add(
|
||||
{
|
||||
id: tagId,
|
||||
type: "tag"
|
||||
},
|
||||
{
|
||||
id: noteId,
|
||||
type: "note"
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const colorCode = note.color ? colorMap[note.color] : undefined;
|
||||
if (colorCode) {
|
||||
const colorId =
|
||||
(await db.colors.find(colorCode))?.id ||
|
||||
(await db.colors.add({
|
||||
colorCode: colorCode,
|
||||
title: note.color
|
||||
}));
|
||||
|
||||
await db.relations.add(
|
||||
{
|
||||
id: colorId,
|
||||
type: "color"
|
||||
},
|
||||
{
|
||||
id: noteId,
|
||||
type: "note"
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
for (const nb of notebooks) {
|
||||
const notebookId = await importNotebook(nb).catch(() => undefined);
|
||||
if (!notebookId) continue;
|
||||
|
||||
@@ -31,9 +31,17 @@ import { isFeatureSupported } from "./feature-check";
|
||||
|
||||
let logger: typeof _logger = new NoopLogger();
|
||||
async function initializeLogger() {
|
||||
const multiTab = !!globalThis.SharedWorker && isFeatureSupported("opfs");
|
||||
await initialize(
|
||||
{
|
||||
dialect: (name, init) => createDialect(name, false, init),
|
||||
dialect: (name, init) =>
|
||||
createDialect({
|
||||
name,
|
||||
init,
|
||||
async: !isFeatureSupported("opfs"),
|
||||
multiTab,
|
||||
encrypted: false
|
||||
}),
|
||||
...(IS_DESKTOP_APP || isFeatureSupported("opfs")
|
||||
? { journalMode: "WAL", lockingMode: "exclusive" }
|
||||
: {
|
||||
@@ -44,7 +52,7 @@ async function initializeLogger() {
|
||||
synchronous: "normal",
|
||||
pageSize: 8192,
|
||||
cacheSize: -32000,
|
||||
skipInitialization: !IS_DESKTOP_APP
|
||||
skipInitialization: !IS_DESKTOP_APP && multiTab
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
@@ -20,12 +20,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import React, { useEffect } from "react";
|
||||
import { useStore } from "../stores/note-store";
|
||||
import ListContainer from "../components/list-container";
|
||||
import { hashNavigate } from "../navigation";
|
||||
import useNavigate from "../hooks/use-navigate";
|
||||
import Placeholder from "../components/placeholders";
|
||||
import { useSearch } from "../hooks/use-search";
|
||||
import { db } from "../common/db";
|
||||
import { useEditorStore } from "../stores/editor-store";
|
||||
import { ListLoader } from "../components/loaders/list-loader";
|
||||
|
||||
function Home() {
|
||||
const notes = useStore((store) => store.notes);
|
||||
@@ -60,7 +60,7 @@ function Home() {
|
||||
// })();
|
||||
// }, []);
|
||||
|
||||
if (!notes) return <Placeholder context="notes" />;
|
||||
if (!notes) return <ListLoader />;
|
||||
return (
|
||||
<ListContainer
|
||||
group="home"
|
||||
|
||||
@@ -34,7 +34,6 @@ import { getQueryParams, hardNavigate, makeURL } from "../navigation";
|
||||
import { store as userstore } from "../stores/user-store";
|
||||
import { db } from "../common/db";
|
||||
import Config from "../utils/config";
|
||||
import useDatabase from "../hooks/use-database";
|
||||
import { Loader } from "../components/loader";
|
||||
import { showToast } from "../utils/toast";
|
||||
import AuthContainer from "../components/auth-container";
|
||||
@@ -173,16 +172,13 @@ function Auth(props: AuthProps) {
|
||||
window.history.replaceState({}, "", makeURL(routePaths[route]));
|
||||
}, [route]);
|
||||
|
||||
const [isAppLoaded] = useDatabase();
|
||||
|
||||
useEffect(() => {
|
||||
if (!isAppLoaded) return;
|
||||
db.user.getUser().then((user) => {
|
||||
if (user && authorizedRoutes.includes(route) && !isSessionExpired())
|
||||
return openURL("/");
|
||||
setIsReady(true);
|
||||
});
|
||||
}, [isAppLoaded, route]);
|
||||
}, [route]);
|
||||
|
||||
if (!isReady) return <></>;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import Placeholder from "../components/placeholders";
|
||||
import { useEffect } from "react";
|
||||
import { db } from "../common/db";
|
||||
import { useSearch } from "../hooks/use-search";
|
||||
import { ListLoader } from "../components/loaders/list-loader";
|
||||
|
||||
function Notebooks() {
|
||||
const notebooks = useStore((state) => state.notebooks);
|
||||
@@ -31,12 +32,13 @@ function Notebooks() {
|
||||
const filteredItems = useSearch("notebooks", (query) =>
|
||||
db.lookup.notebooks(query).sorted()
|
||||
);
|
||||
const isCompact = useStore((store) => store.viewMode === "compact");
|
||||
|
||||
useEffect(() => {
|
||||
store.get().refresh();
|
||||
}, []);
|
||||
|
||||
if (!notebooks) return <Placeholder context="notebooks" />;
|
||||
if (!notebooks) return <ListLoader />;
|
||||
return (
|
||||
<>
|
||||
<ListContainer
|
||||
@@ -44,6 +46,7 @@ function Notebooks() {
|
||||
refresh={refresh}
|
||||
items={filteredItems || notebooks}
|
||||
placeholder={<Placeholder context="notebooks" />}
|
||||
compact={isCompact}
|
||||
button={{
|
||||
onClick: () => hashNavigate("/notebooks/create")
|
||||
}}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user