Blame view

site_projet/js/dropzone.js 119 KB
19ae2416   jnduwamu   MAJ du site
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
  "use strict";
  
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  
  function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  /*
   *
   * More info at [www.dropzonejs.com](http://www.dropzonejs.com)
   *
   * Copyright (c) 2012, Matias Meno
   *
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the Software is
   * furnished to do so, subject to the following conditions:
   *
   * The above copyright notice and this permission notice shall be included in
   * all copies or substantial portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   * THE SOFTWARE.
   *
   */
  
  // The Emitter class provides the ability to call `.on()` on Dropzone to listen
  // to events.
  // It is strongly based on component's emitter class, and I removed the
  // functionality because of the dependency hell with different frameworks.
  var Emitter = function () {
    function Emitter() {
      _classCallCheck(this, Emitter);
    }
  
    _createClass(Emitter, [{
      key: "on",
  
      // Add an event listener for given event
      value: function on(event, fn) {
        this._callbacks = this._callbacks || {};
        // Create namespace for this event
        if (!this._callbacks[event]) {
          this._callbacks[event] = [];
        }
        this._callbacks[event].push(fn);
        return this;
      }
    }, {
      key: "emit",
      value: function emit(event) {
        this._callbacks = this._callbacks || {};
        var callbacks = this._callbacks[event];
  
        if (callbacks) {
          for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
            args[_key - 1] = arguments[_key];
          }
  
          for (var _iterator = callbacks, _isArray = true, _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
            var _ref;
  
            if (_isArray) {
              if (_i >= _iterator.length) break;
              _ref = _iterator[_i++];
            } else {
              _i = _iterator.next();
              if (_i.done) break;
              _ref = _i.value;
            }
  
            var callback = _ref;
  
            callback.apply(this, args);
          }
        }
  
        return this;
      }
  
      // Remove event listener for given event. If fn is not provided, all event
      // listeners for that event will be removed. If neither is provided, all
      // event listeners will be removed.
  
    }, {
      key: "off",
      value: function off(event, fn) {
        if (!this._callbacks || arguments.length === 0) {
          this._callbacks = {};
          return this;
        }
  
        // specific event
        var callbacks = this._callbacks[event];
        if (!callbacks) {
          return this;
        }
  
        // remove all handlers
        if (arguments.length === 1) {
          delete this._callbacks[event];
          return this;
        }
  
        // remove specific handler
        for (var i = 0; i < callbacks.length; i++) {
          var callback = callbacks[i];
          if (callback === fn) {
            callbacks.splice(i, 1);
            break;
          }
        }
  
        return this;
      }
    }]);
  
    return Emitter;
  }();
  
  var Dropzone = function (_Emitter) {
    _inherits(Dropzone, _Emitter);
  
    _createClass(Dropzone, null, [{
      key: "initClass",
      value: function initClass() {
  
        // Exposing the emitter class, mainly for tests
        this.prototype.Emitter = Emitter;
  
        /*
         This is a list of all available events you can register on a dropzone object.
          You can register an event handler like this:
          dropzone.on("dragEnter", function() { });
          */
        this.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "addedfile", "addedfiles", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded", "maxfilesreached", "queuecomplete"];
  
        this.prototype.defaultOptions = {
          /**
           * Has to be specified on elements other than form (or when the form
           * doesn't have an `action` attribute). You can also
           * provide a function that will be called with `files` and
           * must return the url (since `v3.12.0`)
           */
          url: null,
  
          /**
           * Can be changed to `"put"` if necessary. You can also provide a function
           * that will be called with `files` and must return the method (since `v3.12.0`).
           */
          method: "post",
  
          /**
           * Will be set on the XHRequest.
           */
          withCredentials: false,
  
          /**
           * The timeout for the XHR requests in milliseconds (since `v4.4.0`).
           */
          timeout: 30000,
  
          /**
           * How many file uploads to process in parallel (See the
           * Enqueuing file uploads* documentation section for more info)
           */
          parallelUploads: 2,
  
          /**
           * Whether to send multiple files in one request. If
           * this it set to true, then the fallback file input element will
           * have the `multiple` attribute as well. This option will
           * also trigger additional events (like `processingmultiple`). See the events
           * documentation section for more information.
           */
          uploadMultiple: false,
  
          /**
           * Whether you want files to be uploaded in chunks to your server. This can't be
           * used in combination with `uploadMultiple`.
           *
           * See [chunksUploaded](#config-chunksUploaded) for the callback to finalise an upload.
           */
          chunking: false,
  
          /**
           * If `chunking` is enabled, this defines whether **every** file should be chunked,
           * even if the file size is below chunkSize. This means, that the additional chunk
           * form data will be submitted and the `chunksUploaded` callback will be invoked.
           */
          forceChunking: false,
  
          /**
           * If `chunking` is `true`, then this defines the chunk size in bytes.
           */
          chunkSize: 2000000,
  
          /**
           * If `true`, the individual chunks of a file are being uploaded simultaneously.
           */
          parallelChunkUploads: false,
  
          /**
           * Whether a chunk should be retried if it fails.
           */
          retryChunks: false,
  
          /**
           * If `retryChunks` is true, how many times should it be retried.
           */
          retryChunksLimit: 3,
  
          /**
           * If not `null` defines how many files this Dropzone handles. If it exceeds,
           * the event `maxfilesexceeded` will be called. The dropzone element gets the
           * class `dz-max-files-reached` accordingly so you can provide visual feedback.
           */
          maxFilesize: 256,
  
          /**
           * The name of the file param that gets transferred.
           * **NOTE**: If you have the option  `uploadMultiple` set to `true`, then
           * Dropzone will append `[]` to the name.
           */
          paramName: "file",
  
          /**
           * Whether thumbnails for images should be generated
           */
          createImageThumbnails: true,
  
          /**
           * In MB. When the filename exceeds this limit, the thumbnail will not be generated.
           */
          maxThumbnailFilesize: 10,
  
          /**
           * If `null`, the ratio of the image will be used to calculate it.
           */
          thumbnailWidth: 120,
  
          /**
           * The same as `thumbnailWidth`. If both are null, images will not be resized.
           */
          thumbnailHeight: 120,
  
          /**
           * How the images should be scaled down in case both, `thumbnailWidth` and `thumbnailHeight` are provided.
           * Can be either `contain` or `crop`.
           */
          thumbnailMethod: 'crop',
  
          /**
           * If set, images will be resized to these dimensions before being **uploaded**.
           * If only one, `resizeWidth` **or** `resizeHeight` is provided, the original aspect
           * ratio of the file will be preserved.
           *
           * The `options.transformFile` function uses these options, so if the `transformFile` function
           * is overridden, these options don't do anything.
           */
          resizeWidth: null,
  
          /**
           * See `resizeWidth`.
           */
          resizeHeight: null,
  
          /**
           * The mime type of the resized image (before it gets uploaded to the server).
           * If `null` the original mime type will be used. To force jpeg, for example, use `image/jpeg`.
           * See `resizeWidth` for more information.
           */
          resizeMimeType: null,
  
          /**
           * The quality of the resized images. See `resizeWidth`.
           */
          resizeQuality: 0.8,
  
          /**
           * How the images should be scaled down in case both, `resizeWidth` and `resizeHeight` are provided.
           * Can be either `contain` or `crop`.
           */
          resizeMethod: 'contain',
  
          /**
           * The base that is used to calculate the filesize. You can change this to
           * 1024 if you would rather display kibibytes, mebibytes, etc...
           * 1024 is technically incorrect, because `1024 bytes` are `1 kibibyte` not `1 kilobyte`.
           * You can change this to `1024` if you don't care about validity.
           */
          filesizeBase: 1000,
  
          /**
           * Can be used to limit the maximum number of files that will be handled by this Dropzone
           */
          maxFiles: null,
  
          /**
           * An optional object to send additional headers to the server. Eg:
           * `{ "My-Awesome-Header": "header value" }`
           */
          headers: null,
  
          /**
           * If `true`, the dropzone element itself will be clickable, if `false`
           * nothing will be clickable.
           *
           * You can also pass an HTML element, a CSS selector (for multiple elements)
           * or an array of those. In that case, all of those elements will trigger an
           * upload when clicked.
           */
          clickable: true,
  
          /**
           * Whether hidden files in directories should be ignored.
           */
          ignoreHiddenFiles: true,
  
          /**
           * The default implementation of `accept` checks the file's mime type or
           * extension against this list. This is a comma separated list of mime
           * types or file extensions.
           *
           * Eg.: `image/*,application/pdf,.psd`
           *
           * If the Dropzone is `clickable` this option will also be used as
           * [`accept`](https://developer.mozilla.org/en-US/docs/HTML/Element/input#attr-accept)
           * parameter on the hidden file input as well.
           */
          acceptedFiles: null,
  
          /**
           * **Deprecated!**
           * Use acceptedFiles instead.
           */
          acceptedMimeTypes: null,
  
          /**
           * If false, files will be added to the queue but the queue will not be
           * processed automatically.
           * This can be useful if you need some additional user input before sending
           * files (or if you want want all files sent at once).
           * If you're ready to send the file simply call `myDropzone.processQueue()`.
           *
           * See the [enqueuing file uploads](#enqueuing-file-uploads) documentation
           * section for more information.
           */
          autoProcessQueue: true,
  
          /**
           * If false, files added to the dropzone will not be queued by default.
           * You'll have to call `enqueueFile(file)` manually.
           */
          autoQueue: true,
  
          /**
           * If `true`, this will add a link to every file preview to remove or cancel (if
           * already uploading) the file. The `dictCancelUpload`, `dictCancelUploadConfirmation`
           * and `dictRemoveFile` options are used for the wording.
           */
          addRemoveLinks: false,
  
          /**
           * Defines where to display the file previews – if `null` the
           * Dropzone element itself is used. Can be a plain `HTMLElement` or a CSS
           * selector. The element should have the `dropzone-previews` class so
           * the previews are displayed properly.
           */
          previewsContainer: null,
  
          /**
           * This is the element the hidden input field (which is used when clicking on the
           * dropzone to trigger file selection) will be appended to. This might
           * be important in case you use frameworks to switch the content of your page.
           *
           * Can be a selector string, or an element directly.
           */
          hiddenInputContainer: "body",
  
          /**
           * If null, no capture type will be specified
           * If camera, mobile devices will skip the file selection and choose camera
           * If microphone, mobile devices will skip the file selection and choose the microphone
           * If camcorder, mobile devices will skip the file selection and choose the camera in video mode
           * On apple devices multiple must be set to false.  AcceptedFiles may need to
           * be set to an appropriate mime type (e.g. "image/*", "audio/*", or "video/*").
           */
          capture: null,
  
          /**
           * **Deprecated**. Use `renameFile` instead.
           */
          renameFilename: null,
  
          /**
           * A function that is invoked before the file is uploaded to the server and renames the file.
           * This function gets the `File` as argument and can use the `file.name`. The actual name of the
           * file that gets used during the upload can be accessed through `file.upload.filename`.
           */
          renameFile: null,
  
          /**
           * If `true` the fallback will be forced. This is very useful to test your server
           * implementations first and make sure that everything works as
           * expected without dropzone if you experience problems, and to test
           * how your fallbacks will look.
           */
          forceFallback: false,
  
          /**
           * The text used before any files are dropped.
           */
          dictDefaultMessage: "Drop files here to upload",
  
          /**
           * The text that replaces the default message text it the browser is not supported.
           */
          dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
  
          /**
           * The text that will be added before the fallback form.
           * If you provide a  fallback element yourself, or if this option is `null` this will
           * be ignored.
           */
          dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
  
          /**
           * If the filesize is too big.
           * `{{filesize}}` and `{{maxFilesize}}` will be replaced with the respective configuration values.
           */
          dictFileTooBig: "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",
  
          /**
           * If the file doesn't match the file type.
           */
          dictInvalidFileType: "You can't upload files of this type.",
  
          /**
           * If the server response was invalid.
           * `{{statusCode}}` will be replaced with the servers status code.
           */
          dictResponseError: "Server responded with {{statusCode}} code.",
  
          /**
           * If `addRemoveLinks` is true, the text to be used for the cancel upload link.
           */
          dictCancelUpload: "Cancel upload",
  
          /**
           * The text that is displayed if an upload was manually canceled
           */
          dictUploadCanceled: "Upload canceled.",
  
          /**
           * If `addRemoveLinks` is true, the text to be used for confirmation when cancelling upload.
           */
          dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?",
  
          /**
           * If `addRemoveLinks` is true, the text to be used to remove a file.
           */
          dictRemoveFile: "Remove file",
  
          /**
           * If this is not null, then the user will be prompted before removing a file.
           */
          dictRemoveFileConfirmation: null,
  
          /**
           * Displayed if `maxFiles` is st and exceeded.
           * The string `{{maxFiles}}` will be replaced by the configuration value.
           */
          dictMaxFilesExceeded: "You can not upload any more files.",
  
          /**
           * Allows you to translate the different units. Starting with `tb` for terabytes and going down to
           * `b` for bytes.
           */
          dictFileSizeUnits: { tb: "TB", gb: "GB", mb: "MB", kb: "KB", b: "b" },
          /**
           * Called when dropzone initialized
           * You can add event listeners here
           */
          init: function init() {},
  
  
          /**
           * Can be an **object** of additional parameters to transfer to the server, **or** a `Function`
           * that gets invoked with the `files`, `xhr` and, if it's a chunked upload, `chunk` arguments. In case
           * of a function, this needs to return a map.
           *
           * The default implementation does nothing for normal uploads, but adds relevant information for
           * chunked uploads.
           *
           * This is the same as adding hidden input fields in the form element.
           */
          params: function params(files, xhr, chunk) {
            if (chunk) {
              return {
                dzuuid: chunk.file.upload.uuid,
                dzchunkindex: chunk.index,
                dztotalfilesize: chunk.file.size,
                dzchunksize: this.options.chunkSize,
                dztotalchunkcount: chunk.file.upload.totalChunkCount,
                dzchunkbyteoffset: chunk.index * this.options.chunkSize
              };
            }
          },
  
  
          /**
           * A function that gets a [file](https://developer.mozilla.org/en-US/docs/DOM/File)
           * and a `done` function as parameters.
           *
           * If the done function is invoked without arguments, the file is "accepted" and will
           * be processed. If you pass an error message, the file is rejected, and the error
           * message will be displayed.
           * This function will not be called if the file is too big or doesn't match the mime types.
           */
          accept: function accept(file, done) {
            return done();
          },
  
  
          /**
           * The callback that will be invoked when all chunks have been uploaded for a file.
           * It gets the file for which the chunks have been uploaded as the first parameter,
           * and the `done` function as second. `done()` needs to be invoked when everything
           * needed to finish the upload process is done.
           */
          chunksUploaded: function chunksUploaded(file, done) {
            done();
          },
  
          /**
           * Gets called when the browser is not supported.
           * The default implementation shows the fallback input field and adds
           * a text.
           */
          fallback: function fallback() {
            // This code should pass in IE7... :(
            var messageElement = void 0;
            this.element.className = this.element.className + " dz-browser-not-supported";
  
            for (var _iterator2 = this.element.getElementsByTagName("div"), _isArray2 = true, _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
              var _ref2;
  
              if (_isArray2) {
                if (_i2 >= _iterator2.length) break;
                _ref2 = _iterator2[_i2++];
              } else {
                _i2 = _iterator2.next();
                if (_i2.done) break;
                _ref2 = _i2.value;
              }
  
              var child = _ref2;
  
              if (/(^| )dz-message($| )/.test(child.className)) {
                messageElement = child;
                child.className = "dz-message"; // Removes the 'dz-default' class
                break;
              }
            }
            if (!messageElement) {
              messageElement = Dropzone.createElement("<div class=\"dz-message\"><span></span></div>");
              this.element.appendChild(messageElement);
            }
  
            var span = messageElement.getElementsByTagName("span")[0];
            if (span) {
              if (span.textContent != null) {
                span.textContent = this.options.dictFallbackMessage;
              } else if (span.innerText != null) {
                span.innerText = this.options.dictFallbackMessage;
              }
            }
  
            return this.element.appendChild(this.getFallbackForm());
          },
  
  
          /**
           * Gets called to calculate the thumbnail dimensions.
           *
           * It gets `file`, `width` and `height` (both may be `null`) as parameters and must return an object containing:
           *
           *  - `srcWidth` & `srcHeight` (required)
           *  - `trgWidth` & `trgHeight` (required)
           *  - `srcX` & `srcY` (optional, default `0`)
           *  - `trgX` & `trgY` (optional, default `0`)
           *
           * Those values are going to be used by `ctx.drawImage()`.
           */
          resize: function resize(file, width, height, resizeMethod) {
            var info = {
              srcX: 0,
              srcY: 0,
              srcWidth: file.width,
              srcHeight: file.height
            };
  
            var srcRatio = file.width / file.height;
  
            // Automatically calculate dimensions if not specified
            if (width == null && height == null) {
              width = info.srcWidth;
              height = info.srcHeight;
            } else if (width == null) {
              width = height * srcRatio;
            } else if (height == null) {
              height = width / srcRatio;
            }
  
            // Make sure images aren't upscaled
            width = Math.min(width, info.srcWidth);
            height = Math.min(height, info.srcHeight);
  
            var trgRatio = width / height;
  
            if (info.srcWidth > width || info.srcHeight > height) {
              // Image is bigger and needs rescaling
              if (resizeMethod === 'crop') {
                if (srcRatio > trgRatio) {
                  info.srcHeight = file.height;
                  info.srcWidth = info.srcHeight * trgRatio;
                } else {
                  info.srcWidth = file.width;
                  info.srcHeight = info.srcWidth / trgRatio;
                }
              } else if (resizeMethod === 'contain') {
                // Method 'contain'
                if (srcRatio > trgRatio) {
                  height = width / srcRatio;
                } else {
                  width = height * srcRatio;
                }
              } else {
                throw new Error("Unknown resizeMethod '" + resizeMethod + "'");
              }
            }
  
            info.srcX = (file.width - info.srcWidth) / 2;
            info.srcY = (file.height - info.srcHeight) / 2;
  
            info.trgWidth = width;
            info.trgHeight = height;
  
            return info;
          },
  
  
          /**
           * Can be used to transform the file (for example, resize an image if necessary).
           *
           * The default implementation uses `resizeWidth` and `resizeHeight` (if provided) and resizes
           * images according to those dimensions.
           *
           * Gets the `file` as the first parameter, and a `done()` function as the second, that needs
           * to be invoked with the file when the transformation is done.
           */
          transformFile: function transformFile(file, done) {
            if ((this.options.resizeWidth || this.options.resizeHeight) && file.type.match(/image.*/)) {
              return this.resizeImage(file, this.options.resizeWidth, this.options.resizeHeight, this.options.resizeMethod, done);
            } else {
              return done(file);
            }
          },
  
  
          /**
           * A string that contains the template used for each dropped
           * file. Change it to fulfill your needs but make sure to properly
           * provide all elements.
           *
           * If you want to use an actual HTML element instead of providing a String
           * as a config option, you could create a div with the id `tpl`,
           * put the template inside it and provide the element like this:
           *
           *     document
           *       .querySelector('#tpl')
           *       .innerHTML
           *
           */
          previewTemplate: "<div class=\"dz-preview dz-file-preview\">\n  <div class=\"dz-image\"><img data-dz-thumbnail /></div>\n  <div class=\"dz-details\">\n    <div class=\"dz-size\"><span data-dz-size></span></div>\n    <div class=\"dz-filename\"><span data-dz-name></span></div>\n  </div>\n  <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n  <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n  <div class=\"dz-success-mark\">\n    <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n      <title>Check</title>\n      <defs></defs>\n      <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n        <path d=\"M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" stroke-opacity=\"0.198794158\" stroke=\"#747474\" fill-opacity=\"0.816519475\" fill=\"#FFFFFF\" sketch:type=\"MSShapeGroup\"></path>\n      </g>\n    </svg>\n  </div>\n  <div class=\"dz-error-mark\">\n    <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n      <title>Error</title>\n      <defs></defs>\n      <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n        <g id=\"Check-+-Oval-2\" sketch:type=\"MSLayerGroup\" stroke=\"#747474\" stroke-opacity=\"0.198794158\" fill=\"#FFFFFF\" fill-opacity=\"0.816519475\">\n          <path d=\"M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" sketch:type=\"MSShapeGroup\"></path>\n        </g>\n      </g>\n    </svg>\n  </div>\n</div>",
  
          // END OPTIONS
          // (Required by the dropzone documentation parser)
  
  
          /*
           Those functions register themselves to the events on init and handle all
           the user interface specific stuff. Overwriting them won't break the upload
           but can break the way it's displayed.
           You can overwrite them if you don't like the default behavior. If you just
           want to add an additional event handler, register it on the dropzone object
           and don't overwrite those options.
           */
  
          // Those are self explanatory and simply concern the DragnDrop.
          drop: function drop(e) {
            return this.element.classList.remove("dz-drag-hover");
          },
          dragstart: function dragstart(e) {},
          dragend: function dragend(e) {
            return this.element.classList.remove("dz-drag-hover");
          },
          dragenter: function dragenter(e) {
            return this.element.classList.add("dz-drag-hover");
          },
          dragover: function dragover(e) {
            return this.element.classList.add("dz-drag-hover");
          },
          dragleave: function dragleave(e) {
            return this.element.classList.remove("dz-drag-hover");
          },
          paste: function paste(e) {},
  
  
          // Called whenever there are no files left in the dropzone anymore, and the
          // dropzone should be displayed as if in the initial state.
          reset: function reset() {
            return this.element.classList.remove("dz-started");
          },
  
  
          // Called when a file is added to the queue
          // Receives `file`
          addedfile: function addedfile(file) {
            var _this2 = this;
  
            if (this.element === this.previewsContainer) {
              this.element.classList.add("dz-started");
            }
  
            if (this.previewsContainer) {
              file.previewElement = Dropzone.createElement(this.options.previewTemplate.trim());
              file.previewTemplate = file.previewElement; // Backwards compatibility
  
              this.previewsContainer.appendChild(file.previewElement);
              for (var _iterator3 = file.previewElement.querySelectorAll("[data-dz-name]"), _isArray3 = true, _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
                var _ref3;
  
                if (_isArray3) {
                  if (_i3 >= _iterator3.length) break;
                  _ref3 = _iterator3[_i3++];
                } else {
                  _i3 = _iterator3.next();
                  if (_i3.done) break;
                  _ref3 = _i3.value;
                }
  
                var node = _ref3;
  
                node.textContent = file.name;
              }
              for (var _iterator4 = file.previewElement.querySelectorAll("[data-dz-size]"), _isArray4 = true, _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
                if (_isArray4) {
                  if (_i4 >= _iterator4.length) break;
                  node = _iterator4[_i4++];
                } else {
                  _i4 = _iterator4.next();
                  if (_i4.done) break;
                  node = _i4.value;
                }
  
                node.innerHTML = this.filesize(file.size);
              }
  
              if (this.options.addRemoveLinks) {
                file._removeLink = Dropzone.createElement("<a class=\"dz-remove\" href=\"javascript:undefined;\" data-dz-remove>" + this.options.dictRemoveFile + "</a>");
                file.previewElement.appendChild(file._removeLink);
              }
  
              var removeFileEvent = function removeFileEvent(e) {
                e.preventDefault();
                e.stopPropagation();
                if (file.status === Dropzone.UPLOADING) {
                  return Dropzone.confirm(_this2.options.dictCancelUploadConfirmation, function () {
                    return _this2.removeFile(file);
                  });
                } else {
                  if (_this2.options.dictRemoveFileConfirmation) {
                    return Dropzone.confirm(_this2.options.dictRemoveFileConfirmation, function () {
                      return _this2.removeFile(file);
                    });
                  } else {
                    return _this2.removeFile(file);
                  }
                }
              };
  
              for (var _iterator5 = file.previewElement.querySelectorAll("[data-dz-remove]"), _isArray5 = true, _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
                var _ref4;
  
                if (_isArray5) {
                  if (_i5 >= _iterator5.length) break;
                  _ref4 = _iterator5[_i5++];
                } else {
                  _i5 = _iterator5.next();
                  if (_i5.done) break;
                  _ref4 = _i5.value;
                }
  
                var removeLink = _ref4;
  
                removeLink.addEventListener("click", removeFileEvent);
              }
            }
          },
  
  
          // Called whenever a file is removed.
          removedfile: function removedfile(file) {
            if (file.previewElement != null && file.previewElement.parentNode != null) {
              file.previewElement.parentNode.removeChild(file.previewElement);
            }
            return this._updateMaxFilesReachedClass();
          },
  
  
          // Called when a thumbnail has been generated
          // Receives `file` and `dataUrl`
          thumbnail: function thumbnail(file, dataUrl) {
            if (file.previewElement) {
              file.previewElement.classList.remove("dz-file-preview");
              for (var _iterator6 = file.previewElement.querySelectorAll("[data-dz-thumbnail]"), _isArray6 = true, _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) {
                var _ref5;
  
                if (_isArray6) {
                  if (_i6 >= _iterator6.length) break;
                  _ref5 = _iterator6[_i6++];
                } else {
                  _i6 = _iterator6.next();
                  if (_i6.done) break;
                  _ref5 = _i6.value;
                }
  
                var thumbnailElement = _ref5;
  
                thumbnailElement.alt = file.name;
                thumbnailElement.src = dataUrl;
              }
  
              return setTimeout(function () {
                return file.previewElement.classList.add("dz-image-preview");
              }, 1);
            }
          },
  
  
          // Called whenever an error occurs
          // Receives `file` and `message`
          error: function error(file, message) {
            if (file.previewElement) {
              file.previewElement.classList.add("dz-error");
              if (typeof message !== "String" && message.error) {
                message = message.error;
              }
              for (var _iterator7 = file.previewElement.querySelectorAll("[data-dz-errormessage]"), _isArray7 = true, _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) {
                var _ref6;
  
                if (_isArray7) {
                  if (_i7 >= _iterator7.length) break;
                  _ref6 = _iterator7[_i7++];
                } else {
                  _i7 = _iterator7.next();
                  if (_i7.done) break;
                  _ref6 = _i7.value;
                }
  
                var node = _ref6;
  
                node.textContent = message;
              }
            }
          },
          errormultiple: function errormultiple() {},
  
  
          // Called when a file gets processed. Since there is a cue, not all added
          // files are processed immediately.
          // Receives `file`
          processing: function processing(file) {
            if (file.previewElement) {
              file.previewElement.classList.add("dz-processing");
              if (file._removeLink) {
                return file._removeLink.innerHTML = this.options.dictCancelUpload;
              }
            }
          },
          processingmultiple: function processingmultiple() {},
  
  
          // Called whenever the upload progress gets updated.
          // Receives `file`, `progress` (percentage 0-100) and `bytesSent`.
          // To get the total number of bytes of the file, use `file.size`
          uploadprogress: function uploadprogress(file, progress, bytesSent) {
            if (file.previewElement) {
              for (var _iterator8 = file.previewElement.querySelectorAll("[data-dz-uploadprogress]"), _isArray8 = true, _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) {
                var _ref7;
  
                if (_isArray8) {
                  if (_i8 >= _iterator8.length) break;
                  _ref7 = _iterator8[_i8++];
                } else {
                  _i8 = _iterator8.next();
                  if (_i8.done) break;
                  _ref7 = _i8.value;
                }
  
                var node = _ref7;
  
                node.nodeName === 'PROGRESS' ? node.value = progress : node.style.width = progress + "%";
              }
            }
          },
  
  
          // Called whenever the total upload progress gets updated.
          // Called with totalUploadProgress (0-100), totalBytes and totalBytesSent
          totaluploadprogress: function totaluploadprogress() {},
  
  
          // Called just before the file is sent. Gets the `xhr` object as second
          // parameter, so you can modify it (for example to add a CSRF token) and a
          // `formData` object to add additional information.
          sending: function sending() {},
          sendingmultiple: function sendingmultiple() {},
  
  
          // When the complete upload is finished and successful
          // Receives `file`
          success: function success(file) {
            if (file.previewElement) {
              return file.previewElement.classList.add("dz-success");
            }
          },
          successmultiple: function successmultiple() {},
  
  
          // When the upload is canceled.
          canceled: function canceled(file) {
            return this.emit("error", file, this.options.dictUploadCanceled);
          },
          canceledmultiple: function canceledmultiple() {},
  
  
          // When the upload is finished, either with success or an error.
          // Receives `file`
          complete: function complete(file) {
            if (file._removeLink) {
              file._removeLink.innerHTML = this.options.dictRemoveFile;
            }
            if (file.previewElement) {
              return file.previewElement.classList.add("dz-complete");
            }
          },
          completemultiple: function completemultiple() {},
          maxfilesexceeded: function maxfilesexceeded() {},
          maxfilesreached: function maxfilesreached() {},
          queuecomplete: function queuecomplete() {},
          addedfiles: function addedfiles() {}
        };
  
        this.prototype._thumbnailQueue = [];
        this.prototype._processingThumbnail = false;
      }
  
      // global utility
  
    }, {
      key: "extend",
      value: function extend(target) {
        for (var _len2 = arguments.length, objects = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
          objects[_key2 - 1] = arguments[_key2];
        }
  
        for (var _iterator9 = objects, _isArray9 = true, _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) {
          var _ref8;
  
          if (_isArray9) {
            if (_i9 >= _iterator9.length) break;
            _ref8 = _iterator9[_i9++];
          } else {
            _i9 = _iterator9.next();
            if (_i9.done) break;
            _ref8 = _i9.value;
          }
  
          var object = _ref8;
  
          for (var key in object) {
            var val = object[key];
            target[key] = val;
          }
        }
        return target;
      }
    }]);
  
    function Dropzone(el, options) {
      _classCallCheck(this, Dropzone);
  
      var _this = _possibleConstructorReturn(this, (Dropzone.__proto__ || Object.getPrototypeOf(Dropzone)).call(this));
  
      var fallback = void 0,
          left = void 0;
      _this.element = el;
      // For backwards compatibility since the version was in the prototype previously
      _this.version = Dropzone.version;
  
      _this.defaultOptions.previewTemplate = _this.defaultOptions.previewTemplate.replace(/\n*/g, "");
  
      _this.clickableElements = [];
      _this.listeners = [];
      _this.files = []; // All files
  
      if (typeof _this.element === "string") {
        _this.element = document.querySelector(_this.element);
      }
  
      // Not checking if instance of HTMLElement or Element since IE9 is extremely weird.
      if (!_this.element || _this.element.nodeType == null) {
        throw new Error("Invalid dropzone element.");
      }
  
      if (_this.element.dropzone) {
        throw new Error("Dropzone already attached.");
      }
  
      // Now add this dropzone to the instances.
      Dropzone.instances.push(_this);
  
      // Put the dropzone inside the element itself.
      _this.element.dropzone = _this;
  
      var elementOptions = (left = Dropzone.optionsForElement(_this.element)) != null ? left : {};
  
      _this.options = Dropzone.extend({}, _this.defaultOptions, elementOptions, options != null ? options : {});
  
      // If the browser failed, just call the fallback and leave
      if (_this.options.forceFallback || !Dropzone.isBrowserSupported()) {
        var _ret;
  
        return _ret = _this.options.fallback.call(_this), _possibleConstructorReturn(_this, _ret);
      }
  
      // @options.url = @element.getAttribute "action" unless @options.url?
      if (_this.options.url == null) {
        _this.options.url = _this.element.getAttribute("action");
      }
  
      if (!_this.options.url) {
        throw new Error("No URL provided.");
      }
  
      if (_this.options.acceptedFiles && _this.options.acceptedMimeTypes) {
        throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");
      }
  
      if (_this.options.uploadMultiple && _this.options.chunking) {
        throw new Error('You cannot set both: uploadMultiple and chunking.');
      }
  
      // Backwards compatibility
      if (_this.options.acceptedMimeTypes) {
        _this.options.acceptedFiles = _this.options.acceptedMimeTypes;
        delete _this.options.acceptedMimeTypes;
      }
  
      // Backwards compatibility
      if (_this.options.renameFilename != null) {
        _this.options.renameFile = function (file) {
          return _this.options.renameFilename.call(_this, file.name, file);
        };
      }
  
      _this.options.method = _this.options.method.toUpperCase();
  
      if ((fallback = _this.getExistingFallback()) && fallback.parentNode) {
        // Remove the fallback
        fallback.parentNode.removeChild(fallback);
      }
  
      // Display previews in the previewsContainer element or the Dropzone element unless explicitly set to false
      if (_this.options.previewsContainer !== false) {
        if (_this.options.previewsContainer) {
          _this.previewsContainer = Dropzone.getElement(_this.options.previewsContainer, "previewsContainer");
        } else {
          _this.previewsContainer = _this.element;
        }
      }
  
      if (_this.options.clickable) {
        if (_this.options.clickable === true) {
          _this.clickableElements = [_this.element];
        } else {
          _this.clickableElements = Dropzone.getElements(_this.options.clickable, "clickable");
        }
      }
  
      _this.init();
      return _this;
    }
  
    // Returns all files that have been accepted
  
  
    _createClass(Dropzone, [{
      key: "getAcceptedFiles",
      value: function getAcceptedFiles() {
        return this.files.filter(function (file) {
          return file.accepted;
        }).map(function (file) {
          return file;
        });
      }
  
      // Returns all files that have been rejected
      // Not sure when that's going to be useful, but added for completeness.
  
    }, {
      key: "getRejectedFiles",
      value: function getRejectedFiles() {
        return this.files.filter(function (file) {
          return !file.accepted;
        }).map(function (file) {
          return file;
        });
      }
    }, {
      key: "getFilesWithStatus",
      value: function getFilesWithStatus(status) {
        return this.files.filter(function (file) {
          return file.status === status;
        }).map(function (file) {
          return file;
        });
      }
  
      // Returns all files that are in the queue
  
    }, {
      key: "getQueuedFiles",
      value: function getQueuedFiles() {
        return this.getFilesWithStatus(Dropzone.QUEUED);
      }
    }, {
      key: "getUploadingFiles",
      value: function getUploadingFiles() {
        return this.getFilesWithStatus(Dropzone.UPLOADING);
      }
    }, {
      key: "getAddedFiles",
      value: function getAddedFiles() {
        return this.getFilesWithStatus(Dropzone.ADDED);
      }
  
      // Files that are either queued or uploading
  
    }, {
      key: "getActiveFiles",
      value: function getActiveFiles() {
        return this.files.filter(function (file) {
          return file.status === Dropzone.UPLOADING || file.status === Dropzone.QUEUED;
        }).map(function (file) {
          return file;
        });
      }
  
      // The function that gets called when Dropzone is initialized. You
      // can (and should) setup event listeners inside this function.
  
    }, {
      key: "init",
      value: function init() {
        var _this3 = this;
  
        // In case it isn't set already
        if (this.element.tagName === "form") {
          this.element.setAttribute("enctype", "multipart/form-data");
        }
  
        if (this.element.classList.contains("dropzone") && !this.element.querySelector(".dz-message")) {
          this.element.appendChild(Dropzone.createElement("<div class=\"dz-default dz-message\"><span>" + this.options.dictDefaultMessage + "</span></div>"));
        }
  
        if (this.clickableElements.length) {
          var setupHiddenFileInput = function setupHiddenFileInput() {
            if (_this3.hiddenFileInput) {
              _this3.hiddenFileInput.parentNode.removeChild(_this3.hiddenFileInput);
            }
            _this3.hiddenFileInput = document.createElement("input");
            _this3.hiddenFileInput.setAttribute("type", "file");
            if (_this3.options.maxFiles === null || _this3.options.maxFiles > 1) {
              _this3.hiddenFileInput.setAttribute("multiple", "multiple");
            }
            _this3.hiddenFileInput.className = "dz-hidden-input";
  
            if (_this3.options.acceptedFiles !== null) {
              _this3.hiddenFileInput.setAttribute("accept", _this3.options.acceptedFiles);
            }
            if (_this3.options.capture !== null) {
              _this3.hiddenFileInput.setAttribute("capture", _this3.options.capture);
            }
  
            // Not setting `display="none"` because some browsers don't accept clicks
            // on elements that aren't displayed.
            _this3.hiddenFileInput.style.visibility = "hidden";
            _this3.hiddenFileInput.style.position = "absolute";
            _this3.hiddenFileInput.style.top = "0";
            _this3.hiddenFileInput.style.left = "0";
            _this3.hiddenFileInput.style.height = "0";
            _this3.hiddenFileInput.style.width = "0";
            Dropzone.getElement(_this3.options.hiddenInputContainer, 'hiddenInputContainer').appendChild(_this3.hiddenFileInput);
            return _this3.hiddenFileInput.addEventListener("change", function () {
              var files = _this3.hiddenFileInput.files;
  
              if (files.length) {
                for (var _iterator10 = files, _isArray10 = true, _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator]();;) {
                  var _ref9;
  
                  if (_isArray10) {
                    if (_i10 >= _iterator10.length) break;
                    _ref9 = _iterator10[_i10++];
                  } else {
                    _i10 = _iterator10.next();
                    if (_i10.done) break;
                    _ref9 = _i10.value;
                  }
  
                  var file = _ref9;
  
                  _this3.addFile(file);
                }
              }
              _this3.emit("addedfiles", files);
              return setupHiddenFileInput();
            });
          };
          setupHiddenFileInput();
        }
  
        this.URL = window.URL !== null ? window.URL : window.webkitURL;
  
        // Setup all event listeners on the Dropzone object itself.
        // They're not in @setupEventListeners() because they shouldn't be removed
        // again when the dropzone gets disabled.
        for (var _iterator11 = this.events, _isArray11 = true, _i11 = 0, _iterator11 = _isArray11 ? _iterator11 : _iterator11[Symbol.iterator]();;) {
          var _ref10;
  
          if (_isArray11) {
            if (_i11 >= _iterator11.length) break;
            _ref10 = _iterator11[_i11++];
          } else {
            _i11 = _iterator11.next();
            if (_i11.done) break;
            _ref10 = _i11.value;
          }
  
          var eventName = _ref10;
  
          this.on(eventName, this.options[eventName]);
        }
  
        this.on("uploadprogress", function () {
          return _this3.updateTotalUploadProgress();
        });
  
        this.on("removedfile", function () {
          return _this3.updateTotalUploadProgress();
        });
  
        this.on("canceled", function (file) {
          return _this3.emit("complete", file);
        });
  
        // Emit a `queuecomplete` event if all files finished uploading.
        this.on("complete", function (file) {
          if (_this3.getAddedFiles().length === 0 && _this3.getUploadingFiles().length === 0 && _this3.getQueuedFiles().length === 0) {
            // This needs to be deferred so that `queuecomplete` really triggers after `complete`
            return setTimeout(function () {
              return _this3.emit("queuecomplete");
            }, 0);
          }
        });
  
        var noPropagation = function noPropagation(e) {
          e.stopPropagation();
          if (e.preventDefault) {
            return e.preventDefault();
          } else {
            return e.returnValue = false;
          }
        };
  
        // Create the listeners
        this.listeners = [{
          element: this.element,
          events: {
            "dragstart": function dragstart(e) {
              return _this3.emit("dragstart", e);
            },
            "dragenter": function dragenter(e) {
              noPropagation(e);
              return _this3.emit("dragenter", e);
            },
            "dragover": function dragover(e) {
              // Makes it possible to drag files from chrome's download bar
              // http://stackoverflow.com/questions/19526430/drag-and-drop-file-uploads-from-chrome-downloads-bar
              // Try is required to prevent bug in Internet Explorer 11 (SCRIPT65535 exception)
              var efct = void 0;
              try {
                efct = e.dataTransfer.effectAllowed;
              } catch (error) {}
              e.dataTransfer.dropEffect = 'move' === efct || 'linkMove' === efct ? 'move' : 'copy';
  
              noPropagation(e);
              return _this3.emit("dragover", e);
            },
            "dragleave": function dragleave(e) {
              return _this3.emit("dragleave", e);
            },
            "drop": function drop(e) {
              noPropagation(e);
              return _this3.drop(e);
            },
            "dragend": function dragend(e) {
              return _this3.emit("dragend", e);
            }
  
            // This is disabled right now, because the browsers don't implement it properly.
            // "paste": (e) =>
            //   noPropagation e
            //   @paste e
          } }];
  
        this.clickableElements.forEach(function (clickableElement) {
          return _this3.listeners.push({
            element: clickableElement,
            events: {
              "click": function click(evt) {
                // Only the actual dropzone or the message element should trigger file selection
                if (clickableElement !== _this3.element || evt.target === _this3.element || Dropzone.elementInside(evt.target, _this3.element.querySelector(".dz-message"))) {
                  _this3.hiddenFileInput.click(); // Forward the click
                }
                return true;
              }
            }
          });
        });
  
        this.enable();
  
        return this.options.init.call(this);
      }
  
      // Not fully tested yet
  
    }, {
      key: "destroy",
      value: function destroy() {
        this.disable();
        this.removeAllFiles(true);
        if (this.hiddenFileInput != null ? this.hiddenFileInput.parentNode : undefined) {
          this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);
          this.hiddenFileInput = null;
        }
        delete this.element.dropzone;
        return Dropzone.instances.splice(Dropzone.instances.indexOf(this), 1);
      }
    }, {
      key: "updateTotalUploadProgress",
      value: function updateTotalUploadProgress() {
        var totalUploadProgress = void 0;
        var totalBytesSent = 0;
        var totalBytes = 0;
  
        var activeFiles = this.getActiveFiles();
  
        if (activeFiles.length) {
          for (var _iterator12 = this.getActiveFiles(), _isArray12 = true, _i12 = 0, _iterator12 = _isArray12 ? _iterator12 : _iterator12[Symbol.iterator]();;) {
            var _ref11;
  
            if (_isArray12) {
              if (_i12 >= _iterator12.length) break;
              _ref11 = _iterator12[_i12++];
            } else {
              _i12 = _iterator12.next();
              if (_i12.done) break;
              _ref11 = _i12.value;
            }
  
            var file = _ref11;
  
            totalBytesSent += file.upload.bytesSent;
            totalBytes += file.upload.total;
          }
          totalUploadProgress = 100 * totalBytesSent / totalBytes;
        } else {
          totalUploadProgress = 100;
        }
  
        return this.emit("totaluploadprogress", totalUploadProgress, totalBytes, totalBytesSent);
      }
  
      // @options.paramName can be a function taking one parameter rather than a string.
      // A parameter name for a file is obtained simply by calling this with an index number.
  
    }, {
      key: "_getParamName",
      value: function _getParamName(n) {
        if (typeof this.options.paramName === "function") {
          return this.options.paramName(n);
        } else {
          return "" + this.options.paramName + (this.options.uploadMultiple ? "[" + n + "]" : "");
        }
      }
  
      // If @options.renameFile is a function,
      // the function will be used to rename the file.name before appending it to the formData
  
    }, {
      key: "_renameFile",
      value: function _renameFile(file) {
        if (typeof this.options.renameFile !== "function") {
          return file.name;
        }
        return this.options.renameFile(file);
      }
  
      // Returns a form that can be used as fallback if the browser does not support DragnDrop
      //
      // If the dropzone is already a form, only the input field and button are returned. Otherwise a complete form element is provided.
      // This code has to pass in IE7 :(
  
    }, {
      key: "getFallbackForm",
      value: function getFallbackForm() {
        var existingFallback = void 0,
            form = void 0;
        if (existingFallback = this.getExistingFallback()) {
          return existingFallback;
        }
  
        var fieldsString = "<div class=\"dz-fallback\">";
        if (this.options.dictFallbackText) {
          fieldsString += "<p>" + this.options.dictFallbackText + "</p>";
        }
        fieldsString += "<input type=\"file\" name=\"" + this._getParamName(0) + "\" " + (this.options.uploadMultiple ? 'multiple="multiple"' : undefined) + " /><input type=\"submit\" value=\"Upload!\"></div>";
  
        var fields = Dropzone.createElement(fieldsString);
        if (this.element.tagName !== "FORM") {
          form = Dropzone.createElement("<form action=\"" + this.options.url + "\" enctype=\"multipart/form-data\" method=\"" + this.options.method + "\"></form>");
          form.appendChild(fields);
        } else {
          // Make sure that the enctype and method attributes are set properly
          this.element.setAttribute("enctype", "multipart/form-data");
          this.element.setAttribute("method", this.options.method);
        }
        return form != null ? form : fields;
      }
  
      // Returns the fallback elements if they exist already
      //
      // This code has to pass in IE7 :(
  
    }, {
      key: "getExistingFallback",
      value: function getExistingFallback() {
        var getFallback = function getFallback(elements) {
          for (var _iterator13 = elements, _isArray13 = true, _i13 = 0, _iterator13 = _isArray13 ? _iterator13 : _iterator13[Symbol.iterator]();;) {
            var _ref12;
  
            if (_isArray13) {
              if (_i13 >= _iterator13.length) break;
              _ref12 = _iterator13[_i13++];
            } else {
              _i13 = _iterator13.next();
              if (_i13.done) break;
              _ref12 = _i13.value;
            }
  
            var el = _ref12;
  
            if (/(^| )fallback($| )/.test(el.className)) {
              return el;
            }
          }
        };
  
        var _arr = ["div", "form"];
        for (var _i14 = 0; _i14 < _arr.length; _i14++) {
          var tagName = _arr[_i14];
          var fallback;
          if (fallback = getFallback(this.element.getElementsByTagName(tagName))) {
            return fallback;
          }
        }
      }
  
      // Activates all listeners stored in @listeners
  
    }, {
      key: "setupEventListeners",
      value: function setupEventListeners() {
        return this.listeners.map(function (elementListeners) {
          return function () {
            var result = [];
            for (var event in elementListeners.events) {
              var listener = elementListeners.events[event];
              result.push(elementListeners.element.addEventListener(event, listener, false));
            }
            return result;
          }();
        });
      }
  
      // Deactivates all listeners stored in @listeners
  
    }, {
      key: "removeEventListeners",
      value: function removeEventListeners() {
        return this.listeners.map(function (elementListeners) {
          return function () {
            var result = [];
            for (var event in elementListeners.events) {
              var listener = elementListeners.events[event];
              result.push(elementListeners.element.removeEventListener(event, listener, false));
            }
            return result;
          }();
        });
      }
  
      // Removes all event listeners and cancels all files in the queue or being processed.
  
    }, {
      key: "disable",
      value: function disable() {
        var _this4 = this;
  
        this.clickableElements.forEach(function (element) {
          return element.classList.remove("dz-clickable");
        });
        this.removeEventListeners();
        this.disabled = true;
  
        return this.files.map(function (file) {
          return _this4.cancelUpload(file);
        });
      }
    }, {
      key: "enable",
      value: function enable() {
        delete this.disabled;
        this.clickableElements.forEach(function (element) {
          return element.classList.add("dz-clickable");
        });
        return this.setupEventListeners();
      }
  
      // Returns a nicely formatted filesize
  
    }, {
      key: "filesize",
      value: function filesize(size) {
        var selectedSize = 0;
        var selectedUnit = "b";
  
        if (size > 0) {
          var units = ['tb', 'gb', 'mb', 'kb', 'b'];
  
          for (var i = 0; i < units.length; i++) {
            var unit = units[i];
            var cutoff = Math.pow(this.options.filesizeBase, 4 - i) / 10;
  
            if (size >= cutoff) {
              selectedSize = size / Math.pow(this.options.filesizeBase, 4 - i);
              selectedUnit = unit;
              break;
            }
          }
  
          selectedSize = Math.round(10 * selectedSize) / 10; // Cutting of digits
        }
  
        return "<strong>" + selectedSize + "</strong> " + this.options.dictFileSizeUnits[selectedUnit];
      }
  
      // Adds or removes the `dz-max-files-reached` class from the form.
  
    }, {
      key: "_updateMaxFilesReachedClass",
      value: function _updateMaxFilesReachedClass() {
        if (this.options.maxFiles != null && this.getAcceptedFiles().length >= this.options.maxFiles) {
          if (this.getAcceptedFiles().length === this.options.maxFiles) {
            this.emit('maxfilesreached', this.files);
          }
          return this.element.classList.add("dz-max-files-reached");
        } else {
          return this.element.classList.remove("dz-max-files-reached");
        }
      }
    }, {
      key: "drop",
      value: function drop(e) {
        if (!e.dataTransfer) {
          return;
        }
        this.emit("drop", e);
  
        // Convert the FileList to an Array
        // This is necessary for IE11
        var files = [];
        for (var i = 0; i < e.dataTransfer.files.length; i++) {
          files[i] = e.dataTransfer.files[i];
        }
  
        this.emit("addedfiles", files);
  
        // Even if it's a folder, files.length will contain the folders.
        if (files.length) {
          var items = e.dataTransfer.items;
  
          if (items && items.length && items[0].webkitGetAsEntry != null) {
            // The browser supports dropping of folders, so handle items instead of files
            this._addFilesFromItems(items);
          } else {
            this.handleFiles(files);
          }
        }
      }
    }, {
      key: "paste",
      value: function paste(e) {
        if (__guard__(e != null ? e.clipboardData : undefined, function (x) {
          return x.items;
        }) == null) {
          return;
        }
  
        this.emit("paste", e);
        var items = e.clipboardData.items;
  
  
        if (items.length) {
          return this._addFilesFromItems(items);
        }
      }
    }, {
      key: "handleFiles",
      value: function handleFiles(files) {
        for (var _iterator14 = files, _isArray14 = true, _i15 = 0, _iterator14 = _isArray14 ? _iterator14 : _iterator14[Symbol.iterator]();;) {
          var _ref13;
  
          if (_isArray14) {
            if (_i15 >= _iterator14.length) break;
            _ref13 = _iterator14[_i15++];
          } else {
            _i15 = _iterator14.next();
            if (_i15.done) break;
            _ref13 = _i15.value;
          }
  
          var file = _ref13;
  
          this.addFile(file);
        }
      }
  
      // When a folder is dropped (or files are pasted), items must be handled
      // instead of files.
  
    }, {
      key: "_addFilesFromItems",
      value: function _addFilesFromItems(items) {
        var _this5 = this;
  
        return function () {
          var result = [];
          for (var _iterator15 = items, _isArray15 = true, _i16 = 0, _iterator15 = _isArray15 ? _iterator15 : _iterator15[Symbol.iterator]();;) {
            var _ref14;
  
            if (_isArray15) {
              if (_i16 >= _iterator15.length) break;
              _ref14 = _iterator15[_i16++];
            } else {
              _i16 = _iterator15.next();
              if (_i16.done) break;
              _ref14 = _i16.value;
            }
  
            var item = _ref14;
  
            var entry;
            if (item.webkitGetAsEntry != null && (entry = item.webkitGetAsEntry())) {
              if (entry.isFile) {
                result.push(_this5.addFile(item.getAsFile()));
              } else if (entry.isDirectory) {
                // Append all files from that directory to files
                result.push(_this5._addFilesFromDirectory(entry, entry.name));
              } else {
                result.push(undefined);
              }
            } else if (item.getAsFile != null) {
              if (item.kind == null || item.kind === "file") {
                result.push(_this5.addFile(item.getAsFile()));
              } else {
                result.push(undefined);
              }
            } else {
              result.push(undefined);
            }
          }
          return result;
        }();
      }
  
      // Goes through the directory, and adds each file it finds recursively
  
    }, {
      key: "_addFilesFromDirectory",
      value: function _addFilesFromDirectory(directory, path) {
        var _this6 = this;
  
        var dirReader = directory.createReader();
  
        var errorHandler = function errorHandler(error) {
          return __guardMethod__(console, 'log', function (o) {
            return o.log(error);
          });
        };
  
        var readEntries = function readEntries() {
          return dirReader.readEntries(function (entries) {
            if (entries.length > 0) {
              for (var _iterator16 = entries, _isArray16 = true, _i17 = 0, _iterator16 = _isArray16 ? _iterator16 : _iterator16[Symbol.iterator]();;) {
                var _ref15;
  
                if (_isArray16) {
                  if (_i17 >= _iterator16.length) break;
                  _ref15 = _iterator16[_i17++];
                } else {
                  _i17 = _iterator16.next();
                  if (_i17.done) break;
                  _ref15 = _i17.value;
                }
  
                var entry = _ref15;
  
                if (entry.isFile) {
                  entry.file(function (file) {
                    if (_this6.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') {
                      return;
                    }
                    file.fullPath = path + "/" + file.name;
                    return _this6.addFile(file);
                  });
                } else if (entry.isDirectory) {
                  _this6._addFilesFromDirectory(entry, path + "/" + entry.name);
                }
              }
  
              // Recursively call readEntries() again, since browser only handle
              // the first 100 entries.
              // See: https://developer.mozilla.org/en-US/docs/Web/API/DirectoryReader#readEntries
              readEntries();
            }
            return null;
          }, errorHandler);
        };
  
        return readEntries();
      }
  
      // If `done()` is called without argument the file is accepted
      // If you call it with an error message, the file is rejected
      // (This allows for asynchronous validation)
      //
      // This function checks the filesize, and if the file.type passes the
      // `acceptedFiles` check.
  
    }, {
      key: "accept",
      value: function accept(file, done) {
        if (this.options.maxFilesize && file.size > this.options.maxFilesize * 1024 * 1024) {
          return done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize));
        } else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) {
          return done(this.options.dictInvalidFileType);
        } else if (this.options.maxFiles != null && this.getAcceptedFiles().length >= this.options.maxFiles) {
          done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}", this.options.maxFiles));
          return this.emit("maxfilesexceeded", file);
        } else {
          return this.options.accept.call(this, file, done);
        }
      }
    }, {
      key: "addFile",
      value: function addFile(file) {
        var _this7 = this;
  
        file.upload = {
          uuid: Dropzone.uuidv4(),
          progress: 0,
          // Setting the total upload size to file.size for the beginning
          // It's actual different than the size to be transmitted.
          total: file.size,
          bytesSent: 0,
          filename: this._renameFile(file),
          chunked: this.options.chunking && (this.options.forceChunking || file.size > this.options.chunkSize),
          totalChunkCount: Math.ceil(file.size / this.options.chunkSize)
        };
        this.files.push(file);
  
        file.status = Dropzone.ADDED;
  
        this.emit("addedfile", file);
  
        this._enqueueThumbnail(file);
  
        return this.accept(file, function (error) {
          if (error) {
            file.accepted = false;
            _this7._errorProcessing([file], error); // Will set the file.status
          } else {
            file.accepted = true;
            if (_this7.options.autoQueue) {
              _this7.enqueueFile(file);
            } // Will set .accepted = true
          }
          return _this7._updateMaxFilesReachedClass();
        });
      }
  
      // Wrapper for enqueueFile
  
    }, {
      key: "enqueueFiles",
      value: function enqueueFiles(files) {
        for (var _iterator17 = files, _isArray17 = true, _i18 = 0, _iterator17 = _isArray17 ? _iterator17 : _iterator17[Symbol.iterator]();;) {
          var _ref16;
  
          if (_isArray17) {
            if (_i18 >= _iterator17.length) break;
            _ref16 = _iterator17[_i18++];
          } else {
            _i18 = _iterator17.next();
            if (_i18.done) break;
            _ref16 = _i18.value;
          }
  
          var file = _ref16;
  
          this.enqueueFile(file);
        }
        return null;
      }
    }, {
      key: "enqueueFile",
      value: function enqueueFile(file) {
        var _this8 = this;
  
        if (file.status === Dropzone.ADDED && file.accepted === true) {
          file.status = Dropzone.QUEUED;
          if (this.options.autoProcessQueue) {
            return setTimeout(function () {
              return _this8.processQueue();
            }, 0); // Deferring the call
          }
        } else {
          throw new Error("This file can't be queued because it has already been processed or was rejected.");
        }
      }
    }, {
      key: "_enqueueThumbnail",
      value: function _enqueueThumbnail(file) {
        var _this9 = this;
  
        if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) {
          this._thumbnailQueue.push(file);
          return setTimeout(function () {
            return _this9._processThumbnailQueue();
          }, 0); // Deferring the call
        }
      }
    }, {
      key: "_processThumbnailQueue",
      value: function _processThumbnailQueue() {
        var _this10 = this;
  
        if (this._processingThumbnail || this._thumbnailQueue.length === 0) {
          return;
        }
  
        this._processingThumbnail = true;
        var file = this._thumbnailQueue.shift();
        return this.createThumbnail(file, this.options.thumbnailWidth, this.options.thumbnailHeight, this.options.thumbnailMethod, true, function (dataUrl) {
          _this10.emit("thumbnail", file, dataUrl);
          _this10._processingThumbnail = false;
          return _this10._processThumbnailQueue();
        });
      }
  
      // Can be called by the user to remove a file
  
    }, {
      key: "removeFile",
      value: function removeFile(file) {
        if (file.status === Dropzone.UPLOADING) {
          this.cancelUpload(file);
        }
        this.files = without(this.files, file);
  
        this.emit("removedfile", file);
        if (this.files.length === 0) {
          return this.emit("reset");
        }
      }
  
      // Removes all files that aren't currently processed from the list
  
    }, {
      key: "removeAllFiles",
      value: function removeAllFiles(cancelIfNecessary) {
        // Create a copy of files since removeFile() changes the @files array.
        if (cancelIfNecessary == null) {
          cancelIfNecessary = false;
        }
        for (var _iterator18 = this.files.slice(), _isArray18 = true, _i19 = 0, _iterator18 = _isArray18 ? _iterator18 : _iterator18[Symbol.iterator]();;) {
          var _ref17;
  
          if (_isArray18) {
            if (_i19 >= _iterator18.length) break;
            _ref17 = _iterator18[_i19++];
          } else {
            _i19 = _iterator18.next();
            if (_i19.done) break;
            _ref17 = _i19.value;
          }
  
          var file = _ref17;
  
          if (file.status !== Dropzone.UPLOADING || cancelIfNecessary) {
            this.removeFile(file);
          }
        }
        return null;
      }
  
      // Resizes an image before it gets sent to the server. This function is the default behavior of
      // `options.transformFile` if `resizeWidth` or `resizeHeight` are set. The callback is invoked with
      // the resized blob.
  
    }, {
      key: "resizeImage",
      value: function resizeImage(file, width, height, resizeMethod, callback) {
        var _this11 = this;
  
        return this.createThumbnail(file, width, height, resizeMethod, true, function (dataUrl, canvas) {
          if (canvas == null) {
            // The image has not been resized
            return callback(file);
          } else {
            var resizeMimeType = _this11.options.resizeMimeType;
  
            if (resizeMimeType == null) {
              resizeMimeType = file.type;
            }
            var resizedDataURL = canvas.toDataURL(resizeMimeType, _this11.options.resizeQuality);
            if (resizeMimeType === 'image/jpeg' || resizeMimeType === 'image/jpg') {
              // Now add the original EXIF information
              resizedDataURL = ExifRestore.restore(file.dataURL, resizedDataURL);
            }
            return callback(Dropzone.dataURItoBlob(resizedDataURL));
          }
        });
      }
    }, {
      key: "createThumbnail",
      value: function createThumbnail(file, width, height, resizeMethod, fixOrientation, callback) {
        var _this12 = this;
  
        var fileReader = new FileReader();
  
        fileReader.onload = function () {
  
          file.dataURL = fileReader.result;
  
          // Don't bother creating a thumbnail for SVG images since they're vector
          if (file.type === "image/svg+xml") {
            if (callback != null) {
              callback(fileReader.result);
            }
            return;
          }
  
          return _this12.createThumbnailFromUrl(file, width, height, resizeMethod, fixOrientation, callback);
        };
  
        return fileReader.readAsDataURL(file);
      }
    }, {
      key: "createThumbnailFromUrl",
      value: function createThumbnailFromUrl(file, width, height, resizeMethod, fixOrientation, callback, crossOrigin) {
        var _this13 = this;
  
        // Not using `new Image` here because of a bug in latest Chrome versions.
        // See https://github.com/enyo/dropzone/pull/226
        var img = document.createElement("img");
  
        if (crossOrigin) {
          img.crossOrigin = crossOrigin;
        }
  
        img.onload = function () {
          var loadExif = function loadExif(callback) {
            return callback(1);
          };
          if (typeof EXIF !== 'undefined' && EXIF !== null && fixOrientation) {
            loadExif = function loadExif(callback) {
              return EXIF.getData(img, function () {
                return callback(EXIF.getTag(this, 'Orientation'));
              });
            };
          }
  
          return loadExif(function (orientation) {
            file.width = img.width;
            file.height = img.height;
  
            var resizeInfo = _this13.options.resize.call(_this13, file, width, height, resizeMethod);
  
            var canvas = document.createElement("canvas");
            var ctx = canvas.getContext("2d");
  
            canvas.width = resizeInfo.trgWidth;
            canvas.height = resizeInfo.trgHeight;
  
            if (orientation > 4) {
              canvas.width = resizeInfo.trgHeight;
              canvas.height = resizeInfo.trgWidth;
            }
  
            switch (orientation) {
              case 2:
                // horizontal flip
                ctx.translate(canvas.width, 0);
                ctx.scale(-1, 1);
                break;
              case 3:
                // 180° rotate left
                ctx.translate(canvas.width, canvas.height);
                ctx.rotate(Math.PI);
                break;
              case 4:
                // vertical flip
                ctx.translate(0, canvas.height);
                ctx.scale(1, -1);
                break;
              case 5:
                // vertical flip + 90 rotate right
                ctx.rotate(0.5 * Math.PI);
                ctx.scale(1, -1);
                break;
              case 6:
                // 90° rotate right
                ctx.rotate(0.5 * Math.PI);
                ctx.translate(0, -canvas.width);
                break;
              case 7:
                // horizontal flip + 90 rotate right
                ctx.rotate(0.5 * Math.PI);
                ctx.translate(canvas.height, -canvas.width);
                ctx.scale(-1, 1);
                break;
              case 8:
                // 90° rotate left
                ctx.rotate(-0.5 * Math.PI);
                ctx.translate(-canvas.height, 0);
                break;
            }
  
            // This is a bugfix for iOS' scaling bug.
            drawImageIOSFix(ctx, img, resizeInfo.srcX != null ? resizeInfo.srcX : 0, resizeInfo.srcY != null ? resizeInfo.srcY : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, resizeInfo.trgX != null ? resizeInfo.trgX : 0, resizeInfo.trgY != null ? resizeInfo.trgY : 0, resizeInfo.trgWidth, resizeInfo.trgHeight);
  
            var thumbnail = canvas.toDataURL("image/png");
  
            if (callback != null) {
              return callback(thumbnail, canvas);
            }
          });
        };
  
        if (callback != null) {
          img.onerror = callback;
        }
  
        return img.src = file.dataURL;
      }
  
      // Goes through the queue and processes files if there aren't too many already.
  
    }, {
      key: "processQueue",
      value: function processQueue() {
        var parallelUploads = this.options.parallelUploads;
  
        var processingLength = this.getUploadingFiles().length;
        var i = processingLength;
  
        // There are already at least as many files uploading than should be
        if (processingLength >= parallelUploads) {
          return;
        }
  
        var queuedFiles = this.getQueuedFiles();
  
        if (!(queuedFiles.length > 0)) {
          return;
        }
  
        if (this.options.uploadMultiple) {
          // The files should be uploaded in one request
          return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength));
        } else {
          while (i < parallelUploads) {
            if (!queuedFiles.length) {
              return;
            } // Nothing left to process
            this.processFile(queuedFiles.shift());
            i++;
          }
        }
      }
  
      // Wrapper for `processFiles`
  
    }, {
      key: "processFile",
      value: function processFile(file) {
        return this.processFiles([file]);
      }
  
      // Loads the file, then calls finishedLoading()
  
    }, {
      key: "processFiles",
      value: function processFiles(files) {
        for (var _iterator19 = files, _isArray19 = true, _i20 = 0, _iterator19 = _isArray19 ? _iterator19 : _iterator19[Symbol.iterator]();;) {
          var _ref18;
  
          if (_isArray19) {
            if (_i20 >= _iterator19.length) break;
            _ref18 = _iterator19[_i20++];
          } else {
            _i20 = _iterator19.next();
            if (_i20.done) break;
            _ref18 = _i20.value;
          }
  
          var file = _ref18;
  
          file.processing = true; // Backwards compatibility
          file.status = Dropzone.UPLOADING;
  
          this.emit("processing", file);
        }
  
        if (this.options.uploadMultiple) {
          this.emit("processingmultiple", files);
        }
  
        return this.uploadFiles(files);
      }
    }, {
      key: "_getFilesWithXhr",
      value: function _getFilesWithXhr(xhr) {
        var files = void 0;
        return files = this.files.filter(function (file) {
          return file.xhr === xhr;
        }).map(function (file) {
          return file;
        });
      }
  
      // Cancels the file upload and sets the status to CANCELED
      // **if** the file is actually being uploaded.
      // If it's still in the queue, the file is being removed from it and the status
      // set to CANCELED.
  
    }, {
      key: "cancelUpload",
      value: function cancelUpload(file) {
        if (file.status === Dropzone.UPLOADING) {
          var groupedFiles = this._getFilesWithXhr(file.xhr);
          for (var _iterator20 = groupedFiles, _isArray20 = true, _i21 = 0, _iterator20 = _isArray20 ? _iterator20 : _iterator20[Symbol.iterator]();;) {
            var _ref19;
  
            if (_isArray20) {
              if (_i21 >= _iterator20.length) break;
              _ref19 = _iterator20[_i21++];
            } else {
              _i21 = _iterator20.next();
              if (_i21.done) break;
              _ref19 = _i21.value;
            }
  
            var groupedFile = _ref19;
  
            groupedFile.status = Dropzone.CANCELED;
          }
          if (typeof file.xhr !== 'undefined') {
            file.xhr.abort();
          }
          for (var _iterator21 = groupedFiles, _isArray21 = true, _i22 = 0, _iterator21 = _isArray21 ? _iterator21 : _iterator21[Symbol.iterator]();;) {
            var _ref20;
  
            if (_isArray21) {
              if (_i22 >= _iterator21.length) break;
              _ref20 = _iterator21[_i22++];
            } else {
              _i22 = _iterator21.next();
              if (_i22.done) break;
              _ref20 = _i22.value;
            }
  
            var _groupedFile = _ref20;
  
            this.emit("canceled", _groupedFile);
          }
          if (this.options.uploadMultiple) {
            this.emit("canceledmultiple", groupedFiles);
          }
        } else if (file.status === Dropzone.ADDED || file.status === Dropzone.QUEUED) {
          file.status = Dropzone.CANCELED;
          this.emit("canceled", file);
          if (this.options.uploadMultiple) {
            this.emit("canceledmultiple", [file]);
          }
        }
  
        if (this.options.autoProcessQueue) {
          return this.processQueue();
        }
      }
    }, {
      key: "resolveOption",
      value: function resolveOption(option) {
        if (typeof option === 'function') {
          for (var _len3 = arguments.length, args = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
            args[_key3 - 1] = arguments[_key3];
          }
  
          return option.apply(this, args);
        }
        return option;
      }
    }, {
      key: "uploadFile",
      value: function uploadFile(file) {
        return this.uploadFiles([file]);
      }
    }, {
      key: "uploadFiles",
      value: function uploadFiles(files) {
        var _this14 = this;
  
        this._transformFiles(files, function (transformedFiles) {
          if (files[0].upload.chunked) {
            // This file should be sent in chunks!
  
            // If the chunking option is set, we **know** that there can only be **one** file, since
            // uploadMultiple is not allowed with this option.
            var file = files[0];
            var transformedFile = transformedFiles[0];
            var startedChunkCount = 0;
  
            file.upload.chunks = [];
  
            var handleNextChunk = function handleNextChunk() {
              var chunkIndex = 0;
  
              // Find the next item in file.upload.chunks that is not defined yet.
              while (file.upload.chunks[chunkIndex] !== undefined) {
                chunkIndex++;
              }
  
              // This means, that all chunks have already been started.
              if (chunkIndex >= file.upload.totalChunkCount) return;
  
              startedChunkCount++;
  
              var start = chunkIndex * _this14.options.chunkSize;
              var end = Math.min(start + _this14.options.chunkSize, file.size);
  
              var dataBlock = {
                name: _this14._getParamName(0),
                data: transformedFile.webkitSlice ? transformedFile.webkitSlice(start, end) : transformedFile.slice(start, end),
                filename: file.upload.filename,
                chunkIndex: chunkIndex
              };
  
              file.upload.chunks[chunkIndex] = {
                file: file,
                index: chunkIndex,
                dataBlock: dataBlock, // In case we want to retry.
                status: Dropzone.UPLOADING,
                progress: 0,
                retries: 0 // The number of times this block has been retried.
              };
  
              _this14._uploadData(files, [dataBlock]);
            };
  
            file.upload.finishedChunkUpload = function (chunk) {
              var allFinished = true;
              chunk.status = Dropzone.SUCCESS;
  
              // Clear the data from the chunk
              chunk.dataBlock = null;
              // Leaving this reference to xhr intact here will cause memory leaks in some browsers
              chunk.xhr = null;
  
              for (var i = 0; i < file.upload.totalChunkCount; i++) {
                if (file.upload.chunks[i] === undefined) {
                  return handleNextChunk();
                }
                if (file.upload.chunks[i].status !== Dropzone.SUCCESS) {
                  allFinished = false;
                }
              }
  
              if (allFinished) {
                _this14.options.chunksUploaded(file, function () {
                  _this14._finished(files, '', null);
                });
              }
            };
  
            if (_this14.options.parallelChunkUploads) {
              for (var i = 0; i < file.upload.totalChunkCount; i++) {
                handleNextChunk();
              }
            } else {
              handleNextChunk();
            }
          } else {
            var dataBlocks = [];
            for (var _i23 = 0; _i23 < files.length; _i23++) {
              dataBlocks[_i23] = {
                name: _this14._getParamName(_i23),
                data: transformedFiles[_i23],
                filename: files[_i23].upload.filename
              };
            }
            _this14._uploadData(files, dataBlocks);
          }
        });
      }
  
      /// Returns the right chunk for given file and xhr
  
    }, {
      key: "_getChunk",
      value: function _getChunk(file, xhr) {
        for (var i = 0; i < file.upload.totalChunkCount; i++) {
          if (file.upload.chunks[i] !== undefined && file.upload.chunks[i].xhr === xhr) {
            return file.upload.chunks[i];
          }
        }
      }
  
      // This function actually uploads the file(s) to the server.
      // If dataBlocks contains the actual data to upload (meaning, that this could either be transformed
      // files, or individual chunks for chunked upload).
  
    }, {
      key: "_uploadData",
      value: function _uploadData(files, dataBlocks) {
        var _this15 = this;
  
        var xhr = new XMLHttpRequest();
  
        // Put the xhr object in the file objects to be able to reference it later.
        for (var _iterator22 = files, _isArray22 = true, _i24 = 0, _iterator22 = _isArray22 ? _iterator22 : _iterator22[Symbol.iterator]();;) {
          var _ref21;
  
          if (_isArray22) {
            if (_i24 >= _iterator22.length) break;
            _ref21 = _iterator22[_i24++];
          } else {
            _i24 = _iterator22.next();
            if (_i24.done) break;
            _ref21 = _i24.value;
          }
  
          var file = _ref21;
  
          file.xhr = xhr;
        }
        if (files[0].upload.chunked) {
          // Put the xhr object in the right chunk object, so it can be associated later, and found with _getChunk
          files[0].upload.chunks[dataBlocks[0].chunkIndex].xhr = xhr;
        }
  
        var method = this.resolveOption(this.options.method, files);
        var url = this.resolveOption(this.options.url, files);
        xhr.open(method, url, true);
  
        // Setting the timeout after open because of IE11 issue: https://gitlab.com/meno/dropzone/issues/8
        xhr.timeout = this.resolveOption(this.options.timeout, files);
  
        // Has to be after `.open()`. See https://github.com/enyo/dropzone/issues/179
        xhr.withCredentials = !!this.options.withCredentials;
  
        xhr.onload = function (e) {
          _this15._finishedUploading(files, xhr, e);
        };
  
        xhr.onerror = function () {
          _this15._handleUploadError(files, xhr);
        };
  
        // Some browsers do not have the .upload property
        var progressObj = xhr.upload != null ? xhr.upload : xhr;
        progressObj.onprogress = function (e) {
          return _this15._updateFilesUploadProgress(files, xhr, e);
        };
  
        var headers = {
          "Accept": "application/json",
          "Cache-Control": "no-cache",
          "X-Requested-With": "XMLHttpRequest"
        };
  
        if (this.options.headers) {
          Dropzone.extend(headers, this.options.headers);
        }
  
        for (var headerName in headers) {
          var headerValue = headers[headerName];
          if (headerValue) {
            xhr.setRequestHeader(headerName, headerValue);
          }
        }
  
        var formData = new FormData();
  
        // Adding all @options parameters
        if (this.options.params) {
          var additionalParams = this.options.params;
          if (typeof additionalParams === 'function') {
            additionalParams = additionalParams.call(this, files, xhr, files[0].upload.chunked ? this._getChunk(files[0], xhr) : null);
          }
  
          for (var key in additionalParams) {
            var value = additionalParams[key];
            formData.append(key, value);
          }
        }
  
        // Let the user add additional data if necessary
        for (var _iterator23 = files, _isArray23 = true, _i25 = 0, _iterator23 = _isArray23 ? _iterator23 : _iterator23[Symbol.iterator]();;) {
          var _ref22;
  
          if (_isArray23) {
            if (_i25 >= _iterator23.length) break;
            _ref22 = _iterator23[_i25++];
          } else {
            _i25 = _iterator23.next();
            if (_i25.done) break;
            _ref22 = _i25.value;
          }
  
          var _file = _ref22;
  
          this.emit("sending", _file, xhr, formData);
        }
        if (this.options.uploadMultiple) {
          this.emit("sendingmultiple", files, xhr, formData);
        }
  
        this._addFormElementData(formData);
  
        // Finally add the files
        // Has to be last because some servers (eg: S3) expect the file to be the last parameter
        for (var i = 0; i < dataBlocks.length; i++) {
          var dataBlock = dataBlocks[i];
          formData.append(dataBlock.name, dataBlock.data, dataBlock.filename);
        }
  
        this.submitRequest(xhr, formData, files);
      }
  
      // Transforms all files with this.options.transformFile and invokes done with the transformed files when done.
  
    }, {
      key: "_transformFiles",
      value: function _transformFiles(files, done) {
        var _this16 = this;
  
        var transformedFiles = [];
        // Clumsy way of handling asynchronous calls, until I get to add a proper Future library.
        var doneCounter = 0;
  
        var _loop = function _loop(i) {
          _this16.options.transformFile.call(_this16, files[i], function (transformedFile) {
            transformedFiles[i] = transformedFile;
            if (++doneCounter === files.length) {
              done(transformedFiles);
            }
          });
        };
  
        for (var i = 0; i < files.length; i++) {
          _loop(i);
        }
      }
  
      // Takes care of adding other input elements of the form to the AJAX request
  
    }, {
      key: "_addFormElementData",
      value: function _addFormElementData(formData) {
        // Take care of other input elements
        if (this.element.tagName === "FORM") {
          for (var _iterator24 = this.element.querySelectorAll("input, textarea, select, button"), _isArray24 = true, _i26 = 0, _iterator24 = _isArray24 ? _iterator24 : _iterator24[Symbol.iterator]();;) {
            var _ref23;
  
            if (_isArray24) {
              if (_i26 >= _iterator24.length) break;
              _ref23 = _iterator24[_i26++];
            } else {
              _i26 = _iterator24.next();
              if (_i26.done) break;
              _ref23 = _i26.value;
            }
  
            var input = _ref23;
  
            var inputName = input.getAttribute("name");
            var inputType = input.getAttribute("type");
            if (inputType) inputType = inputType.toLowerCase();
  
            // If the input doesn't have a name, we can't use it.
            if (typeof inputName === 'undefined' || inputName === null) continue;
  
            if (input.tagName === "SELECT" && input.hasAttribute("multiple")) {
              // Possibly multiple values
              for (var _iterator25 = input.options, _isArray25 = true, _i27 = 0, _iterator25 = _isArray25 ? _iterator25 : _iterator25[Symbol.iterator]();;) {
                var _ref24;
  
                if (_isArray25) {
                  if (_i27 >= _iterator25.length) break;
                  _ref24 = _iterator25[_i27++];
                } else {
                  _i27 = _iterator25.next();
                  if (_i27.done) break;
                  _ref24 = _i27.value;
                }
  
                var option = _ref24;
  
                if (option.selected) {
                  formData.append(inputName, option.value);
                }
              }
            } else if (!inputType || inputType !== "checkbox" && inputType !== "radio" || input.checked) {
              formData.append(inputName, input.value);
            }
          }
        }
      }
  
      // Invoked when there is new progress information about given files.
      // If e is not provided, it is assumed that the upload is finished.
  
    }, {
      key: "_updateFilesUploadProgress",
      value: function _updateFilesUploadProgress(files, xhr, e) {
        var progress = void 0;
        if (typeof e !== 'undefined') {
          progress = 100 * e.loaded / e.total;
  
          if (files[0].upload.chunked) {
            var file = files[0];
            // Since this is a chunked upload, we need to update the appropriate chunk progress.
            var chunk = this._getChunk(file, xhr);
            chunk.progress = progress;
            chunk.total = e.total;
            chunk.bytesSent = e.loaded;
            var fileProgress = 0,
                fileTotal = void 0,
                fileBytesSent = void 0;
            file.upload.progress = 0;
            file.upload.total = 0;
            file.upload.bytesSent = 0;
            for (var i = 0; i < file.upload.totalChunkCount; i++) {
              if (file.upload.chunks[i] !== undefined && file.upload.chunks[i].progress !== undefined) {
                file.upload.progress += file.upload.chunks[i].progress;
                file.upload.total += file.upload.chunks[i].total;
                file.upload.bytesSent += file.upload.chunks[i].bytesSent;
              }
            }
            file.upload.progress = file.upload.progress / file.upload.totalChunkCount;
          } else {
            for (var _iterator26 = files, _isArray26 = true, _i28 = 0, _iterator26 = _isArray26 ? _iterator26 : _iterator26[Symbol.iterator]();;) {
              var _ref25;
  
              if (_isArray26) {
                if (_i28 >= _iterator26.length) break;
                _ref25 = _iterator26[_i28++];
              } else {
                _i28 = _iterator26.next();
                if (_i28.done) break;
                _ref25 = _i28.value;
              }
  
              var _file2 = _ref25;
  
              _file2.upload.progress = progress;
              _file2.upload.total = e.total;
              _file2.upload.bytesSent = e.loaded;
            }
          }
          for (var _iterator27 = files, _isArray27 = true, _i29 = 0, _iterator27 = _isArray27 ? _iterator27 : _iterator27[Symbol.iterator]();;) {
            var _ref26;
  
            if (_isArray27) {
              if (_i29 >= _iterator27.length) break;
              _ref26 = _iterator27[_i29++];
            } else {
              _i29 = _iterator27.next();
              if (_i29.done) break;
              _ref26 = _i29.value;
            }
  
            var _file3 = _ref26;
  
            this.emit("uploadprogress", _file3, _file3.upload.progress, _file3.upload.bytesSent);
          }
        } else {
          // Called when the file finished uploading
  
          var allFilesFinished = true;
  
          progress = 100;
  
          for (var _iterator28 = files, _isArray28 = true, _i30 = 0, _iterator28 = _isArray28 ? _iterator28 : _iterator28[Symbol.iterator]();;) {
            var _ref27;
  
            if (_isArray28) {
              if (_i30 >= _iterator28.length) break;
              _ref27 = _iterator28[_i30++];
            } else {
              _i30 = _iterator28.next();
              if (_i30.done) break;
              _ref27 = _i30.value;
            }
  
            var _file4 = _ref27;
  
            if (_file4.upload.progress !== 100 || _file4.upload.bytesSent !== _file4.upload.total) {
              allFilesFinished = false;
            }
            _file4.upload.progress = progress;
            _file4.upload.bytesSent = _file4.upload.total;
          }
  
          // Nothing to do, all files already at 100%
          if (allFilesFinished) {
            return;
          }
  
          for (var _iterator29 = files, _isArray29 = true, _i31 = 0, _iterator29 = _isArray29 ? _iterator29 : _iterator29[Symbol.iterator]();;) {
            var _ref28;
  
            if (_isArray29) {
              if (_i31 >= _iterator29.length) break;
              _ref28 = _iterator29[_i31++];
            } else {
              _i31 = _iterator29.next();
              if (_i31.done) break;
              _ref28 = _i31.value;
            }
  
            var _file5 = _ref28;
  
            this.emit("uploadprogress", _file5, progress, _file5.upload.bytesSent);
          }
        }
      }
    }, {
      key: "_finishedUploading",
      value: function _finishedUploading(files, xhr, e) {
        var response = void 0;
  
        if (files[0].status === Dropzone.CANCELED) {
          return;
        }
  
        if (xhr.readyState !== 4) {
          return;
        }
  
        if (xhr.responseType !== 'arraybuffer' && xhr.responseType !== 'blob') {
          response = xhr.responseText;
  
          if (xhr.getResponseHeader("content-type") && ~xhr.getResponseHeader("content-type").indexOf("application/json")) {
            try {
              response = JSON.parse(response);
            } catch (error) {
              e = error;
              response = "Invalid JSON response from server.";
            }
          }
        }
  
        this._updateFilesUploadProgress(files);
  
        if (!(200 <= xhr.status && xhr.status < 300)) {
          this._handleUploadError(files, xhr, response);
        } else {
          if (files[0].upload.chunked) {
            files[0].upload.finishedChunkUpload(this._getChunk(files[0], xhr));
          } else {
            this._finished(files, response, e);
          }
        }
      }
    }, {
      key: "_handleUploadError",
      value: function _handleUploadError(files, xhr, response) {
        if (files[0].status === Dropzone.CANCELED) {
          return;
        }
  
        if (files[0].upload.chunked && this.options.retryChunks) {
          var chunk = this._getChunk(files[0], xhr);
          if (chunk.retries++ < this.options.retryChunksLimit) {
            this._uploadData(files, [chunk.dataBlock]);
            return;
          } else {
            console.warn('Retried this chunk too often. Giving up.');
          }
        }
  
        for (var _iterator30 = files, _isArray30 = true, _i32 = 0, _iterator30 = _isArray30 ? _iterator30 : _iterator30[Symbol.iterator]();;) {
          var _ref29;
  
          if (_isArray30) {
            if (_i32 >= _iterator30.length) break;
            _ref29 = _iterator30[_i32++];
          } else {
            _i32 = _iterator30.next();
            if (_i32.done) break;
            _ref29 = _i32.value;
          }
  
          var file = _ref29;
  
          this._errorProcessing(files, response || this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr);
        }
      }
    }, {
      key: "submitRequest",
      value: function submitRequest(xhr, formData, files) {
        xhr.send(formData);
      }
  
      // Called internally when processing is finished.
      // Individual callbacks have to be called in the appropriate sections.
  
    }, {
      key: "_finished",
      value: function _finished(files, responseText, e) {
        for (var _iterator31 = files, _isArray31 = true, _i33 = 0, _iterator31 = _isArray31 ? _iterator31 : _iterator31[Symbol.iterator]();;) {
          var _ref30;
  
          if (_isArray31) {
            if (_i33 >= _iterator31.length) break;
            _ref30 = _iterator31[_i33++];
          } else {
            _i33 = _iterator31.next();
            if (_i33.done) break;
            _ref30 = _i33.value;
          }
  
          var file = _ref30;
  
          file.status = Dropzone.SUCCESS;
          this.emit("success", file, responseText, e);
          this.emit("complete", file);
        }
        if (this.options.uploadMultiple) {
          this.emit("successmultiple", files, responseText, e);
          this.emit("completemultiple", files);
        }
  
        if (this.options.autoProcessQueue) {
          return this.processQueue();
        }
      }
  
      // Called internally when processing is finished.
      // Individual callbacks have to be called in the appropriate sections.
  
    }, {
      key: "_errorProcessing",
      value: function _errorProcessing(files, message, xhr) {
        for (var _iterator32 = files, _isArray32 = true, _i34 = 0, _iterator32 = _isArray32 ? _iterator32 : _iterator32[Symbol.iterator]();;) {
          var _ref31;
  
          if (_isArray32) {
            if (_i34 >= _iterator32.length) break;
            _ref31 = _iterator32[_i34++];
          } else {
            _i34 = _iterator32.next();
            if (_i34.done) break;
            _ref31 = _i34.value;
          }
  
          var file = _ref31;
  
          file.status = Dropzone.ERROR;
          this.emit("error", file, message, xhr);
          this.emit("complete", file);
        }
        if (this.options.uploadMultiple) {
          this.emit("errormultiple", files, message, xhr);
          this.emit("completemultiple", files);
        }
  
        if (this.options.autoProcessQueue) {
          return this.processQueue();
        }
      }
    }], [{
      key: "uuidv4",
      value: function uuidv4() {
        return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
          var r = Math.random() * 16 | 0,
              v = c === 'x' ? r : r & 0x3 | 0x8;
          return v.toString(16);
        });
      }
    }]);
  
    return Dropzone;
  }(Emitter);
  
  Dropzone.initClass();
  
  Dropzone.version = "5.5.0";
  
  // This is a map of options for your different dropzones. Add configurations
  // to this object for your different dropzone elemens.
  //
  // Example:
  //
  //     Dropzone.options.myDropzoneElementId = { maxFilesize: 1 };
  //
  // To disable autoDiscover for a specific element, you can set `false` as an option:
  //
  //     Dropzone.options.myDisabledElementId = false;
  //
  // And in html:
  //
  //     <form action="/upload" id="my-dropzone-element-id" class="dropzone"></form>
  Dropzone.options = {};
  
  // Returns the options for an element or undefined if none available.
  Dropzone.optionsForElement = function (element) {
    // Get the `Dropzone.options.elementId` for this element if it exists
    if (element.getAttribute("id")) {
      return Dropzone.options[camelize(element.getAttribute("id"))];
    } else {
      return undefined;
    }
  };
  
  // Holds a list of all dropzone instances
  Dropzone.instances = [];
  
  // Returns the dropzone for given element if any
  Dropzone.forElement = function (element) {
    if (typeof element === "string") {
      element = document.querySelector(element);
    }
    if ((element != null ? element.dropzone : undefined) == null) {
      throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");
    }
    return element.dropzone;
  };
  
  // Set to false if you don't want Dropzone to automatically find and attach to .dropzone elements.
  Dropzone.autoDiscover = true;
  
  // Looks for all .dropzone elements and creates a dropzone for them
  Dropzone.discover = function () {
    var dropzones = void 0;
    if (document.querySelectorAll) {
      dropzones = document.querySelectorAll(".dropzone");
    } else {
      dropzones = [];
      // IE :(
      var checkElements = function checkElements(elements) {
        return function () {
          var result = [];
          for (var _iterator33 = elements, _isArray33 = true, _i35 = 0, _iterator33 = _isArray33 ? _iterator33 : _iterator33[Symbol.iterator]();;) {
            var _ref32;
  
            if (_isArray33) {
              if (_i35 >= _iterator33.length) break;
              _ref32 = _iterator33[_i35++];
            } else {
              _i35 = _iterator33.next();
              if (_i35.done) break;
              _ref32 = _i35.value;
            }
  
            var el = _ref32;
  
            if (/(^| )dropzone($| )/.test(el.className)) {
              result.push(dropzones.push(el));
            } else {
              result.push(undefined);
            }
          }
          return result;
        }();
      };
      checkElements(document.getElementsByTagName("div"));
      checkElements(document.getElementsByTagName("form"));
    }
  
    return function () {
      var result = [];
      for (var _iterator34 = dropzones, _isArray34 = true, _i36 = 0, _iterator34 = _isArray34 ? _iterator34 : _iterator34[Symbol.iterator]();;) {
        var _ref33;
  
        if (_isArray34) {
          if (_i36 >= _iterator34.length) break;
          _ref33 = _iterator34[_i36++];
        } else {
          _i36 = _iterator34.next();
          if (_i36.done) break;
          _ref33 = _i36.value;
        }
  
        var dropzone = _ref33;
  
        // Create a dropzone unless auto discover has been disabled for specific element
        if (Dropzone.optionsForElement(dropzone) !== false) {
          result.push(new Dropzone(dropzone));
        } else {
          result.push(undefined);
        }
      }
      return result;
    }();
  };
  
  // Since the whole Drag'n'Drop API is pretty new, some browsers implement it,
  // but not correctly.
  // So I created a blacklist of userAgents. Yes, yes. Browser sniffing, I know.
  // But what to do when browsers *theoretically* support an API, but crash
  // when using it.
  //
  // This is a list of regular expressions tested against navigator.userAgent
  //
  // ** It should only be used on browser that *do* support the API, but
  // incorrectly **
  //
  Dropzone.blacklistedBrowsers = [
  // The mac os and windows phone version of opera 12 seems to have a problem with the File drag'n'drop API.
  /opera.*(Macintosh|Windows Phone).*version\/12/i];
  
  // Checks if the browser is supported
  Dropzone.isBrowserSupported = function () {
    var capableBrowser = true;
  
    if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) {
      if (!("classList" in document.createElement("a"))) {
        capableBrowser = false;
      } else {
        // The browser supports the API, but may be blacklisted.
        for (var _iterator35 = Dropzone.blacklistedBrowsers, _isArray35 = true, _i37 = 0, _iterator35 = _isArray35 ? _iterator35 : _iterator35[Symbol.iterator]();;) {
          var _ref34;
  
          if (_isArray35) {
            if (_i37 >= _iterator35.length) break;
            _ref34 = _iterator35[_i37++];
          } else {
            _i37 = _iterator35.next();
            if (_i37.done) break;
            _ref34 = _i37.value;
          }
  
          var regex = _ref34;
  
          if (regex.test(navigator.userAgent)) {
            capableBrowser = false;
            continue;
          }
        }
      }
    } else {
      capableBrowser = false;
    }
  
    return capableBrowser;
  };
  
  Dropzone.dataURItoBlob = function (dataURI) {
    // convert base64 to raw binary data held in a string
    // doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
    var byteString = atob(dataURI.split(',')[1]);
  
    // separate out the mime component
    var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
  
    // write the bytes of the string to an ArrayBuffer
    var ab = new ArrayBuffer(byteString.length);
    var ia = new Uint8Array(ab);
    for (var i = 0, end = byteString.length, asc = 0 <= end; asc ? i <= end : i >= end; asc ? i++ : i--) {
      ia[i] = byteString.charCodeAt(i);
    }
  
    // write the ArrayBuffer to a blob
    return new Blob([ab], { type: mimeString });
  };
  
  // Returns an array without the rejected item
  var without = function without(list, rejectedItem) {
    return list.filter(function (item) {
      return item !== rejectedItem;
    }).map(function (item) {
      return item;
    });
  };
  
  // abc-def_ghi -> abcDefGhi
  var camelize = function camelize(str) {
    return str.replace(/[\-_](\w)/g, function (match) {
      return match.charAt(1).toUpperCase();
    });
  };
  
  // Creates an element from string
  Dropzone.createElement = function (string) {
    var div = document.createElement("div");
    div.innerHTML = string;
    return div.childNodes[0];
  };
  
  // Tests if given element is inside (or simply is) the container
  Dropzone.elementInside = function (element, container) {
    if (element === container) {
      return true;
    } // Coffeescript doesn't support do/while loops
    while (element = element.parentNode) {
      if (element === container) {
        return true;
      }
    }
    return false;
  };
  
  Dropzone.getElement = function (el, name) {
    var element = void 0;
    if (typeof el === "string") {
      element = document.querySelector(el);
    } else if (el.nodeType != null) {
      element = el;
    }
    if (element == null) {
      throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector or a plain HTML element.");
    }
    return element;
  };
  
  Dropzone.getElements = function (els, name) {
    var el = void 0,
        elements = void 0;
    if (els instanceof Array) {
      elements = [];
      try {
        for (var _iterator36 = els, _isArray36 = true, _i38 = 0, _iterator36 = _isArray36 ? _iterator36 : _iterator36[Symbol.iterator]();;) {
          if (_isArray36) {
            if (_i38 >= _iterator36.length) break;
            el = _iterator36[_i38++];
          } else {
            _i38 = _iterator36.next();
            if (_i38.done) break;
            el = _i38.value;
          }
  
          elements.push(this.getElement(el, name));
        }
      } catch (e) {
        elements = null;
      }
    } else if (typeof els === "string") {
      elements = [];
      for (var _iterator37 = document.querySelectorAll(els), _isArray37 = true, _i39 = 0, _iterator37 = _isArray37 ? _iterator37 : _iterator37[Symbol.iterator]();;) {
        if (_isArray37) {
          if (_i39 >= _iterator37.length) break;
          el = _iterator37[_i39++];
        } else {
          _i39 = _iterator37.next();
          if (_i39.done) break;
          el = _i39.value;
        }
  
        elements.push(el);
      }
    } else if (els.nodeType != null) {
      elements = [els];
    }
  
    if (elements == null || !elements.length) {
      throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");
    }
  
    return elements;
  };
  
  // Asks the user the question and calls accepted or rejected accordingly
  //
  // The default implementation just uses `window.confirm` and then calls the
  // appropriate callback.
  Dropzone.confirm = function (question, accepted, rejected) {
    if (window.confirm(question)) {
      return accepted();
    } else if (rejected != null) {
      return rejected();
    }
  };
  
  // Validates the mime type like this:
  //
  // https://developer.mozilla.org/en-US/docs/HTML/Element/input#attr-accept
  Dropzone.isValidFile = function (file, acceptedFiles) {
    if (!acceptedFiles) {
      return true;
    } // If there are no accepted mime types, it's OK
    acceptedFiles = acceptedFiles.split(",");
  
    var mimeType = file.type;
    var baseMimeType = mimeType.replace(/\/.*$/, "");
  
    for (var _iterator38 = acceptedFiles, _isArray38 = true, _i40 = 0, _iterator38 = _isArray38 ? _iterator38 : _iterator38[Symbol.iterator]();;) {
      var _ref35;
  
      if (_isArray38) {
        if (_i40 >= _iterator38.length) break;
        _ref35 = _iterator38[_i40++];
      } else {
        _i40 = _iterator38.next();
        if (_i40.done) break;
        _ref35 = _i40.value;
      }
  
      var validType = _ref35;
  
      validType = validType.trim();
      if (validType.charAt(0) === ".") {
        if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {
          return true;
        }
      } else if (/\/\*$/.test(validType)) {
        // This is something like a image/* mime type
        if (baseMimeType === validType.replace(/\/.*$/, "")) {
          return true;
        }
      } else {
        if (mimeType === validType) {
          return true;
        }
      }
    }
  
    return false;
  };
  
  // Augment jQuery
  if (typeof jQuery !== 'undefined' && jQuery !== null) {
    jQuery.fn.dropzone = function (options) {
      return this.each(function () {
        return new Dropzone(this, options);
      });
    };
  }
  
  if (typeof module !== 'undefined' && module !== null) {
    module.exports = Dropzone;
  } else {
    window.Dropzone = Dropzone;
  }
  
  // Dropzone file status codes
  Dropzone.ADDED = "added";
  
  Dropzone.QUEUED = "queued";
  // For backwards compatibility. Now, if a file is accepted, it's either queued
  // or uploading.
  Dropzone.ACCEPTED = Dropzone.QUEUED;
  
  Dropzone.UPLOADING = "uploading";
  Dropzone.PROCESSING = Dropzone.UPLOADING; // alias
  
  Dropzone.CANCELED = "canceled";
  Dropzone.ERROR = "error";
  Dropzone.SUCCESS = "success";
  
  /*
  
   Bugfix for iOS 6 and 7
   Source: http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios
   based on the work of https://github.com/stomita/ios-imagefile-megapixel
  
   */
  
  // Detecting vertical squash in loaded image.
  // Fixes a bug which squash image vertically while drawing into canvas for some images.
  // This is a bug in iOS6 devices. This function from https://github.com/stomita/ios-imagefile-megapixel
  var detectVerticalSquash = function detectVerticalSquash(img) {
    var iw = img.naturalWidth;
    var ih = img.naturalHeight;
    var canvas = document.createElement("canvas");
    canvas.width = 1;
    canvas.height = ih;
    var ctx = canvas.getContext("2d");
    ctx.drawImage(img, 0, 0);
  
    var _ctx$getImageData = ctx.getImageData(1, 0, 1, ih),
        data = _ctx$getImageData.data;
  
    // search image edge pixel position in case it is squashed vertically.
  
  
    var sy = 0;
    var ey = ih;
    var py = ih;
    while (py > sy) {
      var alpha = data[(py - 1) * 4 + 3];
  
      if (alpha === 0) {
        ey = py;
      } else {
        sy = py;
      }
  
      py = ey + sy >> 1;
    }
    var ratio = py / ih;
  
    if (ratio === 0) {
      return 1;
    } else {
      return ratio;
    }
  };
  
  // A replacement for context.drawImage
  // (args are for source and destination).
  var drawImageIOSFix = function drawImageIOSFix(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) {
    var vertSquashRatio = detectVerticalSquash(img);
    return ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio);
  };
  
  // Based on MinifyJpeg
  // Source: http://www.perry.cz/files/ExifRestorer.js
  // http://elicon.blog57.fc2.com/blog-entry-206.html
  
  var ExifRestore = function () {
    function ExifRestore() {
      _classCallCheck(this, ExifRestore);
    }
  
    _createClass(ExifRestore, null, [{
      key: "initClass",
      value: function initClass() {
        this.KEY_STR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
      }
    }, {
      key: "encode64",
      value: function encode64(input) {
        var output = '';
        var chr1 = undefined;
        var chr2 = undefined;
        var chr3 = '';
        var enc1 = undefined;
        var enc2 = undefined;
        var enc3 = undefined;
        var enc4 = '';
        var i = 0;
        while (true) {
          chr1 = input[i++];
          chr2 = input[i++];
          chr3 = input[i++];
          enc1 = chr1 >> 2;
          enc2 = (chr1 & 3) << 4 | chr2 >> 4;
          enc3 = (chr2 & 15) << 2 | chr3 >> 6;
          enc4 = chr3 & 63;
          if (isNaN(chr2)) {
            enc3 = enc4 = 64;
          } else if (isNaN(chr3)) {
            enc4 = 64;
          }
          output = output + this.KEY_STR.charAt(enc1) + this.KEY_STR.charAt(enc2) + this.KEY_STR.charAt(enc3) + this.KEY_STR.charAt(enc4);
          chr1 = chr2 = chr3 = '';
          enc1 = enc2 = enc3 = enc4 = '';
          if (!(i < input.length)) {
            break;
          }
        }
        return output;
      }
    }, {
      key: "restore",
      value: function restore(origFileBase64, resizedFileBase64) {
        if (!origFileBase64.match('data:image/jpeg;base64,')) {
          return resizedFileBase64;
        }
        var rawImage = this.decode64(origFileBase64.replace('data:image/jpeg;base64,', ''));
        var segments = this.slice2Segments(rawImage);
        var image = this.exifManipulation(resizedFileBase64, segments);
        return "data:image/jpeg;base64," + this.encode64(image);
      }
    }, {
      key: "exifManipulation",
      value: function exifManipulation(resizedFileBase64, segments) {
        var exifArray = this.getExifArray(segments);
        var newImageArray = this.insertExif(resizedFileBase64, exifArray);
        var aBuffer = new Uint8Array(newImageArray);
        return aBuffer;
      }
    }, {
      key: "getExifArray",
      value: function getExifArray(segments) {
        var seg = undefined;
        var x = 0;
        while (x < segments.length) {
          seg = segments[x];
          if (seg[0] === 255 & seg[1] === 225) {
            return seg;
          }
          x++;
        }
        return [];
      }
    }, {
      key: "insertExif",
      value: function insertExif(resizedFileBase64, exifArray) {
        var imageData = resizedFileBase64.replace('data:image/jpeg;base64,', '');
        var buf = this.decode64(imageData);
        var separatePoint = buf.indexOf(255, 3);
        var mae = buf.slice(0, separatePoint);
        var ato = buf.slice(separatePoint);
        var array = mae;
        array = array.concat(exifArray);
        array = array.concat(ato);
        return array;
      }
    }, {
      key: "slice2Segments",
      value: function slice2Segments(rawImageArray) {
        var head = 0;
        var segments = [];
        while (true) {
          var length;
          if (rawImageArray[head] === 255 & rawImageArray[head + 1] === 218) {
            break;
          }
          if (rawImageArray[head] === 255 & rawImageArray[head + 1] === 216) {
            head += 2;
          } else {
            length = rawImageArray[head + 2] * 256 + rawImageArray[head + 3];
            var endPoint = head + length + 2;
            var seg = rawImageArray.slice(head, endPoint);
            segments.push(seg);
            head = endPoint;
          }
          if (head > rawImageArray.length) {
            break;
          }
        }
        return segments;
      }
    }, {
      key: "decode64",
      value: function decode64(input) {
        var output = '';
        var chr1 = undefined;
        var chr2 = undefined;
        var chr3 = '';
        var enc1 = undefined;
        var enc2 = undefined;
        var enc3 = undefined;
        var enc4 = '';
        var i = 0;
        var buf = [];
        // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
        var base64test = /[^A-Za-z0-9\+\/\=]/g;
        if (base64test.exec(input)) {
          console.warn('There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, \'+\', \'/\',and \'=\'\nExpect errors in decoding.');
        }
        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
        while (true) {
          enc1 = this.KEY_STR.indexOf(input.charAt(i++));
          enc2 = this.KEY_STR.indexOf(input.charAt(i++));
          enc3 = this.KEY_STR.indexOf(input.charAt(i++));
          enc4 = this.KEY_STR.indexOf(input.charAt(i++));
          chr1 = enc1 << 2 | enc2 >> 4;
          chr2 = (enc2 & 15) << 4 | enc3 >> 2;
          chr3 = (enc3 & 3) << 6 | enc4;
          buf.push(chr1);
          if (enc3 !== 64) {
            buf.push(chr2);
          }
          if (enc4 !== 64) {
            buf.push(chr3);
          }
          chr1 = chr2 = chr3 = '';
          enc1 = enc2 = enc3 = enc4 = '';
          if (!(i < input.length)) {
            break;
          }
        }
        return buf;
      }
    }]);
  
    return ExifRestore;
  }();
  
  ExifRestore.initClass();
  
  /*
   * contentloaded.js
   *
   * Author: Diego Perini (diego.perini at gmail.com)
   * Summary: cross-browser wrapper for DOMContentLoaded
   * Updated: 20101020
   * License: MIT
   * Version: 1.2
   *
   * URL:
   * http://javascript.nwbox.com/ContentLoaded/
   * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
   */
  
  // @win window reference
  // @fn function reference
  var contentLoaded = function contentLoaded(win, fn) {
    var done = false;
    var top = true;
    var doc = win.document;
    var root = doc.documentElement;
    var add = doc.addEventListener ? "addEventListener" : "attachEvent";
    var rem = doc.addEventListener ? "removeEventListener" : "detachEvent";
    var pre = doc.addEventListener ? "" : "on";
    var init = function init(e) {
      if (e.type === "readystatechange" && doc.readyState !== "complete") {
        return;
      }
      (e.type === "load" ? win : doc)[rem](pre + e.type, init, false);
      if (!done && (done = true)) {
        return fn.call(win, e.type || e);
      }
    };
  
    var poll = function poll() {
      try {
        root.doScroll("left");
      } catch (e) {
        setTimeout(poll, 50);
        return;
      }
      return init("poll");
    };
  
    if (doc.readyState !== "complete") {
      if (doc.createEventObject && root.doScroll) {
        try {
          top = !win.frameElement;
        } catch (error) {}
        if (top) {
          poll();
        }
      }
      doc[add](pre + "DOMContentLoaded", init, false);
      doc[add](pre + "readystatechange", init, false);
      return win[add](pre + "load", init, false);
    }
  };
  
  // As a single function to be able to write tests.
  Dropzone._autoDiscoverFunction = function () {
    if (Dropzone.autoDiscover) {
      return Dropzone.discover();
    }
  };
  contentLoaded(window, Dropzone._autoDiscoverFunction);
  
  function __guard__(value, transform) {
    return typeof value !== 'undefined' && value !== null ? transform(value) : undefined;
  }
  function __guardMethod__(obj, methodName, transform) {
    if (typeof obj !== 'undefined' && obj !== null && typeof obj[methodName] === 'function') {
      return transform(obj, methodName);
    } else {
      return undefined;
    }
  }