/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/ctrl-keys@1.0.6/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var _=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var U=(e,t)=>{for(var n in t)_(e,n,{get:t[n],enumerable:!0})},B=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of I(t))!T.call(e,r)&&r!==n&&_(e,r,{get:()=>t[r],enumerable:!(o=P(t,r))||o.enumerable});return e};var D=e=>B(_({},"__esModule",{value:!0}),e);var Z={};U(Z,{default:()=>L,keys:()=>O});module.exports=D(Z);var a=["ctrl","alt","meta","shift"],u="__0_1_2_3_4_5_6_7_8_9_a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_z_ _`_'_\"_~_!_@_#_$_%_^_&_*_(_)_._-_+_=_[_]_{_}_<_>_,_/_?_;_:_\\_|_capslock_numlock_enter_tab_arrowdown_arrowleft_arrowright_arrowup_end_home_pagedown_pageup_backspace_delete_insert_escape_f1_f2_f3_f4_f5_f6_f7_f8_f9_f10_f11_f12_f13_f14_f15_f16_f17_f18_f19_f20_f21_f22_f23".split("_");u[1]="_";var i={};for(let[e,t]of u.entries())i[t]=e;var l={space:" ",plus:"+",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",esc:"escape"},d=4,H=9;var p=H+d,y=2**d,h=2**p,E=2**(2*p),K=2**(3*p);function m(e){let t;return e==="+"?["+"]:(e.slice(-1)=="+"?(t=e.slice(0,-2).split("+"),t.push("+")):t=e.split("+"),t.map(n=>l[n]||n))}function x(e){let t=new Set(e),n=i[e[e.length-1].toLowerCase()]||0;for(let o of a)n=2*n+(t.has(o)?1:0);return n}function b(e){return e>>d}function S(e){return e%y}function C(e,t){if(e===void 0||b(e)>0)return!1;let n=S(e),o=S(t);return n===o&&b(t)===0?!1:(n&S(t))===n}function q(e){let t=i[e.key.toLowerCase()]||0;for(let n of a)t=2*t+(e[`${n}Key`]?1:0);return t}function s(e){return e.map(m)}function c(e){if(e.length>4)throw"Can't encode sequence of more than 4 keys!";let t=0;for(let n of e)t=t*h+x(n);return t}function g(e){return e<h?1:e<E?2:e<K?3:4}function z(e){let t=[],n=0,o=0;for(let r=e.length-1;r>=0;r--)n=2**o*e[r]+n,o=o+13,t.push(n);return t}function w(e={}){return{history:[],historySize:0,bindings:new Map,disabledSequenceCodes:new Set,...e}}function M(e,t,n){let o=c(s(t));return e.bindings.has(o)||e.bindings.set(o,new Set),e.bindings.get(o).add(n),N(e)}function k(e,t,n){let o=c(s(t)),r=e.bindings.get(o);return r&&(r.delete(n),r.size==0&&e.bindings.delete(o)),N(e)}function v(e,t){let n=c(s(t));return e.disabledSequenceCodes.delete(n),e}function A(e,t){let n=c(s(t));return e.disabledSequenceCodes.add(n),e}function F(e,t){let n=q(t),o=e.history.at(-1);return C(o,n)&&e.history.pop(),e.history.push(n),e.history.length>e.historySize&&e.history.shift(),e}function Y(e){let t=[];for(let n of z(e.history))e.disabledSequenceCodes.has(n)||t.push(...e.bindings.get(n)||[]);return t}function R(e,t){e=F(e,t);let n=Y(e);for(let o of n)o(t);return[e,n]}function N(e){e.historySize=0;for(let t of e.bindings.keys())e.historySize=Math.max(e.historySize,g(t));return e}var f=class{constructor(t){this.state=t;this.add=this.add.bind(this),this.remove=this.remove.bind(this),this.handle=this.handle.bind(this)}add(...t){let n=t.slice(0,-1),o=t.at(-1);return this.state=M(this.state,n,o),this}remove(...t){let n=t.slice(0,-1),o=t.at(-1);return this.state=k(this.state,n,o),this}enable(...t){return this.state=v(this.state,t),this}disable(...t){return this.state=A(this.state,t),this}handle(t){let[n,o]=R(this.state,t);return this.state=n,o.length>0}};function O(){return new f(w())}var L=O;0&&(module.exports={keys});
//# sourceMappingURL=index.js.map