index.tauri.html 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. <!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})}));
  2. </script><script>// polyfills
  3. if (!String.prototype.startsWith) {
  4. String.prototype.startsWith = function (searchString, position) {
  5. position = position || 0
  6. return this.substr(position, searchString.length) === searchString
  7. }
  8. }
  9. (function () {
  10. function webviewBind (name) {
  11. var RPC = window._rpc = (window._rpc || { nextSeq: 1 });
  12. window[name] = function () {
  13. var seq = RPC.nextSeq++;
  14. var promise = new Promise(function (resolve, reject) {
  15. RPC[seq] = {
  16. resolve: resolve,
  17. reject: reject,
  18. };
  19. });
  20. window.external.invoke(JSON.stringify({
  21. id: seq,
  22. method: name,
  23. params: Array.prototype.slice.call(arguments),
  24. }));
  25. return promise;
  26. }
  27. }
  28. if (!window.__TAURI_INVOKE_HANDLER__) {
  29. webviewBind('__TAURI_INVOKE_HANDLER__')
  30. }
  31. function s4() {
  32. return Math.floor((1 + Math.random()) * 0x10000)
  33. .toString(16)
  34. .substring(1)
  35. }
  36. var uid = function () {
  37. return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
  38. s4() + '-' + s4() + s4() + s4()
  39. }
  40. function ownKeys(object, enumerableOnly) {
  41. var keys = Object.keys(object);
  42. if (Object.getOwnPropertySymbols) {
  43. var symbols = Object.getOwnPropertySymbols(object);
  44. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  45. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  46. });
  47. keys.push.apply(keys, symbols);
  48. }
  49. return keys;
  50. }
  51. function _objectSpread(target) {
  52. for (var i = 1; i < arguments.length; i++) {
  53. var source = arguments[i] != null ? arguments[i] : {};
  54. if (i % 2) {
  55. ownKeys(source, true).forEach(function (key) {
  56. _defineProperty(target, key, source[key]);
  57. });
  58. } else if (Object.getOwnPropertyDescriptors) {
  59. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  60. } else {
  61. ownKeys(source).forEach(function (key) {
  62. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  63. });
  64. }
  65. }
  66. return target;
  67. }
  68. function _defineProperty(obj, key, value) {
  69. if (key in obj) {
  70. Object.defineProperty(obj, key, {
  71. value: value,
  72. enumerable: true,
  73. configurable: true,
  74. writable: true
  75. });
  76. } else {
  77. obj[key] = value;
  78. }
  79. return obj;
  80. }
  81. if (!window.__TAURI__) {
  82. window.__TAURI__ = {}
  83. }
  84. window.__TAURI__.transformCallback = function transformCallback(callback) {
  85. var once = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false
  86. var identifier = uid()
  87. window[identifier] = function (result) {
  88. if (once) {
  89. delete window[identifier]
  90. }
  91. return callback && callback(result)
  92. }
  93. return identifier;
  94. }
  95. window.__TAURI__.promisified = function promisified(args) {
  96. var _this = this
  97. return new Promise(function (resolve, reject) {
  98. window.__TAURI_INVOKE_HANDLER__(_objectSpread({
  99. callback: _this.transformCallback(resolve),
  100. error: _this.transformCallback(reject)
  101. }, args))
  102. })
  103. }
  104. window.__TAURI__.loadAsset = function loadAsset(assetName, assetType) {
  105. return this.promisified({
  106. cmd: 'loadAsset',
  107. asset: assetName,
  108. assetType: assetType || 'unknown'
  109. })
  110. }
  111. document.addEventListener('error', function (e) {
  112. var target = e.target
  113. while (target != null) {
  114. if (target.matches ? target.matches('img') : target.msMatchesSelector('img')) {
  115. window.__TAURI__.loadAsset(target.src, 'image')
  116. .then(function (img) {
  117. target.src = img
  118. })
  119. break
  120. }
  121. target = target.parentElement
  122. }
  123. }, true)
  124. // open <a href="..."> links with the Tauri API
  125. function __openLinks() {
  126. document.querySelector('body').addEventListener('click', function (e) {
  127. var target = e.target
  128. while (target != null) {
  129. if (target.matches ? target.matches('a') : target.msMatchesSelector('a')) {
  130. if (target.href && target.href.startsWith('http') && target.target === '_blank') {
  131. window.__TAURI_INVOKE_HANDLER__({
  132. cmd: 'open',
  133. uri: target.href
  134. })
  135. e.preventDefault()
  136. }
  137. break
  138. }
  139. target = target.parentElement
  140. }
  141. }, true)
  142. }
  143. if (document.readyState === 'complete' || document.readyState === 'interactive') {
  144. __openLinks()
  145. } else {
  146. window.addEventListener('DOMContentLoaded', function () {
  147. __openLinks()
  148. }, true)
  149. }
  150. let permissionSettable = false
  151. let permissionValue = 'default'
  152. function isPermissionGranted() {
  153. if (window.Notification.permission !== 'default') {
  154. return Promise.resolve(window.Notification.permission === 'granted')
  155. }
  156. return window.__TAURI__.promisified({
  157. cmd: 'isNotificationPermissionGranted'
  158. })
  159. }
  160. function setNotificationPermission(value) {
  161. permissionSettable = true
  162. window.Notification.permission = value
  163. permissionSettable = false
  164. }
  165. function requestPermission() {
  166. return window.__TAURI__.promisified({
  167. cmd: 'requestNotificationPermission'
  168. }).then(function (permission) {
  169. setNotificationPermission(permission)
  170. return permission
  171. })
  172. }
  173. function sendNotification(options) {
  174. if (typeof options === 'object') {
  175. Object.freeze(options)
  176. }
  177. isPermissionGranted()
  178. .then(function (permission) {
  179. if (permission) {
  180. return window.__TAURI__.promisified({
  181. cmd: 'notification',
  182. options: typeof options === 'string' ? {
  183. title: options
  184. } : options
  185. })
  186. }
  187. })
  188. }
  189. window.Notification = function (title, options) {
  190. var opts = options || {}
  191. sendNotification(Object.assign(opts, {
  192. title: title
  193. }))
  194. }
  195. window.Notification.requestPermission = requestPermission
  196. Object.defineProperty(window.Notification, 'permission', {
  197. enumerable: true,
  198. get: function () {
  199. return permissionValue
  200. },
  201. set: function (v) {
  202. if (!permissionSettable) {
  203. throw new Error('Readonly property')
  204. }
  205. permissionValue = v
  206. }
  207. })
  208. isPermissionGranted()
  209. .then(function (response) {
  210. if (response === null) {
  211. setNotificationPermission('default')
  212. } else {
  213. setNotificationPermission(response ? 'granted' : 'denied')
  214. }
  215. })
  216. })()
  217. </script>
  218. <style>
  219. * {
  220. font-family: Arial, Helvetica, sans-serif;
  221. }
  222. body {
  223. background: #889;
  224. }
  225. .logo-container {
  226. width: 95%;
  227. margin: 0px auto;
  228. overflow: hidden;
  229. }
  230. .logo-link {
  231. font-weight: 700;
  232. position: absolute;
  233. top: 150px;
  234. right: 10px;
  235. }
  236. .logo {
  237. width: 32px;
  238. height: 32px;
  239. cursor: pointer;
  240. position: fixed;
  241. z-index: 10;
  242. top: 7px;
  243. right: 10px;
  244. }
  245. #response {
  246. position: absolute;
  247. left: 10px;
  248. right: 10px;
  249. top: 440px;
  250. min-height: 110px;
  251. background: #aab;
  252. font-family: 'Courier New', Courier, monospace;
  253. font-size: 12px;
  254. word-wrap: break-word;
  255. padding: 5px;
  256. border-radius: 5px;
  257. overflow-y: auto;
  258. }
  259. input,
  260. select {
  261. background: white;
  262. font-family: system-ui, sans-serif;
  263. border: 0;
  264. border-radius: 0.25rem;
  265. font-size: 1rem;
  266. line-height: 1.2;
  267. padding: 0.25rem 0.5rem;
  268. margin: 0.25rem;
  269. }
  270. button:hover,
  271. button:focus {
  272. background: #0053ba;
  273. }
  274. button:focus {
  275. outline: 1px solid #fff;
  276. outline-offset: -4px;
  277. }
  278. button:active {
  279. transform: scale(0.99);
  280. }
  281. .button {
  282. border: 0;
  283. border-radius: 0.25rem;
  284. background: #1E88E5;
  285. color: white;
  286. font-family: system-ui, sans-serif;
  287. font-size: 1rem;
  288. line-height: 1.2;
  289. white-space: nowrap;
  290. text-decoration: none;
  291. padding: 0.25rem 0.5rem;
  292. margin: 0.25rem;
  293. cursor: pointer;
  294. }
  295. .bottom {
  296. position: fixed;
  297. bottom: 0;
  298. left: 0;
  299. text-align: center;
  300. width: 100%;
  301. padding: 5px;
  302. background: #333;
  303. color: #eef;
  304. }
  305. .dark-link {
  306. color: white;
  307. text-decoration: none !important;
  308. }
  309. .tabs-container {
  310. position: fixed;
  311. height: 400px;
  312. top: 20px;
  313. left: 10px;
  314. right: 10px;
  315. z-index: 9;
  316. }
  317. .tabs {
  318. position: relative;
  319. min-height: 400px;
  320. clear: both;
  321. }
  322. .tab {
  323. float: left;
  324. }
  325. .tab>label {
  326. background: #eee;
  327. padding: 10px;
  328. border: 1px solid transparent;
  329. margin-left: -1px;
  330. position: relative;
  331. left: 1px;
  332. }
  333. .tabs>.tabber {
  334. border-top-left-radius: 5px;
  335. }
  336. .tabs>.tabber~.tabber {
  337. border-top-left-radius: none;
  338. }
  339. .tab [type=radio] {
  340. display: none;
  341. }
  342. .content {
  343. position: absolute;
  344. top: 28px;
  345. left: 0;
  346. background: #bbc;
  347. right: 0;
  348. bottom: 0;
  349. padding: 20px;
  350. border: 1px solid transparent;
  351. border-top-right-radius: 5px;
  352. border-bottom-left-radius: 5px;
  353. border-bottom-right-radius: 5px;
  354. }
  355. [type=radio]:checked~label {
  356. background: #bbc;
  357. border-bottom: 1px solid transparent;
  358. z-index: 2;
  359. }
  360. [type=radio]:checked~label~.content {
  361. z-index: 1;
  362. }
  363. </style>
  364. <meta http-equiv="Content-Security-Policy" content="default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'"></head>
  365. <body>
  366. <div class="logo-container">
  367. <img src="icon.png" class="logo">
  368. </div>
  369. <div class="tabs-container">
  370. <div class="tabs">
  371. <div class="tab">
  372. <input type="radio" id="tab-1" name="tab-group-1" checked="">
  373. <label class="tabber" for="tab-1">Messages</label>
  374. <div class="content">
  375. <button class="button" id="log">Call Log API</button>
  376. <button class="button" id="request">Call Request (async) API</button>
  377. <button class="button" id="event">Send event to Rust</button>
  378. <button class="button" id="notification">Send test notification</button>
  379. <div style="margin-top: 24px">
  380. <input id="title" value="Awesome Tauri Example!">
  381. <button class="button" id="set-title">Set title</button>
  382. </div>
  383. </div>
  384. </div>
  385. <div class="tab">
  386. <input type="radio" id="tab-2" name="tab-group-1">
  387. <label class="tabber" for="tab-2">File System</label>
  388. <div class="content">
  389. <div style="margin-top: 24px">
  390. <select class="button" id="dir">
  391. <option value="">None</option>
  392. </select>
  393. <input id="path-to-read" placeholder="Type the path to read...">
  394. <button class="button" id="read">Read</button>
  395. </div>
  396. <div style="margin-top: 24px">
  397. <input id="dialog-default-path" placeholder="Default path">
  398. <input id="dialog-filter" placeholder="Extensions filter">
  399. <div>
  400. <input type="checkbox" id="dialog-multiple">
  401. <label>Multiple</label>
  402. </div>
  403. <div>
  404. <input type="checkbox" id="dialog-directory">
  405. <label>Directory</label>
  406. </div>
  407. <button class="button" id="open-dialog">Open dialog</button>
  408. <button class="button" id="save-dialog">Open save dialog</button>
  409. </div>
  410. </div>
  411. </div>
  412. <div class="tab">
  413. <input type="radio" id="tab-3" name="tab-group-1">
  414. <label class="tabber" for="tab-3">Communication</label>
  415. <div class="content">
  416. <div style="margin-top: 24px">
  417. <input id="url" value="https://tauri.studio">
  418. <button class="button" id="open-url">Open URL</button>
  419. </div>
  420. <div style="margin-top: 24px">
  421. <select class="button" id="request-method">
  422. <option value="GET">GET</option>
  423. <option value="POST">POST</option>
  424. <option value="PUT">PUT</option>
  425. <option value="PATCH">PATCH</option>
  426. <option value="DELETE">DELETE</option>
  427. </select>
  428. <input id="request-url" placeholder="Type the request URL...">
  429. <br>
  430. <textarea id="request-body" placeholder="Request body" rows="5" style="width:100%;margin-right:10px;font-size:12px"></textarea>
  431. <br>
  432. <button class="button" id="make-request">Make request</button>
  433. </div>
  434. </div>
  435. </div>
  436. <div class="tab">
  437. <input type="radio" id="tab-4" name="tab-group-1">
  438. <label class="tabber" for="tab-4">CLI</label>
  439. <div class="content">
  440. <div style="margin-top: 24px">
  441. <button class="button" id="cli-matches">Get matches</button>
  442. </div>
  443. </div>
  444. </div>
  445. </div>
  446. </div>
  447. <div id="response"></div>
  448. <div class="bottom">
  449. <a class="dark-link" target="_blank" href="https://tauri.studio">Tauri Documentation</a>&nbsp;&nbsp;&nbsp;
  450. <a class="dark-link" target="_blank" href="https://github.com/tauri-apps/tauri">Github Repo</a>&nbsp;&nbsp;&nbsp;
  451. <a class="dark-link" target="_blank" href="https://github.com/tauri-apps/tauri/tree/dev/tauri/examples/communication">Source for this App</a>
  452. </div>
  453. <script>
  454. function registerResponse(response) {
  455. document.getElementById('response').innerHTML = typeof response === 'object' ?
  456. JSON.stringify(response) :
  457. response
  458. }
  459. function addClickEnterHandler(button, input, handler) {
  460. button.addEventListener('click', handler)
  461. input.addEventListener('keyup', function (e) {
  462. if (e.keyCode === 13) {
  463. handler()
  464. }
  465. })
  466. }
  467. window.__TAURI__.event.listen('rust-event', function (res) {
  468. document.getElementById('response').innerHTML = JSON.stringify(res)
  469. })
  470. document.querySelector('.logo').addEventListener('click', function () {
  471. window.__TAURI__.window.open('https://tauri.studio/')
  472. })
  473. var dirSelect = document.getElementById('dir')
  474. for (var key in window.__TAURI__.fs.Dir) {
  475. if (isNaN(parseInt(key))) {
  476. var value = window.__TAURI__.fs.Dir[key]
  477. var opt = document.createElement("option")
  478. opt.value = value
  479. opt.innerHTML = key
  480. dirSelect.appendChild(opt)
  481. }
  482. }
  483. </script>
  484. <script src="communication.js"></script>
  485. <script src="fs.js"></script>
  486. <script src="window.js"></script>
  487. <script src="dialog.js"></script>
  488. <script src="http.js"></script>
  489. <script src="cli.js"></script>
  490. <script src="notification.js"></script>
  491. </body></html>