diff --git a/.changes/form-multipart-support.md b/.changes/form-multipart-support.md new file mode 100644 index 000000000..4c7c3f388 --- /dev/null +++ b/.changes/form-multipart-support.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +The HTTP API now supports `multipart/form-data` requests. You need to set the `Content-Type` header and enable the `http-multipart` Cargo feature. diff --git a/.changes/refactor-form-part-bytes.md b/.changes/refactor-form-part-bytes.md new file mode 100644 index 000000000..9020acaff --- /dev/null +++ b/.changes/refactor-form-part-bytes.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +**Breaking change:** The `tauri::api::http::FormPart::Bytes` enum variant has been renamed to `File` with a value object `{ file, mime, file_name }`. diff --git a/.github/workflows/lint-fmt-core.yml b/.github/workflows/lint-fmt-core.yml index 209753ae7..2ba19ab75 100644 --- a/.github/workflows/lint-fmt-core.yml +++ b/.github/workflows/lint-fmt-core.yml @@ -50,7 +50,7 @@ jobs: clippy: - { args: '', key: 'empty' } - { - args: '--features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray', + args: '--features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray,http-multipart', key: 'all' } - { diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml index 2cd739ffa..663a18f70 100644 --- a/.github/workflows/test-core.yml +++ b/.github/workflows/test-core.yml @@ -89,4 +89,4 @@ jobs: run: | cargo test cargo test --features api-all - cargo test --features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray + cargo test --features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray,http-multipart diff --git a/.github/workflows/udeps.yml b/.github/workflows/udeps.yml index 9d629568a..ff527b27d 100644 --- a/.github/workflows/udeps.yml +++ b/.github/workflows/udeps.yml @@ -29,7 +29,7 @@ jobs: clippy: - { path: './core/tauri/Cargo.toml', - args: '--features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray' + args: '--features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray,http-multipart' } - { path: './core/tauri-build/Cargo.toml', args: '--all-features' } - { path: './core/tauri-codegen/Cargo.toml', args: '--all-features' } diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index 665278af4..b8339fb9d 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -28,6 +28,7 @@ features = [ "__updater-docs", "system-tray", "devtools", + "http-multipart", "dox" ] rustdoc-args = [ "--cfg", "doc_cfg" ] @@ -39,7 +40,7 @@ targets = [ ] [package.metadata.cargo-udeps.ignore] -normal = [ "attohttpc" ] +normal = [ "attohttpc", "reqwest" ] [dependencies] serde_json = { version = "1.0", features = [ "raw_value" ] } @@ -72,7 +73,7 @@ percent-encoding = "2.1" base64 = { version = "0.13", optional = true } clap = { version = "3", optional = true } notify-rust = { version = "4.5", optional = true } -reqwest = { version = "0.11", features = [ "json", "multipart", "stream" ], optional = true } +reqwest = { version = "0.11", features = [ "json", "stream" ], optional = true } bytes = { version = "1", features = [ "serde" ], optional = true } attohttpc = { version = "0.19", features = [ "json", "form" ], optional = true } open = { version = "2.0", optional = true } @@ -134,6 +135,7 @@ updater = [ ] __updater-docs = [ "minisign-verify", "base64", "http-api", "dialog-ask" ] http-api = [ "attohttpc" ] +http-multipart = [ "attohttpc/multipart-form", "reqwest/multipart" ] shell-open-api = [ "open", "regex", "tauri-macros/shell-scope" ] fs-extract-api = [ "zip" ] reqwest-client = [ "reqwest", "bytes" ] diff --git a/core/tauri/scripts/bundle.js b/core/tauri/scripts/bundle.js index c3ed9b144..d3bef2111 100644 --- a/core/tauri/scripts/bundle.js +++ b/core/tauri/scripts/bundle.js @@ -1 +1 @@ -function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,n=_getPrototypeOf(e);if(t){var a=_getPrototypeOf(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){u=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),P(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 a=n.arg;P(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(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){"object"===("undefined"==typeof globalThis?"undefined":_typeof(globalThis))?globalThis.regeneratorRuntime=t: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],a=n(),o="_".concat(a);return Object.defineProperty(window,o,{value:function(n){return t&&Reflect.deleteProperty(window,o),r([e,"optionalCall",function(e){return e(n)}])},writable:!1,configurable:!0}),a}function o(e){return i.apply(this,arguments)}function i(){return(i=_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.abrupt("return",new Promise((function(e,n){var o=a((function(t){e(t),Reflect.deleteProperty(window,i)}),!0),i=a((function(e){n(e),Reflect.deleteProperty(window,o)}),!0);window.__TAURI_IPC__(_objectSpread({cmd:t,callback:o,error:i},r))})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var u=Object.freeze({__proto__:null,transformCallback:a,invoke:o,convertFileSrc:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asset",r=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?"https://".concat(t,".localhost/").concat(r):"".concat(t,"://").concat(r)}});function s(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.abrupt("return",o("tauri",t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(){return(p=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppVersion"}}));case 1: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.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppName"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function f(){return(f=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getTauriVersion"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var h=Object.freeze({__proto__:null,getName:function(){return l.apply(this,arguments)},getVersion:function(){return p.apply(this,arguments)},getTauriVersion:function(){return f.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.abrupt("return",s({__tauriModule:"Cli",message:{cmd:"cliMatches"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var d=Object.freeze({__proto__:null,getMatches:function(){return m.apply(this,arguments)}});function y(){return(y=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"writeText",data:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(){return(g=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"readText"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var _=Object.freeze({__proto__:null,writeText:function(e){return y.apply(this,arguments)},readText:function(){return g.apply(this,arguments)}});function w(){return(w=_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.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"openDialog",options:t}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(){return(v=_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.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:t}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(){return(b=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(){return(R=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"askDialog",title:r,message:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"confirmDialog",title:r,message:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var x=Object.freeze({__proto__:null,open:function(){return w.apply(this,arguments)},save:function(){return v.apply(this,arguments)},message:function(e){return b.apply(this,arguments)},ask:function(e,t){return R.apply(this,arguments)},confirm:function(e,t){return k.apply(this,arguments)}});function T(e,t){return G.apply(this,arguments)}function G(){return(G=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"unlisten",event:t,eventId:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(e,t,r){return M.apply(this,arguments)}function M(){return(M=_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,s({__tauriModule:"Event",message:{cmd:"emit",event:t,windowLabel:r,payload:"string"==typeof n?n:JSON.stringify(n)}});case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e,t,r){return C.apply(this,arguments)}function C(){return(C=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"listen",event:t,windowLabel:r,handler:a(n)}}).then((function(e){return _asyncToGenerator(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",T(t,e));case 1:case"end":return r.stop()}}),r)})))})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function A(e,t,r){return j.apply(this,arguments)}function j(){return(j=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",O(t,r,(function(e){n(e),T(t,e.id).catch((function(){}))})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function S(e,t){return D.apply(this,arguments)}function D(){return(D=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",O(t,null,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function L(e,t){return z.apply(this,arguments)}function z(){return(z=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",A(t,null,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(e,t){return W.apply(this,arguments)}function W(){return(W=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",P(t,void 0,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var F,I=Object.freeze({__proto__:null,listen:S,once:L,emit:E});function N(){return(N=_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.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readTextFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function U(){return(U=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},e.next=3,s({__tauriModule:"Fs",message:{cmd:"readFile",path:t,options:r}});case 3:return n=e.sent,e.abrupt("return",Uint8Array.from(n));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function H(){return(H=_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.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:t.path,contents:Array.from((new TextEncoder).encode(t.contents)),options:r}}));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"object"===_typeof(r=n.length>1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:t.path,contents:Array.from(t.contents),options:r}}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(){return(q=_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.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(){return(B=_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.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"createDir",path:t,options:r}}));case 2: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.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function K(){return(K=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"copyFile",source:t,destination:r,options:n}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Y(){return(Y=_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.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $(){return($=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:r,options:n}}));case 2: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";e[e.Log=19]="Log";e[e.Temp=20]="Temp"}(F||(F={}));var Q=Object.freeze({__proto__:null,get BaseDirectory(){return F},get Dir(){return F},readTextFile:function(e){return N.apply(this,arguments)},readBinaryFile:function(e){return U.apply(this,arguments)},writeFile:function(e){return H.apply(this,arguments)},writeBinaryFile:function(e){return V.apply(this,arguments)},readDir:function(e){return q.apply(this,arguments)},createDir:function(e){return B.apply(this,arguments)},removeDir:function(e){return J.apply(this,arguments)},copyFile:function(e,t){return K.apply(this,arguments)},removeFile:function(e){return Y.apply(this,arguments)},renameFile:function(e,t){return $.apply(this,arguments)}});function X(){return(X=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Z(){return(Z=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ee(){return(ee=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function te(){return(te=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function re(){return(re=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ne,ae=Object.freeze({__proto__:null,register:function(e,t){return X.apply(this,arguments)},registerAll:function(e,t){return Z.apply(this,arguments)},isRegistered:function(e){return ee.apply(this,arguments)},unregister:function(e){return te.apply(this,arguments)},unregisterAll:function(){return re.apply(this,arguments)}});function oe(e,t){return null!=e?e:t()}function ie(e){for(var t=void 0,r=e[0],n=1;n=200&&this.status<300,this.headers=t.headers,this.rawHeaders=t.rawHeaders,this.data=t.data})),ce=function(){function e(t){_classCallCheck(this,e),this.id=t}var t,r,n,a,o,i,u;return _createClass(e,[{key:"drop",value:(u=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"request",value:(i=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=!t.responseType||t.responseType===ne.JSON)&&(t.responseType=ne.Text),e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:t}}).then((function(e){var t=new se(e);if(r){try{t.data=JSON.parse(t.data)}catch(e){if(t.ok&&""===t.data)t.data={};else if(t.ok)throw Error("Failed to parse response `".concat(t.data,"` as JSON: ").concat(e,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return t}return t})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"get",value:(o=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"GET",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"post",value:(a=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"POST",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return a.apply(this,arguments)})},{key:"put",value:(n=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PUT",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"patch",value:(r=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PATCH",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"delete",value:(t=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"DELETE",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}();function pe(e){return le.apply(this,arguments)}function le(){return(le=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then((function(e){return new ce(e)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var fe=null;function he(){return(he=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==fe){e.next=4;break}return e.next=3,pe();case 3:fe=e.sent;case 4:return e.abrupt("return",fe.request(_objectSpread({url:t,method:oe(ie([r,"optionalAccess",function(e){return e.method}]),(function(){return"GET"}))},r)));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var me=Object.freeze({__proto__:null,getClient:pe,fetch:function(e,t){return he.apply(this,arguments)},Body:ue,Client:ce,Response:se,get ResponseType(){return ne}});function de(){return(de=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("default"===window.Notification.permission){e.next=2;break}return e.abrupt("return",Promise.resolve("granted"===window.Notification.permission));case 2:return e.abrupt("return",s({__tauriModule:"Notification",message:{cmd:"isNotificationPermissionGranted"}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ye(){return(ye=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",window.Notification.requestPermission());case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ge=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return ye.apply(this,arguments)},isPermissionGranted:function(){return de.apply(this,arguments)}});function _e(){return navigator.appVersion.includes("Win")}function we(){return(we=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.App}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ve(){return(ve=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Audio}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function be(){return(be=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Cache}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Re(){return(Re=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Config}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ke(){return(ke=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Data}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xe(){return(xe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Desktop}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Te(){return(Te=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Document}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ge(){return(Ge=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Download}}));case 1: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.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Executable}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Me(){return(Me=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Font}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Oe(){return(Oe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Home}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ce(){return(Ce=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.LocalData}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ae(){return(Ae=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Picture}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function je(){return(je=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Public}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Se(){return(Se=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Resource}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function De(){return(De=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Runtime}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Le(){return(Le=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Template}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ze(){return(ze=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Video}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ee(){return(Ee=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Log}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var We=_e()?"\\":"/",Fe=_e()?";":":";function Ie(){return(Ie=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r,n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=a.length,r=new Array(t),n=0;n0&&void 0!==r[0]?r[0]:0,e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"exit",exitCode:t}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ye(){return(Ye=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"relaunch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var $e=Object.freeze({__proto__:null,exit:function(){return Ke.apply(this,arguments)},relaunch:function(){return Ye.apply(this,arguments)}});function Qe(e,t){return null!=e?e:t()}function Xe(e,t){return Ze.apply(this,arguments)}function Ze(){return(Ze=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,o,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>2&&void 0!==i[2]?i[2]:[],o=i.length>3?i[3]:void 0,"object"===_typeof(n)&&Object.freeze(n),e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"execute",program:r,args:n,options:o,onEventFn:a(t)}}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var et=function(){function e(){_classCallCheck(this,e),e.prototype.__init.call(this)}return _createClass(e,[{key:"__init",value:function(){this.eventListeners=Object.create(null)}},{key:"addEventListener",value:function(e,t){e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t]}},{key:"_emit",value:function(e,t){if(e in this.eventListeners){var r,n=_createForOfIteratorHelper(this.eventListeners[e]);try{for(n.s();!(r=n.n()).done;){(0,r.value)(t)}}catch(e){n.e(e)}finally{n.f()}}}},{key:"on",value:function(e,t){return this.addEventListener(e,t),this}}]),e}(),tt=function(){function e(t){_classCallCheck(this,e),this.pid=t}var t,r;return _createClass(e,[{key:"write",value:(r=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"stdinWrite",pid:this.pid,buffer:"string"==typeof t?t:Array.from(t)}}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"kill",value:(t=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"killChild",pid:this.pid}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),rt=function(e){_inherits(a,e);var t,r,n=_createSuper(a);function a(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2?arguments[2]:void 0;return _classCallCheck(this,a),t=n.call(this),a.prototype.__init2.call(_assertThisInitialized(t)),a.prototype.__init3.call(_assertThisInitialized(t)),t.program=e,t.args="string"==typeof r?[r]:r,t.options=Qe(o,(function(){return{}})),t}return _createClass(a,[{key:"__init2",value:function(){this.stdout=new et}},{key:"__init3",value:function(){this.stderr=new et}},{key:"spawn",value:(r=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Xe((function(e){switch(e.event){case"Error":t._emit("error",e.payload);break;case"Terminated":t._emit("close",e.payload);break;case"Stdout":t.stdout._emit("data",e.payload);break;case"Stderr":t.stderr._emit("data",e.payload)}}),this.program,this.args,this.options).then((function(e){return new tt(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"execute",value:(t=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){t.on("error",r);var n=[],a=[];t.stdout.on("data",(function(e){n.push(e)})),t.stderr.on("data",(function(e){a.push(e)})),t.on("close",(function(t){e({code:t.code,signal:t.signal,stdout:n.join("\n"),stderr:a.join("\n")})})),t.spawn().catch(r)})));case 1:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})}],[{key:"sidecar",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=new a(e,t,r);return n.options.sidecar=!0,n}}]),a}(et);function nt(){return(nt=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"open",path:t,with:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var at=Object.freeze({__proto__:null,Command:rt,Child:tt,EventEmitter:et,open:function(e,t){return nt.apply(this,arguments)}});function ot(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(this,r),n=t.call(this,e),ct([a,"optionalAccess",function(e){return e.skip}])||s({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:_objectSpread({label:e},a)}}}).then(_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://created"));case 1:case"end":return e.stop()}}),e)})))).catch(function(){var e=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://error",t));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n}return _createClass(r,null,[{key:"getByLabel",value:function(e){return dt().some((function(t){return t.label===e}))?new r(e,{skip:!0}):null}}]),r}(wt);function bt(){return(bt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Rt(){return(Rt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kt(){return(kt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}"__TAURI_METADATA__"in window?yt=new vt(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn('Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label.\nNote that this is not an issue if running this frontend on a browser instead of a Tauri window.'),yt=new vt("main",{skip:!0}));var xt=Object.freeze({__proto__:null,WebviewWindow:vt,WebviewWindowHandle:_t,WindowManager:wt,getCurrent:function(){return new vt(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})},getAll:dt,get appWindow(){return yt},LogicalSize:lt,PhysicalSize:ft,LogicalPosition:ht,PhysicalPosition:mt,get UserAttentionType(){return pt},currentMonitor:function(){return bt.apply(this,arguments)},primaryMonitor:function(){return Rt.apply(this,arguments)},availableMonitors:function(){return kt.apply(this,arguments)}}),Tt=_e()?"\r\n":"\n";function Gt(){return(Gt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"platform"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pt(){return(Pt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"version"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Mt(){return(Mt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"osType"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ot(){return(Ot=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"arch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ct(){return(Ct=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"tempdir"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var At=Object.freeze({__proto__:null,EOL:Tt,platform:function(){return Gt.apply(this,arguments)},version:function(){return Pt.apply(this,arguments)},type:function(){return Mt.apply(this,arguments)},arch:function(){return Ot.apply(this,arguments)},tempdir:function(){return Ct.apply(this,arguments)}}),jt=o;e.app=h,e.cli=d,e.clipboard=_,e.dialog=x,e.event=I,e.fs=Q,e.globalShortcut=ae,e.http=me,e.invoke=jt,e.notification=ge,e.os=At,e.path=Je,e.process=$e,e.shell=at,e.tauri=u,e.updater=st,e.window=xt,Object.defineProperty(e,"__esModule",{value:!0})})); +function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,n=_getPrototypeOf(e);if(t){var a=_getPrototypeOf(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){u=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),P(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 a=n.arg;P(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(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){"object"===("undefined"==typeof globalThis?"undefined":_typeof(globalThis))?globalThis.regeneratorRuntime=t: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],a=n(),o="_".concat(a);return Object.defineProperty(window,o,{value:function(n){return t&&Reflect.deleteProperty(window,o),r([e,"optionalCall",function(e){return e(n)}])},writable:!1,configurable:!0}),a}function o(e){return i.apply(this,arguments)}function i(){return(i=_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.abrupt("return",new Promise((function(e,n){var o=a((function(t){e(t),Reflect.deleteProperty(window,i)}),!0),i=a((function(e){n(e),Reflect.deleteProperty(window,o)}),!0);window.__TAURI_IPC__(_objectSpread({cmd:t,callback:o,error:i},r))})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var u=Object.freeze({__proto__:null,transformCallback:a,invoke:o,convertFileSrc:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asset",r=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?"https://".concat(t,".localhost/").concat(r):"".concat(t,"://").concat(r)}});function s(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.abrupt("return",o("tauri",t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(){return(p=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppVersion"}}));case 1: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.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppName"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function f(){return(f=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getTauriVersion"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var h=Object.freeze({__proto__:null,getName:function(){return l.apply(this,arguments)},getVersion:function(){return p.apply(this,arguments)},getTauriVersion:function(){return f.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.abrupt("return",s({__tauriModule:"Cli",message:{cmd:"cliMatches"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var d=Object.freeze({__proto__:null,getMatches:function(){return m.apply(this,arguments)}});function y(){return(y=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"writeText",data:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(){return(g=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"readText"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var _=Object.freeze({__proto__:null,writeText:function(e){return y.apply(this,arguments)},readText:function(){return g.apply(this,arguments)}});function w(){return(w=_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.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"openDialog",options:t}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(){return(v=_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.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:t}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(){return(b=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(){return(R=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"askDialog",title:r,message:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"confirmDialog",title:r,message:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var x=Object.freeze({__proto__:null,open:function(){return w.apply(this,arguments)},save:function(){return v.apply(this,arguments)},message:function(e){return b.apply(this,arguments)},ask:function(e,t){return R.apply(this,arguments)},confirm:function(e,t){return k.apply(this,arguments)}});function T(e,t){return G.apply(this,arguments)}function G(){return(G=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"unlisten",event:t,eventId:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(e,t,r){return M.apply(this,arguments)}function M(){return(M=_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,s({__tauriModule:"Event",message:{cmd:"emit",event:t,windowLabel:r,payload:"string"==typeof n?n:JSON.stringify(n)}});case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e,t,r){return A.apply(this,arguments)}function A(){return(A=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"listen",event:t,windowLabel:r,handler:a(n)}}).then((function(e){return _asyncToGenerator(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",T(t,e));case 1:case"end":return r.stop()}}),r)})))})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function C(e,t,r){return j.apply(this,arguments)}function j(){return(j=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",O(t,r,(function(e){n(e),T(t,e.id).catch((function(){}))})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function S(e,t){return D.apply(this,arguments)}function D(){return(D=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",O(t,null,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function L(e,t){return z.apply(this,arguments)}function z(){return(z=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",C(t,null,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(e,t){return W.apply(this,arguments)}function W(){return(W=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",P(t,void 0,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var F,I=Object.freeze({__proto__:null,listen:S,once:L,emit:E});function N(){return(N=_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.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readTextFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function U(){return(U=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},e.next=3,s({__tauriModule:"Fs",message:{cmd:"readFile",path:t,options:r}});case 3:return n=e.sent,e.abrupt("return",Uint8Array.from(n));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function H(){return(H=_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.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:t.path,contents:Array.from((new TextEncoder).encode(t.contents)),options:r}}));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"object"===_typeof(r=n.length>1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:t.path,contents:Array.from(t.contents),options:r}}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(){return(q=_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.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(){return(B=_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.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"createDir",path:t,options:r}}));case 2: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.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function K(){return(K=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"copyFile",source:t,destination:r,options:n}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Y(){return(Y=_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.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $(){return($=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:r,options:n}}));case 2: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";e[e.Log=19]="Log";e[e.Temp=20]="Temp"}(F||(F={}));var Q=Object.freeze({__proto__:null,get BaseDirectory(){return F},get Dir(){return F},readTextFile:function(e){return N.apply(this,arguments)},readBinaryFile:function(e){return U.apply(this,arguments)},writeFile:function(e){return H.apply(this,arguments)},writeBinaryFile:function(e){return V.apply(this,arguments)},readDir:function(e){return q.apply(this,arguments)},createDir:function(e){return B.apply(this,arguments)},removeDir:function(e){return J.apply(this,arguments)},copyFile:function(e,t){return K.apply(this,arguments)},removeFile:function(e){return Y.apply(this,arguments)},renameFile:function(e,t){return $.apply(this,arguments)}});function X(){return(X=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Z(){return(Z=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ee(){return(ee=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function te(){return(te=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function re(){return(re=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ne,ae=Object.freeze({__proto__:null,register:function(e,t){return X.apply(this,arguments)},registerAll:function(e,t){return Z.apply(this,arguments)},isRegistered:function(e){return ee.apply(this,arguments)},unregister:function(e){return te.apply(this,arguments)},unregisterAll:function(){return re.apply(this,arguments)}});function oe(e,t){return null!=e?e:t()}function ie(e){for(var t=void 0,r=e[0],n=1;n=200&&this.status<300,this.headers=t.headers,this.rawHeaders=t.rawHeaders,this.data=t.data})),ce=function(){function e(t){_classCallCheck(this,e),this.id=t}var t,r,n,a,o,i,u;return _createClass(e,[{key:"drop",value:(u=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"request",value:(i=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=!t.responseType||t.responseType===ne.JSON)&&(t.responseType=ne.Text),e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:t}}).then((function(e){var t=new se(e);if(r){try{t.data=JSON.parse(t.data)}catch(e){if(t.ok&&""===t.data)t.data={};else if(t.ok)throw Error("Failed to parse response `".concat(t.data,"` as JSON: ").concat(e,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return t}return t})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"get",value:(o=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"GET",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"post",value:(a=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"POST",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return a.apply(this,arguments)})},{key:"put",value:(n=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PUT",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"patch",value:(r=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PATCH",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"delete",value:(t=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"DELETE",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}();function pe(e){return le.apply(this,arguments)}function le(){return(le=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then((function(e){return new ce(e)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var fe=null;function he(){return(he=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==fe){e.next=4;break}return e.next=3,pe();case 3:fe=e.sent;case 4:return e.abrupt("return",fe.request(_objectSpread({url:t,method:oe(ie([r,"optionalAccess",function(e){return e.method}]),(function(){return"GET"}))},r)));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var me=Object.freeze({__proto__:null,getClient:pe,fetch:function(e,t){return he.apply(this,arguments)},Body:ue,Client:ce,Response:se,get ResponseType(){return ne}});function de(){return(de=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("default"===window.Notification.permission){e.next=2;break}return e.abrupt("return",Promise.resolve("granted"===window.Notification.permission));case 2:return e.abrupt("return",s({__tauriModule:"Notification",message:{cmd:"isNotificationPermissionGranted"}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ye(){return(ye=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",window.Notification.requestPermission());case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ge=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return ye.apply(this,arguments)},isPermissionGranted:function(){return de.apply(this,arguments)}});function _e(){return navigator.appVersion.includes("Win")}function we(){return(we=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.App}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ve(){return(ve=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Audio}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function be(){return(be=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Cache}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Re(){return(Re=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Config}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ke(){return(ke=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Data}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xe(){return(xe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Desktop}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Te(){return(Te=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Document}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ge(){return(Ge=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Download}}));case 1: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.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Executable}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Me(){return(Me=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Font}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Oe(){return(Oe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Home}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ae(){return(Ae=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.LocalData}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ce(){return(Ce=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Picture}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function je(){return(je=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Public}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Se(){return(Se=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Resource}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function De(){return(De=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Runtime}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Le(){return(Le=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Template}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ze(){return(ze=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Video}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ee(){return(Ee=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Log}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var We=_e()?"\\":"/",Fe=_e()?";":":";function Ie(){return(Ie=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r,n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=a.length,r=new Array(t),n=0;n0&&void 0!==r[0]?r[0]:0,e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"exit",exitCode:t}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ye(){return(Ye=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"relaunch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var $e=Object.freeze({__proto__:null,exit:function(){return Ke.apply(this,arguments)},relaunch:function(){return Ye.apply(this,arguments)}});function Qe(e,t){return null!=e?e:t()}function Xe(e,t){return Ze.apply(this,arguments)}function Ze(){return(Ze=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,o,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>2&&void 0!==i[2]?i[2]:[],o=i.length>3?i[3]:void 0,"object"===_typeof(n)&&Object.freeze(n),e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"execute",program:r,args:n,options:o,onEventFn:a(t)}}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var et=function(){function e(){_classCallCheck(this,e),e.prototype.__init.call(this)}return _createClass(e,[{key:"__init",value:function(){this.eventListeners=Object.create(null)}},{key:"addEventListener",value:function(e,t){e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t]}},{key:"_emit",value:function(e,t){if(e in this.eventListeners){var r,n=_createForOfIteratorHelper(this.eventListeners[e]);try{for(n.s();!(r=n.n()).done;){(0,r.value)(t)}}catch(e){n.e(e)}finally{n.f()}}}},{key:"on",value:function(e,t){return this.addEventListener(e,t),this}}]),e}(),tt=function(){function e(t){_classCallCheck(this,e),this.pid=t}var t,r;return _createClass(e,[{key:"write",value:(r=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"stdinWrite",pid:this.pid,buffer:"string"==typeof t?t:Array.from(t)}}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"kill",value:(t=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"killChild",pid:this.pid}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),rt=function(e){_inherits(a,e);var t,r,n=_createSuper(a);function a(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2?arguments[2]:void 0;return _classCallCheck(this,a),t=n.call(this),a.prototype.__init2.call(_assertThisInitialized(t)),a.prototype.__init3.call(_assertThisInitialized(t)),t.program=e,t.args="string"==typeof r?[r]:r,t.options=Qe(o,(function(){return{}})),t}return _createClass(a,[{key:"__init2",value:function(){this.stdout=new et}},{key:"__init3",value:function(){this.stderr=new et}},{key:"spawn",value:(r=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Xe((function(e){switch(e.event){case"Error":t._emit("error",e.payload);break;case"Terminated":t._emit("close",e.payload);break;case"Stdout":t.stdout._emit("data",e.payload);break;case"Stderr":t.stderr._emit("data",e.payload)}}),this.program,this.args,this.options).then((function(e){return new tt(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"execute",value:(t=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){t.on("error",r);var n=[],a=[];t.stdout.on("data",(function(e){n.push(e)})),t.stderr.on("data",(function(e){a.push(e)})),t.on("close",(function(t){e({code:t.code,signal:t.signal,stdout:n.join("\n"),stderr:a.join("\n")})})),t.spawn().catch(r)})));case 1:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})}],[{key:"sidecar",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=new a(e,t,r);return n.options.sidecar=!0,n}}]),a}(et);function nt(){return(nt=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"open",path:t,with:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var at=Object.freeze({__proto__:null,Command:rt,Child:tt,EventEmitter:et,open:function(e,t){return nt.apply(this,arguments)}});function ot(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(this,r),n=t.call(this,e),ct([a,"optionalAccess",function(e){return e.skip}])||s({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:_objectSpread({label:e},a)}}}).then(_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://created"));case 1:case"end":return e.stop()}}),e)})))).catch(function(){var e=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://error",t));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n}return _createClass(r,null,[{key:"getByLabel",value:function(e){return dt().some((function(t){return t.label===e}))?new r(e,{skip:!0}):null}}]),r}(wt);function bt(){return(bt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Rt(){return(Rt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kt(){return(kt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}"__TAURI_METADATA__"in window?yt=new vt(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn('Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label.\nNote that this is not an issue if running this frontend on a browser instead of a Tauri window.'),yt=new vt("main",{skip:!0}));var xt=Object.freeze({__proto__:null,WebviewWindow:vt,WebviewWindowHandle:_t,WindowManager:wt,getCurrent:function(){return new vt(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})},getAll:dt,get appWindow(){return yt},LogicalSize:lt,PhysicalSize:ft,LogicalPosition:ht,PhysicalPosition:mt,get UserAttentionType(){return pt},currentMonitor:function(){return bt.apply(this,arguments)},primaryMonitor:function(){return Rt.apply(this,arguments)},availableMonitors:function(){return kt.apply(this,arguments)}}),Tt=_e()?"\r\n":"\n";function Gt(){return(Gt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"platform"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pt(){return(Pt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"version"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Mt(){return(Mt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"osType"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ot(){return(Ot=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"arch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function At(){return(At=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"tempdir"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ct=Object.freeze({__proto__:null,EOL:Tt,platform:function(){return Gt.apply(this,arguments)},version:function(){return Pt.apply(this,arguments)},type:function(){return Mt.apply(this,arguments)},arch:function(){return Ot.apply(this,arguments)},tempdir:function(){return At.apply(this,arguments)}}),jt=o;e.app=h,e.cli=d,e.clipboard=_,e.dialog=x,e.event=I,e.fs=Q,e.globalShortcut=ae,e.http=me,e.invoke=jt,e.notification=ge,e.os=Ct,e.path=Je,e.process=$e,e.shell=at,e.tauri=u,e.updater=st,e.window=xt,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/core/tauri/src/api/http.rs b/core/tauri/src/api/http.rs index c7dffb071..c74c3fe55 100644 --- a/core/tauri/src/api/http.rs +++ b/core/tauri/src/api/http.rs @@ -11,7 +11,7 @@ use serde_json::Value; use serde_repr::{Deserialize_repr, Serialize_repr}; use url::Url; -use std::{collections::HashMap, time::Duration}; +use std::{collections::HashMap, path::PathBuf, time::Duration}; #[cfg(feature = "reqwest-client")] pub use reqwest::header; @@ -114,7 +114,7 @@ impl Client { request_builder = request_builder.params(&query); } - if let Some(headers) = request.headers { + if let Some(headers) = &request.headers { for (name, value) in headers.0.iter() { request_builder = request_builder.header(name, value); } @@ -130,14 +130,69 @@ impl Client { Body::Text(text) => request_builder.body(attohttpc::body::Bytes(text)).send()?, Body::Json(json) => request_builder.json(&json)?.send()?, Body::Form(form_body) => { - let mut form = Vec::new(); - for (name, part) in form_body.0 { - match part { - FormPart::Bytes(bytes) => form.push((name, serde_json::to_string(&bytes)?)), - FormPart::Text(text) => form.push((name, text)), + #[allow(unused_variables)] + fn send_form( + request_builder: attohttpc::RequestBuilder, + headers: &Option, + form_body: FormBody, + ) -> crate::api::Result { + #[cfg(feature = "http-multipart")] + if matches!( + headers + .as_ref() + .and_then(|h| h.0.get("content-type")) + .map(|v| v.as_bytes()), + Some(b"multipart/form-data") + ) { + let mut multipart = attohttpc::MultipartBuilder::new(); + let mut byte_cache: HashMap> = Default::default(); + + for (name, part) in &form_body.0 { + if let FormPart::File { file, .. } = part { + byte_cache.insert(name.to_string(), file.clone().try_into()?); + } + } + for (name, part) in &form_body.0 { + multipart = match part { + FormPart::File { + file, + mime, + file_name, + } => { + // safe to unwrap: always set by previous loop + let mut file = + attohttpc::MultipartFile::new(name, byte_cache.get(name).unwrap()); + if let Some(mime) = mime { + file = file.with_type(mime)?; + } + if let Some(file_name) = file_name { + file = file.with_filename(file_name); + } + multipart.with_file(file) + } + FormPart::Text(value) => multipart.with_text(name, value), + }; + } + return request_builder + .body(multipart.build()?) + .send() + .map_err(Into::into); } + + let mut form = Vec::new(); + for (name, part) in form_body.0 { + match part { + FormPart::File { file, .. } => { + let bytes: Vec = file.try_into()?; + form.push((name, serde_json::to_string(&bytes)?)) + } + FormPart::Text(value) => form.push((name, value)), + } + } + request_builder.form(&form)?.send().map_err(Into::into) } - request_builder.form(&form)?.send()? + + send_form(request_builder, &request.headers, form_body)? } } } else { @@ -176,14 +231,61 @@ impl Client { Body::Text(text) => request_builder.body(bytes::Bytes::from(text)), Body::Json(json) => request_builder.json(&json), Body::Form(form_body) => { - let mut form = Vec::new(); - for (name, part) in form_body.0 { - match part { - FormPart::Bytes(bytes) => form.push((name, serde_json::to_string(&bytes)?)), - FormPart::Text(text) => form.push((name, text)), + #[allow(unused_variables)] + fn send_form( + request_builder: reqwest::RequestBuilder, + headers: &Option, + form_body: FormBody, + ) -> crate::api::Result { + #[cfg(feature = "http-multipart")] + if matches!( + headers + .as_ref() + .and_then(|h| h.0.get("content-type")) + .map(|v| v.as_bytes()), + Some(b"multipart/form-data") + ) { + let mut multipart = reqwest::multipart::Form::new(); + + for (name, part) in form_body.0 { + let part = match part { + FormPart::File { + file, + mime, + file_name, + } => { + let bytes: Vec = file.try_into()?; + let mut part = reqwest::multipart::Part::bytes(bytes); + if let Some(mime) = mime { + part = part.mime_str(&mime)?; + } + if let Some(file_name) = file_name { + part = part.file_name(file_name); + } + part + } + FormPart::Text(value) => reqwest::multipart::Part::text(value), + }; + + multipart = multipart.part(name, part); + } + + return Ok(request_builder.multipart(multipart)); } + + let mut form = Vec::new(); + for (name, part) in form_body.0 { + match part { + FormPart::File { file, .. } => { + let bytes: Vec = file.try_into()?; + form.push((name, serde_json::to_string(&bytes)?)) + } + FormPart::Text(value) => form.push((name, value)), + } + } + Ok(request_builder.form(&form)) } - request_builder.form(&form) + send_form(request_builder, &request.headers, form_body)? } }; } @@ -216,6 +318,28 @@ pub enum ResponseType { Binary, } +/// A file path or contents. +#[derive(Debug, Clone, Deserialize)] +#[serde(untagged)] +#[non_exhaustive] +pub enum FilePart { + /// File path. + Path(PathBuf), + /// File contents. + Contents(Vec), +} + +impl TryFrom for Vec { + type Error = crate::api::Error; + fn try_from(file: FilePart) -> crate::api::Result { + let bytes = match file { + FilePart::Path(path) => std::fs::read(&path)?, + FilePart::Contents(bytes) => bytes, + }; + Ok(bytes) + } +} + /// [`FormBody`] data types. #[derive(Debug, Deserialize)] #[serde(untagged)] @@ -223,13 +347,23 @@ pub enum ResponseType { pub enum FormPart { /// A string value. Text(String), - /// A byte array value. - Bytes(Vec), + /// A file value. + #[serde(rename_all = "camelCase")] + File { + /// File path or content. + file: FilePart, + /// Mime type of this part. + /// Only used when the `Content-Type` header is set to `multipart/form-data`. + mime: Option, + /// File name. + /// Only used when the `Content-Type` header is set to `multipart/form-data`. + file_name: Option, + }, } /// Form body definition. #[derive(Debug, Deserialize)] -pub struct FormBody(HashMap); +pub struct FormBody(pub(crate) HashMap); impl FormBody { /// Creates a new form body. @@ -243,7 +377,7 @@ impl FormBody { #[serde(tag = "type", content = "payload")] #[non_exhaustive] pub enum Body { - /// A multipart formdata body. + /// A form body. Form(FormBody), /// A JSON body. Json(Value), diff --git a/core/tauri/src/endpoints/http.rs b/core/tauri/src/endpoints/http.rs index 6bc246bab..751af8761 100644 --- a/core/tauri/src/endpoints/http.rs +++ b/core/tauri/src/endpoints/http.rs @@ -79,19 +79,31 @@ impl Cmd { options: Box, ) -> super::Result { use crate::Manager; - if context - .window - .state::() - .http - .is_allowed(&options.url) - { + let scopes = context.window.state::(); + if scopes.http.is_allowed(&options.url) { let client = clients() .lock() .unwrap() .get(&client_id) .ok_or_else(|| crate::Error::HttpClientNotInitialized.into_anyhow())? .clone(); - let response = client.send(*options).await?; + let options = *options; + if let Some(crate::api::http::Body::Form(form)) = &options.body { + for value in form.0.values() { + if let crate::api::http::FormPart::File { + file: crate::api::http::FilePart::Path(path), + .. + } = value + { + if crate::api::file::SafePathBuf::new(path.clone()).is_err() + || scopes.fs.is_allowed(&path) + { + return Err(crate::Error::PathNotAllowed(path.clone()).into_anyhow()); + } + } + } + } + let response = client.send(options).await?; Ok(response.read().await?) } else { Err(crate::Error::UrlNotAllowed(options.url).into_anyhow()) diff --git a/examples/api/dist/assets/index.js b/examples/api/dist/assets/index.js index 8801254ab..ff5b7e88d 100644 --- a/examples/api/dist/assets/index.js +++ b/examples/api/dist/assets/index.js @@ -1,28 +1,29 @@ -var yi=Object.defineProperty,zi=Object.defineProperties;var Ci=Object.getOwnPropertyDescriptors;var Dl=Object.getOwnPropertySymbols;var Mi=Object.prototype.hasOwnProperty,Ti=Object.prototype.propertyIsEnumerable;var jl=(n,e,l)=>e in n?yi(n,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[e]=l,Gl=(n,e)=>{for(var l in e||(e={}))Mi.call(e,l)&&jl(n,l,e[l]);if(Dl)for(var l of Dl(e))Ti.call(e,l)&&jl(n,l,e[l]);return n},Bl=(n,e)=>zi(n,Ci(e));import{S as J,i as X,s as Y,e as u,a as h,t as z,b as a,c as T,d as t,l as y,f as G,n as I,g as S,r as x,h as Si,j as Ri,o as Li,k as Ei,m as Fl,p as Hi,q as en,u as Vl,v as In,w as Un,x as Oi,y as L,z as Jl,A as Xl,B as Ai,C as tn,D as $e,E as Yl,F as Pi,G as Wi,H as Ii,I as Nn,J as xe,K as Ui,L as Kl,M as qn,N as B,O as Ql,P as nn,Q as Dn,R as Zl,T as $l,U as Ni,V as qi,W as xl,X as ei,Y as Di,Z as ji,_ as Gi,$ as Bi,a0 as Fi,a1 as Vi,a2 as Ji,a3 as Xi,a4 as ti,a5 as ni,a6 as li,a7 as ii,a8 as Yi,a9 as si,aa as oi,ab as Ki,ac as Qi,ad as Zi}from"./vendor.js";const $i=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function l(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerpolicy&&(o.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?o.credentials="include":s.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=l(s);fetch(s.href,o)}};$i();function xi(n){let e,l,i,s,o,r,c,v,m,k,w,d,p,_,b,g,M,C,W,P,A;return{c(){e=u("h1"),e.textContent="Welcome",l=h(),i=u("p"),i.textContent="Tauri's API capabilities using the ` @tauri-apps/api ` package. It's used as\n the main validation app, serving as the testbed of our development process. In\n the future, this app will be used on Tauri's integration tests.",s=h(),o=u("p"),r=z("Current App version: "),c=z(n[0]),v=h(),m=u("p"),k=z("Current Tauri version: "),w=z(n[1]),d=h(),p=u("p"),_=z("Current App name: "),b=z(n[2]),g=h(),M=u("button"),M.textContent="Close application",C=h(),W=u("button"),W.textContent="Relaunch application",a(M,"class","button"),a(W,"class","button")},m(E,U){T(E,e,U),T(E,l,U),T(E,i,U),T(E,s,U),T(E,o,U),t(o,r),t(o,c),T(E,v,U),T(E,m,U),t(m,k),t(m,w),T(E,d,U),T(E,p,U),t(p,_),t(p,b),T(E,g,U),T(E,M,U),T(E,C,U),T(E,W,U),P||(A=[y(M,"click",n[3]),y(W,"click",n[4])],P=!0)},p(E,[U]){U&1&&G(c,E[0]),U&2&&G(w,E[1]),U&4&&G(b,E[2])},i:I,o:I,d(E){E&&S(e),E&&S(l),E&&S(i),E&&S(s),E&&S(o),E&&S(v),E&&S(m),E&&S(d),E&&S(p),E&&S(g),E&&S(M),E&&S(C),E&&S(W),P=!1,x(A)}}}function es(n,e,l){let i=0,s=0,o="Unknown";Si().then(v=>{l(2,o=v)}),Ri().then(v=>{l(0,i=v)}),Li().then(v=>{l(1,s=v)});async function r(){await Ei()}async function c(){await Fl()}return[i,s,o,r,c]}class ts extends J{constructor(e){super();X(this,e,es,xi,Y,{})}}function ns(n){let e,l,i,s,o,r,c,v,m,k,w;return{c(){e=u("div"),l=z(`This binary can be run on the terminal and takes the following arguments: - `),i=u("ul"),i.innerHTML=`
  • --config PATH
  • +var zi=Object.defineProperty,Ci=Object.defineProperties;var Mi=Object.getOwnPropertyDescriptors;var Xl=Object.getOwnPropertySymbols;var Ti=Object.prototype.hasOwnProperty,Si=Object.prototype.propertyIsEnumerable;var Yl=(n,t,l)=>t in n?zi(n,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[t]=l,Jl=(n,t)=>{for(var l in t||(t={}))Ti.call(t,l)&&Yl(n,l,t[l]);if(Xl)for(var l of Xl(t))Si.call(t,l)&&Yl(n,l,t[l]);return n},Kl=(n,t)=>Ci(n,Mi(t));import{S as X,i as Y,s as J,e as o,a as h,t as C,b as u,c as S,d as e,l as y,f as G,n as W,g as R,r as x,h as Ri,j as Li,o as Ei,k as Hi,m as Ql,p as Oi,q as en,u as Zl,v as Wn,w as Un,x as Pi,y as E,z as $l,A as xl,B as Ai,C as tn,D as $e,E as ei,F as Ii,G as Wi,H as Ui,I as qn,J as xe,K as ti,L as Nn,M as Dn,N as B,_ as ni,O as nn,P as jn,Q as li,R as ii,T as qi,U as Ni,V as si,W as oi,X as Di,Y as ji,Z as Gi,$ as Bi,a0 as Fi,a1 as Vi,a2 as Xi,a3 as Yi,a4 as Ji,a5 as Gn,a6 as Bn,a7 as Fn,a8 as Vn,a9 as Xn,aa as Ki,ab as ai,ac as Qi,ad as Zi,ae as $i,af as xi}from"./vendor.js";const es=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const r of a.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function l(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerpolicy&&(a.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?a.credentials="include":s.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(s){if(s.ep)return;s.ep=!0;const a=l(s);fetch(s.href,a)}};es();function ts(n){let t,l,i,s,a,r,c,m,v,k,g,p,_,w,b,d,z,M,q,A,P;return{c(){t=o("h1"),t.textContent="Welcome",l=h(),i=o("p"),i.textContent="Tauri's API capabilities using the ` @tauri-apps/api ` package. It's used as\n the main validation app, serving as the testbed of our development process. In\n the future, this app will be used on Tauri's integration tests.",s=h(),a=o("p"),r=C("Current App version: "),c=C(n[0]),m=h(),v=o("p"),k=C("Current Tauri version: "),g=C(n[1]),p=h(),_=o("p"),w=C("Current App name: "),b=C(n[2]),d=h(),z=o("button"),z.textContent="Close application",M=h(),q=o("button"),q.textContent="Relaunch application",u(z,"class","button"),u(q,"class","button")},m(L,I){S(L,t,I),S(L,l,I),S(L,i,I),S(L,s,I),S(L,a,I),e(a,r),e(a,c),S(L,m,I),S(L,v,I),e(v,k),e(v,g),S(L,p,I),S(L,_,I),e(_,w),e(_,b),S(L,d,I),S(L,z,I),S(L,M,I),S(L,q,I),A||(P=[y(z,"click",n[3]),y(q,"click",n[4])],A=!0)},p(L,[I]){I&1&&G(c,L[0]),I&2&&G(g,L[1]),I&4&&G(b,L[2])},i:W,o:W,d(L){L&&R(t),L&&R(l),L&&R(i),L&&R(s),L&&R(a),L&&R(m),L&&R(v),L&&R(p),L&&R(_),L&&R(d),L&&R(z),L&&R(M),L&&R(q),A=!1,x(P)}}}function ns(n,t,l){let i=0,s=0,a="Unknown";Ri().then(m=>{l(2,a=m)}),Li().then(m=>{l(0,i=m)}),Ei().then(m=>{l(1,s=m)});async function r(){await Hi()}async function c(){await Ql()}return[i,s,a,r,c]}class ls extends X{constructor(t){super();Y(this,t,ns,ts,J,{})}}function is(n){let t,l,i,s,a,r,c,m,v,k,g;return{c(){t=o("div"),l=C(`This binary can be run on the terminal and takes the following arguments: + `),i=o("ul"),i.innerHTML=`
  • --config PATH
  • --theme light|dark|system
  • -
  • --verbose
  • `,s=z(` - Additionally, it has a `),o=u("i"),o.textContent="update --background",r=z(` subcommand. +
  • --verbose
  • `,s=C(` + Additionally, it has a `),a=o("i"),a.textContent="update --background",r=C(` subcommand. Note that the arguments are only parsed, not implemented. - `),c=u("br"),v=h(),m=u("button"),m.textContent="Get matches",a(m,"class","button"),a(m,"id","cli-matches")},m(d,p){T(d,e,p),t(e,l),t(e,i),t(e,s),t(e,o),t(e,r),t(e,c),t(e,v),t(e,m),k||(w=y(m,"click",n[0]),k=!0)},p:I,i:I,o:I,d(d){d&&S(e),k=!1,w()}}}function ls(n,e,l){let{onMessage:i}=e;function s(){Hi().then(i).catch(i)}return n.$$set=o=>{"onMessage"in o&&l(1,i=o.onMessage)},[s,i]}class is extends J{constructor(e){super();X(this,e,ls,ns,Y,{onMessage:1})}}function ss(n){let e,l,i,s,o,r,c,v;return{c(){e=u("div"),l=u("button"),l.textContent="Call Log API",i=h(),s=u("button"),s.textContent="Call Request (async) API",o=h(),r=u("button"),r.textContent="Send event to Rust",a(l,"class","button"),a(l,"id","log"),a(s,"class","button"),a(s,"id","request"),a(r,"class","button"),a(r,"id","event")},m(m,k){T(m,e,k),t(e,l),t(e,i),t(e,s),t(e,o),t(e,r),c||(v=[y(l,"click",n[0]),y(s,"click",n[1]),y(r,"click",n[2])],c=!0)},p:I,i:I,o:I,d(m){m&&S(e),c=!1,x(v)}}}function os(n,e,l){let{onMessage:i}=e,s;en(async()=>{s=await Vl("rust-event",i)}),In(()=>{s&&s()});function o(){Un("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function r(){Un("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function c(){Oi("js-event","this is the payload string")}return n.$$set=v=>{"onMessage"in v&&l(3,i=v.onMessage)},[o,r,c,i]}class us extends J{constructor(e){super();X(this,e,os,ss,Y,{onMessage:3})}}function as(n){let e,l,i,s,o,r,c,v,m,k,w,d,p,_,b,g,M,C,W,P;return{c(){e=u("div"),l=u("input"),i=h(),s=u("input"),o=h(),r=u("div"),c=u("input"),v=h(),m=u("label"),m.textContent="Multiple",k=h(),w=u("div"),d=u("input"),p=h(),_=u("label"),_.textContent="Directory",b=h(),g=u("button"),g.textContent="Open dialog",M=h(),C=u("button"),C.textContent="Open save dialog",a(l,"id","dialog-default-path"),a(l,"placeholder","Default path"),a(s,"id","dialog-filter"),a(s,"placeholder","Extensions filter, comma-separated"),a(s,"class","svelte-1eg58yg"),a(c,"type","checkbox"),a(c,"id","dialog-multiple"),a(m,"for","dialog-multiple"),a(d,"type","checkbox"),a(d,"id","dialog-directory"),a(_,"for","dialog-directory"),a(g,"class","button"),a(g,"id","open-dialog"),a(C,"class","button"),a(C,"id","save-dialog")},m(A,E){T(A,e,E),t(e,l),L(l,n[0]),t(e,i),t(e,s),L(s,n[1]),t(e,o),t(e,r),t(r,c),c.checked=n[2],t(r,v),t(r,m),t(e,k),t(e,w),t(w,d),d.checked=n[3],t(w,p),t(w,_),t(e,b),t(e,g),t(e,M),t(e,C),W||(P=[y(l,"input",n[8]),y(s,"input",n[9]),y(c,"change",n[10]),y(d,"change",n[11]),y(g,"click",n[4]),y(C,"click",n[5])],W=!0)},p(A,[E]){E&1&&l.value!==A[0]&&L(l,A[0]),E&2&&s.value!==A[1]&&L(s,A[1]),E&4&&(c.checked=A[2]),E&8&&(d.checked=A[3])},i:I,o:I,d(A){A&&S(e),W=!1,x(P)}}}function rs(n,e){var l=new Blob([n],{type:"application/octet-binary"}),i=new FileReader;i.onload=function(s){var o=s.target.result;e(o.substr(o.indexOf(",")+1))},i.readAsDataURL(l)}function cs(n,e,l){let{onMessage:i}=e,{insecureRenderHtml:s}=e,o=null,r=null,c=!1,v=!1;function m(){Jl({title:"My wonderful open dialog",defaultPath:o,filters:r?[{name:"Tauri Example",extensions:r.split(",").map(b=>b.trim())}]:[],multiple:c,directory:v}).then(function(b){if(Array.isArray(b))i(b);else{var g=b,M=g.match(/\S+\.\S+$/g);Xl(g).then(function(C){M&&(g.includes(".png")||g.includes(".jpg"))?rs(new Uint8Array(C),function(W){var P="data:image/png;base64,"+W;s('')}):i(b)}).catch(i(b))}}).catch(i)}function k(){Ai({title:"My wonderful save dialog",defaultPath:o,filters:r?[{name:"Tauri Example",extensions:r.split(",").map(b=>b.trim())}]:[]}).then(i).catch(i)}function w(){o=this.value,l(0,o)}function d(){r=this.value,l(1,r)}function p(){c=this.checked,l(2,c)}function _(){v=this.checked,l(3,v)}return n.$$set=b=>{"onMessage"in b&&l(6,i=b.onMessage),"insecureRenderHtml"in b&&l(7,s=b.insecureRenderHtml)},[o,r,c,v,m,k,i,s,w,d,p,_]}class ps extends J{constructor(e){super();X(this,e,cs,as,Y,{onMessage:6,insecureRenderHtml:7})}}function ui(n,e,l){const i=n.slice();return i[9]=e[l],i}function ai(n){let e,l=n[9][0]+"",i,s;return{c(){e=u("option"),i=z(l),e.__value=s=n[9][1],e.value=e.__value},m(o,r){T(o,e,r),t(e,i)},p:I,d(o){o&&S(e)}}}function fs(n){let e,l,i,s,o,r,c,v,m,k,w,d,p,_=n[2],b=[];for(let g=0;g<_.length;g+=1)b[g]=ai(ui(n,_,g));return{c(){e=u("form"),l=u("select"),i=u("option"),i.textContent="None";for(let g=0;gisNaN(parseInt(d))).map(d=>[d,Yl[d]]);function v(){const d=o.match(/\S+\.\S+$/g),p={dir:ri()};(d?Xl(o,p):Pi(o,p)).then(function(b){if(d)if(o.includes(".png")||o.includes(".jpg"))ds(new Uint8Array(b),function(g){const M="data:image/png;base64,"+g;s('')});else{const g=String.fromCharCode.apply(null,b);s(''),setTimeout(()=>{const M=document.getElementById("file-response");M.value=g,document.getElementById("file-save").addEventListener("click",function(){writeFile({file:o,contents:M.value},{dir:ri()}).catch(i)})})}else i(b)}).catch(i)}function m(){l(1,r.src=Wi(o),r)}function k(){o=this.value,l(0,o)}function w(d){Ii[d?"unshift":"push"](()=>{r=d,l(1,r)})}return n.$$set=d=>{"onMessage"in d&&l(5,i=d.onMessage),"insecureRenderHtml"in d&&l(6,s=d.insecureRenderHtml)},[o,r,c,v,m,i,s,k,w]}class ms extends J{constructor(e){super();X(this,e,hs,fs,Y,{onMessage:5,insecureRenderHtml:6})}}function vs(n){let e,l,i,s,o,r,c,v,m,k,w,d,p,_,b,g,M;return{c(){e=u("form"),l=u("select"),i=u("option"),i.textContent="GET",s=u("option"),s.textContent="POST",o=u("option"),o.textContent="PUT",r=u("option"),r.textContent="PATCH",c=u("option"),c.textContent="DELETE",v=h(),m=u("input"),k=h(),w=u("br"),d=h(),p=u("textarea"),_=h(),b=u("button"),b.textContent="Make request",i.__value="GET",i.value=i.__value,s.__value="POST",s.value=s.__value,o.__value="PUT",o.value=o.__value,r.__value="PATCH",r.value=r.__value,c.__value="DELETE",c.value=c.__value,a(l,"class","button"),a(l,"id","request-method"),n[0]===void 0&&Nn(()=>n[5].call(l)),a(m,"id","request-url"),a(m,"placeholder","Type the request URL..."),a(p,"id","request-body"),a(p,"placeholder","Request body"),a(p,"rows","5"),a(p,"class","svelte-1xfmj7b"),a(b,"class","button"),a(b,"id","make-request")},m(C,W){T(C,e,W),t(e,l),t(l,i),t(l,s),t(l,o),t(l,r),t(l,c),xe(l,n[0]),t(e,v),t(e,m),L(m,n[1]),t(e,k),t(e,w),t(e,d),t(e,p),L(p,n[2]),t(e,_),t(e,b),g||(M=[y(l,"change",n[5]),y(m,"input",n[6]),y(p,"input",n[7]),y(e,"submit",tn(n[3]))],g=!0)},p(C,[W]){W&1&&xe(l,C[0]),W&2&&m.value!==C[1]&&L(m,C[1]),W&4&&L(p,C[2])},i:I,o:I,d(C){C&&S(e),g=!1,x(M)}}}function _s(n,e,l){let i="GET",s="https://jsonplaceholder.typicode.com/todos/1",o="",{onMessage:r}=e;async function c(){const w=await Ui().catch(b=>{throw r(b),b}),_={url:s||""||"",method:i||"GET"||"GET"};o.startsWith("{")&&o.endsWith("}")||o.startsWith("[")&&o.endsWith("]")?_.body=Kl.json(JSON.parse(o)):o!==""&&(_.body=Kl.text(o)),w.request(_).then(r).catch(r)}function v(){i=qn(this),l(0,i)}function m(){s=this.value,l(1,s)}function k(){o=this.value,l(2,o)}return n.$$set=w=>{"onMessage"in w&&l(4,r=w.onMessage)},[i,s,o,c,r,v,m,k]}class gs extends J{constructor(e){super();X(this,e,_s,vs,Y,{onMessage:4})}}function bs(n){let e,l,i;return{c(){e=u("button"),e.textContent="Send test notification",a(e,"class","button"),a(e,"id","notification")},m(s,o){T(s,e,o),l||(i=y(e,"click",ws),l=!0)},p:I,i:I,o:I,d(s){s&&S(e),l=!1,i()}}}function ws(){new Notification("Notification title",{body:"This is the notification body"})}function ks(n,e,l){let{onMessage:i}=e;return n.$$set=s=>{"onMessage"in s&&l(0,i=s.onMessage)},[i]}class ys extends J{constructor(e){super();X(this,e,ks,bs,Y,{onMessage:0})}}function ci(n,e,l){const i=n.slice();return i[65]=e[l],i}function pi(n,e,l){const i=n.slice();return i[68]=e[l],i}function fi(n){let e,l=n[68]+"",i,s;return{c(){e=u("option"),i=z(l),e.__value=s=n[68],e.value=e.__value},m(o,r){T(o,e,r),t(e,i)},p(o,r){r[0]&2&&l!==(l=o[68]+"")&&G(i,l),r[0]&2&&s!==(s=o[68])&&(e.__value=s,e.value=e.__value)},d(o){o&&S(e)}}}function di(n){let e,l=n[65]+"",i,s;return{c(){e=u("option"),i=z(l),e.__value=s=n[65],e.value=e.__value},m(o,r){T(o,e,r),t(e,i)},p:I,d(o){o&&S(e)}}}function zs(n){let e,l,i,s,o,r,c,v,m,k,w,d,p,_,b,g,M,C,W,P,A,E,U,q,K,fe,V,j,O,Q,H,F,Se,Re,Pe,wt,et,ee,de,We,kt,le,yt,Ie,zt,ie,Ct,he,Ue,Mt,se,Tt,Ne,St,oe,Rt,me,qe,Lt,ue,Et,De,Ht,ae,Ot,ve,je,D,te,jn,At,Gn,ce,ln,re,Ge,_e,sn,Bn,tt,Fn,Pt=n[25].width+"",on,Vn,nt,Jn,Wt=n[25].height+"",un,Xn,ge,an,Yn,lt,Kn,It=n[26].width+"",rn,Qn,it,Zn,Ut=n[26].height+"",cn,$n,Be,be,pn,xn,st,el,Nt=n[25].toLogical(n[22]).width+"",fn,tl,ot,nl,qt=n[25].toLogical(n[22]).height+"",dn,ll,we,hn,il,ut,sl,Dt=n[26].toLogical(n[22]).width+"",mn,ol,at,ul,jt=n[26].toLogical(n[22]).height+"",vn,al,Fe,ke,_n,rl,rt,cl,Gt=n[23].x+"",gn,pl,ct,fl,Bt=n[23].y+"",bn,dl,ye,wn,hl,pt,ml,Ft=n[24].x+"",kn,vl,ft,_l,Vt=n[24].y+"",yn,gl,Ve,ze,zn,bl,dt,wl,Jt=n[23].toLogical(n[22]).x+"",Cn,kl,ht,yl,Xt=n[23].toLogical(n[22]).y+"",Mn,zl,Ce,Tn,Cl,mt,Ml,Yt=n[24].toLogical(n[22]).x+"",Sn,Tl,vt,Sl,Kt=n[24].toLogical(n[22]).y+"",Rn,Ln,ne,En,Rl,Qt,Je,Ll,El,Zt,Xe,Hl,Ol,pe,Al,Ye,$t,Pl,Le,Wl,xt,Il,Ee,Hn,Me,He,Ul,_t,On,Te,Oe,Nl,gt,An,Ae,Pn,Ke,Wn,ql,Qe=Object.keys(n[1]),Z=[];for(let f=0;fn[37].call(l)),a(r,"type","checkbox"),a(k,"type","checkbox"),a(p,"title","Unminimizes after 2 seconds"),a(b,"title","Unminimizes after 2 seconds"),a(M,"title","Visible again after 2 seconds"),a(P,"type","checkbox"),a(q,"type","checkbox"),a(j,"type","checkbox"),a(F,"type","checkbox"),a(le,"type","number"),a(le,"min","0"),a(le,"class","svelte-1tppwwz"),a(ie,"type","number"),a(ie,"min","0"),a(ie,"class","svelte-1tppwwz"),a(de,"class","flex col grow svelte-1tppwwz"),a(se,"type","number"),a(se,"min","400"),a(se,"class","svelte-1tppwwz"),a(oe,"type","number"),a(oe,"min","400"),a(oe,"class","svelte-1tppwwz"),a(he,"class","flex col grow svelte-1tppwwz"),a(ue,"type","number"),a(ue,"class","svelte-1tppwwz"),a(ae,"type","number"),a(ae,"class","svelte-1tppwwz"),a(me,"class","flex col grow svelte-1tppwwz"),a(te,"type","number"),a(te,"min","400"),a(te,"class","svelte-1tppwwz"),a(ce,"type","number"),a(ce,"min","400"),a(ce,"class","svelte-1tppwwz"),a(ve,"class","flex col grow svelte-1tppwwz"),a(ee,"class","window-controls flex flex-row svelte-1tppwwz"),a(e,"class","flex col"),a(tt,"class","svelte-1tppwwz"),a(nt,"class","svelte-1tppwwz"),a(_e,"class","grow window-property svelte-1tppwwz"),a(lt,"class","svelte-1tppwwz"),a(it,"class","svelte-1tppwwz"),a(ge,"class","grow window-property svelte-1tppwwz"),a(Ge,"class","flex"),a(st,"class","svelte-1tppwwz"),a(ot,"class","svelte-1tppwwz"),a(be,"class","grow window-property svelte-1tppwwz"),a(ut,"class","svelte-1tppwwz"),a(at,"class","svelte-1tppwwz"),a(we,"class","grow window-property svelte-1tppwwz"),a(Be,"class","flex"),a(rt,"class","svelte-1tppwwz"),a(ct,"class","svelte-1tppwwz"),a(ke,"class","grow window-property svelte-1tppwwz"),a(pt,"class","svelte-1tppwwz"),a(ft,"class","svelte-1tppwwz"),a(ye,"class","grow window-property svelte-1tppwwz"),a(Fe,"class","flex"),a(dt,"class","svelte-1tppwwz"),a(ht,"class","svelte-1tppwwz"),a(ze,"class","grow window-property svelte-1tppwwz"),a(mt,"class","svelte-1tppwwz"),a(vt,"class","svelte-1tppwwz"),a(Ce,"class","grow window-property svelte-1tppwwz"),a(Ve,"class","flex"),a(Je,"type","checkbox"),a(Xe,"type","checkbox"),a(pe,"class","button"),n[19]===void 0&&Nn(()=>n[55].call(pe)),a(Le,"type","number"),a(Ee,"type","number"),a(Ye,"class","flex col grow svelte-1tppwwz"),a(He,"id","title"),a(_t,"class","button"),a(_t,"type","submit"),a(Me,"class","svelte-1tppwwz"),a(Oe,"id","url"),a(gt,"class","button"),a(gt,"id","open-url"),a(Te,"class","svelte-1tppwwz"),a(Ae,"class","button"),a(Ae,"title","Minimizes the window, requests attention for 3s and then resets it"),a(Ke,"class","button")},m(f,R){T(f,e,R),t(e,l);for(let N=0;N{typeof D=="string"&&s[i].setIcon(D)})}function We(){const D=Math.random().toString().replace(".",""),te=new Ni(D);l(1,s[D]=te,s),te.once("tauri://error",function(){r("Error creating new webview")})}function kt(){s[i].innerSize().then(D=>{l(25,K=D),l(7,_=K.width),l(8,b=K.height)}),s[i].outerSize().then(D=>{l(26,fe=D)})}function le(){s[i].innerPosition().then(D=>{l(23,U=D)}),s[i].outerPosition().then(D=>{l(24,q=D),l(13,P=q.x),l(14,A=q.y)})}async function yt(D){V&&V(),j&&j(),j=await D.listen("tauri://move",le),V=await D.listen("tauri://resize",kt)}async function Ie(){await s[i].minimize(),await s[i].requestUserAttention(qi.Critical),await new Promise(D=>setTimeout(D,3e3)),await s[i].requestUserAttention(null)}function zt(){i=qn(this),l(0,i),l(1,s)}function ie(){v=this.checked,l(2,v)}function Ct(){m=this.checked,l(3,m)}const he=()=>s[i].center();function Ue(){k=this.checked,l(21,k)}function Mt(){w=this.checked,l(4,w)}function se(){d=this.checked,l(5,d)}function Tt(){p=this.checked,l(6,p)}function Ne(){P=B(this.value),l(13,P)}function St(){A=B(this.value),l(14,A)}function oe(){_=B(this.value),l(7,_)}function Rt(){b=B(this.value),l(8,b)}function me(){g=B(this.value),l(9,g)}function qe(){M=B(this.value),l(10,M)}function Lt(){C=B(this.value),l(11,C)}function ue(){W=B(this.value),l(12,W)}function Et(){O=this.checked,l(15,O)}function De(){Q=this.checked,l(16,Q)}function Ht(){Se=qn(this),l(19,Se),l(28,o)}function ae(){H=B(this.value),l(17,H)}function Ot(){F=B(this.value),l(18,F)}function ve(){Re=this.value,l(27,Re)}function je(){c=this.value,l(20,c)}return n.$$set=D=>{"onMessage"in D&&l(36,r=D.onMessage)},n.$$.update=()=>{n.$$.dirty[0]&7&&s[i].setResizable(v),n.$$.dirty[0]&11&&(m?s[i].maximize():s[i].unmaximize()),n.$$.dirty[0]&19&&s[i].setDecorations(w),n.$$.dirty[0]&35&&s[i].setAlwaysOnTop(d),n.$$.dirty[0]&67&&s[i].setFullscreen(p),n.$$.dirty[0]&387&&s[i].setSize(new Dn(_,b)),n.$$.dirty[0]&1539&&(g&&M?s[i].setMinSize(new Zl(g,M)):s[i].setMinSize(null)),n.$$.dirty[0]&6147&&(C&&W?s[i].setMaxSize(new Zl(C,W)):s[i].setMaxSize(null)),n.$$.dirty[0]&24579&&s[i].setPosition(new nn(P,A)),n.$$.dirty[0]&3&&s[i].scaleFactor().then(D=>l(22,E=D)),n.$$.dirty[0]&3&&yt(s[i]),n.$$.dirty[0]&32771&&s[i].setCursorGrab(O),n.$$.dirty[0]&65539&&s[i].setCursorVisible(Q),n.$$.dirty[0]&524291&&s[i].setCursorIcon(Se),n.$$.dirty[0]&393219&&s[i].setCursorPosition(new nn(H,F))},[i,s,v,m,w,d,p,_,b,g,M,C,W,P,A,O,Q,H,F,Se,c,k,E,U,q,K,fe,Re,o,Pe,wt,et,ee,de,We,Ie,r,zt,ie,Ct,he,Ue,Mt,se,Tt,Ne,St,oe,Rt,me,qe,Lt,ue,Et,De,Ht,ae,Ot,ve,je]}class Ms extends J{constructor(e){super();X(this,e,Cs,zs,Y,{onMessage:36},[-1,-1,-1])}}function hi(n,e,l){const i=n.slice();return i[9]=e[l],i}function mi(n){let e,l=n[9]+"",i,s,o,r,c;function v(){return n[8](n[9])}return{c(){e=u("div"),i=z(l),s=h(),o=u("button"),o.textContent="Unregister",a(o,"type","button")},m(m,k){T(m,e,k),t(e,i),t(e,s),t(e,o),r||(c=y(o,"click",v),r=!0)},p(m,k){n=m,k&2&&l!==(l=n[9]+"")&&G(i,l)},d(m){m&&S(e),r=!1,c()}}}function vi(n){let e,l,i;return{c(){e=u("button"),e.textContent="Unregister all",a(e,"type","button")},m(s,o){T(s,e,o),l||(i=y(e,"click",n[5]),l=!0)},p:I,d(s){s&&S(e),l=!1,i()}}}function Ts(n){let e,l,i,s,o,r,c,v,m,k,w=n[1],d=[];for(let _=0;_l(1,i=d));let r="CmdOrControl+X";function c(){const d=r;Di(d,()=>{s(`Shortcut ${d} triggered`)}).then(()=>{o.update(p=>[...p,d]),s(`Shortcut ${d} registered successfully`)}).catch(s)}function v(d){const p=d;ji(p).then(()=>{o.update(_=>_.filter(b=>b!==p)),s(`Shortcut ${p} unregistered`)}).catch(s)}function m(){Gi().then(()=>{o.update(()=>[]),s("Unregistered all shortcuts")}).catch(s)}function k(){r=this.value,l(0,r)}const w=d=>v(d);return n.$$set=d=>{"onMessage"in d&&l(6,s=d.onMessage)},[r,i,o,c,v,m,s,k,w]}class Rs extends J{constructor(e){super();X(this,e,Ss,Ts,Y,{onMessage:6})}}function _i(n){let e,l,i,s,o;return{c(){e=u("input"),l=h(),i=u("button"),i.textContent="Write",a(e,"placeholder","write to stdin"),a(i,"class","button")},m(r,c){T(r,e,c),L(e,n[3]),T(r,l,c),T(r,i,c),s||(o=[y(e,"input",n[10]),y(i,"click",n[7])],s=!0)},p(r,c){c&8&&e.value!==r[3]&&L(e,r[3])},d(r){r&&S(e),r&&S(l),r&&S(i),s=!1,x(o)}}}function Ls(n){let e,l,i,s,o,r,c,v,m,k,w,d,p,_,b,g=n[4]&&_i(n);return{c(){e=u("div"),l=u("div"),i=u("input"),s=h(),o=u("button"),o.textContent="Run",r=h(),c=u("button"),c.textContent="Kill",v=h(),g&&g.c(),m=h(),k=u("div"),w=u("input"),d=h(),p=u("input"),a(o,"class","button"),a(c,"class","button"),a(w,"placeholder","Working directory"),a(p,"class","env-vars svelte-1g38c1n"),a(p,"placeholder","Environment variables")},m(M,C){T(M,e,C),t(e,l),t(l,i),L(i,n[0]),t(l,s),t(l,o),t(l,r),t(l,c),t(l,v),g&&g.m(l,null),t(e,m),t(e,k),t(k,w),L(w,n[1]),t(k,d),t(k,p),L(p,n[2]),_||(b=[y(i,"input",n[9]),y(o,"click",n[5]),y(c,"click",n[6]),y(w,"input",n[11]),y(p,"input",n[12])],_=!0)},p(M,[C]){C&1&&i.value!==M[0]&&L(i,M[0]),M[4]?g?g.p(M,C):(g=_i(M),g.c(),g.m(l,null)):g&&(g.d(1),g=null),C&2&&w.value!==M[1]&&L(w,M[1]),C&4&&p.value!==M[2]&&L(p,M[2])},i:I,o:I,d(M){M&&S(e),g&&g.d(),_=!1,x(b)}}}function Es(n,e,l){const i=navigator.userAgent.includes("Windows");let s=i?"cmd":"sh",o=i?["/C"]:["-c"],{onMessage:r}=e,c='echo "hello world"',v=null,m="SOMETHING=value ANOTHER=2",k="",w;function d(){return m.split(" ").reduce((P,A)=>{let[E,U]=A.split("=");return Bl(Gl({},P),{[E]:U})},{})}function p(){l(4,w=null);const P=new Bi(s,[...o,c],{cwd:v||null,env:d()});P.on("close",A=>{r(`command finished with code ${A.code} and signal ${A.signal}`),l(4,w=null)}),P.on("error",A=>r(`command error: "${A}"`)),P.stdout.on("data",A=>r(`command stdout: "${A}"`)),P.stderr.on("data",A=>r(`command stderr: "${A}"`)),P.spawn().then(A=>{l(4,w=A)}).catch(r)}function _(){w.kill().then(()=>r("killed child process")).catch(r)}function b(){w.write(k).catch(r)}function g(){c=this.value,l(0,c)}function M(){k=this.value,l(3,k)}function C(){v=this.value,l(1,v)}function W(){m=this.value,l(2,m)}return n.$$set=P=>{"onMessage"in P&&l(8,r=P.onMessage)},[c,v,m,k,w,p,_,b,r,g,M,C,W]}class Hs extends J{constructor(e){super();X(this,e,Es,Ls,Y,{onMessage:8})}}function Os(n){let e,l,i,s,o,r;return{c(){e=u("div"),l=u("button"),l.textContent="Check update",i=h(),s=u("button"),s.textContent="Install update",a(l,"class","button"),a(l,"id","check_update"),a(s,"class","button hidden"),a(s,"id","start_update")},m(c,v){T(c,e,v),t(e,l),t(e,i),t(e,s),o||(r=[y(l,"click",n[0]),y(s,"click",n[1])],o=!0)},p:I,i:I,o:I,d(c){c&&S(e),o=!1,x(r)}}}function As(n,e,l){let{onMessage:i}=e,s;en(async()=>{s=await Vl("tauri://update-status",i)}),In(()=>{s&&s()});async function o(){try{document.getElementById("check_update").classList.add("hidden");const{shouldUpdate:c,manifest:v}=await Fi();i(`Should update: ${c}`),i(v),c&&document.getElementById("start_update").classList.remove("hidden")}catch(c){i(c)}}async function r(){try{document.getElementById("start_update").classList.add("hidden"),await Vi(),i("Installation complete, restart required."),await Fl()}catch(c){i(c)}}return n.$$set=c=>{"onMessage"in c&&l(2,i=c.onMessage)},[o,r,i]}class Ps extends J{constructor(e){super();X(this,e,As,Os,Y,{onMessage:2})}}function Ws(n){let e,l,i,s,o,r,c,v,m;return{c(){e=u("div"),l=u("div"),i=u("input"),s=h(),o=u("button"),o.textContent="Write",r=h(),c=u("button"),c.textContent="Read",a(i,"placeholder","Text to write to the clipboard"),a(o,"type","button"),a(c,"type","button")},m(k,w){T(k,e,w),t(e,l),t(l,i),L(i,n[0]),t(l,s),t(l,o),t(e,r),t(e,c),v||(m=[y(i,"input",n[4]),y(o,"click",n[1]),y(c,"click",n[2])],v=!0)},p(k,[w]){w&1&&i.value!==k[0]&&L(i,k[0])},i:I,o:I,d(k){k&&S(e),v=!1,x(m)}}}function Is(n,e,l){let{onMessage:i}=e,s="clipboard message";function o(){Ji(s).then(()=>{i("Wrote to the clipboard")}).catch(i)}function r(){Xi().then(v=>{i(`Clipboard contents: ${v}`)}).catch(i)}function c(){s=this.value,l(0,s)}return n.$$set=v=>{"onMessage"in v&&l(3,i=v.onMessage)},[s,o,r,i,c]}class Us extends J{constructor(e){super();X(this,e,Is,Ws,Y,{onMessage:3})}}function Ns(n){let e;return{c(){e=u("div"),e.innerHTML=`

    Not available for Linux

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

    Not available for Linux

    + `},m(l,i){S(l,t,i)},p:W,i:W,o:W,d(l){l&&R(t)}}}function js(n,t,l){let{onMessage:i}=t;const s=window.constraints={audio:!0,video:!0};function a(c){const m=document.querySelector("video"),v=c.getVideoTracks();i("Got stream with constraints:",s),i(`Using video device: ${v[0].label}`),window.stream=c,m.srcObject=c}function r(c){if(c.name==="ConstraintNotSatisfiedError"){const m=s.video;i(`The resolution ${m.width.exact}x${m.height.exact} px is not supported by your device.`)}else c.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${c.name}`,c)}return en(async()=>{try{const c=await navigator.mediaDevices.getUserMedia(s);a(c)}catch(c){r(c)}}),Wn(()=>{window.stream.getTracks().forEach(function(c){c.stop()})}),n.$$set=c=>{"onMessage"in c&&l(0,i=c.onMessage)},[i]}class Gs extends X{constructor(t){super();Y(this,t,js,Ds,J,{onMessage:0})}}function Bs(n){let t,l,i,s,a,r,c,m,v,k,g,p,_,w,b;return p=new Ji({props:{json:n[2]}}),{c(){t=o("div"),l=o("input"),i=h(),s=o("input"),a=h(),r=o("label"),c=o("input"),m=C(` + Multipart`),v=h(),k=o("button"),k.textContent="Post it.",g=h(),Gn(p.$$.fragment),u(c,"type","checkbox"),u(k,"type","button")},m(d,z){S(d,t,z),e(t,l),E(l,n[0]),e(t,i),e(t,s),E(s,n[1]),e(t,a),e(t,r),e(r,c),c.checked=n[3],e(r,m),e(t,v),e(t,k),e(t,g),Bn(p,t,null),_=!0,w||(b=[y(l,"input",n[5]),y(s,"input",n[6]),y(c,"change",n[7]),y(k,"click",n[4])],w=!0)},p(d,[z]){z&1&&l.value!==d[0]&&E(l,d[0]),z&2&&s.value!==d[1]&&E(s,d[1]),z&8&&(c.checked=d[3]);const M={};z&4&&(M.json=d[2]),p.$set(M)},i(d){_||(Fn(p.$$.fragment,d),_=!0)},o(d){Vn(p.$$.fragment,d),_=!1},d(d){d&&R(t),Xn(p),w=!1,x(b)}}}function Fs(n,t,l){let i="baz",s="qux",a=null,r=!0;async function c(){const g=await ti().catch(p=>{throw onMessage(p),p});l(2,a=await g.request({url:"http://localhost:3003",method:"POST",body:Nn.form({foo:i,bar:s}),headers:r?{"Content-Type":"multipart/form-data"}:void 0,responseType:Ki.Text}))}function m(){i=this.value,l(0,i)}function v(){s=this.value,l(1,s)}function k(){r=this.checked,l(3,r)}return[i,s,a,r,c,m,v,k]}class Vs extends X{constructor(t){super();Y(this,t,Fs,Bs,J,{})}}function bi(n,t,l){const i=n.slice();return i[10]=t[l],i}function wi(n,t,l){const i=n.slice();return i[13]=t[l],i}function ki(n){let t,l=n[13].label+"",i,s,a,r,c;function m(){return n[9](n[13])}return{c(){t=o("p"),i=C(l),s=h(),u(t,"class",a="nv noselect "+(n[0]===n[13]?"nv_selected":""))},m(v,k){S(v,t,k),e(t,i),e(t,s),r||(c=y(t,"click",m),r=!0)},p(v,k){n=v,k&1&&a!==(a="nv noselect "+(n[0]===n[13]?"nv_selected":""))&&u(t,"class",a)},d(v){v&&R(t),r=!1,c()}}}function Xs(n){let t,l=n[10].html+"",i;return{c(){i=ai(),t=new xi(i)},m(s,a){t.m(l,s,a),S(s,i,a)},p(s,a){a&2&&l!==(l=s[10].html+"")&&t.p(l)},d(s){s&&R(i),s&&t.d()}}}function Ys(n){let t,l=n[10].text+"",i;return{c(){t=o("p"),i=C(l)},m(s,a){S(s,t,a),e(t,i)},p(s,a){a&2&&l!==(l=s[10].text+"")&&G(i,l)},d(s){s&&R(t)}}}function yi(n){let t;function l(a,r){return a[10].text?Ys:Xs}let i=l(n),s=i(n);return{c(){s.c(),t=ai()},m(a,r){s.m(a,r),S(a,t,r)},p(a,r){i===(i=l(a))&&s?s.p(a,r):(s.d(1),s=i(a),s&&(s.c(),s.m(t.parentNode,t)))},d(a){s.d(a),a&&R(t)}}}function Js(n){let t,l,i,s,a,r,c,m,v,k,g,p,_,w,b,d,z,M,q,A,P,L,I=n[2],N=[];for(let O=0;ODocumentation Github - Source`,c=h(),v=u("div"),m=u("div");for(let O=0;O{oi(H,1)}),Yi()}K?(d=new K(fe(O)),ni(d.$$.fragment),si(d.$$.fragment,1),li(d,w,null)):d=null}if(Q&2){V=O[1];let H;for(H=0;H{Qi(Xs,()=>{Un("menu_toggle")})});const s=[{label:"Welcome",component:ts},{label:"Messages",component:us},{label:"CLI",component:is},{label:"Dialog",component:ps},{label:"File system",component:ms},{label:"HTTP",component:gs},{label:"HTTP Form",component:Bs},{label:"Notifications",component:ys},{label:"Window",component:Ms},{label:"Shortcuts",component:Rs},{label:"Shell",component:Hs},{label:"Updater",component:Ps},{label:"Clipboard",component:Us},{label:"WebRTC",component:Ds}];let o=s[0],r=ei([]);xl(n,r,p=>l(1,i=p));function c(p){l(0,o=p)}function v(p){r.update(_=>[{text:`[${new Date().toLocaleTimeString()}]: `+(typeof p=="string"?p:JSON.stringify(p))},..._])}function m(p){r.update(_=>[{html:p},..._])}function k(){r.update(()=>[])}function w(){$l("https://tauri.studio/")}return[o,i,s,r,c,v,m,k,w,p=>c(p)]}class Ks extends J{constructor(e){super();X(this,e,Ys,Js,Y,{})}}new Ks({target:document.body}); + Source`,c=h(),m=o("div"),v=o("div");for(let O=0;O{Xn(H,1)}),Qi()}K?(p=new K(fe(O)),Gn(p.$$.fragment),Fn(p.$$.fragment,1),Bn(p,g,null)):p=null}if(Q&2){V=O[1];let H;for(H=0;H{$i(Ks,()=>{Un("menu_toggle")})});const s=[{label:"Welcome",component:ls},{label:"Messages",component:rs},{label:"CLI",component:os},{label:"Dialog",component:ds},{label:"File system",component:_s},{label:"HTTP",component:ws},{label:"HTTP Form",component:Vs},{label:"Notifications",component:Cs},{label:"Window",component:Ss},{label:"Shortcuts",component:Es},{label:"Shell",component:Ps},{label:"Updater",component:Ws},{label:"Clipboard",component:Ns},{label:"WebRTC",component:Gs}];let a=s[0],r=oi([]);si(n,r,_=>l(1,i=_));function c(_){l(0,a=_)}function m(_){r.update(w=>[{text:`[${new Date().toLocaleTimeString()}]: `+(typeof _=="string"?_:JSON.stringify(_))},...w])}function v(_){r.update(w=>[{html:_},...w])}function k(){r.update(()=>[])}function g(){ii("https://tauri.studio/")}return[a,i,s,r,c,m,v,k,g,_=>c(_)]}class Zs extends X{constructor(t){super();Y(this,t,Qs,Js,J,{})}}new Zs({target:document.body}); diff --git a/examples/api/dist/assets/vendor.css b/examples/api/dist/assets/vendor.css new file mode 100644 index 000000000..aaf074e25 --- /dev/null +++ b/examples/api/dist/assets/vendor.css @@ -0,0 +1 @@ +ul.svelte-gbh3pt{list-style:none;margin:0;padding:0;padding-left:var(--nodePaddingLeft, 1rem);border-left:var(--nodeBorderLeft, 1px dotted #9ca3af);color:var(--nodeColor, #374151)}.hidden.svelte-gbh3pt{display:none}.bracket.svelte-gbh3pt{cursor:pointer}.bracket.svelte-gbh3pt:hover{background:var(--bracketHoverBackground, #d1d5db)}.comma.svelte-gbh3pt{color:var(--nodeColor, #374151)}.val.svelte-gbh3pt{color:var(--leafDefaultColor, #9ca3af)}.val.string.svelte-gbh3pt{color:var(--leafStringColor, #059669)}.val.number.svelte-gbh3pt{color:var(--leafNumberColor, #d97706)}.val.boolean.svelte-gbh3pt{color:var(--leafBooleanColor, #2563eb)} diff --git a/examples/api/dist/assets/vendor.js b/examples/api/dist/assets/vendor.js index da0ce0769..7d36b143f 100644 --- a/examples/api/dist/assets/vendor.js +++ b/examples/api/dist/assets/vendor.js @@ -1,4 +1,4 @@ -function T(){}function ot(t){return t()}function ut(){return Object.create(null)}function A(t){t.forEach(ot)}function Kt(t){return typeof t=="function"}function Rt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function Ut(t){return Object.keys(t).length===0}function Nt(t,...e){if(t==null)return T;const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function Ge(t,e,n){t.$$.on_destroy.push(Nt(e,n))}function Je(t,e){t.appendChild(e)}function Bt(t,e,n){t.insertBefore(e,n||null)}function st(t){t.parentNode.removeChild(t)}function Xe(t,e){for(let n=0;nt.removeEventListener(e,n,i)}function tn(t){return function(e){return e.preventDefault(),t.call(this,e)}}function en(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function nn(t){return t===""?null:+t}function qt(t){return Array.from(t.childNodes)}function rn(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function on(t,e){t.value=e==null?"":e}function un(t,e){for(let n=0;n{L.delete(t),i&&(n&&t.d(1),i())}),t.o(e)}}function pn(t){t&&t.c()}function Xt(t,e,n,i){const{fragment:r,on_mount:s,on_destroy:c,after_update:f}=t.$$;r&&r.m(e,n),i||B(()=>{const l=s.map(ot).filter(Kt);c?c.push(...l):A(l),t.$$.on_mount=[]}),f.forEach(B)}function Qt(t,e){const n=t.$$;n.fragment!==null&&(A(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Yt(t,e){t.$$.dirty[0]===-1&&(E.push(t),Vt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const g=_.length?_[0]:v;return l.ctx&&r(l.ctx[d],l.ctx[d]=g)&&(!l.skip_bound&&l.bound[d]&&l.bound[d](g),h&&Yt(t,d)),v}):[],l.update(),h=!0,A(l.before_update),l.fragment=i?i(l.ctx):!1,e.target){if(e.hydrate){const d=qt(e.target);l.fragment&&l.fragment.l(d),d.forEach(st)}else l.fragment&&l.fragment.c();e.intro&&Jt(t.$$.fragment),Xt(t,e.target,e.anchor,e.customElement),ft()}C(f)}class vn{$destroy(){Qt(this,1),this.$destroy=T}$on(e,n){const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(e){this.$$set&&!Ut(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const P=[];function yn(t,e=T){let n;const i=[];function r(f){if(Rt(t,f)&&(t=f,n)){const l=!P.length;for(let h=0;h{const d=i.indexOf(h);d!==-1&&i.splice(d,1),i.length===0&&(n(),n=null)}}return{set:r,update:s,subscribe:c}}/*! +function L(){}function zt(t){return t()}function St(){return Object.create(null)}function N(t){t.forEach(zt)}function ge(t){return typeof t=="function"}function Et(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function ye(t){return Object.keys(t).length===0}function be(t,...e){if(t==null)return L;const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function Wn(t,e,n){t.$$.on_destroy.push(be(e,n))}function P(t,e){t.appendChild(e)}function E(t,e,n){t.insertBefore(e,n||null)}function S(t){t.parentNode.removeChild(t)}function we(t,e){for(let n=0;nt.removeEventListener(e,n,i)}function Dn(t){return function(e){return e.preventDefault(),t.call(this,e)}}function T(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function Cn(t){return t===""?null:+t}function Me(t){return Array.from(t.childNodes)}function q(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Ln(t,e){t.value=e==null?"":e}function Fn(t,e){for(let n=0;n{tt.delete(t),i&&(n&&t.d(1),i())}),t.o(e)}}function Pe(t){t&&t.c()}function Ft(t,e,n,i){const{fragment:r,on_mount:o,on_destroy:u,after_update:f}=t.$$;r&&r.m(e,n),i||ct(()=>{const d=o.map(zt).filter(ge);u?u.push(...d):N(d),t.$$.on_mount=[]}),f.forEach(ct)}function xt(t,e){const n=t.$$;n.fragment!==null&&(N(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Te(t,e){t.$$.dirty[0]===-1&&(I.push(t),ke(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const g=m.length?m[0]:_;return d.ctx&&r(d.ctx[c],d.ctx[c]=g)&&(!d.skip_bound&&d.bound[c]&&d.bound[c](g),h&&Te(t,c)),_}):[],d.update(),h=!0,N(d.before_update),d.fragment=i?i(d.ctx):!1,e.target){if(e.hydrate){const c=Me(e.target);d.fragment&&d.fragment.l(c),c.forEach(S)}else d.fragment&&d.fragment.c();e.intro&&D(t.$$.fragment),Ft(t,e.target,e.anchor,e.customElement),Lt()}Y(f)}class ze{$destroy(){xt(this,1),this.$destroy=L}$on(e,n){const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(e){this.$$set&&!ye(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const H=[];function Bn(t,e=L){let n;const i=[];function r(f){if(Et(t,f)&&(t=f,n)){const d=!H.length;for(let h=0;h{const c=i.indexOf(h);c!==-1&&i.splice(c,1),i.length===0&&(n(),n=null)}}return{set:r,update:o,subscribe:u}}/*! * hotkeys-js v3.8.5 * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * @@ -6,7 +6,7 @@ function T(){}function ot(t){return t()}function ut(){return Object.create(null) * http://jaywcjlove.github.io/hotkeys * * Licensed under the MIT license. - */var H=typeof navigator!="undefined"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function V(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on".concat(e),function(){n(window.event)})}function ht(t,e){for(var n=e.slice(0,e.length-1),i=0;i=0;)e[n-1]+=",",e.splice(n,1),n=e.lastIndexOf("");return e}function Zt(t,e){for(var n=t.length>=e.length?t:e,i=t.length>=e.length?e:t,r=!0,s=0;s=0&&p.splice(n,1),t.key&&t.key.toLowerCase()==="meta"&&p.splice(0,p.length),(e===93||e===224)&&(e=91),e in y){y[e]=!1;for(var i in $)$[i]===e&&(M[i]=!1)}}function oe(t){if(!t)Object.keys(m).forEach(function(c){return delete m[c]});else if(Array.isArray(t))t.forEach(function(c){c.key&&G(c)});else if(typeof t=="object")t.key&&G(t);else if(typeof t=="string"){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i1?ht($,h):[];m[_]=m[_].map(function(b){var Ft=r?b.method===r:!0;return Ft&&b.scope===i&&Zt(b.mods,g)?{}:b})}})};function bt(t,e,n){var i;if(e.scope===n||e.scope==="all"){i=e.mods.length>0;for(var r in y)Object.prototype.hasOwnProperty.call(y,r)&&(!y[r]&&e.mods.indexOf(+r)>-1||y[r]&&e.mods.indexOf(+r)===-1)&&(i=!1);(e.mods.length===0&&!y[16]&&!y[18]&&!y[17]&&!y[91]||i||e.shortcut==="*")&&e.method(t,e)===!1&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function wt(t){var e=m["*"],n=t.keyCode||t.which||t.charCode;if(!!M.filter.call(this,t)){if((n===93||n===224)&&(n=91),p.indexOf(n)===-1&&n!==229&&p.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(g){var b=vt[g];t[g]&&p.indexOf(b)===-1?p.push(b):!t[g]&&p.indexOf(b)>-1?p.splice(p.indexOf(b),1):g==="metaKey"&&t[g]&&p.length===3&&(t.ctrlKey||t.shiftKey||t.altKey||(p=p.slice(p.indexOf(b))))}),n in y){y[n]=!0;for(var i in $)$[i]===n&&(M[i]=!0);if(!e)return}for(var r in y)Object.prototype.hasOwnProperty.call(y,r)&&(y[r]=t[vt[r]]);t.getModifierState&&!(t.altKey&&!t.ctrlKey)&&t.getModifierState("AltGraph")&&(p.indexOf(17)===-1&&p.push(17),p.indexOf(18)===-1&&p.push(18),y[17]=!0,y[18]=!0);var s=z();if(e)for(var c=0;c-1}function M(t,e,n){p=[];var i=pt(t),r=[],s="all",c=document,f=0,l=!1,h=!0,d="+";for(n===void 0&&typeof e=="function"&&(n=e),Object.prototype.toString.call(e)==="[object Object]"&&(e.scope&&(s=e.scope),e.element&&(c=e.element),e.keyup&&(l=e.keyup),e.keydown!==void 0&&(h=e.keydown),typeof e.splitKey=="string"&&(d=e.splitKey)),typeof e=="string"&&(s=e);f1&&(r=ht($,t)),t=t[t.length-1],t=t==="*"?"*":F(t),t in m||(m[t]=[]),m[t].push({keyup:l,keydown:h,scope:s,mods:r,shortcut:i[f],method:n,key:i[f],splitKey:d});typeof c!="undefined"&&!ue(c)&&window&&(_t.push(c),V(c,"keydown",function(v){wt(v)}),V(window,"focus",function(){p=[]}),V(c,"keyup",function(v){wt(v),re(v)}))}var J={setScope:gt,getScope:z,deleteScope:ie,getPressedKeyCodes:te,isPressed:ne,filter:ee,unbind:oe};for(var X in J)Object.prototype.hasOwnProperty.call(J,X)&&(M[X]=J[X]);if(typeof window!="undefined"){var se=window.hotkeys;M.noConflict=function(t){return t&&window.hotkeys===M&&(window.hotkeys=se),M},window.hotkeys=M}/*! ***************************************************************************** + */var pt=typeof navigator!="undefined"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function mt(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on".concat(e),function(){n(window.event)})}function Kt(t,e){for(var n=e.slice(0,e.length-1),i=0;i=0;)e[n-1]+=",",e.splice(n,1),n=e.lastIndexOf("");return e}function Se(t,e){for(var n=t.length>=e.length?t:e,i=t.length>=e.length?e:t,r=!0,o=0;o=0&&y.splice(n,1),t.key&&t.key.toLowerCase()==="meta"&&y.splice(0,y.length),(e===93||e===224)&&(e=91),e in A){A[e]=!1;for(var i in U)U[i]===e&&(F[i]=!1)}}function Le(t){if(!t)Object.keys(k).forEach(function(u){return delete k[u]});else if(Array.isArray(t))t.forEach(function(u){u.key&&_t(u)});else if(typeof t=="object")t.key&&_t(t);else if(typeof t=="string"){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i1?Kt(U,h):[];k[m]=k[m].map(function(b){var v=r?b.method===r:!0;return v&&b.scope===i&&Se(b.mods,g)?{}:b})}})};function Vt(t,e,n){var i;if(e.scope===n||e.scope==="all"){i=e.mods.length>0;for(var r in A)Object.prototype.hasOwnProperty.call(A,r)&&(!A[r]&&e.mods.indexOf(+r)>-1||A[r]&&e.mods.indexOf(+r)===-1)&&(i=!1);(e.mods.length===0&&!A[16]&&!A[18]&&!A[17]&&!A[91]||i||e.shortcut==="*")&&e.method(t,e)===!1&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function It(t){var e=k["*"],n=t.keyCode||t.which||t.charCode;if(!!F.filter.call(this,t)){if((n===93||n===224)&&(n=91),y.indexOf(n)===-1&&n!==229&&y.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(g){var b=Bt[g];t[g]&&y.indexOf(b)===-1?y.push(b):!t[g]&&y.indexOf(b)>-1?y.splice(y.indexOf(b),1):g==="metaKey"&&t[g]&&y.length===3&&(t.ctrlKey||t.shiftKey||t.altKey||(y=y.slice(y.indexOf(b))))}),n in A){A[n]=!0;for(var i in U)U[i]===n&&(F[i]=!0);if(!e)return}for(var r in A)Object.prototype.hasOwnProperty.call(A,r)&&(A[r]=t[Bt[r]]);t.getModifierState&&!(t.altKey&&!t.ctrlKey)&&t.getModifierState("AltGraph")&&(y.indexOf(17)===-1&&y.push(17),y.indexOf(18)===-1&&y.push(18),A[17]=!0,A[18]=!0);var o=J();if(e)for(var u=0;u-1}function F(t,e,n){y=[];var i=Rt(t),r=[],o="all",u=document,f=0,d=!1,h=!0,c="+";for(n===void 0&&typeof e=="function"&&(n=e),Object.prototype.toString.call(e)==="[object Object]"&&(e.scope&&(o=e.scope),e.element&&(u=e.element),e.keyup&&(d=e.keyup),e.keydown!==void 0&&(h=e.keydown),typeof e.splitKey=="string"&&(c=e.splitKey)),typeof e=="string"&&(o=e);f1&&(r=Kt(U,t)),t=t[t.length-1],t=t==="*"?"*":nt(t),t in k||(k[t]=[]),k[t].push({keyup:d,keydown:h,scope:o,mods:r,shortcut:i[f],method:n,key:i[f],splitKey:c});typeof u!="undefined"&&!Fe(u)&&window&&(qt.push(u),mt(u,"keydown",function(_){It(_)}),mt(window,"focus",function(){y=[]}),mt(u,"keyup",function(_){It(_),Ce(_)}))}var vt={setScope:Ht,getScope:J,deleteScope:De,getPressedKeyCodes:Ee,isPressed:We,filter:$e,unbind:Le};for(var gt in vt)Object.prototype.hasOwnProperty.call(vt,gt)&&(F[gt]=vt[gt]);if(typeof window!="undefined"){var xe=window.hotkeys;F.noConflict=function(t){return t&&window.hotkeys===F&&(window.hotkeys=xe),F},window.hotkeys=F}/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -19,7 +19,6 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var Mt=function(t,e){return(Mt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])})(t,e)};function Q(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Mt(t,e),t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var w=function(){return(w=Object.assign||function(t){for(var e,n=1,i=arguments.length;n0&&r[r.length-1])||d[0]!==6&&d[0]!==2)){c=0;continue}if(d[0]===3&&(!r||d[1]>r[0]&&d[1]0&&r[r.length-1])||c[0]!==6&&c[0]!==2)){u=0;continue}if(c[0]===3&&(!r||c[1]>r[0]&&c[1]=200&&this.status<300,this.headers=t.headers,this.rawHeaders=t.rawHeaders,this.data=t.data},zt=function(){function t(e){this.id=e}return t.prototype.drop=function(){return o(this,void 0,void 0,function(){return u(this,function(e){return[2,a({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})]})})},t.prototype.request=function(e){return o(this,void 0,void 0,function(){var n;return u(this,function(i){return(n=!e.responseType||e.responseType===S.JSON)&&(e.responseType=S.Text),[2,a({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:e}}).then(function(r){var s=new Et(r);if(n){try{s.data=JSON.parse(s.data)}catch(c){if(s.ok&&s.data==="")s.data={};else if(s.ok)throw Error("Failed to parse response `".concat(s.data,"` as JSON: ").concat(c,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return s}return s})]})})},t.prototype.get=function(e,n){return o(this,void 0,void 0,function(){return u(this,function(i){return[2,this.request(w({method:"GET",url:e},n))]})})},t.prototype.post=function(e,n,i){return o(this,void 0,void 0,function(){return u(this,function(r){return[2,this.request(w({method:"POST",url:e,body:n},i))]})})},t.prototype.put=function(e,n,i){return o(this,void 0,void 0,function(){return u(this,function(r){return[2,this.request(w({method:"PUT",url:e,body:n},i))]})})},t.prototype.patch=function(e,n){return o(this,void 0,void 0,function(){return u(this,function(i){return[2,this.request(w({method:"PATCH",url:e},n))]})})},t.prototype.delete=function(e,n){return o(this,void 0,void 0,function(){return u(this,function(i){return[2,this.request(w({method:"DELETE",url:e},n))]})})},t}();function St(t){return o(this,void 0,void 0,function(){return u(this,function(e){return[2,a({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then(function(n){return new zt(n)})]})})}var et=null;function Ce(t,e){var n;return o(this,void 0,void 0,function(){return u(this,function(i){switch(i.label){case 0:return et!==null?[3,2]:[4,St()];case 1:et=i.sent(),i.label=2;case 2:return[2,et.request(w({url:t,method:(n=e==null?void 0:e.method)!==null&&n!==void 0?n:"GET"},e))]}})})}Object.freeze({__proto__:null,getClient:St,fetch:Ce,Body:je,Client:zt,Response:Et,get ResponseType(){return S}});var U,Wt=function(t,e){this.type="Logical",this.width=t,this.height=e},nt=function(){function t(e,n){this.type="Physical",this.width=e,this.height=n}return t.prototype.toLogical=function(e){return new Wt(this.width/e,this.height/e)},t}(),jt=function(t,e){this.type="Logical",this.x=t,this.y=e},it=function(){function t(e,n){this.type="Physical",this.x=e,this.y=n}return t.prototype.toLogical=function(e){return new jt(this.x/e,this.y/e)},t}();function De(){return new W(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function Ct(){return window.__TAURI_METADATA__.__windows.map(function(t){return new W(t.label,{skip:!0})})}(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(U||(U={}));var rt,Dt=["tauri://created","tauri://error"],Lt=function(){function t(e){this.label=e,this.listeners=Object.create(null)}return t.prototype.listen=function(e,n){return o(this,void 0,void 0,function(){var i=this;return u(this,function(r){return this._handleTauriEvent(e,n)?[2,Promise.resolve(function(){var s=i.listeners[e];s.splice(s.indexOf(n),1)})]:[2,Y(e,this.label,n)]})})},t.prototype.once=function(e,n){return o(this,void 0,void 0,function(){var i=this;return u(this,function(r){return this._handleTauriEvent(e,n)?[2,Promise.resolve(function(){var s=i.listeners[e];s.splice(s.indexOf(n),1)})]:[2,Pt(e,this.label,n)]})})},t.prototype.emit=function(e,n){return o(this,void 0,void 0,function(){var i,r;return u(this,function(s){if(Dt.includes(e)){for(i=0,r=this.listeners[e]||[];i=200&&this.status<300,this.headers=t.headers,this.rawHeaders=t.rawHeaders,this.data=t.data},ne=function(){function t(e){this.id=e}return t.prototype.drop=function(){return s(this,void 0,void 0,function(){return a(this,function(e){return[2,l({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})]})})},t.prototype.request=function(e){return s(this,void 0,void 0,function(){var n;return a(this,function(i){return(n=!e.responseType||e.responseType===G.JSON)&&(e.responseType=G.Text),[2,l({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:e}}).then(function(r){var o=new ee(r);if(n){try{o.data=JSON.parse(o.data)}catch(u){if(o.ok&&o.data==="")o.data={};else if(o.ok)throw Error("Failed to parse response `".concat(o.data,"` as JSON: ").concat(u,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return o}return o})]})})},t.prototype.get=function(e,n){return s(this,void 0,void 0,function(){return a(this,function(i){return[2,this.request(C({method:"GET",url:e},n))]})})},t.prototype.post=function(e,n,i){return s(this,void 0,void 0,function(){return a(this,function(r){return[2,this.request(C({method:"POST",url:e,body:n},i))]})})},t.prototype.put=function(e,n,i){return s(this,void 0,void 0,function(){return a(this,function(r){return[2,this.request(C({method:"PUT",url:e,body:n},i))]})})},t.prototype.patch=function(e,n){return s(this,void 0,void 0,function(){return a(this,function(i){return[2,this.request(C({method:"PATCH",url:e},n))]})})},t.prototype.delete=function(e,n){return s(this,void 0,void 0,function(){return a(this,function(i){return[2,this.request(C({method:"DELETE",url:e},n))]})})},t}();function ie(t){return s(this,void 0,void 0,function(){return a(this,function(e){return[2,l({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then(function(n){return new ne(n)})]})})}var kt=null;function dn(t,e){var n;return s(this,void 0,void 0,function(){return a(this,function(i){switch(i.label){case 0:return kt!==null?[3,2]:[4,ie()];case 1:kt=i.sent(),i.label=2;case 2:return[2,kt.request(C({url:t,method:(n=e==null?void 0:e.method)!==null&&n!==void 0?n:"GET"},e))]}})})}Object.freeze({__proto__:null,getClient:ie,fetch:dn,Body:fn,Client:ne,Response:ee,get ResponseType(){return G}});var rt,re=function(t,e){this.type="Logical",this.width=t,this.height=e},At=function(){function t(e,n){this.type="Physical",this.width=e,this.height=n}return t.prototype.toLogical=function(e){return new re(this.width/e,this.height/e)},t}(),oe=function(t,e){this.type="Logical",this.x=t,this.y=e},Pt=function(){function t(e,n){this.type="Physical",this.x=e,this.y=n}return t.prototype.toLogical=function(e){return new oe(this.x/e,this.y/e)},t}();function hn(){return new ot(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function ue(){return window.__TAURI_METADATA__.__windows.map(function(t){return new ot(t.label,{skip:!0})})}(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(rt||(rt={}));var se=["tauri://created","tauri://error"],ae=function(){function t(e){this.label=e,this.listeners=Object.create(null)}return t.prototype.listen=function(e,n){return s(this,void 0,void 0,function(){var i=this;return a(this,function(r){return this._handleTauriEvent(e,n)?[2,Promise.resolve(function(){var o=i.listeners[e];o.splice(o.indexOf(n),1)})]:[2,wt(e,this.label,n)]})})},t.prototype.once=function(e,n){return s(this,void 0,void 0,function(){var i=this;return a(this,function(r){return this._handleTauriEvent(e,n)?[2,Promise.resolve(function(){var o=i.listeners[e];o.splice(o.indexOf(n),1)})]:[2,Zt(e,this.label,n)]})})},t.prototype.emit=function(e,n){return s(this,void 0,void 0,function(){var i,r;return a(this,function(o){if(se.includes(e)){for(i=0,r=this.listeners[e]||[];iR(M[p],1,1,()=>{M[p]=null});let j=!t[3]&&me(),z=!t[3]&&t[8]&&_e();return{c(){e=$("span"),n=$("span"),i=W(t[6]),r=V(),o=$("ul");for(let p=0;p{c[b]=null}),ht(),o=c[r],o?o.p(m,g):(o=c[r]=h[r](m),o.c()),D(o,1),o.m(e,u))},i(m){f||(D(o),f=!0)},o(m){R(o),f=!1},d(m){m&&S(e),d&&d.d(),c[r].d()}}}function me(t){let e;return{c(){e=$("span"),e.textContent=",",T(e,"class","comma svelte-gbh3pt")},m(n,i){E(n,e,i)},d(n){n&&S(e)}}}function _e(t){let e;return{c(){e=$("span"),e.textContent=",",T(e,"class","comma svelte-gbh3pt")},m(n,i){E(n,e,i)},d(n){n&&S(e)}}}function zn(t){let e,n,i=t[5].length&&fe(t);return{c(){i&&i.c(),e=$t()},m(r,o){i&&i.m(r,o),E(r,e,o),n=!0},p(r,[o]){r[5].length?i?(i.p(r,o),o&32&&D(i,1)):(i=fe(r),i.c(),D(i,1),i.m(e.parentNode,e)):i&&(dt(),R(i,1,1,()=>{i=null}),ht())},i(r){n||(D(i),n=!0)},o(r){R(i),n=!1},d(r){i&&i.d(r),r&&S(e)}}}const Sn="...";function En(t,e,n){let{json:i}=e,{depth:r=1/0}=e,{_lvl:o=0}=e,{_last:u=!0}=e;const f=v=>v===null?"null":typeof v;let d,h,c,_,m;const g=v=>{switch(f(v)){case"string":return`"${v}"`;case"function":return"f () {...}";case"symbol":return v.toString();default:return v}},b=()=>{n(8,m=!m)};return t.$$set=v=>{"json"in v&&n(0,i=v.json),"depth"in v&&n(1,r=v.depth),"_lvl"in v&&n(2,o=v._lvl),"_last"in v&&n(3,u=v._last)},t.$$.update=()=>{t.$$.dirty&17&&(n(5,d=f(i)==="object"?Object.keys(i):[]),n(4,h=Array.isArray(i)),n(6,c=h?"[":"{"),n(7,_=h?"]":"}")),t.$$.dirty&6&&n(8,m=rSvelte + Vite App + diff --git a/examples/api/package.json b/examples/api/package.json index 53f0c67dc..e861b58ac 100644 --- a/examples/api/package.json +++ b/examples/api/package.json @@ -10,11 +10,12 @@ }, "dependencies": { "@tauri-apps/api": "../../tooling/api/dist", + "@zerodevx/svelte-json-view": "0.2.0", "hotkeys-js": "^3.8.5" }, "devDependencies": { - "svelte": "3.35.0", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.11", + "svelte": "3.35.0", "vite": "^2.6.4" } -} \ No newline at end of file +} diff --git a/examples/api/public/global.css b/examples/api/public/global.css index 3645dd444..54babc528 100644 --- a/examples/api/public/global.css +++ b/examples/api/public/global.css @@ -138,14 +138,14 @@ main { height: 100%; } -[type='radio']:checked ~ label { +[type='radio']:checked~label { background: rgb(36, 37, 38); color: #67d6ed; border-bottom: 1px solid transparent; z-index: 2; } -[type='radio']:checked ~ label ~ .content { +[type='radio']:checked~label~.content { z-index: 1; } @@ -190,3 +190,7 @@ main { #file-response { height: 400px; } + +span.key { + color: #fff; +} \ No newline at end of file diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 7f5e75539..21991012b 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -96,8 +96,15 @@ dependencies = [ "serde_json", "tauri", "tauri-build", + "tiny_http", ] +[[package]] +name = "ascii" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbf56136a5198c7b01a49e3afcbef6cf84597273d298f54432926024107b0109" + [[package]] name = "async-broadcast" version = "0.3.4" @@ -223,6 +230,8 @@ dependencies = [ "flate2", "http", "log", + "mime", + "multipart", "native-tls", "openssl", "serde", @@ -332,6 +341,9 @@ name = "bytes" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +dependencies = [ + "serde", +] [[package]] name = "cache-padded" @@ -435,6 +447,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +[[package]] +name = "chunked_transfer" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" + [[package]] name = "cipher" version = "0.3.0" @@ -839,6 +857,15 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" +[[package]] +name = "encoding_rs" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +dependencies = [ + "cfg-if", +] + [[package]] name = "enumflags2" version = "0.7.4" @@ -1384,6 +1411,25 @@ dependencies = [ "syn", ] +[[package]] +name = "h2" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util 0.7.1", + "tracing", +] + [[package]] name = "hashbrown" version = "0.11.2" @@ -1445,12 +1491,72 @@ dependencies = [ "itoa 1.0.1", ] +[[package]] +name = "http-body" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + [[package]] name = "http-range" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" +[[package]] +name = "httparse" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6330e8a36bd8c859f3fa6d9382911fbb7147ec39807f63b923933a247240b9ba" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa 1.0.1", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "ico" version = "0.1.0" @@ -1533,6 +1639,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "ipnet" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" + [[package]] name = "itertools" version = "0.10.3" @@ -1781,6 +1893,22 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "minisign-verify" version = "0.2.0" @@ -1806,6 +1934,42 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" +dependencies = [ + "libc", + "log", + "miow", + "ntapi", + "wasi 0.11.0+wasi-snapshot-preview1", + "winapi", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + +[[package]] +name = "multipart" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182" +dependencies = [ + "log", + "mime", + "mime_guess", + "rand 0.8.5", + "tempfile", +] + [[package]] name = "native-tls" version = "0.2.9" @@ -1916,6 +2080,15 @@ dependencies = [ "zvariant_derive", ] +[[package]] +name = "ntapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" +dependencies = [ + "winapi", +] + [[package]] name = "num-integer" version = "0.1.44" @@ -2609,6 +2782,44 @@ dependencies = [ "winapi", ] +[[package]] +name = "reqwest" +version = "0.11.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "lazy_static", + "log", + "mime", + "mime_guess", + "native-tls", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tokio-util 0.6.9", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + [[package]] name = "rfd" version = "0.8.1" @@ -3190,6 +3401,7 @@ dependencies = [ "attohttpc", "base64", "bincode", + "bytes", "cfg_aliases", "clap", "dirs-next", @@ -3216,6 +3428,7 @@ dependencies = [ "rand 0.8.5", "raw-window-handle", "regex", + "reqwest", "rfd", "semver 1.0.7", "serde", @@ -3420,8 +3633,29 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" dependencies = [ + "itoa 1.0.1", "libc", "num_threads", + "time-macros", +] + +[[package]] +name = "time-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" + +[[package]] +name = "tiny_http" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0d6ef4e10d23c1efb862eecad25c5054429a71958b4eeef85eb5e7170b477ca" +dependencies = [ + "ascii", + "chunked_transfer", + "log", + "time", + "url", ] [[package]] @@ -3446,9 +3680,51 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" dependencies = [ "bytes", + "libc", "memchr", + "mio", "num_cpus", "pin-project-lite", + "socket2", + "winapi", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", ] [[package]] @@ -3460,6 +3736,12 @@ dependencies = [ "serde", ] +[[package]] +name = "tower-service" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" + [[package]] name = "tracing" version = "0.1.32" @@ -3531,6 +3813,12 @@ dependencies = [ "serde_json", ] +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + [[package]] name = "typenum" version = "1.15.0" @@ -3543,6 +3831,15 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-bidi" version = "0.3.7" @@ -3661,6 +3958,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -3673,6 +3980,12 @@ version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "wasm-bindgen" version = "0.2.79" @@ -4087,6 +4400,15 @@ version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa" +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + [[package]] name = "winres" version = "0.1.12" diff --git a/examples/api/src-tauri/Cargo.toml b/examples/api/src-tauri/Cargo.toml index d8fa382fd..c7f15e679 100644 --- a/examples/api/src-tauri/Cargo.toml +++ b/examples/api/src-tauri/Cargo.toml @@ -12,7 +12,8 @@ tauri-build = { path = "../../../core/tauri-build", features = ["isolation"] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = [ "derive" ] } -tauri = { path = "../../../core/tauri", default-features = false, features = ["api-all", "cli", "compression", "icon-ico", "icon-png", "isolation", "macos-private-api", "objc-exception", "system-tray", "updater", "wry"] } +tauri = { path = "../../../core/tauri", default-features = false, features = ["api-all", "http-multipart", "reqwest-client", "cli", "compression", "icon-ico", "icon-png", "isolation", "macos-private-api", "objc-exception", "system-tray", "updater", "wry"] } +tiny_http = "0.11" [features] default = [ "custom-protocol", "tauri/ayatana-tray" ] diff --git a/examples/api/src-tauri/src/main.rs b/examples/api/src-tauri/src/main.rs index e610d6b33..09a9ea04c 100644 --- a/examples/api/src-tauri/src/main.rs +++ b/examples/api/src-tauri/src/main.rs @@ -14,11 +14,10 @@ mod menu; use std::path::PathBuf; use std::sync::atomic::{AtomicBool, Ordering}; -use serde::{Deserialize, Serialize}; +use serde::Serialize; use tauri::{ - api::dialog::ask, http::ResponseBuilder, window::WindowBuilder, CustomMenuItem, - GlobalShortcutManager, Manager, RunEvent, SystemTray, SystemTrayEvent, SystemTrayMenu, - WindowEvent, WindowUrl, + api::dialog::ask, window::WindowBuilder, CustomMenuItem, GlobalShortcutManager, Manager, + RunEvent, SystemTray, SystemTrayEvent, SystemTrayMenu, WindowEvent, WindowUrl, }; #[derive(Clone, Serialize)] @@ -26,18 +25,6 @@ struct Reply { data: String, } -#[derive(Serialize, Deserialize)] -struct HttpPost { - foo: String, - bar: String, -} - -#[derive(Serialize)] -struct HttpReply { - msg: String, - request: HttpPost, -} - #[tauri::command] async fn menu_toggle(window: tauri::Window) { window.menu_handle().toggle().unwrap(); @@ -63,6 +50,31 @@ fn main() { .setup(|app| { #[cfg(debug_assertions)] app.get_window("main").unwrap().open_devtools(); + + std::thread::spawn(|| { + let server = match tiny_http::Server::http("localhost:3003") { + Ok(s) => s, + Err(e) => { + eprintln!("{}", e); + std::process::exit(1); + } + }; + loop { + if let Ok(mut request) = server.recv() { + let mut body = Vec::new(); + let _ = request.as_reader().read_to_end(&mut body); + let response = tiny_http::Response::new( + tiny_http::StatusCode(200), + request.headers().to_vec(), + std::io::Cursor::new(body), + request.body_length(), + None, + ); + let _ = request.respond(response); + } + } + }); + Ok(()) }) .on_page_load(|window, _| { @@ -78,24 +90,6 @@ fn main() { .expect("failed to emit"); }); }) - .register_uri_scheme_protocol("customprotocol", move |_app_handle, request| { - if request.method() == "POST" { - let request: HttpPost = serde_json::from_slice(request.body()).unwrap(); - return ResponseBuilder::new() - .mimetype("application/json") - .header("Access-Control-Allow-Origin", "*") - .status(200) - .body(serde_json::to_vec(&HttpReply { - request, - msg: "Hello from rust!".to_string(), - })?); - } - - ResponseBuilder::new() - .mimetype("text/html") - .status(404) - .body(Vec::new()) - }) .menu(menu::get_menu()) .on_menu_event(|event| { println!("{:?}", event.menu_item_id()); diff --git a/examples/api/src-tauri/tauri.conf.json b/examples/api/src-tauri/tauri.conf.json index a541e7674..b73f21e06 100644 --- a/examples/api/src-tauri/tauri.conf.json +++ b/examples/api/src-tauri/tauri.conf.json @@ -112,7 +112,7 @@ } }, "http": { - "scope": ["https://jsonplaceholder.typicode.com/todos/*"] + "scope": ["http://localhost:3003"] } }, "windows": [ diff --git a/examples/api/src/components/Http.svelte b/examples/api/src/components/Http.svelte index 2dc92169a..fa3433d90 100644 --- a/examples/api/src/components/Http.svelte +++ b/examples/api/src/components/Http.svelte @@ -1,7 +1,6 @@ - - - - -

    - Result: -

    -
    -{result}
    -
    \ No newline at end of file +
    + + + + + +
    diff --git a/examples/api/yarn.lock b/examples/api/yarn.lock index 130d4b1ba..88165a1f2 100644 --- a/examples/api/yarn.lock +++ b/examples/api/yarn.lock @@ -23,9 +23,14 @@ svelte-hmr "^0.14.7" "@tauri-apps/api@../../tooling/api/dist": - version "1.0.0-rc.3" + version "1.0.0-rc.0" dependencies: - type-fest "2.12.2" + type-fest "2.11.2" + +"@zerodevx/svelte-json-view@0.2.0": + version "0.2.0" + resolved "https://registry.yarnpkg.com/@zerodevx/svelte-json-view/-/svelte-json-view-0.2.0.tgz#e4d1f42d3a0fb57c921873fe9e703dbd5d08d989" + integrity sha512-hAqzbaDJ+cMDAID0PHr8JT0guSaPsabhVxssy5J1mAqrmUvgrAbxxgTT0RzHSwkACrRn9LP8YDbxrwbHdW0FYw== debug@^4.3.2: version "4.3.3" @@ -262,10 +267,10 @@ svelte@3.35.0: resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.35.0.tgz#e0d0ba60c4852181c2b4fd851194be6fda493e65" integrity sha512-gknlZkR2sXheu/X+B7dDImwANVvK1R0QGQLd8CNIfxxGPeXBmePnxfzb6fWwTQRsYQG7lYkZXvpXJvxvpsoB7g== -type-fest@2.12.2: - version "2.12.2" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.12.2.tgz#80a53614e6b9b475eb9077472fb7498dc7aa51d0" - integrity sha512-qt6ylCGpLjZ7AaODxbpyBZSs9fCI9SkL3Z9q2oxMBQhs/uyY+VD8jHA8ULCGmWQJlBgqvO3EJeAngOHD8zQCrQ== +type-fest@2.11.2: + version "2.11.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.11.2.tgz#5534a919858bc517492cd3a53a673835a76d2e71" + integrity sha512-reW2Y2Mpn0QNA/5fvtm5doROLwDPu2zOm5RtY7xQQS05Q7xgC8MOZ3yPNaP9m/s/sNjjFQtHo7VCNqYW2iI+Ig== vite@^2.6.4: version "2.6.14" diff --git a/tooling/api/src/http.ts b/tooling/api/src/http.ts index 7b4d0ee2d..a1d30ed5c 100644 --- a/tooling/api/src/http.ts +++ b/tooling/api/src/http.ts @@ -56,7 +56,13 @@ enum ResponseType { Binary = 3 } -type Part = string | Uint8Array +interface FilePart { + value: string | T + mime?: string + fileName?: string +} + +type Part = string | Uint8Array | FilePart /** The body object to be used on POST and PUT requests. */ class Body { @@ -70,19 +76,49 @@ class Body { } /** - * Creates a new form data body. + * Creates a new form data body. The form data is an object where each key is the entry name, + * and the value is either a string or a file object. + * + * By default it sets the `application/x-www-form-urlencoded` Content-Type header, + * but you can set it to `multipart/form-data` if the Cargo feature `http-multipart` is enabled. + * + * Note that a file path must be allowed in the `fs` allowlist scope. + * + * # Examples + * + * ```js + * import { Body } from "@tauri-apps/api/http" + * Body.form({ + * key: 'value', + * image: { + * file: '/path/to/file', // either a path of an array buffer of the file contents + * mime: 'image/jpeg', // optional + * fileName: 'image.jpg' // optional + * } + * }) + * ``` * * @param data The body data. * * @return The body object ready to be used on the POST and PUT requests. */ static form(data: Record): Body { - const form: Record = {} + const form: Record> = {} for (const key in data) { // eslint-disable-next-line security/detect-object-injection const v = data[key] + let r + if (typeof v === 'string') { + r = v + } else if (v instanceof Uint8Array || Array.isArray(v)) { + r = Array.from(v) + } else if (typeof v.value === 'string') { + r = { value: v.value, mime: v.mime, fileName: v.fileName } + } else { + r = { value: Array.from(v.value), mime: v.mime, fileName: v.fileName } + } // eslint-disable-next-line security/detect-object-injection - form[key] = typeof v === 'string' ? v : Array.from(v) + form[key] = r } return new Body('Form', form) }