From c88838aa7601b1a59d02a8b50012b7718458688e Mon Sep 17 00:00:00 2001 From: chip Date: Fri, 12 Mar 2021 17:10:19 -0800 Subject: [PATCH] feat: build without proc macros (#1226) Co-authored-by: Lucas Nogueira --- .gitignore | 3 - Cargo.toml | 20 +- cli/core/src/build/rust.rs | 6 +- cli/tauri.js/src/template/index.ts | 23 +- cli/tauri.js/templates/src-tauri/Cargo.toml | 10 +- cli/tauri.js/templates/src-tauri/src/build.rs | 15 +- cli/tauri.js/templates/src-tauri/src/main.rs | 10 +- .../jest/fixtures/app/src-tauri/src/main.rs | 10 +- core/tauri-build/Cargo.toml | 30 + core/tauri-build/src/codegen/context.rs | 134 + core/tauri-build/src/codegen/mod.rs | 1 + core/tauri-build/src/lib.rs | 56 + core/tauri-codegen/Cargo.toml | 20 + core/tauri-codegen/src/context.rs | 69 + core/tauri-codegen/src/embedded_assets.rs | 135 + core/tauri-codegen/src/lib.rs | 80 + {tauri/examples => examples}/api/.gitignore | 0 {tauri/examples => examples}/api/README.md | 0 {tauri/examples => examples}/api/package.json | 4 +- examples/api/public/__tauri.js | 332 ++ examples/api/public/build/bundle.js | 17 + examples/api/public/build/bundle.js.map | 1 + .../api/public/favicon.png | Bin .../api/public/global.css | 0 .../examples => examples}/api/public/icon.png | Bin .../api/public/index.html | 0 .../api/rollup.config.js | 0 .../examples => examples}/api/screenshot.png | Bin .../api/src-tauri/.gitignore | 0 examples/api/src-tauri/Cargo.toml | 17 + examples/api/src-tauri/build.rs | 3 + .../api/src-tauri/icons/128x128.png | Bin .../api/src-tauri/icons/128x128@2x.png | Bin .../api/src-tauri/icons/32x32.png | Bin .../api/src-tauri/icons/Square107x107Logo.png | Bin .../api/src-tauri/icons/Square142x142Logo.png | Bin .../api/src-tauri/icons/Square150x150Logo.png | Bin .../api/src-tauri/icons/Square284x284Logo.png | Bin .../api/src-tauri/icons/Square30x30Logo.png | Bin .../api/src-tauri/icons/Square310x310Logo.png | Bin .../api/src-tauri/icons/Square44x44Logo.png | Bin .../api/src-tauri/icons/Square71x71Logo.png | Bin .../api/src-tauri/icons/Square89x89Logo.png | Bin .../api/src-tauri/icons/StoreLogo.png | Bin .../api/src-tauri/icons/icon.icns | Bin .../api/src-tauri/icons/icon.ico | Bin .../api/src-tauri/icons/icon.png | Bin .../api/src-tauri/src/cmd.rs | 0 .../api/src-tauri/src/main.rs | 10 +- .../api/src-tauri/tauri.conf.json | 0 .../examples => examples}/api/src/App.svelte | 0 .../api/src/components/Cli.svelte | 0 .../api/src/components/Communication.svelte | 0 .../api/src/components/Dialog.svelte | 0 .../api/src/components/FileSystem.svelte | 0 .../api/src/components/Http.svelte | 0 .../api/src/components/Notifications.svelte | 0 .../api/src/components/Shortcuts.svelte | 0 .../api/src/components/Window.svelte | 0 {tauri/examples => examples}/api/src/main.js | 0 {tauri/examples => examples}/api/yarn.lock | 5 +- .../helloworld/package.json | 0 .../helloworld/public/__tauri.js | 0 .../helloworld/public/index.html | 0 .../helloworld/src-tauri/.gitignore | 0 .../helloworld/src-tauri/Cargo.toml | 18 +- examples/helloworld/src-tauri/build.rs | 4 + .../helloworld/src-tauri/icons/128x128.png | Bin .../helloworld/src-tauri/icons/128x128@2x.png | Bin .../helloworld/src-tauri/icons/32x32.png | Bin .../src-tauri/icons/Square107x107Logo.png | Bin .../src-tauri/icons/Square142x142Logo.png | Bin .../src-tauri/icons/Square150x150Logo.png | Bin .../src-tauri/icons/Square284x284Logo.png | Bin .../src-tauri/icons/Square30x30Logo.png | Bin .../src-tauri/icons/Square310x310Logo.png | Bin .../src-tauri/icons/Square44x44Logo.png | Bin .../src-tauri/icons/Square71x71Logo.png | Bin .../src-tauri/icons/Square89x89Logo.png | Bin .../helloworld/src-tauri/icons/StoreLogo.png | Bin .../helloworld/src-tauri/icons/icon.icns | Bin .../helloworld/src-tauri/icons/icon.ico | Bin .../helloworld/src-tauri/icons/icon.png | Bin .../helloworld/src-tauri/src/main.rs | 11 +- .../helloworld/src-tauri/tauri.conf.json | 0 examples/multiwindow/dist/__tauri.js | 332 ++ .../multiwindow/dist/index.html | 0 .../multiwindow/package.json | 0 .../multiwindow/src-tauri/.gitignore | 0 examples/multiwindow/src-tauri/Cargo.toml | 18 + examples/multiwindow/src-tauri/build.rs | 4 + .../multiwindow/src-tauri/icons/128x128.png | Bin .../src-tauri/icons/128x128@2x.png | Bin .../multiwindow/src-tauri/icons/32x32.png | Bin .../src-tauri/icons/Square107x107Logo.png | Bin .../src-tauri/icons/Square142x142Logo.png | Bin .../src-tauri/icons/Square150x150Logo.png | Bin .../src-tauri/icons/Square284x284Logo.png | Bin .../src-tauri/icons/Square30x30Logo.png | Bin .../src-tauri/icons/Square310x310Logo.png | Bin .../src-tauri/icons/Square44x44Logo.png | Bin .../src-tauri/icons/Square71x71Logo.png | Bin .../src-tauri/icons/Square89x89Logo.png | Bin .../multiwindow/src-tauri/icons/StoreLogo.png | Bin .../multiwindow/src-tauri/icons/icon.icns | Bin .../multiwindow/src-tauri/icons/icon.ico | Bin .../multiwindow/src-tauri/icons/icon.png | Bin .../multiwindow/src-tauri/src/main.rs | 11 +- .../multiwindow/src-tauri/tauri.conf.json | 0 .../multiwindow/yarn.lock | 0 tauri-api/Cargo.toml | 1 + tauri-api/src/lib.rs | 7 +- tauri-macros/Cargo.toml | 8 +- tauri-macros/src/context/mod.rs | 72 + tauri-macros/src/error.rs | 74 - tauri-macros/src/expand.rs | 124 - tauri-macros/src/include_dir.rs | 165 - tauri-macros/src/lib.rs | 37 +- tauri-utils/Cargo.toml | 11 +- tauri-utils/src/assets.rs | 125 +- tauri-utils/src/config.rs | 361 +- tauri/Cargo.toml | 8 - tauri/examples/api/src-tauri/Cargo.lock | 3725 ----------------- tauri/examples/api/src-tauri/Cargo.toml | 27 - tauri/examples/api/src-tauri/rustfmt.toml | 14 - tauri/examples/api/src-tauri/src/build.rs | 16 - .../examples/helloworld/src-tauri/Cargo.lock | 3637 ---------------- .../helloworld/src-tauri/rustfmt.toml | 14 - .../helloworld/src-tauri/src/build.rs | 16 - tauri/examples/multiwindow/dist/__tauri.js | 332 -- .../examples/multiwindow/src-tauri/Cargo.lock | 3635 ---------------- .../examples/multiwindow/src-tauri/Cargo.toml | 43 - .../multiwindow/src-tauri/rustfmt.toml | 14 - .../multiwindow/src-tauri/src/build.rs | 16 - tauri/src/app.rs | 36 +- tauri/src/app/utils.rs | 35 +- tauri/src/lib.rs | 11 +- 137 files changed, 1883 insertions(+), 12090 deletions(-) create mode 100644 core/tauri-build/Cargo.toml create mode 100644 core/tauri-build/src/codegen/context.rs create mode 100644 core/tauri-build/src/codegen/mod.rs create mode 100644 core/tauri-build/src/lib.rs create mode 100644 core/tauri-codegen/Cargo.toml create mode 100644 core/tauri-codegen/src/context.rs create mode 100644 core/tauri-codegen/src/embedded_assets.rs create mode 100644 core/tauri-codegen/src/lib.rs rename {tauri/examples => examples}/api/.gitignore (100%) rename {tauri/examples => examples}/api/README.md (100%) rename {tauri/examples => examples}/api/package.json (83%) create mode 100644 examples/api/public/__tauri.js create mode 100644 examples/api/public/build/bundle.js create mode 100644 examples/api/public/build/bundle.js.map rename {tauri/examples => examples}/api/public/favicon.png (100%) rename {tauri/examples => examples}/api/public/global.css (100%) rename {tauri/examples => examples}/api/public/icon.png (100%) rename {tauri/examples => examples}/api/public/index.html (100%) rename {tauri/examples => examples}/api/rollup.config.js (100%) rename {tauri/examples => examples}/api/screenshot.png (100%) rename {tauri/examples => examples}/api/src-tauri/.gitignore (100%) create mode 100644 examples/api/src-tauri/Cargo.toml create mode 100644 examples/api/src-tauri/build.rs rename {tauri/examples => examples}/api/src-tauri/icons/128x128.png (100%) rename {tauri/examples => examples}/api/src-tauri/icons/128x128@2x.png (100%) rename {tauri/examples => examples}/api/src-tauri/icons/32x32.png (100%) rename {tauri/examples => examples}/api/src-tauri/icons/Square107x107Logo.png (100%) rename {tauri/examples => examples}/api/src-tauri/icons/Square142x142Logo.png (100%) rename {tauri/examples => examples}/api/src-tauri/icons/Square150x150Logo.png (100%) rename {tauri/examples => examples}/api/src-tauri/icons/Square284x284Logo.png (100%) rename {tauri/examples => examples}/api/src-tauri/icons/Square30x30Logo.png (100%) rename {tauri/examples => examples}/api/src-tauri/icons/Square310x310Logo.png (100%) rename {tauri/examples => examples}/api/src-tauri/icons/Square44x44Logo.png (100%) rename {tauri/examples => examples}/api/src-tauri/icons/Square71x71Logo.png (100%) rename {tauri/examples => examples}/api/src-tauri/icons/Square89x89Logo.png (100%) rename {tauri/examples => examples}/api/src-tauri/icons/StoreLogo.png (100%) rename {tauri/examples => examples}/api/src-tauri/icons/icon.icns (100%) rename {tauri/examples => examples}/api/src-tauri/icons/icon.ico (100%) rename {tauri/examples => examples}/api/src-tauri/icons/icon.png (100%) rename {tauri/examples => examples}/api/src-tauri/src/cmd.rs (100%) rename {tauri/examples => examples}/api/src-tauri/src/main.rs (87%) rename {tauri/examples => examples}/api/src-tauri/tauri.conf.json (100%) rename {tauri/examples => examples}/api/src/App.svelte (100%) rename {tauri/examples => examples}/api/src/components/Cli.svelte (100%) rename {tauri/examples => examples}/api/src/components/Communication.svelte (100%) rename {tauri/examples => examples}/api/src/components/Dialog.svelte (100%) rename {tauri/examples => examples}/api/src/components/FileSystem.svelte (100%) rename {tauri/examples => examples}/api/src/components/Http.svelte (100%) rename {tauri/examples => examples}/api/src/components/Notifications.svelte (100%) rename {tauri/examples => examples}/api/src/components/Shortcuts.svelte (100%) rename {tauri/examples => examples}/api/src/components/Window.svelte (100%) rename {tauri/examples => examples}/api/src/main.js (100%) rename {tauri/examples => examples}/api/yarn.lock (99%) rename {tauri/examples => examples}/helloworld/package.json (100%) rename {tauri/examples => examples}/helloworld/public/__tauri.js (100%) rename {tauri/examples => examples}/helloworld/public/index.html (100%) rename {tauri/examples => examples}/helloworld/src-tauri/.gitignore (100%) rename {tauri/examples => examples}/helloworld/src-tauri/Cargo.toml (55%) create mode 100644 examples/helloworld/src-tauri/build.rs rename {tauri/examples => examples}/helloworld/src-tauri/icons/128x128.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/128x128@2x.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/32x32.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/Square107x107Logo.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/Square142x142Logo.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/Square150x150Logo.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/Square284x284Logo.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/Square30x30Logo.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/Square310x310Logo.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/Square44x44Logo.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/Square71x71Logo.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/Square89x89Logo.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/StoreLogo.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/icon.icns (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/icon.ico (100%) rename {tauri/examples => examples}/helloworld/src-tauri/icons/icon.png (100%) rename {tauri/examples => examples}/helloworld/src-tauri/src/main.rs (61%) rename {tauri/examples => examples}/helloworld/src-tauri/tauri.conf.json (100%) create mode 100644 examples/multiwindow/dist/__tauri.js rename {tauri/examples => examples}/multiwindow/dist/index.html (100%) rename {tauri/examples => examples}/multiwindow/package.json (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/.gitignore (100%) create mode 100644 examples/multiwindow/src-tauri/Cargo.toml create mode 100644 examples/multiwindow/src-tauri/build.rs rename {tauri/examples => examples}/multiwindow/src-tauri/icons/128x128.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/128x128@2x.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/32x32.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/Square107x107Logo.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/Square142x142Logo.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/Square150x150Logo.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/Square284x284Logo.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/Square30x30Logo.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/Square310x310Logo.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/Square44x44Logo.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/Square71x71Logo.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/Square89x89Logo.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/StoreLogo.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/icon.icns (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/icon.ico (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/icons/icon.png (100%) rename {tauri/examples => examples}/multiwindow/src-tauri/src/main.rs (82%) rename {tauri/examples => examples}/multiwindow/src-tauri/tauri.conf.json (100%) rename {tauri/examples => examples}/multiwindow/yarn.lock (100%) create mode 100644 tauri-macros/src/context/mod.rs delete mode 100644 tauri-macros/src/error.rs delete mode 100644 tauri-macros/src/expand.rs delete mode 100644 tauri-macros/src/include_dir.rs delete mode 100644 tauri/examples/api/src-tauri/Cargo.lock delete mode 100644 tauri/examples/api/src-tauri/Cargo.toml delete mode 100644 tauri/examples/api/src-tauri/rustfmt.toml delete mode 100644 tauri/examples/api/src-tauri/src/build.rs delete mode 100644 tauri/examples/helloworld/src-tauri/Cargo.lock delete mode 100644 tauri/examples/helloworld/src-tauri/rustfmt.toml delete mode 100644 tauri/examples/helloworld/src-tauri/src/build.rs delete mode 100644 tauri/examples/multiwindow/dist/__tauri.js delete mode 100644 tauri/examples/multiwindow/src-tauri/Cargo.lock delete mode 100644 tauri/examples/multiwindow/src-tauri/Cargo.toml delete mode 100644 tauri/examples/multiwindow/src-tauri/rustfmt.toml delete mode 100644 tauri/examples/multiwindow/src-tauri/src/build.rs diff --git a/.gitignore b/.gitignore index 43da4b24d..33d79f0f1 100644 --- a/.gitignore +++ b/.gitignore @@ -85,8 +85,5 @@ target # todo: needs a proper fic /cli/tauri.js/tauri.conf.js -# doing this because the task-runner (`mask prepare`) will clone gh:tauri-apps/examples -/examples - # ignore frida handlers __handlers__/ diff --git a/Cargo.toml b/Cargo.toml index 9d8263191..beba431d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,21 @@ members = [ "tauri-api", "tauri-macros", "tauri-utils", + + # core + "core/tauri-build", + "core/tauri-codegen", + + # examples + "examples/api/src-tauri", + "examples/helloworld/src-tauri", + "examples/multiwindow/src-tauri", ] -exclude = [ - "examples", -] + +# default to small, optimized workspace release binaries +[profile.release] +panic = "abort" +codegen-units = 1 +lto = true +incremental = false +opt-level = "s" diff --git a/cli/core/src/build/rust.rs b/cli/core/src/build/rust.rs index 478e20f17..6bae3daa3 100644 --- a/cli/core/src/build/rust.rs +++ b/cli/core/src/build/rust.rs @@ -135,8 +135,10 @@ pub fn get_bundler_settings(config: &Config, debug: bool) -> crate::Result binaries.push(BundleBinary::new(package.name.clone(), true)), + 1 => binaries.get_mut(0).unwrap().set_main(true), + _ => {} } Ok(BundlerSettings { diff --git a/cli/tauri.js/src/template/index.ts b/cli/tauri.js/src/template/index.ts index 1aca73006..9e424ba44 100644 --- a/cli/tauri.js/src/template/index.ts +++ b/cli/tauri.js/src/template/index.ts @@ -77,29 +77,34 @@ Run \`tauri init --force template\` to overwrite.`) if (!force) return false } - const resolveTauriPath = (tauriPath: string): string => { + const resolveTauriPath = (tauriPath: string, crate: string): string => { const resolvedPath = isAbsolute(tauriPath) - ? join(tauriPath, 'tauri') // we received a full path as argument - : join('..', tauriPath, 'tauri') // we received a relative path + ? join(tauriPath, crate) // we received a full path as argument + : join('..', tauriPath, crate) // we received a relative path return resolvedPath.replace(/\\/g, '/') } - const resolveCurrentTauriVersion = (): string => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access - const tauriManifest = require('../../../../tauri/Cargo.toml') as CargoManifest + const resolveCurrentTauriVersion = (crate: string): string => { + const manifestPath = `../../../../${crate}/Cargo.toml` + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access, security/detect-non-literal-require + const tauriManifest = require(manifestPath) as CargoManifest const version = tauriManifest.package.version return version.substring(0, version.lastIndexOf('.')) } const tauriDep = tauriPath - ? `{ path = "${resolveTauriPath(tauriPath)}" }` - : `{ version = "${resolveCurrentTauriVersion()}" }` + ? `{ path = "${resolveTauriPath(tauriPath, 'tauri')}" }` + : `{ version = "${resolveCurrentTauriVersion('tauri')}" }` + const tauriBuildDep = tauriPath + ? `{ path = "${resolveTauriPath(tauriPath, 'core/tauri-build')}" }` + : `{ version = "${resolveCurrentTauriVersion('core/tauri-build')}" }` removeSync(dir) copyTemplates({ source: resolve(__dirname, '../../templates/src-tauri'), scope: { - tauriDep + tauriDep, + tauriBuildDep }, target: dir }) diff --git a/cli/tauri.js/templates/src-tauri/Cargo.toml b/cli/tauri.js/templates/src-tauri/Cargo.toml index d025c8e74..3513d682a 100755 --- a/cli/tauri.js/templates/src-tauri/Cargo.toml +++ b/cli/tauri.js/templates/src-tauri/Cargo.toml @@ -11,17 +11,17 @@ build = "src/build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[build-dependencies] +tauri-build = <%= tauriBuildDep %> + [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = <%= tauriDep || `{ version = "0.5" }` %> +tauri = <%= tauriDep %> [target."cfg(windows)".build-dependencies] winres = "0.1" [features] +default = [ "custom-protocol" ] custom-protocol = [ "tauri/custom-protocol" ] - -[[bin]] -name = "app" -path = "src/main.rs" diff --git a/cli/tauri.js/templates/src-tauri/src/build.rs b/cli/tauri.js/templates/src-tauri/src/build.rs index 83fb8f4d6..795b9b7c8 100644 --- a/cli/tauri.js/templates/src-tauri/src/build.rs +++ b/cli/tauri.js/templates/src-tauri/src/build.rs @@ -1,16 +1,3 @@ -#[cfg(windows)] -extern crate winres; - -#[cfg(windows)] fn main() { - if std::path::Path::new("icons/icon.ico").exists() { - let mut res = winres::WindowsResource::new(); - res.set_icon_with_id("icons/icon.ico", "32512"); - res.compile().expect("Unable to find visual studio tools"); - } else { - panic!("No Icon.ico found. Please add one or check the path"); - } + tauri_build::build() } - -#[cfg(not(windows))] -fn main() {} diff --git a/cli/tauri.js/templates/src-tauri/src/main.rs b/cli/tauri.js/templates/src-tauri/src/main.rs index 143839785..4fe595b63 100755 --- a/cli/tauri.js/templates/src-tauri/src/main.rs +++ b/cli/tauri.js/templates/src-tauri/src/main.rs @@ -3,12 +3,8 @@ windows_subsystem = "windows" )] -#[derive(tauri::FromTauriContext)] -struct Context; - fn main() { - tauri::AppBuilder::::new() - .build() - .unwrap() - .run(); + let context = tauri::generate_tauri_context!(); + + tauri::AppBuilder::default().build(context).run(); } diff --git a/cli/tauri.js/test/jest/fixtures/app/src-tauri/src/main.rs b/cli/tauri.js/test/jest/fixtures/app/src-tauri/src/main.rs index 7f3f6a1b8..2c3ee96b2 100644 --- a/cli/tauri.js/test/jest/fixtures/app/src-tauri/src/main.rs +++ b/cli/tauri.js/test/jest/fixtures/app/src-tauri/src/main.rs @@ -1,10 +1,9 @@ use tauri::ApplicationDispatcherExt; -#[derive(tauri::FromTauriContext)] -struct Context; - fn main() { - tauri::AppBuilder::::new() + let context = tauri::generate_tauri_context!(); + + tauri::AppBuilder::default() .setup(|webview_manager| async move { let mut webview_manager_ = webview_manager.clone(); tauri::event::listen(String::from("hello"), move |_| { @@ -24,7 +23,6 @@ fn main() { webview_manager.close().unwrap(); } }) - .build() - .unwrap() + .build(context) .run(); } diff --git a/core/tauri-build/Cargo.toml b/core/tauri-build/Cargo.toml new file mode 100644 index 000000000..11d096313 --- /dev/null +++ b/core/tauri-build/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "tauri-build" +version = "0.1.0" +authors = [ "Tauri Community" ] +categories = [ "gui", "web-programming" ] +license = "MIT" +homepage = "https://tauri.studio" +repository = "https://github.com/tauri-apps/tauri/tree/dev/core/tauri-build" +description = "build time code to pair with https://crates.io/crates/tauri" +edition = "2018" + +[dependencies] +anyhow = "1" + +# context dependencies +proc-macro2 = "1" +quote = "1" +tauri-codegen = { path = "../tauri-codegen", optional = true } + +[target."cfg(windows)".dependencies] +winres = "0.1" + +[features] +# keep context non-default to prevent some relatively large deps being pulled +codegen = ["tauri-codegen"] + +# enable feature flags on https://docs.rs/tauri-build +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "doc_cfg"] diff --git a/core/tauri-build/src/codegen/context.rs b/core/tauri-build/src/codegen/context.rs new file mode 100644 index 000000000..34d248ca3 --- /dev/null +++ b/core/tauri-build/src/codegen/context.rs @@ -0,0 +1,134 @@ +use anyhow::{Context, Result}; +use proc_macro2::Ident; +use quote::format_ident; +use std::{ + env::var, + fs::{create_dir_all, File}, + io::{BufWriter, Write}, + path::PathBuf, +}; +use tauri_codegen::{context_codegen, ContextData}; + +/// A builder for generating a Tauri application context during compile time. +/// +/// Meant to be used with [`tauri::include_codegen_context!`] inside your application code. +/// +/// [`tauri::include_codegen_context!`]: https://docs.rs/tauri/0.12/tauri/macro.include_codegen_context.html +#[cfg_attr(doc_cfg, doc(cfg(feature = "codegen")))] +#[derive(Debug)] +pub struct CodegenContext { + config_path: PathBuf, + struct_ident: Ident, + out_file: PathBuf, +} + +impl Default for CodegenContext { + fn default() -> Self { + Self { + config_path: PathBuf::from("tauri.conf.json"), + struct_ident: format_ident!("TauriBuildCodegenContext"), + out_file: PathBuf::from("tauri-build-context.rs"), + } + } +} + +impl CodegenContext { + /// Create a new [`CodegenContext`] builder that is already filled with the default options. + pub fn new() -> Self { + Self::default() + } + + /// Set the path to the `tauri.conf.json` (relative to the package's directory). + /// + /// This defaults to a file called `tauri.conf.json` inside of the current working directory of + /// the package compiling; does not need to be set manually if that config file is in the same + /// directory as your `Cargo.toml`. + pub fn config_path(mut self, config_path: impl Into) -> Self { + self.config_path = config_path.into(); + self + } + + /// Set the name of the generated struct. + /// + /// Don't set this if you are using [`tauri::include_codegen_context!`] as that helper macro + /// expects the default value. This option can be useful if you are not using the helper and + /// instead using [`std::include!`] on the generated code yourself. + /// + /// Defaults to `TauriBuildCodegenContext`. + /// + /// [`tauri::include_codegen_context!`]: https://docs.rs/tauri/0.12/tauri/macro.include_codegen_context.html + pub fn struct_ident(mut self, ident: impl AsRef) -> Self { + self.struct_ident = format_ident!("{}", ident.as_ref()); + self + } + + /// Sets the output file's path. + /// + /// **Note:** This path should be relative to the `OUT_DIR`. + /// + /// Don't set this if you are using [`tauri::include_codegen_context!`] as that helper macro + /// expects the default value. This option can be useful if you are not using the helper and + /// instead using [`std::include!`] on the generated code yourself. + /// + /// Defaults to `tauri-build-context.rs`. + /// + /// [`tauri::include_codegen_context!`]: https://docs.rs/tauri/0.12/tauri/macro.include_codegen_context.html + pub fn out_file(mut self, filename: PathBuf) -> Self { + self.out_file = filename; + self + } + + /// Generate the code and write it to the output file - returning the path it was saved to. + /// + /// Unless you are doing something special with this builder, you don't need to do anything with + /// the returned output path. + /// + /// # Panics + /// + /// If any parts of the codegen fail, this will panic with the related error message. This is + /// typically desirable when running inside a build script; see [`Self::try_build`] for no panics. + pub fn build(self) -> PathBuf { + match self.try_build() { + Ok(out) => out, + Err(error) => panic!("Error found during Codegen::build: {}", error), + } + } + + /// Non-panicking [`Self::build`] + pub fn try_build(self) -> Result { + let (config, config_parent) = tauri_codegen::get_config(&self.config_path)?; + let code = context_codegen(ContextData { + config, + config_parent, + struct_ident: self.struct_ident.clone(), + })?; + + // get the full output file path + let out = var("OUT_DIR") + .map(PathBuf::from) + .map(|path| path.join(&self.out_file)) + .with_context(|| "unable to find OUT_DIR during tauri-build")?; + + // make sure any nested directories in OUT_DIR are created + let parent = out.parent().with_context(|| { + "`Codegen` could not find the parent to `out_file` while creating the file" + })?; + create_dir_all(parent)?; + + let mut file = File::create(&out).map(BufWriter::new).with_context(|| { + format!( + "Unable to create output file during tauri-build {}", + out.display() + ) + })?; + + writeln!(&mut file, "{}", code).with_context(|| { + format!( + "Unable to write tokenstream to out file during tauri-build {}", + out.display() + ) + })?; + + Ok(out) + } +} diff --git a/core/tauri-build/src/codegen/mod.rs b/core/tauri-build/src/codegen/mod.rs new file mode 100644 index 000000000..e3c01fd8b --- /dev/null +++ b/core/tauri-build/src/codegen/mod.rs @@ -0,0 +1 @@ +pub(crate) mod context; diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs new file mode 100644 index 000000000..91d00766a --- /dev/null +++ b/core/tauri-build/src/lib.rs @@ -0,0 +1,56 @@ +#![cfg_attr(doc_cfg, feature(doc_cfg))] + +pub use anyhow::Result; + +#[cfg(feature = "codegen")] +mod codegen; + +#[cfg(feature = "codegen")] +pub use codegen::context::CodegenContext; + +/// Run all build time helpers for your Tauri Application. +/// +/// The current helpers include the following: +/// * Generates a Windows Resource file when targeting Windows. +/// +/// # Platforms +/// +/// [`build()`] should be called inside of `build.rs` regardless of the platform: +/// * New helpers may target more platforms in the future. +/// * Platform specific code is handled by the helpers automatically. +/// * A build script is required in order to activate some cargo environmental variables that are +/// used when generating code and embedding assets - so [`build()`] may as well be called. +/// +/// In short, this is saying don't put the call to [`build()`] behind a `#[cfg(windows)]`. +/// +/// # Panics +/// +/// If any of the build time helpers fail, they will [`std::panic!`] with the related error message. +/// This is typically desirable when running inside a build script; see [`try_build`] for no panics. +pub fn build() { + if let Err(error) = try_build() { + panic!("error found during tauri-build: {}", error); + } +} + +/// Non-panicking [`build()`]. +pub fn try_build() -> Result<()> { + #[cfg(windows)] + { + use anyhow::{anyhow, Context}; + use std::path::Path; + use winres::WindowsResource; + + if Path::new("icons/icon.ico").exists() { + let mut res = WindowsResource::new(); + res.set_icon_with_id("icons/icon.ico", "32512"); + res.compile().with_context(|| { + "failed to compile icons/icon.ico into a Windows Resource file during tauri-build" + })?; + } else { + return Err(anyhow!("no icons/icon.ico file found; required for generating a Windows Resource file during tauri-build")); + } + } + + Ok(()) +} diff --git a/core/tauri-codegen/Cargo.toml b/core/tauri-codegen/Cargo.toml new file mode 100644 index 000000000..9a4b06e5e --- /dev/null +++ b/core/tauri-codegen/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "tauri-codegen" +version = "0.1.0" +authors = [ "Tauri Community" ] +categories = [ "gui", "web-programming" ] +license = "MIT" +homepage = "https://tauri.studio" +repository = "https://github.com/tauri-apps/tauri/tree/dev/core/tauri-codegen" +description = "code generation meant to be consumed inside of `tauri` through `tauri-build` or `tauri-macros`" +edition = "2018" + +[dependencies] +proc-macro2 = "1" +quote = "1" +serde = { version = "1", features = ["derive"] } +serde_json = "1" +tauri-api = { path = "../../tauri-api", features = ["build"] } +thiserror = "1" +walkdir = "2" +zstd = "0.6" diff --git a/core/tauri-codegen/src/context.rs b/core/tauri-codegen/src/context.rs new file mode 100644 index 000000000..38da89b0b --- /dev/null +++ b/core/tauri-codegen/src/context.rs @@ -0,0 +1,69 @@ +use crate::embedded_assets::{EmbeddedAssets, EmbeddedAssetsError}; +use proc_macro2::{Ident, TokenStream}; +use quote::quote; +use std::path::PathBuf; +use tauri_api::config::Config; + +/// Necessary data needed by [`codegen_context`] to generate code for a Tauri application context. +pub struct ContextData { + pub config: Config, + pub config_parent: PathBuf, + pub struct_ident: Ident, +} + +/// Build an `AsTauriContext` implementation for including in application code. +pub fn context_codegen(data: ContextData) -> Result { + let ContextData { + config, + config_parent, + struct_ident, + } = data; + let dist_dir = config_parent.join(&config.build.dist_dir); + + // generate the assets inside the dist dir into a perfect hash function + let assets = EmbeddedAssets::new(&dist_dir)?; + + // handle default window icons for Windows targets + let default_window_icon = if cfg!(windows) { + let icon_path = config_parent.join("icons/icon.ico").display().to_string(); + quote!(Some(include_bytes!(#icon_path))) + } else { + quote!(None) + }; + + let tauri_script_path = dist_dir.join("__tauri.js").display().to_string(); + + // double braces are purposeful to force the code into a block expression + Ok(quote! {{ + use ::tauri::api::private::{OnceCell, AsTauriContext}; + + static CONFIG: OnceCell<::tauri::api::config::Config>= OnceCell::new(); + + /// Generated by `tauri-codegen`. + struct #struct_ident; + + impl AsTauriContext for #struct_ident { + /// Return a static reference to the config we parsed at build time + fn config() -> &'static ::tauri::api::config::Config { + CONFIG.get_or_init(|| #config) + } + + /// Inject assets we generated during build time + fn assets() -> &'static ::tauri::api::assets::EmbeddedAssets { + #assets + } + + /// Make the __tauri.js a dependency for the compiler + fn raw_tauri_script() -> &'static str { + include_str!(#tauri_script_path) + } + + /// Default window icon to set automatically if exists + fn default_window_icon() -> Option<&'static [u8]> { + #default_window_icon + } + } + + #struct_ident {} + }}) +} diff --git a/core/tauri-codegen/src/embedded_assets.rs b/core/tauri-codegen/src/embedded_assets.rs new file mode 100644 index 000000000..50be8555c --- /dev/null +++ b/core/tauri-codegen/src/embedded_assets.rs @@ -0,0 +1,135 @@ +use proc_macro2::TokenStream; +use quote::{quote, ToTokens, TokenStreamExt}; +use std::{ + collections::HashMap, + env::var, + fs::File, + io::BufReader, + path::{Path, PathBuf}, +}; +use tauri_api::assets::AssetKey; +use thiserror::Error; +use walkdir::WalkDir; + +/// (key, (original filepath, compressed bytes)) +type Asset = (AssetKey, (String, Vec)); + +/// All possible errors while reading and compressing an [`EmbeddedAssets`] directory +#[derive(Debug, Error)] +pub enum EmbeddedAssetsError { + #[error("failed to read asset at {path} because {error}")] + AssetRead { + path: PathBuf, + error: std::io::Error, + }, + + #[error("failed to write asset from {path} to Vec because {error}")] + AssetWrite { + path: PathBuf, + error: std::io::Error, + }, + + #[error("invalid prefix {prefix} used while including path {path}")] + PrefixInvalid { prefix: PathBuf, path: PathBuf }, + + #[error("failed to walk directory {path} because {error}")] + Walkdir { + path: PathBuf, + error: walkdir::Error, + }, +} + +/// Represent a directory of assets that are compressed and embedded. +/// +/// This is the compile time generation of [`tauri_api::assets::Assets`] from a directory. Assets +/// from the directory are added as compiler dependencies by dummy including the original, +/// uncompressed assets. +/// +/// The assets are compressed during this runtime, and can only be represented as a [`TokenStream`] +/// through [`ToTokens`]. The generated code is meant to be injected into an application to include +/// the compressed assets in that application's binary. +pub struct EmbeddedAssets(HashMap)>); + +impl EmbeddedAssets { + /// Compress a directory of assets, ready to be generated into a [`tauri_api::assets::Assets`]. + pub fn new(path: &Path) -> Result { + WalkDir::new(&path) + .follow_links(true) + .into_iter() + .filter_map(|entry| match entry { + // we only serve files, not directory listings + Ok(entry) if entry.file_type().is_dir() => None, + + // compress all files encountered + Ok(entry) => Some(Self::compress_file(path, entry.path())), + + // pass down error through filter to fail when encountering any error + Err(error) => Some(Err(EmbeddedAssetsError::Walkdir { + path: path.to_owned(), + error, + })), + }) + .collect::>() + .map(Self) + } + + /// Use highest compression level for release, the fastest one for everything else + fn compression_level() -> i32 { + match var("PROFILE").as_ref().map(String::as_str) { + Ok("release") => 22, + _ => -5, + } + } + + /// Compress a file and spit out the information in a [`HashMap`] friendly form. + fn compress_file(prefix: &Path, path: &Path) -> Result { + let reader = + File::open(&path) + .map(BufReader::new) + .map_err(|error| EmbeddedAssetsError::AssetRead { + path: path.to_owned(), + error, + })?; + + // entirely read compressed asset into bytes + let bytes = zstd::encode_all(reader, Self::compression_level()).map_err(|error| { + EmbeddedAssetsError::AssetWrite { + path: path.to_owned(), + error, + } + })?; + + // get a key to the asset path without the asset directory prefix + let key = path + .strip_prefix(prefix) + .map(AssetKey::from) // format the path for use in assets + .map_err(|_| EmbeddedAssetsError::PrefixInvalid { + prefix: prefix.to_owned(), + path: path.to_owned(), + })?; + + Ok((key, (path.display().to_string(), bytes))) + } +} + +impl ToTokens for EmbeddedAssets { + fn to_tokens(&self, tokens: &mut TokenStream) { + let mut map = TokenStream::new(); + for (key, (original, bytes)) in &self.0 { + let key: &str = key.as_ref(); + + // add original asset as a compiler dependency, rely on dead code elimination to clean it up + map.append_all(quote!(#key => { + const _: &[u8] = include_bytes!(#original); + &[#(#bytes),*] + },)); + } + + // we expect phf related items to be in path when generating the path code + tokens.append_all(quote! { + use ::tauri::api::assets::{EmbeddedAssets, phf, phf::phf_map}; + static ASSETS: EmbeddedAssets = EmbeddedAssets::from_zstd(phf_map! { #map }); + &ASSETS + }); + } +} diff --git a/core/tauri-codegen/src/lib.rs b/core/tauri-codegen/src/lib.rs new file mode 100644 index 000000000..6732865ba --- /dev/null +++ b/core/tauri-codegen/src/lib.rs @@ -0,0 +1,80 @@ +pub use context::{context_codegen, ContextData}; +use std::{ + borrow::Cow, + fs::File, + io::BufReader, + path::{Path, PathBuf}, +}; +pub use tauri_api::config::Config; +use thiserror::Error; + +mod context; +pub mod embedded_assets; + +/// Represents all the errors that can happen while reading the config. +#[derive(Debug, Error)] +pub enum ConfigError { + #[error("unable to access current working directory: {0}")] + CurrentDir(std::io::Error), + + // this error should be "impossible" because we use std::env::current_dir() - cover it anyways + #[error("Tauri config file has no parent, this shouldn't be possible. file an issue on https://github.com/tauri-apps/tauri - target {0}")] + Parent(PathBuf), + + #[error("unable to parse inline TAURI_CONFIG env var: {0}")] + FormatInline(serde_json::Error), + + #[error("unable to parse Tauri config file at {path} because {error}")] + Format { + path: PathBuf, + error: serde_json::Error, + }, + + #[error("unable to read Tauri config file at {path} because {error}")] + Io { + path: PathBuf, + error: std::io::Error, + }, +} + +/// Get the [`Config`] from the `TAURI_CONFIG` environmental variable, or read from the passed path. +/// +/// If the passed path is relative, it should be relative to the current working directory of the +/// compiling crate. +pub fn get_config(path: &Path) -> Result<(Config, PathBuf), ConfigError> { + let path = if path.is_relative() { + let cwd = std::env::current_dir().map_err(ConfigError::CurrentDir)?; + Cow::Owned(cwd.join(path)) + } else { + Cow::Borrowed(path) + }; + + // in the future we may want to find a way to not need the TAURI_CONFIG env var so that + // it is impossible for the content of two separate configs to get mixed up. The chances are + // already unlikely unless the developer goes out of their way to run the cli on a different + // project than the target crate. + let config = if let Ok(env) = std::env::var("TAURI_CONFIG") { + serde_json::from_str(&env).map_err(ConfigError::FormatInline)? + } else { + File::open(&path) + .map_err(|error| ConfigError::Io { + path: path.clone().into_owned(), + error, + }) + .map(BufReader::new) + .and_then(|file| { + serde_json::from_reader(file).map_err(|error| ConfigError::Format { + path: path.clone().into_owned(), + error, + }) + })? + }; + + // this should be impossible because of the use of `current_dir()` above, but handle it anyways + let parent = path + .parent() + .map(ToOwned::to_owned) + .ok_or_else(|| ConfigError::Parent(path.into_owned()))?; + + Ok((config, parent)) +} diff --git a/tauri/examples/api/.gitignore b/examples/api/.gitignore similarity index 100% rename from tauri/examples/api/.gitignore rename to examples/api/.gitignore diff --git a/tauri/examples/api/README.md b/examples/api/README.md similarity index 100% rename from tauri/examples/api/README.md rename to examples/api/README.md diff --git a/tauri/examples/api/package.json b/examples/api/package.json similarity index 83% rename from tauri/examples/api/package.json rename to examples/api/package.json index f38fef8f5..da89e33ef 100644 --- a/tauri/examples/api/package.json +++ b/examples/api/package.json @@ -5,7 +5,7 @@ "build": "rollup -c", "dev": "rollup -c -w", "start": "sirv public", - "tauri": "node ../../../cli/tauri.js/bin/tauri" + "tauri": "node ../../cli/tauri.js/bin/tauri" }, "devDependencies": { "@rollup/plugin-commonjs": "17.1.0", @@ -17,7 +17,7 @@ "svelte": "3.35.0" }, "dependencies": { - "@tauri-apps/api": "link:../../../api", + "@tauri-apps/api": "link:../../api", "sirv-cli": "1.0.11" } } diff --git a/examples/api/public/__tauri.js b/examples/api/public/__tauri.js new file mode 100644 index 000000000..dc44a7db6 --- /dev/null +++ b/examples/api/public/__tauri.js @@ -0,0 +1,332 @@ +function _inherits(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&_setPrototypeOf(e,r)}function _setPrototypeOf(e,r){return(_setPrototypeOf=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function _createSuper(e){var r=_isNativeReflectConstruct();return function(){var t,n=_getPrototypeOf(e);if(r){var o=_getPrototypeOf(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return _possibleConstructorReturn(this,t)}}function _possibleConstructorReturn(e,r){return!r||"object"!==_typeof(r)&&"function"!=typeof r?_assertThisInitialized(e):r}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _createForOfIteratorHelper(e,r){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=_unsupportedIterableToArray(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,i=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return u=e.done,e},e:function(e){i=!0,a=e},f:function(){try{u||null==t.return||t.return()}finally{if(i)throw a}}}}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t=0;--a){var u=this.tryEntries[a],i=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),s=n.call(u,"finallyLoc");if(c&&s){if(this.prev=0;--t){var o=this.tryEntries[t];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),P(t),y}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var o=n.arg;P(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:M(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),y}},e}("object"===("undefined"==typeof module?"undefined":_typeof(module))?module.exports:{});try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}function t(e){for(var r=void 0,t=e[0],n=1;n1&&void 0!==arguments[1]&&arguments[1],n=o();return Object.defineProperty(window,n,{value:function(o){return r&&Reflect.deleteProperty(window,n),t([e,"optionalCall",function(e){return e(o)}])},writable:!1,configurable:!0}),n}function u(e){return i.apply(this,arguments)}function i(){return(i=_asyncToGenerator(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",new Promise((function(e,n){var o=a((function(r){e(r),Reflect.deleteProperty(window,u)}),!0),u=a((function(e){n(e),Reflect.deleteProperty(window,o)}),!0);window.rpc.notify(r,_objectSpread({callback:o,error:u},t))})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var c=Object.freeze({__proto__:null,transformCallback:a,invoke:u});function s(e){return p.apply(this,arguments)}function p(){return(p=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",u("tauri",r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function f(){return(f=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Cli",message:{cmd:"cliMatches"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var l=Object.freeze({__proto__:null,getMatches:function(){return f.apply(this,arguments)}});function h(){return(h=_asyncToGenerator(regeneratorRuntime.mark((function e(){var r,t=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r=t.length>0&&void 0!==t[0]?t[0]:{})&&Object.freeze(r),e.abrupt("return",s({__tauriModule:"Dialog",mainThread:!0,message:{cmd:"openDialog",options:r}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function m(){return(m=_asyncToGenerator(regeneratorRuntime.mark((function e(){var r,t=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r=t.length>0&&void 0!==t[0]?t[0]:{})&&Object.freeze(r),e.abrupt("return",s({__tauriModule:"Dialog",mainThread:!0,message:{cmd:"saveDialog",options:r}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var y=Object.freeze({__proto__:null,open:function(){return h.apply(this,arguments)},save:function(){return m.apply(this,arguments)}});function d(e,r,t){return g.apply(this,arguments)}function g(){return(g=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s({__tauriModule:"Event",message:{cmd:"listen",event:r,handler:a(t,n),once:n}});case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(e,r){return v.apply(this,arguments)}function v(){return(v=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",d(r,t,!1));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(e,r){return b.apply(this,arguments)}function b(){return(b=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",d(r,t,!0));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(e,r,t){return k.apply(this,arguments)}function k(){return(k=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s({__tauriModule:"Event",message:{cmd:"emit",event:r,windowLabel:t,payload:n}});case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function x(){return(x=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",R(r,void 0,t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var T,G=Object.freeze({__proto__:null,emit:function(e,r){return x.apply(this,arguments)},listen:_,once:w});function P(){return(P=_asyncToGenerator(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readTextFile",path:r,options:t}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(){return(O=_asyncToGenerator(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readBinaryFile",path:r,options:t}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function M(){return(M=_asyncToGenerator(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=n.length>1&&void 0!==n[1]?n[1]:{})&&Object.freeze(t),"object"===_typeof(r)&&Object.freeze(r),e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:r.path,contents:r.contents,options:t}}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.Audio=1]="Audio";e[e.Cache=2]="Cache";e[e.Config=3]="Config";e[e.Data=4]="Data";e[e.LocalData=5]="LocalData";e[e.Desktop=6]="Desktop";e[e.Document=7]="Document";e[e.Download=8]="Download";e[e.Executable=9]="Executable";e[e.Font=10]="Font";e[e.Home=11]="Home";e[e.Picture=12]="Picture";e[e.Public=13]="Public";e[e.Runtime=14]="Runtime";e[e.Template=15]="Template";e[e.Video=16]="Video";e[e.Resource=17]="Resource";e[e.App=18]="App"}(T||(T={}));var j=65536;function F(e){var r=function(e){if(e.length1&&void 0!==n[1]?n[1]:{})&&Object.freeze(t),"object"===_typeof(r)&&Object.freeze(r),e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeBinaryFile",path:r.path,contents:F(r.contents),options:t}}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function S(){return(S=_asyncToGenerator(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readDir",path:r,options:t}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function C(){return(C=_asyncToGenerator(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"createDir",path:r,options:t}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(){return(E=_asyncToGenerator(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeDir",path:r,options:t}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function A(){return(A=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"copyFile",source:r,destination:t,options:n}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function z(){return(z=_asyncToGenerator(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeFile",path:r,options:t}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function L(){return(L=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:r,newPath:t,options:n}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var W=Object.freeze({__proto__:null,get BaseDirectory(){return T},get Dir(){return T},readTextFile:function(e){return P.apply(this,arguments)},readBinaryFile:function(e){return O.apply(this,arguments)},writeFile:function(e){return M.apply(this,arguments)},writeBinaryFile:function(e){return D.apply(this,arguments)},readDir:function(e){return S.apply(this,arguments)},createDir:function(e){return C.apply(this,arguments)},removeDir:function(e){return E.apply(this,arguments)},copyFile:function(e,r){return A.apply(this,arguments)},removeFile:function(e){return z.apply(this,arguments)},renameFile:function(e,r){return L.apply(this,arguments)}});function N(){return(N=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.App}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function I(){return(I=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Audio}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function H(){return(H=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Cache}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(){return(B=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Config}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(){return(q=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Data}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function U(){return(U=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Desktop}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Y(){return(Y=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Document}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function J(){return(J=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Download}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function K(){return(K=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Executable}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V(){return(V=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Font}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function X(){return(X=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Home}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $(){return($=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.LocalData}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Q(){return(Q=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Picture}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Z(){return(Z=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Public}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ee(){return(ee=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Resource}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function re(){return(re=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Runtime}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function te(){return(te=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Template}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ne(){return(ne=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:"",directory:T.Video}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(){return(oe=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"resolvePath",path:r,directory:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ae,ue=Object.freeze({__proto__:null,appDir:function(){return N.apply(this,arguments)},audioDir:function(){return I.apply(this,arguments)},cacheDir:function(){return H.apply(this,arguments)},configDir:function(){return B.apply(this,arguments)},dataDir:function(){return q.apply(this,arguments)},desktopDir:function(){return U.apply(this,arguments)},documentDir:function(){return Y.apply(this,arguments)},downloadDir:function(){return J.apply(this,arguments)},executableDir:function(){return K.apply(this,arguments)},fontDir:function(){return V.apply(this,arguments)},homeDir:function(){return X.apply(this,arguments)},localDataDir:function(){return $.apply(this,arguments)},pictureDir:function(){return Q.apply(this,arguments)},publicDir:function(){return Z.apply(this,arguments)},resourceDir:function(){return ee.apply(this,arguments)},runtimeDir:function(){return re.apply(this,arguments)},templateDir:function(){return te.apply(this,arguments)},videoDir:function(){return ne.apply(this,arguments)},resolvePath:function(e,r){return oe.apply(this,arguments)}});function ie(e,r){return null!=e?e:r()}function ce(e){for(var r=void 0,t=e[0],n=1;n1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(this,t),n=r.call(this,e),s({__tauriModule:"Window",message:{cmd:"createWebview",options:_objectSpread({label:e},o)}}).then(_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://created"));case 1:case"end":return e.stop()}}),e)})))).catch(function(){var e=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://error",r));case 1:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}()),n}return _createClass(t,null,[{key:"getByLabel",value:function(e){return ve().some((function(r){return r.label===e}))?new be(e):null}}]),t}(be),ke=new(function(){function e(){_classCallCheck(this,e)}var r,t,n,o,a,u,i,c,p,f,l,h,m,y,d,g,_,v,w,b,R;return _createClass(e,[{key:"setResizable",value:(R=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"setResizable",resizable:r}}));case 1:case"end":return e.stop()}}),e)}))),function(e){return R.apply(this,arguments)})},{key:"setTitle",value:(b=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"setTitle",title:r}}));case 1:case"end":return e.stop()}}),e)}))),function(e){return b.apply(this,arguments)})},{key:"maximize",value:(w=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"maximize"}}));case 1:case"end":return e.stop()}}),e)}))),function(){return w.apply(this,arguments)})},{key:"unmaximize",value:(v=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"unmaximize"}}));case 1:case"end":return e.stop()}}),e)}))),function(){return v.apply(this,arguments)})},{key:"minimize",value:(_=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"minimize"}}));case 1:case"end":return e.stop()}}),e)}))),function(){return _.apply(this,arguments)})},{key:"unminimize",value:(g=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"unminimize"}}));case 1:case"end":return e.stop()}}),e)}))),function(){return g.apply(this,arguments)})},{key:"show",value:(d=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"show"}}));case 1:case"end":return e.stop()}}),e)}))),function(){return d.apply(this,arguments)})},{key:"hide",value:(y=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"hide"}}));case 1:case"end":return e.stop()}}),e)}))),function(){return y.apply(this,arguments)})},{key:"close",value:(m=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"close"}}));case 1:case"end":return e.stop()}}),e)}))),function(){return m.apply(this,arguments)})},{key:"setDecorations",value:(h=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"setDecorations",decorations:r}}));case 1:case"end":return e.stop()}}),e)}))),function(e){return h.apply(this,arguments)})},{key:"setAlwaysOnTop",value:(l=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"setAlwaysOnTop",alwaysOnTop:r}}));case 1:case"end":return e.stop()}}),e)}))),function(e){return l.apply(this,arguments)})},{key:"setWidth",value:(f=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"setWidth",width:r}}));case 1:case"end":return e.stop()}}),e)}))),function(e){return f.apply(this,arguments)})},{key:"setHeight",value:(p=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"setHeight",height:r}}));case 1:case"end":return e.stop()}}),e)}))),function(e){return p.apply(this,arguments)})},{key:"resize",value:(c=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"resize",width:r,height:t}}));case 1:case"end":return e.stop()}}),e)}))),function(e,r){return c.apply(this,arguments)})},{key:"setMinSize",value:(i=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"setMinSize",minWidth:r,minHeight:t}}));case 1:case"end":return e.stop()}}),e)}))),function(e,r){return i.apply(this,arguments)})},{key:"setMaxSize",value:(u=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"setMaxSize",maxWidth:r,maxHeight:t}}));case 1:case"end":return e.stop()}}),e)}))),function(e,r){return u.apply(this,arguments)})},{key:"setX",value:(a=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"setX",x:r}}));case 1:case"end":return e.stop()}}),e)}))),function(e){return a.apply(this,arguments)})},{key:"setY",value:(o=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"setY",y:r}}));case 1:case"end":return e.stop()}}),e)}))),function(e){return o.apply(this,arguments)})},{key:"setPosition",value:(n=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"setPosition",x:r,y:t}}));case 1:case"end":return e.stop()}}),e)}))),function(e,r){return n.apply(this,arguments)})},{key:"setFullscreen",value:(t=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"setFullscreen",fullscreen:r}}));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"setIcon",value:(r=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"setIcon",icon:r}}));case 1:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})}]),e}()),xe=Object.freeze({__proto__:null,WebviewWindow:Re,getCurrent:function(){return new be(window.__TAURI__.__currentWindow.label)},getAll:ve,appWindow:ke});function Te(){return(Te=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("default"===window.Notification.permission){e.next=2;break}return e.abrupt("return",Promise.resolve("granted"===window.Notification.permission));case 2:return e.abrupt("return",s({__tauriModule:"Notification",message:{cmd:"isNotificationPermissionGranted"}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ge(){return(Ge=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",window.Notification.requestPermission());case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Pe=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return Ge.apply(this,arguments)},isPermissionGranted:function(){return Te.apply(this,arguments)}});function Oe(){return(Oe=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:r,handler:a(t)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Me(){return(Me=_asyncToGenerator(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:r,handler:a(t)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function je(){return(je=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fe(){return(Fe=_asyncToGenerator(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function De(){return(De=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Se=Object.freeze({__proto__:null,register:function(e,r){return Oe.apply(this,arguments)},registerAll:function(e,r){return Me.apply(this,arguments)},isRegistered:function(e){return je.apply(this,arguments)},unregister:function(e){return Fe.apply(this,arguments)},unregisterAll:function(){return De.apply(this,arguments)}});e.cli=l,e.dialog=y,e.event=G,e.fs=W,e.globalShortcut=Se,e.http=ye,e.notification=Pe,e.path=ue,e.shell=_e,e.tauri=c,e.window=xe,Object.defineProperty(e,"__esModule",{value:!0})})); + + +// polyfills +if (!String.prototype.startsWith) { + String.prototype.startsWith = function (searchString, position) { + position = position || 0; + return this.substr(position, searchString.length) === searchString; + }; +} + +(function () { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + + var uid = function () { + return ( + s4() + + s4() + + "-" + + s4() + + "-" + + s4() + + "-" + + s4() + + "-" + + s4() + + s4() + + s4() + ); + }; + + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) + symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); + } + return keys; + } + + function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + if (i % 2) { + ownKeys(source, true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties( + target, + Object.getOwnPropertyDescriptors(source) + ); + } else { + ownKeys(source).forEach(function (key) { + Object.defineProperty( + target, + key, + Object.getOwnPropertyDescriptor(source, key) + ); + }); + } + } + return target; + } + + function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true, + }); + } else { + obj[key] = value; + } + return obj; + } + + if (!window.__TAURI__) { + window.__TAURI__ = {}; + } + + window.__TAURI__.transformCallback = function transformCallback( + callback, + once + ) { + var identifier = uid(); + + window[identifier] = function (result) { + if (once) { + delete window[identifier]; + } + + return callback && callback(result); + }; + + return identifier; + }; + + window.__TAURI__.invoke = function invoke(cmd, args = {}) { + var _this = this; + + return new Promise(function (resolve, reject) { + var callback = _this.transformCallback(function (r) { + resolve(r); + delete window[error]; + }, true); + var error = _this.transformCallback(function (e) { + reject(e); + delete window[callback]; + }, true); + + if (typeof cmd === "string") { + args.cmd = cmd; + } else if (typeof cmd === "object") { + args = cmd; + } else { + return reject(new Error("Invalid argument type.")); + } + + if (window.rpc) { + window.rpc.notify( + cmd, + _objectSpread( + { + callback: callback, + error: error, + }, + args + ) + ); + } else { + window.addEventListener("DOMContentLoaded", function () { + window.rpc.notify( + cmd, + _objectSpread( + { + callback: callback, + error: error, + }, + args + ) + ); + }); + } + }); + }; + + // open links with the Tauri API + function __openLinks() { + document.querySelector("body").addEventListener( + "click", + function (e) { + var target = e.target; + while (target != null) { + if ( + target.matches ? target.matches("a") : target.msMatchesSelector("a") + ) { + if ( + target.href && + target.href.startsWith("http") && + target.target === "_blank" + ) { + window.__TAURI__.invoke('tauri', { + __tauriModule: "Shell", + message: { + cmd: "open", + uri: target.href, + }, + }); + e.preventDefault(); + } + break; + } + target = target.parentElement; + } + }, + true + ); + } + + if ( + document.readyState === "complete" || + document.readyState === "interactive" + ) { + __openLinks(); + } else { + window.addEventListener( + "DOMContentLoaded", + function () { + __openLinks(); + }, + true + ); + } + + window.__TAURI__.invoke('tauri', { + __tauriModule: "Event", + message: { + cmd: "listen", + event: "tauri://window-created", + handler: window.__TAURI__.transformCallback(function (event) { + if (event.payload) { + var windowLabel = event.payload.label; + window.__TAURI__.__windows.push({ label: windowLabel }); + } + }), + }, + }); + + let permissionSettable = false; + let permissionValue = "default"; + + function isPermissionGranted() { + if (window.Notification.permission !== "default") { + return Promise.resolve(window.Notification.permission === "granted"); + } + return window.__TAURI__.invoke('tauri', { + __tauriModule: "Notification", + message: { + cmd: "isNotificationPermissionGranted", + }, + }); + } + + function setNotificationPermission(value) { + permissionSettable = true; + window.Notification.permission = value; + permissionSettable = false; + } + + function requestPermission() { + return window.__TAURI__ + .invoke('tauri', { + __tauriModule: "Notification", + mainThread: true, + message: { + cmd: "requestNotificationPermission", + }, + }) + .then(function (permission) { + setNotificationPermission(permission); + return permission; + }); + } + + function sendNotification(options) { + if (typeof options === "object") { + Object.freeze(options); + } + + isPermissionGranted().then(function (permission) { + if (permission) { + return window.__TAURI__.invoke('tauri', { + __tauriModule: "Notification", + message: { + cmd: "notification", + options: + typeof options === "string" + ? { + title: options, + } + : options, + }, + }); + } + }); + } + + window.Notification = function (title, options) { + var opts = options || {}; + sendNotification( + Object.assign(opts, { + title: title, + }) + ); + }; + + window.Notification.requestPermission = requestPermission; + + Object.defineProperty(window.Notification, "permission", { + enumerable: true, + get: function () { + return permissionValue; + }, + set: function (v) { + if (!permissionSettable) { + throw new Error("Readonly property"); + } + permissionValue = v; + }, + }); + + isPermissionGranted().then(function (response) { + if (response === null) { + setNotificationPermission("default"); + } else { + setNotificationPermission(response ? "granted" : "denied"); + } + }); + + window.alert = function (message) { + window.__TAURI__.invoke('tauri', { + __tauriModule: "Dialog", + mainThread: true, + message: { + cmd: "messageDialog", + message: message, + }, + }); + }; + + window.confirm = function (message) { + return window.__TAURI__.invoke('tauri', { + __tauriModule: "Dialog", + mainThread: true, + message: { + cmd: "askDialog", + message: message, + }, + }); + }; +})(); diff --git a/examples/api/public/build/bundle.js b/examples/api/public/build/bundle.js new file mode 100644 index 000000000..188873872 --- /dev/null +++ b/examples/api/public/build/bundle.js @@ -0,0 +1,17 @@ +var app=function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function i(e){e.forEach(t)}function r(e){return"function"==typeof e}function o(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function u(t,n,i){t.$$.on_destroy.push(function(t,...n){if(null==t)return e;const i=t.subscribe(...n);return i.unsubscribe?()=>i.unsubscribe():i}(n,i))}function s(e,t){e.appendChild(t)}function a(e,t,n){e.insertBefore(t,n||null)}function c(e){e.parentNode.removeChild(e)}function l(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function p(e){return function(t){return t.preventDefault(),e.call(this,t)}}function v(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function g(e){return""===e?null:+e}function m(e,t){e.value=null==t?"":t}function b(e,t,n,i){e.style.setProperty(t,n,i?"important":"")}function y(e,t){for(let n=0;n{E.delete(e),i&&(n&&e.d(1),i())})),e.o(t)}}function q(e){e&&e.c()}function H(e,n,o,u){const{fragment:s,on_mount:a,on_destroy:c,after_update:l}=e.$$;s&&s.m(n,o),u||F((()=>{const n=a.map(t).filter(r);c?c.push(...n):i(n),e.$$.on_mount=[]})),l.forEach(F)}function L(e,t){const n=e.$$;null!==n.fragment&&(i(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function I(e,t){-1===e.$$.dirty[0]&&(k.push(e),O||(O=!0,T.then(j)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const r=i.length?i[0]:n;return f.ctx&&s(f.ctx[e],f.ctx[e]=r)&&(!f.skip_bound&&f.bound[e]&&f.bound[e](r),h&&I(t,e)),n})):[],f.update(),h=!0,i(f.before_update),f.fragment=!!u&&u(f.ctx),r.target){if(r.hydrate){const e=function(e){return Array.from(e.childNodes)}(r.target);f.fragment&&f.fragment.l(e),e.forEach(c)}else f.fragment&&f.fragment.c();r.intro&&R(t.$$.fragment),H(t,r.target,r.anchor,r.customElement),j()}x(d)}class U{$destroy(){L(this,1),this.$destroy=e}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function G(e){var t={exports:{}};return e(t,t.exports),t.exports}var J=G((function(e,t){ +/*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ +var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t,n,i){return new(n||(n=Promise))((function(r,o){function u(e){try{a(i.next(e))}catch(e){o(e)}}function s(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,s)}a((i=i.apply(e,t||[])).next())}))}function r(e,t){var n,i,r,o,u={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,i=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!((r=(r=u.trys).length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){u=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]{"onMessage"in e&&n(1,i=e.onMessage)},[function(){Q.getMatches().then(i).catch(i)},i]}class te extends U{constructor(e){super(),N(this,e,ee,Z,o,{onMessage:1})}}var ne=G((function(e,t){function n(e,t){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(n){return[2,X.emit(e,void 0,t)]}))}))}var i=Object.freeze({__proto__:null,emit:n,listen:X.listen,once:X.once});t.emit=n,t.event=i})),ie=G((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.listen=X.listen,t.once=X.once,t.emit=ne.emit})),re=G((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.invoke=J.invoke,t.transformCallback=J.transformCallback}));function oe(t){let n,r,o,u,l,f,p,g;return{c(){n=d("div"),r=d("button"),r.textContent="Call Log API",o=h(),u=d("button"),u.textContent="Call Request (async) API",l=h(),f=d("button"),f.textContent="Send event to Rust",v(r,"class","button"),v(r,"id","log"),v(u,"class","button"),v(u,"id","request"),v(f,"class","button"),v(f,"id","event")},m(e,i){a(e,n,i),s(n,r),s(n,o),s(n,u),s(n,l),s(n,f),p||(g=[_(r,"click",t[0]),_(u,"click",t[1]),_(f,"click",t[2])],p=!0)},p:e,i:e,o:e,d(e){e&&c(n),p=!1,i(g)}}}function ue(e,t,n){let{onMessage:i}=t;return ie.listen("rust-event",i),e.$$set=e=>{"onMessage"in e&&n(3,i=e.onMessage)},[function(){re.invoke("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})},function(){re.invoke("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)},function(){ie.emit("js-event","this is the payload string")},i]}class se extends U{constructor(e){super(),N(this,e,ue,oe,o,{onMessage:3})}}var ae=G((function(e,t){function n(e){return void 0===e&&(e={}),J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(t){return"object"==typeof e&&Object.freeze(e),[2,J.invoke({__tauriModule:"Dialog",mainThread:!0,message:{cmd:"openDialog",options:e}})]}))}))}function i(e){return void 0===e&&(e={}),J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(t){return"object"==typeof e&&Object.freeze(e),[2,J.invoke({__tauriModule:"Dialog",mainThread:!0,message:{cmd:"saveDialog",options:e}})]}))}))}var r=Object.freeze({__proto__:null,open:n,save:i});t.dialog=r,t.open=n,t.save=i})),ce=G((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.open=ae.open,t.save=ae.save})),le=G((function(e,t){var n,i=J;function r(e,t){return void 0===t&&(t={}),i.__awaiter(this,void 0,void 0,(function(){return i.__generator(this,(function(n){return[2,i.invoke({__tauriModule:"Fs",message:{cmd:"readTextFile",path:e,options:t}})]}))}))}function o(e,t){return void 0===t&&(t={}),i.__awaiter(this,void 0,void 0,(function(){return i.__generator(this,(function(n){return[2,i.invoke({__tauriModule:"Fs",message:{cmd:"readBinaryFile",path:e,options:t}})]}))}))}function u(e,t){return void 0===t&&(t={}),i.__awaiter(this,void 0,void 0,(function(){return i.__generator(this,(function(n){return"object"==typeof t&&Object.freeze(t),"object"==typeof e&&Object.freeze(e),[2,i.invoke({__tauriModule:"Fs",message:{cmd:"writeFile",path:e.path,contents:e.contents,options:t}})]}))}))}function s(e){var t=function(e){if(e.length<65536)return String.fromCharCode.apply(null,Array.from(e));for(var t="",n=e.length,i=0;i{"onMessage"in e&&n(6,i=e.onMessage)},[r,o,u,s,function(){ce.open({defaultPath:r,filters:o?[{name:"Tauri Example",extensions:o.split(",").map((e=>e.trim()))}]:[],multiple:u,directory:s}).then((function(e){if(Array.isArray(e))i(e);else{var t=e,n=t.match(/\S+\.\S+$/g);de.readBinaryFile(t).then((function(r){var o,u,s,a;n&&(t.includes(".png")||t.includes(".jpg"))?(o=new Uint8Array(r),u=function(e){i('')},s=new Blob([o],{type:"application/octet-binary"}),(a=new FileReader).onload=function(e){var t=e.target.result;u(t.substr(t.indexOf(",")+1))},a.readAsDataURL(s)):i(e)})).catch(i(e))}})).catch(i)},function(){ce.save({defaultPath:r,filters:o?[{name:"Tauri Example",extensions:o.split(",").map((e=>e.trim()))}]:[]}).then(i).catch(i)},i,function(){r=this.value,n(0,r)},function(){o=this.value,n(1,o)},function(){u=this.checked,n(2,u)},function(){s=this.checked,n(3,s)}]}class _e extends U{constructor(e){var t;super(),document.getElementById("svelte-1eg58yg-style")||((t=d("style")).id="svelte-1eg58yg-style",t.textContent="#dialog-filter.svelte-1eg58yg{width:260px}",s(document.head,t)),N(this,e,he,fe,o,{onMessage:6})}}function pe(e,t,n){const i=e.slice();return i[5]=t[n],i}function ve(t){let n,i,r=t[5][0]+"";return{c(){n=d("option"),i=f(r),n.__value=t[5][1],n.value=n.__value},m(e,t){a(e,n,t),s(n,i)},p:e,d(e){e&&c(n)}}}function ge(t){let n,r,o,u,f,g,y,w,x,k=t[1],M=[];for(let e=0;eisNaN(parseInt(e)))).map((e=>[e,de.Dir[e]]));return e.$$set=e=>{"onMessage"in e&&n(3,i=e.onMessage)},[r,o,function(){const e=r.match(/\S+\.\S+$/g),t={dir:me()};(e?de.readBinaryFile(r,t):de.readDir(r,t)).then((function(t){if(e)if(r.includes(".png")||r.includes(".jpg"))!function(e,t){const n=new Blob([e],{type:"application/octet-binary"}),i=new FileReader;i.onload=function(e){const n=e.target.result;t(n.substr(n.indexOf(",")+1))},i.readAsDataURL(n)}(new Uint8Array(t),(function(e){i('')}));else{const e=String.fromCharCode.apply(null,t);i(''),setTimeout((()=>{const t=document.getElementById("file-response");t.value=e,document.getElementById("file-save").addEventListener("click",(function(){writeFile({file:r,contents:t.value},{dir:me()}).catch(i)}))}))}else i(t)})).catch(i)},i,function(){r=this.value,n(0,r)}]}class ye extends U{constructor(e){super(),N(this,e,be,ge,o,{onMessage:3})}}var we=G((function(e,t){var n;t.ResponseType=void 0,(n=t.ResponseType||(t.ResponseType={}))[n.JSON=1]="JSON",n[n.Text=2]="Text",n[n.Binary=3]="Binary";var i=function(){function e(e,t){this.type=e,this.payload=t}return e.form=function(t){return new e("Form",t)},e.json=function(t){return new e("Json",t)},e.text=function(t){return new e("Text",t)},e.bytes=function(t){return new e("Bytes",t)},e}(),r=function(){function e(e){this.id=e}return e.prototype.drop=function(){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(e){return[2,J.invoke({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})]}))}))},e.prototype.request=function(e){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(t){return[2,J.invoke({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:e}})]}))}))},e.prototype.get=function(e,t){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(n){return[2,this.request(J._assign({method:"GET",url:e},t))]}))}))},e.prototype.post=function(e,t,n){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(i){return[2,this.request(J._assign({method:"POST",url:e,body:t},n))]}))}))},e.prototype.put=function(e,t,n){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(i){return[2,this.request(J._assign({method:"PUT",url:e,body:t},n))]}))}))},e.prototype.patch=function(e,t){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(n){return[2,this.request(J._assign({method:"PATCH",url:e},t))]}))}))},e.prototype.delete=function(e,t){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(n){return[2,this.request(J._assign({method:"DELETE",url:e},t))]}))}))},e}();function o(e){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(t){return[2,J.invoke({__tauriModule:"Http",message:{cmd:"createClient",options:e}}).then((function(e){return new r(e)}))]}))}))}var u=null;function s(e,t){var n;return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(i){switch(i.label){case 0:return null!==u?[3,2]:[4,o()];case 1:u=i.sent(),i.label=2;case 2:return[2,u.request(J._assign({url:e,method:null!==(n=null==t?void 0:t.method)&&void 0!==n?n:"GET"},t))]}}))}))}var a=Object.freeze({__proto__:null,get ResponseType(){return t.ResponseType},Body:i,Client:r,getClient:o,fetch:s});t.Body=i,t.Client=r,t.fetch=s,t.getClient=o,t.http=a})),xe=G((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Body=we.Body,t.Client=we.Client,Object.defineProperty(t,"ResponseType",{enumerable:!0,get:function(){return we.ResponseType}}),t.fetch=we.fetch,t.getClient=we.getClient}));function ke(t){let n,r,o,u,l,f,g,w,x,k,M,$,C,T,O,D,P;return{c(){n=d("form"),r=d("select"),o=d("option"),o.textContent="GET",u=d("option"),u.textContent="POST",l=d("option"),l.textContent="PUT",f=d("option"),f.textContent="PATCH",g=d("option"),g.textContent="DELETE",w=h(),x=d("input"),k=h(),M=d("br"),$=h(),C=d("textarea"),T=h(),O=d("button"),O.textContent="Make request",o.__value="GET",o.value=o.__value,u.__value="POST",u.value=u.__value,l.__value="PUT",l.value=l.__value,f.__value="PATCH",f.value=f.__value,g.__value="DELETE",g.value=g.__value,v(r,"class","button"),v(r,"id","request-method"),void 0===t[0]&&F((()=>t[5].call(r))),v(x,"id","request-url"),v(x,"placeholder","Type the request URL..."),v(C,"id","request-body"),v(C,"placeholder","Request body"),v(C,"rows","5"),b(C,"width","100%"),b(C,"margin-right","10px"),b(C,"font-size","12px"),v(O,"class","button"),v(O,"id","make-request")},m(e,i){a(e,n,i),s(n,r),s(r,o),s(r,u),s(r,l),s(r,f),s(r,g),y(r,t[0]),s(n,w),s(n,x),m(x,t[1]),s(n,k),s(n,M),s(n,$),s(n,C),m(C,t[2]),s(n,T),s(n,O),D||(P=[_(r,"change",t[5]),_(x,"input",t[6]),_(C,"input",t[7]),_(n,"submit",p(t[3]))],D=!0)},p(e,[t]){1&t&&y(r,e[0]),2&t&&x.value!==e[1]&&m(x,e[1]),4&t&&m(C,e[2])},i:e,o:e,d(e){e&&c(n),D=!1,i(P)}}}function Me(e,t,n){let i="GET",r="",o="",{onMessage:u}=t;return e.$$set=e=>{"onMessage"in e&&n(4,u=e.onMessage)},[i,r,o,async function(){const e=await xe.getClient(),t={url:r||""||"",method:i||"GET"||"GET"};o.startsWith("{")&&o.endsWith("}")||o.startsWith("[")&&o.endsWith("]")?t.body=xe.Body.json(JSON.parse(o)):""!==o&&(t.body=xe.Body.text(o)),e.request(t).then(u).catch(u)},u,function(){i=function(e){const t=e.querySelector(":checked")||e.options[0];return t&&t.__value}(this),n(0,i)},function(){r=this.value,n(1,r)},function(){o=this.value,n(2,o)}]}class $e extends U{constructor(e){super(),N(this,e,Me,ke,o,{onMessage:4})}}function Ce(t){let n,i,r;return{c(){n=d("button"),n.textContent="Send test notification",v(n,"class","button"),v(n,"id","notification")},m(e,o){a(e,n,o),i||(r=_(n,"click",t[0]),i=!0)},p:e,i:e,o:e,d(e){e&&c(n),i=!1,r()}}}function Te(){new Notification("Notification title",{body:"This is the notification body"})}function Oe(e,t,n){let{onMessage:i}=t;return e.$$set=e=>{"onMessage"in e&&n(1,i=e.onMessage)},[function(){"default"===Notification.permission?Notification.requestPermission().then((function(e){"granted"===e?Te():i("Permission is "+e)})).catch(i):"granted"===Notification.permission?Te():i("Permission is denied")},i]}class Fe extends U{constructor(e){super(),N(this,e,Oe,Ce,o,{onMessage:1})}}var De=G((function(e,t){function n(e,t){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(n){return"object"==typeof t&&Object.freeze(t),[2,J.invoke({__tauriModule:"Shell",message:{cmd:"execute",command:e,args:"string"==typeof t?[t]:t}})]}))}))}function i(e){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(t){return[2,J.invoke({__tauriModule:"Shell",message:{cmd:"open",uri:e}})]}))}))}var r=Object.freeze({__proto__:null,execute:n,open:i});t.execute=n,t.open=i,t.shell=r})),Pe=G((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.execute=De.execute,t.open=De.open}));function je(t){let n,r,o,u,l,y,w,x,k,M,$,C,T,O,F,D,P,j,A,E,z,S,W,R,B,q,H,L,I,N,U,G,J,X,V,Y,K,Q,Z,ee,te,ne,ie,re,oe,ue,se,ae,ce,le,de,fe,he,_e,pe,ve,ge,me,be,ye,we,xe,ke,Me,$e,Ce,Te,Oe,Fe,De,Pe,je,Ae,Ee,ze,Se,We;return{c(){n=d("div"),r=d("div"),o=d("label"),u=d("input"),l=f("\n Resizable"),y=h(),w=d("label"),x=d("input"),k=f("\n Maximize"),M=h(),$=d("button"),$.textContent="Minimize",C=h(),T=d("button"),T.textContent="Hide",O=h(),F=d("label"),D=d("input"),P=f("\n Has decorations"),j=h(),A=d("label"),E=d("input"),z=f("\n Always on top"),S=h(),W=d("label"),R=d("input"),B=f("\n Fullscreen"),q=h(),H=d("button"),H.textContent="Change icon",L=h(),I=d("div"),N=d("div"),U=d("div"),G=d("div"),J=f("X\n "),X=d("input"),V=h(),Y=d("div"),K=f("Y\n "),Q=d("input"),Z=h(),ee=d("div"),te=d("div"),ne=f("Width\n "),ie=d("input"),re=h(),oe=d("div"),ue=f("Height\n "),se=d("input"),ae=h(),ce=d("div"),le=d("div"),de=f("Min width\n "),fe=d("input"),he=h(),_e=d("div"),pe=f("Min height\n "),ve=d("input"),ge=h(),me=d("div"),be=d("div"),ye=f("Max width\n "),we=d("input"),xe=h(),ke=d("div"),Me=f("Max height\n "),$e=d("input"),Ce=h(),Te=d("form"),Oe=d("input"),Fe=h(),De=d("button"),De.textContent="Set title",Pe=h(),je=d("form"),Ae=d("input"),Ee=h(),ze=d("button"),ze.textContent="Open URL",v(u,"type","checkbox"),v(x,"type","checkbox"),v($,"title","Unminimizes after 2 seconds"),v(T,"title","Visible again after 2 seconds"),v(D,"type","checkbox"),v(E,"type","checkbox"),v(R,"type","checkbox"),v(X,"type","number"),v(X,"min","0"),v(X,"class","svelte-c0bh97"),v(Q,"type","number"),v(Q,"min","0"),v(Q,"class","svelte-c0bh97"),v(U,"class","flex flex-column grow svelte-c0bh97"),v(ie,"type","number"),v(ie,"min","400"),v(ie,"class","svelte-c0bh97"),v(se,"type","number"),v(se,"min","400"),v(se,"class","svelte-c0bh97"),v(ee,"class","flex flex-column grow svelte-c0bh97"),v(fe,"type","number"),v(fe,"class","svelte-c0bh97"),v(ve,"type","number"),v(ve,"class","svelte-c0bh97"),v(ce,"class","flex flex-column grow svelte-c0bh97"),v(we,"type","number"),v(we,"min","400"),v(we,"class","svelte-c0bh97"),v($e,"type","number"),v($e,"min","400"),v($e,"class","svelte-c0bh97"),v(me,"class","flex flex-column grow svelte-c0bh97"),v(N,"class","window-controls flex flex-row svelte-c0bh97"),v(n,"class","flex flex-column svelte-c0bh97"),v(Oe,"id","title"),v(De,"class","button"),v(De,"type","submit"),b(Te,"margin-top","24px"),v(Ae,"id","url"),v(ze,"class","button"),v(ze,"id","open-url"),b(je,"margin-top","24px")},m(e,i){a(e,n,i),s(n,r),s(r,o),s(o,u),u.checked=t[0],s(o,l),s(r,y),s(r,w),s(w,x),x.checked=t[1],s(w,k),s(r,M),s(r,$),s(r,C),s(r,T),s(r,O),s(r,F),s(F,D),D.checked=t[2],s(F,P),s(r,j),s(r,A),s(A,E),E.checked=t[3],s(A,z),s(r,S),s(r,W),s(W,R),R.checked=t[4],s(W,B),s(r,q),s(r,H),s(n,L),s(n,I),s(I,N),s(N,U),s(U,G),s(G,J),s(G,X),m(X,t[11]),s(U,V),s(U,Y),s(Y,K),s(Y,Q),m(Q,t[12]),s(N,Z),s(N,ee),s(ee,te),s(te,ne),s(te,ie),m(ie,t[5]),s(ee,re),s(ee,oe),s(oe,ue),s(oe,se),m(se,t[6]),s(N,ae),s(N,ce),s(ce,le),s(le,de),s(le,fe),m(fe,t[7]),s(ce,he),s(ce,_e),s(_e,pe),s(_e,ve),m(ve,t[8]),s(N,ge),s(N,me),s(me,be),s(be,ye),s(be,we),m(we,t[9]),s(me,xe),s(me,ke),s(ke,Me),s(ke,$e),m($e,t[10]),a(e,Ce,i),a(e,Te,i),s(Te,Oe),m(Oe,t[14]),s(Te,Fe),s(Te,De),a(e,Pe,i),a(e,je,i),s(je,Ae),m(Ae,t[13]),s(je,Ee),s(je,ze),Se||(We=[_(u,"change",t[20]),_(x,"change",t[21]),_($,"click",t[18]),_(T,"click",t[17]),_(D,"change",t[22]),_(E,"change",t[23]),_(R,"change",t[24]),_(H,"click",t[19]),_(X,"input",t[25]),_(Q,"input",t[26]),_(ie,"input",t[27]),_(se,"input",t[28]),_(fe,"input",t[29]),_(ve,"input",t[30]),_(we,"input",t[31]),_($e,"input",t[32]),_(Oe,"input",t[33]),_(Te,"submit",p(t[16])),_(Ae,"input",t[34]),_(je,"submit",p(t[15]))],Se=!0)},p(e,t){1&t[0]&&(u.checked=e[0]),2&t[0]&&(x.checked=e[1]),4&t[0]&&(D.checked=e[2]),8&t[0]&&(E.checked=e[3]),16&t[0]&&(R.checked=e[4]),2048&t[0]&&g(X.value)!==e[11]&&m(X,e[11]),4096&t[0]&&g(Q.value)!==e[12]&&m(Q,e[12]),32&t[0]&&g(ie.value)!==e[5]&&m(ie,e[5]),64&t[0]&&g(se.value)!==e[6]&&m(se,e[6]),128&t[0]&&g(fe.value)!==e[7]&&m(fe,e[7]),256&t[0]&&g(ve.value)!==e[8]&&m(ve,e[8]),512&t[0]&&g(we.value)!==e[9]&&m(we,e[9]),1024&t[0]&&g($e.value)!==e[10]&&m($e,e[10]),16384&t[0]&&Oe.value!==e[14]&&m(Oe,e[14]),8192&t[0]&&Ae.value!==e[13]&&m(Ae,e[13])},i:e,o:e,d(e){e&&c(n),e&&c(Ce),e&&c(Te),e&&c(Pe),e&&c(je),Se=!1,i(We)}}}function Ae(e,t,n){const{setResizable:i,setTitle:r,maximize:o,unmaximize:u,minimize:s,unminimize:a,show:c,hide:l,setDecorations:d,setAlwaysOnTop:f,setWidth:h,setHeight:_,setMinSize:p,setMaxSize:v,setX:m,setY:b,setFullscreen:y,setIcon:w}=Y.manager;let x="https://tauri.studio",k=!0,M=!1,$=!1,C=!1,T=!1,O=600,F=600,D=600,P=600,j=null,A=null,E=300,z=300,S="Awesome Tauri Example!";return e.$$.update=()=>{1&e.$$.dirty[0]&&i(k),2&e.$$.dirty[0]&&(M?o():u()),4&e.$$.dirty[0]&&d($),8&e.$$.dirty[0]&&f(C),16&e.$$.dirty[0]&&y(T),32&e.$$.dirty[0]&&h(O),64&e.$$.dirty[0]&&_(F),384&e.$$.dirty[0]&&D&&P&&p(D,P),1536&e.$$.dirty[0]&&j&&A&&v(j,A),2048&e.$$.dirty[0]&&m(E),4096&e.$$.dirty[0]&&b(z)},[k,M,$,C,T,O,F,D,P,j,A,E,z,x,S,function(){Pe.open(x)},function(){r(S)},function(){l(),setTimeout(c,2e3)},function(){s(),setTimeout(a,2e3)},function(){ce.open({multiple:!1}).then(w)},function(){k=this.checked,n(0,k)},function(){M=this.checked,n(1,M)},function(){$=this.checked,n(2,$)},function(){C=this.checked,n(3,C)},function(){T=this.checked,n(4,T)},function(){E=g(this.value),n(11,E)},function(){z=g(this.value),n(12,z)},function(){O=g(this.value),n(5,O)},function(){F=g(this.value),n(6,F)},function(){D=g(this.value),n(7,D)},function(){P=g(this.value),n(8,P)},function(){j=g(this.value),n(9,j)},function(){A=g(this.value),n(10,A)},function(){S=this.value,n(14,S)},function(){x=this.value,n(13,x)}]}class Ee extends U{constructor(e){var t;super(),document.getElementById("svelte-c0bh97-style")||((t=d("style")).id="svelte-c0bh97-style",t.textContent=".flex.svelte-c0bh97.svelte-c0bh97{display:flex}.flex-row.svelte-c0bh97.svelte-c0bh97{flex-direction:row}.flex-column.svelte-c0bh97.svelte-c0bh97{flex-direction:column}.grow.svelte-c0bh97.svelte-c0bh97{flex-grow:1}.window-controls.svelte-c0bh97 input.svelte-c0bh97{width:50px}",s(document.head,t)),N(this,e,Ae,je,o,{},[-1,-1])}}const ze=[];var Se=G((function(e,t){function n(e,t){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(n){return[2,J.invoke({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:e,handler:J.transformCallback(t)}})]}))}))}function i(e,t){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(n){return[2,J.invoke({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:e,handler:J.transformCallback(t)}})]}))}))}function r(e){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(t){return[2,J.invoke({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:e}})]}))}))}function o(e){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(t){return[2,J.invoke({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:e}})]}))}))}function u(){return J.__awaiter(this,void 0,void 0,(function(){return J.__generator(this,(function(e){return[2,J.invoke({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}})]}))}))}var s=Object.freeze({__proto__:null,register:n,registerAll:i,isRegistered:r,unregister:o,unregisterAll:u});t.globalShortcut=s,t.isRegistered=r,t.register=n,t.registerAll=i,t.unregister=o,t.unregisterAll=u})),We=G((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isRegistered=Se.isRegistered,t.register=Se.register,t.registerAll=Se.registerAll,t.unregister=Se.unregister,t.unregisterAll=Se.unregisterAll}));function Re(e,t,n){const i=e.slice();return i[9]=t[n],i}function Be(e){let t,n,i,r,o,u,l=e[9]+"";function p(){return e[8](e[9])}return{c(){t=d("div"),n=f(l),i=h(),r=d("button"),r.textContent="Unregister",v(r,"type","button")},m(e,c){a(e,t,c),s(t,n),s(t,i),s(t,r),o||(u=_(r,"click",p),o=!0)},p(t,i){e=t,2&i&&l!==(l=e[9]+"")&&function(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}(n,l)},d(e){e&&c(t),o=!1,u()}}}function qe(t){let n,i,r;return{c(){n=d("button"),n.textContent="Unregister all",v(n,"type","button")},m(e,o){a(e,n,o),i||(r=_(n,"click",t[5]),i=!0)},p:e,d(e){e&&c(n),i=!1,r()}}}function He(t){let n,r,o,u,f,p,g,y,w,x,k=t[1],M=[];for(let e=0;e{const e=r.indexOf(a);-1!==e&&r.splice(e,1),0===r.length&&(i(),i=null)}}}}([]);u(t,a,(e=>i(1,r=e)));let c="CmdOrControl+X";function l(e){const t=e;We.unregister(t).then((()=>{a.update((e=>e.filter((e=>e!==t)))),s(`Shortcut ${t} unregistered`)})).catch(s)}return t.$$set=e=>{"onMessage"in e&&i(6,s=e.onMessage)},[c,r,a,function(){const e=c;We.register(e,(()=>{s(`Shortcut ${e} triggered`)})).then((()=>{a.update((t=>[...t,e])),s(`Shortcut ${e} registered successfully`)})).catch(s)},l,function(){We.unregisterAll().then((()=>{a.update((()=>[])),s("Unregistered all shortcuts")})).catch(s)},s,function(){c=this.value,i(0,c)},e=>l(e)]}class Ie extends U{constructor(e){super(),N(this,e,Le,He,o,{onMessage:6})}}function Ne(e,t,n){const i=e.slice();return i[7]=t[n],i}function Ue(e){let t,n,i,r,o,u,l,p,g,m,b,y,w,x=e[7].label+"";function k(){return e[6](e[7])}var M=e[7].component;function $(e){return{props:{onMessage:e[4]}}}return M&&(g=new M($(e))),{c(){t=d("div"),n=d("input"),r=h(),o=d("label"),u=f(x),l=h(),p=d("div"),g&&q(g.$$.fragment),m=h(),v(n,"id",`tab-${e[7].label}`),v(n,"type","radio"),n.checked=i=e[7].label===e[0],v(o,"for",`tab-${e[7].label}`),v(o,"class","tabber"),v(p,"class","content"),v(t,"class","tab")},m(e,i){a(e,t,i),s(t,n),s(t,r),s(t,o),s(o,u),s(t,l),s(t,p),g&&H(g,p,null),s(t,m),b=!0,y||(w=_(o,"click",k),y=!0)},p(t,r){if(e=t,(!b||1&r&&i!==(i=e[7].label===e[0]))&&(n.checked=i),M!==(M=e[7].component)){if(g){S();const e=g;B(e.$$.fragment,1,0,(()=>{L(e,1)})),W()}M?(g=new M($(e)),q(g.$$.fragment),R(g.$$.fragment,1),H(g,p,null)):g=null}},i(e){b||(g&&R(g.$$.fragment,e),b=!0)},o(e){g&&B(g.$$.fragment,e),b=!1},d(e){e&&c(t),g&&L(g),y=!1,w()}}}function Ge(e){let t,n,i,r,o,u,f,p,g,m,b,y,w,x,k=e[2],M=[];for(let t=0;tB(M[e],1,1,(()=>{M[e]=null}));return{c(){t=d("main"),n=d("div"),i=d("img"),o=h(),u=d("div"),f=d("div");for(let e=0;eTauri Documentation\n    \n Github Repo\n    \n Source for this App',i.src!==(r="icon.png")&&v(i,"src","icon.png"),v(i,"class","logo"),v(i,"alt","logo"),v(n,"class","logo-container"),v(f,"class","tabs"),v(u,"class","tabs-container"),v(g,"id","response"),v(b,"class","bottom")},m(r,c){a(r,t,c),s(t,n),s(n,i),s(t,o),s(t,u),s(u,f);for(let e=0;eu(e)]}return new class extends U{constructor(e){super(),N(this,e,Je,Ge,o,{})}}({target:document.body})}(); +//# sourceMappingURL=bundle.js.map diff --git a/examples/api/public/build/bundle.js.map b/examples/api/public/build/bundle.js.map new file mode 100644 index 000000000..05c97fb6f --- /dev/null +++ b/examples/api/public/build/bundle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.js","sources":["../../node_modules/svelte/internal/index.mjs","../../../../api/dist/tauri-343a48b5.js","../../../../api/dist/event-63c80523.js","../../../../api/dist/window-718f29c1.js","../../../../api/dist/window.js","../../../../api/dist/cli-574287de.js","../../../../api/dist/cli.js","../../src/components/Cli.svelte","../../../../api/dist/event-b61a4d98.js","../../../../api/dist/event.js","../../../../api/dist/tauri.js","../../src/components/Communication.svelte","../../../../api/dist/dialog-d01564a8.js","../../../../api/dist/dialog.js","../../../../api/dist/fs-29afcf6e.js","../../../../api/dist/fs.js","../../src/components/Dialog.svelte","../../src/components/FileSystem.svelte","../../../../api/dist/http-924906a9.js","../../../../api/dist/http.js","../../src/components/Http.svelte","../../src/components/Notifications.svelte","../../../../api/dist/shell-e4aceb63.js","../../../../api/dist/shell.js","../../src/components/Window.svelte","../../node_modules/svelte/store/index.mjs","../../../../api/dist/globalShortcut-3b17b201.js","../../../../api/dist/globalShortcut.js","../../src/components/Shortcuts.svelte","../../src/App.svelte","../../src/main.js"],"sourcesContent":["function noop() { }\nconst identity = x => x;\nfunction assign(tar, src) {\n // @ts-ignore\n for (const k in src)\n tar[k] = src[k];\n return tar;\n}\nfunction is_promise(value) {\n return value && typeof value === 'object' && typeof value.then === 'function';\n}\nfunction add_location(element, file, line, column, char) {\n element.__svelte_meta = {\n loc: { file, line, column, char }\n };\n}\nfunction run(fn) {\n return fn();\n}\nfunction blank_object() {\n return Object.create(null);\n}\nfunction run_all(fns) {\n fns.forEach(run);\n}\nfunction is_function(thing) {\n return typeof thing === 'function';\n}\nfunction safe_not_equal(a, b) {\n return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');\n}\nfunction not_equal(a, b) {\n return a != a ? b == b : a !== b;\n}\nfunction is_empty(obj) {\n return Object.keys(obj).length === 0;\n}\nfunction validate_store(store, name) {\n if (store != null && typeof store.subscribe !== 'function') {\n throw new Error(`'${name}' is not a store with a 'subscribe' method`);\n }\n}\nfunction subscribe(store, ...callbacks) {\n if (store == null) {\n return noop;\n }\n const unsub = store.subscribe(...callbacks);\n return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;\n}\nfunction get_store_value(store) {\n let value;\n subscribe(store, _ => value = _)();\n return value;\n}\nfunction component_subscribe(component, store, callback) {\n component.$$.on_destroy.push(subscribe(store, callback));\n}\nfunction create_slot(definition, ctx, $$scope, fn) {\n if (definition) {\n const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);\n return definition[0](slot_ctx);\n }\n}\nfunction get_slot_context(definition, ctx, $$scope, fn) {\n return definition[1] && fn\n ? assign($$scope.ctx.slice(), definition[1](fn(ctx)))\n : $$scope.ctx;\n}\nfunction get_slot_changes(definition, $$scope, dirty, fn) {\n if (definition[2] && fn) {\n const lets = definition[2](fn(dirty));\n if ($$scope.dirty === undefined) {\n return lets;\n }\n if (typeof lets === 'object') {\n const merged = [];\n const len = Math.max($$scope.dirty.length, lets.length);\n for (let i = 0; i < len; i += 1) {\n merged[i] = $$scope.dirty[i] | lets[i];\n }\n return merged;\n }\n return $$scope.dirty | lets;\n }\n return $$scope.dirty;\n}\nfunction update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) {\n const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n if (slot_changes) {\n const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n slot.p(slot_context, slot_changes);\n }\n}\nfunction update_slot_spread(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_spread_changes_fn, get_slot_context_fn) {\n const slot_changes = get_slot_spread_changes_fn(dirty) | get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n if (slot_changes) {\n const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n slot.p(slot_context, slot_changes);\n }\n}\nfunction exclude_internal_props(props) {\n const result = {};\n for (const k in props)\n if (k[0] !== '$')\n result[k] = props[k];\n return result;\n}\nfunction compute_rest_props(props, keys) {\n const rest = {};\n keys = new Set(keys);\n for (const k in props)\n if (!keys.has(k) && k[0] !== '$')\n rest[k] = props[k];\n return rest;\n}\nfunction compute_slots(slots) {\n const result = {};\n for (const key in slots) {\n result[key] = true;\n }\n return result;\n}\nfunction once(fn) {\n let ran = false;\n return function (...args) {\n if (ran)\n return;\n ran = true;\n fn.call(this, ...args);\n };\n}\nfunction null_to_empty(value) {\n return value == null ? '' : value;\n}\nfunction set_store_value(store, ret, value = ret) {\n store.set(value);\n return ret;\n}\nconst has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\nfunction action_destroyer(action_result) {\n return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;\n}\n\nconst is_client = typeof window !== 'undefined';\nlet now = is_client\n ? () => window.performance.now()\n : () => Date.now();\nlet raf = is_client ? cb => requestAnimationFrame(cb) : noop;\n// used internally for testing\nfunction set_now(fn) {\n now = fn;\n}\nfunction set_raf(fn) {\n raf = fn;\n}\n\nconst tasks = new Set();\nfunction run_tasks(now) {\n tasks.forEach(task => {\n if (!task.c(now)) {\n tasks.delete(task);\n task.f();\n }\n });\n if (tasks.size !== 0)\n raf(run_tasks);\n}\n/**\n * For testing purposes only!\n */\nfunction clear_loops() {\n tasks.clear();\n}\n/**\n * Creates a new task that runs on each raf frame\n * until it returns a falsy value or is aborted\n */\nfunction loop(callback) {\n let task;\n if (tasks.size === 0)\n raf(run_tasks);\n return {\n promise: new Promise(fulfill => {\n tasks.add(task = { c: callback, f: fulfill });\n }),\n abort() {\n tasks.delete(task);\n }\n };\n}\n\nfunction append(target, node) {\n target.appendChild(node);\n}\nfunction insert(target, node, anchor) {\n target.insertBefore(node, anchor || null);\n}\nfunction detach(node) {\n node.parentNode.removeChild(node);\n}\nfunction destroy_each(iterations, detaching) {\n for (let i = 0; i < iterations.length; i += 1) {\n if (iterations[i])\n iterations[i].d(detaching);\n }\n}\nfunction element(name) {\n return document.createElement(name);\n}\nfunction element_is(name, is) {\n return document.createElement(name, { is });\n}\nfunction object_without_properties(obj, exclude) {\n const target = {};\n for (const k in obj) {\n if (has_prop(obj, k)\n // @ts-ignore\n && exclude.indexOf(k) === -1) {\n // @ts-ignore\n target[k] = obj[k];\n }\n }\n return target;\n}\nfunction svg_element(name) {\n return document.createElementNS('http://www.w3.org/2000/svg', name);\n}\nfunction text(data) {\n return document.createTextNode(data);\n}\nfunction space() {\n return text(' ');\n}\nfunction empty() {\n return text('');\n}\nfunction listen(node, event, handler, options) {\n node.addEventListener(event, handler, options);\n return () => node.removeEventListener(event, handler, options);\n}\nfunction prevent_default(fn) {\n return function (event) {\n event.preventDefault();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_propagation(fn) {\n return function (event) {\n event.stopPropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction self(fn) {\n return function (event) {\n // @ts-ignore\n if (event.target === this)\n fn.call(this, event);\n };\n}\nfunction attr(node, attribute, value) {\n if (value == null)\n node.removeAttribute(attribute);\n else if (node.getAttribute(attribute) !== value)\n node.setAttribute(attribute, value);\n}\nfunction set_attributes(node, attributes) {\n // @ts-ignore\n const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);\n for (const key in attributes) {\n if (attributes[key] == null) {\n node.removeAttribute(key);\n }\n else if (key === 'style') {\n node.style.cssText = attributes[key];\n }\n else if (key === '__value') {\n node.value = node[key] = attributes[key];\n }\n else if (descriptors[key] && descriptors[key].set) {\n node[key] = attributes[key];\n }\n else {\n attr(node, key, attributes[key]);\n }\n }\n}\nfunction set_svg_attributes(node, attributes) {\n for (const key in attributes) {\n attr(node, key, attributes[key]);\n }\n}\nfunction set_custom_element_data(node, prop, value) {\n if (prop in node) {\n node[prop] = value;\n }\n else {\n attr(node, prop, value);\n }\n}\nfunction xlink_attr(node, attribute, value) {\n node.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\nfunction get_binding_group_value(group, __value, checked) {\n const value = new Set();\n for (let i = 0; i < group.length; i += 1) {\n if (group[i].checked)\n value.add(group[i].__value);\n }\n if (!checked) {\n value.delete(__value);\n }\n return Array.from(value);\n}\nfunction to_number(value) {\n return value === '' ? null : +value;\n}\nfunction time_ranges_to_array(ranges) {\n const array = [];\n for (let i = 0; i < ranges.length; i += 1) {\n array.push({ start: ranges.start(i), end: ranges.end(i) });\n }\n return array;\n}\nfunction children(element) {\n return Array.from(element.childNodes);\n}\nfunction claim_element(nodes, name, attributes, svg) {\n for (let i = 0; i < nodes.length; i += 1) {\n const node = nodes[i];\n if (node.nodeName === name) {\n let j = 0;\n const remove = [];\n while (j < node.attributes.length) {\n const attribute = node.attributes[j++];\n if (!attributes[attribute.name]) {\n remove.push(attribute.name);\n }\n }\n for (let k = 0; k < remove.length; k++) {\n node.removeAttribute(remove[k]);\n }\n return nodes.splice(i, 1)[0];\n }\n }\n return svg ? svg_element(name) : element(name);\n}\nfunction claim_text(nodes, data) {\n for (let i = 0; i < nodes.length; i += 1) {\n const node = nodes[i];\n if (node.nodeType === 3) {\n node.data = '' + data;\n return nodes.splice(i, 1)[0];\n }\n }\n return text(data);\n}\nfunction claim_space(nodes) {\n return claim_text(nodes, ' ');\n}\nfunction set_data(text, data) {\n data = '' + data;\n if (text.wholeText !== data)\n text.data = data;\n}\nfunction set_input_value(input, value) {\n input.value = value == null ? '' : value;\n}\nfunction set_input_type(input, type) {\n try {\n input.type = type;\n }\n catch (e) {\n // do nothing\n }\n}\nfunction set_style(node, key, value, important) {\n node.style.setProperty(key, value, important ? 'important' : '');\n}\nfunction select_option(select, value) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n if (option.__value === value) {\n option.selected = true;\n return;\n }\n }\n}\nfunction select_options(select, value) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n option.selected = ~value.indexOf(option.__value);\n }\n}\nfunction select_value(select) {\n const selected_option = select.querySelector(':checked') || select.options[0];\n return selected_option && selected_option.__value;\n}\nfunction select_multiple_value(select) {\n return [].map.call(select.querySelectorAll(':checked'), option => option.__value);\n}\n// unfortunately this can't be a constant as that wouldn't be tree-shakeable\n// so we cache the result instead\nlet crossorigin;\nfunction is_crossorigin() {\n if (crossorigin === undefined) {\n crossorigin = false;\n try {\n if (typeof window !== 'undefined' && window.parent) {\n void window.parent.document;\n }\n }\n catch (error) {\n crossorigin = true;\n }\n }\n return crossorigin;\n}\nfunction add_resize_listener(node, fn) {\n const computed_style = getComputedStyle(node);\n if (computed_style.position === 'static') {\n node.style.position = 'relative';\n }\n const iframe = element('iframe');\n iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +\n 'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;');\n iframe.setAttribute('aria-hidden', 'true');\n iframe.tabIndex = -1;\n const crossorigin = is_crossorigin();\n let unsubscribe;\n if (crossorigin) {\n iframe.src = \"data:text/html,\";\n unsubscribe = listen(window, 'message', (event) => {\n if (event.source === iframe.contentWindow)\n fn();\n });\n }\n else {\n iframe.src = 'about:blank';\n iframe.onload = () => {\n unsubscribe = listen(iframe.contentWindow, 'resize', fn);\n };\n }\n append(node, iframe);\n return () => {\n if (crossorigin) {\n unsubscribe();\n }\n else if (unsubscribe && iframe.contentWindow) {\n unsubscribe();\n }\n detach(iframe);\n };\n}\nfunction toggle_class(element, name, toggle) {\n element.classList[toggle ? 'add' : 'remove'](name);\n}\nfunction custom_event(type, detail) {\n const e = document.createEvent('CustomEvent');\n e.initCustomEvent(type, false, false, detail);\n return e;\n}\nfunction query_selector_all(selector, parent = document.body) {\n return Array.from(parent.querySelectorAll(selector));\n}\nclass HtmlTag {\n constructor(anchor = null) {\n this.a = anchor;\n this.e = this.n = null;\n }\n m(html, target, anchor = null) {\n if (!this.e) {\n this.e = element(target.nodeName);\n this.t = target;\n this.h(html);\n }\n this.i(anchor);\n }\n h(html) {\n this.e.innerHTML = html;\n this.n = Array.from(this.e.childNodes);\n }\n i(anchor) {\n for (let i = 0; i < this.n.length; i += 1) {\n insert(this.t, this.n[i], anchor);\n }\n }\n p(html) {\n this.d();\n this.h(html);\n this.i(this.a);\n }\n d() {\n this.n.forEach(detach);\n }\n}\nfunction attribute_to_object(attributes) {\n const result = {};\n for (const attribute of attributes) {\n result[attribute.name] = attribute.value;\n }\n return result;\n}\nfunction get_custom_elements_slots(element) {\n const result = {};\n element.childNodes.forEach((node) => {\n result[node.slot || 'default'] = true;\n });\n return result;\n}\n\nconst active_docs = new Set();\nlet active = 0;\n// https://github.com/darkskyapp/string-hash/blob/master/index.js\nfunction hash(str) {\n let hash = 5381;\n let i = str.length;\n while (i--)\n hash = ((hash << 5) - hash) ^ str.charCodeAt(i);\n return hash >>> 0;\n}\nfunction create_rule(node, a, b, duration, delay, ease, fn, uid = 0) {\n const step = 16.666 / duration;\n let keyframes = '{\\n';\n for (let p = 0; p <= 1; p += step) {\n const t = a + (b - a) * ease(p);\n keyframes += p * 100 + `%{${fn(t, 1 - t)}}\\n`;\n }\n const rule = keyframes + `100% {${fn(b, 1 - b)}}\\n}`;\n const name = `__svelte_${hash(rule)}_${uid}`;\n const doc = node.ownerDocument;\n active_docs.add(doc);\n const stylesheet = doc.__svelte_stylesheet || (doc.__svelte_stylesheet = doc.head.appendChild(element('style')).sheet);\n const current_rules = doc.__svelte_rules || (doc.__svelte_rules = {});\n if (!current_rules[name]) {\n current_rules[name] = true;\n stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length);\n }\n const animation = node.style.animation || '';\n node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`;\n active += 1;\n return name;\n}\nfunction delete_rule(node, name) {\n const previous = (node.style.animation || '').split(', ');\n const next = previous.filter(name\n ? anim => anim.indexOf(name) < 0 // remove specific animation\n : anim => anim.indexOf('__svelte') === -1 // remove all Svelte animations\n );\n const deleted = previous.length - next.length;\n if (deleted) {\n node.style.animation = next.join(', ');\n active -= deleted;\n if (!active)\n clear_rules();\n }\n}\nfunction clear_rules() {\n raf(() => {\n if (active)\n return;\n active_docs.forEach(doc => {\n const stylesheet = doc.__svelte_stylesheet;\n let i = stylesheet.cssRules.length;\n while (i--)\n stylesheet.deleteRule(i);\n doc.__svelte_rules = {};\n });\n active_docs.clear();\n });\n}\n\nfunction create_animation(node, from, fn, params) {\n if (!from)\n return noop;\n const to = node.getBoundingClientRect();\n if (from.left === to.left && from.right === to.right && from.top === to.top && from.bottom === to.bottom)\n return noop;\n const { delay = 0, duration = 300, easing = identity, \n // @ts-ignore todo: should this be separated from destructuring? Or start/end added to public api and documentation?\n start: start_time = now() + delay, \n // @ts-ignore todo:\n end = start_time + duration, tick = noop, css } = fn(node, { from, to }, params);\n let running = true;\n let started = false;\n let name;\n function start() {\n if (css) {\n name = create_rule(node, 0, 1, duration, delay, easing, css);\n }\n if (!delay) {\n started = true;\n }\n }\n function stop() {\n if (css)\n delete_rule(node, name);\n running = false;\n }\n loop(now => {\n if (!started && now >= start_time) {\n started = true;\n }\n if (started && now >= end) {\n tick(1, 0);\n stop();\n }\n if (!running) {\n return false;\n }\n if (started) {\n const p = now - start_time;\n const t = 0 + 1 * easing(p / duration);\n tick(t, 1 - t);\n }\n return true;\n });\n start();\n tick(0, 1);\n return stop;\n}\nfunction fix_position(node) {\n const style = getComputedStyle(node);\n if (style.position !== 'absolute' && style.position !== 'fixed') {\n const { width, height } = style;\n const a = node.getBoundingClientRect();\n node.style.position = 'absolute';\n node.style.width = width;\n node.style.height = height;\n add_transform(node, a);\n }\n}\nfunction add_transform(node, a) {\n const b = node.getBoundingClientRect();\n if (a.left !== b.left || a.top !== b.top) {\n const style = getComputedStyle(node);\n const transform = style.transform === 'none' ? '' : style.transform;\n node.style.transform = `${transform} translate(${a.left - b.left}px, ${a.top - b.top}px)`;\n }\n}\n\nlet current_component;\nfunction set_current_component(component) {\n current_component = component;\n}\nfunction get_current_component() {\n if (!current_component)\n throw new Error('Function called outside component initialization');\n return current_component;\n}\nfunction beforeUpdate(fn) {\n get_current_component().$$.before_update.push(fn);\n}\nfunction onMount(fn) {\n get_current_component().$$.on_mount.push(fn);\n}\nfunction afterUpdate(fn) {\n get_current_component().$$.after_update.push(fn);\n}\nfunction onDestroy(fn) {\n get_current_component().$$.on_destroy.push(fn);\n}\nfunction createEventDispatcher() {\n const component = get_current_component();\n return (type, detail) => {\n const callbacks = component.$$.callbacks[type];\n if (callbacks) {\n // TODO are there situations where events could be dispatched\n // in a server (non-DOM) environment?\n const event = custom_event(type, detail);\n callbacks.slice().forEach(fn => {\n fn.call(component, event);\n });\n }\n };\n}\nfunction setContext(key, context) {\n get_current_component().$$.context.set(key, context);\n}\nfunction getContext(key) {\n return get_current_component().$$.context.get(key);\n}\nfunction hasContext(key) {\n return get_current_component().$$.context.has(key);\n}\n// TODO figure out if we still want to support\n// shorthand events, or if we want to implement\n// a real bubbling mechanism\nfunction bubble(component, event) {\n const callbacks = component.$$.callbacks[event.type];\n if (callbacks) {\n callbacks.slice().forEach(fn => fn(event));\n }\n}\n\nconst dirty_components = [];\nconst intros = { enabled: false };\nconst binding_callbacks = [];\nconst render_callbacks = [];\nconst flush_callbacks = [];\nconst resolved_promise = Promise.resolve();\nlet update_scheduled = false;\nfunction schedule_update() {\n if (!update_scheduled) {\n update_scheduled = true;\n resolved_promise.then(flush);\n }\n}\nfunction tick() {\n schedule_update();\n return resolved_promise;\n}\nfunction add_render_callback(fn) {\n render_callbacks.push(fn);\n}\nfunction add_flush_callback(fn) {\n flush_callbacks.push(fn);\n}\nlet flushing = false;\nconst seen_callbacks = new Set();\nfunction flush() {\n if (flushing)\n return;\n flushing = true;\n do {\n // first, call beforeUpdate functions\n // and update components\n for (let i = 0; i < dirty_components.length; i += 1) {\n const component = dirty_components[i];\n set_current_component(component);\n update(component.$$);\n }\n set_current_component(null);\n dirty_components.length = 0;\n while (binding_callbacks.length)\n binding_callbacks.pop()();\n // then, once components are updated, call\n // afterUpdate functions. This may cause\n // subsequent updates...\n for (let i = 0; i < render_callbacks.length; i += 1) {\n const callback = render_callbacks[i];\n if (!seen_callbacks.has(callback)) {\n // ...so guard against infinite loops\n seen_callbacks.add(callback);\n callback();\n }\n }\n render_callbacks.length = 0;\n } while (dirty_components.length);\n while (flush_callbacks.length) {\n flush_callbacks.pop()();\n }\n update_scheduled = false;\n flushing = false;\n seen_callbacks.clear();\n}\nfunction update($$) {\n if ($$.fragment !== null) {\n $$.update();\n run_all($$.before_update);\n const dirty = $$.dirty;\n $$.dirty = [-1];\n $$.fragment && $$.fragment.p($$.ctx, dirty);\n $$.after_update.forEach(add_render_callback);\n }\n}\n\nlet promise;\nfunction wait() {\n if (!promise) {\n promise = Promise.resolve();\n promise.then(() => {\n promise = null;\n });\n }\n return promise;\n}\nfunction dispatch(node, direction, kind) {\n node.dispatchEvent(custom_event(`${direction ? 'intro' : 'outro'}${kind}`));\n}\nconst outroing = new Set();\nlet outros;\nfunction group_outros() {\n outros = {\n r: 0,\n c: [],\n p: outros // parent group\n };\n}\nfunction check_outros() {\n if (!outros.r) {\n run_all(outros.c);\n }\n outros = outros.p;\n}\nfunction transition_in(block, local) {\n if (block && block.i) {\n outroing.delete(block);\n block.i(local);\n }\n}\nfunction transition_out(block, local, detach, callback) {\n if (block && block.o) {\n if (outroing.has(block))\n return;\n outroing.add(block);\n outros.c.push(() => {\n outroing.delete(block);\n if (callback) {\n if (detach)\n block.d(1);\n callback();\n }\n });\n block.o(local);\n }\n}\nconst null_transition = { duration: 0 };\nfunction create_in_transition(node, fn, params) {\n let config = fn(node, params);\n let running = false;\n let animation_name;\n let task;\n let uid = 0;\n function cleanup() {\n if (animation_name)\n delete_rule(node, animation_name);\n }\n function go() {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n if (css)\n animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++);\n tick(0, 1);\n const start_time = now() + delay;\n const end_time = start_time + duration;\n if (task)\n task.abort();\n running = true;\n add_render_callback(() => dispatch(node, true, 'start'));\n task = loop(now => {\n if (running) {\n if (now >= end_time) {\n tick(1, 0);\n dispatch(node, true, 'end');\n cleanup();\n return running = false;\n }\n if (now >= start_time) {\n const t = easing((now - start_time) / duration);\n tick(t, 1 - t);\n }\n }\n return running;\n });\n }\n let started = false;\n return {\n start() {\n if (started)\n return;\n delete_rule(node);\n if (is_function(config)) {\n config = config();\n wait().then(go);\n }\n else {\n go();\n }\n },\n invalidate() {\n started = false;\n },\n end() {\n if (running) {\n cleanup();\n running = false;\n }\n }\n };\n}\nfunction create_out_transition(node, fn, params) {\n let config = fn(node, params);\n let running = true;\n let animation_name;\n const group = outros;\n group.r += 1;\n function go() {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n if (css)\n animation_name = create_rule(node, 1, 0, duration, delay, easing, css);\n const start_time = now() + delay;\n const end_time = start_time + duration;\n add_render_callback(() => dispatch(node, false, 'start'));\n loop(now => {\n if (running) {\n if (now >= end_time) {\n tick(0, 1);\n dispatch(node, false, 'end');\n if (!--group.r) {\n // this will result in `end()` being called,\n // so we don't need to clean up here\n run_all(group.c);\n }\n return false;\n }\n if (now >= start_time) {\n const t = easing((now - start_time) / duration);\n tick(1 - t, t);\n }\n }\n return running;\n });\n }\n if (is_function(config)) {\n wait().then(() => {\n // @ts-ignore\n config = config();\n go();\n });\n }\n else {\n go();\n }\n return {\n end(reset) {\n if (reset && config.tick) {\n config.tick(1, 0);\n }\n if (running) {\n if (animation_name)\n delete_rule(node, animation_name);\n running = false;\n }\n }\n };\n}\nfunction create_bidirectional_transition(node, fn, params, intro) {\n let config = fn(node, params);\n let t = intro ? 0 : 1;\n let running_program = null;\n let pending_program = null;\n let animation_name = null;\n function clear_animation() {\n if (animation_name)\n delete_rule(node, animation_name);\n }\n function init(program, duration) {\n const d = program.b - t;\n duration *= Math.abs(d);\n return {\n a: t,\n b: program.b,\n d,\n duration,\n start: program.start,\n end: program.start + duration,\n group: program.group\n };\n }\n function go(b) {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n const program = {\n start: now() + delay,\n b\n };\n if (!b) {\n // @ts-ignore todo: improve typings\n program.group = outros;\n outros.r += 1;\n }\n if (running_program || pending_program) {\n pending_program = program;\n }\n else {\n // if this is an intro, and there's a delay, we need to do\n // an initial tick and/or apply CSS animation immediately\n if (css) {\n clear_animation();\n animation_name = create_rule(node, t, b, duration, delay, easing, css);\n }\n if (b)\n tick(0, 1);\n running_program = init(program, duration);\n add_render_callback(() => dispatch(node, b, 'start'));\n loop(now => {\n if (pending_program && now > pending_program.start) {\n running_program = init(pending_program, duration);\n pending_program = null;\n dispatch(node, running_program.b, 'start');\n if (css) {\n clear_animation();\n animation_name = create_rule(node, t, running_program.b, running_program.duration, 0, easing, config.css);\n }\n }\n if (running_program) {\n if (now >= running_program.end) {\n tick(t = running_program.b, 1 - t);\n dispatch(node, running_program.b, 'end');\n if (!pending_program) {\n // we're done\n if (running_program.b) {\n // intro — we can tidy up immediately\n clear_animation();\n }\n else {\n // outro — needs to be coordinated\n if (!--running_program.group.r)\n run_all(running_program.group.c);\n }\n }\n running_program = null;\n }\n else if (now >= running_program.start) {\n const p = now - running_program.start;\n t = running_program.a + running_program.d * easing(p / running_program.duration);\n tick(t, 1 - t);\n }\n }\n return !!(running_program || pending_program);\n });\n }\n }\n return {\n run(b) {\n if (is_function(config)) {\n wait().then(() => {\n // @ts-ignore\n config = config();\n go(b);\n });\n }\n else {\n go(b);\n }\n },\n end() {\n clear_animation();\n running_program = pending_program = null;\n }\n };\n}\n\nfunction handle_promise(promise, info) {\n const token = info.token = {};\n function update(type, index, key, value) {\n if (info.token !== token)\n return;\n info.resolved = value;\n let child_ctx = info.ctx;\n if (key !== undefined) {\n child_ctx = child_ctx.slice();\n child_ctx[key] = value;\n }\n const block = type && (info.current = type)(child_ctx);\n let needs_flush = false;\n if (info.block) {\n if (info.blocks) {\n info.blocks.forEach((block, i) => {\n if (i !== index && block) {\n group_outros();\n transition_out(block, 1, 1, () => {\n if (info.blocks[i] === block) {\n info.blocks[i] = null;\n }\n });\n check_outros();\n }\n });\n }\n else {\n info.block.d(1);\n }\n block.c();\n transition_in(block, 1);\n block.m(info.mount(), info.anchor);\n needs_flush = true;\n }\n info.block = block;\n if (info.blocks)\n info.blocks[index] = block;\n if (needs_flush) {\n flush();\n }\n }\n if (is_promise(promise)) {\n const current_component = get_current_component();\n promise.then(value => {\n set_current_component(current_component);\n update(info.then, 1, info.value, value);\n set_current_component(null);\n }, error => {\n set_current_component(current_component);\n update(info.catch, 2, info.error, error);\n set_current_component(null);\n if (!info.hasCatch) {\n throw error;\n }\n });\n // if we previously had a then/catch block, destroy it\n if (info.current !== info.pending) {\n update(info.pending, 0);\n return true;\n }\n }\n else {\n if (info.current !== info.then) {\n update(info.then, 1, info.value, promise);\n return true;\n }\n info.resolved = promise;\n }\n}\n\nconst globals = (typeof window !== 'undefined'\n ? window\n : typeof globalThis !== 'undefined'\n ? globalThis\n : global);\n\nfunction destroy_block(block, lookup) {\n block.d(1);\n lookup.delete(block.key);\n}\nfunction outro_and_destroy_block(block, lookup) {\n transition_out(block, 1, 1, () => {\n lookup.delete(block.key);\n });\n}\nfunction fix_and_destroy_block(block, lookup) {\n block.f();\n destroy_block(block, lookup);\n}\nfunction fix_and_outro_and_destroy_block(block, lookup) {\n block.f();\n outro_and_destroy_block(block, lookup);\n}\nfunction update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block, next, get_context) {\n let o = old_blocks.length;\n let n = list.length;\n let i = o;\n const old_indexes = {};\n while (i--)\n old_indexes[old_blocks[i].key] = i;\n const new_blocks = [];\n const new_lookup = new Map();\n const deltas = new Map();\n i = n;\n while (i--) {\n const child_ctx = get_context(ctx, list, i);\n const key = get_key(child_ctx);\n let block = lookup.get(key);\n if (!block) {\n block = create_each_block(key, child_ctx);\n block.c();\n }\n else if (dynamic) {\n block.p(child_ctx, dirty);\n }\n new_lookup.set(key, new_blocks[i] = block);\n if (key in old_indexes)\n deltas.set(key, Math.abs(i - old_indexes[key]));\n }\n const will_move = new Set();\n const did_move = new Set();\n function insert(block) {\n transition_in(block, 1);\n block.m(node, next);\n lookup.set(block.key, block);\n next = block.first;\n n--;\n }\n while (o && n) {\n const new_block = new_blocks[n - 1];\n const old_block = old_blocks[o - 1];\n const new_key = new_block.key;\n const old_key = old_block.key;\n if (new_block === old_block) {\n // do nothing\n next = new_block.first;\n o--;\n n--;\n }\n else if (!new_lookup.has(old_key)) {\n // remove old block\n destroy(old_block, lookup);\n o--;\n }\n else if (!lookup.has(new_key) || will_move.has(new_key)) {\n insert(new_block);\n }\n else if (did_move.has(old_key)) {\n o--;\n }\n else if (deltas.get(new_key) > deltas.get(old_key)) {\n did_move.add(new_key);\n insert(new_block);\n }\n else {\n will_move.add(old_key);\n o--;\n }\n }\n while (o--) {\n const old_block = old_blocks[o];\n if (!new_lookup.has(old_block.key))\n destroy(old_block, lookup);\n }\n while (n)\n insert(new_blocks[n - 1]);\n return new_blocks;\n}\nfunction validate_each_keys(ctx, list, get_context, get_key) {\n const keys = new Set();\n for (let i = 0; i < list.length; i++) {\n const key = get_key(get_context(ctx, list, i));\n if (keys.has(key)) {\n throw new Error('Cannot have duplicate keys in a keyed each');\n }\n keys.add(key);\n }\n}\n\nfunction get_spread_update(levels, updates) {\n const update = {};\n const to_null_out = {};\n const accounted_for = { $$scope: 1 };\n let i = levels.length;\n while (i--) {\n const o = levels[i];\n const n = updates[i];\n if (n) {\n for (const key in o) {\n if (!(key in n))\n to_null_out[key] = 1;\n }\n for (const key in n) {\n if (!accounted_for[key]) {\n update[key] = n[key];\n accounted_for[key] = 1;\n }\n }\n levels[i] = n;\n }\n else {\n for (const key in o) {\n accounted_for[key] = 1;\n }\n }\n }\n for (const key in to_null_out) {\n if (!(key in update))\n update[key] = undefined;\n }\n return update;\n}\nfunction get_spread_object(spread_props) {\n return typeof spread_props === 'object' && spread_props !== null ? spread_props : {};\n}\n\n// source: https://html.spec.whatwg.org/multipage/indices.html\nconst boolean_attributes = new Set([\n 'allowfullscreen',\n 'allowpaymentrequest',\n 'async',\n 'autofocus',\n 'autoplay',\n 'checked',\n 'controls',\n 'default',\n 'defer',\n 'disabled',\n 'formnovalidate',\n 'hidden',\n 'ismap',\n 'loop',\n 'multiple',\n 'muted',\n 'nomodule',\n 'novalidate',\n 'open',\n 'playsinline',\n 'readonly',\n 'required',\n 'reversed',\n 'selected'\n]);\n\nconst invalid_attribute_name_character = /[\\s'\">/=\\u{FDD0}-\\u{FDEF}\\u{FFFE}\\u{FFFF}\\u{1FFFE}\\u{1FFFF}\\u{2FFFE}\\u{2FFFF}\\u{3FFFE}\\u{3FFFF}\\u{4FFFE}\\u{4FFFF}\\u{5FFFE}\\u{5FFFF}\\u{6FFFE}\\u{6FFFF}\\u{7FFFE}\\u{7FFFF}\\u{8FFFE}\\u{8FFFF}\\u{9FFFE}\\u{9FFFF}\\u{AFFFE}\\u{AFFFF}\\u{BFFFE}\\u{BFFFF}\\u{CFFFE}\\u{CFFFF}\\u{DFFFE}\\u{DFFFF}\\u{EFFFE}\\u{EFFFF}\\u{FFFFE}\\u{FFFFF}\\u{10FFFE}\\u{10FFFF}]/u;\n// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n// https://infra.spec.whatwg.org/#noncharacter\nfunction spread(args, classes_to_add) {\n const attributes = Object.assign({}, ...args);\n if (classes_to_add) {\n if (attributes.class == null) {\n attributes.class = classes_to_add;\n }\n else {\n attributes.class += ' ' + classes_to_add;\n }\n }\n let str = '';\n Object.keys(attributes).forEach(name => {\n if (invalid_attribute_name_character.test(name))\n return;\n const value = attributes[name];\n if (value === true)\n str += ' ' + name;\n else if (boolean_attributes.has(name.toLowerCase())) {\n if (value)\n str += ' ' + name;\n }\n else if (value != null) {\n str += ` ${name}=\"${String(value).replace(/\"/g, '"').replace(/'/g, ''')}\"`;\n }\n });\n return str;\n}\nconst escaped = {\n '\"': '"',\n \"'\": ''',\n '&': '&',\n '<': '<',\n '>': '>'\n};\nfunction escape(html) {\n return String(html).replace(/[\"'&<>]/g, match => escaped[match]);\n}\nfunction each(items, fn) {\n let str = '';\n for (let i = 0; i < items.length; i += 1) {\n str += fn(items[i], i);\n }\n return str;\n}\nconst missing_component = {\n $$render: () => ''\n};\nfunction validate_component(component, name) {\n if (!component || !component.$$render) {\n if (name === 'svelte:component')\n name += ' this={...}';\n throw new Error(`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules`);\n }\n return component;\n}\nfunction debug(file, line, column, values) {\n console.log(`{@debug} ${file ? file + ' ' : ''}(${line}:${column})`); // eslint-disable-line no-console\n console.log(values); // eslint-disable-line no-console\n return '';\n}\nlet on_destroy;\nfunction create_ssr_component(fn) {\n function $$render(result, props, bindings, slots) {\n const parent_component = current_component;\n const $$ = {\n on_destroy,\n context: new Map(parent_component ? parent_component.$$.context : []),\n // these will be immediately discarded\n on_mount: [],\n before_update: [],\n after_update: [],\n callbacks: blank_object()\n };\n set_current_component({ $$ });\n const html = fn(result, props, bindings, slots);\n set_current_component(parent_component);\n return html;\n }\n return {\n render: (props = {}, options = {}) => {\n on_destroy = [];\n const result = { title: '', head: '', css: new Set() };\n const html = $$render(result, props, {}, options);\n run_all(on_destroy);\n return {\n html,\n css: {\n code: Array.from(result.css).map(css => css.code).join('\\n'),\n map: null // TODO\n },\n head: result.title + result.head\n };\n },\n $$render\n };\n}\nfunction add_attribute(name, value, boolean) {\n if (value == null || (boolean && !value))\n return '';\n return ` ${name}${value === true ? '' : `=${typeof value === 'string' ? JSON.stringify(escape(value)) : `\"${value}\"`}`}`;\n}\nfunction add_classes(classes) {\n return classes ? ` class=\"${classes}\"` : '';\n}\n\nfunction bind(component, name, callback) {\n const index = component.$$.props[name];\n if (index !== undefined) {\n component.$$.bound[index] = callback;\n callback(component.$$.ctx[index]);\n }\n}\nfunction create_component(block) {\n block && block.c();\n}\nfunction claim_component(block, parent_nodes) {\n block && block.l(parent_nodes);\n}\nfunction mount_component(component, target, anchor, customElement) {\n const { fragment, on_mount, on_destroy, after_update } = component.$$;\n fragment && fragment.m(target, anchor);\n if (!customElement) {\n // onMount happens before the initial afterUpdate\n add_render_callback(() => {\n const new_on_destroy = on_mount.map(run).filter(is_function);\n if (on_destroy) {\n on_destroy.push(...new_on_destroy);\n }\n else {\n // Edge case - component was destroyed immediately,\n // most likely as a result of a binding initialising\n run_all(new_on_destroy);\n }\n component.$$.on_mount = [];\n });\n }\n after_update.forEach(add_render_callback);\n}\nfunction destroy_component(component, detaching) {\n const $$ = component.$$;\n if ($$.fragment !== null) {\n run_all($$.on_destroy);\n $$.fragment && $$.fragment.d(detaching);\n // TODO null out other refs, including component.$$ (but need to\n // preserve final state?)\n $$.on_destroy = $$.fragment = null;\n $$.ctx = [];\n }\n}\nfunction make_dirty(component, i) {\n if (component.$$.dirty[0] === -1) {\n dirty_components.push(component);\n schedule_update();\n component.$$.dirty.fill(0);\n }\n component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));\n}\nfunction init(component, options, instance, create_fragment, not_equal, props, dirty = [-1]) {\n const parent_component = current_component;\n set_current_component(component);\n const $$ = component.$$ = {\n fragment: null,\n ctx: null,\n // state\n props,\n update: noop,\n not_equal,\n bound: blank_object(),\n // lifecycle\n on_mount: [],\n on_destroy: [],\n on_disconnect: [],\n before_update: [],\n after_update: [],\n context: new Map(parent_component ? parent_component.$$.context : []),\n // everything else\n callbacks: blank_object(),\n dirty,\n skip_bound: false\n };\n let ready = false;\n $$.ctx = instance\n ? instance(component, options.props || {}, (i, ret, ...rest) => {\n const value = rest.length ? rest[0] : ret;\n if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {\n if (!$$.skip_bound && $$.bound[i])\n $$.bound[i](value);\n if (ready)\n make_dirty(component, i);\n }\n return ret;\n })\n : [];\n $$.update();\n ready = true;\n run_all($$.before_update);\n // `false` as a special case of no DOM component\n $$.fragment = create_fragment ? create_fragment($$.ctx) : false;\n if (options.target) {\n if (options.hydrate) {\n const nodes = children(options.target);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n $$.fragment && $$.fragment.l(nodes);\n nodes.forEach(detach);\n }\n else {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n $$.fragment && $$.fragment.c();\n }\n if (options.intro)\n transition_in(component.$$.fragment);\n mount_component(component, options.target, options.anchor, options.customElement);\n flush();\n }\n set_current_component(parent_component);\n}\nlet SvelteElement;\nif (typeof HTMLElement === 'function') {\n SvelteElement = class extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n }\n connectedCallback() {\n const { on_mount } = this.$$;\n this.$$.on_disconnect = on_mount.map(run).filter(is_function);\n // @ts-ignore todo: improve typings\n for (const key in this.$$.slotted) {\n // @ts-ignore todo: improve typings\n this.appendChild(this.$$.slotted[key]);\n }\n }\n attributeChangedCallback(attr, _oldValue, newValue) {\n this[attr] = newValue;\n }\n disconnectedCallback() {\n run_all(this.$$.on_disconnect);\n }\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n // TODO should this delegate to addEventListener?\n const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n };\n}\n/**\n * Base class for Svelte components. Used when dev=false.\n */\nclass SvelteComponent {\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n}\n\nfunction dispatch_dev(type, detail) {\n document.dispatchEvent(custom_event(type, Object.assign({ version: '3.35.0' }, detail)));\n}\nfunction append_dev(target, node) {\n dispatch_dev('SvelteDOMInsert', { target, node });\n append(target, node);\n}\nfunction insert_dev(target, node, anchor) {\n dispatch_dev('SvelteDOMInsert', { target, node, anchor });\n insert(target, node, anchor);\n}\nfunction detach_dev(node) {\n dispatch_dev('SvelteDOMRemove', { node });\n detach(node);\n}\nfunction detach_between_dev(before, after) {\n while (before.nextSibling && before.nextSibling !== after) {\n detach_dev(before.nextSibling);\n }\n}\nfunction detach_before_dev(after) {\n while (after.previousSibling) {\n detach_dev(after.previousSibling);\n }\n}\nfunction detach_after_dev(before) {\n while (before.nextSibling) {\n detach_dev(before.nextSibling);\n }\n}\nfunction listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) {\n const modifiers = options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : [];\n if (has_prevent_default)\n modifiers.push('preventDefault');\n if (has_stop_propagation)\n modifiers.push('stopPropagation');\n dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });\n const dispose = listen(node, event, handler, options);\n return () => {\n dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });\n dispose();\n };\n}\nfunction attr_dev(node, attribute, value) {\n attr(node, attribute, value);\n if (value == null)\n dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute });\n else\n dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });\n}\nfunction prop_dev(node, property, value) {\n node[property] = value;\n dispatch_dev('SvelteDOMSetProperty', { node, property, value });\n}\nfunction dataset_dev(node, property, value) {\n node.dataset[property] = value;\n dispatch_dev('SvelteDOMSetDataset', { node, property, value });\n}\nfunction set_data_dev(text, data) {\n data = '' + data;\n if (text.wholeText === data)\n return;\n dispatch_dev('SvelteDOMSetData', { node: text, data });\n text.data = data;\n}\nfunction validate_each_argument(arg) {\n if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {\n let msg = '{#each} only iterates over array-like objects.';\n if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {\n msg += ' You can use a spread to convert this iterable into an array.';\n }\n throw new Error(msg);\n }\n}\nfunction validate_slots(name, slot, keys) {\n for (const slot_key of Object.keys(slot)) {\n if (!~keys.indexOf(slot_key)) {\n console.warn(`<${name}> received an unexpected slot \"${slot_key}\".`);\n }\n }\n}\n/**\n * Base class for Svelte components with some minor dev-enhancements. Used when dev=true.\n */\nclass SvelteComponentDev extends SvelteComponent {\n constructor(options) {\n if (!options || (!options.target && !options.$$inline)) {\n throw new Error(\"'target' is a required option\");\n }\n super();\n }\n $destroy() {\n super.$destroy();\n this.$destroy = () => {\n console.warn('Component was already destroyed'); // eslint-disable-line no-console\n };\n }\n $capture_state() { }\n $inject_state() { }\n}\n/**\n * Base class to create strongly typed Svelte components.\n * This only exists for typing purposes and should be used in `.d.ts` files.\n *\n * ### Example:\n *\n * You have component library on npm called `component-library`, from which\n * you export a component called `MyComponent`. For Svelte+TypeScript users,\n * you want to provide typings. Therefore you create a `index.d.ts`:\n * ```ts\n * import { SvelteComponentTyped } from \"svelte\";\n * export class MyComponent extends SvelteComponentTyped<{foo: string}> {}\n * ```\n * Typing this makes it possible for IDEs like VS Code with the Svelte extension\n * to provide intellisense and to use the component like this in a Svelte file\n * with TypeScript:\n * ```svelte\n * \n * \n * ```\n *\n * #### Why not make this part of `SvelteComponent(Dev)`?\n * Because\n * ```ts\n * class ASubclassOfSvelteComponent extends SvelteComponent<{foo: string}> {}\n * const component: typeof SvelteComponent = ASubclassOfSvelteComponent;\n * ```\n * will throw a type error, so we need to seperate the more strictly typed class.\n */\nclass SvelteComponentTyped extends SvelteComponentDev {\n constructor(options) {\n super(options);\n }\n}\nfunction loop_guard(timeout) {\n const start = Date.now();\n return () => {\n if (Date.now() - start > timeout) {\n throw new Error('Infinite loop detected');\n }\n };\n}\n\nexport { HtmlTag, SvelteComponent, SvelteComponentDev, SvelteComponentTyped, SvelteElement, action_destroyer, add_attribute, add_classes, add_flush_callback, add_location, add_render_callback, add_resize_listener, add_transform, afterUpdate, append, append_dev, assign, attr, attr_dev, attribute_to_object, beforeUpdate, bind, binding_callbacks, blank_object, bubble, check_outros, children, claim_component, claim_element, claim_space, claim_text, clear_loops, component_subscribe, compute_rest_props, compute_slots, createEventDispatcher, create_animation, create_bidirectional_transition, create_component, create_in_transition, create_out_transition, create_slot, create_ssr_component, current_component, custom_event, dataset_dev, debug, destroy_block, destroy_component, destroy_each, detach, detach_after_dev, detach_before_dev, detach_between_dev, detach_dev, dirty_components, dispatch_dev, each, element, element_is, empty, escape, escaped, exclude_internal_props, fix_and_destroy_block, fix_and_outro_and_destroy_block, fix_position, flush, getContext, get_binding_group_value, get_current_component, get_custom_elements_slots, get_slot_changes, get_slot_context, get_spread_object, get_spread_update, get_store_value, globals, group_outros, handle_promise, hasContext, has_prop, identity, init, insert, insert_dev, intros, invalid_attribute_name_character, is_client, is_crossorigin, is_empty, is_function, is_promise, listen, listen_dev, loop, loop_guard, missing_component, mount_component, noop, not_equal, now, null_to_empty, object_without_properties, onDestroy, onMount, once, outro_and_destroy_block, prevent_default, prop_dev, query_selector_all, raf, run, run_all, safe_not_equal, schedule_update, select_multiple_value, select_option, select_options, select_value, self, setContext, set_attributes, set_current_component, set_custom_element_data, set_data, set_data_dev, set_input_type, set_input_value, set_now, set_raf, set_store_value, set_style, set_svg_attributes, space, spread, stop_propagation, subscribe, svg_element, text, tick, time_ranges_to_array, to_number, toggle_class, transition_in, transition_out, update_keyed_each, update_slot, update_slot_spread, validate_component, validate_each_argument, validate_each_keys, validate_slots, validate_store, xlink_attr };\n","\"use strict\";\n/*! *****************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};function e(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}c((r=r.apply(t,e||[])).next())}))}function n(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},\"function\"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError(\"Generator is already executing.\");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]\n import { getMatches } from \"@tauri-apps/api/cli\";\n\n export let onMessage;\n\n function cliMatches() {\n getMatches()\n .then(onMessage)\n .catch(onMessage);\n }\n\n\n
\n \n
","\"use strict\";var e=require(\"./tauri-343a48b5.js\"),t=require(\"./event-63c80523.js\");function r(r,i){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,t.emit(r,void 0,i)]}))}))}var i=Object.freeze({__proto__:null,emit:r,listen:t.listen,once:t.once});exports.emit=r,exports.event=i;\n","\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0}),require(\"./tauri-343a48b5.js\");var e=require(\"./event-63c80523.js\"),r=require(\"./event-b61a4d98.js\");exports.listen=e.listen,exports.once=e.once,exports.emit=r.emit;\n","\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0});var e=require(\"./tauri-343a48b5.js\");exports.invoke=e.invoke,exports.transformCallback=e.transformCallback;\n","\n\n
\n \n \n \n
\n","\"use strict\";var e=require(\"./tauri-343a48b5.js\");function o(o){return void 0===o&&(o={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){return\"object\"==typeof o&&Object.freeze(o),[2,e.invoke({__tauriModule:\"Dialog\",mainThread:!0,message:{cmd:\"openDialog\",options:o}})]}))}))}function t(o){return void 0===o&&(o={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){return\"object\"==typeof o&&Object.freeze(o),[2,e.invoke({__tauriModule:\"Dialog\",mainThread:!0,message:{cmd:\"saveDialog\",options:o}})]}))}))}var r=Object.freeze({__proto__:null,open:o,save:t});exports.dialog=r,exports.open=o,exports.save=t;\n","\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0}),require(\"./tauri-343a48b5.js\");var e=require(\"./dialog-d01564a8.js\");exports.open=e.open,exports.save=e.save;\n","\"use strict\";var e,t=require(\"./tauri-343a48b5.js\");function r(e,r){return void 0===r&&(r={}),t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(i){return[2,t.invoke({__tauriModule:\"Fs\",message:{cmd:\"readTextFile\",path:e,options:r}})]}))}))}function i(e,r){return void 0===r&&(r={}),t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(i){return[2,t.invoke({__tauriModule:\"Fs\",message:{cmd:\"readBinaryFile\",path:e,options:r}})]}))}))}function o(e,r){return void 0===r&&(r={}),t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(i){return\"object\"==typeof r&&Object.freeze(r),\"object\"==typeof e&&Object.freeze(e),[2,t.invoke({__tauriModule:\"Fs\",message:{cmd:\"writeFile\",path:e.path,contents:e.contents,options:r}})]}))}))}exports.BaseDirectory=void 0,(e=exports.BaseDirectory||(exports.BaseDirectory={}))[e.Audio=1]=\"Audio\",e[e.Cache=2]=\"Cache\",e[e.Config=3]=\"Config\",e[e.Data=4]=\"Data\",e[e.LocalData=5]=\"LocalData\",e[e.Desktop=6]=\"Desktop\",e[e.Document=7]=\"Document\",e[e.Download=8]=\"Download\",e[e.Executable=9]=\"Executable\",e[e.Font=10]=\"Font\",e[e.Home=11]=\"Home\",e[e.Picture=12]=\"Picture\",e[e.Public=13]=\"Public\",e[e.Runtime=14]=\"Runtime\",e[e.Template=15]=\"Template\",e[e.Video=16]=\"Video\",e[e.Resource=17]=\"Resource\",e[e.App=18]=\"App\";function n(e){var t=function(e){if(e.length<65536)return String.fromCharCode.apply(null,Array.from(e));for(var t=\"\",r=e.length,i=0;i\n import {\n open,\n save\n } from '@tauri-apps/api/dialog'\n import {\n readBinaryFile\n } from '@tauri-apps/api/fs'\n\n export let onMessage\n let defaultPath = null\n let filter = null\n let multiple = false\n let directory = false\n\n function arrayBufferToBase64(buffer, callback) {\n var blob = new Blob([buffer], {\n type: \"application/octet-binary\",\n });\n var reader = new FileReader();\n reader.onload = function (evt) {\n var dataurl = evt.target.result;\n callback(dataurl.substr(dataurl.indexOf(\",\") + 1));\n };\n reader.readAsDataURL(blob);\n }\n\n function openDialog() {\n open({\n defaultPath,\n filters: filter ? [{\n name: 'Tauri Example',\n extensions: filter.split(',').map(f => f.trim())\n }] : [],\n multiple,\n directory\n }).then(function (res) {\n if (Array.isArray(res)) {\n onMessage(res)\n } else {\n var pathToRead = res\n var isFile = pathToRead.match(/\\S+\\.\\S+$/g)\n readBinaryFile(pathToRead).then(function (response) {\n if (isFile) {\n if (pathToRead.includes('.png') || pathToRead.includes('.jpg')) {\n arrayBufferToBase64(new Uint8Array(response), function (base64) {\n var src = 'data:image/png;base64,' + base64\n onMessage('')\n })\n } else {\n onMessage(res)\n }\n } else {\n onMessage(res)\n }\n }).catch(onMessage(res))\n }\n }).catch(onMessage)\n }\n\n function saveDialog() {\n save({\n defaultPath,\n filters: filter ? [{\n name: 'Tauri Example',\n extensions: filter.split(',').map(f => f.trim())\n }] : [],\n }).then(onMessage).catch(onMessage)\n }\n\n\n\n\n\n
\n \n \n
\n \n \n
\n
\n \n \n
\n\n \n \n
","\n\n
\n \n \n \n
","\"use strict\";var t,e=require(\"./tauri-343a48b5.js\");exports.ResponseType=void 0,(t=exports.ResponseType||(exports.ResponseType={}))[t.JSON=1]=\"JSON\",t[t.Text=2]=\"Text\",t[t.Binary=3]=\"Binary\";var n=function(){function t(t,e){this.type=t,this.payload=e}return t.form=function(e){return new t(\"Form\",e)},t.json=function(e){return new t(\"Json\",e)},t.text=function(e){return new t(\"Text\",e)},t.bytes=function(e){return new t(\"Bytes\",e)},t}(),r=function(){function t(t){this.id=t}return t.prototype.drop=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){return[2,e.invoke({__tauriModule:\"Http\",message:{cmd:\"dropClient\",client:this.id}})]}))}))},t.prototype.request=function(t){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(n){return[2,e.invoke({__tauriModule:\"Http\",message:{cmd:\"httpRequest\",client:this.id,options:t}})]}))}))},t.prototype.get=function(t,n){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(r){return[2,this.request(e._assign({method:\"GET\",url:t},n))]}))}))},t.prototype.post=function(t,n,r){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(i){return[2,this.request(e._assign({method:\"POST\",url:t,body:n},r))]}))}))},t.prototype.put=function(t,n,r){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(i){return[2,this.request(e._assign({method:\"PUT\",url:t,body:n},r))]}))}))},t.prototype.patch=function(t,n){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(r){return[2,this.request(e._assign({method:\"PATCH\",url:t},n))]}))}))},t.prototype.delete=function(t,n){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(r){return[2,this.request(e._assign({method:\"DELETE\",url:t},n))]}))}))},t}();function i(t){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(n){return[2,e.invoke({__tauriModule:\"Http\",message:{cmd:\"createClient\",options:t}}).then((function(t){return new r(t)}))]}))}))}var o=null;function u(t,n){var r;return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(u){switch(u.label){case 0:return null!==o?[3,2]:[4,i()];case 1:o=u.sent(),u.label=2;case 2:return[2,o.request(e._assign({url:t,method:null!==(r=null==n?void 0:n.method)&&void 0!==r?r:\"GET\"},n))]}}))}))}var s=Object.freeze({__proto__:null,get ResponseType(){return exports.ResponseType},Body:n,Client:r,getClient:i,fetch:u});exports.Body=n,exports.Client=r,exports.fetch=u,exports.getClient=i,exports.http=s;\n","\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0}),require(\"./tauri-343a48b5.js\");var e=require(\"./http-924906a9.js\");exports.Body=e.Body,exports.Client=e.Client,Object.defineProperty(exports,\"ResponseType\",{enumerable:!0,get:function(){return e.ResponseType}}),exports.fetch=e.fetch,exports.getClient=e.getClient;\n","\n\n
\n \n \n
\n