"let themselves be defeated before the people of Ai." The phrase "before them" represents what the people of Ai would see and think. AT: "let the people of Ai think that the Israelites were defeated" (See: [[rc://en/ta/man/translate/figs-metonymy]])
The phrase "be defeated" can be stated in active form. AT: "let the people of Ai think that they had defeated the Israelites" (See: [[rc://en/ta/man/translate/figs-activepassive]])
The words "they" and "them" here refer to the army of Isreal.
# All the people who were in the city were called together
This can be stated in active form. AT: "The city leaders called all the people in the city together" (See: [[rc://en/ta/man/translate/figs-activepassive]])
# All the people who were in the city
The writer speaks in a general way about all the people, but "all the people" refers only to those who could fight. AT: "all the people in the city who could help chase the army of Israel" (See: [[rc://en/ta/man/translate/figs-hyperbole]])