diff --git a/.changes/ayatana-tray.md b/.changes/ayatana-tray.md new file mode 100644 index 000000000..321e0280d --- /dev/null +++ b/.changes/ayatana-tray.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +**Breaking change:** Use ayatana-appindicator for Linux system tray by default. Use the `gtk-tray` Cargo feature to use `libappindicator` instead. diff --git a/.changes/config.json b/.changes/config.json index e075525b9..98c17932a 100644 --- a/.changes/config.json +++ b/.changes/config.json @@ -8,7 +8,7 @@ "getPublishedVersion": "cargo search ${ pkgFile.pkg.package.name } --limit 1 | sed -nE \"s/^[^\\\"]*\\\"//; s/\\\".*//1p\"", "prepublish": [ "sudo apt-get update", - "sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf", + "sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf", "cargo install cargo-audit --features=fix", { "command": "cargo generate-lockfile", diff --git a/.changes/dev-keep-default-features.md b/.changes/dev-keep-default-features.md new file mode 100644 index 000000000..947e6d155 --- /dev/null +++ b/.changes/dev-keep-default-features.md @@ -0,0 +1,6 @@ +--- +"cli.rs": patch +"cli.js": patch +--- + +**Breaking change:** Enable default Cargo features except `tauri/custom-protocol` on the dev command. diff --git a/.changes/tauri-build-resources-linux.md b/.changes/tauri-build-resources-linux.md new file mode 100644 index 000000000..b77f25fd0 --- /dev/null +++ b/.changes/tauri-build-resources-linux.md @@ -0,0 +1,5 @@ +--- +"tauri-build": patch +--- + +Copy system tray icon resource to the target directory on Linux. diff --git a/.github/workflows/artifacts-updater.yml b/.github/workflows/artifacts-updater.yml index ac1bdf6b8..4283d78bc 100644 --- a/.github/workflows/artifacts-updater.yml +++ b/.github/workflows/artifacts-updater.yml @@ -41,7 +41,7 @@ jobs: if: matrix.platform == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf + sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf - name: Get current date run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index bfca38dfd..515cf9c32 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -43,7 +43,7 @@ jobs: run: | python -m pip install --upgrade pip sudo apt-get update - sudo apt-get install -y webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf xvfb + sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf xvfb wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb sudo dpkg -i hyperfine_1.11.0_amd64.deb pip install memory_profiler diff --git a/.github/workflows/lint-fmt-core.yml b/.github/workflows/lint-fmt-core.yml index f29f86c6d..d818bc4f0 100644 --- a/.github/workflows/lint-fmt-core.yml +++ b/.github/workflows/lint-fmt-core.yml @@ -49,7 +49,10 @@ jobs: args: '--features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray', key: 'all' } - - { args: '--no-default-features', key: 'no-default' } + - { + args: '--no-default-features --features ayatana-tray', + key: 'no-default' + } - { args: '--features custom-protocol', key: 'custom-protocol' } - { args: '--features api-all', key: 'api-all' } @@ -58,7 +61,7 @@ jobs: - name: install webkit2gtk run: | sudo apt-get update - sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf + sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf - uses: actions-rs/toolchain@v1 with: diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.yml index 80b9da3c3..2deb75489 100644 --- a/.github/workflows/publish-cli.yml +++ b/.github/workflows/publish-cli.yml @@ -255,7 +255,7 @@ jobs: - name: install system dependencies run: | sudo apt-get update - sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf + sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf - name: Test bindings run: yarn test test-linux-x64-musl-binding: @@ -349,7 +349,7 @@ jobs: set -e export PATH=/usr/local/cargo/bin/:/usr/local/fnm:$PATH apt-get update - DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install --no-install-recommends -y unzip libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf + DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install --no-install-recommends -y unzip libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf bash curl https://sh.rustup.rs -sSf | bash -s -- -y curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "/usr/local/fnm" --skip-shell diff --git a/.github/workflows/test-cli.yml b/.github/workflows/test-cli.yml index 3bd500156..077ce415b 100644 --- a/.github/workflows/test-cli.yml +++ b/.github/workflows/test-cli.yml @@ -106,7 +106,7 @@ jobs: if: matrix.platform == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf + sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf - name: Get current date run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml index 62a35f3d5..9e46a31bb 100644 --- a/.github/workflows/test-core.yml +++ b/.github/workflows/test-core.yml @@ -40,7 +40,7 @@ jobs: if: matrix.platform == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf + sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf - name: Get current date run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV diff --git a/.github/workflows/udeps.yml b/.github/workflows/udeps.yml index cb072fafb..5facba6f4 100644 --- a/.github/workflows/udeps.yml +++ b/.github/workflows/udeps.yml @@ -20,6 +20,24 @@ env: jobs: udeps: runs-on: ubuntu-latest + strategy: + matrix: + clippy: + - { + path: './core/tauri/Cargo.toml', + args: '--features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray' + } + - { path: './core/tauri-build/Cargo.toml', args: '--all-features' } + - { path: './core/tauri-codegen/Cargo.toml', args: '--all-features' } + - { path: './core/tauri-macros/Cargo.toml', args: '--all-features' } + - { path: './core/tauri-runtime/Cargo.toml', args: '--all-features' } + - { + path: './core/tauri-runtime-wry/Cargo.toml', + args: '--features devtools,system-tray,macos-private-api,objc-exception,ayatana-tray' + } + - { path: './core/tauri-utils/Cargo.toml', args: '--all-features' } + - { path: './tooling/bundler/Cargo.toml', args: '--all-features' } + - { path: './tooling/cli/Cargo.toml', args: '--all-features' } steps: - uses: actions/checkout@v2 @@ -101,19 +119,9 @@ jobs: - name: Install required packages run: | sudo apt-get update - sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf + sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf - uses: actions-rs/cargo@v1 with: command: udeps - args: --all-targets --all-features - - - uses: actions-rs/cargo@v1 - with: - command: udeps - args: --manifest-path ./tooling/bundler/Cargo.toml --all-targets --all-features - - - uses: actions-rs/cargo@v1 - with: - command: udeps - args: --manifest-path ./tooling/cli/Cargo.toml --all-targets --all-features + args: --manifest-path ${{ matrix.clippy.path }} --all-targets ${{ matrix.clippy.args }} diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 4aaa3218c..33c829dd8 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -236,9 +236,14 @@ pub fn try_build(attributes: Attributes) -> Result<()> { target_dir, )?; } - if let Some(paths) = config.tauri.bundle.resources { - copy_resources(ResourcePaths::new(paths.as_slice(), true), target_dir)?; + + #[allow(unused_mut)] + let mut resources = config.tauri.bundle.resources.unwrap_or_default(); + #[cfg(target_os = "linux")] + if let Some(tray) = config.tauri.system_tray { + resources.push(tray.icon_path.display().to_string()); } + copy_resources(ResourcePaths::new(resources.as_slice(), true), target_dir)?; #[cfg(target_os = "macos")] { diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index cbd216612..72cd6afd0 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -32,10 +32,12 @@ gtk = { version = "0.15", features = [ "v3_20" ] } [features] dox = [ "wry/dox" ] devtools = [ "wry/devtools", "tauri-runtime/devtools" ] -system-tray = [ "wry/tray", "tauri-runtime/system-tray" ] +system-tray = [ "tauri-runtime/system-tray", "wry/tray" ] macos-private-api = [ "wry/fullscreen", "wry/transparent", "tauri-runtime/macos-private-api" ] objc-exception = [ "wry/objc-exception" ] +gtk-tray = [ "wry/gtk-tray" ] +ayatana-tray = [ "wry/ayatana-tray" ] diff --git a/core/tauri-utils/Cargo.toml b/core/tauri-utils/Cargo.toml index a1de8d60b..b82b6c3d8 100644 --- a/core/tauri-utils/Cargo.toml +++ b/core/tauri-utils/Cargo.toml @@ -26,7 +26,7 @@ schemars = { version = "0.8", features = [ "url" ], optional = true } serde_with = "1.12" aes-gcm = { version = "0.9", optional = true } getrandom = { version = "0.2", optional = true, features = [ "std" ] } -serialize-to-javascript = "=0.1.1" +serialize-to-javascript = { version = "=0.1.1", optional = true } ctor = "0.1" json5 = { version = "0.4", optional = true } json-patch = "0.2" @@ -40,7 +40,7 @@ heck = "0.4" build = [ "proc-macro2", "quote" ] compression = [ "brotli" ] schema = [ "schemars" ] -isolation = [ "aes-gcm", "getrandom" ] +isolation = [ "aes-gcm", "getrandom", "serialize-to-javascript" ] process-relaunch-dangerous-allow-symlink-macos = [ ] config-json5 = [ "json5" ] resources = [ "glob", "walkdir" ] diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index 741e9fae5..e63c86b55 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -118,10 +118,12 @@ tokio-test = "0.4.2" tokio = { version = "1.16", features = [ "full" ] } [features] -default = [ "wry", "compression", "objc-exception" ] +default = [ "wry", "compression", "objc-exception", "ayatana-tray" ] compression = [ "tauri-macros/compression", "tauri-utils/compression" ] wry = [ "tauri-runtime-wry" ] objc-exception = [ "tauri-runtime-wry/objc-exception" ] +ayatana-tray = [ "tauri-runtime-wry/ayatana-tray" ] +gtk-tray = [ "tauri-runtime-wry/gtk-tray" ] isolation = [ "tauri-utils/isolation", "tauri-macros/isolation" ] custom-protocol = [ "tauri-macros/custom-protocol" ] updater = [ diff --git a/core/tauri/build.rs b/core/tauri/build.rs index 6fd8354f3..fb608e338 100644 --- a/core/tauri/build.rs +++ b/core/tauri/build.rs @@ -29,7 +29,7 @@ fn main() { window_create: { any(window_all, feature = "window-create") }, window_center: { any(window_all, feature = "window-center") }, window_request_user_attention: { any(window_all, feature = "window-request-user-attention") }, - window_set_resizable: { any(window_all, feature = "window-set-resizable") }, + window_set_izable: { any(window_all, feature = "window-set-resizable") }, window_set_title: { any(window_all, feature = "window-set-title") }, window_maximize: { any(window_all, feature = "window-maximize") }, window_unmaximize: { any(window_all, feature = "window-unmaximize") }, diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 18fe8fb22..ec179359a 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -1294,41 +1294,23 @@ impl Builder { if let Some(menu) = system_tray.menu() { tray::get_menu_ids(&mut ids, menu); } - let mut tray = tray::SystemTray::new(); + let mut tray = tray::SystemTray::new().with_icon( + system_tray + .icon + .or(system_tray_icon) + .expect("tray icon not found; please configure it on tauri.conf.json"), + ); if let Some(menu) = system_tray.menu { tray = tray.with_menu(menu); } - - #[cfg(not(target_os = "macos"))] - let tray_handler = app - .runtime - .as_ref() - .unwrap() - .system_tray( - tray.with_icon( - system_tray - .icon - .or(system_tray_icon) - .expect("tray icon not found; please configure it on tauri.conf.json"), - ), - ) - .expect("failed to run tray"); - #[cfg(target_os = "macos")] + let tray = tray.with_icon_as_template(system_tray_icon_as_template); + let tray_handler = app .runtime .as_ref() .unwrap() - .system_tray( - tray - .with_icon( - system_tray - .icon - .or(system_tray_icon) - .expect("tray icon not found; please configure it on tauri.conf.json"), - ) - .with_icon_as_template(system_tray_icon_as_template), - ) + .system_tray(tray) .expect("failed to run tray"); let tray_handle = tray::SystemTrayHandle { diff --git a/core/tauri/src/updater/mod.rs b/core/tauri/src/updater/mod.rs index 4d39e018f..323d09df4 100644 --- a/core/tauri/src/updater/mod.rs +++ b/core/tauri/src/updater/mod.rs @@ -404,7 +404,7 @@ //! //! The *Private key* (privkey) is used to sign your update and should NEVER be shared with anyone. Also, if you lost this key, you'll NOT be able to publish a new update to the current user base (if pubkey is set in tauri.conf.json). It's important to save it at a safe place and you can always access it. //! -//! To generate your keys you need to use the Tauri cli. +//! To generate your keys you need to use the Tauri cli. //! //! ```bash //! # Generate the keys, follow the instructions diff --git a/examples/api/dist/assets/index.js b/examples/api/dist/assets/index.js index 293475b1f..582f8a333 100644 --- a/examples/api/dist/assets/index.js +++ b/examples/api/dist/assets/index.js @@ -1,40 +1,24 @@ -var Io=Object.defineProperty,No=Object.defineProperties;var qo=Object.getOwnPropertyDescriptors;var Fi=Object.getOwnPropertySymbols;var Bo=Object.prototype.hasOwnProperty,Go=Object.prototype.propertyIsEnumerable;var Ui=(e,t,n)=>t in e?Io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hi=(e,t)=>{for(var n in t||(t={}))Bo.call(t,n)&&Ui(e,n,t[n]);if(Fi)for(var n of Fi(t))Go.call(t,n)&&Ui(e,n,t[n]);return e},Ii=(e,t)=>No(e,qo(t));import{S as K,i as X,s as Y,e as u,a as v,t as S,b as a,c as P,d as r,l as T,f as G,n as I,g as W,r as x,o as Ke,h as On,j as E,p as Xe,k as fe,m as Vo,q as Ni,u as Ye,v as qi,w as J,x as Bi,y as Gi,z as Vi,A as Ji,B as $i,C as Ki,D as Jo,E as Xi,F as Yi,G as $o,H as Ko,I as Xo}from"./vendor.js";const Yo=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const s of l.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&i(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerpolicy&&(l.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?l.credentials="include":o.crossorigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}};Yo();/*! ***************************************************************************** -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 Qi=function(e,t){return(Qi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])})(e,t)};function Ln(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Qi(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var dt=function(){return(dt=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0&&o[o.length-1])||f[0]!==6&&f[0]!==2)){s=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]{n(2,l=p)}),eo().then(p=>{n(0,i=p)}),io().then(p=>{n(1,o=p)});async function s(){await oo()}async function c(){await Dn()}return[i,o,l,s,c]}class tr extends K{constructor(t){super();X(this,t,xo,Zo,Y,{})}}function ro(){return _(this,void 0,void 0,function(){return g(this,function(e){return[2,z({__tauriModule:"Cli",message:{cmd:"cliMatches"}})]})})}Object.freeze({__proto__:null,getMatches:ro});function er(e){let t,n,i,o,l,s,c,p,h,f,M;return{c(){t=u("div"),n=S(`This binary can be run on the terminal and takes the following arguments: - `),i=u("ul"),i.innerHTML=`
  • --config PATH
  • +var Ql=Object.defineProperty,Zl=Object.defineProperties;var $l=Object.getOwnPropertyDescriptors;var hl=Object.getOwnPropertySymbols;var xl=Object.prototype.hasOwnProperty,ei=Object.prototype.propertyIsEnumerable;var ml=(n,e,l)=>e in n?Ql(n,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[e]=l,vl=(n,e)=>{for(var l in e||(e={}))xl.call(e,l)&&ml(n,l,e[l]);if(hl)for(var l of hl(e))ei.call(e,l)&&ml(n,l,e[l]);return n},_l=(n,e)=>Zl(n,$l(e));import{S as V,i as J,s as K,e as a,a as m,t as M,b as u,c as T,d as t,l as y,f as j,n as I,g as S,r as Q,h as ti,j as ni,o as li,k as ii,m as gl,p as si,q as Pt,u as bl,v as hn,w as mn,x as oi,y as H,z as wl,A as kl,B as ai,C as Wt,D as lt,E as yl,F as ui,G as ri,H as ci,I as Cl,J as Ut,K as pi,L as Ml,M as zl,N as F,O as Tl,P as vn,Q as _n,R as Sl,T as Ll,U as fi,V as di,W as El,X as Hl,Y as hi,Z as mi,_ as vi,$ as _i,a0 as gi,a1 as bi,a2 as wi,a3 as ki,a4 as Ol,a5 as Rl,a6 as Al,a7 as Pl,a8 as yi,a9 as Wl,aa as Ul,ab as Ci,ac as Mi,ad as zi}from"./vendor.js";const Ti=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function l(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerpolicy&&(o.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?o.credentials="include":s.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=l(s);fetch(s.href,o)}};Ti();function Si(n){let e,l,i,s,o,r,c,h,d,k,w,f,p,v,b,_,z,C,A,P,W;return{c(){e=a("h1"),e.textContent="Welcome",l=m(),i=a("p"),i.textContent="Tauri's API capabilities using the ` @tauri-apps/api ` package. It's used as\n the main validation app, serving as the testbed of our development process. In\n the future, this app will be used on Tauri's integration tests.",s=m(),o=a("p"),r=M("Current App version: "),c=M(n[0]),h=m(),d=a("p"),k=M("Current Tauri version: "),w=M(n[1]),f=m(),p=a("p"),v=M("Current App name: "),b=M(n[2]),_=m(),z=a("button"),z.textContent="Close application",C=m(),A=a("button"),A.textContent="Relaunch application",u(z,"class","button"),u(A,"class","button")},m(L,U){T(L,e,U),T(L,l,U),T(L,i,U),T(L,s,U),T(L,o,U),t(o,r),t(o,c),T(L,h,U),T(L,d,U),t(d,k),t(d,w),T(L,f,U),T(L,p,U),t(p,v),t(p,b),T(L,_,U),T(L,z,U),T(L,C,U),T(L,A,U),P||(W=[y(z,"click",n[3]),y(A,"click",n[4])],P=!0)},p(L,[U]){U&1&&j(c,L[0]),U&2&&j(w,L[1]),U&4&&j(b,L[2])},i:I,o:I,d(L){L&&S(e),L&&S(l),L&&S(i),L&&S(s),L&&S(o),L&&S(h),L&&S(d),L&&S(f),L&&S(p),L&&S(_),L&&S(z),L&&S(C),L&&S(A),P=!1,Q(W)}}}function Li(n,e,l){let i=0,s=0,o="Unknown";ti().then(h=>{l(2,o=h)}),ni().then(h=>{l(0,i=h)}),li().then(h=>{l(1,s=h)});async function r(){await ii()}async function c(){await gl()}return[i,s,o,r,c]}class Ei extends V{constructor(e){super();J(this,e,Li,Si,K,{})}}function Hi(n){let e,l,i,s,o,r,c,h,d,k,w;return{c(){e=a("div"),l=M(`This binary can be run on the terminal and takes the following arguments: + `),i=a("ul"),i.innerHTML=`
  • --config PATH
  • --theme light|dark|system
  • -
  • --verbose
  • `,o=S(` - Additionally, it has a `),l=u("i"),l.textContent="update --background",s=S(` subcommand. +
  • --verbose
  • `,s=M(` + Additionally, it has a `),o=a("i"),o.textContent="update --background",r=M(` subcommand. Note that the arguments are only parsed, not implemented. - `),c=u("br"),p=v(),h=u("button"),h.textContent="Get matches",a(h,"class","button"),a(h,"id","cli-matches")},m(m,d){P(m,t,d),r(t,n),r(t,i),r(t,o),r(t,l),r(t,s),r(t,c),r(t,p),r(t,h),f||(M=T(h,"click",e[0]),f=!0)},p:I,i:I,o:I,d(m){m&&W(t),f=!1,M()}}}function nr(e,t,n){let{onMessage:i}=t;function o(){ro().then(i).catch(i)}return e.$$set=l=>{"onMessage"in l&&n(1,i=l.onMessage)},[o,i]}class ir extends K{constructor(t){super();X(this,t,nr,er,Y,{onMessage:1})}}function lo(e,t){return _(this,void 0,void 0,function(){return g(this,function(n){return[2,z({__tauriModule:"Event",message:{cmd:"unlisten",event:e,eventId:t}})]})})}function so(e,t,n){return _(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,z({__tauriModule:"Event",message:{cmd:"emit",event:e,windowLabel:t,payload:typeof n=="string"?n:JSON.stringify(n)}})];case 1:return i.sent(),[2]}})})}function Rn(e,t,n){return _(this,void 0,void 0,function(){var i=this;return g(this,function(o){return[2,z({__tauriModule:"Event",message:{cmd:"listen",event:e,windowLabel:t,handler:Wt(n)}}).then(function(l){return function(){return _(i,void 0,void 0,function(){return g(this,function(s){return[2,lo(e,l)]})})}})]})})}function uo(e,t,n){return _(this,void 0,void 0,function(){return g(this,function(i){return[2,Rn(e,t,function(o){n(o),lo(e,o.id).catch(function(){})})]})})}function he(e,t){return _(this,void 0,void 0,function(){return g(this,function(n){return[2,Rn(e,null,t)]})})}function ao(e,t){return _(this,void 0,void 0,function(){return g(this,function(n){return[2,uo(e,null,t)]})})}function Ze(e,t){return _(this,void 0,void 0,function(){return g(this,function(n){return[2,so(e,void 0,t)]})})}Object.freeze({__proto__:null,listen:he,once:ao,emit:Ze});function or(e){let t,n,i,o,l,s,c,p;return{c(){t=u("div"),n=u("button"),n.textContent="Call Log API",i=v(),o=u("button"),o.textContent="Call Request (async) API",l=v(),s=u("button"),s.textContent="Send event to Rust",a(n,"class","button"),a(n,"id","log"),a(o,"class","button"),a(o,"id","request"),a(s,"class","button"),a(s,"id","event")},m(h,f){P(h,t,f),r(t,n),r(t,i),r(t,o),r(t,l),r(t,s),c||(p=[T(n,"click",e[0]),T(o,"click",e[1]),T(s,"click",e[2])],c=!0)},p:I,i:I,o:I,d(h){h&&W(t),c=!1,x(p)}}}function rr(e,t,n){let{onMessage:i}=t,o;Ke(async()=>{o=await he("rust-event",i)}),On(()=>{o&&o()});function l(){pe("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function s(){pe("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function c(){Ze("js-event","this is the payload string")}return e.$$set=p=>{"onMessage"in p&&n(3,i=p.onMessage)},[l,s,c,i]}class lr extends K{constructor(t){super();X(this,t,rr,or,Y,{onMessage:3})}}function jn(e){return e===void 0&&(e={}),_(this,void 0,void 0,function(){return g(this,function(t){return typeof e=="object"&&Object.freeze(e),[2,z({__tauriModule:"Dialog",message:{cmd:"openDialog",options:e}})]})})}function co(e){return e===void 0&&(e={}),_(this,void 0,void 0,function(){return g(this,function(t){return typeof e=="object"&&Object.freeze(e),[2,z({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:e}})]})})}function sr(e){return _(this,void 0,void 0,function(){return g(this,function(t){return[2,z({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:e}})]})})}function ur(e,t){return _(this,void 0,void 0,function(){return g(this,function(n){return[2,z({__tauriModule:"Dialog",message:{cmd:"askDialog",title:t,message:e}})]})})}function ar(e,t){return _(this,void 0,void 0,function(){return g(this,function(n){return[2,z({__tauriModule:"Dialog",message:{cmd:"confirmDialog",title:t,message:e}})]})})}Object.freeze({__proto__:null,open:jn,save:co,message:sr,ask:ur,confirm:ar});var Bt;function cr(e,t){return t===void 0&&(t={}),_(this,void 0,void 0,function(){return g(this,function(n){return[2,z({__tauriModule:"Fs",message:{cmd:"readTextFile",path:e,options:t}})]})})}function Fn(e,t){return t===void 0&&(t={}),_(this,void 0,void 0,function(){var n;return g(this,function(i){switch(i.label){case 0:return[4,z({__tauriModule:"Fs",message:{cmd:"readFile",path:e,options:t}})];case 1:return n=i.sent(),[2,Uint8Array.from(n)]}})})}function dr(e,t){return t===void 0&&(t={}),_(this,void 0,void 0,function(){return g(this,function(n){return typeof t=="object"&&Object.freeze(t),typeof e=="object"&&Object.freeze(e),[2,z({__tauriModule:"Fs",message:{cmd:"writeFile",path:e.path,contents:Array.from(new TextEncoder().encode(e.contents)),options:t}})]})})}function fr(e,t){return t===void 0&&(t={}),_(this,void 0,void 0,function(){return g(this,function(n){return typeof t=="object"&&Object.freeze(t),typeof e=="object"&&Object.freeze(e),[2,z({__tauriModule:"Fs",message:{cmd:"writeFile",path:e.path,contents:Array.from(e.contents),options:t}})]})})}function fo(e,t){return t===void 0&&(t={}),_(this,void 0,void 0,function(){return g(this,function(n){return[2,z({__tauriModule:"Fs",message:{cmd:"readDir",path:e,options:t}})]})})}function pr(e,t){return t===void 0&&(t={}),_(this,void 0,void 0,function(){return g(this,function(n){return[2,z({__tauriModule:"Fs",message:{cmd:"createDir",path:e,options:t}})]})})}function hr(e,t){return t===void 0&&(t={}),_(this,void 0,void 0,function(){return g(this,function(n){return[2,z({__tauriModule:"Fs",message:{cmd:"removeDir",path:e,options:t}})]})})}function mr(e,t,n){return n===void 0&&(n={}),_(this,void 0,void 0,function(){return g(this,function(i){return[2,z({__tauriModule:"Fs",message:{cmd:"copyFile",source:e,destination:t,options:n}})]})})}function vr(e,t){return t===void 0&&(t={}),_(this,void 0,void 0,function(){return g(this,function(n){return[2,z({__tauriModule:"Fs",message:{cmd:"removeFile",path:e,options:t}})]})})}function _r(e,t,n){return n===void 0&&(n={}),_(this,void 0,void 0,function(){return g(this,function(i){return[2,z({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:e,newPath:t,options:n}})]})})}(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",e[e.Log=19]="Log"})(Bt||(Bt={}));Object.freeze({__proto__:null,get BaseDirectory(){return Bt},get Dir(){return Bt},readTextFile:cr,readBinaryFile:Fn,writeFile:dr,writeBinaryFile:fr,readDir:fo,createDir:pr,removeDir:hr,copyFile:mr,removeFile:vr,renameFile:_r});function gr(e){let t,n,i,o,l,s,c,p,h,f,M,m,d,b,k,w,A,C,j,F;return{c(){t=u("div"),n=u("input"),i=v(),o=u("input"),l=v(),s=u("div"),c=u("input"),p=v(),h=u("label"),h.textContent="Multiple",f=v(),M=u("div"),m=u("input"),d=v(),b=u("label"),b.textContent="Directory",k=v(),w=u("button"),w.textContent="Open dialog",A=v(),C=u("button"),C.textContent="Open save dialog",a(n,"id","dialog-default-path"),a(n,"placeholder","Default path"),a(o,"id","dialog-filter"),a(o,"placeholder","Extensions filter, comma-separated"),a(o,"class","svelte-1eg58yg"),a(c,"type","checkbox"),a(c,"id","dialog-multiple"),a(h,"for","dialog-multiple"),a(m,"type","checkbox"),a(m,"id","dialog-directory"),a(b,"for","dialog-directory"),a(w,"class","button"),a(w,"id","open-dialog"),a(C,"class","button"),a(C,"id","save-dialog")},m(U,O){P(U,t,O),r(t,n),E(n,e[0]),r(t,i),r(t,o),E(o,e[1]),r(t,l),r(t,s),r(s,c),c.checked=e[2],r(s,p),r(s,h),r(t,f),r(t,M),r(M,m),m.checked=e[3],r(M,d),r(M,b),r(t,k),r(t,w),r(t,A),r(t,C),j||(F=[T(n,"input",e[8]),T(o,"input",e[9]),T(c,"change",e[10]),T(m,"change",e[11]),T(w,"click",e[4]),T(C,"click",e[5])],j=!0)},p(U,[O]){O&1&&n.value!==U[0]&&E(n,U[0]),O&2&&o.value!==U[1]&&E(o,U[1]),O&4&&(c.checked=U[2]),O&8&&(m.checked=U[3])},i:I,o:I,d(U){U&&W(t),j=!1,x(F)}}}function br(e,t){var n=new Blob([e],{type:"application/octet-binary"}),i=new FileReader;i.onload=function(o){var l=o.target.result;t(l.substr(l.indexOf(",")+1))},i.readAsDataURL(n)}function wr(e,t,n){let{onMessage:i}=t,{insecureRenderHtml:o}=t,l=null,s=null,c=!1,p=!1;function h(){jn({title:"My wonderful open dialog",defaultPath:l,filters:s?[{name:"Tauri Example",extensions:s.split(",").map(k=>k.trim())}]:[],multiple:c,directory:p}).then(function(k){if(Array.isArray(k))i(k);else{var w=k,A=w.match(/\S+\.\S+$/g);Fn(w).then(function(C){A&&(w.includes(".png")||w.includes(".jpg"))?br(new Uint8Array(C),function(j){var F="data:image/png;base64,"+j;o('')}):i(k)}).catch(i(k))}}).catch(i)}function f(){co({title:"My wonderful save dialog",defaultPath:l,filters:s?[{name:"Tauri Example",extensions:s.split(",").map(k=>k.trim())}]:[]}).then(i).catch(i)}function M(){l=this.value,n(0,l)}function m(){s=this.value,n(1,s)}function d(){c=this.checked,n(2,c)}function b(){p=this.checked,n(3,p)}return e.$$set=k=>{"onMessage"in k&&n(6,i=k.onMessage),"insecureRenderHtml"in k&&n(7,o=k.insecureRenderHtml)},[l,s,c,p,h,f,i,o,M,m,d,b]}class yr extends K{constructor(t){super();X(this,t,wr,gr,Y,{onMessage:6,insecureRenderHtml:7})}}function po(e,t,n){const i=e.slice();return i[9]=t[n],i}function ho(e){let t,n=e[9][0]+"",i,o;return{c(){t=u("option"),i=S(n),t.__value=o=e[9][1],t.value=t.__value},m(l,s){P(l,t,s),r(t,i)},p:I,d(l){l&&W(t)}}}function Mr(e){let t,n,i,o,l,s,c,p,h,f,M,m,d,b=e[2],k=[];for(let w=0;wisNaN(parseInt(m))).map(m=>[m,Bt[m]]);function p(){const m=l.match(/\S+\.\S+$/g),d={dir:mo()};(m?Fn(l,d):fo(l,d)).then(function(k){if(m)if(l.includes(".png")||l.includes(".jpg"))kr(new Uint8Array(k),function(w){const A="data:image/png;base64,"+w;o('')});else{const w=String.fromCharCode.apply(null,k);o(''),setTimeout(()=>{const A=document.getElementById("file-response");A.value=w,document.getElementById("file-save").addEventListener("click",function(){writeFile({file:l,contents:A.value},{dir:mo()}).catch(i)})})}else i(k)}).catch(i)}function h(){n(1,s.src=Zi(l),s)}function f(){l=this.value,n(0,l)}function M(m){Vo[m?"unshift":"push"](()=>{s=m,n(1,s)})}return e.$$set=m=>{"onMessage"in m&&n(5,i=m.onMessage),"insecureRenderHtml"in m&&n(6,o=m.insecureRenderHtml)},[l,s,c,p,h,i,o,f,M]}class Tr extends K{constructor(t){super();X(this,t,zr,Mr,Y,{onMessage:5,insecureRenderHtml:6})}}var me;(function(e){e[e.JSON=1]="JSON",e[e.Text=2]="Text",e[e.Binary=3]="Binary"})(me||(me={}));var Un=function(){function e(t,n){this.type=t,this.payload=n}return e.form=function(t){var n={};for(var i in t){var o=t[i];n[i]=typeof o=="string"?o:Array.from(o)}return new e("Form",n)},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",Array.from(t))},e}(),vo=function(e){this.url=e.url,this.status=e.status,this.ok=this.status>=200&&this.status<300,this.headers=e.headers,this.rawHeaders=e.rawHeaders,this.data=e.data},_o=function(){function e(t){this.id=t}return e.prototype.drop=function(){return _(this,void 0,void 0,function(){return g(this,function(t){return[2,z({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})]})})},e.prototype.request=function(t){return _(this,void 0,void 0,function(){var n;return g(this,function(i){return(n=!t.responseType||t.responseType===me.JSON)&&(t.responseType=me.Text),[2,z({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:t}}).then(function(o){var l=new vo(o);if(n){try{l.data=JSON.parse(l.data)}catch(s){if(l.ok&&l.data==="")l.data={};else if(l.ok)throw Error("Failed to parse response `".concat(l.data,"` as JSON: ").concat(s,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return l}return l})]})})},e.prototype.get=function(t,n){return _(this,void 0,void 0,function(){return g(this,function(i){return[2,this.request(dt({method:"GET",url:t},n))]})})},e.prototype.post=function(t,n,i){return _(this,void 0,void 0,function(){return g(this,function(o){return[2,this.request(dt({method:"POST",url:t,body:n},i))]})})},e.prototype.put=function(t,n,i){return _(this,void 0,void 0,function(){return g(this,function(o){return[2,this.request(dt({method:"PUT",url:t,body:n},i))]})})},e.prototype.patch=function(t,n){return _(this,void 0,void 0,function(){return g(this,function(i){return[2,this.request(dt({method:"PATCH",url:t},n))]})})},e.prototype.delete=function(t,n){return _(this,void 0,void 0,function(){return g(this,function(i){return[2,this.request(dt({method:"DELETE",url:t},n))]})})},e}();function Hn(e){return _(this,void 0,void 0,function(){return g(this,function(t){return[2,z({__tauriModule:"Http",message:{cmd:"createClient",options:e}}).then(function(n){return new _o(n)})]})})}var In=null;function Cr(e,t){var n;return _(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return In!==null?[3,2]:[4,Hn()];case 1:In=i.sent(),i.label=2;case 2:return[2,In.request(dt({url:e,method:(n=t==null?void 0:t.method)!==null&&n!==void 0?n:"GET"},t))]}})})}Object.freeze({__proto__:null,getClient:Hn,fetch:Cr,Body:Un,Client:_o,Response:vo,get ResponseType(){return me}});function Sr(e){let t,n,i,o,l,s,c,p,h,f,M,m,d,b,k,w,A;return{c(){t=u("form"),n=u("select"),i=u("option"),i.textContent="GET",o=u("option"),o.textContent="POST",l=u("option"),l.textContent="PUT",s=u("option"),s.textContent="PATCH",c=u("option"),c.textContent="DELETE",p=v(),h=u("input"),f=v(),M=u("br"),m=v(),d=u("textarea"),b=v(),k=u("button"),k.textContent="Make request",i.__value="GET",i.value=i.__value,o.__value="POST",o.value=o.__value,l.__value="PUT",l.value=l.__value,s.__value="PATCH",s.value=s.__value,c.__value="DELETE",c.value=c.__value,a(n,"class","button"),a(n,"id","request-method"),e[0]===void 0&&Ni(()=>e[5].call(n)),a(h,"id","request-url"),a(h,"placeholder","Type the request URL..."),a(d,"id","request-body"),a(d,"placeholder","Request body"),a(d,"rows","5"),a(d,"class","svelte-1xfmj7b"),a(k,"class","button"),a(k,"id","make-request")},m(C,j){P(C,t,j),r(t,n),r(n,i),r(n,o),r(n,l),r(n,s),r(n,c),Ye(n,e[0]),r(t,p),r(t,h),E(h,e[1]),r(t,f),r(t,M),r(t,m),r(t,d),E(d,e[2]),r(t,b),r(t,k),w||(A=[T(n,"change",e[5]),T(h,"input",e[6]),T(d,"input",e[7]),T(t,"submit",Xe(e[3]))],w=!0)},p(C,[j]){j&1&&Ye(n,C[0]),j&2&&h.value!==C[1]&&E(h,C[1]),j&4&&E(d,C[2])},i:I,o:I,d(C){C&&W(t),w=!1,x(A)}}}function Ar(e,t,n){let i="GET",o="https://jsonplaceholder.typicode.com/todos/1",l="",{onMessage:s}=t;async function c(){const M=await Hn().catch(k=>{throw s(k),k}),b={url:o||""||"",method:i||"GET"||"GET"};l.startsWith("{")&&l.endsWith("}")||l.startsWith("[")&&l.endsWith("]")?b.body=Un.json(JSON.parse(l)):l!==""&&(b.body=Un.text(l)),M.request(b).then(s).catch(s)}function p(){i=qi(this),n(0,i)}function h(){o=this.value,n(1,o)}function f(){l=this.value,n(2,l)}return e.$$set=M=>{"onMessage"in M&&n(4,s=M.onMessage)},[i,o,l,c,s,p,h,f]}class Pr extends K{constructor(t){super();X(this,t,Ar,Sr,Y,{onMessage:4})}}function Wr(e){let t,n,i;return{c(){t=u("button"),t.textContent="Send test notification",a(t,"class","button"),a(t,"id","notification")},m(o,l){P(o,t,l),n||(i=T(t,"click",Or),n=!0)},p:I,i:I,o:I,d(o){o&&W(t),n=!1,i()}}}function Or(){new Notification("Notification title",{body:"This is the notification body"})}function Lr(e,t,n){let{onMessage:i}=t;return e.$$set=o=>{"onMessage"in o&&n(0,i=o.onMessage)},[i]}class Er extends K{constructor(t){super();X(this,t,Lr,Wr,Y,{onMessage:0})}}var ve,xe=function(e,t){this.type="Logical",this.width=e,this.height=t},Gt=function(){function e(t,n){this.type="Physical",this.width=t,this.height=n}return e.prototype.toLogical=function(t){return new xe(this.width/t,this.height/t)},e}(),go=function(e,t){this.type="Logical",this.x=e,this.y=t},Vt=function(){function e(t,n){this.type="Physical",this.x=t,this.y=n}return e.prototype.toLogical=function(t){return new go(this.x/t,this.y/t)},e}();function Dr(){return new Jt(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function bo(){return window.__TAURI_METADATA__.__windows.map(function(e){return new Jt(e.label,{skip:!0})})}(function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"})(ve||(ve={}));var _e,wo=["tauri://created","tauri://error"],yo=function(){function e(t){this.label=t,this.listeners=Object.create(null)}return e.prototype.listen=function(t,n){return _(this,void 0,void 0,function(){var i=this;return g(this,function(o){return this._handleTauriEvent(t,n)?[2,Promise.resolve(function(){var l=i.listeners[t];l.splice(l.indexOf(n),1)})]:[2,Rn(t,this.label,n)]})})},e.prototype.once=function(t,n){return _(this,void 0,void 0,function(){var i=this;return g(this,function(o){return this._handleTauriEvent(t,n)?[2,Promise.resolve(function(){var l=i.listeners[t];l.splice(l.indexOf(n),1)})]:[2,uo(t,this.label,n)]})})},e.prototype.emit=function(t,n){return _(this,void 0,void 0,function(){var i,o;return g(this,function(l){if(wo.includes(t)){for(i=0,o=this.listeners[t]||[];ie[31].call(n)),a(s,"type","checkbox"),a(f,"type","checkbox"),a(d,"title","Unminimizes after 2 seconds"),a(k,"title","Unminimizes after 2 seconds"),a(A,"title","Visible again after 2 seconds"),a(F,"type","checkbox"),a(q,"type","checkbox"),a(B,"type","checkbox"),a(Q,"type","checkbox"),a(it,"type","number"),a(it,"min","0"),a(it,"class","svelte-1tppwwz"),a(ot,"type","number"),a(ot,"min","0"),a(ot,"class","svelte-1tppwwz"),a(ft,"class","flex col grow svelte-1tppwwz"),a(rt,"type","number"),a(rt,"min","400"),a(rt,"class","svelte-1tppwwz"),a(lt,"type","number"),a(lt,"min","400"),a(lt,"class","svelte-1tppwwz"),a(pt,"class","flex col grow svelte-1tppwwz"),a(ht,"type","number"),a(ht,"class","svelte-1tppwwz"),a(mt,"type","number"),a(mt,"class","svelte-1tppwwz"),a(N,"class","flex col grow svelte-1tppwwz"),a(at,"type","number"),a(at,"min","400"),a(at,"class","svelte-1tppwwz"),a(ct,"type","number"),a(ct,"min","400"),a(ct,"class","svelte-1tppwwz"),a(jt,"class","flex col grow svelte-1tppwwz"),a(et,"class","window-controls flex flex-row svelte-1tppwwz"),a(t,"class","flex col"),a(Kt,"class","svelte-1tppwwz"),a(Xt,"class","svelte-1tppwwz"),a(vt,"class","grow window-property svelte-1tppwwz"),a(Yt,"class","svelte-1tppwwz"),a(Qt,"class","svelte-1tppwwz"),a(_t,"class","grow window-property svelte-1tppwwz"),a(Ft,"class","flex"),a(Zt,"class","svelte-1tppwwz"),a(xt,"class","svelte-1tppwwz"),a(gt,"class","grow window-property svelte-1tppwwz"),a(te,"class","svelte-1tppwwz"),a(ee,"class","svelte-1tppwwz"),a(bt,"class","grow window-property svelte-1tppwwz"),a(Ut,"class","flex"),a(ne,"class","svelte-1tppwwz"),a(ie,"class","svelte-1tppwwz"),a(wt,"class","grow window-property svelte-1tppwwz"),a(oe,"class","svelte-1tppwwz"),a(re,"class","svelte-1tppwwz"),a(yt,"class","grow window-property svelte-1tppwwz"),a(Ht,"class","flex"),a(le,"class","svelte-1tppwwz"),a(se,"class","svelte-1tppwwz"),a(Mt,"class","grow window-property svelte-1tppwwz"),a(ue,"class","svelte-1tppwwz"),a(ae,"class","svelte-1tppwwz"),a(kt,"class","grow window-property svelte-1tppwwz"),a(It,"class","flex"),a(St,"id","title"),a(ce,"class","button"),a(ce,"type","submit"),a(zt,"class","svelte-1tppwwz"),a(At,"id","url"),a(de,"class","button"),a(de,"id","open-url"),a(Tt,"class","svelte-1tppwwz"),a(Pt,"class","button"),a(Pt,"title","Minimizes the window, requests attention for 3s and then resets it"),a(Nt,"class","button")},m(y,L){P(y,t,L),r(t,n);for(let V=0;V{typeof N=="string"&&o[i].setIcon(N)})}function be(){const N=Math.random().toString().replace(".",""),Ct=new Jt(N);n(1,o[N]=Ct,o),Ct.once("tauri://error",function(){l("Error creating new webview")})}function Ot(){o[i].innerSize().then(N=>{n(20,q=N),n(7,d=q.width),n(8,b=q.height)}),o[i].outerSize().then(N=>{n(21,tt=N)})}function we(){o[i].innerPosition().then(N=>{n(18,O=N)}),o[i].outerPosition().then(N=>{n(19,H=N),n(13,j=H.x),n(14,F=H.y)})}async function $t(N){ut&&ut(),$&&$(),$=await N.listen("tauri://move",we),ut=await N.listen("tauri://resize",Ot)}async function et(){await o[i].minimize(),await o[i].requestUserAttention(ve.Critical),await new Promise(N=>setTimeout(N,3e3)),await o[i].requestUserAttention(null)}function ft(){i=qi(this),n(0,i),n(1,o)}function Lt(){c=this.checked,n(2,c)}function ye(){p=this.checked,n(3,p)}const it=()=>o[i].center();function Me(){h=this.checked,n(16,h)}function Et(){f=this.checked,n(4,f)}function ke(){M=this.checked,n(5,M)}function ot(){m=this.checked,n(6,m)}function ze(){j=J(this.value),n(13,j)}function pt(){F=J(this.value),n(14,F)}function Dt(){d=J(this.value),n(7,d)}function Te(){b=J(this.value),n(8,b)}function rt(){k=J(this.value),n(9,k)}function Ce(){w=J(this.value),n(10,w)}function Rt(){A=J(this.value),n(11,A)}function Se(){C=J(this.value),n(12,C)}function lt(){B=this.value,n(22,B)}function Ae(){s=this.value,n(15,s)}return e.$$set=N=>{"onMessage"in N&&n(30,l=N.onMessage)},e.$$.update=()=>{e.$$.dirty[0]&7&&o[i].setResizable(c),e.$$.dirty[0]&11&&(p?o[i].maximize():o[i].unmaximize()),e.$$.dirty[0]&19&&o[i].setDecorations(f),e.$$.dirty[0]&35&&o[i].setAlwaysOnTop(M),e.$$.dirty[0]&67&&o[i].setFullscreen(m),e.$$.dirty[0]&387&&o[i].setSize(new Gt(d,b)),e.$$.dirty[0]&1539&&(k&&w?o[i].setMinSize(new xe(k,w)):o[i].setMinSize(null)),e.$$.dirty[0]&6147&&(A&&C?o[i].setMaxSize(new xe(A,C)):o[i].setMaxSize(null)),e.$$.dirty[0]&24579&&o[i].setPosition(new Vt(j,F)),e.$$.dirty[0]&3&&o[i].scaleFactor().then(N=>n(17,U=N)),e.$$.dirty[0]&3&&$t(o[i])},[i,o,c,p,f,M,m,d,b,k,w,A,C,j,F,s,h,U,O,H,q,tt,B,R,nt,D,Q,ge,be,et,l,ft,Lt,ye,it,Me,Et,ke,ot,ze,pt,Dt,Te,rt,Ce,Rt,Se,lt,Ae]}class Ir extends K{constructor(t){super();X(this,t,Hr,Ur,Y,{onMessage:30},[-1,-1])}}function To(e,t){return _(this,void 0,void 0,function(){return g(this,function(n){return[2,z({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:e,handler:Wt(t)}})]})})}function Nr(e,t){return _(this,void 0,void 0,function(){return g(this,function(n){return[2,z({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:e,handler:Wt(t)}})]})})}function qr(e){return _(this,void 0,void 0,function(){return g(this,function(t){return[2,z({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:e}})]})})}function Co(e){return _(this,void 0,void 0,function(){return g(this,function(t){return[2,z({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:e}})]})})}function So(){return _(this,void 0,void 0,function(){return g(this,function(e){return[2,z({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}})]})})}Object.freeze({__proto__:null,register:To,registerAll:Nr,isRegistered:qr,unregister:Co,unregisterAll:So});function Ao(e,t,n){const i=e.slice();return i[9]=t[n],i}function Po(e){let t,n=e[9]+"",i,o,l,s,c;function p(){return e[8](e[9])}return{c(){t=u("div"),i=S(n),o=v(),l=u("button"),l.textContent="Unregister",a(l,"type","button")},m(h,f){P(h,t,f),r(t,i),r(t,o),r(t,l),s||(c=T(l,"click",p),s=!0)},p(h,f){e=h,f&2&&n!==(n=e[9]+"")&&G(i,n)},d(h){h&&W(t),s=!1,c()}}}function Wo(e){let t,n,i;return{c(){t=u("button"),t.textContent="Unregister all",a(t,"type","button")},m(o,l){P(o,t,l),n||(i=T(t,"click",e[5]),n=!0)},p:I,d(o){o&&W(t),n=!1,i()}}}function Br(e){let t,n,i,o,l,s,c,p,h,f,M=e[1],m=[];for(let b=0;bn(1,i=m));let s="CmdOrControl+X";function c(){const m=s;To(m,()=>{o(`Shortcut ${m} triggered`)}).then(()=>{l.update(d=>[...d,m]),o(`Shortcut ${m} registered successfully`)}).catch(o)}function p(m){const d=m;Co(d).then(()=>{l.update(b=>b.filter(k=>k!==d)),o(`Shortcut ${d} unregistered`)}).catch(o)}function h(){So().then(()=>{l.update(()=>[]),o("Unregistered all shortcuts")}).catch(o)}function f(){s=this.value,n(0,s)}const M=m=>p(m);return e.$$set=m=>{"onMessage"in m&&n(6,o=m.onMessage)},[s,i,l,c,p,h,o,f,M]}class Vr extends K{constructor(t){super();X(this,t,Gr,Br,Y,{onMessage:6})}}function Oo(e){let t,n,i,o,l;return{c(){t=u("input"),n=v(),i=u("button"),i.textContent="Write",a(t,"placeholder","write to stdin"),a(i,"class","button")},m(s,c){P(s,t,c),E(t,e[3]),P(s,n,c),P(s,i,c),o||(l=[T(t,"input",e[10]),T(i,"click",e[7])],o=!0)},p(s,c){c&8&&t.value!==s[3]&&E(t,s[3])},d(s){s&&W(t),s&&W(n),s&&W(i),o=!1,x(l)}}}function Jr(e){let t,n,i,o,l,s,c,p,h,f,M,m,d,b,k,w=e[4]&&Oo(e);return{c(){t=u("div"),n=u("div"),i=u("input"),o=v(),l=u("button"),l.textContent="Run",s=v(),c=u("button"),c.textContent="Kill",p=v(),w&&w.c(),h=v(),f=u("div"),M=u("input"),m=v(),d=u("input"),a(l,"class","button"),a(c,"class","button"),a(M,"placeholder","Working directory"),a(d,"class","env-vars svelte-1g38c1n"),a(d,"placeholder","Environment variables")},m(A,C){P(A,t,C),r(t,n),r(n,i),E(i,e[0]),r(n,o),r(n,l),r(n,s),r(n,c),r(n,p),w&&w.m(n,null),r(t,h),r(t,f),r(f,M),E(M,e[1]),r(f,m),r(f,d),E(d,e[2]),b||(k=[T(i,"input",e[9]),T(l,"click",e[5]),T(c,"click",e[6]),T(M,"input",e[11]),T(d,"input",e[12])],b=!0)},p(A,[C]){C&1&&i.value!==A[0]&&E(i,A[0]),A[4]?w?w.p(A,C):(w=Oo(A),w.c(),w.m(n,null)):w&&(w.d(1),w=null),C&2&&M.value!==A[1]&&E(M,A[1]),C&4&&d.value!==A[2]&&E(d,A[2])},i:I,o:I,d(A){A&&W(t),w&&w.d(),b=!1,x(k)}}}function $r(e,t,n){const i=navigator.userAgent.includes("Windows");let o=i?"cmd":"sh",l=i?["/C"]:["-c"],{onMessage:s}=t,c='echo "hello world"',p=null,h="SOMETHING=value ANOTHER=2",f="",M;function m(){return h.split(" ").reduce((F,U)=>{let[O,H]=U.split("=");return Ii(Hi({},F),{[O]:H})},{})}function d(){n(4,M=null);const F=new to(o,[...l,c],{cwd:p||null,env:m()});F.on("close",U=>{s(`command finished with code ${U.code} and signal ${U.signal}`),n(4,M=null)}),F.on("error",U=>s(`command error: "${U}"`)),F.stdout.on("data",U=>s(`command stdout: "${U}"`)),F.stderr.on("data",U=>s(`command stderr: "${U}"`)),F.spawn().then(U=>{n(4,M=U)}).catch(s)}function b(){M.kill().then(()=>s("killed child process")).catch(s)}function k(){M.write(f).catch(s)}function w(){c=this.value,n(0,c)}function A(){f=this.value,n(3,f)}function C(){p=this.value,n(1,p)}function j(){h=this.value,n(2,h)}return e.$$set=F=>{"onMessage"in F&&n(8,s=F.onMessage)},[c,p,h,f,M,d,b,k,s,w,A,C,j]}class Kr extends K{constructor(t){super();X(this,t,$r,Jr,Y,{onMessage:8})}}function Lo(){return _(this,void 0,void 0,function(){function e(){t&&t(),t=void 0}var t;return g(this,function(n){return[2,new Promise(function(i,o){he("tauri://update-status",function(l){var s;(s=l==null?void 0:l.payload).error?(e(),o(s.error)):s.status==="DONE"&&(e(),i())}).then(function(l){t=l}).catch(function(l){throw e(),l}),Ze("tauri://update-install").catch(function(l){throw e(),l})})]})})}function Eo(){return _(this,void 0,void 0,function(){function e(){t&&t(),t=void 0}var t;return g(this,function(n){return[2,new Promise(function(i,o){ao("tauri://update-available",function(l){var s;s=l==null?void 0:l.payload,e(),i({manifest:s,shouldUpdate:!0})}).catch(function(l){throw e(),l}),he("tauri://update-status",function(l){var s;(s=l==null?void 0:l.payload).error?(e(),o(s.error)):s.status==="UPTODATE"&&(e(),i({shouldUpdate:!1}))}).then(function(l){t=l}).catch(function(l){throw e(),l}),Ze("tauri://update").catch(function(l){throw e(),l})})]})})}Object.freeze({__proto__:null,installUpdate:Lo,checkUpdate:Eo});function Xr(e){let t,n,i,o,l,s;return{c(){t=u("div"),n=u("button"),n.textContent="Check update",i=v(),o=u("button"),o.textContent="Install update",a(n,"class","button"),a(n,"id","check_update"),a(o,"class","button hidden"),a(o,"id","start_update")},m(c,p){P(c,t,p),r(t,n),r(t,i),r(t,o),l||(s=[T(n,"click",e[0]),T(o,"click",e[1])],l=!0)},p:I,i:I,o:I,d(c){c&&W(t),l=!1,x(s)}}}function Yr(e,t,n){let{onMessage:i}=t,o;Ke(async()=>{o=await he("tauri://update-status",i)}),On(()=>{o&&o()});async function l(){try{document.getElementById("check_update").classList.add("hidden");const{shouldUpdate:c,manifest:p}=await Eo();i(`Should update: ${c}`),i(p),c&&document.getElementById("start_update").classList.remove("hidden")}catch(c){i(c)}}async function s(){try{document.getElementById("start_update").classList.add("hidden"),await Lo(),i("Installation complete, restart required."),await Dn()}catch(c){i(c)}}return e.$$set=c=>{"onMessage"in c&&n(2,i=c.onMessage)},[l,s,i]}class Qr extends K{constructor(t){super();X(this,t,Yr,Xr,Y,{onMessage:2})}}function Do(e){return _(this,void 0,void 0,function(){return g(this,function(t){return[2,z({__tauriModule:"Clipboard",message:{cmd:"writeText",data:e}})]})})}function Ro(){return _(this,void 0,void 0,function(){return g(this,function(e){return[2,z({__tauriModule:"Clipboard",message:{cmd:"readText"}})]})})}Object.freeze({__proto__:null,writeText:Do,readText:Ro});function Zr(e){let t,n,i,o,l,s,c,p,h;return{c(){t=u("div"),n=u("div"),i=u("input"),o=v(),l=u("button"),l.textContent="Write",s=v(),c=u("button"),c.textContent="Read",a(i,"placeholder","Text to write to the clipboard"),a(l,"type","button"),a(c,"type","button")},m(f,M){P(f,t,M),r(t,n),r(n,i),E(i,e[0]),r(n,o),r(n,l),r(t,s),r(t,c),p||(h=[T(i,"input",e[4]),T(l,"click",e[1]),T(c,"click",e[2])],p=!0)},p(f,[M]){M&1&&i.value!==f[0]&&E(i,f[0])},i:I,o:I,d(f){f&&W(t),p=!1,x(h)}}}function xr(e,t,n){let{onMessage:i}=t,o="clipboard message";function l(){Do(o).then(()=>{i("Wrote to the clipboard")}).catch(i)}function s(){Ro().then(p=>{i(`Clipboard contents: ${p}`)}).catch(i)}function c(){o=this.value,n(0,o)}return e.$$set=p=>{"onMessage"in p&&n(3,i=p.onMessage)},[o,l,s,i,c]}class tl extends K{constructor(t){super();X(this,t,xr,Zr,Y,{onMessage:3})}}function el(e){let t;return{c(){t=u("div"),t.innerHTML=`

    Not available for Linux

    - `},m(n,i){P(n,t,i)},p:I,i:I,o:I,d(n){n&&W(t)}}}function nl(e,t,n){let{onMessage:i}=t;const o=window.constraints={audio:!0,video:!0};function l(c){const p=document.querySelector("video"),h=c.getVideoTracks();i("Got stream with constraints:",o),i(`Using video device: ${h[0].label}`),window.stream=c,p.srcObject=c}function s(c){if(c.name==="ConstraintNotSatisfiedError"){const p=o.video;i(`The resolution ${p.width.exact}x${p.height.exact} px is not supported by your device.`)}else c.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${c.name}`,c)}return Ke(async()=>{try{const c=await navigator.mediaDevices.getUserMedia(o);l(c)}catch(c){s(c)}}),On(()=>{window.stream.getTracks().forEach(function(c){c.stop()})}),e.$$set=c=>{"onMessage"in c&&n(0,i=c.onMessage)},[i]}class il extends K{constructor(t){super();X(this,t,nl,el,Y,{onMessage:0})}}function ol(e){let t,n,i,o,l,s,c,p,h,f,M,m;return{c(){t=u("input"),n=v(),i=u("input"),o=v(),l=u("button"),l.textContent="Post it.",s=v(),c=u("p"),c.textContent="Result:",p=v(),h=u("pre"),f=S(e[2]),a(l,"type","button")},m(d,b){P(d,t,b),E(t,e[0]),P(d,n,b),P(d,i,b),E(i,e[1]),P(d,o,b),P(d,l,b),P(d,s,b),P(d,c,b),P(d,p,b),P(d,h,b),r(h,f),M||(m=[T(t,"input",e[4]),T(i,"input",e[5]),T(l,"click",e[3])],M=!0)},p(d,[b]){b&1&&t.value!==d[0]&&E(t,d[0]),b&2&&i.value!==d[1]&&E(i,d[1]),b&4&&G(f,d[2])},i:I,o:I,d(d){d&&W(t),d&&W(n),d&&W(i),d&&W(o),d&&W(l),d&&W(s),d&&W(c),d&&W(p),d&&W(h),M=!1,x(m)}}}function rl(e,t,n){let i="baz",o="qux",l=null;async function s(){let h=navigator.userAgent.includes("Windows")?"https://customprotocol.test/example.html":"customprotocol://test/example.html";const M=await(await fetch(h,{method:"POST",body:JSON.stringify({foo:i,bar:o})})).json();n(2,l=JSON.stringify(M))}function c(){i=this.value,n(0,i)}function p(){o=this.value,n(1,o)}return[i,o,l,s,c,p]}class ll extends K{constructor(t){super();X(this,t,rl,ol,Y,{})}}function jo(e,t,n){const i=e.slice();return i[10]=t[n],i}function Fo(e,t,n){const i=e.slice();return i[13]=t[n],i}function Uo(e){let t,n=e[13].label+"",i,o,l,s,c;function p(){return e[9](e[13])}return{c(){t=u("p"),i=S(n),o=v(),a(t,"class",l="nv noselect "+(e[0]===e[13]?"nv_selected":""))},m(h,f){P(h,t,f),r(t,i),r(t,o),s||(c=T(t,"click",p),s=!0)},p(h,f){e=h,f&1&&l!==(l="nv noselect "+(e[0]===e[13]?"nv_selected":""))&&a(t,"class",l)},d(h){h&&W(t),s=!1,c()}}}function sl(e){let t,n=e[10].html+"",i;return{c(){i=Vi(),t=new Xo(i)},m(o,l){t.m(n,o,l),P(o,i,l)},p(o,l){l&2&&n!==(n=o[10].html+"")&&t.p(n)},d(o){o&&W(i),o&&t.d()}}}function ul(e){let t,n=e[10].text+"",i;return{c(){t=u("p"),i=S(n)},m(o,l){P(o,t,l),r(t,i)},p(o,l){l&2&&n!==(n=o[10].text+"")&&G(i,n)},d(o){o&&W(t)}}}function Ho(e){let t;function n(l,s){return l[10].text?ul:sl}let i=n(e),o=i(e);return{c(){o.c(),t=Vi()},m(l,s){o.m(l,s),P(l,t,s)},p(l,s){i===(i=n(l))&&o?o.p(l,s):(o.d(1),o=i(l),o&&(o.c(),o.m(t.parentNode,t)))},d(l){o.d(l),l&&W(t)}}}function al(e){let t,n,i,o,l,s,c,p,h,f,M,m,d,b,k,w,A,C,j,F,U,O,H=e[2],q=[];for(let R=0;RDocumentation + `),c=a("br"),h=m(),d=a("button"),d.textContent="Get matches",u(d,"class","button"),u(d,"id","cli-matches")},m(f,p){T(f,e,p),t(e,l),t(e,i),t(e,s),t(e,o),t(e,r),t(e,c),t(e,h),t(e,d),k||(w=y(d,"click",n[0]),k=!0)},p:I,i:I,o:I,d(f){f&&S(e),k=!1,w()}}}function Oi(n,e,l){let{onMessage:i}=e;function s(){si().then(i).catch(i)}return n.$$set=o=>{"onMessage"in o&&l(1,i=o.onMessage)},[s,i]}class Ri extends V{constructor(e){super();J(this,e,Oi,Hi,K,{onMessage:1})}}function Ai(n){let e,l,i,s,o,r,c,h;return{c(){e=a("div"),l=a("button"),l.textContent="Call Log API",i=m(),s=a("button"),s.textContent="Call Request (async) API",o=m(),r=a("button"),r.textContent="Send event to Rust",u(l,"class","button"),u(l,"id","log"),u(s,"class","button"),u(s,"id","request"),u(r,"class","button"),u(r,"id","event")},m(d,k){T(d,e,k),t(e,l),t(e,i),t(e,s),t(e,o),t(e,r),c||(h=[y(l,"click",n[0]),y(s,"click",n[1]),y(r,"click",n[2])],c=!0)},p:I,i:I,o:I,d(d){d&&S(e),c=!1,Q(h)}}}function Pi(n,e,l){let{onMessage:i}=e,s;Pt(async()=>{s=await bl("rust-event",i)}),hn(()=>{s&&s()});function o(){mn("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function r(){mn("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function c(){oi("js-event","this is the payload string")}return n.$$set=h=>{"onMessage"in h&&l(3,i=h.onMessage)},[o,r,c,i]}class Wi extends V{constructor(e){super();J(this,e,Pi,Ai,K,{onMessage:3})}}function Ui(n){let e,l,i,s,o,r,c,h,d,k,w,f,p,v,b,_,z,C,A,P;return{c(){e=a("div"),l=a("input"),i=m(),s=a("input"),o=m(),r=a("div"),c=a("input"),h=m(),d=a("label"),d.textContent="Multiple",k=m(),w=a("div"),f=a("input"),p=m(),v=a("label"),v.textContent="Directory",b=m(),_=a("button"),_.textContent="Open dialog",z=m(),C=a("button"),C.textContent="Open save dialog",u(l,"id","dialog-default-path"),u(l,"placeholder","Default path"),u(s,"id","dialog-filter"),u(s,"placeholder","Extensions filter, comma-separated"),u(s,"class","svelte-1eg58yg"),u(c,"type","checkbox"),u(c,"id","dialog-multiple"),u(d,"for","dialog-multiple"),u(f,"type","checkbox"),u(f,"id","dialog-directory"),u(v,"for","dialog-directory"),u(_,"class","button"),u(_,"id","open-dialog"),u(C,"class","button"),u(C,"id","save-dialog")},m(W,L){T(W,e,L),t(e,l),H(l,n[0]),t(e,i),t(e,s),H(s,n[1]),t(e,o),t(e,r),t(r,c),c.checked=n[2],t(r,h),t(r,d),t(e,k),t(e,w),t(w,f),f.checked=n[3],t(w,p),t(w,v),t(e,b),t(e,_),t(e,z),t(e,C),A||(P=[y(l,"input",n[8]),y(s,"input",n[9]),y(c,"change",n[10]),y(f,"change",n[11]),y(_,"click",n[4]),y(C,"click",n[5])],A=!0)},p(W,[L]){L&1&&l.value!==W[0]&&H(l,W[0]),L&2&&s.value!==W[1]&&H(s,W[1]),L&4&&(c.checked=W[2]),L&8&&(f.checked=W[3])},i:I,o:I,d(W){W&&S(e),A=!1,Q(P)}}}function Ii(n,e){var l=new Blob([n],{type:"application/octet-binary"}),i=new FileReader;i.onload=function(s){var o=s.target.result;e(o.substr(o.indexOf(",")+1))},i.readAsDataURL(l)}function Ni(n,e,l){let{onMessage:i}=e,{insecureRenderHtml:s}=e,o=null,r=null,c=!1,h=!1;function d(){wl({title:"My wonderful open dialog",defaultPath:o,filters:r?[{name:"Tauri Example",extensions:r.split(",").map(b=>b.trim())}]:[],multiple:c,directory:h}).then(function(b){if(Array.isArray(b))i(b);else{var _=b,z=_.match(/\S+\.\S+$/g);kl(_).then(function(C){z&&(_.includes(".png")||_.includes(".jpg"))?Ii(new Uint8Array(C),function(A){var P="data:image/png;base64,"+A;s('')}):i(b)}).catch(i(b))}}).catch(i)}function k(){ai({title:"My wonderful save dialog",defaultPath:o,filters:r?[{name:"Tauri Example",extensions:r.split(",").map(b=>b.trim())}]:[]}).then(i).catch(i)}function w(){o=this.value,l(0,o)}function f(){r=this.value,l(1,r)}function p(){c=this.checked,l(2,c)}function v(){h=this.checked,l(3,h)}return n.$$set=b=>{"onMessage"in b&&l(6,i=b.onMessage),"insecureRenderHtml"in b&&l(7,s=b.insecureRenderHtml)},[o,r,c,h,d,k,i,s,w,f,p,v]}class qi extends V{constructor(e){super();J(this,e,Ni,Ui,K,{onMessage:6,insecureRenderHtml:7})}}function Il(n,e,l){const i=n.slice();return i[9]=e[l],i}function Nl(n){let e,l=n[9][0]+"",i,s;return{c(){e=a("option"),i=M(l),e.__value=s=n[9][1],e.value=e.__value},m(o,r){T(o,e,r),t(e,i)},p:I,d(o){o&&S(e)}}}function Di(n){let e,l,i,s,o,r,c,h,d,k,w,f,p,v=n[2],b=[];for(let _=0;_isNaN(parseInt(f))).map(f=>[f,yl[f]]);function h(){const f=o.match(/\S+\.\S+$/g),p={dir:ql()};(f?kl(o,p):ui(o,p)).then(function(b){if(f)if(o.includes(".png")||o.includes(".jpg"))ji(new Uint8Array(b),function(_){const z="data:image/png;base64,"+_;s('')});else{const _=String.fromCharCode.apply(null,b);s(''),setTimeout(()=>{const z=document.getElementById("file-response");z.value=_,document.getElementById("file-save").addEventListener("click",function(){writeFile({file:o,contents:z.value},{dir:ql()}).catch(i)})})}else i(b)}).catch(i)}function d(){l(1,r.src=ri(o),r)}function k(){o=this.value,l(0,o)}function w(f){ci[f?"unshift":"push"](()=>{r=f,l(1,r)})}return n.$$set=f=>{"onMessage"in f&&l(5,i=f.onMessage),"insecureRenderHtml"in f&&l(6,s=f.insecureRenderHtml)},[o,r,c,h,d,i,s,k,w]}class Fi extends V{constructor(e){super();J(this,e,Bi,Di,K,{onMessage:5,insecureRenderHtml:6})}}function Gi(n){let e,l,i,s,o,r,c,h,d,k,w,f,p,v,b,_,z;return{c(){e=a("form"),l=a("select"),i=a("option"),i.textContent="GET",s=a("option"),s.textContent="POST",o=a("option"),o.textContent="PUT",r=a("option"),r.textContent="PATCH",c=a("option"),c.textContent="DELETE",h=m(),d=a("input"),k=m(),w=a("br"),f=m(),p=a("textarea"),v=m(),b=a("button"),b.textContent="Make request",i.__value="GET",i.value=i.__value,s.__value="POST",s.value=s.__value,o.__value="PUT",o.value=o.__value,r.__value="PATCH",r.value=r.__value,c.__value="DELETE",c.value=c.__value,u(l,"class","button"),u(l,"id","request-method"),n[0]===void 0&&Cl(()=>n[5].call(l)),u(d,"id","request-url"),u(d,"placeholder","Type the request URL..."),u(p,"id","request-body"),u(p,"placeholder","Request body"),u(p,"rows","5"),u(p,"class","svelte-1xfmj7b"),u(b,"class","button"),u(b,"id","make-request")},m(C,A){T(C,e,A),t(e,l),t(l,i),t(l,s),t(l,o),t(l,r),t(l,c),Ut(l,n[0]),t(e,h),t(e,d),H(d,n[1]),t(e,k),t(e,w),t(e,f),t(e,p),H(p,n[2]),t(e,v),t(e,b),_||(z=[y(l,"change",n[5]),y(d,"input",n[6]),y(p,"input",n[7]),y(e,"submit",Wt(n[3]))],_=!0)},p(C,[A]){A&1&&Ut(l,C[0]),A&2&&d.value!==C[1]&&H(d,C[1]),A&4&&H(p,C[2])},i:I,o:I,d(C){C&&S(e),_=!1,Q(z)}}}function Vi(n,e,l){let i="GET",s="https://jsonplaceholder.typicode.com/todos/1",o="",{onMessage:r}=e;async function c(){const w=await pi().catch(b=>{throw r(b),b}),v={url:s||""||"",method:i||"GET"||"GET"};o.startsWith("{")&&o.endsWith("}")||o.startsWith("[")&&o.endsWith("]")?v.body=Ml.json(JSON.parse(o)):o!==""&&(v.body=Ml.text(o)),w.request(v).then(r).catch(r)}function h(){i=zl(this),l(0,i)}function d(){s=this.value,l(1,s)}function k(){o=this.value,l(2,o)}return n.$$set=w=>{"onMessage"in w&&l(4,r=w.onMessage)},[i,s,o,c,r,h,d,k]}class Ji extends V{constructor(e){super();J(this,e,Vi,Gi,K,{onMessage:4})}}function Ki(n){let e,l,i;return{c(){e=a("button"),e.textContent="Send test notification",u(e,"class","button"),u(e,"id","notification")},m(s,o){T(s,e,o),l||(i=y(e,"click",Xi),l=!0)},p:I,i:I,o:I,d(s){s&&S(e),l=!1,i()}}}function Xi(){new Notification("Notification title",{body:"This is the notification body"})}function Yi(n,e,l){let{onMessage:i}=e;return n.$$set=s=>{"onMessage"in s&&l(0,i=s.onMessage)},[i]}class Qi extends V{constructor(e){super();J(this,e,Yi,Ki,K,{onMessage:0})}}function Dl(n,e,l){const i=n.slice();return i[54]=e[l],i}function jl(n){let e,l=n[54]+"",i,s;return{c(){e=a("option"),i=M(l),e.__value=s=n[54],e.value=e.__value},m(o,r){T(o,e,r),t(e,i)},p(o,r){r[0]&2&&l!==(l=o[54]+"")&&j(i,l),r[0]&2&&s!==(s=o[54])&&(e.__value=s,e.value=e.__value)},d(o){o&&S(e)}}}function Zi(n){let e,l,i,s,o,r,c,h,d,k,w,f,p,v,b,_,z,C,A,P,W,L,U,q,Z,se,G,D,R,x,O,X,it,st,Te,ot,Ne,$,ue,Se,at,ee,ut,Le,rt,te,ct,re,Ee,pt,ne,ft,He,dt,le,ht,N,ye,gn,ce,bn,mt,wn,pe,kn,Oe,vt,yn,oe,Cn,_t,Mn,ae,It,ie,Re,fe,Nt,zn,qe,Tn,gt=n[20].width+"",qt,Sn,De,Ln,bt=n[20].height+"",Dt,En,de,jt,Hn,je,On,wt=n[21].width+"",Bt,Rn,Be,An,kt=n[21].height+"",Ft,Pn,Ae,he,Gt,Wn,Fe,Un,yt=n[20].toLogical(n[17]).width+"",Vt,In,Ge,Nn,Ct=n[20].toLogical(n[17]).height+"",Jt,qn,me,Kt,Dn,Ve,jn,Mt=n[21].toLogical(n[17]).width+"",Xt,Bn,Je,Fn,zt=n[21].toLogical(n[17]).height+"",Yt,Gn,Pe,ve,Qt,Vn,Ke,Jn,Tt=n[18].x+"",Zt,Kn,Xe,Xn,St=n[18].y+"",$t,Yn,_e,xt,Qn,Ye,Zn,Lt=n[19].x+"",en,$n,Qe,xn,Et=n[19].y+"",tn,el,We,ge,nn,tl,Ze,nl,Ht=n[18].toLogical(n[17]).x+"",ln,ll,$e,il,Ot=n[18].toLogical(n[17]).y+"",sn,sl,be,on,ol,xe,al,Rt=n[19].toLogical(n[17]).x+"",an,ul,et,rl,At=n[19].toLogical(n[17]).y+"",un,rn,we,Ce,cl,tt,cn,ke,Me,pl,nt,pn,ze,fn,Ue,dn,fl,Ie=Object.keys(n[1]),Y=[];for(let g=0;gn[31].call(l)),u(r,"type","checkbox"),u(k,"type","checkbox"),u(p,"title","Unminimizes after 2 seconds"),u(b,"title","Unminimizes after 2 seconds"),u(z,"title","Visible again after 2 seconds"),u(P,"type","checkbox"),u(q,"type","checkbox"),u(D,"type","checkbox"),u(X,"type","checkbox"),u(ee,"type","number"),u(ee,"min","0"),u(ee,"class","svelte-1tppwwz"),u(te,"type","number"),u(te,"min","0"),u(te,"class","svelte-1tppwwz"),u(ue,"class","flex col grow svelte-1tppwwz"),u(ne,"type","number"),u(ne,"min","400"),u(ne,"class","svelte-1tppwwz"),u(le,"type","number"),u(le,"min","400"),u(le,"class","svelte-1tppwwz"),u(re,"class","flex col grow svelte-1tppwwz"),u(ce,"type","number"),u(ce,"class","svelte-1tppwwz"),u(pe,"type","number"),u(pe,"class","svelte-1tppwwz"),u(N,"class","flex col grow svelte-1tppwwz"),u(oe,"type","number"),u(oe,"min","400"),u(oe,"class","svelte-1tppwwz"),u(ae,"type","number"),u(ae,"min","400"),u(ae,"class","svelte-1tppwwz"),u(Oe,"class","flex col grow svelte-1tppwwz"),u($,"class","window-controls flex flex-row svelte-1tppwwz"),u(e,"class","flex col"),u(qe,"class","svelte-1tppwwz"),u(De,"class","svelte-1tppwwz"),u(fe,"class","grow window-property svelte-1tppwwz"),u(je,"class","svelte-1tppwwz"),u(Be,"class","svelte-1tppwwz"),u(de,"class","grow window-property svelte-1tppwwz"),u(Re,"class","flex"),u(Fe,"class","svelte-1tppwwz"),u(Ge,"class","svelte-1tppwwz"),u(he,"class","grow window-property svelte-1tppwwz"),u(Ve,"class","svelte-1tppwwz"),u(Je,"class","svelte-1tppwwz"),u(me,"class","grow window-property svelte-1tppwwz"),u(Ae,"class","flex"),u(Ke,"class","svelte-1tppwwz"),u(Xe,"class","svelte-1tppwwz"),u(ve,"class","grow window-property svelte-1tppwwz"),u(Ye,"class","svelte-1tppwwz"),u(Qe,"class","svelte-1tppwwz"),u(_e,"class","grow window-property svelte-1tppwwz"),u(Pe,"class","flex"),u(Ze,"class","svelte-1tppwwz"),u($e,"class","svelte-1tppwwz"),u(ge,"class","grow window-property svelte-1tppwwz"),u(xe,"class","svelte-1tppwwz"),u(et,"class","svelte-1tppwwz"),u(be,"class","grow window-property svelte-1tppwwz"),u(We,"class","flex"),u(Ce,"id","title"),u(tt,"class","button"),u(tt,"type","submit"),u(we,"class","svelte-1tppwwz"),u(Me,"id","url"),u(nt,"class","button"),u(nt,"id","open-url"),u(ke,"class","svelte-1tppwwz"),u(ze,"class","button"),u(ze,"title","Minimizes the window, requests attention for 3s and then resets it"),u(Ue,"class","button")},m(g,E){T(g,e,E),t(e,l);for(let B=0;B{typeof N=="string"&&s[i].setIcon(N)})}function st(){const N=Math.random().toString().replace(".",""),ye=new fi(N);l(1,s[N]=ye,s),ye.once("tauri://error",function(){o("Error creating new webview")})}function Te(){s[i].innerSize().then(N=>{l(20,q=N),l(7,p=q.width),l(8,v=q.height)}),s[i].outerSize().then(N=>{l(21,Z=N)})}function ot(){s[i].innerPosition().then(N=>{l(18,L=N)}),s[i].outerPosition().then(N=>{l(19,U=N),l(13,A=U.x),l(14,P=U.y)})}async function Ne(N){se&&se(),G&&G(),G=await N.listen("tauri://move",ot),se=await N.listen("tauri://resize",Te)}async function $(){await s[i].minimize(),await s[i].requestUserAttention(di.Critical),await new Promise(N=>setTimeout(N,3e3)),await s[i].requestUserAttention(null)}function ue(){i=zl(this),l(0,i),l(1,s)}function Se(){c=this.checked,l(2,c)}function at(){h=this.checked,l(3,h)}const ee=()=>s[i].center();function ut(){d=this.checked,l(16,d)}function Le(){k=this.checked,l(4,k)}function rt(){w=this.checked,l(5,w)}function te(){f=this.checked,l(6,f)}function ct(){A=F(this.value),l(13,A)}function re(){P=F(this.value),l(14,P)}function Ee(){p=F(this.value),l(7,p)}function pt(){v=F(this.value),l(8,v)}function ne(){b=F(this.value),l(9,b)}function ft(){_=F(this.value),l(10,_)}function He(){z=F(this.value),l(11,z)}function dt(){C=F(this.value),l(12,C)}function le(){D=this.value,l(22,D)}function ht(){r=this.value,l(15,r)}return n.$$set=N=>{"onMessage"in N&&l(30,o=N.onMessage)},n.$$.update=()=>{n.$$.dirty[0]&7&&s[i].setResizable(c),n.$$.dirty[0]&11&&(h?s[i].maximize():s[i].unmaximize()),n.$$.dirty[0]&19&&s[i].setDecorations(k),n.$$.dirty[0]&35&&s[i].setAlwaysOnTop(w),n.$$.dirty[0]&67&&s[i].setFullscreen(f),n.$$.dirty[0]&387&&s[i].setSize(new _n(p,v)),n.$$.dirty[0]&1539&&(b&&_?s[i].setMinSize(new Sl(b,_)):s[i].setMinSize(null)),n.$$.dirty[0]&6147&&(z&&C?s[i].setMaxSize(new Sl(z,C)):s[i].setMaxSize(null)),n.$$.dirty[0]&24579&&s[i].setPosition(new vn(A,P)),n.$$.dirty[0]&3&&s[i].scaleFactor().then(N=>l(17,W=N)),n.$$.dirty[0]&3&&Ne(s[i])},[i,s,c,h,k,w,f,p,v,b,_,z,C,A,P,r,d,W,L,U,q,Z,D,R,x,O,X,it,st,$,o,ue,Se,at,ee,ut,Le,rt,te,ct,re,Ee,pt,ne,ft,He,dt,le,ht]}class xi extends V{constructor(e){super();J(this,e,$i,Zi,K,{onMessage:30},[-1,-1])}}function Bl(n,e,l){const i=n.slice();return i[9]=e[l],i}function Fl(n){let e,l=n[9]+"",i,s,o,r,c;function h(){return n[8](n[9])}return{c(){e=a("div"),i=M(l),s=m(),o=a("button"),o.textContent="Unregister",u(o,"type","button")},m(d,k){T(d,e,k),t(e,i),t(e,s),t(e,o),r||(c=y(o,"click",h),r=!0)},p(d,k){n=d,k&2&&l!==(l=n[9]+"")&&j(i,l)},d(d){d&&S(e),r=!1,c()}}}function Gl(n){let e,l,i;return{c(){e=a("button"),e.textContent="Unregister all",u(e,"type","button")},m(s,o){T(s,e,o),l||(i=y(e,"click",n[5]),l=!0)},p:I,d(s){s&&S(e),l=!1,i()}}}function es(n){let e,l,i,s,o,r,c,h,d,k,w=n[1],f=[];for(let v=0;vl(1,i=f));let r="CmdOrControl+X";function c(){const f=r;hi(f,()=>{s(`Shortcut ${f} triggered`)}).then(()=>{o.update(p=>[...p,f]),s(`Shortcut ${f} registered successfully`)}).catch(s)}function h(f){const p=f;mi(p).then(()=>{o.update(v=>v.filter(b=>b!==p)),s(`Shortcut ${p} unregistered`)}).catch(s)}function d(){vi().then(()=>{o.update(()=>[]),s("Unregistered all shortcuts")}).catch(s)}function k(){r=this.value,l(0,r)}const w=f=>h(f);return n.$$set=f=>{"onMessage"in f&&l(6,s=f.onMessage)},[r,i,o,c,h,d,s,k,w]}class ns extends V{constructor(e){super();J(this,e,ts,es,K,{onMessage:6})}}function Vl(n){let e,l,i,s,o;return{c(){e=a("input"),l=m(),i=a("button"),i.textContent="Write",u(e,"placeholder","write to stdin"),u(i,"class","button")},m(r,c){T(r,e,c),H(e,n[3]),T(r,l,c),T(r,i,c),s||(o=[y(e,"input",n[10]),y(i,"click",n[7])],s=!0)},p(r,c){c&8&&e.value!==r[3]&&H(e,r[3])},d(r){r&&S(e),r&&S(l),r&&S(i),s=!1,Q(o)}}}function ls(n){let e,l,i,s,o,r,c,h,d,k,w,f,p,v,b,_=n[4]&&Vl(n);return{c(){e=a("div"),l=a("div"),i=a("input"),s=m(),o=a("button"),o.textContent="Run",r=m(),c=a("button"),c.textContent="Kill",h=m(),_&&_.c(),d=m(),k=a("div"),w=a("input"),f=m(),p=a("input"),u(o,"class","button"),u(c,"class","button"),u(w,"placeholder","Working directory"),u(p,"class","env-vars svelte-1g38c1n"),u(p,"placeholder","Environment variables")},m(z,C){T(z,e,C),t(e,l),t(l,i),H(i,n[0]),t(l,s),t(l,o),t(l,r),t(l,c),t(l,h),_&&_.m(l,null),t(e,d),t(e,k),t(k,w),H(w,n[1]),t(k,f),t(k,p),H(p,n[2]),v||(b=[y(i,"input",n[9]),y(o,"click",n[5]),y(c,"click",n[6]),y(w,"input",n[11]),y(p,"input",n[12])],v=!0)},p(z,[C]){C&1&&i.value!==z[0]&&H(i,z[0]),z[4]?_?_.p(z,C):(_=Vl(z),_.c(),_.m(l,null)):_&&(_.d(1),_=null),C&2&&w.value!==z[1]&&H(w,z[1]),C&4&&p.value!==z[2]&&H(p,z[2])},i:I,o:I,d(z){z&&S(e),_&&_.d(),v=!1,Q(b)}}}function is(n,e,l){const i=navigator.userAgent.includes("Windows");let s=i?"cmd":"sh",o=i?["/C"]:["-c"],{onMessage:r}=e,c='echo "hello world"',h=null,d="SOMETHING=value ANOTHER=2",k="",w;function f(){return d.split(" ").reduce((P,W)=>{let[L,U]=W.split("=");return _l(vl({},P),{[L]:U})},{})}function p(){l(4,w=null);const P=new _i(s,[...o,c],{cwd:h||null,env:f()});P.on("close",W=>{r(`command finished with code ${W.code} and signal ${W.signal}`),l(4,w=null)}),P.on("error",W=>r(`command error: "${W}"`)),P.stdout.on("data",W=>r(`command stdout: "${W}"`)),P.stderr.on("data",W=>r(`command stderr: "${W}"`)),P.spawn().then(W=>{l(4,w=W)}).catch(r)}function v(){w.kill().then(()=>r("killed child process")).catch(r)}function b(){w.write(k).catch(r)}function _(){c=this.value,l(0,c)}function z(){k=this.value,l(3,k)}function C(){h=this.value,l(1,h)}function A(){d=this.value,l(2,d)}return n.$$set=P=>{"onMessage"in P&&l(8,r=P.onMessage)},[c,h,d,k,w,p,v,b,r,_,z,C,A]}class ss extends V{constructor(e){super();J(this,e,is,ls,K,{onMessage:8})}}function os(n){let e,l,i,s,o,r;return{c(){e=a("div"),l=a("button"),l.textContent="Check update",i=m(),s=a("button"),s.textContent="Install update",u(l,"class","button"),u(l,"id","check_update"),u(s,"class","button hidden"),u(s,"id","start_update")},m(c,h){T(c,e,h),t(e,l),t(e,i),t(e,s),o||(r=[y(l,"click",n[0]),y(s,"click",n[1])],o=!0)},p:I,i:I,o:I,d(c){c&&S(e),o=!1,Q(r)}}}function as(n,e,l){let{onMessage:i}=e,s;Pt(async()=>{s=await bl("tauri://update-status",i)}),hn(()=>{s&&s()});async function o(){try{document.getElementById("check_update").classList.add("hidden");const{shouldUpdate:c,manifest:h}=await gi();i(`Should update: ${c}`),i(h),c&&document.getElementById("start_update").classList.remove("hidden")}catch(c){i(c)}}async function r(){try{document.getElementById("start_update").classList.add("hidden"),await bi(),i("Installation complete, restart required."),await gl()}catch(c){i(c)}}return n.$$set=c=>{"onMessage"in c&&l(2,i=c.onMessage)},[o,r,i]}class us extends V{constructor(e){super();J(this,e,as,os,K,{onMessage:2})}}function rs(n){let e,l,i,s,o,r,c,h,d;return{c(){e=a("div"),l=a("div"),i=a("input"),s=m(),o=a("button"),o.textContent="Write",r=m(),c=a("button"),c.textContent="Read",u(i,"placeholder","Text to write to the clipboard"),u(o,"type","button"),u(c,"type","button")},m(k,w){T(k,e,w),t(e,l),t(l,i),H(i,n[0]),t(l,s),t(l,o),t(e,r),t(e,c),h||(d=[y(i,"input",n[4]),y(o,"click",n[1]),y(c,"click",n[2])],h=!0)},p(k,[w]){w&1&&i.value!==k[0]&&H(i,k[0])},i:I,o:I,d(k){k&&S(e),h=!1,Q(d)}}}function cs(n,e,l){let{onMessage:i}=e,s="clipboard message";function o(){wi(s).then(()=>{i("Wrote to the clipboard")}).catch(i)}function r(){ki().then(h=>{i(`Clipboard contents: ${h}`)}).catch(i)}function c(){s=this.value,l(0,s)}return n.$$set=h=>{"onMessage"in h&&l(3,i=h.onMessage)},[s,o,r,i,c]}class ps extends V{constructor(e){super();J(this,e,cs,rs,K,{onMessage:3})}}function fs(n){let e;return{c(){e=a("div"),e.innerHTML=`

    Not available for Linux

    + `},m(l,i){T(l,e,i)},p:I,i:I,o:I,d(l){l&&S(e)}}}function ds(n,e,l){let{onMessage:i}=e;const s=window.constraints={audio:!0,video:!0};function o(c){const h=document.querySelector("video"),d=c.getVideoTracks();i("Got stream with constraints:",s),i(`Using video device: ${d[0].label}`),window.stream=c,h.srcObject=c}function r(c){if(c.name==="ConstraintNotSatisfiedError"){const h=s.video;i(`The resolution ${h.width.exact}x${h.height.exact} px is not supported by your device.`)}else c.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${c.name}`,c)}return Pt(async()=>{try{const c=await navigator.mediaDevices.getUserMedia(s);o(c)}catch(c){r(c)}}),hn(()=>{window.stream.getTracks().forEach(function(c){c.stop()})}),n.$$set=c=>{"onMessage"in c&&l(0,i=c.onMessage)},[i]}class hs extends V{constructor(e){super();J(this,e,ds,fs,K,{onMessage:0})}}function ms(n){let e,l,i,s,o,r,c,h,d,k,w,f;return{c(){e=a("input"),l=m(),i=a("input"),s=m(),o=a("button"),o.textContent="Post it.",r=m(),c=a("p"),c.textContent="Result:",h=m(),d=a("pre"),k=M(n[2]),u(o,"type","button")},m(p,v){T(p,e,v),H(e,n[0]),T(p,l,v),T(p,i,v),H(i,n[1]),T(p,s,v),T(p,o,v),T(p,r,v),T(p,c,v),T(p,h,v),T(p,d,v),t(d,k),w||(f=[y(e,"input",n[4]),y(i,"input",n[5]),y(o,"click",n[3])],w=!0)},p(p,[v]){v&1&&e.value!==p[0]&&H(e,p[0]),v&2&&i.value!==p[1]&&H(i,p[1]),v&4&&j(k,p[2])},i:I,o:I,d(p){p&&S(e),p&&S(l),p&&S(i),p&&S(s),p&&S(o),p&&S(r),p&&S(c),p&&S(h),p&&S(d),w=!1,Q(f)}}}function vs(n,e,l){let i="baz",s="qux",o=null;async function r(){let d=navigator.userAgent.includes("Windows")?"https://customprotocol.test/example.html":"customprotocol://test/example.html";const w=await(await fetch(d,{method:"POST",body:JSON.stringify({foo:i,bar:s})})).json();l(2,o=JSON.stringify(w))}function c(){i=this.value,l(0,i)}function h(){s=this.value,l(1,s)}return[i,s,o,r,c,h]}class _s extends V{constructor(e){super();J(this,e,vs,ms,K,{})}}function Jl(n,e,l){const i=n.slice();return i[10]=e[l],i}function Kl(n,e,l){const i=n.slice();return i[13]=e[l],i}function Xl(n){let e,l=n[13].label+"",i,s,o,r,c;function h(){return n[9](n[13])}return{c(){e=a("p"),i=M(l),s=m(),u(e,"class",o="nv noselect "+(n[0]===n[13]?"nv_selected":""))},m(d,k){T(d,e,k),t(e,i),t(e,s),r||(c=y(e,"click",h),r=!0)},p(d,k){n=d,k&1&&o!==(o="nv noselect "+(n[0]===n[13]?"nv_selected":""))&&u(e,"class",o)},d(d){d&&S(e),r=!1,c()}}}function gs(n){let e,l=n[10].html+"",i;return{c(){i=Ol(),e=new zi(i)},m(s,o){e.m(l,s,o),T(s,i,o)},p(s,o){o&2&&l!==(l=s[10].html+"")&&e.p(l)},d(s){s&&S(i),s&&e.d()}}}function bs(n){let e,l=n[10].text+"",i;return{c(){e=a("p"),i=M(l)},m(s,o){T(s,e,o),t(e,i)},p(s,o){o&2&&l!==(l=s[10].text+"")&&j(i,l)},d(s){s&&S(e)}}}function Yl(n){let e;function l(o,r){return o[10].text?bs:gs}let i=l(n),s=i(n);return{c(){s.c(),e=Ol()},m(o,r){s.m(o,r),T(o,e,r)},p(o,r){i===(i=l(o))&&s?s.p(o,r):(s.d(1),s=i(o),s&&(s.c(),s.m(e.parentNode,e)))},d(o){s.d(o),o&&S(e)}}}function ws(n){let e,l,i,s,o,r,c,h,d,k,w,f,p,v,b,_,z,C,A,P,W,L,U=n[2],q=[];for(let R=0;RDocumentation Github - Source`,c=v(),p=u("div"),h=u("div");for(let R=0;R{Yi(D,1)}),Jo()}tt?(m=new tt(ut(R)),Ji(m.$$.fragment),Xi(m.$$.fragment,1),$i(m,M,null)):m=null}if(nt&2){$=R[1];let D;for(D=0;D<$.length;D+=1){const Q=jo(R,$,D);B[D]?B[D].p(Q,nt):(B[D]=Ho(Q),B[D].c(),B[D].m(b,null))}for(;D{Ko(cl,()=>{pe("menu_toggle")})});const o=[{label:"Welcome",component:tr},{label:"Messages",component:lr},{label:"CLI",component:ir},{label:"Dialog",component:yr},{label:"File system",component:Tr},{label:"HTTP",component:Pr},{label:"HTTP Form",component:ll},{label:"Notifications",component:Er},{label:"Window",component:Ir},{label:"Shortcuts",component:Vr},{label:"Shell",component:Kr},{label:"Updater",component:Qr},{label:"Clipboard",component:tl},{label:"WebRTC",component:il}];let l=o[0],s=Gi([]);Bi(e,s,d=>n(1,i=d));function c(d){n(0,l=d)}function p(d){s.update(b=>[{text:`[${new Date().toLocaleTimeString()}]: `+(typeof d=="string"?d:JSON.stringify(d))},...b])}function h(d){s.update(b=>[{html:d},...b])}function f(){s.update(()=>[])}function M(){En("https://tauri.studio/")}return[l,i,o,s,c,p,h,f,M,d=>c(d)]}class fl extends K{constructor(t){super();X(this,t,dl,al,Y,{})}}new fl({target:document.body}); + Source`,c=m(),h=a("div"),d=a("div");for(let R=0;R{Ul(O,1)}),yi()}Z?(f=new Z(se(R)),Rl(f.$$.fragment),Wl(f.$$.fragment,1),Al(f,w,null)):f=null}if(x&2){G=R[1];let O;for(O=0;O{Mi(ks,()=>{mn("menu_toggle")})});const s=[{label:"Welcome",component:Ei},{label:"Messages",component:Wi},{label:"CLI",component:Ri},{label:"Dialog",component:qi},{label:"File system",component:Fi},{label:"HTTP",component:Ji},{label:"HTTP Form",component:_s},{label:"Notifications",component:Qi},{label:"Window",component:xi},{label:"Shortcuts",component:ns},{label:"Shell",component:ss},{label:"Updater",component:us},{label:"Clipboard",component:ps},{label:"WebRTC",component:hs}];let o=s[0],r=Hl([]);El(n,r,p=>l(1,i=p));function c(p){l(0,o=p)}function h(p){r.update(v=>[{text:`[${new Date().toLocaleTimeString()}]: `+(typeof p=="string"?p:JSON.stringify(p))},...v])}function d(p){r.update(v=>[{html:p},...v])}function k(){r.update(()=>[])}function w(){Ll("https://tauri.studio/")}return[o,i,s,r,c,h,d,k,w,p=>c(p)]}class Cs extends V{constructor(e){super();J(this,e,ys,ws,K,{})}}new Cs({target:document.body}); diff --git a/examples/api/dist/assets/vendor.js b/examples/api/dist/assets/vendor.js index 3a009e0cb..fb5ffd072 100644 --- a/examples/api/dist/assets/vendor.js +++ b/examples/api/dist/assets/vendor.js @@ -1,4 +1,4 @@ -function w(){}function U(e){return e()}function z(){return Object.create(null)}function K(e){e.forEach(U)}function se(e){return typeof e=="function"}function fe(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function oe(e){return Object.keys(e).length===0}function ae(e,...t){if(e==null)return w;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Ae(e,t,n){e.$$.on_destroy.push(ae(t,n))}function Se(e,t){e.appendChild(t)}function ue(e,t,n){e.insertBefore(t,n||null)}function F(e){e.parentNode.removeChild(e)}function je(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function Le(e){return function(t){return t.preventDefault(),e.call(this,t)}}function Te(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Be(e){return e===""?null:+e}function le(e){return Array.from(e.childNodes)}function De(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function He(e,t){e.value=t==null?"":t}function Ne(e,t){for(let n=0;n{S.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}}function Xe(e){e&&e.c()}function ye(e,t,n,i){const{fragment:r,on_mount:c,on_destroy:o,after_update:f}=e.$$;r&&r.m(t,n),i||P(()=>{const s=c.map(U).filter(se);o?o.push(...s):K(s),e.$$.on_mount=[]}),f.forEach(P)}function ge(e,t){const n=e.$$;n.fragment!==null&&(K(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function _e(e,t){e.$$.dirty[0]===-1&&(O.push(e),pe(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const y=m.length?m[0]:h;return s.ctx&&r(s.ctx[a],s.ctx[a]=y)&&(!s.skip_bound&&s.bound[a]&&s.bound[a](y),l&&_e(e,a)),h}):[],s.update(),l=!0,K(s.before_update),s.fragment=i?i(s.ctx):!1,t.target){if(t.hydrate){const a=le(t.target);s.fragment&&s.fragment.l(a),a.forEach(F)}else s.fragment&&s.fragment.c();t.intro&&me(e.$$.fragment),ye(e,t.target,t.anchor,t.customElement),J()}C(f)}class Qe{$destroy(){ge(this,1),this.$destroy=w}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!oe(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const x=[];function We(e,t=w){let n;const i=[];function r(f){if(fe(e,f)&&(e=f,n)){const s=!x.length;for(let l=0;l{const a=i.indexOf(l);a!==-1&&i.splice(a,1),i.length===0&&(n(),n=null)}}return{set:r,update:c,subscribe:o}}/*! +function T(){}function ot(t){return t()}function ut(){return Object.create(null)}function P(t){t.forEach(ot)}function Kt(t){return typeof t=="function"}function Rt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function Ut(t){return Object.keys(t).length===0}function Nt(t,...e){if(t==null)return T;const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function Ge(t,e,n){t.$$.on_destroy.push(Nt(e,n))}function Je(t,e){t.appendChild(e)}function Bt(t,e,n){t.insertBefore(e,n||null)}function st(t){t.parentNode.removeChild(t)}function Xe(t,e){for(let n=0;nt.removeEventListener(e,n,i)}function tn(t){return function(e){return e.preventDefault(),t.call(this,e)}}function en(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function nn(t){return t===""?null:+t}function Ht(t){return Array.from(t.childNodes)}function rn(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function on(t,e){t.value=e==null?"":e}function un(t,e){for(let n=0;n{L.delete(t),i&&(n&&t.d(1),i())}),t.o(e)}}function pn(t){t&&t.c()}function Xt(t,e,n,i){const{fragment:r,on_mount:o,on_destroy:c,after_update:f}=t.$$;r&&r.m(e,n),i||B(()=>{const l=o.map(ot).filter(Kt);c?c.push(...l):P(l),t.$$.on_mount=[]}),f.forEach(B)}function Qt(t,e){const n=t.$$;n.fragment!==null&&(P(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Yt(t,e){t.$$.dirty[0]===-1&&(E.push(t),Vt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const g=y.length?y[0]:v;return l.ctx&&r(l.ctx[d],l.ctx[d]=g)&&(!l.skip_bound&&l.bound[d]&&l.bound[d](g),h&&Yt(t,d)),v}):[],l.update(),h=!0,P(l.before_update),l.fragment=i?i(l.ctx):!1,e.target){if(e.hydrate){const d=Ht(e.target);l.fragment&&l.fragment.l(d),d.forEach(st)}else l.fragment&&l.fragment.c();e.intro&&Jt(t.$$.fragment),Xt(t,e.target,e.anchor,e.customElement),ft()}D(f)}class vn{$destroy(){Qt(this,1),this.$destroy=T}$on(e,n){const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(e){this.$$set&&!Ut(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const A=[];function _n(t,e=T){let n;const i=[];function r(f){if(Rt(t,f)&&(t=f,n)){const l=!A.length;for(let h=0;h{const d=i.indexOf(h);d!==-1&&i.splice(d,1),i.length===0&&(n(),n=null)}}return{set:r,update:o,subscribe:c}}/*! * hotkeys-js v3.8.5 * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * @@ -6,4 +6,20 @@ function w(){}function U(e){return e()}function z(){return Object.create(null)}f * http://jaywcjlove.github.io/hotkeys * * Licensed under the MIT license. - */var B=typeof navigator!="undefined"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function D(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on".concat(t),function(){n(window.event)})}function Q(e,t){for(var n=t.slice(0,t.length-1),i=0;i=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function be(e,t){for(var n=e.length>=t.length?e:t,i=e.length>=t.length?t:e,r=!0,c=0;c=0&&u.splice(n,1),e.key&&e.key.toLowerCase()==="meta"&&u.splice(0,u.length),(t===93||t===224)&&(t=91),t in p){p[t]=!1;for(var i in v)v[i]===t&&(_[i]=!1)}}function $e(e){if(!e)Object.keys(d).forEach(function(o){return delete d[o]});else if(Array.isArray(e))e.forEach(function(o){o.key&&H(o)});else if(typeof e=="object")e.key&&H(e);else if(typeof e=="string"){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i1?Q(v,l):[];d[m]=d[m].map(function(g){var re=r?g.method===r:!0;return re&&g.scope===i&&be(g.mods,y)?{}:g})}})};function ne(e,t,n){var i;if(t.scope===n||t.scope==="all"){i=t.mods.length>0;for(var r in p)Object.prototype.hasOwnProperty.call(p,r)&&(!p[r]&&t.mods.indexOf(+r)>-1||p[r]&&t.mods.indexOf(+r)===-1)&&(i=!1);(t.mods.length===0&&!p[16]&&!p[18]&&!p[17]&&!p[91]||i||t.shortcut==="*")&&t.method(e,t)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function ie(e){var t=d["*"],n=e.keyCode||e.which||e.charCode;if(!!_.filter.call(this,e)){if((n===93||n===224)&&(n=91),u.indexOf(n)===-1&&n!==229&&u.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(y){var g=Z[y];e[y]&&u.indexOf(g)===-1?u.push(g):!e[y]&&u.indexOf(g)>-1?u.splice(u.indexOf(g),1):y==="metaKey"&&e[y]&&u.length===3&&(e.ctrlKey||e.shiftKey||e.altKey||(u=u.slice(u.indexOf(g))))}),n in p){p[n]=!0;for(var i in v)v[i]===n&&(_[i]=!0);if(!t)return}for(var r in p)Object.prototype.hasOwnProperty.call(p,r)&&(p[r]=e[Z[r]]);e.getModifierState&&!(e.altKey&&!e.ctrlKey)&&e.getModifierState("AltGraph")&&(u.indexOf(17)===-1&&u.push(17),u.indexOf(18)===-1&&u.push(18),p[17]=!0,p[18]=!0);var c=$();if(t)for(var o=0;o-1}function _(e,t,n){u=[];var i=W(e),r=[],c="all",o=document,f=0,s=!1,l=!0,a="+";for(n===void 0&&typeof t=="function"&&(n=t),Object.prototype.toString.call(t)==="[object Object]"&&(t.scope&&(c=t.scope),t.element&&(o=t.element),t.keyup&&(s=t.keyup),t.keydown!==void 0&&(l=t.keydown),typeof t.splitKey=="string"&&(a=t.splitKey)),typeof t=="string"&&(c=t);f1&&(r=Q(v,e)),e=e[e.length-1],e=e==="*"?"*":k(e),e in d||(d[e]=[]),d[e].push({keyup:s,keydown:l,scope:c,mods:r,shortcut:i[f],method:n,key:i[f],splitKey:a});typeof o!="undefined"&&!Ee(o)&&window&&(ee.push(o),D(o,"keydown",function(h){ie(h)}),D(window,"focus",function(){u=[]}),D(o,"keyup",function(h){ie(h),Oe(h)}))}var N={setScope:te,getScope:$,deleteScope:Ke,getPressedKeyCodes:ve,isPressed:xe,filter:we,unbind:$e};for(var q in N)Object.prototype.hasOwnProperty.call(N,q)&&(_[q]=N[q]);if(typeof window!="undefined"){var Ce=window.hotkeys;_.noConflict=function(e){return e&&window.hotkeys===_&&(window.hotkeys=Ce),_},window.hotkeys=_}export{Xe as A,ye as B,Ve as C,Re as D,me as E,ge as F,Ge as G,_ as H,Ue as I,Qe as S,ke as a,Te as b,ue as c,Se as d,ce as e,De as f,F as g,Fe as h,Je as i,He as j,je as k,Pe as l,V as m,w as n,ze as o,Le as p,P as q,K as r,fe as s,G as t,Ne as u,qe as v,Be as w,Ae as x,We as y,Me as z}; + */var I=typeof navigator!="undefined"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function V(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on".concat(e),function(){n(window.event)})}function ht(t,e){for(var n=e.slice(0,e.length-1),i=0;i=0;)e[n-1]+=",",e.splice(n,1),n=e.lastIndexOf("");return e}function Zt(t,e){for(var n=t.length>=e.length?t:e,i=t.length>=e.length?e:t,r=!0,o=0;o=0&&p.splice(n,1),t.key&&t.key.toLowerCase()==="meta"&&p.splice(0,p.length),(e===93||e===224)&&(e=91),e in _){_[e]=!1;for(var i in $)$[i]===e&&(M[i]=!1)}}function oe(t){if(!t)Object.keys(m).forEach(function(c){return delete m[c]});else if(Array.isArray(t))t.forEach(function(c){c.key&&G(c)});else if(typeof t=="object")t.key&&G(t);else if(typeof t=="string"){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i1?ht($,h):[];m[y]=m[y].map(function(b){var Ft=r?b.method===r:!0;return Ft&&b.scope===i&&Zt(b.mods,g)?{}:b})}})};function bt(t,e,n){var i;if(e.scope===n||e.scope==="all"){i=e.mods.length>0;for(var r in _)Object.prototype.hasOwnProperty.call(_,r)&&(!_[r]&&e.mods.indexOf(+r)>-1||_[r]&&e.mods.indexOf(+r)===-1)&&(i=!1);(e.mods.length===0&&!_[16]&&!_[18]&&!_[17]&&!_[91]||i||e.shortcut==="*")&&e.method(t,e)===!1&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function wt(t){var e=m["*"],n=t.keyCode||t.which||t.charCode;if(!!M.filter.call(this,t)){if((n===93||n===224)&&(n=91),p.indexOf(n)===-1&&n!==229&&p.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(g){var b=vt[g];t[g]&&p.indexOf(b)===-1?p.push(b):!t[g]&&p.indexOf(b)>-1?p.splice(p.indexOf(b),1):g==="metaKey"&&t[g]&&p.length===3&&(t.ctrlKey||t.shiftKey||t.altKey||(p=p.slice(p.indexOf(b))))}),n in _){_[n]=!0;for(var i in $)$[i]===n&&(M[i]=!0);if(!e)return}for(var r in _)Object.prototype.hasOwnProperty.call(_,r)&&(_[r]=t[vt[r]]);t.getModifierState&&!(t.altKey&&!t.ctrlKey)&&t.getModifierState("AltGraph")&&(p.indexOf(17)===-1&&p.push(17),p.indexOf(18)===-1&&p.push(18),_[17]=!0,_[18]=!0);var o=z();if(e)for(var c=0;c-1}function M(t,e,n){p=[];var i=pt(t),r=[],o="all",c=document,f=0,l=!1,h=!0,d="+";for(n===void 0&&typeof e=="function"&&(n=e),Object.prototype.toString.call(e)==="[object Object]"&&(e.scope&&(o=e.scope),e.element&&(c=e.element),e.keyup&&(l=e.keyup),e.keydown!==void 0&&(h=e.keydown),typeof e.splitKey=="string"&&(d=e.splitKey)),typeof e=="string"&&(o=e);f1&&(r=ht($,t)),t=t[t.length-1],t=t==="*"?"*":F(t),t in m||(m[t]=[]),m[t].push({keyup:l,keydown:h,scope:o,mods:r,shortcut:i[f],method:n,key:i[f],splitKey:d});typeof c!="undefined"&&!ue(c)&&window&&(yt.push(c),V(c,"keydown",function(v){wt(v)}),V(window,"focus",function(){p=[]}),V(c,"keyup",function(v){wt(v),re(v)}))}var J={setScope:gt,getScope:z,deleteScope:ie,getPressedKeyCodes:te,isPressed:ne,filter:ee,unbind:oe};for(var X in J)Object.prototype.hasOwnProperty.call(J,X)&&(M[X]=J[X]);if(typeof window!="undefined"){var se=window.hotkeys;M.noConflict=function(t){return t&&window.hotkeys===M&&(window.hotkeys=se),M},window.hotkeys=M}/*! ***************************************************************************** +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 Mt=function(t,e){return(Mt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])})(t,e)};function Q(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Mt(t,e),t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var w=function(){return(w=Object.assign||function(t){for(var e,n=1,i=arguments.length;n0&&r[r.length-1])||d[0]!==6&&d[0]!==2)){c=0;continue}if(d[0]===3&&(!r||d[1]>r[0]&&d[1]=200&&this.status<300,this.headers=t.headers,this.rawHeaders=t.rawHeaders,this.data=t.data},zt=function(){function t(e){this.id=e}return t.prototype.drop=function(){return u(this,void 0,void 0,function(){return s(this,function(e){return[2,a({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})]})})},t.prototype.request=function(e){return u(this,void 0,void 0,function(){var n;return s(this,function(i){return(n=!e.responseType||e.responseType===S.JSON)&&(e.responseType=S.Text),[2,a({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:e}}).then(function(r){var o=new Et(r);if(n){try{o.data=JSON.parse(o.data)}catch(c){if(o.ok&&o.data==="")o.data={};else if(o.ok)throw Error("Failed to parse response `".concat(o.data,"` as JSON: ").concat(c,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return o}return o})]})})},t.prototype.get=function(e,n){return u(this,void 0,void 0,function(){return s(this,function(i){return[2,this.request(w({method:"GET",url:e},n))]})})},t.prototype.post=function(e,n,i){return u(this,void 0,void 0,function(){return s(this,function(r){return[2,this.request(w({method:"POST",url:e,body:n},i))]})})},t.prototype.put=function(e,n,i){return u(this,void 0,void 0,function(){return s(this,function(r){return[2,this.request(w({method:"PUT",url:e,body:n},i))]})})},t.prototype.patch=function(e,n){return u(this,void 0,void 0,function(){return s(this,function(i){return[2,this.request(w({method:"PATCH",url:e},n))]})})},t.prototype.delete=function(e,n){return u(this,void 0,void 0,function(){return s(this,function(i){return[2,this.request(w({method:"DELETE",url:e},n))]})})},t}();function St(t){return u(this,void 0,void 0,function(){return s(this,function(e){return[2,a({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then(function(n){return new zt(n)})]})})}var et=null;function De(t,e){var n;return u(this,void 0,void 0,function(){return s(this,function(i){switch(i.label){case 0:return et!==null?[3,2]:[4,St()];case 1:et=i.sent(),i.label=2;case 2:return[2,et.request(w({url:t,method:(n=e==null?void 0:e.method)!==null&&n!==void 0?n:"GET"},e))]}})})}Object.freeze({__proto__:null,getClient:St,fetch:De,Body:We,Client:zt,Response:Et,get ResponseType(){return S}});var U,jt=function(t,e){this.type="Logical",this.width=t,this.height=e},nt=function(){function t(e,n){this.type="Physical",this.width=e,this.height=n}return t.prototype.toLogical=function(e){return new jt(this.width/e,this.height/e)},t}(),Wt=function(t,e){this.type="Logical",this.x=t,this.y=e},it=function(){function t(e,n){this.type="Physical",this.x=e,this.y=n}return t.prototype.toLogical=function(e){return new Wt(this.x/e,this.y/e)},t}();function ke(){return new j(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function Dt(){return window.__TAURI_METADATA__.__windows.map(function(t){return new j(t.label,{skip:!0})})}(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(U||(U={}));var rt,kt=["tauri://created","tauri://error"],Lt=function(){function t(e){this.label=e,this.listeners=Object.create(null)}return t.prototype.listen=function(e,n){return u(this,void 0,void 0,function(){var i=this;return s(this,function(r){return this._handleTauriEvent(e,n)?[2,Promise.resolve(function(){var o=i.listeners[e];o.splice(o.indexOf(n),1)})]:[2,Y(e,this.label,n)]})})},t.prototype.once=function(e,n){return u(this,void 0,void 0,function(){var i=this;return s(this,function(r){return this._handleTauriEvent(e,n)?[2,Promise.resolve(function(){var o=i.listeners[e];o.splice(o.indexOf(n),1)})]:[2,At(e,this.label,n)]})})},t.prototype.emit=function(e,n){return u(this,void 0,void 0,function(){var i,r;return s(this,function(o){if(kt.includes(e)){for(i=0,r=this.listeners[e]||[];i app .tray_handle() .set_icon(tauri::TrayIcon::File(PathBuf::from( - "../../../.icons/tray_icon_with_transparency.png", + "../../.icons/tray_icon_with_transparency.png", ))) .unwrap(), #[cfg(target_os = "linux")] "icon_2" => app .tray_handle() .set_icon(tauri::TrayIcon::File(PathBuf::from( - "../../../.icons/tray_icon.png", + "../../.icons/tray_icon.png", ))) .unwrap(), #[cfg(target_os = "windows")] diff --git a/tooling/cli/Cargo.lock b/tooling/cli/Cargo.lock index 7e9b37153..3dc6961ba 100644 --- a/tooling/cli/Cargo.lock +++ b/tooling/cli/Cargo.lock @@ -992,12 +992,6 @@ dependencies = [ "itoa 1.0.1", ] -[[package]] -name = "humansize" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02296996cb8796d7c6e3bc2d9211b7802812d36999a51bb754123ead7d37d026" - [[package]] name = "icns" version = "0.3.1" @@ -2728,7 +2722,6 @@ dependencies = [ "glob", "handlebars", "heck", - "humansize", "ignore", "include_dir", "json-patch", diff --git a/tooling/cli/Cargo.toml b/tooling/cli/Cargo.toml index 212ed0e21..86f8c0139 100644 --- a/tooling/cli/Cargo.toml +++ b/tooling/cli/Cargo.toml @@ -67,9 +67,6 @@ ctrlc = "3.2" [target."cfg(windows)".dependencies] encode_unicode = "0.3" -[target."cfg(not(windows))".dependencies] -humansize = "1.1" - [target."cfg(target_os = \"linux\")".build-dependencies] heck = "0.4" diff --git a/tooling/cli/src/build.rs b/tooling/cli/src/build.rs index 1d4dd6b00..f26d025f1 100644 --- a/tooling/cli/src/build.rs +++ b/tooling/cli/src/build.rs @@ -173,6 +173,8 @@ pub fn command(options: Options) -> Result<()> { #[cfg(not(windows))] let bin_path = out_dir.join(&bin_name); + let no_default_features = args.contains(&"--no-default-features".into()); + if options.target == Some("universal-apple-darwin".into()) { std::fs::create_dir_all(&out_dir).with_context(|| "failed to create project out directory")?; @@ -306,9 +308,14 @@ pub fn command(options: Options) -> Result<()> { None }; + let mut enabled_features = features.clone(); + if !no_default_features { + enabled_features.push("default".into()); + } let settings = crate::interface::get_bundler_settings( app_settings, options.target.clone(), + &enabled_features, &manifest, config_, &out_dir, diff --git a/tooling/cli/src/dev.rs b/tooling/cli/src/dev.rs index e79e24af9..245918008 100644 --- a/tooling/cli/src/dev.rs +++ b/tooling/cli/src/dev.rs @@ -7,7 +7,7 @@ use crate::{ app_paths::{app_dir, tauri_dir}, command_env, config::{get as get_config, reload as reload_config, AppUrl, WindowUrl}, - manifest::{get_workspace_members, rewrite_manifest}, + manifest::{get_workspace_members, rewrite_manifest, Manifest}, Logger, }, CommandExt, Result, @@ -151,17 +151,18 @@ pub fn command(options: Options) -> Result<()> { .or(runner_from_config) .unwrap_or_else(|| "cargo".to_string()); - { + let mut manifest = { let (tx, rx) = channel(); let mut watcher = watcher(tx, Duration::from_secs(1)).unwrap(); watcher.watch(tauri_path.join("Cargo.toml"), RecursiveMode::Recursive)?; - rewrite_manifest(config.clone())?; + let manifest = rewrite_manifest(config.clone())?; loop { if let Ok(DebouncedEvent::NoticeWrite(_)) = rx.recv() { break; } } - } + manifest + }; let mut cargo_features = config .lock() @@ -238,7 +239,13 @@ pub fn command(options: Options) -> Result<()> { } } - let mut process = start_app(&options, &runner, &cargo_features, child_wait_rx.clone())?; + let mut process = start_app( + &options, + &runner, + &manifest, + &cargo_features, + child_wait_rx.clone(), + )?; let (tx, rx) = channel(); @@ -266,7 +273,7 @@ pub fn command(options: Options) -> Result<()> { if let Some(event_path) = event_path { if event_path.file_name() == Some(OsStr::new("tauri.conf.json")) { reload_config(merge_config.as_deref())?; - rewrite_manifest(config.clone())?; + manifest = rewrite_manifest(config.clone())?; } else { // When tauri.conf.json is changed, rewrite_manifest will be called // which will trigger the watcher again @@ -281,7 +288,13 @@ pub fn command(options: Options) -> Result<()> { break; } } - process = start_app(&options, &runner, &cargo_features, child_wait_rx.clone())?; + process = start_app( + &options, + &runner, + &manifest, + &cargo_features, + child_wait_rx.clone(), + )?; } } } @@ -326,11 +339,33 @@ fn kill_before_dev_process() { fn start_app( options: &Options, runner: &str, + manifest: &Manifest, features: &[String], child_wait_rx: Arc>>, ) -> Result> { let mut command = Command::new(runner); - command.args(&["run", "--no-default-features"]); + command.arg("run"); + + if !options.args.contains(&"--no-default-features".into()) { + let manifest_features = manifest.features(); + let enable_features: Vec = manifest_features + .get("default") + .cloned() + .unwrap_or_default() + .into_iter() + .filter(|feature| { + if let Some(manifest_feature) = manifest_features.get(feature) { + !manifest_feature.contains(&"tauri/custom-protocol".into()) + } else { + feature != "tauri/custom-protocol" + } + }) + .collect(); + command.arg("--no-default-features"); + if !enable_features.is_empty() { + command.args(&["--features", &enable_features.join(",")]); + } + } if options.release_mode { command.args(&["--release"]); diff --git a/tooling/cli/src/helpers/manifest.rs b/tooling/cli/src/helpers/manifest.rs index e33057a3b..fecffe0e5 100644 --- a/tooling/cli/src/helpers/manifest.rs +++ b/tooling/cli/src/helpers/manifest.rs @@ -11,7 +11,7 @@ use anyhow::Context; use toml_edit::{Array, Document, InlineTable, Item, Table, Value}; use std::{ - collections::HashSet, + collections::{HashMap, HashSet}, fs::File, io::{Read, Write}, iter::FromIterator, @@ -20,7 +20,66 @@ use std::{ #[derive(Default)] pub struct Manifest { - pub features: HashSet, + pub inner: Document, + pub tauri_features: HashSet, +} + +impl Manifest { + pub fn features(&self) -> HashMap> { + let mut f = HashMap::new(); + + if let Some(features) = self + .inner + .as_table() + .get("features") + .and_then(|f| f.as_table()) + { + for (feature, enabled_features) in features.into_iter() { + if let Item::Value(Value::Array(enabled_features)) = enabled_features { + let mut enabled = Vec::new(); + for value in enabled_features { + if let Value::String(s) = value { + enabled.push(s.value().clone()); + } + } + f.insert(feature.to_string(), enabled); + } + } + } + + f + } + + pub fn all_enabled_features(&self, enabled_features: &[String]) -> Vec { + let mut all_enabled_features: Vec = self + .tauri_features + .iter() + .map(|f| format!("tauri/{}", f)) + .collect(); + + let manifest_features = self.features(); + for f in enabled_features { + all_enabled_features.extend(get_enabled_features(&manifest_features, f)); + } + + all_enabled_features + } +} + +fn get_enabled_features(list: &HashMap>, feature: &str) -> Vec { + let mut f = Vec::new(); + + if let Some(enabled_features) = list.get(feature) { + for enabled in enabled_features { + if list.contains_key(enabled) { + f.extend(get_enabled_features(list, enabled)); + } else { + f.push(enabled.clone()); + } + } + } + + f } fn read_manifest(manifest_path: &Path) -> crate::Result { @@ -164,11 +223,13 @@ pub fn rewrite_manifest(config: ConfigHandle) -> crate::Result { )?; manifest_file.flush()?; Ok(Manifest { - features: tauri_features, + inner: manifest, + tauri_features, }) } Ok(false) => Ok(Manifest { - features: tauri_features, + inner: manifest, + tauri_features, }), Err(e) => Err(e), } diff --git a/tooling/cli/src/interface/mod.rs b/tooling/cli/src/interface/mod.rs index 33528ee21..d98c6aedf 100644 --- a/tooling/cli/src/interface/mod.rs +++ b/tooling/cli/src/interface/mod.rs @@ -9,9 +9,11 @@ use std::path::Path; use crate::helpers::{config::Config, manifest::Manifest}; use tauri_bundler::bundle::{PackageType, Settings, SettingsBuilder}; +#[allow(clippy::too_many_arguments)] pub fn get_bundler_settings( app_settings: rust::AppSettings, target: Option, + features: &[String], manifest: &Manifest, config: &Config, out_dir: &Path, @@ -20,7 +22,7 @@ pub fn get_bundler_settings( ) -> crate::Result { let mut settings_builder = SettingsBuilder::new() .package_settings(app_settings.get_package_settings()) - .bundle_settings(app_settings.get_bundle_settings(config, manifest)?) + .bundle_settings(app_settings.get_bundle_settings(config, manifest, features)?) .binaries(app_settings.get_binaries(config)?) .project_out_directory(out_dir); diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index 634fb084f..fd4fc474a 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -177,9 +177,11 @@ impl AppSettings { &self, config: &Config, manifest: &Manifest, + features: &[String], ) -> crate::Result { tauri_config_to_bundle_settings( manifest, + features, config.tauri.bundle.clone(), config.tauri.system_tray.clone(), config.tauri.updater.clone(), @@ -369,10 +371,13 @@ pub fn get_workspace_dir(current_dir: &Path) -> PathBuf { #[allow(unused_variables)] fn tauri_config_to_bundle_settings( manifest: &Manifest, + features: &[String], config: crate::helpers::config::BundleConfig, system_tray_config: Option, updater_config: crate::helpers::config::UpdaterConfig, ) -> crate::Result { + let enabled_features = manifest.all_enabled_features(features); + #[cfg(windows)] let windows_icon_path = PathBuf::from( config @@ -396,7 +401,11 @@ fn tauri_config_to_bundle_settings( let mut icon_path = system_tray_config.icon_path.clone(); icon_path.set_extension("png"); resources.push(icon_path.display().to_string()); - depends.push("libappindicator3-1".to_string()); + if enabled_features.contains(&"tauri/gtk-tray".into()) { + depends.push("libappindicator3-1".into()); + } else { + depends.push("libayatana-appindicator3-1".into()); + } } // provides `libwebkit2gtk-4.0.so.37` and all `4.0` versions have the -37 package name