KZKRGZBWLSKWVN6ZKDGGK6W6EAQLMSKUEJBVMMZ2UD3TZERZKS7QC
var _Http_toTask = F3(function(router, toTask, request)
{
return _Scheduler_binding(function(callback)
{
function done(response) {
callback(toTask(request.expect.a(response)));
}
var xhr = new XMLHttpRequest();
xhr.addEventListener('error', function() { done($elm$http$Http$NetworkError_); });
xhr.addEventListener('timeout', function() { done($elm$http$Http$Timeout_); });
xhr.addEventListener('load', function() { done(_Http_toResponse(request.expect.b, xhr)); });
$elm$core$Maybe$isJust(request.tracker) && _Http_track(router, xhr, request.tracker.a);
try {
xhr.open(request.method, request.url, true);
} catch (e) {
return done($elm$http$Http$BadUrl_(request.url));
}
_Http_configureRequest(xhr, request);
request.body.a && xhr.setRequestHeader('Content-Type', request.body.a);
xhr.send(request.body.b);
return function() { xhr.c = true; xhr.abort(); };
});
});
// CONFIGURE
function _Http_configureRequest(xhr, request)
{
for (var headers = request.headers; headers.b; headers = headers.b) // WHILE_CONS
{
xhr.setRequestHeader(headers.a.a, headers.a.b);
}
xhr.timeout = request.timeout.a || 0;
xhr.responseType = request.expect.d;
xhr.withCredentials = request.allowCookiesFromOtherDomains;
}
// RESPONSES
function _Http_toResponse(toBody, xhr)
{
return A2(
200 <= xhr.status && xhr.status < 300 ? $elm$http$Http$GoodStatus_ : $elm$http$Http$BadStatus_,
_Http_toMetadata(xhr),
toBody(xhr.response)
);
}
// METADATA
function _Http_toMetadata(xhr)
{
return {
url: xhr.responseURL,
statusCode: xhr.status,
statusText: xhr.statusText,
headers: _Http_parseHeaders(xhr.getAllResponseHeaders())
};
}
// HEADERS
function _Http_parseHeaders(rawHeaders)
{
if (!rawHeaders)
{
return $elm$core$Dict$empty;
}
var headers = $elm$core$Dict$empty;
var headerPairs = rawHeaders.split('\r\n');
for (var i = headerPairs.length; i--; )
{
var headerPair = headerPairs[i];
var index = headerPair.indexOf(': ');
if (index > 0)
{
var key = headerPair.substring(0, index);
var value = headerPair.substring(index + 2);
headers = A3($elm$core$Dict$update, key, function(oldValue) {
return $elm$core$Maybe$Just($elm$core$Maybe$isJust(oldValue)
? value + ', ' + oldValue.a
: value
);
}, headers);
}
}
return headers;
}
// EXPECT
var _Http_expect = F3(function(type, toBody, toValue)
{
return {
$: 0,
d: type,
b: toBody,
a: toValue
};
});
var _Http_mapExpect = F2(function(func, expect)
{
return {
$: 0,
d: expect.d,
b: expect.b,
a: function(x) { return func(expect.a(x)); }
};
});
function _Http_toDataView(arrayBuffer)
{
return new DataView(arrayBuffer);
}
// BODY and PARTS
var _Http_emptyBody = { $: 0 };
var _Http_pair = F2(function(a, b) { return { $: 0, a: a, b: b }; });
function _Http_toFormData(parts)
{
for (var formData = new FormData(); parts.b; parts = parts.b) // WHILE_CONS
{
var part = parts.a;
formData.append(part.a, part.b);
}
return formData;
}
var _Http_bytesToBlob = F2(function(mime, bytes)
{
return new Blob([bytes], { type: mime });
});
// PROGRESS
function _Http_track(router, xhr, tracker)
{
// TODO check out lengthComputable on loadstart event
xhr.upload.addEventListener('progress', function(event) {
if (xhr.c) { return; }
_Scheduler_rawSpawn(A2($elm$core$Platform$sendToSelf, router, _Utils_Tuple2(tracker, $elm$http$Http$Sending({
sent: event.loaded,
size: event.total
}))));
});
xhr.addEventListener('progress', function(event) {
if (xhr.c) { return; }
_Scheduler_rawSpawn(A2($elm$core$Platform$sendToSelf, router, _Utils_Tuple2(tracker, $elm$http$Http$Receiving({
received: event.loaded,
size: event.lengthComputable ? $elm$core$Maybe$Just(event.total) : $elm$core$Maybe$Nothing
}))));
});
}
};
var $author$project$Queens$ReceivedSolution = function (a) {
return {$: 'ReceivedSolution', a: a};
};
var $elm$json$Json$Decode$decodeString = _Json_runOnString;
var $elm$http$Http$BadStatus_ = F2(
function (a, b) {
return {$: 'BadStatus_', a: a, b: b};
});
var $elm$http$Http$BadUrl_ = function (a) {
return {$: 'BadUrl_', a: a};
};
var $elm$http$Http$GoodStatus_ = F2(
function (a, b) {
return {$: 'GoodStatus_', a: a, b: b};
});
var $elm$http$Http$NetworkError_ = {$: 'NetworkError_'};
var $elm$http$Http$Receiving = function (a) {
return {$: 'Receiving', a: a};
var $elm$http$Http$Sending = function (a) {
return {$: 'Sending', a: a};
};
var $elm$http$Http$Timeout_ = {$: 'Timeout_'};
var $elm$core$Maybe$isJust = function (maybe) {
if (maybe.$ === 'Just') {
return true;
} else {
return false;
}
};
var $elm$core$Platform$sendToSelf = _Platform_sendToSelf;
var $elm$core$Basics$compare = _Utils_compare;
var $elm$core$Dict$get = F2(
function (targetKey, dict) {
get:
while (true) {
if (dict.$ === 'RBEmpty_elm_builtin') {
return $elm$core$Maybe$Nothing;
} else {
var key = dict.b;
var value = dict.c;
var left = dict.d;
var right = dict.e;
var _v1 = A2($elm$core$Basics$compare, targetKey, key);
switch (_v1.$) {
case 'LT':
var $temp$targetKey = targetKey,
$temp$dict = left;
targetKey = $temp$targetKey;
dict = $temp$dict;
continue get;
case 'EQ':
return $elm$core$Maybe$Just(value);
default:
var $temp$targetKey = targetKey,
$temp$dict = right;
targetKey = $temp$targetKey;
dict = $temp$dict;
continue get;
}
}
}
});
}
});
var $elm$core$Dict$update = F3(
function (targetKey, alter, dictionary) {
var _v0 = alter(
A2($elm$core$Dict$get, targetKey, dictionary));
if (_v0.$ === 'Just') {
var value = _v0.a;
return A3($elm$core$Dict$insert, targetKey, value, dictionary);
} else {
return A2($elm$core$Dict$remove, targetKey, dictionary);
}
});
var $elm$core$Basics$composeR = F3(
function (f, g, x) {
return g(
f(x));
});
var $elm$http$Http$expectStringResponse = F2(
function (toMsg, toResult) {
return A3(
_Http_expect,
'',
$elm$core$Basics$identity,
A2($elm$core$Basics$composeR, toResult, toMsg));
});
var $elm$core$Result$mapError = F2(
function (f, result) {
if (result.$ === 'Ok') {
var v = result.a;
return $elm$core$Result$Ok(v);
} else {
var e = result.a;
return $elm$core$Result$Err(
f(e));
}
});
var $elm$http$Http$BadBody = function (a) {
return {$: 'BadBody', a: a};
};
var $elm$http$Http$BadStatus = function (a) {
return {$: 'BadStatus', a: a};
};
var $elm$http$Http$BadUrl = function (a) {
return {$: 'BadUrl', a: a};
};
var $elm$http$Http$NetworkError = {$: 'NetworkError'};
var $elm$http$Http$Timeout = {$: 'Timeout'};
var $elm$http$Http$resolve = F2(
function (toResult, response) {
switch (response.$) {
case 'BadUrl_':
var url = response.a;
return $elm$core$Result$Err(
$elm$http$Http$BadUrl(url));
case 'Timeout_':
return $elm$core$Result$Err($elm$http$Http$Timeout);
case 'NetworkError_':
return $elm$core$Result$Err($elm$http$Http$NetworkError);
case 'BadStatus_':
var metadata = response.a;
return $elm$core$Result$Err(
$elm$http$Http$BadStatus(metadata.statusCode));
default:
var body = response.b;
return A2(
$elm$core$Result$mapError,
$elm$http$Http$BadBody,
toResult(body));
}
});
var $elm$http$Http$expectJson = F2(
function (toMsg, decoder) {
return A2(
$elm$http$Http$expectStringResponse,
toMsg,
$elm$http$Http$resolve(
function (string) {
return A2(
$elm$core$Result$mapError,
$elm$json$Json$Decode$errorToString,
A2($elm$json$Json$Decode$decodeString, decoder, string));
}));
});
var $elm$core$Dict$foldl = F3(
function (func, acc, dict) {
foldl:
while (true) {
if (dict.$ === 'RBEmpty_elm_builtin') {
return acc;
} else {
var key = dict.b;
var value = dict.c;
var left = dict.d;
var right = dict.e;
var $temp$func = func,
$temp$acc = A3(
func,
key,
value,
A3($elm$core$Dict$foldl, func, acc, left)),
$temp$dict = right;
func = $temp$func;
acc = $temp$acc;
dict = $temp$dict;
continue foldl;
}
}
});
var $elm$core$Dict$filter = F2(
function (isGood, dict) {
return A3(
$elm$core$Dict$foldl,
F3(
function (k, v, d) {
return A2(isGood, k, v) ? A3($elm$core$Dict$insert, k, v, d) : d;
}),
$elm$core$Dict$empty,
dict);
});
var $elm$core$Set$filter = F2(
function (isGood, _v0) {
var dict = _v0.a;
return $elm$core$Set$Set_elm_builtin(
A2(
$elm$core$Dict$filter,
F2(
function (key, _v1) {
return isGood(key);
}),
dict));
});
var $elm$core$Set$insert = F2(
function (key, _v0) {
var dict = _v0.a;
return $elm$core$Set$Set_elm_builtin(
A3($elm$core$Dict$insert, key, _Utils_Tuple0, dict));
});
var $elm$core$Set$fromList = function (list) {
return A3($elm$core$List$foldl, $elm$core$Set$insert, $elm$core$Set$empty, list);
};
var $elm$http$Http$emptyBody = _Http_emptyBody;
var $elm$http$Http$Request = function (a) {
return {$: 'Request', a: a};
};
var $elm$http$Http$State = F2(
function (reqs, subs) {
return {reqs: reqs, subs: subs};
});
var $elm$http$Http$init = $elm$core$Task$succeed(
A2($elm$http$Http$State, $elm$core$Dict$empty, _List_Nil));
var $elm$core$Process$kill = _Scheduler_kill;
var $elm$core$Process$spawn = _Scheduler_spawn;
var $elm$http$Http$updateReqs = F3(
function (router, cmds, reqs) {
updateReqs:
while (true) {
if (!cmds.b) {
return $elm$core$Task$succeed(reqs);
} else {
var cmd = cmds.a;
var otherCmds = cmds.b;
if (cmd.$ === 'Cancel') {
var tracker = cmd.a;
var _v2 = A2($elm$core$Dict$get, tracker, reqs);
if (_v2.$ === 'Nothing') {
var $temp$router = router,
$temp$cmds = otherCmds,
$temp$reqs = reqs;
router = $temp$router;
cmds = $temp$cmds;
reqs = $temp$reqs;
continue updateReqs;
} else {
var pid = _v2.a;
return A2(
$elm$core$Task$andThen,
function (_v3) {
return A3(
$elm$http$Http$updateReqs,
router,
otherCmds,
A2($elm$core$Dict$remove, tracker, reqs));
},
$elm$core$Process$kill(pid));
}
} else {
var req = cmd.a;
return A2(
$elm$core$Task$andThen,
function (pid) {
var _v4 = req.tracker;
if (_v4.$ === 'Nothing') {
return A3($elm$http$Http$updateReqs, router, otherCmds, reqs);
} else {
var tracker = _v4.a;
return A3(
$elm$http$Http$updateReqs,
router,
otherCmds,
A3($elm$core$Dict$insert, tracker, pid, reqs));
}
},
$elm$core$Process$spawn(
A3(
_Http_toTask,
router,
$elm$core$Platform$sendToApp(router),
req)));
}
}
}
});
var $elm$http$Http$onEffects = F4(
function (router, cmds, subs, state) {
return A2(
$elm$core$Task$andThen,
function (reqs) {
return $elm$core$Task$succeed(
A2($elm$http$Http$State, reqs, subs));
},
A3($elm$http$Http$updateReqs, router, cmds, state.reqs));
});
var $elm$core$List$maybeCons = F3(
function (f, mx, xs) {
var _v0 = f(mx);
if (_v0.$ === 'Just') {
var x = _v0.a;
return A2($elm$core$List$cons, x, xs);
} else {
return xs;
var $elm$core$List$filterMap = F2(
function (f, xs) {
return A3(
$elm$core$List$foldr,
$elm$core$List$maybeCons(f),
_List_Nil,
xs);
});
var $elm$http$Http$maybeSend = F4(
function (router, desiredTracker, progress, _v0) {
var actualTracker = _v0.a;
var toMsg = _v0.b;
return _Utils_eq(desiredTracker, actualTracker) ? $elm$core$Maybe$Just(
A2(
$elm$core$Platform$sendToApp,
router,
toMsg(progress))) : $elm$core$Maybe$Nothing;
});
var $elm$http$Http$onSelfMsg = F3(
function (router, _v0, state) {
var tracker = _v0.a;
var progress = _v0.b;
return A2(
$elm$core$Task$andThen,
function (_v1) {
return $elm$core$Task$succeed(state);
},
$elm$core$Task$sequence(
A2(
$elm$core$List$filterMap,
A3($elm$http$Http$maybeSend, router, tracker, progress),
state.subs)));
});
var $elm$http$Http$Cancel = function (a) {
return {$: 'Cancel', a: a};
};
var $elm$http$Http$cmdMap = F2(
function (func, cmd) {
if (cmd.$ === 'Cancel') {
var tracker = cmd.a;
return $elm$http$Http$Cancel(tracker);
} else {
var r = cmd.a;
return $elm$http$Http$Request(
{
allowCookiesFromOtherDomains: r.allowCookiesFromOtherDomains,
body: r.body,
expect: A2(_Http_mapExpect, func, r.expect),
headers: r.headers,
method: r.method,
timeout: r.timeout,
tracker: r.tracker,
url: r.url
});
}
});
var $elm$http$Http$MySub = F2(
function (a, b) {
return {$: 'MySub', a: a, b: b};
});
var $elm$http$Http$subMap = F2(
function (func, _v0) {
var tracker = _v0.a;
var toMsg = _v0.b;
return A2(
$elm$http$Http$MySub,
tracker,
A2($elm$core$Basics$composeR, toMsg, func));
});
_Platform_effectManagers['Http'] = _Platform_createManager($elm$http$Http$init, $elm$http$Http$onEffects, $elm$http$Http$onSelfMsg, $elm$http$Http$cmdMap, $elm$http$Http$subMap);
var $elm$http$Http$command = _Platform_leaf('Http');
var $elm$http$Http$subscription = _Platform_leaf('Http');
var $elm$http$Http$request = function (r) {
return $elm$http$Http$command(
$elm$http$Http$Request(
{allowCookiesFromOtherDomains: false, body: r.body, expect: r.expect, headers: r.headers, method: r.method, timeout: r.timeout, tracker: r.tracker, url: r.url}));
};
var $elm$http$Http$get = function (r) {
return $elm$http$Http$request(
{body: $elm$http$Http$emptyBody, expect: r.expect, headers: _List_Nil, method: 'GET', timeout: $elm$core$Maybe$Nothing, tracker: $elm$core$Maybe$Nothing, url: r.url});
};
var $elm$core$Basics$negate = function (n) {
return -n;
};
var $author$project$Queens$listToTuple = function (l) {
if (l.b && l.b.b) {
var x = l.a;
var _v1 = l.b;
var y = _v1.a;
var xs = _v1.b;
return _Utils_Tuple2(x, y);
} else {
return _Utils_Tuple2(-1, -1);
}
};
var $elm$json$Json$Decode$field = _Json_decodeField;
var $elm$json$Json$Decode$int = _Json_decodeInt;
var $elm$json$Json$Decode$list = _Json_decodeList;
var $author$project$Queens$solutionDecoder = A2(
$elm$json$Json$Decode$field,
'queens',
$elm$json$Json$Decode$list(
$elm$json$Json$Decode$list($elm$json$Json$Decode$int)));
case 'ChangeBoardSize':
var size = msg.a;
return _Utils_Tuple2(
_Utils_update(
model,
{
queens: A2(
$elm$core$Set$filter,
function (_v1) {
var x = _v1.a;
var y = _v1.b;
return (_Utils_cmp(x, size) < 0) && (_Utils_cmp(y, size) < 0);
},
model.queens),
size: size
}),
$elm$core$Platform$Cmd$none);
case 'Solve':
return _Utils_Tuple2(
model,
$elm$http$Http$get(
{
expect: A2($elm$http$Http$expectJson, $author$project$Queens$ReceivedSolution, $author$project$Queens$solutionDecoder),
url: 'solve?id=1&size=' + $elm$core$String$fromInt(model.size)
}));
case 'ReceivedSolution':
var maybeSol = msg.a;
if (maybeSol.$ === 'Ok') {
var sol = maybeSol.a;
return _Utils_Tuple2(
_Utils_update(
model,
{
queens: $elm$core$Set$fromList(
A2(
$elm$core$List$map,
function (l) {
return $author$project$Queens$listToTuple(l);
},
sol))
}),
$elm$core$Platform$Cmd$none);
} else {
var err = maybeSol.a;
return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none);
}
var $mdgriffith$elm_ui$Internal$Model$Behind = {$: 'Behind'};
var $mdgriffith$elm_ui$Internal$Model$Nearby = F2(
function (a, b) {
return {$: 'Nearby', a: a, b: b};
});
var $mdgriffith$elm_ui$Internal$Model$NoAttribute = {$: 'NoAttribute'};
var $mdgriffith$elm_ui$Element$createNearby = F2(
function (loc, element) {
if (element.$ === 'Empty') {
return $mdgriffith$elm_ui$Internal$Model$NoAttribute;
} else {
return A2($mdgriffith$elm_ui$Internal$Model$Nearby, loc, element);
}
});
var $mdgriffith$elm_ui$Element$behindContent = function (element) {
return A2($mdgriffith$elm_ui$Element$createNearby, $mdgriffith$elm_ui$Internal$Model$Behind, element);
};
var squares = function (n) {
return $elm$core$List$concat(
A2(
$elm$core$List$map,
function (x) {
return A2(
$elm$core$List$map,
function (y) {
return _Utils_Tuple2(x, y);
},
A2($elm$core$List$range, 0, n - 1));
},
A2($elm$core$List$range, 0, n - 1)));
};
var w = (160 / model.size) | 0;
var squares = $elm$core$List$concat(
A2(
$elm$core$List$map,
function (x) {
return A2(
$elm$core$List$map,
function (y) {
return _Utils_Tuple2(x, y);
},
A2($elm$core$List$range, 0, model.size - 1));
},
A2($elm$core$List$range, 0, model.size - 1)));
$elm$core$String$fromInt(j * 20)),
$elm$svg$Svg$Attributes$width('20'),
$elm$svg$Svg$Attributes$height('20'),
$elm$core$String$fromInt(j * w)),
$elm$svg$Svg$Attributes$width(
$elm$core$String$fromInt(w)),
$elm$svg$Svg$Attributes$height(
$elm$core$String$fromInt(w)),
var $elm$core$Dict$get = F2(
function (targetKey, dict) {
get:
while (true) {
if (dict.$ === 'RBEmpty_elm_builtin') {
return $elm$core$Maybe$Nothing;
} else {
var key = dict.b;
var value = dict.c;
var left = dict.d;
var right = dict.e;
var _v1 = A2($elm$core$Basics$compare, targetKey, key);
switch (_v1.$) {
case 'LT':
var $temp$targetKey = targetKey,
$temp$dict = left;
targetKey = $temp$targetKey;
dict = $temp$dict;
continue get;
case 'EQ':
return $elm$core$Maybe$Just(value);
default:
var $temp$targetKey = targetKey,
$temp$dict = right;
targetKey = $temp$targetKey;
dict = $temp$dict;
continue get;
}
}
}
});
var $elm$core$List$maybeCons = F3(
function (f, mx, xs) {
var _v0 = f(mx);
if (_v0.$ === 'Just') {
var x = _v0.a;
return A2($elm$core$List$cons, x, xs);
} else {
return xs;
}
});
var $elm$core$List$filterMap = F2(
function (f, xs) {
return A3(
$elm$core$List$foldr,
$elm$core$List$maybeCons(f),
_List_Nil,
xs);
});
var $mdgriffith$elm_ui$Element$Input$Thumb = function (a) {
return {$: 'Thumb', a: a};
};
var $mdgriffith$elm_ui$Internal$Flag$borderColor = $mdgriffith$elm_ui$Internal$Flag$flag(28);
var $mdgriffith$elm_ui$Element$Border$color = function (clr) {
return A2(
$mdgriffith$elm_ui$Internal$Model$StyleClass,
$mdgriffith$elm_ui$Internal$Flag$borderColor,
A3(
$mdgriffith$elm_ui$Internal$Model$Colored,
'bc-' + $mdgriffith$elm_ui$Internal$Model$formatColorClass(clr),
'border-color',
clr));
};
var $mdgriffith$elm_ui$Internal$Model$Px = function (a) {
return {$: 'Px', a: a};
};
var $mdgriffith$elm_ui$Element$px = $mdgriffith$elm_ui$Internal$Model$Px;
var $mdgriffith$elm_ui$Internal$Model$Rgba = F4(
function (a, b, c, d) {
return {$: 'Rgba', a: a, b: b, c: c, d: d};
});
var $mdgriffith$elm_ui$Element$rgb = F3(
function (r, g, b) {
return A4($mdgriffith$elm_ui$Internal$Model$Rgba, r, g, b, 1);
});
var $mdgriffith$elm_ui$Internal$Flag$borderRound = $mdgriffith$elm_ui$Internal$Flag$flag(17);
var $mdgriffith$elm_ui$Element$Border$rounded = function (radius) {
return A2(
$mdgriffith$elm_ui$Internal$Model$StyleClass,
$mdgriffith$elm_ui$Internal$Flag$borderRound,
A3(
$mdgriffith$elm_ui$Internal$Model$Single,
'br-' + $elm$core$String$fromInt(radius),
'border-radius',
$elm$core$String$fromInt(radius) + 'px'));
};
var $mdgriffith$elm_ui$Internal$Model$BorderWidth = F5(
function (a, b, c, d, e) {
return {$: 'BorderWidth', a: a, b: b, c: c, d: d, e: e};
});
var $mdgriffith$elm_ui$Element$Border$width = function (v) {
return A2(
$mdgriffith$elm_ui$Internal$Model$StyleClass,
$mdgriffith$elm_ui$Internal$Flag$borderWidth,
A5(
$mdgriffith$elm_ui$Internal$Model$BorderWidth,
'b-' + $elm$core$String$fromInt(v),
v,
v,
v,
v));
};
var $mdgriffith$elm_ui$Element$Input$defaultThumb = $mdgriffith$elm_ui$Element$Input$Thumb(
_List_fromArray(
[
$mdgriffith$elm_ui$Element$width(
$mdgriffith$elm_ui$Element$px(16)),
$mdgriffith$elm_ui$Element$height(
$mdgriffith$elm_ui$Element$px(16)),
$mdgriffith$elm_ui$Element$Border$rounded(8),
$mdgriffith$elm_ui$Element$Border$width(1),
$mdgriffith$elm_ui$Element$Border$color(
A3($mdgriffith$elm_ui$Element$rgb, 0.5, 0.5, 0.5)),
$mdgriffith$elm_ui$Element$Background$color(
A3($mdgriffith$elm_ui$Element$rgb, 1, 1, 1))
]));
var $mdgriffith$elm_ui$Element$Input$Above = {$: 'Above'};
var $mdgriffith$elm_ui$Element$Input$Label = F3(
function (a, b, c) {
return {$: 'Label', a: a, b: b, c: c};
});
var $mdgriffith$elm_ui$Element$Input$labelAbove = $mdgriffith$elm_ui$Element$Input$Label($mdgriffith$elm_ui$Element$Input$Above);
var $mdgriffith$elm_ui$Internal$Flag$borderRound = $mdgriffith$elm_ui$Internal$Flag$flag(17);
var $mdgriffith$elm_ui$Element$Border$rounded = function (radius) {
return A2(
$mdgriffith$elm_ui$Internal$Model$StyleClass,
$mdgriffith$elm_ui$Internal$Flag$borderRound,
A3(
$mdgriffith$elm_ui$Internal$Model$Single,
'br-' + $elm$core$String$fromInt(radius),
'border-radius',
$elm$core$String$fromInt(radius) + 'px'));
};
var $mdgriffith$elm_ui$Internal$Flag$borderStyle = $mdgriffith$elm_ui$Internal$Flag$flag(11);
var $mdgriffith$elm_ui$Element$Border$solid = A2($mdgriffith$elm_ui$Internal$Model$Class, $mdgriffith$elm_ui$Internal$Flag$borderStyle, $mdgriffith$elm_ui$Internal$Style$classes.borderSolid);
var $mdgriffith$elm_ui$Internal$Flag$active = $mdgriffith$elm_ui$Internal$Flag$flag(32);
var $mdgriffith$elm_ui$Internal$Model$LivePolite = {$: 'LivePolite'};
var $mdgriffith$elm_ui$Element$Region$announce = $mdgriffith$elm_ui$Internal$Model$Describe($mdgriffith$elm_ui$Internal$Model$LivePolite);
var $mdgriffith$elm_ui$Element$Input$applyLabel = F3(
function (attrs, label, input) {
if (label.$ === 'HiddenLabel') {
var labelText = label.a;
return A4(
$mdgriffith$elm_ui$Internal$Model$element,
$mdgriffith$elm_ui$Internal$Model$asColumn,
$mdgriffith$elm_ui$Internal$Model$NodeName('label'),
attrs,
$mdgriffith$elm_ui$Internal$Model$Unkeyed(
_List_fromArray(
[input])));
} else {
var position = label.a;
var labelAttrs = label.b;
var labelChild = label.c;
var labelElement = A4(
$mdgriffith$elm_ui$Internal$Model$element,
$mdgriffith$elm_ui$Internal$Model$asEl,
$mdgriffith$elm_ui$Internal$Model$div,
labelAttrs,
$mdgriffith$elm_ui$Internal$Model$Unkeyed(
_List_fromArray(
[labelChild])));
switch (position.$) {
case 'Above':
return A4(
$mdgriffith$elm_ui$Internal$Model$element,
$mdgriffith$elm_ui$Internal$Model$asColumn,
$mdgriffith$elm_ui$Internal$Model$NodeName('label'),
A2(
$elm$core$List$cons,
$mdgriffith$elm_ui$Internal$Model$htmlClass($mdgriffith$elm_ui$Internal$Style$classes.inputLabel),
attrs),
$mdgriffith$elm_ui$Internal$Model$Unkeyed(
_List_fromArray(
[labelElement, input])));
case 'Below':
return A4(
$mdgriffith$elm_ui$Internal$Model$element,
$mdgriffith$elm_ui$Internal$Model$asColumn,
$mdgriffith$elm_ui$Internal$Model$NodeName('label'),
A2(
$elm$core$List$cons,
$mdgriffith$elm_ui$Internal$Model$htmlClass($mdgriffith$elm_ui$Internal$Style$classes.inputLabel),
attrs),
$mdgriffith$elm_ui$Internal$Model$Unkeyed(
_List_fromArray(
[input, labelElement])));
case 'OnRight':
return A4(
$mdgriffith$elm_ui$Internal$Model$element,
$mdgriffith$elm_ui$Internal$Model$asRow,
$mdgriffith$elm_ui$Internal$Model$NodeName('label'),
A2(
$elm$core$List$cons,
$mdgriffith$elm_ui$Internal$Model$htmlClass($mdgriffith$elm_ui$Internal$Style$classes.inputLabel),
attrs),
$mdgriffith$elm_ui$Internal$Model$Unkeyed(
_List_fromArray(
[input, labelElement])));
default:
return A4(
$mdgriffith$elm_ui$Internal$Model$element,
$mdgriffith$elm_ui$Internal$Model$asRow,
$mdgriffith$elm_ui$Internal$Model$NodeName('label'),
A2(
$elm$core$List$cons,
$mdgriffith$elm_ui$Internal$Model$htmlClass($mdgriffith$elm_ui$Internal$Style$classes.inputLabel),
attrs),
$mdgriffith$elm_ui$Internal$Model$Unkeyed(
_List_fromArray(
[labelElement, input])));
}
}
});
var $elm$html$Html$Attributes$attribute = $elm$virtual_dom$VirtualDom$attribute;
var $mdgriffith$elm_ui$Internal$Flag$focus = $mdgriffith$elm_ui$Internal$Flag$flag(31);
var $mdgriffith$elm_ui$Internal$Model$getHeight = function (attrs) {
return A3(
$elm$core$List$foldr,
F2(
function (attr, acc) {
if (acc.$ === 'Just') {
var x = acc.a;
return $elm$core$Maybe$Just(x);
} else {
if (attr.$ === 'Height') {
var len = attr.a;
return $elm$core$Maybe$Just(len);
} else {
return $elm$core$Maybe$Nothing;
}
}
}),
$elm$core$Maybe$Nothing,
attrs);
};
var $mdgriffith$elm_ui$Internal$Model$getSpacing = F2(
function (attrs, _default) {
return A2(
$elm$core$Maybe$withDefault,
_default,
A3(
$elm$core$List$foldr,
F2(
function (attr, acc) {
if (acc.$ === 'Just') {
var x = acc.a;
return $elm$core$Maybe$Just(x);
} else {
if ((attr.$ === 'StyleClass') && (attr.b.$ === 'SpacingStyle')) {
var _v2 = attr.b;
var x = _v2.b;
var y = _v2.c;
return $elm$core$Maybe$Just(
_Utils_Tuple2(x, y));
} else {
return $elm$core$Maybe$Nothing;
}
}
}),
$elm$core$Maybe$Nothing,
attrs));
});
var $mdgriffith$elm_ui$Internal$Model$getWidth = function (attrs) {
return A3(
$elm$core$List$foldr,
F2(
function (attr, acc) {
if (acc.$ === 'Just') {
var x = acc.a;
return $elm$core$Maybe$Just(x);
} else {
if (attr.$ === 'Width') {
var len = attr.a;
return $elm$core$Maybe$Just(len);
} else {
return $elm$core$Maybe$Nothing;
}
}
}),
$elm$core$Maybe$Nothing,
attrs);
};
var $mdgriffith$elm_ui$Internal$Model$Label = function (a) {
return {$: 'Label', a: a};
};
var $mdgriffith$elm_ui$Element$Input$hiddenLabelAttribute = function (label) {
if (label.$ === 'HiddenLabel') {
var textLabel = label.a;
return $mdgriffith$elm_ui$Internal$Model$Describe(
$mdgriffith$elm_ui$Internal$Model$Label(textLabel));
} else {
return $mdgriffith$elm_ui$Internal$Model$NoAttribute;
}
};
var $mdgriffith$elm_ui$Internal$Flag$hover = $mdgriffith$elm_ui$Internal$Flag$flag(33);
var $mdgriffith$elm_ui$Element$Input$isHiddenLabel = function (label) {
if (label.$ === 'HiddenLabel') {
return true;
} else {
return false;
}
};
var $elm$html$Html$Attributes$max = $elm$html$Html$Attributes$stringProperty('max');
var $elm$html$Html$Attributes$min = $elm$html$Html$Attributes$stringProperty('min');
var $elm$html$Html$Events$alwaysStop = function (x) {
return _Utils_Tuple2(x, true);
};
var $elm$virtual_dom$VirtualDom$MayStopPropagation = function (a) {
return {$: 'MayStopPropagation', a: a};
};
var $elm$html$Html$Events$stopPropagationOn = F2(
function (event, decoder) {
return A2(
$elm$virtual_dom$VirtualDom$on,
event,
$elm$virtual_dom$VirtualDom$MayStopPropagation(decoder));
});
var $elm$json$Json$Decode$at = F2(
function (fields, decoder) {
return A3($elm$core$List$foldr, $elm$json$Json$Decode$field, decoder, fields);
});
var $elm$html$Html$Events$targetValue = A2(
$elm$json$Json$Decode$at,
_List_fromArray(
['target', 'value']),
$elm$json$Json$Decode$string);
var $elm$html$Html$Events$onInput = function (tagger) {
return A2(
$elm$html$Html$Events$stopPropagationOn,
'input',
A2(
$elm$json$Json$Decode$map,
$elm$html$Html$Events$alwaysStop,
A2($elm$json$Json$Decode$map, tagger, $elm$html$Html$Events$targetValue)));
};
});
var $mdgriffith$elm_ui$Element$spacingXY = F2(
function (x, y) {
return A2(
$mdgriffith$elm_ui$Internal$Model$StyleClass,
$mdgriffith$elm_ui$Internal$Flag$spacing,
A3(
$mdgriffith$elm_ui$Internal$Model$SpacingStyle,
A2($mdgriffith$elm_ui$Internal$Model$spacingName, x, y),
x,
y));
});
var $elm$html$Html$Attributes$step = function (n) {
return A2($elm$html$Html$Attributes$stringProperty, 'step', n);
};
var $elm$core$String$toFloat = _String_toFloat;
var $elm$html$Html$Attributes$type_ = $elm$html$Html$Attributes$stringProperty('type');
var $elm$html$Html$Attributes$value = $elm$html$Html$Attributes$stringProperty('value');
var $elm$core$Basics$abs = function (n) {
return (n < 0) ? (-n) : n;
};
var $mdgriffith$elm_ui$Element$fillPortion = $mdgriffith$elm_ui$Internal$Model$Fill;
var $mdgriffith$elm_ui$Internal$Model$TransformComponent = F2(
function (a, b) {
return {$: 'TransformComponent', a: a, b: b};
});
var $mdgriffith$elm_ui$Internal$Model$Text = function (a) {
return {$: 'Text', a: a};
};
var $elm$virtual_dom$VirtualDom$map = _VirtualDom_map;
var $mdgriffith$elm_ui$Internal$Model$map = F2(
function (fn, el) {
switch (el.$) {
case 'Styled':
var styled = el.a;
return $mdgriffith$elm_ui$Internal$Model$Styled(
{
html: F2(
function (add, context) {
return A2(
$elm$virtual_dom$VirtualDom$map,
fn,
A2(styled.html, add, context));
}),
styles: styled.styles
});
case 'Unstyled':
var html = el.a;
return $mdgriffith$elm_ui$Internal$Model$Unstyled(
A2(
$elm$core$Basics$composeL,
$elm$virtual_dom$VirtualDom$map(fn),
html));
case 'Text':
var str = el.a;
return $mdgriffith$elm_ui$Internal$Model$Text(str);
default:
return $mdgriffith$elm_ui$Internal$Model$Empty;
}
});
var $elm$virtual_dom$VirtualDom$mapAttribute = _VirtualDom_mapAttribute;
var $mdgriffith$elm_ui$Internal$Model$mapAttr = F2(
function (fn, attr) {
switch (attr.$) {
case 'NoAttribute':
return $mdgriffith$elm_ui$Internal$Model$NoAttribute;
case 'Describe':
var description = attr.a;
return $mdgriffith$elm_ui$Internal$Model$Describe(description);
case 'AlignX':
var x = attr.a;
return $mdgriffith$elm_ui$Internal$Model$AlignX(x);
case 'AlignY':
var y = attr.a;
return $mdgriffith$elm_ui$Internal$Model$AlignY(y);
case 'Width':
var x = attr.a;
return $mdgriffith$elm_ui$Internal$Model$Width(x);
case 'Height':
var x = attr.a;
return $mdgriffith$elm_ui$Internal$Model$Height(x);
case 'Class':
var x = attr.a;
var y = attr.b;
return A2($mdgriffith$elm_ui$Internal$Model$Class, x, y);
case 'StyleClass':
var flag = attr.a;
var style = attr.b;
return A2($mdgriffith$elm_ui$Internal$Model$StyleClass, flag, style);
case 'Nearby':
var location = attr.a;
var elem = attr.b;
return A2(
$mdgriffith$elm_ui$Internal$Model$Nearby,
location,
A2($mdgriffith$elm_ui$Internal$Model$map, fn, elem));
case 'Attr':
var htmlAttr = attr.a;
return $mdgriffith$elm_ui$Internal$Model$Attr(
A2($elm$virtual_dom$VirtualDom$mapAttribute, fn, htmlAttr));
default:
var fl = attr.a;
var trans = attr.b;
return A2($mdgriffith$elm_ui$Internal$Model$TransformComponent, fl, trans);
}
});
var $mdgriffith$elm_ui$Element$Input$viewHorizontalThumb = F3(
function (factor, thumbAttributes, trackHeight) {
return A2(
$mdgriffith$elm_ui$Element$row,
_List_fromArray(
[
$mdgriffith$elm_ui$Element$width($mdgriffith$elm_ui$Element$fill),
$mdgriffith$elm_ui$Element$height(
A2($elm$core$Maybe$withDefault, $mdgriffith$elm_ui$Element$fill, trackHeight)),
$mdgriffith$elm_ui$Element$centerY
]),
_List_fromArray(
[
A2(
$mdgriffith$elm_ui$Element$el,
_List_fromArray(
[
$mdgriffith$elm_ui$Element$width(
$mdgriffith$elm_ui$Element$fillPortion(
$elm$core$Basics$round(factor * 10000)))
]),
$mdgriffith$elm_ui$Element$none),
A2(
$mdgriffith$elm_ui$Element$el,
A2(
$elm$core$List$cons,
$mdgriffith$elm_ui$Element$centerY,
A2(
$elm$core$List$map,
$mdgriffith$elm_ui$Internal$Model$mapAttr($elm$core$Basics$never),
thumbAttributes)),
$mdgriffith$elm_ui$Element$none),
A2(
$mdgriffith$elm_ui$Element$el,
_List_fromArray(
[
$mdgriffith$elm_ui$Element$width(
$mdgriffith$elm_ui$Element$fillPortion(
$elm$core$Basics$round(
$elm$core$Basics$abs(1 - factor) * 10000)))
]),
$mdgriffith$elm_ui$Element$none)
]));
});
var $mdgriffith$elm_ui$Element$Input$viewVerticalThumb = F3(
function (factor, thumbAttributes, trackWidth) {
return A2(
$mdgriffith$elm_ui$Element$column,
_List_fromArray(
[
$mdgriffith$elm_ui$Element$height($mdgriffith$elm_ui$Element$fill),
$mdgriffith$elm_ui$Element$width(
A2($elm$core$Maybe$withDefault, $mdgriffith$elm_ui$Element$fill, trackWidth)),
$mdgriffith$elm_ui$Element$centerX
]),
_List_fromArray(
[
A2(
$mdgriffith$elm_ui$Element$el,
_List_fromArray(
[
$mdgriffith$elm_ui$Element$height(
$mdgriffith$elm_ui$Element$fillPortion(
$elm$core$Basics$round(
$elm$core$Basics$abs(1 - factor) * 10000)))
]),
$mdgriffith$elm_ui$Element$none),
A2(
$mdgriffith$elm_ui$Element$el,
A2(
$elm$core$List$cons,
$mdgriffith$elm_ui$Element$centerX,
A2(
$elm$core$List$map,
$mdgriffith$elm_ui$Internal$Model$mapAttr($elm$core$Basics$never),
thumbAttributes)),
$mdgriffith$elm_ui$Element$none),
A2(
$mdgriffith$elm_ui$Element$el,
_List_fromArray(
[
$mdgriffith$elm_ui$Element$height(
$mdgriffith$elm_ui$Element$fillPortion(
$elm$core$Basics$round(factor * 10000)))
]),
$mdgriffith$elm_ui$Element$none)
]));
});
var $mdgriffith$elm_ui$Element$Input$slider = F2(
function (attributes, input) {
var trackWidth = $mdgriffith$elm_ui$Internal$Model$getWidth(attributes);
var trackHeight = $mdgriffith$elm_ui$Internal$Model$getHeight(attributes);
var vertical = function () {
var _v8 = _Utils_Tuple2(trackWidth, trackHeight);
_v8$3:
while (true) {
if (_v8.a.$ === 'Nothing') {
if (_v8.b.$ === 'Nothing') {
var _v9 = _v8.a;
var _v10 = _v8.b;
return false;
} else {
break _v8$3;
}
} else {
if ((_v8.a.a.$ === 'Px') && (_v8.b.$ === 'Just')) {
switch (_v8.b.a.$) {
case 'Px':
var w = _v8.a.a.a;
var h = _v8.b.a.a;
return _Utils_cmp(h, w) > 0;
case 'Fill':
return true;
default:
break _v8$3;
}
} else {
break _v8$3;
}
}
}
return false;
}();
var factor = (input.value - input.min) / (input.max - input.min);
var _v0 = input.thumb;
var thumbAttributes = _v0.a;
var height = $mdgriffith$elm_ui$Internal$Model$getHeight(thumbAttributes);
var thumbHeightString = function () {
if (height.$ === 'Nothing') {
return '20px';
} else {
if (height.a.$ === 'Px') {
var px = height.a.a;
return $elm$core$String$fromInt(px) + 'px';
} else {
return '100%';
}
}
}();
var width = $mdgriffith$elm_ui$Internal$Model$getWidth(thumbAttributes);
var thumbWidthString = function () {
if (width.$ === 'Nothing') {
return '20px';
} else {
if (width.a.$ === 'Px') {
var px = width.a.a;
return $elm$core$String$fromInt(px) + 'px';
} else {
return '100%';
}
}
}();
var className = 'thmb-' + (thumbWidthString + ('-' + thumbHeightString));
var thumbShadowStyle = _List_fromArray(
[
A2($mdgriffith$elm_ui$Internal$Model$Property, 'width', thumbWidthString),
A2($mdgriffith$elm_ui$Internal$Model$Property, 'height', thumbHeightString)
]);
var _v1 = A2(
$mdgriffith$elm_ui$Internal$Model$getSpacing,
attributes,
_Utils_Tuple2(5, 5));
var spacingX = _v1.a;
var spacingY = _v1.b;
return A3(
$mdgriffith$elm_ui$Element$Input$applyLabel,
_List_fromArray(
[
$mdgriffith$elm_ui$Element$Input$isHiddenLabel(input.label) ? $mdgriffith$elm_ui$Internal$Model$NoAttribute : A2($mdgriffith$elm_ui$Element$spacingXY, spacingX, spacingY),
$mdgriffith$elm_ui$Element$Region$announce,
$mdgriffith$elm_ui$Element$width(
function () {
if (trackWidth.$ === 'Nothing') {
return $mdgriffith$elm_ui$Element$fill;
} else {
if (trackWidth.a.$ === 'Px') {
return $mdgriffith$elm_ui$Element$shrink;
} else {
var x = trackWidth.a;
return x;
}
}
}()),
$mdgriffith$elm_ui$Element$height(
function () {
if (trackHeight.$ === 'Nothing') {
return $mdgriffith$elm_ui$Element$shrink;
} else {
if (trackHeight.a.$ === 'Px') {
return $mdgriffith$elm_ui$Element$shrink;
} else {
var x = trackHeight.a;
return x;
}
}
}())
]),
input.label,
A2(
$mdgriffith$elm_ui$Element$row,
_List_fromArray(
[
$mdgriffith$elm_ui$Element$width(
A2($elm$core$Maybe$withDefault, $mdgriffith$elm_ui$Element$fill, trackWidth)),
$mdgriffith$elm_ui$Element$height(
A2(
$elm$core$Maybe$withDefault,
$mdgriffith$elm_ui$Element$px(20),
trackHeight))
]),
_List_fromArray(
[
A4(
$mdgriffith$elm_ui$Internal$Model$element,
$mdgriffith$elm_ui$Internal$Model$asEl,
$mdgriffith$elm_ui$Internal$Model$NodeName('input'),
_List_fromArray(
[
$mdgriffith$elm_ui$Element$Input$hiddenLabelAttribute(input.label),
A2(
$mdgriffith$elm_ui$Internal$Model$StyleClass,
$mdgriffith$elm_ui$Internal$Flag$active,
A2($mdgriffith$elm_ui$Internal$Model$Style, 'input[type=\"range\"].' + (className + '::-moz-range-thumb'), thumbShadowStyle)),
A2(
$mdgriffith$elm_ui$Internal$Model$StyleClass,
$mdgriffith$elm_ui$Internal$Flag$hover,
A2($mdgriffith$elm_ui$Internal$Model$Style, 'input[type=\"range\"].' + (className + '::-webkit-slider-thumb'), thumbShadowStyle)),
A2(
$mdgriffith$elm_ui$Internal$Model$StyleClass,
$mdgriffith$elm_ui$Internal$Flag$focus,
A2($mdgriffith$elm_ui$Internal$Model$Style, 'input[type=\"range\"].' + (className + '::-ms-thumb'), thumbShadowStyle)),
$mdgriffith$elm_ui$Internal$Model$Attr(
$elm$html$Html$Attributes$class(className + ' ui-slide-bar focusable-parent')),
$mdgriffith$elm_ui$Internal$Model$Attr(
$elm$html$Html$Events$onInput(
function (str) {
var _v4 = $elm$core$String$toFloat(str);
if (_v4.$ === 'Nothing') {
return input.onChange(0);
} else {
var val = _v4.a;
return input.onChange(val);
}
})),
$mdgriffith$elm_ui$Internal$Model$Attr(
$elm$html$Html$Attributes$type_('range')),
$mdgriffith$elm_ui$Internal$Model$Attr(
$elm$html$Html$Attributes$step(
function () {
var _v5 = input.step;
if (_v5.$ === 'Nothing') {
return 'any';
} else {
var step = _v5.a;
return $elm$core$String$fromFloat(step);
}
}())),
$mdgriffith$elm_ui$Internal$Model$Attr(
$elm$html$Html$Attributes$min(
$elm$core$String$fromFloat(input.min))),
$mdgriffith$elm_ui$Internal$Model$Attr(
$elm$html$Html$Attributes$max(
$elm$core$String$fromFloat(input.max))),
$mdgriffith$elm_ui$Internal$Model$Attr(
$elm$html$Html$Attributes$value(
$elm$core$String$fromFloat(input.value))),
vertical ? $mdgriffith$elm_ui$Internal$Model$Attr(
A2($elm$html$Html$Attributes$attribute, 'orient', 'vertical')) : $mdgriffith$elm_ui$Internal$Model$NoAttribute,
$mdgriffith$elm_ui$Element$width(
vertical ? A2(
$elm$core$Maybe$withDefault,
$mdgriffith$elm_ui$Element$px(20),
trackHeight) : A2($elm$core$Maybe$withDefault, $mdgriffith$elm_ui$Element$fill, trackWidth)),
$mdgriffith$elm_ui$Element$height(
vertical ? A2($elm$core$Maybe$withDefault, $mdgriffith$elm_ui$Element$fill, trackWidth) : A2(
$elm$core$Maybe$withDefault,
$mdgriffith$elm_ui$Element$px(20),
trackHeight))
]),
$mdgriffith$elm_ui$Internal$Model$Unkeyed(_List_Nil)),
A2(
$mdgriffith$elm_ui$Element$el,
A2(
$elm$core$List$cons,
$mdgriffith$elm_ui$Element$width(
A2($elm$core$Maybe$withDefault, $mdgriffith$elm_ui$Element$fill, trackWidth)),
A2(
$elm$core$List$cons,
$mdgriffith$elm_ui$Element$height(
A2(
$elm$core$Maybe$withDefault,
$mdgriffith$elm_ui$Element$px(20),
trackHeight)),
_Utils_ap(
attributes,
_List_fromArray(
[
$mdgriffith$elm_ui$Element$behindContent(
vertical ? A3(
$mdgriffith$elm_ui$Element$Input$viewVerticalThumb,
factor,
A2(
$elm$core$List$cons,
$mdgriffith$elm_ui$Internal$Model$htmlClass('focusable-thumb'),
thumbAttributes),
trackWidth) : A3(
$mdgriffith$elm_ui$Element$Input$viewHorizontalThumb,
factor,
A2(
$elm$core$List$cons,
$mdgriffith$elm_ui$Internal$Model$htmlClass('focusable-thumb'),
thumbAttributes),
trackHeight))
])))),
$mdgriffith$elm_ui$Element$none)
])));
var $mdgriffith$elm_ui$Internal$Flag$borderStyle = $mdgriffith$elm_ui$Internal$Flag$flag(11);
var $mdgriffith$elm_ui$Element$Border$solid = A2($mdgriffith$elm_ui$Internal$Model$Class, $mdgriffith$elm_ui$Internal$Flag$borderStyle, $mdgriffith$elm_ui$Internal$Style$classes.borderSolid);
var sizeSlider = A2(
$mdgriffith$elm_ui$Element$Input$slider,
_List_fromArray(
[
$mdgriffith$elm_ui$Element$width(
$mdgriffith$elm_ui$Element$px(100)),
$mdgriffith$elm_ui$Element$behindContent(
A2(
$mdgriffith$elm_ui$Element$el,
_List_fromArray(
[
$mdgriffith$elm_ui$Element$width($mdgriffith$elm_ui$Element$fill),
$mdgriffith$elm_ui$Element$height(
$mdgriffith$elm_ui$Element$px(2)),
$mdgriffith$elm_ui$Element$centerY,
$mdgriffith$elm_ui$Element$Background$color(
A4($mdgriffith$elm_ui$Element$rgba, 0.8, 0.8, 0.8, 0.9)),
$mdgriffith$elm_ui$Element$Border$rounded(2)
]),
$mdgriffith$elm_ui$Element$none))
]),
{
label: A2(
$mdgriffith$elm_ui$Element$Input$labelAbove,
_List_Nil,
$mdgriffith$elm_ui$Element$text('Size')),
max: 20,
min: 4,
onChange: A2($elm$core$Basics$composeR, $elm$core$Basics$round, $author$project$Queens$ChangeBoardSize),
step: $elm$core$Maybe$Just(1),
thumb: $mdgriffith$elm_ui$Element$Input$defaultThumb,
value: model.size
});
ChangeBoardSize size
-> (
{ model
| size = size
, queens = Set.filter (\(x,y) -> x < size && y < size) model.queens
}
, Cmd.none
)
Solve
->
( model
, Http.get
{ url = "solve?id=1&size=" ++ String.fromInt model.size
, expect = Http.expectJson ReceivedSolution solutionDecoder
}
)
ReceivedSolution maybeSol
-> case maybeSol of
Ok(sol) -> ( { model | queens = Set.fromList <| List.map (\l -> listToTuple l) sol}, Cmd.none )
Err(err) -> ( model, Cmd.none )
in
layout
[]
<| column
[ spacing 20
, centerX
]
[ el [centerX, paddingXY 0 20] (text "Queens")
, el [] (html <| board model)
, row [spacing 10, alignRight] [b "Clear" ClearQueens, b "Solve" Solve]
sizeSlider = slider
[ Element.width <| px 100
, behindContent
<| el
[ Element.width fill
, Element.height <| px 2
, centerY
, Background.color <| rgba 0.8 0.8 0.8 0.9
, Border.rounded 2
Element.none
]
{ onChange = round >> ChangeBoardSize
, label = labelAbove [] <| text "Size"
, min = 4
, max = 20
, step = Just 1
, value = toFloat model.size
, thumb = defaultThumb
}
in
layout
[]
<| column
[ spacing 20
, centerX
]
[ el [centerX, paddingXY 0 20] (text "Queens")
, el [] (html <| board model)
, row [spacing 10, alignRight] [sizeSlider, b "Clear" ClearQueens, b "Solve" Solve]
]
-- Decoders and Encoders
solutionDecoder : Decoder (List (List Int))
solutionDecoder = field "queens" <| list (list int)
authorprojectQueensMsgelmjsonJson.Decodesucceed�������������� authorprojectQueensAddQueen���������������authorprojectQueensClearQueens���������������authorprojectQueensModel� �������idqueens�������ididqueensqueens��������authorprojectQueensNoOp���������������authorprojectQueensRemoveQueen��������������authorprojectQueensSolve���������������authorprojectQueensboard� �������model�squares �������nelmcoreBasicsapL�������elmcoreListconcatelmcoreListmap������� �������xelmcoreListmap������� �������yxy�elmcoreListrange���������������elmcoreBasicssub�������n�������elmcoreListrange���������������elmcoreBasicssub�������n��������square �������_v1i���������_v1j��������_v1elmsvgSvgrect��������������elmcoreBasicsapL�������elmsvgSvg.AttributesxelmcoreStringfromInt�������elmcoreBasicsmul�������i�������elmcoreBasicsapL�������elmsvgSvg.AttributesyelmcoreStringfromInt�������elmcoreBasicsmul�������j�������elmsvgSvg.Attributeswidth��������������20elmsvgSvg.Attributesheight��������������20elmcoreBasicsapL�������elmsvgSvg.Attributesfill�������elmcoreBasicseq�������elmcoreBasicsmodBy��������������elmcoreBasicsadd�������ij�������������� lightblue�������whiteelmsvg
Svg.EventsonClick�������authorprojectQueensAddQueen�������ij���������queen �������_v0i���������_v0j��������_v0elmcoreBasicsapL�������elmsvgSvg foreignObject��������������elmsvgSvg.Attributeswidth��������������20elmsvgSvg.Attributesheight��������������20elmcoreBasicsapL�������elmsvgSvg.AttributesxelmcoreStringfromInt�������elmcoreBasicsmul�������i�������elmcoreBasicsapL�������elmsvgSvg.AttributesyelmcoreStringfromInt�������elmcoreBasicsmul�������j�������elmsvg
Svg.EventsonClick�������authorprojectQueensRemoveQueen�������ij�������elmhtmlHtmlimg��������������elmhtmlHtml.Attributeswidth��������������elmhtmlHtml.Attributesheight��������������elmhtmlHtml.Attributessrc��������������static/queen.svg���������border�������elmsvgSvgline��������������elmsvgSvg.Attributesx1��������������0elmsvgSvg.Attributesy1��������������0elmsvgSvg.Attributesx2��������������160elmsvgSvg.Attributesy2��������������0elmsvgSvg.Attributesstroke��������������black��������elmsvgSvgline��������������elmsvgSvg.Attributesx1��������������160elmsvgSvg.Attributesy1��������������0elmsvgSvg.Attributesx2��������������160elmsvgSvg.Attributesy2��������������160elmsvgSvg.Attributesstroke��������������black��������elmsvgSvgline��������������elmsvgSvg.Attributesx1��������������160elmsvgSvg.Attributesy1��������������160elmsvgSvg.Attributesx2��������������0elmsvgSvg.Attributesy2��������������160elmsvgSvg.Attributesstroke��������������black��������elmsvgSvgline��������������elmsvgSvg.Attributesx1��������������0elmsvgSvg.Attributesy1��������������160elmsvgSvg.Attributesx2��������������0elmsvgSvg.Attributesy2��������������0elmsvgSvg.Attributesstroke��������������black��������elmcoreBasicsapL�������elmsvgSvgsvg��������������elmsvgSvg.Attributeswidth��������������500elmsvgSvg.Attributesheight��������������500elmsvgSvg.AttributesviewBox��������������0 0 160 160elmcoreBasicsappend�������elmcoreListmap�������squaresquares��������������elmcoreBasicsappend�������borderelmcoreBasicsapL�������elmcoreListmap�������queenelmcoreSettoList�������modelqueens�������$elmkernelList$elmkernelUtils$authorprojectQueensAddQueenauthorprojectQueensRemoveQueenelmcoreBasicsaddelmcoreBasicsapLelmcoreBasicsappendelmcoreListconcatelmcoreBasicseqelmsvgSvg.AttributesfillelmsvgSvg foreignObjectelmcoreStringfromIntelmhtmlHtml.AttributesheightelmsvgSvg.AttributesheightelmhtmlHtmlimgelmsvgSvglineelmcoreListmapelmcoreBasicsmodByelmcoreBasicsmulelmsvg
Svg.EventsonClickelmcoreListrangeelmsvgSvgrectelmhtmlHtml.AttributessrcelmsvgSvg.AttributesstrokeelmcoreBasicssubelmsvgSvgsvgelmcoreSettoListelmsvgSvg.AttributesviewBoxelmhtmlHtml.AttributeswidthelmsvgSvg.AttributeswidthelmsvgSvg.AttributesxelmsvgSvg.Attributesx1elmsvgSvg.Attributesx2elmsvgSvg.AttributesyelmsvgSvg.Attributesy1elmsvgSvg.Attributesy2authorprojectQueensinit� �������flags�������id�������queenselmcoreSetemptyelmcorePlatform.Cmdnone��������elmkernelUtils$elmcoreSetemptyelmcorePlatform.CmdnoneauthorprojectQueensmain�elmbrowserBrowserdocument��������������initauthorprojectQueensinit subscriptionsauthorprojectQueens subscriptionsupdateauthorprojectQueensupdateviewauthorprojectQueensview�������elmbrowserBrowserdocumentauthorprojectQueensinitauthorprojectQueens subscriptionselmjsonJson.DecodesucceedauthorprojectQueensupdateauthorprojectQueensviewauthorprojectQueens subscriptions� �������modelelmcorePlatform.Subnone�������elmcorePlatform.SubnoneauthorprojectQueensupdate� �������msgmodel_v0msg��������authorprojectQueensAddQueen������������������i���������msgj��������msgmodel�������queenselmcoreSetinsert�������ij�modelqueenselmcorePlatform.Cmdnone��authorprojectQueensRemoveQueen�����������������i���������msgj��������msgmodel�������queenselmcoreSetremove�������ij�modelqueenselmcorePlatform.Cmdnone��authorprojectQueensClearQueens�����������������model�������queenselmcoreSetemptyelmcorePlatform.Cmdnone���modelelmcorePlatform.Cmdnone����������������elmkernelUtils$elmcoreSetemptyelmcoreSetinsertelmcorePlatform.CmdnoneelmcoreSetremoveauthorprojectQueensview� �������model�������body�������authorprojectQueensviewHtml�������modeltitle�������Queens�������elmkernelList$authorprojectQueensviewHtmlauthorprojectQueensviewHtml� �������model�b �������sm
mdgriffithelm-ui Element.Inputbutton��������������elmcoreBasicsapL�������
mdgriffithelm-uiElement.Backgroundcolor
mdgriffithelm-uiElementrgba�������0.30.30.30.9
mdgriffithelm-uiElementpadding��������������
mdgriffithelm-uiElement.Bordersolid
mdgriffithelm-uiElement.Borderrounded��������������elmcoreBasicsapL�������
mdgriffithelm-uiElement.Fontcolor
mdgriffithelm-uiElementrgba�������1.01.01.00.9�������label
mdgriffithelm-uiElementtext�������sonPresselmcoreMaybeJust�������melmcoreBasicsapL�������
mdgriffithelm-uiElementlayout���������������
mdgriffithelm-uiElementcolumn��������������
mdgriffithelm-uiElementspacing��������������
mdgriffithelm-uiElementcenterX�������
mdgriffithelm-uiElementel��������������
mdgriffithelm-uiElementcenterX
mdgriffithelm-uiElement paddingXY����������������������
mdgriffithelm-uiElementtext��������������Queens
mdgriffithelm-uiElementel���������������elmcoreBasicsapL�������
mdgriffithelm-uiElementhtmlauthorprojectQueensboard�������model
mdgriffithelm-uiElementrow��������������
mdgriffithelm-uiElementspacing��������������
mdgriffithelm-uiElement
alignRight�������b��������������ClearauthorprojectQueensClearQueensb��������������SolveauthorprojectQueensSolve�������elmkernelList$authorprojectQueensClearQueenselmcoreMaybeJustauthorprojectQueensSolve
mdgriffithelm-uiElement
alignRightelmcoreBasicsapLauthorprojectQueensboard
mdgriffithelm-ui Element.Inputbutton
mdgriffithelm-uiElementcenterX
mdgriffithelm-uiElement.Backgroundcolor
mdgriffithelm-uiElement.Fontcolor
mdgriffithelm-uiElementcolumn
mdgriffithelm-uiElementel
mdgriffithelm-uiElementhtml
mdgriffithelm-uiElementlayout
mdgriffithelm-uiElementpadding
mdgriffithelm-uiElement paddingXY
mdgriffithelm-uiElementrgba
mdgriffithelm-uiElement.Borderrounded
mdgriffithelm-uiElementrow
mdgriffithelm-uiElement.Bordersolid
mdgriffithelm-uiElementspacing
mdgriffithelm-uiElementtext�������
body�������id�������init�������label�������onPress�������queens������� subscriptions�������title�������update�������view�������
elmcorePlatformProgramauthorprojectQueensFlags��������authorprojectQueensModel���������������id��elmcoreBasicsIntqueens��elmcoreSetSetelmcoreBasicsIntelmcoreBasicsInt��authorprojectQueensMsg�������Msg���������������AddQueen����������������������elmcoreBasicsIntelmcoreBasicsIntRemoveQueen���������������������elmcoreBasicsIntelmcoreBasicsIntClearQueens�����������������������Solve�����������������������NoOp��������������������������������������Flags��������Model���������������id��elmcoreBasicsIntqueens�elmcoreSetSetelmcoreBasicsIntelmcoreBasicsInt����������
elmcorePlatformProgramauthorprojectQueensFlags��������authorprojectQueensModel���������������id��elmcoreBasicsIntqueens��elmcoreSetSetelmcoreBasicsIntelmcoreBasicsInt�size��elmcoreBasicsInt�authorprojectQueensMsg�������Msg���������������AddQueen����������������������elmcoreBasicsIntelmcoreBasicsIntRemoveQueen���������������������elmcoreBasicsIntelmcoreBasicsIntClearQueens�����������������������ChangeBoardSize���������������������elmcoreBasicsIntSolve�����������������������ReceivedSolution��������������������� elmcoreResultResultelmhttpHttpErrorelmcoreListListelmcoreListListelmcoreBasicsIntNoOp��������������������������������������Flags��������Model���������������id��elmcoreBasicsIntqueens�elmcoreSetSetelmcoreBasicsIntelmcoreBasicsInt�size�elmcoreBasicsInt���������