Interactive FSM graph for web

I am working on a project that needs a LabView or UDK Kismet like graph visualisation so users can modify their stories. Users are able to define states, transitions, additional properties for states (like variables in LabView) and entry and outgoing ports. They can also use predefined states to place and modify.

I wonder if there is any JS library available to do this or good enough to expand upon?

I appreciate your answers.