Theresa May's week in charts - BBC News
Five charts about the prime minister's busy week
A confidence vote, a promise to stand down, and thousands of miles travelled - it's been a quiet week for the prime minister.

Theresa May's week was governed by numbers, as she calculated she wouldn't get her Brexit deal through Parliament for now.

She then had to bank on more than half of Tory MPs' support in Wednesday's confidence vote.

And with 103 days until we're supposed to leave the EU, she'll hope to find 320 votes to back her deal in time.

Over the weekend, Downing Street had insisted that the vote on the prime minister's deal with the European Union would go ahead as planned on Tuesday.

But by Monday, defeat was looming.

Mrs May needs 320 votes to win a vote in the Commons. Ordinarily she has the support of 326 MPs if we include all Conservatives and Democratic Unionist Party MPs.

However, the DUP have said they won't back the deal in its current form, meaning she'd be 4 MPs short.

What's more, there are said to be perhaps 90 or so Tory rebels who won't support it, leaving maybe 226 MPs.

Mrs May would have had to bank on significant support from opposition MPs, and with that looking extremely unlikely, she decided to postpone the vote.

With the Brexit vote cancelled, Mrs May travelled across Europe seeking concessions from EU leaders over the issue of the Irish border.

On Tuesday alone, she covered almost 1,200 miles and spent more than four hours flying from London to Amsterdam, then to Berlin and Brussels, before flying home again.

Along the way, she got stuck in a car, posed for several awkward photos and failed to get any concessions from the European Union on the Irish backstop.

On Wednesday morning, Sir Graham Brady announced he had received enough letters - 48 - to trigger a vote of confidence in Mrs May's leadership.

The prime minister spent the day rallying her supporters in Westminster, making several concessions - including that she wouldn't stay as leader at the 2022 election.

In the end, she won the confidence vote by 200 votes to 117, or 63%.

This was a considerably better ratio than Margaret Thatcher in 1990, who won just 55% of the vote when challenged by Michael Heseltine, and Iain Duncan Smith in 2003, who won just 45%.

However, she did worse proportionally than John Major in 1995, He found it increasingly difficult to govern after John Redwood's challenge.

On Thursday, Mrs May confirmed publicly that she would stand down as leader before the next election.

Thursday was her 883rd day as prime minister. If we were to rank all leaders since 1900, she would be placed 5th from bottom - above only Bonar Law, Sir Alec Douglas-Home, Anthony Eden and Henry Campbell-Bannerman.

Mrs May hasn't yet given a leaving date, although some predict she'll quit soon after we leave the EU - currently scheduled for 29 March 2019 (at which point she would still be 5th from bottom).

If she manages to stay until 25 May 2019, she'll overtake Gordon Brown, who managed 1,049 days in office.

However, the next election is not, in theory, scheduled until June 2022, five years after the previous one (according to the Fixed Term Parliament act).

If she stayed until just before that election, she'd also leapfrog Chamberlain, Callaghan, Balfour and Heath, making her the 13th longest serving prime minister since 1900.

Back in Brussels, Theresa May told the media on Friday lunchtime that she'd had a "robust discussion" with Jean-Claude Juncker over the deal, and did her best to reassure the media that if a backstop was triggered, it would just be a temporary move.

However, she admitted there is "work still to do" with more talks to find the assurances that the UK Parliament needs.

But how long does she have left to persuade MPs?

We're set to leave the EU on 29 March, giving us 103 days after today.

However, Parliament is currently only due to sit for a maximum of 57 of those days: Parliament very rarely sits at weekends, and is off for Christmas between 21 December and 6 January. There's also set to be a February recess between 15 and 24 February, although it's unclear if that will go ahead.

Downing Street has said that the vote will have happened by Monday 21 January, in just 38 days' time.

A week is a long time in politics - but for Theresa May, this week has probably seemed longer than most.