123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555 |
- <!DOCTYPE html><html><head><script>function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){asyncGeneratorStep(i,n,o,a,u,"next",e)}function u(e){asyncGeneratorStep(i,n,o,a,u,"throw",e)}a(void 0)}))}}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).__TAURI__={})}(this,(function(e){"use strict";var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(e,t,r,n){var o=t&&t.prototype instanceof p?t:p,i=Object.create(o.prototype),a=new x(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===s)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var p=c(e,t,r);if("normal"===p.type){if(n=r.done?"completed":"suspendedYield",p.arg===s)continue;return{value:p.arg,done:r.done}}"throw"===p.type&&(n="completed",r.method="throw",r.arg=p.arg)}}}(e,r,a),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var s={};function p(){}function f(){}function l(){}var h={};h[o]=function(){return this};var y=Object.getPrototypeOf,d=y&&y(y(R([])));d&&d!==t&&r.call(d,o)&&(h=d);var m=l.prototype=p.prototype=Object.create(h);function v(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function g(e,t){var n;this._invoke=function(o,i){function a(){return new t((function(n,a){!function n(o,i,a,u){var s=c(e[o],e,i);if("throw"!==s.type){var p=s.arg,f=p.value;return f&&"object"===_typeof(f)&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,u)}),(function(e){n("throw",e,a,u)})):t.resolve(f).then((function(e){p.value=e,a(p)}),(function(e){return n("throw",e,a,u)}))}u(s.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,s;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function R(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:j}}function j(){return{value:void 0,done:!0}}return f.prototype=m.constructor=l,l.constructor=f,l[a]=f.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,a in e||(e[a]="GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},v(g.prototype),g.prototype[i]=function(){return this},e.AsyncIterator=g,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new g(u(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},v(m),m[a]="Generator",m[o]=function(){return this},m.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=R,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),_(r),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},e}("object"===("undefined"==typeof module?"undefined":_typeof(module))?module.exports:{});try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}function r(e){for(var t=void 0,r=e[0],n=1;n<e.length;){var o=e[n],i=e[n+1];if(n+=2,("optionalAccess"===o||"optionalCall"===o)&&null==r)return;"access"===o||"optionalAccess"===o?(t=r,r=i(r)):"call"!==o&&"optionalCall"!==o||(r=i((function(){for(var e,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return(e=r).call.apply(e,[t].concat(o))})),t=void 0)}return r}function n(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function o(){return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()}function i(e){window.__TAURI_INVOKE_HANDLER__(e)}function a(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=o();return Object.defineProperty(window,n,{value:function(o){return t&&Reflect.deleteProperty(window,n),r([e,"optionalCall",function(e){return e(o)}])},writable:!1}),n}function u(e){return c.apply(this,arguments)}function c(){return(c=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,r){i(_objectSpread({callback:a(e),error:a(r)},t))}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var s=Object.freeze({__proto__:null,invoke:i,transformCallback:a,promisified:u});function p(){return(p=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({cmd:"cliMatches"});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var f=Object.freeze({__proto__:null,getMatches:function(){return p.apply(this,arguments)}});function l(){return(l=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.next=4,u({cmd:"openDialog",options:t});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(){return(h=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.next=4,u({cmd:"saveDialog",options:t});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var y=Object.freeze({__proto__:null,open:function(){return l.apply(this,arguments)},save:function(){return h.apply(this,arguments)}});var d,m=Object.freeze({__proto__:null,listen:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i({cmd:"listen",event:e,handler:a(t,r),once:r})},emit:function(e,t){i({cmd:"emit",event:e,payload: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.next=3,u({cmd:"readTextFile",path:t,options:r});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(){return(g=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({cmd:"readBinaryFile",path:t,options:r});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(){return(w=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r=n.length>1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.next=5,u({cmd:"writeFile",file:t.path,contents:t.contents,options:r});case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.Audio=1]="Audio";e[e.Cache=2]="Cache";e[e.Config=3]="Config";e[e.Data=4]="Data";e[e.LocalData=5]="LocalData";e[e.Desktop=6]="Desktop";e[e.Document=7]="Document";e[e.Download=8]="Download";e[e.Executable=9]="Executable";e[e.Font=10]="Font";e[e.Home=11]="Home";e[e.Picture=12]="Picture";e[e.Public=13]="Public";e[e.Runtime=14]="Runtime";e[e.Template=15]="Template";e[e.Video=16]="Video";e[e.Resource=17]="Resource";e[e.App=18]="App"}(d||(d={}));function b(e){var t=function(e){if(e.length<65536)return String.fromCharCode.apply(null,Array.from(e));for(var t="",r=e.length,n=0;n<r;n++){var o=e.subarray(65536*n,65536*(n+1));t+=String.fromCharCode.apply(null,Array.from(o))}return t}(new Uint8Array(e));return btoa(t)}function _(){return(_=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r=n.length>1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.next=5,u({cmd:"writeFile",file:t.path,contents:b(t.contents),options:r});case 5:return e.abrupt("return",e.sent);case 6: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.next=3,u({cmd:"readDir",path:t,options:r});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(){return(R=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({cmd:"createDir",path:t,options:r});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function j(){return(j=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({cmd:"removeDir",path:t,options:r});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(){return(O=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:{},e.next=3,u({cmd:"copyFile",source:t,destination:r,options:n});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function T(){return(T=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.next=3,u({cmd:"removeFile",path:t,options:r});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:{},e.next=3,u({cmd:"renameFile",oldPath:t,newPath:r,options:n});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var G,P,E=Object.freeze({__proto__:null,get BaseDirectory(){return d},get Dir(){return d},readTextFile:function(e){return v.apply(this,arguments)},readBinaryFile:function(e){return g.apply(this,arguments)},writeFile:function(e){return w.apply(this,arguments)},writeBinaryFile:function(e){return _.apply(this,arguments)},readDir:function(e){return x.apply(this,arguments)},createDir:function(e){return R.apply(this,arguments)},removeDir:function(e){return j.apply(this,arguments)},copyFile:function(e,t){return O.apply(this,arguments)},removeFile:function(e){return T.apply(this,arguments)},renameFile:function(e,t){return k.apply(this,arguments)}});function L(e){return S.apply(this,arguments)}function S(){return(S=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({cmd:"httpRequest",options:t});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(){return(D=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,L(_objectSpread({method:"GET",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function F(){return(F=_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,L(_objectSpread({method:"POST",url:t,body:r},n));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(){return(N=_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,L(_objectSpread({method:"PUT",url:t,body:r},n));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function A(){return(A=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,L(_objectSpread({method:"PATCH",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function 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.next=2,L(_objectSpread({method:"DELETE",url:t},r));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.JSON=1]="JSON";e[e.Text=2]="Text";e[e.Binary=3]="Binary"}(G||(G={})),function(e){e[e.Form=1]="Form";e[e.File=2]="File";e[e.Auto=3]="Auto"}(P||(P={}));var C={request:L,get:function(e,t){return D.apply(this,arguments)},post:function(e,t,r){return F.apply(this,arguments)},put:function(e,t,r){return N.apply(this,arguments)},patch:function(e,t){return A.apply(this,arguments)},delete:function(e,t){return z.apply(this,arguments)},ResponseType:G,BodyType:P};function B(){return(B=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r)&&Object.freeze(r),e.next=3,u({cmd:"execute",command:t,args:"string"==typeof r?[r]:r});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var I=Object.freeze({__proto__:null,execute:function(e,t){return B.apply(this,arguments)}});var M=Object.freeze({__proto__:null,setTitle:function(e){i({cmd:"setTitle",title:e})},open:function(e){i({cmd:"open",uri:e})}});function q(){return(q=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("default"===window.Notification.permission){e.next=4;break}return e.next=3,Promise.resolve("granted"===window.Notification.permission);case 3:return e.abrupt("return",e.sent);case 4:return e.next=6,u({cmd:"isNotificationPermissionGranted"});case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function H(){return(H=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,window.Notification.requestPermission();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var K=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return H.apply(this,arguments)},isPermissionGranted:function(){return q.apply(this,arguments)}});e.cli=f,e.dialog=y,e.event=m,e.fs=E,e.http=C,e.notification=K,e.process=I,e.tauri=s,e.window=M,Object.defineProperty(e,"__esModule",{value:!0})}));
- </script><script>// polyfills
- if (!String.prototype.startsWith) {
- String.prototype.startsWith = function (searchString, position) {
- position = position || 0
- return this.substr(position, searchString.length) === searchString
- }
- }
- (function () {
- function webviewBind (name) {
- var RPC = window._rpc = (window._rpc || { nextSeq: 1 });
- window[name] = function () {
- var seq = RPC.nextSeq++;
- var promise = new Promise(function (resolve, reject) {
- RPC[seq] = {
- resolve: resolve,
- reject: reject,
- };
- });
- window.external.invoke(JSON.stringify({
- id: seq,
- method: name,
- params: Array.prototype.slice.call(arguments),
- }));
- return promise;
- }
- }
- if (!window.__TAURI_INVOKE_HANDLER__) {
- webviewBind('__TAURI_INVOKE_HANDLER__')
- }
- function s4() {
- return Math.floor((1 + Math.random()) * 0x10000)
- .toString(16)
- .substring(1)
- }
- var uid = function () {
- return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
- s4() + '-' + s4() + s4() + s4()
- }
- function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- });
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- if (i % 2) {
- ownKeys(source, true).forEach(function (key) {
- _defineProperty(target, key, source[key]);
- });
- } else if (Object.getOwnPropertyDescriptors) {
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
- } else {
- ownKeys(source).forEach(function (key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- }
- return target;
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- if (!window.__TAURI__) {
- window.__TAURI__ = {}
- }
- window.__TAURI__.transformCallback = function transformCallback(callback) {
- var once = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false
- var identifier = uid()
- window[identifier] = function (result) {
- if (once) {
- delete window[identifier]
- }
- return callback && callback(result)
- }
- return identifier;
- }
- window.__TAURI__.promisified = function promisified(args) {
- var _this = this
- return new Promise(function (resolve, reject) {
- window.__TAURI_INVOKE_HANDLER__(_objectSpread({
- callback: _this.transformCallback(resolve),
- error: _this.transformCallback(reject)
- }, args))
- })
- }
- window.__TAURI__.loadAsset = function loadAsset(assetName, assetType) {
- return this.promisified({
- cmd: 'loadAsset',
- asset: assetName,
- assetType: assetType || 'unknown'
- })
- }
- document.addEventListener('error', function (e) {
- var target = e.target
- while (target != null) {
- if (target.matches ? target.matches('img') : target.msMatchesSelector('img')) {
- window.__TAURI__.loadAsset(target.src, 'image')
- .then(function (img) {
- target.src = img
- })
- break
- }
- target = target.parentElement
- }
- }, true)
- // open <a href="..."> links with the Tauri API
- function __openLinks() {
- document.querySelector('body').addEventListener('click', function (e) {
- var target = e.target
- while (target != null) {
- if (target.matches ? target.matches('a') : target.msMatchesSelector('a')) {
- if (target.href && target.href.startsWith('http') && target.target === '_blank') {
- window.__TAURI_INVOKE_HANDLER__({
- cmd: 'open',
- uri: target.href
- })
- e.preventDefault()
- }
- break
- }
- target = target.parentElement
- }
- }, true)
- }
- if (document.readyState === 'complete' || document.readyState === 'interactive') {
- __openLinks()
- } else {
- window.addEventListener('DOMContentLoaded', function () {
- __openLinks()
- }, true)
- }
- let permissionSettable = false
- let permissionValue = 'default'
- function isPermissionGranted() {
- if (window.Notification.permission !== 'default') {
- return Promise.resolve(window.Notification.permission === 'granted')
- }
- return window.__TAURI__.promisified({
- cmd: 'isNotificationPermissionGranted'
- })
- }
- function setNotificationPermission(value) {
- permissionSettable = true
- window.Notification.permission = value
- permissionSettable = false
- }
- function requestPermission() {
- return window.__TAURI__.promisified({
- cmd: 'requestNotificationPermission'
- }).then(function (permission) {
- setNotificationPermission(permission)
- return permission
- })
- }
- function sendNotification(options) {
- if (typeof options === 'object') {
- Object.freeze(options)
- }
- isPermissionGranted()
- .then(function (permission) {
- if (permission) {
- return window.__TAURI__.promisified({
- cmd: 'notification',
- options: typeof options === 'string' ? {
- title: options
- } : options
- })
- }
- })
- }
- window.Notification = function (title, options) {
- var opts = options || {}
- sendNotification(Object.assign(opts, {
- title: title
- }))
- }
- window.Notification.requestPermission = requestPermission
- Object.defineProperty(window.Notification, 'permission', {
- enumerable: true,
- get: function () {
- return permissionValue
- },
- set: function (v) {
- if (!permissionSettable) {
- throw new Error('Readonly property')
- }
- permissionValue = v
- }
- })
- isPermissionGranted()
- .then(function (response) {
- if (response === null) {
- setNotificationPermission('default')
- } else {
- setNotificationPermission(response ? 'granted' : 'denied')
- }
- })
- })()
- </script>
- <style>
- * {
- font-family: Arial, Helvetica, sans-serif;
- }
- body {
- background: #889;
- }
- .logo-container {
- width: 95%;
- margin: 0px auto;
- overflow: hidden;
- }
- .logo-link {
- font-weight: 700;
- position: absolute;
- top: 150px;
- right: 10px;
- }
- .logo {
- width: 32px;
- height: 32px;
- cursor: pointer;
- position: fixed;
- z-index: 10;
- top: 7px;
- right: 10px;
- }
- #response {
- position: absolute;
- left: 10px;
- right: 10px;
- top: 440px;
- min-height: 110px;
- background: #aab;
- font-family: 'Courier New', Courier, monospace;
- font-size: 12px;
- word-wrap: break-word;
- padding: 5px;
- border-radius: 5px;
- overflow-y: auto;
- }
- input,
- select {
- background: white;
- font-family: system-ui, sans-serif;
- border: 0;
- border-radius: 0.25rem;
- font-size: 1rem;
- line-height: 1.2;
- padding: 0.25rem 0.5rem;
- margin: 0.25rem;
- }
- button:hover,
- button:focus {
- background: #0053ba;
- }
- button:focus {
- outline: 1px solid #fff;
- outline-offset: -4px;
- }
- button:active {
- transform: scale(0.99);
- }
- .button {
- border: 0;
- border-radius: 0.25rem;
- background: #1E88E5;
- color: white;
- font-family: system-ui, sans-serif;
- font-size: 1rem;
- line-height: 1.2;
- white-space: nowrap;
- text-decoration: none;
- padding: 0.25rem 0.5rem;
- margin: 0.25rem;
- cursor: pointer;
- }
- .bottom {
- position: fixed;
- bottom: 0;
- left: 0;
- text-align: center;
- width: 100%;
- padding: 5px;
- background: #333;
- color: #eef;
- }
- .dark-link {
- color: white;
- text-decoration: none !important;
- }
- .tabs-container {
- position: fixed;
- height: 400px;
- top: 20px;
- left: 10px;
- right: 10px;
- z-index: 9;
- }
- .tabs {
- position: relative;
- min-height: 400px;
- clear: both;
- }
- .tab {
- float: left;
- }
- .tab>label {
- background: #eee;
- padding: 10px;
- border: 1px solid transparent;
- margin-left: -1px;
- position: relative;
- left: 1px;
- }
- .tabs>.tabber {
- border-top-left-radius: 5px;
- }
- .tabs>.tabber~.tabber {
- border-top-left-radius: none;
- }
- .tab [type=radio] {
- display: none;
- }
- .content {
- position: absolute;
- top: 28px;
- left: 0;
- background: #bbc;
- right: 0;
- bottom: 0;
- padding: 20px;
- border: 1px solid transparent;
- border-top-right-radius: 5px;
- border-bottom-left-radius: 5px;
- border-bottom-right-radius: 5px;
- }
- [type=radio]:checked~label {
- background: #bbc;
- border-bottom: 1px solid transparent;
- z-index: 2;
- }
- [type=radio]:checked~label~.content {
- z-index: 1;
- }
- </style>
- <meta http-equiv="Content-Security-Policy" content="default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'"></head>
- <body>
- <div class="logo-container">
- <img src="icon.png" class="logo">
- </div>
- <div class="tabs-container">
- <div class="tabs">
- <div class="tab">
- <input type="radio" id="tab-1" name="tab-group-1" checked="">
- <label class="tabber" for="tab-1">Messages</label>
- <div class="content">
- <button class="button" id="log">Call Log API</button>
- <button class="button" id="request">Call Request (async) API</button>
- <button class="button" id="event">Send event to Rust</button>
- <button class="button" id="notification">Send test notification</button>
- <div style="margin-top: 24px">
- <input id="title" value="Awesome Tauri Example!">
- <button class="button" id="set-title">Set title</button>
- </div>
- </div>
- </div>
- <div class="tab">
- <input type="radio" id="tab-2" name="tab-group-1">
- <label class="tabber" for="tab-2">File System</label>
- <div class="content">
- <div style="margin-top: 24px">
- <select class="button" id="dir">
- <option value="">None</option>
- </select>
- <input id="path-to-read" placeholder="Type the path to read...">
- <button class="button" id="read">Read</button>
- </div>
- <div style="margin-top: 24px">
- <input id="dialog-default-path" placeholder="Default path">
- <input id="dialog-filter" placeholder="Extensions filter">
- <div>
- <input type="checkbox" id="dialog-multiple">
- <label>Multiple</label>
- </div>
- <div>
- <input type="checkbox" id="dialog-directory">
- <label>Directory</label>
- </div>
- <button class="button" id="open-dialog">Open dialog</button>
- <button class="button" id="save-dialog">Open save dialog</button>
- </div>
- </div>
- </div>
- <div class="tab">
- <input type="radio" id="tab-3" name="tab-group-1">
- <label class="tabber" for="tab-3">Communication</label>
- <div class="content">
- <div style="margin-top: 24px">
- <input id="url" value="https://tauri.studio">
- <button class="button" id="open-url">Open URL</button>
- </div>
- <div style="margin-top: 24px">
- <select class="button" id="request-method">
- <option value="GET">GET</option>
- <option value="POST">POST</option>
- <option value="PUT">PUT</option>
- <option value="PATCH">PATCH</option>
- <option value="DELETE">DELETE</option>
- </select>
- <input id="request-url" placeholder="Type the request URL...">
- <br>
- <textarea id="request-body" placeholder="Request body" rows="5" style="width:100%;margin-right:10px;font-size:12px"></textarea>
- <br>
- <button class="button" id="make-request">Make request</button>
- </div>
- </div>
- </div>
- <div class="tab">
- <input type="radio" id="tab-4" name="tab-group-1">
- <label class="tabber" for="tab-4">CLI</label>
- <div class="content">
- <div style="margin-top: 24px">
- <button class="button" id="cli-matches">Get matches</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id="response"></div>
- <div class="bottom">
- <a class="dark-link" target="_blank" href="https://tauri.studio">Tauri Documentation</a>
- <a class="dark-link" target="_blank" href="https://github.com/tauri-apps/tauri">Github Repo</a>
- <a class="dark-link" target="_blank" href="https://github.com/tauri-apps/tauri/tree/dev/tauri/examples/communication">Source for this App</a>
- </div>
- <script>
- function registerResponse(response) {
- document.getElementById('response').innerHTML = typeof response === 'object' ?
- JSON.stringify(response) :
- response
- }
- function addClickEnterHandler(button, input, handler) {
- button.addEventListener('click', handler)
- input.addEventListener('keyup', function (e) {
- if (e.keyCode === 13) {
- handler()
- }
- })
- }
- window.__TAURI__.event.listen('rust-event', function (res) {
- document.getElementById('response').innerHTML = JSON.stringify(res)
- })
- document.querySelector('.logo').addEventListener('click', function () {
- window.__TAURI__.window.open('https://tauri.studio/')
- })
- var dirSelect = document.getElementById('dir')
- for (var key in window.__TAURI__.fs.Dir) {
- if (isNaN(parseInt(key))) {
- var value = window.__TAURI__.fs.Dir[key]
- var opt = document.createElement("option")
- opt.value = value
- opt.innerHTML = key
- dirSelect.appendChild(opt)
- }
- }
- </script>
- <script src="communication.js"></script>
- <script src="fs.js"></script>
- <script src="window.js"></script>
- <script src="dialog.js"></script>
- <script src="http.js"></script>
- <script src="cli.js"></script>
- <script src="notification.js"></script>
- </body></html>
|