diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | frontend/index.html | 12772 | ||||
-rw-r--r-- | frontend/main.html | 21 | ||||
-rw-r--r-- | frontend/main.js | 772 | ||||
-rw-r--r-- | frontend/src/Catalog.elm | 100 | ||||
-rw-r--r-- | frontend/src/Icons.elm | 8 | ||||
-rw-r--r-- | frontend/src/Main.elm | 1 | ||||
-rw-r--r-- | frontend/src/Product.elm | 144 | ||||
-rw-r--r-- | frontend/src/Styles.elm | 21 |
9 files changed, 13657 insertions, 184 deletions
@@ -2,3 +2,5 @@ target/ | |||
2 | elm-stuff | 2 | elm-stuff |
3 | .envrc | 3 | .envrc |
4 | result | 4 | result |
5 | frontend/main.js | ||
6 | frontend/index.html | ||
diff --git a/frontend/index.html b/frontend/index.html index 38203b9..ffc3920 100644 --- a/frontend/index.html +++ b/frontend/index.html | |||
@@ -1,14 +1,12764 @@ | |||
1 | <!DOCTYPE html> | 1 | <!DOCTYPE HTML> |
2 | <html> | 2 | <html> |
3 | <head> | 3 | <head> |
4 | <meta charset="utf-8"> | 4 | <meta charset="UTF-8"> |
5 | <title>hello-world</title> | 5 | <title>Main</title> |
6 | <script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"></script> | 6 | <style>body { padding: 0; margin: 0; }</style> |
7 | <script src="main.js"></script> | 7 | </head> |
8 | </head> | ||
9 | <body> | ||
10 | <script>var app = Elm.Main.init();</script> | ||
11 | </body> | ||
12 | </html> | ||
13 | 8 | ||
9 | <body> | ||
14 | 10 | ||
11 | <pre id="elm"></pre> | ||
12 | |||
13 | <script> | ||
14 | try { | ||
15 | (function(scope){ | ||
16 | 'use strict'; | ||
17 | |||
18 | function F(arity, fun, wrapper) { | ||
19 | wrapper.a = arity; | ||
20 | wrapper.f = fun; | ||
21 | return wrapper; | ||
22 | } | ||
23 | |||
24 | function F2(fun) { | ||
25 | return F(2, fun, function(a) { return function(b) { return fun(a,b); }; }) | ||
26 | } | ||
27 | function F3(fun) { | ||
28 | return F(3, fun, function(a) { | ||
29 | return function(b) { return function(c) { return fun(a, b, c); }; }; | ||
30 | }); | ||
31 | } | ||
32 | function F4(fun) { | ||
33 | return F(4, fun, function(a) { return function(b) { return function(c) { | ||
34 | return function(d) { return fun(a, b, c, d); }; }; }; | ||
35 | }); | ||
36 | } | ||
37 | function F5(fun) { | ||
38 | return F(5, fun, function(a) { return function(b) { return function(c) { | ||
39 | return function(d) { return function(e) { return fun(a, b, c, d, e); }; }; }; }; | ||
40 | }); | ||
41 | } | ||
42 | function F6(fun) { | ||
43 | return F(6, fun, function(a) { return function(b) { return function(c) { | ||
44 | return function(d) { return function(e) { return function(f) { | ||
45 | return fun(a, b, c, d, e, f); }; }; }; }; }; | ||
46 | }); | ||
47 | } | ||
48 | function F7(fun) { | ||
49 | return F(7, fun, function(a) { return function(b) { return function(c) { | ||
50 | return function(d) { return function(e) { return function(f) { | ||
51 | return function(g) { return fun(a, b, c, d, e, f, g); }; }; }; }; }; }; | ||
52 | }); | ||
53 | } | ||
54 | function F8(fun) { | ||
55 | return F(8, fun, function(a) { return function(b) { return function(c) { | ||
56 | return function(d) { return function(e) { return function(f) { | ||
57 | return function(g) { return function(h) { | ||
58 | return fun(a, b, c, d, e, f, g, h); }; }; }; }; }; }; }; | ||
59 | }); | ||
60 | } | ||
61 | function F9(fun) { | ||
62 | return F(9, fun, function(a) { return function(b) { return function(c) { | ||
63 | return function(d) { return function(e) { return function(f) { | ||
64 | return function(g) { return function(h) { return function(i) { | ||
65 | return fun(a, b, c, d, e, f, g, h, i); }; }; }; }; }; }; }; }; | ||
66 | }); | ||
67 | } | ||
68 | |||
69 | function A2(fun, a, b) { | ||
70 | return fun.a === 2 ? fun.f(a, b) : fun(a)(b); | ||
71 | } | ||
72 | function A3(fun, a, b, c) { | ||
73 | return fun.a === 3 ? fun.f(a, b, c) : fun(a)(b)(c); | ||
74 | } | ||
75 | function A4(fun, a, b, c, d) { | ||
76 | return fun.a === 4 ? fun.f(a, b, c, d) : fun(a)(b)(c)(d); | ||
77 | } | ||
78 | function A5(fun, a, b, c, d, e) { | ||
79 | return fun.a === 5 ? fun.f(a, b, c, d, e) : fun(a)(b)(c)(d)(e); | ||
80 | } | ||
81 | function A6(fun, a, b, c, d, e, f) { | ||
82 | return fun.a === 6 ? fun.f(a, b, c, d, e, f) : fun(a)(b)(c)(d)(e)(f); | ||
83 | } | ||
84 | function A7(fun, a, b, c, d, e, f, g) { | ||
85 | return fun.a === 7 ? fun.f(a, b, c, d, e, f, g) : fun(a)(b)(c)(d)(e)(f)(g); | ||
86 | } | ||
87 | function A8(fun, a, b, c, d, e, f, g, h) { | ||
88 | return fun.a === 8 ? fun.f(a, b, c, d, e, f, g, h) : fun(a)(b)(c)(d)(e)(f)(g)(h); | ||
89 | } | ||
90 | function A9(fun, a, b, c, d, e, f, g, h, i) { | ||
91 | return fun.a === 9 ? fun.f(a, b, c, d, e, f, g, h, i) : fun(a)(b)(c)(d)(e)(f)(g)(h)(i); | ||
92 | } | ||
93 | |||
94 | console.warn('Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.'); | ||
95 | |||
96 | |||
97 | // EQUALITY | ||
98 | |||
99 | function _Utils_eq(x, y) | ||
100 | { | ||
101 | for ( | ||
102 | var pair, stack = [], isEqual = _Utils_eqHelp(x, y, 0, stack); | ||
103 | isEqual && (pair = stack.pop()); | ||
104 | isEqual = _Utils_eqHelp(pair.a, pair.b, 0, stack) | ||
105 | ) | ||
106 | {} | ||
107 | |||
108 | return isEqual; | ||
109 | } | ||
110 | |||
111 | function _Utils_eqHelp(x, y, depth, stack) | ||
112 | { | ||
113 | if (x === y) | ||
114 | { | ||
115 | return true; | ||
116 | } | ||
117 | |||
118 | if (typeof x !== 'object' || x === null || y === null) | ||
119 | { | ||
120 | typeof x === 'function' && _Debug_crash(5); | ||
121 | return false; | ||
122 | } | ||
123 | |||
124 | if (depth > 100) | ||
125 | { | ||
126 | stack.push(_Utils_Tuple2(x,y)); | ||
127 | return true; | ||
128 | } | ||
129 | |||
130 | /**/ | ||
131 | if (x.$ === 'Set_elm_builtin') | ||
132 | { | ||
133 | x = $elm$core$Set$toList(x); | ||
134 | y = $elm$core$Set$toList(y); | ||
135 | } | ||
136 | if (x.$ === 'RBNode_elm_builtin' || x.$ === 'RBEmpty_elm_builtin') | ||
137 | { | ||
138 | x = $elm$core$Dict$toList(x); | ||
139 | y = $elm$core$Dict$toList(y); | ||
140 | } | ||
141 | //*/ | ||
142 | |||
143 | /**_UNUSED/ | ||
144 | if (x.$ < 0) | ||
145 | { | ||
146 | x = $elm$core$Dict$toList(x); | ||
147 | y = $elm$core$Dict$toList(y); | ||
148 | } | ||
149 | //*/ | ||
150 | |||
151 | for (var key in x) | ||
152 | { | ||
153 | if (!_Utils_eqHelp(x[key], y[key], depth + 1, stack)) | ||
154 | { | ||
155 | return false; | ||
156 | } | ||
157 | } | ||
158 | return true; | ||
159 | } | ||
160 | |||
161 | var _Utils_equal = F2(_Utils_eq); | ||
162 | var _Utils_notEqual = F2(function(a, b) { return !_Utils_eq(a,b); }); | ||
163 | |||
164 | |||
165 | |||
166 | // COMPARISONS | ||
167 | |||
168 | // Code in Generate/JavaScript.hs, Basics.js, and List.js depends on | ||
169 | // the particular integer values assigned to LT, EQ, and GT. | ||
170 | |||
171 | function _Utils_cmp(x, y, ord) | ||
172 | { | ||
173 | if (typeof x !== 'object') | ||
174 | { | ||
175 | return x === y ? /*EQ*/ 0 : x < y ? /*LT*/ -1 : /*GT*/ 1; | ||
176 | } | ||
177 | |||
178 | /**/ | ||
179 | if (x instanceof String) | ||
180 | { | ||
181 | var a = x.valueOf(); | ||
182 | var b = y.valueOf(); | ||
183 | return a === b ? 0 : a < b ? -1 : 1; | ||
184 | } | ||
185 | //*/ | ||
186 | |||
187 | /**_UNUSED/ | ||
188 | if (typeof x.$ === 'undefined') | ||
189 | //*/ | ||
190 | /**/ | ||
191 | if (x.$[0] === '#') | ||
192 | //*/ | ||
193 | { | ||
194 | return (ord = _Utils_cmp(x.a, y.a)) | ||
195 | ? ord | ||
196 | : (ord = _Utils_cmp(x.b, y.b)) | ||
197 | ? ord | ||
198 | : _Utils_cmp(x.c, y.c); | ||
199 | } | ||
200 | |||
201 | // traverse conses until end of a list or a mismatch | ||
202 | for (; x.b && y.b && !(ord = _Utils_cmp(x.a, y.a)); x = x.b, y = y.b) {} // WHILE_CONSES | ||
203 | return ord || (x.b ? /*GT*/ 1 : y.b ? /*LT*/ -1 : /*EQ*/ 0); | ||
204 | } | ||
205 | |||
206 | var _Utils_lt = F2(function(a, b) { return _Utils_cmp(a, b) < 0; }); | ||
207 | var _Utils_le = F2(function(a, b) { return _Utils_cmp(a, b) < 1; }); | ||
208 | var _Utils_gt = F2(function(a, b) { return _Utils_cmp(a, b) > 0; }); | ||
209 | var _Utils_ge = F2(function(a, b) { return _Utils_cmp(a, b) >= 0; }); | ||
210 | |||
211 | var _Utils_compare = F2(function(x, y) | ||
212 | { | ||
213 | var n = _Utils_cmp(x, y); | ||
214 | return n < 0 ? $elm$core$Basics$LT : n ? $elm$core$Basics$GT : $elm$core$Basics$EQ; | ||
215 | }); | ||
216 | |||
217 | |||
218 | // COMMON VALUES | ||
219 | |||
220 | var _Utils_Tuple0_UNUSED = 0; | ||
221 | var _Utils_Tuple0 = { $: '#0' }; | ||
222 | |||
223 | function _Utils_Tuple2_UNUSED(a, b) { return { a: a, b: b }; } | ||
224 | function _Utils_Tuple2(a, b) { return { $: '#2', a: a, b: b }; } | ||
225 | |||
226 | function _Utils_Tuple3_UNUSED(a, b, c) { return { a: a, b: b, c: c }; } | ||
227 | function _Utils_Tuple3(a, b, c) { return { $: '#3', a: a, b: b, c: c }; } | ||
228 | |||
229 | function _Utils_chr_UNUSED(c) { return c; } | ||
230 | function _Utils_chr(c) { return new String(c); } | ||
231 | |||
232 | |||
233 | // RECORDS | ||
234 | |||
235 | function _Utils_update(oldRecord, updatedFields) | ||
236 | { | ||
237 | var newRecord = {}; | ||
238 | |||
239 | for (var key in oldRecord) | ||
240 | { | ||
241 | newRecord[key] = oldRecord[key]; | ||
242 | } | ||
243 | |||
244 | for (var key in updatedFields) | ||
245 | { | ||
246 | newRecord[key] = updatedFields[key]; | ||
247 | } | ||
248 | |||
249 | return newRecord; | ||
250 | } | ||
251 | |||
252 | |||
253 | // APPEND | ||
254 | |||
255 | var _Utils_append = F2(_Utils_ap); | ||
256 | |||
257 | function _Utils_ap(xs, ys) | ||
258 | { | ||
259 | // append Strings | ||
260 | if (typeof xs === 'string') | ||
261 | { | ||
262 | return xs + ys; | ||
263 | } | ||
264 | |||
265 | // append Lists | ||
266 | if (!xs.b) | ||
267 | { | ||
268 | return ys; | ||
269 | } | ||
270 | var root = _List_Cons(xs.a, ys); | ||
271 | xs = xs.b | ||
272 | for (var curr = root; xs.b; xs = xs.b) // WHILE_CONS | ||
273 | { | ||
274 | curr = curr.b = _List_Cons(xs.a, ys); | ||
275 | } | ||
276 | return root; | ||
277 | } | ||
278 | |||
279 | |||
280 | |||
281 | var _List_Nil_UNUSED = { $: 0 }; | ||
282 | var _List_Nil = { $: '[]' }; | ||
283 | |||
284 | function _List_Cons_UNUSED(hd, tl) { return { $: 1, a: hd, b: tl }; } | ||
285 | function _List_Cons(hd, tl) { return { $: '::', a: hd, b: tl }; } | ||
286 | |||
287 | |||
288 | var _List_cons = F2(_List_Cons); | ||
289 | |||
290 | function _List_fromArray(arr) | ||
291 | { | ||
292 | var out = _List_Nil; | ||
293 | for (var i = arr.length; i--; ) | ||
294 | { | ||
295 | out = _List_Cons(arr[i], out); | ||
296 | } | ||
297 | return out; | ||
298 | } | ||
299 | |||
300 | function _List_toArray(xs) | ||
301 | { | ||
302 | for (var out = []; xs.b; xs = xs.b) // WHILE_CONS | ||
303 | { | ||
304 | out.push(xs.a); | ||
305 | } | ||
306 | return out; | ||
307 | } | ||
308 | |||
309 | var _List_map2 = F3(function(f, xs, ys) | ||
310 | { | ||
311 | for (var arr = []; xs.b && ys.b; xs = xs.b, ys = ys.b) // WHILE_CONSES | ||
312 | { | ||
313 | arr.push(A2(f, xs.a, ys.a)); | ||
314 | } | ||
315 | return _List_fromArray(arr); | ||
316 | }); | ||
317 | |||
318 | var _List_map3 = F4(function(f, xs, ys, zs) | ||
319 | { | ||
320 | for (var arr = []; xs.b && ys.b && zs.b; xs = xs.b, ys = ys.b, zs = zs.b) // WHILE_CONSES | ||
321 | { | ||
322 | arr.push(A3(f, xs.a, ys.a, zs.a)); | ||
323 | } | ||
324 | return _List_fromArray(arr); | ||
325 | }); | ||
326 | |||
327 | var _List_map4 = F5(function(f, ws, xs, ys, zs) | ||
328 | { | ||
329 | for (var arr = []; ws.b && xs.b && ys.b && zs.b; ws = ws.b, xs = xs.b, ys = ys.b, zs = zs.b) // WHILE_CONSES | ||
330 | { | ||
331 | arr.push(A4(f, ws.a, xs.a, ys.a, zs.a)); | ||
332 | } | ||
333 | return _List_fromArray(arr); | ||
334 | }); | ||
335 | |||
336 | var _List_map5 = F6(function(f, vs, ws, xs, ys, zs) | ||
337 | { | ||
338 | for (var arr = []; vs.b && ws.b && xs.b && ys.b && zs.b; vs = vs.b, ws = ws.b, xs = xs.b, ys = ys.b, zs = zs.b) // WHILE_CONSES | ||
339 | { | ||
340 | arr.push(A5(f, vs.a, ws.a, xs.a, ys.a, zs.a)); | ||
341 | } | ||
342 | return _List_fromArray(arr); | ||
343 | }); | ||
344 | |||
345 | var _List_sortBy = F2(function(f, xs) | ||
346 | { | ||
347 | return _List_fromArray(_List_toArray(xs).sort(function(a, b) { | ||
348 | return _Utils_cmp(f(a), f(b)); | ||
349 | })); | ||
350 | }); | ||
351 | |||
352 | var _List_sortWith = F2(function(f, xs) | ||
353 | { | ||
354 | return _List_fromArray(_List_toArray(xs).sort(function(a, b) { | ||
355 | var ord = A2(f, a, b); | ||
356 | return ord === $elm$core$Basics$EQ ? 0 : ord === $elm$core$Basics$LT ? -1 : 1; | ||
357 | })); | ||
358 | }); | ||
359 | |||
360 | |||
361 | |||
362 | var _JsArray_empty = []; | ||
363 | |||
364 | function _JsArray_singleton(value) | ||
365 | { | ||
366 | return [value]; | ||
367 | } | ||
368 | |||
369 | function _JsArray_length(array) | ||
370 | { | ||
371 | return array.length; | ||
372 | } | ||
373 | |||
374 | var _JsArray_initialize = F3(function(size, offset, func) | ||
375 | { | ||
376 | var result = new Array(size); | ||
377 | |||
378 | for (var i = 0; i < size; i++) | ||
379 | { | ||
380 | result[i] = func(offset + i); | ||
381 | } | ||
382 | |||
383 | return result; | ||
384 | }); | ||
385 | |||
386 | var _JsArray_initializeFromList = F2(function (max, ls) | ||
387 | { | ||
388 | var result = new Array(max); | ||
389 | |||
390 | for (var i = 0; i < max && ls.b; i++) | ||
391 | { | ||
392 | result[i] = ls.a; | ||
393 | ls = ls.b; | ||
394 | } | ||
395 | |||
396 | result.length = i; | ||
397 | return _Utils_Tuple2(result, ls); | ||
398 | }); | ||
399 | |||
400 | var _JsArray_unsafeGet = F2(function(index, array) | ||
401 | { | ||
402 | return array[index]; | ||
403 | }); | ||
404 | |||
405 | var _JsArray_unsafeSet = F3(function(index, value, array) | ||
406 | { | ||
407 | var length = array.length; | ||
408 | var result = new Array(length); | ||
409 | |||
410 | for (var i = 0; i < length; i++) | ||
411 | { | ||
412 | result[i] = array[i]; | ||
413 | } | ||
414 | |||
415 | result[index] = value; | ||
416 | return result; | ||
417 | }); | ||
418 | |||
419 | var _JsArray_push = F2(function(value, array) | ||
420 | { | ||
421 | var length = array.length; | ||
422 | var result = new Array(length + 1); | ||
423 | |||
424 | for (var i = 0; i < length; i++) | ||
425 | { | ||
426 | result[i] = array[i]; | ||
427 | } | ||
428 | |||
429 | result[length] = value; | ||
430 | return result; | ||
431 | }); | ||
432 | |||
433 | var _JsArray_foldl = F3(function(func, acc, array) | ||
434 | { | ||
435 | var length = array.length; | ||
436 | |||
437 | for (var i = 0; i < length; i++) | ||
438 | { | ||
439 | acc = A2(func, array[i], acc); | ||
440 | } | ||
441 | |||
442 | return acc; | ||
443 | }); | ||
444 | |||
445 | var _JsArray_foldr = F3(function(func, acc, array) | ||
446 | { | ||
447 | for (var i = array.length - 1; i >= 0; i--) | ||
448 | { | ||
449 | acc = A2(func, array[i], acc); | ||
450 | } | ||
451 | |||
452 | return acc; | ||
453 | }); | ||
454 | |||
455 | var _JsArray_map = F2(function(func, array) | ||
456 | { | ||
457 | var length = array.length; | ||
458 | var result = new Array(length); | ||
459 | |||
460 | for (var i = 0; i < length; i++) | ||
461 | { | ||
462 | result[i] = func(array[i]); | ||
463 | } | ||
464 | |||
465 | return result; | ||
466 | }); | ||
467 | |||
468 | var _JsArray_indexedMap = F3(function(func, offset, array) | ||
469 | { | ||
470 | var length = array.length; | ||
471 | var result = new Array(length); | ||
472 | |||
473 | for (var i = 0; i < length; i++) | ||
474 | { | ||
475 | result[i] = A2(func, offset + i, array[i]); | ||
476 | } | ||
477 | |||
478 | return result; | ||
479 | }); | ||
480 | |||
481 | var _JsArray_slice = F3(function(from, to, array) | ||
482 | { | ||
483 | return array.slice(from, to); | ||
484 | }); | ||
485 | |||
486 | var _JsArray_appendN = F3(function(n, dest, source) | ||
487 | { | ||
488 | var destLen = dest.length; | ||
489 | var itemsToCopy = n - destLen; | ||
490 | |||
491 | if (itemsToCopy > source.length) | ||
492 | { | ||
493 | itemsToCopy = source.length; | ||
494 | } | ||
495 | |||
496 | var size = destLen + itemsToCopy; | ||
497 | var result = new Array(size); | ||
498 | |||
499 | for (var i = 0; i < destLen; i++) | ||
500 | { | ||
501 | result[i] = dest[i]; | ||
502 | } | ||
503 | |||
504 | for (var i = 0; i < itemsToCopy; i++) | ||
505 | { | ||
506 | result[i + destLen] = source[i]; | ||
507 | } | ||
508 | |||
509 | return result; | ||
510 | }); | ||
511 | |||
512 | |||
513 | |||
514 | // LOG | ||
515 | |||
516 | var _Debug_log_UNUSED = F2(function(tag, value) | ||
517 | { | ||
518 | return value; | ||
519 | }); | ||
520 | |||
521 | var _Debug_log = F2(function(tag, value) | ||
522 | { | ||
523 | console.log(tag + ': ' + _Debug_toString(value)); | ||
524 | return value; | ||
525 | }); | ||
526 | |||
527 | |||
528 | // TODOS | ||
529 | |||
530 | function _Debug_todo(moduleName, region) | ||
531 | { | ||
532 | return function(message) { | ||
533 | _Debug_crash(8, moduleName, region, message); | ||
534 | }; | ||
535 | } | ||
536 | |||
537 | function _Debug_todoCase(moduleName, region, value) | ||
538 | { | ||
539 | return function(message) { | ||
540 | _Debug_crash(9, moduleName, region, value, message); | ||
541 | }; | ||
542 | } | ||
543 | |||
544 | |||
545 | // TO STRING | ||
546 | |||
547 | function _Debug_toString_UNUSED(value) | ||
548 | { | ||
549 | return '<internals>'; | ||
550 | } | ||
551 | |||
552 | function _Debug_toString(value) | ||
553 | { | ||
554 | return _Debug_toAnsiString(false, value); | ||
555 | } | ||
556 | |||
557 | function _Debug_toAnsiString(ansi, value) | ||
558 | { | ||
559 | if (typeof value === 'function') | ||
560 | { | ||
561 | return _Debug_internalColor(ansi, '<function>'); | ||
562 | } | ||
563 | |||
564 | if (typeof value === 'boolean') | ||
565 | { | ||
566 | return _Debug_ctorColor(ansi, value ? 'True' : 'False'); | ||
567 | } | ||
568 | |||
569 | if (typeof value === 'number') | ||
570 | { | ||
571 | return _Debug_numberColor(ansi, value + ''); | ||
572 | } | ||
573 | |||
574 | if (value instanceof String) | ||
575 | { | ||
576 | return _Debug_charColor(ansi, "'" + _Debug_addSlashes(value, true) + "'"); | ||
577 | } | ||
578 | |||
579 | if (typeof value === 'string') | ||
580 | { | ||
581 | return _Debug_stringColor(ansi, '"' + _Debug_addSlashes(value, false) + '"'); | ||
582 | } | ||
583 | |||
584 | if (typeof value === 'object' && '$' in value) | ||
585 | { | ||
586 | var tag = value.$; | ||
587 | |||
588 | if (typeof tag === 'number') | ||
589 | { | ||
590 | return _Debug_internalColor(ansi, '<internals>'); | ||
591 | } | ||
592 | |||
593 | if (tag[0] === '#') | ||
594 | { | ||
595 | var output = []; | ||
596 | for (var k in value) | ||
597 | { | ||
598 | if (k === '$') continue; | ||
599 | output.push(_Debug_toAnsiString(ansi, value[k])); | ||
600 | } | ||
601 | return '(' + output.join(',') + ')'; | ||
602 | } | ||
603 | |||
604 | if (tag === 'Set_elm_builtin') | ||
605 | { | ||
606 | return _Debug_ctorColor(ansi, 'Set') | ||
607 | + _Debug_fadeColor(ansi, '.fromList') + ' ' | ||
608 | + _Debug_toAnsiString(ansi, $elm$core$Set$toList(value)); | ||
609 | } | ||
610 | |||
611 | if (tag === 'RBNode_elm_builtin' || tag === 'RBEmpty_elm_builtin') | ||
612 | { | ||
613 | return _Debug_ctorColor(ansi, 'Dict') | ||
614 | + _Debug_fadeColor(ansi, '.fromList') + ' ' | ||
615 | + _Debug_toAnsiString(ansi, $elm$core$Dict$toList(value)); | ||
616 | } | ||
617 | |||
618 | if (tag === 'Array_elm_builtin') | ||
619 | { | ||
620 | return _Debug_ctorColor(ansi, 'Array') | ||
621 | + _Debug_fadeColor(ansi, '.fromList') + ' ' | ||
622 | + _Debug_toAnsiString(ansi, $elm$core$Array$toList(value)); | ||
623 | } | ||
624 | |||
625 | if (tag === '::' || tag === '[]') | ||
626 | { | ||
627 | var output = '['; | ||
628 | |||
629 | value.b && (output += _Debug_toAnsiString(ansi, value.a), value = value.b) | ||
630 | |||
631 | for (; value.b; value = value.b) // WHILE_CONS | ||
632 | { | ||
633 | output += ',' + _Debug_toAnsiString(ansi, value.a); | ||
634 | } | ||
635 | return output + ']'; | ||
636 | } | ||
637 | |||
638 | var output = ''; | ||
639 | for (var i in value) | ||
640 | { | ||
641 | if (i === '$') continue; | ||
642 | var str = _Debug_toAnsiString(ansi, value[i]); | ||
643 | var c0 = str[0]; | ||
644 | var parenless = c0 === '{' || c0 === '(' || c0 === '[' || c0 === '<' || c0 === '"' || str.indexOf(' ') < 0; | ||
645 | output += ' ' + (parenless ? str : '(' + str + ')'); | ||
646 | } | ||
647 | return _Debug_ctorColor(ansi, tag) + output; | ||
648 | } | ||
649 | |||
650 | if (typeof DataView === 'function' && value instanceof DataView) | ||
651 | { | ||
652 | return _Debug_stringColor(ansi, '<' + value.byteLength + ' bytes>'); | ||
653 | } | ||
654 | |||
655 | if (typeof File !== 'undefined' && value instanceof File) | ||
656 | { | ||
657 | return _Debug_internalColor(ansi, '<' + value.name + '>'); | ||
658 | } | ||
659 | |||
660 | if (typeof value === 'object') | ||
661 | { | ||
662 | var output = []; | ||
663 | for (var key in value) | ||
664 | { | ||
665 | var field = key[0] === '_' ? key.slice(1) : key; | ||
666 | output.push(_Debug_fadeColor(ansi, field) + ' = ' + _Debug_toAnsiString(ansi, value[key])); | ||
667 | } | ||
668 | if (output.length === 0) | ||
669 | { | ||
670 | return '{}'; | ||
671 | } | ||
672 | return '{ ' + output.join(', ') + ' }'; | ||
673 | } | ||
674 | |||
675 | return _Debug_internalColor(ansi, '<internals>'); | ||
676 | } | ||
677 | |||
678 | function _Debug_addSlashes(str, isChar) | ||
679 | { | ||
680 | var s = str | ||
681 | .replace(/\\/g, '\\\\') | ||
682 | .replace(/\n/g, '\\n') | ||
683 | .replace(/\t/g, '\\t') | ||
684 | .replace(/\r/g, '\\r') | ||
685 | .replace(/\v/g, '\\v') | ||
686 | .replace(/\0/g, '\\0'); | ||
687 | |||
688 | if (isChar) | ||
689 | { | ||
690 | return s.replace(/\'/g, '\\\''); | ||
691 | } | ||
692 | else | ||
693 | { | ||
694 | return s.replace(/\"/g, '\\"'); | ||
695 | } | ||
696 | } | ||
697 | |||
698 | function _Debug_ctorColor(ansi, string) | ||
699 | { | ||
700 | return ansi ? '\x1b[96m' + string + '\x1b[0m' : string; | ||
701 | } | ||
702 | |||
703 | function _Debug_numberColor(ansi, string) | ||
704 | { | ||
705 | return ansi ? '\x1b[95m' + string + '\x1b[0m' : string; | ||
706 | } | ||
707 | |||
708 | function _Debug_stringColor(ansi, string) | ||
709 | { | ||
710 | return ansi ? '\x1b[93m' + string + '\x1b[0m' : string; | ||
711 | } | ||
712 | |||
713 | function _Debug_charColor(ansi, string) | ||
714 | { | ||
715 | return ansi ? '\x1b[92m' + string + '\x1b[0m' : string; | ||
716 | } | ||
717 | |||
718 | function _Debug_fadeColor(ansi, string) | ||
719 | { | ||
720 | return ansi ? '\x1b[37m' + string + '\x1b[0m' : string; | ||
721 | } | ||
722 | |||
723 | function _Debug_internalColor(ansi, string) | ||
724 | { | ||
725 | return ansi ? '\x1b[36m' + string + '\x1b[0m' : string; | ||
726 | } | ||
727 | |||
728 | function _Debug_toHexDigit(n) | ||
729 | { | ||
730 | return String.fromCharCode(n < 10 ? 48 + n : 55 + n); | ||
731 | } | ||
732 | |||
733 | |||
734 | // CRASH | ||
735 | |||
736 | |||
737 | function _Debug_crash_UNUSED(identifier) | ||
738 | { | ||
739 | throw new Error('https://github.com/elm/core/blob/1.0.0/hints/' + identifier + '.md'); | ||
740 | } | ||
741 | |||
742 | |||
743 | function _Debug_crash(identifier, fact1, fact2, fact3, fact4) | ||
744 | { | ||
745 | switch(identifier) | ||
746 | { | ||
747 | case 0: | ||
748 | throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.'); | ||
749 | |||
750 | case 1: | ||
751 | throw new Error('Browser.application programs cannot handle URLs like this:\n\n ' + document.location.href + '\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.'); | ||
752 | |||
753 | case 2: | ||
754 | var jsonErrorString = fact1; | ||
755 | throw new Error('Problem with the flags given to your Elm program on initialization.\n\n' + jsonErrorString); | ||
756 | |||
757 | case 3: | ||
758 | var portName = fact1; | ||
759 | throw new Error('There can only be one port named `' + portName + '`, but your program has multiple.'); | ||
760 | |||
761 | case 4: | ||
762 | var portName = fact1; | ||
763 | var problem = fact2; | ||
764 | throw new Error('Trying to send an unexpected type of value through port `' + portName + '`:\n' + problem); | ||
765 | |||
766 | case 5: | ||
767 | throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.'); | ||
768 | |||
769 | case 6: | ||
770 | var moduleName = fact1; | ||
771 | throw new Error('Your page is loading multiple Elm scripts with a module named ' + moduleName + '. Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!'); | ||
772 | |||
773 | case 8: | ||
774 | var moduleName = fact1; | ||
775 | var region = fact2; | ||
776 | var message = fact3; | ||
777 | throw new Error('TODO in module `' + moduleName + '` ' + _Debug_regionToString(region) + '\n\n' + message); | ||
778 | |||
779 | case 9: | ||
780 | var moduleName = fact1; | ||
781 | var region = fact2; | ||
782 | var value = fact3; | ||
783 | var message = fact4; | ||
784 | throw new Error( | ||
785 | 'TODO in module `' + moduleName + '` from the `case` expression ' | ||
786 | + _Debug_regionToString(region) + '\n\nIt received the following value:\n\n ' | ||
787 | + _Debug_toString(value).replace('\n', '\n ') | ||
788 | + '\n\nBut the branch that handles it says:\n\n ' + message.replace('\n', '\n ') | ||
789 | ); | ||
790 | |||
791 | case 10: | ||
792 | throw new Error('Bug in https://github.com/elm/virtual-dom/issues'); | ||
793 | |||
794 | case 11: | ||
795 | throw new Error('Cannot perform mod 0. Division by zero error.'); | ||
796 | } | ||
797 | } | ||
798 | |||
799 | function _Debug_regionToString(region) | ||
800 | { | ||
801 | if (region.start.line === region.end.line) | ||
802 | { | ||
803 | return 'on line ' + region.start.line; | ||
804 | } | ||
805 | return 'on lines ' + region.start.line + ' through ' + region.end.line; | ||
806 | } | ||
807 | |||
808 | |||
809 | |||
810 | // MATH | ||
811 | |||
812 | var _Basics_add = F2(function(a, b) { return a + b; }); | ||
813 | var _Basics_sub = F2(function(a, b) { return a - b; }); | ||
814 | var _Basics_mul = F2(function(a, b) { return a * b; }); | ||
815 | var _Basics_fdiv = F2(function(a, b) { return a / b; }); | ||
816 | var _Basics_idiv = F2(function(a, b) { return (a / b) | 0; }); | ||
817 | var _Basics_pow = F2(Math.pow); | ||
818 | |||
819 | var _Basics_remainderBy = F2(function(b, a) { return a % b; }); | ||
820 | |||
821 | // https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/divmodnote-letter.pdf | ||
822 | var _Basics_modBy = F2(function(modulus, x) | ||
823 | { | ||
824 | var answer = x % modulus; | ||
825 | return modulus === 0 | ||
826 | ? _Debug_crash(11) | ||
827 | : | ||
828 | ((answer > 0 && modulus < 0) || (answer < 0 && modulus > 0)) | ||
829 | ? answer + modulus | ||
830 | : answer; | ||
831 | }); | ||
832 | |||
833 | |||
834 | // TRIGONOMETRY | ||
835 | |||
836 | var _Basics_pi = Math.PI; | ||
837 | var _Basics_e = Math.E; | ||
838 | var _Basics_cos = Math.cos; | ||
839 | var _Basics_sin = Math.sin; | ||
840 | var _Basics_tan = Math.tan; | ||
841 | var _Basics_acos = Math.acos; | ||
842 | var _Basics_asin = Math.asin; | ||
843 | var _Basics_atan = Math.atan; | ||
844 | var _Basics_atan2 = F2(Math.atan2); | ||
845 | |||
846 | |||
847 | // MORE MATH | ||
848 | |||
849 | function _Basics_toFloat(x) { return x; } | ||
850 | function _Basics_truncate(n) { return n | 0; } | ||
851 | function _Basics_isInfinite(n) { return n === Infinity || n === -Infinity; } | ||
852 | |||
853 | var _Basics_ceiling = Math.ceil; | ||
854 | var _Basics_floor = Math.floor; | ||
855 | var _Basics_round = Math.round; | ||
856 | var _Basics_sqrt = Math.sqrt; | ||
857 | var _Basics_log = Math.log; | ||
858 | var _Basics_isNaN = isNaN; | ||
859 | |||
860 | |||
861 | // BOOLEANS | ||
862 | |||
863 | function _Basics_not(bool) { return !bool; } | ||
864 | var _Basics_and = F2(function(a, b) { return a && b; }); | ||
865 | var _Basics_or = F2(function(a, b) { return a || b; }); | ||
866 | var _Basics_xor = F2(function(a, b) { return a !== b; }); | ||
867 | |||
868 | |||
869 | |||
870 | var _String_cons = F2(function(chr, str) | ||
871 | { | ||
872 | return chr + str; | ||
873 | }); | ||
874 | |||
875 | function _String_uncons(string) | ||
876 | { | ||
877 | var word = string.charCodeAt(0); | ||
878 | return !isNaN(word) | ||
879 | ? $elm$core$Maybe$Just( | ||
880 | 0xD800 <= word && word <= 0xDBFF | ||
881 | ? _Utils_Tuple2(_Utils_chr(string[0] + string[1]), string.slice(2)) | ||
882 | : _Utils_Tuple2(_Utils_chr(string[0]), string.slice(1)) | ||
883 | ) | ||
884 | : $elm$core$Maybe$Nothing; | ||
885 | } | ||
886 | |||
887 | var _String_append = F2(function(a, b) | ||
888 | { | ||
889 | return a + b; | ||
890 | }); | ||
891 | |||
892 | function _String_length(str) | ||
893 | { | ||
894 | return str.length; | ||
895 | } | ||
896 | |||
897 | var _String_map = F2(function(func, string) | ||
898 | { | ||
899 | var len = string.length; | ||
900 | var array = new Array(len); | ||
901 | var i = 0; | ||
902 | while (i < len) | ||
903 | { | ||
904 | var word = string.charCodeAt(i); | ||
905 | if (0xD800 <= word && word <= 0xDBFF) | ||
906 | { | ||
907 | array[i] = func(_Utils_chr(string[i] + string[i+1])); | ||
908 | i += 2; | ||
909 | continue; | ||
910 | } | ||
911 | array[i] = func(_Utils_chr(string[i])); | ||
912 | i++; | ||
913 | } | ||
914 | return array.join(''); | ||
915 | }); | ||
916 | |||
917 | var _String_filter = F2(function(isGood, str) | ||
918 | { | ||
919 | var arr = []; | ||
920 | var len = str.length; | ||
921 | var i = 0; | ||
922 | while (i < len) | ||
923 | { | ||
924 | var char = str[i]; | ||
925 | var word = str.charCodeAt(i); | ||
926 | i++; | ||
927 | if (0xD800 <= word && word <= 0xDBFF) | ||
928 | { | ||
929 | char += str[i]; | ||
930 | i++; | ||
931 | } | ||
932 | |||
933 | if (isGood(_Utils_chr(char))) | ||
934 | { | ||
935 | arr.push(char); | ||
936 | } | ||
937 | } | ||
938 | return arr.join(''); | ||
939 | }); | ||
940 | |||
941 | function _String_reverse(str) | ||
942 | { | ||
943 | var len = str.length; | ||
944 | var arr = new Array(len); | ||
945 | var i = 0; | ||
946 | while (i < len) | ||
947 | { | ||
948 | var word = str.charCodeAt(i); | ||
949 | if (0xD800 <= word && word <= 0xDBFF) | ||
950 | { | ||
951 | arr[len - i] = str[i + 1]; | ||
952 | i++; | ||
953 | arr[len - i] = str[i - 1]; | ||
954 | i++; | ||
955 | } | ||
956 | else | ||
957 | { | ||
958 | arr[len - i] = str[i]; | ||
959 | i++; | ||
960 | } | ||
961 | } | ||
962 | return arr.join(''); | ||
963 | } | ||
964 | |||
965 | var _String_foldl = F3(function(func, state, string) | ||
966 | { | ||
967 | var len = string.length; | ||
968 | var i = 0; | ||
969 | while (i < len) | ||
970 | { | ||
971 | var char = string[i]; | ||
972 | var word = string.charCodeAt(i); | ||
973 | i++; | ||
974 | if (0xD800 <= word && word <= 0xDBFF) | ||
975 | { | ||
976 | char += string[i]; | ||
977 | i++; | ||
978 | } | ||
979 | state = A2(func, _Utils_chr(char), state); | ||
980 | } | ||
981 | return state; | ||
982 | }); | ||
983 | |||
984 | var _String_foldr = F3(function(func, state, string) | ||
985 | { | ||
986 | var i = string.length; | ||
987 | while (i--) | ||
988 | { | ||
989 | var char = string[i]; | ||
990 | var word = string.charCodeAt(i); | ||
991 | if (0xDC00 <= word && word <= 0xDFFF) | ||
992 | { | ||
993 | i--; | ||
994 | char = string[i] + char; | ||
995 | } | ||
996 | state = A2(func, _Utils_chr(char), state); | ||
997 | } | ||
998 | return state; | ||
999 | }); | ||
1000 | |||
1001 | var _String_split = F2(function(sep, str) | ||
1002 | { | ||
1003 | return str.split(sep); | ||
1004 | }); | ||
1005 | |||
1006 | var _String_join = F2(function(sep, strs) | ||
1007 | { | ||
1008 | return strs.join(sep); | ||
1009 | }); | ||
1010 | |||
1011 | var _String_slice = F3(function(start, end, str) { | ||
1012 | return str.slice(start, end); | ||
1013 | }); | ||
1014 | |||
1015 | function _String_trim(str) | ||
1016 | { | ||
1017 | return str.trim(); | ||
1018 | } | ||
1019 | |||
1020 | function _String_trimLeft(str) | ||
1021 | { | ||
1022 | return str.replace(/^\s+/, ''); | ||
1023 | } | ||
1024 | |||
1025 | function _String_trimRight(str) | ||
1026 | { | ||
1027 | return str.replace(/\s+$/, ''); | ||
1028 | } | ||
1029 | |||
1030 | function _String_words(str) | ||
1031 | { | ||
1032 | return _List_fromArray(str.trim().split(/\s+/g)); | ||
1033 | } | ||
1034 | |||
1035 | function _String_lines(str) | ||
1036 | { | ||
1037 | return _List_fromArray(str.split(/\r\n|\r|\n/g)); | ||
1038 | } | ||
1039 | |||
1040 | function _String_toUpper(str) | ||
1041 | { | ||
1042 | return str.toUpperCase(); | ||
1043 | } | ||
1044 | |||
1045 | function _String_toLower(str) | ||
1046 | { | ||
1047 | return str.toLowerCase(); | ||
1048 | } | ||
1049 | |||
1050 | var _String_any = F2(function(isGood, string) | ||
1051 | { | ||
1052 | var i = string.length; | ||
1053 | while (i--) | ||
1054 | { | ||
1055 | var char = string[i]; | ||
1056 | var word = string.charCodeAt(i); | ||
1057 | if (0xDC00 <= word && word <= 0xDFFF) | ||
1058 | { | ||
1059 | i--; | ||
1060 | char = string[i] + char; | ||
1061 | } | ||
1062 | if (isGood(_Utils_chr(char))) | ||
1063 | { | ||
1064 | return true; | ||
1065 | } | ||
1066 | } | ||
1067 | return false; | ||
1068 | }); | ||
1069 | |||
1070 | var _String_all = F2(function(isGood, string) | ||
1071 | { | ||
1072 | var i = string.length; | ||
1073 | while (i--) | ||
1074 | { | ||
1075 | var char = string[i]; | ||
1076 | var word = string.charCodeAt(i); | ||
1077 | if (0xDC00 <= word && word <= 0xDFFF) | ||
1078 | { | ||
1079 | i--; | ||
1080 | char = string[i] + char; | ||
1081 | } | ||
1082 | if (!isGood(_Utils_chr(char))) | ||
1083 | { | ||
1084 | return false; | ||
1085 | } | ||
1086 | } | ||
1087 | return true; | ||
1088 | }); | ||
1089 | |||
1090 | var _String_contains = F2(function(sub, str) | ||
1091 | { | ||
1092 | return str.indexOf(sub) > -1; | ||
1093 | }); | ||
1094 | |||
1095 | var _String_startsWith = F2(function(sub, str) | ||
1096 | { | ||
1097 | return str.indexOf(sub) === 0; | ||
1098 | }); | ||
1099 | |||
1100 | var _String_endsWith = F2(function(sub, str) | ||
1101 | { | ||
1102 | return str.length >= sub.length && | ||
1103 | str.lastIndexOf(sub) === str.length - sub.length; | ||
1104 | }); | ||
1105 | |||
1106 | var _String_indexes = F2(function(sub, str) | ||
1107 | { | ||
1108 | var subLen = sub.length; | ||
1109 | |||
1110 | if (subLen < 1) | ||
1111 | { | ||
1112 | return _List_Nil; | ||
1113 | } | ||
1114 | |||
1115 | var i = 0; | ||
1116 | var is = []; | ||
1117 | |||
1118 | while ((i = str.indexOf(sub, i)) > -1) | ||
1119 | { | ||
1120 | is.push(i); | ||
1121 | i = i + subLen; | ||
1122 | } | ||
1123 | |||
1124 | return _List_fromArray(is); | ||
1125 | }); | ||
1126 | |||
1127 | |||
1128 | // TO STRING | ||
1129 | |||
1130 | function _String_fromNumber(number) | ||
1131 | { | ||
1132 | return number + ''; | ||
1133 | } | ||
1134 | |||
1135 | |||
1136 | // INT CONVERSIONS | ||
1137 | |||
1138 | function _String_toInt(str) | ||
1139 | { | ||
1140 | var total = 0; | ||
1141 | var code0 = str.charCodeAt(0); | ||
1142 | var start = code0 == 0x2B /* + */ || code0 == 0x2D /* - */ ? 1 : 0; | ||
1143 | |||
1144 | for (var i = start; i < str.length; ++i) | ||
1145 | { | ||
1146 | var code = str.charCodeAt(i); | ||
1147 | if (code < 0x30 || 0x39 < code) | ||
1148 | { | ||
1149 | return $elm$core$Maybe$Nothing; | ||
1150 | } | ||
1151 | total = 10 * total + code - 0x30; | ||
1152 | } | ||
1153 | |||
1154 | return i == start | ||
1155 | ? $elm$core$Maybe$Nothing | ||
1156 | : $elm$core$Maybe$Just(code0 == 0x2D ? -total : total); | ||
1157 | } | ||
1158 | |||
1159 | |||
1160 | // FLOAT CONVERSIONS | ||
1161 | |||
1162 | function _String_toFloat(s) | ||
1163 | { | ||
1164 | // check if it is a hex, octal, or binary number | ||
1165 | if (s.length === 0 || /[\sxbo]/.test(s)) | ||
1166 | { | ||
1167 | return $elm$core$Maybe$Nothing; | ||
1168 | } | ||
1169 | var n = +s; | ||
1170 | // faster isNaN check | ||
1171 | return n === n ? $elm$core$Maybe$Just(n) : $elm$core$Maybe$Nothing; | ||
1172 | } | ||
1173 | |||
1174 | function _String_fromList(chars) | ||
1175 | { | ||
1176 | return _List_toArray(chars).join(''); | ||
1177 | } | ||
1178 | |||
1179 | |||
1180 | |||
1181 | |||
1182 | function _Char_toCode(char) | ||
1183 | { | ||
1184 | var code = char.charCodeAt(0); | ||
1185 | if (0xD800 <= code && code <= 0xDBFF) | ||
1186 | { | ||
1187 | return (code - 0xD800) * 0x400 + char.charCodeAt(1) - 0xDC00 + 0x10000 | ||
1188 | } | ||
1189 | return code; | ||
1190 | } | ||
1191 | |||
1192 | function _Char_fromCode(code) | ||
1193 | { | ||
1194 | return _Utils_chr( | ||
1195 | (code < 0 || 0x10FFFF < code) | ||
1196 | ? '\uFFFD' | ||
1197 | : | ||
1198 | (code <= 0xFFFF) | ||
1199 | ? String.fromCharCode(code) | ||
1200 | : | ||
1201 | (code -= 0x10000, | ||
1202 | String.fromCharCode(Math.floor(code / 0x400) + 0xD800, code % 0x400 + 0xDC00) | ||
1203 | ) | ||
1204 | ); | ||
1205 | } | ||
1206 | |||
1207 | function _Char_toUpper(char) | ||
1208 | { | ||
1209 | return _Utils_chr(char.toUpperCase()); | ||
1210 | } | ||
1211 | |||
1212 | function _Char_toLower(char) | ||
1213 | { | ||
1214 | return _Utils_chr(char.toLowerCase()); | ||
1215 | } | ||
1216 | |||
1217 | function _Char_toLocaleUpper(char) | ||
1218 | { | ||
1219 | return _Utils_chr(char.toLocaleUpperCase()); | ||
1220 | } | ||
1221 | |||
1222 | function _Char_toLocaleLower(char) | ||
1223 | { | ||
1224 | return _Utils_chr(char.toLocaleLowerCase()); | ||
1225 | } | ||
1226 | |||
1227 | |||
1228 | |||
1229 | /**/ | ||
1230 | function _Json_errorToString(error) | ||
1231 | { | ||
1232 | return $elm$json$Json$Decode$errorToString(error); | ||
1233 | } | ||
1234 | //*/ | ||
1235 | |||
1236 | |||
1237 | // CORE DECODERS | ||
1238 | |||
1239 | function _Json_succeed(msg) | ||
1240 | { | ||
1241 | return { | ||
1242 | $: 0, | ||
1243 | a: msg | ||
1244 | }; | ||
1245 | } | ||
1246 | |||
1247 | function _Json_fail(msg) | ||
1248 | { | ||
1249 | return { | ||
1250 | $: 1, | ||
1251 | a: msg | ||
1252 | }; | ||
1253 | } | ||
1254 | |||
1255 | function _Json_decodePrim(decoder) | ||
1256 | { | ||
1257 | return { $: 2, b: decoder }; | ||
1258 | } | ||
1259 | |||
1260 | var _Json_decodeInt = _Json_decodePrim(function(value) { | ||
1261 | return (typeof value !== 'number') | ||
1262 | ? _Json_expecting('an INT', value) | ||
1263 | : | ||
1264 | (-2147483647 < value && value < 2147483647 && (value | 0) === value) | ||
1265 | ? $elm$core$Result$Ok(value) | ||
1266 | : | ||
1267 | (isFinite(value) && !(value % 1)) | ||
1268 | ? $elm$core$Result$Ok(value) | ||
1269 | : _Json_expecting('an INT', value); | ||
1270 | }); | ||
1271 | |||
1272 | var _Json_decodeBool = _Json_decodePrim(function(value) { | ||
1273 | return (typeof value === 'boolean') | ||
1274 | ? $elm$core$Result$Ok(value) | ||
1275 | : _Json_expecting('a BOOL', value); | ||
1276 | }); | ||
1277 | |||
1278 | var _Json_decodeFloat = _Json_decodePrim(function(value) { | ||
1279 | return (typeof value === 'number') | ||
1280 | ? $elm$core$Result$Ok(value) | ||
1281 | : _Json_expecting('a FLOAT', value); | ||
1282 | }); | ||
1283 | |||
1284 | var _Json_decodeValue = _Json_decodePrim(function(value) { | ||
1285 | return $elm$core$Result$Ok(_Json_wrap(value)); | ||
1286 | }); | ||
1287 | |||
1288 | var _Json_decodeString = _Json_decodePrim(function(value) { | ||
1289 | return (typeof value === 'string') | ||
1290 | ? $elm$core$Result$Ok(value) | ||
1291 | : (value instanceof String) | ||
1292 | ? $elm$core$Result$Ok(value + '') | ||
1293 | : _Json_expecting('a STRING', value); | ||
1294 | }); | ||
1295 | |||
1296 | function _Json_decodeList(decoder) { return { $: 3, b: decoder }; } | ||
1297 | function _Json_decodeArray(decoder) { return { $: 4, b: decoder }; } | ||
1298 | |||
1299 | function _Json_decodeNull(value) { return { $: 5, c: value }; } | ||
1300 | |||
1301 | var _Json_decodeField = F2(function(field, decoder) | ||
1302 | { | ||
1303 | return { | ||
1304 | $: 6, | ||
1305 | d: field, | ||
1306 | b: decoder | ||
1307 | }; | ||
1308 | }); | ||
1309 | |||
1310 | var _Json_decodeIndex = F2(function(index, decoder) | ||
1311 | { | ||
1312 | return { | ||
1313 | $: 7, | ||
1314 | e: index, | ||
1315 | b: decoder | ||
1316 | }; | ||
1317 | }); | ||
1318 | |||
1319 | function _Json_decodeKeyValuePairs(decoder) | ||
1320 | { | ||
1321 | return { | ||
1322 | $: 8, | ||
1323 | b: decoder | ||
1324 | }; | ||
1325 | } | ||
1326 | |||
1327 | function _Json_mapMany(f, decoders) | ||
1328 | { | ||
1329 | return { | ||
1330 | $: 9, | ||
1331 | f: f, | ||
1332 | g: decoders | ||
1333 | }; | ||
1334 | } | ||
1335 | |||
1336 | var _Json_andThen = F2(function(callback, decoder) | ||
1337 | { | ||
1338 | return { | ||
1339 | $: 10, | ||
1340 | b: decoder, | ||
1341 | h: callback | ||
1342 | }; | ||
1343 | }); | ||
1344 | |||
1345 | function _Json_oneOf(decoders) | ||
1346 | { | ||
1347 | return { | ||
1348 | $: 11, | ||
1349 | g: decoders | ||
1350 | }; | ||
1351 | } | ||
1352 | |||
1353 | |||
1354 | // DECODING OBJECTS | ||
1355 | |||
1356 | var _Json_map1 = F2(function(f, d1) | ||
1357 | { | ||
1358 | return _Json_mapMany(f, [d1]); | ||
1359 | }); | ||
1360 | |||
1361 | var _Json_map2 = F3(function(f, d1, d2) | ||
1362 | { | ||
1363 | return _Json_mapMany(f, [d1, d2]); | ||
1364 | }); | ||
1365 | |||
1366 | var _Json_map3 = F4(function(f, d1, d2, d3) | ||
1367 | { | ||
1368 | return _Json_mapMany(f, [d1, d2, d3]); | ||
1369 | }); | ||
1370 | |||
1371 | var _Json_map4 = F5(function(f, d1, d2, d3, d4) | ||
1372 | { | ||
1373 | return _Json_mapMany(f, [d1, d2, d3, d4]); | ||
1374 | }); | ||
1375 | |||
1376 | var _Json_map5 = F6(function(f, d1, d2, d3, d4, d5) | ||
1377 | { | ||
1378 | return _Json_mapMany(f, [d1, d2, d3, d4, d5]); | ||
1379 | }); | ||
1380 | |||
1381 | var _Json_map6 = F7(function(f, d1, d2, d3, d4, d5, d6) | ||
1382 | { | ||
1383 | return _Json_mapMany(f, [d1, d2, d3, d4, d5, d6]); | ||
1384 | }); | ||
1385 | |||
1386 | var _Json_map7 = F8(function(f, d1, d2, d3, d4, d5, d6, d7) | ||
1387 | { | ||
1388 | return _Json_mapMany(f, [d1, d2, d3, d4, d5, d6, d7]); | ||
1389 | }); | ||
1390 | |||
1391 | var _Json_map8 = F9(function(f, d1, d2, d3, d4, d5, d6, d7, d8) | ||
1392 | { | ||
1393 | return _Json_mapMany(f, [d1, d2, d3, d4, d5, d6, d7, d8]); | ||
1394 | }); | ||
1395 | |||
1396 | |||
1397 | // DECODE | ||
1398 | |||
1399 | var _Json_runOnString = F2(function(decoder, string) | ||
1400 | { | ||
1401 | try | ||
1402 | { | ||
1403 | var value = JSON.parse(string); | ||
1404 | return _Json_runHelp(decoder, value); | ||
1405 | } | ||
1406 | catch (e) | ||
1407 | { | ||
1408 | return $elm$core$Result$Err(A2($elm$json$Json$Decode$Failure, 'This is not valid JSON! ' + e.message, _Json_wrap(string))); | ||
1409 | } | ||
1410 | }); | ||
1411 | |||
1412 | var _Json_run = F2(function(decoder, value) | ||
1413 | { | ||
1414 | return _Json_runHelp(decoder, _Json_unwrap(value)); | ||
1415 | }); | ||
1416 | |||
1417 | function _Json_runHelp(decoder, value) | ||
1418 | { | ||
1419 | switch (decoder.$) | ||
1420 | { | ||
1421 | case 2: | ||
1422 | return decoder.b(value); | ||
1423 | |||
1424 | case 5: | ||
1425 | return (value === null) | ||
1426 | ? $elm$core$Result$Ok(decoder.c) | ||
1427 | : _Json_expecting('null', value); | ||
1428 | |||
1429 | case 3: | ||
1430 | if (!_Json_isArray(value)) | ||
1431 | { | ||
1432 | return _Json_expecting('a LIST', value); | ||
1433 | } | ||
1434 | return _Json_runArrayDecoder(decoder.b, value, _List_fromArray); | ||
1435 | |||
1436 | case 4: | ||
1437 | if (!_Json_isArray(value)) | ||
1438 | { | ||
1439 | return _Json_expecting('an ARRAY', value); | ||
1440 | } | ||
1441 | return _Json_runArrayDecoder(decoder.b, value, _Json_toElmArray); | ||
1442 | |||
1443 | case 6: | ||
1444 | var field = decoder.d; | ||
1445 | if (typeof value !== 'object' || value === null || !(field in value)) | ||
1446 | { | ||
1447 | return _Json_expecting('an OBJECT with a field named `' + field + '`', value); | ||
1448 | } | ||
1449 | var result = _Json_runHelp(decoder.b, value[field]); | ||
1450 | return ($elm$core$Result$isOk(result)) ? result : $elm$core$Result$Err(A2($elm$json$Json$Decode$Field, field, result.a)); | ||
1451 | |||
1452 | case 7: | ||
1453 | var index = decoder.e; | ||
1454 | if (!_Json_isArray(value)) | ||
1455 | { | ||
1456 | return _Json_expecting('an ARRAY', value); | ||
1457 | } | ||
1458 | if (index >= value.length) | ||
1459 | { | ||
1460 | return _Json_expecting('a LONGER array. Need index ' + index + ' but only see ' + value.length + ' entries', value); | ||
1461 | } | ||
1462 | var result = _Json_runHelp(decoder.b, value[index]); | ||
1463 | return ($elm$core$Result$isOk(result)) ? result : $elm$core$Result$Err(A2($elm$json$Json$Decode$Index, index, result.a)); | ||
1464 | |||
1465 | case 8: | ||
1466 | if (typeof value !== 'object' || value === null || _Json_isArray(value)) | ||
1467 | { | ||
1468 | return _Json_expecting('an OBJECT', value); | ||
1469 | } | ||
1470 | |||
1471 | var keyValuePairs = _List_Nil; | ||
1472 | // TODO test perf of Object.keys and switch when support is good enough | ||
1473 | for (var key in value) | ||
1474 | { | ||
1475 | if (value.hasOwnProperty(key)) | ||
1476 | { | ||
1477 | var result = _Json_runHelp(decoder.b, value[key]); | ||
1478 | if (!$elm$core$Result$isOk(result)) | ||
1479 | { | ||
1480 | return $elm$core$Result$Err(A2($elm$json$Json$Decode$Field, key, result.a)); | ||
1481 | } | ||
1482 | keyValuePairs = _List_Cons(_Utils_Tuple2(key, result.a), keyValuePairs); | ||
1483 | } | ||
1484 | } | ||
1485 | return $elm$core$Result$Ok($elm$core$List$reverse(keyValuePairs)); | ||
1486 | |||
1487 | case 9: | ||
1488 | var answer = decoder.f; | ||
1489 | var decoders = decoder.g; | ||
1490 | for (var i = 0; i < decoders.length; i++) | ||
1491 | { | ||
1492 | var result = _Json_runHelp(decoders[i], value); | ||
1493 | if (!$elm$core$Result$isOk(result)) | ||
1494 | { | ||
1495 | return result; | ||
1496 | } | ||
1497 | answer = answer(result.a); | ||
1498 | } | ||
1499 | return $elm$core$Result$Ok(answer); | ||
1500 | |||
1501 | case 10: | ||
1502 | var result = _Json_runHelp(decoder.b, value); | ||
1503 | return (!$elm$core$Result$isOk(result)) | ||
1504 | ? result | ||
1505 | : _Json_runHelp(decoder.h(result.a), value); | ||
1506 | |||
1507 | case 11: | ||
1508 | var errors = _List_Nil; | ||
1509 | for (var temp = decoder.g; temp.b; temp = temp.b) // WHILE_CONS | ||
1510 | { | ||
1511 | var result = _Json_runHelp(temp.a, value); | ||
1512 | if ($elm$core$Result$isOk(result)) | ||
1513 | { | ||
1514 | return result; | ||
1515 | } | ||
1516 | errors = _List_Cons(result.a, errors); | ||
1517 | } | ||
1518 | return $elm$core$Result$Err($elm$json$Json$Decode$OneOf($elm$core$List$reverse(errors))); | ||
1519 | |||
1520 | case 1: | ||
1521 | return $elm$core$Result$Err(A2($elm$json$Json$Decode$Failure, decoder.a, _Json_wrap(value))); | ||
1522 | |||
1523 | case 0: | ||
1524 | return $elm$core$Result$Ok(decoder.a); | ||
1525 | } | ||
1526 | } | ||
1527 | |||
1528 | function _Json_runArrayDecoder(decoder, value, toElmValue) | ||
1529 | { | ||
1530 | var len = value.length; | ||
1531 | var array = new Array(len); | ||
1532 | for (var i = 0; i < len; i++) | ||
1533 | { | ||
1534 | var result = _Json_runHelp(decoder, value[i]); | ||
1535 | if (!$elm$core$Result$isOk(result)) | ||
1536 | { | ||
1537 | return $elm$core$Result$Err(A2($elm$json$Json$Decode$Index, i, result.a)); | ||
1538 | } | ||
1539 | array[i] = result.a; | ||
1540 | } | ||
1541 | return $elm$core$Result$Ok(toElmValue(array)); | ||
1542 | } | ||
1543 | |||
1544 | function _Json_isArray(value) | ||
1545 | { | ||
1546 | return Array.isArray(value) || (typeof FileList !== 'undefined' && value instanceof FileList); | ||
1547 | } | ||
1548 | |||
1549 | function _Json_toElmArray(array) | ||
1550 | { | ||
1551 | return A2($elm$core$Array$initialize, array.length, function(i) { return array[i]; }); | ||
1552 | } | ||
1553 | |||
1554 | function _Json_expecting(type, value) | ||
1555 | { | ||
1556 | return $elm$core$Result$Err(A2($elm$json$Json$Decode$Failure, 'Expecting ' + type, _Json_wrap(value))); | ||
1557 | } | ||
1558 | |||
1559 | |||
1560 | // EQUALITY | ||
1561 | |||
1562 | function _Json_equality(x, y) | ||
1563 | { | ||
1564 | if (x === y) | ||
1565 | { | ||
1566 | return true; | ||
1567 | } | ||
1568 | |||
1569 | if (x.$ !== y.$) | ||
1570 | { | ||
1571 | return false; | ||
1572 | } | ||
1573 | |||
1574 | switch (x.$) | ||
1575 | { | ||
1576 | case 0: | ||
1577 | case 1: | ||
1578 | return x.a === y.a; | ||
1579 | |||
1580 | case 2: | ||
1581 | return x.b === y.b; | ||
1582 | |||
1583 | case 5: | ||
1584 | return x.c === y.c; | ||
1585 | |||
1586 | case 3: | ||
1587 | case 4: | ||
1588 | case 8: | ||
1589 | return _Json_equality(x.b, y.b); | ||
1590 | |||
1591 | case 6: | ||
1592 | return x.d === y.d && _Json_equality(x.b, y.b); | ||
1593 | |||
1594 | case 7: | ||
1595 | return x.e === y.e && _Json_equality(x.b, y.b); | ||
1596 | |||
1597 | case 9: | ||
1598 | return x.f === y.f && _Json_listEquality(x.g, y.g); | ||
1599 | |||
1600 | case 10: | ||
1601 | return x.h === y.h && _Json_equality(x.b, y.b); | ||
1602 | |||
1603 | case 11: | ||
1604 | return _Json_listEquality(x.g, y.g); | ||
1605 | } | ||
1606 | } | ||
1607 | |||
1608 | function _Json_listEquality(aDecoders, bDecoders) | ||
1609 | { | ||
1610 | var len = aDecoders.length; | ||
1611 | if (len !== bDecoders.length) | ||
1612 | { | ||
1613 | return false; | ||
1614 | } | ||
1615 | for (var i = 0; i < len; i++) | ||
1616 | { | ||
1617 | if (!_Json_equality(aDecoders[i], bDecoders[i])) | ||
1618 | { | ||
1619 | return false; | ||
1620 | } | ||
1621 | } | ||
1622 | return true; | ||
1623 | } | ||
1624 | |||
1625 | |||
1626 | // ENCODE | ||
1627 | |||
1628 | var _Json_encode = F2(function(indentLevel, value) | ||
1629 | { | ||
1630 | return JSON.stringify(_Json_unwrap(value), null, indentLevel) + ''; | ||
1631 | }); | ||
1632 | |||
1633 | function _Json_wrap(value) { return { $: 0, a: value }; } | ||
1634 | function _Json_unwrap(value) { return value.a; } | ||
1635 | |||
1636 | function _Json_wrap_UNUSED(value) { return value; } | ||
1637 | function _Json_unwrap_UNUSED(value) { return value; } | ||
1638 | |||
1639 | function _Json_emptyArray() { return []; } | ||
1640 | function _Json_emptyObject() { return {}; } | ||
1641 | |||
1642 | var _Json_addField = F3(function(key, value, object) | ||
1643 | { | ||
1644 | object[key] = _Json_unwrap(value); | ||
1645 | return object; | ||
1646 | }); | ||
1647 | |||
1648 | function _Json_addEntry(func) | ||
1649 | { | ||
1650 | return F2(function(entry, array) | ||
1651 | { | ||
1652 | array.push(_Json_unwrap(func(entry))); | ||
1653 | return array; | ||
1654 | }); | ||
1655 | } | ||
1656 | |||
1657 | var _Json_encodeNull = _Json_wrap(null); | ||
1658 | |||
1659 | |||
1660 | |||
1661 | // TASKS | ||
1662 | |||
1663 | function _Scheduler_succeed(value) | ||
1664 | { | ||
1665 | return { | ||
1666 | $: 0, | ||
1667 | a: value | ||
1668 | }; | ||
1669 | } | ||
1670 | |||
1671 | function _Scheduler_fail(error) | ||
1672 | { | ||
1673 | return { | ||
1674 | $: 1, | ||
1675 | a: error | ||
1676 | }; | ||
1677 | } | ||
1678 | |||
1679 | function _Scheduler_binding(callback) | ||
1680 | { | ||
1681 | return { | ||
1682 | $: 2, | ||
1683 | b: callback, | ||
1684 | c: null | ||
1685 | }; | ||
1686 | } | ||
1687 | |||
1688 | var _Scheduler_andThen = F2(function(callback, task) | ||
1689 | { | ||
1690 | return { | ||
1691 | $: 3, | ||
1692 | b: callback, | ||
1693 | d: task | ||
1694 | }; | ||
1695 | }); | ||
1696 | |||
1697 | var _Scheduler_onError = F2(function(callback, task) | ||
1698 | { | ||
1699 | return { | ||
1700 | $: 4, | ||
1701 | b: callback, | ||
1702 | d: task | ||
1703 | }; | ||
1704 | }); | ||
1705 | |||
1706 | function _Scheduler_receive(callback) | ||
1707 | { | ||
1708 | return { | ||
1709 | $: 5, | ||
1710 | b: callback | ||
1711 | }; | ||
1712 | } | ||
1713 | |||
1714 | |||
1715 | // PROCESSES | ||
1716 | |||
1717 | var _Scheduler_guid = 0; | ||
1718 | |||
1719 | function _Scheduler_rawSpawn(task) | ||
1720 | { | ||
1721 | var proc = { | ||
1722 | $: 0, | ||
1723 | e: _Scheduler_guid++, | ||
1724 | f: task, | ||
1725 | g: null, | ||
1726 | h: [] | ||
1727 | }; | ||
1728 | |||
1729 | _Scheduler_enqueue(proc); | ||
1730 | |||
1731 | return proc; | ||
1732 | } | ||
1733 | |||
1734 | function _Scheduler_spawn(task) | ||
1735 | { | ||
1736 | return _Scheduler_binding(function(callback) { | ||
1737 | callback(_Scheduler_succeed(_Scheduler_rawSpawn(task))); | ||
1738 | }); | ||
1739 | } | ||
1740 | |||
1741 | function _Scheduler_rawSend(proc, msg) | ||
1742 | { | ||
1743 | proc.h.push(msg); | ||
1744 | _Scheduler_enqueue(proc); | ||
1745 | } | ||
1746 | |||
1747 | var _Scheduler_send = F2(function(proc, msg) | ||
1748 | { | ||
1749 | return _Scheduler_binding(function(callback) { | ||
1750 | _Scheduler_rawSend(proc, msg); | ||
1751 | callback(_Scheduler_succeed(_Utils_Tuple0)); | ||
1752 | }); | ||
1753 | }); | ||
1754 | |||
1755 | function _Scheduler_kill(proc) | ||
1756 | { | ||
1757 | return _Scheduler_binding(function(callback) { | ||
1758 | var task = proc.f; | ||
1759 | if (task.$ === 2 && task.c) | ||
1760 | { | ||
1761 | task.c(); | ||
1762 | } | ||
1763 | |||
1764 | proc.f = null; | ||
1765 | |||
1766 | callback(_Scheduler_succeed(_Utils_Tuple0)); | ||
1767 | }); | ||
1768 | } | ||
1769 | |||
1770 | |||
1771 | /* STEP PROCESSES | ||
1772 | |||
1773 | type alias Process = | ||
1774 | { $ : tag | ||
1775 | , id : unique_id | ||
1776 | , root : Task | ||
1777 | , stack : null | { $: SUCCEED | FAIL, a: callback, b: stack } | ||
1778 | , mailbox : [msg] | ||
1779 | } | ||
1780 | |||
1781 | */ | ||
1782 | |||
1783 | |||
1784 | var _Scheduler_working = false; | ||
1785 | var _Scheduler_queue = []; | ||
1786 | |||
1787 | |||
1788 | function _Scheduler_enqueue(proc) | ||
1789 | { | ||
1790 | _Scheduler_queue.push(proc); | ||
1791 | if (_Scheduler_working) | ||
1792 | { | ||
1793 | return; | ||
1794 | } | ||
1795 | _Scheduler_working = true; | ||
1796 | while (proc = _Scheduler_queue.shift()) | ||
1797 | { | ||
1798 | _Scheduler_step(proc); | ||
1799 | } | ||
1800 | _Scheduler_working = false; | ||
1801 | } | ||
1802 | |||
1803 | |||
1804 | function _Scheduler_step(proc) | ||
1805 | { | ||
1806 | while (proc.f) | ||
1807 | { | ||
1808 | var rootTag = proc.f.$; | ||
1809 | if (rootTag === 0 || rootTag === 1) | ||
1810 | { | ||
1811 | while (proc.g && proc.g.$ !== rootTag) | ||
1812 | { | ||
1813 | proc.g = proc.g.i; | ||
1814 | } | ||
1815 | if (!proc.g) | ||
1816 | { | ||
1817 | return; | ||
1818 | } | ||
1819 | proc.f = proc.g.b(proc.f.a); | ||
1820 | proc.g = proc.g.i; | ||
1821 | } | ||
1822 | else if (rootTag === 2) | ||
1823 | { | ||
1824 | proc.f.c = proc.f.b(function(newRoot) { | ||
1825 | proc.f = newRoot; | ||
1826 | _Scheduler_enqueue(proc); | ||
1827 | }); | ||
1828 | return; | ||
1829 | } | ||
1830 | else if (rootTag === 5) | ||
1831 | { | ||
1832 | if (proc.h.length === 0) | ||
1833 | { | ||
1834 | return; | ||
1835 | } | ||
1836 | proc.f = proc.f.b(proc.h.shift()); | ||
1837 | } | ||
1838 | else // if (rootTag === 3 || rootTag === 4) | ||
1839 | { | ||
1840 | proc.g = { | ||
1841 | $: rootTag === 3 ? 0 : 1, | ||
1842 | b: proc.f.b, | ||
1843 | i: proc.g | ||
1844 | }; | ||
1845 | proc.f = proc.f.d; | ||
1846 | } | ||
1847 | } | ||
1848 | } | ||
1849 | |||
1850 | |||
1851 | |||
1852 | function _Process_sleep(time) | ||
1853 | { | ||
1854 | return _Scheduler_binding(function(callback) { | ||
1855 | var id = setTimeout(function() { | ||
1856 | callback(_Scheduler_succeed(_Utils_Tuple0)); | ||
1857 | }, time); | ||
1858 | |||
1859 | return function() { clearTimeout(id); }; | ||
1860 | }); | ||
1861 | } | ||
1862 | |||
1863 | |||
1864 | |||
1865 | |||
1866 | // PROGRAMS | ||
1867 | |||
1868 | |||
1869 | var _Platform_worker = F4(function(impl, flagDecoder, debugMetadata, args) | ||
1870 | { | ||
1871 | return _Platform_initialize( | ||
1872 | flagDecoder, | ||
1873 | args, | ||
1874 | impl.init, | ||
1875 | impl.update, | ||
1876 | impl.subscriptions, | ||
1877 | function() { return function() {} } | ||
1878 | ); | ||
1879 | }); | ||
1880 | |||
1881 | |||
1882 | |||
1883 | // INITIALIZE A PROGRAM | ||
1884 | |||
1885 | |||
1886 | function _Platform_initialize(flagDecoder, args, init, update, subscriptions, stepperBuilder) | ||
1887 | { | ||
1888 | var result = A2(_Json_run, flagDecoder, _Json_wrap(args ? args['flags'] : undefined)); | ||
1889 | $elm$core$Result$isOk(result) || _Debug_crash(2 /**/, _Json_errorToString(result.a) /**/); | ||
1890 | var managers = {}; | ||
1891 | var initPair = init(result.a); | ||
1892 | var model = initPair.a; | ||
1893 | var stepper = stepperBuilder(sendToApp, model); | ||
1894 | var ports = _Platform_setupEffects(managers, sendToApp); | ||
1895 | |||
1896 | function sendToApp(msg, viewMetadata) | ||
1897 | { | ||
1898 | var pair = A2(update, msg, model); | ||
1899 | stepper(model = pair.a, viewMetadata); | ||
1900 | _Platform_enqueueEffects(managers, pair.b, subscriptions(model)); | ||
1901 | } | ||
1902 | |||
1903 | _Platform_enqueueEffects(managers, initPair.b, subscriptions(model)); | ||
1904 | |||
1905 | return ports ? { ports: ports } : {}; | ||
1906 | } | ||
1907 | |||
1908 | |||
1909 | |||
1910 | // TRACK PRELOADS | ||
1911 | // | ||
1912 | // This is used by code in elm/browser and elm/http | ||
1913 | // to register any HTTP requests that are triggered by init. | ||
1914 | // | ||
1915 | |||
1916 | |||
1917 | var _Platform_preload; | ||
1918 | |||
1919 | |||
1920 | function _Platform_registerPreload(url) | ||
1921 | { | ||
1922 | _Platform_preload.add(url); | ||
1923 | } | ||
1924 | |||
1925 | |||
1926 | |||
1927 | // EFFECT MANAGERS | ||
1928 | |||
1929 | |||
1930 | var _Platform_effectManagers = {}; | ||
1931 | |||
1932 | |||
1933 | function _Platform_setupEffects(managers, sendToApp) | ||
1934 | { | ||
1935 | var ports; | ||
1936 | |||
1937 | // setup all necessary effect managers | ||
1938 | for (var key in _Platform_effectManagers) | ||
1939 | { | ||
1940 | var manager = _Platform_effectManagers[key]; | ||
1941 | |||
1942 | if (manager.a) | ||
1943 | { | ||
1944 | ports = ports || {}; | ||
1945 | ports[key] = manager.a(key, sendToApp); | ||
1946 | } | ||
1947 | |||
1948 | managers[key] = _Platform_instantiateManager(manager, sendToApp); | ||
1949 | } | ||
1950 | |||
1951 | return ports; | ||
1952 | } | ||
1953 | |||
1954 | |||
1955 | function _Platform_createManager(init, onEffects, onSelfMsg, cmdMap, subMap) | ||
1956 | { | ||
1957 | return { | ||
1958 | b: init, | ||
1959 | c: onEffects, | ||
1960 | d: onSelfMsg, | ||
1961 | e: cmdMap, | ||
1962 | f: subMap | ||
1963 | }; | ||
1964 | } | ||
1965 | |||
1966 | |||
1967 | function _Platform_instantiateManager(info, sendToApp) | ||
1968 | { | ||
1969 | var router = { | ||
1970 | g: sendToApp, | ||
1971 | h: undefined | ||
1972 | }; | ||
1973 | |||
1974 | var onEffects = info.c; | ||
1975 | var onSelfMsg = info.d; | ||
1976 | var cmdMap = info.e; | ||
1977 | var subMap = info.f; | ||
1978 | |||
1979 | function loop(state) | ||
1980 | { | ||
1981 | return A2(_Scheduler_andThen, loop, _Scheduler_receive(function(msg) | ||
1982 | { | ||
1983 | var value = msg.a; | ||
1984 | |||
1985 | if (msg.$ === 0) | ||
1986 | { | ||
1987 | return A3(onSelfMsg, router, value, state); | ||
1988 | } | ||
1989 | |||
1990 | return cmdMap && subMap | ||
1991 | ? A4(onEffects, router, value.i, value.j, state) | ||
1992 | : A3(onEffects, router, cmdMap ? value.i : value.j, state); | ||
1993 | })); | ||
1994 | } | ||
1995 | |||
1996 | return router.h = _Scheduler_rawSpawn(A2(_Scheduler_andThen, loop, info.b)); | ||
1997 | } | ||
1998 | |||
1999 | |||
2000 | |||
2001 | // ROUTING | ||
2002 | |||
2003 | |||
2004 | var _Platform_sendToApp = F2(function(router, msg) | ||
2005 | { | ||
2006 | return _Scheduler_binding(function(callback) | ||
2007 | { | ||
2008 | router.g(msg); | ||
2009 | callback(_Scheduler_succeed(_Utils_Tuple0)); | ||
2010 | }); | ||
2011 | }); | ||
2012 | |||
2013 | |||
2014 | var _Platform_sendToSelf = F2(function(router, msg) | ||
2015 | { | ||
2016 | return A2(_Scheduler_send, router.h, { | ||
2017 | $: 0, | ||
2018 | a: msg | ||
2019 | }); | ||
2020 | }); | ||
2021 | |||
2022 | |||
2023 | |||
2024 | // BAGS | ||
2025 | |||
2026 | |||
2027 | function _Platform_leaf(home) | ||
2028 | { | ||
2029 | return function(value) | ||
2030 | { | ||
2031 | return { | ||
2032 | $: 1, | ||
2033 | k: home, | ||
2034 | l: value | ||
2035 | }; | ||
2036 | }; | ||
2037 | } | ||
2038 | |||
2039 | |||
2040 | function _Platform_batch(list) | ||
2041 | { | ||
2042 | return { | ||
2043 | $: 2, | ||
2044 | m: list | ||
2045 | }; | ||
2046 | } | ||
2047 | |||
2048 | |||
2049 | var _Platform_map = F2(function(tagger, bag) | ||
2050 | { | ||
2051 | return { | ||
2052 | $: 3, | ||
2053 | n: tagger, | ||
2054 | o: bag | ||
2055 | } | ||
2056 | }); | ||
2057 | |||
2058 | |||
2059 | |||
2060 | // PIPE BAGS INTO EFFECT MANAGERS | ||
2061 | // | ||
2062 | // Effects must be queued! | ||
2063 | // | ||
2064 | // Say your init contains a synchronous command, like Time.now or Time.here | ||
2065 | // | ||
2066 | // - This will produce a batch of effects (FX_1) | ||
2067 | // - The synchronous task triggers the subsequent `update` call | ||
2068 | // - This will produce a batch of effects (FX_2) | ||
2069 | // | ||
2070 | // If we just start dispatching FX_2, subscriptions from FX_2 can be processed | ||
2071 | // before subscriptions from FX_1. No good! Earlier versions of this code had | ||
2072 | // this problem, leading to these reports: | ||
2073 | // | ||
2074 | // https://github.com/elm/core/issues/980 | ||
2075 | // https://github.com/elm/core/pull/981 | ||
2076 | // https://github.com/elm/compiler/issues/1776 | ||
2077 | // | ||
2078 | // The queue is necessary to avoid ordering issues for synchronous commands. | ||
2079 | |||
2080 | |||
2081 | // Why use true/false here? Why not just check the length of the queue? | ||
2082 | // The goal is to detect "are we currently dispatching effects?" If we | ||
2083 | // are, we need to bail and let the ongoing while loop handle things. | ||
2084 | // | ||
2085 | // Now say the queue has 1 element. When we dequeue the final element, | ||
2086 | // the queue will be empty, but we are still actively dispatching effects. | ||
2087 | // So you could get queue jumping in a really tricky category of cases. | ||
2088 | // | ||
2089 | var _Platform_effectsQueue = []; | ||
2090 | var _Platform_effectsActive = false; | ||
2091 | |||
2092 | |||
2093 | function _Platform_enqueueEffects(managers, cmdBag, subBag) | ||
2094 | { | ||
2095 | _Platform_effectsQueue.push({ p: managers, q: cmdBag, r: subBag }); | ||
2096 | |||
2097 | if (_Platform_effectsActive) return; | ||
2098 | |||
2099 | _Platform_effectsActive = true; | ||
2100 | for (var fx; fx = _Platform_effectsQueue.shift(); ) | ||
2101 | { | ||
2102 | _Platform_dispatchEffects(fx.p, fx.q, fx.r); | ||
2103 | } | ||
2104 | _Platform_effectsActive = false; | ||
2105 | } | ||
2106 | |||
2107 | |||
2108 | function _Platform_dispatchEffects(managers, cmdBag, subBag) | ||
2109 | { | ||
2110 | var effectsDict = {}; | ||
2111 | _Platform_gatherEffects(true, cmdBag, effectsDict, null); | ||
2112 | _Platform_gatherEffects(false, subBag, effectsDict, null); | ||
2113 | |||
2114 | for (var home in managers) | ||
2115 | { | ||
2116 | _Scheduler_rawSend(managers[home], { | ||
2117 | $: 'fx', | ||
2118 | a: effectsDict[home] || { i: _List_Nil, j: _List_Nil } | ||
2119 | }); | ||
2120 | } | ||
2121 | } | ||
2122 | |||
2123 | |||
2124 | function _Platform_gatherEffects(isCmd, bag, effectsDict, taggers) | ||
2125 | { | ||
2126 | switch (bag.$) | ||
2127 | { | ||
2128 | case 1: | ||
2129 | var home = bag.k; | ||
2130 | var effect = _Platform_toEffect(isCmd, home, taggers, bag.l); | ||
2131 | effectsDict[home] = _Platform_insert(isCmd, effect, effectsDict[home]); | ||
2132 | return; | ||
2133 | |||
2134 | case 2: | ||
2135 | for (var list = bag.m; list.b; list = list.b) // WHILE_CONS | ||
2136 | { | ||
2137 | _Platform_gatherEffects(isCmd, list.a, effectsDict, taggers); | ||
2138 | } | ||
2139 | return; | ||
2140 | |||
2141 | case 3: | ||
2142 | _Platform_gatherEffects(isCmd, bag.o, effectsDict, { | ||
2143 | s: bag.n, | ||
2144 | t: taggers | ||
2145 | }); | ||
2146 | return; | ||
2147 | } | ||
2148 | } | ||
2149 | |||
2150 | |||
2151 | function _Platform_toEffect(isCmd, home, taggers, value) | ||
2152 | { | ||
2153 | function applyTaggers(x) | ||
2154 | { | ||
2155 | for (var temp = taggers; temp; temp = temp.t) | ||
2156 | { | ||
2157 | x = temp.s(x); | ||
2158 | } | ||
2159 | return x; | ||
2160 | } | ||
2161 | |||
2162 | var map = isCmd | ||
2163 | ? _Platform_effectManagers[home].e | ||
2164 | : _Platform_effectManagers[home].f; | ||
2165 | |||
2166 | return A2(map, applyTaggers, value) | ||
2167 | } | ||
2168 | |||
2169 | |||
2170 | function _Platform_insert(isCmd, newEffect, effects) | ||
2171 | { | ||
2172 | effects = effects || { i: _List_Nil, j: _List_Nil }; | ||
2173 | |||
2174 | isCmd | ||
2175 | ? (effects.i = _List_Cons(newEffect, effects.i)) | ||
2176 | : (effects.j = _List_Cons(newEffect, effects.j)); | ||
2177 | |||
2178 | return effects; | ||
2179 | } | ||
2180 | |||
2181 | |||
2182 | |||
2183 | // PORTS | ||
2184 | |||
2185 | |||
2186 | function _Platform_checkPortName(name) | ||
2187 | { | ||
2188 | if (_Platform_effectManagers[name]) | ||
2189 | { | ||
2190 | _Debug_crash(3, name) | ||
2191 | } | ||
2192 | } | ||
2193 | |||
2194 | |||
2195 | |||
2196 | // OUTGOING PORTS | ||
2197 | |||
2198 | |||
2199 | function _Platform_outgoingPort(name, converter) | ||
2200 | { | ||
2201 | _Platform_checkPortName(name); | ||
2202 | _Platform_effectManagers[name] = { | ||
2203 | e: _Platform_outgoingPortMap, | ||
2204 | u: converter, | ||
2205 | a: _Platform_setupOutgoingPort | ||
2206 | }; | ||
2207 | return _Platform_leaf(name); | ||
2208 | } | ||
2209 | |||
2210 | |||
2211 | var _Platform_outgoingPortMap = F2(function(tagger, value) { return value; }); | ||
2212 | |||
2213 | |||
2214 | function _Platform_setupOutgoingPort(name) | ||
2215 | { | ||
2216 | var subs = []; | ||
2217 | var converter = _Platform_effectManagers[name].u; | ||
2218 | |||
2219 | // CREATE MANAGER | ||
2220 | |||
2221 | var init = _Process_sleep(0); | ||
2222 | |||
2223 | _Platform_effectManagers[name].b = init; | ||
2224 | _Platform_effectManagers[name].c = F3(function(router, cmdList, state) | ||
2225 | { | ||
2226 | for ( ; cmdList.b; cmdList = cmdList.b) // WHILE_CONS | ||
2227 | { | ||
2228 | // grab a separate reference to subs in case unsubscribe is called | ||
2229 | var currentSubs = subs; | ||
2230 | var value = _Json_unwrap(converter(cmdList.a)); | ||
2231 | for (var i = 0; i < currentSubs.length; i++) | ||
2232 | { | ||
2233 | currentSubs[i](value); | ||
2234 | } | ||
2235 | } | ||
2236 | return init; | ||
2237 | }); | ||
2238 | |||
2239 | // PUBLIC API | ||
2240 | |||
2241 | function subscribe(callback) | ||
2242 | { | ||
2243 | subs.push(callback); | ||
2244 | } | ||
2245 | |||
2246 | function unsubscribe(callback) | ||
2247 | { | ||
2248 | // copy subs into a new array in case unsubscribe is called within a | ||
2249 | // subscribed callback | ||
2250 | subs = subs.slice(); | ||
2251 | var index = subs.indexOf(callback); | ||
2252 | if (index >= 0) | ||
2253 | { | ||
2254 | subs.splice(index, 1); | ||
2255 | } | ||
2256 | } | ||
2257 | |||
2258 | return { | ||
2259 | subscribe: subscribe, | ||
2260 | unsubscribe: unsubscribe | ||
2261 | }; | ||
2262 | } | ||
2263 | |||
2264 | |||
2265 | |||
2266 | // INCOMING PORTS | ||
2267 | |||
2268 | |||
2269 | function _Platform_incomingPort(name, converter) | ||
2270 | { | ||
2271 | _Platform_checkPortName(name); | ||
2272 | _Platform_effectManagers[name] = { | ||
2273 | f: _Platform_incomingPortMap, | ||
2274 | u: converter, | ||
2275 | a: _Platform_setupIncomingPort | ||
2276 | }; | ||
2277 | return _Platform_leaf(name); | ||
2278 | } | ||
2279 | |||
2280 | |||
2281 | var _Platform_incomingPortMap = F2(function(tagger, finalTagger) | ||
2282 | { | ||
2283 | return function(value) | ||
2284 | { | ||
2285 | return tagger(finalTagger(value)); | ||
2286 | }; | ||
2287 | }); | ||
2288 | |||
2289 | |||
2290 | function _Platform_setupIncomingPort(name, sendToApp) | ||
2291 | { | ||
2292 | var subs = _List_Nil; | ||
2293 | var converter = _Platform_effectManagers[name].u; | ||
2294 | |||
2295 | // CREATE MANAGER | ||
2296 | |||
2297 | var init = _Scheduler_succeed(null); | ||
2298 | |||
2299 | _Platform_effectManagers[name].b = init; | ||
2300 | _Platform_effectManagers[name].c = F3(function(router, subList, state) | ||
2301 | { | ||
2302 | subs = subList; | ||
2303 | return init; | ||
2304 | }); | ||
2305 | |||
2306 | // PUBLIC API | ||
2307 | |||
2308 | function send(incomingValue) | ||
2309 | { | ||
2310 | var result = A2(_Json_run, converter, _Json_wrap(incomingValue)); | ||
2311 | |||
2312 | $elm$core$Result$isOk(result) || _Debug_crash(4, name, result.a); | ||
2313 | |||
2314 | var value = result.a; | ||
2315 | for (var temp = subs; temp.b; temp = temp.b) // WHILE_CONS | ||
2316 | { | ||
2317 | sendToApp(temp.a(value)); | ||
2318 | } | ||
2319 | } | ||
2320 | |||
2321 | return { send: send }; | ||
2322 | } | ||
2323 | |||
2324 | |||
2325 | |||
2326 | // EXPORT ELM MODULES | ||
2327 | // | ||
2328 | // Have DEBUG and PROD versions so that we can (1) give nicer errors in | ||
2329 | // debug mode and (2) not pay for the bits needed for that in prod mode. | ||
2330 | // | ||
2331 | |||
2332 | |||
2333 | function _Platform_export_UNUSED(exports) | ||
2334 | { | ||
2335 | scope['Elm'] | ||
2336 | ? _Platform_mergeExportsProd(scope['Elm'], exports) | ||
2337 | : scope['Elm'] = exports; | ||
2338 | } | ||
2339 | |||
2340 | |||
2341 | function _Platform_mergeExportsProd(obj, exports) | ||
2342 | { | ||
2343 | for (var name in exports) | ||
2344 | { | ||
2345 | (name in obj) | ||
2346 | ? (name == 'init') | ||
2347 | ? _Debug_crash(6) | ||
2348 | : _Platform_mergeExportsProd(obj[name], exports[name]) | ||
2349 | : (obj[name] = exports[name]); | ||
2350 | } | ||
2351 | } | ||
2352 | |||
2353 | |||
2354 | function _Platform_export(exports) | ||
2355 | { | ||
2356 | scope['Elm'] | ||
2357 | ? _Platform_mergeExportsDebug('Elm', scope['Elm'], exports) | ||
2358 | : scope['Elm'] = exports; | ||
2359 | } | ||
2360 | |||
2361 | |||
2362 | function _Platform_mergeExportsDebug(moduleName, obj, exports) | ||
2363 | { | ||
2364 | for (var name in exports) | ||
2365 | { | ||
2366 | (name in obj) | ||
2367 | ? (name == 'init') | ||
2368 | ? _Debug_crash(6, moduleName) | ||
2369 | : _Platform_mergeExportsDebug(moduleName + '.' + name, obj[name], exports[name]) | ||
2370 | : (obj[name] = exports[name]); | ||
2371 | } | ||
2372 | } | ||
2373 | |||
2374 | |||
2375 | |||
2376 | |||
2377 | // HELPERS | ||
2378 | |||
2379 | |||
2380 | var _VirtualDom_divertHrefToApp; | ||
2381 | |||
2382 | var _VirtualDom_doc = typeof document !== 'undefined' ? document : {}; | ||
2383 | |||
2384 | |||
2385 | function _VirtualDom_appendChild(parent, child) | ||
2386 | { | ||
2387 | parent.appendChild(child); | ||
2388 | } | ||
2389 | |||
2390 | var _VirtualDom_init = F4(function(virtualNode, flagDecoder, debugMetadata, args) | ||
2391 | { | ||
2392 | // NOTE: this function needs _Platform_export available to work | ||
2393 | |||
2394 | /**_UNUSED/ | ||
2395 | var node = args['node']; | ||
2396 | //*/ | ||
2397 | /**/ | ||
2398 | var node = args && args['node'] ? args['node'] : _Debug_crash(0); | ||
2399 | //*/ | ||
2400 | |||
2401 | node.parentNode.replaceChild( | ||
2402 | _VirtualDom_render(virtualNode, function() {}), | ||
2403 | node | ||
2404 | ); | ||
2405 | |||
2406 | return {}; | ||
2407 | }); | ||
2408 | |||
2409 | |||
2410 | |||
2411 | // TEXT | ||
2412 | |||
2413 | |||
2414 | function _VirtualDom_text(string) | ||
2415 | { | ||
2416 | return { | ||
2417 | $: 0, | ||
2418 | a: string | ||
2419 | }; | ||
2420 | } | ||
2421 | |||
2422 | |||
2423 | |||
2424 | // NODE | ||
2425 | |||
2426 | |||
2427 | var _VirtualDom_nodeNS = F2(function(namespace, tag) | ||
2428 | { | ||
2429 | return F2(function(factList, kidList) | ||
2430 | { | ||
2431 | for (var kids = [], descendantsCount = 0; kidList.b; kidList = kidList.b) // WHILE_CONS | ||
2432 | { | ||
2433 | var kid = kidList.a; | ||
2434 | descendantsCount += (kid.b || 0); | ||
2435 | kids.push(kid); | ||
2436 | } | ||
2437 | descendantsCount += kids.length; | ||
2438 | |||
2439 | return { | ||
2440 | $: 1, | ||
2441 | c: tag, | ||
2442 | d: _VirtualDom_organizeFacts(factList), | ||
2443 | e: kids, | ||
2444 | f: namespace, | ||
2445 | b: descendantsCount | ||
2446 | }; | ||
2447 | }); | ||
2448 | }); | ||
2449 | |||
2450 | |||
2451 | var _VirtualDom_node = _VirtualDom_nodeNS(undefined); | ||
2452 | |||
2453 | |||
2454 | |||
2455 | // KEYED NODE | ||
2456 | |||
2457 | |||
2458 | var _VirtualDom_keyedNodeNS = F2(function(namespace, tag) | ||
2459 | { | ||
2460 | return F2(function(factList, kidList) | ||
2461 | { | ||
2462 | for (var kids = [], descendantsCount = 0; kidList.b; kidList = kidList.b) // WHILE_CONS | ||
2463 | { | ||
2464 | var kid = kidList.a; | ||
2465 | descendantsCount += (kid.b.b || 0); | ||
2466 | kids.push(kid); | ||
2467 | } | ||
2468 | descendantsCount += kids.length; | ||
2469 | |||
2470 | return { | ||
2471 | $: 2, | ||
2472 | c: tag, | ||
2473 | d: _VirtualDom_organizeFacts(factList), | ||
2474 | e: kids, | ||
2475 | f: namespace, | ||
2476 | b: descendantsCount | ||
2477 | }; | ||
2478 | }); | ||
2479 | }); | ||
2480 | |||
2481 | |||
2482 | var _VirtualDom_keyedNode = _VirtualDom_keyedNodeNS(undefined); | ||
2483 | |||
2484 | |||
2485 | |||
2486 | // CUSTOM | ||
2487 | |||
2488 | |||
2489 | function _VirtualDom_custom(factList, model, render, diff) | ||
2490 | { | ||
2491 | return { | ||
2492 | $: 3, | ||
2493 | d: _VirtualDom_organizeFacts(factList), | ||
2494 | g: model, | ||
2495 | h: render, | ||
2496 | i: diff | ||
2497 | }; | ||
2498 | } | ||
2499 | |||
2500 | |||
2501 | |||
2502 | // MAP | ||
2503 | |||
2504 | |||
2505 | var _VirtualDom_map = F2(function(tagger, node) | ||
2506 | { | ||
2507 | return { | ||
2508 | $: 4, | ||
2509 | j: tagger, | ||
2510 | k: node, | ||
2511 | b: 1 + (node.b || 0) | ||
2512 | }; | ||
2513 | }); | ||
2514 | |||
2515 | |||
2516 | |||
2517 | // LAZY | ||
2518 | |||
2519 | |||
2520 | function _VirtualDom_thunk(refs, thunk) | ||
2521 | { | ||
2522 | return { | ||
2523 | $: 5, | ||
2524 | l: refs, | ||
2525 | m: thunk, | ||
2526 | k: undefined | ||
2527 | }; | ||
2528 | } | ||
2529 | |||
2530 | var _VirtualDom_lazy = F2(function(func, a) | ||
2531 | { | ||
2532 | return _VirtualDom_thunk([func, a], function() { | ||
2533 | return func(a); | ||
2534 | }); | ||
2535 | }); | ||
2536 | |||
2537 | var _VirtualDom_lazy2 = F3(function(func, a, b) | ||
2538 | { | ||
2539 | return _VirtualDom_thunk([func, a, b], function() { | ||
2540 | return A2(func, a, b); | ||
2541 | }); | ||
2542 | }); | ||
2543 | |||
2544 | var _VirtualDom_lazy3 = F4(function(func, a, b, c) | ||
2545 | { | ||
2546 | return _VirtualDom_thunk([func, a, b, c], function() { | ||
2547 | return A3(func, a, b, c); | ||
2548 | }); | ||
2549 | }); | ||
2550 | |||
2551 | var _VirtualDom_lazy4 = F5(function(func, a, b, c, d) | ||
2552 | { | ||
2553 | return _VirtualDom_thunk([func, a, b, c, d], function() { | ||
2554 | return A4(func, a, b, c, d); | ||
2555 | }); | ||
2556 | }); | ||
2557 | |||
2558 | var _VirtualDom_lazy5 = F6(function(func, a, b, c, d, e) | ||
2559 | { | ||
2560 | return _VirtualDom_thunk([func, a, b, c, d, e], function() { | ||
2561 | return A5(func, a, b, c, d, e); | ||
2562 | }); | ||
2563 | }); | ||
2564 | |||
2565 | var _VirtualDom_lazy6 = F7(function(func, a, b, c, d, e, f) | ||
2566 | { | ||
2567 | return _VirtualDom_thunk([func, a, b, c, d, e, f], function() { | ||
2568 | return A6(func, a, b, c, d, e, f); | ||
2569 | }); | ||
2570 | }); | ||
2571 | |||
2572 | var _VirtualDom_lazy7 = F8(function(func, a, b, c, d, e, f, g) | ||
2573 | { | ||
2574 | return _VirtualDom_thunk([func, a, b, c, d, e, f, g], function() { | ||
2575 | return A7(func, a, b, c, d, e, f, g); | ||
2576 | }); | ||
2577 | }); | ||
2578 | |||
2579 | var _VirtualDom_lazy8 = F9(function(func, a, b, c, d, e, f, g, h) | ||
2580 | { | ||
2581 | return _VirtualDom_thunk([func, a, b, c, d, e, f, g, h], function() { | ||
2582 | return A8(func, a, b, c, d, e, f, g, h); | ||
2583 | }); | ||
2584 | }); | ||
2585 | |||
2586 | |||
2587 | |||
2588 | // FACTS | ||
2589 | |||
2590 | |||
2591 | var _VirtualDom_on = F2(function(key, handler) | ||
2592 | { | ||
2593 | return { | ||
2594 | $: 'a0', | ||
2595 | n: key, | ||
2596 | o: handler | ||
2597 | }; | ||
2598 | }); | ||
2599 | var _VirtualDom_style = F2(function(key, value) | ||
2600 | { | ||
2601 | return { | ||
2602 | $: 'a1', | ||
2603 | n: key, | ||
2604 | o: value | ||
2605 | }; | ||
2606 | }); | ||
2607 | var _VirtualDom_property = F2(function(key, value) | ||
2608 | { | ||
2609 | return { | ||
2610 | $: 'a2', | ||
2611 | n: key, | ||
2612 | o: value | ||
2613 | }; | ||
2614 | }); | ||
2615 | var _VirtualDom_attribute = F2(function(key, value) | ||
2616 | { | ||
2617 | return { | ||
2618 | $: 'a3', | ||
2619 | n: key, | ||
2620 | o: value | ||
2621 | }; | ||
2622 | }); | ||
2623 | var _VirtualDom_attributeNS = F3(function(namespace, key, value) | ||
2624 | { | ||
2625 | return { | ||
2626 | $: 'a4', | ||
2627 | n: key, | ||
2628 | o: { f: namespace, o: value } | ||
2629 | }; | ||
2630 | }); | ||
2631 | |||
2632 | |||
2633 | |||
2634 | // XSS ATTACK VECTOR CHECKS | ||
2635 | |||
2636 | |||
2637 | function _VirtualDom_noScript(tag) | ||
2638 | { | ||
2639 | return tag == 'script' ? 'p' : tag; | ||
2640 | } | ||
2641 | |||
2642 | function _VirtualDom_noOnOrFormAction(key) | ||
2643 | { | ||
2644 | return /^(on|formAction$)/i.test(key) ? 'data-' + key : key; | ||
2645 | } | ||
2646 | |||
2647 | function _VirtualDom_noInnerHtmlOrFormAction(key) | ||
2648 | { | ||
2649 | return key == 'innerHTML' || key == 'formAction' ? 'data-' + key : key; | ||
2650 | } | ||
2651 | |||
2652 | function _VirtualDom_noJavaScriptUri_UNUSED(value) | ||
2653 | { | ||
2654 | return /^javascript:/i.test(value.replace(/\s/g,'')) ? '' : value; | ||
2655 | } | ||
2656 | |||
2657 | function _VirtualDom_noJavaScriptUri(value) | ||
2658 | { | ||
2659 | return /^javascript:/i.test(value.replace(/\s/g,'')) | ||
2660 | ? 'javascript:alert("This is an XSS vector. Please use ports or web components instead.")' | ||
2661 | : value; | ||
2662 | } | ||
2663 | |||
2664 | function _VirtualDom_noJavaScriptOrHtmlUri_UNUSED(value) | ||
2665 | { | ||
2666 | return /^\s*(javascript:|data:text\/html)/i.test(value) ? '' : value; | ||
2667 | } | ||
2668 | |||
2669 | function _VirtualDom_noJavaScriptOrHtmlUri(value) | ||
2670 | { | ||
2671 | return /^\s*(javascript:|data:text\/html)/i.test(value) | ||
2672 | ? 'javascript:alert("This is an XSS vector. Please use ports or web components instead.")' | ||
2673 | : value; | ||
2674 | } | ||
2675 | |||
2676 | |||
2677 | |||
2678 | // MAP FACTS | ||
2679 | |||
2680 | |||
2681 | var _VirtualDom_mapAttribute = F2(function(func, attr) | ||
2682 | { | ||
2683 | return (attr.$ === 'a0') | ||
2684 | ? A2(_VirtualDom_on, attr.n, _VirtualDom_mapHandler(func, attr.o)) | ||
2685 | : attr; | ||
2686 | }); | ||
2687 | |||
2688 | function _VirtualDom_mapHandler(func, handler) | ||
2689 | { | ||
2690 | var tag = $elm$virtual_dom$VirtualDom$toHandlerInt(handler); | ||
2691 | |||
2692 | // 0 = Normal | ||
2693 | // 1 = MayStopPropagation | ||
2694 | // 2 = MayPreventDefault | ||
2695 | // 3 = Custom | ||
2696 | |||
2697 | return { | ||
2698 | $: handler.$, | ||
2699 | a: | ||
2700 | !tag | ||
2701 | ? A2($elm$json$Json$Decode$map, func, handler.a) | ||
2702 | : | ||
2703 | A3($elm$json$Json$Decode$map2, | ||
2704 | tag < 3 | ||
2705 | ? _VirtualDom_mapEventTuple | ||
2706 | : _VirtualDom_mapEventRecord, | ||
2707 | $elm$json$Json$Decode$succeed(func), | ||
2708 | handler.a | ||
2709 | ) | ||
2710 | }; | ||
2711 | } | ||
2712 | |||
2713 | var _VirtualDom_mapEventTuple = F2(function(func, tuple) | ||
2714 | { | ||
2715 | return _Utils_Tuple2(func(tuple.a), tuple.b); | ||
2716 | }); | ||
2717 | |||
2718 | var _VirtualDom_mapEventRecord = F2(function(func, record) | ||
2719 | { | ||
2720 | return { | ||
2721 | message: func(record.message), | ||
2722 | stopPropagation: record.stopPropagation, | ||
2723 | preventDefault: record.preventDefault | ||
2724 | } | ||
2725 | }); | ||
2726 | |||
2727 | |||
2728 | |||
2729 | // ORGANIZE FACTS | ||
2730 | |||
2731 | |||
2732 | function _VirtualDom_organizeFacts(factList) | ||
2733 | { | ||
2734 | for (var facts = {}; factList.b; factList = factList.b) // WHILE_CONS | ||
2735 | { | ||
2736 | var entry = factList.a; | ||
2737 | |||
2738 | var tag = entry.$; | ||
2739 | var key = entry.n; | ||
2740 | var value = entry.o; | ||
2741 | |||
2742 | if (tag === 'a2') | ||
2743 | { | ||
2744 | (key === 'className') | ||
2745 | ? _VirtualDom_addClass(facts, key, _Json_unwrap(value)) | ||
2746 | : facts[key] = _Json_unwrap(value); | ||
2747 | |||
2748 | continue; | ||
2749 | } | ||
2750 | |||
2751 | var subFacts = facts[tag] || (facts[tag] = {}); | ||
2752 | (tag === 'a3' && key === 'class') | ||
2753 | ? _VirtualDom_addClass(subFacts, key, value) | ||
2754 | : subFacts[key] = value; | ||
2755 | } | ||
2756 | |||
2757 | return facts; | ||
2758 | } | ||
2759 | |||
2760 | function _VirtualDom_addClass(object, key, newClass) | ||
2761 | { | ||
2762 | var classes = object[key]; | ||
2763 | object[key] = classes ? classes + ' ' + newClass : newClass; | ||
2764 | } | ||
2765 | |||
2766 | |||
2767 | |||
2768 | // RENDER | ||
2769 | |||
2770 | |||
2771 | function _VirtualDom_render(vNode, eventNode) | ||
2772 | { | ||
2773 | var tag = vNode.$; | ||
2774 | |||
2775 | if (tag === 5) | ||
2776 | { | ||
2777 | return _VirtualDom_render(vNode.k || (vNode.k = vNode.m()), eventNode); | ||
2778 | } | ||
2779 | |||
2780 | if (tag === 0) | ||
2781 | { | ||
2782 | return _VirtualDom_doc.createTextNode(vNode.a); | ||
2783 | } | ||
2784 | |||
2785 | if (tag === 4) | ||
2786 | { | ||
2787 | var subNode = vNode.k; | ||
2788 | var tagger = vNode.j; | ||
2789 | |||
2790 | while (subNode.$ === 4) | ||
2791 | { | ||
2792 | typeof tagger !== 'object' | ||
2793 | ? tagger = [tagger, subNode.j] | ||
2794 | : tagger.push(subNode.j); | ||
2795 | |||
2796 | subNode = subNode.k; | ||
2797 | } | ||
2798 | |||
2799 | var subEventRoot = { j: tagger, p: eventNode }; | ||
2800 | var domNode = _VirtualDom_render(subNode, subEventRoot); | ||
2801 | domNode.elm_event_node_ref = subEventRoot; | ||
2802 | return domNode; | ||
2803 | } | ||
2804 | |||
2805 | if (tag === 3) | ||
2806 | { | ||
2807 | var domNode = vNode.h(vNode.g); | ||
2808 | _VirtualDom_applyFacts(domNode, eventNode, vNode.d); | ||
2809 | return domNode; | ||
2810 | } | ||
2811 | |||
2812 | // at this point `tag` must be 1 or 2 | ||
2813 | |||
2814 | var domNode = vNode.f | ||
2815 | ? _VirtualDom_doc.createElementNS(vNode.f, vNode.c) | ||
2816 | : _VirtualDom_doc.createElement(vNode.c); | ||
2817 | |||
2818 | if (_VirtualDom_divertHrefToApp && vNode.c == 'a') | ||
2819 | { | ||
2820 | domNode.addEventListener('click', _VirtualDom_divertHrefToApp(domNode)); | ||
2821 | } | ||
2822 | |||
2823 | _VirtualDom_applyFacts(domNode, eventNode, vNode.d); | ||
2824 | |||
2825 | for (var kids = vNode.e, i = 0; i < kids.length; i++) | ||
2826 | { | ||
2827 | _VirtualDom_appendChild(domNode, _VirtualDom_render(tag === 1 ? kids[i] : kids[i].b, eventNode)); | ||
2828 | } | ||
2829 | |||
2830 | return domNode; | ||
2831 | } | ||
2832 | |||
2833 | |||
2834 | |||
2835 | // APPLY FACTS | ||
2836 | |||
2837 | |||
2838 | function _VirtualDom_applyFacts(domNode, eventNode, facts) | ||
2839 | { | ||
2840 | for (var key in facts) | ||
2841 | { | ||
2842 | var value = facts[key]; | ||
2843 | |||
2844 | key === 'a1' | ||
2845 | ? _VirtualDom_applyStyles(domNode, value) | ||
2846 | : | ||
2847 | key === 'a0' | ||
2848 | ? _VirtualDom_applyEvents(domNode, eventNode, value) | ||
2849 | : | ||
2850 | key === 'a3' | ||
2851 | ? _VirtualDom_applyAttrs(domNode, value) | ||
2852 | : | ||
2853 | key === 'a4' | ||
2854 | ? _VirtualDom_applyAttrsNS(domNode, value) | ||
2855 | : | ||
2856 | ((key !== 'value' && key !== 'checked') || domNode[key] !== value) && (domNode[key] = value); | ||
2857 | } | ||
2858 | } | ||
2859 | |||
2860 | |||
2861 | |||
2862 | // APPLY STYLES | ||
2863 | |||
2864 | |||
2865 | function _VirtualDom_applyStyles(domNode, styles) | ||
2866 | { | ||
2867 | var domNodeStyle = domNode.style; | ||
2868 | |||
2869 | for (var key in styles) | ||
2870 | { | ||
2871 | domNodeStyle[key] = styles[key]; | ||
2872 | } | ||
2873 | } | ||
2874 | |||
2875 | |||
2876 | |||
2877 | // APPLY ATTRS | ||
2878 | |||
2879 | |||
2880 | function _VirtualDom_applyAttrs(domNode, attrs) | ||
2881 | { | ||
2882 | for (var key in attrs) | ||
2883 | { | ||
2884 | var value = attrs[key]; | ||
2885 | typeof value !== 'undefined' | ||
2886 | ? domNode.setAttribute(key, value) | ||
2887 | : domNode.removeAttribute(key); | ||
2888 | } | ||
2889 | } | ||
2890 | |||
2891 | |||
2892 | |||
2893 | // APPLY NAMESPACED ATTRS | ||
2894 | |||
2895 | |||
2896 | function _VirtualDom_applyAttrsNS(domNode, nsAttrs) | ||
2897 | { | ||
2898 | for (var key in nsAttrs) | ||
2899 | { | ||
2900 | var pair = nsAttrs[key]; | ||
2901 | var namespace = pair.f; | ||
2902 | var value = pair.o; | ||
2903 | |||
2904 | typeof value !== 'undefined' | ||
2905 | ? domNode.setAttributeNS(namespace, key, value) | ||
2906 | : domNode.removeAttributeNS(namespace, key); | ||
2907 | } | ||
2908 | } | ||
2909 | |||
2910 | |||
2911 | |||
2912 | // APPLY EVENTS | ||
2913 | |||
2914 | |||
2915 | function _VirtualDom_applyEvents(domNode, eventNode, events) | ||
2916 | { | ||
2917 | var allCallbacks = domNode.elmFs || (domNode.elmFs = {}); | ||
2918 | |||
2919 | for (var key in events) | ||
2920 | { | ||
2921 | var newHandler = events[key]; | ||
2922 | var oldCallback = allCallbacks[key]; | ||
2923 | |||
2924 | if (!newHandler) | ||
2925 | { | ||
2926 | domNode.removeEventListener(key, oldCallback); | ||
2927 | allCallbacks[key] = undefined; | ||
2928 | continue; | ||
2929 | } | ||
2930 | |||
2931 | if (oldCallback) | ||
2932 | { | ||
2933 | var oldHandler = oldCallback.q; | ||
2934 | if (oldHandler.$ === newHandler.$) | ||
2935 | { | ||
2936 | oldCallback.q = newHandler; | ||
2937 | continue; | ||
2938 | } | ||
2939 | domNode.removeEventListener(key, oldCallback); | ||
2940 | } | ||
2941 | |||
2942 | oldCallback = _VirtualDom_makeCallback(eventNode, newHandler); | ||
2943 | domNode.addEventListener(key, oldCallback, | ||
2944 | _VirtualDom_passiveSupported | ||
2945 | && { passive: $elm$virtual_dom$VirtualDom$toHandlerInt(newHandler) < 2 } | ||
2946 | ); | ||
2947 | allCallbacks[key] = oldCallback; | ||
2948 | } | ||
2949 | } | ||
2950 | |||
2951 | |||
2952 | |||
2953 | // PASSIVE EVENTS | ||
2954 | |||
2955 | |||
2956 | var _VirtualDom_passiveSupported; | ||
2957 | |||
2958 | try | ||
2959 | { | ||
2960 | window.addEventListener('t', null, Object.defineProperty({}, 'passive', { | ||
2961 | get: function() { _VirtualDom_passiveSupported = true; } | ||
2962 | })); | ||
2963 | } | ||
2964 | catch(e) {} | ||
2965 | |||
2966 | |||
2967 | |||
2968 | // EVENT HANDLERS | ||
2969 | |||
2970 | |||
2971 | function _VirtualDom_makeCallback(eventNode, initialHandler) | ||
2972 | { | ||
2973 | function callback(event) | ||
2974 | { | ||
2975 | var handler = callback.q; | ||
2976 | var result = _Json_runHelp(handler.a, event); | ||
2977 | |||
2978 | if (!$elm$core$Result$isOk(result)) | ||
2979 | { | ||
2980 | return; | ||
2981 | } | ||
2982 | |||
2983 | var tag = $elm$virtual_dom$VirtualDom$toHandlerInt(handler); | ||
2984 | |||
2985 | // 0 = Normal | ||
2986 | // 1 = MayStopPropagation | ||
2987 | // 2 = MayPreventDefault | ||
2988 | // 3 = Custom | ||
2989 | |||
2990 | var value = result.a; | ||
2991 | var message = !tag ? value : tag < 3 ? value.a : value.message; | ||
2992 | var stopPropagation = tag == 1 ? value.b : tag == 3 && value.stopPropagation; | ||
2993 | var currentEventNode = ( | ||
2994 | stopPropagation && event.stopPropagation(), | ||
2995 | (tag == 2 ? value.b : tag == 3 && value.preventDefault) && event.preventDefault(), | ||
2996 | eventNode | ||
2997 | ); | ||
2998 | var tagger; | ||
2999 | var i; | ||
3000 | while (tagger = currentEventNode.j) | ||
3001 | { | ||
3002 | if (typeof tagger == 'function') | ||
3003 | { | ||
3004 | message = tagger(message); | ||
3005 | } | ||
3006 | else | ||
3007 | { | ||
3008 | for (var i = tagger.length; i--; ) | ||
3009 | { | ||
3010 | message = tagger[i](message); | ||
3011 | } | ||
3012 | } | ||
3013 | currentEventNode = currentEventNode.p; | ||
3014 | } | ||
3015 | currentEventNode(message, stopPropagation); // stopPropagation implies isSync | ||
3016 | } | ||
3017 | |||
3018 | callback.q = initialHandler; | ||
3019 | |||
3020 | return callback; | ||
3021 | } | ||
3022 | |||
3023 | function _VirtualDom_equalEvents(x, y) | ||
3024 | { | ||
3025 | return x.$ == y.$ && _Json_equality(x.a, y.a); | ||
3026 | } | ||
3027 | |||
3028 | |||
3029 | |||
3030 | // DIFF | ||
3031 | |||
3032 | |||
3033 | // TODO: Should we do patches like in iOS? | ||
3034 | // | ||
3035 | // type Patch | ||
3036 | // = At Int Patch | ||
3037 | // | Batch (List Patch) | ||
3038 | // | Change ... | ||
3039 | // | ||
3040 | // How could it not be better? | ||
3041 | // | ||
3042 | function _VirtualDom_diff(x, y) | ||
3043 | { | ||
3044 | var patches = []; | ||
3045 | _VirtualDom_diffHelp(x, y, patches, 0); | ||
3046 | return patches; | ||
3047 | } | ||
3048 | |||
3049 | |||
3050 | function _VirtualDom_pushPatch(patches, type, index, data) | ||
3051 | { | ||
3052 | var patch = { | ||
3053 | $: type, | ||
3054 | r: index, | ||
3055 | s: data, | ||
3056 | t: undefined, | ||
3057 | u: undefined | ||
3058 | }; | ||
3059 | patches.push(patch); | ||
3060 | return patch; | ||
3061 | } | ||
3062 | |||
3063 | |||
3064 | function _VirtualDom_diffHelp(x, y, patches, index) | ||
3065 | { | ||
3066 | if (x === y) | ||
3067 | { | ||
3068 | return; | ||
3069 | } | ||
3070 | |||
3071 | var xType = x.$; | ||
3072 | var yType = y.$; | ||
3073 | |||
3074 | // Bail if you run into different types of nodes. Implies that the | ||
3075 | // structure has changed significantly and it's not worth a diff. | ||
3076 | if (xType !== yType) | ||
3077 | { | ||
3078 | if (xType === 1 && yType === 2) | ||
3079 | { | ||
3080 | y = _VirtualDom_dekey(y); | ||
3081 | yType = 1; | ||
3082 | } | ||
3083 | else | ||
3084 | { | ||
3085 | _VirtualDom_pushPatch(patches, 0, index, y); | ||
3086 | return; | ||
3087 | } | ||
3088 | } | ||
3089 | |||
3090 | // Now we know that both nodes are the same $. | ||
3091 | switch (yType) | ||
3092 | { | ||
3093 | case 5: | ||
3094 | var xRefs = x.l; | ||
3095 | var yRefs = y.l; | ||
3096 | var i = xRefs.length; | ||
3097 | var same = i === yRefs.length; | ||
3098 | while (same && i--) | ||
3099 | { | ||
3100 | same = xRefs[i] === yRefs[i]; | ||
3101 | } | ||
3102 | if (same) | ||
3103 | { | ||
3104 | y.k = x.k; | ||
3105 | return; | ||
3106 | } | ||
3107 | y.k = y.m(); | ||
3108 | var subPatches = []; | ||
3109 | _VirtualDom_diffHelp(x.k, y.k, subPatches, 0); | ||
3110 | subPatches.length > 0 && _VirtualDom_pushPatch(patches, 1, index, subPatches); | ||
3111 | return; | ||
3112 | |||
3113 | case 4: | ||
3114 | // gather nested taggers | ||
3115 | var xTaggers = x.j; | ||
3116 | var yTaggers = y.j; | ||
3117 | var nesting = false; | ||
3118 | |||
3119 | var xSubNode = x.k; | ||
3120 | while (xSubNode.$ === 4) | ||
3121 | { | ||
3122 | nesting = true; | ||
3123 | |||
3124 | typeof xTaggers !== 'object' | ||
3125 | ? xTaggers = [xTaggers, xSubNode.j] | ||
3126 | : xTaggers.push(xSubNode.j); | ||
3127 | |||
3128 | xSubNode = xSubNode.k; | ||
3129 | } | ||
3130 | |||
3131 | var ySubNode = y.k; | ||
3132 | while (ySubNode.$ === 4) | ||
3133 | { | ||
3134 | nesting = true; | ||
3135 | |||
3136 | typeof yTaggers !== 'object' | ||
3137 | ? yTaggers = [yTaggers, ySubNode.j] | ||
3138 | : yTaggers.push(ySubNode.j); | ||
3139 | |||
3140 | ySubNode = ySubNode.k; | ||
3141 | } | ||
3142 | |||
3143 | // Just bail if different numbers of taggers. This implies the | ||
3144 | // structure of the virtual DOM has changed. | ||
3145 | if (nesting && xTaggers.length !== yTaggers.length) | ||
3146 | { | ||
3147 | _VirtualDom_pushPatch(patches, 0, index, y); | ||
3148 | return; | ||
3149 | } | ||
3150 | |||
3151 | // check if taggers are "the same" | ||
3152 | if (nesting ? !_VirtualDom_pairwiseRefEqual(xTaggers, yTaggers) : xTaggers !== yTaggers) | ||
3153 | { | ||
3154 | _VirtualDom_pushPatch(patches, 2, index, yTaggers); | ||
3155 | } | ||
3156 | |||
3157 | // diff everything below the taggers | ||
3158 | _VirtualDom_diffHelp(xSubNode, ySubNode, patches, index + 1); | ||
3159 | return; | ||
3160 | |||
3161 | case 0: | ||
3162 | if (x.a !== y.a) | ||
3163 | { | ||
3164 | _VirtualDom_pushPatch(patches, 3, index, y.a); | ||
3165 | } | ||
3166 | return; | ||
3167 | |||
3168 | case 1: | ||
3169 | _VirtualDom_diffNodes(x, y, patches, index, _VirtualDom_diffKids); | ||
3170 | return; | ||
3171 | |||
3172 | case 2: | ||
3173 | _VirtualDom_diffNodes(x, y, patches, index, _VirtualDom_diffKeyedKids); | ||
3174 | return; | ||
3175 | |||
3176 | case 3: | ||
3177 | if (x.h !== y.h) | ||
3178 | { | ||
3179 | _VirtualDom_pushPatch(patches, 0, index, y); | ||
3180 | return; | ||
3181 | } | ||
3182 | |||
3183 | var factsDiff = _VirtualDom_diffFacts(x.d, y.d); | ||
3184 | factsDiff && _VirtualDom_pushPatch(patches, 4, index, factsDiff); | ||
3185 | |||
3186 | var patch = y.i(x.g, y.g); | ||
3187 | patch && _VirtualDom_pushPatch(patches, 5, index, patch); | ||
3188 | |||
3189 | return; | ||
3190 | } | ||
3191 | } | ||
3192 | |||
3193 | // assumes the incoming arrays are the same length | ||
3194 | function _VirtualDom_pairwiseRefEqual(as, bs) | ||
3195 | { | ||
3196 | for (var i = 0; i < as.length; i++) | ||
3197 | { | ||
3198 | if (as[i] !== bs[i]) | ||
3199 | { | ||
3200 | return false; | ||
3201 | } | ||
3202 | } | ||
3203 | |||
3204 | return true; | ||
3205 | } | ||
3206 | |||
3207 | function _VirtualDom_diffNodes(x, y, patches, index, diffKids) | ||
3208 | { | ||
3209 | // Bail if obvious indicators have changed. Implies more serious | ||
3210 | // structural changes such that it's not worth it to diff. | ||
3211 | if (x.c !== y.c || x.f !== y.f) | ||
3212 | { | ||
3213 | _VirtualDom_pushPatch(patches, 0, index, y); | ||
3214 | return; | ||
3215 | } | ||
3216 | |||
3217 | var factsDiff = _VirtualDom_diffFacts(x.d, y.d); | ||
3218 | factsDiff && _VirtualDom_pushPatch(patches, 4, index, factsDiff); | ||
3219 | |||
3220 | diffKids(x, y, patches, index); | ||
3221 | } | ||
3222 | |||
3223 | |||
3224 | |||
3225 | // DIFF FACTS | ||
3226 | |||
3227 | |||
3228 | // TODO Instead of creating a new diff object, it's possible to just test if | ||
3229 | // there *is* a diff. During the actual patch, do the diff again and make the | ||
3230 | // modifications directly. This way, there's no new allocations. Worth it? | ||
3231 | function _VirtualDom_diffFacts(x, y, category) | ||
3232 | { | ||
3233 | var diff; | ||
3234 | |||
3235 | // look for changes and removals | ||
3236 | for (var xKey in x) | ||
3237 | { | ||
3238 | if (xKey === 'a1' || xKey === 'a0' || xKey === 'a3' || xKey === 'a4') | ||
3239 | { | ||
3240 | var subDiff = _VirtualDom_diffFacts(x[xKey], y[xKey] || {}, xKey); | ||
3241 | if (subDiff) | ||
3242 | { | ||
3243 | diff = diff || {}; | ||
3244 | diff[xKey] = subDiff; | ||
3245 | } | ||
3246 | continue; | ||
3247 | } | ||
3248 | |||
3249 | // remove if not in the new facts | ||
3250 | if (!(xKey in y)) | ||
3251 | { | ||
3252 | diff = diff || {}; | ||
3253 | diff[xKey] = | ||
3254 | !category | ||
3255 | ? (typeof x[xKey] === 'string' ? '' : null) | ||
3256 | : | ||
3257 | (category === 'a1') | ||
3258 | ? '' | ||
3259 | : | ||
3260 | (category === 'a0' || category === 'a3') | ||
3261 | ? undefined | ||
3262 | : | ||
3263 | { f: x[xKey].f, o: undefined }; | ||
3264 | |||
3265 | continue; | ||
3266 | } | ||
3267 | |||
3268 | var xValue = x[xKey]; | ||
3269 | var yValue = y[xKey]; | ||
3270 | |||
3271 | // reference equal, so don't worry about it | ||
3272 | if (xValue === yValue && xKey !== 'value' && xKey !== 'checked' | ||
3273 | || category === 'a0' && _VirtualDom_equalEvents(xValue, yValue)) | ||
3274 | { | ||
3275 | continue; | ||
3276 | } | ||
3277 | |||
3278 | diff = diff || {}; | ||
3279 | diff[xKey] = yValue; | ||
3280 | } | ||
3281 | |||
3282 | // add new stuff | ||
3283 | for (var yKey in y) | ||
3284 | { | ||
3285 | if (!(yKey in x)) | ||
3286 | { | ||
3287 | diff = diff || {}; | ||
3288 | diff[yKey] = y[yKey]; | ||
3289 | } | ||
3290 | } | ||
3291 | |||
3292 | return diff; | ||
3293 | } | ||
3294 | |||
3295 | |||
3296 | |||
3297 | // DIFF KIDS | ||
3298 | |||
3299 | |||
3300 | function _VirtualDom_diffKids(xParent, yParent, patches, index) | ||
3301 | { | ||
3302 | var xKids = xParent.e; | ||
3303 | var yKids = yParent.e; | ||
3304 | |||
3305 | var xLen = xKids.length; | ||
3306 | var yLen = yKids.length; | ||
3307 | |||
3308 | // FIGURE OUT IF THERE ARE INSERTS OR REMOVALS | ||
3309 | |||
3310 | if (xLen > yLen) | ||
3311 | { | ||
3312 | _VirtualDom_pushPatch(patches, 6, index, { | ||
3313 | v: yLen, | ||
3314 | i: xLen - yLen | ||
3315 | }); | ||
3316 | } | ||
3317 | else if (xLen < yLen) | ||
3318 | { | ||
3319 | _VirtualDom_pushPatch(patches, 7, index, { | ||
3320 | v: xLen, | ||
3321 | e: yKids | ||
3322 | }); | ||
3323 | } | ||
3324 | |||
3325 | // PAIRWISE DIFF EVERYTHING ELSE | ||
3326 | |||
3327 | for (var minLen = xLen < yLen ? xLen : yLen, i = 0; i < minLen; i++) | ||
3328 | { | ||
3329 | var xKid = xKids[i]; | ||
3330 | _VirtualDom_diffHelp(xKid, yKids[i], patches, ++index); | ||
3331 | index += xKid.b || 0; | ||
3332 | } | ||
3333 | } | ||
3334 | |||
3335 | |||
3336 | |||
3337 | // KEYED DIFF | ||
3338 | |||
3339 | |||
3340 | function _VirtualDom_diffKeyedKids(xParent, yParent, patches, rootIndex) | ||
3341 | { | ||
3342 | var localPatches = []; | ||
3343 | |||
3344 | var changes = {}; // Dict String Entry | ||
3345 | var inserts = []; // Array { index : Int, entry : Entry } | ||
3346 | // type Entry = { tag : String, vnode : VNode, index : Int, data : _ } | ||
3347 | |||
3348 | var xKids = xParent.e; | ||
3349 | var yKids = yParent.e; | ||
3350 | var xLen = xKids.length; | ||
3351 | var yLen = yKids.length; | ||
3352 | var xIndex = 0; | ||
3353 | var yIndex = 0; | ||
3354 | |||
3355 | var index = rootIndex; | ||
3356 | |||
3357 | while (xIndex < xLen && yIndex < yLen) | ||
3358 | { | ||
3359 | var x = xKids[xIndex]; | ||
3360 | var y = yKids[yIndex]; | ||
3361 | |||
3362 | var xKey = x.a; | ||
3363 | var yKey = y.a; | ||
3364 | var xNode = x.b; | ||
3365 | var yNode = y.b; | ||
3366 | |||
3367 | var newMatch = undefined; | ||
3368 | var oldMatch = undefined; | ||
3369 | |||
3370 | // check if keys match | ||
3371 | |||
3372 | if (xKey === yKey) | ||
3373 | { | ||
3374 | index++; | ||
3375 | _VirtualDom_diffHelp(xNode, yNode, localPatches, index); | ||
3376 | index += xNode.b || 0; | ||
3377 | |||
3378 | xIndex++; | ||
3379 | yIndex++; | ||
3380 | continue; | ||
3381 | } | ||
3382 | |||
3383 | // look ahead 1 to detect insertions and removals. | ||
3384 | |||
3385 | var xNext = xKids[xIndex + 1]; | ||
3386 | var yNext = yKids[yIndex + 1]; | ||
3387 | |||
3388 | if (xNext) | ||
3389 | { | ||
3390 | var xNextKey = xNext.a; | ||
3391 | var xNextNode = xNext.b; | ||
3392 | oldMatch = yKey === xNextKey; | ||
3393 | } | ||
3394 | |||
3395 | if (yNext) | ||
3396 | { | ||
3397 | var yNextKey = yNext.a; | ||
3398 | var yNextNode = yNext.b; | ||
3399 | newMatch = xKey === yNextKey; | ||
3400 | } | ||
3401 | |||
3402 | |||
3403 | // swap x and y | ||
3404 | if (newMatch && oldMatch) | ||
3405 | { | ||
3406 | index++; | ||
3407 | _VirtualDom_diffHelp(xNode, yNextNode, localPatches, index); | ||
3408 | _VirtualDom_insertNode(changes, localPatches, xKey, yNode, yIndex, inserts); | ||
3409 | index += xNode.b || 0; | ||
3410 | |||
3411 | index++; | ||
3412 | _VirtualDom_removeNode(changes, localPatches, xKey, xNextNode, index); | ||
3413 | index += xNextNode.b || 0; | ||
3414 | |||
3415 | xIndex += 2; | ||
3416 | yIndex += 2; | ||
3417 | continue; | ||
3418 | } | ||
3419 | |||
3420 | // insert y | ||
3421 | if (newMatch) | ||
3422 | { | ||
3423 | index++; | ||
3424 | _VirtualDom_insertNode(changes, localPatches, yKey, yNode, yIndex, inserts); | ||
3425 | _VirtualDom_diffHelp(xNode, yNextNode, localPatches, index); | ||
3426 | index += xNode.b || 0; | ||
3427 | |||
3428 | xIndex += 1; | ||
3429 | yIndex += 2; | ||
3430 | continue; | ||
3431 | } | ||
3432 | |||
3433 | // remove x | ||
3434 | if (oldMatch) | ||
3435 | { | ||
3436 | index++; | ||
3437 | _VirtualDom_removeNode(changes, localPatches, xKey, xNode, index); | ||
3438 | index += xNode.b || 0; | ||
3439 | |||
3440 | index++; | ||
3441 | _VirtualDom_diffHelp(xNextNode, yNode, localPatches, index); | ||
3442 | index += xNextNode.b || 0; | ||
3443 | |||
3444 | xIndex += 2; | ||
3445 | yIndex += 1; | ||
3446 | continue; | ||
3447 | } | ||
3448 | |||
3449 | // remove x, insert y | ||
3450 | if (xNext && xNextKey === yNextKey) | ||
3451 | { | ||
3452 | index++; | ||
3453 | _VirtualDom_removeNode(changes, localPatches, xKey, xNode, index); | ||
3454 | _VirtualDom_insertNode(changes, localPatches, yKey, yNode, yIndex, inserts); | ||
3455 | index += xNode.b || 0; | ||
3456 | |||
3457 | index++; | ||
3458 | _VirtualDom_diffHelp(xNextNode, yNextNode, localPatches, index); | ||
3459 | index += xNextNode.b || 0; | ||
3460 | |||
3461 | xIndex += 2; | ||
3462 | yIndex += 2; | ||
3463 | continue; | ||
3464 | } | ||
3465 | |||
3466 | break; | ||
3467 | } | ||
3468 | |||
3469 | // eat up any remaining nodes with removeNode and insertNode | ||
3470 | |||
3471 | while (xIndex < xLen) | ||
3472 | { | ||
3473 | index++; | ||
3474 | var x = xKids[xIndex]; | ||
3475 | var xNode = x.b; | ||
3476 | _VirtualDom_removeNode(changes, localPatches, x.a, xNode, index); | ||
3477 | index += xNode.b || 0; | ||
3478 | xIndex++; | ||
3479 | } | ||
3480 | |||
3481 | while (yIndex < yLen) | ||
3482 | { | ||
3483 | var endInserts = endInserts || []; | ||
3484 | var y = yKids[yIndex]; | ||
3485 | _VirtualDom_insertNode(changes, localPatches, y.a, y.b, undefined, endInserts); | ||
3486 | yIndex++; | ||
3487 | } | ||
3488 | |||
3489 | if (localPatches.length > 0 || inserts.length > 0 || endInserts) | ||
3490 | { | ||
3491 | _VirtualDom_pushPatch(patches, 8, rootIndex, { | ||
3492 | w: localPatches, | ||
3493 | x: inserts, | ||
3494 | y: endInserts | ||
3495 | }); | ||
3496 | } | ||
3497 | } | ||
3498 | |||
3499 | |||
3500 | |||
3501 | // CHANGES FROM KEYED DIFF | ||
3502 | |||
3503 | |||
3504 | var _VirtualDom_POSTFIX = '_elmW6BL'; | ||
3505 | |||
3506 | |||
3507 | function _VirtualDom_insertNode(changes, localPatches, key, vnode, yIndex, inserts) | ||
3508 | { | ||
3509 | var entry = changes[key]; | ||
3510 | |||
3511 | // never seen this key before | ||
3512 | if (!entry) | ||
3513 | { | ||
3514 | entry = { | ||
3515 | c: 0, | ||
3516 | z: vnode, | ||
3517 | r: yIndex, | ||
3518 | s: undefined | ||
3519 | }; | ||
3520 | |||
3521 | inserts.push({ r: yIndex, A: entry }); | ||
3522 | changes[key] = entry; | ||
3523 | |||
3524 | return; | ||
3525 | } | ||
3526 | |||
3527 | // this key was removed earlier, a match! | ||
3528 | if (entry.c === 1) | ||
3529 | { | ||
3530 | inserts.push({ r: yIndex, A: entry }); | ||
3531 | |||
3532 | entry.c = 2; | ||
3533 | var subPatches = []; | ||
3534 | _VirtualDom_diffHelp(entry.z, vnode, subPatches, entry.r); | ||
3535 | entry.r = yIndex; | ||
3536 | entry.s.s = { | ||
3537 | w: subPatches, | ||
3538 | A: entry | ||
3539 | }; | ||
3540 | |||
3541 | return; | ||
3542 | } | ||
3543 | |||
3544 | // this key has already been inserted or moved, a duplicate! | ||
3545 | _VirtualDom_insertNode(changes, localPatches, key + _VirtualDom_POSTFIX, vnode, yIndex, inserts); | ||
3546 | } | ||
3547 | |||
3548 | |||
3549 | function _VirtualDom_removeNode(changes, localPatches, key, vnode, index) | ||
3550 | { | ||
3551 | var entry = changes[key]; | ||
3552 | |||
3553 | // never seen this key before | ||
3554 | if (!entry) | ||
3555 | { | ||
3556 | var patch = _VirtualDom_pushPatch(localPatches, 9, index, undefined); | ||
3557 | |||
3558 | changes[key] = { | ||
3559 | c: 1, | ||
3560 | z: vnode, | ||
3561 | r: index, | ||
3562 | s: patch | ||
3563 | }; | ||
3564 | |||
3565 | return; | ||
3566 | } | ||
3567 | |||
3568 | // this key was inserted earlier, a match! | ||
3569 | if (entry.c === 0) | ||
3570 | { | ||
3571 | entry.c = 2; | ||
3572 | var subPatches = []; | ||
3573 | _VirtualDom_diffHelp(vnode, entry.z, subPatches, index); | ||
3574 | |||
3575 | _VirtualDom_pushPatch(localPatches, 9, index, { | ||
3576 | w: subPatches, | ||
3577 | A: entry | ||
3578 | }); | ||
3579 | |||
3580 | return; | ||
3581 | } | ||
3582 | |||
3583 | // this key has already been removed or moved, a duplicate! | ||
3584 | _VirtualDom_removeNode(changes, localPatches, key + _VirtualDom_POSTFIX, vnode, index); | ||
3585 | } | ||
3586 | |||
3587 | |||
3588 | |||
3589 | // ADD DOM NODES | ||
3590 | // | ||
3591 | // Each DOM node has an "index" assigned in order of traversal. It is important | ||
3592 | // to minimize our crawl over the actual DOM, so these indexes (along with the | ||
3593 | // descendantsCount of virtual nodes) let us skip touching entire subtrees of | ||
3594 | // the DOM if we know there are no patches there. | ||
3595 | |||
3596 | |||
3597 | function _VirtualDom_addDomNodes(domNode, vNode, patches, eventNode) | ||
3598 | { | ||
3599 | _VirtualDom_addDomNodesHelp(domNode, vNode, patches, 0, 0, vNode.b, eventNode); | ||
3600 | } | ||
3601 | |||
3602 | |||
3603 | // assumes `patches` is non-empty and indexes increase monotonically. | ||
3604 | function _VirtualDom_addDomNodesHelp(domNode, vNode, patches, i, low, high, eventNode) | ||
3605 | { | ||
3606 | var patch = patches[i]; | ||
3607 | var index = patch.r; | ||
3608 | |||
3609 | while (index === low) | ||
3610 | { | ||
3611 | var patchType = patch.$; | ||
3612 | |||
3613 | if (patchType === 1) | ||
3614 | { | ||
3615 | _VirtualDom_addDomNodes(domNode, vNode.k, patch.s, eventNode); | ||
3616 | } | ||
3617 | else if (patchType === 8) | ||
3618 | { | ||
3619 | patch.t = domNode; | ||
3620 | patch.u = eventNode; | ||
3621 | |||
3622 | var subPatches = patch.s.w; | ||
3623 | if (subPatches.length > 0) | ||
3624 | { | ||
3625 | _VirtualDom_addDomNodesHelp(domNode, vNode, subPatches, 0, low, high, eventNode); | ||
3626 | } | ||
3627 | } | ||
3628 | else if (patchType === 9) | ||
3629 | { | ||
3630 | patch.t = domNode; | ||
3631 | patch.u = eventNode; | ||
3632 | |||
3633 | var data = patch.s; | ||
3634 | if (data) | ||
3635 | { | ||
3636 | data.A.s = domNode; | ||
3637 | var subPatches = data.w; | ||
3638 | if (subPatches.length > 0) | ||
3639 | { | ||
3640 | _VirtualDom_addDomNodesHelp(domNode, vNode, subPatches, 0, low, high, eventNode); | ||
3641 | } | ||
3642 | } | ||
3643 | } | ||
3644 | else | ||
3645 | { | ||
3646 | patch.t = domNode; | ||
3647 | patch.u = eventNode; | ||
3648 | } | ||
3649 | |||
3650 | i++; | ||
3651 | |||
3652 | if (!(patch = patches[i]) || (index = patch.r) > high) | ||
3653 | { | ||
3654 | return i; | ||
3655 | } | ||
3656 | } | ||
3657 | |||
3658 | var tag = vNode.$; | ||
3659 | |||
3660 | if (tag === 4) | ||
3661 | { | ||
3662 | var subNode = vNode.k; | ||
3663 | |||
3664 | while (subNode.$ === 4) | ||
3665 | { | ||
3666 | subNode = subNode.k; | ||
3667 | } | ||
3668 | |||
3669 | return _VirtualDom_addDomNodesHelp(domNode, subNode, patches, i, low + 1, high, domNode.elm_event_node_ref); | ||
3670 | } | ||
3671 | |||
3672 | // tag must be 1 or 2 at this point | ||
3673 | |||
3674 | var vKids = vNode.e; | ||
3675 | var childNodes = domNode.childNodes; | ||
3676 | for (var j = 0; j < vKids.length; j++) | ||
3677 | { | ||
3678 | low++; | ||
3679 | var vKid = tag === 1 ? vKids[j] : vKids[j].b; | ||
3680 | var nextLow = low + (vKid.b || 0); | ||
3681 | if (low <= index && index <= nextLow) | ||
3682 | { | ||
3683 | i = _VirtualDom_addDomNodesHelp(childNodes[j], vKid, patches, i, low, nextLow, eventNode); | ||
3684 | if (!(patch = patches[i]) || (index = patch.r) > high) | ||
3685 | { | ||
3686 | return i; | ||
3687 | } | ||
3688 | } | ||
3689 | low = nextLow; | ||
3690 | } | ||
3691 | return i; | ||
3692 | } | ||
3693 | |||
3694 | |||
3695 | |||
3696 | // APPLY PATCHES | ||
3697 | |||
3698 | |||
3699 | function _VirtualDom_applyPatches(rootDomNode, oldVirtualNode, patches, eventNode) | ||
3700 | { | ||
3701 | if (patches.length === 0) | ||
3702 | { | ||
3703 | return rootDomNode; | ||
3704 | } | ||
3705 | |||
3706 | _VirtualDom_addDomNodes(rootDomNode, oldVirtualNode, patches, eventNode); | ||
3707 | return _VirtualDom_applyPatchesHelp(rootDomNode, patches); | ||
3708 | } | ||
3709 | |||
3710 | function _VirtualDom_applyPatchesHelp(rootDomNode, patches) | ||
3711 | { | ||
3712 | for (var i = 0; i < patches.length; i++) | ||
3713 | { | ||
3714 | var patch = patches[i]; | ||
3715 | var localDomNode = patch.t | ||
3716 | var newNode = _VirtualDom_applyPatch(localDomNode, patch); | ||
3717 | if (localDomNode === rootDomNode) | ||
3718 | { | ||
3719 | rootDomNode = newNode; | ||
3720 | } | ||
3721 | } | ||
3722 | return rootDomNode; | ||
3723 | } | ||
3724 | |||
3725 | function _VirtualDom_applyPatch(domNode, patch) | ||
3726 | { | ||
3727 | switch (patch.$) | ||
3728 | { | ||
3729 | case 0: | ||
3730 | return _VirtualDom_applyPatchRedraw(domNode, patch.s, patch.u); | ||
3731 | |||
3732 | case 4: | ||
3733 | _VirtualDom_applyFacts(domNode, patch.u, patch.s); | ||
3734 | return domNode; | ||
3735 | |||
3736 | case 3: | ||
3737 | domNode.replaceData(0, domNode.length, patch.s); | ||
3738 | return domNode; | ||
3739 | |||
3740 | case 1: | ||
3741 | return _VirtualDom_applyPatchesHelp(domNode, patch.s); | ||
3742 | |||
3743 | case 2: | ||
3744 | if (domNode.elm_event_node_ref) | ||
3745 | { | ||
3746 | domNode.elm_event_node_ref.j = patch.s; | ||
3747 | } | ||
3748 | else | ||
3749 | { | ||
3750 | domNode.elm_event_node_ref = { j: patch.s, p: patch.u }; | ||
3751 | } | ||
3752 | return domNode; | ||
3753 | |||
3754 | case 6: | ||
3755 | var data = patch.s; | ||
3756 | for (var i = 0; i < data.i; i++) | ||
3757 | { | ||
3758 | domNode.removeChild(domNode.childNodes[data.v]); | ||
3759 | } | ||
3760 | return domNode; | ||
3761 | |||
3762 | case 7: | ||
3763 | var data = patch.s; | ||
3764 | var kids = data.e; | ||
3765 | var i = data.v; | ||
3766 | var theEnd = domNode.childNodes[i]; | ||
3767 | for (; i < kids.length; i++) | ||
3768 | { | ||
3769 | domNode.insertBefore(_VirtualDom_render(kids[i], patch.u), theEnd); | ||
3770 | } | ||
3771 | return domNode; | ||
3772 | |||
3773 | case 9: | ||
3774 | var data = patch.s; | ||
3775 | if (!data) | ||
3776 | { | ||
3777 | domNode.parentNode.removeChild(domNode); | ||
3778 | return domNode; | ||
3779 | } | ||
3780 | var entry = data.A; | ||
3781 | if (typeof entry.r !== 'undefined') | ||
3782 | { | ||
3783 | domNode.parentNode.removeChild(domNode); | ||
3784 | } | ||
3785 | entry.s = _VirtualDom_applyPatchesHelp(domNode, data.w); | ||
3786 | return domNode; | ||
3787 | |||
3788 | case 8: | ||
3789 | return _VirtualDom_applyPatchReorder(domNode, patch); | ||
3790 | |||
3791 | case 5: | ||
3792 | return patch.s(domNode); | ||
3793 | |||
3794 | default: | ||
3795 | _Debug_crash(10); // 'Ran into an unknown patch!' | ||
3796 | } | ||
3797 | } | ||
3798 | |||
3799 | |||
3800 | function _VirtualDom_applyPatchRedraw(domNode, vNode, eventNode) | ||
3801 | { | ||
3802 | var parentNode = domNode.parentNode; | ||
3803 | var newNode = _VirtualDom_render(vNode, eventNode); | ||
3804 | |||
3805 | if (!newNode.elm_event_node_ref) | ||
3806 | { | ||
3807 | newNode.elm_event_node_ref = domNode.elm_event_node_ref; | ||
3808 | } | ||
3809 | |||
3810 | if (parentNode && newNode !== domNode) | ||
3811 | { | ||
3812 | parentNode.replaceChild(newNode, domNode); | ||
3813 | } | ||
3814 | return newNode; | ||
3815 | } | ||
3816 | |||
3817 | |||
3818 | function _VirtualDom_applyPatchReorder(domNode, patch) | ||
3819 | { | ||
3820 | var data = patch.s; | ||
3821 | |||
3822 | // remove end inserts | ||
3823 | var frag = _VirtualDom_applyPatchReorderEndInsertsHelp(data.y, patch); | ||
3824 | |||
3825 | // removals | ||
3826 | domNode = _VirtualDom_applyPatchesHelp(domNode, data.w); | ||
3827 | |||
3828 | // inserts | ||
3829 | var inserts = data.x; | ||
3830 | for (var i = 0; i < inserts.length; i++) | ||
3831 | { | ||
3832 | var insert = inserts[i]; | ||
3833 | var entry = insert.A; | ||
3834 | var node = entry.c === 2 | ||
3835 | ? entry.s | ||
3836 | : _VirtualDom_render(entry.z, patch.u); | ||
3837 | domNode.insertBefore(node, domNode.childNodes[insert.r]); | ||
3838 | } | ||
3839 | |||
3840 | // add end inserts | ||
3841 | if (frag) | ||
3842 | { | ||
3843 | _VirtualDom_appendChild(domNode, frag); | ||
3844 | } | ||
3845 | |||
3846 | return domNode; | ||
3847 | } | ||
3848 | |||
3849 | |||
3850 | function _VirtualDom_applyPatchReorderEndInsertsHelp(endInserts, patch) | ||
3851 | { | ||
3852 | if (!endInserts) | ||
3853 | { | ||
3854 | return; | ||
3855 | } | ||
3856 | |||
3857 | var frag = _VirtualDom_doc.createDocumentFragment(); | ||
3858 | for (var i = 0; i < endInserts.length; i++) | ||
3859 | { | ||
3860 | var insert = endInserts[i]; | ||
3861 | var entry = insert.A; | ||
3862 | _VirtualDom_appendChild(frag, entry.c === 2 | ||
3863 | ? entry.s | ||
3864 | : _VirtualDom_render(entry.z, patch.u) | ||
3865 | ); | ||
3866 | } | ||
3867 | return frag; | ||
3868 | } | ||
3869 | |||
3870 | |||
3871 | function _VirtualDom_virtualize(node) | ||
3872 | { | ||
3873 | // TEXT NODES | ||
3874 | |||
3875 | if (node.nodeType === 3) | ||
3876 | { | ||
3877 | return _VirtualDom_text(node.textContent); | ||
3878 | } | ||
3879 | |||
3880 | |||
3881 | // WEIRD NODES | ||
3882 | |||
3883 | if (node.nodeType !== 1) | ||
3884 | { | ||
3885 | return _VirtualDom_text(''); | ||
3886 | } | ||
3887 | |||
3888 | |||
3889 | // ELEMENT NODES | ||
3890 | |||
3891 | var attrList = _List_Nil; | ||
3892 | var attrs = node.attributes; | ||
3893 | for (var i = attrs.length; i--; ) | ||
3894 | { | ||
3895 | var attr = attrs[i]; | ||
3896 | var name = attr.name; | ||
3897 | var value = attr.value; | ||
3898 | attrList = _List_Cons( A2(_VirtualDom_attribute, name, value), attrList ); | ||
3899 | } | ||
3900 | |||
3901 | var tag = node.tagName.toLowerCase(); | ||
3902 | var kidList = _List_Nil; | ||
3903 | var kids = node.childNodes; | ||
3904 | |||
3905 | for (var i = kids.length; i--; ) | ||
3906 | { | ||
3907 | kidList = _List_Cons(_VirtualDom_virtualize(kids[i]), kidList); | ||
3908 | } | ||
3909 | return A3(_VirtualDom_node, tag, attrList, kidList); | ||
3910 | } | ||
3911 | |||
3912 | function _VirtualDom_dekey(keyedNode) | ||
3913 | { | ||
3914 | var keyedKids = keyedNode.e; | ||
3915 | var len = keyedKids.length; | ||
3916 | var kids = new Array(len); | ||
3917 | for (var i = 0; i < len; i++) | ||
3918 | { | ||
3919 | kids[i] = keyedKids[i].b; | ||
3920 | } | ||
3921 | |||
3922 | return { | ||
3923 | $: 1, | ||
3924 | c: keyedNode.c, | ||
3925 | d: keyedNode.d, | ||
3926 | e: kids, | ||
3927 | f: keyedNode.f, | ||
3928 | b: keyedNode.b | ||
3929 | }; | ||
3930 | } | ||
3931 | |||
3932 | |||
3933 | |||
3934 | |||
3935 | // ELEMENT | ||
3936 | |||
3937 | |||
3938 | var _Debugger_element; | ||
3939 | |||
3940 | var _Browser_element = _Debugger_element || F4(function(impl, flagDecoder, debugMetadata, args) | ||
3941 | { | ||
3942 | return _Platform_initialize( | ||
3943 | flagDecoder, | ||
3944 | args, | ||
3945 | impl.init, | ||
3946 | impl.update, | ||
3947 | impl.subscriptions, | ||
3948 | function(sendToApp, initialModel) { | ||
3949 | var view = impl.view; | ||
3950 | /**_UNUSED/ | ||
3951 | var domNode = args['node']; | ||
3952 | //*/ | ||
3953 | /**/ | ||
3954 | var domNode = args && args['node'] ? args['node'] : _Debug_crash(0); | ||
3955 | //*/ | ||
3956 | var currNode = _VirtualDom_virtualize(domNode); | ||
3957 | |||
3958 | return _Browser_makeAnimator(initialModel, function(model) | ||
3959 | { | ||
3960 | var nextNode = view(model); | ||
3961 | var patches = _VirtualDom_diff(currNode, nextNode); | ||
3962 | domNode = _VirtualDom_applyPatches(domNode, currNode, patches, sendToApp); | ||
3963 | currNode = nextNode; | ||
3964 | }); | ||
3965 | } | ||
3966 | ); | ||
3967 | }); | ||
3968 | |||
3969 | |||
3970 | |||
3971 | // DOCUMENT | ||
3972 | |||
3973 | |||
3974 | var _Debugger_document; | ||
3975 | |||
3976 | var _Browser_document = _Debugger_document || F4(function(impl, flagDecoder, debugMetadata, args) | ||
3977 | { | ||
3978 | return _Platform_initialize( | ||
3979 | flagDecoder, | ||
3980 | args, | ||
3981 | impl.init, | ||
3982 | impl.update, | ||
3983 | impl.subscriptions, | ||
3984 | function(sendToApp, initialModel) { | ||
3985 | var divertHrefToApp = impl.setup && impl.setup(sendToApp) | ||
3986 | var view = impl.view; | ||
3987 | var title = _VirtualDom_doc.title; | ||
3988 | var bodyNode = _VirtualDom_doc.body; | ||
3989 | var currNode = _VirtualDom_virtualize(bodyNode); | ||
3990 | return _Browser_makeAnimator(initialModel, function(model) | ||
3991 | { | ||
3992 | _VirtualDom_divertHrefToApp = divertHrefToApp; | ||
3993 | var doc = view(model); | ||
3994 | var nextNode = _VirtualDom_node('body')(_List_Nil)(doc.body); | ||
3995 | var patches = _VirtualDom_diff(currNode, nextNode); | ||
3996 | bodyNode = _VirtualDom_applyPatches(bodyNode, currNode, patches, sendToApp); | ||
3997 | currNode = nextNode; | ||
3998 | _VirtualDom_divertHrefToApp = 0; | ||
3999 | (title !== doc.title) && (_VirtualDom_doc.title = title = doc.title); | ||
4000 | }); | ||
4001 | } | ||
4002 | ); | ||
4003 | }); | ||
4004 | |||
4005 | |||
4006 | |||
4007 | // ANIMATION | ||
4008 | |||
4009 | |||
4010 | var _Browser_cancelAnimationFrame = | ||
4011 | typeof cancelAnimationFrame !== 'undefined' | ||
4012 | ? cancelAnimationFrame | ||
4013 | : function(id) { clearTimeout(id); }; | ||
4014 | |||
4015 | var _Browser_requestAnimationFrame = | ||
4016 | typeof requestAnimationFrame !== 'undefined' | ||
4017 | ? requestAnimationFrame | ||
4018 | : function(callback) { return setTimeout(callback, 1000 / 60); }; | ||
4019 | |||
4020 | |||
4021 | function _Browser_makeAnimator(model, draw) | ||
4022 | { | ||
4023 | draw(model); | ||
4024 | |||
4025 | var state = 0; | ||
4026 | |||
4027 | function updateIfNeeded() | ||
4028 | { | ||
4029 | state = state === 1 | ||
4030 | ? 0 | ||
4031 | : ( _Browser_requestAnimationFrame(updateIfNeeded), draw(model), 1 ); | ||
4032 | } | ||
4033 | |||
4034 | return function(nextModel, isSync) | ||
4035 | { | ||
4036 | model = nextModel; | ||
4037 | |||
4038 | isSync | ||
4039 | ? ( draw(model), | ||
4040 | state === 2 && (state = 1) | ||
4041 | ) | ||
4042 | : ( state === 0 && _Browser_requestAnimationFrame(updateIfNeeded), | ||
4043 | state = 2 | ||
4044 | ); | ||
4045 | }; | ||
4046 | } | ||
4047 | |||
4048 | |||
4049 | |||
4050 | // APPLICATION | ||
4051 | |||
4052 | |||
4053 | function _Browser_application(impl) | ||
4054 | { | ||
4055 | var onUrlChange = impl.onUrlChange; | ||
4056 | var onUrlRequest = impl.onUrlRequest; | ||
4057 | var key = function() { key.a(onUrlChange(_Browser_getUrl())); }; | ||
4058 | |||
4059 | return _Browser_document({ | ||
4060 | setup: function(sendToApp) | ||
4061 | { | ||
4062 | key.a = sendToApp; | ||
4063 | _Browser_window.addEventListener('popstate', key); | ||
4064 | _Browser_window.navigator.userAgent.indexOf('Trident') < 0 || _Browser_window.addEventListener('hashchange', key); | ||
4065 | |||
4066 | return F2(function(domNode, event) | ||
4067 | { | ||
4068 | if (!event.ctrlKey && !event.metaKey && !event.shiftKey && event.button < 1 && !domNode.target && !domNode.hasAttribute('download')) | ||
4069 | { | ||
4070 | event.preventDefault(); | ||
4071 | var href = domNode.href; | ||
4072 | var curr = _Browser_getUrl(); | ||
4073 | var next = $elm$url$Url$fromString(href).a; | ||
4074 | sendToApp(onUrlRequest( | ||
4075 | (next | ||
4076 | && curr.protocol === next.protocol | ||
4077 | && curr.host === next.host | ||
4078 | && curr.port_.a === next.port_.a | ||
4079 | ) | ||
4080 | ? $elm$browser$Browser$Internal(next) | ||
4081 | : $elm$browser$Browser$External(href) | ||
4082 | )); | ||
4083 | } | ||
4084 | }); | ||
4085 | }, | ||
4086 | init: function(flags) | ||
4087 | { | ||
4088 | return A3(impl.init, flags, _Browser_getUrl(), key); | ||
4089 | }, | ||
4090 | view: impl.view, | ||
4091 | update: impl.update, | ||
4092 | subscriptions: impl.subscriptions | ||
4093 | }); | ||
4094 | } | ||
4095 | |||
4096 | function _Browser_getUrl() | ||
4097 | { | ||
4098 | return $elm$url$Url$fromString(_VirtualDom_doc.location.href).a || _Debug_crash(1); | ||
4099 | } | ||
4100 | |||
4101 | var _Browser_go = F2(function(key, n) | ||
4102 | { | ||
4103 | return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function() { | ||
4104 | n && history.go(n); | ||
4105 | key(); | ||
4106 | })); | ||
4107 | }); | ||
4108 | |||
4109 | var _Browser_pushUrl = F2(function(key, url) | ||
4110 | { | ||
4111 | return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function() { | ||
4112 | history.pushState({}, '', url); | ||
4113 | key(); | ||
4114 | })); | ||
4115 | }); | ||
4116 | |||
4117 | var _Browser_replaceUrl = F2(function(key, url) | ||
4118 | { | ||
4119 | return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function() { | ||
4120 | history.replaceState({}, '', url); | ||
4121 | key(); | ||
4122 | })); | ||
4123 | }); | ||
4124 | |||
4125 | |||
4126 | |||
4127 | // GLOBAL EVENTS | ||
4128 | |||
4129 | |||
4130 | var _Browser_fakeNode = { addEventListener: function() {}, removeEventListener: function() {} }; | ||
4131 | var _Browser_doc = typeof document !== 'undefined' ? document : _Browser_fakeNode; | ||
4132 | var _Browser_window = typeof window !== 'undefined' ? window : _Browser_fakeNode; | ||
4133 | |||
4134 | var _Browser_on = F3(function(node, eventName, sendToSelf) | ||
4135 | { | ||
4136 | return _Scheduler_spawn(_Scheduler_binding(function(callback) | ||
4137 | { | ||
4138 | function handler(event) { _Scheduler_rawSpawn(sendToSelf(event)); } | ||
4139 | node.addEventListener(eventName, handler, _VirtualDom_passiveSupported && { passive: true }); | ||
4140 | return function() { node.removeEventListener(eventName, handler); }; | ||
4141 | })); | ||
4142 | }); | ||
4143 | |||
4144 | var _Browser_decodeEvent = F2(function(decoder, event) | ||
4145 | { | ||
4146 | var result = _Json_runHelp(decoder, event); | ||
4147 | return $elm$core$Result$isOk(result) ? $elm$core$Maybe$Just(result.a) : $elm$core$Maybe$Nothing; | ||
4148 | }); | ||
4149 | |||
4150 | |||
4151 | |||
4152 | // PAGE VISIBILITY | ||
4153 | |||
4154 | |||
4155 | function _Browser_visibilityInfo() | ||
4156 | { | ||
4157 | return (typeof _VirtualDom_doc.hidden !== 'undefined') | ||
4158 | ? { hidden: 'hidden', change: 'visibilitychange' } | ||
4159 | : | ||
4160 | (typeof _VirtualDom_doc.mozHidden !== 'undefined') | ||
4161 | ? { hidden: 'mozHidden', change: 'mozvisibilitychange' } | ||
4162 | : | ||
4163 | (typeof _VirtualDom_doc.msHidden !== 'undefined') | ||
4164 | ? { hidden: 'msHidden', change: 'msvisibilitychange' } | ||
4165 | : | ||
4166 | (typeof _VirtualDom_doc.webkitHidden !== 'undefined') | ||
4167 | ? { hidden: 'webkitHidden', change: 'webkitvisibilitychange' } | ||
4168 | : { hidden: 'hidden', change: 'visibilitychange' }; | ||
4169 | } | ||
4170 | |||
4171 | |||
4172 | |||
4173 | // ANIMATION FRAMES | ||
4174 | |||
4175 | |||
4176 | function _Browser_rAF() | ||
4177 | { | ||
4178 | return _Scheduler_binding(function(callback) | ||
4179 | { | ||
4180 | var id = _Browser_requestAnimationFrame(function() { | ||
4181 | callback(_Scheduler_succeed(Date.now())); | ||
4182 | }); | ||
4183 | |||
4184 | return function() { | ||
4185 | _Browser_cancelAnimationFrame(id); | ||
4186 | }; | ||
4187 | }); | ||
4188 | } | ||
4189 | |||
4190 | |||
4191 | function _Browser_now() | ||
4192 | { | ||
4193 | return _Scheduler_binding(function(callback) | ||
4194 | { | ||
4195 | callback(_Scheduler_succeed(Date.now())); | ||
4196 | }); | ||
4197 | } | ||
4198 | |||
4199 | |||
4200 | |||
4201 | // DOM STUFF | ||
4202 | |||
4203 | |||
4204 | function _Browser_withNode(id, doStuff) | ||
4205 | { | ||
4206 | return _Scheduler_binding(function(callback) | ||
4207 | { | ||
4208 | _Browser_requestAnimationFrame(function() { | ||
4209 | var node = document.getElementById(id); | ||
4210 | callback(node | ||
4211 | ? _Scheduler_succeed(doStuff(node)) | ||
4212 | : _Scheduler_fail($elm$browser$Browser$Dom$NotFound(id)) | ||
4213 | ); | ||
4214 | }); | ||
4215 | }); | ||
4216 | } | ||
4217 | |||
4218 | |||
4219 | function _Browser_withWindow(doStuff) | ||
4220 | { | ||
4221 | return _Scheduler_binding(function(callback) | ||
4222 | { | ||
4223 | _Browser_requestAnimationFrame(function() { | ||
4224 | callback(_Scheduler_succeed(doStuff())); | ||
4225 | }); | ||
4226 | }); | ||
4227 | } | ||
4228 | |||
4229 | |||
4230 | // FOCUS and BLUR | ||
4231 | |||
4232 | |||
4233 | var _Browser_call = F2(function(functionName, id) | ||
4234 | { | ||
4235 | return _Browser_withNode(id, function(node) { | ||
4236 | node[functionName](); | ||
4237 | return _Utils_Tuple0; | ||
4238 | }); | ||
4239 | }); | ||
4240 | |||
4241 | |||
4242 | |||
4243 | // WINDOW VIEWPORT | ||
4244 | |||
4245 | |||
4246 | function _Browser_getViewport() | ||
4247 | { | ||
4248 | return { | ||
4249 | scene: _Browser_getScene(), | ||
4250 | viewport: { | ||
4251 | x: _Browser_window.pageXOffset, | ||
4252 | y: _Browser_window.pageYOffset, | ||
4253 | width: _Browser_doc.documentElement.clientWidth, | ||
4254 | height: _Browser_doc.documentElement.clientHeight | ||
4255 | } | ||
4256 | }; | ||
4257 | } | ||
4258 | |||
4259 | function _Browser_getScene() | ||
4260 | { | ||
4261 | var body = _Browser_doc.body; | ||
4262 | var elem = _Browser_doc.documentElement; | ||
4263 | return { | ||
4264 | width: Math.max(body.scrollWidth, body.offsetWidth, elem.scrollWidth, elem.offsetWidth, elem.clientWidth), | ||
4265 | height: Math.max(body.scrollHeight, body.offsetHeight, elem.scrollHeight, elem.offsetHeight, elem.clientHeight) | ||
4266 | }; | ||
4267 | } | ||
4268 | |||
4269 | var _Browser_setViewport = F2(function(x, y) | ||
4270 | { | ||
4271 | return _Browser_withWindow(function() | ||
4272 | { | ||
4273 | _Browser_window.scroll(x, y); | ||
4274 | return _Utils_Tuple0; | ||
4275 | }); | ||
4276 | }); | ||
4277 | |||
4278 | |||
4279 | |||
4280 | // ELEMENT VIEWPORT | ||
4281 | |||
4282 | |||
4283 | function _Browser_getViewportOf(id) | ||
4284 | { | ||
4285 | return _Browser_withNode(id, function(node) | ||
4286 | { | ||
4287 | return { | ||
4288 | scene: { | ||
4289 | width: node.scrollWidth, | ||
4290 | height: node.scrollHeight | ||
4291 | }, | ||
4292 | viewport: { | ||
4293 | x: node.scrollLeft, | ||
4294 | y: node.scrollTop, | ||
4295 | width: node.clientWidth, | ||
4296 | height: node.clientHeight | ||
4297 | } | ||
4298 | }; | ||
4299 | }); | ||
4300 | } | ||
4301 | |||
4302 | |||
4303 | var _Browser_setViewportOf = F3(function(id, x, y) | ||
4304 | { | ||
4305 | return _Browser_withNode(id, function(node) | ||
4306 | { | ||
4307 | node.scrollLeft = x; | ||
4308 | node.scrollTop = y; | ||
4309 | return _Utils_Tuple0; | ||
4310 | }); | ||
4311 | }); | ||
4312 | |||
4313 | |||
4314 | |||
4315 | // ELEMENT | ||
4316 | |||
4317 | |||
4318 | function _Browser_getElement(id) | ||
4319 | { | ||
4320 | return _Browser_withNode(id, function(node) | ||
4321 | { | ||
4322 | var rect = node.getBoundingClientRect(); | ||
4323 | var x = _Browser_window.pageXOffset; | ||
4324 | var y = _Browser_window.pageYOffset; | ||
4325 | return { | ||
4326 | scene: _Browser_getScene(), | ||
4327 | viewport: { | ||
4328 | x: x, | ||
4329 | y: y, | ||
4330 | width: _Browser_doc.documentElement.clientWidth, | ||
4331 | height: _Browser_doc.documentElement.clientHeight | ||
4332 | }, | ||
4333 | element: { | ||
4334 | x: x + rect.left, | ||
4335 | y: y + rect.top, | ||
4336 | width: rect.width, | ||
4337 | height: rect.height | ||
4338 | } | ||
4339 | }; | ||
4340 | }); | ||
4341 | } | ||
4342 | |||
4343 | |||
4344 | |||
4345 | // LOAD and RELOAD | ||
4346 | |||
4347 | |||
4348 | function _Browser_reload(skipCache) | ||
4349 | { | ||
4350 | return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function(callback) | ||
4351 | { | ||
4352 | _VirtualDom_doc.location.reload(skipCache); | ||
4353 | })); | ||
4354 | } | ||
4355 | |||
4356 | function _Browser_load(url) | ||
4357 | { | ||
4358 | return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function(callback) | ||
4359 | { | ||
4360 | try | ||
4361 | { | ||
4362 | _Browser_window.location = url; | ||
4363 | } | ||
4364 | catch(err) | ||
4365 | { | ||
4366 | // Only Firefox can throw a NS_ERROR_MALFORMED_URI exception here. | ||
4367 | // Other browsers reload the page, so let's be consistent about that. | ||
4368 | _VirtualDom_doc.location.reload(false); | ||
4369 | } | ||
4370 | })); | ||
4371 | } | ||
4372 | |||
4373 | |||
4374 | |||
4375 | // SEND REQUEST | ||
4376 | |||
4377 | var _Http_toTask = F3(function(router, toTask, request) | ||
4378 | { | ||
4379 | return _Scheduler_binding(function(callback) | ||
4380 | { | ||
4381 | function done(response) { | ||
4382 | callback(toTask(request.expect.a(response))); | ||
4383 | } | ||
4384 | |||
4385 | var xhr = new XMLHttpRequest(); | ||
4386 | xhr.addEventListener('error', function() { done($elm$http$Http$NetworkError_); }); | ||
4387 | xhr.addEventListener('timeout', function() { done($elm$http$Http$Timeout_); }); | ||
4388 | xhr.addEventListener('load', function() { done(_Http_toResponse(request.expect.b, xhr)); }); | ||
4389 | $elm$core$Maybe$isJust(request.tracker) && _Http_track(router, xhr, request.tracker.a); | ||
4390 | |||
4391 | try { | ||
4392 | xhr.open(request.method, request.url, true); | ||
4393 | } catch (e) { | ||
4394 | return done($elm$http$Http$BadUrl_(request.url)); | ||
4395 | } | ||
4396 | |||
4397 | _Http_configureRequest(xhr, request); | ||
4398 | |||
4399 | request.body.a && xhr.setRequestHeader('Content-Type', request.body.a); | ||
4400 | xhr.send(request.body.b); | ||
4401 | |||
4402 | return function() { xhr.c = true; xhr.abort(); }; | ||
4403 | }); | ||
4404 | }); | ||
4405 | |||
4406 | |||
4407 | // CONFIGURE | ||
4408 | |||
4409 | function _Http_configureRequest(xhr, request) | ||
4410 | { | ||
4411 | for (var headers = request.headers; headers.b; headers = headers.b) // WHILE_CONS | ||
4412 | { | ||
4413 | xhr.setRequestHeader(headers.a.a, headers.a.b); | ||
4414 | } | ||
4415 | xhr.timeout = request.timeout.a || 0; | ||
4416 | xhr.responseType = request.expect.d; | ||
4417 | xhr.withCredentials = request.allowCookiesFromOtherDomains; | ||
4418 | } | ||
4419 | |||
4420 | |||
4421 | // RESPONSES | ||
4422 | |||
4423 | function _Http_toResponse(toBody, xhr) | ||
4424 | { | ||
4425 | return A2( | ||
4426 | 200 <= xhr.status && xhr.status < 300 ? $elm$http$Http$GoodStatus_ : $elm$http$Http$BadStatus_, | ||
4427 | _Http_toMetadata(xhr), | ||
4428 | toBody(xhr.response) | ||
4429 | ); | ||
4430 | } | ||
4431 | |||
4432 | |||
4433 | // METADATA | ||
4434 | |||
4435 | function _Http_toMetadata(xhr) | ||
4436 | { | ||
4437 | return { | ||
4438 | url: xhr.responseURL, | ||
4439 | statusCode: xhr.status, | ||
4440 | statusText: xhr.statusText, | ||
4441 | headers: _Http_parseHeaders(xhr.getAllResponseHeaders()) | ||
4442 | }; | ||
4443 | } | ||
4444 | |||
4445 | |||
4446 | // HEADERS | ||
4447 | |||
4448 | function _Http_parseHeaders(rawHeaders) | ||
4449 | { | ||
4450 | if (!rawHeaders) | ||
4451 | { | ||
4452 | return $elm$core$Dict$empty; | ||
4453 | } | ||
4454 | |||
4455 | var headers = $elm$core$Dict$empty; | ||
4456 | var headerPairs = rawHeaders.split('\r\n'); | ||
4457 | for (var i = headerPairs.length; i--; ) | ||
4458 | { | ||
4459 | var headerPair = headerPairs[i]; | ||
4460 | var index = headerPair.indexOf(': '); | ||
4461 | if (index > 0) | ||
4462 | { | ||
4463 | var key = headerPair.substring(0, index); | ||
4464 | var value = headerPair.substring(index + 2); | ||
4465 | |||
4466 | headers = A3($elm$core$Dict$update, key, function(oldValue) { | ||
4467 | return $elm$core$Maybe$Just($elm$core$Maybe$isJust(oldValue) | ||
4468 | ? value + ', ' + oldValue.a | ||
4469 | : value | ||
4470 | ); | ||
4471 | }, headers); | ||
4472 | } | ||
4473 | } | ||
4474 | return headers; | ||
4475 | } | ||
4476 | |||
4477 | |||
4478 | // EXPECT | ||
4479 | |||
4480 | var _Http_expect = F3(function(type, toBody, toValue) | ||
4481 | { | ||
4482 | return { | ||
4483 | $: 0, | ||
4484 | d: type, | ||
4485 | b: toBody, | ||
4486 | a: toValue | ||
4487 | }; | ||
4488 | }); | ||
4489 | |||
4490 | var _Http_mapExpect = F2(function(func, expect) | ||
4491 | { | ||
4492 | return { | ||
4493 | $: 0, | ||
4494 | d: expect.d, | ||
4495 | b: expect.b, | ||
4496 | a: function(x) { return func(expect.a(x)); } | ||
4497 | }; | ||
4498 | }); | ||
4499 | |||
4500 | function _Http_toDataView(arrayBuffer) | ||
4501 | { | ||
4502 | return new DataView(arrayBuffer); | ||
4503 | } | ||
4504 | |||
4505 | |||
4506 | // BODY and PARTS | ||
4507 | |||
4508 | var _Http_emptyBody = { $: 0 }; | ||
4509 | var _Http_pair = F2(function(a, b) { return { $: 0, a: a, b: b }; }); | ||
4510 | |||
4511 | function _Http_toFormData(parts) | ||
4512 | { | ||
4513 | for (var formData = new FormData(); parts.b; parts = parts.b) // WHILE_CONS | ||
4514 | { | ||
4515 | var part = parts.a; | ||
4516 | formData.append(part.a, part.b); | ||
4517 | } | ||
4518 | return formData; | ||
4519 | } | ||
4520 | |||
4521 | var _Http_bytesToBlob = F2(function(mime, bytes) | ||
4522 | { | ||
4523 | return new Blob([bytes], { type: mime }); | ||
4524 | }); | ||
4525 | |||
4526 | |||
4527 | // PROGRESS | ||
4528 | |||
4529 | function _Http_track(router, xhr, tracker) | ||
4530 | { | ||
4531 | // TODO check out lengthComputable on loadstart event | ||
4532 | |||
4533 | xhr.upload.addEventListener('progress', function(event) { | ||
4534 | if (xhr.c) { return; } | ||
4535 | _Scheduler_rawSpawn(A2($elm$core$Platform$sendToSelf, router, _Utils_Tuple2(tracker, $elm$http$Http$Sending({ | ||
4536 | sent: event.loaded, | ||
4537 | size: event.total | ||
4538 | })))); | ||
4539 | }); | ||
4540 | xhr.addEventListener('progress', function(event) { | ||
4541 | if (xhr.c) { return; } | ||
4542 | _Scheduler_rawSpawn(A2($elm$core$Platform$sendToSelf, router, _Utils_Tuple2(tracker, $elm$http$Http$Receiving({ | ||
4543 | received: event.loaded, | ||
4544 | size: event.lengthComputable ? $elm$core$Maybe$Just(event.total) : $elm$core$Maybe$Nothing | ||
4545 | })))); | ||
4546 | }); | ||
4547 | } | ||
4548 | |||
4549 | function _Url_percentEncode(string) | ||
4550 | { | ||
4551 | return encodeURIComponent(string); | ||
4552 | } | ||
4553 | |||
4554 | function _Url_percentDecode(string) | ||
4555 | { | ||
4556 | try | ||
4557 | { | ||
4558 | return $elm$core$Maybe$Just(decodeURIComponent(string)); | ||
4559 | } | ||
4560 | catch (e) | ||
4561 | { | ||
4562 | return $elm$core$Maybe$Nothing; | ||
4563 | } | ||
4564 | } | ||
4565 | |||
4566 | |||
4567 | var _Bitwise_and = F2(function(a, b) | ||
4568 | { | ||
4569 | return a & b; | ||
4570 | }); | ||
4571 | |||
4572 | var _Bitwise_or = F2(function(a, b) | ||
4573 | { | ||
4574 | return a | b; | ||
4575 | }); | ||
4576 | |||
4577 | var _Bitwise_xor = F2(function(a, b) | ||
4578 | { | ||
4579 | return a ^ b; | ||
4580 | }); | ||
4581 | |||
4582 | function _Bitwise_complement(a) | ||
4583 | { | ||
4584 | return ~a; | ||
4585 | }; | ||
4586 | |||
4587 | var _Bitwise_shiftLeftBy = F2(function(offset, a) | ||
4588 | { | ||
4589 | return a << offset; | ||
4590 | }); | ||
4591 | |||
4592 | var _Bitwise_shiftRightBy = F2(function(offset, a) | ||
4593 | { | ||
4594 | return a >> offset; | ||
4595 | }); | ||
4596 | |||
4597 | var _Bitwise_shiftRightZfBy = F2(function(offset, a) | ||
4598 | { | ||
4599 | return a >>> offset; | ||
4600 | }); | ||
4601 | var $author$project$Main$LinkClicked = function (a) { | ||
4602 | return {$: 'LinkClicked', a: a}; | ||
4603 | }; | ||
4604 | var $author$project$Main$UrlChanged = function (a) { | ||
4605 | return {$: 'UrlChanged', a: a}; | ||
4606 | }; | ||
4607 | var $elm$core$Basics$EQ = {$: 'EQ'}; | ||
4608 | var $elm$core$Basics$GT = {$: 'GT'}; | ||
4609 | var $elm$core$Basics$LT = {$: 'LT'}; | ||
4610 | var $elm$core$List$cons = _List_cons; | ||
4611 | var $elm$core$Dict$foldr = F3( | ||
4612 | function (func, acc, t) { | ||
4613 | foldr: | ||
4614 | while (true) { | ||
4615 | if (t.$ === 'RBEmpty_elm_builtin') { | ||
4616 | return acc; | ||
4617 | } else { | ||
4618 | var key = t.b; | ||
4619 | var value = t.c; | ||
4620 | var left = t.d; | ||
4621 | var right = t.e; | ||
4622 | var $temp$func = func, | ||
4623 | $temp$acc = A3( | ||
4624 | func, | ||
4625 | key, | ||
4626 | value, | ||
4627 | A3($elm$core$Dict$foldr, func, acc, right)), | ||
4628 | $temp$t = left; | ||
4629 | func = $temp$func; | ||
4630 | acc = $temp$acc; | ||
4631 | t = $temp$t; | ||
4632 | continue foldr; | ||
4633 | } | ||
4634 | } | ||
4635 | }); | ||
4636 | var $elm$core$Dict$toList = function (dict) { | ||
4637 | return A3( | ||
4638 | $elm$core$Dict$foldr, | ||
4639 | F3( | ||
4640 | function (key, value, list) { | ||
4641 | return A2( | ||
4642 | $elm$core$List$cons, | ||
4643 | _Utils_Tuple2(key, value), | ||
4644 | list); | ||
4645 | }), | ||
4646 | _List_Nil, | ||
4647 | dict); | ||
4648 | }; | ||
4649 | var $elm$core$Dict$keys = function (dict) { | ||
4650 | return A3( | ||
4651 | $elm$core$Dict$foldr, | ||
4652 | F3( | ||
4653 | function (key, value, keyList) { | ||
4654 | return A2($elm$core$List$cons, key, keyList); | ||
4655 | }), | ||
4656 | _List_Nil, | ||
4657 | dict); | ||
4658 | }; | ||
4659 | var $elm$core$Set$toList = function (_v0) { | ||
4660 | var dict = _v0.a; | ||
4661 | return $elm$core$Dict$keys(dict); | ||
4662 | }; | ||
4663 | var $elm$core$Elm$JsArray$foldr = _JsArray_foldr; | ||
4664 | var $elm$core$Array$foldr = F3( | ||
4665 | function (func, baseCase, _v0) { | ||
4666 | var tree = _v0.c; | ||
4667 | var tail = _v0.d; | ||
4668 | var helper = F2( | ||
4669 | function (node, acc) { | ||
4670 | if (node.$ === 'SubTree') { | ||
4671 | var subTree = node.a; | ||
4672 | return A3($elm$core$Elm$JsArray$foldr, helper, acc, subTree); | ||
4673 | } else { | ||
4674 | var values = node.a; | ||
4675 | return A3($elm$core$Elm$JsArray$foldr, func, acc, values); | ||
4676 | } | ||
4677 | }); | ||
4678 | return A3( | ||
4679 | $elm$core$Elm$JsArray$foldr, | ||
4680 | helper, | ||
4681 | A3($elm$core$Elm$JsArray$foldr, func, baseCase, tail), | ||
4682 | tree); | ||
4683 | }); | ||
4684 | var $elm$core$Array$toList = function (array) { | ||
4685 | return A3($elm$core$Array$foldr, $elm$core$List$cons, _List_Nil, array); | ||
4686 | }; | ||
4687 | var $elm$core$Result$Err = function (a) { | ||
4688 | return {$: 'Err', a: a}; | ||
4689 | }; | ||
4690 | var $elm$json$Json$Decode$Failure = F2( | ||
4691 | function (a, b) { | ||
4692 | return {$: 'Failure', a: a, b: b}; | ||
4693 | }); | ||
4694 | var $elm$json$Json$Decode$Field = F2( | ||
4695 | function (a, b) { | ||
4696 | return {$: 'Field', a: a, b: b}; | ||
4697 | }); | ||
4698 | var $elm$json$Json$Decode$Index = F2( | ||
4699 | function (a, b) { | ||
4700 | return {$: 'Index', a: a, b: b}; | ||
4701 | }); | ||
4702 | var $elm$core$Result$Ok = function (a) { | ||
4703 | return {$: 'Ok', a: a}; | ||
4704 | }; | ||
4705 | var $elm$json$Json$Decode$OneOf = function (a) { | ||
4706 | return {$: 'OneOf', a: a}; | ||
4707 | }; | ||
4708 | var $elm$core$Basics$False = {$: 'False'}; | ||
4709 | var $elm$core$Basics$add = _Basics_add; | ||
4710 | var $elm$core$Maybe$Just = function (a) { | ||
4711 | return {$: 'Just', a: a}; | ||
4712 | }; | ||
4713 | var $elm$core$Maybe$Nothing = {$: 'Nothing'}; | ||
4714 | var $elm$core$String$all = _String_all; | ||
4715 | var $elm$core$Basics$and = _Basics_and; | ||
4716 | var $elm$core$Basics$append = _Utils_append; | ||
4717 | var $elm$json$Json$Encode$encode = _Json_encode; | ||
4718 | var $elm$core$String$fromInt = _String_fromNumber; | ||
4719 | var $elm$core$String$join = F2( | ||
4720 | function (sep, chunks) { | ||
4721 | return A2( | ||
4722 | _String_join, | ||
4723 | sep, | ||
4724 | _List_toArray(chunks)); | ||
4725 | }); | ||
4726 | var $elm$core$String$split = F2( | ||
4727 | function (sep, string) { | ||
4728 | return _List_fromArray( | ||
4729 | A2(_String_split, sep, string)); | ||
4730 | }); | ||
4731 | var $elm$json$Json$Decode$indent = function (str) { | ||
4732 | return A2( | ||
4733 | $elm$core$String$join, | ||
4734 | '\n ', | ||
4735 | A2($elm$core$String$split, '\n', str)); | ||
4736 | }; | ||
4737 | var $elm$core$List$foldl = F3( | ||
4738 | function (func, acc, list) { | ||
4739 | foldl: | ||
4740 | while (true) { | ||
4741 | if (!list.b) { | ||
4742 | return acc; | ||
4743 | } else { | ||
4744 | var x = list.a; | ||
4745 | var xs = list.b; | ||
4746 | var $temp$func = func, | ||
4747 | $temp$acc = A2(func, x, acc), | ||
4748 | $temp$list = xs; | ||
4749 | func = $temp$func; | ||
4750 | acc = $temp$acc; | ||
4751 | list = $temp$list; | ||
4752 | continue foldl; | ||
4753 | } | ||
4754 | } | ||
4755 | }); | ||
4756 | var $elm$core$List$length = function (xs) { | ||
4757 | return A3( | ||
4758 | $elm$core$List$foldl, | ||
4759 | F2( | ||
4760 | function (_v0, i) { | ||
4761 | return i + 1; | ||
4762 | }), | ||
4763 | 0, | ||
4764 | xs); | ||
4765 | }; | ||
4766 | var $elm$core$List$map2 = _List_map2; | ||
4767 | var $elm$core$Basics$le = _Utils_le; | ||
4768 | var $elm$core$Basics$sub = _Basics_sub; | ||
4769 | var $elm$core$List$rangeHelp = F3( | ||
4770 | function (lo, hi, list) { | ||
4771 | rangeHelp: | ||
4772 | while (true) { | ||
4773 | if (_Utils_cmp(lo, hi) < 1) { | ||
4774 | var $temp$lo = lo, | ||
4775 | $temp$hi = hi - 1, | ||
4776 | $temp$list = A2($elm$core$List$cons, hi, list); | ||
4777 | lo = $temp$lo; | ||
4778 | hi = $temp$hi; | ||
4779 | list = $temp$list; | ||
4780 | continue rangeHelp; | ||
4781 | } else { | ||
4782 | return list; | ||
4783 | } | ||
4784 | } | ||
4785 | }); | ||
4786 | var $elm$core$List$range = F2( | ||
4787 | function (lo, hi) { | ||
4788 | return A3($elm$core$List$rangeHelp, lo, hi, _List_Nil); | ||
4789 | }); | ||
4790 | var $elm$core$List$indexedMap = F2( | ||
4791 | function (f, xs) { | ||
4792 | return A3( | ||
4793 | $elm$core$List$map2, | ||
4794 | f, | ||
4795 | A2( | ||
4796 | $elm$core$List$range, | ||
4797 | 0, | ||
4798 | $elm$core$List$length(xs) - 1), | ||
4799 | xs); | ||
4800 | }); | ||
4801 | var $elm$core$Char$toCode = _Char_toCode; | ||
4802 | var $elm$core$Char$isLower = function (_char) { | ||
4803 | var code = $elm$core$Char$toCode(_char); | ||
4804 | return (97 <= code) && (code <= 122); | ||
4805 | }; | ||
4806 | var $elm$core$Char$isUpper = function (_char) { | ||
4807 | var code = $elm$core$Char$toCode(_char); | ||
4808 | return (code <= 90) && (65 <= code); | ||
4809 | }; | ||
4810 | var $elm$core$Basics$or = _Basics_or; | ||
4811 | var $elm$core$Char$isAlpha = function (_char) { | ||
4812 | return $elm$core$Char$isLower(_char) || $elm$core$Char$isUpper(_char); | ||
4813 | }; | ||
4814 | var $elm$core$Char$isDigit = function (_char) { | ||
4815 | var code = $elm$core$Char$toCode(_char); | ||
4816 | return (code <= 57) && (48 <= code); | ||
4817 | }; | ||
4818 | var $elm$core$Char$isAlphaNum = function (_char) { | ||
4819 | return $elm$core$Char$isLower(_char) || ($elm$core$Char$isUpper(_char) || $elm$core$Char$isDigit(_char)); | ||
4820 | }; | ||
4821 | var $elm$core$List$reverse = function (list) { | ||
4822 | return A3($elm$core$List$foldl, $elm$core$List$cons, _List_Nil, list); | ||
4823 | }; | ||
4824 | var $elm$core$String$uncons = _String_uncons; | ||
4825 | var $elm$json$Json$Decode$errorOneOf = F2( | ||
4826 | function (i, error) { | ||
4827 | return '\n\n(' + ($elm$core$String$fromInt(i + 1) + (') ' + $elm$json$Json$Decode$indent( | ||
4828 | $elm$json$Json$Decode$errorToString(error)))); | ||
4829 | }); | ||
4830 | var $elm$json$Json$Decode$errorToString = function (error) { | ||
4831 | return A2($elm$json$Json$Decode$errorToStringHelp, error, _List_Nil); | ||
4832 | }; | ||
4833 | var $elm$json$Json$Decode$errorToStringHelp = F2( | ||
4834 | function (error, context) { | ||
4835 | errorToStringHelp: | ||
4836 | while (true) { | ||
4837 | switch (error.$) { | ||
4838 | case 'Field': | ||
4839 | var f = error.a; | ||
4840 | var err = error.b; | ||
4841 | var isSimple = function () { | ||
4842 | var _v1 = $elm$core$String$uncons(f); | ||
4843 | if (_v1.$ === 'Nothing') { | ||
4844 | return false; | ||
4845 | } else { | ||
4846 | var _v2 = _v1.a; | ||
4847 | var _char = _v2.a; | ||
4848 | var rest = _v2.b; | ||
4849 | return $elm$core$Char$isAlpha(_char) && A2($elm$core$String$all, $elm$core$Char$isAlphaNum, rest); | ||
4850 | } | ||
4851 | }(); | ||
4852 | var fieldName = isSimple ? ('.' + f) : ('[\'' + (f + '\']')); | ||
4853 | var $temp$error = err, | ||
4854 | $temp$context = A2($elm$core$List$cons, fieldName, context); | ||
4855 | error = $temp$error; | ||
4856 | context = $temp$context; | ||
4857 | continue errorToStringHelp; | ||
4858 | case 'Index': | ||
4859 | var i = error.a; | ||
4860 | var err = error.b; | ||
4861 | var indexName = '[' + ($elm$core$String$fromInt(i) + ']'); | ||
4862 | var $temp$error = err, | ||
4863 | $temp$context = A2($elm$core$List$cons, indexName, context); | ||
4864 | error = $temp$error; | ||
4865 | context = $temp$context; | ||
4866 | continue errorToStringHelp; | ||
4867 | case 'OneOf': | ||
4868 | var errors = error.a; | ||
4869 | if (!errors.b) { | ||
4870 | return 'Ran into a Json.Decode.oneOf with no possibilities' + function () { | ||
4871 | if (!context.b) { | ||
4872 | return '!'; | ||
4873 | } else { | ||
4874 | return ' at json' + A2( | ||
4875 | $elm$core$String$join, | ||
4876 | '', | ||
4877 | $elm$core$List$reverse(context)); | ||
4878 | } | ||
4879 | }(); | ||
4880 | } else { | ||
4881 | if (!errors.b.b) { | ||
4882 | var err = errors.a; | ||
4883 | var $temp$error = err, | ||
4884 | $temp$context = context; | ||
4885 | error = $temp$error; | ||
4886 | context = $temp$context; | ||
4887 | continue errorToStringHelp; | ||
4888 | } else { | ||
4889 | var starter = function () { | ||
4890 | if (!context.b) { | ||
4891 | return 'Json.Decode.oneOf'; | ||
4892 | } else { | ||
4893 | return 'The Json.Decode.oneOf at json' + A2( | ||
4894 | $elm$core$String$join, | ||
4895 | '', | ||
4896 | $elm$core$List$reverse(context)); | ||
4897 | } | ||
4898 | }(); | ||
4899 | var introduction = starter + (' failed in the following ' + ($elm$core$String$fromInt( | ||
4900 | $elm$core$List$length(errors)) + ' ways:')); | ||
4901 | return A2( | ||
4902 | $elm$core$String$join, | ||
4903 | '\n\n', | ||
4904 | A2( | ||
4905 | $elm$core$List$cons, | ||
4906 | introduction, | ||
4907 | A2($elm$core$List$indexedMap, $elm$json$Json$Decode$errorOneOf, errors))); | ||
4908 | } | ||
4909 | } | ||
4910 | default: | ||
4911 | var msg = error.a; | ||
4912 | var json = error.b; | ||
4913 | var introduction = function () { | ||
4914 | if (!context.b) { | ||
4915 | return 'Problem with the given value:\n\n'; | ||
4916 | } else { | ||
4917 | return 'Problem with the value at json' + (A2( | ||
4918 | $elm$core$String$join, | ||
4919 | '', | ||
4920 | $elm$core$List$reverse(context)) + ':\n\n '); | ||
4921 | } | ||
4922 | }(); | ||
4923 | return introduction + ($elm$json$Json$Decode$indent( | ||
4924 | A2($elm$json$Json$Encode$encode, 4, json)) + ('\n\n' + msg)); | ||
4925 | } | ||
4926 | } | ||
4927 | }); | ||
4928 | var $elm$core$Array$branchFactor = 32; | ||
4929 | var $elm$core$Array$Array_elm_builtin = F4( | ||
4930 | function (a, b, c, d) { | ||
4931 | return {$: 'Array_elm_builtin', a: a, b: b, c: c, d: d}; | ||
4932 | }); | ||
4933 | var $elm$core$Elm$JsArray$empty = _JsArray_empty; | ||
4934 | var $elm$core$Basics$ceiling = _Basics_ceiling; | ||
4935 | var $elm$core$Basics$fdiv = _Basics_fdiv; | ||
4936 | var $elm$core$Basics$logBase = F2( | ||
4937 | function (base, number) { | ||
4938 | return _Basics_log(number) / _Basics_log(base); | ||
4939 | }); | ||
4940 | var $elm$core$Basics$toFloat = _Basics_toFloat; | ||
4941 | var $elm$core$Array$shiftStep = $elm$core$Basics$ceiling( | ||
4942 | A2($elm$core$Basics$logBase, 2, $elm$core$Array$branchFactor)); | ||
4943 | var $elm$core$Array$empty = A4($elm$core$Array$Array_elm_builtin, 0, $elm$core$Array$shiftStep, $elm$core$Elm$JsArray$empty, $elm$core$Elm$JsArray$empty); | ||
4944 | var $elm$core$Elm$JsArray$initialize = _JsArray_initialize; | ||
4945 | var $elm$core$Array$Leaf = function (a) { | ||
4946 | return {$: 'Leaf', a: a}; | ||
4947 | }; | ||
4948 | var $elm$core$Basics$apL = F2( | ||
4949 | function (f, x) { | ||
4950 | return f(x); | ||
4951 | }); | ||
4952 | var $elm$core$Basics$apR = F2( | ||
4953 | function (x, f) { | ||
4954 | return f(x); | ||
4955 | }); | ||
4956 | var $elm$core$Basics$eq = _Utils_equal; | ||
4957 | var $elm$core$Basics$floor = _Basics_floor; | ||
4958 | var $elm$core$Elm$JsArray$length = _JsArray_length; | ||
4959 | var $elm$core$Basics$gt = _Utils_gt; | ||
4960 | var $elm$core$Basics$max = F2( | ||
4961 | function (x, y) { | ||
4962 | return (_Utils_cmp(x, y) > 0) ? x : y; | ||
4963 | }); | ||
4964 | var $elm$core$Basics$mul = _Basics_mul; | ||
4965 | var $elm$core$Array$SubTree = function (a) { | ||
4966 | return {$: 'SubTree', a: a}; | ||
4967 | }; | ||
4968 | var $elm$core$Elm$JsArray$initializeFromList = _JsArray_initializeFromList; | ||
4969 | var $elm$core$Array$compressNodes = F2( | ||
4970 | function (nodes, acc) { | ||
4971 | compressNodes: | ||
4972 | while (true) { | ||
4973 | var _v0 = A2($elm$core$Elm$JsArray$initializeFromList, $elm$core$Array$branchFactor, nodes); | ||
4974 | var node = _v0.a; | ||
4975 | var remainingNodes = _v0.b; | ||
4976 | var newAcc = A2( | ||
4977 | $elm$core$List$cons, | ||
4978 | $elm$core$Array$SubTree(node), | ||
4979 | acc); | ||
4980 | if (!remainingNodes.b) { | ||
4981 | return $elm$core$List$reverse(newAcc); | ||
4982 | } else { | ||
4983 | var $temp$nodes = remainingNodes, | ||
4984 | $temp$acc = newAcc; | ||
4985 | nodes = $temp$nodes; | ||
4986 | acc = $temp$acc; | ||
4987 | continue compressNodes; | ||
4988 | } | ||
4989 | } | ||
4990 | }); | ||
4991 | var $elm$core$Tuple$first = function (_v0) { | ||
4992 | var x = _v0.a; | ||
4993 | return x; | ||
4994 | }; | ||
4995 | var $elm$core$Array$treeFromBuilder = F2( | ||
4996 | function (nodeList, nodeListSize) { | ||
4997 | treeFromBuilder: | ||
4998 | while (true) { | ||
4999 | var newNodeSize = $elm$core$Basics$ceiling(nodeListSize / $elm$core$Array$branchFactor); | ||
5000 | if (newNodeSize === 1) { | ||
5001 | return A2($elm$core$Elm$JsArray$initializeFromList, $elm$core$Array$branchFactor, nodeList).a; | ||
5002 | } else { | ||
5003 | var $temp$nodeList = A2($elm$core$Array$compressNodes, nodeList, _List_Nil), | ||
5004 | $temp$nodeListSize = newNodeSize; | ||
5005 | nodeList = $temp$nodeList; | ||
5006 | nodeListSize = $temp$nodeListSize; | ||
5007 | continue treeFromBuilder; | ||
5008 | } | ||
5009 | } | ||
5010 | }); | ||
5011 | var $elm$core$Array$builderToArray = F2( | ||
5012 | function (reverseNodeList, builder) { | ||
5013 | if (!builder.nodeListSize) { | ||
5014 | return A4( | ||
5015 | $elm$core$Array$Array_elm_builtin, | ||
5016 | $elm$core$Elm$JsArray$length(builder.tail), | ||
5017 | $elm$core$Array$shiftStep, | ||
5018 | $elm$core$Elm$JsArray$empty, | ||
5019 | builder.tail); | ||
5020 | } else { | ||
5021 | var treeLen = builder.nodeListSize * $elm$core$Array$branchFactor; | ||
5022 | var depth = $elm$core$Basics$floor( | ||
5023 | A2($elm$core$Basics$logBase, $elm$core$Array$branchFactor, treeLen - 1)); | ||
5024 | var correctNodeList = reverseNodeList ? $elm$core$List$reverse(builder.nodeList) : builder.nodeList; | ||
5025 | var tree = A2($elm$core$Array$treeFromBuilder, correctNodeList, builder.nodeListSize); | ||
5026 | return A4( | ||
5027 | $elm$core$Array$Array_elm_builtin, | ||
5028 | $elm$core$Elm$JsArray$length(builder.tail) + treeLen, | ||
5029 | A2($elm$core$Basics$max, 5, depth * $elm$core$Array$shiftStep), | ||
5030 | tree, | ||
5031 | builder.tail); | ||
5032 | } | ||
5033 | }); | ||
5034 | var $elm$core$Basics$idiv = _Basics_idiv; | ||
5035 | var $elm$core$Basics$lt = _Utils_lt; | ||
5036 | var $elm$core$Array$initializeHelp = F5( | ||
5037 | function (fn, fromIndex, len, nodeList, tail) { | ||
5038 | initializeHelp: | ||
5039 | while (true) { | ||
5040 | if (fromIndex < 0) { | ||
5041 | return A2( | ||
5042 | $elm$core$Array$builderToArray, | ||
5043 | false, | ||
5044 | {nodeList: nodeList, nodeListSize: (len / $elm$core$Array$branchFactor) | 0, tail: tail}); | ||
5045 | } else { | ||
5046 | var leaf = $elm$core$Array$Leaf( | ||
5047 | A3($elm$core$Elm$JsArray$initialize, $elm$core$Array$branchFactor, fromIndex, fn)); | ||
5048 | var $temp$fn = fn, | ||
5049 | $temp$fromIndex = fromIndex - $elm$core$Array$branchFactor, | ||
5050 | $temp$len = len, | ||
5051 | $temp$nodeList = A2($elm$core$List$cons, leaf, nodeList), | ||
5052 | $temp$tail = tail; | ||
5053 | fn = $temp$fn; | ||
5054 | fromIndex = $temp$fromIndex; | ||
5055 | len = $temp$len; | ||
5056 | nodeList = $temp$nodeList; | ||
5057 | tail = $temp$tail; | ||
5058 | continue initializeHelp; | ||
5059 | } | ||
5060 | } | ||
5061 | }); | ||
5062 | var $elm$core$Basics$remainderBy = _Basics_remainderBy; | ||
5063 | var $elm$core$Array$initialize = F2( | ||
5064 | function (len, fn) { | ||
5065 | if (len <= 0) { | ||
5066 | return $elm$core$Array$empty; | ||
5067 | } else { | ||
5068 | var tailLen = len % $elm$core$Array$branchFactor; | ||
5069 | var tail = A3($elm$core$Elm$JsArray$initialize, tailLen, len - tailLen, fn); | ||
5070 | var initialFromIndex = (len - tailLen) - $elm$core$Array$branchFactor; | ||
5071 | return A5($elm$core$Array$initializeHelp, fn, initialFromIndex, len, _List_Nil, tail); | ||
5072 | } | ||
5073 | }); | ||
5074 | var $elm$core$Basics$True = {$: 'True'}; | ||
5075 | var $elm$core$Result$isOk = function (result) { | ||
5076 | if (result.$ === 'Ok') { | ||
5077 | return true; | ||
5078 | } else { | ||
5079 | return false; | ||
5080 | } | ||
5081 | }; | ||
5082 | var $elm$json$Json$Decode$map = _Json_map1; | ||
5083 | var $elm$json$Json$Decode$map2 = _Json_map2; | ||
5084 | var $elm$json$Json$Decode$succeed = _Json_succeed; | ||
5085 | var $elm$virtual_dom$VirtualDom$toHandlerInt = function (handler) { | ||
5086 | switch (handler.$) { | ||
5087 | case 'Normal': | ||
5088 | return 0; | ||
5089 | case 'MayStopPropagation': | ||
5090 | return 1; | ||
5091 | case 'MayPreventDefault': | ||
5092 | return 2; | ||
5093 | default: | ||
5094 | return 3; | ||
5095 | } | ||
5096 | }; | ||
5097 | var $elm$browser$Browser$External = function (a) { | ||
5098 | return {$: 'External', a: a}; | ||
5099 | }; | ||
5100 | var $elm$browser$Browser$Internal = function (a) { | ||
5101 | return {$: 'Internal', a: a}; | ||
5102 | }; | ||
5103 | var $elm$core$Basics$identity = function (x) { | ||
5104 | return x; | ||
5105 | }; | ||
5106 | var $elm$browser$Browser$Dom$NotFound = function (a) { | ||
5107 | return {$: 'NotFound', a: a}; | ||
5108 | }; | ||
5109 | var $elm$url$Url$Http = {$: 'Http'}; | ||
5110 | var $elm$url$Url$Https = {$: 'Https'}; | ||
5111 | var $elm$url$Url$Url = F6( | ||
5112 | function (protocol, host, port_, path, query, fragment) { | ||
5113 | return {fragment: fragment, host: host, path: path, port_: port_, protocol: protocol, query: query}; | ||
5114 | }); | ||
5115 | var $elm$core$String$contains = _String_contains; | ||
5116 | var $elm$core$String$length = _String_length; | ||
5117 | var $elm$core$String$slice = _String_slice; | ||
5118 | var $elm$core$String$dropLeft = F2( | ||
5119 | function (n, string) { | ||
5120 | return (n < 1) ? string : A3( | ||
5121 | $elm$core$String$slice, | ||
5122 | n, | ||
5123 | $elm$core$String$length(string), | ||
5124 | string); | ||
5125 | }); | ||
5126 | var $elm$core$String$indexes = _String_indexes; | ||
5127 | var $elm$core$String$isEmpty = function (string) { | ||
5128 | return string === ''; | ||
5129 | }; | ||
5130 | var $elm$core$String$left = F2( | ||
5131 | function (n, string) { | ||
5132 | return (n < 1) ? '' : A3($elm$core$String$slice, 0, n, string); | ||
5133 | }); | ||
5134 | var $elm$core$String$toInt = _String_toInt; | ||
5135 | var $elm$url$Url$chompBeforePath = F5( | ||
5136 | function (protocol, path, params, frag, str) { | ||
5137 | if ($elm$core$String$isEmpty(str) || A2($elm$core$String$contains, '@', str)) { | ||
5138 | return $elm$core$Maybe$Nothing; | ||
5139 | } else { | ||
5140 | var _v0 = A2($elm$core$String$indexes, ':', str); | ||
5141 | if (!_v0.b) { | ||
5142 | return $elm$core$Maybe$Just( | ||
5143 | A6($elm$url$Url$Url, protocol, str, $elm$core$Maybe$Nothing, path, params, frag)); | ||
5144 | } else { | ||
5145 | if (!_v0.b.b) { | ||
5146 | var i = _v0.a; | ||
5147 | var _v1 = $elm$core$String$toInt( | ||
5148 | A2($elm$core$String$dropLeft, i + 1, str)); | ||
5149 | if (_v1.$ === 'Nothing') { | ||
5150 | return $elm$core$Maybe$Nothing; | ||
5151 | } else { | ||
5152 | var port_ = _v1; | ||
5153 | return $elm$core$Maybe$Just( | ||
5154 | A6( | ||
5155 | $elm$url$Url$Url, | ||
5156 | protocol, | ||
5157 | A2($elm$core$String$left, i, str), | ||
5158 | port_, | ||
5159 | path, | ||
5160 | params, | ||
5161 | frag)); | ||
5162 | } | ||
5163 | } else { | ||
5164 | return $elm$core$Maybe$Nothing; | ||
5165 | } | ||
5166 | } | ||
5167 | } | ||
5168 | }); | ||
5169 | var $elm$url$Url$chompBeforeQuery = F4( | ||
5170 | function (protocol, params, frag, str) { | ||
5171 | if ($elm$core$String$isEmpty(str)) { | ||
5172 | return $elm$core$Maybe$Nothing; | ||
5173 | } else { | ||
5174 | var _v0 = A2($elm$core$String$indexes, '/', str); | ||
5175 | if (!_v0.b) { | ||
5176 | return A5($elm$url$Url$chompBeforePath, protocol, '/', params, frag, str); | ||
5177 | } else { | ||
5178 | var i = _v0.a; | ||
5179 | return A5( | ||
5180 | $elm$url$Url$chompBeforePath, | ||
5181 | protocol, | ||
5182 | A2($elm$core$String$dropLeft, i, str), | ||
5183 | params, | ||
5184 | frag, | ||
5185 | A2($elm$core$String$left, i, str)); | ||
5186 | } | ||
5187 | } | ||
5188 | }); | ||
5189 | var $elm$url$Url$chompBeforeFragment = F3( | ||
5190 | function (protocol, frag, str) { | ||
5191 | if ($elm$core$String$isEmpty(str)) { | ||
5192 | return $elm$core$Maybe$Nothing; | ||
5193 | } else { | ||
5194 | var _v0 = A2($elm$core$String$indexes, '?', str); | ||
5195 | if (!_v0.b) { | ||
5196 | return A4($elm$url$Url$chompBeforeQuery, protocol, $elm$core$Maybe$Nothing, frag, str); | ||
5197 | } else { | ||
5198 | var i = _v0.a; | ||
5199 | return A4( | ||
5200 | $elm$url$Url$chompBeforeQuery, | ||
5201 | protocol, | ||
5202 | $elm$core$Maybe$Just( | ||
5203 | A2($elm$core$String$dropLeft, i + 1, str)), | ||
5204 | frag, | ||
5205 | A2($elm$core$String$left, i, str)); | ||
5206 | } | ||
5207 | } | ||
5208 | }); | ||
5209 | var $elm$url$Url$chompAfterProtocol = F2( | ||
5210 | function (protocol, str) { | ||
5211 | if ($elm$core$String$isEmpty(str)) { | ||
5212 | return $elm$core$Maybe$Nothing; | ||
5213 | } else { | ||
5214 | var _v0 = A2($elm$core$String$indexes, '#', str); | ||
5215 | if (!_v0.b) { | ||
5216 | return A3($elm$url$Url$chompBeforeFragment, protocol, $elm$core$Maybe$Nothing, str); | ||
5217 | } else { | ||
5218 | var i = _v0.a; | ||
5219 | return A3( | ||
5220 | $elm$url$Url$chompBeforeFragment, | ||
5221 | protocol, | ||
5222 | $elm$core$Maybe$Just( | ||
5223 | A2($elm$core$String$dropLeft, i + 1, str)), | ||
5224 | A2($elm$core$String$left, i, str)); | ||
5225 | } | ||
5226 | } | ||
5227 | }); | ||
5228 | var $elm$core$String$startsWith = _String_startsWith; | ||
5229 | var $elm$url$Url$fromString = function (str) { | ||
5230 | return A2($elm$core$String$startsWith, 'http://', str) ? A2( | ||
5231 | $elm$url$Url$chompAfterProtocol, | ||
5232 | $elm$url$Url$Http, | ||
5233 | A2($elm$core$String$dropLeft, 7, str)) : (A2($elm$core$String$startsWith, 'https://', str) ? A2( | ||
5234 | $elm$url$Url$chompAfterProtocol, | ||
5235 | $elm$url$Url$Https, | ||
5236 | A2($elm$core$String$dropLeft, 8, str)) : $elm$core$Maybe$Nothing); | ||
5237 | }; | ||
5238 | var $elm$core$Basics$never = function (_v0) { | ||
5239 | never: | ||
5240 | while (true) { | ||
5241 | var nvr = _v0.a; | ||
5242 | var $temp$_v0 = nvr; | ||
5243 | _v0 = $temp$_v0; | ||
5244 | continue never; | ||
5245 | } | ||
5246 | }; | ||
5247 | var $elm$core$Task$Perform = function (a) { | ||
5248 | return {$: 'Perform', a: a}; | ||
5249 | }; | ||
5250 | var $elm$core$Task$succeed = _Scheduler_succeed; | ||
5251 | var $elm$core$Task$init = $elm$core$Task$succeed(_Utils_Tuple0); | ||
5252 | var $elm$core$List$foldrHelper = F4( | ||
5253 | function (fn, acc, ctr, ls) { | ||
5254 | if (!ls.b) { | ||
5255 | return acc; | ||
5256 | } else { | ||
5257 | var a = ls.a; | ||
5258 | var r1 = ls.b; | ||
5259 | if (!r1.b) { | ||
5260 | return A2(fn, a, acc); | ||
5261 | } else { | ||
5262 | var b = r1.a; | ||
5263 | var r2 = r1.b; | ||
5264 | if (!r2.b) { | ||
5265 | return A2( | ||
5266 | fn, | ||
5267 | a, | ||
5268 | A2(fn, b, acc)); | ||
5269 | } else { | ||
5270 | var c = r2.a; | ||
5271 | var r3 = r2.b; | ||
5272 | if (!r3.b) { | ||
5273 | return A2( | ||
5274 | fn, | ||
5275 | a, | ||
5276 | A2( | ||
5277 | fn, | ||
5278 | b, | ||
5279 | A2(fn, c, acc))); | ||
5280 | } else { | ||
5281 | var d = r3.a; | ||
5282 | var r4 = r3.b; | ||
5283 | var res = (ctr > 500) ? A3( | ||
5284 | $elm$core$List$foldl, | ||
5285 | fn, | ||
5286 | acc, | ||
5287 | $elm$core$List$reverse(r4)) : A4($elm$core$List$foldrHelper, fn, acc, ctr + 1, r4); | ||
5288 | return A2( | ||
5289 | fn, | ||
5290 | a, | ||
5291 | A2( | ||
5292 | fn, | ||
5293 | b, | ||
5294 | A2( | ||
5295 | fn, | ||
5296 | c, | ||
5297 | A2(fn, d, res)))); | ||
5298 | } | ||
5299 | } | ||
5300 | } | ||
5301 | } | ||
5302 | }); | ||
5303 | var $elm$core$List$foldr = F3( | ||
5304 | function (fn, acc, ls) { | ||
5305 | return A4($elm$core$List$foldrHelper, fn, acc, 0, ls); | ||
5306 | }); | ||
5307 | var $elm$core$List$map = F2( | ||
5308 | function (f, xs) { | ||
5309 | return A3( | ||
5310 | $elm$core$List$foldr, | ||
5311 | F2( | ||
5312 | function (x, acc) { | ||
5313 | return A2( | ||
5314 | $elm$core$List$cons, | ||
5315 | f(x), | ||
5316 | acc); | ||
5317 | }), | ||
5318 | _List_Nil, | ||
5319 | xs); | ||
5320 | }); | ||
5321 | var $elm$core$Task$andThen = _Scheduler_andThen; | ||
5322 | var $elm$core$Task$map = F2( | ||
5323 | function (func, taskA) { | ||
5324 | return A2( | ||
5325 | $elm$core$Task$andThen, | ||
5326 | function (a) { | ||
5327 | return $elm$core$Task$succeed( | ||
5328 | func(a)); | ||
5329 | }, | ||
5330 | taskA); | ||
5331 | }); | ||
5332 | var $elm$core$Task$map2 = F3( | ||
5333 | function (func, taskA, taskB) { | ||
5334 | return A2( | ||
5335 | $elm$core$Task$andThen, | ||
5336 | function (a) { | ||
5337 | return A2( | ||
5338 | $elm$core$Task$andThen, | ||
5339 | function (b) { | ||
5340 | return $elm$core$Task$succeed( | ||
5341 | A2(func, a, b)); | ||
5342 | }, | ||
5343 | taskB); | ||
5344 | }, | ||
5345 | taskA); | ||
5346 | }); | ||
5347 | var $elm$core$Task$sequence = function (tasks) { | ||
5348 | return A3( | ||
5349 | $elm$core$List$foldr, | ||
5350 | $elm$core$Task$map2($elm$core$List$cons), | ||
5351 | $elm$core$Task$succeed(_List_Nil), | ||
5352 | tasks); | ||
5353 | }; | ||
5354 | var $elm$core$Platform$sendToApp = _Platform_sendToApp; | ||
5355 | var $elm$core$Task$spawnCmd = F2( | ||
5356 | function (router, _v0) { | ||
5357 | var task = _v0.a; | ||
5358 | return _Scheduler_spawn( | ||
5359 | A2( | ||
5360 | $elm$core$Task$andThen, | ||
5361 | $elm$core$Platform$sendToApp(router), | ||
5362 | task)); | ||
5363 | }); | ||
5364 | var $elm$core$Task$onEffects = F3( | ||
5365 | function (router, commands, state) { | ||
5366 | return A2( | ||
5367 | $elm$core$Task$map, | ||
5368 | function (_v0) { | ||
5369 | return _Utils_Tuple0; | ||
5370 | }, | ||
5371 | $elm$core$Task$sequence( | ||
5372 | A2( | ||
5373 | $elm$core$List$map, | ||
5374 | $elm$core$Task$spawnCmd(router), | ||
5375 | commands))); | ||
5376 | }); | ||
5377 | var $elm$core$Task$onSelfMsg = F3( | ||
5378 | function (_v0, _v1, _v2) { | ||
5379 | return $elm$core$Task$succeed(_Utils_Tuple0); | ||
5380 | }); | ||
5381 | var $elm$core$Task$cmdMap = F2( | ||
5382 | function (tagger, _v0) { | ||
5383 | var task = _v0.a; | ||
5384 | return $elm$core$Task$Perform( | ||
5385 | A2($elm$core$Task$map, tagger, task)); | ||
5386 | }); | ||
5387 | _Platform_effectManagers['Task'] = _Platform_createManager($elm$core$Task$init, $elm$core$Task$onEffects, $elm$core$Task$onSelfMsg, $elm$core$Task$cmdMap); | ||
5388 | var $elm$core$Task$command = _Platform_leaf('Task'); | ||
5389 | var $elm$core$Task$perform = F2( | ||
5390 | function (toMessage, task) { | ||
5391 | return $elm$core$Task$command( | ||
5392 | $elm$core$Task$Perform( | ||
5393 | A2($elm$core$Task$map, toMessage, task))); | ||
5394 | }); | ||
5395 | var $elm$browser$Browser$application = _Browser_application; | ||
5396 | var $author$project$Main$HomePage = {$: 'HomePage'}; | ||
5397 | var $author$project$Main$Model = F9( | ||
5398 | function (key, url, location, loginModel, catalogModel, productModel, signupModel, cartModel, checkoutModel) { | ||
5399 | return {cartModel: cartModel, catalogModel: catalogModel, checkoutModel: checkoutModel, key: key, location: location, loginModel: loginModel, productModel: productModel, signupModel: signupModel, url: url}; | ||
5400 | }); | ||
5401 | var $author$project$Cart$Model = F2( | ||
5402 | function (pageStatus, products) { | ||
5403 | return {pageStatus: pageStatus, products: products}; | ||
5404 | }); | ||
5405 | var $author$project$Cart$NotLoaded = {$: 'NotLoaded'}; | ||
5406 | var $author$project$Cart$init = A2($author$project$Cart$Model, $author$project$Cart$NotLoaded, _List_Nil); | ||
5407 | var $author$project$Catalog$Model = F3( | ||
5408 | function (pageStatus, products, filters) { | ||
5409 | return {filters: filters, pageStatus: pageStatus, products: products}; | ||
5410 | }); | ||
5411 | var $author$project$Catalog$NotLoaded = {$: 'NotLoaded'}; | ||
5412 | var $author$project$Catalog$Filters = F2( | ||
5413 | function (price, rating) { | ||
5414 | return {price: price, rating: rating}; | ||
5415 | }); | ||
5416 | var $elm$core$Basics$negate = function (n) { | ||
5417 | return -n; | ||
5418 | }; | ||
5419 | var $author$project$Catalog$defaultFilters = A2( | ||
5420 | $author$project$Catalog$Filters, | ||
5421 | _Utils_Tuple2(-1, 100000), | ||
5422 | _Utils_Tuple2(0, 5)); | ||
5423 | var $author$project$Catalog$init = A3($author$project$Catalog$Model, $author$project$Catalog$NotLoaded, _List_Nil, $author$project$Catalog$defaultFilters); | ||
5424 | var $author$project$Checkout$Model = F3( | ||
5425 | function (pageStatus, paymentMode, cartTotal) { | ||
5426 | return {cartTotal: cartTotal, pageStatus: pageStatus, paymentMode: paymentMode}; | ||
5427 | }); | ||
5428 | var $author$project$Checkout$NotLoaded = {$: 'NotLoaded'}; | ||
5429 | var $author$project$Checkout$init = A3($author$project$Checkout$Model, $author$project$Checkout$NotLoaded, 'Cash', 0); | ||
5430 | var $author$project$Login$Model = F3( | ||
5431 | function (username, password, loginStatus) { | ||
5432 | return {loginStatus: loginStatus, password: password, username: username}; | ||
5433 | }); | ||
5434 | var $author$project$Login$NotLoggedIn = {$: 'NotLoggedIn'}; | ||
5435 | var $author$project$Login$init = A3($author$project$Login$Model, '', '', $author$project$Login$NotLoggedIn); | ||
5436 | var $author$project$Product$Model = F6( | ||
5437 | function (pageStatus, listing, ratings, ratingStars, ratingText, addRatingStatus) { | ||
5438 | return {addRatingStatus: addRatingStatus, listing: listing, pageStatus: pageStatus, ratingStars: ratingStars, ratingText: ratingText, ratings: ratings}; | ||
5439 | }); | ||
5440 | var $author$project$Product$NotLoaded = {$: 'NotLoaded'}; | ||
5441 | var $author$project$Product$NotSubmitted = {$: 'NotSubmitted'}; | ||
5442 | var $author$project$Product$Product = F7( | ||
5443 | function (id, name, kind, price, description, src, iosSrc) { | ||
5444 | return {description: description, id: id, iosSrc: iosSrc, kind: kind, name: name, price: price, src: src}; | ||
5445 | }); | ||
5446 | var $author$project$Product$emptyProduct = A7($author$project$Product$Product, -1, '', $elm$core$Maybe$Nothing, 0, $elm$core$Maybe$Nothing, '', ''); | ||
5447 | var $author$project$Product$init = A6($author$project$Product$Model, $author$project$Product$NotLoaded, $author$project$Product$emptyProduct, _List_Nil, 5, '', $author$project$Product$NotSubmitted); | ||
5448 | var $author$project$Signup$Empty = {$: 'Empty'}; | ||
5449 | var $author$project$Signup$Model = F6( | ||
5450 | function (username, password, phoneNumber, emailId, address, status) { | ||
5451 | return {address: address, emailId: emailId, password: password, phoneNumber: phoneNumber, status: status, username: username}; | ||
5452 | }); | ||
5453 | var $author$project$Signup$init = A6($author$project$Signup$Model, '', '', '', '', $elm$core$Maybe$Nothing, $author$project$Signup$Empty); | ||
5454 | var $elm$core$Platform$Cmd$batch = _Platform_batch; | ||
5455 | var $elm$core$Platform$Cmd$none = $elm$core$Platform$Cmd$batch(_List_Nil); | ||
5456 | var $author$project$Main$init = F3( | ||
5457 | function (flags, url, key) { | ||
5458 | var start = $author$project$Main$HomePage; | ||
5459 | var signup = $author$project$Signup$init; | ||
5460 | var product = $author$project$Product$init; | ||
5461 | var login = $author$project$Login$init; | ||
5462 | var checkout = $author$project$Checkout$init; | ||
5463 | var catalog = $author$project$Catalog$init; | ||
5464 | var cart = $author$project$Cart$init; | ||
5465 | return _Utils_Tuple2( | ||
5466 | A9($author$project$Main$Model, key, url, start, login, catalog, product, signup, cart, checkout), | ||
5467 | $elm$core$Platform$Cmd$none); | ||
5468 | }); | ||
5469 | var $elm$core$Platform$Sub$batch = _Platform_batch; | ||
5470 | var $elm$core$Platform$Sub$none = $elm$core$Platform$Sub$batch(_List_Nil); | ||
5471 | var $author$project$Main$subscriptions = function (_v0) { | ||
5472 | return $elm$core$Platform$Sub$none; | ||
5473 | }; | ||
5474 | var $author$project$Main$CartMessage = function (a) { | ||
5475 | return {$: 'CartMessage', a: a}; | ||
5476 | }; | ||
5477 | var $author$project$Main$CartPage = {$: 'CartPage'}; | ||
5478 | var $author$project$Main$CatalogMessage = function (a) { | ||
5479 | return {$: 'CatalogMessage', a: a}; | ||
5480 | }; | ||
5481 | var $author$project$Main$CatalogPage = {$: 'CatalogPage'}; | ||
5482 | var $author$project$Main$CheckoutMessage = function (a) { | ||
5483 | return {$: 'CheckoutMessage', a: a}; | ||
5484 | }; | ||
5485 | var $author$project$Main$CheckoutPage = {$: 'CheckoutPage'}; | ||
5486 | var $author$project$Main$LoginMessage = function (a) { | ||
5487 | return {$: 'LoginMessage', a: a}; | ||
5488 | }; | ||
5489 | var $author$project$Main$NotFoundPage = {$: 'NotFoundPage'}; | ||
5490 | var $author$project$Main$ProductMessage = function (a) { | ||
5491 | return {$: 'ProductMessage', a: a}; | ||
5492 | }; | ||
5493 | var $author$project$Main$ProductPage = function (a) { | ||
5494 | return {$: 'ProductPage', a: a}; | ||
5495 | }; | ||
5496 | var $author$project$Main$SignupMessage = function (a) { | ||
5497 | return {$: 'SignupMessage', a: a}; | ||
5498 | }; | ||
5499 | var $author$project$Checkout$AmountLoaded = function (a) { | ||
5500 | return {$: 'AmountLoaded', a: a}; | ||
5501 | }; | ||
5502 | var $elm$http$Http$BadStatus_ = F2( | ||
5503 | function (a, b) { | ||
5504 | return {$: 'BadStatus_', a: a, b: b}; | ||
5505 | }); | ||
5506 | var $elm$http$Http$BadUrl_ = function (a) { | ||
5507 | return {$: 'BadUrl_', a: a}; | ||
5508 | }; | ||
5509 | var $elm$http$Http$GoodStatus_ = F2( | ||
5510 | function (a, b) { | ||
5511 | return {$: 'GoodStatus_', a: a, b: b}; | ||
5512 | }); | ||
5513 | var $elm$http$Http$NetworkError_ = {$: 'NetworkError_'}; | ||
5514 | var $elm$http$Http$Receiving = function (a) { | ||
5515 | return {$: 'Receiving', a: a}; | ||
5516 | }; | ||
5517 | var $elm$http$Http$Sending = function (a) { | ||
5518 | return {$: 'Sending', a: a}; | ||
5519 | }; | ||
5520 | var $elm$http$Http$Timeout_ = {$: 'Timeout_'}; | ||
5521 | var $elm$core$Dict$RBEmpty_elm_builtin = {$: 'RBEmpty_elm_builtin'}; | ||
5522 | var $elm$core$Dict$empty = $elm$core$Dict$RBEmpty_elm_builtin; | ||
5523 | var $elm$core$Maybe$isJust = function (maybe) { | ||
5524 | if (maybe.$ === 'Just') { | ||
5525 | return true; | ||
5526 | } else { | ||
5527 | return false; | ||
5528 | } | ||
5529 | }; | ||
5530 | var $elm$core$Platform$sendToSelf = _Platform_sendToSelf; | ||
5531 | var $elm$core$Basics$compare = _Utils_compare; | ||
5532 | var $elm$core$Dict$get = F2( | ||
5533 | function (targetKey, dict) { | ||
5534 | get: | ||
5535 | while (true) { | ||
5536 | if (dict.$ === 'RBEmpty_elm_builtin') { | ||
5537 | return $elm$core$Maybe$Nothing; | ||
5538 | } else { | ||
5539 | var key = dict.b; | ||
5540 | var value = dict.c; | ||
5541 | var left = dict.d; | ||
5542 | var right = dict.e; | ||
5543 | var _v1 = A2($elm$core$Basics$compare, targetKey, key); | ||
5544 | switch (_v1.$) { | ||
5545 | case 'LT': | ||
5546 | var $temp$targetKey = targetKey, | ||
5547 | $temp$dict = left; | ||
5548 | targetKey = $temp$targetKey; | ||
5549 | dict = $temp$dict; | ||
5550 | continue get; | ||
5551 | case 'EQ': | ||
5552 | return $elm$core$Maybe$Just(value); | ||
5553 | default: | ||
5554 | var $temp$targetKey = targetKey, | ||
5555 | $temp$dict = right; | ||
5556 | targetKey = $temp$targetKey; | ||
5557 | dict = $temp$dict; | ||
5558 | continue get; | ||
5559 | } | ||
5560 | } | ||
5561 | } | ||
5562 | }); | ||
5563 | var $elm$core$Dict$Black = {$: 'Black'}; | ||
5564 | var $elm$core$Dict$RBNode_elm_builtin = F5( | ||
5565 | function (a, b, c, d, e) { | ||
5566 | return {$: 'RBNode_elm_builtin', a: a, b: b, c: c, d: d, e: e}; | ||
5567 | }); | ||
5568 | var $elm$core$Dict$Red = {$: 'Red'}; | ||
5569 | var $elm$core$Dict$balance = F5( | ||
5570 | function (color, key, value, left, right) { | ||
5571 | if ((right.$ === 'RBNode_elm_builtin') && (right.a.$ === 'Red')) { | ||
5572 | var _v1 = right.a; | ||
5573 | var rK = right.b; | ||
5574 | var rV = right.c; | ||
5575 | var rLeft = right.d; | ||
5576 | var rRight = right.e; | ||
5577 | if ((left.$ === 'RBNode_elm_builtin') && (left.a.$ === 'Red')) { | ||
5578 | var _v3 = left.a; | ||
5579 | var lK = left.b; | ||
5580 | var lV = left.c; | ||
5581 | var lLeft = left.d; | ||
5582 | var lRight = left.e; | ||
5583 | return A5( | ||
5584 | $elm$core$Dict$RBNode_elm_builtin, | ||
5585 | $elm$core$Dict$Red, | ||
5586 | key, | ||
5587 | value, | ||
5588 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Black, lK, lV, lLeft, lRight), | ||
5589 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Black, rK, rV, rLeft, rRight)); | ||
5590 | } else { | ||
5591 | return A5( | ||
5592 | $elm$core$Dict$RBNode_elm_builtin, | ||
5593 | color, | ||
5594 | rK, | ||
5595 | rV, | ||
5596 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Red, key, value, left, rLeft), | ||
5597 | rRight); | ||
5598 | } | ||
5599 | } else { | ||
5600 | if ((((left.$ === 'RBNode_elm_builtin') && (left.a.$ === 'Red')) && (left.d.$ === 'RBNode_elm_builtin')) && (left.d.a.$ === 'Red')) { | ||
5601 | var _v5 = left.a; | ||
5602 | var lK = left.b; | ||
5603 | var lV = left.c; | ||
5604 | var _v6 = left.d; | ||
5605 | var _v7 = _v6.a; | ||
5606 | var llK = _v6.b; | ||
5607 | var llV = _v6.c; | ||
5608 | var llLeft = _v6.d; | ||
5609 | var llRight = _v6.e; | ||
5610 | var lRight = left.e; | ||
5611 | return A5( | ||
5612 | $elm$core$Dict$RBNode_elm_builtin, | ||
5613 | $elm$core$Dict$Red, | ||
5614 | lK, | ||
5615 | lV, | ||
5616 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Black, llK, llV, llLeft, llRight), | ||
5617 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Black, key, value, lRight, right)); | ||
5618 | } else { | ||
5619 | return A5($elm$core$Dict$RBNode_elm_builtin, color, key, value, left, right); | ||
5620 | } | ||
5621 | } | ||
5622 | }); | ||
5623 | var $elm$core$Dict$insertHelp = F3( | ||
5624 | function (key, value, dict) { | ||
5625 | if (dict.$ === 'RBEmpty_elm_builtin') { | ||
5626 | return A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Red, key, value, $elm$core$Dict$RBEmpty_elm_builtin, $elm$core$Dict$RBEmpty_elm_builtin); | ||
5627 | } else { | ||
5628 | var nColor = dict.a; | ||
5629 | var nKey = dict.b; | ||
5630 | var nValue = dict.c; | ||
5631 | var nLeft = dict.d; | ||
5632 | var nRight = dict.e; | ||
5633 | var _v1 = A2($elm$core$Basics$compare, key, nKey); | ||
5634 | switch (_v1.$) { | ||
5635 | case 'LT': | ||
5636 | return A5( | ||
5637 | $elm$core$Dict$balance, | ||
5638 | nColor, | ||
5639 | nKey, | ||
5640 | nValue, | ||
5641 | A3($elm$core$Dict$insertHelp, key, value, nLeft), | ||
5642 | nRight); | ||
5643 | case 'EQ': | ||
5644 | return A5($elm$core$Dict$RBNode_elm_builtin, nColor, nKey, value, nLeft, nRight); | ||
5645 | default: | ||
5646 | return A5( | ||
5647 | $elm$core$Dict$balance, | ||
5648 | nColor, | ||
5649 | nKey, | ||
5650 | nValue, | ||
5651 | nLeft, | ||
5652 | A3($elm$core$Dict$insertHelp, key, value, nRight)); | ||
5653 | } | ||
5654 | } | ||
5655 | }); | ||
5656 | var $elm$core$Dict$insert = F3( | ||
5657 | function (key, value, dict) { | ||
5658 | var _v0 = A3($elm$core$Dict$insertHelp, key, value, dict); | ||
5659 | if ((_v0.$ === 'RBNode_elm_builtin') && (_v0.a.$ === 'Red')) { | ||
5660 | var _v1 = _v0.a; | ||
5661 | var k = _v0.b; | ||
5662 | var v = _v0.c; | ||
5663 | var l = _v0.d; | ||
5664 | var r = _v0.e; | ||
5665 | return A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Black, k, v, l, r); | ||
5666 | } else { | ||
5667 | var x = _v0; | ||
5668 | return x; | ||
5669 | } | ||
5670 | }); | ||
5671 | var $elm$core$Dict$getMin = function (dict) { | ||
5672 | getMin: | ||
5673 | while (true) { | ||
5674 | if ((dict.$ === 'RBNode_elm_builtin') && (dict.d.$ === 'RBNode_elm_builtin')) { | ||
5675 | var left = dict.d; | ||
5676 | var $temp$dict = left; | ||
5677 | dict = $temp$dict; | ||
5678 | continue getMin; | ||
5679 | } else { | ||
5680 | return dict; | ||
5681 | } | ||
5682 | } | ||
5683 | }; | ||
5684 | var $elm$core$Dict$moveRedLeft = function (dict) { | ||
5685 | if (((dict.$ === 'RBNode_elm_builtin') && (dict.d.$ === 'RBNode_elm_builtin')) && (dict.e.$ === 'RBNode_elm_builtin')) { | ||
5686 | if ((dict.e.d.$ === 'RBNode_elm_builtin') && (dict.e.d.a.$ === 'Red')) { | ||
5687 | var clr = dict.a; | ||
5688 | var k = dict.b; | ||
5689 | var v = dict.c; | ||
5690 | var _v1 = dict.d; | ||
5691 | var lClr = _v1.a; | ||
5692 | var lK = _v1.b; | ||
5693 | var lV = _v1.c; | ||
5694 | var lLeft = _v1.d; | ||
5695 | var lRight = _v1.e; | ||
5696 | var _v2 = dict.e; | ||
5697 | var rClr = _v2.a; | ||
5698 | var rK = _v2.b; | ||
5699 | var rV = _v2.c; | ||
5700 | var rLeft = _v2.d; | ||
5701 | var _v3 = rLeft.a; | ||
5702 | var rlK = rLeft.b; | ||
5703 | var rlV = rLeft.c; | ||
5704 | var rlL = rLeft.d; | ||
5705 | var rlR = rLeft.e; | ||
5706 | var rRight = _v2.e; | ||
5707 | return A5( | ||
5708 | $elm$core$Dict$RBNode_elm_builtin, | ||
5709 | $elm$core$Dict$Red, | ||
5710 | rlK, | ||
5711 | rlV, | ||
5712 | A5( | ||
5713 | $elm$core$Dict$RBNode_elm_builtin, | ||
5714 | $elm$core$Dict$Black, | ||
5715 | k, | ||
5716 | v, | ||
5717 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Red, lK, lV, lLeft, lRight), | ||
5718 | rlL), | ||
5719 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Black, rK, rV, rlR, rRight)); | ||
5720 | } else { | ||
5721 | var clr = dict.a; | ||
5722 | var k = dict.b; | ||
5723 | var v = dict.c; | ||
5724 | var _v4 = dict.d; | ||
5725 | var lClr = _v4.a; | ||
5726 | var lK = _v4.b; | ||
5727 | var lV = _v4.c; | ||
5728 | var lLeft = _v4.d; | ||
5729 | var lRight = _v4.e; | ||
5730 | var _v5 = dict.e; | ||
5731 | var rClr = _v5.a; | ||
5732 | var rK = _v5.b; | ||
5733 | var rV = _v5.c; | ||
5734 | var rLeft = _v5.d; | ||
5735 | var rRight = _v5.e; | ||
5736 | if (clr.$ === 'Black') { | ||
5737 | return A5( | ||
5738 | $elm$core$Dict$RBNode_elm_builtin, | ||
5739 | $elm$core$Dict$Black, | ||
5740 | k, | ||
5741 | v, | ||
5742 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Red, lK, lV, lLeft, lRight), | ||
5743 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Red, rK, rV, rLeft, rRight)); | ||
5744 | } else { | ||
5745 | return A5( | ||
5746 | $elm$core$Dict$RBNode_elm_builtin, | ||
5747 | $elm$core$Dict$Black, | ||
5748 | k, | ||
5749 | v, | ||
5750 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Red, lK, lV, lLeft, lRight), | ||
5751 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Red, rK, rV, rLeft, rRight)); | ||
5752 | } | ||
5753 | } | ||
5754 | } else { | ||
5755 | return dict; | ||
5756 | } | ||
5757 | }; | ||
5758 | var $elm$core$Dict$moveRedRight = function (dict) { | ||
5759 | if (((dict.$ === 'RBNode_elm_builtin') && (dict.d.$ === 'RBNode_elm_builtin')) && (dict.e.$ === 'RBNode_elm_builtin')) { | ||
5760 | if ((dict.d.d.$ === 'RBNode_elm_builtin') && (dict.d.d.a.$ === 'Red')) { | ||
5761 | var clr = dict.a; | ||
5762 | var k = dict.b; | ||
5763 | var v = dict.c; | ||
5764 | var _v1 = dict.d; | ||
5765 | var lClr = _v1.a; | ||
5766 | var lK = _v1.b; | ||
5767 | var lV = _v1.c; | ||
5768 | var _v2 = _v1.d; | ||
5769 | var _v3 = _v2.a; | ||
5770 | var llK = _v2.b; | ||
5771 | var llV = _v2.c; | ||
5772 | var llLeft = _v2.d; | ||
5773 | var llRight = _v2.e; | ||
5774 | var lRight = _v1.e; | ||
5775 | var _v4 = dict.e; | ||
5776 | var rClr = _v4.a; | ||
5777 | var rK = _v4.b; | ||
5778 | var rV = _v4.c; | ||
5779 | var rLeft = _v4.d; | ||
5780 | var rRight = _v4.e; | ||
5781 | return A5( | ||
5782 | $elm$core$Dict$RBNode_elm_builtin, | ||
5783 | $elm$core$Dict$Red, | ||
5784 | lK, | ||
5785 | lV, | ||
5786 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Black, llK, llV, llLeft, llRight), | ||
5787 | A5( | ||
5788 | $elm$core$Dict$RBNode_elm_builtin, | ||
5789 | $elm$core$Dict$Black, | ||
5790 | k, | ||
5791 | v, | ||
5792 | lRight, | ||
5793 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Red, rK, rV, rLeft, rRight))); | ||
5794 | } else { | ||
5795 | var clr = dict.a; | ||
5796 | var k = dict.b; | ||
5797 | var v = dict.c; | ||
5798 | var _v5 = dict.d; | ||
5799 | var lClr = _v5.a; | ||
5800 | var lK = _v5.b; | ||
5801 | var lV = _v5.c; | ||
5802 | var lLeft = _v5.d; | ||
5803 | var lRight = _v5.e; | ||
5804 | var _v6 = dict.e; | ||
5805 | var rClr = _v6.a; | ||
5806 | var rK = _v6.b; | ||
5807 | var rV = _v6.c; | ||
5808 | var rLeft = _v6.d; | ||
5809 | var rRight = _v6.e; | ||
5810 | if (clr.$ === 'Black') { | ||
5811 | return A5( | ||
5812 | $elm$core$Dict$RBNode_elm_builtin, | ||
5813 | $elm$core$Dict$Black, | ||
5814 | k, | ||
5815 | v, | ||
5816 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Red, lK, lV, lLeft, lRight), | ||
5817 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Red, rK, rV, rLeft, rRight)); | ||
5818 | } else { | ||
5819 | return A5( | ||
5820 | $elm$core$Dict$RBNode_elm_builtin, | ||
5821 | $elm$core$Dict$Black, | ||
5822 | k, | ||
5823 | v, | ||
5824 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Red, lK, lV, lLeft, lRight), | ||
5825 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Red, rK, rV, rLeft, rRight)); | ||
5826 | } | ||
5827 | } | ||
5828 | } else { | ||
5829 | return dict; | ||
5830 | } | ||
5831 | }; | ||
5832 | var $elm$core$Dict$removeHelpPrepEQGT = F7( | ||
5833 | function (targetKey, dict, color, key, value, left, right) { | ||
5834 | if ((left.$ === 'RBNode_elm_builtin') && (left.a.$ === 'Red')) { | ||
5835 | var _v1 = left.a; | ||
5836 | var lK = left.b; | ||
5837 | var lV = left.c; | ||
5838 | var lLeft = left.d; | ||
5839 | var lRight = left.e; | ||
5840 | return A5( | ||
5841 | $elm$core$Dict$RBNode_elm_builtin, | ||
5842 | color, | ||
5843 | lK, | ||
5844 | lV, | ||
5845 | lLeft, | ||
5846 | A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Red, key, value, lRight, right)); | ||
5847 | } else { | ||
5848 | _v2$2: | ||
5849 | while (true) { | ||
5850 | if ((right.$ === 'RBNode_elm_builtin') && (right.a.$ === 'Black')) { | ||
5851 | if (right.d.$ === 'RBNode_elm_builtin') { | ||
5852 | if (right.d.a.$ === 'Black') { | ||
5853 | var _v3 = right.a; | ||
5854 | var _v4 = right.d; | ||
5855 | var _v5 = _v4.a; | ||
5856 | return $elm$core$Dict$moveRedRight(dict); | ||
5857 | } else { | ||
5858 | break _v2$2; | ||
5859 | } | ||
5860 | } else { | ||
5861 | var _v6 = right.a; | ||
5862 | var _v7 = right.d; | ||
5863 | return $elm$core$Dict$moveRedRight(dict); | ||
5864 | } | ||
5865 | } else { | ||
5866 | break _v2$2; | ||
5867 | } | ||
5868 | } | ||
5869 | return dict; | ||
5870 | } | ||
5871 | }); | ||
5872 | var $elm$core$Dict$removeMin = function (dict) { | ||
5873 | if ((dict.$ === 'RBNode_elm_builtin') && (dict.d.$ === 'RBNode_elm_builtin')) { | ||
5874 | var color = dict.a; | ||
5875 | var key = dict.b; | ||
5876 | var value = dict.c; | ||
5877 | var left = dict.d; | ||
5878 | var lColor = left.a; | ||
5879 | var lLeft = left.d; | ||
5880 | var right = dict.e; | ||
5881 | if (lColor.$ === 'Black') { | ||
5882 | if ((lLeft.$ === 'RBNode_elm_builtin') && (lLeft.a.$ === 'Red')) { | ||
5883 | var _v3 = lLeft.a; | ||
5884 | return A5( | ||
5885 | $elm$core$Dict$RBNode_elm_builtin, | ||
5886 | color, | ||
5887 | key, | ||
5888 | value, | ||
5889 | $elm$core$Dict$removeMin(left), | ||
5890 | right); | ||
5891 | } else { | ||
5892 | var _v4 = $elm$core$Dict$moveRedLeft(dict); | ||
5893 | if (_v4.$ === 'RBNode_elm_builtin') { | ||
5894 | var nColor = _v4.a; | ||
5895 | var nKey = _v4.b; | ||
5896 | var nValue = _v4.c; | ||
5897 | var nLeft = _v4.d; | ||
5898 | var nRight = _v4.e; | ||
5899 | return A5( | ||
5900 | $elm$core$Dict$balance, | ||
5901 | nColor, | ||
5902 | nKey, | ||
5903 | nValue, | ||
5904 | $elm$core$Dict$removeMin(nLeft), | ||
5905 | nRight); | ||
5906 | } else { | ||
5907 | return $elm$core$Dict$RBEmpty_elm_builtin; | ||
5908 | } | ||
5909 | } | ||
5910 | } else { | ||
5911 | return A5( | ||
5912 | $elm$core$Dict$RBNode_elm_builtin, | ||
5913 | color, | ||
5914 | key, | ||
5915 | value, | ||
5916 | $elm$core$Dict$removeMin(left), | ||
5917 | right); | ||
5918 | } | ||
5919 | } else { | ||
5920 | return $elm$core$Dict$RBEmpty_elm_builtin; | ||
5921 | } | ||
5922 | }; | ||
5923 | var $elm$core$Dict$removeHelp = F2( | ||
5924 | function (targetKey, dict) { | ||
5925 | if (dict.$ === 'RBEmpty_elm_builtin') { | ||
5926 | return $elm$core$Dict$RBEmpty_elm_builtin; | ||
5927 | } else { | ||
5928 | var color = dict.a; | ||
5929 | var key = dict.b; | ||
5930 | var value = dict.c; | ||
5931 | var left = dict.d; | ||
5932 | var right = dict.e; | ||
5933 | if (_Utils_cmp(targetKey, key) < 0) { | ||
5934 | if ((left.$ === 'RBNode_elm_builtin') && (left.a.$ === 'Black')) { | ||
5935 | var _v4 = left.a; | ||
5936 | var lLeft = left.d; | ||
5937 | if ((lLeft.$ === 'RBNode_elm_builtin') && (lLeft.a.$ === 'Red')) { | ||
5938 | var _v6 = lLeft.a; | ||
5939 | return A5( | ||
5940 | $elm$core$Dict$RBNode_elm_builtin, | ||
5941 | color, | ||
5942 | key, | ||
5943 | value, | ||
5944 | A2($elm$core$Dict$removeHelp, targetKey, left), | ||
5945 | right); | ||
5946 | } else { | ||
5947 | var _v7 = $elm$core$Dict$moveRedLeft(dict); | ||
5948 | if (_v7.$ === 'RBNode_elm_builtin') { | ||
5949 | var nColor = _v7.a; | ||
5950 | var nKey = _v7.b; | ||
5951 | var nValue = _v7.c; | ||
5952 | var nLeft = _v7.d; | ||
5953 | var nRight = _v7.e; | ||
5954 | return A5( | ||
5955 | $elm$core$Dict$balance, | ||
5956 | nColor, | ||
5957 | nKey, | ||
5958 | nValue, | ||
5959 | A2($elm$core$Dict$removeHelp, targetKey, nLeft), | ||
5960 | nRight); | ||
5961 | } else { | ||
5962 | return $elm$core$Dict$RBEmpty_elm_builtin; | ||
5963 | } | ||
5964 | } | ||
5965 | } else { | ||
5966 | return A5( | ||
5967 | $elm$core$Dict$RBNode_elm_builtin, | ||
5968 | color, | ||
5969 | key, | ||
5970 | value, | ||
5971 | A2($elm$core$Dict$removeHelp, targetKey, left), | ||
5972 | right); | ||
5973 | } | ||
5974 | } else { | ||
5975 | return A2( | ||
5976 | $elm$core$Dict$removeHelpEQGT, | ||
5977 | targetKey, | ||
5978 | A7($elm$core$Dict$removeHelpPrepEQGT, targetKey, dict, color, key, value, left, right)); | ||
5979 | } | ||
5980 | } | ||
5981 | }); | ||
5982 | var $elm$core$Dict$removeHelpEQGT = F2( | ||
5983 | function (targetKey, dict) { | ||
5984 | if (dict.$ === 'RBNode_elm_builtin') { | ||
5985 | var color = dict.a; | ||
5986 | var key = dict.b; | ||
5987 | var value = dict.c; | ||
5988 | var left = dict.d; | ||
5989 | var right = dict.e; | ||
5990 | if (_Utils_eq(targetKey, key)) { | ||
5991 | var _v1 = $elm$core$Dict$getMin(right); | ||
5992 | if (_v1.$ === 'RBNode_elm_builtin') { | ||
5993 | var minKey = _v1.b; | ||
5994 | var minValue = _v1.c; | ||
5995 | return A5( | ||
5996 | $elm$core$Dict$balance, | ||
5997 | color, | ||
5998 | minKey, | ||
5999 | minValue, | ||
6000 | left, | ||
6001 | $elm$core$Dict$removeMin(right)); | ||
6002 | } else { | ||
6003 | return $elm$core$Dict$RBEmpty_elm_builtin; | ||
6004 | } | ||
6005 | } else { | ||
6006 | return A5( | ||
6007 | $elm$core$Dict$balance, | ||
6008 | color, | ||
6009 | key, | ||
6010 | value, | ||
6011 | left, | ||
6012 | A2($elm$core$Dict$removeHelp, targetKey, right)); | ||
6013 | } | ||
6014 | } else { | ||
6015 | return $elm$core$Dict$RBEmpty_elm_builtin; | ||
6016 | } | ||
6017 | }); | ||
6018 | var $elm$core$Dict$remove = F2( | ||
6019 | function (key, dict) { | ||
6020 | var _v0 = A2($elm$core$Dict$removeHelp, key, dict); | ||
6021 | if ((_v0.$ === 'RBNode_elm_builtin') && (_v0.a.$ === 'Red')) { | ||
6022 | var _v1 = _v0.a; | ||
6023 | var k = _v0.b; | ||
6024 | var v = _v0.c; | ||
6025 | var l = _v0.d; | ||
6026 | var r = _v0.e; | ||
6027 | return A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Black, k, v, l, r); | ||
6028 | } else { | ||
6029 | var x = _v0; | ||
6030 | return x; | ||
6031 | } | ||
6032 | }); | ||
6033 | var $elm$core$Dict$update = F3( | ||
6034 | function (targetKey, alter, dictionary) { | ||
6035 | var _v0 = alter( | ||
6036 | A2($elm$core$Dict$get, targetKey, dictionary)); | ||
6037 | if (_v0.$ === 'Just') { | ||
6038 | var value = _v0.a; | ||
6039 | return A3($elm$core$Dict$insert, targetKey, value, dictionary); | ||
6040 | } else { | ||
6041 | return A2($elm$core$Dict$remove, targetKey, dictionary); | ||
6042 | } | ||
6043 | }); | ||
6044 | var $elm$http$Http$emptyBody = _Http_emptyBody; | ||
6045 | var $elm$json$Json$Decode$decodeString = _Json_runOnString; | ||
6046 | var $elm$core$Basics$composeR = F3( | ||
6047 | function (f, g, x) { | ||
6048 | return g( | ||
6049 | f(x)); | ||
6050 | }); | ||
6051 | var $elm$http$Http$expectStringResponse = F2( | ||
6052 | function (toMsg, toResult) { | ||
6053 | return A3( | ||
6054 | _Http_expect, | ||
6055 | '', | ||
6056 | $elm$core$Basics$identity, | ||
6057 | A2($elm$core$Basics$composeR, toResult, toMsg)); | ||
6058 | }); | ||
6059 | var $elm$core$Result$mapError = F2( | ||
6060 | function (f, result) { | ||
6061 | if (result.$ === 'Ok') { | ||
6062 | var v = result.a; | ||
6063 | return $elm$core$Result$Ok(v); | ||
6064 | } else { | ||
6065 | var e = result.a; | ||
6066 | return $elm$core$Result$Err( | ||
6067 | f(e)); | ||
6068 | } | ||
6069 | }); | ||
6070 | var $elm$http$Http$BadBody = function (a) { | ||
6071 | return {$: 'BadBody', a: a}; | ||
6072 | }; | ||
6073 | var $elm$http$Http$BadStatus = function (a) { | ||
6074 | return {$: 'BadStatus', a: a}; | ||
6075 | }; | ||
6076 | var $elm$http$Http$BadUrl = function (a) { | ||
6077 | return {$: 'BadUrl', a: a}; | ||
6078 | }; | ||
6079 | var $elm$http$Http$NetworkError = {$: 'NetworkError'}; | ||
6080 | var $elm$http$Http$Timeout = {$: 'Timeout'}; | ||
6081 | var $elm$http$Http$resolve = F2( | ||
6082 | function (toResult, response) { | ||
6083 | switch (response.$) { | ||
6084 | case 'BadUrl_': | ||
6085 | var url = response.a; | ||
6086 | return $elm$core$Result$Err( | ||
6087 | $elm$http$Http$BadUrl(url)); | ||
6088 | case 'Timeout_': | ||
6089 | return $elm$core$Result$Err($elm$http$Http$Timeout); | ||
6090 | case 'NetworkError_': | ||
6091 | return $elm$core$Result$Err($elm$http$Http$NetworkError); | ||
6092 | case 'BadStatus_': | ||
6093 | var metadata = response.a; | ||
6094 | return $elm$core$Result$Err( | ||
6095 | $elm$http$Http$BadStatus(metadata.statusCode)); | ||
6096 | default: | ||
6097 | var body = response.b; | ||
6098 | return A2( | ||
6099 | $elm$core$Result$mapError, | ||
6100 | $elm$http$Http$BadBody, | ||
6101 | toResult(body)); | ||
6102 | } | ||
6103 | }); | ||
6104 | var $elm$http$Http$expectJson = F2( | ||
6105 | function (toMsg, decoder) { | ||
6106 | return A2( | ||
6107 | $elm$http$Http$expectStringResponse, | ||
6108 | toMsg, | ||
6109 | $elm$http$Http$resolve( | ||
6110 | function (string) { | ||
6111 | return A2( | ||
6112 | $elm$core$Result$mapError, | ||
6113 | $elm$json$Json$Decode$errorToString, | ||
6114 | A2($elm$json$Json$Decode$decodeString, decoder, string)); | ||
6115 | })); | ||
6116 | }); | ||
6117 | var $elm$json$Json$Decode$float = _Json_decodeFloat; | ||
6118 | var $elm$http$Http$Request = function (a) { | ||
6119 | return {$: 'Request', a: a}; | ||
6120 | }; | ||
6121 | var $elm$http$Http$State = F2( | ||
6122 | function (reqs, subs) { | ||
6123 | return {reqs: reqs, subs: subs}; | ||
6124 | }); | ||
6125 | var $elm$http$Http$init = $elm$core$Task$succeed( | ||
6126 | A2($elm$http$Http$State, $elm$core$Dict$empty, _List_Nil)); | ||
6127 | var $elm$core$Process$kill = _Scheduler_kill; | ||
6128 | var $elm$core$Process$spawn = _Scheduler_spawn; | ||
6129 | var $elm$http$Http$updateReqs = F3( | ||
6130 | function (router, cmds, reqs) { | ||
6131 | updateReqs: | ||
6132 | while (true) { | ||
6133 | if (!cmds.b) { | ||
6134 | return $elm$core$Task$succeed(reqs); | ||
6135 | } else { | ||
6136 | var cmd = cmds.a; | ||
6137 | var otherCmds = cmds.b; | ||
6138 | if (cmd.$ === 'Cancel') { | ||
6139 | var tracker = cmd.a; | ||
6140 | var _v2 = A2($elm$core$Dict$get, tracker, reqs); | ||
6141 | if (_v2.$ === 'Nothing') { | ||
6142 | var $temp$router = router, | ||
6143 | $temp$cmds = otherCmds, | ||
6144 | $temp$reqs = reqs; | ||
6145 | router = $temp$router; | ||
6146 | cmds = $temp$cmds; | ||
6147 | reqs = $temp$reqs; | ||
6148 | continue updateReqs; | ||
6149 | } else { | ||
6150 | var pid = _v2.a; | ||
6151 | return A2( | ||
6152 | $elm$core$Task$andThen, | ||
6153 | function (_v3) { | ||
6154 | return A3( | ||
6155 | $elm$http$Http$updateReqs, | ||
6156 | router, | ||
6157 | otherCmds, | ||
6158 | A2($elm$core$Dict$remove, tracker, reqs)); | ||
6159 | }, | ||
6160 | $elm$core$Process$kill(pid)); | ||
6161 | } | ||
6162 | } else { | ||
6163 | var req = cmd.a; | ||
6164 | return A2( | ||
6165 | $elm$core$Task$andThen, | ||
6166 | function (pid) { | ||
6167 | var _v4 = req.tracker; | ||
6168 | if (_v4.$ === 'Nothing') { | ||
6169 | return A3($elm$http$Http$updateReqs, router, otherCmds, reqs); | ||
6170 | } else { | ||
6171 | var tracker = _v4.a; | ||
6172 | return A3( | ||
6173 | $elm$http$Http$updateReqs, | ||
6174 | router, | ||
6175 | otherCmds, | ||
6176 | A3($elm$core$Dict$insert, tracker, pid, reqs)); | ||
6177 | } | ||
6178 | }, | ||
6179 | $elm$core$Process$spawn( | ||
6180 | A3( | ||
6181 | _Http_toTask, | ||
6182 | router, | ||
6183 | $elm$core$Platform$sendToApp(router), | ||
6184 | req))); | ||
6185 | } | ||
6186 | } | ||
6187 | } | ||
6188 | }); | ||
6189 | var $elm$http$Http$onEffects = F4( | ||
6190 | function (router, cmds, subs, state) { | ||
6191 | return A2( | ||
6192 | $elm$core$Task$andThen, | ||
6193 | function (reqs) { | ||
6194 | return $elm$core$Task$succeed( | ||
6195 | A2($elm$http$Http$State, reqs, subs)); | ||
6196 | }, | ||
6197 | A3($elm$http$Http$updateReqs, router, cmds, state.reqs)); | ||
6198 | }); | ||
6199 | var $elm$core$List$maybeCons = F3( | ||
6200 | function (f, mx, xs) { | ||
6201 | var _v0 = f(mx); | ||
6202 | if (_v0.$ === 'Just') { | ||
6203 | var x = _v0.a; | ||
6204 | return A2($elm$core$List$cons, x, xs); | ||
6205 | } else { | ||
6206 | return xs; | ||
6207 | } | ||
6208 | }); | ||
6209 | var $elm$core$List$filterMap = F2( | ||
6210 | function (f, xs) { | ||
6211 | return A3( | ||
6212 | $elm$core$List$foldr, | ||
6213 | $elm$core$List$maybeCons(f), | ||
6214 | _List_Nil, | ||
6215 | xs); | ||
6216 | }); | ||
6217 | var $elm$http$Http$maybeSend = F4( | ||
6218 | function (router, desiredTracker, progress, _v0) { | ||
6219 | var actualTracker = _v0.a; | ||
6220 | var toMsg = _v0.b; | ||
6221 | return _Utils_eq(desiredTracker, actualTracker) ? $elm$core$Maybe$Just( | ||
6222 | A2( | ||
6223 | $elm$core$Platform$sendToApp, | ||
6224 | router, | ||
6225 | toMsg(progress))) : $elm$core$Maybe$Nothing; | ||
6226 | }); | ||
6227 | var $elm$http$Http$onSelfMsg = F3( | ||
6228 | function (router, _v0, state) { | ||
6229 | var tracker = _v0.a; | ||
6230 | var progress = _v0.b; | ||
6231 | return A2( | ||
6232 | $elm$core$Task$andThen, | ||
6233 | function (_v1) { | ||
6234 | return $elm$core$Task$succeed(state); | ||
6235 | }, | ||
6236 | $elm$core$Task$sequence( | ||
6237 | A2( | ||
6238 | $elm$core$List$filterMap, | ||
6239 | A3($elm$http$Http$maybeSend, router, tracker, progress), | ||
6240 | state.subs))); | ||
6241 | }); | ||
6242 | var $elm$http$Http$Cancel = function (a) { | ||
6243 | return {$: 'Cancel', a: a}; | ||
6244 | }; | ||
6245 | var $elm$http$Http$cmdMap = F2( | ||
6246 | function (func, cmd) { | ||
6247 | if (cmd.$ === 'Cancel') { | ||
6248 | var tracker = cmd.a; | ||
6249 | return $elm$http$Http$Cancel(tracker); | ||
6250 | } else { | ||
6251 | var r = cmd.a; | ||
6252 | return $elm$http$Http$Request( | ||
6253 | { | ||
6254 | allowCookiesFromOtherDomains: r.allowCookiesFromOtherDomains, | ||
6255 | body: r.body, | ||
6256 | expect: A2(_Http_mapExpect, func, r.expect), | ||
6257 | headers: r.headers, | ||
6258 | method: r.method, | ||
6259 | timeout: r.timeout, | ||
6260 | tracker: r.tracker, | ||
6261 | url: r.url | ||
6262 | }); | ||
6263 | } | ||
6264 | }); | ||
6265 | var $elm$http$Http$MySub = F2( | ||
6266 | function (a, b) { | ||
6267 | return {$: 'MySub', a: a, b: b}; | ||
6268 | }); | ||
6269 | var $elm$http$Http$subMap = F2( | ||
6270 | function (func, _v0) { | ||
6271 | var tracker = _v0.a; | ||
6272 | var toMsg = _v0.b; | ||
6273 | return A2( | ||
6274 | $elm$http$Http$MySub, | ||
6275 | tracker, | ||
6276 | A2($elm$core$Basics$composeR, toMsg, func)); | ||
6277 | }); | ||
6278 | _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); | ||
6279 | var $elm$http$Http$command = _Platform_leaf('Http'); | ||
6280 | var $elm$http$Http$subscription = _Platform_leaf('Http'); | ||
6281 | var $elm$http$Http$riskyRequest = function (r) { | ||
6282 | return $elm$http$Http$command( | ||
6283 | $elm$http$Http$Request( | ||
6284 | {allowCookiesFromOtherDomains: true, body: r.body, expect: r.expect, headers: r.headers, method: r.method, timeout: r.timeout, tracker: r.tracker, url: r.url})); | ||
6285 | }; | ||
6286 | var $author$project$Checkout$fetchAmount = $elm$http$Http$riskyRequest( | ||
6287 | { | ||
6288 | body: $elm$http$Http$emptyBody, | ||
6289 | expect: A2($elm$http$Http$expectJson, $author$project$Checkout$AmountLoaded, $elm$json$Json$Decode$float), | ||
6290 | headers: _List_Nil, | ||
6291 | method: 'GET', | ||
6292 | timeout: $elm$core$Maybe$Nothing, | ||
6293 | tracker: $elm$core$Maybe$Nothing, | ||
6294 | url: 'http://127.0.0.1:7878/cart/total' | ||
6295 | }); | ||
6296 | var $author$project$Cart$CartLoaded = function (a) { | ||
6297 | return {$: 'CartLoaded', a: a}; | ||
6298 | }; | ||
6299 | var $author$project$Cart$CartListing = F2( | ||
6300 | function (productItem, quantity) { | ||
6301 | return {productItem: productItem, quantity: quantity}; | ||
6302 | }); | ||
6303 | var $author$project$Cart$Product = F5( | ||
6304 | function (id, name, kind, price, description) { | ||
6305 | return {description: description, id: id, kind: kind, name: name, price: price}; | ||
6306 | }); | ||
6307 | var $elm$json$Json$Decode$field = _Json_decodeField; | ||
6308 | var $elm$json$Json$Decode$int = _Json_decodeInt; | ||
6309 | var $elm$json$Json$Decode$map5 = _Json_map5; | ||
6310 | var $elm$json$Json$Decode$null = _Json_decodeNull; | ||
6311 | var $elm$json$Json$Decode$oneOf = _Json_oneOf; | ||
6312 | var $elm$json$Json$Decode$nullable = function (decoder) { | ||
6313 | return $elm$json$Json$Decode$oneOf( | ||
6314 | _List_fromArray( | ||
6315 | [ | ||
6316 | $elm$json$Json$Decode$null($elm$core$Maybe$Nothing), | ||
6317 | A2($elm$json$Json$Decode$map, $elm$core$Maybe$Just, decoder) | ||
6318 | ])); | ||
6319 | }; | ||
6320 | var $elm$json$Json$Decode$string = _Json_decodeString; | ||
6321 | var $author$project$Cart$decodeProduct = A6( | ||
6322 | $elm$json$Json$Decode$map5, | ||
6323 | $author$project$Cart$Product, | ||
6324 | A2($elm$json$Json$Decode$field, 'id', $elm$json$Json$Decode$int), | ||
6325 | A2($elm$json$Json$Decode$field, 'name', $elm$json$Json$Decode$string), | ||
6326 | A2( | ||
6327 | $elm$json$Json$Decode$field, | ||
6328 | 'kind', | ||
6329 | $elm$json$Json$Decode$nullable($elm$json$Json$Decode$string)), | ||
6330 | A2($elm$json$Json$Decode$field, 'price', $elm$json$Json$Decode$float), | ||
6331 | A2( | ||
6332 | $elm$json$Json$Decode$field, | ||
6333 | 'description', | ||
6334 | $elm$json$Json$Decode$nullable($elm$json$Json$Decode$string))); | ||
6335 | var $elm$json$Json$Decode$list = _Json_decodeList; | ||
6336 | var $author$project$Cart$decodeResponse = $elm$json$Json$Decode$list( | ||
6337 | A3( | ||
6338 | $elm$json$Json$Decode$map2, | ||
6339 | $author$project$Cart$CartListing, | ||
6340 | A2($elm$json$Json$Decode$field, 'product_item', $author$project$Cart$decodeProduct), | ||
6341 | A2($elm$json$Json$Decode$field, 'quantity', $elm$json$Json$Decode$int))); | ||
6342 | var $elm$core$Debug$log = _Debug_log; | ||
6343 | var $author$project$Cart$fetchCartItems = function () { | ||
6344 | var _v0 = A2($elm$core$Debug$log, 'cart', 'fetching cart items'); | ||
6345 | return $elm$http$Http$riskyRequest( | ||
6346 | { | ||
6347 | body: $elm$http$Http$emptyBody, | ||
6348 | expect: A2($elm$http$Http$expectJson, $author$project$Cart$CartLoaded, $author$project$Cart$decodeResponse), | ||
6349 | headers: _List_Nil, | ||
6350 | method: 'GET', | ||
6351 | timeout: $elm$core$Maybe$Nothing, | ||
6352 | tracker: $elm$core$Maybe$Nothing, | ||
6353 | url: 'http://127.0.0.1:7878/cart/items' | ||
6354 | }); | ||
6355 | }(); | ||
6356 | var $author$project$Product$ListingLoaded = function (a) { | ||
6357 | return {$: 'ListingLoaded', a: a}; | ||
6358 | }; | ||
6359 | var $elm$json$Json$Decode$map7 = _Json_map7; | ||
6360 | var $author$project$Product$decodeProduct = A8( | ||
6361 | $elm$json$Json$Decode$map7, | ||
6362 | $author$project$Product$Product, | ||
6363 | A2($elm$json$Json$Decode$field, 'id', $elm$json$Json$Decode$int), | ||
6364 | A2($elm$json$Json$Decode$field, 'name', $elm$json$Json$Decode$string), | ||
6365 | A2( | ||
6366 | $elm$json$Json$Decode$field, | ||
6367 | 'kind', | ||
6368 | $elm$json$Json$Decode$nullable($elm$json$Json$Decode$string)), | ||
6369 | A2($elm$json$Json$Decode$field, 'price', $elm$json$Json$Decode$float), | ||
6370 | A2( | ||
6371 | $elm$json$Json$Decode$field, | ||
6372 | 'description', | ||
6373 | $elm$json$Json$Decode$nullable($elm$json$Json$Decode$string)), | ||
6374 | A2($elm$json$Json$Decode$field, 'src', $elm$json$Json$Decode$string), | ||
6375 | A2($elm$json$Json$Decode$field, 'ios_src', $elm$json$Json$Decode$string)); | ||
6376 | var $elm$http$Http$request = function (r) { | ||
6377 | return $elm$http$Http$command( | ||
6378 | $elm$http$Http$Request( | ||
6379 | {allowCookiesFromOtherDomains: false, body: r.body, expect: r.expect, headers: r.headers, method: r.method, timeout: r.timeout, tracker: r.tracker, url: r.url})); | ||
6380 | }; | ||
6381 | var $elm$http$Http$get = function (r) { | ||
6382 | return $elm$http$Http$request( | ||
6383 | {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}); | ||
6384 | }; | ||
6385 | var $author$project$Product$fetchListing = function (id) { | ||
6386 | var _v0 = A2( | ||
6387 | $elm$core$Debug$log, | ||
6388 | 'err', | ||
6389 | 'fetching listing ' + $elm$core$String$fromInt(id)); | ||
6390 | return $elm$http$Http$get( | ||
6391 | { | ||
6392 | expect: A2($elm$http$Http$expectJson, $author$project$Product$ListingLoaded, $author$project$Product$decodeProduct), | ||
6393 | url: 'http://127.0.0.1:7878/product/' + $elm$core$String$fromInt(id) | ||
6394 | }); | ||
6395 | }; | ||
6396 | var $author$project$Catalog$ProductsLoaded = function (a) { | ||
6397 | return {$: 'ProductsLoaded', a: a}; | ||
6398 | }; | ||
6399 | var $author$project$Catalog$Product = F8( | ||
6400 | function (id, name, kind, price, description, averageRating, src, iosSrc) { | ||
6401 | return {averageRating: averageRating, description: description, id: id, iosSrc: iosSrc, kind: kind, name: name, price: price, src: src}; | ||
6402 | }); | ||
6403 | var $elm$json$Json$Decode$map8 = _Json_map8; | ||
6404 | var $author$project$Catalog$decodeProduct = A9( | ||
6405 | $elm$json$Json$Decode$map8, | ||
6406 | $author$project$Catalog$Product, | ||
6407 | A2($elm$json$Json$Decode$field, 'id', $elm$json$Json$Decode$int), | ||
6408 | A2($elm$json$Json$Decode$field, 'name', $elm$json$Json$Decode$string), | ||
6409 | A2( | ||
6410 | $elm$json$Json$Decode$field, | ||
6411 | 'kind', | ||
6412 | $elm$json$Json$Decode$nullable($elm$json$Json$Decode$string)), | ||
6413 | A2($elm$json$Json$Decode$field, 'price', $elm$json$Json$Decode$float), | ||
6414 | A2( | ||
6415 | $elm$json$Json$Decode$field, | ||
6416 | 'description', | ||
6417 | $elm$json$Json$Decode$nullable($elm$json$Json$Decode$string)), | ||
6418 | A2( | ||
6419 | $elm$json$Json$Decode$field, | ||
6420 | 'average_rating', | ||
6421 | $elm$json$Json$Decode$nullable($elm$json$Json$Decode$float)), | ||
6422 | A2($elm$json$Json$Decode$field, 'src', $elm$json$Json$Decode$string), | ||
6423 | A2($elm$json$Json$Decode$field, 'ios_src', $elm$json$Json$Decode$string)); | ||
6424 | var $author$project$Catalog$decodeResponse = $elm$json$Json$Decode$list($author$project$Catalog$decodeProduct); | ||
6425 | var $author$project$Catalog$fetchProducts = function () { | ||
6426 | var _v0 = A2($elm$core$Debug$log, 'err', 'fetching products'); | ||
6427 | return $elm$http$Http$get( | ||
6428 | { | ||
6429 | expect: A2($elm$http$Http$expectJson, $author$project$Catalog$ProductsLoaded, $author$project$Catalog$decodeResponse), | ||
6430 | url: 'http://127.0.0.1:7878/product/catalog' | ||
6431 | }); | ||
6432 | }(); | ||
6433 | var $author$project$Product$RatingsLoaded = function (a) { | ||
6434 | return {$: 'RatingsLoaded', a: a}; | ||
6435 | }; | ||
6436 | var $author$project$Product$Rating = F5( | ||
6437 | function (commentDate, commentText, customerName, productName, stars) { | ||
6438 | return {commentDate: commentDate, commentText: commentText, customerName: customerName, productName: productName, stars: stars}; | ||
6439 | }); | ||
6440 | var $author$project$Product$decodeRating = A6( | ||
6441 | $elm$json$Json$Decode$map5, | ||
6442 | $author$project$Product$Rating, | ||
6443 | A2($elm$json$Json$Decode$field, 'comment_date', $elm$json$Json$Decode$string), | ||
6444 | A2( | ||
6445 | $elm$json$Json$Decode$field, | ||
6446 | 'comment_text', | ||
6447 | $elm$json$Json$Decode$nullable($elm$json$Json$Decode$string)), | ||
6448 | A2($elm$json$Json$Decode$field, 'customer_name', $elm$json$Json$Decode$string), | ||
6449 | A2($elm$json$Json$Decode$field, 'product_name', $elm$json$Json$Decode$string), | ||
6450 | A2($elm$json$Json$Decode$field, 'stars', $elm$json$Json$Decode$int)); | ||
6451 | var $author$project$Product$decodeRatings = $elm$json$Json$Decode$list($author$project$Product$decodeRating); | ||
6452 | var $author$project$Product$fetchRatings = function (id) { | ||
6453 | var _v0 = A2( | ||
6454 | $elm$core$Debug$log, | ||
6455 | 'err', | ||
6456 | 'fetching ratings ' + $elm$core$String$fromInt(id)); | ||
6457 | return $elm$http$Http$get( | ||
6458 | { | ||
6459 | expect: A2($elm$http$Http$expectJson, $author$project$Product$RatingsLoaded, $author$project$Product$decodeRatings), | ||
6460 | url: 'http://127.0.0.1:7878/product/reviews/' + $elm$core$String$fromInt(id) | ||
6461 | }); | ||
6462 | }; | ||
6463 | var $elm$browser$Browser$Navigation$load = _Browser_load; | ||
6464 | var $elm$core$Platform$Cmd$map = _Platform_map; | ||
6465 | var $elm$url$Url$Parser$State = F5( | ||
6466 | function (visited, unvisited, params, frag, value) { | ||
6467 | return {frag: frag, params: params, unvisited: unvisited, value: value, visited: visited}; | ||
6468 | }); | ||
6469 | var $elm$url$Url$Parser$getFirstMatch = function (states) { | ||
6470 | getFirstMatch: | ||
6471 | while (true) { | ||
6472 | if (!states.b) { | ||
6473 | return $elm$core$Maybe$Nothing; | ||
6474 | } else { | ||
6475 | var state = states.a; | ||
6476 | var rest = states.b; | ||
6477 | var _v1 = state.unvisited; | ||
6478 | if (!_v1.b) { | ||
6479 | return $elm$core$Maybe$Just(state.value); | ||
6480 | } else { | ||
6481 | if ((_v1.a === '') && (!_v1.b.b)) { | ||
6482 | return $elm$core$Maybe$Just(state.value); | ||
6483 | } else { | ||
6484 | var $temp$states = rest; | ||
6485 | states = $temp$states; | ||
6486 | continue getFirstMatch; | ||
6487 | } | ||
6488 | } | ||
6489 | } | ||
6490 | } | ||
6491 | }; | ||
6492 | var $elm$url$Url$Parser$removeFinalEmpty = function (segments) { | ||
6493 | if (!segments.b) { | ||
6494 | return _List_Nil; | ||
6495 | } else { | ||
6496 | if ((segments.a === '') && (!segments.b.b)) { | ||
6497 | return _List_Nil; | ||
6498 | } else { | ||
6499 | var segment = segments.a; | ||
6500 | var rest = segments.b; | ||
6501 | return A2( | ||
6502 | $elm$core$List$cons, | ||
6503 | segment, | ||
6504 | $elm$url$Url$Parser$removeFinalEmpty(rest)); | ||
6505 | } | ||
6506 | } | ||
6507 | }; | ||
6508 | var $elm$url$Url$Parser$preparePath = function (path) { | ||
6509 | var _v0 = A2($elm$core$String$split, '/', path); | ||
6510 | if (_v0.b && (_v0.a === '')) { | ||
6511 | var segments = _v0.b; | ||
6512 | return $elm$url$Url$Parser$removeFinalEmpty(segments); | ||
6513 | } else { | ||
6514 | var segments = _v0; | ||
6515 | return $elm$url$Url$Parser$removeFinalEmpty(segments); | ||
6516 | } | ||
6517 | }; | ||
6518 | var $elm$url$Url$Parser$addToParametersHelp = F2( | ||
6519 | function (value, maybeList) { | ||
6520 | if (maybeList.$ === 'Nothing') { | ||
6521 | return $elm$core$Maybe$Just( | ||
6522 | _List_fromArray( | ||
6523 | [value])); | ||
6524 | } else { | ||
6525 | var list = maybeList.a; | ||
6526 | return $elm$core$Maybe$Just( | ||
6527 | A2($elm$core$List$cons, value, list)); | ||
6528 | } | ||
6529 | }); | ||
6530 | var $elm$url$Url$percentDecode = _Url_percentDecode; | ||
6531 | var $elm$url$Url$Parser$addParam = F2( | ||
6532 | function (segment, dict) { | ||
6533 | var _v0 = A2($elm$core$String$split, '=', segment); | ||
6534 | if ((_v0.b && _v0.b.b) && (!_v0.b.b.b)) { | ||
6535 | var rawKey = _v0.a; | ||
6536 | var _v1 = _v0.b; | ||
6537 | var rawValue = _v1.a; | ||
6538 | var _v2 = $elm$url$Url$percentDecode(rawKey); | ||
6539 | if (_v2.$ === 'Nothing') { | ||
6540 | return dict; | ||
6541 | } else { | ||
6542 | var key = _v2.a; | ||
6543 | var _v3 = $elm$url$Url$percentDecode(rawValue); | ||
6544 | if (_v3.$ === 'Nothing') { | ||
6545 | return dict; | ||
6546 | } else { | ||
6547 | var value = _v3.a; | ||
6548 | return A3( | ||
6549 | $elm$core$Dict$update, | ||
6550 | key, | ||
6551 | $elm$url$Url$Parser$addToParametersHelp(value), | ||
6552 | dict); | ||
6553 | } | ||
6554 | } | ||
6555 | } else { | ||
6556 | return dict; | ||
6557 | } | ||
6558 | }); | ||
6559 | var $elm$url$Url$Parser$prepareQuery = function (maybeQuery) { | ||
6560 | if (maybeQuery.$ === 'Nothing') { | ||
6561 | return $elm$core$Dict$empty; | ||
6562 | } else { | ||
6563 | var qry = maybeQuery.a; | ||
6564 | return A3( | ||
6565 | $elm$core$List$foldr, | ||
6566 | $elm$url$Url$Parser$addParam, | ||
6567 | $elm$core$Dict$empty, | ||
6568 | A2($elm$core$String$split, '&', qry)); | ||
6569 | } | ||
6570 | }; | ||
6571 | var $elm$url$Url$Parser$parse = F2( | ||
6572 | function (_v0, url) { | ||
6573 | var parser = _v0.a; | ||
6574 | return $elm$url$Url$Parser$getFirstMatch( | ||
6575 | parser( | ||
6576 | A5( | ||
6577 | $elm$url$Url$Parser$State, | ||
6578 | _List_Nil, | ||
6579 | $elm$url$Url$Parser$preparePath(url.path), | ||
6580 | $elm$url$Url$Parser$prepareQuery(url.query), | ||
6581 | url.fragment, | ||
6582 | $elm$core$Basics$identity))); | ||
6583 | }); | ||
6584 | var $author$project$Main$LoginPage = {$: 'LoginPage'}; | ||
6585 | var $author$project$Main$SignupPage = {$: 'SignupPage'}; | ||
6586 | var $elm$url$Url$Parser$Parser = function (a) { | ||
6587 | return {$: 'Parser', a: a}; | ||
6588 | }; | ||
6589 | var $elm$url$Url$Parser$custom = F2( | ||
6590 | function (tipe, stringToSomething) { | ||
6591 | return $elm$url$Url$Parser$Parser( | ||
6592 | function (_v0) { | ||
6593 | var visited = _v0.visited; | ||
6594 | var unvisited = _v0.unvisited; | ||
6595 | var params = _v0.params; | ||
6596 | var frag = _v0.frag; | ||
6597 | var value = _v0.value; | ||
6598 | if (!unvisited.b) { | ||
6599 | return _List_Nil; | ||
6600 | } else { | ||
6601 | var next = unvisited.a; | ||
6602 | var rest = unvisited.b; | ||
6603 | var _v2 = stringToSomething(next); | ||
6604 | if (_v2.$ === 'Just') { | ||
6605 | var nextValue = _v2.a; | ||
6606 | return _List_fromArray( | ||
6607 | [ | ||
6608 | A5( | ||
6609 | $elm$url$Url$Parser$State, | ||
6610 | A2($elm$core$List$cons, next, visited), | ||
6611 | rest, | ||
6612 | params, | ||
6613 | frag, | ||
6614 | value(nextValue)) | ||
6615 | ]); | ||
6616 | } else { | ||
6617 | return _List_Nil; | ||
6618 | } | ||
6619 | } | ||
6620 | }); | ||
6621 | }); | ||
6622 | var $elm$url$Url$Parser$int = A2($elm$url$Url$Parser$custom, 'NUMBER', $elm$core$String$toInt); | ||
6623 | var $elm$url$Url$Parser$mapState = F2( | ||
6624 | function (func, _v0) { | ||
6625 | var visited = _v0.visited; | ||
6626 | var unvisited = _v0.unvisited; | ||
6627 | var params = _v0.params; | ||
6628 | var frag = _v0.frag; | ||
6629 | var value = _v0.value; | ||
6630 | return A5( | ||
6631 | $elm$url$Url$Parser$State, | ||
6632 | visited, | ||
6633 | unvisited, | ||
6634 | params, | ||
6635 | frag, | ||
6636 | func(value)); | ||
6637 | }); | ||
6638 | var $elm$url$Url$Parser$map = F2( | ||
6639 | function (subValue, _v0) { | ||
6640 | var parseArg = _v0.a; | ||
6641 | return $elm$url$Url$Parser$Parser( | ||
6642 | function (_v1) { | ||
6643 | var visited = _v1.visited; | ||
6644 | var unvisited = _v1.unvisited; | ||
6645 | var params = _v1.params; | ||
6646 | var frag = _v1.frag; | ||
6647 | var value = _v1.value; | ||
6648 | return A2( | ||
6649 | $elm$core$List$map, | ||
6650 | $elm$url$Url$Parser$mapState(value), | ||
6651 | parseArg( | ||
6652 | A5($elm$url$Url$Parser$State, visited, unvisited, params, frag, subValue))); | ||
6653 | }); | ||
6654 | }); | ||
6655 | var $elm$core$List$append = F2( | ||
6656 | function (xs, ys) { | ||
6657 | if (!ys.b) { | ||
6658 | return xs; | ||
6659 | } else { | ||
6660 | return A3($elm$core$List$foldr, $elm$core$List$cons, ys, xs); | ||
6661 | } | ||
6662 | }); | ||
6663 | var $elm$core$List$concat = function (lists) { | ||
6664 | return A3($elm$core$List$foldr, $elm$core$List$append, _List_Nil, lists); | ||
6665 | }; | ||
6666 | var $elm$core$List$concatMap = F2( | ||
6667 | function (f, list) { | ||
6668 | return $elm$core$List$concat( | ||
6669 | A2($elm$core$List$map, f, list)); | ||
6670 | }); | ||
6671 | var $elm$url$Url$Parser$oneOf = function (parsers) { | ||
6672 | return $elm$url$Url$Parser$Parser( | ||
6673 | function (state) { | ||
6674 | return A2( | ||
6675 | $elm$core$List$concatMap, | ||
6676 | function (_v0) { | ||
6677 | var parser = _v0.a; | ||
6678 | return parser(state); | ||
6679 | }, | ||
6680 | parsers); | ||
6681 | }); | ||
6682 | }; | ||
6683 | var $elm$url$Url$Parser$s = function (str) { | ||
6684 | return $elm$url$Url$Parser$Parser( | ||
6685 | function (_v0) { | ||
6686 | var visited = _v0.visited; | ||
6687 | var unvisited = _v0.unvisited; | ||
6688 | var params = _v0.params; | ||
6689 | var frag = _v0.frag; | ||
6690 | var value = _v0.value; | ||
6691 | if (!unvisited.b) { | ||
6692 | return _List_Nil; | ||
6693 | } else { | ||
6694 | var next = unvisited.a; | ||
6695 | var rest = unvisited.b; | ||
6696 | return _Utils_eq(next, str) ? _List_fromArray( | ||
6697 | [ | ||
6698 | A5( | ||
6699 | $elm$url$Url$Parser$State, | ||
6700 | A2($elm$core$List$cons, next, visited), | ||
6701 | rest, | ||
6702 | params, | ||
6703 | frag, | ||
6704 | value) | ||
6705 | ]) : _List_Nil; | ||
6706 | } | ||
6707 | }); | ||
6708 | }; | ||
6709 | var $elm$url$Url$Parser$slash = F2( | ||
6710 | function (_v0, _v1) { | ||
6711 | var parseBefore = _v0.a; | ||
6712 | var parseAfter = _v1.a; | ||
6713 | return $elm$url$Url$Parser$Parser( | ||
6714 | function (state) { | ||
6715 | return A2( | ||
6716 | $elm$core$List$concatMap, | ||
6717 | parseAfter, | ||
6718 | parseBefore(state)); | ||
6719 | }); | ||
6720 | }); | ||
6721 | var $elm$url$Url$Parser$top = $elm$url$Url$Parser$Parser( | ||
6722 | function (state) { | ||
6723 | return _List_fromArray( | ||
6724 | [state]); | ||
6725 | }); | ||
6726 | var $author$project$Main$parseRoute = $elm$url$Url$Parser$oneOf( | ||
6727 | _List_fromArray( | ||
6728 | [ | ||
6729 | A2( | ||
6730 | $elm$url$Url$Parser$map, | ||
6731 | $author$project$Main$LoginPage, | ||
6732 | $elm$url$Url$Parser$s('login')), | ||
6733 | A2($elm$url$Url$Parser$map, $author$project$Main$HomePage, $elm$url$Url$Parser$top), | ||
6734 | A2( | ||
6735 | $elm$url$Url$Parser$map, | ||
6736 | $author$project$Main$CatalogPage, | ||
6737 | $elm$url$Url$Parser$s('catalog')), | ||
6738 | A2( | ||
6739 | $elm$url$Url$Parser$map, | ||
6740 | $author$project$Main$CartPage, | ||
6741 | $elm$url$Url$Parser$s('cart')), | ||
6742 | A2( | ||
6743 | $elm$url$Url$Parser$map, | ||
6744 | $author$project$Main$SignupPage, | ||
6745 | $elm$url$Url$Parser$s('signup')), | ||
6746 | A2( | ||
6747 | $elm$url$Url$Parser$map, | ||
6748 | $author$project$Main$CheckoutPage, | ||
6749 | $elm$url$Url$Parser$s('checkout')), | ||
6750 | A2( | ||
6751 | $elm$url$Url$Parser$map, | ||
6752 | $author$project$Main$ProductPage, | ||
6753 | A2( | ||
6754 | $elm$url$Url$Parser$slash, | ||
6755 | $elm$url$Url$Parser$s('product'), | ||
6756 | $elm$url$Url$Parser$int)) | ||
6757 | ])); | ||
6758 | var $elm$browser$Browser$Navigation$pushUrl = _Browser_pushUrl; | ||
6759 | var $elm$browser$Browser$Navigation$replaceUrl = _Browser_replaceUrl; | ||
6760 | var $elm$url$Url$addPort = F2( | ||
6761 | function (maybePort, starter) { | ||
6762 | if (maybePort.$ === 'Nothing') { | ||
6763 | return starter; | ||
6764 | } else { | ||
6765 | var port_ = maybePort.a; | ||
6766 | return starter + (':' + $elm$core$String$fromInt(port_)); | ||
6767 | } | ||
6768 | }); | ||
6769 | var $elm$url$Url$addPrefixed = F3( | ||
6770 | function (prefix, maybeSegment, starter) { | ||
6771 | if (maybeSegment.$ === 'Nothing') { | ||
6772 | return starter; | ||
6773 | } else { | ||
6774 | var segment = maybeSegment.a; | ||
6775 | return _Utils_ap( | ||
6776 | starter, | ||
6777 | _Utils_ap(prefix, segment)); | ||
6778 | } | ||
6779 | }); | ||
6780 | var $elm$url$Url$toString = function (url) { | ||
6781 | var http = function () { | ||
6782 | var _v0 = url.protocol; | ||
6783 | if (_v0.$ === 'Http') { | ||
6784 | return 'http://'; | ||
6785 | } else { | ||
6786 | return 'https://'; | ||
6787 | } | ||
6788 | }(); | ||
6789 | return A3( | ||
6790 | $elm$url$Url$addPrefixed, | ||
6791 | '#', | ||
6792 | url.fragment, | ||
6793 | A3( | ||
6794 | $elm$url$Url$addPrefixed, | ||
6795 | '?', | ||
6796 | url.query, | ||
6797 | _Utils_ap( | ||
6798 | A2( | ||
6799 | $elm$url$Url$addPort, | ||
6800 | url.port_, | ||
6801 | _Utils_ap(http, url.host)), | ||
6802 | url.path))); | ||
6803 | }; | ||
6804 | var $author$project$Main$LogoutSuccess = function (a) { | ||
6805 | return {$: 'LogoutSuccess', a: a}; | ||
6806 | }; | ||
6807 | var $elm$http$Http$expectBytesResponse = F2( | ||
6808 | function (toMsg, toResult) { | ||
6809 | return A3( | ||
6810 | _Http_expect, | ||
6811 | 'arraybuffer', | ||
6812 | _Http_toDataView, | ||
6813 | A2($elm$core$Basics$composeR, toResult, toMsg)); | ||
6814 | }); | ||
6815 | var $elm$http$Http$expectWhatever = function (toMsg) { | ||
6816 | return A2( | ||
6817 | $elm$http$Http$expectBytesResponse, | ||
6818 | toMsg, | ||
6819 | $elm$http$Http$resolve( | ||
6820 | function (_v0) { | ||
6821 | return $elm$core$Result$Ok(_Utils_Tuple0); | ||
6822 | })); | ||
6823 | }; | ||
6824 | var $author$project$Main$tryLogout = $elm$http$Http$riskyRequest( | ||
6825 | { | ||
6826 | body: $elm$http$Http$emptyBody, | ||
6827 | expect: $elm$http$Http$expectWhatever($author$project$Main$LogoutSuccess), | ||
6828 | headers: _List_Nil, | ||
6829 | method: 'POST', | ||
6830 | timeout: $elm$core$Maybe$Nothing, | ||
6831 | tracker: $elm$core$Maybe$Nothing, | ||
6832 | url: 'http://127.0.0.1:7878/user/logout' | ||
6833 | }); | ||
6834 | var $author$project$Cart$Loaded = {$: 'Loaded'}; | ||
6835 | var $author$project$Cart$Loading = {$: 'Loading'}; | ||
6836 | var $author$project$Cart$AddToCartSuccess = function (a) { | ||
6837 | return {$: 'AddToCartSuccess', a: a}; | ||
6838 | }; | ||
6839 | var $elm$http$Http$stringBody = _Http_pair; | ||
6840 | var $author$project$Cart$addToCart = function (id) { | ||
6841 | var _v0 = A2( | ||
6842 | $elm$core$Debug$log, | ||
6843 | 'err', | ||
6844 | 'adding to cart: ' + $elm$core$String$fromInt(id)); | ||
6845 | return $elm$http$Http$riskyRequest( | ||
6846 | { | ||
6847 | body: A2( | ||
6848 | $elm$http$Http$stringBody, | ||
6849 | 'applcation/json', | ||
6850 | $elm$core$String$fromInt(id)), | ||
6851 | expect: $elm$http$Http$expectWhatever($author$project$Cart$AddToCartSuccess), | ||
6852 | headers: _List_Nil, | ||
6853 | method: 'POST', | ||
6854 | timeout: $elm$core$Maybe$Nothing, | ||
6855 | tracker: $elm$core$Maybe$Nothing, | ||
6856 | url: 'http://127.0.0.1:7878/cart/add' | ||
6857 | }); | ||
6858 | }; | ||
6859 | var $author$project$Cart$CartItemRemoved = function (a) { | ||
6860 | return {$: 'CartItemRemoved', a: a}; | ||
6861 | }; | ||
6862 | var $author$project$Cart$removeProduct = function (id) { | ||
6863 | var _v0 = A2($elm$core$Debug$log, 'cart', 'fetching cart items'); | ||
6864 | return $elm$http$Http$riskyRequest( | ||
6865 | { | ||
6866 | body: A2( | ||
6867 | $elm$http$Http$stringBody, | ||
6868 | 'application/json', | ||
6869 | $elm$core$String$fromInt(id)), | ||
6870 | expect: $elm$http$Http$expectWhatever($author$project$Cart$CartItemRemoved), | ||
6871 | headers: _List_Nil, | ||
6872 | method: 'POST', | ||
6873 | timeout: $elm$core$Maybe$Nothing, | ||
6874 | tracker: $elm$core$Maybe$Nothing, | ||
6875 | url: 'http://127.0.0.1:7878/cart/remove' | ||
6876 | }); | ||
6877 | }; | ||
6878 | var $author$project$Cart$update = F2( | ||
6879 | function (msg, model) { | ||
6880 | switch (msg.$) { | ||
6881 | case 'CartLoaded': | ||
6882 | var res = msg.a; | ||
6883 | if (res.$ === 'Ok') { | ||
6884 | var s = res.a; | ||
6885 | return _Utils_Tuple2( | ||
6886 | _Utils_update( | ||
6887 | model, | ||
6888 | {pageStatus: $author$project$Cart$Loaded, products: s}), | ||
6889 | $elm$core$Platform$Cmd$none); | ||
6890 | } else { | ||
6891 | var e = res.a; | ||
6892 | var _v2 = A2($elm$core$Debug$log, 'error', e); | ||
6893 | return _Utils_Tuple2( | ||
6894 | _Utils_update( | ||
6895 | model, | ||
6896 | {pageStatus: $author$project$Cart$NotLoaded}), | ||
6897 | $elm$core$Platform$Cmd$none); | ||
6898 | } | ||
6899 | case 'RemoveFromCart': | ||
6900 | var id = msg.a; | ||
6901 | return _Utils_Tuple2( | ||
6902 | model, | ||
6903 | $author$project$Cart$removeProduct(id)); | ||
6904 | case 'CartItemRemoved': | ||
6905 | return _Utils_Tuple2( | ||
6906 | _Utils_update( | ||
6907 | model, | ||
6908 | {pageStatus: $author$project$Cart$Loading}), | ||
6909 | $author$project$Cart$fetchCartItems); | ||
6910 | case 'FetchCartItems': | ||
6911 | return _Utils_Tuple2( | ||
6912 | _Utils_update( | ||
6913 | model, | ||
6914 | {pageStatus: $author$project$Cart$Loading}), | ||
6915 | $author$project$Cart$fetchCartItems); | ||
6916 | case 'AddToCartPressed': | ||
6917 | var id = msg.a; | ||
6918 | return _Utils_Tuple2( | ||
6919 | model, | ||
6920 | $author$project$Cart$addToCart(id)); | ||
6921 | default: | ||
6922 | return _Utils_Tuple2( | ||
6923 | _Utils_update( | ||
6924 | model, | ||
6925 | {pageStatus: $author$project$Cart$Loading}), | ||
6926 | $author$project$Cart$fetchCartItems); | ||
6927 | } | ||
6928 | }); | ||
6929 | var $author$project$Catalog$Loaded = {$: 'Loaded'}; | ||
6930 | var $author$project$Catalog$Loading = {$: 'Loading'}; | ||
6931 | var $elm$core$Basics$always = F2( | ||
6932 | function (a, _v0) { | ||
6933 | return a; | ||
6934 | }); | ||
6935 | var $elm$core$Tuple$mapFirst = F2( | ||
6936 | function (func, _v0) { | ||
6937 | var x = _v0.a; | ||
6938 | var y = _v0.b; | ||
6939 | return _Utils_Tuple2( | ||
6940 | func(x), | ||
6941 | y); | ||
6942 | }); | ||
6943 | var $elm$core$Tuple$mapSecond = F2( | ||
6944 | function (func, _v0) { | ||
6945 | var x = _v0.a; | ||
6946 | var y = _v0.b; | ||
6947 | return _Utils_Tuple2( | ||
6948 | x, | ||
6949 | func(y)); | ||
6950 | }); | ||
6951 | var $author$project$Catalog$update = F2( | ||
6952 | function (msg, model) { | ||
6953 | switch (msg.$) { | ||
6954 | case 'ProductsLoaded': | ||
6955 | var res = msg.a; | ||
6956 | if (res.$ === 'Ok') { | ||
6957 | var s = res.a; | ||
6958 | return _Utils_Tuple2( | ||
6959 | _Utils_update( | ||
6960 | model, | ||
6961 | {pageStatus: $author$project$Catalog$Loaded, products: s}), | ||
6962 | $elm$core$Platform$Cmd$none); | ||
6963 | } else { | ||
6964 | var e = res.a; | ||
6965 | var _v2 = A2($elm$core$Debug$log, 'error', e); | ||
6966 | return _Utils_Tuple2( | ||
6967 | _Utils_update( | ||
6968 | model, | ||
6969 | {pageStatus: $author$project$Catalog$NotLoaded}), | ||
6970 | $elm$core$Platform$Cmd$none); | ||
6971 | } | ||
6972 | case 'FetchProducts': | ||
6973 | return _Utils_Tuple2( | ||
6974 | _Utils_update( | ||
6975 | model, | ||
6976 | {pageStatus: $author$project$Catalog$Loading}), | ||
6977 | $author$project$Catalog$fetchProducts); | ||
6978 | case 'ChangePriceLower': | ||
6979 | var v = msg.a; | ||
6980 | var fs = model.filters; | ||
6981 | var nfs = _Utils_update( | ||
6982 | fs, | ||
6983 | { | ||
6984 | price: A2( | ||
6985 | $elm$core$Tuple$mapFirst, | ||
6986 | $elm$core$Basics$always(v), | ||
6987 | fs.price) | ||
6988 | }); | ||
6989 | return _Utils_Tuple2( | ||
6990 | _Utils_update( | ||
6991 | model, | ||
6992 | {filters: nfs}), | ||
6993 | $elm$core$Platform$Cmd$none); | ||
6994 | case 'ChangePriceUpper': | ||
6995 | var v = msg.a; | ||
6996 | var fs = model.filters; | ||
6997 | var nfs = _Utils_update( | ||
6998 | fs, | ||
6999 | { | ||
7000 | price: A2( | ||
7001 | $elm$core$Tuple$mapSecond, | ||
7002 | $elm$core$Basics$always(v), | ||
7003 | fs.price) | ||
7004 | }); | ||
7005 | return _Utils_Tuple2( | ||
7006 | _Utils_update( | ||
7007 | model, | ||
7008 | {filters: nfs}), | ||
7009 | $elm$core$Platform$Cmd$none); | ||
7010 | case 'ChangeRatingLower': | ||
7011 | var v = msg.a; | ||
7012 | var fs = model.filters; | ||
7013 | var nfs = _Utils_update( | ||
7014 | fs, | ||
7015 | { | ||
7016 | rating: A2( | ||
7017 | $elm$core$Tuple$mapFirst, | ||
7018 | $elm$core$Basics$always(v), | ||
7019 | fs.rating) | ||
7020 | }); | ||
7021 | return _Utils_Tuple2( | ||
7022 | _Utils_update( | ||
7023 | model, | ||
7024 | {filters: nfs}), | ||
7025 | $elm$core$Platform$Cmd$none); | ||
7026 | default: | ||
7027 | var v = msg.a; | ||
7028 | var fs = model.filters; | ||
7029 | var nfs = _Utils_update( | ||
7030 | fs, | ||
7031 | { | ||
7032 | rating: A2( | ||
7033 | $elm$core$Tuple$mapSecond, | ||
7034 | $elm$core$Basics$always(v), | ||
7035 | fs.rating) | ||
7036 | }); | ||
7037 | return _Utils_Tuple2( | ||
7038 | _Utils_update( | ||
7039 | model, | ||
7040 | {filters: nfs}), | ||
7041 | $elm$core$Platform$Cmd$none); | ||
7042 | } | ||
7043 | }); | ||
7044 | var $author$project$Checkout$Loading = {$: 'Loading'}; | ||
7045 | var $author$project$Checkout$CheckoutSuccessful = function (a) { | ||
7046 | return {$: 'CheckoutSuccessful', a: a}; | ||
7047 | }; | ||
7048 | var $author$project$Checkout$tryCheckout = function (pm) { | ||
7049 | return $elm$http$Http$riskyRequest( | ||
7050 | { | ||
7051 | body: A2($elm$http$Http$stringBody, 'application/json', pm), | ||
7052 | expect: $elm$http$Http$expectWhatever($author$project$Checkout$CheckoutSuccessful), | ||
7053 | headers: _List_Nil, | ||
7054 | method: 'POST', | ||
7055 | timeout: $elm$core$Maybe$Nothing, | ||
7056 | tracker: $elm$core$Maybe$Nothing, | ||
7057 | url: 'http://127.0.0.1:7878/transaction/checkout' | ||
7058 | }); | ||
7059 | }; | ||
7060 | var $author$project$Checkout$update = F2( | ||
7061 | function (msg, model) { | ||
7062 | switch (msg.$) { | ||
7063 | case 'CheckoutPressed': | ||
7064 | return _Utils_Tuple2( | ||
7065 | model, | ||
7066 | $author$project$Checkout$tryCheckout(model.paymentMode)); | ||
7067 | case 'CheckoutSuccessful': | ||
7068 | return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none); | ||
7069 | case 'AmountLoaded': | ||
7070 | var res = msg.a; | ||
7071 | if (res.$ === 'Ok') { | ||
7072 | var v = res.a; | ||
7073 | return _Utils_Tuple2( | ||
7074 | _Utils_update( | ||
7075 | model, | ||
7076 | {cartTotal: v}), | ||
7077 | $elm$core$Platform$Cmd$none); | ||
7078 | } else { | ||
7079 | return _Utils_Tuple2( | ||
7080 | _Utils_update( | ||
7081 | model, | ||
7082 | {pageStatus: $author$project$Checkout$NotLoaded}), | ||
7083 | $elm$core$Platform$Cmd$none); | ||
7084 | } | ||
7085 | case 'FetchAmount': | ||
7086 | var _v2 = A2($elm$core$Debug$log, 'err', 'fetching checkout amount'); | ||
7087 | return _Utils_Tuple2( | ||
7088 | _Utils_update( | ||
7089 | model, | ||
7090 | {pageStatus: $author$project$Checkout$Loading}), | ||
7091 | $author$project$Checkout$fetchAmount); | ||
7092 | default: | ||
7093 | var s = msg.a; | ||
7094 | return _Utils_Tuple2( | ||
7095 | _Utils_update( | ||
7096 | model, | ||
7097 | {paymentMode: s}), | ||
7098 | $elm$core$Platform$Cmd$none); | ||
7099 | } | ||
7100 | }); | ||
7101 | var $author$project$Login$InvalidLogin = {$: 'InvalidLogin'}; | ||
7102 | var $author$project$Login$LoggedIn = {$: 'LoggedIn'}; | ||
7103 | var $author$project$Login$LoggingIn = {$: 'LoggingIn'}; | ||
7104 | var $author$project$Login$LoginSuccess = function (a) { | ||
7105 | return {$: 'LoginSuccess', a: a}; | ||
7106 | }; | ||
7107 | var $elm$json$Json$Encode$object = function (pairs) { | ||
7108 | return _Json_wrap( | ||
7109 | A3( | ||
7110 | $elm$core$List$foldl, | ||
7111 | F2( | ||
7112 | function (_v0, obj) { | ||
7113 | var k = _v0.a; | ||
7114 | var v = _v0.b; | ||
7115 | return A3(_Json_addField, k, v, obj); | ||
7116 | }), | ||
7117 | _Json_emptyObject(_Utils_Tuple0), | ||
7118 | pairs)); | ||
7119 | }; | ||
7120 | var $elm$json$Json$Encode$string = _Json_wrap; | ||
7121 | var $author$project$Login$encodeLogin = function (model) { | ||
7122 | return $elm$json$Json$Encode$object( | ||
7123 | _List_fromArray( | ||
7124 | [ | ||
7125 | _Utils_Tuple2( | ||
7126 | 'username', | ||
7127 | $elm$json$Json$Encode$string(model.username)), | ||
7128 | _Utils_Tuple2( | ||
7129 | 'password', | ||
7130 | $elm$json$Json$Encode$string(model.password)) | ||
7131 | ])); | ||
7132 | }; | ||
7133 | var $elm$http$Http$jsonBody = function (value) { | ||
7134 | return A2( | ||
7135 | _Http_pair, | ||
7136 | 'application/json', | ||
7137 | A2($elm$json$Json$Encode$encode, 0, value)); | ||
7138 | }; | ||
7139 | var $author$project$Login$tryLogin = function (model) { | ||
7140 | return $elm$http$Http$riskyRequest( | ||
7141 | { | ||
7142 | body: $elm$http$Http$jsonBody( | ||
7143 | $author$project$Login$encodeLogin(model)), | ||
7144 | expect: $elm$http$Http$expectWhatever($author$project$Login$LoginSuccess), | ||
7145 | headers: _List_Nil, | ||
7146 | method: 'POST', | ||
7147 | timeout: $elm$core$Maybe$Nothing, | ||
7148 | tracker: $elm$core$Maybe$Nothing, | ||
7149 | url: 'http://127.0.0.1:7878/user/login' | ||
7150 | }); | ||
7151 | }; | ||
7152 | var $author$project$Login$update = F2( | ||
7153 | function (msg, model) { | ||
7154 | switch (msg.$) { | ||
7155 | case 'PassEntered': | ||
7156 | var s = msg.a; | ||
7157 | return _Utils_Tuple2( | ||
7158 | _Utils_update( | ||
7159 | model, | ||
7160 | {password: s}), | ||
7161 | $elm$core$Platform$Cmd$none); | ||
7162 | case 'UserEntered': | ||
7163 | var s = msg.a; | ||
7164 | return _Utils_Tuple2( | ||
7165 | _Utils_update( | ||
7166 | model, | ||
7167 | {username: s}), | ||
7168 | $elm$core$Platform$Cmd$none); | ||
7169 | case 'LoginPressed': | ||
7170 | return _Utils_Tuple2( | ||
7171 | _Utils_update( | ||
7172 | model, | ||
7173 | {loginStatus: $author$project$Login$LoggingIn}), | ||
7174 | $author$project$Login$tryLogin(model)); | ||
7175 | case 'LoginSuccess': | ||
7176 | var res = msg.a; | ||
7177 | if (res.$ === 'Ok') { | ||
7178 | var s = res.a; | ||
7179 | return _Utils_Tuple2( | ||
7180 | _Utils_update( | ||
7181 | model, | ||
7182 | {loginStatus: $author$project$Login$LoggedIn}), | ||
7183 | $elm$core$Platform$Cmd$none); | ||
7184 | } else { | ||
7185 | var e = res.a; | ||
7186 | return _Utils_Tuple2( | ||
7187 | _Utils_update( | ||
7188 | model, | ||
7189 | {loginStatus: $author$project$Login$InvalidLogin}), | ||
7190 | $elm$core$Platform$Cmd$none); | ||
7191 | } | ||
7192 | default: | ||
7193 | return _Utils_Tuple2( | ||
7194 | _Utils_update( | ||
7195 | model, | ||
7196 | {loginStatus: $author$project$Login$InvalidLogin}), | ||
7197 | $elm$core$Platform$Cmd$none); | ||
7198 | } | ||
7199 | }); | ||
7200 | var $author$project$Product$Loaded = {$: 'Loaded'}; | ||
7201 | var $author$project$Product$Loading = {$: 'Loading'}; | ||
7202 | var $author$project$Product$SubmitFail = {$: 'SubmitFail'}; | ||
7203 | var $author$project$Product$SubmitSuccess = {$: 'SubmitSuccess'}; | ||
7204 | var $author$project$Product$Submitting = {$: 'Submitting'}; | ||
7205 | var $author$project$Product$AddToCartSuccess = function (a) { | ||
7206 | return {$: 'AddToCartSuccess', a: a}; | ||
7207 | }; | ||
7208 | var $author$project$Product$addToCart = function (model) { | ||
7209 | var _v0 = A2( | ||
7210 | $elm$core$Debug$log, | ||
7211 | 'err', | ||
7212 | 'adding to cart: ' + $elm$core$String$fromInt(model.listing.id)); | ||
7213 | return $elm$http$Http$riskyRequest( | ||
7214 | { | ||
7215 | body: A2( | ||
7216 | $elm$http$Http$stringBody, | ||
7217 | 'applcation/json', | ||
7218 | $elm$core$String$fromInt(model.listing.id)), | ||
7219 | expect: $elm$http$Http$expectWhatever($author$project$Product$AddToCartSuccess), | ||
7220 | headers: _List_Nil, | ||
7221 | method: 'POST', | ||
7222 | timeout: $elm$core$Maybe$Nothing, | ||
7223 | tracker: $elm$core$Maybe$Nothing, | ||
7224 | url: 'http://127.0.0.1:7878/cart/add' | ||
7225 | }); | ||
7226 | }; | ||
7227 | var $author$project$Product$AddRatingSuccess = function (a) { | ||
7228 | return {$: 'AddRatingSuccess', a: a}; | ||
7229 | }; | ||
7230 | var $elm$json$Json$Encode$int = _Json_wrap; | ||
7231 | var $author$project$Product$encodeRatingForm = function (model) { | ||
7232 | return $elm$json$Json$Encode$object( | ||
7233 | _List_fromArray( | ||
7234 | [ | ||
7235 | _Utils_Tuple2( | ||
7236 | 'product_id', | ||
7237 | $elm$json$Json$Encode$int(model.listing.id)), | ||
7238 | _Utils_Tuple2( | ||
7239 | 'stars', | ||
7240 | $elm$json$Json$Encode$int(model.ratingStars)), | ||
7241 | _Utils_Tuple2( | ||
7242 | 'comment_text', | ||
7243 | $elm$json$Json$Encode$string(model.ratingText)) | ||
7244 | ])); | ||
7245 | }; | ||
7246 | var $author$project$Product$submitRating = function (model) { | ||
7247 | var _v0 = A2( | ||
7248 | $elm$core$Debug$log, | ||
7249 | 'err', | ||
7250 | 'submitting rating for' + $elm$core$String$fromInt(model.listing.id)); | ||
7251 | return $elm$http$Http$riskyRequest( | ||
7252 | { | ||
7253 | body: $elm$http$Http$jsonBody( | ||
7254 | $author$project$Product$encodeRatingForm(model)), | ||
7255 | expect: $elm$http$Http$expectWhatever($author$project$Product$AddRatingSuccess), | ||
7256 | headers: _List_Nil, | ||
7257 | method: 'POST', | ||
7258 | timeout: $elm$core$Maybe$Nothing, | ||
7259 | tracker: $elm$core$Maybe$Nothing, | ||
7260 | url: 'http://127.0.0.1:7878/rating/add' | ||
7261 | }); | ||
7262 | }; | ||
7263 | var $author$project$Product$update = F2( | ||
7264 | function (msg, model) { | ||
7265 | switch (msg.$) { | ||
7266 | case 'ListingLoaded': | ||
7267 | var res = msg.a; | ||
7268 | if (res.$ === 'Ok') { | ||
7269 | var s = res.a; | ||
7270 | return _Utils_Tuple2( | ||
7271 | _Utils_update( | ||
7272 | model, | ||
7273 | {listing: s, pageStatus: $author$project$Product$Loaded}), | ||
7274 | $elm$core$Platform$Cmd$none); | ||
7275 | } else { | ||
7276 | var e = res.a; | ||
7277 | var _v2 = A2($elm$core$Debug$log, 'error', e); | ||
7278 | return _Utils_Tuple2( | ||
7279 | _Utils_update( | ||
7280 | model, | ||
7281 | {pageStatus: $author$project$Product$NotLoaded}), | ||
7282 | $elm$core$Platform$Cmd$none); | ||
7283 | } | ||
7284 | case 'RatingsLoaded': | ||
7285 | var res = msg.a; | ||
7286 | if (res.$ === 'Ok') { | ||
7287 | var s = res.a; | ||
7288 | return _Utils_Tuple2( | ||
7289 | _Utils_update( | ||
7290 | model, | ||
7291 | {pageStatus: $author$project$Product$Loaded, ratings: s}), | ||
7292 | $elm$core$Platform$Cmd$none); | ||
7293 | } else { | ||
7294 | var e = res.a; | ||
7295 | var _v4 = A2($elm$core$Debug$log, 'error', e); | ||
7296 | return _Utils_Tuple2( | ||
7297 | _Utils_update( | ||
7298 | model, | ||
7299 | {pageStatus: $author$project$Product$NotLoaded}), | ||
7300 | $elm$core$Platform$Cmd$none); | ||
7301 | } | ||
7302 | case 'FetchProduct': | ||
7303 | var id = msg.a; | ||
7304 | return _Utils_Tuple2( | ||
7305 | _Utils_update( | ||
7306 | model, | ||
7307 | {pageStatus: $author$project$Product$Loading}), | ||
7308 | $author$project$Product$fetchListing(id)); | ||
7309 | case 'FetchRatings': | ||
7310 | var id = msg.a; | ||
7311 | return _Utils_Tuple2( | ||
7312 | _Utils_update( | ||
7313 | model, | ||
7314 | {pageStatus: $author$project$Product$Loading}), | ||
7315 | $author$project$Product$fetchRatings(id)); | ||
7316 | case 'AddRatingStars': | ||
7317 | var i = msg.a; | ||
7318 | return _Utils_Tuple2( | ||
7319 | _Utils_update( | ||
7320 | model, | ||
7321 | {ratingStars: i}), | ||
7322 | $elm$core$Platform$Cmd$none); | ||
7323 | case 'AddRatingComment': | ||
7324 | var s = msg.a; | ||
7325 | return _Utils_Tuple2( | ||
7326 | _Utils_update( | ||
7327 | model, | ||
7328 | {ratingText: s}), | ||
7329 | $elm$core$Platform$Cmd$none); | ||
7330 | case 'AddRatingPressed': | ||
7331 | return _Utils_Tuple2( | ||
7332 | _Utils_update( | ||
7333 | model, | ||
7334 | {addRatingStatus: $author$project$Product$Submitting}), | ||
7335 | $author$project$Product$submitRating(model)); | ||
7336 | case 'AddRatingSuccess': | ||
7337 | var res = msg.a; | ||
7338 | if (res.$ === 'Ok') { | ||
7339 | return _Utils_Tuple2( | ||
7340 | _Utils_update( | ||
7341 | model, | ||
7342 | {addRatingStatus: $author$project$Product$SubmitSuccess}), | ||
7343 | $author$project$Product$fetchRatings(model.listing.id)); | ||
7344 | } else { | ||
7345 | return _Utils_Tuple2( | ||
7346 | _Utils_update( | ||
7347 | model, | ||
7348 | {addRatingStatus: $author$project$Product$SubmitFail}), | ||
7349 | $elm$core$Platform$Cmd$none); | ||
7350 | } | ||
7351 | case 'AddRatingFail': | ||
7352 | return _Utils_Tuple2( | ||
7353 | _Utils_update( | ||
7354 | model, | ||
7355 | {addRatingStatus: $author$project$Product$SubmitFail}), | ||
7356 | $elm$core$Platform$Cmd$none); | ||
7357 | case 'AddToCartPressed': | ||
7358 | return _Utils_Tuple2( | ||
7359 | model, | ||
7360 | $author$project$Product$addToCart(model)); | ||
7361 | default: | ||
7362 | return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none); | ||
7363 | } | ||
7364 | }); | ||
7365 | var $author$project$Signup$CreatedSuccessfully = {$: 'CreatedSuccessfully'}; | ||
7366 | var $author$project$Signup$CreatingUser = {$: 'CreatingUser'}; | ||
7367 | var $author$project$Signup$InvalidEmail = {$: 'InvalidEmail'}; | ||
7368 | var $author$project$Signup$InvalidPhone = {$: 'InvalidPhone'}; | ||
7369 | var $author$project$Signup$UsernameTaken = {$: 'UsernameTaken'}; | ||
7370 | var $elm$core$List$any = F2( | ||
7371 | function (isOkay, list) { | ||
7372 | any: | ||
7373 | while (true) { | ||
7374 | if (!list.b) { | ||
7375 | return false; | ||
7376 | } else { | ||
7377 | var x = list.a; | ||
7378 | var xs = list.b; | ||
7379 | if (isOkay(x)) { | ||
7380 | return true; | ||
7381 | } else { | ||
7382 | var $temp$isOkay = isOkay, | ||
7383 | $temp$list = xs; | ||
7384 | isOkay = $temp$isOkay; | ||
7385 | list = $temp$list; | ||
7386 | continue any; | ||
7387 | } | ||
7388 | } | ||
7389 | } | ||
7390 | }); | ||
7391 | var $elm$core$Basics$composeL = F3( | ||
7392 | function (g, f, x) { | ||
7393 | return g( | ||
7394 | f(x)); | ||
7395 | }); | ||
7396 | var $elm$core$Basics$not = _Basics_not; | ||
7397 | var $elm$core$List$all = F2( | ||
7398 | function (isOkay, list) { | ||
7399 | return !A2( | ||
7400 | $elm$core$List$any, | ||
7401 | A2($elm$core$Basics$composeL, $elm$core$Basics$not, isOkay), | ||
7402 | list); | ||
7403 | }); | ||
7404 | var $author$project$Signup$UsernameExists = function (a) { | ||
7405 | return {$: 'UsernameExists', a: a}; | ||
7406 | }; | ||
7407 | var $elm$http$Http$expectString = function (toMsg) { | ||
7408 | return A2( | ||
7409 | $elm$http$Http$expectStringResponse, | ||
7410 | toMsg, | ||
7411 | $elm$http$Http$resolve($elm$core$Result$Ok)); | ||
7412 | }; | ||
7413 | var $elm$http$Http$post = function (r) { | ||
7414 | return $elm$http$Http$request( | ||
7415 | {body: r.body, expect: r.expect, headers: _List_Nil, method: 'POST', timeout: $elm$core$Maybe$Nothing, tracker: $elm$core$Maybe$Nothing, url: r.url}); | ||
7416 | }; | ||
7417 | var $author$project$Signup$checkExists = function (model) { | ||
7418 | return $elm$http$Http$post( | ||
7419 | { | ||
7420 | body: A2($elm$http$Http$stringBody, 'application/json', model.username), | ||
7421 | expect: $elm$http$Http$expectString($author$project$Signup$UsernameExists), | ||
7422 | url: 'http://127.0.0.1:7878/user/existing' | ||
7423 | }); | ||
7424 | }; | ||
7425 | var $author$project$Signup$CreationSuccess = function (a) { | ||
7426 | return {$: 'CreationSuccess', a: a}; | ||
7427 | }; | ||
7428 | var $elm$core$Maybe$withDefault = F2( | ||
7429 | function (_default, maybe) { | ||
7430 | if (maybe.$ === 'Just') { | ||
7431 | var value = maybe.a; | ||
7432 | return value; | ||
7433 | } else { | ||
7434 | return _default; | ||
7435 | } | ||
7436 | }); | ||
7437 | var $author$project$Signup$encodeCreateUser = function (model) { | ||
7438 | return $elm$json$Json$Encode$object( | ||
7439 | _List_fromArray( | ||
7440 | [ | ||
7441 | _Utils_Tuple2( | ||
7442 | 'username', | ||
7443 | $elm$json$Json$Encode$string(model.username)), | ||
7444 | _Utils_Tuple2( | ||
7445 | 'password', | ||
7446 | $elm$json$Json$Encode$string(model.password)), | ||
7447 | _Utils_Tuple2( | ||
7448 | 'phone_number', | ||
7449 | $elm$json$Json$Encode$string(model.phoneNumber)), | ||
7450 | _Utils_Tuple2( | ||
7451 | 'email_id', | ||
7452 | $elm$json$Json$Encode$string(model.emailId)), | ||
7453 | _Utils_Tuple2( | ||
7454 | 'address', | ||
7455 | $elm$json$Json$Encode$string( | ||
7456 | A2($elm$core$Maybe$withDefault, '', model.address))) | ||
7457 | ])); | ||
7458 | }; | ||
7459 | var $author$project$Signup$createUser = function (model) { | ||
7460 | return $elm$http$Http$riskyRequest( | ||
7461 | { | ||
7462 | body: $elm$http$Http$jsonBody( | ||
7463 | $author$project$Signup$encodeCreateUser(model)), | ||
7464 | expect: $elm$http$Http$expectWhatever($author$project$Signup$CreationSuccess), | ||
7465 | headers: _List_Nil, | ||
7466 | method: 'POST', | ||
7467 | timeout: $elm$core$Maybe$Nothing, | ||
7468 | tracker: $elm$core$Maybe$Nothing, | ||
7469 | url: 'http://127.0.0.1:7878/user/new' | ||
7470 | }); | ||
7471 | }; | ||
7472 | var $elm$core$Basics$neq = _Utils_notEqual; | ||
7473 | var $elm$core$String$foldr = _String_foldr; | ||
7474 | var $elm$core$String$toList = function (string) { | ||
7475 | return A3($elm$core$String$foldr, $elm$core$List$cons, _List_Nil, string); | ||
7476 | }; | ||
7477 | var $author$project$Signup$update = F2( | ||
7478 | function (msg, model) { | ||
7479 | switch (msg.$) { | ||
7480 | case 'UserEntered': | ||
7481 | var s = msg.a; | ||
7482 | return _Utils_Tuple2( | ||
7483 | _Utils_update( | ||
7484 | model, | ||
7485 | {username: s}), | ||
7486 | $elm$core$Platform$Cmd$none); | ||
7487 | case 'PassEntered': | ||
7488 | var s = msg.a; | ||
7489 | return _Utils_Tuple2( | ||
7490 | _Utils_update( | ||
7491 | model, | ||
7492 | {password: s}), | ||
7493 | $elm$core$Platform$Cmd$none); | ||
7494 | case 'PhoneEntered': | ||
7495 | var s = msg.a; | ||
7496 | var status = (($elm$core$String$length(s) !== 10) || A2( | ||
7497 | $elm$core$List$all, | ||
7498 | A2($elm$core$Basics$composeL, $elm$core$Basics$not, $elm$core$Char$isDigit), | ||
7499 | $elm$core$String$toList(s))) ? $author$project$Signup$InvalidPhone : $author$project$Signup$Empty; | ||
7500 | return _Utils_Tuple2( | ||
7501 | _Utils_update( | ||
7502 | model, | ||
7503 | {phoneNumber: s, status: status}), | ||
7504 | $elm$core$Platform$Cmd$none); | ||
7505 | case 'EmailEntered': | ||
7506 | var s = msg.a; | ||
7507 | var status = (!A2($elm$core$String$contains, '@', s)) ? $author$project$Signup$InvalidEmail : $author$project$Signup$Empty; | ||
7508 | return _Utils_Tuple2( | ||
7509 | _Utils_update( | ||
7510 | model, | ||
7511 | {emailId: s, status: status}), | ||
7512 | $elm$core$Platform$Cmd$none); | ||
7513 | case 'AddressEntered': | ||
7514 | var s = msg.a; | ||
7515 | return _Utils_Tuple2( | ||
7516 | _Utils_update( | ||
7517 | model, | ||
7518 | { | ||
7519 | address: $elm$core$Maybe$Just(s) | ||
7520 | }), | ||
7521 | $elm$core$Platform$Cmd$none); | ||
7522 | case 'CreatePressed': | ||
7523 | return _Utils_Tuple2( | ||
7524 | _Utils_update( | ||
7525 | model, | ||
7526 | {status: $author$project$Signup$CreatingUser}), | ||
7527 | $author$project$Signup$checkExists(model)); | ||
7528 | case 'CreationSuccess': | ||
7529 | var res = msg.a; | ||
7530 | if (res.$ === 'Ok') { | ||
7531 | return _Utils_Tuple2( | ||
7532 | _Utils_update( | ||
7533 | model, | ||
7534 | {status: $author$project$Signup$CreatedSuccessfully}), | ||
7535 | $elm$core$Platform$Cmd$none); | ||
7536 | } else { | ||
7537 | return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none); | ||
7538 | } | ||
7539 | case 'CreationFail': | ||
7540 | return _Utils_Tuple2($author$project$Signup$init, $elm$core$Platform$Cmd$none); | ||
7541 | default: | ||
7542 | var res = msg.a; | ||
7543 | _v2$2: | ||
7544 | while (true) { | ||
7545 | if (res.$ === 'Ok') { | ||
7546 | switch (res.a) { | ||
7547 | case 'true': | ||
7548 | return _Utils_Tuple2( | ||
7549 | _Utils_update( | ||
7550 | model, | ||
7551 | {status: $author$project$Signup$UsernameTaken}), | ||
7552 | $elm$core$Platform$Cmd$none); | ||
7553 | case 'false': | ||
7554 | var _v3 = A2($elm$core$Debug$log, 'signup', 'Hit create user ...'); | ||
7555 | return _Utils_Tuple2( | ||
7556 | _Utils_update( | ||
7557 | model, | ||
7558 | {status: $author$project$Signup$CreatingUser}), | ||
7559 | $author$project$Signup$createUser(model)); | ||
7560 | default: | ||
7561 | break _v2$2; | ||
7562 | } | ||
7563 | } else { | ||
7564 | break _v2$2; | ||
7565 | } | ||
7566 | } | ||
7567 | return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none); | ||
7568 | } | ||
7569 | }); | ||
7570 | var $author$project$Main$update = F2( | ||
7571 | function (msg, model) { | ||
7572 | switch (msg.$) { | ||
7573 | case 'LinkClicked': | ||
7574 | var urlRequest = msg.a; | ||
7575 | if (urlRequest.$ === 'Internal') { | ||
7576 | var url = urlRequest.a; | ||
7577 | return _Utils_Tuple2( | ||
7578 | model, | ||
7579 | A2( | ||
7580 | $elm$browser$Browser$Navigation$pushUrl, | ||
7581 | model.key, | ||
7582 | $elm$url$Url$toString(url))); | ||
7583 | } else { | ||
7584 | var href = urlRequest.a; | ||
7585 | return _Utils_Tuple2( | ||
7586 | model, | ||
7587 | $elm$browser$Browser$Navigation$load(href)); | ||
7588 | } | ||
7589 | case 'LogoutPressed': | ||
7590 | return _Utils_Tuple2(model, $author$project$Main$tryLogout); | ||
7591 | case 'LogoutSuccess': | ||
7592 | return _Utils_Tuple2( | ||
7593 | _Utils_update( | ||
7594 | model, | ||
7595 | {loginModel: $author$project$Login$init}), | ||
7596 | A2($elm$browser$Browser$Navigation$replaceUrl, model.key, '/login')); | ||
7597 | case 'UrlChanged': | ||
7598 | var url = msg.a; | ||
7599 | var parsedUrl = A2($elm$url$Url$Parser$parse, $author$project$Main$parseRoute, url); | ||
7600 | if (parsedUrl.$ === 'Just') { | ||
7601 | switch (parsedUrl.a.$) { | ||
7602 | case 'CatalogPage': | ||
7603 | var _v3 = parsedUrl.a; | ||
7604 | return _Utils_Tuple2( | ||
7605 | _Utils_update( | ||
7606 | model, | ||
7607 | {location: $author$project$Main$CatalogPage}), | ||
7608 | A2($elm$core$Platform$Cmd$map, $author$project$Main$CatalogMessage, $author$project$Catalog$fetchProducts)); | ||
7609 | case 'ProductPage': | ||
7610 | var id = parsedUrl.a.a; | ||
7611 | var cmds = A2( | ||
7612 | $elm$core$List$map, | ||
7613 | $elm$core$Platform$Cmd$map($author$project$Main$ProductMessage), | ||
7614 | _List_fromArray( | ||
7615 | [ | ||
7616 | $author$project$Product$fetchListing(id), | ||
7617 | $author$project$Product$fetchRatings(id) | ||
7618 | ])); | ||
7619 | return _Utils_Tuple2( | ||
7620 | _Utils_update( | ||
7621 | model, | ||
7622 | { | ||
7623 | location: $author$project$Main$ProductPage(id) | ||
7624 | }), | ||
7625 | $elm$core$Platform$Cmd$batch(cmds)); | ||
7626 | case 'CartPage': | ||
7627 | var _v4 = parsedUrl.a; | ||
7628 | var cmd = A2($elm$core$Platform$Cmd$map, $author$project$Main$CartMessage, $author$project$Cart$fetchCartItems); | ||
7629 | return _Utils_Tuple2( | ||
7630 | _Utils_update( | ||
7631 | model, | ||
7632 | {location: $author$project$Main$CartPage}), | ||
7633 | cmd); | ||
7634 | case 'CheckoutPage': | ||
7635 | var _v5 = parsedUrl.a; | ||
7636 | var cmd = A2($elm$core$Platform$Cmd$map, $author$project$Main$CheckoutMessage, $author$project$Checkout$fetchAmount); | ||
7637 | var _v6 = A2($elm$core$Debug$log, 'err', 'loading checkout page ...'); | ||
7638 | return _Utils_Tuple2( | ||
7639 | _Utils_update( | ||
7640 | model, | ||
7641 | {location: $author$project$Main$CheckoutPage}), | ||
7642 | cmd); | ||
7643 | default: | ||
7644 | var p = parsedUrl.a; | ||
7645 | return _Utils_Tuple2( | ||
7646 | _Utils_update( | ||
7647 | model, | ||
7648 | {location: p}), | ||
7649 | $elm$core$Platform$Cmd$none); | ||
7650 | } | ||
7651 | } else { | ||
7652 | return _Utils_Tuple2( | ||
7653 | _Utils_update( | ||
7654 | model, | ||
7655 | {location: $author$project$Main$NotFoundPage}), | ||
7656 | $elm$core$Platform$Cmd$none); | ||
7657 | } | ||
7658 | case 'LoginMessage': | ||
7659 | var lm = msg.a; | ||
7660 | var _v7 = A2($author$project$Login$update, lm, model.loginModel); | ||
7661 | var lmn = _v7.a; | ||
7662 | var cmd = _v7.b; | ||
7663 | var redir = function () { | ||
7664 | var _v8 = lmn.loginStatus; | ||
7665 | if (_v8.$ === 'LoggedIn') { | ||
7666 | return A2($elm$browser$Browser$Navigation$replaceUrl, model.key, '/catalog'); | ||
7667 | } else { | ||
7668 | return $elm$core$Platform$Cmd$none; | ||
7669 | } | ||
7670 | }(); | ||
7671 | return _Utils_Tuple2( | ||
7672 | _Utils_update( | ||
7673 | model, | ||
7674 | {loginModel: lmn}), | ||
7675 | $elm$core$Platform$Cmd$batch( | ||
7676 | _List_fromArray( | ||
7677 | [ | ||
7678 | A2($elm$core$Platform$Cmd$map, $author$project$Main$LoginMessage, cmd), | ||
7679 | redir | ||
7680 | ]))); | ||
7681 | case 'SignupMessage': | ||
7682 | var sm = msg.a; | ||
7683 | var _v9 = A2($author$project$Signup$update, sm, model.signupModel); | ||
7684 | var smn = _v9.a; | ||
7685 | var cmd = _v9.b; | ||
7686 | var redir = function () { | ||
7687 | var _v10 = smn.status; | ||
7688 | if (_v10.$ === 'CreatedSuccessfully') { | ||
7689 | return A2($elm$browser$Browser$Navigation$replaceUrl, model.key, '/login'); | ||
7690 | } else { | ||
7691 | return $elm$core$Platform$Cmd$none; | ||
7692 | } | ||
7693 | }(); | ||
7694 | return _Utils_Tuple2( | ||
7695 | _Utils_update( | ||
7696 | model, | ||
7697 | {signupModel: smn}), | ||
7698 | $elm$core$Platform$Cmd$batch( | ||
7699 | _List_fromArray( | ||
7700 | [ | ||
7701 | A2($elm$core$Platform$Cmd$map, $author$project$Main$SignupMessage, cmd), | ||
7702 | redir | ||
7703 | ]))); | ||
7704 | case 'CatalogMessage': | ||
7705 | var cm = msg.a; | ||
7706 | var _v11 = A2($author$project$Catalog$update, cm, model.catalogModel); | ||
7707 | var cmn = _v11.a; | ||
7708 | var cmd = _v11.b; | ||
7709 | return _Utils_Tuple2( | ||
7710 | _Utils_update( | ||
7711 | model, | ||
7712 | {catalogModel: cmn}), | ||
7713 | A2($elm$core$Platform$Cmd$map, $author$project$Main$CatalogMessage, cmd)); | ||
7714 | case 'CartMessage': | ||
7715 | var cm = msg.a; | ||
7716 | var _v12 = A2($author$project$Cart$update, cm, model.cartModel); | ||
7717 | var cmn = _v12.a; | ||
7718 | var cmd = _v12.b; | ||
7719 | return _Utils_Tuple2( | ||
7720 | _Utils_update( | ||
7721 | model, | ||
7722 | {cartModel: cmn}), | ||
7723 | A2($elm$core$Platform$Cmd$map, $author$project$Main$CartMessage, cmd)); | ||
7724 | case 'CheckoutMessage': | ||
7725 | var cm = msg.a; | ||
7726 | var _v13 = A2($author$project$Checkout$update, cm, model.checkoutModel); | ||
7727 | var cmn = _v13.a; | ||
7728 | var cmd = _v13.b; | ||
7729 | var _v14 = A2($elm$core$Debug$log, 'err', 'received checkout message ...'); | ||
7730 | return _Utils_Tuple2( | ||
7731 | _Utils_update( | ||
7732 | model, | ||
7733 | {checkoutModel: cmn}), | ||
7734 | A2($elm$core$Platform$Cmd$map, $author$project$Main$CheckoutMessage, cmd)); | ||
7735 | default: | ||
7736 | var pm = msg.a; | ||
7737 | var redir = function () { | ||
7738 | if (pm.$ === 'AddToCartSuccess') { | ||
7739 | return A2($elm$browser$Browser$Navigation$replaceUrl, model.key, '/cart'); | ||
7740 | } else { | ||
7741 | return $elm$core$Platform$Cmd$none; | ||
7742 | } | ||
7743 | }(); | ||
7744 | var _v15 = A2($author$project$Product$update, pm, model.productModel); | ||
7745 | var pmn = _v15.a; | ||
7746 | var cmd = _v15.b; | ||
7747 | return _Utils_Tuple2( | ||
7748 | _Utils_update( | ||
7749 | model, | ||
7750 | {productModel: pmn}), | ||
7751 | $elm$core$Platform$Cmd$batch( | ||
7752 | _List_fromArray( | ||
7753 | [ | ||
7754 | A2($elm$core$Platform$Cmd$map, $author$project$Main$ProductMessage, cmd), | ||
7755 | redir | ||
7756 | ]))); | ||
7757 | } | ||
7758 | }); | ||
7759 | var $rtfeldman$elm_css$VirtualDom$Styled$Node = F3( | ||
7760 | function (a, b, c) { | ||
7761 | return {$: 'Node', a: a, b: b, c: c}; | ||
7762 | }); | ||
7763 | var $rtfeldman$elm_css$VirtualDom$Styled$node = $rtfeldman$elm_css$VirtualDom$Styled$Node; | ||
7764 | var $rtfeldman$elm_css$Html$Styled$node = $rtfeldman$elm_css$VirtualDom$Styled$node; | ||
7765 | var $rtfeldman$elm_css$Html$Styled$a = $rtfeldman$elm_css$Html$Styled$node('a'); | ||
7766 | var $rtfeldman$elm_css$Html$Styled$div = $rtfeldman$elm_css$Html$Styled$node('div'); | ||
7767 | var $rtfeldman$elm_css$VirtualDom$Styled$Attribute = F3( | ||
7768 | function (a, b, c) { | ||
7769 | return {$: 'Attribute', a: a, b: b, c: c}; | ||
7770 | }); | ||
7771 | var $elm$virtual_dom$VirtualDom$property = F2( | ||
7772 | function (key, value) { | ||
7773 | return A2( | ||
7774 | _VirtualDom_property, | ||
7775 | _VirtualDom_noInnerHtmlOrFormAction(key), | ||
7776 | _VirtualDom_noJavaScriptOrHtmlUri(value)); | ||
7777 | }); | ||
7778 | var $rtfeldman$elm_css$VirtualDom$Styled$property = F2( | ||
7779 | function (key, value) { | ||
7780 | return A3( | ||
7781 | $rtfeldman$elm_css$VirtualDom$Styled$Attribute, | ||
7782 | A2($elm$virtual_dom$VirtualDom$property, key, value), | ||
7783 | _List_Nil, | ||
7784 | ''); | ||
7785 | }); | ||
7786 | var $rtfeldman$elm_css$Html$Styled$Attributes$stringProperty = F2( | ||
7787 | function (key, string) { | ||
7788 | return A2( | ||
7789 | $rtfeldman$elm_css$VirtualDom$Styled$property, | ||
7790 | key, | ||
7791 | $elm$json$Json$Encode$string(string)); | ||
7792 | }); | ||
7793 | var $rtfeldman$elm_css$Html$Styled$Attributes$href = function (url) { | ||
7794 | return A2($rtfeldman$elm_css$Html$Styled$Attributes$stringProperty, 'href', url); | ||
7795 | }; | ||
7796 | var $rtfeldman$elm_css$Html$Styled$li = $rtfeldman$elm_css$Html$Styled$node('li'); | ||
7797 | var $rtfeldman$elm_css$VirtualDom$Styled$KeyedNode = F3( | ||
7798 | function (a, b, c) { | ||
7799 | return {$: 'KeyedNode', a: a, b: b, c: c}; | ||
7800 | }); | ||
7801 | var $rtfeldman$elm_css$VirtualDom$Styled$KeyedNodeNS = F4( | ||
7802 | function (a, b, c, d) { | ||
7803 | return {$: 'KeyedNodeNS', a: a, b: b, c: c, d: d}; | ||
7804 | }); | ||
7805 | var $rtfeldman$elm_css$VirtualDom$Styled$NodeNS = F4( | ||
7806 | function (a, b, c, d) { | ||
7807 | return {$: 'NodeNS', a: a, b: b, c: c, d: d}; | ||
7808 | }); | ||
7809 | var $rtfeldman$elm_css$VirtualDom$Styled$Unstyled = function (a) { | ||
7810 | return {$: 'Unstyled', a: a}; | ||
7811 | }; | ||
7812 | var $elm$virtual_dom$VirtualDom$map = _VirtualDom_map; | ||
7813 | var $elm$virtual_dom$VirtualDom$mapAttribute = _VirtualDom_mapAttribute; | ||
7814 | var $rtfeldman$elm_css$VirtualDom$Styled$mapAttribute = F2( | ||
7815 | function (transform, _v0) { | ||
7816 | var prop = _v0.a; | ||
7817 | var styles = _v0.b; | ||
7818 | var classname = _v0.c; | ||
7819 | return A3( | ||
7820 | $rtfeldman$elm_css$VirtualDom$Styled$Attribute, | ||
7821 | A2($elm$virtual_dom$VirtualDom$mapAttribute, transform, prop), | ||
7822 | styles, | ||
7823 | classname); | ||
7824 | }); | ||
7825 | var $rtfeldman$elm_css$VirtualDom$Styled$map = F2( | ||
7826 | function (transform, vdomNode) { | ||
7827 | switch (vdomNode.$) { | ||
7828 | case 'Node': | ||
7829 | var elemType = vdomNode.a; | ||
7830 | var properties = vdomNode.b; | ||
7831 | var children = vdomNode.c; | ||
7832 | return A3( | ||
7833 | $rtfeldman$elm_css$VirtualDom$Styled$Node, | ||
7834 | elemType, | ||
7835 | A2( | ||
7836 | $elm$core$List$map, | ||
7837 | $rtfeldman$elm_css$VirtualDom$Styled$mapAttribute(transform), | ||
7838 | properties), | ||
7839 | A2( | ||
7840 | $elm$core$List$map, | ||
7841 | $rtfeldman$elm_css$VirtualDom$Styled$map(transform), | ||
7842 | children)); | ||
7843 | case 'NodeNS': | ||
7844 | var ns = vdomNode.a; | ||
7845 | var elemType = vdomNode.b; | ||
7846 | var properties = vdomNode.c; | ||
7847 | var children = vdomNode.d; | ||
7848 | return A4( | ||
7849 | $rtfeldman$elm_css$VirtualDom$Styled$NodeNS, | ||
7850 | ns, | ||
7851 | elemType, | ||
7852 | A2( | ||
7853 | $elm$core$List$map, | ||
7854 | $rtfeldman$elm_css$VirtualDom$Styled$mapAttribute(transform), | ||
7855 | properties), | ||
7856 | A2( | ||
7857 | $elm$core$List$map, | ||
7858 | $rtfeldman$elm_css$VirtualDom$Styled$map(transform), | ||
7859 | children)); | ||
7860 | case 'KeyedNode': | ||
7861 | var elemType = vdomNode.a; | ||
7862 | var properties = vdomNode.b; | ||
7863 | var children = vdomNode.c; | ||
7864 | return A3( | ||
7865 | $rtfeldman$elm_css$VirtualDom$Styled$KeyedNode, | ||
7866 | elemType, | ||
7867 | A2( | ||
7868 | $elm$core$List$map, | ||
7869 | $rtfeldman$elm_css$VirtualDom$Styled$mapAttribute(transform), | ||
7870 | properties), | ||
7871 | A2( | ||
7872 | $elm$core$List$map, | ||
7873 | function (_v1) { | ||
7874 | var key = _v1.a; | ||
7875 | var child = _v1.b; | ||
7876 | return _Utils_Tuple2( | ||
7877 | key, | ||
7878 | A2($rtfeldman$elm_css$VirtualDom$Styled$map, transform, child)); | ||
7879 | }, | ||
7880 | children)); | ||
7881 | case 'KeyedNodeNS': | ||
7882 | var ns = vdomNode.a; | ||
7883 | var elemType = vdomNode.b; | ||
7884 | var properties = vdomNode.c; | ||
7885 | var children = vdomNode.d; | ||
7886 | return A4( | ||
7887 | $rtfeldman$elm_css$VirtualDom$Styled$KeyedNodeNS, | ||
7888 | ns, | ||
7889 | elemType, | ||
7890 | A2( | ||
7891 | $elm$core$List$map, | ||
7892 | $rtfeldman$elm_css$VirtualDom$Styled$mapAttribute(transform), | ||
7893 | properties), | ||
7894 | A2( | ||
7895 | $elm$core$List$map, | ||
7896 | function (_v2) { | ||
7897 | var key = _v2.a; | ||
7898 | var child = _v2.b; | ||
7899 | return _Utils_Tuple2( | ||
7900 | key, | ||
7901 | A2($rtfeldman$elm_css$VirtualDom$Styled$map, transform, child)); | ||
7902 | }, | ||
7903 | children)); | ||
7904 | default: | ||
7905 | var vdom = vdomNode.a; | ||
7906 | return $rtfeldman$elm_css$VirtualDom$Styled$Unstyled( | ||
7907 | A2($elm$virtual_dom$VirtualDom$map, transform, vdom)); | ||
7908 | } | ||
7909 | }); | ||
7910 | var $rtfeldman$elm_css$Html$Styled$map = $rtfeldman$elm_css$VirtualDom$Styled$map; | ||
7911 | var $elm$core$List$singleton = function (value) { | ||
7912 | return _List_fromArray( | ||
7913 | [value]); | ||
7914 | }; | ||
7915 | var $elm$core$List$isEmpty = function (xs) { | ||
7916 | if (!xs.b) { | ||
7917 | return true; | ||
7918 | } else { | ||
7919 | return false; | ||
7920 | } | ||
7921 | }; | ||
7922 | var $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyles = F2( | ||
7923 | function (_v0, styles) { | ||
7924 | var newStyles = _v0.b; | ||
7925 | var classname = _v0.c; | ||
7926 | return $elm$core$List$isEmpty(newStyles) ? styles : A3($elm$core$Dict$insert, classname, newStyles, styles); | ||
7927 | }); | ||
7928 | var $rtfeldman$elm_css$VirtualDom$Styled$extractUnstyledAttribute = function (_v0) { | ||
7929 | var val = _v0.a; | ||
7930 | return val; | ||
7931 | }; | ||
7932 | var $elm$virtual_dom$VirtualDom$keyedNode = function (tag) { | ||
7933 | return _VirtualDom_keyedNode( | ||
7934 | _VirtualDom_noScript(tag)); | ||
7935 | }; | ||
7936 | var $elm$virtual_dom$VirtualDom$keyedNodeNS = F2( | ||
7937 | function (namespace, tag) { | ||
7938 | return A2( | ||
7939 | _VirtualDom_keyedNodeNS, | ||
7940 | namespace, | ||
7941 | _VirtualDom_noScript(tag)); | ||
7942 | }); | ||
7943 | var $elm$virtual_dom$VirtualDom$node = function (tag) { | ||
7944 | return _VirtualDom_node( | ||
7945 | _VirtualDom_noScript(tag)); | ||
7946 | }; | ||
7947 | var $elm$virtual_dom$VirtualDom$nodeNS = function (tag) { | ||
7948 | return _VirtualDom_nodeNS( | ||
7949 | _VirtualDom_noScript(tag)); | ||
7950 | }; | ||
7951 | var $rtfeldman$elm_css$VirtualDom$Styled$accumulateKeyedStyledHtml = F2( | ||
7952 | function (_v6, _v7) { | ||
7953 | var key = _v6.a; | ||
7954 | var html = _v6.b; | ||
7955 | var pairs = _v7.a; | ||
7956 | var styles = _v7.b; | ||
7957 | switch (html.$) { | ||
7958 | case 'Unstyled': | ||
7959 | var vdom = html.a; | ||
7960 | return _Utils_Tuple2( | ||
7961 | A2( | ||
7962 | $elm$core$List$cons, | ||
7963 | _Utils_Tuple2(key, vdom), | ||
7964 | pairs), | ||
7965 | styles); | ||
7966 | case 'Node': | ||
7967 | var elemType = html.a; | ||
7968 | var properties = html.b; | ||
7969 | var children = html.c; | ||
7970 | var combinedStyles = A3($elm$core$List$foldl, $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyles, styles, properties); | ||
7971 | var _v9 = A3( | ||
7972 | $elm$core$List$foldl, | ||
7973 | $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyledHtml, | ||
7974 | _Utils_Tuple2(_List_Nil, combinedStyles), | ||
7975 | children); | ||
7976 | var childNodes = _v9.a; | ||
7977 | var finalStyles = _v9.b; | ||
7978 | var vdom = A3( | ||
7979 | $elm$virtual_dom$VirtualDom$node, | ||
7980 | elemType, | ||
7981 | A2($elm$core$List$map, $rtfeldman$elm_css$VirtualDom$Styled$extractUnstyledAttribute, properties), | ||
7982 | $elm$core$List$reverse(childNodes)); | ||
7983 | return _Utils_Tuple2( | ||
7984 | A2( | ||
7985 | $elm$core$List$cons, | ||
7986 | _Utils_Tuple2(key, vdom), | ||
7987 | pairs), | ||
7988 | finalStyles); | ||
7989 | case 'NodeNS': | ||
7990 | var ns = html.a; | ||
7991 | var elemType = html.b; | ||
7992 | var properties = html.c; | ||
7993 | var children = html.d; | ||
7994 | var combinedStyles = A3($elm$core$List$foldl, $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyles, styles, properties); | ||
7995 | var _v10 = A3( | ||
7996 | $elm$core$List$foldl, | ||
7997 | $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyledHtml, | ||
7998 | _Utils_Tuple2(_List_Nil, combinedStyles), | ||
7999 | children); | ||
8000 | var childNodes = _v10.a; | ||
8001 | var finalStyles = _v10.b; | ||
8002 | var vdom = A4( | ||
8003 | $elm$virtual_dom$VirtualDom$nodeNS, | ||
8004 | ns, | ||
8005 | elemType, | ||
8006 | A2($elm$core$List$map, $rtfeldman$elm_css$VirtualDom$Styled$extractUnstyledAttribute, properties), | ||
8007 | $elm$core$List$reverse(childNodes)); | ||
8008 | return _Utils_Tuple2( | ||
8009 | A2( | ||
8010 | $elm$core$List$cons, | ||
8011 | _Utils_Tuple2(key, vdom), | ||
8012 | pairs), | ||
8013 | finalStyles); | ||
8014 | case 'KeyedNode': | ||
8015 | var elemType = html.a; | ||
8016 | var properties = html.b; | ||
8017 | var children = html.c; | ||
8018 | var combinedStyles = A3($elm$core$List$foldl, $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyles, styles, properties); | ||
8019 | var _v11 = A3( | ||
8020 | $elm$core$List$foldl, | ||
8021 | $rtfeldman$elm_css$VirtualDom$Styled$accumulateKeyedStyledHtml, | ||
8022 | _Utils_Tuple2(_List_Nil, combinedStyles), | ||
8023 | children); | ||
8024 | var childNodes = _v11.a; | ||
8025 | var finalStyles = _v11.b; | ||
8026 | var vdom = A3( | ||
8027 | $elm$virtual_dom$VirtualDom$keyedNode, | ||
8028 | elemType, | ||
8029 | A2($elm$core$List$map, $rtfeldman$elm_css$VirtualDom$Styled$extractUnstyledAttribute, properties), | ||
8030 | $elm$core$List$reverse(childNodes)); | ||
8031 | return _Utils_Tuple2( | ||
8032 | A2( | ||
8033 | $elm$core$List$cons, | ||
8034 | _Utils_Tuple2(key, vdom), | ||
8035 | pairs), | ||
8036 | finalStyles); | ||
8037 | default: | ||
8038 | var ns = html.a; | ||
8039 | var elemType = html.b; | ||
8040 | var properties = html.c; | ||
8041 | var children = html.d; | ||
8042 | var combinedStyles = A3($elm$core$List$foldl, $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyles, styles, properties); | ||
8043 | var _v12 = A3( | ||
8044 | $elm$core$List$foldl, | ||
8045 | $rtfeldman$elm_css$VirtualDom$Styled$accumulateKeyedStyledHtml, | ||
8046 | _Utils_Tuple2(_List_Nil, combinedStyles), | ||
8047 | children); | ||
8048 | var childNodes = _v12.a; | ||
8049 | var finalStyles = _v12.b; | ||
8050 | var vdom = A4( | ||
8051 | $elm$virtual_dom$VirtualDom$keyedNodeNS, | ||
8052 | ns, | ||
8053 | elemType, | ||
8054 | A2($elm$core$List$map, $rtfeldman$elm_css$VirtualDom$Styled$extractUnstyledAttribute, properties), | ||
8055 | $elm$core$List$reverse(childNodes)); | ||
8056 | return _Utils_Tuple2( | ||
8057 | A2( | ||
8058 | $elm$core$List$cons, | ||
8059 | _Utils_Tuple2(key, vdom), | ||
8060 | pairs), | ||
8061 | finalStyles); | ||
8062 | } | ||
8063 | }); | ||
8064 | var $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyledHtml = F2( | ||
8065 | function (html, _v0) { | ||
8066 | var nodes = _v0.a; | ||
8067 | var styles = _v0.b; | ||
8068 | switch (html.$) { | ||
8069 | case 'Unstyled': | ||
8070 | var vdomNode = html.a; | ||
8071 | return _Utils_Tuple2( | ||
8072 | A2($elm$core$List$cons, vdomNode, nodes), | ||
8073 | styles); | ||
8074 | case 'Node': | ||
8075 | var elemType = html.a; | ||
8076 | var properties = html.b; | ||
8077 | var children = html.c; | ||
8078 | var combinedStyles = A3($elm$core$List$foldl, $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyles, styles, properties); | ||
8079 | var _v2 = A3( | ||
8080 | $elm$core$List$foldl, | ||
8081 | $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyledHtml, | ||
8082 | _Utils_Tuple2(_List_Nil, combinedStyles), | ||
8083 | children); | ||
8084 | var childNodes = _v2.a; | ||
8085 | var finalStyles = _v2.b; | ||
8086 | var vdomNode = A3( | ||
8087 | $elm$virtual_dom$VirtualDom$node, | ||
8088 | elemType, | ||
8089 | A2($elm$core$List$map, $rtfeldman$elm_css$VirtualDom$Styled$extractUnstyledAttribute, properties), | ||
8090 | $elm$core$List$reverse(childNodes)); | ||
8091 | return _Utils_Tuple2( | ||
8092 | A2($elm$core$List$cons, vdomNode, nodes), | ||
8093 | finalStyles); | ||
8094 | case 'NodeNS': | ||
8095 | var ns = html.a; | ||
8096 | var elemType = html.b; | ||
8097 | var properties = html.c; | ||
8098 | var children = html.d; | ||
8099 | var combinedStyles = A3($elm$core$List$foldl, $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyles, styles, properties); | ||
8100 | var _v3 = A3( | ||
8101 | $elm$core$List$foldl, | ||
8102 | $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyledHtml, | ||
8103 | _Utils_Tuple2(_List_Nil, combinedStyles), | ||
8104 | children); | ||
8105 | var childNodes = _v3.a; | ||
8106 | var finalStyles = _v3.b; | ||
8107 | var vdomNode = A4( | ||
8108 | $elm$virtual_dom$VirtualDom$nodeNS, | ||
8109 | ns, | ||
8110 | elemType, | ||
8111 | A2($elm$core$List$map, $rtfeldman$elm_css$VirtualDom$Styled$extractUnstyledAttribute, properties), | ||
8112 | $elm$core$List$reverse(childNodes)); | ||
8113 | return _Utils_Tuple2( | ||
8114 | A2($elm$core$List$cons, vdomNode, nodes), | ||
8115 | finalStyles); | ||
8116 | case 'KeyedNode': | ||
8117 | var elemType = html.a; | ||
8118 | var properties = html.b; | ||
8119 | var children = html.c; | ||
8120 | var combinedStyles = A3($elm$core$List$foldl, $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyles, styles, properties); | ||
8121 | var _v4 = A3( | ||
8122 | $elm$core$List$foldl, | ||
8123 | $rtfeldman$elm_css$VirtualDom$Styled$accumulateKeyedStyledHtml, | ||
8124 | _Utils_Tuple2(_List_Nil, combinedStyles), | ||
8125 | children); | ||
8126 | var childNodes = _v4.a; | ||
8127 | var finalStyles = _v4.b; | ||
8128 | var vdomNode = A3( | ||
8129 | $elm$virtual_dom$VirtualDom$keyedNode, | ||
8130 | elemType, | ||
8131 | A2($elm$core$List$map, $rtfeldman$elm_css$VirtualDom$Styled$extractUnstyledAttribute, properties), | ||
8132 | $elm$core$List$reverse(childNodes)); | ||
8133 | return _Utils_Tuple2( | ||
8134 | A2($elm$core$List$cons, vdomNode, nodes), | ||
8135 | finalStyles); | ||
8136 | default: | ||
8137 | var ns = html.a; | ||
8138 | var elemType = html.b; | ||
8139 | var properties = html.c; | ||
8140 | var children = html.d; | ||
8141 | var combinedStyles = A3($elm$core$List$foldl, $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyles, styles, properties); | ||
8142 | var _v5 = A3( | ||
8143 | $elm$core$List$foldl, | ||
8144 | $rtfeldman$elm_css$VirtualDom$Styled$accumulateKeyedStyledHtml, | ||
8145 | _Utils_Tuple2(_List_Nil, combinedStyles), | ||
8146 | children); | ||
8147 | var childNodes = _v5.a; | ||
8148 | var finalStyles = _v5.b; | ||
8149 | var vdomNode = A4( | ||
8150 | $elm$virtual_dom$VirtualDom$keyedNodeNS, | ||
8151 | ns, | ||
8152 | elemType, | ||
8153 | A2($elm$core$List$map, $rtfeldman$elm_css$VirtualDom$Styled$extractUnstyledAttribute, properties), | ||
8154 | $elm$core$List$reverse(childNodes)); | ||
8155 | return _Utils_Tuple2( | ||
8156 | A2($elm$core$List$cons, vdomNode, nodes), | ||
8157 | finalStyles); | ||
8158 | } | ||
8159 | }); | ||
8160 | var $elm$core$Dict$singleton = F2( | ||
8161 | function (key, value) { | ||
8162 | return A5($elm$core$Dict$RBNode_elm_builtin, $elm$core$Dict$Black, key, value, $elm$core$Dict$RBEmpty_elm_builtin, $elm$core$Dict$RBEmpty_elm_builtin); | ||
8163 | }); | ||
8164 | var $rtfeldman$elm_css$VirtualDom$Styled$stylesFromPropertiesHelp = F2( | ||
8165 | function (candidate, properties) { | ||
8166 | stylesFromPropertiesHelp: | ||
8167 | while (true) { | ||
8168 | if (!properties.b) { | ||
8169 | return candidate; | ||
8170 | } else { | ||
8171 | var _v1 = properties.a; | ||
8172 | var styles = _v1.b; | ||
8173 | var classname = _v1.c; | ||
8174 | var rest = properties.b; | ||
8175 | if ($elm$core$String$isEmpty(classname)) { | ||
8176 | var $temp$candidate = candidate, | ||
8177 | $temp$properties = rest; | ||
8178 | candidate = $temp$candidate; | ||
8179 | properties = $temp$properties; | ||
8180 | continue stylesFromPropertiesHelp; | ||
8181 | } else { | ||
8182 | var $temp$candidate = $elm$core$Maybe$Just( | ||
8183 | _Utils_Tuple2(classname, styles)), | ||
8184 | $temp$properties = rest; | ||
8185 | candidate = $temp$candidate; | ||
8186 | properties = $temp$properties; | ||
8187 | continue stylesFromPropertiesHelp; | ||
8188 | } | ||
8189 | } | ||
8190 | } | ||
8191 | }); | ||
8192 | var $rtfeldman$elm_css$VirtualDom$Styled$stylesFromProperties = function (properties) { | ||
8193 | var _v0 = A2($rtfeldman$elm_css$VirtualDom$Styled$stylesFromPropertiesHelp, $elm$core$Maybe$Nothing, properties); | ||
8194 | if (_v0.$ === 'Nothing') { | ||
8195 | return $elm$core$Dict$empty; | ||
8196 | } else { | ||
8197 | var _v1 = _v0.a; | ||
8198 | var classname = _v1.a; | ||
8199 | var styles = _v1.b; | ||
8200 | return A2($elm$core$Dict$singleton, classname, styles); | ||
8201 | } | ||
8202 | }; | ||
8203 | var $elm$virtual_dom$VirtualDom$text = _VirtualDom_text; | ||
8204 | var $rtfeldman$elm_css$Css$Structure$compactHelp = F2( | ||
8205 | function (declaration, _v0) { | ||
8206 | var keyframesByName = _v0.a; | ||
8207 | var declarations = _v0.b; | ||
8208 | switch (declaration.$) { | ||
8209 | case 'StyleBlockDeclaration': | ||
8210 | var _v2 = declaration.a; | ||
8211 | var properties = _v2.c; | ||
8212 | return $elm$core$List$isEmpty(properties) ? _Utils_Tuple2(keyframesByName, declarations) : _Utils_Tuple2( | ||
8213 | keyframesByName, | ||
8214 | A2($elm$core$List$cons, declaration, declarations)); | ||
8215 | case 'MediaRule': | ||
8216 | var styleBlocks = declaration.b; | ||
8217 | return A2( | ||
8218 | $elm$core$List$all, | ||
8219 | function (_v3) { | ||
8220 | var properties = _v3.c; | ||
8221 | return $elm$core$List$isEmpty(properties); | ||
8222 | }, | ||
8223 | styleBlocks) ? _Utils_Tuple2(keyframesByName, declarations) : _Utils_Tuple2( | ||
8224 | keyframesByName, | ||
8225 | A2($elm$core$List$cons, declaration, declarations)); | ||
8226 | case 'SupportsRule': | ||
8227 | var otherDeclarations = declaration.b; | ||
8228 | return $elm$core$List$isEmpty(otherDeclarations) ? _Utils_Tuple2(keyframesByName, declarations) : _Utils_Tuple2( | ||
8229 | keyframesByName, | ||
8230 | A2($elm$core$List$cons, declaration, declarations)); | ||
8231 | case 'DocumentRule': | ||
8232 | return _Utils_Tuple2( | ||
8233 | keyframesByName, | ||
8234 | A2($elm$core$List$cons, declaration, declarations)); | ||
8235 | case 'PageRule': | ||
8236 | var properties = declaration.b; | ||
8237 | return $elm$core$List$isEmpty(properties) ? _Utils_Tuple2(keyframesByName, declarations) : _Utils_Tuple2( | ||
8238 | keyframesByName, | ||
8239 | A2($elm$core$List$cons, declaration, declarations)); | ||
8240 | case 'FontFace': | ||
8241 | var properties = declaration.a; | ||
8242 | return $elm$core$List$isEmpty(properties) ? _Utils_Tuple2(keyframesByName, declarations) : _Utils_Tuple2( | ||
8243 | keyframesByName, | ||
8244 | A2($elm$core$List$cons, declaration, declarations)); | ||
8245 | case 'Keyframes': | ||
8246 | var record = declaration.a; | ||
8247 | return $elm$core$String$isEmpty(record.declaration) ? _Utils_Tuple2(keyframesByName, declarations) : _Utils_Tuple2( | ||
8248 | A3($elm$core$Dict$insert, record.name, record.declaration, keyframesByName), | ||
8249 | declarations); | ||
8250 | case 'Viewport': | ||
8251 | var properties = declaration.a; | ||
8252 | return $elm$core$List$isEmpty(properties) ? _Utils_Tuple2(keyframesByName, declarations) : _Utils_Tuple2( | ||
8253 | keyframesByName, | ||
8254 | A2($elm$core$List$cons, declaration, declarations)); | ||
8255 | case 'CounterStyle': | ||
8256 | var properties = declaration.a; | ||
8257 | return $elm$core$List$isEmpty(properties) ? _Utils_Tuple2(keyframesByName, declarations) : _Utils_Tuple2( | ||
8258 | keyframesByName, | ||
8259 | A2($elm$core$List$cons, declaration, declarations)); | ||
8260 | default: | ||
8261 | var tuples = declaration.a; | ||
8262 | return A2( | ||
8263 | $elm$core$List$all, | ||
8264 | function (_v4) { | ||
8265 | var properties = _v4.b; | ||
8266 | return $elm$core$List$isEmpty(properties); | ||
8267 | }, | ||
8268 | tuples) ? _Utils_Tuple2(keyframesByName, declarations) : _Utils_Tuple2( | ||
8269 | keyframesByName, | ||
8270 | A2($elm$core$List$cons, declaration, declarations)); | ||
8271 | } | ||
8272 | }); | ||
8273 | var $rtfeldman$elm_css$Css$Structure$Keyframes = function (a) { | ||
8274 | return {$: 'Keyframes', a: a}; | ||
8275 | }; | ||
8276 | var $rtfeldman$elm_css$Css$Structure$withKeyframeDeclarations = F2( | ||
8277 | function (keyframesByName, compactedDeclarations) { | ||
8278 | return A2( | ||
8279 | $elm$core$List$append, | ||
8280 | A2( | ||
8281 | $elm$core$List$map, | ||
8282 | function (_v0) { | ||
8283 | var name = _v0.a; | ||
8284 | var decl = _v0.b; | ||
8285 | return $rtfeldman$elm_css$Css$Structure$Keyframes( | ||
8286 | {declaration: decl, name: name}); | ||
8287 | }, | ||
8288 | $elm$core$Dict$toList(keyframesByName)), | ||
8289 | compactedDeclarations); | ||
8290 | }); | ||
8291 | var $rtfeldman$elm_css$Css$Structure$compactStylesheet = function (_v0) { | ||
8292 | var charset = _v0.charset; | ||
8293 | var imports = _v0.imports; | ||
8294 | var namespaces = _v0.namespaces; | ||
8295 | var declarations = _v0.declarations; | ||
8296 | var _v1 = A3( | ||
8297 | $elm$core$List$foldr, | ||
8298 | $rtfeldman$elm_css$Css$Structure$compactHelp, | ||
8299 | _Utils_Tuple2($elm$core$Dict$empty, _List_Nil), | ||
8300 | declarations); | ||
8301 | var keyframesByName = _v1.a; | ||
8302 | var compactedDeclarations = _v1.b; | ||
8303 | var finalDeclarations = A2($rtfeldman$elm_css$Css$Structure$withKeyframeDeclarations, keyframesByName, compactedDeclarations); | ||
8304 | return {charset: charset, declarations: finalDeclarations, imports: imports, namespaces: namespaces}; | ||
8305 | }; | ||
8306 | var $elm$core$Maybe$map = F2( | ||
8307 | function (f, maybe) { | ||
8308 | if (maybe.$ === 'Just') { | ||
8309 | var value = maybe.a; | ||
8310 | return $elm$core$Maybe$Just( | ||
8311 | f(value)); | ||
8312 | } else { | ||
8313 | return $elm$core$Maybe$Nothing; | ||
8314 | } | ||
8315 | }); | ||
8316 | var $rtfeldman$elm_css$Css$Structure$Output$charsetToString = function (charset) { | ||
8317 | return A2( | ||
8318 | $elm$core$Maybe$withDefault, | ||
8319 | '', | ||
8320 | A2( | ||
8321 | $elm$core$Maybe$map, | ||
8322 | function (str) { | ||
8323 | return '@charset \"' + (str + '\"'); | ||
8324 | }, | ||
8325 | charset)); | ||
8326 | }; | ||
8327 | var $elm$core$List$filter = F2( | ||
8328 | function (isGood, list) { | ||
8329 | return A3( | ||
8330 | $elm$core$List$foldr, | ||
8331 | F2( | ||
8332 | function (x, xs) { | ||
8333 | return isGood(x) ? A2($elm$core$List$cons, x, xs) : xs; | ||
8334 | }), | ||
8335 | _List_Nil, | ||
8336 | list); | ||
8337 | }); | ||
8338 | var $rtfeldman$elm_css$Css$Structure$Output$mediaExpressionToString = function (expression) { | ||
8339 | return '(' + (expression.feature + (A2( | ||
8340 | $elm$core$Maybe$withDefault, | ||
8341 | '', | ||
8342 | A2( | ||
8343 | $elm$core$Maybe$map, | ||
8344 | $elm$core$Basics$append(': '), | ||
8345 | expression.value)) + ')')); | ||
8346 | }; | ||
8347 | var $rtfeldman$elm_css$Css$Structure$Output$mediaTypeToString = function (mediaType) { | ||
8348 | switch (mediaType.$) { | ||
8349 | case 'Print': | ||
8350 | return 'print'; | ||
8351 | case 'Screen': | ||
8352 | return 'screen'; | ||
8353 | default: | ||
8354 | return 'speech'; | ||
8355 | } | ||
8356 | }; | ||
8357 | var $rtfeldman$elm_css$Css$Structure$Output$mediaQueryToString = function (mediaQuery) { | ||
8358 | var prefixWith = F3( | ||
8359 | function (str, mediaType, expressions) { | ||
8360 | return str + (' ' + A2( | ||
8361 | $elm$core$String$join, | ||
8362 | ' and ', | ||
8363 | A2( | ||
8364 | $elm$core$List$cons, | ||
8365 | $rtfeldman$elm_css$Css$Structure$Output$mediaTypeToString(mediaType), | ||
8366 | A2($elm$core$List$map, $rtfeldman$elm_css$Css$Structure$Output$mediaExpressionToString, expressions)))); | ||
8367 | }); | ||
8368 | switch (mediaQuery.$) { | ||
8369 | case 'AllQuery': | ||
8370 | var expressions = mediaQuery.a; | ||
8371 | return A2( | ||
8372 | $elm$core$String$join, | ||
8373 | ' and ', | ||
8374 | A2($elm$core$List$map, $rtfeldman$elm_css$Css$Structure$Output$mediaExpressionToString, expressions)); | ||
8375 | case 'OnlyQuery': | ||
8376 | var mediaType = mediaQuery.a; | ||
8377 | var expressions = mediaQuery.b; | ||
8378 | return A3(prefixWith, 'only', mediaType, expressions); | ||
8379 | case 'NotQuery': | ||
8380 | var mediaType = mediaQuery.a; | ||
8381 | var expressions = mediaQuery.b; | ||
8382 | return A3(prefixWith, 'not', mediaType, expressions); | ||
8383 | default: | ||
8384 | var str = mediaQuery.a; | ||
8385 | return str; | ||
8386 | } | ||
8387 | }; | ||
8388 | var $rtfeldman$elm_css$Css$Structure$Output$importMediaQueryToString = F2( | ||
8389 | function (name, mediaQuery) { | ||
8390 | return '@import \"' + (name + ($rtfeldman$elm_css$Css$Structure$Output$mediaQueryToString(mediaQuery) + '\"')); | ||
8391 | }); | ||
8392 | var $rtfeldman$elm_css$Css$Structure$Output$importToString = function (_v0) { | ||
8393 | var name = _v0.a; | ||
8394 | var mediaQueries = _v0.b; | ||
8395 | return A2( | ||
8396 | $elm$core$String$join, | ||
8397 | '\n', | ||
8398 | A2( | ||
8399 | $elm$core$List$map, | ||
8400 | $rtfeldman$elm_css$Css$Structure$Output$importMediaQueryToString(name), | ||
8401 | mediaQueries)); | ||
8402 | }; | ||
8403 | var $rtfeldman$elm_css$Css$Structure$Output$namespaceToString = function (_v0) { | ||
8404 | var prefix = _v0.a; | ||
8405 | var str = _v0.b; | ||
8406 | return '@namespace ' + (prefix + ('\"' + (str + '\"'))); | ||
8407 | }; | ||
8408 | var $rtfeldman$elm_css$Css$Structure$Output$spaceIndent = ' '; | ||
8409 | var $rtfeldman$elm_css$Css$Structure$Output$indent = function (str) { | ||
8410 | return _Utils_ap($rtfeldman$elm_css$Css$Structure$Output$spaceIndent, str); | ||
8411 | }; | ||
8412 | var $rtfeldman$elm_css$Css$Structure$Output$noIndent = ''; | ||
8413 | var $rtfeldman$elm_css$Css$Structure$Output$emitProperty = function (str) { | ||
8414 | return str + ';'; | ||
8415 | }; | ||
8416 | var $rtfeldman$elm_css$Css$Structure$Output$emitProperties = function (properties) { | ||
8417 | return A2( | ||
8418 | $elm$core$String$join, | ||
8419 | '\n', | ||
8420 | A2( | ||
8421 | $elm$core$List$map, | ||
8422 | A2($elm$core$Basics$composeL, $rtfeldman$elm_css$Css$Structure$Output$indent, $rtfeldman$elm_css$Css$Structure$Output$emitProperty), | ||
8423 | properties)); | ||
8424 | }; | ||
8425 | var $elm$core$String$append = _String_append; | ||
8426 | var $rtfeldman$elm_css$Css$Structure$Output$pseudoElementToString = function (_v0) { | ||
8427 | var str = _v0.a; | ||
8428 | return '::' + str; | ||
8429 | }; | ||
8430 | var $rtfeldman$elm_css$Css$Structure$Output$combinatorToString = function (combinator) { | ||
8431 | switch (combinator.$) { | ||
8432 | case 'AdjacentSibling': | ||
8433 | return '+'; | ||
8434 | case 'GeneralSibling': | ||
8435 | return '~'; | ||
8436 | case 'Child': | ||
8437 | return '>'; | ||
8438 | default: | ||
8439 | return ''; | ||
8440 | } | ||
8441 | }; | ||
8442 | var $rtfeldman$elm_css$Css$Structure$Output$repeatableSimpleSelectorToString = function (repeatableSimpleSelector) { | ||
8443 | switch (repeatableSimpleSelector.$) { | ||
8444 | case 'ClassSelector': | ||
8445 | var str = repeatableSimpleSelector.a; | ||
8446 | return '.' + str; | ||
8447 | case 'IdSelector': | ||
8448 | var str = repeatableSimpleSelector.a; | ||
8449 | return '#' + str; | ||
8450 | case 'PseudoClassSelector': | ||
8451 | var str = repeatableSimpleSelector.a; | ||
8452 | return ':' + str; | ||
8453 | default: | ||
8454 | var str = repeatableSimpleSelector.a; | ||
8455 | return '[' + (str + ']'); | ||
8456 | } | ||
8457 | }; | ||
8458 | var $rtfeldman$elm_css$Css$Structure$Output$simpleSelectorSequenceToString = function (simpleSelectorSequence) { | ||
8459 | switch (simpleSelectorSequence.$) { | ||
8460 | case 'TypeSelectorSequence': | ||
8461 | var str = simpleSelectorSequence.a.a; | ||
8462 | var repeatableSimpleSelectors = simpleSelectorSequence.b; | ||
8463 | return A2( | ||
8464 | $elm$core$String$join, | ||
8465 | '', | ||
8466 | A2( | ||
8467 | $elm$core$List$cons, | ||
8468 | str, | ||
8469 | A2($elm$core$List$map, $rtfeldman$elm_css$Css$Structure$Output$repeatableSimpleSelectorToString, repeatableSimpleSelectors))); | ||
8470 | case 'UniversalSelectorSequence': | ||
8471 | var repeatableSimpleSelectors = simpleSelectorSequence.a; | ||
8472 | return $elm$core$List$isEmpty(repeatableSimpleSelectors) ? '*' : A2( | ||
8473 | $elm$core$String$join, | ||
8474 | '', | ||
8475 | A2($elm$core$List$map, $rtfeldman$elm_css$Css$Structure$Output$repeatableSimpleSelectorToString, repeatableSimpleSelectors)); | ||
8476 | default: | ||
8477 | var str = simpleSelectorSequence.a; | ||
8478 | var repeatableSimpleSelectors = simpleSelectorSequence.b; | ||
8479 | return A2( | ||
8480 | $elm$core$String$join, | ||
8481 | '', | ||
8482 | A2( | ||
8483 | $elm$core$List$cons, | ||
8484 | str, | ||
8485 | A2($elm$core$List$map, $rtfeldman$elm_css$Css$Structure$Output$repeatableSimpleSelectorToString, repeatableSimpleSelectors))); | ||
8486 | } | ||
8487 | }; | ||
8488 | var $rtfeldman$elm_css$Css$Structure$Output$selectorChainToString = function (_v0) { | ||
8489 | var combinator = _v0.a; | ||
8490 | var sequence = _v0.b; | ||
8491 | return A2( | ||
8492 | $elm$core$String$join, | ||
8493 | ' ', | ||
8494 | _List_fromArray( | ||
8495 | [ | ||
8496 | $rtfeldman$elm_css$Css$Structure$Output$combinatorToString(combinator), | ||
8497 | $rtfeldman$elm_css$Css$Structure$Output$simpleSelectorSequenceToString(sequence) | ||
8498 | ])); | ||
8499 | }; | ||
8500 | var $rtfeldman$elm_css$Css$Structure$Output$selectorToString = function (_v0) { | ||
8501 | var simpleSelectorSequence = _v0.a; | ||
8502 | var chain = _v0.b; | ||
8503 | var pseudoElement = _v0.c; | ||
8504 | var segments = A2( | ||
8505 | $elm$core$List$cons, | ||
8506 | $rtfeldman$elm_css$Css$Structure$Output$simpleSelectorSequenceToString(simpleSelectorSequence), | ||
8507 | A2($elm$core$List$map, $rtfeldman$elm_css$Css$Structure$Output$selectorChainToString, chain)); | ||
8508 | var pseudoElementsString = A2( | ||
8509 | $elm$core$String$join, | ||
8510 | '', | ||
8511 | _List_fromArray( | ||
8512 | [ | ||
8513 | A2( | ||
8514 | $elm$core$Maybe$withDefault, | ||
8515 | '', | ||
8516 | A2($elm$core$Maybe$map, $rtfeldman$elm_css$Css$Structure$Output$pseudoElementToString, pseudoElement)) | ||
8517 | ])); | ||
8518 | return A2( | ||
8519 | $elm$core$String$append, | ||
8520 | A2( | ||
8521 | $elm$core$String$join, | ||
8522 | ' ', | ||
8523 | A2( | ||
8524 | $elm$core$List$filter, | ||
8525 | A2($elm$core$Basics$composeL, $elm$core$Basics$not, $elm$core$String$isEmpty), | ||
8526 | segments)), | ||
8527 | pseudoElementsString); | ||
8528 | }; | ||
8529 | var $rtfeldman$elm_css$Css$Structure$Output$prettyPrintStyleBlock = F2( | ||
8530 | function (indentLevel, _v0) { | ||
8531 | var firstSelector = _v0.a; | ||
8532 | var otherSelectors = _v0.b; | ||
8533 | var properties = _v0.c; | ||
8534 | var selectorStr = A2( | ||
8535 | $elm$core$String$join, | ||
8536 | ', ', | ||
8537 | A2( | ||
8538 | $elm$core$List$map, | ||
8539 | $rtfeldman$elm_css$Css$Structure$Output$selectorToString, | ||
8540 | A2($elm$core$List$cons, firstSelector, otherSelectors))); | ||
8541 | return A2( | ||
8542 | $elm$core$String$join, | ||
8543 | '', | ||
8544 | _List_fromArray( | ||
8545 | [ | ||
8546 | selectorStr, | ||
8547 | ' {\n', | ||
8548 | indentLevel, | ||
8549 | $rtfeldman$elm_css$Css$Structure$Output$emitProperties(properties), | ||
8550 | '\n', | ||
8551 | indentLevel, | ||
8552 | '}' | ||
8553 | ])); | ||
8554 | }); | ||
8555 | var $rtfeldman$elm_css$Css$Structure$Output$prettyPrintDeclaration = function (decl) { | ||
8556 | switch (decl.$) { | ||
8557 | case 'StyleBlockDeclaration': | ||
8558 | var styleBlock = decl.a; | ||
8559 | return A2($rtfeldman$elm_css$Css$Structure$Output$prettyPrintStyleBlock, $rtfeldman$elm_css$Css$Structure$Output$noIndent, styleBlock); | ||
8560 | case 'MediaRule': | ||
8561 | var mediaQueries = decl.a; | ||
8562 | var styleBlocks = decl.b; | ||
8563 | var query = A2( | ||
8564 | $elm$core$String$join, | ||
8565 | ',\n', | ||
8566 | A2($elm$core$List$map, $rtfeldman$elm_css$Css$Structure$Output$mediaQueryToString, mediaQueries)); | ||
8567 | var blocks = A2( | ||
8568 | $elm$core$String$join, | ||
8569 | '\n\n', | ||
8570 | A2( | ||
8571 | $elm$core$List$map, | ||
8572 | A2( | ||
8573 | $elm$core$Basics$composeL, | ||
8574 | $rtfeldman$elm_css$Css$Structure$Output$indent, | ||
8575 | $rtfeldman$elm_css$Css$Structure$Output$prettyPrintStyleBlock($rtfeldman$elm_css$Css$Structure$Output$spaceIndent)), | ||
8576 | styleBlocks)); | ||
8577 | return '@media ' + (query + (' {\n' + (blocks + '\n}'))); | ||
8578 | case 'SupportsRule': | ||
8579 | return 'TODO'; | ||
8580 | case 'DocumentRule': | ||
8581 | return 'TODO'; | ||
8582 | case 'PageRule': | ||
8583 | return 'TODO'; | ||
8584 | case 'FontFace': | ||
8585 | return 'TODO'; | ||
8586 | case 'Keyframes': | ||
8587 | var name = decl.a.name; | ||
8588 | var declaration = decl.a.declaration; | ||
8589 | return '@keyframes ' + (name + (' {\n' + (declaration + '\n}'))); | ||
8590 | case 'Viewport': | ||
8591 | return 'TODO'; | ||
8592 | case 'CounterStyle': | ||
8593 | return 'TODO'; | ||
8594 | default: | ||
8595 | return 'TODO'; | ||
8596 | } | ||
8597 | }; | ||
8598 | var $rtfeldman$elm_css$Css$Structure$Output$prettyPrint = function (_v0) { | ||
8599 | var charset = _v0.charset; | ||
8600 | var imports = _v0.imports; | ||
8601 | var namespaces = _v0.namespaces; | ||
8602 | var declarations = _v0.declarations; | ||
8603 | return A2( | ||
8604 | $elm$core$String$join, | ||
8605 | '\n\n', | ||
8606 | A2( | ||
8607 | $elm$core$List$filter, | ||
8608 | A2($elm$core$Basics$composeL, $elm$core$Basics$not, $elm$core$String$isEmpty), | ||
8609 | _List_fromArray( | ||
8610 | [ | ||
8611 | $rtfeldman$elm_css$Css$Structure$Output$charsetToString(charset), | ||
8612 | A2( | ||
8613 | $elm$core$String$join, | ||
8614 | '\n', | ||
8615 | A2($elm$core$List$map, $rtfeldman$elm_css$Css$Structure$Output$importToString, imports)), | ||
8616 | A2( | ||
8617 | $elm$core$String$join, | ||
8618 | '\n', | ||
8619 | A2($elm$core$List$map, $rtfeldman$elm_css$Css$Structure$Output$namespaceToString, namespaces)), | ||
8620 | A2( | ||
8621 | $elm$core$String$join, | ||
8622 | '\n\n', | ||
8623 | A2($elm$core$List$map, $rtfeldman$elm_css$Css$Structure$Output$prettyPrintDeclaration, declarations)) | ||
8624 | ]))); | ||
8625 | }; | ||
8626 | var $rtfeldman$elm_css$Css$Structure$CounterStyle = function (a) { | ||
8627 | return {$: 'CounterStyle', a: a}; | ||
8628 | }; | ||
8629 | var $rtfeldman$elm_css$Css$Structure$FontFace = function (a) { | ||
8630 | return {$: 'FontFace', a: a}; | ||
8631 | }; | ||
8632 | var $rtfeldman$elm_css$Css$Structure$PageRule = F2( | ||
8633 | function (a, b) { | ||
8634 | return {$: 'PageRule', a: a, b: b}; | ||
8635 | }); | ||
8636 | var $rtfeldman$elm_css$Css$Structure$Selector = F3( | ||
8637 | function (a, b, c) { | ||
8638 | return {$: 'Selector', a: a, b: b, c: c}; | ||
8639 | }); | ||
8640 | var $rtfeldman$elm_css$Css$Structure$StyleBlock = F3( | ||
8641 | function (a, b, c) { | ||
8642 | return {$: 'StyleBlock', a: a, b: b, c: c}; | ||
8643 | }); | ||
8644 | var $rtfeldman$elm_css$Css$Structure$StyleBlockDeclaration = function (a) { | ||
8645 | return {$: 'StyleBlockDeclaration', a: a}; | ||
8646 | }; | ||
8647 | var $rtfeldman$elm_css$Css$Structure$SupportsRule = F2( | ||
8648 | function (a, b) { | ||
8649 | return {$: 'SupportsRule', a: a, b: b}; | ||
8650 | }); | ||
8651 | var $rtfeldman$elm_css$Css$Structure$Viewport = function (a) { | ||
8652 | return {$: 'Viewport', a: a}; | ||
8653 | }; | ||
8654 | var $rtfeldman$elm_css$Css$Structure$MediaRule = F2( | ||
8655 | function (a, b) { | ||
8656 | return {$: 'MediaRule', a: a, b: b}; | ||
8657 | }); | ||
8658 | var $rtfeldman$elm_css$Css$Structure$mapLast = F2( | ||
8659 | function (update, list) { | ||
8660 | if (!list.b) { | ||
8661 | return list; | ||
8662 | } else { | ||
8663 | if (!list.b.b) { | ||
8664 | var only = list.a; | ||
8665 | return _List_fromArray( | ||
8666 | [ | ||
8667 | update(only) | ||
8668 | ]); | ||
8669 | } else { | ||
8670 | var first = list.a; | ||
8671 | var rest = list.b; | ||
8672 | return A2( | ||
8673 | $elm$core$List$cons, | ||
8674 | first, | ||
8675 | A2($rtfeldman$elm_css$Css$Structure$mapLast, update, rest)); | ||
8676 | } | ||
8677 | } | ||
8678 | }); | ||
8679 | var $rtfeldman$elm_css$Css$Structure$withPropertyAppended = F2( | ||
8680 | function (property, _v0) { | ||
8681 | var firstSelector = _v0.a; | ||
8682 | var otherSelectors = _v0.b; | ||
8683 | var properties = _v0.c; | ||
8684 | return A3( | ||
8685 | $rtfeldman$elm_css$Css$Structure$StyleBlock, | ||
8686 | firstSelector, | ||
8687 | otherSelectors, | ||
8688 | _Utils_ap( | ||
8689 | properties, | ||
8690 | _List_fromArray( | ||
8691 | [property]))); | ||
8692 | }); | ||
8693 | var $rtfeldman$elm_css$Css$Structure$appendProperty = F2( | ||
8694 | function (property, declarations) { | ||
8695 | if (!declarations.b) { | ||
8696 | return declarations; | ||
8697 | } else { | ||
8698 | if (!declarations.b.b) { | ||
8699 | switch (declarations.a.$) { | ||
8700 | case 'StyleBlockDeclaration': | ||
8701 | var styleBlock = declarations.a.a; | ||
8702 | return _List_fromArray( | ||
8703 | [ | ||
8704 | $rtfeldman$elm_css$Css$Structure$StyleBlockDeclaration( | ||
8705 | A2($rtfeldman$elm_css$Css$Structure$withPropertyAppended, property, styleBlock)) | ||
8706 | ]); | ||
8707 | case 'MediaRule': | ||
8708 | var _v1 = declarations.a; | ||
8709 | var mediaQueries = _v1.a; | ||
8710 | var styleBlocks = _v1.b; | ||
8711 | return _List_fromArray( | ||
8712 | [ | ||
8713 | A2( | ||
8714 | $rtfeldman$elm_css$Css$Structure$MediaRule, | ||
8715 | mediaQueries, | ||
8716 | A2( | ||
8717 | $rtfeldman$elm_css$Css$Structure$mapLast, | ||
8718 | $rtfeldman$elm_css$Css$Structure$withPropertyAppended(property), | ||
8719 | styleBlocks)) | ||
8720 | ]); | ||
8721 | default: | ||
8722 | return declarations; | ||
8723 | } | ||
8724 | } else { | ||
8725 | var first = declarations.a; | ||
8726 | var rest = declarations.b; | ||
8727 | return A2( | ||
8728 | $elm$core$List$cons, | ||
8729 | first, | ||
8730 | A2($rtfeldman$elm_css$Css$Structure$appendProperty, property, rest)); | ||
8731 | } | ||
8732 | } | ||
8733 | }); | ||
8734 | var $rtfeldman$elm_css$Css$Structure$appendToLastSelector = F2( | ||
8735 | function (f, styleBlock) { | ||
8736 | if (!styleBlock.b.b) { | ||
8737 | var only = styleBlock.a; | ||
8738 | var properties = styleBlock.c; | ||
8739 | return _List_fromArray( | ||
8740 | [ | ||
8741 | A3($rtfeldman$elm_css$Css$Structure$StyleBlock, only, _List_Nil, properties), | ||
8742 | A3( | ||
8743 | $rtfeldman$elm_css$Css$Structure$StyleBlock, | ||
8744 | f(only), | ||
8745 | _List_Nil, | ||
8746 | _List_Nil) | ||
8747 | ]); | ||
8748 | } else { | ||
8749 | var first = styleBlock.a; | ||
8750 | var rest = styleBlock.b; | ||
8751 | var properties = styleBlock.c; | ||
8752 | var newRest = A2($elm$core$List$map, f, rest); | ||
8753 | var newFirst = f(first); | ||
8754 | return _List_fromArray( | ||
8755 | [ | ||
8756 | A3($rtfeldman$elm_css$Css$Structure$StyleBlock, first, rest, properties), | ||
8757 | A3($rtfeldman$elm_css$Css$Structure$StyleBlock, newFirst, newRest, _List_Nil) | ||
8758 | ]); | ||
8759 | } | ||
8760 | }); | ||
8761 | var $rtfeldman$elm_css$Css$Structure$applyPseudoElement = F2( | ||
8762 | function (pseudo, _v0) { | ||
8763 | var sequence = _v0.a; | ||
8764 | var selectors = _v0.b; | ||
8765 | return A3( | ||
8766 | $rtfeldman$elm_css$Css$Structure$Selector, | ||
8767 | sequence, | ||
8768 | selectors, | ||
8769 | $elm$core$Maybe$Just(pseudo)); | ||
8770 | }); | ||
8771 | var $rtfeldman$elm_css$Css$Structure$appendPseudoElementToLastSelector = F2( | ||
8772 | function (pseudo, styleBlock) { | ||
8773 | return A2( | ||
8774 | $rtfeldman$elm_css$Css$Structure$appendToLastSelector, | ||
8775 | $rtfeldman$elm_css$Css$Structure$applyPseudoElement(pseudo), | ||
8776 | styleBlock); | ||
8777 | }); | ||
8778 | var $rtfeldman$elm_css$Css$Structure$CustomSelector = F2( | ||
8779 | function (a, b) { | ||
8780 | return {$: 'CustomSelector', a: a, b: b}; | ||
8781 | }); | ||
8782 | var $rtfeldman$elm_css$Css$Structure$TypeSelectorSequence = F2( | ||
8783 | function (a, b) { | ||
8784 | return {$: 'TypeSelectorSequence', a: a, b: b}; | ||
8785 | }); | ||
8786 | var $rtfeldman$elm_css$Css$Structure$UniversalSelectorSequence = function (a) { | ||
8787 | return {$: 'UniversalSelectorSequence', a: a}; | ||
8788 | }; | ||
8789 | var $rtfeldman$elm_css$Css$Structure$appendRepeatable = F2( | ||
8790 | function (selector, sequence) { | ||
8791 | switch (sequence.$) { | ||
8792 | case 'TypeSelectorSequence': | ||
8793 | var typeSelector = sequence.a; | ||
8794 | var list = sequence.b; | ||
8795 | return A2( | ||
8796 | $rtfeldman$elm_css$Css$Structure$TypeSelectorSequence, | ||
8797 | typeSelector, | ||
8798 | _Utils_ap( | ||
8799 | list, | ||
8800 | _List_fromArray( | ||
8801 | [selector]))); | ||
8802 | case 'UniversalSelectorSequence': | ||
8803 | var list = sequence.a; | ||
8804 | return $rtfeldman$elm_css$Css$Structure$UniversalSelectorSequence( | ||
8805 | _Utils_ap( | ||
8806 | list, | ||
8807 | _List_fromArray( | ||
8808 | [selector]))); | ||
8809 | default: | ||
8810 | var str = sequence.a; | ||
8811 | var list = sequence.b; | ||
8812 | return A2( | ||
8813 | $rtfeldman$elm_css$Css$Structure$CustomSelector, | ||
8814 | str, | ||
8815 | _Utils_ap( | ||
8816 | list, | ||
8817 | _List_fromArray( | ||
8818 | [selector]))); | ||
8819 | } | ||
8820 | }); | ||
8821 | var $rtfeldman$elm_css$Css$Structure$appendRepeatableWithCombinator = F2( | ||
8822 | function (selector, list) { | ||
8823 | if (!list.b) { | ||
8824 | return _List_Nil; | ||
8825 | } else { | ||
8826 | if (!list.b.b) { | ||
8827 | var _v1 = list.a; | ||
8828 | var combinator = _v1.a; | ||
8829 | var sequence = _v1.b; | ||
8830 | return _List_fromArray( | ||
8831 | [ | ||
8832 | _Utils_Tuple2( | ||
8833 | combinator, | ||
8834 | A2($rtfeldman$elm_css$Css$Structure$appendRepeatable, selector, sequence)) | ||
8835 | ]); | ||
8836 | } else { | ||
8837 | var first = list.a; | ||
8838 | var rest = list.b; | ||
8839 | return A2( | ||
8840 | $elm$core$List$cons, | ||
8841 | first, | ||
8842 | A2($rtfeldman$elm_css$Css$Structure$appendRepeatableWithCombinator, selector, rest)); | ||
8843 | } | ||
8844 | } | ||
8845 | }); | ||
8846 | var $rtfeldman$elm_css$Css$Structure$appendRepeatableSelector = F2( | ||
8847 | function (repeatableSimpleSelector, selector) { | ||
8848 | if (!selector.b.b) { | ||
8849 | var sequence = selector.a; | ||
8850 | var pseudoElement = selector.c; | ||
8851 | return A3( | ||
8852 | $rtfeldman$elm_css$Css$Structure$Selector, | ||
8853 | A2($rtfeldman$elm_css$Css$Structure$appendRepeatable, repeatableSimpleSelector, sequence), | ||
8854 | _List_Nil, | ||
8855 | pseudoElement); | ||
8856 | } else { | ||
8857 | var firstSelector = selector.a; | ||
8858 | var tuples = selector.b; | ||
8859 | var pseudoElement = selector.c; | ||
8860 | return A3( | ||
8861 | $rtfeldman$elm_css$Css$Structure$Selector, | ||
8862 | firstSelector, | ||
8863 | A2($rtfeldman$elm_css$Css$Structure$appendRepeatableWithCombinator, repeatableSimpleSelector, tuples), | ||
8864 | pseudoElement); | ||
8865 | } | ||
8866 | }); | ||
8867 | var $rtfeldman$elm_css$Css$Structure$appendRepeatableToLastSelector = F2( | ||
8868 | function (selector, styleBlock) { | ||
8869 | return A2( | ||
8870 | $rtfeldman$elm_css$Css$Structure$appendToLastSelector, | ||
8871 | $rtfeldman$elm_css$Css$Structure$appendRepeatableSelector(selector), | ||
8872 | styleBlock); | ||
8873 | }); | ||
8874 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$collectSelectors = function (declarations) { | ||
8875 | collectSelectors: | ||
8876 | while (true) { | ||
8877 | if (!declarations.b) { | ||
8878 | return _List_Nil; | ||
8879 | } else { | ||
8880 | if (declarations.a.$ === 'StyleBlockDeclaration') { | ||
8881 | var _v1 = declarations.a.a; | ||
8882 | var firstSelector = _v1.a; | ||
8883 | var otherSelectors = _v1.b; | ||
8884 | var rest = declarations.b; | ||
8885 | return _Utils_ap( | ||
8886 | A2($elm$core$List$cons, firstSelector, otherSelectors), | ||
8887 | $rtfeldman$elm_css$Css$Preprocess$Resolve$collectSelectors(rest)); | ||
8888 | } else { | ||
8889 | var rest = declarations.b; | ||
8890 | var $temp$declarations = rest; | ||
8891 | declarations = $temp$declarations; | ||
8892 | continue collectSelectors; | ||
8893 | } | ||
8894 | } | ||
8895 | } | ||
8896 | }; | ||
8897 | var $rtfeldman$elm_css$Css$Structure$DocumentRule = F5( | ||
8898 | function (a, b, c, d, e) { | ||
8899 | return {$: 'DocumentRule', a: a, b: b, c: c, d: d, e: e}; | ||
8900 | }); | ||
8901 | var $rtfeldman$elm_css$Css$Structure$concatMapLastStyleBlock = F2( | ||
8902 | function (update, declarations) { | ||
8903 | _v0$12: | ||
8904 | while (true) { | ||
8905 | if (!declarations.b) { | ||
8906 | return declarations; | ||
8907 | } else { | ||
8908 | if (!declarations.b.b) { | ||
8909 | switch (declarations.a.$) { | ||
8910 | case 'StyleBlockDeclaration': | ||
8911 | var styleBlock = declarations.a.a; | ||
8912 | return A2( | ||
8913 | $elm$core$List$map, | ||
8914 | $rtfeldman$elm_css$Css$Structure$StyleBlockDeclaration, | ||
8915 | update(styleBlock)); | ||
8916 | case 'MediaRule': | ||
8917 | if (declarations.a.b.b) { | ||
8918 | if (!declarations.a.b.b.b) { | ||
8919 | var _v1 = declarations.a; | ||
8920 | var mediaQueries = _v1.a; | ||
8921 | var _v2 = _v1.b; | ||
8922 | var styleBlock = _v2.a; | ||
8923 | return _List_fromArray( | ||
8924 | [ | ||
8925 | A2( | ||
8926 | $rtfeldman$elm_css$Css$Structure$MediaRule, | ||
8927 | mediaQueries, | ||
8928 | update(styleBlock)) | ||
8929 | ]); | ||
8930 | } else { | ||
8931 | var _v3 = declarations.a; | ||
8932 | var mediaQueries = _v3.a; | ||
8933 | var _v4 = _v3.b; | ||
8934 | var first = _v4.a; | ||
8935 | var rest = _v4.b; | ||
8936 | var _v5 = A2( | ||
8937 | $rtfeldman$elm_css$Css$Structure$concatMapLastStyleBlock, | ||
8938 | update, | ||
8939 | _List_fromArray( | ||
8940 | [ | ||
8941 | A2($rtfeldman$elm_css$Css$Structure$MediaRule, mediaQueries, rest) | ||
8942 | ])); | ||
8943 | if ((_v5.b && (_v5.a.$ === 'MediaRule')) && (!_v5.b.b)) { | ||
8944 | var _v6 = _v5.a; | ||
8945 | var newMediaQueries = _v6.a; | ||
8946 | var newStyleBlocks = _v6.b; | ||
8947 | return _List_fromArray( | ||
8948 | [ | ||
8949 | A2( | ||
8950 | $rtfeldman$elm_css$Css$Structure$MediaRule, | ||
8951 | newMediaQueries, | ||
8952 | A2($elm$core$List$cons, first, newStyleBlocks)) | ||
8953 | ]); | ||
8954 | } else { | ||
8955 | var newDeclarations = _v5; | ||
8956 | return newDeclarations; | ||
8957 | } | ||
8958 | } | ||
8959 | } else { | ||
8960 | break _v0$12; | ||
8961 | } | ||
8962 | case 'SupportsRule': | ||
8963 | var _v7 = declarations.a; | ||
8964 | var str = _v7.a; | ||
8965 | var nestedDeclarations = _v7.b; | ||
8966 | return _List_fromArray( | ||
8967 | [ | ||
8968 | A2( | ||
8969 | $rtfeldman$elm_css$Css$Structure$SupportsRule, | ||
8970 | str, | ||
8971 | A2($rtfeldman$elm_css$Css$Structure$concatMapLastStyleBlock, update, nestedDeclarations)) | ||
8972 | ]); | ||
8973 | case 'DocumentRule': | ||
8974 | var _v8 = declarations.a; | ||
8975 | var str1 = _v8.a; | ||
8976 | var str2 = _v8.b; | ||
8977 | var str3 = _v8.c; | ||
8978 | var str4 = _v8.d; | ||
8979 | var styleBlock = _v8.e; | ||
8980 | return A2( | ||
8981 | $elm$core$List$map, | ||
8982 | A4($rtfeldman$elm_css$Css$Structure$DocumentRule, str1, str2, str3, str4), | ||
8983 | update(styleBlock)); | ||
8984 | case 'PageRule': | ||
8985 | var _v9 = declarations.a; | ||
8986 | return declarations; | ||
8987 | case 'FontFace': | ||
8988 | return declarations; | ||
8989 | case 'Keyframes': | ||
8990 | return declarations; | ||
8991 | case 'Viewport': | ||
8992 | return declarations; | ||
8993 | case 'CounterStyle': | ||
8994 | return declarations; | ||
8995 | default: | ||
8996 | return declarations; | ||
8997 | } | ||
8998 | } else { | ||
8999 | break _v0$12; | ||
9000 | } | ||
9001 | } | ||
9002 | } | ||
9003 | var first = declarations.a; | ||
9004 | var rest = declarations.b; | ||
9005 | return A2( | ||
9006 | $elm$core$List$cons, | ||
9007 | first, | ||
9008 | A2($rtfeldman$elm_css$Css$Structure$concatMapLastStyleBlock, update, rest)); | ||
9009 | }); | ||
9010 | var $elm$core$String$cons = _String_cons; | ||
9011 | var $rtfeldman$elm_css$ElmCssVendor$Murmur3$HashData = F4( | ||
9012 | function (shift, seed, hash, charsProcessed) { | ||
9013 | return {charsProcessed: charsProcessed, hash: hash, seed: seed, shift: shift}; | ||
9014 | }); | ||
9015 | var $rtfeldman$elm_css$ElmCssVendor$Murmur3$c1 = 3432918353; | ||
9016 | var $rtfeldman$elm_css$ElmCssVendor$Murmur3$c2 = 461845907; | ||
9017 | var $elm$core$Bitwise$and = _Bitwise_and; | ||
9018 | var $elm$core$Bitwise$shiftLeftBy = _Bitwise_shiftLeftBy; | ||
9019 | var $elm$core$Bitwise$shiftRightZfBy = _Bitwise_shiftRightZfBy; | ||
9020 | var $rtfeldman$elm_css$ElmCssVendor$Murmur3$multiplyBy = F2( | ||
9021 | function (b, a) { | ||
9022 | return ((a & 65535) * b) + ((((a >>> 16) * b) & 65535) << 16); | ||
9023 | }); | ||
9024 | var $elm$core$Bitwise$or = _Bitwise_or; | ||
9025 | var $rtfeldman$elm_css$ElmCssVendor$Murmur3$rotlBy = F2( | ||
9026 | function (b, a) { | ||
9027 | return (a << b) | (a >>> (32 - b)); | ||
9028 | }); | ||
9029 | var $elm$core$Bitwise$xor = _Bitwise_xor; | ||
9030 | var $rtfeldman$elm_css$ElmCssVendor$Murmur3$finalize = function (data) { | ||
9031 | var acc = (!(!data.hash)) ? (data.seed ^ A2( | ||
9032 | $rtfeldman$elm_css$ElmCssVendor$Murmur3$multiplyBy, | ||
9033 | $rtfeldman$elm_css$ElmCssVendor$Murmur3$c2, | ||
9034 | A2( | ||
9035 | $rtfeldman$elm_css$ElmCssVendor$Murmur3$rotlBy, | ||
9036 | 15, | ||
9037 | A2($rtfeldman$elm_css$ElmCssVendor$Murmur3$multiplyBy, $rtfeldman$elm_css$ElmCssVendor$Murmur3$c1, data.hash)))) : data.seed; | ||
9038 | var h0 = acc ^ data.charsProcessed; | ||
9039 | var h1 = A2($rtfeldman$elm_css$ElmCssVendor$Murmur3$multiplyBy, 2246822507, h0 ^ (h0 >>> 16)); | ||
9040 | var h2 = A2($rtfeldman$elm_css$ElmCssVendor$Murmur3$multiplyBy, 3266489909, h1 ^ (h1 >>> 13)); | ||
9041 | return (h2 ^ (h2 >>> 16)) >>> 0; | ||
9042 | }; | ||
9043 | var $elm$core$String$foldl = _String_foldl; | ||
9044 | var $rtfeldman$elm_css$ElmCssVendor$Murmur3$mix = F2( | ||
9045 | function (h1, k1) { | ||
9046 | return A2( | ||
9047 | $rtfeldman$elm_css$ElmCssVendor$Murmur3$multiplyBy, | ||
9048 | 5, | ||
9049 | A2( | ||
9050 | $rtfeldman$elm_css$ElmCssVendor$Murmur3$rotlBy, | ||
9051 | 13, | ||
9052 | h1 ^ A2( | ||
9053 | $rtfeldman$elm_css$ElmCssVendor$Murmur3$multiplyBy, | ||
9054 | $rtfeldman$elm_css$ElmCssVendor$Murmur3$c2, | ||
9055 | A2( | ||
9056 | $rtfeldman$elm_css$ElmCssVendor$Murmur3$rotlBy, | ||
9057 | 15, | ||
9058 | A2($rtfeldman$elm_css$ElmCssVendor$Murmur3$multiplyBy, $rtfeldman$elm_css$ElmCssVendor$Murmur3$c1, k1))))) + 3864292196; | ||
9059 | }); | ||
9060 | var $rtfeldman$elm_css$ElmCssVendor$Murmur3$hashFold = F2( | ||
9061 | function (c, data) { | ||
9062 | var res = data.hash | ((255 & $elm$core$Char$toCode(c)) << data.shift); | ||
9063 | var _v0 = data.shift; | ||
9064 | if (_v0 === 24) { | ||
9065 | return { | ||
9066 | charsProcessed: data.charsProcessed + 1, | ||
9067 | hash: 0, | ||
9068 | seed: A2($rtfeldman$elm_css$ElmCssVendor$Murmur3$mix, data.seed, res), | ||
9069 | shift: 0 | ||
9070 | }; | ||
9071 | } else { | ||
9072 | return {charsProcessed: data.charsProcessed + 1, hash: res, seed: data.seed, shift: data.shift + 8}; | ||
9073 | } | ||
9074 | }); | ||
9075 | var $rtfeldman$elm_css$ElmCssVendor$Murmur3$hashString = F2( | ||
9076 | function (seed, str) { | ||
9077 | return $rtfeldman$elm_css$ElmCssVendor$Murmur3$finalize( | ||
9078 | A3( | ||
9079 | $elm$core$String$foldl, | ||
9080 | $rtfeldman$elm_css$ElmCssVendor$Murmur3$hashFold, | ||
9081 | A4($rtfeldman$elm_css$ElmCssVendor$Murmur3$HashData, 0, seed, 0, 0), | ||
9082 | str)); | ||
9083 | }); | ||
9084 | var $rtfeldman$elm_css$Hash$murmurSeed = 15739; | ||
9085 | var $elm$core$String$fromList = _String_fromList; | ||
9086 | var $elm$core$Basics$modBy = _Basics_modBy; | ||
9087 | var $rtfeldman$elm_hex$Hex$unsafeToDigit = function (num) { | ||
9088 | unsafeToDigit: | ||
9089 | while (true) { | ||
9090 | switch (num) { | ||
9091 | case 0: | ||
9092 | return _Utils_chr('0'); | ||
9093 | case 1: | ||
9094 | return _Utils_chr('1'); | ||
9095 | case 2: | ||
9096 | return _Utils_chr('2'); | ||
9097 | case 3: | ||
9098 | return _Utils_chr('3'); | ||
9099 | case 4: | ||
9100 | return _Utils_chr('4'); | ||
9101 | case 5: | ||
9102 | return _Utils_chr('5'); | ||
9103 | case 6: | ||
9104 | return _Utils_chr('6'); | ||
9105 | case 7: | ||
9106 | return _Utils_chr('7'); | ||
9107 | case 8: | ||
9108 | return _Utils_chr('8'); | ||
9109 | case 9: | ||
9110 | return _Utils_chr('9'); | ||
9111 | case 10: | ||
9112 | return _Utils_chr('a'); | ||
9113 | case 11: | ||
9114 | return _Utils_chr('b'); | ||
9115 | case 12: | ||
9116 | return _Utils_chr('c'); | ||
9117 | case 13: | ||
9118 | return _Utils_chr('d'); | ||
9119 | case 14: | ||
9120 | return _Utils_chr('e'); | ||
9121 | case 15: | ||
9122 | return _Utils_chr('f'); | ||
9123 | default: | ||
9124 | var $temp$num = num; | ||
9125 | num = $temp$num; | ||
9126 | continue unsafeToDigit; | ||
9127 | } | ||
9128 | } | ||
9129 | }; | ||
9130 | var $rtfeldman$elm_hex$Hex$unsafePositiveToDigits = F2( | ||
9131 | function (digits, num) { | ||
9132 | unsafePositiveToDigits: | ||
9133 | while (true) { | ||
9134 | if (num < 16) { | ||
9135 | return A2( | ||
9136 | $elm$core$List$cons, | ||
9137 | $rtfeldman$elm_hex$Hex$unsafeToDigit(num), | ||
9138 | digits); | ||
9139 | } else { | ||
9140 | var $temp$digits = A2( | ||
9141 | $elm$core$List$cons, | ||
9142 | $rtfeldman$elm_hex$Hex$unsafeToDigit( | ||
9143 | A2($elm$core$Basics$modBy, 16, num)), | ||
9144 | digits), | ||
9145 | $temp$num = (num / 16) | 0; | ||
9146 | digits = $temp$digits; | ||
9147 | num = $temp$num; | ||
9148 | continue unsafePositiveToDigits; | ||
9149 | } | ||
9150 | } | ||
9151 | }); | ||
9152 | var $rtfeldman$elm_hex$Hex$toString = function (num) { | ||
9153 | return $elm$core$String$fromList( | ||
9154 | (num < 0) ? A2( | ||
9155 | $elm$core$List$cons, | ||
9156 | _Utils_chr('-'), | ||
9157 | A2($rtfeldman$elm_hex$Hex$unsafePositiveToDigits, _List_Nil, -num)) : A2($rtfeldman$elm_hex$Hex$unsafePositiveToDigits, _List_Nil, num)); | ||
9158 | }; | ||
9159 | var $rtfeldman$elm_css$Hash$fromString = function (str) { | ||
9160 | return A2( | ||
9161 | $elm$core$String$cons, | ||
9162 | _Utils_chr('_'), | ||
9163 | $rtfeldman$elm_hex$Hex$toString( | ||
9164 | A2($rtfeldman$elm_css$ElmCssVendor$Murmur3$hashString, $rtfeldman$elm_css$Hash$murmurSeed, str))); | ||
9165 | }; | ||
9166 | var $elm$core$List$head = function (list) { | ||
9167 | if (list.b) { | ||
9168 | var x = list.a; | ||
9169 | var xs = list.b; | ||
9170 | return $elm$core$Maybe$Just(x); | ||
9171 | } else { | ||
9172 | return $elm$core$Maybe$Nothing; | ||
9173 | } | ||
9174 | }; | ||
9175 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$last = function (list) { | ||
9176 | last: | ||
9177 | while (true) { | ||
9178 | if (!list.b) { | ||
9179 | return $elm$core$Maybe$Nothing; | ||
9180 | } else { | ||
9181 | if (!list.b.b) { | ||
9182 | var singleton = list.a; | ||
9183 | return $elm$core$Maybe$Just(singleton); | ||
9184 | } else { | ||
9185 | var rest = list.b; | ||
9186 | var $temp$list = rest; | ||
9187 | list = $temp$list; | ||
9188 | continue last; | ||
9189 | } | ||
9190 | } | ||
9191 | } | ||
9192 | }; | ||
9193 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$lastDeclaration = function (declarations) { | ||
9194 | lastDeclaration: | ||
9195 | while (true) { | ||
9196 | if (!declarations.b) { | ||
9197 | return $elm$core$Maybe$Nothing; | ||
9198 | } else { | ||
9199 | if (!declarations.b.b) { | ||
9200 | var x = declarations.a; | ||
9201 | return $elm$core$Maybe$Just( | ||
9202 | _List_fromArray( | ||
9203 | [x])); | ||
9204 | } else { | ||
9205 | var xs = declarations.b; | ||
9206 | var $temp$declarations = xs; | ||
9207 | declarations = $temp$declarations; | ||
9208 | continue lastDeclaration; | ||
9209 | } | ||
9210 | } | ||
9211 | } | ||
9212 | }; | ||
9213 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$oneOf = function (maybes) { | ||
9214 | oneOf: | ||
9215 | while (true) { | ||
9216 | if (!maybes.b) { | ||
9217 | return $elm$core$Maybe$Nothing; | ||
9218 | } else { | ||
9219 | var maybe = maybes.a; | ||
9220 | var rest = maybes.b; | ||
9221 | if (maybe.$ === 'Nothing') { | ||
9222 | var $temp$maybes = rest; | ||
9223 | maybes = $temp$maybes; | ||
9224 | continue oneOf; | ||
9225 | } else { | ||
9226 | return maybe; | ||
9227 | } | ||
9228 | } | ||
9229 | } | ||
9230 | }; | ||
9231 | var $rtfeldman$elm_css$Css$Structure$FontFeatureValues = function (a) { | ||
9232 | return {$: 'FontFeatureValues', a: a}; | ||
9233 | }; | ||
9234 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$resolveFontFeatureValues = function (tuples) { | ||
9235 | var expandTuples = function (tuplesToExpand) { | ||
9236 | if (!tuplesToExpand.b) { | ||
9237 | return _List_Nil; | ||
9238 | } else { | ||
9239 | var properties = tuplesToExpand.a; | ||
9240 | var rest = tuplesToExpand.b; | ||
9241 | return A2( | ||
9242 | $elm$core$List$cons, | ||
9243 | properties, | ||
9244 | expandTuples(rest)); | ||
9245 | } | ||
9246 | }; | ||
9247 | var newTuples = expandTuples(tuples); | ||
9248 | return _List_fromArray( | ||
9249 | [ | ||
9250 | $rtfeldman$elm_css$Css$Structure$FontFeatureValues(newTuples) | ||
9251 | ]); | ||
9252 | }; | ||
9253 | var $rtfeldman$elm_css$Css$Structure$styleBlockToMediaRule = F2( | ||
9254 | function (mediaQueries, declaration) { | ||
9255 | if (declaration.$ === 'StyleBlockDeclaration') { | ||
9256 | var styleBlock = declaration.a; | ||
9257 | return A2( | ||
9258 | $rtfeldman$elm_css$Css$Structure$MediaRule, | ||
9259 | mediaQueries, | ||
9260 | _List_fromArray( | ||
9261 | [styleBlock])); | ||
9262 | } else { | ||
9263 | return declaration; | ||
9264 | } | ||
9265 | }); | ||
9266 | var $elm$core$List$tail = function (list) { | ||
9267 | if (list.b) { | ||
9268 | var x = list.a; | ||
9269 | var xs = list.b; | ||
9270 | return $elm$core$Maybe$Just(xs); | ||
9271 | } else { | ||
9272 | return $elm$core$Maybe$Nothing; | ||
9273 | } | ||
9274 | }; | ||
9275 | var $elm$core$List$takeReverse = F3( | ||
9276 | function (n, list, kept) { | ||
9277 | takeReverse: | ||
9278 | while (true) { | ||
9279 | if (n <= 0) { | ||
9280 | return kept; | ||
9281 | } else { | ||
9282 | if (!list.b) { | ||
9283 | return kept; | ||
9284 | } else { | ||
9285 | var x = list.a; | ||
9286 | var xs = list.b; | ||
9287 | var $temp$n = n - 1, | ||
9288 | $temp$list = xs, | ||
9289 | $temp$kept = A2($elm$core$List$cons, x, kept); | ||
9290 | n = $temp$n; | ||
9291 | list = $temp$list; | ||
9292 | kept = $temp$kept; | ||
9293 | continue takeReverse; | ||
9294 | } | ||
9295 | } | ||
9296 | } | ||
9297 | }); | ||
9298 | var $elm$core$List$takeTailRec = F2( | ||
9299 | function (n, list) { | ||
9300 | return $elm$core$List$reverse( | ||
9301 | A3($elm$core$List$takeReverse, n, list, _List_Nil)); | ||
9302 | }); | ||
9303 | var $elm$core$List$takeFast = F3( | ||
9304 | function (ctr, n, list) { | ||
9305 | if (n <= 0) { | ||
9306 | return _List_Nil; | ||
9307 | } else { | ||
9308 | var _v0 = _Utils_Tuple2(n, list); | ||
9309 | _v0$1: | ||
9310 | while (true) { | ||
9311 | _v0$5: | ||
9312 | while (true) { | ||
9313 | if (!_v0.b.b) { | ||
9314 | return list; | ||
9315 | } else { | ||
9316 | if (_v0.b.b.b) { | ||
9317 | switch (_v0.a) { | ||
9318 | case 1: | ||
9319 | break _v0$1; | ||
9320 | case 2: | ||
9321 | var _v2 = _v0.b; | ||
9322 | var x = _v2.a; | ||
9323 | var _v3 = _v2.b; | ||
9324 | var y = _v3.a; | ||
9325 | return _List_fromArray( | ||
9326 | [x, y]); | ||
9327 | case 3: | ||
9328 | if (_v0.b.b.b.b) { | ||
9329 | var _v4 = _v0.b; | ||
9330 | var x = _v4.a; | ||
9331 | var _v5 = _v4.b; | ||
9332 | var y = _v5.a; | ||
9333 | var _v6 = _v5.b; | ||
9334 | var z = _v6.a; | ||
9335 | return _List_fromArray( | ||
9336 | [x, y, z]); | ||
9337 | } else { | ||
9338 | break _v0$5; | ||
9339 | } | ||
9340 | default: | ||
9341 | if (_v0.b.b.b.b && _v0.b.b.b.b.b) { | ||
9342 | var _v7 = _v0.b; | ||
9343 | var x = _v7.a; | ||
9344 | var _v8 = _v7.b; | ||
9345 | var y = _v8.a; | ||
9346 | var _v9 = _v8.b; | ||
9347 | var z = _v9.a; | ||
9348 | var _v10 = _v9.b; | ||
9349 | var w = _v10.a; | ||
9350 | var tl = _v10.b; | ||
9351 | return (ctr > 1000) ? A2( | ||
9352 | $elm$core$List$cons, | ||
9353 | x, | ||
9354 | A2( | ||
9355 | $elm$core$List$cons, | ||
9356 | y, | ||
9357 | A2( | ||
9358 | $elm$core$List$cons, | ||
9359 | z, | ||
9360 | A2( | ||
9361 | $elm$core$List$cons, | ||
9362 | w, | ||
9363 | A2($elm$core$List$takeTailRec, n - 4, tl))))) : A2( | ||
9364 | $elm$core$List$cons, | ||
9365 | x, | ||
9366 | A2( | ||
9367 | $elm$core$List$cons, | ||
9368 | y, | ||
9369 | A2( | ||
9370 | $elm$core$List$cons, | ||
9371 | z, | ||
9372 | A2( | ||
9373 | $elm$core$List$cons, | ||
9374 | w, | ||
9375 | A3($elm$core$List$takeFast, ctr + 1, n - 4, tl))))); | ||
9376 | } else { | ||
9377 | break _v0$5; | ||
9378 | } | ||
9379 | } | ||
9380 | } else { | ||
9381 | if (_v0.a === 1) { | ||
9382 | break _v0$1; | ||
9383 | } else { | ||
9384 | break _v0$5; | ||
9385 | } | ||
9386 | } | ||
9387 | } | ||
9388 | } | ||
9389 | return list; | ||
9390 | } | ||
9391 | var _v1 = _v0.b; | ||
9392 | var x = _v1.a; | ||
9393 | return _List_fromArray( | ||
9394 | [x]); | ||
9395 | } | ||
9396 | }); | ||
9397 | var $elm$core$List$take = F2( | ||
9398 | function (n, list) { | ||
9399 | return A3($elm$core$List$takeFast, 0, n, list); | ||
9400 | }); | ||
9401 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$toDocumentRule = F5( | ||
9402 | function (str1, str2, str3, str4, declaration) { | ||
9403 | if (declaration.$ === 'StyleBlockDeclaration') { | ||
9404 | var structureStyleBlock = declaration.a; | ||
9405 | return A5($rtfeldman$elm_css$Css$Structure$DocumentRule, str1, str2, str3, str4, structureStyleBlock); | ||
9406 | } else { | ||
9407 | return declaration; | ||
9408 | } | ||
9409 | }); | ||
9410 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$toMediaRule = F2( | ||
9411 | function (mediaQueries, declaration) { | ||
9412 | switch (declaration.$) { | ||
9413 | case 'StyleBlockDeclaration': | ||
9414 | var structureStyleBlock = declaration.a; | ||
9415 | return A2( | ||
9416 | $rtfeldman$elm_css$Css$Structure$MediaRule, | ||
9417 | mediaQueries, | ||
9418 | _List_fromArray( | ||
9419 | [structureStyleBlock])); | ||
9420 | case 'MediaRule': | ||
9421 | var newMediaQueries = declaration.a; | ||
9422 | var structureStyleBlocks = declaration.b; | ||
9423 | return A2( | ||
9424 | $rtfeldman$elm_css$Css$Structure$MediaRule, | ||
9425 | _Utils_ap(mediaQueries, newMediaQueries), | ||
9426 | structureStyleBlocks); | ||
9427 | case 'SupportsRule': | ||
9428 | var str = declaration.a; | ||
9429 | var declarations = declaration.b; | ||
9430 | return A2( | ||
9431 | $rtfeldman$elm_css$Css$Structure$SupportsRule, | ||
9432 | str, | ||
9433 | A2( | ||
9434 | $elm$core$List$map, | ||
9435 | $rtfeldman$elm_css$Css$Preprocess$Resolve$toMediaRule(mediaQueries), | ||
9436 | declarations)); | ||
9437 | case 'DocumentRule': | ||
9438 | var str1 = declaration.a; | ||
9439 | var str2 = declaration.b; | ||
9440 | var str3 = declaration.c; | ||
9441 | var str4 = declaration.d; | ||
9442 | var structureStyleBlock = declaration.e; | ||
9443 | return A5($rtfeldman$elm_css$Css$Structure$DocumentRule, str1, str2, str3, str4, structureStyleBlock); | ||
9444 | case 'PageRule': | ||
9445 | return declaration; | ||
9446 | case 'FontFace': | ||
9447 | return declaration; | ||
9448 | case 'Keyframes': | ||
9449 | return declaration; | ||
9450 | case 'Viewport': | ||
9451 | return declaration; | ||
9452 | case 'CounterStyle': | ||
9453 | return declaration; | ||
9454 | default: | ||
9455 | return declaration; | ||
9456 | } | ||
9457 | }); | ||
9458 | var $rtfeldman$elm_css$Css$Preprocess$unwrapSnippet = function (_v0) { | ||
9459 | var declarations = _v0.a; | ||
9460 | return declarations; | ||
9461 | }; | ||
9462 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$applyNestedStylesToLast = F4( | ||
9463 | function (nestedStyles, rest, f, declarations) { | ||
9464 | var withoutParent = function (decls) { | ||
9465 | return A2( | ||
9466 | $elm$core$Maybe$withDefault, | ||
9467 | _List_Nil, | ||
9468 | $elm$core$List$tail(decls)); | ||
9469 | }; | ||
9470 | var nextResult = A2( | ||
9471 | $rtfeldman$elm_css$Css$Preprocess$Resolve$applyStyles, | ||
9472 | rest, | ||
9473 | A2( | ||
9474 | $elm$core$Maybe$withDefault, | ||
9475 | _List_Nil, | ||
9476 | $rtfeldman$elm_css$Css$Preprocess$Resolve$lastDeclaration(declarations))); | ||
9477 | var newDeclarations = function () { | ||
9478 | var _v14 = _Utils_Tuple2( | ||
9479 | $elm$core$List$head(nextResult), | ||
9480 | $rtfeldman$elm_css$Css$Preprocess$Resolve$last(declarations)); | ||
9481 | if ((_v14.a.$ === 'Just') && (_v14.b.$ === 'Just')) { | ||
9482 | var nextResultParent = _v14.a.a; | ||
9483 | var originalParent = _v14.b.a; | ||
9484 | return _Utils_ap( | ||
9485 | A2( | ||
9486 | $elm$core$List$take, | ||
9487 | $elm$core$List$length(declarations) - 1, | ||
9488 | declarations), | ||
9489 | _List_fromArray( | ||
9490 | [ | ||
9491 | (!_Utils_eq(originalParent, nextResultParent)) ? nextResultParent : originalParent | ||
9492 | ])); | ||
9493 | } else { | ||
9494 | return declarations; | ||
9495 | } | ||
9496 | }(); | ||
9497 | var insertStylesToNestedDecl = function (lastDecl) { | ||
9498 | return $elm$core$List$concat( | ||
9499 | A2( | ||
9500 | $rtfeldman$elm_css$Css$Structure$mapLast, | ||
9501 | $rtfeldman$elm_css$Css$Preprocess$Resolve$applyStyles(nestedStyles), | ||
9502 | A2( | ||
9503 | $elm$core$List$map, | ||
9504 | $elm$core$List$singleton, | ||
9505 | A2($rtfeldman$elm_css$Css$Structure$concatMapLastStyleBlock, f, lastDecl)))); | ||
9506 | }; | ||
9507 | var initialResult = A2( | ||
9508 | $elm$core$Maybe$withDefault, | ||
9509 | _List_Nil, | ||
9510 | A2( | ||
9511 | $elm$core$Maybe$map, | ||
9512 | insertStylesToNestedDecl, | ||
9513 | $rtfeldman$elm_css$Css$Preprocess$Resolve$lastDeclaration(declarations))); | ||
9514 | return _Utils_ap( | ||
9515 | newDeclarations, | ||
9516 | _Utils_ap( | ||
9517 | withoutParent(initialResult), | ||
9518 | withoutParent(nextResult))); | ||
9519 | }); | ||
9520 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$applyStyles = F2( | ||
9521 | function (styles, declarations) { | ||
9522 | if (!styles.b) { | ||
9523 | return declarations; | ||
9524 | } else { | ||
9525 | switch (styles.a.$) { | ||
9526 | case 'AppendProperty': | ||
9527 | var property = styles.a.a; | ||
9528 | var rest = styles.b; | ||
9529 | return A2( | ||
9530 | $rtfeldman$elm_css$Css$Preprocess$Resolve$applyStyles, | ||
9531 | rest, | ||
9532 | A2($rtfeldman$elm_css$Css$Structure$appendProperty, property, declarations)); | ||
9533 | case 'ExtendSelector': | ||
9534 | var _v4 = styles.a; | ||
9535 | var selector = _v4.a; | ||
9536 | var nestedStyles = _v4.b; | ||
9537 | var rest = styles.b; | ||
9538 | return A4( | ||
9539 | $rtfeldman$elm_css$Css$Preprocess$Resolve$applyNestedStylesToLast, | ||
9540 | nestedStyles, | ||
9541 | rest, | ||
9542 | $rtfeldman$elm_css$Css$Structure$appendRepeatableToLastSelector(selector), | ||
9543 | declarations); | ||
9544 | case 'NestSnippet': | ||
9545 | var _v5 = styles.a; | ||
9546 | var selectorCombinator = _v5.a; | ||
9547 | var snippets = _v5.b; | ||
9548 | var rest = styles.b; | ||
9549 | var chain = F2( | ||
9550 | function (_v9, _v10) { | ||
9551 | var originalSequence = _v9.a; | ||
9552 | var originalTuples = _v9.b; | ||
9553 | var originalPseudoElement = _v9.c; | ||
9554 | var newSequence = _v10.a; | ||
9555 | var newTuples = _v10.b; | ||
9556 | var newPseudoElement = _v10.c; | ||
9557 | return A3( | ||
9558 | $rtfeldman$elm_css$Css$Structure$Selector, | ||
9559 | originalSequence, | ||
9560 | _Utils_ap( | ||
9561 | originalTuples, | ||
9562 | A2( | ||
9563 | $elm$core$List$cons, | ||
9564 | _Utils_Tuple2(selectorCombinator, newSequence), | ||
9565 | newTuples)), | ||
9566 | $rtfeldman$elm_css$Css$Preprocess$Resolve$oneOf( | ||
9567 | _List_fromArray( | ||
9568 | [newPseudoElement, originalPseudoElement]))); | ||
9569 | }); | ||
9570 | var expandDeclaration = function (declaration) { | ||
9571 | switch (declaration.$) { | ||
9572 | case 'StyleBlockDeclaration': | ||
9573 | var _v7 = declaration.a; | ||
9574 | var firstSelector = _v7.a; | ||
9575 | var otherSelectors = _v7.b; | ||
9576 | var nestedStyles = _v7.c; | ||
9577 | var newSelectors = A2( | ||
9578 | $elm$core$List$concatMap, | ||
9579 | function (originalSelector) { | ||
9580 | return A2( | ||
9581 | $elm$core$List$map, | ||
9582 | chain(originalSelector), | ||
9583 | A2($elm$core$List$cons, firstSelector, otherSelectors)); | ||
9584 | }, | ||
9585 | $rtfeldman$elm_css$Css$Preprocess$Resolve$collectSelectors(declarations)); | ||
9586 | var newDeclarations = function () { | ||
9587 | if (!newSelectors.b) { | ||
9588 | return _List_Nil; | ||
9589 | } else { | ||
9590 | var first = newSelectors.a; | ||
9591 | var remainder = newSelectors.b; | ||
9592 | return _List_fromArray( | ||
9593 | [ | ||
9594 | $rtfeldman$elm_css$Css$Structure$StyleBlockDeclaration( | ||
9595 | A3($rtfeldman$elm_css$Css$Structure$StyleBlock, first, remainder, _List_Nil)) | ||
9596 | ]); | ||
9597 | } | ||
9598 | }(); | ||
9599 | return A2($rtfeldman$elm_css$Css$Preprocess$Resolve$applyStyles, nestedStyles, newDeclarations); | ||
9600 | case 'MediaRule': | ||
9601 | var mediaQueries = declaration.a; | ||
9602 | var styleBlocks = declaration.b; | ||
9603 | return A2($rtfeldman$elm_css$Css$Preprocess$Resolve$resolveMediaRule, mediaQueries, styleBlocks); | ||
9604 | case 'SupportsRule': | ||
9605 | var str = declaration.a; | ||
9606 | var otherSnippets = declaration.b; | ||
9607 | return A2($rtfeldman$elm_css$Css$Preprocess$Resolve$resolveSupportsRule, str, otherSnippets); | ||
9608 | case 'DocumentRule': | ||
9609 | var str1 = declaration.a; | ||
9610 | var str2 = declaration.b; | ||
9611 | var str3 = declaration.c; | ||
9612 | var str4 = declaration.d; | ||
9613 | var styleBlock = declaration.e; | ||
9614 | return A2( | ||
9615 | $elm$core$List$map, | ||
9616 | A4($rtfeldman$elm_css$Css$Preprocess$Resolve$toDocumentRule, str1, str2, str3, str4), | ||
9617 | $rtfeldman$elm_css$Css$Preprocess$Resolve$expandStyleBlock(styleBlock)); | ||
9618 | case 'PageRule': | ||
9619 | var str = declaration.a; | ||
9620 | var properties = declaration.b; | ||
9621 | return _List_fromArray( | ||
9622 | [ | ||
9623 | A2($rtfeldman$elm_css$Css$Structure$PageRule, str, properties) | ||
9624 | ]); | ||
9625 | case 'FontFace': | ||
9626 | var properties = declaration.a; | ||
9627 | return _List_fromArray( | ||
9628 | [ | ||
9629 | $rtfeldman$elm_css$Css$Structure$FontFace(properties) | ||
9630 | ]); | ||
9631 | case 'Viewport': | ||
9632 | var properties = declaration.a; | ||
9633 | return _List_fromArray( | ||
9634 | [ | ||
9635 | $rtfeldman$elm_css$Css$Structure$Viewport(properties) | ||
9636 | ]); | ||
9637 | case 'CounterStyle': | ||
9638 | var properties = declaration.a; | ||
9639 | return _List_fromArray( | ||
9640 | [ | ||
9641 | $rtfeldman$elm_css$Css$Structure$CounterStyle(properties) | ||
9642 | ]); | ||
9643 | default: | ||
9644 | var tuples = declaration.a; | ||
9645 | return $rtfeldman$elm_css$Css$Preprocess$Resolve$resolveFontFeatureValues(tuples); | ||
9646 | } | ||
9647 | }; | ||
9648 | return $elm$core$List$concat( | ||
9649 | _Utils_ap( | ||
9650 | _List_fromArray( | ||
9651 | [ | ||
9652 | A2($rtfeldman$elm_css$Css$Preprocess$Resolve$applyStyles, rest, declarations) | ||
9653 | ]), | ||
9654 | A2( | ||
9655 | $elm$core$List$map, | ||
9656 | expandDeclaration, | ||
9657 | A2($elm$core$List$concatMap, $rtfeldman$elm_css$Css$Preprocess$unwrapSnippet, snippets)))); | ||
9658 | case 'WithPseudoElement': | ||
9659 | var _v11 = styles.a; | ||
9660 | var pseudoElement = _v11.a; | ||
9661 | var nestedStyles = _v11.b; | ||
9662 | var rest = styles.b; | ||
9663 | return A4( | ||
9664 | $rtfeldman$elm_css$Css$Preprocess$Resolve$applyNestedStylesToLast, | ||
9665 | nestedStyles, | ||
9666 | rest, | ||
9667 | $rtfeldman$elm_css$Css$Structure$appendPseudoElementToLastSelector(pseudoElement), | ||
9668 | declarations); | ||
9669 | case 'WithKeyframes': | ||
9670 | var str = styles.a.a; | ||
9671 | var rest = styles.b; | ||
9672 | var name = $rtfeldman$elm_css$Hash$fromString(str); | ||
9673 | var newProperty = 'animation-name:' + name; | ||
9674 | var newDeclarations = A2( | ||
9675 | $rtfeldman$elm_css$Css$Preprocess$Resolve$applyStyles, | ||
9676 | rest, | ||
9677 | A2($rtfeldman$elm_css$Css$Structure$appendProperty, newProperty, declarations)); | ||
9678 | return A2( | ||
9679 | $elm$core$List$append, | ||
9680 | newDeclarations, | ||
9681 | _List_fromArray( | ||
9682 | [ | ||
9683 | $rtfeldman$elm_css$Css$Structure$Keyframes( | ||
9684 | {declaration: str, name: name}) | ||
9685 | ])); | ||
9686 | case 'WithMedia': | ||
9687 | var _v12 = styles.a; | ||
9688 | var mediaQueries = _v12.a; | ||
9689 | var nestedStyles = _v12.b; | ||
9690 | var rest = styles.b; | ||
9691 | var extraDeclarations = function () { | ||
9692 | var _v13 = $rtfeldman$elm_css$Css$Preprocess$Resolve$collectSelectors(declarations); | ||
9693 | if (!_v13.b) { | ||
9694 | return _List_Nil; | ||
9695 | } else { | ||
9696 | var firstSelector = _v13.a; | ||
9697 | var otherSelectors = _v13.b; | ||
9698 | return A2( | ||
9699 | $elm$core$List$map, | ||
9700 | $rtfeldman$elm_css$Css$Structure$styleBlockToMediaRule(mediaQueries), | ||
9701 | A2( | ||
9702 | $rtfeldman$elm_css$Css$Preprocess$Resolve$applyStyles, | ||
9703 | nestedStyles, | ||
9704 | $elm$core$List$singleton( | ||
9705 | $rtfeldman$elm_css$Css$Structure$StyleBlockDeclaration( | ||
9706 | A3($rtfeldman$elm_css$Css$Structure$StyleBlock, firstSelector, otherSelectors, _List_Nil))))); | ||
9707 | } | ||
9708 | }(); | ||
9709 | return _Utils_ap( | ||
9710 | A2($rtfeldman$elm_css$Css$Preprocess$Resolve$applyStyles, rest, declarations), | ||
9711 | extraDeclarations); | ||
9712 | default: | ||
9713 | var otherStyles = styles.a.a; | ||
9714 | var rest = styles.b; | ||
9715 | return A2( | ||
9716 | $rtfeldman$elm_css$Css$Preprocess$Resolve$applyStyles, | ||
9717 | _Utils_ap(otherStyles, rest), | ||
9718 | declarations); | ||
9719 | } | ||
9720 | } | ||
9721 | }); | ||
9722 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$expandStyleBlock = function (_v2) { | ||
9723 | var firstSelector = _v2.a; | ||
9724 | var otherSelectors = _v2.b; | ||
9725 | var styles = _v2.c; | ||
9726 | return A2( | ||
9727 | $rtfeldman$elm_css$Css$Preprocess$Resolve$applyStyles, | ||
9728 | styles, | ||
9729 | _List_fromArray( | ||
9730 | [ | ||
9731 | $rtfeldman$elm_css$Css$Structure$StyleBlockDeclaration( | ||
9732 | A3($rtfeldman$elm_css$Css$Structure$StyleBlock, firstSelector, otherSelectors, _List_Nil)) | ||
9733 | ])); | ||
9734 | }; | ||
9735 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$extract = function (snippetDeclarations) { | ||
9736 | if (!snippetDeclarations.b) { | ||
9737 | return _List_Nil; | ||
9738 | } else { | ||
9739 | var first = snippetDeclarations.a; | ||
9740 | var rest = snippetDeclarations.b; | ||
9741 | return _Utils_ap( | ||
9742 | $rtfeldman$elm_css$Css$Preprocess$Resolve$toDeclarations(first), | ||
9743 | $rtfeldman$elm_css$Css$Preprocess$Resolve$extract(rest)); | ||
9744 | } | ||
9745 | }; | ||
9746 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$resolveMediaRule = F2( | ||
9747 | function (mediaQueries, styleBlocks) { | ||
9748 | var handleStyleBlock = function (styleBlock) { | ||
9749 | return A2( | ||
9750 | $elm$core$List$map, | ||
9751 | $rtfeldman$elm_css$Css$Preprocess$Resolve$toMediaRule(mediaQueries), | ||
9752 | $rtfeldman$elm_css$Css$Preprocess$Resolve$expandStyleBlock(styleBlock)); | ||
9753 | }; | ||
9754 | return A2($elm$core$List$concatMap, handleStyleBlock, styleBlocks); | ||
9755 | }); | ||
9756 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$resolveSupportsRule = F2( | ||
9757 | function (str, snippets) { | ||
9758 | var declarations = $rtfeldman$elm_css$Css$Preprocess$Resolve$extract( | ||
9759 | A2($elm$core$List$concatMap, $rtfeldman$elm_css$Css$Preprocess$unwrapSnippet, snippets)); | ||
9760 | return _List_fromArray( | ||
9761 | [ | ||
9762 | A2($rtfeldman$elm_css$Css$Structure$SupportsRule, str, declarations) | ||
9763 | ]); | ||
9764 | }); | ||
9765 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$toDeclarations = function (snippetDeclaration) { | ||
9766 | switch (snippetDeclaration.$) { | ||
9767 | case 'StyleBlockDeclaration': | ||
9768 | var styleBlock = snippetDeclaration.a; | ||
9769 | return $rtfeldman$elm_css$Css$Preprocess$Resolve$expandStyleBlock(styleBlock); | ||
9770 | case 'MediaRule': | ||
9771 | var mediaQueries = snippetDeclaration.a; | ||
9772 | var styleBlocks = snippetDeclaration.b; | ||
9773 | return A2($rtfeldman$elm_css$Css$Preprocess$Resolve$resolveMediaRule, mediaQueries, styleBlocks); | ||
9774 | case 'SupportsRule': | ||
9775 | var str = snippetDeclaration.a; | ||
9776 | var snippets = snippetDeclaration.b; | ||
9777 | return A2($rtfeldman$elm_css$Css$Preprocess$Resolve$resolveSupportsRule, str, snippets); | ||
9778 | case 'DocumentRule': | ||
9779 | var str1 = snippetDeclaration.a; | ||
9780 | var str2 = snippetDeclaration.b; | ||
9781 | var str3 = snippetDeclaration.c; | ||
9782 | var str4 = snippetDeclaration.d; | ||
9783 | var styleBlock = snippetDeclaration.e; | ||
9784 | return A2( | ||
9785 | $elm$core$List$map, | ||
9786 | A4($rtfeldman$elm_css$Css$Preprocess$Resolve$toDocumentRule, str1, str2, str3, str4), | ||
9787 | $rtfeldman$elm_css$Css$Preprocess$Resolve$expandStyleBlock(styleBlock)); | ||
9788 | case 'PageRule': | ||
9789 | var str = snippetDeclaration.a; | ||
9790 | var properties = snippetDeclaration.b; | ||
9791 | return _List_fromArray( | ||
9792 | [ | ||
9793 | A2($rtfeldman$elm_css$Css$Structure$PageRule, str, properties) | ||
9794 | ]); | ||
9795 | case 'FontFace': | ||
9796 | var properties = snippetDeclaration.a; | ||
9797 | return _List_fromArray( | ||
9798 | [ | ||
9799 | $rtfeldman$elm_css$Css$Structure$FontFace(properties) | ||
9800 | ]); | ||
9801 | case 'Viewport': | ||
9802 | var properties = snippetDeclaration.a; | ||
9803 | return _List_fromArray( | ||
9804 | [ | ||
9805 | $rtfeldman$elm_css$Css$Structure$Viewport(properties) | ||
9806 | ]); | ||
9807 | case 'CounterStyle': | ||
9808 | var properties = snippetDeclaration.a; | ||
9809 | return _List_fromArray( | ||
9810 | [ | ||
9811 | $rtfeldman$elm_css$Css$Structure$CounterStyle(properties) | ||
9812 | ]); | ||
9813 | default: | ||
9814 | var tuples = snippetDeclaration.a; | ||
9815 | return $rtfeldman$elm_css$Css$Preprocess$Resolve$resolveFontFeatureValues(tuples); | ||
9816 | } | ||
9817 | }; | ||
9818 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$toStructure = function (_v0) { | ||
9819 | var charset = _v0.charset; | ||
9820 | var imports = _v0.imports; | ||
9821 | var namespaces = _v0.namespaces; | ||
9822 | var snippets = _v0.snippets; | ||
9823 | var declarations = $rtfeldman$elm_css$Css$Preprocess$Resolve$extract( | ||
9824 | A2($elm$core$List$concatMap, $rtfeldman$elm_css$Css$Preprocess$unwrapSnippet, snippets)); | ||
9825 | return {charset: charset, declarations: declarations, imports: imports, namespaces: namespaces}; | ||
9826 | }; | ||
9827 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$compileHelp = function (sheet) { | ||
9828 | return $rtfeldman$elm_css$Css$Structure$Output$prettyPrint( | ||
9829 | $rtfeldman$elm_css$Css$Structure$compactStylesheet( | ||
9830 | $rtfeldman$elm_css$Css$Preprocess$Resolve$toStructure(sheet))); | ||
9831 | }; | ||
9832 | var $rtfeldman$elm_css$Css$Preprocess$Resolve$compile = function (styles) { | ||
9833 | return A2( | ||
9834 | $elm$core$String$join, | ||
9835 | '\n\n', | ||
9836 | A2($elm$core$List$map, $rtfeldman$elm_css$Css$Preprocess$Resolve$compileHelp, styles)); | ||
9837 | }; | ||
9838 | var $rtfeldman$elm_css$Css$Structure$ClassSelector = function (a) { | ||
9839 | return {$: 'ClassSelector', a: a}; | ||
9840 | }; | ||
9841 | var $rtfeldman$elm_css$Css$Preprocess$Snippet = function (a) { | ||
9842 | return {$: 'Snippet', a: a}; | ||
9843 | }; | ||
9844 | var $rtfeldman$elm_css$Css$Preprocess$StyleBlock = F3( | ||
9845 | function (a, b, c) { | ||
9846 | return {$: 'StyleBlock', a: a, b: b, c: c}; | ||
9847 | }); | ||
9848 | var $rtfeldman$elm_css$Css$Preprocess$StyleBlockDeclaration = function (a) { | ||
9849 | return {$: 'StyleBlockDeclaration', a: a}; | ||
9850 | }; | ||
9851 | var $rtfeldman$elm_css$VirtualDom$Styled$makeSnippet = F2( | ||
9852 | function (styles, sequence) { | ||
9853 | var selector = A3($rtfeldman$elm_css$Css$Structure$Selector, sequence, _List_Nil, $elm$core$Maybe$Nothing); | ||
9854 | return $rtfeldman$elm_css$Css$Preprocess$Snippet( | ||
9855 | _List_fromArray( | ||
9856 | [ | ||
9857 | $rtfeldman$elm_css$Css$Preprocess$StyleBlockDeclaration( | ||
9858 | A3($rtfeldman$elm_css$Css$Preprocess$StyleBlock, selector, _List_Nil, styles)) | ||
9859 | ])); | ||
9860 | }); | ||
9861 | var $rtfeldman$elm_css$VirtualDom$Styled$snippetFromPair = function (_v0) { | ||
9862 | var classname = _v0.a; | ||
9863 | var styles = _v0.b; | ||
9864 | return A2( | ||
9865 | $rtfeldman$elm_css$VirtualDom$Styled$makeSnippet, | ||
9866 | styles, | ||
9867 | $rtfeldman$elm_css$Css$Structure$UniversalSelectorSequence( | ||
9868 | _List_fromArray( | ||
9869 | [ | ||
9870 | $rtfeldman$elm_css$Css$Structure$ClassSelector(classname) | ||
9871 | ]))); | ||
9872 | }; | ||
9873 | var $rtfeldman$elm_css$Css$Preprocess$stylesheet = function (snippets) { | ||
9874 | return {charset: $elm$core$Maybe$Nothing, imports: _List_Nil, namespaces: _List_Nil, snippets: snippets}; | ||
9875 | }; | ||
9876 | var $rtfeldman$elm_css$VirtualDom$Styled$toDeclaration = function (dict) { | ||
9877 | return $rtfeldman$elm_css$Css$Preprocess$Resolve$compile( | ||
9878 | $elm$core$List$singleton( | ||
9879 | $rtfeldman$elm_css$Css$Preprocess$stylesheet( | ||
9880 | A2( | ||
9881 | $elm$core$List$map, | ||
9882 | $rtfeldman$elm_css$VirtualDom$Styled$snippetFromPair, | ||
9883 | $elm$core$Dict$toList(dict))))); | ||
9884 | }; | ||
9885 | var $rtfeldman$elm_css$VirtualDom$Styled$toStyleNode = function (styles) { | ||
9886 | return A3( | ||
9887 | $elm$virtual_dom$VirtualDom$node, | ||
9888 | 'style', | ||
9889 | _List_Nil, | ||
9890 | $elm$core$List$singleton( | ||
9891 | $elm$virtual_dom$VirtualDom$text( | ||
9892 | $rtfeldman$elm_css$VirtualDom$Styled$toDeclaration(styles)))); | ||
9893 | }; | ||
9894 | var $rtfeldman$elm_css$VirtualDom$Styled$unstyle = F3( | ||
9895 | function (elemType, properties, children) { | ||
9896 | var unstyledProperties = A2($elm$core$List$map, $rtfeldman$elm_css$VirtualDom$Styled$extractUnstyledAttribute, properties); | ||
9897 | var initialStyles = $rtfeldman$elm_css$VirtualDom$Styled$stylesFromProperties(properties); | ||
9898 | var _v0 = A3( | ||
9899 | $elm$core$List$foldl, | ||
9900 | $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyledHtml, | ||
9901 | _Utils_Tuple2(_List_Nil, initialStyles), | ||
9902 | children); | ||
9903 | var childNodes = _v0.a; | ||
9904 | var styles = _v0.b; | ||
9905 | var styleNode = $rtfeldman$elm_css$VirtualDom$Styled$toStyleNode(styles); | ||
9906 | return A3( | ||
9907 | $elm$virtual_dom$VirtualDom$node, | ||
9908 | elemType, | ||
9909 | unstyledProperties, | ||
9910 | A2( | ||
9911 | $elm$core$List$cons, | ||
9912 | styleNode, | ||
9913 | $elm$core$List$reverse(childNodes))); | ||
9914 | }); | ||
9915 | var $rtfeldman$elm_css$VirtualDom$Styled$containsKey = F2( | ||
9916 | function (key, pairs) { | ||
9917 | containsKey: | ||
9918 | while (true) { | ||
9919 | if (!pairs.b) { | ||
9920 | return false; | ||
9921 | } else { | ||
9922 | var _v1 = pairs.a; | ||
9923 | var str = _v1.a; | ||
9924 | var rest = pairs.b; | ||
9925 | if (_Utils_eq(key, str)) { | ||
9926 | return true; | ||
9927 | } else { | ||
9928 | var $temp$key = key, | ||
9929 | $temp$pairs = rest; | ||
9930 | key = $temp$key; | ||
9931 | pairs = $temp$pairs; | ||
9932 | continue containsKey; | ||
9933 | } | ||
9934 | } | ||
9935 | } | ||
9936 | }); | ||
9937 | var $rtfeldman$elm_css$VirtualDom$Styled$getUnusedKey = F2( | ||
9938 | function (_default, pairs) { | ||
9939 | getUnusedKey: | ||
9940 | while (true) { | ||
9941 | if (!pairs.b) { | ||
9942 | return _default; | ||
9943 | } else { | ||
9944 | var _v1 = pairs.a; | ||
9945 | var firstKey = _v1.a; | ||
9946 | var rest = pairs.b; | ||
9947 | var newKey = '_' + firstKey; | ||
9948 | if (A2($rtfeldman$elm_css$VirtualDom$Styled$containsKey, newKey, rest)) { | ||
9949 | var $temp$default = newKey, | ||
9950 | $temp$pairs = rest; | ||
9951 | _default = $temp$default; | ||
9952 | pairs = $temp$pairs; | ||
9953 | continue getUnusedKey; | ||
9954 | } else { | ||
9955 | return newKey; | ||
9956 | } | ||
9957 | } | ||
9958 | } | ||
9959 | }); | ||
9960 | var $rtfeldman$elm_css$VirtualDom$Styled$toKeyedStyleNode = F2( | ||
9961 | function (allStyles, keyedChildNodes) { | ||
9962 | var styleNodeKey = A2($rtfeldman$elm_css$VirtualDom$Styled$getUnusedKey, '_', keyedChildNodes); | ||
9963 | var finalNode = $rtfeldman$elm_css$VirtualDom$Styled$toStyleNode(allStyles); | ||
9964 | return _Utils_Tuple2(styleNodeKey, finalNode); | ||
9965 | }); | ||
9966 | var $rtfeldman$elm_css$VirtualDom$Styled$unstyleKeyed = F3( | ||
9967 | function (elemType, properties, keyedChildren) { | ||
9968 | var unstyledProperties = A2($elm$core$List$map, $rtfeldman$elm_css$VirtualDom$Styled$extractUnstyledAttribute, properties); | ||
9969 | var initialStyles = $rtfeldman$elm_css$VirtualDom$Styled$stylesFromProperties(properties); | ||
9970 | var _v0 = A3( | ||
9971 | $elm$core$List$foldl, | ||
9972 | $rtfeldman$elm_css$VirtualDom$Styled$accumulateKeyedStyledHtml, | ||
9973 | _Utils_Tuple2(_List_Nil, initialStyles), | ||
9974 | keyedChildren); | ||
9975 | var keyedChildNodes = _v0.a; | ||
9976 | var styles = _v0.b; | ||
9977 | var keyedStyleNode = A2($rtfeldman$elm_css$VirtualDom$Styled$toKeyedStyleNode, styles, keyedChildNodes); | ||
9978 | return A3( | ||
9979 | $elm$virtual_dom$VirtualDom$keyedNode, | ||
9980 | elemType, | ||
9981 | unstyledProperties, | ||
9982 | A2( | ||
9983 | $elm$core$List$cons, | ||
9984 | keyedStyleNode, | ||
9985 | $elm$core$List$reverse(keyedChildNodes))); | ||
9986 | }); | ||
9987 | var $rtfeldman$elm_css$VirtualDom$Styled$unstyleKeyedNS = F4( | ||
9988 | function (ns, elemType, properties, keyedChildren) { | ||
9989 | var unstyledProperties = A2($elm$core$List$map, $rtfeldman$elm_css$VirtualDom$Styled$extractUnstyledAttribute, properties); | ||
9990 | var initialStyles = $rtfeldman$elm_css$VirtualDom$Styled$stylesFromProperties(properties); | ||
9991 | var _v0 = A3( | ||
9992 | $elm$core$List$foldl, | ||
9993 | $rtfeldman$elm_css$VirtualDom$Styled$accumulateKeyedStyledHtml, | ||
9994 | _Utils_Tuple2(_List_Nil, initialStyles), | ||
9995 | keyedChildren); | ||
9996 | var keyedChildNodes = _v0.a; | ||
9997 | var styles = _v0.b; | ||
9998 | var keyedStyleNode = A2($rtfeldman$elm_css$VirtualDom$Styled$toKeyedStyleNode, styles, keyedChildNodes); | ||
9999 | return A4( | ||
10000 | $elm$virtual_dom$VirtualDom$keyedNodeNS, | ||
10001 | ns, | ||
10002 | elemType, | ||
10003 | unstyledProperties, | ||
10004 | A2( | ||
10005 | $elm$core$List$cons, | ||
10006 | keyedStyleNode, | ||
10007 | $elm$core$List$reverse(keyedChildNodes))); | ||
10008 | }); | ||
10009 | var $rtfeldman$elm_css$VirtualDom$Styled$unstyleNS = F4( | ||
10010 | function (ns, elemType, properties, children) { | ||
10011 | var unstyledProperties = A2($elm$core$List$map, $rtfeldman$elm_css$VirtualDom$Styled$extractUnstyledAttribute, properties); | ||
10012 | var initialStyles = $rtfeldman$elm_css$VirtualDom$Styled$stylesFromProperties(properties); | ||
10013 | var _v0 = A3( | ||
10014 | $elm$core$List$foldl, | ||
10015 | $rtfeldman$elm_css$VirtualDom$Styled$accumulateStyledHtml, | ||
10016 | _Utils_Tuple2(_List_Nil, initialStyles), | ||
10017 | children); | ||
10018 | var childNodes = _v0.a; | ||
10019 | var styles = _v0.b; | ||
10020 | var styleNode = $rtfeldman$elm_css$VirtualDom$Styled$toStyleNode(styles); | ||
10021 | return A4( | ||
10022 | $elm$virtual_dom$VirtualDom$nodeNS, | ||
10023 | ns, | ||
10024 | elemType, | ||
10025 | unstyledProperties, | ||
10026 | A2( | ||
10027 | $elm$core$List$cons, | ||
10028 | styleNode, | ||
10029 | $elm$core$List$reverse(childNodes))); | ||
10030 | }); | ||
10031 | var $rtfeldman$elm_css$VirtualDom$Styled$toUnstyled = function (vdom) { | ||
10032 | switch (vdom.$) { | ||
10033 | case 'Unstyled': | ||
10034 | var plainNode = vdom.a; | ||
10035 | return plainNode; | ||
10036 | case 'Node': | ||
10037 | var elemType = vdom.a; | ||
10038 | var properties = vdom.b; | ||
10039 | var children = vdom.c; | ||
10040 | return A3($rtfeldman$elm_css$VirtualDom$Styled$unstyle, elemType, properties, children); | ||
10041 | case 'NodeNS': | ||
10042 | var ns = vdom.a; | ||
10043 | var elemType = vdom.b; | ||
10044 | var properties = vdom.c; | ||
10045 | var children = vdom.d; | ||
10046 | return A4($rtfeldman$elm_css$VirtualDom$Styled$unstyleNS, ns, elemType, properties, children); | ||
10047 | case 'KeyedNode': | ||
10048 | var elemType = vdom.a; | ||
10049 | var properties = vdom.b; | ||
10050 | var children = vdom.c; | ||
10051 | return A3($rtfeldman$elm_css$VirtualDom$Styled$unstyleKeyed, elemType, properties, children); | ||
10052 | default: | ||
10053 | var ns = vdom.a; | ||
10054 | var elemType = vdom.b; | ||
10055 | var properties = vdom.c; | ||
10056 | var children = vdom.d; | ||
10057 | return A4($rtfeldman$elm_css$VirtualDom$Styled$unstyleKeyedNS, ns, elemType, properties, children); | ||
10058 | } | ||
10059 | }; | ||
10060 | var $rtfeldman$elm_css$Html$Styled$toUnstyled = $rtfeldman$elm_css$VirtualDom$Styled$toUnstyled; | ||
10061 | var $author$project$Main$LogoutPressed = {$: 'LogoutPressed'}; | ||
10062 | var $rtfeldman$elm_css$Css$Preprocess$AppendProperty = function (a) { | ||
10063 | return {$: 'AppendProperty', a: a}; | ||
10064 | }; | ||
10065 | var $rtfeldman$elm_css$Css$property = F2( | ||
10066 | function (key, value) { | ||
10067 | return $rtfeldman$elm_css$Css$Preprocess$AppendProperty(key + (':' + value)); | ||
10068 | }); | ||
10069 | var $rtfeldman$elm_css$Css$backgroundColor = function (c) { | ||
10070 | return A2($rtfeldman$elm_css$Css$property, 'background-color', c.value); | ||
10071 | }; | ||
10072 | var $rtfeldman$elm_css$VirtualDom$Styled$murmurSeed = 15739; | ||
10073 | var $rtfeldman$elm_css$VirtualDom$Styled$getClassname = function (styles) { | ||
10074 | return $elm$core$List$isEmpty(styles) ? 'unstyled' : A2( | ||
10075 | $elm$core$String$cons, | ||
10076 | _Utils_chr('_'), | ||
10077 | $rtfeldman$elm_hex$Hex$toString( | ||
10078 | A2( | ||
10079 | $rtfeldman$elm_css$ElmCssVendor$Murmur3$hashString, | ||
10080 | $rtfeldman$elm_css$VirtualDom$Styled$murmurSeed, | ||
10081 | $rtfeldman$elm_css$Css$Preprocess$Resolve$compile( | ||
10082 | $elm$core$List$singleton( | ||
10083 | $rtfeldman$elm_css$Css$Preprocess$stylesheet( | ||
10084 | $elm$core$List$singleton( | ||
10085 | A2( | ||
10086 | $rtfeldman$elm_css$VirtualDom$Styled$makeSnippet, | ||
10087 | styles, | ||
10088 | $rtfeldman$elm_css$Css$Structure$UniversalSelectorSequence(_List_Nil))))))))); | ||
10089 | }; | ||
10090 | var $rtfeldman$elm_css$Html$Styled$Internal$css = function (styles) { | ||
10091 | var classname = $rtfeldman$elm_css$VirtualDom$Styled$getClassname(styles); | ||
10092 | var classProperty = A2( | ||
10093 | $elm$virtual_dom$VirtualDom$property, | ||
10094 | 'className', | ||
10095 | $elm$json$Json$Encode$string(classname)); | ||
10096 | return A3($rtfeldman$elm_css$VirtualDom$Styled$Attribute, classProperty, styles, classname); | ||
10097 | }; | ||
10098 | var $rtfeldman$elm_css$Html$Styled$Attributes$css = $rtfeldman$elm_css$Html$Styled$Internal$css; | ||
10099 | var $rtfeldman$elm_css$Css$prop1 = F2( | ||
10100 | function (key, arg) { | ||
10101 | return A2($rtfeldman$elm_css$Css$property, key, arg.value); | ||
10102 | }); | ||
10103 | var $rtfeldman$elm_css$Css$display = $rtfeldman$elm_css$Css$prop1('display'); | ||
10104 | var $rtfeldman$elm_css$Css$border = $rtfeldman$elm_css$Css$prop1('border'); | ||
10105 | var $rtfeldman$elm_css$Css$borderRadius = $rtfeldman$elm_css$Css$prop1('border-radius'); | ||
10106 | var $rtfeldman$elm_css$Html$Styled$button = $rtfeldman$elm_css$Html$Styled$node('button'); | ||
10107 | var $rtfeldman$elm_css$Css$color = function (c) { | ||
10108 | return A2($rtfeldman$elm_css$Css$property, 'color', c.value); | ||
10109 | }; | ||
10110 | var $rtfeldman$elm_css$Css$height = $rtfeldman$elm_css$Css$prop1('height'); | ||
10111 | var $rtfeldman$elm_css$Css$Preprocess$ExtendSelector = F2( | ||
10112 | function (a, b) { | ||
10113 | return {$: 'ExtendSelector', a: a, b: b}; | ||
10114 | }); | ||
10115 | var $rtfeldman$elm_css$Css$Structure$PseudoClassSelector = function (a) { | ||
10116 | return {$: 'PseudoClassSelector', a: a}; | ||
10117 | }; | ||
10118 | var $rtfeldman$elm_css$Css$pseudoClass = function (_class) { | ||
10119 | return $rtfeldman$elm_css$Css$Preprocess$ExtendSelector( | ||
10120 | $rtfeldman$elm_css$Css$Structure$PseudoClassSelector(_class)); | ||
10121 | }; | ||
10122 | var $rtfeldman$elm_css$Css$hover = $rtfeldman$elm_css$Css$pseudoClass('hover'); | ||
10123 | var $rtfeldman$elm_css$Css$margin = $rtfeldman$elm_css$Css$prop1('margin'); | ||
10124 | var $rtfeldman$elm_css$Css$prop2 = F3( | ||
10125 | function (key, argA, argB) { | ||
10126 | return A2( | ||
10127 | $rtfeldman$elm_css$Css$property, | ||
10128 | key, | ||
10129 | A2( | ||
10130 | $elm$core$String$join, | ||
10131 | ' ', | ||
10132 | _List_fromArray( | ||
10133 | [argA.value, argB.value]))); | ||
10134 | }); | ||
10135 | var $rtfeldman$elm_css$Css$padding2 = $rtfeldman$elm_css$Css$prop2('padding'); | ||
10136 | var $rtfeldman$elm_css$Css$PxUnits = {$: 'PxUnits'}; | ||
10137 | var $rtfeldman$elm_css$Css$Structure$Compatible = {$: 'Compatible'}; | ||
10138 | var $elm$core$String$fromFloat = _String_fromNumber; | ||
10139 | var $rtfeldman$elm_css$Css$Internal$lengthConverter = F3( | ||
10140 | function (units, unitLabel, numericValue) { | ||
10141 | return { | ||
10142 | absoluteLength: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10143 | calc: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10144 | flexBasis: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10145 | fontSize: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10146 | length: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10147 | lengthOrAuto: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10148 | lengthOrAutoOrCoverOrContain: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10149 | lengthOrMinMaxDimension: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10150 | lengthOrNone: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10151 | lengthOrNoneOrMinMaxDimension: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10152 | lengthOrNumber: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10153 | lengthOrNumberOrAutoOrNoneOrContent: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10154 | numericValue: numericValue, | ||
10155 | textIndent: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10156 | unitLabel: unitLabel, | ||
10157 | units: units, | ||
10158 | value: _Utils_ap( | ||
10159 | $elm$core$String$fromFloat(numericValue), | ||
10160 | unitLabel) | ||
10161 | }; | ||
10162 | }); | ||
10163 | var $rtfeldman$elm_css$Css$px = A2($rtfeldman$elm_css$Css$Internal$lengthConverter, $rtfeldman$elm_css$Css$PxUnits, 'px'); | ||
10164 | var $rtfeldman$elm_css$Html$Styled$styled = F4( | ||
10165 | function (fn, styles, attrs, children) { | ||
10166 | return A2( | ||
10167 | fn, | ||
10168 | A2( | ||
10169 | $elm$core$List$cons, | ||
10170 | $rtfeldman$elm_css$Html$Styled$Internal$css(styles), | ||
10171 | attrs), | ||
10172 | children); | ||
10173 | }); | ||
10174 | var $author$project$Styles$Theme = F7( | ||
10175 | function (primary, secondary, bad, fg, bg, fgLight, bgLight) { | ||
10176 | return {bad: bad, bg: bg, bgLight: bgLight, fg: fg, fgLight: fgLight, primary: primary, secondary: secondary}; | ||
10177 | }); | ||
10178 | var $rtfeldman$elm_css$Css$withPrecedingHash = function (str) { | ||
10179 | return A2($elm$core$String$startsWith, '#', str) ? str : A2( | ||
10180 | $elm$core$String$cons, | ||
10181 | _Utils_chr('#'), | ||
10182 | str); | ||
10183 | }; | ||
10184 | var $rtfeldman$elm_css$Css$erroneousHex = function (str) { | ||
10185 | return { | ||
10186 | alpha: 1, | ||
10187 | blue: 0, | ||
10188 | color: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10189 | green: 0, | ||
10190 | red: 0, | ||
10191 | value: $rtfeldman$elm_css$Css$withPrecedingHash(str) | ||
10192 | }; | ||
10193 | }; | ||
10194 | var $elm$core$String$fromChar = function (_char) { | ||
10195 | return A2($elm$core$String$cons, _char, ''); | ||
10196 | }; | ||
10197 | var $elm$core$Basics$pow = _Basics_pow; | ||
10198 | var $rtfeldman$elm_hex$Hex$fromStringHelp = F3( | ||
10199 | function (position, chars, accumulated) { | ||
10200 | fromStringHelp: | ||
10201 | while (true) { | ||
10202 | if (!chars.b) { | ||
10203 | return $elm$core$Result$Ok(accumulated); | ||
10204 | } else { | ||
10205 | var _char = chars.a; | ||
10206 | var rest = chars.b; | ||
10207 | switch (_char.valueOf()) { | ||
10208 | case '0': | ||
10209 | var $temp$position = position - 1, | ||
10210 | $temp$chars = rest, | ||
10211 | $temp$accumulated = accumulated; | ||
10212 | position = $temp$position; | ||
10213 | chars = $temp$chars; | ||
10214 | accumulated = $temp$accumulated; | ||
10215 | continue fromStringHelp; | ||
10216 | case '1': | ||
10217 | var $temp$position = position - 1, | ||
10218 | $temp$chars = rest, | ||
10219 | $temp$accumulated = accumulated + A2($elm$core$Basics$pow, 16, position); | ||
10220 | position = $temp$position; | ||
10221 | chars = $temp$chars; | ||
10222 | accumulated = $temp$accumulated; | ||
10223 | continue fromStringHelp; | ||
10224 | case '2': | ||
10225 | var $temp$position = position - 1, | ||
10226 | $temp$chars = rest, | ||
10227 | $temp$accumulated = accumulated + (2 * A2($elm$core$Basics$pow, 16, position)); | ||
10228 | position = $temp$position; | ||
10229 | chars = $temp$chars; | ||
10230 | accumulated = $temp$accumulated; | ||
10231 | continue fromStringHelp; | ||
10232 | case '3': | ||
10233 | var $temp$position = position - 1, | ||
10234 | $temp$chars = rest, | ||
10235 | $temp$accumulated = accumulated + (3 * A2($elm$core$Basics$pow, 16, position)); | ||
10236 | position = $temp$position; | ||
10237 | chars = $temp$chars; | ||
10238 | accumulated = $temp$accumulated; | ||
10239 | continue fromStringHelp; | ||
10240 | case '4': | ||
10241 | var $temp$position = position - 1, | ||
10242 | $temp$chars = rest, | ||
10243 | $temp$accumulated = accumulated + (4 * A2($elm$core$Basics$pow, 16, position)); | ||
10244 | position = $temp$position; | ||
10245 | chars = $temp$chars; | ||
10246 | accumulated = $temp$accumulated; | ||
10247 | continue fromStringHelp; | ||
10248 | case '5': | ||
10249 | var $temp$position = position - 1, | ||
10250 | $temp$chars = rest, | ||
10251 | $temp$accumulated = accumulated + (5 * A2($elm$core$Basics$pow, 16, position)); | ||
10252 | position = $temp$position; | ||
10253 | chars = $temp$chars; | ||
10254 | accumulated = $temp$accumulated; | ||
10255 | continue fromStringHelp; | ||
10256 | case '6': | ||
10257 | var $temp$position = position - 1, | ||
10258 | $temp$chars = rest, | ||
10259 | $temp$accumulated = accumulated + (6 * A2($elm$core$Basics$pow, 16, position)); | ||
10260 | position = $temp$position; | ||
10261 | chars = $temp$chars; | ||
10262 | accumulated = $temp$accumulated; | ||
10263 | continue fromStringHelp; | ||
10264 | case '7': | ||
10265 | var $temp$position = position - 1, | ||
10266 | $temp$chars = rest, | ||
10267 | $temp$accumulated = accumulated + (7 * A2($elm$core$Basics$pow, 16, position)); | ||
10268 | position = $temp$position; | ||
10269 | chars = $temp$chars; | ||
10270 | accumulated = $temp$accumulated; | ||
10271 | continue fromStringHelp; | ||
10272 | case '8': | ||
10273 | var $temp$position = position - 1, | ||
10274 | $temp$chars = rest, | ||
10275 | $temp$accumulated = accumulated + (8 * A2($elm$core$Basics$pow, 16, position)); | ||
10276 | position = $temp$position; | ||
10277 | chars = $temp$chars; | ||
10278 | accumulated = $temp$accumulated; | ||
10279 | continue fromStringHelp; | ||
10280 | case '9': | ||
10281 | var $temp$position = position - 1, | ||
10282 | $temp$chars = rest, | ||
10283 | $temp$accumulated = accumulated + (9 * A2($elm$core$Basics$pow, 16, position)); | ||
10284 | position = $temp$position; | ||
10285 | chars = $temp$chars; | ||
10286 | accumulated = $temp$accumulated; | ||
10287 | continue fromStringHelp; | ||
10288 | case 'a': | ||
10289 | var $temp$position = position - 1, | ||
10290 | $temp$chars = rest, | ||
10291 | $temp$accumulated = accumulated + (10 * A2($elm$core$Basics$pow, 16, position)); | ||
10292 | position = $temp$position; | ||
10293 | chars = $temp$chars; | ||
10294 | accumulated = $temp$accumulated; | ||
10295 | continue fromStringHelp; | ||
10296 | case 'b': | ||
10297 | var $temp$position = position - 1, | ||
10298 | $temp$chars = rest, | ||
10299 | $temp$accumulated = accumulated + (11 * A2($elm$core$Basics$pow, 16, position)); | ||
10300 | position = $temp$position; | ||
10301 | chars = $temp$chars; | ||
10302 | accumulated = $temp$accumulated; | ||
10303 | continue fromStringHelp; | ||
10304 | case 'c': | ||
10305 | var $temp$position = position - 1, | ||
10306 | $temp$chars = rest, | ||
10307 | $temp$accumulated = accumulated + (12 * A2($elm$core$Basics$pow, 16, position)); | ||
10308 | position = $temp$position; | ||
10309 | chars = $temp$chars; | ||
10310 | accumulated = $temp$accumulated; | ||
10311 | continue fromStringHelp; | ||
10312 | case 'd': | ||
10313 | var $temp$position = position - 1, | ||
10314 | $temp$chars = rest, | ||
10315 | $temp$accumulated = accumulated + (13 * A2($elm$core$Basics$pow, 16, position)); | ||
10316 | position = $temp$position; | ||
10317 | chars = $temp$chars; | ||
10318 | accumulated = $temp$accumulated; | ||
10319 | continue fromStringHelp; | ||
10320 | case 'e': | ||
10321 | var $temp$position = position - 1, | ||
10322 | $temp$chars = rest, | ||
10323 | $temp$accumulated = accumulated + (14 * A2($elm$core$Basics$pow, 16, position)); | ||
10324 | position = $temp$position; | ||
10325 | chars = $temp$chars; | ||
10326 | accumulated = $temp$accumulated; | ||
10327 | continue fromStringHelp; | ||
10328 | case 'f': | ||
10329 | var $temp$position = position - 1, | ||
10330 | $temp$chars = rest, | ||
10331 | $temp$accumulated = accumulated + (15 * A2($elm$core$Basics$pow, 16, position)); | ||
10332 | position = $temp$position; | ||
10333 | chars = $temp$chars; | ||
10334 | accumulated = $temp$accumulated; | ||
10335 | continue fromStringHelp; | ||
10336 | default: | ||
10337 | var nonHex = _char; | ||
10338 | return $elm$core$Result$Err( | ||
10339 | $elm$core$String$fromChar(nonHex) + ' is not a valid hexadecimal character.'); | ||
10340 | } | ||
10341 | } | ||
10342 | } | ||
10343 | }); | ||
10344 | var $elm$core$Result$map = F2( | ||
10345 | function (func, ra) { | ||
10346 | if (ra.$ === 'Ok') { | ||
10347 | var a = ra.a; | ||
10348 | return $elm$core$Result$Ok( | ||
10349 | func(a)); | ||
10350 | } else { | ||
10351 | var e = ra.a; | ||
10352 | return $elm$core$Result$Err(e); | ||
10353 | } | ||
10354 | }); | ||
10355 | var $rtfeldman$elm_hex$Hex$fromString = function (str) { | ||
10356 | if ($elm$core$String$isEmpty(str)) { | ||
10357 | return $elm$core$Result$Err('Empty strings are not valid hexadecimal strings.'); | ||
10358 | } else { | ||
10359 | var result = function () { | ||
10360 | if (A2($elm$core$String$startsWith, '-', str)) { | ||
10361 | var list = A2( | ||
10362 | $elm$core$Maybe$withDefault, | ||
10363 | _List_Nil, | ||
10364 | $elm$core$List$tail( | ||
10365 | $elm$core$String$toList(str))); | ||
10366 | return A2( | ||
10367 | $elm$core$Result$map, | ||
10368 | $elm$core$Basics$negate, | ||
10369 | A3( | ||
10370 | $rtfeldman$elm_hex$Hex$fromStringHelp, | ||
10371 | $elm$core$List$length(list) - 1, | ||
10372 | list, | ||
10373 | 0)); | ||
10374 | } else { | ||
10375 | return A3( | ||
10376 | $rtfeldman$elm_hex$Hex$fromStringHelp, | ||
10377 | $elm$core$String$length(str) - 1, | ||
10378 | $elm$core$String$toList(str), | ||
10379 | 0); | ||
10380 | } | ||
10381 | }(); | ||
10382 | var formatError = function (err) { | ||
10383 | return A2( | ||
10384 | $elm$core$String$join, | ||
10385 | ' ', | ||
10386 | _List_fromArray( | ||
10387 | ['\"' + (str + '\"'), 'is not a valid hexadecimal string because', err])); | ||
10388 | }; | ||
10389 | return A2($elm$core$Result$mapError, formatError, result); | ||
10390 | } | ||
10391 | }; | ||
10392 | var $elm$core$String$toLower = _String_toLower; | ||
10393 | var $rtfeldman$elm_css$Css$validHex = F5( | ||
10394 | function (str, _v0, _v1, _v2, _v3) { | ||
10395 | var r1 = _v0.a; | ||
10396 | var r2 = _v0.b; | ||
10397 | var g1 = _v1.a; | ||
10398 | var g2 = _v1.b; | ||
10399 | var b1 = _v2.a; | ||
10400 | var b2 = _v2.b; | ||
10401 | var a1 = _v3.a; | ||
10402 | var a2 = _v3.b; | ||
10403 | var toResult = A2( | ||
10404 | $elm$core$Basics$composeR, | ||
10405 | $elm$core$String$fromList, | ||
10406 | A2($elm$core$Basics$composeR, $elm$core$String$toLower, $rtfeldman$elm_hex$Hex$fromString)); | ||
10407 | var results = _Utils_Tuple2( | ||
10408 | _Utils_Tuple2( | ||
10409 | toResult( | ||
10410 | _List_fromArray( | ||
10411 | [r1, r2])), | ||
10412 | toResult( | ||
10413 | _List_fromArray( | ||
10414 | [g1, g2]))), | ||
10415 | _Utils_Tuple2( | ||
10416 | toResult( | ||
10417 | _List_fromArray( | ||
10418 | [b1, b2])), | ||
10419 | toResult( | ||
10420 | _List_fromArray( | ||
10421 | [a1, a2])))); | ||
10422 | if ((((results.a.a.$ === 'Ok') && (results.a.b.$ === 'Ok')) && (results.b.a.$ === 'Ok')) && (results.b.b.$ === 'Ok')) { | ||
10423 | var _v5 = results.a; | ||
10424 | var red = _v5.a.a; | ||
10425 | var green = _v5.b.a; | ||
10426 | var _v6 = results.b; | ||
10427 | var blue = _v6.a.a; | ||
10428 | var alpha = _v6.b.a; | ||
10429 | return { | ||
10430 | alpha: alpha / 255, | ||
10431 | blue: blue, | ||
10432 | color: $rtfeldman$elm_css$Css$Structure$Compatible, | ||
10433 | green: green, | ||
10434 | red: red, | ||
10435 | value: $rtfeldman$elm_css$Css$withPrecedingHash(str) | ||
10436 | }; | ||
10437 | } else { | ||
10438 | return $rtfeldman$elm_css$Css$erroneousHex(str); | ||
10439 | } | ||
10440 | }); | ||
10441 | var $rtfeldman$elm_css$Css$hex = function (str) { | ||
10442 | var withoutHash = A2($elm$core$String$startsWith, '#', str) ? A2($elm$core$String$dropLeft, 1, str) : str; | ||
10443 | var _v0 = $elm$core$String$toList(withoutHash); | ||
10444 | _v0$4: | ||
10445 | while (true) { | ||
10446 | if ((_v0.b && _v0.b.b) && _v0.b.b.b) { | ||
10447 | if (!_v0.b.b.b.b) { | ||
10448 | var r = _v0.a; | ||
10449 | var _v1 = _v0.b; | ||
10450 | var g = _v1.a; | ||
10451 | var _v2 = _v1.b; | ||
10452 | var b = _v2.a; | ||
10453 | return A5( | ||
10454 | $rtfeldman$elm_css$Css$validHex, | ||
10455 | str, | ||
10456 | _Utils_Tuple2(r, r), | ||
10457 | _Utils_Tuple2(g, g), | ||
10458 | _Utils_Tuple2(b, b), | ||
10459 | _Utils_Tuple2( | ||
10460 | _Utils_chr('f'), | ||
10461 | _Utils_chr('f'))); | ||
10462 | } else { | ||
10463 | if (!_v0.b.b.b.b.b) { | ||
10464 | var r = _v0.a; | ||
10465 | var _v3 = _v0.b; | ||
10466 | var g = _v3.a; | ||
10467 | var _v4 = _v3.b; | ||
10468 | var b = _v4.a; | ||
10469 | var _v5 = _v4.b; | ||
10470 | var a = _v5.a; | ||
10471 | return A5( | ||
10472 | $rtfeldman$elm_css$Css$validHex, | ||
10473 | str, | ||
10474 | _Utils_Tuple2(r, r), | ||
10475 | _Utils_Tuple2(g, g), | ||
10476 | _Utils_Tuple2(b, b), | ||
10477 | _Utils_Tuple2(a, a)); | ||
10478 | } else { | ||
10479 | if (_v0.b.b.b.b.b.b) { | ||
10480 | if (!_v0.b.b.b.b.b.b.b) { | ||
10481 | var r1 = _v0.a; | ||
10482 | var _v6 = _v0.b; | ||
10483 | var r2 = _v6.a; | ||
10484 | var _v7 = _v6.b; | ||
10485 | var g1 = _v7.a; | ||
10486 | var _v8 = _v7.b; | ||
10487 | var g2 = _v8.a; | ||
10488 | var _v9 = _v8.b; | ||
10489 | var b1 = _v9.a; | ||
10490 | var _v10 = _v9.b; | ||
10491 | var b2 = _v10.a; | ||
10492 | return A5( | ||
10493 | $rtfeldman$elm_css$Css$validHex, | ||
10494 | str, | ||
10495 | _Utils_Tuple2(r1, r2), | ||
10496 | _Utils_Tuple2(g1, g2), | ||
10497 | _Utils_Tuple2(b1, b2), | ||
10498 | _Utils_Tuple2( | ||
10499 | _Utils_chr('f'), | ||
10500 | _Utils_chr('f'))); | ||
10501 | } else { | ||
10502 | if (_v0.b.b.b.b.b.b.b.b && (!_v0.b.b.b.b.b.b.b.b.b)) { | ||
10503 | var r1 = _v0.a; | ||
10504 | var _v11 = _v0.b; | ||
10505 | var r2 = _v11.a; | ||
10506 | var _v12 = _v11.b; | ||
10507 | var g1 = _v12.a; | ||
10508 | var _v13 = _v12.b; | ||
10509 | var g2 = _v13.a; | ||
10510 | var _v14 = _v13.b; | ||
10511 | var b1 = _v14.a; | ||
10512 | var _v15 = _v14.b; | ||
10513 | var b2 = _v15.a; | ||
10514 | var _v16 = _v15.b; | ||
10515 | var a1 = _v16.a; | ||
10516 | var _v17 = _v16.b; | ||
10517 | var a2 = _v17.a; | ||
10518 | return A5( | ||
10519 | $rtfeldman$elm_css$Css$validHex, | ||
10520 | str, | ||
10521 | _Utils_Tuple2(r1, r2), | ||
10522 | _Utils_Tuple2(g1, g2), | ||
10523 | _Utils_Tuple2(b1, b2), | ||
10524 | _Utils_Tuple2(a1, a2)); | ||
10525 | } else { | ||
10526 | break _v0$4; | ||
10527 | } | ||
10528 | } | ||
10529 | } else { | ||
10530 | break _v0$4; | ||
10531 | } | ||
10532 | } | ||
10533 | } | ||
10534 | } else { | ||
10535 | break _v0$4; | ||
10536 | } | ||
10537 | } | ||
10538 | return $rtfeldman$elm_css$Css$erroneousHex(str); | ||
10539 | }; | ||
10540 | var $author$project$Styles$theme = A7( | ||
10541 | $author$project$Styles$Theme, | ||
10542 | $rtfeldman$elm_css$Css$hex('fedbd0'), | ||
10543 | $rtfeldman$elm_css$Css$hex('feeae6'), | ||
10544 | $rtfeldman$elm_css$Css$hex('ff0000'), | ||
10545 | $rtfeldman$elm_css$Css$hex('442c2e'), | ||
10546 | $rtfeldman$elm_css$Css$hex('ffffff'), | ||
10547 | $rtfeldman$elm_css$Css$hex('442c2e'), | ||
10548 | $rtfeldman$elm_css$Css$hex('feeae6')); | ||
10549 | var $author$project$Styles$furbyButton = A2( | ||
10550 | $rtfeldman$elm_css$Html$Styled$styled, | ||
10551 | $rtfeldman$elm_css$Html$Styled$button, | ||
10552 | _List_fromArray( | ||
10553 | [ | ||
10554 | $rtfeldman$elm_css$Css$margin( | ||
10555 | $rtfeldman$elm_css$Css$px(12)), | ||
10556 | $rtfeldman$elm_css$Css$color($author$project$Styles$theme.fg), | ||
10557 | $rtfeldman$elm_css$Css$height( | ||
10558 | $rtfeldman$elm_css$Css$px(40)), | ||
10559 | $rtfeldman$elm_css$Css$border( | ||
10560 | $rtfeldman$elm_css$Css$px(0)), | ||
10561 | $rtfeldman$elm_css$Css$borderRadius( | ||
10562 | $rtfeldman$elm_css$Css$px(2)), | ||
10563 | A2( | ||
10564 | $rtfeldman$elm_css$Css$padding2, | ||
10565 | $rtfeldman$elm_css$Css$px(6), | ||
10566 | $rtfeldman$elm_css$Css$px(12)), | ||
10567 | $rtfeldman$elm_css$Css$backgroundColor($author$project$Styles$theme.primary), | ||
10568 | $rtfeldman$elm_css$Css$hover( | ||
10569 | _List_fromArray( | ||
10570 | [ | ||
10571 | $rtfeldman$elm_css$Css$backgroundColor($author$project$Styles$theme.secondary), | ||
10572 | $rtfeldman$elm_css$Css$color($author$project$Styles$theme.fg), | ||
10573 | $rtfeldman$elm_css$Css$margin( | ||
10574 | $rtfeldman$elm_css$Css$px(12)) | ||
10575 | ])) | ||
10576 | ])); | ||
10577 | var $rtfeldman$elm_css$Css$none = {backgroundImage: $rtfeldman$elm_css$Css$Structure$Compatible, blockAxisOverflow: $rtfeldman$elm_css$Css$Structure$Compatible, borderStyle: $rtfeldman$elm_css$Css$Structure$Compatible, cursor: $rtfeldman$elm_css$Css$Structure$Compatible, display: $rtfeldman$elm_css$Css$Structure$Compatible, hoverCapability: $rtfeldman$elm_css$Css$Structure$Compatible, inlineAxisOverflow: $rtfeldman$elm_css$Css$Structure$Compatible, keyframes: $rtfeldman$elm_css$Css$Structure$Compatible, lengthOrNone: $rtfeldman$elm_css$Css$Structure$Compatible, lengthOrNoneOrMinMaxDimension: $rtfeldman$elm_css$Css$Structure$Compatible, lengthOrNumberOrAutoOrNoneOrContent: $rtfeldman$elm_css$Css$Structure$Compatible, listStyleType: $rtfeldman$elm_css$Css$Structure$Compatible, listStyleTypeOrPositionOrImage: $rtfeldman$elm_css$Css$Structure$Compatible, none: $rtfeldman$elm_css$Css$Structure$Compatible, outline: $rtfeldman$elm_css$Css$Structure$Compatible, pointerDevice: $rtfeldman$elm_css$Css$Structure$Compatible, pointerEvents: $rtfeldman$elm_css$Css$Structure$Compatible, resize: $rtfeldman$elm_css$Css$Structure$Compatible, scriptingSupport: $rtfeldman$elm_css$Css$Structure$Compatible, textDecorationLine: $rtfeldman$elm_css$Css$Structure$Compatible, textTransform: $rtfeldman$elm_css$Css$Structure$Compatible, touchAction: $rtfeldman$elm_css$Css$Structure$Compatible, transform: $rtfeldman$elm_css$Css$Structure$Compatible, updateFrequency: $rtfeldman$elm_css$Css$Structure$Compatible, value: 'none'}; | ||
10578 | var $rtfeldman$elm_css$Css$padding = $rtfeldman$elm_css$Css$prop1('padding'); | ||
10579 | var $rtfeldman$elm_css$Css$textDecoration = $rtfeldman$elm_css$Css$prop1('text-decoration'); | ||
10580 | var $rtfeldman$elm_css$Css$underline = {textDecorationLine: $rtfeldman$elm_css$Css$Structure$Compatible, value: 'underline'}; | ||
10581 | var $author$project$Styles$headerLink = A2( | ||
10582 | $rtfeldman$elm_css$Html$Styled$styled, | ||
10583 | $rtfeldman$elm_css$Html$Styled$a, | ||
10584 | _List_fromArray( | ||
10585 | [ | ||
10586 | $rtfeldman$elm_css$Css$color($author$project$Styles$theme.fgLight), | ||
10587 | $rtfeldman$elm_css$Css$padding( | ||
10588 | $rtfeldman$elm_css$Css$px(12)), | ||
10589 | $rtfeldman$elm_css$Css$textDecoration($rtfeldman$elm_css$Css$none), | ||
10590 | $rtfeldman$elm_css$Css$hover( | ||
10591 | _List_fromArray( | ||
10592 | [ | ||
10593 | $rtfeldman$elm_css$Css$backgroundColor($author$project$Styles$theme.secondary), | ||
10594 | $rtfeldman$elm_css$Css$textDecoration($rtfeldman$elm_css$Css$underline) | ||
10595 | ])) | ||
10596 | ])); | ||
10597 | var $rtfeldman$elm_css$Css$inline = {display: $rtfeldman$elm_css$Css$Structure$Compatible, value: 'inline'}; | ||
10598 | var $rtfeldman$elm_css$Css$left = $rtfeldman$elm_css$Css$prop1('left'); | ||
10599 | var $rtfeldman$elm_css$Css$listStyle = $rtfeldman$elm_css$Css$prop1('list-style'); | ||
10600 | var $elm$virtual_dom$VirtualDom$Normal = function (a) { | ||
10601 | return {$: 'Normal', a: a}; | ||
10602 | }; | ||
10603 | var $elm$virtual_dom$VirtualDom$on = _VirtualDom_on; | ||
10604 | var $rtfeldman$elm_css$VirtualDom$Styled$on = F2( | ||
10605 | function (eventName, handler) { | ||
10606 | return A3( | ||
10607 | $rtfeldman$elm_css$VirtualDom$Styled$Attribute, | ||
10608 | A2($elm$virtual_dom$VirtualDom$on, eventName, handler), | ||
10609 | _List_Nil, | ||
10610 | ''); | ||
10611 | }); | ||
10612 | var $rtfeldman$elm_css$Html$Styled$Events$on = F2( | ||
10613 | function (event, decoder) { | ||
10614 | return A2( | ||
10615 | $rtfeldman$elm_css$VirtualDom$Styled$on, | ||
10616 | event, | ||
10617 | $elm$virtual_dom$VirtualDom$Normal(decoder)); | ||
10618 | }); | ||
10619 | var $rtfeldman$elm_css$Html$Styled$Events$onClick = function (msg) { | ||
10620 | return A2( | ||
10621 | $rtfeldman$elm_css$Html$Styled$Events$on, | ||
10622 | 'click', | ||
10623 | $elm$json$Json$Decode$succeed(msg)); | ||
10624 | }; | ||
10625 | var $rtfeldman$elm_css$Css$paddingBottom = $rtfeldman$elm_css$Css$prop1('padding-bottom'); | ||
10626 | var $rtfeldman$elm_css$Css$paddingTop = $rtfeldman$elm_css$Css$prop1('padding-top'); | ||
10627 | var $rtfeldman$elm_css$VirtualDom$Styled$text = function (str) { | ||
10628 | return $rtfeldman$elm_css$VirtualDom$Styled$Unstyled( | ||
10629 | $elm$virtual_dom$VirtualDom$text(str)); | ||
10630 | }; | ||
10631 | var $rtfeldman$elm_css$Html$Styled$text = $rtfeldman$elm_css$VirtualDom$Styled$text; | ||
10632 | var $rtfeldman$elm_css$Css$Preprocess$ApplyStyles = function (a) { | ||
10633 | return {$: 'ApplyStyles', a: a}; | ||
10634 | }; | ||
10635 | var $rtfeldman$elm_css$Css$Internal$property = F2( | ||
10636 | function (key, value) { | ||
10637 | return $rtfeldman$elm_css$Css$Preprocess$AppendProperty(key + (':' + value)); | ||
10638 | }); | ||
10639 | var $rtfeldman$elm_css$Css$Internal$getOverloadedProperty = F3( | ||
10640 | function (functionName, desiredKey, style) { | ||
10641 | getOverloadedProperty: | ||
10642 | while (true) { | ||
10643 | switch (style.$) { | ||
10644 | case 'AppendProperty': | ||
10645 | var str = style.a; | ||
10646 | var key = A2( | ||
10647 | $elm$core$Maybe$withDefault, | ||
10648 | '', | ||
10649 | $elm$core$List$head( | ||
10650 | A2($elm$core$String$split, ':', str))); | ||
10651 | return A2($rtfeldman$elm_css$Css$Internal$property, desiredKey, key); | ||
10652 | case 'ExtendSelector': | ||
10653 | var selector = style.a; | ||
10654 | return A2($rtfeldman$elm_css$Css$Internal$property, desiredKey, 'elm-css-error-cannot-apply-' + (functionName + '-with-inapplicable-Style-for-selector')); | ||
10655 | case 'NestSnippet': | ||
10656 | var combinator = style.a; | ||
10657 | return A2($rtfeldman$elm_css$Css$Internal$property, desiredKey, 'elm-css-error-cannot-apply-' + (functionName + '-with-inapplicable-Style-for-combinator')); | ||
10658 | case 'WithPseudoElement': | ||
10659 | var pseudoElement = style.a; | ||
10660 | return A2($rtfeldman$elm_css$Css$Internal$property, desiredKey, 'elm-css-error-cannot-apply-' + (functionName + '-with-inapplicable-Style-for-pseudo-element setter')); | ||
10661 | case 'WithMedia': | ||
10662 | return A2($rtfeldman$elm_css$Css$Internal$property, desiredKey, 'elm-css-error-cannot-apply-' + (functionName + '-with-inapplicable-Style-for-media-query')); | ||
10663 | case 'WithKeyframes': | ||
10664 | return A2($rtfeldman$elm_css$Css$Internal$property, desiredKey, 'elm-css-error-cannot-apply-' + (functionName + '-with-inapplicable-Style-for-keyframes')); | ||
10665 | default: | ||
10666 | if (!style.a.b) { | ||
10667 | return A2($rtfeldman$elm_css$Css$Internal$property, desiredKey, 'elm-css-error-cannot-apply-' + (functionName + '-with-empty-Style')); | ||
10668 | } else { | ||
10669 | if (!style.a.b.b) { | ||
10670 | var _v1 = style.a; | ||
10671 | var only = _v1.a; | ||
10672 | var $temp$functionName = functionName, | ||
10673 | $temp$desiredKey = desiredKey, | ||
10674 | $temp$style = only; | ||
10675 | functionName = $temp$functionName; | ||
10676 | desiredKey = $temp$desiredKey; | ||
10677 | style = $temp$style; | ||
10678 | continue getOverloadedProperty; | ||
10679 | } else { | ||
10680 | var _v2 = style.a; | ||
10681 | var first = _v2.a; | ||
10682 | var rest = _v2.b; | ||
10683 | var $temp$functionName = functionName, | ||
10684 | $temp$desiredKey = desiredKey, | ||
10685 | $temp$style = $rtfeldman$elm_css$Css$Preprocess$ApplyStyles(rest); | ||
10686 | functionName = $temp$functionName; | ||
10687 | desiredKey = $temp$desiredKey; | ||
10688 | style = $temp$style; | ||
10689 | continue getOverloadedProperty; | ||
10690 | } | ||
10691 | } | ||
10692 | } | ||
10693 | } | ||
10694 | }); | ||
10695 | var $rtfeldman$elm_css$Css$Internal$IncompatibleUnits = {$: 'IncompatibleUnits'}; | ||
10696 | var $rtfeldman$elm_css$Css$Internal$lengthForOverloadedProperty = A3($rtfeldman$elm_css$Css$Internal$lengthConverter, $rtfeldman$elm_css$Css$Internal$IncompatibleUnits, '', 0); | ||
10697 | var $rtfeldman$elm_css$Css$textAlign = function (fn) { | ||
10698 | return A3( | ||
10699 | $rtfeldman$elm_css$Css$Internal$getOverloadedProperty, | ||
10700 | 'textAlign', | ||
10701 | 'text-align', | ||
10702 | fn($rtfeldman$elm_css$Css$Internal$lengthForOverloadedProperty)); | ||
10703 | }; | ||
10704 | var $rtfeldman$elm_css$Html$Styled$ul = $rtfeldman$elm_css$Html$Styled$node('ul'); | ||
10705 | var $author$project$Main$viewHeader = function (model) { | ||
10706 | var links = _List_fromArray( | ||
10707 | [ | ||
10708 | _Utils_Tuple2('Catalog', '/catalog'), | ||
10709 | _Utils_Tuple2('Cart', '/cart') | ||
10710 | ]); | ||
10711 | return A2( | ||
10712 | $rtfeldman$elm_css$Html$Styled$div, | ||
10713 | _List_fromArray( | ||
10714 | [ | ||
10715 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
10716 | _List_fromArray( | ||
10717 | [ | ||
10718 | $rtfeldman$elm_css$Css$padding( | ||
10719 | $rtfeldman$elm_css$Css$px(40)), | ||
10720 | $rtfeldman$elm_css$Css$paddingTop( | ||
10721 | $rtfeldman$elm_css$Css$px(3)), | ||
10722 | $rtfeldman$elm_css$Css$paddingBottom( | ||
10723 | $rtfeldman$elm_css$Css$px(3)), | ||
10724 | $rtfeldman$elm_css$Css$textAlign($rtfeldman$elm_css$Css$left), | ||
10725 | $rtfeldman$elm_css$Css$backgroundColor($author$project$Styles$theme.secondary) | ||
10726 | ])) | ||
10727 | ]), | ||
10728 | _List_fromArray( | ||
10729 | [ | ||
10730 | A2( | ||
10731 | $rtfeldman$elm_css$Html$Styled$ul, | ||
10732 | _List_fromArray( | ||
10733 | [ | ||
10734 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
10735 | _List_fromArray( | ||
10736 | [ | ||
10737 | $rtfeldman$elm_css$Css$listStyle($rtfeldman$elm_css$Css$none), | ||
10738 | $rtfeldman$elm_css$Css$padding( | ||
10739 | $rtfeldman$elm_css$Css$px(0)), | ||
10740 | $rtfeldman$elm_css$Css$margin( | ||
10741 | $rtfeldman$elm_css$Css$px(24)) | ||
10742 | ])) | ||
10743 | ]), | ||
10744 | _Utils_ap( | ||
10745 | A2( | ||
10746 | $elm$core$List$map, | ||
10747 | function (_v0) { | ||
10748 | var name = _v0.a; | ||
10749 | var loc = _v0.b; | ||
10750 | return A2( | ||
10751 | $rtfeldman$elm_css$Html$Styled$li, | ||
10752 | _List_fromArray( | ||
10753 | [ | ||
10754 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
10755 | _List_fromArray( | ||
10756 | [ | ||
10757 | $rtfeldman$elm_css$Css$display($rtfeldman$elm_css$Css$inline) | ||
10758 | ])) | ||
10759 | ]), | ||
10760 | _List_fromArray( | ||
10761 | [ | ||
10762 | A2( | ||
10763 | $author$project$Styles$headerLink, | ||
10764 | _List_fromArray( | ||
10765 | [ | ||
10766 | $rtfeldman$elm_css$Html$Styled$Attributes$href(loc) | ||
10767 | ]), | ||
10768 | _List_fromArray( | ||
10769 | [ | ||
10770 | $rtfeldman$elm_css$Html$Styled$text(name) | ||
10771 | ])) | ||
10772 | ])); | ||
10773 | }, | ||
10774 | links), | ||
10775 | _List_fromArray( | ||
10776 | [ | ||
10777 | (!_Utils_eq(model.loginModel.loginStatus, $author$project$Login$LoggedIn)) ? A2( | ||
10778 | $rtfeldman$elm_css$Html$Styled$li, | ||
10779 | _List_fromArray( | ||
10780 | [ | ||
10781 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
10782 | _List_fromArray( | ||
10783 | [ | ||
10784 | $rtfeldman$elm_css$Css$display($rtfeldman$elm_css$Css$inline) | ||
10785 | ])) | ||
10786 | ]), | ||
10787 | _List_fromArray( | ||
10788 | [ | ||
10789 | A2( | ||
10790 | $author$project$Styles$headerLink, | ||
10791 | _List_fromArray( | ||
10792 | [ | ||
10793 | $rtfeldman$elm_css$Html$Styled$Attributes$href('/login') | ||
10794 | ]), | ||
10795 | _List_fromArray( | ||
10796 | [ | ||
10797 | $rtfeldman$elm_css$Html$Styled$text('Login') | ||
10798 | ])) | ||
10799 | ])) : A2( | ||
10800 | $author$project$Styles$furbyButton, | ||
10801 | _List_fromArray( | ||
10802 | [ | ||
10803 | $rtfeldman$elm_css$Html$Styled$Events$onClick($author$project$Main$LogoutPressed) | ||
10804 | ]), | ||
10805 | _List_fromArray( | ||
10806 | [ | ||
10807 | $rtfeldman$elm_css$Html$Styled$text('Logout') | ||
10808 | ])) | ||
10809 | ]))) | ||
10810 | ])); | ||
10811 | }; | ||
10812 | var $author$project$Main$pageWrap = F2( | ||
10813 | function (model, page) { | ||
10814 | return $elm$core$List$singleton( | ||
10815 | $rtfeldman$elm_css$Html$Styled$toUnstyled( | ||
10816 | A2( | ||
10817 | $rtfeldman$elm_css$Html$Styled$div, | ||
10818 | _List_Nil, | ||
10819 | _List_fromArray( | ||
10820 | [ | ||
10821 | $author$project$Main$viewHeader(model), | ||
10822 | page | ||
10823 | ])))); | ||
10824 | }); | ||
10825 | var $author$project$Cart$calculateTotal = function (model) { | ||
10826 | var items = model.products; | ||
10827 | return A3( | ||
10828 | $elm$core$List$foldl, | ||
10829 | $elm$core$Basics$add, | ||
10830 | 0, | ||
10831 | A2( | ||
10832 | $elm$core$List$map, | ||
10833 | function (i) { | ||
10834 | return i.quantity * i.productItem.price; | ||
10835 | }, | ||
10836 | items)); | ||
10837 | }; | ||
10838 | var $author$project$Cart$AddToCartPressed = function (a) { | ||
10839 | return {$: 'AddToCartPressed', a: a}; | ||
10840 | }; | ||
10841 | var $author$project$Cart$RemoveFromCart = function (a) { | ||
10842 | return {$: 'RemoveFromCart', a: a}; | ||
10843 | }; | ||
10844 | var $author$project$Cart$viewCartItemListing = function (listing) { | ||
10845 | return A2( | ||
10846 | $rtfeldman$elm_css$Html$Styled$div, | ||
10847 | _List_Nil, | ||
10848 | _List_fromArray( | ||
10849 | [ | ||
10850 | $rtfeldman$elm_css$Html$Styled$text(listing.productItem.name), | ||
10851 | A2( | ||
10852 | $rtfeldman$elm_css$Html$Styled$div, | ||
10853 | _List_Nil, | ||
10854 | _List_fromArray( | ||
10855 | [ | ||
10856 | $rtfeldman$elm_css$Html$Styled$text( | ||
10857 | A2($elm$core$Maybe$withDefault, '', listing.productItem.kind)) | ||
10858 | ])), | ||
10859 | A2( | ||
10860 | $rtfeldman$elm_css$Html$Styled$div, | ||
10861 | _List_Nil, | ||
10862 | _List_fromArray( | ||
10863 | [ | ||
10864 | $rtfeldman$elm_css$Html$Styled$text( | ||
10865 | A2($elm$core$Maybe$withDefault, '', listing.productItem.description)) | ||
10866 | ])), | ||
10867 | A2( | ||
10868 | $rtfeldman$elm_css$Html$Styled$div, | ||
10869 | _List_Nil, | ||
10870 | _List_fromArray( | ||
10871 | [ | ||
10872 | $rtfeldman$elm_css$Html$Styled$text( | ||
10873 | $elm$core$String$fromFloat(listing.productItem.price)) | ||
10874 | ])), | ||
10875 | A2( | ||
10876 | $rtfeldman$elm_css$Html$Styled$div, | ||
10877 | _List_Nil, | ||
10878 | _List_fromArray( | ||
10879 | [ | ||
10880 | $rtfeldman$elm_css$Html$Styled$text( | ||
10881 | $elm$core$String$fromInt(listing.quantity)) | ||
10882 | ])), | ||
10883 | A2( | ||
10884 | $rtfeldman$elm_css$Html$Styled$div, | ||
10885 | _List_Nil, | ||
10886 | _List_fromArray( | ||
10887 | [ | ||
10888 | A2( | ||
10889 | $rtfeldman$elm_css$Html$Styled$button, | ||
10890 | _List_fromArray( | ||
10891 | [ | ||
10892 | $rtfeldman$elm_css$Html$Styled$Events$onClick( | ||
10893 | $author$project$Cart$AddToCartPressed(listing.productItem.id)) | ||
10894 | ]), | ||
10895 | _List_fromArray( | ||
10896 | [ | ||
10897 | $rtfeldman$elm_css$Html$Styled$text('Add') | ||
10898 | ])) | ||
10899 | ])), | ||
10900 | A2( | ||
10901 | $rtfeldman$elm_css$Html$Styled$div, | ||
10902 | _List_Nil, | ||
10903 | _List_fromArray( | ||
10904 | [ | ||
10905 | A2( | ||
10906 | $rtfeldman$elm_css$Html$Styled$button, | ||
10907 | _List_fromArray( | ||
10908 | [ | ||
10909 | $rtfeldman$elm_css$Html$Styled$Events$onClick( | ||
10910 | $author$project$Cart$RemoveFromCart(listing.productItem.id)) | ||
10911 | ]), | ||
10912 | _List_fromArray( | ||
10913 | [ | ||
10914 | $rtfeldman$elm_css$Html$Styled$text('Remove') | ||
10915 | ])) | ||
10916 | ])), | ||
10917 | A2( | ||
10918 | $rtfeldman$elm_css$Html$Styled$div, | ||
10919 | _List_Nil, | ||
10920 | _List_fromArray( | ||
10921 | [ | ||
10922 | A2( | ||
10923 | $rtfeldman$elm_css$Html$Styled$a, | ||
10924 | _List_fromArray( | ||
10925 | [ | ||
10926 | $rtfeldman$elm_css$Html$Styled$Attributes$href( | ||
10927 | '/product/' + $elm$core$String$fromInt(listing.productItem.id)) | ||
10928 | ]), | ||
10929 | _List_fromArray( | ||
10930 | [ | ||
10931 | $rtfeldman$elm_css$Html$Styled$text('View Product') | ||
10932 | ])) | ||
10933 | ])) | ||
10934 | ])); | ||
10935 | }; | ||
10936 | var $author$project$Cart$viewStatus = function (s) { | ||
10937 | switch (s.$) { | ||
10938 | case 'Loading': | ||
10939 | return 'Loading'; | ||
10940 | case 'Loaded': | ||
10941 | return 'Ready!'; | ||
10942 | default: | ||
10943 | return 'Not loaded ...'; | ||
10944 | } | ||
10945 | }; | ||
10946 | var $author$project$Cart$view = function (model) { | ||
10947 | var _v0 = model.pageStatus; | ||
10948 | if (_v0.$ === 'Loading') { | ||
10949 | return A2( | ||
10950 | $rtfeldman$elm_css$Html$Styled$div, | ||
10951 | _List_Nil, | ||
10952 | _List_fromArray( | ||
10953 | [ | ||
10954 | $rtfeldman$elm_css$Html$Styled$text( | ||
10955 | $author$project$Cart$viewStatus($author$project$Cart$Loading)) | ||
10956 | ])); | ||
10957 | } else { | ||
10958 | return A2( | ||
10959 | $rtfeldman$elm_css$Html$Styled$div, | ||
10960 | _List_Nil, | ||
10961 | _List_fromArray( | ||
10962 | [ | ||
10963 | function () { | ||
10964 | var cart = A2($elm$core$List$map, $author$project$Cart$viewCartItemListing, model.products); | ||
10965 | return $elm$core$List$isEmpty(cart) ? $rtfeldman$elm_css$Html$Styled$text('No items in cart') : A2($rtfeldman$elm_css$Html$Styled$ul, _List_Nil, cart); | ||
10966 | }(), | ||
10967 | $rtfeldman$elm_css$Html$Styled$text( | ||
10968 | $elm$core$String$fromFloat( | ||
10969 | $author$project$Cart$calculateTotal(model))), | ||
10970 | A2( | ||
10971 | $rtfeldman$elm_css$Html$Styled$a, | ||
10972 | _List_fromArray( | ||
10973 | [ | ||
10974 | $rtfeldman$elm_css$Html$Styled$Attributes$href('/checkout') | ||
10975 | ]), | ||
10976 | _List_fromArray( | ||
10977 | [ | ||
10978 | $rtfeldman$elm_css$Html$Styled$text('Checkout') | ||
10979 | ])) | ||
10980 | ])); | ||
10981 | } | ||
10982 | }; | ||
10983 | var $rtfeldman$elm_css$Css$fontSize = $rtfeldman$elm_css$Css$prop1('font-size'); | ||
10984 | var $author$project$Styles$bigHeading = $rtfeldman$elm_css$Css$fontSize( | ||
10985 | $rtfeldman$elm_css$Css$px(24)); | ||
10986 | var $elm$core$Basics$ge = _Utils_ge; | ||
10987 | var $author$project$Utils$between = F2( | ||
10988 | function (_v0, v) { | ||
10989 | var l = _v0.a; | ||
10990 | var u = _v0.b; | ||
10991 | return (_Utils_cmp(v, l) > -1) && (_Utils_cmp(v, u) < 1); | ||
10992 | }); | ||
10993 | var $author$project$Catalog$filterProducts = function (model) { | ||
10994 | return A2( | ||
10995 | $elm$core$List$filter, | ||
10996 | function (p) { | ||
10997 | return A2( | ||
10998 | $author$project$Utils$between, | ||
10999 | model.filters.rating, | ||
11000 | A2($elm$core$Maybe$withDefault, 5.0, p.averageRating)); | ||
11001 | }, | ||
11002 | A2( | ||
11003 | $elm$core$List$filter, | ||
11004 | A2( | ||
11005 | $elm$core$Basics$composeL, | ||
11006 | $author$project$Utils$between(model.filters.price), | ||
11007 | function ($) { | ||
11008 | return $.price; | ||
11009 | }), | ||
11010 | model.products)); | ||
11011 | }; | ||
11012 | var $rtfeldman$elm_css$Css$float = function (fn) { | ||
11013 | return A3( | ||
11014 | $rtfeldman$elm_css$Css$Internal$getOverloadedProperty, | ||
11015 | 'float', | ||
11016 | 'float', | ||
11017 | fn($rtfeldman$elm_css$Css$Internal$lengthForOverloadedProperty)); | ||
11018 | }; | ||
11019 | var $rtfeldman$elm_css$Css$PercentageUnits = {$: 'PercentageUnits'}; | ||
11020 | var $rtfeldman$elm_css$Css$pct = A2($rtfeldman$elm_css$Css$Internal$lengthConverter, $rtfeldman$elm_css$Css$PercentageUnits, '%'); | ||
11021 | var $author$project$Catalog$ChangePriceLower = function (a) { | ||
11022 | return {$: 'ChangePriceLower', a: a}; | ||
11023 | }; | ||
11024 | var $author$project$Catalog$ChangePriceUpper = function (a) { | ||
11025 | return {$: 'ChangePriceUpper', a: a}; | ||
11026 | }; | ||
11027 | var $author$project$Catalog$ChangeRatingLower = function (a) { | ||
11028 | return {$: 'ChangeRatingLower', a: a}; | ||
11029 | }; | ||
11030 | var $author$project$Catalog$ChangeRatingUpper = function (a) { | ||
11031 | return {$: 'ChangeRatingUpper', a: a}; | ||
11032 | }; | ||
11033 | var $rtfeldman$elm_css$Css$prop3 = F4( | ||
11034 | function (key, argA, argB, argC) { | ||
11035 | return A2( | ||
11036 | $rtfeldman$elm_css$Css$property, | ||
11037 | key, | ||
11038 | A2( | ||
11039 | $elm$core$String$join, | ||
11040 | ' ', | ||
11041 | _List_fromArray( | ||
11042 | [argA.value, argB.value, argC.value]))); | ||
11043 | }); | ||
11044 | var $rtfeldman$elm_css$Css$borderBottom3 = $rtfeldman$elm_css$Css$prop3('border-bottom'); | ||
11045 | var $rtfeldman$elm_css$Css$right = $rtfeldman$elm_css$Css$prop1('right'); | ||
11046 | var $rtfeldman$elm_css$Html$Styled$select = $rtfeldman$elm_css$Html$Styled$node('select'); | ||
11047 | var $rtfeldman$elm_css$Css$solid = {borderStyle: $rtfeldman$elm_css$Css$Structure$Compatible, textDecorationStyle: $rtfeldman$elm_css$Css$Structure$Compatible, value: 'solid'}; | ||
11048 | var $author$project$Styles$furbySelect = A2( | ||
11049 | $rtfeldman$elm_css$Html$Styled$styled, | ||
11050 | $rtfeldman$elm_css$Html$Styled$select, | ||
11051 | _List_fromArray( | ||
11052 | [ | ||
11053 | $rtfeldman$elm_css$Css$margin( | ||
11054 | $rtfeldman$elm_css$Css$px(6)), | ||
11055 | $rtfeldman$elm_css$Css$color($author$project$Styles$theme.fg), | ||
11056 | $rtfeldman$elm_css$Css$border( | ||
11057 | $rtfeldman$elm_css$Css$px(0)), | ||
11058 | A3( | ||
11059 | $rtfeldman$elm_css$Css$borderBottom3, | ||
11060 | $rtfeldman$elm_css$Css$px(2), | ||
11061 | $rtfeldman$elm_css$Css$solid, | ||
11062 | $author$project$Styles$theme.bgLight), | ||
11063 | $rtfeldman$elm_css$Css$textAlign($rtfeldman$elm_css$Css$right), | ||
11064 | A2( | ||
11065 | $rtfeldman$elm_css$Css$padding2, | ||
11066 | $rtfeldman$elm_css$Css$px(3), | ||
11067 | $rtfeldman$elm_css$Css$px(3)), | ||
11068 | $rtfeldman$elm_css$Css$backgroundColor($author$project$Styles$theme.bg), | ||
11069 | $rtfeldman$elm_css$Css$hover( | ||
11070 | _List_fromArray( | ||
11071 | [ | ||
11072 | A3( | ||
11073 | $rtfeldman$elm_css$Css$borderBottom3, | ||
11074 | $rtfeldman$elm_css$Css$px(2), | ||
11075 | $rtfeldman$elm_css$Css$solid, | ||
11076 | $author$project$Styles$theme.fg) | ||
11077 | ])) | ||
11078 | ])); | ||
11079 | var $rtfeldman$elm_css$Html$Styled$Events$alwaysStop = function (x) { | ||
11080 | return _Utils_Tuple2(x, true); | ||
11081 | }; | ||
11082 | var $elm$virtual_dom$VirtualDom$MayStopPropagation = function (a) { | ||
11083 | return {$: 'MayStopPropagation', a: a}; | ||
11084 | }; | ||
11085 | var $rtfeldman$elm_css$Html$Styled$Events$stopPropagationOn = F2( | ||
11086 | function (event, decoder) { | ||
11087 | return A2( | ||
11088 | $rtfeldman$elm_css$VirtualDom$Styled$on, | ||
11089 | event, | ||
11090 | $elm$virtual_dom$VirtualDom$MayStopPropagation(decoder)); | ||
11091 | }); | ||
11092 | var $elm$json$Json$Decode$at = F2( | ||
11093 | function (fields, decoder) { | ||
11094 | return A3($elm$core$List$foldr, $elm$json$Json$Decode$field, decoder, fields); | ||
11095 | }); | ||
11096 | var $rtfeldman$elm_css$Html$Styled$Events$targetValue = A2( | ||
11097 | $elm$json$Json$Decode$at, | ||
11098 | _List_fromArray( | ||
11099 | ['target', 'value']), | ||
11100 | $elm$json$Json$Decode$string); | ||
11101 | var $rtfeldman$elm_css$Html$Styled$Events$onInput = function (tagger) { | ||
11102 | return A2( | ||
11103 | $rtfeldman$elm_css$Html$Styled$Events$stopPropagationOn, | ||
11104 | 'input', | ||
11105 | A2( | ||
11106 | $elm$json$Json$Decode$map, | ||
11107 | $rtfeldman$elm_css$Html$Styled$Events$alwaysStop, | ||
11108 | A2($elm$json$Json$Decode$map, tagger, $rtfeldman$elm_css$Html$Styled$Events$targetValue))); | ||
11109 | }; | ||
11110 | var $rtfeldman$elm_css$Html$Styled$option = $rtfeldman$elm_css$Html$Styled$node('option'); | ||
11111 | var $author$project$Utils$range = F3( | ||
11112 | function (start, stop, step) { | ||
11113 | return (_Utils_cmp(start, stop) > -1) ? _List_Nil : A2( | ||
11114 | $elm$core$List$cons, | ||
11115 | start, | ||
11116 | A3($author$project$Utils$range, start + step, stop, step)); | ||
11117 | }); | ||
11118 | var $elm$json$Json$Encode$bool = _Json_wrap; | ||
11119 | var $rtfeldman$elm_css$Html$Styled$Attributes$boolProperty = F2( | ||
11120 | function (key, bool) { | ||
11121 | return A2( | ||
11122 | $rtfeldman$elm_css$VirtualDom$Styled$property, | ||
11123 | key, | ||
11124 | $elm$json$Json$Encode$bool(bool)); | ||
11125 | }); | ||
11126 | var $rtfeldman$elm_css$Html$Styled$Attributes$selected = $rtfeldman$elm_css$Html$Styled$Attributes$boolProperty('selected'); | ||
11127 | var $elm$virtual_dom$VirtualDom$style = _VirtualDom_style; | ||
11128 | var $rtfeldman$elm_css$VirtualDom$Styled$style = F2( | ||
11129 | function (key, val) { | ||
11130 | return A3( | ||
11131 | $rtfeldman$elm_css$VirtualDom$Styled$Attribute, | ||
11132 | A2($elm$virtual_dom$VirtualDom$style, key, val), | ||
11133 | _List_Nil, | ||
11134 | ''); | ||
11135 | }); | ||
11136 | var $rtfeldman$elm_css$Html$Styled$Attributes$style = $rtfeldman$elm_css$VirtualDom$Styled$style; | ||
11137 | var $elm$core$String$toFloat = _String_toFloat; | ||
11138 | var $author$project$Catalog$viewFilters = function (model) { | ||
11139 | var viewRange = F2( | ||
11140 | function (_default, scale) { | ||
11141 | return A2( | ||
11142 | $elm$core$List$map, | ||
11143 | function (i) { | ||
11144 | return A2( | ||
11145 | $rtfeldman$elm_css$Html$Styled$option, | ||
11146 | _List_fromArray( | ||
11147 | [ | ||
11148 | $rtfeldman$elm_css$Html$Styled$Attributes$selected( | ||
11149 | _Utils_eq(i, _default)) | ||
11150 | ]), | ||
11151 | _List_fromArray( | ||
11152 | [ | ||
11153 | $rtfeldman$elm_css$Html$Styled$text( | ||
11154 | $elm$core$String$fromInt(i)) | ||
11155 | ])); | ||
11156 | }, | ||
11157 | scale); | ||
11158 | }); | ||
11159 | var ratingRange = A3($author$project$Utils$range, 1, 6, 1); | ||
11160 | var priceRange = A3($author$project$Utils$range, 0, 55000, 5000); | ||
11161 | var inp = A2( | ||
11162 | $elm$core$Basics$composeL, | ||
11163 | $elm$core$Maybe$withDefault(0), | ||
11164 | $elm$core$String$toFloat); | ||
11165 | return A2( | ||
11166 | $rtfeldman$elm_css$Html$Styled$div, | ||
11167 | _List_Nil, | ||
11168 | _List_fromArray( | ||
11169 | [ | ||
11170 | A2( | ||
11171 | $rtfeldman$elm_css$Html$Styled$div, | ||
11172 | _List_fromArray( | ||
11173 | [ | ||
11174 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11175 | _List_fromArray( | ||
11176 | [ | ||
11177 | $author$project$Styles$bigHeading, | ||
11178 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11179 | $rtfeldman$elm_css$Css$px(12)) | ||
11180 | ])) | ||
11181 | ]), | ||
11182 | _List_fromArray( | ||
11183 | [ | ||
11184 | $rtfeldman$elm_css$Html$Styled$text('Filters') | ||
11185 | ])), | ||
11186 | A2( | ||
11187 | $rtfeldman$elm_css$Html$Styled$div, | ||
11188 | _List_Nil, | ||
11189 | _List_fromArray( | ||
11190 | [ | ||
11191 | A2( | ||
11192 | $rtfeldman$elm_css$Html$Styled$div, | ||
11193 | _List_Nil, | ||
11194 | _List_fromArray( | ||
11195 | [ | ||
11196 | $rtfeldman$elm_css$Html$Styled$text('Price') | ||
11197 | ])), | ||
11198 | A2( | ||
11199 | $author$project$Styles$furbySelect, | ||
11200 | _List_fromArray( | ||
11201 | [ | ||
11202 | $rtfeldman$elm_css$Html$Styled$Events$onInput( | ||
11203 | A2($elm$core$Basics$composeL, $author$project$Catalog$ChangePriceLower, inp)), | ||
11204 | A2($rtfeldman$elm_css$Html$Styled$Attributes$style, 'appearance', 'none') | ||
11205 | ]), | ||
11206 | A2(viewRange, 0, priceRange)), | ||
11207 | $rtfeldman$elm_css$Html$Styled$text('to'), | ||
11208 | A2( | ||
11209 | $author$project$Styles$furbySelect, | ||
11210 | _List_fromArray( | ||
11211 | [ | ||
11212 | $rtfeldman$elm_css$Html$Styled$Events$onInput( | ||
11213 | A2($elm$core$Basics$composeL, $author$project$Catalog$ChangePriceUpper, inp)), | ||
11214 | A2($rtfeldman$elm_css$Html$Styled$Attributes$style, 'appearance', 'none') | ||
11215 | ]), | ||
11216 | A2(viewRange, 50000, priceRange)) | ||
11217 | ])), | ||
11218 | A2( | ||
11219 | $rtfeldman$elm_css$Html$Styled$div, | ||
11220 | _List_Nil, | ||
11221 | _List_fromArray( | ||
11222 | [ | ||
11223 | A2( | ||
11224 | $rtfeldman$elm_css$Html$Styled$div, | ||
11225 | _List_Nil, | ||
11226 | _List_fromArray( | ||
11227 | [ | ||
11228 | $rtfeldman$elm_css$Html$Styled$text('Rating') | ||
11229 | ])), | ||
11230 | A2( | ||
11231 | $author$project$Styles$furbySelect, | ||
11232 | _List_fromArray( | ||
11233 | [ | ||
11234 | $rtfeldman$elm_css$Html$Styled$Events$onInput( | ||
11235 | A2($elm$core$Basics$composeL, $author$project$Catalog$ChangeRatingLower, inp)), | ||
11236 | A2($rtfeldman$elm_css$Html$Styled$Attributes$style, 'appearance', 'none') | ||
11237 | ]), | ||
11238 | A2(viewRange, 1, ratingRange)), | ||
11239 | $rtfeldman$elm_css$Html$Styled$text('to'), | ||
11240 | A2( | ||
11241 | $author$project$Styles$furbySelect, | ||
11242 | _List_fromArray( | ||
11243 | [ | ||
11244 | $rtfeldman$elm_css$Html$Styled$Events$onInput( | ||
11245 | A2($elm$core$Basics$composeL, $author$project$Catalog$ChangeRatingUpper, inp)), | ||
11246 | A2($rtfeldman$elm_css$Html$Styled$Attributes$style, 'appearance', 'none') | ||
11247 | ]), | ||
11248 | A2(viewRange, 5, ratingRange)) | ||
11249 | ])) | ||
11250 | ])); | ||
11251 | }; | ||
11252 | var $elm$virtual_dom$VirtualDom$attribute = F2( | ||
11253 | function (key, value) { | ||
11254 | return A2( | ||
11255 | _VirtualDom_attribute, | ||
11256 | _VirtualDom_noOnOrFormAction(key), | ||
11257 | _VirtualDom_noJavaScriptOrHtmlUri(value)); | ||
11258 | }); | ||
11259 | var $rtfeldman$elm_css$VirtualDom$Styled$attribute = F2( | ||
11260 | function (key, value) { | ||
11261 | return A3( | ||
11262 | $rtfeldman$elm_css$VirtualDom$Styled$Attribute, | ||
11263 | A2($elm$virtual_dom$VirtualDom$attribute, key, value), | ||
11264 | _List_Nil, | ||
11265 | ''); | ||
11266 | }); | ||
11267 | var $rtfeldman$elm_css$Html$Styled$Attributes$attribute = $rtfeldman$elm_css$VirtualDom$Styled$attribute; | ||
11268 | var $author$project$Utils$arIosSrc = function (src) { | ||
11269 | return A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'ios-src', src); | ||
11270 | }; | ||
11271 | var $author$project$Utils$arModes = function (mode) { | ||
11272 | return A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'ar-modes', mode); | ||
11273 | }; | ||
11274 | var $author$project$Utils$arSrc = function (src) { | ||
11275 | return A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'src', src); | ||
11276 | }; | ||
11277 | var $author$project$Utils$autoRotate = A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'auto-rotate', ''); | ||
11278 | var $rtfeldman$elm_css$Css$bold = {fontWeight: $rtfeldman$elm_css$Css$Structure$Compatible, value: 'bold'}; | ||
11279 | var $rtfeldman$elm_css$Css$border3 = $rtfeldman$elm_css$Css$prop3('border'); | ||
11280 | var $author$project$Utils$cameraControls = A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'camera-controls', ''); | ||
11281 | var $author$project$Styles$cardPrimaryText = $rtfeldman$elm_css$Css$fontSize( | ||
11282 | $rtfeldman$elm_css$Css$px(18)); | ||
11283 | var $rtfeldman$elm_css$Css$batch = $rtfeldman$elm_css$Css$Preprocess$ApplyStyles; | ||
11284 | var $author$project$Styles$cardSecondaryText = $rtfeldman$elm_css$Css$batch( | ||
11285 | _List_fromArray( | ||
11286 | [ | ||
11287 | $rtfeldman$elm_css$Css$color($author$project$Styles$theme.fgLight), | ||
11288 | $rtfeldman$elm_css$Css$fontSize( | ||
11289 | $rtfeldman$elm_css$Css$px(12)) | ||
11290 | ])); | ||
11291 | var $author$project$Styles$cardSupportingText = $rtfeldman$elm_css$Css$fontSize( | ||
11292 | $rtfeldman$elm_css$Css$px(16)); | ||
11293 | var $rtfeldman$elm_css$Css$fontVariant = $rtfeldman$elm_css$Css$prop1('font-variant'); | ||
11294 | var $rtfeldman$elm_css$Css$fontWeight = function (_v0) { | ||
11295 | var value = _v0.value; | ||
11296 | return A2($rtfeldman$elm_css$Css$property, 'font-weight', value); | ||
11297 | }; | ||
11298 | var $author$project$Utils$loading = function (mode) { | ||
11299 | return A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'loading', mode); | ||
11300 | }; | ||
11301 | var $rtfeldman$elm_css$Css$marginBottom = $rtfeldman$elm_css$Css$prop1('margin-bottom'); | ||
11302 | var $rtfeldman$elm_css$Css$maxWidth = $rtfeldman$elm_css$Css$prop1('max-width'); | ||
11303 | var $author$project$Utils$modelViewer = F2( | ||
11304 | function (attributes, children) { | ||
11305 | return A3($rtfeldman$elm_css$Html$Styled$node, 'model-viewer', attributes, children); | ||
11306 | }); | ||
11307 | var $rtfeldman$elm_css$Css$Structure$PseudoElement = function (a) { | ||
11308 | return {$: 'PseudoElement', a: a}; | ||
11309 | }; | ||
11310 | var $rtfeldman$elm_css$Css$Preprocess$WithPseudoElement = F2( | ||
11311 | function (a, b) { | ||
11312 | return {$: 'WithPseudoElement', a: a, b: b}; | ||
11313 | }); | ||
11314 | var $rtfeldman$elm_css$Css$pseudoElement = function (element) { | ||
11315 | return $rtfeldman$elm_css$Css$Preprocess$WithPseudoElement( | ||
11316 | $rtfeldman$elm_css$Css$Structure$PseudoElement(element)); | ||
11317 | }; | ||
11318 | var $rtfeldman$elm_css$Css$before = $rtfeldman$elm_css$Css$pseudoElement('before'); | ||
11319 | var $author$project$Styles$money = $rtfeldman$elm_css$Css$before( | ||
11320 | _List_fromArray( | ||
11321 | [ | ||
11322 | A2($rtfeldman$elm_css$Css$property, 'content', '\"₹ \"') | ||
11323 | ])); | ||
11324 | var $rtfeldman$elm_css$Css$smallCaps = {fontVariant: $rtfeldman$elm_css$Css$Structure$Compatible, fontVariantCaps: $rtfeldman$elm_css$Css$Structure$Compatible, value: 'small-caps'}; | ||
11325 | var $rtfeldman$elm_css$Css$width = $rtfeldman$elm_css$Css$prop1('width'); | ||
11326 | var $author$project$Catalog$viewProduct = function (p) { | ||
11327 | return A2( | ||
11328 | $rtfeldman$elm_css$Html$Styled$div, | ||
11329 | _List_fromArray( | ||
11330 | [ | ||
11331 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11332 | _List_fromArray( | ||
11333 | [ | ||
11334 | $rtfeldman$elm_css$Css$marginBottom( | ||
11335 | $rtfeldman$elm_css$Css$px(20)), | ||
11336 | A3( | ||
11337 | $rtfeldman$elm_css$Css$border3, | ||
11338 | $rtfeldman$elm_css$Css$px(1), | ||
11339 | $rtfeldman$elm_css$Css$solid, | ||
11340 | $author$project$Styles$theme.primary), | ||
11341 | $rtfeldman$elm_css$Css$borderRadius( | ||
11342 | $rtfeldman$elm_css$Css$px(4)), | ||
11343 | $rtfeldman$elm_css$Css$padding( | ||
11344 | $rtfeldman$elm_css$Css$px(20)), | ||
11345 | $rtfeldman$elm_css$Css$width( | ||
11346 | $rtfeldman$elm_css$Css$pct(100)), | ||
11347 | $rtfeldman$elm_css$Css$maxWidth( | ||
11348 | $rtfeldman$elm_css$Css$px(650)) | ||
11349 | ])) | ||
11350 | ]), | ||
11351 | _List_fromArray( | ||
11352 | [ | ||
11353 | A2( | ||
11354 | $rtfeldman$elm_css$Html$Styled$div, | ||
11355 | _List_fromArray( | ||
11356 | [ | ||
11357 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11358 | _List_fromArray( | ||
11359 | [ | ||
11360 | $rtfeldman$elm_css$Css$float($rtfeldman$elm_css$Css$left), | ||
11361 | $rtfeldman$elm_css$Css$width( | ||
11362 | $rtfeldman$elm_css$Css$pct(50)) | ||
11363 | ])) | ||
11364 | ]), | ||
11365 | _List_fromArray( | ||
11366 | [ | ||
11367 | A2( | ||
11368 | $author$project$Utils$modelViewer, | ||
11369 | _List_fromArray( | ||
11370 | [ | ||
11371 | $author$project$Utils$cameraControls, | ||
11372 | $author$project$Utils$autoRotate, | ||
11373 | $author$project$Utils$arSrc(p.src), | ||
11374 | $author$project$Utils$arIosSrc(p.iosSrc), | ||
11375 | $author$project$Utils$loading('eager'), | ||
11376 | $author$project$Utils$arModes('webxr') | ||
11377 | ]), | ||
11378 | _List_Nil) | ||
11379 | ])), | ||
11380 | A2( | ||
11381 | $rtfeldman$elm_css$Html$Styled$div, | ||
11382 | _List_fromArray( | ||
11383 | [ | ||
11384 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11385 | _List_fromArray( | ||
11386 | [ | ||
11387 | $rtfeldman$elm_css$Css$float($rtfeldman$elm_css$Css$left), | ||
11388 | $rtfeldman$elm_css$Css$width( | ||
11389 | $rtfeldman$elm_css$Css$pct(50)) | ||
11390 | ])) | ||
11391 | ]), | ||
11392 | _List_fromArray( | ||
11393 | [ | ||
11394 | A2( | ||
11395 | $rtfeldman$elm_css$Html$Styled$div, | ||
11396 | _List_fromArray( | ||
11397 | [ | ||
11398 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11399 | _List_fromArray( | ||
11400 | [ | ||
11401 | $author$project$Styles$cardSecondaryText, | ||
11402 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11403 | $rtfeldman$elm_css$Css$px(3)), | ||
11404 | $rtfeldman$elm_css$Css$fontVariant($rtfeldman$elm_css$Css$smallCaps) | ||
11405 | ])) | ||
11406 | ]), | ||
11407 | _List_fromArray( | ||
11408 | [ | ||
11409 | $rtfeldman$elm_css$Html$Styled$text( | ||
11410 | A2($elm$core$Maybe$withDefault, '', p.kind)) | ||
11411 | ])), | ||
11412 | A2( | ||
11413 | $rtfeldman$elm_css$Html$Styled$div, | ||
11414 | _List_fromArray( | ||
11415 | [ | ||
11416 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11417 | _List_fromArray( | ||
11418 | [ | ||
11419 | $author$project$Styles$cardPrimaryText, | ||
11420 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11421 | $rtfeldman$elm_css$Css$px(3)) | ||
11422 | ])) | ||
11423 | ]), | ||
11424 | _List_fromArray( | ||
11425 | [ | ||
11426 | A2( | ||
11427 | $rtfeldman$elm_css$Html$Styled$a, | ||
11428 | _List_fromArray( | ||
11429 | [ | ||
11430 | $rtfeldman$elm_css$Html$Styled$Attributes$href( | ||
11431 | '/product/' + $elm$core$String$fromInt(p.id)) | ||
11432 | ]), | ||
11433 | _List_fromArray( | ||
11434 | [ | ||
11435 | $rtfeldman$elm_css$Html$Styled$text(p.name) | ||
11436 | ])) | ||
11437 | ])), | ||
11438 | A2( | ||
11439 | $rtfeldman$elm_css$Html$Styled$div, | ||
11440 | _List_fromArray( | ||
11441 | [ | ||
11442 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11443 | _List_fromArray( | ||
11444 | [ | ||
11445 | $author$project$Styles$cardSecondaryText, | ||
11446 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11447 | $rtfeldman$elm_css$Css$px(12)) | ||
11448 | ])) | ||
11449 | ]), | ||
11450 | _List_fromArray( | ||
11451 | [ | ||
11452 | function () { | ||
11453 | var _v0 = p.averageRating; | ||
11454 | if (_v0.$ === 'Just') { | ||
11455 | var v = _v0.a; | ||
11456 | return $rtfeldman$elm_css$Html$Styled$text( | ||
11457 | 'Avg Rating: ' + $elm$core$String$fromFloat(v)); | ||
11458 | } else { | ||
11459 | return $rtfeldman$elm_css$Html$Styled$text('No Ratings'); | ||
11460 | } | ||
11461 | }() | ||
11462 | ])), | ||
11463 | A2( | ||
11464 | $rtfeldman$elm_css$Html$Styled$div, | ||
11465 | _List_fromArray( | ||
11466 | [ | ||
11467 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11468 | _List_fromArray( | ||
11469 | [ | ||
11470 | $author$project$Styles$cardSupportingText, | ||
11471 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11472 | $rtfeldman$elm_css$Css$px(6)) | ||
11473 | ])) | ||
11474 | ]), | ||
11475 | _List_fromArray( | ||
11476 | [ | ||
11477 | $rtfeldman$elm_css$Html$Styled$text( | ||
11478 | A2($elm$core$Maybe$withDefault, 'No description provided', p.description)) | ||
11479 | ])), | ||
11480 | A2( | ||
11481 | $rtfeldman$elm_css$Html$Styled$div, | ||
11482 | _List_fromArray( | ||
11483 | [ | ||
11484 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11485 | _List_fromArray( | ||
11486 | [ | ||
11487 | $rtfeldman$elm_css$Css$fontWeight($rtfeldman$elm_css$Css$bold), | ||
11488 | $rtfeldman$elm_css$Css$fontSize( | ||
11489 | $rtfeldman$elm_css$Css$px(14)), | ||
11490 | $author$project$Styles$money | ||
11491 | ])) | ||
11492 | ]), | ||
11493 | _List_fromArray( | ||
11494 | [ | ||
11495 | $rtfeldman$elm_css$Html$Styled$text( | ||
11496 | $elm$core$String$fromFloat(p.price)) | ||
11497 | ])) | ||
11498 | ])), | ||
11499 | A2( | ||
11500 | $rtfeldman$elm_css$Html$Styled$div, | ||
11501 | _List_fromArray( | ||
11502 | [ | ||
11503 | A2($rtfeldman$elm_css$Html$Styled$Attributes$style, 'clear', 'both') | ||
11504 | ]), | ||
11505 | _List_Nil) | ||
11506 | ])); | ||
11507 | }; | ||
11508 | var $author$project$Catalog$viewStatus = function (s) { | ||
11509 | switch (s.$) { | ||
11510 | case 'Loading': | ||
11511 | return 'Loading'; | ||
11512 | case 'Loaded': | ||
11513 | return 'Ready!'; | ||
11514 | default: | ||
11515 | return 'Not loaded ...'; | ||
11516 | } | ||
11517 | }; | ||
11518 | var $author$project$Catalog$view = function (model) { | ||
11519 | var _v0 = model.pageStatus; | ||
11520 | if (_v0.$ === 'Loading') { | ||
11521 | return A2( | ||
11522 | $rtfeldman$elm_css$Html$Styled$div, | ||
11523 | _List_Nil, | ||
11524 | _List_fromArray( | ||
11525 | [ | ||
11526 | $rtfeldman$elm_css$Html$Styled$text( | ||
11527 | $author$project$Catalog$viewStatus($author$project$Catalog$Loading)) | ||
11528 | ])); | ||
11529 | } else { | ||
11530 | return A2( | ||
11531 | $rtfeldman$elm_css$Html$Styled$div, | ||
11532 | _List_fromArray( | ||
11533 | [ | ||
11534 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11535 | _List_fromArray( | ||
11536 | [ | ||
11537 | $rtfeldman$elm_css$Css$padding( | ||
11538 | $rtfeldman$elm_css$Css$px(40)) | ||
11539 | ])) | ||
11540 | ]), | ||
11541 | _List_fromArray( | ||
11542 | [ | ||
11543 | A2( | ||
11544 | $rtfeldman$elm_css$Html$Styled$div, | ||
11545 | _List_fromArray( | ||
11546 | [ | ||
11547 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11548 | _List_fromArray( | ||
11549 | [ | ||
11550 | $rtfeldman$elm_css$Css$float($rtfeldman$elm_css$Css$left), | ||
11551 | $rtfeldman$elm_css$Css$width( | ||
11552 | $rtfeldman$elm_css$Css$pct(20)) | ||
11553 | ])) | ||
11554 | ]), | ||
11555 | _List_fromArray( | ||
11556 | [ | ||
11557 | $author$project$Catalog$viewFilters(model) | ||
11558 | ])), | ||
11559 | A2( | ||
11560 | $rtfeldman$elm_css$Html$Styled$div, | ||
11561 | _List_fromArray( | ||
11562 | [ | ||
11563 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11564 | _List_fromArray( | ||
11565 | [ | ||
11566 | $rtfeldman$elm_css$Css$float($rtfeldman$elm_css$Css$left), | ||
11567 | $rtfeldman$elm_css$Css$width( | ||
11568 | $rtfeldman$elm_css$Css$pct(80)) | ||
11569 | ])) | ||
11570 | ]), | ||
11571 | _List_fromArray( | ||
11572 | [ | ||
11573 | A2( | ||
11574 | $rtfeldman$elm_css$Html$Styled$div, | ||
11575 | _List_fromArray( | ||
11576 | [ | ||
11577 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11578 | _List_fromArray( | ||
11579 | [$author$project$Styles$bigHeading])) | ||
11580 | ]), | ||
11581 | _List_fromArray( | ||
11582 | [ | ||
11583 | $rtfeldman$elm_css$Html$Styled$text('Products') | ||
11584 | ])), | ||
11585 | A2( | ||
11586 | $rtfeldman$elm_css$Html$Styled$ul, | ||
11587 | _List_fromArray( | ||
11588 | [ | ||
11589 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11590 | _List_fromArray( | ||
11591 | [ | ||
11592 | $rtfeldman$elm_css$Css$padding( | ||
11593 | $rtfeldman$elm_css$Css$px(0)), | ||
11594 | $rtfeldman$elm_css$Css$listStyle($rtfeldman$elm_css$Css$none) | ||
11595 | ])) | ||
11596 | ]), | ||
11597 | A2( | ||
11598 | $elm$core$List$map, | ||
11599 | $author$project$Catalog$viewProduct, | ||
11600 | $author$project$Catalog$filterProducts(model))) | ||
11601 | ])) | ||
11602 | ])); | ||
11603 | } | ||
11604 | }; | ||
11605 | var $author$project$Checkout$CheckoutPressed = {$: 'CheckoutPressed'}; | ||
11606 | var $author$project$Checkout$PaymentModeSelected = function (a) { | ||
11607 | return {$: 'PaymentModeSelected', a: a}; | ||
11608 | }; | ||
11609 | var $author$project$Checkout$viewStatus = function (s) { | ||
11610 | switch (s.$) { | ||
11611 | case 'Loading': | ||
11612 | return 'Loading'; | ||
11613 | case 'Loaded': | ||
11614 | return 'Ready!'; | ||
11615 | default: | ||
11616 | return 'Not loaded ...'; | ||
11617 | } | ||
11618 | }; | ||
11619 | var $author$project$Checkout$view = function (model) { | ||
11620 | var _v0 = model.pageStatus; | ||
11621 | if (_v0.$ === 'Loading') { | ||
11622 | return A2( | ||
11623 | $rtfeldman$elm_css$Html$Styled$div, | ||
11624 | _List_Nil, | ||
11625 | _List_fromArray( | ||
11626 | [ | ||
11627 | $rtfeldman$elm_css$Html$Styled$text( | ||
11628 | $author$project$Checkout$viewStatus($author$project$Checkout$Loading)) | ||
11629 | ])); | ||
11630 | } else { | ||
11631 | return A2( | ||
11632 | $rtfeldman$elm_css$Html$Styled$div, | ||
11633 | _List_Nil, | ||
11634 | _List_fromArray( | ||
11635 | [ | ||
11636 | A2( | ||
11637 | $rtfeldman$elm_css$Html$Styled$div, | ||
11638 | _List_Nil, | ||
11639 | _List_fromArray( | ||
11640 | [ | ||
11641 | $rtfeldman$elm_css$Html$Styled$text( | ||
11642 | $elm$core$String$fromFloat(model.cartTotal)) | ||
11643 | ])), | ||
11644 | A2( | ||
11645 | $rtfeldman$elm_css$Html$Styled$select, | ||
11646 | _List_Nil, | ||
11647 | _List_fromArray( | ||
11648 | [ | ||
11649 | A2( | ||
11650 | $rtfeldman$elm_css$Html$Styled$option, | ||
11651 | _List_fromArray( | ||
11652 | [ | ||
11653 | $rtfeldman$elm_css$Html$Styled$Events$onInput($author$project$Checkout$PaymentModeSelected) | ||
11654 | ]), | ||
11655 | _List_fromArray( | ||
11656 | [ | ||
11657 | $rtfeldman$elm_css$Html$Styled$text('Cash') | ||
11658 | ])), | ||
11659 | A2( | ||
11660 | $rtfeldman$elm_css$Html$Styled$option, | ||
11661 | _List_fromArray( | ||
11662 | [ | ||
11663 | $rtfeldman$elm_css$Html$Styled$Events$onInput($author$project$Checkout$PaymentModeSelected) | ||
11664 | ]), | ||
11665 | _List_fromArray( | ||
11666 | [ | ||
11667 | $rtfeldman$elm_css$Html$Styled$text('Debit Card') | ||
11668 | ])), | ||
11669 | A2( | ||
11670 | $rtfeldman$elm_css$Html$Styled$option, | ||
11671 | _List_fromArray( | ||
11672 | [ | ||
11673 | $rtfeldman$elm_css$Html$Styled$Events$onInput($author$project$Checkout$PaymentModeSelected) | ||
11674 | ]), | ||
11675 | _List_fromArray( | ||
11676 | [ | ||
11677 | $rtfeldman$elm_css$Html$Styled$text('Credit Card') | ||
11678 | ])) | ||
11679 | ])), | ||
11680 | A2( | ||
11681 | $rtfeldman$elm_css$Html$Styled$div, | ||
11682 | _List_Nil, | ||
11683 | _List_fromArray( | ||
11684 | [ | ||
11685 | A2( | ||
11686 | $rtfeldman$elm_css$Html$Styled$a, | ||
11687 | _List_fromArray( | ||
11688 | [ | ||
11689 | $rtfeldman$elm_css$Html$Styled$Attributes$href('/cart') | ||
11690 | ]), | ||
11691 | _List_fromArray( | ||
11692 | [ | ||
11693 | $rtfeldman$elm_css$Html$Styled$text('Cancel') | ||
11694 | ])) | ||
11695 | ])), | ||
11696 | A2( | ||
11697 | $rtfeldman$elm_css$Html$Styled$div, | ||
11698 | _List_Nil, | ||
11699 | _List_fromArray( | ||
11700 | [ | ||
11701 | A2( | ||
11702 | $rtfeldman$elm_css$Html$Styled$button, | ||
11703 | _List_fromArray( | ||
11704 | [ | ||
11705 | $rtfeldman$elm_css$Html$Styled$Events$onClick($author$project$Checkout$CheckoutPressed) | ||
11706 | ]), | ||
11707 | _List_fromArray( | ||
11708 | [ | ||
11709 | $rtfeldman$elm_css$Html$Styled$text('Confirm and Pay') | ||
11710 | ])) | ||
11711 | ])) | ||
11712 | ])); | ||
11713 | } | ||
11714 | }; | ||
11715 | var $author$project$Login$LoginPressed = {$: 'LoginPressed'}; | ||
11716 | var $author$project$Login$PassEntered = function (a) { | ||
11717 | return {$: 'PassEntered', a: a}; | ||
11718 | }; | ||
11719 | var $author$project$Login$UserEntered = function (a) { | ||
11720 | return {$: 'UserEntered', a: a}; | ||
11721 | }; | ||
11722 | var $rtfeldman$elm_css$Css$auto = {alignItemsOrAuto: $rtfeldman$elm_css$Css$Structure$Compatible, cursor: $rtfeldman$elm_css$Css$Structure$Compatible, flexBasis: $rtfeldman$elm_css$Css$Structure$Compatible, intOrAuto: $rtfeldman$elm_css$Css$Structure$Compatible, justifyContentOrAuto: $rtfeldman$elm_css$Css$Structure$Compatible, lengthOrAuto: $rtfeldman$elm_css$Css$Structure$Compatible, lengthOrAutoOrCoverOrContain: $rtfeldman$elm_css$Css$Structure$Compatible, lengthOrNumberOrAutoOrNoneOrContent: $rtfeldman$elm_css$Css$Structure$Compatible, overflow: $rtfeldman$elm_css$Css$Structure$Compatible, pointerEvents: $rtfeldman$elm_css$Css$Structure$Compatible, tableLayout: $rtfeldman$elm_css$Css$Structure$Compatible, textRendering: $rtfeldman$elm_css$Css$Structure$Compatible, touchAction: $rtfeldman$elm_css$Css$Structure$Compatible, value: 'auto'}; | ||
11723 | var $rtfeldman$elm_css$Css$center = $rtfeldman$elm_css$Css$prop1('center'); | ||
11724 | var $author$project$Login$fieldPadding = $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11725 | _List_fromArray( | ||
11726 | [ | ||
11727 | $rtfeldman$elm_css$Css$paddingTop( | ||
11728 | $rtfeldman$elm_css$Css$px(10)), | ||
11729 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11730 | $rtfeldman$elm_css$Css$px(10)) | ||
11731 | ])); | ||
11732 | var $rtfeldman$elm_css$Css$marginTop = $rtfeldman$elm_css$Css$prop1('margin-top'); | ||
11733 | var $rtfeldman$elm_css$Css$focus = $rtfeldman$elm_css$Css$pseudoClass('focus'); | ||
11734 | var $rtfeldman$elm_css$Html$Styled$input = $rtfeldman$elm_css$Html$Styled$node('input'); | ||
11735 | var $author$project$Styles$loginInputField = A2( | ||
11736 | $rtfeldman$elm_css$Html$Styled$styled, | ||
11737 | $rtfeldman$elm_css$Html$Styled$input, | ||
11738 | _List_fromArray( | ||
11739 | [ | ||
11740 | $rtfeldman$elm_css$Css$width( | ||
11741 | $rtfeldman$elm_css$Css$pct(100)), | ||
11742 | $rtfeldman$elm_css$Css$color($author$project$Styles$theme.fg), | ||
11743 | $rtfeldman$elm_css$Css$border( | ||
11744 | $rtfeldman$elm_css$Css$px(0)), | ||
11745 | A3( | ||
11746 | $rtfeldman$elm_css$Css$borderBottom3, | ||
11747 | $rtfeldman$elm_css$Css$px(1), | ||
11748 | $rtfeldman$elm_css$Css$solid, | ||
11749 | $author$project$Styles$theme.bgLight), | ||
11750 | $rtfeldman$elm_css$Css$focus( | ||
11751 | _List_fromArray( | ||
11752 | [ | ||
11753 | A3( | ||
11754 | $rtfeldman$elm_css$Css$borderBottom3, | ||
11755 | $rtfeldman$elm_css$Css$px(2), | ||
11756 | $rtfeldman$elm_css$Css$solid, | ||
11757 | $author$project$Styles$theme.fg) | ||
11758 | ])) | ||
11759 | ])); | ||
11760 | var $rtfeldman$elm_css$Html$Styled$Attributes$placeholder = $rtfeldman$elm_css$Html$Styled$Attributes$stringProperty('placeholder'); | ||
11761 | var $rtfeldman$elm_css$Html$Styled$Attributes$type_ = $rtfeldman$elm_css$Html$Styled$Attributes$stringProperty('type'); | ||
11762 | var $rtfeldman$elm_css$Html$Styled$Attributes$value = $rtfeldman$elm_css$Html$Styled$Attributes$stringProperty('value'); | ||
11763 | var $author$project$Login$viewInput = F4( | ||
11764 | function (t, p, v, toMsg) { | ||
11765 | return A2( | ||
11766 | $author$project$Styles$loginInputField, | ||
11767 | _List_fromArray( | ||
11768 | [ | ||
11769 | $rtfeldman$elm_css$Html$Styled$Attributes$type_(t), | ||
11770 | $rtfeldman$elm_css$Html$Styled$Attributes$placeholder(p), | ||
11771 | $rtfeldman$elm_css$Html$Styled$Attributes$value(v), | ||
11772 | $rtfeldman$elm_css$Html$Styled$Events$onInput(toMsg) | ||
11773 | ]), | ||
11774 | _List_Nil); | ||
11775 | }); | ||
11776 | var $author$project$Login$viewStatus = function (ls) { | ||
11777 | switch (ls.$) { | ||
11778 | case 'NotLoggedIn': | ||
11779 | return ''; | ||
11780 | case 'InvalidLogin': | ||
11781 | return 'Invalid Login'; | ||
11782 | case 'LoggedIn': | ||
11783 | return 'Logged in!'; | ||
11784 | default: | ||
11785 | return 'Logging In ...'; | ||
11786 | } | ||
11787 | }; | ||
11788 | var $author$project$Login$view = function (model) { | ||
11789 | return A2( | ||
11790 | $rtfeldman$elm_css$Html$Styled$div, | ||
11791 | _List_fromArray( | ||
11792 | [ | ||
11793 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11794 | _List_fromArray( | ||
11795 | [ | ||
11796 | $rtfeldman$elm_css$Css$margin($rtfeldman$elm_css$Css$auto), | ||
11797 | $rtfeldman$elm_css$Css$marginTop( | ||
11798 | $rtfeldman$elm_css$Css$pct(10)), | ||
11799 | $rtfeldman$elm_css$Css$padding( | ||
11800 | $rtfeldman$elm_css$Css$px(20)), | ||
11801 | $rtfeldman$elm_css$Css$width( | ||
11802 | $rtfeldman$elm_css$Css$pct(30)) | ||
11803 | ])) | ||
11804 | ]), | ||
11805 | _List_fromArray( | ||
11806 | [ | ||
11807 | A2( | ||
11808 | $rtfeldman$elm_css$Html$Styled$div, | ||
11809 | _List_fromArray( | ||
11810 | [ | ||
11811 | $author$project$Login$fieldPadding, | ||
11812 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11813 | _List_fromArray( | ||
11814 | [$author$project$Styles$bigHeading])) | ||
11815 | ]), | ||
11816 | _List_fromArray( | ||
11817 | [ | ||
11818 | $rtfeldman$elm_css$Html$Styled$text('Login') | ||
11819 | ])), | ||
11820 | A2( | ||
11821 | $rtfeldman$elm_css$Html$Styled$div, | ||
11822 | _List_fromArray( | ||
11823 | [$author$project$Login$fieldPadding]), | ||
11824 | _List_fromArray( | ||
11825 | [ | ||
11826 | A4($author$project$Login$viewInput, 'text', 'Enter name here', model.username, $author$project$Login$UserEntered) | ||
11827 | ])), | ||
11828 | A2( | ||
11829 | $rtfeldman$elm_css$Html$Styled$div, | ||
11830 | _List_fromArray( | ||
11831 | [$author$project$Login$fieldPadding]), | ||
11832 | _List_fromArray( | ||
11833 | [ | ||
11834 | A4($author$project$Login$viewInput, 'password', 'Password', model.password, $author$project$Login$PassEntered) | ||
11835 | ])), | ||
11836 | A2( | ||
11837 | $rtfeldman$elm_css$Html$Styled$div, | ||
11838 | _List_fromArray( | ||
11839 | [ | ||
11840 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11841 | _List_fromArray( | ||
11842 | [ | ||
11843 | $rtfeldman$elm_css$Css$textAlign($rtfeldman$elm_css$Css$center) | ||
11844 | ])), | ||
11845 | $author$project$Login$fieldPadding | ||
11846 | ]), | ||
11847 | _List_fromArray( | ||
11848 | [ | ||
11849 | A2( | ||
11850 | $author$project$Styles$furbyButton, | ||
11851 | _List_fromArray( | ||
11852 | [ | ||
11853 | $rtfeldman$elm_css$Html$Styled$Events$onClick($author$project$Login$LoginPressed) | ||
11854 | ]), | ||
11855 | _List_fromArray( | ||
11856 | [ | ||
11857 | $rtfeldman$elm_css$Html$Styled$text('Login') | ||
11858 | ])) | ||
11859 | ])), | ||
11860 | A2( | ||
11861 | $rtfeldman$elm_css$Html$Styled$div, | ||
11862 | _List_fromArray( | ||
11863 | [ | ||
11864 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11865 | _List_fromArray( | ||
11866 | [ | ||
11867 | $rtfeldman$elm_css$Css$textAlign($rtfeldman$elm_css$Css$center) | ||
11868 | ])) | ||
11869 | ]), | ||
11870 | _List_fromArray( | ||
11871 | [ | ||
11872 | $rtfeldman$elm_css$Html$Styled$text( | ||
11873 | $author$project$Login$viewStatus(model.loginStatus)) | ||
11874 | ])), | ||
11875 | A2( | ||
11876 | $rtfeldman$elm_css$Html$Styled$div, | ||
11877 | _List_fromArray( | ||
11878 | [$author$project$Login$fieldPadding]), | ||
11879 | _List_fromArray( | ||
11880 | [ | ||
11881 | $rtfeldman$elm_css$Html$Styled$text('Don\'t have an account? '), | ||
11882 | A2( | ||
11883 | $rtfeldman$elm_css$Html$Styled$a, | ||
11884 | _List_fromArray( | ||
11885 | [ | ||
11886 | $rtfeldman$elm_css$Html$Styled$Attributes$href('/signup') | ||
11887 | ]), | ||
11888 | _List_fromArray( | ||
11889 | [ | ||
11890 | $rtfeldman$elm_css$Html$Styled$text('Register now!') | ||
11891 | ])) | ||
11892 | ])) | ||
11893 | ])); | ||
11894 | }; | ||
11895 | var $author$project$Product$AddRatingComment = function (a) { | ||
11896 | return {$: 'AddRatingComment', a: a}; | ||
11897 | }; | ||
11898 | var $author$project$Product$AddRatingPressed = {$: 'AddRatingPressed'}; | ||
11899 | var $author$project$Product$viewInput = F4( | ||
11900 | function (t, p, v, toMsg) { | ||
11901 | return A2( | ||
11902 | $rtfeldman$elm_css$Html$Styled$input, | ||
11903 | _List_fromArray( | ||
11904 | [ | ||
11905 | $rtfeldman$elm_css$Html$Styled$Attributes$type_(t), | ||
11906 | $rtfeldman$elm_css$Html$Styled$Attributes$placeholder(p), | ||
11907 | $rtfeldman$elm_css$Html$Styled$Attributes$value(v), | ||
11908 | $rtfeldman$elm_css$Html$Styled$Events$onInput(toMsg) | ||
11909 | ]), | ||
11910 | _List_Nil); | ||
11911 | }); | ||
11912 | var $author$project$Product$AddToCartPressed = {$: 'AddToCartPressed'}; | ||
11913 | var $author$project$Product$viewProduct = function (p) { | ||
11914 | return A2( | ||
11915 | $rtfeldman$elm_css$Html$Styled$div, | ||
11916 | _List_fromArray( | ||
11917 | [ | ||
11918 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11919 | _List_fromArray( | ||
11920 | [ | ||
11921 | $rtfeldman$elm_css$Css$marginBottom( | ||
11922 | $rtfeldman$elm_css$Css$px(20)), | ||
11923 | $rtfeldman$elm_css$Css$padding( | ||
11924 | $rtfeldman$elm_css$Css$px(20)), | ||
11925 | $rtfeldman$elm_css$Css$width( | ||
11926 | $rtfeldman$elm_css$Css$pct(100)) | ||
11927 | ])) | ||
11928 | ]), | ||
11929 | _List_fromArray( | ||
11930 | [ | ||
11931 | A2( | ||
11932 | $rtfeldman$elm_css$Html$Styled$div, | ||
11933 | _List_fromArray( | ||
11934 | [ | ||
11935 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11936 | _List_fromArray( | ||
11937 | [ | ||
11938 | $rtfeldman$elm_css$Css$float($rtfeldman$elm_css$Css$left), | ||
11939 | $rtfeldman$elm_css$Css$width( | ||
11940 | $rtfeldman$elm_css$Css$pct(50)) | ||
11941 | ])) | ||
11942 | ]), | ||
11943 | _List_fromArray( | ||
11944 | [ | ||
11945 | A2( | ||
11946 | $author$project$Utils$modelViewer, | ||
11947 | _List_fromArray( | ||
11948 | [ | ||
11949 | $author$project$Utils$cameraControls, | ||
11950 | $author$project$Utils$autoRotate, | ||
11951 | $author$project$Utils$arSrc(p.src), | ||
11952 | $author$project$Utils$arIosSrc(p.iosSrc), | ||
11953 | $author$project$Utils$loading('eager'), | ||
11954 | $author$project$Utils$arModes('webxr') | ||
11955 | ]), | ||
11956 | _List_Nil) | ||
11957 | ])), | ||
11958 | A2( | ||
11959 | $rtfeldman$elm_css$Html$Styled$div, | ||
11960 | _List_fromArray( | ||
11961 | [ | ||
11962 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11963 | _List_fromArray( | ||
11964 | [ | ||
11965 | $rtfeldman$elm_css$Css$float($rtfeldman$elm_css$Css$left), | ||
11966 | $rtfeldman$elm_css$Css$width( | ||
11967 | $rtfeldman$elm_css$Css$pct(50)) | ||
11968 | ])) | ||
11969 | ]), | ||
11970 | _List_fromArray( | ||
11971 | [ | ||
11972 | A2( | ||
11973 | $rtfeldman$elm_css$Html$Styled$div, | ||
11974 | _List_fromArray( | ||
11975 | [ | ||
11976 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11977 | _List_fromArray( | ||
11978 | [ | ||
11979 | $author$project$Styles$cardSecondaryText, | ||
11980 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11981 | $rtfeldman$elm_css$Css$px(3)), | ||
11982 | $rtfeldman$elm_css$Css$fontVariant($rtfeldman$elm_css$Css$smallCaps) | ||
11983 | ])) | ||
11984 | ]), | ||
11985 | _List_fromArray( | ||
11986 | [ | ||
11987 | $rtfeldman$elm_css$Html$Styled$text( | ||
11988 | A2($elm$core$Maybe$withDefault, '', p.kind)) | ||
11989 | ])), | ||
11990 | A2( | ||
11991 | $rtfeldman$elm_css$Html$Styled$div, | ||
11992 | _List_fromArray( | ||
11993 | [ | ||
11994 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11995 | _List_fromArray( | ||
11996 | [ | ||
11997 | $author$project$Styles$cardPrimaryText, | ||
11998 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11999 | $rtfeldman$elm_css$Css$px(12)) | ||
12000 | ])) | ||
12001 | ]), | ||
12002 | _List_fromArray( | ||
12003 | [ | ||
12004 | $rtfeldman$elm_css$Html$Styled$text(p.name) | ||
12005 | ])), | ||
12006 | A2( | ||
12007 | $rtfeldman$elm_css$Html$Styled$div, | ||
12008 | _List_fromArray( | ||
12009 | [ | ||
12010 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12011 | _List_fromArray( | ||
12012 | [ | ||
12013 | $author$project$Styles$cardSupportingText, | ||
12014 | $rtfeldman$elm_css$Css$paddingBottom( | ||
12015 | $rtfeldman$elm_css$Css$px(6)) | ||
12016 | ])) | ||
12017 | ]), | ||
12018 | _List_fromArray( | ||
12019 | [ | ||
12020 | $rtfeldman$elm_css$Html$Styled$text( | ||
12021 | A2($elm$core$Maybe$withDefault, 'No description provided', p.description)) | ||
12022 | ])), | ||
12023 | A2( | ||
12024 | $rtfeldman$elm_css$Html$Styled$div, | ||
12025 | _List_fromArray( | ||
12026 | [ | ||
12027 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12028 | _List_fromArray( | ||
12029 | [ | ||
12030 | $rtfeldman$elm_css$Css$fontWeight($rtfeldman$elm_css$Css$bold), | ||
12031 | $rtfeldman$elm_css$Css$fontSize( | ||
12032 | $rtfeldman$elm_css$Css$px(14)), | ||
12033 | $author$project$Styles$money | ||
12034 | ])) | ||
12035 | ]), | ||
12036 | _List_fromArray( | ||
12037 | [ | ||
12038 | $rtfeldman$elm_css$Html$Styled$text( | ||
12039 | $elm$core$String$fromFloat(p.price)), | ||
12040 | A2( | ||
12041 | $rtfeldman$elm_css$Html$Styled$div, | ||
12042 | _List_Nil, | ||
12043 | _List_fromArray( | ||
12044 | [ | ||
12045 | A2( | ||
12046 | $author$project$Styles$furbyButton, | ||
12047 | _List_fromArray( | ||
12048 | [ | ||
12049 | $rtfeldman$elm_css$Html$Styled$Events$onClick($author$project$Product$AddToCartPressed) | ||
12050 | ]), | ||
12051 | _List_fromArray( | ||
12052 | [ | ||
12053 | $rtfeldman$elm_css$Html$Styled$text('Add To Cart') | ||
12054 | ])) | ||
12055 | ])) | ||
12056 | ])) | ||
12057 | ])), | ||
12058 | A2( | ||
12059 | $rtfeldman$elm_css$Html$Styled$div, | ||
12060 | _List_fromArray( | ||
12061 | [ | ||
12062 | A2($rtfeldman$elm_css$Html$Styled$Attributes$style, 'clear', 'both') | ||
12063 | ]), | ||
12064 | _List_Nil) | ||
12065 | ])); | ||
12066 | }; | ||
12067 | var $elm$core$List$repeatHelp = F3( | ||
12068 | function (result, n, value) { | ||
12069 | repeatHelp: | ||
12070 | while (true) { | ||
12071 | if (n <= 0) { | ||
12072 | return result; | ||
12073 | } else { | ||
12074 | var $temp$result = A2($elm$core$List$cons, value, result), | ||
12075 | $temp$n = n - 1, | ||
12076 | $temp$value = value; | ||
12077 | result = $temp$result; | ||
12078 | n = $temp$n; | ||
12079 | value = $temp$value; | ||
12080 | continue repeatHelp; | ||
12081 | } | ||
12082 | } | ||
12083 | }); | ||
12084 | var $elm$core$List$repeat = F2( | ||
12085 | function (n, value) { | ||
12086 | return A3($elm$core$List$repeatHelp, _List_Nil, n, value); | ||
12087 | }); | ||
12088 | var $rtfeldman$elm_css$VirtualDom$Styled$unstyledNode = $rtfeldman$elm_css$VirtualDom$Styled$Unstyled; | ||
12089 | var $rtfeldman$elm_css$Html$Styled$fromUnstyled = $rtfeldman$elm_css$VirtualDom$Styled$unstyledNode; | ||
12090 | var $elm$svg$Svg$Attributes$class = _VirtualDom_attribute('class'); | ||
12091 | var $elm$svg$Svg$Attributes$fill = _VirtualDom_attribute('fill'); | ||
12092 | var $elm$svg$Svg$Attributes$height = _VirtualDom_attribute('height'); | ||
12093 | var $elm$svg$Svg$map = $elm$virtual_dom$VirtualDom$map; | ||
12094 | var $elm$svg$Svg$Attributes$stroke = _VirtualDom_attribute('stroke'); | ||
12095 | var $elm$svg$Svg$Attributes$strokeLinecap = _VirtualDom_attribute('stroke-linecap'); | ||
12096 | var $elm$svg$Svg$Attributes$strokeLinejoin = _VirtualDom_attribute('stroke-linejoin'); | ||
12097 | var $elm$svg$Svg$Attributes$strokeWidth = _VirtualDom_attribute('stroke-width'); | ||
12098 | var $elm$svg$Svg$trustedNode = _VirtualDom_nodeNS('http://www.w3.org/2000/svg'); | ||
12099 | var $elm$svg$Svg$svg = $elm$svg$Svg$trustedNode('svg'); | ||
12100 | var $elm$svg$Svg$Attributes$viewBox = _VirtualDom_attribute('viewBox'); | ||
12101 | var $elm$svg$Svg$Attributes$width = _VirtualDom_attribute('width'); | ||
12102 | var $1602$elm_feather$FeatherIcons$toHtml = F2( | ||
12103 | function (attributes, _v0) { | ||
12104 | var src = _v0.a.src; | ||
12105 | var attrs = _v0.a.attrs; | ||
12106 | var strSize = $elm$core$String$fromFloat(attrs.size); | ||
12107 | var baseAttributes = _List_fromArray( | ||
12108 | [ | ||
12109 | $elm$svg$Svg$Attributes$fill('none'), | ||
12110 | $elm$svg$Svg$Attributes$height( | ||
12111 | _Utils_ap(strSize, attrs.sizeUnit)), | ||
12112 | $elm$svg$Svg$Attributes$width( | ||
12113 | _Utils_ap(strSize, attrs.sizeUnit)), | ||
12114 | $elm$svg$Svg$Attributes$stroke('currentColor'), | ||
12115 | $elm$svg$Svg$Attributes$strokeLinecap('round'), | ||
12116 | $elm$svg$Svg$Attributes$strokeLinejoin('round'), | ||
12117 | $elm$svg$Svg$Attributes$strokeWidth( | ||
12118 | $elm$core$String$fromFloat(attrs.strokeWidth)), | ||
12119 | $elm$svg$Svg$Attributes$viewBox(attrs.viewBox) | ||
12120 | ]); | ||
12121 | var combinedAttributes = _Utils_ap( | ||
12122 | function () { | ||
12123 | var _v1 = attrs._class; | ||
12124 | if (_v1.$ === 'Just') { | ||
12125 | var c = _v1.a; | ||
12126 | return A2( | ||
12127 | $elm$core$List$cons, | ||
12128 | $elm$svg$Svg$Attributes$class(c), | ||
12129 | baseAttributes); | ||
12130 | } else { | ||
12131 | return baseAttributes; | ||
12132 | } | ||
12133 | }(), | ||
12134 | attributes); | ||
12135 | return A2( | ||
12136 | $elm$svg$Svg$svg, | ||
12137 | combinedAttributes, | ||
12138 | A2( | ||
12139 | $elm$core$List$map, | ||
12140 | $elm$svg$Svg$map($elm$core$Basics$never), | ||
12141 | src)); | ||
12142 | }); | ||
12143 | var $1602$elm_feather$FeatherIcons$Icon = function (a) { | ||
12144 | return {$: 'Icon', a: a}; | ||
12145 | }; | ||
12146 | var $1602$elm_feather$FeatherIcons$withSize = F2( | ||
12147 | function (size, _v0) { | ||
12148 | var attrs = _v0.a.attrs; | ||
12149 | var src = _v0.a.src; | ||
12150 | return $1602$elm_feather$FeatherIcons$Icon( | ||
12151 | { | ||
12152 | attrs: _Utils_update( | ||
12153 | attrs, | ||
12154 | {size: size}), | ||
12155 | src: src | ||
12156 | }); | ||
12157 | }); | ||
12158 | var $author$project$Icons$convert = A2( | ||
12159 | $elm$core$Basics$composeL, | ||
12160 | A2( | ||
12161 | $elm$core$Basics$composeL, | ||
12162 | $rtfeldman$elm_css$Html$Styled$fromUnstyled, | ||
12163 | $1602$elm_feather$FeatherIcons$toHtml(_List_Nil)), | ||
12164 | $1602$elm_feather$FeatherIcons$withSize(14)); | ||
12165 | var $1602$elm_feather$FeatherIcons$defaultAttributes = function (name) { | ||
12166 | return { | ||
12167 | _class: $elm$core$Maybe$Just('feather feather-' + name), | ||
12168 | size: 24, | ||
12169 | sizeUnit: '', | ||
12170 | strokeWidth: 2, | ||
12171 | viewBox: '0 0 24 24' | ||
12172 | }; | ||
12173 | }; | ||
12174 | var $1602$elm_feather$FeatherIcons$makeBuilder = F2( | ||
12175 | function (name, src) { | ||
12176 | return $1602$elm_feather$FeatherIcons$Icon( | ||
12177 | { | ||
12178 | attrs: $1602$elm_feather$FeatherIcons$defaultAttributes(name), | ||
12179 | src: src | ||
12180 | }); | ||
12181 | }); | ||
12182 | var $elm$svg$Svg$Attributes$points = _VirtualDom_attribute('points'); | ||
12183 | var $elm$svg$Svg$polygon = $elm$svg$Svg$trustedNode('polygon'); | ||
12184 | var $1602$elm_feather$FeatherIcons$xmlns = function (s) { | ||
12185 | return A2( | ||
12186 | $elm$virtual_dom$VirtualDom$property, | ||
12187 | 'xmlns', | ||
12188 | $elm$json$Json$Encode$string(s)); | ||
12189 | }; | ||
12190 | var $1602$elm_feather$FeatherIcons$star = A2( | ||
12191 | $1602$elm_feather$FeatherIcons$makeBuilder, | ||
12192 | 'star', | ||
12193 | _List_fromArray( | ||
12194 | [ | ||
12195 | A2( | ||
12196 | $elm$svg$Svg$svg, | ||
12197 | _List_fromArray( | ||
12198 | [ | ||
12199 | $1602$elm_feather$FeatherIcons$xmlns('http://www.w3.org/2000/svg'), | ||
12200 | $elm$svg$Svg$Attributes$width('24'), | ||
12201 | $elm$svg$Svg$Attributes$height('24'), | ||
12202 | $elm$svg$Svg$Attributes$viewBox('0 0 24 24'), | ||
12203 | $elm$svg$Svg$Attributes$fill('none'), | ||
12204 | $elm$svg$Svg$Attributes$stroke('currentColor'), | ||
12205 | $elm$svg$Svg$Attributes$strokeWidth('2'), | ||
12206 | $elm$svg$Svg$Attributes$strokeLinecap('round'), | ||
12207 | $elm$svg$Svg$Attributes$strokeLinejoin('round'), | ||
12208 | $elm$svg$Svg$Attributes$class('feather feather-star') | ||
12209 | ]), | ||
12210 | _List_fromArray( | ||
12211 | [ | ||
12212 | A2( | ||
12213 | $elm$svg$Svg$polygon, | ||
12214 | _List_fromArray( | ||
12215 | [ | ||
12216 | $elm$svg$Svg$Attributes$points('12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2') | ||
12217 | ]), | ||
12218 | _List_Nil) | ||
12219 | ])) | ||
12220 | ])); | ||
12221 | var $author$project$Icons$starIcon = $author$project$Icons$convert($1602$elm_feather$FeatherIcons$star); | ||
12222 | var $author$project$Product$viewStarRating = function (i) { | ||
12223 | return A2( | ||
12224 | $rtfeldman$elm_css$Html$Styled$div, | ||
12225 | _List_Nil, | ||
12226 | A2($elm$core$List$repeat, i, $author$project$Icons$starIcon)); | ||
12227 | }; | ||
12228 | var $author$project$Product$viewRating = function (r) { | ||
12229 | return A2( | ||
12230 | $rtfeldman$elm_css$Html$Styled$div, | ||
12231 | _List_fromArray( | ||
12232 | [ | ||
12233 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12234 | _List_fromArray( | ||
12235 | [ | ||
12236 | A3( | ||
12237 | $rtfeldman$elm_css$Css$border3, | ||
12238 | $rtfeldman$elm_css$Css$px(1), | ||
12239 | $rtfeldman$elm_css$Css$solid, | ||
12240 | $author$project$Styles$theme.primary), | ||
12241 | $rtfeldman$elm_css$Css$borderRadius( | ||
12242 | $rtfeldman$elm_css$Css$px(4)), | ||
12243 | $rtfeldman$elm_css$Css$marginBottom( | ||
12244 | $rtfeldman$elm_css$Css$px(20)), | ||
12245 | $rtfeldman$elm_css$Css$padding( | ||
12246 | $rtfeldman$elm_css$Css$px(20)) | ||
12247 | ])) | ||
12248 | ]), | ||
12249 | _List_fromArray( | ||
12250 | [ | ||
12251 | A2( | ||
12252 | $rtfeldman$elm_css$Html$Styled$div, | ||
12253 | _List_fromArray( | ||
12254 | [ | ||
12255 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12256 | _List_fromArray( | ||
12257 | [ | ||
12258 | $rtfeldman$elm_css$Css$fontSize( | ||
12259 | $rtfeldman$elm_css$Css$px(16)), | ||
12260 | $rtfeldman$elm_css$Css$fontWeight($rtfeldman$elm_css$Css$bold), | ||
12261 | $rtfeldman$elm_css$Css$paddingBottom( | ||
12262 | $rtfeldman$elm_css$Css$px(3)) | ||
12263 | ])) | ||
12264 | ]), | ||
12265 | _List_fromArray( | ||
12266 | [ | ||
12267 | $rtfeldman$elm_css$Html$Styled$text(r.customerName) | ||
12268 | ])), | ||
12269 | $author$project$Product$viewStarRating(r.stars), | ||
12270 | A2( | ||
12271 | $rtfeldman$elm_css$Html$Styled$div, | ||
12272 | _List_fromArray( | ||
12273 | [ | ||
12274 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12275 | _List_fromArray( | ||
12276 | [ | ||
12277 | $author$project$Styles$cardSecondaryText, | ||
12278 | $rtfeldman$elm_css$Css$paddingBottom( | ||
12279 | $rtfeldman$elm_css$Css$px(12)) | ||
12280 | ])) | ||
12281 | ]), | ||
12282 | _List_fromArray( | ||
12283 | [ | ||
12284 | $rtfeldman$elm_css$Html$Styled$text('Reviewed on ' + r.commentDate) | ||
12285 | ])), | ||
12286 | (!_Utils_eq(r.commentText, $elm$core$Maybe$Nothing)) ? A2( | ||
12287 | $rtfeldman$elm_css$Html$Styled$div, | ||
12288 | _List_fromArray( | ||
12289 | [ | ||
12290 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12291 | _List_fromArray( | ||
12292 | [$author$project$Styles$cardSupportingText])) | ||
12293 | ]), | ||
12294 | _List_fromArray( | ||
12295 | [ | ||
12296 | $rtfeldman$elm_css$Html$Styled$text( | ||
12297 | A2($elm$core$Maybe$withDefault, '', r.commentText)) | ||
12298 | ])) : $rtfeldman$elm_css$Html$Styled$text('') | ||
12299 | ])); | ||
12300 | }; | ||
12301 | var $author$project$Product$AddRatingStars = function (a) { | ||
12302 | return {$: 'AddRatingStars', a: a}; | ||
12303 | }; | ||
12304 | var $author$project$Product$viewStars = A2( | ||
12305 | $rtfeldman$elm_css$Html$Styled$ul, | ||
12306 | _List_Nil, | ||
12307 | A2( | ||
12308 | $elm$core$List$map, | ||
12309 | function (i) { | ||
12310 | return A2( | ||
12311 | $rtfeldman$elm_css$Html$Styled$button, | ||
12312 | _List_fromArray( | ||
12313 | [ | ||
12314 | $rtfeldman$elm_css$Html$Styled$Events$onClick( | ||
12315 | $author$project$Product$AddRatingStars(i)) | ||
12316 | ]), | ||
12317 | _List_fromArray( | ||
12318 | [ | ||
12319 | $rtfeldman$elm_css$Html$Styled$text( | ||
12320 | $elm$core$String$fromInt(i)) | ||
12321 | ])); | ||
12322 | }, | ||
12323 | _List_fromArray( | ||
12324 | [1, 2, 3, 4, 5]))); | ||
12325 | var $author$project$Product$viewStatus = function (s) { | ||
12326 | switch (s.$) { | ||
12327 | case 'Loading': | ||
12328 | return 'Loading'; | ||
12329 | case 'Loaded': | ||
12330 | return 'Ready!'; | ||
12331 | default: | ||
12332 | return 'Not loaded ...'; | ||
12333 | } | ||
12334 | }; | ||
12335 | var $author$project$Product$view = function (model) { | ||
12336 | var _v0 = model.pageStatus; | ||
12337 | if (_v0.$ === 'Loading') { | ||
12338 | return A2( | ||
12339 | $rtfeldman$elm_css$Html$Styled$div, | ||
12340 | _List_Nil, | ||
12341 | _List_fromArray( | ||
12342 | [ | ||
12343 | $rtfeldman$elm_css$Html$Styled$text( | ||
12344 | $author$project$Product$viewStatus($author$project$Product$Loading)) | ||
12345 | ])); | ||
12346 | } else { | ||
12347 | return A2( | ||
12348 | $rtfeldman$elm_css$Html$Styled$div, | ||
12349 | _List_fromArray( | ||
12350 | [ | ||
12351 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12352 | _List_fromArray( | ||
12353 | [ | ||
12354 | $rtfeldman$elm_css$Css$width( | ||
12355 | $rtfeldman$elm_css$Css$pct(60)), | ||
12356 | $rtfeldman$elm_css$Css$margin($rtfeldman$elm_css$Css$auto) | ||
12357 | ])) | ||
12358 | ]), | ||
12359 | _List_fromArray( | ||
12360 | [ | ||
12361 | A2( | ||
12362 | $rtfeldman$elm_css$Html$Styled$div, | ||
12363 | _List_Nil, | ||
12364 | _List_fromArray( | ||
12365 | [ | ||
12366 | $author$project$Product$viewProduct(model.listing) | ||
12367 | ])), | ||
12368 | A2( | ||
12369 | $rtfeldman$elm_css$Html$Styled$div, | ||
12370 | _List_fromArray( | ||
12371 | [ | ||
12372 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12373 | _List_fromArray( | ||
12374 | [$author$project$Styles$cardPrimaryText])) | ||
12375 | ]), | ||
12376 | _List_fromArray( | ||
12377 | [ | ||
12378 | $rtfeldman$elm_css$Html$Styled$text('User Reviews') | ||
12379 | ])), | ||
12380 | _Utils_eq(model.ratings, _List_Nil) ? $rtfeldman$elm_css$Html$Styled$text('Be the first to add a review.') : A2( | ||
12381 | $rtfeldman$elm_css$Html$Styled$ul, | ||
12382 | _List_fromArray( | ||
12383 | [ | ||
12384 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12385 | _List_fromArray( | ||
12386 | [ | ||
12387 | $rtfeldman$elm_css$Css$padding( | ||
12388 | $rtfeldman$elm_css$Css$px(0)), | ||
12389 | $rtfeldman$elm_css$Css$listStyle($rtfeldman$elm_css$Css$none) | ||
12390 | ])) | ||
12391 | ]), | ||
12392 | A2($elm$core$List$map, $author$project$Product$viewRating, model.ratings)), | ||
12393 | A2( | ||
12394 | $rtfeldman$elm_css$Html$Styled$div, | ||
12395 | _List_Nil, | ||
12396 | _List_fromArray( | ||
12397 | [ | ||
12398 | $rtfeldman$elm_css$Html$Styled$text('Add Rating: ') | ||
12399 | ])), | ||
12400 | A2( | ||
12401 | $rtfeldman$elm_css$Html$Styled$div, | ||
12402 | _List_Nil, | ||
12403 | _List_fromArray( | ||
12404 | [ | ||
12405 | $author$project$Product$viewStars, | ||
12406 | A4($author$project$Product$viewInput, 'text', 'Enter Comment Text', model.ratingText, $author$project$Product$AddRatingComment), | ||
12407 | A2( | ||
12408 | $rtfeldman$elm_css$Html$Styled$button, | ||
12409 | _List_fromArray( | ||
12410 | [ | ||
12411 | $rtfeldman$elm_css$Html$Styled$Events$onClick($author$project$Product$AddRatingPressed) | ||
12412 | ]), | ||
12413 | _List_fromArray( | ||
12414 | [ | ||
12415 | $rtfeldman$elm_css$Html$Styled$text('Submit Rating') | ||
12416 | ])) | ||
12417 | ])), | ||
12418 | A2( | ||
12419 | $rtfeldman$elm_css$Html$Styled$div, | ||
12420 | _List_Nil, | ||
12421 | _List_fromArray( | ||
12422 | [ | ||
12423 | A2( | ||
12424 | $rtfeldman$elm_css$Html$Styled$a, | ||
12425 | _List_fromArray( | ||
12426 | [ | ||
12427 | $rtfeldman$elm_css$Html$Styled$Attributes$href('/catalog') | ||
12428 | ]), | ||
12429 | _List_fromArray( | ||
12430 | [ | ||
12431 | $rtfeldman$elm_css$Html$Styled$text('Back to catalog') | ||
12432 | ])) | ||
12433 | ])) | ||
12434 | ])); | ||
12435 | } | ||
12436 | }; | ||
12437 | var $author$project$Signup$AddressEntered = function (a) { | ||
12438 | return {$: 'AddressEntered', a: a}; | ||
12439 | }; | ||
12440 | var $author$project$Signup$CreatePressed = {$: 'CreatePressed'}; | ||
12441 | var $author$project$Signup$EmailEntered = function (a) { | ||
12442 | return {$: 'EmailEntered', a: a}; | ||
12443 | }; | ||
12444 | var $author$project$Signup$PassEntered = function (a) { | ||
12445 | return {$: 'PassEntered', a: a}; | ||
12446 | }; | ||
12447 | var $author$project$Signup$PhoneEntered = function (a) { | ||
12448 | return {$: 'PhoneEntered', a: a}; | ||
12449 | }; | ||
12450 | var $author$project$Signup$UserEntered = function (a) { | ||
12451 | return {$: 'UserEntered', a: a}; | ||
12452 | }; | ||
12453 | var $author$project$Signup$fieldPadding = $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12454 | _List_fromArray( | ||
12455 | [ | ||
12456 | $rtfeldman$elm_css$Css$paddingTop( | ||
12457 | $rtfeldman$elm_css$Css$px(10)), | ||
12458 | $rtfeldman$elm_css$Css$paddingBottom( | ||
12459 | $rtfeldman$elm_css$Css$px(10)) | ||
12460 | ])); | ||
12461 | var $author$project$Signup$viewInput = F4( | ||
12462 | function (t, p, v, toMsg) { | ||
12463 | return A2( | ||
12464 | $author$project$Styles$loginInputField, | ||
12465 | _List_fromArray( | ||
12466 | [ | ||
12467 | $rtfeldman$elm_css$Html$Styled$Attributes$type_(t), | ||
12468 | $rtfeldman$elm_css$Html$Styled$Attributes$placeholder(p), | ||
12469 | $rtfeldman$elm_css$Html$Styled$Attributes$value(v), | ||
12470 | $rtfeldman$elm_css$Html$Styled$Events$onInput(toMsg) | ||
12471 | ]), | ||
12472 | _List_Nil); | ||
12473 | }); | ||
12474 | var $author$project$Signup$viewStatus = function (s) { | ||
12475 | switch (s.$) { | ||
12476 | case 'UsernameTaken': | ||
12477 | return 'This username is taken!'; | ||
12478 | case 'InvalidPhone': | ||
12479 | return 'Invalid phone number!'; | ||
12480 | case 'InvalidEmail': | ||
12481 | return 'Invalid email address!'; | ||
12482 | case 'CreatedSuccessfully': | ||
12483 | return 'User created successfully'; | ||
12484 | case 'CreatingUser': | ||
12485 | return 'Creating user ...'; | ||
12486 | default: | ||
12487 | return ''; | ||
12488 | } | ||
12489 | }; | ||
12490 | var $author$project$Signup$view = function (model) { | ||
12491 | return A2( | ||
12492 | $rtfeldman$elm_css$Html$Styled$div, | ||
12493 | _List_fromArray( | ||
12494 | [ | ||
12495 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12496 | _List_fromArray( | ||
12497 | [ | ||
12498 | $rtfeldman$elm_css$Css$margin($rtfeldman$elm_css$Css$auto), | ||
12499 | $rtfeldman$elm_css$Css$marginTop( | ||
12500 | $rtfeldman$elm_css$Css$pct(10)), | ||
12501 | $rtfeldman$elm_css$Css$padding( | ||
12502 | $rtfeldman$elm_css$Css$px(20)), | ||
12503 | $rtfeldman$elm_css$Css$width( | ||
12504 | $rtfeldman$elm_css$Css$pct(30)) | ||
12505 | ])) | ||
12506 | ]), | ||
12507 | _List_fromArray( | ||
12508 | [ | ||
12509 | A2( | ||
12510 | $rtfeldman$elm_css$Html$Styled$div, | ||
12511 | _List_fromArray( | ||
12512 | [ | ||
12513 | $author$project$Signup$fieldPadding, | ||
12514 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12515 | _List_fromArray( | ||
12516 | [$author$project$Styles$bigHeading])) | ||
12517 | ]), | ||
12518 | _List_fromArray( | ||
12519 | [ | ||
12520 | $rtfeldman$elm_css$Html$Styled$text('Signup') | ||
12521 | ])), | ||
12522 | A2( | ||
12523 | $rtfeldman$elm_css$Html$Styled$div, | ||
12524 | _List_fromArray( | ||
12525 | [$author$project$Signup$fieldPadding]), | ||
12526 | _List_fromArray( | ||
12527 | [ | ||
12528 | A4($author$project$Signup$viewInput, 'text', 'Username', model.username, $author$project$Signup$UserEntered) | ||
12529 | ])), | ||
12530 | A2( | ||
12531 | $rtfeldman$elm_css$Html$Styled$div, | ||
12532 | _List_fromArray( | ||
12533 | [$author$project$Signup$fieldPadding]), | ||
12534 | _List_fromArray( | ||
12535 | [ | ||
12536 | A4($author$project$Signup$viewInput, 'password', 'Password', model.password, $author$project$Signup$PassEntered) | ||
12537 | ])), | ||
12538 | A2( | ||
12539 | $rtfeldman$elm_css$Html$Styled$div, | ||
12540 | _List_fromArray( | ||
12541 | [$author$project$Signup$fieldPadding]), | ||
12542 | _List_fromArray( | ||
12543 | [ | ||
12544 | A4($author$project$Signup$viewInput, 'text', 'Email', model.emailId, $author$project$Signup$EmailEntered) | ||
12545 | ])), | ||
12546 | A2( | ||
12547 | $rtfeldman$elm_css$Html$Styled$div, | ||
12548 | _List_fromArray( | ||
12549 | [$author$project$Signup$fieldPadding]), | ||
12550 | _List_fromArray( | ||
12551 | [ | ||
12552 | A4($author$project$Signup$viewInput, 'text', 'Phone Number', model.phoneNumber, $author$project$Signup$PhoneEntered) | ||
12553 | ])), | ||
12554 | A2( | ||
12555 | $rtfeldman$elm_css$Html$Styled$div, | ||
12556 | _List_fromArray( | ||
12557 | [$author$project$Signup$fieldPadding]), | ||
12558 | _List_fromArray( | ||
12559 | [ | ||
12560 | A4( | ||
12561 | $author$project$Signup$viewInput, | ||
12562 | 'text', | ||
12563 | 'Shipping Address', | ||
12564 | A2($elm$core$Maybe$withDefault, '', model.address), | ||
12565 | $author$project$Signup$AddressEntered) | ||
12566 | ])), | ||
12567 | A2( | ||
12568 | $rtfeldman$elm_css$Html$Styled$div, | ||
12569 | _List_fromArray( | ||
12570 | [ | ||
12571 | $author$project$Signup$fieldPadding, | ||
12572 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12573 | _List_fromArray( | ||
12574 | [ | ||
12575 | $rtfeldman$elm_css$Css$textAlign($rtfeldman$elm_css$Css$center) | ||
12576 | ])) | ||
12577 | ]), | ||
12578 | _List_fromArray( | ||
12579 | [ | ||
12580 | A2( | ||
12581 | $author$project$Styles$furbyButton, | ||
12582 | _List_fromArray( | ||
12583 | [ | ||
12584 | $rtfeldman$elm_css$Html$Styled$Events$onClick($author$project$Signup$CreatePressed) | ||
12585 | ]), | ||
12586 | _List_fromArray( | ||
12587 | [ | ||
12588 | $rtfeldman$elm_css$Html$Styled$text('Create Account') | ||
12589 | ])) | ||
12590 | ])), | ||
12591 | A2( | ||
12592 | $rtfeldman$elm_css$Html$Styled$div, | ||
12593 | _List_fromArray( | ||
12594 | [$author$project$Signup$fieldPadding]), | ||
12595 | _List_fromArray( | ||
12596 | [ | ||
12597 | $rtfeldman$elm_css$Html$Styled$text('Already have a account? '), | ||
12598 | A2( | ||
12599 | $rtfeldman$elm_css$Html$Styled$a, | ||
12600 | _List_fromArray( | ||
12601 | [ | ||
12602 | $rtfeldman$elm_css$Html$Styled$Attributes$href('/login') | ||
12603 | ]), | ||
12604 | _List_fromArray( | ||
12605 | [ | ||
12606 | $rtfeldman$elm_css$Html$Styled$text('Login >') | ||
12607 | ])) | ||
12608 | ])), | ||
12609 | $rtfeldman$elm_css$Html$Styled$text( | ||
12610 | $author$project$Signup$viewStatus(model.status)) | ||
12611 | ])); | ||
12612 | }; | ||
12613 | var $author$project$Main$view = function (model) { | ||
12614 | var _v0 = model.location; | ||
12615 | switch (_v0.$) { | ||
12616 | case 'HomePage': | ||
12617 | return { | ||
12618 | body: $elm$core$List$singleton( | ||
12619 | $rtfeldman$elm_css$Html$Styled$toUnstyled( | ||
12620 | A2( | ||
12621 | $rtfeldman$elm_css$Html$Styled$div, | ||
12622 | _List_Nil, | ||
12623 | _List_fromArray( | ||
12624 | [ | ||
12625 | A2( | ||
12626 | $rtfeldman$elm_css$Html$Styled$ul, | ||
12627 | _List_Nil, | ||
12628 | A2( | ||
12629 | $elm$core$List$map, | ||
12630 | function (l) { | ||
12631 | return A2( | ||
12632 | $rtfeldman$elm_css$Html$Styled$li, | ||
12633 | _List_Nil, | ||
12634 | _List_fromArray( | ||
12635 | [ | ||
12636 | A2( | ||
12637 | $rtfeldman$elm_css$Html$Styled$a, | ||
12638 | _List_fromArray( | ||
12639 | [ | ||
12640 | $rtfeldman$elm_css$Html$Styled$Attributes$href(l) | ||
12641 | ]), | ||
12642 | _List_fromArray( | ||
12643 | [ | ||
12644 | $rtfeldman$elm_css$Html$Styled$text(l) | ||
12645 | ])) | ||
12646 | ])); | ||
12647 | }, | ||
12648 | _List_fromArray( | ||
12649 | ['/login', '/catalog', '/cart']))) | ||
12650 | ])))), | ||
12651 | title: 'Login' | ||
12652 | }; | ||
12653 | case 'LoginPage': | ||
12654 | return { | ||
12655 | body: $elm$core$List$singleton( | ||
12656 | $rtfeldman$elm_css$Html$Styled$toUnstyled( | ||
12657 | A2( | ||
12658 | $rtfeldman$elm_css$Html$Styled$map, | ||
12659 | $author$project$Main$LoginMessage, | ||
12660 | $author$project$Login$view(model.loginModel)))), | ||
12661 | title: 'Login' | ||
12662 | }; | ||
12663 | case 'SignupPage': | ||
12664 | return { | ||
12665 | body: $elm$core$List$singleton( | ||
12666 | $rtfeldman$elm_css$Html$Styled$toUnstyled( | ||
12667 | A2( | ||
12668 | $rtfeldman$elm_css$Html$Styled$map, | ||
12669 | $author$project$Main$SignupMessage, | ||
12670 | $author$project$Signup$view(model.signupModel)))), | ||
12671 | title: 'Signup' | ||
12672 | }; | ||
12673 | case 'NotFoundPage': | ||
12674 | return { | ||
12675 | body: $elm$core$List$singleton( | ||
12676 | $rtfeldman$elm_css$Html$Styled$toUnstyled( | ||
12677 | A2( | ||
12678 | $rtfeldman$elm_css$Html$Styled$div, | ||
12679 | _List_Nil, | ||
12680 | _List_fromArray( | ||
12681 | [ | ||
12682 | $rtfeldman$elm_css$Html$Styled$text('404 - Not Found'), | ||
12683 | A2( | ||
12684 | $rtfeldman$elm_css$Html$Styled$a, | ||
12685 | _List_fromArray( | ||
12686 | [ | ||
12687 | $rtfeldman$elm_css$Html$Styled$Attributes$href('/') | ||
12688 | ]), | ||
12689 | _List_fromArray( | ||
12690 | [ | ||
12691 | $rtfeldman$elm_css$Html$Styled$text('Go back >') | ||
12692 | ])) | ||
12693 | ])))), | ||
12694 | title: '404 - Not Found' | ||
12695 | }; | ||
12696 | case 'CatalogPage': | ||
12697 | return { | ||
12698 | body: A2( | ||
12699 | $author$project$Main$pageWrap, | ||
12700 | model, | ||
12701 | A2( | ||
12702 | $rtfeldman$elm_css$Html$Styled$map, | ||
12703 | $author$project$Main$CatalogMessage, | ||
12704 | $author$project$Catalog$view(model.catalogModel))), | ||
12705 | title: 'Catalog' | ||
12706 | }; | ||
12707 | case 'CartPage': | ||
12708 | return { | ||
12709 | body: A2( | ||
12710 | $author$project$Main$pageWrap, | ||
12711 | model, | ||
12712 | A2( | ||
12713 | $rtfeldman$elm_css$Html$Styled$map, | ||
12714 | $author$project$Main$CartMessage, | ||
12715 | $author$project$Cart$view(model.cartModel))), | ||
12716 | title: 'Cart' | ||
12717 | }; | ||
12718 | case 'CheckoutPage': | ||
12719 | return { | ||
12720 | body: A2( | ||
12721 | $author$project$Main$pageWrap, | ||
12722 | model, | ||
12723 | A2( | ||
12724 | $rtfeldman$elm_css$Html$Styled$map, | ||
12725 | $author$project$Main$CheckoutMessage, | ||
12726 | $author$project$Checkout$view(model.checkoutModel))), | ||
12727 | title: 'Checkout' | ||
12728 | }; | ||
12729 | default: | ||
12730 | var item = _v0.a; | ||
12731 | return { | ||
12732 | body: A2( | ||
12733 | $author$project$Main$pageWrap, | ||
12734 | model, | ||
12735 | A2( | ||
12736 | $rtfeldman$elm_css$Html$Styled$map, | ||
12737 | $author$project$Main$ProductMessage, | ||
12738 | $author$project$Product$view(model.productModel))), | ||
12739 | title: 'Product ' + $elm$core$String$fromInt(item) | ||
12740 | }; | ||
12741 | } | ||
12742 | }; | ||
12743 | var $author$project$Main$main = $elm$browser$Browser$application( | ||
12744 | {init: $author$project$Main$init, onUrlChange: $author$project$Main$UrlChanged, onUrlRequest: $author$project$Main$LinkClicked, subscriptions: $author$project$Main$subscriptions, update: $author$project$Main$update, view: $author$project$Main$view}); | ||
12745 | _Platform_export({'Main':{'init':$author$project$Main$main( | ||
12746 | $elm$json$Json$Decode$succeed(_Utils_Tuple0))(0)}});}(this)); | ||
12747 | |||
12748 | var app = Elm.Main.init({ node: document.getElementById("elm") }); | ||
12749 | } | ||
12750 | catch (e) | ||
12751 | { | ||
12752 | // display initialization errors (e.g. bad flags, infinite recursion) | ||
12753 | var header = document.createElement("h1"); | ||
12754 | header.style.fontFamily = "monospace"; | ||
12755 | header.innerText = "Initialization Error"; | ||
12756 | var pre = document.getElementById("elm"); | ||
12757 | document.body.insertBefore(header, pre); | ||
12758 | pre.innerText = e; | ||
12759 | throw e; | ||
12760 | } | ||
12761 | </script> | ||
12762 | |||
12763 | </body> | ||
12764 | </html> \ No newline at end of file | ||
diff --git a/frontend/main.html b/frontend/main.html new file mode 100644 index 0000000..887c60a --- /dev/null +++ b/frontend/main.html | |||
@@ -0,0 +1,21 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html> | ||
3 | <head> | ||
4 | <meta charset="utf-8"> | ||
5 | <title>hello-world</title> | ||
6 | <script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"></script> | ||
7 | <script src="main.js"></script> | ||
8 | <link rel="preconnect" href="https://fonts.gstatic.com"> | ||
9 | <link href="https://fonts.googleapis.com/css2?family=Rubik:wght@400;600&display=swap" rel="stylesheet"> | ||
10 | <style> | ||
11 | * { | ||
12 | font-family: 'Rubik', sans-serif; | ||
13 | } | ||
14 | </style> | ||
15 | </head> | ||
16 | <body> | ||
17 | <script>var app = Elm.Main.init();</script> | ||
18 | </body> | ||
19 | </html> | ||
20 | |||
21 | |||
diff --git a/frontend/main.js b/frontend/main.js index 931d7ae..9d33498 100644 --- a/frontend/main.js +++ b/frontend/main.js | |||
@@ -5430,7 +5430,7 @@ var $author$project$Product$Product = F7( | |||
5430 | return {description: description, id: id, iosSrc: iosSrc, kind: kind, name: name, price: price, src: src}; | 5430 | return {description: description, id: id, iosSrc: iosSrc, kind: kind, name: name, price: price, src: src}; |
5431 | }); | 5431 | }); |
5432 | var $author$project$Product$emptyProduct = A7($author$project$Product$Product, -1, '', $elm$core$Maybe$Nothing, 0, $elm$core$Maybe$Nothing, '', ''); | 5432 | var $author$project$Product$emptyProduct = A7($author$project$Product$Product, -1, '', $elm$core$Maybe$Nothing, 0, $elm$core$Maybe$Nothing, '', ''); |
5433 | var $author$project$Product$init = A6($author$project$Product$Model, $author$project$Product$NotLoaded, $author$project$Product$emptyProduct, _List_Nil, 0, '', $author$project$Product$NotSubmitted); | 5433 | var $author$project$Product$init = A6($author$project$Product$Model, $author$project$Product$NotLoaded, $author$project$Product$emptyProduct, _List_Nil, 5, '', $author$project$Product$NotSubmitted); |
5434 | var $author$project$Signup$Empty = {$: 'Empty'}; | 5434 | var $author$project$Signup$Empty = {$: 'Empty'}; |
5435 | var $author$project$Signup$Model = F6( | 5435 | var $author$project$Signup$Model = F6( |
5436 | function (username, password, phoneNumber, emailId, address, status) { | 5436 | function (username, password, phoneNumber, emailId, address, status) { |
@@ -6382,13 +6382,13 @@ var $author$project$Product$fetchListing = function (id) { | |||
6382 | var $author$project$Catalog$ProductsLoaded = function (a) { | 6382 | var $author$project$Catalog$ProductsLoaded = function (a) { |
6383 | return {$: 'ProductsLoaded', a: a}; | 6383 | return {$: 'ProductsLoaded', a: a}; |
6384 | }; | 6384 | }; |
6385 | var $author$project$Catalog$Product = F6( | 6385 | var $author$project$Catalog$Product = F8( |
6386 | function (id, name, kind, price, description, averageRating) { | 6386 | function (id, name, kind, price, description, averageRating, src, iosSrc) { |
6387 | return {averageRating: averageRating, description: description, id: id, kind: kind, name: name, price: price}; | 6387 | return {averageRating: averageRating, description: description, id: id, iosSrc: iosSrc, kind: kind, name: name, price: price, src: src}; |
6388 | }); | 6388 | }); |
6389 | var $elm$json$Json$Decode$map6 = _Json_map6; | 6389 | var $elm$json$Json$Decode$map8 = _Json_map8; |
6390 | var $author$project$Catalog$decodeProduct = A7( | 6390 | var $author$project$Catalog$decodeProduct = A9( |
6391 | $elm$json$Json$Decode$map6, | 6391 | $elm$json$Json$Decode$map8, |
6392 | $author$project$Catalog$Product, | 6392 | $author$project$Catalog$Product, |
6393 | A2($elm$json$Json$Decode$field, 'id', $elm$json$Json$Decode$int), | 6393 | A2($elm$json$Json$Decode$field, 'id', $elm$json$Json$Decode$int), |
6394 | A2($elm$json$Json$Decode$field, 'name', $elm$json$Json$Decode$string), | 6394 | A2($elm$json$Json$Decode$field, 'name', $elm$json$Json$Decode$string), |
@@ -6404,7 +6404,9 @@ var $author$project$Catalog$decodeProduct = A7( | |||
6404 | A2( | 6404 | A2( |
6405 | $elm$json$Json$Decode$field, | 6405 | $elm$json$Json$Decode$field, |
6406 | 'average_rating', | 6406 | 'average_rating', |
6407 | $elm$json$Json$Decode$nullable($elm$json$Json$Decode$float))); | 6407 | $elm$json$Json$Decode$nullable($elm$json$Json$Decode$float)), |
6408 | A2($elm$json$Json$Decode$field, 'src', $elm$json$Json$Decode$string), | ||
6409 | A2($elm$json$Json$Decode$field, 'ios_src', $elm$json$Json$Decode$string)); | ||
6408 | var $author$project$Catalog$decodeResponse = $elm$json$Json$Decode$list($author$project$Catalog$decodeProduct); | 6410 | var $author$project$Catalog$decodeResponse = $elm$json$Json$Decode$list($author$project$Catalog$decodeProduct); |
6409 | var $author$project$Catalog$fetchProducts = function () { | 6411 | var $author$project$Catalog$fetchProducts = function () { |
6410 | var _v0 = A2($elm$core$Debug$log, 'err', 'fetching products'); | 6412 | var _v0 = A2($elm$core$Debug$log, 'err', 'fetching products'); |
@@ -10086,6 +10088,7 @@ var $rtfeldman$elm_css$Css$prop1 = F2( | |||
10086 | }); | 10088 | }); |
10087 | var $rtfeldman$elm_css$Css$display = $rtfeldman$elm_css$Css$prop1('display'); | 10089 | var $rtfeldman$elm_css$Css$display = $rtfeldman$elm_css$Css$prop1('display'); |
10088 | var $rtfeldman$elm_css$Css$border = $rtfeldman$elm_css$Css$prop1('border'); | 10090 | var $rtfeldman$elm_css$Css$border = $rtfeldman$elm_css$Css$prop1('border'); |
10091 | var $rtfeldman$elm_css$Css$borderRadius = $rtfeldman$elm_css$Css$prop1('border-radius'); | ||
10089 | var $rtfeldman$elm_css$Html$Styled$button = $rtfeldman$elm_css$Html$Styled$node('button'); | 10092 | var $rtfeldman$elm_css$Html$Styled$button = $rtfeldman$elm_css$Html$Styled$node('button'); |
10090 | var $rtfeldman$elm_css$Css$color = function (c) { | 10093 | var $rtfeldman$elm_css$Css$color = function (c) { |
10091 | return A2($rtfeldman$elm_css$Css$property, 'color', c.value); | 10094 | return A2($rtfeldman$elm_css$Css$property, 'color', c.value); |
@@ -10541,6 +10544,8 @@ var $author$project$Styles$furbyButton = A2( | |||
10541 | $rtfeldman$elm_css$Css$px(40)), | 10544 | $rtfeldman$elm_css$Css$px(40)), |
10542 | $rtfeldman$elm_css$Css$border( | 10545 | $rtfeldman$elm_css$Css$border( |
10543 | $rtfeldman$elm_css$Css$px(0)), | 10546 | $rtfeldman$elm_css$Css$px(0)), |
10547 | $rtfeldman$elm_css$Css$borderRadius( | ||
10548 | $rtfeldman$elm_css$Css$px(2)), | ||
10544 | A2( | 10549 | A2( |
10545 | $rtfeldman$elm_css$Css$padding2, | 10550 | $rtfeldman$elm_css$Css$padding2, |
10546 | $rtfeldman$elm_css$Css$px(6), | 10551 | $rtfeldman$elm_css$Css$px(6), |
@@ -10717,7 +10722,9 @@ var $author$project$Main$viewHeader = function (model) { | |||
10717 | [ | 10722 | [ |
10718 | $rtfeldman$elm_css$Css$listStyle($rtfeldman$elm_css$Css$none), | 10723 | $rtfeldman$elm_css$Css$listStyle($rtfeldman$elm_css$Css$none), |
10719 | $rtfeldman$elm_css$Css$padding( | 10724 | $rtfeldman$elm_css$Css$padding( |
10720 | $rtfeldman$elm_css$Css$px(0)) | 10725 | $rtfeldman$elm_css$Css$px(0)), |
10726 | $rtfeldman$elm_css$Css$margin( | ||
10727 | $rtfeldman$elm_css$Css$px(24)) | ||
10721 | ])) | 10728 | ])) |
10722 | ]), | 10729 | ]), |
10723 | _Utils_ap( | 10730 | _Utils_ap( |
@@ -11228,70 +11235,260 @@ var $author$project$Catalog$viewFilters = function (model) { | |||
11228 | ])) | 11235 | ])) |
11229 | ])); | 11236 | ])); |
11230 | }; | 11237 | }; |
11238 | var $elm$virtual_dom$VirtualDom$attribute = F2( | ||
11239 | function (key, value) { | ||
11240 | return A2( | ||
11241 | _VirtualDom_attribute, | ||
11242 | _VirtualDom_noOnOrFormAction(key), | ||
11243 | _VirtualDom_noJavaScriptOrHtmlUri(value)); | ||
11244 | }); | ||
11245 | var $rtfeldman$elm_css$VirtualDom$Styled$attribute = F2( | ||
11246 | function (key, value) { | ||
11247 | return A3( | ||
11248 | $rtfeldman$elm_css$VirtualDom$Styled$Attribute, | ||
11249 | A2($elm$virtual_dom$VirtualDom$attribute, key, value), | ||
11250 | _List_Nil, | ||
11251 | ''); | ||
11252 | }); | ||
11253 | var $rtfeldman$elm_css$Html$Styled$Attributes$attribute = $rtfeldman$elm_css$VirtualDom$Styled$attribute; | ||
11254 | var $author$project$Utils$arIosSrc = function (src) { | ||
11255 | return A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'ios-src', src); | ||
11256 | }; | ||
11257 | var $author$project$Utils$arModes = function (mode) { | ||
11258 | return A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'ar-modes', mode); | ||
11259 | }; | ||
11260 | var $author$project$Utils$arSrc = function (src) { | ||
11261 | return A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'src', src); | ||
11262 | }; | ||
11263 | var $author$project$Utils$autoRotate = A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'auto-rotate', ''); | ||
11264 | var $rtfeldman$elm_css$Css$bold = {fontWeight: $rtfeldman$elm_css$Css$Structure$Compatible, value: 'bold'}; | ||
11265 | var $rtfeldman$elm_css$Css$border3 = $rtfeldman$elm_css$Css$prop3('border'); | ||
11266 | var $author$project$Utils$cameraControls = A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'camera-controls', ''); | ||
11267 | var $author$project$Styles$cardPrimaryText = $rtfeldman$elm_css$Css$fontSize( | ||
11268 | $rtfeldman$elm_css$Css$px(18)); | ||
11269 | var $rtfeldman$elm_css$Css$batch = $rtfeldman$elm_css$Css$Preprocess$ApplyStyles; | ||
11270 | var $author$project$Styles$cardSecondaryText = $rtfeldman$elm_css$Css$batch( | ||
11271 | _List_fromArray( | ||
11272 | [ | ||
11273 | $rtfeldman$elm_css$Css$color($author$project$Styles$theme.fgLight), | ||
11274 | $rtfeldman$elm_css$Css$fontSize( | ||
11275 | $rtfeldman$elm_css$Css$px(12)) | ||
11276 | ])); | ||
11277 | var $author$project$Styles$cardSupportingText = $rtfeldman$elm_css$Css$fontSize( | ||
11278 | $rtfeldman$elm_css$Css$px(16)); | ||
11279 | var $rtfeldman$elm_css$Css$fontVariant = $rtfeldman$elm_css$Css$prop1('font-variant'); | ||
11280 | var $rtfeldman$elm_css$Css$fontWeight = function (_v0) { | ||
11281 | var value = _v0.value; | ||
11282 | return A2($rtfeldman$elm_css$Css$property, 'font-weight', value); | ||
11283 | }; | ||
11284 | var $author$project$Utils$loading = function (mode) { | ||
11285 | return A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'loading', mode); | ||
11286 | }; | ||
11287 | var $rtfeldman$elm_css$Css$marginBottom = $rtfeldman$elm_css$Css$prop1('margin-bottom'); | ||
11288 | var $rtfeldman$elm_css$Css$maxWidth = $rtfeldman$elm_css$Css$prop1('max-width'); | ||
11289 | var $author$project$Utils$modelViewer = F2( | ||
11290 | function (attributes, children) { | ||
11291 | return A3($rtfeldman$elm_css$Html$Styled$node, 'model-viewer', attributes, children); | ||
11292 | }); | ||
11293 | var $rtfeldman$elm_css$Css$Structure$PseudoElement = function (a) { | ||
11294 | return {$: 'PseudoElement', a: a}; | ||
11295 | }; | ||
11296 | var $rtfeldman$elm_css$Css$Preprocess$WithPseudoElement = F2( | ||
11297 | function (a, b) { | ||
11298 | return {$: 'WithPseudoElement', a: a, b: b}; | ||
11299 | }); | ||
11300 | var $rtfeldman$elm_css$Css$pseudoElement = function (element) { | ||
11301 | return $rtfeldman$elm_css$Css$Preprocess$WithPseudoElement( | ||
11302 | $rtfeldman$elm_css$Css$Structure$PseudoElement(element)); | ||
11303 | }; | ||
11304 | var $rtfeldman$elm_css$Css$before = $rtfeldman$elm_css$Css$pseudoElement('before'); | ||
11305 | var $author$project$Styles$money = $rtfeldman$elm_css$Css$before( | ||
11306 | _List_fromArray( | ||
11307 | [ | ||
11308 | A2($rtfeldman$elm_css$Css$property, 'content', '\"₹ \"') | ||
11309 | ])); | ||
11310 | var $rtfeldman$elm_css$Css$smallCaps = {fontVariant: $rtfeldman$elm_css$Css$Structure$Compatible, fontVariantCaps: $rtfeldman$elm_css$Css$Structure$Compatible, value: 'small-caps'}; | ||
11311 | var $rtfeldman$elm_css$Css$width = $rtfeldman$elm_css$Css$prop1('width'); | ||
11231 | var $author$project$Catalog$viewProduct = function (p) { | 11312 | var $author$project$Catalog$viewProduct = function (p) { |
11232 | return A2( | 11313 | return A2( |
11233 | $rtfeldman$elm_css$Html$Styled$div, | 11314 | $rtfeldman$elm_css$Html$Styled$div, |
11234 | _List_Nil, | ||
11235 | _List_fromArray( | 11315 | _List_fromArray( |
11236 | [ | 11316 | [ |
11237 | A2( | 11317 | $rtfeldman$elm_css$Html$Styled$Attributes$css( |
11238 | $rtfeldman$elm_css$Html$Styled$div, | ||
11239 | _List_Nil, | ||
11240 | _List_fromArray( | 11318 | _List_fromArray( |
11241 | [ | 11319 | [ |
11242 | $rtfeldman$elm_css$Html$Styled$text(p.name) | 11320 | $rtfeldman$elm_css$Css$marginBottom( |
11243 | ])), | 11321 | $rtfeldman$elm_css$Css$px(20)), |
11322 | A3( | ||
11323 | $rtfeldman$elm_css$Css$border3, | ||
11324 | $rtfeldman$elm_css$Css$px(1), | ||
11325 | $rtfeldman$elm_css$Css$solid, | ||
11326 | $author$project$Styles$theme.primary), | ||
11327 | $rtfeldman$elm_css$Css$borderRadius( | ||
11328 | $rtfeldman$elm_css$Css$px(4)), | ||
11329 | $rtfeldman$elm_css$Css$padding( | ||
11330 | $rtfeldman$elm_css$Css$px(20)), | ||
11331 | $rtfeldman$elm_css$Css$width( | ||
11332 | $rtfeldman$elm_css$Css$pct(100)), | ||
11333 | $rtfeldman$elm_css$Css$maxWidth( | ||
11334 | $rtfeldman$elm_css$Css$px(650)) | ||
11335 | ])) | ||
11336 | ]), | ||
11337 | _List_fromArray( | ||
11338 | [ | ||
11244 | A2( | 11339 | A2( |
11245 | $rtfeldman$elm_css$Html$Styled$div, | 11340 | $rtfeldman$elm_css$Html$Styled$div, |
11246 | _List_Nil, | ||
11247 | _List_fromArray( | 11341 | _List_fromArray( |
11248 | [ | 11342 | [ |
11249 | $rtfeldman$elm_css$Html$Styled$text( | 11343 | $rtfeldman$elm_css$Html$Styled$Attributes$css( |
11250 | A2($elm$core$Maybe$withDefault, '', p.kind)) | 11344 | _List_fromArray( |
11251 | ])), | 11345 | [ |
11252 | A2( | 11346 | $rtfeldman$elm_css$Css$float($rtfeldman$elm_css$Css$left), |
11253 | $rtfeldman$elm_css$Html$Styled$div, | 11347 | $rtfeldman$elm_css$Css$width( |
11254 | _List_Nil, | 11348 | $rtfeldman$elm_css$Css$pct(50)) |
11349 | ])) | ||
11350 | ]), | ||
11255 | _List_fromArray( | 11351 | _List_fromArray( |
11256 | [ | 11352 | [ |
11257 | $rtfeldman$elm_css$Html$Styled$text( | 11353 | A2( |
11258 | A2($elm$core$Maybe$withDefault, '', p.description)) | 11354 | $author$project$Utils$modelViewer, |
11355 | _List_fromArray( | ||
11356 | [ | ||
11357 | $author$project$Utils$cameraControls, | ||
11358 | $author$project$Utils$autoRotate, | ||
11359 | $author$project$Utils$arSrc(p.src), | ||
11360 | $author$project$Utils$arIosSrc(p.iosSrc), | ||
11361 | $author$project$Utils$loading('eager'), | ||
11362 | $author$project$Utils$arModes('webxr') | ||
11363 | ]), | ||
11364 | _List_Nil) | ||
11259 | ])), | 11365 | ])), |
11260 | A2( | 11366 | A2( |
11261 | $rtfeldman$elm_css$Html$Styled$div, | 11367 | $rtfeldman$elm_css$Html$Styled$div, |
11262 | _List_Nil, | ||
11263 | _List_fromArray( | 11368 | _List_fromArray( |
11264 | [ | 11369 | [ |
11265 | $rtfeldman$elm_css$Html$Styled$text( | 11370 | $rtfeldman$elm_css$Html$Styled$Attributes$css( |
11266 | $elm$core$String$fromFloat(p.price)) | 11371 | _List_fromArray( |
11267 | ])), | 11372 | [ |
11268 | function () { | 11373 | $rtfeldman$elm_css$Css$float($rtfeldman$elm_css$Css$left), |
11269 | var _v0 = p.averageRating; | 11374 | $rtfeldman$elm_css$Css$width( |
11270 | if (_v0.$ === 'Just') { | 11375 | $rtfeldman$elm_css$Css$pct(50)) |
11271 | var v = _v0.a; | 11376 | ])) |
11272 | return $rtfeldman$elm_css$Html$Styled$text( | 11377 | ]), |
11273 | 'Avg Rating: ' + $elm$core$String$fromFloat(v)); | ||
11274 | } else { | ||
11275 | return $rtfeldman$elm_css$Html$Styled$text('No Ratings'); | ||
11276 | } | ||
11277 | }(), | ||
11278 | A2( | ||
11279 | $rtfeldman$elm_css$Html$Styled$div, | ||
11280 | _List_Nil, | ||
11281 | _List_fromArray( | 11378 | _List_fromArray( |
11282 | [ | 11379 | [ |
11283 | A2( | 11380 | A2( |
11284 | $rtfeldman$elm_css$Html$Styled$a, | 11381 | $rtfeldman$elm_css$Html$Styled$div, |
11285 | _List_fromArray( | 11382 | _List_fromArray( |
11286 | [ | 11383 | [ |
11287 | $rtfeldman$elm_css$Html$Styled$Attributes$href( | 11384 | $rtfeldman$elm_css$Html$Styled$Attributes$css( |
11288 | '/product/' + $elm$core$String$fromInt(p.id)) | 11385 | _List_fromArray( |
11386 | [ | ||
11387 | $author$project$Styles$cardSecondaryText, | ||
11388 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11389 | $rtfeldman$elm_css$Css$px(3)), | ||
11390 | $rtfeldman$elm_css$Css$fontVariant($rtfeldman$elm_css$Css$smallCaps) | ||
11391 | ])) | ||
11289 | ]), | 11392 | ]), |
11290 | _List_fromArray( | 11393 | _List_fromArray( |
11291 | [ | 11394 | [ |
11292 | $rtfeldman$elm_css$Html$Styled$text('View Product') | 11395 | $rtfeldman$elm_css$Html$Styled$text( |
11396 | A2($elm$core$Maybe$withDefault, '', p.kind)) | ||
11397 | ])), | ||
11398 | A2( | ||
11399 | $rtfeldman$elm_css$Html$Styled$div, | ||
11400 | _List_fromArray( | ||
11401 | [ | ||
11402 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11403 | _List_fromArray( | ||
11404 | [ | ||
11405 | $author$project$Styles$cardPrimaryText, | ||
11406 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11407 | $rtfeldman$elm_css$Css$px(3)) | ||
11408 | ])) | ||
11409 | ]), | ||
11410 | _List_fromArray( | ||
11411 | [ | ||
11412 | A2( | ||
11413 | $rtfeldman$elm_css$Html$Styled$a, | ||
11414 | _List_fromArray( | ||
11415 | [ | ||
11416 | $rtfeldman$elm_css$Html$Styled$Attributes$href( | ||
11417 | '/product/' + $elm$core$String$fromInt(p.id)) | ||
11418 | ]), | ||
11419 | _List_fromArray( | ||
11420 | [ | ||
11421 | $rtfeldman$elm_css$Html$Styled$text(p.name) | ||
11422 | ])) | ||
11423 | ])), | ||
11424 | A2( | ||
11425 | $rtfeldman$elm_css$Html$Styled$div, | ||
11426 | _List_fromArray( | ||
11427 | [ | ||
11428 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11429 | _List_fromArray( | ||
11430 | [ | ||
11431 | $author$project$Styles$cardSecondaryText, | ||
11432 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11433 | $rtfeldman$elm_css$Css$px(12)) | ||
11434 | ])) | ||
11435 | ]), | ||
11436 | _List_fromArray( | ||
11437 | [ | ||
11438 | function () { | ||
11439 | var _v0 = p.averageRating; | ||
11440 | if (_v0.$ === 'Just') { | ||
11441 | var v = _v0.a; | ||
11442 | return $rtfeldman$elm_css$Html$Styled$text( | ||
11443 | 'Avg Rating: ' + $elm$core$String$fromFloat(v)); | ||
11444 | } else { | ||
11445 | return $rtfeldman$elm_css$Html$Styled$text('No Ratings'); | ||
11446 | } | ||
11447 | }() | ||
11448 | ])), | ||
11449 | A2( | ||
11450 | $rtfeldman$elm_css$Html$Styled$div, | ||
11451 | _List_fromArray( | ||
11452 | [ | ||
11453 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11454 | _List_fromArray( | ||
11455 | [ | ||
11456 | $author$project$Styles$cardSupportingText, | ||
11457 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11458 | $rtfeldman$elm_css$Css$px(6)) | ||
11459 | ])) | ||
11460 | ]), | ||
11461 | _List_fromArray( | ||
11462 | [ | ||
11463 | $rtfeldman$elm_css$Html$Styled$text( | ||
11464 | A2($elm$core$Maybe$withDefault, 'No description provided', p.description)) | ||
11465 | ])), | ||
11466 | A2( | ||
11467 | $rtfeldman$elm_css$Html$Styled$div, | ||
11468 | _List_fromArray( | ||
11469 | [ | ||
11470 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11471 | _List_fromArray( | ||
11472 | [ | ||
11473 | $rtfeldman$elm_css$Css$fontWeight($rtfeldman$elm_css$Css$bold), | ||
11474 | $rtfeldman$elm_css$Css$fontSize( | ||
11475 | $rtfeldman$elm_css$Css$px(14)), | ||
11476 | $author$project$Styles$money | ||
11477 | ])) | ||
11478 | ]), | ||
11479 | _List_fromArray( | ||
11480 | [ | ||
11481 | $rtfeldman$elm_css$Html$Styled$text( | ||
11482 | $elm$core$String$fromFloat(p.price)) | ||
11293 | ])) | 11483 | ])) |
11294 | ])) | 11484 | ])), |
11485 | A2( | ||
11486 | $rtfeldman$elm_css$Html$Styled$div, | ||
11487 | _List_fromArray( | ||
11488 | [ | ||
11489 | A2($rtfeldman$elm_css$Html$Styled$Attributes$style, 'clear', 'both') | ||
11490 | ]), | ||
11491 | _List_Nil) | ||
11295 | ])); | 11492 | ])); |
11296 | }; | 11493 | }; |
11297 | var $author$project$Catalog$viewStatus = function (s) { | 11494 | var $author$project$Catalog$viewStatus = function (s) { |
@@ -11304,7 +11501,6 @@ var $author$project$Catalog$viewStatus = function (s) { | |||
11304 | return 'Not loaded ...'; | 11501 | return 'Not loaded ...'; |
11305 | } | 11502 | } |
11306 | }; | 11503 | }; |
11307 | var $rtfeldman$elm_css$Css$width = $rtfeldman$elm_css$Css$prop1('width'); | ||
11308 | var $author$project$Catalog$view = function (model) { | 11504 | var $author$project$Catalog$view = function (model) { |
11309 | var _v0 = model.pageStatus; | 11505 | var _v0 = model.pageStatus; |
11310 | if (_v0.$ === 'Loading') { | 11506 | if (_v0.$ === 'Loading') { |
@@ -11380,7 +11576,8 @@ var $author$project$Catalog$view = function (model) { | |||
11380 | _List_fromArray( | 11576 | _List_fromArray( |
11381 | [ | 11577 | [ |
11382 | $rtfeldman$elm_css$Css$padding( | 11578 | $rtfeldman$elm_css$Css$padding( |
11383 | $rtfeldman$elm_css$Css$px(0)) | 11579 | $rtfeldman$elm_css$Css$px(0)), |
11580 | $rtfeldman$elm_css$Css$listStyle($rtfeldman$elm_css$Css$none) | ||
11384 | ])) | 11581 | ])) |
11385 | ]), | 11582 | ]), |
11386 | A2( | 11583 | A2( |
@@ -11685,7 +11882,6 @@ var $author$project$Product$AddRatingComment = function (a) { | |||
11685 | return {$: 'AddRatingComment', a: a}; | 11882 | return {$: 'AddRatingComment', a: a}; |
11686 | }; | 11883 | }; |
11687 | var $author$project$Product$AddRatingPressed = {$: 'AddRatingPressed'}; | 11884 | var $author$project$Product$AddRatingPressed = {$: 'AddRatingPressed'}; |
11688 | var $author$project$Product$AddToCartPressed = {$: 'AddToCartPressed'}; | ||
11689 | var $author$project$Product$viewInput = F4( | 11885 | var $author$project$Product$viewInput = F4( |
11690 | function (t, p, v, toMsg) { | 11886 | function (t, p, v, toMsg) { |
11691 | return A2( | 11887 | return A2( |
@@ -11699,80 +11895,37 @@ var $author$project$Product$viewInput = F4( | |||
11699 | ]), | 11895 | ]), |
11700 | _List_Nil); | 11896 | _List_Nil); |
11701 | }); | 11897 | }); |
11702 | var $elm$virtual_dom$VirtualDom$attribute = F2( | 11898 | var $author$project$Product$AddToCartPressed = {$: 'AddToCartPressed'}; |
11703 | function (key, value) { | ||
11704 | return A2( | ||
11705 | _VirtualDom_attribute, | ||
11706 | _VirtualDom_noOnOrFormAction(key), | ||
11707 | _VirtualDom_noJavaScriptOrHtmlUri(value)); | ||
11708 | }); | ||
11709 | var $rtfeldman$elm_css$VirtualDom$Styled$attribute = F2( | ||
11710 | function (key, value) { | ||
11711 | return A3( | ||
11712 | $rtfeldman$elm_css$VirtualDom$Styled$Attribute, | ||
11713 | A2($elm$virtual_dom$VirtualDom$attribute, key, value), | ||
11714 | _List_Nil, | ||
11715 | ''); | ||
11716 | }); | ||
11717 | var $rtfeldman$elm_css$Html$Styled$Attributes$attribute = $rtfeldman$elm_css$VirtualDom$Styled$attribute; | ||
11718 | var $author$project$Utils$arIosSrc = function (src) { | ||
11719 | return A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'ios-src', src); | ||
11720 | }; | ||
11721 | var $author$project$Utils$arModes = function (mode) { | ||
11722 | return A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'ar-modes', mode); | ||
11723 | }; | ||
11724 | var $author$project$Utils$arSrc = function (src) { | ||
11725 | return A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'src', src); | ||
11726 | }; | ||
11727 | var $author$project$Utils$autoRotate = A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'auto-rotate', ''); | ||
11728 | var $author$project$Utils$cameraControls = A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'camera-controls', ''); | ||
11729 | var $author$project$Utils$loading = function (mode) { | ||
11730 | return A2($rtfeldman$elm_css$Html$Styled$Attributes$attribute, 'loading', mode); | ||
11731 | }; | ||
11732 | var $author$project$Utils$modelViewer = F2( | ||
11733 | function (attributes, children) { | ||
11734 | return A3($rtfeldman$elm_css$Html$Styled$node, 'model-viewer', attributes, children); | ||
11735 | }); | ||
11736 | var $author$project$Product$viewProduct = function (p) { | 11899 | var $author$project$Product$viewProduct = function (p) { |
11737 | return A2( | 11900 | return A2( |
11738 | $rtfeldman$elm_css$Html$Styled$div, | 11901 | $rtfeldman$elm_css$Html$Styled$div, |
11739 | _List_Nil, | ||
11740 | _List_fromArray( | 11902 | _List_fromArray( |
11741 | [ | 11903 | [ |
11742 | A2( | 11904 | $rtfeldman$elm_css$Html$Styled$Attributes$css( |
11743 | $rtfeldman$elm_css$Html$Styled$div, | ||
11744 | _List_Nil, | ||
11745 | _List_fromArray( | ||
11746 | [ | ||
11747 | $rtfeldman$elm_css$Html$Styled$text(p.name) | ||
11748 | ])), | ||
11749 | A2( | ||
11750 | $rtfeldman$elm_css$Html$Styled$div, | ||
11751 | _List_Nil, | ||
11752 | _List_fromArray( | ||
11753 | [ | ||
11754 | $rtfeldman$elm_css$Html$Styled$text( | ||
11755 | A2($elm$core$Maybe$withDefault, '', p.kind)) | ||
11756 | ])), | ||
11757 | A2( | ||
11758 | $rtfeldman$elm_css$Html$Styled$div, | ||
11759 | _List_Nil, | ||
11760 | _List_fromArray( | 11905 | _List_fromArray( |
11761 | [ | 11906 | [ |
11762 | $rtfeldman$elm_css$Html$Styled$text( | 11907 | $rtfeldman$elm_css$Css$marginBottom( |
11763 | A2($elm$core$Maybe$withDefault, '', p.description)) | 11908 | $rtfeldman$elm_css$Css$px(20)), |
11764 | ])), | 11909 | $rtfeldman$elm_css$Css$padding( |
11910 | $rtfeldman$elm_css$Css$px(20)), | ||
11911 | $rtfeldman$elm_css$Css$width( | ||
11912 | $rtfeldman$elm_css$Css$pct(100)) | ||
11913 | ])) | ||
11914 | ]), | ||
11915 | _List_fromArray( | ||
11916 | [ | ||
11765 | A2( | 11917 | A2( |
11766 | $rtfeldman$elm_css$Html$Styled$div, | 11918 | $rtfeldman$elm_css$Html$Styled$div, |
11767 | _List_Nil, | ||
11768 | _List_fromArray( | 11919 | _List_fromArray( |
11769 | [ | 11920 | [ |
11770 | $rtfeldman$elm_css$Html$Styled$text( | 11921 | $rtfeldman$elm_css$Html$Styled$Attributes$css( |
11771 | $elm$core$String$fromFloat(p.price)) | 11922 | _List_fromArray( |
11772 | ])), | 11923 | [ |
11773 | A2( | 11924 | $rtfeldman$elm_css$Css$float($rtfeldman$elm_css$Css$left), |
11774 | $rtfeldman$elm_css$Html$Styled$div, | 11925 | $rtfeldman$elm_css$Css$width( |
11775 | _List_Nil, | 11926 | $rtfeldman$elm_css$Css$pct(50)) |
11927 | ])) | ||
11928 | ]), | ||
11776 | _List_fromArray( | 11929 | _List_fromArray( |
11777 | [ | 11930 | [ |
11778 | A2( | 11931 | A2( |
@@ -11787,21 +11940,348 @@ var $author$project$Product$viewProduct = function (p) { | |||
11787 | $author$project$Utils$arModes('webxr') | 11940 | $author$project$Utils$arModes('webxr') |
11788 | ]), | 11941 | ]), |
11789 | _List_Nil) | 11942 | _List_Nil) |
11790 | ])) | 11943 | ])), |
11944 | A2( | ||
11945 | $rtfeldman$elm_css$Html$Styled$div, | ||
11946 | _List_fromArray( | ||
11947 | [ | ||
11948 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11949 | _List_fromArray( | ||
11950 | [ | ||
11951 | $rtfeldman$elm_css$Css$float($rtfeldman$elm_css$Css$left), | ||
11952 | $rtfeldman$elm_css$Css$width( | ||
11953 | $rtfeldman$elm_css$Css$pct(50)) | ||
11954 | ])) | ||
11955 | ]), | ||
11956 | _List_fromArray( | ||
11957 | [ | ||
11958 | A2( | ||
11959 | $rtfeldman$elm_css$Html$Styled$div, | ||
11960 | _List_fromArray( | ||
11961 | [ | ||
11962 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11963 | _List_fromArray( | ||
11964 | [ | ||
11965 | $author$project$Styles$cardSecondaryText, | ||
11966 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11967 | $rtfeldman$elm_css$Css$px(3)), | ||
11968 | $rtfeldman$elm_css$Css$fontVariant($rtfeldman$elm_css$Css$smallCaps) | ||
11969 | ])) | ||
11970 | ]), | ||
11971 | _List_fromArray( | ||
11972 | [ | ||
11973 | $rtfeldman$elm_css$Html$Styled$text( | ||
11974 | A2($elm$core$Maybe$withDefault, '', p.kind)) | ||
11975 | ])), | ||
11976 | A2( | ||
11977 | $rtfeldman$elm_css$Html$Styled$div, | ||
11978 | _List_fromArray( | ||
11979 | [ | ||
11980 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11981 | _List_fromArray( | ||
11982 | [ | ||
11983 | $author$project$Styles$cardPrimaryText, | ||
11984 | $rtfeldman$elm_css$Css$paddingBottom( | ||
11985 | $rtfeldman$elm_css$Css$px(12)) | ||
11986 | ])) | ||
11987 | ]), | ||
11988 | _List_fromArray( | ||
11989 | [ | ||
11990 | $rtfeldman$elm_css$Html$Styled$text(p.name) | ||
11991 | ])), | ||
11992 | A2( | ||
11993 | $rtfeldman$elm_css$Html$Styled$div, | ||
11994 | _List_fromArray( | ||
11995 | [ | ||
11996 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
11997 | _List_fromArray( | ||
11998 | [ | ||
11999 | $author$project$Styles$cardSupportingText, | ||
12000 | $rtfeldman$elm_css$Css$paddingBottom( | ||
12001 | $rtfeldman$elm_css$Css$px(6)) | ||
12002 | ])) | ||
12003 | ]), | ||
12004 | _List_fromArray( | ||
12005 | [ | ||
12006 | $rtfeldman$elm_css$Html$Styled$text( | ||
12007 | A2($elm$core$Maybe$withDefault, 'No description provided', p.description)) | ||
12008 | ])), | ||
12009 | A2( | ||
12010 | $rtfeldman$elm_css$Html$Styled$div, | ||
12011 | _List_fromArray( | ||
12012 | [ | ||
12013 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12014 | _List_fromArray( | ||
12015 | [ | ||
12016 | $rtfeldman$elm_css$Css$fontWeight($rtfeldman$elm_css$Css$bold), | ||
12017 | $rtfeldman$elm_css$Css$fontSize( | ||
12018 | $rtfeldman$elm_css$Css$px(14)), | ||
12019 | $author$project$Styles$money | ||
12020 | ])) | ||
12021 | ]), | ||
12022 | _List_fromArray( | ||
12023 | [ | ||
12024 | $rtfeldman$elm_css$Html$Styled$text( | ||
12025 | $elm$core$String$fromFloat(p.price)), | ||
12026 | A2( | ||
12027 | $rtfeldman$elm_css$Html$Styled$div, | ||
12028 | _List_Nil, | ||
12029 | _List_fromArray( | ||
12030 | [ | ||
12031 | A2( | ||
12032 | $author$project$Styles$furbyButton, | ||
12033 | _List_fromArray( | ||
12034 | [ | ||
12035 | $rtfeldman$elm_css$Html$Styled$Events$onClick($author$project$Product$AddToCartPressed) | ||
12036 | ]), | ||
12037 | _List_fromArray( | ||
12038 | [ | ||
12039 | $rtfeldman$elm_css$Html$Styled$text('Add To Cart') | ||
12040 | ])) | ||
12041 | ])) | ||
12042 | ])) | ||
12043 | ])), | ||
12044 | A2( | ||
12045 | $rtfeldman$elm_css$Html$Styled$div, | ||
12046 | _List_fromArray( | ||
12047 | [ | ||
12048 | A2($rtfeldman$elm_css$Html$Styled$Attributes$style, 'clear', 'both') | ||
12049 | ]), | ||
12050 | _List_Nil) | ||
11791 | ])); | 12051 | ])); |
11792 | }; | 12052 | }; |
11793 | var $author$project$Product$viewRating = function (r) { | 12053 | var $elm$core$List$repeatHelp = F3( |
12054 | function (result, n, value) { | ||
12055 | repeatHelp: | ||
12056 | while (true) { | ||
12057 | if (n <= 0) { | ||
12058 | return result; | ||
12059 | } else { | ||
12060 | var $temp$result = A2($elm$core$List$cons, value, result), | ||
12061 | $temp$n = n - 1, | ||
12062 | $temp$value = value; | ||
12063 | result = $temp$result; | ||
12064 | n = $temp$n; | ||
12065 | value = $temp$value; | ||
12066 | continue repeatHelp; | ||
12067 | } | ||
12068 | } | ||
12069 | }); | ||
12070 | var $elm$core$List$repeat = F2( | ||
12071 | function (n, value) { | ||
12072 | return A3($elm$core$List$repeatHelp, _List_Nil, n, value); | ||
12073 | }); | ||
12074 | var $rtfeldman$elm_css$VirtualDom$Styled$unstyledNode = $rtfeldman$elm_css$VirtualDom$Styled$Unstyled; | ||
12075 | var $rtfeldman$elm_css$Html$Styled$fromUnstyled = $rtfeldman$elm_css$VirtualDom$Styled$unstyledNode; | ||
12076 | var $elm$svg$Svg$Attributes$class = _VirtualDom_attribute('class'); | ||
12077 | var $elm$svg$Svg$Attributes$fill = _VirtualDom_attribute('fill'); | ||
12078 | var $elm$svg$Svg$Attributes$height = _VirtualDom_attribute('height'); | ||
12079 | var $elm$svg$Svg$map = $elm$virtual_dom$VirtualDom$map; | ||
12080 | var $elm$svg$Svg$Attributes$stroke = _VirtualDom_attribute('stroke'); | ||
12081 | var $elm$svg$Svg$Attributes$strokeLinecap = _VirtualDom_attribute('stroke-linecap'); | ||
12082 | var $elm$svg$Svg$Attributes$strokeLinejoin = _VirtualDom_attribute('stroke-linejoin'); | ||
12083 | var $elm$svg$Svg$Attributes$strokeWidth = _VirtualDom_attribute('stroke-width'); | ||
12084 | var $elm$svg$Svg$trustedNode = _VirtualDom_nodeNS('http://www.w3.org/2000/svg'); | ||
12085 | var $elm$svg$Svg$svg = $elm$svg$Svg$trustedNode('svg'); | ||
12086 | var $elm$svg$Svg$Attributes$viewBox = _VirtualDom_attribute('viewBox'); | ||
12087 | var $elm$svg$Svg$Attributes$width = _VirtualDom_attribute('width'); | ||
12088 | var $1602$elm_feather$FeatherIcons$toHtml = F2( | ||
12089 | function (attributes, _v0) { | ||
12090 | var src = _v0.a.src; | ||
12091 | var attrs = _v0.a.attrs; | ||
12092 | var strSize = $elm$core$String$fromFloat(attrs.size); | ||
12093 | var baseAttributes = _List_fromArray( | ||
12094 | [ | ||
12095 | $elm$svg$Svg$Attributes$fill('none'), | ||
12096 | $elm$svg$Svg$Attributes$height( | ||
12097 | _Utils_ap(strSize, attrs.sizeUnit)), | ||
12098 | $elm$svg$Svg$Attributes$width( | ||
12099 | _Utils_ap(strSize, attrs.sizeUnit)), | ||
12100 | $elm$svg$Svg$Attributes$stroke('currentColor'), | ||
12101 | $elm$svg$Svg$Attributes$strokeLinecap('round'), | ||
12102 | $elm$svg$Svg$Attributes$strokeLinejoin('round'), | ||
12103 | $elm$svg$Svg$Attributes$strokeWidth( | ||
12104 | $elm$core$String$fromFloat(attrs.strokeWidth)), | ||
12105 | $elm$svg$Svg$Attributes$viewBox(attrs.viewBox) | ||
12106 | ]); | ||
12107 | var combinedAttributes = _Utils_ap( | ||
12108 | function () { | ||
12109 | var _v1 = attrs._class; | ||
12110 | if (_v1.$ === 'Just') { | ||
12111 | var c = _v1.a; | ||
12112 | return A2( | ||
12113 | $elm$core$List$cons, | ||
12114 | $elm$svg$Svg$Attributes$class(c), | ||
12115 | baseAttributes); | ||
12116 | } else { | ||
12117 | return baseAttributes; | ||
12118 | } | ||
12119 | }(), | ||
12120 | attributes); | ||
12121 | return A2( | ||
12122 | $elm$svg$Svg$svg, | ||
12123 | combinedAttributes, | ||
12124 | A2( | ||
12125 | $elm$core$List$map, | ||
12126 | $elm$svg$Svg$map($elm$core$Basics$never), | ||
12127 | src)); | ||
12128 | }); | ||
12129 | var $1602$elm_feather$FeatherIcons$Icon = function (a) { | ||
12130 | return {$: 'Icon', a: a}; | ||
12131 | }; | ||
12132 | var $1602$elm_feather$FeatherIcons$withSize = F2( | ||
12133 | function (size, _v0) { | ||
12134 | var attrs = _v0.a.attrs; | ||
12135 | var src = _v0.a.src; | ||
12136 | return $1602$elm_feather$FeatherIcons$Icon( | ||
12137 | { | ||
12138 | attrs: _Utils_update( | ||
12139 | attrs, | ||
12140 | {size: size}), | ||
12141 | src: src | ||
12142 | }); | ||
12143 | }); | ||
12144 | var $author$project$Icons$convert = A2( | ||
12145 | $elm$core$Basics$composeL, | ||
12146 | A2( | ||
12147 | $elm$core$Basics$composeL, | ||
12148 | $rtfeldman$elm_css$Html$Styled$fromUnstyled, | ||
12149 | $1602$elm_feather$FeatherIcons$toHtml(_List_Nil)), | ||
12150 | $1602$elm_feather$FeatherIcons$withSize(14)); | ||
12151 | var $1602$elm_feather$FeatherIcons$defaultAttributes = function (name) { | ||
12152 | return { | ||
12153 | _class: $elm$core$Maybe$Just('feather feather-' + name), | ||
12154 | size: 24, | ||
12155 | sizeUnit: '', | ||
12156 | strokeWidth: 2, | ||
12157 | viewBox: '0 0 24 24' | ||
12158 | }; | ||
12159 | }; | ||
12160 | var $1602$elm_feather$FeatherIcons$makeBuilder = F2( | ||
12161 | function (name, src) { | ||
12162 | return $1602$elm_feather$FeatherIcons$Icon( | ||
12163 | { | ||
12164 | attrs: $1602$elm_feather$FeatherIcons$defaultAttributes(name), | ||
12165 | src: src | ||
12166 | }); | ||
12167 | }); | ||
12168 | var $elm$svg$Svg$Attributes$points = _VirtualDom_attribute('points'); | ||
12169 | var $elm$svg$Svg$polygon = $elm$svg$Svg$trustedNode('polygon'); | ||
12170 | var $1602$elm_feather$FeatherIcons$xmlns = function (s) { | ||
12171 | return A2( | ||
12172 | $elm$virtual_dom$VirtualDom$property, | ||
12173 | 'xmlns', | ||
12174 | $elm$json$Json$Encode$string(s)); | ||
12175 | }; | ||
12176 | var $1602$elm_feather$FeatherIcons$star = A2( | ||
12177 | $1602$elm_feather$FeatherIcons$makeBuilder, | ||
12178 | 'star', | ||
12179 | _List_fromArray( | ||
12180 | [ | ||
12181 | A2( | ||
12182 | $elm$svg$Svg$svg, | ||
12183 | _List_fromArray( | ||
12184 | [ | ||
12185 | $1602$elm_feather$FeatherIcons$xmlns('http://www.w3.org/2000/svg'), | ||
12186 | $elm$svg$Svg$Attributes$width('24'), | ||
12187 | $elm$svg$Svg$Attributes$height('24'), | ||
12188 | $elm$svg$Svg$Attributes$viewBox('0 0 24 24'), | ||
12189 | $elm$svg$Svg$Attributes$fill('none'), | ||
12190 | $elm$svg$Svg$Attributes$stroke('currentColor'), | ||
12191 | $elm$svg$Svg$Attributes$strokeWidth('2'), | ||
12192 | $elm$svg$Svg$Attributes$strokeLinecap('round'), | ||
12193 | $elm$svg$Svg$Attributes$strokeLinejoin('round'), | ||
12194 | $elm$svg$Svg$Attributes$class('feather feather-star') | ||
12195 | ]), | ||
12196 | _List_fromArray( | ||
12197 | [ | ||
12198 | A2( | ||
12199 | $elm$svg$Svg$polygon, | ||
12200 | _List_fromArray( | ||
12201 | [ | ||
12202 | $elm$svg$Svg$Attributes$points('12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2') | ||
12203 | ]), | ||
12204 | _List_Nil) | ||
12205 | ])) | ||
12206 | ])); | ||
12207 | var $author$project$Icons$starIcon = $author$project$Icons$convert($1602$elm_feather$FeatherIcons$star); | ||
12208 | var $author$project$Product$viewStarRating = function (i) { | ||
11794 | return A2( | 12209 | return A2( |
11795 | $rtfeldman$elm_css$Html$Styled$div, | 12210 | $rtfeldman$elm_css$Html$Styled$div, |
11796 | _List_Nil, | 12211 | _List_Nil, |
12212 | A2($elm$core$List$repeat, i, $author$project$Icons$starIcon)); | ||
12213 | }; | ||
12214 | var $author$project$Product$viewRating = function (r) { | ||
12215 | return A2( | ||
12216 | $rtfeldman$elm_css$Html$Styled$div, | ||
11797 | _List_fromArray( | 12217 | _List_fromArray( |
11798 | [ | 12218 | [ |
11799 | $rtfeldman$elm_css$Html$Styled$text(r.customerName + ' posted on '), | 12219 | $rtfeldman$elm_css$Html$Styled$Attributes$css( |
11800 | $rtfeldman$elm_css$Html$Styled$text(r.commentDate + ' '), | 12220 | _List_fromArray( |
11801 | $rtfeldman$elm_css$Html$Styled$text( | 12221 | [ |
11802 | A2($elm$core$Maybe$withDefault, '', r.commentText)), | 12222 | A3( |
11803 | $rtfeldman$elm_css$Html$Styled$text( | 12223 | $rtfeldman$elm_css$Css$border3, |
11804 | ' Stars: ' + $elm$core$String$fromInt(r.stars)) | 12224 | $rtfeldman$elm_css$Css$px(1), |
12225 | $rtfeldman$elm_css$Css$solid, | ||
12226 | $author$project$Styles$theme.primary), | ||
12227 | $rtfeldman$elm_css$Css$borderRadius( | ||
12228 | $rtfeldman$elm_css$Css$px(4)), | ||
12229 | $rtfeldman$elm_css$Css$marginBottom( | ||
12230 | $rtfeldman$elm_css$Css$px(20)), | ||
12231 | $rtfeldman$elm_css$Css$padding( | ||
12232 | $rtfeldman$elm_css$Css$px(20)) | ||
12233 | ])) | ||
12234 | ]), | ||
12235 | _List_fromArray( | ||
12236 | [ | ||
12237 | A2( | ||
12238 | $rtfeldman$elm_css$Html$Styled$div, | ||
12239 | _List_fromArray( | ||
12240 | [ | ||
12241 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12242 | _List_fromArray( | ||
12243 | [ | ||
12244 | $rtfeldman$elm_css$Css$fontSize( | ||
12245 | $rtfeldman$elm_css$Css$px(16)), | ||
12246 | $rtfeldman$elm_css$Css$fontWeight($rtfeldman$elm_css$Css$bold), | ||
12247 | $rtfeldman$elm_css$Css$paddingBottom( | ||
12248 | $rtfeldman$elm_css$Css$px(3)) | ||
12249 | ])) | ||
12250 | ]), | ||
12251 | _List_fromArray( | ||
12252 | [ | ||
12253 | $rtfeldman$elm_css$Html$Styled$text(r.customerName) | ||
12254 | ])), | ||
12255 | $author$project$Product$viewStarRating(r.stars), | ||
12256 | A2( | ||
12257 | $rtfeldman$elm_css$Html$Styled$div, | ||
12258 | _List_fromArray( | ||
12259 | [ | ||
12260 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12261 | _List_fromArray( | ||
12262 | [ | ||
12263 | $author$project$Styles$cardSecondaryText, | ||
12264 | $rtfeldman$elm_css$Css$paddingBottom( | ||
12265 | $rtfeldman$elm_css$Css$px(12)) | ||
12266 | ])) | ||
12267 | ]), | ||
12268 | _List_fromArray( | ||
12269 | [ | ||
12270 | $rtfeldman$elm_css$Html$Styled$text('Reviewed on ' + r.commentDate) | ||
12271 | ])), | ||
12272 | (!_Utils_eq(r.commentText, $elm$core$Maybe$Nothing)) ? A2( | ||
12273 | $rtfeldman$elm_css$Html$Styled$div, | ||
12274 | _List_fromArray( | ||
12275 | [ | ||
12276 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12277 | _List_fromArray( | ||
12278 | [$author$project$Styles$cardSupportingText])) | ||
12279 | ]), | ||
12280 | _List_fromArray( | ||
12281 | [ | ||
12282 | $rtfeldman$elm_css$Html$Styled$text( | ||
12283 | A2($elm$core$Maybe$withDefault, '', r.commentText)) | ||
12284 | ])) : $rtfeldman$elm_css$Html$Styled$text('') | ||
11805 | ])); | 12285 | ])); |
11806 | }; | 12286 | }; |
11807 | var $author$project$Product$AddRatingStars = function (a) { | 12287 | var $author$project$Product$AddRatingStars = function (a) { |
@@ -11827,7 +12307,7 @@ var $author$project$Product$viewStars = A2( | |||
11827 | ])); | 12307 | ])); |
11828 | }, | 12308 | }, |
11829 | _List_fromArray( | 12309 | _List_fromArray( |
11830 | [0, 1, 2, 3, 4, 5]))); | 12310 | [1, 2, 3, 4, 5]))); |
11831 | var $author$project$Product$viewStatus = function (s) { | 12311 | var $author$project$Product$viewStatus = function (s) { |
11832 | switch (s.$) { | 12312 | switch (s.$) { |
11833 | case 'Loading': | 12313 | case 'Loading': |
@@ -11852,7 +12332,16 @@ var $author$project$Product$view = function (model) { | |||
11852 | } else { | 12332 | } else { |
11853 | return A2( | 12333 | return A2( |
11854 | $rtfeldman$elm_css$Html$Styled$div, | 12334 | $rtfeldman$elm_css$Html$Styled$div, |
11855 | _List_Nil, | 12335 | _List_fromArray( |
12336 | [ | ||
12337 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12338 | _List_fromArray( | ||
12339 | [ | ||
12340 | $rtfeldman$elm_css$Css$width( | ||
12341 | $rtfeldman$elm_css$Css$pct(60)), | ||
12342 | $rtfeldman$elm_css$Css$margin($rtfeldman$elm_css$Css$auto) | ||
12343 | ])) | ||
12344 | ]), | ||
11856 | _List_fromArray( | 12345 | _List_fromArray( |
11857 | [ | 12346 | [ |
11858 | A2( | 12347 | A2( |
@@ -11863,8 +12352,29 @@ var $author$project$Product$view = function (model) { | |||
11863 | $author$project$Product$viewProduct(model.listing) | 12352 | $author$project$Product$viewProduct(model.listing) |
11864 | ])), | 12353 | ])), |
11865 | A2( | 12354 | A2( |
12355 | $rtfeldman$elm_css$Html$Styled$div, | ||
12356 | _List_fromArray( | ||
12357 | [ | ||
12358 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12359 | _List_fromArray( | ||
12360 | [$author$project$Styles$cardPrimaryText])) | ||
12361 | ]), | ||
12362 | _List_fromArray( | ||
12363 | [ | ||
12364 | $rtfeldman$elm_css$Html$Styled$text('User Reviews') | ||
12365 | ])), | ||
12366 | _Utils_eq(model.ratings, _List_Nil) ? $rtfeldman$elm_css$Html$Styled$text('Be the first to add a review.') : A2( | ||
11866 | $rtfeldman$elm_css$Html$Styled$ul, | 12367 | $rtfeldman$elm_css$Html$Styled$ul, |
11867 | _List_Nil, | 12368 | _List_fromArray( |
12369 | [ | ||
12370 | $rtfeldman$elm_css$Html$Styled$Attributes$css( | ||
12371 | _List_fromArray( | ||
12372 | [ | ||
12373 | $rtfeldman$elm_css$Css$padding( | ||
12374 | $rtfeldman$elm_css$Css$px(0)), | ||
12375 | $rtfeldman$elm_css$Css$listStyle($rtfeldman$elm_css$Css$none) | ||
12376 | ])) | ||
12377 | ]), | ||
11868 | A2($elm$core$List$map, $author$project$Product$viewRating, model.ratings)), | 12378 | A2($elm$core$List$map, $author$project$Product$viewRating, model.ratings)), |
11869 | A2( | 12379 | A2( |
11870 | $rtfeldman$elm_css$Html$Styled$div, | 12380 | $rtfeldman$elm_css$Html$Styled$div, |
@@ -11897,22 +12407,6 @@ var $author$project$Product$view = function (model) { | |||
11897 | _List_fromArray( | 12407 | _List_fromArray( |
11898 | [ | 12408 | [ |
11899 | A2( | 12409 | A2( |
11900 | $rtfeldman$elm_css$Html$Styled$button, | ||
11901 | _List_fromArray( | ||
11902 | [ | ||
11903 | $rtfeldman$elm_css$Html$Styled$Events$onClick($author$project$Product$AddToCartPressed) | ||
11904 | ]), | ||
11905 | _List_fromArray( | ||
11906 | [ | ||
11907 | $rtfeldman$elm_css$Html$Styled$text('Add To Cart') | ||
11908 | ])) | ||
11909 | ])), | ||
11910 | A2( | ||
11911 | $rtfeldman$elm_css$Html$Styled$div, | ||
11912 | _List_Nil, | ||
11913 | _List_fromArray( | ||
11914 | [ | ||
11915 | A2( | ||
11916 | $rtfeldman$elm_css$Html$Styled$a, | 12410 | $rtfeldman$elm_css$Html$Styled$a, |
11917 | _List_fromArray( | 12411 | _List_fromArray( |
11918 | [ | 12412 | [ |
diff --git a/frontend/src/Catalog.elm b/frontend/src/Catalog.elm index 5b233f2..7e9bde7 100644 --- a/frontend/src/Catalog.elm +++ b/frontend/src/Catalog.elm | |||
@@ -27,6 +27,8 @@ type alias Product = | |||
27 | , price : Float | 27 | , price : Float |
28 | , description : Maybe String | 28 | , description : Maybe String |
29 | , averageRating : Maybe Float | 29 | , averageRating : Maybe Float |
30 | , src : String | ||
31 | , iosSrc : String | ||
30 | } | 32 | } |
31 | 33 | ||
32 | 34 | ||
@@ -129,13 +131,15 @@ update msg model = | |||
129 | 131 | ||
130 | decodeProduct : D.Decoder Product | 132 | decodeProduct : D.Decoder Product |
131 | decodeProduct = | 133 | decodeProduct = |
132 | D.map6 Product | 134 | D.map8 Product |
133 | (D.field "id" D.int) | 135 | (D.field "id" D.int) |
134 | (D.field "name" D.string) | 136 | (D.field "name" D.string) |
135 | (D.field "kind" (D.nullable D.string)) | 137 | (D.field "kind" (D.nullable D.string)) |
136 | (D.field "price" D.float) | 138 | (D.field "price" D.float) |
137 | (D.field "description" (D.nullable D.string)) | 139 | (D.field "description" (D.nullable D.string)) |
138 | (D.field "average_rating" (D.nullable D.float)) | 140 | (D.field "average_rating" (D.nullable D.float)) |
141 | (D.field "src" D.string) | ||
142 | (D.field "ios_src" D.string) | ||
139 | 143 | ||
140 | 144 | ||
141 | decodeResponse : D.Decoder (List Product) | 145 | decodeResponse : D.Decoder (List Product) |
@@ -170,18 +174,83 @@ viewStatus s = | |||
170 | 174 | ||
171 | viewProduct : Product -> Html Msg | 175 | viewProduct : Product -> Html Msg |
172 | viewProduct p = | 176 | viewProduct p = |
173 | div [] | 177 | div |
174 | [ div [] [ text p.name ] | 178 | [ css |
175 | , div [] [ text <| Maybe.withDefault "" p.kind ] | 179 | [ marginBottom (px 20) |
176 | , div [] [ text <| Maybe.withDefault "" p.description ] | 180 | , border3 (px 1) solid theme.primary |
177 | , div [] [ text <| String.fromFloat p.price ] | 181 | , borderRadius (px 4) |
178 | , case p.averageRating of | 182 | , padding (px 20) |
179 | Just v -> | 183 | , Css.width (pct 100) |
180 | text <| "Avg Rating: " ++ String.fromFloat v | 184 | , maxWidth (px 650) |
181 | 185 | ] | |
182 | Nothing -> | 186 | ] |
183 | text "No Ratings" | 187 | [ div |
184 | , div [] [ a [ href ("/product/" ++ String.fromInt p.id) ] [ text "View Product" ] ] | 188 | [ css |
189 | [ float left | ||
190 | , Css.width (pct 50) | ||
191 | ] | ||
192 | ] | ||
193 | [ modelViewer | ||
194 | [ cameraControls | ||
195 | , autoRotate | ||
196 | , arSrc p.src | ||
197 | , arIosSrc p.iosSrc | ||
198 | , loading "eager" | ||
199 | , arModes "webxr" | ||
200 | ] | ||
201 | [] | ||
202 | ] | ||
203 | , div | ||
204 | [ css | ||
205 | [ float left | ||
206 | , Css.width (pct 50) | ||
207 | ] | ||
208 | ] | ||
209 | [ div | ||
210 | [ css | ||
211 | [ cardSecondaryText | ||
212 | , paddingBottom (px 3) | ||
213 | , fontVariant smallCaps | ||
214 | ] | ||
215 | ] | ||
216 | [ text <| Maybe.withDefault "" p.kind ] | ||
217 | , div | ||
218 | [ css | ||
219 | [ cardPrimaryText | ||
220 | , paddingBottom (px 3) | ||
221 | ] | ||
222 | ] | ||
223 | [ a [ href ("/product/" ++ String.fromInt p.id) ] [ text p.name ] ] | ||
224 | , div | ||
225 | [ css | ||
226 | [ cardSecondaryText | ||
227 | , paddingBottom (px 12) | ||
228 | ] | ||
229 | ] | ||
230 | [ case p.averageRating of | ||
231 | Just v -> | ||
232 | text <| "Avg Rating: " ++ String.fromFloat v | ||
233 | |||
234 | Nothing -> | ||
235 | text "No Ratings" | ||
236 | ] | ||
237 | , div | ||
238 | [ css | ||
239 | [ cardSupportingText | ||
240 | , paddingBottom (px 6) | ||
241 | ] | ||
242 | ] | ||
243 | [ text <| Maybe.withDefault "No description provided" p.description ] | ||
244 | , div | ||
245 | [ css | ||
246 | [ fontWeight bold | ||
247 | , fontSize (px 14) | ||
248 | , money | ||
249 | ] | ||
250 | ] | ||
251 | [ text <| String.fromFloat p.price ] | ||
252 | ] | ||
253 | , div [ style "clear" "both" ] [] | ||
185 | ] | 254 | ] |
186 | 255 | ||
187 | 256 | ||
@@ -260,7 +329,10 @@ view model = | |||
260 | ] | 329 | ] |
261 | [ div [ css [ bigHeading ] ] [ text "Products" ] | 330 | [ div [ css [ bigHeading ] ] [ text "Products" ] |
262 | , ul | 331 | , ul |
263 | [ css [ padding (px 0) ] | 332 | [ css |
333 | [ padding (px 0) | ||
334 | , listStyle Css.none | ||
335 | ] | ||
264 | ] | 336 | ] |
265 | (filterProducts model |> List.map viewProduct) | 337 | (filterProducts model |> List.map viewProduct) |
266 | ] | 338 | ] |
diff --git a/frontend/src/Icons.elm b/frontend/src/Icons.elm index d3b862f..96fa6ff 100644 --- a/frontend/src/Icons.elm +++ b/frontend/src/Icons.elm | |||
@@ -1,6 +1,6 @@ | |||
1 | module Icons exposing (..) | 1 | module Icons exposing (..) |
2 | 2 | ||
3 | import FeatherIcons exposing (toHtml) | 3 | import FeatherIcons exposing (toHtml, withSize) |
4 | import Html | 4 | import Html |
5 | import Html.Styled exposing (..) | 5 | import Html.Styled exposing (..) |
6 | import Html.Styled.Attributes exposing (..) | 6 | import Html.Styled.Attributes exposing (..) |
@@ -8,8 +8,12 @@ import Html.Styled.Events exposing (..) | |||
8 | 8 | ||
9 | 9 | ||
10 | convert = | 10 | convert = |
11 | Html.Styled.fromUnstyled << toHtml [] | 11 | Html.Styled.fromUnstyled << toHtml [] << withSize 14 |
12 | 12 | ||
13 | 13 | ||
14 | loginIcon = | 14 | loginIcon = |
15 | convert FeatherIcons.logIn | 15 | convert FeatherIcons.logIn |
16 | |||
17 | |||
18 | starIcon = | ||
19 | convert FeatherIcons.star | ||
diff --git a/frontend/src/Main.elm b/frontend/src/Main.elm index ea80921..c1489bf 100644 --- a/frontend/src/Main.elm +++ b/frontend/src/Main.elm | |||
@@ -403,6 +403,7 @@ viewHeader model = | |||
403 | [ css | 403 | [ css |
404 | [ listStyle Css.none | 404 | [ listStyle Css.none |
405 | , padding (px 0) | 405 | , padding (px 0) |
406 | , margin (px 24) | ||
406 | ] | 407 | ] |
407 | ] | 408 | ] |
408 | ] | 409 | ] |
diff --git a/frontend/src/Product.elm b/frontend/src/Product.elm index b97a847..79256cc 100644 --- a/frontend/src/Product.elm +++ b/frontend/src/Product.elm | |||
@@ -2,13 +2,16 @@ module Product exposing (..) | |||
2 | 2 | ||
3 | import Browser | 3 | import Browser |
4 | import Browser.Navigation as Nav | 4 | import Browser.Navigation as Nav |
5 | import Css exposing (..) | ||
5 | import Html | 6 | import Html |
6 | import Html.Styled exposing (..) | 7 | import Html.Styled exposing (..) |
7 | import Html.Styled.Attributes exposing (..) | 8 | import Html.Styled.Attributes exposing (..) |
8 | import Html.Styled.Events exposing (..) | 9 | import Html.Styled.Events exposing (..) |
9 | import Http | 10 | import Http |
11 | import Icons exposing (..) | ||
10 | import Json.Decode as D | 12 | import Json.Decode as D |
11 | import Json.Encode as Encode | 13 | import Json.Encode as Encode |
14 | import Styles exposing (..) | ||
12 | import Url | 15 | import Url |
13 | import Url.Parser as P exposing ((</>), Parser, int, oneOf, s, string) | 16 | import Url.Parser as P exposing ((</>), Parser, int, oneOf, s, string) |
14 | import Utils exposing (..) | 17 | import Utils exposing (..) |
@@ -77,7 +80,7 @@ type Msg | |||
77 | 80 | ||
78 | init : Model | 81 | init : Model |
79 | init = | 82 | init = |
80 | Model NotLoaded emptyProduct [] 0 "" NotSubmitted | 83 | Model NotLoaded emptyProduct [] 5 "" NotSubmitted |
81 | 84 | ||
82 | 85 | ||
83 | update : Msg -> Model -> ( Model, Cmd Msg ) | 86 | update : Msg -> Model -> ( Model, Cmd Msg ) |
@@ -251,12 +254,19 @@ viewStatus s = | |||
251 | 254 | ||
252 | viewProduct : Product -> Html Msg | 255 | viewProduct : Product -> Html Msg |
253 | viewProduct p = | 256 | viewProduct p = |
254 | div [] | 257 | div |
255 | [ div [] [ text p.name ] | 258 | [ css |
256 | , div [] [ text <| Maybe.withDefault "" p.kind ] | 259 | [ marginBottom (px 20) |
257 | , div [] [ text <| Maybe.withDefault "" p.description ] | 260 | , padding (px 20) |
258 | , div [] [ text <| String.fromFloat p.price ] | 261 | , Css.width (pct 100) |
259 | , div [] | 262 | ] |
263 | ] | ||
264 | [ div | ||
265 | [ css | ||
266 | [ float left | ||
267 | , Css.width (pct 50) | ||
268 | ] | ||
269 | ] | ||
260 | [ modelViewer | 270 | [ modelViewer |
261 | [ cameraControls | 271 | [ cameraControls |
262 | , autoRotate | 272 | , autoRotate |
@@ -267,16 +277,96 @@ viewProduct p = | |||
267 | ] | 277 | ] |
268 | [] | 278 | [] |
269 | ] | 279 | ] |
280 | , div | ||
281 | [ css | ||
282 | [ float left | ||
283 | , Css.width (pct 50) | ||
284 | ] | ||
285 | ] | ||
286 | [ div | ||
287 | [ css | ||
288 | [ cardSecondaryText | ||
289 | , paddingBottom (px 3) | ||
290 | , fontVariant smallCaps | ||
291 | ] | ||
292 | ] | ||
293 | [ text <| Maybe.withDefault "" p.kind ] | ||
294 | , div | ||
295 | [ css | ||
296 | [ cardPrimaryText | ||
297 | , paddingBottom (px 12) | ||
298 | ] | ||
299 | ] | ||
300 | [ text p.name ] | ||
301 | , div | ||
302 | [ css | ||
303 | [ cardSupportingText | ||
304 | , paddingBottom (px 6) | ||
305 | ] | ||
306 | ] | ||
307 | [ text <| Maybe.withDefault "No description provided" p.description ] | ||
308 | , div | ||
309 | [ css | ||
310 | [ fontWeight bold | ||
311 | , fontSize (px 14) | ||
312 | , money | ||
313 | ] | ||
314 | ] | ||
315 | [ text <| String.fromFloat p.price | ||
316 | , div [] | ||
317 | [ furbyButton [ onClick AddToCartPressed ] [ text "Add To Cart" ] | ||
318 | ] | ||
319 | ] | ||
320 | ] | ||
321 | , div [ style "clear" "both" ] [] | ||
270 | ] | 322 | ] |
271 | 323 | ||
272 | 324 | ||
325 | viewStarRating : Int -> Html Msg | ||
326 | viewStarRating i = | ||
327 | div [] | ||
328 | (List.repeat i starIcon) | ||
329 | |||
330 | |||
273 | viewRating : Rating -> Html Msg | 331 | viewRating : Rating -> Html Msg |
274 | viewRating r = | 332 | viewRating r = |
275 | div [] | 333 | -- div [] |
276 | [ text <| r.customerName ++ " posted on " | 334 | -- [ text <| r.customerName ++ " posted on " |
277 | , text <| r.commentDate ++ " " | 335 | -- , text <| r.commentDate ++ " " |
278 | , text <| Maybe.withDefault "" r.commentText | 336 | -- , text <| Maybe.withDefault "" r.commentText |
279 | , text <| " Stars: " ++ String.fromInt r.stars | 337 | -- , text <| " Stars: " ++ String.fromInt r.stars |
338 | -- ] | ||
339 | div | ||
340 | [ css | ||
341 | [ border3 (px 1) solid theme.primary | ||
342 | , borderRadius (px 4) | ||
343 | , marginBottom (px 20) | ||
344 | , padding (px 20) | ||
345 | ] | ||
346 | ] | ||
347 | [ div | ||
348 | [ css | ||
349 | [ fontSize (px 16) | ||
350 | , fontWeight bold | ||
351 | , paddingBottom (px 3) | ||
352 | ] | ||
353 | ] | ||
354 | [ text r.customerName ] | ||
355 | , viewStarRating r.stars | ||
356 | , div | ||
357 | [ css | ||
358 | [ cardSecondaryText | ||
359 | , paddingBottom (px 12) | ||
360 | ] | ||
361 | ] | ||
362 | [ text <| "Reviewed on " ++ r.commentDate ] | ||
363 | , if r.commentText /= Nothing then | ||
364 | div | ||
365 | [ css [ cardSupportingText ] ] | ||
366 | [ text <| Maybe.withDefault "" <| r.commentText ] | ||
367 | |||
368 | else | ||
369 | text "" | ||
280 | ] | 370 | ] |
281 | 371 | ||
282 | 372 | ||
@@ -290,7 +380,7 @@ viewStars = | |||
290 | ul [] | 380 | ul [] |
291 | (List.map | 381 | (List.map |
292 | (\i -> button [ onClick (AddRatingStars i) ] [ text <| String.fromInt i ]) | 382 | (\i -> button [ onClick (AddRatingStars i) ] [ text <| String.fromInt i ]) |
293 | [ 0, 1, 2, 3, 4, 5 ] | 383 | [ 1, 2, 3, 4, 5 ] |
294 | ) | 384 | ) |
295 | 385 | ||
296 | 386 | ||
@@ -301,9 +391,30 @@ view model = | |||
301 | div [] [ text <| viewStatus Loading ] | 391 | div [] [ text <| viewStatus Loading ] |
302 | 392 | ||
303 | _ -> | 393 | _ -> |
304 | div [] | 394 | div |
395 | [ css | ||
396 | [ Css.width (pct 60) | ||
397 | , margin auto | ||
398 | ] | ||
399 | ] | ||
305 | [ div [] [ viewProduct model.listing ] | 400 | [ div [] [ viewProduct model.listing ] |
306 | , ul [] (List.map viewRating model.ratings) | 401 | , div |
402 | [ css | ||
403 | [ cardPrimaryText | ||
404 | ] | ||
405 | ] | ||
406 | [ text "User Reviews" ] | ||
407 | , if model.ratings == [] then | ||
408 | text "Be the first to add a review." | ||
409 | |||
410 | else | ||
411 | ul | ||
412 | [ css | ||
413 | [ padding (px 0) | ||
414 | , listStyle Css.none | ||
415 | ] | ||
416 | ] | ||
417 | (List.map viewRating model.ratings) | ||
307 | , div [] [ text "Add Rating: " ] | 418 | , div [] [ text "Add Rating: " ] |
308 | , div [] | 419 | , div [] |
309 | [ viewStars | 420 | [ viewStars |
@@ -311,9 +422,6 @@ view model = | |||
311 | , button [ onClick AddRatingPressed ] [ text "Submit Rating" ] | 422 | , button [ onClick AddRatingPressed ] [ text "Submit Rating" ] |
312 | ] | 423 | ] |
313 | , div [] | 424 | , div [] |
314 | [ button [ onClick AddToCartPressed ] [ text "Add To Cart" ] | ||
315 | ] | ||
316 | , div [] | ||
317 | [ a [ href "/catalog" ] [ text "Back to catalog" ] | 425 | [ a [ href "/catalog" ] [ text "Back to catalog" ] |
318 | ] | 426 | ] |
319 | ] | 427 | ] |
diff --git a/frontend/src/Styles.elm b/frontend/src/Styles.elm index 36f2a81..fbef6e1 100644 --- a/frontend/src/Styles.elm +++ b/frontend/src/Styles.elm | |||
@@ -60,6 +60,7 @@ furbyButton = | |||
60 | , color theme.fg | 60 | , color theme.fg |
61 | , Css.height (px 40) | 61 | , Css.height (px 40) |
62 | , border (px 0) | 62 | , border (px 0) |
63 | , borderRadius (px 2) | ||
63 | , padding2 (px 6) (px 12) | 64 | , padding2 (px 6) (px 12) |
64 | , backgroundColor theme.primary | 65 | , backgroundColor theme.primary |
65 | , hover | 66 | , hover |
@@ -102,3 +103,23 @@ loginInputField = | |||
102 | bigHeading : Style | 103 | bigHeading : Style |
103 | bigHeading = | 104 | bigHeading = |
104 | fontSize (px 24) | 105 | fontSize (px 24) |
106 | |||
107 | |||
108 | |||
109 | -- card styles | ||
110 | |||
111 | |||
112 | cardPrimaryText = | ||
113 | fontSize (px 18) | ||
114 | |||
115 | |||
116 | cardSecondaryText = | ||
117 | Css.batch [ color theme.fgLight, fontSize (px 12) ] | ||
118 | |||
119 | |||
120 | cardSupportingText = | ||
121 | fontSize (px 16) | ||
122 | |||
123 | |||
124 | money = | ||
125 | before [ Css.property "content" "\"₹ \"" ] | ||