Primer

The operation of time travel in Primer.
Two engineersÂ â Aaron and AbeÂ â supplement their day-jobs with entrepreneurial tech projects, working out of Aaron's garage. During one such research effort, involving electromagnetic reduction of objects' weight, the two men accidentally discover an 'A-to-B' time loop side-effect; objects left in the weight-reducing field exhibit temporal anomalies, proceeding normally (from time 'A,' when the field was activated, to time 'B,' when the field is powered off), then backwards (from 'B' back to 'A'), in continuous A-then-B-then-A-then-B sequence, such that objects can leave the field in the present, or at some previous point.
Abe refines this proof-of-concept and builds a stable time-apparatus ("the box"), sized to accommodate a human subject. Abe uses this "box" to travel six hours into his own pastâas part of this process, Original-Abe sits incommunicado in a hotel room, so as not to interact or interfere with the outside world, after which Original-Abe enters the "box," waits inside the "box" for six hours (thus going back in time six hours), and becomes Future-Overlap-Double-Abe, who travels across town, explains the proceedings to Aaron, and brings Aaron back to the secure self-storage facility housing the "box." At the end of the overlap-timespan, Original-Abe no longer exists, having entered the "box," rewound six hours, and become Future-Overlap-Double-Abe for the remainder of time.
Abe and Aaron repeat Abe's six-hour experiment multiple times over multiple days, making profitable same-day stock trades armed with foreknowledge of the market's performance. The duo's divergent personalitiesÂ â Abe cautious and controlling, Aaron impulsive and meddlesomeÂ â put subtle strain on their collaboration and friendship. These tensions come to a head after a late-night encounter with Thomas Granger (father to Abe's girlfriend Rachel), who appears inexplicably unshaven and exists in overlap with his original suburban self. Granger falls into a comatose state after being pursued by Aaron; Aaron theorizes that, at some point in the future, Granger entered the "box" (at an unknown time, for unknown reasons), with timeline-altering consequences. Abe concludes that time travel is simply too dangerous, and uses a second apparatus (his "failsafe box," built before the experiment's beginning and kept continuously running in a secret location), traveling back four days to prevent the experiment's launch.
Cumulative competing interference wreaks havoc upon the timeline. Future-Abe sedates Original-Abe (so he will never conduct the initial time travel experiment), and meets Original-Aaron at a park bench (so as to dissuade him), but finds that Future-Aaron has gotten there first (armed with pre-recordings of the past conversations, and an unobtrusive earpiece), having brought a disassembled "third failsafe box" four days back with his own body. Future-Abe faints at this revelation, overcome by shock and fatigue.
The two men briefly and tentatively reconcile. They jointly travel back in time, experiencing and reshaping an event where Abe's girlfriend Rachel was nearly killed by a gun-wielding party crasher. After many repetitions, Aaron, forearmed with knowledge of the party's events, stops the gunman, becoming a local hero. Abe and Aaron ultimately part ways; Aaron considers a new life in foreign countries where he can tamper more broadly for personal gain, while Abe states his intent to remain in town and dissuade/sabotage the original "box" experiment. Abe warns Aaron to leave and never return.
An epilogue sequence reveals that multiple "box-aware" versions of Aaron are still alive and circulatingÂ â at least one Future-Aaron has intermingled knowledge with Original-Aaron (thanks to discussions, voice-recordings, and an unsuccessful physical altercation). As a result, two or more Aarons now inhabit the same timeline, sharing information of future events, in stark contrast to Abe, who goes to painstaking extremes to keep his Original-Abe "pure" and unaware of the future. The film's final scene depicts a fully aware Aaron, directing French-speaking workers in the construction of what appears to be a warehouse-sized "box."

Question: Who was nearly killed by a gun-wielding party crasher?
Answer: Rachel