The struggling seaside resort in New Jersey must meet several measures to avoid bankruptcy, or the state will take over, according to the legislation.