State of emergency declared in Tripoli after days of fighting