hotkey-router 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/data/browser-hotkeys.json +60 -57
- package/dist/auto.js +1 -1
- package/dist/auto.min.js +2 -2
- package/dist/core.js +1 -1
- package/dist/format.js +1 -1
- package/dist/hotkey-router.cjs +1 -1
- package/dist/hotkey-router.js +1 -1
- package/dist/hotkey-router.min.js +1 -1
- package/dist/reservations.js +69 -65
- package/dist/reservations.js.map +2 -2
- package/dist/sites.js +1 -1
- package/dist/types/reservations.d.ts +13 -5
- package/dist/validate.js +2 -2
- package/dist/validate.js.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -504,7 +504,7 @@ The `code:` value is **case-sensitive** (matches the camelCase `KeyboardEvent.co
|
|
|
504
504
|
|
|
505
505
|
### Conflict warnings (v0.2.0+)
|
|
506
506
|
|
|
507
|
-
Some combos are reserved by the browser chrome (find bar, devtools, bookmarks) or the OS (Spotlight, window management).
|
|
507
|
+
Some combos are reserved by the browser chrome (find bar, devtools, bookmarks) or the OS (Spotlight, window management). The hard ones never reach page-world JavaScript, no matter how early you listen or whether you call `preventDefault`: Ctrl+T, Ctrl+N and Ctrl+W on Windows, for example. Others reach the page first, and the browser acts on them too unless the page calls `preventDefault`: most Ctrl+letter shortcuts on Windows and Linux, such as Ctrl+K, Ctrl+F, Ctrl+P and Ctrl+S (checked with real key presses in Chrome, Edge and Firefox on Windows, 2026-10-29). hotkey-router ships an **opt-in** reservation table that emits a warning at bind time, so the silent failure (or the double action) becomes a noisy one.
|
|
508
508
|
|
|
509
509
|
The feature is opt-in by design: the core router is ~11 KB minified (~4.9 KB gzipped), and the reservation module (~23 KB minified, ~5.5 KB gzipped, mostly data) is tree-shaken out entirely unless you import it.
|
|
510
510
|
|
|
@@ -542,6 +542,7 @@ hotkeys.bind('meta+shift+f', toggleFullscreen)
|
|
|
542
542
|
| `compose` | `info` | macOS Option+letter types a special char in inputs. |
|
|
543
543
|
| `system-text` | `info` | Mac Ctrl+letter cursor controls inside text inputs. |
|
|
544
544
|
| `devtools-open` | `info` | Only relevant when DevTools is already open. |
|
|
545
|
+
| `preventable` | `warn` without `preventDefault: true`, else `info` | The browser's shortcut, but the page sees it first and `preventDefault: true` keeps the browser out. Without it, both act. |
|
|
545
546
|
|
|
546
547
|
**Per-bind opt-out:**
|
|
547
548
|
|
|
@@ -652,8 +653,10 @@ field.addEventListener('keydown', (e) => {
|
|
|
652
653
|
Errors (`ok: false`): no key, no modifier, Alt as the only modifier on
|
|
653
654
|
Windows/Linux, a rule you asked for (`requirePrimary`, `minModifiers`),
|
|
654
655
|
already in `taken`, or reserved by a browser/OS (never reaches the page).
|
|
655
|
-
Warnings (`ok: true`): reserved only in some situations
|
|
656
|
-
|
|
656
|
+
Warnings (`ok: true`): reserved only in some situations; the browser's own
|
|
657
|
+
shortcut that the page can win with `preventDefault` (`details.severity` is
|
|
658
|
+
`'preventable'`; most Ctrl+letter keys on Windows and Linux); Ctrl+Alt acting
|
|
659
|
+
as AltGr on some Windows layouts; and sites that use the same keys.
|
|
657
660
|
|
|
658
661
|
It loads both data tables: with them, about 62 KB minified (~15 KB
|
|
659
662
|
gzipped). Import it in the settings page that records keys, not in code
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "Machine-readable companion to docs/browser-hotkeys.md. Each combo entry describes who claims the binding and how strongly. Intended for runtime conflict warnings in keyboard-routing libraries (e.g. hotkey-router) and dev-time validation in apps like WebRadar. Update both this file and the markdown together — the markdown is the human source of truth, this file is the machine projection.",
|
|
3
3
|
"version": {
|
|
4
|
-
"generated": "2026-10-
|
|
4
|
+
"generated": "2026-10-29",
|
|
5
5
|
"schema": "1.0",
|
|
6
6
|
"sources": [
|
|
7
7
|
"https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"system-text": "Only reserved while a text input has focus (terminal-style cursor controls on macOS).",
|
|
24
24
|
"compose": "macOS Option+letter types a special character in text inputs. Outside inputs, free for page world.",
|
|
25
25
|
"os": "Operating system intercepts globally, before any application sees it.",
|
|
26
|
-
"devtools-open": "Only relevant when DevTools is already open; outside DevTools it fires normally."
|
|
26
|
+
"devtools-open": "Only relevant when DevTools is already open; outside DevTools it fires normally.",
|
|
27
|
+
"preventable": "The browser's own shortcut, but keydown reaches the page first: a binding with preventDefault() keeps the browser out, and without one the browser acts. Checked with real keys on Windows (docs/notes/key-check-reserved-2026-10-29.md)."
|
|
27
28
|
},
|
|
28
29
|
"$keyFormat": "Each combo key uses hotkey-router-compatible syntax: modifiers in canonical order (ctrl|meta|alt|shift) joined by '+', then the key (lowercased letter, or symbolic name). Per-platform tables use the platform's native modifier name — `meta` on macOS = Cmd, `meta` on Windows = Win, `ctrl` on Linux/Windows = the primary modifier.",
|
|
29
30
|
"platforms": {
|
|
@@ -168,27 +169,29 @@
|
|
|
168
169
|
"windows": {
|
|
169
170
|
"browsers": {
|
|
170
171
|
"firefox": {
|
|
171
|
-
"ctrl+a": { "action": "Select all", "severity": "
|
|
172
|
-
"ctrl+b": { "action": "Bookmarks sidebar", "severity": "
|
|
173
|
-
"ctrl+c": { "action": "Copy", "severity": "
|
|
174
|
-
"ctrl+d": { "action": "Bookmark this page", "severity": "
|
|
175
|
-
"ctrl+
|
|
176
|
-
"ctrl+
|
|
177
|
-
"ctrl+
|
|
178
|
-
"ctrl+
|
|
179
|
-
"ctrl+
|
|
172
|
+
"ctrl+a": { "action": "Select all", "severity": "preventable" },
|
|
173
|
+
"ctrl+b": { "action": "Bookmarks sidebar", "severity": "preventable" },
|
|
174
|
+
"ctrl+c": { "action": "Copy", "severity": "preventable" },
|
|
175
|
+
"ctrl+d": { "action": "Bookmark this page", "severity": "preventable" },
|
|
176
|
+
"ctrl+e": { "action": "Search from page", "severity": "preventable" },
|
|
177
|
+
"ctrl+f": { "action": "Find in page", "severity": "preventable" },
|
|
178
|
+
"ctrl+g": { "action": "Find next", "severity": "preventable" },
|
|
179
|
+
"ctrl+h": { "action": "History sidebar", "severity": "preventable" },
|
|
180
|
+
"ctrl+j": { "action": "Downloads", "severity": "preventable" },
|
|
181
|
+
"ctrl+k": { "action": "Search from page", "severity": "preventable" },
|
|
182
|
+
"ctrl+l": { "action": "Focus address bar", "severity": "preventable" },
|
|
180
183
|
"ctrl+n": { "action": "New window", "severity": "hard" },
|
|
181
|
-
"ctrl+o": { "action": "Open file", "severity": "
|
|
182
|
-
"ctrl+p": { "action": "Print", "severity": "
|
|
183
|
-
"ctrl+r": { "action": "Reload", "severity": "
|
|
184
|
-
"ctrl+s": { "action": "Save page", "severity": "
|
|
184
|
+
"ctrl+o": { "action": "Open file", "severity": "preventable" },
|
|
185
|
+
"ctrl+p": { "action": "Print", "severity": "preventable" },
|
|
186
|
+
"ctrl+r": { "action": "Reload", "severity": "preventable" },
|
|
187
|
+
"ctrl+s": { "action": "Save page", "severity": "preventable" },
|
|
185
188
|
"ctrl+t": { "action": "New tab", "severity": "hard" },
|
|
186
|
-
"ctrl+u": { "action": "View source", "severity": "
|
|
187
|
-
"ctrl+v": { "action": "Paste", "severity": "
|
|
189
|
+
"ctrl+u": { "action": "View source", "severity": "preventable" },
|
|
190
|
+
"ctrl+v": { "action": "Paste", "severity": "preventable" },
|
|
188
191
|
"ctrl+w": { "action": "Close tab", "severity": "hard" },
|
|
189
|
-
"ctrl+x": { "action": "Cut", "severity": "
|
|
190
|
-
"ctrl+y": { "action": "Redo", "severity": "
|
|
191
|
-
"ctrl+z": { "action": "Undo", "severity": "
|
|
192
|
+
"ctrl+x": { "action": "Cut", "severity": "preventable" },
|
|
193
|
+
"ctrl+y": { "action": "Redo", "severity": "preventable" },
|
|
194
|
+
"ctrl+z": { "action": "Undo", "severity": "preventable" },
|
|
192
195
|
"ctrl+shift+a": { "action": "Add-ons manager", "severity": "hard" },
|
|
193
196
|
"ctrl+shift+b": { "action": "Bookmarks toolbar", "severity": "hard" },
|
|
194
197
|
"ctrl+shift+c": { "action": "Inspector (element picker)", "severity": "hard" },
|
|
@@ -217,27 +220,27 @@
|
|
|
217
220
|
"alt+d": { "action": "Focus address bar", "severity": "hard" }
|
|
218
221
|
},
|
|
219
222
|
"chrome": {
|
|
220
|
-
"ctrl+a": { "action": "Select all", "severity": "
|
|
221
|
-
"ctrl+c": { "action": "Copy", "severity": "
|
|
222
|
-
"ctrl+d": { "action": "Bookmark this page", "severity": "
|
|
223
|
-
"ctrl+e": { "action": "Search from page", "severity": "
|
|
224
|
-
"ctrl+f": { "action": "Find in page", "severity": "
|
|
225
|
-
"ctrl+g": { "action": "Find next", "severity": "
|
|
226
|
-
"ctrl+h": { "action": "History page", "severity": "
|
|
227
|
-
"ctrl+j": { "action": "Downloads", "severity": "
|
|
228
|
-
"ctrl+k": { "action": "Search from page", "severity": "
|
|
229
|
-
"ctrl+l": { "action": "Focus address bar", "severity": "
|
|
223
|
+
"ctrl+a": { "action": "Select all", "severity": "preventable" },
|
|
224
|
+
"ctrl+c": { "action": "Copy", "severity": "preventable" },
|
|
225
|
+
"ctrl+d": { "action": "Bookmark this page", "severity": "preventable" },
|
|
226
|
+
"ctrl+e": { "action": "Search from page", "severity": "preventable" },
|
|
227
|
+
"ctrl+f": { "action": "Find in page", "severity": "preventable" },
|
|
228
|
+
"ctrl+g": { "action": "Find next", "severity": "preventable" },
|
|
229
|
+
"ctrl+h": { "action": "History page", "severity": "preventable" },
|
|
230
|
+
"ctrl+j": { "action": "Downloads", "severity": "preventable" },
|
|
231
|
+
"ctrl+k": { "action": "Search from page", "severity": "preventable" },
|
|
232
|
+
"ctrl+l": { "action": "Focus address bar", "severity": "preventable" },
|
|
230
233
|
"ctrl+n": { "action": "New window", "severity": "hard" },
|
|
231
|
-
"ctrl+o": { "action": "Open file", "severity": "
|
|
232
|
-
"ctrl+p": { "action": "Print", "severity": "
|
|
233
|
-
"ctrl+r": { "action": "Reload", "severity": "
|
|
234
|
-
"ctrl+s": { "action": "Save page", "severity": "
|
|
234
|
+
"ctrl+o": { "action": "Open file", "severity": "preventable" },
|
|
235
|
+
"ctrl+p": { "action": "Print", "severity": "preventable" },
|
|
236
|
+
"ctrl+r": { "action": "Reload", "severity": "preventable" },
|
|
237
|
+
"ctrl+s": { "action": "Save page", "severity": "preventable" },
|
|
235
238
|
"ctrl+t": { "action": "New tab", "severity": "hard" },
|
|
236
|
-
"ctrl+u": { "action": "View source", "severity": "
|
|
237
|
-
"ctrl+v": { "action": "Paste", "severity": "
|
|
239
|
+
"ctrl+u": { "action": "View source", "severity": "preventable" },
|
|
240
|
+
"ctrl+v": { "action": "Paste", "severity": "preventable" },
|
|
238
241
|
"ctrl+w": { "action": "Close tab", "severity": "hard" },
|
|
239
|
-
"ctrl+x": { "action": "Cut", "severity": "
|
|
240
|
-
"ctrl+z": { "action": "Undo", "severity": "
|
|
242
|
+
"ctrl+x": { "action": "Cut", "severity": "preventable" },
|
|
243
|
+
"ctrl+z": { "action": "Undo", "severity": "preventable" },
|
|
241
244
|
"ctrl+shift+b": { "action": "Bookmarks bar toggle", "severity": "hard" },
|
|
242
245
|
"ctrl+shift+d": { "action": "Bookmark all tabs", "severity": "hard" },
|
|
243
246
|
"ctrl+shift+g": { "action": "Find previous", "severity": "find-bar-only" },
|
|
@@ -254,28 +257,28 @@
|
|
|
254
257
|
"alt+f": { "action": "Customize menu (alt)", "severity": "menu-activation" }
|
|
255
258
|
},
|
|
256
259
|
"edge": {
|
|
257
|
-
"ctrl+a": { "action": "Select all", "severity": "
|
|
258
|
-
"ctrl+c": { "action": "Copy", "severity": "
|
|
259
|
-
"ctrl+d": { "action": "Favorite this page", "severity": "
|
|
260
|
-
"ctrl+e": { "action": "Search from page", "severity": "
|
|
261
|
-
"ctrl+f": { "action": "Find in page", "severity": "
|
|
262
|
-
"ctrl+g": { "action": "Find next", "severity": "
|
|
263
|
-
"ctrl+h": { "action": "History", "severity": "
|
|
264
|
-
"ctrl+j": { "action": "Downloads", "severity": "
|
|
265
|
-
"ctrl+k": { "action": "Search from page", "severity": "
|
|
266
|
-
"ctrl+l": { "action": "Focus address bar", "severity": "
|
|
267
|
-
"ctrl+m": { "action": "Mute current tab", "severity": "
|
|
260
|
+
"ctrl+a": { "action": "Select all", "severity": "preventable" },
|
|
261
|
+
"ctrl+c": { "action": "Copy", "severity": "preventable" },
|
|
262
|
+
"ctrl+d": { "action": "Favorite this page", "severity": "preventable" },
|
|
263
|
+
"ctrl+e": { "action": "Search from page", "severity": "preventable" },
|
|
264
|
+
"ctrl+f": { "action": "Find in page", "severity": "preventable" },
|
|
265
|
+
"ctrl+g": { "action": "Find next", "severity": "preventable" },
|
|
266
|
+
"ctrl+h": { "action": "History", "severity": "preventable" },
|
|
267
|
+
"ctrl+j": { "action": "Downloads", "severity": "preventable" },
|
|
268
|
+
"ctrl+k": { "action": "Search from page", "severity": "preventable" },
|
|
269
|
+
"ctrl+l": { "action": "Focus address bar", "severity": "preventable" },
|
|
270
|
+
"ctrl+m": { "action": "Mute current tab", "severity": "preventable" },
|
|
268
271
|
"ctrl+n": { "action": "New window", "severity": "hard" },
|
|
269
|
-
"ctrl+o": { "action": "Open file", "severity": "
|
|
270
|
-
"ctrl+p": { "action": "Print", "severity": "
|
|
271
|
-
"ctrl+r": { "action": "Reload", "severity": "
|
|
272
|
-
"ctrl+s": { "action": "Save page", "severity": "
|
|
272
|
+
"ctrl+o": { "action": "Open file", "severity": "preventable" },
|
|
273
|
+
"ctrl+p": { "action": "Print", "severity": "preventable" },
|
|
274
|
+
"ctrl+r": { "action": "Reload", "severity": "preventable" },
|
|
275
|
+
"ctrl+s": { "action": "Save page", "severity": "preventable" },
|
|
273
276
|
"ctrl+t": { "action": "New tab", "severity": "hard" },
|
|
274
|
-
"ctrl+u": { "action": "View source", "severity": "
|
|
275
|
-
"ctrl+v": { "action": "Paste", "severity": "
|
|
277
|
+
"ctrl+u": { "action": "View source", "severity": "preventable" },
|
|
278
|
+
"ctrl+v": { "action": "Paste", "severity": "preventable" },
|
|
276
279
|
"ctrl+w": { "action": "Close tab", "severity": "hard" },
|
|
277
|
-
"ctrl+x": { "action": "Cut", "severity": "
|
|
278
|
-
"ctrl+z": { "action": "Undo", "severity": "
|
|
280
|
+
"ctrl+x": { "action": "Cut", "severity": "preventable" },
|
|
281
|
+
"ctrl+z": { "action": "Undo", "severity": "preventable" },
|
|
279
282
|
"ctrl+shift+b": { "action": "Favorites bar toggle", "severity": "hard" },
|
|
280
283
|
"ctrl+shift+d": { "action": "Bookmark all tabs in folder", "severity": "hard" },
|
|
281
284
|
"ctrl+shift+e": { "action": "Search in sidebar", "severity": "hard" },
|
package/dist/auto.js
CHANGED
package/dist/auto.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// hotkey-router v0.
|
|
1
|
+
// hotkey-router v0.5.0 | SEE LICENSE IN LICENSE
|
|
2
2
|
|
|
3
|
-
function J(t){return t?/Chrome ?OS|CrOS/i.test(t)?"chromeos":/Mac|iPhone|iPad|iPod/i.test(t)?"mac":/Win/i.test(t)?"windows":/Linux|X11/i.test(t)?"linux":null:null}function E(t=typeof navigator<"u"?navigator:null,{chromeos:e=!1}={}){if(!t)return null;let r=t.userAgent||"",i=(/\bCrOS\b/.test(r)?"chromeos":null)||J(t.userAgentData?.platform)||J(t.platform)||(/Mac OS X/i.test(r)?"mac":/Windows/i.test(r)?"windows":/Linux|X11/i.test(r)?"linux":null);return i==="chromeos"&&!e?"linux":i}function tt(t=typeof navigator<"u"?navigator:null){if(!t)return null;let e=t.userAgent||"";return/Edg\//.test(e)?"edge":/Firefox/.test(e)?"firefox":/Chrome/.test(e)?"chrome":/Safari/.test(e)?"safari":null}var Et={mac:"macOS",windows:"Windows",linux:"Linux",chromeos:"ChromeOS"};function et(t){return Et[t]||t}var At=E(),rt=new Set(["ctrl","shift","alt","meta","mod"]),Pt=new Map([["^","ctrl"],["!","alt"],["+","shift"],["#","meta"]]),it=Object.freeze({esc:"escape",escape:"escape",space:" ",spacebar:" ",enter:"enter",return:"enter",del:"delete",delete:"delete",backspace:"backspace",tab:"tab",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",home:"home",end:"end",pageup:"pageup",pagedown:"pagedown",pgup:"pageup",pgdn:"pagedown",cmd:"meta",command:"meta",win:"meta",meta:"meta",control:"ctrl",ctrl:"ctrl",option:"alt",opt:"alt",alt:"alt",shift:"shift","\u2318":"meta","\u2303":"ctrl","\u2325":"alt","\u21E7":"shift",mod:"mod",plus:"+"});function P(t){let e=String(t??"");if(e===" ")return" ";let i=e.trim().toLowerCase();return it[i]??i}function Tt(t){return rt.has(P(t))}var Ft=/(^|\+)code:([A-Za-z][A-Za-z0-9_]*)/;function ot(t,{platform:e=At}={}){let r=String(t||"").trim(),i=null,a=p=>{i=i||`Invalid hotkey "${t}": ${p}`},d=/\s+up$/i.test(r),y=d?r.replace(/\s+up$/i,"").trim():r,n={ctrl:!1,shift:!1,alt:!1,meta:!1,key:null,code:null,bareModifier:null},w=p=>{p==="mod"?n[e==="mac"?"meta":"ctrl"]=!0:n[p]=!0},g=y;for(;g.length;){let p=Pt.get(g[0])??null;if(!p)break;w(p),g=g.slice(1).trimStart()}let x=g.match(/code:[A-Za-z][A-Za-z0-9_]*/g);x&&x.length>1&&a(`multiple code: tokens not supported (got ${x.length}).`);let L=null,F=g.replace(Ft,(p,S,j)=>(L=j,S+"__code__")).toLowerCase(),R=F.split("+").map(p=>p.trim()),N=R.filter(Boolean),$=R.some(p=>p==="")&&F.includes("++");if(!$){let p=!1;for(let S of N)Tt(S)?p&&a('modifiers must come before the base key (e.g. "ctrl+k", not "k+ctrl")'):p=!0}for(let p of N){if(p==="__code__"){n.code=L;continue}let S=it[p]??p;rt.has(S)?w(S):n.key=P(S)}if(!n.key&&!n.code&&$&&(n.key="+"),!n.key&&!n.code){let p=(n.ctrl?1:0)+(n.shift?1:0)+(n.alt?1:0)+(n.meta?1:0);p===1?n.bareModifier=n.ctrl?"ctrl":n.shift?"shift":n.alt?"alt":"meta":p>1?a('multi-modifier bare bindings not supported. Add a base key (e.g. "ctrl+alt+x").'):i=i||`Invalid hotkey "${t}" (missing base key)`}return{combo:n,type:d?"keyup":"keydown",raw:t,error:i}}function T(t,e){let{combo:r,type:i,raw:a,error:d}=ot(t,e);if(d)throw new Error(d);return{combo:r,type:i,raw:a}}var Kt={",":["<","Comma"],".":[">","Period"],"/":["?","Slash"],";":[":","Semicolon"],"'":['"',"Quote"],"[":["{","BracketLeft"],"]":["}","BracketRight"],"\\":["|","Backslash"],"-":["_","Minus"],"=":["+","Equal"],"`":["~","Backquote"]};function at(t){let{combo:e,type:r,error:i}=ot(t);if(i||!e.shift||e.code)return null;let a=Kt[e.key];if(!a)return null;let[d,y]=a,w=String(t).trim().replace(/\s+up$/i,"").slice(0,-1)+"code:"+y+(r==="keyup"?" up":"");return{message:`"${t}" never fires on US layouts: Shift turns "${e.key}" into "${d}". Bind "${w}" instead.`,suggestion:w}}var W={".":"period",",":"comma",";":"semicolon","'":"quote","/":"slash","\\":"backslash","[":"bracketleft","]":"bracketright","-":"minus","=":"equal","`":"backquote"," ":"space","+":"equal"};function Ot(t){if(!t)return null;let e=/^Key([A-Za-z])$/.exec(t);if(e)return e[1].toLowerCase();let r=/^(?:Digit|Numpad)(\d)$/.exec(t);return r?r[1]:t.toLowerCase()}function Rt(t){if(t==null||t==="")return null;if(W[t])return W[t];let e=P(t);return W[e]||e||null}function nt(t){if(!t||t.bareModifier)return null;let e=t.code?Ot(t.code):Rt(t.key);if(!e)return null;let r=[];return t.ctrl&&r.push("ctrl"),t.meta&&r.push("meta"),t.alt&&r.push("alt"),t.shift&&r.push("shift"),r.push(e),r.join("+")}function O(t,e,r,i){return t.addEventListener(e,r,i),()=>t.removeEventListener(e,r,i)}var Bt=E(),q=Object.freeze({Alt:"alt",AltGraph:"alt",Control:"ctrl",Shift:"shift",Meta:"meta",OS:"meta"}),st=new Set;function z({ctrl:t,shift:e,alt:r,meta:i,key:a,code:d,bareModifier:y}){if(y)return`__bare__:${y}`;let n="";return t&&(n+="ctrl+"),e&&(n+="shift+"),r&&(n+="alt+"),i&&(n+="meta+"),d?n+"code:"+d:n?n+a:a}function Mt(t){let e=q[t.key];return e?`__bare__:${e}`:z({ctrl:t.ctrlKey,shift:t.shiftKey,alt:t.altKey,meta:t.metaKey,key:P(t.key)})}function Dt(t){if(!t.code)return null;let e="";return t.ctrlKey&&(e+="ctrl+"),t.shiftKey&&(e+="shift+"),t.altKey&&(e+="alt+"),t.metaKey&&(e+="meta+"),e+"code:"+t.code}var Lt=new Set(["checkbox","radio","range","color","file","button","submit","reset","image"]);function Nt(t){let e=t?.composedPath?.();if(e?.length)return e;let r=[];for(let i=t?.target;i;i=i.parentNode||i.host)r.push(i);return r}function $t(t,e){let r=Nt(t),i=r[0];if(!i)return null;let a=String(i.tagName||"").toUpperCase();if(i.isContentEditable||a==="TEXTAREA"||a==="SELECT"||i.getAttribute?.("role")==="textbox")return"text";if(a==="INPUT"){if(e==="all")return"text";let d=String(i.getAttribute?.("type")||"text").toLowerCase();return Lt.has(d)?"control":"text"}if(e==="text"){for(let d of r)if(String(d.tagName||"").toUpperCase()==="BUTTON"||d.getAttribute?.("role")==="button")return"control"}return null}function _t(t){return!!((t.ctrlKey||t.altKey||t.metaKey)&&!q[t.key])}function ct(t){if(t==="all"||t==="text")return t;if(typeof t=="string")throw new TypeError(`hotkeys.ignoreInput() expects true, false, 'all' or 'text', got "${t}"`);return t?"all":null}function It(t,e){let r=e?{...e}:{};return t==="keydown"&&r.repeat==null&&(r.repeat=!1),r.priority==null&&(r.priority=0),r}function lt(t){let e=null;for(let r of t)e?(r.options.priority>e.options.priority||r.options.priority===e.options.priority&&r.id>e.id)&&(e=r):e=r;return e}function zt(t){return!!(t.ctrlKey&&t.altKey&&typeof t.getModifierState=="function"&&t.getModifierState("AltGraph")&&typeof t.key=="string"&&t.key.length===1)}function ft(t){return!!(t.isComposing||t.keyCode===229)}var jt=/^(?!\p{Script=Latin})\p{L}$/u;function Ht(t){if(!(t.ctrlKey||t.metaKey)||t.altKey||ft(t)||typeof t.getModifierState=="function"&&t.getModifierState("AltGraph"))return null;let e=/^Key([A-Z])$/.exec(t.code||"");return!e||typeof t.key!="string"||!jt.test(t.key)?null:z({ctrl:t.ctrlKey,shift:t.shiftKey,alt:!1,meta:t.metaKey,key:e[1].toLowerCase()})}var Ut={ctrl:"Control",shift:"Shift",alt:"Alt",meta:"Meta"},ht={Period:".",Comma:",",Semicolon:";",Quote:"'",Slash:"/",Backslash:"\\",BracketLeft:"[",BracketRight:"]",Minus:"-",Equal:"=",Backquote:"`",Space:" ",Enter:"Enter",NumpadEnter:"Enter",Tab:"Tab",Escape:"Escape",Backspace:"Backspace",Delete:"Delete",Insert:"Insert",Home:"Home",End:"End",PageUp:"PageUp",PageDown:"PageDown",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight"},I={},dt;for(let[t,e]of Object.entries(ht))I[dt=P(e)]??(I[dt]=t);function Wt(t){if(!t)return null;let e=/^Key([A-Z])$/.exec(t);if(e)return e[1].toLowerCase();let r=/^(?:Digit|Numpad)(\d)$/.exec(t);return r?r[1]:/^F\d{1,2}$/.test(t)?t:ht[t]??null}function qt(t){return t?/^[a-z]$/.test(t)?"Key"+t.toUpperCase():/^\d$/.test(t)?"Digit"+t:/^f\d{1,2}$/.test(t)?t.toUpperCase():I[t]??null:null}function ut(t,{physical:e=!0,useMod:r=!1,platform:i=Bt}={}){if(!t||q[t.key])return null;let a=[],d=i==="mac";if(r&&(d?t.metaKey:t.ctrlKey)&&a.push("mod"),t.ctrlKey&&!(r&&!d)&&a.push("ctrl"),t.metaKey&&!(r&&d)&&a.push("meta"),t.altKey&&a.push("alt"),t.shiftKey&&a.push("shift"),e&&t.code)a.push(`code:${t.code}`);else{let y=P(t.key);if(!y)return null;a.push(y===" "?"space":y)}return a.join("+")}function yt({target:t=typeof window<"u"?window:null,capture:e=!1,ignoreInput:r=!0}={}){let i=ct(r),a=t,d=e,y=[],n=new Map,w=new Map,g=new Map,x=!1,L=1;function G(o,l){let c=n.get(o);c||(c=new Map,n.set(o,c));let s=c.get(l);return s||(s=[],c.set(l,s)),s}function F(o){let l=g.get(o);if(!l)return!1;let{comboStr:c,type:s}=l,h=n.get(c),f=h?.get(s);if(!f?.length)return g.delete(o),!1;let u=f.filter(m=>m.id!==o);return u.length?h.set(s,u):h.delete(s),h.size||n.delete(c),g.delete(o),!0}function R(o,l,c=null,s={}){let{combo:h,type:f,raw:u}=T(o),m=z(h),b=It(f,s),k={id:L++,comboStr:m,type:f,combo:h,handler:l,plugin:c,raw:u,options:b};G(m,f).push(k),g.set(k.id,{comboStr:m,type:f});let C=`${m} ${f}`;if(!st.has(C)){let A=at(o);A&&(st.add(C),console.warn(`[hotkey-router] ${A.message}`))}if(y.length)for(let A of y)try{A({combo:h,raw:u,options:b,plugin:c,id:k.id})}catch(_){console.error("[hotkey-router] onBind hook threw:",_)}let v=()=>F(k.id);return v.id=k.id,v.hotkey=u,v}function N(o){if(typeof o!="function")throw new TypeError("hotkeys.onBind(hook) expects a function");return y.push(o),()=>{y=y.filter(l=>l!==o)}}function $(o,l){let{combo:c,type:s}=T(o),h=z(c),f=n.get(h);if(!f)return;let u=f.get(s);if(u?.length){if(l){let m=[];for(let b of u)b.handler===l?g.delete(b.id):m.push(b);m.length?f.set(s,m):f.delete(s)}else{for(let m of u)g.delete(m.id);f.delete(s)}f.size||n.delete(h)}}function p(o,l){if(w.has(o))throw new Error(`Plugin "${o}" already registered`);let c=Object.entries(l);for(let[h]of c)T(h);let s=[];for(let[h,f]of c){let[u,m]=Array.isArray(f)?f:[f,{}],b=R(h,u,o,m);s.push(b.id)}return w.set(o,s),()=>S(o)}function S(o){let l=w.get(o);if(l){for(let c of l)F(c);w.delete(o)}}function j(){x=!0}function bt(){x=!1}function kt(o=!0){i=ct(o)}function St(o){a=o}function Z(o,l,c){let s={altGraphChar:zt(o),composing:ft(o),focus:i&&$t(o,i),chord:_t(o)},h=[],f=new Set;for(let u of[Mt(o),Dt(o)])!u||f.has(u)||(f.add(u),Q(h,u,o,l,c,s));if(!h.length){let u=Ht(o);u&&!f.has(u)&&Q(h,u,o,l,c,s)}return h}function Q(o,l,c,s,h,{altGraphChar:f,composing:u,focus:m,chord:b}){let k=n.get(l)?.get(s);if(k?.length)for(let C of k){let v=C.options;h==="capture"&&!v.capture||h==="bubble"&&v.capture||f&&!v.altGraph||u&&!v.composing||m&&!(m==="control"&&b)&&!v.allowIn?.(c)||s==="keydown"&&v.repeat===!1&&c.repeat||v.when&&v.when(c)===!1||o.push(C)}}function X(o,l){let c=o.options;c.preventDefault&&l.preventDefault(),c.stopImmediatePropagation?l.stopImmediatePropagation():c.stopPropagation&&l.stopPropagation();try{o.handler(l)}finally{c.once&&F(o.id)}}function K(o,l="all"){return c=>{if(x)return;let s=Z(c,o,l);s.length&&X(lt(s),c)}}let B=null,M=null,H=null,U=null;function xt({target:o=a,capture:l=d}={}){if(!o)throw new Error("hotkeys.init() requires a target (e.g. window)");if((B||M)&&Y(),l){B=O(o,"keydown",K("keydown"),{capture:!0}),M=O(o,"keyup",K("keyup"),{capture:!0});return}B=O(o,"keydown",K("keydown","bubble"),{capture:!1}),M=O(o,"keyup",K("keyup","bubble"),{capture:!1}),H=O(o,"keydown",K("keydown","capture"),{capture:!0}),U=O(o,"keyup",K("keyup","capture"),{capture:!0})}function Y(){B?.(),M?.(),H?.(),U?.(),B=null,M=null,H=null,U=null,n.clear(),w.clear(),g.clear()}function Ct(o,{type:l,target:c=null}={}){let{combo:s,type:h}=T(o),f=l||h;if(x)return!1;let u=s.bareModifier?Ut[s.bareModifier]:s.key??Wt(s.code),m=s.bareModifier?null:s.code??qt(s.key),b=!!s.alt,k=!!s.ctrl,C=!!s.shift,v=!!s.meta;s.bareModifier&&f==="keyup"&&(s.bareModifier==="alt"?b=!1:s.bareModifier==="ctrl"?k=!1:s.bareModifier==="shift"?C=!1:s.bareModifier==="meta"&&(v=!1));let A={type:f,key:u,code:m,ctrlKey:k,shiftKey:C,altKey:b,metaKey:v,repeat:!1,isComposing:!1,getModifierState(){return!1},preventDefault(){},stopPropagation(){},stopImmediatePropagation(){},target:c},_=Z(A,f,"all");return _.length?(X(lt(_),A),!0):!1}return{init:xt,destroy:Y,setTarget:St,bind:R,unbind:$,registerPlugin:p,unregisterPlugin:S,onBind:N,pause:j,resume:bt,ignoreInput:kt,trigger:Ct,parseHotkey:T,comboFromEvent:ut,detectPlatform:E}}var pt=yt();typeof window<"u"&&pt.init();var V=pt;var D={$comment:"Machine-readable companion to docs/browser-hotkeys.md. Each combo entry describes who claims the binding and how strongly. Intended for runtime conflict warnings in keyboard-routing libraries (e.g. hotkey-router) and dev-time validation in apps like WebRadar. Update both this file and the markdown together \u2014 the markdown is the human source of truth, this file is the machine projection.",version:{generated:"2026-10-15",schema:"1.0",sources:["https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly","https://firefox-source-docs.mozilla.org/devtools-user/keyboard_shortcuts/index.html","https://support.google.com/chrome/answer/157179","https://developer.chrome.com/docs/devtools/shortcuts","https://support.apple.com/guide/safari/keyboard-shortcuts-and-gestures-cpsh003/mac","https://developer.apple.com/documentation/safari-developer-tools/web-inspector","https://support.microsoft.com/en-us/microsoft-edge/keyboard-shortcuts-in-microsoft-edge-50d3edab-30d9-c7e4-21ce-37fe2713cfad","https://support.apple.com/en-us/102650","https://support.microsoft.com/en-us/windows/keyboard-shortcuts-in-windows-dcc61a57-8ff0-cffe-9796-cb9706c75eec","https://help.gnome.org/gnome-help/shell-keyboard-shortcuts.html"]},severityLevels:{hard:"Browser or OS intercepts before page-world keydown fires. preventDefault() can't recover it.","find-bar-only":"Reserved only when the browser's find bar has focus. Fires in page world during normal browsing.","menu-activation":"Win/Linux Alt+letter activates the browser menu bar. Hard to suppress reliably.","system-text":"Only reserved while a text input has focus (terminal-style cursor controls on macOS).",compose:"macOS Option+letter types a special character in text inputs. Outside inputs, free for page world.",os:"Operating system intercepts globally, before any application sees it.","devtools-open":"Only relevant when DevTools is already open; outside DevTools it fires normally."},$keyFormat:"Each combo key uses hotkey-router-compatible syntax: modifiers in canonical order (ctrl|meta|alt|shift) joined by '+', then the key (lowercased letter, or symbolic name). Per-platform tables use the platform's native modifier name \u2014 `meta` on macOS = Cmd, `meta` on Windows = Win, `ctrl` on Linux/Windows = the primary modifier.",platforms:{mac:{browsers:{firefox:{"meta+a":{action:"Select all",severity:"hard"},"meta+b":{action:"Bookmarks sidebar",severity:"hard"},"meta+c":{action:"Copy",severity:"hard"},"meta+d":{action:"Bookmark this page",severity:"hard"},"meta+e":{action:"Search from page",severity:"hard"},"meta+f":{action:"Find in page",severity:"hard"},"meta+g":{action:"Find next",severity:"hard"},"meta+j":{action:"Downloads",severity:"hard"},"meta+l":{action:"Focus address bar",severity:"hard"},"meta+n":{action:"New window",severity:"hard"},"meta+o":{action:"Open file",severity:"hard"},"meta+p":{action:"Print",severity:"hard"},"meta+r":{action:"Reload",severity:"hard"},"meta+s":{action:"Save page",severity:"hard"},"meta+t":{action:"New tab",severity:"hard"},"meta+u":{action:"View source",severity:"hard"},"meta+v":{action:"Paste",severity:"hard"},"meta+w":{action:"Close tab",severity:"hard"},"meta+x":{action:"Cut",severity:"hard"},"meta+y":{action:"Redo",severity:"hard"},"meta+z":{action:"Undo",severity:"hard"},"meta+shift+a":{action:"Add-ons manager",severity:"hard"},"meta+shift+b":{action:"Bookmarks toolbar",severity:"hard"},"meta+shift+c":{action:"Inspector (element picker)",severity:"hard"},"meta+shift+d":{action:"Bookmark all tabs",severity:"hard"},"meta+shift+e":{action:"Network Monitor",severity:"hard"},"meta+shift+f":{action:"Toggle fullscreen",severity:"hard"},"meta+shift+g":{action:"Find previous",severity:"find-bar-only"},"meta+shift+j":{action:"Browser Console",severity:"hard"},"meta+shift+n":{action:"New private window",severity:"hard"},"meta+shift+o":{action:"Bookmarks library",severity:"hard"},"meta+shift+p":{action:"New private window (alt)",severity:"hard"},"meta+shift+q":{action:"Quit (with confirm)",severity:"hard"},"meta+shift+s":{action:"Firefox Screenshot",severity:"hard"},"meta+shift+t":{action:"Reopen closed tab",severity:"hard"},"meta+shift+v":{action:"Paste as plain text",severity:"hard"},"meta+shift+w":{action:"Close window",severity:"hard"},"meta+shift+z":{action:"Redo",severity:"hard"},"meta+alt+c":{action:"Inspector",severity:"hard"},"meta+alt+e":{action:"Network Monitor",severity:"hard"},"meta+alt+i":{action:"DevTools Toolbox",severity:"hard"},"meta+alt+j":{action:"Browser Console",severity:"hard"},"meta+alt+k":{action:"Web Console",severity:"hard"},"meta+alt+m":{action:"Responsive Design Mode",severity:"hard"},"meta+alt+z":{action:"Debugger",severity:"hard"}},chrome:{"meta+a":{action:"Select all",severity:"hard"},"meta+c":{action:"Copy",severity:"hard"},"meta+d":{action:"Bookmark this page",severity:"hard"},"meta+e":{action:"Search selected text",severity:"find-bar-only"},"meta+f":{action:"Find in page",severity:"hard"},"meta+g":{action:"Find next",severity:"hard"},"meta+l":{action:"Focus address bar",severity:"hard"},"meta+n":{action:"New window",severity:"hard"},"meta+o":{action:"Open file",severity:"hard"},"meta+p":{action:"Print",severity:"hard"},"meta+r":{action:"Reload",severity:"hard"},"meta+s":{action:"Save page",severity:"hard"},"meta+t":{action:"New tab",severity:"hard"},"meta+v":{action:"Paste",severity:"hard"},"meta+w":{action:"Close tab",severity:"hard"},"meta+x":{action:"Cut",severity:"hard"},"meta+y":{action:"History page",severity:"hard"},"meta+z":{action:"Undo",severity:"hard"},"meta+shift+b":{action:"Bookmarks bar toggle",severity:"hard"},"meta+shift+c":{action:"DevTools Inspector",severity:"hard"},"meta+shift+d":{action:"Bookmark all tabs",severity:"hard"},"meta+shift+g":{action:"Find previous",severity:"find-bar-only"},"meta+shift+j":{action:"Downloads page",severity:"hard"},"meta+shift+m":{action:"Switch user / guest",severity:"hard"},"meta+shift+n":{action:"New incognito window",severity:"hard"},"meta+shift+r":{action:"Hard reload",severity:"hard"},"meta+shift+t":{action:"Reopen closed tab",severity:"hard"},"meta+shift+v":{action:"Paste as plain text",severity:"hard"},"meta+shift+w":{action:"Close window",severity:"hard"},"meta+shift+z":{action:"Redo",severity:"hard"},"meta+alt+i":{action:"DevTools",severity:"hard"},"meta+alt+j":{action:"DevTools (console)",severity:"hard"},"meta+alt+u":{action:"View source",severity:"hard"}},safari:{"meta+a":{action:"Select all",severity:"hard"},"meta+c":{action:"Copy",severity:"hard"},"meta+d":{action:"Add to Reading List",severity:"hard"},"meta+f":{action:"Find in page",severity:"hard"},"meta+g":{action:"Find next",severity:"hard"},"meta+j":{action:"Downloads",severity:"hard"},"meta+l":{action:"Focus Smart Search",severity:"hard"},"meta+n":{action:"New window",severity:"hard"},"meta+p":{action:"Print",severity:"hard"},"meta+r":{action:"Reload",severity:"hard"},"meta+s":{action:"Save page",severity:"hard"},"meta+t":{action:"New tab",severity:"hard"},"meta+v":{action:"Paste",severity:"hard"},"meta+w":{action:"Close tab",severity:"hard"},"meta+x":{action:"Cut",severity:"hard"},"meta+z":{action:"Undo",severity:"hard"},"meta+shift+c":{action:"Inspector pick element",severity:"hard"},"meta+shift+d":{action:"Add Reading List item",severity:"hard"},"meta+shift+g":{action:"Find previous",severity:"find-bar-only"},"meta+shift+h":{action:"Go to homepage",severity:"hard"},"meta+shift+n":{action:"New private window",severity:"hard"},"meta+shift+r":{action:"Reader mode",severity:"hard"},"meta+shift+t":{action:"Reopen last closed tab",severity:"hard"},"meta+shift+v":{action:"Paste as plain text",severity:"hard"},"meta+shift+w":{action:"Close window",severity:"hard"},"meta+shift+z":{action:"Redo",severity:"hard"},"meta+alt+c":{action:"Web Inspector pick",severity:"hard"},"meta+alt+i":{action:"Web Inspector",severity:"hard"}}},system:{"meta+space":{action:"Spotlight",severity:"os"},"meta+tab":{action:"App switcher",severity:"os"},"meta+h":{action:"Hide app",severity:"os"},"meta+m":{action:"Minimize window",severity:"os"},"meta+q":{action:"Quit app",severity:"os"},"meta+shift+3":{action:"Screenshot full screen",severity:"os"},"meta+shift+4":{action:"Screenshot selection",severity:"os"},"meta+shift+5":{action:"Screen recording tool",severity:"os"},"meta+shift+q":{action:"Log out",severity:"os"},"meta+ctrl+q":{action:"Lock screen",severity:"os"},"meta+ctrl+space":{action:"Character Viewer",severity:"os"},"meta+alt+esc":{action:"Force-quit dialog",severity:"os"},"meta+shift+slash":{action:"Help menu search (Cmd+?)",severity:"os"},"meta+alt+h":{action:"Hide other apps",severity:"os"},"meta+alt+d":{action:"Show or hide the Dock",severity:"os"},"meta+backquote":{action:"Switch windows of the front app",severity:"os"}},noteForLetterCombos:{"alt+a..z":{behavior:"compose",note:"Option+letter types special characters in text inputs (Option+E\u2192\xB4, Option+A\u2192\xE5, Option+F\u2192\u0192). Outside inputs, free for page world."},"ctrl+a..z":{behavior:"system-text",note:"Mac uses Ctrl+letter as terminal-style cursor controls inside text inputs (Ctrl+A=line start, Ctrl+E=line end, Ctrl+K=delete-to-end, etc.). Outside inputs, free for page world."}}},windows:{browsers:{firefox:{"ctrl+a":{action:"Select all",severity:"hard"},"ctrl+b":{action:"Bookmarks sidebar",severity:"hard"},"ctrl+c":{action:"Copy",severity:"hard"},"ctrl+d":{action:"Bookmark this page",severity:"hard"},"ctrl+f":{action:"Find in page",severity:"hard"},"ctrl+g":{action:"Find next",severity:"hard"},"ctrl+h":{action:"History sidebar",severity:"hard"},"ctrl+j":{action:"Downloads",severity:"hard"},"ctrl+l":{action:"Focus address bar",severity:"hard"},"ctrl+n":{action:"New window",severity:"hard"},"ctrl+o":{action:"Open file",severity:"hard"},"ctrl+p":{action:"Print",severity:"hard"},"ctrl+r":{action:"Reload",severity:"hard"},"ctrl+s":{action:"Save page",severity:"hard"},"ctrl+t":{action:"New tab",severity:"hard"},"ctrl+u":{action:"View source",severity:"hard"},"ctrl+v":{action:"Paste",severity:"hard"},"ctrl+w":{action:"Close tab",severity:"hard"},"ctrl+x":{action:"Cut",severity:"hard"},"ctrl+y":{action:"Redo",severity:"hard"},"ctrl+z":{action:"Undo",severity:"hard"},"ctrl+shift+a":{action:"Add-ons manager",severity:"hard"},"ctrl+shift+b":{action:"Bookmarks toolbar",severity:"hard"},"ctrl+shift+c":{action:"Inspector (element picker)",severity:"hard"},"ctrl+shift+d":{action:"Bookmark all tabs",severity:"hard"},"ctrl+shift+e":{action:"Network Monitor",severity:"hard"},"ctrl+shift+g":{action:"Find previous",severity:"find-bar-only"},"ctrl+shift+i":{action:"Developer Tools",severity:"hard"},"ctrl+shift+j":{action:"Browser Console",severity:"hard"},"ctrl+shift+k":{action:"Web Console",severity:"hard"},"ctrl+shift+m":{action:"Responsive Design Mode",severity:"hard"},"ctrl+shift+n":{action:"New private window",severity:"hard"},"ctrl+shift+o":{action:"Bookmarks library",severity:"hard"},"ctrl+shift+p":{action:"New private window (alt)",severity:"hard"},"ctrl+shift+s":{action:"Firefox Screenshot",severity:"hard"},"ctrl+shift+t":{action:"Reopen closed tab",severity:"hard"},"ctrl+shift+v":{action:"Paste as plain text",severity:"hard"},"ctrl+shift+w":{action:"Close window",severity:"hard"},"ctrl+shift+y":{action:"Downloads (alt)",severity:"hard"},"ctrl+shift+z":{action:"Debugger",severity:"hard"},"alt+f":{action:"File menu",severity:"menu-activation"},"alt+e":{action:"Edit menu",severity:"menu-activation"},"alt+v":{action:"View menu",severity:"menu-activation"},"alt+b":{action:"Bookmarks menu",severity:"menu-activation"},"alt+t":{action:"Tools menu",severity:"menu-activation"},"alt+h":{action:"Help menu",severity:"menu-activation"},"alt+d":{action:"Focus address bar",severity:"hard"}},chrome:{"ctrl+a":{action:"Select all",severity:"hard"},"ctrl+c":{action:"Copy",severity:"hard"},"ctrl+d":{action:"Bookmark this page",severity:"hard"},"ctrl+e":{action:"Search from page",severity:"hard"},"ctrl+f":{action:"Find in page",severity:"hard"},"ctrl+g":{action:"Find next",severity:"hard"},"ctrl+h":{action:"History page",severity:"hard"},"ctrl+j":{action:"Downloads",severity:"hard"},"ctrl+k":{action:"Search from page",severity:"hard"},"ctrl+l":{action:"Focus address bar",severity:"hard"},"ctrl+n":{action:"New window",severity:"hard"},"ctrl+o":{action:"Open file",severity:"hard"},"ctrl+p":{action:"Print",severity:"hard"},"ctrl+r":{action:"Reload",severity:"hard"},"ctrl+s":{action:"Save page",severity:"hard"},"ctrl+t":{action:"New tab",severity:"hard"},"ctrl+u":{action:"View source",severity:"hard"},"ctrl+v":{action:"Paste",severity:"hard"},"ctrl+w":{action:"Close tab",severity:"hard"},"ctrl+x":{action:"Cut",severity:"hard"},"ctrl+z":{action:"Undo",severity:"hard"},"ctrl+shift+b":{action:"Bookmarks bar toggle",severity:"hard"},"ctrl+shift+d":{action:"Bookmark all tabs",severity:"hard"},"ctrl+shift+g":{action:"Find previous",severity:"find-bar-only"},"ctrl+shift+i":{action:"DevTools",severity:"hard"},"ctrl+shift+j":{action:"DevTools (console)",severity:"hard"},"ctrl+shift+m":{action:"Switch user / guest",severity:"hard"},"ctrl+shift+n":{action:"Incognito window",severity:"hard"},"ctrl+shift+r":{action:"Hard reload",severity:"hard"},"ctrl+shift+t":{action:"Reopen closed tab",severity:"hard"},"ctrl+shift+v":{action:"Paste as plain text",severity:"hard"},"ctrl+shift+w":{action:"Close window",severity:"hard"},"alt+d":{action:"Focus address bar",severity:"hard"},"alt+e":{action:"Customize menu",severity:"menu-activation"},"alt+f":{action:"Customize menu (alt)",severity:"menu-activation"}},edge:{"ctrl+a":{action:"Select all",severity:"hard"},"ctrl+c":{action:"Copy",severity:"hard"},"ctrl+d":{action:"Favorite this page",severity:"hard"},"ctrl+e":{action:"Search from page",severity:"hard"},"ctrl+f":{action:"Find in page",severity:"hard"},"ctrl+g":{action:"Find next",severity:"hard"},"ctrl+h":{action:"History",severity:"hard"},"ctrl+j":{action:"Downloads",severity:"hard"},"ctrl+k":{action:"Search from page",severity:"hard"},"ctrl+l":{action:"Focus address bar",severity:"hard"},"ctrl+m":{action:"Mute current tab",severity:"hard"},"ctrl+n":{action:"New window",severity:"hard"},"ctrl+o":{action:"Open file",severity:"hard"},"ctrl+p":{action:"Print",severity:"hard"},"ctrl+r":{action:"Reload",severity:"hard"},"ctrl+s":{action:"Save page",severity:"hard"},"ctrl+t":{action:"New tab",severity:"hard"},"ctrl+u":{action:"View source",severity:"hard"},"ctrl+v":{action:"Paste",severity:"hard"},"ctrl+w":{action:"Close tab",severity:"hard"},"ctrl+x":{action:"Cut",severity:"hard"},"ctrl+z":{action:"Undo",severity:"hard"},"ctrl+shift+b":{action:"Favorites bar toggle",severity:"hard"},"ctrl+shift+d":{action:"Bookmark all tabs in folder",severity:"hard"},"ctrl+shift+e":{action:"Search in sidebar",severity:"hard"},"ctrl+shift+g":{action:"Find previous",severity:"find-bar-only"},"ctrl+shift+i":{action:"DevTools",severity:"hard"},"ctrl+shift+j":{action:"DevTools (console)",severity:"hard"},"ctrl+shift+k":{action:"Duplicate tab",severity:"hard"},"ctrl+shift+l":{action:"Paste and search",severity:"hard"},"ctrl+shift+m":{action:"Switch user / guest",severity:"hard"},"ctrl+shift+n":{action:"InPrivate window",severity:"hard"},"ctrl+shift+o":{action:"Open favorites",severity:"hard"},"ctrl+shift+p":{action:"Print (system dialog)",severity:"hard"},"ctrl+shift+r":{action:"Hard reload",severity:"hard"},"ctrl+shift+t":{action:"Reopen closed tab",severity:"hard"},"ctrl+shift+u":{action:"Read Aloud toggle",severity:"hard"},"ctrl+shift+v":{action:"Paste without formatting",severity:"hard"},"ctrl+shift+w":{action:"Close window",severity:"hard"},"ctrl+shift+y":{action:"Collections",severity:"hard"},"alt+d":{action:"Focus address bar",severity:"hard"},"alt+e":{action:"Settings menu",severity:"menu-activation"},"alt+f":{action:"Settings menu (alt)",severity:"menu-activation"},"alt+shift+b":{action:"Focus favorites bar",severity:"hard"},"alt+shift+i":{action:"Send feedback dialog",severity:"hard"},"alt+shift+t":{action:"Focus app bar toolbar",severity:"hard"}}},system:{"meta+a":{action:"Action Center",severity:"os"},"meta+c":{action:"Windows search",severity:"os"},"meta+d":{action:"Show desktop",severity:"os"},"meta+e":{action:"File Explorer",severity:"os"},"meta+g":{action:"Game bar",severity:"os"},"meta+h":{action:"Voice dictation",severity:"os"},"meta+i":{action:"Settings",severity:"os"},"meta+l":{action:"Lock",severity:"os"},"meta+n":{action:"Notification center",severity:"os"},"meta+p":{action:"Project / display mode",severity:"os"},"meta+r":{action:"Run dialog",severity:"os"},"meta+s":{action:"Search",severity:"os"},"meta+v":{action:"Clipboard history",severity:"os"},"meta+w":{action:"Widgets",severity:"os"},"meta+x":{action:"Quick Link menu",severity:"os"},"meta+z":{action:"Snap layouts",severity:"os"},"meta+tab":{action:"Task View",severity:"os"},"meta+shift+s":{action:"Screenshot region",severity:"os"},"ctrl+shift+esc":{action:"Task Manager",severity:"os"},"ctrl+alt+del":{action:"Security screen",severity:"os"},"alt+tab":{action:"Switch windows",severity:"os"},"alt+f4":{action:"Close active window",severity:"os"}}},linux:{browsers:{firefox:"$ref:platforms.windows.browsers.firefox",chrome:"$ref:platforms.windows.browsers.chrome",edge:"$ref:platforms.windows.browsers.edge"},system:{$comment:"GNOME defaults. KDE and other DEs have similar-shaped reservations but vary; this is a conservative baseline.","meta+tab":{action:"Switch windows",severity:"os"},"meta+a":{action:"Show applications",severity:"os"},"meta+l":{action:"Lock screen",severity:"os"},"meta+v":{action:"Notification list",severity:"os"},"alt+tab":{action:"Switch applications",severity:"os"},"alt+esc":{action:"Cycle windows",severity:"os"},"alt+f2":{action:"Run command",severity:"os"},"alt+f4":{action:"Close window",severity:"os"},"ctrl+alt+tab":{action:"Top-bar accessibility switcher",severity:"os"},"ctrl+alt+del":{action:"Power-off dialog",severity:"os"},"ctrl+shift+alt+r":{action:"Toggle screencast recording",severity:"os"}},noteForCtrlAlt:"Some Linux setups map right-Alt (AltGr) to 'compose' for typing accented characters, in which case AltGr+letter is reported as ctrl+alt+letter and types a special character. Avoid the ctrl+alt+letter namespace on Linux."}}};var Gt="1.0",Zt=new Set(["hard","os","menu-activation"]);function Qt(t){let e=String(t).toLowerCase().split("+").map(d=>d.trim()).filter(Boolean);if(!e.length)return"";let r=e[e.length-1],i=new Set(e.slice(0,-1)),a=[];return i.has("ctrl")&&a.push("ctrl"),i.has("meta")&&a.push("meta"),i.has("alt")&&a.push("alt"),i.has("shift")&&a.push("shift"),a.push(r),a.join("+")}function Xt(t,e){if(typeof t!="string"||!t.startsWith("$ref:"))return t;let r=t.slice(5).split("."),i=e;for(let a of r)i=i?.[a];return i}function mt(t){if(!t||typeof t!="object")return null;let e=Object.create(null);for(let[r,i]of Object.entries(t))!i||typeof i!="object"||!("severity"in i)||(e[Qt(r)]=i);return e}function Yt(t){let e={platforms:{}},r=t?.platforms||{};for(let[i,a]of Object.entries(r)){let d={};for(let[y,n]of Object.entries(a.browsers||{}))d[y]=mt(Xt(n,t));e.platforms[i]={browsers:d,system:mt(a.system)}}return e}var vt=D?.version?.schema===Gt,Jt=vt?Yt(D):{platforms:{}},te=nt;function ee(t,{platform:e,browser:r}={}){if(!vt)return null;let i=te(t);if(!i)return null;let a=e&&Jt.platforms[e];if(!a)return null;let y=(r?a.browsers?.[r]:null)?.[i];if(y)return{source:"browser",platform:e,browser:r,lookupKey:i,action:y.action,severity:y.severity};let n=a.system?.[i];return n?{source:"system",platform:e,browser:r,lookupKey:i,action:n.action,severity:n.severity}:null}function wt(t){return Zt.has(t)}function re(t,e){let r=et(t.platform),i=t.source==="browser"?`${t.browser} on ${r}`:r,a=wt(t.severity)?"will not fire":"fires in normal browsing";return`[hotkey-router] "${e}" (${t.lookupKey}) reserved by ${i}: "${t.action}" [${t.severity}] \u2014 ${a}.`}function ie(t,e,r=console){let i=re(t,e);(wt(t.severity)?r.warn:r.info).call(r,i)}function gt(t,e={}){if(!t||typeof t.onBind!="function")throw new TypeError("installReservationWarnings(hotkeys) requires a hotkey-router instance with onBind() (>= v0.2.0)");let r=e.platform!==void 0?e.platform:E(),i=e.browser!==void 0?e.browser:tt(),a=e.console||console;return t.onBind(({combo:d,raw:y,options:n})=>{if(n?.warnOnReserved===!1||!r||!i)return;let w=ee(d,{platform:r,browser:i});w&&ie(w,y,a)})}var me=D?.version?.schema,ve=D?.version?.generated;gt(V);var ke=V;export{ke as default};
|
|
3
|
+
function J(e){return e?/Chrome ?OS|CrOS/i.test(e)?"chromeos":/Mac|iPhone|iPad|iPod/i.test(e)?"mac":/Win/i.test(e)?"windows":/Linux|X11/i.test(e)?"linux":null:null}function E(e=typeof navigator<"u"?navigator:null,{chromeos:t=!1}={}){if(!e)return null;let r=e.userAgent||"",i=(/\bCrOS\b/.test(r)?"chromeos":null)||J(e.userAgentData?.platform)||J(e.platform)||(/Mac OS X/i.test(r)?"mac":/Windows/i.test(r)?"windows":/Linux|X11/i.test(r)?"linux":null);return i==="chromeos"&&!t?"linux":i}function ee(e=typeof navigator<"u"?navigator:null){if(!e)return null;let t=e.userAgent||"";return/Edg\//.test(t)?"edge":/Firefox/.test(t)?"firefox":/Chrome/.test(t)?"chrome":/Safari/.test(t)?"safari":null}var Ee={mac:"macOS",windows:"Windows",linux:"Linux",chromeos:"ChromeOS"};function te(e){return Ee[e]||e}var Ae=E(),re=new Set(["ctrl","shift","alt","meta","mod"]),Pe=new Map([["^","ctrl"],["!","alt"],["+","shift"],["#","meta"]]),ie=Object.freeze({esc:"escape",escape:"escape",space:" ",spacebar:" ",enter:"enter",return:"enter",del:"delete",delete:"delete",backspace:"backspace",tab:"tab",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",home:"home",end:"end",pageup:"pageup",pagedown:"pagedown",pgup:"pageup",pgdn:"pagedown",cmd:"meta",command:"meta",win:"meta",meta:"meta",control:"ctrl",ctrl:"ctrl",option:"alt",opt:"alt",alt:"alt",shift:"shift","\u2318":"meta","\u2303":"ctrl","\u2325":"alt","\u21E7":"shift",mod:"mod",plus:"+"});function P(e){let t=String(e??"");if(t===" ")return" ";let i=t.trim().toLowerCase();return ie[i]??i}function Te(e){return re.has(P(e))}var Fe=/(^|\+)code:([A-Za-z][A-Za-z0-9_]*)/;function oe(e,{platform:t=Ae}={}){let r=String(e||"").trim(),i=null,a=y=>{i=i||`Invalid hotkey "${e}": ${y}`},d=/\s+up$/i.test(r),u=d?r.replace(/\s+up$/i,"").trim():r,n={ctrl:!1,shift:!1,alt:!1,meta:!1,key:null,code:null,bareModifier:null},b=y=>{y==="mod"?n[t==="mac"?"meta":"ctrl"]=!0:n[y]=!0},w=u;for(;w.length;){let y=Pe.get(w[0])??null;if(!y)break;b(y),w=w.slice(1).trimStart()}let x=w.match(/code:[A-Za-z][A-Za-z0-9_]*/g);x&&x.length>1&&a(`multiple code: tokens not supported (got ${x.length}).`);let L=null,F=w.replace(Fe,(y,S,j)=>(L=j,S+"__code__")).toLowerCase(),D=F.split("+").map(y=>y.trim()),N=D.filter(Boolean),$=D.some(y=>y==="")&&F.includes("++");if(!$){let y=!1;for(let S of N)Te(S)?y&&a('modifiers must come before the base key (e.g. "ctrl+k", not "k+ctrl")'):y=!0}for(let y of N){if(y==="__code__"){n.code=L;continue}let S=ie[y]??y;re.has(S)?b(S):n.key=P(S)}if(!n.key&&!n.code&&$&&(n.key="+"),!n.key&&!n.code){let y=(n.ctrl?1:0)+(n.shift?1:0)+(n.alt?1:0)+(n.meta?1:0);y===1?n.bareModifier=n.ctrl?"ctrl":n.shift?"shift":n.alt?"alt":"meta":y>1?a('multi-modifier bare bindings not supported. Add a base key (e.g. "ctrl+alt+x").'):i=i||`Invalid hotkey "${e}" (missing base key)`}return{combo:n,type:d?"keyup":"keydown",raw:e,error:i}}function T(e,t){let{combo:r,type:i,raw:a,error:d}=oe(e,t);if(d)throw new Error(d);return{combo:r,type:i,raw:a}}var Ke={",":["<","Comma"],".":[">","Period"],"/":["?","Slash"],";":[":","Semicolon"],"'":['"',"Quote"],"[":["{","BracketLeft"],"]":["}","BracketRight"],"\\":["|","Backslash"],"-":["_","Minus"],"=":["+","Equal"],"`":["~","Backquote"]};function ae(e){let{combo:t,type:r,error:i}=oe(e);if(i||!t.shift||t.code)return null;let a=Ke[t.key];if(!a)return null;let[d,u]=a,b=String(e).trim().replace(/\s+up$/i,"").slice(0,-1)+"code:"+u+(r==="keyup"?" up":"");return{message:`"${e}" never fires on US layouts: Shift turns "${t.key}" into "${d}". Bind "${b}" instead.`,suggestion:b}}var W={".":"period",",":"comma",";":"semicolon","'":"quote","/":"slash","\\":"backslash","[":"bracketleft","]":"bracketright","-":"minus","=":"equal","`":"backquote"," ":"space","+":"equal"};function Re(e){if(!e)return null;let t=/^Key([A-Za-z])$/.exec(e);if(t)return t[1].toLowerCase();let r=/^(?:Digit|Numpad)(\d)$/.exec(e);return r?r[1]:e.toLowerCase()}function De(e){if(e==null||e==="")return null;if(W[e])return W[e];let t=P(e);return W[t]||t||null}function ne(e){if(!e||e.bareModifier)return null;let t=e.code?Re(e.code):De(e.key);if(!t)return null;let r=[];return e.ctrl&&r.push("ctrl"),e.meta&&r.push("meta"),e.alt&&r.push("alt"),e.shift&&r.push("shift"),r.push(t),r.join("+")}function R(e,t,r,i){return e.addEventListener(t,r,i),()=>e.removeEventListener(t,r,i)}var Oe=E(),q=Object.freeze({Alt:"alt",AltGraph:"alt",Control:"ctrl",Shift:"shift",Meta:"meta",OS:"meta"}),se=new Set;function z({ctrl:e,shift:t,alt:r,meta:i,key:a,code:d,bareModifier:u}){if(u)return`__bare__:${u}`;let n="";return e&&(n+="ctrl+"),t&&(n+="shift+"),r&&(n+="alt+"),i&&(n+="meta+"),d?n+"code:"+d:n?n+a:a}function Be(e){let t=q[e.key];return t?`__bare__:${t}`:z({ctrl:e.ctrlKey,shift:e.shiftKey,alt:e.altKey,meta:e.metaKey,key:P(e.key)})}function Me(e){if(!e.code)return null;let t="";return e.ctrlKey&&(t+="ctrl+"),e.shiftKey&&(t+="shift+"),e.altKey&&(t+="alt+"),e.metaKey&&(t+="meta+"),t+"code:"+e.code}var Le=new Set(["checkbox","radio","range","color","file","button","submit","reset","image"]);function Ne(e){let t=e?.composedPath?.();if(t?.length)return t;let r=[];for(let i=e?.target;i;i=i.parentNode||i.host)r.push(i);return r}function $e(e,t){let r=Ne(e),i=r[0];if(!i)return null;let a=String(i.tagName||"").toUpperCase();if(i.isContentEditable||a==="TEXTAREA"||a==="SELECT"||i.getAttribute?.("role")==="textbox")return"text";if(a==="INPUT"){if(t==="all")return"text";let d=String(i.getAttribute?.("type")||"text").toLowerCase();return Le.has(d)?"control":"text"}if(t==="text"){for(let d of r)if(String(d.tagName||"").toUpperCase()==="BUTTON"||d.getAttribute?.("role")==="button")return"control"}return null}function _e(e){return!!((e.ctrlKey||e.altKey||e.metaKey)&&!q[e.key])}function ce(e){if(e==="all"||e==="text")return e;if(typeof e=="string")throw new TypeError(`hotkeys.ignoreInput() expects true, false, 'all' or 'text', got "${e}"`);return e?"all":null}function Ie(e,t){let r=t?{...t}:{};return e==="keydown"&&r.repeat==null&&(r.repeat=!1),r.priority==null&&(r.priority=0),r}function le(e){let t=null;for(let r of e)t?(r.options.priority>t.options.priority||r.options.priority===t.options.priority&&r.id>t.id)&&(t=r):t=r;return t}function ze(e){return!!(e.ctrlKey&&e.altKey&&typeof e.getModifierState=="function"&&e.getModifierState("AltGraph")&&typeof e.key=="string"&&e.key.length===1)}function fe(e){return!!(e.isComposing||e.keyCode===229)}var je=/^(?!\p{Script=Latin})\p{L}$/u;function He(e){if(!(e.ctrlKey||e.metaKey)||e.altKey||fe(e)||typeof e.getModifierState=="function"&&e.getModifierState("AltGraph"))return null;let t=/^Key([A-Z])$/.exec(e.code||"");return!t||typeof e.key!="string"||!je.test(e.key)?null:z({ctrl:e.ctrlKey,shift:e.shiftKey,alt:!1,meta:e.metaKey,key:t[1].toLowerCase()})}var Ue={ctrl:"Control",shift:"Shift",alt:"Alt",meta:"Meta"},ue={Period:".",Comma:",",Semicolon:";",Quote:"'",Slash:"/",Backslash:"\\",BracketLeft:"[",BracketRight:"]",Minus:"-",Equal:"=",Backquote:"`",Space:" ",Enter:"Enter",NumpadEnter:"Enter",Tab:"Tab",Escape:"Escape",Backspace:"Backspace",Delete:"Delete",Insert:"Insert",Home:"Home",End:"End",PageUp:"PageUp",PageDown:"PageDown",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight"},I={},de;for(let[e,t]of Object.entries(ue))I[de=P(t)]??(I[de]=e);function We(e){if(!e)return null;let t=/^Key([A-Z])$/.exec(e);if(t)return t[1].toLowerCase();let r=/^(?:Digit|Numpad)(\d)$/.exec(e);return r?r[1]:/^F\d{1,2}$/.test(e)?e:ue[e]??null}function qe(e){return e?/^[a-z]$/.test(e)?"Key"+e.toUpperCase():/^\d$/.test(e)?"Digit"+e:/^f\d{1,2}$/.test(e)?e.toUpperCase():I[e]??null:null}function he(e,{physical:t=!0,useMod:r=!1,platform:i=Oe}={}){if(!e||q[e.key])return null;let a=[],d=i==="mac";if(r&&(d?e.metaKey:e.ctrlKey)&&a.push("mod"),e.ctrlKey&&!(r&&!d)&&a.push("ctrl"),e.metaKey&&!(r&&d)&&a.push("meta"),e.altKey&&a.push("alt"),e.shiftKey&&a.push("shift"),t&&e.code)a.push(`code:${e.code}`);else{let u=P(e.key);if(!u)return null;a.push(u===" "?"space":u)}return a.join("+")}function pe({target:e=typeof window<"u"?window:null,capture:t=!1,ignoreInput:r=!0}={}){let i=ce(r),a=e,d=t,u=[],n=new Map,b=new Map,w=new Map,x=!1,L=1;function G(o,l){let c=n.get(o);c||(c=new Map,n.set(o,c));let s=c.get(l);return s||(s=[],c.set(l,s)),s}function F(o){let l=w.get(o);if(!l)return!1;let{comboStr:c,type:s}=l,h=n.get(c),f=h?.get(s);if(!f?.length)return w.delete(o),!1;let p=f.filter(m=>m.id!==o);return p.length?h.set(s,p):h.delete(s),h.size||n.delete(c),w.delete(o),!0}function D(o,l,c=null,s={}){let{combo:h,type:f,raw:p}=T(o),m=z(h),g=Ie(f,s),k={id:L++,comboStr:m,type:f,combo:h,handler:l,plugin:c,raw:p,options:g};G(m,f).push(k),w.set(k.id,{comboStr:m,type:f});let C=`${m} ${f}`;if(!se.has(C)){let A=ae(o);A&&(se.add(C),console.warn(`[hotkey-router] ${A.message}`))}if(u.length)for(let A of u)try{A({combo:h,raw:p,options:g,plugin:c,id:k.id})}catch(_){console.error("[hotkey-router] onBind hook threw:",_)}let v=()=>F(k.id);return v.id=k.id,v.hotkey=p,v}function N(o){if(typeof o!="function")throw new TypeError("hotkeys.onBind(hook) expects a function");return u.push(o),()=>{u=u.filter(l=>l!==o)}}function $(o,l){let{combo:c,type:s}=T(o),h=z(c),f=n.get(h);if(!f)return;let p=f.get(s);if(p?.length){if(l){let m=[];for(let g of p)g.handler===l?w.delete(g.id):m.push(g);m.length?f.set(s,m):f.delete(s)}else{for(let m of p)w.delete(m.id);f.delete(s)}f.size||n.delete(h)}}function y(o,l){if(b.has(o))throw new Error(`Plugin "${o}" already registered`);let c=Object.entries(l);for(let[h]of c)T(h);let s=[];for(let[h,f]of c){let[p,m]=Array.isArray(f)?f:[f,{}],g=D(h,p,o,m);s.push(g.id)}return b.set(o,s),()=>S(o)}function S(o){let l=b.get(o);if(l){for(let c of l)F(c);b.delete(o)}}function j(){x=!0}function ge(){x=!1}function ke(o=!0){i=ce(o)}function Se(o){a=o}function Z(o,l,c){let s={altGraphChar:ze(o),composing:fe(o),focus:i&&$e(o,i),chord:_e(o)},h=[],f=new Set;for(let p of[Be(o),Me(o)])!p||f.has(p)||(f.add(p),Q(h,p,o,l,c,s));if(!h.length){let p=He(o);p&&!f.has(p)&&Q(h,p,o,l,c,s)}return h}function Q(o,l,c,s,h,{altGraphChar:f,composing:p,focus:m,chord:g}){let k=n.get(l)?.get(s);if(k?.length)for(let C of k){let v=C.options;h==="capture"&&!v.capture||h==="bubble"&&v.capture||f&&!v.altGraph||p&&!v.composing||m&&!(m==="control"&&g)&&!v.allowIn?.(c)||s==="keydown"&&v.repeat===!1&&c.repeat||v.when&&v.when(c)===!1||o.push(C)}}function X(o,l){let c=o.options;c.preventDefault&&l.preventDefault(),c.stopImmediatePropagation?l.stopImmediatePropagation():c.stopPropagation&&l.stopPropagation();try{o.handler(l)}finally{c.once&&F(o.id)}}function K(o,l="all"){return c=>{if(x)return;let s=Z(c,o,l);s.length&&X(le(s),c)}}let O=null,B=null,H=null,U=null;function xe({target:o=a,capture:l=d}={}){if(!o)throw new Error("hotkeys.init() requires a target (e.g. window)");if((O||B)&&Y(),l){O=R(o,"keydown",K("keydown"),{capture:!0}),B=R(o,"keyup",K("keyup"),{capture:!0});return}O=R(o,"keydown",K("keydown","bubble"),{capture:!1}),B=R(o,"keyup",K("keyup","bubble"),{capture:!1}),H=R(o,"keydown",K("keydown","capture"),{capture:!0}),U=R(o,"keyup",K("keyup","capture"),{capture:!0})}function Y(){O?.(),B?.(),H?.(),U?.(),O=null,B=null,H=null,U=null,n.clear(),b.clear(),w.clear()}function Ce(o,{type:l,target:c=null}={}){let{combo:s,type:h}=T(o),f=l||h;if(x)return!1;let p=s.bareModifier?Ue[s.bareModifier]:s.key??We(s.code),m=s.bareModifier?null:s.code??qe(s.key),g=!!s.alt,k=!!s.ctrl,C=!!s.shift,v=!!s.meta;s.bareModifier&&f==="keyup"&&(s.bareModifier==="alt"?g=!1:s.bareModifier==="ctrl"?k=!1:s.bareModifier==="shift"?C=!1:s.bareModifier==="meta"&&(v=!1));let A={type:f,key:p,code:m,ctrlKey:k,shiftKey:C,altKey:g,metaKey:v,repeat:!1,isComposing:!1,getModifierState(){return!1},preventDefault(){},stopPropagation(){},stopImmediatePropagation(){},target:c},_=Z(A,f,"all");return _.length?(X(le(_),A),!0):!1}return{init:xe,destroy:Y,setTarget:Se,bind:D,unbind:$,registerPlugin:y,unregisterPlugin:S,onBind:N,pause:j,resume:ge,ignoreInput:ke,trigger:Ce,parseHotkey:T,comboFromEvent:he,detectPlatform:E}}var ye=pe();typeof window<"u"&&ye.init();var V=ye;var M={$comment:"Machine-readable companion to docs/browser-hotkeys.md. Each combo entry describes who claims the binding and how strongly. Intended for runtime conflict warnings in keyboard-routing libraries (e.g. hotkey-router) and dev-time validation in apps like WebRadar. Update both this file and the markdown together \u2014 the markdown is the human source of truth, this file is the machine projection.",version:{generated:"2026-10-29",schema:"1.0",sources:["https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly","https://firefox-source-docs.mozilla.org/devtools-user/keyboard_shortcuts/index.html","https://support.google.com/chrome/answer/157179","https://developer.chrome.com/docs/devtools/shortcuts","https://support.apple.com/guide/safari/keyboard-shortcuts-and-gestures-cpsh003/mac","https://developer.apple.com/documentation/safari-developer-tools/web-inspector","https://support.microsoft.com/en-us/microsoft-edge/keyboard-shortcuts-in-microsoft-edge-50d3edab-30d9-c7e4-21ce-37fe2713cfad","https://support.apple.com/en-us/102650","https://support.microsoft.com/en-us/windows/keyboard-shortcuts-in-windows-dcc61a57-8ff0-cffe-9796-cb9706c75eec","https://help.gnome.org/gnome-help/shell-keyboard-shortcuts.html"]},severityLevels:{hard:"Browser or OS intercepts before page-world keydown fires. preventDefault() can't recover it.","find-bar-only":"Reserved only when the browser's find bar has focus. Fires in page world during normal browsing.","menu-activation":"Win/Linux Alt+letter activates the browser menu bar. Hard to suppress reliably.","system-text":"Only reserved while a text input has focus (terminal-style cursor controls on macOS).",compose:"macOS Option+letter types a special character in text inputs. Outside inputs, free for page world.",os:"Operating system intercepts globally, before any application sees it.","devtools-open":"Only relevant when DevTools is already open; outside DevTools it fires normally.",preventable:"The browser's own shortcut, but keydown reaches the page first: a binding with preventDefault() keeps the browser out, and without one the browser acts. Checked with real keys on Windows (docs/notes/key-check-reserved-2026-10-29.md)."},$keyFormat:"Each combo key uses hotkey-router-compatible syntax: modifiers in canonical order (ctrl|meta|alt|shift) joined by '+', then the key (lowercased letter, or symbolic name). Per-platform tables use the platform's native modifier name \u2014 `meta` on macOS = Cmd, `meta` on Windows = Win, `ctrl` on Linux/Windows = the primary modifier.",platforms:{mac:{browsers:{firefox:{"meta+a":{action:"Select all",severity:"hard"},"meta+b":{action:"Bookmarks sidebar",severity:"hard"},"meta+c":{action:"Copy",severity:"hard"},"meta+d":{action:"Bookmark this page",severity:"hard"},"meta+e":{action:"Search from page",severity:"hard"},"meta+f":{action:"Find in page",severity:"hard"},"meta+g":{action:"Find next",severity:"hard"},"meta+j":{action:"Downloads",severity:"hard"},"meta+l":{action:"Focus address bar",severity:"hard"},"meta+n":{action:"New window",severity:"hard"},"meta+o":{action:"Open file",severity:"hard"},"meta+p":{action:"Print",severity:"hard"},"meta+r":{action:"Reload",severity:"hard"},"meta+s":{action:"Save page",severity:"hard"},"meta+t":{action:"New tab",severity:"hard"},"meta+u":{action:"View source",severity:"hard"},"meta+v":{action:"Paste",severity:"hard"},"meta+w":{action:"Close tab",severity:"hard"},"meta+x":{action:"Cut",severity:"hard"},"meta+y":{action:"Redo",severity:"hard"},"meta+z":{action:"Undo",severity:"hard"},"meta+shift+a":{action:"Add-ons manager",severity:"hard"},"meta+shift+b":{action:"Bookmarks toolbar",severity:"hard"},"meta+shift+c":{action:"Inspector (element picker)",severity:"hard"},"meta+shift+d":{action:"Bookmark all tabs",severity:"hard"},"meta+shift+e":{action:"Network Monitor",severity:"hard"},"meta+shift+f":{action:"Toggle fullscreen",severity:"hard"},"meta+shift+g":{action:"Find previous",severity:"find-bar-only"},"meta+shift+j":{action:"Browser Console",severity:"hard"},"meta+shift+n":{action:"New private window",severity:"hard"},"meta+shift+o":{action:"Bookmarks library",severity:"hard"},"meta+shift+p":{action:"New private window (alt)",severity:"hard"},"meta+shift+q":{action:"Quit (with confirm)",severity:"hard"},"meta+shift+s":{action:"Firefox Screenshot",severity:"hard"},"meta+shift+t":{action:"Reopen closed tab",severity:"hard"},"meta+shift+v":{action:"Paste as plain text",severity:"hard"},"meta+shift+w":{action:"Close window",severity:"hard"},"meta+shift+z":{action:"Redo",severity:"hard"},"meta+alt+c":{action:"Inspector",severity:"hard"},"meta+alt+e":{action:"Network Monitor",severity:"hard"},"meta+alt+i":{action:"DevTools Toolbox",severity:"hard"},"meta+alt+j":{action:"Browser Console",severity:"hard"},"meta+alt+k":{action:"Web Console",severity:"hard"},"meta+alt+m":{action:"Responsive Design Mode",severity:"hard"},"meta+alt+z":{action:"Debugger",severity:"hard"}},chrome:{"meta+a":{action:"Select all",severity:"hard"},"meta+c":{action:"Copy",severity:"hard"},"meta+d":{action:"Bookmark this page",severity:"hard"},"meta+e":{action:"Search selected text",severity:"find-bar-only"},"meta+f":{action:"Find in page",severity:"hard"},"meta+g":{action:"Find next",severity:"hard"},"meta+l":{action:"Focus address bar",severity:"hard"},"meta+n":{action:"New window",severity:"hard"},"meta+o":{action:"Open file",severity:"hard"},"meta+p":{action:"Print",severity:"hard"},"meta+r":{action:"Reload",severity:"hard"},"meta+s":{action:"Save page",severity:"hard"},"meta+t":{action:"New tab",severity:"hard"},"meta+v":{action:"Paste",severity:"hard"},"meta+w":{action:"Close tab",severity:"hard"},"meta+x":{action:"Cut",severity:"hard"},"meta+y":{action:"History page",severity:"hard"},"meta+z":{action:"Undo",severity:"hard"},"meta+shift+b":{action:"Bookmarks bar toggle",severity:"hard"},"meta+shift+c":{action:"DevTools Inspector",severity:"hard"},"meta+shift+d":{action:"Bookmark all tabs",severity:"hard"},"meta+shift+g":{action:"Find previous",severity:"find-bar-only"},"meta+shift+j":{action:"Downloads page",severity:"hard"},"meta+shift+m":{action:"Switch user / guest",severity:"hard"},"meta+shift+n":{action:"New incognito window",severity:"hard"},"meta+shift+r":{action:"Hard reload",severity:"hard"},"meta+shift+t":{action:"Reopen closed tab",severity:"hard"},"meta+shift+v":{action:"Paste as plain text",severity:"hard"},"meta+shift+w":{action:"Close window",severity:"hard"},"meta+shift+z":{action:"Redo",severity:"hard"},"meta+alt+i":{action:"DevTools",severity:"hard"},"meta+alt+j":{action:"DevTools (console)",severity:"hard"},"meta+alt+u":{action:"View source",severity:"hard"}},safari:{"meta+a":{action:"Select all",severity:"hard"},"meta+c":{action:"Copy",severity:"hard"},"meta+d":{action:"Add to Reading List",severity:"hard"},"meta+f":{action:"Find in page",severity:"hard"},"meta+g":{action:"Find next",severity:"hard"},"meta+j":{action:"Downloads",severity:"hard"},"meta+l":{action:"Focus Smart Search",severity:"hard"},"meta+n":{action:"New window",severity:"hard"},"meta+p":{action:"Print",severity:"hard"},"meta+r":{action:"Reload",severity:"hard"},"meta+s":{action:"Save page",severity:"hard"},"meta+t":{action:"New tab",severity:"hard"},"meta+v":{action:"Paste",severity:"hard"},"meta+w":{action:"Close tab",severity:"hard"},"meta+x":{action:"Cut",severity:"hard"},"meta+z":{action:"Undo",severity:"hard"},"meta+shift+c":{action:"Inspector pick element",severity:"hard"},"meta+shift+d":{action:"Add Reading List item",severity:"hard"},"meta+shift+g":{action:"Find previous",severity:"find-bar-only"},"meta+shift+h":{action:"Go to homepage",severity:"hard"},"meta+shift+n":{action:"New private window",severity:"hard"},"meta+shift+r":{action:"Reader mode",severity:"hard"},"meta+shift+t":{action:"Reopen last closed tab",severity:"hard"},"meta+shift+v":{action:"Paste as plain text",severity:"hard"},"meta+shift+w":{action:"Close window",severity:"hard"},"meta+shift+z":{action:"Redo",severity:"hard"},"meta+alt+c":{action:"Web Inspector pick",severity:"hard"},"meta+alt+i":{action:"Web Inspector",severity:"hard"}}},system:{"meta+space":{action:"Spotlight",severity:"os"},"meta+tab":{action:"App switcher",severity:"os"},"meta+h":{action:"Hide app",severity:"os"},"meta+m":{action:"Minimize window",severity:"os"},"meta+q":{action:"Quit app",severity:"os"},"meta+shift+3":{action:"Screenshot full screen",severity:"os"},"meta+shift+4":{action:"Screenshot selection",severity:"os"},"meta+shift+5":{action:"Screen recording tool",severity:"os"},"meta+shift+q":{action:"Log out",severity:"os"},"meta+ctrl+q":{action:"Lock screen",severity:"os"},"meta+ctrl+space":{action:"Character Viewer",severity:"os"},"meta+alt+esc":{action:"Force-quit dialog",severity:"os"},"meta+shift+slash":{action:"Help menu search (Cmd+?)",severity:"os"},"meta+alt+h":{action:"Hide other apps",severity:"os"},"meta+alt+d":{action:"Show or hide the Dock",severity:"os"},"meta+backquote":{action:"Switch windows of the front app",severity:"os"}},noteForLetterCombos:{"alt+a..z":{behavior:"compose",note:"Option+letter types special characters in text inputs (Option+E\u2192\xB4, Option+A\u2192\xE5, Option+F\u2192\u0192). Outside inputs, free for page world."},"ctrl+a..z":{behavior:"system-text",note:"Mac uses Ctrl+letter as terminal-style cursor controls inside text inputs (Ctrl+A=line start, Ctrl+E=line end, Ctrl+K=delete-to-end, etc.). Outside inputs, free for page world."}}},windows:{browsers:{firefox:{"ctrl+a":{action:"Select all",severity:"preventable"},"ctrl+b":{action:"Bookmarks sidebar",severity:"preventable"},"ctrl+c":{action:"Copy",severity:"preventable"},"ctrl+d":{action:"Bookmark this page",severity:"preventable"},"ctrl+e":{action:"Search from page",severity:"preventable"},"ctrl+f":{action:"Find in page",severity:"preventable"},"ctrl+g":{action:"Find next",severity:"preventable"},"ctrl+h":{action:"History sidebar",severity:"preventable"},"ctrl+j":{action:"Downloads",severity:"preventable"},"ctrl+k":{action:"Search from page",severity:"preventable"},"ctrl+l":{action:"Focus address bar",severity:"preventable"},"ctrl+n":{action:"New window",severity:"hard"},"ctrl+o":{action:"Open file",severity:"preventable"},"ctrl+p":{action:"Print",severity:"preventable"},"ctrl+r":{action:"Reload",severity:"preventable"},"ctrl+s":{action:"Save page",severity:"preventable"},"ctrl+t":{action:"New tab",severity:"hard"},"ctrl+u":{action:"View source",severity:"preventable"},"ctrl+v":{action:"Paste",severity:"preventable"},"ctrl+w":{action:"Close tab",severity:"hard"},"ctrl+x":{action:"Cut",severity:"preventable"},"ctrl+y":{action:"Redo",severity:"preventable"},"ctrl+z":{action:"Undo",severity:"preventable"},"ctrl+shift+a":{action:"Add-ons manager",severity:"hard"},"ctrl+shift+b":{action:"Bookmarks toolbar",severity:"hard"},"ctrl+shift+c":{action:"Inspector (element picker)",severity:"hard"},"ctrl+shift+d":{action:"Bookmark all tabs",severity:"hard"},"ctrl+shift+e":{action:"Network Monitor",severity:"hard"},"ctrl+shift+g":{action:"Find previous",severity:"find-bar-only"},"ctrl+shift+i":{action:"Developer Tools",severity:"hard"},"ctrl+shift+j":{action:"Browser Console",severity:"hard"},"ctrl+shift+k":{action:"Web Console",severity:"hard"},"ctrl+shift+m":{action:"Responsive Design Mode",severity:"hard"},"ctrl+shift+n":{action:"New private window",severity:"hard"},"ctrl+shift+o":{action:"Bookmarks library",severity:"hard"},"ctrl+shift+p":{action:"New private window (alt)",severity:"hard"},"ctrl+shift+s":{action:"Firefox Screenshot",severity:"hard"},"ctrl+shift+t":{action:"Reopen closed tab",severity:"hard"},"ctrl+shift+v":{action:"Paste as plain text",severity:"hard"},"ctrl+shift+w":{action:"Close window",severity:"hard"},"ctrl+shift+y":{action:"Downloads (alt)",severity:"hard"},"ctrl+shift+z":{action:"Debugger",severity:"hard"},"alt+f":{action:"File menu",severity:"menu-activation"},"alt+e":{action:"Edit menu",severity:"menu-activation"},"alt+v":{action:"View menu",severity:"menu-activation"},"alt+b":{action:"Bookmarks menu",severity:"menu-activation"},"alt+t":{action:"Tools menu",severity:"menu-activation"},"alt+h":{action:"Help menu",severity:"menu-activation"},"alt+d":{action:"Focus address bar",severity:"hard"}},chrome:{"ctrl+a":{action:"Select all",severity:"preventable"},"ctrl+c":{action:"Copy",severity:"preventable"},"ctrl+d":{action:"Bookmark this page",severity:"preventable"},"ctrl+e":{action:"Search from page",severity:"preventable"},"ctrl+f":{action:"Find in page",severity:"preventable"},"ctrl+g":{action:"Find next",severity:"preventable"},"ctrl+h":{action:"History page",severity:"preventable"},"ctrl+j":{action:"Downloads",severity:"preventable"},"ctrl+k":{action:"Search from page",severity:"preventable"},"ctrl+l":{action:"Focus address bar",severity:"preventable"},"ctrl+n":{action:"New window",severity:"hard"},"ctrl+o":{action:"Open file",severity:"preventable"},"ctrl+p":{action:"Print",severity:"preventable"},"ctrl+r":{action:"Reload",severity:"preventable"},"ctrl+s":{action:"Save page",severity:"preventable"},"ctrl+t":{action:"New tab",severity:"hard"},"ctrl+u":{action:"View source",severity:"preventable"},"ctrl+v":{action:"Paste",severity:"preventable"},"ctrl+w":{action:"Close tab",severity:"hard"},"ctrl+x":{action:"Cut",severity:"preventable"},"ctrl+z":{action:"Undo",severity:"preventable"},"ctrl+shift+b":{action:"Bookmarks bar toggle",severity:"hard"},"ctrl+shift+d":{action:"Bookmark all tabs",severity:"hard"},"ctrl+shift+g":{action:"Find previous",severity:"find-bar-only"},"ctrl+shift+i":{action:"DevTools",severity:"hard"},"ctrl+shift+j":{action:"DevTools (console)",severity:"hard"},"ctrl+shift+m":{action:"Switch user / guest",severity:"hard"},"ctrl+shift+n":{action:"Incognito window",severity:"hard"},"ctrl+shift+r":{action:"Hard reload",severity:"hard"},"ctrl+shift+t":{action:"Reopen closed tab",severity:"hard"},"ctrl+shift+v":{action:"Paste as plain text",severity:"hard"},"ctrl+shift+w":{action:"Close window",severity:"hard"},"alt+d":{action:"Focus address bar",severity:"hard"},"alt+e":{action:"Customize menu",severity:"menu-activation"},"alt+f":{action:"Customize menu (alt)",severity:"menu-activation"}},edge:{"ctrl+a":{action:"Select all",severity:"preventable"},"ctrl+c":{action:"Copy",severity:"preventable"},"ctrl+d":{action:"Favorite this page",severity:"preventable"},"ctrl+e":{action:"Search from page",severity:"preventable"},"ctrl+f":{action:"Find in page",severity:"preventable"},"ctrl+g":{action:"Find next",severity:"preventable"},"ctrl+h":{action:"History",severity:"preventable"},"ctrl+j":{action:"Downloads",severity:"preventable"},"ctrl+k":{action:"Search from page",severity:"preventable"},"ctrl+l":{action:"Focus address bar",severity:"preventable"},"ctrl+m":{action:"Mute current tab",severity:"preventable"},"ctrl+n":{action:"New window",severity:"hard"},"ctrl+o":{action:"Open file",severity:"preventable"},"ctrl+p":{action:"Print",severity:"preventable"},"ctrl+r":{action:"Reload",severity:"preventable"},"ctrl+s":{action:"Save page",severity:"preventable"},"ctrl+t":{action:"New tab",severity:"hard"},"ctrl+u":{action:"View source",severity:"preventable"},"ctrl+v":{action:"Paste",severity:"preventable"},"ctrl+w":{action:"Close tab",severity:"hard"},"ctrl+x":{action:"Cut",severity:"preventable"},"ctrl+z":{action:"Undo",severity:"preventable"},"ctrl+shift+b":{action:"Favorites bar toggle",severity:"hard"},"ctrl+shift+d":{action:"Bookmark all tabs in folder",severity:"hard"},"ctrl+shift+e":{action:"Search in sidebar",severity:"hard"},"ctrl+shift+g":{action:"Find previous",severity:"find-bar-only"},"ctrl+shift+i":{action:"DevTools",severity:"hard"},"ctrl+shift+j":{action:"DevTools (console)",severity:"hard"},"ctrl+shift+k":{action:"Duplicate tab",severity:"hard"},"ctrl+shift+l":{action:"Paste and search",severity:"hard"},"ctrl+shift+m":{action:"Switch user / guest",severity:"hard"},"ctrl+shift+n":{action:"InPrivate window",severity:"hard"},"ctrl+shift+o":{action:"Open favorites",severity:"hard"},"ctrl+shift+p":{action:"Print (system dialog)",severity:"hard"},"ctrl+shift+r":{action:"Hard reload",severity:"hard"},"ctrl+shift+t":{action:"Reopen closed tab",severity:"hard"},"ctrl+shift+u":{action:"Read Aloud toggle",severity:"hard"},"ctrl+shift+v":{action:"Paste without formatting",severity:"hard"},"ctrl+shift+w":{action:"Close window",severity:"hard"},"ctrl+shift+y":{action:"Collections",severity:"hard"},"alt+d":{action:"Focus address bar",severity:"hard"},"alt+e":{action:"Settings menu",severity:"menu-activation"},"alt+f":{action:"Settings menu (alt)",severity:"menu-activation"},"alt+shift+b":{action:"Focus favorites bar",severity:"hard"},"alt+shift+i":{action:"Send feedback dialog",severity:"hard"},"alt+shift+t":{action:"Focus app bar toolbar",severity:"hard"}}},system:{"meta+a":{action:"Action Center",severity:"os"},"meta+c":{action:"Windows search",severity:"os"},"meta+d":{action:"Show desktop",severity:"os"},"meta+e":{action:"File Explorer",severity:"os"},"meta+g":{action:"Game bar",severity:"os"},"meta+h":{action:"Voice dictation",severity:"os"},"meta+i":{action:"Settings",severity:"os"},"meta+l":{action:"Lock",severity:"os"},"meta+n":{action:"Notification center",severity:"os"},"meta+p":{action:"Project / display mode",severity:"os"},"meta+r":{action:"Run dialog",severity:"os"},"meta+s":{action:"Search",severity:"os"},"meta+v":{action:"Clipboard history",severity:"os"},"meta+w":{action:"Widgets",severity:"os"},"meta+x":{action:"Quick Link menu",severity:"os"},"meta+z":{action:"Snap layouts",severity:"os"},"meta+tab":{action:"Task View",severity:"os"},"meta+shift+s":{action:"Screenshot region",severity:"os"},"ctrl+shift+esc":{action:"Task Manager",severity:"os"},"ctrl+alt+del":{action:"Security screen",severity:"os"},"alt+tab":{action:"Switch windows",severity:"os"},"alt+f4":{action:"Close active window",severity:"os"}}},linux:{browsers:{firefox:"$ref:platforms.windows.browsers.firefox",chrome:"$ref:platforms.windows.browsers.chrome",edge:"$ref:platforms.windows.browsers.edge"},system:{$comment:"GNOME defaults. KDE and other DEs have similar-shaped reservations but vary; this is a conservative baseline.","meta+tab":{action:"Switch windows",severity:"os"},"meta+a":{action:"Show applications",severity:"os"},"meta+l":{action:"Lock screen",severity:"os"},"meta+v":{action:"Notification list",severity:"os"},"alt+tab":{action:"Switch applications",severity:"os"},"alt+esc":{action:"Cycle windows",severity:"os"},"alt+f2":{action:"Run command",severity:"os"},"alt+f4":{action:"Close window",severity:"os"},"ctrl+alt+tab":{action:"Top-bar accessibility switcher",severity:"os"},"ctrl+alt+del":{action:"Power-off dialog",severity:"os"},"ctrl+shift+alt+r":{action:"Toggle screencast recording",severity:"os"}},noteForCtrlAlt:"Some Linux setups map right-Alt (AltGr) to 'compose' for typing accented characters, in which case AltGr+letter is reported as ctrl+alt+letter and types a special character. Avoid the ctrl+alt+letter namespace on Linux."}}};var Ge="1.0",Ze=new Set(["hard","os","menu-activation"]);function Qe(e){let t=String(e).toLowerCase().split("+").map(d=>d.trim()).filter(Boolean);if(!t.length)return"";let r=t[t.length-1],i=new Set(t.slice(0,-1)),a=[];return i.has("ctrl")&&a.push("ctrl"),i.has("meta")&&a.push("meta"),i.has("alt")&&a.push("alt"),i.has("shift")&&a.push("shift"),a.push(r),a.join("+")}function Xe(e,t){if(typeof e!="string"||!e.startsWith("$ref:"))return e;let r=e.slice(5).split("."),i=t;for(let a of r)i=i?.[a];return i}function me(e){if(!e||typeof e!="object")return null;let t=Object.create(null);for(let[r,i]of Object.entries(e))!i||typeof i!="object"||!("severity"in i)||(t[Qe(r)]=i);return t}function Ye(e){let t={platforms:{}},r=e?.platforms||{};for(let[i,a]of Object.entries(r)){let d={};for(let[u,n]of Object.entries(a.browsers||{}))d[u]=me(Xe(n,e));t.platforms[i]={browsers:d,system:me(a.system)}}return t}var ve=M?.version?.schema===Ge,Je=ve?Ye(M):{platforms:{}},et=ne;function tt(e,{platform:t,browser:r}={}){if(!ve)return null;let i=et(e);if(!i)return null;let a=t&&Je.platforms[t];if(!a)return null;let u=(r?a.browsers?.[r]:null)?.[i];if(u)return{source:"browser",platform:t,browser:r,lookupKey:i,action:u.action,severity:u.severity};let n=a.system?.[i];return n?{source:"system",platform:t,browser:r,lookupKey:i,action:n.action,severity:n.severity}:null}function be(e){return Ze.has(e)}function rt(e,t,r){let i=te(e.platform),a=e.source==="browser"?`${e.browser} on ${i}`:i,d=be(e.severity)?"will not fire":e.severity==="preventable"?r?.preventDefault?"fires first; preventDefault keeps the browser out":"fires, and the browser acts too; bind with preventDefault: true":"fires in normal browsing";return`[hotkey-router] "${t}" (${e.lookupKey}) reserved by ${a}: "${e.action}" [${e.severity}] \u2014 ${d}.`}function it(e,t,r=console,i){let a=rt(e,t,i);(be(e.severity)||e.severity==="preventable"&&!i?.preventDefault?r.warn:r.info).call(r,a)}function we(e,t={}){if(!e||typeof e.onBind!="function")throw new TypeError("installReservationWarnings(hotkeys) requires a hotkey-router instance with onBind() (>= v0.2.0)");let r=t.platform!==void 0?t.platform:E(),i=t.browser!==void 0?t.browser:ee(),a=t.console||console;return e.onBind(({combo:d,raw:u,options:n})=>{if(n?.warnOnReserved===!1||!r||!i)return;let b=tt(d,{platform:r,browser:i});b&&it(b,u,a,n)})}var mt=M?.version?.schema,vt=M?.version?.generated;we(V);var kt=V;export{kt as default};
|
package/dist/core.js
CHANGED
package/dist/format.js
CHANGED
package/dist/hotkey-router.cjs
CHANGED
package/dist/hotkey-router.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// hotkey-router v0.
|
|
1
|
+
// hotkey-router v0.5.0 | SEE LICENSE IN LICENSE
|
|
2
2
|
|
|
3
3
|
function Y(t){return t?/Chrome ?OS|CrOS/i.test(t)?"chromeos":/Mac|iPhone|iPad|iPod/i.test(t)?"mac":/Win/i.test(t)?"windows":/Linux|X11/i.test(t)?"linux":null:null}function _(t=typeof navigator<"u"?navigator:null,{chromeos:e=!1}={}){if(!t)return null;let r=t.userAgent||"",i=(/\bCrOS\b/.test(r)?"chromeos":null)||Y(t.userAgentData?.platform)||Y(t.platform)||(/Mac OS X/i.test(r)?"mac":/Windows/i.test(r)?"windows":/Linux|X11/i.test(r)?"linux":null);return i==="chromeos"&&!e?"linux":i}var ht=_(),Q=new Set(["ctrl","shift","alt","meta","mod"]),yt=new Map([["^","ctrl"],["!","alt"],["+","shift"],["#","meta"]]),V=Object.freeze({esc:"escape",escape:"escape",space:" ",spacebar:" ",enter:"enter",return:"enter",del:"delete",delete:"delete",backspace:"backspace",tab:"tab",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",home:"home",end:"end",pageup:"pageup",pagedown:"pagedown",pgup:"pageup",pgdn:"pagedown",cmd:"meta",command:"meta",win:"meta",meta:"meta",control:"ctrl",ctrl:"ctrl",option:"alt",opt:"alt",alt:"alt",shift:"shift","\u2318":"meta","\u2303":"ctrl","\u2325":"alt","\u21E7":"shift",mod:"mod",plus:"+"});function T(t){let e=String(t??"");if(e===" ")return" ";let i=e.trim().toLowerCase();return V[i]??i}function gt(t){return Q.has(T(t))}var wt=/(^|\+)code:([A-Za-z][A-Za-z0-9_]*)/;function J(t,{platform:e=ht}={}){let r=String(t||"").trim(),i=null,c=d=>{i=i||`Invalid hotkey "${t}": ${d}`},m=/\s+up$/i.test(r),y=m?r.replace(/\s+up$/i,"").trim():r,s={ctrl:!1,shift:!1,alt:!1,meta:!1,key:null,code:null,bareModifier:null},k=d=>{d==="mod"?s[e==="mac"?"meta":"ctrl"]=!0:s[d]=!0},w=y;for(;w.length;){let d=yt.get(w[0])??null;if(!d)break;k(d),w=w.slice(1).trimStart()}let E=w.match(/code:[A-Za-z][A-Za-z0-9_]*/g);E&&E.length>1&&c(`multiple code: tokens not supported (got ${E.length}).`);let I=null,C=w.replace(wt,(d,x,v)=>(I=v,x+"__code__")).toLowerCase(),B=C.split("+").map(d=>d.trim()),D=B.filter(Boolean),N=B.some(d=>d==="")&&C.includes("++");if(!N){let d=!1;for(let x of D)gt(x)?d&&c('modifiers must come before the base key (e.g. "ctrl+k", not "k+ctrl")'):d=!0}for(let d of D){if(d==="__code__"){s.code=I;continue}let x=V[d]??d;Q.has(x)?k(x):s.key=T(x)}if(!s.key&&!s.code&&N&&(s.key="+"),!s.key&&!s.code){let d=(s.ctrl?1:0)+(s.shift?1:0)+(s.alt?1:0)+(s.meta?1:0);d===1?s.bareModifier=s.ctrl?"ctrl":s.shift?"shift":s.alt?"alt":"meta":d>1?c('multi-modifier bare bindings not supported. Add a base key (e.g. "ctrl+alt+x").'):i=i||`Invalid hotkey "${t}" (missing base key)`}return{combo:s,type:m?"keyup":"keydown",raw:t,error:i}}function M(t,e){let{combo:r,type:i,raw:c,error:m}=J(t,e);if(m)throw new Error(m);return{combo:r,type:i,raw:c}}var bt={",":["<","Comma"],".":[">","Period"],"/":["?","Slash"],";":[":","Semicolon"],"'":['"',"Quote"],"[":["{","BracketLeft"],"]":["}","BracketRight"],"\\":["|","Backslash"],"-":["_","Minus"],"=":["+","Equal"],"`":["~","Backquote"]};function tt(t){let{combo:e,type:r,error:i}=J(t);if(i||!e.shift||e.code)return null;let c=bt[e.key];if(!c)return null;let[m,y]=c,k=String(t).trim().replace(/\s+up$/i,"").slice(0,-1)+"code:"+y+(r==="keyup"?" up":"");return{message:`"${t}" never fires on US layouts: Shift turns "${e.key}" into "${m}". Bind "${k}" instead.`,suggestion:k}}function L(t,e,r,i){return t.addEventListener(e,r,i),()=>t.removeEventListener(e,r,i)}var kt=_(),q=Object.freeze({Alt:"alt",AltGraph:"alt",Control:"ctrl",Shift:"shift",Meta:"meta",OS:"meta"}),et=new Set;function F({ctrl:t,shift:e,alt:r,meta:i,key:c,code:m,bareModifier:y}){if(y)return`__bare__:${y}`;let s="";return t&&(s+="ctrl+"),e&&(s+="shift+"),r&&(s+="alt+"),i&&(s+="meta+"),m?s+"code:"+m:s?s+c:c}function Kt(t){let e=q[t.key];return e?`__bare__:${e}`:F({ctrl:t.ctrlKey,shift:t.shiftKey,alt:t.altKey,meta:t.metaKey,key:T(t.key)})}function xt(t){if(!t.code)return null;let e="";return t.ctrlKey&&(e+="ctrl+"),t.shiftKey&&(e+="shift+"),t.altKey&&(e+="alt+"),t.metaKey&&(e+="meta+"),e+"code:"+t.code}var Et=new Set(["checkbox","radio","range","color","file","button","submit","reset","image"]);function St(t){let e=t?.composedPath?.();if(e?.length)return e;let r=[];for(let i=t?.target;i;i=i.parentNode||i.host)r.push(i);return r}function At(t,e){let r=St(t),i=r[0];if(!i)return null;let c=String(i.tagName||"").toUpperCase();if(i.isContentEditable||c==="TEXTAREA"||c==="SELECT"||i.getAttribute?.("role")==="textbox")return"text";if(c==="INPUT"){if(e==="all")return"text";let m=String(i.getAttribute?.("type")||"text").toLowerCase();return Et.has(m)?"control":"text"}if(e==="text"){for(let m of r)if(String(m.tagName||"").toUpperCase()==="BUTTON"||m.getAttribute?.("role")==="button")return"control"}return null}function Mt(t){return!!((t.ctrlKey||t.altKey||t.metaKey)&&!q[t.key])}function nt(t){if(t==="all"||t==="text")return t;if(typeof t=="string")throw new TypeError(`hotkeys.ignoreInput() expects true, false, 'all' or 'text', got "${t}"`);return t?"all":null}function Ct(t,e){let r=e?{...e}:{};return t==="keydown"&&r.repeat==null&&(r.repeat=!1),r.priority==null&&(r.priority=0),r}function rt(t){let e=null;for(let r of t)e?(r.options.priority>e.options.priority||r.options.priority===e.options.priority&&r.id>e.id)&&(e=r):e=r;return e}function Pt(t){return!!(t.ctrlKey&&t.altKey&&typeof t.getModifierState=="function"&&t.getModifierState("AltGraph")&&typeof t.key=="string"&&t.key.length===1)}function it(t){return!!(t.isComposing||t.keyCode===229)}var _t=/^(?!\p{Script=Latin})\p{L}$/u;function Tt(t){if(!(t.ctrlKey||t.metaKey)||t.altKey||it(t)||typeof t.getModifierState=="function"&&t.getModifierState("AltGraph"))return null;let e=/^Key([A-Z])$/.exec(t.code||"");return!e||typeof t.key!="string"||!_t.test(t.key)?null:F({ctrl:t.ctrlKey,shift:t.shiftKey,alt:!1,meta:t.metaKey,key:e[1].toLowerCase()})}var Lt={ctrl:"Control",shift:"Shift",alt:"Alt",meta:"Meta"},st={Period:".",Comma:",",Semicolon:";",Quote:"'",Slash:"/",Backslash:"\\",BracketLeft:"[",BracketRight:"]",Minus:"-",Equal:"=",Backquote:"`",Space:" ",Enter:"Enter",NumpadEnter:"Enter",Tab:"Tab",Escape:"Escape",Backspace:"Backspace",Delete:"Delete",Insert:"Insert",Home:"Home",End:"End",PageUp:"PageUp",PageDown:"PageDown",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight"},U={},ot;for(let[t,e]of Object.entries(st))U[ot=T(e)]??(U[ot]=t);function Bt(t){if(!t)return null;let e=/^Key([A-Z])$/.exec(t);if(e)return e[1].toLowerCase();let r=/^(?:Digit|Numpad)(\d)$/.exec(t);return r?r[1]:/^F\d{1,2}$/.test(t)?t:st[t]??null}function $t(t){return t?/^[a-z]$/.test(t)?"Key"+t.toUpperCase():/^\d$/.test(t)?"Digit"+t:/^f\d{1,2}$/.test(t)?t.toUpperCase():U[t]??null:null}function at(t,{physical:e=!0,useMod:r=!1,platform:i=kt}={}){if(!t||q[t.key])return null;let c=[],m=i==="mac";if(r&&(m?t.metaKey:t.ctrlKey)&&c.push("mod"),t.ctrlKey&&!(r&&!m)&&c.push("ctrl"),t.metaKey&&!(r&&m)&&c.push("meta"),t.altKey&&c.push("alt"),t.shiftKey&&c.push("shift"),e&&t.code)c.push(`code:${t.code}`);else{let y=T(t.key);if(!y)return null;c.push(y===" "?"space":y)}return c.join("+")}function lt({target:t=typeof window<"u"?window:null,capture:e=!1,ignoreInput:r=!0}={}){let i=nt(r),c=t,m=e,y=[],s=new Map,k=new Map,w=new Map,E=!1,I=1;function Z(n,l){let a=s.get(n);a||(a=new Map,s.set(n,a));let o=a.get(l);return o||(o=[],a.set(l,o)),o}function C(n){let l=w.get(n);if(!l)return!1;let{comboStr:a,type:o}=l,f=s.get(a),u=f?.get(o);if(!u?.length)return w.delete(n),!1;let p=u.filter(h=>h.id!==n);return p.length?f.set(o,p):f.delete(o),f.size||s.delete(a),w.delete(n),!0}function B(n,l,a=null,o={}){let{combo:f,type:u,raw:p}=M(n),h=F(f),b=Ct(u,o),K={id:I++,comboStr:h,type:u,combo:f,handler:l,plugin:a,raw:p,options:b};Z(h,u).push(K),w.set(K.id,{comboStr:h,type:u});let S=`${h} ${u}`;if(!et.has(S)){let A=tt(n);A&&(et.add(S),console.warn(`[hotkey-router] ${A.message}`))}if(y.length)for(let A of y)try{A({combo:f,raw:p,options:b,plugin:a,id:K.id})}catch(R){console.error("[hotkey-router] onBind hook threw:",R)}let g=()=>C(K.id);return g.id=K.id,g.hotkey=p,g}function D(n){if(typeof n!="function")throw new TypeError("hotkeys.onBind(hook) expects a function");return y.push(n),()=>{y=y.filter(l=>l!==n)}}function N(n,l){let{combo:a,type:o}=M(n),f=F(a),u=s.get(f);if(!u)return;let p=u.get(o);if(p?.length){if(l){let h=[];for(let b of p)b.handler===l?w.delete(b.id):h.push(b);h.length?u.set(o,h):u.delete(o)}else{for(let h of p)w.delete(h.id);u.delete(o)}u.size||s.delete(f)}}function d(n,l){if(k.has(n))throw new Error(`Plugin "${n}" already registered`);let a=Object.entries(l);for(let[f]of a)M(f);let o=[];for(let[f,u]of a){let[p,h]=Array.isArray(u)?u:[u,{}],b=B(f,p,n,h);o.push(b.id)}return k.set(n,o),()=>x(n)}function x(n){let l=k.get(n);if(l){for(let a of l)C(a);k.delete(n)}}function v(){E=!0}function ct(){E=!1}function ft(n=!0){i=nt(n)}function pt(n){c=n}function j(n,l,a){let o={altGraphChar:Pt(n),composing:it(n),focus:i&&At(n,i),chord:Mt(n)},f=[],u=new Set;for(let p of[Kt(n),xt(n)])!p||u.has(p)||(u.add(p),G(f,p,n,l,a,o));if(!f.length){let p=Tt(n);p&&!u.has(p)&&G(f,p,n,l,a,o)}return f}function G(n,l,a,o,f,{altGraphChar:u,composing:p,focus:h,chord:b}){let K=s.get(l)?.get(o);if(K?.length)for(let S of K){let g=S.options;f==="capture"&&!g.capture||f==="bubble"&&g.capture||u&&!g.altGraph||p&&!g.composing||h&&!(h==="control"&&b)&&!g.allowIn?.(a)||o==="keydown"&&g.repeat===!1&&a.repeat||g.when&&g.when(a)===!1||n.push(S)}}function W(n,l){let a=n.options;a.preventDefault&&l.preventDefault(),a.stopImmediatePropagation?l.stopImmediatePropagation():a.stopPropagation&&l.stopPropagation();try{n.handler(l)}finally{a.once&&C(n.id)}}function P(n,l="all"){return a=>{if(E)return;let o=j(a,n,l);o.length&&W(rt(o),a)}}let $=null,O=null,z=null,H=null;function dt({target:n=c,capture:l=m}={}){if(!n)throw new Error("hotkeys.init() requires a target (e.g. window)");if(($||O)&&X(),l){$=L(n,"keydown",P("keydown"),{capture:!0}),O=L(n,"keyup",P("keyup"),{capture:!0});return}$=L(n,"keydown",P("keydown","bubble"),{capture:!1}),O=L(n,"keyup",P("keyup","bubble"),{capture:!1}),z=L(n,"keydown",P("keydown","capture"),{capture:!0}),H=L(n,"keyup",P("keyup","capture"),{capture:!0})}function X(){$?.(),O?.(),z?.(),H?.(),$=null,O=null,z=null,H=null,s.clear(),k.clear(),w.clear()}function mt(n,{type:l,target:a=null}={}){let{combo:o,type:f}=M(n),u=l||f;if(E)return!1;let p=o.bareModifier?Lt[o.bareModifier]:o.key??Bt(o.code),h=o.bareModifier?null:o.code??$t(o.key),b=!!o.alt,K=!!o.ctrl,S=!!o.shift,g=!!o.meta;o.bareModifier&&u==="keyup"&&(o.bareModifier==="alt"?b=!1:o.bareModifier==="ctrl"?K=!1:o.bareModifier==="shift"?S=!1:o.bareModifier==="meta"&&(g=!1));let A={type:u,key:p,code:h,ctrlKey:K,shiftKey:S,altKey:b,metaKey:g,repeat:!1,isComposing:!1,getModifierState(){return!1},preventDefault(){},stopPropagation(){},stopImmediatePropagation(){},target:a},R=j(A,u,"all");return R.length?(W(rt(R),A),!0):!1}return{init:dt,destroy:X,setTarget:pt,bind:B,unbind:N,registerPlugin:d,unregisterPlugin:x,onBind:D,pause:v,resume:ct,ignoreInput:ft,trigger:mt,parseHotkey:M,comboFromEvent:at,detectPlatform:_}}var ut=lt();typeof window<"u"&&ut.init();var vt=ut;export{at as comboFromEvent,lt as createRouter,vt as default,_ as detectPlatform,M as parseHotkey};
|