How do I use EQS to figure out if a player is within range of the navmesh?

In my game one of the player classes can grappling hook to walls and ceiling and hang from them.

Some of the enemies in my game are primarily melee attackers, but they all have a backup ranged attack (i.e, throwing their sword or spitting acid).

I’d like to write an environment query that checks to see whether the AI can get into melee range of a player, and if not, it should fall back to using its backup ranged attack.

I’d like to check whether a player is near enough to navmesh that the AI would be able to get within melee range (though they need not actually be on the navmesh, since my AI have long arms). I’d also like to check to make sure they’re not too high (i.e, hanging from the ceiling, though again, if they’re hanging near the ground, they’re still in reach of those long arms), and to make sure they’re not behind a wall or some other solid surface that would block a melee attack.

How can I find this out using EQS or another AI system?