1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-05-28 23:41:32 +00:00
8bitworkshop/gen/chunk-XMPGMPQ4.js

3 lines
5.2 KiB
JavaScript

import{b as G}from"./chunk-RQFURXHW.js";var J=G((W,w)=>{(function(m,M,Q){if(!m)return;for(var v={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},E={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},q={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},T={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},k,c=1;c<20;++c)v[111+c]="f"+c;for(c=0;c<=9;++c)v[c+96]=c.toString();function K(e,r,n){if(e.addEventListener){e.addEventListener(r,n,!1);return}e.attachEvent("on"+r,n)}function x(e){if(e.type=="keypress"){var r=String.fromCharCode(e.which);return e.shiftKey||(r=r.toLowerCase()),r}return v[e.which]?v[e.which]:E[e.which]?E[e.which]:String.fromCharCode(e.which).toLowerCase()}function R(e,r){return e.sort().join(",")===r.sort().join(",")}function F(e){var r=[];return e.shiftKey&&r.push("shift"),e.altKey&&r.push("alt"),e.ctrlKey&&r.push("ctrl"),e.metaKey&&r.push("meta"),r}function B(e){if(e.preventDefault){e.preventDefault();return}e.returnValue=!1}function N(e){if(e.stopPropagation){e.stopPropagation();return}e.cancelBubble=!0}function P(e){return e=="shift"||e=="ctrl"||e=="alt"||e=="meta"}function V(){if(!k){k={};for(var e in v)e>95&&e<112||v.hasOwnProperty(e)&&(k[v[e]]=e)}return k}function H(e,r,n){return n||(n=V()[e]?"keydown":"keypress"),n=="keypress"&&r.length&&(n="keydown"),n}function U(e){return e==="+"?["+"]:(e=e.replace(/\+{2}/g,"+plus"),e.split("+"))}function L(e,r){var n,o,h,y=[];for(n=U(e),h=0;h<n.length;++h)o=n[h],T[o]&&(o=T[o]),r&&r!="keypress"&&q[o]&&(o=q[o],y.push("shift")),P(o)&&y.push(o);return r=H(o,y,r),{key:o,modifiers:y,action:r}}function I(e,r){return e===null||e===M?!1:e===r?!0:I(e.parentNode,r)}function l(e){var r=this;if(e=e||M,!(r instanceof l))return new l(e);r.target=e,r._callbacks={},r._directMap={};var n={},o,h=!1,y=!1,S=!1;function b(t){t=t||{};var f=!1,s;for(s in n){if(t[s]){f=!0;continue}n[s]=0}f||(S=!1)}function D(t,f,s,i,u,d){var a,p,g=[],_=s.type;if(!r._callbacks[t])return[];for(_=="keyup"&&P(t)&&(f=[t]),a=0;a<r._callbacks[t].length;++a)if(p=r._callbacks[t][a],!(!i&&p.seq&&n[p.seq]!=p.level)&&_==p.action&&(_=="keypress"&&!s.metaKey&&!s.ctrlKey||R(f,p.modifiers))){var $=!i&&p.combo==u,z=i&&p.seq==i&&p.level==d;($||z)&&r._callbacks[t].splice(a,1),g.push(p)}return g}function C(t,f,s,i){r.stopCallback(f,f.target||f.srcElement,s,i)||t(f,s)===!1&&(B(f),N(f))}r._handleKey=function(t,f,s){var i=D(t,f,s),u,d={},a=0,p=!1;for(u=0;u<i.length;++u)i[u].seq&&(a=Math.max(a,i[u].level));for(u=0;u<i.length;++u){if(i[u].seq){if(i[u].level!=a)continue;p=!0,d[i[u].seq]=1,C(i[u].callback,s,i[u].combo,i[u].seq);continue}p||C(i[u].callback,s,i[u].combo)}var g=s.type=="keypress"&&y;s.type==S&&!P(t)&&!g&&b(d),y=p&&s.type=="keydown"};function A(t){typeof t.which!="number"&&(t.which=t.keyCode);var f=x(t);if(!!f){if(t.type=="keyup"&&h===f){h=!1;return}r.handleKey(f,F(t),t)}}function X(){clearTimeout(o),o=setTimeout(b,1e3)}function Y(t,f,s,i){n[t]=0;function u(_){return function(){S=_,++n[t],X()}}function d(_){C(s,_,t),i!=="keyup"&&(h=x(_)),setTimeout(b,10)}for(var a=0;a<f.length;++a){var p=a+1===f.length,g=p?d:u(i||L(f[a+1]).action);O(f[a],g,i,t,a)}}function O(t,f,s,i,u){r._directMap[t+":"+s]=f,t=t.replace(/\s+/g," ");var d=t.split(" "),a;if(d.length>1){Y(t,d,f,s);return}a=L(t,s),r._callbacks[a.key]=r._callbacks[a.key]||[],D(a.key,a.modifiers,{type:a.action},i,t,u),r._callbacks[a.key][i?"unshift":"push"]({callback:f,modifiers:a.modifiers,action:a.action,seq:i,level:u,combo:t})}r._bindMultiple=function(t,f,s){for(var i=0;i<t.length;++i)O(t[i],f,s)},K(e,"keypress",A),K(e,"keydown",A),K(e,"keyup",A)}l.prototype.bind=function(e,r,n){var o=this;return e=e instanceof Array?e:[e],o._bindMultiple.call(o,e,r,n),o},l.prototype.unbind=function(e,r){var n=this;return n.bind.call(n,e,function(){},r)},l.prototype.trigger=function(e,r){var n=this;return n._directMap[e+":"+r]&&n._directMap[e+":"+r]({},e),n},l.prototype.reset=function(){var e=this;return e._callbacks={},e._directMap={},e},l.prototype.stopCallback=function(e,r){var n=this;if((" "+r.className+" ").indexOf(" mousetrap ")>-1||I(r,n.target))return!1;if("composedPath"in e&&typeof e.composedPath=="function"){var o=e.composedPath()[0];o!==e.target&&(r=o)}return r.tagName=="INPUT"||r.tagName=="SELECT"||r.tagName=="TEXTAREA"||r.isContentEditable},l.prototype.handleKey=function(){var e=this;return e._handleKey.apply(e,arguments)},l.addKeycodes=function(e){for(var r in e)e.hasOwnProperty(r)&&(v[r]=e[r]);k=null},l.init=function(){var e=l(M);for(var r in e)r.charAt(0)!=="_"&&(l[r]=function(n){return function(){return e[n].apply(e,arguments)}}(r))},l.init(),m.Mousetrap=l,typeof w!="undefined"&&w.exports&&(w.exports=l),typeof define=="function"&&define.amd&&define(function(){return l})})(typeof window!="undefined"?window:null,typeof window!="undefined"?document:null)});export{J as a};
//# sourceMappingURL=chunk-XMPGMPQ4.js.map