was an empire which existed from 1038 to 1227 in what are now the northwestern Chinese provinces of Ningxia, Gansu, eastern Qinghai, northern Shaanxi, northeastern Xinjiang, southwest Inner Mongolia, and southernmost Outer Mongolia, measuring about 800000 sqkm .