Elm-0.3.5: elm-runtime-0.3.5.js
var Guid=function(){var d=0;return{guid:function(){return d+=1}}}(),Foreign=function(){return{JavaScript:function(){function d(a){for(var b=["Nil"],c=a.length;c--;)b=["Cons",a[c],b];return b}function c(a){for(var b=[];"Cons"===a[0];)b.push(a[1]),a=a[2];return b}function b(a){return a.slice(1)}function a(a){return a.unshift("Tuple"+a.length)}return{castJSBoolToBool:function(a){return a},castBoolToJSBool:function(a){return a},castJSNumberToFloat:function(a){return a},castFloatToJSNumber:function(a){return a},
castJSNumberToInt:function(a){return~~a},castIntToJSNumber:function(a){return a},Experimental:{castJSElementToElement:function(a){return Element.jsElement(a)},castElementToJSElement:function(a){return a}},castJSArrayToList:d,castListToJSArray:c,castJSStringToString:d,castStringToJSString:function(a){return"string"===typeof a?a:c(a).join("")},castTupleToJSTuple2:b,castTupleToJSTuple3:b,castTupleToJSTuple4:b,castTupleToJSTuple5:b,castJSTupleToTuple2:a,castJSTupleToTuple3:a,castJSTupleToTuple4:a,castJSTupleToTuple5:a}}()}}(),
Value=function(){var d=function(a,b){if("object"===typeof a){if(a===b)return!0;if(a.length!==b.length)return!1;for(var c=a.length;c--;)if(!d(a[c],b[c]))return!1;return!0}return a===b},c=function(a){a.replace('"',""");a.replace("&","&");a.replace("'","'");a.replace("<","<");a.replace(">",">");return a},b=function(a){if("boolean"===typeof a)return a?"True":"False";if("number"!==typeof a&&a[0]){if("Tuple"===a[0].substring(0,5)){for(var c="",i=a.length;--i;)c=","+b(a[i])+c;","===c[0]&&
(c=c.substring(1));return"("+c+")"}if("Cons"===a[0])for(var i="string"===typeof a[1]?'"':"]",d="string"===typeof a[1]?"":",",c=("string"===typeof a[1]?'"':"[")+b(a[1]),a=a[2];;)if("Cons"===a[0])c+=d+b(a[1]),a=a[2];else return c+i;else{if("Nil"===a[0])return"[]";c="";for(i=a.length;--i;)c=" "+b(a[i])+c;c=a[0]+c;return 1<a.length?"("+c+")":c}}return a+""};return{eq:d,str:function(a){for(var b=["Nil"],c=a.length;c--;)b=["Cons",a[c],b];return b},show:function(a){return Text.monospace(c(b(a)))},Tuple:function(){var a=
arguments.length,b=Array(a+1);for(b[0]="Tuple"+arguments.length;a--;)b[a+1]=arguments[a];return b},append:function(a,b){if("string"===typeof a&&"string"===typeof b)return a.concat(b);if("Nil"===a[0])return b;for(var c=["Cons",a[1],["Nil"]],d=c,a=a[2];"Cons"===a[0];)d[2]=["Cons",a[1],["Nil"]],a=a[2],d=d[2];d[2]=b;return c},listToArray:function(a){for(var b=[];"Cons"===a[0];)b.push(a[1]),a=a[2];return b},toText:function(a){if("string"===typeof a)return a;for(var b=[];"Cons"===a[0];)b.push(a[1]),a=a[2];
return c(b.join(""))},properEscape:c}}(),List=function(){function d(a){return function(f){if("Nil"===f[0])return f;"Cons"!==f[0]&&e("map");for(var b=["Cons",a(f[1]),["Nil"]],g=b,f=f[2];"Cons"===f[0];)g[2]=["Cons",a(f[1]),["Nil"]],f=f[2],g=g[2];return b}}function c(a){return function(f){return function(b){var g=f;if("Nil"===b[0])return g;for("Cons"!==b[0]&&e("foldl");"Cons"===b[0];)g=a(b[1])(g),b=b[2];return g}}}function b(a){return function(f){return function(b){var g=f;if("Nil"===b[0])return g;"Cons"!==
b[0]&&e("foldr");for(var c=[];"Cons"===b[0];)c.push(b[1]),b=b[2];for(b=c.length;b--;)g=a(c[b])(g);return g}}}function a(a){return function(f){var b;"Cons"!==f[0]?b=void 0:(b=f[1],f=f[2],b=c(a)(b)(f));return b}}function h(a){return function(f){return function(b){if("Nil"===b[0])return["Cons",f,["Nil"]];"Cons"!==b[0]&&e("scanl");for(var g=[f];"Cons"===b[0];)f=a(b[1])(f),g.push(f),b=b[2];for(var b=["Nil"],c=g.length;c--;)b=["Cons",g[c],b];return b}}}function i(a){return function(b){return function(){for(var f=
[function(a){return"Nil"!==a[0]?void 0:["Tuple2",["Nil"],["Nil"]]},function(b){if("Cons"===b[0]){var f=b[1],b=b[2];var g=i(a)(b);"Tuple2"!==g[0]?f=void 0:(b=g[1],g=g[2],f=a(f)?["Tuple2",["Cons",f,b],g]:["Tuple2",b,["Cons",f,g]]);return f}}],g=f.length;g--;){var c=f[g](b);if(void 0!==c)return c}}()}}function l(a){return function(){for(var b=[function(a){return"Nil"!==a[0]?void 0:["Tuple2",["Nil"],["Nil"]]},function(a){if("Cons"!==a[0])a=void 0;else if(a=["Tuple2",a[1],l(a[2])],"Tuple2"!==a[0]||"Tuple2"!==
a[1][0])a=void 0;else var b=a[1][1],f=a[1][2],a="Tuple2"!==a[2][0]?void 0:["Tuple2",["Cons",b,a[2][1]],["Cons",f,a[2][2]]];return a}],f=b.length;f--;){var g=b[f](a);if(void 0!==g)return g}}()}function n(a){return function(b){return function(){for(var f=[function(a){return"Nil"!==a[0]?void 0:["Nil"]},function(a){if("Cons"===a[0]){var b=a[1];return"Nil"!==a[2][0]?void 0:["Cons",b,["Nil"]]}},function(b){if("Cons"===b[0]){var f=b[1];if("Cons"===b[2][0]){var g=b[2][1],b=b[2][2];return["Cons",f,["Cons",
a,n(a)(["Cons",g,b])]]}}}],g=f.length;g--;){var c=f[g](b);if(void 0!==c)return c}}()}}function o(a){return function(b){return function(){for(var f=[function(a){return"Nil"!==a[0]?void 0:["Nil"]},function(a){if("Cons"===a[0]){var b=a[1];return"Nil"!==a[2][0]?void 0:b}},function(b){if("Cons"===b[0]){var f=b[1];if("Cons"===b[2][0]){var g=b[2][1],b=b[2][2];return Value.append(f,Value.append(a,o(a)(["Cons",g,b])))}}}],g=f.length;g--;){var c=f[g](b);if(void 0!==c)return c}}()}}var e=function(a){throw"Function '"+
a+"' expecting a list!";},j=c(function(a){return function(b){return["Cons",a,b]}})(["Nil"]),k=b(function(a){return function(b){return Value.append(a,b)}})(["Nil"]),m=c(function(a){return function(b){return a&&b}})(!0),f=c(function(a){return function(b){return a||b}})(!1),g=c(function(a){return function(b){return a+b}})(0),t=c(function(a){return function(b){return a*b}})(1),q=a(function(a){return function(b){return Math.max(a,b)}}),s=a(function(a){return function(b){return Math.min(a,b)}});return{head:function(a){if("Cons"!==
a[0])throw"Error: 'head' only accepts lists of length greater than one.";return a[1]},tail:function(a){if("Cons"!==a[0])throw"Error: 'tail' only accepts lists of length greater than one.";return a[2]},last:function(a){if("Cons"!==a[0])throw"Error: 'last' only accepts lists of length greater than one.";for(var b=a[1];"Cons"===a[0];)b=a[1],a=a[2];return b},map:d,foldl:c,foldr:b,foldl1:a,foldr1:function(a){return function(f){var g;"Cons"!==f[0]?g=void 0:(g=f[1],f=f[2],g=b(a)(g)(f));return g}},scanl:h,
scanl1:function(a){return function(b){if("Cons"!==b[0])throw"Error: 'scanl1' requires a list of at least length 1.";return h(a)(b[1])(b[2])}},filter:function(a){return function(b){if("Nil"===b[0])return b;"Cons"!==b[0]&&e("filter");for(var f=[];"Cons"===b[0];)a(b[1])&&f.push(b[1]),b=b[2];for(var b=["Nil"],g=f.length;g--;)b=["Cons",f[g],b];return b}},length:function(a){for(var b=0;"Cons"===a[0];)b+=1,a=a[2];return b},reverse:j,concat:k,concatMap:function(a){return function(b){return k(d(a)(b))}},and:m,
or:f,forall:function(a){return c(function(b){return function(f){return f&&a(b)}})(!0)},exists:function(a){return c(function(b){return function(f){return f||a(b)}})(!1)},sum:g,product:t,maximum:q,minimum:s,partition:i,zipWith:function(a){return function(b){return function(f){if("Nil"===b[0]||"Nil"===f[0])return["Nil"];("Cons"!==b[0]||"Cons"!==f[0])&&e("zipWith");for(var g=[];"Cons"===b[0]&&"Cons"===f[0];)g.push(a(b[1])(f[1])),b=b[2],f=f[2];for(var f=["Nil"],c=g.length;c--;)f=["Cons",g[c],f];return f}}},
zip:function(a){return function(b){if("Nil"===a[0]||"Nil"===b[0])return["Nil"];("Cons"!==a[0]||"Cons"!==b[0])&&e("zip");for(var f=[];"Cons"===a[0]&&"Cons"===b[0];)f.push(["Tuple2",a[1],b[1]]),a=a[2],b=b[2];for(var b=["Nil"],g=f.length;g--;)b=["Cons",f[g],b];return b}},unzip:l,intersperse:n,intercalate:o,sort:function(a){if("Nil"===a[0])return a;"Cons"!==a[0]&&e("sort");for(var b=[];"Cons"===a[0];)b.push(a[1]),a=a[2];b.sort(function(a,b){return a-b});for(var a=["Nil"],f=b.length;f--;)a=["Cons",b[f],
a];return a},take:function(a){return function(b){if(0>=a)return["Nil"];if("Nil"===b[0])return b;"Cons"!==b[0]&&e("take");var f=["Cons",b[1],["Nil"]],g=f,b=b[2];for(--a;"Cons"===b[0]&&0<a;)g[2]=["Cons",b[1],["Nil"]],g=g[2],b=b[2],--a;return f}},drop:function(a){return function(b){if("Nil"===b[0])return b;for("Cons"!==b[0]&&e("drop");"Cons"===b[0]&&0<a;)b=b[2],--a;return b}}}}(),Data=function(){var d=function(){return{fromCode:function(b){return String.fromCharCode(b)},toCode:function(b){return b.charCodeAt(0)},
toUpper:function(b){return b.toUpperCase()},toLower:function(b){return b.toLowerCase()},toLocaleUpper:function(b){return b.toLocaleUpperCase()},toLocaleLower:function(b){return b.toLocaleLowerCase()}}}(),c=function(){function b(a){return function(b){return"Just"===a[0]?["Cons",a[1],b]:b}}function a(a){return function(b){return function(c){var d=a(b);return"Just"===d[0]?["Cons",d[1],c]:c}}}return{Just:function(a){return["Just",a]},Nothing:["Nothing"],catMaybes:List.foldr(b)(["Nil"]),isJust:function(a){return"Just"===
a[0]},isNothing:function(a){return"Nothing"===a[0]},fromMaybe:function(a){return function(b){return"Just"===b[0]?b[1]:a}},consMaybe:b,mapMaybe:function(b){return List.foldr(a(b))(["Nil"])},maybe:function(a){return function(b){return function(c){return"Just"===c[0]?b(c[1]):a}}}}}();return{String:{toText:Value.toText,properEscape:Value.properEscape},Char:d,Maybe:c,List:List}}(),Color=function(){var d=function(c,b,a,d){return{r:c,g:b,b:a,a:d}};return{black:d(0,0,0,1),white:d(255,255,255,1),red:d(255,
0,0,1),green:d(0,255,0,1),blue:d(0,0,255,1),gray:d(128,128,128,1),grey:d(128,128,128,1),yellow:d(255,255,0,1),cyan:d(0,255,255,1),magenta:d(255,0,255,1),rgba:function(c){return function(b){return function(a){return function(h){return d(c,b,a,h)}}}},rgb:function(c){return function(b){return function(a){return d(c,b,a,1)}}},Internal:{extract:function(c){return 1===c.a?"rgb("+c.r+","+c.g+","+c.b+")":"rgba("+c.r+","+c.g+","+c.b+","+c.a+")"}}}}(),Element=function(){var d=function(a){a=document.createElement(a);
a.id=Guid.guid();a.style.padding="0";a.style.margin="0";return a},c=function(a){var b=d("div");b.appendChild(a);return b},b=function(a){return function(b){return function(c){var e=d("div");e.isElmLeaf=!0;e.isElmText=!0;e.innerHTML=c;e.style.textAlign=b;0<a&&(e.style.width=a+"px");return e}}},a=b(0)("left"),h=b(0)("justify"),i=b(0)("center"),l=b(0)("right"),n=function(a){return"DIV"===a.tagName?a:c(a)},o=function(a){a.style.styleFloat="left";a.style.cssFloat="left";return a},e=function(a){a.style.position=
"absolute";return a},j=function(a,b,c){for(var e=d("div"),j=c.length;j--;){var k=b(c[j]);e.appendChild(k)}e.elmFlowDirection=a;return e},k=function(a){return function(b){for(var c=[];"Cons"===b[0];)c.push(b[1]),b=b[2];3<=a&&c.reverse();b=a%3;if(0==b)return j("Y",n,c);if(1==b)return j("X",o,c);if(2==b)return j("Z",e,c)}},m=function(a){return function(g){if("A"===g.tagName)return m(a)(g.firstChild),g;if(g.hasOwnProperty("isElmText")){var c=b(a)(g.style.textAlign)(g.innerHTML);g.style.height=c.style.height}g.style.width=
a+"px";return g}};return{text:a,image:function(a){var b=d("img");b.isElmLeaf=!0;b.onload=function(){""===b.style.width&&0<this.width&&(b.style.width=b.width=this.width+"px");""===b.style.height&&0<this.height&&(b.style.height=b.height=this.height+"px");Dispatcher.adjust()};b.src=Data.String.toText(a);b.name=b.src;return b},fittedImage:function(a){return function(b){return function(c){var e=d("canvas");e.style.width=a+"px";e.style.height=b+"px";e.width=a;e.height=b;e.innerHTML="Your browser does not support the canvas element.";
e.isElmLeaf=!0;var j=d("img");j.onload=function(){if(e.getContext){var c=e.getContext("2d"),d=0,k=0,m=this.width,i=this.height;a/b>this.width/this.height?(i=this.width*b/a,k=(this.height-i)/2):(m=this.height*a/b,d=(this.width-m)/2);c.drawImage(j,d,k,m,i,0,0,e.width,e.height)}};j.src=Data.String.toText(c);return e}}},video:function(a){var a=Data.String.toText(a),b=d("video");b.controls="controls";var c=d("source");c.src=a;c.type="video/"+a.substring(a.length-3,a.length);b.appendChild(c);b.isElmLeaf=
!0;return b},audio:function(a){var a=Data.String.toString(a),b=d("video");b.controls="controls";var c=d("source");c.src=a;c.type="audio/"+a.substring(a.length-3,a.length);b.appendChild(c);b.isElmLeaf=!0;return b},collage:function(a){return function(b){return function(c){var e=d("canvas");e.style.width=a+"px";e.style.height=b+"px";e.width=a;e.height=b;if(e.getContext){var j=e.getContext("2d");for(j.clearRect(0,0,e.width,e.height);"Cons"===c[0];)j=c[1](j),c=c[2];return e}e.innerHTML="Your browser does not support the canvas element.";
e.isElmLeaf=!0;return e}}},flow:k,layers:k(2),rectangle:function(a){return function(b){var c=d("div");c.isElmLeaf=!0;c.style.width=a+"px";c.style.height=b+"px";return c}},beside:function(a){return function(b){return k(4)(["Cons",a,["Cons",b,["Nil"]]])}},above:function(a){return function(b){return k(3)(["Cons",a,["Cons",b,["Nil"]]])}},below:function(a){return function(b){return k(0)(["Cons",a,["Cons",b,["Nil"]]])}},box:function(a){return function(b){b.style.position="absolute";b.style.margin="auto";
var c=(a-1)%3,e=(a-1)/3;2>c&&(b.style.left=0);0<c&&(b.style.right=0);2>e&&(b.style.top=0);0<e&&(b.style.bottom=0);c=d("div");c.style.position="relative";c.appendChild(b);return c}},width:m,height:function(a){return function(b){("A"===b.tagName?b.firstChild:b).style.height=a+"px";return b}},size:function(a){return function(b){return function(c){var e="A"===c.tagName?c.firstChild:c;e.style.width=a+"px";e.style.height=b+"px";return c}}},color:function(a){return function(b){b.style.backgroundColor=Color.Internal.extract(a);
return b}},opacity:function(a){return function(b){b.style.opacity=a;return b}},link:function(a){return function(b){var e=d("a");e.href=Text.fromString(a);e.appendChild(b);return c(e)}},asText:function(a){return b(0)("left")(Value.show(a))},plainText:function(a){return b(0)("left")(Data.String.toText(a))},justifiedText:h,centeredText:i,rightedText:l,up:0,left:1,inward:2,down:3,right:4,outward:5,correctTextSize:function(a){var b=a.style.width?a.style.width.slice(0,-2):0,c=d("div");c.innerHTML=a.innerHTML;
c.style.textAlign=a.style.textAlign;0<b&&(c.style.width=b+"px");c.style.visibility="hidden";c.style.styleFloat="left";c.style.cssFloat="left";document.body.appendChild(c);var e=window.getComputedStyle(c);0>=b&&(a.style.width=e.getPropertyValue("width"));a.style.height=e.getPropertyValue("height");document.body.removeChild(c)},jsElement:function(a){return function(b){return function(c){var e=d("div");e.isElmLeaf=!0;e.style.width=a+"px";e.style.height=b+"px";e.appendChild(c);return e}}}}}(),Text=function(){var d=
function(a){if("string"===typeof a)return a;for(var b=[];"Cons"===a[0];)b.push(a[1]),a=a[2];return Data.String.properEscape(b.join(""))},c=function(a){return function(b){return"<"+a+' style="padding:0;margin:0">'+b+"</"+a+">"}},b=function(a,b){return function(c){return"<span style='"+a+":"+b+"'>"+c+"</span>"}},a=c("h1"),h=b("font-style","italic"),c=c("b"),i=b("text-decoration","underline"),l=b("text-decoration","overline"),n=b("text-decoration","line-through");return{fromString:d,toText:d,header:a,
height:function(a){return b("font-size",a+"em")},italic:h,bold:c,underline:i,overline:l,strikeThrough:n,monospace:b("font-family","monospace"),color:function(a){return b("color",Color.Internal.extract(a))},link:function(a){return function(b){return"<a href='"+d(a)+"'>"+b+"</a>"}}}}(),Shape=function(){var d=function(b,a,c,d){return{center:b,points:a,theta:c,scale:d}},c=function(b){return function(a){return function(c){return function(d){d.save();d.translate(c.center[0],c.center[1]);d.rotate(c.theta);
d.scale(c.scale,c.scale);d.beginPath();var l=c.points;d.moveTo(l[0][0],l[0][1]);for(var n=l.length;n--;)d.lineTo(l[n][0],l[n][1]);d.closePath();b?(d.fillStyle=Color.Internal.extract(a),d.fill()):(d.strokeStyle=Color.Internal.extract(a),d.stroke());d.restore();return d}}}};return{polygon:function(b){return function(a){for(var c=[];"Cons"===b[0];)c.push([b[1][1],b[1][2]]),b=b[2];a=[a[1],a[2]];return d(a,c,0,1)}},ngon:function(b){return function(a){return function(c){for(var i=[],l=b;l--;)i.push([a*
Math.cos(2*Math.PI*l/b),a*Math.sin(2*Math.PI*l/b)]);c=[c[1],c[2]];return d(c,i,0,1)}}},rect:function(b){return function(a){return function(c){var i=[[-b/2,-a/2],[b/2,-a/2],[b/2,a/2],[-b/2,a/2]],c=[c[1],c[2]];return d(c,i,0,1)}}},oval:function(b){return function(a){return function(c){for(var i=[],l=2*Math.PI;0<l;l-=Math.PI/50)i.push([b/2*Math.cos(l),a/2*Math.sin(l)]);c=[c[1],c[2]];return d(c,i,0,1)}}},move:function(b){return function(a){return function(c){return d([b+c.center[0],a+c.center[1]],c.points,
c.theta,c.scale)}}},rotate:function(b){return function(a){return d(a.center,a.points,a.theta+2*Math.PI*b,a.scale)}},scale:function(b){return function(a){return d(a.center,a.points,a.theta,a.scale*b)}},filled:c(!0),outlined:c(!1),customOutline:function(b){return function(a){return function(c){c.points.push(c.points[0]);return Line.customLine(b)(a)(c)}}}}}(),Line=function(){var d=function(c){return function(b){return function(a){if("string"===typeof c[0]){for(var d=[];"Cons"===c[0];)d.push(c[1]),c=
c[2];c=d}0===c.length&&(c=[8,4]);return function(d){d.save();d.beginPath();d.translate(a.center[0],a.center[1]);d.rotate(a.theta);d.scale(a.scale,a.scale);var l=c,n=a.points,o=n.length-1,e=n[o][0],j=n[o][1],k=0,m=0,f=0,g=0,h=0,q=0,s=l.length,r=!0,p=l[0];for(d.moveTo(e,j);o--;){k=n[o][0];m=n[o][1];f=k-e;g=m-j;for(h=Math.sqrt(f*f+g*g);p<=h;)e+=f*p/h,j+=g*p/h,d[r?"lineTo":"moveTo"](e,j),f=k-e,g=m-j,h=Math.sqrt(f*f+g*g),r=!r,q=(q+1)%s,p=l[q];0<h&&(d[r?"lineTo":"moveTo"](k,m),p-=h);e=k;j=m}d.strokeStyle=
Color.Internal.extract(b);d.stroke();d.restore();return d}}}};return{line:function(c){for(var b=[];"Cons"===c[0];)b.push([c[1][1],c[1][2]]),c=c[2];return{center:[0,0],points:b,theta:0,scale:1}},customLine:d,solid:function(c){return function(b){return function(a){a.save();a.beginPath();a.translate(b.center[0],b.center[1]);a.rotate(b.theta);a.scale(b.scale,b.scale);var d=b.points,i=d.length;for(a.moveTo(d[i-1][0],d[i-1][1]);i--;)a.lineTo(d[i][0],d[i][1]);a.strokeStyle=Color.Internal.extract(c);a.stroke();
a.restore();return a}}},dashed:d([8,4]),dotted:d([3,3])}}(),Elm=function(){var d=function(a,b,c){for(var d=a.kids,m=d.length;m--;)d[m].recv(b,c,a.id)},c=function(a){this.id=Guid.guid();this.value=a;this.kids=[];this.recv=function(a,b,c){if(b=b===this.id)this.value=c;d(this,a,b)};Dispatcher.inputs.push(this)},b=function(a,b){this.id=Guid.guid();this.value=null;this.kids=[];this.inbox={};b.reverse();this.recalc=function(){for(var c=a,d=b.length;d--;)c=c(b[d].value);this.value=c};this.recalc();this.recv=
function(a,c){this.inbox.hasOwnProperty(a)||(this.inbox[a]={changed:!1,count:0});var f=this.inbox[a];f.count+=1;c&&(f.changed=!0);f.count==b.length&&(f.changed&&this.recalc(),d(this,a,f.changed),delete this.inbox[a])};for(var c=b.length;c--;)b[c].kids.push(this)},a=function(a,b,c){this.id=Guid.guid();this.value=b;this.kids=[];this.recv=function(b,e){e&&(this.value=a(c.value)(this.value));d(this,b,e)};c.kids.push(this)},h=function(a,b,c){this.id=Guid.guid();this.value=a(c.value)?b:c.value;this.kids=
[];this.recv=function(b,e){var f=e&&!a(c.value);f&&(this.value=c.value);d(this,b,f)};c.kids.push(this)},i=function(a){this.id=Guid.guid();this.value=a.value;this.kids=[];this.recv=function(b,c){var k=c&&!eq(this.value,a.value);k&&(this.value=a.value);d(this,b,k)};a.kids.push(this)},l=function(a){return function(c){return function(d){d=new b(function(a){return function(b){return[a,b]}},[a,d]);d=new h(function(a){return a[0]},[!0,c],d);return new b(function(a){return a[1]},[d])}}},n=function(a,b){this.id=
Guid.guid();this.value=b.value;this.kids=[];this.inbox={};this.recv=function(c,k,m){if(k=k&&m===a.id)this.value=b.value;d(this,c,k)};a.kids.push(this);b.kids.push(this)};return{Input:function(a){return new c(a)},Lift:function(a,c){return new b(a,c)},Fold:function(b,c,d){return new a(b,c,d)},keepIf:function(a){return function(b){return function(c){return new h(function(b){return!a(b)},b,c)}}},dropIf:function(a){return function(b){return function(c){return new h(a,b,c)}}},keepWhen:function(a){return l(new b(function(a){return!a},
[a]))},dropWhen:l,dropRepeats:function(a){return new i(a)},sampleOn:function(a){return function(b){return new n(a,b)}}}}(),Dispatcher=function(){var d=null,c=0,b=[],a=function(b){var c=b.childNodes,d=c.length;if(b.hasOwnProperty("isElmLeaf")){b.hasOwnProperty("isElmText")&&Element.correctTextSize(b);var c=""===b.style.width?0:b.style.width.slice(0,-2)-0,h=""===b.style.height?0:b.style.height.slice(0,-2)-0;return[c,h]}if(1===d){var e=a(c[0]);""!==b.style.width&&(e[0]=b.style.width.slice(0,-2)-0);""!==
b.style.height&&(e[1]=b.style.height.slice(0,-2)-0);0!==e[0]&&(b.style.width=e[0]+"px");0!==e[1]&&(b.style.height=e[1]+"px");return e}for(var j=0,k=h=0,m=0,f=!0,g=!0;d--;)e=a(c[d]),j=Math.max(j,e[0]),h=Math.max(h,e[1]),k+=e[0],m+=e[1],f=f&&0<e[0],g=g&&0<e[1];c=j;d=b.elmFlowDirection;"X"===d&&(c=f?k:0);"Y"===d&&(h=g?m:0);0<c&&(b.style.width=c+"px");0<h&&(b.style.height=h+"px");return[c,h]},h=function(){var b=document.getElementById("content");a(b.children[0])};return{initialize:function(){d=ElmCode.main();
d.hasOwnProperty("recv")||(d=Elm.Input(d));document.getElementById("content").appendChild(d.value);h();var a=document.getElementById("widthChecker").offsetWidth;a!==window.innerWidth&&Dispatcher.notify(Window.dimensions.id,Value.Tuple(a,window.innerHeight));d=Elm.Lift(function(a){var b=document.getElementById("content"),c=b.children[0];b.replaceChild(a,c);delete c;h();return a},[d])},notify:function(a,d){c+=1;for(var h=b.length;h--;)b[h].recv(c,a,d)},adjust:h,inputs:b}}(),Signal=function(){function d(a){for(var b=
["Nil"],c=a.length;c--;)b=["Cons",a[c],b];return b}var c=function(){return document.addEventListener?function(a,b,c){a.addEventListener(b,c,!1)}:function(a,b,c){a.attachEvent("on"+b,c)}}(),b=function(){function a(b){var c=0,d=0;b||(b=window.event);if(b.pageX||b.pageY)c=b.pageX,d=b.pageY;else if(b.clientX||b.clientY)c=b.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,d=b.clientY+document.body.scrollTop+document.documentElement.scrollTop;return Value.Tuple(c,d)}var b=Elm.Input(Value.Tuple(0,
0)),d=Elm.Input(!1),m=Elm.Input(!1),f=Elm.Input(Value.Tuple());c(document,"click",function(){Dispatcher.notify(m.id,!0);Dispatcher.notify(f.id,Value.Tuple());Dispatcher.notify(m.id,!1)});c(document,"mousedown",function(){Dispatcher.notify(d.id,!0)});c(document,"mouseup",function(){Dispatcher.notify(d.id,!1)});c(document,"mousemove",function(c){Dispatcher.notify(b.id,a(c))});return{position:b,x:Elm.Lift(function(a){return a[1]},[b]),y:Elm.Lift(function(a){return a[2]},[b]),isClicked:m,isDown:d,clicks:f}}(),
a=function(){return{every:function(a){var a=1E3*a,b=Elm.Input(0),c=0;setInterval(function(){c+=a;Dispatcher.notify(b.id,c/1E3)},a);return b},after:function(a){var a=1E3*a,b=Elm.Input(!1);setTimeout(function(){Dispatcher.notify(b.id,!0)},a);return b},before:function(a){var a=1E3*a,b=Elm.Input(!0);setTimeout(function(){Dispatcher.notify(b.id,!1)},a);return b}}}(),h=function(){var a=Elm.Input(Value.Tuple(window.innerWidth,window.innerHeight));c(window,"resize",function(){var b=document.getElementById("widthChecker").offsetWidth;
Dispatcher.notify(a.id,Value.Tuple(b,window.innerHeight))});return{dimensions:a,width:Elm.Lift(function(a){return a[1]},[a]),height:Elm.Lift(function(a){return a[2]},[a])}}(),i={Raw:function(){function a(b,c){return"Nil"===c[0]?c:c[1]===b?c[2]:["Cons",c[1],a(b,c[2])]}var b=Elm.Input(["Nil"]),d=Elm.Input(["Nothing"]);c(document,"keydown",function(a){var c;a:{for(c=b.value;"Nil"!==c[0];){if(c[1]===a.keyCode){c=!0;break a}c=c[2]}c=!1}c||Dispatcher.notify(b.id,["Cons",a.keyCode,b.value])});c(document,
"keyup",function(c){c=a(c.keyCode,b.value);Dispatcher.notify(b.id,c)});c(window,"blur",function(){Dispatcher.notify(b.id,["Nil"])});c(document,"keypress",function(a){Dispatcher.notify(d.id,["Just",a.charCode||a.keyCode]);Dispatcher.notify(d.id,["Nothing"])});return{keysDown:b,charPressed:d}}()},l=function(){var a=function(a){return function(b){var c=Elm.Input(["Waiting"]),e={};window.XMLHttpRequest?e=new XMLHttpRequest:window.ActiveXObject&&(e=new ActiveXObject("Microsoft.XMLHTTP"));e.onreadystatechange=
function(){4===e.readyState&&Dispatcher.notify(c.id,200===e.status?["Success",d(e.responseText)]:["Failure",e.status,d(e.statusText)])};e.open(a,Data.String.toText(b),!0);e.send(null);return c}},b=function(a){return function(b){var c=Elm.Input(["Nothing"]),b=Elm.Lift(function(b){if("Just"!==b[0]){try{Dispatcher.notify(c.id,["Nothing"])}catch(e){}return[]}try{Dispatcher.notify(c.id,["Just",["Waiting"]])}catch(m){c.value=["Just",["Waiting"]]}var j={};window.XMLHttpRequest?j=new XMLHttpRequest:window.ActiveXObject&&
(j=new ActiveXObject("Microsoft.XMLHTTP"));j.onreadystatechange=function(){4===j.readyState&&Dispatcher.notify(c.id,["Just",200===j.status?["Success",d(j.responseText)]:["Failure",j.status,d(j.statusText)]])};j.open(a,Data.String.toText(b[1]),!0);j.send(null);return[]},[b]);return Elm.Lift(function(a){return function(){return a}},[c,b])}};return{get:a("GET"),post:a("POST"),gets:b("GET"),posts:b("POST")}}(),n=function(){return{inRange:function(a){return function(b){return Elm.Input(Math.floor(Math.random()*
(b-a+1))+a)}},randomize:function(a){return function(b){return function(c){return Elm.Lift(function(){return Math.floor(Math.random()*(b-a+1))+a},[c])}}}}}(),o=function(){var a=function(a){a.isElmLeaf=!0;var b=Elm.Input(["Nil"]);c(a,"keyup",function(){Dispatcher.notify(b.id,d(a.value));a.focus()});return Value.Tuple(a,b)},b=function(a){a=document.createElement(a);a.id=Guid.guid();return a},h=function(a){for(var d=b("select"),e=[];"Cons"===a[0];){var h=b("option"),k=Text.toText(a[1][1]);h.value=k;h.innerHTML=
k;d.appendChild(h);e.push(a[1][2]);a=a[2]}var i=Elm.Input(e[0]);c(d,"change",function(){Dispatcher.notify(i.id,e[d.selectedIndex])});return Value.Tuple(d,i)};return{textArea:function(c){return function(d){var g=b("textarea");g.rows=d;g.cols=c;return a(g,"")}},textField:function(c){var d=b("input");d.type="text";return a(d,c)},password:function(c){var d=b("input");d.type="password";return a(d,c)},checkbox:function(a){var d=b("input");d.type="checkbox";d.checked=a;var e=Elm.Input(a);c(d,"change",function(){Dispatcher.notify(e.id,
d.checked)});return Value.Tuple(d,e)},dropDown:h,stringDropDown:function(a){return h(List.map(function(a){return Value.Tuple(a,a)})(a))},button:function(a){var d=b("input");d.type="button";d.value=Text.toText(a);var e=Elm.Input(!1);c(d,"click",function(){Dispatcher.notify(e.id,!0);Dispatcher.notify(e.id,!1)});return Value.Tuple(d,e)}}}();return{addListener:c,Mouse:b,Keyboard:i,Time:a,Window:h,HTTP:l,Random:n,Input:o,constant:function(a){return Elm.Input(a)},lift:function(a){return function(b){return Elm.Lift(a,
[b])}},lift2:function(a){return function(b){return function(c){return Elm.Lift(a,[b,c])}}},lift3:function(a){return function(b){return function(c){return function(d){return Elm.Lift(a,[b,c,d])}}}},lift4:function(a){return function(b){return function(c){return function(d){return function(f){return Elm.Lift(a,[b,c,d,f])}}}}},foldp:function(a){return function(b){return function(c){return Elm.Fold(a,b,c)}}},count:function(a){return Elm.Fold(function(){return function(a){return a+1}},0,a)},keepIf:Elm.keepIf,
dropIf:Elm.dropIf,keepWhen:Elm.keepWhen,dropWhen:Elm.dropWhen,dropRepeats:Elm.dropRepeats,sampleOn:Elm.sampleOn}}(),Prelude=function(){var d=function(c){return function(b){var a=c%b,a=0==c?0:0<b?0<=c?a:a+b:-d(-c)(-b);return a==b?0:a}};return{id:function(c){return c},not:function(c){return!c},fst:function(c){return c[1]},snd:function(c){return c[2]},rem:function(c){return function(b){return c%b}},sqrt:Math.sqrt,abs:Math.abs,pi:Math.PI,sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,
atan:Math.atan,mod:d,min:function(c){return function(b){return Math.min(c,b)}},max:function(c){return function(b){return Math.max(c,b)}},flip:function(c){return function(b){return function(a){return c(a)(b)}}},clamp:function(c){return function(b){return function(a){return Math.min(b,Math.max(c,a))}}},curry:function(c){return function(b){return function(a){return c(["Tuple2",b,a])}}},uncurry:function(c){return function(b){if("Tuple2"!==b[0])throw"Function was uncurry'd but was not given a pair.";return c(b[1])(b[2])}},
logBase:function(c){return function(b){return Math.log(b)/Math.log(c)}},Just:Data.Maybe.Just,Nothing:Data.Maybe.Nothing,maybe:Data.Maybe.maybe,map:Data.List.map,filter:Data.List.filter,head:Data.List.head,tail:Data.List.tail,last:Data.List.last,length:Data.List.length,reverse:Data.List.reverse,foldr:Data.List.foldr,foldr1:Data.List.foldr1,foldl:Data.List.foldl,foldl1:Data.List.foldl1,and:Data.List.and,or:Data.List.or,forall:Data.List.forall,exists:Data.List.exists,sum:Data.List.sum,product:Data.List.product,
concat:Data.List.concat,concatMap:Data.List.concatMap,maximum:Data.List.maximum,minimum:Data.List.minimum,scanl:Data.List.scanl,scanl1:Data.List.scanl1,take:Data.List.take,drop:Data.List.drop,lift:Signal.lift,lift2:Signal.lift2,lift3:Signal.lift3,lift4:Signal.lift4,foldp:Signal.foldp,constant:Signal.constant,count:Signal.count,keepIf:Signal.keepIf,dropIf:Signal.dropIf,keepWhen:Signal.keepWhen,dropWhen:Signal.dropWhen,dropRepeats:Signal.dropRepeats,sampleOn:Signal.sampleOn}}(),eq=Value.eq;
Signal.addListener(document,"elm_log",function(d){console.log(d.value)});Signal.addListener(document,"elm_title",function(d){document.title=d.value});Signal.addListener(document,"elm_redirect",function(d){0<d.value.length&&(window.location=d.value)});var includeGlobal=this;
(function(){var d=function(b){for(var a in b)if("Internal"!==a)try{includeGlobal[a]=b[a]}catch(c){"length"===a&&(includeGlobal.execScript("var length;"),length=b[a])}},c=function(b){return function(a){includeGlobal[b]=includeGlobal[b]||{};for(var c in a)"Internal"!==c&&(includeGlobal[b][c]=a[c])}};d(Element);d(Text);color=Element.color;height=Element.height;show=Value.show;d(Color);d(Shape);d(Line);c("Time")(Signal.Time);c("Mouse")(Signal.Mouse);c("Keyboard")(Signal.Keyboard);c("Window")(Signal.Window);
c("HTTP")(Signal.HTTP);c("Input")(Signal.Input);c("Random")(Signal.Random)})();var ElmCode={};ElmCode.Data=Data;ElmCode.Signal=Signal;ElmCode.Data.List=List;ElmCode.Foreign=Foreign;ElmCode.Prelude=Prelude;