var y=["Shift","Meta","Alt","Control"],g=typeof navigator=="object"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"Meta":"Control";function p(n,t){return typeof n.getModifierState=="function"&&n.getModifierState(t)}function b(n){return n.trim().split(" ").map(function(t){var e=t.split(/\b\+/),a=e.pop();return[e=e.map(function(o){return o==="$mod"?g:o}),a]})}function M(n,t){var e;t===void 0&&(t={});var a=(e=t.timeout)!=null?e:1e3,o=Object.keys(n).map(function(r){return[b(r),n[r]]}),i=new Map,l=null;return function(r){r instanceof KeyboardEvent&&(o.forEach(function(v){var u=v[0],m=v[1],s=i.get(u)||u;(function(d,c){return!(c[1].toUpperCase()!==d.key.toUpperCase()&&c[1]!==d.code||c[0].find(function(f){return!p(d,f)})||y.find(function(f){return!c[0].includes(f)&&c[1]!==f&&p(d,f)}))})(r,s[0])?s.length>1?i.set(u,s.slice(1)):(i.delete(u),m(r)):p(r,r.key)||i.delete(u)}),l&&clearTimeout(l),l=setTimeout(i.clear.bind(i),a))}}function h(n,t,e){var a;e===void 0&&(e={});var o=(a=e.event)!=null?a:"keydown",i=M(t,e);return n.addEventListener(o,i),function(){n.removeEventListener(o,i)}}export{M as createKeybindingsHandler,h as default,b as parseKeybinding};
//# sourceMappingURL=tinykeys.module.d8e12cf8.js.map
