Browse files

Updated makefile with support for make all, and rev'd dist.

  • Loading branch information...
1 parent 3b8527e commit a17638a6e9b5f2e4aabd0a49f12a38acd8a9e40d @jbeard4 committed Dec 21, 2012
Showing with 9 additions and 2 deletions.
  1. +3 −1 Makefile
  2. +1 −1 dist/scion-min.js
  3. +5 −0 dist/scion.js
View
4 Makefile
@@ -1,5 +1,7 @@
js = $(shell find lib/ -name "*.js")
+all : dist/scion.js dist/scion-min.js
+
dist/scion.js : $(js)
mkdir -p dist && node lib/browser/build/stitch.js dist/scion.js
@@ -9,4 +11,4 @@ dist/scion-min.js : dist/scion.js
clean :
rm -rf dist
-.PHONY : clean
+.PHONY : clean all
View
2 dist/scion-min.js
@@ -1 +1 @@
-(function(){if(!this.require){var a={},b={},c=function(f,g){var h=d(g,f),i=b[h],j;if(i)return i.exports;if(!(j=a[h]||a[h=d(h,"./index")]))throw"module '"+f+"' not found";i={id:h,exports:{}};try{return b[h]=i,j(i.exports,function(a){return c(a,e(h))},i),i.exports}catch(k){throw delete b[h],k}},d=function(a,b){var c=[],d,e;/^\.\.?(\/|$)/.test(b)?d=[a,b].join("/").split("/"):d=b.split("/");for(var f=0,g=d.length;f<g;f++)e=d[f],e==".."?c.pop():e!="."&&e!=""&&c.push(e);return c.join("/")},e=function(a){return a.split("/").slice(0,-1).join("/")};this.require=function(a){return c(a,"")},this.require.define=function(b){for(var c in b)a[c]=b[c]}}return this.require.define}).call(this)({"base-platform/dom":function(a,b,c){"use strict",c.exports={getChildren:function(a){return Array.prototype.slice.call(a.childNodes)},localName:function(a){return a.localName},getAttribute:function(a,b){return a.getAttribute(b)},hasAttribute:function(a,b){return a.hasAttribute(b)},namespaceURI:function(a){return a.namespaceURI},createElementNS:function(a,b,c){return a.createElementNS(b,c)},setAttribute:function(a,b,c){return a.setAttribute(b,c)},appendChild:function(a,b){return a.appendChild(b)},textContent:function(a,b){if(b===undefined)return a.nodeType===1?a.textContent!==undefined?a.textContent:this.getChildren(a).map(function(a){return this.textContent(a)},this).join(""):a.nodeType===3||a.nodeType===4?a.data:"";if(a.nodeType===1){if(a.textContent!==undefined)return a.textContent=b;var c=a.ownerDocument.createTextNode(b);return a.appendChild(c),b}if(a.nodeType===3)return a.data=b},getElementChildren:function(a){return this.getChildren(a).filter(function(a){return a.nodeType===1})}}},"base-platform/eval":function(exports,require,module){module.exports=function(content,name){return eval("(function(){\nreturn "+content+";})()")}},"base-platform/path":function(a,b,c){"use strict",c.exports={sep:"/",join:function(a,b){return a+"/"+b},dirname:function(a){return a.split(this.sep).slice(0,-1).join(this.sep)},basename:function(a,b){var c=a.split(this.sep).slice(-1);if(b){var d=this.extname(c);d[1]===b&&(c=d[1])}return c},extname:function(a){return a.split(/\\.(?=[^\\.]+$)/)[1]}}},"browser/browser-listener-client":function(a,b,c){},"browser/dom":function(a,b,c){function e(a,b){return"item"in a?a.item(b):a[b]}"use strict";var d=b("../base-platform/dom"),f=Object.create(d);f.hasAttribute=function(a,b){return a.hasAttribute?a.hasAttribute(b):a.getAttribute(b)},f.localName=function(a){return a.localName||a.tagName},f.createElementNS=function(a,b,c){return a.createElementNS?a.createElementNS(b,c):a.createElement(c)},f.getChildren=function(a){var b=[];for(var c=0;c<a.childNodes.length;c++)b.push(e(a.childNodes,c));return b},f.serializeToString=function(a){return a.xml||(new XMLSerializer).serializeToString(a)},c.exports=f},"browser/platform":function(a,b,c){"use strict";var d=b("../core/util/util");a.platform={ajax:window.jQuery,eval:b("../base-platform/eval"),getDocumentFromUrl:function(a,b){this.ajax.get(a,function(a){b(null,a)},"xml").error(function(a){b(a)})},parseDocumentFromString:function(a){return(new window.DOMParser).parseFromString(a,"application/xml")},getDocumentFromFilesystem:function(a,b){this.getDocumentFromUrl(a,b)},getResourceFromUrl:function(a,b){this.ajax.get(a,function(a){b(null,a)}).error(function(a){b(a)})},postDataToUrl:function(a,b,c){this.ajax.post(a,b,function(a){c(null,a)}).error(function(a){c(a)})},setTimeout:function(a,b){return window.setTimeout(a,b)},clearTimeout:function(a){window.clearTimeout(a)},log:window.console&&window.console.log&&(window.console.log.bind?window.console.log.bind(window.console):window.console.log),path:b("../base-platform/path"),url:b("./url"),dom:b("./dom")}},"browser/url":function(a,b,c){function d(a){var b=document.createElement("a");return b.href=a,b}"use strict",c.exports={getPathFromUrl:function(a){var b=d(a);return b.pathname},changeUrlPath:function(a,b){var c=d(a);return c.protocol+"//"+c.hostname+":"+c.port+b}}},"core/constants":function(a,b,c){"use strict",c.exports={SCXML_NS:"http://www.w3.org/2005/07/scxml"}},"core/scxml/SCXML":function(a,b,c){function i(a){return function(a){var b=a[0],c=a[1];return b.source.depth<c.source.depth?c:c.source.depth<b.source.depth?b:b.documentOrder<c.documentOrder?b:c}}function k(a,b){this.model=a,this.opts=b,this.opts.log=this.opts.log||h.platform.log,this.opts.StateIdSet=this.opts.StateIdSet||d,this.opts.EventSet=this.opts.EventSet||d,this.opts.TransitionPairSet=this.opts.TransitionPairSet||d,this.opts.priorityComparisonFn=this.opts.priorityComparisonFn||i(this.opts.model),this._configuration=new this.opts.BasicStateSet,this._historyValue={},this._innerEventQueue=[],this._isInFinalState=!1,this._timeoutMap={},this._listeners=[]}function l(a,b){b=b||{},f(b),this._isStepping=!1,this._send=b.send||this._send,this._cancel=b.cancel||this._cancel,k.call(this,a,b)}"use strict";var d=b("./set/ArraySet"),e=b("./state-kinds-enum"),f=b("./setup-default-opts"),g=b("./scxml-dynamic-name-match-transition-selector"),h=b("../../platform"),j=!1;k.prototype={start:function(){j&&h.platform.log("performing initial big step"),this._configuration.add(this.model.root.initial);var a=this.opts.require||c.parent&&c.parent.parent&&c.parent.parent.require&&c.parent.parent.require.bind(c.parent.parent)||b.main&&b.main.require&&b.main.require.bind(b.main)||b,d=this.model.actionFactory(this.opts.log,this._cancel.bind(this),this._send.bind(this),this.opts.origin,this.isIn.bind(this),a,h.platform.parseDocumentFromString);return this._actions=d.actions,this._datamodel=d.datamodel,this._performBigStep(),this.getConfiguration()},_getOrSetData:function(a,b,c){var d=this._datamodel[b];if(!d)throw new Error("Variable "+b+" not declared in datamodel.");return d[a](c)},_getData:function(a){return this._getOrSetData("get",a)},_setData:function(a,b){return this._getOrSetData("set",a,b)},getConfiguration:function(){return this._configuration.iter().map(function(a){return a.id})},getFullConfiguration:function(){return this._configuration.iter().map(function(a){return[a].concat(this.opts.model.getAncestors(a))},this).reduce(function(a,b){return a.concat(b)},[]).map(function(a){return a.id}).reduce(function(a,b){return a.indexOf(b)>-1?a:a.concat(b)},[])},isIn:function(a){return this.getFullConfiguration().indexOf(a)>-1},_performBigStep:function(a){a&&this._innerEventQueue.push(new this.opts.EventSet([a]));var b=!0;while(b){var c=this._innerEventQueue.length?this._innerEventQueue.shift():new this.opts.EventSet,d={},f=this._performSmallStep(c,d);b=!f.isEmpty()}this._isInFinalState=this._configuration.iter().every(function(a){return a.kind===e.FINAL})},_performSmallStep:function(a,b){j&&h.platform.log("selecting transitions with eventSet: ",a);var c=this._selectTransitions(a,b);j&&h.platform.log("selected transitions: ",c);if(!c.isEmpty()){j&&h.platform.log("sorted transitions: ",c);var d=new this.opts.TransitionSet(c.iter().filter(function(a){return a.targets})),f=this._getStatesExited(d),g=f[0],i=f[1],k=this._getStatesEntered(d),l=k[0],m=k[1];j&&h.platform.log("basicStatesExited ",g),j&&h.platform.log("basicStatesEntered ",l),j&&h.platform.log("statesExited ",i),j&&h.platform.log("statesEntered ",m);var n=new this.opts.EventSet;j&&h.platform.log("executing state exit actions"),i.forEach(function(c){(j||this.opts.logStatesEnteredAndExited)&&h.platform.log("exiting ",c.id),this._listeners.forEach(function(a){a.onExit&&a.onExit(c.id)}),c.onexit!==undefined&&this._evaluateAction(c.onexit,a,b,n);var d;c.history&&(c.history.isDeep?d=function(a){return a.kind===e.BASIC&&c.descendants.indexOf(a)>-1}:d=function(a){return a.parent===c},this._historyValue[c.history.id]=i.filter(d))},this);var o=c.iter().sort(function(a,b){return a.documentOrder-b.documentOrder});j&&h.platform.log("executing transitition actions"),o.forEach(function(c){var d=c.targets&&c.targets.map(function(a){return a.id});this._listeners.forEach(function(a){a.onTransition&&a.onTransition(c.source.id,d)}),c.actions!==undefined&&this._evaluateAction(c.actions,a,b,n)},this),j&&h.platform.log("executing state enter actions"),m.forEach(function(c){(j||this.opts.logStatesEnteredAndExited)&&h.platform.log("entering",c.id),this._listeners.forEach(function(a){a.onEntry&&a.onEntry(c.id)}),c.onentry!==undefined&&this._evaluateAction(c.onentry,a,b,n)},this),j&&h.platform.log("updating configuration "),j&&h.platform.log("old configuration ",this._configuration),this._configuration.difference(g),this._configuration.union(l),j&&h.platform.log("new configuration ",this._configuration),n.isEmpty()||(j&&h.platform.log("adding triggered events to inner queue ",n),this._innerEventQueue.push(n)),j&&h.platform.log("updating datamodel for next small step :");for(var p in b)this._setData(p,b[p])}return c},_evaluateAction:function(a,b,c,d){function e(a){d.add(a)}var f=this._getScriptingInterface(c,b,!0);return this._actions[a].call(this.opts.evaluationContext,f.getData,f.setData,f.events,e)},_getScriptingInterface:function(a,b,c){return{setData:c?function(b,c){return a[b]=c}:function(){},getData:this._getData.bind(this),events:b.iter()}},_getStatesExited:function(a){var b=new this.opts.StateSet,c=new this.opts.BasicStateSet;a.iter().forEach(function(a){var d=a.lca,e=d.descendants;this._configuration.iter().forEach(function(a){e.indexOf(a)>-1&&(c.add(a),b.add(a),this.opts.model.getAncestors(a,d).forEach(function(a){b.add(a)}))},this)},this);var d=b.iter().sort(function(a,b){return b.depth-a.depth});return[c,d]},_getStatesEntered:function(a){var b=new this.opts.StateSet,c=new this.opts.BasicStateSet,d=new this.opts.StateSet,f=[],g=function(a,c){h(c);var f=this.opts.model.getLCA(a,c);this.opts.model.getAncestors(c,f).forEach(function(a){a.kind===e.COMPOSITE?(b.add(a),d.add(a)):h(a)})}.bind(this),h=function(a){if(d.contains(a))return;a.kind===e.HISTORY?a.id in this._historyValue?this._historyValue[a.id].forEach(function(b){g(a,b)}):(b.add(a),c.add(a)):(b.add(a),a.kind===e.PARALLEL?f.push.apply(f,a.children.filter(function(a){return a.kind!==e.HISTORY})):a.kind===e.COMPOSITE?f.push(a.initial):(a.kind===e.INITIAL||a.kind===e.BASIC||a.kind===e.FINAL)&&c.add(a)),d.add(a)}.bind(this);a.iter().forEach(function(a){a.targets.forEach(function(b){g(a.source,b)})});var i;while(i=f.pop())h(i);var j=b.iter().sort(function(a,b){return a.depth-b.depth});return[c,j]},_selectTransitions:function(a,b){if(this.opts.onlySelectFromBasicStates)var c=this._configuration.iter();else{var d=new this.opts.StateSet;this._configuration.iter().forEach(function(a){d.add(a),this.opts.model.getAncestors(a).forEach(function(a){d.add(a)})},this),c=d.iter()}var e=this._getScriptingInterface(b,a),f=function(a){return this._actions[a.conditionActionRef].call(this.opts.evaluationContext,e.getData,e.setData,e.events)}.bind(this),i=a.iter().map(function(a){return a.name}),k=i.filter(function(a){return a.search(".")}).length,l=k?g:this.opts.transitionSelector,m=new this.opts.TransitionSet;c.forEach(function(a){l(a,i,f).forEach(function(a){m.add(a)})});var n=this._selectPriorityEnabledTransitions(m);return j&&h.platform.log("priorityEnabledTransitions",n),n},_selectPriorityEnabledTransitions:function(a){var b=new this.opts.TransitionSet,c=this._getInconsistentTransitions(a),d=c[0],e=c[1];b.union(d),j&&h.platform.log("enabledTransitions",a),j&&h.platform.log("consistentTransitions",d),j&&h.platform.log("inconsistentTransitionsPairs",e),j&&h.platform.log("priorityEnabledTransitions",b);while(!e.isEmpty())a=new this.opts.TransitionSet(e.iter().map(function(a){return this.opts.priorityComparisonFn(a)},this)),c=this._getInconsistentTransitions(a),d=c[0],e=c[1],b.union(d),j&&h.platform.log("enabledTransitions",a),j&&h.platform.log("consistentTransitions",d),j&&h.platform.log("inconsistentTransitionsPairs",e),j&&h.platform.log("priorityEnabledTransitions",b);return b},_getInconsistentTransitions:function(a){var b=new this.opts.TransitionSet,c=new this.opts.TransitionPairSet,d=a.iter();j&&h.platform.log("transitions",d);for(var e=0;e<d.length;e++)for(var f=e+1;f<d.length;f++){var g=d[e],i=d[f];this._conflicts(g,i)&&(b.add(g),b.add(i),c.add([g,i]))}var k=a.difference(b);return[k,c]},_conflicts:function(a,b){return!this._isArenaOrthogonal(a,b)},_isArenaOrthogonal:function(a,b){var c=a.targets?a.lca:a.source,d=b.targets?b.lca:b.source,e=this.opts.model.isOrthogonalTo(c,d);return j&&(h.platform.log("transition LCAs",c.id,d.id),h.platform.log("transition LCAs are orthogonal?",e)),e},registerListener:function(a){return this._listeners.push(a)},unregisterListener:function(a){return this._listeners.splice(this._listeners.indexOf(a),1)}},l.prototype=Object.create(k.prototype),l.prototype.gen=function(a,b){var c;switch(typeof a){case"string":c={name:a,data:b};break;case"object":if(typeof a.name!="string")throw new Error('Event object must have "name" property of type string.');c=a;break;default:throw new Error("First argument to gen must be a string or object.")}if(this._isStepping)throw new Error("gen called before previous call to gen could complete. If executed in single-threaded environment, this means it was called recursively, which is illegal, as it would break SCION step semantics.");return this._isStepping=!0,this._performBigStep(c),this._isStepping=!1,this.getConfiguration()},l.prototype._send=function(a,b){var c,d,e=this;if(!h.platform.setTimeout)throw new Error("setTimeout function not set");j&&h.platform.log("sending event",a.name,"with content",a.data,"after delay",b.delay),c=function(){return e.gen(a)},d=h.platform.setTimeout(c,b.delay);if(b.sendid)return this._timeoutMap[b.sendid]=d},l.prototype._cancel=function(a){if(!h.platform.clearTimeout)throw new Error("clearTimeout function not set");if(a in this._timeoutMap)return j&&h.platform.log("cancelling ",a," with timeout id ",this._timeoutMap[a]),h.platform.clearTimeout(this._timeoutMap[a])},c.exports={SCXMLInterpreter:k,SimpleInterpreter:l}},"core/scxml/default-transition-selector":function(a,b,c){"use strict",c.exports=function(a,b,c){return a.transitions.filter(function(a){return!a.event||b.indexOf(a.event)>-1&&(!a.cond||c(a))})}},"core/scxml/json2model":function(a,b,c){function f(a){function b(a,b){return d.push(e.gen.util.wrapFunctionBodyInDeclaration(a,b))-1}function c(a){return f[a]}var d=[],f={};a.states.forEach(function(a){f[a.id]=a}),a.transitions.forEach(function(a){a.cond&&(a.conditionActionRef=b(a.cond,!0))}),a.states.forEach(function(d){d.transitions=d.transitions.map(function(b){return a.transitions[b]});var e=[];d.onentry&&(d.onentry=b(d.onentry)),d.onexit&&(d.onexit=b(d.onexit)),d.transitions.forEach(function(a){a.actions&&(a.actions=b(a.actions)),a.lca&&(a.lca=f[a.lca])}),d.initial=f[d.initial],d.history=f[d.history],d.children=d.children.map(c),d.parent=f[d.parent],d.ancestors&&(d.ancestors=d.ancestors.map(c)),d.descendants&&(d.descendants=d.descendants.map(c)),d.transitions.forEach(function(a){a.source=f[a.source],a.targets=a.targets&&a.targets.map(c)})}),a.root=f[a.root];var g=e.gen.util.makeActionFactory(a.scripts,d,a.datamodel);return g}function g(a,b){var c=f(a);try{a.actionFactory=d.platform.eval(c,b)}catch(e){throw d.platform.log("Failed to evaluate action factory."),d.platform.log("Generated js code to evaluate\n",c),e}}"use strict";var d=b("../../platform"),e=b("../util/code-gen");c.exports=function(a,b){return g(a,b),a};if(b.main===c){var h=process.argv[2],i=function(a,b){if(a)throw a;process.stdout.write(f(JSON.parse(b)))};if(h==="-"){var j="";process.stdin.resume(),process.stdin.on("data",function(a){j+=a}),process.stdin.on("end",function(a){i(null,j)})}else{var k=b("fs");k.readFile(h,"utf8",i)}}},"core/scxml/model":function(a,b,c){"use strict";var d=b("./state-kinds-enum"),e={getAncestors:function(a,b){var c,d,e;return d=a.ancestors.indexOf(b),d>-1?a.ancestors.slice(0,d):a.ancestors},getAncestorsOrSelf:function(a,b){return[a].concat(this.getAncestors(a,b))},getDescendantsOrSelf:function(a){return[a].concat(a.descendants)},isOrthogonalTo:function(a,b){return!this.isAncestrallyRelatedTo(a,b)&&this.getLCA(a,b).kind===d.PARALLEL},isAncestrallyRelatedTo:function(a,b){return this.getAncestorsOrSelf(b).indexOf(a)>-1||this.getAncestorsOrSelf(a).indexOf(b)>-1},getLCA:function(a,b){var c=this.getAncestors(a).filter(function(a){return a.descendants.indexOf(b)>-1},this);return c[0]}};c.exports=e},"core/scxml/scxml-dynamic-name-match-transition-selector":function(a,b,c){function e(a){return new RegExp("^"+a.replace(/\./g,"\\.")+"(\\.[0-9a-zA-Z]+)*$")}function f(a){return d[a]?d[a]:d[a]=e(a)}function g(a,b){var c=a.events,d=c.indexOf("*")>-1?function(){return!0}:function(a){return c.filter(function(b){return f(b).test(a)}).length};return b.filter(d).length}"use strict";var d={};c.exports=function(a,b,c){return a.transitions.filter(function(a){return(!a.events||g(a,b))&&(!a.cond||c(a))})}},"core/scxml/set/ArraySet":function(a,b,c){function d(a){a=a||[],this.o=[],a.forEach(function(a){this.add(a)},this)}"use strict",d.prototype={add:function(a){if(!this.contains(a))return this.o.push(a)},remove:function(a){var b=this.o.indexOf(a);return b===-1?!1:(this.o.splice(b,1),!0)},union:function(a){return a=a.iter?a.iter():a,a.forEach(function(a){this.add(a)},this),this},difference:function(a){return a=a.iter?a.iter():a,a.forEach(function(a){this.remove(a)},this),this},contains:function(a){return this.o.indexOf(a)>-1},iter:function(){return this.o},isEmpty:function(){return!this.o.length},equals:function(a){var b=a.iter(),c=this.o;return c.every(function(a){return b.indexOf(a)>-1})&&b.every(function(a){return c.indexOf(a)>-1})},toString:function(){return"Set("+this.o.toString()+")"}},c.exports=d},"core/scxml/setup-default-opts":function(a,b,c){"use strict";var d=b("./scxml-dynamic-name-match-transition-selector"),e=b("./set/ArraySet"),f=b("./model");c.exports=function(a){return a=a||{},a.TransitionSet=a.TransitionSet||e,a.StateSet=a.StateSet||e,a.BasicStateSet=a.BasicStateSet||e,a.transitionSelector=a.transitionSelector||d,a.model=a.model||f,a}},"core/scxml/state-kinds-enum":function(a,b,c){"use strict",c.exports={BASIC:0,COMPOSITE:1,PARALLEL:2,HISTORY:3,INITIAL:4,FINAL:5}},"core/util/annotate-scxml-json":function(a,b,c){function t(a){return f.platform.dom.getChildren(a).filter(function(a){return f.platform.dom.localName(a)==="script"}).map(function(a){return f.platform.dom.textContent(a)})}function u(a){var b,c,d;c=0,d={};for(b in a)d[b]={name:b,documentOrder:c++};return d}function w(a,b){if(f.platform.dom.hasAttribute(a,"event")){var c,e=f.platform.dom.getAttribute(a,"event");e==="*"?c=[e]:c=e.trim().split(/\s+/).map(function(a){var b=a.match(v);if(b){var c=b[1];if(!b||!c)throw new Error("Unable to parse event: "+a);return c}}),c.filter(function(a){return a!=="*"}).forEach(function(a){l[a]=!0});if(c.indexOf(undefined)>-1)throw new Error("Error parsing event attribute attributes.event")}var g={documentOrder:m.length,id:m.length,source:b.id,cond:f.platform.dom.getAttribute(a,"cond"),events:c,targets:f.platform.dom.hasAttribute(a,"target")?f.platform.dom.getAttribute(a,"target").trim().split(/\s+/):null};return f.platform.dom.getElementChildren(a).length&&(g.actions=d.gen.parentToFnBody(a)),m.push(g),g}function x(a,b){f.platform.dom.getChildren(a).filter(function(a){return f.platform.dom.localName(a)==="data"}).forEach(function(a){if(f.platform.dom.hasAttribute(a,"id")){var b,c=f.platform.dom.getAttribute(a,"id");if(f.platform.dom.hasAttribute(a,"expr"))b={content:f.platform.dom.getAttribute(a,"expr"),type:"expr"};else{var d=f.platform.dom.hasAttribute(a,"type");if(d){var e=f.platform.dom.getAttribute(a,"type"),g=e==="xml"?f.platform.dom.serializeToString(a):f.platform.dom.textContent(a);b={content:g,type:e}}else g=f.platform.dom.textContent(a),b=g.length?{content:g,type:"text"}:null}p[c]=b}})}function y(a,b){var c=f.platform.dom.hasAttribute(a,"id")?f.platform.dom.getAttribute(a,"id"):B(f.platform.dom.localName(a)),l;switch(f.platform.dom.localName(a)){case"state":f.platform.dom.getChildren(a).filter(function(a){return i.indexOf(f.platform.dom.localName(a))>-1}).length?l=g.COMPOSITE:l=g.BASIC;break;case"scxml":l=g.COMPOSITE;break;case"initial":l=g.INITIAL;break;case"parallel":l=g.PARALLEL;break;case"final":l=g.FINAL;break;case"history":l=g.HISTORY;break;default:}var m={id:c,kind:l,descendants:[]};n[c]=m,b.length&&(m.parent=b[b.length-1]),l===g.HISTORY&&(m.isDeep=f.platform.dom.getAttribute(a,"type")==="deep"?!0:!1),m.documentOrder=j.length,j.push(m);if(l===g.BASIC||l===g.INITIAL||l===g.HISTORY)m.basicDocumentOrder=k.length,k.push(m);m.depth=b.length,m.ancestors=b.slice(),b.forEach(function(a){n[a].descendants.push(m.id)});var o,p,r=[],s=[],t=b.concat(m.id),u=!1,v=null,z=function(a){var b=y(a,t);return m.initial=b.id,s.push(b),u=!0};f.platform.dom.getElementChildren(a).forEach(function(a){switch(f.platform.dom.localName(a)){case"transition":r.push(w(a,m));break;case"onentry":p=d.gen.parentToFnBody(a);break;case"onexit":o=d.gen.parentToFnBody(a);break;case"initial":if(!!u)throw new Error("Encountered duplicate initial states in state "+m.id);z(a);break;case"history":var b=y(a,t);m.history=b.id,s.push(b);break;case"datamodel":x(a,t);break;default:if(h.indexOf(f.platform.dom.localName(a))>-1){var c=y(a,t);v===null&&(v=c),s.push(c)}}});if(!u&&f.platform.dom.localName(a)!=="parallel"){var A=f.platform.dom.hasAttribute(a,"initial"),C=function(a){var b=f.platform.dom.createElementNS(q,e.SCXML_NS,"initial"),c=f.platform.dom.createElementNS(q,e.SCXML_NS,"transition");return f.platform.dom.setAttribute(c,"target",a),f.platform.dom.appendChild(b,c),z(b)};A?C(f.platform.dom.getAttribute(a,"initial")):v&&C(v.id)}return m.onexit=o,m.onentry=p,m.transitions=r.map(function(a){return a.documentOrder}),m.children=s.map(function(a){return a.id}),m}function B(a){return A[a]=A[a]||0,""+z+"-"+a+"-"+A[a]++}function C(a,b){var c,d,e,f,g,h,i;e=[],a.ancestors.forEach(function(a){d=n[a],d.descendants.indexOf(b.id)>-1&&e.push(a)});if(!e.length)throw new Error("Could not find LCA for states.");return e[0]}"use strict";var d=b("./code-gen"),e=b("../constants"),f=b("../../platform"),g=b("../scxml/state-kinds-enum"),h=["state","parallel","history","final","initial"],i=h.concat("scxml"),j,k,l,m,n,o,p,q,r=a.transformAndSerialize=r=function(a){return JSON.stringify(s(a))},s=a.transform=function(a){q=a;var b=q.documentElement;j=[],k=[],l={},m=[],n={},o=[],p={};var c=y(b,[]);return j.forEach(function(a){a.ancestors.reverse()}),j.forEach(function(a){a.descendants.reverse()}),m.filter(function(a){return a.targets}).forEach(function(a){var b=n[a.source],c=a.targets.map(function(a){var b=n[a];if(!b)throw new Error("Transition targets state id '"+a+"' but state does not exist.");return b});a.lca=C(b,c[0])}),{states:j,transitions:m,root:c.id,events:u(l),scripts:t(b),profile:f.platform.dom.getAttribute(b,"profile"),version:f.platform.dom.getAttribute(b,"version"),datamodel:p}},v=/^((([^.]+)\.)*([^.]+))(\.\*)?$/,z="$generated",A={};b.main===c&&console.log(JSON.stringify(s((new(b("xmldom").DOMParser)).parseFromString(b("fs").readFileSync(process.argv[2],"utf8"))),4,4))},"core/util/code-gen":function(a,b,c){function f(a){return d.platform.dom.getElementChildren(a).map(g).join("\n;;\n")}function g(a){var b=h[d.platform.dom.namespaceURI(a)],c=b&&b[d.platform.dom.localName(a)];if(!b||!c)throw new Error("Element "+d.platform.dom.namespaceURI(a)+":"+d.platform.dom.localName(a)+" not yet supported");return c(a)}function i(a){return a?a.slice(-2)==="ms"?parseFloat(a.slice(0,-2)):a.slice(-1)==="s"?parseFloat(a.slice(0,-1))*1e3:parseFloat(a):0}function j(a,b){var c=a;if(b){c+=" = ";switch(b.type){case"xml":c+="$parseXml("+JSON.stringify(b.content)+")";break;case"json":c+="JSON.parse("+JSON.stringify(b.content)+")";break;case"expr":c+=b.content;break;default:c+=JSON.stringify(b.content)}}return c}function k(a){var b="var ",c=[];for(var d in a){var e=a[d];c.push(j(d,e))}return c.length?b+c.join(", ")+";":""}function l(a){var b=[];for(var c in a)b.push('"'+c+'" : {\n'+'"set" : function(v){ return '+c+" = v; },\n"+'"get" : function(){ return '+c+";}"+"\n}");return"{\n"+b.join(",\n")+"\n}"}function m(a,b){return"function(getData,setData,_events,$raise){var _event = _events[0];\n"+(b?"return":"")+" "+a+"\n}"}function n(a,b,c,d){return a+(b.length?b.join("\n"):"")+"var $datamodel = "+c+";\n"+"return {\n"+"datamodel:$datamodel,\n"+"actions:[\n"+d.join(",\n")+"\n]"+"\n};"}function o(a){return"function($log,$cancel,$send,$origin,In,require,$parseXml){\n"+a+"\n}"}function p(a,b,c){var d=k(c),e=l(c),f=n(d,a,e,b),g=o(f);return g}function q(a){var b=d.platform.dom.hasAttribute(a,"namelist")?d.platform.dom.getAttribute(a,"namelist").trim().split(/ +/):null,c=d.platform.dom.getChildren(a).filter(function(a){return d.platform.dom.localName(a)==="param"}),e=d.platform.dom.getChildren(a).filter(function(a){return d.platform.dom.localName(a)==="content"});if(e.length)return e=e[0],d.platform.dom.getAttribute(e,"type")==="application/json"?d.platform.dom.textContent(e):JSON.stringify(d.platform.dom.textContent(e));if(d.platform.dom.hasAttribute(a,"contentexpr"))return d.platform.dom.getAttribute(a,"contentexpr");var f="{";return b&&b.forEach(function(a){f+='"'+a+'"'+":"+a+",\n"}),c.length&&c.map(function(a){return r(a)}).forEach(function(a){a.expr?f+='"'+a.name+'"'+":"+a.expr+",\n":a.location&&(f+='"'+a.name+'"'+":"+a.location+",\n")}),f+="}",f}function r(a){return{name:d.platform.dom.getAttribute(a,"name"),expr:d.platform.dom.getAttribute(a,"expr"),location:d.platform.dom.getAttribute(a,"location")}}"use strict";var d=b("../../platform"),e=b("../constants"),h={"":{script:function(a){return d.platform.dom.textContent(a)},assign:function(a){return d.platform.dom.getAttribute(a,"location")+" = "+d.platform.dom.getAttribute(a,"expr")+";"},"if":function(a){var b="";b+="if("+d.platform.dom.getAttribute(a,"cond")+"){\n";var c=d.platform.dom.getElementChildren(a);for(var e=0;e<c.length;e++){var f=c[e];if(d.platform.dom.localName(f)==="elseif"||d.platform.dom.localName(f)==="else")break;b+=g(f)+"\n;;\n"}for(;e<c.length;e++){f=c[e];if(d.platform.dom.localName(f)==="elseif")b+="}else if("+d.platform.dom.getAttribute(f,"cond")+"){\n";else{if(d.platform.dom.localName(f)==="else"){b+="}";break}b+=g(f)+"\n;;\n"}}for(;e<c.length;e++)f=c[e],d.platform.dom.localName(f)==="else"?b+="else{\n":b+=g(f)+"\n;;\n";return b+="}",b},elseif:function(){throw new Error("Encountered unexpected elseif tag.")},"else":function(){throw new Error("Encountered unexpected else tag.")},log:function(a){var b=[];return d.platform.dom.hasAttribute(a,"label")&&b.push(JSON.stringify(d.platform.dom.getAttribute(a,"label"))),d.platform.dom.hasAttribute(a,"expr")&&b.push(d.platform.dom.getAttribute(a,"expr")),"$log("+b.join(",")+");"},raise:function(a){return"$raise({ name:"+JSON.stringify(d.platform.dom.getAttribute(a,"event"))+", data : {}});"},cancel:function(a){return"$cancel("+JSON.stringify(d.platform.dom.getAttribute(a,"sendid"))+");"},send:function(a){var b=d.platform.dom.hasAttribute(a,"targetexpr")?d.platform.dom.getAttribute(a,"targetexpr"):JSON.stringify(d.platform.dom.getAttribute(a,"target")),c="{\ntarget: "+b+",\n"+"name: "+(d.platform.dom.hasAttribute(a,"eventexpr")?d.platform.dom.getAttribute(a,"eventexpr"):JSON.stringify(d.platform.dom.getAttribute(a,"event")))+",\n"+"type: "+(d.platform.dom.hasAttribute(a,"typeexpr")?d.platform.dom.getAttribute(a,"typeexpr"):JSON.stringify(d.platform.dom.getAttribute(a,"type")))+",\n"+"data: "+q(a)+",\n"+"origin: $origin\n"+"}",e="if("+b+" === '#_internal'){\n"+"$raise("+c+");\n"+"}else{\n"+"$send("+c+", {\n"+"delay: "+(d.platform.dom.hasAttribute(a,"delayexpr")?d.platform.dom.getAttribute(a,"delayexpr"):i(d.platform.dom.getAttribute(a,"delay")))+",\n"+"sendId: "+(d.platform.dom.hasAttribute(a,"idlocation")?d.platform.dom.getAttribute(a,"idlocation"):JSON.stringify(d.platform.dom.getAttribute(a,"id")))+"\n"+"});"+"}";return e},foreach:function(a){var b=d.platform.dom.hasAttribute(a,"index"),c=d.platform.dom.getAttribute(a,"index")||"$i",e=d.platform.dom.getAttribute(a,"item"),f=d.platform.dom.getAttribute(a,"array"),h=d.platform.dom.getElementChildren(a).map(g).join("\n;;\n");return"(function(){\nif(Array.isArray("+f+")){\n"+f+".forEach(function("+e+","+c+"){\n"+h+"\n});\n"+"}else{\n"+"Object.keys("+f+").forEach(function("+c+"){\n"+e+" = "+f+"["+c+"];\n"+h+"\n});\n"+"}\n"+"})();"}}};h[e.SCXML_NS]=h[""],c.exports={gen:{parentToFnBody:f,actionTagToFnBody:g,actionTags:h,util:{makeDatamodelDeclaration:k,makeDatamodelClosures:l,wrapFunctionBodyInDeclaration:m,makeTopLevelFunctionBody:n,wrapTopLevelFunctionBodyInDeclaration:o,makeActionFactory:p}}}},"core/util/docToModel":function(a,b,c){function g(a,b,c){f.platform.getResourceFromUrl?i(a,b,function(d){d&&f.platform.log("Errors downloading src attributes",d),h(b,a,c)}):h(b,a,c)}function h(a,b,c){try{var f=d.transform(a),g=e(f,b);c(null,g)}catch(h){c(h)}}function i(a,b,c){function g(){var b=d.pop();if(b){var h=f.platform.dom.getAttribute(b,"src");if(a){var i=f.platform.url.getPathFromUrl(a),j=f.platform.path.dirname(i),k=f.platform.path.join(j,h);h=f.platform.url.changeUrlPath(a,k)}f.platform.getResourceFromUrl(h,function(a,c){a?(f.platform.log("Error downloading document "+h+" : "+a.message),e.push(a)):f.platform.dom.textContent(b,c),g()})}else c(e.length?e:null)}var d=[],e=[];j(b.documentElement,d),g()}function j(a,b){(f.platform.dom.localName(a)==="script"||f.platform.dom.localName(a)==="data")&&f.platform.dom.hasAttribute(a,"src")&&b.push(a),f.platform.dom.getElementChildren(a).forEach(function(a){j(a,b)})}"use strict";var d=b("./annotate-scxml-json"),e=b("../scxml/json2model"),f=b("../../platform");c.exports=g},"core/util/util":function(a,b,c){"use strict",c.exports={merge:function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}return a}}},platform:function(a,b,c){function d(){return typeof Packages!="undefined"}function e(){return typeof process!="undefined"&&typeof c!="undefined"}function f(){return typeof window!="undefined"&&typeof document!="undefined"}"use strict";var g;f()?c.exports=b("./browser/platform"):e()?c.exports=b("./node/platform"):d()&&(c.exports=b("./rhino/platform"))},scion:function(a,b,c){function g(a,b){if(!d.platform.getDocumentFromUrl)throw new Error("Platform does not support getDocumentFromUrl");d.platform.getDocumentFromUrl(a,function(c,d){c?b(c,null):f(a,d,b)})}function h(a,b){if(!d.platform.getDocumentFromFilesystem)throw new Error("Platform does not support getDocumentFromFilesystem");d.platform.getDocumentFromFilesystem(a,function(c,d){c?b(c,null):f(a,d,b)})}function i(a,b){if(!d.platform.parseDocumentFromString)throw new Error("Platform does not support parseDocumentFromString");f(null,d.platform.parseDocumentFromString(a),b)}"use strict";var d=b("./platform"),e=b("./core/scxml/SCXML"),f=b("./core/util/docToModel"),j=c.exports={pathToModel:h,urlToModel:g,documentStringToModel:i,documentToModel:f,SCXML:e.SimpleInterpreter,ext:{platformModule:d,actionCodeGeneratorModule:b("./core/util/code-gen")}}}});
+(function(){if(!this.require){var a={},b={},c=function(f,g){var h=d(g,f),i=b[h],j;if(i)return i.exports;if(!(j=a[h]||a[h=d(h,"./index")]))throw"module '"+f+"' not found";i={id:h,exports:{}};try{return b[h]=i,j(i.exports,function(a){return c(a,e(h))},i),i.exports}catch(k){throw delete b[h],k}},d=function(a,b){var c=[],d,e;/^\.\.?(\/|$)/.test(b)?d=[a,b].join("/").split("/"):d=b.split("/");for(var f=0,g=d.length;f<g;f++)e=d[f],e==".."?c.pop():e!="."&&e!=""&&c.push(e);return c.join("/")},e=function(a){return a.split("/").slice(0,-1).join("/")};this.require=function(a){return c(a,"")},this.require.define=function(b){for(var c in b)a[c]=b[c]}}return this.require.define}).call(this)({"base-platform/dom":function(a,b,c){"use strict",c.exports={getChildren:function(a){return Array.prototype.slice.call(a.childNodes)},localName:function(a){return a.localName},getAttribute:function(a,b){return a.getAttribute(b)},hasAttribute:function(a,b){return a.hasAttribute(b)},namespaceURI:function(a){return a.namespaceURI},createElementNS:function(a,b,c){return a.createElementNS(b,c)},setAttribute:function(a,b,c){return a.setAttribute(b,c)},appendChild:function(a,b){return a.appendChild(b)},textContent:function(a,b){if(b===undefined)return a.nodeType===1?a.textContent!==undefined?a.textContent:this.getChildren(a).map(function(a){return this.textContent(a)},this).join(""):a.nodeType===3||a.nodeType===4?a.data:"";if(a.nodeType===1){if(a.textContent!==undefined)return a.textContent=b;var c=a.ownerDocument.createTextNode(b);return a.appendChild(c),b}if(a.nodeType===3)return a.data=b},getElementChildren:function(a){return this.getChildren(a).filter(function(a){return a.nodeType===1})}}},"base-platform/eval":function(exports,require,module){module.exports=function(content,name){return eval("(function(){\nreturn "+content+";})()")}},"base-platform/path":function(a,b,c){"use strict",c.exports={sep:"/",join:function(a,b){return a+"/"+b},dirname:function(a){return a.split(this.sep).slice(0,-1).join(this.sep)},basename:function(a,b){var c=a.split(this.sep).slice(-1);if(b){var d=this.extname(c);d[1]===b&&(c=d[1])}return c},extname:function(a){return a.split(/\\.(?=[^\\.]+$)/)[1]}}},"browser/browser-listener-client":function(a,b,c){},"browser/dom":function(a,b,c){function e(a,b){return"item"in a?a.item(b):a[b]}"use strict";var d=b("../base-platform/dom"),f=Object.create(d);f.hasAttribute=function(a,b){return a.hasAttribute?a.hasAttribute(b):a.getAttribute(b)},f.localName=function(a){return a.localName||a.tagName},f.createElementNS=function(a,b,c){return a.createElementNS?a.createElementNS(b,c):a.createElement(c)},f.getChildren=function(a){var b=[];for(var c=0;c<a.childNodes.length;c++)b.push(e(a.childNodes,c));return b},f.serializeToString=function(a){return a.xml||(new XMLSerializer).serializeToString(a)},c.exports=f},"browser/platform":function(a,b,c){"use strict";var d=b("../core/util/util");a.platform={ajax:window.jQuery,eval:b("../base-platform/eval"),getDocumentFromUrl:function(a,b){this.ajax.get(a,function(a){b(null,a)},"xml").error(function(a){b(a)})},parseDocumentFromString:function(a){return(new window.DOMParser).parseFromString(a,"application/xml")},getDocumentFromFilesystem:function(a,b){this.getDocumentFromUrl(a,b)},getResourceFromUrl:function(a,b){this.ajax.get(a,function(a){b(null,a)}).error(function(a){b(a)})},postDataToUrl:function(a,b,c){this.ajax.post(a,b,function(a){c(null,a)}).error(function(a){c(a)})},setTimeout:function(a,b){return window.setTimeout(a,b)},clearTimeout:function(a){window.clearTimeout(a)},log:window.console&&window.console.log&&(window.console.log.bind?window.console.log.bind(window.console):window.console.log),path:b("../base-platform/path"),url:b("./url"),dom:b("./dom")}},"browser/url":function(a,b,c){function d(a){var b=document.createElement("a");return b.href=a,b}"use strict",c.exports={getPathFromUrl:function(a){var b=d(a);return b.pathname},changeUrlPath:function(a,b){var c=d(a);return c.protocol+"//"+c.hostname+":"+c.port+b}}},"core/constants":function(a,b,c){"use strict",c.exports={SCXML_NS:"http://www.w3.org/2005/07/scxml"}},"core/scxml/SCXML":function(a,b,c){function i(a){return function(a){var b=a[0],c=a[1];return b.source.depth<c.source.depth?c:c.source.depth<b.source.depth?b:b.documentOrder<c.documentOrder?b:c}}function k(a,b){this.model=a,this.opts=b,this.opts.log=this.opts.log||h.platform.log,this.opts.StateIdSet=this.opts.StateIdSet||d,this.opts.EventSet=this.opts.EventSet||d,this.opts.TransitionPairSet=this.opts.TransitionPairSet||d,this.opts.priorityComparisonFn=this.opts.priorityComparisonFn||i(this.opts.model),this._configuration=new this.opts.BasicStateSet,this._historyValue={},this._innerEventQueue=[],this._isInFinalState=!1,this._timeoutMap={},this._listeners=[]}function l(a,b){b=b||{},f(b),this._isStepping=!1,this._send=b.send||this._send,this._cancel=b.cancel||this._cancel,k.call(this,a,b)}"use strict";var d=b("./set/ArraySet"),e=b("./state-kinds-enum"),f=b("./setup-default-opts"),g=b("./scxml-dynamic-name-match-transition-selector"),h=b("../../platform"),j=!1;k.prototype={start:function(){j&&h.platform.log("performing initial big step"),this._configuration.add(this.model.root.initial);var a=this.opts.require||c.parent&&c.parent.parent&&c.parent.parent.require&&c.parent.parent.require.bind(c.parent.parent)||b.main&&b.main.require&&b.main.require.bind(b.main)||b,d=this.model.actionFactory(this.opts.log,this._cancel.bind(this),this._send.bind(this),this.opts.origin,this.isIn.bind(this),a,h.platform.parseDocumentFromString);return this._actions=d.actions,this._datamodel=d.datamodel,this._performBigStep(),this.getConfiguration()},_getOrSetData:function(a,b,c){var d=this._datamodel[b];if(!d)throw new Error("Variable "+b+" not declared in datamodel.");return d[a](c)},_getData:function(a){return this._getOrSetData("get",a)},_setData:function(a,b){return this._getOrSetData("set",a,b)},getConfiguration:function(){return this._configuration.iter().map(function(a){return a.id})},getFullConfiguration:function(){return this._configuration.iter().map(function(a){return[a].concat(this.opts.model.getAncestors(a))},this).reduce(function(a,b){return a.concat(b)},[]).map(function(a){return a.id}).reduce(function(a,b){return a.indexOf(b)>-1?a:a.concat(b)},[])},isIn:function(a){return this.getFullConfiguration().indexOf(a)>-1},isFinal:function(a){return this._isInFinalState},_performBigStep:function(a){a&&this._innerEventQueue.push(new this.opts.EventSet([a]));var b=!0;while(b){var c=this._innerEventQueue.length?this._innerEventQueue.shift():new this.opts.EventSet,d={},f=this._performSmallStep(c,d);b=!f.isEmpty()}this._isInFinalState=this._configuration.iter().every(function(a){return a.kind===e.FINAL})},_performSmallStep:function(a,b){j&&h.platform.log("selecting transitions with eventSet: ",a);var c=this._selectTransitions(a,b);j&&h.platform.log("selected transitions: ",c);if(!c.isEmpty()){j&&h.platform.log("sorted transitions: ",c);var d=new this.opts.TransitionSet(c.iter().filter(function(a){return a.targets})),f=this._getStatesExited(d),g=f[0],i=f[1],k=this._getStatesEntered(d),l=k[0],m=k[1];j&&h.platform.log("basicStatesExited ",g),j&&h.platform.log("basicStatesEntered ",l),j&&h.platform.log("statesExited ",i),j&&h.platform.log("statesEntered ",m);var n=new this.opts.EventSet;j&&h.platform.log("executing state exit actions"),i.forEach(function(c){(j||this.opts.logStatesEnteredAndExited)&&h.platform.log("exiting ",c.id),this._listeners.forEach(function(a){a.onExit&&a.onExit(c.id)}),c.onexit!==undefined&&this._evaluateAction(c.onexit,a,b,n);var d;c.history&&(c.history.isDeep?d=function(a){return a.kind===e.BASIC&&c.descendants.indexOf(a)>-1}:d=function(a){return a.parent===c},this._historyValue[c.history.id]=i.filter(d))},this);var o=c.iter().sort(function(a,b){return a.documentOrder-b.documentOrder});j&&h.platform.log("executing transitition actions"),o.forEach(function(c){var d=c.targets&&c.targets.map(function(a){return a.id});this._listeners.forEach(function(a){a.onTransition&&a.onTransition(c.source.id,d)}),c.actions!==undefined&&this._evaluateAction(c.actions,a,b,n)},this),j&&h.platform.log("executing state enter actions"),m.forEach(function(c){(j||this.opts.logStatesEnteredAndExited)&&h.platform.log("entering",c.id),this._listeners.forEach(function(a){a.onEntry&&a.onEntry(c.id)}),c.onentry!==undefined&&this._evaluateAction(c.onentry,a,b,n)},this),j&&h.platform.log("updating configuration "),j&&h.platform.log("old configuration ",this._configuration),this._configuration.difference(g),this._configuration.union(l),j&&h.platform.log("new configuration ",this._configuration),n.isEmpty()||(j&&h.platform.log("adding triggered events to inner queue ",n),this._innerEventQueue.push(n)),j&&h.platform.log("updating datamodel for next small step :");for(var p in b)this._setData(p,b[p])}return c},_evaluateAction:function(a,b,c,d){function e(a){d.add(a)}var f=this._getScriptingInterface(c,b,!0);return this._actions[a].call(this.opts.evaluationContext,f.getData,f.setData,f.events,e)},_getScriptingInterface:function(a,b,c){return{setData:c?function(b,c){return a[b]=c}:function(){},getData:this._getData.bind(this),events:b.iter()}},_getStatesExited:function(a){var b=new this.opts.StateSet,c=new this.opts.BasicStateSet;a.iter().forEach(function(a){var d=a.lca,e=d.descendants;this._configuration.iter().forEach(function(a){e.indexOf(a)>-1&&(c.add(a),b.add(a),this.opts.model.getAncestors(a,d).forEach(function(a){b.add(a)}))},this)},this);var d=b.iter().sort(function(a,b){return b.depth-a.depth});return[c,d]},_getStatesEntered:function(a){var b=new this.opts.StateSet,c=new this.opts.BasicStateSet,d=new this.opts.StateSet,f=[],g=function(a,c){h(c);var f=this.opts.model.getLCA(a,c);this.opts.model.getAncestors(c,f).forEach(function(a){a.kind===e.COMPOSITE?(b.add(a),d.add(a)):h(a)})}.bind(this),h=function(a){if(d.contains(a))return;a.kind===e.HISTORY?a.id in this._historyValue?this._historyValue[a.id].forEach(function(b){g(a,b)}):(b.add(a),c.add(a)):(b.add(a),a.kind===e.PARALLEL?f.push.apply(f,a.children.filter(function(a){return a.kind!==e.HISTORY})):a.kind===e.COMPOSITE?f.push(a.initial):(a.kind===e.INITIAL||a.kind===e.BASIC||a.kind===e.FINAL)&&c.add(a)),d.add(a)}.bind(this);a.iter().forEach(function(a){a.targets.forEach(function(b){g(a.source,b)})});var i;while(i=f.pop())h(i);var j=b.iter().sort(function(a,b){return a.depth-b.depth});return[c,j]},_selectTransitions:function(a,b){if(this.opts.onlySelectFromBasicStates)var c=this._configuration.iter();else{var d=new this.opts.StateSet;this._configuration.iter().forEach(function(a){d.add(a),this.opts.model.getAncestors(a).forEach(function(a){d.add(a)})},this),c=d.iter()}var e=this._getScriptingInterface(b,a),f=function(a){return this._actions[a.conditionActionRef].call(this.opts.evaluationContext,e.getData,e.setData,e.events)}.bind(this),i=a.iter().map(function(a){return a.name}),k=i.filter(function(a){return a.search(".")}).length,l=k?g:this.opts.transitionSelector,m=new this.opts.TransitionSet;c.forEach(function(a){l(a,i,f).forEach(function(a){m.add(a)})});var n=this._selectPriorityEnabledTransitions(m);return j&&h.platform.log("priorityEnabledTransitions",n),n},_selectPriorityEnabledTransitions:function(a){var b=new this.opts.TransitionSet,c=this._getInconsistentTransitions(a),d=c[0],e=c[1];b.union(d),j&&h.platform.log("enabledTransitions",a),j&&h.platform.log("consistentTransitions",d),j&&h.platform.log("inconsistentTransitionsPairs",e),j&&h.platform.log("priorityEnabledTransitions",b);while(!e.isEmpty())a=new this.opts.TransitionSet(e.iter().map(function(a){return this.opts.priorityComparisonFn(a)},this)),c=this._getInconsistentTransitions(a),d=c[0],e=c[1],b.union(d),j&&h.platform.log("enabledTransitions",a),j&&h.platform.log("consistentTransitions",d),j&&h.platform.log("inconsistentTransitionsPairs",e),j&&h.platform.log("priorityEnabledTransitions",b);return b},_getInconsistentTransitions:function(a){var b=new this.opts.TransitionSet,c=new this.opts.TransitionPairSet,d=a.iter();j&&h.platform.log("transitions",d);for(var e=0;e<d.length;e++)for(var f=e+1;f<d.length;f++){var g=d[e],i=d[f];this._conflicts(g,i)&&(b.add(g),b.add(i),c.add([g,i]))}var k=a.difference(b);return[k,c]},_conflicts:function(a,b){return!this._isArenaOrthogonal(a,b)},_isArenaOrthogonal:function(a,b){var c=a.targets?a.lca:a.source,d=b.targets?b.lca:b.source,e=this.opts.model.isOrthogonalTo(c,d);return j&&(h.platform.log("transition LCAs",c.id,d.id),h.platform.log("transition LCAs are orthogonal?",e)),e},registerListener:function(a){return this._listeners.push(a)},unregisterListener:function(a){return this._listeners.splice(this._listeners.indexOf(a),1)}},l.prototype=Object.create(k.prototype),l.prototype.gen=function(a,b){var c;switch(typeof a){case"string":c={name:a,data:b};break;case"object":if(typeof a.name!="string")throw new Error('Event object must have "name" property of type string.');c=a;break;default:throw new Error("First argument to gen must be a string or object.")}if(this._isStepping)throw new Error("gen called before previous call to gen could complete. If executed in single-threaded environment, this means it was called recursively, which is illegal, as it would break SCION step semantics.");return this._isStepping=!0,this._performBigStep(c),this._isStepping=!1,this.getConfiguration()},l.prototype._send=function(a,b){var c,d,e=this;if(!h.platform.setTimeout)throw new Error("setTimeout function not set");j&&h.platform.log("sending event",a.name,"with content",a.data,"after delay",b.delay),c=function(){return e.gen(a)},d=h.platform.setTimeout(c,b.delay);if(b.sendid)return this._timeoutMap[b.sendid]=d},l.prototype._cancel=function(a){if(!h.platform.clearTimeout)throw new Error("clearTimeout function not set");if(a in this._timeoutMap)return j&&h.platform.log("cancelling ",a," with timeout id ",this._timeoutMap[a]),h.platform.clearTimeout(this._timeoutMap[a])},c.exports={SCXMLInterpreter:k,SimpleInterpreter:l}},"core/scxml/default-transition-selector":function(a,b,c){"use strict",c.exports=function(a,b,c){return a.transitions.filter(function(a){return!a.event||b.indexOf(a.event)>-1&&(!a.cond||c(a))})}},"core/scxml/json2model":function(a,b,c){function f(a){function b(a,b){return d.push(e.gen.util.wrapFunctionBodyInDeclaration(a,b))-1}function c(a){return f[a]}var d=[],f={};a.states.forEach(function(a){f[a.id]=a}),a.transitions.forEach(function(a){a.cond&&(a.conditionActionRef=b(a.cond,!0))}),a.states.forEach(function(d){d.transitions=d.transitions.map(function(b){return a.transitions[b]});var e=[];d.onentry&&(d.onentry=b(d.onentry)),d.onexit&&(d.onexit=b(d.onexit)),d.transitions.forEach(function(a){a.actions&&(a.actions=b(a.actions)),a.lca&&(a.lca=f[a.lca])}),d.initial=f[d.initial],d.history=f[d.history],d.children=d.children.map(c),d.parent=f[d.parent],d.ancestors&&(d.ancestors=d.ancestors.map(c)),d.descendants&&(d.descendants=d.descendants.map(c)),d.transitions.forEach(function(a){a.source=f[a.source],a.targets=a.targets&&a.targets.map(c)})}),a.root=f[a.root];var g=e.gen.util.makeActionFactory(a.scripts,d,a.datamodel);return g}function g(a,b){var c=f(a);try{a.actionFactory=d.platform.eval(c,b)}catch(e){throw d.platform.log("Failed to evaluate action factory."),d.platform.log("Generated js code to evaluate\n",c),e}}"use strict";var d=b("../../platform"),e=b("../util/code-gen");c.exports=function(a,b){return g(a,b),a};if(b.main===c){var h=process.argv[2],i=function(a,b){if(a)throw a;process.stdout.write(f(JSON.parse(b)))};if(h==="-"){var j="";process.stdin.resume(),process.stdin.on("data",function(a){j+=a}),process.stdin.on("end",function(a){i(null,j)})}else{var k=b("fs");k.readFile(h,"utf8",i)}}},"core/scxml/model":function(a,b,c){"use strict";var d=b("./state-kinds-enum"),e={getAncestors:function(a,b){var c,d,e;return d=a.ancestors.indexOf(b),d>-1?a.ancestors.slice(0,d):a.ancestors},getAncestorsOrSelf:function(a,b){return[a].concat(this.getAncestors(a,b))},getDescendantsOrSelf:function(a){return[a].concat(a.descendants)},isOrthogonalTo:function(a,b){return!this.isAncestrallyRelatedTo(a,b)&&this.getLCA(a,b).kind===d.PARALLEL},isAncestrallyRelatedTo:function(a,b){return this.getAncestorsOrSelf(b).indexOf(a)>-1||this.getAncestorsOrSelf(a).indexOf(b)>-1},getLCA:function(a,b){var c=this.getAncestors(a).filter(function(a){return a.descendants.indexOf(b)>-1},this);return c[0]}};c.exports=e},"core/scxml/scxml-dynamic-name-match-transition-selector":function(a,b,c){function e(a){return new RegExp("^"+a.replace(/\./g,"\\.")+"(\\.[0-9a-zA-Z]+)*$")}function f(a){return d[a]?d[a]:d[a]=e(a)}function g(a,b){var c=a.events,d=c.indexOf("*")>-1?function(){return!0}:function(a){return c.filter(function(b){return f(b).test(a)}).length};return b.filter(d).length}"use strict";var d={};c.exports=function(a,b,c){return a.transitions.filter(function(a){return(!a.events||g(a,b))&&(!a.cond||c(a))})}},"core/scxml/set/ArraySet":function(a,b,c){function d(a){a=a||[],this.o=[],a.forEach(function(a){this.add(a)},this)}"use strict",d.prototype={add:function(a){if(!this.contains(a))return this.o.push(a)},remove:function(a){var b=this.o.indexOf(a);return b===-1?!1:(this.o.splice(b,1),!0)},union:function(a){return a=a.iter?a.iter():a,a.forEach(function(a){this.add(a)},this),this},difference:function(a){return a=a.iter?a.iter():a,a.forEach(function(a){this.remove(a)},this),this},contains:function(a){return this.o.indexOf(a)>-1},iter:function(){return this.o},isEmpty:function(){return!this.o.length},equals:function(a){var b=a.iter(),c=this.o;return c.every(function(a){return b.indexOf(a)>-1})&&b.every(function(a){return c.indexOf(a)>-1})},toString:function(){return"Set("+this.o.toString()+")"}},c.exports=d},"core/scxml/setup-default-opts":function(a,b,c){"use strict";var d=b("./scxml-dynamic-name-match-transition-selector"),e=b("./set/ArraySet"),f=b("./model");c.exports=function(a){return a=a||{},a.TransitionSet=a.TransitionSet||e,a.StateSet=a.StateSet||e,a.BasicStateSet=a.BasicStateSet||e,a.transitionSelector=a.transitionSelector||d,a.model=a.model||f,a}},"core/scxml/state-kinds-enum":function(a,b,c){"use strict",c.exports={BASIC:0,COMPOSITE:1,PARALLEL:2,HISTORY:3,INITIAL:4,FINAL:5}},"core/util/annotate-scxml-json":function(a,b,c){function t(a){return f.platform.dom.getChildren(a).filter(function(a){return f.platform.dom.localName(a)==="script"}).map(function(a){return f.platform.dom.textContent(a)})}function u(a){var b,c,d;c=0,d={};for(b in a)d[b]={name:b,documentOrder:c++};return d}function w(a,b){if(f.platform.dom.hasAttribute(a,"event")){var c,e=f.platform.dom.getAttribute(a,"event");e==="*"?c=[e]:c=e.trim().split(/\s+/).map(function(a){var b=a.match(v);if(b){var c=b[1];if(!b||!c)throw new Error("Unable to parse event: "+a);return c}}),c.filter(function(a){return a!=="*"}).forEach(function(a){l[a]=!0});if(c.indexOf(undefined)>-1)throw new Error("Error parsing event attribute attributes.event")}var g={documentOrder:m.length,id:m.length,source:b.id,cond:f.platform.dom.getAttribute(a,"cond"),events:c,targets:f.platform.dom.hasAttribute(a,"target")?f.platform.dom.getAttribute(a,"target").trim().split(/\s+/):null};return f.platform.dom.getElementChildren(a).length&&(g.actions=d.gen.parentToFnBody(a)),m.push(g),g}function x(a,b){f.platform.dom.getChildren(a).filter(function(a){return f.platform.dom.localName(a)==="data"}).forEach(function(a){if(f.platform.dom.hasAttribute(a,"id")){var b,c=f.platform.dom.getAttribute(a,"id");if(f.platform.dom.hasAttribute(a,"expr"))b={content:f.platform.dom.getAttribute(a,"expr"),type:"expr"};else{var d=f.platform.dom.hasAttribute(a,"type");if(d){var e=f.platform.dom.getAttribute(a,"type"),g=e==="xml"?f.platform.dom.serializeToString(a):f.platform.dom.textContent(a);b={content:g,type:e}}else g=f.platform.dom.textContent(a),b=g.length?{content:g,type:"text"}:null}p[c]=b}})}function y(a,b){var c=f.platform.dom.hasAttribute(a,"id")?f.platform.dom.getAttribute(a,"id"):B(f.platform.dom.localName(a)),l;switch(f.platform.dom.localName(a)){case"state":f.platform.dom.getChildren(a).filter(function(a){return i.indexOf(f.platform.dom.localName(a))>-1}).length?l=g.COMPOSITE:l=g.BASIC;break;case"scxml":l=g.COMPOSITE;break;case"initial":l=g.INITIAL;break;case"parallel":l=g.PARALLEL;break;case"final":l=g.FINAL;break;case"history":l=g.HISTORY;break;default:}var m={id:c,kind:l,descendants:[]};n[c]=m,b.length&&(m.parent=b[b.length-1]),l===g.HISTORY&&(m.isDeep=f.platform.dom.getAttribute(a,"type")==="deep"?!0:!1),m.documentOrder=j.length,j.push(m);if(l===g.BASIC||l===g.INITIAL||l===g.HISTORY)m.basicDocumentOrder=k.length,k.push(m);m.depth=b.length,m.ancestors=b.slice(),b.forEach(function(a){n[a].descendants.push(m.id)});var o,p,r=[],s=[],t=b.concat(m.id),u=!1,v=null,z=function(a){var b=y(a,t);return m.initial=b.id,s.push(b),u=!0};f.platform.dom.getElementChildren(a).forEach(function(a){switch(f.platform.dom.localName(a)){case"transition":r.push(w(a,m));break;case"onentry":p=d.gen.parentToFnBody(a);break;case"onexit":o=d.gen.parentToFnBody(a);break;case"initial":if(!!u)throw new Error("Encountered duplicate initial states in state "+m.id);z(a);break;case"history":var b=y(a,t);m.history=b.id,s.push(b);break;case"datamodel":x(a,t);break;default:if(h.indexOf(f.platform.dom.localName(a))>-1){var c=y(a,t);v===null&&(v=c),s.push(c)}}});if(!u&&f.platform.dom.localName(a)!=="parallel"){var A=f.platform.dom.hasAttribute(a,"initial"),C=function(a){var b=f.platform.dom.createElementNS(q,e.SCXML_NS,"initial"),c=f.platform.dom.createElementNS(q,e.SCXML_NS,"transition");return f.platform.dom.setAttribute(c,"target",a),f.platform.dom.appendChild(b,c),z(b)};A?C(f.platform.dom.getAttribute(a,"initial")):v&&C(v.id)}return m.onexit=o,m.onentry=p,m.transitions=r.map(function(a){return a.documentOrder}),m.children=s.map(function(a){return a.id}),m}function B(a){return A[a]=A[a]||0,""+z+"-"+a+"-"+A[a]++}function C(a,b){var c,d,e,f,g,h,i;e=[],a.ancestors.forEach(function(a){d=n[a],d.descendants.indexOf(b.id)>-1&&e.push(a)});if(!e.length)throw new Error("Could not find LCA for states.");return e[0]}"use strict";var d=b("./code-gen"),e=b("../constants"),f=b("../../platform"),g=b("../scxml/state-kinds-enum"),h=["state","parallel","history","final","initial"],i=h.concat("scxml"),j,k,l,m,n,o,p,q,r=a.transformAndSerialize=r=function(a){return JSON.stringify(s(a))},s=a.transform=function(a){q=a;var b=q.documentElement;j=[],k=[],l={},m=[],n={},o=[],p={};var c=y(b,[]);return j.forEach(function(a){a.ancestors.reverse()}),j.forEach(function(a){a.descendants.reverse()}),m.filter(function(a){return a.targets}).forEach(function(a){var b=n[a.source],c=a.targets.map(function(a){var b=n[a];if(!b)throw new Error("Transition targets state id '"+a+"' but state does not exist.");return b});a.lca=C(b,c[0])}),{states:j,transitions:m,root:c.id,events:u(l),scripts:t(b),profile:f.platform.dom.getAttribute(b,"profile"),version:f.platform.dom.getAttribute(b,"version"),datamodel:p}},v=/^((([^.]+)\.)*([^.]+))(\.\*)?$/,z="$generated",A={};b.main===c&&console.log(JSON.stringify(s((new(b("xmldom").DOMParser)).parseFromString(b("fs").readFileSync(process.argv[2],"utf8"))),4,4))},"core/util/code-gen":function(a,b,c){function f(a){return d.platform.dom.getElementChildren(a).map(g).join("\n;;\n")}function g(a){var b=h[d.platform.dom.namespaceURI(a)],c=b&&b[d.platform.dom.localName(a)];if(!b||!c)throw new Error("Element "+d.platform.dom.namespaceURI(a)+":"+d.platform.dom.localName(a)+" not yet supported");return c(a)}function i(a){return a?a.slice(-2)==="ms"?parseFloat(a.slice(0,-2)):a.slice(-1)==="s"?parseFloat(a.slice(0,-1))*1e3:parseFloat(a):0}function j(a,b){var c=a;if(b){c+=" = ";switch(b.type){case"xml":c+="$parseXml("+JSON.stringify(b.content)+")";break;case"json":c+="JSON.parse("+JSON.stringify(b.content)+")";break;case"expr":c+=b.content;break;default:c+=JSON.stringify(b.content)}}return c}function k(a){var b="var ",c=[];for(var d in a){var e=a[d];c.push(j(d,e))}return c.length?b+c.join(", ")+";":""}function l(a){var b=[];for(var c in a)b.push('"'+c+'" : {\n'+'"set" : function(v){ return '+c+" = v; },\n"+'"get" : function(){ return '+c+";}"+"\n}");return"{\n"+b.join(",\n")+"\n}"}function m(a,b){return"function(getData,setData,_events,$raise){var _event = _events[0];\n"+(b?"return":"")+" "+a+"\n}"}function n(a,b,c,d){return a+(b.length?b.join("\n"):"")+"var $datamodel = "+c+";\n"+"return {\n"+"datamodel:$datamodel,\n"+"actions:[\n"+d.join(",\n")+"\n]"+"\n};"}function o(a){return"function($log,$cancel,$send,$origin,In,require,$parseXml){\n"+a+"\n}"}function p(a,b,c){var d=k(c),e=l(c),f=n(d,a,e,b),g=o(f);return g}function q(a){var b=d.platform.dom.hasAttribute(a,"namelist")?d.platform.dom.getAttribute(a,"namelist").trim().split(/ +/):null,c=d.platform.dom.getChildren(a).filter(function(a){return d.platform.dom.localName(a)==="param"}),e=d.platform.dom.getChildren(a).filter(function(a){return d.platform.dom.localName(a)==="content"});if(e.length)return e=e[0],d.platform.dom.getAttribute(e,"type")==="application/json"?d.platform.dom.textContent(e):JSON.stringify(d.platform.dom.textContent(e));if(d.platform.dom.hasAttribute(a,"contentexpr"))return d.platform.dom.getAttribute(a,"contentexpr");var f="{";return b&&b.forEach(function(a){f+='"'+a+'"'+":"+a+",\n"}),c.length&&c.map(function(a){return r(a)}).forEach(function(a){a.expr?f+='"'+a.name+'"'+":"+a.expr+",\n":a.location&&(f+='"'+a.name+'"'+":"+a.location+",\n")}),f+="}",f}function r(a){return{name:d.platform.dom.getAttribute(a,"name"),expr:d.platform.dom.getAttribute(a,"expr"),location:d.platform.dom.getAttribute(a,"location")}}"use strict";var d=b("../../platform"),e=b("../constants"),h={"":{script:function(a){return d.platform.dom.textContent(a)},assign:function(a){return d.platform.dom.getAttribute(a,"location")+" = "+d.platform.dom.getAttribute(a,"expr")+";"},"if":function(a){var b="";b+="if("+d.platform.dom.getAttribute(a,"cond")+"){\n";var c=d.platform.dom.getElementChildren(a);for(var e=0;e<c.length;e++){var f=c[e];if(d.platform.dom.localName(f)==="elseif"||d.platform.dom.localName(f)==="else")break;b+=g(f)+"\n;;\n"}for(;e<c.length;e++){f=c[e];if(d.platform.dom.localName(f)==="elseif")b+="}else if("+d.platform.dom.getAttribute(f,"cond")+"){\n";else{if(d.platform.dom.localName(f)==="else"){b+="}";break}b+=g(f)+"\n;;\n"}}for(;e<c.length;e++)f=c[e],d.platform.dom.localName(f)==="else"?b+="else{\n":b+=g(f)+"\n;;\n";return b+="}",b},elseif:function(){throw new Error("Encountered unexpected elseif tag.")},"else":function(){throw new Error("Encountered unexpected else tag.")},log:function(a){var b=[];return d.platform.dom.hasAttribute(a,"label")&&b.push(JSON.stringify(d.platform.dom.getAttribute(a,"label"))),d.platform.dom.hasAttribute(a,"expr")&&b.push(d.platform.dom.getAttribute(a,"expr")),"$log("+b.join(",")+");"},raise:function(a){return"$raise({ name:"+JSON.stringify(d.platform.dom.getAttribute(a,"event"))+", data : {}});"},cancel:function(a){return"$cancel("+JSON.stringify(d.platform.dom.getAttribute(a,"sendid"))+");"},send:function(a){var b=d.platform.dom.hasAttribute(a,"targetexpr")?d.platform.dom.getAttribute(a,"targetexpr"):JSON.stringify(d.platform.dom.getAttribute(a,"target")),c="{\ntarget: "+b+",\n"+"name: "+(d.platform.dom.hasAttribute(a,"eventexpr")?d.platform.dom.getAttribute(a,"eventexpr"):JSON.stringify(d.platform.dom.getAttribute(a,"event")))+",\n"+"type: "+(d.platform.dom.hasAttribute(a,"typeexpr")?d.platform.dom.getAttribute(a,"typeexpr"):JSON.stringify(d.platform.dom.getAttribute(a,"type")))+",\n"+"data: "+q(a)+",\n"+"origin: $origin\n"+"}",e="if("+b+" === '#_internal'){\n"+"$raise("+c+");\n"+"}else{\n"+"$send("+c+", {\n"+"delay: "+(d.platform.dom.hasAttribute(a,"delayexpr")?d.platform.dom.getAttribute(a,"delayexpr"):i(d.platform.dom.getAttribute(a,"delay")))+",\n"+"sendId: "+(d.platform.dom.hasAttribute(a,"idlocation")?d.platform.dom.getAttribute(a,"idlocation"):JSON.stringify(d.platform.dom.getAttribute(a,"id")))+"\n"+"});"+"}";return e},foreach:function(a){var b=d.platform.dom.hasAttribute(a,"index"),c=d.platform.dom.getAttribute(a,"index")||"$i",e=d.platform.dom.getAttribute(a,"item"),f=d.platform.dom.getAttribute(a,"array"),h=d.platform.dom.getElementChildren(a).map(g).join("\n;;\n");return"(function(){\nif(Array.isArray("+f+")){\n"+f+".forEach(function("+e+","+c+"){\n"+h+"\n});\n"+"}else{\n"+"Object.keys("+f+").forEach(function("+c+"){\n"+e+" = "+f+"["+c+"];\n"+h+"\n});\n"+"}\n"+"})();"}}};h[e.SCXML_NS]=h[""],c.exports={gen:{parentToFnBody:f,actionTagToFnBody:g,actionTags:h,util:{makeDatamodelDeclaration:k,makeDatamodelClosures:l,wrapFunctionBodyInDeclaration:m,makeTopLevelFunctionBody:n,wrapTopLevelFunctionBodyInDeclaration:o,makeActionFactory:p}}}},"core/util/docToModel":function(a,b,c){function g(a,b,c){f.platform.getResourceFromUrl?i(a,b,function(d){d&&f.platform.log("Errors downloading src attributes",d),h(b,a,c)}):h(b,a,c)}function h(a,b,c){try{var f=d.transform(a),g=e(f,b);c(null,g)}catch(h){c(h)}}function i(a,b,c){function g(){var b=d.pop();if(b){var h=f.platform.dom.getAttribute(b,"src");if(a){var i=f.platform.url.getPathFromUrl(a),j=f.platform.path.dirname(i),k=f.platform.path.join(j,h);h=f.platform.url.changeUrlPath(a,k)}f.platform.getResourceFromUrl(h,function(a,c){a?(f.platform.log("Error downloading document "+h+" : "+a.message),e.push(a)):f.platform.dom.textContent(b,c),g()})}else c(e.length?e:null)}var d=[],e=[];j(b.documentElement,d),g()}function j(a,b){(f.platform.dom.localName(a)==="script"||f.platform.dom.localName(a)==="data")&&f.platform.dom.hasAttribute(a,"src")&&b.push(a),f.platform.dom.getElementChildren(a).forEach(function(a){j(a,b)})}"use strict";var d=b("./annotate-scxml-json"),e=b("../scxml/json2model"),f=b("../../platform");c.exports=g},"core/util/util":function(a,b,c){"use strict",c.exports={merge:function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}return a}}},platform:function(a,b,c){function d(){return typeof Packages!="undefined"}function e(){return typeof process!="undefined"&&typeof c!="undefined"}function f(){return typeof window!="undefined"&&typeof document!="undefined"}"use strict";var g;f()?c.exports=b("./browser/platform"):e()?c.exports=b("./node/platform"):d()&&(c.exports=b("./rhino/platform"))},scion:function(a,b,c){function g(a,b){if(!d.platform.getDocumentFromUrl)throw new Error("Platform does not support getDocumentFromUrl");d.platform.getDocumentFromUrl(a,function(c,d){c?b(c,null):f(a,d,b)})}function h(a,b){if(!d.platform.getDocumentFromFilesystem)throw new Error("Platform does not support getDocumentFromFilesystem");d.platform.getDocumentFromFilesystem(a,function(c,d){c?b(c,null):f(a,d,b)})}function i(a,b){if(!d.platform.parseDocumentFromString)throw new Error("Platform does not support parseDocumentFromString");f(null,d.platform.parseDocumentFromString(a),b)}"use strict";var d=b("./platform"),e=b("./core/scxml/SCXML"),f=b("./core/util/docToModel"),j=c.exports={pathToModel:h,urlToModel:g,documentStringToModel:i,documentToModel:f,SCXML:e.SimpleInterpreter,ext:{platformModule:d,actionCodeGeneratorModule:b("./core/util/code-gen")}}}});
View
5 dist/scion.js
@@ -529,6 +529,11 @@ SCXMLInterpreter.prototype = {
return this.getFullConfiguration().indexOf(stateName) > -1;
},
+ /** @expose */
+ isFinal : function(stateName) {
+ return this._isInFinalState;
+ },
+
/** @private */
_performBigStep : function(e) {
if (e) this._innerEventQueue.push(new this.opts.EventSet([e]));

0 comments on commit a17638a

Please sign in to comment.