diff --git a/dist/jssm.es5.cjs.js b/dist/jssm.es5.cjs.js index bbbd1927..dd7aa8c7 100644 --- a/dist/jssm.es5.cjs.js +++ b/dist/jssm.es5.cjs.js @@ -2837,7 +2837,7 @@ Object.defineProperty(exports, "__esModule", { var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var rand_select = function rand_select(options) { +var weighted_rand_select = function weighted_rand_select(options) { var probability_property = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'probability'; @@ -2875,23 +2875,23 @@ var histograph = function histograph(a) { }, new Map()); }; -var sample_select = function sample_select(n, options, probability_property) { +var weighted_sample_select = function weighted_sample_select(n, options, probability_property) { return seq(n).map(function (i) { - return rand_select(options, probability_property); + return weighted_rand_select(options, probability_property); }); }; -var histo_key = function histo_key(n, options, probability_property, extract) { - return histograph(sample_select(n, options, probability_property).map(function (s) { +var weighted_histo_key = function weighted_histo_key(n, options, probability_property, extract) { + return histograph(weighted_sample_select(n, options, probability_property).map(function (s) { return s[extract]; })); }; exports.seq = seq; exports.histograph = histograph; -exports.histo_key = histo_key; -exports.rand_select = rand_select; -exports.sample_select = sample_select; +exports.weighted_histo_key = weighted_histo_key; +exports.weighted_rand_select = weighted_rand_select; +exports.weighted_sample_select = weighted_sample_select; },{}],3:[function(require,module,exports){ 'use strict'; @@ -3003,7 +3003,7 @@ exports.viz = viz; Object.defineProperty(exports, "__esModule", { value: true }); -exports.histograph = exports.rand_select = exports.seq = exports.parse = exports.machine = exports.version = undefined; +exports.histograph = exports.weighted_rand_select = exports.seq = exports.parse = exports.machine = exports.version = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); @@ -3296,7 +3296,7 @@ var machine = function () { }, { key: 'probabilistic_transition', value: function probabilistic_transition() { - var selected = (0, _jssmUtil.rand_select)(this.probable_exits_for(this.state())); + var selected = (0, _jssmUtil.weighted_rand_select)(this.probable_exits_for(this.state())); return this.transition(selected.to); } }, { @@ -3560,7 +3560,7 @@ exports.version = version; exports.machine = machine; exports.parse = parse; exports.seq = _jssmUtil.seq; -exports.rand_select = _jssmUtil.rand_select; +exports.weighted_rand_select = _jssmUtil.weighted_rand_select; exports.histograph = _jssmUtil.histograph; },{"./jssm-dot.js":1,"./jssm-util.js":2,"./jssm-viz.js":3}]},{},[]); diff --git a/dist/jssm.es5.cjs.min.js b/dist/jssm.es5.cjs.min.js index dadd1d59..041ff14d 100644 --- a/dist/jssm.es5.cjs.min.js +++ b/dist/jssm.es5.cjs.min.js @@ -1 +1 @@ -require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;opeg$maxFailPos&&(peg$maxFailPos=peg$currPos,peg$maxFailExpected=[]),peg$maxFailExpected.push(expected))}function peg$buildStructuredError(expected,found,location){return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected,found),expected,found,location)}function peg$parseDocument(){var s0,s1,s2;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED&&(s2=peg$parseTermList())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c0(s2)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGvizShape(){var s0;return input.substr(peg$currPos,6)===peg$c1?(s0=peg$c1,peg$currPos+=6):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c2)),s0===peg$FAILED&&(input.substr(peg$currPos,9)===peg$c3?(s0=peg$c3,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c4)),s0===peg$FAILED&&(input.substr(peg$currPos,6)===peg$c5?(s0=peg$c5,peg$currPos+=6):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c6)))),s0}function peg$parseForwardArrow(){var s0;return peg$silentFails++,input.substr(peg$currPos,2)===peg$c8?(s0=peg$c8,peg$currPos+=2):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c9)),peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c7)),s0}function peg$parseTwoWayArrow(){var s0;return peg$silentFails++,input.substr(peg$currPos,3)===peg$c11?(s0=peg$c11,peg$currPos+=3):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c12)),peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c10)),s0}function peg$parseArrow(){var s0;return(s0=peg$parseForwardArrow())===peg$FAILED&&(s0=peg$parseTwoWayArrow()),s0}function peg$parseHexDigit(){var s0;return peg$c13.test(input.charAt(peg$currPos))?(s0=input.charAt(peg$currPos),peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c14)),s0}function peg$parseChar(){var s0,s2,s3,s4,s5,s6,s7,s8,s9;return(s0=peg$parseUnescaped())===peg$FAILED&&(s0=peg$currPos,peg$parseEscape()!==peg$FAILED?(34===input.charCodeAt(peg$currPos)?(s2=peg$c15,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c16)),s2===peg$FAILED&&(92===input.charCodeAt(peg$currPos)?(s2=peg$c17,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c18)),s2===peg$FAILED&&(47===input.charCodeAt(peg$currPos)?(s2=peg$c19,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c20)),s2===peg$FAILED&&(s2=peg$currPos,98===input.charCodeAt(peg$currPos)?(s3=peg$c21,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c22)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c23()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,102===input.charCodeAt(peg$currPos)?(s3=peg$c24,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c25)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c26()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,110===input.charCodeAt(peg$currPos)?(s3=peg$c27,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c28)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c29()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,114===input.charCodeAt(peg$currPos)?(s3=peg$c30,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c31)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c32()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,116===input.charCodeAt(peg$currPos)?(s3=peg$c33,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c34)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c35()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,118===input.charCodeAt(peg$currPos)?(s3=peg$c36,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c37)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c38()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,117===input.charCodeAt(peg$currPos)?(s3=peg$c39,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c40)),s3!==peg$FAILED?(s4=peg$currPos,s5=peg$currPos,(s6=peg$parseHexDigit())!==peg$FAILED&&(s7=peg$parseHexDigit())!==peg$FAILED&&(s8=peg$parseHexDigit())!==peg$FAILED&&(s9=peg$parseHexDigit())!==peg$FAILED?s5=s6=[s6,s7,s8,s9]:(peg$currPos=s5,s5=peg$FAILED),(s4=s5!==peg$FAILED?input.substring(s4,peg$currPos):s5)!==peg$FAILED?(peg$savedPos=s2,s2=s3=peg$c41(s4)):(peg$currPos=s2,s2=peg$FAILED)):(peg$currPos=s2,s2=peg$FAILED)))))))))),s2!==peg$FAILED?(peg$savedPos=s0,s0=peg$c42(s2)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)),s0}function peg$parseEscape(){var s0;return 92===input.charCodeAt(peg$currPos)?(s0=peg$c17,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c18)),s0}function peg$parseQuoteMark(){var s0;return 34===input.charCodeAt(peg$currPos)?(s0=peg$c15,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c16)),s0}function peg$parseUnescaped(){var s0;return peg$c43.test(input.charAt(peg$currPos))?(s0=input.charAt(peg$currPos),peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c44)),s0}function peg$parseWhitespace(){var s0,s1;for(peg$silentFails++,s0=[],peg$c46.test(input.charAt(peg$currPos))?(s1=input.charAt(peg$currPos),peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c47));s1!==peg$FAILED;)s0.push(s1),peg$c46.test(input.charAt(peg$currPos))?(s1=input.charAt(peg$currPos),peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c47));return peg$silentFails--,s0===peg$FAILED&&(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c45)),s0}function peg$parseString(){var s0,s2,s3;if(peg$silentFails++,s0=peg$currPos,peg$parseQuoteMark()!==peg$FAILED){for(s2=[],s3=peg$parseChar();s3!==peg$FAILED;)s2.push(s3),s3=peg$parseChar();s2!==peg$FAILED&&(s3=peg$parseQuoteMark())!==peg$FAILED?(peg$savedPos=s0,s0=peg$c49(s2)):(peg$currPos=s0,s0=peg$FAILED)}else peg$currPos=s0,s0=peg$FAILED;return peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c48)),s0}function peg$parseAtom(){var s0,s1,s2;if(peg$silentFails++,s0=peg$currPos,s1=[],peg$c51.test(input.charAt(peg$currPos))?(s2=input.charAt(peg$currPos),peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c52)),s2!==peg$FAILED)for(;s2!==peg$FAILED;)s1.push(s2),peg$c51.test(input.charAt(peg$currPos))?(s2=input.charAt(peg$currPos),peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c52));else s1=peg$FAILED;return s1!==peg$FAILED&&(peg$savedPos=s0,s1=peg$c53(s1)),s0=s1,peg$silentFails--,s0===peg$FAILED&&(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c50)),s0}function peg$parseLabel(){var s0;return peg$silentFails++,(s0=peg$parseAtom())===peg$FAILED&&(s0=peg$parseString()),peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c54)),s0}function peg$parseValue(){return peg$parseLabel()}function peg$parseItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseLabel(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c55,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s2!==peg$FAILED&&(s3=peg$parseValue())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c57,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c59(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseItems(){var s0,s1;if(s0=[],(s1=peg$parseItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseItem();else s0=peg$FAILED;return s0}function peg$parseArrowDesc(){var s0,s1,s2,s3;return s0=peg$currPos,123===input.charCodeAt(peg$currPos)?(s1=peg$c60,peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s1!==peg$FAILED?((s2=peg$parseItems())===peg$FAILED&&(s2=null),s2!==peg$FAILED?(125===input.charCodeAt(peg$currPos)?(s3=peg$c62,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s3!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c64(s2)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseSubexp(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?((s2=peg$parseArrowDesc())===peg$FAILED&&(s2=null),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s4=peg$parseArrow())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s6=peg$parseArrowDesc())===peg$FAILED&&(s6=null),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s8=peg$parseLabel())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s10=peg$parseSubexp())===peg$FAILED&&(s10=null),s10!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c65(s2,s4,s6,s8,s10)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseExp(){var s0,s1,s2,s4;return s0=peg$currPos,s1=peg$parseLabel(),s1!==peg$FAILED&&(s2=peg$parseSubexp())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c57,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c66(s1,s2)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseValidationKey(){var s0;return input.substr(peg$currPos,9)===peg$c67?(s0=peg$c67,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c68)),s0===peg$FAILED&&(input.substr(peg$currPos,4)===peg$c69?(s0=peg$c69,peg$currPos+=4):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c70))),s0}function peg$parseValidationItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseValidationKey(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c55,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s2!==peg$FAILED&&(s3=peg$parseValue())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c57,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c71(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseValidationItems(){var s0,s1;if(s0=[],(s1=peg$parseValidationItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseValidationItem();else s0=peg$FAILED;return s0}function peg$parseConfigValidation(){var s0,s1,s2,s4,s6,s7,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,10)===peg$c72?(s2=peg$c72,peg$currPos+=10):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c73)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c60,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s6!==peg$FAILED?((s7=peg$parseValidationItems())===peg$FAILED&&(s7=null),s7!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c74?(s8=peg$c74,peg$currPos+=2):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c75)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c76(s7)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGvizLayout(){var s0;return input.substr(peg$currPos,3)===peg$c77?(s0=peg$c77,peg$currPos+=3):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c78)),s0===peg$FAILED&&(input.substr(peg$currPos,5)===peg$c79?(s0=peg$c79,peg$currPos+=5):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c80))),s0}function peg$parseInShape(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,8)===peg$c81?(s2=peg$c81,peg$currPos+=8):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c82)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c83(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseOutShape(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,9)===peg$c84?(s2=peg$c84,peg$currPos+=9):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c85)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c86(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseNodeShape(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,10)===peg$c87?(s2=peg$c87,peg$currPos+=10):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c88)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c89(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGraphLayout(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,12)===peg$c90?(s2=peg$c90,peg$currPos+=12):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c91)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizLayout())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c92(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseStateItem(){var s0;return(s0=peg$parseInShape())===peg$FAILED&&(s0=peg$parseOutShape())===peg$FAILED&&(s0=peg$parseNodeShape())===peg$FAILED&&(s0=peg$parseGraphLayout()),s0}function peg$parseStateItems(){var s0,s1;if(s0=[],(s1=peg$parseStateItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseStateItem();else s0=peg$FAILED;return s0}function peg$parseConfigState(){var s0,s1,s2,s4,s6,s7,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,5)===peg$c93?(s2=peg$c93,peg$currPos+=5):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c94)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c60,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s6!==peg$FAILED?((s7=peg$parseStateItems())===peg$FAILED&&(s7=null),s7!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c74?(s8=peg$c74,peg$currPos+=2):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c75)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c95(s7)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseActionKey(){var s0;return input.substr(peg$currPos,9)===peg$c67?(s0=peg$c67,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c68)),s0===peg$FAILED&&(input.substr(peg$currPos,4)===peg$c69?(s0=peg$c69,peg$currPos+=4):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c70))),s0}function peg$parseActionItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseActionKey(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c55,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s2!==peg$FAILED&&(s3=peg$parseValue())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c57,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c96(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseActionItems(){var s0,s1;if(s0=[],(s1=peg$parseActionItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseActionItem();else s0=peg$FAILED;return s0}function peg$parseConfigAction(){var s0,s1,s2,s4,s6,s7,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,6)===peg$c97?(s2=peg$c97,peg$currPos+=6):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c98)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c60,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s6!==peg$FAILED?((s7=peg$parseActionItems())===peg$FAILED&&(s7=null),s7!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c74?(s8=peg$c74,peg$currPos+=2):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c75)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c99(s7)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseTransitionKey(){var s0;return input.substr(peg$currPos,9)===peg$c67?(s0=peg$c67,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c68)),s0===peg$FAILED&&(input.substr(peg$currPos,4)===peg$c69?(s0=peg$c69,peg$currPos+=4):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c70))),s0}function peg$parseTransitionItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseTransitionKey(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c55,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s2!==peg$FAILED&&(s3=peg$parseValue())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c57,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c100(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseTransitionItems(){var s0,s1;if(s0=[],(s1=peg$parseTransitionItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseTransitionItem();else s0=peg$FAILED;return s0}function peg$parseConfigTransition(){var s0,s1,s2,s4,s6,s7,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,10)===peg$c101?(s2=peg$c101,peg$currPos+=10):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c102)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c60,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s6!==peg$FAILED?((s7=peg$parseTransitionItems())===peg$FAILED&&(s7=null),s7!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c74?(s8=peg$c74,peg$currPos+=2):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c75)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c103(s7)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGraphBg(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,8)===peg$c104?(s2=peg$c104,peg$currPos+=8):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c105)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c106(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseMinTransitionsPerState(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,25)===peg$c107?(s2=peg$c107,peg$currPos+=25):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c108)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseLabel())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c109(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseMaxTransitionsPerState(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,25)===peg$c110?(s2=peg$c110,peg$currPos+=25):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c111)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseLabel())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c112(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGraphItem(){var s0;return(s0=peg$parseGraphBg())===peg$FAILED&&(s0=peg$parseMinTransitionsPerState())===peg$FAILED&&(s0=peg$parseMaxTransitionsPerState()),s0}function peg$parseGraphItems(){var s0,s1;if(s0=[],(s1=peg$parseGraphItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseGraphItem();else s0=peg$FAILED;return s0}function peg$parseConfigGraph(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,5)===peg$c113?(s2=peg$c113,peg$currPos+=5):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c114)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c60,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseGraphItems())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c74?(s10=peg$c74,peg$currPos+=2):(s10=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c75)),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c115(s8)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseConfig(){var s0;return(s0=peg$parseConfigGraph())===peg$FAILED&&(s0=peg$parseConfigTransition())===peg$FAILED&&(s0=peg$parseConfigAction())===peg$FAILED&&(s0=peg$parseConfigState())===peg$FAILED&&(s0=peg$parseConfigValidation()),s0}function peg$parseTerm(){var s0;return(s0=peg$parseExp())===peg$FAILED&&(s0=peg$parseConfig()),s0}function peg$parseTermList(){var s0,s1;for(s0=[],s1=peg$parseTerm();s1!==peg$FAILED;)s0.push(s1),s1=peg$parseTerm();return s0}options=void 0!==options?options:{};var peg$result,peg$FAILED={},peg$startRuleFunctions={Document:peg$parseDocument},peg$startRuleFunction=peg$parseDocument,peg$c0=function(e){return e},peg$c1="square",peg$c2=peg$literalExpectation("square",!1),peg$c3="rectangle",peg$c4=peg$literalExpectation("rectangle",!1),peg$c5="circle",peg$c6=peg$literalExpectation("circle",!1),peg$c7=peg$otherExpectation("forward arrow"),peg$c8="->",peg$c9=peg$literalExpectation("->",!1),peg$c10=peg$otherExpectation("two way arrow"),peg$c11="<->",peg$c12=peg$literalExpectation("<->",!1),peg$c13=/^[0-9a-fA-F]/,peg$c14=peg$classExpectation([["0","9"],["a","f"],["A","F"]],!1,!1),peg$c15='"',peg$c16=peg$literalExpectation('"',!1),peg$c17="\\",peg$c18=peg$literalExpectation("\\",!1),peg$c19="/",peg$c20=peg$literalExpectation("/",!1),peg$c21="b",peg$c22=peg$literalExpectation("b",!1),peg$c23=function(){return"\b"},peg$c24="f",peg$c25=peg$literalExpectation("f",!1),peg$c26=function(){return"\f"},peg$c27="n",peg$c28=peg$literalExpectation("n",!1),peg$c29=function(){return"\n"},peg$c30="r",peg$c31=peg$literalExpectation("r",!1),peg$c32=function(){return"\r"},peg$c33="t",peg$c34=peg$literalExpectation("t",!1),peg$c35=function(){return"\t"},peg$c36="v",peg$c37=peg$literalExpectation("v",!1),peg$c38=function(){return"\v"},peg$c39="u",peg$c40=peg$literalExpectation("u",!1),peg$c41=function(digits){return String.fromCharCode(parseInt(digits,16))},peg$c42=function(Sequence){return Sequence},peg$c43=/^[ -!#-[\]-\u10FFFF]/,peg$c44=peg$classExpectation([[" ","!"],["#","["],["]","ჿ"],"F","F"],!1,!1),peg$c45=peg$otherExpectation("whitespace"),peg$c46=/^[ \t\n\r\x0B]/,peg$c47=peg$classExpectation([" ","\t","\n","\r","\v"],!1,!1),peg$c48=peg$otherExpectation("string"),peg$c49=function(chars){return chars.join("")},peg$c50=peg$otherExpectation("atom"),peg$c51=/^[0-9a-zA-Z.+_&()%$#@!?,']/,peg$c52=peg$classExpectation([["0","9"],["a","z"],["A","Z"],".","+","_","&","(",")","%","$","#","@","!","?",",","'"],!1,!1),peg$c53=function(text){return text.join("")},peg$c54=peg$otherExpectation("label"),peg$c55=":",peg$c56=peg$literalExpectation(":",!1),peg$c57=";",peg$c58=peg$literalExpectation(";",!1),peg$c59=function(text,value){return{text:text,value:value}},peg$c60="{",peg$c61=peg$literalExpectation("{",!1),peg$c62="}",peg$c63=peg$literalExpectation("}",!1),peg$c64=function(items){return items},peg$c65=function(ldesc,arrow,rdesc,label,tail){var base={kind:arrow,to:label};return tail&&tail!==[]&&(base.se=tail),ldesc&&(base.ldesc=ldesc),rdesc&&(base.rdesc=rdesc),base},peg$c66=function(label,se){var base={from:label};return se&&se!==[]&&(base.se=se),base},peg$c67="whargarbl",peg$c68=peg$literalExpectation("whargarbl",!1),peg$c69="todo",peg$c70=peg$literalExpectation("todo",!1),peg$c71=function(validationkey,value){return{key:validationkey,value:value}},peg$c72="validation",peg$c73=peg$literalExpectation("validation",!1),peg$c74="};",peg$c75=peg$literalExpectation("};",!1),peg$c76=function(validation_items){return{config_kind:"validation",config_items:validation_items||[]}},peg$c77="dot",peg$c78=peg$literalExpectation("dot",!1),peg$c79="circo",peg$c80=peg$literalExpectation("circo",!1),peg$c81="in_shape",peg$c82=peg$literalExpectation("in_shape",!1),peg$c83=function(value){return{key:"in_shape",value:value}},peg$c84="out_shape",peg$c85=peg$literalExpectation("out_shape",!1),peg$c86=function(value){return{key:"out_shape",value:value}},peg$c87="node_shape",peg$c88=peg$literalExpectation("node_shape",!1),peg$c89=function(value){return{key:"node_shape",value:value}},peg$c90="graph_layout",peg$c91=peg$literalExpectation("graph_layout",!1),peg$c92=function(value){return{key:"graph_layout",value:value}},peg$c93="state",peg$c94=peg$literalExpectation("state",!1),peg$c95=function(state_items){return{config_kind:"state",config_items:state_items||[]}},peg$c96=function(actionkey,value){return{key:actionkey,value:value}},peg$c97="action",peg$c98=peg$literalExpectation("action",!1),peg$c99=function(action_items){return{config_kind:"action",config_items:action_items||[]}},peg$c100=function(transitionkey,value){return{key:transitionkey,value:value}},peg$c101="transition",peg$c102=peg$literalExpectation("transition",!1),peg$c103=function(transition_items){return{config_kind:"transition",config_items:transition_items||[]}},peg$c104="graph_bg",peg$c105=peg$literalExpectation("graph_bg",!1),peg$c106=function(value){return{key:"graph_bg",value:value}},peg$c107="min_transitions_per_state",peg$c108=peg$literalExpectation("min_transitions_per_state",!1),peg$c109=function(value){return{key:"min_transitions_per_state",value:value}},peg$c110="max_transitions_per_state",peg$c111=peg$literalExpectation("max_transitions_per_state",!1),peg$c112=function(value){return{key:"max_transitions_per_state",value:value}},peg$c113="graph",peg$c114=peg$literalExpectation("graph",!1),peg$c115=function(graph_items){return{config_kind:"graph",config_items:graph_items||[]}},peg$currPos=0,peg$savedPos=0,peg$posDetailsCache=[{line:1,column:1}],peg$maxFailPos=0,peg$maxFailExpected=[],peg$silentFails=0;if("startRule"in options){if(!(options.startRule in peg$startRuleFunctions))throw new Error("Can't start parsing from rule \""+options.startRule+'".');peg$startRuleFunction=peg$startRuleFunctions[options.startRule]}if((peg$result=peg$startRuleFunction())!==peg$FAILED&&peg$currPos===input.length)return peg$result;throw peg$result!==peg$FAILED&&peg$currPos0){for(i=1,j=1;i1&&void 0!==arguments[1]?arguments[1]:"probability";if(!Array.isArray(options))throw new TypeError("options must be a non-empty array of objects");if("object"!==_typeof(options[0]))throw new TypeError("options must be a non-empty array of objects");for(var rnd=function(cap){return Math.random()*cap}(options.reduce(function(acc,val){return acc+val[probability_property]},0)),cursor=0,cursor_sum=0;(cursor_sum+=options[cursor++][probability_property])<=rnd;);return options[cursor-1]},seq=function(n){return new Array(n).fill(!0).map(function(_,i){return i})},histograph=function(a){return a.sort().reduce(function(m,v){return m.set(v,m.has(v)?m.get(v)+1:1),m},new Map)},sample_select=function(n,options,probability_property){return seq(n).map(function(i){return rand_select(options,probability_property)})},histo_key=function(n,options,probability_property,extract){return histograph(sample_select(n,options,probability_property).map(function(s){return s[extract]}))};exports.seq=seq,exports.histograph=histograph,exports.histo_key=histo_key,exports.rand_select=rand_select,exports.sample_select=sample_select},{}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var viz=function(jssm){var l_states=jssm.states(),node_of=function(state){return"n"+l_states.indexOf(state)},vc=function(col){return jssm._viz_colors[col]||""},strike=[];return'digraph G {\n fontname="helvetica neue";\n style=filled;\n bgcolor=lightgrey;\n node [fontsize=14; shape=box; style=filled; fillcolor=white; fontname="helvetica neue"];\n edge [fontsize=6;fontname="helvetica neue"];\n\n '+l_states.map(function(s){jssm.state_for(s);var terminal=jssm.state_is_terminal(s),final=jssm.state_is_final(s),complete=jssm.state_is_complete(s),features=[["label",s],["peripheries",complete?2:1],["fillcolor",final?vc("fill_final"):complete?vc("fill_complete"):terminal?vc("fill_terminal"):""]].filter(function(r){return r[1]}).map(function(r){return r[0]+'="'+r[1]+'"'}).join(" ");return node_of(s)+" ["+features+"];"}).join(" ")+"\n\n "+jssm.states().map(function(s){return jssm.list_exits(s).map(function(ex){if(strike.find(function(row){return row[0]===s&&row[1]==ex}))return"";var edge=jssm.list_transitions(s,ex),pair=jssm.list_transitions(ex,s),double=pair&&s!==ex,if_obj_field=(jssm.state_for(s),jssm.state_for(ex),function(obj,field){return obj?obj[field]||"":""}),h_final=jssm.state_is_final(s),h_complete=jssm.state_is_complete(s),h_terminal=jssm.state_is_terminal(s),t_final=jssm.state_is_final(ex),t_complete=jssm.state_is_complete(ex),t_terminal=jssm.state_is_terminal(ex),lineColor=function(final,complete,terminal){var _solo_1_2=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"_solo";return vc(final?"line_final"+_solo_1_2:complete?"line_complete"+_solo_1_2:terminal?"line_terminal"+_solo_1_2:"normal_line"+_solo_1_2)},textColor=function(final,complete,terminal){var _solo_1_2=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"_solo";return final?vc("text_final"+_solo_1_2):complete?vc("text_complete"+_solo_1_2):terminal?vc("text_terminal"+_solo_1_2):""},labelInline=[[pair,"probability","headlabel","name","action",double,textColor(h_final,h_complete,h_terminal,double?"_1":"_solo")],[edge,"probability","taillabel","name","action",!0,textColor(t_final,t_complete,t_terminal,double?"_2":"_solo")]].map(function(r){return{which:r[2],whether:r[5]?[if_obj_field(r[0],r[5]),if_obj_field(r[0],r[1]),if_obj_field(r[0],r[3])].filter(function(q){return q}).join("
")||"":"",color:r[6]}}).filter(function(present){return present.whether}).map(function(r){return r.which+"="+(r.color?'<'+r.whether+">":'"'+r.whether+'"')+";"}).join(" "),tc1=lineColor(t_final,t_complete,t_terminal,"_1"),tc2=lineColor(h_final,h_complete,h_terminal,"_2"),tcd=lineColor(t_final,t_complete,t_terminal,"_solo"),edgeInline=edge?double?'dir=both;color="'+tc1+":"+tc2+'"':'color="'+tcd+'"':"";return pair&&strike.push([ex,s]),node_of(s)+"->"+node_of(ex)+" ["+labelInline+edgeInline+"];"}).join(" ")}).join(" ")+"\n}"};exports.viz=viz},{}],jssm:[function(require,module,exports){"use strict";function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i to already exists "+tr.from+" "+tr.to);if(from_mapping.set(tr.to,thisEdgeId),tr.action){_this._actions.has(tr.action)||_this._actions.set(tr.action,new Map);var actionMap=_this._actions.get(tr.action);if(!actionMap)throw new Error("should be impossible, satisfying type checker that doesn't know .set precedes .get. severe error?");if(actionMap.has(tr.from))throw new Error("action "+tr.action+" already attached to origin "+tr.from);actionMap.set(tr.from,thisEdgeId),_this._reverse_actions.has(tr.from)||_this._reverse_actions.set(tr.from,new Map);var rActionMap=_this._reverse_actions.get(tr.from);if(!rActionMap)throw new Error("should be impossible, satisfying type checker that doesn't know .set precedes .get again. severe error?");if(rActionMap.has(tr.action))throw new Error("r-action "+tr.from+" already attached to action "+tr.action);rActionMap.set(tr.action,thisEdgeId),_this._reverse_action_targets.has(tr.to)||_this._reverse_action_targets.set(tr.to,new Map)}})}return _createClass(machine,[{key:"_new_state",value:function(state_config){if(this._states.has(state_config.name))throw new Error("state "+state_config.name+" already exists");return this._states.set(state_config.name,state_config),state_config.name}},{key:"state",value:function(){return this._state}},{key:"is_changing",value:function(){return!0}},{key:"state_is_final",value:function(whichState){return this.state_is_terminal(whichState)&&this.state_is_complete(whichState)}},{key:"is_final",value:function(){return!this.is_changing()&&this.state_is_final(this.state())}},{key:"machine_state",value:function(){return{internal_state_impl_version:1,actions:this._actions,edge_map:this._edge_map,edges:this._edges,named_transitions:this._named_transitions,reverse_actions:this._reverse_actions,state:this._state,states:this._states}}},{key:"load_machine_state",value:function(){return!1}},{key:"states",value:function(){return[].concat(_toConsumableArray(this._states.keys()))}},{key:"state_for",value:function(whichState){var state=this._states.get(whichState);if(state)return state;throw new Error("no such state "+JSON.stringify(state))}},{key:"list_transitions",value:function(){return this._edges}},{key:"list_named_transitions",value:function(){return this._named_transitions}},{key:"list_actions",value:function(){return[].concat(_toConsumableArray(this._actions.keys()))}},{key:"get_transition_by_id",value:function(from,to){return this._edge_map.has(from)?this._edge_map.get(from).get(to):void 0}},{key:"lookup_transition_for",value:function(from,to){var id=this.get_transition_by_id(from,to);return void 0===id?void 0:this._edges[id]}},{key:"list_transitions",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return{entrances:this.list_entrances(whichState),exits:this.list_exits(whichState)}}},{key:"list_entrances",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return(this._states.get(whichState)||{}).from}},{key:"list_exits",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return(this._states.get(whichState)||{}).to}},{key:"probable_exits_for",value:function(whichState){var _this2=this;return(this._states.get(whichState)||{to:[]}).to.map(function(ws){return _this2.lookup_transition_for(_this2.state(),ws)}).filter(function(defined){return defined})||[]}},{key:"probabilistic_transition",value:function(){var selected=(0,_jssmUtil.rand_select)(this.probable_exits_for(this.state()));return this.transition(selected.to)}},{key:"probabilistic_walk",value:function(n){var _this3=this;return(0,_jssmUtil.seq)(n-1).map(function(i){var state_was=_this3.state();return _this3.probabilistic_transition(),state_was}).concat([this.state()])}},{key:"probabilistic_histo_walk",value:function(n){return(0,_jssmUtil.histograph)(this.probabilistic_walk(n))}},{key:"actions",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state(),wstate=this._reverse_actions.get(whichState);if(wstate)return[].concat(_toConsumableArray(wstate.keys()));throw new Error("No such state "+JSON.stringify(whichState))}},{key:"list_states_having_action",value:function(whichState){var wstate=this._actions.get(whichState);if(wstate)return[].concat(_toConsumableArray(wstate.keys()));throw new Error("No such state "+JSON.stringify(whichState))}},{key:"list_exit_actions",value:function(){var _this4=this,whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return[].concat(_toConsumableArray((this._reverse_actions.get(whichState)||new Map).values())).map(function(edgeId){return _this4._edges[edgeId]}).filter(function(o){return o.from===whichState}).map(function(filtered){return filtered.action})}},{key:"probable_action_exits",value:function(){var _this5=this,whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return[].concat(_toConsumableArray((this._reverse_actions.get(whichState)||new Map).values())).map(function(edgeId){return _this5._edges[edgeId]}).filter(function(o){return o.from===whichState}).map(function(filtered){return{action:filtered.action,probability:filtered.probability}})}},{key:"is_unenterable",value:function(whichState){return 0===this.list_entrances(whichState).length}},{key:"has_unenterables",value:function(){return this.states.some(this.is_unenterable)}},{key:"is_terminal",value:function(){return this.state_is_terminal(this.state())}},{key:"state_is_terminal",value:function(whichState){return 0===this.list_exits(whichState).length}},{key:"has_terminals",value:function(){return this.states.some(this.state_is_terminal)}},{key:"is_complete",value:function(){return this.state_is_complete(this.state())}},{key:"state_is_complete",value:function(whichState){var wstate=this._states.get(whichState);if(wstate)return wstate.complete;throw new Error("No such state "+JSON.stringify(whichState))}},{key:"has_completes",value:function(){return this.states.some(this.state_is_complete)}},{key:"action",value:function(name,newData){if(this.valid_action(name,newData)){var edge=this.current_action_edge_for(name);if(!edge)throw new Error("Should be impossible - valid_action true, no edge in current_action_edge_for, in action("+JSON.stringify(name)+"...)");return this._state=edge.to,!0}return!1}},{key:"transition",value:function(newState,newData){return!!this.valid_transition(newState,newData)&&(this._state=newState,!0)}},{key:"force_transition",value:function(newState,newData){return!!this.valid_force_transition(newState,newData)&&(this._state=newState,!0)}},{key:"current_action_for",value:function(action){var action_base=this._actions.get(action);return action_base?action_base.get(this.state()):void 0}},{key:"current_action_edge_for",value:function(action){var idx=this.current_action_for(action);return void 0!==idx?this._edges[idx]:void 0}},{key:"valid_action",value:function(action,newData){return void 0!==this.current_action_for(action)}},{key:"valid_transition",value:function(newState,newData){return void 0!==this.lookup_transition_for(this.state(),newState)}},{key:"valid_force_transition",value:function(newState,newData){return!1}},{key:"viz",value:function(){return(0,_jssmViz.viz)(this)}},{key:"set_viz_colors",value:function(){this._viz_colors={fill_final:"#eeeeff",fill_terminal:"#ffeeee",fill_complete:"#eeffee",normal_line_1:"#999999",normal_line_2:"#888888",normal_line_solo:"#888888",line_final_1:"#8888bb",line_final_2:"#7777aa",line_final_solo:"#7777aa",line_terminal_1:"#bb8888",line_terminal_2:"#aa7777",line_terminal_solo:"#aa7777",line_complete_1:"#88bb88",line_complete_2:"#77aa77",line_complete_solo:"#77aa77",text_final_1:"#000088",text_final_2:"#000088",text_final_solo:"#000088",text_terminal_1:"#880000",text_terminal_2:"#880000",text_terminal_solo:"#880000",text_complete_1:"#007700",text_complete_2:"#007700",text_complete_solo:"#007700"}}}]),machine}();exports.version="2.6.6",exports.machine=machine,exports.parse=parse,exports.seq=_jssmUtil.seq,exports.rand_select=_jssmUtil.rand_select,exports.histograph=_jssmUtil.histograph},{"./jssm-dot.js":1,"./jssm-util.js":2,"./jssm-viz.js":3}]},{},[]); \ No newline at end of file +require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;opeg$maxFailPos&&(peg$maxFailPos=peg$currPos,peg$maxFailExpected=[]),peg$maxFailExpected.push(expected))}function peg$buildStructuredError(expected,found,location){return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected,found),expected,found,location)}function peg$parseDocument(){var s0,s1,s2;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED&&(s2=peg$parseTermList())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c0(s2)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGvizShape(){var s0;return input.substr(peg$currPos,6)===peg$c1?(s0=peg$c1,peg$currPos+=6):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c2)),s0===peg$FAILED&&(input.substr(peg$currPos,9)===peg$c3?(s0=peg$c3,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c4)),s0===peg$FAILED&&(input.substr(peg$currPos,6)===peg$c5?(s0=peg$c5,peg$currPos+=6):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c6)))),s0}function peg$parseForwardArrow(){var s0;return peg$silentFails++,input.substr(peg$currPos,2)===peg$c8?(s0=peg$c8,peg$currPos+=2):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c9)),peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c7)),s0}function peg$parseTwoWayArrow(){var s0;return peg$silentFails++,input.substr(peg$currPos,3)===peg$c11?(s0=peg$c11,peg$currPos+=3):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c12)),peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c10)),s0}function peg$parseArrow(){var s0;return(s0=peg$parseForwardArrow())===peg$FAILED&&(s0=peg$parseTwoWayArrow()),s0}function peg$parseHexDigit(){var s0;return peg$c13.test(input.charAt(peg$currPos))?(s0=input.charAt(peg$currPos),peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c14)),s0}function peg$parseChar(){var s0,s2,s3,s4,s5,s6,s7,s8,s9;return(s0=peg$parseUnescaped())===peg$FAILED&&(s0=peg$currPos,peg$parseEscape()!==peg$FAILED?(34===input.charCodeAt(peg$currPos)?(s2=peg$c15,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c16)),s2===peg$FAILED&&(92===input.charCodeAt(peg$currPos)?(s2=peg$c17,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c18)),s2===peg$FAILED&&(47===input.charCodeAt(peg$currPos)?(s2=peg$c19,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c20)),s2===peg$FAILED&&(s2=peg$currPos,98===input.charCodeAt(peg$currPos)?(s3=peg$c21,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c22)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c23()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,102===input.charCodeAt(peg$currPos)?(s3=peg$c24,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c25)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c26()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,110===input.charCodeAt(peg$currPos)?(s3=peg$c27,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c28)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c29()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,114===input.charCodeAt(peg$currPos)?(s3=peg$c30,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c31)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c32()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,116===input.charCodeAt(peg$currPos)?(s3=peg$c33,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c34)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c35()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,118===input.charCodeAt(peg$currPos)?(s3=peg$c36,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c37)),s3!==peg$FAILED&&(peg$savedPos=s2,s3=peg$c38()),(s2=s3)===peg$FAILED&&(s2=peg$currPos,117===input.charCodeAt(peg$currPos)?(s3=peg$c39,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c40)),s3!==peg$FAILED?(s4=peg$currPos,s5=peg$currPos,(s6=peg$parseHexDigit())!==peg$FAILED&&(s7=peg$parseHexDigit())!==peg$FAILED&&(s8=peg$parseHexDigit())!==peg$FAILED&&(s9=peg$parseHexDigit())!==peg$FAILED?s5=s6=[s6,s7,s8,s9]:(peg$currPos=s5,s5=peg$FAILED),(s4=s5!==peg$FAILED?input.substring(s4,peg$currPos):s5)!==peg$FAILED?(peg$savedPos=s2,s2=s3=peg$c41(s4)):(peg$currPos=s2,s2=peg$FAILED)):(peg$currPos=s2,s2=peg$FAILED)))))))))),s2!==peg$FAILED?(peg$savedPos=s0,s0=peg$c42(s2)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)),s0}function peg$parseEscape(){var s0;return 92===input.charCodeAt(peg$currPos)?(s0=peg$c17,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c18)),s0}function peg$parseQuoteMark(){var s0;return 34===input.charCodeAt(peg$currPos)?(s0=peg$c15,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c16)),s0}function peg$parseUnescaped(){var s0;return peg$c43.test(input.charAt(peg$currPos))?(s0=input.charAt(peg$currPos),peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c44)),s0}function peg$parseWhitespace(){var s0,s1;for(peg$silentFails++,s0=[],peg$c46.test(input.charAt(peg$currPos))?(s1=input.charAt(peg$currPos),peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c47));s1!==peg$FAILED;)s0.push(s1),peg$c46.test(input.charAt(peg$currPos))?(s1=input.charAt(peg$currPos),peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c47));return peg$silentFails--,s0===peg$FAILED&&(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c45)),s0}function peg$parseString(){var s0,s2,s3;if(peg$silentFails++,s0=peg$currPos,peg$parseQuoteMark()!==peg$FAILED){for(s2=[],s3=peg$parseChar();s3!==peg$FAILED;)s2.push(s3),s3=peg$parseChar();s2!==peg$FAILED&&(s3=peg$parseQuoteMark())!==peg$FAILED?(peg$savedPos=s0,s0=peg$c49(s2)):(peg$currPos=s0,s0=peg$FAILED)}else peg$currPos=s0,s0=peg$FAILED;return peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c48)),s0}function peg$parseAtom(){var s0,s1,s2;if(peg$silentFails++,s0=peg$currPos,s1=[],peg$c51.test(input.charAt(peg$currPos))?(s2=input.charAt(peg$currPos),peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c52)),s2!==peg$FAILED)for(;s2!==peg$FAILED;)s1.push(s2),peg$c51.test(input.charAt(peg$currPos))?(s2=input.charAt(peg$currPos),peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c52));else s1=peg$FAILED;return s1!==peg$FAILED&&(peg$savedPos=s0,s1=peg$c53(s1)),s0=s1,peg$silentFails--,s0===peg$FAILED&&(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c50)),s0}function peg$parseLabel(){var s0;return peg$silentFails++,(s0=peg$parseAtom())===peg$FAILED&&(s0=peg$parseString()),peg$silentFails--,s0===peg$FAILED&&(peg$FAILED,0===peg$silentFails&&peg$fail(peg$c54)),s0}function peg$parseValue(){return peg$parseLabel()}function peg$parseItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseLabel(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c55,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s2!==peg$FAILED&&(s3=peg$parseValue())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c57,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c59(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseItems(){var s0,s1;if(s0=[],(s1=peg$parseItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseItem();else s0=peg$FAILED;return s0}function peg$parseArrowDesc(){var s0,s1,s2,s3;return s0=peg$currPos,123===input.charCodeAt(peg$currPos)?(s1=peg$c60,peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s1!==peg$FAILED?((s2=peg$parseItems())===peg$FAILED&&(s2=null),s2!==peg$FAILED?(125===input.charCodeAt(peg$currPos)?(s3=peg$c62,peg$currPos++):(s3=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c63)),s3!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c64(s2)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseSubexp(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?((s2=peg$parseArrowDesc())===peg$FAILED&&(s2=null),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s4=peg$parseArrow())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s6=peg$parseArrowDesc())===peg$FAILED&&(s6=null),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s8=peg$parseLabel())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s10=peg$parseSubexp())===peg$FAILED&&(s10=null),s10!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c65(s2,s4,s6,s8,s10)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseExp(){var s0,s1,s2,s4;return s0=peg$currPos,s1=peg$parseLabel(),s1!==peg$FAILED&&(s2=peg$parseSubexp())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c57,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c66(s1,s2)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseValidationKey(){var s0;return input.substr(peg$currPos,9)===peg$c67?(s0=peg$c67,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c68)),s0===peg$FAILED&&(input.substr(peg$currPos,4)===peg$c69?(s0=peg$c69,peg$currPos+=4):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c70))),s0}function peg$parseValidationItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseValidationKey(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c55,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s2!==peg$FAILED&&(s3=peg$parseValue())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c57,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c71(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseValidationItems(){var s0,s1;if(s0=[],(s1=peg$parseValidationItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseValidationItem();else s0=peg$FAILED;return s0}function peg$parseConfigValidation(){var s0,s1,s2,s4,s6,s7,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,10)===peg$c72?(s2=peg$c72,peg$currPos+=10):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c73)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c60,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s6!==peg$FAILED?((s7=peg$parseValidationItems())===peg$FAILED&&(s7=null),s7!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c74?(s8=peg$c74,peg$currPos+=2):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c75)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c76(s7)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGvizLayout(){var s0;return input.substr(peg$currPos,3)===peg$c77?(s0=peg$c77,peg$currPos+=3):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c78)),s0===peg$FAILED&&(input.substr(peg$currPos,5)===peg$c79?(s0=peg$c79,peg$currPos+=5):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c80))),s0}function peg$parseInShape(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,8)===peg$c81?(s2=peg$c81,peg$currPos+=8):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c82)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c83(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseOutShape(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,9)===peg$c84?(s2=peg$c84,peg$currPos+=9):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c85)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c86(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseNodeShape(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,10)===peg$c87?(s2=peg$c87,peg$currPos+=10):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c88)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c89(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGraphLayout(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,12)===peg$c90?(s2=peg$c90,peg$currPos+=12):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c91)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizLayout())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c92(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseStateItem(){var s0;return(s0=peg$parseInShape())===peg$FAILED&&(s0=peg$parseOutShape())===peg$FAILED&&(s0=peg$parseNodeShape())===peg$FAILED&&(s0=peg$parseGraphLayout()),s0}function peg$parseStateItems(){var s0,s1;if(s0=[],(s1=peg$parseStateItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseStateItem();else s0=peg$FAILED;return s0}function peg$parseConfigState(){var s0,s1,s2,s4,s6,s7,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,5)===peg$c93?(s2=peg$c93,peg$currPos+=5):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c94)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c60,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s6!==peg$FAILED?((s7=peg$parseStateItems())===peg$FAILED&&(s7=null),s7!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c74?(s8=peg$c74,peg$currPos+=2):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c75)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c95(s7)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseActionKey(){var s0;return input.substr(peg$currPos,9)===peg$c67?(s0=peg$c67,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c68)),s0===peg$FAILED&&(input.substr(peg$currPos,4)===peg$c69?(s0=peg$c69,peg$currPos+=4):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c70))),s0}function peg$parseActionItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseActionKey(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c55,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s2!==peg$FAILED&&(s3=peg$parseValue())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c57,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c96(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseActionItems(){var s0,s1;if(s0=[],(s1=peg$parseActionItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseActionItem();else s0=peg$FAILED;return s0}function peg$parseConfigAction(){var s0,s1,s2,s4,s6,s7,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,6)===peg$c97?(s2=peg$c97,peg$currPos+=6):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c98)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c60,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s6!==peg$FAILED?((s7=peg$parseActionItems())===peg$FAILED&&(s7=null),s7!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c74?(s8=peg$c74,peg$currPos+=2):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c75)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c99(s7)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseTransitionKey(){var s0;return input.substr(peg$currPos,9)===peg$c67?(s0=peg$c67,peg$currPos+=9):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c68)),s0===peg$FAILED&&(input.substr(peg$currPos,4)===peg$c69?(s0=peg$c69,peg$currPos+=4):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c70))),s0}function peg$parseTransitionItem(){var s0,s1,s2,s3,s4;return s0=peg$currPos,s1=peg$parseTransitionKey(),s1!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s2=peg$c55,peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s2!==peg$FAILED&&(s3=peg$parseValue())!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s4=peg$c57,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s4!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c100(s1,s3)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseTransitionItems(){var s0,s1;if(s0=[],(s1=peg$parseTransitionItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseTransitionItem();else s0=peg$FAILED;return s0}function peg$parseConfigTransition(){var s0,s1,s2,s4,s6,s7,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,10)===peg$c101?(s2=peg$c101,peg$currPos+=10):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c102)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c60,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s6!==peg$FAILED?((s7=peg$parseTransitionItems())===peg$FAILED&&(s7=null),s7!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c74?(s8=peg$c74,peg$currPos+=2):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c75)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c103(s7)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGraphBg(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,8)===peg$c104?(s2=peg$c104,peg$currPos+=8):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c105)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseGvizShape())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c106(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseMinTransitionsPerState(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,25)===peg$c107?(s2=peg$c107,peg$currPos+=25):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c108)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseLabel())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c109(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseMaxTransitionsPerState(){var s0,s1,s2,s4,s6,s8;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,25)===peg$c110?(s2=peg$c110,peg$currPos+=25):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c111)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED&&(s6=peg$parseLabel())!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(59===input.charCodeAt(peg$currPos)?(s8=peg$c57,peg$currPos++):(s8=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c58)),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c112(s6)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseGraphItem(){var s0;return(s0=peg$parseGraphBg())===peg$FAILED&&(s0=peg$parseMinTransitionsPerState())===peg$FAILED&&(s0=peg$parseMaxTransitionsPerState()),s0}function peg$parseGraphItems(){var s0,s1;if(s0=[],(s1=peg$parseGraphItem())!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),s1=peg$parseGraphItem();else s0=peg$FAILED;return s0}function peg$parseConfigGraph(){var s0,s1,s2,s4,s6,s8,s10;return s0=peg$currPos,s1=peg$parseWhitespace(),s1!==peg$FAILED?(input.substr(peg$currPos,5)===peg$c113?(s2=peg$c113,peg$currPos+=5):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c114)),s2!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(58===input.charCodeAt(peg$currPos)?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c56)),s4!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(123===input.charCodeAt(peg$currPos)?(s6=peg$c60,peg$currPos++):(s6=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c61)),s6!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?((s8=peg$parseGraphItems())===peg$FAILED&&(s8=null),s8!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(input.substr(peg$currPos,2)===peg$c74?(s10=peg$c74,peg$currPos+=2):(s10=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c75)),s10!==peg$FAILED&&peg$parseWhitespace()!==peg$FAILED?(peg$savedPos=s0,s0=s1=peg$c115(s8)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseConfig(){var s0;return(s0=peg$parseConfigGraph())===peg$FAILED&&(s0=peg$parseConfigTransition())===peg$FAILED&&(s0=peg$parseConfigAction())===peg$FAILED&&(s0=peg$parseConfigState())===peg$FAILED&&(s0=peg$parseConfigValidation()),s0}function peg$parseTerm(){var s0;return(s0=peg$parseExp())===peg$FAILED&&(s0=peg$parseConfig()),s0}function peg$parseTermList(){var s0,s1;for(s0=[],s1=peg$parseTerm();s1!==peg$FAILED;)s0.push(s1),s1=peg$parseTerm();return s0}options=void 0!==options?options:{};var peg$result,peg$FAILED={},peg$startRuleFunctions={Document:peg$parseDocument},peg$startRuleFunction=peg$parseDocument,peg$c0=function(e){return e},peg$c1="square",peg$c2=peg$literalExpectation("square",!1),peg$c3="rectangle",peg$c4=peg$literalExpectation("rectangle",!1),peg$c5="circle",peg$c6=peg$literalExpectation("circle",!1),peg$c7=peg$otherExpectation("forward arrow"),peg$c8="->",peg$c9=peg$literalExpectation("->",!1),peg$c10=peg$otherExpectation("two way arrow"),peg$c11="<->",peg$c12=peg$literalExpectation("<->",!1),peg$c13=/^[0-9a-fA-F]/,peg$c14=peg$classExpectation([["0","9"],["a","f"],["A","F"]],!1,!1),peg$c15='"',peg$c16=peg$literalExpectation('"',!1),peg$c17="\\",peg$c18=peg$literalExpectation("\\",!1),peg$c19="/",peg$c20=peg$literalExpectation("/",!1),peg$c21="b",peg$c22=peg$literalExpectation("b",!1),peg$c23=function(){return"\b"},peg$c24="f",peg$c25=peg$literalExpectation("f",!1),peg$c26=function(){return"\f"},peg$c27="n",peg$c28=peg$literalExpectation("n",!1),peg$c29=function(){return"\n"},peg$c30="r",peg$c31=peg$literalExpectation("r",!1),peg$c32=function(){return"\r"},peg$c33="t",peg$c34=peg$literalExpectation("t",!1),peg$c35=function(){return"\t"},peg$c36="v",peg$c37=peg$literalExpectation("v",!1),peg$c38=function(){return"\v"},peg$c39="u",peg$c40=peg$literalExpectation("u",!1),peg$c41=function(digits){return String.fromCharCode(parseInt(digits,16))},peg$c42=function(Sequence){return Sequence},peg$c43=/^[ -!#-[\]-\u10FFFF]/,peg$c44=peg$classExpectation([[" ","!"],["#","["],["]","ჿ"],"F","F"],!1,!1),peg$c45=peg$otherExpectation("whitespace"),peg$c46=/^[ \t\n\r\x0B]/,peg$c47=peg$classExpectation([" ","\t","\n","\r","\v"],!1,!1),peg$c48=peg$otherExpectation("string"),peg$c49=function(chars){return chars.join("")},peg$c50=peg$otherExpectation("atom"),peg$c51=/^[0-9a-zA-Z.+_&()%$#@!?,']/,peg$c52=peg$classExpectation([["0","9"],["a","z"],["A","Z"],".","+","_","&","(",")","%","$","#","@","!","?",",","'"],!1,!1),peg$c53=function(text){return text.join("")},peg$c54=peg$otherExpectation("label"),peg$c55=":",peg$c56=peg$literalExpectation(":",!1),peg$c57=";",peg$c58=peg$literalExpectation(";",!1),peg$c59=function(text,value){return{text:text,value:value}},peg$c60="{",peg$c61=peg$literalExpectation("{",!1),peg$c62="}",peg$c63=peg$literalExpectation("}",!1),peg$c64=function(items){return items},peg$c65=function(ldesc,arrow,rdesc,label,tail){var base={kind:arrow,to:label};return tail&&tail!==[]&&(base.se=tail),ldesc&&(base.ldesc=ldesc),rdesc&&(base.rdesc=rdesc),base},peg$c66=function(label,se){var base={from:label};return se&&se!==[]&&(base.se=se),base},peg$c67="whargarbl",peg$c68=peg$literalExpectation("whargarbl",!1),peg$c69="todo",peg$c70=peg$literalExpectation("todo",!1),peg$c71=function(validationkey,value){return{key:validationkey,value:value}},peg$c72="validation",peg$c73=peg$literalExpectation("validation",!1),peg$c74="};",peg$c75=peg$literalExpectation("};",!1),peg$c76=function(validation_items){return{config_kind:"validation",config_items:validation_items||[]}},peg$c77="dot",peg$c78=peg$literalExpectation("dot",!1),peg$c79="circo",peg$c80=peg$literalExpectation("circo",!1),peg$c81="in_shape",peg$c82=peg$literalExpectation("in_shape",!1),peg$c83=function(value){return{key:"in_shape",value:value}},peg$c84="out_shape",peg$c85=peg$literalExpectation("out_shape",!1),peg$c86=function(value){return{key:"out_shape",value:value}},peg$c87="node_shape",peg$c88=peg$literalExpectation("node_shape",!1),peg$c89=function(value){return{key:"node_shape",value:value}},peg$c90="graph_layout",peg$c91=peg$literalExpectation("graph_layout",!1),peg$c92=function(value){return{key:"graph_layout",value:value}},peg$c93="state",peg$c94=peg$literalExpectation("state",!1),peg$c95=function(state_items){return{config_kind:"state",config_items:state_items||[]}},peg$c96=function(actionkey,value){return{key:actionkey,value:value}},peg$c97="action",peg$c98=peg$literalExpectation("action",!1),peg$c99=function(action_items){return{config_kind:"action",config_items:action_items||[]}},peg$c100=function(transitionkey,value){return{key:transitionkey,value:value}},peg$c101="transition",peg$c102=peg$literalExpectation("transition",!1),peg$c103=function(transition_items){return{config_kind:"transition",config_items:transition_items||[]}},peg$c104="graph_bg",peg$c105=peg$literalExpectation("graph_bg",!1),peg$c106=function(value){return{key:"graph_bg",value:value}},peg$c107="min_transitions_per_state",peg$c108=peg$literalExpectation("min_transitions_per_state",!1),peg$c109=function(value){return{key:"min_transitions_per_state",value:value}},peg$c110="max_transitions_per_state",peg$c111=peg$literalExpectation("max_transitions_per_state",!1),peg$c112=function(value){return{key:"max_transitions_per_state",value:value}},peg$c113="graph",peg$c114=peg$literalExpectation("graph",!1),peg$c115=function(graph_items){return{config_kind:"graph",config_items:graph_items||[]}},peg$currPos=0,peg$savedPos=0,peg$posDetailsCache=[{line:1,column:1}],peg$maxFailPos=0,peg$maxFailExpected=[],peg$silentFails=0;if("startRule"in options){if(!(options.startRule in peg$startRuleFunctions))throw new Error("Can't start parsing from rule \""+options.startRule+'".');peg$startRuleFunction=peg$startRuleFunctions[options.startRule]}if((peg$result=peg$startRuleFunction())!==peg$FAILED&&peg$currPos===input.length)return peg$result;throw peg$result!==peg$FAILED&&peg$currPos0){for(i=1,j=1;i1&&void 0!==arguments[1]?arguments[1]:"probability";if(!Array.isArray(options))throw new TypeError("options must be a non-empty array of objects");if("object"!==_typeof(options[0]))throw new TypeError("options must be a non-empty array of objects");for(var rnd=function(cap){return Math.random()*cap}(options.reduce(function(acc,val){return acc+val[probability_property]},0)),cursor=0,cursor_sum=0;(cursor_sum+=options[cursor++][probability_property])<=rnd;);return options[cursor-1]},seq=function(n){return new Array(n).fill(!0).map(function(_,i){return i})},histograph=function(a){return a.sort().reduce(function(m,v){return m.set(v,m.has(v)?m.get(v)+1:1),m},new Map)},weighted_sample_select=function(n,options,probability_property){return seq(n).map(function(i){return weighted_rand_select(options,probability_property)})},weighted_histo_key=function(n,options,probability_property,extract){return histograph(weighted_sample_select(n,options,probability_property).map(function(s){return s[extract]}))};exports.seq=seq,exports.histograph=histograph,exports.weighted_histo_key=weighted_histo_key,exports.weighted_rand_select=weighted_rand_select,exports.weighted_sample_select=weighted_sample_select},{}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var viz=function(jssm){var l_states=jssm.states(),node_of=function(state){return"n"+l_states.indexOf(state)},vc=function(col){return jssm._viz_colors[col]||""},strike=[];return'digraph G {\n fontname="helvetica neue";\n style=filled;\n bgcolor=lightgrey;\n node [fontsize=14; shape=box; style=filled; fillcolor=white; fontname="helvetica neue"];\n edge [fontsize=6;fontname="helvetica neue"];\n\n '+l_states.map(function(s){jssm.state_for(s);var terminal=jssm.state_is_terminal(s),final=jssm.state_is_final(s),complete=jssm.state_is_complete(s),features=[["label",s],["peripheries",complete?2:1],["fillcolor",final?vc("fill_final"):complete?vc("fill_complete"):terminal?vc("fill_terminal"):""]].filter(function(r){return r[1]}).map(function(r){return r[0]+'="'+r[1]+'"'}).join(" ");return node_of(s)+" ["+features+"];"}).join(" ")+"\n\n "+jssm.states().map(function(s){return jssm.list_exits(s).map(function(ex){if(strike.find(function(row){return row[0]===s&&row[1]==ex}))return"";var edge=jssm.list_transitions(s,ex),pair=jssm.list_transitions(ex,s),double=pair&&s!==ex,if_obj_field=(jssm.state_for(s),jssm.state_for(ex),function(obj,field){return obj?obj[field]||"":""}),h_final=jssm.state_is_final(s),h_complete=jssm.state_is_complete(s),h_terminal=jssm.state_is_terminal(s),t_final=jssm.state_is_final(ex),t_complete=jssm.state_is_complete(ex),t_terminal=jssm.state_is_terminal(ex),lineColor=function(final,complete,terminal){var _solo_1_2=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"_solo";return vc(final?"line_final"+_solo_1_2:complete?"line_complete"+_solo_1_2:terminal?"line_terminal"+_solo_1_2:"normal_line"+_solo_1_2)},textColor=function(final,complete,terminal){var _solo_1_2=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"_solo";return final?vc("text_final"+_solo_1_2):complete?vc("text_complete"+_solo_1_2):terminal?vc("text_terminal"+_solo_1_2):""},labelInline=[[pair,"probability","headlabel","name","action",double,textColor(h_final,h_complete,h_terminal,double?"_1":"_solo")],[edge,"probability","taillabel","name","action",!0,textColor(t_final,t_complete,t_terminal,double?"_2":"_solo")]].map(function(r){return{which:r[2],whether:r[5]?[if_obj_field(r[0],r[5]),if_obj_field(r[0],r[1]),if_obj_field(r[0],r[3])].filter(function(q){return q}).join("
")||"":"",color:r[6]}}).filter(function(present){return present.whether}).map(function(r){return r.which+"="+(r.color?'<'+r.whether+">":'"'+r.whether+'"')+";"}).join(" "),tc1=lineColor(t_final,t_complete,t_terminal,"_1"),tc2=lineColor(h_final,h_complete,h_terminal,"_2"),tcd=lineColor(t_final,t_complete,t_terminal,"_solo"),edgeInline=edge?double?'dir=both;color="'+tc1+":"+tc2+'"':'color="'+tcd+'"':"";return pair&&strike.push([ex,s]),node_of(s)+"->"+node_of(ex)+" ["+labelInline+edgeInline+"];"}).join(" ")}).join(" ")+"\n}"};exports.viz=viz},{}],jssm:[function(require,module,exports){"use strict";function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i to already exists "+tr.from+" "+tr.to);if(from_mapping.set(tr.to,thisEdgeId),tr.action){_this._actions.has(tr.action)||_this._actions.set(tr.action,new Map);var actionMap=_this._actions.get(tr.action);if(!actionMap)throw new Error("should be impossible, satisfying type checker that doesn't know .set precedes .get. severe error?");if(actionMap.has(tr.from))throw new Error("action "+tr.action+" already attached to origin "+tr.from);actionMap.set(tr.from,thisEdgeId),_this._reverse_actions.has(tr.from)||_this._reverse_actions.set(tr.from,new Map);var rActionMap=_this._reverse_actions.get(tr.from);if(!rActionMap)throw new Error("should be impossible, satisfying type checker that doesn't know .set precedes .get again. severe error?");if(rActionMap.has(tr.action))throw new Error("r-action "+tr.from+" already attached to action "+tr.action);rActionMap.set(tr.action,thisEdgeId),_this._reverse_action_targets.has(tr.to)||_this._reverse_action_targets.set(tr.to,new Map)}})}return _createClass(machine,[{key:"_new_state",value:function(state_config){if(this._states.has(state_config.name))throw new Error("state "+state_config.name+" already exists");return this._states.set(state_config.name,state_config),state_config.name}},{key:"state",value:function(){return this._state}},{key:"is_changing",value:function(){return!0}},{key:"state_is_final",value:function(whichState){return this.state_is_terminal(whichState)&&this.state_is_complete(whichState)}},{key:"is_final",value:function(){return!this.is_changing()&&this.state_is_final(this.state())}},{key:"machine_state",value:function(){return{internal_state_impl_version:1,actions:this._actions,edge_map:this._edge_map,edges:this._edges,named_transitions:this._named_transitions,reverse_actions:this._reverse_actions,state:this._state,states:this._states}}},{key:"load_machine_state",value:function(){return!1}},{key:"states",value:function(){return[].concat(_toConsumableArray(this._states.keys()))}},{key:"state_for",value:function(whichState){var state=this._states.get(whichState);if(state)return state;throw new Error("no such state "+JSON.stringify(state))}},{key:"list_transitions",value:function(){return this._edges}},{key:"list_named_transitions",value:function(){return this._named_transitions}},{key:"list_actions",value:function(){return[].concat(_toConsumableArray(this._actions.keys()))}},{key:"get_transition_by_id",value:function(from,to){return this._edge_map.has(from)?this._edge_map.get(from).get(to):void 0}},{key:"lookup_transition_for",value:function(from,to){var id=this.get_transition_by_id(from,to);return void 0===id?void 0:this._edges[id]}},{key:"list_transitions",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return{entrances:this.list_entrances(whichState),exits:this.list_exits(whichState)}}},{key:"list_entrances",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return(this._states.get(whichState)||{}).from}},{key:"list_exits",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return(this._states.get(whichState)||{}).to}},{key:"probable_exits_for",value:function(whichState){var _this2=this;return(this._states.get(whichState)||{to:[]}).to.map(function(ws){return _this2.lookup_transition_for(_this2.state(),ws)}).filter(function(defined){return defined})||[]}},{key:"probabilistic_transition",value:function(){var selected=(0,_jssmUtil.weighted_rand_select)(this.probable_exits_for(this.state()));return this.transition(selected.to)}},{key:"probabilistic_walk",value:function(n){var _this3=this;return(0,_jssmUtil.seq)(n-1).map(function(i){var state_was=_this3.state();return _this3.probabilistic_transition(),state_was}).concat([this.state()])}},{key:"probabilistic_histo_walk",value:function(n){return(0,_jssmUtil.histograph)(this.probabilistic_walk(n))}},{key:"actions",value:function(){var whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state(),wstate=this._reverse_actions.get(whichState);if(wstate)return[].concat(_toConsumableArray(wstate.keys()));throw new Error("No such state "+JSON.stringify(whichState))}},{key:"list_states_having_action",value:function(whichState){var wstate=this._actions.get(whichState);if(wstate)return[].concat(_toConsumableArray(wstate.keys()));throw new Error("No such state "+JSON.stringify(whichState))}},{key:"list_exit_actions",value:function(){var _this4=this,whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return[].concat(_toConsumableArray((this._reverse_actions.get(whichState)||new Map).values())).map(function(edgeId){return _this4._edges[edgeId]}).filter(function(o){return o.from===whichState}).map(function(filtered){return filtered.action})}},{key:"probable_action_exits",value:function(){var _this5=this,whichState=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state();return[].concat(_toConsumableArray((this._reverse_actions.get(whichState)||new Map).values())).map(function(edgeId){return _this5._edges[edgeId]}).filter(function(o){return o.from===whichState}).map(function(filtered){return{action:filtered.action,probability:filtered.probability}})}},{key:"is_unenterable",value:function(whichState){return 0===this.list_entrances(whichState).length}},{key:"has_unenterables",value:function(){return this.states.some(this.is_unenterable)}},{key:"is_terminal",value:function(){return this.state_is_terminal(this.state())}},{key:"state_is_terminal",value:function(whichState){return 0===this.list_exits(whichState).length}},{key:"has_terminals",value:function(){return this.states.some(this.state_is_terminal)}},{key:"is_complete",value:function(){return this.state_is_complete(this.state())}},{key:"state_is_complete",value:function(whichState){var wstate=this._states.get(whichState);if(wstate)return wstate.complete;throw new Error("No such state "+JSON.stringify(whichState))}},{key:"has_completes",value:function(){return this.states.some(this.state_is_complete)}},{key:"action",value:function(name,newData){if(this.valid_action(name,newData)){var edge=this.current_action_edge_for(name);if(!edge)throw new Error("Should be impossible - valid_action true, no edge in current_action_edge_for, in action("+JSON.stringify(name)+"...)");return this._state=edge.to,!0}return!1}},{key:"transition",value:function(newState,newData){return!!this.valid_transition(newState,newData)&&(this._state=newState,!0)}},{key:"force_transition",value:function(newState,newData){return!!this.valid_force_transition(newState,newData)&&(this._state=newState,!0)}},{key:"current_action_for",value:function(action){var action_base=this._actions.get(action);return action_base?action_base.get(this.state()):void 0}},{key:"current_action_edge_for",value:function(action){var idx=this.current_action_for(action);return void 0!==idx?this._edges[idx]:void 0}},{key:"valid_action",value:function(action,newData){return void 0!==this.current_action_for(action)}},{key:"valid_transition",value:function(newState,newData){return void 0!==this.lookup_transition_for(this.state(),newState)}},{key:"valid_force_transition",value:function(newState,newData){return!1}},{key:"viz",value:function(){return(0,_jssmViz.viz)(this)}},{key:"set_viz_colors",value:function(){this._viz_colors={fill_final:"#eeeeff",fill_terminal:"#ffeeee",fill_complete:"#eeffee",normal_line_1:"#999999",normal_line_2:"#888888",normal_line_solo:"#888888",line_final_1:"#8888bb",line_final_2:"#7777aa",line_final_solo:"#7777aa",line_terminal_1:"#bb8888",line_terminal_2:"#aa7777",line_terminal_solo:"#aa7777",line_complete_1:"#88bb88",line_complete_2:"#77aa77",line_complete_solo:"#77aa77",text_final_1:"#000088",text_final_2:"#000088",text_final_solo:"#000088",text_terminal_1:"#880000",text_terminal_2:"#880000",text_terminal_solo:"#880000",text_complete_1:"#007700",text_complete_2:"#007700",text_complete_solo:"#007700"}}}]),machine}();exports.version="2.6.6",exports.machine=machine,exports.parse=parse,exports.seq=_jssmUtil.seq,exports.weighted_rand_select=_jssmUtil.weighted_rand_select,exports.histograph=_jssmUtil.histograph},{"./jssm-dot.js":1,"./jssm-util.js":2,"./jssm-viz.js":3}]},{},[]); \ No newline at end of file diff --git a/docs/lib/assets/anchor.js b/docs/lib/assets/anchor.js new file mode 100644 index 00000000..476a8f9a --- /dev/null +++ b/docs/lib/assets/anchor.js @@ -0,0 +1,198 @@ +/*! + * AnchorJS - v1.2.1 - 2015-07-02 + * https://github.com/bryanbraun/anchorjs + * Copyright (c) 2015 Bryan Braun; Licensed MIT + */ + +function AnchorJS(options) { + 'use strict'; + this.options = options || {}; + + this._applyRemainingDefaultOptions = function(opts) { + this.options.icon = this.options.hasOwnProperty('icon') + ? opts.icon + : '\ue9cb'; // Accepts characters (and also URLs?), like '#', '¶', '❡', or '§'. + this.options.visible = this.options.hasOwnProperty('visible') + ? opts.visible + : 'hover'; // Also accepts 'always' + this.options.placement = this.options.hasOwnProperty('placement') + ? opts.placement + : 'right'; // Also accepts 'left' + this.options.class = this.options.hasOwnProperty('class') ? opts.class : ''; // Accepts any class name. + }; + + this._applyRemainingDefaultOptions(options); + + this.add = function(selector) { + var elements, + elsWithIds, + idList, + elementID, + i, + roughText, + tidyText, + index, + count, + newTidyText, + readableID, + anchor; + + this._applyRemainingDefaultOptions(this.options); + + // Provide a sensible default selector, if none is given. + if (!selector) { + selector = 'h1, h2, h3, h4, h5, h6'; + } else if (typeof selector !== 'string') { + throw new Error('The selector provided to AnchorJS was invalid.'); + } + + elements = document.querySelectorAll(selector); + if (elements.length === 0) { + return false; + } + + this._addBaselineStyles(); + + // We produce a list of existing IDs so we don't generate a duplicate. + elsWithIds = document.querySelectorAll('[id]'); + idList = [].map.call(elsWithIds, function assign(el) { + return el.id; + }); + + for (i = 0; i < elements.length; i++) { + if (elements[i].hasAttribute('id')) { + elementID = elements[i].getAttribute('id'); + } else { + roughText = elements[i].textContent; + + // Refine it so it makes a good ID. Strip out non-safe characters, replace + // spaces with hyphens, truncate to 32 characters, and make toLowerCase. + // + // Example string: // '⚡⚡⚡ Unicode icons are cool--but they definitely don't belong in a URL fragment.' + tidyText = roughText + .replace(/[^\w\s-]/gi, '') // ' Unicode icons are cool--but they definitely dont belong in a URL fragment' + .replace(/\s+/g, '-') // '-Unicode-icons-are-cool--but-they-definitely-dont-belong-in-a-URL-fragment' + .replace(/-{2,}/g, '-') // '-Unicode-icons-are-cool-but-they-definitely-dont-belong-in-a-URL-fragment' + .substring(0, 64) // '-Unicode-icons-are-cool-but-they-definitely-dont-belong-in-a-URL' + .replace(/^-+|-+$/gm, '') // 'Unicode-icons-are-cool-but-they-definitely-dont-belong-in-a-URL' + .toLowerCase(); // 'unicode-icons-are-cool-but-they-definitely-dont-belong-in-a-url' + + // Compare our generated ID to existing IDs (and increment it if needed) + // before we add it to the page. + newTidyText = tidyText; + count = 0; + do { + if (index !== undefined) { + newTidyText = tidyText + '-' + count; + } + // .indexOf is supported in IE9+. + index = idList.indexOf(newTidyText); + count += 1; + } while (index !== -1); + index = undefined; + idList.push(newTidyText); + + // Assign it to our element. + // Currently the setAttribute element is only supported in IE9 and above. + elements[i].setAttribute('id', newTidyText); + + elementID = newTidyText; + } + + readableID = elementID.replace(/-/g, ' '); + + // The following code builds the following DOM structure in a more effiecient (albeit opaque) way. + // ''; + anchor = document.createElement('a'); + anchor.className = 'anchorjs-link ' + this.options.class; + anchor.href = '#' + elementID; + anchor.setAttribute('aria-label', 'Anchor link for: ' + readableID); + anchor.setAttribute('data-anchorjs-icon', this.options.icon); + + if (this.options.visible === 'always') { + anchor.style.opacity = '1'; + } + + if (this.options.icon === '\ue9cb') { + anchor.style.fontFamily = 'anchorjs-icons'; + anchor.style.fontStyle = 'normal'; + anchor.style.fontVariant = 'normal'; + anchor.style.fontWeight = 'normal'; + anchor.style.lineHeight = 1; + } + + if (this.options.placement === 'left') { + anchor.style.position = 'absolute'; + anchor.style.marginLeft = '-1em'; + anchor.style.paddingRight = '0.5em'; + elements[i].insertBefore(anchor, elements[i].firstChild); + } else { + // if the option provided is `right` (or anything else). + anchor.style.paddingLeft = '0.375em'; + elements[i].appendChild(anchor); + } + } + + return this; + }; + + this.remove = function(selector) { + var domAnchor, elements = document.querySelectorAll(selector); + for (var i = 0; i < elements.length; i++) { + domAnchor = elements[i].querySelector('.anchorjs-link'); + if (domAnchor) { + elements[i].removeChild(domAnchor); + } + } + return this; + }; + + this._addBaselineStyles = function() { + // We don't want to add global baseline styles if they've been added before. + if (document.head.querySelector('style.anchorjs') !== null) { + return; + } + + var style = document.createElement('style'), + linkRule = ' .anchorjs-link {' + + ' opacity: 0;' + + ' text-decoration: none;' + + ' -webkit-font-smoothing: antialiased;' + + ' -moz-osx-font-smoothing: grayscale;' + + ' }', + hoverRule = ' *:hover > .anchorjs-link,' + + ' .anchorjs-link:focus {' + + ' opacity: 1;' + + ' }', + anchorjsLinkFontFace = ' @font-face {' + + ' font-family: "anchorjs-icons";' + + ' font-style: normal;' + + ' font-weight: normal;' + // Icon from icomoon; 10px wide & 10px tall; 2 empty below & 4 above + ' src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBTUAAAC8AAAAYGNtYXAWi9QdAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5Zgq29TcAAAF4AAABNGhlYWQEZM3pAAACrAAAADZoaGVhBhUDxgAAAuQAAAAkaG10eASAADEAAAMIAAAAFGxvY2EAKACuAAADHAAAAAxtYXhwAAgAVwAAAygAAAAgbmFtZQ5yJ3cAAANIAAAB2nBvc3QAAwAAAAAFJAAAACAAAwJAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpywPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6cv//f//AAAAAAAg6cv//f//AAH/4xY5AAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAACADEARAJTAsAAKwBUAAABIiYnJjQ/AT4BMzIWFxYUDwEGIicmND8BNjQnLgEjIgYPAQYUFxYUBw4BIwciJicmND8BNjIXFhQPAQYUFx4BMzI2PwE2NCcmNDc2MhcWFA8BDgEjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAEAAAABAACiToc1Xw889QALBAAAAAAA0XnFFgAAAADRecUWAAAAAAJTAsAAAAAIAAIAAAAAAAAAAQAAA8D/wAAABAAAAAAAAlMAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAACAAAAAoAAMQAAAAAACgAUAB4AmgABAAAABQBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIABwCfAAEAAAAAAAMADgBLAAEAAAAAAAQADgC0AAEAAAAAAAUACwAqAAEAAAAAAAYADgB1AAEAAAAAAAoAGgDeAAMAAQQJAAEAHAAOAAMAAQQJAAIADgCmAAMAAQQJAAMAHABZAAMAAQQJAAQAHADCAAMAAQQJAAUAFgA1AAMAAQQJAAYAHACDAAMAAQQJAAoANAD4YW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzUmVndWxhcgBSAGUAZwB1AGwAYQByYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("truetype");' + + ' }', + pseudoElContent = ' [data-anchorjs-icon]::after {' + + ' content: attr(data-anchorjs-icon);' + + ' }', + firstStyleEl; + + style.className = 'anchorjs'; + style.appendChild(document.createTextNode('')); // Necessary for Webkit. + + // We place it in the head with the other style tags, if possible, so as to + // not look out of place. We insert before the others so these styles can be + // overridden if necessary. + firstStyleEl = document.head.querySelector('[rel="stylesheet"], style'); + if (firstStyleEl === undefined) { + document.head.appendChild(style); + } else { + document.head.insertBefore(style, firstStyleEl); + } + + style.sheet.insertRule(linkRule, style.sheet.cssRules.length); + style.sheet.insertRule(hoverRule, style.sheet.cssRules.length); + style.sheet.insertRule(pseudoElContent, style.sheet.cssRules.length); + style.sheet.insertRule(anchorjsLinkFontFace, style.sheet.cssRules.length); + }; +} + +var anchors = new AnchorJS(); diff --git a/docs/lib/assets/bass-addons.css b/docs/lib/assets/bass-addons.css new file mode 100644 index 00000000..c27e96d8 --- /dev/null +++ b/docs/lib/assets/bass-addons.css @@ -0,0 +1,12 @@ +.input { + font-family: inherit; + display: block; + width: 100%; + height: 2rem; + padding: .5rem; + margin-bottom: 1rem; + border: 1px solid #ccc; + font-size: .875rem; + border-radius: 3px; + box-sizing: border-box; +} diff --git a/docs/lib/assets/bass.css b/docs/lib/assets/bass.css new file mode 100644 index 00000000..15e0dc9a --- /dev/null +++ b/docs/lib/assets/bass.css @@ -0,0 +1,543 @@ +/*! Basscss | http://basscss.com | MIT License */ + +.h1{ font-size: 2rem } +.h2{ font-size: 1.5rem } +.h3{ font-size: 1.25rem } +.h4{ font-size: 1rem } +.h5{ font-size: .875rem } +.h6{ font-size: .75rem } + +.font-family-inherit{ font-family:inherit } +.font-size-inherit{ font-size:inherit } +.text-decoration-none{ text-decoration:none } + +.bold{ font-weight: bold; font-weight: bold } +.regular{ font-weight:normal } +.italic{ font-style:italic } +.caps{ text-transform:uppercase; letter-spacing: .2em; } + +.left-align{ text-align:left } +.center{ text-align:center } +.right-align{ text-align:right } +.justify{ text-align:justify } + +.nowrap{ white-space:nowrap } +.break-word{ word-wrap:break-word } + +.line-height-1{ line-height: 1 } +.line-height-2{ line-height: 1.125 } +.line-height-3{ line-height: 1.25 } +.line-height-4{ line-height: 1.5 } + +.list-style-none{ list-style:none } +.underline{ text-decoration:underline } + +.truncate{ + max-width:100%; + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap; +} + +.list-reset{ + list-style:none; + padding-left:0; +} + +.inline{ display:inline } +.block{ display:block } +.inline-block{ display:inline-block } +.table{ display:table } +.table-cell{ display:table-cell } + +.overflow-hidden{ overflow:hidden } +.overflow-scroll{ overflow:scroll } +.overflow-auto{ overflow:auto } + +.clearfix:before, +.clearfix:after{ + content:" "; + display:table +} +.clearfix:after{ clear:both } + +.left{ float:left } +.right{ float:right } + +.fit{ max-width:100% } + +.max-width-1{ max-width: 24rem } +.max-width-2{ max-width: 32rem } +.max-width-3{ max-width: 48rem } +.max-width-4{ max-width: 64rem } + +.border-box{ box-sizing:border-box } + +.align-baseline{ vertical-align:baseline } +.align-top{ vertical-align:top } +.align-middle{ vertical-align:middle } +.align-bottom{ vertical-align:bottom } + +.m0{ margin:0 } +.mt0{ margin-top:0 } +.mr0{ margin-right:0 } +.mb0{ margin-bottom:0 } +.ml0{ margin-left:0 } +.mx0{ margin-left:0; margin-right:0 } +.my0{ margin-top:0; margin-bottom:0 } + +.m1{ margin: .5rem } +.mt1{ margin-top: .5rem } +.mr1{ margin-right: .5rem } +.mb1{ margin-bottom: .5rem } +.ml1{ margin-left: .5rem } +.mx1{ margin-left: .5rem; margin-right: .5rem } +.my1{ margin-top: .5rem; margin-bottom: .5rem } + +.m2{ margin: 1rem } +.mt2{ margin-top: 1rem } +.mr2{ margin-right: 1rem } +.mb2{ margin-bottom: 1rem } +.ml2{ margin-left: 1rem } +.mx2{ margin-left: 1rem; margin-right: 1rem } +.my2{ margin-top: 1rem; margin-bottom: 1rem } + +.m3{ margin: 2rem } +.mt3{ margin-top: 2rem } +.mr3{ margin-right: 2rem } +.mb3{ margin-bottom: 2rem } +.ml3{ margin-left: 2rem } +.mx3{ margin-left: 2rem; margin-right: 2rem } +.my3{ margin-top: 2rem; margin-bottom: 2rem } + +.m4{ margin: 4rem } +.mt4{ margin-top: 4rem } +.mr4{ margin-right: 4rem } +.mb4{ margin-bottom: 4rem } +.ml4{ margin-left: 4rem } +.mx4{ margin-left: 4rem; margin-right: 4rem } +.my4{ margin-top: 4rem; margin-bottom: 4rem } + +.mxn1{ margin-left: -.5rem; margin-right: -.5rem; } +.mxn2{ margin-left: -1rem; margin-right: -1rem; } +.mxn3{ margin-left: -2rem; margin-right: -2rem; } +.mxn4{ margin-left: -4rem; margin-right: -4rem; } + +.ml-auto{ margin-left:auto } +.mr-auto{ margin-right:auto } +.mx-auto{ margin-left:auto; margin-right:auto; } + +.p0{ padding:0 } +.pt0{ padding-top:0 } +.pr0{ padding-right:0 } +.pb0{ padding-bottom:0 } +.pl0{ padding-left:0 } +.px0{ padding-left:0; padding-right:0 } +.py0{ padding-top:0; padding-bottom:0 } + +.p1{ padding: .5rem } +.pt1{ padding-top: .5rem } +.pr1{ padding-right: .5rem } +.pb1{ padding-bottom: .5rem } +.pl1{ padding-left: .5rem } +.py1{ padding-top: .5rem; padding-bottom: .5rem } +.px1{ padding-left: .5rem; padding-right: .5rem } + +.p2{ padding: 1rem } +.pt2{ padding-top: 1rem } +.pr2{ padding-right: 1rem } +.pb2{ padding-bottom: 1rem } +.pl2{ padding-left: 1rem } +.py2{ padding-top: 1rem; padding-bottom: 1rem } +.px2{ padding-left: 1rem; padding-right: 1rem } + +.p3{ padding: 2rem } +.pt3{ padding-top: 2rem } +.pr3{ padding-right: 2rem } +.pb3{ padding-bottom: 2rem } +.pl3{ padding-left: 2rem } +.py3{ padding-top: 2rem; padding-bottom: 2rem } +.px3{ padding-left: 2rem; padding-right: 2rem } + +.p4{ padding: 4rem } +.pt4{ padding-top: 4rem } +.pr4{ padding-right: 4rem } +.pb4{ padding-bottom: 4rem } +.pl4{ padding-left: 4rem } +.py4{ padding-top: 4rem; padding-bottom: 4rem } +.px4{ padding-left: 4rem; padding-right: 4rem } + +.col{ + float:left; + box-sizing:border-box; +} + +.col-right{ + float:right; + box-sizing:border-box; +} + +.col-1{ + width:8.33333%; +} + +.col-2{ + width:16.66667%; +} + +.col-3{ + width:25%; +} + +.col-4{ + width:33.33333%; +} + +.col-5{ + width:41.66667%; +} + +.col-6{ + width:50%; +} + +.col-7{ + width:58.33333%; +} + +.col-8{ + width:66.66667%; +} + +.col-9{ + width:75%; +} + +.col-10{ + width:83.33333%; +} + +.col-11{ + width:91.66667%; +} + +.col-12{ + width:100%; +} +@media (min-width: 40em){ + + .sm-col{ + float:left; + box-sizing:border-box; + } + + .sm-col-right{ + float:right; + box-sizing:border-box; + } + + .sm-col-1{ + width:8.33333%; + } + + .sm-col-2{ + width:16.66667%; + } + + .sm-col-3{ + width:25%; + } + + .sm-col-4{ + width:33.33333%; + } + + .sm-col-5{ + width:41.66667%; + } + + .sm-col-6{ + width:50%; + } + + .sm-col-7{ + width:58.33333%; + } + + .sm-col-8{ + width:66.66667%; + } + + .sm-col-9{ + width:75%; + } + + .sm-col-10{ + width:83.33333%; + } + + .sm-col-11{ + width:91.66667%; + } + + .sm-col-12{ + width:100%; + } + +} +@media (min-width: 52em){ + + .md-col{ + float:left; + box-sizing:border-box; + } + + .md-col-right{ + float:right; + box-sizing:border-box; + } + + .md-col-1{ + width:8.33333%; + } + + .md-col-2{ + width:16.66667%; + } + + .md-col-3{ + width:25%; + } + + .md-col-4{ + width:33.33333%; + } + + .md-col-5{ + width:41.66667%; + } + + .md-col-6{ + width:50%; + } + + .md-col-7{ + width:58.33333%; + } + + .md-col-8{ + width:66.66667%; + } + + .md-col-9{ + width:75%; + } + + .md-col-10{ + width:83.33333%; + } + + .md-col-11{ + width:91.66667%; + } + + .md-col-12{ + width:100%; + } + +} +@media (min-width: 64em){ + + .lg-col{ + float:left; + box-sizing:border-box; + } + + .lg-col-right{ + float:right; + box-sizing:border-box; + } + + .lg-col-1{ + width:8.33333%; + } + + .lg-col-2{ + width:16.66667%; + } + + .lg-col-3{ + width:25%; + } + + .lg-col-4{ + width:33.33333%; + } + + .lg-col-5{ + width:41.66667%; + } + + .lg-col-6{ + width:50%; + } + + .lg-col-7{ + width:58.33333%; + } + + .lg-col-8{ + width:66.66667%; + } + + .lg-col-9{ + width:75%; + } + + .lg-col-10{ + width:83.33333%; + } + + .lg-col-11{ + width:91.66667%; + } + + .lg-col-12{ + width:100%; + } + +} +.flex{ display:-webkit-box; display:-webkit-flex; display:-ms-flexbox; display:flex } + +@media (min-width: 40em){ + .sm-flex{ display:-webkit-box; display:-webkit-flex; display:-ms-flexbox; display:flex } +} + +@media (min-width: 52em){ + .md-flex{ display:-webkit-box; display:-webkit-flex; display:-ms-flexbox; display:flex } +} + +@media (min-width: 64em){ + .lg-flex{ display:-webkit-box; display:-webkit-flex; display:-ms-flexbox; display:flex } +} + +.flex-column{ -webkit-box-orient:vertical; -webkit-box-direction:normal; -webkit-flex-direction:column; -ms-flex-direction:column; flex-direction:column } +.flex-wrap{ -webkit-flex-wrap:wrap; -ms-flex-wrap:wrap; flex-wrap:wrap } + +.items-start{ -webkit-box-align:start; -webkit-align-items:flex-start; -ms-flex-align:start; -ms-grid-row-align:flex-start; align-items:flex-start } +.items-end{ -webkit-box-align:end; -webkit-align-items:flex-end; -ms-flex-align:end; -ms-grid-row-align:flex-end; align-items:flex-end } +.items-center{ -webkit-box-align:center; -webkit-align-items:center; -ms-flex-align:center; -ms-grid-row-align:center; align-items:center } +.items-baseline{ -webkit-box-align:baseline; -webkit-align-items:baseline; -ms-flex-align:baseline; -ms-grid-row-align:baseline; align-items:baseline } +.items-stretch{ -webkit-box-align:stretch; -webkit-align-items:stretch; -ms-flex-align:stretch; -ms-grid-row-align:stretch; align-items:stretch } + +.self-start{ -webkit-align-self:flex-start; -ms-flex-item-align:start; align-self:flex-start } +.self-end{ -webkit-align-self:flex-end; -ms-flex-item-align:end; align-self:flex-end } +.self-center{ -webkit-align-self:center; -ms-flex-item-align:center; align-self:center } +.self-baseline{ -webkit-align-self:baseline; -ms-flex-item-align:baseline; align-self:baseline } +.self-stretch{ -webkit-align-self:stretch; -ms-flex-item-align:stretch; align-self:stretch } + +.justify-start{ -webkit-box-pack:start; -webkit-justify-content:flex-start; -ms-flex-pack:start; justify-content:flex-start } +.justify-end{ -webkit-box-pack:end; -webkit-justify-content:flex-end; -ms-flex-pack:end; justify-content:flex-end } +.justify-center{ -webkit-box-pack:center; -webkit-justify-content:center; -ms-flex-pack:center; justify-content:center } +.justify-between{ -webkit-box-pack:justify; -webkit-justify-content:space-between; -ms-flex-pack:justify; justify-content:space-between } +.justify-around{ -webkit-justify-content:space-around; -ms-flex-pack:distribute; justify-content:space-around } + +.content-start{ -webkit-align-content:flex-start; -ms-flex-line-pack:start; align-content:flex-start } +.content-end{ -webkit-align-content:flex-end; -ms-flex-line-pack:end; align-content:flex-end } +.content-center{ -webkit-align-content:center; -ms-flex-line-pack:center; align-content:center } +.content-between{ -webkit-align-content:space-between; -ms-flex-line-pack:justify; align-content:space-between } +.content-around{ -webkit-align-content:space-around; -ms-flex-line-pack:distribute; align-content:space-around } +.content-stretch{ -webkit-align-content:stretch; -ms-flex-line-pack:stretch; align-content:stretch } +.flex-auto{ + -webkit-box-flex:1; + -webkit-flex:1 1 auto; + -ms-flex:1 1 auto; + flex:1 1 auto; + min-width:0; + min-height:0; +} +.flex-none{ -webkit-box-flex:0; -webkit-flex:none; -ms-flex:none; flex:none } + +.order-0{ -webkit-box-ordinal-group:1; -webkit-order:0; -ms-flex-order:0; order:0 } +.order-1{ -webkit-box-ordinal-group:2; -webkit-order:1; -ms-flex-order:1; order:1 } +.order-2{ -webkit-box-ordinal-group:3; -webkit-order:2; -ms-flex-order:2; order:2 } +.order-3{ -webkit-box-ordinal-group:4; -webkit-order:3; -ms-flex-order:3; order:3 } +.order-last{ -webkit-box-ordinal-group:100000; -webkit-order:99999; -ms-flex-order:99999; order:99999 } + +.relative{ position:relative } +.absolute{ position:absolute } +.fixed{ position:fixed } + +.top-0{ top:0 } +.right-0{ right:0 } +.bottom-0{ bottom:0 } +.left-0{ left:0 } + +.z1{ z-index: 1 } +.z2{ z-index: 2 } +.z3{ z-index: 3 } +.z4{ z-index: 4 } + +.border{ + border-style:solid; + border-width: 1px; +} + +.border-top{ + border-top-style:solid; + border-top-width: 1px; +} + +.border-right{ + border-right-style:solid; + border-right-width: 1px; +} + +.border-bottom{ + border-bottom-style:solid; + border-bottom-width: 1px; +} + +.border-left{ + border-left-style:solid; + border-left-width: 1px; +} + +.border-none{ border:0 } + +.rounded{ border-radius: 3px } +.circle{ border-radius:50% } + +.rounded-top{ border-radius: 3px 3px 0 0 } +.rounded-right{ border-radius: 0 3px 3px 0 } +.rounded-bottom{ border-radius: 0 0 3px 3px } +.rounded-left{ border-radius: 3px 0 0 3px } + +.not-rounded{ border-radius:0 } + +.hide{ + position:absolute !important; + height:1px; + width:1px; + overflow:hidden; + clip:rect(1px, 1px, 1px, 1px); +} + +@media (max-width: 40em){ + .xs-hide{ display:none !important } +} + +@media (min-width: 40em) and (max-width: 52em){ + .sm-hide{ display:none !important } +} + +@media (min-width: 52em) and (max-width: 64em){ + .md-hide{ display:none !important } +} + +@media (min-width: 64em){ + .lg-hide{ display:none !important } +} + +.display-none{ display:none !important } + diff --git a/docs/lib/assets/fonts/EOT/SourceCodePro-Bold.eot b/docs/lib/assets/fonts/EOT/SourceCodePro-Bold.eot new file mode 100755 index 00000000..d24cc39f Binary files /dev/null and b/docs/lib/assets/fonts/EOT/SourceCodePro-Bold.eot differ diff --git a/docs/lib/assets/fonts/EOT/SourceCodePro-Regular.eot b/docs/lib/assets/fonts/EOT/SourceCodePro-Regular.eot new file mode 100755 index 00000000..09e94730 Binary files /dev/null and b/docs/lib/assets/fonts/EOT/SourceCodePro-Regular.eot differ diff --git a/docs/lib/assets/fonts/LICENSE.txt b/docs/lib/assets/fonts/LICENSE.txt new file mode 100755 index 00000000..d154618a --- /dev/null +++ b/docs/lib/assets/fonts/LICENSE.txt @@ -0,0 +1,93 @@ +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/docs/lib/assets/fonts/OTF/SourceCodePro-Bold.otf b/docs/lib/assets/fonts/OTF/SourceCodePro-Bold.otf new file mode 100755 index 00000000..f4e576ce Binary files /dev/null and b/docs/lib/assets/fonts/OTF/SourceCodePro-Bold.otf differ diff --git a/docs/lib/assets/fonts/OTF/SourceCodePro-Regular.otf b/docs/lib/assets/fonts/OTF/SourceCodePro-Regular.otf new file mode 100755 index 00000000..4e3b9d0b Binary files /dev/null and b/docs/lib/assets/fonts/OTF/SourceCodePro-Regular.otf differ diff --git a/docs/lib/assets/fonts/TTF/SourceCodePro-Bold.ttf b/docs/lib/assets/fonts/TTF/SourceCodePro-Bold.ttf new file mode 100755 index 00000000..e0c576f1 Binary files /dev/null and b/docs/lib/assets/fonts/TTF/SourceCodePro-Bold.ttf differ diff --git a/docs/lib/assets/fonts/TTF/SourceCodePro-Regular.ttf b/docs/lib/assets/fonts/TTF/SourceCodePro-Regular.ttf new file mode 100755 index 00000000..437f4728 Binary files /dev/null and b/docs/lib/assets/fonts/TTF/SourceCodePro-Regular.ttf differ diff --git a/docs/lib/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff b/docs/lib/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff new file mode 100755 index 00000000..cf960992 Binary files /dev/null and b/docs/lib/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff differ diff --git a/docs/lib/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff b/docs/lib/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff new file mode 100755 index 00000000..395436eb Binary files /dev/null and b/docs/lib/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff differ diff --git a/docs/lib/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff b/docs/lib/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff new file mode 100755 index 00000000..c65ba841 Binary files /dev/null and b/docs/lib/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff differ diff --git a/docs/lib/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff b/docs/lib/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff new file mode 100755 index 00000000..0af792a1 Binary files /dev/null and b/docs/lib/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff differ diff --git a/docs/lib/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2 b/docs/lib/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2 new file mode 100755 index 00000000..cbe38353 Binary files /dev/null and b/docs/lib/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2 differ diff --git a/docs/lib/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2 b/docs/lib/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2 new file mode 100755 index 00000000..65cd591b Binary files /dev/null and b/docs/lib/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2 differ diff --git a/docs/lib/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2 b/docs/lib/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2 new file mode 100755 index 00000000..b78d5235 Binary files /dev/null and b/docs/lib/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2 differ diff --git a/docs/lib/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2 b/docs/lib/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2 new file mode 100755 index 00000000..18d2199e Binary files /dev/null and b/docs/lib/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2 differ diff --git a/docs/lib/assets/fonts/source-code-pro.css b/docs/lib/assets/fonts/source-code-pro.css new file mode 100755 index 00000000..3abb4f09 --- /dev/null +++ b/docs/lib/assets/fonts/source-code-pro.css @@ -0,0 +1,23 @@ +@font-face{ + font-family: 'Source Code Pro'; + font-weight: 400; + font-style: normal; + font-stretch: normal; + src: url('EOT/SourceCodePro-Regular.eot') format('embedded-opentype'), + url('WOFF2/TTF/SourceCodePro-Regular.ttf.woff2') format('woff2'), + url('WOFF/OTF/SourceCodePro-Regular.otf.woff') format('woff'), + url('OTF/SourceCodePro-Regular.otf') format('opentype'), + url('TTF/SourceCodePro-Regular.ttf') format('truetype'); +} + +@font-face{ + font-family: 'Source Code Pro'; + font-weight: 700; + font-style: normal; + font-stretch: normal; + src: url('EOT/SourceCodePro-Bold.eot') format('embedded-opentype'), + url('WOFF2/TTF/SourceCodePro-Bold.ttf.woff2') format('woff2'), + url('WOFF/OTF/SourceCodePro-Bold.otf.woff') format('woff'), + url('OTF/SourceCodePro-Bold.otf') format('opentype'), + url('TTF/SourceCodePro-Bold.ttf') format('truetype'); +} diff --git a/docs/lib/assets/github.css b/docs/lib/assets/github.css new file mode 100644 index 00000000..8852abb4 --- /dev/null +++ b/docs/lib/assets/github.css @@ -0,0 +1,123 @@ +/* + +github.com style (c) Vasily Polovnyov + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #333; + background: #f8f8f8; + -webkit-text-size-adjust: none; +} + +.hljs-comment, +.diff .hljs-header, +.hljs-javadoc { + color: #998; + font-style: italic; +} + +.hljs-keyword, +.css .rule .hljs-keyword, +.hljs-winutils, +.nginx .hljs-title, +.hljs-subst, +.hljs-request, +.hljs-status { + color: #1184CE; +} + +.hljs-number, +.hljs-hexcolor, +.ruby .hljs-constant { + color: #ed225d; +} + +.hljs-string, +.hljs-tag .hljs-value, +.hljs-phpdoc, +.hljs-dartdoc, +.tex .hljs-formula { + color: #ed225d; +} + +.hljs-title, +.hljs-id, +.scss .hljs-preprocessor { + color: #900; + font-weight: bold; +} + +.hljs-list .hljs-keyword, +.hljs-subst { + font-weight: normal; +} + +.hljs-class .hljs-title, +.hljs-type, +.vhdl .hljs-literal, +.tex .hljs-command { + color: #458; + font-weight: bold; +} + +.hljs-tag, +.hljs-tag .hljs-title, +.hljs-rules .hljs-property, +.django .hljs-tag .hljs-keyword { + color: #000080; + font-weight: normal; +} + +.hljs-attribute, +.hljs-variable, +.lisp .hljs-body { + color: #008080; +} + +.hljs-regexp { + color: #009926; +} + +.hljs-symbol, +.ruby .hljs-symbol .hljs-string, +.lisp .hljs-keyword, +.clojure .hljs-keyword, +.scheme .hljs-keyword, +.tex .hljs-special, +.hljs-prompt { + color: #990073; +} + +.hljs-built_in { + color: #0086b3; +} + +.hljs-preprocessor, +.hljs-pragma, +.hljs-pi, +.hljs-doctype, +.hljs-shebang, +.hljs-cdata { + color: #999; + font-weight: bold; +} + +.hljs-deletion { + background: #fdd; +} + +.hljs-addition { + background: #dfd; +} + +.diff .hljs-change { + background: #0086b3; +} + +.hljs-chunk { + color: #aaa; +} diff --git a/docs/lib/assets/site.js b/docs/lib/assets/site.js new file mode 100644 index 00000000..55ada036 --- /dev/null +++ b/docs/lib/assets/site.js @@ -0,0 +1,110 @@ +/* global anchors */ + +// add anchor links to headers +anchors.options.placement = 'left'; +anchors.add('h3'); + +// Filter UI +var tocElements = document.getElementById('toc').getElementsByTagName('li'); + +document.getElementById('filter-input').addEventListener('keyup', function(e) { + var i, element, children; + + // enter key + if (e.keyCode === 13) { + // go to the first displayed item in the toc + for (i = 0; i < tocElements.length; i++) { + element = tocElements[i]; + if (!element.classList.contains('display-none')) { + location.replace(element.firstChild.href); + return e.preventDefault(); + } + } + } + + var match = function() { + return true; + }; + + var value = this.value.toLowerCase(); + + if (!value.match(/^\s*$/)) { + match = function(element) { + return element.firstChild.innerHTML.toLowerCase().indexOf(value) !== -1; + }; + } + + for (i = 0; i < tocElements.length; i++) { + element = tocElements[i]; + children = Array.from(element.getElementsByTagName('li')); + if (match(element) || children.some(match)) { + element.classList.remove('display-none'); + } else { + element.classList.add('display-none'); + } + } +}); + +var toggles = document.getElementsByClassName('toggle-step-sibling'); +for (var i = 0; i < toggles.length; i++) { + toggles[i].addEventListener('click', toggleStepSibling); +} + +function toggleStepSibling() { + var stepSibling = this.parentNode.parentNode.parentNode.getElementsByClassName( + 'toggle-target' + )[0]; + var klass = 'display-none'; + if (stepSibling.classList.contains(klass)) { + stepSibling.classList.remove(klass); + stepSibling.innerHTML = '▾'; + } else { + stepSibling.classList.add(klass); + stepSibling.innerHTML = '▸'; + } +} + +var items = document.getElementsByClassName('toggle-sibling'); +for (var j = 0; j < items.length; j++) { + items[j].addEventListener('click', toggleSibling); +} + +function toggleSibling() { + var stepSibling = this.parentNode.getElementsByClassName('toggle-target')[0]; + var icon = this.getElementsByClassName('icon')[0]; + var klass = 'display-none'; + if (stepSibling.classList.contains(klass)) { + stepSibling.classList.remove(klass); + icon.innerHTML = '▾'; + } else { + stepSibling.classList.add(klass); + icon.innerHTML = '▸'; + } +} + +function showHashTarget(targetId) { + var hashTarget = document.getElementById(targetId); + // new target is hidden + if ( + hashTarget && + hashTarget.offsetHeight === 0 && + hashTarget.parentNode.parentNode.classList.contains('display-none') + ) { + hashTarget.parentNode.parentNode.classList.remove('display-none'); + } +} + +window.addEventListener('hashchange', function() { + showHashTarget(location.hash.substring(1)); +}); + +showHashTarget(location.hash.substring(1)); + +var toclinks = document.getElementsByClassName('pre-open'); +for (var k = 0; k < toclinks.length; k++) { + toclinks[k].addEventListener('mousedown', preOpen, false); +} + +function preOpen() { + showHashTarget(this.hash.substring(1)); +} diff --git a/docs/lib/assets/style.css b/docs/lib/assets/style.css new file mode 100644 index 00000000..d7e56e04 --- /dev/null +++ b/docs/lib/assets/style.css @@ -0,0 +1,136 @@ +.documentation { + font-family: Helvetica, sans-serif; + color: #666; + line-height: 1.5; + background: #f5f5f5; +} + +.black { + color: #666; +} + +.bg-white { + background-color: #fff; +} + +h4 { + margin: 20px 0 10px 0; +} + +.documentation h3 { + color: #000; +} + +.border-bottom { + border-color: #ddd; +} + +a { + color: #1184CE; + text-decoration: none; +} + +.documentation a[href]:hover { + text-decoration: underline; +} + +a:hover { + cursor: pointer; +} + +.py1-ul li { + padding: 5px 0; +} + +.max-height-100 { + max-height: 100%; +} + +section:target h3 { + font-weight:700; +} + +.documentation td, +.documentation th { + padding: .25rem .25rem; +} + +h1:hover .anchorjs-link, +h2:hover .anchorjs-link, +h3:hover .anchorjs-link, +h4:hover .anchorjs-link { + opacity: 1; +} + +.fix-3 { + width: 25%; + max-width: 244px; +} + +.fix-3 { + width: 25%; + max-width: 244px; +} + +@media (min-width: 52em) { + .fix-margin-3 { + margin-left: 25%; + } +} + +.pre, pre, code, .code { + font-family: Source Code Pro,Menlo,Consolas,Liberation Mono,monospace; + font-size: 14px; +} + +.fill-light { + background: #F9F9F9; +} + +.width2 { + width: 1rem; +} + +.input { + font-family: inherit; + display: block; + width: 100%; + height: 2rem; + padding: .5rem; + margin-bottom: 1rem; + border: 1px solid #ccc; + font-size: .875rem; + border-radius: 3px; + box-sizing: border-box; +} + +table { + border-collapse: collapse; +} + +.prose table th, +.prose table td { + text-align: left; + padding:8px; + border:1px solid #ddd; +} + +.prose table th:nth-child(1) { border-right: none; } +.prose table th:nth-child(2) { border-left: none; } + +.prose table { + border:1px solid #ddd; +} + +.prose-big { + font-size: 18px; + line-height: 30px; +} + +.quiet { + opacity: 0.7; +} + +.minishadow { + box-shadow: 2px 2px 10px #f3f3f3; +} diff --git a/docs/lib/index.html b/docs/lib/index.html new file mode 100644 index 00000000..54a60250 --- /dev/null +++ b/docs/lib/index.html @@ -0,0 +1,41 @@ + + + + + jssm 2.6.6 | Documentation + + + + + + +
+
+
+
+

jssm

+
2.6.6
+ +
+
    + +
+
+ +
+
+
+ +
+
+
+ + + + diff --git a/src/js/jssm-util.js b/src/js/jssm-util.js index f40a8622..2b30a277 100644 --- a/src/js/jssm-util.js +++ b/src/js/jssm-util.js @@ -1,5 +1,5 @@ -const rand_select = (options : Array, probability_property : string = 'probability') => { +const weighted_rand_select = (options : Array, probability_property : string = 'probability') => { if (!Array.isArray(options)) { throw new TypeError('options must be a non-empty array of objects'); } if (!(typeof options[0] === 'object')) { throw new TypeError('options must be a non-empty array of objects'); } @@ -36,20 +36,20 @@ const histograph = (a : Array) => -const sample_select = (n : number, options : Array, probability_property : string) => +const weighted_sample_select = (n : number, options : Array, probability_property : string) => - seq(n).map(i => rand_select(options, probability_property)); + seq(n).map(i => weighted_rand_select(options, probability_property)); -const histo_key = (n : number, options : Array, probability_property : string, extract : string) => +const weighted_histo_key = (n : number, options : Array, probability_property : string, extract : string) => - histograph(sample_select(n, options, probability_property).map( (s:any) => s[extract])); + histograph(weighted_sample_select(n, options, probability_property).map( (s:any) => s[extract])); -export { seq, histograph, histo_key, rand_select, sample_select }; +export { seq, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select }; diff --git a/src/js/jssm.js b/src/js/jssm.js index 841b199a..329e0ded 100644 --- a/src/js/jssm.js +++ b/src/js/jssm.js @@ -16,8 +16,8 @@ const version = null; // replaced from package.js in build -import { seq, rand_select, histograph } from './jssm-util.js'; -import { viz } from './jssm-viz.js'; +import { seq, weighted_rand_select, histograph } from './jssm-util.js'; +import { viz } from './jssm-viz.js'; const parse = require('./jssm-dot.js').parse; @@ -267,7 +267,7 @@ class machine { } probabilistic_transition() : boolean { - const selected = rand_select(this.probable_exits_for(this.state())); + const selected = weighted_rand_select(this.probable_exits_for(this.state())); return this.transition( selected.to ); } @@ -496,6 +496,6 @@ export { machine, parse, - seq, rand_select, histograph + seq, weighted_rand_select, histograph }; diff --git a/src/js/tests/sample_select.js b/src/js/tests/sample_select.js new file mode 100644 index 00000000..30d7a5f4 --- /dev/null +++ b/src/js/tests/sample_select.js @@ -0,0 +1,22 @@ + +import {test, describe} from 'ava-spec'; + +const jssm = require('../../../build/jssm.es5.js'); + + + + + +describe('sample_select/1', async it => { + + // wow is this hard to meaningfully test + it('(0) generates []', t => t.deepEqual([], jssm.seq(0) )); + + // stochastics would help, eg "every returned item is a member" and "in a + // sufficient list any positive sample size is reasonable" and "always + // returns the right sample size" - whargarbl todo + + +}); + +// stochable