-
Notifications
You must be signed in to change notification settings - Fork 33
/
elm.js
8038 lines (7097 loc) · 180 KB
/
elm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(function(scope){
'use strict';
function F(arity, fun, wrapper) {
wrapper.a = arity;
wrapper.f = fun;
return wrapper;
}
function F2(fun) {
return F(2, fun, function(a) { return function(b) { return fun(a,b); }; })
}
function F3(fun) {
return F(3, fun, function(a) {
return function(b) { return function(c) { return fun(a, b, c); }; };
});
}
function F4(fun) {
return F(4, fun, function(a) { return function(b) { return function(c) {
return function(d) { return fun(a, b, c, d); }; }; };
});
}
function F5(fun) {
return F(5, fun, function(a) { return function(b) { return function(c) {
return function(d) { return function(e) { return fun(a, b, c, d, e); }; }; }; };
});
}
function F6(fun) {
return F(6, fun, function(a) { return function(b) { return function(c) {
return function(d) { return function(e) { return function(f) {
return fun(a, b, c, d, e, f); }; }; }; }; };
});
}
function F7(fun) {
return F(7, fun, function(a) { return function(b) { return function(c) {
return function(d) { return function(e) { return function(f) {
return function(g) { return fun(a, b, c, d, e, f, g); }; }; }; }; }; };
});
}
function F8(fun) {
return F(8, fun, function(a) { return function(b) { return function(c) {
return function(d) { return function(e) { return function(f) {
return function(g) { return function(h) {
return fun(a, b, c, d, e, f, g, h); }; }; }; }; }; }; };
});
}
function F9(fun) {
return F(9, fun, function(a) { return function(b) { return function(c) {
return function(d) { return function(e) { return function(f) {
return function(g) { return function(h) { return function(i) {
return fun(a, b, c, d, e, f, g, h, i); }; }; }; }; }; }; }; };
});
}
function A2(fun, a, b) {
return fun.a === 2 ? fun.f(a, b) : fun(a)(b);
}
function A3(fun, a, b, c) {
return fun.a === 3 ? fun.f(a, b, c) : fun(a)(b)(c);
}
function A4(fun, a, b, c, d) {
return fun.a === 4 ? fun.f(a, b, c, d) : fun(a)(b)(c)(d);
}
function A5(fun, a, b, c, d, e) {
return fun.a === 5 ? fun.f(a, b, c, d, e) : fun(a)(b)(c)(d)(e);
}
function A6(fun, a, b, c, d, e, f) {
return fun.a === 6 ? fun.f(a, b, c, d, e, f) : fun(a)(b)(c)(d)(e)(f);
}
function A7(fun, a, b, c, d, e, f, g) {
return fun.a === 7 ? fun.f(a, b, c, d, e, f, g) : fun(a)(b)(c)(d)(e)(f)(g);
}
function A8(fun, a, b, c, d, e, f, g, h) {
return fun.a === 8 ? fun.f(a, b, c, d, e, f, g, h) : fun(a)(b)(c)(d)(e)(f)(g)(h);
}
function A9(fun, a, b, c, d, e, f, g, h, i) {
return fun.a === 9 ? fun.f(a, b, c, d, e, f, g, h, i) : fun(a)(b)(c)(d)(e)(f)(g)(h)(i);
}
console.warn('Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.0/optimize for better performance and smaller assets.');
var _JsArray_empty = [];
function _JsArray_singleton(value)
{
return [value];
}
function _JsArray_length(array)
{
return array.length;
}
var _JsArray_initialize = F3(function(size, offset, func)
{
var result = new Array(size);
for (var i = 0; i < size; i++)
{
result[i] = func(offset + i);
}
return result;
});
var _JsArray_initializeFromList = F2(function (max, ls)
{
var result = new Array(max);
for (var i = 0; i < max && ls.b; i++)
{
result[i] = ls.a;
ls = ls.b;
}
result.length = i;
return _Utils_Tuple2(result, ls);
});
var _JsArray_unsafeGet = F2(function(index, array)
{
return array[index];
});
var _JsArray_unsafeSet = F3(function(index, value, array)
{
var length = array.length;
var result = new Array(length);
for (var i = 0; i < length; i++)
{
result[i] = array[i];
}
result[index] = value;
return result;
});
var _JsArray_push = F2(function(value, array)
{
var length = array.length;
var result = new Array(length + 1);
for (var i = 0; i < length; i++)
{
result[i] = array[i];
}
result[length] = value;
return result;
});
var _JsArray_foldl = F3(function(func, acc, array)
{
var length = array.length;
for (var i = 0; i < length; i++)
{
acc = A2(func, array[i], acc);
}
return acc;
});
var _JsArray_foldr = F3(function(func, acc, array)
{
for (var i = array.length - 1; i >= 0; i--)
{
acc = A2(func, array[i], acc);
}
return acc;
});
var _JsArray_map = F2(function(func, array)
{
var length = array.length;
var result = new Array(length);
for (var i = 0; i < length; i++)
{
result[i] = func(array[i]);
}
return result;
});
var _JsArray_indexedMap = F3(function(func, offset, array)
{
var length = array.length;
var result = new Array(length);
for (var i = 0; i < length; i++)
{
result[i] = A2(func, offset + i, array[i]);
}
return result;
});
var _JsArray_slice = F3(function(from, to, array)
{
return array.slice(from, to);
});
var _JsArray_appendN = F3(function(n, dest, source)
{
var destLen = dest.length;
var itemsToCopy = n - destLen;
if (itemsToCopy > source.length)
{
itemsToCopy = source.length;
}
var size = destLen + itemsToCopy;
var result = new Array(size);
for (var i = 0; i < destLen; i++)
{
result[i] = dest[i];
}
for (var i = 0; i < itemsToCopy; i++)
{
result[i + destLen] = source[i];
}
return result;
});
// LOG
var _Debug_log_UNUSED = F2(function(tag, value)
{
return value;
});
var _Debug_log = F2(function(tag, value)
{
console.log(tag + ': ' + _Debug_toString(value));
return value;
});
// TODOS
function _Debug_todo(moduleName, region)
{
return function(message) {
_Debug_crash(8, moduleName, region, message);
};
}
function _Debug_todoCase(moduleName, region, value)
{
return function(message) {
_Debug_crash(9, moduleName, region, value, message);
};
}
// TO STRING
function _Debug_toString_UNUSED(value)
{
return '<internals>';
}
function _Debug_toString(value)
{
return _Debug_toAnsiString(false, value);
}
function _Debug_toAnsiString(ansi, value)
{
if (typeof value === 'function')
{
return _Debug_internalColor(ansi, '<function>');
}
if (typeof value === 'boolean')
{
return _Debug_ctorColor(ansi, value ? 'True' : 'False');
}
if (typeof value === 'number')
{
return _Debug_numberColor(ansi, value + '');
}
if (value instanceof String)
{
return _Debug_charColor(ansi, "'" + _Debug_addSlashes(value, true) + "'");
}
if (typeof value === 'string')
{
return _Debug_stringColor(ansi, '"' + _Debug_addSlashes(value, false) + '"');
}
if (typeof value === 'object' && '$' in value)
{
var tag = value.$;
if (typeof tag === 'number')
{
return _Debug_internalColor(ansi, '<internals>');
}
if (tag[0] === '#')
{
var output = [];
for (var k in value)
{
if (k === '$') continue;
output.push(_Debug_toAnsiString(ansi, value[k]));
}
return '(' + output.join(',') + ')';
}
if (tag === 'Set_elm_builtin')
{
return _Debug_ctorColor(ansi, 'Set')
+ _Debug_fadeColor(ansi, '.fromList') + ' '
+ _Debug_toAnsiString(ansi, elm$core$Set$toList(value));
}
if (tag === 'RBNode_elm_builtin' || tag === 'RBEmpty_elm_builtin')
{
return _Debug_ctorColor(ansi, 'Dict')
+ _Debug_fadeColor(ansi, '.fromList') + ' '
+ _Debug_toAnsiString(ansi, elm$core$Dict$toList(value));
}
if (tag === 'Array_elm_builtin')
{
return _Debug_ctorColor(ansi, 'Array')
+ _Debug_fadeColor(ansi, '.fromList') + ' '
+ _Debug_toAnsiString(ansi, elm$core$Array$toList(value));
}
if (tag === '::' || tag === '[]')
{
var output = '[';
value.b && (output += _Debug_toAnsiString(ansi, value.a), value = value.b)
for (; value.b; value = value.b) // WHILE_CONS
{
output += ',' + _Debug_toAnsiString(ansi, value.a);
}
return output + ']';
}
var output = '';
for (var i in value)
{
if (i === '$') continue;
var str = _Debug_toAnsiString(ansi, value[i]);
var c0 = str[0];
var parenless = c0 === '{' || c0 === '(' || c0 === '[' || c0 === '<' || c0 === '"' || str.indexOf(' ') < 0;
output += ' ' + (parenless ? str : '(' + str + ')');
}
return _Debug_ctorColor(ansi, tag) + output;
}
if (typeof DataView === 'function' && value instanceof DataView)
{
return _Debug_stringColor(ansi, '<' + value.byteLength + ' bytes>');
}
if (typeof File === 'function' && value instanceof File)
{
return _Debug_internalColor(ansi, '<' + value.name + '>');
}
if (typeof value === 'object')
{
var output = [];
for (var key in value)
{
var field = key[0] === '_' ? key.slice(1) : key;
output.push(_Debug_fadeColor(ansi, field) + ' = ' + _Debug_toAnsiString(ansi, value[key]));
}
if (output.length === 0)
{
return '{}';
}
return '{ ' + output.join(', ') + ' }';
}
return _Debug_internalColor(ansi, '<internals>');
}
function _Debug_addSlashes(str, isChar)
{
var s = str
.replace(/\\/g, '\\\\')
.replace(/\n/g, '\\n')
.replace(/\t/g, '\\t')
.replace(/\r/g, '\\r')
.replace(/\v/g, '\\v')
.replace(/\0/g, '\\0');
if (isChar)
{
return s.replace(/\'/g, '\\\'');
}
else
{
return s.replace(/\"/g, '\\"');
}
}
function _Debug_ctorColor(ansi, string)
{
return ansi ? '\x1b[96m' + string + '\x1b[0m' : string;
}
function _Debug_numberColor(ansi, string)
{
return ansi ? '\x1b[95m' + string + '\x1b[0m' : string;
}
function _Debug_stringColor(ansi, string)
{
return ansi ? '\x1b[93m' + string + '\x1b[0m' : string;
}
function _Debug_charColor(ansi, string)
{
return ansi ? '\x1b[92m' + string + '\x1b[0m' : string;
}
function _Debug_fadeColor(ansi, string)
{
return ansi ? '\x1b[37m' + string + '\x1b[0m' : string;
}
function _Debug_internalColor(ansi, string)
{
return ansi ? '\x1b[94m' + string + '\x1b[0m' : string;
}
function _Debug_toHexDigit(n)
{
return String.fromCharCode(n < 10 ? 48 + n : 55 + n);
}
// CRASH
function _Debug_crash_UNUSED(identifier)
{
throw new Error('https://github.com/elm/core/blob/1.0.0/hints/' + identifier + '.md');
}
function _Debug_crash(identifier, fact1, fact2, fact3, fact4)
{
switch(identifier)
{
case 0:
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.');
case 1:
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.');
case 2:
var jsonErrorString = fact1;
throw new Error('Problem with the flags given to your Elm program on initialization.\n\n' + jsonErrorString);
case 3:
var portName = fact1;
throw new Error('There can only be one port named `' + portName + '`, but your program has multiple.');
case 4:
var portName = fact1;
var problem = fact2;
throw new Error('Trying to send an unexpected type of value through port `' + portName + '`:\n' + problem);
case 5:
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.');
case 6:
var moduleName = fact1;
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!');
case 8:
var moduleName = fact1;
var region = fact2;
var message = fact3;
throw new Error('TODO in module `' + moduleName + '` ' + _Debug_regionToString(region) + '\n\n' + message);
case 9:
var moduleName = fact1;
var region = fact2;
var value = fact3;
var message = fact4;
throw new Error(
'TODO in module `' + moduleName + '` from the `case` expression '
+ _Debug_regionToString(region) + '\n\nIt received the following value:\n\n '
+ _Debug_toString(value).replace('\n', '\n ')
+ '\n\nBut the branch that handles it says:\n\n ' + message.replace('\n', '\n ')
);
case 10:
throw new Error('Bug in https://github.com/elm/virtual-dom/issues');
case 11:
throw new Error('Cannot perform mod 0. Division by zero error.');
}
}
function _Debug_regionToString(region)
{
if (region.start.line === region.end.line)
{
return 'on line ' + region.start.line;
}
return 'on lines ' + region.start.line + ' through ' + region.end.line;
}
// EQUALITY
function _Utils_eq(x, y)
{
for (
var pair, stack = [], isEqual = _Utils_eqHelp(x, y, 0, stack);
isEqual && (pair = stack.pop());
isEqual = _Utils_eqHelp(pair.a, pair.b, 0, stack)
)
{}
return isEqual;
}
function _Utils_eqHelp(x, y, depth, stack)
{
if (depth > 100)
{
stack.push(_Utils_Tuple2(x,y));
return true;
}
if (x === y)
{
return true;
}
if (typeof x !== 'object' || x === null || y === null)
{
typeof x === 'function' && _Debug_crash(5);
return false;
}
/**/
if (x.$ === 'Set_elm_builtin')
{
x = elm$core$Set$toList(x);
y = elm$core$Set$toList(y);
}
if (x.$ === 'RBNode_elm_builtin' || x.$ === 'RBEmpty_elm_builtin')
{
x = elm$core$Dict$toList(x);
y = elm$core$Dict$toList(y);
}
//*/
/**_UNUSED/
if (x.$ < 0)
{
x = elm$core$Dict$toList(x);
y = elm$core$Dict$toList(y);
}
//*/
for (var key in x)
{
if (!_Utils_eqHelp(x[key], y[key], depth + 1, stack))
{
return false;
}
}
return true;
}
var _Utils_equal = F2(_Utils_eq);
var _Utils_notEqual = F2(function(a, b) { return !_Utils_eq(a,b); });
// COMPARISONS
// Code in Generate/JavaScript.hs, Basics.js, and List.js depends on
// the particular integer values assigned to LT, EQ, and GT.
function _Utils_cmp(x, y, ord)
{
if (typeof x !== 'object')
{
return x === y ? /*EQ*/ 0 : x < y ? /*LT*/ -1 : /*GT*/ 1;
}
/**/
if (x instanceof String)
{
var a = x.valueOf();
var b = y.valueOf();
return a === b ? 0 : a < b ? -1 : 1;
}
//*/
/**_UNUSED/
if (typeof x.$ === 'undefined')
//*/
/**/
if (x.$[0] === '#')
//*/
{
return (ord = _Utils_cmp(x.a, y.a))
? ord
: (ord = _Utils_cmp(x.b, y.b))
? ord
: _Utils_cmp(x.c, y.c);
}
// traverse conses until end of a list or a mismatch
for (; x.b && y.b && !(ord = _Utils_cmp(x.a, y.a)); x = x.b, y = y.b) {} // WHILE_CONSES
return ord || (x.b ? /*GT*/ 1 : y.b ? /*LT*/ -1 : /*EQ*/ 0);
}
var _Utils_lt = F2(function(a, b) { return _Utils_cmp(a, b) < 0; });
var _Utils_le = F2(function(a, b) { return _Utils_cmp(a, b) < 1; });
var _Utils_gt = F2(function(a, b) { return _Utils_cmp(a, b) > 0; });
var _Utils_ge = F2(function(a, b) { return _Utils_cmp(a, b) >= 0; });
var _Utils_compare = F2(function(x, y)
{
var n = _Utils_cmp(x, y);
return n < 0 ? elm$core$Basics$LT : n ? elm$core$Basics$GT : elm$core$Basics$EQ;
});
// COMMON VALUES
var _Utils_Tuple0_UNUSED = 0;
var _Utils_Tuple0 = { $: '#0' };
function _Utils_Tuple2_UNUSED(a, b) { return { a: a, b: b }; }
function _Utils_Tuple2(a, b) { return { $: '#2', a: a, b: b }; }
function _Utils_Tuple3_UNUSED(a, b, c) { return { a: a, b: b, c: c }; }
function _Utils_Tuple3(a, b, c) { return { $: '#3', a: a, b: b, c: c }; }
function _Utils_chr_UNUSED(c) { return c; }
function _Utils_chr(c) { return new String(c); }
// RECORDS
function _Utils_update(oldRecord, updatedFields)
{
var newRecord = {};
for (var key in oldRecord)
{
newRecord[key] = oldRecord[key];
}
for (var key in updatedFields)
{
newRecord[key] = updatedFields[key];
}
return newRecord;
}
// APPEND
var _Utils_append = F2(_Utils_ap);
function _Utils_ap(xs, ys)
{
// append Strings
if (typeof xs === 'string')
{
return xs + ys;
}
// append Lists
if (!xs.b)
{
return ys;
}
var root = _List_Cons(xs.a, ys);
xs = xs.b
for (var curr = root; xs.b; xs = xs.b) // WHILE_CONS
{
curr = curr.b = _List_Cons(xs.a, ys);
}
return root;
}
var _List_Nil_UNUSED = { $: 0 };
var _List_Nil = { $: '[]' };
function _List_Cons_UNUSED(hd, tl) { return { $: 1, a: hd, b: tl }; }
function _List_Cons(hd, tl) { return { $: '::', a: hd, b: tl }; }
var _List_cons = F2(_List_Cons);
function _List_fromArray(arr)
{
var out = _List_Nil;
for (var i = arr.length; i--; )
{
out = _List_Cons(arr[i], out);
}
return out;
}
function _List_toArray(xs)
{
for (var out = []; xs.b; xs = xs.b) // WHILE_CONS
{
out.push(xs.a);
}
return out;
}
var _List_map2 = F3(function(f, xs, ys)
{
for (var arr = []; xs.b && ys.b; xs = xs.b, ys = ys.b) // WHILE_CONSES
{
arr.push(A2(f, xs.a, ys.a));
}
return _List_fromArray(arr);
});
var _List_map3 = F4(function(f, xs, ys, zs)
{
for (var arr = []; xs.b && ys.b && zs.b; xs = xs.b, ys = ys.b, zs = zs.b) // WHILE_CONSES
{
arr.push(A3(f, xs.a, ys.a, zs.a));
}
return _List_fromArray(arr);
});
var _List_map4 = F5(function(f, ws, xs, ys, zs)
{
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
{
arr.push(A4(f, ws.a, xs.a, ys.a, zs.a));
}
return _List_fromArray(arr);
});
var _List_map5 = F6(function(f, vs, ws, xs, ys, zs)
{
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
{
arr.push(A5(f, vs.a, ws.a, xs.a, ys.a, zs.a));
}
return _List_fromArray(arr);
});
var _List_sortBy = F2(function(f, xs)
{
return _List_fromArray(_List_toArray(xs).sort(function(a, b) {
return _Utils_cmp(f(a), f(b));
}));
});
var _List_sortWith = F2(function(f, xs)
{
return _List_fromArray(_List_toArray(xs).sort(function(a, b) {
var ord = A2(f, a, b);
return ord === elm$core$Basics$EQ ? 0 : ord === elm$core$Basics$LT ? -1 : 1;
}));
});
// MATH
var _Basics_add = F2(function(a, b) { return a + b; });
var _Basics_sub = F2(function(a, b) { return a - b; });
var _Basics_mul = F2(function(a, b) { return a * b; });
var _Basics_fdiv = F2(function(a, b) { return a / b; });
var _Basics_idiv = F2(function(a, b) { return (a / b) | 0; });
var _Basics_pow = F2(Math.pow);
var _Basics_remainderBy = F2(function(b, a) { return a % b; });
// https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/divmodnote-letter.pdf
var _Basics_modBy = F2(function(modulus, x)
{
var answer = x % modulus;
return modulus === 0
? _Debug_crash(11)
:
((answer > 0 && modulus < 0) || (answer < 0 && modulus > 0))
? answer + modulus
: answer;
});
// TRIGONOMETRY
var _Basics_pi = Math.PI;
var _Basics_e = Math.E;
var _Basics_cos = Math.cos;
var _Basics_sin = Math.sin;
var _Basics_tan = Math.tan;
var _Basics_acos = Math.acos;
var _Basics_asin = Math.asin;
var _Basics_atan = Math.atan;
var _Basics_atan2 = F2(Math.atan2);
// MORE MATH
function _Basics_toFloat(x) { return x; }
function _Basics_truncate(n) { return n | 0; }
function _Basics_isInfinite(n) { return n === Infinity || n === -Infinity; }
var _Basics_ceiling = Math.ceil;
var _Basics_floor = Math.floor;
var _Basics_round = Math.round;
var _Basics_sqrt = Math.sqrt;
var _Basics_log = Math.log;
var _Basics_isNaN = isNaN;
// BOOLEANS
function _Basics_not(bool) { return !bool; }
var _Basics_and = F2(function(a, b) { return a && b; });
var _Basics_or = F2(function(a, b) { return a || b; });
var _Basics_xor = F2(function(a, b) { return a !== b; });
function _Char_toCode(char)
{
var code = char.charCodeAt(0);
if (0xD800 <= code && code <= 0xDBFF)
{
return (code - 0xD800) * 0x400 + char.charCodeAt(1) - 0xDC00 + 0x10000
}
return code;
}
function _Char_fromCode(code)
{
return _Utils_chr(
(code < 0 || 0x10FFFF < code)
? '\uFFFD'
:
(code <= 0xFFFF)
? String.fromCharCode(code)
:
(code -= 0x10000,
String.fromCharCode(Math.floor(code / 0x400) + 0xD800, code % 0x400 + 0xDC00)
)
);
}
function _Char_toUpper(char)
{
return _Utils_chr(char.toUpperCase());
}
function _Char_toLower(char)
{
return _Utils_chr(char.toLowerCase());
}
function _Char_toLocaleUpper(char)
{
return _Utils_chr(char.toLocaleUpperCase());
}
function _Char_toLocaleLower(char)
{
return _Utils_chr(char.toLocaleLowerCase());
}
var _String_cons = F2(function(chr, str)
{
return chr + str;
});
function _String_uncons(string)
{
var word = string.charCodeAt(0);
return word
? elm$core$Maybe$Just(
0xD800 <= word && word <= 0xDBFF
? _Utils_Tuple2(_Utils_chr(string[0] + string[1]), string.slice(2))
: _Utils_Tuple2(_Utils_chr(string[0]), string.slice(1))
)
: elm$core$Maybe$Nothing;
}
var _String_append = F2(function(a, b)
{
return a + b;
});
function _String_length(str)
{
return str.length;
}
var _String_map = F2(function(func, string)
{
var len = string.length;
var array = new Array(len);
var i = 0;
while (i < len)
{
var word = string.charCodeAt(i);
if (0xD800 <= word && word <= 0xDBFF)
{
array[i] = func(_Utils_chr(string[i] + string[i+1]));
i += 2;
continue;
}
array[i] = func(_Utils_chr(string[i]));
i++;
}
return array.join('');
});
var _String_filter = F2(function(isGood, str)
{
var arr = [];
var len = str.length;
var i = 0;
while (i < len)
{
var char = str[i];
var word = str.charCodeAt(i);
i++;
if (0xD800 <= word && word <= 0xDBFF)
{
char += str[i];
i++;
}
if (isGood(_Utils_chr(char)))
{
arr.push(char);
}
}
return arr.join('');
});
function _String_reverse(str)
{
var len = str.length;
var arr = new Array(len);
var i = 0;
while (i < len)
{
var word = str.charCodeAt(i);
if (0xD800 <= word && word <= 0xDBFF)
{
arr[len - i] = str[i + 1];
i++;
arr[len - i] = str[i - 1];
i++;
}
else
{
arr[len - i] = str[i];
i++;
}
}
return arr.join('');
}
var _String_foldl = F3(function(func, state, string)
{
var len = string.length;