hotkey-router 0.3.3 → 0.4.1

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 CHANGED
@@ -13,12 +13,15 @@ A tiny, deterministic keyboard routing engine for modern web apps. Not a key uti
13
13
 
14
14
  - O(1) dispatch
15
15
  - Plugin-safe lifecycle management
16
- - Deterministic winner selection (priority + recency)
17
- - Input-safe by default
16
+ - Deterministic winner selection (priority + recency); see [Who gets a key](#who-gets-a-key)
17
+ - Separate and scoped routers: per library, dialog, shadow root or iframe (`createRouter`)
18
+ - Input-safe by default, with an opt-in mode that lets chords through on checkboxes, sliders and buttons
19
+ - Works on any keyboard layout: physical-key `code:` bindings, and Ctrl/Cmd shortcuts on non-Latin layouts
20
+ - AltGr and IME aware: no shortcut fires while typing a character
18
21
  - Testable via `trigger()`
19
- - Optional opt-in browser/OS conflict warnings (tree-shakable)
22
+ - Optional opt-in browser/OS conflict warnings and website-shortcut awareness (tree-shakable)
20
23
  - Display helpers: `Ctrl+Shift+.` / `⇧⌘.` and accessible keycaps (`hotkey-router/format`)
21
- - ~4 kB minified + gzipped (core); ~8.5 kB with conflict warnings
24
+ - ~4.9 kB minified + gzipped (core); ~9.5 kB with conflict warnings
22
25
  - Zero dependencies
23
26
 
24
27
  ---
@@ -26,19 +29,22 @@ A tiny, deterministic keyboard routing engine for modern web apps. Not a key uti
26
29
  ## Install
27
30
 
28
31
  ```sh
29
- pnpm add hotkey-router
32
+ npm install hotkey-router
30
33
  ```
31
34
 
35
+ (or `pnpm add hotkey-router`, `yarn add hotkey-router`)
36
+
32
37
  ESM:
33
38
 
34
39
  ```js
35
40
  import hotkeys from 'hotkey-router'
36
41
  ```
37
42
 
38
- CommonJS:
43
+ CommonJS (the router is the `default` export):
39
44
 
40
45
  ```js
41
- const hotkeys = require('hotkey-router')
46
+ const hotkeys = require('hotkey-router').default
47
+ const { createRouter } = require('hotkey-router')
42
48
  ```
43
49
 
44
50
  CDN (ESM):
@@ -47,6 +53,16 @@ CDN (ESM):
47
53
  import hotkeys from 'https://cdn.jsdelivr.net/npm/hotkey-router/dist/hotkey-router.min.js'
48
54
  ```
49
55
 
56
+ Nothing at import (v0.4.0+): `hotkey-router/core` has `createRouter` and the
57
+ helpers, but no ready router and no listeners until you start one.
58
+
59
+ ```js
60
+ import { createRouter } from 'hotkey-router/core'
61
+
62
+ const keys = createRouter()
63
+ keys.init() // when your app is ready
64
+ ```
65
+
50
66
  ---
51
67
 
52
68
  ## Quick start
@@ -54,22 +70,19 @@ import hotkeys from 'https://cdn.jsdelivr.net/npm/hotkey-router/dist/hotkey-rout
54
70
  ```js
55
71
  import hotkeys from 'hotkey-router'
56
72
 
57
- // Simple keydown
58
- hotkeys.bind('ctrl+k', () => {
73
+ // Simple keydown. `mod` is Cmd on macOS, Ctrl elsewhere.
74
+ hotkeys.bind('mod+shift+space', () => {
59
75
  openCommandPalette()
60
76
  })
61
77
 
62
- // Multi-modifier combos, including the spacebar
63
- hotkeys.bind('mod+shift+space', summonCommandPalette)
64
-
65
78
  // Keyup using " up" suffix
66
- hotkeys.bind('ctrl+p up', () => {
67
- console.log('Released CTRL+P')
79
+ hotkeys.bind('mod+shift+x up', () => {
80
+ console.log('Released Ctrl+Shift+X')
68
81
  })
69
82
 
70
83
  // AHK-style modifiers also supported
71
- hotkeys.bind('^k', () => {
72
- openCommandPalette() // ctrl+k
84
+ hotkeys.bind('^!k', () => {
85
+ openCommandPalette() // ctrl+alt+k
73
86
  })
74
87
 
75
88
  // Bare-modifier bindings (Alt-as-mode UX)
@@ -80,13 +93,19 @@ hotkeys.bind('alt up', exitSelectMode) // fires on Alt keyup
80
93
  // works on macOS where Option remaps Alt+X to ≈)
81
94
  hotkeys.bind('alt+code:KeyX', deleteHovered, null, { preventDefault: true })
82
95
 
83
- // Plugin grouping
96
+ // Plugin grouping. Plain keys don't fire while the user types in a field.
84
97
  hotkeys.registerPlugin('docs', {
85
- 'ctrl+f': openSearch,
98
+ '/': openSearch,
86
99
  'escape': closeSearch,
87
100
  })
88
101
  ```
89
102
 
103
+ Browsers and the OS keep some shortcuts for themselves (Ctrl+T, Ctrl+W, Cmd+Q
104
+ and more); a page never gets those keys. The examples above use keys that are
105
+ free in every major browser. Before picking your own, see
106
+ [Who gets a key](#who-gets-a-key). `hotkey-router/auto` warns in the console
107
+ when you bind a reserved one.
108
+
90
109
  ---
91
110
 
92
111
  ## API
@@ -232,9 +251,10 @@ Hook errors are caught and logged via `console.error`. A buggy hook can't break
232
251
 
233
252
  Temporarily disable or re-enable all routing.
234
253
 
235
- ### `ignoreInput(boolean = true)`
254
+ ### `ignoreInput(value = true)`
236
255
 
237
- By default, hotkeys do **not** fire inside:
256
+ `value` is `true` / `'all'` (the default, below), `'text'` (v0.4.0+, below)
257
+ or `false` (no check). By default, hotkeys do **not** fire inside:
238
258
 
239
259
  - `<input>`
240
260
  - `<textarea>`
@@ -261,6 +281,46 @@ hotkeys.bind('mod+k', openPalette, null, {
261
281
  })
262
282
  ```
263
283
 
284
+ **The `'text'` mode (v0.4.0+, opt-in).** For apps with forms and settings
285
+ panels, `hotkeys.ignoreInput('text')` (or `createRouter({ ignoreInput:
286
+ 'text' })`) blocks typing but not shortcuts:
287
+
288
+ | Where the key was typed | Plain and Shift-only keys | Chords with Ctrl, Alt or Meta |
289
+ | --- | --- | --- |
290
+ | Text entry: text-like and date/time `<input>` types (and any type not listed below), `<textarea>`, `<select>`, contenteditable, `role="textbox"` | blocked | blocked |
291
+ | Other controls: checkbox, radio, range, color, file, button, submit, reset and image inputs; `<button>`; `role="button"`; any element inside a button | blocked (Space, Enter and arrows belong to the control) | **fire** |
292
+
293
+ A chord needs a non-modifier key, so bare-modifier bindings (`alt`,
294
+ `alt up`) stay blocked on controls. Where an element is both (an editable
295
+ element inside a button), text entry wins. `allowIn` still overrides the
296
+ input check, but not the AltGr, IME, repeat or `when` checks. The default
297
+ stays `'all'`, so nothing changes unless you opt in.
298
+
299
+ ### `createRouter(options?)` (v0.4.0+)
300
+
301
+ A separate router: its own bindings, plugins, `pause()`, `ignoreInput()`,
302
+ `onBind` hooks and listeners, with the same methods as the default export.
303
+ It attaches nothing until you call `init()`.
304
+
305
+ ```js
306
+ import { createRouter } from 'hotkey-router'
307
+
308
+ const dialogKeys = createRouter({ target: dialogEl })
309
+ dialogKeys.init()
310
+ dialogKeys.bind('escape', closeDialog)
311
+ // Later
312
+ dialogKeys.destroy() // the page's other routers keep working
313
+ ```
314
+
315
+ Options: `target` (default `window` when there is one; an element, a
316
+ `ShadowRoot` or an iframe's window scopes the router to keys from inside
317
+ it), `capture` (default `false`) and `ignoreInput` (default `true`; also
318
+ `'text'` or `false`, as for `ignoreInput()`).
319
+ `target` and `capture` are defaults: `init({ target, capture })` overrides
320
+ them for that call only. `setTarget(target)` changes the default target of an
321
+ existing router, which is useful when other code holds on to it; it doesn't
322
+ move listeners until the next `init()`. See [Multiple routers](#multiple-routers-v040).
323
+
264
324
  ### `init(options?)`
265
325
 
266
326
  Manually attach listeners.
@@ -276,8 +336,9 @@ Auto-initializes on `window` by default (browser environments): importing
276
336
  `hotkey-router` attaches `keydown` and `keyup` listeners to `window` straight
277
337
  away, and `hotkey-router/auto` also installs the reservation warnings. The
278
338
  package's `sideEffects` list names those files so bundlers keep that work;
279
- `/reservations`, `/sites`, `/validate` and `/format` do nothing at import and
280
- tree-shake away when unused.
339
+ `/core` (v0.4.0+), `/reservations`, `/sites`, `/validate` and `/format` do
340
+ nothing at import and tree-shake away when unused. `hotkey-router` is built
341
+ on `hotkey-router/core`, so an app that imports both bundles one copy.
281
342
 
282
343
  With `capture: false` (the default), bindings run in the bubble phase except
283
344
  those bound with `{ capture: true }`, which a second, capture-phase listener
@@ -329,6 +390,11 @@ would: the synthetic event has both `key` and `code` (US layout), so
329
390
  and the same guards apply (`when`, `ignoreInput`/`allowIn` with `target`,
330
391
  priority, `once`, `pause()`).
331
392
 
393
+ Each router's `trigger()` fires only that router's bindings. It doesn't
394
+ check the router's scope: `target` only feeds the input check, so a router
395
+ on a dialog still fires for a `target` outside the dialog, where a real
396
+ keypress would never reach it.
397
+
332
398
  ---
333
399
 
334
400
  ## Notes
@@ -349,6 +415,67 @@ hotkeys.bind('escape', closeModal, null, {
349
415
  })
350
416
  ```
351
417
 
418
+ ### Who gets a key
419
+
420
+ A keypress meets these in order, and each one can stop it before the next:
421
+
422
+ 1. **The browser and the OS.** Reserved shortcuts (Ctrl+T, Cmd+Q, Spotlight)
423
+ are taken before the page gets a keydown, and no listener can get them
424
+ back. [Conflict warnings](#conflict-warnings-v020) flag them when you bind.
425
+ 2. **The capture phase, from `window` down to the focused element.** Bindings
426
+ with `{ capture: true }`, or every binding of a router started with
427
+ `init({ capture: true })`, run here, at the router's target. That's before
428
+ the page's own listeners below it, so they can stop the key with
429
+ `stopPropagation`. Listeners on the same target run in the order they were
430
+ added.
431
+ 3. **The focused element, then the bubble phase back up.** The page's own
432
+ handlers (an editor's keymap, say) run first and can stop the key. Other
433
+ bindings run when it reaches the router's target. For the default router,
434
+ that's `window`, last of all.
435
+ 4. **Inside one router**, each time its listener runs:
436
+ - **Lookup:** the bindings for the key (`ctrl+k`) and for the physical key
437
+ (`ctrl+code:KeyK`) are both candidates. The non-Latin fallback (`ctrl+k`
438
+ from Russian Ctrl+K) is tried only when neither has an eligible binding.
439
+ - **Checks per binding:** AltGr typing a character, IME composition, the
440
+ input check (`ignoreInput` / `allowIn`), auto-repeat, then `when`.
441
+ A paused router skips all of this.
442
+ - **One winner:** highest `priority`, then the most recently bound. One
443
+ binding per router fires in each phase.
444
+ - **What the winner can do:** `preventDefault` stops the browser's own action
445
+ (typing the character, scrolling). `stopPropagation` and
446
+ `stopImmediatePropagation` stop the event as in steps 2 and 3.
447
+ 5. **Between routers:** each picks its own winner, and both fire if the event
448
+ reaches both. See [Multiple routers](#multiple-routers-v040).
449
+
450
+ ### Multiple routers (v0.4.0+)
451
+
452
+ The default export is one router, started on `window` at import. Each
453
+ `createRouter()` call makes another. Use one when:
454
+
455
+ - **two libraries in one bundle both use hotkey-router.** They'd otherwise share
456
+ the default router (one copy of the module, one registry), so one's
457
+ `pause()` or `destroy()` would stop the other's keys. With its own router
458
+ each is independent. A browser extension's content scripts don't share a
459
+ router with the page's own scripts anyway: they run in a separate,
460
+ isolated JavaScript world with their own copy of the module. Key events
461
+ still reach both.
462
+ - **keys belong to a scope.** A router on a dialog element, a `ShadowRoot` or
463
+ an iframe's window only sees keys from inside it, while page-wide keys stay
464
+ on the default router.
465
+
466
+ Routers don't arbitrate between each other. If two routers bind the same key
467
+ and the event reaches both, both fire: priority and recency only pick a
468
+ winner within one router. To let one take the key, gate the other with `when`,
469
+ or keep their scopes apart. `stopPropagation` doesn't stop another router
470
+ listening on the same target. `stopImmediatePropagation` does, but only for
471
+ routers whose listeners were added later.
472
+
473
+ Shared by every router: the parser, `comboFromEvent`, `detectPlatform`, and
474
+ the one-time console warning for shifted punctuation (once per combo per
475
+ loaded copy of the module). Reservation warnings are per router:
476
+ `installReservationWarnings(router)` covers that router's binds only, and
477
+ `hotkey-router/auto` covers the default router.
478
+
352
479
  ### Bare-modifier bindings (v0.1.0+)
353
480
 
354
481
  Some UX patterns are driven by a bare modifier rather than a chord. For example, "hold Alt to enter select mode, release Alt to exit."
@@ -379,7 +506,7 @@ The `code:` value is **case-sensitive** (matches the camelCase `KeyboardEvent.co
379
506
 
380
507
  Some combos are reserved by the browser chrome (find bar, devtools, bookmarks) or the OS (Spotlight, window management). They never reach page-world JavaScript, no matter how early you listen or whether you call `preventDefault`. hotkey-router ships an **opt-in** reservation table that emits a soft warning at bind time, so the silent failure becomes a noisy one.
381
508
 
382
- The feature is opt-in by design: the core router is ~10 KB minified (~4.5 KB gzipped), and the reservation module (~23 KB minified, ~5.5 KB gzipped, mostly data) is tree-shaken out entirely unless you import it.
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.
383
510
 
384
511
  **Two ways to opt in.** One-line ergonomic, use the `auto` entry. Same default export as `hotkey-router`, with warnings pre-installed. It is the same router object, so other files can keep importing `hotkey-router` and their bindings are warned about too (v0.3.3+; earlier versions shipped a second copy of the router in `auto`). The CDN file `dist/auto.min.js` is a standalone build with its own router; don't mix it with other hotkey-router imports.
385
512
 
@@ -652,6 +779,25 @@ Modern browsers supporting:
652
779
 
653
780
  Chrome, Firefox, Safari, Edge.
654
781
 
782
+ ### Testing
783
+
784
+ Everything runs locally; there is no hosted CI.
785
+
786
+ - `npm test`: unit tests in jsdom.
787
+ - `npm run test:browser` (v0.4.0+): builds, then runs `browser-tests/` in the
788
+ Chrome and Edge installed on this machine through `playwright-core`. That
789
+ covers real key events through shadow roots, routers scoped to a dialog, a
790
+ shadow root and an iframe, capture against a page that stops keys, the
791
+ `'text'` mode on real controls, and the built entries as an app bundles
792
+ them. Nothing is downloaded; a browser that isn't installed is skipped.
793
+ `BROWSERS=chrome` runs one. Needs Node 22 or later.
794
+ - `npm run data:age` (v0.4.0+): how old the browser/OS and website shortcut
795
+ tables are; warns past six months (the build prints the same warning).
796
+ [docs/data-review.md](docs/data-review.md) says how to review them.
797
+ - `scripts/key-check.ahk` (Windows, AutoHotkey 1.1): real keyboard layouts
798
+ (Russian, Greek, Hebrew, Polish AltGr) in Chrome, Firefox and Edge, with
799
+ results written to `docs/notes/`. See `playground/key-check.html`.
800
+
655
801
  ---
656
802
 
657
803
  ## License
package/dist/auto.js CHANGED
@@ -1,4 +1,4 @@
1
- // hotkey-router v0.3.3 | SEE LICENSE IN LICENSE
1
+ // hotkey-router v0.4.1 | SEE LICENSE IN LICENSE
2
2
 
3
3
 
4
4
  // auto.js
package/dist/auto.min.js CHANGED
@@ -1,3 +1,3 @@
1
- // hotkey-router v0.3.3 | SEE LICENSE IN LICENSE
1
+ // hotkey-router v0.4.1 | SEE LICENSE IN LICENSE
2
2
 
3
- function I(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 v(t=typeof navigator<"u"?navigator:null,{chromeos:e=!1}={}){if(!t)return null;let r=t.userAgent||"",i=(/\bCrOS\b/.test(r)?"chromeos":null)||I(t.userAgentData?.platform)||I(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 z(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 ut={mac:"macOS",windows:"Windows",linux:"Linux",chromeos:"ChromeOS"};function j(t){return ut[t]||t}var yt=v(),H=new Set(["ctrl","shift","alt","meta","mod"]),mt=new Map([["^","ctrl"],["!","alt"],["+","shift"],["#","meta"]]),U=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 w(t){let e=String(t??"");if(e===" ")return" ";let i=e.trim().toLowerCase();return U[i]??i}function pt(t){return H.has(w(t))}var vt=/(^|\+)code:([A-Za-z][A-Za-z0-9_]*)/;function W(t,{platform:e=yt}={}){let r=String(t||"").trim(),i=null,o=l=>{i=i||`Invalid hotkey "${t}": ${l}`},n=/\s+up$/i.test(r),s=n?r.replace(/\s+up$/i,"").trim():r,a={ctrl:!1,shift:!1,alt:!1,meta:!1,key:null,code:null,bareModifier:null},c=l=>{l==="mod"?a[e==="mac"?"meta":"ctrl"]=!0:a[l]=!0},d=s;for(;d.length;){let l=mt.get(d[0])??null;if(!l)break;c(l),d=d.slice(1).trimStart()}let f=d.match(/code:[A-Za-z][A-Za-z0-9_]*/g);f&&f.length>1&&o(`multiple code: tokens not supported (got ${f.length}).`);let h=null,m=d.replace(vt,(l,p,ht)=>(h=ht,p+"__code__")).toLowerCase(),$=m.split("+").map(l=>l.trim()),_=$.filter(Boolean),N=$.some(l=>l==="")&&m.includes("++");if(!N){let l=!1;for(let p of _)pt(p)?l&&o('modifiers must come before the base key (e.g. "ctrl+k", not "k+ctrl")'):l=!0}for(let l of _){if(l==="__code__"){a.code=h;continue}let p=U[l]??l;H.has(p)?c(p):a.key=w(p)}if(!a.key&&!a.code&&N&&(a.key="+"),!a.key&&!a.code){let l=(a.ctrl?1:0)+(a.shift?1:0)+(a.alt?1:0)+(a.meta?1:0);l===1?a.bareModifier=a.ctrl?"ctrl":a.shift?"shift":a.alt?"alt":"meta":l>1?o('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:a,type:n?"keyup":"keydown",raw:t,error:i}}function b(t,e){let{combo:r,type:i,raw:o,error:n}=W(t,e);if(n)throw new Error(n);return{combo:r,type:i,raw:o}}var wt={",":["<","Comma"],".":[">","Period"],"/":["?","Slash"],";":[":","Semicolon"],"'":['"',"Quote"],"[":["{","BracketLeft"],"]":["}","BracketRight"],"\\":["|","Backslash"],"-":["_","Minus"],"=":["+","Equal"],"`":["~","Backquote"]};function q(t){let{combo:e,type:r,error:i}=W(t);if(i||!e.shift||e.code)return null;let o=wt[e.key];if(!o)return null;let[n,s]=o,c=String(t).trim().replace(/\s+up$/i,"").slice(0,-1)+"code:"+s+(r==="keyup"?" up":"");return{message:`"${t}" never fires on US layouts: Shift turns "${e.key}" into "${n}". Bind "${c}" instead.`,suggestion:c}}var R={".":"period",",":"comma",";":"semicolon","'":"quote","/":"slash","\\":"backslash","[":"bracketleft","]":"bracketright","-":"minus","=":"equal","`":"backquote"," ":"space","+":"equal"};function gt(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 bt(t){if(t==null||t==="")return null;if(R[t])return R[t];let e=w(t);return R[e]||e||null}function V(t){if(!t||t.bareModifier)return null;let e=t.code?gt(t.code):bt(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 k(t,e,r,i){return t.addEventListener(e,r,i),()=>t.removeEventListener(e,r,i)}var kt=v(),X=Object.freeze({Alt:"alt",AltGraph:"alt",Control:"ctrl",Shift:"shift",Meta:"meta",OS:"meta"}),Y=!0,D=typeof window<"u"?window:null,x=[],y=new Map,A=new Map,g=new Map,T=!1,St=1,G=new Set;function O({ctrl:t,shift:e,alt:r,meta:i,key:o,code:n,bareModifier:s}){if(s)return`__bare__:${s}`;let a="";return t&&(a+="ctrl+"),e&&(a+="shift+"),r&&(a+="alt+"),i&&(a+="meta+"),n?a+"code:"+n:a?a+o:o}function xt(t){let e=X[t.key];return e?`__bare__:${e}`:O({ctrl:t.ctrlKey,shift:t.shiftKey,alt:t.altKey,meta:t.metaKey,key:w(t.key)})}function Ct(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}function Et(t){let e=t?.composedPath?.()[0]??t?.target;if(!e)return!1;let r=String(e.tagName||"").toUpperCase();return e.isContentEditable||r==="INPUT"||r==="TEXTAREA"||r==="SELECT"||e.getAttribute?.("role")==="textbox"}function At(t,e){let r=e?{...e}:{};return t==="keydown"&&r.repeat==null&&(r.repeat=!1),r.priority==null&&(r.priority=0),r}function Pt(t,e){let r=y.get(t);r||(r=new Map,y.set(t,r));let i=r.get(e);return i||(i=[],r.set(e,i)),i}function M(t){let e=g.get(t);if(!e)return!1;let{comboStr:r,type:i}=e,o=y.get(r),n=o?.get(i);if(!n?.length)return g.delete(t),!1;let s=n.filter(a=>a.id!==t);return s.length?o.set(i,s):o.delete(i),o.size||y.delete(r),g.delete(t),!0}function J(t,e,r=null,i={}){let{combo:o,type:n,raw:s}=b(t),a=O(o),c=At(n,i),d={id:St++,comboStr:a,type:n,combo:o,handler:e,plugin:r,raw:s,options:c};Pt(a,n).push(d),g.set(d.id,{comboStr:a,type:n});let f=`${a} ${n}`;if(!G.has(f)){let u=q(t);u&&(G.add(f),console.warn(`[hotkey-router] ${u.message}`))}if(x.length)for(let u of x)try{u({combo:o,raw:s,options:c,plugin:r,id:d.id})}catch(m){console.error("[hotkey-router] onBind hook threw:",m)}let h=()=>M(d.id);return h.id=d.id,h.hotkey=s,h}function Ft(t){if(typeof t!="function")throw new TypeError("hotkeys.onBind(hook) expects a function");return x.push(t),()=>{x=x.filter(e=>e!==t)}}function Tt(t,e){let{combo:r,type:i}=b(t),o=O(r),n=y.get(o);if(!n)return;let s=n.get(i);if(s?.length){if(e){let a=[];for(let c of s)c.handler===e?g.delete(c.id):a.push(c);a.length?n.set(i,a):n.delete(i)}else{for(let a of s)g.delete(a.id);n.delete(i)}n.size||y.delete(o)}}function Ot(t,e){if(A.has(t))throw new Error(`Plugin "${t}" already registered`);let r=Object.entries(e);for(let[o]of r)b(o);let i=[];for(let[o,n]of r){let[s,a]=Array.isArray(n)?n:[n,{}],c=J(o,s,t,a);i.push(c.id)}return A.set(t,i),()=>tt(t)}function tt(t){let e=A.get(t);if(e){for(let r of e)M(r);A.delete(t)}}function Rt(){T=!0}function Kt(){T=!1}function Bt(t=!0){Y=!!t}function Dt(t){D=t}function et(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 Mt(t){return!!(t.ctrlKey&&t.altKey&&typeof t.getModifierState=="function"&&t.getModifierState("AltGraph")&&typeof t.key=="string"&&t.key.length===1)}function rt(t){return!!(t.isComposing||t.keyCode===229)}var Lt=/^(?!\p{Script=Latin})\p{L}$/u;function $t(t){if(!(t.ctrlKey||t.metaKey)||t.altKey||rt(t)||typeof t.getModifierState=="function"&&t.getModifierState("AltGraph"))return null;let e=/^Key([A-Z])$/.exec(t.code||"");return!e||typeof t.key!="string"||!Lt.test(t.key)?null:O({ctrl:t.ctrlKey,shift:t.shiftKey,alt:!1,meta:t.metaKey,key:e[1].toLowerCase()})}function it(t,e,r){let i={altGraphChar:Mt(t),composing:rt(t),fromInput:Y&&Et(t)},o=[],n=new Set;for(let s of[xt(t),Ct(t)])!s||n.has(s)||(n.add(s),Z(o,s,t,e,r,i));if(!o.length){let s=$t(t);s&&!n.has(s)&&Z(o,s,t,e,r,i)}return o}function Z(t,e,r,i,o,{altGraphChar:n,composing:s,fromInput:a}){let c=y.get(e)?.get(i);if(c?.length)for(let d of c){let f=d.options;o==="capture"&&!f.capture||o==="bubble"&&f.capture||n&&!f.altGraph||s&&!f.composing||a&&!f.allowIn?.(r)||i==="keydown"&&f.repeat===!1&&r.repeat||f.when&&f.when(r)===!1||t.push(d)}}function ot(t,e){let r=t.options;r.preventDefault&&e.preventDefault(),r.stopImmediatePropagation?e.stopImmediatePropagation():r.stopPropagation&&e.stopPropagation();try{t.handler(e)}finally{r.once&&M(t.id)}}function S(t,e="all"){return r=>{if(T)return;let i=it(r,t,e);i.length&&ot(et(i),r)}}var C=null,E=null,K=null,B=null;function at({target:t=D,capture:e=!1}={}){if(!t)throw new Error("hotkeys.init() requires a target (e.g. window)");if((C||E)&&nt(),e){C=k(t,"keydown",S("keydown"),{capture:!0}),E=k(t,"keyup",S("keyup"),{capture:!0});return}C=k(t,"keydown",S("keydown","bubble"),{capture:!1}),E=k(t,"keyup",S("keyup","bubble"),{capture:!1}),K=k(t,"keydown",S("keydown","capture"),{capture:!0}),B=k(t,"keyup",S("keyup","capture"),{capture:!0})}function nt(){C?.(),E?.(),K?.(),B?.(),C=null,E=null,K=null,B=null,y.clear(),A.clear(),g.clear()}var _t={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"},F={},Q;for(let[t,e]of Object.entries(st))F[Q=w(e)]??(F[Q]=t);function Nt(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 It(t){return t?/^[a-z]$/.test(t)?"Key"+t.toUpperCase():/^\d$/.test(t)?"Digit"+t:/^f\d{1,2}$/.test(t)?t.toUpperCase():F[t]??null:null}function zt(t,{type:e,target:r=null}={}){let{combo:i,type:o}=b(t),n=e||o;if(T)return!1;let s=i.bareModifier?_t[i.bareModifier]:i.key??Nt(i.code),a=i.bareModifier?null:i.code??It(i.key),c=!!i.alt,d=!!i.ctrl,f=!!i.shift,h=!!i.meta;i.bareModifier&&n==="keyup"&&(i.bareModifier==="alt"?c=!1:i.bareModifier==="ctrl"?d=!1:i.bareModifier==="shift"?f=!1:i.bareModifier==="meta"&&(h=!1));let u={type:n,key:s,code:a,ctrlKey:d,shiftKey:f,altKey:c,metaKey:h,repeat:!1,isComposing:!1,getModifierState(){return!1},preventDefault(){},stopPropagation(){},stopImmediatePropagation(){},target:r},m=it(u,n,"all");return m.length?(ot(et(m),u),!0):!1}function jt(t,{physical:e=!0,useMod:r=!1,platform:i=kt}={}){if(!t||X[t.key])return null;let o=[],n=i==="mac";if(r&&(n?t.metaKey:t.ctrlKey)&&o.push("mod"),t.ctrlKey&&!(r&&!n)&&o.push("ctrl"),t.metaKey&&!(r&&n)&&o.push("meta"),t.altKey&&o.push("alt"),t.shiftKey&&o.push("shift"),e&&t.code)o.push(`code:${t.code}`);else{let s=w(t.key);if(!s)return null;o.push(s===" "?"space":s)}return o.join("+")}D&&at();var L={init:at,destroy:nt,setTarget:Dt,bind:J,unbind:Tt,registerPlugin:Ot,unregisterPlugin:tt,onBind:Ft,pause:Rt,resume:Kt,ignoreInput:Bt,trigger:zt,parseHotkey:b,comboFromEvent:jt,detectPlatform:v};var P={$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 Ut="1.0",Wt=new Set(["hard","os","menu-activation"]);function qt(t){let e=String(t).toLowerCase().split("+").map(n=>n.trim()).filter(Boolean);if(!e.length)return"";let r=e[e.length-1],i=new Set(e.slice(0,-1)),o=[];return i.has("ctrl")&&o.push("ctrl"),i.has("meta")&&o.push("meta"),i.has("alt")&&o.push("alt"),i.has("shift")&&o.push("shift"),o.push(r),o.join("+")}function Vt(t,e){if(typeof t!="string"||!t.startsWith("$ref:"))return t;let r=t.slice(5).split("."),i=e;for(let o of r)i=i?.[o];return i}function ct(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 Gt(t){let e={platforms:{}},r=t?.platforms||{};for(let[i,o]of Object.entries(r)){let n={};for(let[s,a]of Object.entries(o.browsers||{}))n[s]=ct(Vt(a,t));e.platforms[i]={browsers:n,system:ct(o.system)}}return e}var lt=P?.version?.schema===Ut,Zt=lt?Gt(P):{platforms:{}},Qt=V;function Xt(t,{platform:e,browser:r}={}){if(!lt)return null;let i=Qt(t);if(!i)return null;let o=e&&Zt.platforms[e];if(!o)return null;let s=(r?o.browsers?.[r]:null)?.[i];if(s)return{source:"browser",platform:e,browser:r,lookupKey:i,action:s.action,severity:s.severity};let a=o.system?.[i];return a?{source:"system",platform:e,browser:r,lookupKey:i,action:a.action,severity:a.severity}:null}function dt(t){return Wt.has(t)}function Yt(t,e){let r=j(t.platform),i=t.source==="browser"?`${t.browser} on ${r}`:r,o=dt(t.severity)?"will not fire":"fires in normal browsing";return`[hotkey-router] "${e}" (${t.lookupKey}) reserved by ${i}: "${t.action}" [${t.severity}] \u2014 ${o}.`}function Jt(t,e,r=console){let i=Yt(t,e);(dt(t.severity)?r.warn:r.info).call(r,i)}function ft(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:v(),i=e.browser!==void 0?e.browser:z(),o=e.console||console;return t.onBind(({combo:n,raw:s,options:a})=>{if(a?.warnOnReserved===!1||!r||!i)return;let c=Xt(n,{platform:r,browser:i});c&&Jt(c,s,o)})}var de=P?.version?.schema,fe=P?.version?.generated;ft(L);var me=L;export{me as default};
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};