Hierarchical finite state machine library for JavaScript supporting most of the UML 2 state machine semantics