diff --git a/.changes/app-dirs-api.md b/.changes/app-dirs-api.md new file mode 100644 index 00000000000..eb1d50fd708 --- /dev/null +++ b/.changes/app-dirs-api.md @@ -0,0 +1,6 @@ +--- +"tauri": minor +"api": minor +--- + +Add new app-specific `BaseDirectory` enum variants `AppConfig`, `AppData`, `AppLocalData`, `AppCache` and `AppLog` along with equivalent functions in `path` module and deprecated ambiguous variants `Log` and `App` along with their equivalent functions in `path` module. diff --git a/core/tauri-utils/src/config.rs b/core/tauri-utils/src/config.rs index acd4edce772..9fb28bd5d35 100644 --- a/core/tauri-utils/src/config.rs +++ b/core/tauri-utils/src/config.rs @@ -1129,7 +1129,8 @@ macro_rules! check_feature { /// Each pattern can start with a variable that resolves to a system base directory. /// The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, /// `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, -/// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`. +/// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, +/// `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`. #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(untagged)] @@ -1465,7 +1466,8 @@ pub struct ShellAllowedCommand { /// It can start with a variable that resolves to a system base directory. /// The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, /// `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, - /// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`. + /// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, + /// `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`. #[serde(rename = "cmd", default)] // use default just so the schema doesn't flag it as required pub command: PathBuf, diff --git a/core/tauri/scripts/bundle.js b/core/tauri/scripts/bundle.js index e0f576b456d..f788970df84 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?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(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.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(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;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),p}},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;R(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:x(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;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),m}},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:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},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,"_".concat(i))}),!0),i=a((function(e){n(e),Reflect.deleteProperty(window,"_".concat(o))}),!0);window.__TAURI_IPC__(_objectSpread({cmd:t,callback:o,error:i},r))})));case 2:case"end":return e.stop()}}),e)}))),i.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 d(){return(d=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Cli",message:{cmd:"cliMatches"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var m=Object.freeze({__proto__:null,getMatches:function(){return d.apply(this,arguments)}});function _(){return(_=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"writeText",data:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function y(){return(y=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"readText",data:null}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var g=Object.freeze({__proto__:null,writeText:function(e){return _.apply(this,arguments)},readText:function(){return y.apply(this,arguments)}});function v(e){for(var t=void 0,r=e[0],n=1;n0&&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)}))),w.apply(this,arguments)}function b(){return b=_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)}))),b.apply(this,arguments)}function R(){return R=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:t.toString(),title:v([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:v([n,"optionalAccess",function(e){return e.type}])}}));case 2:case"end":return e.stop()}}),e)}))),R.apply(this,arguments)}function k(){return k=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"askDialog",message:t.toString(),title:v([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:v([n,"optionalAccess",function(e){return e.type}])}}));case 2:case"end":return e.stop()}}),e)}))),k.apply(this,arguments)}function x(){return x=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"confirmDialog",message:t.toString(),title:v([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:v([n,"optionalAccess",function(e){return e.type}])}}));case 2:case"end":return e.stop()}}),e)}))),x.apply(this,arguments)}var T,G=Object.freeze({__proto__:null,open:function(){return w.apply(this,arguments)},save:function(){return b.apply(this,arguments)},message:function(e,t){return R.apply(this,arguments)},ask:function(e,t){return k.apply(this,arguments)},confirm:function(e,t){return x.apply(this,arguments)}});function P(e,t){return O.apply(this,arguments)}function O(){return 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",s({__tauriModule:"Event",message:{cmd:"unlisten",event:t,eventId:r}}));case 1:case"end":return e.stop()}}),e)}))),O.apply(this,arguments)}function M(e,t,r){return E.apply(this,arguments)}function E(){return E=_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)}))),E.apply(this,arguments)}function A(e,t,r){return L.apply(this,arguments)}function L(){return L=_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",P(t,e));case 1:case"end":return r.stop()}}),r)})))})));case 1:case"end":return e.stop()}}),e)}))),L.apply(this,arguments)}function D(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",A(t,r,(function(e){n(e),P(t,e.id).catch((function(){}))})));case 1:case"end":return e.stop()}}),e)}))),C.apply(this,arguments)}function S(e,t){return j.apply(this,arguments)}function j(){return j=_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)}))),j.apply(this,arguments)}function W(e,t){return N.apply(this,arguments)}function N(){return N=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",D(t,null,r));case 1:case"end":return e.stop()}}),e)}))),N.apply(this,arguments)}function I(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",M(t,void 0,r));case 1:case"end":return e.stop()}}),e)}))),z.apply(this,arguments)}!function(e){e.WINDOW_RESIZED="tauri://resize";e.WINDOW_MOVED="tauri://move";e.WINDOW_CLOSE_REQUESTED="tauri://close-requested";e.WINDOW_CREATED="tauri://window-created";e.WINDOW_DESTROYED="tauri://destroyed";e.WINDOW_FOCUS="tauri://focus";e.WINDOW_BLUR="tauri://blur";e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change";e.WINDOW_THEME_CHANGED="tauri://theme-changed";e.WINDOW_FILE_DROP="tauri://file-drop";e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover";e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled";e.MENU="tauri://menu";e.CHECK_UPDATE="tauri://update";e.UPDATE_AVAILABLE="tauri://update-available";e.INSTALL_UPDATE="tauri://update-install";e.STATUS_UPDATE="tauri://update-status";e.DOWNLOAD_PROGRESS="tauri://update-download-progress"}(T||(T={}));var F,U=Object.freeze({__proto__:null,get TauriEvent(){return T},listen:S,once:W,emit:I});function H(e,t){return null!=e?e:t()}function V(){return V=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readTextFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)}))),V.apply(this,arguments)}function B(){return B=_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)}))),B.apply(this,arguments)}function q(e,t,r){return J.apply(this,arguments)}function J(){return J=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(n)&&Object.freeze(n),"object"===_typeof(t)&&Object.freeze(t),a={path:"",contents:""},o=n,"string"==typeof t?a.path=t:(a.path=t.path,a.contents=t.contents),"string"==typeof r?a.contents=H(r,(function(){return""})):o=r,e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:a.path,contents:Array.from((new TextEncoder).encode(a.contents)),options:o}}));case 7:case"end":return e.stop()}}),e)}))),J.apply(this,arguments)}function K(){return K=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(n)&&Object.freeze(n),"object"===_typeof(t)&&Object.freeze(t),a={path:"",contents:[]},o=n,"string"==typeof t?a.path=t:(a.path=t.path,a.contents=t.contents),r&&"dir"in r?o=r:"string"==typeof t&&(a.contents=H(r,(function(){return[]}))),e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:a.path,contents:Array.from(a.contents instanceof ArrayBuffer?new Uint8Array(a.contents):a.contents),options:o}}));case 7:case"end":return e.stop()}}),e)}))),K.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:"readDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)}))),Y.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:"createDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)}))),Q.apply(this,arguments)}function Z(){return Z=_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)}))),Z.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:"copyFile",source:t,destination:r,options:n}}));case 2:case"end":return e.stop()}}),e)}))),$.apply(this,arguments)}function X(){return X=_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)}))),X.apply(this,arguments)}function ee(){return ee=_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)}))),ee.apply(this,arguments)}function te(){return te=_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:"exists",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)}))),te.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 re=Object.freeze({__proto__:null,get BaseDirectory(){return F},get Dir(){return F},readTextFile:function(e){return V.apply(this,arguments)},readBinaryFile:function(e){return B.apply(this,arguments)},writeTextFile:q,writeFile:q,writeBinaryFile:function(e,t,r){return K.apply(this,arguments)},readDir:function(e){return Y.apply(this,arguments)},createDir:function(e){return Q.apply(this,arguments)},removeDir:function(e){return Z.apply(this,arguments)},copyFile:function(e,t){return $.apply(this,arguments)},removeFile:function(e){return X.apply(this,arguments)},renameFile:function(e,t){return ee.apply(this,arguments)},exists:function(e){return te.apply(this,arguments)}});function ne(){return(ne=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.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 ae(){return(ae=_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 oe(){return(oe=_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 ie(){return(ie=_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 ue(){return(ue=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var se,ce=Object.freeze({__proto__:null,register:function(e,t){return ne.apply(this,arguments)},registerAll:function(e,t){return ae.apply(this,arguments)},isRegistered:function(e){return oe.apply(this,arguments)},unregister:function(e){return ie.apply(this,arguments)},unregisterAll:function(){return ue.apply(this,arguments)}});function pe(e,t){return null!=e?e:t()}function le(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})),de=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===se.JSON)&&(t.responseType=se.Text),e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:t}}).then((function(e){var t=new he(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 me(e){return _e.apply(this,arguments)}function _e(){return(_e=_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 de(e)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ye=null;function ge(){return(ge=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==ye){e.next=4;break}return e.next=3,me();case 3:ye=e.sent;case 4:return e.abrupt("return",ye.request(_objectSpread({url:t,method:pe(le([r,"optionalAccess",function(e){return e.method}]),(function(){return"GET"}))},r)));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ve=Object.freeze({__proto__:null,getClient:me,fetch:function(e,t){return ge.apply(this,arguments)},Body:fe,Client:de,Response:he,get ResponseType(){return se}});function we(){return(we=_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 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",window.Notification.requestPermission());case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Re=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return be.apply(this,arguments)},isPermissionGranted:function(){return we.apply(this,arguments)}});function ke(){return navigator.appVersion.includes("Win")}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.App}}));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.Audio}}));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.Cache}}));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.Config}}));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.Data}}));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.Desktop}}));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.Document}}));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.Download}}));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.Executable}}));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.Font}}));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.Home}}));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.LocalData}}));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.Picture}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}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.Public}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ne(){return(Ne=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Resource}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ie(){return(Ie=_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:"Path",message:{cmd:"resolvePath",path:t,directory:F.Resource}}));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.Runtime}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fe(){return(Fe=_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 Ue(){return(Ue=_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 He(){return(He=_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 Ve=ke()?"\\":"/",Be=ke()?";":":";function qe(){return qe=_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)}))),et.apply(this,arguments)}function tt(){return(tt=_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 rt=Object.freeze({__proto__:null,exit:function(){return et.apply(this,arguments)},relaunch:function(){return tt.apply(this,arguments)}});function nt(e,t){return null!=e?e:t()}function at(e,t){return ot.apply(this,arguments)}function ot(){return ot=_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)}))),ot.apply(this,arguments)}var it=function(){function e(){_classCallCheck(this,e),e.prototype.__init.call(this)}return _createClass(e,[{key:"__init",value:function(){this.eventListeners=Object.create(null)}},{key:"addListener",value:function(e,t){return this.on(e,t)}},{key:"removeListener",value:function(e,t){return this.off(e,t)}},{key:"on",value:function(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}},{key:"once",value:function(e,t){var r=this;return this.addListener(e,(function n(){r.removeListener(e,n),t.apply(void 0,arguments)}))}},{key:"off",value:function(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter((function(e){return e!==t}))),this}},{key:"removeAllListeners",value:function(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}},{key:"emit",value:function(e){if(e in this.eventListeners){for(var t=this.eventListeners[e],r=arguments.length,n=new Array(r>1?r-1:0),a=1;a1&&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=nt(o,(function(){return{}})),t}return _createClass(a,[{key:"__init2",value:function(){this.stdout=new it}},{key:"__init3",value:function(){this.stderr=new it}},{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",at((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 ut(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}(it);function ct(){return ct=_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)}))),ct.apply(this,arguments)}var pt=Object.freeze({__proto__:null,Command:st,Child:ut,EventEmitter:it,open:function(e,t){return ct.apply(this,arguments)}});function lt(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),yt([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 kt().some((function(t){return t.label===e}))?new r(e,{skip:!0}):null}}]),r}(Pt);function Et(){return(Et=_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 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:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lt(){return(Lt=_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?xt=new Mt(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.'),xt=new Mt("main",{skip:!0}));var Dt=Object.freeze({__proto__:null,WebviewWindow:Mt,WebviewWindowHandle:Gt,WindowManager:Pt,CloseRequestedEvent:Ot,getCurrent:function(){return new Mt(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})},getAll:kt,get appWindow(){return xt},LogicalSize:vt,PhysicalSize:wt,LogicalPosition:bt,PhysicalPosition:Rt,get UserAttentionType(){return gt},currentMonitor:function(){return Et.apply(this,arguments)},primaryMonitor:function(){return At.apply(this,arguments)},availableMonitors:function(){return Lt.apply(this,arguments)}}),Ct=ke()?"\r\n":"\n";function St(){return(St=_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 jt(){return(jt=_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 Wt(){return(Wt=_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 Nt(){return(Nt=_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 It(){return(It=_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 zt=Object.freeze({__proto__:null,EOL:Ct,platform:function(){return St.apply(this,arguments)},version:function(){return jt.apply(this,arguments)},type:function(){return Wt.apply(this,arguments)},arch:function(){return Nt.apply(this,arguments)},tempdir:function(){return It.apply(this,arguments)}}),Ft=o;e.app=h,e.cli=m,e.clipboard=g,e.dialog=G,e.event=U,e.fs=re,e.globalShortcut=ce,e.http=ve,e.invoke=Ft,e.notification=Re,e.os=zt,e.path=Xe,e.process=rt,e.shell=pt,e.tauri=u,e.updater=_t,e.window=Dt,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?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(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.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(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;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),p}},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;R(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:x(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;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:A(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,"_".concat(i))}),!0),i=a((function(e){n(e),Reflect.deleteProperty(window,"_".concat(o))}),!0);window.__TAURI_IPC__(_objectSpread({cmd:t,callback:o,error:i},r))})));case 2:case"end":return e.stop()}}),e)}))),i.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 _(){return(_=_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 y(){return(y=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"readText",data:null}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var g=Object.freeze({__proto__:null,writeText:function(e){return _.apply(this,arguments)},readText:function(){return y.apply(this,arguments)}});function v(e){for(var t=void 0,r=e[0],n=1;n0&&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)}))),w.apply(this,arguments)}function b(){return b=_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)}))),b.apply(this,arguments)}function R(){return R=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:t.toString(),title:v([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:v([n,"optionalAccess",function(e){return e.type}])}}));case 2:case"end":return e.stop()}}),e)}))),R.apply(this,arguments)}function k(){return k=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"askDialog",message:t.toString(),title:v([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:v([n,"optionalAccess",function(e){return e.type}])}}));case 2:case"end":return e.stop()}}),e)}))),k.apply(this,arguments)}function x(){return x=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"confirmDialog",message:t.toString(),title:v([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:v([n,"optionalAccess",function(e){return e.type}])}}));case 2:case"end":return e.stop()}}),e)}))),x.apply(this,arguments)}var T,G=Object.freeze({__proto__:null,open:function(){return w.apply(this,arguments)},save:function(){return b.apply(this,arguments)},message:function(e,t){return R.apply(this,arguments)},ask:function(e,t){return k.apply(this,arguments)},confirm:function(e,t){return x.apply(this,arguments)}});function P(e,t){return O.apply(this,arguments)}function O(){return 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",s({__tauriModule:"Event",message:{cmd:"unlisten",event:t,eventId:r}}));case 1:case"end":return e.stop()}}),e)}))),O.apply(this,arguments)}function A(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)}))),M.apply(this,arguments)}function D(e,t,r){return L.apply(this,arguments)}function L(){return L=_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",P(t,e));case 1:case"end":return r.stop()}}),r)})))})));case 1:case"end":return e.stop()}}),e)}))),L.apply(this,arguments)}function E(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",D(t,r,(function(e){n(e),P(t,e.id).catch((function(){}))})));case 1:case"end":return e.stop()}}),e)}))),C.apply(this,arguments)}function S(e,t){return j.apply(this,arguments)}function j(){return j=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",D(t,null,r));case 1:case"end":return e.stop()}}),e)}))),j.apply(this,arguments)}function W(e,t){return N.apply(this,arguments)}function N(){return N=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",E(t,null,r));case 1:case"end":return e.stop()}}),e)}))),N.apply(this,arguments)}function I(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,void 0,r));case 1:case"end":return e.stop()}}),e)}))),z.apply(this,arguments)}!function(e){e.WINDOW_RESIZED="tauri://resize";e.WINDOW_MOVED="tauri://move";e.WINDOW_CLOSE_REQUESTED="tauri://close-requested";e.WINDOW_CREATED="tauri://window-created";e.WINDOW_DESTROYED="tauri://destroyed";e.WINDOW_FOCUS="tauri://focus";e.WINDOW_BLUR="tauri://blur";e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change";e.WINDOW_THEME_CHANGED="tauri://theme-changed";e.WINDOW_FILE_DROP="tauri://file-drop";e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover";e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled";e.MENU="tauri://menu";e.CHECK_UPDATE="tauri://update";e.UPDATE_AVAILABLE="tauri://update-available";e.INSTALL_UPDATE="tauri://update-install";e.STATUS_UPDATE="tauri://update-status";e.DOWNLOAD_PROGRESS="tauri://update-download-progress"}(T||(T={}));var F,U=Object.freeze({__proto__:null,get TauriEvent(){return T},listen:S,once:W,emit:I});function H(e,t){return null!=e?e:t()}function V(){return V=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readTextFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)}))),V.apply(this,arguments)}function B(){return B=_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)}))),B.apply(this,arguments)}function q(e,t,r){return J.apply(this,arguments)}function J(){return J=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(n)&&Object.freeze(n),"object"===_typeof(t)&&Object.freeze(t),a={path:"",contents:""},o=n,"string"==typeof t?a.path=t:(a.path=t.path,a.contents=t.contents),"string"==typeof r?a.contents=H(r,(function(){return""})):o=r,e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:a.path,contents:Array.from((new TextEncoder).encode(a.contents)),options:o}}));case 7:case"end":return e.stop()}}),e)}))),J.apply(this,arguments)}function K(){return K=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(n)&&Object.freeze(n),"object"===_typeof(t)&&Object.freeze(t),a={path:"",contents:[]},o=n,"string"==typeof t?a.path=t:(a.path=t.path,a.contents=t.contents),r&&"dir"in r?o=r:"string"==typeof t&&(a.contents=H(r,(function(){return[]}))),e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:a.path,contents:Array.from(a.contents instanceof ArrayBuffer?new Uint8Array(a.contents):a.contents),options:o}}));case 7:case"end":return e.stop()}}),e)}))),K.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:"readDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)}))),Y.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:"createDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)}))),Q.apply(this,arguments)}function Z(){return Z=_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)}))),Z.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:"copyFile",source:t,destination:r,options:n}}));case 2:case"end":return e.stop()}}),e)}))),$.apply(this,arguments)}function X(){return X=_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)}))),X.apply(this,arguments)}function ee(){return ee=_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)}))),ee.apply(this,arguments)}function te(){return te=_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:"exists",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)}))),te.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";e[e.AppConfig=21]="AppConfig";e[e.AppData=22]="AppData";e[e.AppLocalData=23]="AppLocalData";e[e.AppCache=24]="AppCache";e[e.AppLog=25]="AppLog"}(F||(F={}));var re=Object.freeze({__proto__:null,get BaseDirectory(){return F},get Dir(){return F},readTextFile:function(e){return V.apply(this,arguments)},readBinaryFile:function(e){return B.apply(this,arguments)},writeTextFile:q,writeFile:q,writeBinaryFile:function(e,t,r){return K.apply(this,arguments)},readDir:function(e){return Y.apply(this,arguments)},createDir:function(e){return Q.apply(this,arguments)},removeDir:function(e){return Z.apply(this,arguments)},copyFile:function(e,t){return $.apply(this,arguments)},removeFile:function(e){return X.apply(this,arguments)},renameFile:function(e,t){return ee.apply(this,arguments)},exists:function(e){return te.apply(this,arguments)}});function ne(){return(ne=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.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 ae(){return(ae=_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 oe(){return(oe=_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 ie(){return(ie=_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 ue(){return(ue=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var se,ce=Object.freeze({__proto__:null,register:function(e,t){return ne.apply(this,arguments)},registerAll:function(e,t){return ae.apply(this,arguments)},isRegistered:function(e){return oe.apply(this,arguments)},unregister:function(e){return ie.apply(this,arguments)},unregisterAll:function(){return ue.apply(this,arguments)}});function pe(e,t){return null!=e?e:t()}function le(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})),me=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===se.JSON)&&(t.responseType=se.Text),e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:t}}).then((function(e){var t=new he(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 de(e){return _e.apply(this,arguments)}function _e(){return(_e=_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 me(e)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ye=null;function ge(){return(ge=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==ye){e.next=4;break}return e.next=3,de();case 3:ye=e.sent;case 4:return e.abrupt("return",ye.request(_objectSpread({url:t,method:pe(le([r,"optionalAccess",function(e){return e.method}]),(function(){return"GET"}))},r)));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ve=Object.freeze({__proto__:null,getClient:de,fetch:function(e,t){return ge.apply(this,arguments)},Body:fe,Client:me,Response:he,get ResponseType(){return se}});function we(){return(we=_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 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",window.Notification.requestPermission());case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Re=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return be.apply(this,arguments)},isPermissionGranted:function(){return we.apply(this,arguments)}});function ke(){return navigator.appVersion.includes("Win")}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",Te());case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Te(){return Ge.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.AppConfig}}));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.AppData}}));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.AppLocalData}}));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.AppCache}}));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.Audio}}));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.Cache}}));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.Config}}));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.Data}}));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.Desktop}}));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.Document}}));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.Download}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}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.Executable}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ne(){return(Ne=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:F.Font}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ie(){return(Ie=_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 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.LocalData}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fe(){return(Fe=_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 Ue(){return(Ue=_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 He(){return(He=_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 Ve(){return(Ve=_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:"Path",message:{cmd:"resolvePath",path:t,directory:F.Resource}}));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.Runtime}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qe(){return(qe=_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 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.Video}}));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",Ye());case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ye(){return Qe.apply(this,arguments)}function Qe(){return(Qe=_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.AppLog}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ze=ke()?"\\":"/",$e=ke()?";":":";function Xe(){return Xe=_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)}))),ut.apply(this,arguments)}function st(){return(st=_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 ct=Object.freeze({__proto__:null,exit:function(){return ut.apply(this,arguments)},relaunch:function(){return st.apply(this,arguments)}});function pt(e,t){return null!=e?e:t()}function lt(e,t){return ft.apply(this,arguments)}function ft(){return ft=_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)}))),ft.apply(this,arguments)}var ht=function(){function e(){_classCallCheck(this,e),e.prototype.__init.call(this)}return _createClass(e,[{key:"__init",value:function(){this.eventListeners=Object.create(null)}},{key:"addListener",value:function(e,t){return this.on(e,t)}},{key:"removeListener",value:function(e,t){return this.off(e,t)}},{key:"on",value:function(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}},{key:"once",value:function(e,t){var r=this;return this.addListener(e,(function n(){r.removeListener(e,n),t.apply(void 0,arguments)}))}},{key:"off",value:function(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter((function(e){return e!==t}))),this}},{key:"removeAllListeners",value:function(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}},{key:"emit",value:function(e){if(e in this.eventListeners){for(var t=this.eventListeners[e],r=arguments.length,n=new Array(r>1?r-1:0),a=1;a1&&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=pt(o,(function(){return{}})),t}return _createClass(a,[{key:"__init2",value:function(){this.stdout=new ht}},{key:"__init3",value:function(){this.stderr=new ht}},{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",lt((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 mt(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}(ht);function _t(){return _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",s({__tauriModule:"Shell",message:{cmd:"open",path:t,with:r}}));case 1:case"end":return e.stop()}}),e)}))),_t.apply(this,arguments)}var yt=Object.freeze({__proto__:null,Command:dt,Child:mt,EventEmitter:ht,open:function(e,t){return _t.apply(this,arguments)}});function gt(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),xt([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 Mt().some((function(t){return t.label===e}))?new r(e,{skip:!0}):null}}]),r}(Ct);function Wt(){return(Wt=_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 Nt(){return(Nt=_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 It(){return(It=_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?Dt=new jt(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.'),Dt=new jt("main",{skip:!0}));var zt=Object.freeze({__proto__:null,WebviewWindow:jt,WebviewWindowHandle:Et,WindowManager:Ct,CloseRequestedEvent:St,getCurrent:function(){return new jt(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})},getAll:Mt,get appWindow(){return Dt},LogicalSize:Gt,PhysicalSize:Pt,LogicalPosition:Ot,PhysicalPosition:At,get UserAttentionType(){return Tt},currentMonitor:function(){return Wt.apply(this,arguments)},primaryMonitor:function(){return Nt.apply(this,arguments)},availableMonitors:function(){return It.apply(this,arguments)}}),Ft=ke()?"\r\n":"\n";function Ut(){return(Ut=_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 Ht(){return(Ht=_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 Vt(){return(Vt=_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 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:"Os",message:{cmd:"arch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qt(){return(qt=_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 Jt=Object.freeze({__proto__:null,EOL:Ft,platform:function(){return Ut.apply(this,arguments)},version:function(){return Ht.apply(this,arguments)},type:function(){return Vt.apply(this,arguments)},arch:function(){return Bt.apply(this,arguments)},tempdir:function(){return qt.apply(this,arguments)}}),Kt=o;e.app=h,e.cli=d,e.clipboard=g,e.dialog=G,e.event=U,e.fs=re,e.globalShortcut=ce,e.http=ve,e.invoke=Kt,e.notification=Re,e.os=Jt,e.path=it,e.process=ct,e.shell=yt,e.tauri=u,e.updater=kt,e.window=zt,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/core/tauri/src/api/path.rs b/core/tauri/src/api/path.rs index fc744ba54d9..dc73389da91 100644 --- a/core/tauri/src/api/path.rs +++ b/core/tauri/src/api/path.rs @@ -13,61 +13,94 @@ use crate::{Config, Env, PackageInfo}; use serde_repr::{Deserialize_repr, Serialize_repr}; -/// A base directory to be used in [`resolve_path`]. -/// -/// The base directory is the optional root of a file system operation. -/// If informed by the API call, all paths will be relative to the path of the given directory. -/// -/// For more information, check the [`dirs_next` documentation](https://docs.rs/dirs_next/). -#[derive(Serialize_repr, Deserialize_repr, Clone, Copy, Debug)] -#[repr(u16)] -#[non_exhaustive] -pub enum BaseDirectory { - /// The Audio directory. - Audio = 1, - /// The Cache directory. - Cache, - /// The Config directory. - Config, - /// The Data directory. - Data, - /// The LocalData directory. - LocalData, - /// The Desktop directory. - Desktop, - /// The Document directory. - Document, - /// The Download directory. - Download, - /// The Executable directory. - Executable, - /// The Font directory. - Font, - /// The Home directory. - Home, - /// The Picture directory. - Picture, - /// The Public directory. - Public, - /// The Runtime directory. - Runtime, - /// The Template directory. - Template, - /// The Video directory. - Video, - /// The Resource directory. - Resource, - /// The default App config directory. - /// Resolves to [`BaseDirectory::Config`]. - App, - /// The Log directory. - /// Resolves to `BaseDirectory::Home/Library/Logs/{bundle_identifier}` on macOS - /// and `BaseDirectory::Config/{bundle_identifier}/logs` on linux and windows. - Log, - /// A temporary directory. - /// Resolves to [`temp_dir`]. - Temp, +// we have to wrap the BaseDirectory enum in a module for #[allow(deprecated)] +// to work, because the procedural macros on the enum prevent it from working directly +// TODO: remove this workaround in v2 along with deprecated variants +#[allow(deprecated)] +mod base_directory { + use super::*; + + /// A base directory to be used in [`resolve_path`]. + /// + /// The base directory is the optional root of a file system operation. + /// If informed by the API call, all paths will be relative to the path of the given directory. + /// + /// For more information, check the [`dirs_next` documentation](https://docs.rs/dirs_next/). + #[derive(Serialize_repr, Deserialize_repr, Clone, Copy, Debug)] + #[repr(u16)] + #[non_exhaustive] + pub enum BaseDirectory { + /// The Audio directory. + Audio = 1, + /// The Cache directory. + Cache, + /// The Config directory. + Config, + /// The Data directory. + Data, + /// The LocalData directory. + LocalData, + /// The Desktop directory. + Desktop, + /// The Document directory. + Document, + /// The Download directory. + Download, + /// The Executable directory. + Executable, + /// The Font directory. + Font, + /// The Home directory. + Home, + /// The Picture directory. + Picture, + /// The Public directory. + Public, + /// The Runtime directory. + Runtime, + /// The Template directory. + Template, + /// The Video directory. + Video, + /// The Resource directory. + Resource, + /// The default app config directory. + /// Resolves to [`BaseDirectory::Config`]`/{bundle_identifier}`. + #[deprecated( + since = "1.2.0", + note = "Will be removed in 2.0.0. Use `BaseDirectory::AppConfig` or BaseDirectory::AppData` instead." + )] + App, + /// The default app log directory. + /// Resolves to [`BaseDirectory::Home`]`/Library/Logs/{bundle_identifier}` on macOS + /// and [`BaseDirectory::Config`]`/{bundle_identifier}/logs` on linux and Windows. + #[deprecated( + since = "1.2.0", + note = "Will be removed in 2.0.0. Use `BaseDirectory::AppLog` instead." + )] + Log, + /// A temporary directory. + /// Resolves to [`temp_dir`]. + Temp, + /// The default app config directory. + /// Resolves to [`BaseDirectory::Config`]`/{bundle_identifier}`. + AppConfig, + /// The default app data directory. + /// Resolves to [`BaseDirectory::Data`]`/{bundle_identifier}`. + AppData, + /// The default app local data directory. + /// Resolves to [`BaseDirectory::LocalData`]`/{bundle_identifier}`. + AppLocalData, + /// The default app cache directory. + /// Resolves to [`BaseDirectory::Cache`]`/{bundle_identifier}`. + AppCache, + /// The default app log directory. + /// Resolves to [`BaseDirectory::Home`]`/Library/Logs/{bundle_identifier}` on macOS + /// and [`BaseDirectory::Config`]`/{bundle_identifier}/logs` on linux and Windows. + AppLog, + } } +pub use base_directory::BaseDirectory; impl BaseDirectory { /// Gets the variable that represents this [`BaseDirectory`] for string paths. @@ -90,9 +123,16 @@ impl BaseDirectory { Self::Template => "$TEMPLATE", Self::Video => "$VIDEO", Self::Resource => "$RESOURCE", + #[allow(deprecated)] Self::App => "$APP", + #[allow(deprecated)] Self::Log => "$LOG", Self::Temp => "$TEMP", + Self::AppConfig => "$APPCONFIG", + Self::AppData => "$APPDATA", + Self::AppLocalData => "$APPLOCALDATA", + Self::AppCache => "$APPCACHE", + Self::AppLog => "$APPLOG", } } @@ -116,9 +156,16 @@ impl BaseDirectory { "$TEMPLATE" => Self::Template, "$VIDEO" => Self::Video, "$RESOURCE" => Self::Resource, + #[allow(deprecated)] "$APP" => Self::App, + #[allow(deprecated)] "$LOG" => Self::Log, "$TEMP" => Self::Temp, + "$APPCONFIG" => Self::AppConfig, + "$APPDATA" => Self::AppData, + "$APPLOCALDATA" => Self::AppLocalData, + "$APPCACHE" => Self::AppCache, + "$APPLOG" => Self::AppLog, _ => return None, }; Some(res) @@ -192,7 +239,7 @@ pub fn parse>( /// context.package_info(), /// &Env::default(), /// "db/tauri.sqlite", -/// Some(BaseDirectory::App)) +/// Some(BaseDirectory::AppData)) /// .expect("failed to resolve path"); /// assert_eq!(path.to_str().unwrap(), "/home/${whoami}/.config/com.tauri.app/db/tauri.sqlite"); /// @@ -242,9 +289,16 @@ pub fn resolve_path>( BaseDirectory::Template => template_dir(), BaseDirectory::Video => video_dir(), BaseDirectory::Resource => resource_dir(package_info, env), - BaseDirectory::App => app_dir(config), - BaseDirectory::Log => log_dir(config), + #[allow(deprecated)] + BaseDirectory::App => app_config_dir(config), + #[allow(deprecated)] + BaseDirectory::Log => app_log_dir(config), BaseDirectory::Temp => Some(temp_dir()), + BaseDirectory::AppConfig => app_config_dir(config), + BaseDirectory::AppData => app_data_dir(config), + BaseDirectory::AppLocalData => app_local_data_dir(config), + BaseDirectory::AppCache => app_cache_dir(config), + BaseDirectory::AppLog => app_log_dir(config), }; if let Some(mut base_dir_path_value) = base_dir_path { // use the same path resolution mechanism as the bundler's resource injection algorithm @@ -459,25 +513,52 @@ pub fn resource_dir(package_info: &PackageInfo, env: &Env) -> Option { crate::utils::platform::resource_dir(package_info, env).ok() } -/// Returns the path to the suggested directory for your app config files. +/// Returns the path to the suggested directory for your app's config files. /// -/// Resolves to `${config_dir}/${bundle_identifier}`. +/// Resolves to [`config_dir`]`/${bundle_identifier}`. /// -/// See [`PathResolver::app_dir`](crate::PathResolver#method.app_dir) for a more convenient helper function. -pub fn app_dir(config: &Config) -> Option { +/// See [`PathResolver::app_config_dir`](crate::PathResolver#method.app_config_dir) for a more convenient helper function. +pub fn app_config_dir(config: &Config) -> Option { dirs_next::config_dir().map(|dir| dir.join(&config.tauri.bundle.identifier)) } -/// Returns the path to the suggested log directory. +/// Returns the path to the suggested directory for your app's data files. +/// +/// Resolves to [`data_dir`]`/${bundle_identifier}`. +/// +/// See [`PathResolver::app_data_dir`](crate::PathResolver#method.app_data_dir) for a more convenient helper function. +pub fn app_data_dir(config: &Config) -> Option { + dirs_next::data_dir().map(|dir| dir.join(&config.tauri.bundle.identifier)) +} + +/// Returns the path to the suggested directory for your app's local data files. +/// +/// Resolves to [`local_data_dir`]`/${bundle_identifier}`. +/// +/// See [`PathResolver::app_data_dir`](crate::PathResolver#method.app_data_dir) for a more convenient helper function. +pub fn app_local_data_dir(config: &Config) -> Option { + dirs_next::data_local_dir().map(|dir| dir.join(&config.tauri.bundle.identifier)) +} + +/// Returns the path to the suggested directory for your app's cache files. +/// +/// Resolves to [`cache_dir`]`/${bundle_identifier}`. +/// +/// See [`PathResolver::app_cache_dir`](crate::PathResolver#method.app_cache_dir) for a more convenient helper function. +pub fn app_cache_dir(config: &Config) -> Option { + dirs_next::cache_dir().map(|dir| dir.join(&config.tauri.bundle.identifier)) +} + +/// Returns the path to the suggested directory for your app's log files. /// /// ## Platform-specific /// -/// - **Linux:** Resolves to `${config_dir}/${bundle_identifier}/logs`. -/// - **macOS:** Resolves to `${home_dir}//Library/Logs/{bundle_identifier}` -/// - **Windows:** Resolves to `${config_dir}/${bundle_identifier}/logs`. +/// - **Linux:** Resolves to [`config_dir`]`/${bundle_identifier}/logs`. +/// - **macOS:** Resolves to [`home_dir`]`/Library/Logs/${bundle_identifier}` +/// - **Windows:** Resolves to [`config_dir`]`/${bundle_identifier}/logs`. /// -/// See [`PathResolver::log_dir`](crate::PathResolver#method.log_dir) for a more convenient helper function. -pub fn log_dir(config: &Config) -> Option { +/// See [`PathResolver::app_log_dir`](crate::PathResolver#method.app_log_dir) for a more convenient helper function. +pub fn app_log_dir(config: &Config) -> Option { #[cfg(target_os = "macos")] let path = dirs_next::home_dir().map(|dir| { dir @@ -491,3 +572,33 @@ pub fn log_dir(config: &Config) -> Option { path } + +/// Returns the path to the suggested directory for your app's config files. +/// +/// Resolves to [`config_dir`]`/${bundle_identifier}`. +/// +/// See [`PathResolver::app_config_dir`](crate::PathResolver#method.app_config_dir) for a more convenient helper function. +#[deprecated( + since = "1.2.0", + note = "Will be removed in 2.0.0. Use `app_config_dir` or `app_data_dir` instead." +)] +pub fn app_dir(config: &Config) -> Option { + app_config_dir(config) +} + +/// Returns the path to the suggested directory for your app's log files. +/// +/// ## Platform-specific +/// +/// - **Linux:** Resolves to [`config_dir`]`/${bundle_identifier}`. +/// - **macOS:** Resolves to [`home_dir`]`/Library/Logs/${bundle_identifier}` +/// - **Windows:** Resolves to [`config_dir`]`/${bundle_identifier}`. +/// +/// See [`PathResolver::app_log_dir`](crate::PathResolver#method.app_log_dir) for a more convenient helper function. +#[deprecated( + since = "1.2.0", + note = "Will be removed in 2.0.0. Use `app_log_dir` instead." +)] +pub fn log_dir(config: &Config) -> Option { + app_log_dir(config) +} diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 0cb8bc362d1..c19a6b50549 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -288,14 +288,47 @@ impl PathResolver { .map(|dir| dir.join(resource_relpath(path.as_ref()))) } - /// Returns the path to the suggested directory for your app config files. + /// Returns the path to the suggested directory for your app's config files. + pub fn app_config_dir(&self) -> Option { + crate::api::path::app_config_dir(&self.config) + } + + /// Returns the path to the suggested directory for your app's data files. + pub fn app_data_dir(&self) -> Option { + crate::api::path::app_data_dir(&self.config) + } + + /// Returns the path to the suggested directory for your app's local data files. + pub fn app_local_data_dir(&self) -> Option { + crate::api::path::app_local_data_dir(&self.config) + } + + /// Returns the path to the suggested directory for your app's cache files. + pub fn app_cache_dir(&self) -> Option { + crate::api::path::app_cache_dir(&self.config) + } + + /// Returns the path to the suggested directory for your app's log files. + pub fn app_log_dir(&self) -> Option { + crate::api::path::app_log_dir(&self.config) + } + + /// Returns the path to the suggested directory for your app's config files. + #[deprecated( + since = "1.2.0", + note = "Will be removed in 2.0.0. Use `app_config_dir` or `app_data_dir` instead." + )] pub fn app_dir(&self) -> Option { - crate::api::path::app_dir(&self.config) + self.app_config_dir() } - /// Returns the path to the suggested log directory. + /// Returns the path to the suggested directory for your app's log files. + #[deprecated( + since = "1.2.0", + note = "Will be removed in 2.0.0. Use `app_log_dir` instead." + )] pub fn log_dir(&self) -> Option { - crate::api::path::log_dir(&self.config) + self.app_log_dir() } } diff --git a/core/tauri/src/endpoints/file_system.rs b/core/tauri/src/endpoints/file_system.rs index 23efbf09da2..8d5f4534b44 100644 --- a/core/tauri/src/endpoints/file_system.rs +++ b/core/tauri/src/endpoints/file_system.rs @@ -399,7 +399,7 @@ mod tests { impl Arbitrary for BaseDirectory { fn arbitrary(g: &mut Gen) -> Self { if bool::arbitrary(g) { - BaseDirectory::App + BaseDirectory::AppData } else { BaseDirectory::Resource } diff --git a/examples/api/src-tauri/tauri.conf.json b/examples/api/src-tauri/tauri.conf.json index 148a9b18ca0..a478db5883b 100644 --- a/examples/api/src-tauri/tauri.conf.json +++ b/examples/api/src-tauri/tauri.conf.json @@ -87,8 +87,8 @@ "all": true, "fs": { "scope": { - "allow": ["$APP/db/**", "$DOWNLOAD/**", "$RESOURCE/**"], - "deny": ["$APP/db/*.stronghold"] + "allow": ["$APPDATA/db/**", "$DOWNLOAD/**", "$RESOURCE/**"], + "deny": ["$APPDATA/db/*.stronghold"] } }, "shell": { @@ -109,8 +109,8 @@ "protocol": { "asset": true, "assetScope": { - "allow": ["$APP/db/**", "$RESOURCE/**"], - "deny": ["$APP/db/*.stronghold"] + "allow": ["$APPDATA/db/**", "$RESOURCE/**"], + "deny": ["$APPDATA/db/*.stronghold"] } }, "http": { diff --git a/tooling/api/src/fs.ts b/tooling/api/src/fs.ts index 9187763a699..300e81949dd 100644 --- a/tooling/api/src/fs.ts +++ b/tooling/api/src/fs.ts @@ -41,21 +41,23 @@ * * The scope configuration is an array of glob patterns describing folder paths that are allowed. * For instance, this scope configuration only allows accessing files on the - * *databases* folder of the {@link path.appDir | $APP directory}: + * *databases* folder of the {@link path.appDataDir | $APPDATA directory}: * ```json * { * "tauri": { * "allowlist": { * "fs": { - * "scope": ["$APP/databases/*"] + * "scope": ["$APPDATA/databases/*"] * } * } * } * } * ``` * - * Notice the use of the `$APP` variable. The value is injected at runtime, resolving to the {@link path.appDir | app directory}. + * Notice the use of the `$APPDATA` variable. The value is injected at runtime, resolving to the {@link path.appDataDir | app data directory}. * The available variables are: + * {@link path.appConfigDir | `$APPCONFIG`}, {@link path.appDataDir | `$APPDATA`}, {@link path.appLocalDataDir | `$APPLOCALDATA`}, + * {@link path.appCacheDir | `$APPCACHE`}, {@link path.appLogDir | `$APPLOG`}, * {@link path.audioDir | `$AUDIO`}, {@link path.cacheDir | `$CACHE`}, {@link path.configDir | `$CONFIG`}, {@link path.dataDir | `$DATA`}, * {@link path.localDataDir | `$LOCALDATA`}, {@link path.desktopDir | `$DESKTOP`}, {@link path.documentDir | `$DOCUMENT`}, * {@link path.downloadDir | `$DOWNLOAD`}, {@link path.executableDir | `$EXE`}, {@link path.fontDir | `$FONT`}, {@link path.homeDir | `$HOME`}, @@ -95,7 +97,12 @@ export enum BaseDirectory { Resource, App, Log, - Temp + Temp, + AppConfig, + AppData, + AppLocalData, + AppCache, + AppLog } /** @@ -159,8 +166,8 @@ interface FileEntry { * @example * ```typescript * import { readTextFile, BaseDirectory } from '@tauri-apps/api/fs'; - * // Read the text file in the `$APPDIR/app.conf` path - * const contents = await readTextFile('app.conf', { dir: BaseDirectory.App }); + * // Read the text file in the `$APPCONFIG/app.conf` path + * const contents = await readTextFile('app.conf', { dir: BaseDirectory.AppConfig }); * ``` * * @since 1.0.0 @@ -211,8 +218,8 @@ async function readBinaryFile( * @example * ```typescript * import { writeTextFile, BaseDirectory } from '@tauri-apps/api/fs'; - * // Write a text file to the `$APPDIR/app.conf` path - * await writeTextFile('app.conf', 'file contents', { dir: BaseDirectory.App }); + * // Write a text file to the `$APPCONFIG/app.conf` path + * await writeTextFile('app.conf', 'file contents', { dir: BaseDirectory.AppConfig }); * ``` * * @since 1.0.0 @@ -228,8 +235,8 @@ async function writeTextFile( * @example * ```typescript * import { writeTextFile, BaseDirectory } from '@tauri-apps/api/fs'; - * // Write a text file to the `$APPDIR/app.conf` path - * await writeTextFile({ path: 'app.conf', contents: 'file contents' }, { dir: BaseDirectory.App }); + * // Write a text file to the `$APPCONFIG/app.conf` path + * await writeTextFile({ path: 'app.conf', contents: 'file contents' }, { dir: BaseDirectory.AppConfig }); * ``` * @returns A promise indicating the success or failure of the operation. * @@ -290,8 +297,8 @@ async function writeTextFile( * @example * ```typescript * import { writeBinaryFile, BaseDirectory } from '@tauri-apps/api/fs'; - * // Write a binary file to the `$APPDIR/avatar.png` path - * await writeBinaryFile('avatar.png', new Uint8Array([]), { dir: BaseDirectory.App }); + * // Write a binary file to the `$APPDATA/avatar.png` path + * await writeBinaryFile('avatar.png', new Uint8Array([]), { dir: BaseDirectory.AppData }); * ``` * * @param options Configuration object. @@ -310,8 +317,8 @@ async function writeBinaryFile( * @example * ```typescript * import { writeBinaryFile, BaseDirectory } from '@tauri-apps/api/fs'; - * // Write a binary file to the `$APPDIR/avatar.png` path - * await writeBinaryFile({ path: 'avatar.png', contents: new Uint8Array([]) }, { dir: BaseDirectory.App }); + * // Write a binary file to the `$APPDATA/avatar.png` path + * await writeBinaryFile({ path: 'avatar.png', contents: new Uint8Array([]) }, { dir: BaseDirectory.AppData }); * ``` * * @param file The object containing the file path and contents. @@ -380,8 +387,8 @@ async function writeBinaryFile( * @example * ```typescript * import { readDir, BaseDirectory } from '@tauri-apps/api/fs'; - * // Reads the `$APPDIR/users` directory recursively - * const entries = await readDir('users', { dir: BaseDirectory.App, recursive: true }); + * // Reads the `$APPDATA/users` directory recursively + * const entries = await readDir('users', { dir: BaseDirectory.AppData, recursive: true }); * * function processEntries(entries) { * for (const entry of entries) { @@ -416,8 +423,8 @@ async function readDir( * @example * ```typescript * import { createDir, BaseDirectory } from '@tauri-apps/api/fs'; - * // Create the `$APPDIR/users` directory - * await createDir('users', { dir: BaseDirectory.App, recursive: true }); + * // Create the `$APPDATA/users` directory + * await createDir('users', { dir: BaseDirectory.AppData, recursive: true }); * ``` * * @returns A promise indicating the success or failure of the operation. @@ -444,8 +451,8 @@ async function createDir( * @example * ```typescript * import { removeDir, BaseDirectory } from '@tauri-apps/api/fs'; - * // Remove the directory `$APPDIR/users` - * await removeDir('users', { dir: BaseDirectory.App }); + * // Remove the directory `$APPDATA/users` + * await removeDir('users', { dir: BaseDirectory.AppData }); * ``` * * @returns A promise indicating the success or failure of the operation. @@ -471,8 +478,8 @@ async function removeDir( * @example * ```typescript * import { copyFile, BaseDirectory } from '@tauri-apps/api/fs'; - * // Copy the `$APPDIR/app.conf` file to `$APPDIR/app.conf.bk` - * await copyFile('app.conf', 'app.conf.bk', { dir: BaseDirectory.App }); + * // Copy the `$APPCONFIG/app.conf` file to `$APPCONFIG/app.conf.bk` + * await copyFile('app.conf', 'app.conf.bk', { dir: BaseDirectory.AppConfig }); * ``` * * @returns A promise indicating the success or failure of the operation. @@ -500,8 +507,8 @@ async function copyFile( * @example * ```typescript * import { removeFile, BaseDirectory } from '@tauri-apps/api/fs'; - * // Remove the `$APPDIR/app.conf` file - * await removeFile('app.conf', { dir: BaseDirectory.App }); + * // Remove the `$APPConfig/app.conf` file + * await removeFile('app.conf', { dir: BaseDirectory.AppConfig }); * ``` * * @returns A promise indicating the success or failure of the operation. @@ -527,8 +534,8 @@ async function removeFile( * @example * ```typescript * import { renameFile, BaseDirectory } from '@tauri-apps/api/fs'; - * // Rename the `$APPDIR/avatar.png` file - * await renameFile('avatar.png', 'deleted.png', { dir: BaseDirectory.App }); + * // Rename the `$APPDATA/avatar.png` file + * await renameFile('avatar.png', 'deleted.png', { dir: BaseDirectory.AppData }); * ``` * * @returns A promise indicating the success or failure of the operation. @@ -556,8 +563,8 @@ async function renameFile( * @example * ```typescript * import { exists, BaseDirectory } from '@tauri-apps/api/fs'; - * // Check if the `$APPDIR/avatar.png` file exists - * await exists('avatar.png', { dir: BaseDirectory.App }); + * // Check if the `$APPDATA/avatar.png` file exists + * await exists('avatar.png', { dir: BaseDirectory.AppData }); * ``` * * @since 1.1.0 diff --git a/tooling/api/src/path.ts b/tooling/api/src/path.ts index b73e34e5922..4edc9c2fc13 100644 --- a/tooling/api/src/path.ts +++ b/tooling/api/src/path.ts @@ -29,22 +29,98 @@ import { isWindows } from './helpers/os-check' /** * Returns the path to the suggested directory for your app config files. + * + * @deprecated since 1.2.0: Will be removed in 2.0.0. Use {@link appConfigDir} or {@link appDataDir} instead. + * @since 1.0.0 + */ +async function appDir(): Promise { + return appConfigDir() +} + +/** + * Returns the path to the suggested directory for your app's config files. * Resolves to `${configDir}/${bundleIdentifier}`, where `bundleIdentifier` is the value [`tauri.bundle.identifier`](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in `tauri.conf.json`. * @example * ```typescript - * import { appDir } from '@tauri-apps/api/path'; - * const appDirPath = await appDir(); + * import { appConfigDir } from '@tauri-apps/api/path'; + * const appConfigDirPath = await appConfigDir(); * ``` * - * @since 1.0.0 + * @since 1.2.0 */ -async function appDir(): Promise { +async function appConfigDir(): Promise { + return invokeTauriCommand({ + __tauriModule: 'Path', + message: { + cmd: 'resolvePath', + path: '', + directory: BaseDirectory.AppConfig + } + }) +} + +/** + * Returns the path to the suggested directory for your app's data files. + * Resolves to `${dataDir}/${bundleIdentifier}`, where `bundleIdentifier` is the value [`tauri.bundle.identifier`](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in `tauri.conf.json`. + * @example + * ```typescript + * import { appDataDir } from '@tauri-apps/api/path'; + * const appDataDirPath = await appDataDir(); + * ``` + * + * @since 1.2.0 + */ +async function appDataDir(): Promise { return invokeTauriCommand({ __tauriModule: 'Path', message: { cmd: 'resolvePath', path: '', - directory: BaseDirectory.App + directory: BaseDirectory.AppData + } + }) +} + +/** + * Returns the path to the suggested directory for your app's local data files. + * Resolves to `${localDataDir}/${bundleIdentifier}`, where `bundleIdentifier` is the value [`tauri.bundle.identifier`](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in `tauri.conf.json`. + * @example + * ```typescript + * import { appLocalDataDir } from '@tauri-apps/api/path'; + * const appLocalDataDirPath = await appLocalDataDir(); + * ``` + * + * @since 1.2.0 + */ +async function appLocalDataDir(): Promise { + return invokeTauriCommand({ + __tauriModule: 'Path', + message: { + cmd: 'resolvePath', + path: '', + directory: BaseDirectory.AppLocalData + } + }) +} + +/** + * Returns the path to the suggested directory for your app's cache files. + * Resolves to `${cacheDir}/${bundleIdentifier}`, where `bundleIdentifier` is the value [`tauri.bundle.identifier`](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in `tauri.conf.json`. + * @example + * ```typescript + * import { appCacheDir } from '@tauri-apps/api/path'; + * const appCacheDirPath = await appCacheDir(); + * ``` + * + * @since 1.2.0 + */ +async function appCacheDir(): Promise { + return invokeTauriCommand({ + __tauriModule: 'Path', + message: { + cmd: 'resolvePath', + path: '', + directory: BaseDirectory.AppCache } }) } @@ -531,6 +607,16 @@ async function videoDir(): Promise { /** * Returns the path to the suggested log directory. * + * @deprecated since 1.2.0: Will be removed in 2.0.0. Use {@link appLogDir} instead. + * @since 1.0.0 + */ +async function logDir(): Promise { + return appLogDir() +} + +/** + * Returns the path to the suggested directory for your app's log files. + * * #### Platform-specific * * - **Linux:** Resolves to `${configDir}/${bundleIdentifier}/logs`. @@ -538,19 +624,19 @@ async function videoDir(): Promise { * - **Windows:** Resolves to `${configDir}/${bundleIdentifier}/logs`. * @example * ```typescript - * import { logDir } from '@tauri-apps/api/path'; - * const logDirPath = await logDir(); + * import { appLogDir } from '@tauri-apps/api/path'; + * const appLogDirPath = await appLogDir(); * ``` * - * @since 1.0.0 + * @since 1.2.0 */ -async function logDir(): Promise { +async function appLogDir(): Promise { return invokeTauriCommand({ __tauriModule: 'Path', message: { cmd: 'resolvePath', path: '', - directory: BaseDirectory.Log + directory: BaseDirectory.AppLog } }) } @@ -577,9 +663,9 @@ const delimiter = isWindows() ? ';' : ':' * Resolves a sequence of `paths` or `path` segments into an absolute path. * @example * ```typescript - * import { resolve, appDir } from '@tauri-apps/api/path'; - * const appDirPath = await appDir(); - * const path = await resolve(appDirPath, '..', 'users', 'tauri', 'avatar.png'); + * import { resolve, appDataDir } from '@tauri-apps/api/path'; + * const appDataDirPath = await appDataDir(); + * const path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png'); * ``` * * @since 1.0.0 @@ -598,9 +684,9 @@ async function resolve(...paths: string[]): Promise { * Normalizes the given `path`, resolving `'..'` and `'.'` segments and resolve symbolic links. * @example * ```typescript - * import { normalize, appDir } from '@tauri-apps/api/path'; - * const appDirPath = await appDir(); - * const path = await normalize(appDirPath, '..', 'users', 'tauri', 'avatar.png'); + * import { normalize, appDataDir } from '@tauri-apps/api/path'; + * const appDataDirPath = await appDataDir(); + * const path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png'); * ``` * * @since 1.0.0 @@ -619,9 +705,9 @@ async function normalize(path: string): Promise { * Joins all given `path` segments together using the platform-specific separator as a delimiter, then normalizes the resulting path. * @example * ```typescript - * import { join, appDir } from '@tauri-apps/api/path'; - * const appDirPath = await appDir(); - * const path = await join(appDirPath, 'users', 'tauri', 'avatar.png'); + * import { join, appDataDir } from '@tauri-apps/api/path'; + * const appDataDirPath = await appDataDir(); + * const path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png'); * ``` * * @since 1.0.0 @@ -640,9 +726,9 @@ async function join(...paths: string[]): Promise { * Returns the directory name of a `path`. Trailing directory separators are ignored. * @example * ```typescript - * import { dirname, appDir } from '@tauri-apps/api/path'; - * const appDirPath = await appDir(); - * const dir = await dirname(appDirPath); + * import { dirname, appDataDir } from '@tauri-apps/api/path'; + * const appDataDirPath = await appDataDir(); + * const dir = await dirname(appDataDirPath); * ``` * * @since 1.0.0 @@ -726,6 +812,11 @@ async function isAbsolute(path: string): Promise { export { appDir, + appConfigDir, + appDataDir, + appLocalDataDir, + appCacheDir, + appLogDir, audioDir, cacheDir, configDir, diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index b07f5169aa7..7c422405357 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -110,10 +110,10 @@ async function invoke(cmd: string, args: InvokeArgs = {}): Promise { * @param protocol The protocol to use. Defaults to `asset`. You only need to set this when using a custom protocol. * @example * ```typescript - * import { appDir, join } from '@tauri-apps/api/path'; + * import { appDataDir, join } from '@tauri-apps/api/path'; * import { convertFileSrc } from '@tauri-apps/api/tauri'; - * const appDirPath = await appDir(); - * const filePath = await join(appDir, 'assets/video.mp4'); + * const appDataDirPath = await appDataDir(); + * const filePath = await join(appDataDirPath, 'assets/video.mp4'); * const assetUrl = convertFileSrc(filePath); * * const video = document.getElementById('my-video'); diff --git a/tooling/cli/schema.json b/tooling/cli/schema.json index 61139463bbb..a00bf7a73a6 100644 --- a/tooling/cli/schema.json +++ b/tooling/cli/schema.json @@ -1771,7 +1771,7 @@ "additionalProperties": false }, "FsAllowlistScope": { - "description": "Filesystem scope definition. It is a list of glob patterns that restrict the API access from the webview.\n\nEach pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`.", + "description": "Filesystem scope definition. It is a list of glob patterns that restrict the API access from the webview.\n\nEach pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.", "anyOf": [ { "description": "A list of paths that are allowed by this scope.", @@ -2020,7 +2020,7 @@ "type": "string" }, "cmd": { - "description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`.", + "description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.", "default": "", "type": "string" },