var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function i(t){t.forEach(e)}function o(t){return"function"==typeof t}function r(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function u(e,n,i){e.$$.on_destroy.push(function(e,...n){if(null==e)return t;const i=e.subscribe(...n);return i.unsubscribe?()=>i.unsubscribe():i}(n,i))}function s(t,e){t.appendChild(e)}function a(t,e,n){t.insertBefore(e,n||null)}function c(t){t.parentNode.removeChild(t)}function l(t,e){for(let n=0;nt.removeEventListener(e,n,i)}function m(t){return function(e){return e.preventDefault(),t.call(this,e)}}function v(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function g(t){return""===t?null:+t}function y(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function b(t,e){t.value=null==e?"":e}function _(t,e,n,i){t.style.setProperty(e,n,i?"important":"")}function w(t,e){for(let n=0;n{U.delete(t),i&&(n&&t.d(1),i())})),t.o(e)}}function K(t){t&&t.c()}function B(t,n,r,u){const{fragment:s,on_mount:a,on_destroy:c,after_update:l}=t.$$;s&&s.m(n,r),u||W((()=>{const n=a.map(e).filter(o);c?c.push(...n):i(n),t.$$.on_mount=[]})),l.forEach(W)}function H(t,e){const n=t.$$;null!==n.fragment&&(i(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function G(t,e){-1===t.$$.dirty[0]&&(S.push(t),j||(j=!0,A.then(D)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const o=i.length?i[0]:n;return f.ctx&&s(f.ctx[t],f.ctx[t]=o)&&(!f.skip_bound&&f.bound[t]&&f.bound[t](o),h&&G(e,t)),n})):[],f.update(),h=!0,i(f.before_update),f.fragment=!!u&&u(f.ctx),o.target){if(o.hydrate){const t=function(t){return Array.from(t.childNodes)}(o.target);f.fragment&&f.fragment.l(t),t.forEach(c)}else f.fragment&&f.fragment.c();o.intro&&N(e.$$.fragment),B(e,o.target,o.anchor,o.customElement),D()}C(d)}class J{$destroy(){H(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const X=[];function Y(e,n=t){let i;const o=[];function u(t){if(r(e,t)&&(e=t,i)){const t=!X.length;for(let t=0;t{const t=o.indexOf(a);-1!==t&&o.splice(t,1),0===o.length&&(i(),i=null)}}}} /*! * hotkeys-js v3.8.5 * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * * Copyright (c) 2021 kenny wong * http://jaywcjlove.github.io/hotkeys * * Licensed under the MIT license. */var Q="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function Z(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on".concat(e),(function(){n(window.event)}))}function tt(t,e){for(var n=e.slice(0,e.length-1),i=0;i=0;)e[n-1]+=",",e.splice(n,1),n=e.lastIndexOf("");return e}for(var nt={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":Q?173:189,"=":Q?61:187,";":Q?59:186,"'":222,"[":219,"]":221,"\\":220},it={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},ot={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},rt={16:!1,18:!1,17:!1,91:!1},ut={},st=1;st<20;st++)nt["f".concat(st)]=111+st;var at=[],ct="all",lt=[],dt=function(t){return nt[t.toLowerCase()]||it[t.toLowerCase()]||t.toUpperCase().charCodeAt(0)};function ft(t){ct=t||"all"}function ht(){return ct||"all"}var pt=function(t){var e=t.key,n=t.scope,i=t.method,o=t.splitKey,r=void 0===o?"+":o;et(e).forEach((function(t){var e=t.split(r),o=e.length,u=e[o-1],s="*"===u?"*":dt(u);if(ut[s]){n||(n=ht());var a=o>1?tt(it,e):[];ut[s]=ut[s].map((function(t){return(!i||t.method===i)&&t.scope===n&&function(t,e){for(var n=t.length>=e.length?t:e,i=t.length>=e.length?e:t,o=!0,r=0;r0,rt)Object.prototype.hasOwnProperty.call(rt,o)&&(!rt[o]&&e.mods.indexOf(+o)>-1||rt[o]&&-1===e.mods.indexOf(+o))&&(i=!1);(0!==e.mods.length||rt[16]||rt[18]||rt[17]||rt[91])&&!i&&"*"!==e.shortcut||!1===e.method(t,e)&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function vt(t){var e=ut["*"],n=t.keyCode||t.which||t.charCode;if(gt.filter.call(this,t)){if(93!==n&&224!==n||(n=91),-1===at.indexOf(n)&&229!==n&&at.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach((function(e){var n=ot[e];t[e]&&-1===at.indexOf(n)?at.push(n):!t[e]&&at.indexOf(n)>-1?at.splice(at.indexOf(n),1):"metaKey"===e&&t[e]&&3===at.length&&(t.ctrlKey||t.shiftKey||t.altKey||(at=at.slice(at.indexOf(n))))})),n in rt){for(var i in rt[n]=!0,it)it[i]===n&&(gt[i]=!0);if(!e)return}for(var o in rt)Object.prototype.hasOwnProperty.call(rt,o)&&(rt[o]=t[ot[o]]);t.getModifierState&&(!t.altKey||t.ctrlKey)&&t.getModifierState("AltGraph")&&(-1===at.indexOf(17)&&at.push(17),-1===at.indexOf(18)&&at.push(18),rt[17]=!0,rt[18]=!0);var r=ht();if(e)for(var u=0;u1&&(o=tt(it,t)),(t="*"===(t=t[t.length-1])?"*":dt(t))in ut||(ut[t]=[]),ut[t].push({keyup:a,keydown:c,scope:r,mods:o,shortcut:i[s],method:n,key:i[s],splitKey:l});void 0!==u&&!function(t){return lt.indexOf(t)>-1}(u)&&window&&(lt.push(u),Z(u,"keydown",(function(t){vt(t)})),Z(window,"focus",(function(){at=[]})),Z(u,"keyup",(function(t){vt(t),function(t){var e=t.keyCode||t.which||t.charCode,n=at.indexOf(e);if(n>=0&&at.splice(n,1),t.key&&"meta"===t.key.toLowerCase()&&at.splice(0,at.length),93!==e&&224!==e||(e=91),e in rt)for(var i in rt[e]=!1,it)it[i]===e&&(gt[i]=!1)}(t)})))}var yt={setScope:ft,getScope:ht,deleteScope:function(t,e){var n,i;for(var o in t||(t=ht()),ut)if(Object.prototype.hasOwnProperty.call(ut,o))for(n=ut[o],i=0;i1?e-1:0),i=1;i0&&o[o.length-1])||6!==r[0]&&2!==r[0])){u=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]{n(2,r=t)})),Ft().then((t=>{n(0,i=t)})),Rt().then((t=>{n(1,o=t)})),[i,o,r,async function(){await Ut()},async function(){await It()}]}Object.freeze({__proto__:null,Command:Wt,Child:jt,open:Lt}),Object.freeze({__proto__:null,getName:Dt,getVersion:Ft,getTauriVersion:Rt}),Object.freeze({__proto__:null,exit:Ut,relaunch:It});class Kt extends J{constructor(t){super(),V(this,t,qt,Nt,r,{})}}function Bt(){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(t){return[2,St({__tauriModule:"Cli",message:{cmd:"cliMatches"}})]}))}))}function Ht(e){let n,i,o,r,u,l,m,g,y,b,_;return{c(){n=d("div"),i=f("This binary can be run on the terminal and takes the following arguments:\n "),o=d("ul"),o.innerHTML="
  • --config PATH
  • \n
  • --theme light|dark|system
  • \n
  • --verbose
  • ",r=f("\n Additionally, it has a "),u=d("i"),u.textContent="update --background",l=f(" subcommand.\n Note that the arguments are only parsed, not implemented.\n "),m=d("br"),g=h(),y=d("button"),y.textContent="Get matches",v(y,"class","button"),v(y,"id","cli-matches")},m(t,c){a(t,n,c),s(n,i),s(n,o),s(n,r),s(n,u),s(n,l),s(n,m),s(n,g),s(n,y),b||(_=p(y,"click",e[0]),b=!0)},p:t,i:t,o:t,d(t){t&&c(n),b=!1,_()}}}function Gt(t,e,n){let{onMessage:i}=e;return t.$$set=t=>{"onMessage"in t&&n(1,i=t.onMessage)},[function(){Bt().then(i).catch(i)},i]}Object.freeze({__proto__:null,getMatches:Bt});class Vt extends J{constructor(t){super(),V(this,t,Gt,Ht,r,{onMessage:1})}}function Jt(t,e,n){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(i){switch(i.label){case 0:return[4,St({__tauriModule:"Event",message:{cmd:"emit",event:t,windowLabel:e,payload:n}})];case 1:return i.sent(),[2]}}))}))}function Xt(t){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(e){return[2,St({__tauriModule:"Event",message:{cmd:"unlisten",eventId:t}})]}))}))}function Yt(t,e){return Mt(this,void 0,void 0,(function(){var n=this;return Ct(this,(function(i){return[2,St({__tauriModule:"Event",message:{cmd:"listen",event:t,handler:$t(e)}}).then((function(t){return function(){return Mt(n,void 0,void 0,(function(){return Ct(this,(function(e){return[2,Xt(t)]}))}))}}))]}))}))}function Qt(t,e){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return[2,Yt(t,(function(t){e(t),Xt(t.id).catch((function(){}))}))]}))}))}function Zt(t,e){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return[2,Jt(t,void 0,e)]}))}))}function te(e){let n,o,r,u,l,f,m,g;return{c(){n=d("div"),o=d("button"),o.textContent="Call Log API",r=h(),u=d("button"),u.textContent="Call Request (async) API",l=h(),f=d("button"),f.textContent="Send event to Rust",v(o,"class","button"),v(o,"id","log"),v(u,"class","button"),v(u,"id","request"),v(f,"class","button"),v(f,"id","event")},m(t,i){a(t,n,i),s(n,o),s(n,r),s(n,u),s(n,l),s(n,f),m||(g=[p(o,"click",e[0]),p(u,"click",e[1]),p(f,"click",e[2])],m=!0)},p:t,i:t,o:t,d(t){t&&c(n),m=!1,i(g)}}}function ee(t,e,n){let i,{onMessage:o}=e;return O((async()=>{i=await Yt("rust-event",o)})),T((()=>{i&&i()})),t.$$set=t=>{"onMessage"in t&&n(3,o=t.onMessage)},[function(){Ot("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})},function(){Ot("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(o).catch(o)},function(){Zt("js-event","this is the payload string")},o]}Object.freeze({__proto__:null,listen:Yt,once:Qt,emit:Zt});class ne extends J{constructor(t){super(),V(this,t,ee,te,r,{onMessage:3})}}function ie(t){return void 0===t&&(t={}),Mt(this,void 0,void 0,(function(){return Ct(this,(function(e){return"object"==typeof t&&Object.freeze(t),[2,St({__tauriModule:"Dialog",message:{cmd:"openDialog",options:t}})]}))}))}function oe(t){return void 0===t&&(t={}),Mt(this,void 0,void 0,(function(){return Ct(this,(function(e){return"object"==typeof t&&Object.freeze(t),[2,St({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:t}})]}))}))}function re(t,e){return void 0===e&&(e={}),Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return[2,St({__tauriModule:"Fs",message:{cmd:"readBinaryFile",path:t,options:e}})]}))}))}function ue(t){var e=function(t){if(t.length<65536)return String.fromCharCode.apply(null,Array.from(t));for(var e="",n=t.length,i=0;i{"onMessage"in t&&n(6,i=t.onMessage)},[o,r,u,s,function(){ie({defaultPath:o,filters:r?[{name:"Tauri Example",extensions:r.split(",").map((t=>t.trim()))}]:[],multiple:u,directory:s}).then((function(t){if(Array.isArray(t))i(t);else{var e=t,n=e.match(/\S+\.\S+$/g);re(e).then((function(o){var r,u,s,a;n&&(e.includes(".png")||e.includes(".jpg"))?(r=new Uint8Array(o),u=function(t){i('')},s=new Blob([r],{type:"application/octet-binary"}),(a=new FileReader).onload=function(t){var e=t.target.result;u(e.substr(e.indexOf(",")+1))},a.readAsDataURL(s)):i(t)})).catch(i(t))}})).catch(i)},function(){oe({defaultPath:o,filters:r?[{name:"Tauri Example",extensions:r.split(",").map((t=>t.trim()))}]:[]}).then(i).catch(i)},i,function(){o=this.value,n(0,o)},function(){r=this.value,n(1,r)},function(){u=this.checked,n(2,u)},function(){s=this.checked,n(3,s)}]}Object.freeze({__proto__:null,open:ie,save:oe}),function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Desktop=6]="Desktop",t[t.Document=7]="Document",t[t.Download=8]="Download",t[t.Executable=9]="Executable",t[t.Font=10]="Font",t[t.Home=11]="Home",t[t.Picture=12]="Picture",t[t.Public=13]="Public",t[t.Runtime=14]="Runtime",t[t.Template=15]="Template",t[t.Video=16]="Video",t[t.Resource=17]="Resource",t[t.App=18]="App",t[t.Current=19]="Current"}(Pt||(Pt={})),Object.freeze({__proto__:null,get BaseDirectory(){return Pt},get Dir(){return Pt},readTextFile:function(t,e){return void 0===e&&(e={}),Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return[2,St({__tauriModule:"Fs",message:{cmd:"readTextFile",path:t,options:e}})]}))}))},readBinaryFile:re,writeFile:function(t,e){return void 0===e&&(e={}),Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return"object"==typeof e&&Object.freeze(e),"object"==typeof t&&Object.freeze(t),[2,St({__tauriModule:"Fs",message:{cmd:"writeFile",path:t.path,contents:t.contents,options:e}})]}))}))},writeBinaryFile:function(t,e){return void 0===e&&(e={}),Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return"object"==typeof e&&Object.freeze(e),"object"==typeof t&&Object.freeze(t),[2,St({__tauriModule:"Fs",message:{cmd:"writeBinaryFile",path:t.path,contents:ue(t.contents),options:e}})]}))}))},readDir:se,createDir:function(t,e){return void 0===e&&(e={}),Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return[2,St({__tauriModule:"Fs",message:{cmd:"createDir",path:t,options:e}})]}))}))},removeDir:function(t,e){return void 0===e&&(e={}),Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return[2,St({__tauriModule:"Fs",message:{cmd:"removeDir",path:t,options:e}})]}))}))},copyFile:function(t,e,n){return void 0===n&&(n={}),Mt(this,void 0,void 0,(function(){return Ct(this,(function(i){return[2,St({__tauriModule:"Fs",message:{cmd:"copyFile",source:t,destination:e,options:n}})]}))}))},removeFile:function(t,e){return void 0===e&&(e={}),Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return[2,St({__tauriModule:"Fs",message:{cmd:"removeFile",path:t,options:e}})]}))}))},renameFile:function(t,e,n){return void 0===n&&(n={}),Mt(this,void 0,void 0,(function(){return Ct(this,(function(i){return[2,St({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:e,options:n}})]}))}))}});class le extends J{constructor(t){var e;super(),document.getElementById("svelte-1eg58yg-style")||((e=d("style")).id="svelte-1eg58yg-style",e.textContent="#dialog-filter.svelte-1eg58yg{width:260px}",s(document.head,e)),V(this,t,ce,ae,r,{onMessage:6})}}function de(t,e,n){const i=t.slice();return i[8]=e[n],i}function fe(e){let n,i,o=e[8][0]+"";return{c(){n=d("option"),i=f(o),n.__value=e[8][1],n.value=n.__value},m(t,e){a(t,n,e),s(n,i)},p:t,d(t){t&&c(n)}}}function he(e){let n,o,r,u,f,g,y,_,w,x,k,M,C,$=e[2],O=[];for(let t=0;t<$.length;t+=1)O[t]=fe(de(e,$,t));return{c(){n=d("form"),o=d("select"),r=d("option"),r.textContent="None";for(let t=0;tisNaN(parseInt(t)))).map((t=>[t,Pt[t]]));return t.$$set=t=>{"onMessage"in t&&n(5,o=t.onMessage)},[r,i,u,function(){const t=r.match(/\S+\.\S+$/g),e={dir:pe()};(t?re(r,e):se(r,e)).then((function(e){if(t)if(r.includes(".png")||r.includes(".jpg"))!function(t,e){const n=new Blob([t],{type:"application/octet-binary"}),i=new FileReader;i.onload=function(t){const n=t.target.result;e(n.substr(n.indexOf(",")+1))},i.readAsDataURL(n)}(new Uint8Array(e),(function(t){o('')}));else{const t=String.fromCharCode.apply(null,e);o(''),setTimeout((()=>{const e=document.getElementById("file-response");e.value=t,document.getElementById("file-save").addEventListener("click",(function(){writeFile({file:r,contents:e.value},{dir:pe()}).catch(o)}))}))}else o(e)})).catch(o)},function(){n(1,i.src=Tt(r),i)},o,function(){r=this.value,n(0,r)},function(t){E[t?"unshift":"push"]((()=>{i=t,n(1,i)}))}]}class ve extends J{constructor(t){super(),V(this,t,me,he,r,{onMessage:5})}}!function(t){t[t.JSON=1]="JSON",t[t.Text=2]="Text",t[t.Binary=3]="Binary"}(zt||(zt={}));var ge=function(){function t(t,e){this.type=t,this.payload=e}return t.form=function(e){return new t("Form",e)},t.json=function(e){return new t("Json",e)},t.text=function(e){return new t("Text",e)},t.bytes=function(e){return new t("Bytes",e)},t}(),ye=function(t){this.url=t.url,this.status=t.status,this.ok=this.status>=200&&this.status<300,this.headers=t.headers,this.data=t.data},be=function(){function t(t){this.id=t}return t.prototype.drop=function(){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(t){return[2,St({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})]}))}))},t.prototype.request=function(t){return Mt(this,void 0,void 0,(function(){var e;return Ct(this,(function(n){return(e=!t.responseType||t.responseType===zt.JSON)&&(t.responseType=zt.Text),[2,St({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:t}}).then((function(t){var n=new ye(t);if(e){try{n.data=JSON.parse(n.data)}catch(t){if(n.ok)throw Error("Failed to parse response `"+n.data+"` as JSON: "+t+";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response.")}return n}return n}))]}))}))},t.prototype.get=function(t,e){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return[2,this.request(kt({method:"GET",url:t},e))]}))}))},t.prototype.post=function(t,e,n){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(i){return[2,this.request(kt({method:"POST",url:t,body:e},n))]}))}))},t.prototype.put=function(t,e,n){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(i){return[2,this.request(kt({method:"PUT",url:t,body:e},n))]}))}))},t.prototype.patch=function(t,e){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return[2,this.request(kt({method:"PATCH",url:t},e))]}))}))},t.prototype.delete=function(t,e){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return[2,this.request(kt({method:"DELETE",url:t},e))]}))}))},t}();function _e(t){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(e){return[2,St({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then((function(t){return new be(t)}))]}))}))}var we=null;function xe(e){let n,o,r,u,l,f,g,y,x,k,M,C,$,O,T,S,E;return{c(){n=d("form"),o=d("select"),r=d("option"),r.textContent="GET",u=d("option"),u.textContent="POST",l=d("option"),l.textContent="PUT",f=d("option"),f.textContent="PATCH",g=d("option"),g.textContent="DELETE",y=h(),x=d("input"),k=h(),M=d("br"),C=h(),$=d("textarea"),O=h(),T=d("button"),T.textContent="Make request",r.__value="GET",r.value=r.__value,u.__value="POST",u.value=u.__value,l.__value="PUT",l.value=l.__value,f.__value="PATCH",f.value=f.__value,g.__value="DELETE",g.value=g.__value,v(o,"class","button"),v(o,"id","request-method"),void 0===e[0]&&W((()=>e[5].call(o))),v(x,"id","request-url"),v(x,"placeholder","Type the request URL..."),v($,"id","request-body"),v($,"placeholder","Request body"),v($,"rows","5"),_($,"width","100%"),_($,"margin-right","10px"),_($,"font-size","12px"),v(T,"class","button"),v(T,"id","make-request")},m(t,i){a(t,n,i),s(n,o),s(o,r),s(o,u),s(o,l),s(o,f),s(o,g),w(o,e[0]),s(n,y),s(n,x),b(x,e[1]),s(n,k),s(n,M),s(n,C),s(n,$),b($,e[2]),s(n,O),s(n,T),S||(E=[p(o,"change",e[5]),p(x,"input",e[6]),p($,"input",e[7]),p(n,"submit",m(e[3]))],S=!0)},p(t,[e]){1&e&&w(o,t[0]),2&e&&x.value!==t[1]&&b(x,t[1]),4&e&&b($,t[2])},i:t,o:t,d(t){t&&c(n),S=!1,i(E)}}}function ke(t,e,n){let i="GET",o="https://jsonplaceholder.typicode.com/todos/1",r="",{onMessage:u}=e;return t.$$set=t=>{"onMessage"in t&&n(4,u=t.onMessage)},[i,o,r,async function(){const t=await _e(),e={url:o||""||"",method:i||"GET"||"GET"};r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]")?e.body=ge.json(JSON.parse(r)):""!==r&&(e.body=ge.text(r)),t.request(e).then(u).catch(u)},u,function(){i=x(this),n(0,i)},function(){o=this.value,n(1,o)},function(){r=this.value,n(2,r)}]}Object.freeze({__proto__:null,getClient:_e,fetch:function(t,e){var n;return Mt(this,void 0,void 0,(function(){return Ct(this,(function(i){switch(i.label){case 0:return null!==we?[3,2]:[4,_e()];case 1:we=i.sent(),i.label=2;case 2:return[2,we.request(kt({url:t,method:null!==(n=null==e?void 0:e.method)&&void 0!==n?n:"GET"},e))]}}))}))},Body:ge,Client:be,Response:ye,get ResponseType(){return zt}});class Me extends J{constructor(t){super(),V(this,t,ke,xe,r,{onMessage:4})}}function Ce(e){let n,i,o;return{c(){n=d("button"),n.textContent="Send test notification",v(n,"class","button"),v(n,"id","notification")},m(t,r){a(t,n,r),i||(o=p(n,"click",e[0]),i=!0)},p:t,i:t,o:t,d(t){t&&c(n),i=!1,o()}}}function $e(){new Notification("Notification title",{body:"This is the notification body"})}function Oe(t,e,n){let{onMessage:i}=e;return t.$$set=t=>{"onMessage"in t&&n(1,i=t.onMessage)},[function(){"default"===Notification.permission?Notification.requestPermission().then((function(t){"granted"===t?$e():i("Permission is "+t)})).catch(i):"granted"===Notification.permission?$e():i("Permission is denied")},i]}class Te extends J{constructor(t){super(),V(this,t,Oe,Ce,r,{onMessage:1})}}var Se,Ee=function(t,e){this.type="Logical",this.width=t,this.height=e},Pe=function(){function t(t,e){this.type="Physical",this.width=t,this.height=e}return t.prototype.toLogical=function(t){return new Ee(this.width/t,this.height/t)},t}(),ze=function(t,e){this.type="Logical",this.x=t,this.y=e},Ae=function(){function t(t,e){this.type="Physical",this.x=t,this.y=e}return t.prototype.toLogical=function(t){return new ze(this.x/t,this.y/t)},t}();function je(){return new Re(window.__TAURI__.__currentWindow.label,{skip:!0})}function We(){return window.__TAURI__.__windows.map((function(t){return new Re(t,{skip:!0})}))}!function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"}(Se||(Se={}));var Le=["tauri://created","tauri://error"],Fe=function(){function t(t){this.label=t,this.listeners=Object.create(null)}return t.prototype.listen=function(t,e){return Mt(this,void 0,void 0,(function(){var n=this;return Ct(this,(function(i){return this._handleTauriEvent(t,e)?[2,Promise.resolve((function(){var i=n.listeners[t];i.splice(i.indexOf(e),1)}))]:[2,Yt(t,e)]}))}))},t.prototype.once=function(t,e){return Mt(this,void 0,void 0,(function(){var n=this;return Ct(this,(function(i){return this._handleTauriEvent(t,e)?[2,Promise.resolve((function(){var i=n.listeners[t];i.splice(i.indexOf(e),1)}))]:[2,Qt(t,e)]}))}))},t.prototype.emit=function(t,e){return Mt(this,void 0,void 0,(function(){var n,i;return Ct(this,(function(o){if(Le.includes(t)){for(n=0,i=this.listeners[t]||[];ne[26].call(o))),v(x,"type","checkbox"),v($,"type","checkbox"),v(S,"title","Unminimizes after 2 seconds"),v(P,"title","Unminimizes after 2 seconds"),v(A,"title","Visible again after 2 seconds"),v(F,"type","checkbox"),v(I,"type","checkbox"),v(B,"type","checkbox"),v(J,"type","checkbox"),v(rt,"type","number"),v(rt,"min","0"),v(rt,"class","svelte-b76pvm"),v(ct,"type","number"),v(ct,"min","0"),v(ct,"class","svelte-b76pvm"),v(nt,"class","flex col grow svelte-b76pvm"),v(pt,"type","number"),v(pt,"min","400"),v(pt,"class","svelte-b76pvm"),v(yt,"type","number"),v(yt,"min","400"),v(yt,"class","svelte-b76pvm"),v(dt,"class","flex col grow svelte-b76pvm"),v(kt,"type","number"),v(kt,"class","svelte-b76pvm"),v(Ot,"type","number"),v(Ot,"class","svelte-b76pvm"),v(_t,"class","flex col grow svelte-b76pvm"),v(zt,"type","number"),v(zt,"min","400"),v(zt,"class","svelte-b76pvm"),v(Lt,"type","number"),v(Lt,"min","400"),v(Lt,"class","svelte-b76pvm"),v(St,"class","flex col grow svelte-b76pvm"),v(et,"class","window-controls flex flex-row svelte-b76pvm"),v(n,"class","flex col"),v(Rt,"id","title"),v(It,"class","button"),v(It,"type","submit"),_(Dt,"margin-top","24px"),v(Kt,"id","url"),v(Ht,"class","button"),v(Ht,"id","open-url"),_(qt,"margin-top","24px"),v(Vt,"class","button"),v(Vt,"title","Minimizes the window, requests attention for 3s and then resets it"),v(Xt,"class","button")},m(t,i){a(t,n,i),s(n,o);for(let t=0;t{"onMessage"in t&&n(25,r=t.onMessage)},t.$$.update=()=>{7&t.$$.dirty[0]&&o[i].setResizable(s),11&t.$$.dirty[0]&&(a?o[i].maximize():o[i].unmaximize()),19&t.$$.dirty[0]&&o[i].setDecorations(l),35&t.$$.dirty[0]&&o[i].setAlwaysOnTop(d),67&t.$$.dirty[0]&&o[i].setFullscreen(f),387&t.$$.dirty[0]&&o[i].setSize(new Ee(h,p)),1539&t.$$.dirty[0]&&(m&&v?o[i].setMinSize(new Ee(m,v)):o[i].setMinSize(null)),6147&t.$$.dirty[0]&&(y&&b?o[i].setMaxSize(new Ee(y,b)):o[i].setMaxSize(null)),24579&t.$$.dirty[0]&&o[i].setPosition(new ze(_,w))},[i,o,s,a,l,d,f,h,p,m,v,y,b,_,w,u,c,k,function(){Lt(u)},function(){o[i].setTitle(k)},function(){o[i].hide(),setTimeout(o[i].show,2e3)},function(){o[i].minimize(),setTimeout(o[i].unminimize,2e3)},function(){ie({multiple:!1}).then(o[i].setIcon)},function(){const t=Math.random().toString(),e=new Re(t);n(1,o[t]=e,o),e.once("tauri://error",(function(){r("Error creating new webview")}))},async function(){await o[i].minimize(),await o[i].requestUserAttention(Se.Critical),await new Promise((t=>setTimeout(t,3e3))),await o[i].requestUserAttention(null)},r,function(){i=x(this),n(0,i),n(1,o)},function(){s=this.checked,n(2,s)},function(){a=this.checked,n(3,a)},()=>o[i].center(),function(){c=this.checked,n(16,c)},function(){l=this.checked,n(4,l)},function(){d=this.checked,n(5,d)},function(){f=this.checked,n(6,f)},function(){_=g(this.value),n(13,_)},function(){w=g(this.value),n(14,w)},function(){h=g(this.value),n(7,h)},function(){p=g(this.value),n(8,p)},function(){m=g(this.value),n(9,m)},function(){v=g(this.value),n(10,v)},function(){y=g(this.value),n(11,y)},function(){b=g(this.value),n(12,b)},function(){k=this.value,n(17,k)},function(){u=this.value,n(15,u)}]}Object.freeze({__proto__:null,WebviewWindow:Re,WebviewWindowHandle:Fe,WindowManager:De,getCurrent:je,getAll:We,appWindow:Ue,LogicalSize:Ee,PhysicalSize:Pe,LogicalPosition:ze,PhysicalPosition:Ae,get UserAttentionType(){return Se},currentMonitor:function(){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(t){return[2,St({__tauriModule:"Window",message:{cmd:"currentMonitor"}})]}))}))},primaryMonitor:function(){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(t){return[2,St({__tauriModule:"Window",message:{cmd:"primaryMonitor"}})]}))}))},availableMonitors:function(){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(t){return[2,St({__tauriModule:"Window",message:{cmd:"availableMonitors"}})]}))}))}});class Be extends J{constructor(t){var e;super(),document.getElementById("svelte-b76pvm-style")||((e=d("style")).id="svelte-b76pvm-style",e.textContent=".flex-row.svelte-b76pvm.svelte-b76pvm{flex-direction:row}.grow.svelte-b76pvm.svelte-b76pvm{flex-grow:1}.window-controls.svelte-b76pvm input.svelte-b76pvm{width:50px}",s(document.head,e)),V(this,t,Ke,qe,r,{onMessage:25},[-1,-1])}}function He(t,e){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return[2,St({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:$t(e)}})]}))}))}function Ge(t){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(e){return[2,St({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}})]}))}))}function Ve(){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(t){return[2,St({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}})]}))}))}function Je(t,e,n){const i=t.slice();return i[9]=e[n],i}function Xe(t){let e,n,i,o,r,u,l=t[9]+"";function m(){return t[8](t[9])}return{c(){e=d("div"),n=f(l),i=h(),o=d("button"),o.textContent="Unregister",v(o,"type","button")},m(t,c){a(t,e,c),s(e,n),s(e,i),s(e,o),r||(u=p(o,"click",m),r=!0)},p(e,i){t=e,2&i&&l!==(l=t[9]+"")&&y(n,l)},d(t){t&&c(e),r=!1,u()}}}function Ye(e){let n,i,o;return{c(){n=d("button"),n.textContent="Unregister all",v(n,"type","button")},m(t,r){a(t,n,r),i||(o=p(n,"click",e[5]),i=!0)},p:t,d(t){t&&c(n),i=!1,o()}}}function Qe(e){let n,o,r,u,f,m,g,y,_,w,x=e[1],k=[];for(let t=0;tn(1,i=t)));let s="CmdOrControl+X";function a(t){const e=t;Ge(e).then((()=>{r.update((t=>t.filter((t=>t!==e)))),o(`Shortcut ${e} unregistered`)})).catch(o)}return t.$$set=t=>{"onMessage"in t&&n(6,o=t.onMessage)},[s,i,r,function(){const t=s;He(t,(()=>{o(`Shortcut ${t} triggered`)})).then((()=>{r.update((e=>[...e,t])),o(`Shortcut ${t} registered successfully`)})).catch(o)},a,function(){Ve().then((()=>{r.update((()=>[])),o("Unregistered all shortcuts")})).catch(o)},o,function(){s=this.value,n(0,s)},t=>a(t)]}Object.freeze({__proto__:null,register:He,registerAll:function(t,e){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(n){return[2,St({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:t,handler:$t(e)}})]}))}))},isRegistered:function(t){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(e){return[2,St({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:t}})]}))}))},unregister:Ge,unregisterAll:Ve});class tn extends J{constructor(t){super(),V(this,t,Ze,Qe,r,{onMessage:6})}}function en(t){let e,n,o,r,u;return{c(){e=d("input"),n=h(),o=d("button"),o.textContent="Write",v(e,"placeholder","write to stdin"),v(o,"class","button")},m(i,s){a(i,e,s),b(e,t[3]),a(i,n,s),a(i,o,s),r||(u=[p(e,"input",t[10]),p(o,"click",t[7])],r=!0)},p(t,n){8&n&&e.value!==t[3]&&b(e,t[3])},d(t){t&&c(e),t&&c(n),t&&c(o),r=!1,i(u)}}}function nn(e){let n,o,r,u,l,f,m,g,y,w,x,k,M,C,$,O=e[4]&&en(e);return{c(){n=d("div"),o=d("div"),r=d("input"),u=h(),l=d("button"),l.textContent="Run",f=h(),m=d("button"),m.textContent="Kill",g=h(),O&&O.c(),y=h(),w=d("div"),x=d("input"),k=h(),M=d("input"),v(l,"class","button"),v(m,"class","button"),v(x,"placeholder","Working directory"),v(M,"placeholder","Environment variables"),_(M,"width","300px")},m(t,i){a(t,n,i),s(n,o),s(o,r),b(r,e[0]),s(o,u),s(o,l),s(o,f),s(o,m),s(o,g),O&&O.m(o,null),s(n,y),s(n,w),s(w,x),b(x,e[1]),s(w,k),s(w,M),b(M,e[2]),C||($=[p(r,"input",e[9]),p(l,"click",e[5]),p(m,"click",e[6]),p(x,"input",e[11]),p(M,"input",e[12])],C=!0)},p(t,[e]){1&e&&r.value!==t[0]&&b(r,t[0]),t[4]?O?O.p(t,e):(O=en(t),O.c(),O.m(o,null)):O&&(O.d(1),O=null),2&e&&x.value!==t[1]&&b(x,t[1]),4&e&&M.value!==t[2]&&b(M,t[2])},i:t,o:t,d(t){t&&c(n),O&&O.d(),C=!1,i($)}}}function on(t,e,n){const i=navigator.userAgent.includes("Windows");let o,r=i?"cmd":"sh",u=i?["/C"]:["-c"],{onMessage:s}=e,a='echo "hello world"',c=null,l="SOMETHING=value ANOTHER=2",d="";return t.$$set=t=>{"onMessage"in t&&n(8,s=t.onMessage)},[a,c,l,d,o,function(){n(4,o=null);const t=new Wt(r,[...u,a],{cwd:c||null,env:l.split(" ").reduce(((t,e)=>{let[n,i]=e.split("=");return{...t,[n]:i}}),{})});t.on("close",(t=>{s(`command finished with code ${t.code} and signal ${t.signal}`),n(4,o=null)})),t.on("error",(t=>s(`command error: "${t}"`))),t.stdout.on("data",(t=>s(`command stdout: "${t}"`))),t.stderr.on("data",(t=>s(`command stderr: "${t}"`))),t.spawn().then((t=>{n(4,o=t)})).catch(s)},function(){o.kill().then((()=>s("killed child process"))).catch(s)},function(){o.write(d).catch(s)},s,function(){a=this.value,n(0,a)},function(){d=this.value,n(3,d)},function(){c=this.value,n(1,c)},function(){l=this.value,n(2,l)}]}class rn extends J{constructor(t){super(),V(this,t,on,nn,r,{onMessage:8})}}function un(){return Mt(this,void 0,void 0,(function(){function t(){e&&e(),e=void 0}var e;return Ct(this,(function(n){return[2,new Promise((function(n,i){Yt("tauri://update-status",(function(e){var o;(o=null==e?void 0:e.payload).error?(t(),i(o.error)):"DONE"===o.status&&(t(),n())})).then((function(t){e=t})).catch((function(e){throw t(),e})),Zt("tauri://update-install").catch((function(e){throw t(),e}))}))]}))}))}function sn(){return Mt(this,void 0,void 0,(function(){function t(){e&&e(),e=void 0}var e;return Ct(this,(function(n){return[2,new Promise((function(n,i){Qt("tauri://update-available",(function(e){var i;i=null==e?void 0:e.payload,t(),n({manifest:i,shouldUpdate:!0})})).catch((function(e){throw t(),e})),Yt("tauri://update-status",(function(e){var o;(o=null==e?void 0:e.payload).error?(t(),i(o.error)):"UPTODATE"===o.status&&(t(),n({shouldUpdate:!1}))})).then((function(t){e=t})).catch((function(e){throw t(),e})),Zt("tauri://update").catch((function(e){throw t(),e}))}))]}))}))}function an(e){let n,o,r,u,l,f;return{c(){n=d("div"),o=d("button"),o.textContent="Check update",r=h(),u=d("button"),u.textContent="Install update",v(o,"class","button"),v(o,"id","check_update"),v(u,"class","button hidden"),v(u,"id","start_update")},m(t,i){a(t,n,i),s(n,o),s(n,r),s(n,u),l||(f=[p(o,"click",e[0]),p(u,"click",e[1])],l=!0)},p:t,i:t,o:t,d(t){t&&c(n),l=!1,i(f)}}}function cn(t,e,n){let i,{onMessage:o}=e;return O((async()=>{i=await Yt("tauri://update-status",o)})),T((()=>{i&&i()})),t.$$set=t=>{"onMessage"in t&&n(2,o=t.onMessage)},[async function(){try{document.getElementById("check_update").classList.add("hidden");const{shouldUpdate:t,manifest:e}=await sn();o(`Should update: ${t}`),o(e),t&&document.getElementById("start_update").classList.remove("hidden")}catch(t){o(t)}},async function(){try{document.getElementById("start_update").classList.add("hidden"),await un(),o("Installation complete, restart required."),await It()}catch(t){o(t)}},o]}Object.freeze({__proto__:null,installUpdate:un,checkUpdate:sn});class ln extends J{constructor(t){super(),V(this,t,cn,an,r,{onMessage:2})}}function dn(e){let n,o,r,u,l,f,m,g,y;return{c(){n=d("div"),o=d("div"),r=d("input"),u=h(),l=d("button"),l.textContent="Write",f=h(),m=d("button"),m.textContent="Read",v(r,"placeholder","Text to write to the clipboard"),v(l,"type","button"),v(m,"type","button")},m(t,i){a(t,n,i),s(n,o),s(o,r),b(r,e[0]),s(o,u),s(o,l),s(n,f),s(n,m),g||(y=[p(r,"input",e[4]),p(l,"click",e[1]),p(m,"click",e[2])],g=!0)},p(t,[e]){1&e&&r.value!==t[0]&&b(r,t[0])},i:t,o:t,d(t){t&&c(n),g=!1,i(y)}}}function fn(t,e,n){let{onMessage:i}=e,o="clipboard message";return t.$$set=t=>{"onMessage"in t&&n(3,i=t.onMessage)},[o,function(){(function(t){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(e){return[2,St({__tauriModule:"Clipboard",message:{cmd:"writeText",data:t}})]}))}))})(o).then((()=>{i("Wrote to the clipboard")})).catch(i)},function(){(function(){return Mt(this,void 0,void 0,(function(){return Ct(this,(function(t){return[2,St({__tauriModule:"Clipboard",message:{cmd:"readText"}})]}))}))})().then((t=>{i(`Clipboard contents: ${t}`)})).catch(i)},i,function(){o=this.value,n(0,o)}]}class hn extends J{constructor(t){super(),V(this,t,fn,dn,r,{onMessage:3})}}function pn(t,e,n){const i=t.slice();return i[9]=e[n],i}function mn(t){let e,n,i,o,r,u,l=t[9].label+"";function m(){return t[7](t[9])}return{c(){e=d("p"),n=f(l),i=h(),v(e,"class",o="nv noselect "+(t[0]===t[9]?"nv_selected":""))},m(t,o){a(t,e,o),s(e,n),s(e,i),r||(u=p(e,"click",m),r=!0)},p(n,i){t=n,1&i&&o!==(o="nv noselect "+(t[0]===t[9]?"nv_selected":""))&&v(e,"class",o)},d(t){t&&c(e),r=!1,u()}}}function vn(t){let e,n,o,r,u,f,m,g,y,b,w,x,M,C,$,O,T,S,E,P,z,A,j,W=t[2],L=[];for(let e=0;eDocumentation \n Github \n Source',m=h(),g=d("div"),y=d("div");for(let t=0;t{H(t,1)})),I.r||i(I.c),I=I.p}F?(x=new F(D(t)),K(x.$$.fragment),N(x.$$.fragment,1),B(x,w,null)):x=null}(!z||2&e)&&P.p(t[1])},i(t){z||(x&&N(x.$$.fragment,t),z=!0)},o(t){x&&q(x.$$.fragment,t),z=!1},d(t){t&&c(e),l(L,t),x&&H(x),A=!1,i(j)}}}function gn(t,e,n){O((()=>{gt("ctrl+b",(()=>{Ot("menu_toggle")}))}));const i=[{label:"Welcome",component:Kt},{label:"Messages",component:ne},{label:"CLI",component:Vt},{label:"Dialog",component:le},{label:"File system",component:ve},{label:"HTTP",component:Me},{label:"Notifications",component:Te},{label:"Window",component:Be},{label:"Shortcuts",component:tn},{label:"Shell",component:rn},{label:"Updater",component:ln},{label:"Clipboard",component:hn}];let o=i[0],r=Y([]),u="";function s(t){n(0,o=t)}O((()=>{r.subscribe((t=>{n(1,u=t.join("\n"))}))}));return[o,u,i,r,s,function(t){r.update((e=>[`[${(new Date).toLocaleTimeString()}]: `+("string"==typeof t?t:JSON.stringify(t)),...e]))},function(){Lt("https://tauri.studio/")},t=>s(t),()=>{r.update((()=>[]))}]}return new class extends J{constructor(t){super(),V(this,t,gn,vn,r,{})}}({target:document.body})}(); //# sourceMappingURL=bundle.js.map