mirror of
https://github.com/osmarks/website
synced 2024-11-16 23:44:48 +00:00
1 line
71 KiB
Plaintext
1 line
71 KiB
Plaintext
{"version":3,"sources":["../node_modules/hyperapp/src/index.js","../node_modules/arcsecond/index.mjs","../node_modules/tie-dye/hueToRgb.js","../node_modules/tie-dye/hslToRgb.js","../node_modules/tie-dye/rgbToHex.js","../node_modules/tie-dye/hslToHex.js","../node_modules/hashbow/index.js","index.js"],"names":["RECYCLED_NODE","LAZY_NODE","TEXT_NODE","EMPTY_OBJ","EMPTY_ARR","map","isArray","Array","defer","requestAnimationFrame","setTimeout","createClass","obj","out","length","tmp","k","merge","a","b","batch","list","reduce","item","concat","isSameAction","shouldRestart","patchSubs","oldSubs","newSubs","dispatch","oldSub","newSub","i","subs","push","patchProperty","node","key","oldValue","newValue","listener","isSvg","setProperty","actions","slice","toLowerCase","addEventListener","removeEventListener","removeAttribute","setAttribute","createNode","vdom","ns","props","type","document","createTextNode","name","createElementNS","is","createElement","len","children","appendChild","getVNode","getKey","patch","parent","oldVNode","newVNode","nodeValue","insertBefore","removeChild","tmpVKid","oldVKid","oldKey","newKey","oldVProps","newVProps","oldVKids","newVKids","oldHead","newHead","oldTail","newTail","keyed","newKeyed","propsChanged","getTextVNode","createTextVNode","lazy","view","createVNode","value","undefined","recycleNode","nodeType","nodeName","call","childNodes","Lazy","h","rest","arguments","pop","app","state","lock","subscriptions","event","setState","newState","render","middleware","action","fx","parentNode","init","reDigit","reDigits","reLetter","reLetters","reWhitespaces","createParserState","target","data","isError","error","index","result","updateError","updateResult","updateData","updateParserState","Parser","p","prototype","run","targetString","resultState","fork","errorFn","successFn","fn","parserOfFunction","argumentState","fnState","errorMap","nextState","errorChain","nextParser","mapFromData","chainFromData","mapData","x","ap","chain","of","getData","setData","withData","parser","stateData","pipeParsers","parsers","composeParsers","reverse","tapParser","parse","decide","fail","errorMessage","succeedWith","either","coroutine","g","_","generator","step","nextValue","next","done","Error","many","results","many1","resState","mapTo","errorMapTo","char","c","TypeError","str","s","startsWith","regex","re","typeofre","Object","toString","match","digit","test","digits","letter","letters","anyOfString","includes","namedSequenceOf","pairedParsers","sequenceOf","sepBy","sepParser","valParser","valState","sepState","sepBy1","choice","between","leftParser","rightParser","everythingUntil","val","join","anythingExcept","lookAhead","possibly","skip","endOfInput","whitespace","optionalWhitespace","recursiveParser","parserThunk","takeRight","lParser","rParser","takeLeft","toPromise","Promise","reject","resolve","toValue","e","parseIndex","positiveNumber","A","parseInt","number","sign","diceNotationParser","numDice","die","offset","roll","sum","Math","floor","random","simpleDistribution","dieSize","dist","Map","set","addDistributions","y","xResult","xProbability","yResult","yProbability","get","offsetDistribution","newDist","probability","stats","lowerBound","upperBound","oneDieProbabilities","probabilities","percentage","toFixed","renderDistribution","elements","highest","fraction","width","height","style","fill","class","rollButton","dice","rolls","updateDice","text","console","log","rawDice","raw","renderRoll","color","onClick","onDiceInput","onInput","getElementById"],"mappings":";AAgbO,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,IAAA,QAAA,EAAA,QAAA,UAAA,EAhbP,IAAIA,EAAgB,EAChBC,EAAY,EACZC,EAAY,EACZC,EAAY,GACZC,EAAY,GACZC,EAAMD,EAAUC,IAChBC,EAAUC,MAAMD,QAChBE,EAC+B,oBAA1BC,sBACHA,sBACAC,WAEFC,EAAc,SAASC,GACrBC,IAAAA,EAAM,GAEN,GAAe,iBAARD,EAAkB,OAAOA,EAEhCN,GAAAA,EAAQM,IAAQA,EAAIE,OAAS,EAC1B,IAAA,IAAWC,EAAPC,EAAI,EAAQA,EAAIJ,EAAIE,OAAQE,IACC,MAA/BD,EAAMJ,EAAYC,EAAII,OACzBH,IAAQA,GAAO,KAAOE,QAIrB,IAAA,IAAIC,KAAKJ,EACRA,EAAII,KACNH,IAAQA,GAAO,KAAOG,GAKrBH,OAAAA,GAGLI,EAAQ,SAASC,EAAGC,GAClBN,IAAAA,EAAM,GAEL,IAAA,IAAIG,KAAKE,EAAGL,EAAIG,GAAKE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.3854b3a8.js","sourceRoot":"../src","sourcesContent":["var RECYCLED_NODE = 1\nvar LAZY_NODE = 2\nvar TEXT_NODE = 3\nvar EMPTY_OBJ = {}\nvar EMPTY_ARR = []\nvar map = EMPTY_ARR.map\nvar isArray = Array.isArray\nvar defer =\n typeof requestAnimationFrame !== \"undefined\"\n ? requestAnimationFrame\n : setTimeout\n\nvar createClass = function(obj) {\n var out = \"\"\n\n if (typeof obj === \"string\") return obj\n\n if (isArray(obj) && obj.length > 0) {\n for (var k = 0, tmp; k < obj.length; k++) {\n if ((tmp = createClass(obj[k])) !== \"\") {\n out += (out && \" \") + tmp\n }\n }\n } else {\n for (var k in obj) {\n if (obj[k]) {\n out += (out && \" \") + k\n }\n }\n }\n\n return out\n}\n\nvar merge = function(a, b) {\n var out = {}\n\n for (var k in a) out[k] = a[k]\n for (var k in b) out[k] = b[k]\n\n return out\n}\n\nvar batch = function(list) {\n return list.reduce(function(out, item) {\n return out.concat(\n !item || item === true\n ? 0\n : typeof item[0] === \"function\"\n ? [item]\n : batch(item)\n )\n }, EMPTY_ARR)\n}\n\nvar isSameAction = function(a, b) {\n return isArray(a) && isArray(b) && a[0] === b[0] && typeof a[0] === \"function\"\n}\n\nvar shouldRestart = function(a, b) {\n if (a !== b) {\n for (var k in merge(a, b)) {\n if (a[k] !== b[k] && !isSameAction(a[k], b[k])) return true\n b[k] = a[k]\n }\n }\n}\n\nvar patchSubs = function(oldSubs, newSubs, dispatch) {\n for (\n var i = 0, oldSub, newSub, subs = [];\n i < oldSubs.length || i < newSubs.length;\n i++\n ) {\n oldSub = oldSubs[i]\n newSub = newSubs[i]\n subs.push(\n newSub\n ? !oldSub ||\n newSub[0] !== oldSub[0] ||\n shouldRestart(newSub[1], oldSub[1])\n ? [\n newSub[0],\n newSub[1],\n newSub[0](dispatch, newSub[1]),\n oldSub && oldSub[2]()\n ]\n : oldSub\n : oldSub && oldSub[2]()\n )\n }\n return subs\n}\n\nvar patchProperty = function(node, key, oldValue, newValue, listener, isSvg) {\n if (key === \"key\") {\n } else if (key === \"style\") {\n for (var k in merge(oldValue, newValue)) {\n oldValue = newValue == null || newValue[k] == null ? \"\" : newValue[k]\n if (k[0] === \"-\") {\n node[key].setProperty(k, oldValue)\n } else {\n node[key][k] = oldValue\n }\n }\n } else if (key[0] === \"o\" && key[1] === \"n\") {\n if (\n !((node.actions || (node.actions = {}))[\n (key = key.slice(2).toLowerCase())\n ] = newValue)\n ) {\n node.removeEventListener(key, listener)\n } else if (!oldValue) {\n node.addEventListener(key, listener)\n }\n } else if (!isSvg && key !== \"list\" && key in node) {\n node[key] = newValue == null ? \"\" : newValue\n } else if (\n newValue == null ||\n newValue === false ||\n (key === \"class\" && !(newValue = createClass(newValue)))\n ) {\n node.removeAttribute(key)\n } else {\n node.setAttribute(key, newValue)\n }\n}\n\nvar createNode = function(vdom, listener, isSvg) {\n var ns = \"http://www.w3.org/2000/svg\"\n var props = vdom.props\n var node =\n vdom.type === TEXT_NODE\n ? document.createTextNode(vdom.name)\n : (isSvg = isSvg || vdom.name === \"svg\")\n ? document.createElementNS(ns, vdom.name, { is: props.is })\n : document.createElement(vdom.name, { is: props.is })\n\n for (var k in props) {\n patchProperty(node, k, null, props[k], listener, isSvg)\n }\n\n for (var i = 0, len = vdom.children.length; i < len; i++) {\n node.appendChild(\n createNode(\n (vdom.children[i] = getVNode(vdom.children[i])),\n listener,\n isSvg\n )\n )\n }\n\n return (vdom.node = node)\n}\n\nvar getKey = function(vdom) {\n return vdom == null ? null : vdom.key\n}\n\nvar patch = function(parent, node, oldVNode, newVNode, listener, isSvg) {\n if (oldVNode === newVNode) {\n } else if (\n oldVNode != null &&\n oldVNode.type === TEXT_NODE &&\n newVNode.type === TEXT_NODE\n ) {\n if (oldVNode.name !== newVNode.name) node.nodeValue = newVNode.name\n } else if (oldVNode == null || oldVNode.name !== newVNode.name) {\n node = parent.insertBefore(\n createNode((newVNode = getVNode(newVNode)), listener, isSvg),\n node\n )\n if (oldVNode != null) {\n parent.removeChild(oldVNode.node)\n }\n } else {\n var tmpVKid\n var oldVKid\n\n var oldKey\n var newKey\n\n var oldVProps = oldVNode.props\n var newVProps = newVNode.props\n\n var oldVKids = oldVNode.children\n var newVKids = newVNode.children\n\n var oldHead = 0\n var newHead = 0\n var oldTail = oldVKids.length - 1\n var newTail = newVKids.length - 1\n\n isSvg = isSvg || newVNode.name === \"svg\"\n\n for (var i in merge(oldVProps, newVProps)) {\n if (\n (i === \"value\" || i === \"selected\" || i === \"checked\"\n ? node[i]\n : oldVProps[i]) !== newVProps[i]\n ) {\n patchProperty(node, i, oldVProps[i], newVProps[i], listener, isSvg)\n }\n }\n\n while (newHead <= newTail && oldHead <= oldTail) {\n if (\n (oldKey = getKey(oldVKids[oldHead])) == null ||\n oldKey !== getKey(newVKids[newHead])\n ) {\n break\n }\n\n patch(\n node,\n oldVKids[oldHead].node,\n oldVKids[oldHead],\n (newVKids[newHead] = getVNode(\n newVKids[newHead++],\n oldVKids[oldHead++]\n )),\n listener,\n isSvg\n )\n }\n\n while (newHead <= newTail && oldHead <= oldTail) {\n if (\n (oldKey = getKey(oldVKids[oldTail])) == null ||\n oldKey !== getKey(newVKids[newTail])\n ) {\n break\n }\n\n patch(\n node,\n oldVKids[oldTail].node,\n oldVKids[oldTail],\n (newVKids[newTail] = getVNode(\n newVKids[newTail--],\n oldVKids[oldTail--]\n )),\n listener,\n isSvg\n )\n }\n\n if (oldHead > oldTail) {\n while (newHead <= newTail) {\n node.insertBefore(\n createNode(\n (newVKids[newHead] = getVNode(newVKids[newHead++])),\n listener,\n isSvg\n ),\n (oldVKid = oldVKids[oldHead]) && oldVKid.node\n )\n }\n } else if (newHead > newTail) {\n while (oldHead <= oldTail) {\n node.removeChild(oldVKids[oldHead++].node)\n }\n } else {\n for (var i = oldHead, keyed = {}, newKeyed = {}; i <= oldTail; i++) {\n if ((oldKey = oldVKids[i].key) != null) {\n keyed[oldKey] = oldVKids[i]\n }\n }\n\n while (newHead <= newTail) {\n oldKey = getKey((oldVKid = oldVKids[oldHead]))\n newKey = getKey(\n (newVKids[newHead] = getVNode(newVKids[newHead], oldVKid))\n )\n\n if (\n newKeyed[oldKey] ||\n (newKey != null && newKey === getKey(oldVKids[oldHead + 1]))\n ) {\n if (oldKey == null) {\n node.removeChild(oldVKid.node)\n }\n oldHead++\n continue\n }\n\n if (newKey == null || oldVNode.type === RECYCLED_NODE) {\n if (oldKey == null) {\n patch(\n node,\n oldVKid && oldVKid.node,\n oldVKid,\n newVKids[newHead],\n listener,\n isSvg\n )\n newHead++\n }\n oldHead++\n } else {\n if (oldKey === newKey) {\n patch(\n node,\n oldVKid.node,\n oldVKid,\n newVKids[newHead],\n listener,\n isSvg\n )\n newKeyed[newKey] = true\n oldHead++\n } else {\n if ((tmpVKid = keyed[newKey]) != null) {\n patch(\n node,\n node.insertBefore(tmpVKid.node, oldVKid && oldVKid.node),\n tmpVKid,\n newVKids[newHead],\n listener,\n isSvg\n )\n newKeyed[newKey] = true\n } else {\n patch(\n node,\n oldVKid && oldVKid.node,\n null,\n newVKids[newHead],\n listener,\n isSvg\n )\n }\n }\n newHead++\n }\n }\n\n while (oldHead <= oldTail) {\n if (getKey((oldVKid = oldVKids[oldHead++])) == null) {\n node.removeChild(oldVKid.node)\n }\n }\n\n for (var i in keyed) {\n if (newKeyed[i] == null) {\n node.removeChild(keyed[i].node)\n }\n }\n }\n }\n\n return (newVNode.node = node)\n}\n\nvar propsChanged = function(a, b) {\n for (var k in a) if (a[k] !== b[k]) return true\n for (var k in b) if (a[k] !== b[k]) return true\n}\n\nvar getTextVNode = function(node) {\n return typeof node === \"object\" ? node : createTextVNode(node)\n}\n\nvar getVNode = function(newVNode, oldVNode) {\n return newVNode.type === LAZY_NODE\n ? ((!oldVNode ||\n (oldVNode.type !== LAZY_NODE ||\n propsChanged(oldVNode.lazy, newVNode.lazy))) &&\n ((oldVNode = getTextVNode(newVNode.lazy.view(newVNode.lazy))).lazy =\n newVNode.lazy),\n oldVNode)\n : newVNode\n}\n\nvar createVNode = function(name, props, children, node, key, type) {\n return {\n name: name,\n props: props,\n children: children,\n node: node,\n type: type,\n key: key\n }\n}\n\nvar createTextVNode = function(value, node) {\n return createVNode(value, EMPTY_OBJ, EMPTY_ARR, node, undefined, TEXT_NODE)\n}\n\nvar recycleNode = function(node) {\n return node.nodeType === TEXT_NODE\n ? createTextVNode(node.nodeValue, node)\n : createVNode(\n node.nodeName.toLowerCase(),\n EMPTY_OBJ,\n map.call(node.childNodes, recycleNode),\n node,\n undefined,\n RECYCLED_NODE\n )\n}\n\nexport var Lazy = function(props) {\n return {\n lazy: props,\n type: LAZY_NODE\n }\n}\n\nexport var h = function(name, props) {\n for (var vdom, rest = [], children = [], i = arguments.length; i-- > 2; ) {\n rest.push(arguments[i])\n }\n\n while (rest.length > 0) {\n if (isArray((vdom = rest.pop()))) {\n for (var i = vdom.length; i-- > 0; ) {\n rest.push(vdom[i])\n }\n } else if (vdom === false || vdom === true || vdom == null) {\n } else {\n children.push(getTextVNode(vdom))\n }\n }\n\n props = props || EMPTY_OBJ\n\n return typeof name === \"function\"\n ? name(props, children)\n : createVNode(name, props, children, undefined, props.key)\n}\n\nexport var app = function(props) {\n var state = {}\n var lock = false\n var view = props.view\n var node = props.node\n var vdom = node && recycleNode(node)\n var subscriptions = props.subscriptions\n var subs = []\n\n var listener = function(event) {\n dispatch(this.actions[event.type], event)\n }\n\n var setState = function(newState) {\n if (state !== newState) {\n state = newState\n if (subscriptions) {\n subs = patchSubs(subs, batch([subscriptions(state)]), dispatch)\n }\n if (view && !lock) defer(render, (lock = true))\n }\n return state\n }\n\n var dispatch = (props.middleware ||\n function(obj) {\n return obj\n })(function(action, props) {\n return typeof action === \"function\"\n ? dispatch(action(state, props))\n : isArray(action)\n ? typeof action[0] === \"function\" || isArray(action[0])\n ? dispatch(\n action[0],\n typeof action[1] === \"function\" ? action[1](props) : action[1]\n )\n : (batch(action.slice(1)).map(function(fx) {\n fx && fx[0](dispatch, fx[1])\n }, setState(action[0])),\n state)\n : setState(action)\n })\n\n var render = function() {\n lock = false\n node = patch(\n node.parentNode,\n node,\n vdom,\n (vdom = getTextVNode(view(state))),\n listener\n )\n }\n\n dispatch(props.init)\n}\n","// data ParserState e a s\n// data Parser e a s = { p: ParserState e a s }\n// data StateData a s = { result: a, data: s }\n// data ParsingResult e a = Ok a | Error e\n\n// Caching compiled regexs for better performance\nconst reDigit = /[0-9]/;\nconst reDigits = /^[0-9]+/;\nconst reLetter = /[a-zA-Z]/;\nconst reLetters = /^[a-zA-Z]+/;\nconst reWhitespaces = /^\\s+/;\n\n// createParserState :: x -> s -> ParserState e a s\nconst createParserState = (target, data = null) => ({\n isError: false,\n error: null,\n target,\n data,\n index: 0,\n result: null\n});\n\n// updateError :: (ParserState e a s, f) -> ParserState f a s\nconst updateError = (state, error) => ({ ...state, isError: true, error });\n\n// updateResult :: (ParserState e a s, b) -> ParserState e b s\nconst updateResult = (state, result) => ({ ...state, result });\n\n// updateData :: (ParserState e a s, t) -> ParserState e b t\nconst updateData = (state, data) => ({ ...state, data });\n\n// updateResult :: (ParserState e a s, b, Integer) -> ParserState e b s\nconst updateParserState = (state, result, index) => ({ ...state, result, index });\n\n// data Parser e a s\nexport function Parser(p) {\n this.p = p;\n};\n\n// run :: Parser e a s ~> x -> Either e a\nParser.prototype.run = function Parser$run(targetString) {\n const state = createParserState(targetString, null);\n\n const resultState = this.p(state);\n\n if (resultState.isError) {\n return {\n isError: true,\n error: resultState.error,\n index: resultState.index,\n data: resultState.data\n };\n }\n\n return {\n isError: false,\n result: resultState.result,\n index: resultState.index,\n data: resultState.data\n };\n};\n\n// fork :: Parser e a s ~> x -> (e -> ParserState e a s -> f) -> (a -> ParserState e a s -> b)\nParser.prototype.fork = function Parser$run(targetString, errorFn, successFn) {\n const state = createParserState(targetString);\n const newState = this.p(state);\n\n if (newState.isError) {\n return errorFn(newState.error, newState);\n }\n\n return successFn(newState.result, newState);\n};\n\n// map :: Parser e a s ~> (a -> b) -> Parser e b s\nParser.prototype['fantasy-land/map'] = function Parser$map(fn) {\n const p = this.p;\n return new Parser(function Parser$map$state (state) {\n const newState = p(state);\n if (newState.isError) return newState;\n return updateResult(newState, fn(newState.result));\n });\n};\n\n// chain :: Parser e a s ~> (a -> Parser e b s) -> Parser e b s\nParser.prototype['fantasy-land/chain'] = function Parser$chain(fn) {\n const p = this.p;\n return new Parser(function Parser$chain$state(state) {\n const newState = p(state);\n if (newState.isError) return newState;\n return fn(newState.result).p(newState);\n });\n};\n\n// ap :: Parser e a s ~> Parser e (a -> b) s -> Parser e b s\nParser.prototype['fantasy-land/ap'] = function Parser$ap(parserOfFunction) {\n const p = this.p;\n return new Parser(function Parser$ap$state(state) {\n if (state.isError) return state;\n\n const argumentState = p(state);\n if (argumentState.isError) return argumentState;\n\n const fnState = parserOfFunction.p(argumentState);\n if (fnState.isError) return fnState;\n\n return updateResult(fnState, fnState.result(argumentState.result));\n });\n};\n\n// errorMap :: Parser e a s ~> (e -> f) -> Parser f a s\nParser.prototype.errorMap = function Parser$errorMap(fn) {\n const p = this.p;\n return new Parser(function Parser$errorMap$state(state) {\n const nextState = p(state);\n if (!nextState.isError) return nextState;\n\n return updateError(nextState, fn(nextState.error, nextState.index, nextState.data));\n });\n};\n\n// errorChain :: Parser e a s ~> ((e, Integer, s) -> Parser f a s) -> Parser f a s\nParser.prototype.errorChain = function Parser$errorMap(fn) {\n const p = this.p;\n return new Parser(function Parser$errorMap$state(state) {\n const nextState = p(state);\n if (nextState.isError) {\n const {error, index, data} = nextState;\n const nextParser = fn({error, index, data});\n return nextParser.p({ ...nextState, isError: false });\n }\n return nextState;\n });\n};\n\n// mapFromData :: Parser e a s ~> (StateData a s -> b) -> Parser e b s\nParser.prototype.mapFromData = function Parser$mapFromData(fn) {\n const p = this.p;\n return new Parser(function Parser$mapFromData$state (state) {\n const newState = p(state);\n if (newState.error) return newState;\n return updateResult(newState, fn({result: newState.result, data: newState.data}));\n });\n};\n\n// chainFromData :: Parser e a s ~> (StateData a s -> Parser f b t) -> Parser f b t\nParser.prototype.chainFromData = function Parser$chainFromData(fn) {\n const p = this.p;\n return new Parser(function Parser$chainFromData$state(state) {\n const newState = p(state);\n if (newState.error) return newState;\n return fn({result: newState.result, data: newState.data}).p(newState);\n });\n};\n\n// mapData :: Parser e a s ~> (s -> t) -> Parser e a t\nParser.prototype.mapData = function mapData(fn) {\n const p = this.p;\n return new Parser(function mapData$state(state) {\n const newState = p(state);\n return updateData(newState, fn(newState.data));\n });\n};\n\n// of :: a -> Parser e a s\nParser['fantasy-land/of'] = function (x) {\n return new Parser(state => updateResult(state, x));\n};\n\nParser.prototype.map = Parser.prototype['fantasy-land/map'];\nParser.prototype.ap = Parser.prototype['fantasy-land/ap'];\nParser.prototype.chain = Parser.prototype['fantasy-land/chain'];\nParser.of = Parser['fantasy-land/of'];\n\n// getData :: Parser e a s\nexport const getData = new Parser(function getData$state(state) {\n if (state.isError) return state;\n return updateResult(state, state.data);\n});\n\n// setData :: t -> Parser e a t\nexport const setData = function setData(x) {\n return new Parser(function setData$state(state) {\n if (state.isError) return state;\n return updateData(state, x)\n });\n};\n\n// mapData :: (s -> t) -> Parser e a t\nexport const mapData = function mapData(fn) {\n return new Parser(function mapData$state(state) {\n if (state.isError) return state;\n return updateData(state, fn(state.data));\n });\n};\n\n// withData :: Parser e a x -> s -> Parser e a s\nexport const withData = function withData(parser) {\n return function withData$parser(stateData) {\n return setData(stateData).chain(() => parser);\n };\n};\n\n// pipeParsers :: [Parser * * *] -> Parser * * *\nexport const pipeParsers = function pipeParsers (parsers) {\n return new Parser(function pipeParsers$state (state) {\n let nextState = state;\n for (const parser of parsers) {\n nextState = parser.p(nextState);\n }\n return nextState;\n });\n};\n\n// composeParsers :: [Parser * * *] -> Parser * * *\nexport const composeParsers = function composeParsers(parsers) {\n return new Parser(function composeParsers$state(state) {\n return pipeParsers ([...parsers].reverse()).p(state);\n });\n};\n\n// tapParser :: (a => ()) -> Parser e a s\nexport const tapParser = function tapParser(fn) {\n return new Parser(function tapParser$state(state) {\n fn(state);\n return state;\n });\n};\n\n// parse :: Parser e a s -> String -> Either e a\nexport const parse = function parse(parser) {\n return function parse$targetString(targetString) {\n return parser.run(targetString);\n };\n};\n\n// decide :: (a -> Parser e b s) -> Parser e b s\nexport const decide = function decide(fn) {\n return new Parser(function decide$state(state) {\n if (state.isError) return state;\n const parser = fn(state.result);\n return parser.p(state);\n });\n};\n\n// fail :: e -> Parser e a s\nexport const fail = function fail(errorMessage) {\n return new Parser(function fail$state(state) {\n if (state.isError) return state;\n return updateError(state, errorMessage);\n });\n};\n\n// succeedWith :: a -> Parser e a s\nexport const succeedWith = Parser.of;\n\n// either :: Parser e a s -> Parser e (Either e a) s\nexport const either = function either(parser) {\n return new Parser(function either$state(state) {\n if (state.isError) return state;\n\n const nextState = parser.p(state);\n\n return updateResult({...nextState, isError: false}, {\n isError: nextState.isError,\n value: nextState.isError ? nextState.error : nextState.result\n });\n });\n}\n\n// coroutine :: (() -> Iterator (Parser e a s)) -> Parser e a s\nexport const coroutine = function coroutine(g) {\n return Parser.of().chain(_ => {\n const generator = g();\n\n const step = (nextValue) => {\n const result = generator.next(nextValue);\n const value = result.value;\n const done = result.done;\n\n if (!done && (!value || typeof value.chain !== 'function')) {\n throw new Error(`[coroutine] yielded values must be Parsers, got ${result.value}.`);\n }\n\n return done\n ? Parser.of(value)\n : value.chain(step);\n };\n\n return step();\n });\n};\n\n// many :: Parser e s a -> Parser e s [a]\nexport const many = function many(parser) {\n return new Parser(function many$state(state) {\n if (state.isError) return state;\n\n const results = [];\n let nextState = state;\n\n while (true) {\n const out = parser.p(nextState);\n\n if (out.isError) {\n break;\n } else {\n nextState = out;\n results.push(nextState.result);\n\n if (nextState.index >= nextState.target.length) {\n break;\n }\n }\n }\n\n return updateResult(nextState, results);\n });\n};\n\n// many1 :: Parser e s a -> Parser e s [a]\nexport const many1 = function many1(parser) {\n return new Parser(function many1$state(state) {\n if (state.isError) return state;\n\n const resState = many (parser).p(state);\n if (resState.result.length) return resState;\n\n return updateError(state, `ParseError 'many1' (position ${state.index}): Expecting to match at least one value`);\n });\n};\n\n// mapTo :: (a -> b) -> Parser e b s\nexport const mapTo = function mapTo(fn) {\n return new Parser(function mapTo$state(state) {\n if (state.isError) return state;\n return updateResult(state, fn(state.result));\n });\n};\n\n// errorMapTo :: (ParserState e a s -> f) -> Parser f a s\nexport const errorMapTo = fn => new Parser(state => {\n if (!state.isError) return state;\n return updateError(state, fn(state.error, state.index, state.data));\n});\n\n// char :: Char -> Parser e Char s\nexport const char = function char(c) {\n if (!c || c.length !== 1) {\n throw new TypeError (`char must be called with a single character, but got ${c}`);\n }\n\n return new Parser(function char$state (state) {\n if (state.isError) return state;\n\n const {target, index} = state;\n if (index < target.length) {\n return (target[index] === c)\n ? updateParserState(state, c, index + 1)\n : updateError(state, `ParseError (position ${index}): Expecting character '${c}', got '${target[index]}'`);\n }\n return updateError(state, `ParseError (position ${index}): Expecting character '${c}', but got end of input.`);\n });\n};\n\n// str :: String -> Parser e String s\nexport const str = function str(s) {\n if (!s || s.length < 1) {\n throw new TypeError (`str must be called with a string with length > 1, but got ${s}`);\n }\n\n return new Parser(function str$state (state) {\n const {target, index} = state;\n const rest = target.slice(index);\n\n if (rest.length >= 1) {\n return (rest.startsWith(s))\n ? updateParserState(state, s, index + s.length)\n : updateError(state, `ParseError (position ${index}): Expecting string '${s}', got '${rest.slice(0, s.length)}...'`);\n }\n\n return updateError(state, `ParseError (position ${index}): Expecting string '${s}', but got end of input.`);\n });\n};\n\n// regex :: RegExp -> Parser e String s\nexport const regex = function regex(re) {\n const typeofre = Object.prototype.toString.call(re);\n if (typeofre !== '[object RegExp]') {\n throw new TypeError (`regex must be called with a Regular Expression, but got ${typeofre}`);\n }\n\n if (re.toString()[1] !== '^') {\n throw new Error(`regex parsers must contain '^' start assertion.`)\n }\n\n return new Parser(function regex$state(state) {\n if (state.isError) return state;\n const {target, index} = state;\n const rest = target.slice(index);\n\n if (rest.length >= 1) {\n const match = rest.match(re);\n return (match)\n ? updateParserState(state, match[0], index + match[0].length)\n : updateError(state, `ParseError (position ${index}): Expecting string matching '${re}', got '${rest.slice(0, 5)}...'`)\n }\n return updateError(state, `ParseError (position ${index}): Expecting string matching '${re}', but got end of input.`);\n });\n};\n\n// digit :: Parser e String s\nexport const digit = new Parser(function digit$state(state) {\n if (state.isError) return state;\n\n const {target, index} = state;\n\n if (target.length > index) {\n return (target.length && target[index] && reDigit.test(target[index]))\n ? updateParserState(state, target[index], index + 1)\n : updateError(state, `ParseError (position ${index}): Expecting digit, got '${target[index]}'`)\n }\n return updateError(state, `ParseError (position ${index}): Expecting digit, but got end of input.`);\n});\n\n// digits :: Parser e String s\nexport const digits = regex(reDigits)\n .errorMap((_, index) => `ParseError (position ${index}): Expecting digits`);\n\n// letter :: Parser e Char s\nexport const letter = new Parser(function letter$state(state) {\n if (state.isError) return state;\n\n const {index, target} = state;\n\n if (target.length > index) {\n return (target.length && target[index] && reLetter.test(target[index]))\n ? updateParserState(state, target[index], index + 1)\n : updateError(state, `ParseError (position ${index}): Expecting letter, got '${target[index]}'`);\n }\n\n return updateError(state, `ParseError (position ${index}): Expecting letter, but got end of input.`);\n});\n\n// letters :: Parser e String s\nexport const letters = regex(reLetters)\n .errorMap((_, index) => `ParseError (position ${index}): Expecting letters`);\n\n// anyOfString :: String -> Parser e Char s\nexport const anyOfString = function anyOfString(s) {\n return new Parser(function anyOfString$state(state) {\n if (state.isError) return state;\n\n const {target, index} = state;\n\n if (target.length > index) {\n return (s.includes(target[index]))\n ? updateParserState(state, target[index], index + 1)\n : updateError(state, `ParseError (position ${index}): Expecting any of the string \"${s}\", got ${target[index]}`);\n }\n return updateError(state, `ParseError (position ${index}): Expecting any of the string \"${s}\", but got end of input.`);\n });\n};\n\n// namedSequenceOf :: [(String, Parser * * *)] -> Parser e (StrMap *) s\nexport const namedSequenceOf = function namedSequenceOf(pairedParsers) {\n return new Parser(function namedSequenceOf$state(state) {\n if (state.isError) return state;\n\n const results = {};\n let nextState = state;\n\n for (const [key, parser] of pairedParsers) {\n const out = parser.p(nextState);\n if (out.isError) {\n return out;\n } else {\n nextState = out;\n results[key] = out.result;\n }\n }\n\n return updateResult(nextState, results);\n });\n};\n\n// sequenceOf :: [Parser * * *] -> Parser * [*] *\nexport const sequenceOf = function sequenceOf(parsers) {\n return new Parser(function sequenceOf$state(state) {\n if (state.isError) return state;\n\n const length = parsers.length;\n const results = new Array(length);\n let nextState = state;\n\n for (let i = 0; i < length; i++) {\n const out = parsers[i].p(nextState);\n\n if (out.isError) {\n return out;\n } else {\n nextState = out;\n results[i] = out.result;\n }\n }\n\n return updateResult(nextState, results);\n });\n};\n\n// sepBy :: Parser e a s -> Parser e b s -> Parser e [b] s\nexport const sepBy = function sepBy(sepParser) {\n return function sepBy$valParser(valParser) {\n return new Parser(function sepBy$valParser$state(state) {\n if (state.isError) return state;\n\n let nextState = state;\n let error = null;\n const results = [];\n\n while (true) {\n const valState = valParser.p(nextState);\n const sepState = sepParser.p(valState);\n\n if (valState.isError) {\n error = valState;\n break;\n } else {\n results.push(valState.result);\n }\n\n if (sepState.isError) {\n nextState = valState;\n break;\n }\n\n nextState = sepState;\n }\n\n if (error) {\n if (results.length === 0) {\n return updateResult(state, results)\n }\n return error;\n }\n\n return updateResult(nextState, results);\n });\n }\n};\n\n// sepBy1 :: Parser e a s -> Parser e b s -> Parser e [b] s\nexport const sepBy1 = function sepBy1(sepParser) {\n return function sepBy1$valParser(valParser) {\n return new Parser(function sepBy1$valParser$state(state) {\n if (state.isError) return state;\n\n const out = sepBy(sepParser)(valParser).p(state);\n if (out.isError) return out;\n if (out.result.length === 0) {\n return updateError(state, `ParseError 'sepBy1' (position ${state.index}): Expecting to match at least one separated value`);\n }\n return out;\n });\n }\n};\n\n// choice :: [Parser * * *] -> Parser * * *\nexport const choice = function choice(parsers) {\n return new Parser(function choice$state(state) {\n if (state.isError) return state;\n\n let error = null;\n for (const parser of parsers) {\n const out = parser.p(state);\n\n if (!out.isError) return out;\n\n if (!error || (error && out.index > error.index)) {\n error = out;\n }\n }\n\n return error;\n });\n};\n\n// between :: Parser e a s -> Parser e b s -> Parser e c s -> Parser e b s\nexport const between = function between(leftParser) {\n return function between$rightParser(rightParser) {\n return function between$rightParser(parser) {\n return sequenceOf ([\n leftParser,\n parser,\n rightParser\n ]) .map (([_, x]) => x);\n }\n }\n};\n\n// everythingUntil :: Parser e a s -> Parser e String s\nexport const everythingUntil = function everythingUntil(parser) {\n return new Parser(state => {\n if (state.isError) return state;\n\n const results = [];\n let nextState = state;\n\n while (true) {\n const out = parser.p(nextState);\n\n if (out.isError) {\n const {index, target} = nextState;\n const val = target[index];\n\n if (val) {\n results.push(val);\n nextState = updateParserState(nextState, val, index + 1);\n } else {\n return updateError(nextState, `ParseError 'everythingUntil' (position ${nextState.index}): Unexpected end of input.`);\n }\n } else {\n break;\n }\n }\n\n return updateResult(nextState, results.join(''));\n });\n};\n\n// anythingExcept :: Parser e a s -> Parser e Char s\nexport const anythingExcept = function anythingExcept(parser) {\n return new Parser(function anythingExcept$state(state) {\n if (state.isError) return state;\n const {target, index} = state;\n\n const out = parser.p(state);\n if (out.isError) {\n return updateParserState(state, target[index], index + 1);\n }\n return updateError(state, `ParseError 'anythingExcept' (position ${index}): Matched '${out.result}' from the exception parser`);\n });\n};\n\n// lookAhead :: Parser e a s -> Parser e a s\nexport const lookAhead = function lookAhead(parser) {\n return new Parser(function lookAhead$state(state) {\n if (state.isError) return state;\n const nextState = parser.p(state);\n return (nextState.isError)\n ? updateError(state, nextState.error)\n : updateResult(state, nextState.result);\n });\n};\n\n// possibly :: Parser e a s -> Parser e (a | Null) s\nexport const possibly = function possibly(parser) {\n return new Parser(function possibly$state(state) {\n if (state.isError) return state;\n\n const nextState = parser.p(state);\n return (nextState.isError)\n ? updateResult(state, null)\n : nextState;\n });\n};\n\n// skip :: Parser e a s -> Parser e a s\nexport const skip = function skip(parser) {\n return new Parser(function skip$state(state) {\n if (state.isError) return state;\n const nextState = parser.p(state);\n if (nextState.isError) return nextState;\n\n return updateResult(nextState, state.result);\n });\n};\n\n// endOfInput :: Parser e Null s\nexport const endOfInput = new Parser(function endOfInput$state(state) {\n if (state.isError) return state;\n const {target, index} = state;\n if (index !== target.length) {\n return updateError(state, `ParseError 'endOfInput' (position ${index}): Expected end of input but got '${target.slice(index, index+1)}'`);\n }\n\n return updateResult(state, null);\n});\n\n// whitespace :: Parser e String s\nexport const whitespace = regex(reWhitespaces)\n // Keeping this error even though the implementation no longer uses many1. Will change it to something more appropriate in the next major release.\n .errorMap((_, index) => `ParseError 'many1' (position ${index}): Expecting to match at least one value`);\n\n// optionalWhitespace :: Parser e String s\nexport const optionalWhitespace = possibly(whitespace).map(x => x||'');\n\n// recursiveParser :: (() => Parser e a s) -> Parser e a s\nexport const recursiveParser = function recursiveParser(parserThunk) {\n return new Parser(function recursiveParser$state(state) {\n return parserThunk().p(state);\n });\n};\n\n// takeRight :: Parser e a s -> Parser f b t -> Parser f b t\nexport const takeRight = lParser => rParser => lParser.chain(() => rParser);\n\n// takeLeft :: Parser e a s -> Parser f b t -> Parser e a s\nexport const takeLeft = lParser => rParser => lParser.chain(x => rParser.map(() => x));\n\n// toPromise :: ParserResult e a s -> Promise (e, Integer, s) a\nexport const toPromise = result => {\n return result.isError\n ? Promise.reject({\n error: result.error,\n index: result.index,\n data: result.data\n })\n : Promise.resolve(result.result);\n};\n\n// toValue :: ParserResult e a s -> a\nexport const toValue = result => {\n if (result.isError) {\n const e = new Error(result.error);\n e.parseIndex = result.index;\n e.data = result.data;\n throw e;\n }\n return result.result;\n};\n","function hueToRgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n}\n\nmodule.exports = hueToRgb;\n","var hueToRgb = require('./hueToRgb');\n\n/**\n * Convert a color from HSL to RGB\n *\n * @param {number} h - A value from 0 - 360\n * @param {number} s - A value from 0 - 100\n * @param {number} l - A value from 0 - 100\n * @returns {object} With the signature {r: 0-255, g: 0-255, b: 0-255}\n */\nfunction hslToRgb(h, s, l) {\n\n h /= 360;\n s /= 100;\n l /= 100;\n\n var r, g, b;\n\n if (s === 0) {\n r = g = b = l; // achromatic\n } else {\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hueToRgb(p, q, h + 1 / 3);\n g = hueToRgb(p, q, h);\n b = hueToRgb(p, q, h - 1 / 3);\n }\n\n return ({\n r: r * 255,\n g: g * 255,\n b: b * 255\n });\n}\n\nmodule.exports = hslToRgb;\n","/**\n * Convert a color from RGB to hexidecimal\n *\n * @param {number} r - A value from 0 - 255\n * @param {number} g - A value from 0 - 255\n * @param {number} b - A value from 0 - 255\n * @returns {string} In the format #000000\n */\nfunction rgbToHex(r, g, b) {\n var integer = ((Math.round(r) & 0xFF) << 16)\n + ((Math.round(g) & 0xFF) << 8)\n + (Math.round(b) & 0xFF);\n\n var string = integer.toString(16).toUpperCase();\n return '#' + ('000000'.substring(string.length) + string);\n}\n\nmodule.exports = rgbToHex;\n","var hslToRgb = require('./hslToRgb');\nvar rgbToHex = require('./rgbToHex');\n\nfunction hslToHex(h, s, l) {\n var rgb = hslToRgb(h, s, l);\n return rgbToHex(rgb.r, rgb.g, rgb.b);\n}\n\nmodule.exports = hslToHex;\n","var hslToHex = require('tie-dye/hslToHex');\n\nfunction hashbow(input, saturation, lightness) {\n\n var inputAsString, sum;\n saturation = saturation || 50;\n lightness = lightness || 50;\n\n var greyValues = [null, undefined, [], {}, '', new RegExp()];\n\n if (greyValues.indexOf(input) != -1) {\n return hslToHex(0, 0, lightness);\n }\n\n switch (input.constructor) {\n case Function:\n case RegExp:\n inputAsString = input.toString();\n break;\n case Object:\n case Array:\n inputAsString = JSON.stringify(input);\n break;\n case Number:\n sum = input;\n break;\n case Boolean:\n return hslToHex(input ? 120 : 0, saturation, lightness);\n break;\n case String:\n default:\n inputAsString = input;\n }\n\n if (sum === undefined) {\n sum = 0;\n inputAsString.split('').forEach(function (letter) {\n sum += letter.charCodeAt(0);\n });\n }\n\n sum = Math.abs(sum * sum);\n\n return hslToHex(sum % 360, saturation, lightness);\n}\n\nmodule.exports = hashbow;\n","import { h, app } from \"hyperapp\"\nimport * as A from \"arcsecond\"\nimport hashbow from \"hashbow\"\n\nconst positiveNumber = A.digits.map(parseInt)\n\nconst number = A.coroutine(function*() {\n const sign = (yield A.possibly(A.choice([ A.char(\"+\"), A.char(\"-\") ]))) || \"+\"\n const number = yield A.digits\n return parseInt(sign + number)\n})\n\n// Parse a \"dice notation\" string like \"3d6+7\"\nconst diceNotationParser = A.coroutine(function*() {\n const numDice = (yield A.possibly(positiveNumber)) || 1 // Optionally parse the bit before the \"d\" - number of dice\n const modeChar = yield A.choice([A.char(\"d\"), A.char(\"u\")])\n const die = yield positiveNumber // Parse the number indicating the number of sides on the simulated di(c)e\n const offset = (yield A.possibly(number)) || 0 // Optionally parse an offset - the \"number\" parser happens to handle positives/negatives, so it works without any extra logic\n return { numDice, die, offset }\n})\n\nconst roll = ({ numDice, die, offset }) => {\n let sum = offset\n for (let i = 0; i < numDice; i++) {\n sum += Math.floor(Math.random() * die) + 1\n }\n return sum\n}\n\nconst simpleDistribution = dieSize => {\n const dist = new Map()\n for (let i = 1; i <= dieSize; i++) {\n dist.set(i, 1 / dieSize)\n }\n return dist\n}\n\nconst addDistributions = (x, y) => {\n const dist = new Map()\n for (const [xResult, xProbability] of x) {\n for (const [yResult, yProbability] of y) {\n const result = xResult + yResult\n dist.set(result, (dist.get(result) || 0) + (xProbability * yProbability))\n }\n }\n return dist\n}\n\nconst offsetDistribution = (dist, offset) => {\n const newDist = new Map()\n for (const [result, probability] of dist) {\n newDist.set(result + offset, probability)\n }\n return newDist\n}\n\nconst stats = ({ numDice, die, offset }) => {\n const lowerBound = numDice + offset\n const upperBound = numDice * die + offset\n const oneDieProbabilities = simpleDistribution(die)\n let probabilities = oneDieProbabilities\n for (let i = 1; i < numDice; i++) {\n probabilities = addDistributions(probabilities, oneDieProbabilities)\n }\n probabilities = offsetDistribution(probabilities, offset)\n return { upperBound, lowerBound, probabilities }\n}\n\nconst percentage = value => `${(value * 100).toFixed(1)}%`\n\nconst renderDistribution = dist => {\n let elements = []\n let highest = 0\n for (const [_, value] of dist) {\n if (value > highest) {\n highest = value\n }\n }\n\n let i = 0\n for (const [result, probability] of dist) {\n const fraction = probability / highest\n elements.push(h(\"rect\", { \n x: i * 50, \n y: 100 - fraction * 100, \n width: 49, \n height: fraction * 100, \n style: { fill: `rgb(0, 0, ${255 * fraction})` } }, \n [ h(\"title\", {}, percentage(probability)) ]))\n\n elements.push(h(\"text\", { x: i * 50 + 25, y: 120, width: 50, \"text-anchor\": \"middle\" }, result))\n i++\n }\n return h(\"svg\", { height: 130, width: i * 50 + 50, class: \"distribution\" }, elements)\n}\n\nconst rollButton = state => {\n if (state.dice === null) {\n return { ...state, rolls: [] }\n } else {\n return { ...state, rolls: [{ result: roll(state.dice), dice: state.dice }].concat(state.rolls).slice(0, 50) }\n }\n}\n\nconst updateDice = (state, text) => {\n const result = diceNotationParser.run(text)\n console.log(result)\n if (result.isError) {\n return { ...state, rawDice: text, error: result.error, dice: null }\n } else {\n result.result.stats = stats(result.result)\n result.result.raw = text\n return { ...state, rawDice: text, error: null, dice: result.result }\n }\n}\n\nconst renderRoll = roll => {\n const rawDice = roll.dice.raw\n return h(\"tr\", {}, [\n h(\"td\", { class: \"raw-dice\", style: { color: hashbow(rawDice) }, onClick: state => updateDice(state, rawDice) }, rawDice),\n h(\"td\", { class: \"result\" }, roll.result),\n h(\"td\", { class: \"outcome-probability\" }, percentage(roll.dice.stats.probabilities.get(roll.result)))\n ])\n}\n\nconst onDiceInput = (state, event) => updateDice(state, event.target.value)\n\napp({\n init: updateDice({ rolls: [] }, \"d6\"),\n view: state =>\n h(\"div\", {}, [\n h(\"div\", { class: \"controls\" }, [\n h(\"input\", { type: \"text\", value: state.rawDice, onInput: onDiceInput }),\n h(\"button\", { onClick: rollButton, class: \"roll-button\" }, \"Roll\"),\n ]),\n state.error !== null ? h(\"div\", { class: \"error\" }, state.error) : null,\n state.dice && state.dice.stats && state.dice.stats.probabilities && renderDistribution(state.dice.stats.probabilities),\n state.rolls.length > 0 ? h(\"h1\", {}, state.rolls[0].result) : null,\n h(\"table\", { class: \"previous-rolls\" }, [\n h(\"tr\", {}, [ h(\"th\", {}, \"Dice\"), h(\"th\", {}, \"Result\"), h(\"th\", {}, \"Chance\") ])\n ].concat(state.rolls.map(renderRoll)))\n ]),\n node: document.getElementById(\"app\")\n})"]} |