Your connection in PTY is gate-to-gate, no immigration or customs clearance is required. 47 minutes is not a problem, you can walk end to end of the terminal in 10 minutes.
AeroRepublica is Copa Airlines, no difference in PTY.
Copa is due to start a flight DEN - PTY, not sure when, you might want to look for that.