From 855effadd9ebfb6bc1a3555ac7fc733f6f766b7a Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Sun, 14 Feb 2021 17:34:23 -0300 Subject: [PATCH] feat(core): globalShortcut API (#1232) --- .changes/shortcut-api.md | 7 ++ api/package.json | 3 +- api/rollup.config.js | 3 +- api/src/bundle.ts | 4 +- api/src/globalShortcut.ts | 39 +++++++++ api/src/http.ts | 9 +- api/src/window.ts | 2 +- tauri-api/Cargo.toml | 2 + tauri-api/src/error.rs | 4 + tauri-api/src/lib.rs | 4 + tauri-api/src/shortcuts.rs | 30 +++++++ tauri/Cargo.toml | 5 +- tauri/build.rs | 3 + tauri/examples/api/src-tauri/Cargo.lock | 81 ++++++++++++++++++ tauri/examples/api/src/App.svelte | 4 + .../api/src/components/Shortcuts.svelte | 41 +++++++++ tauri/examples/communication/dist/__tauri.js | 2 +- .../communication/src-tauri/Cargo.lock | 81 ++++++++++++++++++ tauri/examples/multiwindow/dist/__tauri.js | 2 +- .../examples/multiwindow/src-tauri/Cargo.lock | 81 ++++++++++++++++++ tauri/src/endpoints.rs | 4 + tauri/src/endpoints/global_shortcut.rs | 85 +++++++++++++++++++ 22 files changed, 481 insertions(+), 15 deletions(-) create mode 100644 .changes/shortcut-api.md create mode 100644 api/src/globalShortcut.ts create mode 100644 tauri-api/src/shortcuts.rs create mode 100644 tauri/examples/api/src/components/Shortcuts.svelte create mode 100644 tauri/src/endpoints/global_shortcut.rs diff --git a/.changes/shortcut-api.md b/.changes/shortcut-api.md new file mode 100644 index 00000000000..48361ff2be3 --- /dev/null +++ b/.changes/shortcut-api.md @@ -0,0 +1,7 @@ +--- +"api": minor +"tauri-api": minor +"tauri": minor +--- + +Adds a global shortcut API. diff --git a/api/package.json b/api/package.json index a4e85529d16..9af7bf859cb 100644 --- a/api/package.json +++ b/api/package.json @@ -14,7 +14,8 @@ "./notification": "./dist/notification.js", "./tauri": "./dist/tauri.js", "./window": "./dist/window.js", - "./shell": "./dist/shell.js" + "./shell": "./dist/shell.js", + "./globalShortcut": "./dist/globalShortcut.js" }, "funding": { "type": "opencollective", diff --git a/api/rollup.config.js b/api/rollup.config.js index 557683a3650..52ca1875f7f 100644 --- a/api/rollup.config.js +++ b/api/rollup.config.js @@ -20,7 +20,8 @@ export default [ tauri: './src/tauri.ts', window: './src/window.ts', cli: './src/cli.ts', - notification: './src/notification.ts' + notification: './src/notification.ts', + globalShortcut: './src/globalShortcut.ts' }, treeshake: true, perf: true, diff --git a/api/src/bundle.ts b/api/src/bundle.ts index c981d1d1a62..f232b3b743e 100644 --- a/api/src/bundle.ts +++ b/api/src/bundle.ts @@ -9,6 +9,7 @@ import * as shell from './shell' import * as tauri from './tauri' import * as window from './window' import * as notification from './notification' +import * as globalShortcut from './globalShortcut' export { cli, @@ -20,5 +21,6 @@ export { shell, tauri, window, - notification + notification, + globalShortcut } diff --git a/api/src/globalShortcut.ts b/api/src/globalShortcut.ts new file mode 100644 index 00000000000..227520aa1fb --- /dev/null +++ b/api/src/globalShortcut.ts @@ -0,0 +1,39 @@ +import { promisified, transformCallback } from './tauri' + +/** + * register a global shortcut + * @param shortcut shortcut definition, modifiers and key separated by "+" e.g. Alt+Q + * @param handler shortcut handler callback + */ +async function registerShortcut( + shortcut: string, + handler: () => void +): Promise { + return await promisified({ + module: 'GlobalShortcut', + message: { + cmd: 'register', + shortcut, + handler: transformCallback(handler) + } + }) +} + +/** + * unregister a global shortcut + * @param shortcut shortcut definition, modifiers and key separated by "+" e.g. Alt+Q + */ +async function unregisterShortcut(shortcut: string): Promise { + return await promisified({ + module: 'GlobalShortcut', + message: { + cmd: 'unregister', + shortcut + } + }) +} + +export { + registerShortcut, + unregisterShortcut +} diff --git a/api/src/http.ts b/api/src/http.ts index 54047b93d0a..5fb368f341b 100644 --- a/api/src/http.ts +++ b/api/src/http.ts @@ -155,11 +155,4 @@ async function deleteRequest( }) } -export { - request, - get, - post, - put, - patch, - deleteRequest as httpDelete, -} +export { request, get, post, put, patch, deleteRequest as httpDelete } diff --git a/api/src/window.ts b/api/src/window.ts index 1459e6732ef..fef439ee34e 100644 --- a/api/src/window.ts +++ b/api/src/window.ts @@ -187,7 +187,7 @@ function resize(width: number, height: number): void { message: { cmd: 'resize', width, - height, + height } }) } diff --git a/tauri-api/Cargo.toml b/tauri-api/Cargo.toml index 03f371fb830..752be79ea1e 100644 --- a/tauri-api/Cargo.toml +++ b/tauri-api/Cargo.toml @@ -35,6 +35,7 @@ tauri-utils = { version = "0.5", path = "../tauri-utils" } clap = { version = "=3.0.0-beta.2", optional = true } notify-rust = { version = "4.2.2", optional = true } once_cell = "1.5.2" +tauri-hotkey = { git = "https://github.com/tauri-apps/tauri-hotkey-rs", branch = "dev", optional = true } [dev-dependencies] quickcheck = "1.0.3" @@ -43,3 +44,4 @@ quickcheck_macros = "1.0.0" [features] cli = [ "clap" ] notification = [ "notify-rust" ] +global-shortcut = [ "tauri-hotkey" ] diff --git a/tauri-api/src/error.rs b/tauri-api/src/error.rs index ba566281cc2..c27ed9376f1 100644 --- a/tauri-api/src/error.rs +++ b/tauri-api/src/error.rs @@ -53,6 +53,10 @@ pub enum Error { #[cfg(feature = "cli")] #[error("failed to parse CLI arguments: {0}")] ParseCliArguments(#[from] clap::Error), + /// Shortcut error. + #[cfg(feature = "global-shortcut")] + #[error("shortcut error: {0}")] + Shortcut(#[from] tauri_hotkey::Error), } impl From for Error { diff --git a/tauri-api/src/lib.rs b/tauri-api/src/lib.rs index e829a033cc1..9a28c9d575d 100644 --- a/tauri-api/src/lib.rs +++ b/tauri-api/src/lib.rs @@ -30,6 +30,10 @@ pub mod cli; #[macro_use] extern crate clap; +/// Global shortcuts interface. +#[cfg(feature = "global-shortcut")] +pub mod shortcuts; + /// The desktop notifications API module. #[cfg(feature = "notification")] pub mod notification; diff --git a/tauri-api/src/shortcuts.rs b/tauri-api/src/shortcuts.rs new file mode 100644 index 00000000000..277ed05a963 --- /dev/null +++ b/tauri-api/src/shortcuts.rs @@ -0,0 +1,30 @@ +use tauri_hotkey::{parse_hotkey, HotkeyManager}; + +/// The shortcut manager builder. +#[derive(Default)] +pub struct ShortcutManager(HotkeyManager); + +impl ShortcutManager { + /// Initializes a new instance of the shortcut manager. + pub fn new() -> Self { + Default::default() + } + + /// Registers a new shortcut handler. + pub fn register_shortcut( + &mut self, + shortcut: String, + handler: H, + ) -> crate::Result<()> { + let hotkey = parse_hotkey(&shortcut.to_uppercase().replace(" ", ""))?; + self.0.register(hotkey, handler)?; + Ok(()) + } + + /// Unregister a previously registered shortcut handler. + pub fn unregister_shortcut(&mut self, shortcut: String) -> crate::Result<()> { + let hotkey = parse_hotkey(&shortcut.to_uppercase().replace(" ", ""))?; + self.0.unregister(&hotkey)?; + Ok(()) + } +} diff --git a/tauri/Cargo.toml b/tauri/Cargo.toml index db47e82f0af..5a26c88e98e 100644 --- a/tauri/Cargo.toml +++ b/tauri/Cargo.toml @@ -49,7 +49,7 @@ serde = { version = "1.0", features = [ "derive" ] } [features] cli = [ "tauri-api/cli" ] embedded-server = [ "tiny_http" ] -all-api = [ "tauri-api/notification" ] +all-api = [ "tauri-api/notification", "tauri-api/global-shortcut" ] updater = [ ] # FS @@ -83,6 +83,9 @@ http-request = [ ] # notification notification = [ "tauri-api/notification" ] +# global shortcut +global-shortcut = [ "tauri-api/global-shortcut" ] + [[example]] name = "communication" path = "examples/communication/src-tauri/src/main.rs" diff --git a/tauri/build.rs b/tauri/build.rs index c4a93010b59..52a363118bb 100644 --- a/tauri/build.rs +++ b/tauri/build.rs @@ -44,5 +44,8 @@ fn main() { // notification notification: { any(all_api, feature = "notification") }, + + // global shortcut + global_shortcut: { any(all_api, feature = "global_shortcut" )}, } } diff --git a/tauri/examples/api/src-tauri/Cargo.lock b/tauri/examples/api/src-tauri/Cargo.lock index c09b1954a6e..729ef5f8bff 100644 --- a/tauri/examples/api/src-tauri/Cargo.lock +++ b/tauri/examples/api/src-tauri/Cargo.lock @@ -27,6 +27,15 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" +[[package]] +name = "aho-corasick" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +dependencies = [ + "memchr", +] + [[package]] name = "andrew" version = "0.3.1" @@ -2105,6 +2114,24 @@ dependencies = [ "redox_syscall 0.2.4", ] +[[package]] +name = "regex" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", +] + +[[package]] +name = "regex-syntax" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" + [[package]] name = "remove_dir_all" version = "0.5.3" @@ -2378,6 +2405,12 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b" +[[package]] +name = "strum" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c" + [[package]] name = "strum_macros" version = "0.8.0" @@ -2400,6 +2433,18 @@ dependencies = [ "syn 1.0.60", ] +[[package]] +name = "strum_macros" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149" +dependencies = [ + "heck", + "proc-macro2", + "quote 1.0.8", + "syn 1.0.60", +] + [[package]] name = "syn" version = "0.11.11" @@ -2515,6 +2560,7 @@ dependencies = [ "serde_repr", "tar", "tauri-dialog", + "tauri-hotkey", "tauri-utils", "tempfile", "thiserror", @@ -2540,6 +2586,32 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "tauri-hotkey" +version = "0.0.0" +source = "git+https://github.com/tauri-apps/tauri-hotkey-rs?branch=dev#48cda6dc66fbfc6f54c1aca3c14df9490f898729" +dependencies = [ + "log", + "once_cell", + "regex", + "serde", + "strum 0.20.0", + "strum_macros 0.20.1", + "tauri-hotkey-sys", + "thiserror", +] + +[[package]] +name = "tauri-hotkey-sys" +version = "0.0.0" +source = "git+https://github.com/tauri-apps/tauri-hotkey-rs?branch=dev#48cda6dc66fbfc6f54c1aca3c14df9490f898729" +dependencies = [ + "cc", + "thiserror", + "winapi 0.3.9", + "x11-dl", +] + [[package]] name = "tauri-macros" version = "0.1.0" @@ -2618,6 +2690,15 @@ dependencies = [ "syn 1.0.60", ] +[[package]] +name = "thread_local" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +dependencies = [ + "once_cell", +] + [[package]] name = "tiff" version = "0.6.1" diff --git a/tauri/examples/api/src/App.svelte b/tauri/examples/api/src/App.svelte index d881b209dc8..6720471479b 100644 --- a/tauri/examples/api/src/App.svelte +++ b/tauri/examples/api/src/App.svelte @@ -9,6 +9,7 @@ import Http from './components/Http.svelte' import Notifications from './components/Notifications.svelte' import Window from './components/Window.svelte' + import Shortcuts from './components/Shortcuts.svelte' const views = [{ label: 'Messages', @@ -31,6 +32,9 @@ }, { label: 'Window', component: Window + }, { + label: 'Shortcuts', + component: Shortcuts }] let selected = views[0].label; diff --git a/tauri/examples/api/src/components/Shortcuts.svelte b/tauri/examples/api/src/components/Shortcuts.svelte new file mode 100644 index 00000000000..e1a5e08d0dd --- /dev/null +++ b/tauri/examples/api/src/components/Shortcuts.svelte @@ -0,0 +1,41 @@ + + +
+
+ + +
+
+ {#each $shortcuts as savedShortcut} +
+ {savedShortcut} + +
+ {/each} +
+
\ No newline at end of file diff --git a/tauri/examples/communication/dist/__tauri.js b/tauri/examples/communication/dist/__tauri.js index 5d2c10d73b8..c48767651d2 100644 --- a/tauri/examples/communication/dist/__tauri.js +++ b/tauri/examples/communication/dist/__tauri.js @@ -1,4 +1,4 @@ -function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),j(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:G(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}("object"===("undefined"==typeof module?"undefined":_typeof(module))?module.exports:{});try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}function r(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]&&arguments[1],n=o();return Object.defineProperty(window,n,{value:function(o){return t&&Reflect.deleteProperty(window,n),r([e,"optionalCall",function(e){return e(o)}])},writable:!1,configurable:!0}),n}function u(e){return c.apply(this,arguments)}function c(){return(c=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,r){var n=i((function(t){e(t),Reflect.deleteProperty(window,o)}),!0),o=i((function(e){r(e),Reflect.deleteProperty(window,n)}),!0);a(_objectSpread({callback:n,error:o},t))}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var s=Object.freeze({__proto__:null,invoke:a,transformCallback:i,promisified:u});function p(){return(p=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Cli",message:{cmd:"cliMatches"}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var f=Object.freeze({__proto__:null,getMatches:function(){return p.apply(this,arguments)}});function l(){return(l=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.next=4,u({module:"Dialog",message:{cmd:"openDialog",options:t}});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function m(){return(m=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.next=4,u({module:"Dialog",message:{cmd:"saveDialog",options:t}});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var h=Object.freeze({__proto__:null,open:function(){return l.apply(this,arguments)},save:function(){return m.apply(this,arguments)}});var d,y=Object.freeze({__proto__:null,listen:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];a({module:"Event",message:{cmd:"listen",event:e,handler:i(t,r),once:r}})},emit:function(e,t){a({module:"Event",message:{cmd:"emit",event:e,payload:t}})}});function g(){return(g=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"readTextFile",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(){return(v=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"readBinaryFile",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(){return(w=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r=n.length>1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.next=5,u({module:"Fs",message:{cmd:"writeFile",path:t.path,contents:t.contents,options:r}});case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.Audio=1]="Audio";e[e.Cache=2]="Cache";e[e.Config=3]="Config";e[e.Data=4]="Data";e[e.LocalData=5]="LocalData";e[e.Desktop=6]="Desktop";e[e.Document=7]="Document";e[e.Download=8]="Download";e[e.Executable=9]="Executable";e[e.Font=10]="Font";e[e.Home=11]="Home";e[e.Picture=12]="Picture";e[e.Public=13]="Public";e[e.Runtime=14]="Runtime";e[e.Template=15]="Template";e[e.Video=16]="Video";e[e.Resource=17]="Resource";e[e.App=18]="App"}(d||(d={}));var b=65536;function x(e){var t=function(e){if(e.length1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.next=5,u({module:"Fs",message:{cmd:"writeBinaryFile",path:t.path,contents:x(t.contents),options:r}});case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(){return(R=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"readDir",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function T(){return(T=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"createDir",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(){return(P=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"removeDir",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:{},e.next=3,u({module:"Fs",message:{cmd:"copyFile",source:t,destination:r,options:n}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function j(){return(j=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"removeFile",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function F(){return(F=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:{},e.next=3,u({module:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:r,options:n}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var G=Object.freeze({__proto__:null,get BaseDirectory(){return d},get Dir(){return d},readTextFile:function(e){return g.apply(this,arguments)},readBinaryFile:function(e){return v.apply(this,arguments)},writeFile:function(e){return w.apply(this,arguments)},writeBinaryFile:function(e){return _.apply(this,arguments)},readDir:function(e){return R.apply(this,arguments)},createDir:function(e){return T.apply(this,arguments)},removeDir:function(e){return P.apply(this,arguments)},copyFile:function(e,t){return k.apply(this,arguments)},removeFile:function(e){return j.apply(this,arguments)},renameFile:function(e,t){return F.apply(this,arguments)}});function O(){return(O=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.App}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(){return(D=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Audio}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function S(){return(S=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Cache}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(){return(E=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Config}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function z(){return(z=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Data}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function L(){return(L=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Desktop}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function W(){return(W=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Document}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function A(){return(A=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Download}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(){return(N=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Executable}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function C(){return(C=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Font}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function H(){return(H=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Home}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function M(){return(M=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.LocalData}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(){return(B=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Picture}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function I(){return(I=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Public}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(){return(q=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Resource}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function K(){return(K=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Runtime}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function U(){return(U=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Template}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V(){return(V=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Video}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Y(){return(Y=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:t,directory:r}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var J,X,Q=Object.freeze({__proto__:null,appDir:function(){return O.apply(this,arguments)},audioDir:function(){return D.apply(this,arguments)},cacheDir:function(){return S.apply(this,arguments)},configDir:function(){return E.apply(this,arguments)},dataDir:function(){return z.apply(this,arguments)},desktopDir:function(){return L.apply(this,arguments)},documentDir:function(){return W.apply(this,arguments)},downloadDir:function(){return A.apply(this,arguments)},executableDir:function(){return N.apply(this,arguments)},fontDir:function(){return C.apply(this,arguments)},homeDir:function(){return H.apply(this,arguments)},localDataDir:function(){return M.apply(this,arguments)},pictureDir:function(){return B.apply(this,arguments)},publicDir:function(){return I.apply(this,arguments)},resourceDir:function(){return q.apply(this,arguments)},runtimeDir:function(){return K.apply(this,arguments)},templateDir:function(){return U.apply(this,arguments)},videoDir:function(){return V.apply(this,arguments)},resolvePath:function(e,t){return Y.apply(this,arguments)}});function Z(e){return $.apply(this,arguments)}function $(){return($=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Http",message:{cmd:"httpRequest",options:t}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ee(){return(ee=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"GET",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function te(){return(te=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"POST",url:t,body:r},n));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function re(){return(re=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"PUT",url:t,body:r},n));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ne(){return(ne=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"PATCH",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(){return(oe=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"DELETE",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.JSON=1]="JSON";e[e.Text=2]="Text";e[e.Binary=3]="Binary"}(J||(J={})),function(e){e[e.Form=1]="Form";e[e.File=2]="File";e[e.Auto=3]="Auto"}(X||(X={}));var ae=Object.freeze({__proto__:null,get ResponseType(){return J},get BodyType(){return X},request:Z,get:function(e,t){return ee.apply(this,arguments)},post:function(e,t,r){return te.apply(this,arguments)},put:function(e,t,r){return re.apply(this,arguments)},patch:function(e,t){return ne.apply(this,arguments)},httpDelete:function(e,t){return oe.apply(this,arguments)}});function ie(){return(ie=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r)&&Object.freeze(r),e.next=3,u({module:"Shell",message:{cmd:"execute",command:t,args:"string"==typeof r?[r]:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ue=Object.freeze({__proto__:null,execute:function(e,t){return ie.apply(this,arguments)},open:function(e){a({module:"Shell",message:{cmd:"open",uri:e}})}});var ce=Object.freeze({__proto__:null,setResizable:function(e){a({module:"Window",message:{cmd:"setResizable",resizable:e}})},setTitle:function(e){a({module:"Window",message:{cmd:"setTitle",title:e}})},maximize:function(){a({module:"Window",message:{cmd:"maximize"}})},unmaximize:function(){a({module:"Window",message:{cmd:"unmaximize"}})},minimize:function(){a({module:"Window",message:{cmd:"minimize"}})},unminimize:function(){a({module:"Window",message:{cmd:"unminimize"}})},show:function(){a({module:"Window",message:{cmd:"show"}})},hide:function(){a({module:"Window",message:{cmd:"hide"}})},setTransparent:function(e){a({module:"Window",message:{cmd:"setTransparent",transparent:e}})},setDecorations:function(e){a({module:"Window",message:{cmd:"setDecorations",decorations:e}})},setAlwaysOnTop:function(e){a({module:"Window",message:{cmd:"setAlwaysOnTop",alwaysOnTop:e}})},setWidth:function(e){a({module:"Window",message:{cmd:"setWidth",width:e}})},setHeight:function(e){a({module:"Window",message:{cmd:"setHeight",height:e}})},resize:function(e,t){a({module:"Window",message:{cmd:"resize",width:e,height:t}})},setMinSize:function(e,t){a({module:"Window",message:{cmd:"setMinSize",minWidth:e,minHeight:t}})},setMaxSize:function(e,t){a({module:"Window",message:{cmd:"setMaxSize",maxWidth:e,maxHeight:t}})},setX:function(e){a({module:"Window",message:{cmd:"setX",x:e}})},setY:function(e){a({module:"Window",message:{cmd:"setY",y:e}})},setPosition:function(e,t){a({module:"Window",message:{cmd:"setPosition",x:e,y:t}})},setFullscreen:function(e){a({module:"Window",message:{cmd:"setFullscreen",fullscreen:e}})},setIcon:function(e){a({module:"Window",message:{cmd:"setIcon",icon:e}})}});function se(){return(se=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("default"===window.Notification.permission){e.next=4;break}return e.next=3,Promise.resolve("granted"===window.Notification.permission);case 3:return e.abrupt("return",e.sent);case 4:return e.next=6,u({module:"Notification",message:{cmd:"isNotificationPermissionGranted"}});case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pe(){return(pe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,window.Notification.requestPermission();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var fe=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return pe.apply(this,arguments)},isPermissionGranted:function(){return se.apply(this,arguments)}});e.cli=f,e.dialog=h,e.event=y,e.fs=G,e.http=ae,e.notification=fe,e.path=Q,e.shell=ue,e.tauri=s,e.window=ce,Object.defineProperty(e,"__esModule",{value:!0})})); +function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),G(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;G(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}("object"===("undefined"==typeof module?"undefined":_typeof(module))?module.exports:{});try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}function r(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]&&arguments[1],n=o();return Object.defineProperty(window,n,{value:function(o){return t&&Reflect.deleteProperty(window,n),r([e,"optionalCall",function(e){return e(o)}])},writable:!1,configurable:!0}),n}function u(e){return c.apply(this,arguments)}function c(){return(c=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,r){var n=i((function(t){e(t),Reflect.deleteProperty(window,o)}),!0),o=i((function(e){r(e),Reflect.deleteProperty(window,n)}),!0);a(_objectSpread({callback:n,error:o},t))}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var s=Object.freeze({__proto__:null,invoke:a,transformCallback:i,promisified:u});function p(){return(p=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Cli",message:{cmd:"cliMatches"}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var f=Object.freeze({__proto__:null,getMatches:function(){return p.apply(this,arguments)}});function l(){return(l=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.next=4,u({module:"Dialog",message:{cmd:"openDialog",options:t}});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function m(){return(m=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.next=4,u({module:"Dialog",message:{cmd:"saveDialog",options:t}});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var h=Object.freeze({__proto__:null,open:function(){return l.apply(this,arguments)},save:function(){return m.apply(this,arguments)}});var d,y=Object.freeze({__proto__:null,listen:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];a({module:"Event",message:{cmd:"listen",event:e,handler:i(t,r),once:r}})},emit:function(e,t){a({module:"Event",message:{cmd:"emit",event:e,payload:t}})}});function g(){return(g=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"readTextFile",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(){return(v=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"readBinaryFile",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(){return(w=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r=n.length>1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.next=5,u({module:"Fs",message:{cmd:"writeFile",path:t.path,contents:t.contents,options:r}});case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.Audio=1]="Audio";e[e.Cache=2]="Cache";e[e.Config=3]="Config";e[e.Data=4]="Data";e[e.LocalData=5]="LocalData";e[e.Desktop=6]="Desktop";e[e.Document=7]="Document";e[e.Download=8]="Download";e[e.Executable=9]="Executable";e[e.Font=10]="Font";e[e.Home=11]="Home";e[e.Picture=12]="Picture";e[e.Public=13]="Public";e[e.Runtime=14]="Runtime";e[e.Template=15]="Template";e[e.Video=16]="Video";e[e.Resource=17]="Resource";e[e.App=18]="App"}(d||(d={}));var b=65536;function x(e){var t=function(e){if(e.length1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.next=5,u({module:"Fs",message:{cmd:"writeBinaryFile",path:t.path,contents:x(t.contents),options:r}});case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(){return(R=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"readDir",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function T(){return(T=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"createDir",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(){return(P=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"removeDir",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:{},e.next=3,u({module:"Fs",message:{cmd:"copyFile",source:t,destination:r,options:n}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function G(){return(G=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"removeFile",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function j(){return(j=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:{},e.next=3,u({module:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:r,options:n}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var F=Object.freeze({__proto__:null,get BaseDirectory(){return d},get Dir(){return d},readTextFile:function(e){return g.apply(this,arguments)},readBinaryFile:function(e){return v.apply(this,arguments)},writeFile:function(e){return w.apply(this,arguments)},writeBinaryFile:function(e){return _.apply(this,arguments)},readDir:function(e){return R.apply(this,arguments)},createDir:function(e){return T.apply(this,arguments)},removeDir:function(e){return P.apply(this,arguments)},copyFile:function(e,t){return k.apply(this,arguments)},removeFile:function(e){return G.apply(this,arguments)},renameFile:function(e,t){return j.apply(this,arguments)}});function O(){return(O=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.App}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(){return(D=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Audio}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function S(){return(S=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Cache}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function z(){return(z=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Config}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(){return(E=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Data}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function L(){return(L=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Desktop}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function W(){return(W=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Document}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function A(){return(A=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Download}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(){return(N=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Executable}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function C(){return(C=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Font}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function H(){return(H=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Home}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function M(){return(M=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.LocalData}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(){return(B=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Picture}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function I(){return(I=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Public}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(){return(q=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Resource}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function K(){return(K=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Runtime}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function U(){return(U=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Template}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V(){return(V=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Video}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Y(){return(Y=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:t,directory:r}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var J,X,Q=Object.freeze({__proto__:null,appDir:function(){return O.apply(this,arguments)},audioDir:function(){return D.apply(this,arguments)},cacheDir:function(){return S.apply(this,arguments)},configDir:function(){return z.apply(this,arguments)},dataDir:function(){return E.apply(this,arguments)},desktopDir:function(){return L.apply(this,arguments)},documentDir:function(){return W.apply(this,arguments)},downloadDir:function(){return A.apply(this,arguments)},executableDir:function(){return N.apply(this,arguments)},fontDir:function(){return C.apply(this,arguments)},homeDir:function(){return H.apply(this,arguments)},localDataDir:function(){return M.apply(this,arguments)},pictureDir:function(){return B.apply(this,arguments)},publicDir:function(){return I.apply(this,arguments)},resourceDir:function(){return q.apply(this,arguments)},runtimeDir:function(){return K.apply(this,arguments)},templateDir:function(){return U.apply(this,arguments)},videoDir:function(){return V.apply(this,arguments)},resolvePath:function(e,t){return Y.apply(this,arguments)}});function Z(e){return $.apply(this,arguments)}function $(){return($=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Http",message:{cmd:"httpRequest",options:t}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ee(){return(ee=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"GET",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function te(){return(te=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"POST",url:t,body:r},n));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function re(){return(re=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"PUT",url:t,body:r},n));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ne(){return(ne=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"PATCH",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(){return(oe=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"DELETE",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.JSON=1]="JSON";e[e.Text=2]="Text";e[e.Binary=3]="Binary"}(J||(J={})),function(e){e[e.Form=1]="Form";e[e.File=2]="File";e[e.Auto=3]="Auto"}(X||(X={}));var ae=Object.freeze({__proto__:null,get ResponseType(){return J},get BodyType(){return X},request:Z,get:function(e,t){return ee.apply(this,arguments)},post:function(e,t,r){return te.apply(this,arguments)},put:function(e,t,r){return re.apply(this,arguments)},patch:function(e,t){return ne.apply(this,arguments)},httpDelete:function(e,t){return oe.apply(this,arguments)}});function ie(){return(ie=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r)&&Object.freeze(r),e.next=3,u({module:"Shell",message:{cmd:"execute",command:t,args:"string"==typeof r?[r]:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ue=Object.freeze({__proto__:null,execute:function(e,t){return ie.apply(this,arguments)},open:function(e){a({module:"Shell",message:{cmd:"open",uri:e}})}});var ce=Object.freeze({__proto__:null,setResizable:function(e){a({module:"Window",message:{cmd:"setResizable",resizable:e}})},setTitle:function(e){a({module:"Window",message:{cmd:"setTitle",title:e}})},maximize:function(){a({module:"Window",message:{cmd:"maximize"}})},unmaximize:function(){a({module:"Window",message:{cmd:"unmaximize"}})},minimize:function(){a({module:"Window",message:{cmd:"minimize"}})},unminimize:function(){a({module:"Window",message:{cmd:"unminimize"}})},show:function(){a({module:"Window",message:{cmd:"show"}})},hide:function(){a({module:"Window",message:{cmd:"hide"}})},setTransparent:function(e){a({module:"Window",message:{cmd:"setTransparent",transparent:e}})},setDecorations:function(e){a({module:"Window",message:{cmd:"setDecorations",decorations:e}})},setAlwaysOnTop:function(e){a({module:"Window",message:{cmd:"setAlwaysOnTop",alwaysOnTop:e}})},setWidth:function(e){a({module:"Window",message:{cmd:"setWidth",width:e}})},setHeight:function(e){a({module:"Window",message:{cmd:"setHeight",height:e}})},resize:function(e,t){a({module:"Window",message:{cmd:"resize",width:e,height:t}})},setMinSize:function(e,t){a({module:"Window",message:{cmd:"setMinSize",minWidth:e,minHeight:t}})},setMaxSize:function(e,t){a({module:"Window",message:{cmd:"setMaxSize",maxWidth:e,maxHeight:t}})},setX:function(e){a({module:"Window",message:{cmd:"setX",x:e}})},setY:function(e){a({module:"Window",message:{cmd:"setY",y:e}})},setPosition:function(e,t){a({module:"Window",message:{cmd:"setPosition",x:e,y:t}})},setFullscreen:function(e){a({module:"Window",message:{cmd:"setFullscreen",fullscreen:e}})},setIcon:function(e){a({module:"Window",message:{cmd:"setIcon",icon:e}})}});function se(){return(se=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("default"===window.Notification.permission){e.next=4;break}return e.next=3,Promise.resolve("granted"===window.Notification.permission);case 3:return e.abrupt("return",e.sent);case 4:return e.next=6,u({module:"Notification",message:{cmd:"isNotificationPermissionGranted"}});case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pe(){return(pe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,window.Notification.requestPermission();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var fe=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return pe.apply(this,arguments)},isPermissionGranted:function(){return se.apply(this,arguments)}});function le(){return(le=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:i(r)}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function me(){return(me=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var he=Object.freeze({__proto__:null,registerShortcut:function(e,t){return le.apply(this,arguments)},unregisterShortcut:function(e){return me.apply(this,arguments)}});e.cli=f,e.dialog=h,e.event=y,e.fs=F,e.globalShortcut=he,e.http=ae,e.notification=fe,e.path=Q,e.shell=ue,e.tauri=s,e.window=ce,Object.defineProperty(e,"__esModule",{value:!0})})); // polyfills diff --git a/tauri/examples/communication/src-tauri/Cargo.lock b/tauri/examples/communication/src-tauri/Cargo.lock index c09b1954a6e..729ef5f8bff 100644 --- a/tauri/examples/communication/src-tauri/Cargo.lock +++ b/tauri/examples/communication/src-tauri/Cargo.lock @@ -27,6 +27,15 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" +[[package]] +name = "aho-corasick" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +dependencies = [ + "memchr", +] + [[package]] name = "andrew" version = "0.3.1" @@ -2105,6 +2114,24 @@ dependencies = [ "redox_syscall 0.2.4", ] +[[package]] +name = "regex" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", +] + +[[package]] +name = "regex-syntax" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" + [[package]] name = "remove_dir_all" version = "0.5.3" @@ -2378,6 +2405,12 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b" +[[package]] +name = "strum" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c" + [[package]] name = "strum_macros" version = "0.8.0" @@ -2400,6 +2433,18 @@ dependencies = [ "syn 1.0.60", ] +[[package]] +name = "strum_macros" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149" +dependencies = [ + "heck", + "proc-macro2", + "quote 1.0.8", + "syn 1.0.60", +] + [[package]] name = "syn" version = "0.11.11" @@ -2515,6 +2560,7 @@ dependencies = [ "serde_repr", "tar", "tauri-dialog", + "tauri-hotkey", "tauri-utils", "tempfile", "thiserror", @@ -2540,6 +2586,32 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "tauri-hotkey" +version = "0.0.0" +source = "git+https://github.com/tauri-apps/tauri-hotkey-rs?branch=dev#48cda6dc66fbfc6f54c1aca3c14df9490f898729" +dependencies = [ + "log", + "once_cell", + "regex", + "serde", + "strum 0.20.0", + "strum_macros 0.20.1", + "tauri-hotkey-sys", + "thiserror", +] + +[[package]] +name = "tauri-hotkey-sys" +version = "0.0.0" +source = "git+https://github.com/tauri-apps/tauri-hotkey-rs?branch=dev#48cda6dc66fbfc6f54c1aca3c14df9490f898729" +dependencies = [ + "cc", + "thiserror", + "winapi 0.3.9", + "x11-dl", +] + [[package]] name = "tauri-macros" version = "0.1.0" @@ -2618,6 +2690,15 @@ dependencies = [ "syn 1.0.60", ] +[[package]] +name = "thread_local" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +dependencies = [ + "once_cell", +] + [[package]] name = "tiff" version = "0.6.1" diff --git a/tauri/examples/multiwindow/dist/__tauri.js b/tauri/examples/multiwindow/dist/__tauri.js index 5d2c10d73b8..c48767651d2 100644 --- a/tauri/examples/multiwindow/dist/__tauri.js +++ b/tauri/examples/multiwindow/dist/__tauri.js @@ -1,4 +1,4 @@ -function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),j(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:G(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}("object"===("undefined"==typeof module?"undefined":_typeof(module))?module.exports:{});try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}function r(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]&&arguments[1],n=o();return Object.defineProperty(window,n,{value:function(o){return t&&Reflect.deleteProperty(window,n),r([e,"optionalCall",function(e){return e(o)}])},writable:!1,configurable:!0}),n}function u(e){return c.apply(this,arguments)}function c(){return(c=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,r){var n=i((function(t){e(t),Reflect.deleteProperty(window,o)}),!0),o=i((function(e){r(e),Reflect.deleteProperty(window,n)}),!0);a(_objectSpread({callback:n,error:o},t))}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var s=Object.freeze({__proto__:null,invoke:a,transformCallback:i,promisified:u});function p(){return(p=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Cli",message:{cmd:"cliMatches"}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var f=Object.freeze({__proto__:null,getMatches:function(){return p.apply(this,arguments)}});function l(){return(l=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.next=4,u({module:"Dialog",message:{cmd:"openDialog",options:t}});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function m(){return(m=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.next=4,u({module:"Dialog",message:{cmd:"saveDialog",options:t}});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var h=Object.freeze({__proto__:null,open:function(){return l.apply(this,arguments)},save:function(){return m.apply(this,arguments)}});var d,y=Object.freeze({__proto__:null,listen:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];a({module:"Event",message:{cmd:"listen",event:e,handler:i(t,r),once:r}})},emit:function(e,t){a({module:"Event",message:{cmd:"emit",event:e,payload:t}})}});function g(){return(g=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"readTextFile",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(){return(v=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"readBinaryFile",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(){return(w=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r=n.length>1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.next=5,u({module:"Fs",message:{cmd:"writeFile",path:t.path,contents:t.contents,options:r}});case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.Audio=1]="Audio";e[e.Cache=2]="Cache";e[e.Config=3]="Config";e[e.Data=4]="Data";e[e.LocalData=5]="LocalData";e[e.Desktop=6]="Desktop";e[e.Document=7]="Document";e[e.Download=8]="Download";e[e.Executable=9]="Executable";e[e.Font=10]="Font";e[e.Home=11]="Home";e[e.Picture=12]="Picture";e[e.Public=13]="Public";e[e.Runtime=14]="Runtime";e[e.Template=15]="Template";e[e.Video=16]="Video";e[e.Resource=17]="Resource";e[e.App=18]="App"}(d||(d={}));var b=65536;function x(e){var t=function(e){if(e.length1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.next=5,u({module:"Fs",message:{cmd:"writeBinaryFile",path:t.path,contents:x(t.contents),options:r}});case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(){return(R=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"readDir",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function T(){return(T=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"createDir",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(){return(P=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"removeDir",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:{},e.next=3,u({module:"Fs",message:{cmd:"copyFile",source:t,destination:r,options:n}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function j(){return(j=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"removeFile",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function F(){return(F=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:{},e.next=3,u({module:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:r,options:n}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var G=Object.freeze({__proto__:null,get BaseDirectory(){return d},get Dir(){return d},readTextFile:function(e){return g.apply(this,arguments)},readBinaryFile:function(e){return v.apply(this,arguments)},writeFile:function(e){return w.apply(this,arguments)},writeBinaryFile:function(e){return _.apply(this,arguments)},readDir:function(e){return R.apply(this,arguments)},createDir:function(e){return T.apply(this,arguments)},removeDir:function(e){return P.apply(this,arguments)},copyFile:function(e,t){return k.apply(this,arguments)},removeFile:function(e){return j.apply(this,arguments)},renameFile:function(e,t){return F.apply(this,arguments)}});function O(){return(O=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.App}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(){return(D=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Audio}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function S(){return(S=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Cache}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(){return(E=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Config}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function z(){return(z=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Data}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function L(){return(L=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Desktop}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function W(){return(W=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Document}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function A(){return(A=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Download}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(){return(N=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Executable}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function C(){return(C=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Font}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function H(){return(H=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Home}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function M(){return(M=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.LocalData}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(){return(B=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Picture}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function I(){return(I=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Public}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(){return(q=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Resource}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function K(){return(K=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Runtime}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function U(){return(U=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Template}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V(){return(V=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Video}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Y(){return(Y=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:t,directory:r}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var J,X,Q=Object.freeze({__proto__:null,appDir:function(){return O.apply(this,arguments)},audioDir:function(){return D.apply(this,arguments)},cacheDir:function(){return S.apply(this,arguments)},configDir:function(){return E.apply(this,arguments)},dataDir:function(){return z.apply(this,arguments)},desktopDir:function(){return L.apply(this,arguments)},documentDir:function(){return W.apply(this,arguments)},downloadDir:function(){return A.apply(this,arguments)},executableDir:function(){return N.apply(this,arguments)},fontDir:function(){return C.apply(this,arguments)},homeDir:function(){return H.apply(this,arguments)},localDataDir:function(){return M.apply(this,arguments)},pictureDir:function(){return B.apply(this,arguments)},publicDir:function(){return I.apply(this,arguments)},resourceDir:function(){return q.apply(this,arguments)},runtimeDir:function(){return K.apply(this,arguments)},templateDir:function(){return U.apply(this,arguments)},videoDir:function(){return V.apply(this,arguments)},resolvePath:function(e,t){return Y.apply(this,arguments)}});function Z(e){return $.apply(this,arguments)}function $(){return($=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Http",message:{cmd:"httpRequest",options:t}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ee(){return(ee=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"GET",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function te(){return(te=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"POST",url:t,body:r},n));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function re(){return(re=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"PUT",url:t,body:r},n));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ne(){return(ne=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"PATCH",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(){return(oe=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"DELETE",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.JSON=1]="JSON";e[e.Text=2]="Text";e[e.Binary=3]="Binary"}(J||(J={})),function(e){e[e.Form=1]="Form";e[e.File=2]="File";e[e.Auto=3]="Auto"}(X||(X={}));var ae=Object.freeze({__proto__:null,get ResponseType(){return J},get BodyType(){return X},request:Z,get:function(e,t){return ee.apply(this,arguments)},post:function(e,t,r){return te.apply(this,arguments)},put:function(e,t,r){return re.apply(this,arguments)},patch:function(e,t){return ne.apply(this,arguments)},httpDelete:function(e,t){return oe.apply(this,arguments)}});function ie(){return(ie=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r)&&Object.freeze(r),e.next=3,u({module:"Shell",message:{cmd:"execute",command:t,args:"string"==typeof r?[r]:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ue=Object.freeze({__proto__:null,execute:function(e,t){return ie.apply(this,arguments)},open:function(e){a({module:"Shell",message:{cmd:"open",uri:e}})}});var ce=Object.freeze({__proto__:null,setResizable:function(e){a({module:"Window",message:{cmd:"setResizable",resizable:e}})},setTitle:function(e){a({module:"Window",message:{cmd:"setTitle",title:e}})},maximize:function(){a({module:"Window",message:{cmd:"maximize"}})},unmaximize:function(){a({module:"Window",message:{cmd:"unmaximize"}})},minimize:function(){a({module:"Window",message:{cmd:"minimize"}})},unminimize:function(){a({module:"Window",message:{cmd:"unminimize"}})},show:function(){a({module:"Window",message:{cmd:"show"}})},hide:function(){a({module:"Window",message:{cmd:"hide"}})},setTransparent:function(e){a({module:"Window",message:{cmd:"setTransparent",transparent:e}})},setDecorations:function(e){a({module:"Window",message:{cmd:"setDecorations",decorations:e}})},setAlwaysOnTop:function(e){a({module:"Window",message:{cmd:"setAlwaysOnTop",alwaysOnTop:e}})},setWidth:function(e){a({module:"Window",message:{cmd:"setWidth",width:e}})},setHeight:function(e){a({module:"Window",message:{cmd:"setHeight",height:e}})},resize:function(e,t){a({module:"Window",message:{cmd:"resize",width:e,height:t}})},setMinSize:function(e,t){a({module:"Window",message:{cmd:"setMinSize",minWidth:e,minHeight:t}})},setMaxSize:function(e,t){a({module:"Window",message:{cmd:"setMaxSize",maxWidth:e,maxHeight:t}})},setX:function(e){a({module:"Window",message:{cmd:"setX",x:e}})},setY:function(e){a({module:"Window",message:{cmd:"setY",y:e}})},setPosition:function(e,t){a({module:"Window",message:{cmd:"setPosition",x:e,y:t}})},setFullscreen:function(e){a({module:"Window",message:{cmd:"setFullscreen",fullscreen:e}})},setIcon:function(e){a({module:"Window",message:{cmd:"setIcon",icon:e}})}});function se(){return(se=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("default"===window.Notification.permission){e.next=4;break}return e.next=3,Promise.resolve("granted"===window.Notification.permission);case 3:return e.abrupt("return",e.sent);case 4:return e.next=6,u({module:"Notification",message:{cmd:"isNotificationPermissionGranted"}});case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pe(){return(pe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,window.Notification.requestPermission();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var fe=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return pe.apply(this,arguments)},isPermissionGranted:function(){return se.apply(this,arguments)}});e.cli=f,e.dialog=h,e.event=y,e.fs=G,e.http=ae,e.notification=fe,e.path=Q,e.shell=ue,e.tauri=s,e.window=ce,Object.defineProperty(e,"__esModule",{value:!0})})); +function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),G(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;G(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}("object"===("undefined"==typeof module?"undefined":_typeof(module))?module.exports:{});try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}function r(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]&&arguments[1],n=o();return Object.defineProperty(window,n,{value:function(o){return t&&Reflect.deleteProperty(window,n),r([e,"optionalCall",function(e){return e(o)}])},writable:!1,configurable:!0}),n}function u(e){return c.apply(this,arguments)}function c(){return(c=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,r){var n=i((function(t){e(t),Reflect.deleteProperty(window,o)}),!0),o=i((function(e){r(e),Reflect.deleteProperty(window,n)}),!0);a(_objectSpread({callback:n,error:o},t))}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var s=Object.freeze({__proto__:null,invoke:a,transformCallback:i,promisified:u});function p(){return(p=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Cli",message:{cmd:"cliMatches"}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var f=Object.freeze({__proto__:null,getMatches:function(){return p.apply(this,arguments)}});function l(){return(l=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.next=4,u({module:"Dialog",message:{cmd:"openDialog",options:t}});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function m(){return(m=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.next=4,u({module:"Dialog",message:{cmd:"saveDialog",options:t}});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var h=Object.freeze({__proto__:null,open:function(){return l.apply(this,arguments)},save:function(){return m.apply(this,arguments)}});var d,y=Object.freeze({__proto__:null,listen:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];a({module:"Event",message:{cmd:"listen",event:e,handler:i(t,r),once:r}})},emit:function(e,t){a({module:"Event",message:{cmd:"emit",event:e,payload:t}})}});function g(){return(g=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"readTextFile",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(){return(v=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"readBinaryFile",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(){return(w=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r=n.length>1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.next=5,u({module:"Fs",message:{cmd:"writeFile",path:t.path,contents:t.contents,options:r}});case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.Audio=1]="Audio";e[e.Cache=2]="Cache";e[e.Config=3]="Config";e[e.Data=4]="Data";e[e.LocalData=5]="LocalData";e[e.Desktop=6]="Desktop";e[e.Document=7]="Document";e[e.Download=8]="Download";e[e.Executable=9]="Executable";e[e.Font=10]="Font";e[e.Home=11]="Home";e[e.Picture=12]="Picture";e[e.Public=13]="Public";e[e.Runtime=14]="Runtime";e[e.Template=15]="Template";e[e.Video=16]="Video";e[e.Resource=17]="Resource";e[e.App=18]="App"}(d||(d={}));var b=65536;function x(e){var t=function(e){if(e.length1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.next=5,u({module:"Fs",message:{cmd:"writeBinaryFile",path:t.path,contents:x(t.contents),options:r}});case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(){return(R=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"readDir",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function T(){return(T=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"createDir",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(){return(P=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"removeDir",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:{},e.next=3,u({module:"Fs",message:{cmd:"copyFile",source:t,destination:r,options:n}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function G(){return(G=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({module:"Fs",message:{cmd:"removeFile",path:t,options:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function j(){return(j=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:{},e.next=3,u({module:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:r,options:n}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var F=Object.freeze({__proto__:null,get BaseDirectory(){return d},get Dir(){return d},readTextFile:function(e){return g.apply(this,arguments)},readBinaryFile:function(e){return v.apply(this,arguments)},writeFile:function(e){return w.apply(this,arguments)},writeBinaryFile:function(e){return _.apply(this,arguments)},readDir:function(e){return R.apply(this,arguments)},createDir:function(e){return T.apply(this,arguments)},removeDir:function(e){return P.apply(this,arguments)},copyFile:function(e,t){return k.apply(this,arguments)},removeFile:function(e){return G.apply(this,arguments)},renameFile:function(e,t){return j.apply(this,arguments)}});function O(){return(O=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.App}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(){return(D=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Audio}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function S(){return(S=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Cache}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function z(){return(z=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Config}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(){return(E=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Data}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function L(){return(L=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Desktop}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function W(){return(W=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Document}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function A(){return(A=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Download}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(){return(N=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Executable}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function C(){return(C=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Font}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function H(){return(H=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Home}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function M(){return(M=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.LocalData}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(){return(B=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Picture}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function I(){return(I=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Public}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(){return(q=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Resource}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function K(){return(K=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Runtime}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function U(){return(U=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Template}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V(){return(V=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:"",directory:d.Video}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Y(){return(Y=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Fs",message:{cmd:"resolvePath",path:t,directory:r}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var J,X,Q=Object.freeze({__proto__:null,appDir:function(){return O.apply(this,arguments)},audioDir:function(){return D.apply(this,arguments)},cacheDir:function(){return S.apply(this,arguments)},configDir:function(){return z.apply(this,arguments)},dataDir:function(){return E.apply(this,arguments)},desktopDir:function(){return L.apply(this,arguments)},documentDir:function(){return W.apply(this,arguments)},downloadDir:function(){return A.apply(this,arguments)},executableDir:function(){return N.apply(this,arguments)},fontDir:function(){return C.apply(this,arguments)},homeDir:function(){return H.apply(this,arguments)},localDataDir:function(){return M.apply(this,arguments)},pictureDir:function(){return B.apply(this,arguments)},publicDir:function(){return I.apply(this,arguments)},resourceDir:function(){return q.apply(this,arguments)},runtimeDir:function(){return K.apply(this,arguments)},templateDir:function(){return U.apply(this,arguments)},videoDir:function(){return V.apply(this,arguments)},resolvePath:function(e,t){return Y.apply(this,arguments)}});function Z(e){return $.apply(this,arguments)}function $(){return($=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"Http",message:{cmd:"httpRequest",options:t}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ee(){return(ee=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"GET",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function te(){return(te=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"POST",url:t,body:r},n));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function re(){return(re=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"PUT",url:t,body:r},n));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ne(){return(ne=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"PATCH",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(){return(oe=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(_objectSpread({method:"DELETE",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.JSON=1]="JSON";e[e.Text=2]="Text";e[e.Binary=3]="Binary"}(J||(J={})),function(e){e[e.Form=1]="Form";e[e.File=2]="File";e[e.Auto=3]="Auto"}(X||(X={}));var ae=Object.freeze({__proto__:null,get ResponseType(){return J},get BodyType(){return X},request:Z,get:function(e,t){return ee.apply(this,arguments)},post:function(e,t,r){return te.apply(this,arguments)},put:function(e,t,r){return re.apply(this,arguments)},patch:function(e,t){return ne.apply(this,arguments)},httpDelete:function(e,t){return oe.apply(this,arguments)}});function ie(){return(ie=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r)&&Object.freeze(r),e.next=3,u({module:"Shell",message:{cmd:"execute",command:t,args:"string"==typeof r?[r]:r}});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ue=Object.freeze({__proto__:null,execute:function(e,t){return ie.apply(this,arguments)},open:function(e){a({module:"Shell",message:{cmd:"open",uri:e}})}});var ce=Object.freeze({__proto__:null,setResizable:function(e){a({module:"Window",message:{cmd:"setResizable",resizable:e}})},setTitle:function(e){a({module:"Window",message:{cmd:"setTitle",title:e}})},maximize:function(){a({module:"Window",message:{cmd:"maximize"}})},unmaximize:function(){a({module:"Window",message:{cmd:"unmaximize"}})},minimize:function(){a({module:"Window",message:{cmd:"minimize"}})},unminimize:function(){a({module:"Window",message:{cmd:"unminimize"}})},show:function(){a({module:"Window",message:{cmd:"show"}})},hide:function(){a({module:"Window",message:{cmd:"hide"}})},setTransparent:function(e){a({module:"Window",message:{cmd:"setTransparent",transparent:e}})},setDecorations:function(e){a({module:"Window",message:{cmd:"setDecorations",decorations:e}})},setAlwaysOnTop:function(e){a({module:"Window",message:{cmd:"setAlwaysOnTop",alwaysOnTop:e}})},setWidth:function(e){a({module:"Window",message:{cmd:"setWidth",width:e}})},setHeight:function(e){a({module:"Window",message:{cmd:"setHeight",height:e}})},resize:function(e,t){a({module:"Window",message:{cmd:"resize",width:e,height:t}})},setMinSize:function(e,t){a({module:"Window",message:{cmd:"setMinSize",minWidth:e,minHeight:t}})},setMaxSize:function(e,t){a({module:"Window",message:{cmd:"setMaxSize",maxWidth:e,maxHeight:t}})},setX:function(e){a({module:"Window",message:{cmd:"setX",x:e}})},setY:function(e){a({module:"Window",message:{cmd:"setY",y:e}})},setPosition:function(e,t){a({module:"Window",message:{cmd:"setPosition",x:e,y:t}})},setFullscreen:function(e){a({module:"Window",message:{cmd:"setFullscreen",fullscreen:e}})},setIcon:function(e){a({module:"Window",message:{cmd:"setIcon",icon:e}})}});function se(){return(se=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("default"===window.Notification.permission){e.next=4;break}return e.next=3,Promise.resolve("granted"===window.Notification.permission);case 3:return e.abrupt("return",e.sent);case 4:return e.next=6,u({module:"Notification",message:{cmd:"isNotificationPermissionGranted"}});case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pe(){return(pe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,window.Notification.requestPermission();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var fe=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return pe.apply(this,arguments)},isPermissionGranted:function(){return se.apply(this,arguments)}});function le(){return(le=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:i(r)}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function me(){return(me=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({module:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var he=Object.freeze({__proto__:null,registerShortcut:function(e,t){return le.apply(this,arguments)},unregisterShortcut:function(e){return me.apply(this,arguments)}});e.cli=f,e.dialog=h,e.event=y,e.fs=F,e.globalShortcut=he,e.http=ae,e.notification=fe,e.path=Q,e.shell=ue,e.tauri=s,e.window=ce,Object.defineProperty(e,"__esModule",{value:!0})})); // polyfills diff --git a/tauri/examples/multiwindow/src-tauri/Cargo.lock b/tauri/examples/multiwindow/src-tauri/Cargo.lock index 33dd0e8e245..5be91ca5e2b 100644 --- a/tauri/examples/multiwindow/src-tauri/Cargo.lock +++ b/tauri/examples/multiwindow/src-tauri/Cargo.lock @@ -27,6 +27,15 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" +[[package]] +name = "aho-corasick" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +dependencies = [ + "memchr", +] + [[package]] name = "andrew" version = "0.3.1" @@ -2038,6 +2047,24 @@ dependencies = [ "redox_syscall 0.2.4", ] +[[package]] +name = "regex" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", +] + +[[package]] +name = "regex-syntax" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" + [[package]] name = "remove_dir_all" version = "0.5.3" @@ -2305,6 +2332,12 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b" +[[package]] +name = "strum" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c" + [[package]] name = "strum_macros" version = "0.8.0" @@ -2327,6 +2360,18 @@ dependencies = [ "syn 1.0.60", ] +[[package]] +name = "strum_macros" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149" +dependencies = [ + "heck", + "proc-macro2", + "quote 1.0.8", + "syn 1.0.60", +] + [[package]] name = "syn" version = "0.11.11" @@ -2441,6 +2486,7 @@ dependencies = [ "serde_repr", "tar", "tauri-dialog", + "tauri-hotkey", "tauri-utils", "tempfile", "thiserror", @@ -2466,6 +2512,32 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "tauri-hotkey" +version = "0.0.0" +source = "git+https://github.com/tauri-apps/tauri-hotkey-rs?branch=dev#48cda6dc66fbfc6f54c1aca3c14df9490f898729" +dependencies = [ + "log", + "once_cell", + "regex", + "serde", + "strum 0.20.0", + "strum_macros 0.20.1", + "tauri-hotkey-sys", + "thiserror", +] + +[[package]] +name = "tauri-hotkey-sys" +version = "0.0.0" +source = "git+https://github.com/tauri-apps/tauri-hotkey-rs?branch=dev#48cda6dc66fbfc6f54c1aca3c14df9490f898729" +dependencies = [ + "cc", + "thiserror", + "winapi 0.3.9", + "x11-dl", +] + [[package]] name = "tauri-macros" version = "0.1.0" @@ -2526,6 +2598,15 @@ dependencies = [ "syn 1.0.60", ] +[[package]] +name = "thread_local" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +dependencies = [ + "once_cell", +] + [[package]] name = "tiff" version = "0.6.1" diff --git a/tauri/src/endpoints.rs b/tauri/src/endpoints.rs index a959e49854a..611db30df7e 100644 --- a/tauri/src/endpoints.rs +++ b/tauri/src/endpoints.rs @@ -4,6 +4,8 @@ mod dialog; mod event; #[allow(unused_imports)] mod file_system; +#[cfg(global_shortcut)] +mod global_shortcut; #[cfg(http_request)] mod http; mod internal; @@ -37,6 +39,7 @@ enum Module { Cli(cli::Cmd), Notification(notification::Cmd), Http(http::Cmd), + GlobalShortcut(global_shortcut::Cmd), } impl Module { @@ -55,6 +58,7 @@ impl Module { Self::Cli(cmd) => cmd.run(webview_manager, context).await, Self::Notification(cmd) => cmd.run(webview_manager, context).await?, Self::Http(cmd) => cmd.run(webview_manager).await, + Self::GlobalShortcut(cmd) => cmd.run(webview_manager).await?, } Ok(()) } diff --git a/tauri/src/endpoints/global_shortcut.rs b/tauri/src/endpoints/global_shortcut.rs new file mode 100644 index 00000000000..7d67441a49c --- /dev/null +++ b/tauri/src/endpoints/global_shortcut.rs @@ -0,0 +1,85 @@ +use crate::{api::shortcuts::ShortcutManager, async_runtime::Mutex}; +use once_cell::sync::Lazy; +use serde::Deserialize; + +use std::sync::Arc; + +type ShortcutManagerHandle = Arc>; + +pub fn manager_handle() -> &'static ShortcutManagerHandle { + static MANAGER: Lazy = Lazy::new(Default::default); + &MANAGER +} + +/// The API descriptor. +#[derive(Deserialize)] +#[serde(tag = "cmd", rename_all = "camelCase")] +pub enum Cmd { + /// Register a global shortcut. + Register { + shortcut: String, + handler: String, + callback: String, + error: String, + }, + /// Unregister a global shortcut. + Unregister { + shortcut: String, + callback: String, + error: String, + }, +} + +impl Cmd { + pub async fn run( + self, + webview_manager: &crate::WebviewManager, + ) -> crate::Result<()> { + #[cfg(not(global_shortcut))] + super::allowlist_error(webview_manager, error, "globalShortcut"); + #[cfg(global_shortcut)] + match self { + Self::Register { + shortcut, + handler, + callback, + error, + } => { + let dispatcher = webview_manager.current_webview()?.clone(); + crate::execute_promise( + webview_manager, + async move { + let mut manager = manager_handle().lock().await; + manager.register_shortcut(shortcut, move || { + let callback_string = + crate::api::rpc::format_callback(handler.to_string(), serde_json::Value::Null); + dispatcher.eval(callback_string.as_str()); + })?; + Ok(()) + }, + callback, + error, + ) + .await; + } + Self::Unregister { + shortcut, + callback, + error, + } => { + crate::execute_promise( + webview_manager, + async move { + let mut manager = manager_handle().lock().await; + manager.unregister_shortcut(shortcut)?; + Ok(()) + }, + callback, + error, + ) + .await; + } + } + Ok(()) + } +}