。
She lost her mind from the shock.
Literal
She [topic-は] shock [due-to-で] mind [subject-が] went-mad.
気が狂う ('go mad') is one of many Japanese idioms built on 気 ('spirit, mind, mood'); it depicts the mind/spirit losing its proper alignment. The で here is the causal で — '(it was) due to shock that...' Note how the mind takes が as the subject: body or mind 'parts' that fall out of working order routinely pattern with が rather than は. Modern Japanese tends to soften this expression to 気が変になる ('the mind goes strange') in casual settings, since 気が狂う sounds quite stark — the kind of phrase you'd find in dramatic narrative rather than casual chat about a friend.