How to create a variable hotkey (mouse button) based on if a certain palette is open or not?

Sample Scenario

[Example Scenario A] Suppose I am in Figma doing some design work. If I press Button 8 on my mouse (see image), then that triggers Action X, which does some common Figma function and I happily carry on with my day.

Now, let's say I have an active palette open specifically for Figma, with a bunch of less commonly used actions. These actions can arrange objects left, right and center. Suppose 'left' has the palette-local hotkey of 1, center is 2, and right is 3. (Alternatively, I could have made these palette local hot keys the very same mouse buttons; however, that will surprisingly still return a Conflict Palette [conflicting with Example Scenario A above] i.e. the mouse Button 8 that is local to a palette will still conflict with the same mouse Button 8 when a palette is not even active)

At this point, instead of hitting 1, 2 or 3 on my keyboard, I would love to be able to hit Button 1, Button 2, and Button 3 on my mouse respectively (see above image). For context, I use Karabiner Elements to map those buttons from their Razer defaults to Karabiner's "virtual buttons"—Button 1, 2, 3, up to 19 in my case

Is this possible within Keyboard Maestro? The problem I continually run into is the Conflict Palette constantly triggering even though I attempted to set up some conditional logic with If's and Then's checking to see if a palette was active or not.

My thinking is that if any palette is NOT active, then keep the mouse buttons and their intended actions as is. If a palette IS active, then swap the buttons' intended actions to instead be key presses of 1, 2, 3, 4, 5, etc. Unfortunately, with my skillset and knowledge of the tool, I cannot get this to work.

Can you share what you have so far