var Elm = Elm || { Native: {} };
Elm.Native.Basics = {};
Elm.Native.Basics.make = function(localRuntime) {
localRuntime.Native = localRuntime.Native || {};
localRuntime.Native.Basics = localRuntime.Native.Basics || {};
if (localRuntime.Native.Basics.values)
{
return localRuntime.Native.Basics.values;
}
var Utils = Elm.Native.Utils.make(localRuntime);
function div(a, b)
{
return (a / b) | 0;
}
function rem(a, b)
{
return a % b;
}
function mod(a, b)
{
if (b === 0)
{
throw new Error('Cannot perform mod 0. Division by zero error.');
}
var r = a % b;
var m = a === 0 ? 0 : (b > 0 ? (a >= 0 ? r : r + b) : -mod(-a, -b));
return m === b ? 0 : m;
}
function logBase(base, n)
{
return Math.log(n) / Math.log(base);
}
function negate(n)
{
return -n;
}
function abs(n)
{
return n < 0 ? -n : n;
}
function min(a, b)
{
return Utils.cmp(a, b) < 0 ? a : b;
}
function max(a, b)
{
return Utils.cmp(a, b) > 0 ? a : b;
}
function clamp(lo, hi, n)
{
return Utils.cmp(n, lo) < 0 ? lo : Utils.cmp(n, hi) > 0 ? hi : n;
}
function xor(a, b)
{
return a !== b;
}
function not(b)
{
return !b;
}
function isInfinite(n)
{
return n === Infinity || n === -Infinity;
}
function truncate(n)
{
return n | 0;
}
function degrees(d)
{
return d * Math.PI / 180;
}
function turns(t)
{
return 2 * Math.PI * t;
}
function fromPolar(point)
{
var r = point._0;
var t = point._1;
return Utils.Tuple2(r * Math.cos(t), r * Math.sin(t));
}
function toPolar(point)
{
var x = point._0;
var y = point._1;
return Utils.Tuple2(Math.sqrt(x * x + y * y), Math.atan2(y, x));
}
return localRuntime.Native.Basics.values = {
div: F2(div),
rem: F2(rem),
mod: F2(mod),
pi: Math.PI,
e: Math.E,
cos: Math.cos,
sin: Math.sin,
tan: Math.tan,
acos: Math.acos,
asin: Math.asin,
atan: Math.atan,
atan2: F2(Math.atan2),
degrees: degrees,
turns: turns,
fromPolar: fromPolar,
toPolar: toPolar,
sqrt: Math.sqrt,
logBase: F2(logBase),
negate: negate,
abs: abs,
min: F2(min),
max: F2(max),
clamp: F3(clamp),
compare: Utils.compare,
xor: F2(xor),
not: not,
truncate: truncate,
ceiling: Math.ceil,
floor: Math.floor,
round: Math.round,
toFloat: function(x) { return x; },
isNaN: isNaN,
isInfinite: isInfinite
};
};
Elm.Native.Port = {};
Elm.Native.Port.make = function(localRuntime) {
localRuntime.Native = localRuntime.Native || {};
localRuntime.Native.Port = localRuntime.Native.Port || {};
if (localRuntime.Native.Port.values)
{
return localRuntime.Native.Port.values;
}
var NS;
// INBOUND
function inbound(name, type, converter)
{
if (!localRuntime.argsTracker[name])
{
throw new Error(
'Port Error:\n' +
'No argument was given for the port named \'' + name + '\' with type:\n\n' +
' ' + type.split('\n').join('\n ') + '\n\n' +
'You need to provide an initial value!\n\n' +
'Find out more about ports here '
);
}
var arg = localRuntime.argsTracker[name];
arg.used = true;
return jsToElm(name, type, converter, arg.value);
}
function inboundSignal(name, type, converter)
{
var initialValue = inbound(name, type, converter);
if (!NS)
{
NS = Elm.Native.Signal.make(localRuntime);
}
var signal = NS.input('inbound-port-' + name, initialValue);
function send(jsValue)
{
var elmValue = jsToElm(name, type, converter, jsValue);
setTimeout(function() {
localRuntime.notify(signal.id, elmValue);
}, 0);
}
localRuntime.ports[name] = { send: send };
return signal;
}
function jsToElm(name, type, converter, value)
{
try
{
return converter(value);
}
catch(e)
{
throw new Error(
'Port Error:\n' +
'Regarding the port named \'' + name + '\' with type:\n\n' +
' ' + type.split('\n').join('\n ') + '\n\n' +
'You just sent the value:\n\n' +
' ' + JSON.stringify(value) + '\n\n' +
'but it cannot be converted to the necessary type.\n' +
e.message
);
}
}
// OUTBOUND
function outbound(name, converter, elmValue)
{
localRuntime.ports[name] = converter(elmValue);
}
function outboundSignal(name, converter, signal)
{
var subscribers = [];
function subscribe(handler)
{
subscribers.push(handler);
}
function unsubscribe(handler)
{
subscribers.pop(subscribers.indexOf(handler));
}
function notify(elmValue)
{
var jsValue = converter(elmValue);
var len = subscribers.length;
for (var i = 0; i < len; ++i)
{
subscribers[i](jsValue);
}
}
if (!NS)
{
NS = Elm.Native.Signal.make(localRuntime);
}
NS.output('outbound-port-' + name, notify, signal);
localRuntime.ports[name] = {
subscribe: subscribe,
unsubscribe: unsubscribe
};
return signal;
}
return localRuntime.Native.Port.values = {
inbound: inbound,
outbound: outbound,
inboundSignal: inboundSignal,
outboundSignal: outboundSignal
};
};
if (!Elm.fullscreen) {
(function() {
'use strict';
var Display = {
FULLSCREEN: 0,
COMPONENT: 1,
NONE: 2
};
Elm.fullscreen = function(module, args)
{
var container = document.createElement('div');
document.body.appendChild(container);
return init(Display.FULLSCREEN, container, module, args || {});
};
Elm.embed = function(module, container, args)
{
var tag = container.tagName;
if (tag !== 'DIV')
{
throw new Error('Elm.node must be given a DIV, not a ' + tag + '.');
}
return init(Display.COMPONENT, container, module, args || {});
};
Elm.worker = function(module, args)
{
return init(Display.NONE, {}, module, args || {});
};
function init(display, container, module, args, moduleToReplace)
{
// defining state needed for an instance of the Elm RTS
var inputs = [];
/* OFFSET
* Elm's time traveling debugger lets you pause time. This means
* "now" may be shifted a bit into the past. By wrapping Date.now()
* we can manage this.
*/
var timer = {
programStart: Date.now(),
now: function()
{
return Date.now();
}
};
var updateInProgress = false;
function notify(id, v)
{
if (updateInProgress)
{
throw new Error(
'The notify function has been called synchronously!\n' +
'This can lead to frames being dropped.\n' +
'Definitely report this to \n');
}
updateInProgress = true;
var timestep = timer.now();
for (var i = inputs.length; i--; )
{
inputs[i].notify(timestep, id, v);
}
updateInProgress = false;
}
function setTimeout(func, delay)
{
return window.setTimeout(func, delay);
}
var listeners = [];
function addListener(relevantInputs, domNode, eventName, func)
{
domNode.addEventListener(eventName, func);
var listener = {
relevantInputs: relevantInputs,
domNode: domNode,
eventName: eventName,
func: func
};
listeners.push(listener);
}
var argsTracker = {};
for (var name in args)
{
argsTracker[name] = {
value: args[name],
used: false
};
}
// create the actual RTS. Any impure modules will attach themselves to this
// object. This permits many Elm programs to be embedded per document.
var elm = {
notify: notify,
setTimeout: setTimeout,
node: container,
addListener: addListener,
inputs: inputs,
timer: timer,
argsTracker: argsTracker,
ports: {},
isFullscreen: function() { return display === Display.FULLSCREEN; },
isEmbed: function() { return display === Display.COMPONENT; },
isWorker: function() { return display === Display.NONE; }
};
function swap(newModule)
{
removeListeners(listeners);
var div = document.createElement('div');
var newElm = init(display, div, newModule, args, elm);
inputs = [];
return newElm;
}
function dispose()
{
removeListeners(listeners);
inputs = [];
}
var Module = {};
try
{
Module = module.make(elm);
checkInputs(elm);
}
catch (error)
{
if (typeof container.appendChild === "function")
{
container.appendChild(errorNode(error.message));
}
else
{
console.error(error.message);
}
throw error;
}
if (display !== Display.NONE)
{
var graphicsNode = initGraphics(elm, Module);
}
var rootNode = { kids: inputs };
trimDeadNodes(rootNode);
inputs = rootNode.kids;
filterListeners(inputs, listeners);
addReceivers(elm.ports);
if (typeof moduleToReplace !== 'undefined')
{
hotSwap(moduleToReplace, elm);
// rerender scene if graphics are enabled.
if (typeof graphicsNode !== 'undefined')
{
graphicsNode.notify(0, true, 0);
}
}
return {
swap: swap,
ports: elm.ports,
dispose: dispose
};
}
function checkInputs(elm)
{
var argsTracker = elm.argsTracker;
for (var name in argsTracker)
{
if (!argsTracker[name].used)
{
throw new Error(
"Port Error:\nYou provided an argument named '" + name +
"' but there is no corresponding port!\n\n" +
"Maybe add a port '" + name + "' to your Elm module?\n" +
"Maybe remove the '" + name + "' argument from your initialization code in JS?"
);
}
}
}
function errorNode(message)
{
var code = document.createElement('code');
var lines = message.split('\n');
code.appendChild(document.createTextNode(lines[0]));
code.appendChild(document.createElement('br'));
code.appendChild(document.createElement('br'));
for (var i = 1; i < lines.length; ++i)
{
code.appendChild(document.createTextNode('\u00A0 \u00A0 ' + lines[i].replace(/ /g, '\u00A0 ')));
code.appendChild(document.createElement('br'));
}
code.appendChild(document.createElement('br'));
code.appendChild(document.createTextNode('Open the developer console for more details.'));
return code;
}
//// FILTER SIGNALS ////
// TODO: move this code into the signal module and create a function
// Signal.initializeGraph that actually instantiates everything.
function filterListeners(inputs, listeners)
{
loop:
for (var i = listeners.length; i--; )
{
var listener = listeners[i];
for (var j = inputs.length; j--; )
{
if (listener.relevantInputs.indexOf(inputs[j].id) >= 0)
{
continue loop;
}
}
listener.domNode.removeEventListener(listener.eventName, listener.func);
}
}
function removeListeners(listeners)
{
for (var i = listeners.length; i--; )
{
var listener = listeners[i];
listener.domNode.removeEventListener(listener.eventName, listener.func);
}
}
// add receivers for built-in ports if they are defined
function addReceivers(ports)
{
if ('title' in ports)
{
if (typeof ports.title === 'string')
{
document.title = ports.title;
}
else
{
ports.title.subscribe(function(v) { document.title = v; });
}
}
if ('redirect' in ports)
{
ports.redirect.subscribe(function(v) {
if (v.length > 0)
{
window.location = v;
}
});
}
}
// returns a boolean representing whether the node is alive or not.
function trimDeadNodes(node)
{
if (node.isOutput)
{
return true;
}
var liveKids = [];
for (var i = node.kids.length; i--; )
{
var kid = node.kids[i];
if (trimDeadNodes(kid))
{
liveKids.push(kid);
}
}
node.kids = liveKids;
return liveKids.length > 0;
}
//// RENDERING ////
function initGraphics(elm, Module)
{
if (!('main' in Module))
{
throw new Error("'main' is missing! What do I display?!");
}
var signalGraph = Module.main;
// make sure the signal graph is actually a signal & extract the visual model
if (!('notify' in signalGraph))
{
signalGraph = Elm.Signal.make(elm).constant(signalGraph);
}
var initialScene = signalGraph.value;
// Figure out what the render functions should be
var render;
var update;
if (initialScene.ctor === 'Element_elm_builtin')
{
var Element = Elm.Native.Graphics.Element.make(elm);
render = Element.render;
update = Element.updateAndReplace;
}
else
{
var VirtualDom = Elm.Native.VirtualDom.make(elm);
render = VirtualDom.render;
update = VirtualDom.updateAndReplace;
}
// Add the initialScene to the DOM
var container = elm.node;
var node = render(initialScene);
while (container.firstChild)
{
container.removeChild(container.firstChild);
}
container.appendChild(node);
var _requestAnimationFrame =
typeof requestAnimationFrame !== 'undefined'
? requestAnimationFrame
: function(cb) { setTimeout(cb, 1000 / 60); }
;
// domUpdate is called whenever the main Signal changes.
//
// domUpdate and drawCallback implement a small state machine in order
// to schedule only 1 draw per animation frame. This enforces that
// once draw has been called, it will not be called again until the
// next frame.
//
// drawCallback is scheduled whenever
// 1. The state transitions from PENDING_REQUEST to EXTRA_REQUEST, or
// 2. The state transitions from NO_REQUEST to PENDING_REQUEST
//
// Invariants:
// 1. In the NO_REQUEST state, there is never a scheduled drawCallback.
// 2. In the PENDING_REQUEST and EXTRA_REQUEST states, there is always exactly 1
// scheduled drawCallback.
var NO_REQUEST = 0;
var PENDING_REQUEST = 1;
var EXTRA_REQUEST = 2;
var state = NO_REQUEST;
var savedScene = initialScene;
var scheduledScene = initialScene;
function domUpdate(newScene)
{
scheduledScene = newScene;
switch (state)
{
case NO_REQUEST:
_requestAnimationFrame(drawCallback);
state = PENDING_REQUEST;
return;
case PENDING_REQUEST:
state = PENDING_REQUEST;
return;
case EXTRA_REQUEST:
state = PENDING_REQUEST;
return;
}
}
function drawCallback()
{
switch (state)
{
case NO_REQUEST:
// This state should not be possible. How can there be no
// request, yet somehow we are actively fulfilling a
// request?
throw new Error(
'Unexpected draw callback.\n' +
'Please report this to .'
);
case PENDING_REQUEST:
// At this point, we do not *know* that another frame is
// needed, but we make an extra request to rAF just in
// case. It's possible to drop a frame if rAF is called
// too late, so we just do it preemptively.
_requestAnimationFrame(drawCallback);
state = EXTRA_REQUEST;
// There's also stuff we definitely need to draw.
draw();
return;
case EXTRA_REQUEST:
// Turns out the extra request was not needed, so we will
// stop calling rAF. No reason to call it all the time if
// no one needs it.
state = NO_REQUEST;
return;
}
}
function draw()
{
update(elm.node.firstChild, savedScene, scheduledScene);
if (elm.Native.Window)
{
elm.Native.Window.values.resizeIfNeeded();
}
savedScene = scheduledScene;
}
var renderer = Elm.Native.Signal.make(elm).output('main', domUpdate, signalGraph);
// must check for resize after 'renderer' is created so
// that changes show up.
if (elm.Native.Window)
{
elm.Native.Window.values.resizeIfNeeded();
}
return renderer;
}
//// HOT SWAPPING ////
// Returns boolean indicating if the swap was successful.
// Requires that the two signal graphs have exactly the same
// structure.
function hotSwap(from, to)
{
function similar(nodeOld, nodeNew)
{
if (nodeOld.id !== nodeNew.id)
{
return false;
}
if (nodeOld.isOutput)
{
return nodeNew.isOutput;
}
return nodeOld.kids.length === nodeNew.kids.length;
}
function swap(nodeOld, nodeNew)
{
nodeNew.value = nodeOld.value;
return true;
}
var canSwap = depthFirstTraversals(similar, from.inputs, to.inputs);
if (canSwap)
{
depthFirstTraversals(swap, from.inputs, to.inputs);
}
from.node.parentNode.replaceChild(to.node, from.node);
return canSwap;
}
// Returns false if the node operation f ever fails.
function depthFirstTraversals(f, queueOld, queueNew)
{
if (queueOld.length !== queueNew.length)
{
return false;
}
queueOld = queueOld.slice(0);
queueNew = queueNew.slice(0);
var seen = [];
while (queueOld.length > 0 && queueNew.length > 0)
{
var nodeOld = queueOld.pop();
var nodeNew = queueNew.pop();
if (seen.indexOf(nodeOld.id) < 0)
{
if (!f(nodeOld, nodeNew))
{
return false;
}
queueOld = queueOld.concat(nodeOld.kids || []);
queueNew = queueNew.concat(nodeNew.kids || []);
seen.push(nodeOld.id);
}
}
return true;
}
}());
function F2(fun)
{
function wrapper(a) { return function(b) { return fun(a,b); }; }
wrapper.arity = 2;
wrapper.func = fun;
return wrapper;
}
function F3(fun)
{
function wrapper(a) {
return function(b) { return function(c) { return fun(a, b, c); }; };
}
wrapper.arity = 3;
wrapper.func = fun;
return wrapper;
}
function F4(fun)
{
function wrapper(a) { return function(b) { return function(c) {
return function(d) { return fun(a, b, c, d); }; }; };
}
wrapper.arity = 4;
wrapper.func = fun;
return wrapper;
}
function F5(fun)
{
function wrapper(a) { return function(b) { return function(c) {
return function(d) { return function(e) { return fun(a, b, c, d, e); }; }; }; };
}
wrapper.arity = 5;
wrapper.func = fun;
return wrapper;
}
function F6(fun)
{
function wrapper(a) { return function(b) { return function(c) {
return function(d) { return function(e) { return function(f) {
return fun(a, b, c, d, e, f); }; }; }; }; };
}
wrapper.arity = 6;
wrapper.func = fun;
return wrapper;
}
function F7(fun)
{
function wrapper(a) { return function(b) { return function(c) {
return function(d) { return function(e) { return function(f) {
return function(g) { return fun(a, b, c, d, e, f, g); }; }; }; }; }; };
}
wrapper.arity = 7;
wrapper.func = fun;
return wrapper;
}
function F8(fun)
{
function wrapper(a) { return function(b) { return function(c) {
return function(d) { return function(e) { return function(f) {
return function(g) { return function(h) {
return fun(a, b, c, d, e, f, g, h); }; }; }; }; }; }; };
}
wrapper.arity = 8;
wrapper.func = fun;
return wrapper;
}
function F9(fun)
{
function wrapper(a) { return function(b) { return function(c) {
return function(d) { return function(e) { return function(f) {
return function(g) { return function(h) { return function(i) {
return fun(a, b, c, d, e, f, g, h, i); }; }; }; }; }; }; }; };
}
wrapper.arity = 9;
wrapper.func = fun;
return wrapper;
}
function A2(fun, a, b)
{
return fun.arity === 2
? fun.func(a, b)
: fun(a)(b);
}
function A3(fun, a, b, c)
{
return fun.arity === 3
? fun.func(a, b, c)
: fun(a)(b)(c);
}
function A4(fun, a, b, c, d)
{
return fun.arity === 4
? fun.func(a, b, c, d)
: fun(a)(b)(c)(d);
}
function A5(fun, a, b, c, d, e)
{
return fun.arity === 5
? fun.func(a, b, c, d, e)
: fun(a)(b)(c)(d)(e);
}
function A6(fun, a, b, c, d, e, f)
{
return fun.arity === 6
? fun.func(a, b, c, d, e, f)
: fun(a)(b)(c)(d)(e)(f);
}
function A7(fun, a, b, c, d, e, f, g)
{
return fun.arity === 7
? fun.func(a, b, c, d, e, f, g)
: fun(a)(b)(c)(d)(e)(f)(g);
}
function A8(fun, a, b, c, d, e, f, g, h)
{
return fun.arity === 8
? fun.func(a, b, c, d, e, f, g, h)
: fun(a)(b)(c)(d)(e)(f)(g)(h);
}
function A9(fun, a, b, c, d, e, f, g, h, i)
{
return fun.arity === 9
? fun.func(a, b, c, d, e, f, g, h, i)
: fun(a)(b)(c)(d)(e)(f)(g)(h)(i);
}
}
Elm.Native = Elm.Native || {};
Elm.Native.Utils = {};
Elm.Native.Utils.make = function(localRuntime) {
localRuntime.Native = localRuntime.Native || {};
localRuntime.Native.Utils = localRuntime.Native.Utils || {};
if (localRuntime.Native.Utils.values)
{
return localRuntime.Native.Utils.values;
}
// COMPARISONS
function eq(l, r)
{
var stack = [{'x': l, 'y': r}];
while (stack.length > 0)
{
var front = stack.pop();
var x = front.x;
var y = front.y;
if (x === y)
{
continue;
}
if (typeof x === 'object')
{
var c = 0;
for (var i in x)
{
++c;
if (i in y)
{
if (i !== 'ctor')
{
stack.push({ 'x': x[i], 'y': y[i] });
}
}
else
{
return false;
}
}
if ('ctor' in x)
{
stack.push({'x': x.ctor, 'y': y.ctor});
}
if (c !== Object.keys(y).length)
{
return false;
}
}
else if (typeof x === 'function')
{
throw new Error('Equality error: general function equality is ' +
'undecidable, and therefore, unsupported');
}
else
{
return false;
}
}
return true;
}
// code in Generate/JavaScript.hs depends on the particular
// integer values assigned to LT, EQ, and GT
var LT = -1, EQ = 0, GT = 1, ord = ['LT', 'EQ', 'GT'];
function compare(x, y)
{
return {
ctor: ord[cmp(x, y) + 1]
};
}
function cmp(x, y) {
var ord;
if (typeof x !== 'object')
{
return x === y ? EQ : x < y ? LT : GT;
}
else if (x.isChar)
{
var a = x.toString();
var b = y.toString();
return a === b
? EQ
: a < b
? LT
: GT;
}
else if (x.ctor === '::' || x.ctor === '[]')
{
while (true)
{
if (x.ctor === '[]' && y.ctor === '[]')
{
return EQ;
}
if (x.ctor !== y.ctor)
{
return x.ctor === '[]' ? LT : GT;
}
ord = cmp(x._0, y._0);
if (ord !== EQ)
{
return ord;
}
x = x._1;
y = y._1;
}
}
else if (x.ctor.slice(0, 6) === '_Tuple')
{
var n = x.ctor.slice(6) - 0;
var err = 'cannot compare tuples with more than 6 elements.';
if (n === 0) return EQ;
if (n >= 1) { ord = cmp(x._0, y._0); if (ord !== EQ) return ord;
if (n >= 2) { ord = cmp(x._1, y._1); if (ord !== EQ) return ord;
if (n >= 3) { ord = cmp(x._2, y._2); if (ord !== EQ) return ord;
if (n >= 4) { ord = cmp(x._3, y._3); if (ord !== EQ) return ord;
if (n >= 5) { ord = cmp(x._4, y._4); if (ord !== EQ) return ord;
if (n >= 6) { ord = cmp(x._5, y._5); if (ord !== EQ) return ord;
if (n >= 7) throw new Error('Comparison error: ' + err); } } } } } }
return EQ;
}
else
{
throw new Error('Comparison error: comparison is only defined on ints, ' +
'floats, times, chars, strings, lists of comparable values, ' +
'and tuples of comparable values.');
}
}
// TUPLES
var Tuple0 = {
ctor: '_Tuple0'
};
function Tuple2(x, y)
{
return {
ctor: '_Tuple2',
_0: x,
_1: y
};
}
// LITERALS
function chr(c)
{
var x = new String(c);
x.isChar = true;
return x;
}
function txt(str)
{
var t = new String(str);
t.text = true;
return t;
}
// GUID
var count = 0;
function guid(_)
{
return count++;
}
// RECORDS
function update(oldRecord, updatedFields)
{
var newRecord = {};
for (var key in oldRecord)
{
var value = (key in updatedFields) ? updatedFields[key] : oldRecord[key];
newRecord[key] = value;
}
return newRecord;
}
// MOUSE COORDINATES
function getXY(e)
{
var posx = 0;
var posy = 0;
if (e.pageX || e.pageY)
{
posx = e.pageX;
posy = e.pageY;
}
else if (e.clientX || e.clientY)
{
posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
if (localRuntime.isEmbed())
{
var rect = localRuntime.node.getBoundingClientRect();
var relx = rect.left + document.body.scrollLeft + document.documentElement.scrollLeft;
var rely = rect.top + document.body.scrollTop + document.documentElement.scrollTop;
// TODO: figure out if there is a way to avoid rounding here
posx = posx - Math.round(relx) - localRuntime.node.clientLeft;
posy = posy - Math.round(rely) - localRuntime.node.clientTop;
}
return Tuple2(posx, posy);
}
//// LIST STUFF ////
var Nil = { ctor: '[]' };
function Cons(hd, tl)
{
return {
ctor: '::',
_0: hd,
_1: tl
};
}
function list(arr)
{
var out = Nil;
for (var i = arr.length; i--; )
{
out = Cons(arr[i], out);
}
return out;
}
function range(lo, hi)
{
var list = Nil;
if (lo <= hi)
{
do
{
list = Cons(hi, list);
}
while (hi-- > lo);
}
return list;
}
function append(xs, ys)
{
// append Strings
if (typeof xs === 'string')
{
return xs + ys;
}
// append Text
if (xs.ctor.slice(0, 5) === 'Text:')
{
return {
ctor: 'Text:Append',
_0: xs,
_1: ys
};
}
// append Lists
if (xs.ctor === '[]')
{
return ys;
}
var root = Cons(xs._0, Nil);
var curr = root;
xs = xs._1;
while (xs.ctor !== '[]')
{
curr._1 = Cons(xs._0, Nil);
xs = xs._1;
curr = curr._1;
}
curr._1 = ys;
return root;
}
// CRASHES
function crash(moduleName, region)
{
return function(message) {
throw new Error(
'Ran into a `Debug.crash` in module `' + moduleName + '` ' + regionToString(region) + '\n'
+ 'The message provided by the code author is:\n\n '
+ message
);
};
}
function crashCase(moduleName, region, value)
{
return function(message) {
throw new Error(
'Ran into a `Debug.crash` in module `' + moduleName + '`\n\n'
+ 'This was caused by the `case` expression ' + regionToString(region) + '.\n'
+ 'One of the branches ended with a crash and the following value got through:\n\n ' + toString(value) + '\n\n'
+ 'The message provided by the code author is:\n\n '
+ message
);
};
}
function regionToString(region)
{
if (region.start.line == region.end.line)
{
return 'on line ' + region.start.line;
}
return 'between lines ' + region.start.line + ' and ' + region.end.line;
}
// BAD PORTS
function badPort(expected, received)
{
throw new Error(
'Runtime error when sending values through a port.\n\n'
+ 'Expecting ' + expected + ' but was given ' + formatValue(received)
);
}
function formatValue(value)
{
// Explicity format undefined values as "undefined"
// because JSON.stringify(undefined) unhelpfully returns ""
return (value === undefined) ? "undefined" : JSON.stringify(value);
}
// TO STRING
var _Array;
var Dict;
var List;
var toString = function(v)
{
var type = typeof v;
if (type === 'function')
{
var name = v.func ? v.func.name : v.name;
return '';
}
else if (type === 'boolean')
{
return v ? 'True' : 'False';
}
else if (type === 'number')
{
return v + '';
}
else if ((v instanceof String) && v.isChar)
{
return '\'' + addSlashes(v, true) + '\'';
}
else if (type === 'string')
{
return '"' + addSlashes(v, false) + '"';
}
else if (type === 'object' && 'ctor' in v)
{
if (v.ctor.substring(0, 6) === '_Tuple')
{
var output = [];
for (var k in v)
{
if (k === 'ctor') continue;
output.push(toString(v[k]));
}
return '(' + output.join(',') + ')';
}
else if (v.ctor === '_Array')
{
if (!_Array)
{
_Array = Elm.Array.make(localRuntime);
}
var list = _Array.toList(v);
return 'Array.fromList ' + toString(list);
}
else if (v.ctor === '::')
{
var output = '[' + toString(v._0);
v = v._1;
while (v.ctor === '::')
{
output += ',' + toString(v._0);
v = v._1;
}
return output + ']';
}
else if (v.ctor === '[]')
{
return '[]';
}
else if (v.ctor === 'RBNode_elm_builtin' || v.ctor === 'RBEmpty_elm_builtin' || v.ctor === 'Set_elm_builtin')
{
if (!Dict)
{
Dict = Elm.Dict.make(localRuntime);
}
var list;
var name;
if (v.ctor === 'Set_elm_builtin')
{
if (!List)
{
List = Elm.List.make(localRuntime);
}
name = 'Set';
list = A2(List.map, function(x) {return x._0; }, Dict.toList(v._0));
}
else
{
name = 'Dict';
list = Dict.toList(v);
}
return name + '.fromList ' + toString(list);
}
else if (v.ctor.slice(0, 5) === 'Text:')
{
return '';
}
else if (v.ctor === 'Element_elm_builtin')
{
return ''
}
else if (v.ctor === 'Form_elm_builtin')
{
return '
"+escape(e.message+"",true)+"
"}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}).call(function(){return this||(typeof window!=="undefined"?window:global)}());
return module.exports;
})();
function formatOptions(options) {
var toHighlight = function (code, lang) {
if (!lang && options.defaultHighlighting.ctor === 'Just')
{
lang = options.defaultHighlighting._0;
}
if (typeof hljs !== 'undefined'
&& lang
&& hljs.listLanguages().indexOf(lang) >= 0)
{
return hljs.highlight(lang, code, true).value;
}
return code;
};
var gfm = options.githubFlavored;
if (gfm.ctor === 'Just')
{
return {
highlight: toHighlight,
gfm: true,
tables: gfm._0.tables,
breaks: gfm._0.breaks,
sanitize: options.sanitize,
smartypants: options.smartypants
};
}
else
{
return {
highlight: toHighlight,
gfm: false,
tables: false,
breaks: false,
sanitize: options.sanitize,
smartypants: options.smartypants
};
}
}
function toHtmlWith(options, rawMarkdown)
{
return new MarkdownWidget(options, rawMarkdown);
}
function MarkdownWidget(options, rawMarkdown)
{
this.options = options;
this.markdown = rawMarkdown;
}
MarkdownWidget.prototype.type = "Widget";
MarkdownWidget.prototype.init = function init()
{
var html = marked(this.markdown, formatOptions(this.options));
var div = document.createElement('div');
div.innerHTML = html;
return div;
};
MarkdownWidget.prototype.update = function update(previous, node)
{
if (this.markdown !== previous.markdown || this.options != previous.options)
{
var html = marked(this.markdown, formatOptions(this.options));
node.innerHTML = html;
}
return node;
};
function toElementWith(options, rawMarkdown)
{
return Element.markdown(marked(rawMarkdown, formatOptions(options)));
}
return Elm.Native.Markdown.values = {
toHtmlWith: F2(toHtmlWith),
toElementWith: F2(toElementWith)
};
};
Elm.Markdown = Elm.Markdown || {};
Elm.Markdown.make = function (_elm) {
"use strict";
_elm.Markdown = _elm.Markdown || {};
if (_elm.Markdown.values) return _elm.Markdown.values;
var _U = Elm.Native.Utils.make(_elm),
$Basics = Elm.Basics.make(_elm),
$Debug = Elm.Debug.make(_elm),
$Graphics$Element = Elm.Graphics.Element.make(_elm),
$Html = Elm.Html.make(_elm),
$List = Elm.List.make(_elm),
$Maybe = Elm.Maybe.make(_elm),
$Native$Markdown = Elm.Native.Markdown.make(_elm),
$Result = Elm.Result.make(_elm),
$Signal = Elm.Signal.make(_elm);
var _op = {};
var toElementWith = $Native$Markdown.toElementWith;
var toHtmlWith = $Native$Markdown.toHtmlWith;
var defaultOptions = {githubFlavored: $Maybe.Just({tables: false,breaks: false}),defaultHighlighting: $Maybe.Nothing,sanitize: false,smartypants: false};
var Options = F4(function (a,b,c,d) { return {githubFlavored: a,defaultHighlighting: b,sanitize: c,smartypants: d};});
var toElement = function (string) { return A2($Native$Markdown.toElementWith,defaultOptions,string);};
var toHtml = function (string) { return A2($Native$Markdown.toHtmlWith,defaultOptions,string);};
return _elm.Markdown.values = {_op: _op
,toHtml: toHtml
,toElement: toElement
,Options: Options
,defaultOptions: defaultOptions
,toHtmlWith: toHtmlWith
,toElementWith: toElementWith};
};
Elm.Html = Elm.Html || {};
Elm.Html.Events = Elm.Html.Events || {};
Elm.Html.Events.make = function (_elm) {
"use strict";
_elm.Html = _elm.Html || {};
_elm.Html.Events = _elm.Html.Events || {};
if (_elm.Html.Events.values) return _elm.Html.Events.values;
var _U = Elm.Native.Utils.make(_elm),
$Basics = Elm.Basics.make(_elm),
$Debug = Elm.Debug.make(_elm),
$Html = Elm.Html.make(_elm),
$Json$Decode = Elm.Json.Decode.make(_elm),
$List = Elm.List.make(_elm),
$Maybe = Elm.Maybe.make(_elm),
$Result = Elm.Result.make(_elm),
$Signal = Elm.Signal.make(_elm),
$VirtualDom = Elm.VirtualDom.make(_elm);
var _op = {};
var keyCode = A2($Json$Decode._op[":="],"keyCode",$Json$Decode.$int);
var targetChecked = A2($Json$Decode.at,_U.list(["target","checked"]),$Json$Decode.bool);
var targetValue = A2($Json$Decode.at,_U.list(["target","value"]),$Json$Decode.string);
var defaultOptions = $VirtualDom.defaultOptions;
var Options = F2(function (a,b) { return {stopPropagation: a,preventDefault: b};});
var onWithOptions = $VirtualDom.onWithOptions;
var on = $VirtualDom.on;
var messageOn = F3(function (name,addr,msg) { return A3(on,name,$Json$Decode.value,function (_p0) { return A2($Signal.message,addr,msg);});});
var onClick = messageOn("click");
var onDoubleClick = messageOn("dblclick");
var onMouseMove = messageOn("mousemove");
var onMouseDown = messageOn("mousedown");
var onMouseUp = messageOn("mouseup");
var onMouseEnter = messageOn("mouseenter");
var onMouseLeave = messageOn("mouseleave");
var onMouseOver = messageOn("mouseover");
var onMouseOut = messageOn("mouseout");
var onBlur = messageOn("blur");
var onFocus = messageOn("focus");
var onSubmit = messageOn("submit");
var onKey = F3(function (name,addr,handler) { return A3(on,name,keyCode,function (code) { return A2($Signal.message,addr,handler(code));});});
var onKeyUp = onKey("keyup");
var onKeyDown = onKey("keydown");
var onKeyPress = onKey("keypress");
return _elm.Html.Events.values = {_op: _op
,onBlur: onBlur
,onFocus: onFocus
,onSubmit: onSubmit
,onKeyUp: onKeyUp
,onKeyDown: onKeyDown
,onKeyPress: onKeyPress
,onClick: onClick
,onDoubleClick: onDoubleClick
,onMouseMove: onMouseMove
,onMouseDown: onMouseDown
,onMouseUp: onMouseUp
,onMouseEnter: onMouseEnter
,onMouseLeave: onMouseLeave
,onMouseOver: onMouseOver
,onMouseOut: onMouseOut
,on: on
,onWithOptions: onWithOptions
,defaultOptions: defaultOptions
,targetValue: targetValue
,targetChecked: targetChecked
,keyCode: keyCode
,Options: Options};
};
Elm.Material = Elm.Material || {};
Elm.Material.Ripple = Elm.Material.Ripple || {};
Elm.Material.Ripple.make = function (_elm) {
"use strict";
_elm.Material = _elm.Material || {};
_elm.Material.Ripple = _elm.Material.Ripple || {};
if (_elm.Material.Ripple.values) return _elm.Material.Ripple.values;
var _U = Elm.Native.Utils.make(_elm),
$Basics = Elm.Basics.make(_elm),
$DOM = Elm.DOM.make(_elm),
$Debug = Elm.Debug.make(_elm),
$Effects = Elm.Effects.make(_elm),
$Html = Elm.Html.make(_elm),
$Html$Attributes = Elm.Html.Attributes.make(_elm),
$Html$Events = Elm.Html.Events.make(_elm),
$Json$Decode = Elm.Json.Decode.make(_elm),
$List = Elm.List.make(_elm),
$Material$Helpers = Elm.Material.Helpers.make(_elm),
$Maybe = Elm.Maybe.make(_elm),
$Result = Elm.Result.make(_elm),
$Signal = Elm.Signal.make(_elm);
var _op = {};
var styles = F2(function (m,frame) {
var r = m.rect;
var toPx = function (k) { return A2($Basics._op["++"],$Basics.toString($Basics.round(k)),"px");};
var offset = A2($Basics._op["++"],"translate(",A2($Basics._op["++"],toPx(m.x),A2($Basics._op["++"],", ",A2($Basics._op["++"],toPx(m.y),")"))));
var rippleSize = toPx($Basics.sqrt(r.width * r.width + r.height * r.height) * 2.0 + 2.0);
var scale = _U.eq(frame,0) ? "scale(0.0001, 0.0001)" : "";
var transformString = A2($Basics._op["++"],"translate(-50%, -50%) ",A2($Basics._op["++"],offset,scale));
return _U.list([{ctor: "_Tuple2",_0: "width",_1: rippleSize}
,{ctor: "_Tuple2",_0: "height",_1: rippleSize}
,{ctor: "_Tuple2",_0: "-webkit-transform",_1: transformString}
,{ctor: "_Tuple2",_0: "-ms-transform",_1: transformString}
,{ctor: "_Tuple2",_0: "transform",_1: transformString}]);
});
var Tick = {ctor: "Tick"};
var Up = {ctor: "Up"};
var upOn = F2(function (name,addr) {
return A3($Html$Events.on,
name,
$Json$Decode.succeed({ctor: "_Tuple0"}),
function (_p0) {
return A2($Signal.message,addr,function (_p1) { return Up;}(_p0));
});
});
var Down = function (a) { return {ctor: "Down",_0: a};};
var Geometry = F5(function (a,b,c,d,e) { return {rect: a,clientX: b,clientY: c,touchX: d,touchY: e};});
var geometryDecoder = A6($Json$Decode.object5,
Geometry,
$DOM.target($DOM.boundingClientRect),
$Json$Decode.maybe(A2($Json$Decode._op[":="],"clientX",$Json$Decode.$float)),
$Json$Decode.maybe(A2($Json$Decode._op[":="],"clientY",$Json$Decode.$float)),
$Json$Decode.maybe(A2($Json$Decode.at,_U.list(["touches","0","clientX"]),$Json$Decode.$float)),
$Json$Decode.maybe(A2($Json$Decode.at,_U.list(["touches","0","clientY"]),$Json$Decode.$float)));
var downOn = F2(function (name,addr) { return A3($Html$Events.on,name,geometryDecoder,function (_p2) { return A2($Signal.message,addr,Down(_p2));});});
var Model = F2(function (a,b) { return {animation: a,metrics: b};});
var Inert = {ctor: "Inert"};
var model = {animation: Inert,metrics: $Maybe.Nothing};
var Frame = function (a) { return {ctor: "Frame",_0: a};};
var view = F3(function (addr,attrs,model) {
var styling = function () {
var _p3 = {ctor: "_Tuple2",_0: model.metrics,_1: model.animation};
if (_p3.ctor === "_Tuple2" && _p3._0.ctor === "Just") {
if (_p3._1.ctor === "Frame") {
return A2(styles,_p3._0._0,_p3._1._0);
} else {
return A2(styles,_p3._0._0,1);
}
} else {
return _U.list([]);
}
}();
return A2($Html.span,
A2($List._op["::"],
A2(downOn,"mousedown",addr),
A2($List._op["::"],
A2(downOn,"touchstart",addr),
A2($List._op["::"],
A2(upOn,"mouseup",addr),
A2($List._op["::"],A2(upOn,"mouseleave",addr),A2($List._op["::"],A2(upOn,"touchend",addr),A2($List._op["::"],A2(upOn,"blur",addr),attrs)))))),
_U.list([A2($Html.span,
_U.list([$Html$Attributes.classList(_U.list([{ctor: "_Tuple2",_0: "mdl-ripple",_1: true}
,{ctor: "_Tuple2",_0: "is-animating",_1: !_U.eq(model.animation,Frame(0))}
,{ctor: "_Tuple2",_0: "is-visible",_1: !_U.eq(model.animation,Inert)}]))
,$Html$Attributes.style(styling)]),
_U.list([]))]));
});
var Metrics = F3(function (a,b,c) { return {rect: a,x: b,y: c};});
var computeMetrics = function (g) {
var rect = g.rect;
var set = F2(function (x,y) { return $Maybe.Just({ctor: "_Tuple2",_0: x - rect.left,_1: y - rect.top});});
return A2($Maybe.map,
function (_p4) {
var _p5 = _p4;
return A3(Metrics,rect,_p5._0,_p5._1);
},
function () {
var _p6 = {ctor: "_Tuple4",_0: g.clientX,_1: g.clientY,_2: g.touchX,_3: g.touchY};
_v2_3: do {
if (_p6.ctor === "_Tuple4") {
if (_p6._0.ctor === "Just" && _p6._1.ctor === "Just") {
if (_p6._0._0 === 0.0 && _p6._1._0 === 0.0) {
return $Maybe.Just({ctor: "_Tuple2",_0: rect.width / 2.0,_1: rect.height / 2.0});
} else {
return A2(set,_p6._0._0,_p6._1._0);
}
} else {
if (_p6._2.ctor === "Just" && _p6._3.ctor === "Just") {
return A2(set,_p6._2._0,_p6._3._0);
} else {
break _v2_3;
}
}
} else {
break _v2_3;
}
} while (false);
return $Maybe.Nothing;
}());
};
var update = F2(function (action,model) {
var _p7 = action;
switch (_p7.ctor)
{case "Down": return A2($Material$Helpers.effect,
$Effects.tick(function (_p8) { return Tick;}),
_U.update(model,{animation: Frame(0),metrics: computeMetrics(_p7._0)}));
case "Up": return A2($Material$Helpers.effect,$Effects.none,_U.update(model,{animation: Inert}));
default: return A2($Material$Helpers.effect,$Effects.none,_U.update(model,{animation: Frame(1)}));}
});
return _elm.Material.Ripple.values = {_op: _op
,Metrics: Metrics
,Frame: Frame
,Inert: Inert
,Model: Model
,model: model
,Geometry: Geometry
,geometryDecoder: geometryDecoder
,computeMetrics: computeMetrics
,Down: Down
,Up: Up
,Tick: Tick
,update: update
,downOn: downOn
,upOn: upOn
,styles: styles
,view: view};
};
Elm.Material = Elm.Material || {};
Elm.Material.Component = Elm.Material.Component || {};
Elm.Material.Component.make = function (_elm) {
"use strict";
_elm.Material = _elm.Material || {};
_elm.Material.Component = _elm.Material.Component || {};
if (_elm.Material.Component.values) return _elm.Material.Component.values;
var _U = Elm.Native.Utils.make(_elm),
$Basics = Elm.Basics.make(_elm),
$Debug = Elm.Debug.make(_elm),
$Dict = Elm.Dict.make(_elm),
$Effects = Elm.Effects.make(_elm),
$List = Elm.List.make(_elm),
$Material$Helpers = Elm.Material.Helpers.make(_elm),
$Maybe = Elm.Maybe.make(_elm),
$Result = Elm.Result.make(_elm),
$Signal = Elm.Signal.make(_elm),
$Task = Elm.Task.make(_elm);
var _op = {};
var pick = F2(function (f,xs) {
pick: while (true) {
var _p0 = xs;
if (_p0.ctor === "[]") {
return $Maybe.Nothing;
} else {
var _p1 = f(_p0._0);
if (_p1.ctor === "Nothing") {
var _v2 = f,_v3 = _p0._1;
f = _v2;
xs = _v3;
continue pick;
} else {
return _p1;
}
}
}
});
var connect = F2(function (observers,subaction) { return A2(pick,F2(function (x,y) { return y(x);})(subaction),observers);});
var observe = F3(function (f,update,action) {
return function (_p2) {
return function (_p3) {
var _p4 = _p3;
return {ctor: "_Tuple3",_0: _p4._0,_1: _p4._1,_2: f(action)};
}(A2(update,action,_p2));
};
});
var Instance = F5(function (a,b,c,d,e) { return {view: a,get: b,set: c,map: d,fwd: e};});
var update = F3(function (fwd,_p5,container) {
var _p6 = _p5;
var _p7 = A2($Material$Helpers.map2,$Effects.map(fwd),_p6._0(container));
var container$ = _p7._0;
var fx = _p7._1;
var obs = _p7._2;
var _p8 = obs;
if (_p8.ctor === "Nothing") {
return {ctor: "_Tuple2",_0: container$,_1: fx};
} else {
return {ctor: "_Tuple2",_0: container$,_1: $Effects.batch(_U.list([fx,$Effects.task($Task.succeed(_p8._0))]))};
}
});
var A = function (a) { return {ctor: "A",_0: a};};
var pack = F2(function (update,action) {
return A(function (_p9) { return A2($Material$Helpers.map2,$Effects.map(pack(update)),A2(update,action,_p9));});
});
var instance$ = F3(function (lift,observers,embedding) {
var set = embedding.setModel;
var get = embedding.getModel;
var fwd = function (_p10) { return lift(A2(pack,A2(observe,connect(observers),embedding.update),_p10));};
return {view: function (addr) {
return embedding.view(A2($Signal.forwardTo,addr,fwd));
}
,get: get
,set: set
,map: F2(function (f,model) { return A2(set,f(get(model)),model);})
,fwd: fwd};
});
var embed = F4(function (view,update,get,set) {
return {view: F2(function (addr,model) { return A2(view,addr,get(model));})
,update: F2(function (action,model) { return A2($Material$Helpers.map1st,A2($Basics.flip,set,model),A2(update,action,get(model)));})
,getModel: get
,setModel: set};
});
var embedIndexed = F6(function (view,update,get,set,model0,id) {
var set$ = F2(function (submodel,model) { return A2(set,A3($Dict.insert,id,submodel,get(model)),model);});
var get$ = function (model) { return A2($Maybe.withDefault,model0,A2($Dict.get,id,get(model)));};
return A4(embed,view,update,get$,set$);
});
var instance = F8(function (view,update,get,set,id,lift,model0,observers) {
return A3(instance$,lift,observers,A6(embedIndexed,view,update,get,set,model0,id));
});
var instance1 = F7(function (view,update,get,set,lift,model0,observers) {
return A3(instance$,
lift,
observers,
A4(embed,view,update,function (_p11) { return A2($Maybe.withDefault,model0,get(_p11));},function (_p12) { return set($Maybe.Just(_p12));}));
});
var Embedding = F4(function (a,b,c,d) { return {view: a,update: b,getModel: c,setModel: d};});
return _elm.Material.Component.values = {_op: _op
,embed: embed
,embedIndexed: embedIndexed
,instance: instance
,instance1: instance1
,update: update
,Embedding: Embedding
,Instance: Instance};
};
Elm.Material = Elm.Material || {};
Elm.Material.Button = Elm.Material.Button || {};
Elm.Material.Button.make = function (_elm) {
"use strict";
_elm.Material = _elm.Material || {};
_elm.Material.Button = _elm.Material.Button || {};
if (_elm.Material.Button.values) return _elm.Material.Button.values;
var _U = Elm.Native.Utils.make(_elm),
$Basics = Elm.Basics.make(_elm),
$Debug = Elm.Debug.make(_elm),
$Effects = Elm.Effects.make(_elm),
$Html = Elm.Html.make(_elm),
$Html$Attributes = Elm.Html.Attributes.make(_elm),
$Html$Events = Elm.Html.Events.make(_elm),
$List = Elm.List.make(_elm),
$Material$Component = Elm.Material.Component.make(_elm),
$Material$Helpers = Elm.Material.Helpers.make(_elm),
$Material$Ripple = Elm.Material.Ripple.make(_elm),
$Material$Style = Elm.Material.Style.make(_elm),
$Maybe = Elm.Maybe.make(_elm),
$Result = Elm.Result.make(_elm),
$Signal = Elm.Signal.make(_elm);
var _op = {};
var fwdClick = F2(function (obs,action) { var _p0 = action;if (_p0.ctor === "Click") { return $Maybe.Just(obs);} else { return $Maybe.Nothing;}});
var accent = $Material$Style.cs("mdl-button--accent");
var primary = $Material$Style.cs("mdl-button--primary");
var colored = $Material$Style.cs("mdl-button--colored");
var Click = {ctor: "Click"};
var Ripple = function (a) { return {ctor: "Ripple",_0: a};};
var S = function (a) { return {ctor: "S",_0: a};};
var model = function (shouldRipple) { return shouldRipple ? S($Maybe.Just($Material$Ripple.model)) : S($Maybe.Nothing);};
var update = F2(function (action,model) {
var _p1 = action;
if (_p1.ctor === "Click") {
return {ctor: "_Tuple2",_0: model,_1: $Effects.none};
} else {
var _p2 = model;
if (_p2._0.ctor === "Just") {
var _p3 = A2($Material$Ripple.update,_p1._0,_p2._0._0);
var ripple$ = _p3._0;
var e = _p3._1;
return {ctor: "_Tuple2",_0: S($Maybe.Just(ripple$)),_1: A2($Effects.map,Ripple,e)};
} else {
return {ctor: "_Tuple2",_0: model,_1: $Effects.none};
}
}
});
var instance = F5(function (id,lift,view,model0,observers) {
return A8($Material$Component.instance,
view,
update,
function (_) {
return _.button;
},
F2(function (x,y) { return _U.update(y,{button: x});}),
id,
lift,
model0,
observers);
});
var view = F5(function (kind,addr,model,styling,html) {
return A4($Material$Style.styled,
$Html.button,
A2($List._op["::"],
$Material$Style.cs("mdl-button"),
A2($List._op["::"],
$Material$Style.cs("mdl-js-button"),
A2($List._op["::"],
A2($Material$Style.cs$,"mdl-js-ripple-effect",!_U.eq(model,S($Maybe.Nothing))),
A2($List._op["::"],A2($Material$Style.cs$,kind,!_U.eq(kind,"")),styling)))),
_U.list([$Material$Helpers.blurOn("mouseup"),$Material$Helpers.blurOn("mouseleave"),A2($Html$Events.onClick,addr,Click)]),
function () {
var _p4 = model;
if (_p4._0.ctor === "Just") {
return A2($List._op["::"],
A3($Material$Ripple.view,
A2($Signal.forwardTo,addr,Ripple),
_U.list([$Html$Attributes.$class("mdl-button__ripple-container"),$Material$Helpers.blurOn("mouseup")]),
_p4._0._0),
html);
} else {
return html;
}
}());
});
var flat = view("");
var raised = view("mdl-button--raised");
var fab = view("mdl-button--fab");
var minifab = view("mdl-button--mini-fab");
var icon = view("mdl-button--icon");
return _elm.Material.Button.values = {_op: _op
,model: model
,update: update
,flat: flat
,raised: raised
,fab: fab
,minifab: minifab
,icon: icon
,colored: colored
,primary: primary
,accent: accent
,instance: instance
,fwdClick: fwdClick
,Click: Click};
};
Elm.Material = Elm.Material || {};
Elm.Material.Color = Elm.Material.Color || {};
Elm.Material.Color.make = function (_elm) {
"use strict";
_elm.Material = _elm.Material || {};
_elm.Material.Color = _elm.Material.Color || {};
if (_elm.Material.Color.values) return _elm.Material.Color.values;
var _U = Elm.Native.Utils.make(_elm),
$Array = Elm.Array.make(_elm),
$Basics = Elm.Basics.make(_elm),
$Debug = Elm.Debug.make(_elm),
$List = Elm.List.make(_elm),
$Material$Style = Elm.Material.Style.make(_elm),
$Maybe = Elm.Maybe.make(_elm),
$Result = Elm.Result.make(_elm),
$Signal = Elm.Signal.make(_elm);
var _op = {};
var text = function (_p0) { var _p1 = _p0;return $Material$Style.cs(A2($Basics._op["++"],"mdl-color-text--",_p1._0));};
var background = function (_p2) { var _p3 = _p2;return $Material$Style.cs(A2($Basics._op["++"],"mdl-color--",_p3._0));};
var C = function (a) { return {ctor: "C",_0: a};};
var white = C("white");
var black = C("black");
var primary = C("primary");
var primaryDark = C("primary-dark");
var primaryContrast = C("primary-contrast");
var accent = C("accent");
var accentContrast = C("accent-contrast");
var shadeName = function (shade) {
var _p4 = shade;
switch (_p4.ctor)
{case "S50": return "50";
case "S100": return "100";
case "S200": return "200";
case "S300": return "300";
case "S400": return "400";
case "S500": return "500";
case "S600": return "600";
case "S700": return "700";
case "S800": return "800";
case "S900": return "900";
case "A100": return "A100";
case "A200": return "A200";
case "A400": return "A400";
default: return "A700";}
};
var A700 = {ctor: "A700"};
var A400 = {ctor: "A400"};
var A200 = {ctor: "A200"};
var A100 = {ctor: "A100"};
var S900 = {ctor: "S900"};
var S800 = {ctor: "S800"};
var S700 = {ctor: "S700"};
var S600 = {ctor: "S600"};
var S500 = {ctor: "S500"};
var S400 = {ctor: "S400"};
var S300 = {ctor: "S300"};
var S200 = {ctor: "S200"};
var S100 = {ctor: "S100"};
var S50 = {ctor: "S50"};
var shades = $Array.fromList(_U.list([S50,S100,S200,S300,S400,S500,S600,S700,S800,S900,A100,A200,A400,A700]));
var hueName = function (color) {
var _p5 = color;
switch (_p5.ctor)
{case "Indigo": return "indigo";
case "Blue": return "blue";
case "LightBlue": return "light-blue";
case "Cyan": return "cyan";
case "Teal": return "teal";
case "Green": return "green";
case "LightGreen": return "light-green";
case "Lime": return "lime";
case "Yellow": return "yellow";
case "Amber": return "amber";
case "Orange": return "orange";
case "Brown": return "brown";
case "BlueGrey": return "blue-grey";
case "Grey": return "grey";
case "DeepOrange": return "deep-orange";
case "Red": return "red";
case "Pink": return "pink";
case "Purple": return "purple";
default: return "deep-purple";}
};
var color = F2(function (hue,shade) { return C(A2($Basics._op["++"],hueName(hue),A2($Basics._op["++"],"-",shadeName(shade))));});
var scheme = F2(function (primary,accent) {
var cssFile = function () {
var _p6 = accent;
switch (_p6.ctor)
{case "Grey": return "";
case "Brown": return "";
case "BlueGrey": return "";
default: return A2($Basics._op["++"],".",A2($Basics._op["++"],hueName(primary),A2($Basics._op["++"],"-",hueName(accent))));}
}();
return A2($Basics._op["++"],"material",A2($Basics._op["++"],cssFile,".min.css"));
});
var DeepPurple = {ctor: "DeepPurple"};
var Purple = {ctor: "Purple"};
var Pink = {ctor: "Pink"};
var Red = {ctor: "Red"};
var DeepOrange = {ctor: "DeepOrange"};
var Grey = {ctor: "Grey"};
var BlueGrey = {ctor: "BlueGrey"};
var Brown = {ctor: "Brown"};
var Orange = {ctor: "Orange"};
var Amber = {ctor: "Amber"};
var Yellow = {ctor: "Yellow"};
var Lime = {ctor: "Lime"};
var LightGreen = {ctor: "LightGreen"};
var Green = {ctor: "Green"};
var Teal = {ctor: "Teal"};
var Cyan = {ctor: "Cyan"};
var LightBlue = {ctor: "LightBlue"};
var Blue = {ctor: "Blue"};
var Indigo = {ctor: "Indigo"};
var hues = $Array.fromList(_U.list([Indigo
,Blue
,LightBlue
,Cyan
,Teal
,Green
,LightGreen
,Lime
,Yellow
,Amber
,Orange
,Brown
,BlueGrey
,Grey
,DeepOrange
,Red
,Pink
,Purple
,DeepPurple]));
return _elm.Material.Color.values = {_op: _op
,hues: hues
,shades: shades
,color: color
,white: white
,black: black
,primary: primary
,primaryDark: primaryDark
,primaryContrast: primaryContrast
,accent: accent
,accentContrast: accentContrast
,background: background
,text: text
,scheme: scheme
,Indigo: Indigo
,Blue: Blue
,LightBlue: LightBlue
,Cyan: Cyan
,Teal: Teal
,Green: Green
,LightGreen: LightGreen
,Lime: Lime
,Yellow: Yellow
,Amber: Amber
,Orange: Orange
,Brown: Brown
,BlueGrey: BlueGrey
,Grey: Grey
,DeepOrange: DeepOrange
,Red: Red
,Pink: Pink
,Purple: Purple
,DeepPurple: DeepPurple
,S50: S50
,S100: S100
,S200: S200
,S300: S300
,S400: S400
,S500: S500
,S600: S600
,S700: S700
,S800: S800
,S900: S900
,A100: A100
,A200: A200
,A400: A400
,A700: A700};
};
Elm.Demo = Elm.Demo || {};
Elm.Demo.Page = Elm.Demo.Page || {};
Elm.Demo.Page.make = function (_elm) {
"use strict";
_elm.Demo = _elm.Demo || {};
_elm.Demo.Page = _elm.Demo.Page || {};
if (_elm.Demo.Page.values) return _elm.Demo.Page.values;
var _U = Elm.Native.Utils.make(_elm),
$Basics = Elm.Basics.make(_elm),
$Debug = Elm.Debug.make(_elm),
$Html = Elm.Html.make(_elm),
$Html$Attributes = Elm.Html.Attributes.make(_elm),
$List = Elm.List.make(_elm),
$Markdown = Elm.Markdown.make(_elm),
$Material$Button = Elm.Material.Button.make(_elm),
$Material$Color = Elm.Material.Color.make(_elm),
$Material$Grid = Elm.Material.Grid.make(_elm),
$Material$Icon = Elm.Material.Icon.make(_elm),
$Material$Style = Elm.Material.Style.make(_elm),
$Maybe = Elm.Maybe.make(_elm),
$Result = Elm.Result.make(_elm),
$Signal = Elm.Signal.make(_elm);
var _op = {};
var addr = $Signal.mailbox($Material$Button.Click).address;
var fab = function (url) {
return A4($Material$Button.fab,
addr,
$Material$Button.model(false),
_U.list([A2($Material$Style.css,"position","fixed")
,A2($Material$Style.css,"right","48px")
,A2($Material$Style.css,"top","72px")
,A2($Material$Style.css,"z-index","100")
,$Material$Button.colored
,$Material$Style.attribute(A2($Html$Attributes.attribute,"onclick","alert(\'foo!\');"))]),
_U.list([$Material$Icon.i("link")]));
};
var header = function (str) { return $Html.text(str);};
var title = function (t) {
return A4($Material$Style.styled,$Html.h1,_U.list([$Material$Color.text($Material$Color.primary)]),_U.list([]),_U.list([$Html.text(t)]));
};
var from = F3(function (title,url,body) {
return A2($Html.div,
_U.list([]),
_U.list([$Html.text("From the "),A2($Html.a,_U.list([$Html$Attributes.href(url)]),_U.list([$Html.text(title)])),$Html.text(":"),$Markdown.toHtml(body)]));
});
var fromMDL = from("Material Design Lite documentation");
var fromMDS = from("Material Design Specification");
var references = function (links) {
return _U.list([header("References")
,A2($Html.ul,
_U.list([$Html$Attributes.style(_U.list([{ctor: "_Tuple2",_0: "padding-left",_1: "0"}]))]),
A2($List.map,
function (_p0) {
var _p1 = _p0;
return A2($Html.li,
_U.list([$Html$Attributes.style(_U.list([{ctor: "_Tuple2",_0: "list-style-type",_1: "none"}]))]),
_U.list([A2($Html.a,_U.list([$Html$Attributes.href(_p1._1)]),_U.list([$Html.text(_p1._0)]))]));
},
links))]);
};
var body1 = F5(function (t,srcUrl,contents,links,demo) {
return A2($Html.div,
_U.list([]),
_U.list([title(t)
,A2($Material$Grid.grid,
_U.list([$Material$Grid.noSpacing]),
_U.list([A2($Material$Grid.cell,
_U.list([A2($Material$Grid.size,$Material$Grid.All,6),A2($Material$Grid.size,$Material$Grid.Phone,4)]),
_U.list([contents]))
,A2($Material$Grid.cell,
_U.list([A2($Material$Grid.size,$Material$Grid.All,5)
,A2($Material$Grid.offset,$Material$Grid.Desktop,1)
,A2($Material$Grid.size,$Material$Grid.Phone,4)
,$Material$Grid.align($Material$Grid.Top)
,A2($Material$Style.css,"position","relative")]),
references(A2($List._op["::"],{ctor: "_Tuple2",_0: "Demo source",_1: srcUrl},links)))]))
,A2($Material$Style.div,_U.list([A2($Material$Style.css,"margin-bottom","48px")]),demo)]));
});
var body2 = body1;
var body3 = F5(function (t,srcUrl,contents,links,demo) {
return A2($Html.div,
_U.list([]),
_U.list([title(t)
,A2($Material$Grid.grid,
_U.list([$Material$Grid.noSpacing]),
_U.list([A2($Material$Grid.cell,
_U.list([A2($Material$Grid.size,$Material$Grid.All,4)
,A2($Material$Grid.size,$Material$Grid.Desktop,5)
,A2($Material$Grid.size,$Material$Grid.Tablet,8)]),
_U.list([contents,A2($Html.div,_U.list([]),references(A2($List._op["::"],{ctor: "_Tuple2",_0: "Demo source",_1: srcUrl},links)))]))
,A2($Material$Grid.cell,
_U.list([A2($Material$Grid.size,$Material$Grid.Phone,4)
,A2($Material$Grid.size,$Material$Grid.Desktop,5)
,A2($Material$Grid.offset,$Material$Grid.Desktop,1)
,A2($Material$Grid.size,$Material$Grid.Tablet,8)]),
demo)]))]));
});
var mdl = function (url) { return {ctor: "_Tuple2",_0: "Material Design Lite documentation",_1: url};};
var mds = function (url) { return {ctor: "_Tuple2",_0: "Material Design Specification",_1: url};};
var $package = function (url) { return {ctor: "_Tuple2",_0: "Package documentation",_1: url};};
var demo = function (url) { return {ctor: "_Tuple2",_0: "Demo source",_1: url};};
return _elm.Demo.Page.values = {_op: _op,demo: demo,$package: $package,mds: mds,mdl: mdl,fromMDL: fromMDL,fromMDS: fromMDS,body1: body1,body2: body2};
};
Elm.Demo = Elm.Demo || {};
Elm.Demo.Badges = Elm.Demo.Badges || {};
Elm.Demo.Badges.make = function (_elm) {
"use strict";
_elm.Demo = _elm.Demo || {};
_elm.Demo.Badges = _elm.Demo.Badges || {};
if (_elm.Demo.Badges.values) return _elm.Demo.Badges.values;
var _U = Elm.Native.Utils.make(_elm),
$Basics = Elm.Basics.make(_elm),
$Debug = Elm.Debug.make(_elm),
$Demo$Page = Elm.Demo.Page.make(_elm),
$Html = Elm.Html.make(_elm),
$List = Elm.List.make(_elm),
$Material$Badge = Elm.Material.Badge.make(_elm),
$Material$Grid = Elm.Material.Grid.make(_elm),
$Material$Icon = Elm.Material.Icon.make(_elm),
$Material$Style = Elm.Material.Style.make(_elm),
$Maybe = Elm.Maybe.make(_elm),
$Result = Elm.Result.make(_elm),
$Signal = Elm.Signal.make(_elm);
var _op = {};
var references = _U.list([$Demo$Page.$package("http://package.elm-lang.org/packages/debois/elm-mdl/latest/Material-Badge")
,$Demo$Page.mdl("https://www.getmdl.io/components/#badges-section")]);
var srcUrl = "https://github.com/debois/elm-mdl/blob/master/examples/Demo/Badges.elm";
var intro = A2($Demo$Page.fromMDL,
"http://www.getmdl.io/components/#badges-section",
"\n> The Material Design Lite (MDL) badge component is an onscreen notification\n> element. A badge consists of a small circle, typically containing a number or\n> other characters, that appears in proximity to another object. A badge can be\n> both a notifier that there are additional items associated with an object and\n> an indicator of how many items there are.\n> \n> You can use a badge to unobtrusively draw the user\'s attention to items they\n> might not otherwise notice, or to emphasize that items may need their\n> attention. For example:\n> \n> - A \"New messages\" notification might be followed by a badge containing the\n> number of unread messages. \n> - A \"You have unpurchased items in your shopping cart\" reminder might include\n> a badge showing the number of items in the cart.\n> - A \"Join the discussion!\" button might have an accompanying badge indicating the\n> number of users currently participating in the discussion. \n> \n> A badge is almost\n> always positioned near a link so that the user has a convenient way to access\n> the additional information indicated by the badge. However, depending on the\n> intent, the badge itself may or may not be part of the link.\n> \n> Badges are a new feature in user interfaces, and provide users with a visual clue to help them discover additional relevant content. Their design and use is therefore an important factor in the overall user experience.\n> \n");
var c = $Material$Grid.cell(_U.list([A2($Material$Grid.size,$Material$Grid.All,4)]));
var view = A5($Demo$Page.body2,
"Badges",
srcUrl,
intro,
references,
_U.list([A2($Html.p,_U.list([]),_U.list([$Html.text("Below are examples of various badges.")]))
,A2($Material$Grid.grid,
_U.list([]),
_U.list([c(_U.list([A2($Material$Style.span,_U.list([$Material$Badge.withBadge("2")]),_U.list([$Html.text("Badge")]))]))
,c(_U.list([A2($Material$Style.span,
_U.list([$Material$Badge.withBadge("22"),$Material$Badge.noBackground]),
_U.list([$Html.text("No background")]))]))
,c(_U.list([A2($Material$Style.span,_U.list([$Material$Badge.withBadge("33"),$Material$Badge.overlap]),_U.list([$Html.text("Overlap")]))]))
,c(_U.list([A2($Material$Style.span,
_U.list([$Material$Badge.withBadge("99"),$Material$Badge.overlap,$Material$Badge.noBackground]),
_U.list([$Html.text("Overlap, no background")]))]))
,c(_U.list([A2($Material$Style.span,_U.list([$Material$Badge.withBadge("♥")]),_U.list([$Html.text("Symbol")]))]))
,c(_U.list([A3($Material$Icon.view,
"flight_takeoff",
_U.list([$Material$Icon.size24,$Material$Badge.withBadge("33"),$Material$Badge.overlap]),
_U.list([]))]))]))]));
return _elm.Demo.Badges.values = {_op: _op,c: c,view: view,intro: intro,srcUrl: srcUrl,references: references};
};
Elm.Demo = Elm.Demo || {};
Elm.Demo.Buttons = Elm.Demo.Buttons || {};
Elm.Demo.Buttons.make = function (_elm) {
"use strict";
_elm.Demo = _elm.Demo || {};
_elm.Demo.Buttons = _elm.Demo.Buttons || {};
if (_elm.Demo.Buttons.values) return _elm.Demo.Buttons.values;
var _U = Elm.Native.Utils.make(_elm),
$Basics = Elm.Basics.make(_elm),
$Debug = Elm.Debug.make(_elm),
$Demo$Page = Elm.Demo.Page.make(_elm),
$Dict = Elm.Dict.make(_elm),
$Effects = Elm.Effects.make(_elm),
$Html = Elm.Html.make(_elm),
$Html$Attributes = Elm.Html.Attributes.make(_elm),
$List = Elm.List.make(_elm),
$Material$Button = Elm.Material.Button.make(_elm),
$Material$Grid = Elm.Material.Grid.make(_elm),
$Material$Icon = Elm.Material.Icon.make(_elm),
$Material$Style = Elm.Material.Style.make(_elm),
$Maybe = Elm.Maybe.make(_elm),
$Result = Elm.Result.make(_elm),
$Signal = Elm.Signal.make(_elm);
var _op = {};
var references = _U.list([$Demo$Page.$package("http://package.elm-lang.org/packages/debois/elm-mdl/latest/Material-Button")
,$Demo$Page.mds("https://www.google.com/design/spec/components/buttons.html")
,$Demo$Page.mdl("https://www.getmdl.io/components/#buttons-section")]);
var srcUrl = "https://github.com/debois/elm-mdl/blob/master/examples/Demo/Buttons.elm";
var intro = A2($Demo$Page.fromMDL,
"https://www.getmdl.io/components/#buttons-section",
"\n> The Material Design Lite (MDL) button component is an enhanced version of the\n> standard HTML `