(t0)
| 224 | handler: () => void; |
| 225 | }; |
| 226 | function ChordInterceptor(t0) { |
| 227 | const $ = _c(6); |
| 228 | const { |
| 229 | bindings, |
| 230 | pendingChordRef, |
| 231 | setPendingChord, |
| 232 | activeContexts, |
| 233 | handlerRegistryRef |
| 234 | } = t0; |
| 235 | let t1; |
| 236 | if ($[0] !== activeContexts || $[1] !== bindings || $[2] !== handlerRegistryRef || $[3] !== pendingChordRef || $[4] !== setPendingChord) { |
| 237 | t1 = (input, key, event) => { |
| 238 | if ((key.wheelUp || key.wheelDown) && pendingChordRef.current === null) { |
| 239 | return; |
| 240 | } |
| 241 | const registry = handlerRegistryRef.current; |
| 242 | const handlerContexts = new Set(); |
| 243 | if (registry) { |
| 244 | for (const handlers of registry.values()) { |
| 245 | for (const registration of handlers) { |
| 246 | handlerContexts.add(registration.context); |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | const contexts = [...handlerContexts, ...activeContexts, "Global"]; |
| 251 | const wasInChord = pendingChordRef.current !== null; |
| 252 | const result = resolveKeyWithChordState(input, key, contexts, bindings, pendingChordRef.current); |
| 253 | bb23: switch (result.type) { |
| 254 | case "chord_started": |
| 255 | { |
| 256 | setPendingChord(result.pending); |
| 257 | event.stopImmediatePropagation(); |
| 258 | break bb23; |
| 259 | } |
| 260 | case "match": |
| 261 | { |
| 262 | setPendingChord(null); |
| 263 | if (wasInChord) { |
| 264 | const contextsSet = new Set(contexts); |
| 265 | if (registry) { |
| 266 | const handlers_0 = registry.get(result.action); |
| 267 | if (handlers_0 && handlers_0.size > 0) { |
| 268 | for (const registration_0 of handlers_0) { |
| 269 | if (contextsSet.has(registration_0.context)) { |
| 270 | registration_0.handler(); |
| 271 | event.stopImmediatePropagation(); |
| 272 | break; |
| 273 | } |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | break bb23; |
| 279 | } |
| 280 | case "chord_cancelled": |
| 281 | { |
| 282 | setPendingChord(null); |
| 283 | event.stopImmediatePropagation(); |
nothing calls this directly
no test coverage detected