(t0)
| 35 | * the corresponding slash command (e.g., "command:commit" submits "/commit"). |
| 36 | */ |
| 37 | export function CommandKeybindingHandlers(t0) { |
| 38 | const $ = _c(8); |
| 39 | const { |
| 40 | onSubmit, |
| 41 | isActive: t1 |
| 42 | } = t0; |
| 43 | const isActive = t1 === undefined ? true : t1; |
| 44 | const keybindingContext = useOptionalKeybindingContext(); |
| 45 | const isModalOverlayActive = useIsModalOverlayActive(); |
| 46 | let t2; |
| 47 | bb0: { |
| 48 | if (!keybindingContext) { |
| 49 | let t3; |
| 50 | if ($[0] === Symbol.for("react.memo_cache_sentinel")) { |
| 51 | t3 = new Set(); |
| 52 | $[0] = t3; |
| 53 | } else { |
| 54 | t3 = $[0]; |
| 55 | } |
| 56 | t2 = t3; |
| 57 | break bb0; |
| 58 | } |
| 59 | let actions; |
| 60 | if ($[1] !== keybindingContext.bindings) { |
| 61 | actions = new Set(); |
| 62 | for (const binding of keybindingContext.bindings) { |
| 63 | if (binding.action?.startsWith("command:")) { |
| 64 | actions.add(binding.action); |
| 65 | } |
| 66 | } |
| 67 | $[1] = keybindingContext.bindings; |
| 68 | $[2] = actions; |
| 69 | } else { |
| 70 | actions = $[2]; |
| 71 | } |
| 72 | t2 = actions; |
| 73 | } |
| 74 | const commandActions = t2; |
| 75 | let map; |
| 76 | if ($[3] !== commandActions || $[4] !== onSubmit) { |
| 77 | map = {}; |
| 78 | for (const action of commandActions) { |
| 79 | const commandName = action.slice(8); |
| 80 | map[action] = () => { |
| 81 | onSubmit(`/${commandName}`, NOOP_HELPERS, undefined, { |
| 82 | fromKeybinding: true |
| 83 | }); |
| 84 | }; |
| 85 | } |
| 86 | $[3] = commandActions; |
| 87 | $[4] = onSubmit; |
| 88 | $[5] = map; |
| 89 | } else { |
| 90 | map = $[5]; |
| 91 | } |
| 92 | const handlers = map; |
| 93 | const t3 = isActive && !isModalOverlayActive; |
| 94 | let t4; |
nothing calls this directly
no test coverage detected