mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-22 02:01:49 +03:00
10 lines
10 KiB
JavaScript
10 lines
10 KiB
JavaScript
function w(){}function U(e){return e()}function z(){return Object.create(null)}function K(e){e.forEach(U)}function se(e){return typeof e=="function"}function fe(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function oe(e){return Object.keys(e).length===0}function ae(e,...t){if(e==null)return w;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Ae(e,t,n){e.$$.on_destroy.push(ae(t,n))}function Se(e,t){e.appendChild(t)}function ue(e,t,n){e.insertBefore(t,n||null)}function F(e){e.parentNode.removeChild(e)}function je(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function ce(e){return document.createElement(e)}function G(e){return document.createTextNode(e)}function ke(){return G(" ")}function Me(){return G("")}function Pe(e,t,n,i){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n,i)}function Le(e){return function(t){return t.preventDefault(),e.call(this,t)}}function Te(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Be(e){return e===""?null:+e}function le(e){return Array.from(e.childNodes)}function De(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function He(e,t){e.value=t==null?"":t}function Ne(e,t){for(let n=0;n<e.options.length;n+=1){const i=e.options[n];if(i.__value===t){i.selected=!0;return}}}function qe(e){const t=e.querySelector(":checked")||e.options[0];return t&&t.__value}class Ue{constructor(t=null){this.a=t,this.e=this.n=null}m(t,n,i=null){this.e||(this.e=ce(n.nodeName),this.t=n,this.h(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let n=0;n<this.n.length;n+=1)ue(this.t,this.n[n],t)}p(t){this.d(),this.h(t),this.i(this.a)}d(){this.n.forEach(F)}}let E;function C(e){E=e}function R(){if(!E)throw new Error("Function called outside component initialization");return E}function ze(e){R().$$.on_mount.push(e)}function Fe(e){R().$$.on_destroy.push(e)}const O=[],V=[],A=[],X=[],de=Promise.resolve();let M=!1;function pe(){M||(M=!0,de.then(J))}function P(e){A.push(e)}let L=!1;const T=new Set;function J(){if(!L){L=!0;do{for(let e=0;e<O.length;e+=1){const t=O[e];C(t),he(t.$$)}for(C(null),O.length=0;V.length;)V.pop()();for(let e=0;e<A.length;e+=1){const t=A[e];T.has(t)||(T.add(t),t())}A.length=0}while(O.length);for(;X.length;)X.pop()();M=!1,L=!1,T.clear()}}function he(e){if(e.fragment!==null){e.update(),K(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(P)}}const S=new Set;let b;function Ge(){b={r:0,c:[],p:b}}function Re(){b.r||K(b.c),b=b.p}function me(e,t){e&&e.i&&(S.delete(e),e.i(t))}function Ve(e,t,n,i){if(e&&e.o){if(S.has(e))return;S.add(e),b.c.push(()=>{S.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}}function Xe(e){e&&e.c()}function ye(e,t,n,i){const{fragment:r,on_mount:c,on_destroy:o,after_update:f}=e.$$;r&&r.m(t,n),i||P(()=>{const s=c.map(U).filter(se);o?o.push(...s):K(s),e.$$.on_mount=[]}),f.forEach(P)}function ge(e,t){const n=e.$$;n.fragment!==null&&(K(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function _e(e,t){e.$$.dirty[0]===-1&&(O.push(e),pe(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Je(e,t,n,i,r,c,o=[-1]){const f=E;C(e);const s=e.$$={fragment:null,ctx:null,props:c,update:w,not_equal:r,bound:z(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(f?f.$$.context:[]),callbacks:z(),dirty:o,skip_bound:!1};let l=!1;if(s.ctx=n?n(e,t.props||{},(a,h,...m)=>{const y=m.length?m[0]:h;return s.ctx&&r(s.ctx[a],s.ctx[a]=y)&&(!s.skip_bound&&s.bound[a]&&s.bound[a](y),l&&_e(e,a)),h}):[],s.update(),l=!0,K(s.before_update),s.fragment=i?i(s.ctx):!1,t.target){if(t.hydrate){const a=le(t.target);s.fragment&&s.fragment.l(a),a.forEach(F)}else s.fragment&&s.fragment.c();t.intro&&me(e.$$.fragment),ye(e,t.target,t.anchor,t.customElement),J()}C(f)}class Qe{$destroy(){ge(this,1),this.$destroy=w}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!oe(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const x=[];function We(e,t=w){let n;const i=[];function r(f){if(fe(e,f)&&(e=f,n)){const s=!x.length;for(let l=0;l<i.length;l+=1){const a=i[l];a[1](),x.push(a,e)}if(s){for(let l=0;l<x.length;l+=2)x[l][0](x[l+1]);x.length=0}}}function c(f){r(f(e))}function o(f,s=w){const l=[f,s];return i.push(l),i.length===1&&(n=t(r)||w),f(e),()=>{const a=i.indexOf(l);a!==-1&&i.splice(a,1),i.length===0&&(n(),n=null)}}return{set:r,update:c,subscribe:o}}/*!
|
|
* hotkeys-js v3.8.5
|
|
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
|
|
*
|
|
* Copyright (c) 2021 kenny wong <wowohoo@qq.com>
|
|
* http://jaywcjlove.github.io/hotkeys
|
|
*
|
|
* Licensed under the MIT license.
|
|
*/var B=typeof navigator!="undefined"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function D(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on".concat(t),function(){n(window.event)})}function Q(e,t){for(var n=t.slice(0,t.length-1),i=0;i<n.length;i++)n[i]=e[n[i].toLowerCase()];return n}function W(e){typeof e!="string"&&(e=""),e=e.replace(/\s/g,"");for(var t=e.split(","),n=t.lastIndexOf("");n>=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function be(e,t){for(var n=e.length>=t.length?e:t,i=e.length>=t.length?t:e,r=!0,c=0;c<n.length;c++)i.indexOf(n[c])===-1&&(r=!1);return r}var Y={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,"\u21EA":20,",":188,".":190,"/":191,"`":192,"-":B?173:189,"=":B?61:187,";":B?59:186,"'":222,"[":219,"]":221,"\\":220},v={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,command:91},Z={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},p={16:!1,18:!1,17:!1,91:!1},d={};for(var j=1;j<20;j++)Y["f".concat(j)]=111+j;var u=[],I="all",ee=[],k=function(t){return Y[t.toLowerCase()]||v[t.toLowerCase()]||t.toUpperCase().charCodeAt(0)};function te(e){I=e||"all"}function $(){return I||"all"}function ve(){return u.slice(0)}function we(e){var t=e.target||e.srcElement,n=t.tagName,i=!0;return(t.isContentEditable||(n==="INPUT"||n==="TEXTAREA"||n==="SELECT")&&!t.readOnly)&&(i=!1),i}function xe(e){return typeof e=="string"&&(e=k(e)),u.indexOf(e)!==-1}function Ke(e,t){var n,i;e||(e=$());for(var r in d)if(Object.prototype.hasOwnProperty.call(d,r))for(n=d[r],i=0;i<n.length;)n[i].scope===e?n.splice(i,1):i++;$()===e&&te(t||"all")}function Oe(e){var t=e.keyCode||e.which||e.charCode,n=u.indexOf(t);if(n>=0&&u.splice(n,1),e.key&&e.key.toLowerCase()==="meta"&&u.splice(0,u.length),(t===93||t===224)&&(t=91),t in p){p[t]=!1;for(var i in v)v[i]===t&&(_[i]=!1)}}function $e(e){if(!e)Object.keys(d).forEach(function(o){return delete d[o]});else if(Array.isArray(e))e.forEach(function(o){o.key&&H(o)});else if(typeof e=="object")e.key&&H(e);else if(typeof e=="string"){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];var r=n[0],c=n[1];typeof r=="function"&&(c=r,r=""),H({key:e,scope:r,method:c,splitKey:"+"})}}var H=function(t){var n=t.key,i=t.scope,r=t.method,c=t.splitKey,o=c===void 0?"+":c,f=W(n);f.forEach(function(s){var l=s.split(o),a=l.length,h=l[a-1],m=h==="*"?"*":k(h);if(!!d[m]){i||(i=$());var y=a>1?Q(v,l):[];d[m]=d[m].map(function(g){var re=r?g.method===r:!0;return re&&g.scope===i&&be(g.mods,y)?{}:g})}})};function ne(e,t,n){var i;if(t.scope===n||t.scope==="all"){i=t.mods.length>0;for(var r in p)Object.prototype.hasOwnProperty.call(p,r)&&(!p[r]&&t.mods.indexOf(+r)>-1||p[r]&&t.mods.indexOf(+r)===-1)&&(i=!1);(t.mods.length===0&&!p[16]&&!p[18]&&!p[17]&&!p[91]||i||t.shortcut==="*")&&t.method(e,t)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function ie(e){var t=d["*"],n=e.keyCode||e.which||e.charCode;if(!!_.filter.call(this,e)){if((n===93||n===224)&&(n=91),u.indexOf(n)===-1&&n!==229&&u.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(y){var g=Z[y];e[y]&&u.indexOf(g)===-1?u.push(g):!e[y]&&u.indexOf(g)>-1?u.splice(u.indexOf(g),1):y==="metaKey"&&e[y]&&u.length===3&&(e.ctrlKey||e.shiftKey||e.altKey||(u=u.slice(u.indexOf(g))))}),n in p){p[n]=!0;for(var i in v)v[i]===n&&(_[i]=!0);if(!t)return}for(var r in p)Object.prototype.hasOwnProperty.call(p,r)&&(p[r]=e[Z[r]]);e.getModifierState&&!(e.altKey&&!e.ctrlKey)&&e.getModifierState("AltGraph")&&(u.indexOf(17)===-1&&u.push(17),u.indexOf(18)===-1&&u.push(18),p[17]=!0,p[18]=!0);var c=$();if(t)for(var o=0;o<t.length;o++)t[o].scope===c&&(e.type==="keydown"&&t[o].keydown||e.type==="keyup"&&t[o].keyup)&&ne(e,t[o],c);if(n in d){for(var f=0;f<d[n].length;f++)if((e.type==="keydown"&&d[n][f].keydown||e.type==="keyup"&&d[n][f].keyup)&&d[n][f].key){for(var s=d[n][f],l=s.splitKey,a=s.key.split(l),h=[],m=0;m<a.length;m++)h.push(k(a[m]));h.sort().join("")===u.sort().join("")&&ne(e,s,c)}}}}function Ee(e){return ee.indexOf(e)>-1}function _(e,t,n){u=[];var i=W(e),r=[],c="all",o=document,f=0,s=!1,l=!0,a="+";for(n===void 0&&typeof t=="function"&&(n=t),Object.prototype.toString.call(t)==="[object Object]"&&(t.scope&&(c=t.scope),t.element&&(o=t.element),t.keyup&&(s=t.keyup),t.keydown!==void 0&&(l=t.keydown),typeof t.splitKey=="string"&&(a=t.splitKey)),typeof t=="string"&&(c=t);f<i.length;f++)e=i[f].split(a),r=[],e.length>1&&(r=Q(v,e)),e=e[e.length-1],e=e==="*"?"*":k(e),e in d||(d[e]=[]),d[e].push({keyup:s,keydown:l,scope:c,mods:r,shortcut:i[f],method:n,key:i[f],splitKey:a});typeof o!="undefined"&&!Ee(o)&&window&&(ee.push(o),D(o,"keydown",function(h){ie(h)}),D(window,"focus",function(){u=[]}),D(o,"keyup",function(h){ie(h),Oe(h)}))}var N={setScope:te,getScope:$,deleteScope:Ke,getPressedKeyCodes:ve,isPressed:xe,filter:we,unbind:$e};for(var q in N)Object.prototype.hasOwnProperty.call(N,q)&&(_[q]=N[q]);if(typeof window!="undefined"){var Ce=window.hotkeys;_.noConflict=function(e){return e&&window.hotkeys===_&&(window.hotkeys=Ce),_},window.hotkeys=_}export{Xe as A,ye as B,Ve as C,Re as D,me as E,ge as F,Ge as G,_ as H,Ue as I,Qe as S,ke as a,Te as b,ue as c,Se as d,ce as e,De as f,F as g,Fe as h,Je as i,He as j,je as k,Pe as l,V as m,w as n,ze as o,Le as p,P as q,K as r,fe as s,G as t,Ne as u,qe as v,Be as w,Ae as x,We as y,Me as z};
|