rumine-web/static/wagtailadmin/js/vendor/mousetrap.min.04548cfd2ec9.js

1 line
4.5 KiB
JavaScript
Raw Permalink Normal View History

2024-03-13 07:49:06 +01:00
!function(e,t,n){function r(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)}function a(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return u[e.which]?u[e.which]:p[e.which]?p[e.which]:String.fromCharCode(e.which).toLowerCase()}function i(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function o(e,t){var n,r,a,o=[];for(n="+"===(n=e)?["+"]:(n=n.replace(/\+{2}/g,"+plus")).split("+"),a=0;a<n.length;++a)r=n[a],h[r]&&(r=h[r]),t&&"keypress"!=t&&f[r]&&(r=f[r],o.push("shift")),i(r)&&o.push(r);if(n=r,!(a=t)){if(!l)for(var c in l={},u)95<c&&112>c||u.hasOwnProperty(c)&&(l[u[c]]=c);a=l[n]?"keydown":"keypress"}return"keypress"==a&&o.length&&(a="keydown"),{key:r,modifiers:o,action:a}}function c(e,n){return null!==e&&e!==t&&(e===n||c(e.parentNode,n))}function s(e){function n(e){e=e||{};var t,n=!1;for(t in y)e[t]?n=!0:y[t]=0;n||(b=!1)}function c(e,t,n,r,a,o){var c,s,l=[],u=n.type;if(!h._callbacks[e])return[];for("keyup"==u&&i(e)&&(t=[e]),c=0;c<h._callbacks[e].length;++c)if(s=h._callbacks[e][c],(r||!s.seq||y[s.seq]==s.level)&&u==s.action){var p;(p="keypress"==u&&!n.metaKey&&!n.ctrlKey)||(p=s.modifiers,p=t.sort().join(",")===p.sort().join(",")),p&&(p=r&&s.seq==r&&s.level==o,(!r&&s.combo==a||p)&&h._callbacks[e].splice(c,1),l.push(s))}return l}function l(e,t,n,r){h.stopCallback(t,t.target||t.srcElement,n,r)||!1!==e(t,n)||(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation?t.stopPropagation():t.cancelBubble=!0)}function u(e){"number"!=typeof e.which&&(e.which=e.keyCode);var t=a(e);t&&("keyup"==e.type&&m===t?m=!1:h.handleKey(t,function(e){var t=[];return e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t}(e),e))}function p(e,t,r,i){function c(t){return function(){b=t,++y[e],clearTimeout(d),d=setTimeout(n,1e3)}}function s(t){l(r,t,e),"keyup"!==i&&(m=a(t)),setTimeout(n,10)}for(var u=y[e]=0;u<t.length;++u){var p=u+1===t.length?s:c(i||o(t[u+1]).action);f(t[u],p,i,e,u)}}function f(e,t,n,r,a){h._directMap[e+":"+n]=t;var i=(e=e.replace(/\s+/g," ")).split(" ");1<i.length?p(e,i,t,n):(n=o(e,n),h._callbacks[n.key]=h._callbacks[n.key]||[],c(n.key,n.modifiers,{type:n.action},r,e,a),h._callbacks[n.key][r?"unshift":"push"]({callback:t,modifiers:n.modifiers,action:n.action,seq:r,level:a,combo:e}))}var h=this;if(e=e||t,!(h instanceof s))return new s(e);h.target=e,h._callbacks={},h._directMap={};var d,y={},m=!1,k=!1,b=!1;h._handleKey=function(e,t,r){var a,o=c(e,t,r);t={};var s=0,u=!1;for(a=0;a<o.length;++a)o[a].seq&&(s=Math.max(s,o[a].level));for(a=0;a<o.length;++a)o[a].seq?o[a].level==s&&(u=!0,t[o[a].seq]=1,l(o[a].callback,r,o[a].combo,o[a].seq)):u||l(o[a].callback,r,o[a].combo);o="keypress"==r.type&&k,r.type!=b||i(e)||o||n(t),k=u&&"keydown"==r.type},h._bindMultiple=function(e,t,n){for(var r=0;r<e.length;++r)f(e[r],t,n)},r(e,"keypress",u),r(e,"keydown",u),r(e,"keyup",u)}var l,u={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"},p={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},f={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},h={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"};for(n=1;20>n;++n)u[111+n]="f"+n;for(n=0;9>=n;++n)u[n+96]=n;s.prototype.bind=function(e,t,n){return e=e instanceof Array?e:[e],this._bindMultiple.call(this,e,t,n),this},s.prototype.unbind=function(e,t){return this.bind.call(this,e,(function(){}),t)},s.prototype.trigger=function(e,t){return this._directMap[e+":"+t]&&this._directMap[e+":"+t]({},e),this},s.prototype.reset=function(){return this._callbacks={},this._directMap={},this},s.prototype.stopCallback=function(e,t){return!(-1<(" "+