It is struggling but not all is lost. I can't see the bottom but from what it looks like it is etoliated. You should cut the top off, remove the bottom leaves, leaving some stem, and pop it into some dry, free-draining sandy soil fora few days, then lightly water it. It should take root. The base remaining may sprout babies. Don't water it, let it stress a little bit. If it starts to dry out in the leaves then give it a little water but not too much.