/usr/share/jupyter/nbextensions/jupyter-js-widgets/extension.js is in jupyter-nbextension-jupyter-js-widgets 6.0.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 11823 11824 11825 11826 11827 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 11843 11844 11845 11846 11847 11848 11849 11850 11851 11852 11853 11854 11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 11914 11915 11916 11917 11918 11919 11920 11921 11922 11923 11924 11925 11926 11927 11928 11929 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 12275 12276 12277 12278 12279 12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 12653 12654 12655 12656 12657 12658 12659 12660 12661 12662 12663 12664 12665 12666 12667 12668 12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 12803 12804 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 13036 13037 13038 13039 13040 13041 13042 13043 13044 13045 13046 13047 13048 13049 13050 13051 13052 13053 13054 13055 13056 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13086 13087 13088 13089 13090 13091 13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 13103 13104 13105 13106 13107 13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 13148 13149 13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286 13287 13288 13289 13290 13291 13292 13293 13294 13295 13296 13297 13298 13299 13300 13301 13302 13303 13304 13305 13306 13307 13308 13309 13310 13311 13312 13313 13314 13315 13316 13317 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 13335 13336 13337 13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 13354 13355 13356 13357 13358 13359 13360 13361 13362 13363 13364 13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 13401 13402 13403 13404 13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 13446 13447 13448 13449 13450 13451 13452 13453 13454 13455 13456 13457 13458 13459 13460 13461 13462 13463 13464 13465 13466 13467 13468 13469 13470 13471 13472 13473 13474 13475 13476 13477 13478 13479 13480 13481 13482 13483 13484 13485 13486 13487 13488 13489 13490 13491 13492 13493 13494 13495 13496 13497 13498 13499 13500 13501 13502 13503 13504 13505 13506 13507 13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 13539 13540 13541 13542 13543 13544 13545 13546 13547 13548 13549 13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 13581 13582 13583 13584 13585 13586 13587 13588 13589 13590 13591 13592 13593 13594 13595 13596 13597 13598 13599 13600 13601 13602 13603 13604 13605 13606 13607 13608 13609 13610 13611 13612 13613 13614 13615 13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 13629 13630 13631 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 13661 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 13740 13741 13742 13743 13744 13745 13746 13747 13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 13867 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 13889 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 13904 13905 13906 13907 13908 13909 13910 13911 13912 13913 13914 13915 13916 13917 13918 13919 13920 13921 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 13932 13933 13934 13935 13936 13937 13938 13939 13940 13941 13942 13943 13944 13945 13946 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 13964 13965 13966 13967 13968 13969 13970 13971 13972 13973 13974 13975 13976 13977 13978 13979 13980 13981 13982 13983 13984 13985 13986 13987 13988 13989 13990 13991 13992 13993 13994 13995 13996 13997 13998 13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 14102 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 14122 14123 14124 14125 14126 14127 14128 14129 14130 14131 14132 14133 14134 14135 14136 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 14147 14148 14149 14150 14151 14152 14153 14154 14155 14156 14157 14158 14159 14160 14161 14162 14163 14164 14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 14188 14189 14190 14191 14192 14193 14194 14195 14196 14197 14198 14199 14200 14201 14202 14203 14204 14205 14206 14207 14208 14209 14210 14211 14212 14213 14214 14215 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 14228 14229 14230 14231 14232 14233 14234 14235 14236 14237 14238 14239 14240 14241 14242 14243 14244 14245 14246 14247 14248 14249 14250 14251 14252 14253 14254 14255 14256 14257 14258 14259 14260 14261 14262 14263 14264 14265 14266 14267 14268 14269 14270 14271 14272 14273 14274 14275 14276 14277 14278 14279 14280 14281 14282 14283 14284 14285 14286 14287 14288 14289 14290 14291 14292 14293 14294 14295 14296 14297 14298 14299 14300 14301 14302 14303 14304 14305 14306 14307 14308 14309 14310 14311 14312 14313 14314 14315 14316 14317 14318 14319 14320 14321 14322 14323 14324 14325 14326 14327 14328 14329 14330 14331 14332 14333 14334 14335 14336 14337 14338 14339 14340 14341 14342 14343 14344 14345 14346 14347 14348 14349 14350 14351 14352 14353 14354 14355 14356 14357 14358 14359 14360 14361 14362 14363 14364 14365 14366 14367 14368 14369 14370 14371 14372 14373 14374 14375 14376 14377 14378 14379 14380 14381 14382 14383 14384 14385 14386 14387 14388 14389 14390 14391 14392 14393 14394 14395 14396 14397 14398 14399 14400 14401 14402 14403 14404 14405 14406 14407 14408 14409 14410 14411 14412 14413 14414 14415 14416 14417 14418 14419 14420 14421 14422 14423 14424 14425 14426 14427 14428 14429 14430 14431 14432 14433 14434 14435 14436 14437 14438 14439 14440 14441 14442 14443 14444 14445 14446 14447 14448 14449 14450 14451 14452 14453 14454 14455 14456 14457 14458 14459 14460 14461 14462 14463 14464 14465 14466 14467 14468 14469 14470 14471 14472 14473 14474 14475 14476 14477 14478 14479 14480 14481 14482 14483 14484 14485 14486 14487 14488 14489 14490 14491 14492 14493 14494 14495 14496 14497 14498 14499 14500 14501 14502 14503 14504 14505 14506 14507 14508 14509 14510 14511 14512 14513 14514 14515 14516 14517 14518 14519 14520 14521 14522 14523 14524 14525 14526 14527 14528 14529 14530 14531 14532 14533 14534 14535 14536 14537 14538 14539 14540 14541 14542 14543 14544 14545 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14556 14557 14558 14559 14560 14561 14562 14563 14564 14565 14566 14567 14568 14569 14570 14571 14572 14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 14583 14584 14585 14586 14587 14588 14589 14590 14591 14592 14593 14594 14595 14596 14597 14598 14599 14600 14601 14602 14603 14604 14605 14606 14607 14608 14609 14610 14611 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 14643 14644 14645 14646 14647 14648 14649 14650 14651 14652 14653 14654 14655 14656 14657 14658 14659 14660 14661 14662 14663 14664 14665 14666 14667 14668 14669 14670 14671 14672 14673 14674 14675 14676 14677 14678 14679 14680 14681 14682 14683 14684 14685 14686 14687 14688 14689 14690 14691 14692 14693 14694 14695 14696 14697 14698 14699 14700 14701 14702 14703 14704 14705 14706 14707 14708 14709 14710 14711 14712 14713 14714 14715 14716 14717 14718 14719 14720 14721 14722 14723 14724 14725 14726 14727 14728 14729 14730 14731 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 14763 14764 14765 14766 14767 14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 14806 14807 14808 14809 14810 14811 14812 14813 14814 14815 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 14878 14879 14880 14881 14882 14883 14884 14885 14886 14887 14888 14889 14890 14891 14892 14893 14894 14895 14896 14897 14898 14899 14900 14901 14902 14903 14904 14905 14906 14907 14908 14909 14910 14911 14912 14913 14914 14915 14916 14917 14918 14919 14920 14921 14922 14923 14924 14925 14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 14936 14937 14938 14939 14940 14941 14942 14943 14944 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962 14963 14964 14965 14966 14967 14968 14969 14970 14971 14972 14973 14974 14975 14976 14977 14978 14979 14980 14981 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 14993 14994 14995 14996 14997 14998 14999 15000 15001 15002 15003 15004 15005 15006 15007 15008 15009 15010 15011 15012 15013 15014 15015 15016 15017 15018 15019 15020 15021 15022 15023 15024 15025 15026 15027 15028 15029 15030 15031 15032 15033 15034 15035 15036 15037 15038 15039 15040 15041 15042 15043 15044 15045 15046 15047 15048 15049 15050 15051 15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 15063 15064 15065 15066 15067 15068 15069 15070 15071 15072 15073 15074 15075 15076 15077 15078 15079 15080 15081 15082 15083 15084 15085 15086 15087 15088 15089 15090 15091 15092 15093 15094 15095 15096 15097 15098 15099 15100 15101 15102 15103 15104 15105 15106 15107 15108 15109 15110 15111 15112 15113 15114 15115 15116 15117 15118 15119 15120 15121 15122 15123 15124 15125 15126 15127 15128 15129 15130 15131 15132 15133 15134 15135 15136 15137 15138 15139 15140 15141 15142 15143 15144 15145 15146 15147 15148 15149 15150 15151 15152 15153 15154 15155 15156 15157 15158 15159 15160 15161 15162 15163 15164 15165 15166 15167 15168 15169 15170 15171 15172 15173 15174 15175 15176 15177 15178 15179 15180 15181 15182 15183 15184 15185 15186 15187 15188 15189 15190 15191 15192 15193 15194 15195 15196 15197 15198 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15228 15229 15230 15231 15232 15233 15234 15235 15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 15295 15296 15297 15298 15299 15300 15301 15302 15303 15304 15305 15306 15307 15308 15309 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 15330 15331 15332 15333 15334 15335 15336 15337 15338 15339 15340 15341 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 15398 15399 15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 15434 15435 15436 15437 15438 15439 15440 15441 15442 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 15484 15485 15486 15487 15488 15489 15490 15491 15492 15493 15494 15495 15496 15497 15498 15499 15500 15501 15502 15503 15504 15505 15506 15507 15508 15509 15510 15511 15512 15513 15514 15515 15516 15517 15518 15519 15520 15521 15522 15523 15524 15525 15526 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539 15540 15541 15542 15543 15544 15545 15546 15547 15548 15549 15550 15551 15552 15553 15554 15555 15556 15557 15558 15559 15560 15561 15562 15563 15564 15565 15566 15567 15568 15569 15570 15571 15572 15573 15574 15575 15576 15577 15578 15579 15580 15581 15582 15583 15584 15585 15586 15587 15588 15589 15590 15591 15592 15593 15594 15595 15596 15597 15598 15599 15600 15601 15602 15603 15604 15605 15606 15607 15608 15609 15610 15611 15612 15613 15614 15615 15616 15617 15618 15619 15620 15621 15622 15623 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 15636 15637 15638 15639 15640 15641 15642 15643 15644 15645 15646 15647 15648 15649 15650 15651 15652 15653 15654 15655 15656 15657 15658 15659 15660 15661 15662 15663 15664 15665 15666 15667 15668 15669 15670 15671 15672 15673 15674 15675 15676 15677 15678 15679 15680 15681 15682 15683 15684 15685 15686 15687 15688 15689 15690 15691 15692 15693 15694 15695 15696 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 15722 15723 15724 15725 15726 15727 15728 15729 15730 15731 15732 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 15751 15752 15753 15754 15755 15756 15757 15758 15759 15760 15761 15762 15763 15764 15765 15766 15767 15768 15769 15770 15771 15772 15773 15774 15775 15776 15777 15778 15779 15780 15781 15782 15783 15784 15785 15786 15787 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 15798 15799 15800 15801 15802 15803 15804 15805 15806 15807 15808 15809 15810 15811 15812 15813 15814 15815 15816 15817 15818 15819 15820 15821 15822 15823 15824 15825 15826 15827 15828 15829 15830 15831 15832 15833 15834 15835 15836 15837 15838 15839 15840 15841 15842 15843 15844 15845 15846 15847 15848 15849 15850 15851 15852 15853 15854 15855 15856 15857 15858 15859 15860 15861 15862 15863 15864 15865 15866 15867 15868 15869 15870 15871 15872 15873 15874 15875 15876 15877 15878 15879 15880 15881 15882 15883 15884 15885 15886 15887 15888 15889 15890 15891 15892 15893 15894 15895 15896 15897 15898 15899 15900 15901 15902 15903 15904 15905 15906 15907 15908 15909 15910 15911 15912 15913 15914 15915 15916 15917 15918 15919 15920 15921 15922 15923 15924 15925 15926 15927 15928 15929 15930 15931 15932 15933 15934 15935 15936 15937 15938 15939 15940 15941 15942 15943 15944 15945 15946 15947 15948 15949 15950 15951 15952 15953 15954 15955 15956 15957 15958 15959 15960 15961 15962 15963 15964 15965 15966 15967 15968 15969 15970 15971 15972 15973 15974 15975 15976 15977 15978 15979 15980 15981 15982 15983 15984 15985 15986 15987 15988 15989 15990 15991 15992 15993 15994 15995 15996 15997 15998 15999 16000 16001 16002 16003 16004 16005 16006 16007 16008 16009 16010 16011 16012 16013 16014 16015 16016 16017 16018 16019 16020 16021 16022 16023 16024 16025 16026 16027 16028 16029 16030 16031 16032 16033 16034 16035 16036 16037 16038 16039 16040 16041 16042 16043 16044 16045 16046 16047 16048 16049 16050 16051 16052 16053 16054 16055 16056 16057 16058 16059 16060 16061 16062 16063 16064 16065 16066 16067 16068 16069 16070 16071 16072 16073 16074 16075 16076 16077 16078 16079 16080 16081 16082 16083 16084 16085 16086 16087 16088 16089 16090 16091 16092 16093 16094 16095 16096 16097 16098 16099 16100 16101 16102 16103 16104 16105 16106 16107 16108 16109 16110 16111 16112 16113 16114 16115 16116 16117 16118 16119 16120 16121 16122 16123 16124 16125 16126 16127 16128 16129 16130 16131 16132 16133 16134 16135 16136 16137 16138 16139 16140 16141 16142 16143 16144 16145 16146 16147 16148 16149 16150 16151 16152 16153 16154 16155 16156 16157 16158 16159 16160 16161 16162 16163 16164 16165 16166 16167 16168 16169 16170 16171 16172 16173 16174 16175 16176 16177 16178 16179 16180 16181 16182 16183 16184 16185 16186 16187 16188 16189 16190 16191 16192 16193 16194 16195 16196 16197 16198 16199 16200 16201 16202 16203 16204 16205 16206 16207 16208 16209 16210 16211 16212 16213 16214 16215 16216 16217 16218 16219 16220 16221 16222 16223 16224 16225 16226 16227 16228 16229 16230 16231 16232 16233 16234 16235 16236 16237 16238 16239 16240 16241 16242 16243 16244 16245 16246 16247 16248 16249 16250 16251 16252 16253 16254 16255 16256 16257 16258 16259 16260 16261 16262 16263 16264 16265 16266 16267 16268 16269 16270 16271 16272 16273 16274 16275 16276 16277 16278 16279 16280 16281 16282 16283 16284 16285 16286 16287 16288 16289 16290 16291 16292 16293 16294 16295 16296 16297 16298 16299 16300 16301 16302 16303 16304 16305 16306 16307 16308 16309 16310 16311 16312 16313 16314 16315 16316 16317 16318 16319 16320 16321 16322 16323 16324 16325 16326 16327 16328 16329 16330 16331 16332 16333 16334 16335 16336 16337 16338 16339 16340 16341 16342 16343 16344 16345 16346 16347 16348 16349 16350 16351 16352 16353 16354 16355 16356 16357 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 16369 16370 16371 16372 16373 16374 16375 16376 16377 16378 16379 16380 16381 16382 16383 16384 16385 16386 16387 16388 16389 16390 16391 16392 16393 16394 16395 16396 16397 16398 16399 16400 16401 16402 16403 16404 16405 16406 16407 16408 16409 16410 16411 16412 16413 16414 16415 16416 16417 16418 16419 16420 16421 16422 16423 16424 16425 16426 16427 16428 16429 16430 16431 16432 16433 16434 16435 16436 16437 16438 16439 16440 16441 16442 16443 16444 16445 16446 16447 16448 16449 16450 16451 16452 16453 16454 16455 16456 16457 16458 16459 16460 16461 16462 16463 16464 16465 16466 16467 16468 16469 16470 16471 16472 16473 16474 16475 16476 16477 16478 16479 16480 16481 16482 16483 16484 16485 16486 16487 16488 16489 16490 16491 16492 16493 16494 16495 16496 16497 16498 16499 16500 16501 16502 16503 16504 16505 16506 16507 16508 16509 16510 16511 16512 16513 16514 16515 16516 16517 16518 16519 16520 16521 16522 16523 16524 16525 16526 16527 16528 16529 16530 16531 16532 16533 16534 16535 16536 16537 16538 16539 16540 16541 16542 16543 16544 16545 16546 16547 16548 16549 16550 16551 16552 16553 16554 16555 16556 16557 16558 16559 16560 16561 16562 16563 16564 16565 16566 16567 16568 16569 16570 16571 16572 16573 16574 16575 16576 16577 16578 16579 16580 16581 16582 16583 16584 16585 16586 16587 16588 16589 16590 16591 16592 16593 16594 16595 16596 16597 16598 16599 16600 16601 16602 16603 16604 16605 16606 16607 16608 16609 16610 16611 16612 16613 16614 16615 16616 16617 16618 16619 16620 16621 16622 16623 16624 16625 16626 16627 16628 16629 16630 16631 16632 16633 16634 16635 16636 16637 16638 16639 16640 16641 16642 16643 16644 16645 16646 16647 16648 16649 16650 16651 16652 16653 16654 16655 16656 16657 16658 16659 16660 16661 16662 16663 16664 16665 16666 16667 16668 16669 16670 16671 16672 16673 16674 16675 16676 16677 16678 16679 16680 16681 16682 16683 16684 16685 16686 16687 16688 16689 16690 16691 16692 16693 16694 16695 16696 16697 16698 16699 16700 16701 16702 16703 16704 16705 16706 16707 16708 16709 16710 16711 16712 16713 16714 16715 16716 16717 16718 16719 16720 16721 16722 16723 16724 16725 16726 16727 16728 16729 16730 16731 16732 16733 16734 16735 16736 16737 16738 16739 16740 16741 16742 16743 16744 16745 16746 16747 16748 16749 16750 16751 16752 16753 16754 16755 16756 16757 16758 16759 16760 16761 16762 16763 16764 16765 16766 16767 16768 16769 16770 16771 16772 16773 16774 16775 16776 16777 16778 16779 16780 16781 16782 16783 16784 16785 16786 16787 16788 16789 16790 16791 16792 16793 16794 16795 16796 16797 16798 16799 16800 16801 16802 16803 16804 16805 16806 16807 16808 16809 16810 16811 16812 16813 16814 16815 16816 16817 16818 16819 16820 16821 16822 16823 16824 16825 16826 16827 16828 16829 16830 16831 16832 16833 16834 16835 16836 16837 16838 16839 16840 16841 16842 16843 16844 16845 16846 16847 16848 16849 16850 16851 16852 16853 16854 16855 16856 16857 16858 16859 16860 16861 16862 16863 16864 16865 16866 16867 16868 16869 16870 16871 16872 16873 16874 16875 16876 16877 16878 16879 16880 16881 16882 16883 16884 16885 16886 16887 16888 16889 16890 16891 16892 16893 16894 16895 16896 16897 16898 16899 16900 16901 16902 16903 16904 16905 16906 16907 16908 16909 16910 16911 16912 16913 16914 16915 16916 16917 16918 16919 16920 16921 16922 16923 16924 16925 16926 16927 16928 16929 16930 16931 16932 16933 16934 16935 16936 16937 16938 16939 16940 16941 16942 16943 16944 16945 16946 16947 16948 16949 16950 16951 16952 16953 16954 16955 16956 16957 16958 16959 16960 16961 16962 16963 16964 16965 16966 16967 16968 16969 16970 16971 16972 16973 16974 16975 16976 16977 16978 16979 16980 16981 16982 16983 16984 16985 16986 16987 16988 16989 16990 16991 16992 16993 16994 16995 16996 16997 16998 16999 17000 17001 17002 17003 17004 17005 17006 17007 17008 17009 17010 17011 17012 17013 17014 17015 17016 17017 17018 17019 17020 17021 17022 17023 17024 17025 17026 17027 17028 17029 17030 17031 17032 17033 17034 17035 17036 17037 17038 17039 17040 17041 17042 17043 17044 17045 17046 17047 17048 17049 17050 17051 17052 17053 17054 17055 17056 17057 17058 17059 17060 17061 17062 17063 17064 17065 17066 17067 17068 17069 17070 17071 17072 17073 17074 17075 17076 17077 17078 17079 17080 17081 17082 17083 17084 17085 17086 17087 17088 17089 17090 17091 17092 17093 17094 17095 17096 17097 17098 17099 17100 17101 17102 17103 17104 17105 17106 17107 17108 17109 17110 17111 17112 17113 17114 17115 17116 17117 17118 17119 17120 17121 17122 17123 17124 17125 17126 17127 17128 17129 17130 17131 17132 17133 17134 17135 17136 17137 17138 17139 17140 17141 17142 17143 17144 17145 17146 17147 17148 17149 17150 17151 17152 17153 17154 17155 17156 17157 17158 17159 17160 17161 17162 17163 17164 17165 17166 17167 17168 17169 17170 17171 17172 17173 17174 17175 17176 17177 17178 17179 17180 17181 17182 17183 17184 17185 17186 17187 17188 17189 17190 17191 17192 17193 17194 17195 17196 17197 17198 17199 17200 17201 17202 17203 17204 17205 17206 17207 17208 17209 17210 17211 17212 17213 17214 17215 17216 17217 17218 17219 17220 17221 17222 17223 17224 17225 17226 17227 17228 17229 17230 17231 17232 17233 17234 17235 17236 17237 17238 17239 17240 17241 17242 17243 17244 17245 17246 17247 17248 17249 17250 17251 17252 17253 17254 17255 17256 17257 17258 17259 17260 17261 17262 17263 17264 17265 17266 17267 17268 17269 17270 17271 17272 17273 17274 17275 17276 17277 17278 17279 17280 17281 17282 17283 17284 17285 17286 17287 17288 17289 17290 17291 17292 17293 17294 17295 17296 17297 17298 17299 17300 17301 17302 17303 17304 17305 17306 17307 17308 17309 17310 17311 17312 17313 17314 17315 17316 17317 17318 17319 17320 17321 17322 17323 17324 17325 17326 17327 17328 17329 17330 17331 17332 17333 17334 17335 17336 17337 17338 17339 17340 17341 17342 17343 17344 17345 17346 17347 17348 17349 17350 17351 17352 17353 17354 17355 17356 17357 17358 17359 17360 17361 17362 17363 17364 17365 17366 17367 17368 17369 17370 17371 17372 17373 17374 17375 17376 17377 17378 17379 17380 17381 17382 17383 17384 17385 17386 17387 17388 17389 17390 17391 17392 17393 17394 17395 17396 17397 17398 17399 17400 17401 17402 17403 17404 17405 17406 17407 17408 17409 17410 17411 17412 17413 17414 17415 17416 17417 17418 17419 17420 17421 17422 17423 17424 17425 17426 17427 17428 17429 17430 17431 17432 17433 17434 17435 17436 17437 17438 17439 17440 17441 17442 17443 17444 17445 17446 17447 17448 17449 17450 17451 17452 17453 17454 17455 17456 17457 17458 17459 17460 17461 17462 17463 17464 17465 17466 17467 17468 17469 17470 17471 17472 17473 17474 17475 17476 17477 17478 17479 17480 17481 17482 17483 17484 17485 17486 17487 17488 17489 17490 17491 17492 17493 17494 17495 17496 17497 17498 17499 17500 17501 17502 17503 17504 17505 17506 17507 17508 17509 17510 17511 17512 17513 17514 17515 17516 17517 17518 17519 17520 17521 17522 17523 17524 17525 17526 17527 17528 17529 17530 17531 17532 17533 17534 17535 17536 17537 17538 17539 17540 17541 17542 17543 17544 17545 17546 17547 17548 17549 17550 17551 17552 17553 17554 17555 17556 17557 17558 17559 17560 17561 17562 17563 17564 17565 17566 17567 17568 17569 17570 17571 17572 17573 17574 17575 17576 17577 17578 17579 17580 17581 17582 17583 17584 17585 17586 17587 17588 17589 17590 17591 17592 17593 17594 17595 17596 17597 17598 17599 17600 17601 17602 17603 17604 17605 17606 17607 17608 17609 17610 17611 17612 17613 17614 17615 17616 17617 17618 17619 17620 17621 17622 17623 17624 17625 17626 17627 17628 17629 17630 17631 17632 17633 17634 17635 17636 17637 17638 17639 17640 17641 17642 17643 17644 17645 17646 17647 17648 17649 17650 17651 17652 17653 17654 17655 17656 17657 17658 17659 17660 17661 17662 17663 17664 17665 17666 17667 17668 17669 17670 17671 17672 17673 17674 17675 17676 17677 17678 17679 17680 17681 17682 17683 17684 17685 17686 17687 17688 17689 17690 17691 17692 17693 17694 17695 17696 17697 17698 17699 17700 17701 17702 17703 17704 17705 17706 17707 17708 17709 17710 17711 17712 17713 17714 17715 17716 17717 17718 17719 17720 17721 17722 17723 17724 17725 17726 17727 17728 17729 17730 17731 17732 17733 17734 17735 17736 17737 17738 17739 17740 17741 17742 17743 17744 17745 17746 17747 17748 17749 17750 17751 17752 17753 17754 17755 17756 17757 17758 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 17774 17775 17776 17777 17778 17779 17780 17781 17782 17783 17784 17785 17786 17787 17788 17789 17790 17791 17792 17793 17794 17795 17796 17797 17798 17799 17800 17801 17802 17803 17804 17805 17806 17807 17808 17809 17810 17811 17812 17813 17814 17815 17816 17817 17818 17819 17820 17821 17822 17823 17824 17825 17826 17827 17828 17829 17830 17831 17832 17833 17834 17835 17836 17837 17838 17839 17840 17841 17842 17843 17844 17845 17846 17847 17848 17849 17850 17851 17852 17853 17854 17855 17856 17857 17858 17859 17860 17861 17862 17863 17864 17865 17866 17867 17868 17869 17870 17871 17872 17873 17874 17875 17876 17877 17878 17879 17880 17881 17882 17883 17884 17885 17886 17887 17888 17889 17890 17891 17892 17893 17894 17895 17896 17897 17898 17899 17900 17901 17902 17903 17904 17905 17906 17907 17908 17909 17910 17911 17912 17913 17914 17915 17916 17917 17918 17919 17920 17921 17922 17923 17924 17925 17926 17927 17928 17929 17930 17931 17932 17933 17934 17935 17936 17937 17938 17939 17940 17941 17942 17943 17944 17945 17946 17947 17948 17949 17950 17951 17952 17953 17954 17955 17956 17957 17958 17959 17960 17961 17962 17963 17964 17965 17966 17967 17968 17969 17970 17971 17972 17973 17974 17975 17976 17977 17978 17979 17980 17981 17982 17983 17984 17985 17986 17987 17988 17989 17990 17991 17992 17993 17994 17995 17996 17997 17998 17999 18000 18001 18002 18003 18004 18005 18006 18007 18008 18009 18010 18011 18012 18013 18014 18015 18016 18017 18018 18019 18020 18021 18022 18023 18024 18025 18026 18027 18028 18029 18030 18031 18032 18033 18034 18035 18036 18037 18038 18039 18040 18041 18042 18043 18044 18045 18046 18047 18048 18049 18050 18051 18052 18053 18054 18055 18056 18057 18058 18059 18060 18061 18062 18063 18064 18065 18066 18067 18068 18069 18070 18071 18072 18073 18074 18075 18076 18077 18078 18079 18080 18081 18082 18083 18084 18085 18086 18087 18088 18089 18090 18091 18092 18093 18094 18095 18096 18097 18098 18099 18100 18101 18102 18103 18104 18105 18106 18107 18108 18109 18110 18111 18112 18113 18114 18115 18116 18117 18118 18119 18120 18121 18122 18123 18124 18125 18126 18127 18128 18129 18130 18131 18132 18133 18134 18135 18136 18137 18138 18139 18140 18141 18142 18143 18144 18145 18146 18147 18148 18149 18150 18151 18152 18153 18154 18155 18156 18157 18158 18159 18160 18161 18162 18163 18164 18165 18166 18167 18168 18169 18170 18171 18172 18173 18174 18175 18176 18177 18178 18179 18180 18181 18182 18183 18184 18185 18186 18187 18188 18189 18190 18191 18192 18193 18194 18195 18196 18197 18198 18199 18200 18201 18202 18203 18204 18205 18206 18207 18208 18209 18210 18211 18212 18213 18214 18215 18216 18217 18218 18219 18220 18221 18222 18223 18224 18225 18226 18227 18228 18229 18230 18231 18232 18233 18234 18235 18236 18237 18238 18239 18240 18241 18242 18243 18244 18245 18246 18247 18248 18249 18250 18251 18252 18253 18254 18255 18256 18257 18258 18259 18260 18261 18262 18263 18264 18265 18266 18267 18268 18269 18270 18271 18272 18273 18274 18275 18276 18277 18278 18279 18280 18281 18282 18283 18284 18285 18286 18287 18288 18289 18290 18291 18292 18293 18294 18295 18296 18297 18298 18299 18300 18301 18302 18303 18304 18305 18306 18307 18308 18309 18310 18311 18312 18313 18314 18315 18316 18317 18318 18319 18320 18321 18322 18323 18324 18325 18326 18327 18328 18329 18330 18331 18332 18333 18334 18335 18336 18337 18338 18339 18340 18341 18342 18343 18344 18345 18346 18347 18348 18349 18350 18351 18352 18353 18354 18355 18356 18357 18358 18359 18360 18361 18362 18363 18364 18365 18366 18367 18368 18369 18370 18371 18372 18373 18374 18375 18376 18377 18378 18379 18380 18381 18382 18383 18384 18385 18386 18387 18388 18389 18390 18391 18392 18393 18394 18395 18396 18397 18398 18399 18400 18401 18402 18403 18404 18405 18406 18407 18408 18409 18410 18411 18412 18413 18414 18415 18416 18417 18418 18419 18420 18421 18422 18423 18424 18425 18426 18427 18428 18429 18430 18431 18432 18433 18434 18435 18436 18437 18438 18439 18440 18441 18442 18443 18444 18445 18446 18447 18448 18449 18450 18451 18452 18453 18454 18455 18456 18457 18458 18459 18460 18461 18462 18463 18464 18465 18466 18467 18468 18469 18470 18471 18472 18473 18474 18475 18476 18477 18478 18479 18480 18481 18482 18483 18484 18485 18486 18487 18488 18489 18490 18491 18492 18493 18494 18495 18496 18497 18498 18499 18500 18501 18502 18503 18504 18505 18506 18507 18508 18509 18510 18511 18512 18513 18514 18515 18516 18517 18518 18519 18520 18521 18522 18523 18524 18525 18526 18527 18528 18529 18530 18531 18532 18533 18534 18535 18536 18537 18538 18539 18540 18541 18542 18543 18544 18545 18546 18547 18548 18549 18550 18551 18552 18553 18554 18555 18556 18557 18558 18559 18560 18561 18562 18563 18564 18565 18566 18567 18568 18569 18570 18571 18572 18573 18574 18575 18576 18577 18578 18579 18580 18581 18582 18583 18584 18585 18586 18587 18588 18589 18590 18591 18592 18593 18594 18595 18596 18597 18598 18599 18600 18601 18602 18603 18604 18605 18606 18607 18608 18609 18610 18611 18612 18613 18614 18615 18616 18617 18618 18619 18620 18621 18622 18623 18624 18625 18626 18627 18628 18629 18630 18631 18632 18633 18634 18635 18636 18637 18638 18639 18640 18641 18642 18643 18644 18645 18646 18647 18648 18649 18650 18651 18652 18653 18654 18655 18656 18657 18658 18659 18660 18661 18662 18663 18664 18665 18666 18667 18668 18669 18670 18671 18672 18673 18674 18675 18676 18677 18678 18679 18680 18681 18682 18683 18684 18685 18686 18687 18688 18689 18690 18691 18692 18693 18694 18695 18696 18697 18698 18699 18700 18701 18702 18703 18704 18705 18706 18707 18708 18709 18710 18711 18712 18713 18714 18715 18716 18717 18718 18719 18720 18721 18722 18723 18724 18725 18726 18727 18728 18729 18730 18731 18732 18733 18734 18735 18736 18737 18738 18739 18740 18741 18742 18743 18744 18745 18746 18747 18748 18749 18750 18751 18752 18753 18754 18755 18756 18757 18758 18759 18760 18761 18762 18763 18764 18765 18766 18767 18768 18769 18770 18771 18772 18773 18774 18775 18776 18777 18778 18779 18780 18781 18782 18783 18784 18785 18786 18787 18788 18789 18790 18791 18792 18793 18794 18795 18796 18797 18798 18799 18800 18801 18802 18803 18804 18805 18806 18807 18808 18809 18810 18811 18812 18813 18814 18815 18816 18817 18818 18819 18820 18821 18822 18823 18824 18825 18826 18827 18828 18829 18830 18831 18832 18833 18834 18835 18836 18837 18838 18839 18840 18841 18842 18843 18844 18845 18846 18847 18848 18849 18850 18851 18852 18853 18854 18855 18856 18857 18858 18859 18860 18861 18862 18863 18864 18865 18866 18867 18868 18869 18870 18871 18872 18873 18874 18875 18876 18877 18878 18879 18880 18881 18882 18883 18884 18885 18886 18887 18888 18889 18890 18891 18892 18893 18894 18895 18896 18897 18898 18899 18900 18901 18902 18903 18904 18905 18906 18907 18908 18909 18910 18911 18912 18913 18914 18915 18916 18917 18918 18919 18920 18921 18922 18923 18924 18925 18926 18927 18928 18929 18930 18931 18932 18933 18934 18935 18936 18937 18938 18939 18940 18941 18942 18943 18944 18945 18946 18947 18948 18949 18950 18951 18952 18953 18954 18955 18956 18957 18958 18959 18960 18961 18962 18963 18964 18965 18966 18967 18968 18969 18970 18971 18972 18973 18974 18975 18976 18977 18978 18979 18980 18981 18982 18983 18984 18985 18986 18987 18988 18989 18990 18991 18992 18993 18994 18995 18996 18997 18998 18999 19000 19001 19002 19003 19004 19005 19006 19007 19008 19009 19010 19011 19012 19013 19014 19015 19016 19017 19018 19019 19020 19021 19022 19023 19024 19025 19026 19027 19028 19029 19030 19031 19032 19033 19034 19035 19036 19037 19038 19039 19040 19041 19042 19043 19044 19045 19046 19047 19048 19049 19050 19051 19052 19053 19054 19055 19056 19057 19058 19059 19060 19061 19062 19063 19064 19065 19066 19067 19068 19069 19070 19071 19072 19073 19074 19075 19076 19077 19078 19079 19080 19081 19082 19083 19084 19085 19086 19087 19088 19089 19090 19091 19092 19093 19094 19095 19096 19097 19098 19099 19100 19101 19102 19103 19104 19105 19106 19107 19108 19109 19110 19111 19112 19113 19114 19115 19116 19117 19118 19119 19120 19121 19122 19123 19124 19125 19126 19127 19128 19129 19130 19131 19132 19133 19134 19135 19136 19137 19138 19139 19140 19141 19142 19143 19144 19145 19146 19147 19148 19149 19150 19151 19152 19153 19154 19155 19156 19157 19158 19159 19160 19161 19162 19163 19164 19165 19166 19167 19168 19169 19170 19171 19172 19173 19174 19175 19176 19177 19178 19179 19180 19181 19182 19183 19184 19185 19186 19187 19188 19189 19190 19191 19192 19193 19194 19195 19196 19197 19198 19199 19200 19201 19202 19203 19204 19205 19206 19207 19208 19209 19210 19211 19212 19213 19214 19215 19216 19217 19218 19219 19220 19221 19222 19223 19224 19225 19226 19227 19228 19229 19230 19231 19232 19233 19234 19235 19236 19237 19238 19239 19240 19241 19242 19243 19244 19245 19246 19247 19248 19249 19250 19251 19252 19253 19254 19255 19256 19257 19258 19259 19260 19261 19262 19263 19264 19265 19266 19267 19268 19269 19270 19271 19272 19273 19274 19275 19276 19277 19278 19279 19280 19281 19282 19283 19284 19285 19286 19287 19288 19289 19290 19291 19292 19293 19294 19295 19296 19297 19298 19299 19300 19301 19302 19303 19304 19305 19306 19307 19308 19309 19310 19311 19312 19313 19314 19315 19316 19317 19318 19319 19320 19321 19322 19323 19324 19325 19326 19327 19328 19329 19330 19331 19332 19333 19334 19335 19336 19337 19338 19339 19340 19341 19342 19343 19344 19345 19346 19347 19348 19349 19350 19351 19352 19353 19354 19355 19356 19357 19358 19359 19360 19361 19362 19363 19364 19365 19366 19367 19368 19369 19370 19371 19372 19373 19374 19375 19376 19377 19378 19379 19380 19381 19382 19383 19384 19385 19386 19387 19388 19389 19390 19391 19392 19393 19394 19395 19396 19397 19398 19399 19400 19401 19402 19403 19404 19405 19406 19407 19408 19409 19410 19411 19412 19413 19414 19415 19416 19417 19418 19419 19420 19421 19422 19423 19424 19425 19426 19427 19428 19429 19430 19431 19432 19433 19434 19435 19436 19437 19438 19439 19440 19441 19442 19443 19444 19445 19446 19447 19448 19449 19450 19451 19452 19453 19454 19455 19456 19457 19458 19459 19460 19461 19462 19463 19464 19465 19466 19467 19468 19469 19470 19471 19472 19473 19474 19475 19476 19477 19478 19479 19480 19481 19482 19483 19484 19485 19486 19487 19488 19489 19490 19491 19492 19493 19494 19495 19496 19497 19498 19499 19500 19501 19502 19503 19504 19505 19506 19507 19508 19509 19510 19511 19512 19513 19514 19515 19516 19517 19518 19519 19520 19521 19522 19523 19524 19525 19526 19527 19528 19529 19530 19531 19532 19533 19534 19535 19536 19537 19538 19539 19540 19541 19542 19543 19544 19545 19546 19547 19548 19549 19550 19551 19552 19553 19554 19555 19556 19557 19558 19559 19560 19561 19562 19563 19564 19565 19566 19567 19568 19569 19570 19571 19572 19573 19574 19575 19576 19577 19578 19579 19580 19581 19582 19583 19584 19585 19586 19587 19588 19589 19590 19591 19592 19593 19594 19595 19596 19597 19598 19599 19600 19601 19602 19603 19604 19605 19606 19607 19608 19609 19610 19611 19612 19613 19614 19615 19616 19617 19618 19619 19620 19621 19622 19623 19624 19625 19626 19627 19628 19629 19630 19631 19632 19633 19634 19635 19636 19637 19638 19639 19640 19641 19642 19643 19644 19645 19646 19647 19648 19649 19650 19651 19652 19653 19654 19655 19656 19657 19658 19659 19660 19661 19662 19663 19664 19665 19666 19667 19668 19669 19670 19671 19672 19673 19674 19675 19676 19677 19678 19679 19680 19681 19682 19683 19684 19685 19686 19687 19688 19689 19690 19691 19692 19693 19694 19695 19696 19697 19698 19699 19700 19701 19702 19703 19704 19705 19706 19707 19708 19709 19710 19711 19712 19713 19714 19715 19716 19717 19718 19719 19720 19721 19722 19723 19724 19725 19726 19727 19728 19729 19730 19731 19732 19733 19734 19735 19736 19737 19738 19739 19740 19741 19742 19743 19744 19745 19746 19747 19748 19749 19750 19751 19752 19753 19754 19755 19756 19757 19758 19759 19760 19761 19762 19763 19764 19765 19766 19767 19768 19769 19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 19833 19834 19835 19836 19837 19838 19839 19840 19841 19842 19843 19844 19845 19846 19847 19848 19849 19850 19851 19852 19853 19854 19855 19856 19857 19858 19859 19860 19861 19862 19863 19864 19865 19866 19867 19868 19869 19870 19871 19872 19873 19874 19875 19876 19877 19878 19879 19880 19881 19882 19883 19884 19885 19886 19887 19888 19889 19890 19891 19892 19893 19894 19895 19896 19897 19898 19899 19900 19901 19902 19903 19904 19905 19906 19907 19908 19909 19910 19911 19912 19913 19914 19915 19916 19917 19918 19919 19920 19921 19922 19923 19924 19925 19926 19927 19928 19929 19930 19931 19932 19933 19934 19935 19936 19937 19938 19939 19940 19941 19942 19943 19944 19945 19946 19947 19948 19949 19950 19951 19952 19953 19954 19955 19956 19957 19958 19959 19960 19961 19962 19963 19964 19965 19966 19967 19968 19969 19970 19971 19972 19973 19974 19975 19976 19977 19978 19979 19980 19981 19982 19983 19984 19985 19986 19987 19988 19989 19990 19991 19992 19993 19994 19995 19996 19997 19998 19999 20000 20001 20002 20003 20004 20005 20006 20007 20008 20009 20010 20011 20012 20013 20014 20015 20016 20017 20018 20019 20020 20021 20022 20023 20024 20025 20026 20027 20028 20029 20030 20031 20032 20033 20034 20035 20036 20037 20038 20039 20040 20041 20042 20043 20044 20045 20046 20047 20048 20049 20050 20051 20052 20053 20054 20055 20056 20057 20058 20059 20060 20061 20062 20063 20064 20065 20066 20067 20068 20069 20070 20071 20072 20073 20074 20075 20076 20077 20078 20079 20080 20081 20082 20083 20084 20085 20086 20087 20088 20089 20090 20091 20092 20093 20094 20095 20096 20097 20098 20099 20100 20101 20102 20103 20104 20105 20106 20107 20108 20109 20110 20111 20112 20113 20114 20115 20116 20117 20118 20119 20120 20121 20122 20123 20124 20125 20126 20127 20128 20129 20130 20131 20132 20133 20134 20135 20136 20137 20138 20139 20140 20141 20142 20143 20144 20145 20146 20147 20148 20149 20150 20151 20152 20153 20154 20155 20156 20157 20158 20159 20160 20161 20162 20163 20164 20165 20166 20167 20168 20169 20170 20171 20172 20173 20174 20175 20176 20177 20178 20179 20180 20181 20182 20183 20184 20185 20186 20187 20188 20189 20190 20191 20192 20193 20194 20195 20196 20197 20198 20199 20200 20201 20202 20203 20204 20205 20206 20207 20208 20209 20210 20211 20212 20213 20214 20215 20216 20217 20218 20219 20220 20221 20222 20223 20224 20225 20226 20227 20228 20229 20230 20231 20232 20233 20234 20235 20236 20237 20238 20239 20240 20241 20242 20243 20244 20245 20246 20247 20248 20249 20250 20251 20252 20253 20254 20255 20256 20257 20258 20259 20260 20261 20262 20263 20264 20265 20266 20267 20268 20269 20270 20271 20272 20273 20274 20275 20276 20277 20278 20279 20280 20281 20282 20283 20284 20285 20286 20287 20288 20289 20290 20291 20292 20293 20294 20295 20296 20297 20298 20299 20300 20301 20302 20303 20304 20305 20306 20307 20308 20309 20310 20311 20312 20313 20314 20315 20316 20317 20318 20319 20320 20321 20322 20323 20324 20325 20326 20327 20328 20329 20330 20331 20332 20333 20334 20335 20336 20337 20338 20339 20340 20341 20342 20343 20344 20345 20346 20347 20348 20349 20350 20351 20352 20353 20354 20355 20356 20357 20358 20359 20360 20361 20362 20363 20364 20365 20366 20367 20368 20369 20370 20371 20372 20373 20374 20375 20376 20377 20378 20379 20380 20381 20382 20383 20384 20385 20386 20387 20388 20389 20390 20391 20392 20393 20394 20395 20396 20397 20398 20399 20400 20401 20402 20403 20404 20405 20406 20407 20408 20409 20410 20411 20412 20413 20414 20415 20416 20417 20418 20419 20420 20421 20422 20423 20424 20425 20426 20427 20428 20429 20430 20431 20432 20433 20434 20435 20436 20437 20438 20439 20440 20441 20442 20443 20444 20445 20446 20447 20448 20449 20450 20451 20452 20453 20454 20455 20456 20457 20458 20459 20460 20461 20462 20463 20464 20465 20466 20467 20468 20469 20470 20471 20472 20473 20474 20475 20476 20477 20478 20479 20480 20481 20482 20483 20484 20485 20486 20487 20488 20489 20490 20491 20492 20493 20494 20495 20496 20497 20498 20499 20500 20501 20502 20503 20504 20505 20506 20507 20508 20509 20510 20511 20512 20513 20514 20515 20516 20517 20518 20519 20520 20521 20522 20523 20524 20525 20526 20527 20528 20529 20530 20531 20532 20533 20534 20535 20536 20537 20538 20539 20540 20541 20542 20543 20544 20545 20546 20547 20548 20549 20550 20551 20552 20553 20554 20555 20556 20557 20558 20559 20560 20561 20562 20563 20564 20565 20566 20567 20568 20569 20570 20571 20572 20573 20574 20575 20576 20577 20578 20579 20580 20581 20582 20583 20584 20585 20586 20587 20588 20589 20590 20591 20592 20593 20594 20595 20596 20597 20598 20599 20600 20601 20602 20603 20604 20605 20606 20607 20608 20609 20610 20611 20612 20613 20614 20615 20616 20617 20618 20619 20620 20621 20622 20623 20624 20625 20626 20627 20628 20629 20630 20631 20632 20633 20634 20635 20636 20637 20638 20639 20640 20641 20642 20643 20644 20645 20646 20647 20648 20649 20650 20651 20652 20653 20654 20655 20656 20657 20658 20659 20660 20661 20662 20663 20664 20665 20666 20667 20668 20669 20670 20671 20672 20673 20674 20675 20676 20677 20678 20679 20680 20681 20682 20683 20684 20685 20686 20687 20688 20689 20690 20691 20692 20693 20694 20695 20696 20697 20698 20699 20700 20701 20702 20703 20704 20705 20706 20707 20708 20709 20710 20711 20712 20713 20714 20715 20716 20717 20718 20719 20720 20721 20722 20723 20724 20725 20726 20727 20728 20729 20730 20731 20732 20733 20734 20735 20736 20737 20738 20739 20740 20741 20742 20743 20744 20745 20746 20747 20748 20749 20750 20751 20752 20753 20754 20755 20756 20757 20758 20759 20760 20761 20762 20763 20764 20765 20766 20767 20768 20769 20770 20771 20772 20773 20774 20775 20776 20777 20778 20779 20780 20781 20782 20783 20784 20785 20786 20787 20788 20789 20790 20791 20792 20793 20794 20795 20796 20797 20798 20799 20800 20801 20802 20803 20804 20805 20806 20807 20808 20809 20810 20811 20812 20813 20814 20815 20816 20817 20818 20819 20820 20821 20822 20823 20824 20825 20826 20827 20828 20829 20830 20831 20832 20833 20834 20835 20836 20837 20838 20839 20840 20841 20842 20843 20844 20845 20846 20847 20848 20849 20850 20851 20852 20853 20854 20855 20856 20857 20858 20859 20860 20861 20862 20863 20864 20865 20866 20867 20868 20869 20870 20871 20872 20873 20874 20875 20876 20877 20878 20879 20880 20881 20882 20883 20884 20885 20886 20887 20888 20889 20890 20891 20892 20893 20894 20895 20896 20897 20898 20899 20900 20901 20902 20903 20904 20905 20906 20907 20908 20909 20910 20911 20912 20913 20914 20915 20916 20917 20918 20919 20920 20921 20922 20923 20924 20925 20926 20927 20928 20929 20930 20931 20932 20933 20934 20935 20936 20937 20938 20939 20940 20941 20942 20943 20944 20945 20946 20947 20948 20949 20950 20951 20952 20953 20954 20955 20956 20957 20958 20959 20960 20961 20962 20963 20964 20965 20966 20967 20968 20969 20970 20971 20972 20973 20974 20975 20976 20977 20978 20979 20980 20981 20982 20983 20984 20985 20986 20987 20988 20989 20990 20991 20992 20993 20994 20995 20996 20997 20998 20999 21000 21001 21002 21003 21004 21005 21006 21007 21008 21009 21010 21011 21012 21013 21014 21015 21016 21017 21018 21019 21020 21021 21022 21023 21024 21025 21026 21027 21028 21029 21030 21031 21032 21033 21034 21035 21036 21037 21038 21039 21040 21041 21042 21043 21044 21045 21046 21047 21048 21049 21050 21051 21052 21053 21054 21055 21056 21057 21058 21059 21060 21061 21062 21063 21064 21065 21066 21067 21068 21069 21070 21071 21072 21073 21074 21075 21076 21077 21078 21079 21080 21081 21082 21083 21084 21085 21086 21087 21088 21089 21090 21091 21092 21093 21094 21095 21096 21097 21098 21099 21100 21101 21102 21103 21104 21105 21106 21107 21108 21109 21110 21111 21112 21113 21114 21115 21116 21117 21118 21119 21120 21121 21122 21123 21124 21125 21126 21127 21128 21129 21130 21131 21132 21133 21134 21135 21136 21137 21138 21139 21140 21141 21142 21143 21144 21145 21146 21147 21148 21149 21150 21151 21152 21153 21154 21155 21156 21157 21158 21159 21160 21161 21162 21163 21164 21165 21166 21167 21168 21169 21170 21171 21172 21173 21174 21175 21176 21177 21178 21179 21180 21181 21182 21183 21184 21185 21186 21187 21188 21189 21190 21191 21192 21193 21194 21195 21196 21197 21198 21199 21200 21201 21202 21203 21204 21205 21206 21207 21208 21209 21210 21211 21212 21213 21214 21215 21216 21217 21218 21219 21220 21221 21222 21223 21224 21225 21226 21227 21228 21229 21230 21231 21232 21233 21234 21235 21236 21237 21238 21239 21240 21241 21242 21243 21244 21245 21246 21247 21248 21249 21250 21251 21252 21253 21254 21255 21256 21257 21258 21259 21260 21261 21262 21263 21264 21265 21266 21267 21268 21269 21270 21271 21272 21273 21274 21275 21276 21277 21278 21279 21280 21281 21282 21283 21284 21285 21286 21287 21288 21289 21290 21291 21292 21293 21294 21295 21296 21297 21298 21299 21300 21301 21302 21303 21304 21305 21306 21307 21308 21309 21310 21311 21312 21313 21314 21315 21316 21317 21318 21319 21320 21321 21322 21323 21324 21325 21326 21327 21328 21329 21330 21331 21332 21333 21334 21335 21336 21337 21338 21339 21340 21341 21342 21343 21344 21345 21346 21347 21348 21349 21350 21351 21352 21353 21354 21355 21356 21357 21358 21359 21360 21361 21362 21363 21364 21365 21366 21367 21368 21369 21370 21371 21372 21373 21374 21375 21376 21377 21378 21379 21380 21381 21382 21383 21384 21385 21386 21387 21388 21389 21390 21391 21392 21393 21394 21395 21396 21397 21398 21399 21400 21401 21402 21403 21404 21405 21406 21407 21408 21409 21410 21411 21412 21413 21414 21415 21416 21417 21418 21419 21420 21421 21422 21423 21424 21425 21426 21427 21428 21429 21430 21431 21432 21433 21434 21435 21436 21437 21438 21439 21440 21441 21442 21443 21444 21445 21446 21447 21448 21449 21450 21451 21452 21453 21454 21455 21456 21457 21458 21459 21460 21461 21462 21463 21464 21465 21466 21467 21468 21469 21470 21471 21472 21473 21474 21475 21476 21477 21478 21479 21480 21481 21482 21483 21484 21485 21486 21487 21488 21489 21490 21491 21492 21493 21494 21495 21496 21497 21498 21499 21500 21501 21502 21503 21504 21505 21506 21507 21508 21509 21510 21511 21512 21513 21514 21515 21516 21517 21518 21519 21520 21521 21522 21523 21524 21525 21526 21527 21528 21529 21530 21531 21532 21533 21534 21535 21536 21537 21538 21539 21540 21541 21542 21543 21544 21545 21546 21547 21548 21549 21550 21551 21552 21553 21554 21555 21556 21557 21558 21559 21560 21561 21562 21563 21564 21565 21566 21567 21568 21569 21570 21571 21572 21573 21574 21575 21576 21577 21578 21579 21580 21581 21582 21583 21584 21585 21586 21587 21588 21589 21590 21591 21592 21593 21594 21595 21596 21597 21598 21599 21600 21601 21602 21603 21604 21605 21606 21607 21608 21609 21610 21611 21612 21613 21614 21615 21616 21617 21618 21619 21620 21621 21622 21623 21624 21625 21626 21627 21628 21629 21630 21631 21632 21633 21634 21635 21636 21637 21638 21639 21640 21641 21642 21643 21644 21645 21646 21647 21648 21649 21650 21651 21652 21653 21654 21655 21656 21657 21658 21659 21660 21661 21662 21663 21664 21665 21666 21667 21668 21669 21670 21671 21672 21673 21674 21675 21676 21677 21678 21679 21680 21681 21682 21683 21684 21685 21686 21687 21688 21689 21690 21691 21692 21693 21694 21695 21696 21697 21698 21699 21700 21701 21702 21703 21704 21705 21706 21707 21708 21709 21710 21711 21712 21713 21714 21715 21716 21717 21718 21719 21720 21721 21722 21723 21724 21725 21726 21727 21728 21729 21730 21731 21732 21733 21734 21735 21736 21737 21738 21739 21740 21741 21742 21743 21744 21745 21746 21747 21748 21749 21750 21751 21752 21753 21754 21755 21756 21757 21758 21759 21760 21761 21762 21763 21764 21765 21766 21767 21768 21769 21770 21771 21772 21773 21774 21775 21776 21777 21778 21779 21780 21781 21782 21783 21784 21785 21786 21787 21788 21789 21790 21791 21792 21793 21794 21795 21796 21797 21798 21799 21800 21801 21802 21803 21804 21805 21806 21807 21808 21809 21810 21811 21812 21813 21814 21815 21816 21817 21818 21819 21820 21821 21822 21823 21824 21825 21826 21827 21828 21829 21830 21831 21832 21833 21834 21835 21836 21837 21838 21839 21840 21841 21842 21843 21844 21845 21846 21847 21848 21849 21850 21851 21852 21853 21854 21855 21856 21857 21858 21859 21860 21861 21862 21863 21864 21865 21866 21867 21868 21869 21870 21871 21872 21873 21874 21875 21876 21877 21878 21879 21880 21881 21882 21883 21884 21885 21886 21887 21888 21889 21890 21891 21892 21893 21894 21895 21896 21897 21898 21899 21900 21901 21902 21903 21904 21905 21906 21907 21908 21909 21910 21911 21912 21913 21914 21915 21916 21917 21918 21919 21920 21921 21922 21923 21924 21925 21926 21927 21928 21929 21930 21931 21932 21933 21934 21935 21936 21937 21938 21939 21940 21941 21942 21943 21944 21945 21946 21947 21948 21949 21950 21951 21952 21953 21954 21955 21956 21957 21958 21959 21960 21961 21962 21963 21964 21965 21966 21967 21968 21969 21970 21971 21972 21973 21974 21975 21976 21977 21978 21979 21980 21981 21982 21983 21984 21985 21986 21987 21988 21989 21990 21991 21992 21993 21994 21995 21996 21997 21998 21999 22000 22001 22002 22003 22004 22005 22006 22007 22008 22009 22010 22011 22012 22013 22014 22015 22016 22017 22018 22019 22020 22021 22022 22023 22024 22025 22026 22027 22028 22029 22030 22031 22032 22033 22034 22035 22036 22037 22038 22039 22040 22041 22042 22043 22044 22045 22046 22047 22048 22049 22050 22051 22052 22053 22054 22055 22056 22057 22058 22059 22060 22061 22062 22063 22064 22065 22066 22067 22068 22069 22070 22071 22072 22073 22074 22075 22076 22077 22078 22079 22080 22081 22082 22083 22084 22085 22086 22087 22088 22089 22090 22091 22092 22093 22094 22095 22096 22097 22098 22099 22100 22101 22102 22103 22104 22105 22106 22107 22108 22109 22110 22111 22112 22113 22114 22115 22116 22117 22118 22119 22120 22121 22122 22123 22124 22125 22126 22127 22128 22129 22130 22131 22132 22133 22134 22135 22136 22137 22138 22139 22140 22141 22142 22143 22144 22145 22146 22147 22148 22149 22150 22151 22152 22153 22154 22155 22156 22157 22158 22159 22160 22161 22162 22163 22164 22165 22166 22167 22168 22169 22170 22171 22172 22173 22174 22175 22176 22177 22178 22179 22180 22181 22182 22183 22184 22185 22186 22187 22188 22189 22190 22191 22192 22193 22194 22195 22196 22197 22198 22199 22200 22201 22202 22203 22204 22205 22206 22207 22208 22209 22210 22211 22212 22213 22214 22215 22216 22217 22218 22219 22220 22221 22222 22223 22224 22225 22226 22227 22228 22229 22230 22231 22232 22233 22234 22235 22236 22237 22238 22239 22240 22241 22242 22243 22244 22245 22246 22247 22248 22249 22250 22251 22252 22253 22254 22255 22256 22257 22258 22259 22260 22261 22262 22263 22264 22265 22266 22267 22268 22269 22270 22271 22272 22273 22274 22275 22276 22277 22278 22279 22280 22281 22282 22283 22284 22285 22286 22287 22288 22289 22290 22291 22292 22293 22294 22295 22296 22297 22298 22299 22300 22301 22302 22303 22304 22305 22306 22307 22308 22309 22310 22311 22312 22313 22314 22315 22316 22317 22318 22319 22320 22321 22322 22323 22324 22325 22326 22327 22328 22329 22330 22331 22332 22333 22334 22335 22336 22337 22338 22339 22340 22341 22342 22343 22344 22345 22346 22347 22348 22349 22350 22351 22352 22353 22354 22355 22356 22357 22358 22359 22360 22361 22362 22363 22364 22365 22366 22367 22368 22369 22370 22371 22372 22373 22374 22375 22376 22377 22378 22379 22380 22381 22382 22383 22384 22385 22386 22387 22388 22389 22390 22391 22392 22393 22394 22395 22396 22397 22398 22399 22400 22401 22402 22403 22404 22405 22406 22407 22408 22409 22410 22411 22412 22413 22414 22415 22416 22417 22418 22419 22420 22421 22422 22423 22424 22425 22426 22427 22428 22429 22430 22431 22432 22433 22434 22435 22436 22437 22438 22439 22440 22441 22442 22443 22444 22445 22446 22447 22448 22449 22450 22451 22452 22453 22454 22455 22456 22457 22458 22459 22460 22461 22462 22463 22464 22465 22466 22467 22468 22469 22470 22471 22472 22473 22474 22475 22476 22477 22478 22479 22480 22481 22482 22483 22484 22485 22486 22487 22488 22489 22490 22491 22492 22493 22494 22495 22496 22497 22498 22499 22500 22501 22502 22503 22504 22505 22506 22507 22508 22509 22510 22511 22512 22513 22514 22515 22516 22517 22518 22519 22520 22521 22522 22523 22524 22525 22526 22527 22528 22529 22530 22531 22532 22533 22534 22535 22536 22537 22538 22539 22540 22541 22542 22543 22544 22545 22546 22547 22548 22549 22550 22551 22552 22553 22554 22555 22556 22557 22558 22559 22560 22561 22562 22563 22564 22565 22566 22567 22568 22569 22570 22571 22572 22573 22574 22575 22576 22577 22578 22579 22580 22581 22582 22583 22584 22585 22586 22587 22588 22589 22590 22591 22592 22593 22594 22595 22596 22597 22598 22599 22600 22601 22602 22603 22604 22605 22606 22607 22608 22609 22610 22611 22612 22613 22614 22615 22616 22617 22618 22619 22620 22621 22622 22623 22624 22625 22626 22627 22628 22629 22630 22631 22632 22633 22634 22635 22636 22637 22638 22639 22640 22641 22642 22643 22644 22645 22646 22647 22648 22649 22650 22651 22652 22653 22654 22655 22656 22657 22658 22659 22660 22661 22662 22663 22664 22665 22666 22667 22668 22669 22670 22671 22672 22673 22674 22675 22676 22677 22678 22679 22680 22681 22682 22683 22684 22685 22686 22687 22688 22689 22690 22691 22692 22693 22694 22695 22696 22697 22698 22699 22700 22701 22702 22703 22704 22705 22706 22707 22708 22709 22710 22711 22712 22713 22714 22715 22716 22717 22718 22719 22720 22721 22722 22723 22724 22725 22726 22727 22728 22729 22730 22731 22732 22733 22734 22735 22736 22737 22738 22739 22740 22741 22742 22743 22744 22745 22746 22747 22748 22749 22750 22751 22752 22753 22754 22755 22756 22757 22758 22759 22760 22761 22762 22763 22764 22765 22766 22767 22768 22769 22770 22771 22772 22773 22774 22775 22776 22777 22778 22779 22780 22781 22782 22783 22784 22785 22786 22787 22788 22789 22790 22791 22792 22793 22794 22795 22796 22797 22798 22799 22800 22801 22802 22803 22804 22805 22806 22807 22808 22809 22810 22811 22812 22813 22814 22815 22816 22817 22818 22819 22820 22821 22822 22823 22824 22825 22826 22827 22828 22829 22830 22831 22832 22833 22834 22835 22836 22837 22838 22839 22840 22841 22842 22843 22844 22845 22846 22847 22848 22849 22850 22851 22852 22853 22854 22855 22856 22857 22858 22859 22860 22861 22862 22863 22864 22865 22866 22867 22868 22869 22870 22871 22872 22873 22874 22875 22876 22877 22878 22879 22880 22881 22882 22883 22884 22885 22886 22887 22888 22889 22890 22891 22892 22893 22894 22895 22896 22897 22898 22899 22900 22901 22902 22903 22904 22905 22906 22907 22908 22909 22910 22911 22912 22913 22914 22915 22916 22917 22918 22919 22920 22921 22922 22923 22924 22925 22926 22927 22928 22929 22930 22931 22932 22933 22934 22935 22936 22937 22938 22939 22940 22941 22942 22943 22944 22945 22946 22947 22948 22949 22950 22951 22952 22953 22954 22955 22956 22957 22958 22959 22960 22961 22962 22963 22964 22965 22966 22967 22968 22969 22970 22971 22972 22973 22974 22975 22976 22977 22978 22979 22980 22981 22982 22983 22984 22985 22986 22987 22988 22989 22990 22991 22992 22993 22994 22995 22996 22997 22998 22999 23000 23001 23002 23003 23004 23005 23006 23007 23008 23009 23010 23011 23012 23013 23014 23015 23016 23017 23018 23019 23020 23021 23022 23023 23024 23025 23026 23027 23028 23029 23030 23031 23032 23033 23034 23035 23036 23037 23038 23039 23040 23041 23042 23043 23044 23045 23046 23047 23048 23049 23050 23051 23052 23053 23054 23055 23056 23057 23058 23059 23060 23061 23062 23063 23064 23065 23066 23067 23068 23069 23070 23071 23072 23073 23074 23075 23076 23077 23078 23079 23080 23081 23082 23083 23084 23085 23086 23087 23088 23089 23090 23091 23092 23093 23094 23095 23096 23097 23098 23099 23100 23101 23102 23103 23104 23105 23106 23107 23108 23109 23110 23111 23112 23113 23114 23115 23116 23117 23118 23119 23120 23121 23122 23123 23124 23125 23126 23127 23128 23129 23130 23131 23132 23133 23134 23135 23136 23137 23138 23139 23140 23141 23142 23143 23144 23145 23146 23147 23148 23149 23150 23151 23152 23153 23154 23155 23156 23157 23158 23159 23160 23161 23162 23163 23164 23165 23166 23167 23168 23169 23170 23171 23172 23173 23174 23175 23176 23177 23178 23179 23180 23181 23182 23183 23184 23185 23186 23187 23188 23189 23190 23191 23192 23193 23194 23195 23196 23197 23198 23199 23200 23201 23202 23203 23204 23205 23206 23207 23208 23209 23210 23211 23212 23213 23214 23215 23216 23217 23218 23219 23220 23221 23222 23223 23224 23225 23226 23227 23228 23229 23230 23231 23232 23233 23234 23235 23236 23237 23238 23239 23240 23241 23242 23243 23244 23245 23246 23247 23248 23249 23250 23251 23252 23253 23254 23255 23256 23257 23258 23259 23260 23261 23262 23263 23264 23265 23266 23267 23268 23269 23270 23271 23272 23273 23274 23275 23276 23277 23278 23279 23280 23281 23282 23283 23284 23285 23286 23287 23288 23289 23290 23291 23292 23293 23294 23295 23296 23297 23298 23299 23300 23301 23302 23303 23304 23305 23306 23307 23308 23309 23310 23311 23312 23313 23314 23315 23316 23317 23318 23319 23320 23321 23322 23323 23324 23325 23326 23327 23328 23329 23330 23331 23332 23333 23334 23335 23336 23337 23338 23339 23340 23341 23342 23343 23344 23345 23346 23347 23348 23349 23350 23351 23352 23353 23354 23355 23356 23357 23358 23359 23360 23361 23362 23363 23364 23365 23366 23367 23368 23369 23370 23371 23372 23373 23374 23375 23376 23377 23378 23379 23380 23381 23382 23383 23384 23385 23386 23387 23388 23389 23390 23391 23392 23393 23394 23395 23396 23397 23398 23399 23400 23401 23402 23403 23404 23405 23406 23407 23408 23409 23410 23411 23412 23413 23414 23415 23416 23417 23418 23419 23420 23421 23422 23423 23424 23425 23426 23427 23428 23429 23430 23431 23432 23433 23434 23435 23436 23437 23438 23439 23440 23441 23442 23443 23444 23445 23446 23447 23448 23449 23450 23451 23452 23453 23454 23455 23456 23457 23458 23459 23460 23461 23462 23463 23464 23465 23466 23467 23468 23469 23470 23471 23472 23473 23474 23475 23476 23477 23478 23479 23480 23481 23482 23483 23484 23485 23486 23487 23488 23489 23490 23491 23492 23493 23494 23495 23496 23497 23498 23499 23500 23501 23502 23503 23504 23505 23506 23507 23508 23509 23510 23511 23512 23513 23514 23515 23516 23517 23518 23519 23520 23521 23522 23523 23524 23525 23526 23527 23528 23529 23530 23531 23532 23533 23534 23535 23536 23537 23538 23539 23540 23541 23542 23543 23544 23545 23546 23547 23548 23549 23550 23551 23552 23553 23554 23555 23556 23557 23558 23559 23560 23561 23562 23563 23564 23565 23566 23567 23568 23569 23570 23571 23572 23573 23574 23575 23576 23577 23578 23579 23580 23581 23582 23583 23584 23585 23586 23587 23588 23589 23590 23591 23592 23593 23594 23595 23596 23597 23598 23599 23600 23601 23602 23603 23604 23605 23606 23607 23608 23609 23610 23611 23612 23613 23614 23615 23616 23617 23618 23619 23620 23621 23622 23623 23624 23625 23626 23627 23628 23629 23630 23631 23632 23633 23634 23635 23636 23637 23638 23639 23640 23641 23642 23643 23644 23645 23646 23647 23648 23649 23650 23651 23652 23653 23654 23655 23656 23657 23658 23659 23660 23661 23662 23663 23664 23665 23666 23667 23668 23669 23670 23671 23672 23673 23674 23675 23676 23677 23678 23679 23680 23681 23682 23683 23684 23685 23686 23687 23688 23689 23690 23691 23692 23693 23694 23695 23696 23697 23698 23699 23700 23701 23702 23703 23704 23705 23706 23707 23708 23709 23710 23711 23712 23713 23714 23715 23716 23717 23718 23719 23720 23721 23722 23723 23724 23725 23726 23727 23728 23729 23730 23731 23732 23733 23734 23735 23736 23737 23738 23739 23740 23741 23742 23743 23744 23745 23746 23747 23748 23749 23750 23751 23752 23753 23754 23755 23756 23757 23758 23759 23760 23761 23762 23763 23764 23765 23766 23767 23768 23769 23770 23771 23772 23773 23774 23775 23776 23777 23778 23779 23780 23781 23782 23783 23784 23785 23786 23787 23788 23789 23790 23791 23792 23793 23794 23795 23796 23797 23798 23799 23800 23801 23802 23803 23804 23805 23806 23807 23808 23809 23810 23811 23812 23813 23814 23815 23816 23817 23818 23819 23820 23821 23822 23823 23824 23825 23826 23827 23828 23829 23830 23831 23832 23833 23834 23835 23836 23837 23838 23839 23840 23841 23842 23843 23844 23845 23846 23847 23848 23849 23850 23851 23852 23853 23854 23855 23856 23857 23858 23859 23860 23861 23862 23863 23864 23865 23866 23867 23868 23869 23870 23871 23872 23873 23874 23875 23876 23877 23878 23879 23880 23881 23882 23883 23884 23885 23886 23887 23888 23889 23890 23891 23892 23893 23894 23895 23896 23897 23898 23899 23900 23901 23902 23903 23904 23905 23906 23907 23908 23909 23910 23911 23912 23913 23914 23915 23916 23917 23918 23919 23920 23921 23922 23923 23924 23925 23926 23927 23928 23929 23930 23931 23932 23933 23934 23935 23936 23937 23938 23939 23940 23941 23942 23943 23944 23945 23946 23947 23948 23949 23950 23951 23952 23953 23954 23955 23956 23957 23958 23959 23960 23961 23962 23963 23964 23965 23966 23967 23968 23969 23970 23971 23972 23973 23974 23975 23976 23977 23978 23979 23980 23981 23982 23983 23984 23985 23986 23987 23988 23989 23990 23991 23992 23993 23994 23995 23996 23997 23998 23999 24000 24001 24002 24003 24004 24005 24006 24007 24008 24009 24010 24011 24012 24013 24014 24015 24016 24017 24018 24019 24020 24021 24022 24023 24024 24025 24026 24027 24028 24029 24030 24031 24032 24033 24034 24035 24036 24037 24038 24039 24040 24041 24042 24043 24044 24045 24046 24047 24048 24049 24050 24051 24052 24053 24054 24055 24056 24057 24058 24059 24060 24061 24062 24063 24064 24065 24066 24067 24068 24069 24070 24071 24072 24073 24074 24075 24076 24077 24078 24079 24080 24081 24082 24083 24084 24085 24086 24087 24088 24089 24090 24091 24092 24093 24094 24095 24096 24097 24098 24099 24100 24101 24102 24103 24104 24105 24106 24107 24108 24109 24110 24111 24112 24113 24114 24115 24116 24117 24118 24119 24120 24121 24122 24123 24124 24125 24126 24127 24128 24129 24130 24131 24132 24133 24134 24135 24136 24137 24138 24139 24140 24141 24142 24143 24144 24145 24146 24147 24148 24149 24150 24151 24152 24153 24154 24155 24156 24157 24158 24159 24160 24161 24162 24163 24164 24165 24166 24167 24168 24169 24170 24171 24172 24173 24174 24175 24176 24177 24178 24179 24180 24181 24182 24183 24184 24185 24186 24187 24188 24189 24190 24191 24192 24193 24194 24195 24196 24197 24198 24199 24200 24201 24202 24203 24204 24205 24206 24207 24208 24209 24210 24211 24212 24213 24214 24215 24216 24217 24218 24219 24220 24221 24222 24223 24224 24225 24226 24227 24228 24229 24230 24231 24232 24233 24234 24235 24236 24237 24238 24239 24240 24241 24242 24243 24244 24245 24246 24247 24248 24249 24250 24251 24252 24253 24254 24255 24256 24257 24258 24259 24260 24261 24262 24263 24264 24265 24266 24267 24268 24269 24270 24271 24272 24273 24274 24275 24276 24277 24278 24279 24280 24281 24282 24283 24284 24285 24286 24287 24288 24289 24290 24291 24292 24293 24294 24295 24296 24297 24298 24299 24300 24301 24302 24303 24304 24305 24306 24307 24308 24309 24310 24311 24312 24313 24314 24315 24316 24317 24318 24319 24320 24321 24322 24323 24324 24325 24326 24327 24328 24329 24330 24331 24332 24333 24334 24335 24336 24337 24338 24339 24340 24341 24342 24343 24344 24345 24346 24347 24348 24349 24350 24351 24352 24353 24354 24355 24356 24357 24358 24359 24360 24361 24362 24363 24364 24365 24366 24367 24368 24369 24370 24371 24372 24373 24374 24375 24376 24377 24378 24379 24380 24381 24382 24383 24384 24385 24386 24387 24388 24389 24390 24391 24392 24393 24394 24395 24396 24397 24398 24399 24400 24401 24402 24403 24404 24405 24406 24407 24408 24409 24410 24411 24412 24413 24414 24415 24416 24417 24418 24419 24420 24421 24422 24423 24424 24425 24426 24427 24428 24429 24430 24431 24432 24433 24434 24435 24436 24437 24438 24439 24440 24441 24442 24443 24444 24445 24446 24447 24448 24449 24450 24451 24452 24453 24454 24455 24456 24457 24458 24459 24460 24461 24462 24463 24464 24465 24466 24467 24468 24469 24470 24471 24472 24473 24474 24475 24476 24477 24478 24479 24480 24481 24482 24483 24484 24485 24486 24487 24488 24489 24490 24491 24492 24493 24494 24495 24496 24497 24498 24499 24500 24501 24502 24503 24504 24505 24506 24507 24508 24509 24510 24511 24512 24513 24514 24515 24516 24517 24518 24519 24520 24521 24522 24523 24524 24525 24526 24527 24528 24529 24530 24531 24532 24533 24534 24535 24536 24537 24538 24539 24540 24541 24542 24543 24544 24545 24546 24547 24548 24549 24550 24551 24552 24553 24554 24555 24556 24557 24558 24559 24560 24561 24562 24563 24564 24565 24566 24567 24568 24569 24570 24571 24572 24573 24574 24575 24576 24577 24578 24579 24580 24581 24582 24583 24584 24585 24586 24587 24588 24589 24590 24591 24592 24593 24594 24595 24596 24597 24598 24599 24600 24601 24602 24603 24604 24605 24606 24607 24608 24609 24610 24611 24612 24613 24614 24615 24616 24617 24618 24619 24620 24621 24622 24623 24624 24625 24626 24627 24628 24629 24630 24631 24632 24633 24634 24635 24636 24637 24638 24639 24640 24641 24642 24643 24644 24645 24646 24647 24648 24649 24650 24651 24652 24653 24654 24655 24656 24657 24658 24659 24660 24661 24662 24663 24664 24665 24666 24667 24668 24669 24670 24671 24672 24673 24674 24675 24676 24677 24678 24679 24680 24681 24682 24683 24684 24685 24686 24687 24688 24689 24690 24691 24692 24693 24694 24695 24696 24697 24698 24699 24700 24701 24702 24703 24704 24705 24706 24707 24708 24709 24710 24711 24712 24713 24714 24715 24716 24717 24718 24719 24720 24721 24722 24723 24724 24725 24726 24727 24728 24729 24730 24731 24732 24733 24734 24735 24736 24737 24738 24739 24740 24741 24742 24743 24744 24745 24746 24747 24748 24749 24750 24751 24752 24753 24754 24755 24756 24757 24758 24759 24760 24761 24762 24763 24764 24765 24766 24767 24768 24769 24770 24771 24772 24773 24774 24775 24776 24777 24778 24779 24780 24781 24782 24783 24784 24785 24786 24787 24788 24789 24790 24791 24792 24793 24794 24795 24796 24797 24798 24799 24800 24801 24802 24803 24804 24805 24806 24807 24808 24809 24810 24811 24812 24813 24814 24815 24816 24817 24818 24819 24820 24821 24822 24823 24824 24825 24826 24827 24828 24829 24830 24831 24832 24833 24834 24835 24836 24837 24838 24839 24840 24841 24842 24843 24844 24845 24846 24847 24848 24849 24850 24851 24852 24853 24854 24855 24856 24857 24858 24859 24860 24861 24862 24863 24864 24865 24866 24867 24868 24869 24870 24871 24872 24873 24874 24875 24876 24877 24878 24879 24880 24881 24882 24883 24884 24885 24886 24887 24888 24889 24890 24891 24892 24893 24894 24895 24896 24897 24898 24899 24900 24901 24902 24903 24904 24905 24906 24907 24908 24909 24910 24911 24912 24913 24914 24915 24916 24917 24918 24919 24920 24921 24922 24923 24924 24925 24926 24927 24928 24929 24930 24931 24932 24933 24934 24935 24936 24937 24938 24939 24940 24941 24942 24943 24944 24945 24946 24947 24948 24949 24950 24951 24952 24953 24954 24955 24956 24957 24958 24959 24960 24961 24962 24963 24964 24965 24966 24967 24968 24969 24970 24971 24972 24973 24974 24975 24976 24977 24978 24979 24980 24981 24982 24983 24984 24985 24986 24987 24988 24989 24990 24991 24992 24993 24994 24995 24996 24997 24998 24999 25000 25001 25002 25003 25004 25005 25006 25007 25008 25009 25010 25011 25012 25013 25014 25015 25016 25017 25018 25019 25020 25021 25022 25023 25024 25025 25026 25027 25028 25029 25030 25031 25032 25033 25034 25035 25036 25037 25038 25039 25040 25041 25042 25043 25044 25045 25046 25047 25048 25049 25050 25051 25052 25053 25054 25055 25056 25057 25058 25059 25060 25061 25062 25063 25064 25065 25066 25067 25068 25069 25070 25071 25072 25073 25074 25075 25076 25077 25078 25079 25080 25081 25082 25083 25084 25085 25086 25087 25088 25089 25090 25091 25092 25093 25094 25095 25096 25097 25098 25099 25100 25101 25102 25103 25104 25105 25106 25107 25108 25109 25110 25111 25112 25113 25114 25115 25116 25117 25118 25119 25120 25121 25122 25123 25124 25125 25126 25127 25128 25129 25130 25131 25132 25133 25134 25135 25136 25137 25138 25139 25140 25141 25142 25143 25144 25145 25146 25147 25148 25149 25150 25151 25152 25153 25154 25155 25156 25157 25158 25159 25160 25161 25162 25163 25164 25165 25166 25167 25168 25169 25170 25171 25172 25173 25174 25175 25176 25177 25178 25179 25180 25181 25182 25183 25184 25185 25186 25187 25188 25189 25190 25191 25192 25193 25194 25195 25196 25197 25198 25199 25200 25201 25202 25203 25204 25205 25206 25207 25208 25209 25210 25211 25212 25213 25214 25215 25216 25217 25218 25219 25220 25221 25222 25223 25224 25225 25226 25227 25228 25229 25230 25231 25232 25233 25234 25235 25236 25237 25238 25239 25240 25241 25242 25243 25244 25245 25246 25247 25248 25249 25250 25251 25252 25253 25254 25255 25256 25257 25258 25259 25260 25261 25262 25263 25264 25265 25266 25267 25268 25269 25270 25271 25272 25273 25274 25275 25276 25277 25278 25279 25280 25281 25282 25283 25284 25285 25286 25287 25288 25289 25290 25291 25292 25293 25294 25295 25296 25297 25298 25299 25300 25301 25302 25303 25304 25305 25306 25307 25308 25309 25310 25311 25312 25313 25314 25315 25316 25317 25318 25319 25320 25321 25322 25323 25324 25325 25326 25327 25328 25329 25330 25331 25332 25333 25334 25335 25336 25337 25338 25339 25340 25341 25342 25343 25344 25345 25346 25347 25348 25349 25350 25351 25352 25353 25354 25355 25356 25357 25358 25359 25360 25361 25362 25363 25364 25365 25366 25367 25368 25369 25370 25371 25372 25373 25374 25375 25376 25377 25378 25379 25380 25381 25382 25383 25384 25385 25386 25387 25388 25389 25390 25391 25392 25393 25394 25395 25396 25397 25398 25399 25400 25401 25402 25403 25404 25405 25406 25407 25408 25409 25410 25411 25412 25413 25414 25415 25416 25417 25418 25419 25420 25421 25422 25423 25424 25425 25426 25427 25428 25429 25430 25431 25432 25433 25434 25435 25436 25437 25438 25439 25440 25441 25442 25443 25444 25445 25446 25447 25448 25449 25450 25451 25452 25453 25454 25455 25456 25457 25458 25459 25460 25461 25462 25463 25464 25465 25466 25467 25468 25469 25470 25471 25472 25473 25474 25475 25476 25477 25478 25479 25480 25481 25482 25483 25484 25485 25486 25487 25488 25489 25490 25491 25492 25493 25494 25495 25496 25497 25498 25499 25500 25501 25502 25503 25504 25505 25506 25507 25508 25509 25510 25511 25512 25513 25514 25515 25516 25517 25518 25519 25520 25521 25522 25523 25524 25525 25526 25527 25528 25529 25530 25531 25532 25533 25534 25535 25536 25537 25538 25539 25540 25541 25542 25543 25544 25545 25546 25547 25548 25549 25550 25551 25552 25553 25554 25555 25556 25557 25558 25559 25560 25561 25562 25563 25564 25565 25566 25567 25568 25569 25570 25571 25572 25573 25574 25575 25576 25577 25578 25579 25580 25581 25582 25583 25584 25585 25586 25587 25588 25589 25590 25591 25592 25593 25594 25595 25596 25597 25598 25599 25600 25601 25602 25603 25604 25605 25606 25607 25608 25609 25610 25611 25612 25613 25614 25615 25616 25617 25618 25619 25620 25621 25622 25623 25624 25625 25626 25627 25628 25629 25630 25631 25632 25633 25634 25635 25636 25637 25638 25639 25640 25641 25642 25643 25644 25645 25646 25647 25648 25649 25650 25651 25652 25653 25654 25655 25656 25657 25658 25659 25660 25661 25662 25663 25664 25665 25666 25667 25668 25669 25670 25671 25672 25673 25674 25675 25676 25677 25678 25679 25680 25681 25682 25683 25684 25685 25686 25687 25688 25689 25690 25691 25692 25693 25694 25695 25696 25697 25698 25699 25700 25701 25702 25703 25704 25705 25706 25707 25708 25709 25710 25711 25712 25713 25714 25715 25716 25717 25718 25719 25720 25721 25722 25723 25724 25725 25726 25727 25728 25729 25730 25731 25732 25733 25734 25735 25736 25737 25738 25739 25740 25741 25742 25743 25744 25745 25746 25747 25748 25749 25750 25751 25752 25753 25754 25755 25756 25757 25758 25759 25760 25761 25762 25763 25764 25765 25766 25767 25768 25769 25770 25771 25772 25773 25774 25775 25776 25777 25778 25779 25780 25781 25782 25783 25784 25785 25786 25787 25788 25789 25790 25791 25792 25793 25794 25795 25796 25797 25798 25799 25800 25801 25802 25803 25804 25805 25806 25807 25808 25809 25810 25811 25812 25813 25814 25815 25816 25817 25818 25819 25820 25821 25822 25823 25824 25825 25826 25827 25828 25829 25830 25831 25832 25833 25834 25835 25836 25837 25838 25839 25840 25841 25842 25843 25844 25845 25846 25847 25848 25849 25850 25851 25852 25853 25854 25855 25856 25857 25858 25859 25860 25861 25862 25863 25864 25865 25866 25867 25868 25869 25870 25871 25872 25873 25874 25875 25876 25877 25878 25879 25880 25881 25882 25883 25884 25885 25886 25887 25888 25889 25890 25891 25892 25893 25894 25895 25896 25897 25898 25899 25900 25901 25902 25903 25904 25905 25906 25907 25908 25909 25910 25911 25912 25913 25914 25915 25916 25917 25918 25919 25920 25921 25922 25923 25924 25925 25926 25927 25928 25929 25930 25931 25932 25933 25934 25935 25936 25937 25938 25939 25940 25941 25942 25943 25944 25945 25946 25947 25948 25949 25950 25951 25952 25953 25954 25955 25956 25957 25958 25959 25960 25961 25962 25963 25964 25965 25966 25967 25968 25969 25970 25971 25972 25973 25974 25975 25976 25977 25978 25979 25980 25981 25982 25983 25984 25985 25986 25987 25988 25989 25990 25991 25992 25993 25994 25995 25996 25997 25998 25999 26000 26001 26002 26003 26004 26005 26006 26007 26008 26009 26010 26011 26012 26013 26014 26015 26016 26017 26018 26019 26020 26021 26022 26023 26024 26025 26026 26027 26028 26029 26030 26031 26032 26033 26034 26035 26036 26037 26038 26039 26040 26041 26042 26043 26044 26045 26046 26047 26048 26049 26050 26051 26052 26053 26054 26055 26056 26057 26058 26059 26060 26061 26062 26063 26064 26065 26066 26067 26068 26069 26070 26071 26072 26073 26074 26075 26076 26077 26078 26079 26080 26081 26082 26083 26084 26085 26086 26087 26088 26089 26090 26091 26092 26093 26094 26095 26096 26097 26098 26099 26100 26101 26102 26103 26104 26105 26106 26107 26108 26109 26110 26111 26112 26113 26114 26115 26116 26117 26118 26119 26120 26121 26122 26123 26124 26125 26126 26127 26128 26129 26130 26131 26132 26133 26134 26135 26136 26137 26138 26139 26140 26141 26142 26143 26144 26145 26146 26147 26148 26149 26150 26151 26152 26153 26154 26155 26156 26157 26158 26159 26160 26161 26162 26163 26164 26165 26166 26167 26168 26169 26170 26171 26172 26173 26174 26175 26176 26177 26178 26179 26180 26181 26182 26183 26184 26185 26186 26187 26188 26189 26190 26191 26192 26193 26194 26195 26196 26197 26198 26199 26200 26201 26202 26203 26204 26205 26206 26207 26208 26209 26210 26211 26212 26213 26214 26215 26216 26217 26218 26219 26220 26221 26222 26223 26224 26225 26226 26227 26228 26229 26230 26231 26232 26233 26234 26235 26236 26237 26238 26239 26240 26241 26242 26243 26244 26245 26246 26247 26248 26249 26250 26251 26252 26253 26254 26255 26256 26257 26258 26259 26260 26261 26262 26263 26264 26265 26266 26267 26268 26269 26270 26271 26272 26273 26274 26275 26276 26277 26278 26279 26280 26281 26282 26283 26284 26285 26286 26287 26288 26289 26290 26291 26292 26293 26294 26295 26296 26297 26298 26299 26300 26301 26302 26303 26304 26305 26306 26307 26308 26309 26310 26311 26312 26313 26314 26315 26316 26317 26318 26319 26320 26321 26322 26323 26324 26325 26326 26327 26328 26329 26330 26331 26332 26333 26334 26335 26336 26337 26338 26339 26340 26341 26342 26343 26344 26345 26346 26347 26348 26349 26350 26351 26352 26353 26354 26355 26356 26357 26358 26359 26360 26361 26362 26363 26364 26365 26366 26367 26368 26369 26370 26371 26372 26373 26374 26375 26376 26377 26378 26379 26380 26381 26382 26383 26384 26385 26386 26387 26388 26389 26390 26391 26392 26393 26394 26395 26396 26397 26398 26399 26400 26401 26402 26403 26404 26405 26406 26407 26408 26409 26410 26411 26412 26413 26414 26415 26416 26417 26418 26419 26420 26421 26422 26423 26424 26425 26426 26427 26428 26429 26430 26431 26432 26433 26434 26435 26436 26437 26438 26439 26440 26441 26442 26443 26444 26445 26446 26447 26448 26449 26450 26451 26452 26453 26454 26455 26456 26457 26458 26459 26460 26461 26462 26463 26464 26465 26466 26467 26468 26469 26470 26471 26472 26473 26474 26475 26476 26477 26478 26479 26480 26481 26482 26483 26484 26485 26486 26487 26488 26489 26490 26491 26492 26493 26494 26495 26496 26497 26498 26499 26500 26501 26502 26503 26504 26505 26506 26507 26508 26509 26510 26511 26512 26513 26514 26515 26516 26517 26518 26519 26520 26521 26522 26523 26524 26525 26526 26527 26528 26529 26530 26531 26532 26533 26534 26535 26536 26537 26538 26539 26540 26541 26542 26543 26544 26545 26546 26547 26548 26549 26550 26551 26552 26553 26554 26555 26556 26557 26558 26559 26560 26561 26562 26563 26564 26565 26566 26567 26568 26569 26570 26571 26572 26573 26574 26575 26576 26577 26578 26579 26580 26581 26582 26583 26584 26585 26586 26587 26588 26589 26590 26591 26592 26593 26594 26595 26596 26597 26598 26599 26600 26601 26602 26603 26604 26605 26606 26607 26608 26609 26610 26611 26612 26613 26614 26615 26616 26617 26618 26619 26620 26621 26622 26623 26624 26625 26626 26627 26628 26629 26630 26631 26632 26633 26634 26635 26636 26637 26638 26639 26640 26641 26642 26643 26644 26645 26646 26647 26648 26649 26650 26651 26652 26653 26654 26655 26656 26657 26658 26659 26660 26661 26662 26663 26664 26665 26666 26667 26668 26669 26670 26671 26672 26673 26674 26675 26676 26677 26678 26679 26680 26681 26682 26683 26684 26685 26686 26687 26688 26689 26690 26691 26692 26693 26694 26695 26696 26697 26698 26699 26700 26701 26702 26703 26704 26705 26706 26707 26708 26709 26710 26711 26712 26713 26714 26715 26716 26717 26718 26719 26720 26721 26722 26723 26724 26725 26726 26727 26728 26729 26730 26731 26732 26733 26734 26735 26736 26737 26738 26739 26740 26741 26742 26743 26744 26745 26746 26747 26748 26749 26750 26751 26752 26753 26754 26755 26756 26757 26758 26759 26760 26761 26762 26763 26764 26765 26766 26767 26768 26769 26770 26771 26772 26773 26774 26775 26776 26777 26778 26779 26780 26781 26782 26783 26784 26785 26786 26787 26788 26789 26790 26791 26792 26793 26794 26795 26796 26797 26798 26799 26800 26801 26802 26803 26804 26805 26806 26807 26808 26809 26810 26811 26812 26813 26814 26815 26816 26817 26818 26819 26820 26821 26822 26823 26824 26825 26826 26827 26828 26829 26830 26831 26832 26833 26834 26835 26836 26837 26838 26839 26840 26841 26842 26843 26844 26845 26846 26847 26848 26849 26850 26851 26852 26853 26854 26855 26856 26857 26858 26859 26860 26861 26862 26863 26864 26865 26866 26867 26868 26869 26870 26871 26872 26873 26874 26875 26876 26877 26878 26879 26880 26881 26882 26883 26884 26885 26886 26887 26888 26889 26890 26891 26892 26893 26894 26895 26896 26897 26898 26899 26900 26901 26902 26903 26904 26905 26906 26907 26908 26909 26910 26911 26912 26913 26914 26915 26916 26917 26918 26919 26920 26921 26922 26923 26924 26925 26926 26927 26928 26929 26930 26931 26932 26933 26934 26935 26936 26937 26938 26939 26940 26941 26942 26943 26944 26945 26946 26947 26948 26949 26950 26951 26952 26953 26954 26955 26956 26957 26958 26959 26960 26961 26962 26963 26964 26965 26966 26967 26968 26969 26970 26971 26972 26973 26974 26975 26976 26977 26978 26979 26980 26981 26982 26983 26984 26985 26986 26987 26988 26989 26990 26991 26992 26993 26994 26995 26996 26997 26998 26999 27000 27001 27002 27003 27004 27005 27006 27007 27008 27009 27010 27011 27012 27013 27014 27015 27016 27017 27018 27019 27020 27021 27022 27023 27024 27025 27026 27027 27028 27029 27030 27031 27032 27033 27034 27035 27036 27037 27038 27039 27040 27041 27042 27043 27044 27045 27046 27047 27048 27049 27050 27051 27052 27053 27054 27055 27056 27057 27058 27059 27060 27061 27062 27063 27064 27065 27066 27067 27068 27069 27070 27071 27072 27073 27074 27075 27076 27077 27078 27079 27080 27081 27082 27083 27084 27085 27086 27087 27088 27089 27090 27091 27092 27093 27094 27095 27096 27097 27098 27099 27100 27101 27102 27103 27104 27105 27106 27107 27108 27109 27110 27111 27112 27113 27114 27115 27116 27117 27118 27119 27120 27121 27122 27123 27124 27125 27126 27127 27128 27129 27130 27131 27132 27133 27134 27135 27136 27137 27138 27139 27140 27141 27142 27143 27144 27145 27146 27147 27148 27149 27150 27151 27152 27153 27154 27155 27156 27157 27158 27159 27160 27161 27162 27163 27164 27165 27166 27167 27168 27169 27170 27171 27172 27173 27174 27175 27176 27177 27178 27179 27180 27181 27182 27183 27184 27185 27186 27187 27188 27189 27190 27191 27192 27193 27194 27195 27196 27197 27198 27199 27200 27201 27202 27203 27204 27205 27206 27207 27208 27209 27210 27211 27212 27213 27214 27215 27216 27217 27218 27219 27220 27221 27222 27223 27224 27225 27226 27227 27228 27229 27230 27231 27232 27233 27234 27235 27236 27237 27238 27239 27240 27241 27242 27243 27244 27245 27246 27247 27248 27249 27250 27251 27252 27253 27254 27255 27256 27257 27258 27259 27260 27261 27262 27263 27264 27265 27266 27267 27268 27269 27270 27271 27272 27273 27274 27275 27276 27277 27278 27279 27280 27281 27282 27283 27284 27285 27286 27287 27288 27289 27290 27291 27292 27293 27294 27295 27296 27297 27298 27299 27300 27301 27302 27303 27304 27305 27306 27307 27308 27309 27310 27311 27312 27313 27314 27315 27316 27317 27318 27319 27320 27321 27322 27323 27324 27325 27326 27327 27328 27329 27330 27331 27332 27333 27334 27335 27336 27337 27338 27339 27340 27341 27342 27343 27344 27345 27346 27347 27348 27349 27350 27351 27352 27353 27354 27355 27356 27357 27358 27359 27360 27361 27362 27363 27364 27365 27366 27367 27368 27369 27370 27371 27372 27373 27374 27375 27376 27377 27378 27379 27380 27381 27382 27383 27384 27385 27386 27387 27388 27389 27390 27391 27392 27393 27394 27395 27396 27397 27398 27399 27400 27401 27402 27403 27404 27405 27406 27407 27408 27409 27410 27411 27412 27413 27414 27415 27416 27417 27418 27419 27420 27421 27422 27423 27424 27425 27426 27427 27428 27429 27430 27431 27432 27433 27434 27435 27436 27437 27438 27439 27440 27441 27442 27443 27444 27445 27446 27447 27448 27449 27450 27451 27452 27453 27454 27455 27456 27457 27458 27459 27460 27461 27462 27463 27464 27465 27466 27467 27468 27469 27470 27471 27472 27473 27474 27475 27476 27477 27478 27479 27480 27481 27482 27483 27484 27485 27486 27487 27488 27489 27490 27491 27492 27493 27494 27495 27496 27497 27498 27499 27500 27501 27502 27503 27504 27505 27506 27507 27508 27509 27510 27511 27512 27513 27514 27515 27516 27517 27518 27519 27520 27521 27522 27523 27524 27525 27526 27527 27528 27529 27530 27531 27532 27533 27534 27535 27536 27537 27538 27539 27540 27541 27542 27543 27544 27545 27546 27547 27548 27549 27550 27551 27552 27553 27554 27555 27556 27557 27558 27559 27560 27561 27562 27563 27564 27565 27566 27567 27568 27569 27570 27571 27572 27573 27574 27575 27576 27577 27578 27579 27580 27581 27582 27583 27584 27585 27586 27587 27588 27589 27590 27591 27592 27593 27594 27595 27596 27597 27598 27599 27600 27601 27602 27603 27604 27605 27606 27607 27608 27609 27610 27611 27612 27613 27614 27615 27616 27617 27618 27619 27620 27621 27622 27623 27624 27625 27626 27627 27628 27629 27630 27631 27632 27633 27634 27635 27636 27637 27638 27639 27640 27641 27642 27643 27644 27645 27646 27647 27648 27649 27650 27651 27652 27653 27654 27655 27656 27657 27658 27659 27660 27661 27662 27663 27664 27665 27666 27667 27668 27669 27670 27671 27672 27673 27674 27675 27676 27677 27678 27679 27680 27681 27682 27683 27684 27685 27686 27687 27688 27689 27690 27691 27692 27693 27694 27695 27696 27697 27698 27699 27700 27701 27702 27703 27704 27705 27706 27707 27708 27709 27710 27711 27712 27713 27714 27715 27716 27717 27718 27719 27720 27721 27722 27723 27724 27725 27726 27727 27728 27729 27730 27731 27732 27733 27734 27735 27736 27737 27738 27739 27740 27741 27742 27743 27744 27745 27746 27747 27748 27749 27750 27751 27752 27753 27754 27755 27756 27757 27758 27759 27760 27761 27762 27763 27764 27765 27766 27767 27768 27769 27770 27771 27772 27773 27774 27775 27776 27777 27778 27779 27780 27781 27782 27783 27784 27785 27786 27787 27788 27789 27790 27791 27792 27793 27794 27795 27796 27797 27798 27799 27800 27801 27802 27803 27804 27805 27806 27807 27808 27809 27810 27811 27812 27813 27814 27815 27816 27817 27818 27819 27820 27821 27822 27823 27824 27825 27826 27827 27828 27829 27830 27831 27832 27833 27834 27835 27836 27837 27838 27839 27840 27841 27842 27843 27844 27845 27846 27847 27848 27849 27850 27851 27852 27853 27854 27855 27856 27857 27858 27859 27860 27861 27862 27863 27864 27865 27866 27867 27868 27869 27870 27871 27872 27873 27874 27875 27876 27877 27878 27879 27880 27881 27882 27883 27884 27885 27886 27887 27888 27889 27890 27891 27892 27893 27894 27895 27896 27897 27898 27899 27900 27901 27902 27903 27904 27905 27906 27907 27908 27909 27910 27911 27912 27913 27914 27915 27916 27917 27918 27919 27920 27921 27922 27923 27924 27925 27926 27927 27928 27929 27930 27931 27932 27933 27934 27935 27936 27937 27938 27939 27940 27941 27942 27943 27944 27945 27946 27947 27948 27949 27950 27951 27952 27953 27954 27955 27956 27957 27958 27959 27960 27961 27962 27963 27964 27965 27966 27967 27968 27969 27970 27971 27972 27973 27974 27975 27976 27977 27978 27979 27980 27981 27982 27983 27984 27985 27986 27987 27988 27989 27990 27991 27992 27993 27994 27995 27996 27997 27998 27999 28000 28001 28002 28003 28004 28005 28006 28007 28008 28009 28010 28011 28012 28013 28014 28015 28016 28017 28018 28019 28020 28021 28022 28023 28024 28025 28026 28027 28028 28029 28030 28031 28032 28033 28034 28035 28036 28037 28038 28039 28040 28041 28042 28043 28044 28045 28046 28047 28048 28049 28050 28051 28052 28053 28054 28055 28056 28057 28058 28059 28060 28061 28062 28063 28064 28065 28066 28067 28068 28069 28070 28071 28072 28073 28074 28075 28076 28077 28078 28079 28080 28081 28082 28083 28084 28085 28086 28087 28088 28089 28090 28091 28092 28093 28094 28095 28096 28097 28098 28099 28100 28101 28102 28103 28104 28105 28106 28107 28108 28109 28110 28111 28112 28113 28114 28115 28116 28117 28118 28119 28120 28121 28122 28123 28124 28125 28126 28127 28128 28129 28130 28131 28132 28133 28134 28135 28136 28137 28138 28139 28140 28141 28142 28143 28144 28145 28146 28147 28148 28149 28150 28151 28152 28153 28154 28155 28156 28157 28158 28159 28160 28161 28162 28163 28164 28165 28166 28167 28168 28169 28170 28171 28172 28173 28174 28175 28176 28177 28178 28179 28180 28181 28182 28183 28184 28185 28186 28187 28188 28189 28190 28191 28192 28193 28194 28195 28196 28197 28198 28199 28200 28201 28202 28203 28204 28205 28206 28207 28208 28209 28210 28211 28212 28213 28214 28215 28216 28217 28218 28219 28220 28221 28222 28223 28224 28225 28226 28227 28228 28229 28230 28231 28232 28233 28234 28235 28236 28237 28238 28239 28240 28241 28242 28243 28244 28245 28246 28247 28248 28249 28250 28251 28252 28253 28254 28255 28256 28257 28258 28259 28260 28261 28262 28263 28264 28265 28266 28267 28268 28269 28270 28271 28272 28273 28274 28275 28276 28277 28278 28279 28280 28281 28282 28283 28284 28285 28286 28287 28288 28289 28290 28291 28292 28293 28294 28295 28296 28297 28298 28299 28300 28301 28302 28303 28304 28305 28306 28307 28308 28309 28310 28311 28312 28313 28314 28315 28316 28317 28318 28319 28320 28321 28322 28323 28324 28325 28326 28327 28328 28329 28330 28331 28332 28333 28334 28335 28336 28337 28338 28339 28340 28341 28342 28343 28344 28345 28346 28347 28348 28349 28350 28351 28352 28353 28354 28355 28356 28357 28358 28359 28360 28361 28362 28363 28364 28365 28366 28367 28368 28369 28370 28371 28372 28373 28374 28375 28376 28377 28378 28379 28380 28381 28382 28383 28384 28385 28386 28387 28388 28389 28390 28391 28392 28393 28394 28395 28396 28397 28398 28399 28400 28401 28402 28403 28404 28405 28406 28407 28408 28409 28410 28411 28412 28413 28414 28415 28416 28417 28418 28419 28420 28421 28422 28423 28424 28425 28426 28427 28428 28429 28430 28431 28432 28433 28434 28435 28436 28437 28438 28439 28440 28441 28442 28443 28444 28445 28446 28447 28448 28449 28450 28451 28452 28453 28454 28455 28456 28457 28458 28459 28460 28461 28462 28463 28464 28465 28466 28467 28468 28469 28470 28471 28472 28473 28474 28475 28476 28477 28478 28479 28480 28481 28482 28483 28484 28485 28486 28487 28488 28489 28490 28491 28492 28493 28494 28495 28496 28497 28498 28499 28500 28501 28502 28503 28504 28505 28506 28507 28508 28509 28510 28511 28512 28513 28514 28515 28516 28517 28518 28519 28520 28521 28522 28523 28524 28525 28526 28527 28528 28529 28530 28531 28532 28533 28534 28535 28536 28537 28538 28539 28540 28541 28542 28543 28544 28545 28546 28547 28548 28549 28550 28551 28552 28553 28554 28555 28556 28557 28558 28559 28560 28561 28562 28563 28564 28565 28566 28567 28568 28569 28570 28571 28572 28573 28574 28575 28576 28577 28578 28579 28580 28581 28582 28583 28584 28585 28586 28587 28588 28589 28590 28591 28592 28593 28594 28595 28596 28597 28598 28599 28600 28601 28602 28603 28604 28605 28606 28607 28608 28609 28610 28611 28612 28613 28614 28615 28616 28617 28618 28619 28620 28621 28622 28623 28624 28625 28626 28627 28628 28629 28630 28631 28632 28633 28634 28635 28636 28637 28638 28639 28640 28641 28642 28643 28644 28645 28646 28647 28648 28649 28650 28651 28652 28653 28654 28655 28656 28657 28658 28659 28660 28661 28662 28663 28664 28665 28666 28667 28668 28669 28670 28671 28672 28673 28674 28675 28676 28677 28678 28679 28680 28681 28682 28683 28684 28685 28686 28687 28688 28689 28690 28691 28692 28693 28694 28695 28696 28697 28698 28699 28700 28701 28702 28703 28704 28705 28706 28707 28708 28709 28710 28711 28712 28713 28714 28715 28716 28717 28718 28719 28720 28721 28722 28723 28724 28725 28726 28727 28728 28729 28730 28731 28732 28733 28734 28735 28736 28737 28738 28739 28740 28741 28742 28743 28744 28745 28746 28747 28748 28749 28750 28751 28752 28753 28754 28755 28756 28757 28758 28759 28760 28761 28762 28763 28764 28765 28766 28767 28768 28769 28770 28771 28772 28773 28774 28775 28776 28777 28778 28779 28780 28781 28782 28783 28784 28785 28786 28787 28788 28789 28790 28791 28792 28793 28794 28795 28796 28797 28798 28799 28800 28801 28802 28803 28804 28805 28806 28807 28808 28809 28810 28811 28812 28813 28814 28815 28816 28817 28818 28819 28820 28821 28822 28823 28824 28825 28826 28827 28828 28829 28830 28831 28832 28833 28834 28835 28836 28837 28838 28839 28840 28841 28842 28843 28844 28845 28846 28847 28848 28849 28850 28851 28852 28853 28854 28855 28856 28857 28858 28859 28860 28861 28862 28863 28864 28865 28866 28867 28868 28869 28870 28871 28872 28873 28874 28875 28876 28877 28878 28879 28880 28881 28882 28883 28884 28885 28886 28887 28888 28889 28890 28891 28892 28893 28894 28895 28896 28897 28898 28899 28900 28901 28902 28903 28904 28905 28906 28907 28908 28909 28910 28911 28912 28913 28914 28915 28916 28917 28918 28919 28920 28921 28922 28923 28924 28925 28926 28927 28928 28929 28930 28931 28932 28933 28934 28935 28936 28937 28938 28939 28940 28941 28942 28943 28944 28945 28946 28947 28948 28949 28950 28951 28952 28953 28954 28955 28956 28957 28958 28959 28960 28961 28962 28963 28964 28965 28966 28967 28968 28969 28970 28971 28972 28973 28974 28975 28976 28977 28978 28979 28980 28981 28982 28983 28984 28985 28986 28987 28988 28989 28990 28991 28992 28993 28994 28995 28996 28997 28998 28999 29000 29001 29002 29003 29004 29005 29006 29007 29008 29009 29010 29011 29012 29013 29014 29015 29016 29017 29018 29019 29020 29021 29022 29023 29024 29025 29026 29027 29028 29029 29030 29031 29032 29033 29034 29035 29036 29037 29038 29039 29040 29041 29042 29043 29044 29045 29046 29047 29048 29049 29050 29051 29052 29053 29054 29055 29056 29057 29058 29059 29060 29061 29062 29063 29064 29065 29066 29067 29068 29069 29070 29071 29072 29073 29074 29075 29076 29077 29078 29079 29080 29081 29082 29083 29084 29085 29086 29087 29088 29089 29090 29091 29092 29093 29094 29095 29096 29097 29098 29099 29100 29101 29102 29103 29104 29105 29106 29107 29108 29109 29110 29111 29112 29113 29114 29115 29116 29117 29118 29119 29120 29121 29122 29123 29124 29125 29126 29127 29128 29129 29130 29131 29132 29133 29134 29135 29136 29137 29138 29139 29140 29141 29142 29143 29144 29145 29146 29147 29148 29149 29150 29151 29152 29153 29154 29155 29156 29157 29158 29159 29160 29161 29162 29163 29164 29165 29166 29167 29168 29169 29170 29171 29172 29173 29174 29175 29176 29177 29178 29179 29180 29181 29182 29183 29184 29185 29186 29187 29188 29189 29190 29191 29192 29193 29194 29195 29196 29197 29198 29199 29200 29201 29202 29203 29204 29205 29206 29207 29208 29209 29210 29211 29212 29213 29214 29215 29216 29217 29218 29219 29220 29221 29222 29223 29224 29225 29226 29227 29228 29229 29230 29231 29232 29233 29234 29235 29236 29237 29238 29239 29240 29241 29242 29243 29244 29245 29246 29247 29248 29249 29250 29251 29252 29253 29254 29255 29256 29257 29258 29259 29260 29261 29262 29263 29264 29265 29266 29267 29268 29269 29270 29271 29272 29273 29274 29275 29276 29277 29278 29279 29280 29281 29282 29283 29284 29285 29286 29287 29288 29289 29290 29291 29292 29293 29294 29295 29296 29297 29298 29299 29300 29301 29302 29303 29304 29305 29306 29307 29308 29309 29310 29311 29312 29313 29314 29315 29316 29317 29318 29319 29320 29321 29322 29323 29324 29325 29326 29327 29328 29329 29330 29331 29332 29333 29334 29335 29336 29337 29338 29339 29340 29341 29342 29343 29344 29345 29346 29347 29348 29349 29350 29351 29352 29353 29354 29355 29356 29357 29358 29359 29360 29361 29362 29363 29364 29365 29366 29367 29368 29369 29370 29371 29372 29373 29374 29375 29376 29377 29378 29379 29380 29381 29382 29383 29384 29385 29386 29387 29388 29389 29390 29391 29392 29393 29394 29395 29396 29397 29398 29399 29400 29401 29402 29403 29404 29405 29406 29407 29408 29409 29410 29411 29412 29413 29414 29415 29416 29417 29418 29419 29420 29421 29422 29423 29424 29425 29426 29427 29428 29429 29430 29431 29432 29433 29434 29435 29436 29437 29438 29439 29440 29441 29442 29443 29444 29445 29446 29447 29448 29449 29450 29451 29452 29453 29454 29455 29456 29457 29458 29459 29460 29461 29462 29463 29464 29465 29466 29467 29468 29469 29470 29471 29472 29473 29474 29475 29476 29477 29478 29479 29480 29481 29482 29483 29484 29485 29486 29487 29488 29489 29490 29491 29492 29493 29494 29495 29496 29497 29498 29499 29500 29501 29502 29503 29504 29505 29506 29507 29508 29509 29510 29511 29512 29513 29514 29515 29516 29517 29518 29519 29520 29521 29522 29523 29524 29525 29526 29527 29528 29529 29530 29531 29532 29533 29534 29535 29536 29537 29538 29539 29540 29541 29542 29543 29544 29545 29546 29547 29548 29549 29550 29551 29552 29553 29554 29555 29556 29557 29558 29559 29560 29561 29562 29563 29564 29565 29566 29567 29568 29569 29570 29571 29572 29573 29574 29575 29576 29577 29578 29579 29580 29581 29582 29583 29584 29585 29586 29587 29588 29589 29590 29591 29592 29593 29594 29595 29596 29597 29598 29599 29600 29601 29602 29603 29604 29605 29606 29607 29608 29609 29610 29611 29612 29613 29614 29615 29616 29617 29618 29619 29620 29621 29622 29623 29624 29625 29626 29627 29628 29629 29630 29631 29632 29633 29634 29635 29636 29637 29638 29639 29640 29641 29642 29643 29644 29645 29646 29647 29648 29649 29650 29651 29652 29653 29654 29655 29656 29657 29658 29659 29660 29661 29662 29663 29664 29665 29666 29667 29668 29669 29670 29671 29672 29673 29674 29675 29676 29677 29678 29679 29680 29681 29682 29683 29684 29685 29686 29687 29688 29689 29690 29691 29692 29693 29694 29695 29696 29697 29698 29699 29700 29701 29702 29703 29704 29705 29706 29707 29708 29709 29710 29711 29712 29713 29714 29715 29716 29717 29718 29719 29720 29721 29722 29723 29724 29725 29726 29727 29728 29729 29730 29731 29732 29733 29734 29735 29736 29737 29738 29739 29740 29741 29742 29743 29744 29745 29746 29747 29748 29749 29750 29751 29752 29753 29754 29755 29756 29757 29758 29759 29760 29761 29762 29763 29764 29765 29766 29767 29768 29769 29770 29771 29772 29773 29774 29775 29776 29777 29778 29779 29780 29781 29782 29783 29784 29785 29786 29787 29788 29789 29790 29791 29792 29793 29794 29795 29796 29797 29798 29799 29800 29801 29802 29803 29804 29805 29806 29807 29808 29809 29810 29811 29812 29813 29814 29815 29816 29817 29818 29819 29820 29821 29822 29823 29824 29825 29826 29827 29828 29829 29830 29831 29832 29833 29834 29835 29836 29837 29838 29839 29840 29841 29842 29843 29844 29845 29846 29847 29848 29849 29850 29851 29852 29853 29854 29855 29856 29857 29858 29859 29860 29861 29862 29863 29864 29865 29866 29867 29868 29869 29870 29871 29872 29873 29874 29875 29876 29877 29878 29879 29880 29881 29882 29883 29884 29885 29886 29887 29888 29889 29890 29891 29892 29893 29894 29895 29896 29897 29898 29899 29900 29901 29902 29903 29904 29905 29906 29907 29908 29909 29910 29911 29912 29913 29914 29915 29916 29917 29918 29919 29920 29921 29922 29923 29924 29925 29926 29927 29928 29929 29930 29931 29932 29933 29934 29935 29936 29937 29938 29939 29940 29941 29942 29943 29944 29945 29946 29947 29948 29949 29950 29951 29952 29953 29954 29955 29956 29957 29958 29959 29960 29961 29962 29963 29964 29965 29966 29967 29968 29969 29970 29971 29972 29973 29974 29975 29976 29977 29978 29979 29980 29981 29982 29983 29984 29985 29986 29987 29988 29989 29990 29991 29992 29993 29994 29995 29996 29997 29998 29999 30000 30001 30002 30003 30004 30005 30006 30007 30008 30009 30010 30011 30012 30013 30014 30015 30016 30017 30018 30019 30020 30021 30022 30023 30024 30025 30026 30027 30028 30029 30030 30031 30032 30033 30034 30035 30036 30037 30038 30039 30040 30041 30042 30043 30044 30045 30046 30047 30048 30049 30050 30051 30052 30053 30054 30055 30056 30057 30058 30059 30060 30061 30062 30063 30064 30065 30066 30067 30068 30069 30070 30071 30072 30073 30074 30075 30076 30077 30078 30079 30080 30081 30082 30083 30084 30085 30086 30087 30088 30089 30090 30091 30092 30093 30094 30095 30096 30097 30098 30099 30100 30101 30102 30103 30104 30105 30106 30107 30108 30109 30110 30111 30112 30113 30114 30115 30116 30117 30118 30119 30120 30121 30122 30123 30124 30125 30126 30127 30128 30129 30130 30131 30132 30133 30134 30135 30136 30137 30138 30139 30140 30141 30142 30143 30144 30145 30146 30147 30148 30149 30150 30151 30152 30153 30154 30155 30156 30157 30158 30159 30160 30161 30162 30163 30164 30165 30166 30167 30168 30169 30170 30171 30172 30173 30174 30175 30176 30177 30178 30179 30180 30181 30182 30183 30184 30185 30186 30187 30188 30189 30190 30191 30192 30193 30194 30195 30196 30197 30198 30199 30200 30201 30202 30203 30204 30205 30206 30207 30208 30209 30210 30211 30212 30213 30214 30215 30216 30217 30218 30219 30220 30221 30222 30223 30224 30225 30226 30227 30228 30229 30230 30231 30232 30233 30234 30235 30236 30237 30238 30239 30240 30241 30242 30243 30244 30245 30246 30247 30248 30249 30250 30251 30252 30253 30254 30255 30256 30257 30258 30259 30260 30261 30262 30263 30264 30265 30266 30267 30268 30269 30270 30271 30272 30273 30274 30275 30276 30277 30278 30279 30280 30281 30282 30283 30284 30285 30286 30287 30288 30289 30290 30291 30292 30293 30294 30295 30296 30297 30298 30299 30300 30301 30302 30303 30304 30305 30306 30307 30308 30309 30310 30311 30312 30313 30314 30315 30316 30317 30318 30319 30320 30321 30322 30323 30324 30325 30326 30327 30328 30329 30330 30331 30332 30333 30334 30335 30336 30337 30338 30339 30340 30341 30342 30343 30344 30345 30346 30347 30348 30349 30350 30351 30352 30353 30354 30355 30356 30357 30358 30359 30360 30361 30362 30363 30364 30365 30366 30367 30368 30369 30370 30371 30372 30373 30374 30375 30376 30377 30378 30379 30380 30381 30382 30383 30384 30385 30386 30387 30388 30389 30390 30391 30392 30393 30394 30395 30396 30397 30398 30399 30400 30401 30402 30403 30404 30405 30406 30407 30408 30409 30410 30411 30412 30413 30414 30415 30416 30417 30418 30419 30420 30421 30422 30423 30424 30425 30426 30427 30428 30429 30430 30431 30432 30433 30434 30435 30436 30437 30438 30439 30440 30441 30442 30443 30444 30445 30446 30447 30448 30449 30450 30451 30452 30453 30454 30455 30456 30457 30458 30459 30460 30461 30462 30463 30464 30465 30466 30467 30468 30469 30470 30471 30472 30473 30474 30475 30476 30477 30478 30479 30480 30481 30482 30483 30484 30485 30486 30487 30488 30489 30490 30491 30492 30493 30494 30495 30496 30497 30498 30499 30500 30501 30502 30503 30504 30505 30506 30507 30508 30509 30510 30511 30512 30513 30514 30515 30516 30517 30518 30519 30520 30521 30522 30523 30524 30525 30526 30527 30528 30529 30530 30531 30532 30533 30534 30535 30536 30537 30538 30539 30540 30541 30542 30543 30544 30545 30546 30547 30548 30549 30550 30551 30552 30553 30554 30555 30556 30557 30558 30559 30560 30561 30562 30563 30564 30565 30566 30567 30568 30569 30570 30571 30572 30573 30574 30575 30576 30577 30578 30579 30580 30581 30582 30583 30584 30585 30586 30587 30588 30589 30590 30591 30592 30593 30594 30595 30596 30597 30598 30599 30600 30601 30602 30603 30604 30605 30606 30607 30608 30609 30610 30611 30612 30613 30614 30615 30616 30617 30618 30619 30620 30621 30622 30623 30624 30625 30626 30627 30628 30629 30630 30631 30632 30633 30634 30635 30636 30637 30638 30639 30640 30641 30642 30643 30644 30645 30646 30647 30648 30649 30650 30651 30652 30653 30654 30655 30656 30657 30658 30659 30660 30661 30662 30663 30664 30665 30666 30667 30668 30669 30670 30671 30672 30673 30674 30675 30676 30677 30678 30679 30680 30681 30682 30683 30684 30685 30686 30687 30688 30689 30690 30691 30692 30693 30694 30695 30696 30697 30698 30699 30700 30701 30702 30703 30704 30705 30706 30707 30708 30709 30710 30711 30712 30713 30714 30715 30716 30717 30718 30719 30720 30721 30722 30723 30724 30725 30726 30727 30728 30729 30730 30731 30732 30733 30734 30735 30736 30737 30738 30739 30740 30741 30742 30743 30744 30745 30746 30747 30748 30749 30750 30751 30752 30753 30754 30755 30756 30757 30758 30759 30760 30761 30762 30763 30764 30765 30766 30767 30768 30769 30770 30771 30772 30773 30774 30775 30776 30777 30778 30779 30780 30781 30782 30783 30784 30785 30786 30787 30788 30789 30790 30791 30792 30793 30794 30795 30796 30797 30798 30799 30800 30801 30802 30803 30804 30805 30806 30807 30808 30809 30810 30811 30812 30813 30814 30815 30816 30817 30818 30819 30820 30821 30822 30823 30824 30825 30826 30827 30828 30829 30830 30831 30832 30833 30834 30835 30836 30837 30838 30839 30840 30841 30842 30843 30844 30845 30846 30847 30848 30849 30850 30851 30852 30853 30854 30855 30856 30857 30858 30859 30860 30861 30862 30863 30864 30865 30866 30867 30868 30869 30870 30871 30872 30873 30874 30875 30876 30877 30878 30879 30880 30881 30882 30883 30884 30885 30886 30887 30888 30889 30890 30891 30892 30893 30894 30895 30896 30897 30898 30899 30900 30901 30902 30903 30904 30905 30906 30907 30908 30909 30910 30911 30912 30913 30914 30915 30916 30917 30918 30919 30920 30921 30922 30923 30924 30925 30926 30927 30928 30929 30930 30931 30932 30933 30934 30935 30936 30937 30938 30939 30940 30941 30942 30943 30944 30945 30946 30947 30948 30949 30950 30951 30952 30953 30954 30955 30956 30957 30958 30959 30960 30961 30962 30963 30964 30965 30966 30967 30968 30969 30970 30971 30972 30973 30974 30975 30976 30977 30978 30979 30980 30981 30982 30983 30984 30985 30986 30987 30988 30989 30990 30991 30992 30993 30994 30995 30996 30997 30998 30999 31000 31001 31002 31003 31004 31005 31006 31007 31008 31009 31010 31011 31012 31013 31014 31015 31016 31017 31018 31019 31020 31021 31022 31023 31024 31025 31026 31027 31028 31029 31030 31031 31032 31033 31034 31035 31036 31037 31038 31039 31040 31041 31042 31043 31044 31045 31046 31047 31048 31049 31050 31051 31052 31053 31054 31055 31056 31057 31058 31059 31060 31061 31062 31063 31064 31065 31066 31067 31068 31069 31070 31071 31072 31073 31074 31075 31076 31077 31078 31079 31080 31081 31082 31083 31084 31085 31086 31087 31088 31089 31090 31091 31092 31093 31094 31095 31096 31097 31098 31099 31100 31101 31102 31103 31104 31105 31106 31107 31108 31109 31110 31111 31112 31113 31114 31115 31116 31117 31118 31119 31120 31121 31122 31123 31124 31125 31126 31127 31128 31129 31130 31131 31132 31133 31134 31135 31136 31137 31138 31139 31140 31141 31142 31143 31144 31145 31146 31147 31148 31149 31150 31151 31152 31153 31154 31155 31156 31157 31158 31159 31160 31161 31162 31163 31164 31165 31166 31167 31168 31169 31170 31171 31172 31173 31174 31175 31176 31177 31178 31179 31180 31181 31182 31183 31184 31185 31186 31187 31188 31189 31190 31191 31192 31193 31194 31195 31196 31197 31198 31199 31200 31201 31202 31203 31204 31205 31206 31207 31208 31209 31210 31211 31212 31213 31214 31215 31216 31217 31218 31219 31220 31221 31222 31223 31224 31225 31226 31227 31228 31229 31230 31231 31232 31233 31234 31235 31236 31237 31238 31239 31240 31241 31242 31243 31244 31245 31246 31247 31248 31249 31250 31251 31252 31253 31254 31255 31256 31257 31258 31259 31260 31261 31262 31263 31264 31265 31266 31267 31268 31269 31270 31271 31272 31273 31274 31275 31276 31277 31278 31279 31280 31281 31282 31283 31284 31285 31286 31287 31288 31289 31290 31291 31292 31293 31294 31295 31296 31297 31298 31299 31300 31301 31302 31303 31304 31305 31306 31307 31308 31309 31310 31311 31312 31313 31314 31315 31316 31317 31318 31319 31320 31321 31322 31323 31324 31325 31326 31327 31328 31329 31330 31331 31332 31333 31334 31335 31336 31337 31338 31339 31340 31341 31342 31343 31344 31345 31346 31347 31348 31349 31350 31351 31352 31353 31354 31355 31356 31357 31358 31359 31360 31361 31362 31363 31364 31365 31366 31367 31368 31369 31370 31371 31372 31373 31374 31375 31376 31377 31378 31379 31380 31381 31382 31383 31384 31385 31386 31387 31388 31389 31390 31391 31392 31393 31394 31395 31396 31397 31398 31399 31400 31401 31402 31403 31404 31405 31406 31407 31408 31409 31410 31411 31412 31413 31414 31415 31416 31417 31418 31419 31420 31421 31422 31423 31424 31425 31426 31427 31428 31429 31430 31431 31432 31433 31434 31435 31436 31437 31438 31439 31440 31441 31442 31443 31444 31445 31446 31447 31448 31449 31450 31451 31452 31453 31454 31455 31456 31457 31458 31459 31460 31461 31462 31463 31464 31465 31466 31467 31468 31469 31470 31471 31472 31473 31474 31475 31476 31477 31478 31479 31480 31481 31482 31483 31484 31485 31486 31487 31488 31489 31490 31491 31492 31493 31494 31495 31496 31497 31498 31499 31500 31501 31502 31503 31504 31505 31506 31507 31508 31509 31510 31511 31512 31513 31514 31515 31516 31517 31518 31519 31520 31521 31522 31523 31524 31525 31526 31527 31528 31529 31530 31531 31532 31533 31534 31535 31536 31537 31538 31539 31540 31541 31542 31543 31544 31545 31546 31547 31548 31549 31550 31551 31552 31553 31554 31555 31556 31557 31558 31559 31560 31561 31562 31563 31564 31565 31566 31567 31568 31569 31570 31571 31572 31573 31574 31575 31576 31577 31578 31579 31580 31581 31582 31583 31584 31585 31586 31587 31588 31589 31590 31591 31592 31593 31594 31595 31596 31597 31598 31599 31600 31601 31602 31603 31604 31605 31606 31607 31608 31609 31610 31611 31612 31613 31614 31615 31616 31617 31618 31619 31620 31621 31622 31623 31624 31625 31626 31627 31628 31629 31630 31631 31632 31633 31634 31635 31636 31637 31638 31639 31640 31641 31642 31643 31644 31645 31646 31647 31648 31649 31650 31651 31652 31653 31654 31655 31656 31657 31658 31659 31660 31661 31662 31663 31664 31665 31666 31667 31668 31669 31670 31671 31672 31673 31674 31675 31676 31677 31678 31679 31680 31681 31682 31683 31684 31685 31686 31687 31688 31689 31690 31691 31692 31693 31694 31695 31696 31697 31698 31699 31700 31701 31702 31703 31704 31705 31706 31707 31708 31709 31710 31711 31712 31713 31714 31715 31716 31717 31718 31719 31720 31721 31722 31723 31724 31725 31726 31727 31728 31729 31730 31731 31732 31733 31734 31735 31736 31737 31738 31739 31740 31741 31742 31743 31744 31745 31746 31747 31748 31749 31750 31751 31752 31753 31754 31755 31756 31757 31758 31759 31760 31761 31762 31763 31764 31765 31766 31767 31768 31769 31770 31771 31772 31773 31774 31775 31776 31777 31778 31779 31780 31781 31782 31783 31784 31785 31786 31787 31788 31789 31790 31791 31792 31793 31794 31795 31796 31797 31798 31799 31800 31801 31802 31803 31804 31805 31806 31807 31808 31809 31810 31811 31812 31813 31814 31815 31816 31817 31818 31819 31820 31821 31822 31823 31824 31825 31826 31827 31828 31829 31830 31831 31832 31833 31834 31835 31836 31837 31838 31839 31840 31841 31842 31843 31844 31845 31846 31847 31848 31849 31850 31851 31852 31853 31854 31855 31856 31857 31858 31859 31860 31861 31862 31863 31864 31865 31866 31867 31868 31869 31870 31871 31872 31873 31874 31875 31876 31877 31878 31879 31880 31881 31882 31883 31884 31885 31886 31887 31888 31889 31890 31891 31892 31893 31894 31895 31896 31897 31898 31899 31900 31901 31902 31903 31904 31905 31906 31907 31908 31909 31910 31911 31912 31913 31914 31915 31916 31917 31918 31919 31920 31921 31922 31923 31924 31925 31926 31927 31928 31929 31930 31931 31932 31933 31934 31935 31936 31937 31938 31939 31940 31941 31942 31943 31944 31945 31946 31947 31948 31949 31950 31951 31952 31953 31954 31955 31956 31957 31958 31959 31960 31961 31962 31963 31964 31965 31966 31967 31968 31969 31970 31971 31972 31973 31974 31975 31976 31977 31978 31979 31980 31981 31982 31983 31984 31985 31986 31987 31988 31989 31990 31991 31992 31993 31994 31995 31996 31997 31998 31999 32000 32001 32002 32003 32004 32005 32006 32007 32008 32009 32010 32011 32012 32013 32014 32015 32016 32017 32018 32019 32020 32021 32022 32023 32024 32025 32026 32027 32028 32029 32030 32031 32032 32033 32034 32035 32036 32037 32038 32039 32040 32041 32042 32043 32044 32045 32046 32047 32048 32049 32050 32051 32052 32053 32054 32055 32056 32057 32058 32059 32060 32061 32062 32063 32064 32065 32066 32067 32068 32069 32070 32071 32072 32073 32074 32075 32076 32077 32078 32079 32080 32081 32082 32083 32084 32085 32086 32087 32088 32089 32090 32091 32092 32093 32094 32095 32096 32097 32098 32099 32100 32101 32102 32103 32104 32105 32106 32107 32108 32109 32110 32111 32112 32113 32114 32115 32116 32117 32118 32119 32120 32121 32122 32123 32124 32125 32126 32127 32128 32129 32130 32131 32132 32133 32134 32135 32136 32137 32138 32139 32140 32141 32142 32143 32144 32145 32146 32147 32148 32149 32150 32151 32152 32153 32154 32155 32156 32157 32158 32159 32160 32161 32162 32163 32164 32165 32166 32167 32168 32169 32170 32171 32172 32173 32174 32175 32176 32177 32178 32179 32180 32181 32182 32183 32184 32185 32186 32187 32188 32189 32190 32191 32192 32193 32194 32195 32196 32197 32198 32199 32200 32201 32202 32203 32204 32205 32206 32207 32208 32209 32210 32211 32212 32213 32214 32215 32216 32217 32218 32219 32220 32221 32222 32223 32224 32225 32226 32227 32228 32229 32230 32231 32232 32233 32234 32235 32236 32237 32238 32239 32240 32241 32242 32243 32244 32245 32246 32247 32248 32249 32250 32251 32252 32253 32254 32255 32256 32257 32258 32259 32260 32261 32262 32263 32264 32265 32266 32267 32268 32269 32270 32271 32272 32273 32274 32275 32276 32277 32278 32279 32280 32281 32282 32283 32284 32285 32286 32287 32288 32289 32290 32291 32292 32293 32294 32295 32296 32297 32298 32299 32300 32301 32302 32303 32304 32305 32306 32307 32308 32309 32310 32311 32312 32313 32314 32315 32316 32317 32318 32319 32320 32321 32322 32323 32324 32325 32326 32327 32328 32329 32330 32331 32332 32333 32334 32335 32336 32337 32338 32339 32340 32341 32342 32343 32344 32345 32346 32347 32348 32349 32350 32351 32352 32353 32354 32355 32356 32357 32358 32359 32360 32361 32362 32363 32364 32365 32366 32367 32368 32369 32370 32371 32372 32373 32374 32375 32376 32377 32378 32379 32380 32381 32382 32383 32384 32385 32386 32387 32388 32389 32390 32391 32392 32393 32394 32395 32396 32397 32398 32399 32400 32401 32402 32403 32404 32405 32406 32407 32408 32409 32410 32411 32412 32413 32414 32415 32416 32417 32418 32419 32420 32421 32422 32423 32424 32425 32426 32427 32428 32429 32430 32431 32432 32433 32434 32435 32436 32437 32438 32439 32440 32441 32442 32443 32444 32445 32446 32447 32448 32449 32450 32451 32452 32453 32454 32455 32456 32457 32458 32459 32460 32461 32462 32463 32464 32465 32466 32467 32468 32469 32470 32471 32472 32473 32474 32475 32476 32477 32478 32479 32480 32481 32482 32483 32484 32485 32486 32487 32488 32489 32490 32491 32492 32493 32494 32495 32496 32497 32498 32499 32500 32501 32502 32503 32504 32505 32506 32507 32508 32509 32510 32511 32512 32513 32514 32515 32516 32517 32518 32519 32520 32521 32522 32523 32524 32525 32526 32527 32528 32529 32530 32531 32532 32533 32534 32535 32536 32537 32538 32539 32540 32541 32542 32543 32544 32545 32546 32547 32548 32549 32550 32551 32552 32553 32554 32555 32556 32557 32558 32559 32560 32561 32562 32563 32564 32565 32566 32567 32568 32569 32570 32571 32572 32573 32574 32575 32576 32577 32578 32579 32580 32581 32582 32583 32584 32585 32586 32587 32588 32589 32590 32591 32592 32593 32594 32595 32596 32597 32598 32599 32600 32601 32602 32603 32604 32605 32606 32607 32608 32609 32610 32611 32612 32613 32614 32615 32616 32617 32618 32619 32620 32621 32622 32623 32624 32625 32626 32627 32628 32629 32630 32631 32632 32633 32634 32635 32636 32637 32638 32639 32640 32641 32642 32643 32644 32645 32646 32647 32648 32649 32650 32651 32652 32653 32654 32655 32656 32657 32658 32659 32660 32661 32662 32663 32664 32665 32666 32667 32668 32669 32670 32671 32672 32673 32674 32675 32676 32677 32678 32679 32680 32681 32682 32683 32684 32685 32686 32687 32688 32689 32690 32691 32692 32693 32694 32695 32696 32697 32698 32699 32700 32701 32702 32703 32704 32705 32706 32707 32708 32709 32710 32711 32712 32713 32714 32715 32716 32717 32718 32719 32720 32721 32722 32723 32724 32725 32726 32727 32728 32729 32730 32731 32732 32733 32734 32735 32736 32737 32738 32739 32740 32741 32742 32743 32744 32745 32746 32747 32748 32749 32750 32751 32752 32753 32754 32755 32756 32757 32758 32759 32760 32761 32762 32763 32764 32765 32766 32767 32768 32769 32770 32771 32772 32773 32774 32775 32776 32777 32778 32779 32780 32781 32782 32783 32784 32785 32786 32787 32788 32789 32790 32791 32792 32793 32794 32795 32796 32797 32798 32799 32800 32801 32802 32803 32804 32805 32806 32807 32808 32809 32810 32811 32812 32813 32814 32815 32816 32817 32818 32819 32820 32821 32822 32823 32824 32825 32826 32827 32828 32829 32830 32831 32832 32833 32834 32835 32836 32837 32838 32839 32840 32841 32842 32843 32844 32845 32846 32847 32848 32849 32850 32851 32852 32853 32854 32855 32856 32857 32858 32859 32860 32861 32862 32863 32864 32865 32866 32867 32868 32869 32870 32871 32872 32873 32874 32875 32876 32877 32878 32879 32880 32881 32882 32883 32884 32885 32886 32887 32888 32889 32890 32891 32892 32893 32894 32895 32896 32897 32898 32899 32900 32901 32902 32903 32904 32905 32906 32907 32908 32909 32910 32911 32912 32913 32914 32915 32916 32917 32918 32919 32920 32921 32922 32923 32924 32925 32926 32927 32928 32929 32930 32931 32932 32933 32934 32935 32936 32937 32938 32939 32940 32941 32942 32943 32944 32945 32946 32947 32948 32949 32950 32951 32952 32953 32954 32955 32956 32957 32958 32959 32960 32961 32962 32963 32964 32965 32966 32967 32968 32969 32970 32971 32972 32973 32974 32975 32976 32977 32978 32979 32980 32981 32982 32983 32984 32985 32986 32987 32988 32989 32990 32991 32992 32993 32994 32995 32996 32997 32998 32999 33000 33001 33002 33003 33004 33005 33006 33007 33008 33009 33010 33011 33012 33013 33014 33015 33016 33017 33018 33019 33020 33021 33022 33023 33024 33025 33026 33027 33028 33029 33030 33031 33032 33033 33034 33035 33036 33037 33038 33039 33040 33041 33042 33043 33044 33045 33046 33047 33048 33049 33050 33051 33052 33053 33054 33055 33056 33057 33058 33059 33060 33061 33062 33063 33064 33065 33066 33067 33068 33069 33070 33071 33072 33073 33074 33075 33076 33077 33078 33079 33080 33081 33082 33083 33084 33085 33086 33087 33088 33089 33090 33091 33092 33093 33094 33095 33096 33097 33098 33099 33100 33101 33102 33103 33104 33105 33106 33107 33108 33109 33110 33111 33112 33113 33114 33115 33116 33117 33118 33119 33120 33121 33122 33123 33124 33125 33126 33127 33128 33129 33130 33131 33132 33133 33134 33135 33136 33137 33138 33139 33140 33141 33142 33143 33144 33145 33146 33147 33148 33149 33150 33151 33152 33153 33154 33155 33156 33157 33158 33159 33160 33161 33162 33163 33164 33165 33166 33167 33168 33169 33170 33171 33172 33173 33174 33175 33176 33177 33178 33179 33180 33181 33182 33183 33184 33185 33186 33187 33188 33189 33190 33191 33192 33193 33194 33195 33196 33197 33198 33199 33200 33201 33202 33203 33204 33205 33206 33207 33208 33209 33210 33211 33212 33213 33214 33215 33216 33217 33218 33219 33220 33221 33222 33223 33224 33225 33226 33227 33228 33229 33230 33231 33232 33233 33234 33235 33236 33237 33238 33239 33240 33241 33242 33243 33244 33245 33246 33247 33248 33249 33250 33251 33252 33253 33254 33255 33256 33257 33258 33259 33260 33261 33262 33263 33264 33265 33266 33267 33268 33269 33270 33271 33272 33273 33274 33275 33276 33277 33278 33279 33280 33281 33282 33283 33284 33285 33286 33287 33288 33289 33290 33291 33292 33293 33294 33295 33296 33297 33298 33299 33300 33301 33302 33303 33304 33305 33306 33307 33308 33309 33310 33311 33312 33313 33314 33315 33316 33317 33318 33319 33320 33321 33322 33323 33324 33325 33326 33327 33328 33329 33330 33331 33332 33333 33334 33335 33336 33337 33338 33339 33340 33341 33342 33343 33344 33345 33346 33347 33348 33349 33350 33351 33352 33353 33354 33355 33356 33357 33358 33359 33360 33361 33362 33363 33364 33365 33366 33367 33368 33369 33370 33371 33372 33373 33374 33375 33376 33377 33378 33379 33380 33381 33382 33383 33384 33385 33386 33387 33388 33389 33390 33391 33392 33393 33394 33395 33396 33397 33398 33399 33400 33401 33402 33403 33404 33405 33406 33407 33408 33409 33410 33411 33412 33413 33414 33415 33416 33417 33418 33419 33420 33421 33422 33423 33424 33425 33426 33427 33428 33429 33430 33431 33432 33433 33434 33435 33436 33437 33438 33439 33440 33441 33442 33443 33444 33445 33446 33447 33448 33449 33450 33451 33452 33453 33454 33455 33456 33457 33458 33459 33460 33461 33462 33463 33464 33465 33466 33467 33468 33469 33470 33471 33472 33473 33474 33475 33476 33477 33478 33479 33480 33481 33482 33483 33484 33485 33486 33487 33488 33489 33490 33491 33492 33493 33494 33495 33496 33497 33498 33499 33500 33501 33502 33503 33504 33505 33506 33507 33508 33509 33510 33511 33512 33513 33514 33515 33516 33517 33518 33519 33520 33521 33522 33523 33524 33525 33526 33527 33528 33529 33530 33531 33532 33533 33534 33535 33536 33537 33538 33539 33540 33541 33542 33543 33544 33545 33546 33547 33548 33549 33550 33551 33552 33553 33554 33555 33556 33557 33558 33559 33560 33561 33562 33563 33564 33565 33566 33567 33568 33569 33570 33571 33572 33573 33574 33575 33576 33577 33578 33579 33580 33581 33582 33583 33584 33585 33586 33587 33588 33589 33590 33591 33592 33593 33594 33595 33596 33597 33598 33599 33600 33601 33602 33603 33604 33605 33606 33607 33608 33609 33610 33611 33612 33613 33614 33615 33616 33617 33618 33619 33620 33621 33622 33623 33624 33625 33626 33627 33628 33629 33630 33631 33632 33633 33634 33635 33636 33637 33638 33639 33640 33641 33642 33643 33644 33645 33646 33647 33648 33649 33650 33651 33652 33653 33654 33655 33656 33657 33658 33659 33660 33661 33662 33663 33664 33665 33666 33667 33668 33669 33670 33671 33672 33673 33674 33675 33676 33677 33678 33679 33680 33681 33682 33683 33684 33685 33686 33687 33688 33689 33690 33691 33692 33693 33694 33695 33696 33697 33698 33699 33700 33701 33702 33703 33704 33705 33706 33707 33708 33709 33710 33711 33712 33713 33714 33715 33716 33717 33718 33719 33720 33721 33722 33723 33724 33725 33726 33727 33728 33729 33730 33731 33732 33733 33734 33735 33736 33737 33738 33739 33740 33741 33742 33743 33744 33745 33746 33747 33748 33749 33750 33751 33752 33753 33754 33755 33756 33757 33758 33759 33760 33761 33762 33763 33764 33765 33766 33767 33768 33769 33770 33771 33772 33773 33774 33775 33776 33777 33778 33779 33780 33781 33782 33783 33784 33785 33786 33787 33788 33789 33790 33791 33792 33793 33794 33795 33796 33797 33798 33799 33800 33801 33802 33803 33804 33805 33806 33807 33808 33809 33810 33811 33812 33813 33814 33815 33816 33817 33818 33819 33820 33821 33822 33823 33824 33825 33826 33827 33828 33829 33830 33831 33832 33833 33834 33835 33836 33837 33838 33839 33840 33841 33842 33843 33844 33845 33846 33847 33848 33849 33850 33851 33852 33853 33854 33855 33856 33857 33858 33859 33860 33861 33862 33863 33864 33865 33866 33867 33868 33869 33870 33871 33872 33873 33874 33875 33876 33877 33878 33879 33880 33881 33882 33883 33884 33885 33886 33887 33888 33889 33890 33891 33892 33893 33894 33895 33896 33897 33898 33899 33900 33901 33902 33903 33904 33905 33906 33907 33908 33909 33910 33911 33912 33913 33914 33915 33916 33917 33918 33919 33920 33921 33922 33923 33924 33925 33926 33927 33928 33929 33930 33931 33932 33933 33934 33935 33936 33937 33938 33939 33940 33941 33942 33943 33944 33945 33946 33947 33948 33949 33950 33951 33952 33953 33954 33955 33956 33957 33958 33959 33960 33961 33962 33963 33964 33965 33966 33967 33968 33969 33970 33971 33972 33973 33974 33975 33976 33977 33978 33979 33980 33981 33982 33983 33984 33985 33986 33987 33988 33989 33990 33991 33992 33993 33994 33995 33996 33997 33998 33999 34000 34001 34002 34003 34004 34005 34006 34007 34008 34009 34010 34011 34012 34013 34014 34015 34016 34017 34018 34019 34020 34021 34022 34023 34024 34025 34026 34027 34028 34029 34030 34031 34032 34033 34034 34035 34036 34037 34038 34039 34040 34041 34042 34043 34044 34045 34046 34047 34048 34049 34050 34051 34052 34053 34054 34055 34056 34057 34058 34059 34060 34061 34062 34063 34064 34065 34066 34067 34068 34069 34070 34071 34072 34073 34074 34075 34076 34077 34078 34079 34080 34081 34082 34083 34084 34085 34086 34087 34088 34089 34090 34091 34092 34093 34094 34095 34096 34097 34098 34099 34100 34101 34102 34103 34104 34105 34106 34107 34108 34109 34110 34111 34112 34113 34114 34115 34116 34117 34118 34119 34120 34121 34122 34123 34124 34125 34126 34127 34128 34129 34130 34131 34132 34133 34134 34135 34136 34137 34138 34139 34140 34141 34142 34143 34144 34145 34146 34147 34148 34149 34150 34151 34152 34153 34154 34155 34156 34157 34158 34159 34160 34161 34162 34163 34164 34165 34166 34167 34168 34169 34170 34171 34172 34173 34174 34175 34176 34177 34178 34179 34180 34181 34182 34183 34184 34185 34186 34187 34188 34189 34190 34191 34192 34193 34194 34195 34196 34197 34198 34199 34200 34201 34202 34203 34204 34205 34206 34207 34208 34209 34210 34211 34212 34213 34214 34215 34216 34217 34218 34219 34220 34221 34222 34223 34224 34225 34226 34227 34228 34229 34230 34231 34232 34233 34234 34235 34236 34237 34238 34239 34240 34241 34242 34243 34244 34245 34246 34247 34248 34249 34250 34251 34252 34253 34254 34255 34256 34257 34258 34259 34260 34261 34262 34263 34264 34265 34266 34267 34268 34269 34270 34271 34272 34273 34274 34275 34276 34277 34278 34279 34280 34281 34282 34283 34284 34285 34286 34287 34288 34289 34290 34291 34292 34293 34294 34295 34296 34297 34298 34299 34300 34301 34302 34303 34304 34305 34306 34307 34308 34309 34310 34311 34312 34313 34314 34315 34316 34317 34318 34319 34320 34321 34322 34323 34324 34325 34326 34327 34328 34329 34330 34331 34332 34333 34334 34335 34336 34337 34338 34339 34340 34341 34342 34343 34344 34345 34346 34347 34348 34349 34350 34351 34352 34353 34354 34355 34356 34357 34358 34359 34360 34361 34362 34363 34364 34365 34366 34367 34368 34369 34370 34371 34372 34373 34374 34375 34376 34377 34378 34379 34380 34381 34382 34383 34384 34385 34386 34387 34388 34389 34390 34391 34392 34393 34394 34395 34396 34397 34398 34399 34400 34401 34402 34403 34404 34405 34406 34407 34408 34409 34410 34411 34412 34413 34414 34415 34416 34417 34418 34419 34420 34421 34422 34423 34424 34425 34426 34427 34428 34429 34430 34431 34432 34433 34434 34435 34436 34437 34438 34439 34440 34441 34442 34443 34444 34445 34446 34447 34448 34449 34450 34451 34452 34453 34454 34455 34456 34457 34458 34459 34460 34461 34462 34463 34464 34465 34466 34467 34468 34469 34470 34471 34472 34473 34474 34475 34476 34477 34478 34479 34480 34481 34482 34483 34484 34485 34486 34487 34488 34489 34490 34491 34492 34493 34494 34495 34496 34497 34498 34499 34500 34501 34502 34503 34504 34505 34506 34507 34508 34509 34510 34511 34512 34513 34514 34515 34516 34517 34518 34519 34520 34521 34522 34523 34524 34525 34526 34527 34528 34529 34530 34531 34532 34533 34534 34535 34536 34537 34538 34539 34540 34541 34542 34543 34544 34545 34546 34547 34548 34549 34550 34551 34552 34553 34554 34555 34556 34557 34558 34559 34560 34561 34562 34563 34564 34565 34566 34567 34568 34569 34570 34571 34572 34573 34574 34575 34576 34577 34578 34579 34580 34581 34582 34583 34584 34585 34586 34587 34588 34589 34590 34591 34592 34593 34594 34595 34596 34597 34598 34599 34600 34601 34602 34603 34604 34605 34606 34607 34608 34609 34610 34611 34612 34613 34614 34615 34616 34617 34618 34619 34620 34621 34622 34623 34624 34625 34626 34627 34628 34629 34630 34631 34632 34633 34634 34635 34636 34637 34638 34639 34640 34641 34642 34643 34644 34645 34646 34647 34648 34649 34650 34651 34652 34653 34654 34655 34656 34657 34658 34659 34660 34661 34662 34663 34664 34665 34666 34667 34668 34669 34670 34671 34672 34673 34674 34675 34676 34677 34678 34679 34680 34681 34682 34683 34684 34685 34686 34687 34688 34689 34690 34691 34692 34693 34694 34695 34696 34697 34698 34699 34700 34701 34702 34703 34704 34705 34706 34707 34708 34709 34710 34711 34712 34713 34714 34715 34716 34717 34718 34719 34720 34721 34722 34723 34724 34725 34726 34727 34728 34729 34730 34731 34732 34733 34734 34735 34736 34737 34738 34739 34740 34741 34742 34743 34744 34745 34746 34747 34748 34749 34750 34751 34752 34753 34754 34755 34756 34757 34758 34759 34760 34761 34762 34763 34764 34765 34766 34767 34768 34769 34770 34771 34772 34773 34774 34775 34776 34777 34778 34779 34780 34781 34782 34783 34784 34785 34786 34787 34788 34789 34790 34791 34792 34793 34794 34795 34796 34797 34798 34799 34800 34801 34802 34803 34804 34805 34806 34807 34808 34809 34810 34811 34812 34813 34814 34815 34816 34817 34818 34819 34820 34821 34822 34823 34824 34825 34826 34827 34828 34829 34830 34831 34832 34833 34834 34835 34836 34837 34838 34839 34840 34841 34842 34843 34844 34845 34846 34847 34848 34849 34850 34851 34852 34853 34854 34855 34856 34857 34858 34859 34860 34861 34862 34863 34864 34865 34866 34867 34868 34869 34870 34871 34872 34873 34874 34875 34876 34877 34878 34879 34880 34881 34882 34883 34884 34885 34886 34887 34888 34889 34890 34891 34892 34893 34894 34895 34896 34897 34898 34899 34900 34901 34902 34903 34904 34905 34906 34907 34908 34909 34910 34911 34912 34913 34914 34915 34916 34917 34918 34919 34920 34921 34922 34923 34924 34925 34926 34927 34928 34929 34930 34931 34932 34933 34934 34935 34936 34937 34938 34939 34940 34941 34942 34943 34944 34945 34946 34947 34948 34949 34950 34951 34952 34953 34954 34955 34956 34957 34958 34959 34960 34961 34962 34963 34964 34965 34966 34967 34968 34969 34970 34971 34972 34973 34974 34975 34976 34977 34978 34979 34980 34981 34982 34983 34984 34985 34986 34987 34988 34989 34990 34991 34992 34993 34994 34995 34996 34997 34998 34999 35000 35001 35002 35003 35004 35005 35006 35007 35008 35009 35010 35011 35012 35013 35014 35015 35016 35017 35018 35019 35020 35021 35022 35023 35024 35025 35026 35027 35028 35029 35030 35031 35032 35033 35034 35035 35036 35037 35038 35039 35040 35041 35042 35043 35044 35045 35046 35047 35048 35049 35050 35051 35052 35053 35054 35055 35056 35057 35058 35059 35060 35061 35062 35063 35064 35065 35066 35067 35068 35069 35070 35071 35072 35073 35074 35075 35076 35077 35078 35079 35080 35081 35082 35083 35084 35085 35086 35087 35088 35089 35090 35091 35092 35093 35094 35095 35096 35097 35098 35099 35100 35101 35102 35103 35104 35105 35106 35107 35108 35109 35110 35111 35112 35113 35114 35115 35116 35117 35118 35119 35120 35121 35122 35123 35124 35125 35126 35127 35128 35129 35130 35131 35132 35133 35134 35135 35136 35137 35138 35139 35140 35141 35142 35143 35144 35145 35146 35147 35148 35149 35150 35151 35152 35153 35154 35155 35156 35157 35158 35159 35160 35161 35162 35163 35164 35165 35166 35167 35168 35169 35170 35171 35172 35173 35174 35175 35176 35177 35178 35179 35180 35181 35182 35183 35184 35185 35186 35187 35188 35189 35190 35191 35192 35193 35194 35195 35196 35197 35198 35199 35200 35201 35202 35203 35204 35205 35206 35207 35208 35209 35210 35211 35212 35213 35214 35215 35216 35217 35218 35219 35220 35221 35222 35223 35224 35225 35226 35227 35228 35229 35230 35231 35232 35233 35234 35235 35236 35237 35238 35239 35240 35241 35242 35243 35244 35245 35246 35247 35248 35249 35250 35251 35252 35253 35254 35255 35256 35257 35258 35259 35260 35261 35262 35263 35264 35265 35266 35267 35268 35269 35270 35271 35272 35273 35274 35275 35276 35277 35278 35279 35280 35281 35282 35283 35284 35285 35286 35287 35288 35289 35290 35291 35292 35293 35294 35295 35296 35297 35298 35299 35300 35301 35302 35303 35304 35305 35306 35307 35308 35309 35310 35311 35312 35313 35314 35315 35316 35317 35318 35319 35320 35321 35322 35323 35324 35325 35326 35327 35328 35329 35330 35331 35332 35333 35334 35335 35336 35337 35338 35339 35340 35341 35342 35343 35344 35345 35346 35347 35348 35349 35350 35351 35352 35353 35354 35355 35356 35357 35358 35359 35360 35361 35362 35363 35364 35365 35366 35367 35368 35369 35370 35371 35372 35373 35374 35375 35376 35377 35378 35379 35380 35381 35382 35383 35384 35385 35386 35387 35388 35389 35390 35391 35392 35393 35394 35395 35396 35397 35398 35399 35400 35401 35402 35403 35404 35405 35406 35407 35408 35409 35410 35411 35412 35413 35414 35415 35416 35417 35418 35419 35420 35421 35422 35423 35424 35425 35426 35427 35428 35429 35430 35431 35432 35433 35434 35435 35436 35437 35438 35439 35440 35441 35442 35443 35444 35445 35446 35447 35448 35449 35450 35451 35452 35453 35454 35455 35456 35457 35458 35459 35460 35461 35462 35463 35464 35465 35466 35467 35468 35469 35470 35471 35472 35473 35474 35475 35476 35477 35478 35479 35480 35481 35482 35483 35484 35485 35486 35487 35488 35489 35490 35491 35492 35493 35494 35495 35496 35497 35498 35499 35500 35501 35502 35503 35504 35505 35506 35507 35508 35509 35510 35511 35512 35513 35514 35515 35516 35517 35518 35519 35520 35521 35522 35523 35524 35525 35526 35527 35528 35529 35530 35531 35532 35533 35534 35535 35536 35537 35538 35539 35540 35541 35542 35543 35544 35545 35546 35547 35548 35549 35550 35551 35552 35553 35554 35555 35556 35557 35558 35559 35560 35561 35562 35563 35564 35565 35566 35567 35568 35569 35570 35571 35572 35573 35574 35575 35576 35577 35578 35579 35580 35581 35582 35583 35584 35585 35586 35587 35588 35589 35590 35591 35592 35593 35594 35595 35596 35597 35598 35599 35600 35601 35602 35603 35604 35605 35606 35607 35608 35609 35610 35611 35612 35613 35614 35615 35616 35617 35618 35619 35620 35621 35622 35623 35624 35625 35626 35627 35628 35629 35630 35631 35632 35633 35634 35635 35636 35637 35638 35639 35640 35641 35642 35643 35644 35645 35646 35647 35648 35649 35650 35651 35652 35653 35654 35655 35656 35657 35658 35659 35660 35661 35662 35663 35664 35665 35666 35667 35668 35669 35670 35671 35672 35673 35674 35675 35676 35677 35678 35679 35680 35681 35682 35683 35684 35685 35686 35687 35688 35689 35690 35691 35692 35693 35694 35695 35696 35697 35698 35699 35700 35701 35702 35703 35704 35705 35706 35707 35708 35709 35710 35711 35712 35713 35714 35715 35716 | define(function() { return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
'use strict';
window['requirejs'].config({
map: {
'*': {
'jupyter-js-widgets': 'nbextensions/jupyter-js-widgets/extension',
},
}
});
var mngr = __webpack_require__(1);
var widgetarea = __webpack_require__(64);
__webpack_require__(60);
__webpack_require__(61);
/**
* Create a widget manager for a kernel instance.
*/
var handle_kernel = function(Jupyter, kernel) {
if (kernel.comm_manager && kernel.widget_manager === undefined) {
// Create a widget manager instance. Use the global
// Jupyter.notebook handle.
var manager = new mngr.WidgetManager(kernel.comm_manager, Jupyter.notebook);
// For backwards compatibility and interactive use.
Jupyter.WidgetManager = mngr.WidgetManager;
// Store a handle to the manager so we know not to
// another for this kernel. This also is a convenience
// for the user.
kernel.widget_manager = manager;
}
};
/**
* Creates a widgetarea for the cell if it is a CodeCell.
* If the cell isn't a CodeCell, no action is taken.
*/
var handle_cell = function(cell) {
if (cell.cell_type==='code') {
var area = new widgetarea.WidgetArea(cell);
cell.widgetarea = area;
}
};
function register_events(Jupyter, events) {
// If a kernel already exists, create a widget manager.
if (Jupyter.notebook && Jupyter.notebook.kernel) {
handle_kernel(Jupyter, Jupyter.notebook.kernel);
}
// When the kernel is created, create a widget manager.
events.on('kernel_created.Kernel kernel_created.Session', function(event, data) {
handle_kernel(Jupyter, data.kernel);
});
// Create widget areas for cells that already exist.
var cells = Jupyter.notebook.get_cells();
for (var i = 0; i < cells.length; i++) {
handle_cell(cells[i]);
}
events.on('create.Cell', function(event, data) {
handle_cell(data.cell);
});
var clearWidgetArea = function(event, data) {
data.cell.widgetarea && data.cell.widgetarea.clear();
}
events.on('delete.Cell', clearWidgetArea);
events.on('execute.CodeCell', clearWidgetArea);
events.on('clear_output.CodeCell', clearWidgetArea);
events.on('resize.Cell', function(event, data) {
data.cell.widgetarea && data.cell.widgetarea.resize();
})
var disconnectWidgetAreas = function() {
var cells = Jupyter.notebook.get_cells();
for (var i = 0; i < cells.length; i++) {
var cell = cells[i];
cell.widgetarea && cell.widgetarea.disconnect();
}
}
events.on('kernel_disconnected.Kernel', disconnectWidgetAreas);
events.on('kernel_killed.Kernel', disconnectWidgetAreas);
events.on('kernel_restarting.Kernel', disconnectWidgetAreas);
events.on('kernel_dead.Kernel', disconnectWidgetAreas);
}
function load_ipython_extension () {
return new Promise(function(resolve) {
requirejs([
"base/js/namespace",
"base/js/events"
], function(Jupyter, events) {
__webpack_require__(69)
__webpack_require__(71);
register_events(Jupyter, events);
console.log("loaded widgets");
resolve();
});
});
}
var _ = __webpack_require__(2);
module.exports = _.extend({
load_ipython_extension: load_ipython_extension,
}, __webpack_require__(5), __webpack_require__(63));
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var _ = __webpack_require__(2);
var Backbone = __webpack_require__(3);
var widgets = __webpack_require__(5);
var saveState = __webpack_require__(60);
var embedWidgets = __webpack_require__(61);
var version = __webpack_require__(62).version;
var output = __webpack_require__(63);
//--------------------------------------------------------------------
// WidgetManager class
//--------------------------------------------------------------------
var WidgetManager = function (comm_manager, notebook) {
widgets.ManagerBase.apply(this);
WidgetManager._managers.push(this);
// Attach a comm manager
this.notebook = notebook;
this.keyboard_manager = notebook.keyboard_manager;
this.comm_manager = comm_manager;
// Register with the comm manager.
this.comm_manager.register_target(this.comm_target_name, _.bind(this.handle_comm_open,this));
// Attempt to reconstruct any live comms by requesting them from the back-end.
var that = this;
var backed_widgets_loaded = this._get_comm_info().then(function(comm_ids) {
// Create comm class instances from comm ids.
var comm_promises = Object.keys(comm_ids).map(function(comm_id) {
return that._create_comm(that.comm_target_name, comm_id);
});
// Send a state request message out for each widget comm and wait
// for the responses.
return Promise.all(comm_promises).then(function(comms) {
return Promise.all(comms.map(function(comm) {
var update_promise = new Promise(function(resolve, reject) {
comm.on_msg(function (msg) {
// A suspected response was received, check to see if
// it's a state update. If so, resolve.
if (msg.content.data.method === 'update') {
resolve({
comm: comm,
msg: msg
});
}
});
});
comm.send({
method: 'request_state'
}, that.callbacks());
return update_promise;
}));
}).then(function(widgets_info) {
return Promise.all(widgets_info.map(function(widget_info) {
return that.new_model({
model_name: widget_info.msg.content.data.state._model_name,
model_module: widget_info.msg.content.data.state._model_module,
model_module_version: widget_info.msg.content.data.state._model_module_version,
comm: widget_info.comm,
}, widget_info.msg.content.data.state);
}));
}).then(function() {
var cells = that.notebook.get_cells();
var outputs, cell;
for (var i = 0; i < cells.length; ++i) {
cell = cells[i];
if (cell.output_area) {
outputs = cell.output_area.outputs;
for (var j = 0; j < outputs.length; ++j) {
var out = outputs[j];
if (out.output_type==="display_data" && out.data['application/vnd.jupyter.widget-view+json']) {
var model_promise = that.get_model(out.data['application/vnd.jupyter.widget-view+json'].model_id);
if (model_promise !== undefined) {
model_promise.then((function(cell_index) {
return function (model) {
that.display_model(undefined, model, { cell_index: cell_index });
};
})(i));
}
}
}
}
}
});
});
// Setup state saving code.
this.notebook.events.on('before_save.Notebook', (function() {
var save_callback = WidgetManager._save_callback;
if (save_callback) {
this.get_state(WidgetManager._get_state_options).then((function(state) {
save_callback.call(this, state);
}).bind(this)).catch(widgets.reject('Could not call widget save state callback.', true));
}
}).bind(this));
// Validate the version requested by the backend.
var validate = (function validate() {
this.validateVersion().then(function(valid) {
if (!valid) {
console.warn('Widget frontend version does not match the backend.');
}
}).catch(function(err) {
console.warn('Could not cross validate the widget frontend and backend versions.', err);
});
}).bind(this);
validate();
// Revalidate the version when a new kernel connects.
this.notebook.events.on('kernel_connected.Kernel', function(event, data) {
validate();
});
// Create the actions and menu
this._init_actions();
this._init_menu();
};
WidgetManager.prototype = Object.create(widgets.ManagerBase.prototype);
WidgetManager._managers = []; /* List of widget managers */
WidgetManager._load_callback = null;
WidgetManager._save_callback = null;
WidgetManager.register_widget_model = function (model_name, model_type) {
/**
* Registers a widget model by name.
*/
return widgets.ManagerBase.register_widget_model.apply(this, arguments);
};
WidgetManager.register_widget_view = function (view_name, view_type) {
/**
* Registers a widget view by name.
*/
return widgets.ManagerBase.register_widget_view.apply(this, arguments);
};
WidgetManager.set_state_callbacks = function (load_callback, save_callback, options) {
/**
* Registers callbacks for widget state persistence.
*
* Parameters
* ----------
* load_callback: function()
* function that is called when the widget manager state should be
* loaded. This function should return a promise for the widget
* manager state. An empty state is an empty dictionary `{}`.
* save_callback: function(state as dictionary)
* function that is called when the notebook is saved or autosaved.
* The current state of the widget manager is passed in as the first
* argument.
*/
WidgetManager._load_callback = load_callback;
WidgetManager._save_callback = save_callback;
WidgetManager._get_state_options = options || {};
// Use the load callback to immediately load widget states.
WidgetManager._managers.forEach(function(manager) {
if (load_callback) {
Promise.resolve().then(function () {
return load_callback.call(manager);
}).then(function(state) {
manager.set_state(state);
}).catch(widgets.reject('Error loading widget manager state', true));
}
});
};
var url = [window.location.protocol, '//', window.location.host, window.location.pathname].join('');
var key = 'widgets:' + url;
WidgetManager.set_state_callbacks(function() {
if (Jupyter.notebook.metadata.widgets) {
return Promise.resolve(Jupyter.notebook.metadata.widgets.state);
} else {
return Promise.resolve({});
}
});
WidgetManager.prototype.loadClass = function(className, moduleName, moduleVersion, error) {
if (moduleName === "jupyter-js-widgets") {
if (className === "OutputModel" || className === "OutputView") {
return Promise.resolve(output[className]);
} else {
return Promise.resolve(widgets[className]);
}
} else {
return Object.getPrototypeOf(WidgetManager.prototype).loadClass.apply(this, arguments);
}
}
WidgetManager.prototype._handle_display_view = function (view) {
/**
* Have the IPython keyboard manager disable its event
* handling so the widget can capture keyboard input.
* Note, this is only done on the outer most widgets.
*/
if (this.keyboard_manager) {
this.keyboard_manager.register_events(view.el);
if (view.additional_elements) {
for (var i = 0; i < view.additional_elements.length; i++) {
this.keyboard_manager.register_events(view.additional_elements[i]);
}
}
}
};
/**
* Registers manager level actions with the notebook actions list
*/
WidgetManager.prototype._init_actions = function() {
var notifier = Jupyter.notification_area.widget('widgets');
this.saveWidgetsAction = {
handler: (function() {
this.get_state({
drop_defaults: true
}).then(function(state) {
Jupyter.notebook.metadata.widgets = {
'application/vnd.jupyter.widget-state+json' : {
version_major: 1,
version_minor: 0,
state: state
}
};
Jupyter.menubar.actions.get('jupyter-notebook:save-notebook').handler({
notebook: Jupyter.notebook
});
});
}).bind(this),
icon: 'fa-truck',
help: 'Save the notebook with the widget state information for static rendering'
};
Jupyter.menubar.actions.register(this.saveWidgetsAction, 'save-with-widgets', 'widgets');
};
/**
* Initialize the widget menu
*/
WidgetManager.prototype._init_menu = function() {
// Add a widgets menubar item, before help.
var widgetsMenu = document.createElement('li');
widgetsMenu.classList.add('dropdown');
var helpMenu = document.querySelector('#help_menu').parentElement;
helpMenu.parentElement.insertBefore(widgetsMenu, helpMenu);
var widgetsMenuLink = document.createElement('a');
widgetsMenuLink.setAttribute('href', '#');
widgetsMenuLink.setAttribute('data-toggle', 'dropdown');
widgetsMenuLink.classList.add('dropdown-toggle');
widgetsMenuLink.innerText = 'Widgets';
widgetsMenu.appendChild(widgetsMenuLink);
var widgetsSubmenu = document.createElement('ul');
widgetsSubmenu.setAttribute('id', 'widget-submenu');
widgetsSubmenu.classList.add('dropdown-menu');
widgetsMenu.appendChild(widgetsSubmenu);
widgetsSubmenu.appendChild(this._createMenuItem('Save Notebook with Widgets', this.saveWidgetsAction));
widgetsSubmenu.appendChild(this._createMenuItem('Download Widget State', saveState.action));
widgetsSubmenu.appendChild(this._createMenuItem('Embed Widgets', embedWidgets.action));
};
/**
* Creates a menu item for an action.
* @param {string} title - display string for the menu item
* @param {Action} action
* @return {HTMLElement} menu item
*/
WidgetManager.prototype._createMenuItem = function(title, action) {
var item = document.createElement('li');
item.setAttribute('title', action.help);
var itemLink = document.createElement('a');
itemLink.setAttribute('href', '#');
itemLink.innerText = title;
item.appendChild(itemLink);
item.onclick = action.handler;
return item;
};
WidgetManager.prototype.display_model = function(msg, model, options) {
options = options || {};
if (msg) {
options.cell = this.get_msg_cell(msg.parent_header.msg_id);
// Only set cell_index when view is displayed as directly.
options.cell_index = this.notebook.find_cell_index(options.cell);
} else if (options && options.cell_index !== undefined) {
options.cell = this.notebook.get_cell(options.cell_index);
} else {
options.cell = null;
}
return widgets.ManagerBase.prototype.display_model.call(this, msg, model, options)
.catch(widgets.reject('Could not display model', true));
};
// In display view
WidgetManager.prototype.display_view = function(msg, view, options) {
if (view instanceof widgets.DOMWidgetView) {
if (options.cell === null) {
view.remove();
return Promise.reject(new Error("Could not determine where the display" +
" message was from. Widget will not be displayed"));
} else {
if (options.cell.widgetarea) {
var that = this;
return options.cell.widgetarea.display_widget_view(Promise.resolve(view)).then(function(view) {
that._handle_display_view(view);
return view;
}).catch(widgets.reject('Could not display view', true));
} else {
return Promise.reject(new Error('Cell does not have a `widgetarea` defined'));
}
}
}
};
WidgetManager.prototype.setViewOptions = function (options) {
var options = options || {};
// If a view is passed into the method, use that view's cell as
// the cell for the view that is created.
if (options.parent !== undefined) {
options.cell = options.parent.options.cell;
}
return options;
};
WidgetManager.prototype.get_msg_cell = function (msg_id) {
var cell = null;
// First, check to see if the msg was triggered by cell execution.
if (this.notebook) {
cell = this.notebook.get_msg_cell(msg_id);
}
if (cell !== null) {
return cell;
}
// Second, check to see if a get_cell callback was defined
// for the message. get_cell callbacks are registered for
// widget messages, so this block is actually checking to see if the
// message was triggered by a widget.
var kernel = this.comm_manager.kernel;
if (kernel) {
var callbacks = kernel.get_callbacks_for_msg(msg_id);
if (callbacks && callbacks.iopub &&
callbacks.iopub.get_cell !== undefined) {
return callbacks.iopub.get_cell();
}
}
// Not triggered by a cell or widget (no get_cell callback
// exists).
return null;
};
WidgetManager.prototype._create_comm = function(comm_target_name, model_id, data) {
var that = this;
return this._get_connected_kernel().then(function(kernel) {
if (data) {
return kernel.comm_manager.new_comm(comm_target_name, data,
that.callbacks(), {}, model_id);
} else {
return new Promise(function(resolve) {
requirejs(["services/kernels/comm"], function(comm) {
var new_comm = new comm.Comm(comm_target_name, model_id);
kernel.comm_manager.register_comm(new_comm);
resolve(new_comm);
});
});
}
});
};
WidgetManager.prototype.callbacks = function (view) {
/**
* callback handlers specific a view
*/
var callbacks = {};
if (view && view.options.cell) {
// Try to get output handlers
var cell = view.options.cell;
var handle_output = null;
var handle_clear_output = null;
if (cell.output_area) {
handle_output = _.bind(cell.output_area.handle_output, cell.output_area);
handle_clear_output = _.bind(cell.output_area.handle_clear_output, cell.output_area);
}
// Create callback dictionary using what is known
var that = this;
callbacks = {
iopub : {
output : handle_output,
clear_output : handle_clear_output,
// Special function only registered by widget messages.
// Allows us to get the cell for a message so we know
// where to add widgets if the code requires it.
get_cell : function () {
return cell;
},
},
};
}
return callbacks;
};
WidgetManager.prototype._get_comm_info = function() {
/**
* Gets a promise for the valid widget models.
*/
var that = this;
return this._get_connected_kernel().then(function(kernel) {
return new Promise(function(resolve, reject) {
kernel.comm_info('jupyter.widget', function(msg) {
resolve(msg['content']['comms']);
});
});
});
};
WidgetManager.prototype._get_connected_kernel = function() {
/**
* Gets a promise for a connected kernel
*/
var that = this;
return new Promise(function(resolve, reject) {
if (that.comm_manager &&
that.comm_manager.kernel &&
that.comm_manager.kernel.is_connected()) {
resolve(that.comm_manager.kernel);
} else {
that.notebook.events.on('kernel_connected.Kernel', function(event, data) {
resolve(data.kernel);
});
}
});
};
module.exports = {
WidgetManager: WidgetManager
};
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Underscore.js 1.8.3
// http://underscorejs.org
// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
(function() {
// Baseline setup
// --------------
// Establish the root object, `window` in the browser, or `exports` on the server.
var root = this;
// Save the previous value of the `_` variable.
var previousUnderscore = root._;
// Save bytes in the minified (but not gzipped) version:
var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
// Create quick reference variables for speed access to core prototypes.
var
push = ArrayProto.push,
slice = ArrayProto.slice,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty;
// All **ECMAScript 5** native function implementations that we hope to use
// are declared here.
var
nativeIsArray = Array.isArray,
nativeKeys = Object.keys,
nativeBind = FuncProto.bind,
nativeCreate = Object.create;
// Naked function reference for surrogate-prototype-swapping.
var Ctor = function(){};
// Create a safe reference to the Underscore object for use below.
var _ = function(obj) {
if (obj instanceof _) return obj;
if (!(this instanceof _)) return new _(obj);
this._wrapped = obj;
};
// Export the Underscore object for **Node.js**, with
// backwards-compatibility for the old `require()` API. If we're in
// the browser, add `_` as a global object.
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = _;
}
exports._ = _;
} else {
root._ = _;
}
// Current version.
_.VERSION = '1.8.3';
// Internal function that returns an efficient (for current engines) version
// of the passed-in callback, to be repeatedly applied in other Underscore
// functions.
var optimizeCb = function(func, context, argCount) {
if (context === void 0) return func;
switch (argCount == null ? 3 : argCount) {
case 1: return function(value) {
return func.call(context, value);
};
case 2: return function(value, other) {
return func.call(context, value, other);
};
case 3: return function(value, index, collection) {
return func.call(context, value, index, collection);
};
case 4: return function(accumulator, value, index, collection) {
return func.call(context, accumulator, value, index, collection);
};
}
return function() {
return func.apply(context, arguments);
};
};
// A mostly-internal function to generate callbacks that can be applied
// to each element in a collection, returning the desired result — either
// identity, an arbitrary callback, a property matcher, or a property accessor.
var cb = function(value, context, argCount) {
if (value == null) return _.identity;
if (_.isFunction(value)) return optimizeCb(value, context, argCount);
if (_.isObject(value)) return _.matcher(value);
return _.property(value);
};
_.iteratee = function(value, context) {
return cb(value, context, Infinity);
};
// An internal function for creating assigner functions.
var createAssigner = function(keysFunc, undefinedOnly) {
return function(obj) {
var length = arguments.length;
if (length < 2 || obj == null) return obj;
for (var index = 1; index < length; index++) {
var source = arguments[index],
keys = keysFunc(source),
l = keys.length;
for (var i = 0; i < l; i++) {
var key = keys[i];
if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key];
}
}
return obj;
};
};
// An internal function for creating a new object that inherits from another.
var baseCreate = function(prototype) {
if (!_.isObject(prototype)) return {};
if (nativeCreate) return nativeCreate(prototype);
Ctor.prototype = prototype;
var result = new Ctor;
Ctor.prototype = null;
return result;
};
var property = function(key) {
return function(obj) {
return obj == null ? void 0 : obj[key];
};
};
// Helper for collection methods to determine whether a collection
// should be iterated as an array or as an object
// Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
// Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
var getLength = property('length');
var isArrayLike = function(collection) {
var length = getLength(collection);
return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX;
};
// Collection Functions
// --------------------
// The cornerstone, an `each` implementation, aka `forEach`.
// Handles raw objects in addition to array-likes. Treats all
// sparse array-likes as if they were dense.
_.each = _.forEach = function(obj, iteratee, context) {
iteratee = optimizeCb(iteratee, context);
var i, length;
if (isArrayLike(obj)) {
for (i = 0, length = obj.length; i < length; i++) {
iteratee(obj[i], i, obj);
}
} else {
var keys = _.keys(obj);
for (i = 0, length = keys.length; i < length; i++) {
iteratee(obj[keys[i]], keys[i], obj);
}
}
return obj;
};
// Return the results of applying the iteratee to each element.
_.map = _.collect = function(obj, iteratee, context) {
iteratee = cb(iteratee, context);
var keys = !isArrayLike(obj) && _.keys(obj),
length = (keys || obj).length,
results = Array(length);
for (var index = 0; index < length; index++) {
var currentKey = keys ? keys[index] : index;
results[index] = iteratee(obj[currentKey], currentKey, obj);
}
return results;
};
// Create a reducing function iterating left or right.
function createReduce(dir) {
// Optimized iterator function as using arguments.length
// in the main function will deoptimize the, see #1991.
function iterator(obj, iteratee, memo, keys, index, length) {
for (; index >= 0 && index < length; index += dir) {
var currentKey = keys ? keys[index] : index;
memo = iteratee(memo, obj[currentKey], currentKey, obj);
}
return memo;
}
return function(obj, iteratee, memo, context) {
iteratee = optimizeCb(iteratee, context, 4);
var keys = !isArrayLike(obj) && _.keys(obj),
length = (keys || obj).length,
index = dir > 0 ? 0 : length - 1;
// Determine the initial value if none is provided.
if (arguments.length < 3) {
memo = obj[keys ? keys[index] : index];
index += dir;
}
return iterator(obj, iteratee, memo, keys, index, length);
};
}
// **Reduce** builds up a single result from a list of values, aka `inject`,
// or `foldl`.
_.reduce = _.foldl = _.inject = createReduce(1);
// The right-associative version of reduce, also known as `foldr`.
_.reduceRight = _.foldr = createReduce(-1);
// Return the first value which passes a truth test. Aliased as `detect`.
_.find = _.detect = function(obj, predicate, context) {
var key;
if (isArrayLike(obj)) {
key = _.findIndex(obj, predicate, context);
} else {
key = _.findKey(obj, predicate, context);
}
if (key !== void 0 && key !== -1) return obj[key];
};
// Return all the elements that pass a truth test.
// Aliased as `select`.
_.filter = _.select = function(obj, predicate, context) {
var results = [];
predicate = cb(predicate, context);
_.each(obj, function(value, index, list) {
if (predicate(value, index, list)) results.push(value);
});
return results;
};
// Return all the elements for which a truth test fails.
_.reject = function(obj, predicate, context) {
return _.filter(obj, _.negate(cb(predicate)), context);
};
// Determine whether all of the elements match a truth test.
// Aliased as `all`.
_.every = _.all = function(obj, predicate, context) {
predicate = cb(predicate, context);
var keys = !isArrayLike(obj) && _.keys(obj),
length = (keys || obj).length;
for (var index = 0; index < length; index++) {
var currentKey = keys ? keys[index] : index;
if (!predicate(obj[currentKey], currentKey, obj)) return false;
}
return true;
};
// Determine if at least one element in the object matches a truth test.
// Aliased as `any`.
_.some = _.any = function(obj, predicate, context) {
predicate = cb(predicate, context);
var keys = !isArrayLike(obj) && _.keys(obj),
length = (keys || obj).length;
for (var index = 0; index < length; index++) {
var currentKey = keys ? keys[index] : index;
if (predicate(obj[currentKey], currentKey, obj)) return true;
}
return false;
};
// Determine if the array or object contains a given item (using `===`).
// Aliased as `includes` and `include`.
_.contains = _.includes = _.include = function(obj, item, fromIndex, guard) {
if (!isArrayLike(obj)) obj = _.values(obj);
if (typeof fromIndex != 'number' || guard) fromIndex = 0;
return _.indexOf(obj, item, fromIndex) >= 0;
};
// Invoke a method (with arguments) on every item in a collection.
_.invoke = function(obj, method) {
var args = slice.call(arguments, 2);
var isFunc = _.isFunction(method);
return _.map(obj, function(value) {
var func = isFunc ? method : value[method];
return func == null ? func : func.apply(value, args);
});
};
// Convenience version of a common use case of `map`: fetching a property.
_.pluck = function(obj, key) {
return _.map(obj, _.property(key));
};
// Convenience version of a common use case of `filter`: selecting only objects
// containing specific `key:value` pairs.
_.where = function(obj, attrs) {
return _.filter(obj, _.matcher(attrs));
};
// Convenience version of a common use case of `find`: getting the first object
// containing specific `key:value` pairs.
_.findWhere = function(obj, attrs) {
return _.find(obj, _.matcher(attrs));
};
// Return the maximum element (or element-based computation).
_.max = function(obj, iteratee, context) {
var result = -Infinity, lastComputed = -Infinity,
value, computed;
if (iteratee == null && obj != null) {
obj = isArrayLike(obj) ? obj : _.values(obj);
for (var i = 0, length = obj.length; i < length; i++) {
value = obj[i];
if (value > result) {
result = value;
}
}
} else {
iteratee = cb(iteratee, context);
_.each(obj, function(value, index, list) {
computed = iteratee(value, index, list);
if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
result = value;
lastComputed = computed;
}
});
}
return result;
};
// Return the minimum element (or element-based computation).
_.min = function(obj, iteratee, context) {
var result = Infinity, lastComputed = Infinity,
value, computed;
if (iteratee == null && obj != null) {
obj = isArrayLike(obj) ? obj : _.values(obj);
for (var i = 0, length = obj.length; i < length; i++) {
value = obj[i];
if (value < result) {
result = value;
}
}
} else {
iteratee = cb(iteratee, context);
_.each(obj, function(value, index, list) {
computed = iteratee(value, index, list);
if (computed < lastComputed || computed === Infinity && result === Infinity) {
result = value;
lastComputed = computed;
}
});
}
return result;
};
// Shuffle a collection, using the modern version of the
// [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
_.shuffle = function(obj) {
var set = isArrayLike(obj) ? obj : _.values(obj);
var length = set.length;
var shuffled = Array(length);
for (var index = 0, rand; index < length; index++) {
rand = _.random(0, index);
if (rand !== index) shuffled[index] = shuffled[rand];
shuffled[rand] = set[index];
}
return shuffled;
};
// Sample **n** random values from a collection.
// If **n** is not specified, returns a single random element.
// The internal `guard` argument allows it to work with `map`.
_.sample = function(obj, n, guard) {
if (n == null || guard) {
if (!isArrayLike(obj)) obj = _.values(obj);
return obj[_.random(obj.length - 1)];
}
return _.shuffle(obj).slice(0, Math.max(0, n));
};
// Sort the object's values by a criterion produced by an iteratee.
_.sortBy = function(obj, iteratee, context) {
iteratee = cb(iteratee, context);
return _.pluck(_.map(obj, function(value, index, list) {
return {
value: value,
index: index,
criteria: iteratee(value, index, list)
};
}).sort(function(left, right) {
var a = left.criteria;
var b = right.criteria;
if (a !== b) {
if (a > b || a === void 0) return 1;
if (a < b || b === void 0) return -1;
}
return left.index - right.index;
}), 'value');
};
// An internal function used for aggregate "group by" operations.
var group = function(behavior) {
return function(obj, iteratee, context) {
var result = {};
iteratee = cb(iteratee, context);
_.each(obj, function(value, index) {
var key = iteratee(value, index, obj);
behavior(result, value, key);
});
return result;
};
};
// Groups the object's values by a criterion. Pass either a string attribute
// to group by, or a function that returns the criterion.
_.groupBy = group(function(result, value, key) {
if (_.has(result, key)) result[key].push(value); else result[key] = [value];
});
// Indexes the object's values by a criterion, similar to `groupBy`, but for
// when you know that your index values will be unique.
_.indexBy = group(function(result, value, key) {
result[key] = value;
});
// Counts instances of an object that group by a certain criterion. Pass
// either a string attribute to count by, or a function that returns the
// criterion.
_.countBy = group(function(result, value, key) {
if (_.has(result, key)) result[key]++; else result[key] = 1;
});
// Safely create a real, live array from anything iterable.
_.toArray = function(obj) {
if (!obj) return [];
if (_.isArray(obj)) return slice.call(obj);
if (isArrayLike(obj)) return _.map(obj, _.identity);
return _.values(obj);
};
// Return the number of elements in an object.
_.size = function(obj) {
if (obj == null) return 0;
return isArrayLike(obj) ? obj.length : _.keys(obj).length;
};
// Split a collection into two arrays: one whose elements all satisfy the given
// predicate, and one whose elements all do not satisfy the predicate.
_.partition = function(obj, predicate, context) {
predicate = cb(predicate, context);
var pass = [], fail = [];
_.each(obj, function(value, key, obj) {
(predicate(value, key, obj) ? pass : fail).push(value);
});
return [pass, fail];
};
// Array Functions
// ---------------
// Get the first element of an array. Passing **n** will return the first N
// values in the array. Aliased as `head` and `take`. The **guard** check
// allows it to work with `_.map`.
_.first = _.head = _.take = function(array, n, guard) {
if (array == null) return void 0;
if (n == null || guard) return array[0];
return _.initial(array, array.length - n);
};
// Returns everything but the last entry of the array. Especially useful on
// the arguments object. Passing **n** will return all the values in
// the array, excluding the last N.
_.initial = function(array, n, guard) {
return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
};
// Get the last element of an array. Passing **n** will return the last N
// values in the array.
_.last = function(array, n, guard) {
if (array == null) return void 0;
if (n == null || guard) return array[array.length - 1];
return _.rest(array, Math.max(0, array.length - n));
};
// Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
// Especially useful on the arguments object. Passing an **n** will return
// the rest N values in the array.
_.rest = _.tail = _.drop = function(array, n, guard) {
return slice.call(array, n == null || guard ? 1 : n);
};
// Trim out all falsy values from an array.
_.compact = function(array) {
return _.filter(array, _.identity);
};
// Internal implementation of a recursive `flatten` function.
var flatten = function(input, shallow, strict, startIndex) {
var output = [], idx = 0;
for (var i = startIndex || 0, length = getLength(input); i < length; i++) {
var value = input[i];
if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {
//flatten current level of array or arguments object
if (!shallow) value = flatten(value, shallow, strict);
var j = 0, len = value.length;
output.length += len;
while (j < len) {
output[idx++] = value[j++];
}
} else if (!strict) {
output[idx++] = value;
}
}
return output;
};
// Flatten out an array, either recursively (by default), or just one level.
_.flatten = function(array, shallow) {
return flatten(array, shallow, false);
};
// Return a version of the array that does not contain the specified value(s).
_.without = function(array) {
return _.difference(array, slice.call(arguments, 1));
};
// Produce a duplicate-free version of the array. If the array has already
// been sorted, you have the option of using a faster algorithm.
// Aliased as `unique`.
_.uniq = _.unique = function(array, isSorted, iteratee, context) {
if (!_.isBoolean(isSorted)) {
context = iteratee;
iteratee = isSorted;
isSorted = false;
}
if (iteratee != null) iteratee = cb(iteratee, context);
var result = [];
var seen = [];
for (var i = 0, length = getLength(array); i < length; i++) {
var value = array[i],
computed = iteratee ? iteratee(value, i, array) : value;
if (isSorted) {
if (!i || seen !== computed) result.push(value);
seen = computed;
} else if (iteratee) {
if (!_.contains(seen, computed)) {
seen.push(computed);
result.push(value);
}
} else if (!_.contains(result, value)) {
result.push(value);
}
}
return result;
};
// Produce an array that contains the union: each distinct element from all of
// the passed-in arrays.
_.union = function() {
return _.uniq(flatten(arguments, true, true));
};
// Produce an array that contains every item shared between all the
// passed-in arrays.
_.intersection = function(array) {
var result = [];
var argsLength = arguments.length;
for (var i = 0, length = getLength(array); i < length; i++) {
var item = array[i];
if (_.contains(result, item)) continue;
for (var j = 1; j < argsLength; j++) {
if (!_.contains(arguments[j], item)) break;
}
if (j === argsLength) result.push(item);
}
return result;
};
// Take the difference between one array and a number of other arrays.
// Only the elements present in just the first array will remain.
_.difference = function(array) {
var rest = flatten(arguments, true, true, 1);
return _.filter(array, function(value){
return !_.contains(rest, value);
});
};
// Zip together multiple lists into a single array -- elements that share
// an index go together.
_.zip = function() {
return _.unzip(arguments);
};
// Complement of _.zip. Unzip accepts an array of arrays and groups
// each array's elements on shared indices
_.unzip = function(array) {
var length = array && _.max(array, getLength).length || 0;
var result = Array(length);
for (var index = 0; index < length; index++) {
result[index] = _.pluck(array, index);
}
return result;
};
// Converts lists into objects. Pass either a single array of `[key, value]`
// pairs, or two parallel arrays of the same length -- one of keys, and one of
// the corresponding values.
_.object = function(list, values) {
var result = {};
for (var i = 0, length = getLength(list); i < length; i++) {
if (values) {
result[list[i]] = values[i];
} else {
result[list[i][0]] = list[i][1];
}
}
return result;
};
// Generator function to create the findIndex and findLastIndex functions
function createPredicateIndexFinder(dir) {
return function(array, predicate, context) {
predicate = cb(predicate, context);
var length = getLength(array);
var index = dir > 0 ? 0 : length - 1;
for (; index >= 0 && index < length; index += dir) {
if (predicate(array[index], index, array)) return index;
}
return -1;
};
}
// Returns the first index on an array-like that passes a predicate test
_.findIndex = createPredicateIndexFinder(1);
_.findLastIndex = createPredicateIndexFinder(-1);
// Use a comparator function to figure out the smallest index at which
// an object should be inserted so as to maintain order. Uses binary search.
_.sortedIndex = function(array, obj, iteratee, context) {
iteratee = cb(iteratee, context, 1);
var value = iteratee(obj);
var low = 0, high = getLength(array);
while (low < high) {
var mid = Math.floor((low + high) / 2);
if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
}
return low;
};
// Generator function to create the indexOf and lastIndexOf functions
function createIndexFinder(dir, predicateFind, sortedIndex) {
return function(array, item, idx) {
var i = 0, length = getLength(array);
if (typeof idx == 'number') {
if (dir > 0) {
i = idx >= 0 ? idx : Math.max(idx + length, i);
} else {
length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
}
} else if (sortedIndex && idx && length) {
idx = sortedIndex(array, item);
return array[idx] === item ? idx : -1;
}
if (item !== item) {
idx = predicateFind(slice.call(array, i, length), _.isNaN);
return idx >= 0 ? idx + i : -1;
}
for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
if (array[idx] === item) return idx;
}
return -1;
};
}
// Return the position of the first occurrence of an item in an array,
// or -1 if the item is not included in the array.
// If the array is large and already in sort order, pass `true`
// for **isSorted** to use binary search.
_.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex);
_.lastIndexOf = createIndexFinder(-1, _.findLastIndex);
// Generate an integer Array containing an arithmetic progression. A port of
// the native Python `range()` function. See
// [the Python documentation](http://docs.python.org/library/functions.html#range).
_.range = function(start, stop, step) {
if (stop == null) {
stop = start || 0;
start = 0;
}
step = step || 1;
var length = Math.max(Math.ceil((stop - start) / step), 0);
var range = Array(length);
for (var idx = 0; idx < length; idx++, start += step) {
range[idx] = start;
}
return range;
};
// Function (ahem) Functions
// ------------------
// Determines whether to execute a function as a constructor
// or a normal function with the provided arguments
var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) {
if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
var self = baseCreate(sourceFunc.prototype);
var result = sourceFunc.apply(self, args);
if (_.isObject(result)) return result;
return self;
};
// Create a function bound to a given object (assigning `this`, and arguments,
// optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
// available.
_.bind = function(func, context) {
if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');
var args = slice.call(arguments, 2);
var bound = function() {
return executeBound(func, bound, context, this, args.concat(slice.call(arguments)));
};
return bound;
};
// Partially apply a function by creating a version that has had some of its
// arguments pre-filled, without changing its dynamic `this` context. _ acts
// as a placeholder, allowing any combination of arguments to be pre-filled.
_.partial = function(func) {
var boundArgs = slice.call(arguments, 1);
var bound = function() {
var position = 0, length = boundArgs.length;
var args = Array(length);
for (var i = 0; i < length; i++) {
args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i];
}
while (position < arguments.length) args.push(arguments[position++]);
return executeBound(func, bound, this, this, args);
};
return bound;
};
// Bind a number of an object's methods to that object. Remaining arguments
// are the method names to be bound. Useful for ensuring that all callbacks
// defined on an object belong to it.
_.bindAll = function(obj) {
var i, length = arguments.length, key;
if (length <= 1) throw new Error('bindAll must be passed function names');
for (i = 1; i < length; i++) {
key = arguments[i];
obj[key] = _.bind(obj[key], obj);
}
return obj;
};
// Memoize an expensive function by storing its results.
_.memoize = function(func, hasher) {
var memoize = function(key) {
var cache = memoize.cache;
var address = '' + (hasher ? hasher.apply(this, arguments) : key);
if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
return cache[address];
};
memoize.cache = {};
return memoize;
};
// Delays a function for the given number of milliseconds, and then calls
// it with the arguments supplied.
_.delay = function(func, wait) {
var args = slice.call(arguments, 2);
return setTimeout(function(){
return func.apply(null, args);
}, wait);
};
// Defers a function, scheduling it to run after the current call stack has
// cleared.
_.defer = _.partial(_.delay, _, 1);
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time. Normally, the throttled function will run
// as much as it can, without ever going more than once per `wait` duration;
// but if you'd like to disable the execution on the leading edge, pass
// `{leading: false}`. To disable execution on the trailing edge, ditto.
_.throttle = function(func, wait, options) {
var context, args, result;
var timeout = null;
var previous = 0;
if (!options) options = {};
var later = function() {
previous = options.leading === false ? 0 : _.now();
timeout = null;
result = func.apply(context, args);
if (!timeout) context = args = null;
};
return function() {
var now = _.now();
if (!previous && options.leading === false) previous = now;
var remaining = wait - (now - previous);
context = this;
args = arguments;
if (remaining <= 0 || remaining > wait) {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
previous = now;
result = func.apply(context, args);
if (!timeout) context = args = null;
} else if (!timeout && options.trailing !== false) {
timeout = setTimeout(later, remaining);
}
return result;
};
};
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
_.debounce = function(func, wait, immediate) {
var timeout, args, context, timestamp, result;
var later = function() {
var last = _.now() - timestamp;
if (last < wait && last >= 0) {
timeout = setTimeout(later, wait - last);
} else {
timeout = null;
if (!immediate) {
result = func.apply(context, args);
if (!timeout) context = args = null;
}
}
};
return function() {
context = this;
args = arguments;
timestamp = _.now();
var callNow = immediate && !timeout;
if (!timeout) timeout = setTimeout(later, wait);
if (callNow) {
result = func.apply(context, args);
context = args = null;
}
return result;
};
};
// Returns the first function passed as an argument to the second,
// allowing you to adjust arguments, run code before and after, and
// conditionally execute the original function.
_.wrap = function(func, wrapper) {
return _.partial(wrapper, func);
};
// Returns a negated version of the passed-in predicate.
_.negate = function(predicate) {
return function() {
return !predicate.apply(this, arguments);
};
};
// Returns a function that is the composition of a list of functions, each
// consuming the return value of the function that follows.
_.compose = function() {
var args = arguments;
var start = args.length - 1;
return function() {
var i = start;
var result = args[start].apply(this, arguments);
while (i--) result = args[i].call(this, result);
return result;
};
};
// Returns a function that will only be executed on and after the Nth call.
_.after = function(times, func) {
return function() {
if (--times < 1) {
return func.apply(this, arguments);
}
};
};
// Returns a function that will only be executed up to (but not including) the Nth call.
_.before = function(times, func) {
var memo;
return function() {
if (--times > 0) {
memo = func.apply(this, arguments);
}
if (times <= 1) func = null;
return memo;
};
};
// Returns a function that will be executed at most one time, no matter how
// often you call it. Useful for lazy initialization.
_.once = _.partial(_.before, 2);
// Object Functions
// ----------------
// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
function collectNonEnumProps(obj, keys) {
var nonEnumIdx = nonEnumerableProps.length;
var constructor = obj.constructor;
var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto;
// Constructor is a special case.
var prop = 'constructor';
if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop);
while (nonEnumIdx--) {
prop = nonEnumerableProps[nonEnumIdx];
if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) {
keys.push(prop);
}
}
}
// Retrieve the names of an object's own properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`
_.keys = function(obj) {
if (!_.isObject(obj)) return [];
if (nativeKeys) return nativeKeys(obj);
var keys = [];
for (var key in obj) if (_.has(obj, key)) keys.push(key);
// Ahem, IE < 9.
if (hasEnumBug) collectNonEnumProps(obj, keys);
return keys;
};
// Retrieve all the property names of an object.
_.allKeys = function(obj) {
if (!_.isObject(obj)) return [];
var keys = [];
for (var key in obj) keys.push(key);
// Ahem, IE < 9.
if (hasEnumBug) collectNonEnumProps(obj, keys);
return keys;
};
// Retrieve the values of an object's properties.
_.values = function(obj) {
var keys = _.keys(obj);
var length = keys.length;
var values = Array(length);
for (var i = 0; i < length; i++) {
values[i] = obj[keys[i]];
}
return values;
};
// Returns the results of applying the iteratee to each element of the object
// In contrast to _.map it returns an object
_.mapObject = function(obj, iteratee, context) {
iteratee = cb(iteratee, context);
var keys = _.keys(obj),
length = keys.length,
results = {},
currentKey;
for (var index = 0; index < length; index++) {
currentKey = keys[index];
results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
}
return results;
};
// Convert an object into a list of `[key, value]` pairs.
_.pairs = function(obj) {
var keys = _.keys(obj);
var length = keys.length;
var pairs = Array(length);
for (var i = 0; i < length; i++) {
pairs[i] = [keys[i], obj[keys[i]]];
}
return pairs;
};
// Invert the keys and values of an object. The values must be serializable.
_.invert = function(obj) {
var result = {};
var keys = _.keys(obj);
for (var i = 0, length = keys.length; i < length; i++) {
result[obj[keys[i]]] = keys[i];
}
return result;
};
// Return a sorted list of the function names available on the object.
// Aliased as `methods`
_.functions = _.methods = function(obj) {
var names = [];
for (var key in obj) {
if (_.isFunction(obj[key])) names.push(key);
}
return names.sort();
};
// Extend a given object with all the properties in passed-in object(s).
_.extend = createAssigner(_.allKeys);
// Assigns a given object with all the own properties in the passed-in object(s)
// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
_.extendOwn = _.assign = createAssigner(_.keys);
// Returns the first key on an object that passes a predicate test
_.findKey = function(obj, predicate, context) {
predicate = cb(predicate, context);
var keys = _.keys(obj), key;
for (var i = 0, length = keys.length; i < length; i++) {
key = keys[i];
if (predicate(obj[key], key, obj)) return key;
}
};
// Return a copy of the object only containing the whitelisted properties.
_.pick = function(object, oiteratee, context) {
var result = {}, obj = object, iteratee, keys;
if (obj == null) return result;
if (_.isFunction(oiteratee)) {
keys = _.allKeys(obj);
iteratee = optimizeCb(oiteratee, context);
} else {
keys = flatten(arguments, false, false, 1);
iteratee = function(value, key, obj) { return key in obj; };
obj = Object(obj);
}
for (var i = 0, length = keys.length; i < length; i++) {
var key = keys[i];
var value = obj[key];
if (iteratee(value, key, obj)) result[key] = value;
}
return result;
};
// Return a copy of the object without the blacklisted properties.
_.omit = function(obj, iteratee, context) {
if (_.isFunction(iteratee)) {
iteratee = _.negate(iteratee);
} else {
var keys = _.map(flatten(arguments, false, false, 1), String);
iteratee = function(value, key) {
return !_.contains(keys, key);
};
}
return _.pick(obj, iteratee, context);
};
// Fill in a given object with default properties.
_.defaults = createAssigner(_.allKeys, true);
// Creates an object that inherits from the given prototype object.
// If additional properties are provided then they will be added to the
// created object.
_.create = function(prototype, props) {
var result = baseCreate(prototype);
if (props) _.extendOwn(result, props);
return result;
};
// Create a (shallow-cloned) duplicate of an object.
_.clone = function(obj) {
if (!_.isObject(obj)) return obj;
return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
};
// Invokes interceptor with the obj, and then returns obj.
// The primary purpose of this method is to "tap into" a method chain, in
// order to perform operations on intermediate results within the chain.
_.tap = function(obj, interceptor) {
interceptor(obj);
return obj;
};
// Returns whether an object has a given set of `key:value` pairs.
_.isMatch = function(object, attrs) {
var keys = _.keys(attrs), length = keys.length;
if (object == null) return !length;
var obj = Object(object);
for (var i = 0; i < length; i++) {
var key = keys[i];
if (attrs[key] !== obj[key] || !(key in obj)) return false;
}
return true;
};
// Internal recursive comparison function for `isEqual`.
var eq = function(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
if (a === b) return a !== 0 || 1 / a === 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
// Unwrap any wrapped objects.
if (a instanceof _) a = a._wrapped;
if (b instanceof _) b = b._wrapped;
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className !== toString.call(b)) return false;
switch (className) {
// Strings, numbers, regular expressions, dates, and booleans are compared by value.
case '[object RegExp]':
// RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
case '[object String]':
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return '' + a === '' + b;
case '[object Number]':
// `NaN`s are equivalent, but non-reflexive.
// Object(NaN) is equivalent to NaN
if (+a !== +a) return +b !== +b;
// An `egal` comparison is performed for other numeric values.
return +a === 0 ? 1 / +a === 1 / b : +a === +b;
case '[object Date]':
case '[object Boolean]':
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a === +b;
}
var areArrays = className === '[object Array]';
if (!areArrays) {
if (typeof a != 'object' || typeof b != 'object') return false;
// Objects with different constructors are not equivalent, but `Object`s or `Array`s
// from different frames are.
var aCtor = a.constructor, bCtor = b.constructor;
if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&
_.isFunction(bCtor) && bCtor instanceof bCtor)
&& ('constructor' in a && 'constructor' in b)) {
return false;
}
}
// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
// Initializing stack of traversed objects.
// It's done here since we only need them for objects and arrays comparison.
aStack = aStack || [];
bStack = bStack || [];
var length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (aStack[length] === a) return bStack[length] === b;
}
// Add the first object to the stack of traversed objects.
aStack.push(a);
bStack.push(b);
// Recursively compare objects and arrays.
if (areArrays) {
// Compare array lengths to determine if a deep comparison is necessary.
length = a.length;
if (length !== b.length) return false;
// Deep compare the contents, ignoring non-numeric properties.
while (length--) {
if (!eq(a[length], b[length], aStack, bStack)) return false;
}
} else {
// Deep compare objects.
var keys = _.keys(a), key;
length = keys.length;
// Ensure that both objects contain the same number of properties before comparing deep equality.
if (_.keys(b).length !== length) return false;
while (length--) {
// Deep compare each member
key = keys[length];
if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
}
}
// Remove the first object from the stack of traversed objects.
aStack.pop();
bStack.pop();
return true;
};
// Perform a deep comparison to check if two objects are equal.
_.isEqual = function(a, b) {
return eq(a, b);
};
// Is a given array, string, or object empty?
// An "empty" object has no enumerable own-properties.
_.isEmpty = function(obj) {
if (obj == null) return true;
if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0;
return _.keys(obj).length === 0;
};
// Is a given value a DOM element?
_.isElement = function(obj) {
return !!(obj && obj.nodeType === 1);
};
// Is a given value an array?
// Delegates to ECMA5's native Array.isArray
_.isArray = nativeIsArray || function(obj) {
return toString.call(obj) === '[object Array]';
};
// Is a given variable an object?
_.isObject = function(obj) {
var type = typeof obj;
return type === 'function' || type === 'object' && !!obj;
};
// Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError.
_.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) {
_['is' + name] = function(obj) {
return toString.call(obj) === '[object ' + name + ']';
};
});
// Define a fallback version of the method in browsers (ahem, IE < 9), where
// there isn't any inspectable "Arguments" type.
if (!_.isArguments(arguments)) {
_.isArguments = function(obj) {
return _.has(obj, 'callee');
};
}
// Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8,
// IE 11 (#1621), and in Safari 8 (#1929).
if (typeof /./ != 'function' && typeof Int8Array != 'object') {
_.isFunction = function(obj) {
return typeof obj == 'function' || false;
};
}
// Is a given object a finite number?
_.isFinite = function(obj) {
return isFinite(obj) && !isNaN(parseFloat(obj));
};
// Is the given value `NaN`? (NaN is the only number which does not equal itself).
_.isNaN = function(obj) {
return _.isNumber(obj) && obj !== +obj;
};
// Is a given value a boolean?
_.isBoolean = function(obj) {
return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
};
// Is a given value equal to null?
_.isNull = function(obj) {
return obj === null;
};
// Is a given variable undefined?
_.isUndefined = function(obj) {
return obj === void 0;
};
// Shortcut function for checking if an object has a given property directly
// on itself (in other words, not on a prototype).
_.has = function(obj, key) {
return obj != null && hasOwnProperty.call(obj, key);
};
// Utility Functions
// -----------------
// Run Underscore.js in *noConflict* mode, returning the `_` variable to its
// previous owner. Returns a reference to the Underscore object.
_.noConflict = function() {
root._ = previousUnderscore;
return this;
};
// Keep the identity function around for default iteratees.
_.identity = function(value) {
return value;
};
// Predicate-generating functions. Often useful outside of Underscore.
_.constant = function(value) {
return function() {
return value;
};
};
_.noop = function(){};
_.property = property;
// Generates a function for a given object that returns a given property.
_.propertyOf = function(obj) {
return obj == null ? function(){} : function(key) {
return obj[key];
};
};
// Returns a predicate for checking whether an object has a given set of
// `key:value` pairs.
_.matcher = _.matches = function(attrs) {
attrs = _.extendOwn({}, attrs);
return function(obj) {
return _.isMatch(obj, attrs);
};
};
// Run a function **n** times.
_.times = function(n, iteratee, context) {
var accum = Array(Math.max(0, n));
iteratee = optimizeCb(iteratee, context, 1);
for (var i = 0; i < n; i++) accum[i] = iteratee(i);
return accum;
};
// Return a random integer between min and max (inclusive).
_.random = function(min, max) {
if (max == null) {
max = min;
min = 0;
}
return min + Math.floor(Math.random() * (max - min + 1));
};
// A (possibly faster) way to get the current timestamp as an integer.
_.now = Date.now || function() {
return new Date().getTime();
};
// List of HTML entities for escaping.
var escapeMap = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
'`': '`'
};
var unescapeMap = _.invert(escapeMap);
// Functions for escaping and unescaping strings to/from HTML interpolation.
var createEscaper = function(map) {
var escaper = function(match) {
return map[match];
};
// Regexes for identifying a key that needs to be escaped
var source = '(?:' + _.keys(map).join('|') + ')';
var testRegexp = RegExp(source);
var replaceRegexp = RegExp(source, 'g');
return function(string) {
string = string == null ? '' : '' + string;
return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
};
};
_.escape = createEscaper(escapeMap);
_.unescape = createEscaper(unescapeMap);
// If the value of the named `property` is a function then invoke it with the
// `object` as context; otherwise, return it.
_.result = function(object, property, fallback) {
var value = object == null ? void 0 : object[property];
if (value === void 0) {
value = fallback;
}
return _.isFunction(value) ? value.call(object) : value;
};
// Generate a unique integer id (unique within the entire client session).
// Useful for temporary DOM ids.
var idCounter = 0;
_.uniqueId = function(prefix) {
var id = ++idCounter + '';
return prefix ? prefix + id : id;
};
// By default, Underscore uses ERB-style template delimiters, change the
// following template settings to use alternative delimiters.
_.templateSettings = {
evaluate : /<%([\s\S]+?)%>/g,
interpolate : /<%=([\s\S]+?)%>/g,
escape : /<%-([\s\S]+?)%>/g
};
// When customizing `templateSettings`, if you don't want to define an
// interpolation, evaluation or escaping regex, we need one that is
// guaranteed not to match.
var noMatch = /(.)^/;
// Certain characters need to be escaped so that they can be put into a
// string literal.
var escapes = {
"'": "'",
'\\': '\\',
'\r': 'r',
'\n': 'n',
'\u2028': 'u2028',
'\u2029': 'u2029'
};
var escaper = /\\|'|\r|\n|\u2028|\u2029/g;
var escapeChar = function(match) {
return '\\' + escapes[match];
};
// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
// and correctly escapes quotes within interpolated code.
// NB: `oldSettings` only exists for backwards compatibility.
_.template = function(text, settings, oldSettings) {
if (!settings && oldSettings) settings = oldSettings;
settings = _.defaults({}, settings, _.templateSettings);
// Combine delimiters into one regular expression via alternation.
var matcher = RegExp([
(settings.escape || noMatch).source,
(settings.interpolate || noMatch).source,
(settings.evaluate || noMatch).source
].join('|') + '|$', 'g');
// Compile the template source, escaping string literals appropriately.
var index = 0;
var source = "__p+='";
text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
source += text.slice(index, offset).replace(escaper, escapeChar);
index = offset + match.length;
if (escape) {
source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
} else if (interpolate) {
source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
} else if (evaluate) {
source += "';\n" + evaluate + "\n__p+='";
}
// Adobe VMs need the match returned to produce the correct offest.
return match;
});
source += "';\n";
// If a variable is not specified, place data values in local scope.
if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
source = "var __t,__p='',__j=Array.prototype.join," +
"print=function(){__p+=__j.call(arguments,'');};\n" +
source + 'return __p;\n';
try {
var render = new Function(settings.variable || 'obj', '_', source);
} catch (e) {
e.source = source;
throw e;
}
var template = function(data) {
return render.call(this, data, _);
};
// Provide the compiled source as a convenience for precompilation.
var argument = settings.variable || 'obj';
template.source = 'function(' + argument + '){\n' + source + '}';
return template;
};
// Add a "chain" function. Start chaining a wrapped Underscore object.
_.chain = function(obj) {
var instance = _(obj);
instance._chain = true;
return instance;
};
// OOP
// ---------------
// If Underscore is called as a function, it returns a wrapped object that
// can be used OO-style. This wrapper holds altered versions of all the
// underscore functions. Wrapped objects may be chained.
// Helper function to continue chaining intermediate results.
var result = function(instance, obj) {
return instance._chain ? _(obj).chain() : obj;
};
// Add your own custom functions to the Underscore object.
_.mixin = function(obj) {
_.each(_.functions(obj), function(name) {
var func = _[name] = obj[name];
_.prototype[name] = function() {
var args = [this._wrapped];
push.apply(args, arguments);
return result(this, func.apply(_, args));
};
});
};
// Add all of the Underscore functions to the wrapper object.
_.mixin(_);
// Add all mutator Array functions to the wrapper.
_.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
var method = ArrayProto[name];
_.prototype[name] = function() {
var obj = this._wrapped;
method.apply(obj, arguments);
if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0];
return result(this, obj);
};
});
// Add all accessor Array functions to the wrapper.
_.each(['concat', 'join', 'slice'], function(name) {
var method = ArrayProto[name];
_.prototype[name] = function() {
return result(this, method.apply(this._wrapped, arguments));
};
});
// Extracts the result from a wrapped and chained object.
_.prototype.value = function() {
return this._wrapped;
};
// Provide unwrapping proxy for some methods used in engine operations
// such as arithmetic and JSON stringification.
_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
_.prototype.toString = function() {
return '' + this._wrapped;
};
// AMD registration happens at the end for compatibility with AMD loaders
// that may not enforce next-turn semantics on modules. Even though general
// practice for AMD registration is to be anonymous, underscore registers
// as a named module because, like jQuery, it is a base library that is
// popular enough to be bundled in a third party lib, but not be part of
// an AMD load request. Those cases could generate an error when an
// anonymous define() is called outside of a loader request.
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
return _;
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
}.call(this));
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(global) {// Backbone.js 1.3.3
// (c) 2010-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Backbone may be freely distributed under the MIT license.
// For all details and documentation:
// http://backbonejs.org
(function(factory) {
// Establish the root object, `window` (`self`) in the browser, or `global` on the server.
// We use `self` instead of `window` for `WebWorker` support.
var root = (typeof self == 'object' && self.self === self && self) ||
(typeof global == 'object' && global.global === global && global);
// Set up Backbone appropriately for the environment. Start with AMD.
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(4), exports], __WEBPACK_AMD_DEFINE_RESULT__ = function(_, $, exports) {
// Export global even in AMD case in case this script is loaded with
// others that may still expect a global Backbone.
root.Backbone = factory(root, exports, _, $);
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
// Next for Node.js or CommonJS. jQuery may not be needed as a module.
} else if (typeof exports !== 'undefined') {
var _ = __webpack_require__(2), $;
try { $ = __webpack_require__(4); } catch (e) {}
factory(root, exports, _, $);
// Finally, as a browser global.
} else {
root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
}
})(function(root, Backbone, _, $) {
// Initial Setup
// -------------
// Save the previous value of the `Backbone` variable, so that it can be
// restored later on, if `noConflict` is used.
var previousBackbone = root.Backbone;
// Create a local reference to a common array method we'll want to use later.
var slice = Array.prototype.slice;
// Current version of the library. Keep in sync with `package.json`.
Backbone.VERSION = '1.3.3';
// For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
// the `$` variable.
Backbone.$ = $;
// Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
// to its previous owner. Returns a reference to this Backbone object.
Backbone.noConflict = function() {
root.Backbone = previousBackbone;
return this;
};
// Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option
// will fake `"PATCH"`, `"PUT"` and `"DELETE"` requests via the `_method` parameter and
// set a `X-Http-Method-Override` header.
Backbone.emulateHTTP = false;
// Turn on `emulateJSON` to support legacy servers that can't deal with direct
// `application/json` requests ... this will encode the body as
// `application/x-www-form-urlencoded` instead and will send the model in a
// form param named `model`.
Backbone.emulateJSON = false;
// Proxy Backbone class methods to Underscore functions, wrapping the model's
// `attributes` object or collection's `models` array behind the scenes.
//
// collection.filter(function(model) { return model.get('age') > 10 });
// collection.each(this.addView);
//
// `Function#apply` can be slow so we use the method's arg count, if we know it.
var addMethod = function(length, method, attribute) {
switch (length) {
case 1: return function() {
return _[method](this[attribute]);
};
case 2: return function(value) {
return _[method](this[attribute], value);
};
case 3: return function(iteratee, context) {
return _[method](this[attribute], cb(iteratee, this), context);
};
case 4: return function(iteratee, defaultVal, context) {
return _[method](this[attribute], cb(iteratee, this), defaultVal, context);
};
default: return function() {
var args = slice.call(arguments);
args.unshift(this[attribute]);
return _[method].apply(_, args);
};
}
};
var addUnderscoreMethods = function(Class, methods, attribute) {
_.each(methods, function(length, method) {
if (_[method]) Class.prototype[method] = addMethod(length, method, attribute);
});
};
// Support `collection.sortBy('attr')` and `collection.findWhere({id: 1})`.
var cb = function(iteratee, instance) {
if (_.isFunction(iteratee)) return iteratee;
if (_.isObject(iteratee) && !instance._isModel(iteratee)) return modelMatcher(iteratee);
if (_.isString(iteratee)) return function(model) { return model.get(iteratee); };
return iteratee;
};
var modelMatcher = function(attrs) {
var matcher = _.matches(attrs);
return function(model) {
return matcher(model.attributes);
};
};
// Backbone.Events
// ---------------
// A module that can be mixed in to *any object* in order to provide it with
// a custom event channel. You may bind a callback to an event with `on` or
// remove with `off`; `trigger`-ing an event fires all callbacks in
// succession.
//
// var object = {};
// _.extend(object, Backbone.Events);
// object.on('expand', function(){ alert('expanded'); });
// object.trigger('expand');
//
var Events = Backbone.Events = {};
// Regular expression used to split event strings.
var eventSplitter = /\s+/;
// Iterates over the standard `event, callback` (as well as the fancy multiple
// space-separated events `"change blur", callback` and jQuery-style event
// maps `{event: callback}`).
var eventsApi = function(iteratee, events, name, callback, opts) {
var i = 0, names;
if (name && typeof name === 'object') {
// Handle event maps.
if (callback !== void 0 && 'context' in opts && opts.context === void 0) opts.context = callback;
for (names = _.keys(name); i < names.length ; i++) {
events = eventsApi(iteratee, events, names[i], name[names[i]], opts);
}
} else if (name && eventSplitter.test(name)) {
// Handle space-separated event names by delegating them individually.
for (names = name.split(eventSplitter); i < names.length; i++) {
events = iteratee(events, names[i], callback, opts);
}
} else {
// Finally, standard events.
events = iteratee(events, name, callback, opts);
}
return events;
};
// Bind an event to a `callback` function. Passing `"all"` will bind
// the callback to all events fired.
Events.on = function(name, callback, context) {
return internalOn(this, name, callback, context);
};
// Guard the `listening` argument from the public API.
var internalOn = function(obj, name, callback, context, listening) {
obj._events = eventsApi(onApi, obj._events || {}, name, callback, {
context: context,
ctx: obj,
listening: listening
});
if (listening) {
var listeners = obj._listeners || (obj._listeners = {});
listeners[listening.id] = listening;
}
return obj;
};
// Inversion-of-control versions of `on`. Tell *this* object to listen to
// an event in another object... keeping track of what it's listening to
// for easier unbinding later.
Events.listenTo = function(obj, name, callback) {
if (!obj) return this;
var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
var listeningTo = this._listeningTo || (this._listeningTo = {});
var listening = listeningTo[id];
// This object is not listening to any other events on `obj` yet.
// Setup the necessary references to track the listening callbacks.
if (!listening) {
var thisId = this._listenId || (this._listenId = _.uniqueId('l'));
listening = listeningTo[id] = {obj: obj, objId: id, id: thisId, listeningTo: listeningTo, count: 0};
}
// Bind callbacks on obj, and keep track of them on listening.
internalOn(obj, name, callback, this, listening);
return this;
};
// The reducing API that adds a callback to the `events` object.
var onApi = function(events, name, callback, options) {
if (callback) {
var handlers = events[name] || (events[name] = []);
var context = options.context, ctx = options.ctx, listening = options.listening;
if (listening) listening.count++;
handlers.push({callback: callback, context: context, ctx: context || ctx, listening: listening});
}
return events;
};
// Remove one or many callbacks. If `context` is null, removes all
// callbacks with that function. If `callback` is null, removes all
// callbacks for the event. If `name` is null, removes all bound
// callbacks for all events.
Events.off = function(name, callback, context) {
if (!this._events) return this;
this._events = eventsApi(offApi, this._events, name, callback, {
context: context,
listeners: this._listeners
});
return this;
};
// Tell this object to stop listening to either specific events ... or
// to every object it's currently listening to.
Events.stopListening = function(obj, name, callback) {
var listeningTo = this._listeningTo;
if (!listeningTo) return this;
var ids = obj ? [obj._listenId] : _.keys(listeningTo);
for (var i = 0; i < ids.length; i++) {
var listening = listeningTo[ids[i]];
// If listening doesn't exist, this object is not currently
// listening to obj. Break out early.
if (!listening) break;
listening.obj.off(name, callback, this);
}
return this;
};
// The reducing API that removes a callback from the `events` object.
var offApi = function(events, name, callback, options) {
if (!events) return;
var i = 0, listening;
var context = options.context, listeners = options.listeners;
// Delete all events listeners and "drop" events.
if (!name && !callback && !context) {
var ids = _.keys(listeners);
for (; i < ids.length; i++) {
listening = listeners[ids[i]];
delete listeners[listening.id];
delete listening.listeningTo[listening.objId];
}
return;
}
var names = name ? [name] : _.keys(events);
for (; i < names.length; i++) {
name = names[i];
var handlers = events[name];
// Bail out if there are no events stored.
if (!handlers) break;
// Replace events if there are any remaining. Otherwise, clean up.
var remaining = [];
for (var j = 0; j < handlers.length; j++) {
var handler = handlers[j];
if (
callback && callback !== handler.callback &&
callback !== handler.callback._callback ||
context && context !== handler.context
) {
remaining.push(handler);
} else {
listening = handler.listening;
if (listening && --listening.count === 0) {
delete listeners[listening.id];
delete listening.listeningTo[listening.objId];
}
}
}
// Update tail event if the list has any events. Otherwise, clean up.
if (remaining.length) {
events[name] = remaining;
} else {
delete events[name];
}
}
return events;
};
// Bind an event to only be triggered a single time. After the first time
// the callback is invoked, its listener will be removed. If multiple events
// are passed in using the space-separated syntax, the handler will fire
// once for each event, not once for a combination of all events.
Events.once = function(name, callback, context) {
// Map the event into a `{event: once}` object.
var events = eventsApi(onceMap, {}, name, callback, _.bind(this.off, this));
if (typeof name === 'string' && context == null) callback = void 0;
return this.on(events, callback, context);
};
// Inversion-of-control versions of `once`.
Events.listenToOnce = function(obj, name, callback) {
// Map the event into a `{event: once}` object.
var events = eventsApi(onceMap, {}, name, callback, _.bind(this.stopListening, this, obj));
return this.listenTo(obj, events);
};
// Reduces the event callbacks into a map of `{event: onceWrapper}`.
// `offer` unbinds the `onceWrapper` after it has been called.
var onceMap = function(map, name, callback, offer) {
if (callback) {
var once = map[name] = _.once(function() {
offer(name, once);
callback.apply(this, arguments);
});
once._callback = callback;
}
return map;
};
// Trigger one or many events, firing all bound callbacks. Callbacks are
// passed the same arguments as `trigger` is, apart from the event name
// (unless you're listening on `"all"`, which will cause your callback to
// receive the true name of the event as the first argument).
Events.trigger = function(name) {
if (!this._events) return this;
var length = Math.max(0, arguments.length - 1);
var args = Array(length);
for (var i = 0; i < length; i++) args[i] = arguments[i + 1];
eventsApi(triggerApi, this._events, name, void 0, args);
return this;
};
// Handles triggering the appropriate event callbacks.
var triggerApi = function(objEvents, name, callback, args) {
if (objEvents) {
var events = objEvents[name];
var allEvents = objEvents.all;
if (events && allEvents) allEvents = allEvents.slice();
if (events) triggerEvents(events, args);
if (allEvents) triggerEvents(allEvents, [name].concat(args));
}
return objEvents;
};
// A difficult-to-believe, but optimized internal dispatch function for
// triggering events. Tries to keep the usual cases speedy (most internal
// Backbone events have 3 arguments).
var triggerEvents = function(events, args) {
var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];
switch (args.length) {
case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;
case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;
case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;
case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;
default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;
}
};
// Aliases for backwards compatibility.
Events.bind = Events.on;
Events.unbind = Events.off;
// Allow the `Backbone` object to serve as a global event bus, for folks who
// want global "pubsub" in a convenient place.
_.extend(Backbone, Events);
// Backbone.Model
// --------------
// Backbone **Models** are the basic data object in the framework --
// frequently representing a row in a table in a database on your server.
// A discrete chunk of data and a bunch of useful, related methods for
// performing computations and transformations on that data.
// Create a new model with the specified attributes. A client id (`cid`)
// is automatically generated and assigned for you.
var Model = Backbone.Model = function(attributes, options) {
var attrs = attributes || {};
options || (options = {});
this.cid = _.uniqueId(this.cidPrefix);
this.attributes = {};
if (options.collection) this.collection = options.collection;
if (options.parse) attrs = this.parse(attrs, options) || {};
var defaults = _.result(this, 'defaults');
attrs = _.defaults(_.extend({}, defaults, attrs), defaults);
this.set(attrs, options);
this.changed = {};
this.initialize.apply(this, arguments);
};
// Attach all inheritable methods to the Model prototype.
_.extend(Model.prototype, Events, {
// A hash of attributes whose current and previous value differ.
changed: null,
// The value returned during the last failed validation.
validationError: null,
// The default name for the JSON `id` attribute is `"id"`. MongoDB and
// CouchDB users may want to set this to `"_id"`.
idAttribute: 'id',
// The prefix is used to create the client id which is used to identify models locally.
// You may want to override this if you're experiencing name clashes with model ids.
cidPrefix: 'c',
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// Return a copy of the model's `attributes` object.
toJSON: function(options) {
return _.clone(this.attributes);
},
// Proxy `Backbone.sync` by default -- but override this if you need
// custom syncing semantics for *this* particular model.
sync: function() {
return Backbone.sync.apply(this, arguments);
},
// Get the value of an attribute.
get: function(attr) {
return this.attributes[attr];
},
// Get the HTML-escaped value of an attribute.
escape: function(attr) {
return _.escape(this.get(attr));
},
// Returns `true` if the attribute contains a value that is not null
// or undefined.
has: function(attr) {
return this.get(attr) != null;
},
// Special-cased proxy to underscore's `_.matches` method.
matches: function(attrs) {
return !!_.iteratee(attrs, this)(this.attributes);
},
// Set a hash of model attributes on the object, firing `"change"`. This is
// the core primitive operation of a model, updating the data and notifying
// anyone who needs to know about the change in state. The heart of the beast.
set: function(key, val, options) {
if (key == null) return this;
// Handle both `"key", value` and `{key: value}` -style arguments.
var attrs;
if (typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
options || (options = {});
// Run validation.
if (!this._validate(attrs, options)) return false;
// Extract attributes and options.
var unset = options.unset;
var silent = options.silent;
var changes = [];
var changing = this._changing;
this._changing = true;
if (!changing) {
this._previousAttributes = _.clone(this.attributes);
this.changed = {};
}
var current = this.attributes;
var changed = this.changed;
var prev = this._previousAttributes;
// For each `set` attribute, update or delete the current value.
for (var attr in attrs) {
val = attrs[attr];
if (!_.isEqual(current[attr], val)) changes.push(attr);
if (!_.isEqual(prev[attr], val)) {
changed[attr] = val;
} else {
delete changed[attr];
}
unset ? delete current[attr] : current[attr] = val;
}
// Update the `id`.
if (this.idAttribute in attrs) this.id = this.get(this.idAttribute);
// Trigger all relevant attribute changes.
if (!silent) {
if (changes.length) this._pending = options;
for (var i = 0; i < changes.length; i++) {
this.trigger('change:' + changes[i], this, current[changes[i]], options);
}
}
// You might be wondering why there's a `while` loop here. Changes can
// be recursively nested within `"change"` events.
if (changing) return this;
if (!silent) {
while (this._pending) {
options = this._pending;
this._pending = false;
this.trigger('change', this, options);
}
}
this._pending = false;
this._changing = false;
return this;
},
// Remove an attribute from the model, firing `"change"`. `unset` is a noop
// if the attribute doesn't exist.
unset: function(attr, options) {
return this.set(attr, void 0, _.extend({}, options, {unset: true}));
},
// Clear all attributes on the model, firing `"change"`.
clear: function(options) {
var attrs = {};
for (var key in this.attributes) attrs[key] = void 0;
return this.set(attrs, _.extend({}, options, {unset: true}));
},
// Determine if the model has changed since the last `"change"` event.
// If you specify an attribute name, determine if that attribute has changed.
hasChanged: function(attr) {
if (attr == null) return !_.isEmpty(this.changed);
return _.has(this.changed, attr);
},
// Return an object containing all the attributes that have changed, or
// false if there are no changed attributes. Useful for determining what
// parts of a view need to be updated and/or what attributes need to be
// persisted to the server. Unset attributes will be set to undefined.
// You can also pass an attributes object to diff against the model,
// determining if there *would be* a change.
changedAttributes: function(diff) {
if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;
var old = this._changing ? this._previousAttributes : this.attributes;
var changed = {};
for (var attr in diff) {
var val = diff[attr];
if (_.isEqual(old[attr], val)) continue;
changed[attr] = val;
}
return _.size(changed) ? changed : false;
},
// Get the previous value of an attribute, recorded at the time the last
// `"change"` event was fired.
previous: function(attr) {
if (attr == null || !this._previousAttributes) return null;
return this._previousAttributes[attr];
},
// Get all of the attributes of the model at the time of the previous
// `"change"` event.
previousAttributes: function() {
return _.clone(this._previousAttributes);
},
// Fetch the model from the server, merging the response with the model's
// local attributes. Any changed attributes will trigger a "change" event.
fetch: function(options) {
options = _.extend({parse: true}, options);
var model = this;
var success = options.success;
options.success = function(resp) {
var serverAttrs = options.parse ? model.parse(resp, options) : resp;
if (!model.set(serverAttrs, options)) return false;
if (success) success.call(options.context, model, resp, options);
model.trigger('sync', model, resp, options);
};
wrapError(this, options);
return this.sync('read', this, options);
},
// Set a hash of model attributes, and sync the model to the server.
// If the server returns an attributes hash that differs, the model's
// state will be `set` again.
save: function(key, val, options) {
// Handle both `"key", value` and `{key: value}` -style arguments.
var attrs;
if (key == null || typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
options = _.extend({validate: true, parse: true}, options);
var wait = options.wait;
// If we're not waiting and attributes exist, save acts as
// `set(attr).save(null, opts)` with validation. Otherwise, check if
// the model will be valid when the attributes, if any, are set.
if (attrs && !wait) {
if (!this.set(attrs, options)) return false;
} else if (!this._validate(attrs, options)) {
return false;
}
// After a successful server-side save, the client is (optionally)
// updated with the server-side state.
var model = this;
var success = options.success;
var attributes = this.attributes;
options.success = function(resp) {
// Ensure attributes are restored during synchronous saves.
model.attributes = attributes;
var serverAttrs = options.parse ? model.parse(resp, options) : resp;
if (wait) serverAttrs = _.extend({}, attrs, serverAttrs);
if (serverAttrs && !model.set(serverAttrs, options)) return false;
if (success) success.call(options.context, model, resp, options);
model.trigger('sync', model, resp, options);
};
wrapError(this, options);
// Set temporary attributes if `{wait: true}` to properly find new ids.
if (attrs && wait) this.attributes = _.extend({}, attributes, attrs);
var method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
if (method === 'patch' && !options.attrs) options.attrs = attrs;
var xhr = this.sync(method, this, options);
// Restore attributes.
this.attributes = attributes;
return xhr;
},
// Destroy this model on the server if it was already persisted.
// Optimistically removes the model from its collection, if it has one.
// If `wait: true` is passed, waits for the server to respond before removal.
destroy: function(options) {
options = options ? _.clone(options) : {};
var model = this;
var success = options.success;
var wait = options.wait;
var destroy = function() {
model.stopListening();
model.trigger('destroy', model, model.collection, options);
};
options.success = function(resp) {
if (wait) destroy();
if (success) success.call(options.context, model, resp, options);
if (!model.isNew()) model.trigger('sync', model, resp, options);
};
var xhr = false;
if (this.isNew()) {
_.defer(options.success);
} else {
wrapError(this, options);
xhr = this.sync('delete', this, options);
}
if (!wait) destroy();
return xhr;
},
// Default URL for the model's representation on the server -- if you're
// using Backbone's restful methods, override this to change the endpoint
// that will be called.
url: function() {
var base =
_.result(this, 'urlRoot') ||
_.result(this.collection, 'url') ||
urlError();
if (this.isNew()) return base;
var id = this.get(this.idAttribute);
return base.replace(/[^\/]$/, '$&/') + encodeURIComponent(id);
},
// **parse** converts a response into the hash of attributes to be `set` on
// the model. The default implementation is just to pass the response along.
parse: function(resp, options) {
return resp;
},
// Create a new model with identical attributes to this one.
clone: function() {
return new this.constructor(this.attributes);
},
// A model is new if it has never been saved to the server, and lacks an id.
isNew: function() {
return !this.has(this.idAttribute);
},
// Check if the model is currently in a valid state.
isValid: function(options) {
return this._validate({}, _.extend({}, options, {validate: true}));
},
// Run validation against the next complete set of model attributes,
// returning `true` if all is well. Otherwise, fire an `"invalid"` event.
_validate: function(attrs, options) {
if (!options.validate || !this.validate) return true;
attrs = _.extend({}, this.attributes, attrs);
var error = this.validationError = this.validate(attrs, options) || null;
if (!error) return true;
this.trigger('invalid', this, error, _.extend(options, {validationError: error}));
return false;
}
});
// Underscore methods that we want to implement on the Model, mapped to the
// number of arguments they take.
var modelMethods = {keys: 1, values: 1, pairs: 1, invert: 1, pick: 0,
omit: 0, chain: 1, isEmpty: 1};
// Mix in each Underscore method as a proxy to `Model#attributes`.
addUnderscoreMethods(Model, modelMethods, 'attributes');
// Backbone.Collection
// -------------------
// If models tend to represent a single row of data, a Backbone Collection is
// more analogous to a table full of data ... or a small slice or page of that
// table, or a collection of rows that belong together for a particular reason
// -- all of the messages in this particular folder, all of the documents
// belonging to this particular author, and so on. Collections maintain
// indexes of their models, both in order, and for lookup by `id`.
// Create a new **Collection**, perhaps to contain a specific type of `model`.
// If a `comparator` is specified, the Collection will maintain
// its models in sort order, as they're added and removed.
var Collection = Backbone.Collection = function(models, options) {
options || (options = {});
if (options.model) this.model = options.model;
if (options.comparator !== void 0) this.comparator = options.comparator;
this._reset();
this.initialize.apply(this, arguments);
if (models) this.reset(models, _.extend({silent: true}, options));
};
// Default options for `Collection#set`.
var setOptions = {add: true, remove: true, merge: true};
var addOptions = {add: true, remove: false};
// Splices `insert` into `array` at index `at`.
var splice = function(array, insert, at) {
at = Math.min(Math.max(at, 0), array.length);
var tail = Array(array.length - at);
var length = insert.length;
var i;
for (i = 0; i < tail.length; i++) tail[i] = array[i + at];
for (i = 0; i < length; i++) array[i + at] = insert[i];
for (i = 0; i < tail.length; i++) array[i + length + at] = tail[i];
};
// Define the Collection's inheritable methods.
_.extend(Collection.prototype, Events, {
// The default model for a collection is just a **Backbone.Model**.
// This should be overridden in most cases.
model: Model,
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// The JSON representation of a Collection is an array of the
// models' attributes.
toJSON: function(options) {
return this.map(function(model) { return model.toJSON(options); });
},
// Proxy `Backbone.sync` by default.
sync: function() {
return Backbone.sync.apply(this, arguments);
},
// Add a model, or list of models to the set. `models` may be Backbone
// Models or raw JavaScript objects to be converted to Models, or any
// combination of the two.
add: function(models, options) {
return this.set(models, _.extend({merge: false}, options, addOptions));
},
// Remove a model, or a list of models from the set.
remove: function(models, options) {
options = _.extend({}, options);
var singular = !_.isArray(models);
models = singular ? [models] : models.slice();
var removed = this._removeModels(models, options);
if (!options.silent && removed.length) {
options.changes = {added: [], merged: [], removed: removed};
this.trigger('update', this, options);
}
return singular ? removed[0] : removed;
},
// Update a collection by `set`-ing a new list of models, adding new ones,
// removing models that are no longer present, and merging models that
// already exist in the collection, as necessary. Similar to **Model#set**,
// the core operation for updating the data contained by the collection.
set: function(models, options) {
if (models == null) return;
options = _.extend({}, setOptions, options);
if (options.parse && !this._isModel(models)) {
models = this.parse(models, options) || [];
}
var singular = !_.isArray(models);
models = singular ? [models] : models.slice();
var at = options.at;
if (at != null) at = +at;
if (at > this.length) at = this.length;
if (at < 0) at += this.length + 1;
var set = [];
var toAdd = [];
var toMerge = [];
var toRemove = [];
var modelMap = {};
var add = options.add;
var merge = options.merge;
var remove = options.remove;
var sort = false;
var sortable = this.comparator && at == null && options.sort !== false;
var sortAttr = _.isString(this.comparator) ? this.comparator : null;
// Turn bare objects into model references, and prevent invalid models
// from being added.
var model, i;
for (i = 0; i < models.length; i++) {
model = models[i];
// If a duplicate is found, prevent it from being added and
// optionally merge it into the existing model.
var existing = this.get(model);
if (existing) {
if (merge && model !== existing) {
var attrs = this._isModel(model) ? model.attributes : model;
if (options.parse) attrs = existing.parse(attrs, options);
existing.set(attrs, options);
toMerge.push(existing);
if (sortable && !sort) sort = existing.hasChanged(sortAttr);
}
if (!modelMap[existing.cid]) {
modelMap[existing.cid] = true;
set.push(existing);
}
models[i] = existing;
// If this is a new, valid model, push it to the `toAdd` list.
} else if (add) {
model = models[i] = this._prepareModel(model, options);
if (model) {
toAdd.push(model);
this._addReference(model, options);
modelMap[model.cid] = true;
set.push(model);
}
}
}
// Remove stale models.
if (remove) {
for (i = 0; i < this.length; i++) {
model = this.models[i];
if (!modelMap[model.cid]) toRemove.push(model);
}
if (toRemove.length) this._removeModels(toRemove, options);
}
// See if sorting is needed, update `length` and splice in new models.
var orderChanged = false;
var replace = !sortable && add && remove;
if (set.length && replace) {
orderChanged = this.length !== set.length || _.some(this.models, function(m, index) {
return m !== set[index];
});
this.models.length = 0;
splice(this.models, set, 0);
this.length = this.models.length;
} else if (toAdd.length) {
if (sortable) sort = true;
splice(this.models, toAdd, at == null ? this.length : at);
this.length = this.models.length;
}
// Silently sort the collection if appropriate.
if (sort) this.sort({silent: true});
// Unless silenced, it's time to fire all appropriate add/sort/update events.
if (!options.silent) {
for (i = 0; i < toAdd.length; i++) {
if (at != null) options.index = at + i;
model = toAdd[i];
model.trigger('add', model, this, options);
}
if (sort || orderChanged) this.trigger('sort', this, options);
if (toAdd.length || toRemove.length || toMerge.length) {
options.changes = {
added: toAdd,
removed: toRemove,
merged: toMerge
};
this.trigger('update', this, options);
}
}
// Return the added (or merged) model (or models).
return singular ? models[0] : models;
},
// When you have more items than you want to add or remove individually,
// you can reset the entire set with a new list of models, without firing
// any granular `add` or `remove` events. Fires `reset` when finished.
// Useful for bulk operations and optimizations.
reset: function(models, options) {
options = options ? _.clone(options) : {};
for (var i = 0; i < this.models.length; i++) {
this._removeReference(this.models[i], options);
}
options.previousModels = this.models;
this._reset();
models = this.add(models, _.extend({silent: true}, options));
if (!options.silent) this.trigger('reset', this, options);
return models;
},
// Add a model to the end of the collection.
push: function(model, options) {
return this.add(model, _.extend({at: this.length}, options));
},
// Remove a model from the end of the collection.
pop: function(options) {
var model = this.at(this.length - 1);
return this.remove(model, options);
},
// Add a model to the beginning of the collection.
unshift: function(model, options) {
return this.add(model, _.extend({at: 0}, options));
},
// Remove a model from the beginning of the collection.
shift: function(options) {
var model = this.at(0);
return this.remove(model, options);
},
// Slice out a sub-array of models from the collection.
slice: function() {
return slice.apply(this.models, arguments);
},
// Get a model from the set by id, cid, model object with id or cid
// properties, or an attributes object that is transformed through modelId.
get: function(obj) {
if (obj == null) return void 0;
return this._byId[obj] ||
this._byId[this.modelId(obj.attributes || obj)] ||
obj.cid && this._byId[obj.cid];
},
// Returns `true` if the model is in the collection.
has: function(obj) {
return this.get(obj) != null;
},
// Get the model at the given index.
at: function(index) {
if (index < 0) index += this.length;
return this.models[index];
},
// Return models with matching attributes. Useful for simple cases of
// `filter`.
where: function(attrs, first) {
return this[first ? 'find' : 'filter'](attrs);
},
// Return the first model with matching attributes. Useful for simple cases
// of `find`.
findWhere: function(attrs) {
return this.where(attrs, true);
},
// Force the collection to re-sort itself. You don't need to call this under
// normal circumstances, as the set will maintain sort order as each item
// is added.
sort: function(options) {
var comparator = this.comparator;
if (!comparator) throw new Error('Cannot sort a set without a comparator');
options || (options = {});
var length = comparator.length;
if (_.isFunction(comparator)) comparator = _.bind(comparator, this);
// Run sort based on type of `comparator`.
if (length === 1 || _.isString(comparator)) {
this.models = this.sortBy(comparator);
} else {
this.models.sort(comparator);
}
if (!options.silent) this.trigger('sort', this, options);
return this;
},
// Pluck an attribute from each model in the collection.
pluck: function(attr) {
return this.map(attr + '');
},
// Fetch the default set of models for this collection, resetting the
// collection when they arrive. If `reset: true` is passed, the response
// data will be passed through the `reset` method instead of `set`.
fetch: function(options) {
options = _.extend({parse: true}, options);
var success = options.success;
var collection = this;
options.success = function(resp) {
var method = options.reset ? 'reset' : 'set';
collection[method](resp, options);
if (success) success.call(options.context, collection, resp, options);
collection.trigger('sync', collection, resp, options);
};
wrapError(this, options);
return this.sync('read', this, options);
},
// Create a new instance of a model in this collection. Add the model to the
// collection immediately, unless `wait: true` is passed, in which case we
// wait for the server to agree.
create: function(model, options) {
options = options ? _.clone(options) : {};
var wait = options.wait;
model = this._prepareModel(model, options);
if (!model) return false;
if (!wait) this.add(model, options);
var collection = this;
var success = options.success;
options.success = function(m, resp, callbackOpts) {
if (wait) collection.add(m, callbackOpts);
if (success) success.call(callbackOpts.context, m, resp, callbackOpts);
};
model.save(null, options);
return model;
},
// **parse** converts a response into a list of models to be added to the
// collection. The default implementation is just to pass it through.
parse: function(resp, options) {
return resp;
},
// Create a new collection with an identical list of models as this one.
clone: function() {
return new this.constructor(this.models, {
model: this.model,
comparator: this.comparator
});
},
// Define how to uniquely identify models in the collection.
modelId: function(attrs) {
return attrs[this.model.prototype.idAttribute || 'id'];
},
// Private method to reset all internal state. Called when the collection
// is first initialized or reset.
_reset: function() {
this.length = 0;
this.models = [];
this._byId = {};
},
// Prepare a hash of attributes (or other model) to be added to this
// collection.
_prepareModel: function(attrs, options) {
if (this._isModel(attrs)) {
if (!attrs.collection) attrs.collection = this;
return attrs;
}
options = options ? _.clone(options) : {};
options.collection = this;
var model = new this.model(attrs, options);
if (!model.validationError) return model;
this.trigger('invalid', this, model.validationError, options);
return false;
},
// Internal method called by both remove and set.
_removeModels: function(models, options) {
var removed = [];
for (var i = 0; i < models.length; i++) {
var model = this.get(models[i]);
if (!model) continue;
var index = this.indexOf(model);
this.models.splice(index, 1);
this.length--;
// Remove references before triggering 'remove' event to prevent an
// infinite loop. #3693
delete this._byId[model.cid];
var id = this.modelId(model.attributes);
if (id != null) delete this._byId[id];
if (!options.silent) {
options.index = index;
model.trigger('remove', model, this, options);
}
removed.push(model);
this._removeReference(model, options);
}
return removed;
},
// Method for checking whether an object should be considered a model for
// the purposes of adding to the collection.
_isModel: function(model) {
return model instanceof Model;
},
// Internal method to create a model's ties to a collection.
_addReference: function(model, options) {
this._byId[model.cid] = model;
var id = this.modelId(model.attributes);
if (id != null) this._byId[id] = model;
model.on('all', this._onModelEvent, this);
},
// Internal method to sever a model's ties to a collection.
_removeReference: function(model, options) {
delete this._byId[model.cid];
var id = this.modelId(model.attributes);
if (id != null) delete this._byId[id];
if (this === model.collection) delete model.collection;
model.off('all', this._onModelEvent, this);
},
// Internal method called every time a model in the set fires an event.
// Sets need to update their indexes when models change ids. All other
// events simply proxy through. "add" and "remove" events that originate
// in other collections are ignored.
_onModelEvent: function(event, model, collection, options) {
if (model) {
if ((event === 'add' || event === 'remove') && collection !== this) return;
if (event === 'destroy') this.remove(model, options);
if (event === 'change') {
var prevId = this.modelId(model.previousAttributes());
var id = this.modelId(model.attributes);
if (prevId !== id) {
if (prevId != null) delete this._byId[prevId];
if (id != null) this._byId[id] = model;
}
}
}
this.trigger.apply(this, arguments);
}
});
// Underscore methods that we want to implement on the Collection.
// 90% of the core usefulness of Backbone Collections is actually implemented
// right here:
var collectionMethods = {forEach: 3, each: 3, map: 3, collect: 3, reduce: 0,
foldl: 0, inject: 0, reduceRight: 0, foldr: 0, find: 3, detect: 3, filter: 3,
select: 3, reject: 3, every: 3, all: 3, some: 3, any: 3, include: 3, includes: 3,
contains: 3, invoke: 0, max: 3, min: 3, toArray: 1, size: 1, first: 3,
head: 3, take: 3, initial: 3, rest: 3, tail: 3, drop: 3, last: 3,
without: 0, difference: 0, indexOf: 3, shuffle: 1, lastIndexOf: 3,
isEmpty: 1, chain: 1, sample: 3, partition: 3, groupBy: 3, countBy: 3,
sortBy: 3, indexBy: 3, findIndex: 3, findLastIndex: 3};
// Mix in each Underscore method as a proxy to `Collection#models`.
addUnderscoreMethods(Collection, collectionMethods, 'models');
// Backbone.View
// -------------
// Backbone Views are almost more convention than they are actual code. A View
// is simply a JavaScript object that represents a logical chunk of UI in the
// DOM. This might be a single item, an entire list, a sidebar or panel, or
// even the surrounding frame which wraps your whole app. Defining a chunk of
// UI as a **View** allows you to define your DOM events declaratively, without
// having to worry about render order ... and makes it easy for the view to
// react to specific changes in the state of your models.
// Creating a Backbone.View creates its initial element outside of the DOM,
// if an existing element is not provided...
var View = Backbone.View = function(options) {
this.cid = _.uniqueId('view');
_.extend(this, _.pick(options, viewOptions));
this._ensureElement();
this.initialize.apply(this, arguments);
};
// Cached regex to split keys for `delegate`.
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
// List of view options to be set as properties.
var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
// Set up all inheritable **Backbone.View** properties and methods.
_.extend(View.prototype, Events, {
// The default `tagName` of a View's element is `"div"`.
tagName: 'div',
// jQuery delegate for element lookup, scoped to DOM elements within the
// current view. This should be preferred to global lookups where possible.
$: function(selector) {
return this.$el.find(selector);
},
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// **render** is the core function that your view should override, in order
// to populate its element (`this.el`), with the appropriate HTML. The
// convention is for **render** to always return `this`.
render: function() {
return this;
},
// Remove this view by taking the element out of the DOM, and removing any
// applicable Backbone.Events listeners.
remove: function() {
this._removeElement();
this.stopListening();
return this;
},
// Remove this view's element from the document and all event listeners
// attached to it. Exposed for subclasses using an alternative DOM
// manipulation API.
_removeElement: function() {
this.$el.remove();
},
// Change the view's element (`this.el` property) and re-delegate the
// view's events on the new element.
setElement: function(element) {
this.undelegateEvents();
this._setElement(element);
this.delegateEvents();
return this;
},
// Creates the `this.el` and `this.$el` references for this view using the
// given `el`. `el` can be a CSS selector or an HTML string, a jQuery
// context or an element. Subclasses can override this to utilize an
// alternative DOM manipulation API and are only required to set the
// `this.el` property.
_setElement: function(el) {
this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);
this.el = this.$el[0];
},
// Set callbacks, where `this.events` is a hash of
//
// *{"event selector": "callback"}*
//
// {
// 'mousedown .title': 'edit',
// 'click .button': 'save',
// 'click .open': function(e) { ... }
// }
//
// pairs. Callbacks will be bound to the view, with `this` set properly.
// Uses event delegation for efficiency.
// Omitting the selector binds the event to `this.el`.
delegateEvents: function(events) {
events || (events = _.result(this, 'events'));
if (!events) return this;
this.undelegateEvents();
for (var key in events) {
var method = events[key];
if (!_.isFunction(method)) method = this[method];
if (!method) continue;
var match = key.match(delegateEventSplitter);
this.delegate(match[1], match[2], _.bind(method, this));
}
return this;
},
// Add a single event listener to the view's element (or a child element
// using `selector`). This only works for delegate-able events: not `focus`,
// `blur`, and not `change`, `submit`, and `reset` in Internet Explorer.
delegate: function(eventName, selector, listener) {
this.$el.on(eventName + '.delegateEvents' + this.cid, selector, listener);
return this;
},
// Clears all callbacks previously bound to the view by `delegateEvents`.
// You usually don't need to use this, but may wish to if you have multiple
// Backbone views attached to the same DOM element.
undelegateEvents: function() {
if (this.$el) this.$el.off('.delegateEvents' + this.cid);
return this;
},
// A finer-grained `undelegateEvents` for removing a single delegated event.
// `selector` and `listener` are both optional.
undelegate: function(eventName, selector, listener) {
this.$el.off(eventName + '.delegateEvents' + this.cid, selector, listener);
return this;
},
// Produces a DOM element to be assigned to your view. Exposed for
// subclasses using an alternative DOM manipulation API.
_createElement: function(tagName) {
return document.createElement(tagName);
},
// Ensure that the View has a DOM element to render into.
// If `this.el` is a string, pass it through `$()`, take the first
// matching element, and re-assign it to `el`. Otherwise, create
// an element from the `id`, `className` and `tagName` properties.
_ensureElement: function() {
if (!this.el) {
var attrs = _.extend({}, _.result(this, 'attributes'));
if (this.id) attrs.id = _.result(this, 'id');
if (this.className) attrs['class'] = _.result(this, 'className');
this.setElement(this._createElement(_.result(this, 'tagName')));
this._setAttributes(attrs);
} else {
this.setElement(_.result(this, 'el'));
}
},
// Set attributes from a hash on this view's element. Exposed for
// subclasses using an alternative DOM manipulation API.
_setAttributes: function(attributes) {
this.$el.attr(attributes);
}
});
// Backbone.sync
// -------------
// Override this function to change the manner in which Backbone persists
// models to the server. You will be passed the type of request, and the
// model in question. By default, makes a RESTful Ajax request
// to the model's `url()`. Some possible customizations could be:
//
// * Use `setTimeout` to batch rapid-fire updates into a single request.
// * Send up the models as XML instead of JSON.
// * Persist models via WebSockets instead of Ajax.
//
// Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests
// as `POST`, with a `_method` parameter containing the true HTTP method,
// as well as all requests with the body as `application/x-www-form-urlencoded`
// instead of `application/json` with the model in a param named `model`.
// Useful when interfacing with server-side languages like **PHP** that make
// it difficult to read the body of `PUT` requests.
Backbone.sync = function(method, model, options) {
var type = methodMap[method];
// Default options, unless specified.
_.defaults(options || (options = {}), {
emulateHTTP: Backbone.emulateHTTP,
emulateJSON: Backbone.emulateJSON
});
// Default JSON-request options.
var params = {type: type, dataType: 'json'};
// Ensure that we have a URL.
if (!options.url) {
params.url = _.result(model, 'url') || urlError();
}
// Ensure that we have the appropriate request data.
if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
params.contentType = 'application/json';
params.data = JSON.stringify(options.attrs || model.toJSON(options));
}
// For older servers, emulate JSON by encoding the request into an HTML-form.
if (options.emulateJSON) {
params.contentType = 'application/x-www-form-urlencoded';
params.data = params.data ? {model: params.data} : {};
}
// For older servers, emulate HTTP by mimicking the HTTP method with `_method`
// And an `X-HTTP-Method-Override` header.
if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) {
params.type = 'POST';
if (options.emulateJSON) params.data._method = type;
var beforeSend = options.beforeSend;
options.beforeSend = function(xhr) {
xhr.setRequestHeader('X-HTTP-Method-Override', type);
if (beforeSend) return beforeSend.apply(this, arguments);
};
}
// Don't process data on a non-GET request.
if (params.type !== 'GET' && !options.emulateJSON) {
params.processData = false;
}
// Pass along `textStatus` and `errorThrown` from jQuery.
var error = options.error;
options.error = function(xhr, textStatus, errorThrown) {
options.textStatus = textStatus;
options.errorThrown = errorThrown;
if (error) error.call(options.context, xhr, textStatus, errorThrown);
};
// Make the request, allowing the user to override any Ajax options.
var xhr = options.xhr = Backbone.ajax(_.extend(params, options));
model.trigger('request', model, xhr, options);
return xhr;
};
// Map from CRUD to HTTP for our default `Backbone.sync` implementation.
var methodMap = {
'create': 'POST',
'update': 'PUT',
'patch': 'PATCH',
'delete': 'DELETE',
'read': 'GET'
};
// Set the default implementation of `Backbone.ajax` to proxy through to `$`.
// Override this if you'd like to use a different library.
Backbone.ajax = function() {
return Backbone.$.ajax.apply(Backbone.$, arguments);
};
// Backbone.Router
// ---------------
// Routers map faux-URLs to actions, and fire events when routes are
// matched. Creating a new one sets its `routes` hash, if not set statically.
var Router = Backbone.Router = function(options) {
options || (options = {});
if (options.routes) this.routes = options.routes;
this._bindRoutes();
this.initialize.apply(this, arguments);
};
// Cached regular expressions for matching named param parts and splatted
// parts of route strings.
var optionalParam = /\((.*?)\)/g;
var namedParam = /(\(\?)?:\w+/g;
var splatParam = /\*\w+/g;
var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g;
// Set up all inheritable **Backbone.Router** properties and methods.
_.extend(Router.prototype, Events, {
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// Manually bind a single named route to a callback. For example:
//
// this.route('search/:query/p:num', 'search', function(query, num) {
// ...
// });
//
route: function(route, name, callback) {
if (!_.isRegExp(route)) route = this._routeToRegExp(route);
if (_.isFunction(name)) {
callback = name;
name = '';
}
if (!callback) callback = this[name];
var router = this;
Backbone.history.route(route, function(fragment) {
var args = router._extractParameters(route, fragment);
if (router.execute(callback, args, name) !== false) {
router.trigger.apply(router, ['route:' + name].concat(args));
router.trigger('route', name, args);
Backbone.history.trigger('route', router, name, args);
}
});
return this;
},
// Execute a route handler with the provided parameters. This is an
// excellent place to do pre-route setup or post-route cleanup.
execute: function(callback, args, name) {
if (callback) callback.apply(this, args);
},
// Simple proxy to `Backbone.history` to save a fragment into the history.
navigate: function(fragment, options) {
Backbone.history.navigate(fragment, options);
return this;
},
// Bind all defined routes to `Backbone.history`. We have to reverse the
// order of the routes here to support behavior where the most general
// routes can be defined at the bottom of the route map.
_bindRoutes: function() {
if (!this.routes) return;
this.routes = _.result(this, 'routes');
var route, routes = _.keys(this.routes);
while ((route = routes.pop()) != null) {
this.route(route, this.routes[route]);
}
},
// Convert a route string into a regular expression, suitable for matching
// against the current location hash.
_routeToRegExp: function(route) {
route = route.replace(escapeRegExp, '\\$&')
.replace(optionalParam, '(?:$1)?')
.replace(namedParam, function(match, optional) {
return optional ? match : '([^/?]+)';
})
.replace(splatParam, '([^?]*?)');
return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$');
},
// Given a route, and a URL fragment that it matches, return the array of
// extracted decoded parameters. Empty or unmatched parameters will be
// treated as `null` to normalize cross-browser behavior.
_extractParameters: function(route, fragment) {
var params = route.exec(fragment).slice(1);
return _.map(params, function(param, i) {
// Don't decode the search params.
if (i === params.length - 1) return param || null;
return param ? decodeURIComponent(param) : null;
});
}
});
// Backbone.History
// ----------------
// Handles cross-browser history management, based on either
// [pushState](http://diveintohtml5.info/history.html) and real URLs, or
// [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange)
// and URL fragments. If the browser supports neither (old IE, natch),
// falls back to polling.
var History = Backbone.History = function() {
this.handlers = [];
this.checkUrl = _.bind(this.checkUrl, this);
// Ensure that `History` can be used outside of the browser.
if (typeof window !== 'undefined') {
this.location = window.location;
this.history = window.history;
}
};
// Cached regex for stripping a leading hash/slash and trailing space.
var routeStripper = /^[#\/]|\s+$/g;
// Cached regex for stripping leading and trailing slashes.
var rootStripper = /^\/+|\/+$/g;
// Cached regex for stripping urls of hash.
var pathStripper = /#.*$/;
// Has the history handling already been started?
History.started = false;
// Set up all inheritable **Backbone.History** properties and methods.
_.extend(History.prototype, Events, {
// The default interval to poll for hash changes, if necessary, is
// twenty times a second.
interval: 50,
// Are we at the app root?
atRoot: function() {
var path = this.location.pathname.replace(/[^\/]$/, '$&/');
return path === this.root && !this.getSearch();
},
// Does the pathname match the root?
matchRoot: function() {
var path = this.decodeFragment(this.location.pathname);
var rootPath = path.slice(0, this.root.length - 1) + '/';
return rootPath === this.root;
},
// Unicode characters in `location.pathname` are percent encoded so they're
// decoded for comparison. `%25` should not be decoded since it may be part
// of an encoded parameter.
decodeFragment: function(fragment) {
return decodeURI(fragment.replace(/%25/g, '%2525'));
},
// In IE6, the hash fragment and search params are incorrect if the
// fragment contains `?`.
getSearch: function() {
var match = this.location.href.replace(/#.*/, '').match(/\?.+/);
return match ? match[0] : '';
},
// Gets the true hash value. Cannot use location.hash directly due to bug
// in Firefox where location.hash will always be decoded.
getHash: function(window) {
var match = (window || this).location.href.match(/#(.*)$/);
return match ? match[1] : '';
},
// Get the pathname and search params, without the root.
getPath: function() {
var path = this.decodeFragment(
this.location.pathname + this.getSearch()
).slice(this.root.length - 1);
return path.charAt(0) === '/' ? path.slice(1) : path;
},
// Get the cross-browser normalized URL fragment from the path or hash.
getFragment: function(fragment) {
if (fragment == null) {
if (this._usePushState || !this._wantsHashChange) {
fragment = this.getPath();
} else {
fragment = this.getHash();
}
}
return fragment.replace(routeStripper, '');
},
// Start the hash change handling, returning `true` if the current URL matches
// an existing route, and `false` otherwise.
start: function(options) {
if (History.started) throw new Error('Backbone.history has already been started');
History.started = true;
// Figure out the initial configuration. Do we need an iframe?
// Is pushState desired ... is it available?
this.options = _.extend({root: '/'}, this.options, options);
this.root = this.options.root;
this._wantsHashChange = this.options.hashChange !== false;
this._hasHashChange = 'onhashchange' in window && (document.documentMode === void 0 || document.documentMode > 7);
this._useHashChange = this._wantsHashChange && this._hasHashChange;
this._wantsPushState = !!this.options.pushState;
this._hasPushState = !!(this.history && this.history.pushState);
this._usePushState = this._wantsPushState && this._hasPushState;
this.fragment = this.getFragment();
// Normalize root to always include a leading and trailing slash.
this.root = ('/' + this.root + '/').replace(rootStripper, '/');
// Transition from hashChange to pushState or vice versa if both are
// requested.
if (this._wantsHashChange && this._wantsPushState) {
// If we've started off with a route from a `pushState`-enabled
// browser, but we're currently in a browser that doesn't support it...
if (!this._hasPushState && !this.atRoot()) {
var rootPath = this.root.slice(0, -1) || '/';
this.location.replace(rootPath + '#' + this.getPath());
// Return immediately as browser will do redirect to new url
return true;
// Or if we've started out with a hash-based route, but we're currently
// in a browser where it could be `pushState`-based instead...
} else if (this._hasPushState && this.atRoot()) {
this.navigate(this.getHash(), {replace: true});
}
}
// Proxy an iframe to handle location events if the browser doesn't
// support the `hashchange` event, HTML5 history, or the user wants
// `hashChange` but not `pushState`.
if (!this._hasHashChange && this._wantsHashChange && !this._usePushState) {
this.iframe = document.createElement('iframe');
this.iframe.src = 'javascript:0';
this.iframe.style.display = 'none';
this.iframe.tabIndex = -1;
var body = document.body;
// Using `appendChild` will throw on IE < 9 if the document is not ready.
var iWindow = body.insertBefore(this.iframe, body.firstChild).contentWindow;
iWindow.document.open();
iWindow.document.close();
iWindow.location.hash = '#' + this.fragment;
}
// Add a cross-platform `addEventListener` shim for older browsers.
var addEventListener = window.addEventListener || function(eventName, listener) {
return attachEvent('on' + eventName, listener);
};
// Depending on whether we're using pushState or hashes, and whether
// 'onhashchange' is supported, determine how we check the URL state.
if (this._usePushState) {
addEventListener('popstate', this.checkUrl, false);
} else if (this._useHashChange && !this.iframe) {
addEventListener('hashchange', this.checkUrl, false);
} else if (this._wantsHashChange) {
this._checkUrlInterval = setInterval(this.checkUrl, this.interval);
}
if (!this.options.silent) return this.loadUrl();
},
// Disable Backbone.history, perhaps temporarily. Not useful in a real app,
// but possibly useful for unit testing Routers.
stop: function() {
// Add a cross-platform `removeEventListener` shim for older browsers.
var removeEventListener = window.removeEventListener || function(eventName, listener) {
return detachEvent('on' + eventName, listener);
};
// Remove window listeners.
if (this._usePushState) {
removeEventListener('popstate', this.checkUrl, false);
} else if (this._useHashChange && !this.iframe) {
removeEventListener('hashchange', this.checkUrl, false);
}
// Clean up the iframe if necessary.
if (this.iframe) {
document.body.removeChild(this.iframe);
this.iframe = null;
}
// Some environments will throw when clearing an undefined interval.
if (this._checkUrlInterval) clearInterval(this._checkUrlInterval);
History.started = false;
},
// Add a route to be tested when the fragment changes. Routes added later
// may override previous routes.
route: function(route, callback) {
this.handlers.unshift({route: route, callback: callback});
},
// Checks the current URL to see if it has changed, and if it has,
// calls `loadUrl`, normalizing across the hidden iframe.
checkUrl: function(e) {
var current = this.getFragment();
// If the user pressed the back button, the iframe's hash will have
// changed and we should use that for comparison.
if (current === this.fragment && this.iframe) {
current = this.getHash(this.iframe.contentWindow);
}
if (current === this.fragment) return false;
if (this.iframe) this.navigate(current);
this.loadUrl();
},
// Attempt to load the current URL fragment. If a route succeeds with a
// match, returns `true`. If no defined routes matches the fragment,
// returns `false`.
loadUrl: function(fragment) {
// If the root doesn't match, no routes can match either.
if (!this.matchRoot()) return false;
fragment = this.fragment = this.getFragment(fragment);
return _.some(this.handlers, function(handler) {
if (handler.route.test(fragment)) {
handler.callback(fragment);
return true;
}
});
},
// Save a fragment into the hash history, or replace the URL state if the
// 'replace' option is passed. You are responsible for properly URL-encoding
// the fragment in advance.
//
// The options object can contain `trigger: true` if you wish to have the
// route callback be fired (not usually desirable), or `replace: true`, if
// you wish to modify the current URL without adding an entry to the history.
navigate: function(fragment, options) {
if (!History.started) return false;
if (!options || options === true) options = {trigger: !!options};
// Normalize the fragment.
fragment = this.getFragment(fragment || '');
// Don't include a trailing slash on the root.
var rootPath = this.root;
if (fragment === '' || fragment.charAt(0) === '?') {
rootPath = rootPath.slice(0, -1) || '/';
}
var url = rootPath + fragment;
// Strip the hash and decode for matching.
fragment = this.decodeFragment(fragment.replace(pathStripper, ''));
if (this.fragment === fragment) return;
this.fragment = fragment;
// If pushState is available, we use it to set the fragment as a real URL.
if (this._usePushState) {
this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);
// If hash changes haven't been explicitly disabled, update the hash
// fragment to store history.
} else if (this._wantsHashChange) {
this._updateHash(this.location, fragment, options.replace);
if (this.iframe && fragment !== this.getHash(this.iframe.contentWindow)) {
var iWindow = this.iframe.contentWindow;
// Opening and closing the iframe tricks IE7 and earlier to push a
// history entry on hash-tag change. When replace is true, we don't
// want this.
if (!options.replace) {
iWindow.document.open();
iWindow.document.close();
}
this._updateHash(iWindow.location, fragment, options.replace);
}
// If you've told us that you explicitly don't want fallback hashchange-
// based history, then `navigate` becomes a page refresh.
} else {
return this.location.assign(url);
}
if (options.trigger) return this.loadUrl(fragment);
},
// Update the hash location, either replacing the current entry, or adding
// a new one to the browser history.
_updateHash: function(location, fragment, replace) {
if (replace) {
var href = location.href.replace(/(javascript:|#).*$/, '');
location.replace(href + '#' + fragment);
} else {
// Some browsers require that `hash` contains a leading #.
location.hash = '#' + fragment;
}
}
});
// Create the default Backbone.history.
Backbone.history = new History;
// Helpers
// -------
// Helper function to correctly set up the prototype chain for subclasses.
// Similar to `goog.inherits`, but uses a hash of prototype properties and
// class properties to be extended.
var extend = function(protoProps, staticProps) {
var parent = this;
var child;
// The constructor function for the new subclass is either defined by you
// (the "constructor" property in your `extend` definition), or defaulted
// by us to simply call the parent constructor.
if (protoProps && _.has(protoProps, 'constructor')) {
child = protoProps.constructor;
} else {
child = function(){ return parent.apply(this, arguments); };
}
// Add static properties to the constructor function, if supplied.
_.extend(child, parent, staticProps);
// Set the prototype chain to inherit from `parent`, without calling
// `parent`'s constructor function and add the prototype properties.
child.prototype = _.create(parent.prototype, protoProps);
child.prototype.constructor = child;
// Set a convenience property in case the parent's prototype is needed
// later.
child.__super__ = parent.prototype;
return child;
};
// Set up inheritance for the model, collection, router, view and history.
Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend;
// Throw an error when a URL is needed, and none is supplied.
var urlError = function() {
throw new Error('A "url" property or function must be specified');
};
// Wrap an optional error callback with a fallback error event.
var wrapError = function(model, options) {
var error = options.error;
options.error = function(resp) {
if (error) error.call(options.context, model, resp, options);
model.trigger('error', model, resp, options);
};
};
return Backbone;
});
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
* jQuery JavaScript Library v3.1.1
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2016-12-11T15:18Z
*/
( function( global, factory ) {
"use strict";
if ( typeof module === "object" && typeof module.exports === "object" ) {
// For CommonJS and CommonJS-like environments where a proper `window`
// is present, execute the factory and get jQuery.
// For environments that do not have a `window` with a `document`
// (such as Node.js), expose a factory as module.exports.
// This accentuates the need for the creation of a real `window`.
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info.
module.exports = global.document ?
factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window with a document" );
}
return factory( w );
};
} else {
factory( global );
}
// Pass this if window is not defined yet
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
// enough that all such attempts are guarded in a try block.
var arr = [];
var document = window.document;
var getProto = Object.getPrototypeOf;
var slice = arr.slice;
var concat = arr.concat;
var push = arr.push;
var indexOf = arr.indexOf;
var class2type = {};
var toString = class2type.toString;
var hasOwn = class2type.hasOwnProperty;
var fnToString = hasOwn.toString;
var ObjectFunctionString = fnToString.call( Object );
var support = {};
function DOMEval( code, doc ) {
doc = doc || document;
var script = doc.createElement( "script" );
script.text = code;
doc.head.appendChild( script ).parentNode.removeChild( script );
}
/* global Symbol */
// Defining this global in .eslintrc.json would create a danger of using the global
// unguarded in another place, it seems safer to define global only for this module
var
version = "3.1.1",
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
// Need init if jQuery is called (just allow error to be thrown if not included)
return new jQuery.fn.init( selector, context );
},
// Support: Android <=4.0 only
// Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([a-z])/g,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: version,
constructor: jQuery,
// The default length of a jQuery object is 0
length: 0,
toArray: function() {
return slice.call( this );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
// Return all the elements in a clean array
if ( num == null ) {
return slice.call( this );
}
// Return just the one element from the set
return num < 0 ? this[ num + this.length ] : this[ num ];
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
each: function( callback ) {
return jQuery.each( this, callback );
},
map: function( callback ) {
return this.pushStack( jQuery.map( this, function( elem, i ) {
return callback.call( elem, i, elem );
} ) );
},
slice: function() {
return this.pushStack( slice.apply( this, arguments ) );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
},
end: function() {
return this.prevObject || this.constructor();
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: arr.sort,
splice: arr.splice
};
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[ 0 ] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
// Skip the boolean and the target
target = arguments[ i ] || {};
i++;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
target = {};
}
// Extend jQuery itself if only one argument is passed
if ( i === length ) {
target = this;
i--;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( ( options = arguments[ i ] ) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
( copyIsArray = jQuery.isArray( copy ) ) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray( src ) ? src : [];
} else {
clone = src && jQuery.isPlainObject( src ) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend( {
// Unique for each copy of jQuery on the page
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
// Assume jQuery is ready without the ready module
isReady: true,
error: function( msg ) {
throw new Error( msg );
},
noop: function() {},
isFunction: function( obj ) {
return jQuery.type( obj ) === "function";
},
isArray: Array.isArray,
isWindow: function( obj ) {
return obj != null && obj === obj.window;
},
isNumeric: function( obj ) {
// As of jQuery 3.0, isNumeric is limited to
// strings and numbers (primitives or objects)
// that can be coerced to finite numbers (gh-2662)
var type = jQuery.type( obj );
return ( type === "number" || type === "string" ) &&
// parseFloat NaNs numeric-cast false positives ("")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
!isNaN( obj - parseFloat( obj ) );
},
isPlainObject: function( obj ) {
var proto, Ctor;
// Detect obvious negatives
// Use toString instead of jQuery.type to catch host objects
if ( !obj || toString.call( obj ) !== "[object Object]" ) {
return false;
}
proto = getProto( obj );
// Objects with no prototype (e.g., `Object.create( null )`) are plain
if ( !proto ) {
return true;
}
// Objects with prototype are plain iff they were constructed by a global Object function
Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
},
isEmptyObject: function( obj ) {
/* eslint-disable no-unused-vars */
// See https://github.com/eslint/eslint/issues/6125
var name;
for ( name in obj ) {
return false;
}
return true;
},
type: function( obj ) {
if ( obj == null ) {
return obj + "";
}
// Support: Android <=2.3 only (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call( obj ) ] || "object" :
typeof obj;
},
// Evaluates a script in a global context
globalEval: function( code ) {
DOMEval( code );
},
// Convert dashed to camelCase; used by the css and data modules
// Support: IE <=9 - 11, Edge 12 - 13
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
each: function( obj, callback ) {
var length, i = 0;
if ( isArrayLike( obj ) ) {
length = obj.length;
for ( ; i < length; i++ ) {
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
break;
}
}
} else {
for ( i in obj ) {
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
break;
}
}
}
return obj;
},
// Support: Android <=4.0 only
trim: function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
if ( arr != null ) {
if ( isArrayLike( Object( arr ) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
);
} else {
push.call( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
return arr == null ? -1 : indexOf.call( arr, elem, i );
},
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
merge: function( first, second ) {
var len = +second.length,
j = 0,
i = first.length;
for ( ; j < len; j++ ) {
first[ i++ ] = second[ j ];
}
first.length = i;
return first;
},
grep: function( elems, callback, invert ) {
var callbackInverse,
matches = [],
i = 0,
length = elems.length,
callbackExpect = !invert;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
callbackInverse = !callback( elems[ i ], i );
if ( callbackInverse !== callbackExpect ) {
matches.push( elems[ i ] );
}
}
return matches;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var length, value,
i = 0,
ret = [];
// Go through the array, translating each of the items to their new values
if ( isArrayLike( elems ) ) {
length = elems.length;
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret.push( value );
}
}
// Go through every key on the object,
} else {
for ( i in elems ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret.push( value );
}
}
}
// Flatten any nested arrays
return concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var tmp, args, proxy;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
now: Date.now,
// jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist.
support: support
} );
if ( typeof Symbol === "function" ) {
jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
}
// Populate the class2type map
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
function( i, name ) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
} );
function isArrayLike( obj ) {
// Support: real iOS 8.2 only (not reproducible in simulator)
// `in` check used to prevent JIT error (gh-2145)
// hasOwn isn't used here due to false negatives
// regarding Nodelist length in IE
var length = !!obj && "length" in obj && obj.length,
type = jQuery.type( obj );
if ( type === "function" || jQuery.isWindow( obj ) ) {
return false;
}
return type === "array" || length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
var Sizzle =
/*!
* Sizzle CSS Selector Engine v2.3.3
* https://sizzlejs.com/
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2016-08-08
*/
(function( window ) {
var i,
support,
Expr,
getText,
isXML,
tokenize,
compile,
select,
outermostContext,
sortInput,
hasDuplicate,
// Local document vars
setDocument,
document,
docElem,
documentIsHTML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
// Instance-specific data
expando = "sizzle" + 1 * new Date(),
preferredDoc = window.document,
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
}
return 0;
},
// Instance methods
hasOwn = ({}).hasOwnProperty,
arr = [],
pop = arr.pop,
push_native = arr.push,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf as it's faster than native
// https://jsperf.com/thor-indexof-vs-for/5
indexOf = function( list, elem ) {
var i = 0,
len = list.length;
for ( ; i < len; i++ ) {
if ( list[i] === elem ) {
return i;
}
}
return -1;
},
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
// Regular expressions
// http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
// Operator (capture 2)
"*([*^$|!~]?=)" + whitespace +
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
"*\\]",
pseudos = ":(" + identifier + ")(?:\\((" +
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
// 1. quoted (capture 3; capture 4 or capture 5)
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
// 2. simple (capture 6)
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
// 3. anything else (capture 2)
".*" +
")\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rwhitespace = new RegExp( whitespace + "+", "g" ),
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + identifier + ")" ),
"CLASS": new RegExp( "^\\.(" + identifier + ")" ),
"TAG": new RegExp( "^(" + identifier + "|[*])" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rnative = /^[^{]+\{\s*\[native \w/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rsibling = /[+~]/,
// CSS escapes
// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
funescape = function( _, escaped, escapedWhitespace ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
// Support: Firefox<24
// Workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedWhitespace ?
escaped :
high < 0 ?
// BMP codepoint
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
},
// CSS string/identifier serialization
// https://drafts.csswg.org/cssom/#common-serializing-idioms
rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
fcssescape = function( ch, asCodePoint ) {
if ( asCodePoint ) {
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
if ( ch === "\0" ) {
return "\uFFFD";
}
// Control characters and (dependent upon position) numbers get escaped as code points
return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
}
// Other potentially-special ASCII characters get backslash-escaped
return "\\" + ch;
},
// Used for iframes
// See setDocument()
// Removing the function wrapper causes a "Permission Denied"
// error in IE
unloadHandler = function() {
setDocument();
},
disabledAncestor = addCombinator(
function( elem ) {
return elem.disabled === true && ("form" in elem || "label" in elem);
},
{ dir: "parentNode", next: "legend" }
);
// Optimize for push.apply( _, NodeList )
try {
push.apply(
(arr = slice.call( preferredDoc.childNodes )),
preferredDoc.childNodes
);
// Support: Android<4.0
// Detect silently failing push.apply
arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
push = { apply: arr.length ?
// Leverage slice if possible
function( target, els ) {
push_native.apply( target, slice.call(els) );
} :
// Support: IE<9
// Otherwise append directly
function( target, els ) {
var j = target.length,
i = 0;
// Can't trust NodeList.length
while ( (target[j++] = els[i++]) ) {}
target.length = j - 1;
}
};
}
function Sizzle( selector, context, results, seed ) {
var m, i, elem, nid, match, groups, newSelector,
newContext = context && context.ownerDocument,
// nodeType defaults to 9, since context defaults to document
nodeType = context ? context.nodeType : 9;
results = results || [];
// Return early from calls with invalid selector or context
if ( typeof selector !== "string" || !selector ||
nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
return results;
}
// Try to shortcut find operations (as opposed to filters) in HTML documents
if ( !seed ) {
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
setDocument( context );
}
context = context || document;
if ( documentIsHTML ) {
// If the selector is sufficiently simple, try using a "get*By*" DOM method
// (excepting DocumentFragment context, where the methods don't exist)
if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
// ID selector
if ( (m = match[1]) ) {
// Document context
if ( nodeType === 9 ) {
if ( (elem = context.getElementById( m )) ) {
// Support: IE, Opera, Webkit
// TODO: identify versions
// getElementById can match elements by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
// Element context
} else {
// Support: IE, Opera, Webkit
// TODO: identify versions
// getElementById can match elements by name instead of ID
if ( newContext && (elem = newContext.getElementById( m )) &&
contains( context, elem ) &&
elem.id === m ) {
results.push( elem );
return results;
}
}
// Type selector
} else if ( match[2] ) {
push.apply( results, context.getElementsByTagName( selector ) );
return results;
// Class selector
} else if ( (m = match[3]) && support.getElementsByClassName &&
context.getElementsByClassName ) {
push.apply( results, context.getElementsByClassName( m ) );
return results;
}
}
// Take advantage of querySelectorAll
if ( support.qsa &&
!compilerCache[ selector + " " ] &&
(!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
if ( nodeType !== 1 ) {
newContext = context;
newSelector = selector;
// qSA looks outside Element context, which is not what we want
// Thanks to Andrew Dupont for this workaround technique
// Support: IE <=8
// Exclude object elements
} else if ( context.nodeName.toLowerCase() !== "object" ) {
// Capture the context ID, setting it first if necessary
if ( (nid = context.getAttribute( "id" )) ) {
nid = nid.replace( rcssescape, fcssescape );
} else {
context.setAttribute( "id", (nid = expando) );
}
// Prefix every selector in the list
groups = tokenize( selector );
i = groups.length;
while ( i-- ) {
groups[i] = "#" + nid + " " + toSelector( groups[i] );
}
newSelector = groups.join( "," );
// Expand context for sibling selectors
newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
context;
}
if ( newSelector ) {
try {
push.apply( results,
newContext.querySelectorAll( newSelector )
);
return results;
} catch ( qsaError ) {
} finally {
if ( nid === expando ) {
context.removeAttribute( "id" );
}
}
}
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* Create key-value caches of limited size
* @returns {function(string, object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var keys = [];
function cache( key, value ) {
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if ( keys.push( key + " " ) > Expr.cacheLength ) {
// Only keep the most recent entries
delete cache[ keys.shift() ];
}
return (cache[ key + " " ] = value);
}
return cache;
}
/**
* Mark a function for special use by Sizzle
* @param {Function} fn The function to mark
*/
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
}
/**
* Support testing using an element
* @param {Function} fn Passed the created element and returns a boolean result
*/
function assert( fn ) {
var el = document.createElement("fieldset");
try {
return !!fn( el );
} catch (e) {
return false;
} finally {
// Remove from its parent by default
if ( el.parentNode ) {
el.parentNode.removeChild( el );
}
// release memory in IE
el = null;
}
}
/**
* Adds the same handler for all of the specified attrs
* @param {String} attrs Pipe-separated list of attributes
* @param {Function} handler The method that will be applied
*/
function addHandle( attrs, handler ) {
var arr = attrs.split("|"),
i = arr.length;
while ( i-- ) {
Expr.attrHandle[ arr[i] ] = handler;
}
}
/**
* Checks document order of two siblings
* @param {Element} a
* @param {Element} b
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
*/
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
a.sourceIndex - b.sourceIndex;
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( (cur = cur.nextSibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
}
/**
* Returns a function to use in pseudos for input types
* @param {String} type
*/
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for buttons
* @param {String} type
*/
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for :enabled/:disabled
* @param {Boolean} disabled true for :disabled; false for :enabled
*/
function createDisabledPseudo( disabled ) {
// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
return function( elem ) {
// Only certain elements can match :enabled or :disabled
// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
if ( "form" in elem ) {
// Check for inherited disabledness on relevant non-disabled elements:
// * listed form-associated elements in a disabled fieldset
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
// https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
// * option elements in a disabled optgroup
// https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
// All such elements have a "form" property.
if ( elem.parentNode && elem.disabled === false ) {
// Option elements defer to a parent optgroup if present
if ( "label" in elem ) {
if ( "label" in elem.parentNode ) {
return elem.parentNode.disabled === disabled;
} else {
return elem.disabled === disabled;
}
}
// Support: IE 6 - 11
// Use the isDisabled shortcut property to check for disabled fieldset ancestors
return elem.isDisabled === disabled ||
// Where there is no isDisabled, check manually
/* jshint -W018 */
elem.isDisabled !== !disabled &&
disabledAncestor( elem ) === disabled;
}
return elem.disabled === disabled;
// Try to winnow out elements that can't be disabled before trusting the disabled property.
// Some victims get caught in our net (label, legend, menu, track), but it shouldn't
// even exist on them, let alone have a boolean value.
} else if ( "label" in elem ) {
return elem.disabled === disabled;
}
// Remaining elements are neither :enabled nor :disabled
return false;
};
}
/**
* Returns a function to use in pseudos for positionals
* @param {Function} fn
*/
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Checks a node for validity as a Sizzle context
* @param {Element|Object=} context
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
*/
function testContext( context ) {
return context && typeof context.getElementsByTagName !== "undefined" && context;
}
// Expose support vars for convenience
support = Sizzle.support = {};
/**
* Detects XML nodes
* @param {Element|Object} elem An element or a document
* @returns {Boolean} True iff elem is a non-HTML XML node
*/
isXML = Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
/**
* Sets document-related variables once based on the current document
* @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
setDocument = Sizzle.setDocument = function( node ) {
var hasCompare, subWindow,
doc = node ? node.ownerDocument || node : preferredDoc;
// Return early if doc is invalid or already selected
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
return document;
}
// Update global variables
document = doc;
docElem = document.documentElement;
documentIsHTML = !isXML( document );
// Support: IE 9-11, Edge
// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
if ( preferredDoc !== document &&
(subWindow = document.defaultView) && subWindow.top !== subWindow ) {
// Support: IE 11, Edge
if ( subWindow.addEventListener ) {
subWindow.addEventListener( "unload", unloadHandler, false );
// Support: IE 9 - 10 only
} else if ( subWindow.attachEvent ) {
subWindow.attachEvent( "onunload", unloadHandler );
}
}
/* Attributes
---------------------------------------------------------------------- */
// Support: IE<8
// Verify that getAttribute really returns attributes and not properties
// (excepting IE8 booleans)
support.attributes = assert(function( el ) {
el.className = "i";
return !el.getAttribute("className");
});
/* getElement(s)By*
---------------------------------------------------------------------- */
// Check if getElementsByTagName("*") returns only elements
support.getElementsByTagName = assert(function( el ) {
el.appendChild( document.createComment("") );
return !el.getElementsByTagName("*").length;
});
// Support: IE<9
support.getElementsByClassName = rnative.test( document.getElementsByClassName );
// Support: IE<10
// Check if getElementById returns elements by name
// The broken getElementById methods don't pick up programmatically-set names,
// so use a roundabout getElementsByName test
support.getById = assert(function( el ) {
docElem.appendChild( el ).id = expando;
return !document.getElementsByName || !document.getElementsByName( expando ).length;
});
// ID filter and find
if ( support.getById ) {
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
return elem.getAttribute("id") === attrId;
};
};
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
var elem = context.getElementById( id );
return elem ? [ elem ] : [];
}
};
} else {
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
var node = typeof elem.getAttributeNode !== "undefined" &&
elem.getAttributeNode("id");
return node && node.value === attrId;
};
};
// Support: IE 6 - 7 only
// getElementById is not reliable as a find shortcut
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
var node, i, elems,
elem = context.getElementById( id );
if ( elem ) {
// Verify the id attribute
node = elem.getAttributeNode("id");
if ( node && node.value === id ) {
return [ elem ];
}
// Fall back on getElementsByName
elems = context.getElementsByName( id );
i = 0;
while ( (elem = elems[i++]) ) {
node = elem.getAttributeNode("id");
if ( node && node.value === id ) {
return [ elem ];
}
}
}
return [];
}
};
}
// Tag
Expr.find["TAG"] = support.getElementsByTagName ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== "undefined" ) {
return context.getElementsByTagName( tag );
// DocumentFragment nodes don't have gEBTN
} else if ( support.qsa ) {
return context.querySelectorAll( tag );
}
} :
function( tag, context ) {
var elem,
tmp = [],
i = 0,
// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
while ( (elem = results[i++]) ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
};
// Class
Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
return context.getElementsByClassName( className );
}
};
/* QSA/matchesSelector
---------------------------------------------------------------------- */
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21)
// We allow this because of a bug in IE8/9 that throws an error
// whenever `document.activeElement` is accessed on an iframe
// So, we allow :focus to pass through QSA all the time to avoid the IE error
// See https://bugs.jquery.com/ticket/13378
rbuggyQSA = [];
if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( el ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explicitly
// setting a boolean content attribute,
// since its presence should be enough
// https://bugs.jquery.com/ticket/12359
docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
"<select id='" + expando + "-\r\\' msallowcapture=''>" +
"<option selected=''></option></select>";
// Support: IE8, Opera 11-12.16
// Nothing should be selected when empty strings follow ^= or $= or *=
// The test attribute must be unknown in Opera but "safe" for WinRT
// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
if ( el.querySelectorAll("[msallowcapture^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
}
// Support: IE8
// Boolean attributes and "value" are not treated correctly
if ( !el.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
}
// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
rbuggyQSA.push("~=");
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
if ( !el.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
// Support: Safari 8+, iOS 8+
// https://bugs.webkit.org/show_bug.cgi?id=136851
// In-page `selector#id sibling-combinator selector` fails
if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
rbuggyQSA.push(".#.+[+~]");
}
});
assert(function( el ) {
el.innerHTML = "<a href='' disabled='disabled'></a>" +
"<select disabled='disabled'><option/></select>";
// Support: Windows 8 Native Apps
// The type and name attributes are restricted during .innerHTML assignment
var input = document.createElement("input");
input.setAttribute( "type", "hidden" );
el.appendChild( input ).setAttribute( "name", "D" );
// Support: IE8
// Enforce case-sensitivity of name attribute
if ( el.querySelectorAll("[name=d]").length ) {
rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if ( el.querySelectorAll(":enabled").length !== 2 ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Support: IE9-11+
// IE's :disabled selector does not pick up the children of disabled fieldsets
docElem.appendChild( el ).disabled = true;
if ( el.querySelectorAll(":disabled").length !== 2 ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Opera 10-11 does not throw on post-comma invalid pseudos
el.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");
});
}
if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
docElem.webkitMatchesSelector ||
docElem.mozMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector) )) ) {
assert(function( el ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call( el, "*" );
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( el, "[s!='']:x" );
rbuggyMatches.push( "!=", pseudos );
});
}
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
/* Contains
---------------------------------------------------------------------- */
hasCompare = rnative.test( docElem.compareDocumentPosition );
// Element contains another
// Purposefully self-exclusive
// As in, an element does not contain itself
contains = hasCompare || rnative.test( docElem.contains ) ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
/* Sorting
---------------------------------------------------------------------- */
// Document order sorting
sortOrder = hasCompare ?
function( a, b ) {
// Flag for duplicate removal
if ( a === b ) {
hasDuplicate = true;
return 0;
}
// Sort on method existence if only one input has compareDocumentPosition
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
if ( compare ) {
return compare;
}
// Calculate position if both inputs belong to the same document
compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
a.compareDocumentPosition( b ) :
// Otherwise we know they are disconnected
1;
// Disconnected nodes
if ( compare & 1 ||
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
// Choose the first element that is related to our preferred document
if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
return -1;
}
if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
return 1;
}
// Maintain original order
return sortInput ?
( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
0;
}
return compare & 4 ? -1 : 1;
} :
function( a, b ) {
// Exit early if the nodes are identical
if ( a === b ) {
hasDuplicate = true;
return 0;
}
var cur,
i = 0,
aup = a.parentNode,
bup = b.parentNode,
ap = [ a ],
bp = [ b ];
// Parentless nodes are either documents or disconnected
if ( !aup || !bup ) {
return a === document ? -1 :
b === document ? 1 :
aup ? -1 :
bup ? 1 :
sortInput ?
( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
0;
// If the nodes are siblings, we can do a quick check
} else if ( aup === bup ) {
return siblingCheck( a, b );
}
// Otherwise we need full lists of their ancestors for comparison
cur = a;
while ( (cur = cur.parentNode) ) {
ap.unshift( cur );
}
cur = b;
while ( (cur = cur.parentNode) ) {
bp.unshift( cur );
}
// Walk down the tree looking for a discrepancy
while ( ap[i] === bp[i] ) {
i++;
}
return i ?
// Do a sibling check if the nodes have a common ancestor
siblingCheck( ap[i], bp[i] ) :
// Otherwise nodes in our document sort first
ap[i] === preferredDoc ? -1 :
bp[i] === preferredDoc ? 1 :
0;
};
return document;
};
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
if ( support.matchesSelector && documentIsHTML &&
!compilerCache[ expr + " " ] &&
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || support.disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch (e) {}
}
return Sizzle( expr, document, null, [ elem ] ).length > 0;
};
Sizzle.contains = function( context, elem ) {
// Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context );
}
return contains( context, elem );
};
Sizzle.attr = function( elem, name ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
var fn = Expr.attrHandle[ name.toLowerCase() ],
// Don't get fooled by Object.prototype properties (jQuery #13807)
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
fn( elem, name, !documentIsHTML ) :
undefined;
return val !== undefined ?
val :
support.attributes || !documentIsHTML ?
elem.getAttribute( name ) :
(val = elem.getAttributeNode(name)) && val.specified ?
val.value :
null;
};
Sizzle.escape = function( sel ) {
return (sel + "").replace( rcssescape, fcssescape );
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
/**
* Document sorting and removing duplicates
* @param {ArrayLike} results
*/
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
j = 0,
i = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
sortInput = !support.sortStable && results.slice( 0 );
results.sort( sortOrder );
if ( hasDuplicate ) {
while ( (elem = results[i++]) ) {
if ( elem === results[ i ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
// Clear input after sorting to release objects
// See https://github.com/jquery/sizzle/pull/225
sortInput = null;
return results;
};
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
// If no nodeType, this is expected to be an array
while ( (node = elem[i++]) ) {
// Do not traverse comment nodes
ret += getText( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (jQuery #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
attrHandle: {},
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
if ( !match[3] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
// other types prohibit arguments
} else if ( match[3] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var excess,
unquoted = !match[6] && match[2];
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
// Accept quoted arguments as-is
if ( match[3] ) {
match[2] = match[4] || match[5] || "";
// Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
match[0] = match[0].slice( 0, excess );
match[2] = unquoted.slice( 0, excess );
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"TAG": function( nodeNameSelector ) {
var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
return nodeNameSelector === "*" ?
function() { return true; } :
function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.slice( -check.length ) === check :
operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0 ?
// Shortcut for :nth-*(n)
function( elem ) {
return !!elem.parentNode;
} :
function( elem, context, xml ) {
var cache, uniqueCache, outerCache, node, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType,
diff = false;
if ( parent ) {
// :(first|last|only)-(child|of-type)
if ( simple ) {
while ( dir ) {
node = elem;
while ( (node = node[ dir ]) ) {
if ( ofType ?
node.nodeName.toLowerCase() === name :
node.nodeType === 1 ) {
return false;
}
}
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
}
return true;
}
start = [ forward ? parent.firstChild : parent.lastChild ];
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
// ...in a gzip-friendly way
node = parent;
outerCache = node[ expando ] || (node[ expando ] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache = outerCache[ node.uniqueID ] ||
(outerCache[ node.uniqueID ] = {});
cache = uniqueCache[ type ] || [];
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
diff = nodeIndex && cache[ 2 ];
node = nodeIndex && parent.childNodes[ nodeIndex ];
while ( (node = ++nodeIndex && node && node[ dir ] ||
// Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) || start.pop()) ) {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
break;
}
}
} else {
// Use previously-cached element index if available
if ( useCache ) {
// ...in a gzip-friendly way
node = elem;
outerCache = node[ expando ] || (node[ expando ] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache = outerCache[ node.uniqueID ] ||
(outerCache[ node.uniqueID ] = {});
cache = uniqueCache[ type ] || [];
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
diff = nodeIndex;
}
// xml :nth-child(...)
// or :nth-last-child(...) or :nth(-last)?-of-type(...)
if ( diff === false ) {
// Use the same loop as above to seek `elem` from the start
while ( (node = ++nodeIndex && node && node[ dir ] ||
(diff = nodeIndex = 0) || start.pop()) ) {
if ( ( ofType ?
node.nodeName.toLowerCase() === name :
node.nodeType === 1 ) &&
++diff ) {
// Cache the index of each encountered element
if ( useCache ) {
outerCache = node[ expando ] || (node[ expando ] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache = outerCache[ node.uniqueID ] ||
(outerCache[ node.uniqueID ] = {});
uniqueCache[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
break;
}
}
}
}
}
// Incorporate the offset, then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
// Potentially complex pseudos
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
// Don't keep the element (issue #299)
input[0] = null;
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
text = text.replace( runescape, funescape );
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction( function( lang ) {
// lang value must be a valid identifier
if ( !ridentifier.test(lang || "") ) {
Sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
var elemLang;
do {
if ( (elemLang = documentIsHTML ?
elem.lang :
elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
}
} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
return false;
};
}),
// Miscellaneous
"target": function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
},
"root": function( elem ) {
return elem === docElem;
},
"focus": function( elem ) {
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
// Boolean properties
"enabled": createDisabledPseudo( false ),
"disabled": createDisabledPseudo( true ),
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected": function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
// Contents
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
// but not by others (comment: 8; processing instruction: 7; etc.)
// nodeType < 6 works because attributes (2) do not appear as children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeType < 6 ) {
return false;
}
}
return true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
// Element/input types
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"text": function( elem ) {
var attr;
return elem.nodeName.toLowerCase() === "input" &&
elem.type === "text" &&
// Support: IE<8
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
},
// Position-in-collection
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
Expr.pseudos[ i ] = createButtonPseudo( i );
}
// Easy API for creating new setFilters
function setFilters() {}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();
tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( (tokens = []) );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
matched = match.shift();
tokens.push({
value: matched,
// Cast descendant combinators to space
type: match[0].replace( rtrim, " " )
});
soFar = soFar.slice( matched.length );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
matched = match.shift();
tokens.push({
value: matched,
type: type,
matches: match
});
soFar = soFar.slice( matched.length );
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
};
function toSelector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
skip = combinator.next,
key = skip || dir,
checkNonElements = base && key === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
}
return false;
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
var oldCache, uniqueCache, outerCache,
newCache = [ dirruns, doneName ];
// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || (elem[ expando ] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
if ( skip && skip === elem.nodeName.toLowerCase() ) {
elem = elem[ dir ] || elem;
} else if ( (oldCache = uniqueCache[ key ]) &&
oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
// Assign to newCache so results back-propagate to previous elements
return (newCache[ 2 ] = oldCache[ 2 ]);
} else {
// Reuse newcache so results back-propagate to previous elements
uniqueCache[ key ] = newCache;
// A match means we're done; a fail means we have to keep checking
if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
return true;
}
}
}
}
}
return false;
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
// Avoid hanging onto element (issue #299)
checkContext = null;
return ret;
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector(
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && toSelector( tokens )
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, outermost ) {
var elem, j, matcher,
matchedCount = 0,
i = "0",
unmatched = seed && [],
setMatched = [],
contextBackup = outermostContext,
// We must always have either seed elements or outermost context
elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
len = elems.length;
if ( outermost ) {
outermostContext = context === document || context || outermost;
}
// Add elements passing elementMatchers directly to results
// Support: IE<9, Safari
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
if ( !context && elem.ownerDocument !== document ) {
setDocument( elem );
xml = !documentIsHTML;
}
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context || document, xml) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// `i` is now the count of elements visited above, and adding it to `matchedCount`
// makes the latter nonnegative.
matchedCount += i;
// Apply set filters to unmatched elements
// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
// no element matchers and no seed.
// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
// case, which will result in a "00" `matchedCount` that differs from `i` but is also
// numerically zero.
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !match ) {
match = tokenize( selector );
}
i = match.length;
while ( i-- ) {
cached = matcherFromTokens( match[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
// Save selector and tokenization
cached.selector = selector;
}
return cached;
};
/**
* A low-level selection function that works with Sizzle's compiled
* selector functions
* @param {String|Function} selector A selector or a pre-compiled
* selector function built with Sizzle.compile
* @param {Element} context
* @param {Array} [results]
* @param {Array} [seed] A set of elements to match against
*/
select = Sizzle.select = function( selector, context, results, seed ) {
var i, tokens, token, type, find,
compiled = typeof selector === "function" && selector,
match = !seed && tokenize( (selector = compiled.selector || selector) );
results = results || [];
// Try to minimize operations if there is only one selector in the list and no seed
// (the latter of which guarantees us context)
if ( match.length === 1 ) {
// Reduce context if the leading compound selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
if ( !context ) {
return results;
// Precompiled matchers will still verify ancestry, so step up a level
} else if ( compiled ) {
context = context.parentNode;
}
selector = selector.slice( tokens.shift().value.length );
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toSelector( tokens );
if ( !selector ) {
push.apply( results, seed );
return results;
}
break;
}
}
}
}
// Compile and execute a filtering function if one is not provided
// Provide `match` to avoid retokenization if we modified the selector above
( compiled || compile( selector, match ) )(
seed,
context,
!documentIsHTML,
results,
!context || rsibling.test( selector ) && testContext( context.parentNode ) || context
);
return results;
};
// One-time assignments
// Sort stability
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
// Support: Chrome 14-35+
// Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = !!hasDuplicate;
// Initialize against the default document
setDocument();
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert(function( el ) {
// Should return 1, but returns 4 (following)
return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
});
// Support: IE<8
// Prevent attribute/property "interpolation"
// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !assert(function( el ) {
el.innerHTML = "<a href='#'></a>";
return el.firstChild.getAttribute("href") === "#" ;
}) ) {
addHandle( "type|href|height|width", function( elem, name, isXML ) {
if ( !isXML ) {
return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
}
});
}
// Support: IE<9
// Use defaultValue in place of getAttribute("value")
if ( !support.attributes || !assert(function( el ) {
el.innerHTML = "<input/>";
el.firstChild.setAttribute( "value", "" );
return el.firstChild.getAttribute( "value" ) === "";
}) ) {
addHandle( "value", function( elem, name, isXML ) {
if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
return elem.defaultValue;
}
});
}
// Support: IE<9
// Use getAttributeNode to fetch booleans when getAttribute lies
if ( !assert(function( el ) {
return el.getAttribute("disabled") == null;
}) ) {
addHandle( booleans, function( elem, name, isXML ) {
var val;
if ( !isXML ) {
return elem[ name ] === true ? name.toLowerCase() :
(val = elem.getAttributeNode( name )) && val.specified ?
val.value :
null;
}
});
}
return Sizzle;
})( window );
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
// Deprecated
jQuery.expr[ ":" ] = jQuery.expr.pseudos;
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
jQuery.escapeSelector = Sizzle.escape;
var dir = function( elem, dir, until ) {
var matched = [],
truncate = until !== undefined;
while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
if ( elem.nodeType === 1 ) {
if ( truncate && jQuery( elem ).is( until ) ) {
break;
}
matched.push( elem );
}
}
return matched;
};
var siblings = function( n, elem ) {
var matched = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
matched.push( n );
}
}
return matched;
};
var rneedsContext = jQuery.expr.match.needsContext;
var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
var risSimple = /^.[^:#\[\.,]*$/;
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) {
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep( elements, function( elem, i ) {
return !!qualifier.call( elem, i, elem ) !== not;
} );
}
// Single element
if ( qualifier.nodeType ) {
return jQuery.grep( elements, function( elem ) {
return ( elem === qualifier ) !== not;
} );
}
// Arraylike of elements (jQuery, arguments, Array)
if ( typeof qualifier !== "string" ) {
return jQuery.grep( elements, function( elem ) {
return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
} );
}
// Simple selector that can be filtered directly, removing non-Elements
if ( risSimple.test( qualifier ) ) {
return jQuery.filter( qualifier, elements, not );
}
// Complex selector, compare the two sets, removing non-Elements
qualifier = jQuery.filter( qualifier, elements );
return jQuery.grep( elements, function( elem ) {
return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
} );
}
jQuery.filter = function( expr, elems, not ) {
var elem = elems[ 0 ];
if ( not ) {
expr = ":not(" + expr + ")";
}
if ( elems.length === 1 && elem.nodeType === 1 ) {
return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
}
return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
return elem.nodeType === 1;
} ) );
};
jQuery.fn.extend( {
find: function( selector ) {
var i, ret,
len = this.length,
self = this;
if ( typeof selector !== "string" ) {
return this.pushStack( jQuery( selector ).filter( function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
} ) );
}
ret = this.pushStack( [] );
for ( i = 0; i < len; i++ ) {
jQuery.find( selector, self[ i ], ret );
}
return len > 1 ? jQuery.uniqueSort( ret ) : ret;
},
filter: function( selector ) {
return this.pushStack( winnow( this, selector || [], false ) );
},
not: function( selector ) {
return this.pushStack( winnow( this, selector || [], true ) );
},
is: function( selector ) {
return !!winnow(
this,
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
typeof selector === "string" && rneedsContext.test( selector ) ?
jQuery( selector ) :
selector || [],
false
).length;
}
} );
// Initialize a jQuery object
// A central reference to the root jQuery(document)
var rootjQuery,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <)
// Shortcut simple #id case for speed
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
init = jQuery.fn.init = function( selector, context, root ) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// Method init() accepts an alternate rootjQuery
// so migrate can support jQuery.sub (gh-2101)
root = root || rootjQuery;
// Handle HTML strings
if ( typeof selector === "string" ) {
if ( selector[ 0 ] === "<" &&
selector[ selector.length - 1 ] === ">" &&
selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = rquickExpr.exec( selector );
}
// Match html or make sure no context is specified for #id
if ( match && ( match[ 1 ] || !context ) ) {
// HANDLE: $(html) -> $(array)
if ( match[ 1 ] ) {
context = context instanceof jQuery ? context[ 0 ] : context;
// Option to run scripts is true for back-compat
// Intentionally let the error be thrown if parseHTML is not present
jQuery.merge( this, jQuery.parseHTML(
match[ 1 ],
context && context.nodeType ? context.ownerDocument || context : document,
true
) );
// HANDLE: $(html, props)
if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
for ( match in context ) {
// Properties of context are called as methods if possible
if ( jQuery.isFunction( this[ match ] ) ) {
this[ match ]( context[ match ] );
// ...and otherwise set as attributes
} else {
this.attr( match, context[ match ] );
}
}
}
return this;
// HANDLE: $(#id)
} else {
elem = document.getElementById( match[ 2 ] );
if ( elem ) {
// Inject the element directly into the jQuery object
this[ 0 ] = elem;
this.length = 1;
}
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || root ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(DOMElement)
} else if ( selector.nodeType ) {
this[ 0 ] = selector;
this.length = 1;
return this;
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return root.ready !== undefined ?
root.ready( selector ) :
// Execute immediately if ready is not present
selector( jQuery );
}
return jQuery.makeArray( selector, this );
};
// Give the init function the jQuery prototype for later instantiation
init.prototype = jQuery.fn;
// Initialize central reference
rootjQuery = jQuery( document );
var rparentsprev = /^(?:parents|prev(?:Until|All))/,
// Methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend( {
has: function( target ) {
var targets = jQuery( target, this ),
l = targets.length;
return this.filter( function() {
var i = 0;
for ( ; i < l; i++ ) {
if ( jQuery.contains( this, targets[ i ] ) ) {
return true;
}
}
} );
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
matched = [],
targets = typeof selectors !== "string" && jQuery( selectors );
// Positional selectors never match, since there's no _selection_ context
if ( !rneedsContext.test( selectors ) ) {
for ( ; i < l; i++ ) {
for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
// Always skip document fragments
if ( cur.nodeType < 11 && ( targets ?
targets.index( cur ) > -1 :
// Don't pass non-elements to Sizzle
cur.nodeType === 1 &&
jQuery.find.matchesSelector( cur, selectors ) ) ) {
matched.push( cur );
break;
}
}
}
}
return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
},
// Determine the position of an element within the set
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
}
// Index in selector
if ( typeof elem === "string" ) {
return indexOf.call( jQuery( elem ), this[ 0 ] );
}
// Locate the position of the desired element
return indexOf.call( this,
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[ 0 ] : elem
);
},
add: function( selector, context ) {
return this.pushStack(
jQuery.uniqueSort(
jQuery.merge( this.get(), jQuery( selector, context ) )
)
);
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter( selector )
);
}
} );
function sibling( cur, dir ) {
while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
return cur;
}
jQuery.each( {
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return dir( elem, "parentNode", until );
},
next: function( elem ) {
return sibling( elem, "nextSibling" );
},
prev: function( elem ) {
return sibling( elem, "previousSibling" );
},
nextAll: function( elem ) {
return dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return siblings( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return siblings( elem.firstChild );
},
contents: function( elem ) {
return elem.contentDocument || jQuery.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var matched = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
matched = jQuery.filter( selector, matched );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
jQuery.uniqueSort( matched );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
matched.reverse();
}
}
return this.pushStack( matched );
};
} );
var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
// Convert String-formatted options into Object-formatted ones
function createOptions( options ) {
var object = {};
jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
object[ flag ] = true;
} );
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
createOptions( options ) :
jQuery.extend( {}, options );
var // Flag to know if list is currently firing
firing,
// Last fire value for non-forgettable lists
memory,
// Flag to know if list was already fired
fired,
// Flag to prevent firing
locked,
// Actual callback list
list = [],
// Queue of execution data for repeatable lists
queue = [],
// Index of currently firing callback (modified by add/remove as needed)
firingIndex = -1,
// Fire callbacks
fire = function() {
// Enforce single-firing
locked = options.once;
// Execute callbacks for all pending executions,
// respecting firingIndex overrides and runtime changes
fired = firing = true;
for ( ; queue.length; firingIndex = -1 ) {
memory = queue.shift();
while ( ++firingIndex < list.length ) {
// Run callback and check for early termination
if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
options.stopOnFalse ) {
// Jump to end and forget the data so .add doesn't re-fire
firingIndex = list.length;
memory = false;
}
}
}
// Forget the data if we're done with it
if ( !options.memory ) {
memory = false;
}
firing = false;
// Clean up if we're done firing for good
if ( locked ) {
// Keep an empty list if we have data for future add calls
if ( memory ) {
list = [];
// Otherwise, this object is spent
} else {
list = "";
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// If we have memory from a past run, we should fire after adding
if ( memory && !firing ) {
firingIndex = list.length - 1;
queue.push( memory );
}
( function add( args ) {
jQuery.each( args, function( _, arg ) {
if ( jQuery.isFunction( arg ) ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
// Inspect recursively
add( arg );
}
} );
} )( arguments );
if ( memory && !firing ) {
fire();
}
}
return this;
},
// Remove a callback from the list
remove: function() {
jQuery.each( arguments, function( _, arg ) {
var index;
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( index <= firingIndex ) {
firingIndex--;
}
}
} );
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ?
jQuery.inArray( fn, list ) > -1 :
list.length > 0;
},
// Remove all callbacks from the list
empty: function() {
if ( list ) {
list = [];
}
return this;
},
// Disable .fire and .add
// Abort any current/pending executions
// Clear all callbacks and values
disable: function() {
locked = queue = [];
list = memory = "";
return this;
},
disabled: function() {
return !list;
},
// Disable .fire
// Also disable .add unless we have memory (since it would have no effect)
// Abort any pending executions
lock: function() {
locked = queue = [];
if ( !memory && !firing ) {
list = memory = "";
}
return this;
},
locked: function() {
return !!locked;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
if ( !locked ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
queue.push( args );
if ( !firing ) {
fire();
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
function Identity( v ) {
return v;
}
function Thrower( ex ) {
throw ex;
}
function adoptValue( value, resolve, reject ) {
var method;
try {
// Check for promise aspect first to privilege synchronous behavior
if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
method.call( value ).done( resolve ).fail( reject );
// Other thenables
} else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
method.call( value, resolve, reject );
// Other non-thenables
} else {
// Support: Android 4.0 only
// Strict mode functions invoked without .call/.apply get global-object context
resolve.call( undefined, value );
}
// For Promises/A+, convert exceptions into rejections
// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
// Deferred#then to conditionally suppress rejection.
} catch ( value ) {
// Support: Android 4.0 only
// Strict mode functions invoked without .call/.apply get global-object context
reject.call( undefined, value );
}
}
jQuery.extend( {
Deferred: function( func ) {
var tuples = [
// action, add listener, callbacks,
// ... .then handlers, argument index, [final state]
[ "notify", "progress", jQuery.Callbacks( "memory" ),
jQuery.Callbacks( "memory" ), 2 ],
[ "resolve", "done", jQuery.Callbacks( "once memory" ),
jQuery.Callbacks( "once memory" ), 0, "resolved" ],
[ "reject", "fail", jQuery.Callbacks( "once memory" ),
jQuery.Callbacks( "once memory" ), 1, "rejected" ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
"catch": function( fn ) {
return promise.then( null, fn );
},
// Keep pipe for back-compat
pipe: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
return jQuery.Deferred( function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
// Map tuples (progress, done, fail) to arguments (done, fail, progress)
var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
// deferred.progress(function() { bind to newDefer or newDefer.notify })
// deferred.done(function() { bind to newDefer or newDefer.resolve })
// deferred.fail(function() { bind to newDefer or newDefer.reject })
deferred[ tuple[ 1 ] ]( function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.progress( newDefer.notify )
.done( newDefer.resolve )
.fail( newDefer.reject );
} else {
newDefer[ tuple[ 0 ] + "With" ](
this,
fn ? [ returned ] : arguments
);
}
} );
} );
fns = null;
} ).promise();
},
then: function( onFulfilled, onRejected, onProgress ) {
var maxDepth = 0;
function resolve( depth, deferred, handler, special ) {
return function() {
var that = this,
args = arguments,
mightThrow = function() {
var returned, then;
// Support: Promises/A+ section 2.3.3.3.3
// https://promisesaplus.com/#point-59
// Ignore double-resolution attempts
if ( depth < maxDepth ) {
return;
}
returned = handler.apply( that, args );
// Support: Promises/A+ section 2.3.1
// https://promisesaplus.com/#point-48
if ( returned === deferred.promise() ) {
throw new TypeError( "Thenable self-resolution" );
}
// Support: Promises/A+ sections 2.3.3.1, 3.5
// https://promisesaplus.com/#point-54
// https://promisesaplus.com/#point-75
// Retrieve `then` only once
then = returned &&
// Support: Promises/A+ section 2.3.4
// https://promisesaplus.com/#point-64
// Only check objects and functions for thenability
( typeof returned === "object" ||
typeof returned === "function" ) &&
returned.then;
// Handle a returned thenable
if ( jQuery.isFunction( then ) ) {
// Special processors (notify) just wait for resolution
if ( special ) {
then.call(
returned,
resolve( maxDepth, deferred, Identity, special ),
resolve( maxDepth, deferred, Thrower, special )
);
// Normal processors (resolve) also hook into progress
} else {
// ...and disregard older resolution values
maxDepth++;
then.call(
returned,
resolve( maxDepth, deferred, Identity, special ),
resolve( maxDepth, deferred, Thrower, special ),
resolve( maxDepth, deferred, Identity,
deferred.notifyWith )
);
}
// Handle all other returned values
} else {
// Only substitute handlers pass on context
// and multiple values (non-spec behavior)
if ( handler !== Identity ) {
that = undefined;
args = [ returned ];
}
// Process the value(s)
// Default process is resolve
( special || deferred.resolveWith )( that, args );
}
},
// Only normal processors (resolve) catch and reject exceptions
process = special ?
mightThrow :
function() {
try {
mightThrow();
} catch ( e ) {
if ( jQuery.Deferred.exceptionHook ) {
jQuery.Deferred.exceptionHook( e,
process.stackTrace );
}
// Support: Promises/A+ section 2.3.3.3.4.1
// https://promisesaplus.com/#point-61
// Ignore post-resolution exceptions
if ( depth + 1 >= maxDepth ) {
// Only substitute handlers pass on context
// and multiple values (non-spec behavior)
if ( handler !== Thrower ) {
that = undefined;
args = [ e ];
}
deferred.rejectWith( that, args );
}
}
};
// Support: Promises/A+ section 2.3.3.3.1
// https://promisesaplus.com/#point-57
// Re-resolve promises immediately to dodge false rejection from
// subsequent errors
if ( depth ) {
process();
} else {
// Call an optional hook to record the stack, in case of exception
// since it's otherwise lost when execution goes async
if ( jQuery.Deferred.getStackHook ) {
process.stackTrace = jQuery.Deferred.getStackHook();
}
window.setTimeout( process );
}
};
}
return jQuery.Deferred( function( newDefer ) {
// progress_handlers.add( ... )
tuples[ 0 ][ 3 ].add(
resolve(
0,
newDefer,
jQuery.isFunction( onProgress ) ?
onProgress :
Identity,
newDefer.notifyWith
)
);
// fulfilled_handlers.add( ... )
tuples[ 1 ][ 3 ].add(
resolve(
0,
newDefer,
jQuery.isFunction( onFulfilled ) ?
onFulfilled :
Identity
)
);
// rejected_handlers.add( ... )
tuples[ 2 ][ 3 ].add(
resolve(
0,
newDefer,
jQuery.isFunction( onRejected ) ?
onRejected :
Thrower
)
);
} ).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
}
},
deferred = {};
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
stateString = tuple[ 5 ];
// promise.progress = list.add
// promise.done = list.add
// promise.fail = list.add
promise[ tuple[ 1 ] ] = list.add;
// Handle state
if ( stateString ) {
list.add(
function() {
// state = "resolved" (i.e., fulfilled)
// state = "rejected"
state = stateString;
},
// rejected_callbacks.disable
// fulfilled_callbacks.disable
tuples[ 3 - i ][ 2 ].disable,
// progress_callbacks.lock
tuples[ 0 ][ 2 ].lock
);
}
// progress_handlers.fire
// fulfilled_handlers.fire
// rejected_handlers.fire
list.add( tuple[ 3 ].fire );
// deferred.notify = function() { deferred.notifyWith(...) }
// deferred.resolve = function() { deferred.resolveWith(...) }
// deferred.reject = function() { deferred.rejectWith(...) }
deferred[ tuple[ 0 ] ] = function() {
deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
return this;
};
// deferred.notifyWith = list.fireWith
// deferred.resolveWith = list.fireWith
// deferred.rejectWith = list.fireWith
deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
} );
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( singleValue ) {
var
// count of uncompleted subordinates
remaining = arguments.length,
// count of unprocessed arguments
i = remaining,
// subordinate fulfillment data
resolveContexts = Array( i ),
resolveValues = slice.call( arguments ),
// the master Deferred
master = jQuery.Deferred(),
// subordinate callback factory
updateFunc = function( i ) {
return function( value ) {
resolveContexts[ i ] = this;
resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
if ( !( --remaining ) ) {
master.resolveWith( resolveContexts, resolveValues );
}
};
};
// Single- and empty arguments are adopted like Promise.resolve
if ( remaining <= 1 ) {
adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject );
// Use .then() to unwrap secondary thenables (cf. gh-3000)
if ( master.state() === "pending" ||
jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
return master.then();
}
}
// Multiple arguments are aggregated like Promise.all array elements
while ( i-- ) {
adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
}
return master.promise();
}
} );
// These usually indicate a programmer mistake during development,
// warn about them ASAP rather than swallowing them by default.
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
jQuery.Deferred.exceptionHook = function( error, stack ) {
// Support: IE 8 - 9 only
// Console exists when dev tools are open, which can happen at any time
if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
}
};
jQuery.readyException = function( error ) {
window.setTimeout( function() {
throw error;
} );
};
// The deferred used on DOM ready
var readyList = jQuery.Deferred();
jQuery.fn.ready = function( fn ) {
readyList
.then( fn )
// Wrap jQuery.readyException in a function so that the lookup
// happens at the time of error handling instead of callback
// registration.
.catch( function( error ) {
jQuery.readyException( error );
} );
return this;
};
jQuery.extend( {
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return;
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
}
} );
jQuery.ready.then = readyList.then;
// The ready event handler and self cleanup method
function completed() {
document.removeEventListener( "DOMContentLoaded", completed );
window.removeEventListener( "load", completed );
jQuery.ready();
}
// Catch cases where $(document).ready() is called
// after the browser event has already occurred.
// Support: IE <=9 - 10 only
// Older IE sometimes signals "interactive" too soon
if ( document.readyState === "complete" ||
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
window.setTimeout( jQuery.ready );
} else {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed );
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed );
}
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0,
len = elems.length,
bulk = key == null;
// Sets many values
if ( jQuery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
access( elems, fn, i, key[ i ], true, emptyGet, raw );
}
// Sets one value
} else if ( value !== undefined ) {
chainable = true;
if ( !jQuery.isFunction( value ) ) {
raw = true;
}
if ( bulk ) {
// Bulk operations run against the entire set
if ( raw ) {
fn.call( elems, value );
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function( elem, key, value ) {
return bulk.call( jQuery( elem ), value );
};
}
}
if ( fn ) {
for ( ; i < len; i++ ) {
fn(
elems[ i ], key, raw ?
value :
value.call( elems[ i ], i, fn( elems[ i ], key ) )
);
}
}
}
if ( chainable ) {
return elems;
}
// Gets
if ( bulk ) {
return fn.call( elems );
}
return len ? fn( elems[ 0 ], key ) : emptyGet;
};
var acceptData = function( owner ) {
// Accepts only:
// - Node
// - Node.ELEMENT_NODE
// - Node.DOCUMENT_NODE
// - Object
// - Any
return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
};
function Data() {
this.expando = jQuery.expando + Data.uid++;
}
Data.uid = 1;
Data.prototype = {
cache: function( owner ) {
// Check if the owner object already has a cache
var value = owner[ this.expando ];
// If not, create one
if ( !value ) {
value = {};
// We can accept data for non-element nodes in modern browsers,
// but we should not, see #8335.
// Always return an empty object.
if ( acceptData( owner ) ) {
// If it is a node unlikely to be stringify-ed or looped over
// use plain assignment
if ( owner.nodeType ) {
owner[ this.expando ] = value;
// Otherwise secure it in a non-enumerable property
// configurable must be true to allow the property to be
// deleted when data is removed
} else {
Object.defineProperty( owner, this.expando, {
value: value,
configurable: true
} );
}
}
}
return value;
},
set: function( owner, data, value ) {
var prop,
cache = this.cache( owner );
// Handle: [ owner, key, value ] args
// Always use camelCase key (gh-2257)
if ( typeof data === "string" ) {
cache[ jQuery.camelCase( data ) ] = value;
// Handle: [ owner, { properties } ] args
} else {
// Copy the properties one-by-one to the cache object
for ( prop in data ) {
cache[ jQuery.camelCase( prop ) ] = data[ prop ];
}
}
return cache;
},
get: function( owner, key ) {
return key === undefined ?
this.cache( owner ) :
// Always use camelCase key (gh-2257)
owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
},
access: function( owner, key, value ) {
// In cases where either:
//
// 1. No key was specified
// 2. A string key was specified, but no value provided
//
// Take the "read" path and allow the get method to determine
// which value to return, respectively either:
//
// 1. The entire cache object
// 2. The data stored at the key
//
if ( key === undefined ||
( ( key && typeof key === "string" ) && value === undefined ) ) {
return this.get( owner, key );
}
// When the key is not a string, or both a key and value
// are specified, set or extend (existing objects) with either:
//
// 1. An object of properties
// 2. A key and value
//
this.set( owner, key, value );
// Since the "set" path can have two possible entry points
// return the expected data based on which path was taken[*]
return value !== undefined ? value : key;
},
remove: function( owner, key ) {
var i,
cache = owner[ this.expando ];
if ( cache === undefined ) {
return;
}
if ( key !== undefined ) {
// Support array or space separated string of keys
if ( jQuery.isArray( key ) ) {
// If key is an array of keys...
// We always set camelCase keys, so remove that.
key = key.map( jQuery.camelCase );
} else {
key = jQuery.camelCase( key );
// If a key with the spaces exists, use it.
// Otherwise, create an array by matching non-whitespace
key = key in cache ?
[ key ] :
( key.match( rnothtmlwhite ) || [] );
}
i = key.length;
while ( i-- ) {
delete cache[ key[ i ] ];
}
}
// Remove the expando if there's no more data
if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
// Support: Chrome <=35 - 45
// Webkit & Blink performance suffers when deleting properties
// from DOM nodes, so set to undefined instead
// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
if ( owner.nodeType ) {
owner[ this.expando ] = undefined;
} else {
delete owner[ this.expando ];
}
}
},
hasData: function( owner ) {
var cache = owner[ this.expando ];
return cache !== undefined && !jQuery.isEmptyObject( cache );
}
};
var dataPriv = new Data();
var dataUser = new Data();
// Implementation Summary
//
// 1. Enforce API surface and semantic compatibility with 1.9.x branch
// 2. Improve the module's maintainability by reducing the storage
// paths to a single mechanism.
// 3. Use the same single mechanism to support "private" and "user" data.
// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
// 5. Avoid exposing implementation details on user objects (eg. expando properties)
// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
rmultiDash = /[A-Z]/g;
function getData( data ) {
if ( data === "true" ) {
return true;
}
if ( data === "false" ) {
return false;
}
if ( data === "null" ) {
return null;
}
// Only convert to a number if it doesn't change the string
if ( data === +data + "" ) {
return +data;
}
if ( rbrace.test( data ) ) {
return JSON.parse( data );
}
return data;
}
function dataAttr( elem, key, data ) {
var name;
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = getData( data );
} catch ( e ) {}
// Make sure we set the data so it isn't changed later
dataUser.set( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
jQuery.extend( {
hasData: function( elem ) {
return dataUser.hasData( elem ) || dataPriv.hasData( elem );
},
data: function( elem, name, data ) {
return dataUser.access( elem, name, data );
},
removeData: function( elem, name ) {
dataUser.remove( elem, name );
},
// TODO: Now that all calls to _data and _removeData have been replaced
// with direct calls to dataPriv methods, these can be deprecated.
_data: function( elem, name, data ) {
return dataPriv.access( elem, name, data );
},
_removeData: function( elem, name ) {
dataPriv.remove( elem, name );
}
} );
jQuery.fn.extend( {
data: function( key, value ) {
var i, name, data,
elem = this[ 0 ],
attrs = elem && elem.attributes;
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = dataUser.get( elem );
if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
i = attrs.length;
while ( i-- ) {
// Support: IE 11 only
// The attrs elements can be null (#14894)
if ( attrs[ i ] ) {
name = attrs[ i ].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.slice( 5 ) );
dataAttr( elem, name, data[ name ] );
}
}
}
dataPriv.set( elem, "hasDataAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each( function() {
dataUser.set( this, key );
} );
}
return access( this, function( value ) {
var data;
// The calling jQuery object (element matches) is not empty
// (and therefore has an element appears at this[ 0 ]) and the
// `value` parameter was not undefined. An empty jQuery object
// will result in `undefined` for elem = this[ 0 ] which will
// throw an exception if an attempt to read a data cache is made.
if ( elem && value === undefined ) {
// Attempt to get data from the cache
// The key will always be camelCased in Data
data = dataUser.get( elem, key );
if ( data !== undefined ) {
return data;
}
// Attempt to "discover" the data in
// HTML5 custom data-* attrs
data = dataAttr( elem, key );
if ( data !== undefined ) {
return data;
}
// We tried really hard, but the data doesn't exist.
return;
}
// Set the data...
this.each( function() {
// We always store the camelCased key
dataUser.set( this, key, value );
} );
}, null, value, arguments.length > 1, null, true );
},
removeData: function( key ) {
return this.each( function() {
dataUser.remove( this, key );
} );
}
} );
jQuery.extend( {
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = dataPriv.get( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray( data ) ) {
queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// Clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// Not public - generate a queueHooks object, or return the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
empty: jQuery.Callbacks( "once memory" ).add( function() {
dataPriv.remove( elem, [ type + "queue", key ] );
} )
} );
}
} );
jQuery.fn.extend( {
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[ 0 ], type );
}
return data === undefined ?
this :
this.each( function() {
var queue = jQuery.queue( this, type, data );
// Ensure a hooks for this queue
jQuery._queueHooks( this, type );
if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
} );
},
dequeue: function( type ) {
return this.each( function() {
jQuery.dequeue( this, type );
} );
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while ( i-- ) {
tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
} );
var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
var isHiddenWithinTree = function( elem, el ) {
// isHiddenWithinTree might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
// Inline style trumps all
return elem.style.display === "none" ||
elem.style.display === "" &&
// Otherwise, check computed style
// Support: Firefox <=43 - 45
// Disconnected elements can have computed display: none, so first confirm that elem is
// in the document.
jQuery.contains( elem.ownerDocument, elem ) &&
jQuery.css( elem, "display" ) === "none";
};
var swap = function( elem, options, callback, args ) {
var ret, name,
old = {};
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
};
function adjustCSS( elem, prop, valueParts, tween ) {
var adjusted,
scale = 1,
maxIterations = 20,
currentValue = tween ?
function() {
return tween.cur();
} :
function() {
return jQuery.css( elem, prop, "" );
},
initial = currentValue(),
unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
// Starting value computation is required for potential unit mismatches
initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
rcssNum.exec( jQuery.css( elem, prop ) );
if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
// Trust units reported by jQuery.css
unit = unit || initialInUnit[ 3 ];
// Make sure we update the tween properties later on
valueParts = valueParts || [];
// Iteratively approximate from a nonzero starting point
initialInUnit = +initial || 1;
do {
// If previous iteration zeroed out, double until we get *something*.
// Use string for doubling so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// Adjust and apply
initialInUnit = initialInUnit / scale;
jQuery.style( elem, prop, initialInUnit + unit );
// Update scale, tolerating zero or NaN from tween.cur()
// Break the loop if scale is unchanged or perfect, or if we've just had enough.
} while (
scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
);
}
if ( valueParts ) {
initialInUnit = +initialInUnit || +initial || 0;
// Apply relative offset (+=/-=) if specified
adjusted = valueParts[ 1 ] ?
initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
+valueParts[ 2 ];
if ( tween ) {
tween.unit = unit;
tween.start = initialInUnit;
tween.end = adjusted;
}
}
return adjusted;
}
var defaultDisplayMap = {};
function getDefaultDisplay( elem ) {
var temp,
doc = elem.ownerDocument,
nodeName = elem.nodeName,
display = defaultDisplayMap[ nodeName ];
if ( display ) {
return display;
}
temp = doc.body.appendChild( doc.createElement( nodeName ) );
display = jQuery.css( temp, "display" );
temp.parentNode.removeChild( temp );
if ( display === "none" ) {
display = "block";
}
defaultDisplayMap[ nodeName ] = display;
return display;
}
function showHide( elements, show ) {
var display, elem,
values = [],
index = 0,
length = elements.length;
// Determine new display value for elements that need to change
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
display = elem.style.display;
if ( show ) {
// Since we force visibility upon cascade-hidden elements, an immediate (and slow)
// check is required in this first loop unless we have a nonempty display value (either
// inline or about-to-be-restored)
if ( display === "none" ) {
values[ index ] = dataPriv.get( elem, "display" ) || null;
if ( !values[ index ] ) {
elem.style.display = "";
}
}
if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
values[ index ] = getDefaultDisplay( elem );
}
} else {
if ( display !== "none" ) {
values[ index ] = "none";
// Remember what we're overwriting
dataPriv.set( elem, "display", display );
}
}
}
// Set the display of the elements in a second loop to avoid constant reflow
for ( index = 0; index < length; index++ ) {
if ( values[ index ] != null ) {
elements[ index ].style.display = values[ index ];
}
}
return elements;
}
jQuery.fn.extend( {
show: function() {
return showHide( this, true );
},
hide: function() {
return showHide( this );
},
toggle: function( state ) {
if ( typeof state === "boolean" ) {
return state ? this.show() : this.hide();
}
return this.each( function() {
if ( isHiddenWithinTree( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
} );
}
} );
var rcheckableType = ( /^(?:checkbox|radio)$/i );
var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
var rscriptType = ( /^$|\/(?:java|ecma)script/i );
// We have to close these tags to support XHTML (#13200)
var wrapMap = {
// Support: IE <=9 only
option: [ 1, "<select multiple='multiple'>", "</select>" ],
// XHTML parsers do not magically insert elements in the
// same way that tag soup parsers do. So we cannot shorten
// this by omitting <tbody> or other required elements.
thead: [ 1, "<table>", "</table>" ],
col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
_default: [ 0, "", "" ]
};
// Support: IE <=9 only
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
function getAll( context, tag ) {
// Support: IE <=9 - 11 only
// Use typeof to avoid zero-argument method invocation on host objects (#15151)
var ret;
if ( typeof context.getElementsByTagName !== "undefined" ) {
ret = context.getElementsByTagName( tag || "*" );
} else if ( typeof context.querySelectorAll !== "undefined" ) {
ret = context.querySelectorAll( tag || "*" );
} else {
ret = [];
}
if ( tag === undefined || tag && jQuery.nodeName( context, tag ) ) {
return jQuery.merge( [ context ], ret );
}
return ret;
}
// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
var i = 0,
l = elems.length;
for ( ; i < l; i++ ) {
dataPriv.set(
elems[ i ],
"globalEval",
!refElements || dataPriv.get( refElements[ i ], "globalEval" )
);
}
}
var rhtml = /<|&#?\w+;/;
function buildFragment( elems, context, scripts, selection, ignored ) {
var elem, tmp, tag, wrap, contains, j,
fragment = context.createDocumentFragment(),
nodes = [],
i = 0,
l = elems.length;
for ( ; i < l; i++ ) {
elem = elems[ i ];
if ( elem || elem === 0 ) {
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
// Convert non-html into a text node
} else if ( !rhtml.test( elem ) ) {
nodes.push( context.createTextNode( elem ) );
// Convert html into DOM nodes
} else {
tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
// Descend through wrappers to the right content
j = wrap[ 0 ];
while ( j-- ) {
tmp = tmp.lastChild;
}
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( nodes, tmp.childNodes );
// Remember the top-level container
tmp = fragment.firstChild;
// Ensure the created nodes are orphaned (#12392)
tmp.textContent = "";
}
}
}
// Remove wrapper from fragment
fragment.textContent = "";
i = 0;
while ( ( elem = nodes[ i++ ] ) ) {
// Skip elements already in the context collection (trac-4087)
if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
if ( ignored ) {
ignored.push( elem );
}
continue;
}
contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
tmp = getAll( fragment.appendChild( elem ), "script" );
// Preserve script evaluation history
if ( contains ) {
setGlobalEval( tmp );
}
// Capture executables
if ( scripts ) {
j = 0;
while ( ( elem = tmp[ j++ ] ) ) {
if ( rscriptType.test( elem.type || "" ) ) {
scripts.push( elem );
}
}
}
}
return fragment;
}
( function() {
var fragment = document.createDocumentFragment(),
div = fragment.appendChild( document.createElement( "div" ) ),
input = document.createElement( "input" );
// Support: Android 4.0 - 4.3 only
// Check state lost if the name is set (#11217)
// Support: Windows Web Apps (WWA)
// `name` and `type` must use .setAttribute for WWA (#14901)
input.setAttribute( "type", "radio" );
input.setAttribute( "checked", "checked" );
input.setAttribute( "name", "t" );
div.appendChild( input );
// Support: Android <=4.1 only
// Older WebKit doesn't clone checked state correctly in fragments
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: IE <=11 only
// Make sure textarea (and checkbox) defaultValue is properly cloned
div.innerHTML = "<textarea>x</textarea>";
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
} )();
var documentElement = document.documentElement;
var
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
// Support: IE <=9 only
// See #13393 for more info
function safeActiveElement() {
try {
return document.activeElement;
} catch ( err ) { }
}
function on( elem, types, selector, data, fn, one ) {
var origFn, type;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
on( elem, type, selector, data, types[ type ], one );
}
return elem;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return elem;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return elem.each( function() {
jQuery.event.add( this, types, fn, data, selector );
} );
}
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
global: {},
add: function( elem, types, handler, data, selector ) {
var handleObjIn, eventHandle, tmp,
events, t, handleObj,
special, handlers, type, namespaces, origType,
elemData = dataPriv.get( elem );
// Don't attach events to noData or text/comment nodes (but allow plain objects)
if ( !elemData ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Ensure that invalid selectors throw exceptions at attach time
// Evaluate against documentElement in case elem is a non-element node (e.g., document)
if ( selector ) {
jQuery.find.matchesSelector( documentElement, selector );
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
if ( !( events = elemData.events ) ) {
events = elemData.events = {};
}
if ( !( eventHandle = elemData.handle ) ) {
eventHandle = elemData.handle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
jQuery.event.dispatch.apply( elem, arguments ) : undefined;
};
}
// Handle multiple events separated by a space
types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[ t ] ) || [];
type = origType = tmp[ 1 ];
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
// There *must* be a type, no attaching namespace-only handlers
if ( !type ) {
continue;
}
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend( {
type: type,
origType: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join( "." )
}, handleObjIn );
// Init the event handler queue if we're the first
if ( !( handlers = events[ type ] ) ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener if the special events handler returns false
if ( !special.setup ||
special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, origCount, tmp,
events, t, handleObj,
special, handlers, type, namespaces, origType,
elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
if ( !elemData || !( events = elemData.events ) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[ t ] ) || [];
type = origType = tmp[ 1 ];
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector ? special.delegateType : special.bindType ) || type;
handlers = events[ type ] || [];
tmp = tmp[ 2 ] &&
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
// Remove matching events
origCount = j = handlers.length;
while ( j-- ) {
handleObj = handlers[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector ||
selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
if ( handleObj.selector ) {
handlers.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( origCount && !handlers.length ) {
if ( !special.teardown ||
special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove data and the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
dataPriv.remove( elem, "handle events" );
}
},
dispatch: function( nativeEvent ) {
// Make a writable jQuery.Event from the native event object
var event = jQuery.event.fix( nativeEvent );
var i, j, ret, matched, handleObj, handlerQueue,
args = new Array( arguments.length ),
handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[ 0 ] = event;
for ( i = 1; i < arguments.length; i++ ) {
args[ i ] = arguments[ i ];
}
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
// Run delegates first; they may want to stop propagation beneath us
i = 0;
while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
event.currentTarget = matched.elem;
j = 0;
while ( ( handleObj = matched.handlers[ j++ ] ) &&
!event.isImmediatePropagationStopped() ) {
// Triggered event must either 1) have no namespace, or 2) have namespace(s)
// a subset or equal to those in the bound event (both can have no namespace).
if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
event.handleObj = handleObj;
event.data = handleObj.data;
ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
handleObj.handler ).apply( matched.elem, args );
if ( ret !== undefined ) {
if ( ( event.result = ret ) === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
handlers: function( event, handlers ) {
var i, handleObj, sel, matchedHandlers, matchedSelectors,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
// Find delegate handlers
if ( delegateCount &&
// Support: IE <=9
// Black-hole SVG <use> instance trees (trac-13180)
cur.nodeType &&
// Support: Firefox <=42
// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
// Support: IE 11 only
// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
!( event.type === "click" && event.button >= 1 ) ) {
for ( ; cur !== this; cur = cur.parentNode || this ) {
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
matchedHandlers = [];
matchedSelectors = {};
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
// Don't conflict with Object.prototype properties (#13203)
sel = handleObj.selector + " ";
if ( matchedSelectors[ sel ] === undefined ) {
matchedSelectors[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) > -1 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( matchedSelectors[ sel ] ) {
matchedHandlers.push( handleObj );
}
}
if ( matchedHandlers.length ) {
handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
}
}
}
}
// Add the remaining (directly-bound) handlers
cur = this;
if ( delegateCount < handlers.length ) {
handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
}
return handlerQueue;
},
addProp: function( name, hook ) {
Object.defineProperty( jQuery.Event.prototype, name, {
enumerable: true,
configurable: true,
get: jQuery.isFunction( hook ) ?
function() {
if ( this.originalEvent ) {
return hook( this.originalEvent );
}
} :
function() {
if ( this.originalEvent ) {
return this.originalEvent[ name ];
}
},
set: function( value ) {
Object.defineProperty( this, name, {
enumerable: true,
configurable: true,
writable: true,
value: value
} );
}
} );
},
fix: function( originalEvent ) {
return originalEvent[ jQuery.expando ] ?
originalEvent :
new jQuery.Event( originalEvent );
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
if ( this !== safeActiveElement() && this.focus ) {
this.focus();
return false;
}
},
delegateType: "focusin"
},
blur: {
trigger: function() {
if ( this === safeActiveElement() && this.blur ) {
this.blur();
return false;
}
},
delegateType: "focusout"
},
click: {
// For checkbox, fire native event so checked state will be right
trigger: function() {
if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
this.click();
return false;
}
},
// For cross-browser consistency, don't fire native .click() on links
_default: function( event ) {
return jQuery.nodeName( event.target, "a" );
}
},
beforeunload: {
postDispatch: function( event ) {
// Support: Firefox 20+
// Firefox doesn't alert if the returnValue field is not set.
if ( event.result !== undefined && event.originalEvent ) {
event.originalEvent.returnValue = event.result;
}
}
}
}
};
jQuery.removeEvent = function( elem, type, handle ) {
// This "if" is needed for plain objects
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !( this instanceof jQuery.Event ) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = src.defaultPrevented ||
src.defaultPrevented === undefined &&
// Support: Android <=2.3 only
src.returnValue === false ?
returnTrue :
returnFalse;
// Create target properties
// Support: Safari <=6 - 7 only
// Target should not be a text node (#504, #13143)
this.target = ( src.target && src.target.nodeType === 3 ) ?
src.target.parentNode :
src.target;
this.currentTarget = src.currentTarget;
this.relatedTarget = src.relatedTarget;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
constructor: jQuery.Event,
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
isSimulated: false,
preventDefault: function() {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if ( e && !this.isSimulated ) {
e.preventDefault();
}
},
stopPropagation: function() {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if ( e && !this.isSimulated ) {
e.stopPropagation();
}
},
stopImmediatePropagation: function() {
var e = this.originalEvent;
this.isImmediatePropagationStopped = returnTrue;
if ( e && !this.isSimulated ) {
e.stopImmediatePropagation();
}
this.stopPropagation();
}
};
// Includes all common event props including KeyEvent and MouseEvent specific props
jQuery.each( {
altKey: true,
bubbles: true,
cancelable: true,
changedTouches: true,
ctrlKey: true,
detail: true,
eventPhase: true,
metaKey: true,
pageX: true,
pageY: true,
shiftKey: true,
view: true,
"char": true,
charCode: true,
key: true,
keyCode: true,
button: true,
buttons: true,
clientX: true,
clientY: true,
offsetX: true,
offsetY: true,
pointerId: true,
pointerType: true,
screenX: true,
screenY: true,
targetTouches: true,
toElement: true,
touches: true,
which: function( event ) {
var button = event.button;
// Add which for key events
if ( event.which == null && rkeyEvent.test( event.type ) ) {
return event.charCode != null ? event.charCode : event.keyCode;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
if ( button & 1 ) {
return 1;
}
if ( button & 2 ) {
return 3;
}
if ( button & 4 ) {
return 2;
}
return 0;
}
return event.which;
}
}, jQuery.event.addProp );
// Create mouseenter/leave events using mouseover/out and event-time checks
// so that event delegation works in jQuery.
// Do the same for pointerenter/pointerleave and pointerover/pointerout
//
// Support: Safari 7 only
// Safari sends mouseenter too often; see:
// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
// for the description of the bug (it existed in older Chrome versions as well).
jQuery.each( {
mouseenter: "mouseover",
mouseleave: "mouseout",
pointerenter: "pointerover",
pointerleave: "pointerout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj;
// For mouseenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
}
return ret;
}
};
} );
jQuery.fn.extend( {
on: function( types, selector, data, fn ) {
return on( this, types, selector, data, fn );
},
one: function( types, selector, data, fn ) {
return on( this, types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ?
handleObj.origType + "." + handleObj.namespace :
handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each( function() {
jQuery.event.remove( this, types, fn, selector );
} );
}
} );
var
/* eslint-disable max-len */
// See https://github.com/eslint/eslint/issues/3229
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
/* eslint-enable */
// Support: IE <=10 - 11, Edge 12 - 13
// In IE/Edge using regex groups here causes severe slowdowns.
// See https://connect.microsoft.com/IE/feedback/details/1736512/
rnoInnerhtml = /<script|<style|<link/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
function manipulationTarget( elem, content ) {
if ( jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
return elem.getElementsByTagName( "tbody" )[ 0 ] || elem;
}
return elem;
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
return elem;
}
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
elem.type = match[ 1 ];
} else {
elem.removeAttribute( "type" );
}
return elem;
}
function cloneCopyEvent( src, dest ) {
var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
if ( dest.nodeType !== 1 ) {
return;
}
// 1. Copy private data: events, handlers, etc.
if ( dataPriv.hasData( src ) ) {
pdataOld = dataPriv.access( src );
pdataCur = dataPriv.set( dest, pdataOld );
events = pdataOld.events;
if ( events ) {
delete pdataCur.handle;
pdataCur.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
}
// 2. Copy user data
if ( dataUser.hasData( src ) ) {
udataOld = dataUser.access( src );
udataCur = jQuery.extend( {}, udataOld );
dataUser.set( dest, udataCur );
}
}
// Fix IE bugs, see support tests
function fixInput( src, dest ) {
var nodeName = dest.nodeName.toLowerCase();
// Fails to persist the checked state of a cloned checkbox or radio button.
if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
dest.checked = src.checked;
// Fails to return the selected option to the default selected state when cloning options
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
}
function domManip( collection, args, callback, ignored ) {
// Flatten any nested arrays
args = concat.apply( [], args );
var fragment, first, scripts, hasScripts, node, doc,
i = 0,
l = collection.length,
iNoClone = l - 1,
value = args[ 0 ],
isFunction = jQuery.isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction ||
( l > 1 && typeof value === "string" &&
!support.checkClone && rchecked.test( value ) ) ) {
return collection.each( function( index ) {
var self = collection.eq( index );
if ( isFunction ) {
args[ 0 ] = value.call( this, index, self.html() );
}
domManip( self, args, callback, ignored );
} );
}
if ( l ) {
fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
// Require either new content or an interest in ignored elements to invoke the callback
if ( first || ignored ) {
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
hasScripts = scripts.length;
// Use the original fragment for the last item
// instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
for ( ; i < l; i++ ) {
node = fragment;
if ( i !== iNoClone ) {
node = jQuery.clone( node, true, true );
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
callback.call( collection[ i ], node, i );
}
if ( hasScripts ) {
doc = scripts[ scripts.length - 1 ].ownerDocument;
// Reenable scripts
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first document insertion
for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ];
if ( rscriptType.test( node.type || "" ) &&
!dataPriv.access( node, "globalEval" ) &&
jQuery.contains( doc, node ) ) {
if ( node.src ) {
// Optional AJAX dependency, but won't run scripts if not present
if ( jQuery._evalUrl ) {
jQuery._evalUrl( node.src );
}
} else {
DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
}
}
}
}
}
}
return collection;
}
function remove( elem, selector, keepData ) {
var node,
nodes = selector ? jQuery.filter( selector, elem ) : elem,
i = 0;
for ( ; ( node = nodes[ i ] ) != null; i++ ) {
if ( !keepData && node.nodeType === 1 ) {
jQuery.cleanData( getAll( node ) );
}
if ( node.parentNode ) {
if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
setGlobalEval( getAll( node, "script" ) );
}
node.parentNode.removeChild( node );
}
}
return elem;
}
jQuery.extend( {
htmlPrefilter: function( html ) {
return html.replace( rxhtmlTag, "<$1></$2>" );
},
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var i, l, srcElements, destElements,
clone = elem.cloneNode( true ),
inPage = jQuery.contains( elem.ownerDocument, elem );
// Fix IE cloning issues
if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
!jQuery.isXMLDoc( elem ) ) {
// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );
for ( i = 0, l = srcElements.length; i < l; i++ ) {
fixInput( srcElements[ i ], destElements[ i ] );
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
if ( deepDataAndEvents ) {
srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone );
for ( i = 0, l = srcElements.length; i < l; i++ ) {
cloneCopyEvent( srcElements[ i ], destElements[ i ] );
}
} else {
cloneCopyEvent( elem, clone );
}
}
// Preserve script evaluation history
destElements = getAll( clone, "script" );
if ( destElements.length > 0 ) {
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
}
// Return the cloned set
return clone;
},
cleanData: function( elems ) {
var data, elem, type,
special = jQuery.event.special,
i = 0;
for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
if ( acceptData( elem ) ) {
if ( ( data = elem[ dataPriv.expando ] ) ) {
if ( data.events ) {
for ( type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
}
// Support: Chrome <=35 - 45+
// Assign undefined instead of using delete, see Data#remove
elem[ dataPriv.expando ] = undefined;
}
if ( elem[ dataUser.expando ] ) {
// Support: Chrome <=35 - 45+
// Assign undefined instead of using delete, see Data#remove
elem[ dataUser.expando ] = undefined;
}
}
}
}
} );
jQuery.fn.extend( {
detach: function( selector ) {
return remove( this, selector, true );
},
remove: function( selector ) {
return remove( this, selector );
},
text: function( value ) {
return access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().each( function() {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
this.textContent = value;
}
} );
}, null, value, arguments.length );
},
append: function() {
return domManip( this, arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.appendChild( elem );
}
} );
},
prepend: function() {
return domManip( this, arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.insertBefore( elem, target.firstChild );
}
} );
},
before: function() {
return domManip( this, arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
} );
},
after: function() {
return domManip( this, arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
} );
},
empty: function() {
var elem,
i = 0;
for ( ; ( elem = this[ i ] ) != null; i++ ) {
if ( elem.nodeType === 1 ) {
// Prevent memory leaks
jQuery.cleanData( getAll( elem, false ) );
// Remove any remaining nodes
elem.textContent = "";
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function() {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
} );
},
html: function( value ) {
return access( this, function( value ) {
var elem = this[ 0 ] || {},
i = 0,
l = this.length;
if ( value === undefined && elem.nodeType === 1 ) {
return elem.innerHTML;
}
// See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
value = jQuery.htmlPrefilter( value );
try {
for ( ; i < l; i++ ) {
elem = this[ i ] || {};
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch ( e ) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function() {
var ignored = [];
// Make the changes, replacing each non-ignored context element with the new content
return domManip( this, arguments, function( elem ) {
var parent = this.parentNode;
if ( jQuery.inArray( this, ignored ) < 0 ) {
jQuery.cleanData( getAll( this ) );
if ( parent ) {
parent.replaceChild( elem, this );
}
}
// Force callback invocation
}, ignored );
}
} );
jQuery.each( {
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var elems,
ret = [],
insert = jQuery( selector ),
last = insert.length - 1,
i = 0;
for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone( true );
jQuery( insert[ i ] )[ original ]( elems );
// Support: Android <=4.0 only, PhantomJS 1 only
// .get() because push.apply(_, arraylike) throws on ancient WebKit
push.apply( ret, elems.get() );
}
return this.pushStack( ret );
};
} );
var rmargin = ( /^margin/ );
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
var getStyles = function( elem ) {
// Support: IE <=11 only, Firefox <=30 (#15098, #14150)
// IE throws on elements created in popups
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
var view = elem.ownerDocument.defaultView;
if ( !view || !view.opener ) {
view = window;
}
return view.getComputedStyle( elem );
};
( function() {
// Executing both pixelPosition & boxSizingReliable tests require only one layout
// so they're executed at the same time to save the second computation.
function computeStyleTests() {
// This is a singleton, we need to execute it only once
if ( !div ) {
return;
}
div.style.cssText =
"box-sizing:border-box;" +
"position:relative;display:block;" +
"margin:auto;border:1px;padding:1px;" +
"top:1%;width:50%";
div.innerHTML = "";
documentElement.appendChild( container );
var divStyle = window.getComputedStyle( div );
pixelPositionVal = divStyle.top !== "1%";
// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
reliableMarginLeftVal = divStyle.marginLeft === "2px";
boxSizingReliableVal = divStyle.width === "4px";
// Support: Android 4.0 - 4.3 only
// Some styles come back with percentage values, even though they shouldn't
div.style.marginRight = "50%";
pixelMarginRightVal = divStyle.marginRight === "4px";
documentElement.removeChild( container );
// Nullify the div so it wouldn't be stored in the memory and
// it will also be a sign that checks already performed
div = null;
}
var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
container = document.createElement( "div" ),
div = document.createElement( "div" );
// Finish early in limited (non-browser) environments
if ( !div.style ) {
return;
}
// Support: IE <=9 - 11 only
// Style of cloned element affects source element cloned (#8908)
div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
"padding:0;margin-top:1px;position:absolute";
container.appendChild( div );
jQuery.extend( support, {
pixelPosition: function() {
computeStyleTests();
return pixelPositionVal;
},
boxSizingReliable: function() {
computeStyleTests();
return boxSizingReliableVal;
},
pixelMarginRight: function() {
computeStyleTests();
return pixelMarginRightVal;
},
reliableMarginLeft: function() {
computeStyleTests();
return reliableMarginLeftVal;
}
} );
} )();
function curCSS( elem, name, computed ) {
var width, minWidth, maxWidth, ret,
style = elem.style;
computed = computed || getStyles( elem );
// Support: IE <=9 only
// getPropertyValue is only needed for .css('filter') (#12537)
if ( computed ) {
ret = computed.getPropertyValue( name ) || computed[ name ];
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// A tribute to the "awesome hack by Dean Edwards"
// Android Browser returns percentage for some values,
// but width seems to be reliably pixels.
// This is against the CSSOM draft spec:
// https://drafts.csswg.org/cssom/#resolved-values
if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret !== undefined ?
// Support: IE <=9 - 11 only
// IE returns zIndex value as an integer.
ret + "" :
ret;
}
function addGetHookIf( conditionFn, hookFn ) {
// Define the hook, we'll check on the first run if it's really needed.
return {
get: function() {
if ( conditionFn() ) {
// Hook not needed (or it's not possible to use it due
// to missing dependency), remove it.
delete this.get;
return;
}
// Hook needed; redefine it so that the support test is not executed again.
return ( this.get = hookFn ).apply( this, arguments );
}
};
}
var
// Swappable if display is none or starts with table
// except "table", "table-cell", or "table-caption"
// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: "0",
fontWeight: "400"
},
cssPrefixes = [ "Webkit", "Moz", "ms" ],
emptyStyle = document.createElement( "div" ).style;
// Return a css property mapped to a potentially vendor prefixed property
function vendorPropName( name ) {
// Shortcut for names that are not vendor prefixed
if ( name in emptyStyle ) {
return name;
}
// Check for vendor prefixed names
var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
if ( name in emptyStyle ) {
return name;
}
}
}
function setPositiveNumber( elem, value, subtract ) {
// Any relative (+/-) values have already been
// normalized at this point
var matches = rcssNum.exec( value );
return matches ?
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
value;
}
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
var i,
val = 0;
// If we already have the right measurement, avoid augmentation
if ( extra === ( isBorderBox ? "border" : "content" ) ) {
i = 4;
// Otherwise initialize for horizontal or vertical properties
} else {
i = name === "width" ? 1 : 0;
}
for ( ; i < 4; i += 2 ) {
// Both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
}
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
}
// At this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
} else {
// At this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
// At this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
}
}
return val;
}
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var val,
valueIsBorderBox = true,
styles = getStyles( elem ),
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// Support: IE <=11 only
// Running getBoundingClientRect on a disconnected node
// in IE throws an error.
if ( elem.getClientRects().length ) {
val = elem.getBoundingClientRect()[ name ];
}
// Some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, styles );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test( val ) ) {
return val;
}
// Check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox &&
( support.boxSizingReliable() || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
}
// Use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
styles
)
) + "px";
}
jQuery.extend( {
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
}
}
}
},
// Don't automatically add "px" to these possibly-unitless properties
cssNumber: {
"animationIterationCount": true,
"columnCount": true,
"fillOpacity": true,
"flexGrow": true,
"flexShrink": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"order": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
"float": "cssFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, hooks,
origName = jQuery.camelCase( name ),
style = elem.style;
name = jQuery.cssProps[ origName ] ||
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
// Gets hook for the prefixed version, then unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// Convert "+=" or "-=" to relative numbers (#7345)
if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
value = adjustCSS( elem, name, ret );
// Fixes bug #9237
type = "number";
}
// Make sure that null and NaN values aren't set (#7116)
if ( value == null || value !== value ) {
return;
}
// If a number was passed in, add the unit (except for certain CSS properties)
if ( type === "number" ) {
value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
}
// background-* props affect original clone's values
if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
style[ name ] = "inherit";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !( "set" in hooks ) ||
( value = hooks.set( elem, value, extra ) ) !== undefined ) {
style[ name ] = value;
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks &&
( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, extra, styles ) {
var val, num, hooks,
origName = jQuery.camelCase( name );
// Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] ||
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
// Try prefixed name followed by the unprefixed name
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks ) {
val = hooks.get( elem, true, extra );
}
// Otherwise, if a way to get the computed value exists, use that
if ( val === undefined ) {
val = curCSS( elem, name, styles );
}
// Convert "normal" to computed value
if ( val === "normal" && name in cssNormalTransform ) {
val = cssNormalTransform[ name ];
}
// Make numeric if forced or a qualifier was provided and val looks numeric
if ( extra === "" || extra ) {
num = parseFloat( val );
return extra === true || isFinite( num ) ? num || 0 : val;
}
return val;
}
} );
jQuery.each( [ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
// Certain elements can have dimension info if we invisibly show them
// but it must have a current display style that would benefit
return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
// Support: Safari 8+
// Table columns in Safari have non-zero offsetWidth & zero
// getBoundingClientRect().width unless display is changed.
// Support: IE <=11 only
// Running getBoundingClientRect on a disconnected node
// in IE throws an error.
( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
} ) :
getWidthOrHeight( elem, name, extra );
}
},
set: function( elem, value, extra ) {
var matches,
styles = extra && getStyles( elem ),
subtract = extra && augmentWidthOrHeight(
elem,
name,
extra,
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles
);
// Convert to pixels if value adjustment is needed
if ( subtract && ( matches = rcssNum.exec( value ) ) &&
( matches[ 3 ] || "px" ) !== "px" ) {
elem.style[ name ] = value;
value = jQuery.css( elem, name );
}
return setPositiveNumber( elem, value, subtract );
}
};
} );
jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
function( elem, computed ) {
if ( computed ) {
return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
elem.getBoundingClientRect().left -
swap( elem, { marginLeft: 0 }, function() {
return elem.getBoundingClientRect().left;
} )
) + "px";
}
}
);
// These hooks are used by animate to expand properties
jQuery.each( {
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i = 0,
expanded = {},
// Assumes a single number if not a string
parts = typeof value === "string" ? value.split( " " ) : [ value ];
for ( ; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
} );
jQuery.fn.extend( {
css: function( name, value ) {
return access( this, function( elem, name, value ) {
var styles, len,
map = {},
i = 0;
if ( jQuery.isArray( name ) ) {
styles = getStyles( elem );
len = name.length;
for ( ; i < len; i++ ) {
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
}
return map;
}
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
}
} );
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function( elem, options, prop, end, easing, unit ) {
this.elem = elem;
this.prop = prop;
this.easing = easing || jQuery.easing._default;
this.options = options;
this.start = this.now = this.cur();
this.end = end;
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
},
cur: function() {
var hooks = Tween.propHooks[ this.prop ];
return hooks && hooks.get ?
hooks.get( this ) :
Tween.propHooks._default.get( this );
},
run: function( percent ) {
var eased,
hooks = Tween.propHooks[ this.prop ];
if ( this.options.duration ) {
this.pos = eased = jQuery.easing[ this.easing ](
percent, this.options.duration * percent, 0, 1, this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
if ( hooks && hooks.set ) {
hooks.set( this );
} else {
Tween.propHooks._default.set( this );
}
return this;
}
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function( tween ) {
var result;
// Use a property on the element directly when it is not a DOM element,
// or when there is no matching style property that exists.
if ( tween.elem.nodeType !== 1 ||
tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
return tween.elem[ tween.prop ];
}
// Passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails.
// Simple values such as "10px" are parsed to Float;
// complex values such as "rotate(1rad)" are returned as-is.
result = jQuery.css( tween.elem, tween.prop, "" );
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function( tween ) {
// Use step hook for back compat.
// Use cssHook if its there.
// Use .style if available and use plain properties where available.
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.nodeType === 1 &&
( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
jQuery.cssHooks[ tween.prop ] ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else {
tween.elem[ tween.prop ] = tween.now;
}
}
}
};
// Support: IE <=9 only
// Panic based approach to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function( tween ) {
if ( tween.elem.nodeType && tween.elem.parentNode ) {
tween.elem[ tween.prop ] = tween.now;
}
}
};
jQuery.easing = {
linear: function( p ) {
return p;
},
swing: function( p ) {
return 0.5 - Math.cos( p * Math.PI ) / 2;
},
_default: "swing"
};
jQuery.fx = Tween.prototype.init;
// Back compat <1.8 extension point
jQuery.fx.step = {};
var
fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/,
rrun = /queueHooks$/;
function raf() {
if ( timerId ) {
window.requestAnimationFrame( raf );
jQuery.fx.tick();
}
}
// Animations created synchronously will run synchronously
function createFxNow() {
window.setTimeout( function() {
fxNow = undefined;
} );
return ( fxNow = jQuery.now() );
}
// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
var which,
i = 0,
attrs = { height: type };
// If we include width, step value is 1 to do all cssExpand values,
// otherwise step value is 2 to skip over Left and Right
includeWidth = includeWidth ? 1 : 0;
for ( ; i < 4; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
if ( includeWidth ) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
function createTween( value, prop, animation ) {
var tween,
collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
// We're done with this property
return tween;
}
}
}
function defaultPrefilter( elem, props, opts ) {
var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
isBox = "width" in props || "height" in props,
anim = this,
orig = {},
style = elem.style,
hidden = elem.nodeType && isHiddenWithinTree( elem ),
dataShow = dataPriv.get( elem, "fxshow" );
// Queue-skipping animations hijack the fx hooks
if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if ( !hooks.unqueued ) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always( function() {
// Ensure the complete handler is called before this completes
anim.always( function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
} );
} );
}
// Detect show/hide animations
for ( prop in props ) {
value = props[ prop ];
if ( rfxtypes.test( value ) ) {
delete props[ prop ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
// Pretend to be hidden if this is a "show" and
// there is still data from a stopped show/hide
if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
hidden = true;
// Ignore all other no-op show/hide data
} else {
continue;
}
}
orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
}
}
// Bail out if this is a no-op like .hide().hide()
propTween = !jQuery.isEmptyObject( props );
if ( !propTween && jQuery.isEmptyObject( orig ) ) {
return;
}
// Restrict "overflow" and "display" styles during box animations
if ( isBox && elem.nodeType === 1 ) {
// Support: IE <=9 - 11, Edge 12 - 13
// Record all 3 overflow attributes because IE does not infer the shorthand
// from identically-valued overflowX and overflowY
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Identify a display type, preferring old show/hide data over the CSS cascade
restoreDisplay = dataShow && dataShow.display;
if ( restoreDisplay == null ) {
restoreDisplay = dataPriv.get( elem, "display" );
}
display = jQuery.css( elem, "display" );
if ( display === "none" ) {
if ( restoreDisplay ) {
display = restoreDisplay;
} else {
// Get nonempty value(s) by temporarily forcing visibility
showHide( [ elem ], true );
restoreDisplay = elem.style.display || restoreDisplay;
display = jQuery.css( elem, "display" );
showHide( [ elem ] );
}
}
// Animate inline elements as inline-block
if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
if ( jQuery.css( elem, "float" ) === "none" ) {
// Restore the original display value at the end of pure show/hide animations
if ( !propTween ) {
anim.done( function() {
style.display = restoreDisplay;
} );
if ( restoreDisplay == null ) {
display = style.display;
restoreDisplay = display === "none" ? "" : display;
}
}
style.display = "inline-block";
}
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
anim.always( function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
} );
}
// Implement show/hide animations
propTween = false;
for ( prop in orig ) {
// General show/hide setup for this element animation
if ( !propTween ) {
if ( dataShow ) {
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
} else {
dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
}
// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
if ( toggle ) {
dataShow.hidden = !hidden;
}
// Show elements before animating them
if ( hidden ) {
showHide( [ elem ], true );
}
/* eslint-disable no-loop-func */
anim.done( function() {
/* eslint-enable no-loop-func */
// The final step of a "hide" animation is actually hiding the element
if ( !hidden ) {
showHide( [ elem ] );
}
dataPriv.remove( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
} );
}
// Per-property setup
propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
if ( !( prop in dataShow ) ) {
dataShow[ prop ] = propTween.start;
if ( hidden ) {
propTween.end = propTween.start;
propTween.start = 0;
}
}
}
}
function propFilter( props, specialEasing ) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// Not quite $.extend, this won't overwrite existing keys.
// Reusing 'index' because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
}
function Animation( elem, properties, options ) {
var result,
stopped,
index = 0,
length = Animation.prefilters.length,
deferred = jQuery.Deferred().always( function() {
// Don't match elem in the :animated selector
delete tick.elem;
} ),
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// Support: Android 2.3 only
// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ] );
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
},
animation = deferred.promise( {
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, {
specialEasing: {},
easing: jQuery.easing._default
}, options ),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function( prop, end ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
stop: function( gotoEnd ) {
var index = 0,
// If we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
if ( stopped ) {
return this;
}
stopped = true;
for ( ; index < length; index++ ) {
animation.tweens[ index ].run( 1 );
}
// Resolve when we played the last frame; otherwise, reject
if ( gotoEnd ) {
deferred.notifyWith( elem, [ animation, 1, 0 ] );
deferred.resolveWith( elem, [ animation, gotoEnd ] );
} else {
deferred.rejectWith( elem, [ animation, gotoEnd ] );
}
return this;
}
} ),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
for ( ; index < length; index++ ) {
result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) {
if ( jQuery.isFunction( result.stop ) ) {
jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
jQuery.proxy( result.stop, result );
}
return result;
}
}
jQuery.map( props, createTween, animation );
if ( jQuery.isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation );
}
jQuery.fx.timer(
jQuery.extend( tick, {
elem: elem,
anim: animation,
queue: animation.opts.queue
} )
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
}
jQuery.Animation = jQuery.extend( Animation, {
tweeners: {
"*": [ function( prop, value ) {
var tween = this.createTween( prop, value );
adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
return tween;
} ]
},
tweener: function( props, callback ) {
if ( jQuery.isFunction( props ) ) {
callback = props;
props = [ "*" ];
} else {
props = props.match( rnothtmlwhite );
}
var prop,
index = 0,
length = props.length;
for ( ; index < length; index++ ) {
prop = props[ index ];
Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
Animation.tweeners[ prop ].unshift( callback );
}
},
prefilters: [ defaultPrefilter ],
prefilter: function( callback, prepend ) {
if ( prepend ) {
Animation.prefilters.unshift( callback );
} else {
Animation.prefilters.push( callback );
}
}
} );
jQuery.speed = function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};
// Go to the end state if fx are off or if document is hidden
if ( jQuery.fx.off || document.hidden ) {
opt.duration = 0;
} else {
if ( typeof opt.duration !== "number" ) {
if ( opt.duration in jQuery.fx.speeds ) {
opt.duration = jQuery.fx.speeds[ opt.duration ];
} else {
opt.duration = jQuery.fx.speeds._default;
}
}
}
// Normalize opt.queue - true/undefined/null -> "fx"
if ( opt.queue == null || opt.queue === true ) {
opt.queue = "fx";
}
// Queueing
opt.old = opt.complete;
opt.complete = function() {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
}
};
return opt;
};
jQuery.fn.extend( {
fadeTo: function( speed, to, easing, callback ) {
// Show any hidden elements after setting opacity to 0
return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
// Animate to the value specified
.end().animate( { opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
// Empty animations, or finishing resolves immediately
if ( empty || dataPriv.get( this, "finish" ) ) {
anim.stop( true );
}
};
doAnimation.finish = doAnimation;
return empty || optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
var stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
};
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each( function() {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = dataPriv.get( this );
if ( index ) {
if ( data[ index ] && data[ index ].stop ) {
stopQueue( data[ index ] );
}
} else {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
stopQueue( data[ index ] );
}
}
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this &&
( type == null || timers[ index ].queue === type ) ) {
timers[ index ].anim.stop( gotoEnd );
dequeue = false;
timers.splice( index, 1 );
}
}
// Start the next in the queue if the last step wasn't forced.
// Timers currently will call their complete callbacks, which
// will dequeue but only if they were gotoEnd.
if ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
} );
},
finish: function( type ) {
if ( type !== false ) {
type = type || "fx";
}
return this.each( function() {
var index,
data = dataPriv.get( this ),
queue = data[ type + "queue" ],
hooks = data[ type + "queueHooks" ],
timers = jQuery.timers,
length = queue ? queue.length : 0;
// Enable finishing flag on private data
data.finish = true;
// Empty the queue first
jQuery.queue( this, type, [] );
if ( hooks && hooks.stop ) {
hooks.stop.call( this, true );
}
// Look for any active animations, and finish them
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
timers[ index ].anim.stop( true );
timers.splice( index, 1 );
}
}
// Look for any animations in the old queue and finish them
for ( index = 0; index < length; index++ ) {
if ( queue[ index ] && queue[ index ].finish ) {
queue[ index ].finish.call( this );
}
}
// Turn off finishing flag
delete data.finish;
} );
}
} );
jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) {
return speed == null || typeof speed === "boolean" ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
} );
// Generate shortcuts for custom animations
jQuery.each( {
slideDown: genFx( "show" ),
slideUp: genFx( "hide" ),
slideToggle: genFx( "toggle" ),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
} );
jQuery.timers = [];
jQuery.fx.tick = function() {
var timer,
i = 0,
timers = jQuery.timers;
fxNow = jQuery.now();
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
// Checks the timer has not already been removed
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
fxNow = undefined;
};
jQuery.fx.timer = function( timer ) {
jQuery.timers.push( timer );
if ( timer() ) {
jQuery.fx.start();
} else {
jQuery.timers.pop();
}
};
jQuery.fx.interval = 13;
jQuery.fx.start = function() {
if ( !timerId ) {
timerId = window.requestAnimationFrame ?
window.requestAnimationFrame( raf ) :
window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
}
};
jQuery.fx.stop = function() {
if ( window.cancelAnimationFrame ) {
window.cancelAnimationFrame( timerId );
} else {
window.clearInterval( timerId );
}
timerId = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400
};
// Based off of the plugin by Clint Helfers, with permission.
// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
jQuery.fn.delay = function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = window.setTimeout( next, time );
hooks.stop = function() {
window.clearTimeout( timeout );
};
} );
};
( function() {
var input = document.createElement( "input" ),
select = document.createElement( "select" ),
opt = select.appendChild( document.createElement( "option" ) );
input.type = "checkbox";
// Support: Android <=4.3 only
// Default value for a checkbox should be "on"
support.checkOn = input.value !== "";
// Support: IE <=11 only
// Must access selectedIndex to make default options select
support.optSelected = opt.selected;
// Support: IE <=11 only
// An input loses its value after becoming a radio
input = document.createElement( "input" );
input.value = "t";
input.type = "radio";
support.radioValue = input.value === "t";
} )();
var boolHook,
attrHandle = jQuery.expr.attrHandle;
jQuery.fn.extend( {
attr: function( name, value ) {
return access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each( function() {
jQuery.removeAttr( this, name );
} );
}
} );
jQuery.extend( {
attr: function( elem, name, value ) {
var ret, hooks,
nType = elem.nodeType;
// Don't get/set attributes on text, comment and attribute nodes
if ( nType === 3 || nType === 8 || nType === 2 ) {
return;
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === "undefined" ) {
return jQuery.prop( elem, name, value );
}
// Attribute hooks are determined by the lowercase version
// Grab necessary hook if one is defined
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return;
}
if ( hooks && "set" in hooks &&
( ret = hooks.set( elem, value, name ) ) !== undefined ) {
return ret;
}
elem.setAttribute( name, value + "" );
return value;
}
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
return ret;
}
ret = jQuery.find.attr( elem, name );
// Non-existent attributes return null, we normalize to undefined
return ret == null ? undefined : ret;
},
attrHooks: {
type: {
set: function( elem, value ) {
if ( !support.radioValue && value === "radio" &&
jQuery.nodeName( elem, "input" ) ) {
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
}
},
removeAttr: function( elem, value ) {
var name,
i = 0,
// Attribute names can contain non-HTML whitespace characters
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
attrNames = value && value.match( rnothtmlwhite );
if ( attrNames && elem.nodeType === 1 ) {
while ( ( name = attrNames[ i++ ] ) ) {
elem.removeAttribute( name );
}
}
}
} );
// Hooks for boolean attributes
boolHook = {
set: function( elem, value, name ) {
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
elem.setAttribute( name, name );
}
return name;
}
};
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
var getter = attrHandle[ name ] || jQuery.find.attr;
attrHandle[ name ] = function( elem, name, isXML ) {
var ret, handle,
lowercaseName = name.toLowerCase();
if ( !isXML ) {
// Avoid an infinite loop by temporarily removing this function from the getter
handle = attrHandle[ lowercaseName ];
attrHandle[ lowercaseName ] = ret;
ret = getter( elem, name, isXML ) != null ?
lowercaseName :
null;
attrHandle[ lowercaseName ] = handle;
}
return ret;
};
} );
var rfocusable = /^(?:input|select|textarea|button)$/i,
rclickable = /^(?:a|area)$/i;
jQuery.fn.extend( {
prop: function( name, value ) {
return access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
return this.each( function() {
delete this[ jQuery.propFix[ name ] || name ];
} );
}
} );
jQuery.extend( {
prop: function( elem, name, value ) {
var ret, hooks,
nType = elem.nodeType;
// Don't get/set properties on text, comment and attribute nodes
if ( nType === 3 || nType === 8 || nType === 2 ) {
return;
}
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks &&
( ret = hooks.set( elem, value, name ) ) !== undefined ) {
return ret;
}
return ( elem[ name ] = value );
}
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
return ret;
}
return elem[ name ];
},
propHooks: {
tabIndex: {
get: function( elem ) {
// Support: IE <=9 - 11 only
// elem.tabIndex doesn't always return the
// correct value when it hasn't been explicitly set
// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
// Use proper attribute retrieval(#12072)
var tabindex = jQuery.find.attr( elem, "tabindex" );
if ( tabindex ) {
return parseInt( tabindex, 10 );
}
if (
rfocusable.test( elem.nodeName ) ||
rclickable.test( elem.nodeName ) &&
elem.href
) {
return 0;
}
return -1;
}
}
},
propFix: {
"for": "htmlFor",
"class": "className"
}
} );
// Support: IE <=11 only
// Accessing the selectedIndex property
// forces the browser to respect setting selected
// on the option
// The getter ensures a default option is selected
// when in an optgroup
// eslint rule "no-unused-expressions" is disabled for this code
// since it considers such accessions noop
if ( !support.optSelected ) {
jQuery.propHooks.selected = {
get: function( elem ) {
/* eslint no-unused-expressions: "off" */
var parent = elem.parentNode;
if ( parent && parent.parentNode ) {
parent.parentNode.selectedIndex;
}
return null;
},
set: function( elem ) {
/* eslint no-unused-expressions: "off" */
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
}
};
}
jQuery.each( [
"tabIndex",
"readOnly",
"maxLength",
"cellSpacing",
"cellPadding",
"rowSpan",
"colSpan",
"useMap",
"frameBorder",
"contentEditable"
], function() {
jQuery.propFix[ this.toLowerCase() ] = this;
} );
// Strip and collapse whitespace according to HTML spec
// https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
function stripAndCollapse( value ) {
var tokens = value.match( rnothtmlwhite ) || [];
return tokens.join( " " );
}
function getClass( elem ) {
return elem.getAttribute && elem.getAttribute( "class" ) || "";
}
jQuery.fn.extend( {
addClass: function( value ) {
var classes, elem, cur, curValue, clazz, j, finalValue,
i = 0;
if ( jQuery.isFunction( value ) ) {
return this.each( function( j ) {
jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
} );
}
if ( typeof value === "string" && value ) {
classes = value.match( rnothtmlwhite ) || [];
while ( ( elem = this[ i++ ] ) ) {
curValue = getClass( elem );
cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
if ( cur ) {
j = 0;
while ( ( clazz = classes[ j++ ] ) ) {
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
cur += clazz + " ";
}
}
// Only assign if different to avoid unneeded rendering.
finalValue = stripAndCollapse( cur );
if ( curValue !== finalValue ) {
elem.setAttribute( "class", finalValue );
}
}
}
}
return this;
},
removeClass: function( value ) {
var classes, elem, cur, curValue, clazz, j, finalValue,
i = 0;
if ( jQuery.isFunction( value ) ) {
return this.each( function( j ) {
jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
} );
}
if ( !arguments.length ) {
return this.attr( "class", "" );
}
if ( typeof value === "string" && value ) {
classes = value.match( rnothtmlwhite ) || [];
while ( ( elem = this[ i++ ] ) ) {
curValue = getClass( elem );
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
if ( cur ) {
j = 0;
while ( ( clazz = classes[ j++ ] ) ) {
// Remove *all* instances
while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
cur = cur.replace( " " + clazz + " ", " " );
}
}
// Only assign if different to avoid unneeded rendering.
finalValue = stripAndCollapse( cur );
if ( curValue !== finalValue ) {
elem.setAttribute( "class", finalValue );
}
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value;
if ( typeof stateVal === "boolean" && type === "string" ) {
return stateVal ? this.addClass( value ) : this.removeClass( value );
}
if ( jQuery.isFunction( value ) ) {
return this.each( function( i ) {
jQuery( this ).toggleClass(
value.call( this, i, getClass( this ), stateVal ),
stateVal
);
} );
}
return this.each( function() {
var className, i, self, classNames;
if ( type === "string" ) {
// Toggle individual class names
i = 0;
self = jQuery( this );
classNames = value.match( rnothtmlwhite ) || [];
while ( ( className = classNames[ i++ ] ) ) {
// Check each className given, space separated list
if ( self.hasClass( className ) ) {
self.removeClass( className );
} else {
self.addClass( className );
}
}
// Toggle whole class name
} else if ( value === undefined || type === "boolean" ) {
className = getClass( this );
if ( className ) {
// Store className if set
dataPriv.set( this, "__className__", className );
}
// If the element has a class name or if we're passed `false`,
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
if ( this.setAttribute ) {
this.setAttribute( "class",
className || value === false ?
"" :
dataPriv.get( this, "__className__" ) || ""
);
}
}
} );
},
hasClass: function( selector ) {
var className, elem,
i = 0;
className = " " + selector + " ";
while ( ( elem = this[ i++ ] ) ) {
if ( elem.nodeType === 1 &&
( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
return true;
}
}
return false;
}
} );
var rreturn = /\r/g;
jQuery.fn.extend( {
val: function( value ) {
var hooks, ret, isFunction,
elem = this[ 0 ];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] ||
jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks &&
"get" in hooks &&
( ret = hooks.get( elem, "value" ) ) !== undefined
) {
return ret;
}
ret = elem.value;
// Handle most common string cases
if ( typeof ret === "string" ) {
return ret.replace( rreturn, "" );
}
// Handle cases where value is null/undef or number
return ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each( function( i ) {
var val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, jQuery( this ).val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map( val, function( value ) {
return value == null ? "" : value + "";
} );
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
} );
}
} );
jQuery.extend( {
valHooks: {
option: {
get: function( elem ) {
var val = jQuery.find.attr( elem, "value" );
return val != null ?
val :
// Support: IE <=10 - 11 only
// option.text throws exceptions (#14686, #14858)
// Strip and collapse whitespace
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
stripAndCollapse( jQuery.text( elem ) );
}
},
select: {
get: function( elem ) {
var value, option, i,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one",
values = one ? null : [],
max = one ? index + 1 : options.length;
if ( index < 0 ) {
i = max;
} else {
i = one ? index : 0;
}
// Loop through all the selected options
for ( ; i < max; i++ ) {
option = options[ i ];
// Support: IE <=9 only
// IE8-9 doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
!option.disabled &&
( !option.parentNode.disabled ||
!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
return values;
},
set: function( elem, value ) {
var optionSet, option,
options = elem.options,
values = jQuery.makeArray( value ),
i = options.length;
while ( i-- ) {
option = options[ i ];
/* eslint-disable no-cond-assign */
if ( option.selected =
jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
) {
optionSet = true;
}
/* eslint-enable no-cond-assign */
}
// Force browsers to behave consistently when non-matching value is set
if ( !optionSet ) {
elem.selectedIndex = -1;
}
return values;
}
}
}
} );
// Radios and checkboxes getter/setter
jQuery.each( [ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
}
}
};
if ( !support.checkOn ) {
jQuery.valHooks[ this ].get = function( elem ) {
return elem.getAttribute( "value" ) === null ? "on" : elem.value;
};
}
} );
// Return jQuery for attributes-only inclusion
var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
jQuery.extend( jQuery.event, {
trigger: function( event, data, elem, onlyHandlers ) {
var i, cur, tmp, bubbleType, ontype, handle, special,
eventPath = [ elem || document ],
type = hasOwn.call( event, "type" ) ? event.type : event,
namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf( "." ) > -1 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split( "." );
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf( ":" ) < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[ jQuery.expando ] ?
event :
new jQuery.Event( type, typeof event === "object" && event );
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join( "." );
event.rnamespace = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
null;
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data == null ?
[ event ] :
jQuery.makeArray( data, [ event ] );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) {
cur = cur.parentNode;
}
for ( ; cur; cur = cur.parentNode ) {
eventPath.push( cur );
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( tmp === ( elem.ownerDocument || document ) ) {
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
}
}
// Fire handlers on the event path
i = 0;
while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
event.type = i > 1 ?
bubbleType :
special.bindType || type;
// jQuery handler
handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
dataPriv.get( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Native handler
handle = ontype && cur[ ontype ];
if ( handle && handle.apply && acceptData( cur ) ) {
event.result = handle.apply( cur, data );
if ( event.result === false ) {
event.preventDefault();
}
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( ( !special._default ||
special._default.apply( eventPath.pop(), data ) === false ) &&
acceptData( elem ) ) {
// Call a native DOM method on the target with the same name as the event.
// Don't do default actions on window, that's where global variables be (#6170)
if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ ontype ];
if ( tmp ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
elem[ type ]();
jQuery.event.triggered = undefined;
if ( tmp ) {
elem[ ontype ] = tmp;
}
}
}
}
return event.result;
},
// Piggyback on a donor event to simulate a different one
// Used only for `focus(in | out)` events
simulate: function( type, elem, event ) {
var e = jQuery.extend(
new jQuery.Event(),
event,
{
type: type,
isSimulated: true
}
);
jQuery.event.trigger( e, null, elem );
}
} );
jQuery.fn.extend( {
trigger: function( type, data ) {
return this.each( function() {
jQuery.event.trigger( type, data, this );
} );
},
triggerHandler: function( type, data ) {
var elem = this[ 0 ];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
}
} );
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup contextmenu" ).split( " " ),
function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
} );
jQuery.fn.extend( {
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
} );
support.focusin = "onfocusin" in window;
// Support: Firefox <=44
// Firefox doesn't have focus(in | out) events
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
//
// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
// focus(in | out) events fire after focus & blur events,
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
if ( !support.focusin ) {
jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler on the document while someone wants focusin/focusout
var handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
};
jQuery.event.special[ fix ] = {
setup: function() {
var doc = this.ownerDocument || this,
attaches = dataPriv.access( doc, fix );
if ( !attaches ) {
doc.addEventListener( orig, handler, true );
}
dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
},
teardown: function() {
var doc = this.ownerDocument || this,
attaches = dataPriv.access( doc, fix ) - 1;
if ( !attaches ) {
doc.removeEventListener( orig, handler, true );
dataPriv.remove( doc, fix );
} else {
dataPriv.access( doc, fix, attaches );
}
}
};
} );
}
var location = window.location;
var nonce = jQuery.now();
var rquery = ( /\?/ );
// Cross-browser xml parsing
jQuery.parseXML = function( data ) {
var xml;
if ( !data || typeof data !== "string" ) {
return null;
}
// Support: IE 9 - 11 only
// IE throws on parseFromString with invalid input.
try {
xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
} catch ( e ) {
xml = undefined;
}
if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
};
var
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// Item is non-scalar (array or object), encode its numeric index.
buildParams(
prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
v,
traditional,
add
);
}
} );
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
// Serialize an array of form elements or a set of
// key/values into a query string
jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, valueOrFunction ) {
// If value is a function, invoke it and use its return value
var value = jQuery.isFunction( valueOrFunction ) ?
valueOrFunction() :
valueOrFunction;
s[ s.length ] = encodeURIComponent( key ) + "=" +
encodeURIComponent( value == null ? "" : value );
};
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
} );
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" );
};
jQuery.fn.extend( {
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map( function() {
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
} )
.filter( function() {
var type = this.type;
// Use .is( ":disabled" ) so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !rcheckableType.test( type ) );
} )
.map( function( i, elem ) {
var val = jQuery( this ).val();
if ( val == null ) {
return null;
}
if ( jQuery.isArray( val ) ) {
return jQuery.map( val, function( val ) {
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
} );
}
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
} ).get();
}
} );
var
r20 = /%20/g,
rhash = /#.*$/,
rantiCache = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat( "*" ),
// Anchor tag for parsing the document origin
originAnchor = document.createElement( "a" );
originAnchor.href = location.href;
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( ( dataType = dataTypes[ i++ ] ) ) {
// Prepend if requested
if ( dataType[ 0 ] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
// Otherwise append
} else {
( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
}
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if ( typeof dataTypeOrTransport === "string" &&
!seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
} );
return selected;
}
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
return target;
}
/* Handles responses to an ajax request:
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var ct, type, finalDataType, firstDataType,
contents = s.contents,
dataTypes = s.dataTypes;
// Remove auto dataType and get content-type in the process
while ( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
/* Chain conversions given the request and the original response
* Also sets the responseXXX fields on the jqXHR instance
*/
function ajaxConvert( s, response, jqXHR, isSuccess ) {
var conv2, current, conv, tmp, prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
current = dataTypes.shift();
// Convert to each sequential dataType
while ( current ) {
if ( s.responseFields[ current ] ) {
jqXHR[ s.responseFields[ current ] ] = response;
}
// Apply the dataFilter if provided
if ( !prev && isSuccess && s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
prev = current;
current = dataTypes.shift();
if ( current ) {
// There's only work to do if current dataType is non-auto
if ( current === "*" ) {
current = prev;
// Convert response if prev dataType is non-auto and differs from current
} else if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split( " " );
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.unshift( tmp[ 1 ] );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s.throws ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return {
state: "parsererror",
error: conv ? e : "No conversion from " + prev + " to " + current
};
}
}
}
}
}
}
return { state: "success", data: response };
}
jQuery.extend( {
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: location.href,
type: "GET",
isLocal: rlocalProtocol.test( location.protocol ),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /\bxml\b/,
html: /\bhtml/,
json: /\bjson\b/
},
responseFields: {
xml: "responseXML",
text: "responseText",
json: "responseJSON"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": JSON.parse,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
url: true,
context: true
}
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
return settings ?
// Building a settings object
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
// Extending ajaxSettings
ajaxExtend( jQuery.ajaxSettings, target );
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var transport,
// URL without anti-cache param
cacheURL,
// Response headers
responseHeadersString,
responseHeaders,
// timeout handle
timeoutTimer,
// Url cleanup var
urlAnchor,
// Request state (becomes false upon send and true upon completion)
completed,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// uncached part of the url
uncached,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context &&
( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks( "once memory" ),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( completed ) {
if ( !responseHeaders ) {
responseHeaders = {};
while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match == null ? null : match;
},
// Raw string
getAllResponseHeaders: function() {
return completed ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function( name, value ) {
if ( completed == null ) {
name = requestHeadersNames[ name.toLowerCase() ] =
requestHeadersNames[ name.toLowerCase() ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( completed == null ) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function( map ) {
var code;
if ( map ) {
if ( completed ) {
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
} else {
// Lazy-add the new callbacks in a way that preserves old ones
for ( code in map ) {
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
}
}
}
return this;
},
// Cancel the request
abort: function( statusText ) {
var finalText = statusText || strAbort;
if ( transport ) {
transport.abort( finalText );
}
done( 0, finalText );
return this;
}
};
// Attach deferreds
deferred.promise( jqXHR );
// Add protocol if not provided (prefilters might expect it)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || location.href ) + "" )
.replace( rprotocol, location.protocol + "//" );
// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
// A cross-domain request is in order when the origin doesn't match the current origin.
if ( s.crossDomain == null ) {
urlAnchor = document.createElement( "a" );
// Support: IE <=8 - 11, Edge 12 - 13
// IE throws exception on accessing the href property if url is malformed,
// e.g. http://example.com:80x/
try {
urlAnchor.href = s.url;
// Support: IE <=8 - 11 only
// Anchor's host property isn't correctly set when s.url is relative
urlAnchor.href = urlAnchor.href;
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
urlAnchor.protocol + "//" + urlAnchor.host;
} catch ( e ) {
// If there is an error parsing the URL, assume it is crossDomain,
// it can be rejected by the transport if it is invalid
s.crossDomain = true;
}
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefilter, stop there
if ( completed ) {
return jqXHR;
}
// We can fire global events as of now if asked to
// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
fireGlobals = jQuery.event && s.global;
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
// Remove hash to simplify url manipulation
cacheURL = s.url.replace( rhash, "" );
// More options handling for requests with no content
if ( !s.hasContent ) {
// Remember the hash so we can put it back
uncached = s.url.slice( cacheURL.length );
// If data is available, append data to url
if ( s.data ) {
cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add or update anti-cache param if needed
if ( s.cache === false ) {
cacheURL = cacheURL.replace( rantiCache, "$1" );
uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
}
// Put hash and anti-cache on the URL that will be requested (gh-1732)
s.url = cacheURL + uncached;
// Change '%20' to '+' if this is encoded form body content (gh-2658)
} else if ( s.data && s.processData &&
( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
s.data = s.data.replace( r20, "+" );
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( jQuery.lastModified[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
}
if ( jQuery.etag[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
s.accepts[ s.dataTypes[ 0 ] ] +
( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend &&
( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
// Abort if not done already and return
return jqXHR.abort();
}
// Aborting is no longer a cancellation
strAbort = "abort";
// Install callbacks on deferreds
completeDeferred.add( s.complete );
jqXHR.done( s.success );
jqXHR.fail( s.error );
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// If request was aborted inside ajaxSend, stop there
if ( completed ) {
return jqXHR;
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = window.setTimeout( function() {
jqXHR.abort( "timeout" );
}, s.timeout );
}
try {
completed = false;
transport.send( requestHeaders, done );
} catch ( e ) {
// Rethrow post-completion exceptions
if ( completed ) {
throw e;
}
// Propagate others as results
done( -1, e );
}
}
// Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Ignore repeat invocations
if ( completed ) {
return;
}
completed = true;
// Clear timeout if it exists
if ( timeoutTimer ) {
window.clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Determine if successful
isSuccess = status >= 200 && status < 300 || status === 304;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// Convert no matter what (that way responseXXX fields are always set)
response = ajaxConvert( s, response, jqXHR, isSuccess );
// If successful, handle type chaining
if ( isSuccess ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader( "Last-Modified" );
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
modified = jqXHR.getResponseHeader( "etag" );
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
}
// if no content
if ( status === 204 || s.type === "HEAD" ) {
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
statusText = "notmodified";
// If we have data, let's convert it
} else {
statusText = response.state;
success = response.data;
error = response.error;
isSuccess = !error;
}
} else {
// Extract error from statusText and normalize for non-aborts
error = statusText;
if ( status || !statusText ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger( "ajaxStop" );
}
}
}
return jqXHR;
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
}
} );
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// Shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
// The url can be an options object (which then must have .url)
return jQuery.ajax( jQuery.extend( {
url: url,
type: method,
dataType: type,
data: data,
success: callback
}, jQuery.isPlainObject( url ) && url ) );
};
} );
jQuery._evalUrl = function( url ) {
return jQuery.ajax( {
url: url,
// Make this explicit, since user can override this through ajaxSetup (#11264)
type: "GET",
dataType: "script",
cache: true,
async: false,
global: false,
"throws": true
} );
};
jQuery.fn.extend( {
wrapAll: function( html ) {
var wrap;
if ( this[ 0 ] ) {
if ( jQuery.isFunction( html ) ) {
html = html.call( this[ 0 ] );
}
// The elements to wrap the target around
wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
if ( this[ 0 ].parentNode ) {
wrap.insertBefore( this[ 0 ] );
}
wrap.map( function() {
var elem = this;
while ( elem.firstElementChild ) {
elem = elem.firstElementChild;
}
return elem;
} ).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each( function( i ) {
jQuery( this ).wrapInner( html.call( this, i ) );
} );
}
return this.each( function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
} );
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each( function( i ) {
jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
} );
},
unwrap: function( selector ) {
this.parent( selector ).not( "body" ).each( function() {
jQuery( this ).replaceWith( this.childNodes );
} );
return this;
}
} );
jQuery.expr.pseudos.hidden = function( elem ) {
return !jQuery.expr.pseudos.visible( elem );
};
jQuery.expr.pseudos.visible = function( elem ) {
return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
};
jQuery.ajaxSettings.xhr = function() {
try {
return new window.XMLHttpRequest();
} catch ( e ) {}
};
var xhrSuccessStatus = {
// File protocol always yields status code 0, assume 200
0: 200,
// Support: IE <=9 only
// #1450: sometimes IE returns 1223 when it should be 204
1223: 204
},
xhrSupported = jQuery.ajaxSettings.xhr();
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
support.ajax = xhrSupported = !!xhrSupported;
jQuery.ajaxTransport( function( options ) {
var callback, errorCallback;
// Cross domain only allowed if supported through XMLHttpRequest
if ( support.cors || xhrSupported && !options.crossDomain ) {
return {
send: function( headers, complete ) {
var i,
xhr = options.xhr();
xhr.open(
options.type,
options.url,
options.async,
options.username,
options.password
);
// Apply custom fields if provided
if ( options.xhrFields ) {
for ( i in options.xhrFields ) {
xhr[ i ] = options.xhrFields[ i ];
}
}
// Override mime type if needed
if ( options.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( options.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Set headers
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
// Callback
callback = function( type ) {
return function() {
if ( callback ) {
callback = errorCallback = xhr.onload =
xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
if ( type === "abort" ) {
xhr.abort();
} else if ( type === "error" ) {
// Support: IE <=9 only
// On a manual native abort, IE9 throws
// errors on any property access that is not readyState
if ( typeof xhr.status !== "number" ) {
complete( 0, "error" );
} else {
complete(
// File: protocol always yields status 0; see #8605, #14207
xhr.status,
xhr.statusText
);
}
} else {
complete(
xhrSuccessStatus[ xhr.status ] || xhr.status,
xhr.statusText,
// Support: IE <=9 only
// IE9 has no XHR2 but throws on binary (trac-11426)
// For XHR2 non-text, let the caller handle it (gh-2498)
( xhr.responseType || "text" ) !== "text" ||
typeof xhr.responseText !== "string" ?
{ binary: xhr.response } :
{ text: xhr.responseText },
xhr.getAllResponseHeaders()
);
}
}
};
};
// Listen to events
xhr.onload = callback();
errorCallback = xhr.onerror = callback( "error" );
// Support: IE 9 only
// Use onreadystatechange to replace onabort
// to handle uncaught aborts
if ( xhr.onabort !== undefined ) {
xhr.onabort = errorCallback;
} else {
xhr.onreadystatechange = function() {
// Check readyState before timeout as it changes
if ( xhr.readyState === 4 ) {
// Allow onerror to be called first,
// but that will not handle a native abort
// Also, save errorCallback to a variable
// as xhr.onerror cannot be accessed
window.setTimeout( function() {
if ( callback ) {
errorCallback();
}
} );
}
};
}
// Create the abort callback
callback = callback( "abort" );
try {
// Do send the request (this may raise an exception)
xhr.send( options.hasContent && options.data || null );
} catch ( e ) {
// #14683: Only rethrow if this hasn't been notified as an error yet
if ( callback ) {
throw e;
}
}
},
abort: function() {
if ( callback ) {
callback();
}
}
};
}
} );
// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
jQuery.ajaxPrefilter( function( s ) {
if ( s.crossDomain ) {
s.contents.script = false;
}
} );
// Install script dataType
jQuery.ajaxSetup( {
accepts: {
script: "text/javascript, application/javascript, " +
"application/ecmascript, application/x-ecmascript"
},
contents: {
script: /\b(?:java|ecma)script\b/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
} );
// Handle cache's special case and crossDomain
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
}
} );
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function( s ) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script, callback;
return {
send: function( _, complete ) {
script = jQuery( "<script>" ).prop( {
charset: s.scriptCharset,
src: s.url
} ).on(
"load error",
callback = function( evt ) {
script.remove();
callback = null;
if ( evt ) {
complete( evt.type === "error" ? 404 : 200, evt.type );
}
}
);
// Use native DOM manipulation to avoid our domManip AJAX trickery
document.head.appendChild( script[ 0 ] );
},
abort: function() {
if ( callback ) {
callback();
}
}
};
}
} );
var oldCallbacks = [],
rjsonp = /(=)\?(?=&|$)|\?\?/;
// Default jsonp settings
jQuery.ajaxSetup( {
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
this[ callback ] = true;
return callback;
}
} );
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
typeof s.data === "string" &&
( s.contentType || "" )
.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
rjsonp.test( s.data ) && "data"
);
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
s.jsonpCallback() :
s.jsonpCallback;
// Insert callback into url or form data
if ( jsonProp ) {
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
} else if ( s.jsonp !== false ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters[ "script json" ] = function() {
if ( !responseContainer ) {
jQuery.error( callbackName + " was not called" );
}
return responseContainer[ 0 ];
};
// Force json dataType
s.dataTypes[ 0 ] = "json";
// Install callback
overwritten = window[ callbackName ];
window[ callbackName ] = function() {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always( function() {
// If previous value didn't exist - remove it
if ( overwritten === undefined ) {
jQuery( window ).removeProp( callbackName );
// Otherwise restore preexisting value
} else {
window[ callbackName ] = overwritten;
}
// Save back as free
if ( s[ callbackName ] ) {
// Make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// Save the callback name for future use
oldCallbacks.push( callbackName );
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
}
responseContainer = overwritten = undefined;
} );
// Delegate to script
return "script";
}
} );
// Support: Safari 8 only
// In Safari 8 documents created via document.implementation.createHTMLDocument
// collapse sibling forms: the second one becomes a child of the first one.
// Because of that, this security measure has to be disabled in Safari 8.
// https://bugs.webkit.org/show_bug.cgi?id=137337
support.createHTMLDocument = ( function() {
var body = document.implementation.createHTMLDocument( "" ).body;
body.innerHTML = "<form></form><form></form>";
return body.childNodes.length === 2;
} )();
// Argument "data" should be string of html
// context (optional): If specified, the fragment will be created in this context,
// defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) {
if ( typeof data !== "string" ) {
return [];
}
if ( typeof context === "boolean" ) {
keepScripts = context;
context = false;
}
var base, parsed, scripts;
if ( !context ) {
// Stop scripts or inline event handlers from being executed immediately
// by using document.implementation
if ( support.createHTMLDocument ) {
context = document.implementation.createHTMLDocument( "" );
// Set the base href for the created document
// so any parsed elements with URLs
// are based on the document's URL (gh-2965)
base = context.createElement( "base" );
base.href = document.location.href;
context.head.appendChild( base );
} else {
context = document;
}
}
parsed = rsingleTag.exec( data );
scripts = !keepScripts && [];
// Single tag
if ( parsed ) {
return [ context.createElement( parsed[ 1 ] ) ];
}
parsed = buildFragment( [ data ], context, scripts );
if ( scripts && scripts.length ) {
jQuery( scripts ).remove();
}
return jQuery.merge( [], parsed.childNodes );
};
/**
* Load a url into a page
*/
jQuery.fn.load = function( url, params, callback ) {
var selector, type, response,
self = this,
off = url.indexOf( " " );
if ( off > -1 ) {
selector = stripAndCollapse( url.slice( off ) );
url = url.slice( 0, off );
}
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( params && typeof params === "object" ) {
type = "POST";
}
// If we have elements to modify, make the request
if ( self.length > 0 ) {
jQuery.ajax( {
url: url,
// If "type" variable is undefined, then "GET" method will be used.
// Make value of this field explicit since
// user can override it through ajaxSetup method
type: type || "GET",
dataType: "html",
data: params
} ).done( function( responseText ) {
// Save response for use in complete callback
response = arguments;
self.html( selector ?
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
// Otherwise use the full result
responseText );
// If the request succeeds, this function gets "data", "status", "jqXHR"
// but they are ignored because response was set above.
// If it fails, this function gets "jqXHR", "status", "error"
} ).always( callback && function( jqXHR, status ) {
self.each( function() {
callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
} );
} );
}
return this;
};
// Attach a bunch of functions for handling common AJAX events
jQuery.each( [
"ajaxStart",
"ajaxStop",
"ajaxComplete",
"ajaxError",
"ajaxSuccess",
"ajaxSend"
], function( i, type ) {
jQuery.fn[ type ] = function( fn ) {
return this.on( type, fn );
};
} );
jQuery.expr.pseudos.animated = function( elem ) {
return jQuery.grep( jQuery.timers, function( fn ) {
return elem === fn.elem;
} ).length;
};
/**
* Gets a window from an element
*/
function getWindow( elem ) {
return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
}
jQuery.offset = {
setOffset: function( elem, options, i ) {
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
position = jQuery.css( elem, "position" ),
curElem = jQuery( elem ),
props = {};
// Set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
curOffset = curElem.offset();
curCSSTop = jQuery.css( elem, "top" );
curCSSLeft = jQuery.css( elem, "left" );
calculatePosition = ( position === "absolute" || position === "fixed" ) &&
( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
// Need to be able to calculate position if either
// top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
}
if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend( {
offset: function( options ) {
// Preserve chaining for setter
if ( arguments.length ) {
return options === undefined ?
this :
this.each( function( i ) {
jQuery.offset.setOffset( this, options, i );
} );
}
var docElem, win, rect, doc,
elem = this[ 0 ];
if ( !elem ) {
return;
}
// Support: IE <=11 only
// Running getBoundingClientRect on a
// disconnected node in IE throws an error
if ( !elem.getClientRects().length ) {
return { top: 0, left: 0 };
}
rect = elem.getBoundingClientRect();
// Make sure element is not hidden (display: none)
if ( rect.width || rect.height ) {
doc = elem.ownerDocument;
win = getWindow( doc );
docElem = doc.documentElement;
return {
top: rect.top + win.pageYOffset - docElem.clientTop,
left: rect.left + win.pageXOffset - docElem.clientLeft
};
}
// Return zeros for disconnected and hidden elements (gh-2310)
return rect;
},
position: function() {
if ( !this[ 0 ] ) {
return;
}
var offsetParent, offset,
elem = this[ 0 ],
parentOffset = { top: 0, left: 0 };
// Fixed elements are offset from window (parentOffset = {top:0, left: 0},
// because it is its only offset parent
if ( jQuery.css( elem, "position" ) === "fixed" ) {
// Assume getBoundingClientRect is there when computed position is fixed
offset = elem.getBoundingClientRect();
} else {
// Get *real* offsetParent
offsetParent = this.offsetParent();
// Get correct offsets
offset = this.offset();
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
parentOffset = offsetParent.offset();
}
// Add offsetParent borders
parentOffset = {
top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
};
}
// Subtract parent offsets and element margins
return {
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
};
},
// This method will return documentElement in the following cases:
// 1) For the element inside the iframe without offsetParent, this method will return
// documentElement of the parent window
// 2) For the hidden or detached element
// 3) For body or html element, i.e. in case of the html node - it will return itself
//
// but those exceptions were never presented as a real life use-cases
// and might be considered as more preferable results.
//
// This logic, however, is not guaranteed and can change at any point in the future
offsetParent: function() {
return this.map( function() {
var offsetParent = this.offsetParent;
while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || documentElement;
} );
}
} );
// Create scrollLeft and scrollTop methods
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
var top = "pageYOffset" === prop;
jQuery.fn[ method ] = function( val ) {
return access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? win[ prop ] : elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : win.pageXOffset,
top ? val : win.pageYOffset
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length );
};
} );
// Support: Safari <=7 - 9.1, Chrome <=37 - 49
// Add the top/left cssHooks using jQuery.fn.position
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
// getComputedStyle returns percent when specified for top/left/bottom/right;
// rather than make the css module depend on the offset module, just check for it here
jQuery.each( [ "top", "left" ], function( i, prop ) {
jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
function( elem, computed ) {
if ( computed ) {
computed = curCSS( elem, prop );
// If curCSS returns percentage, fallback to offset
return rnumnonpx.test( computed ) ?
jQuery( elem ).position()[ prop ] + "px" :
computed;
}
}
);
} );
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
function( defaultExtra, funcName ) {
// Margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
return funcName.indexOf( "outer" ) === 0 ?
elem[ "inner" + name ] :
elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
// whichever is greatest
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable );
};
} );
} );
jQuery.fn.extend( {
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ?
this.off( selector, "**" ) :
this.off( types, selector || "**", fn );
}
} );
jQuery.parseJSON = JSON.parse;
// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via a proper concatenation script that
// understands anonymous AMD modules. A named AMD is safest and most robust
// way to register. Lowercase jquery is used because AMD module names are
// derived from file names, and jQuery is normally delivered in a lowercase
// file name. Do this after creating the global so that if an AMD module wants
// to call noConflict to hide this version of jQuery, it will work.
// Note that for maximum portability, libraries that are not jQuery should
// declare themselves as anonymous modules, and avoid setting a global if an
// AMD loader is present. jQuery is a special case. For more information, see
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
if ( true ) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
return jQuery;
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
var
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$;
jQuery.noConflict = function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
};
// Expose jQuery and $ identifiers, even in AMD
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566)
if ( !noGlobal ) {
window.jQuery = window.$ = jQuery;
}
return jQuery;
} );
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(__webpack_require__(6));
__export(__webpack_require__(7));
__export(__webpack_require__(11));
__export(__webpack_require__(25));
__export(__webpack_require__(26));
__export(__webpack_require__(27));
__export(__webpack_require__(28));
__export(__webpack_require__(29));
__export(__webpack_require__(30));
__export(__webpack_require__(36));
__export(__webpack_require__(37));
__export(__webpack_require__(38));
__export(__webpack_require__(39));
__export(__webpack_require__(40));
__export(__webpack_require__(48));
__export(__webpack_require__(49));
__export(__webpack_require__(50));
__export(__webpack_require__(51));
__export(__webpack_require__(10));
exports.version = __webpack_require__(24).version;
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
Object.defineProperty(exports, "__esModule", { value: true });
var _ = __webpack_require__(2);
var utils = __webpack_require__(7);
var semver = __webpack_require__(8);
var widget_string_1 = __webpack_require__(10);
/**
* Manager abstract base class
*/
var ManagerBase = (function () {
function ManagerBase() {
/**
* Dictionary of model ids and model instance promises
*/
this._models = Object.create(null);
}
Object.defineProperty(ManagerBase.prototype, "comm_target_name", {
/**
* The comm target name to register.
*/
get: function () {
return 'jupyter.widget';
},
enumerable: true,
configurable: true
});
Object.defineProperty(ManagerBase.prototype, "version_comm_target_name", {
/**
* The version comm target name to register.
*/
get: function () {
return 'jupyter.widget.version';
},
enumerable: true,
configurable: true
});
/**
* Display a view for a particular model.
*/
ManagerBase.prototype.display_model = function (msg, model, options) {
options = options || {};
return this.create_view(model, options).then(_.bind(function (view) {
return this.display_view(msg, view, options);
}, this)).catch(utils.reject('Could not create view', true));
};
;
/**
* Modifies view options. Generally overloaded in custom widget manager
* implementations.
*/
ManagerBase.prototype.setViewOptions = function (options) {
return options || {};
};
;
/**
* Takes a requirejs success handler and returns a requirejs error handler.
* The default implementation just throws the original error.
*/
ManagerBase.prototype.require_error = function (success_callback, failure_callback, version) {
return failure_callback;
};
;
/**
* Creates a promise for a view of a given model
*
* Make sure the view creation is not out of order with
* any state updates.
*/
ManagerBase.prototype.create_view = function (model, options) {
var _this = this;
model.state_change = model.state_change.then(function () {
return _this.loadClass(model.get('_view_name'), model.get('_view_module'), model.get('_view_module_version'), _this.require_error).then(function (ViewType) {
var view = new ViewType({
model: model,
options: _this.setViewOptions(options)
});
view.listenTo(model, 'destroy', view.remove);
return Promise.resolve(view.render()).then(function () { return view; });
}).catch(utils.reject('Could not create a view for model id ' + model.id, true));
});
var id = utils.uuid();
model.views[id] = model.state_change;
model.state_change.then(function (view) {
view.once('remove', function () { delete view.model.views[id]; }, _this);
});
return model.state_change;
};
;
/**
* callback handlers specific to a view
*/
ManagerBase.prototype.callbacks = function (view) {
return {};
};
;
/**
* Get a promise for a model by model id.
*/
ManagerBase.prototype.get_model = function (model_id) {
// Perhaps we should return a Promise.reject if the model is not found.
return this._models[model_id];
};
;
/**
* Handle when a comm is opened.
*/
ManagerBase.prototype.handle_comm_open = function (comm, msg) {
return this.new_model({
model_name: msg.content.data['_model_name'],
model_module: msg.content.data['_model_module'],
model_module_version: msg.content.data['_model_module_version'],
comm: comm
}, msg.content.data).catch(utils.reject('Could not create a model.', true));
};
;
/**
* Create a comm and new widget model.
* @param options - same options as new_model but, comm is not
* required and additional options are available.
* @param serialized_state - serialized model attributes.
*/
ManagerBase.prototype.new_widget = function (options, serialized_state) {
var _this = this;
var commPromise;
// If no comm is provided, a new comm is opened for the jupyter.widget
// target.
if (options.comm) {
commPromise = Promise.resolve(options.comm);
}
else {
commPromise = this._create_comm(this.comm_target_name, options.model_id, {
widget_class: options.widget_class,
target_name: 'jupyter.widget'
});
}
// The options dictionary is copied since data will be added to it.
var options_clone = _.clone(options);
// Create the model. In the case where the comm promise is rejected a
// comm-less model is still created with the required model id.
return commPromise.then(function (comm) {
// Comm Promise Resolved.
options_clone.comm = comm;
var widget_model = _this.new_model(options_clone, serialized_state);
return widget_model.then(function (model) {
model.sync('create', model);
return model;
});
}, function () {
// Comm Promise Rejected.
if (!options_clone.model_id) {
options_clone.model_id = utils.uuid();
}
return _this.new_model(options_clone, serialized_state);
});
};
;
/**
* Validate the version of the Javascript against the version requested by
* the backend.
* @return Whether or not the versions are okay
*/
ManagerBase.prototype.validateVersion = function () {
return this._create_comm(this.version_comm_target_name, undefined, {}).then((function (comm) {
return new Promise((function (resolve, reject) {
comm.on_msg((function (msg) {
var version = __webpack_require__(24).version;
var requirement = msg.content.data.version;
var validated = semver.satisfies(version, requirement);
comm.send({ 'validated': validated, 'frontend_version': version });
if (validated) {
console.info('Widget backend and frontend versions are compatible');
}
else {
console.warn("Widget backend and frontend versions are not compatible. The backend wants a version in the range " + requirement + ", but the frontend is version " + version + ".");
}
resolve(validated);
}).bind(this));
setTimeout(function () {
reject(new Error('Timeout while trying to cross validate the widget frontend and backend versions.'));
}, 3000);
}).bind(this));
}).bind(this));
};
;
/**
* Create and return a promise for a new widget model
*
* Minimally, one must provide the model_name and widget_class
* parameters to create a model from Javascript.
*
* @param options - the options for creating the model.
* @param serialized_state - attribute values for the model.
*
* @example
* widget_manager.new_model({
* model_name: 'WidgetModel',
* widget_class: 'Jupyter.IntSlider'
* })
* .then((model) => { console.log('Create success!', model); },
* (err) => {console.error(err)});
*
*/
ManagerBase.prototype.new_model = function (options, serialized_state) {
if (serialized_state === void 0) { serialized_state = {}; }
var that = this;
var model_id;
if (options.model_id) {
model_id = options.model_id;
}
else if (options.comm) {
model_id = options.comm.comm_id;
}
else {
throw new Error('Neither comm nor model_id provided in options object. At least one must exist.');
}
var error_handler = function (error) {
var modelOptions = {
widget_manager: that,
model_id: model_id,
comm: options.comm,
};
var widget_model = new widget_string_1.HTMLModel({}, modelOptions);
widget_model.once('comm:close', function () {
delete that._models[model_id];
});
var placeholder = "<table style=\"width:100%\">\n <thead>\n <tr>\n <th colspan=\"2\">\n Could not create model:\n </th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>Model name</td>\n <td> " + options.model_name + " </td>\n </tr>\n <tr>\n <td>Model module</td>\n <td> " + options.model_module + " </td>\n </tr>\n <tr>\n <td>Model module version</td>\n <td> " + options.model_module_version + " </td>\n </tr>\n <tbody>\n <tfoot>\n <tr>\n <th colspan=\"2\">\n " + error.message + "\n </th>\n </tr>\n </tfoot>\n </table>";
widget_model.set('value', placeholder);
return widget_model;
};
var model_promise = this.loadClass(options.model_name, options.model_module, options.model_module_version, that.require_error)
.then(function (ModelType) {
try {
return ModelType._deserialize_state(serialized_state || {}, that)
.then(function (attributes) {
var modelOptions = {
widget_manager: that,
model_id: model_id,
comm: options.comm,
};
var widget_model = new ModelType(attributes, modelOptions);
widget_model.once('comm:close', function () {
delete that._models[model_id];
});
widget_model.name = options.model_name;
widget_model.module = options.model_module;
return widget_model;
});
}
catch (error) {
error_handler(error); // error handler call if ModelType is undefined.
}
}, error_handler); // error handler call if module cannot be loaded.
this._models[model_id] = model_promise;
return model_promise;
};
;
/**
* Close all widgets and empty the widget state.
* @param commlessOnly should only commless widgets be removed
* @return promise that resolves when the widget state is cleared.
*/
ManagerBase.prototype.clear_state = function (commlessOnly) {
var _this = this;
return utils.resolvePromisesDict(this._models).then(function (models) {
Object.keys(models).forEach(function (id) {
if (!commlessOnly || models[id].comm) {
models[id].close();
}
});
_this._models = {};
});
};
;
/**
* Asynchronously get the state of the widget manager.
*
* This includes all of the widget models.
*
* @param options - The options for what state to return.
* @returns Promise for a state dictionary
*/
ManagerBase.prototype.get_state = function (options) {
var that = this;
return utils.resolvePromisesDict(this._models).then(function (models) {
var state = {};
for (var model_id in models) {
if (models.hasOwnProperty(model_id)) {
var model = models[model_id];
state[model_id] = utils.resolvePromisesDict({
model_name: model.name,
model_module: model.module,
model_module_version: model.get('_model_module_version'),
state: model.constructor._serialize_state(model.get_state(options.drop_defaults), that)
});
}
}
return utils.resolvePromisesDict(state);
}).catch(utils.reject('Could not get state of widget manager', true));
};
;
/**
* Set the widget manager state.
*
* Reconstructs all of the widget models in the state, merges that with the
* current manager state, and then attempts to redisplay the widgets in the
* state.
*/
ManagerBase.prototype.set_state = function (state, displayOptions) {
var that = this;
// Recreate all the widget models for the given widget manager state.
var all_models = that._get_comm_info().then(function (live_comms) {
return Promise.all(_.map(Object.keys(state), function (model_id) {
// If the model has already been created, set it's state and then
// return it.
if (that._models[model_id]) {
return that._models[model_id].then(function (model) {
return model.constructor._deserialize_state(state[model_id].state || {}, that).then(function (attributes) {
model.set_state(attributes);
return model;
});
});
}
if (live_comms.hasOwnProperty(model_id)) {
return that._create_comm(that.comm_target_name, model_id).then(function (new_comm) {
return that.new_model({
comm: new_comm,
model_name: state[model_id].model_name,
model_module: state[model_id].model_module,
model_module_version: state[model_id].model_module_version
});
});
}
else {
return that.new_model({
model_id: model_id,
model_name: state[model_id].model_name,
model_module: state[model_id].model_module,
model_module_version: state[model_id].model_module_version
}, state[model_id].state);
}
}));
});
return all_models;
};
;
/**
* Load a class and return a promise to the loaded object.
*/
ManagerBase.prototype.loadClass = function (className, moduleName, moduleVersion, error) {
return utils.loadClass(className, moduleName, moduleVersion, null, error);
};
return ManagerBase;
}());
exports.ManagerBase = ManagerBase;
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
// TODO: ATTEMPT TO KILL THIS MODULE USING THIRD PARTY LIBRARIES WHEN IPYWIDGETS
// IS CONVERTED TO NODE COMMONJS.
/**
* http://www.ietf.org/rfc/rfc4122.txt
*/
function uuid() {
var s = [];
var hexDigits = '0123456789ABCDEF';
for (var i = 0; i < 32; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[12] = '4'; // bits 12-15 of the time_hi_and_version field to 0010
s[16] = hexDigits.substr((s[16] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
return s.join('');
}
exports.uuid = uuid;
/**
* Wrappable Error class
*
* The Error class doesn't actually act on `this`. Instead it always
* returns a new instance of Error. Here we capture that instance so we
* can apply it's properties to `this`.
*/
var WrappedError = (function (_super) {
__extends(WrappedError, _super);
function WrappedError(message, error) {
var _this = _super.call(this, message) || this;
// Keep a stack of the original error messages.
if (error instanceof WrappedError) {
_this.error_stack = error.error_stack;
}
else {
_this.error_stack = [error];
}
_this.error_stack.push(_this);
return _this;
}
return WrappedError;
}(Error));
exports.WrappedError = WrappedError;
/**
* Tries to load a class
*
* Tries to load a class from a module using require.js, if a module
* is specified, otherwise tries to load a class from the global
* registry, if the global registry is provided.
*
* The optional require_error argument is a function that takes the success
* handler and returns a requirejs error handler, which may call the success
* handler with a fallback module.
*
*/
function loadClass(class_name, module_name, module_version, registry, require_error) {
return new Promise(function (resolve, reject) {
// Try loading the view module using require.js
if (module_name) {
// If the module is jupyter-js-widgets, we can just self import.
var modulePromise;
var requirejsDefined = typeof window !== 'undefined' && window.requirejs;
if (requirejsDefined) {
if (module_name !== 'jupyter-js-widgets' || window.requirejs.defined('jupyter-js-widgets')) {
modulePromise = new Promise(function (innerResolve, innerReject) {
var success_callback = function (module) {
innerResolve(module);
};
var failure_callback = require_error ? require_error(success_callback, reject, module_version) : reject;
window.require([module_name], success_callback, failure_callback);
});
}
else if (module_name === 'jupyter-js-widgets') {
modulePromise = Promise.resolve(__webpack_require__(5));
}
}
else if (module_name === 'jupyter-js-widgets') {
modulePromise = Promise.resolve(__webpack_require__(5));
}
else {
// FUTURE: Investigate dynamic loading methods other than require.js.
throw new Error(['In order to use third party widgets, you ',
'must have require.js loaded on the page.'].join(''));
}
modulePromise.then(function (module) {
if (module[class_name] === undefined) {
reject(new Error('Class ' + class_name + ' not found in module ' + module_name));
}
else {
resolve(module[class_name]);
}
});
}
else {
if (registry && registry[class_name]) {
resolve(registry[class_name]);
}
else {
reject(new Error('Class ' + class_name + ' not found in registry '));
}
}
});
}
exports.loadClass = loadClass;
/**
* Resolve a promiseful dictionary.
* Returns a single Promise.
*/
function resolvePromisesDict(d) {
var keys = Object.keys(d);
var values = [];
keys.forEach(function (key) {
values.push(d[key]);
});
return Promise.all(values).then(function (v) {
d = {};
for (var i = 0; i < keys.length; i++) {
d[keys[i]] = v[i];
}
return d;
});
}
exports.resolvePromisesDict = resolvePromisesDict;
/**
* Creates a wrappable Promise rejection function.
*
* Creates a function that returns a Promise.reject with a new WrappedError
* that has the provided message and wraps the original error that
* caused the promise to reject.
*/
function reject(message, log) {
return function promiseRejection(error) {
var wrapped_error = new WrappedError(message, error);
if (log)
console.error(wrapped_error);
return Promise.reject(wrapped_error);
};
}
exports.reject = reject;
/**
* Apply MathJax rendering to an element, and optionally set its text.
*
* If MathJax is not available, make no changes.
*
* Parameters
* ----------
* element: Node
* text: optional string
*/
function typeset(element, text) {
if (text !== void 0) {
element.textContent = text;
}
if (window.MathJax !== void 0) {
MathJax.Hub.Queue(['Typeset', MathJax.Hub, element]);
}
}
exports.typeset = typeset;
/**
* escape text to HTML
*/
function escape_html(text) {
var esc = document.createElement('div');
esc.textContent = text;
return esc.innerHTML;
}
exports.escape_html = escape_html;
;
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {exports = module.exports = SemVer;
// The debug function is excluded entirely from the minified version.
/* nomin */ var debug;
/* nomin */ if (typeof process === 'object' &&
/* nomin */ process.env &&
/* nomin */ process.env.NODE_DEBUG &&
/* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG))
/* nomin */ debug = function() {
/* nomin */ var args = Array.prototype.slice.call(arguments, 0);
/* nomin */ args.unshift('SEMVER');
/* nomin */ console.log.apply(console, args);
/* nomin */ };
/* nomin */ else
/* nomin */ debug = function() {};
// Note: this is the semver.org version of the spec that it implements
// Not necessarily the package version of this code.
exports.SEMVER_SPEC_VERSION = '2.0.0';
var MAX_LENGTH = 256;
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
// The actual regexps go on exports.re
var re = exports.re = [];
var src = exports.src = [];
var R = 0;
// The following Regular Expressions can be used for tokenizing,
// validating, and parsing SemVer version strings.
// ## Numeric Identifier
// A single `0`, or a non-zero digit followed by zero or more digits.
var NUMERICIDENTIFIER = R++;
src[NUMERICIDENTIFIER] = '0|[1-9]\\d*';
var NUMERICIDENTIFIERLOOSE = R++;
src[NUMERICIDENTIFIERLOOSE] = '[0-9]+';
// ## Non-numeric Identifier
// Zero or more digits, followed by a letter or hyphen, and then zero or
// more letters, digits, or hyphens.
var NONNUMERICIDENTIFIER = R++;
src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
// ## Main Version
// Three dot-separated numeric identifiers.
var MAINVERSION = R++;
src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' +
'(' + src[NUMERICIDENTIFIER] + ')\\.' +
'(' + src[NUMERICIDENTIFIER] + ')';
var MAINVERSIONLOOSE = R++;
src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
'(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
'(' + src[NUMERICIDENTIFIERLOOSE] + ')';
// ## Pre-release Version Identifier
// A numeric identifier, or a non-numeric identifier.
var PRERELEASEIDENTIFIER = R++;
src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +
'|' + src[NONNUMERICIDENTIFIER] + ')';
var PRERELEASEIDENTIFIERLOOSE = R++;
src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +
'|' + src[NONNUMERICIDENTIFIER] + ')';
// ## Pre-release Version
// Hyphen, followed by one or more dot-separated pre-release version
// identifiers.
var PRERELEASE = R++;
src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +
'(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))';
var PRERELEASELOOSE = R++;
src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
'(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))';
// ## Build Metadata Identifier
// Any combination of digits, letters, or hyphens.
var BUILDIDENTIFIER = R++;
src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
// ## Build Metadata
// Plus sign, followed by one or more period-separated build metadata
// identifiers.
var BUILD = R++;
src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
'(?:\\.' + src[BUILDIDENTIFIER] + ')*))';
// ## Full Version String
// A main version, followed optionally by a pre-release version and
// build metadata.
// Note that the only major, minor, patch, and pre-release sections of
// the version string are capturing groups. The build metadata is not a
// capturing group, because it should not ever be used in version
// comparison.
var FULL = R++;
var FULLPLAIN = 'v?' + src[MAINVERSION] +
src[PRERELEASE] + '?' +
src[BUILD] + '?';
src[FULL] = '^' + FULLPLAIN + '$';
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
// common in the npm registry.
var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] +
src[PRERELEASELOOSE] + '?' +
src[BUILD] + '?';
var LOOSE = R++;
src[LOOSE] = '^' + LOOSEPLAIN + '$';
var GTLT = R++;
src[GTLT] = '((?:<|>)?=?)';
// Something like "2.*" or "1.2.x".
// Note that "x.x" is a valid xRange identifer, meaning "any version"
// Only the first item is strictly required.
var XRANGEIDENTIFIERLOOSE = R++;
src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
var XRANGEIDENTIFIER = R++;
src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*';
var XRANGEPLAIN = R++;
src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
'(?:' + src[PRERELEASE] + ')?' +
src[BUILD] + '?' +
')?)?';
var XRANGEPLAINLOOSE = R++;
src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
'(?:' + src[PRERELEASELOOSE] + ')?' +
src[BUILD] + '?' +
')?)?';
var XRANGE = R++;
src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
var XRANGELOOSE = R++;
src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$';
// Tilde ranges.
// Meaning is "reasonably at or greater than"
var LONETILDE = R++;
src[LONETILDE] = '(?:~>?)';
var TILDETRIM = R++;
src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+';
re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g');
var tildeTrimReplace = '$1~';
var TILDE = R++;
src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$';
var TILDELOOSE = R++;
src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$';
// Caret ranges.
// Meaning is "at least and backwards compatible with"
var LONECARET = R++;
src[LONECARET] = '(?:\\^)';
var CARETTRIM = R++;
src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+';
re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g');
var caretTrimReplace = '$1^';
var CARET = R++;
src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$';
var CARETLOOSE = R++;
src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$';
// A simple gt/lt/eq thing, or just "" to indicate "any version"
var COMPARATORLOOSE = R++;
src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$';
var COMPARATOR = R++;
src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$';
// An expression to strip any whitespace between the gtlt and the thing
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
var COMPARATORTRIM = R++;
src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
'\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')';
// this one has to use the /g flag
re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g');
var comparatorTrimReplace = '$1$2$3';
// Something like `1.2.3 - 1.2.4`
// Note that these all use the loose form, because they'll be
// checked against either the strict or loose comparator form
// later.
var HYPHENRANGE = R++;
src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' +
'\\s+-\\s+' +
'(' + src[XRANGEPLAIN] + ')' +
'\\s*$';
var HYPHENRANGELOOSE = R++;
src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' +
'\\s+-\\s+' +
'(' + src[XRANGEPLAINLOOSE] + ')' +
'\\s*$';
// Star ranges basically just allow anything at all.
var STAR = R++;
src[STAR] = '(<|>)?=?\\s*\\*';
// Compile to actual regexp objects.
// All are flag-free, unless they were created above with a flag.
for (var i = 0; i < R; i++) {
debug(i, src[i]);
if (!re[i])
re[i] = new RegExp(src[i]);
}
exports.parse = parse;
function parse(version, loose) {
if (version instanceof SemVer)
return version;
if (typeof version !== 'string')
return null;
if (version.length > MAX_LENGTH)
return null;
var r = loose ? re[LOOSE] : re[FULL];
if (!r.test(version))
return null;
try {
return new SemVer(version, loose);
} catch (er) {
return null;
}
}
exports.valid = valid;
function valid(version, loose) {
var v = parse(version, loose);
return v ? v.version : null;
}
exports.clean = clean;
function clean(version, loose) {
var s = parse(version.trim().replace(/^[=v]+/, ''), loose);
return s ? s.version : null;
}
exports.SemVer = SemVer;
function SemVer(version, loose) {
if (version instanceof SemVer) {
if (version.loose === loose)
return version;
else
version = version.version;
} else if (typeof version !== 'string') {
throw new TypeError('Invalid Version: ' + version);
}
if (version.length > MAX_LENGTH)
throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
if (!(this instanceof SemVer))
return new SemVer(version, loose);
debug('SemVer', version, loose);
this.loose = loose;
var m = version.trim().match(loose ? re[LOOSE] : re[FULL]);
if (!m)
throw new TypeError('Invalid Version: ' + version);
this.raw = version;
// these are actually numbers
this.major = +m[1];
this.minor = +m[2];
this.patch = +m[3];
if (this.major > MAX_SAFE_INTEGER || this.major < 0)
throw new TypeError('Invalid major version')
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0)
throw new TypeError('Invalid minor version')
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0)
throw new TypeError('Invalid patch version')
// numberify any prerelease numeric ids
if (!m[4])
this.prerelease = [];
else
this.prerelease = m[4].split('.').map(function(id) {
if (/^[0-9]+$/.test(id)) {
var num = +id;
if (num >= 0 && num < MAX_SAFE_INTEGER)
return num;
}
return id;
});
this.build = m[5] ? m[5].split('.') : [];
this.format();
}
SemVer.prototype.format = function() {
this.version = this.major + '.' + this.minor + '.' + this.patch;
if (this.prerelease.length)
this.version += '-' + this.prerelease.join('.');
return this.version;
};
SemVer.prototype.toString = function() {
return this.version;
};
SemVer.prototype.compare = function(other) {
debug('SemVer.compare', this.version, this.loose, other);
if (!(other instanceof SemVer))
other = new SemVer(other, this.loose);
return this.compareMain(other) || this.comparePre(other);
};
SemVer.prototype.compareMain = function(other) {
if (!(other instanceof SemVer))
other = new SemVer(other, this.loose);
return compareIdentifiers(this.major, other.major) ||
compareIdentifiers(this.minor, other.minor) ||
compareIdentifiers(this.patch, other.patch);
};
SemVer.prototype.comparePre = function(other) {
if (!(other instanceof SemVer))
other = new SemVer(other, this.loose);
// NOT having a prerelease is > having one
if (this.prerelease.length && !other.prerelease.length)
return -1;
else if (!this.prerelease.length && other.prerelease.length)
return 1;
else if (!this.prerelease.length && !other.prerelease.length)
return 0;
var i = 0;
do {
var a = this.prerelease[i];
var b = other.prerelease[i];
debug('prerelease compare', i, a, b);
if (a === undefined && b === undefined)
return 0;
else if (b === undefined)
return 1;
else if (a === undefined)
return -1;
else if (a === b)
continue;
else
return compareIdentifiers(a, b);
} while (++i);
};
// preminor will bump the version up to the next minor release, and immediately
// down to pre-release. premajor and prepatch work the same way.
SemVer.prototype.inc = function(release, identifier) {
switch (release) {
case 'premajor':
this.prerelease.length = 0;
this.patch = 0;
this.minor = 0;
this.major++;
this.inc('pre', identifier);
break;
case 'preminor':
this.prerelease.length = 0;
this.patch = 0;
this.minor++;
this.inc('pre', identifier);
break;
case 'prepatch':
// If this is already a prerelease, it will bump to the next version
// drop any prereleases that might already exist, since they are not
// relevant at this point.
this.prerelease.length = 0;
this.inc('patch', identifier);
this.inc('pre', identifier);
break;
// If the input is a non-prerelease version, this acts the same as
// prepatch.
case 'prerelease':
if (this.prerelease.length === 0)
this.inc('patch', identifier);
this.inc('pre', identifier);
break;
case 'major':
// If this is a pre-major version, bump up to the same major version.
// Otherwise increment major.
// 1.0.0-5 bumps to 1.0.0
// 1.1.0 bumps to 2.0.0
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0)
this.major++;
this.minor = 0;
this.patch = 0;
this.prerelease = [];
break;
case 'minor':
// If this is a pre-minor version, bump up to the same minor version.
// Otherwise increment minor.
// 1.2.0-5 bumps to 1.2.0
// 1.2.1 bumps to 1.3.0
if (this.patch !== 0 || this.prerelease.length === 0)
this.minor++;
this.patch = 0;
this.prerelease = [];
break;
case 'patch':
// If this is not a pre-release version, it will increment the patch.
// If it is a pre-release it will bump up to the same patch version.
// 1.2.0-5 patches to 1.2.0
// 1.2.0 patches to 1.2.1
if (this.prerelease.length === 0)
this.patch++;
this.prerelease = [];
break;
// This probably shouldn't be used publicly.
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
case 'pre':
if (this.prerelease.length === 0)
this.prerelease = [0];
else {
var i = this.prerelease.length;
while (--i >= 0) {
if (typeof this.prerelease[i] === 'number') {
this.prerelease[i]++;
i = -2;
}
}
if (i === -1) // didn't increment anything
this.prerelease.push(0);
}
if (identifier) {
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
if (this.prerelease[0] === identifier) {
if (isNaN(this.prerelease[1]))
this.prerelease = [identifier, 0];
} else
this.prerelease = [identifier, 0];
}
break;
default:
throw new Error('invalid increment argument: ' + release);
}
this.format();
this.raw = this.version;
return this;
};
exports.inc = inc;
function inc(version, release, loose, identifier) {
if (typeof(loose) === 'string') {
identifier = loose;
loose = undefined;
}
try {
return new SemVer(version, loose).inc(release, identifier).version;
} catch (er) {
return null;
}
}
exports.diff = diff;
function diff(version1, version2) {
if (eq(version1, version2)) {
return null;
} else {
var v1 = parse(version1);
var v2 = parse(version2);
if (v1.prerelease.length || v2.prerelease.length) {
for (var key in v1) {
if (key === 'major' || key === 'minor' || key === 'patch') {
if (v1[key] !== v2[key]) {
return 'pre'+key;
}
}
}
return 'prerelease';
}
for (var key in v1) {
if (key === 'major' || key === 'minor' || key === 'patch') {
if (v1[key] !== v2[key]) {
return key;
}
}
}
}
}
exports.compareIdentifiers = compareIdentifiers;
var numeric = /^[0-9]+$/;
function compareIdentifiers(a, b) {
var anum = numeric.test(a);
var bnum = numeric.test(b);
if (anum && bnum) {
a = +a;
b = +b;
}
return (anum && !bnum) ? -1 :
(bnum && !anum) ? 1 :
a < b ? -1 :
a > b ? 1 :
0;
}
exports.rcompareIdentifiers = rcompareIdentifiers;
function rcompareIdentifiers(a, b) {
return compareIdentifiers(b, a);
}
exports.major = major;
function major(a, loose) {
return new SemVer(a, loose).major;
}
exports.minor = minor;
function minor(a, loose) {
return new SemVer(a, loose).minor;
}
exports.patch = patch;
function patch(a, loose) {
return new SemVer(a, loose).patch;
}
exports.compare = compare;
function compare(a, b, loose) {
return new SemVer(a, loose).compare(b);
}
exports.compareLoose = compareLoose;
function compareLoose(a, b) {
return compare(a, b, true);
}
exports.rcompare = rcompare;
function rcompare(a, b, loose) {
return compare(b, a, loose);
}
exports.sort = sort;
function sort(list, loose) {
return list.sort(function(a, b) {
return exports.compare(a, b, loose);
});
}
exports.rsort = rsort;
function rsort(list, loose) {
return list.sort(function(a, b) {
return exports.rcompare(a, b, loose);
});
}
exports.gt = gt;
function gt(a, b, loose) {
return compare(a, b, loose) > 0;
}
exports.lt = lt;
function lt(a, b, loose) {
return compare(a, b, loose) < 0;
}
exports.eq = eq;
function eq(a, b, loose) {
return compare(a, b, loose) === 0;
}
exports.neq = neq;
function neq(a, b, loose) {
return compare(a, b, loose) !== 0;
}
exports.gte = gte;
function gte(a, b, loose) {
return compare(a, b, loose) >= 0;
}
exports.lte = lte;
function lte(a, b, loose) {
return compare(a, b, loose) <= 0;
}
exports.cmp = cmp;
function cmp(a, op, b, loose) {
var ret;
switch (op) {
case '===':
if (typeof a === 'object') a = a.version;
if (typeof b === 'object') b = b.version;
ret = a === b;
break;
case '!==':
if (typeof a === 'object') a = a.version;
if (typeof b === 'object') b = b.version;
ret = a !== b;
break;
case '': case '=': case '==': ret = eq(a, b, loose); break;
case '!=': ret = neq(a, b, loose); break;
case '>': ret = gt(a, b, loose); break;
case '>=': ret = gte(a, b, loose); break;
case '<': ret = lt(a, b, loose); break;
case '<=': ret = lte(a, b, loose); break;
default: throw new TypeError('Invalid operator: ' + op);
}
return ret;
}
exports.Comparator = Comparator;
function Comparator(comp, loose) {
if (comp instanceof Comparator) {
if (comp.loose === loose)
return comp;
else
comp = comp.value;
}
if (!(this instanceof Comparator))
return new Comparator(comp, loose);
debug('comparator', comp, loose);
this.loose = loose;
this.parse(comp);
if (this.semver === ANY)
this.value = '';
else
this.value = this.operator + this.semver.version;
debug('comp', this);
}
var ANY = {};
Comparator.prototype.parse = function(comp) {
var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
var m = comp.match(r);
if (!m)
throw new TypeError('Invalid comparator: ' + comp);
this.operator = m[1];
if (this.operator === '=')
this.operator = '';
// if it literally is just '>' or '' then allow anything.
if (!m[2])
this.semver = ANY;
else
this.semver = new SemVer(m[2], this.loose);
};
Comparator.prototype.toString = function() {
return this.value;
};
Comparator.prototype.test = function(version) {
debug('Comparator.test', version, this.loose);
if (this.semver === ANY)
return true;
if (typeof version === 'string')
version = new SemVer(version, this.loose);
return cmp(version, this.operator, this.semver, this.loose);
};
exports.Range = Range;
function Range(range, loose) {
if ((range instanceof Range) && range.loose === loose)
return range;
if (!(this instanceof Range))
return new Range(range, loose);
this.loose = loose;
// First, split based on boolean or ||
this.raw = range;
this.set = range.split(/\s*\|\|\s*/).map(function(range) {
return this.parseRange(range.trim());
}, this).filter(function(c) {
// throw out any that are not relevant for whatever reason
return c.length;
});
if (!this.set.length) {
throw new TypeError('Invalid SemVer Range: ' + range);
}
this.format();
}
Range.prototype.format = function() {
this.range = this.set.map(function(comps) {
return comps.join(' ').trim();
}).join('||').trim();
return this.range;
};
Range.prototype.toString = function() {
return this.range;
};
Range.prototype.parseRange = function(range) {
var loose = this.loose;
range = range.trim();
debug('range', range, loose);
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
range = range.replace(hr, hyphenReplace);
debug('hyphen replace', range);
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace);
debug('comparator trim', range, re[COMPARATORTRIM]);
// `~ 1.2.3` => `~1.2.3`
range = range.replace(re[TILDETRIM], tildeTrimReplace);
// `^ 1.2.3` => `^1.2.3`
range = range.replace(re[CARETTRIM], caretTrimReplace);
// normalize spaces
range = range.split(/\s+/).join(' ');
// At this point, the range is completely trimmed and
// ready to be split into comparators.
var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
var set = range.split(' ').map(function(comp) {
return parseComparator(comp, loose);
}).join(' ').split(/\s+/);
if (this.loose) {
// in loose mode, throw out any that are not valid comparators
set = set.filter(function(comp) {
return !!comp.match(compRe);
});
}
set = set.map(function(comp) {
return new Comparator(comp, loose);
});
return set;
};
// Mostly just for testing and legacy API reasons
exports.toComparators = toComparators;
function toComparators(range, loose) {
return new Range(range, loose).set.map(function(comp) {
return comp.map(function(c) {
return c.value;
}).join(' ').trim().split(' ');
});
}
// comprised of xranges, tildes, stars, and gtlt's at this point.
// already replaced the hyphen ranges
// turn into a set of JUST comparators.
function parseComparator(comp, loose) {
debug('comp', comp);
comp = replaceCarets(comp, loose);
debug('caret', comp);
comp = replaceTildes(comp, loose);
debug('tildes', comp);
comp = replaceXRanges(comp, loose);
debug('xrange', comp);
comp = replaceStars(comp, loose);
debug('stars', comp);
return comp;
}
function isX(id) {
return !id || id.toLowerCase() === 'x' || id === '*';
}
// ~, ~> --> * (any, kinda silly)
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
function replaceTildes(comp, loose) {
return comp.trim().split(/\s+/).map(function(comp) {
return replaceTilde(comp, loose);
}).join(' ');
}
function replaceTilde(comp, loose) {
var r = loose ? re[TILDELOOSE] : re[TILDE];
return comp.replace(r, function(_, M, m, p, pr) {
debug('tilde', comp, _, M, m, p, pr);
var ret;
if (isX(M))
ret = '';
else if (isX(m))
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
else if (isX(p))
// ~1.2 == >=1.2.0 <1.3.0
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
else if (pr) {
debug('replaceTilde pr', pr);
if (pr.charAt(0) !== '-')
pr = '-' + pr;
ret = '>=' + M + '.' + m + '.' + p + pr +
' <' + M + '.' + (+m + 1) + '.0';
} else
// ~1.2.3 == >=1.2.3 <1.3.0
ret = '>=' + M + '.' + m + '.' + p +
' <' + M + '.' + (+m + 1) + '.0';
debug('tilde return', ret);
return ret;
});
}
// ^ --> * (any, kinda silly)
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
// ^1.2.3 --> >=1.2.3 <2.0.0
// ^1.2.0 --> >=1.2.0 <2.0.0
function replaceCarets(comp, loose) {
return comp.trim().split(/\s+/).map(function(comp) {
return replaceCaret(comp, loose);
}).join(' ');
}
function replaceCaret(comp, loose) {
debug('caret', comp, loose);
var r = loose ? re[CARETLOOSE] : re[CARET];
return comp.replace(r, function(_, M, m, p, pr) {
debug('caret', comp, _, M, m, p, pr);
var ret;
if (isX(M))
ret = '';
else if (isX(m))
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
else if (isX(p)) {
if (M === '0')
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
else
ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0';
} else if (pr) {
debug('replaceCaret pr', pr);
if (pr.charAt(0) !== '-')
pr = '-' + pr;
if (M === '0') {
if (m === '0')
ret = '>=' + M + '.' + m + '.' + p + pr +
' <' + M + '.' + m + '.' + (+p + 1);
else
ret = '>=' + M + '.' + m + '.' + p + pr +
' <' + M + '.' + (+m + 1) + '.0';
} else
ret = '>=' + M + '.' + m + '.' + p + pr +
' <' + (+M + 1) + '.0.0';
} else {
debug('no pr');
if (M === '0') {
if (m === '0')
ret = '>=' + M + '.' + m + '.' + p +
' <' + M + '.' + m + '.' + (+p + 1);
else
ret = '>=' + M + '.' + m + '.' + p +
' <' + M + '.' + (+m + 1) + '.0';
} else
ret = '>=' + M + '.' + m + '.' + p +
' <' + (+M + 1) + '.0.0';
}
debug('caret return', ret);
return ret;
});
}
function replaceXRanges(comp, loose) {
debug('replaceXRanges', comp, loose);
return comp.split(/\s+/).map(function(comp) {
return replaceXRange(comp, loose);
}).join(' ');
}
function replaceXRange(comp, loose) {
comp = comp.trim();
var r = loose ? re[XRANGELOOSE] : re[XRANGE];
return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
debug('xRange', comp, ret, gtlt, M, m, p, pr);
var xM = isX(M);
var xm = xM || isX(m);
var xp = xm || isX(p);
var anyX = xp;
if (gtlt === '=' && anyX)
gtlt = '';
if (xM) {
if (gtlt === '>' || gtlt === '<') {
// nothing is allowed
ret = '<0.0.0';
} else {
// nothing is forbidden
ret = '*';
}
} else if (gtlt && anyX) {
// replace X with 0
if (xm)
m = 0;
if (xp)
p = 0;
if (gtlt === '>') {
// >1 => >=2.0.0
// >1.2 => >=1.3.0
// >1.2.3 => >= 1.2.4
gtlt = '>=';
if (xm) {
M = +M + 1;
m = 0;
p = 0;
} else if (xp) {
m = +m + 1;
p = 0;
}
} else if (gtlt === '<=') {
// <=0.7.x is actually <0.8.0, since any 0.7.x should
// pass. Similarly, <=7.x is actually <8.0.0, etc.
gtlt = '<';
if (xm)
M = +M + 1;
else
m = +m + 1;
}
ret = gtlt + M + '.' + m + '.' + p;
} else if (xm) {
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
} else if (xp) {
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
}
debug('xRange return', ret);
return ret;
});
}
// Because * is AND-ed with everything else in the comparator,
// and '' means "any version", just remove the *s entirely.
function replaceStars(comp, loose) {
debug('replaceStars', comp, loose);
// Looseness is ignored here. star is always as loose as it gets!
return comp.trim().replace(re[STAR], '');
}
// This function is passed to string.replace(re[HYPHENRANGE])
// M, m, patch, prerelease, build
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
// 1.2 - 3.4 => >=1.2.0 <3.5.0
function hyphenReplace($0,
from, fM, fm, fp, fpr, fb,
to, tM, tm, tp, tpr, tb) {
if (isX(fM))
from = '';
else if (isX(fm))
from = '>=' + fM + '.0.0';
else if (isX(fp))
from = '>=' + fM + '.' + fm + '.0';
else
from = '>=' + from;
if (isX(tM))
to = '';
else if (isX(tm))
to = '<' + (+tM + 1) + '.0.0';
else if (isX(tp))
to = '<' + tM + '.' + (+tm + 1) + '.0';
else if (tpr)
to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
else
to = '<=' + to;
return (from + ' ' + to).trim();
}
// if ANY of the sets match ALL of its comparators, then pass
Range.prototype.test = function(version) {
if (!version)
return false;
if (typeof version === 'string')
version = new SemVer(version, this.loose);
for (var i = 0; i < this.set.length; i++) {
if (testSet(this.set[i], version))
return true;
}
return false;
};
function testSet(set, version) {
for (var i = 0; i < set.length; i++) {
if (!set[i].test(version))
return false;
}
if (version.prerelease.length) {
// Find the set of versions that are allowed to have prereleases
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
// That should allow `1.2.3-pr.2` to pass.
// However, `1.2.4-alpha.notready` should NOT be allowed,
// even though it's within the range set by the comparators.
for (var i = 0; i < set.length; i++) {
debug(set[i].semver);
if (set[i].semver === ANY)
continue;
if (set[i].semver.prerelease.length > 0) {
var allowed = set[i].semver;
if (allowed.major === version.major &&
allowed.minor === version.minor &&
allowed.patch === version.patch)
return true;
}
}
// Version has a -pre, but it's not one of the ones we like.
return false;
}
return true;
}
exports.satisfies = satisfies;
function satisfies(version, range, loose) {
try {
range = new Range(range, loose);
} catch (er) {
return false;
}
return range.test(version);
}
exports.maxSatisfying = maxSatisfying;
function maxSatisfying(versions, range, loose) {
return versions.filter(function(version) {
return satisfies(version, range, loose);
}).sort(function(a, b) {
return rcompare(a, b, loose);
})[0] || null;
}
exports.minSatisfying = minSatisfying;
function minSatisfying(versions, range, loose) {
return versions.filter(function(version) {
return satisfies(version, range, loose);
}).sort(function(a, b) {
return compare(a, b, loose);
})[0] || null;
}
exports.validRange = validRange;
function validRange(range, loose) {
try {
// Return '*' instead of '' so that truthiness works.
// This will throw if it's invalid anyway
return new Range(range, loose).range || '*';
} catch (er) {
return null;
}
}
// Determine if version is less than all the versions possible in the range
exports.ltr = ltr;
function ltr(version, range, loose) {
return outside(version, range, '<', loose);
}
// Determine if version is greater than all the versions possible in the range.
exports.gtr = gtr;
function gtr(version, range, loose) {
return outside(version, range, '>', loose);
}
exports.outside = outside;
function outside(version, range, hilo, loose) {
version = new SemVer(version, loose);
range = new Range(range, loose);
var gtfn, ltefn, ltfn, comp, ecomp;
switch (hilo) {
case '>':
gtfn = gt;
ltefn = lte;
ltfn = lt;
comp = '>';
ecomp = '>=';
break;
case '<':
gtfn = lt;
ltefn = gte;
ltfn = gt;
comp = '<';
ecomp = '<=';
break;
default:
throw new TypeError('Must provide a hilo val of "<" or ">"');
}
// If it satisifes the range it is not outside
if (satisfies(version, range, loose)) {
return false;
}
// From now on, variable terms are as if we're in "gtr" mode.
// but note that everything is flipped for the "ltr" function.
for (var i = 0; i < range.set.length; ++i) {
var comparators = range.set[i];
var high = null;
var low = null;
comparators.forEach(function(comparator) {
if (comparator.semver === ANY) {
comparator = new Comparator('>=0.0.0')
}
high = high || comparator;
low = low || comparator;
if (gtfn(comparator.semver, high.semver, loose)) {
high = comparator;
} else if (ltfn(comparator.semver, low.semver, loose)) {
low = comparator;
}
});
// If the edge version comparator has a operator then our version
// isn't outside it
if (high.operator === comp || high.operator === ecomp) {
return false;
}
// If the lowest version comparator has an operator and our version
// is less than it then it isn't higher than the range
if ((!low.operator || low.operator === comp) &&
ltefn(version, low.semver)) {
return false;
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
return false;
}
}
return true;
}
exports.prerelease = prerelease;
function prerelease(version, loose) {
var parsed = parse(version, loose);
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null;
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9)))
/***/ },
/* 9 */
/***/ function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_1 = __webpack_require__(11);
var widget_core_1 = __webpack_require__(23);
var _ = __webpack_require__(2);
var StringModel = (function (_super) {
__extends(StringModel, _super);
function StringModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
StringModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
value: '',
disabled: false,
placeholder: '\u200b',
_model_name: 'StringModel'
});
};
return StringModel;
}(widget_core_1.CoreLabeledDOMWidgetModel));
exports.StringModel = StringModel;
var HTMLModel = (function (_super) {
__extends(HTMLModel, _super);
function HTMLModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
HTMLModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_view_name: 'HTMLView',
_model_name: 'HTMLModel'
});
};
return HTMLModel;
}(StringModel));
exports.HTMLModel = HTMLModel;
var HTMLView = (function (_super) {
__extends(HTMLView, _super);
function HTMLView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Called when view is rendered.
*/
HTMLView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-html');
this.content = document.createElement('div');
this.content.classList.add('widget-html-content');
this.el.appendChild(this.content);
this.update(); // Set defaults.
};
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
HTMLView.prototype.update = function () {
this.content.innerHTML = this.model.get('value');
return _super.prototype.update.call(this);
};
return HTMLView;
}(widget_1.LabeledDOMWidgetView));
exports.HTMLView = HTMLView;
var HTMLMathModel = (function (_super) {
__extends(HTMLMathModel, _super);
function HTMLMathModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
HTMLMathModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_view_name: 'HTMLMathView',
_model_name: 'HTMLMathModel'
});
};
return HTMLMathModel;
}(StringModel));
exports.HTMLMathModel = HTMLMathModel;
var HTMLMathView = (function (_super) {
__extends(HTMLMathView, _super);
function HTMLMathView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Called when view is rendered.
*/
HTMLMathView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-htmlmath');
this.content = document.createElement('div');
this.content.classList.add('widget-htmlmath-content');
this.el.appendChild(this.content);
this.update(); // Set defaults.
};
/**
* Update the contents of this view
*/
HTMLMathView.prototype.update = function () {
this.content.innerHTML = this.model.get('value');
this.typeset(this.content);
return _super.prototype.update.call(this);
};
return HTMLMathView;
}(widget_1.LabeledDOMWidgetView));
exports.HTMLMathView = HTMLMathView;
var LabelModel = (function (_super) {
__extends(LabelModel, _super);
function LabelModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
LabelModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_view_name: 'LabelView',
_model_name: 'LabelModel'
});
};
return LabelModel;
}(StringModel));
exports.LabelModel = LabelModel;
var LabelView = (function (_super) {
__extends(LabelView, _super);
function LabelView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Called when view is rendered.
*/
LabelView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-label');
this.update(); // Set defaults.
};
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
LabelView.prototype.update = function () {
this.typeset(this.el, this.model.get('value'));
return _super.prototype.update.call(this);
};
return LabelView;
}(widget_1.LabeledDOMWidgetView));
exports.LabelView = LabelView;
var TextareaModel = (function (_super) {
__extends(TextareaModel, _super);
function TextareaModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
TextareaModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_view_name: 'TextareaView',
_model_name: 'TextareaModel',
rows: null
});
};
return TextareaModel;
}(StringModel));
exports.TextareaModel = TextareaModel;
var TextareaView = (function (_super) {
__extends(TextareaView, _super);
function TextareaView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Called when view is rendered.
*/
TextareaView.prototype.render = function () {
var _this = this;
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-textarea');
this.textbox = document.createElement('textarea');
this.textbox.setAttribute('rows', '5');
this.el.appendChild(this.textbox);
this.update(); // Set defaults.
this.listenTo(this.model, 'msg:custom', function (content) {
_this._handle_textarea_msg(content);
});
this.listenTo(this.model, 'change:placeholder', function (model, value, options) {
this.update_placeholder(value);
});
this.update_placeholder();
};
/**
* Handle when a custom msg is recieved from the back-end.
*/
TextareaView.prototype._handle_textarea_msg = function (content) {
if (content.method == 'scroll_to_bottom') {
this.scroll_to_bottom();
}
};
TextareaView.prototype.update_placeholder = function (value) {
value = value || this.model.get('placeholder');
this.textbox.setAttribute('placeholder', value.toString());
};
/**
* Scroll the text-area view to the bottom.
*/
TextareaView.prototype.scroll_to_bottom = function () {
//this.$textbox.scrollTop(this.$textbox[0].scrollHeight); // DW TODO
};
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
TextareaView.prototype.update = function (options) {
if (options === undefined || options.updated_view != this) {
this.textbox.value = this.model.get('value');
this.textbox.rows = this.model.get('rows');
var disabled = this.model.get('disabled');
this.textbox.disabled = disabled;
}
return _super.prototype.update.call(this);
};
TextareaView.prototype.events = function () {
return {
// Dictionary of events and their handlers.
'keydown textarea': 'handleKeyDown',
'keypress textarea': 'handleKeypress',
'keyup textarea': 'handleChanging',
'paste textarea': 'handleChanging',
'cut textarea': 'handleChanging'
};
};
/**
* Handle key down
*
* Stop propagation so the event isn't sent to the application.
*/
TextareaView.prototype.handleKeyDown = function (e) {
e.stopPropagation();
};
/**
* Handles key press
*
* Stop propagation so the keypress isn't sent to the application.
*/
TextareaView.prototype.handleKeypress = function (e) {
e.stopPropagation();
};
/**
* Handles and validates user input.
*
* Calling model.set will trigger all of the other views of the
* model to update.
*/
TextareaView.prototype.handleChanging = function (e) {
this.model.set('value', e.target.value, { updated_view: this });
this.touch();
};
return TextareaView;
}(widget_1.LabeledDOMWidgetView));
exports.TextareaView = TextareaView;
var TextModel = (function (_super) {
__extends(TextModel, _super);
function TextModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
TextModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_view_name: 'TextView',
_model_name: 'TextModel'
});
};
return TextModel;
}(StringModel));
exports.TextModel = TextModel;
var TextView = (function (_super) {
__extends(TextView, _super);
function TextView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Called when view is rendered.
*/
TextView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-text');
this.textbox = document.createElement('input');
this.textbox.setAttribute('type', 'text');
this.el.appendChild(this.textbox);
this.update(); // Set defaults.
this.listenTo(this.model, 'change:placeholder', function (model, value, options) {
this.update_placeholder(value);
});
this.update_placeholder();
};
TextView.prototype.update_placeholder = function (value) {
if (!value) {
value = this.model.get('placeholder');
}
this.textbox.setAttribute('placeholder', value);
};
TextView.prototype.update = function (options) {
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
if (options === undefined || options.updated_view != this) {
if (this.textbox.value != this.model.get('value')) {
this.textbox.value = this.model.get('value');
}
var disabled = this.model.get('disabled');
this.textbox.disabled = disabled;
}
return _super.prototype.update.call(this);
};
TextView.prototype.events = function () {
return {
// Dictionary of events and their handlers.
'keydown input': 'handleKeyDown',
'keypress input': 'handleKeypress',
'keyup input': 'handleChanging',
'paste input': 'handleChanging',
'cut input': 'handleChanging',
'blur input': 'handleBlur',
'focusout input': 'handleFocusOut'
};
};
/**
* Handle key down
*
* Stop propagation so the keypress isn't sent to the application.
*/
TextView.prototype.handleKeyDown = function (e) {
e.stopPropagation();
};
/**
* Handles text submission
*/
TextView.prototype.handleKeypress = function (e) {
e.stopPropagation();
if (e.keyCode == 13) {
this.send({ event: 'submit' });
e.preventDefault();
}
};
/**
* Handles user input.
*
* Calling model.set will trigger all of the other views of the
* model to update.
*/
TextView.prototype.handleChanging = function (e) {
e.stopPropagation();
this.model.set('value', e.target.value, { updated_view: this });
this.touch();
};
/**
* Prevent a blur from firing if the blur was not user intended.
* This is a workaround for the return-key focus loss bug.
* TODO: Is the original bug actually a fault of the keyboard
* manager?
*/
TextView.prototype.handleBlur = function (e) {
if (e.relatedTarget === null) {
e.stopPropagation();
e.preventDefault();
}
};
/**
* Prevent a blur from firing if the blur was not user intended.
* This is a workaround for the return-key focus loss bug.
*/
TextView.prototype.handleFocusOut = function (e) {
if (e.relatedTarget === null) {
e.stopPropagation();
e.preventDefault();
}
};
return TextView;
}(widget_1.LabeledDOMWidgetView));
exports.TextView = TextView;
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Backbone = __webpack_require__(3);
var _ = __webpack_require__(2);
var utils = __webpack_require__(7);
var $ = __webpack_require__(4);
var nativeview_1 = __webpack_require__(13);
var widget_1 = __webpack_require__(14);
var messaging_1 = __webpack_require__(16);
var widget_2 = __webpack_require__(14);
/**
* Replace model ids with models recursively.
*/
function unpack_models(value, manager) {
var unpacked;
if (_.isArray(value)) {
unpacked = [];
_.each(value, function (sub_value, key) {
unpacked.push(unpack_models(sub_value, manager));
});
return Promise.all(unpacked);
}
else if (value instanceof Object) {
unpacked = {};
_.each(value, function (sub_value, key) {
unpacked[key] = unpack_models(sub_value, manager);
});
return utils.resolvePromisesDict(unpacked);
}
else if (typeof value === 'string' && value.slice(0, 10) === 'IPY_MODEL_') {
// get_model returns a promise already
return manager.get_model(value.slice(10, value.length));
}
else {
return Promise.resolve(value);
}
}
exports.unpack_models = unpack_models;
;
var WidgetModel = (function (_super) {
__extends(WidgetModel, _super);
function WidgetModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* The default attributes.
*/
WidgetModel.prototype.defaults = function () {
return {
_model_module: "jupyter-js-widgets",
_model_name: "WidgetModel",
_model_module_version: "*",
_view_module: "jupyter-js-widgets",
_view_name: null,
_view_module_version: "*",
msg_throttle: 1,
};
};
/**
* Test to see if the model has been synced with the server.
*
* #### Notes
* As of backbone 1.1, backbone ignores `patch` if it thinks the
* model has never been pushed.
*/
WidgetModel.prototype.isNew = function () {
return false;
};
/**
* Constructor
*
* Creates a WidgetModel instance.
*
* Parameters
* ----------
* widget_manager : WidgetManager instance
* model_id : string
* An ID unique to this model.
* comm : Comm instance (optional)
*/
WidgetModel.prototype.initialize = function (attributes, options) {
_super.prototype.initialize.call(this, attributes, options);
this.widget_manager = options.widget_manager;
this.id = options.model_id;
var comm = options.comm;
this.state_change = Promise.resolve();
this.pending_msgs = 0;
this.msg_buffer = null;
this.state_lock = null;
this._buffered_state_diff = {};
this.views = {};
if (comm) {
// Remember comm associated with the model.
this.comm = comm;
comm.model = this;
// Hook comm messages up to model.
comm.on_close(_.bind(this._handle_comm_closed, this));
comm.on_msg(_.bind(this._handle_comm_msg, this));
this.comm_live = true;
}
else {
this.comm_live = false;
}
};
/**
* Send a custom msg over the comm.
*/
WidgetModel.prototype.send = function (content, callbacks, buffers) {
if (this.comm !== undefined) {
var data = { method: 'custom', content: content };
this.comm.send(data, callbacks, {}, buffers);
this.pending_msgs++;
}
};
/**
* Close model
*/
WidgetModel.prototype.close = function (comm_closed) {
if (this.comm && !comm_closed) {
this.comm.close();
}
this.stopListening();
this.trigger('destroy', this);
if (this.comm) {
delete this.comm.model; // Delete ref so GC will collect widget model.
delete this.comm;
}
delete this.model_id; // Delete id from model so widget manager cleans up.
_.each(this.views, function (v, id, views) {
v.then(function (view) {
view.remove();
delete views[id];
});
});
};
/**
* Handle when a widget is closed.
*/
WidgetModel.prototype._handle_comm_closed = function (msg) {
this.trigger('comm:close');
this.close(true);
};
/**
* Handle incoming comm msg.
*/
WidgetModel.prototype._handle_comm_msg = function (msg) {
var _this = this;
var method = msg.content.data.method;
switch (method) {
case 'update':
this.state_change = this.state_change
.then(function () {
var state = msg.content.data.state || {};
var buffer_keys = msg.content.data.buffers || [];
var buffers = msg.buffers || [];
for (var i = 0; i < buffer_keys.length; i++) {
state[buffer_keys[i]] = buffers[i];
}
return _this.constructor._deserialize_state(state, _this.widget_manager);
}).then(function (state) {
_this.set_state(state);
}).catch(utils.reject('Could not process update msg for model id: ' + String(this.id), true));
return this.state_change;
case 'custom':
this.trigger('msg:custom', msg.content.data.content, msg.buffers);
return Promise.resolve();
case 'display':
if (this.widget_manager.displayWithOutput) {
return;
}
this.state_change = this.state_change.then(function () {
_this.widget_manager.display_model(msg, _this);
}).catch(utils.reject('Could not process display view msg', true));
return this.state_change;
}
};
/**
* Handle when a widget is updated from the backend.
*/
WidgetModel.prototype.set_state = function (state) {
this.state_lock = state;
try {
this.set(state);
}
catch (e) {
console.error('Error setting state:', e.message);
}
finally {
this.state_lock = null;
}
};
/**
* Get the serializable state of the model.
*
* If drop_default is thruthy, attributes that are equal to their default
* values are dropped.
*/
WidgetModel.prototype.get_state = function (drop_defaults) {
var state = this.attributes;
if (drop_defaults) {
var defaults = _.result(this, 'defaults');
return Object.keys(state).reduce(function (obj, key) {
if (!_.isEqual(state[key], defaults[key])) {
obj[key] = state[key];
}
return obj;
}, {});
}
else {
return _.clone(state);
}
};
/**
* Handle status msgs.
*
* execution_state : ('busy', 'idle', 'starting')
*/
WidgetModel.prototype._handle_status = function (msg, callbacks) {
if (this.comm !== undefined) {
if (msg.content.execution_state === 'idle') {
// Send buffer if this message caused another message to be
// throttled.
if (this.msg_buffer !== null &&
(this.get('msg_throttle') || 1) === this.pending_msgs) {
var data = {
method: 'backbone',
sync_method: 'update',
sync_data: this.msg_buffer
};
this.comm.send(data, callbacks);
this.msg_buffer = null;
}
else {
--this.pending_msgs;
}
}
}
};
/**
* Create msg callbacks for a comm msg.
*/
WidgetModel.prototype.callbacks = function (view) {
var _this = this;
var callbacks = this.widget_manager.callbacks(view);
if (callbacks.iopub === undefined) {
callbacks.iopub = {};
}
callbacks.iopub.status = function (msg) {
_this._handle_status(msg, callbacks);
};
return callbacks;
};
/**
* Set a value.
*
* We just call the super method, in which val and options are optional
*/
WidgetModel.prototype.set = function (key, val, options) {
var return_value = _super.prototype.set.call(this, key, val, options);
// Backbone only remembers the diff of the most recent set()
// operation. Calling set multiple times in a row results in a
// loss of diff information. Here we keep our own running diff.
//
// We don't buffer the state set in the constructor (including
// defaults), so we first check to see if we've initialized _buffered_state_diff.
// which happens after the constructor sets attributes at creation.
if (this._buffered_state_diff !== void 0) {
this._buffered_state_diff = _.extend(this._buffered_state_diff, this.changedAttributes() || {});
}
return return_value;
};
/**
* Handle sync to the back-end. Called when a model.save() is called.
*
* Make sure a comm exists.
*
* Parameters
* ----------
* method : create, update, patch, delete, read
* create/update always send the full attribute set
* patch - only send attributes listed in options.attrs, and if we
* are queuing up messages, combine with previous messages that have
* not been sent yet
* model : the model we are syncing
* will normally be the same as `this`
* options : dict
* the `attrs` key, if it exists, gives an {attr: value} dict that
* should be synced, otherwise, sync all attributes.
*
*/
WidgetModel.prototype.sync = function (method, model, options) {
if (options === void 0) { options = {}; }
// the typing is to return `any` since the super.sync method returns a JqXHR, but we just return false if there is an error.
var error = options.error || function () {
console.error('Backbone sync error:', arguments);
};
if (this.comm === undefined) {
error();
return false;
}
var attrs = (method === 'patch') ? options.attrs : model.get_state(options.drop_defaults);
// The state_lock lists attributes that are currently being changed
// right now from a kernel message.
// We don't want to send these non-changes back to the kernel, so we
// delete them out of attrs, (but we only delete them if the value
// hasn't changed from the value stored in the state_lock).
if (this.state_lock !== null) {
var keys = Object.keys(this.state_lock);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (attrs[key] === this.state_lock[key]) {
delete attrs[key];
}
}
}
if (_.size(attrs) > 0) {
// If this message was sent via backbone itself, it will not
// have any callbacks. It's important that we create callbacks
// so we can listen for status messages, etc...
var callbacks = options.callbacks || this.callbacks();
// Check throttle.
if (this.pending_msgs >= (this.get('msg_throttle') || 1)) {
// The throttle has been exceeded, buffer the current msg so
// it can be sent once the kernel has finished processing
// some of the existing messages.
// Combine updates if it is a 'patch' sync, otherwise replace updates
switch (method) {
case 'patch':
this.msg_buffer = _.extend(this.msg_buffer || {}, attrs);
break;
case 'update':
case 'create':
this.msg_buffer = attrs;
break;
default:
error();
return false;
}
this.msg_buffer_callbacks = callbacks;
}
else {
// We haven't exceeded the throttle, send the message like
// normal.
this.send_sync_message(attrs, callbacks);
this.pending_msgs++;
// Since the comm is a one-way communication, assume the message
// arrived and was processed successfully.
// Don't call options.success since we don't have a model back from
// the server. Note that this means we don't have the Backbone
// 'sync' event.
}
}
};
WidgetModel.prototype.send_sync_message = function (attrs, callbacks) {
var _this = this;
// prepare and send a comm message syncing attrs
// first, build a state dictionary with key=the attribute and the value
// being the value or the promise of the serialized value
var serializers = this.constructor.serializers;
if (serializers) {
for (var k in attrs) {
if (serializers[k] && serializers[k].serialize) {
attrs[k] = (serializers[k].serialize)(attrs[k], this);
}
}
}
utils.resolvePromisesDict(attrs).then(function (state) {
// get binary values, then send
var keys = Object.keys(state);
var buffers = [];
var buffer_keys = [];
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var value = state[key];
if (value) {
if (value.buffer instanceof ArrayBuffer
|| value instanceof ArrayBuffer) {
buffers.push(value);
buffer_keys.push(key);
delete state[key];
}
}
}
_this.comm.send({
method: 'backbone',
sync_data: state,
buffer_keys: buffer_keys
}, callbacks, {}, buffers);
}).catch(function (error) {
_this.pending_msgs--;
return (utils.reject('Could not send widget sync message', true))(error);
});
};
/**
* Push this model's state to the back-end
*
* This invokes a Backbone.Sync.
*/
WidgetModel.prototype.save_changes = function (callbacks) {
if (this.comm_live) {
var options = { patch: true };
if (callbacks) {
options.callbacks = callbacks;
}
this.save(this._buffered_state_diff, options);
this._buffered_state_diff = {};
}
};
/**
* on_some_change(['key1', 'key2'], foo, context) differs from
* on('change:key1 change:key2', foo, context).
* If the widget attributes key1 and key2 are both modified,
* the second form will result in foo being called twice
* while the first will call foo only once.
*/
WidgetModel.prototype.on_some_change = function (keys, callback, context) {
this.on('change', function () {
if (keys.some(this.hasChanged, this)) {
callback.apply(context, arguments);
}
}, this);
};
/**
* Serialize the model. See the deserialization function at the top of this file
* and the kernel-side serializer/deserializer.
*/
WidgetModel.prototype.toJSON = function (options) {
return 'IPY_MODEL_' + this.id;
};
/**
* Returns a promise for the deserialized state. The second argument
* is an instance of widget manager, which is required for the
* deserialization of widget models.
*/
WidgetModel._deserialize_state = function (state, manager) {
var serializers = this.serializers;
var deserialized;
if (serializers) {
deserialized = {};
for (var k in state) {
if (serializers[k] && serializers[k].deserialize) {
deserialized[k] = (serializers[k].deserialize)(state[k], manager);
}
else {
deserialized[k] = state[k];
}
}
}
else {
deserialized = state;
}
return utils.resolvePromisesDict(deserialized);
};
/**
* Returns a promise for the serialized state. The second argument
* is an instance of widget manager.
*/
WidgetModel._serialize_state = function (state, manager) {
var serializers = this.serializers;
var serialized;
if (serializers) {
serialized = {};
for (var k in state) {
if (serializers[k] && serializers[k].serialize) {
serialized[k] = (serializers[k].serialize)(state[k], manager);
}
else {
serialized[k] = state[k];
}
}
}
else {
serialized = state;
}
return utils.resolvePromisesDict(serialized);
};
return WidgetModel;
}(Backbone.Model));
exports.WidgetModel = WidgetModel;
var DOMWidgetModel = (function (_super) {
__extends(DOMWidgetModel, _super);
function DOMWidgetModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
DOMWidgetModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
layout: void 0,
_dom_classes: []
});
};
DOMWidgetModel.serializers = _.extend({
layout: { deserialize: unpack_models },
style: { deserialize: unpack_models },
}, WidgetModel.serializers);
return DOMWidgetModel;
}(WidgetModel));
exports.DOMWidgetModel = DOMWidgetModel;
/**
* - create_view and remove_view are default functions called when adding or removing views
* - create_view takes a model and an index and returns a view or a promise for a view for that model
* - remove_view takes a view and destroys it (including calling `view.remove()`)
* - each time the update() function is called with a new list, the create and remove
* callbacks will be called in an order so that if you append the views created in the
* create callback and remove the views in the remove callback, you will duplicate
* the order of the list.
* - the remove callback defaults to just removing the view (e.g., pass in null for the second parameter)
* - the context defaults to the created ViewList. If you pass another context, the create and remove
* will be called in that context.
*/
var ViewList = (function () {
function ViewList(create_view, remove_view, context) {
this.initialize(create_view, remove_view, context);
}
ViewList.prototype.initialize = function (create_view, remove_view, context) {
this._handler_context = context || this;
this._models = [];
this.views = []; // list of promises for views
this._create_view = create_view;
this._remove_view = remove_view || function (view) { view.remove(); };
};
/**
* the create_view, remove_view, and context arguments override the defaults
* specified when the list is created.
* after this function, the .views attribute is a list of promises for views
* if you want to perform some action on the list of views, do something like
* `Promise.all(myviewlist.views).then(function(views) {...});`
*/
ViewList.prototype.update = function (new_models, create_view, remove_view, context) {
var remove = remove_view || this._remove_view;
var create = create_view || this._create_view;
context = context || this._handler_context;
var i = 0;
// first, skip past the beginning of the lists if they are identical
for (; i < new_models.length; i++) {
if (i >= this._models.length || new_models[i] !== this._models[i]) {
break;
}
}
var first_removed = i;
// Remove the non-matching items from the old list.
var removed = this.views.splice(first_removed, this.views.length - first_removed);
for (var j = 0; j < removed.length; j++) {
removed[j].then(function (view) {
remove.call(context, view);
});
}
// Add the rest of the new list items.
for (; i < new_models.length; i++) {
this.views.push(Promise.resolve(create.call(context, new_models[i], i)));
}
// make a copy of the input array
this._models = new_models.slice();
// return a promise that resolves to all of the resolved views
return Promise.all(this.views);
};
/**
* removes every view in the list; convenience function for `.update([])`
* that should be faster
* returns a promise that resolves after this removal is done
*/
ViewList.prototype.remove = function () {
var _this = this;
return Promise.all(this.views).then(function (views) {
views.forEach(function (value) { return _this._remove_view.call(_this._handler_context, value); });
_this.views = [];
_this._models = [];
});
};
/**
* Dispose this viewlist.
*
* A synchronous function which just deletes references to child views. This
* function does not call .remove() on child views because that is
* asynchronous. Use this in cases where child views will be removed in
* another way.
*/
ViewList.prototype.dispose = function () {
this.views = null;
this._models = null;
};
return ViewList;
}());
exports.ViewList = ViewList;
var WidgetView = (function (_super) {
__extends(WidgetView, _super);
function WidgetView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Public constructor.
*/
WidgetView.prototype.initialize = function (parameters) {
var _this = this;
this.listenTo(this.model, 'change', this.update);
this.options = parameters.options;
this.displayed = new Promise(function (resolve, reject) {
_this.once('displayed', resolve);
});
};
/**
* Triggered on model change.
*
* Update view to be consistent with this.model
*/
WidgetView.prototype.update = function (options) {
};
;
/**
* Render a view
*
* @returns the view or a promise to the view.
*/
WidgetView.prototype.render = function () {
};
/**
* Create and promise that resolves to a child view of a given model
*/
WidgetView.prototype.create_child_view = function (child_model, options) {
var that = this;
options = _.extend({ parent: this }, options || {});
return this.model.widget_manager.create_view(child_model, options)
.catch(utils.reject('Could not create child view', true));
};
/**
* Create msg callbacks for a comm msg.
*/
WidgetView.prototype.callbacks = function () {
return this.model.callbacks(this);
};
/**
* Send a custom msg associated with this view.
*/
WidgetView.prototype.send = function (content, buffers) {
this.model.send(content, this.callbacks(), buffers);
};
WidgetView.prototype.touch = function () {
this.model.save_changes(this.callbacks());
};
WidgetView.prototype.remove = function () {
// Raise a remove event when the view is removed.
_super.prototype.remove.call(this);
this.trigger('remove');
return this;
};
return WidgetView;
}(nativeview_1.NativeView));
exports.WidgetView = WidgetView;
var JupyterPhosphorWidget = (function (_super) {
__extends(JupyterPhosphorWidget, _super);
function JupyterPhosphorWidget(options) {
var _this = this;
var view = options.view;
delete options.view;
_this = _super.call(this, options) || this;
_this._view = view;
return _this;
}
/**
* Dispose the widget.
*
* This causes the view to be destroyed as well with 'remove'
*/
JupyterPhosphorWidget.prototype.dispose = function () {
if (this.isDisposed) {
return;
}
_super.prototype.dispose.call(this);
if (this._view) {
this._view.remove();
}
this._view = null;
};
/**
* Process the phosphor message.
*
* Any custom phosphor widget used inside a Jupyter widget should override
* the processMessage function like this.
*/
JupyterPhosphorWidget.prototype.processMessage = function (msg) {
_super.prototype.processMessage.call(this, msg);
this._view.processPhosphorMessage(msg);
};
return JupyterPhosphorWidget;
}(widget_1.Widget));
exports.JupyterPhosphorWidget = JupyterPhosphorWidget;
var DOMWidgetView = (function (_super) {
__extends(DOMWidgetView, _super);
function DOMWidgetView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Public constructor
*/
DOMWidgetView.prototype.initialize = function (parameters) {
var _this = this;
_super.prototype.initialize.call(this, parameters);
this.id = utils.uuid();
this.listenTo(this.model, 'change:_dom_classes', function (model, new_classes) {
var old_classes = model.previous('_dom_classes');
_this.update_classes(old_classes, new_classes);
});
this.layoutPromise = Promise.resolve();
this.listenTo(this.model, 'change:layout', function (model, value) {
_this.setLayout(value, model.previous('layout'));
});
this.stylePromise = Promise.resolve();
this.listenTo(this.model, 'change:style', function (model, value) {
_this.setStyle(value, model.previous('style'));
});
this.displayed.then(function () {
_this.update_classes([], _this.model.get('_dom_classes'));
_this.setLayout(_this.model.get('layout'));
_this.setStyle(_this.model.get('style'));
});
};
DOMWidgetView.prototype.setLayout = function (layout, oldLayout) {
var _this = this;
if (layout) {
this.layoutPromise = this.layoutPromise.then(function (oldLayoutView) {
if (oldLayoutView) {
oldLayoutView.unlayout();
_this.stopListening(oldLayoutView.model);
oldLayoutView.remove();
}
return _this.create_child_view(layout).then(function (view) {
// Trigger the displayed event of the child view.
return _this.displayed.then(function () {
view.trigger('displayed');
_this.listenTo(view.model, 'change', function () {
// Post (asynchronous) so layout changes can take
// effect first.
messaging_1.postMessage(_this.pWidget, widget_2.ResizeMessage.UnknownSize);
});
messaging_1.postMessage(_this.pWidget, widget_2.ResizeMessage.UnknownSize);
return view;
});
}).catch(utils.reject('Could not add LayoutView to DOMWidgetView', true));
});
}
};
DOMWidgetView.prototype.setStyle = function (style, oldStyle) {
var _this = this;
if (style) {
this.stylePromise = this.stylePromise.then(function (oldStyleView) {
if (oldStyleView) {
oldStyleView.unstyle();
_this.stopListening(oldStyleView.model);
oldStyleView.remove();
}
return _this.create_child_view(style).then(function (view) {
// Trigger the displayed event of the child view.
return _this.displayed.then(function () {
view.trigger('displayed');
// Unlike for the layout attribute, style changes don't
// trigger phosphor resize messages.
return view;
});
}).catch(utils.reject('Could not add styleView to DOMWidgetView', true));
});
}
};
/**
* Update the DOM classes applied to an element, default to this.el.
*/
DOMWidgetView.prototype.update_classes = function (old_classes, new_classes, el) {
if (el === undefined) {
el = this.el;
}
_.difference(old_classes, new_classes).map(function (c) {
if (el.classList) {
el.classList.remove(c);
}
else {
el.setAttribute('class', el.getAttribute('class').replace(c, ''));
}
});
_.difference(new_classes, old_classes).map(function (c) {
if (el.classList) {
el.classList.add(c);
}
else {
el.setAttribute('class', el.getAttribute('class').concat(' ', c));
}
});
};
/**
* Update the DOM classes applied to the widget based on a single
* trait's value.
*
* Given a trait value classes map, this function automatically
* handles applying the appropriate classes to the widget element
* and removing classes that are no longer valid.
*
* Parameters
* ----------
* class_map: dictionary
* Dictionary of trait values to class lists.
* Example:
* {
* success: ['alert', 'alert-success'],
* info: ['alert', 'alert-info'],
* warning: ['alert', 'alert-warning'],
* danger: ['alert', 'alert-danger']
* };
* trait_name: string
* Name of the trait to check the value of.
* el: optional DOM element handle, defaults to this.el
* Element that the classes are applied to.
*/
DOMWidgetView.prototype.update_mapped_classes = function (class_map, trait_name, el) {
var key = this.model.previous(trait_name);
var old_classes = class_map[key] ? class_map[key] : [];
key = this.model.get(trait_name);
var new_classes = class_map[key] ? class_map[key] : [];
this.update_classes(old_classes, new_classes, el || this.el);
};
DOMWidgetView.prototype.set_mapped_classes = function (class_map, trait_name, el) {
var key = this.model.get(trait_name);
var new_classes = class_map[key] ? class_map[key] : [];
this.update_classes([], new_classes, el || this.el);
};
DOMWidgetView.prototype.typeset = function (element, text) {
this.displayed.then(function () { utils.typeset(element, text); });
};
DOMWidgetView.prototype._setElement = function (el) {
if (this.pWidget) {
this.pWidget.dispose();
}
this.$el = el instanceof $ ? el : $(el);
this.el = this.$el[0];
this.pWidget = new JupyterPhosphorWidget({
node: el,
view: this
});
};
DOMWidgetView.prototype.remove = function () {
if (this.pWidget) {
this.pWidget.dispose();
}
return _super.prototype.remove.call(this);
};
DOMWidgetView.prototype.processPhosphorMessage = function (msg) {
switch (msg.type) {
case 'after-attach':
this.trigger('displayed');
break;
}
};
return DOMWidgetView;
}(WidgetView));
exports.DOMWidgetView = DOMWidgetView;
var LabeledDOMWidgetModel = (function (_super) {
__extends(LabeledDOMWidgetModel, _super);
function LabeledDOMWidgetModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
LabeledDOMWidgetModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
description: '',
});
};
return LabeledDOMWidgetModel;
}(DOMWidgetModel));
exports.LabeledDOMWidgetModel = LabeledDOMWidgetModel;
var LabeledDOMWidgetView = (function (_super) {
__extends(LabeledDOMWidgetView, _super);
function LabeledDOMWidgetView() {
return _super !== null && _super.apply(this, arguments) || this;
}
LabeledDOMWidgetView.prototype.render = function () {
this.label = document.createElement('div');
this.el.appendChild(this.label);
this.label.className = 'widget-label';
this.label.style.display = 'none';
this.listenTo(this.model, 'change:description', this.updateDescription);
this.updateDescription();
};
LabeledDOMWidgetView.prototype.updateDescription = function () {
var description = this.model.get('description');
if (description.length === 0) {
this.label.style.display = 'none';
}
else {
this.label.innerHTML = description;
this.typeset(this.label);
this.label.style.display = '';
}
this.label.title = description;
};
return LabeledDOMWidgetView;
}(DOMWidgetView));
exports.LabeledDOMWidgetView = LabeledDOMWidgetView;
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(global) {// Backbone.js 1.3.3
// (c) 2010-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Backbone may be freely distributed under the MIT license.
// For all details and documentation:
// http://backbonejs.org
(function(factory) {
// Establish the root object, `window` (`self`) in the browser, or `global` on the server.
// We use `self` instead of `window` for `WebWorker` support.
var root = (typeof self == 'object' && self.self === self && self) ||
(typeof global == 'object' && global.global === global && global);
// Set up Backbone appropriately for the environment. Start with AMD.
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(4), exports], __WEBPACK_AMD_DEFINE_RESULT__ = function(_, $, exports) {
// Export global even in AMD case in case this script is loaded with
// others that may still expect a global Backbone.
root.Backbone = factory(root, exports, _, $);
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
// Next for Node.js or CommonJS. jQuery may not be needed as a module.
} else if (typeof exports !== 'undefined') {
var _ = __webpack_require__(2), $;
try { $ = __webpack_require__(4); } catch (e) {}
factory(root, exports, _, $);
// Finally, as a browser global.
} else {
root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
}
})(function(root, Backbone, _, $) {
// Initial Setup
// -------------
// Save the previous value of the `Backbone` variable, so that it can be
// restored later on, if `noConflict` is used.
var previousBackbone = root.Backbone;
// Create a local reference to a common array method we'll want to use later.
var slice = Array.prototype.slice;
// Current version of the library. Keep in sync with `package.json`.
Backbone.VERSION = '1.3.3';
// For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
// the `$` variable.
Backbone.$ = $;
// Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
// to its previous owner. Returns a reference to this Backbone object.
Backbone.noConflict = function() {
root.Backbone = previousBackbone;
return this;
};
// Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option
// will fake `"PATCH"`, `"PUT"` and `"DELETE"` requests via the `_method` parameter and
// set a `X-Http-Method-Override` header.
Backbone.emulateHTTP = false;
// Turn on `emulateJSON` to support legacy servers that can't deal with direct
// `application/json` requests ... this will encode the body as
// `application/x-www-form-urlencoded` instead and will send the model in a
// form param named `model`.
Backbone.emulateJSON = false;
// Proxy Backbone class methods to Underscore functions, wrapping the model's
// `attributes` object or collection's `models` array behind the scenes.
//
// collection.filter(function(model) { return model.get('age') > 10 });
// collection.each(this.addView);
//
// `Function#apply` can be slow so we use the method's arg count, if we know it.
var addMethod = function(length, method, attribute) {
switch (length) {
case 1: return function() {
return _[method](this[attribute]);
};
case 2: return function(value) {
return _[method](this[attribute], value);
};
case 3: return function(iteratee, context) {
return _[method](this[attribute], cb(iteratee, this), context);
};
case 4: return function(iteratee, defaultVal, context) {
return _[method](this[attribute], cb(iteratee, this), defaultVal, context);
};
default: return function() {
var args = slice.call(arguments);
args.unshift(this[attribute]);
return _[method].apply(_, args);
};
}
};
var addUnderscoreMethods = function(Class, methods, attribute) {
_.each(methods, function(length, method) {
if (_[method]) Class.prototype[method] = addMethod(length, method, attribute);
});
};
// Support `collection.sortBy('attr')` and `collection.findWhere({id: 1})`.
var cb = function(iteratee, instance) {
if (_.isFunction(iteratee)) return iteratee;
if (_.isObject(iteratee) && !instance._isModel(iteratee)) return modelMatcher(iteratee);
if (_.isString(iteratee)) return function(model) { return model.get(iteratee); };
return iteratee;
};
var modelMatcher = function(attrs) {
var matcher = _.matches(attrs);
return function(model) {
return matcher(model.attributes);
};
};
// Backbone.Events
// ---------------
// A module that can be mixed in to *any object* in order to provide it with
// a custom event channel. You may bind a callback to an event with `on` or
// remove with `off`; `trigger`-ing an event fires all callbacks in
// succession.
//
// var object = {};
// _.extend(object, Backbone.Events);
// object.on('expand', function(){ alert('expanded'); });
// object.trigger('expand');
//
var Events = Backbone.Events = {};
// Regular expression used to split event strings.
var eventSplitter = /\s+/;
// Iterates over the standard `event, callback` (as well as the fancy multiple
// space-separated events `"change blur", callback` and jQuery-style event
// maps `{event: callback}`).
var eventsApi = function(iteratee, events, name, callback, opts) {
var i = 0, names;
if (name && typeof name === 'object') {
// Handle event maps.
if (callback !== void 0 && 'context' in opts && opts.context === void 0) opts.context = callback;
for (names = _.keys(name); i < names.length ; i++) {
events = eventsApi(iteratee, events, names[i], name[names[i]], opts);
}
} else if (name && eventSplitter.test(name)) {
// Handle space-separated event names by delegating them individually.
for (names = name.split(eventSplitter); i < names.length; i++) {
events = iteratee(events, names[i], callback, opts);
}
} else {
// Finally, standard events.
events = iteratee(events, name, callback, opts);
}
return events;
};
// Bind an event to a `callback` function. Passing `"all"` will bind
// the callback to all events fired.
Events.on = function(name, callback, context) {
return internalOn(this, name, callback, context);
};
// Guard the `listening` argument from the public API.
var internalOn = function(obj, name, callback, context, listening) {
obj._events = eventsApi(onApi, obj._events || {}, name, callback, {
context: context,
ctx: obj,
listening: listening
});
if (listening) {
var listeners = obj._listeners || (obj._listeners = {});
listeners[listening.id] = listening;
}
return obj;
};
// Inversion-of-control versions of `on`. Tell *this* object to listen to
// an event in another object... keeping track of what it's listening to
// for easier unbinding later.
Events.listenTo = function(obj, name, callback) {
if (!obj) return this;
var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
var listeningTo = this._listeningTo || (this._listeningTo = {});
var listening = listeningTo[id];
// This object is not listening to any other events on `obj` yet.
// Setup the necessary references to track the listening callbacks.
if (!listening) {
var thisId = this._listenId || (this._listenId = _.uniqueId('l'));
listening = listeningTo[id] = {obj: obj, objId: id, id: thisId, listeningTo: listeningTo, count: 0};
}
// Bind callbacks on obj, and keep track of them on listening.
internalOn(obj, name, callback, this, listening);
return this;
};
// The reducing API that adds a callback to the `events` object.
var onApi = function(events, name, callback, options) {
if (callback) {
var handlers = events[name] || (events[name] = []);
var context = options.context, ctx = options.ctx, listening = options.listening;
if (listening) listening.count++;
handlers.push({callback: callback, context: context, ctx: context || ctx, listening: listening});
}
return events;
};
// Remove one or many callbacks. If `context` is null, removes all
// callbacks with that function. If `callback` is null, removes all
// callbacks for the event. If `name` is null, removes all bound
// callbacks for all events.
Events.off = function(name, callback, context) {
if (!this._events) return this;
this._events = eventsApi(offApi, this._events, name, callback, {
context: context,
listeners: this._listeners
});
return this;
};
// Tell this object to stop listening to either specific events ... or
// to every object it's currently listening to.
Events.stopListening = function(obj, name, callback) {
var listeningTo = this._listeningTo;
if (!listeningTo) return this;
var ids = obj ? [obj._listenId] : _.keys(listeningTo);
for (var i = 0; i < ids.length; i++) {
var listening = listeningTo[ids[i]];
// If listening doesn't exist, this object is not currently
// listening to obj. Break out early.
if (!listening) break;
listening.obj.off(name, callback, this);
}
return this;
};
// The reducing API that removes a callback from the `events` object.
var offApi = function(events, name, callback, options) {
if (!events) return;
var i = 0, listening;
var context = options.context, listeners = options.listeners;
// Delete all events listeners and "drop" events.
if (!name && !callback && !context) {
var ids = _.keys(listeners);
for (; i < ids.length; i++) {
listening = listeners[ids[i]];
delete listeners[listening.id];
delete listening.listeningTo[listening.objId];
}
return;
}
var names = name ? [name] : _.keys(events);
for (; i < names.length; i++) {
name = names[i];
var handlers = events[name];
// Bail out if there are no events stored.
if (!handlers) break;
// Replace events if there are any remaining. Otherwise, clean up.
var remaining = [];
for (var j = 0; j < handlers.length; j++) {
var handler = handlers[j];
if (
callback && callback !== handler.callback &&
callback !== handler.callback._callback ||
context && context !== handler.context
) {
remaining.push(handler);
} else {
listening = handler.listening;
if (listening && --listening.count === 0) {
delete listeners[listening.id];
delete listening.listeningTo[listening.objId];
}
}
}
// Update tail event if the list has any events. Otherwise, clean up.
if (remaining.length) {
events[name] = remaining;
} else {
delete events[name];
}
}
return events;
};
// Bind an event to only be triggered a single time. After the first time
// the callback is invoked, its listener will be removed. If multiple events
// are passed in using the space-separated syntax, the handler will fire
// once for each event, not once for a combination of all events.
Events.once = function(name, callback, context) {
// Map the event into a `{event: once}` object.
var events = eventsApi(onceMap, {}, name, callback, _.bind(this.off, this));
if (typeof name === 'string' && context == null) callback = void 0;
return this.on(events, callback, context);
};
// Inversion-of-control versions of `once`.
Events.listenToOnce = function(obj, name, callback) {
// Map the event into a `{event: once}` object.
var events = eventsApi(onceMap, {}, name, callback, _.bind(this.stopListening, this, obj));
return this.listenTo(obj, events);
};
// Reduces the event callbacks into a map of `{event: onceWrapper}`.
// `offer` unbinds the `onceWrapper` after it has been called.
var onceMap = function(map, name, callback, offer) {
if (callback) {
var once = map[name] = _.once(function() {
offer(name, once);
callback.apply(this, arguments);
});
once._callback = callback;
}
return map;
};
// Trigger one or many events, firing all bound callbacks. Callbacks are
// passed the same arguments as `trigger` is, apart from the event name
// (unless you're listening on `"all"`, which will cause your callback to
// receive the true name of the event as the first argument).
Events.trigger = function(name) {
if (!this._events) return this;
var length = Math.max(0, arguments.length - 1);
var args = Array(length);
for (var i = 0; i < length; i++) args[i] = arguments[i + 1];
eventsApi(triggerApi, this._events, name, void 0, args);
return this;
};
// Handles triggering the appropriate event callbacks.
var triggerApi = function(objEvents, name, callback, args) {
if (objEvents) {
var events = objEvents[name];
var allEvents = objEvents.all;
if (events && allEvents) allEvents = allEvents.slice();
if (events) triggerEvents(events, args);
if (allEvents) triggerEvents(allEvents, [name].concat(args));
}
return objEvents;
};
// A difficult-to-believe, but optimized internal dispatch function for
// triggering events. Tries to keep the usual cases speedy (most internal
// Backbone events have 3 arguments).
var triggerEvents = function(events, args) {
var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];
switch (args.length) {
case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;
case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;
case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;
case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;
default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;
}
};
// Aliases for backwards compatibility.
Events.bind = Events.on;
Events.unbind = Events.off;
// Allow the `Backbone` object to serve as a global event bus, for folks who
// want global "pubsub" in a convenient place.
_.extend(Backbone, Events);
// Backbone.Model
// --------------
// Backbone **Models** are the basic data object in the framework --
// frequently representing a row in a table in a database on your server.
// A discrete chunk of data and a bunch of useful, related methods for
// performing computations and transformations on that data.
// Create a new model with the specified attributes. A client id (`cid`)
// is automatically generated and assigned for you.
var Model = Backbone.Model = function(attributes, options) {
var attrs = attributes || {};
options || (options = {});
this.cid = _.uniqueId(this.cidPrefix);
this.attributes = {};
if (options.collection) this.collection = options.collection;
if (options.parse) attrs = this.parse(attrs, options) || {};
var defaults = _.result(this, 'defaults');
attrs = _.defaults(_.extend({}, defaults, attrs), defaults);
this.set(attrs, options);
this.changed = {};
this.initialize.apply(this, arguments);
};
// Attach all inheritable methods to the Model prototype.
_.extend(Model.prototype, Events, {
// A hash of attributes whose current and previous value differ.
changed: null,
// The value returned during the last failed validation.
validationError: null,
// The default name for the JSON `id` attribute is `"id"`. MongoDB and
// CouchDB users may want to set this to `"_id"`.
idAttribute: 'id',
// The prefix is used to create the client id which is used to identify models locally.
// You may want to override this if you're experiencing name clashes with model ids.
cidPrefix: 'c',
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// Return a copy of the model's `attributes` object.
toJSON: function(options) {
return _.clone(this.attributes);
},
// Proxy `Backbone.sync` by default -- but override this if you need
// custom syncing semantics for *this* particular model.
sync: function() {
return Backbone.sync.apply(this, arguments);
},
// Get the value of an attribute.
get: function(attr) {
return this.attributes[attr];
},
// Get the HTML-escaped value of an attribute.
escape: function(attr) {
return _.escape(this.get(attr));
},
// Returns `true` if the attribute contains a value that is not null
// or undefined.
has: function(attr) {
return this.get(attr) != null;
},
// Special-cased proxy to underscore's `_.matches` method.
matches: function(attrs) {
return !!_.iteratee(attrs, this)(this.attributes);
},
// Set a hash of model attributes on the object, firing `"change"`. This is
// the core primitive operation of a model, updating the data and notifying
// anyone who needs to know about the change in state. The heart of the beast.
set: function(key, val, options) {
if (key == null) return this;
// Handle both `"key", value` and `{key: value}` -style arguments.
var attrs;
if (typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
options || (options = {});
// Run validation.
if (!this._validate(attrs, options)) return false;
// Extract attributes and options.
var unset = options.unset;
var silent = options.silent;
var changes = [];
var changing = this._changing;
this._changing = true;
if (!changing) {
this._previousAttributes = _.clone(this.attributes);
this.changed = {};
}
var current = this.attributes;
var changed = this.changed;
var prev = this._previousAttributes;
// For each `set` attribute, update or delete the current value.
for (var attr in attrs) {
val = attrs[attr];
if (!_.isEqual(current[attr], val)) changes.push(attr);
if (!_.isEqual(prev[attr], val)) {
changed[attr] = val;
} else {
delete changed[attr];
}
unset ? delete current[attr] : current[attr] = val;
}
// Update the `id`.
if (this.idAttribute in attrs) this.id = this.get(this.idAttribute);
// Trigger all relevant attribute changes.
if (!silent) {
if (changes.length) this._pending = options;
for (var i = 0; i < changes.length; i++) {
this.trigger('change:' + changes[i], this, current[changes[i]], options);
}
}
// You might be wondering why there's a `while` loop here. Changes can
// be recursively nested within `"change"` events.
if (changing) return this;
if (!silent) {
while (this._pending) {
options = this._pending;
this._pending = false;
this.trigger('change', this, options);
}
}
this._pending = false;
this._changing = false;
return this;
},
// Remove an attribute from the model, firing `"change"`. `unset` is a noop
// if the attribute doesn't exist.
unset: function(attr, options) {
return this.set(attr, void 0, _.extend({}, options, {unset: true}));
},
// Clear all attributes on the model, firing `"change"`.
clear: function(options) {
var attrs = {};
for (var key in this.attributes) attrs[key] = void 0;
return this.set(attrs, _.extend({}, options, {unset: true}));
},
// Determine if the model has changed since the last `"change"` event.
// If you specify an attribute name, determine if that attribute has changed.
hasChanged: function(attr) {
if (attr == null) return !_.isEmpty(this.changed);
return _.has(this.changed, attr);
},
// Return an object containing all the attributes that have changed, or
// false if there are no changed attributes. Useful for determining what
// parts of a view need to be updated and/or what attributes need to be
// persisted to the server. Unset attributes will be set to undefined.
// You can also pass an attributes object to diff against the model,
// determining if there *would be* a change.
changedAttributes: function(diff) {
if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;
var old = this._changing ? this._previousAttributes : this.attributes;
var changed = {};
for (var attr in diff) {
var val = diff[attr];
if (_.isEqual(old[attr], val)) continue;
changed[attr] = val;
}
return _.size(changed) ? changed : false;
},
// Get the previous value of an attribute, recorded at the time the last
// `"change"` event was fired.
previous: function(attr) {
if (attr == null || !this._previousAttributes) return null;
return this._previousAttributes[attr];
},
// Get all of the attributes of the model at the time of the previous
// `"change"` event.
previousAttributes: function() {
return _.clone(this._previousAttributes);
},
// Fetch the model from the server, merging the response with the model's
// local attributes. Any changed attributes will trigger a "change" event.
fetch: function(options) {
options = _.extend({parse: true}, options);
var model = this;
var success = options.success;
options.success = function(resp) {
var serverAttrs = options.parse ? model.parse(resp, options) : resp;
if (!model.set(serverAttrs, options)) return false;
if (success) success.call(options.context, model, resp, options);
model.trigger('sync', model, resp, options);
};
wrapError(this, options);
return this.sync('read', this, options);
},
// Set a hash of model attributes, and sync the model to the server.
// If the server returns an attributes hash that differs, the model's
// state will be `set` again.
save: function(key, val, options) {
// Handle both `"key", value` and `{key: value}` -style arguments.
var attrs;
if (key == null || typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
options = _.extend({validate: true, parse: true}, options);
var wait = options.wait;
// If we're not waiting and attributes exist, save acts as
// `set(attr).save(null, opts)` with validation. Otherwise, check if
// the model will be valid when the attributes, if any, are set.
if (attrs && !wait) {
if (!this.set(attrs, options)) return false;
} else if (!this._validate(attrs, options)) {
return false;
}
// After a successful server-side save, the client is (optionally)
// updated with the server-side state.
var model = this;
var success = options.success;
var attributes = this.attributes;
options.success = function(resp) {
// Ensure attributes are restored during synchronous saves.
model.attributes = attributes;
var serverAttrs = options.parse ? model.parse(resp, options) : resp;
if (wait) serverAttrs = _.extend({}, attrs, serverAttrs);
if (serverAttrs && !model.set(serverAttrs, options)) return false;
if (success) success.call(options.context, model, resp, options);
model.trigger('sync', model, resp, options);
};
wrapError(this, options);
// Set temporary attributes if `{wait: true}` to properly find new ids.
if (attrs && wait) this.attributes = _.extend({}, attributes, attrs);
var method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
if (method === 'patch' && !options.attrs) options.attrs = attrs;
var xhr = this.sync(method, this, options);
// Restore attributes.
this.attributes = attributes;
return xhr;
},
// Destroy this model on the server if it was already persisted.
// Optimistically removes the model from its collection, if it has one.
// If `wait: true` is passed, waits for the server to respond before removal.
destroy: function(options) {
options = options ? _.clone(options) : {};
var model = this;
var success = options.success;
var wait = options.wait;
var destroy = function() {
model.stopListening();
model.trigger('destroy', model, model.collection, options);
};
options.success = function(resp) {
if (wait) destroy();
if (success) success.call(options.context, model, resp, options);
if (!model.isNew()) model.trigger('sync', model, resp, options);
};
var xhr = false;
if (this.isNew()) {
_.defer(options.success);
} else {
wrapError(this, options);
xhr = this.sync('delete', this, options);
}
if (!wait) destroy();
return xhr;
},
// Default URL for the model's representation on the server -- if you're
// using Backbone's restful methods, override this to change the endpoint
// that will be called.
url: function() {
var base =
_.result(this, 'urlRoot') ||
_.result(this.collection, 'url') ||
urlError();
if (this.isNew()) return base;
var id = this.get(this.idAttribute);
return base.replace(/[^\/]$/, '$&/') + encodeURIComponent(id);
},
// **parse** converts a response into the hash of attributes to be `set` on
// the model. The default implementation is just to pass the response along.
parse: function(resp, options) {
return resp;
},
// Create a new model with identical attributes to this one.
clone: function() {
return new this.constructor(this.attributes);
},
// A model is new if it has never been saved to the server, and lacks an id.
isNew: function() {
return !this.has(this.idAttribute);
},
// Check if the model is currently in a valid state.
isValid: function(options) {
return this._validate({}, _.extend({}, options, {validate: true}));
},
// Run validation against the next complete set of model attributes,
// returning `true` if all is well. Otherwise, fire an `"invalid"` event.
_validate: function(attrs, options) {
if (!options.validate || !this.validate) return true;
attrs = _.extend({}, this.attributes, attrs);
var error = this.validationError = this.validate(attrs, options) || null;
if (!error) return true;
this.trigger('invalid', this, error, _.extend(options, {validationError: error}));
return false;
}
});
// Underscore methods that we want to implement on the Model, mapped to the
// number of arguments they take.
var modelMethods = {keys: 1, values: 1, pairs: 1, invert: 1, pick: 0,
omit: 0, chain: 1, isEmpty: 1};
// Mix in each Underscore method as a proxy to `Model#attributes`.
addUnderscoreMethods(Model, modelMethods, 'attributes');
// Backbone.Collection
// -------------------
// If models tend to represent a single row of data, a Backbone Collection is
// more analogous to a table full of data ... or a small slice or page of that
// table, or a collection of rows that belong together for a particular reason
// -- all of the messages in this particular folder, all of the documents
// belonging to this particular author, and so on. Collections maintain
// indexes of their models, both in order, and for lookup by `id`.
// Create a new **Collection**, perhaps to contain a specific type of `model`.
// If a `comparator` is specified, the Collection will maintain
// its models in sort order, as they're added and removed.
var Collection = Backbone.Collection = function(models, options) {
options || (options = {});
if (options.model) this.model = options.model;
if (options.comparator !== void 0) this.comparator = options.comparator;
this._reset();
this.initialize.apply(this, arguments);
if (models) this.reset(models, _.extend({silent: true}, options));
};
// Default options for `Collection#set`.
var setOptions = {add: true, remove: true, merge: true};
var addOptions = {add: true, remove: false};
// Splices `insert` into `array` at index `at`.
var splice = function(array, insert, at) {
at = Math.min(Math.max(at, 0), array.length);
var tail = Array(array.length - at);
var length = insert.length;
var i;
for (i = 0; i < tail.length; i++) tail[i] = array[i + at];
for (i = 0; i < length; i++) array[i + at] = insert[i];
for (i = 0; i < tail.length; i++) array[i + length + at] = tail[i];
};
// Define the Collection's inheritable methods.
_.extend(Collection.prototype, Events, {
// The default model for a collection is just a **Backbone.Model**.
// This should be overridden in most cases.
model: Model,
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// The JSON representation of a Collection is an array of the
// models' attributes.
toJSON: function(options) {
return this.map(function(model) { return model.toJSON(options); });
},
// Proxy `Backbone.sync` by default.
sync: function() {
return Backbone.sync.apply(this, arguments);
},
// Add a model, or list of models to the set. `models` may be Backbone
// Models or raw JavaScript objects to be converted to Models, or any
// combination of the two.
add: function(models, options) {
return this.set(models, _.extend({merge: false}, options, addOptions));
},
// Remove a model, or a list of models from the set.
remove: function(models, options) {
options = _.extend({}, options);
var singular = !_.isArray(models);
models = singular ? [models] : models.slice();
var removed = this._removeModels(models, options);
if (!options.silent && removed.length) {
options.changes = {added: [], merged: [], removed: removed};
this.trigger('update', this, options);
}
return singular ? removed[0] : removed;
},
// Update a collection by `set`-ing a new list of models, adding new ones,
// removing models that are no longer present, and merging models that
// already exist in the collection, as necessary. Similar to **Model#set**,
// the core operation for updating the data contained by the collection.
set: function(models, options) {
if (models == null) return;
options = _.extend({}, setOptions, options);
if (options.parse && !this._isModel(models)) {
models = this.parse(models, options) || [];
}
var singular = !_.isArray(models);
models = singular ? [models] : models.slice();
var at = options.at;
if (at != null) at = +at;
if (at > this.length) at = this.length;
if (at < 0) at += this.length + 1;
var set = [];
var toAdd = [];
var toMerge = [];
var toRemove = [];
var modelMap = {};
var add = options.add;
var merge = options.merge;
var remove = options.remove;
var sort = false;
var sortable = this.comparator && at == null && options.sort !== false;
var sortAttr = _.isString(this.comparator) ? this.comparator : null;
// Turn bare objects into model references, and prevent invalid models
// from being added.
var model, i;
for (i = 0; i < models.length; i++) {
model = models[i];
// If a duplicate is found, prevent it from being added and
// optionally merge it into the existing model.
var existing = this.get(model);
if (existing) {
if (merge && model !== existing) {
var attrs = this._isModel(model) ? model.attributes : model;
if (options.parse) attrs = existing.parse(attrs, options);
existing.set(attrs, options);
toMerge.push(existing);
if (sortable && !sort) sort = existing.hasChanged(sortAttr);
}
if (!modelMap[existing.cid]) {
modelMap[existing.cid] = true;
set.push(existing);
}
models[i] = existing;
// If this is a new, valid model, push it to the `toAdd` list.
} else if (add) {
model = models[i] = this._prepareModel(model, options);
if (model) {
toAdd.push(model);
this._addReference(model, options);
modelMap[model.cid] = true;
set.push(model);
}
}
}
// Remove stale models.
if (remove) {
for (i = 0; i < this.length; i++) {
model = this.models[i];
if (!modelMap[model.cid]) toRemove.push(model);
}
if (toRemove.length) this._removeModels(toRemove, options);
}
// See if sorting is needed, update `length` and splice in new models.
var orderChanged = false;
var replace = !sortable && add && remove;
if (set.length && replace) {
orderChanged = this.length !== set.length || _.some(this.models, function(m, index) {
return m !== set[index];
});
this.models.length = 0;
splice(this.models, set, 0);
this.length = this.models.length;
} else if (toAdd.length) {
if (sortable) sort = true;
splice(this.models, toAdd, at == null ? this.length : at);
this.length = this.models.length;
}
// Silently sort the collection if appropriate.
if (sort) this.sort({silent: true});
// Unless silenced, it's time to fire all appropriate add/sort/update events.
if (!options.silent) {
for (i = 0; i < toAdd.length; i++) {
if (at != null) options.index = at + i;
model = toAdd[i];
model.trigger('add', model, this, options);
}
if (sort || orderChanged) this.trigger('sort', this, options);
if (toAdd.length || toRemove.length || toMerge.length) {
options.changes = {
added: toAdd,
removed: toRemove,
merged: toMerge
};
this.trigger('update', this, options);
}
}
// Return the added (or merged) model (or models).
return singular ? models[0] : models;
},
// When you have more items than you want to add or remove individually,
// you can reset the entire set with a new list of models, without firing
// any granular `add` or `remove` events. Fires `reset` when finished.
// Useful for bulk operations and optimizations.
reset: function(models, options) {
options = options ? _.clone(options) : {};
for (var i = 0; i < this.models.length; i++) {
this._removeReference(this.models[i], options);
}
options.previousModels = this.models;
this._reset();
models = this.add(models, _.extend({silent: true}, options));
if (!options.silent) this.trigger('reset', this, options);
return models;
},
// Add a model to the end of the collection.
push: function(model, options) {
return this.add(model, _.extend({at: this.length}, options));
},
// Remove a model from the end of the collection.
pop: function(options) {
var model = this.at(this.length - 1);
return this.remove(model, options);
},
// Add a model to the beginning of the collection.
unshift: function(model, options) {
return this.add(model, _.extend({at: 0}, options));
},
// Remove a model from the beginning of the collection.
shift: function(options) {
var model = this.at(0);
return this.remove(model, options);
},
// Slice out a sub-array of models from the collection.
slice: function() {
return slice.apply(this.models, arguments);
},
// Get a model from the set by id, cid, model object with id or cid
// properties, or an attributes object that is transformed through modelId.
get: function(obj) {
if (obj == null) return void 0;
return this._byId[obj] ||
this._byId[this.modelId(obj.attributes || obj)] ||
obj.cid && this._byId[obj.cid];
},
// Returns `true` if the model is in the collection.
has: function(obj) {
return this.get(obj) != null;
},
// Get the model at the given index.
at: function(index) {
if (index < 0) index += this.length;
return this.models[index];
},
// Return models with matching attributes. Useful for simple cases of
// `filter`.
where: function(attrs, first) {
return this[first ? 'find' : 'filter'](attrs);
},
// Return the first model with matching attributes. Useful for simple cases
// of `find`.
findWhere: function(attrs) {
return this.where(attrs, true);
},
// Force the collection to re-sort itself. You don't need to call this under
// normal circumstances, as the set will maintain sort order as each item
// is added.
sort: function(options) {
var comparator = this.comparator;
if (!comparator) throw new Error('Cannot sort a set without a comparator');
options || (options = {});
var length = comparator.length;
if (_.isFunction(comparator)) comparator = _.bind(comparator, this);
// Run sort based on type of `comparator`.
if (length === 1 || _.isString(comparator)) {
this.models = this.sortBy(comparator);
} else {
this.models.sort(comparator);
}
if (!options.silent) this.trigger('sort', this, options);
return this;
},
// Pluck an attribute from each model in the collection.
pluck: function(attr) {
return this.map(attr + '');
},
// Fetch the default set of models for this collection, resetting the
// collection when they arrive. If `reset: true` is passed, the response
// data will be passed through the `reset` method instead of `set`.
fetch: function(options) {
options = _.extend({parse: true}, options);
var success = options.success;
var collection = this;
options.success = function(resp) {
var method = options.reset ? 'reset' : 'set';
collection[method](resp, options);
if (success) success.call(options.context, collection, resp, options);
collection.trigger('sync', collection, resp, options);
};
wrapError(this, options);
return this.sync('read', this, options);
},
// Create a new instance of a model in this collection. Add the model to the
// collection immediately, unless `wait: true` is passed, in which case we
// wait for the server to agree.
create: function(model, options) {
options = options ? _.clone(options) : {};
var wait = options.wait;
model = this._prepareModel(model, options);
if (!model) return false;
if (!wait) this.add(model, options);
var collection = this;
var success = options.success;
options.success = function(m, resp, callbackOpts) {
if (wait) collection.add(m, callbackOpts);
if (success) success.call(callbackOpts.context, m, resp, callbackOpts);
};
model.save(null, options);
return model;
},
// **parse** converts a response into a list of models to be added to the
// collection. The default implementation is just to pass it through.
parse: function(resp, options) {
return resp;
},
// Create a new collection with an identical list of models as this one.
clone: function() {
return new this.constructor(this.models, {
model: this.model,
comparator: this.comparator
});
},
// Define how to uniquely identify models in the collection.
modelId: function(attrs) {
return attrs[this.model.prototype.idAttribute || 'id'];
},
// Private method to reset all internal state. Called when the collection
// is first initialized or reset.
_reset: function() {
this.length = 0;
this.models = [];
this._byId = {};
},
// Prepare a hash of attributes (or other model) to be added to this
// collection.
_prepareModel: function(attrs, options) {
if (this._isModel(attrs)) {
if (!attrs.collection) attrs.collection = this;
return attrs;
}
options = options ? _.clone(options) : {};
options.collection = this;
var model = new this.model(attrs, options);
if (!model.validationError) return model;
this.trigger('invalid', this, model.validationError, options);
return false;
},
// Internal method called by both remove and set.
_removeModels: function(models, options) {
var removed = [];
for (var i = 0; i < models.length; i++) {
var model = this.get(models[i]);
if (!model) continue;
var index = this.indexOf(model);
this.models.splice(index, 1);
this.length--;
// Remove references before triggering 'remove' event to prevent an
// infinite loop. #3693
delete this._byId[model.cid];
var id = this.modelId(model.attributes);
if (id != null) delete this._byId[id];
if (!options.silent) {
options.index = index;
model.trigger('remove', model, this, options);
}
removed.push(model);
this._removeReference(model, options);
}
return removed;
},
// Method for checking whether an object should be considered a model for
// the purposes of adding to the collection.
_isModel: function(model) {
return model instanceof Model;
},
// Internal method to create a model's ties to a collection.
_addReference: function(model, options) {
this._byId[model.cid] = model;
var id = this.modelId(model.attributes);
if (id != null) this._byId[id] = model;
model.on('all', this._onModelEvent, this);
},
// Internal method to sever a model's ties to a collection.
_removeReference: function(model, options) {
delete this._byId[model.cid];
var id = this.modelId(model.attributes);
if (id != null) delete this._byId[id];
if (this === model.collection) delete model.collection;
model.off('all', this._onModelEvent, this);
},
// Internal method called every time a model in the set fires an event.
// Sets need to update their indexes when models change ids. All other
// events simply proxy through. "add" and "remove" events that originate
// in other collections are ignored.
_onModelEvent: function(event, model, collection, options) {
if (model) {
if ((event === 'add' || event === 'remove') && collection !== this) return;
if (event === 'destroy') this.remove(model, options);
if (event === 'change') {
var prevId = this.modelId(model.previousAttributes());
var id = this.modelId(model.attributes);
if (prevId !== id) {
if (prevId != null) delete this._byId[prevId];
if (id != null) this._byId[id] = model;
}
}
}
this.trigger.apply(this, arguments);
}
});
// Underscore methods that we want to implement on the Collection.
// 90% of the core usefulness of Backbone Collections is actually implemented
// right here:
var collectionMethods = {forEach: 3, each: 3, map: 3, collect: 3, reduce: 0,
foldl: 0, inject: 0, reduceRight: 0, foldr: 0, find: 3, detect: 3, filter: 3,
select: 3, reject: 3, every: 3, all: 3, some: 3, any: 3, include: 3, includes: 3,
contains: 3, invoke: 0, max: 3, min: 3, toArray: 1, size: 1, first: 3,
head: 3, take: 3, initial: 3, rest: 3, tail: 3, drop: 3, last: 3,
without: 0, difference: 0, indexOf: 3, shuffle: 1, lastIndexOf: 3,
isEmpty: 1, chain: 1, sample: 3, partition: 3, groupBy: 3, countBy: 3,
sortBy: 3, indexBy: 3, findIndex: 3, findLastIndex: 3};
// Mix in each Underscore method as a proxy to `Collection#models`.
addUnderscoreMethods(Collection, collectionMethods, 'models');
// Backbone.View
// -------------
// Backbone Views are almost more convention than they are actual code. A View
// is simply a JavaScript object that represents a logical chunk of UI in the
// DOM. This might be a single item, an entire list, a sidebar or panel, or
// even the surrounding frame which wraps your whole app. Defining a chunk of
// UI as a **View** allows you to define your DOM events declaratively, without
// having to worry about render order ... and makes it easy for the view to
// react to specific changes in the state of your models.
// Creating a Backbone.View creates its initial element outside of the DOM,
// if an existing element is not provided...
var View = Backbone.View = function(options) {
this.cid = _.uniqueId('view');
_.extend(this, _.pick(options, viewOptions));
this._ensureElement();
this.initialize.apply(this, arguments);
};
// Cached regex to split keys for `delegate`.
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
// List of view options to be set as properties.
var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
// Set up all inheritable **Backbone.View** properties and methods.
_.extend(View.prototype, Events, {
// The default `tagName` of a View's element is `"div"`.
tagName: 'div',
// jQuery delegate for element lookup, scoped to DOM elements within the
// current view. This should be preferred to global lookups where possible.
$: function(selector) {
return this.$el.find(selector);
},
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// **render** is the core function that your view should override, in order
// to populate its element (`this.el`), with the appropriate HTML. The
// convention is for **render** to always return `this`.
render: function() {
return this;
},
// Remove this view by taking the element out of the DOM, and removing any
// applicable Backbone.Events listeners.
remove: function() {
this._removeElement();
this.stopListening();
return this;
},
// Remove this view's element from the document and all event listeners
// attached to it. Exposed for subclasses using an alternative DOM
// manipulation API.
_removeElement: function() {
this.$el.remove();
},
// Change the view's element (`this.el` property) and re-delegate the
// view's events on the new element.
setElement: function(element) {
this.undelegateEvents();
this._setElement(element);
this.delegateEvents();
return this;
},
// Creates the `this.el` and `this.$el` references for this view using the
// given `el`. `el` can be a CSS selector or an HTML string, a jQuery
// context or an element. Subclasses can override this to utilize an
// alternative DOM manipulation API and are only required to set the
// `this.el` property.
_setElement: function(el) {
this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);
this.el = this.$el[0];
},
// Set callbacks, where `this.events` is a hash of
//
// *{"event selector": "callback"}*
//
// {
// 'mousedown .title': 'edit',
// 'click .button': 'save',
// 'click .open': function(e) { ... }
// }
//
// pairs. Callbacks will be bound to the view, with `this` set properly.
// Uses event delegation for efficiency.
// Omitting the selector binds the event to `this.el`.
delegateEvents: function(events) {
events || (events = _.result(this, 'events'));
if (!events) return this;
this.undelegateEvents();
for (var key in events) {
var method = events[key];
if (!_.isFunction(method)) method = this[method];
if (!method) continue;
var match = key.match(delegateEventSplitter);
this.delegate(match[1], match[2], _.bind(method, this));
}
return this;
},
// Add a single event listener to the view's element (or a child element
// using `selector`). This only works for delegate-able events: not `focus`,
// `blur`, and not `change`, `submit`, and `reset` in Internet Explorer.
delegate: function(eventName, selector, listener) {
this.$el.on(eventName + '.delegateEvents' + this.cid, selector, listener);
return this;
},
// Clears all callbacks previously bound to the view by `delegateEvents`.
// You usually don't need to use this, but may wish to if you have multiple
// Backbone views attached to the same DOM element.
undelegateEvents: function() {
if (this.$el) this.$el.off('.delegateEvents' + this.cid);
return this;
},
// A finer-grained `undelegateEvents` for removing a single delegated event.
// `selector` and `listener` are both optional.
undelegate: function(eventName, selector, listener) {
this.$el.off(eventName + '.delegateEvents' + this.cid, selector, listener);
return this;
},
// Produces a DOM element to be assigned to your view. Exposed for
// subclasses using an alternative DOM manipulation API.
_createElement: function(tagName) {
return document.createElement(tagName);
},
// Ensure that the View has a DOM element to render into.
// If `this.el` is a string, pass it through `$()`, take the first
// matching element, and re-assign it to `el`. Otherwise, create
// an element from the `id`, `className` and `tagName` properties.
_ensureElement: function() {
if (!this.el) {
var attrs = _.extend({}, _.result(this, 'attributes'));
if (this.id) attrs.id = _.result(this, 'id');
if (this.className) attrs['class'] = _.result(this, 'className');
this.setElement(this._createElement(_.result(this, 'tagName')));
this._setAttributes(attrs);
} else {
this.setElement(_.result(this, 'el'));
}
},
// Set attributes from a hash on this view's element. Exposed for
// subclasses using an alternative DOM manipulation API.
_setAttributes: function(attributes) {
this.$el.attr(attributes);
}
});
// Backbone.sync
// -------------
// Override this function to change the manner in which Backbone persists
// models to the server. You will be passed the type of request, and the
// model in question. By default, makes a RESTful Ajax request
// to the model's `url()`. Some possible customizations could be:
//
// * Use `setTimeout` to batch rapid-fire updates into a single request.
// * Send up the models as XML instead of JSON.
// * Persist models via WebSockets instead of Ajax.
//
// Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests
// as `POST`, with a `_method` parameter containing the true HTTP method,
// as well as all requests with the body as `application/x-www-form-urlencoded`
// instead of `application/json` with the model in a param named `model`.
// Useful when interfacing with server-side languages like **PHP** that make
// it difficult to read the body of `PUT` requests.
Backbone.sync = function(method, model, options) {
var type = methodMap[method];
// Default options, unless specified.
_.defaults(options || (options = {}), {
emulateHTTP: Backbone.emulateHTTP,
emulateJSON: Backbone.emulateJSON
});
// Default JSON-request options.
var params = {type: type, dataType: 'json'};
// Ensure that we have a URL.
if (!options.url) {
params.url = _.result(model, 'url') || urlError();
}
// Ensure that we have the appropriate request data.
if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
params.contentType = 'application/json';
params.data = JSON.stringify(options.attrs || model.toJSON(options));
}
// For older servers, emulate JSON by encoding the request into an HTML-form.
if (options.emulateJSON) {
params.contentType = 'application/x-www-form-urlencoded';
params.data = params.data ? {model: params.data} : {};
}
// For older servers, emulate HTTP by mimicking the HTTP method with `_method`
// And an `X-HTTP-Method-Override` header.
if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) {
params.type = 'POST';
if (options.emulateJSON) params.data._method = type;
var beforeSend = options.beforeSend;
options.beforeSend = function(xhr) {
xhr.setRequestHeader('X-HTTP-Method-Override', type);
if (beforeSend) return beforeSend.apply(this, arguments);
};
}
// Don't process data on a non-GET request.
if (params.type !== 'GET' && !options.emulateJSON) {
params.processData = false;
}
// Pass along `textStatus` and `errorThrown` from jQuery.
var error = options.error;
options.error = function(xhr, textStatus, errorThrown) {
options.textStatus = textStatus;
options.errorThrown = errorThrown;
if (error) error.call(options.context, xhr, textStatus, errorThrown);
};
// Make the request, allowing the user to override any Ajax options.
var xhr = options.xhr = Backbone.ajax(_.extend(params, options));
model.trigger('request', model, xhr, options);
return xhr;
};
// Map from CRUD to HTTP for our default `Backbone.sync` implementation.
var methodMap = {
'create': 'POST',
'update': 'PUT',
'patch': 'PATCH',
'delete': 'DELETE',
'read': 'GET'
};
// Set the default implementation of `Backbone.ajax` to proxy through to `$`.
// Override this if you'd like to use a different library.
Backbone.ajax = function() {
return Backbone.$.ajax.apply(Backbone.$, arguments);
};
// Backbone.Router
// ---------------
// Routers map faux-URLs to actions, and fire events when routes are
// matched. Creating a new one sets its `routes` hash, if not set statically.
var Router = Backbone.Router = function(options) {
options || (options = {});
if (options.routes) this.routes = options.routes;
this._bindRoutes();
this.initialize.apply(this, arguments);
};
// Cached regular expressions for matching named param parts and splatted
// parts of route strings.
var optionalParam = /\((.*?)\)/g;
var namedParam = /(\(\?)?:\w+/g;
var splatParam = /\*\w+/g;
var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g;
// Set up all inheritable **Backbone.Router** properties and methods.
_.extend(Router.prototype, Events, {
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// Manually bind a single named route to a callback. For example:
//
// this.route('search/:query/p:num', 'search', function(query, num) {
// ...
// });
//
route: function(route, name, callback) {
if (!_.isRegExp(route)) route = this._routeToRegExp(route);
if (_.isFunction(name)) {
callback = name;
name = '';
}
if (!callback) callback = this[name];
var router = this;
Backbone.history.route(route, function(fragment) {
var args = router._extractParameters(route, fragment);
if (router.execute(callback, args, name) !== false) {
router.trigger.apply(router, ['route:' + name].concat(args));
router.trigger('route', name, args);
Backbone.history.trigger('route', router, name, args);
}
});
return this;
},
// Execute a route handler with the provided parameters. This is an
// excellent place to do pre-route setup or post-route cleanup.
execute: function(callback, args, name) {
if (callback) callback.apply(this, args);
},
// Simple proxy to `Backbone.history` to save a fragment into the history.
navigate: function(fragment, options) {
Backbone.history.navigate(fragment, options);
return this;
},
// Bind all defined routes to `Backbone.history`. We have to reverse the
// order of the routes here to support behavior where the most general
// routes can be defined at the bottom of the route map.
_bindRoutes: function() {
if (!this.routes) return;
this.routes = _.result(this, 'routes');
var route, routes = _.keys(this.routes);
while ((route = routes.pop()) != null) {
this.route(route, this.routes[route]);
}
},
// Convert a route string into a regular expression, suitable for matching
// against the current location hash.
_routeToRegExp: function(route) {
route = route.replace(escapeRegExp, '\\$&')
.replace(optionalParam, '(?:$1)?')
.replace(namedParam, function(match, optional) {
return optional ? match : '([^/?]+)';
})
.replace(splatParam, '([^?]*?)');
return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$');
},
// Given a route, and a URL fragment that it matches, return the array of
// extracted decoded parameters. Empty or unmatched parameters will be
// treated as `null` to normalize cross-browser behavior.
_extractParameters: function(route, fragment) {
var params = route.exec(fragment).slice(1);
return _.map(params, function(param, i) {
// Don't decode the search params.
if (i === params.length - 1) return param || null;
return param ? decodeURIComponent(param) : null;
});
}
});
// Backbone.History
// ----------------
// Handles cross-browser history management, based on either
// [pushState](http://diveintohtml5.info/history.html) and real URLs, or
// [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange)
// and URL fragments. If the browser supports neither (old IE, natch),
// falls back to polling.
var History = Backbone.History = function() {
this.handlers = [];
this.checkUrl = _.bind(this.checkUrl, this);
// Ensure that `History` can be used outside of the browser.
if (typeof window !== 'undefined') {
this.location = window.location;
this.history = window.history;
}
};
// Cached regex for stripping a leading hash/slash and trailing space.
var routeStripper = /^[#\/]|\s+$/g;
// Cached regex for stripping leading and trailing slashes.
var rootStripper = /^\/+|\/+$/g;
// Cached regex for stripping urls of hash.
var pathStripper = /#.*$/;
// Has the history handling already been started?
History.started = false;
// Set up all inheritable **Backbone.History** properties and methods.
_.extend(History.prototype, Events, {
// The default interval to poll for hash changes, if necessary, is
// twenty times a second.
interval: 50,
// Are we at the app root?
atRoot: function() {
var path = this.location.pathname.replace(/[^\/]$/, '$&/');
return path === this.root && !this.getSearch();
},
// Does the pathname match the root?
matchRoot: function() {
var path = this.decodeFragment(this.location.pathname);
var rootPath = path.slice(0, this.root.length - 1) + '/';
return rootPath === this.root;
},
// Unicode characters in `location.pathname` are percent encoded so they're
// decoded for comparison. `%25` should not be decoded since it may be part
// of an encoded parameter.
decodeFragment: function(fragment) {
return decodeURI(fragment.replace(/%25/g, '%2525'));
},
// In IE6, the hash fragment and search params are incorrect if the
// fragment contains `?`.
getSearch: function() {
var match = this.location.href.replace(/#.*/, '').match(/\?.+/);
return match ? match[0] : '';
},
// Gets the true hash value. Cannot use location.hash directly due to bug
// in Firefox where location.hash will always be decoded.
getHash: function(window) {
var match = (window || this).location.href.match(/#(.*)$/);
return match ? match[1] : '';
},
// Get the pathname and search params, without the root.
getPath: function() {
var path = this.decodeFragment(
this.location.pathname + this.getSearch()
).slice(this.root.length - 1);
return path.charAt(0) === '/' ? path.slice(1) : path;
},
// Get the cross-browser normalized URL fragment from the path or hash.
getFragment: function(fragment) {
if (fragment == null) {
if (this._usePushState || !this._wantsHashChange) {
fragment = this.getPath();
} else {
fragment = this.getHash();
}
}
return fragment.replace(routeStripper, '');
},
// Start the hash change handling, returning `true` if the current URL matches
// an existing route, and `false` otherwise.
start: function(options) {
if (History.started) throw new Error('Backbone.history has already been started');
History.started = true;
// Figure out the initial configuration. Do we need an iframe?
// Is pushState desired ... is it available?
this.options = _.extend({root: '/'}, this.options, options);
this.root = this.options.root;
this._wantsHashChange = this.options.hashChange !== false;
this._hasHashChange = 'onhashchange' in window && (document.documentMode === void 0 || document.documentMode > 7);
this._useHashChange = this._wantsHashChange && this._hasHashChange;
this._wantsPushState = !!this.options.pushState;
this._hasPushState = !!(this.history && this.history.pushState);
this._usePushState = this._wantsPushState && this._hasPushState;
this.fragment = this.getFragment();
// Normalize root to always include a leading and trailing slash.
this.root = ('/' + this.root + '/').replace(rootStripper, '/');
// Transition from hashChange to pushState or vice versa if both are
// requested.
if (this._wantsHashChange && this._wantsPushState) {
// If we've started off with a route from a `pushState`-enabled
// browser, but we're currently in a browser that doesn't support it...
if (!this._hasPushState && !this.atRoot()) {
var rootPath = this.root.slice(0, -1) || '/';
this.location.replace(rootPath + '#' + this.getPath());
// Return immediately as browser will do redirect to new url
return true;
// Or if we've started out with a hash-based route, but we're currently
// in a browser where it could be `pushState`-based instead...
} else if (this._hasPushState && this.atRoot()) {
this.navigate(this.getHash(), {replace: true});
}
}
// Proxy an iframe to handle location events if the browser doesn't
// support the `hashchange` event, HTML5 history, or the user wants
// `hashChange` but not `pushState`.
if (!this._hasHashChange && this._wantsHashChange && !this._usePushState) {
this.iframe = document.createElement('iframe');
this.iframe.src = 'javascript:0';
this.iframe.style.display = 'none';
this.iframe.tabIndex = -1;
var body = document.body;
// Using `appendChild` will throw on IE < 9 if the document is not ready.
var iWindow = body.insertBefore(this.iframe, body.firstChild).contentWindow;
iWindow.document.open();
iWindow.document.close();
iWindow.location.hash = '#' + this.fragment;
}
// Add a cross-platform `addEventListener` shim for older browsers.
var addEventListener = window.addEventListener || function(eventName, listener) {
return attachEvent('on' + eventName, listener);
};
// Depending on whether we're using pushState or hashes, and whether
// 'onhashchange' is supported, determine how we check the URL state.
if (this._usePushState) {
addEventListener('popstate', this.checkUrl, false);
} else if (this._useHashChange && !this.iframe) {
addEventListener('hashchange', this.checkUrl, false);
} else if (this._wantsHashChange) {
this._checkUrlInterval = setInterval(this.checkUrl, this.interval);
}
if (!this.options.silent) return this.loadUrl();
},
// Disable Backbone.history, perhaps temporarily. Not useful in a real app,
// but possibly useful for unit testing Routers.
stop: function() {
// Add a cross-platform `removeEventListener` shim for older browsers.
var removeEventListener = window.removeEventListener || function(eventName, listener) {
return detachEvent('on' + eventName, listener);
};
// Remove window listeners.
if (this._usePushState) {
removeEventListener('popstate', this.checkUrl, false);
} else if (this._useHashChange && !this.iframe) {
removeEventListener('hashchange', this.checkUrl, false);
}
// Clean up the iframe if necessary.
if (this.iframe) {
document.body.removeChild(this.iframe);
this.iframe = null;
}
// Some environments will throw when clearing an undefined interval.
if (this._checkUrlInterval) clearInterval(this._checkUrlInterval);
History.started = false;
},
// Add a route to be tested when the fragment changes. Routes added later
// may override previous routes.
route: function(route, callback) {
this.handlers.unshift({route: route, callback: callback});
},
// Checks the current URL to see if it has changed, and if it has,
// calls `loadUrl`, normalizing across the hidden iframe.
checkUrl: function(e) {
var current = this.getFragment();
// If the user pressed the back button, the iframe's hash will have
// changed and we should use that for comparison.
if (current === this.fragment && this.iframe) {
current = this.getHash(this.iframe.contentWindow);
}
if (current === this.fragment) return false;
if (this.iframe) this.navigate(current);
this.loadUrl();
},
// Attempt to load the current URL fragment. If a route succeeds with a
// match, returns `true`. If no defined routes matches the fragment,
// returns `false`.
loadUrl: function(fragment) {
// If the root doesn't match, no routes can match either.
if (!this.matchRoot()) return false;
fragment = this.fragment = this.getFragment(fragment);
return _.some(this.handlers, function(handler) {
if (handler.route.test(fragment)) {
handler.callback(fragment);
return true;
}
});
},
// Save a fragment into the hash history, or replace the URL state if the
// 'replace' option is passed. You are responsible for properly URL-encoding
// the fragment in advance.
//
// The options object can contain `trigger: true` if you wish to have the
// route callback be fired (not usually desirable), or `replace: true`, if
// you wish to modify the current URL without adding an entry to the history.
navigate: function(fragment, options) {
if (!History.started) return false;
if (!options || options === true) options = {trigger: !!options};
// Normalize the fragment.
fragment = this.getFragment(fragment || '');
// Don't include a trailing slash on the root.
var rootPath = this.root;
if (fragment === '' || fragment.charAt(0) === '?') {
rootPath = rootPath.slice(0, -1) || '/';
}
var url = rootPath + fragment;
// Strip the hash and decode for matching.
fragment = this.decodeFragment(fragment.replace(pathStripper, ''));
if (this.fragment === fragment) return;
this.fragment = fragment;
// If pushState is available, we use it to set the fragment as a real URL.
if (this._usePushState) {
this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);
// If hash changes haven't been explicitly disabled, update the hash
// fragment to store history.
} else if (this._wantsHashChange) {
this._updateHash(this.location, fragment, options.replace);
if (this.iframe && fragment !== this.getHash(this.iframe.contentWindow)) {
var iWindow = this.iframe.contentWindow;
// Opening and closing the iframe tricks IE7 and earlier to push a
// history entry on hash-tag change. When replace is true, we don't
// want this.
if (!options.replace) {
iWindow.document.open();
iWindow.document.close();
}
this._updateHash(iWindow.location, fragment, options.replace);
}
// If you've told us that you explicitly don't want fallback hashchange-
// based history, then `navigate` becomes a page refresh.
} else {
return this.location.assign(url);
}
if (options.trigger) return this.loadUrl(fragment);
},
// Update the hash location, either replacing the current entry, or adding
// a new one to the browser history.
_updateHash: function(location, fragment, replace) {
if (replace) {
var href = location.href.replace(/(javascript:|#).*$/, '');
location.replace(href + '#' + fragment);
} else {
// Some browsers require that `hash` contains a leading #.
location.hash = '#' + fragment;
}
}
});
// Create the default Backbone.history.
Backbone.history = new History;
// Helpers
// -------
// Helper function to correctly set up the prototype chain for subclasses.
// Similar to `goog.inherits`, but uses a hash of prototype properties and
// class properties to be extended.
var extend = function(protoProps, staticProps) {
var parent = this;
var child;
// The constructor function for the new subclass is either defined by you
// (the "constructor" property in your `extend` definition), or defaulted
// by us to simply call the parent constructor.
if (protoProps && _.has(protoProps, 'constructor')) {
child = protoProps.constructor;
} else {
child = function(){ return parent.apply(this, arguments); };
}
// Add static properties to the constructor function, if supplied.
_.extend(child, parent, staticProps);
// Set the prototype chain to inherit from `parent`, without calling
// `parent`'s constructor function and add the prototype properties.
child.prototype = _.create(parent.prototype, protoProps);
child.prototype.constructor = child;
// Set a convenience property in case the parent's prototype is needed
// later.
child.__super__ = parent.prototype;
return child;
};
// Set up inheritance for the model, collection, router, view and history.
Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend;
// Throw an error when a URL is needed, and none is supplied.
var urlError = function() {
throw new Error('A "url" property or function must be specified');
};
// Wrap an optional error callback with a fallback error event.
var wrapError = function(model, options) {
var error = options.error;
options.error = function(resp) {
if (error) error.call(options.context, model, resp, options);
model.trigger('error', model, resp, options);
};
};
return Backbone;
});
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/*
This file contains substantial portions of https://github.com/akre54/Backbone.NativeView/blob/521188d9554b53d95d70ed34f878d8ac9fc10df2/backbone.nativeview.js, which has the following license:
(c) 2015 Adam Krebs, Jimmy Yuen Ho Wong
Backbone.NativeView may be freely distributed under the MIT license.
Copyright (c) 2014 Adam Krebs
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.
*/
var Backbone = __webpack_require__(3);
// Caches a local reference to `Element.prototype` for faster access.
var ElementProto = Element.prototype; //: typeof Element = (typeof Element !== 'undefined' && Element.prototype) || {};
// Find the right `Element#matches` for IE>=9 and modern browsers.
var matchesSelector = ElementProto.matches ||
ElementProto['webkitMatchesSelector'] ||
ElementProto['mozMatchesSelector'] ||
ElementProto['msMatchesSelector'] ||
ElementProto['oMatchesSelector'] ||
function matches(selector) {
var matches = (this.document || this.ownerDocument).querySelectorAll(selector), i = matches.length;
while (--i >= 0 && matches.item(i) !== this) { }
return i > -1;
};
var NativeView = (function (_super) {
__extends(NativeView, _super);
function NativeView() {
return _super !== null && _super.apply(this, arguments) || this;
}
NativeView.prototype._removeElement = function () {
this.undelegateEvents();
if (this.el.parentNode) {
this.el.parentNode.removeChild(this.el);
}
};
// Apply the `element` to the view.
NativeView.prototype._setElement = function (element) {
this.el = element;
};
// Set a hash of attributes to the view's `el`. We use the "prop" version
// if available, falling back to `setAttribute` for the catch-all.
NativeView.prototype._setAttributes = function (attrs) {
for (var attr in attrs) {
attr in this.el ? this.el[attr] = attrs[attr] : this.el.setAttribute(attr, attrs[attr]);
}
};
/**
* Make an event delegation handler for the given `eventName` and `selector`
* and attach it to `this.el`.
* If selector is empty, the listener will be bound to `this.el`. If not, a
* new handler that will recursively traverse up the event target's DOM
* hierarchy looking for a node that matches the selector. If one is found,
* the event's `delegateTarget` property is set to it and the return the
* result of calling bound `listener` with the parameters given to the
* handler.
*
* This does not properly handle selectors for things like focus and blur (see
* https://github.com/jquery/jquery/blob/7d21f02b9ec9f655583e898350badf89165ed4d5/src/event.js#L442
* for some similar exceptional cases).
*/
NativeView.prototype.delegate = function (eventName, selector, listener) {
if (typeof selector !== 'string') {
listener = selector;
selector = null;
}
// We have to initialize this here, instead of in the constructor, because the
// super constructor eventually calls this method before we get a chance to initialize
// this._domEvents to an empty list.
if (this._domEvents === void 0) {
this._domEvents = [];
}
var root = this.el;
var handler = selector ? function (e) {
var node = e.target || e.srcElement;
for (; node && node != root; node = node.parentNode) {
if (matchesSelector.call(node, selector)) {
e.delegateTarget = node;
if (listener.handleEvent) {
return listener.handleEvent(e);
}
else {
return listener(e);
}
}
}
} : listener;
this.el.addEventListener(eventName, handler, false);
this._domEvents.push({ eventName: eventName, handler: handler, listener: listener, selector: selector });
return handler;
};
// Remove a single delegated event. Either `eventName` or `selector` must
// be included, `selector` and `listener` are optional.
NativeView.prototype.undelegate = function (eventName, selector, listener) {
if (typeof selector === 'function') {
listener = selector;
selector = null;
}
if (this.el && this._domEvents) {
var handlers = this._domEvents.slice();
var i = handlers.length;
while (i--) {
var item = handlers[i];
var match = item.eventName === eventName &&
(listener ? item.listener === listener : true) &&
(selector ? item.selector === selector : true);
if (!match)
continue;
this.el.removeEventListener(item.eventName, item.handler, false);
this._domEvents.splice(i, 1);
}
}
return this;
};
// Remove all events created with `delegate` from `el`
NativeView.prototype.undelegateEvents = function () {
if (this.el && this._domEvents) {
for (var i = 0, len = this._domEvents.length; i < len; i++) {
var item = this._domEvents[i];
this.el.removeEventListener(item.eventName, item.handler, false);
}
;
this._domEvents.length = 0;
}
return this;
};
return NativeView;
}(Backbone.View));
exports.NativeView = NativeView;
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
var iteration_1 = __webpack_require__(15);
var messaging_1 = __webpack_require__(16);
var properties_1 = __webpack_require__(20);
var signaling_1 = __webpack_require__(21);
var title_1 = __webpack_require__(22);
/**
* The class name added to Widget instances.
*/
var WIDGET_CLASS = 'p-Widget';
/**
* The class name added to hidden widgets.
*/
var HIDDEN_CLASS = 'p-mod-hidden';
/**
* The base class of the Phosphor widget hierarchy.
*
* #### Notes
* This class will typically be subclassed in order to create a useful
* widget. However, it can be used directly to host externally created
* content.
*/
var Widget = (function () {
/**
* Construct a new widget.
*
* @param options - The options for initializing the widget.
*/
function Widget(options) {
if (options === void 0) { options = {}; }
this._flags = 0;
this._layout = null;
this._parent = null;
this._node = Private.createNode(options);
this.addClass(WIDGET_CLASS);
}
/**
* Dispose of the widget and its descendant widgets.
*
* #### Notes
* It is unsafe to use the widget after it has been disposed.
*
* All calls made to this method after the first are a no-op.
*/
Widget.prototype.dispose = function () {
// Do nothing if the widget is already disposed.
if (this.isDisposed) {
return;
}
// Set the disposed flag and emit the disposed signal.
this.setFlag(WidgetFlag.IsDisposed);
this.disposed.emit(void 0);
// Remove or detach the widget if necessary.
if (this.parent) {
this.parent = null;
}
else if (this.isAttached) {
Widget.detach(this);
}
// Dispose of the widget layout.
if (this._layout) {
this._layout.dispose();
this._layout = null;
}
// Clear the attached data associated with the widget.
signaling_1.clearSignalData(this);
messaging_1.clearMessageData(this);
properties_1.clearPropertyData(this);
// Clear the reference to the DOM node.
this._node = null;
};
Object.defineProperty(Widget.prototype, "isDisposed", {
/**
* Test whether the widget has been disposed.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return this.testFlag(WidgetFlag.IsDisposed);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Widget.prototype, "isAttached", {
/**
* Test whether the widget's node is attached to the DOM.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return this.testFlag(WidgetFlag.IsAttached);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Widget.prototype, "isHidden", {
/**
* Test whether the widget is explicitly hidden.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return this.testFlag(WidgetFlag.IsHidden);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Widget.prototype, "isVisible", {
/**
* Test whether the widget is visible.
*
* #### Notes
* A widget is visible when it is attached to the DOM, is not
* explicitly hidden, and has no explicitly hidden ancestors.
*
* This is a read-only property.
*/
get: function () {
return this.testFlag(WidgetFlag.IsVisible);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Widget.prototype, "node", {
/**
* Get the DOM node owned by the widget.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return this._node;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Widget.prototype, "id", {
/**
* Get the id of the widget's DOM node.
*/
get: function () {
return this._node.id;
},
/**
* Set the id of the widget's DOM node.
*/
set: function (value) {
this._node.id = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Widget.prototype, "title", {
/**
* Get the title object for the widget.
*
* #### Notes
* The title object is used by some container widgets when displaying
* the widget alongside some title, such as a tab panel or side bar.
*
* Since not all widgets will use the title, it is created on demand.
*
* The `owner` property of the title is set to this widget.
*
* This is a read-only property.
*/
get: function () {
return Private.titleProperty.get(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Widget.prototype, "parent", {
/**
* Get the parent of the widget.
*
* #### Notes
* This will be `null` if the widget does not have a parent.
*/
get: function () {
return this._parent;
},
/**
* Set the parent of the widget.
*
* #### Notes
* Children are typically added to a widget by using a layout, which
* means user code will not normally set the parent widget directly.
*
* The widget will be automatically removed from its old parent.
*
* This is a no-op if there is no effective parent change.
*/
set: function (value) {
value = value || null;
if (this._parent === value) {
return;
}
if (value && this.contains(value)) {
throw new Error('Invalid parent widget.');
}
if (this._parent && !this._parent.isDisposed) {
messaging_1.sendMessage(this._parent, new ChildMessage('child-removed', this));
}
this._parent = value;
if (this._parent && !this._parent.isDisposed) {
messaging_1.sendMessage(this._parent, new ChildMessage('child-added', this));
}
messaging_1.sendMessage(this, WidgetMessage.ParentChanged);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Widget.prototype, "layout", {
/**
* Get the layout for the widget.
*
* #### Notes
* This will be `null` if the widget does not have a layout.
*/
get: function () {
return this._layout;
},
/**
* Set the layout for the widget.
*
* #### Notes
* The layout is single-use only. It cannot be set to `null` and it
* cannot be changed after the first assignment.
*
* The layout is disposed automatically when the widget is disposed.
*/
set: function (value) {
value = value || null;
if (this._layout === value) {
return;
}
if (this.testFlag(WidgetFlag.DisallowLayout)) {
throw new Error('Cannot set widget layout.');
}
if (this._layout) {
throw new Error('Cannot change widget layout.');
}
if (value.parent) {
throw new Error('Cannot change layout parent.');
}
this._layout = value;
value.parent = this;
},
enumerable: true,
configurable: true
});
/**
* Create an iterator over the widget's children.
*
* @returns A new iterator over the children of the widget.
*
* #### Notes
* The widget must have a populated layout in order to have children.
*
* If a layout is not installed, the returned iterator will be empty.
*/
Widget.prototype.children = function () {
return this._layout ? this._layout.iter() : iteration_1.empty();
};
/**
* Test whether a widget is a descendant of this widget.
*
* @param widget - The descendant widget of interest.
*
* @returns `true` if the widget is a descendant, `false` otherwise.
*/
Widget.prototype.contains = function (widget) {
for (; widget; widget = widget._parent) {
if (widget === this)
return true;
}
return false;
};
/**
* Test whether the widget's DOM node has the given class name.
*
* @param name - The class name of interest.
*
* @returns `true` if the node has the class, `false` otherwise.
*/
Widget.prototype.hasClass = function (name) {
return this._node.classList.contains(name);
};
/**
* Add a class name to the widget's DOM node.
*
* @param name - The class name to add to the node.
*
* #### Notes
* If the class name is already added to the node, this is a no-op.
*
* The class name must not contain whitespace.
*/
Widget.prototype.addClass = function (name) {
this._node.classList.add(name);
};
/**
* Remove a class name from the widget's DOM node.
*
* @param name - The class name to remove from the node.
*
* #### Notes
* If the class name is not yet added to the node, this is a no-op.
*
* The class name must not contain whitespace.
*/
Widget.prototype.removeClass = function (name) {
this._node.classList.remove(name);
};
/**
* Toggle a class name on the widget's DOM node.
*
* @param name - The class name to toggle on the node.
*
* @param force - Whether to force add the class (`true`) or force
* remove the class (`false`). If not provided, the presence of
* the class will be toggled from its current state.
*
* @returns `true` if the class is now present, `false` otherwise.
*
* #### Notes
* The class name must not contain whitespace.
*/
Widget.prototype.toggleClass = function (name, force) {
if (force === true) {
this._node.classList.add(name);
return true;
}
if (force === false) {
this._node.classList.remove(name);
return false;
}
return this._node.classList.toggle(name);
};
/**
* Post an `'update-request'` message to the widget.
*
* #### Notes
* This is a simple convenience method for posting the message.
*/
Widget.prototype.update = function () {
messaging_1.postMessage(this, WidgetMessage.UpdateRequest);
};
/**
* Post a `'fit-request'` message to the widget.
*
* #### Notes
* This is a simple convenience method for posting the message.
*/
Widget.prototype.fit = function () {
messaging_1.postMessage(this, WidgetMessage.FitRequest);
};
/**
* Post an `'activate-request'` message to the widget.
*
* #### Notes
* This is a simple convenience method for posting the message.
*/
Widget.prototype.activate = function () {
messaging_1.postMessage(this, WidgetMessage.ActivateRequest);
};
/**
* Send a `'close-request'` message to the widget.
*
* #### Notes
* This is a simple convenience method for sending the message.
*/
Widget.prototype.close = function () {
messaging_1.sendMessage(this, WidgetMessage.CloseRequest);
};
/**
* Show the widget and make it visible to its parent widget.
*
* #### Notes
* This causes the [[isHidden]] property to be `false`.
*
* If the widget is not explicitly hidden, this is a no-op.
*/
Widget.prototype.show = function () {
if (!this.testFlag(WidgetFlag.IsHidden)) {
return;
}
this.clearFlag(WidgetFlag.IsHidden);
this.removeClass(HIDDEN_CLASS);
if (this.isAttached && (!this.parent || this.parent.isVisible)) {
messaging_1.sendMessage(this, WidgetMessage.AfterShow);
}
if (this.parent) {
messaging_1.sendMessage(this.parent, new ChildMessage('child-shown', this));
}
};
/**
* Hide the widget and make it hidden to its parent widget.
*
* #### Notes
* This causes the [[isHidden]] property to be `true`.
*
* If the widget is explicitly hidden, this is a no-op.
*/
Widget.prototype.hide = function () {
if (this.testFlag(WidgetFlag.IsHidden)) {
return;
}
if (this.isAttached && (!this.parent || this.parent.isVisible)) {
messaging_1.sendMessage(this, WidgetMessage.BeforeHide);
}
this.setFlag(WidgetFlag.IsHidden);
this.addClass(HIDDEN_CLASS);
if (this.parent) {
messaging_1.sendMessage(this.parent, new ChildMessage('child-hidden', this));
}
};
/**
* Show or hide the widget according to a boolean value.
*
* @param hidden - `true` to hide the widget, or `false` to show it.
*
* #### Notes
* This is a convenience method for `hide()` and `show()`.
*/
Widget.prototype.setHidden = function (hidden) {
if (hidden) {
this.hide();
}
else {
this.show();
}
};
/**
* Test whether the given widget flag is set.
*
* #### Notes
* This will not typically be called directly by user code.
*/
Widget.prototype.testFlag = function (flag) {
return (this._flags & flag) !== 0;
};
/**
* Set the given widget flag.
*
* #### Notes
* This will not typically be called directly by user code.
*/
Widget.prototype.setFlag = function (flag) {
this._flags |= flag;
};
/**
* Clear the given widget flag.
*
* #### Notes
* This will not typically be called directly by user code.
*/
Widget.prototype.clearFlag = function (flag) {
this._flags &= ~flag;
};
/**
* Process a message sent to the widget.
*
* @param msg - The message sent to the widget.
*
* #### Notes
* Subclasses may reimplement this method as needed.
*/
Widget.prototype.processMessage = function (msg) {
switch (msg.type) {
case 'resize':
this.notifyLayout(msg);
this.onResize(msg);
break;
case 'update-request':
this.notifyLayout(msg);
this.onUpdateRequest(msg);
break;
case 'after-show':
this.setFlag(WidgetFlag.IsVisible);
this.notifyLayout(msg);
this.onAfterShow(msg);
break;
case 'before-hide':
this.notifyLayout(msg);
this.onBeforeHide(msg);
this.clearFlag(WidgetFlag.IsVisible);
break;
case 'after-attach':
var visible = !this.isHidden && (!this.parent || this.parent.isVisible);
if (visible)
this.setFlag(WidgetFlag.IsVisible);
this.setFlag(WidgetFlag.IsAttached);
this.notifyLayout(msg);
this.onAfterAttach(msg);
break;
case 'before-detach':
this.notifyLayout(msg);
this.onBeforeDetach(msg);
this.clearFlag(WidgetFlag.IsVisible);
this.clearFlag(WidgetFlag.IsAttached);
break;
case 'activate-request':
this.notifyLayout(msg);
this.onActivateRequest(msg);
break;
case 'close-request':
this.notifyLayout(msg);
this.onCloseRequest(msg);
break;
case 'child-added':
this.notifyLayout(msg);
this.onChildAdded(msg);
break;
case 'child-removed':
this.notifyLayout(msg);
this.onChildRemoved(msg);
break;
default:
this.notifyLayout(msg);
break;
}
};
/**
* Invoke the message processing routine of the widget's layout.
*
* @param msg - The message to dispatch to the layout.
*
* #### Notes
* This is a no-op if the widget does not have a layout.
*
* This will not typically be called directly by user code.
*/
Widget.prototype.notifyLayout = function (msg) {
if (this._layout)
this._layout.processParentMessage(msg);
};
/**
* A message handler invoked on a `'close-request'` message.
*
* #### Notes
* The default implementation unparents or detaches the widget.
*/
Widget.prototype.onCloseRequest = function (msg) {
if (this.parent) {
this.parent = null;
}
else if (this.isAttached) {
Widget.detach(this);
}
};
/**
* A message handler invoked on a `'resize'` message.
*
* #### Notes
* The default implementation of this handler is a no-op.
*/
Widget.prototype.onResize = function (msg) { };
/**
* A message handler invoked on an `'update-request'` message.
*
* #### Notes
* The default implementation of this handler is a no-op.
*/
Widget.prototype.onUpdateRequest = function (msg) { };
/**
* A message handler invoked on an `'activate-request'` message.
*
* #### Notes
* The default implementation of this handler is a no-op.
*/
Widget.prototype.onActivateRequest = function (msg) { };
/**
* A message handler invoked on an `'after-show'` message.
*
* #### Notes
* The default implementation of this handler is a no-op.
*/
Widget.prototype.onAfterShow = function (msg) { };
/**
* A message handler invoked on a `'before-hide'` message.
*
* #### Notes
* The default implementation of this handler is a no-op.
*/
Widget.prototype.onBeforeHide = function (msg) { };
/**
* A message handler invoked on an `'after-attach'` message.
*
* #### Notes
* The default implementation of this handler is a no-op.
*/
Widget.prototype.onAfterAttach = function (msg) { };
/**
* A message handler invoked on a `'before-detach'` message.
*
* #### Notes
* The default implementation of this handler is a no-op.
*/
Widget.prototype.onBeforeDetach = function (msg) { };
/**
* A message handler invoked on a `'child-added'` message.
*
* #### Notes
* The default implementation of this handler is a no-op.
*/
Widget.prototype.onChildAdded = function (msg) { };
/**
* A message handler invoked on a `'child-removed'` message.
*
* #### Notes
* The default implementation of this handler is a no-op.
*/
Widget.prototype.onChildRemoved = function (msg) { };
return Widget;
}());
exports.Widget = Widget;
// Define the signals for the `Widget` class.
signaling_1.defineSignal(Widget.prototype, 'disposed');
/**
* The namespace for the `Widget` class statics.
*/
(function (Widget) {
// TODO - should this be an instance method?
/**
* Attach a widget to a host DOM node.
*
* @param widget - The widget of interest.
*
* @param host - The DOM node to use as the widget's host.
*
* #### Notes
* This will throw an error if the widget is not a root widget, if
* the widget is already attached, or if the host is not attached
* to the DOM.
*/
function attach(widget, host) {
if (widget.parent) {
throw new Error('Cannot attach child widget.');
}
if (widget.isAttached || document.body.contains(widget.node)) {
throw new Error('Widget already attached.');
}
if (!document.body.contains(host)) {
throw new Error('Host not attached.');
}
host.appendChild(widget.node);
messaging_1.sendMessage(widget, WidgetMessage.AfterAttach);
}
Widget.attach = attach;
// TODO - should this be an instance method?
/**
* Detach the widget from its host DOM node.
*
* @param widget - The widget of interest.
*
* #### Notes
* This will throw an error if the widget is not a root widget, or
* if the widget is not attached to the DOM.
*/
function detach(widget) {
if (widget.parent) {
throw new Error('Cannot detach child widget.');
}
if (!widget.isAttached || !document.body.contains(widget.node)) {
throw new Error('Widget not attached.');
}
messaging_1.sendMessage(widget, WidgetMessage.BeforeDetach);
widget.node.parentNode.removeChild(widget.node);
}
Widget.detach = detach;
/**
* Prepare a widget for absolute layout geometry.
*
* @param widget - The widget of interest.
*
* #### Notes
* This sets the inline style position of the widget to `absolute`.
*/
function prepareGeometry(widget) {
widget.node.style.position = 'absolute';
}
Widget.prepareGeometry = prepareGeometry;
/**
* Reset the layout geometry of a widget.
*
* @param widget - The widget of interest.
*
* #### Notes
* This clears the inline style position and geometry of the widget.
*/
function resetGeometry(widget) {
var style = widget.node.style;
var rect = Private.rectProperty.get(widget);
rect.top = NaN;
rect.left = NaN;
rect.width = NaN;
rect.height = NaN;
style.position = '';
style.top = '';
style.left = '';
style.width = '';
style.height = '';
}
Widget.resetGeometry = resetGeometry;
/**
* Set the absolute layout geometry of a widget.
*
* @param widget - The widget of interest.
*
* @param left - The desired offset left position of the widget.
*
* @param top - The desired offset top position of the widget.
*
* @param width - The desired offset width of the widget.
*
* @param height - The desired offset height of the widget.
*
* #### Notes
* All dimensions are assumed to be pixels with coordinates relative
* to the origin of the widget's offset parent.
*
* The widget's node is assumed to be position `absolute`.
*
* If the widget is resized from its previous size, a `ResizeMessage`
* will be automatically sent to the widget.
*/
function setGeometry(widget, left, top, width, height) {
var resized = false;
var style = widget.node.style;
var rect = Private.rectProperty.get(widget);
if (rect.top !== top) {
rect.top = top;
style.top = top + "px";
}
if (rect.left !== left) {
rect.left = left;
style.left = left + "px";
}
if (rect.width !== width) {
resized = true;
rect.width = width;
style.width = width + "px";
}
if (rect.height !== height) {
resized = true;
rect.height = height;
style.height = height + "px";
}
if (resized) {
messaging_1.sendMessage(widget, new ResizeMessage(width, height));
}
}
Widget.setGeometry = setGeometry;
})(Widget = exports.Widget || (exports.Widget = {}));
exports.Widget = Widget;
/**
* An abstract base class for creating Phosphor layouts.
*
* #### Notes
* A layout is used to add widgets to a parent and to arrange those
* widgets within the parent's DOM node.
*
* This class implements the base functionality which is required of
* nearly all layouts. It must be subclassed in order to be useful.
*
* Notably, this class does not define a uniform interface for adding
* widgets to the layout. A subclass should define that API in a way
* which is meaningful for its intended use.
*/
var Layout = (function () {
function Layout() {
this._disposed = false;
this._parent = null;
}
/**
* Dispose of the resources held by the layout.
*
* #### Notes
* This should be reimplemented to clear and dispose of the widgets.
*
* All reimplementations should call the superclass method.
*
* This method is called automatically when the parent is disposed.
*/
Layout.prototype.dispose = function () {
this._disposed = true;
this._parent = null;
signaling_1.clearSignalData(this);
properties_1.clearPropertyData(this);
};
Object.defineProperty(Layout.prototype, "isDisposed", {
/**
* Test whether the layout is disposed.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return this._disposed;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Layout.prototype, "parent", {
/**
* Get the parent widget of the layout.
*/
get: function () {
return this._parent;
},
/**
* Set the parent widget of the layout.
*
* #### Notes
* This is set automatically when installing the layout on the parent
* widget. The parent widget should not be set directly by user code.
*/
set: function (value) {
if (!value) {
throw new Error('Cannot set parent widget to null.');
}
if (this._parent === value) {
return;
}
if (this._parent) {
throw new Error('Cannot change parent widget.');
}
if (value.layout !== this) {
throw new Error('Invalid parent widget.');
}
this._parent = value;
this.init();
},
enumerable: true,
configurable: true
});
/**
* Process a message sent to the parent widget.
*
* @param msg - The message sent to the parent widget.
*
* #### Notes
* This method is called by the parent widget to process a message.
*
* Subclasses may reimplement this method as needed.
*/
Layout.prototype.processParentMessage = function (msg) {
switch (msg.type) {
case 'resize':
this.onResize(msg);
break;
case 'update-request':
this.onUpdateRequest(msg);
break;
case 'fit-request':
this.onFitRequest(msg);
break;
case 'after-show':
this.onAfterShow(msg);
break;
case 'before-hide':
this.onBeforeHide(msg);
break;
case 'after-attach':
this.onAfterAttach(msg);
break;
case 'before-detach':
this.onBeforeDetach(msg);
break;
case 'child-removed':
this.onChildRemoved(msg);
break;
case 'child-shown':
this.onChildShown(msg);
break;
case 'child-hidden':
this.onChildHidden(msg);
break;
}
};
/**
* Perform layout initialization which requires the parent widget.
*
* #### Notes
* This method is invoked immediately after the layout is installed
* on the parent widget.
*
* The default implementation reparents all of the widgets to the
* layout parent widget.
*
* Subclasses should reimplement this method and attach the child
* widget nodes to the parent widget's node.
*/
Layout.prototype.init = function () {
var _this = this;
iteration_1.each(this, function (widget) { widget.parent = _this.parent; });
};
/**
* A message handler invoked on a `'resize'` message.
*
* #### Notes
* The layout should ensure that its widgets are resized according
* to the specified layout space, and that they are sent a `'resize'`
* message if appropriate.
*
* The default implementation of this method sends an `UnknownSize`
* resize message to all widgets.
*
* This may be reimplemented by subclasses as needed.
*/
Layout.prototype.onResize = function (msg) {
iteration_1.each(this, function (widget) { messaging_1.sendMessage(widget, ResizeMessage.UnknownSize); });
};
/**
* A message handler invoked on an `'update-request'` message.
*
* #### Notes
* The layout should ensure that its widgets are resized according
* to the available layout space, and that they are sent a `'resize'`
* message if appropriate.
*
* The default implementation of this method sends an `UnknownSize`
* resize message to all widgets.
*
* This may be reimplemented by subclasses as needed.
*/
Layout.prototype.onUpdateRequest = function (msg) {
iteration_1.each(this, function (widget) { messaging_1.sendMessage(widget, ResizeMessage.UnknownSize); });
};
/**
* A message handler invoked on an `'after-attach'` message.
*
* #### Notes
* The default implementation of this method forwards the message
* to all widgets. It assumes all widget nodes are attached to the
* parent widget node.
*
* This may be reimplemented by subclasses as needed.
*/
Layout.prototype.onAfterAttach = function (msg) {
iteration_1.each(this, function (widget) { messaging_1.sendMessage(widget, msg); });
};
/**
* A message handler invoked on a `'before-detach'` message.
*
* #### Notes
* The default implementation of this method forwards the message
* to all widgets. It assumes all widget nodes are attached to the
* parent widget node.
*
* This may be reimplemented by subclasses as needed.
*/
Layout.prototype.onBeforeDetach = function (msg) {
iteration_1.each(this, function (widget) { messaging_1.sendMessage(widget, msg); });
};
/**
* A message handler invoked on an `'after-show'` message.
*
* #### Notes
* The default implementation of this method forwards the message to
* all non-hidden widgets. It assumes all widget nodes are attached
* to the parent widget node.
*
* This may be reimplemented by subclasses as needed.
*/
Layout.prototype.onAfterShow = function (msg) {
iteration_1.each(this, function (widget) { if (!widget.isHidden)
messaging_1.sendMessage(widget, msg); });
};
/**
* A message handler invoked on a `'before-hide'` message.
*
* #### Notes
* The default implementation of this method forwards the message to
* all non-hidden widgets. It assumes all widget nodes are attached
* to the parent widget node.
*
* This may be reimplemented by subclasses as needed.
*/
Layout.prototype.onBeforeHide = function (msg) {
iteration_1.each(this, function (widget) { if (!widget.isHidden)
messaging_1.sendMessage(widget, msg); });
};
/**
* A message handler invoked on a `'child-removed'` message.
*
* #### Notes
* This will remove the child widget from the layout.
*
* Subclasses should **not** typically reimplement this method.
*/
Layout.prototype.onChildRemoved = function (msg) {
this.removeWidget(msg.child);
};
/**
* A message handler invoked on a `'fit-request'` message.
*
* #### Notes
* The default implementation of this handler is a no-op.
*/
Layout.prototype.onFitRequest = function (msg) { };
/**
* A message handler invoked on a `'child-shown'` message.
*
* #### Notes
* The default implementation of this handler is a no-op.
*/
Layout.prototype.onChildShown = function (msg) { };
/**
* A message handler invoked on a `'child-hidden'` message.
*
* #### Notes
* The default implementation of this handler is a no-op.
*/
Layout.prototype.onChildHidden = function (msg) { };
return Layout;
}());
exports.Layout = Layout;
// TODO should this be in the Widget namespace?
/**
* An enum of widget bit flags.
*/
var WidgetFlag;
(function (WidgetFlag) {
/**
* The widget has been disposed.
*/
WidgetFlag[WidgetFlag["IsDisposed"] = 1] = "IsDisposed";
/**
* The widget is attached to the DOM.
*/
WidgetFlag[WidgetFlag["IsAttached"] = 2] = "IsAttached";
/**
* The widget is hidden.
*/
WidgetFlag[WidgetFlag["IsHidden"] = 4] = "IsHidden";
/**
* The widget is visible.
*/
WidgetFlag[WidgetFlag["IsVisible"] = 8] = "IsVisible";
/**
* A layout cannot be set on the widget.
*/
WidgetFlag[WidgetFlag["DisallowLayout"] = 16] = "DisallowLayout";
})(WidgetFlag = exports.WidgetFlag || (exports.WidgetFlag = {}));
// TODO should this be in the Widget namespace?
/**
* A collection of stateless messages related to widgets.
*/
var WidgetMessage;
(function (WidgetMessage) {
/**
* A singleton `'after-show'` message.
*
* #### Notes
* This message is sent to a widget after it becomes visible.
*
* This message is **not** sent when the widget is being attached.
*/
WidgetMessage.AfterShow = new messaging_1.Message('after-show');
/**
* A singleton `'before-hide'` message.
*
* #### Notes
* This message is sent to a widget before it becomes not-visible.
*
* This message is **not** sent when the widget is being detached.
*/
WidgetMessage.BeforeHide = new messaging_1.Message('before-hide');
/**
* A singleton `'after-attach'` message.
*
* #### Notes
* This message is sent to a widget after it is attached.
*/
WidgetMessage.AfterAttach = new messaging_1.Message('after-attach');
/**
* A singleton `'before-detach'` message.
*
* #### Notes
* This message is sent to a widget before it is detached.
*/
WidgetMessage.BeforeDetach = new messaging_1.Message('before-detach');
/**
* A singleton `'parent-changed'` message.
*
* #### Notes
* This message is sent to a widget when its parent has changed.
*/
WidgetMessage.ParentChanged = new messaging_1.Message('parent-changed');
/**
* A singleton conflatable `'update-request'` message.
*
* #### Notes
* This message can be dispatched to supporting widgets in order to
* update their content based on the current widget state. Not all
* widgets will respond to messages of this type.
*
* For widgets with a layout, this message will inform the layout to
* update the position and size of its child widgets.
*/
WidgetMessage.UpdateRequest = new messaging_1.ConflatableMessage('update-request');
/**
* A singleton conflatable `'fit-request'` message.
*
* #### Notes
* For widgets with a layout, this message will inform the layout to
* recalculate its size constraints to fit the space requirements of
* its child widgets, and to update their position and size. Not all
* layouts will respond to messages of this type.
*/
WidgetMessage.FitRequest = new messaging_1.ConflatableMessage('fit-request');
/**
* A singleton conflatable `'activate-request'` message.
*
* #### Notes
* This message should be dispatched to a widget when it should
* perform the actions necessary to activate the widget, which
* may include focusing its node or descendant node.
*/
WidgetMessage.ActivateRequest = new messaging_1.ConflatableMessage('activate-request');
/**
* A singleton conflatable `'close-request'` message.
*
* #### Notes
* This message should be dispatched to a widget when it should close
* and remove itself from the widget hierarchy.
*/
WidgetMessage.CloseRequest = new messaging_1.ConflatableMessage('close-request');
})(WidgetMessage = exports.WidgetMessage || (exports.WidgetMessage = {}));
// TODO should this be in the Widget namespace?
/**
* A message class for child related messages.
*/
var ChildMessage = (function (_super) {
__extends(ChildMessage, _super);
/**
* Construct a new child message.
*
* @param type - The message type.
*
* @param child - The child widget for the message.
*/
function ChildMessage(type, child) {
var _this = _super.call(this, type) || this;
_this._child = child;
return _this;
}
Object.defineProperty(ChildMessage.prototype, "child", {
/**
* The child widget for the message.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return this._child;
},
enumerable: true,
configurable: true
});
return ChildMessage;
}(messaging_1.Message));
exports.ChildMessage = ChildMessage;
// TODO should this be in the Widget namespace?
/**
* A message class for `'resize'` messages.
*/
var ResizeMessage = (function (_super) {
__extends(ResizeMessage, _super);
/**
* Construct a new resize message.
*
* @param width - The **offset width** of the widget, or `-1` if
* the width is not known.
*
* @param height - The **offset height** of the widget, or `-1` if
* the height is not known.
*/
function ResizeMessage(width, height) {
var _this = _super.call(this, 'resize') || this;
_this._width = width;
_this._height = height;
return _this;
}
Object.defineProperty(ResizeMessage.prototype, "width", {
/**
* The offset width of the widget.
*
* #### Notes
* This will be `-1` if the width is unknown.
*
* This is a read-only property.
*/
get: function () {
return this._width;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ResizeMessage.prototype, "height", {
/**
* The offset height of the widget.
*
* #### Notes
* This will be `-1` if the height is unknown.
*
* This is a read-only property.
*/
get: function () {
return this._height;
},
enumerable: true,
configurable: true
});
return ResizeMessage;
}(messaging_1.Message));
exports.ResizeMessage = ResizeMessage;
/**
* The namespace for the `ResizeMessage` class statics.
*/
(function (ResizeMessage) {
/**
* A singleton `'resize'` message with an unknown size.
*/
ResizeMessage.UnknownSize = new ResizeMessage(-1, -1);
})(ResizeMessage = exports.ResizeMessage || (exports.ResizeMessage = {}));
exports.ResizeMessage = ResizeMessage;
/**
* The namespace for the private module data.
*/
var Private;
(function (Private) {
/**
* A property descriptor for a widget absolute geometry rect.
*/
Private.rectProperty = new properties_1.AttachedProperty({
name: 'rect',
create: function () { return ({ top: NaN, left: NaN, width: NaN, height: NaN }); },
});
/**
* An attached property for the widget title object.
*/
Private.titleProperty = new properties_1.AttachedProperty({
name: 'title',
create: function (owner) { return new title_1.Title({ owner: owner }); },
});
/**
* Create a DOM node for the given widget options.
*/
function createNode(options) {
return options.node || document.createElement('div');
}
Private.createNode = createNode;
})(Private || (Private = {}));
/***/ },
/* 15 */
/***/ function(module, exports) {
"use strict";
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Create an iterator for an iterable or array-like object.
*
* @param object - The iterable or array-like object of interest.
*
* @returns A new iterator for the given object.
*
* #### Notes
* This function allows iteration algorithms to operate on user-defined
* iterable types and builtin array-like objects in a uniform fashion.
*/
function iter(object) {
var it;
if (typeof object.iter === 'function') {
it = object.iter();
}
else {
it = new ArrayIterator(object, 0);
}
return it;
}
exports.iter = iter;
/**
* Create an array from an iterable of values.
*
* @param object - The iterable or array-like object of interest.
*
* @returns A new array of values from the given object.
*/
function toArray(object) {
var value;
var result = [];
var it = iter(object);
while ((value = it.next()) !== void 0) {
result[result.length] = value;
}
return result;
}
exports.toArray = toArray;
/**
* Create an empty iterator.
*
* @returns A new iterator which yields nothing.
*/
function empty() {
return new EmptyIterator();
}
exports.empty = empty;
/**
* An iterator which is always empty.
*/
var EmptyIterator = (function () {
/**
* Construct a new empty iterator.
*/
function EmptyIterator() {
}
/**
* Create an iterator over the object's values.
*
* @returns A reference to `this` iterator.
*/
EmptyIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the current iterator.
*
* @returns A new independent clone of the current iterator.
*/
EmptyIterator.prototype.clone = function () {
return new EmptyIterator();
};
/**
* Get the next value from the iterator.
*
* @returns Always `undefined`.
*/
EmptyIterator.prototype.next = function () {
return void 0;
};
return EmptyIterator;
}());
exports.EmptyIterator = EmptyIterator;
/**
* An iterator for an array-like object.
*
* #### Notes
* This iterator can be used for any builtin JS array-like object.
*/
var ArrayIterator = (function () {
/**
* Construct a new array iterator.
*
* @param source - The array-like object of interest.
*
* @param start - The starting index for iteration.
*/
function ArrayIterator(source, start) {
this._source = source;
this._index = start;
}
/**
* Create an iterator over the object's values.
*
* @returns A reference to `this` iterator.
*/
ArrayIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the current iterator.
*
* @returns A new independent clone of the current iterator.
*
* #### Notes
* The source array is shared among clones.
*/
ArrayIterator.prototype.clone = function () {
return new ArrayIterator(this._source, this._index);
};
/**
* Get the next value from the source array.
*
* @returns The next value from the source array, or `undefined`
* if the iterator is exhausted.
*/
ArrayIterator.prototype.next = function () {
if (this._index >= this._source.length) {
return void 0;
}
return this._source[this._index++];
};
return ArrayIterator;
}());
exports.ArrayIterator = ArrayIterator;
/**
* Invoke a function for each value in an iterable.
*
* @param object - The iterable or array-like object of interest.
*
* @param fn - The callback function to invoke for each value.
*
* #### Notes
* Iteration cannot be terminated early.
*/
function each(object, fn) {
var value;
var it = iter(object);
while ((value = it.next()) !== void 0) {
fn(value);
}
}
exports.each = each;
/**
* Test whether all values in an iterable satisfy a predicate.
*
* @param object - The iterable or array-like object of interest.
*
* @param fn - The predicate function to invoke for each value.
*
* @returns `true` if all values pass the test, `false` otherwise.
*
* #### Notes
* Iteration terminates on the first `false` predicate result.
*/
function every(object, fn) {
var value;
var it = iter(object);
while ((value = it.next()) !== void 0) {
if (!fn(value)) {
return false;
}
}
return true;
}
exports.every = every;
/**
* Test whether any value in an iterable satisfies a predicate.
*
* @param object - The iterable or array-like object of interest.
*
* @param fn - The predicate function to invoke for each value.
*
* @returns `true` if any value passes the test, `false` otherwise.
*
* #### Notes
* Iteration terminates on the first `true` predicate result.
*/
function some(object, fn) {
var value;
var it = iter(object);
while ((value = it.next()) !== void 0) {
if (fn(value)) {
return true;
}
}
return false;
}
exports.some = some;
function reduce(object, fn, initial) {
// Setup the iterator and fetch the first value.
var it = iter(object);
var first = it.next();
// An empty iterator and no initial value is an error.
if (first === void 0 && initial === void 0) {
throw new TypeError('Reduce of empty iterable with no initial value.');
}
// If the iterator is empty, return the initial value.
if (first === void 0) {
return initial;
}
// If the iterator has a single item and no initial value, the
// reducer is not invoked and the first item is the return value.
var second = it.next();
if (second === void 0 && initial === void 0) {
return first;
}
// If iterator has a single item and an initial value is provided,
// the reducer is invoked and that result is the return value.
if (second === void 0) {
return fn(initial, first);
}
// Setup the initial accumulator value.
var accumulator;
if (initial === void 0) {
accumulator = fn(first, second);
}
else {
accumulator = fn(fn(initial, first), second);
}
// Iterate the rest of the values, updating the accumulator.
var next;
while ((next = it.next()) !== void 0) {
accumulator = fn(accumulator, next);
}
// Return the final accumulated value.
return accumulator;
}
exports.reduce = reduce;
/**
* Filter an iterable for values which pass a test.
*
* @param object - The iterable or array-like object of interest.
*
* @param fn - The predicate function to invoke for each value.
*
* @returns An iterator which yields the values which pass the test.
*/
function filter(object, fn) {
return new FilterIterator(iter(object), fn);
}
exports.filter = filter;
/**
* An iterator which yields values which pass a test.
*/
var FilterIterator = (function () {
/**
* Construct a new filter iterator.
*
* @param source - The iterator of values of interest.
*
* @param fn - The predicate function to invoke for each value in
* the iterator. It returns whether the value passes the test.
*/
function FilterIterator(source, fn) {
this._source = source;
this._fn = fn;
}
/**
* Create an iterator over the object's values.
*
* @returns A reference to `this` iterator.
*/
FilterIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the current iterator.
*
* @returns A new independent clone of the current iterator.
*
* #### Notes
* The source iterator must be cloneable.
*
* The predicate function is shared among clones.
*/
FilterIterator.prototype.clone = function () {
return new FilterIterator(this._source.clone(), this._fn);
};
/**
* Get the next value which passes the test.
*
* @returns The next value from the source iterator which passes
* the predicate, or `undefined` if the iterator is exhausted.
*/
FilterIterator.prototype.next = function () {
var value;
var fn = this._fn;
var it = this._source;
while ((value = it.next()) !== void 0) {
if (fn(value)) {
return value;
}
}
return void 0;
};
return FilterIterator;
}());
exports.FilterIterator = FilterIterator;
/**
* Transform the values of an iterable with a mapping function.
*
* @param object - The iterable or array-like object of interest.
*
* @param fn - The mapping function to invoke for each value.
*
* @returns An iterator which yields the transformed values.
*/
function map(object, fn) {
return new MapIterator(iter(object), fn);
}
exports.map = map;
/**
* An iterator which transforms values using a mapping function.
*/
var MapIterator = (function () {
/**
* Construct a new map iterator.
*
* @param source - The iterator of values of interest.
*
* @param fn - The mapping function to invoke for each value in the
* iterator. It returns the transformed value.
*/
function MapIterator(source, fn) {
this._source = source;
this._fn = fn;
}
/**
* Create an iterator over the object's values.
*
* @returns A reference to `this` iterator.
*/
MapIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the current iterator.
*
* @returns A new independent clone of the current iterator.
*
* #### Notes
* The source iterator must be cloneable.
*
* The mapping function is shared among clones.
*/
MapIterator.prototype.clone = function () {
return new MapIterator(this._source.clone(), this._fn);
};
/**
* Get the next mapped value from the source iterator.
*
* @returns The next value from the source iterator transformed
* by the mapper, or `undefined` if the iterator is exhausted.
*/
MapIterator.prototype.next = function () {
var value = this._source.next();
if (value === void 0) {
return void 0;
}
return this._fn.call(void 0, value);
};
return MapIterator;
}());
exports.MapIterator = MapIterator;
/**
* Attach an incremental index to an iterable.
*
* @param object - The iterable or array-like object of interest.
*
* @param start - The initial value of the index. The default is zero.
*
* @returns An iterator which yields `[index, value]` tuples.
*/
function enumerate(object, start) {
if (start === void 0) { start = 0; }
return new EnumerateIterator(iter(object), start);
}
exports.enumerate = enumerate;
/**
* An iterator which attaches an incremental index to a source.
*/
var EnumerateIterator = (function () {
/**
* Construct a new enumerate iterator.
*
* @param source - The iterator of values of interest.
*
* @param start - The initial value of the index.
*/
function EnumerateIterator(source, start) {
this._source = source;
this._index = start;
}
/**
* Create an iterator over the object's values.
*
* @returns A reference to `this` iterator.
*/
EnumerateIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the enumerate iterator.
*
* @returns A new iterator starting with the current value.
*
* #### Notes
* The source iterator must be cloneable.
*/
EnumerateIterator.prototype.clone = function () {
return new EnumerateIterator(this._source.clone(), this._index);
};
/**
* Get the next value from the enumeration.
*
* @returns The next value from the enumeration, or `undefined` if
* the iterator is exhausted.
*/
EnumerateIterator.prototype.next = function () {
var value = this._source.next();
if (value === void 0) {
return void 0;
}
return [this._index++, value];
};
return EnumerateIterator;
}());
exports.EnumerateIterator = EnumerateIterator;
/**
* Create an iterator which yields a value a single time.
*
* @param value - The value to wrap in an iterator.
*
* @returns A new iterator which yields the value a single time.
*/
function once(value) {
return new RepeatIterator(value, 1);
}
exports.once = once;
/**
* Create an iterator which repeats a value a number of times.
*
* @param value - The value to repeat.
*
* @param count - The number of times to repeat the value.
*
* @returns A new iterator which repeats the specified value.
*/
function repeat(value, count) {
return new RepeatIterator(value, count);
}
exports.repeat = repeat;
/**
* An iterator which repeats a value a specified number of times.
*/
var RepeatIterator = (function () {
/**
* Construct a new repeat iterator.
*
* @param value - The value to repeat.
*
* @param count - The number of times to repeat the value.
*/
function RepeatIterator(value, count) {
this._value = value;
this._count = count;
}
/**
* Create an iterator over the object's values.
*
* @returns A reference to `this` iterator.
*/
RepeatIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the repeat iterator.
*
* @returns A new iterator starting with the current value.
*/
RepeatIterator.prototype.clone = function () {
return new RepeatIterator(this._value, this._count);
};
/**
* Get the next value from the iterator.
*
* @returns The next value from the iterator, or `undefined` if
* the iterator is exhausted.
*/
RepeatIterator.prototype.next = function () {
if (this._count <= 0) {
return void 0;
}
this._count--;
return this._value;
};
return RepeatIterator;
}());
exports.RepeatIterator = RepeatIterator;
/**
* Chain together several iterables.
*
* @param objects - The iterables or array-like objects of interest.
*
* @returns An iterator which yields the values of the given iterables
* in the order in which they are supplied.
*/
function chain() {
var objects = [];
for (var _i = 0; _i < arguments.length; _i++) {
objects[_i] = arguments[_i];
}
return new ChainIterator(map(objects, iter));
}
exports.chain = chain;
/**
* An iterator which chains together several iterators.
*/
var ChainIterator = (function () {
/**
* Construct a new chain iterator.
*
* @param source - The iterator of iterators of interest.
*/
function ChainIterator(source) {
this._cloned = false;
this._source = source;
this._active = void 0;
}
/**
* Create an iterator over the object's values.
*
* @returns A reference to `this` iterator.
*/
ChainIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the chain iterator.
*
* @returns A new iterator starting with the current value.
*
* #### Notes
* The source iterators must be cloneable.
*/
ChainIterator.prototype.clone = function () {
var result = new ChainIterator(this._source.clone());
result._active = this._active && this._active.clone();
result._cloned = true;
this._cloned = true;
return result;
};
/**
* Get the next value from the iterator.
*
* @returns The next value from the iterator, or `undefined` when
* all source iterators are exhausted.
*/
ChainIterator.prototype.next = function () {
if (this._active === void 0) {
this._active = this._source.next();
if (this._active === void 0) {
return void 0;
}
if (this._cloned) {
this._active = this._active.clone();
}
}
var value = this._active.next();
if (value !== void 0) {
return value;
}
this._active = void 0;
return this.next();
};
return ChainIterator;
}());
exports.ChainIterator = ChainIterator;
/**
* Iterate several iterables in lockstep.
*
* @param objects - The iterables or array-like objects of interest.
*
* @returns An iterator which yields successive tuples of values where
* each value is taken in turn from the provided iterables. It will
* be as long as the shortest provided iterable.
*/
function zip() {
var objects = [];
for (var _i = 0; _i < arguments.length; _i++) {
objects[_i] = arguments[_i];
}
return new ZipIterator(objects.map(iter));
}
exports.zip = zip;
/**
* An iterator which iterates several sources in lockstep.
*/
var ZipIterator = (function () {
/**
* Construct a new zip iterator.
*
* @param source - The iterators of interest.
*/
function ZipIterator(source) {
this._source = source;
}
/**
* Create an iterator over the object's values.
*
* @returns A reference to `this` iterator.
*/
ZipIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the zip iterator.
*
* @returns A new iterator starting with the current value.
*
* #### Notes
* The source iterators must be cloneable.
*/
ZipIterator.prototype.clone = function () {
return new ZipIterator(this._source.map(function (it) { return it.clone(); }));
};
/**
* Get the next zipped value from the iterator.
*
* @returns The next zipped value from the iterator, or `undefined`
* when the first source iterator is exhausted.
*/
ZipIterator.prototype.next = function () {
var iters = this._source;
var result = new Array(iters.length);
for (var i = 0, n = iters.length; i < n; ++i) {
var value = iters[i].next();
if (value === void 0) {
return void 0;
}
result[i] = value;
}
return result;
};
return ZipIterator;
}());
exports.ZipIterator = ZipIterator;
/**
* Iterate over an iterable using a stepped increment.
*
* @param object - The iterable or array-like object of interest.
*
* @param step - The distance to step on each iteration. A value
* of less than `1` will behave the same as a value of `1`.
*
* @returns An iterator which traverses the iterable step-wise.
*/
function stride(object, step) {
return new StrideIterator(iter(object), step);
}
exports.stride = stride;
/**
* An iterator which traverses a source iterator step-wise.
*/
var StrideIterator = (function () {
/**
* Construct a new stride iterator.
*
* @param source - The iterator of values of interest.
*
* @param step - The distance to step on each iteration. A value
* of less than `1` will behave the same as a value of `1`.
*/
function StrideIterator(source, step) {
this._source = source;
this._step = step;
}
/**
* Create an iterator over the object's values.
*
* @returns A reference to `this` iterator.
*/
StrideIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the stride iterator.
*
* @returns A new iterator starting with the current value.
*
* #### Notes
* The source iterator must be cloneable.
*/
StrideIterator.prototype.clone = function () {
return new StrideIterator(this._source.clone(), this._step);
};
/**
* Get the next stepped value from the iterator.
*
* @returns The next stepped value from the iterator, or `undefined`
* when the source iterator is exhausted.
*/
StrideIterator.prototype.next = function () {
var value = this._source.next();
if (value === void 0) {
return void 0;
}
var step = this._step;
while (--step > 0) {
this._source.next();
}
return value;
};
return StrideIterator;
}());
exports.StrideIterator = StrideIterator;
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(setImmediate) {"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
var iteration_1 = __webpack_require__(15);
var queue_1 = __webpack_require__(19);
/**
* A message which can be delivered to a message handler.
*
* #### Notes
* This class may be subclassed to create complex message types.
*
* **See also:** [[postMessage]] and [[sendMessage]].
*/
var Message = (function () {
/**
* Construct a new message.
*
* @param type - The type of the message.
*/
function Message(type) {
this._type = type;
}
Object.defineProperty(Message.prototype, "type", {
/**
* The type of the message.
*
* #### Notes
* This value can be used to cast the message to a derived type.
*
* This is a read-only property.
*/
get: function () {
return this._type;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Message.prototype, "isConflatable", {
/**
* Test whether the message is conflatable.
*
* #### Notes
* Message conflation is an advanced topic. Most message types will
* not make use of this feature.
*
* If a conflatable message is posted to the event queue when another
* conflatable message of the same type and handler has already been
* posted, the `conflate()` method of the existing message will be
* invoked. If that method returns `true`, the new message will not
* be enqueued. This allows messages to be compressed, so that only
* a single instance of the message type is processed per cycle, no
* matter how many times messages of that type are posted.
*
* Custom message types may reimplement this property. The default
* implementation is always `false`.
*
* This is a read-only property.
*
* **See also:** [[conflateMessage]]
*/
get: function () {
return false;
},
enumerable: true,
configurable: true
});
/**
* Conflate this message with another message of the same `type`.
*
* @param other - A conflatable message of the same `type`.
*
* @returns `true` if the message was successfully conflated, or
* `false` otherwise.
*
* #### Notes
* Message conflation is an advanced topic. Most message types will
* not make use of this feature.
*
* This method is called automatically by the message loop when the
* given message is posted to the handler paired with this message.
* This message will already be enqueued and conflatable, and the
* given message will have the same `type` and also be conflatable.
*
* This method should merge the state of the other message into this
* message as needed so that when this message is finally delivered
* to the handler, it receives the most up-to-date information.
*
* If this method returns `true`, it signals that the other message
* was successfully conflated and it will not be enqueued.
*
* If this method returns `false`, the other message will be enqueued
* for normal delivery.
*
* Custom message types may reimplement this method. The default
* implementation always returns `false`.
*
* **See also:** [[isConflatable]]
*/
Message.prototype.conflate = function (other) {
return false;
};
return Message;
}());
exports.Message = Message;
/**
* A convenience message class which conflates automatically.
*
* #### Notes
* Message conflation is an advanced topic. Most user code will not
* make use of this class.
*
* This message class is useful for creating message instances which
* should be conflated, but which have no state other than `type`.
*
* If conflation of stateful messages is required, a custom `Message`
* subclass should be created.
*/
var ConflatableMessage = (function (_super) {
__extends(ConflatableMessage, _super);
function ConflatableMessage() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(ConflatableMessage.prototype, "isConflatable", {
/**
* Test whether the message is conflatable.
*
* #### Notes
* This property is always `true`.
*
* This is a read-only property.
*/
get: function () {
return true;
},
enumerable: true,
configurable: true
});
/**
* Conflate this message with another message of the same `type`.
*
* #### Notes
* This method always returns `true`.
*/
ConflatableMessage.prototype.conflate = function (other) {
return true;
};
return ConflatableMessage;
}(Message));
exports.ConflatableMessage = ConflatableMessage;
/**
* Send a message to a message handler to process immediately.
*
* @param handler - The handler which should process the message.
*
* @param msg - The message to deliver to the handler.
*
* #### Notes
* The message will first be sent through any installed message hooks
* for the handler. If the message passes all hooks, it will then be
* delivered to the `processMessage` method of the handler.
*
* The message will not be conflated with pending posted messages.
*
* Exceptions in hooks and handlers will be caught and logged.
*/
function sendMessage(handler, msg) {
MessageLoop.sendMessage(handler, msg);
}
exports.sendMessage = sendMessage;
/**
* Post a message to the message handler to process in the future.
*
* @param handler - The handler which should process the message.
*
* @param msg - The message to post to the handler.
*
* #### Notes
* The message will be conflated with the pending posted messages for
* the handler, if possible. If the message is not conflated, it will
* be queued for normal delivery on the next cycle of the event loop.
*
* Exceptions in hooks and handlers will be caught and logged.
*/
function postMessage(handler, msg) {
MessageLoop.postMessage(handler, msg);
}
exports.postMessage = postMessage;
/**
* Install a message hook for a message handler.
*
* @param handler - The message handler of interest.
*
* @param hook - The message hook to install.
*
* #### Notes
* A message hook is invoked before a message is delivered to the
* handler. If the hook returns `false`, no other hooks will be
* invoked and the message will not be delivered to the handler.
*
* The most recently installed message hook is executed first.
*
* If the hook is already installed, it will be moved to the front.
*
* **See also:** [[removeMessageHook]]
*/
function installMessageHook(handler, hook) {
MessageLoop.installMessageHook(handler, hook);
}
exports.installMessageHook = installMessageHook;
/**
* Remove an installed message hook for a message handler.
*
* @param handler - The message handler of interest.
*
* @param hook - The message hook to remove.
*
* #### Notes
* If the hook is not installed, this is a no-op.
*
* It is safe to call this function while the hook is executing.
*/
function removeMessageHook(handler, hook) {
MessageLoop.removeMessageHook(handler, hook);
}
exports.removeMessageHook = removeMessageHook;
/**
* Clear all message data associated with a message handler.
*
* @param handler - The message handler of interest.
*
* #### Notes
* This will clear all pending messages and hooks for the handler.
*/
function clearMessageData(handler) {
MessageLoop.clearMessageData(handler);
}
exports.clearMessageData = clearMessageData;
/**
* The namespace for the global singleton message loop.
*/
var MessageLoop;
(function (MessageLoop) {
/**
* Send a message to a handler for immediate processing.
*
* This will first call all message hooks for the handler. If any
* hook rejects the message, the message will not be delivered.
*/
function sendMessage(handler, msg) {
// Handle the common case of no message hooks.
var node = hooks.get(handler);
if (node === void 0) {
invokeHandler(handler, msg);
return;
}
// Run the message hooks and bail early if any hook returns false.
// A null hook indicates the hook was removed during dispatch.
for (; node !== null; node = node.next) {
if (node.hook !== null && !invokeHook(node.hook, handler, msg)) {
return;
}
}
// All message hooks returned true, so invoke the handler.
invokeHandler(handler, msg);
}
MessageLoop.sendMessage = sendMessage;
/**
* Post a message to a handler for processing in the future.
*
* This will first conflate the message, if possible. If it cannot
* be conflated, it will be queued for delivery on the next cycle
* of the event loop.
*/
function postMessage(handler, msg) {
// Handle the common case a non-conflatable message first.
if (!msg.isConflatable) {
enqueueMessage(handler, msg);
return;
}
// Conflate message if possible.
var conflated = iteration_1.some(queue, function (posted) {
if (posted.handler !== handler) {
return false;
}
if (posted.msg.type !== msg.type) {
return false;
}
if (!posted.msg.isConflatable) {
return false;
}
return posted.msg.conflate(msg);
});
// If the message was not conflated, enqueue the message.
if (!conflated)
enqueueMessage(handler, msg);
}
MessageLoop.postMessage = postMessage;
/**
* Install a message hook for a handler.
*
* This will first remove the hook if it exists, then install the
* hook in front of other hooks for the handler.
*/
function installMessageHook(handler, hook) {
// Remove the message hook if it's already installed.
removeMessageHook(handler, hook);
// Install the hook at the front of the list.
var next = hooks.get(handler) || null;
hooks.set(handler, { next: next, hook: hook });
}
MessageLoop.installMessageHook = installMessageHook;
/**
* Remove a message hook for a handler, if it exists.
*/
function removeMessageHook(handler, hook) {
// Traverse the list and find the matching hook. If found, clear
// the reference to the hook and remove the node from the list.
// The node's next reference is *not* cleared so that dispatch
// may continue when the hook is removed during dispatch.
var prev = null;
var node = hooks.get(handler) || null;
for (; node !== null; prev = node, node = node.next) {
if (node.hook === hook) {
if (prev === null && node.next === null) {
hooks.delete(handler);
}
else if (prev === null) {
hooks.set(handler, node.next);
}
else {
prev.next = node.next;
}
node.hook = null;
return;
}
}
}
MessageLoop.removeMessageHook = removeMessageHook;
/**
* Clear all message data for a handler.
*
* This will remove all message hooks and clear pending messages.
*/
function clearMessageData(handler) {
// Clear all message hooks.
var node = hooks.get(handler) || null;
for (; node !== null; node = node.next) {
node.hook = null;
}
// Remove the handler from the hooks map.
hooks.delete(handler);
// Clear all pending messages.
iteration_1.each(queue, function (posted) {
if (posted.handler === handler) {
posted.handler = null;
}
});
}
MessageLoop.clearMessageData = clearMessageData;
/**
* The queue of posted message pairs.
*/
var queue = new queue_1.Queue();
/**
* A mapping of handler to list of installed message hooks.
*/
var hooks = new WeakMap();
/**
* A local reference to an event loop callback.
*/
var defer = (function () {
var ok = typeof requestAnimationFrame === 'function';
return ok ? requestAnimationFrame : setImmediate;
})();
/**
* Whether a message loop cycle is pending.
*/
var cyclePending = false;
/**
* Invoke a message hook with the specified handler and message.
*
* Returns the result of the hook, or `true` if the hook throws.
*
* Exceptions in the hook will be caught and logged.
*/
function invokeHook(hook, handler, msg) {
var result;
try {
if (typeof hook === 'function') {
result = hook(handler, msg);
}
else {
result = hook.messageHook(handler, msg);
}
}
catch (err) {
result = true;
console.error(err);
}
return result;
}
/**
* Invoke a message handler with the specified message.
*
* Exceptions in the handler will be caught and logged.
*/
function invokeHandler(handler, msg) {
try {
handler.processMessage(msg);
}
catch (err) {
console.error(err);
}
}
/**
* Add a message to the end of the message queue.
*
* This will automatically schedule a cycle of the loop.
*/
function enqueueMessage(handler, msg) {
queue.pushBack({ handler: handler, msg: msg });
scheduleMessageLoop();
}
/**
* Schedule a message loop cycle to process any pending messages.
*
* This is a no-op if a loop cycle is already pending.
*/
function scheduleMessageLoop() {
if (!cyclePending) {
defer(runMessageLoop);
cyclePending = true;
}
}
/**
* Run an iteration of the message loop.
*
* This will process all pending messages in the queue. If a message
* is added to the queue while the message loop is running, it will
* be processed on the next cycle of the loop.
*/
function runMessageLoop() {
// Clear the pending flag so the next loop can be scheduled.
cyclePending = false;
// If the queue is empty, there is nothing else to do.
if (queue.isEmpty) {
return;
}
// Add a sentinel value to the end of the queue. The queue will
// only be processed up to the sentinel. Messages posted during
// this cycle will execute on the next cycle.
var sentinel = { handler: null, msg: null };
queue.pushBack(sentinel);
// Enter the message loop.
while (!queue.isEmpty) {
// Remove the first posted message in the queue.
var posted = queue.popFront();
// If the value is the sentinel, exit the loop.
if (posted === sentinel) {
return;
}
// Dispatch the message if the handler has not been cleared.
if (posted.handler !== null) {
sendMessage(posted.handler, posted.msg);
}
}
}
})(MessageLoop || (MessageLoop = {}));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17).setImmediate))
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
var apply = Function.prototype.apply;
// DOM APIs, for completeness
exports.setTimeout = function() {
return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
};
exports.setInterval = function() {
return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
};
exports.clearTimeout =
exports.clearInterval = function(timeout) {
if (timeout) {
timeout.close();
}
};
function Timeout(id, clearFn) {
this._id = id;
this._clearFn = clearFn;
}
Timeout.prototype.unref = Timeout.prototype.ref = function() {};
Timeout.prototype.close = function() {
this._clearFn.call(window, this._id);
};
// Does not start the time, just sets up the members needed.
exports.enroll = function(item, msecs) {
clearTimeout(item._idleTimeoutId);
item._idleTimeout = msecs;
};
exports.unenroll = function(item) {
clearTimeout(item._idleTimeoutId);
item._idleTimeout = -1;
};
exports._unrefActive = exports.active = function(item) {
clearTimeout(item._idleTimeoutId);
var msecs = item._idleTimeout;
if (msecs >= 0) {
item._idleTimeoutId = setTimeout(function onTimeout() {
if (item._onTimeout)
item._onTimeout();
}, msecs);
}
};
// setimmediate attaches itself to the global object
__webpack_require__(18);
exports.setImmediate = setImmediate;
exports.clearImmediate = clearImmediate;
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process, global) {(function (global, undefined) {
"use strict";
if (global.setImmediate) {
return;
}
var nextHandle = 1; // Spec says greater than zero
var tasksByHandle = {};
var currentlyRunningATask = false;
var doc = global.document;
var registerImmediate;
function setImmediate(callback) {
// Callback can either be a function or a string
if (typeof callback !== "function") {
callback = new Function("" + callback);
}
// Copy function arguments
var args = new Array(arguments.length - 1);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i + 1];
}
// Store and register the task
var task = { callback: callback, args: args };
tasksByHandle[nextHandle] = task;
registerImmediate(nextHandle);
return nextHandle++;
}
function clearImmediate(handle) {
delete tasksByHandle[handle];
}
function run(task) {
var callback = task.callback;
var args = task.args;
switch (args.length) {
case 0:
callback();
break;
case 1:
callback(args[0]);
break;
case 2:
callback(args[0], args[1]);
break;
case 3:
callback(args[0], args[1], args[2]);
break;
default:
callback.apply(undefined, args);
break;
}
}
function runIfPresent(handle) {
// From the spec: "Wait until any invocations of this algorithm started before this one have completed."
// So if we're currently running a task, we'll need to delay this invocation.
if (currentlyRunningATask) {
// Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
// "too much recursion" error.
setTimeout(runIfPresent, 0, handle);
} else {
var task = tasksByHandle[handle];
if (task) {
currentlyRunningATask = true;
try {
run(task);
} finally {
clearImmediate(handle);
currentlyRunningATask = false;
}
}
}
}
function installNextTickImplementation() {
registerImmediate = function(handle) {
process.nextTick(function () { runIfPresent(handle); });
};
}
function canUsePostMessage() {
// The test against `importScripts` prevents this implementation from being installed inside a web worker,
// where `global.postMessage` means something completely different and can't be used for this purpose.
if (global.postMessage && !global.importScripts) {
var postMessageIsAsynchronous = true;
var oldOnMessage = global.onmessage;
global.onmessage = function() {
postMessageIsAsynchronous = false;
};
global.postMessage("", "*");
global.onmessage = oldOnMessage;
return postMessageIsAsynchronous;
}
}
function installPostMessageImplementation() {
// Installs an event handler on `global` for the `message` event: see
// * https://developer.mozilla.org/en/DOM/window.postMessage
// * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
var messagePrefix = "setImmediate$" + Math.random() + "$";
var onGlobalMessage = function(event) {
if (event.source === global &&
typeof event.data === "string" &&
event.data.indexOf(messagePrefix) === 0) {
runIfPresent(+event.data.slice(messagePrefix.length));
}
};
if (global.addEventListener) {
global.addEventListener("message", onGlobalMessage, false);
} else {
global.attachEvent("onmessage", onGlobalMessage);
}
registerImmediate = function(handle) {
global.postMessage(messagePrefix + handle, "*");
};
}
function installMessageChannelImplementation() {
var channel = new MessageChannel();
channel.port1.onmessage = function(event) {
var handle = event.data;
runIfPresent(handle);
};
registerImmediate = function(handle) {
channel.port2.postMessage(handle);
};
}
function installReadyStateChangeImplementation() {
var html = doc.documentElement;
registerImmediate = function(handle) {
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
var script = doc.createElement("script");
script.onreadystatechange = function () {
runIfPresent(handle);
script.onreadystatechange = null;
html.removeChild(script);
script = null;
};
html.appendChild(script);
};
}
function installSetTimeoutImplementation() {
registerImmediate = function(handle) {
setTimeout(runIfPresent, 0, handle);
};
}
// If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
// Don't get fooled by e.g. browserify environments.
if ({}.toString.call(global.process) === "[object process]") {
// For Node.js before 0.9
installNextTickImplementation();
} else if (canUsePostMessage()) {
// For non-IE10 modern browsers
installPostMessageImplementation();
} else if (global.MessageChannel) {
// For web workers, where supported
installMessageChannelImplementation();
} else if (doc && "onreadystatechange" in doc.createElement("script")) {
// For IE 6–8
installReadyStateChangeImplementation();
} else {
// For older browsers
installSetTimeoutImplementation();
}
attachTo.setImmediate = setImmediate;
attachTo.clearImmediate = clearImmediate;
}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9), (function() { return this; }())))
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
var iteration_1 = __webpack_require__(15);
/**
* A generic FIFO queue data structure.
*/
var Queue = (function () {
/**
* Construct a new queue.
*
* @param values - The initial values for the queue.
*/
function Queue(values) {
var _this = this;
this._length = 0;
this._front = null;
this._back = null;
if (values)
iteration_1.each(values, function (value) { _this.pushBack(value); });
}
Object.defineProperty(Queue.prototype, "isEmpty", {
/**
* Test whether the queue is empty.
*
* @returns `true` if the queue is empty, `false` otherwise.
*
* #### Notes
* This is a read-only property.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*/
get: function () {
return this._length === 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Queue.prototype, "length", {
/**
* Get the length of the queue.
*
* @return The number of values in the queue.
*
* #### Notes
* This is a read-only property.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*/
get: function () {
return this._length;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Queue.prototype, "front", {
/**
* Get the value at the front of the queue.
*
* @returns The value at the front of the queue, or `undefined` if
* the queue is empty.
*
* #### Notes
* This is a read-only property.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*/
get: function () {
return this._front ? this._front.value : void 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Queue.prototype, "back", {
/**
* Get the value at the back of the queue.
*
* @returns The value at the back of the queue, or `undefined` if
* the queue is empty.
*
* #### Notes
* This is a read-only property.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*/
get: function () {
return this._back ? this._back.value : void 0;
},
enumerable: true,
configurable: true
});
/**
* Create an iterator over the values in the queue.
*
* @returns A new iterator starting at the front of the queue.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*/
Queue.prototype.iter = function () {
return new QueueIterator(this._front);
};
/**
* Add a value to the back of the queue.
*
* @param value - The value to add to the back of the queue.
*
* @returns The new length of the queue.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*/
Queue.prototype.pushBack = function (value) {
var node = new QueueNode(value);
if (this._length === 0) {
this._front = node;
this._back = node;
}
else {
this._back.next = node;
this._back = node;
}
return ++this._length;
};
/**
* Remove and return the value at the front of the queue.
*
* @returns The value at the front of the queue, or `undefined` if
* the queue is empty.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* Iterators pointing at the removed value are invalidated.
*/
Queue.prototype.popFront = function () {
if (this._length === 0) {
return void 0;
}
var node = this._front;
if (this._length === 1) {
this._front = null;
this._back = null;
}
else {
this._front = node.next;
node.next = null;
}
this._length--;
return node.value;
};
/**
* Remove all values from the queue.
*
* #### Complexity
* Linear.
*
* #### Iterator Validity
* All current iterators are invalidated.
*/
Queue.prototype.clear = function () {
var node = this._front;
while (node) {
var next = node.next;
node.next = null;
node = next;
}
this._length = 0;
this._front = null;
this._back = null;
};
/**
* Swap the contents of the queue with the contents of another.
*
* @param other - The other queue holding the contents to swap.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* All current iterators remain valid, but will now point to the
* contents of the other queue involved in the swap.
*/
Queue.prototype.swap = function (other) {
var length = other._length;
var front = other._front;
var back = other._back;
other._length = this._length;
other._front = this._front;
other._back = this._back;
this._length = length;
this._front = front;
this._back = back;
};
return Queue;
}());
exports.Queue = Queue;
/**
* An iterator for a queue.
*/
var QueueIterator = (function () {
/**
* Construct a new queue iterator.
*
* @param node - The node at the front of range.
*/
function QueueIterator(node) {
this._node = node;
}
/**
* Create an iterator over the object's values.
*
* @returns A reference to `this` iterator.
*/
QueueIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the queue iterator.
*
* @returns A new iterator starting with the current value.
*/
QueueIterator.prototype.clone = function () {
return new QueueIterator(this._node);
};
/**
* Get the next value from the queue.
*
* @returns The next value from the queue, or `undefined` if the
* iterator is exhausted.
*/
QueueIterator.prototype.next = function () {
if (!this._node) {
return void 0;
}
var value = this._node.value;
this._node = this._node.next;
return value;
};
return QueueIterator;
}());
/**
* The node type for a queue.
*/
var QueueNode = (function () {
/**
* Construct a new queue node.
*
* @param value - The value for the node.
*/
function QueueNode(value) {
/**
* The next node the queue.
*/
this.next = null;
this.value = value;
}
return QueueNode;
}());
/***/ },
/* 20 */
/***/ function(module, exports) {
"use strict";
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* A class which attaches a value to an external object.
*
* #### Notes
* Attached properties are used to extend the state of an object with
* semantic data from an unrelated class. They also encapsulate value
* creation, coercion, and notification.
*
* Because attached property values are stored in a hash table, which
* in turn is stored in a WeakMap keyed on the owner object, there is
* non-trivial storage overhead involved in their use. The pattern is
* therefore best used for the storage of rare data.
*/
var AttachedProperty = (function () {
/**
* Construct a new attached property.
*
* @param options - The options for initializing the property.
*/
function AttachedProperty(options) {
this._pid = nextPID();
this._name = options.name;
this._value = options.value;
this._create = options.create;
this._coerce = options.coerce;
this._compare = options.compare;
this._changed = options.changed;
}
Object.defineProperty(AttachedProperty.prototype, "name", {
/**
* Get the human readable name for the property.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return this._name;
},
enumerable: true,
configurable: true
});
/**
* Get the current value of the property for a given owner.
*
* @param owner - The property owner of interest.
*
* @returns The current value of the property.
*
* #### Notes
* If the value has not yet been set, the default value will be
* computed and assigned as the current value of the property.
*/
AttachedProperty.prototype.get = function (owner) {
var value;
var map = ensureMap(owner);
if (this._pid in map) {
value = map[this._pid];
}
else {
value = map[this._pid] = this._createValue(owner);
}
return value;
};
/**
* Set the current value of the property for a given owner.
*
* @param owner - The property owner of interest.
*
* @param value - The value for the property.
*
* #### Notes
* If the value has not yet been set, the default value will be
* computed and used as the previous value for the comparison.
*/
AttachedProperty.prototype.set = function (owner, value) {
var oldValue;
var map = ensureMap(owner);
if (this._pid in map) {
oldValue = map[this._pid];
}
else {
oldValue = map[this._pid] = this._createValue(owner);
}
var newValue = this._coerceValue(owner, value);
this._maybeNotify(owner, oldValue, map[this._pid] = newValue);
};
/**
* Explicitly coerce the current property value for a given owner.
*
* @param owner - The property owner of interest.
*
* #### Notes
* If the value has not yet been set, the default value will be
* computed and used as the previous value for the comparison.
*/
AttachedProperty.prototype.coerce = function (owner) {
var oldValue;
var map = ensureMap(owner);
if (this._pid in map) {
oldValue = map[this._pid];
}
else {
oldValue = map[this._pid] = this._createValue(owner);
}
var newValue = this._coerceValue(owner, oldValue);
this._maybeNotify(owner, oldValue, map[this._pid] = newValue);
};
/**
* Get or create the default value for the given owner.
*/
AttachedProperty.prototype._createValue = function (owner) {
var create = this._create;
return create ? create(owner) : this._value;
};
/**
* Coerce the value for the given owner.
*/
AttachedProperty.prototype._coerceValue = function (owner, value) {
var coerce = this._coerce;
return coerce ? coerce(owner, value) : value;
};
/**
* Compare the old value and new value for equality.
*/
AttachedProperty.prototype._compareValue = function (oldValue, newValue) {
var compare = this._compare;
return compare ? compare(oldValue, newValue) : oldValue === newValue;
};
/**
* Run the change notification if the given values are different.
*/
AttachedProperty.prototype._maybeNotify = function (owner, oldValue, newValue) {
if (!this._changed || this._compareValue(oldValue, newValue)) {
return;
}
this._changed.call(void 0, owner, oldValue, newValue);
};
return AttachedProperty;
}());
exports.AttachedProperty = AttachedProperty;
/**
* Clear the stored property data for the given property owner.
*
* @param owner - The property owner of interest.
*
* #### Notes
* This will clear all property values for the owner, but it will
* **not** run the change notification for any of the properties.
*/
function clearPropertyData(owner) {
ownerData.delete(owner);
}
exports.clearPropertyData = clearPropertyData;
/**
* A weak mapping of property owner to property map.
*/
var ownerData = new WeakMap();
/**
* A function which computes successive unique property ids.
*/
var nextPID = (function () {
var id = 0;
return function () {
var rand = Math.random();
var stem = ("" + rand).slice(2);
return "pid-" + stem + "-" + id++;
};
})();
/**
* Lookup the data map for the property owner.
*
* This will create the map if one does not already exist.
*/
function ensureMap(owner) {
var map = ownerData.get(owner);
if (map !== void 0)
return map;
map = Object.create(null);
ownerData.set(owner, map);
return map;
}
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(setImmediate) {"use strict";
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Define a signal property on a prototype object.
*
* @param target - The prototype for the class of interest.
*
* @param name - The name of the signal property.
*
* #### Notes
* The defined signal property is read-only.
*
* #### Example
* ```typescript
* class SomeClass {
* valueChanged: ISignal<SomeClass, number>;
* }
*
* defineSignal(SomeClass.prototype, 'valueChanged');
*/
function defineSignal(target, name) {
var token = Object.freeze({});
Object.defineProperty(target, name, {
get: function () { return new Signal(this, token); }
});
}
exports.defineSignal = defineSignal;
/**
* Remove all connections where the given object is the sender.
*
* @param sender - The sender object of interest.
*
* #### Example
* ```typescript
* disconnectSender(someObject);
* ```
*/
function disconnectSender(sender) {
// If there are no receivers, there is nothing to do.
var receiverList = senderData.get(sender);
if (receiverList === void 0) {
return;
}
// Clear the connections and schedule a cleanup of the
// receiver's corresponding list of sender connections.
for (var i = 0, n = receiverList.length; i < n; ++i) {
var conn = receiverList[i];
var senderList = receiverData.get(conn.thisArg || conn.slot);
scheduleCleanup(senderList);
conn.token = null;
}
// Schedule a cleanup of the receiver list.
scheduleCleanup(receiverList);
}
exports.disconnectSender = disconnectSender;
/**
* Remove all connections where the given object is the receiver.
*
* @param receiver - The receiver object of interest.
*
* #### Notes
* If a `thisArg` is provided when connecting a signal, that object
* is considered the receiver. Otherwise, the `callback` is used as
* the receiver.
*
* #### Example
* ```typescript
* // disconnect a regular object receiver
* disconnectReceiver(myObject);
*
* // disconnect a plain callback receiver
* disconnectReceiver(myCallback);
* ```
*/
function disconnectReceiver(receiver) {
// If there are no senders, there is nothing to do.
var senderList = receiverData.get(receiver);
if (senderList === void 0) {
return;
}
// Clear the connections and schedule a cleanup of the
// senders's corresponding list of receiver connections.
for (var i = 0, n = senderList.length; i < n; ++i) {
var conn = senderList[i];
var receiverList = senderData.get(conn.sender);
scheduleCleanup(receiverList);
conn.token = null;
}
// Schedule a cleanup of the sender list.
scheduleCleanup(senderList);
}
exports.disconnectReceiver = disconnectReceiver;
/**
* Clear all signal data associated with the given object.
*
* @param obj - The object for which the signal data should be cleared.
*
* #### Notes
* This removes all signal connections where the object is used as
* either the sender or the receiver.
*
* #### Example
* ```typescript
* clearSignalData(someObject);
* ```
*/
function clearSignalData(obj) {
disconnectSender(obj);
disconnectReceiver(obj);
}
exports.clearSignalData = clearSignalData;
/**
* A concrete implementation of `ISignal`.
*/
var Signal = (function () {
/**
* Construct a new signal.
*
* @param sender - The object which owns the signal.
*
* @param token - The unique token identifying the signal.
*/
function Signal(sender, token) {
this._sender = sender;
this._token = token;
}
/**
* Connect a slot to the signal.
*
* @param slot - The slot to invoke when the signal is emitted.
*
* @param thisArg - The `this` context for the slot. If provided,
* this must be a non-primitive object.
*
* @returns `true` if the connection succeeds, `false` otherwise.
*/
Signal.prototype.connect = function (slot, thisArg) {
return connect(this._sender, this._token, slot, thisArg);
};
/**
* Disconnect a slot from the signal.
*
* @param slot - The slot to disconnect from the signal.
*
* @param thisArg - The `this` context for the slot. If provided,
* this must be a non-primitive object.
*
* @returns `true` if the connection is removed, `false` otherwise.
*/
Signal.prototype.disconnect = function (slot, thisArg) {
return disconnect(this._sender, this._token, slot, thisArg);
};
/**
* Emit the signal and invoke the connected slots.
*
* @param args - The args to pass to the connected slots.
*/
Signal.prototype.emit = function (args) {
emit(this._sender, this._token, args);
};
return Signal;
}());
/**
* A weak mapping of sender to list of receiver connections.
*/
var senderData = new WeakMap();
/**
* A weak mapping of receiver to list of sender connections.
*/
var receiverData = new WeakMap();
/**
* A set of connection lists which are pending cleanup.
*/
var dirtySet = new Set();
/**
* A local reference to an event loop callback.
*/
var defer = (function () {
var ok = typeof requestAnimationFrame === 'function';
return ok ? requestAnimationFrame : setImmediate;
})();
/**
* Connect a slot to a signal.
*
* @param sender - The object emitting the signal.
*
* @param token - The unique token for the signal.
*
* @param slot - The slot to connect to the signal.
*
* @param thisArg - The `this` context for the slot.
*
* @returns `true` if the connection succeeds, `false` otherwise.
*
* #### Notes
* Signal connections are unique. If a connection already exists for
* the given `slot` and `thisArg`, this function returns `false`.
*
* A newly connected slot will not be invoked until the next time the
* signal is emitted, even if the slot is connected while the signal
* is dispatching.
*/
function connect(sender, token, slot, thisArg) {
// Coerce a `null` thisArg to `undefined`.
thisArg = thisArg || void 0;
// Ensure the sender's receiver list is created.
var receiverList = senderData.get(sender);
if (receiverList === void 0) {
receiverList = [];
senderData.set(sender, receiverList);
}
// Bail if a matching connection already exists.
if (findConnection(receiverList, token, slot, thisArg) !== null) {
return false;
}
// Ensure the receiver's sender list is created.
var receiver = thisArg || slot;
var senderList = receiverData.get(receiver);
if (senderList === void 0) {
senderList = [];
receiverData.set(receiver, senderList);
}
// Create a new connection and add it to the end of each list.
var connection = { sender: sender, token: token, slot: slot, thisArg: thisArg };
receiverList.push(connection);
senderList.push(connection);
// Indicate a successful connection.
return true;
}
/**
* Disconnect a slot from a signal.
*
* @param sender - The object emitting the signal.
*
* @param token - The unique token for the signal.
*
* @param slot - The slot to disconnect from the signal.
*
* @param thisArg - The `this` context for the slot.
*
* @returns `true` if the connection is removed, `false` otherwise.
*
* #### Notes
* If no connection exists for the given `slot` and `thisArg`, this
* function returns `false`.
*
* A disconnected slot will no longer be invoked, even if the slot
* is disconnected while the signal is dispatching.
*/
function disconnect(sender, token, slot, thisArg) {
// Coerce a `null` thisArg to `undefined`.
thisArg = thisArg || void 0;
// Lookup the list of receivers, and bail if none exist.
var receiverList = senderData.get(sender);
if (receiverList === void 0) {
return false;
}
// Bail if no matching connection exits.
var conn = findConnection(receiverList, token, slot, thisArg);
if (conn === null) {
return false;
}
// Lookup the list of senders, which is now known to exist.
var senderList = receiverData.get(thisArg || slot);
// Clear the connection and schedule list cleanup.
conn.token = null;
scheduleCleanup(receiverList);
scheduleCleanup(senderList);
// Indicate a successful disconnection.
return true;
}
/**
* Emit a signal and invoke the connected slots.
*
* @param sender - The object emitting the signal.
*
* @param token - The unique token for the signal.
*
* @param args - The args to pass to the connected slots.
*
* #### Notes
* Connected slots are invoked synchronously, in the order in which
* they are connected.
*
* Exceptions thrown by connected slots will be caught and logged.
*/
function emit(sender, token, args) {
// If there are no receivers, there is nothing to do.
var receiverList = senderData.get(sender);
if (receiverList === void 0) {
return;
}
// Invoke the connections which match the given token.
for (var i = 0, n = receiverList.length; i < n; ++i) {
var conn = receiverList[i];
if (conn.token === token) {
invokeSlot(conn, args);
}
}
}
/**
* Safely invoke a non-empty connection.
*
* @param conn - The connection of interest
*
* @param args - The arguments to pass to the slot.
*
* #### Notes
* Any exception thrown by the slot will be caught and logged.
*/
function invokeSlot(conn, args) {
try {
conn.slot.call(conn.thisArg, conn.sender, args);
}
catch (err) {
console.error(err);
}
}
/**
* Find a connection which matches the given parameters.
*
* @param list - The list of connections to search.
*
* @param token - The unique token for the signal.
*
* @param slot - The slot of interest.
*
* @param thisArg - The `this` context for the slot.
*
* @returns The first connection which matches the supplied parameters,
* or null if no matching connection is found.
*/
function findConnection(list, token, slot, thisArg) {
for (var i = 0, n = list.length; i < n; ++i) {
var conn = list[i];
if (conn.token === token &&
conn.slot === slot &&
conn.thisArg === thisArg) {
return conn;
}
}
return null;
}
/**
* Schedule a cleanup of a connection list.
*
* @param list - The list of connections to cleanup.
*
* #### Notes
* This will add the list to the dirty set and schedule a deferred
* cleanup of the list contents. On cleanup, any connection with a
* null token will be removed from the array.
*/
function scheduleCleanup(list) {
if (dirtySet.size === 0) {
defer(cleanupDirtySet);
}
dirtySet.add(list);
}
/**
* Cleanup the connection lists in the dirty set.
*
* #### Notes
* This function should only be invoked asynchronously, when the stack
* frame is guaranteed to not be on the path of a signal dispatch.
*/
function cleanupDirtySet() {
dirtySet.forEach(cleanupList);
dirtySet.clear();
}
/**
* Cleanup the dirty connections in a connection list.
*
* @param list - The list of connection to cleanup.
*
* #### Notes
* This will remove any connection with a null token from the list,
* while retaining the relative order of the other connections.
*
* This function should only be invoked asynchronously, when the stack
* frame is guaranteed to not be on the path of a signal dispatch.
*/
function cleanupList(list) {
var count = 0;
for (var i = 0, n = list.length; i < n; ++i) {
var conn = list[i];
if (conn.token === null) {
count++;
}
else {
list[i - count] = conn;
}
}
list.length -= count;
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17).setImmediate))
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
var signaling_1 = __webpack_require__(21);
/**
* An object which holds data related to a widget's title.
*
* #### Notes
* A title object is intended to hold the data necessary to display a
* header for a particular widget. A common example is the `TabPanel`,
* which uses the widget title to populate the tab for a child widget.
*/
var Title = (function () {
/**
* Construct a new title.
*
* @param options - The options for initializing the title.
*/
function Title(options) {
if (options === void 0) { options = {}; }
this._label = '';
this._icon = '';
this._caption = '';
this._mnemonic = -1;
this._className = '';
this._closable = false;
this._owner = null;
if (options.owner !== void 0) {
this._owner = options.owner;
}
if (options.label !== void 0) {
this._label = options.label;
}
if (options.mnemonic !== void 0) {
this._mnemonic = options.mnemonic;
}
if (options.icon !== void 0) {
this._icon = options.icon;
}
if (options.caption !== void 0) {
this._caption = options.caption;
}
if (options.closable !== void 0) {
this._closable = options.closable;
}
if (options.className !== void 0) {
this._className = options.className;
}
}
Object.defineProperty(Title.prototype, "owner", {
/**
* Get the object which owns the title.
*
* #### Notes
* This will be `null` if the title has no owner.
*
* This is a read-only property.
*/
get: function () {
return this._owner;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Title.prototype, "label", {
/**
* Get the label for the title.
*
* #### Notes
* The default value is an empty string.
*/
get: function () {
return this._label;
},
/**
* Set the label for the title.
*/
set: function (value) {
if (this._label === value) {
return;
}
this._label = value;
this.changed.emit(void 0);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Title.prototype, "mnemonic", {
/**
* Get the mnemonic index for the title.
*
* #### Notes
* The default value is `-1`.
*/
get: function () {
return this._mnemonic;
},
/**
* Set the mnemonic index for the title.
*/
set: function (value) {
if (this._mnemonic === value) {
return;
}
this._mnemonic = value;
this.changed.emit(void 0);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Title.prototype, "icon", {
/**
* Get the icon class name for the title.
*
* #### Notes
* The default value is an empty string.
*/
get: function () {
return this._icon;
},
/**
* Set the icon class name for the title.
*
* #### Notes
* Multiple class names can be separated with whitespace.
*/
set: function (value) {
if (this._icon === value) {
return;
}
this._icon = value;
this.changed.emit(void 0);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Title.prototype, "caption", {
/**
* Get the caption for the title.
*
* #### Notes
* The default value is an empty string.
*/
get: function () {
return this._caption;
},
/**
* Set the caption for the title.
*/
set: function (value) {
if (this._caption === value) {
return;
}
this._caption = value;
this.changed.emit(void 0);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Title.prototype, "className", {
/**
* Get the extra class name for the title.
*
* #### Notes
* The default value is an empty string.
*/
get: function () {
return this._className;
},
/**
* Set the extra class name for the title.
*
* #### Notes
* Multiple class names can be separated with whitespace.
*/
set: function (value) {
if (this._className === value) {
return;
}
this._className = value;
this.changed.emit(void 0);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Title.prototype, "closable", {
/**
* Get the closable state for the title.
*
* #### Notes
* The default value is `false`.
*/
get: function () {
return this._closable;
},
/**
* Set the closable state for the title.
*
* #### Notes
* This controls the presence of a close icon when applicable.
*/
set: function (value) {
if (this._closable === value) {
return;
}
this._closable = value;
this.changed.emit(void 0);
},
enumerable: true,
configurable: true
});
return Title;
}());
exports.Title = Title;
// Define the signals for the `Title` class.
signaling_1.defineSignal(Title.prototype, 'changed');
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
// widget_core implements some common patterns for the core widget collection
// that are not to be used directly by third-party widget authors.
var widget_1 = __webpack_require__(11);
var _ = __webpack_require__(2);
var semver_range = '^' + __webpack_require__(24).version;
var CoreWidgetModel = (function (_super) {
__extends(CoreWidgetModel, _super);
function CoreWidgetModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
CoreWidgetModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'CoreWidgetModel',
_model_module_version: semver_range,
_view_module_version: semver_range
});
};
return CoreWidgetModel;
}(widget_1.WidgetModel));
exports.CoreWidgetModel = CoreWidgetModel;
var CoreDOMWidgetModel = (function (_super) {
__extends(CoreDOMWidgetModel, _super);
function CoreDOMWidgetModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
CoreDOMWidgetModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'CoreDOMWidgetModel',
_model_module_version: semver_range,
_view_module_version: semver_range
});
};
return CoreDOMWidgetModel;
}(widget_1.DOMWidgetModel));
exports.CoreDOMWidgetModel = CoreDOMWidgetModel;
var CoreLabeledDOMWidgetModel = (function (_super) {
__extends(CoreLabeledDOMWidgetModel, _super);
function CoreLabeledDOMWidgetModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
CoreLabeledDOMWidgetModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'CoreLabeledDOMWidgetModel',
_model_module_version: semver_range,
_view_module_version: semver_range
});
};
return CoreLabeledDOMWidgetModel;
}(widget_1.LabeledDOMWidgetModel));
exports.CoreLabeledDOMWidgetModel = CoreLabeledDOMWidgetModel;
/***/ },
/* 24 */
/***/ function(module, exports) {
module.exports = {
"name": "jupyter-js-widgets",
"version": "2.1.4",
"description": "Jupyter interactive widgets",
"author": "Project Jupyter",
"license": "BSD-3-Clause",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/ipython/ipywidgets.git"
},
"files": [
"lib/**/*.d.ts",
"lib/**/*.js",
"css/*.css",
"dist/"
],
"scripts": {
"clean:src": "rimraf lib",
"clean:embed": "rimraf lib-embed",
"clean": "npm run clean:src && npm run clean:embed",
"build:test": "tsc --project test/src && webpack --config test/webpack.conf.js",
"build:src": "tsc --project src",
"build:src-embed": "tsc --project src-embed",
"build:css": "postcss --use postcss-import --use postcss-cssnext -o css/widgets.built.css css/widgets.css",
"build": "npm run build:src && npm run build:src-embed && npm run build:css && webpack",
"docs": "npm run docs:src && npm run docs:embed",
"docs:src": "typedoc --mode file --module commonjs --excludeNotExported --target es5 --moduleResolution node --out docs/ src",
"docs:embed": "typedoc --mode file --module commonjs --excludeNotExported --target es5 --moduleResolution node --out docs-embed/ src-embed",
"prepublish": "npm run build",
"test": "npm run test:unit && npm run test:examples",
"test:coverage": "npm run build:test && webpack --config test/webpack-cov.conf.js && karma start test/karma-cov.conf.js",
"test:unit": "npm run test:unit:firefox && npm run test:unit:chrome",
"test:unit:default": "npm run build:test && karma start test/karma.conf.js --log-level debug",
"test:unit:firefox": "npm run test:unit:default -- --browsers=Firefox",
"test:unit:chrome": "npm run test:unit:default -- --browsers=Chrome",
"test:unit:ie": "npm run test:unit:default -- --browsers=IE",
"test:examples": "npm run test:examples:chrome && npm run test:examples:firefox",
"test:examples:chrome": "npm-run-all \"test:example:*\"",
"test:examples:firefox": "npm-run-all \"test:example:* -- -- --browsers Firefox\"",
"test:example:web2": "cd examples/web2 && npm install && npm run test:default",
"test:example:web3": "cd examples/web3 && npm install && npm run test:default",
"test:example:web4": "cd examples/web4 && npm install && npm run test:default",
"test:example:web5": "cd examples/web5 && npm install && npm run test:default"
},
"devDependencies": {
"@types/expect.js": "^0.3.29",
"@types/mathjax": "0.0.31",
"@types/mocha": "2.2.32",
"@types/requirejs": "^2.1.28",
"@types/sinon": "^1.16.31",
"cpx": "^1.5.0",
"css-loader": "^0.23.1",
"es6-promise": "^3.1.2",
"expect.js": "^0.3.1",
"file-loader": "^0.8.5",
"istanbul-instrumenter-loader": "^0.2.0",
"json-loader": "^0.5.4",
"karma": "^0.13.15",
"karma-chrome-launcher": "^0.2.2",
"karma-coverage": "^1.0.0",
"karma-firefox-launcher": "^0.1.7",
"karma-ie-launcher": "^1.0.0",
"karma-mocha": "^0.2.1",
"karma-mocha-reporter": "^1.1.3",
"karma-webpack": "^1.7.0",
"mocha": "^2.3.4",
"npm-run-all": "^1.5.1",
"postcss-cli": "^2.6.0",
"postcss-cssnext": "^2.8.0",
"postcss-import": "^8.1.2",
"postcss-loader": "^1.3.2",
"rimraf": "^2.4.1",
"sinon": "^1.17.2",
"spawn-sync": "^1.0.14",
"style-loader": "^0.13.1",
"typedoc": "^0.5.0",
"typescript": "~2.0.10",
"url-loader": "^0.5.7",
"webpack": "^1.12.11"
},
"dependencies": {
"@jupyterlab/services": "^0.35.0",
"@types/backbone": "^1.3.33",
"@types/semver": "^5.3.30",
"ajv": "^4.9.0",
"backbone": "1.2.0",
"d3-format": "^0.5.1",
"font-awesome": "^4.5.0",
"jquery": "^3.1.1",
"jquery-ui": "^1.12.1",
"jupyter-widgets-schema": "^0.1.1",
"lolex": "^1.4.0",
"phosphor": "^0.7.0",
"scriptjs": "^2.5.8",
"semver": "^5.1.0",
"underscore": "^1.8.3"
}
};
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_1 = __webpack_require__(11);
var widget_core_1 = __webpack_require__(23);
var _ = __webpack_require__(2);
/**
* css properties exposed by the layout widget with their default values.
*/
var css_properties = {
align_content: null,
align_items: null,
align_self: null,
border: null,
bottom: null,
display: null,
flex: null,
flex_flow: null,
height: null,
justify_content: null,
left: null,
margin: null,
max_height: null,
max_width: null,
min_height: null,
min_width: null,
overflow: null,
overflow_x: null,
overflow_y: null,
order: null,
padding: null,
right: null,
top: null,
visibility: null,
width: null
};
var LayoutModel = (function (_super) {
__extends(LayoutModel, _super);
function LayoutModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
LayoutModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'LayoutModel',
_view_name: 'LayoutView'
}, css_properties);
};
return LayoutModel;
}(widget_core_1.CoreWidgetModel));
exports.LayoutModel = LayoutModel;
var LayoutView = (function (_super) {
__extends(LayoutView, _super);
function LayoutView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Public constructor
*/
LayoutView.prototype.initialize = function (parameters) {
this._traitNames = [];
_super.prototype.initialize.call(this, parameters);
// Register the traits that live on the Python side
for (var _i = 0, _a = Object.keys(css_properties); _i < _a.length; _i++) {
var key = _a[_i];
this.registerTrait(key);
}
};
/**
* Register a CSS trait that is known by the model
* @param trait
*/
LayoutView.prototype.registerTrait = function (trait) {
var _this = this;
this._traitNames.push(trait);
// Listen to changes, and set the value on change.
this.listenTo(this.model, 'change:' + trait, function (model, value) {
_this.handleChange(trait, value);
});
// Set the initial value on display.
this.handleChange(trait, this.model.get(trait));
};
/**
* Get the the name of the css property from the trait name
* @param model attribute name
* @return css property name
*/
LayoutView.prototype.css_name = function (trait) {
return trait.replace('_', '-');
};
/**
* Handles when a trait value changes
*/
LayoutView.prototype.handleChange = function (trait, value) {
// should be synchronous so that we can measure later.
var parent = this.options.parent;
if (parent) {
if (value === null) {
parent.el.style.removeProperty(this.css_name(trait));
}
else {
parent.el.style[this.css_name(trait)] = value;
}
}
else {
console.warn('Style not applied because a parent view does not exist');
}
};
/**
* Remove the styling from the parent view.
*/
LayoutView.prototype.unlayout = function () {
var _this = this;
var parent = this.options.parent;
this._traitNames.forEach(function (trait) {
if (parent) {
parent.el.style.removeProperty(_this.css_name(trait));
}
else {
console.warn('Style not removed because a parent view does not exist');
}
}, this);
};
return LayoutView;
}(widget_1.WidgetView));
exports.LayoutView = LayoutView;
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_1 = __webpack_require__(11);
var widget_core_1 = __webpack_require__(23);
var _ = __webpack_require__(2);
var StyleModel = (function (_super) {
__extends(StyleModel, _super);
function StyleModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
StyleModel.prototype.defaults = function () {
var Derived = this.constructor;
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'StyleModel',
_view_name: 'StyleView',
}, _.reduce(Object.keys(Derived.styleProperties), function (obj, key) {
obj[key] = Derived.styleProperties[key].default;
return obj;
}, {}));
};
StyleModel.styleProperties = {};
return StyleModel;
}(widget_core_1.CoreWidgetModel));
exports.StyleModel = StyleModel;
var StyleView = (function (_super) {
__extends(StyleView, _super);
function StyleView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Public constructor
*/
StyleView.prototype.initialize = function (parameters) {
this._traitNames = [];
_super.prototype.initialize.call(this, parameters);
// Register the traits that live on the Python side
var ModelType = this.model.constructor;
for (var _i = 0, _a = Object.keys(ModelType.styleProperties); _i < _a.length; _i++) {
var key = _a[_i];
this.registerTrait(key);
}
};
/**
* Register a CSS trait that is known by the model
* @param trait
*/
StyleView.prototype.registerTrait = function (trait) {
var _this = this;
this._traitNames.push(trait);
// Listen to changes, and set the value on change.
this.listenTo(this.model, 'change:' + trait, function (model, value) {
_this.handleChange(trait, value);
});
// Set the initial value on display.
this.handleChange(trait, this.model.get(trait));
};
/**
* Handles when a trait value changes
*/
StyleView.prototype.handleChange = function (trait, value) {
// should be synchronous so that we can measure later.
var parent = this.options.parent;
if (parent) {
var ModelType = this.model.constructor;
var styleProperties = ModelType.styleProperties;
var attribute = styleProperties[trait].attribute;
var selector = styleProperties[trait].selector;
var elements = selector ? parent.el.querySelectorAll(selector) : [parent.el];
if (value === null) {
for (var i = 0; i !== elements.length; ++i) {
elements[i].style.removeProperty(attribute);
}
}
else {
for (var i = 0; i !== elements.length; ++i) {
elements[i].style[attribute] = value;
}
}
}
else {
console.warn('Style not applied because a parent view does not exist');
}
};
/**
* Remove the styling from the parent view.
*/
StyleView.prototype.unstyle = function () {
var parent = this.options.parent;
var ModelType = this.model.constructor;
var styleProperties = ModelType.styleProperties;
this._traitNames.forEach(function (trait) {
if (parent) {
var attribute = styleProperties[trait].attribute;
var selector = styleProperties[trait].selector;
var elements = selector ? parent.el.querySelectorAll(selector) : [parent.el];
for (var i = 0; i !== elements.length; ++i) {
elements[i].style.removeProperty(attribute);
}
}
else {
console.warn('Style not removed because a parent view does not exist');
}
}, this);
};
return StyleView;
}(widget_1.WidgetView));
exports.StyleView = StyleView;
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_1 = __webpack_require__(11);
var widget_core_1 = __webpack_require__(23);
var _ = __webpack_require__(2);
var DirectionalLinkModel = (function (_super) {
__extends(DirectionalLinkModel, _super);
function DirectionalLinkModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
DirectionalLinkModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
target: undefined,
source: undefined,
_model_name: 'DirectionalLinkModel'
});
};
DirectionalLinkModel.prototype.initialize = function (attributes, options) {
_super.prototype.initialize.call(this, attributes, options);
this.on('change', this.updateBindings, this);
this.updateBindings();
};
DirectionalLinkModel.prototype.updateValue = function (sourceModel, sourceAttr, targetModel, targetAttr) {
if (this._updating) {
return;
}
this._updating = true;
try {
if (targetModel) {
targetModel.set(targetAttr, sourceModel.get(sourceAttr));
targetModel.save_changes();
}
}
finally {
this._updating = false;
}
};
DirectionalLinkModel.prototype.updateBindings = function () {
var _this = this;
this.cleanup();
_a = this.get('source') || [null, null], this.sourceModel = _a[0], this.sourceAttr = _a[1];
_b = this.get('target') || [null, null], this.targetModel = _b[0], this.targetAttr = _b[1];
if (this.sourceModel) {
this.listenTo(this.sourceModel, 'change:' + this.sourceAttr, function () {
_this.updateValue(_this.sourceModel, _this.sourceAttr, _this.targetModel, _this.targetAttr);
});
this.updateValue(this.sourceModel, this.sourceAttr, this.targetModel, this.targetAttr);
this.listenToOnce(this.sourceModel, 'destroy', this.cleanup);
}
if (this.targetModel) {
this.listenToOnce(this.targetModel, 'destroy', this.cleanup);
}
var _a, _b;
};
DirectionalLinkModel.prototype.cleanup = function () {
// Stop listening to 'change' and 'destroy' events of the source and target
if (this.sourceModel) {
this.stopListening(this.sourceModel, 'change:' + this.sourceAttr, null);
this.stopListening(this.sourceModel, 'destroy', null);
}
if (this.targetModel) {
this.stopListening(this.targetModel, 'destroy', null);
}
};
DirectionalLinkModel.serializers = _.extend({
target: { deserialize: widget_1.unpack_models },
source: { deserialize: widget_1.unpack_models }
}, widget_core_1.CoreWidgetModel.serializers);
return DirectionalLinkModel;
}(widget_core_1.CoreWidgetModel));
exports.DirectionalLinkModel = DirectionalLinkModel;
var LinkModel = (function (_super) {
__extends(LinkModel, _super);
function LinkModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
LinkModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'LinkModel'
});
};
LinkModel.prototype.updateBindings = function () {
var _this = this;
_super.prototype.updateBindings.call(this);
if (this.targetModel) {
this.listenTo(this.targetModel, 'change:' + this.targetAttr, function () {
_this.updateValue(_this.targetModel, _this.targetAttr, _this.sourceModel, _this.sourceAttr);
});
}
};
LinkModel.prototype.cleanup = function () {
_super.prototype.cleanup.call(this);
if (this.targetModel) {
this.stopListening(this.targetModel, 'change:' + this.targetAttr, null);
}
};
return LinkModel;
}(DirectionalLinkModel));
exports.LinkModel = LinkModel;
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_core_1 = __webpack_require__(23);
var widget_1 = __webpack_require__(11);
var _ = __webpack_require__(2);
var BoolModel = (function (_super) {
__extends(BoolModel, _super);
function BoolModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
BoolModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
value: false,
disabled: false,
_model_name: 'BoolModel'
});
};
return BoolModel;
}(widget_core_1.CoreLabeledDOMWidgetModel));
exports.BoolModel = BoolModel;
var CheckboxModel = (function (_super) {
__extends(CheckboxModel, _super);
function CheckboxModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
CheckboxModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_view_name: 'CheckboxView',
_model_name: 'CheckboxModel'
});
};
return CheckboxModel;
}(widget_core_1.CoreLabeledDOMWidgetModel));
exports.CheckboxModel = CheckboxModel;
var CheckboxView = (function (_super) {
__extends(CheckboxView, _super);
function CheckboxView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Called when view is rendered.
*/
CheckboxView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-checkbox');
this.checkbox = document.createElement('input');
this.checkbox.setAttribute('type', 'checkbox');
this.el.appendChild(this.checkbox);
this.update(); // Set defaults.
};
CheckboxView.prototype.events = function () {
return {
'click input[type="checkbox"]': '_handle_click'
};
};
/**
* Handles when the checkbox is clicked.
*
* Calling model.set will trigger all of the other views of the
* model to update.
*/
CheckboxView.prototype._handle_click = function () {
var value = this.model.get('value');
this.model.set('value', !value, { updated_view: this });
this.touch();
};
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
CheckboxView.prototype.update = function (options) {
this.checkbox.checked = this.model.get('value');
if (options === undefined || options.updated_view != this) {
this.checkbox.disabled = this.model.get('disabled');
}
return _super.prototype.update.call(this);
};
return CheckboxView;
}(widget_1.LabeledDOMWidgetView));
exports.CheckboxView = CheckboxView;
var ToggleButtonModel = (function (_super) {
__extends(ToggleButtonModel, _super);
function ToggleButtonModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ToggleButtonModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_view_name: 'ToggleButtonView',
_model_name: 'ToggleButtonModel',
tooltip: '',
icon: '',
button_style: ''
});
};
return ToggleButtonModel;
}(BoolModel));
exports.ToggleButtonModel = ToggleButtonModel;
var ToggleButtonView = (function (_super) {
__extends(ToggleButtonView, _super);
function ToggleButtonView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Called when view is rendered.
*/
ToggleButtonView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.className = 'jupyter-widgets jupyter-button widget-toggle-button';
this.listenTo(this.model, 'change:button_style', this.update_button_style);
this.set_button_style();
this.update(); // Set defaults.
};
ToggleButtonView.prototype.update_button_style = function () {
this.update_mapped_classes(ToggleButtonView.class_map, 'button_style');
};
ToggleButtonView.prototype.set_button_style = function () {
this.set_mapped_classes(ToggleButtonView.class_map, 'button_style');
};
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
ToggleButtonView.prototype.update = function (options) {
if (this.model.get('value')) {
this.el.classList.add('mod-active');
}
else {
this.el.classList.remove('mod-active');
}
if (options === undefined || options.updated_view !== this) {
this.el.disabled = this.model.get('disabled');
this.el.setAttribute('title', this.model.get('tooltip'));
var description = this.model.get('description');
var icon = this.model.get('icon');
if (description.trim().length === 0 && icon.trim().length === 0) {
this.el.innerHTML = ' '; // Preserve button height
}
else {
this.el.textContent = '';
if (icon.trim().length) {
var i = document.createElement('i');
this.el.appendChild(i);
i.classList.add('fa');
i.classList.add('fa-' + icon);
}
this.el.appendChild(document.createTextNode(description));
}
}
return _super.prototype.update.call(this);
};
ToggleButtonView.prototype.events = function () {
return {
// Dictionary of events and their handlers.
'click': '_handle_click'
};
};
/**
* Handles and validates user input.
*
* Calling model.set will trigger all of the other views of the
* model to update.
*/
ToggleButtonView.prototype._handle_click = function (event) {
event.preventDefault();
var value = this.model.get('value');
this.model.set('value', !value, { updated_view: this });
this.touch();
};
Object.defineProperty(ToggleButtonView.prototype, "tagName", {
/**
* The default tag name.
*
* #### Notes
* This is a read-only attribute.
*/
get: function () {
// We can't make this an attribute with a default value
// since it would be set after it is needed in the
// constructor.
return 'button';
},
enumerable: true,
configurable: true
});
ToggleButtonView.class_map = {
primary: ['mod-primary'],
success: ['mod-success'],
info: ['mod-info'],
warning: ['mod-warning'],
danger: ['mod-danger']
};
return ToggleButtonView;
}(widget_1.DOMWidgetView));
exports.ToggleButtonView = ToggleButtonView;
var ValidModel = (function (_super) {
__extends(ValidModel, _super);
function ValidModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ValidModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
readout: 'Invalid',
_view_name: 'ValidView',
_model_name: 'ValidModel'
});
};
return ValidModel;
}(BoolModel));
exports.ValidModel = ValidModel;
var ValidView = (function (_super) {
__extends(ValidView, _super);
function ValidView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Called when view is rendered.
*/
ValidView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-valid');
this.el.classList.add('widget-inline-hbox');
var icon = document.createElement('i');
this.el.appendChild(icon);
this.readout = document.createElement('span');
this.readout.classList.add('widget-valid-readout');
this.readout.classList.add('widget-readout');
this.el.appendChild(this.readout);
this.update();
};
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
ValidView.prototype.update = function () {
this.el.classList.remove('mod-valid');
this.el.classList.remove('mod-invalid');
this.readout.textContent = this.model.get('readout');
if (this.model.get('value')) {
this.el.classList.add('mod-valid');
}
else {
this.el.classList.add('mod-invalid');
}
};
return ValidView;
}(widget_1.LabeledDOMWidgetView));
exports.ValidView = ValidView;
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_1 = __webpack_require__(11);
var widget_core_1 = __webpack_require__(23);
var widget_style_1 = __webpack_require__(26);
var _ = __webpack_require__(2);
var ButtonStyleModel = (function (_super) {
__extends(ButtonStyleModel, _super);
function ButtonStyleModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ButtonStyleModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'ButtonStyleModel',
});
};
ButtonStyleModel.styleProperties = {
button_color: {
selector: '',
attribute: 'background-color',
default: null
},
font_weight: {
selector: '',
attribute: 'font-weight',
default: ''
}
};
return ButtonStyleModel;
}(widget_style_1.StyleModel));
exports.ButtonStyleModel = ButtonStyleModel;
var ButtonModel = (function (_super) {
__extends(ButtonModel, _super);
function ButtonModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ButtonModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
description: '',
tooltip: '',
disabled: false,
icon: '',
button_style: '',
_view_name: 'ButtonView',
_model_name: 'ButtonModel',
style: void 0
});
};
return ButtonModel;
}(widget_core_1.CoreDOMWidgetModel));
exports.ButtonModel = ButtonModel;
var ButtonView = (function (_super) {
__extends(ButtonView, _super);
function ButtonView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Called when view is rendered.
*/
ButtonView.prototype.render = function () {
this.el.className = 'jupyter-widgets jupyter-button widget-button';
this.listenTo(this.model, 'change:button_style', this.update_button_style);
this.set_button_style();
this.update(); // Set defaults.
};
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
ButtonView.prototype.update = function () {
this.el.disabled = this.model.get('disabled');
this.el.setAttribute('title', this.model.get('tooltip'));
var description = this.model.get('description');
var icon = this.model.get('icon');
if (description.trim().length || icon.trim().length) {
this.el.textContent = '';
if (icon.trim().length) {
var i = document.createElement('i');
i.classList.add('fa');
i.classList.add('fa-' + icon);
if (description.trim().length === 0) {
i.classList.add('center');
}
this.el.appendChild(i);
}
this.el.appendChild(document.createTextNode(description));
}
return _super.prototype.update.call(this);
};
ButtonView.prototype.update_button_style = function () {
this.update_mapped_classes(ButtonView.class_map, 'button_style');
};
ButtonView.prototype.set_button_style = function () {
this.set_mapped_classes(ButtonView.class_map, 'button_style');
};
/**
* Dictionary of events and handlers
*/
ButtonView.prototype.events = function () {
// TODO: return typing not needed in Typescript later than 1.8.x
// See http://stackoverflow.com/questions/22077023/why-cant-i-indirectly-return-an-object-literal-to-satisfy-an-index-signature-re and https://github.com/Microsoft/TypeScript/pull/7029
return { 'click': '_handle_click' };
};
/**
* Handles when the button is clicked.
*/
ButtonView.prototype._handle_click = function (event) {
event.preventDefault();
this.send({ event: 'click' });
};
Object.defineProperty(ButtonView.prototype, "tagName", {
/**
* The default tag name.
*
* #### Notes
* This is a read-only attribute.
*/
get: function () {
// We can't make this an attribute with a default value
// since it would be set after it is needed in the
// constructor.
return 'button';
},
enumerable: true,
configurable: true
});
ButtonView.class_map = {
primary: ['mod-primary'],
success: ['mod-success'],
info: ['mod-info'],
warning: ['mod-warning'],
danger: ['mod-danger']
};
return ButtonView;
}(widget_1.DOMWidgetView));
exports.ButtonView = ButtonView;
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_1 = __webpack_require__(11);
var widget_core_1 = __webpack_require__(23);
var utils_1 = __webpack_require__(7);
var searching_1 = __webpack_require__(31);
var messaging_1 = __webpack_require__(16);
var panel_1 = __webpack_require__(33);
var widget_2 = __webpack_require__(14);
var _ = __webpack_require__(2);
var $ = __webpack_require__(4);
var JupyterPhosphorPanelWidget = (function (_super) {
__extends(JupyterPhosphorPanelWidget, _super);
function JupyterPhosphorPanelWidget(options) {
var _this = this;
var view = options.view;
delete options.view;
_this = _super.call(this, options) || this;
_this._view = view;
return _this;
}
/**
* Process the phosphor message.
*
* Any custom phosphor widget used inside a Jupyter widget should override
* the processMessage function like this.
*/
JupyterPhosphorPanelWidget.prototype.processMessage = function (msg) {
_super.prototype.processMessage.call(this, msg);
this._view.processPhosphorMessage(msg);
};
/**
* Dispose the widget.
*
* This causes the view to be destroyed as well with 'remove'
*/
JupyterPhosphorPanelWidget.prototype.dispose = function () {
if (this.isDisposed) {
return;
}
_super.prototype.dispose.call(this);
if (this._view) {
this._view.remove();
}
this._view = null;
};
return JupyterPhosphorPanelWidget;
}(panel_1.Panel));
exports.JupyterPhosphorPanelWidget = JupyterPhosphorPanelWidget;
var BoxModel = (function (_super) {
__extends(BoxModel, _super);
function BoxModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
BoxModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_view_name: 'BoxView',
_model_name: 'BoxModel',
children: [],
box_style: ''
});
};
BoxModel.serializers = _.extend({
children: { deserialize: widget_1.unpack_models }
}, widget_core_1.CoreDOMWidgetModel.serializers);
return BoxModel;
}(widget_core_1.CoreDOMWidgetModel));
exports.BoxModel = BoxModel;
var HBoxModel = (function (_super) {
__extends(HBoxModel, _super);
function HBoxModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
HBoxModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_view_name: 'HBoxView',
_model_name: 'HBoxModel',
});
};
return HBoxModel;
}(BoxModel));
exports.HBoxModel = HBoxModel;
var VBoxModel = (function (_super) {
__extends(VBoxModel, _super);
function VBoxModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
VBoxModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_view_name: 'VBoxView',
_model_name: 'VBoxModel',
});
};
return VBoxModel;
}(BoxModel));
exports.VBoxModel = VBoxModel;
var BoxView = (function (_super) {
__extends(BoxView, _super);
function BoxView() {
return _super !== null && _super.apply(this, arguments) || this;
}
BoxView.prototype._createElement = function (tagName) {
this.pWidget = new JupyterPhosphorPanelWidget({ view: this });
return this.pWidget.node;
};
BoxView.prototype._setElement = function (el) {
if (this.el || el !== this.pWidget.node) {
// Boxes don't allow setting the element beyond the initial creation.
throw new Error('Cannot reset the DOM element.');
}
this.el = this.pWidget.node;
this.$el = $(this.pWidget.node);
};
/**
* Public constructor
*/
BoxView.prototype.initialize = function (parameters) {
_super.prototype.initialize.call(this, parameters);
this.children_views = new widget_1.ViewList(this.add_child_model, null, this);
this.listenTo(this.model, 'change:children', this.update_children);
this.listenTo(this.model, 'change:box_style', this.update_box_style);
this.pWidget.addClass('jupyter-widgets');
this.pWidget.addClass('widget-container');
this.pWidget.addClass('widget-box');
};
/**
* Called when view is rendered.
*/
BoxView.prototype.render = function () {
_super.prototype.render.call(this);
this.update_children();
this.set_box_style();
};
BoxView.prototype.update_children = function () {
this.children_views.update(this.model.get('children')).then(function (views) {
// Notify all children that their sizes may have changed.
views.forEach(function (view) {
messaging_1.postMessage(view.pWidget, widget_2.ResizeMessage.UnknownSize);
});
});
};
BoxView.prototype.update_box_style = function () {
this.update_mapped_classes(BoxView.class_map, 'box_style');
};
BoxView.prototype.set_box_style = function () {
this.set_mapped_classes(BoxView.class_map, 'box_style');
};
BoxView.prototype.add_child_model = function (model) {
var _this = this;
// we insert a dummy element so the order is preserved when we add
// the rendered content later.
var dummy = new widget_2.Widget();
this.pWidget.addWidget(dummy);
return this.create_child_view(model).then(function (view) {
// replace the dummy widget with the new one.
var i = searching_1.indexOf(_this.pWidget.widgets, dummy);
_this.pWidget.insertWidget(i, view.pWidget);
dummy.dispose();
return view;
}).catch(utils_1.reject('Could not add child view to box', true));
};
BoxView.prototype.remove = function () {
this.children_views = null;
_super.prototype.remove.call(this);
};
BoxView.class_map = {
success: ['alert', 'alert-success'],
info: ['alert', 'alert-info'],
warning: ['alert', 'alert-warning'],
danger: ['alert', 'alert-danger']
};
return BoxView;
}(widget_1.DOMWidgetView));
exports.BoxView = BoxView;
var HBoxView = (function (_super) {
__extends(HBoxView, _super);
function HBoxView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Public constructor
*/
HBoxView.prototype.initialize = function (parameters) {
_super.prototype.initialize.call(this, parameters);
this.pWidget.addClass('widget-hbox');
};
return HBoxView;
}(BoxView));
exports.HBoxView = HBoxView;
var VBoxView = (function (_super) {
__extends(VBoxView, _super);
function VBoxView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Public constructor
*/
VBoxView.prototype.initialize = function (parameters) {
_super.prototype.initialize.call(this, parameters);
this.pWidget.addClass('widget-vbox');
};
return VBoxView;
}(BoxView));
exports.VBoxView = VBoxView;
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
var iteration_1 = __webpack_require__(15);
var sequence_1 = __webpack_require__(32);
/**
* Find the first value in an iterable which matches a predicate.
*
* @param object - The iterable or array-like object to search.
*
* @param fn - The predicate function to apply to the values.
*
* @returns The first matching value, or `undefined` if no matching
* value is found.
*
* #### Complexity
* Linear.
*
* #### Example
* ```typescript
* import { find } from 'phosphor/lib/algorithm/searching';
*
* interface IAnimal { species: string, name: string };
*
* function isCat(value: IAnimal): boolean {
* return value.species === 'cat';
* }
*
* let data: IAnimal[] = [
* { species: 'dog', name: 'spot' },
* { species: 'cat', name: 'fluffy' },
* { species: 'alligator', name: 'pocho' },
* ];
*
* find(data, isCat).name; // 'fluffy'
* ```
*/
function find(object, fn) {
var value;
var it = iteration_1.iter(object);
while ((value = it.next()) !== void 0) {
if (fn(value)) {
return value;
}
}
return void 0;
}
exports.find = find;
/**
* Test whether an iterable contains a specific value.
*
* @param object - The iterable or array-like object to search.
*
* @param value - The value to search for in the iterable. Values
* are compared using strict `===` equality.
*
* @returns `true` if the value is found, `false` otherwise.
*
* #### Complexity
* Linear.
*
* #### Example
* ```typescript
* import { contains } from 'phosphor/lib/algorithm/searching';
*
* let data: number[] = [5, 7, 0, -2, 9];
*
* contains(data, -2); // true
* contains(data, 3); // false
* ```
*/
function contains(object, value) {
var temp;
var it = iteration_1.iter(object);
while ((temp = it.next()) !== void 0) {
if (temp === value) {
return true;
}
}
return false;
}
exports.contains = contains;
/**
* Find the minimum value in an iterable.
*
* @param object - The iterable or array-like object to search.
*
* @param fn - The 3-way comparison function to apply to the values.
* It should return `< 0` if the first value is less than the second.
* `0` if the values are equivalent, or `> 0` if the first value is
* greater than the second.
*
* @returns The minimum value in the iterable. If multiple values are
* equivalent to the minimum, the left-most value is returned. If
* the iterable is empty, this returns `undefined`.
*
* #### Complexity
* Linear.
*
* #### Example
* ```typescript
* import { min } from 'phosphor/lib/algorithm/searching';
*
* function numberCmp(a: number, b: number): number {
* return a - b;
* }
*
* min([7, 4, 0, 3, 9, 4], numberCmp); // 0
* ```
*/
function min(object, fn) {
var it = iteration_1.iter(object);
var result = it.next();
if (result === void 0) {
return void 0;
}
var value;
while ((value = it.next()) !== void 0) {
if (fn(value, result) < 0) {
result = value;
}
}
return result;
}
exports.min = min;
/**
* Find the maximum value in an iterable.
*
* @param object - The iterable or array-like object to search.
*
* @param fn - The 3-way comparison function to apply to the values.
* It should return `< 0` if the first value is less than the second.
* `0` if the values are equivalent, or `> 0` if the first value is
* greater than the second.
*
* @returns The maximum value in the iterable. If multiple values are
* equivalent to the maximum, the left-most value is returned. If
* the iterable is empty, this returns `undefined`.
*
* #### Complexity
* Linear.
*
* #### Example
* ```typescript
* import { max } from 'phosphor/lib/algorithm/searching';
*
* function numberCmp(a: number, b: number): number {
* return a - b;
* }
*
* max([7, 4, 0, 3, 9, 4], numberCmp); // 9
* ```
*/
function max(object, fn) {
var it = iteration_1.iter(object);
var result = it.next();
if (result === void 0) {
return void 0;
}
var value;
while ((value = it.next()) !== void 0) {
if (fn(value, result) > 0) {
result = value;
}
}
return result;
}
exports.max = max;
/**
* Find the index of the first occurrence of a value in a sequence.
*
* @param object - The sequence or array-like object to search.
*
* @param value - The value to locate in the sequence. Values are
* compared using strict `===` equality.
*
* @param fromIndex - The starting index of the search. The default
* value is `0`.
*
* @returns The index of the first occurrence of the value, or `-1`
* if the value is not found.
*
* #### Complexity
* Linear.
*
* #### Undefined Behavior
* A `fromIndex` which is non-integral or `< 0`.
*
* #### Example
* ```typescript
* import { indexOf } from 'phosphor/lib/algorithm/searching';
*
* let data = ['one', 'two', 'three', 'four', 'one'];
* indexOf(data, 'red'); // -1
* indexOf(data, 'one'); // 0
* indexOf(data, 'one', 1); // 4
* indexOf(data, 'two', 2); // -1
* ```
*/
function indexOf(object, value, fromIndex) {
var length = object.length;
if (length === 0) {
return -1;
}
var start;
if (fromIndex === void 0) {
start = 0;
}
else {
start = fromIndex;
}
var seq = sequence_1.asSequence(object);
for (var i = start; i < length; ++i) {
if (seq.at(i) === value) {
return i;
}
}
return -1;
}
exports.indexOf = indexOf;
/**
* Find the index of the last occurrence of a value in a sequence.
*
* @param object - The sequence or array-like object to search.
*
* @param value - The value to locate in the sequence. Values are
* compared using strict `===` equality.
*
* @param fromIndex - The starting index of the search. The default
* value is `length - 1`.
*
* @returns The index of the last occurrence of the value, or `-1`
* if the value is not found.
*
* #### Complexity
* Linear.
*
* #### Undefined Behavior
* A `fromIndex` which is non-integral or `>= length`.
*
* #### Example
* ```typescript
* import { lastIndexOf } from 'phosphor/lib/algorithm/searching';
*
* let data = ['one', 'two', 'three', 'four', 'one'];
* lastIndexOf(data, 'red'); // -1
* lastIndexOf(data, 'one'); // 4
* lastIndexOf(data, 'one', 1); // 0
* lastIndexOf(data, 'two', 2); // 1
* ```
*/
function lastIndexOf(object, value, fromIndex) {
var length = object.length;
if (length === 0) {
return -1;
}
var start;
if (fromIndex === void 0) {
start = length - 1;
}
else {
start = fromIndex;
}
var seq = sequence_1.asSequence(object);
for (var i = start; i >= 0; --i) {
if (seq.at(i) === value) {
return i;
}
}
return -1;
}
exports.lastIndexOf = lastIndexOf;
/**
* Find the index of the first value which matches a predicate.
*
* @param object - The sequence or array-like object to search.
*
* @param fn - The predicate function to apply to the values.
*
* @param fromIndex - The starting index of the search. The default
* value is `0`.
*
* @returns The index of the first matching value, or `-1` if no
* matching value is found.
*
* #### Complexity
* Linear.
*
* #### Undefined Behavior
* A `fromIndex` which is non-integral or `< 0`.
*
* Modifying the length of the sequence while searching.
*
* #### Example
* ```typescript
* import { findIndex } from 'phosphor/lib/algorithm/searching';
*
* function isEven(value: number): boolean {
* return value % 2 === 0;
* }
*
* let data = [1, 2, 3, 4, 3, 2, 1];
* findIndex(data, isEven); // 1
* findIndex(data, isEven, 4); // 5
* findIndex(data, isEven, 6); // -1
* ```
*/
function findIndex(object, fn, fromIndex) {
var length = object.length;
if (length === 0) {
return -1;
}
var start;
if (fromIndex === void 0) {
start = 0;
}
else {
start = fromIndex;
}
var seq = sequence_1.asSequence(object);
for (var i = start; i < length; ++i) {
if (fn(seq.at(i), i)) {
return i;
}
}
return -1;
}
exports.findIndex = findIndex;
/**
* Find the index of the last value which matches a predicate.
*
* @param object - The sequence or array-like object to search.
*
* @param fn - The predicate function to apply to the values.
*
* @param fromIndex - The starting index of the search. The default
* value is `length - 1`.
*
* @returns The index of the last matching value, or `-1` if no
* matching value is found.
*
* #### Complexity
* Linear.
*
* #### Undefined Behavior
* A `fromIndex` which is non-integral or `>= length`.
*
* Modifying the length of the sequence while searching.
*
* #### Example
* ```typescript
* import { findLastIndex } from 'phosphor/lib/algorithm/searching';
*
* function isEven(value: number): boolean {
* return value % 2 === 0;
* }
*
* let data = [1, 2, 3, 4, 3, 2, 1];
* findLastIndex(data, isEven); // 5
* findLastIndex(data, isEven, 4); // 3
* findLastIndex(data, isEven, 0); // -1
* ```
*/
function findLastIndex(object, fn, fromIndex) {
var length = object.length;
if (length === 0) {
return -1;
}
var start;
if (fromIndex === void 0) {
start = length - 1;
}
else {
start = fromIndex;
}
var seq = sequence_1.asSequence(object);
for (var i = start; i >= 0; --i) {
if (fn(seq.at(i), i)) {
return i;
}
}
return -1;
}
exports.findLastIndex = findLastIndex;
/**
* Find the index of the first element which compares `>=` to a value.
*
* @param sequence - The sequence or array-like object to search.
* It must be sorted in ascending order.
*
* @param value - The value to locate in the sequence.
*
* @param fn - The 3-way comparison function to apply to the values.
* It should return `< 0` if an element is less than a value, `0` if
* an element is equal to a value, or `> 0` if an element is greater
* than a value.
*
* @returns The index of the first element which compares `>=` to the
* value, or `length` if there is no such element.
*
* #### Complexity
* Logarithmic.
*
* #### Undefined Behavior
* A sequence which is not sorted in ascending order.
*
* Modifying the length of the sequence while searching.
*
* #### Example
* ```typescript
* import { lowerBound } from 'phosphor/lib/algorithm/searching';
*
* function numberCmp(a: number, b: number): number {
* return a - b;
* }
*
* let data = [0, 3, 4, 7, 7, 9];
* lowerBound(data, 0, numberCmp); // 0
* lowerBound(data, 6, numberCmp); // 3
* lowerBound(data, 7, numberCmp); // 3
* lowerBound(data, -1, numberCmp); // 0
* lowerBound(data, 10, numberCmp); // 6
* ```
*/
function lowerBound(object, value, fn) {
var n = object.length;
if (n === 0) {
return 0;
}
var begin = 0;
var half;
var middle;
var seq = sequence_1.asSequence(object);
while (n > 0) {
half = n / 2 | 0;
middle = begin + half;
if (fn(seq.at(middle), value) < 0) {
begin = middle + 1;
n -= half + 1;
}
else {
n = half;
}
}
return begin;
}
exports.lowerBound = lowerBound;
/**
* Find the index of the first element which compares `>` than a value.
*
* @param sequence - The sequence or array-like object to search.
* It must be sorted in ascending order.
*
* @param value - The value to locate in the sequence.
*
* @param fn - The 3-way comparison function to apply to the values.
* It should return `< 0` if an element is less than a value, `0` if
* an element is equal to a value, or `> 0` if an element is greater
* than a value.
*
* @returns The index of the first element which compares `>` than the
* value, or `length` if there is no such element.
*
* #### Complexity
* Logarithmic.
*
* #### Undefined Behavior
* A sequence which is not sorted in ascending order.
*
* Modifying the length of the sequence while searching.
*
* #### Example
* ```typescript
* import { upperBound } from 'phosphor/lib/algorithm/searching';
*
* function numberCmp(a: number, b: number): number {
* return a - b;
* }
*
* let data = [0, 3, 4, 7, 7, 9];
* upperBound(data, 0, numberCmp); // 1
* upperBound(data, 6, numberCmp); // 3
* upperBound(data, 7, numberCmp); // 5
* upperBound(data, -1, numberCmp); // 0
* upperBound(data, 10, numberCmp); // 6
* ```
*/
function upperBound(object, value, fn) {
var n = object.length;
if (n === 0) {
return 0;
}
var begin = 0;
var half;
var middle;
var seq = sequence_1.asSequence(object);
while (n > 0) {
half = n / 2 | 0;
middle = begin + half;
if (fn(seq.at(middle), value) > 0) {
n = half;
}
else {
begin = middle + 1;
n -= half + 1;
}
}
return begin;
}
exports.upperBound = upperBound;
/**
* A namespace which holds string searching functionality.
*/
var StringSearch;
(function (StringSearch) {
/**
* Compute the sum-of-squares match for the given search text.
*
* @param sourceText - The text which should be searched.
*
* @param queryText - The query text to locate in the source text.
*
* @returns The match result object, or `null` if there is no match.
*
* #### Complexity
* Linear on `sourceText`.
*
* #### Notes
* This scoring algorithm uses a sum-of-squares approach to determine
* the score. In order for there to be a match, all of the characters
* in `queryText` **must** appear in `sourceText` in order. The index
* of each matching character is squared and added to the score. This
* means that early and consecutive character matches are preferred.
*
* The character match is performed with strict equality. It is case
* sensitive and does not ignore whitespace. If those behaviors are
* required, the text should be transformed before scoring.
*/
function sumOfSquares(sourceText, queryText) {
var score = 0;
var indices = new Array(queryText.length);
for (var i = 0, j = 0, n = queryText.length; i < n; ++i, ++j) {
j = sourceText.indexOf(queryText[i], j);
if (j === -1) {
return null;
}
indices[i] = j;
score += j * j;
}
return { score: score, indices: indices };
}
StringSearch.sumOfSquares = sumOfSquares;
/**
* Highlight the matched characters of a source string.
*
* @param source - The text which should be highlighted.
*
* @param indices - The indices of the matched characters. They must
* appear in increasing order and must be in bounds of the source.
*
* @returns A string with interpolated `<mark>` tags.
*/
function highlight(sourceText, indices) {
var k = 0;
var last = 0;
var result = '';
var n = indices.length;
while (k < n) {
var i = indices[k];
var j = indices[k];
while (++k < n && indices[k] === j + 1) {
j++;
}
var head = sourceText.slice(last, i);
var chunk = sourceText.slice(i, j + 1);
result += head + "<mark>" + chunk + "</mark>";
last = j + 1;
}
return result + sourceText.slice(last);
}
StringSearch.highlight = highlight;
})(StringSearch = exports.StringSearch || (exports.StringSearch = {}));
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
var iteration_1 = __webpack_require__(15);
/**
* Cast a sequence or array-like object to a sequence.
*
* @param object - The sequence or array-like object of interest.
*
* @returns A sequence for the given object.
*
* #### Notes
* This function allows sequence algorithms to operate on user-defined
* sequence types and builtin array-like objects in a uniform fashion.
*/
function asSequence(object) {
var seq;
if (typeof object.at === 'function') {
seq = object;
}
else {
seq = new ArraySequence(object);
}
return seq;
}
exports.asSequence = asSequence;
/**
* Cast a mutable sequence or array-like object to a mutable sequence.
*
* @param object - The sequence or array-like object of interest.
*
* @returns A mutable sequence for the given object.
*
* #### Notes
* This function allows sequence algorithms to operate on user-defined
* sequence types and builtin array-like objects in a uniform fashion.
*/
function asMutableSequence(object) {
var seq;
if (typeof object.set === 'function') {
seq = object;
}
else {
seq = new MutableArraySequence(object);
}
return seq;
}
exports.asMutableSequence = asMutableSequence;
/**
* A sequence for an array-like object.
*
* #### Notes
* This sequence can be used for any builtin JS array-like object.
*/
var ArraySequence = (function () {
/**
* Construct a new array sequence.
*
* @param source - The array-like object of interest.
*/
function ArraySequence(source) {
this._source = source;
}
Object.defineProperty(ArraySequence.prototype, "length", {
/**
* The length of the sequence.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return this._source.length;
},
enumerable: true,
configurable: true
});
/**
* Create an iterator over the object's values.
*
* @returns A new iterator which traverses the object's values.
*/
ArraySequence.prototype.iter = function () {
return new iteration_1.ArrayIterator(this._source, 0);
};
/**
* Get the value at the specified index.
*
* @param index - The positive integer index of interest.
*
* @returns The value at the specified index.
*
* #### Undefined Behavior
* An `index` which is non-integral or out of range.
*/
ArraySequence.prototype.at = function (index) {
return this._source[index];
};
return ArraySequence;
}());
exports.ArraySequence = ArraySequence;
/**
* A sequence for a mutable array-like object.
*
* #### Notes
* This sequence can be used for any builtin JS array-like object.
*/
var MutableArraySequence = (function (_super) {
__extends(MutableArraySequence, _super);
function MutableArraySequence() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Set the value at the specified index.
*
* @param index - The positive integer index of interest.
*
* @param value - The value to set at the specified index.
*
* #### Undefined Behavior
* An `index` which is non-integral or out of range.
*/
MutableArraySequence.prototype.set = function (index, value) {
this._source[index] = value;
};
return MutableArraySequence;
}(ArraySequence));
exports.MutableArraySequence = MutableArraySequence;
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
var iteration_1 = __webpack_require__(15);
var mutation_1 = __webpack_require__(34);
var searching_1 = __webpack_require__(31);
var vector_1 = __webpack_require__(35);
var messaging_1 = __webpack_require__(16);
var widget_1 = __webpack_require__(14);
/**
* The class name added to Panel instances.
*/
var PANEL_CLASS = 'p-Panel';
/**
* A simple and convenient panel widget class.
*
* #### Notes
* This class is suitable as a base class for implementing a variety of
* convenience panel widgets, but can also be used directly with CSS to
* arrange a collection of widgets.
*
* This class provides a convenience wrapper around a [[PanelLayout]].
*/
var Panel = (function (_super) {
__extends(Panel, _super);
/**
* Construct a new panel.
*
* @param options - The options for initializing the panel.
*/
function Panel(options) {
if (options === void 0) { options = {}; }
var _this = _super.call(this) || this;
_this.addClass(PANEL_CLASS);
_this.layout = Private.createLayout(options);
return _this;
}
Object.defineProperty(Panel.prototype, "widgets", {
/**
* A read-only sequence of the widgets in the panel.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return this.layout.widgets;
},
enumerable: true,
configurable: true
});
/**
* Add a widget to the end of the panel.
*
* @param widget - The widget to add to the panel.
*
* #### Notes
* If the is already contained in the panel, it will be moved.
*/
Panel.prototype.addWidget = function (widget) {
this.layout.addWidget(widget);
};
/**
* Insert a widget at the specified index.
*
* @param index - The index at which to insert the widget.
*
* @param widget - The widget to insert into to the panel.
*
* #### Notes
* If the widget is already contained in the panel, it will be moved.
*/
Panel.prototype.insertWidget = function (index, widget) {
this.layout.insertWidget(index, widget);
};
return Panel;
}(widget_1.Widget));
exports.Panel = Panel;
/**
* A concrete layout implementation suitable for many use cases.
*
* #### Notes
* This class is suitable as a base class for implementing a variety of
* layouts, but can also be used directly with standard CSS to layout a
* collection of widgets.
*/
var PanelLayout = (function (_super) {
__extends(PanelLayout, _super);
function PanelLayout() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._widgets = new vector_1.Vector();
return _this;
}
/**
* Dispose of the resources held by the layout.
*
* #### Notes
* This will clear and dispose all widgets in the layout.
*
* All reimplementations should call the superclass method.
*
* This method is called automatically when the parent is disposed.
*/
PanelLayout.prototype.dispose = function () {
while (this._widgets.length > 0) {
this._widgets.popBack().dispose();
}
_super.prototype.dispose.call(this);
};
Object.defineProperty(PanelLayout.prototype, "widgets", {
/**
* A read-only sequence of the widgets in the layout.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return this._widgets;
},
enumerable: true,
configurable: true
});
/**
* Create an iterator over the widgets in the layout.
*
* @returns A new iterator over the widgets in the layout.
*/
PanelLayout.prototype.iter = function () {
return this._widgets.iter();
};
/**
* Add a widget to the end of the layout.
*
* @param widget - The widget to add to the layout.
*
* #### Notes
* If the widget is already contained in the layout, it will be moved.
*/
PanelLayout.prototype.addWidget = function (widget) {
this.insertWidget(this._widgets.length, widget);
};
/**
* Insert a widget into the layout at the specified index.
*
* @param index - The index at which to insert the widget.
*
* @param widget - The widget to insert into the layout.
*
* #### Notes
* The index will be clamped to the bounds of the widgets.
*
* If the widget is already added to the layout, it will be moved.
*/
PanelLayout.prototype.insertWidget = function (index, widget) {
// Remove the widget from its current parent. This is a no-op
// if the widget's parent is already the layout parent widget.
widget.parent = this.parent;
// Look up the current index of the widget.
var i = searching_1.indexOf(this._widgets, widget);
// Clamp the insert index to the vector bounds.
var j = Math.max(0, Math.min(Math.floor(index), this._widgets.length));
// If the widget is not in the vector, insert it.
if (i === -1) {
// Insert the widget into the vector.
this._widgets.insert(j, widget);
// If the layout is parented, attach the widget to the DOM.
if (this.parent)
this.attachWidget(j, widget);
// There is nothing more to do.
return;
}
// Otherwise, the widget exists in the vector and should be moved.
// Adjust the index if the location is at the end of the vector.
if (j === this._widgets.length)
j--;
// Bail if there is no effective move.
if (i === j)
return;
// Move the widget to the new location.
mutation_1.move(this._widgets, i, j);
// If the layout is parented, move the widget in the DOM.
if (this.parent)
this.moveWidget(i, j, widget);
};
/**
* Remove a widget from the layout.
*
* @param widget - The widget to remove from the layout.
*
* #### Notes
* A widget is automatically removed from the layout when its `parent`
* is set to `null`. This method should only be invoked directly when
* removing a widget from a layout which has yet to be installed on a
* parent widget.
*
* This method does *not* modify the widget's `parent`.
*/
PanelLayout.prototype.removeWidget = function (widget) {
this.removeWidgetAt(searching_1.indexOf(this._widgets, widget));
};
/**
* Remove the widget at a given index from the layout.
*
* @param index - The index of the widget to remove.
*
* #### Notes
* A widget is automatically removed from the layout when its `parent`
* is set to `null`. This method should only be invoked directly when
* removing a widget from a layout which has yet to be installed on a
* parent widget.
*
* This method does *not* modify the widget's `parent`.
*/
PanelLayout.prototype.removeWidgetAt = function (index) {
// Bail if the index is out of range.
var i = Math.floor(index);
if (i < 0 || i >= this._widgets.length) {
return;
}
// Remove the widget from the vector.
var widget = this._widgets.removeAt(i);
// If the layout is parented, detach the widget from the DOM.
if (this.parent)
this.detachWidget(i, widget);
};
/**
* Perform layout initialization which requires the parent widget.
*/
PanelLayout.prototype.init = function () {
var _this = this;
_super.prototype.init.call(this);
var index = 0;
iteration_1.each(this, function (widget) { _this.attachWidget(index++, widget); });
};
/**
* Attach a widget to the parent's DOM node.
*
* @param index - The current index of the widget in the layout.
*
* @param widget - The widget to attach to the parent.
*
* #### Notes
* This method is called automatically by the panel layout at the
* appropriate time. It should not be called directly by user code.
*
* The default implementation adds the widgets's node to the parent's
* node at the proper location, and sends an `'after-attach'` message
* to the widget if the parent is attached to the DOM.
*
* Subclasses may reimplement this method to control how the widget's
* node is added to the parent's node, but the reimplementation must
* send an `'after-attach'` message to the widget if the parent is
* attached to the DOM.
*/
PanelLayout.prototype.attachWidget = function (index, widget) {
// Look up the next sibling reference node.
var ref = this.parent.node.children[index];
// Insert the widget's node before the sibling.
this.parent.node.insertBefore(widget.node, ref);
// Send an `'after-attach'` message if the parent is attached.
if (this.parent.isAttached)
messaging_1.sendMessage(widget, widget_1.WidgetMessage.AfterAttach);
};
/**
* Move a widget in the parent's DOM node.
*
* @param fromIndex - The previous index of the widget in the layout.
*
* @param toIndex - The current index of the widget in the layout.
*
* @param widget - The widget to move in the parent.
*
* #### Notes
* This method is called automatically by the panel layout at the
* appropriate time. It should not be called directly by user code.
*
* The default implementation moves the widget's node to the proper
* location in the parent's node and sends both a `'before-detach'`
* and an `'after-attach'` message to the widget if the parent is
* attached to the DOM.
*
* Subclasses may reimplement this method to control how the widget's
* node is moved in the parent's node, but the reimplementation must
* send both a `'before-detach'` and an `'after-attach'` message to
* the widget if the parent is attached to the DOM.
*/
PanelLayout.prototype.moveWidget = function (fromIndex, toIndex, widget) {
// Send a `'before-detach'` message if the parent is attached.
if (this.parent.isAttached)
messaging_1.sendMessage(widget, widget_1.WidgetMessage.BeforeDetach);
// Remove the widget's node from the parent.
this.parent.node.removeChild(widget.node);
// Look up the next sibling reference node.
var ref = this.parent.node.children[toIndex];
// Insert the widget's node before the sibling.
this.parent.node.insertBefore(widget.node, ref);
// Send an `'after-attach'` message if the parent is attached.
if (this.parent.isAttached)
messaging_1.sendMessage(widget, widget_1.WidgetMessage.AfterAttach);
};
/**
* Detach a widget from the parent's DOM node.
*
* @param index - The previous index of the widget in the layout.
*
* @param widget - The widget to detach from the parent.
*
* #### Notes
* This method is called automatically by the panel layout at the
* appropriate time. It should not be called directly by user code.
*
* The default implementation removes the widget's node from the
* parent's node, and sends a `'before-detach'` message to the widget
* if the parent is attached to the DOM.
*
* Subclasses may reimplement this method to control how the widget's
* node is removed from the parent's node, but the reimplementation
* must send a `'before-detach'` message to the widget if the parent
* is attached to the DOM.
*/
PanelLayout.prototype.detachWidget = function (index, widget) {
// Send a `'before-detach'` message if the parent is attached.
if (this.parent.isAttached)
messaging_1.sendMessage(widget, widget_1.WidgetMessage.BeforeDetach);
// Remove the widget's node from the parent.
this.parent.node.removeChild(widget.node);
};
return PanelLayout;
}(widget_1.Layout));
exports.PanelLayout = PanelLayout;
/**
* The namespace for the private module data.
*/
var Private;
(function (Private) {
/**
* Create a panel layout for the given panel options.
*/
function createLayout(options) {
return options.layout || new PanelLayout();
}
Private.createLayout = createLayout;
})(Private || (Private = {}));
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
var sequence_1 = __webpack_require__(32);
/**
* Move an element in a sequence from one index to another.
*
* @param object - The sequence or array-like object to mutate.
*
* @param fromIndex - The index of the element to move.
*
* @param toIndex - The target index of the element.
*
* #### Complexity
* Linear.
*
* #### Undefined Behavior
* A `fromIndex` which is non-integral or out of range.
*
* A `toIndex` which is non-integral or out of range.
*
* #### Example
* ```typescript
* import { move } from 'phosphor/lib/algorithm/mutation';
*
* let data = [0, 1, 2, 3, 4];
* move(data, 1, 2); // [0, 2, 1, 3, 4]
* move(data, 4, 2); // [0, 2, 4, 1, 3]
* ```
*/
function move(object, fromIndex, toIndex) {
if (object.length <= 1 || fromIndex === toIndex) {
return;
}
var d = fromIndex < toIndex ? 1 : -1;
var seq = sequence_1.asMutableSequence(object);
var value = seq.at(fromIndex);
for (var i = fromIndex; i !== toIndex; i += d) {
seq.set(i, seq.at(i + d));
}
seq.set(toIndex, value);
}
exports.move = move;
/**
* Reverse a sequence in-place subject to an optional range.
*
* @param object - The sequence or array-like object to mutate.
*
* @param first - The index of the first element of the range. This
* should be `<=` the `last` index. The default is `0`.
*
* @param last - The index of the last element of the range. This
* should be `>=` the `first` index. The default is `length - 1`.
*
* #### Complexity
* Linear.
*
* #### Undefined Behavior
* A `first` index which is non-integral or out of range.
*
* A `last` index which is non-integral or out of range.
*
* #### Example
* ```typescript
* import { reverse } from 'phosphor/lib/algorithm/mutation';
*
* let data = [0, 1, 2, 3, 4];
* reverse(data, 1, 3); // [0, 3, 2, 1, 4]
* reverse(data, 3); // [0, 3, 2, 4, 1]
* reverse(data); // [1, 4, 2, 3, 0]
* ```
*/
function reverse(object, first, last) {
var length = object.length;
if (length <= 1) {
return;
}
if (first === void 0) {
first = 0;
}
if (last === void 0) {
last = length - 1;
}
if (first >= last) {
return;
}
var seq = sequence_1.asMutableSequence(object);
while (first < last) {
var front = seq.at(first);
var back = seq.at(last);
seq.set(first++, back);
seq.set(last--, front);
}
}
exports.reverse = reverse;
/**
* Rotate the elements of a sequence by a positive or negative amount.
*
* @param object - The sequence or array-like object to mutate.
*
* @param delta - The amount of rotation to apply to the elements. A
* positive value will rotate the elements to the left. A negative
* value will rotate the elements to the right.
*
* #### Complexity
* Linear.
*
* #### Undefined Behavior
* A `delta` amount which is non-integral.
*
* #### Example
* ```typescript
* import { rotate } from 'phosphor/lib/algorithm/mutation';
*
* let data = [0, 1, 2, 3, 4];
* rotate(data, 2); // [2, 3, 4, 0, 1]
* rotate(data, -2); // [0, 1, 2, 3, 4]
* rotate(data, 10); // [0, 1, 2, 3, 4]
* rotate(data, 9); // [4, 0, 1, 2, 3]
* ```
*/
function rotate(object, delta) {
var length = object.length;
if (length <= 1) {
return;
}
if (delta > 0) {
delta = delta % length;
}
else if (delta < 0) {
delta = ((delta % length) + length) % length;
}
if (delta === 0) {
return;
}
var seq = sequence_1.asMutableSequence(object);
reverse(seq, 0, delta - 1);
reverse(seq, delta, length - 1);
reverse(seq, 0, length - 1);
}
exports.rotate = rotate;
/***/ },
/* 35 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
var iteration_1 = __webpack_require__(15);
/**
* A generic vector data structure.
*/
var Vector = (function () {
/**
* Construct a new vector.
*
* @param values - The initial values for the vector.
*/
function Vector(values) {
var _this = this;
this._array = [];
if (values)
iteration_1.each(values, function (value) { _this.pushBack(value); });
}
Object.defineProperty(Vector.prototype, "isEmpty", {
/**
* Test whether the vector is empty.
*
* @returns `true` if the vector is empty, `false` otherwise.
*
* #### Notes
* This is a read-only property.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*/
get: function () {
return this._array.length === 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Vector.prototype, "length", {
/**
* Get the length of the vector.
*
* @return The number of values in the vector.
*
* #### Notes
* This is a read-only property.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*/
get: function () {
return this._array.length;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Vector.prototype, "front", {
/**
* Get the value at the front of the vector.
*
* @returns The value at the front of the vector, or `undefined` if
* the vector is empty.
*
* #### Notes
* This is a read-only property.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*/
get: function () {
return this._array[0];
},
enumerable: true,
configurable: true
});
Object.defineProperty(Vector.prototype, "back", {
/**
* Get the value at the back of the vector.
*
* @returns The value at the back of the vector, or `undefined` if
* the vector is empty.
*
* #### Notes
* This is a read-only property.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*/
get: function () {
return this._array[this._array.length - 1];
},
enumerable: true,
configurable: true
});
/**
* Create an iterator over the values in the vector.
*
* @returns A new iterator starting at the front of the vector.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*/
Vector.prototype.iter = function () {
return new iteration_1.ArrayIterator(this._array, 0);
};
/**
* Get the value at the specified index.
*
* @param index - The positive integer index of interest.
*
* @returns The value at the specified index.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*
* #### Undefined Behavior
* An `index` which is non-integral or out of range.
*/
Vector.prototype.at = function (index) {
return this._array[index];
};
/**
* Set the value at the specified index.
*
* @param index - The positive integer index of interest.
*
* @param value - The value to set at the specified index.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*
* #### Undefined Behavior
* An `index` which is non-integral or out of range.
*/
Vector.prototype.set = function (index, value) {
this._array[index] = value;
};
/**
* Add a value to the back of the vector.
*
* @param value - The value to add to the back of the vector.
*
* @returns The new length of the vector.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* No changes.
*/
Vector.prototype.pushBack = function (value) {
return this._array.push(value);
};
/**
* Remove and return the value at the back of the vector.
*
* @returns The value at the back of the vector, or `undefined` if
* the vector is empty.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* Iterators pointing at the removed value are invalidated.
*/
Vector.prototype.popBack = function () {
return this._array.pop();
};
/**
* Insert a value into the vector at a specific index.
*
* @param index - The index at which to insert the value.
*
* @param value - The value to set at the specified index.
*
* @returns The new length of the vector.
*
* #### Complexity
* Linear.
*
* #### Iterator Validity
* No changes.
*
* #### Notes
* The `index` will be clamped to the bounds of the vector.
*
* #### Undefined Behavior
* An `index` which is non-integral.
*/
Vector.prototype.insert = function (index, value) {
var array = this._array;
var n = array.length;
index = Math.max(0, Math.min(index, n));
for (var i = n; i > index; --i) {
array[i] = array[i - 1];
}
array[index] = value;
return n + 1;
};
/**
* Remove the first occurrence of a value from the vector.
*
* @param value - The value of interest.
*
* @returns The index of the removed value, or `-1` if the value
* is not contained in the vector.
*
* #### Complexity
* Linear.
*
* #### Iterator Validity
* Iterators pointing at the removed value and beyond are invalidated.
*
* #### Notes
* Comparison is performed using strict `===` equality.
*/
Vector.prototype.remove = function (value) {
var index = this._array.indexOf(value);
if (index !== -1)
this.removeAt(index);
return index;
};
/**
* Remove and return the value at a specific index.
*
* @param index - The index of the value of interest.
*
* @returns The value at the specified index, or `undefined` if the
* index is out of range.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* Iterators pointing at the removed value and beyond are invalidated.
*
* #### Undefined Behavior
* An `index` which is non-integral.
*/
Vector.prototype.removeAt = function (index) {
var array = this._array;
var n = array.length;
if (index < 0 || index >= n) {
return void 0;
}
var value = array[index];
for (var i = index + 1; i < n; ++i) {
array[i - 1] = array[i];
}
array.length = n - 1;
return value;
};
/**
* Remove all values from the vector.
*
* #### Complexity
* Linear.
*
* #### Iterator Validity
* All current iterators are invalidated.
*/
Vector.prototype.clear = function () {
this._array.length = 0;
};
/**
* Swap the contents of the vector with the contents of another.
*
* @param other - The other vector holding the contents to swap.
*
* #### Complexity
* Constant.
*
* #### Iterator Validity
* All current iterators remain valid, but will now point to the
* contents of the other vector involved in the swap.
*/
Vector.prototype.swap = function (other) {
var array = other._array;
other._array = this._array;
this._array = array;
};
return Vector;
}());
exports.Vector = Vector;
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_1 = __webpack_require__(11);
var widget_core_1 = __webpack_require__(23);
var _ = __webpack_require__(2);
var ImageModel = (function (_super) {
__extends(ImageModel, _super);
function ImageModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ImageModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'ImageModel',
_view_name: 'ImageView',
format: 'png',
width: '',
height: '',
_b64value: ''
});
};
return ImageModel;
}(widget_core_1.CoreDOMWidgetModel));
exports.ImageModel = ImageModel;
var ImageView = (function (_super) {
__extends(ImageView, _super);
function ImageView() {
return _super !== null && _super.apply(this, arguments) || this;
}
ImageView.prototype.render = function () {
/**
* Called when view is rendered.
*/
this.pWidget.addClass('jupyter-widgets');
this.pWidget.addClass('widget-image');
this.update(); // Set defaults.
};
ImageView.prototype.update = function () {
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
var image_src = 'data:image/' + this.model.get('format') + ';base64,' + this.model.get('_b64value');
this.el.setAttribute('src', image_src);
var width = this.model.get('width');
if (width !== undefined && width.length > 0) {
this.el.setAttribute('width', width);
}
else {
this.el.removeAttribute('width');
}
var height = this.model.get('height');
if (height !== undefined && height.length > 0) {
this.el.setAttribute('height', height);
}
else {
this.el.removeAttribute('height');
}
return _super.prototype.update.call(this);
};
Object.defineProperty(ImageView.prototype, "tagName", {
/**
* The default tag name.
*
* #### Notes
* This is a read-only attribute.
*/
get: function () {
// We can't make this an attribute with a default value
// since it would be set after it is needed in the
// constructor.
return 'img';
},
enumerable: true,
configurable: true
});
return ImageView;
}(widget_1.DOMWidgetView));
exports.ImageView = ImageView;
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_1 = __webpack_require__(11);
var widget_core_1 = __webpack_require__(23);
var _ = __webpack_require__(2);
var ColorPickerModel = (function (_super) {
__extends(ColorPickerModel, _super);
function ColorPickerModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ColorPickerModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
value: 'black',
concise: false,
_model_name: 'ColorPickerModel',
_view_name: 'ColorPickerView'
});
};
return ColorPickerModel;
}(widget_core_1.CoreLabeledDOMWidgetModel));
exports.ColorPickerModel = ColorPickerModel;
var ColorPickerView = (function (_super) {
__extends(ColorPickerView, _super);
function ColorPickerView() {
return _super !== null && _super.apply(this, arguments) || this;
}
ColorPickerView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-colorpicker');
this._color_container = document.createElement('div');
this._color_container.className = 'widget-inline-hbox widget-colorpicker-input';
this.el.appendChild(this._color_container);
this._textbox = document.createElement('input');
this._textbox.setAttribute('type', 'text');
this._color_container.appendChild(this._textbox);
this._textbox.value = this.model.get('value');
this._colorpicker = document.createElement('input');
this._colorpicker.setAttribute('type', 'color');
this._color_container.appendChild(this._colorpicker);
this.listenTo(this.model, 'change:value', this._update_value);
this.listenTo(this.model, 'change:concise', this._update_concise);
this._update_concise();
this._update_value();
};
ColorPickerView.prototype.events = function () {
return {
'change [type="color"]': '_picker_change',
'change [type="text"]': '_text_change'
};
};
ColorPickerView.prototype._update_value = function () {
var value = this.model.get('value');
this._colorpicker.value = color2hex(value);
this._textbox.value = value;
};
ColorPickerView.prototype._update_concise = function () {
var concise = this.model.get('concise');
if (concise) {
this.el.classList.add('concise');
this._textbox.style.display = 'none';
}
else {
this.el.classList.remove('concise');
this._textbox.style.display = '';
}
};
ColorPickerView.prototype._picker_change = function () {
this.model.set('value', this._colorpicker.value);
this.touch();
};
ColorPickerView.prototype._text_change = function () {
var value = this._validate_color(this._textbox.value, this.model.get('value'));
this.model.set('value', value);
this.touch();
};
ColorPickerView.prototype._validate_color = function (color, fallback) {
return color.match(/#[a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?$/) ||
named_colors[color.toLowerCase()] ? color : fallback;
};
return ColorPickerView;
}(widget_1.LabeledDOMWidgetView));
exports.ColorPickerView = ColorPickerView;
var named_colors = { aliceblue: '#f0f8ff', antiquewhite: '#faebd7', aqua: '#00ffff', aquamarine: '#7fffd4', azure: '#f0ffff', beige: '#f5f5dc', bisque: '#ffe4c4', black: '#000000', blanchedalmond: '#ffebcd', blue: '#0000ff', blueviolet: '#8a2be2', brown: '#a52a2a', burlywood: '#deb887', cadetblue: '#5f9ea0', chartreuse: '#7fff00', chocolate: '#d2691e', coral: '#ff7f50', cornflowerblue: '#6495ed', cornsilk: '#fff8dc', crimson: '#dc143c', cyan: '#00ffff', darkblue: '#00008b', darkcyan: '#008b8b', darkgoldenrod: '#b8860b', darkgray: '#a9a9a9', darkgrey: '#a9a9a9', darkgreen: '#006400', darkkhaki: '#bdb76b', darkmagenta: '#8b008b', darkolivegreen: '#556b2f', darkorange: '#ff8c00', darkorchid: '#9932cc', darkred: '#8b0000', darksalmon: '#e9967a', darkseagreen: '#8fbc8f', darkslateblue: '#483d8b', darkslategray: '#2f4f4f', darkslategrey: '#2f4f4f', darkturquoise: '#00ced1', darkviolet: '#9400d3', deeppink: '#ff1493', deepskyblue: '#00bfff', dimgray: '#696969', dimgrey: '#696969', dodgerblue: '#1e90ff', firebrick: '#b22222', floralwhite: '#fffaf0', forestgreen: '#228b22', fuchsia: '#ff00ff', gainsboro: '#dcdcdc', ghostwhite: '#f8f8ff', gold: '#ffd700', goldenrod: '#daa520', gray: '#808080', grey: '#808080', green: '#008000', greenyellow: '#adff2f', honeydew: '#f0fff0', hotpink: '#ff69b4', indianred: '#cd5c5c', indigo: '#4b0082', ivory: '#fffff0', khaki: '#f0e68c', lavender: '#e6e6fa', lavenderblush: '#fff0f5', lawngreen: '#7cfc00', lemonchiffon: '#fffacd', lightblue: '#add8e6', lightcoral: '#f08080', lightcyan: '#e0ffff', lightgoldenrodyellow: '#fafad2', lightgreen: '#90ee90', lightgray: '#d3d3d3', lightgrey: '#d3d3d3', lightpink: '#ffb6c1', lightsalmon: '#ffa07a', lightseagreen: '#20b2aa', lightskyblue: '#87cefa', lightslategray: '#778899', lightslategrey: '#778899', lightsteelblue: '#b0c4de', lightyellow: '#ffffe0', lime: '#00ff00', limegreen: '#32cd32', linen: '#faf0e6', magenta: '#ff00ff', maroon: '#800000', mediumaquamarine: '#66cdaa', mediumblue: '#0000cd', mediumorchid: '#ba55d3', mediumpurple: '#9370db', mediumseagreen: '#3cb371', mediumslateblue: '#7b68ee', mediumspringgreen: '#00fa9a', mediumturquoise: '#48d1cc', mediumvioletred: '#c71585', midnightblue: '#191970', mintcream: '#f5fffa', mistyrose: '#ffe4e1', moccasin: '#ffe4b5', navajowhite: '#ffdead', navy: '#000080', oldlace: '#fdf5e6', olive: '#808000', olivedrab: '#6b8e23', orange: '#ffa500', orangered: '#ff4500', orchid: '#da70d6', palegoldenrod: '#eee8aa', palegreen: '#98fb98', paleturquoise: '#afeeee', palevioletred: '#db7093', papayawhip: '#ffefd5', peachpuff: '#ffdab9', peru: '#cd853f', pink: '#ffc0cb', plum: '#dda0dd', powderblue: '#b0e0e6', purple: '#800080', red: '#ff0000', rosybrown: '#bc8f8f', royalblue: '#4169e1', saddlebrown: '#8b4513', salmon: '#fa8072', sandybrown: '#f4a460', seagreen: '#2e8b57', seashell: '#fff5ee', sienna: '#a0522d', silver: '#c0c0c0', skyblue: '#87ceeb', slateblue: '#6a5acd', slategray: '#708090', slategrey: '#708090', snow: '#fffafa', springgreen: '#00ff7f', steelblue: '#4682b4', tan: '#d2b48c', teal: '#008080', thistle: '#d8bfd8', tomato: '#ff6347', turquoise: '#40e0d0', violet: '#ee82ee', wheat: '#f5deb3', white: '#ffffff', whitesmoke: '#f5f5f5', yellow: '#ffff00', yellowgreen: '#9acd32', };
/*
* From a valid html color (named color, 6-digits or 3-digits hex format)
* return a 6-digits hexadecimal color #rrggbb.
*/
function color2hex(color) {
return named_colors[color.toLowerCase()] || rgb3_to_rgb6(color);
}
function rgb3_to_rgb6(rgb) {
if (rgb.length === 7) {
return rgb;
}
else {
return '#' + rgb.charAt(1) + rgb.charAt(1) +
rgb.charAt(2) + rgb.charAt(2) +
rgb.charAt(3) + rgb.charAt(3);
}
}
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_1 = __webpack_require__(11);
var widget_core_1 = __webpack_require__(23);
var _ = __webpack_require__(2);
function serialize_datetime(value, manager) {
if (value === null) {
return null;
}
else {
value = new Date(value);
return {
year: value.getFullYear(),
month: value.getMonth(),
date: value.getDate(),
hours: value.getHours(),
minutes: value.getMinutes(),
seconds: value.getSeconds(),
milliseconds: value.getMilliseconds()
};
}
}
exports.serialize_datetime = serialize_datetime;
;
function deserialize_datetime(value, manager) {
if (value === null) {
return null;
}
else {
return new Date(value.year, value.month, value.date, value.hours, value.minutes, value.seconds, value.milliseconds);
}
}
exports.deserialize_datetime = deserialize_datetime;
;
function createDateAsUTC(date) {
if (date === null) {
return null;
}
else {
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
}
}
function convertDateToUTC(date) {
if (date === null) {
return null;
}
else {
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
}
}
var DatePickerModel = (function (_super) {
__extends(DatePickerModel, _super);
function DatePickerModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
DatePickerModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
value: null,
_model_name: 'DatePickerModel',
_view_name: 'DatePickerView'
});
};
DatePickerModel.serializers = _.extend({
value: {
serialize: serialize_datetime,
deserialize: deserialize_datetime
}
}, widget_core_1.CoreLabeledDOMWidgetModel.serializers);
return DatePickerModel;
}(widget_core_1.CoreLabeledDOMWidgetModel));
exports.DatePickerModel = DatePickerModel;
var DatePickerView = (function (_super) {
__extends(DatePickerView, _super);
function DatePickerView() {
return _super !== null && _super.apply(this, arguments) || this;
}
DatePickerView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-datepicker');
this._datepicker = document.createElement('input');
this._datepicker.setAttribute('type', 'date');
this.el.appendChild(this._datepicker);
this.listenTo(this.model, 'change:value', this._update_value);
this._update_value();
};
DatePickerView.prototype.events = function () {
return {
'change [type="date"]': '_picker_change',
};
};
DatePickerView.prototype._update_value = function () {
var value = this.model.get('value');
this._datepicker.valueAsDate = createDateAsUTC(value);
};
DatePickerView.prototype._picker_change = function () {
this.model.set('value', convertDateToUTC(this._datepicker.valueAsDate));
this.touch();
};
return DatePickerView;
}(widget_1.LabeledDOMWidgetView));
exports.DatePickerView = DatePickerView;
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
Object.defineProperty(exports, "__esModule", { value: true });
var utils = __webpack_require__(7);
var shims;
(function (shims) {
var services;
(function (services) {
/**
* Public constructor
* @param jsServicesKernel - @jupyterlab/services Kernel.IKernel instance
*/
var CommManager = (function () {
function CommManager(jsServicesKernel) {
/**
* Register a comm in the mapping
*/
this.register_comm = function (comm) {
this.comms[comm.comm_id] = Promise.resolve(comm);
comm.kernel = this.kernel;
return comm.comm_id;
};
this.targets = Object.create(null);
this.comms = Object.create(null);
this.kernel = null;
this.jsServicesKernel = null;
this.init_kernel(jsServicesKernel);
}
;
/**
* Hookup kernel events.
* @param {Kernel.IKernel} jsServicesKernel - @jupyterlab/services Kernel.IKernel instance
*/
CommManager.prototype.init_kernel = function (jsServicesKernel) {
this.kernel = jsServicesKernel; // These aren't really the same.
this.jsServicesKernel = jsServicesKernel;
};
;
/**
* Creates a new connected comm
* @param {string} target_name
* @param {object} data
* @param {object} callbacks
* @param {object} metadata
* @param {string} comm_id
* @return {Comm}
*/
CommManager.prototype.new_comm = function (target_name, data, callbacks, metadata, comm_id) {
var comm = new Comm(this.jsServicesKernel.connectToComm(target_name, comm_id));
this.register_comm(comm);
comm.open(data, callbacks, metadata);
return comm;
};
;
/**
* Register a comm target
* @param {string} target_name
* @param {(Comm, object) => void} f - callback that is called when the
* comm is made. Signature of f(comm, msg).
*/
CommManager.prototype.register_target = function (target_name, f) {
var _this = this;
var handle = this.jsServicesKernel.registerCommTarget(target_name, function (jsServicesComm, msg) {
// Create the comm.
var comm = new Comm(jsServicesComm);
_this.register_comm(comm);
// Call the callback for the comm.
try {
return f(comm, msg);
}
catch (e) {
comm.close();
var wrapped_error = new utils.WrappedError('Exception opening new comm', e);
console.error(wrapped_error);
return;
}
});
this.targets[target_name] = handle;
};
;
/**
* Unregisters a comm target
* @param {string} target_name
*/
CommManager.prototype.unregister_target = function (target_name, f) {
var handle = this.targets[target_name];
handle.dispose();
delete this.targets[target_name];
};
;
return CommManager;
}());
services.CommManager = CommManager;
/**
* Public constructor
* @param {IComm} jsServicesComm - @jupyterlab/services IComm instance
*/
var Comm = (function () {
function Comm(jsServicesComm) {
this.jsServicesComm = null;
this.jsServicesComm = jsServicesComm;
}
Object.defineProperty(Comm.prototype, "comm_id", {
/**
* Comm id
* @return {string}
*/
get: function () {
return this.jsServicesComm.commId;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Comm.prototype, "target_name", {
/**
* Target name
* @return {string}
*/
get: function () {
return this.jsServicesComm.targetName;
},
enumerable: true,
configurable: true
});
/**
* Opens a sibling comm in the backend
* @param data
* @param callbacks
* @param metadata
* @return msg id
*/
Comm.prototype.open = function (data, callbacks, metadata) {
var future = this.jsServicesComm.open(data, metadata);
this._hookupCallbacks(future, callbacks);
return future.msg.header.msg_id;
};
;
/**
* Sends a message to the sibling comm in the backend
* @param data
* @param callbacks
* @param metadata
* @param buffers
* @return message id
*/
Comm.prototype.send = function (data, callbacks, metadata, buffers) {
var future = this.jsServicesComm.send(data, metadata, buffers);
this._hookupCallbacks(future, callbacks);
return future.msg.header.msg_id;
};
;
/**
* Closes the sibling comm in the backend
* @param data
* @param callbacks
* @param metadata
* @return msg id
*/
Comm.prototype.close = function (data, callbacks, metadata) {
var future = this.jsServicesComm.close(data, metadata);
this._hookupCallbacks(future, callbacks);
return future.msg.header.msg_id;
};
;
/**
* Register a message handler
* @param callback, which is given a message
*/
Comm.prototype.on_msg = function (callback) {
this.jsServicesComm.onMsg = callback.bind(this);
};
;
/**
* Register a handler for when the comm is closed by the backend
* @param callback, which is given a message
*/
Comm.prototype.on_close = function (callback) {
this.jsServicesComm.onClose = callback.bind(this);
};
;
/**
* Hooks callback object up with @jupyterlab/services IKernelFuture
* @param @jupyterlab/services IKernelFuture instance
* @param callbacks
*/
Comm.prototype._hookupCallbacks = function (future, callbacks) {
if (callbacks) {
future.onReply = function (msg) {
if (callbacks.shell && callbacks.shell.reply)
callbacks.shell.reply(msg);
// TODO: Handle payloads. See https://github.com/jupyter/notebook/blob/master/notebook/static/services/kernels/kernel.js#L923-L947
};
future.onStdin = function (msg) {
if (callbacks.input)
callbacks.input(msg);
};
future.onIOPub = function (msg) {
if (callbacks.iopub) {
if (callbacks.iopub.status && msg.header.msg_type === 'status') {
callbacks.iopub.status(msg);
}
else if (callbacks.iopub.clear_output && msg.header.msg_type === 'clear_output') {
callbacks.iopub.clear_output(msg);
}
else if (callbacks.iopub.output) {
switch (msg.header.msg_type) {
case 'display_data':
case 'execute_result':
callbacks.iopub.output(msg);
break;
}
;
}
}
};
}
};
;
return Comm;
}());
services.Comm = Comm;
})(services = shims.services || (shims.services = {}));
})(shims = exports.shims || (exports.shims = {}));
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_core_1 = __webpack_require__(23);
var widget_1 = __webpack_require__(11);
var widget_style_1 = __webpack_require__(26);
var _ = __webpack_require__(2);
var $ = __webpack_require__(4);
__webpack_require__(41);
var d3format = __webpack_require__(47).format;
var IntModel = (function (_super) {
__extends(IntModel, _super);
function IntModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
IntModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'IntModel',
value: 0,
disabled: false,
});
};
return IntModel;
}(widget_core_1.CoreLabeledDOMWidgetModel));
exports.IntModel = IntModel;
var BoundedIntModel = (function (_super) {
__extends(BoundedIntModel, _super);
function BoundedIntModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
BoundedIntModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'BoundedIntModel',
step: 1,
max: 100,
min: 0
});
};
return BoundedIntModel;
}(IntModel));
exports.BoundedIntModel = BoundedIntModel;
var SliderStyleModel = (function (_super) {
__extends(SliderStyleModel, _super);
function SliderStyleModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
SliderStyleModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'SliderStyleModel',
});
};
SliderStyleModel.styleProperties = {
handle_color: {
selector: '.ui-slider-handle',
attribute: 'background-color',
default: null
}
};
return SliderStyleModel;
}(widget_style_1.StyleModel));
exports.SliderStyleModel = SliderStyleModel;
var IntSliderModel = (function (_super) {
__extends(IntSliderModel, _super);
function IntSliderModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
IntSliderModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'IntSliderModel',
_view_name: 'IntSliderView',
orientation: 'horizontal',
_range: false,
readout: true,
readout_format: 'd',
continuous_update: true,
style: void 0
});
};
IntSliderModel.prototype.initialize = function (attributes, options) {
_super.prototype.initialize.call(this, attributes, options);
this.on('change:readout_format', this.update_readout_format, this);
this.update_readout_format();
};
IntSliderModel.prototype.update_readout_format = function () {
this.readout_formatter = d3format(this.get('readout_format'));
};
return IntSliderModel;
}(BoundedIntModel));
exports.IntSliderModel = IntSliderModel;
var IntSliderView = (function (_super) {
__extends(IntSliderView, _super);
function IntSliderView() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._parse_value = parseInt;
_this._range_regex = /^\s*([+-]?\d+)\s*[-:]\s*([+-]?\d+)/;
return _this;
}
IntSliderView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-slider');
this.el.classList.add('widget-hslider');
(this.$slider = $('<div />'))
.slider({
slide: this.handleSliderChange.bind(this),
stop: this.handleSliderChanged.bind(this)
})
.addClass('slider');
// Put the slider in a container
this.slider_container = document.createElement('div');
this.slider_container.classList.add('slider-container');
this.slider_container.appendChild(this.$slider[0]);
this.el.appendChild(this.slider_container);
this.readout = document.createElement('div');
this.el.appendChild(this.readout);
this.readout.classList.add('widget-readout');
this.readout.contentEditable = 'true';
this.readout.style.display = 'none';
// Set defaults.
this.update();
};
IntSliderView.prototype.update = function (options) {
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
if (options === undefined || options.updated_view != this) {
// JQuery slider option keys. These keys happen to have a
// one-to-one mapping with the corresponding keys of the model.
var jquery_slider_keys = ['step', 'disabled'];
var that = this;
that.$slider.slider({});
_.each(jquery_slider_keys, function (key, i) {
var model_value = that.model.get(key);
if (model_value !== undefined) {
that.$slider.slider('option', key, model_value);
}
});
var max = this.model.get('max');
var min = this.model.get('min');
if (min <= max) {
if (max !== undefined)
this.$slider.slider('option', 'max', max);
if (min !== undefined)
this.$slider.slider('option', 'min', min);
}
var range_value = this.model.get('_range');
if (range_value !== undefined) {
this.$slider.slider('option', 'range', range_value);
}
// WORKAROUND FOR JQUERY SLIDER BUG.
// The horizontal position of the slider handle
// depends on the value of the slider at the time
// of orientation change. Before applying the new
// workaround, we set the value to the minimum to
// make sure that the horizontal placement of the
// handle in the vertical slider is always
// consistent.
var orientation = this.model.get('orientation');
var min = this.model.get('min');
var max = this.model.get('max');
if (this.model.get('_range')) {
this.$slider.slider('option', 'values', [min, min]);
}
else {
this.$slider.slider('option', 'value', min);
}
this.$slider.slider('option', 'orientation', orientation);
var value = this.model.get('value');
if (this.model.get('_range')) {
// values for the range case are validated python-side in
// _Bounded{Int,Float}RangeWidget._validate
this.$slider.slider('option', 'values', value);
this.readout.textContent = this.valueToString(value);
}
else {
if (value > max) {
value = max;
}
else if (value < min) {
value = min;
}
this.$slider.slider('option', 'value', value);
this.readout.textContent = this.valueToString(value);
}
if (this.model.get('value') != value) {
this.model.set('value', value, { updated_view: this });
this.touch();
}
// Use the right CSS classes for vertical & horizontal sliders
if (orientation == 'vertical') {
this.el.classList.remove('widget-hslider');
this.el.classList.add('widget-vslider');
this.el.classList.remove('widget-inline-hbox');
this.el.classList.add('widget-inline-vbox');
}
else {
this.el.classList.remove('widget-vslider');
this.el.classList.add('widget-hslider');
this.el.classList.remove('widget-inline-vbox');
this.el.classList.add('widget-inline-hbox');
}
var readout = this.model.get('readout');
if (readout) {
this.readout.style.display = '';
this.displayed.then(function () {
if (that.readout_overflow()) {
that.readout.classList.add('overflow');
}
else {
that.readout.classList.remove('overflow');
}
});
}
else {
this.readout.style.display = 'none';
}
}
return _super.prototype.update.call(this);
};
/**
* Returns true if the readout box content overflows.
*/
IntSliderView.prototype.readout_overflow = function () {
return this.readout.scrollWidth > this.readout.clientWidth;
};
/**
* Write value to a string
* @param {number|number[]} value
* @return {string}
*/
IntSliderView.prototype.valueToString = function (value) {
var format = this.model.readout_formatter;
if (this.model.get('_range')) {
return value.map(function (v) {
return format(v);
}).join(' – ');
}
else {
return format(value);
}
};
/**
* Parse value from a string
* @param {string} text
* @return {number|number[]} value
*/
IntSliderView.prototype.stringToValue = function (text) {
if (this.model.get('_range')) {
// range case
// ranges can be expressed either 'val-val' or 'val:val' (+spaces)
var match = this._range_regex.exec(text);
if (match) {
return [this._parse_value(match[1]), this._parse_value(match[2])];
}
else {
return null;
}
}
else {
return this._parse_value(text);
}
};
IntSliderView.prototype.events = function () {
return {
// Dictionary of events and their handlers.
'slide': 'handleSliderChange',
'slidestop': 'handleSliderChanged',
'blur [contentEditable=true]': 'handleTextChange',
'keydown [contentEditable=true]': 'handleKeyDown'
};
};
IntSliderView.prototype.handleKeyDown = function (e) {
if (e.keyCode == 13) {
e.preventDefault();
this.handleTextChange();
}
};
IntSliderView.prototype.handleTextChange = function () {
/**
* this handles the entry of text into the contentEditable label
* first, the value is checked if it contains a parseable number
* (or pair of numbers, for the _range case)
* then it is clamped within the min-max range of the slider
* finally, the model is updated if the value is to be changed
*
* if any of these conditions are not met, the text is reset
*
* the step size is not enforced
*/
var value = this.stringToValue(this.readout.textContent);
var vmin = this.model.get('min');
var vmax = this.model.get('max');
if (this.model.get('_range')) {
// reject input where NaN or lower > upper
if (value === null ||
isNaN(value[0]) ||
isNaN(value[1]) ||
(value[0] > value[1])) {
this.readout.textContent = this.valueToString(this.model.get('value'));
}
else {
// clamp to range
value = [Math.max(Math.min(value[0], vmax), vmin),
Math.max(Math.min(value[1], vmax), vmin)];
if ((value[0] != this.model.get('value')[0]) ||
(value[1] != this.model.get('value')[1])) {
this.readout.textContent = this.valueToString(value);
this.model.set('value', value, { updated_view: this });
this.touch();
}
else {
this.readout.textContent = this.valueToString(this.model.get('value'));
}
}
}
else {
// single value case
if (isNaN(value)) {
this.readout.textContent = this.valueToString(this.model.get('value'));
}
else {
value = Math.max(Math.min(value, vmax), vmin);
if (value != this.model.get('value')) {
this.readout.textContent = this.valueToString(value);
this.model.set('value', value, { updated_view: this });
this.touch();
}
else {
this.readout.textContent = this.valueToString(this.model.get('value'));
}
}
}
};
/**
* Called when the slider value is changing.
*/
IntSliderView.prototype.handleSliderChange = function (e, ui) {
var actual_value;
if (this.model.get('_range')) {
actual_value = ui.values.map(this._validate_slide_value);
this.readout.textContent = this.valueToString(actual_value);
}
else {
actual_value = this._validate_slide_value(ui.value);
this.readout.textContent = this.valueToString(actual_value);
}
// Only persist the value while sliding if the continuous_update
// trait is set to true.
if (this.model.get('continuous_update')) {
this.handleSliderChanged(e, ui);
}
};
/**
* Called when the slider value has changed.
*
* Calling model.set will trigger all of the other views of the
* model to update.
*/
IntSliderView.prototype.handleSliderChanged = function (e, ui) {
var actual_value;
if (this.model.get('_range')) {
actual_value = ui.values.map(this._validate_slide_value);
}
else {
actual_value = this._validate_slide_value(ui.value);
}
this.model.set('value', actual_value, { updated_view: this });
this.touch();
};
IntSliderView.prototype._validate_slide_value = function (x) {
/**
* Validate the value of the slider before sending it to the back-end
* and applying it to the other views on the page.
*/
return Math.floor(x);
};
return IntSliderView;
}(widget_1.LabeledDOMWidgetView));
exports.IntSliderView = IntSliderView;
var IntTextModel = (function (_super) {
__extends(IntTextModel, _super);
function IntTextModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
IntTextModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'IntTextModel',
_view_name: 'IntTextView'
});
};
return IntTextModel;
}(IntModel));
exports.IntTextModel = IntTextModel;
var IntTextView = (function (_super) {
__extends(IntTextView, _super);
function IntTextView() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._parse_value = parseInt;
return _this;
}
IntTextView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-text');
this.textbox = document.createElement('input');
this.textbox.setAttribute('type', 'text');
this.el.appendChild(this.textbox);
this.update(); // Set defaults.
};
IntTextView.prototype.update = function (options) {
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
if (options === undefined || options.updated_view != this) {
var value = this.model.get('value');
if (this._parse_value(this.textbox.value) !== value) {
this.textbox.value = value.toString();
}
var disabled = this.model.get('disabled');
if (disabled) {
this.textbox.setAttribute('disabled', disabled);
}
else {
this.textbox.removeAttribute('disabled');
}
}
return _super.prototype.update.call(this);
};
IntTextView.prototype.events = function () {
return {
// Dictionary of events and their handlers.
'keydown input': 'handleKeyDown',
'keypress input': 'handleKeypress',
'keyup input': 'handleChanging',
'paste input': 'handleChanging',
'cut input': 'handleChanging',
// Fires only when control is validated or looses focus.
'change input': 'handleChanged'
};
};
/**
* Handle key down
*
* Stop propagation so the event isn't sent to the application.
*/
IntTextView.prototype.handleKeyDown = function (e) {
e.stopPropagation();
};
/**
* Handles key press
*
* Stop propagation so the event isn't sent to the application.
*/
IntTextView.prototype.handleKeypress = function (e) {
e.stopPropagation();
};
IntTextView.prototype.handleChanging = function (e) {
/**
* Handles and validates user input.
*
* Try to parse value as an int.
*/
var numericalValue = 0;
var trimmed = e.target.value.trim();
if (trimmed === '') {
return;
}
else {
if (!(['-', '-.', '.', '+.', '+'].indexOf(trimmed) >= 0)) {
numericalValue = this._parse_value(e.target.value);
}
}
// If parse failed, reset value to value stored in model.
if (isNaN(numericalValue)) {
e.target.value = this.model.get('value');
}
else if (!isNaN(numericalValue)) {
if (this.model.get('max') !== undefined) {
numericalValue = Math.min(this.model.get('max'), numericalValue);
}
if (this.model.get('min') !== undefined) {
numericalValue = Math.max(this.model.get('min'), numericalValue);
}
// Apply the value if it has changed.
if (numericalValue != this.model.get('value')) {
// Calling model.set will trigger all of the other views of the
// model to update.
this.model.set('value', numericalValue, { updated_view: this });
this.touch();
}
}
};
IntTextView.prototype.handleChanged = function (e) {
/**
* Applies validated input.
*/
if (e.target.value.trim() === '' || e.target.value !== this.model.get('value')) {
e.target.value = this.model.get('value');
}
};
return IntTextView;
}(widget_1.LabeledDOMWidgetView));
exports.IntTextView = IntTextView;
var ProgressStyleModel = (function (_super) {
__extends(ProgressStyleModel, _super);
function ProgressStyleModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ProgressStyleModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'ProgressStyleModel',
});
};
ProgressStyleModel.styleProperties = {
bar_color: {
selector: '.progress-bar',
attribute: 'background-color',
default: null
}
};
return ProgressStyleModel;
}(widget_style_1.StyleModel));
exports.ProgressStyleModel = ProgressStyleModel;
var ProgressModel = (function (_super) {
__extends(ProgressModel, _super);
function ProgressModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ProgressModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'ProgressModel',
_view_name: 'ProgressView',
orientation: 'horizontal',
bar_style: '',
style: void 0
});
};
return ProgressModel;
}(BoundedIntModel));
exports.ProgressModel = ProgressModel;
var ProgressView = (function (_super) {
__extends(ProgressView, _super);
function ProgressView() {
return _super !== null && _super.apply(this, arguments) || this;
}
ProgressView.prototype.initialize = function (parameters) {
_super.prototype.initialize.call(this, parameters);
this.listenTo(this.model, 'change:bar_style', this.update_bar_style);
this.pWidget.addClass('jupyter-widgets');
};
ProgressView.prototype.render = function () {
_super.prototype.render.call(this);
var orientation = this.model.get('orientation');
var className = orientation === 'horizontal' ?
'widget-hprogress' : 'widget-vprogress';
this.el.classList.add(className);
this.progress = document.createElement('div');
this.progress.classList.add('progress');
this.progress.style.position = 'relative';
this.el.appendChild(this.progress);
this.bar = document.createElement('div');
this.bar.classList.add('progress-bar');
this.bar.style.position = 'absolute';
this.bar.style.bottom = '0px';
this.bar.style.left = '0px';
this.progress.appendChild(this.bar);
// Set defaults.
this.update();
this.set_bar_style();
};
ProgressView.prototype.update = function () {
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
var value = this.model.get('value');
var max = this.model.get('max');
var min = this.model.get('min');
var orientation = this.model.get('orientation');
var percent = 100.0 * (value - min) / (max - min);
if (orientation === 'horizontal') {
this.el.classList.remove('widget-inline-vbox');
this.el.classList.remove('widget-vprogress');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-hprogress');
this.bar.style.width = percent + '%';
this.bar.style.height = '100%';
}
else {
this.el.classList.remove('widget-inline-hbox');
this.el.classList.remove('widget-hprogress');
this.el.classList.add('widget-inline-vbox');
this.el.classList.add('widget-vprogress');
this.bar.style.width = '100%';
this.bar.style.height = percent + '%';
}
return _super.prototype.update.call(this);
};
ProgressView.prototype.update_bar_style = function () {
this.update_mapped_classes(ProgressView.class_map, 'bar_style', this.bar);
};
ProgressView.prototype.set_bar_style = function () {
this.set_mapped_classes(ProgressView.class_map, 'bar_style', this.bar);
};
ProgressView.class_map = {
success: ['progress-bar-success'],
info: ['progress-bar-info'],
warning: ['progress-bar-warning'],
danger: ['progress-bar-danger']
};
return ProgressView;
}(widget_1.LabeledDOMWidgetView));
exports.ProgressView = ProgressView;
var PlayModel = (function (_super) {
__extends(PlayModel, _super);
function PlayModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
PlayModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'PlayModel',
_view_name: 'PlayView',
_playing: false,
interval: 100
});
};
PlayModel.prototype.initialize = function (attributes, options) {
_super.prototype.initialize.call(this, attributes, options);
this.on('change:_playing', function () {
if (this.get('_playing')) {
this.loop();
}
}, this);
};
PlayModel.prototype.loop = function () {
if (this.get('_playing')) {
var next_value = this.get('value') + this.get('step');
if (next_value < this.get('max')) {
this.set('value', next_value);
window.setTimeout(this.loop.bind(this), this.get('interval'));
}
else {
this.set('value', this.get('min'));
this.set('_playing', false);
}
this.save_changes();
}
};
PlayModel.prototype.stop = function () {
this.set('_playing', false);
this.set('value', this.get('min'));
this.save_changes();
};
PlayModel.prototype.pause = function () {
this.set('_playing', false);
this.save_changes();
};
PlayModel.prototype.play = function () {
this.set('_playing', true);
this.save_changes();
};
return PlayModel;
}(BoundedIntModel));
exports.PlayModel = PlayModel;
var PlayView = (function (_super) {
__extends(PlayView, _super);
function PlayView() {
return _super !== null && _super.apply(this, arguments) || this;
}
PlayView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-play');
this.playButton = document.createElement('button');
this.pauseButton = document.createElement('button');
this.stopButton = document.createElement('button');
this.playButton.className = 'jupyter-button';
this.pauseButton.className = 'jupyter-button';
this.stopButton.className = 'jupyter-button';
this.el.appendChild(this.playButton); // Toggle button with playing
this.el.appendChild(this.pauseButton); // Disable if not playing
this.el.appendChild(this.stopButton); // Disable if not playing
var playIcon = document.createElement('i');
playIcon.className = 'fa fa-play';
this.playButton.appendChild(playIcon);
var pauseIcon = document.createElement('i');
pauseIcon.className = 'fa fa-pause';
this.pauseButton.appendChild(pauseIcon);
var stopIcon = document.createElement('i');
stopIcon.className = 'fa fa-stop';
this.stopButton.appendChild(stopIcon);
this.playButton.onclick = this.model.play.bind(this.model);
this.pauseButton.onclick = this.model.pause.bind(this.model);
this.stopButton.onclick = this.model.stop.bind(this.model);
this.listenTo(this.model, 'change:_playing', this.update_playing);
this.update_playing();
};
PlayView.prototype.update_playing = function () {
var playing = this.model.get('_playing');
if (playing) {
this.pauseButton.disabled = false;
this.playButton.classList.add('mod-active');
}
else {
this.pauseButton.disabled = true;
this.playButton.classList.remove('mod-active');
}
};
return PlayView;
}(widget_1.DOMWidgetView));
exports.PlayView = PlayView;
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
* jQuery UI Slider 1.12.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Slider
//>>group: Widgets
//>>description: Displays a flexible slider with ranges and accessibility via keyboard.
//>>docs: http://api.jqueryui.com/slider/
//>>demos: http://jqueryui.com/slider/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/slider.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
if ( true ) {
// AMD. Register as an anonymous module.
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
__webpack_require__(4),
__webpack_require__(42),
__webpack_require__(46),
__webpack_require__(44),
__webpack_require__(45)
], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
// Browser globals
factory( jQuery );
}
}( function( $ ) {
return $.widget( "ui.slider", $.ui.mouse, {
version: "1.12.1",
widgetEventPrefix: "slide",
options: {
animate: false,
classes: {
"ui-slider": "ui-corner-all",
"ui-slider-handle": "ui-corner-all",
// Note: ui-widget-header isn't the most fittingly semantic framework class for this
// element, but worked best visually with a variety of themes
"ui-slider-range": "ui-corner-all ui-widget-header"
},
distance: 0,
max: 100,
min: 0,
orientation: "horizontal",
range: false,
step: 1,
value: 0,
values: null,
// Callbacks
change: null,
slide: null,
start: null,
stop: null
},
// Number of pages in a slider
// (how many times can you page up/down to go through the whole range)
numPages: 5,
_create: function() {
this._keySliding = false;
this._mouseSliding = false;
this._animateOff = true;
this._handleIndex = null;
this._detectOrientation();
this._mouseInit();
this._calculateNewMax();
this._addClass( "ui-slider ui-slider-" + this.orientation,
"ui-widget ui-widget-content" );
this._refresh();
this._animateOff = false;
},
_refresh: function() {
this._createRange();
this._createHandles();
this._setupEvents();
this._refreshValue();
},
_createHandles: function() {
var i, handleCount,
options = this.options,
existingHandles = this.element.find( ".ui-slider-handle" ),
handle = "<span tabindex='0'></span>",
handles = [];
handleCount = ( options.values && options.values.length ) || 1;
if ( existingHandles.length > handleCount ) {
existingHandles.slice( handleCount ).remove();
existingHandles = existingHandles.slice( 0, handleCount );
}
for ( i = existingHandles.length; i < handleCount; i++ ) {
handles.push( handle );
}
this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );
this.handle = this.handles.eq( 0 );
this.handles.each( function( i ) {
$( this )
.data( "ui-slider-handle-index", i )
.attr( "tabIndex", 0 );
} );
},
_createRange: function() {
var options = this.options;
if ( options.range ) {
if ( options.range === true ) {
if ( !options.values ) {
options.values = [ this._valueMin(), this._valueMin() ];
} else if ( options.values.length && options.values.length !== 2 ) {
options.values = [ options.values[ 0 ], options.values[ 0 ] ];
} else if ( $.isArray( options.values ) ) {
options.values = options.values.slice( 0 );
}
}
if ( !this.range || !this.range.length ) {
this.range = $( "<div>" )
.appendTo( this.element );
this._addClass( this.range, "ui-slider-range" );
} else {
this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );
// Handle range switching from true to min/max
this.range.css( {
"left": "",
"bottom": ""
} );
}
if ( options.range === "min" || options.range === "max" ) {
this._addClass( this.range, "ui-slider-range-" + options.range );
}
} else {
if ( this.range ) {
this.range.remove();
}
this.range = null;
}
},
_setupEvents: function() {
this._off( this.handles );
this._on( this.handles, this._handleEvents );
this._hoverable( this.handles );
this._focusable( this.handles );
},
_destroy: function() {
this.handles.remove();
if ( this.range ) {
this.range.remove();
}
this._mouseDestroy();
},
_mouseCapture: function( event ) {
var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
that = this,
o = this.options;
if ( o.disabled ) {
return false;
}
this.elementSize = {
width: this.element.outerWidth(),
height: this.element.outerHeight()
};
this.elementOffset = this.element.offset();
position = { x: event.pageX, y: event.pageY };
normValue = this._normValueFromMouse( position );
distance = this._valueMax() - this._valueMin() + 1;
this.handles.each( function( i ) {
var thisDistance = Math.abs( normValue - that.values( i ) );
if ( ( distance > thisDistance ) ||
( distance === thisDistance &&
( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
distance = thisDistance;
closestHandle = $( this );
index = i;
}
} );
allowed = this._start( event, index );
if ( allowed === false ) {
return false;
}
this._mouseSliding = true;
this._handleIndex = index;
this._addClass( closestHandle, null, "ui-state-active" );
closestHandle.trigger( "focus" );
offset = closestHandle.offset();
mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
top: event.pageY - offset.top -
( closestHandle.height() / 2 ) -
( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -
( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +
( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
};
if ( !this.handles.hasClass( "ui-state-hover" ) ) {
this._slide( event, index, normValue );
}
this._animateOff = true;
return true;
},
_mouseStart: function() {
return true;
},
_mouseDrag: function( event ) {
var position = { x: event.pageX, y: event.pageY },
normValue = this._normValueFromMouse( position );
this._slide( event, this._handleIndex, normValue );
return false;
},
_mouseStop: function( event ) {
this._removeClass( this.handles, null, "ui-state-active" );
this._mouseSliding = false;
this._stop( event, this._handleIndex );
this._change( event, this._handleIndex );
this._handleIndex = null;
this._clickOffset = null;
this._animateOff = false;
return false;
},
_detectOrientation: function() {
this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
},
_normValueFromMouse: function( position ) {
var pixelTotal,
pixelMouse,
percentMouse,
valueTotal,
valueMouse;
if ( this.orientation === "horizontal" ) {
pixelTotal = this.elementSize.width;
pixelMouse = position.x - this.elementOffset.left -
( this._clickOffset ? this._clickOffset.left : 0 );
} else {
pixelTotal = this.elementSize.height;
pixelMouse = position.y - this.elementOffset.top -
( this._clickOffset ? this._clickOffset.top : 0 );
}
percentMouse = ( pixelMouse / pixelTotal );
if ( percentMouse > 1 ) {
percentMouse = 1;
}
if ( percentMouse < 0 ) {
percentMouse = 0;
}
if ( this.orientation === "vertical" ) {
percentMouse = 1 - percentMouse;
}
valueTotal = this._valueMax() - this._valueMin();
valueMouse = this._valueMin() + percentMouse * valueTotal;
return this._trimAlignValue( valueMouse );
},
_uiHash: function( index, value, values ) {
var uiHash = {
handle: this.handles[ index ],
handleIndex: index,
value: value !== undefined ? value : this.value()
};
if ( this._hasMultipleValues() ) {
uiHash.value = value !== undefined ? value : this.values( index );
uiHash.values = values || this.values();
}
return uiHash;
},
_hasMultipleValues: function() {
return this.options.values && this.options.values.length;
},
_start: function( event, index ) {
return this._trigger( "start", event, this._uiHash( index ) );
},
_slide: function( event, index, newVal ) {
var allowed, otherVal,
currentValue = this.value(),
newValues = this.values();
if ( this._hasMultipleValues() ) {
otherVal = this.values( index ? 0 : 1 );
currentValue = this.values( index );
if ( this.options.values.length === 2 && this.options.range === true ) {
newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );
}
newValues[ index ] = newVal;
}
if ( newVal === currentValue ) {
return;
}
allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );
// A slide can be canceled by returning false from the slide callback
if ( allowed === false ) {
return;
}
if ( this._hasMultipleValues() ) {
this.values( index, newVal );
} else {
this.value( newVal );
}
},
_stop: function( event, index ) {
this._trigger( "stop", event, this._uiHash( index ) );
},
_change: function( event, index ) {
if ( !this._keySliding && !this._mouseSliding ) {
//store the last changed value index for reference when handles overlap
this._lastChangedValue = index;
this._trigger( "change", event, this._uiHash( index ) );
}
},
value: function( newValue ) {
if ( arguments.length ) {
this.options.value = this._trimAlignValue( newValue );
this._refreshValue();
this._change( null, 0 );
return;
}
return this._value();
},
values: function( index, newValue ) {
var vals,
newValues,
i;
if ( arguments.length > 1 ) {
this.options.values[ index ] = this._trimAlignValue( newValue );
this._refreshValue();
this._change( null, index );
return;
}
if ( arguments.length ) {
if ( $.isArray( arguments[ 0 ] ) ) {
vals = this.options.values;
newValues = arguments[ 0 ];
for ( i = 0; i < vals.length; i += 1 ) {
vals[ i ] = this._trimAlignValue( newValues[ i ] );
this._change( null, i );
}
this._refreshValue();
} else {
if ( this._hasMultipleValues() ) {
return this._values( index );
} else {
return this.value();
}
}
} else {
return this._values();
}
},
_setOption: function( key, value ) {
var i,
valsLength = 0;
if ( key === "range" && this.options.range === true ) {
if ( value === "min" ) {
this.options.value = this._values( 0 );
this.options.values = null;
} else if ( value === "max" ) {
this.options.value = this._values( this.options.values.length - 1 );
this.options.values = null;
}
}
if ( $.isArray( this.options.values ) ) {
valsLength = this.options.values.length;
}
this._super( key, value );
switch ( key ) {
case "orientation":
this._detectOrientation();
this._removeClass( "ui-slider-horizontal ui-slider-vertical" )
._addClass( "ui-slider-" + this.orientation );
this._refreshValue();
if ( this.options.range ) {
this._refreshRange( value );
}
// Reset positioning from previous orientation
this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
break;
case "value":
this._animateOff = true;
this._refreshValue();
this._change( null, 0 );
this._animateOff = false;
break;
case "values":
this._animateOff = true;
this._refreshValue();
// Start from the last handle to prevent unreachable handles (#9046)
for ( i = valsLength - 1; i >= 0; i-- ) {
this._change( null, i );
}
this._animateOff = false;
break;
case "step":
case "min":
case "max":
this._animateOff = true;
this._calculateNewMax();
this._refreshValue();
this._animateOff = false;
break;
case "range":
this._animateOff = true;
this._refresh();
this._animateOff = false;
break;
}
},
_setOptionDisabled: function( value ) {
this._super( value );
this._toggleClass( null, "ui-state-disabled", !!value );
},
//internal value getter
// _value() returns value trimmed by min and max, aligned by step
_value: function() {
var val = this.options.value;
val = this._trimAlignValue( val );
return val;
},
//internal values getter
// _values() returns array of values trimmed by min and max, aligned by step
// _values( index ) returns single value trimmed by min and max, aligned by step
_values: function( index ) {
var val,
vals,
i;
if ( arguments.length ) {
val = this.options.values[ index ];
val = this._trimAlignValue( val );
return val;
} else if ( this._hasMultipleValues() ) {
// .slice() creates a copy of the array
// this copy gets trimmed by min and max and then returned
vals = this.options.values.slice();
for ( i = 0; i < vals.length; i += 1 ) {
vals[ i ] = this._trimAlignValue( vals[ i ] );
}
return vals;
} else {
return [];
}
},
// Returns the step-aligned value that val is closest to, between (inclusive) min and max
_trimAlignValue: function( val ) {
if ( val <= this._valueMin() ) {
return this._valueMin();
}
if ( val >= this._valueMax() ) {
return this._valueMax();
}
var step = ( this.options.step > 0 ) ? this.options.step : 1,
valModStep = ( val - this._valueMin() ) % step,
alignValue = val - valModStep;
if ( Math.abs( valModStep ) * 2 >= step ) {
alignValue += ( valModStep > 0 ) ? step : ( -step );
}
// Since JavaScript has problems with large floats, round
// the final value to 5 digits after the decimal point (see #4124)
return parseFloat( alignValue.toFixed( 5 ) );
},
_calculateNewMax: function() {
var max = this.options.max,
min = this._valueMin(),
step = this.options.step,
aboveMin = Math.round( ( max - min ) / step ) * step;
max = aboveMin + min;
if ( max > this.options.max ) {
//If max is not divisible by step, rounding off may increase its value
max -= step;
}
this.max = parseFloat( max.toFixed( this._precision() ) );
},
_precision: function() {
var precision = this._precisionOf( this.options.step );
if ( this.options.min !== null ) {
precision = Math.max( precision, this._precisionOf( this.options.min ) );
}
return precision;
},
_precisionOf: function( num ) {
var str = num.toString(),
decimal = str.indexOf( "." );
return decimal === -1 ? 0 : str.length - decimal - 1;
},
_valueMin: function() {
return this.options.min;
},
_valueMax: function() {
return this.max;
},
_refreshRange: function( orientation ) {
if ( orientation === "vertical" ) {
this.range.css( { "width": "", "left": "" } );
}
if ( orientation === "horizontal" ) {
this.range.css( { "height": "", "bottom": "" } );
}
},
_refreshValue: function() {
var lastValPercent, valPercent, value, valueMin, valueMax,
oRange = this.options.range,
o = this.options,
that = this,
animate = ( !this._animateOff ) ? o.animate : false,
_set = {};
if ( this._hasMultipleValues() ) {
this.handles.each( function( i ) {
valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
that._valueMin() ) * 100;
_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
if ( that.options.range === true ) {
if ( that.orientation === "horizontal" ) {
if ( i === 0 ) {
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
left: valPercent + "%"
}, o.animate );
}
if ( i === 1 ) {
that.range[ animate ? "animate" : "css" ]( {
width: ( valPercent - lastValPercent ) + "%"
}, {
queue: false,
duration: o.animate
} );
}
} else {
if ( i === 0 ) {
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
bottom: ( valPercent ) + "%"
}, o.animate );
}
if ( i === 1 ) {
that.range[ animate ? "animate" : "css" ]( {
height: ( valPercent - lastValPercent ) + "%"
}, {
queue: false,
duration: o.animate
} );
}
}
}
lastValPercent = valPercent;
} );
} else {
value = this.value();
valueMin = this._valueMin();
valueMax = this._valueMax();
valPercent = ( valueMax !== valueMin ) ?
( value - valueMin ) / ( valueMax - valueMin ) * 100 :
0;
_set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
if ( oRange === "min" && this.orientation === "horizontal" ) {
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
width: valPercent + "%"
}, o.animate );
}
if ( oRange === "max" && this.orientation === "horizontal" ) {
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
width: ( 100 - valPercent ) + "%"
}, o.animate );
}
if ( oRange === "min" && this.orientation === "vertical" ) {
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
height: valPercent + "%"
}, o.animate );
}
if ( oRange === "max" && this.orientation === "vertical" ) {
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
height: ( 100 - valPercent ) + "%"
}, o.animate );
}
}
},
_handleEvents: {
keydown: function( event ) {
var allowed, curVal, newVal, step,
index = $( event.target ).data( "ui-slider-handle-index" );
switch ( event.keyCode ) {
case $.ui.keyCode.HOME:
case $.ui.keyCode.END:
case $.ui.keyCode.PAGE_UP:
case $.ui.keyCode.PAGE_DOWN:
case $.ui.keyCode.UP:
case $.ui.keyCode.RIGHT:
case $.ui.keyCode.DOWN:
case $.ui.keyCode.LEFT:
event.preventDefault();
if ( !this._keySliding ) {
this._keySliding = true;
this._addClass( $( event.target ), null, "ui-state-active" );
allowed = this._start( event, index );
if ( allowed === false ) {
return;
}
}
break;
}
step = this.options.step;
if ( this._hasMultipleValues() ) {
curVal = newVal = this.values( index );
} else {
curVal = newVal = this.value();
}
switch ( event.keyCode ) {
case $.ui.keyCode.HOME:
newVal = this._valueMin();
break;
case $.ui.keyCode.END:
newVal = this._valueMax();
break;
case $.ui.keyCode.PAGE_UP:
newVal = this._trimAlignValue(
curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
);
break;
case $.ui.keyCode.PAGE_DOWN:
newVal = this._trimAlignValue(
curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
break;
case $.ui.keyCode.UP:
case $.ui.keyCode.RIGHT:
if ( curVal === this._valueMax() ) {
return;
}
newVal = this._trimAlignValue( curVal + step );
break;
case $.ui.keyCode.DOWN:
case $.ui.keyCode.LEFT:
if ( curVal === this._valueMin() ) {
return;
}
newVal = this._trimAlignValue( curVal - step );
break;
}
this._slide( event, index, newVal );
},
keyup: function( event ) {
var index = $( event.target ).data( "ui-slider-handle-index" );
if ( this._keySliding ) {
this._keySliding = false;
this._stop( event, index );
this._change( event, index );
this._removeClass( $( event.target ), null, "ui-state-active" );
}
}
}
} );
} ) );
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
* jQuery UI Mouse 1.12.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Mouse
//>>group: Widgets
//>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
//>>docs: http://api.jqueryui.com/mouse/
( function( factory ) {
if ( true ) {
// AMD. Register as an anonymous module.
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
__webpack_require__(4),
__webpack_require__(43),
__webpack_require__(44),
__webpack_require__(45)
], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
// Browser globals
factory( jQuery );
}
}( function( $ ) {
var mouseHandled = false;
$( document ).on( "mouseup", function() {
mouseHandled = false;
} );
return $.widget( "ui.mouse", {
version: "1.12.1",
options: {
cancel: "input, textarea, button, select, option",
distance: 1,
delay: 0
},
_mouseInit: function() {
var that = this;
this.element
.on( "mousedown." + this.widgetName, function( event ) {
return that._mouseDown( event );
} )
.on( "click." + this.widgetName, function( event ) {
if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
$.removeData( event.target, that.widgetName + ".preventClickEvent" );
event.stopImmediatePropagation();
return false;
}
} );
this.started = false;
},
// TODO: make sure destroying one instance of mouse doesn't mess with
// other instances of mouse
_mouseDestroy: function() {
this.element.off( "." + this.widgetName );
if ( this._mouseMoveDelegate ) {
this.document
.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
}
},
_mouseDown: function( event ) {
// don't let more than one widget handle mouseStart
if ( mouseHandled ) {
return;
}
this._mouseMoved = false;
// We may have missed mouseup (out of window)
( this._mouseStarted && this._mouseUp( event ) );
this._mouseDownEvent = event;
var that = this,
btnIsLeft = ( event.which === 1 ),
// event.target.nodeName works around a bug in IE 8 with
// disabled inputs (#7620)
elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
$( event.target ).closest( this.options.cancel ).length : false );
if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
return true;
}
this.mouseDelayMet = !this.options.delay;
if ( !this.mouseDelayMet ) {
this._mouseDelayTimer = setTimeout( function() {
that.mouseDelayMet = true;
}, this.options.delay );
}
if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
this._mouseStarted = ( this._mouseStart( event ) !== false );
if ( !this._mouseStarted ) {
event.preventDefault();
return true;
}
}
// Click event may never have fired (Gecko & Opera)
if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
$.removeData( event.target, this.widgetName + ".preventClickEvent" );
}
// These delegates are required to keep context
this._mouseMoveDelegate = function( event ) {
return that._mouseMove( event );
};
this._mouseUpDelegate = function( event ) {
return that._mouseUp( event );
};
this.document
.on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.on( "mouseup." + this.widgetName, this._mouseUpDelegate );
event.preventDefault();
mouseHandled = true;
return true;
},
_mouseMove: function( event ) {
// Only check for mouseups outside the document if you've moved inside the document
// at least once. This prevents the firing of mouseup in the case of IE<9, which will
// fire a mousemove event if content is placed under the cursor. See #7778
// Support: IE <9
if ( this._mouseMoved ) {
// IE mouseup check - mouseup happened when mouse was out of window
if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
!event.button ) {
return this._mouseUp( event );
// Iframe mouseup check - mouseup occurred in another document
} else if ( !event.which ) {
// Support: Safari <=8 - 9
// Safari sets which to 0 if you press any of the following keys
// during a drag (#14461)
if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
this.ignoreMissingWhich = true;
} else if ( !this.ignoreMissingWhich ) {
return this._mouseUp( event );
}
}
}
if ( event.which || event.button ) {
this._mouseMoved = true;
}
if ( this._mouseStarted ) {
this._mouseDrag( event );
return event.preventDefault();
}
if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
this._mouseStarted =
( this._mouseStart( this._mouseDownEvent, event ) !== false );
( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) );
}
return !this._mouseStarted;
},
_mouseUp: function( event ) {
this.document
.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
if ( this._mouseStarted ) {
this._mouseStarted = false;
if ( event.target === this._mouseDownEvent.target ) {
$.data( event.target, this.widgetName + ".preventClickEvent", true );
}
this._mouseStop( event );
}
if ( this._mouseDelayTimer ) {
clearTimeout( this._mouseDelayTimer );
delete this._mouseDelayTimer;
}
this.ignoreMissingWhich = false;
mouseHandled = false;
event.preventDefault();
},
_mouseDistanceMet: function( event ) {
return ( Math.max(
Math.abs( this._mouseDownEvent.pageX - event.pageX ),
Math.abs( this._mouseDownEvent.pageY - event.pageY )
) >= this.options.distance
);
},
_mouseDelayMet: function( /* event */ ) {
return this.mouseDelayMet;
},
// These are placeholder methods, to be overriden by extending plugin
_mouseStart: function( /* event */ ) {},
_mouseDrag: function( /* event */ ) {},
_mouseStop: function( /* event */ ) {},
_mouseCapture: function( /* event */ ) { return true; }
} );
} ) );
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
if ( true ) {
// AMD. Register as an anonymous module.
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4), __webpack_require__(44) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
// Browser globals
factory( jQuery );
}
} ( function( $ ) {
// This file is deprecated
return $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
} ) );
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
if ( true ) {
// AMD. Register as an anonymous module.
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
// Browser globals
factory( jQuery );
}
} ( function( $ ) {
$.ui = $.ui || {};
return $.ui.version = "1.12.1";
} ) );
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
* jQuery UI Widget 1.12.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Widget
//>>group: Core
//>>description: Provides a factory for creating stateful widgets with a common API.
//>>docs: http://api.jqueryui.com/jQuery.widget/
//>>demos: http://jqueryui.com/widget/
( function( factory ) {
if ( true ) {
// AMD. Register as an anonymous module.
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4), __webpack_require__(44) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
// Browser globals
factory( jQuery );
}
}( function( $ ) {
var widgetUuid = 0;
var widgetSlice = Array.prototype.slice;
$.cleanData = ( function( orig ) {
return function( elems ) {
var events, elem, i;
for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
try {
// Only trigger remove when necessary to save time
events = $._data( elem, "events" );
if ( events && events.remove ) {
$( elem ).triggerHandler( "remove" );
}
// Http://bugs.jquery.com/ticket/8235
} catch ( e ) {}
}
orig( elems );
};
} )( $.cleanData );
$.widget = function( name, base, prototype ) {
var existingConstructor, constructor, basePrototype;
// ProxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
var proxiedPrototype = {};
var namespace = name.split( "." )[ 0 ];
name = name.split( "." )[ 1 ];
var fullName = namespace + "-" + name;
if ( !prototype ) {
prototype = base;
base = $.Widget;
}
if ( $.isArray( prototype ) ) {
prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
}
// Create selector for plugin
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
return !!$.data( elem, fullName );
};
$[ namespace ] = $[ namespace ] || {};
existingConstructor = $[ namespace ][ name ];
constructor = $[ namespace ][ name ] = function( options, element ) {
// Allow instantiation without "new" keyword
if ( !this._createWidget ) {
return new constructor( options, element );
}
// Allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if ( arguments.length ) {
this._createWidget( options, element );
}
};
// Extend with the existing constructor to carry over any static properties
$.extend( constructor, existingConstructor, {
version: prototype.version,
// Copy the object used to create the prototype in case we need to
// redefine the widget later
_proto: $.extend( {}, prototype ),
// Track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors: []
} );
basePrototype = new base();
// We need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options = $.widget.extend( {}, basePrototype.options );
$.each( prototype, function( prop, value ) {
if ( !$.isFunction( value ) ) {
proxiedPrototype[ prop ] = value;
return;
}
proxiedPrototype[ prop ] = ( function() {
function _super() {
return base.prototype[ prop ].apply( this, arguments );
}
function _superApply( args ) {
return base.prototype[ prop ].apply( this, args );
}
return function() {
var __super = this._super;
var __superApply = this._superApply;
var returnValue;
this._super = _super;
this._superApply = _superApply;
returnValue = value.apply( this, arguments );
this._super = __super;
this._superApply = __superApply;
return returnValue;
};
} )();
} );
constructor.prototype = $.widget.extend( basePrototype, {
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
}, proxiedPrototype, {
constructor: constructor,
namespace: namespace,
widgetName: name,
widgetFullName: fullName
} );
// If this widget is being redefined then we need to find all widgets that
// are inheriting from it and redefine all of them so that they inherit from
// the new version of this widget. We're essentially trying to replace one
// level in the prototype chain.
if ( existingConstructor ) {
$.each( existingConstructor._childConstructors, function( i, child ) {
var childPrototype = child.prototype;
// Redefine the child widget using the same prototype that was
// originally used, but inherit from the new version of the base
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
child._proto );
} );
// Remove the list of existing child constructors from the old constructor
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors;
} else {
base._childConstructors.push( constructor );
}
$.widget.bridge( name, constructor );
return constructor;
};
$.widget.extend = function( target ) {
var input = widgetSlice.call( arguments, 1 );
var inputIndex = 0;
var inputLength = input.length;
var key;
var value;
for ( ; inputIndex < inputLength; inputIndex++ ) {
for ( key in input[ inputIndex ] ) {
value = input[ inputIndex ][ key ];
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
// Clone objects
if ( $.isPlainObject( value ) ) {
target[ key ] = $.isPlainObject( target[ key ] ) ?
$.widget.extend( {}, target[ key ], value ) :
// Don't extend strings, arrays, etc. with objects
$.widget.extend( {}, value );
// Copy everything else by reference
} else {
target[ key ] = value;
}
}
}
}
return target;
};
$.widget.bridge = function( name, object ) {
var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string";
var args = widgetSlice.call( arguments, 1 );
var returnValue = this;
if ( isMethodCall ) {
// If this is an empty collection, we need to have the instance method
// return undefined instead of the jQuery instance
if ( !this.length && options === "instance" ) {
returnValue = undefined;
} else {
this.each( function() {
var methodValue;
var instance = $.data( this, fullName );
if ( options === "instance" ) {
returnValue = instance;
return false;
}
if ( !instance ) {
return $.error( "cannot call methods on " + name +
" prior to initialization; " +
"attempted to call method '" + options + "'" );
}
if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name +
" widget instance" );
}
methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack( methodValue.get() ) :
methodValue;
return false;
}
} );
}
} else {
// Allow multiple hashes to be passed on init
if ( args.length ) {
options = $.widget.extend.apply( null, [ options ].concat( args ) );
}
this.each( function() {
var instance = $.data( this, fullName );
if ( instance ) {
instance.option( options || {} );
if ( instance._init ) {
instance._init();
}
} else {
$.data( this, fullName, new object( options, this ) );
}
} );
}
return returnValue;
};
};
$.Widget = function( /* options, element */ ) {};
$.Widget._childConstructors = [];
$.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
defaultElement: "<div>",
options: {
classes: {},
disabled: false,
// Callbacks
create: null
},
_createWidget: function( options, element ) {
element = $( element || this.defaultElement || this )[ 0 ];
this.element = $( element );
this.uuid = widgetUuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
this.bindings = $();
this.hoverable = $();
this.focusable = $();
this.classesElementLookup = {};
if ( element !== this ) {
$.data( element, this.widgetFullName, this );
this._on( true, this.element, {
remove: function( event ) {
if ( event.target === element ) {
this.destroy();
}
}
} );
this.document = $( element.style ?
// Element within the document
element.ownerDocument :
// Element is window or document
element.document || element );
this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
}
this.options = $.widget.extend( {},
this.options,
this._getCreateOptions(),
options );
this._create();
if ( this.options.disabled ) {
this._setOptionDisabled( this.options.disabled );
}
this._trigger( "create", null, this._getCreateEventData() );
this._init();
},
_getCreateOptions: function() {
return {};
},
_getCreateEventData: $.noop,
_create: $.noop,
_init: $.noop,
destroy: function() {
var that = this;
this._destroy();
$.each( this.classesElementLookup, function( key, value ) {
that._removeClass( value, key );
} );
// We can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element
.off( this.eventNamespace )
.removeData( this.widgetFullName );
this.widget()
.off( this.eventNamespace )
.removeAttr( "aria-disabled" );
// Clean up events and states
this.bindings.off( this.eventNamespace );
},
_destroy: $.noop,
widget: function() {
return this.element;
},
option: function( key, value ) {
var options = key;
var parts;
var curOption;
var i;
if ( arguments.length === 0 ) {
// Don't return a reference to the internal hash
return $.widget.extend( {}, this.options );
}
if ( typeof key === "string" ) {
// Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
options = {};
parts = key.split( "." );
key = parts.shift();
if ( parts.length ) {
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
for ( i = 0; i < parts.length - 1; i++ ) {
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
curOption = curOption[ parts[ i ] ];
}
key = parts.pop();
if ( arguments.length === 1 ) {
return curOption[ key ] === undefined ? null : curOption[ key ];
}
curOption[ key ] = value;
} else {
if ( arguments.length === 1 ) {
return this.options[ key ] === undefined ? null : this.options[ key ];
}
options[ key ] = value;
}
}
this._setOptions( options );
return this;
},
_setOptions: function( options ) {
var key;
for ( key in options ) {
this._setOption( key, options[ key ] );
}
return this;
},
_setOption: function( key, value ) {
if ( key === "classes" ) {
this._setOptionClasses( value );
}
this.options[ key ] = value;
if ( key === "disabled" ) {
this._setOptionDisabled( value );
}
return this;
},
_setOptionClasses: function( value ) {
var classKey, elements, currentElements;
for ( classKey in value ) {
currentElements = this.classesElementLookup[ classKey ];
if ( value[ classKey ] === this.options.classes[ classKey ] ||
!currentElements ||
!currentElements.length ) {
continue;
}
// We are doing this to create a new jQuery object because the _removeClass() call
// on the next line is going to destroy the reference to the current elements being
// tracked. We need to save a copy of this collection so that we can add the new classes
// below.
elements = $( currentElements.get() );
this._removeClass( currentElements, classKey );
// We don't use _addClass() here, because that uses this.options.classes
// for generating the string of classes. We want to use the value passed in from
// _setOption(), this is the new value of the classes option which was passed to
// _setOption(). We pass this value directly to _classes().
elements.addClass( this._classes( {
element: elements,
keys: classKey,
classes: value,
add: true
} ) );
}
},
_setOptionDisabled: function( value ) {
this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
// If the widget is becoming disabled, then nothing is interactive
if ( value ) {
this._removeClass( this.hoverable, null, "ui-state-hover" );
this._removeClass( this.focusable, null, "ui-state-focus" );
}
},
enable: function() {
return this._setOptions( { disabled: false } );
},
disable: function() {
return this._setOptions( { disabled: true } );
},
_classes: function( options ) {
var full = [];
var that = this;
options = $.extend( {
element: this.element,
classes: this.options.classes || {}
}, options );
function processClassString( classes, checkOption ) {
var current, i;
for ( i = 0; i < classes.length; i++ ) {
current = that.classesElementLookup[ classes[ i ] ] || $();
if ( options.add ) {
current = $( $.unique( current.get().concat( options.element.get() ) ) );
} else {
current = $( current.not( options.element ).get() );
}
that.classesElementLookup[ classes[ i ] ] = current;
full.push( classes[ i ] );
if ( checkOption && options.classes[ classes[ i ] ] ) {
full.push( options.classes[ classes[ i ] ] );
}
}
}
this._on( options.element, {
"remove": "_untrackClassesElement"
} );
if ( options.keys ) {
processClassString( options.keys.match( /\S+/g ) || [], true );
}
if ( options.extra ) {
processClassString( options.extra.match( /\S+/g ) || [] );
}
return full.join( " " );
},
_untrackClassesElement: function( event ) {
var that = this;
$.each( that.classesElementLookup, function( key, value ) {
if ( $.inArray( event.target, value ) !== -1 ) {
that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
}
} );
},
_removeClass: function( element, keys, extra ) {
return this._toggleClass( element, keys, extra, false );
},
_addClass: function( element, keys, extra ) {
return this._toggleClass( element, keys, extra, true );
},
_toggleClass: function( element, keys, extra, add ) {
add = ( typeof add === "boolean" ) ? add : extra;
var shift = ( typeof element === "string" || element === null ),
options = {
extra: shift ? keys : extra,
keys: shift ? element : keys,
element: shift ? this.element : element,
add: add
};
options.element.toggleClass( this._classes( options ), add );
return this;
},
_on: function( suppressDisabledCheck, element, handlers ) {
var delegateElement;
var instance = this;
// No suppressDisabledCheck flag, shuffle arguments
if ( typeof suppressDisabledCheck !== "boolean" ) {
handlers = element;
element = suppressDisabledCheck;
suppressDisabledCheck = false;
}
// No element argument, shuffle and use this.element
if ( !handlers ) {
handlers = element;
element = this.element;
delegateElement = this.widget();
} else {
element = delegateElement = $( element );
this.bindings = this.bindings.add( element );
}
$.each( handlers, function( event, handler ) {
function handlerProxy() {
// Allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if ( !suppressDisabledCheck &&
( instance.options.disabled === true ||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
return;
}
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
}
// Copy the guid so direct unbinding works
if ( typeof handler !== "string" ) {
handlerProxy.guid = handler.guid =
handler.guid || handlerProxy.guid || $.guid++;
}
var match = event.match( /^([\w:-]*)\s*(.*)$/ );
var eventName = match[ 1 ] + instance.eventNamespace;
var selector = match[ 2 ];
if ( selector ) {
delegateElement.on( eventName, selector, handlerProxy );
} else {
element.on( eventName, handlerProxy );
}
} );
},
_off: function( element, eventName ) {
eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
this.eventNamespace;
element.off( eventName ).off( eventName );
// Clear the stack to avoid memory leaks (#10056)
this.bindings = $( this.bindings.not( element ).get() );
this.focusable = $( this.focusable.not( element ).get() );
this.hoverable = $( this.hoverable.not( element ).get() );
},
_delay: function( handler, delay ) {
function handlerProxy() {
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
}
var instance = this;
return setTimeout( handlerProxy, delay || 0 );
},
_hoverable: function( element ) {
this.hoverable = this.hoverable.add( element );
this._on( element, {
mouseenter: function( event ) {
this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
},
mouseleave: function( event ) {
this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
}
} );
},
_focusable: function( element ) {
this.focusable = this.focusable.add( element );
this._on( element, {
focusin: function( event ) {
this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
},
focusout: function( event ) {
this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
}
} );
},
_trigger: function( type, event, data ) {
var prop, orig;
var callback = this.options[ type ];
data = data || {};
event = $.Event( event );
event.type = ( type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type ).toLowerCase();
// The original event may come from any element
// so we need to reset the target on the new event
event.target = this.element[ 0 ];
// Copy original event properties over to the new event
orig = event.originalEvent;
if ( orig ) {
for ( prop in orig ) {
if ( !( prop in event ) ) {
event[ prop ] = orig[ prop ];
}
}
}
this.element.trigger( event, data );
return !( $.isFunction( callback ) &&
callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
event.isDefaultPrevented() );
}
};
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
if ( typeof options === "string" ) {
options = { effect: options };
}
var hasOptions;
var effectName = !options ?
method :
options === true || typeof options === "number" ?
defaultEffect :
options.effect || defaultEffect;
options = options || {};
if ( typeof options === "number" ) {
options = { duration: options };
}
hasOptions = !$.isEmptyObject( options );
options.complete = callback;
if ( options.delay ) {
element.delay( options.delay );
}
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
element[ method ]( options );
} else if ( effectName !== method && element[ effectName ] ) {
element[ effectName ]( options.duration, options.easing, callback );
} else {
element.queue( function( next ) {
$( this )[ method ]();
if ( callback ) {
callback.call( element[ 0 ] );
}
next();
} );
}
};
} );
return $.widget;
} ) );
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
* jQuery UI Keycode 1.12.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Keycode
//>>group: Core
//>>description: Provide keycodes as keynames
//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
( function( factory ) {
if ( true ) {
// AMD. Register as an anonymous module.
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4), __webpack_require__(44) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
// Browser globals
factory( jQuery );
}
} ( function( $ ) {
return $.ui.keyCode = {
BACKSPACE: 8,
COMMA: 188,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
LEFT: 37,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SPACE: 32,
TAB: 9,
UP: 38
};
} ) );
/***/ },
/* 47 */
/***/ function(module, exports) {
// https://d3js.org/d3-format/ Version 1.0.2 Copyright Mike Bostock
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.d3 = global.d3 || {})));
}(this, (function (exports) { 'use strict';
// Computes the decimal coefficient and exponent of the specified number x with
// significant digits p, where x is positive and p is in [1, 21] or undefined.
// For example, formatDecimal(1.23) returns ["123", 0].
function formatDecimal(x, p) {
if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
var i, coefficient = x.slice(0, i);
// The string returned by toExponential either has the form \d\.\d+e[-+]\d+
// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
return [
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
+x.slice(i + 1)
];
}
function exponent(x) {
return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;
}
function formatGroup(grouping, thousands) {
return function(value, width) {
var i = value.length,
t = [],
j = 0,
g = grouping[0],
length = 0;
while (i > 0 && g > 0) {
if (length + g + 1 > width) g = Math.max(1, width - length);
t.push(value.substring(i -= g, i + g));
if ((length += g + 1) > width) break;
g = grouping[j = (j + 1) % grouping.length];
}
return t.reverse().join(thousands);
};
}
function formatDefault(x, p) {
x = x.toPrecision(p);
out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {
switch (x[i]) {
case ".": i0 = i1 = i; break;
case "0": if (i0 === 0) i0 = i; i1 = i; break;
case "e": break out;
default: if (i0 > 0) i0 = 0; break;
}
}
return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;
}
var prefixExponent;
function formatPrefixAuto(x, p) {
var d = formatDecimal(x, p);
if (!d) return x + "";
var coefficient = d[0],
exponent = d[1],
i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
n = coefficient.length;
return i === n ? coefficient
: i > n ? coefficient + new Array(i - n + 1).join("0")
: i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
: "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y!
}
function formatRounded(x, p) {
var d = formatDecimal(x, p);
if (!d) return x + "";
var coefficient = d[0],
exponent = d[1];
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
: coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
: coefficient + new Array(exponent - coefficient.length + 2).join("0");
}
var formatTypes = {
"": formatDefault,
"%": function(x, p) { return (x * 100).toFixed(p); },
"b": function(x) { return Math.round(x).toString(2); },
"c": function(x) { return x + ""; },
"d": function(x) { return Math.round(x).toString(10); },
"e": function(x, p) { return x.toExponential(p); },
"f": function(x, p) { return x.toFixed(p); },
"g": function(x, p) { return x.toPrecision(p); },
"o": function(x) { return Math.round(x).toString(8); },
"p": function(x, p) { return formatRounded(x * 100, p); },
"r": formatRounded,
"s": formatPrefixAuto,
"X": function(x) { return Math.round(x).toString(16).toUpperCase(); },
"x": function(x) { return Math.round(x).toString(16); }
};
// [[fill]align][sign][symbol][0][width][,][.precision][type]
var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;
function formatSpecifier(specifier) {
return new FormatSpecifier(specifier);
}
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
function FormatSpecifier(specifier) {
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
var match,
fill = match[1] || " ",
align = match[2] || ">",
sign = match[3] || "-",
symbol = match[4] || "",
zero = !!match[5],
width = match[6] && +match[6],
comma = !!match[7],
precision = match[8] && +match[8].slice(1),
type = match[9] || "";
// The "n" type is an alias for ",g".
if (type === "n") comma = true, type = "g";
// Map invalid types to the default format.
else if (!formatTypes[type]) type = "";
// If zero fill is specified, padding goes after sign and before digits.
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
this.fill = fill;
this.align = align;
this.sign = sign;
this.symbol = symbol;
this.zero = zero;
this.width = width;
this.comma = comma;
this.precision = precision;
this.type = type;
}
FormatSpecifier.prototype.toString = function() {
return this.fill
+ this.align
+ this.sign
+ this.symbol
+ (this.zero ? "0" : "")
+ (this.width == null ? "" : Math.max(1, this.width | 0))
+ (this.comma ? "," : "")
+ (this.precision == null ? "" : "." + Math.max(0, this.precision | 0))
+ this.type;
};
var prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
function identity(x) {
return x;
}
function formatLocale(locale) {
var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity,
currency = locale.currency,
decimal = locale.decimal;
function newFormat(specifier) {
specifier = formatSpecifier(specifier);
var fill = specifier.fill,
align = specifier.align,
sign = specifier.sign,
symbol = specifier.symbol,
zero = specifier.zero,
width = specifier.width,
comma = specifier.comma,
precision = specifier.precision,
type = specifier.type;
// Compute the prefix and suffix.
// For SI-prefix, the suffix is lazily computed.
var prefix = symbol === "$" ? currency[0] : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
suffix = symbol === "$" ? currency[1] : /[%p]/.test(type) ? "%" : "";
// What format function should we use?
// Is this an integer type?
// Can this type generate exponential notation?
var formatType = formatTypes[type],
maybeSuffix = !type || /[defgprs%]/.test(type);
// Set the default precision if not specified,
// or clamp the specified precision to the supported range.
// For significant precision, it must be in [1, 21].
// For fixed precision, it must be in [0, 20].
precision = precision == null ? (type ? 6 : 12)
: /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
: Math.max(0, Math.min(20, precision));
function format(value) {
var valuePrefix = prefix,
valueSuffix = suffix,
i, n, c;
if (type === "c") {
valueSuffix = formatType(value) + valueSuffix;
value = "";
} else {
value = +value;
// Convert negative to positive, and compute the prefix.
// Note that -0 is not less than 0, but 1 / -0 is!
var valueNegative = (value < 0 || 1 / value < 0) && (value *= -1, true);
// Perform the initial formatting.
value = formatType(value, precision);
// If the original value was negative, it may be rounded to zero during
// formatting; treat this as (positive) zero.
if (valueNegative) {
i = -1, n = value.length;
valueNegative = false;
while (++i < n) {
if (c = value.charCodeAt(i), (48 < c && c < 58)
|| (type === "x" && 96 < c && c < 103)
|| (type === "X" && 64 < c && c < 71)) {
valueNegative = true;
break;
}
}
}
// Compute the prefix and suffix.
valuePrefix = (valueNegative ? (sign === "(" ? sign : "-") : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
valueSuffix = valueSuffix + (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + (valueNegative && sign === "(" ? ")" : "");
// Break the formatted value into the integer “value” part that can be
// grouped, and fractional or exponential “suffix” part that is not.
if (maybeSuffix) {
i = -1, n = value.length;
while (++i < n) {
if (c = value.charCodeAt(i), 48 > c || c > 57) {
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
value = value.slice(0, i);
break;
}
}
}
}
// If the fill character is not "0", grouping is applied before padding.
if (comma && !zero) value = group(value, Infinity);
// Compute the padding.
var length = valuePrefix.length + value.length + valueSuffix.length,
padding = length < width ? new Array(width - length + 1).join(fill) : "";
// If the fill character is "0", grouping is applied after padding.
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
// Reconstruct the final output based on the desired alignment.
switch (align) {
case "<": return valuePrefix + value + valueSuffix + padding;
case "=": return valuePrefix + padding + value + valueSuffix;
case "^": return padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
}
return padding + valuePrefix + value + valueSuffix;
}
format.toString = function() {
return specifier + "";
};
return format;
}
function formatPrefix(specifier, value) {
var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
k = Math.pow(10, -e),
prefix = prefixes[8 + e / 3];
return function(value) {
return f(k * value) + prefix;
};
}
return {
format: newFormat,
formatPrefix: formatPrefix
};
}
var locale;
defaultLocale({
decimal: ".",
thousands: ",",
grouping: [3],
currency: ["$", ""]
});
function defaultLocale(definition) {
locale = formatLocale(definition);
exports.format = locale.format;
exports.formatPrefix = locale.formatPrefix;
return locale;
}
function precisionFixed(step) {
return Math.max(0, -exponent(Math.abs(step)));
}
function precisionPrefix(step, value) {
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
}
function precisionRound(step, max) {
step = Math.abs(step), max = Math.abs(max) - step;
return Math.max(0, exponent(max) - exponent(step)) + 1;
}
exports.formatDefaultLocale = defaultLocale;
exports.formatLocale = formatLocale;
exports.formatSpecifier = formatSpecifier;
exports.precisionFixed = precisionFixed;
exports.precisionPrefix = precisionPrefix;
exports.precisionRound = precisionRound;
Object.defineProperty(exports, '__esModule', { value: true });
})));
/***/ },
/* 48 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_core_1 = __webpack_require__(23);
var _ = __webpack_require__(2);
var widget_int_1 = __webpack_require__(40);
var d3format = __webpack_require__(47).format;
var FloatModel = (function (_super) {
__extends(FloatModel, _super);
function FloatModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
FloatModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: "FloatModel",
value: 0,
disabled: false,
});
};
return FloatModel;
}(widget_core_1.CoreLabeledDOMWidgetModel));
exports.FloatModel = FloatModel;
var BoundedFloatModel = (function (_super) {
__extends(BoundedFloatModel, _super);
function BoundedFloatModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
BoundedFloatModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: "BoundedFloatModel",
step: 1.0,
max: 100.0,
min: 0.0
});
};
return BoundedFloatModel;
}(FloatModel));
exports.BoundedFloatModel = BoundedFloatModel;
var FloatSliderModel = (function (_super) {
__extends(FloatSliderModel, _super);
function FloatSliderModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
FloatSliderModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: "FloatSliderModel",
_view_name: "FloatSliderView",
orientation: "horizontal",
_range: false,
readout: true,
readout_format: '.2f',
slider_color: null,
continuous_update: true
});
};
FloatSliderModel.prototype.initialize = function (attributes, options) {
_super.prototype.initialize.call(this, attributes, options);
this.on('change:readout_format', this.update_readout_format, this);
this.update_readout_format();
};
FloatSliderModel.prototype.update_readout_format = function () {
this.readout_formatter = d3format(this.get('readout_format'));
};
return FloatSliderModel;
}(BoundedFloatModel));
exports.FloatSliderModel = FloatSliderModel;
var FloatSliderView = (function (_super) {
__extends(FloatSliderView, _super);
function FloatSliderView() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._parse_value = parseFloat;
// matches: whitespace?, float, whitespace?, [-:], whitespace?, float
_this._range_regex = /^\s*([+-]?(?:\d*\.?\d+|\d+\.)(?:[eE][+-]?\d+)?)\s*[-:]\s*([+-]?(?:\d*\.?\d+|\d+\.)(?:[eE][+-]?\d+)?)/;
return _this;
}
/**
* Validate the value of the slider before sending it to the back-end
* and applying it to the other views on the page.
*/
FloatSliderView.prototype._validate_slide_value = function (x) {
return x;
};
return FloatSliderView;
}(widget_int_1.IntSliderView));
exports.FloatSliderView = FloatSliderView;
var FloatTextModel = (function (_super) {
__extends(FloatTextModel, _super);
function FloatTextModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
FloatTextModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: "FloatTextModel",
_view_name: "FloatTextView"
});
};
return FloatTextModel;
}(FloatModel));
exports.FloatTextModel = FloatTextModel;
var FloatTextView = (function (_super) {
__extends(FloatTextView, _super);
function FloatTextView() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._parse_value = parseFloat;
return _this;
}
return FloatTextView;
}(widget_int_1.IntTextView));
exports.FloatTextView = FloatTextView;
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_core_1 = __webpack_require__(23);
var widget_1 = __webpack_require__(11);
var _ = __webpack_require__(2);
var utils = __webpack_require__(7);
var ControllerButtonModel = (function (_super) {
__extends(ControllerButtonModel, _super);
function ControllerButtonModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ControllerButtonModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'ControllerButtonModel',
_view_name: 'ControllerButtonView',
value: 0.0,
pressed: false
});
};
return ControllerButtonModel;
}(widget_core_1.CoreDOMWidgetModel));
exports.ControllerButtonModel = ControllerButtonModel;
/**
* Very simple view for a gamepad button.
*/
var ControllerButtonView = (function (_super) {
__extends(ControllerButtonView, _super);
function ControllerButtonView() {
return _super !== null && _super.apply(this, arguments) || this;
}
ControllerButtonView.prototype.render = function () {
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-controller-button');
this.support = document.createElement('div');
this.support.style.position = 'relative';
this.support.style.margin = '1px';
this.support.style.width = '16px';
this.support.style.height = '16px';
this.support.style.border = '1px solid black';
this.support.style.background = 'lightgray';
this.el.appendChild(this.support);
this.bar = document.createElement('div');
this.bar.style.position = 'absolute';
this.bar.style.width = '100%';
this.bar.style.bottom = '0px';
this.bar.style.background = 'gray';
this.support.appendChild(this.bar);
this.update();
this.label = document.createElement('div');
this.label.textContent = this.model.get('description');
this.label.style.textAlign = 'center';
this.el.appendChild(this.label);
};
ControllerButtonView.prototype.update = function () {
this.bar.style.height = (100 * this.model.get('value')) + '%';
};
return ControllerButtonView;
}(widget_1.DOMWidgetView));
exports.ControllerButtonView = ControllerButtonView;
var ControllerAxisModel = (function (_super) {
__extends(ControllerAxisModel, _super);
function ControllerAxisModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ControllerAxisModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'ControllerAxisModel',
_view_name: 'ControllerAxisView',
value: 0.0
});
};
return ControllerAxisModel;
}(widget_core_1.CoreDOMWidgetModel));
exports.ControllerAxisModel = ControllerAxisModel;
/**
* Very simple view for a gamepad axis.
*/
var ControllerAxisView = (function (_super) {
__extends(ControllerAxisView, _super);
function ControllerAxisView() {
return _super !== null && _super.apply(this, arguments) || this;
}
ControllerAxisView.prototype.render = function () {
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-controller-axis');
this.el.style.width = '16px';
this.el.style.padding = '4px';
this.support = document.createElement('div');
this.support.style.position = 'relative';
this.support.style.margin = '1px';
this.support.style.width = '4px';
this.support.style.height = '64px';
this.support.style.border = '1px solid black';
this.support.style.background = 'lightgray';
this.bullet = document.createElement('div');
this.bullet.style.position = 'absolute';
this.bullet.style.margin = '-4px';
this.bullet.style.width = '10px';
this.bullet.style.height = '10px';
this.bullet.style.background = 'gray';
this.label = document.createElement('div');
this.label.textContent = this.model.get('description');
this.label.style.textAlign = 'center';
this.support.appendChild(this.bullet);
this.el.appendChild(this.support);
this.el.appendChild(this.label);
this.update();
};
ControllerAxisView.prototype.update = function () {
this.bullet.style.top = (50 * (this.model.get('value') + 1)) + '%';
};
return ControllerAxisView;
}(widget_1.DOMWidgetView));
exports.ControllerAxisView = ControllerAxisView;
var ControllerModel = (function (_super) {
__extends(ControllerModel, _super);
function ControllerModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ControllerModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'ControllerModel',
_view_name: 'ControllerView',
index: 0,
name: '',
mapping: '',
connected: false,
timestamp: 0,
buttons: [],
axes: []
});
};
ControllerModel.prototype.initialize = function (attributes, options) {
_super.prototype.initialize.call(this, attributes, options);
if (navigator.getGamepads === void 0) {
// Checks if the browser supports the gamepad API
this.readout = 'This browser does not support gamepads.';
console.error(this.readout);
}
else {
// Start the wait loop, and listen to updates of the only
// user-provided attribute, the gamepad index.
this.readout = 'Connect gamepad and press any button.';
if (this.get('connected')) {
// No need to re-create Button and Axis widgets, re-use
// the models provided by the backend which may already
// be wired to other things.
this.update_loop();
}
else {
// Wait for a gamepad to be connected.
this.wait_loop();
}
}
};
/**
* Waits for a gamepad to be connected at the provided index.
* Once one is connected, it will start the update loop, which
* populates the update of axes and button values.
*/
ControllerModel.prototype.wait_loop = function () {
var index = this.get('index');
var pad = navigator.getGamepads()[index];
if (pad) {
var that = this;
this.setup(pad).then(function (controls) {
that.set(controls);
that.save_changes();
window.requestAnimationFrame(that.update_loop.bind(that));
});
}
else {
window.requestAnimationFrame(this.wait_loop.bind(this));
}
};
/**
* Given a native gamepad object, returns a promise for a dictionary of
* controls, of the form
* {
* buttons: list of Button models,
* axes: list of Axis models,
* }
*/
ControllerModel.prototype.setup = function (pad) {
// Set up the main gamepad attributes
this.set({
name: pad.id,
mapping: pad.mapping,
connected: pad.connected,
timestamp: pad.timestamp
});
// Create buttons and axes. When done, start the update loop
var that = this;
return utils.resolvePromisesDict({
buttons: Promise.all(pad.buttons.map(function (btn, index) {
return that._create_button_model(index);
})),
axes: Promise.all(pad.axes.map(function (axis, index) {
return that._create_axis_model(index);
})),
});
};
/**
* Update axes and buttons values, until the gamepad is disconnected.
* When the gamepad is disconnected, this.reset_gamepad is called.
*/
ControllerModel.prototype.update_loop = function () {
var index = this.get('index');
var id = this.get('name');
var pad = navigator.getGamepads()[index];
if (pad && index === pad.index && id === pad.id) {
this.set({
timestamp: pad.timestamp,
connected: pad.connected
});
this.save_changes();
this.get('buttons').forEach(function (model, index) {
model.set({
value: pad.buttons[index].value,
pressed: pad.buttons[index].pressed
});
model.save_changes();
});
this.get('axes').forEach(function (model, index) {
model.set('value', pad.axes[index]);
model.save_changes();
});
window.requestAnimationFrame(this.update_loop.bind(this));
}
else {
this.reset_gamepad();
}
};
/**
* Resets the gamepad attributes, and start the wait_loop.
*/
ControllerModel.prototype.reset_gamepad = function () {
this.get('buttons').forEach(function (button) {
button.close();
});
this.get('axes').forEach(function (axis) {
axis.close();
});
this.set({
name: '',
mapping: '',
connected: false,
timestamp: 0.0,
buttons: [],
axes: []
});
this.save_changes();
window.requestAnimationFrame(this.wait_loop.bind(this));
};
/**
* Creates a gamepad button widget.
*/
ControllerModel.prototype._create_button_model = function (index) {
return this.widget_manager.new_widget({
model_name: 'ControllerButtonModel',
model_module: 'jupyter-js-widgets',
model_module_version: this.get('_model_module_version'),
widget_class: 'Jupyter.ControllerButton',
}).then(function (model) {
model.set('description', index);
return model;
});
};
/**
* Creates a gamepad axis widget.
*/
ControllerModel.prototype._create_axis_model = function (index) {
return this.widget_manager.new_widget({
model_name: 'ControllerAxisModel',
model_module: 'jupyter-js-widgets',
model_module_version: this.get('_model_module_version'),
widget_class: 'Jupyter.ControllerAxis',
}).then(function (model) {
model.set('description', index);
return model;
});
};
ControllerModel.serializers = _.extend({
buttons: { deserialize: widget_1.unpack_models },
axes: { deserialize: widget_1.unpack_models }
}, widget_core_1.CoreDOMWidgetModel.serializers);
return ControllerModel;
}(widget_core_1.CoreDOMWidgetModel));
exports.ControllerModel = ControllerModel;
/**
* A simple view for a gamepad.
*/
var ControllerView = (function (_super) {
__extends(ControllerView, _super);
function ControllerView() {
return _super !== null && _super.apply(this, arguments) || this;
}
ControllerView.prototype.initialize = function (parameters) {
_super.prototype.initialize.call(this, parameters);
this.button_views = new widget_1.ViewList(this.add_button, null, this);
this.listenTo(this.model, 'change:buttons', function (model, value) {
this.button_views.update(value);
});
this.axis_views = new widget_1.ViewList(this.add_axis, null, this);
this.listenTo(this.model, 'change:axes', function (model, value) {
this.axis_views.update(value);
});
this.listenTo(this.model, 'change:name', this.update_label);
};
ControllerView.prototype.render = function () {
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-controller');
this.box = this.el;
this.label = document.createElement('div');
this.box.appendChild(this.label);
this.axis_box = document.createElement('div');
this.axis_box.style.display = 'flex';
this.box.appendChild(this.axis_box);
this.button_box = document.createElement('div');
this.button_box.style.display = 'flex';
this.box.appendChild(this.button_box);
this.button_views.update(this.model.get('buttons'));
this.axis_views.update(this.model.get('axes'));
this.update_label();
};
ControllerView.prototype.update_label = function () {
this.label.textContent = this.model.get('name') || this.model.readout;
};
ControllerView.prototype.add_button = function (model) {
var that = this;
var dummy = document.createElement('div');
that.button_box.appendChild(dummy);
return this.create_child_view(model).then(function (view) {
that.button_box.replaceChild(view.el, dummy);
that.displayed.then(function () {
view.trigger('displayed', that);
});
return view;
}).catch(utils.reject('Could not add button view', true));
};
ControllerView.prototype.add_axis = function (model) {
var that = this;
var dummy = document.createElement('div');
that.axis_box.appendChild(dummy);
return this.create_child_view(model).then(function (view) {
that.axis_box.replaceChild(view.el, dummy);
that.displayed.then(function () {
view.trigger('displayed', that);
});
return view;
}).catch(utils.reject('Could not add axis view', true));
};
ControllerView.prototype.remove = function () {
_super.prototype.remove.call(this);
this.button_views.remove();
this.axis_views.remove();
};
return ControllerView;
}(widget_1.DOMWidgetView));
exports.ControllerView = ControllerView;
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_core_1 = __webpack_require__(23);
var widget_1 = __webpack_require__(11);
var _ = __webpack_require__(2);
var utils = __webpack_require__(7);
var $ = __webpack_require__(4);
function scrollIfNeeded(area, elem) {
var ar = area.getBoundingClientRect();
var er = elem.getBoundingClientRect();
if (er.top < ar.top) {
area.scrollTop -= ar.top - er.top;
}
else if (er.bottom > ar.bottom) {
area.scrollTop += er.bottom - ar.bottom;
}
}
var SelectionModel = (function (_super) {
__extends(SelectionModel, _super);
function SelectionModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
SelectionModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'SelectionModel',
value: '',
_options_labels: [],
disabled: false,
});
};
return SelectionModel;
}(widget_core_1.CoreLabeledDOMWidgetModel));
exports.SelectionModel = SelectionModel;
var SelectModel = (function (_super) {
__extends(SelectModel, _super);
function SelectModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
SelectModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'SelectModel',
_view_name: 'SelectView'
});
};
return SelectModel;
}(SelectionModel));
exports.SelectModel = SelectModel;
var SelectView = (function (_super) {
__extends(SelectView, _super);
function SelectView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Public constructor.
*/
SelectView.prototype.initialize = function (parameters) {
var _this = this;
_super.prototype.initialize.call(this, parameters);
this.listenTo(this.model, 'change:_options_labels', function () { return _this._updateOptions(); });
};
/**
* Called when view is rendered.
*/
SelectView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-select');
this.listbox = document.createElement('select');
this.el.appendChild(this.listbox);
this._updateOptions();
this.update();
};
/**
* Update the contents of this view
*/
SelectView.prototype.update = function () {
// Disable listbox if needed
this.listbox.disabled = this.model.get('disabled');
// Select the correct element
var value = this.model.get('value');
this.listbox.selectedIndex = this.model.get('_options_labels').indexOf(value);
return _super.prototype.update.call(this);
};
SelectView.prototype._updateOptions = function () {
this.listbox.textContent = '';
var items = this.model.get('_options_labels');
for (var i = 0; i < items.length; i++) {
var item = items[i];
var option = document.createElement('option');
option.textContent = item.replace(/ /g, '\xa0'); // space ->
option.setAttribute('data-value', encodeURIComponent(item));
option.value = item;
this.listbox.appendChild(option);
}
};
SelectView.prototype.events = function () {
return {
'change select': '_handle_change'
};
};
/**
* Handle when a new value is selected.
*/
SelectView.prototype._handle_change = function () {
var value = this.listbox.options[this.listbox.selectedIndex].value;
this.model.set('value', value);
this.touch();
};
return SelectView;
}(widget_1.LabeledDOMWidgetView));
exports.SelectView = SelectView;
var DropdownModel = (function (_super) {
__extends(DropdownModel, _super);
function DropdownModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
DropdownModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'DropdownModel',
_view_name: 'DropdownView',
button_style: ''
});
};
return DropdownModel;
}(SelectionModel));
exports.DropdownModel = DropdownModel;
// TODO: Make a phosphor dropdown control, wrapped in DropdownView. Also, fix
// bugs in keyboard handling. See
// https://github.com/ipython/ipywidgets/issues/1055 and
// https://github.com/ipython/ipywidgets/issues/1049
// For now, we subclass SelectView to provide DropdownView
// For the old code, see commit f68bfbc566f3a78a8f3350b438db8ed523ce3642
var DropdownView = (function (_super) {
__extends(DropdownView, _super);
function DropdownView() {
return _super !== null && _super.apply(this, arguments) || this;
}
return DropdownView;
}(SelectView));
exports.DropdownView = DropdownView;
var RadioButtonsModel = (function (_super) {
__extends(RadioButtonsModel, _super);
function RadioButtonsModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
RadioButtonsModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'RadioButtonsModel',
_view_name: 'RadioButtonsView',
tooltips: [],
icons: [],
button_style: ''
});
};
return RadioButtonsModel;
}(SelectionModel));
exports.RadioButtonsModel = RadioButtonsModel;
var RadioButtonsView = (function (_super) {
__extends(RadioButtonsView, _super);
function RadioButtonsView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Called when view is rendered.
*/
RadioButtonsView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-radio');
this.container = document.createElement('div');
this.el.appendChild(this.container);
this.container.classList.add('widget-radio-box');
this.update();
};
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
RadioButtonsView.prototype.update = function (options) {
var view = this;
var items = this.model.get('_options_labels');
var radios = _.pluck(this.container.querySelectorAll('input[type="radio"]'), 'value');
var stale = false;
for (var i = 0, len = items.length; i < len; ++i) {
if (radios[i] !== items[i]) {
stale = true;
break;
}
}
if (stale && (options === undefined || options.updated_view !== this)) {
// Add items to the DOM.
this.container.textContent = '';
_.each(items, function (item) {
var label = document.createElement('label');
label.textContent = item;
view.container.appendChild(label);
var radio = document.createElement('input');
radio.setAttribute('type', 'radio');
radio.value = item;
radio.setAttribute('data-value', encodeURIComponent(item));
label.appendChild(radio);
});
}
_.each(items, function (item) {
var item_query = 'input[data-value="' +
encodeURIComponent(item) + '"]';
var radio = view.container.querySelectorAll(item_query);
if (radio.length > 0) {
var radio_el = radio[0];
radio_el.checked = view.model.get('value') === item;
radio_el.disabled = view.model.get('disabled');
}
});
return _super.prototype.update.call(this, options);
};
RadioButtonsView.prototype.events = function () {
return {
'click input[type="radio"]': '_handle_click'
};
};
/**
* Handle when a value is clicked.
*
* Calling model.set will trigger all of the other views of the
* model to update.
*/
RadioButtonsView.prototype._handle_click = function (event) {
var value = event.target.value;
this.model.set('value', value, { updated_view: this });
this.touch();
};
return RadioButtonsView;
}(widget_1.LabeledDOMWidgetView));
exports.RadioButtonsView = RadioButtonsView;
var ToggleButtonsModel = (function (_super) {
__extends(ToggleButtonsModel, _super);
function ToggleButtonsModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ToggleButtonsModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'ToggleButtonsModel',
_view_name: 'ToggleButtonsView'
});
};
return ToggleButtonsModel;
}(SelectionModel));
exports.ToggleButtonsModel = ToggleButtonsModel;
var ToggleButtonsView = (function (_super) {
__extends(ToggleButtonsView, _super);
function ToggleButtonsView() {
return _super !== null && _super.apply(this, arguments) || this;
}
ToggleButtonsView.prototype.initialize = function (options) {
this._css_state = {};
_super.prototype.initialize.call(this, options);
this.listenTo(this.model, 'change:button_style', this.update_button_style);
};
/**
* Called when view is rendered.
*/
ToggleButtonsView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-toggle-buttons');
this.buttongroup = document.createElement('div');
this.el.appendChild(this.buttongroup);
this.update();
this.set_button_style();
};
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
ToggleButtonsView.prototype.update = function (options) {
var view = this;
var items = this.model.get('_options_labels');
var icons = this.model.get('icons') || [];
var previous_icons = this.model.previous('icons') || [];
var previous_bstyle = ToggleButtonsView.classMap[this.model.previous('button_style')] || '';
var tooltips = view.model.get('tooltips') || [];
var disabled = this.model.get('disabled');
var buttons = this.buttongroup.querySelectorAll('button');
var values = _.pluck(buttons, 'value');
var stale = false;
for (var i = 0, len = items.length; i < len; ++i) {
if (values[i] !== items[i] || icons[i] !== previous_icons[i]) {
stale = true;
break;
}
}
if (stale && options === undefined || options.updated_view !== this) {
// Add items to the DOM.
this.buttongroup.textContent = '';
_.each(items, function (item, index) {
var item_html;
var empty = item.trim().length === 0 &&
(!icons[index] || icons[index].trim().length === 0);
if (empty) {
item_html = ' ';
}
else {
item_html = utils.escape_html(item);
}
var icon = document.createElement('i');
var button = document.createElement('button');
if (icons[index]) {
icon.className = 'fa fa-' + icons[index];
}
button.setAttribute('type', 'button');
button.className = 'widget-toggle-button jupyter-button';
if (previous_bstyle) {
button.classList.add(previous_bstyle);
}
button.innerHTML = item_html;
button.setAttribute('data-value', encodeURIComponent(item));
button.setAttribute('value', item);
button.appendChild(icon);
button.disabled = disabled;
if (tooltips[index]) {
button.setAttribute('title', tooltips[index]);
}
view.update_style_traits(button);
view.buttongroup.appendChild(button);
});
}
// Select active button.
_.each(items, function (item) {
var item_query = '[data-value="' + encodeURIComponent(item) + '"]';
var button = view.buttongroup.querySelector(item_query);
if (view.model.get('value') === item) {
button.classList.add('mod-active');
}
else {
button.classList.remove('mod-active');
}
});
return _super.prototype.update.call(this, options);
};
ToggleButtonsView.prototype.update_style_traits = function (button) {
for (var name in this._css_state) {
if (this._css_state.hasOwnProperty(name)) {
if (name === 'margin') {
this.buttongroup.style[name] = this._css_state[name];
}
else if (name !== 'width') {
if (button) {
button.style[name] = this._css_state[name];
}
else {
var buttons = this.buttongroup
.querySelectorAll('button');
if (buttons.length) {
buttons[0].style[name] = this._css_state[name];
}
}
}
}
}
};
ToggleButtonsView.prototype.update_button_style = function () {
var _this = this;
var buttons = this.buttongroup.querySelectorAll('button');
_.each(buttons, function (button) {
_this.update_mapped_classes(ToggleButtonsView.classMap, 'button_style', button);
});
};
ToggleButtonsView.prototype.set_button_style = function () {
var _this = this;
var buttons = this.buttongroup.querySelectorAll('button');
_.each(buttons, function (button) {
_this.set_mapped_classes(ToggleButtonsView.classMap, 'button_style', button);
});
};
ToggleButtonsView.prototype.events = function () {
return {
'click button': '_handle_click'
};
};
/**
* Handle when a value is clicked.
*
* Calling model.set will trigger all of the other views of the
* model to update.
*/
ToggleButtonsView.prototype._handle_click = function (event) {
var value = event.target.value;
this.model.set('value', value, { updated_view: this });
this.touch();
};
return ToggleButtonsView;
}(widget_1.LabeledDOMWidgetView));
exports.ToggleButtonsView = ToggleButtonsView;
(function (ToggleButtonsView) {
ToggleButtonsView.classMap = {
primary: ['mod-primary'],
success: ['mod-success'],
info: ['mod-info'],
warning: ['mod-warning'],
danger: ['mod-danger']
};
})(ToggleButtonsView = exports.ToggleButtonsView || (exports.ToggleButtonsView = {}));
exports.ToggleButtonsView = ToggleButtonsView;
var SelectionSliderModel = (function (_super) {
__extends(SelectionSliderModel, _super);
function SelectionSliderModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
SelectionSliderModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'SelectionSliderModel',
_view_name: 'SelectionSliderView',
orientation: 'horizontal',
readout: true,
continuous_update: true
});
};
return SelectionSliderModel;
}(SelectionModel));
exports.SelectionSliderModel = SelectionSliderModel;
var SelectionSliderView = (function (_super) {
__extends(SelectionSliderView, _super);
function SelectionSliderView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Called when view is rendered.
*/
SelectionSliderView.prototype.render = function () {
var _this = this;
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-hslider');
this.el.classList.add('widget-slider');
(this.$slider = $('<div />'))
.slider({
slide: this.handleSliderChange.bind(this),
stop: this.handleSliderChanged.bind(this)
})
.addClass('slider');
// Put the slider in a container
this.slider_container = document.createElement('div');
this.slider_container.classList.add('slider-container');
this.slider_container.appendChild(this.$slider[0]);
this.el.appendChild(this.slider_container);
this.readout = document.createElement('div');
this.el.appendChild(this.readout);
this.readout.classList.add('widget-readout');
this.readout.style.display = 'none';
this.listenTo(this.model, 'change:slider_color', function (sender, value) {
_this.$slider.find('a').css('background', value);
});
this.$slider.find('a').css('background', this.model.get('slider_color'));
// Set defaults.
this.update();
};
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
SelectionSliderView.prototype.update = function (options) {
if (options === undefined || options.updated_view != this) {
var labels = this.model.get('_options_labels');
var max = labels.length - 1;
var min = 0;
this.$slider.slider('option', 'step', 1);
this.$slider.slider('option', 'max', max);
this.$slider.slider('option', 'min', min);
// WORKAROUND FOR JQUERY SLIDER BUG.
// The horizontal position of the slider handle
// depends on the value of the slider at the time
// of orientation change. Before applying the new
// workaround, we set the value to the minimum to
// make sure that the horizontal placement of the
// handle in the vertical slider is always
// consistent.
var orientation = this.model.get('orientation');
this.$slider.slider('option', 'value', min);
this.$slider.slider('option', 'orientation', orientation);
var value = this.model.get('value');
var index = labels.indexOf(value);
this.$slider.slider('option', 'value', index);
this.readout.textContent = value;
// Use the right CSS classes for vertical & horizontal sliders
if (orientation === 'vertical') {
this.el.classList.remove('widget-hslider');
this.el.classList.remove('widget-inline-hbox');
this.el.classList.add('widget-vslider');
this.el.classList.add('widget-inline-vbox');
}
else {
this.el.classList.remove('widget-vslider');
this.el.classList.remove('widget-inline-vbox');
this.el.classList.add('widget-hslider');
this.el.classList.add('widget-inline-hbox');
}
var readout = this.model.get('readout');
if (readout) {
// this.$readout.show();
this.readout.style.display = '';
}
else {
// this.$readout.hide();
this.readout.style.display = 'none';
}
}
return _super.prototype.update.call(this, options);
};
SelectionSliderView.prototype.events = function () {
return {
'slide': 'handleSliderChange',
'slidestop': 'handleSliderChanged'
};
};
/**
* Called when the slider value is changing.
*/
SelectionSliderView.prototype.handleSliderChange = function (e, ui) {
var actual_value = this._validate_slide_value(ui.value);
var selected_label = this.model.get('_options_labels')[actual_value];
this.readout.textContent = selected_label;
// Only persist the value while sliding if the continuous_update
// trait is set to true.
if (this.model.get('continuous_update')) {
this.handleSliderChanged(e, ui);
}
};
/**
* Called when the slider value has changed.
*
* Calling model.set will trigger all of the other views of the
* model to update.
*/
SelectionSliderView.prototype.handleSliderChanged = function (e, ui) {
var actual_value = this._validate_slide_value(ui.value);
var selected_label = this.model.get('_options_labels')[actual_value];
this.readout.textContent = selected_label;
this.model.set('value', selected_label, { updated_view: this });
this.touch();
};
SelectionSliderView.prototype._validate_slide_value = function (x) {
/**
* Validate the value of the slider before sending it to the back-end
* and applying it to the other views on the page.
*/
return Math.floor(x);
};
return SelectionSliderView;
}(widget_1.LabeledDOMWidgetView));
exports.SelectionSliderView = SelectionSliderView;
var MultipleSelectionModel = (function (_super) {
__extends(MultipleSelectionModel, _super);
function MultipleSelectionModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
MultipleSelectionModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'MultipleSelectionModel',
});
};
return MultipleSelectionModel;
}(SelectionModel));
exports.MultipleSelectionModel = MultipleSelectionModel;
var SelectMultipleModel = (function (_super) {
__extends(SelectMultipleModel, _super);
function SelectMultipleModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
SelectMultipleModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'SelectMultipleModel',
_view_name: 'SelectMultipleView'
});
};
return SelectMultipleModel;
}(MultipleSelectionModel));
exports.SelectMultipleModel = SelectMultipleModel;
var SelectMultipleView = (function (_super) {
__extends(SelectMultipleView, _super);
function SelectMultipleView() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Public constructor.
*/
SelectMultipleView.prototype.initialize = function (parameters) {
var _this = this;
_super.prototype.initialize.call(this, parameters);
this.listenTo(this.model, 'change:_options_labels', function () { return _this._updateOptions(); });
};
/**
* Called when view is rendered.
*/
SelectMultipleView.prototype.render = function () {
_super.prototype.render.call(this);
this.el.classList.add('jupyter-widgets');
this.el.classList.add('widget-inline-hbox');
this.el.classList.add('widget-select-multiple');
this.listbox = document.createElement('select');
this.listbox.multiple = true;
this.el.appendChild(this.listbox);
this._updateOptions();
this.update();
};
/**
* Update the contents of this view
*/
SelectMultipleView.prototype.update = function () {
_super.prototype.update.call(this);
this.listbox.disabled = this.model.get('disabled');
// Set selected values
var selected = this.model.get('value') || [];
var values = _.map(selected, encodeURIComponent);
var options = this.listbox.options;
for (var i = 0, len = options.length; i < len; ++i) {
var value = options[i].getAttribute('data-value');
options[i].selected = _.contains(values, value);
}
};
SelectMultipleView.prototype._updateOptions = function () {
this.listbox.textContent = '';
var items = this.model.get('_options_labels');
for (var i = 0; i < items.length; i++) {
var item = items[i];
var option = document.createElement('option');
option.textContent = item.replace(/ /g, '\xa0'); // space ->
option.setAttribute('data-value', encodeURIComponent(item));
option.value = item;
this.listbox.appendChild(option);
}
};
SelectMultipleView.prototype.events = function () {
return {
'change select': '_handle_change'
};
};
/**
* Handle when a new value is selected.
*/
SelectMultipleView.prototype._handle_change = function () {
// In order to preserve type information correctly, we need to map
// the selected indices to the options list.
var items = this.model.get('_options_labels');
var values = Array.prototype.map
.call(this.listbox.selectedOptions || [], function (option) {
return items[option.index];
});
this.model.set('value', values);
this.touch();
};
return SelectMultipleView;
}(widget_1.LabeledDOMWidgetView));
exports.SelectMultipleView = SelectMultipleView;
/***/ },
/* 51 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var widget_1 = __webpack_require__(11);
var widget_box_1 = __webpack_require__(30);
var tabpanel_1 = __webpack_require__(52);
var accordion_1 = __webpack_require__(58);
var widget_2 = __webpack_require__(14);
var iteration_1 = __webpack_require__(15);
var mutation_1 = __webpack_require__(34);
var searching_1 = __webpack_require__(31);
var messaging_1 = __webpack_require__(16);
var _ = __webpack_require__(2);
var utils = __webpack_require__(7);
var $ = __webpack_require__(4);
var SelectionContainerModel = (function (_super) {
__extends(SelectionContainerModel, _super);
function SelectionContainerModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
SelectionContainerModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'SelectionContainerModel',
selected_index: 0,
_titles: {}
});
};
return SelectionContainerModel;
}(widget_box_1.BoxModel));
exports.SelectionContainerModel = SelectionContainerModel;
var AccordionModel = (function (_super) {
__extends(AccordionModel, _super);
function AccordionModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
AccordionModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'AccordionModel',
_view_name: 'AccordionView'
});
};
return AccordionModel;
}(SelectionContainerModel));
exports.AccordionModel = AccordionModel;
// We implement our own tab widget since Phoshpor's TabPanel uses an absolute
// positioning BoxLayout, but we want a more an html/css-based Panel layout.
var JupyterPhosphorAccordionWidget = (function (_super) {
__extends(JupyterPhosphorAccordionWidget, _super);
function JupyterPhosphorAccordionWidget(options) {
var _this = this;
var view = options.view;
delete options.view;
_this = _super.call(this, options) || this;
_this._view = view;
return _this;
}
/**
* Process the phosphor message.
*
* Any custom phosphor widget used inside a Jupyter widget should override
* the processMessage function like this.
*/
JupyterPhosphorAccordionWidget.prototype.processMessage = function (msg) {
_super.prototype.processMessage.call(this, msg);
this._view.processPhosphorMessage(msg);
};
/**
* Dispose the widget.
*
* This causes the view to be destroyed as well with 'remove'
*/
JupyterPhosphorAccordionWidget.prototype.dispose = function () {
if (this.isDisposed) {
return;
}
_super.prototype.dispose.call(this);
if (this._view) {
this._view.remove();
}
this._view = null;
};
return JupyterPhosphorAccordionWidget;
}(accordion_1.Accordion));
exports.JupyterPhosphorAccordionWidget = JupyterPhosphorAccordionWidget;
var AccordionView = (function (_super) {
__extends(AccordionView, _super);
function AccordionView() {
return _super !== null && _super.apply(this, arguments) || this;
}
AccordionView.prototype._createElement = function (tagName) {
this.pWidget = new JupyterPhosphorAccordionWidget({ view: this });
return this.pWidget.node;
};
AccordionView.prototype._setElement = function (el) {
if (this.el || el !== this.pWidget.node) {
// Accordions don't allow setting the element beyond the initial creation.
throw new Error('Cannot reset the DOM element.');
}
this.el = this.pWidget.node;
this.$el = $(this.pWidget.node);
};
AccordionView.prototype.initialize = function (parameters) {
var _this = this;
_super.prototype.initialize.call(this, parameters);
this.children_views = new widget_1.ViewList(this.add_child_view, this.remove_child_view, this);
this.listenTo(this.model, 'change:children', function () { return _this.updateChildren(); });
this.listenTo(this.model, 'change:selected_index', function () { return _this.update_selected_index(); });
this.listenTo(this.model, 'change:_titles', function () { return _this.update_titles(); });
};
/**
* Called when view is rendered.
*/
AccordionView.prototype.render = function () {
var _this = this;
_super.prototype.render.call(this);
var accordion = this.pWidget;
accordion.addClass('jupyter-widgets');
accordion.addClass('widget-accordion');
accordion.addClass('widget-container');
accordion.selection.selectionChanged.connect(function (sender) {
if (!_this.updatingChildren) {
_this.model.set('selected_index', accordion.selection.index);
_this.touch();
}
});
this.children_views.update(this.model.get('children'));
this.update_titles();
this.update_selected_index();
};
/**
* Update children
*/
AccordionView.prototype.updateChildren = function () {
// While we are updating, the index may not be valid, so deselect the
// tabs before updating so we don't get spurious changes in the index,
// which would then set off another sync cycle.
this.updatingChildren = true;
this.pWidget.selection.index = -1;
this.children_views.update(this.model.get('children'));
this.update_selected_index();
this.updatingChildren = false;
};
/**
* Set header titles
*/
AccordionView.prototype.update_titles = function () {
var widgets = this.pWidget.widgets;
var titles = this.model.get('_titles');
for (var i = 0; i < widgets.length; i++) {
if (titles[i] !== void 0) {
widgets.at(i).title.label = titles[i];
}
}
};
/**
* Make the rendering and selected index consistent.
*/
AccordionView.prototype.update_selected_index = function () {
this.pWidget.selection.index = this.model.get('selected_index');
};
/**
* Called when a child is removed from children list.
*/
AccordionView.prototype.remove_child_view = function (view) {
this.pWidget.removeWidget(view.pWidget);
view.remove();
};
/**
* Called when a child is added to children list.
*/
AccordionView.prototype.add_child_view = function (model, index) {
// Placeholder widget to keep our position in the tab panel while we create the view.
var accordion = this.pWidget;
var placeholder = new widget_2.Widget();
placeholder.title.label = this.model.get('_titles')[index] || '';
;
accordion.addWidget(placeholder);
return this.create_child_view(model).then(function (view) {
var widget = view.pWidget;
widget.title.label = placeholder.title.label;
var collapse = accordion.collapseWidgets.at(accordion.indexOf(placeholder));
collapse.widget = widget;
placeholder.dispose();
return view;
}).catch(utils.reject('Could not add child view to box', true));
};
AccordionView.prototype.remove = function () {
this.children_views = null;
_super.prototype.remove.call(this);
};
return AccordionView;
}(widget_1.DOMWidgetView));
exports.AccordionView = AccordionView;
var TabModel = (function (_super) {
__extends(TabModel, _super);
function TabModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
TabModel.prototype.defaults = function () {
return _.extend(_super.prototype.defaults.call(this), {
_model_name: 'TabModel',
_view_name: 'TabView'
});
};
return TabModel;
}(SelectionContainerModel));
exports.TabModel = TabModel;
// We implement our own tab widget since Phoshpor's TabPanel uses an absolute
// positioning BoxLayout, but we want a more an html/css-based Panel layout.
var JupyterPhosphorTabPanelWidget = (function (_super) {
__extends(JupyterPhosphorTabPanelWidget, _super);
function JupyterPhosphorTabPanelWidget(options) {
var _this = this;
var view = options.view;
delete options.view;
_this = _super.call(this, options) || this;
_this._view = view;
// We want the view's messages to be the messages the tabContents panel
// gets.
messaging_1.installMessageHook(_this.tabContents, function (handler, msg) {
// There may be times when we want the view's handler to be called
// *after* the message has been processed by the widget, in which
// case we'll need to revisit using a message hook.
_this._view.processPhosphorMessage(msg);
return true;
});
return _this;
}
/**
* Dispose the widget.
*
* This causes the view to be destroyed as well with 'remove'
*/
JupyterPhosphorTabPanelWidget.prototype.dispose = function () {
if (this.isDisposed) {
return;
}
_super.prototype.dispose.call(this);
if (this._view) {
this._view.remove();
}
this._view = null;
};
return JupyterPhosphorTabPanelWidget;
}(tabpanel_1.TabPanel));
exports.JupyterPhosphorTabPanelWidget = JupyterPhosphorTabPanelWidget;
var TabView = (function (_super) {
__extends(TabView, _super);
function TabView() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.updatingTabs = false;
return _this;
}
TabView.prototype._createElement = function (tagName) {
this.pWidget = new JupyterPhosphorTabPanelWidget({
view: this,
});
return this.pWidget.node;
};
TabView.prototype._setElement = function (el) {
if (this.el || el !== this.pWidget.node) {
// TabViews don't allow setting the element beyond the initial creation.
throw new Error('Cannot reset the DOM element.');
}
this.el = this.pWidget.node;
this.$el = $(this.pWidget.node);
};
/**
* Public constructor.
*/
TabView.prototype.initialize = function (parameters) {
var _this = this;
_super.prototype.initialize.call(this, parameters);
this.childrenViews = new widget_1.ViewList(this.addChildView, function (view) { view.remove(); }, this);
this.listenTo(this.model, 'change:children', function () { return _this.updateTabs(); });
this.listenTo(this.model, 'change:_titles', function () { return _this.updateTitles(); });
};
/**
* Called when view is rendered.
*/
TabView.prototype.render = function () {
_super.prototype.render.call(this);
var tabs = this.pWidget;
tabs.addClass('jupyter-widgets');
tabs.addClass('widget-container');
tabs.addClass('widget-tab');
tabs.tabBar.insertBehavior = 'none'; // needed for insert behavior, see below.
tabs.tabBar.currentChanged.connect(this._onTabChanged, this);
tabs.tabBar.tabMoved.connect(this._onTabMoved, this);
tabs.tabBar.addClass('widget-tab-bar');
tabs.tabContents.addClass('widget-tab-contents');
// TODO: expose this option in python
tabs.tabBar.tabsMovable = false;
this.updateTabs();
this.update();
};
/**
* Render tab views based on the current model's children.
*/
TabView.prototype.updateTabs = function () {
// While we are updating, the index may not be valid, so deselect the
// tabs before updating so we don't get spurious changes in the index,
// which would then set off another sync cycle.
this.updatingTabs = true;
this.pWidget.currentIndex = -1;
this.childrenViews.update(this.model.get('children'));
this.pWidget.currentIndex = this.model.get('selected_index');
this.updatingTabs = false;
};
/**
* Called when a child is added to children list.
*/
TabView.prototype.addChildView = function (model, index) {
// Placeholder widget to keep our position in the tab panel while we create the view.
var label = this.model.get('_titles')[index] || '';
var tabs = this.pWidget;
var placeholder = new widget_2.Widget();
placeholder.title.label = label;
tabs.addWidget(placeholder);
return this.create_child_view(model).then(function (view) {
var widget = view.pWidget;
widget.title.label = placeholder.title.label;
widget.title.closable = true;
var i = searching_1.indexOf(tabs.widgets, placeholder);
// insert after placeholder so that if placholder is selected, the
// real widget will be selected now (this depends on the tab bar
// insert behavior)
tabs.insertWidget(i + 1, widget);
placeholder.dispose();
return view;
}).catch(utils.reject('Could not add child view to box', true));
};
/**
* Update the contents of this view
*
* Called when the model is changed. The model may have been
* changed by another view or by a state update from the back-end.
*/
TabView.prototype.update = function () {
// Update the selected index in the overall update method because it
// should be run after the tabs have been updated. Otherwise the
// selected index may not be a valid tab in the tab bar.
this.updateSelectedIndex();
return _super.prototype.update.call(this);
};
/**
* Updates the tab page titles.
*/
TabView.prototype.updateTitles = function () {
var titles = this.model.get('_titles') || {};
iteration_1.each(iteration_1.enumerate(this.pWidget.widgets), function (_a) {
var i = _a[0], widget = _a[1];
widget.title.label = titles[i] || '';
});
};
/**
* Updates the selected index.
*/
TabView.prototype.updateSelectedIndex = function () {
this.pWidget.currentIndex = this.model.get('selected_index');
};
TabView.prototype.remove = function () {
this.childrenViews = null;
_super.prototype.remove.call(this);
};
TabView.prototype._onTabChanged = function (sender, args) {
if (!this.updatingTabs) {
this.model.set('selected_index', args.currentIndex);
this.touch();
}
};
/**
* Handle the `tabMoved` signal from the tab bar.
*/
TabView.prototype._onTabMoved = function (sender, args) {
var children = this.model.get('children').slice();
mutation_1.move(children, args.fromIndex, args.toIndex);
this.model.set('children', children);
this.touch();
};
return TabView;
}(widget_1.DOMWidgetView));
exports.TabView = TabView;
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var signaling_1 = __webpack_require__(21);
var panel_1 = __webpack_require__(33);
var tabbar_1 = __webpack_require__(53);
var widget_1 = __webpack_require__(14);
/**
* The class name added to TabPanel instances.
*/
var TAB_PANEL_CLASS = 'p-TabPanel';
/**
* The class name added to a TabPanel's tab bar.
*/
var TAB_BAR_CLASS = 'p-TabPanel-tabBar';
/**
* The class name added to a TabPanel's stacked panel.
*/
var TAB_CONTENTS_CLASS = 'p-TabPanel-tabContents';
/**
* The class name added to a StackedPanel child.
*/
var CHILD_CLASS = 'p-TabPanel-child';
/**
* A panel where visible widgets are stacked atop one another.
*
* #### Notes
* This class provides a convenience wrapper around a [[StackedLayout]].
*/
var EventedPanel = (function (_super) {
__extends(EventedPanel, _super);
/**
* Construct a new stacked panel.
*
* @param options - The options for initializing the panel.
*/
function EventedPanel(options) {
if (options === void 0) { options = {}; }
var _this = _super.call(this) || this;
_this.addClass(TAB_CONTENTS_CLASS);
return _this;
}
/**
* A message handler invoked on a `'child-added'` message.
*/
EventedPanel.prototype.onChildAdded = function (msg) {
msg.child.addClass(CHILD_CLASS);
};
/**
* A message handler invoked on a `'child-removed'` message.
*/
EventedPanel.prototype.onChildRemoved = function (msg) {
msg.child.removeClass(CHILD_CLASS);
this.widgetRemoved.emit(msg.child);
};
return EventedPanel;
}(panel_1.Panel));
exports.EventedPanel = EventedPanel;
// Define the signals for the `EventedPanel` class.
signaling_1.defineSignal(EventedPanel.prototype, 'widgetRemoved');
/**
* A widget which combines a `TabBar` and a `EventedPanel`.
*
* #### Notes
* This is a simple panel which handles the common case of a tab bar
* placed next to a content area. The selected tab controls the widget
* which is shown in the content area.
*
* For use cases which require more control than is provided by this
* panel, the `TabBar` widget may be used independently.
*
* TODO: Support setting the direction??
*/
var TabPanel = (function (_super) {
__extends(TabPanel, _super);
/**
* Construct a new tab panel.
*
* @param options - The options for initializing the tab panel.
*/
function TabPanel(options) {
if (options === void 0) { options = {}; }
var _this = _super.call(this) || this;
_this.addClass(TAB_PANEL_CLASS);
// Create the tab bar and stacked panel.
_this._tabBar = new tabbar_1.TabBar(options);
_this._tabBar.tabsMovable = true;
_this._tabBar.addClass(TAB_BAR_CLASS);
_this._tabContents = new EventedPanel();
_this._tabContents.addClass(TAB_CONTENTS_CLASS);
// Connect the tab bar signal handlers.
_this._tabBar.tabMoved.connect(_this._onTabMoved, _this);
_this._tabBar.currentChanged.connect(_this._onCurrentChanged, _this);
_this._tabBar.tabCloseRequested.connect(_this._onTabCloseRequested, _this);
// Connect the stacked panel signal handlers.
_this._tabContents.widgetRemoved.connect(_this._onWidgetRemoved, _this);
// Get the data related to the placement.
_this._tabPlacement = options.tabPlacement || 'top';
var direction = Private.directionFromPlacement(_this._tabPlacement);
var orientation = Private.orientationFromPlacement(_this._tabPlacement);
// Configure the tab bar for the placement.
_this._tabBar.orientation = orientation;
_this._tabBar.addClass("p-mod-" + _this._tabPlacement);
// Create the box layout.
var layout = new panel_1.PanelLayout();
// Add the child widgets to the layout.
layout.addWidget(_this._tabBar);
layout.addWidget(_this._tabContents);
// Install the layout on the tab panel.
_this.layout = layout;
return _this;
}
/**
* Dispose of the resources held by the widget.
*/
TabPanel.prototype.dispose = function () {
this._tabBar = null;
this._tabContents = null;
_super.prototype.dispose.call(this);
};
Object.defineProperty(TabPanel.prototype, "currentIndex", {
/**
* Get the index of the currently selected tab.
*
* #### Notes
* This will be `-1` if no tab is selected.
*/
get: function () {
return this._tabBar.currentIndex;
},
/**
* Set the index of the currently selected tab.
*
* #### Notes
* If the index is out of range, it will be set to `-1`.
*/
set: function (value) {
this._tabBar.currentIndex = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabPanel.prototype, "currentWidget", {
/**
* Get the currently selected widget.
*
* #### Notes
* This will be `null` if there is no selected tab.
*/
get: function () {
var title = this._tabBar.currentTitle;
return title ? title.owner : null;
},
/**
* Set the currently selected widget.
*
* #### Notes
* If the widget is not in the panel, it will be set to `null`.
*/
set: function (value) {
this._tabBar.currentTitle = value ? value.title : null;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabPanel.prototype, "tabsMovable", {
/**
* Get the whether the tabs are movable by the user.
*
* #### Notes
* Tabs can always be moved programmatically.
*/
get: function () {
return this._tabBar.tabsMovable;
},
/**
* Set the whether the tabs are movable by the user.
*
* #### Notes
* Tabs can always be moved programmatically.
*/
set: function (value) {
this._tabBar.tabsMovable = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabPanel.prototype, "tabPlacement", {
/**
* Get the tab placement for the tab panel.
*
* #### Notes
* This controls the position of the tab bar relative to the content.
*/
get: function () {
return this._tabPlacement;
},
/**
* Set the tab placement for the tab panel.
*
* #### Notes
* This controls the position of the tab bar relative to the content.
*/
set: function (value) {
// Bail if the placement does not change.
if (this._tabPlacement === value) {
return;
}
// Swap the internal values.
var old = this._tabPlacement;
this._tabPlacement = value;
// Get the values related to the placement.
var direction = Private.directionFromPlacement(value);
var orientation = Private.orientationFromPlacement(value);
// Configure the tab bar for the placement.
this._tabBar.orientation = orientation;
this._tabBar.removeClass("p-mod-" + old);
this._tabBar.addClass("p-mod-" + value);
// Update the layout direction.
this.layout.direction = direction;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabPanel.prototype, "tabBar", {
/**
* The tab bar associated with the tab panel.
*
* #### Notes
* Modifying the tab bar directly can lead to undefined behavior.
*
* This is a read-only property.
*/
get: function () {
return this._tabBar;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabPanel.prototype, "tabContents", {
/**
* The stacked panel associated with the tab panel.
*
* #### Notes
* Modifying the stack directly can lead to undefined behavior.
*
* This is a read-only property.
*/
get: function () {
return this._tabContents;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabPanel.prototype, "widgets", {
/**
* A read-only sequence of the widgets in the panel.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return this._tabContents.widgets;
},
enumerable: true,
configurable: true
});
/**
* Add a widget to the end of the tab panel.
*
* @param widget - The widget to add to the tab panel.
*
* #### Notes
* If the widget is already contained in the panel, it will be moved.
*
* The widget's `title` is used to populate the tab.
*/
TabPanel.prototype.addWidget = function (widget) {
this.insertWidget(this.widgets.length, widget);
};
/**
* Insert a widget into the tab panel at a specified index.
*
* @param index - The index at which to insert the widget.
*
* @param widget - The widget to insert into to the tab panel.
*
* #### Notes
* If the widget is already contained in the panel, it will be moved.
*
* The widget's `title` is used to populate the tab.
*/
TabPanel.prototype.insertWidget = function (index, widget) {
if (widget !== this.currentWidget) {
widget.hide();
}
this._tabContents.insertWidget(index, widget);
this._tabBar.insertTab(index, widget.title);
};
/**
* Handle the `currentChanged` signal from the tab bar.
*/
TabPanel.prototype._onCurrentChanged = function (sender, args) {
// Extract the previous and current title from the args.
var previousIndex = args.previousIndex, previousTitle = args.previousTitle, currentIndex = args.currentIndex, currentTitle = args.currentTitle;
// Extract the widgets from the titles.
var previousWidget = previousTitle ? previousTitle.owner : null;
var currentWidget = currentTitle ? currentTitle.owner : null;
// Hide the previous widget.
if (previousWidget) {
previousWidget.hide();
}
// Show the current widget.
if (currentWidget) {
currentWidget.show();
}
// Emit the `currentChanged` signal for the tab panel.
this.currentChanged.emit({
previousIndex: previousIndex, previousWidget: previousWidget, currentIndex: currentIndex, currentWidget: currentWidget
});
};
/**
* Handle the `tabActivateRequested` signal from the tab bar.
*/
TabPanel.prototype._onTabActivateRequested = function (sender, args) {
args.title.owner.activate();
};
/**
* Handle the `tabCloseRequested` signal from the tab bar.
*/
TabPanel.prototype._onTabCloseRequested = function (sender, args) {
args.title.owner.close();
};
/**
* Handle the `tabMoved` signal from the tab bar.
*/
TabPanel.prototype._onTabMoved = function (sender, args) {
this._tabContents.insertWidget(args.toIndex, args.title.owner);
};
/**
* Handle the `widgetRemoved` signal from the stacked panel.
*/
TabPanel.prototype._onWidgetRemoved = function (sender, widget) {
this._tabBar.removeTab(widget.title);
};
return TabPanel;
}(widget_1.Widget));
exports.TabPanel = TabPanel;
// Define the signals for the `TabPanel` class.
signaling_1.defineSignal(TabPanel.prototype, 'currentChanged');
/**
* The namespace for the private module data.
*/
var Private;
(function (Private) {
/**
* Convert a tab placement to tab bar orientation.
*/
function orientationFromPlacement(plc) {
return placementToOrientationMap[plc];
}
Private.orientationFromPlacement = orientationFromPlacement;
/**
* Convert a tab placement to a box layout direction.
*/
function directionFromPlacement(plc) {
return placementToDirectionMap[plc];
}
Private.directionFromPlacement = directionFromPlacement;
/**
* A mapping of tab placement to tab bar orientation.
*/
var placementToOrientationMap = {
'top': 'horizontal',
'left': 'vertical',
'right': 'vertical',
'bottom': 'horizontal'
};
/**
* A mapping of tab placement to box layout direction.
*/
var placementToDirectionMap = {
'top': 'top-to-bottom',
'left': 'left-to-right',
'right': 'right-to-left',
'bottom': 'bottom-to-top'
};
})(Private || (Private = {}));
/***/ },
/* 53 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
var iteration_1 = __webpack_require__(15);
var mutation_1 = __webpack_require__(34);
var searching_1 = __webpack_require__(31);
var vector_1 = __webpack_require__(35);
var messaging_1 = __webpack_require__(16);
var signaling_1 = __webpack_require__(21);
var cursor_1 = __webpack_require__(54);
var query_1 = __webpack_require__(56);
var title_1 = __webpack_require__(22);
var vdom_1 = __webpack_require__(57);
var widget_1 = __webpack_require__(14);
/**
* The class name added to TabBar instances.
*/
var TAB_BAR_CLASS = 'p-TabBar';
/**
* The class name added to a tab bar content node.
*/
var CONTENT_CLASS = 'p-TabBar-content';
/**
* The class name added to a tab bar tab.
*/
var TAB_CLASS = 'p-TabBar-tab';
/**
* The class name added to a tab label node.
*/
var LABEL_CLASS = 'p-TabBar-tabLabel';
/**
* The class name added to a tab icon node.
*/
var ICON_CLASS = 'p-TabBar-tabIcon';
/**
* The class name added to a tab close icon node.
*/
var CLOSE_ICON_CLASS = 'p-TabBar-tabCloseIcon';
/**
* The class name added to a tab bar and tab when dragging.
*/
var DRAGGING_CLASS = 'p-mod-dragging';
/**
* The class name added to the current tab.
*/
var CURRENT_CLASS = 'p-mod-current';
/**
* The class name added to a closable tab.
*/
var CLOSABLE_CLASS = 'p-mod-closable';
/**
* The start drag distance threshold.
*/
var DRAG_THRESHOLD = 5;
/**
* The detach distance threshold.
*/
var DETACH_THRESHOLD = 20;
/**
* The DOM structure for a TabBar.
*/
var TAB_BAR_NODE = (vdom_1.h.div(vdom_1.h.ul({ className: CONTENT_CLASS })));
/**
* A widget which displays titles as a single row or column of tabs.
*
* #### Notes
* If CSS transforms are used to rotate nodes for vertically oriented
* text, then tab dragging will not work correctly. The `tabsMovable`
* property should be set to `false` when rotating nodes from CSS.
*/
var TabBar = (function (_super) {
__extends(TabBar, _super);
/**
* Construct a new tab bar.
*
* @param options - The options for initializing the tab bar.
*/
function TabBar(options) {
if (options === void 0) { options = {}; }
var _this = _super.call(this, { node: vdom_1.realize(TAB_BAR_NODE) }) || this;
_this._currentIndex = -1;
_this._previousTitle = null;
_this._titles = new vector_1.Vector();
_this._dragData = null;
_this.addClass(TAB_BAR_CLASS);
_this.setFlag(widget_1.WidgetFlag.DisallowLayout);
_this._tabsMovable = options.tabsMovable || false;
_this._allowDeselect = options.allowDeselect || false;
_this._orientation = options.orientation || 'horizontal';
_this._renderer = options.renderer || TabBar.defaultRenderer;
_this._insertBehavior = options.insertBehavior || 'select-tab-if-needed';
_this._removeBehavior = options.removeBehavior || 'select-tab-after';
_this.addClass("p-mod-" + _this._orientation);
return _this;
}
/**
* Dispose of the resources held by the widget.
*/
TabBar.prototype.dispose = function () {
this._releaseMouse();
this._titles.clear();
this._renderer = null;
this._previousTitle = null;
_super.prototype.dispose.call(this);
};
Object.defineProperty(TabBar.prototype, "contentNode", {
/**
* Get the tab bar content node.
*
* #### Notes
* This is the node which holds the tab nodes.
*
* Modifying this node directly can lead to undefined behavior.
*
* This is a read-only property.
*/
get: function () {
return this.node.getElementsByClassName(CONTENT_CLASS)[0];
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabBar.prototype, "titles", {
/**
* A read-only sequence of the titles in the tab bar.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return this._titles;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabBar.prototype, "currentTitle", {
/**
* Get the currently selected title.
*
* #### Notes
* This will be `null` if no tab is selected.
*/
get: function () {
var i = this._currentIndex;
return i !== -1 ? this._titles.at(i) : null;
},
/**
* Set the currently selected title.
*
* #### Notes
* If the title does not exist, the title will be set to `null`.
*/
set: function (value) {
this.currentIndex = searching_1.indexOf(this._titles, value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabBar.prototype, "currentIndex", {
/**
* Get the index of the currently selected tab.
*
* #### Notes
* This will be `-1` if no tab is selected.
*/
get: function () {
return this._currentIndex;
},
/**
* Set the index of the currently selected tab.
*
* #### Notes
* If the value is out of range, the index will be set to `-1`.
*/
set: function (value) {
// Coerce the value to an index.
var i = Math.floor(value);
if (i < 0 || i >= this._titles.length) {
i = -1;
}
// Bail early if the index will not change.
if (this._currentIndex === i) {
return;
}
// Look up the previous index and title.
var pi = this._currentIndex;
var pt = pi === -1 ? null : this._titles.at(pi);
// Look up the current index and title.
var ci = i;
var ct = ci === -1 ? null : this._titles.at(ci);
// Update the current index and previous title.
this._currentIndex = ci;
this._previousTitle = pt;
// Emit the current changed signal.
this.currentChanged.emit({
previousIndex: pi, previousTitle: pt,
currentIndex: ci, currentTitle: ct
});
// Schedule an update of the tabs.
this.update();
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabBar.prototype, "orientation", {
/**
* Get the orientation of the tab bar.
*
* #### Notes
* This controls whether the tabs are arranged in a row or column.
*/
get: function () {
return this._orientation;
},
/**
* Set the orientation of the tab bar.
*
* #### Notes
* This controls whether the tabs are arranged in a row or column.
*/
set: function (value) {
// Do nothing if the orientation does not change.
if (this._orientation === value) {
return;
}
// Release the mouse before making any changes.
this._releaseMouse();
// Swap the orientation values.
var old = this._orientation;
this._orientation = value;
// Toggle the orientation classes.
this.removeClass("p-mod-" + old);
this.addClass("p-mod-" + value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabBar.prototype, "tabsMovable", {
/**
* Get whether the tabs are movable by the user.
*
* #### Notes
* Tabs can always be moved programmatically.
*/
get: function () {
return this._tabsMovable;
},
/**
* Set whether the tabs are movable by the user.
*
* #### Notes
* Tabs can always be moved programmatically.
*/
set: function (value) {
this._tabsMovable = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabBar.prototype, "allowDeselect", {
/**
* Get whether a tab can be deselected by the user.
*
* #### Notes
* Tabs can be always be deselected programmatically.
*/
get: function () {
return this._allowDeselect;
},
/**
* Set whether a tab can be deselected by the user.
*
* #### Notes
* Tabs can be always be deselected programmatically.
*/
set: function (value) {
this._allowDeselect = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabBar.prototype, "insertBehavior", {
/**
* Get the selection behavior when inserting a tab.
*/
get: function () {
return this._insertBehavior;
},
/**
* Set the selection behavior when inserting a tab.
*/
set: function (value) {
this._insertBehavior = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabBar.prototype, "removeBehavior", {
/**
* Get the selection behavior when removing a tab.
*/
get: function () {
return this._removeBehavior;
},
/**
* Set the selection behavior when removing a tab.
*/
set: function (value) {
this._removeBehavior = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabBar.prototype, "renderer", {
/**
* The renderer used by the tab bar.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return this._renderer;
},
enumerable: true,
configurable: true
});
/**
* Add a tab to the end of the tab bar.
*
* @param value - The title which holds the data for the tab,
* or an options object to convert to a title.
*
* @returns The title object added to the tab bar.
*
* #### Notes
* If the title is already added to the tab bar, it will be moved.
*/
TabBar.prototype.addTab = function (value) {
return this.insertTab(this._titles.length, value);
};
/**
* Insert a tab into the tab bar at the specified index.
*
* @param index - The index at which to insert the tab.
*
* @param value - The title which holds the data for the tab,
* or an options object to convert to a title.
*
* @returns The title object added to the tab bar.
*
* #### Notes
* The index will be clamped to the bounds of the tabs.
*
* If the title is already added to the tab bar, it will be moved.
*/
TabBar.prototype.insertTab = function (index, value) {
// Release the mouse before making any changes.
this._releaseMouse();
// Coerce the value to a title.
var title = Private.asTitle(value);
// Look up the index of the title.
var i = searching_1.indexOf(this._titles, title);
// Clamp the insert index to the vector bounds.
var j = Math.max(0, Math.min(Math.floor(index), this._titles.length));
// If the title is not in the vector, insert it.
if (i === -1) {
// Insert the title into the vector.
this._titles.insert(j, title);
// Connect to the title changed signal.
title.changed.connect(this._onTitleChanged, this);
// Adjust the current index for the insert.
this._adjustCurrentForInsert(j, title);
// Schedule an update of the tabs.
this.update();
// Return the title added to the tab bar.
return title;
}
// Otherwise, the title exists in the vector and should be moved.
// Adjust the index if the location is at the end of the vector.
if (j === this._titles.length)
j--;
// Bail if there is no effective move.
if (i === j)
return title;
// Move the title to the new location.
mutation_1.move(this._titles, i, j);
// Adjust the current index for the move.
this._adjustCurrentForMove(i, j);
// Schedule an update of the tabs.
this.update();
// Return the title added to the tab bar.
return title;
};
/**
* Remove a tab from the tab bar.
*
* @param title - The title for the tab to remove.
*
* @returns The index occupied by the tab, or `-1` if the tab
* was not contained in the tab bar.
*/
TabBar.prototype.removeTab = function (title) {
var index = searching_1.indexOf(this._titles, title);
if (index !== -1)
this.removeTabAt(index);
return index;
};
/**
* Remove the tab at a given index from the tab bar.
*
* @param index - The index of the tab to remove.
*
* @returns The title occupying the index, or `null` if the index
* is out of range.
*/
TabBar.prototype.removeTabAt = function (index) {
// Bail if the index is out of range.
var i = Math.floor(index);
if (i < 0 || i >= this._titles.length) {
return null;
}
// Release the mouse before making any changes.
this._releaseMouse();
// Remove the title from the vector.
var title = this._titles.removeAt(i);
// Disconnect from the title changed signal.
title.changed.disconnect(this._onTitleChanged, this);
// Clear the previous title if it's being removed.
if (title === this._previousTitle) {
this._previousTitle = null;
}
// Adjust the current index for the remove.
this._adjustCurrentForRemove(i, title);
// Schedule an update of the tabs.
this.update();
// Return the removed title.
return title;
};
/**
* Remove all tabs from the tab bar.
*/
TabBar.prototype.clearTabs = function () {
var _this = this;
// Bail if there is nothing to remove.
if (this._titles.length === 0) {
return;
}
// Release the mouse before making any changes.
this._releaseMouse();
// Disconnect from the title changed signals.
iteration_1.each(this._titles, function (title) {
title.changed.disconnect(_this._onTitleChanged, _this);
});
// Get the current index and title.
var pi = this.currentIndex;
var pt = this.currentTitle;
// Reset the current index and previous title.
this._currentIndex = -1;
this._previousTitle = null;
// Clear the title vector.
this._titles.clear();
// Schedule an update of the tabs.
this.update();
// If no tab was selected, there's nothing else to do.
if (pi === -1) {
return;
}
// Emit the current changed signal.
this.currentChanged.emit({
previousIndex: pi, previousTitle: pt,
currentIndex: -1, currentTitle: null
});
};
/**
* Release the mouse and restore the non-dragged tab positions.
*
* #### Notes
* This will cause the tab bar to stop handling mouse events and to
* restore the tabs to their non-dragged positions.
*/
TabBar.prototype.releaseMouse = function () {
this._releaseMouse();
};
/**
* Handle the DOM events for the tab bar.
*
* @param event - The DOM event sent to the tab bar.
*
* #### Notes
* This method implements the DOM `EventListener` interface and is
* called in response to events on the tab bar's DOM node.
*
* This should not be called directly by user code.
*/
TabBar.prototype.handleEvent = function (event) {
switch (event.type) {
case 'click':
this._evtClick(event);
break;
case 'mousedown':
this._evtMouseDown(event);
break;
case 'mousemove':
this._evtMouseMove(event);
break;
case 'mouseup':
this._evtMouseUp(event);
break;
case 'keydown':
this._evtKeyDown(event);
break;
case 'contextmenu':
event.preventDefault();
event.stopPropagation();
break;
}
};
/**
* A message handler invoked on an `'after-attach'` message.
*/
TabBar.prototype.onAfterAttach = function (msg) {
this.node.addEventListener('click', this);
this.node.addEventListener('mousedown', this);
};
/**
* A message handler invoked on a `'before-detach'` message.
*/
TabBar.prototype.onBeforeDetach = function (msg) {
this.node.removeEventListener('click', this);
this.node.removeEventListener('mousedown', this);
this._releaseMouse();
};
/**
* A message handler invoked on an `'update-request'` message.
*/
TabBar.prototype.onUpdateRequest = function (msg) {
var content = [];
var titles = this._titles;
var renderer = this._renderer;
var currentTitle = this.currentTitle;
for (var i = 0, n = titles.length; i < n; ++i) {
var title = titles.at(i);
var current = title === currentTitle;
var zIndex = current ? n : n - i - 1;
content.push(renderer.renderTab({ title: title, current: current, zIndex: zIndex }));
}
vdom_1.render(content, this.contentNode);
};
/**
* Handle the `'keydown'` event for the tab bar.
*/
TabBar.prototype._evtKeyDown = function (event) {
// Stop all input events during drag.
event.preventDefault();
event.stopPropagation();
// Release the mouse if `Escape` is pressed.
if (event.keyCode === 27)
this._releaseMouse();
};
/**
* Handle the `'click'` event for the tab bar.
*/
TabBar.prototype._evtClick = function (event) {
// Do nothing if it's not a left click.
if (event.button !== 0) {
return;
}
// Do nothing if a drag is in progress.
if (this._dragData) {
return;
}
// Lookup the tab nodes.
var tabs = this.contentNode.children;
// Do nothing if the click is not on a tab.
var x = event.clientX;
var y = event.clientY;
var i = searching_1.findIndex(tabs, function (tab) { return query_1.hitTest(tab, x, y); });
if (i < 0) {
return;
}
// Clicking on a tab stops the event propagation.
event.preventDefault();
event.stopPropagation();
// Ignore the click if the title is not closable.
var title = this._titles.at(i);
if (!title.closable) {
return;
}
// Ignore the click if it was not on a close icon.
var icon = tabs[i].querySelector(this._renderer.closeIconSelector);
if (!icon || !icon.contains(event.target)) {
return;
}
// Emit the tab close requested signal.
this.tabCloseRequested.emit({ index: i, title: title });
};
/**
* Handle the `'mousedown'` event for the tab bar.
*/
TabBar.prototype._evtMouseDown = function (event) {
// Do nothing if it's not a left mouse press.
if (event.button !== 0) {
return;
}
// Do nothing if a drag is in progress.
if (this._dragData) {
return;
}
// Lookup the tab nodes.
var tabs = this.contentNode.children;
// Do nothing if the press is not on a tab.
var x = event.clientX;
var y = event.clientY;
var i = searching_1.findIndex(tabs, function (tab) { return query_1.hitTest(tab, x, y); });
if (i < 0) {
return;
}
// Pressing on a tab stops the event propagation.
event.preventDefault();
event.stopPropagation();
// Ignore the press if it was on a close icon.
var icon = tabs[i].querySelector(this._renderer.closeIconSelector);
if (icon && icon.contains(event.target)) {
return;
}
// Setup the drag data if the tabs are movable.
if (this._tabsMovable) {
this._dragData = new Private.DragData();
this._dragData.index = i;
this._dragData.tab = tabs[i];
this._dragData.pressX = event.clientX;
this._dragData.pressY = event.clientY;
document.addEventListener('mousemove', this, true);
document.addEventListener('mouseup', this, true);
document.addEventListener('keydown', this, true);
document.addEventListener('contextmenu', this, true);
}
// Update the current index as appropriate.
if (this._allowDeselect && this._currentIndex === i) {
this.currentIndex = -1;
}
else {
this.currentIndex = i;
}
// Do nothing else if there is no current tab.
if (this._currentIndex === -1) {
return;
}
// Emit the tab activate request signal.
this.tabActivateRequested.emit({
index: this.currentIndex,
title: this.currentTitle
});
};
/**
* Handle the `'mousemove'` event for the tab bar.
*/
TabBar.prototype._evtMouseMove = function (event) {
// Do nothing if no drag is in progress.
if (!this._dragData) {
return;
}
// Suppress the event during a drag.
event.preventDefault();
event.stopPropagation();
// Lookup the tab nodes.
var tabs = this.contentNode.children;
// Check the threshold if the drag is not active.
var data = this._dragData;
if (!data.dragActive) {
// Bail if the drag threshold is not exceeded.
var dx = Math.abs(event.clientX - data.pressX);
var dy = Math.abs(event.clientY - data.pressY);
if (dx < DRAG_THRESHOLD && dy < DRAG_THRESHOLD) {
return;
}
// Fill in the rest of the drag data measurements.
var tabRect = data.tab.getBoundingClientRect();
if (this._orientation === 'horizontal') {
data.tabPos = data.tab.offsetLeft;
data.tabSize = tabRect.width;
data.tabPressPos = data.pressX - tabRect.left;
}
else {
data.tabPos = data.tab.offsetTop;
data.tabSize = tabRect.height;
data.tabPressPos = data.pressY - tabRect.top;
}
data.tabLayout = Private.snapTabLayout(tabs, this._orientation);
data.contentRect = this.contentNode.getBoundingClientRect();
data.override = cursor_1.overrideCursor('default');
// Add the dragging style classes.
data.tab.classList.add(DRAGGING_CLASS);
this.addClass(DRAGGING_CLASS);
// Mark the drag as active.
data.dragActive = true;
}
// Emit the detach requested signal if the threshold is exceeded.
if (!data.detachRequested && Private.detachExceeded(data, event)) {
// Only emit the signal once per drag cycle.
data.detachRequested = true;
// Setup the arguments for the signal.
var index = data.index;
var clientX = event.clientX;
var clientY = event.clientY;
var tab = tabs[index];
var title = this._titles.at(index);
// Emit the tab detach requested signal.
this.tabDetachRequested.emit({ index: index, title: title, tab: tab, clientX: clientX, clientY: clientY });
// Bail if the signal handler aborted the drag.
if (data.dragAborted) {
return;
}
}
// Update the positions of the tabs.
Private.layoutTabs(tabs, data, event, this._orientation);
};
/**
* Handle the `'mouseup'` event for the tab bar.
*/
TabBar.prototype._evtMouseUp = function (event) {
var _this = this;
// Do nothing if it's not a left mouse release.
if (event.button !== 0) {
return;
}
// Do nothing if no drag is in progress.
if (!this._dragData) {
return;
}
// Suppress the event during a drag operation.
event.preventDefault();
event.stopPropagation();
// Remove the extra mouse event listeners.
document.removeEventListener('mousemove', this, true);
document.removeEventListener('mouseup', this, true);
document.removeEventListener('keydown', this, true);
document.removeEventListener('contextmenu', this, true);
// Bail early if the drag is not active.
var data = this._dragData;
if (!data.dragActive) {
this._dragData = null;
return;
}
// Position the tab at its final resting position.
Private.finalizeTabPosition(data, this._orientation);
// Remove the dragging class from the tab so it can be transitioned.
data.tab.classList.remove(DRAGGING_CLASS);
// Parse the transition duration for releasing the tab.
var duration = Private.parseTransitionDuration(data.tab);
// Complete the release on a timer to allow the tab to transition.
setTimeout(function () {
// Do nothing if the drag has been aborted.
if (data.dragAborted) {
return;
}
// Clear the drag data reference.
_this._dragData = null;
// Reset the positions of the tabs.
Private.resetTabPositions(_this.contentNode.children, _this._orientation);
// Clear the cursor grab.
data.override.dispose();
// Remove the remaining dragging style.
_this.removeClass(DRAGGING_CLASS);
// If the tab was not moved, there is nothing else to do.
var i = data.index;
var j = data.targetIndex;
if (j === -1 || i === j) {
return;
}
// Move the title to the new locations.
mutation_1.move(_this._titles, i, j);
// Adjust the current index for the move.
_this._adjustCurrentForMove(i, j);
// Emit the tab moved signal.
_this.tabMoved.emit({
fromIndex: i, toIndex: j, title: _this._titles.at(j)
});
// Update the tabs immediately to prevent flicker.
messaging_1.sendMessage(_this, widget_1.WidgetMessage.UpdateRequest);
}, duration);
};
/**
* Release the mouse and restore the non-dragged tab positions.
*/
TabBar.prototype._releaseMouse = function () {
// Do nothing if no drag is in progress.
if (!this._dragData) {
return;
}
// Remove the extra mouse listeners.
document.removeEventListener('mousemove', this, true);
document.removeEventListener('mouseup', this, true);
document.removeEventListener('keydown', this, true);
document.removeEventListener('contextmenu', this, true);
// Clear the drag data reference.
var data = this._dragData;
this._dragData = null;
// Indicate the drag has been aborted. This allows the mouse
// event handlers to return early when the drag is canceled.
data.dragAborted = true;
// If the drag is not active, there's nothing more to do.
if (!data.dragActive) {
return;
}
// Reset the tabs to their non-dragged positions.
Private.resetTabPositions(this.contentNode.children, this._orientation);
// Clear the cursor override.
data.override.dispose();
// Clear the dragging style classes.
data.tab.classList.remove(DRAGGING_CLASS);
this.removeClass(DRAGGING_CLASS);
};
/**
* Adjust the current index for a tab insert operation.
*
* This method accounts for the tab bar's insertion behavior when
* adjusting the current index and emitting the changed signal.
*/
TabBar.prototype._adjustCurrentForInsert = function (i, title) {
// Lookup commonly used variables.
var ct = this.currentTitle;
var ci = this._currentIndex;
var bh = this._insertBehavior;
// Handle the behavior where the new tab is always selected,
// or the behavior where the new tab is selected if needed.
if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {
this._currentIndex = i;
this._previousTitle = ct;
this.currentChanged.emit({
previousIndex: ci, previousTitle: ct,
currentIndex: i, currentTitle: title
});
return;
}
// Otherwise, silently adjust the current index if needed.
if (ci >= i)
this._currentIndex++;
};
/**
* Adjust the current index for a tab move operation.
*
* This method will not cause the actual current tab to change.
* It silently adjusts the index to account for the given move.
*/
TabBar.prototype._adjustCurrentForMove = function (i, j) {
if (this._currentIndex === i) {
this._currentIndex = j;
}
else if (this._currentIndex < i && this._currentIndex >= j) {
this._currentIndex++;
}
else if (this._currentIndex > i && this._currentIndex <= j) {
this._currentIndex--;
}
};
/**
* Adjust the current index for a tab remove operation.
*
* This method accounts for the tab bar's remove behavior when
* adjusting the current index and emitting the changed signal.
*/
TabBar.prototype._adjustCurrentForRemove = function (i, title) {
// Lookup commonly used variables.
var ci = this._currentIndex;
var bh = this._removeBehavior;
// Silently adjust the index if the current tab is not removed.
if (ci !== i) {
if (ci > i)
this._currentIndex--;
return;
}
// No tab gets selected if the tab bar is empty.
if (this._titles.length === 0) {
this._currentIndex = -1;
this.currentChanged.emit({
previousIndex: i, previousTitle: title,
currentIndex: -1, currentTitle: null
});
return;
}
// Handle behavior where the next sibling tab is selected.
if (bh === 'select-tab-after') {
this._currentIndex = Math.min(i, this._titles.length - 1);
this.currentChanged.emit({
previousIndex: i, previousTitle: title,
currentIndex: this._currentIndex, currentTitle: this.currentTitle
});
return;
}
// Handle behavior where the previous sibling tab is selected.
if (bh === 'select-tab-before') {
this._currentIndex = Math.max(0, i - 1);
this.currentChanged.emit({
previousIndex: i, previousTitle: title,
currentIndex: this._currentIndex, currentTitle: this.currentTitle
});
return;
}
// Handle behavior where the previous history tab is selected.
if (bh === 'select-previous-tab') {
if (this._previousTitle) {
this._currentIndex = searching_1.indexOf(this._titles, this._previousTitle);
this._previousTitle = null;
}
else {
this._currentIndex = Math.min(i, this._titles.length - 1);
}
this.currentChanged.emit({
previousIndex: i, previousTitle: title,
currentIndex: this._currentIndex, currentTitle: this.currentTitle
});
return;
}
// Otherwise, no tab gets selected.
this._currentIndex = -1;
this.currentChanged.emit({
previousIndex: i, previousTitle: title,
currentIndex: -1, currentTitle: null
});
};
/**
* Handle the `changed` signal of a title object.
*/
TabBar.prototype._onTitleChanged = function (sender) {
this.update();
};
return TabBar;
}(widget_1.Widget));
exports.TabBar = TabBar;
// Define the signals for the `TabBar` class.
signaling_1.defineSignal(TabBar.prototype, 'currentChanged');
signaling_1.defineSignal(TabBar.prototype, 'tabMoved');
signaling_1.defineSignal(TabBar.prototype, 'tabActivateRequested');
signaling_1.defineSignal(TabBar.prototype, 'tabCloseRequested');
signaling_1.defineSignal(TabBar.prototype, 'tabDetachRequested');
/**
* The namespace for the `TabBar` class statics.
*/
(function (TabBar) {
/**
* The default implementation of `IRenderer`.
*/
var Renderer = (function () {
/**
* Construct a new renderer.
*
* @param options - The options for initializing the renderer.
*/
function Renderer(options) {
if (options === void 0) { options = {}; }
this._tabID = 0;
this._tabKeys = new WeakMap();
this._extraTabClass = options.extraTabClass || '';
}
Object.defineProperty(Renderer.prototype, "closeIconSelector", {
/**
* A selector which matches the close icon node in a tab.
*
* #### Notes
* This is a read-only property.
*/
get: function () {
return "." + CLOSE_ICON_CLASS;
},
enumerable: true,
configurable: true
});
/**
* Render the node for the a tab.
*
* @param data - The data to use for rendering the tab.
*
* @returns A virtual DOM node representing the tab.
*/
Renderer.prototype.renderTab = function (data) {
var _a = data.title, label = _a.label, caption = _a.caption;
var key = this.createTabKey(data);
var style = this.createTabStyle(data);
var tabClass = this.createTabClass(data);
var iconClass = this.createIconClass(data);
return (vdom_1.h.li({ key: key, className: tabClass, title: caption, style: style }, vdom_1.h.div({ className: iconClass }), vdom_1.h.div({ className: LABEL_CLASS }, label), vdom_1.h.div({ className: CLOSE_ICON_CLASS })));
};
/**
* Create a unique render key for the tab.
*
* @param data - The data to use for the tab.
*
* @returns The unique render key for the tab.
*
* #### Notes
* This method caches the key against the tab title the first time
* the key is generated. This enables efficient rendering of moved
* tabs and avoids subtle hover style artifacts.
*/
Renderer.prototype.createTabKey = function (data) {
var key = this._tabKeys.get(data.title);
if (key === void 0) {
key = "tab-key-" + this._tabID++;
this._tabKeys.set(data.title, key);
}
return key;
};
/**
* Create the inline style object for a tab.
*
* @param data - The data to use for the tab.
*
* @returns The inline style data for the tab.
*/
Renderer.prototype.createTabStyle = function (data) {
return { zIndex: "" + data.zIndex };
};
/**
* Create the class name for the tab.
*
* @param data - The data to use for the tab.
*
* @returns The full class name for the tab.
*/
Renderer.prototype.createTabClass = function (data) {
var title = data.title, current = data.current;
var name = TAB_CLASS;
if (title.className) {
name += " " + title.className;
}
if (title.closable) {
name += " " + CLOSABLE_CLASS;
}
if (current) {
name += " " + CURRENT_CLASS;
}
if (this._extraTabClass) {
name += " " + this._extraTabClass;
}
return name;
};
/**
* Create the class name for the tab icon.
*
* @param data - The data to use for the tab.
*
* @returns The full class name for the tab icon.
*/
Renderer.prototype.createIconClass = function (data) {
var title = data.title;
var name = ICON_CLASS;
if (title.icon) {
name += " " + title.icon;
}
return name;
};
return Renderer;
}());
TabBar.Renderer = Renderer;
/**
* The default `Renderer` instance.
*/
TabBar.defaultRenderer = new Renderer();
})(TabBar = exports.TabBar || (exports.TabBar = {}));
exports.TabBar = TabBar;
/**
* The namespace for the private module data.
*/
var Private;
(function (Private) {
/**
* A struct which holds the drag data for a tab bar.
*/
var DragData = (function () {
function DragData() {
/**
* The tab node being dragged.
*/
this.tab = null;
/**
* The index of the tab being dragged.
*/
this.index = -1;
/**
* The offset left/top of the tab being dragged.
*/
this.tabPos = -1;
/**
* The offset width/height of the tab being dragged.
*/
this.tabSize = -1;
/**
* The original mouse X/Y position in tab coordinates.
*/
this.tabPressPos = -1;
/**
* The tab target index upon mouse release.
*/
this.targetIndex = -1;
/**
* The array of tab layout objects snapped at drag start.
*/
this.tabLayout = null;
/**
* The mouse press client X position.
*/
this.pressX = -1;
/**
* The mouse press client Y position.
*/
this.pressY = -1;
/**
* The bounding client rect of the tab bar content node.
*/
this.contentRect = null;
/**
* The disposable to clean up the cursor override.
*/
this.override = null;
/**
* Whether the drag is currently active.
*/
this.dragActive = false;
/**
* Whether the drag has been aborted.
*/
this.dragAborted = false;
/**
* Whether a detach request as been made.
*/
this.detachRequested = false;
}
return DragData;
}());
Private.DragData = DragData;
/**
* Coerce a title or options into a real title.
*/
function asTitle(value) {
return value instanceof title_1.Title ? value : new title_1.Title(value);
}
Private.asTitle = asTitle;
/**
* Parse the transition duration for a tab node.
*/
function parseTransitionDuration(tab) {
var style = window.getComputedStyle(tab);
return 1000 * (parseFloat(style.transitionDuration) || 0);
}
Private.parseTransitionDuration = parseTransitionDuration;
/**
* Get a snapshot of the current tab layout values.
*/
function snapTabLayout(tabs, orientation) {
var layout = new Array(tabs.length);
if (orientation === 'horizontal') {
for (var i = 0, n = tabs.length; i < n; ++i) {
var node = tabs[i];
var pos = node.offsetLeft;
var size = node.offsetWidth;
var cstyle = window.getComputedStyle(node);
var margin = parseInt(cstyle.marginLeft, 10) || 0;
layout[i] = { margin: margin, pos: pos, size: size };
}
}
else {
for (var i = 0, n = tabs.length; i < n; ++i) {
var node = tabs[i];
var pos = node.offsetTop;
var size = node.offsetHeight;
var cstyle = window.getComputedStyle(node);
var margin = parseInt(cstyle.marginTop, 10) || 0;
layout[i] = { margin: margin, pos: pos, size: size };
}
}
return layout;
}
Private.snapTabLayout = snapTabLayout;
/**
* Test if the event exceeds the drag detach threshold.
*/
function detachExceeded(data, event) {
var rect = data.contentRect;
return ((event.clientX < rect.left - DETACH_THRESHOLD) ||
(event.clientX >= rect.right + DETACH_THRESHOLD) ||
(event.clientY < rect.top - DETACH_THRESHOLD) ||
(event.clientY >= rect.bottom + DETACH_THRESHOLD));
}
Private.detachExceeded = detachExceeded;
/**
* Update the relative tab positions and computed target index.
*/
function layoutTabs(tabs, data, event, orientation) {
// Compute the orientation-sensitive values.
var pressPos;
var localPos;
var clientPos;
var clientSize;
if (orientation === 'horizontal') {
pressPos = data.pressX;
localPos = event.clientX - data.contentRect.left;
clientPos = event.clientX;
clientSize = data.contentRect.width;
}
else {
pressPos = data.pressY;
localPos = event.clientY - data.contentRect.top;
clientPos = event.clientY;
clientSize = data.contentRect.height;
}
// Compute the target data.
var targetIndex = data.index;
var targetPos = localPos - data.tabPressPos;
var targetEnd = targetPos + data.tabSize;
// Update the relative tab positions.
for (var i = 0, n = tabs.length; i < n; ++i) {
var pxPos = void 0;
var layout = data.tabLayout[i];
var threshold = layout.pos + (layout.size >> 1);
if (i < data.index && targetPos < threshold) {
pxPos = data.tabSize + data.tabLayout[i + 1].margin + "px";
targetIndex = Math.min(targetIndex, i);
}
else if (i > data.index && targetEnd > threshold) {
pxPos = -data.tabSize - layout.margin + "px";
targetIndex = Math.max(targetIndex, i);
}
else if (i === data.index) {
var ideal = clientPos - pressPos;
var limit = clientSize - (data.tabPos + data.tabSize);
pxPos = Math.max(-data.tabPos, Math.min(ideal, limit)) + "px";
}
else {
pxPos = '';
}
if (orientation === 'horizontal') {
tabs[i].style.left = pxPos;
}
else {
tabs[i].style.top = pxPos;
}
}
// Update the computed target index.
data.targetIndex = targetIndex;
}
Private.layoutTabs = layoutTabs;
/**
* Position the drag tab at its final resting relative position.
*/
function finalizeTabPosition(data, orientation) {
// Compute the orientation-sensitive client size.
var clientSize;
if (orientation === 'horizontal') {
clientSize = data.contentRect.width;
}
else {
clientSize = data.contentRect.height;
}
// Compute the ideal final tab position.
var ideal;
if (data.targetIndex === data.index) {
ideal = 0;
}
else if (data.targetIndex > data.index) {
var tgt = data.tabLayout[data.targetIndex];
ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;
}
else {
var tgt = data.tabLayout[data.targetIndex];
ideal = tgt.pos - data.tabPos;
}
// Compute the tab position limit.
var limit = clientSize - (data.tabPos + data.tabSize);
var final = Math.max(-data.tabPos, Math.min(ideal, limit));
// Set the final orientation-sensitive position.
if (orientation === 'horizontal') {
data.tab.style.left = final + "px";
}
else {
data.tab.style.top = final + "px";
}
}
Private.finalizeTabPosition = finalizeTabPosition;
/**
* Reset the relative positions of the given tabs.
*/
function resetTabPositions(tabs, orientation) {
if (orientation === 'horizontal') {
iteration_1.each(tabs, function (tab) { tab.style.left = ''; });
}
else {
iteration_1.each(tabs, function (tab) { tab.style.top = ''; });
}
}
Private.resetTabPositions = resetTabPositions;
})(Private || (Private = {}));
/***/ },
/* 54 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
var disposable_1 = __webpack_require__(55);
/**
* The class name added to the document body during cursor override.
*/
var OVERRIDE_CURSOR_CLASS = 'p-mod-override-cursor';
/**
* Override the cursor for the entire document.
*
* @param cursor - The string representing the cursor style.
*
* @returns A disposable which will clear the override when disposed.
*
* #### Notes
* The most recent call to `overrideCursor` takes precedence. Disposing
* an old override is a no-op and will not effect the current override.
*
* #### Example
* ```typescript
* import { overrideCursor } from 'phosphor/lib/dom/cursor';
*
* // force the cursor to be 'wait' for the entire document
* let override = overrideCursor('wait');
*
* // clear the override by disposing the return value
* override.dispose();
* ```
*/
function overrideCursor(cursor) {
var id = ++Private.cursorID;
var body = document.body;
body.style.cursor = cursor;
body.classList.add(OVERRIDE_CURSOR_CLASS);
return new disposable_1.DisposableDelegate(function () {
if (id === Private.cursorID) {
body.style.cursor = '';
body.classList.remove(OVERRIDE_CURSOR_CLASS);
}
});
}
exports.overrideCursor = overrideCursor;
/**
* The namespace for the private module data.
*/
var Private;
(function (Private) {
/**
* The id for the active cursor override.
*/
Private.cursorID = 0;
})(Private || (Private = {}));
/***/ },
/* 55 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
var iteration_1 = __webpack_require__(15);
/**
* A disposable object which delegates to a callback function.
*/
var DisposableDelegate = (function () {
/**
* Construct a new disposable delegate.
*
* @param callback - The function to invoke on dispose.
*/
function DisposableDelegate(callback) {
this._callback = callback || null;
}
Object.defineProperty(DisposableDelegate.prototype, "isDisposed", {
/**
* Test whether the delegate has been disposed.
*
* #### Notes
* This is a read-only property which is always safe to access.
*/
get: function () {
return this._callback === null;
},
enumerable: true,
configurable: true
});
/**
* Dispose of the delegate and invoke the callback function.
*
* #### Notes
* All calls to this method after the first will be a no-op.
*/
DisposableDelegate.prototype.dispose = function () {
if (this._callback === null) {
return;
}
var callback = this._callback;
this._callback = null;
callback();
};
return DisposableDelegate;
}());
exports.DisposableDelegate = DisposableDelegate;
/**
* An object which manages a collection of disposable items.
*/
var DisposableSet = (function () {
/**
* Construct a new disposable set.
*
* @param items - The initial disposable items.
*/
function DisposableSet(items) {
var _this = this;
this._set = new Set();
if (items)
iteration_1.each(items, function (item) { _this._set.add(item); });
}
Object.defineProperty(DisposableSet.prototype, "isDisposed", {
/**
* Test whether the set has been disposed.
*
* #### Notes
* This is a read-only property which is always safe to access.
*/
get: function () {
return this._set === null;
},
enumerable: true,
configurable: true
});
/**
* Dispose of the set and the disposable items it contains.
*
* #### Notes
* Items are disposed in the order they are added to the set.
*
* It is unsafe to use the set after it has been disposed.
*
* All calls to this method after the first will be a no-op.
*/
DisposableSet.prototype.dispose = function () {
if (this._set === null) {
return;
}
var set = this._set;
this._set = null;
set.forEach(function (item) { item.dispose(); });
};
/**
* Add a disposable item to the set.
*
* @param item - The disposable item to add to the set. If the item
* is already contained in the set, this is a no-op.
*
* @throws An error if the set has been disposed.
*/
DisposableSet.prototype.add = function (item) {
if (this._set === null) {
throw new Error('Object is disposed');
}
this._set.add(item);
};
/**
* Remove a disposable item from the set.
*
* @param item - The disposable item to remove from the set. If the
* item does not exist in the set, this is a no-op.
*
* @throws An error if the set has been disposed.
*/
DisposableSet.prototype.remove = function (item) {
if (this._set === null) {
throw new Error('Object is disposed');
}
this._set.delete(item);
};
/**
* Remove all disposable items from the set.
*
* @throws An error if the set has been disposed.
*/
DisposableSet.prototype.clear = function () {
if (this._set === null) {
throw new Error('Object is disposed');
}
this._set.clear();
};
return DisposableSet;
}());
exports.DisposableSet = DisposableSet;
/***/ },
/* 56 */
/***/ function(module, exports) {
"use strict";
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Test whether a client position lies within a node.
*
* @param node - The DOM node of interest.
*
* @param clientX - The client X coordinate of interest.
*
* @param clientY - The client Y coordinate of interest.
*
* @returns `true` if the node covers the position, `false` otherwise.
*
* #### Example
* ```typescript
* import { hitTest } from 'phosphor/lib/dom/query';
*
* let div = document.createElement('div');
* div.style.position = 'absolute';
* div.style.left = '0px';
* div.style.top = '0px';
* div.style.width = '100px';
* div.style.height = '100px';
* document.body.appendChild(div);
*
* hitTest(div, 50, 50); // true
* hitTest(div, 150, 150); // false
* ```
*/
function hitTest(node, clientX, clientY) {
var rect = node.getBoundingClientRect();
return (clientX >= rect.left &&
clientX < rect.right &&
clientY >= rect.top &&
clientY < rect.bottom);
}
exports.hitTest = hitTest;
/**
* Vertically scroll an element into view if needed.
*
* @param area - The scroll area element.
*
* @param elem - The element of interest.
*
* #### Notes
* This follows the "nearest" behavior of the native `scrollIntoView`
* method, which is not supported by all browsers.
* https://drafts.csswg.org/cssom-view/#element-scrolling-members
*
* If the element fully covers the visible area or is fully contained
* within the visible area, no scrolling will take place. Otherwise,
* the nearest edges of the area and element are aligned.
*
* #### Example
* ```typescript
* import { scrollIntoViewIfNeeded } from 'phosphor/lib/dom/query';
*
* let area = document.createElement('div');
* let elem = document.createElement('div');
*
* // Style the scrollable area with a small height and a black border.
* area.style.height = '100px';
* area.style.overflow = 'auto';
* area.style.border = '1px solid black';
*
* // Style the element of interest with a red border and some content.
* elem.style.border = '1px solid red';
* elem.textContent = 'visible content';
*
* // Add enough whitespace to to guarantee scrolling.
* for (let i = 0; i < 50; i++) {
* area.appendChild(document.createElement('br'));
* }
*
* // Attach the nodes to the DOM.
* area.appendChild(elem);
* document.body.appendChild(area);
*
* // Scroll to the element of interest.
* scrollIntoViewIfNeeded(area, elem);
* ```
*/
function scrollIntoViewIfNeeded(area, elem) {
var ar = area.getBoundingClientRect();
var er = elem.getBoundingClientRect();
if (er.top <= ar.top && er.bottom >= ar.bottom) {
return;
}
if (er.top < ar.top && er.height <= ar.height) {
area.scrollTop -= ar.top - er.top;
return;
}
if (er.bottom > ar.bottom && er.height >= ar.height) {
area.scrollTop -= ar.top - er.top;
return;
}
if (er.top < ar.top && er.height > ar.height) {
area.scrollTop -= ar.bottom - er.bottom;
return;
}
if (er.bottom > ar.bottom && er.height < ar.height) {
area.scrollTop -= ar.bottom - er.bottom;
return;
}
}
exports.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded;
/***/ },
/* 57 */
/***/ function(module, exports) {
"use strict";
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2016, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* A node in a virtual DOM hierarchy.
*
* #### Notes
* User code will not usually instantiate an node directly. Rather, the
* `h()` function will be called to create a node in a type-safe manner.
*
* A node *must* be treated as immutable. Mutating the state of a node
* **will** result in undefined rendering behavior.
*/
var VNode = (function () {
/**
* Construct a new virtual DOM node.
*
* @param type - The type of the node.
*
* @param tag - The node tag.
*
* @param attrs - The node attributes.
*
* @param children - The node children.
*/
function VNode(type, tag, attrs, children) {
this.type = type;
this.tag = tag;
this.attrs = attrs;
this.children = children;
}
return VNode;
}());
exports.VNode = VNode;
function h(tag, first) {
// Setup the variables to hold the parsed data.
var attrs;
var children;
// Parse the first variadic argument.
if (first) {
if (typeof first === 'string') {
children = [first];
}
else if (first instanceof VNode) {
children = [first];
}
else if (first instanceof Array) {
children = first.slice();
}
else {
attrs = first;
}
}
// Parse the rest of the variadic arguments.
if (arguments.length > 2) {
children = children || [];
for (var i = 2, n = arguments.length; i < n; ++i) {
var child = arguments[i];
if (child instanceof Array) {
for (var j = 0, k = child.length; j < k; ++j) {
if (child[j])
children.push(child[j]);
}
}
else if (child) {
children.push(child);
}
}
}
// Convert string literal children into text nodes.
if (children) {
for (var i = 0, n = children.length; i < n; ++i) {
var child = children[i];
if (typeof child === 'string') {
children[i] = Private.createTextVNode(child);
}
}
}
// Return a new virtual DOM node.
return Private.createElementVNode(tag, attrs, children);
}
exports.h = h;
/**
* The namespace for the `h()` function statics.
*/
(function (h) {
h.a = h.bind(void 0, 'a');
h.abbr = h.bind(void 0, 'abbr');
h.address = h.bind(void 0, 'address');
h.area = h.bind(void 0, 'area');
h.article = h.bind(void 0, 'article');
h.aside = h.bind(void 0, 'aside');
h.audio = h.bind(void 0, 'audio');
h.b = h.bind(void 0, 'b');
h.bdi = h.bind(void 0, 'bdi');
h.bdo = h.bind(void 0, 'bdo');
h.blockquote = h.bind(void 0, 'blockquote');
h.br = h.bind(void 0, 'br');
h.button = h.bind(void 0, 'button');
h.canvas = h.bind(void 0, 'canvas');
h.caption = h.bind(void 0, 'caption');
h.cite = h.bind(void 0, 'cite');
h.code = h.bind(void 0, 'code');
h.col = h.bind(void 0, 'col');
h.colgroup = h.bind(void 0, 'colgroup');
h.data = h.bind(void 0, 'data');
h.datalist = h.bind(void 0, 'datalist');
h.dd = h.bind(void 0, 'dd');
h.del = h.bind(void 0, 'del');
h.dfn = h.bind(void 0, 'dfn');
h.div = h.bind(void 0, 'div');
h.dl = h.bind(void 0, 'dl');
h.dt = h.bind(void 0, 'dt');
h.em = h.bind(void 0, 'em');
h.embed = h.bind(void 0, 'embed');
h.fieldset = h.bind(void 0, 'fieldset');
h.figcaption = h.bind(void 0, 'figcaption');
h.figure = h.bind(void 0, 'figure');
h.footer = h.bind(void 0, 'footer');
h.form = h.bind(void 0, 'form');
h.h1 = h.bind(void 0, 'h1');
h.h2 = h.bind(void 0, 'h2');
h.h3 = h.bind(void 0, 'h3');
h.h4 = h.bind(void 0, 'h4');
h.h5 = h.bind(void 0, 'h5');
h.h6 = h.bind(void 0, 'h6');
h.header = h.bind(void 0, 'header');
h.hr = h.bind(void 0, 'hr');
h.i = h.bind(void 0, 'i');
h.iframe = h.bind(void 0, 'iframe');
h.img = h.bind(void 0, 'img');
h.input = h.bind(void 0, 'input');
h.ins = h.bind(void 0, 'ins');
h.kbd = h.bind(void 0, 'kbd');
h.label = h.bind(void 0, 'label');
h.legend = h.bind(void 0, 'legend');
h.li = h.bind(void 0, 'li');
h.main = h.bind(void 0, 'main');
h.map = h.bind(void 0, 'map');
h.mark = h.bind(void 0, 'mark');
h.meter = h.bind(void 0, 'meter');
h.nav = h.bind(void 0, 'nav');
h.noscript = h.bind(void 0, 'noscript');
h.object = h.bind(void 0, 'object');
h.ol = h.bind(void 0, 'ol');
h.optgroup = h.bind(void 0, 'optgroup');
h.option = h.bind(void 0, 'option');
h.output = h.bind(void 0, 'output');
h.p = h.bind(void 0, 'p');
h.param = h.bind(void 0, 'param');
h.pre = h.bind(void 0, 'pre');
h.progress = h.bind(void 0, 'progress');
h.q = h.bind(void 0, 'q');
h.rp = h.bind(void 0, 'rp');
h.rt = h.bind(void 0, 'rt');
h.ruby = h.bind(void 0, 'ruby');
h.s = h.bind(void 0, 's');
h.samp = h.bind(void 0, 'samp');
h.section = h.bind(void 0, 'section');
h.select = h.bind(void 0, 'select');
h.small = h.bind(void 0, 'small');
h.source = h.bind(void 0, 'source');
h.span = h.bind(void 0, 'span');
h.strong = h.bind(void 0, 'strong');
h.sub = h.bind(void 0, 'sub');
h.summary = h.bind(void 0, 'summary');
h.sup = h.bind(void 0, 'sup');
h.table = h.bind(void 0, 'table');
h.tbody = h.bind(void 0, 'tbody');
h.td = h.bind(void 0, 'td');
h.textarea = h.bind(void 0, 'textarea');
h.tfoot = h.bind(void 0, 'tfoot');
h.th = h.bind(void 0, 'th');
h.thead = h.bind(void 0, 'thead');
h.time = h.bind(void 0, 'time');
h.title = h.bind(void 0, 'title');
h.tr = h.bind(void 0, 'tr');
h.track = h.bind(void 0, 'track');
h.u = h.bind(void 0, 'u');
h.ul = h.bind(void 0, 'ul');
h.var_ = h.bind(void 0, 'var');
h.video = h.bind(void 0, 'video');
h.wbr = h.bind(void 0, 'wbr');
})(h = exports.h || (exports.h = {}));
/**
* Create a real DOM node from a virtual DOM node.
*
* @param content - The virtual DOM content to realize.
*
* @returns A new DOM node for the given virtual DOM tree.
*
* #### Notes
* The content node is assumed to be of the `'element'` type.
*
* This creates a brand new *real* DOM node with a structure which
* matches the given virtual DOM node.
*
* If virtual diffing is desired, use the `render` function instead.
*/
function realize(content) {
return Private.realizeImpl(content);
}
exports.realize = realize;
/**
* Render virtual DOM content into a host element.
*
* @param content - The virtual DOM content to render.
*
* @param host - The host element for the rendered content.
*
* #### Notes
* This renders the delta from the previous rendering. It assumes that
* the content of the host element is not manipulated by external code.
*
* Providing `null` content will clear the rendering.
*
* Externally modifying the provided content or the host element will
* result in undefined rendering behavior.
*/
function render(content, host) {
Private.renderImpl(content, host);
}
exports.render = render;
/**
* The namespace for the private module data.
*/
var Private;
(function (Private) {
/**
* Create a virtual text node for the given string.
*/
function createTextVNode(text) {
return new VNode('text', text, emptyObject, emptyArray);
}
Private.createTextVNode = createTextVNode;
/**
* Create a virtual element node for the given parameters.
*/
function createElementVNode(tag, attrs, children) {
attrs = attrs || emptyObject;
children = children || emptyArray;
return new VNode('element', tag, attrs, children);
}
Private.createElementVNode = createElementVNode;
/**
* The internal `realize` entry point.
*/
function realizeImpl(content) {
return createDOMNode(content);
}
Private.realizeImpl = realizeImpl;
/**
* The internal `render` entry point.
*/
function renderImpl(content, host) {
var oldContent = hostMap.get(host) || emptyArray;
var newContent = asVNodeArray(content);
hostMap.set(host, newContent);
updateContent(host, oldContent, newContent);
}
Private.renderImpl = renderImpl;
/**
* A shared frozen empty array.
*/
var emptyArray = Object.freeze([]);
/**
* A shared frozen empty object.
*/
var emptyObject = Object.freeze({});
/**
* A weak mapping of host element to virtual DOM content.
*/
var hostMap = new WeakMap();
/**
* Coerce content into a virtual node array.
*
* Null content will be coerced to an empty array.
*/
function asVNodeArray(content) {
if (content instanceof Array) {
return content;
}
if (content) {
return [content];
}
return emptyArray;
}
/**
* Update a host element with the delta of the virtual content.
*
* This is the core "diff" algorithm. There is no explicit "patch"
* phase. The host is patched at each step as the diff progresses.
*/
function updateContent(host, oldContent, newContent) {
// Bail early if the content is identical. This can occur when an
// node has no children or if the user is rendering cached content.
if (oldContent === newContent) {
return;
}
// Collect the old keyed elems into a mapping.
var oldKeyed = collectKeys(host, oldContent);
// Create a copy of the old content which can be modified in-place.
var oldCopy = oldContent.slice();
// Update the host with the new content. The diff always proceeds
// forward and never modifies a previously visited index. The old
// copy array is modified in-place to reflect the changes made to
// the host children. This causes the stale nodes to be pushed to
// the end of the host node and removed at the end of the loop.
var currNode = host.firstChild;
var newCount = newContent.length;
for (var i = 0; i < newCount; ++i) {
// If the old elems are exhausted, create a new node.
if (i >= oldCopy.length) {
host.appendChild(createDOMNode(newContent[i]));
continue;
}
// Cache a reference to the old and new elems.
var oldVNode = oldCopy[i];
var newVNode = newContent[i];
// If the new elem is keyed, move an old keyed elem to the proper
// location before proceeding with the diff. The search can start
// at the current index, since the unmatched old keyed elems are
// pushed forward in the old copy array.
var newKey = newVNode.attrs.key;
if (newKey && newKey in oldKeyed) {
var pair = oldKeyed[newKey];
if (pair.vNode !== oldVNode) {
arrayMove(oldCopy, oldCopy.indexOf(pair.vNode), i);
host.insertBefore(pair.element, currNode);
oldVNode = pair.vNode;
currNode = pair.element;
}
}
// If both elements are identical, there is nothing to do.
// This can occur when the user renders cached content.
if (oldVNode === newVNode) {
currNode = currNode.nextSibling;
continue;
}
// If the old elem is keyed and does not match the new elem key,
// create a new node. This is necessary since the old keyed elem
// may be matched at a later point in the diff.
var oldKey = oldVNode.attrs.key;
if (oldKey && oldKey !== newKey) {
arrayInsert(oldCopy, i, newVNode);
host.insertBefore(createDOMNode(newVNode), currNode);
continue;
}
// If the elements have different types, create a new node.
if (oldVNode.type !== newVNode.type) {
arrayInsert(oldCopy, i, newVNode);
host.insertBefore(createDOMNode(newVNode), currNode);
continue;
}
// If the element is a text node, update its text content.
if (newVNode.type === 'text') {
currNode.textContent = newVNode.tag;
currNode = currNode.nextSibling;
continue;
}
// At this point, the node is an 'element' type. If the tags
// are different, create a new node.
if (oldVNode.tag !== newVNode.tag) {
arrayInsert(oldCopy, i, newVNode);
host.insertBefore(createDOMNode(newVNode), currNode);
continue;
}
// The element tags match, update the element in place.
updateAttrs(currNode, oldVNode.attrs, newVNode.attrs);
updateContent(currNode, oldVNode.children, newVNode.children);
currNode = currNode.nextSibling;
}
// Dispose of the old nodes pushed to the end of the host.
for (var i = oldCopy.length - 1; i >= newCount; --i) {
host.removeChild(host.lastChild);
}
}
/**
* Add attributes to a newly created DOM node.
*/
function addAttrs(node, attrs) {
// Set the known attributes defined in the attr table.
for (var name_1 in attrs) {
var mode = attrModeTable[name_1];
if (mode === 0 /* Property */ || mode === 2 /* Event */) {
node[name_1] = attrs[name_1];
}
else if (mode === 1 /* Attribute */) {
node.setAttribute(name_1.toLowerCase(), attrs[name_1]);
}
}
// Handle the dataset values.
var dataset = attrs.dataset;
if (dataset) {
for (var name_2 in dataset) {
node.setAttribute("data-" + name_2, dataset[name_2]);
}
}
// Handle the inline styles.
var styles = attrs.style;
if (styles) {
var nodeStyle = node.style;
for (var name_3 in styles) {
nodeStyle[name_3] = styles[name_3];
}
}
}
/**
* Update the node attributes with the delta of attribute objects.
*/
function updateAttrs(node, oldAttrs, newAttrs) {
// Do nothing if the attrs are the same object.
if (oldAttrs === newAttrs) {
return;
}
// Remove attributes which no longer exist.
for (var name_4 in oldAttrs) {
if (!(name_4 in newAttrs)) {
var mode = attrModeTable[name_4];
if (mode === 0 /* Property */) {
node.removeAttribute(name_4);
}
else if (mode === 1 /* Attribute */) {
node.removeAttribute(name_4.toLowerCase());
}
else if (mode === 2 /* Event */) {
node[name_4] = null;
}
}
}
// Add new attributes an update existing ones.
for (var name_5 in newAttrs) {
var value = newAttrs[name_5];
if (oldAttrs[name_5] !== value) {
var mode = attrModeTable[name_5];
if (mode === 0 /* Property */ || mode === 2 /* Event */) {
node[name_5] = value;
}
else if (mode === 1 /* Attribute */) {
node.setAttribute(name_5.toLowerCase(), value);
}
}
}
// Handle the dataset values.
var oldDataset = oldAttrs.dataset || emptyObject;
var newDataset = newAttrs.dataset || emptyObject;
if (oldDataset !== newDataset) {
for (var name_6 in oldDataset) {
if (!(name_6 in newDataset)) {
node.removeAttribute('data-' + name_6);
}
}
for (var name_7 in newDataset) {
var value = newDataset[name_7];
if (oldDataset[name_7] !== value) {
node.setAttribute('data-' + name_7, value);
}
}
}
// Handle the inline styles.
var oldStyle = oldAttrs.style || emptyObject;
var newStyle = newAttrs.style || emptyObject;
if (oldStyle !== newStyle) {
var nodeStyle = node.style;
for (var name_8 in oldStyle) {
if (!(name_8 in newStyle)) {
nodeStyle[name_8] = '';
}
}
for (var name_9 in newStyle) {
var value = newStyle[name_9];
if (oldStyle[name_9] !== value) {
nodeStyle[name_9] = value;
}
}
}
}
/**
* Collect a mapping of keyed elements for the host content.
*/
function collectKeys(host, content) {
var node = host.firstChild;
var keyed = Object.create(null);
for (var i = 0, n = content.length; i < n; ++i) {
var vNode = content[i];
if (vNode.type === 'element') {
var key = vNode.attrs.key;
if (key)
keyed[key] = { vNode: vNode, element: node };
}
node = node.nextSibling;
}
return keyed;
}
/**
* Create and return a new DOM node for a virtual element.
*/
function createDOMNode(elem) {
var node;
if (elem.type === 'text') {
node = document.createTextNode(elem.tag);
}
else {
node = document.createElement(elem.tag);
addAttrs(node, elem.attrs);
addContent(node, elem.children);
}
return node;
}
/**
* Create and add child content to a newly created DOM node.
*/
function addContent(node, content) {
for (var i = 0, n = content.length; i < n; ++i) {
node.appendChild(createDOMNode(content[i]));
}
}
/**
* A mapping of attribute name to attribute mode.
*/
var attrModeTable = {
accept: 0 /* Property */,
acceptCharset: 0 /* Property */,
accessKey: 0 /* Property */,
action: 0 /* Property */,
allowFullscreen: 1 /* Attribute */,
alt: 0 /* Property */,
autocomplete: 0 /* Property */,
autofocus: 0 /* Property */,
autoplay: 0 /* Property */,
checked: 0 /* Property */,
cite: 0 /* Property */,
className: 0 /* Property */,
colSpan: 0 /* Property */,
cols: 0 /* Property */,
contentEditable: 0 /* Property */,
controls: 0 /* Property */,
coords: 0 /* Property */,
crossOrigin: 0 /* Property */,
data: 0 /* Property */,
dateTime: 0 /* Property */,
default: 0 /* Property */,
dir: 0 /* Property */,
dirName: 0 /* Property */,
disabled: 0 /* Property */,
download: 0 /* Property */,
draggable: 0 /* Property */,
enctype: 0 /* Property */,
form: 1 /* Attribute */,
formAction: 0 /* Property */,
formEnctype: 0 /* Property */,
formMethod: 0 /* Property */,
formNoValidate: 0 /* Property */,
formTarget: 0 /* Property */,
headers: 0 /* Property */,
height: 0 /* Property */,
hidden: 0 /* Property */,
high: 0 /* Property */,
href: 0 /* Property */,
hreflang: 0 /* Property */,
htmlFor: 0 /* Property */,
id: 0 /* Property */,
inputMode: 0 /* Property */,
isMap: 0 /* Property */,
kind: 0 /* Property */,
label: 0 /* Property */,
lang: 0 /* Property */,
list: 1 /* Attribute */,
loop: 0 /* Property */,
low: 0 /* Property */,
max: 0 /* Property */,
maxLength: 0 /* Property */,
media: 1 /* Attribute */,
mediaGroup: 0 /* Property */,
method: 0 /* Property */,
min: 0 /* Property */,
minLength: 0 /* Property */,
multiple: 0 /* Property */,
muted: 0 /* Property */,
name: 0 /* Property */,
noValidate: 0 /* Property */,
optimum: 0 /* Property */,
pattern: 0 /* Property */,
placeholder: 0 /* Property */,
poster: 0 /* Property */,
preload: 0 /* Property */,
readOnly: 0 /* Property */,
rel: 0 /* Property */,
required: 0 /* Property */,
reversed: 0 /* Property */,
rowSpan: 0 /* Property */,
rows: 0 /* Property */,
sandbox: 0 /* Property */,
scope: 0 /* Property */,
seamless: 1 /* Attribute */,
selected: 0 /* Property */,
shape: 0 /* Property */,
size: 0 /* Property */,
sizes: 1 /* Attribute */,
sorted: 0 /* Property */,
span: 0 /* Property */,
spellcheck: 0 /* Property */,
src: 0 /* Property */,
srcdoc: 0 /* Property */,
srclang: 0 /* Property */,
srcset: 1 /* Attribute */,
start: 0 /* Property */,
step: 0 /* Property */,
tabIndex: 0 /* Property */,
target: 0 /* Property */,
title: 0 /* Property */,
type: 0 /* Property */,
typeMustMatch: 0 /* Property */,
useMap: 0 /* Property */,
value: 0 /* Property */,
volume: 0 /* Property */,
width: 0 /* Property */,
wrap: 0 /* Property */,
onabort: 2 /* Event */,
onbeforecopy: 2 /* Event */,
onbeforecut: 2 /* Event */,
onbeforepaste: 2 /* Event */,
onblur: 2 /* Event */,
oncanplay: 2 /* Event */,
oncanplaythrough: 2 /* Event */,
onchange: 2 /* Event */,
onclick: 2 /* Event */,
oncontextmenu: 2 /* Event */,
oncopy: 2 /* Event */,
oncuechange: 2 /* Event */,
oncut: 2 /* Event */,
ondblclick: 2 /* Event */,
ondrag: 2 /* Event */,
ondragend: 2 /* Event */,
ondragenter: 2 /* Event */,
ondragleave: 2 /* Event */,
ondragover: 2 /* Event */,
ondragstart: 2 /* Event */,
ondrop: 2 /* Event */,
ondurationchange: 2 /* Event */,
onended: 2 /* Event */,
onemptied: 2 /* Event */,
onerror: 2 /* Event */,
onfocus: 2 /* Event */,
onhelp: 2 /* Event */,
oninput: 2 /* Event */,
onkeydown: 2 /* Event */,
onkeypress: 2 /* Event */,
onkeyup: 2 /* Event */,
onload: 2 /* Event */,
onloadeddata: 2 /* Event */,
onloadedmetadata: 2 /* Event */,
onloadstart: 2 /* Event */,
onmousedown: 2 /* Event */,
onmouseenter: 2 /* Event */,
onmouseleave: 2 /* Event */,
onmousemove: 2 /* Event */,
onmouseout: 2 /* Event */,
onmouseover: 2 /* Event */,
onmouseup: 2 /* Event */,
onmousewheel: 2 /* Event */,
onpaste: 2 /* Event */,
onpause: 2 /* Event */,
onplay: 2 /* Event */,
onplaying: 2 /* Event */,
onprogress: 2 /* Event */,
onratechange: 2 /* Event */,
onreadystatechange: 2 /* Event */,
onreset: 2 /* Event */,
onscroll: 2 /* Event */,
onseeked: 2 /* Event */,
onseeking: 2 /* Event */,
onselect: 2 /* Event */,
onselectstart: 2 /* Event */,
onstalled: 2 /* Event */,
onsubmit: 2 /* Event */,
onsuspend: 2 /* Event */,
ontimeupdate: 2 /* Event */,
onvolumechange: 2 /* Event */,
onwaiting: 2 /* Event */
};
/**
* Insert an element into an array at a specified index.
*/
function arrayInsert(array, i, value) {
for (var k = array.length; k > i; --k) {
array[k] = array[k - 1];
}
array[i] = value;
}
/**
* Move an element in an array from one index to another.
*/
function arrayMove(array, i, j) {
if (i === j) {
return;
}
var value = array[i];
var d = i < j ? 1 : -1;
for (var k = i; k !== j; k += d) {
array[k] = array[k + d];
}
array[j] = value;
}
})(Private || (Private = {}));
/***/ },
/* 58 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var signaling_1 = __webpack_require__(21);
var panel_1 = __webpack_require__(33);
var widget_1 = __webpack_require__(14);
var currentselection_1 = __webpack_require__(59);
var searching_1 = __webpack_require__(31);
/**
* The class name added to Collapse instances.
*/
var COLLAPSE_CLASS = 'p-Collapse';
/**
* The class name added to a Collapse's header.
*/
var COLLAPSE_HEADER_CLASS = 'p-Collapse-header';
/**
* The class name added to a Collapse's contents.
*/
var COLLAPSE_CONTENTS_CLASS = 'p-Collapse-contents';
/**
* The class name added to a Collapse when it is opened
*/
var COLLAPSE_CLASS_OPEN = 'p-Collapse-open';
/**
* A panel that supports a collapsible header, made from the widget's title.
* Clicking on the title expands or contracts the widget.
*/
var Collapse = (function (_super) {
__extends(Collapse, _super);
function Collapse(options) {
var _this = _super.call(this, options) || this;
_this.addClass(COLLAPSE_CLASS);
_this._header = new widget_1.Widget();
_this._header.addClass(COLLAPSE_HEADER_CLASS);
_this._header.node.addEventListener('click', _this);
_this._content = new panel_1.Panel();
_this._content.addClass(COLLAPSE_CONTENTS_CLASS);
var layout = new panel_1.PanelLayout();
_this.layout = layout;
layout.addWidget(_this._header);
layout.addWidget(_this._content);
if (options.widget) {
_this.widget = options.widget;
}
_this.collapsed = false;
return _this;
}
Collapse.prototype.dispose = function () {
if (this.isDisposed) {
return;
}
_super.prototype.dispose.call(this);
this._header = null;
this._widget = null;
this._content = null;
};
Object.defineProperty(Collapse.prototype, "widget", {
get: function () {
return this._widget;
},
set: function (widget) {
var oldWidget = this._widget;
if (oldWidget) {
oldWidget.disposed.disconnect(this._onChildDisposed, this);
oldWidget.title.changed.disconnect(this._onTitleChanged, this);
oldWidget.parent = null;
}
this._widget = widget;
widget.disposed.connect(this._onChildDisposed, this);
widget.title.changed.connect(this._onTitleChanged, this);
this._onTitleChanged(widget.title);
this._content.addWidget(widget);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Collapse.prototype, "collapsed", {
get: function () {
return this._collapsed;
},
set: function (value) {
// TODO: should we have this check here?
if (value === this._collapsed) {
return;
}
if (value) {
this._collapse();
}
else {
this._uncollapse();
}
},
enumerable: true,
configurable: true
});
Collapse.prototype.toggle = function () {
this.collapsed = !this.collapsed;
};
Collapse.prototype._collapse = function () {
this._collapsed = true;
if (this._content) {
this._content.hide();
}
this.removeClass(COLLAPSE_CLASS_OPEN);
this.collapseChanged.emit(void 0);
};
Collapse.prototype._uncollapse = function () {
this._collapsed = false;
if (this._content) {
this._content.show();
}
this.addClass(COLLAPSE_CLASS_OPEN);
this.collapseChanged.emit(void 0);
};
/**
* Handle the DOM events for the Collapse widget.
*
* @param event - The DOM event sent to the panel.
*
* #### Notes
* This method implements the DOM `EventListener` interface and is
* called in response to events on the panel's DOM node. It should
* not be called directly by user code.
*/
Collapse.prototype.handleEvent = function (event) {
switch (event.type) {
case 'click':
this._evtClick(event);
break;
default:
break;
}
};
Collapse.prototype._evtClick = function (event) {
this.toggle();
};
/**
* Handle the `changed` signal of a title object.
*/
Collapse.prototype._onTitleChanged = function (sender) {
this._header.node.textContent = this._widget.title.label;
};
Collapse.prototype._onChildDisposed = function (sender) {
this.dispose();
};
return Collapse;
}(widget_1.Widget));
exports.Collapse = Collapse;
// Define the signals for the `Widget` class.
signaling_1.defineSignal(Collapse.prototype, 'collapseChanged');
/**
* The class name added to Accordion instances.
*/
var ACCORDION_CLASS = 'p-Accordion';
/**
* The class name added to an Accordion child.
*/
var ACCORDION_CHILD_CLASS = 'p-Accordion-child';
var ACCORDION_CHILD_ACTIVE_CLASS = 'p-Accordion-child-active';
/**
* A panel that supports a collapsible header, made from the widget's title.
* Clicking on the title expands or contracts the widget.
*/
var Accordion = (function (_super) {
__extends(Accordion, _super);
function Accordion(options) {
var _this = _super.call(this, options) || this;
_this._selection = new currentselection_1.Selection(_this.widgets);
_this._selection.selectionChanged.connect(_this._onSelectionChanged, _this);
_this.addClass(ACCORDION_CLASS);
return _this;
}
Object.defineProperty(Accordion.prototype, "collapseWidgets", {
/**
* A read-only sequence of the widgets in the panel.
*
* #### Notes
* This is a read-only property.
*/
/* get widgets(): ISequence<Widget> {
return new ArraySequence(toArray(map((this.layout as PanelLayout).widgets, (w: Collapse) => w.widget)));
}
*/
get: function () {
return this.layout.widgets;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Accordion.prototype, "selection", {
get: function () {
return this._selection;
},
enumerable: true,
configurable: true
});
Accordion.prototype.indexOf = function (widget) {
return searching_1.findIndex(this.collapseWidgets, function (w) { return w.widget === widget; });
};
/**
* Add a widget to the end of the accordion.
*
* @param widget - The widget to add to the accordion.
*
* @returns The Collapse widget wrapping the added widget.
* #### Notes
* The widget will be wrapped in a CollapsedWidget.
*/
Accordion.prototype.addWidget = function (widget) {
var collapse = this._wrapWidget(widget);
collapse.collapsed = true;
_super.prototype.addWidget.call(this, collapse);
this._selection.adjustSelectionForInsert(this.widgets.length - 1, collapse);
return collapse;
};
/**
* Insert a widget at the specified index.
*
* @param index - The index at which to insert the widget.
*
* @param widget - The widget to insert into to the accordion.
*
* #### Notes
* If the widget is already contained in the panel, it will be moved.
*/
Accordion.prototype.insertWidget = function (index, widget) {
var collapse = this._wrapWidget(widget);
collapse.collapsed = true;
_super.prototype.insertWidget.call(this, index, collapse);
this._selection.adjustSelectionForInsert(index, collapse);
};
Accordion.prototype.removeWidget = function (widget) {
var index = this.indexOf(widget);
if (index >= 0) {
var collapse = this.collapseWidgets.at(index);
widget.parent = null;
collapse.dispose();
this._selection.adjustSelectionForRemove(index, null);
}
};
Accordion.prototype._wrapWidget = function (widget) {
var collapse = new Collapse({ widget: widget });
collapse.addClass(ACCORDION_CHILD_CLASS);
collapse.collapseChanged.connect(this._onCollapseChange, this);
return collapse;
};
Accordion.prototype._onCollapseChange = function (sender) {
if (!sender.collapsed) {
this._selection.value = sender;
}
else if (this._selection.value === sender && sender.collapsed) {
this._selection.value = null;
}
};
Accordion.prototype._onSelectionChanged = function (sender, change) {
// Collapse previous widget, open current widget
var pv = change.previousValue;
var cv = change.currentValue;
if (pv) {
pv.collapsed = true;
pv.removeClass(ACCORDION_CHILD_ACTIVE_CLASS);
}
if (cv) {
cv.collapsed = false;
cv.addClass(ACCORDION_CHILD_ACTIVE_CLASS);
}
};
return Accordion;
}(panel_1.Panel));
exports.Accordion = Accordion;
/***/ },
/* 59 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
Object.defineProperty(exports, "__esModule", { value: true });
/**
* A variety of convenience methods for maintaining a current selection
*/
var searching_1 = __webpack_require__(31);
var signaling_1 = __webpack_require__(21);
var Selection = (function () {
function Selection(sequence, options) {
if (options === void 0) { options = {}; }
this._sequence = null;
this._value = null;
this._previousValue = null;
this._sequence = sequence;
this._insertBehavior = options.insertBehavior || 'select-item-if-needed';
this._removeBehavior = options.removeBehavior || 'select-item-after';
}
/**
* Adjust for setting an item.
*
* This should be called *after* the set.
*
* @param index - The index set.
* @param oldValue - The old value at the index.
*/
Selection.prototype.adjustSelectionForSet = function (index) {
// We just need to send a signal if the currentValue changed.
// Get the current index and value.
var pi = this.index;
var pv = this.value;
// Exit early if this doesn't affect the selection
if (index !== pi) {
return;
}
this._updateSelectedValue();
var cv = this.value;
// The previous item is now null, since it is no longer in the array.
this._previousValue = null;
// Send signal if there was a change
if (pv !== cv) {
// Emit the current changed signal.
this.selectionChanged.emit({
previousIndex: pi, previousValue: pv,
currentIndex: pi, currentValue: cv
});
}
};
Object.defineProperty(Selection.prototype, "value", {
/**
* Get the currently selected item.
*
* #### Notes
* This will be `null` if no item is selected.
*/
get: function () {
return this._value;
},
/**
* Set the currently selected item.
*
* #### Notes
* If the item does not exist in the vector, the currentValue will be set to
* `null`. This selects the first entry equal to the desired item.
*/
set: function (value) {
if (value === null) {
this.index = -1;
}
else {
this.index = searching_1.indexOf(this._sequence, value);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Selection.prototype, "index", {
/**
* Get the index of the currently selected item.
*
* #### Notes
* This will be `-1` if no item is selected.
*/
get: function () {
return this._index;
},
/**
* Set the index of the currently selected tab.
*
* @param index - The index to select.
*
* #### Notes
* If the value is out of range, the index will be set to `-1`, which
* indicates no item is selected.
*/
set: function (index) {
// Coerce the value to an index.
var i = Math.floor(index);
if (i < 0 || i >= this._sequence.length) {
i = -1;
}
// Bail early if the index will not change.
if (this._index === i) {
return;
}
// Look up the previous index and item.
var pi = this._index;
var pv = this._value;
// Update the state
this._index = i;
this._updateSelectedValue();
this._previousValue = pv;
// Emit the current changed signal.
this.selectionChanged.emit({
previousIndex: pi, previousValue: pv,
currentIndex: i, currentValue: this._value
});
},
enumerable: true,
configurable: true
});
Object.defineProperty(Selection.prototype, "insertBehavior", {
/**
* Get the selection behavior when inserting a tab.
*/
get: function () {
return this._insertBehavior;
},
/**
* Set the selection behavior when inserting a tab.
*/
set: function (value) {
this._insertBehavior = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Selection.prototype, "removeBehavior", {
/**
* Get the selection behavior when removing a tab.
*/
get: function () {
return this._removeBehavior;
},
/**
* Set the selection behavior when removing a tab.
*/
set: function (value) {
this._removeBehavior = value;
},
enumerable: true,
configurable: true
});
/**
* Adjust the current index for a tab insert operation.
*
* @param i - The new index of the inserted item.
* @param j - The inserted item.
*
* #### Notes
* This method accounts for the tab bar's insertion behavior when adjusting
* the current index and emitting the changed signal. This should be called
* after the insertion.
*/
Selection.prototype.adjustSelectionForInsert = function (i, item) {
// Lookup commonly used variables.
var cv = this._value;
var ci = this._index;
var bh = this._insertBehavior;
// Handle the behavior where the new item is always selected,
// or the behavior where the new item is selected if needed.
if (bh === 'select-item' || (bh === 'select-item-if-needed' && ci === -1)) {
this._index = i;
this._value = item;
this._previousValue = cv;
this.selectionChanged.emit({
previousIndex: ci, previousValue: cv,
currentIndex: i, currentValue: item
});
return;
}
// Otherwise, silently adjust the current index if needed.
if (ci >= i) {
this._index++;
}
};
/**
* Adjust the current index for move operation.
*
* @param i - The previous index of the item.
* @param j - The new index of the item.
*
* #### Notes
* This method will not cause the actual current item to change. It silently
* adjusts the current index to account for the given move.
*/
Selection.prototype.adjustSelectionForMove = function (i, j) {
if (this._index === i) {
this._index = j;
}
else if (this._index < i && this._index >= j) {
this._index++;
}
else if (this._index > i && this._index <= j) {
this._index--;
}
};
/**
* Clear the selection and history.
*/
Selection.prototype.clearSelection = function () {
// Get the current index and item.
var pi = this._index;
var pv = this._value;
// Reset the current index and previous item.
this._index = -1;
this._value = null;
this._previousValue = null;
// If no item was selected, there's nothing else to do.
if (pi === -1) {
return;
}
// Emit the current changed signal.
this.selectionChanged.emit({
previousIndex: pi, previousValue: pv,
currentIndex: -1, currentValue: null
});
};
/**
* Adjust the current index for an item remove operation.
*
* @param i - The former index of the removed item.
* @param item - The removed item.
*
* #### Notes
* This method accounts for the remove behavior when adjusting the current
* index and emitting the changed signal. It should be called after the item
* is removed.
*/
Selection.prototype.adjustSelectionForRemove = function (i, item) {
// Lookup commonly used variables.
var ci = this._index;
var bh = this._removeBehavior;
// Silently adjust the index if the current item is not removed.
if (ci !== i) {
if (ci > i) {
this._index--;
}
return;
}
// No item gets selected if the vector is empty.
if (this._sequence.length === 0) {
// Reset the current index and previous item.
this._index = -1;
this._value = null;
this._previousValue = null;
this.selectionChanged.emit({
previousIndex: i, previousValue: item,
currentIndex: -1, currentValue: null
});
return;
}
// Handle behavior where the next sibling item is selected.
if (bh === 'select-item-after') {
this._index = Math.min(i, this._sequence.length - 1);
this._updateSelectedValue();
this._previousValue = null;
this.selectionChanged.emit({
previousIndex: i, previousValue: item,
currentIndex: this._index, currentValue: this._value
});
return;
}
// Handle behavior where the previous sibling item is selected.
if (bh === 'select-item-before') {
this._index = Math.max(0, i - 1);
this._updateSelectedValue();
this._previousValue = null;
this.selectionChanged.emit({
previousIndex: i, previousValue: item,
currentIndex: this._index, currentValue: this._value
});
return;
}
// Handle behavior where the previous history item is selected.
if (bh === 'select-previous-item') {
if (this._previousValue) {
this.value = this._previousValue;
}
else {
this._index = Math.min(i, this._sequence.length - 1);
this._updateSelectedValue();
}
this._previousValue = null;
this.selectionChanged.emit({
previousIndex: i, previousValue: item,
currentIndex: this._index, currentValue: this.value
});
return;
}
// Otherwise, no item gets selected.
this._index = -1;
this._value = null;
this._previousValue = null;
this.selectionChanged.emit({
previousIndex: i, previousValue: item,
currentIndex: -1, currentValue: null
});
};
/**
* Set the current value based on the current index.
*/
Selection.prototype._updateSelectedValue = function () {
var i = this._index;
this._value = i !== -1 ? this._sequence.at(i) : null;
};
return Selection;
}());
exports.Selection = Selection;
// Define the signals for the `TabBar` class.
signaling_1.defineSignal(Selection.prototype, 'selectionChanged');
/***/ },
/* 60 */
/***/ function(module, exports) {
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var save_state = function() {
return new Promise(function(resolve) {
requirejs(["base/js/namespace"], function(Jupyter) {
return Jupyter.WidgetManager._managers[0].get_state({
'drop_defaults': true
}).then(function(state) {
var data = "text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(state, null, " "));
var a = document.createElement("a");
a.download = "widget_state.json";
a.href = "data:" + data;
a.click();
});
});
});
};
var action = {
help: 'Download the widget state as a JSON file',
icon: 'fa-sliders',
help_index : 'zz',
handler : save_state
};
var action_name = 'save-widget-state';
var prefix = 'widgets';
requirejs(["base/js/namespace"], function(Jupyter) {
Jupyter.notebook.keyboard_manager.actions.register(action, action_name, prefix);
});
module.exports = {action: action};
/***/ },
/* 61 */
/***/ function(module, exports) {
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var embed_widgets = function() {
return new Promise(function(resolve) {
requirejs(['base/js/namespace', 'base/js/dialog', 'jupyter-js-widgets'], function(Jupyter, dialog, widgets) {
Jupyter.WidgetManager._managers[0].get_state({
'drop_defaults': true
}).then(function(state) {
var data = JSON.stringify({
version_major: 1,
version_minor: 0,
state: state
}, null, ' ');
var value = '<script src="https://unpkg.com/jupyter-js-widgets@~' + widgets.version + '/dist/embed.js"></script>\n' +
'<script type="application/vnd.jupyter.widget-state+json">\n' + data + '\n</script>';
var cells = Jupyter.notebook.get_cells();
for (var i = 0; i<cells.length; ++i) {
var current_cell = cells[i];
if (current_cell.widgetarea && current_cell.widgetarea.widget_views) {
for (var j=0; j!=current_cell.widgetarea.widget_views.length; ++j) {
value += '\n<script type="application/vnd.jupyter.widget-view+json">\n' +
JSON.stringify({ model_id : current_cell.widgetarea.widget_views[j].model.id }, null, ' ') +
'\n</script>';
}
}
}
var content = document.createElement('textarea');
content.setAttribute('readonly', 'true');
content.style.width = '100%';
content.style.minHeight = '250px';
content.value = value;
var mod = dialog.modal({
show: true,
title: 'Embed widgets',
body: content,
keyboard_manager: Jupyter.notebook.keyboard_manager,
notebook: Jupyter.notebook,
buttons: {
'Copy to Clipboard': {
class: 'btn-primary',
click: function(event) {
content.select();
return document.execCommand('copy');
}
}
}
});
});
});
});
};
var action = {
help: 'Embed interactive widgets',
icon: 'fa-sliders',
help_index : 'zz',
handler : embed_widgets
};
var action_name = 'embed-interactive-widgets';
var prefix = 'widgets';
requirejs(["base/js/namespace"], function(Jupyter) {
Jupyter.notebook.keyboard_manager.actions.register(action, action_name, prefix);
});
module.exports = {
action: action
};
/***/ },
/* 62 */
/***/ function(module, exports) {
module.exports = {
"name": "widgetsnbextension",
"version": "2.0.18",
"description": "Jupyter Widgets nbextension",
"main": "src/extension.js",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "npm run clean && webpack",
"clean": "rimraf widgetsnbextension/static",
"update": "rimraf node_modules/jupyter-js-widgets && npm install file:../jupyter-js-widgets && npm run build",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ipython/ipywidgets.git"
},
"author": "Jupyter Project",
"license": "BSD-3-Clause",
"bugs": {
"url": "https://github.com/ipython/ipywidgets/issues"
},
"homepage": "https://github.com/ipython/ipywidgets#readme",
"dependencies": {
"backbone": "^1.2.3",
"jupyter-js-widgets": "file:../jupyter-js-widgets",
"underscore": "^1.8.3"
},
"devDependencies": {
"css-loader": "^0.23.1",
"json-loader": "^0.5.4",
"postcss-cssnext": "^2.8.0",
"postcss-import": "^8.1.2",
"postcss-loader": "^1.1.0",
"rimraf": "^2.5.1",
"style-loader": "^0.13.0",
"webpack": "^1.12.12"
}
};
/***/ },
/* 63 */
/***/ function(module, exports, __webpack_require__) {
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
// This widget is strongly coupled to the notebook because of the outputarea
// dependency.
var widgets = __webpack_require__(5);
var _ = __webpack_require__(2);
var OutputModel = widgets.DOMWidgetModel.extend({
defaults: _.extend({}, widgets.DOMWidgetModel.prototype.defaults, {
_model_name: "OutputModel",
_view_name: "OutputView",
msg_id: "",
}),
initialize: function(attributes, options) {
OutputModel.__super__.initialize.apply(this, arguments);
this.kernel = this.comm.kernel;
this.listenTo(this, 'change:msg_id', this.reset_msg_id);
console.log('initializing model');
if (this.kernel) {
this.kernel.set_callbacks_for_msg(this.id, this.callbacks(), false);
}
this._outputs = [];
},
// make callbacks
callbacks: function() {
return {
iopub: {
output: function(msg) {
this.trigger('new_message', msg);
this._outputs.push(msg);
}.bind(this),
clear_output: function(msg) {
this.trigger('clear_output', msg);
this._outputs = [];
}.bind(this)
}
}
},
reset_msg_id: function() {
var kernel = this.kernel;
// Pop previous message id
var prev_msg_id = this.previous('msg_id');
if (prev_msg_id && kernel) {
var previous_callback = kernel.output_callback_overrides_pop(prev_msg_id);
if (previous_callback !== this.id) {
console.error('Popped wrong message ('+previous_callback+' instead of '+this.id+') - likely the stack was not maintained in kernel.');
}
}
var msg_id = this.get('msg_id');
if (msg_id && kernel) {
kernel.output_callback_overrides_push(msg_id, this.id);
}
},
});
var OutputView = widgets.DOMWidgetView.extend({
initialize: function (parameters) {
OutputView.__super__.initialize.apply(this, arguments);
},
render: function(){
var that = this;
var renderOutput = function(outputArea) {
that.output_area = new outputArea.OutputArea({
selector: that.el,
config: that.options.cell.config,
prompt_area: false,
events: that.model.widget_manager.notebook.events,
keyboard_manager: that.model.widget_manager.keyboard_manager });
that.listenTo(that.model, 'new_message', function(msg) {
console.log('View new output message');
console.log(msg);
that.output_area.handle_output(msg);
}, that);
that.listenTo(that.model, 'clear_output', function(msg) {
console.log('View clear output');
console.log(msg);
that.output_area.handle_clear_output(msg);
})
// Render initial contents from that.model._outputs
that.model._outputs.forEach(function(msg) {
that.output_area.handle_output(msg);
}, that)
}
if (requirejs.defined("notebook/js/outputarea")) {
// Notebook 4.x
requirejs(["notebook/js/outputarea"], renderOutput)
} else {
// Notebook 5.x
requirejs(["notebook"], function(notebookApp) {
var outputArea = notebookApp["notebook/js/outputarea"];
renderOutput(outputArea);
});
}
},
});
module.exports = {
OutputView: OutputView,
OutputModel: OutputModel,
};
/***/ },
/* 64 */
/***/ function(module, exports, __webpack_require__) {
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
__webpack_require__(65);
var messaging = __webpack_require__(16);
var pwidgets = __webpack_require__(14);
/**
* WidgetArea
*/
var WidgetArea = function(cell) {
this.widget_views = [];
this._cell = cell;
this._widgets_live = true;
this._create_elements();
requirejs(['base/js/events'], (function(events) {
events.trigger('create.WidgetArea', {widgetarea: this, cell: cell});
}).bind(this));
};
/**
* Display a widget view in the cell.
*/
WidgetArea.prototype.display_widget_view = function(view_promise) {
// Display a dummy element
var dummy = document.createElement('div');
this.widget_subarea.appendChild(dummy);
// Display the view.
var that = this;
return view_promise.then(function(view) {
that.widget_area.style.display = '';
// Do basically the same as Phosphor's Widget.attach, except we replace
// a child rather than appending the view's Phosphor widget
dummy.parentNode.replaceChild(view.pWidget.node, dummy);
messaging.sendMessage(view.pWidget, pwidgets.WidgetMessage.AfterAttach)
that.widget_views.push(view);
// Check the live state of the view's model.
if (view.model.comm_live) {
that._widget_live(view);
} else {
that.disconnect(view);
}
// If the view is removed, check to see if the widget area is empty.
// If the widget area is empty, close it.
view.on('remove', function() {
var index = that.widget_views.indexOf(view);
if (index !== -1) that.widget_views.splice(index, 1);
if (that.widget_views.length === 0) {
that.clear();
}
});
return view;
});
};
/**
* Creates the elements of the widget area and appends them
* to the associated cell.
*/
WidgetArea.prototype._create_elements = function() {
var widget_area = document.createElement('div');
widget_area.classList.add('widget-area');
widget_area.style.display = 'none';
this.widget_area = widget_area;
var widget_prompt = document.createElement('div');
widget_prompt.classList.add('prompt');
widget_area.appendChild(widget_prompt);
var widget_subarea = document.createElement('div');
widget_subarea.classList.add('widget-subarea');
widget_subarea.classList.add('jp-Output-result');
widget_area.appendChild(widget_subarea);
this.widget_subarea = widget_subarea;
var that = this;
var widget_clear_button = document.createElement('button');
widget_clear_button.classList.add('close');
widget_clear_button.innerHTML = '×';
widget_clear_button.onclick = function() {
for (var i = 0; i < that.widget_views.length; i++) {
var view = that.widget_views[i];
view.remove();
}
that.widget_views = [];
widget_subarea.innerHTML = '';
}
widget_prompt.appendChild(widget_clear_button);
if (this._cell.input) {
this._cell.input.after(widget_area);
} else {
throw new Error('Cell does not have an `input` element. Is it not a CodeCell?');
}
};
/**
* Handles when a widget loses it's comm connection.
* @param {WidgetView} view
*/
WidgetArea.prototype.disconnect = function() {
if (this._widgets_live) {
this._widgets_live = false;
this.widget_area.classList.add('connection-problems');
}
};
/**
* Sends resize message to all child views
*/
WidgetArea.prototype.resize = function() {
this.widget_views.forEach(function(view) {
messaging.sendMessage(view.pWidget, pwidgets.ResizeMessage.UnknownSize);
});
}
/**
* Handles when a widget is connected to a live comm.
*/
WidgetArea.prototype._widget_live = function() {
if (!this._widgets_live) {
// Check that the other widgets are live too. O(N) operation.
// Abort the function at the first dead widget found.
for (var i = 0; i < this.widget_views.length; i++) {
if (!this.widget_views[i].model.comm_live) {
return;
}
}
this._widgets_live = true;
this.widget_area.classList.remove('connection-problems');
}
};
/**
* Clears the widgets in the widget area.
*/
WidgetArea.prototype.clear = function() {
// Clear widget area
for (var i = 0; i < this.widget_views.length; i++) {
var view = this.widget_views[i];
view.remove();
}
this.widget_views = [];
this.widget_subarea.innerHTML = '';
this.widget_subarea.style.height = '';
this.widget_area.style.height = '';
this.widget_area.style.display = 'none';
};
module.exports = {
WidgetArea: WidgetArea
};
/***/ },
/* 65 */
/***/ function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(66);
if(typeof content === 'string') content = [[module.id, content, '']];
// add the styles to the DOM
var update = __webpack_require__(68)(content, {});
if(content.locals) module.exports = content.locals;
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../node_modules/css-loader/index.js!../node_modules/postcss-loader/index.js!./outputarea.css", function() {
var newContent = __webpack_require__(66);
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ },
/* 66 */
/***/ function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(67)();
// imports
// module
exports.push([module.id, "/*\n +------------------------------------------+\n | widget-area |\n | +--------+---------------------------+ |\n | | prompt | widget-subarea | |\n | | | +-----------------------+ | |\n | | | | widget | | |\n | | | +-----------------------+ | |\n | | | +-----------------------+ | |\n | | | | widget | | |\n | | | +-----------------------+ | |\n | +--------+---------------------------+ |\n +------------------------------------------+\n*/\n\n.widget-area {\n\tpage-break-inside : avoid;\n display: flex;\n flex-direction: row;\n align-items: stretch;\n}\n\n.widget-area.connection-problems .prompt:after {\n content: \"\\f127\"; /* chain-broken */\n font-family: \"FontAwesome\";\n color: #d9534f;\n top: 3px;\n padding: 3px;\n}\n\n.widget-area .widget-subarea {\n min-width: 0px;\n padding: 0.4em 0 0.4em 0;\n display: flex;\n flex: 2;\n align-items: flex-start;\n flex-direction: column;\n align-items: stretch;\n box-sizing: border-box;\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n}\n", ""]);
// exports
/***/ },
/* 67 */
/***/ function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function() {
var list = [];
// return the list of modules as css string
list.toString = function toString() {
var result = [];
for(var i = 0; i < this.length; i++) {
var item = this[i];
if(item[2]) {
result.push("@media " + item[2] + "{" + item[1] + "}");
} else {
result.push(item[1]);
}
}
return result.join("");
};
// import a list of modules into the list
list.i = function(modules, mediaQuery) {
if(typeof modules === "string")
modules = [[null, modules, ""]];
var alreadyImportedModules = {};
for(var i = 0; i < this.length; i++) {
var id = this[i][0];
if(typeof id === "number")
alreadyImportedModules[id] = true;
}
for(i = 0; i < modules.length; i++) {
var item = modules[i];
// skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
if(mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if(mediaQuery) {
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
}
list.push(item);
}
}
};
return list;
};
/***/ },
/* 68 */
/***/ function(module, exports, __webpack_require__) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var stylesInDom = {},
memoize = function(fn) {
var memo;
return function () {
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
return memo;
};
},
isOldIE = memoize(function() {
return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase());
}),
getHeadElement = memoize(function () {
return document.head || document.getElementsByTagName("head")[0];
}),
singletonElement = null,
singletonCounter = 0,
styleElementsInsertedAtTop = [];
module.exports = function(list, options) {
if(false) {
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
}
options = options || {};
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (typeof options.singleton === "undefined") options.singleton = isOldIE();
// By default, add <style> tags to the bottom of <head>.
if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
var styles = listToStyles(list);
addStylesToDom(styles, options);
return function update(newList) {
var mayRemove = [];
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
domStyle.refs--;
mayRemove.push(domStyle);
}
if(newList) {
var newStyles = listToStyles(newList);
addStylesToDom(newStyles, options);
}
for(var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i];
if(domStyle.refs === 0) {
for(var j = 0; j < domStyle.parts.length; j++)
domStyle.parts[j]();
delete stylesInDom[domStyle.id];
}
}
};
}
function addStylesToDom(styles, options) {
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
if(domStyle) {
domStyle.refs++;
for(var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j]);
}
for(; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j], options));
}
} else {
var parts = [];
for(var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j], options));
}
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
}
}
}
function listToStyles(list) {
var styles = [];
var newStyles = {};
for(var i = 0; i < list.length; i++) {
var item = list[i];
var id = item[0];
var css = item[1];
var media = item[2];
var sourceMap = item[3];
var part = {css: css, media: media, sourceMap: sourceMap};
if(!newStyles[id])
styles.push(newStyles[id] = {id: id, parts: [part]});
else
newStyles[id].parts.push(part);
}
return styles;
}
function insertStyleElement(options, styleElement) {
var head = getHeadElement();
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
if (options.insertAt === "top") {
if(!lastStyleElementInsertedAtTop) {
head.insertBefore(styleElement, head.firstChild);
} else if(lastStyleElementInsertedAtTop.nextSibling) {
head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
} else {
head.appendChild(styleElement);
}
styleElementsInsertedAtTop.push(styleElement);
} else if (options.insertAt === "bottom") {
head.appendChild(styleElement);
} else {
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
}
}
function removeStyleElement(styleElement) {
styleElement.parentNode.removeChild(styleElement);
var idx = styleElementsInsertedAtTop.indexOf(styleElement);
if(idx >= 0) {
styleElementsInsertedAtTop.splice(idx, 1);
}
}
function createStyleElement(options) {
var styleElement = document.createElement("style");
styleElement.type = "text/css";
insertStyleElement(options, styleElement);
return styleElement;
}
function createLinkElement(options) {
var linkElement = document.createElement("link");
linkElement.rel = "stylesheet";
insertStyleElement(options, linkElement);
return linkElement;
}
function addStyle(obj, options) {
var styleElement, update, remove;
if (options.singleton) {
var styleIndex = singletonCounter++;
styleElement = singletonElement || (singletonElement = createStyleElement(options));
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
} else if(obj.sourceMap &&
typeof URL === "function" &&
typeof URL.createObjectURL === "function" &&
typeof URL.revokeObjectURL === "function" &&
typeof Blob === "function" &&
typeof btoa === "function") {
styleElement = createLinkElement(options);
update = updateLink.bind(null, styleElement);
remove = function() {
removeStyleElement(styleElement);
if(styleElement.href)
URL.revokeObjectURL(styleElement.href);
};
} else {
styleElement = createStyleElement(options);
update = applyToTag.bind(null, styleElement);
remove = function() {
removeStyleElement(styleElement);
};
}
update(obj);
return function updateStyle(newObj) {
if(newObj) {
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
return;
update(obj = newObj);
} else {
remove();
}
};
}
var replaceText = (function () {
var textStore = [];
return function (index, replacement) {
textStore[index] = replacement;
return textStore.filter(Boolean).join('\n');
};
})();
function applyToSingletonTag(styleElement, index, remove, obj) {
var css = remove ? "" : obj.css;
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = styleElement.childNodes;
if (childNodes[index]) styleElement.removeChild(childNodes[index]);
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index]);
} else {
styleElement.appendChild(cssNode);
}
}
}
function applyToTag(styleElement, obj) {
var css = obj.css;
var media = obj.media;
if(media) {
styleElement.setAttribute("media", media)
}
if(styleElement.styleSheet) {
styleElement.styleSheet.cssText = css;
} else {
while(styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild);
}
styleElement.appendChild(document.createTextNode(css));
}
}
function updateLink(linkElement, obj) {
var css = obj.css;
var sourceMap = obj.sourceMap;
if(sourceMap) {
// http://stackoverflow.com/a/26603875
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
}
var blob = new Blob([css], { type: "text/css" });
var oldSrc = linkElement.href;
linkElement.href = URL.createObjectURL(blob);
if(oldSrc)
URL.revokeObjectURL(oldSrc);
}
/***/ },
/* 69 */
/***/ function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(70);
if(typeof content === 'string') content = [[module.id, content, '']];
// add the styles to the DOM
var update = __webpack_require__(68)(content, {});
if(content.locals) module.exports = content.locals;
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../css-loader/index.js!../../postcss-loader/index.js!./base.css", function() {
var newContent = __webpack_require__(70);
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ },
/* 70 */
/***/ function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(67)();
// imports
// module
exports.push([module.id, "/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2016, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/*-----------------------------------------------------------------------------\n| dom/cursor\n|----------------------------------------------------------------------------*/\nbody.p-mod-override-cursor * {\n cursor: inherit !important;\n}\n\n\n/*-----------------------------------------------------------------------------\n| ui/widget\n|----------------------------------------------------------------------------*/\n.p-Widget {\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n cursor: default;\n}\n\n\n.p-Widget.p-mod-hidden {\n display: none;\n}\n\n\n/*-----------------------------------------------------------------------------\n| ui/commandpalette\n|----------------------------------------------------------------------------*/\n.p-CommandPalette {\n display: flex;\n flex-direction: column;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n\n.p-CommandPalette-search {\n flex: 0 0 auto;\n}\n\n\n.p-CommandPalette-content {\n flex: 1 1 auto;\n margin: 0;\n padding: 0;\n min-height: 0;\n overflow: auto;\n list-style-type: none;\n}\n\n\n.p-CommandPalette-header {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n text-transform: capitalize;\n}\n\n\n.p-CommandPalette-itemShortcut {\n float: right;\n}\n\n\n.p-CommandPalette-itemLabel {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n\n/*-----------------------------------------------------------------------------\n| ui/menu\n|----------------------------------------------------------------------------*/\n.p-Menu {\n position: absolute;\n white-space: nowrap;\n overflow-x: hidden;\n overflow-y: auto;\n outline: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n\n.p-Menu-content {\n margin: 0;\n padding: 0;\n display: table;\n list-style-type: none;\n}\n\n\n.p-Menu-item {\n display: table-row;\n}\n\n\n.p-Menu-item.p-mod-hidden {\n display: none;\n}\n\n\n.p-Menu-itemIcon,\n.p-Menu-itemSubmenuIcon {\n display: table-cell;\n text-align: center;\n}\n\n\n.p-Menu-itemLabel {\n display: table-cell;\n text-align: left;\n}\n\n\n.p-Menu-itemShortcut {\n display: table-cell;\n text-align: right;\n}\n\n\n/*-----------------------------------------------------------------------------\n| ui/menubar\n|----------------------------------------------------------------------------*/\n.p-MenuBar {\n outline: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n\n.p-MenuBar-content {\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: row;\n list-style-type: none;\n}\n\n\n.p-MenuBar-item {\n box-sizing: border-box;\n}\n\n\n.p-MenuBar-itemIcon,\n.p-MenuBar-itemLabel {\n display: inline-block;\n}\n\n\n/*-----------------------------------------------------------------------------\n| ui/splitpanel\n|----------------------------------------------------------------------------*/\n.p-SplitPanel-child {\n z-index: 0;\n}\n\n\n.p-SplitPanel-handle {\n z-index: 1;\n}\n\n\n.p-SplitPanel-handle.p-mod-hidden {\n display: none;\n}\n\n\n.p-SplitPanel-handle:after {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n content: '';\n}\n\n\n.p-SplitPanel.p-mod-horizontal > .p-SplitPanel-handle {\n cursor: ew-resize;\n}\n\n\n.p-SplitPanel.p-mod-vertical > .p-SplitPanel-handle {\n cursor: ns-resize;\n}\n\n\n.p-SplitPanel.p-mod-horizontal > .p-SplitPanel-handle:after {\n left: 50%;\n min-width: 8px;\n transform: translateX(-50%);\n}\n\n\n.p-SplitPanel.p-mod-vertical > .p-SplitPanel-handle:after {\n top: 50%;\n min-height: 8px;\n transform: translateY(-50%);\n}\n\n\n/*-----------------------------------------------------------------------------\n| ui/tabbar\n|----------------------------------------------------------------------------*/\n.p-TabBar {\n display: flex;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n\n.p-TabBar.p-mod-horizontal {\n flex-direction: row;\n}\n\n\n.p-TabBar.p-mod-vertical {\n flex-direction: column;\n}\n\n\n.p-TabBar-content {\n margin: 0;\n padding: 0;\n display: flex;\n flex: 1 1 auto;\n list-style-type: none;\n}\n\n\n.p-TabBar.p-mod-horizontal > .p-TabBar-content {\n flex-direction: row;\n}\n\n\n.p-TabBar.p-mod-vertical > .p-TabBar-content {\n flex-direction: column;\n}\n\n\n.p-TabBar-tab {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n overflow: hidden;\n}\n\n\n.p-TabBar-tabIcon,\n.p-TabBar-tabCloseIcon {\n flex: 0 0 auto;\n}\n\n\n.p-TabBar-tabLabel {\n flex: 1 1 auto;\n overflow: hidden;\n white-space: nowrap;\n}\n\n\n.p-TabBar-tab.p-mod-hidden {\n display: none;\n}\n\n\n.p-TabBar.p-mod-dragging .p-TabBar-tab {\n position: relative;\n}\n\n\n.p-TabBar.p-mod-horizontal.p-mod-dragging .p-TabBar-tab {\n left: 0;\n transition: left 150ms ease;\n}\n\n\n.p-TabBar.p-mod-vertical.p-mod-dragging .p-TabBar-tab {\n top: 0;\n transition: top 150ms ease;\n}\n\n\n.p-TabBar.p-mod-dragging .p-TabBar-tab.p-mod-dragging {\n transition: none;\n}\n\n\n/*-----------------------------------------------------------------------------\n| ui/tabpanel\n|----------------------------------------------------------------------------*/\n.p-TabPanel-tabBar {\n z-index: 1;\n}\n\n\n.p-TabPanel-stackedPanel {\n z-index: 0;\n}\n\n\n/*-----------------------------------------------------------------------------\n| ui/dockpanel\n|----------------------------------------------------------------------------*/\n.p-DockPanel {\n z-index: 0;\n}\n\n\n.p-DockPanel-widget {\n z-index: 0;\n}\n\n\n.p-DockPanel-tabBar {\n z-index: 1;\n}\n\n\n.p-DockPanel-handle {\n z-index: 2;\n}\n\n\n.p-DockPanel-handle.p-mod-hidden {\n display: none;\n}\n\n\n.p-DockPanel-handle:after {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n content: '';\n}\n\n\n.p-DockPanel-handle.p-mod-horizontal {\n cursor: ew-resize;\n}\n\n\n.p-DockPanel-handle.p-mod-vertical {\n cursor: ns-resize;\n}\n\n\n.p-DockPanel-handle.p-mod-horizontal:after {\n left: 50%;\n min-width: 8px;\n transform: translateX(-50%);\n}\n\n\n.p-DockPanel-handle.p-mod-vertical:after {\n top: 50%;\n min-height: 8px;\n transform: translateY(-50%);\n}\n\n\n.p-DockPanel-overlay {\n z-index: 3;\n box-sizing: border-box;\n pointer-events: none;\n}\n\n\n.p-DockPanel-overlay.p-mod-hidden {\n display: none;\n}\n", ""]);
// exports
/***/ },
/* 71 */
/***/ function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(72);
if(typeof content === 'string') content = [[module.id, content, '']];
// add the styles to the DOM
var update = __webpack_require__(68)(content, {});
if(content.locals) module.exports = content.locals;
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../css-loader/index.js!../../postcss-loader/index.js!./widgets.css", function() {
var newContent = __webpack_require__(72);
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ },
/* 72 */
/***/ function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(67)();
// imports
// module
exports.push([module.id, "/* Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\n/* We import all of these together in a single css file because the Webpack\nloader sees only one file at a time. This allows postcss to see the variable\ndefinitions when they are used. */\n\n/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n/**\n * The material design colors are adapted from google-material-color v1.2.6\n * https://github.com/danlevan/google-material-color\n * https://github.com/danlevan/google-material-color/blob/f67ca5f4028b2f1b34862f64b0ca67323f91b088/dist/palette.var.css\n *\n * The license for the material design color CSS variables is as follows (see\n * https://github.com/danlevan/google-material-color/blob/f67ca5f4028b2f1b34862f64b0ca67323f91b088/LICENSE)\n *\n * The MIT License (MIT)\n *\n * Copyright (c) 2014 Dan Le Van\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n:root {\n --md-red-50: #FFEBEE;\n --md-red-100: #FFCDD2;\n --md-red-200: #EF9A9A;\n --md-red-300: #E57373;\n --md-red-400: #EF5350;\n --md-red-500: #F44336;\n --md-red-600: #E53935;\n --md-red-700: #D32F2F;\n --md-red-800: #C62828;\n --md-red-900: #B71C1C;\n --md-red-A100: #FF8A80;\n --md-red-A200: #FF5252;\n --md-red-A400: #FF1744;\n --md-red-A700: #D50000;\n\n --md-pink-50: #FCE4EC;\n --md-pink-100: #F8BBD0;\n --md-pink-200: #F48FB1;\n --md-pink-300: #F06292;\n --md-pink-400: #EC407A;\n --md-pink-500: #E91E63;\n --md-pink-600: #D81B60;\n --md-pink-700: #C2185B;\n --md-pink-800: #AD1457;\n --md-pink-900: #880E4F;\n --md-pink-A100: #FF80AB;\n --md-pink-A200: #FF4081;\n --md-pink-A400: #F50057;\n --md-pink-A700: #C51162;\n\n --md-purple-50: #F3E5F5;\n --md-purple-100: #E1BEE7;\n --md-purple-200: #CE93D8;\n --md-purple-300: #BA68C8;\n --md-purple-400: #AB47BC;\n --md-purple-500: #9C27B0;\n --md-purple-600: #8E24AA;\n --md-purple-700: #7B1FA2;\n --md-purple-800: #6A1B9A;\n --md-purple-900: #4A148C;\n --md-purple-A100: #EA80FC;\n --md-purple-A200: #E040FB;\n --md-purple-A400: #D500F9;\n --md-purple-A700: #AA00FF;\n\n --md-deep-purple-50: #EDE7F6;\n --md-deep-purple-100: #D1C4E9;\n --md-deep-purple-200: #B39DDB;\n --md-deep-purple-300: #9575CD;\n --md-deep-purple-400: #7E57C2;\n --md-deep-purple-500: #673AB7;\n --md-deep-purple-600: #5E35B1;\n --md-deep-purple-700: #512DA8;\n --md-deep-purple-800: #4527A0;\n --md-deep-purple-900: #311B92;\n --md-deep-purple-A100: #B388FF;\n --md-deep-purple-A200: #7C4DFF;\n --md-deep-purple-A400: #651FFF;\n --md-deep-purple-A700: #6200EA;\n\n --md-indigo-50: #E8EAF6;\n --md-indigo-100: #C5CAE9;\n --md-indigo-200: #9FA8DA;\n --md-indigo-300: #7986CB;\n --md-indigo-400: #5C6BC0;\n --md-indigo-500: #3F51B5;\n --md-indigo-600: #3949AB;\n --md-indigo-700: #303F9F;\n --md-indigo-800: #283593;\n --md-indigo-900: #1A237E;\n --md-indigo-A100: #8C9EFF;\n --md-indigo-A200: #536DFE;\n --md-indigo-A400: #3D5AFE;\n --md-indigo-A700: #304FFE;\n\n --md-blue-50: #E3F2FD;\n --md-blue-100: #BBDEFB;\n --md-blue-200: #90CAF9;\n --md-blue-300: #64B5F6;\n --md-blue-400: #42A5F5;\n --md-blue-500: #2196F3;\n --md-blue-600: #1E88E5;\n --md-blue-700: #1976D2;\n --md-blue-800: #1565C0;\n --md-blue-900: #0D47A1;\n --md-blue-A100: #82B1FF;\n --md-blue-A200: #448AFF;\n --md-blue-A400: #2979FF;\n --md-blue-A700: #2962FF;\n\n --md-light-blue-50: #E1F5FE;\n --md-light-blue-100: #B3E5FC;\n --md-light-blue-200: #81D4FA;\n --md-light-blue-300: #4FC3F7;\n --md-light-blue-400: #29B6F6;\n --md-light-blue-500: #03A9F4;\n --md-light-blue-600: #039BE5;\n --md-light-blue-700: #0288D1;\n --md-light-blue-800: #0277BD;\n --md-light-blue-900: #01579B;\n --md-light-blue-A100: #80D8FF;\n --md-light-blue-A200: #40C4FF;\n --md-light-blue-A400: #00B0FF;\n --md-light-blue-A700: #0091EA;\n\n --md-cyan-50: #E0F7FA;\n --md-cyan-100: #B2EBF2;\n --md-cyan-200: #80DEEA;\n --md-cyan-300: #4DD0E1;\n --md-cyan-400: #26C6DA;\n --md-cyan-500: #00BCD4;\n --md-cyan-600: #00ACC1;\n --md-cyan-700: #0097A7;\n --md-cyan-800: #00838F;\n --md-cyan-900: #006064;\n --md-cyan-A100: #84FFFF;\n --md-cyan-A200: #18FFFF;\n --md-cyan-A400: #00E5FF;\n --md-cyan-A700: #00B8D4;\n\n --md-teal-50: #E0F2F1;\n --md-teal-100: #B2DFDB;\n --md-teal-200: #80CBC4;\n --md-teal-300: #4DB6AC;\n --md-teal-400: #26A69A;\n --md-teal-500: #009688;\n --md-teal-600: #00897B;\n --md-teal-700: #00796B;\n --md-teal-800: #00695C;\n --md-teal-900: #004D40;\n --md-teal-A100: #A7FFEB;\n --md-teal-A200: #64FFDA;\n --md-teal-A400: #1DE9B6;\n --md-teal-A700: #00BFA5;\n\n --md-green-50: #E8F5E9;\n --md-green-100: #C8E6C9;\n --md-green-200: #A5D6A7;\n --md-green-300: #81C784;\n --md-green-400: #66BB6A;\n --md-green-500: #4CAF50;\n --md-green-600: #43A047;\n --md-green-700: #388E3C;\n --md-green-800: #2E7D32;\n --md-green-900: #1B5E20;\n --md-green-A100: #B9F6CA;\n --md-green-A200: #69F0AE;\n --md-green-A400: #00E676;\n --md-green-A700: #00C853;\n\n --md-light-green-50: #F1F8E9;\n --md-light-green-100: #DCEDC8;\n --md-light-green-200: #C5E1A5;\n --md-light-green-300: #AED581;\n --md-light-green-400: #9CCC65;\n --md-light-green-500: #8BC34A;\n --md-light-green-600: #7CB342;\n --md-light-green-700: #689F38;\n --md-light-green-800: #558B2F;\n --md-light-green-900: #33691E;\n --md-light-green-A100: #CCFF90;\n --md-light-green-A200: #B2FF59;\n --md-light-green-A400: #76FF03;\n --md-light-green-A700: #64DD17;\n\n --md-lime-50: #F9FBE7;\n --md-lime-100: #F0F4C3;\n --md-lime-200: #E6EE9C;\n --md-lime-300: #DCE775;\n --md-lime-400: #D4E157;\n --md-lime-500: #CDDC39;\n --md-lime-600: #C0CA33;\n --md-lime-700: #AFB42B;\n --md-lime-800: #9E9D24;\n --md-lime-900: #827717;\n --md-lime-A100: #F4FF81;\n --md-lime-A200: #EEFF41;\n --md-lime-A400: #C6FF00;\n --md-lime-A700: #AEEA00;\n\n --md-yellow-50: #FFFDE7;\n --md-yellow-100: #FFF9C4;\n --md-yellow-200: #FFF59D;\n --md-yellow-300: #FFF176;\n --md-yellow-400: #FFEE58;\n --md-yellow-500: #FFEB3B;\n --md-yellow-600: #FDD835;\n --md-yellow-700: #FBC02D;\n --md-yellow-800: #F9A825;\n --md-yellow-900: #F57F17;\n --md-yellow-A100: #FFFF8D;\n --md-yellow-A200: #FFFF00;\n --md-yellow-A400: #FFEA00;\n --md-yellow-A700: #FFD600;\n\n --md-amber-50: #FFF8E1;\n --md-amber-100: #FFECB3;\n --md-amber-200: #FFE082;\n --md-amber-300: #FFD54F;\n --md-amber-400: #FFCA28;\n --md-amber-500: #FFC107;\n --md-amber-600: #FFB300;\n --md-amber-700: #FFA000;\n --md-amber-800: #FF8F00;\n --md-amber-900: #FF6F00;\n --md-amber-A100: #FFE57F;\n --md-amber-A200: #FFD740;\n --md-amber-A400: #FFC400;\n --md-amber-A700: #FFAB00;\n\n --md-orange-50: #FFF3E0;\n --md-orange-100: #FFE0B2;\n --md-orange-200: #FFCC80;\n --md-orange-300: #FFB74D;\n --md-orange-400: #FFA726;\n --md-orange-500: #FF9800;\n --md-orange-600: #FB8C00;\n --md-orange-700: #F57C00;\n --md-orange-800: #EF6C00;\n --md-orange-900: #E65100;\n --md-orange-A100: #FFD180;\n --md-orange-A200: #FFAB40;\n --md-orange-A400: #FF9100;\n --md-orange-A700: #FF6D00;\n\n --md-deep-orange-50: #FBE9E7;\n --md-deep-orange-100: #FFCCBC;\n --md-deep-orange-200: #FFAB91;\n --md-deep-orange-300: #FF8A65;\n --md-deep-orange-400: #FF7043;\n --md-deep-orange-500: #FF5722;\n --md-deep-orange-600: #F4511E;\n --md-deep-orange-700: #E64A19;\n --md-deep-orange-800: #D84315;\n --md-deep-orange-900: #BF360C;\n --md-deep-orange-A100: #FF9E80;\n --md-deep-orange-A200: #FF6E40;\n --md-deep-orange-A400: #FF3D00;\n --md-deep-orange-A700: #DD2C00;\n\n --md-brown-50: #EFEBE9;\n --md-brown-100: #D7CCC8;\n --md-brown-200: #BCAAA4;\n --md-brown-300: #A1887F;\n --md-brown-400: #8D6E63;\n --md-brown-500: #795548;\n --md-brown-600: #6D4C41;\n --md-brown-700: #5D4037;\n --md-brown-800: #4E342E;\n --md-brown-900: #3E2723;\n\n --md-grey-50: #FAFAFA;\n --md-grey-100: #F5F5F5;\n --md-grey-200: #EEEEEE;\n --md-grey-300: #E0E0E0;\n --md-grey-400: #BDBDBD;\n --md-grey-500: #9E9E9E;\n --md-grey-600: #757575;\n --md-grey-700: #616161;\n --md-grey-800: #424242;\n --md-grey-900: #212121;\n\n --md-blue-grey-50: #ECEFF1;\n --md-blue-grey-100: #CFD8DC;\n --md-blue-grey-200: #B0BEC5;\n --md-blue-grey-300: #90A4AE;\n --md-blue-grey-400: #78909C;\n --md-blue-grey-500: #607D8B;\n --md-blue-grey-600: #546E7A;\n --md-blue-grey-700: #455A64;\n --md-blue-grey-800: #37474F;\n --md-blue-grey-900: #263238;\n}\n/*\nThe following CSS variables define the main, public API for styling JupyterLab.\nThese variables should be used by all plugins wherever possible. In other\nwords, plugins should not define custom colors, sizes, etc unless absolutely\nnecessary. This enables users to change the visual theme of JupyterLab\nby changing these variables.\n\nMany variables appear in an ordered sequence (0,1,2,3). These sequences\nare designed to work well together, so for example, `--jp-border-color1` should\nbe used with `--jp-layout-color1`. The numbers have the following meanings:\n\n* 0: super-primary, reserved for special emphasis\n* 1: primary, most important under normal situations\n* 2: secondary, next most important under normal situations\n* 3: tertiary, next most important under normal situations\n\nThroughout JupyterLab, we are mostly following principles from Google's\nMaterial Design when selecting colors. We are not, however, following \nall of MD as it is not optimized for dense, information rich UIs.\n*/\n\n\n:root {\n\n /* Borders\n \n The following variables, specify the visual styling of borders in JupyterLab.\n */\n\n --jp-border-width: 1px;\n --jp-border-color0: var(--md-grey-700); \n --jp-border-color1: var(--md-grey-500);\n --jp-border-color2: var(--md-grey-300);\n --jp-border-color3: var(--md-grey-100);\n\n /* UI Fonts\n \n The UI font CSS variables are used for the typography all of the JupyterLab\n user interface elements that are not directly user generated content.\n */\n\n --jp-ui-font-scale-factor: 1.2;\n --jp-ui-font-size0: calc(var(--jp-ui-font-size1)/var(--jp-ui-font-scale-factor));\n --jp-ui-font-size1: 13px; /* Base font size */\n --jp-ui-font-size2: calc(var(--jp-ui-font-size1)*var(--jp-ui-font-scale-factor));\n --jp-ui-font-size3: calc(var(--jp-ui-font-size2)*var(--jp-ui-font-scale-factor));\n --jp-ui-icon-font-size: 14px; /* Ensures px perfect FontAwesome icons */\n\n /* Use these font colors against the corresponding main layout colors.\n In a light theme, these go from dark to light.\n */\n\n --jp-ui-font-color0: rgba(0,0,0,1.0);\n --jp-ui-font-color1: rgba(0,0,0,0.87);\n --jp-ui-font-color2: rgba(0,0,0,0.54);\n --jp-ui-font-color3: rgba(0,0,0,0.38);\n \n /* Use these against the brand/accent/warn/error colors.\n These will typically go from light to darker, in both a dark and light theme\n */\n\n --jp-inverse-ui-font-color0: rgba(255,255,255,1);\n --jp-inverse-ui-font-color1: rgba(255,255,255,1.0);\n --jp-inverse-ui-font-color2: rgba(255,255,255,0.7);\n --jp-inverse-ui-font-color3: rgba(255,255,255,0.5);\n\n /* Content Fonts\n \n Content font variables are used for typography of user generated content.\n */\n \n --jp-content-font-size: 13px;\n --jp-content-line-height: 1.5;\n --jp-content-font-color0: black;\n --jp-content-font-color1: black;\n --jp-content-font-color2: var(--md-grey-700);\n --jp-content-font-color3: var(--md-grey-500);\n\n --jp-ui-font-scale-factor: 1.2;\n --jp-ui-font-size0: calc(var(--jp-ui-font-size1)/var(--jp-ui-font-scale-factor));\n --jp-ui-font-size1: 13px; /* Base font size */\n --jp-ui-font-size2: calc(var(--jp-ui-font-size1)*var(--jp-ui-font-scale-factor));\n --jp-ui-font-size3: calc(var(--jp-ui-font-size2)*var(--jp-ui-font-scale-factor));\n\n --jp-code-font-size: 13px;\n --jp-code-line-height: 17px;\n --jp-code-padding: 5px;\n\n /* Layout\n \n The following are the main layout colors use in JupyterLab. In a light\n theme these would go from light to dark.\n */\n\n --jp-layout-color0: white; \n --jp-layout-color1: white;\n --jp-layout-color2: var(--md-grey-200);\n --jp-layout-color3: var(--md-grey-400);\n\n /* Brand/accent */\n\n --jp-brand-color0: var(--md-blue-700);\n --jp-brand-color1: var(--md-blue-500);\n --jp-brand-color2: var(--md-blue-300);\n --jp-brand-color3: var(--md-blue-100);\n\n --jp-accent-color0: var(--md-green-700);\n --jp-accent-color1: var(--md-green-500);\n --jp-accent-color2: var(--md-green-300);\n --jp-accent-color3: var(--md-green-100);\n\n /* State colors (warn, error, success, info) */\n\n --jp-warn-color0: var(--md-orange-700);\n --jp-warn-color1: var(--md-orange-500);\n --jp-warn-color2: var(--md-orange-300);\n --jp-warn-color3: var(--md-orange-100);\n\n --jp-error-color0: var(--md-red-700);\n --jp-error-color1: var(--md-red-500);\n --jp-error-color2: var(--md-red-300);\n --jp-error-color3: var(--md-red-100);\n\n --jp-success-color0: var(--md-green-700);\n --jp-success-color1: var(--md-green-500);\n --jp-success-color2: var(--md-green-300);\n --jp-success-color3: var(--md-green-100);\n\n --jp-info-color0: var(--md-cyan-700);\n --jp-info-color1: var(--md-cyan-500);\n --jp-info-color2: var(--md-cyan-300);\n --jp-info-color3: var(--md-cyan-100);\n\n}\n/* Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\n/*\n * We assume that the CSS variables in\n * https://github.com/jupyterlab/jupyterlab/blob/master/src/default-theme/variables.css\n * have been defined.\n */\n\n\n:root {\n --jp-widgets-color: var(--jp-content-font-color1);\n --jp-widgets-label-color: var(--jp-widgets-color);\n --jp-widgets-readout-color: var(--jp-widgets-color);\n --jp-widgets-font-size: var(--jp-ui-font-size1);\n --jp-widgets-margin: 2px;\n --jp-widgets-inline-height: 28px;\n --jp-widgets-inline-width: 300px;\n --jp-widgets-inline-width-short: calc(var(--jp-widgets-inline-width) / 2 - var(--jp-widgets-margin));\n --jp-widgets-inline-width-tiny: calc(var(--jp-widgets-inline-width-short) / 2 - var(--jp-widgets-margin));\n --jp-widgets-inline-margin: 4px; /* margin between inline elements */\n --jp-widgets-inline-label-min-width: 80px;\n --jp-widgets-inline-label-max-width: calc(var(--jp-widgets-inline-width) - var(--jp-widgets-inline-margin) - var(--jp-widgets-inline-width-short));\n --jp-widgets-border-width: var(--jp-border-width);\n --jp-widgets-vertical-height: 200px;\n --jp-widgets-horizontal-tab-height: 24px;\n --jp-widgets-horizontal-tab-width: 144px;\n --jp-widgets-horizontal-tab-top-border: 2px;\n --jp-widgets-progress-thickness: 20px;\n --jp-widgets-container-padding: 15px;\n --jp-widgets-input-padding: 4px;\n --jp-widgets-slider-track-thickness: 4px;\n --jp-widgets-slider-border-width: var(--jp-widgets-border-width);\n --jp-widgets-slider-handle-size: 16px;\n --jp-widgets-slider-handle-border-color: var(--jp-border-color1);\n --jp-widgets-slider-handle-background-color: var(--jp-layout-color1);\n --jp-widgets-slider-active-handle-color: var(--jp-brand-color1);\n --jp-widgets-menu-item-height: 24px;\n\n --jp-widgets-input-color: var(--jp-ui-font-color1);\n --jp-widgets-input-background-color: var(--jp-layout-color1);\n --jp-widgets-input-border-color: var(--jp-border-color1);\n --jp-widgets-input-focus-border-color: var(--jp-brand-color2);\n --jp-widgets-input-border-width: var(--jp-widgets-border-width);\n\n /* From Material Design Lite */\n --md-shadow-key-umbra-opacity: 0.2;\n --md-shadow-key-penumbra-opacity: 0.14;\n --md-shadow-ambient-shadow-opacity: 0.12;\n}\n\n.jupyter-widgets {\n margin: var(--jp-widgets-margin);\n box-sizing: border-box;\n color: var(--jp-widgets-color);\n overflow: visible;\n}\n\n.jp-Output-result > .jupyter-widgets {\n margin-left: 0;\n margin-right: 0;\n}\n\n/* vbox and hbox */\n\n.widget-inline-hbox {\n /* Horizontal widgets */\n box-sizing: border-box;\n display: flex;\n flex-direction: row;\n align-items: baseline;\n}\n\n.widget-inline-vbox {\n /* Vertical Widgets */\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}\n\n.widget-box {\n box-sizing: border-box;\n display: flex;\n margin: 0;\n}\n\n.widget-hbox {\n flex-direction: row;\n}\n\n.widget-vbox {\n flex-direction: column;\n}\n\n/* General Button Styling */\n\n.jupyter-button {\n padding: 0;\n display: inline-block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: center;\n font-size: var(--jp-widgets-font-size);\n cursor: pointer;\n\n height: var(--jp-widgets-inline-height);\n border: 0px solid;\n line-height: var(--jp-widgets-inline-height);\n box-shadow: none;\n\n color: var(--jp-ui-font-color1);\n background-color: var(--jp-layout-color2);\n border-color: var(--jp-border-color2);\n border: none;\n}\n\n.jupyter-button i.fa {\n margin-right: var(--jp-widgets-inline-margin);\n pointer-events: none;\n}\n\n.jupyter-button:empty:before {\n content: \"\\200b\"; /* zero-width space */\n}\n\n.jupyter-button i.fa.center {\n margin-right: 0;\n}\n\n.jupyter-button:hover, .jupyter-button:focus {\n /* MD Lite 2dp shadow */\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\n 0 3px 1px -2px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity)),\n 0 1px 5px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity));\n}\n\n.jupyter-button:active, .jupyter-button.mod-active {\n /* MD Lite 4dp shadow */\n box-shadow: 0 4px 5px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\n 0 1px 10px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity)),\n 0 2px 4px -1px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity));\n color: var(--jp-ui-font-color1);\n background-color: var(--jp-layout-color3);\n}\n\n.jupyter-button:focus {\n outline: 1px solid var(--jp-widgets-input-focus-border-color);\n}\n\n/* Button \"Primary\" Styling */\n\n.jupyter-button.mod-primary {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-brand-color1);\n}\n\n.jupyter-button.mod-primary.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-brand-color0);\n}\n\n.jupyter-button.mod-primary:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-brand-color0);\n}\n\n/* Button \"Success\" Styling */\n\n.jupyter-button.mod-success {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-success-color1);\n}\n\n.jupyter-button.mod-success.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-success-color0);\n }\n\n.jupyter-button.mod-success:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-success-color0);\n }\n\n /* Button \"Info\" Styling */\n\n.jupyter-button.mod-info {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-info-color1);\n}\n\n.jupyter-button.mod-info.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-info-color0);\n}\n\n.jupyter-button.mod-info:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-info-color0);\n}\n\n/* Button \"Warning\" Styling */\n\n.jupyter-button.mod-warning {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-warn-color1);\n}\n\n.jupyter-button.mod-warning.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-warn-color0);\n}\n\n.jupyter-button.mod-warning:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-warn-color0);\n}\n\n/* Button \"Danger\" Styling */\n\n.jupyter-button.mod-danger {\n color: var(--jp-inverse-ui-font-color1);\n background-color: var(--jp-error-color1);\n}\n\n.jupyter-button.mod-danger.mod-active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-error-color0);\n}\n\n.jupyter-button.mod-danger:active {\n color: var(--jp-inverse-ui-font-color0);\n background-color: var(--jp-error-color0);\n}\n\n/* Widget Button*/\n\n.widget-button, .widget-toggle-button {\n width: var(--jp-widgets-inline-width-short);\n}\n\n/* Widget Label Styling */\n\n.widget-label {\n /* Label */\n color: var(--jp-widgets-label-color);\n font-size: var(--jp-widgets-font-size);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: var(--jp-widgets-inline-height);\n max-width: var(--jp-widgets-inline-width);\n}\n\n.jupyter-widgets.widget-label {\n width: var(--jp-widgets-inline-width-tiny);\n}\n\n.widget-inline-hbox .widget-label {\n /* Horizontal Widget Label */\n color: var(--jp-widgets-label-color);\n text-align: right;\n margin-right: var(--jp-widgets-inline-margin);\n max-width: var(--jp-widgets-inline-label-max-width);\n min-width: var(--jp-widgets-inline-label-min-width);\n flex-shrink: 0;\n}\n\n.widget-inline-vbox .widget-label {\n /* Vertical Widget Label */\n color: var(--jp-widgets-label-color);\n text-align: center;\n}\n\n/* Widget Readout Styling */\n\n.widget-readout {\n color: var(--jp-widgets-readout-color);\n font-size: var(--jp-widgets-font-size);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n margin-left: var(--jp-widgets-inline-margin);\n overflow: hidden;\n white-space: nowrap;\n text-align: center;\n}\n\n.widget-readout.overflow {\n /* Overflowing Readout */\n\n /* From Material Design Lite\n shadow-key-umbra-opacity: 0.2;\n shadow-key-penumbra-opacity: 0.14;\n shadow-ambient-shadow-opacity: 0.12;\n */\n -webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\n 0 3px 1px -2px rgba(0, 0, 0, 0.14),\n 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n\n -moz-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\n 0 3px 1px -2px rgba(0, 0, 0, 0.14),\n 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\n 0 3px 1px -2px rgba(0, 0, 0, 0.14),\n 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n}\n\n.widget-inline-hbox .widget-readout {\n /* Horizontal Readout */\n text-align: center;\n max-width: var(--jp-widgets-inline-width-short);\n min-width: var(--jp-widgets-inline-width-tiny);\n margin-left: var(--jp-widgets-inline-margin);\n}\n\n.widget-inline-vbox .widget-readout {\n /* Vertical Readout */\n margin-top: var(--jp-widgets-inline-margin);\n}\n\n/* Widget Checkbox Styling */\n\n.widget-checkbox {\n width: var(--jp-widgets-inline-width-short);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n justify-content: space-between;\n}\n\n.widget-checkbox input[type=\"checkbox\"] {\n margin: 0px var(--jp-widgets-inline-margin) 0px var(--jp-widgets-inline-margin);\n line-height: var(--jp-widgets-inline-height);\n font-size: large;\n flex-grow: 1;\n flex-shrink: 0;\n align-self: center;\n}\n\n/* Widget Valid Styling */\n\n.widget-valid {\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n width: var(--jp-widgets-inline-width-short);\n font-size: var(--jp-widgets-font-size);\n}\n\n.widget-valid i:before {\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n margin-right: var(--jp-widgets-inline-margin);\n margin-left: var(--jp-widgets-inline-margin);\n\n /* from the fa class in FontAwesome: https://github.com/FortAwesome/Font-Awesome/blob/49100c7c3a7b58d50baa71efef11af41a66b03d3/css/font-awesome.css#L14 */\n display: inline-block;\n font: normal normal normal 14px/1 FontAwesome;\n font-size: inherit;\n text-rendering: auto;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.widget-valid.mod-valid i:before {\n content: \"\\f00c\";\n color: green;\n}\n\n.widget-valid.mod-invalid i:before {\n content: \"\\f00d\";\n color: red;\n}\n\n.widget-valid.mod-valid .widget-valid-readout {\n display: none;\n}\n\n/* Widget Text and TextArea Stying */\n\n.widget-textarea, .widget-text {\n width: var(--jp-widgets-inline-width);\n}\n\n.widget-text input[type=\"text\"] {\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-text input[type=\"text\"], .widget-textarea textarea {\n box-sizing: border-box;\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n background-color: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n font-size: var(--jp-widgets-font-size);\n padding: var(--jp-widgets-input-padding) calc( var(--jp-widgets-input-padding) * 2 );\n flex-grow: 1;\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\n flex-shrink: 1;\n outline: none !important;\n line-height: 1.5;\n}\n\n.widget-textarea textarea {\n height: inherit;\n width: inherit;\n}\n\n.widget-text input:focus, .widget-textarea textarea:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n/* Widget Slider */\n\n.widget-slider .ui-slider {\n /* Slider Track */\n border: var(--jp-widgets-slider-border-width) solid var(--jp-layout-color3);\n background: var(--jp-layout-color3);\n box-sizing: border-box;\n position: relative;\n border-radius: 0px;\n}\n\n.widget-slider .ui-slider .ui-slider-handle {\n /* Slider Handle */\n outline: none !important; /* focused slider handles are colored - see below */\n position: absolute;\n background-color: var(--jp-widgets-slider-handle-background-color);\n border: var(--jp-widgets-slider-border-width) solid var(--jp-widgets-slider-handle-border-color);\n box-sizing: border-box;\n z-index: 1;\n background-image: none; /* Override jquery-ui */\n}\n\n/* Override jquery-ui */\n.widget-slider .ui-slider .ui-slider-handle:hover, .widget-slider .ui-slider .ui-slider-handle:focus {\n background-color: var(--jp-widgets-slider-active-handle-color);\n border: var(--jp-widgets-slider-border-width) solid var(--jp-widgets-slider-active-handle-color);\n}\n\n.widget-slider .ui-slider .ui-slider-handle:active {\n background-color: var(--jp-widgets-slider-active-handle-color);\n border-color: var(--jp-widgets-slider-active-handle-color);\n z-index: 2;\n transform: scale(1.2);\n}\n\n.widget-slider .ui-slider .ui-slider-range {\n /* Interval between the two specified value of a double slider */\n position: absolute;\n background: var(--jp-widgets-slider-active-handle-color);\n z-index: 0;\n}\n\n/* Shapes of Slider Handles */\n\n.widget-hslider .ui-slider .ui-slider-handle {\n width: var(--jp-widgets-slider-handle-size);\n height: var(--jp-widgets-slider-handle-size);\n margin-top: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-handle-size)) / 2 - var(--jp-widgets-slider-border-width));\n margin-left: calc(var(--jp-widgets-slider-handle-size) / -2 + var(--jp-widgets-slider-border-width));\n border-radius: 50%;\n top: 0;\n}\n\n.widget-vslider .ui-slider .ui-slider-handle {\n width: var(--jp-widgets-slider-handle-size);\n height: var(--jp-widgets-slider-handle-size);\n margin-bottom: calc(var(--jp-widgets-slider-handle-size) / -2 + var(--jp-widgets-slider-border-width));\n margin-left: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-handle-size)) / 2 - var(--jp-widgets-slider-border-width));\n border-radius: 50%;\n left: 0;\n}\n\n.widget-hslider .ui-slider .ui-slider-range {\n height: calc( var(--jp-widgets-slider-track-thickness) * 2 );\n margin-top: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-track-thickness) * 2 ) / 2 - var(--jp-widgets-slider-border-width));\n}\n\n.widget-vslider .ui-slider .ui-slider-range {\n width: calc( var(--jp-widgets-slider-track-thickness) * 2 );\n margin-left: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-track-thickness) * 2 ) / 2 - var(--jp-widgets-slider-border-width));\n}\n\n/* Horizontal Slider */\n\n.widget-hslider {\n width: var(--jp-widgets-inline-width);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widgets-slider .slider-container {\n overflow: visible;\n}\n\n.widget-hslider .slider-container {\n height: var(--jp-widgets-inline-height);\n margin-left: calc(var(--jp-widgets-slider-handle-size) / 2 - 2 * var(--jp-widgets-slider-border-width));\n margin-right: calc(var(--jp-widgets-slider-handle-size) / 2 - 2 * var(--jp-widgets-slider-border-width));\n align-self: stretch;\n flex: 1 1 var(--jp-widgets-inline-width-short);\n}\n\n.widget-hslider .ui-slider {\n /* Inner, invisible slide div */\n height: var(--jp-widgets-slider-track-thickness);\n margin-top: calc((var(--jp-widgets-inline-height) - var(--jp-widgets-slider-track-thickness)) / 2);\n width: 100%;\n}\n\n/* Vertical Slider */\n\n.widget-vbox .widget-label {\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-vslider {\n /* Vertical Slider */\n height: var(--jp-widgets-vertical-height);\n width: var(--jp-widgets-inline-width-tiny);\n}\n\n.widget-vslider .slider-container {\n flex: 1 1 var(--jp-widgets-inline-width-short);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: calc(var(--jp-widgets-slider-handle-size) / 2 - 2 * var(--jp-widgets-slider-border-width));\n margin-top: calc(var(--jp-widgets-slider-handle-size) / 2 - 2 * var(--jp-widgets-slider-border-width));\n}\n\n.widget-vslider .ui-slider {\n /* Inner, invisible slide div */\n width: var(--jp-widgets-slider-track-thickness);\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n/* Widget Progress Styling */\n\n.progress-bar {\n -webkit-transition: none;\n -moz-transition: none;\n -ms-transition: none;\n -o-transition: none;\n transition: none;\n}\n\n.progress-bar {\n height: var(--jp-widgets-inline-height);\n}\n\n.progress-bar {\n background-color: var(--jp-brand-color1);\n}\n\n.progress-bar-success {\n background-color: var(--jp-success-color1);\n}\n\n.progress-bar-info {\n background-color: var(--jp-info-color1);\n}\n\n.progress-bar-warning {\n background-color: var(--jp-warn-color1);\n}\n\n.progress-bar-danger {\n background-color: var(--jp-error-color1);\n}\n\n.progress {\n background-color: var(--jp-layout-color2);\n border: none;\n box-shadow: none;\n}\n\n/* Horisontal Progress */\n\n.widget-hprogress {\n /* Progress Bar */\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n width: var(--jp-widgets-inline-width);\n}\n\n.widget-hprogress .progress {\n flex-grow: 1;\n height: var(--jp-widgets-progress-thickness);\n margin-top: auto;\n margin-bottom: auto;\n}\n\n/* Vertical Progress */\n\n.widget-vprogress {\n height: var(--jp-widgets-vertical-height);\n width: var(--jp-widgets-inline-width-tiny);\n}\n\n.widget-vprogress .progress {\n flex-grow: 1;\n width: var(--jp-widgets-progress-thickness);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 0;\n}\n\n/* Select Widget Styling */\n\n.widget-select {\n width: var(--jp-widgets-inline-width);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-select select {\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n border-radius: 0;\n height: var(--jp-widgets-inline-height);\n flex: 1 1 var(--jp-widgets-inline-width-short);\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\n box-sizing: border-box;\n outline: none !important;\n box-shadow: none;\n background-color: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n font-size: var(--jp-widgets-font-size);\n vertical-align: top;\n padding-left: calc( var(--jp-widgets-input-padding) * 2);\n\tappearance: none;\n\t-webkit-appearance: none;\n\t-moz-appearance: none;\n background-repeat: no-repeat;\n\tbackground-size: 20px;\n\tbackground-position: right center;\n background-image: url(\"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxOCAxOCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTggMTg7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDpub25lO30KPC9zdHlsZT4KPHBhdGggZD0iTTUuMiw1LjlMOSw5LjdsMy44LTMuOGwxLjIsMS4ybC00LjksNWwtNC45LTVMNS4yLDUuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTAtMC42aDE4djE4SDBWLTAuNnoiLz4KPC9zdmc+Cg\");\n}\n\n.widget-select select:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n/* To disable the dotted border in Firefox around select controls.\n See http://stackoverflow.com/a/18853002 */\n.widget-select select:-moz-focusring {\n color: transparent;\n text-shadow: 0 0 0 #000;\n}\n\n.widget-select select option:checked {\n color: var(--jp-ui-font-color0);\n background: var(--jp-layout-color0) repeat url(\"data:image/gif;base64,R0lGO...\");\n}\n\n/* Select Multiple */\n\n.widget-select-multiple {\n width: var(--jp-widgets-inline-width);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-select-multiple select {\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n background-color: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n font-size: var(--jp-widgets-font-size);\n flex: 1 1 var(--jp-widgets-inline-width-short);\n outline: none !important;\n overflow: auto;\n}\n\n.widget-select-multiple select:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n.widget-select-multiple select option:checked {\n color: var(--jp-ui-font-color0);\n background: var(--jp-layout-color0) repeat url(\"data:image/gif;base64,R0lGO...\");\n}\n\n.wiget-select-multiple select option {\n padding-left: var(--jp-widgets-input-padding);\n line-height: var(--jp-widgets-inline-height);\n /* line-height doesn't work on some browsers for select options */\n padding-top: calc(var(--jp-widgets-inline-height)-var(--jp-widgets-font-size)/2);\n padding-bottom: calc(var(--jp-widgets-inline-height)-var(--jp-widgets-font-size)/2);\n}\n\n\n\n/* Toggle Buttons Styling */\n\n.widget-toggle-buttons {\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-toggle-buttons .widget-toggle-button {\n margin-left: var(--jp-widgets-margin);\n margin-right: var(--jp-widgets-margin);\n}\n\n/* Radio Buttons Styling */\n\n.widget-radio {\n width: var(--jp-widgets-inline-width);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-radio-box {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n box-sizing: border-box;\n flex-grow: 1;\n}\n\n.widget-radio-box label {\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n font-size: var(--jp-widgets-font-size);\n}\n\n.widget-radio-box input {\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n margin: 0 var(--jp-widgets-input-padding) 0 var(--jp-widgets-input-padding);\n float: left;\n}\n\n/* Color Picker Styling */\n\n.widget-colorpicker {\n width: var(--jp-widgets-inline-width);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-colorpicker > .widget-colorpicker-input {\n flex-grow: 1;\n flex-shrink: 1;\n min-width: var(--jp-widgets-inline-width-tiny);\n}\n\n.widget-colorpicker input[type=\"color\"] {\n width: var(--jp-widgets-inline-height);\n height: var(--jp-widgets-inline-height);\n padding: 0 2px; /* make the color square actually square on Chrome on OS X */\n background: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n border-left: none;\n flex-grow: 0;\n flex-shrink: 0;\n box-sizing: border-box;\n align-self: stretch;\n outline: none !important;\n}\n\n.widget-colorpicker.concise input[type=\"color\"] {\n border-left: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n}\n\n.widget-colorpicker input[type=\"color\"]:focus, .widget-colorpicker input[type=\"text\"]:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n.widget-colorpicker input[type=\"text\"] {\n flex-grow: 1;\n outline: none !important;\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n background: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n font-size: var(--jp-widgets-font-size);\n padding: var(--jp-widgets-input-padding) calc( var(--jp-widgets-input-padding) * 2 );\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\n flex-shrink: 1;\n box-sizing: border-box;\n}\n\n/* Date Picker Styling */\n\n.widget-datepicker {\n width: var(--jp-widgets-inline-width);\n height: var(--jp-widgets-inline-height);\n line-height: var(--jp-widgets-inline-height);\n}\n\n.widget-datepicker input[type=\"date\"] {\n flex-grow: 1;\n flex-shrink: 1;\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\n outline: none !important;\n height: var(--jp-widgets-inline-height);\n border: var(--jp-widgets-input-border-width) solid var(--jp-widgets-input-border-color);\n background-color: var(--jp-widgets-input-background-color);\n color: var(--jp-widgets-input-color);\n font-size: var(--jp-widgets-font-size);\n padding: var(--jp-widgets-input-padding) calc( var(--jp-widgets-input-padding) * 2 );\n box-sizing: border-box;\n}\n\n.widget-datepicker input[type=\"date\"]:focus {\n border-color: var(--jp-widgets-input-focus-border-color);\n}\n\n/* Play Widget */\n\n.widget-play {\n min-width: var(--jp-widgets-inline-width-short);\n display: flex;\n justify-content: space-between;\n}\n\n.widget-play .jupyter-button {\n min-width: calc(var(--jp-widgets-inline-width-short) / 3 - 2 * var(--jp-widgets-margin));\n text-align: center;\n}\n\n/* Tab Widget */\n\n.jupyter-widgets .p-TabBar {\n overflow-x: visible;\n overflow-y: visible;\n}\n\n.jupyter-widgets.widget-tab .p-TabBar.p-mod-horizontal > .p-TabBar-content {\n align-items: flex-end;\n margin-bottom: 0;\n}\n\n.jupyter-widgets.widget-tab .widget-tab-contents {\n width: 100%;\n box-sizing: border-box;\n margin: 0;\n background: var(--jp-layout-color1);\n color: var(--jp-ui-font-color1);\n border: var(--jp-border-width) solid var(--jp-border-color1);\n padding: var(--jp-widgets-container-padding);\n}\n\n.jupyter-widgets.widget-tab .widget-tab-contents .widget-tab-child.p-mod-hidden {\n display: none !important;\n}\n\n.jupyter-widgets.widget-tab .widget-tab-bar.p-TabBar {\n font: var(--jp-widgets-font-size) Helvetica, Arial, sans-serif;\n}\n\n.jupyter-widgets.widget-tab .p-TabBar-tab {\n flex: 0 1 var(--jp-widgets-horizontal-tab-width);\n min-width: 35px;\n min-height: calc(var(--jp-widgets-horizontal-tab-height) + var(--jp-border-width));\n line-height: var(--jp-widgets-horizontal-tab-height);\n margin-left: calc(-1 * var(--jp-border-width));\n padding: 0px 10px;\n background: var(--jp-layout-color2);\n color: var(--jp-ui-font-color2);\n border: var(--jp-border-width) solid var(--jp-border-color1);\n border-bottom: none;\n position: relative;\n}\n\n.jupyter-widgets.widget-tab .p-TabBar-tab.p-mod-current {\n color: var(--jp-ui-font-color0);\n /* We want the background to match the tab content background */\n background: var(--jp-layout-color1);\n min-height: calc(var(--jp-widgets-horizontal-tab-height) + 2 * var(--jp-border-width));\n transform: translateY(var(--jp-border-width));\n}\n\n.jupyter-widgets.widget-tab .p-TabBar-tab.p-mod-current:before {\n position: absolute;\n top: calc(-1 * var(--jp-border-width));\n left: calc(-1 * var(--jp-border-width));\n content: '';\n height: var(--jp-widgets-horizontal-tab-top-border);\n width: calc(100% + 2 * var(--jp-border-width));\n background: var(--jp-brand-color1);\n}\n\n.jupyter-widgets.widget-tab .p-TabBar-tab:first-child {\n margin-left: 0;\n}\n\n.jupyter-widgets.widget-tab .p-TabBar-tab:hover:not(.p-mod-current) {\n background: var(--jp-layout-color1);\n color: var(--jp-ui-font-color1);\n}\n\n.jupyter-widgets.widget-tab.p-mod-closable > .p-TabBar-tabCloseIcon {\n margin-left: 4px;\n}\n\n.jupyter-widgets.widget-tab.p-mod-closable > .p-TabBar-tabCloseIcon:before {\n font-family: FontAwesome;\n content: '\\f00d'; /* close */\n}\n\n.jupyter-widgets.widget-tab .p-TabBar-tabIcon,\n.jupyter-widgets.widget-tab .p-TabBar-tabLabel,\n.jupyter-widgets.widget-tab .p-TabBar-tabCloseIcon {\n line-height: var(--jp-widgets-horizontal-tab-height);\n}\n\n/* Accordion Widget */\n\n.p-Collapse {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}\n\n.p-Collapse-header {\n padding: var(--jp-widgets-input-padding);\n cursor: pointer;\n color: var(--jp-ui-font-color2);\n background-color: var(--jp-layout-color2);\n border: var(--jp-widgets-border-width) solid var(--jp-border-color1);\n padding: calc(var(--jp-widgets-container-padding) * 2 / 3) var(--jp-widgets-container-padding);\n font-weight: bold;\n}\n\n.p-Collapse-header:hover {\n background-color: var(--jp-layout-color1);\n color: var(--jp-ui-font-color1);\n}\n\n.p-Collapse-open .p-Collapse-header {\n background-color: var(--jp-layout-color1);\n color: var(--jp-ui-font-color0);\n cursor: default;\n border-bottom: none;\n}\n\n.p-Collapse .p-Collapse-header::before {\n content: '\\f0da\\00A0'; /* caret-right, non-breaking space */\n display: inline-block;\n font: normal normal normal 14px/1 FontAwesome;\n font-size: inherit;\n text-rendering: auto;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.p-Collapse-open .p-Collapse-header::before {\n content: '\\f0d7\\00A0'; /* caret-down, non-breaking space */\n}\n\n.p-Collapse-contents {\n padding: var(--jp-widgets-container-padding);\n background-color: var(--jp-layout-color1);\n color: var(--jp-ui-font-color1);\n border-left: var(--jp-widgets-border-width) solid var(--jp-border-color1);\n border-right: var(--jp-widgets-border-width) solid var(--jp-border-color1);\n border-bottom: var(--jp-widgets-border-width) solid var(--jp-border-color1);\n}\n\n.p-Accordion {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}\n\n.p-Accordion .p-Collapse {\n margin-bottom: 0;\n}\n\n.p-Accordion .p-Collapse + .p-Collapse {\n margin-top: 4px;\n}\n\n\n\n/* HTML widget */\n\n.widget-html, .widget-htmlmath {\n font-size: var(--jp-widgets-font-size);\n}\n", ""]);
// exports
/***/ }
/******/ ])});;
|