Spaces:
Runtime error
Runtime error
File size: 227,050 Bytes
5f5d58c |
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 |
import { commonjsGlobal, getDefaultExportFromCjs } from './index-f3183a9a.js';
import require$$0__default__default from 'fs';
import postcss$1 from './postcss-db2e39ff.js';
import require$$0$4 from 'path';
import require$$3$1 from 'crypto';
import require$$0$6 from 'util';
import { lib } from './dep-c423598f-00db75d5.js';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import { createRequire } from 'node:module';
import 'node:child_process';
import 'net';
import 'node:fs';
import 'node:fs/promises';
import 'node:util';
import 'node:perf_hooks';
import 'tty';
import 'esbuild-wasm';
import 'events';
import 'assert';
import 'url';
import 'http';
import 'stream';
import 'os';
import 'child_process';
import 'node:os';
import 'node:crypto';
import 'node:dns';
import 'node:buffer';
import 'module';
import 'node:assert';
import 'node:process';
import 'node:v8';
import 'worker_threads';
import 'zlib';
import 'buffer';
import 'https';
import 'tls';
import 'node:http';
import 'node:https';
import 'querystring';
import 'node:readline';
import 'node:zlib';
import '../compiler.js';
import 'fs/promises';
const __filename = fileURLToPath(import.meta.url);
dirname(__filename);
const require = createRequire(import.meta.url);
function _mergeNamespaces(n, m) {
for (var i = 0; i < m.length; i++) {
var e = m[i];
if (typeof e !== 'string' && !Array.isArray(e)) { for (var k in e) {
if (k !== 'default' && !(k in n)) {
n[k] = e[k];
}
} }
}
return n;
}
var build = {exports: {}};
var fs = {};
Object.defineProperty(fs, "__esModule", {
value: true
});
fs.getFileSystem = getFileSystem;
fs.setFileSystem = setFileSystem;
let fileSystem = {
readFile: () => {
throw Error("readFile not implemented");
},
writeFile: () => {
throw Error("writeFile not implemented");
}
};
function setFileSystem(fs) {
fileSystem.readFile = fs.readFile;
fileSystem.writeFile = fs.writeFile;
}
function getFileSystem() {
return fileSystem;
}
var pluginFactory = {};
var unquote$1 = {};
Object.defineProperty(unquote$1, "__esModule", {
value: true
});
unquote$1.default = unquote;
// copied from https://github.com/lakenen/node-unquote
const reg = /['"]/;
function unquote(str) {
if (!str) {
return "";
}
if (reg.test(str.charAt(0))) {
str = str.substr(1);
}
if (reg.test(str.charAt(str.length - 1))) {
str = str.substr(0, str.length - 1);
}
return str;
}
var Parser$1 = {};
const matchValueName = /[$]?[\w-]+/g;
const replaceValueSymbols$2 = (value, replacements) => {
let matches;
while ((matches = matchValueName.exec(value))) {
const replacement = replacements[matches[0]];
if (replacement) {
value =
value.slice(0, matches.index) +
replacement +
value.slice(matchValueName.lastIndex);
matchValueName.lastIndex -= matches[0].length - replacement.length;
}
}
return value;
};
var replaceValueSymbols_1 = replaceValueSymbols$2;
const replaceValueSymbols$1 = replaceValueSymbols_1;
const replaceSymbols$1 = (css, replacements) => {
css.walk((node) => {
if (node.type === "decl" && node.value) {
node.value = replaceValueSymbols$1(node.value.toString(), replacements);
} else if (node.type === "rule" && node.selector) {
node.selector = replaceValueSymbols$1(
node.selector.toString(),
replacements
);
} else if (node.type === "atrule" && node.params) {
node.params = replaceValueSymbols$1(node.params.toString(), replacements);
}
});
};
var replaceSymbols_1 = replaceSymbols$1;
const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/;
const balancedQuotes = /^("[^"]*"|'[^']*'|[^"']+)$/;
const getDeclsObject = (rule) => {
const object = {};
rule.walkDecls((decl) => {
const before = decl.raws.before ? decl.raws.before.trim() : "";
object[before + decl.prop] = decl.value;
});
return object;
};
/**
*
* @param {string} css
* @param {boolean} removeRules
* @param {'auto' | 'rule' | 'at-rule'} mode
*/
const extractICSS$2 = (css, removeRules = true, mode = "auto") => {
const icssImports = {};
const icssExports = {};
function addImports(node, path) {
const unquoted = path.replace(/'|"/g, "");
icssImports[unquoted] = Object.assign(
icssImports[unquoted] || {},
getDeclsObject(node)
);
if (removeRules) {
node.remove();
}
}
function addExports(node) {
Object.assign(icssExports, getDeclsObject(node));
if (removeRules) {
node.remove();
}
}
css.each((node) => {
if (node.type === "rule" && mode !== "at-rule") {
if (node.selector.slice(0, 7) === ":import") {
const matches = importPattern.exec(node.selector);
if (matches) {
addImports(node, matches[1]);
}
}
if (node.selector === ":export") {
addExports(node);
}
}
if (node.type === "atrule" && mode !== "rule") {
if (node.name === "icss-import") {
const matches = balancedQuotes.exec(node.params);
if (matches) {
addImports(node, matches[1]);
}
}
if (node.name === "icss-export") {
addExports(node);
}
}
});
return { icssImports, icssExports };
};
var extractICSS_1 = extractICSS$2;
const createImports = (imports, postcss, mode = "rule") => {
return Object.keys(imports).map((path) => {
const aliases = imports[path];
const declarations = Object.keys(aliases).map((key) =>
postcss.decl({
prop: key,
value: aliases[key],
raws: { before: "\n " },
})
);
const hasDeclarations = declarations.length > 0;
const rule =
mode === "rule"
? postcss.rule({
selector: `:import('${path}')`,
raws: { after: hasDeclarations ? "\n" : "" },
})
: postcss.atRule({
name: "icss-import",
params: `'${path}'`,
raws: { after: hasDeclarations ? "\n" : "" },
});
if (hasDeclarations) {
rule.append(declarations);
}
return rule;
});
};
const createExports = (exports, postcss, mode = "rule") => {
const declarations = Object.keys(exports).map((key) =>
postcss.decl({
prop: key,
value: exports[key],
raws: { before: "\n " },
})
);
if (declarations.length === 0) {
return [];
}
const rule =
mode === "rule"
? postcss.rule({
selector: `:export`,
raws: { after: "\n" },
})
: postcss.atRule({
name: "icss-export",
raws: { after: "\n" },
});
rule.append(declarations);
return [rule];
};
const createICSSRules$1 = (imports, exports, postcss, mode) => [
...createImports(imports, postcss, mode),
...createExports(exports, postcss, mode),
];
var createICSSRules_1 = createICSSRules$1;
const replaceValueSymbols = replaceValueSymbols_1;
const replaceSymbols = replaceSymbols_1;
const extractICSS$1 = extractICSS_1;
const createICSSRules = createICSSRules_1;
var src$4 = {
replaceValueSymbols,
replaceSymbols,
extractICSS: extractICSS$1,
createICSSRules,
};
Object.defineProperty(Parser$1, "__esModule", {
value: true
});
Parser$1.default = void 0;
var _icssUtils = src$4;
// Initially copied from https://github.com/css-modules/css-modules-loader-core
const importRegexp = /^:import\((.+)\)$/;
class Parser {
constructor(pathFetcher, trace) {
this.pathFetcher = pathFetcher;
this.plugin = this.plugin.bind(this);
this.exportTokens = {};
this.translations = {};
this.trace = trace;
}
plugin() {
const parser = this;
return {
postcssPlugin: "css-modules-parser",
async OnceExit(css) {
await Promise.all(parser.fetchAllImports(css));
parser.linkImportedSymbols(css);
return parser.extractExports(css);
}
};
}
fetchAllImports(css) {
let imports = [];
css.each(node => {
if (node.type == "rule" && node.selector.match(importRegexp)) {
imports.push(this.fetchImport(node, css.source.input.from, imports.length));
}
});
return imports;
}
linkImportedSymbols(css) {
(0, _icssUtils.replaceSymbols)(css, this.translations);
}
extractExports(css) {
css.each(node => {
if (node.type == "rule" && node.selector == ":export") this.handleExport(node);
});
}
handleExport(exportNode) {
exportNode.each(decl => {
if (decl.type == "decl") {
Object.keys(this.translations).forEach(translation => {
decl.value = decl.value.replace(translation, this.translations[translation]);
});
this.exportTokens[decl.prop] = decl.value;
}
});
exportNode.remove();
}
async fetchImport(importNode, relativeTo, depNr) {
const file = importNode.selector.match(importRegexp)[1];
const depTrace = this.trace + String.fromCharCode(depNr);
const exports = await this.pathFetcher(file, relativeTo, depTrace);
try {
importNode.each(decl => {
if (decl.type == "decl") {
this.translations[decl.prop] = exports[decl.value];
}
});
importNode.remove();
} catch (err) {
console.log(err);
}
}
}
Parser$1.default = Parser;
var saveJSON$1 = {};
Object.defineProperty(saveJSON$1, "__esModule", {
value: true
});
saveJSON$1.default = saveJSON;
var _fs$2 = fs;
function saveJSON(cssFile, json) {
return new Promise((resolve, reject) => {
const {
writeFile
} = (0, _fs$2.getFileSystem)();
writeFile(`${cssFile}.json`, JSON.stringify(json), e => e ? reject(e) : resolve(json));
});
}
var localsConvention = {};
/**
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/** Used to match words composed of alphanumeric characters. */
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
/** Used to match Latin Unicode letters (excluding mathematical operators). */
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
rsComboSymbolsRange = '\\u20d0-\\u20f0',
rsDingbatRange = '\\u2700-\\u27bf',
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
rsPunctuationRange = '\\u2000-\\u206f',
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
rsVarRange = '\\ufe0e\\ufe0f',
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
/** Used to compose unicode capture groups. */
var rsApos = "['\u2019]",
rsAstral = '[' + rsAstralRange + ']',
rsBreak = '[' + rsBreakRange + ']',
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
rsDigits = '\\d+',
rsDingbat = '[' + rsDingbatRange + ']',
rsLower = '[' + rsLowerRange + ']',
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
rsFitz = '\\ud83c[\\udffb-\\udfff]',
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
rsNonAstral = '[^' + rsAstralRange + ']',
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
rsUpper = '[' + rsUpperRange + ']',
rsZWJ = '\\u200d';
/** Used to compose unicode regexes. */
var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
reOptMod = rsModifier + '?',
rsOptVar = '[' + rsVarRange + ']?',
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
rsSeq = rsOptVar + reOptMod + rsOptJoin,
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
/** Used to match apostrophes. */
var reApos = RegExp(rsApos, 'g');
/**
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
*/
var reComboMark = RegExp(rsCombo, 'g');
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
/** Used to match complex or compound words. */
var reUnicodeWord = RegExp([
rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
rsUpper + '+' + rsOptUpperContr,
rsDigits,
rsEmoji
].join('|'), 'g');
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
/** Used to detect strings that need a more robust regexp to match words. */
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
/** Used to map Latin Unicode letters to basic Latin letters. */
var deburredLetters = {
// Latin-1 Supplement block.
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
'\xc7': 'C', '\xe7': 'c',
'\xd0': 'D', '\xf0': 'd',
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
'\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
'\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
'\xd1': 'N', '\xf1': 'n',
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
'\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
'\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
'\xc6': 'Ae', '\xe6': 'ae',
'\xde': 'Th', '\xfe': 'th',
'\xdf': 'ss',
// Latin Extended-A block.
'\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
'\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
'\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
'\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
'\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
'\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
'\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
'\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
'\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
'\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
'\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
'\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
'\u0134': 'J', '\u0135': 'j',
'\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
'\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
'\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
'\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
'\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
'\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
'\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
'\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
'\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
'\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
'\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
'\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
'\u0163': 't', '\u0165': 't', '\u0167': 't',
'\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
'\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
'\u0174': 'W', '\u0175': 'w',
'\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
'\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
'\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
'\u0132': 'IJ', '\u0133': 'ij',
'\u0152': 'Oe', '\u0153': 'oe',
'\u0149': "'n", '\u017f': 'ss'
};
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root$2 = freeGlobal || freeSelf || Function('return this')();
/**
* A specialized version of `_.reduce` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @param {boolean} [initAccum] Specify using the first element of `array` as
* the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1,
length = array ? array.length : 0;
if (initAccum && length) {
accumulator = array[++index];
}
while (++index < length) {
accumulator = iteratee(accumulator, array[index], index, array);
}
return accumulator;
}
/**
* Converts an ASCII `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function asciiToArray(string) {
return string.split('');
}
/**
* Splits an ASCII `string` into an array of its words.
*
* @private
* @param {string} The string to inspect.
* @returns {Array} Returns the words of `string`.
*/
function asciiWords(string) {
return string.match(reAsciiWord) || [];
}
/**
* The base implementation of `_.propertyOf` without support for deep paths.
*
* @private
* @param {Object} object The object to query.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyOf(object) {
return function(key) {
return object == null ? undefined : object[key];
};
}
/**
* Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
* letters to basic Latin letters.
*
* @private
* @param {string} letter The matched letter to deburr.
* @returns {string} Returns the deburred letter.
*/
var deburrLetter = basePropertyOf(deburredLetters);
/**
* Checks if `string` contains Unicode symbols.
*
* @private
* @param {string} string The string to inspect.
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
*/
function hasUnicode(string) {
return reHasUnicode.test(string);
}
/**
* Checks if `string` contains a word composed of Unicode symbols.
*
* @private
* @param {string} string The string to inspect.
* @returns {boolean} Returns `true` if a word is found, else `false`.
*/
function hasUnicodeWord(string) {
return reHasUnicodeWord.test(string);
}
/**
* Converts `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function stringToArray(string) {
return hasUnicode(string)
? unicodeToArray(string)
: asciiToArray(string);
}
/**
* Converts a Unicode `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function unicodeToArray(string) {
return string.match(reUnicode) || [];
}
/**
* Splits a Unicode `string` into an array of its words.
*
* @private
* @param {string} The string to inspect.
* @returns {Array} Returns the words of `string`.
*/
function unicodeWords(string) {
return string.match(reUnicodeWord) || [];
}
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Built-in value references. */
var Symbol$1 = root$2.Symbol;
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
/**
* The base implementation of `_.slice` without an iteratee call guard.
*
* @private
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the slice of `array`.
*/
function baseSlice(array, start, end) {
var index = -1,
length = array.length;
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : ((end - start) >>> 0);
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}
return result;
}
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
/**
* Casts `array` to a slice if it's needed.
*
* @private
* @param {Array} array The array to inspect.
* @param {number} start The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the cast slice.
*/
function castSlice(array, start, end) {
var length = array.length;
end = end === undefined ? length : end;
return (!start && end >= length) ? array : baseSlice(array, start, end);
}
/**
* Creates a function like `_.lowerFirst`.
*
* @private
* @param {string} methodName The name of the `String` case method to use.
* @returns {Function} Returns the new case function.
*/
function createCaseFirst(methodName) {
return function(string) {
string = toString(string);
var strSymbols = hasUnicode(string)
? stringToArray(string)
: undefined;
var chr = strSymbols
? strSymbols[0]
: string.charAt(0);
var trailing = strSymbols
? castSlice(strSymbols, 1).join('')
: string.slice(1);
return chr[methodName]() + trailing;
};
}
/**
* Creates a function like `_.camelCase`.
*
* @private
* @param {Function} callback The function to combine each word.
* @returns {Function} Returns the new compounder function.
*/
function createCompounder(callback) {
return function(string) {
return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
};
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
}
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {string} Returns the string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : baseToString(value);
}
/**
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the camel cased string.
* @example
*
* _.camelCase('Foo Bar');
* // => 'fooBar'
*
* _.camelCase('--foo-bar--');
* // => 'fooBar'
*
* _.camelCase('__FOO_BAR__');
* // => 'fooBar'
*/
var camelCase = createCompounder(function(result, word, index) {
word = word.toLowerCase();
return result + (index ? capitalize(word) : word);
});
/**
* Converts the first character of `string` to upper case and the remaining
* to lower case.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to capitalize.
* @returns {string} Returns the capitalized string.
* @example
*
* _.capitalize('FRED');
* // => 'Fred'
*/
function capitalize(string) {
return upperFirst(toString(string).toLowerCase());
}
/**
* Deburrs `string` by converting
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
* letters to basic Latin letters and removing
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to deburr.
* @returns {string} Returns the deburred string.
* @example
*
* _.deburr('déjà vu');
* // => 'deja vu'
*/
function deburr(string) {
string = toString(string);
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
}
/**
* Converts the first character of `string` to upper case.
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.upperFirst('fred');
* // => 'Fred'
*
* _.upperFirst('FRED');
* // => 'FRED'
*/
var upperFirst = createCaseFirst('toUpperCase');
/**
* Splits `string` into an array of its words.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to inspect.
* @param {RegExp|string} [pattern] The pattern to match words.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the words of `string`.
* @example
*
* _.words('fred, barney, & pebbles');
* // => ['fred', 'barney', 'pebbles']
*
* _.words('fred, barney, & pebbles', /[^, ]+/g);
* // => ['fred', 'barney', '&', 'pebbles']
*/
function words(string, pattern, guard) {
string = toString(string);
pattern = guard ? undefined : pattern;
if (pattern === undefined) {
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
}
return string.match(pattern) || [];
}
var lodash_camelcase = camelCase;
Object.defineProperty(localsConvention, "__esModule", {
value: true
});
localsConvention.makeLocalsConventionReducer = makeLocalsConventionReducer;
var _lodash = _interopRequireDefault$5(lodash_camelcase);
function _interopRequireDefault$5(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function dashesCamelCase(string) {
return string.replace(/-+(\w)/g, (_, firstLetter) => firstLetter.toUpperCase());
}
function makeLocalsConventionReducer(localsConvention, inputFile) {
const isFunc = typeof localsConvention === "function";
return (tokens, [className, value]) => {
if (isFunc) {
const convention = localsConvention(className, value, inputFile);
tokens[convention] = value;
return tokens;
}
switch (localsConvention) {
case "camelCase":
tokens[className] = value;
tokens[(0, _lodash.default)(className)] = value;
break;
case "camelCaseOnly":
tokens[(0, _lodash.default)(className)] = value;
break;
case "dashes":
tokens[className] = value;
tokens[dashesCamelCase(className)] = value;
break;
case "dashesOnly":
tokens[dashesCamelCase(className)] = value;
break;
}
return tokens;
};
}
var FileSystemLoader$1 = {};
Object.defineProperty(FileSystemLoader$1, "__esModule", {
value: true
});
FileSystemLoader$1.default = void 0;
var _postcss$1 = _interopRequireDefault$4(postcss$1);
var _path = _interopRequireDefault$4(require$$0$4);
var _Parser$1 = _interopRequireDefault$4(Parser$1);
var _fs$1 = fs;
function _interopRequireDefault$4(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Initially copied from https://github.com/css-modules/css-modules-loader-core
class Core {
constructor(plugins) {
this.plugins = plugins || Core.defaultPlugins;
}
async load(sourceString, sourcePath, trace, pathFetcher) {
const parser = new _Parser$1.default(pathFetcher, trace);
const plugins = this.plugins.concat([parser.plugin()]);
const result = await (0, _postcss$1.default)(plugins).process(sourceString, {
from: sourcePath
});
return {
injectableSource: result.css,
exportTokens: parser.exportTokens
};
}
} // Sorts dependencies in the following way:
// AAA comes before AA and A
// AB comes after AA and before A
// All Bs come after all As
// This ensures that the files are always returned in the following order:
// - In the order they were required, except
// - After all their dependencies
const traceKeySorter = (a, b) => {
if (a.length < b.length) {
return a < b.substring(0, a.length) ? -1 : 1;
}
if (a.length > b.length) {
return a.substring(0, b.length) <= b ? -1 : 1;
}
return a < b ? -1 : 1;
};
class FileSystemLoader {
constructor(root, plugins, fileResolve) {
if (root === "/" && process.platform === "win32") {
const cwdDrive = process.cwd().slice(0, 3);
if (!/^[A-Za-z]:\\$/.test(cwdDrive)) {
throw new Error(`Failed to obtain root from "${process.cwd()}".`);
}
root = cwdDrive;
}
this.root = root;
this.fileResolve = fileResolve;
this.sources = {};
this.traces = {};
this.importNr = 0;
this.core = new Core(plugins);
this.tokensByFile = {};
this.fs = (0, _fs$1.getFileSystem)();
}
async fetch(_newPath, relativeTo, _trace) {
const newPath = _newPath.replace(/^["']|["']$/g, "");
const trace = _trace || String.fromCharCode(this.importNr++);
const useFileResolve = typeof this.fileResolve === "function";
const fileResolvedPath = useFileResolve ? await this.fileResolve(newPath, relativeTo) : await Promise.resolve();
if (fileResolvedPath && !_path.default.isAbsolute(fileResolvedPath)) {
throw new Error('The returned path from the "fileResolve" option must be absolute.');
}
const relativeDir = _path.default.dirname(relativeTo);
const rootRelativePath = fileResolvedPath || _path.default.resolve(relativeDir, newPath);
let fileRelativePath = fileResolvedPath || _path.default.resolve(_path.default.resolve(this.root, relativeDir), newPath); // if the path is not relative or absolute, try to resolve it in node_modules
if (!useFileResolve && newPath[0] !== "." && !_path.default.isAbsolute(newPath)) {
try {
fileRelativePath = require.resolve(newPath);
} catch (e) {// noop
}
}
const tokens = this.tokensByFile[fileRelativePath];
if (tokens) return tokens;
return new Promise((resolve, reject) => {
this.fs.readFile(fileRelativePath, "utf-8", async (err, source) => {
if (err) reject(err);
const {
injectableSource,
exportTokens
} = await this.core.load(source, rootRelativePath, trace, this.fetch.bind(this));
this.sources[fileRelativePath] = injectableSource;
this.traces[trace] = fileRelativePath;
this.tokensByFile[fileRelativePath] = exportTokens;
resolve(exportTokens);
});
});
}
get finalSource() {
const traces = this.traces;
const sources = this.sources;
let written = new Set();
return Object.keys(traces).sort(traceKeySorter).map(key => {
const filename = traces[key];
if (written.has(filename)) {
return null;
}
written.add(filename);
return sources[filename];
}).join("");
}
}
FileSystemLoader$1.default = FileSystemLoader;
var scoping = {};
var src$3 = {exports: {}};
const PERMANENT_MARKER = 2;
const TEMPORARY_MARKER = 1;
function createError(node, graph) {
const er = new Error("Nondeterministic import's order");
const related = graph[node];
const relatedNode = related.find(
(relatedNode) => graph[relatedNode].indexOf(node) > -1
);
er.nodes = [node, relatedNode];
return er;
}
function walkGraph(node, graph, state, result, strict) {
if (state[node] === PERMANENT_MARKER) {
return;
}
if (state[node] === TEMPORARY_MARKER) {
if (strict) {
return createError(node, graph);
}
return;
}
state[node] = TEMPORARY_MARKER;
const children = graph[node];
const length = children.length;
for (let i = 0; i < length; ++i) {
const error = walkGraph(children[i], graph, state, result, strict);
if (error instanceof Error) {
return error;
}
}
state[node] = PERMANENT_MARKER;
result.push(node);
}
function topologicalSort$1(graph, strict) {
const result = [];
const state = {};
const nodes = Object.keys(graph);
const length = nodes.length;
for (let i = 0; i < length; ++i) {
const er = walkGraph(nodes[i], graph, state, result, strict);
if (er instanceof Error) {
return er;
}
}
return result;
}
var topologicalSort_1 = topologicalSort$1;
const topologicalSort = topologicalSort_1;
const matchImports$1 = /^(.+?)\s+from\s+(?:"([^"]+)"|'([^']+)'|(global))$/;
const icssImport = /^:import\((?:"([^"]+)"|'([^']+)')\)/;
const VISITED_MARKER = 1;
/**
* :import('G') {}
*
* Rule
* composes: ... from 'A'
* composes: ... from 'B'
* Rule
* composes: ... from 'A'
* composes: ... from 'A'
* composes: ... from 'C'
*
* Results in:
*
* graph: {
* G: [],
* A: [],
* B: ['A'],
* C: ['A'],
* }
*/
function addImportToGraph(importId, parentId, graph, visited) {
const siblingsId = parentId + "_" + "siblings";
const visitedId = parentId + "_" + importId;
if (visited[visitedId] !== VISITED_MARKER) {
if (!Array.isArray(visited[siblingsId])) {
visited[siblingsId] = [];
}
const siblings = visited[siblingsId];
if (Array.isArray(graph[importId])) {
graph[importId] = graph[importId].concat(siblings);
} else {
graph[importId] = siblings.slice();
}
visited[visitedId] = VISITED_MARKER;
siblings.push(importId);
}
}
src$3.exports = (options = {}) => {
let importIndex = 0;
const createImportedName =
typeof options.createImportedName !== "function"
? (importName /*, path*/) =>
`i__imported_${importName.replace(/\W/g, "_")}_${importIndex++}`
: options.createImportedName;
const failOnWrongOrder = options.failOnWrongOrder;
return {
postcssPlugin: "postcss-modules-extract-imports",
prepare() {
const graph = {};
const visited = {};
const existingImports = {};
const importDecls = {};
const imports = {};
return {
Once(root, postcss) {
// Check the existing imports order and save refs
root.walkRules((rule) => {
const matches = icssImport.exec(rule.selector);
if (matches) {
const [, /*match*/ doubleQuotePath, singleQuotePath] = matches;
const importPath = doubleQuotePath || singleQuotePath;
addImportToGraph(importPath, "root", graph, visited);
existingImports[importPath] = rule;
}
});
root.walkDecls(/^composes$/, (declaration) => {
const matches = declaration.value.match(matchImports$1);
if (!matches) {
return;
}
let tmpSymbols;
let [
,
/*match*/ symbols,
doubleQuotePath,
singleQuotePath,
global,
] = matches;
if (global) {
// Composing globals simply means changing these classes to wrap them in global(name)
tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`);
} else {
const importPath = doubleQuotePath || singleQuotePath;
let parent = declaration.parent;
let parentIndexes = "";
while (parent.type !== "root") {
parentIndexes =
parent.parent.index(parent) + "_" + parentIndexes;
parent = parent.parent;
}
const { selector } = declaration.parent;
const parentRule = `_${parentIndexes}${selector}`;
addImportToGraph(importPath, parentRule, graph, visited);
importDecls[importPath] = declaration;
imports[importPath] = imports[importPath] || {};
tmpSymbols = symbols.split(/\s+/).map((s) => {
if (!imports[importPath][s]) {
imports[importPath][s] = createImportedName(s, importPath);
}
return imports[importPath][s];
});
}
declaration.value = tmpSymbols.join(" ");
});
const importsOrder = topologicalSort(graph, failOnWrongOrder);
if (importsOrder instanceof Error) {
const importPath = importsOrder.nodes.find((importPath) =>
// eslint-disable-next-line no-prototype-builtins
importDecls.hasOwnProperty(importPath)
);
const decl = importDecls[importPath];
throw decl.error(
"Failed to resolve order of composed modules " +
importsOrder.nodes
.map((importPath) => "`" + importPath + "`")
.join(", ") +
".",
{
plugin: "postcss-modules-extract-imports",
word: "composes",
}
);
}
let lastImportRule;
importsOrder.forEach((path) => {
const importedSymbols = imports[path];
let rule = existingImports[path];
if (!rule && importedSymbols) {
rule = postcss.rule({
selector: `:import("${path}")`,
raws: { after: "\n" },
});
if (lastImportRule) {
root.insertAfter(lastImportRule, rule);
} else {
root.prepend(rule);
}
}
lastImportRule = rule;
if (!importedSymbols) {
return;
}
Object.keys(importedSymbols).forEach((importedSymbol) => {
rule.append(
postcss.decl({
value: importedSymbol,
prop: importedSymbols[importedSymbol],
raws: { before: "\n " },
})
);
});
});
},
};
},
};
};
src$3.exports.postcss = true;
var srcExports$2 = src$3.exports;
var wasmHash = {exports: {}};
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var hasRequiredWasmHash;
function requireWasmHash () {
if (hasRequiredWasmHash) return wasmHash.exports;
hasRequiredWasmHash = 1;
// 65536 is the size of a wasm memory page
// 64 is the maximum chunk size for every possible wasm hash implementation
// 4 is the maximum number of bytes per char for string encoding (max is utf-8)
// ~3 makes sure that it's always a block of 4 chars, so avoid partially encoded bytes for base64
const MAX_SHORT_STRING = Math.floor((65536 - 64) / 4) & ~3;
class WasmHash {
/**
* @param {WebAssembly.Instance} instance wasm instance
* @param {WebAssembly.Instance[]} instancesPool pool of instances
* @param {number} chunkSize size of data chunks passed to wasm
* @param {number} digestSize size of digest returned by wasm
*/
constructor(instance, instancesPool, chunkSize, digestSize) {
const exports = /** @type {any} */ (instance.exports);
exports.init();
this.exports = exports;
this.mem = Buffer.from(exports.memory.buffer, 0, 65536);
this.buffered = 0;
this.instancesPool = instancesPool;
this.chunkSize = chunkSize;
this.digestSize = digestSize;
}
reset() {
this.buffered = 0;
this.exports.init();
}
/**
* @param {Buffer | string} data data
* @param {BufferEncoding=} encoding encoding
* @returns {this} itself
*/
update(data, encoding) {
if (typeof data === "string") {
while (data.length > MAX_SHORT_STRING) {
this._updateWithShortString(data.slice(0, MAX_SHORT_STRING), encoding);
data = data.slice(MAX_SHORT_STRING);
}
this._updateWithShortString(data, encoding);
return this;
}
this._updateWithBuffer(data);
return this;
}
/**
* @param {string} data data
* @param {BufferEncoding=} encoding encoding
* @returns {void}
*/
_updateWithShortString(data, encoding) {
const { exports, buffered, mem, chunkSize } = this;
let endPos;
if (data.length < 70) {
if (!encoding || encoding === "utf-8" || encoding === "utf8") {
endPos = buffered;
for (let i = 0; i < data.length; i++) {
const cc = data.charCodeAt(i);
if (cc < 0x80) {
mem[endPos++] = cc;
} else if (cc < 0x800) {
mem[endPos] = (cc >> 6) | 0xc0;
mem[endPos + 1] = (cc & 0x3f) | 0x80;
endPos += 2;
} else {
// bail-out for weird chars
endPos += mem.write(data.slice(i), endPos, encoding);
break;
}
}
} else if (encoding === "latin1") {
endPos = buffered;
for (let i = 0; i < data.length; i++) {
const cc = data.charCodeAt(i);
mem[endPos++] = cc;
}
} else {
endPos = buffered + mem.write(data, buffered, encoding);
}
} else {
endPos = buffered + mem.write(data, buffered, encoding);
}
if (endPos < chunkSize) {
this.buffered = endPos;
} else {
const l = endPos & ~(this.chunkSize - 1);
exports.update(l);
const newBuffered = endPos - l;
this.buffered = newBuffered;
if (newBuffered > 0) {
mem.copyWithin(0, l, endPos);
}
}
}
/**
* @param {Buffer} data data
* @returns {void}
*/
_updateWithBuffer(data) {
const { exports, buffered, mem } = this;
const length = data.length;
if (buffered + length < this.chunkSize) {
data.copy(mem, buffered, 0, length);
this.buffered += length;
} else {
const l = (buffered + length) & ~(this.chunkSize - 1);
if (l > 65536) {
let i = 65536 - buffered;
data.copy(mem, buffered, 0, i);
exports.update(65536);
const stop = l - buffered - 65536;
while (i < stop) {
data.copy(mem, 0, i, i + 65536);
exports.update(65536);
i += 65536;
}
data.copy(mem, 0, i, l - buffered);
exports.update(l - buffered - i);
} else {
data.copy(mem, buffered, 0, l - buffered);
exports.update(l);
}
const newBuffered = length + buffered - l;
this.buffered = newBuffered;
if (newBuffered > 0) {
data.copy(mem, 0, length - newBuffered, length);
}
}
}
digest(type) {
const { exports, buffered, mem, digestSize } = this;
exports.final(buffered);
this.instancesPool.push(this);
const hex = mem.toString("latin1", 0, digestSize);
if (type === "hex") {
return hex;
}
if (type === "binary" || !type) {
return Buffer.from(hex, "hex");
}
return Buffer.from(hex, "hex").toString(type);
}
}
const create = (wasmModule, instancesPool, chunkSize, digestSize) => {
if (instancesPool.length > 0) {
const old = instancesPool.pop();
old.reset();
return old;
} else {
return new WasmHash(
new WebAssembly.Instance(wasmModule),
instancesPool,
chunkSize,
digestSize
);
}
};
wasmHash.exports = create;
wasmHash.exports.MAX_SHORT_STRING = MAX_SHORT_STRING;
return wasmHash.exports;
}
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var xxhash64_1;
var hasRequiredXxhash64;
function requireXxhash64 () {
if (hasRequiredXxhash64) return xxhash64_1;
hasRequiredXxhash64 = 1;
const create = requireWasmHash();
//#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1
const xxhash64 = new WebAssembly.Module(
Buffer.from(
// 1173 bytes
"AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrUIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqwYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEACfyACIAE1AgBCh5Wvr5i23puef36FQheJQs/W077Sx6vZQn5C+fPd8Zn2masWfCECIAFBBGoLIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAiACQh2IhUL5893xmfaZqxZ+IgIgAkIgiIUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL",
"base64"
)
);
//#endregion
xxhash64_1 = create.bind(null, xxhash64, [], 32, 16);
return xxhash64_1;
}
var BatchedHash_1;
var hasRequiredBatchedHash;
function requireBatchedHash () {
if (hasRequiredBatchedHash) return BatchedHash_1;
hasRequiredBatchedHash = 1;
const MAX_SHORT_STRING = requireWasmHash().MAX_SHORT_STRING;
class BatchedHash {
constructor(hash) {
this.string = undefined;
this.encoding = undefined;
this.hash = hash;
}
/**
* Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
* @param {string|Buffer} data data
* @param {string=} inputEncoding data encoding
* @returns {this} updated hash
*/
update(data, inputEncoding) {
if (this.string !== undefined) {
if (
typeof data === "string" &&
inputEncoding === this.encoding &&
this.string.length + data.length < MAX_SHORT_STRING
) {
this.string += data;
return this;
}
this.hash.update(this.string, this.encoding);
this.string = undefined;
}
if (typeof data === "string") {
if (
data.length < MAX_SHORT_STRING &&
// base64 encoding is not valid since it may contain padding chars
(!inputEncoding || !inputEncoding.startsWith("ba"))
) {
this.string = data;
this.encoding = inputEncoding;
} else {
this.hash.update(data, inputEncoding);
}
} else {
this.hash.update(data);
}
return this;
}
/**
* Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
* @param {string=} encoding encoding of the return value
* @returns {string|Buffer} digest
*/
digest(encoding) {
if (this.string !== undefined) {
this.hash.update(this.string, this.encoding);
}
return this.hash.digest(encoding);
}
}
BatchedHash_1 = BatchedHash;
return BatchedHash_1;
}
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var md4_1;
var hasRequiredMd4;
function requireMd4 () {
if (hasRequiredMd4) return md4_1;
hasRequiredMd4 = 1;
const create = requireWasmHash();
//#region wasm code: md4 (../../../assembly/hash/md4.asm.ts) --initialMemory 1
const md4 = new WebAssembly.Module(
Buffer.from(
// 2150 bytes
"AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwciBARpbml0AAAGdXBkYXRlAAIFZmluYWwAAwZtZW1vcnkCAAqFEAQmAEGBxpS6BiQBQYnXtv5+JAJB/rnrxXkkA0H2qMmBASQEQQAkAAvMCgEYfyMBIQojAiEGIwMhByMEIQgDQCAAIAVLBEAgBSgCCCINIAcgBiAFKAIEIgsgCCAHIAUoAgAiDCAKIAggBiAHIAhzcXNqakEDdyIDIAYgB3Nxc2pqQQd3IgEgAyAGc3FzampBC3chAiAFKAIUIg8gASACIAUoAhAiCSADIAEgBSgCDCIOIAYgAyACIAEgA3Nxc2pqQRN3IgQgASACc3FzampBA3ciAyACIARzcXNqakEHdyEBIAUoAiAiEiADIAEgBSgCHCIRIAQgAyAFKAIYIhAgAiAEIAEgAyAEc3FzampBC3ciAiABIANzcXNqakETdyIEIAEgAnNxc2pqQQN3IQMgBSgCLCIVIAQgAyAFKAIoIhQgAiAEIAUoAiQiEyABIAIgAyACIARzcXNqakEHdyIBIAMgBHNxc2pqQQt3IgIgASADc3FzampBE3chBCAPIBAgCSAVIBQgEyAFKAI4IhYgAiAEIAUoAjQiFyABIAIgBSgCMCIYIAMgASAEIAEgAnNxc2pqQQN3IgEgAiAEc3FzampBB3ciAiABIARzcXNqakELdyIDIAkgAiAMIAEgBSgCPCIJIAQgASADIAEgAnNxc2pqQRN3IgEgAiADcnEgAiADcXJqakGZ84nUBWpBA3ciAiABIANycSABIANxcmpqQZnzidQFakEFdyIEIAEgAnJxIAEgAnFyaiASakGZ84nUBWpBCXciAyAPIAQgCyACIBggASADIAIgBHJxIAIgBHFyampBmfOJ1AVqQQ13IgEgAyAEcnEgAyAEcXJqakGZ84nUBWpBA3ciAiABIANycSABIANxcmpqQZnzidQFakEFdyIEIAEgAnJxIAEgAnFyampBmfOJ1AVqQQl3IgMgECAEIAIgFyABIAMgAiAEcnEgAiAEcXJqakGZ84nUBWpBDXciASADIARycSADIARxcmogDWpBmfOJ1AVqQQN3IgIgASADcnEgASADcXJqakGZ84nUBWpBBXciBCABIAJycSABIAJxcmpqQZnzidQFakEJdyIDIBEgBCAOIAIgFiABIAMgAiAEcnEgAiAEcXJqakGZ84nUBWpBDXciASADIARycSADIARxcmpqQZnzidQFakEDdyICIAEgA3JxIAEgA3FyampBmfOJ1AVqQQV3IgQgASACcnEgASACcXJqakGZ84nUBWpBCXciAyAMIAIgAyAJIAEgAyACIARycSACIARxcmpqQZnzidQFakENdyIBcyAEc2pqQaHX5/YGakEDdyICIAQgASACcyADc2ogEmpBodfn9gZqQQl3IgRzIAFzampBodfn9gZqQQt3IgMgAiADIBggASADIARzIAJzampBodfn9gZqQQ93IgFzIARzaiANakGh1+f2BmpBA3ciAiAUIAQgASACcyADc2pqQaHX5/YGakEJdyIEcyABc2pqQaHX5/YGakELdyIDIAsgAiADIBYgASADIARzIAJzampBodfn9gZqQQ93IgFzIARzampBodfn9gZqQQN3IgIgEyAEIAEgAnMgA3NqakGh1+f2BmpBCXciBHMgAXNqakGh1+f2BmpBC3chAyAKIA4gAiADIBcgASADIARzIAJzampBodfn9gZqQQ93IgFzIARzampBodfn9gZqQQN3IgJqIQogBiAJIAEgESADIAIgFSAEIAEgAnMgA3NqakGh1+f2BmpBCXciBHMgAXNqakGh1+f2BmpBC3ciAyAEcyACc2pqQaHX5/YGakEPd2ohBiADIAdqIQcgBCAIaiEIIAVBQGshBQwBCwsgCiQBIAYkAiAHJAMgCCQECw0AIAAQASMAIABqJAAL/wQCA38BfiMAIABqrUIDhiEEIABByABqQUBxIgJBCGshAyAAIgFBAWohACABQYABOgAAA0AgACACSUEAIABBB3EbBEAgAEEAOgAAIABBAWohAAwBCwsDQCAAIAJJBEAgAEIANwMAIABBCGohAAwBCwsgAyAENwMAIAIQAUEAIwGtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEIIwKtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEQIwOtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEYIwStIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAAs=",
"base64"
)
);
//#endregion
md4_1 = create.bind(null, md4, [], 64, 32);
return md4_1;
}
var BulkUpdateDecorator_1;
var hasRequiredBulkUpdateDecorator;
function requireBulkUpdateDecorator () {
if (hasRequiredBulkUpdateDecorator) return BulkUpdateDecorator_1;
hasRequiredBulkUpdateDecorator = 1;
const BULK_SIZE = 2000;
// We are using an object instead of a Map as this will stay static during the runtime
// so access to it can be optimized by v8
const digestCaches = {};
class BulkUpdateDecorator {
/**
* @param {Hash | function(): Hash} hashOrFactory function to create a hash
* @param {string=} hashKey key for caching
*/
constructor(hashOrFactory, hashKey) {
this.hashKey = hashKey;
if (typeof hashOrFactory === "function") {
this.hashFactory = hashOrFactory;
this.hash = undefined;
} else {
this.hashFactory = undefined;
this.hash = hashOrFactory;
}
this.buffer = "";
}
/**
* Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
* @param {string|Buffer} data data
* @param {string=} inputEncoding data encoding
* @returns {this} updated hash
*/
update(data, inputEncoding) {
if (
inputEncoding !== undefined ||
typeof data !== "string" ||
data.length > BULK_SIZE
) {
if (this.hash === undefined) {
this.hash = this.hashFactory();
}
if (this.buffer.length > 0) {
this.hash.update(this.buffer);
this.buffer = "";
}
this.hash.update(data, inputEncoding);
} else {
this.buffer += data;
if (this.buffer.length > BULK_SIZE) {
if (this.hash === undefined) {
this.hash = this.hashFactory();
}
this.hash.update(this.buffer);
this.buffer = "";
}
}
return this;
}
/**
* Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
* @param {string=} encoding encoding of the return value
* @returns {string|Buffer} digest
*/
digest(encoding) {
let digestCache;
const buffer = this.buffer;
if (this.hash === undefined) {
// short data for hash, we can use caching
const cacheKey = `${this.hashKey}-${encoding}`;
digestCache = digestCaches[cacheKey];
if (digestCache === undefined) {
digestCache = digestCaches[cacheKey] = new Map();
}
const cacheEntry = digestCache.get(buffer);
if (cacheEntry !== undefined) {
return cacheEntry;
}
this.hash = this.hashFactory();
}
if (buffer.length > 0) {
this.hash.update(buffer);
}
const digestResult = this.hash.digest(encoding);
if (digestCache !== undefined) {
digestCache.set(buffer, digestResult);
}
return digestResult;
}
}
BulkUpdateDecorator_1 = BulkUpdateDecorator;
return BulkUpdateDecorator_1;
}
const baseEncodeTables = {
26: "abcdefghijklmnopqrstuvwxyz",
32: "123456789abcdefghjkmnpqrstuvwxyz", // no 0lio
36: "0123456789abcdefghijklmnopqrstuvwxyz",
49: "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ", // no lIO
52: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
58: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ", // no 0lIO
62: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
64: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_",
};
/**
* @param {Uint32Array} uint32Array Treated as a long base-0x100000000 number, little endian
* @param {number} divisor The divisor
* @return {number} Modulo (remainder) of the division
*/
function divmod32(uint32Array, divisor) {
let carry = 0;
for (let i = uint32Array.length - 1; i >= 0; i--) {
const value = carry * 0x100000000 + uint32Array[i];
carry = value % divisor;
uint32Array[i] = Math.floor(value / divisor);
}
return carry;
}
function encodeBufferToBase(buffer, base, length) {
const encodeTable = baseEncodeTables[base];
if (!encodeTable) {
throw new Error("Unknown encoding base" + base);
}
// Input bits are only enough to generate this many characters
const limit = Math.ceil((buffer.length * 8) / Math.log2(base));
length = Math.min(length, limit);
// Most of the crypto digests (if not all) has length a multiple of 4 bytes.
// Fewer numbers in the array means faster math.
const uint32Array = new Uint32Array(Math.ceil(buffer.length / 4));
// Make sure the input buffer data is copied and is not mutated by reference.
// divmod32() would corrupt the BulkUpdateDecorator cache otherwise.
buffer.copy(Buffer.from(uint32Array.buffer));
let output = "";
for (let i = 0; i < length; i++) {
output = encodeTable[divmod32(uint32Array, base)] + output;
}
return output;
}
let crypto = undefined;
let createXXHash64 = undefined;
let createMd4 = undefined;
let BatchedHash = undefined;
let BulkUpdateDecorator = undefined;
function getHashDigest$1(buffer, algorithm, digestType, maxLength) {
algorithm = algorithm || "xxhash64";
maxLength = maxLength || 9999;
let hash;
if (algorithm === "xxhash64") {
if (createXXHash64 === undefined) {
createXXHash64 = requireXxhash64();
if (BatchedHash === undefined) {
BatchedHash = requireBatchedHash();
}
}
hash = new BatchedHash(createXXHash64());
} else if (algorithm === "md4") {
if (createMd4 === undefined) {
createMd4 = requireMd4();
if (BatchedHash === undefined) {
BatchedHash = requireBatchedHash();
}
}
hash = new BatchedHash(createMd4());
} else if (algorithm === "native-md4") {
if (typeof crypto === "undefined") {
crypto = require$$3$1;
if (BulkUpdateDecorator === undefined) {
BulkUpdateDecorator = requireBulkUpdateDecorator();
}
}
hash = new BulkUpdateDecorator(() => crypto.createHash("md4"), "md4");
} else {
if (typeof crypto === "undefined") {
crypto = require$$3$1;
if (BulkUpdateDecorator === undefined) {
BulkUpdateDecorator = requireBulkUpdateDecorator();
}
}
hash = new BulkUpdateDecorator(
() => crypto.createHash(algorithm),
algorithm
);
}
hash.update(buffer);
if (
digestType === "base26" ||
digestType === "base32" ||
digestType === "base36" ||
digestType === "base49" ||
digestType === "base52" ||
digestType === "base58" ||
digestType === "base62"
) {
return encodeBufferToBase(hash.digest(), digestType.substr(4), maxLength);
} else {
return hash.digest(digestType || "hex").substr(0, maxLength);
}
}
var getHashDigest_1 = getHashDigest$1;
const path$1 = require$$0$4;
const getHashDigest = getHashDigest_1;
function interpolateName$1(loaderContext, name, options = {}) {
let filename;
const hasQuery =
loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1;
if (typeof name === "function") {
filename = name(
loaderContext.resourcePath,
hasQuery ? loaderContext.resourceQuery : undefined
);
} else {
filename = name || "[hash].[ext]";
}
const context = options.context;
const content = options.content;
const regExp = options.regExp;
let ext = "bin";
let basename = "file";
let directory = "";
let folder = "";
let query = "";
if (loaderContext.resourcePath) {
const parsed = path$1.parse(loaderContext.resourcePath);
let resourcePath = loaderContext.resourcePath;
if (parsed.ext) {
ext = parsed.ext.substr(1);
}
if (parsed.dir) {
basename = parsed.name;
resourcePath = parsed.dir + path$1.sep;
}
if (typeof context !== "undefined") {
directory = path$1
.relative(context, resourcePath + "_")
.replace(/\\/g, "/")
.replace(/\.\.(\/)?/g, "_$1");
directory = directory.substr(0, directory.length - 1);
} else {
directory = resourcePath.replace(/\\/g, "/").replace(/\.\.(\/)?/g, "_$1");
}
if (directory.length === 1) {
directory = "";
} else if (directory.length > 1) {
folder = path$1.basename(directory);
}
}
if (loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1) {
query = loaderContext.resourceQuery;
const hashIdx = query.indexOf("#");
if (hashIdx >= 0) {
query = query.substr(0, hashIdx);
}
}
let url = filename;
if (content) {
// Match hash template
url = url
// `hash` and `contenthash` are same in `loader-utils` context
// let's keep `hash` for backward compatibility
.replace(
/\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
(all, hashType, digestType, maxLength) =>
getHashDigest(content, hashType, digestType, parseInt(maxLength, 10))
);
}
url = url
.replace(/\[ext\]/gi, () => ext)
.replace(/\[name\]/gi, () => basename)
.replace(/\[path\]/gi, () => directory)
.replace(/\[folder\]/gi, () => folder)
.replace(/\[query\]/gi, () => query);
if (regExp && loaderContext.resourcePath) {
const match = loaderContext.resourcePath.match(new RegExp(regExp));
match &&
match.forEach((matched, i) => {
url = url.replace(new RegExp("\\[" + i + "\\]", "ig"), matched);
});
}
if (
typeof loaderContext.options === "object" &&
typeof loaderContext.options.customInterpolateName === "function"
) {
url = loaderContext.options.customInterpolateName.call(
loaderContext,
url,
name,
options
);
}
return url;
}
var interpolateName_1 = interpolateName$1;
var interpolateName = interpolateName_1;
var path = require$$0$4;
/**
* @param {string} pattern
* @param {object} options
* @param {string} options.context
* @param {string} options.hashPrefix
* @return {function}
*/
var genericNames = function createGenerator(pattern, options) {
options = options || {};
var context =
options && typeof options.context === "string"
? options.context
: process.cwd();
var hashPrefix =
options && typeof options.hashPrefix === "string" ? options.hashPrefix : "";
/**
* @param {string} localName Usually a class name
* @param {string} filepath Absolute path
* @return {string}
*/
return function generate(localName, filepath) {
var name = pattern.replace(/\[local\]/gi, localName);
var loaderContext = {
resourcePath: filepath,
};
var loaderOptions = {
content:
hashPrefix +
path.relative(context, filepath).replace(/\\/g, "/") +
"\x00" +
localName,
context: context,
};
var genericName = interpolateName(loaderContext, name, loaderOptions);
return genericName
.replace(new RegExp("[^a-zA-Z0-9\\-_\u00A0-\uFFFF]", "g"), "-")
.replace(/^((-?[0-9])|--)/, "_$1");
};
};
var src$2 = {exports: {}};
var dist = {exports: {}};
var processor = {exports: {}};
var parser = {exports: {}};
var root$1 = {exports: {}};
var container = {exports: {}};
var node$1 = {exports: {}};
var util = {};
var unesc = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = unesc;
// Many thanks for this post which made this migration much easier.
// https://mathiasbynens.be/notes/css-escapes
/**
*
* @param {string} str
* @returns {[string, number]|undefined}
*/
function gobbleHex(str) {
var lower = str.toLowerCase();
var hex = '';
var spaceTerminated = false;
for (var i = 0; i < 6 && lower[i] !== undefined; i++) {
var code = lower.charCodeAt(i); // check to see if we are dealing with a valid hex char [a-f|0-9]
var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
spaceTerminated = code === 32;
if (!valid) {
break;
}
hex += lower[i];
}
if (hex.length === 0) {
return undefined;
}
var codePoint = parseInt(hex, 16);
var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF; // Add special case for
// "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
// https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {
return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
}
return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
}
var CONTAINS_ESCAPE = /\\/;
function unesc(str) {
var needToProcess = CONTAINS_ESCAPE.test(str);
if (!needToProcess) {
return str;
}
var ret = "";
for (var i = 0; i < str.length; i++) {
if (str[i] === "\\") {
var gobbled = gobbleHex(str.slice(i + 1, i + 7));
if (gobbled !== undefined) {
ret += gobbled[0];
i += gobbled[1];
continue;
} // Retain a pair of \\ if double escaped `\\\\`
// https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
if (str[i + 1] === "\\") {
ret += "\\";
i++;
continue;
} // if \\ is at the end of the string retain it
// https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
if (str.length === i + 1) {
ret += str[i];
}
continue;
}
ret += str[i];
}
return ret;
}
module.exports = exports.default;
} (unesc, unesc.exports));
var unescExports = unesc.exports;
var getProp = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = getProp;
function getProp(obj) {
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
props[_key - 1] = arguments[_key];
}
while (props.length > 0) {
var prop = props.shift();
if (!obj[prop]) {
return undefined;
}
obj = obj[prop];
}
return obj;
}
module.exports = exports.default;
} (getProp, getProp.exports));
var getPropExports = getProp.exports;
var ensureObject = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = ensureObject;
function ensureObject(obj) {
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
props[_key - 1] = arguments[_key];
}
while (props.length > 0) {
var prop = props.shift();
if (!obj[prop]) {
obj[prop] = {};
}
obj = obj[prop];
}
}
module.exports = exports.default;
} (ensureObject, ensureObject.exports));
var ensureObjectExports = ensureObject.exports;
var stripComments = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = stripComments;
function stripComments(str) {
var s = "";
var commentStart = str.indexOf("/*");
var lastEnd = 0;
while (commentStart >= 0) {
s = s + str.slice(lastEnd, commentStart);
var commentEnd = str.indexOf("*/", commentStart + 2);
if (commentEnd < 0) {
return s;
}
lastEnd = commentEnd + 2;
commentStart = str.indexOf("/*", lastEnd);
}
s = s + str.slice(lastEnd);
return s;
}
module.exports = exports.default;
} (stripComments, stripComments.exports));
var stripCommentsExports = stripComments.exports;
util.__esModule = true;
util.stripComments = util.ensureObject = util.getProp = util.unesc = void 0;
var _unesc = _interopRequireDefault$3(unescExports);
util.unesc = _unesc["default"];
var _getProp = _interopRequireDefault$3(getPropExports);
util.getProp = _getProp["default"];
var _ensureObject = _interopRequireDefault$3(ensureObjectExports);
util.ensureObject = _ensureObject["default"];
var _stripComments = _interopRequireDefault$3(stripCommentsExports);
util.stripComments = _stripComments["default"];
function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _util = util;
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var cloneNode = function cloneNode(obj, parent) {
if (typeof obj !== 'object' || obj === null) {
return obj;
}
var cloned = new obj.constructor();
for (var i in obj) {
if (!obj.hasOwnProperty(i)) {
continue;
}
var value = obj[i];
var type = typeof value;
if (i === 'parent' && type === 'object') {
if (parent) {
cloned[i] = parent;
}
} else if (value instanceof Array) {
cloned[i] = value.map(function (j) {
return cloneNode(j, cloned);
});
} else {
cloned[i] = cloneNode(value, cloned);
}
}
return cloned;
};
var Node = /*#__PURE__*/function () {
function Node(opts) {
if (opts === void 0) {
opts = {};
}
Object.assign(this, opts);
this.spaces = this.spaces || {};
this.spaces.before = this.spaces.before || '';
this.spaces.after = this.spaces.after || '';
}
var _proto = Node.prototype;
_proto.remove = function remove() {
if (this.parent) {
this.parent.removeChild(this);
}
this.parent = undefined;
return this;
};
_proto.replaceWith = function replaceWith() {
if (this.parent) {
for (var index in arguments) {
this.parent.insertBefore(this, arguments[index]);
}
this.remove();
}
return this;
};
_proto.next = function next() {
return this.parent.at(this.parent.index(this) + 1);
};
_proto.prev = function prev() {
return this.parent.at(this.parent.index(this) - 1);
};
_proto.clone = function clone(overrides) {
if (overrides === void 0) {
overrides = {};
}
var cloned = cloneNode(this);
for (var name in overrides) {
cloned[name] = overrides[name];
}
return cloned;
}
/**
* Some non-standard syntax doesn't follow normal escaping rules for css.
* This allows non standard syntax to be appended to an existing property
* by specifying the escaped value. By specifying the escaped value,
* illegal characters are allowed to be directly inserted into css output.
* @param {string} name the property to set
* @param {any} value the unescaped value of the property
* @param {string} valueEscaped optional. the escaped value of the property.
*/
;
_proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
if (!this.raws) {
this.raws = {};
}
var originalValue = this[name];
var originalEscaped = this.raws[name];
this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
if (originalEscaped || valueEscaped !== value) {
this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
} else {
delete this.raws[name]; // delete any escaped value that was created by the setter.
}
}
/**
* Some non-standard syntax doesn't follow normal escaping rules for css.
* This allows the escaped value to be specified directly, allowing illegal
* characters to be directly inserted into css output.
* @param {string} name the property to set
* @param {any} value the unescaped value of the property
* @param {string} valueEscaped the escaped value of the property.
*/
;
_proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
if (!this.raws) {
this.raws = {};
}
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
this.raws[name] = valueEscaped;
}
/**
* When you want a value to passed through to CSS directly. This method
* deletes the corresponding raw value causing the stringifier to fallback
* to the unescaped value.
* @param {string} name the property to set.
* @param {any} value The value that is both escaped and unescaped.
*/
;
_proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
if (this.raws) {
delete this.raws[name];
}
}
/**
*
* @param {number} line The number (starting with 1)
* @param {number} column The column number (starting with 1)
*/
;
_proto.isAtPosition = function isAtPosition(line, column) {
if (this.source && this.source.start && this.source.end) {
if (this.source.start.line > line) {
return false;
}
if (this.source.end.line < line) {
return false;
}
if (this.source.start.line === line && this.source.start.column > column) {
return false;
}
if (this.source.end.line === line && this.source.end.column < column) {
return false;
}
return true;
}
return undefined;
};
_proto.stringifyProperty = function stringifyProperty(name) {
return this.raws && this.raws[name] || this[name];
};
_proto.valueToString = function valueToString() {
return String(this.stringifyProperty("value"));
};
_proto.toString = function toString() {
return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
};
_createClass(Node, [{
key: "rawSpaceBefore",
get: function get() {
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
if (rawSpace === undefined) {
rawSpace = this.spaces && this.spaces.before;
}
return rawSpace || "";
},
set: function set(raw) {
(0, _util.ensureObject)(this, "raws", "spaces");
this.raws.spaces.before = raw;
}
}, {
key: "rawSpaceAfter",
get: function get() {
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
if (rawSpace === undefined) {
rawSpace = this.spaces.after;
}
return rawSpace || "";
},
set: function set(raw) {
(0, _util.ensureObject)(this, "raws", "spaces");
this.raws.spaces.after = raw;
}
}]);
return Node;
}();
exports["default"] = Node;
module.exports = exports.default;
} (node$1, node$1.exports));
var nodeExports = node$1.exports;
var types = {};
types.__esModule = true;
types.UNIVERSAL = types.ATTRIBUTE = types.CLASS = types.COMBINATOR = types.COMMENT = types.ID = types.NESTING = types.PSEUDO = types.ROOT = types.SELECTOR = types.STRING = types.TAG = void 0;
var TAG = 'tag';
types.TAG = TAG;
var STRING = 'string';
types.STRING = STRING;
var SELECTOR = 'selector';
types.SELECTOR = SELECTOR;
var ROOT = 'root';
types.ROOT = ROOT;
var PSEUDO = 'pseudo';
types.PSEUDO = PSEUDO;
var NESTING = 'nesting';
types.NESTING = NESTING;
var ID = 'id';
types.ID = ID;
var COMMENT = 'comment';
types.COMMENT = COMMENT;
var COMBINATOR = 'combinator';
types.COMBINATOR = COMBINATOR;
var CLASS = 'class';
types.CLASS = CLASS;
var ATTRIBUTE = 'attribute';
types.ATTRIBUTE = ATTRIBUTE;
var UNIVERSAL = 'universal';
types.UNIVERSAL = UNIVERSAL;
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _node = _interopRequireDefault(nodeExports);
var types$1 = _interopRequireWildcard(types);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Container = /*#__PURE__*/function (_Node) {
_inheritsLoose(Container, _Node);
function Container(opts) {
var _this;
_this = _Node.call(this, opts) || this;
if (!_this.nodes) {
_this.nodes = [];
}
return _this;
}
var _proto = Container.prototype;
_proto.append = function append(selector) {
selector.parent = this;
this.nodes.push(selector);
return this;
};
_proto.prepend = function prepend(selector) {
selector.parent = this;
this.nodes.unshift(selector);
return this;
};
_proto.at = function at(index) {
return this.nodes[index];
};
_proto.index = function index(child) {
if (typeof child === 'number') {
return child;
}
return this.nodes.indexOf(child);
};
_proto.removeChild = function removeChild(child) {
child = this.index(child);
this.at(child).parent = undefined;
this.nodes.splice(child, 1);
var index;
for (var id in this.indexes) {
index = this.indexes[id];
if (index >= child) {
this.indexes[id] = index - 1;
}
}
return this;
};
_proto.removeAll = function removeAll() {
for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
var node = _step.value;
node.parent = undefined;
}
this.nodes = [];
return this;
};
_proto.empty = function empty() {
return this.removeAll();
};
_proto.insertAfter = function insertAfter(oldNode, newNode) {
newNode.parent = this;
var oldIndex = this.index(oldNode);
this.nodes.splice(oldIndex + 1, 0, newNode);
newNode.parent = this;
var index;
for (var id in this.indexes) {
index = this.indexes[id];
if (oldIndex <= index) {
this.indexes[id] = index + 1;
}
}
return this;
};
_proto.insertBefore = function insertBefore(oldNode, newNode) {
newNode.parent = this;
var oldIndex = this.index(oldNode);
this.nodes.splice(oldIndex, 0, newNode);
newNode.parent = this;
var index;
for (var id in this.indexes) {
index = this.indexes[id];
if (index <= oldIndex) {
this.indexes[id] = index + 1;
}
}
return this;
};
_proto._findChildAtPosition = function _findChildAtPosition(line, col) {
var found = undefined;
this.each(function (node) {
if (node.atPosition) {
var foundChild = node.atPosition(line, col);
if (foundChild) {
found = foundChild;
return false;
}
} else if (node.isAtPosition(line, col)) {
found = node;
return false;
}
});
return found;
}
/**
* Return the most specific node at the line and column number given.
* The source location is based on the original parsed location, locations aren't
* updated as selector nodes are mutated.
*
* Note that this location is relative to the location of the first character
* of the selector, and not the location of the selector in the overall document
* when used in conjunction with postcss.
*
* If not found, returns undefined.
* @param {number} line The line number of the node to find. (1-based index)
* @param {number} col The column number of the node to find. (1-based index)
*/
;
_proto.atPosition = function atPosition(line, col) {
if (this.isAtPosition(line, col)) {
return this._findChildAtPosition(line, col) || this;
} else {
return undefined;
}
};
_proto._inferEndPosition = function _inferEndPosition() {
if (this.last && this.last.source && this.last.source.end) {
this.source = this.source || {};
this.source.end = this.source.end || {};
Object.assign(this.source.end, this.last.source.end);
}
};
_proto.each = function each(callback) {
if (!this.lastEach) {
this.lastEach = 0;
}
if (!this.indexes) {
this.indexes = {};
}
this.lastEach++;
var id = this.lastEach;
this.indexes[id] = 0;
if (!this.length) {
return undefined;
}
var index, result;
while (this.indexes[id] < this.length) {
index = this.indexes[id];
result = callback(this.at(index), index);
if (result === false) {
break;
}
this.indexes[id] += 1;
}
delete this.indexes[id];
if (result === false) {
return false;
}
};
_proto.walk = function walk(callback) {
return this.each(function (node, i) {
var result = callback(node, i);
if (result !== false && node.length) {
result = node.walk(callback);
}
if (result === false) {
return false;
}
});
};
_proto.walkAttributes = function walkAttributes(callback) {
var _this2 = this;
return this.walk(function (selector) {
if (selector.type === types$1.ATTRIBUTE) {
return callback.call(_this2, selector);
}
});
};
_proto.walkClasses = function walkClasses(callback) {
var _this3 = this;
return this.walk(function (selector) {
if (selector.type === types$1.CLASS) {
return callback.call(_this3, selector);
}
});
};
_proto.walkCombinators = function walkCombinators(callback) {
var _this4 = this;
return this.walk(function (selector) {
if (selector.type === types$1.COMBINATOR) {
return callback.call(_this4, selector);
}
});
};
_proto.walkComments = function walkComments(callback) {
var _this5 = this;
return this.walk(function (selector) {
if (selector.type === types$1.COMMENT) {
return callback.call(_this5, selector);
}
});
};
_proto.walkIds = function walkIds(callback) {
var _this6 = this;
return this.walk(function (selector) {
if (selector.type === types$1.ID) {
return callback.call(_this6, selector);
}
});
};
_proto.walkNesting = function walkNesting(callback) {
var _this7 = this;
return this.walk(function (selector) {
if (selector.type === types$1.NESTING) {
return callback.call(_this7, selector);
}
});
};
_proto.walkPseudos = function walkPseudos(callback) {
var _this8 = this;
return this.walk(function (selector) {
if (selector.type === types$1.PSEUDO) {
return callback.call(_this8, selector);
}
});
};
_proto.walkTags = function walkTags(callback) {
var _this9 = this;
return this.walk(function (selector) {
if (selector.type === types$1.TAG) {
return callback.call(_this9, selector);
}
});
};
_proto.walkUniversals = function walkUniversals(callback) {
var _this10 = this;
return this.walk(function (selector) {
if (selector.type === types$1.UNIVERSAL) {
return callback.call(_this10, selector);
}
});
};
_proto.split = function split(callback) {
var _this11 = this;
var current = [];
return this.reduce(function (memo, node, index) {
var split = callback.call(_this11, node);
current.push(node);
if (split) {
memo.push(current);
current = [];
} else if (index === _this11.length - 1) {
memo.push(current);
}
return memo;
}, []);
};
_proto.map = function map(callback) {
return this.nodes.map(callback);
};
_proto.reduce = function reduce(callback, memo) {
return this.nodes.reduce(callback, memo);
};
_proto.every = function every(callback) {
return this.nodes.every(callback);
};
_proto.some = function some(callback) {
return this.nodes.some(callback);
};
_proto.filter = function filter(callback) {
return this.nodes.filter(callback);
};
_proto.sort = function sort(callback) {
return this.nodes.sort(callback);
};
_proto.toString = function toString() {
return this.map(String).join('');
};
_createClass(Container, [{
key: "first",
get: function get() {
return this.at(0);
}
}, {
key: "last",
get: function get() {
return this.at(this.length - 1);
}
}, {
key: "length",
get: function get() {
return this.nodes.length;
}
}]);
return Container;
}(_node["default"]);
exports["default"] = Container;
module.exports = exports.default;
} (container, container.exports));
var containerExports = container.exports;
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _container = _interopRequireDefault(containerExports);
var _types = types;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Root = /*#__PURE__*/function (_Container) {
_inheritsLoose(Root, _Container);
function Root(opts) {
var _this;
_this = _Container.call(this, opts) || this;
_this.type = _types.ROOT;
return _this;
}
var _proto = Root.prototype;
_proto.toString = function toString() {
var str = this.reduce(function (memo, selector) {
memo.push(String(selector));
return memo;
}, []).join(',');
return this.trailingComma ? str + ',' : str;
};
_proto.error = function error(message, options) {
if (this._error) {
return this._error(message, options);
} else {
return new Error(message);
}
};
_createClass(Root, [{
key: "errorGenerator",
set: function set(handler) {
this._error = handler;
}
}]);
return Root;
}(_container["default"]);
exports["default"] = Root;
module.exports = exports.default;
} (root$1, root$1.exports));
var rootExports = root$1.exports;
var selector$1 = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _container = _interopRequireDefault(containerExports);
var _types = types;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Selector = /*#__PURE__*/function (_Container) {
_inheritsLoose(Selector, _Container);
function Selector(opts) {
var _this;
_this = _Container.call(this, opts) || this;
_this.type = _types.SELECTOR;
return _this;
}
return Selector;
}(_container["default"]);
exports["default"] = Selector;
module.exports = exports.default;
} (selector$1, selector$1.exports));
var selectorExports = selector$1.exports;
var className$1 = {exports: {}};
/*! https://mths.be/cssesc v3.0.0 by @mathias */
var object = {};
var hasOwnProperty$1 = object.hasOwnProperty;
var merge = function merge(options, defaults) {
if (!options) {
return defaults;
}
var result = {};
for (var key in defaults) {
// `if (defaults.hasOwnProperty(key) { … }` is not needed here, since
// only recognized option names are used.
result[key] = hasOwnProperty$1.call(options, key) ? options[key] : defaults[key];
}
return result;
};
var regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/;
var regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/;
var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;
// https://mathiasbynens.be/notes/css-escapes#css
var cssesc = function cssesc(string, options) {
options = merge(options, cssesc.options);
if (options.quotes != 'single' && options.quotes != 'double') {
options.quotes = 'single';
}
var quote = options.quotes == 'double' ? '"' : '\'';
var isIdentifier = options.isIdentifier;
var firstChar = string.charAt(0);
var output = '';
var counter = 0;
var length = string.length;
while (counter < length) {
var character = string.charAt(counter++);
var codePoint = character.charCodeAt();
var value = void 0;
// If it’s not a printable ASCII character…
if (codePoint < 0x20 || codePoint > 0x7E) {
if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) {
// It’s a high surrogate, and there is a next character.
var extra = string.charCodeAt(counter++);
if ((extra & 0xFC00) == 0xDC00) {
// next character is low surrogate
codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;
} else {
// It’s an unmatched surrogate; only append this code unit, in case
// the next code unit is the high surrogate of a surrogate pair.
counter--;
}
}
value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
} else {
if (options.escapeEverything) {
if (regexAnySingleEscape.test(character)) {
value = '\\' + character;
} else {
value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
}
} else if (/[\t\n\f\r\x0B]/.test(character)) {
value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
} else if (character == '\\' || !isIdentifier && (character == '"' && quote == character || character == '\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) {
value = '\\' + character;
} else {
value = character;
}
}
output += value;
}
if (isIdentifier) {
if (/^-[-\d]/.test(output)) {
output = '\\-' + output.slice(1);
} else if (/\d/.test(firstChar)) {
output = '\\3' + firstChar + ' ' + output.slice(1);
}
}
// Remove spaces after `\HEX` escapes that are not followed by a hex digit,
// since they’re redundant. Note that this is only possible if the escape
// sequence isn’t preceded by an odd number of backslashes.
output = output.replace(regexExcessiveSpaces, function ($0, $1, $2) {
if ($1 && $1.length % 2) {
// It’s not safe to remove the space, so don’t.
return $0;
}
// Strip the space.
return ($1 || '') + $2;
});
if (!isIdentifier && options.wrap) {
return quote + output + quote;
}
return output;
};
// Expose default options (so they can be overridden globally).
cssesc.options = {
'escapeEverything': false,
'isIdentifier': false,
'quotes': 'single',
'wrap': false
};
cssesc.version = '3.0.0';
var cssesc_1 = cssesc;
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _cssesc = _interopRequireDefault(cssesc_1);
var _util = util;
var _node = _interopRequireDefault(nodeExports);
var _types = types;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var ClassName = /*#__PURE__*/function (_Node) {
_inheritsLoose(ClassName, _Node);
function ClassName(opts) {
var _this;
_this = _Node.call(this, opts) || this;
_this.type = _types.CLASS;
_this._constructed = true;
return _this;
}
var _proto = ClassName.prototype;
_proto.valueToString = function valueToString() {
return '.' + _Node.prototype.valueToString.call(this);
};
_createClass(ClassName, [{
key: "value",
get: function get() {
return this._value;
},
set: function set(v) {
if (this._constructed) {
var escaped = (0, _cssesc["default"])(v, {
isIdentifier: true
});
if (escaped !== v) {
(0, _util.ensureObject)(this, "raws");
this.raws.value = escaped;
} else if (this.raws) {
delete this.raws.value;
}
}
this._value = v;
}
}]);
return ClassName;
}(_node["default"]);
exports["default"] = ClassName;
module.exports = exports.default;
} (className$1, className$1.exports));
var classNameExports = className$1.exports;
var comment$2 = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _node = _interopRequireDefault(nodeExports);
var _types = types;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Comment = /*#__PURE__*/function (_Node) {
_inheritsLoose(Comment, _Node);
function Comment(opts) {
var _this;
_this = _Node.call(this, opts) || this;
_this.type = _types.COMMENT;
return _this;
}
return Comment;
}(_node["default"]);
exports["default"] = Comment;
module.exports = exports.default;
} (comment$2, comment$2.exports));
var commentExports = comment$2.exports;
var id$1 = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _node = _interopRequireDefault(nodeExports);
var _types = types;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var ID = /*#__PURE__*/function (_Node) {
_inheritsLoose(ID, _Node);
function ID(opts) {
var _this;
_this = _Node.call(this, opts) || this;
_this.type = _types.ID;
return _this;
}
var _proto = ID.prototype;
_proto.valueToString = function valueToString() {
return '#' + _Node.prototype.valueToString.call(this);
};
return ID;
}(_node["default"]);
exports["default"] = ID;
module.exports = exports.default;
} (id$1, id$1.exports));
var idExports = id$1.exports;
var tag$1 = {exports: {}};
var namespace = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _cssesc = _interopRequireDefault(cssesc_1);
var _util = util;
var _node = _interopRequireDefault(nodeExports);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Namespace = /*#__PURE__*/function (_Node) {
_inheritsLoose(Namespace, _Node);
function Namespace() {
return _Node.apply(this, arguments) || this;
}
var _proto = Namespace.prototype;
_proto.qualifiedName = function qualifiedName(value) {
if (this.namespace) {
return this.namespaceString + "|" + value;
} else {
return value;
}
};
_proto.valueToString = function valueToString() {
return this.qualifiedName(_Node.prototype.valueToString.call(this));
};
_createClass(Namespace, [{
key: "namespace",
get: function get() {
return this._namespace;
},
set: function set(namespace) {
if (namespace === true || namespace === "*" || namespace === "&") {
this._namespace = namespace;
if (this.raws) {
delete this.raws.namespace;
}
return;
}
var escaped = (0, _cssesc["default"])(namespace, {
isIdentifier: true
});
this._namespace = namespace;
if (escaped !== namespace) {
(0, _util.ensureObject)(this, "raws");
this.raws.namespace = escaped;
} else if (this.raws) {
delete this.raws.namespace;
}
}
}, {
key: "ns",
get: function get() {
return this._namespace;
},
set: function set(namespace) {
this.namespace = namespace;
}
}, {
key: "namespaceString",
get: function get() {
if (this.namespace) {
var ns = this.stringifyProperty("namespace");
if (ns === true) {
return '';
} else {
return ns;
}
} else {
return '';
}
}
}]);
return Namespace;
}(_node["default"]);
exports["default"] = Namespace;
module.exports = exports.default;
} (namespace, namespace.exports));
var namespaceExports = namespace.exports;
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _namespace = _interopRequireDefault(namespaceExports);
var _types = types;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Tag = /*#__PURE__*/function (_Namespace) {
_inheritsLoose(Tag, _Namespace);
function Tag(opts) {
var _this;
_this = _Namespace.call(this, opts) || this;
_this.type = _types.TAG;
return _this;
}
return Tag;
}(_namespace["default"]);
exports["default"] = Tag;
module.exports = exports.default;
} (tag$1, tag$1.exports));
var tagExports = tag$1.exports;
var string$1 = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _node = _interopRequireDefault(nodeExports);
var _types = types;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var String = /*#__PURE__*/function (_Node) {
_inheritsLoose(String, _Node);
function String(opts) {
var _this;
_this = _Node.call(this, opts) || this;
_this.type = _types.STRING;
return _this;
}
return String;
}(_node["default"]);
exports["default"] = String;
module.exports = exports.default;
} (string$1, string$1.exports));
var stringExports = string$1.exports;
var pseudo$1 = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _container = _interopRequireDefault(containerExports);
var _types = types;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Pseudo = /*#__PURE__*/function (_Container) {
_inheritsLoose(Pseudo, _Container);
function Pseudo(opts) {
var _this;
_this = _Container.call(this, opts) || this;
_this.type = _types.PSEUDO;
return _this;
}
var _proto = Pseudo.prototype;
_proto.toString = function toString() {
var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join('');
};
return Pseudo;
}(_container["default"]);
exports["default"] = Pseudo;
module.exports = exports.default;
} (pseudo$1, pseudo$1.exports));
var pseudoExports = pseudo$1.exports;
var attribute$1 = {};
/**
* For Node.js, simply re-export the core `util.deprecate` function.
*/
var node = require$$0$6.deprecate;
(function (exports) {
exports.__esModule = true;
exports.unescapeValue = unescapeValue;
exports["default"] = void 0;
var _cssesc = _interopRequireDefault(cssesc_1);
var _unesc = _interopRequireDefault(unescExports);
var _namespace = _interopRequireDefault(namespaceExports);
var _types = types;
var _CSSESC_QUOTE_OPTIONS;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var deprecate = node;
var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;
var warnOfDeprecatedValueAssignment = deprecate(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
var warnOfDeprecatedQuotedAssignment = deprecate(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
var warnOfDeprecatedConstructor = deprecate(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
function unescapeValue(value) {
var deprecatedUsage = false;
var quoteMark = null;
var unescaped = value;
var m = unescaped.match(WRAPPED_IN_QUOTES);
if (m) {
quoteMark = m[1];
unescaped = m[2];
}
unescaped = (0, _unesc["default"])(unescaped);
if (unescaped !== value) {
deprecatedUsage = true;
}
return {
deprecatedUsage: deprecatedUsage,
unescaped: unescaped,
quoteMark: quoteMark
};
}
function handleDeprecatedContructorOpts(opts) {
if (opts.quoteMark !== undefined) {
return opts;
}
if (opts.value === undefined) {
return opts;
}
warnOfDeprecatedConstructor();
var _unescapeValue = unescapeValue(opts.value),
quoteMark = _unescapeValue.quoteMark,
unescaped = _unescapeValue.unescaped;
if (!opts.raws) {
opts.raws = {};
}
if (opts.raws.value === undefined) {
opts.raws.value = opts.value;
}
opts.value = unescaped;
opts.quoteMark = quoteMark;
return opts;
}
var Attribute = /*#__PURE__*/function (_Namespace) {
_inheritsLoose(Attribute, _Namespace);
function Attribute(opts) {
var _this;
if (opts === void 0) {
opts = {};
}
_this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;
_this.type = _types.ATTRIBUTE;
_this.raws = _this.raws || {};
Object.defineProperty(_this.raws, 'unquoted', {
get: deprecate(function () {
return _this.value;
}, "attr.raws.unquoted is deprecated. Call attr.value instead."),
set: deprecate(function () {
return _this.value;
}, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.")
});
_this._constructed = true;
return _this;
}
/**
* Returns the Attribute's value quoted such that it would be legal to use
* in the value of a css file. The original value's quotation setting
* used for stringification is left unchanged. See `setValue(value, options)`
* if you want to control the quote settings of a new value for the attribute.
*
* You can also change the quotation used for the current value by setting quoteMark.
*
* Options:
* * quoteMark {'"' | "'" | null} - Use this value to quote the value. If this
* option is not set, the original value for quoteMark will be used. If
* indeterminate, a double quote is used. The legal values are:
* * `null` - the value will be unquoted and characters will be escaped as necessary.
* * `'` - the value will be quoted with a single quote and single quotes are escaped.
* * `"` - the value will be quoted with a double quote and double quotes are escaped.
* * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark
* over the quoteMark option value.
* * smart {boolean} - if true, will select a quote mark based on the value
* and the other options specified here. See the `smartQuoteMark()`
* method.
**/
var _proto = Attribute.prototype;
_proto.getQuotedValue = function getQuotedValue(options) {
if (options === void 0) {
options = {};
}
var quoteMark = this._determineQuoteMark(options);
var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
var escaped = (0, _cssesc["default"])(this._value, cssescopts);
return escaped;
};
_proto._determineQuoteMark = function _determineQuoteMark(options) {
return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
}
/**
* Set the unescaped value with the specified quotation options. The value
* provided must not include any wrapping quote marks -- those quotes will
* be interpreted as part of the value and escaped accordingly.
*/
;
_proto.setValue = function setValue(value, options) {
if (options === void 0) {
options = {};
}
this._value = value;
this._quoteMark = this._determineQuoteMark(options);
this._syncRawValue();
}
/**
* Intelligently select a quoteMark value based on the value's contents. If
* the value is a legal CSS ident, it will not be quoted. Otherwise a quote
* mark will be picked that minimizes the number of escapes.
*
* If there's no clear winner, the quote mark from these options is used,
* then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
* true). If the quoteMark is unspecified, a double quote is used.
*
* @param options This takes the quoteMark and preferCurrentQuoteMark options
* from the quoteValue method.
*/
;
_proto.smartQuoteMark = function smartQuoteMark(options) {
var v = this.value;
var numSingleQuotes = v.replace(/[^']/g, '').length;
var numDoubleQuotes = v.replace(/[^"]/g, '').length;
if (numSingleQuotes + numDoubleQuotes === 0) {
var escaped = (0, _cssesc["default"])(v, {
isIdentifier: true
});
if (escaped === v) {
return Attribute.NO_QUOTE;
} else {
var pref = this.preferredQuoteMark(options);
if (pref === Attribute.NO_QUOTE) {
// pick a quote mark that isn't none and see if it's smaller
var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
var opts = CSSESC_QUOTE_OPTIONS[quote];
var quoteValue = (0, _cssesc["default"])(v, opts);
if (quoteValue.length < escaped.length) {
return quote;
}
}
return pref;
}
} else if (numDoubleQuotes === numSingleQuotes) {
return this.preferredQuoteMark(options);
} else if (numDoubleQuotes < numSingleQuotes) {
return Attribute.DOUBLE_QUOTE;
} else {
return Attribute.SINGLE_QUOTE;
}
}
/**
* Selects the preferred quote mark based on the options and the current quote mark value.
* If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
* instead.
*/
;
_proto.preferredQuoteMark = function preferredQuoteMark(options) {
var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
if (quoteMark === undefined) {
quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
}
if (quoteMark === undefined) {
quoteMark = Attribute.DOUBLE_QUOTE;
}
return quoteMark;
};
_proto._syncRawValue = function _syncRawValue() {
var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
if (rawValue === this._value) {
if (this.raws) {
delete this.raws.value;
}
} else {
this.raws.value = rawValue;
}
};
_proto._handleEscapes = function _handleEscapes(prop, value) {
if (this._constructed) {
var escaped = (0, _cssesc["default"])(value, {
isIdentifier: true
});
if (escaped !== value) {
this.raws[prop] = escaped;
} else {
delete this.raws[prop];
}
}
};
_proto._spacesFor = function _spacesFor(name) {
var attrSpaces = {
before: '',
after: ''
};
var spaces = this.spaces[name] || {};
var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
return Object.assign(attrSpaces, spaces, rawSpaces);
};
_proto._stringFor = function _stringFor(name, spaceName, concat) {
if (spaceName === void 0) {
spaceName = name;
}
if (concat === void 0) {
concat = defaultAttrConcat;
}
var attrSpaces = this._spacesFor(spaceName);
return concat(this.stringifyProperty(name), attrSpaces);
}
/**
* returns the offset of the attribute part specified relative to the
* start of the node of the output string.
*
* * "ns" - alias for "namespace"
* * "namespace" - the namespace if it exists.
* * "attribute" - the attribute name
* * "attributeNS" - the start of the attribute or its namespace
* * "operator" - the match operator of the attribute
* * "value" - The value (string or identifier)
* * "insensitive" - the case insensitivity flag;
* @param part One of the possible values inside an attribute.
* @returns -1 if the name is invalid or the value doesn't exist in this attribute.
*/
;
_proto.offsetOf = function offsetOf(name) {
var count = 1;
var attributeSpaces = this._spacesFor("attribute");
count += attributeSpaces.before.length;
if (name === "namespace" || name === "ns") {
return this.namespace ? count : -1;
}
if (name === "attributeNS") {
return count;
}
count += this.namespaceString.length;
if (this.namespace) {
count += 1;
}
if (name === "attribute") {
return count;
}
count += this.stringifyProperty("attribute").length;
count += attributeSpaces.after.length;
var operatorSpaces = this._spacesFor("operator");
count += operatorSpaces.before.length;
var operator = this.stringifyProperty("operator");
if (name === "operator") {
return operator ? count : -1;
}
count += operator.length;
count += operatorSpaces.after.length;
var valueSpaces = this._spacesFor("value");
count += valueSpaces.before.length;
var value = this.stringifyProperty("value");
if (name === "value") {
return value ? count : -1;
}
count += value.length;
count += valueSpaces.after.length;
var insensitiveSpaces = this._spacesFor("insensitive");
count += insensitiveSpaces.before.length;
if (name === "insensitive") {
return this.insensitive ? count : -1;
}
return -1;
};
_proto.toString = function toString() {
var _this2 = this;
var selector = [this.rawSpaceBefore, '['];
selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
if (this.operator && (this.value || this.value === '')) {
selector.push(this._stringFor('operator'));
selector.push(this._stringFor('value'));
selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {
if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
attrSpaces.before = " ";
}
return defaultAttrConcat(attrValue, attrSpaces);
}));
}
selector.push(']');
selector.push(this.rawSpaceAfter);
return selector.join('');
};
_createClass(Attribute, [{
key: "quoted",
get: function get() {
var qm = this.quoteMark;
return qm === "'" || qm === '"';
},
set: function set(value) {
warnOfDeprecatedQuotedAssignment();
}
/**
* returns a single (`'`) or double (`"`) quote character if the value is quoted.
* returns `null` if the value is not quoted.
* returns `undefined` if the quotation state is unknown (this can happen when
* the attribute is constructed without specifying a quote mark.)
*/
}, {
key: "quoteMark",
get: function get() {
return this._quoteMark;
}
/**
* Set the quote mark to be used by this attribute's value.
* If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute
* value is updated accordingly.
*
* @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
*/
,
set: function set(quoteMark) {
if (!this._constructed) {
this._quoteMark = quoteMark;
return;
}
if (this._quoteMark !== quoteMark) {
this._quoteMark = quoteMark;
this._syncRawValue();
}
}
}, {
key: "qualifiedAttribute",
get: function get() {
return this.qualifiedName(this.raws.attribute || this.attribute);
}
}, {
key: "insensitiveFlag",
get: function get() {
return this.insensitive ? 'i' : '';
}
}, {
key: "value",
get: function get() {
return this._value;
}
/**
* Before 3.0, the value had to be set to an escaped value including any wrapped
* quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value
* is unescaped during parsing and any quote marks are removed.
*
* Because the ambiguity of this semantic change, if you set `attr.value = newValue`,
* a deprecation warning is raised when the new value contains any characters that would
* require escaping (including if it contains wrapped quotes).
*
* Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe
* how the new value is quoted.
*/
,
set: function set(v) {
if (this._constructed) {
var _unescapeValue2 = unescapeValue(v),
deprecatedUsage = _unescapeValue2.deprecatedUsage,
unescaped = _unescapeValue2.unescaped,
quoteMark = _unescapeValue2.quoteMark;
if (deprecatedUsage) {
warnOfDeprecatedValueAssignment();
}
if (unescaped === this._value && quoteMark === this._quoteMark) {
return;
}
this._value = unescaped;
this._quoteMark = quoteMark;
this._syncRawValue();
} else {
this._value = v;
}
}
}, {
key: "attribute",
get: function get() {
return this._attribute;
},
set: function set(name) {
this._handleEscapes("attribute", name);
this._attribute = name;
}
}]);
return Attribute;
}(_namespace["default"]);
exports["default"] = Attribute;
Attribute.NO_QUOTE = null;
Attribute.SINGLE_QUOTE = "'";
Attribute.DOUBLE_QUOTE = '"';
var CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = {
"'": {
quotes: 'single',
wrap: true
},
'"': {
quotes: 'double',
wrap: true
}
}, _CSSESC_QUOTE_OPTIONS[null] = {
isIdentifier: true
}, _CSSESC_QUOTE_OPTIONS);
function defaultAttrConcat(attrValue, attrSpaces) {
return "" + attrSpaces.before + attrValue + attrSpaces.after;
}
} (attribute$1));
var universal$1 = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _namespace = _interopRequireDefault(namespaceExports);
var _types = types;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Universal = /*#__PURE__*/function (_Namespace) {
_inheritsLoose(Universal, _Namespace);
function Universal(opts) {
var _this;
_this = _Namespace.call(this, opts) || this;
_this.type = _types.UNIVERSAL;
_this.value = '*';
return _this;
}
return Universal;
}(_namespace["default"]);
exports["default"] = Universal;
module.exports = exports.default;
} (universal$1, universal$1.exports));
var universalExports = universal$1.exports;
var combinator$2 = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _node = _interopRequireDefault(nodeExports);
var _types = types;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Combinator = /*#__PURE__*/function (_Node) {
_inheritsLoose(Combinator, _Node);
function Combinator(opts) {
var _this;
_this = _Node.call(this, opts) || this;
_this.type = _types.COMBINATOR;
return _this;
}
return Combinator;
}(_node["default"]);
exports["default"] = Combinator;
module.exports = exports.default;
} (combinator$2, combinator$2.exports));
var combinatorExports = combinator$2.exports;
var nesting$1 = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _node = _interopRequireDefault(nodeExports);
var _types = types;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Nesting = /*#__PURE__*/function (_Node) {
_inheritsLoose(Nesting, _Node);
function Nesting(opts) {
var _this;
_this = _Node.call(this, opts) || this;
_this.type = _types.NESTING;
_this.value = '&';
return _this;
}
return Nesting;
}(_node["default"]);
exports["default"] = Nesting;
module.exports = exports.default;
} (nesting$1, nesting$1.exports));
var nestingExports = nesting$1.exports;
var sortAscending = {exports: {}};
(function (module, exports) {
exports.__esModule = true;
exports["default"] = sortAscending;
function sortAscending(list) {
return list.sort(function (a, b) {
return a - b;
});
}
module.exports = exports.default;
} (sortAscending, sortAscending.exports));
var sortAscendingExports = sortAscending.exports;
var tokenize = {};
var tokenTypes = {};
tokenTypes.__esModule = true;
tokenTypes.combinator = tokenTypes.word = tokenTypes.comment = tokenTypes.str = tokenTypes.tab = tokenTypes.newline = tokenTypes.feed = tokenTypes.cr = tokenTypes.backslash = tokenTypes.bang = tokenTypes.slash = tokenTypes.doubleQuote = tokenTypes.singleQuote = tokenTypes.space = tokenTypes.greaterThan = tokenTypes.pipe = tokenTypes.equals = tokenTypes.plus = tokenTypes.caret = tokenTypes.tilde = tokenTypes.dollar = tokenTypes.closeSquare = tokenTypes.openSquare = tokenTypes.closeParenthesis = tokenTypes.openParenthesis = tokenTypes.semicolon = tokenTypes.colon = tokenTypes.comma = tokenTypes.at = tokenTypes.asterisk = tokenTypes.ampersand = void 0;
var ampersand = 38; // `&`.charCodeAt(0);
tokenTypes.ampersand = ampersand;
var asterisk = 42; // `*`.charCodeAt(0);
tokenTypes.asterisk = asterisk;
var at = 64; // `@`.charCodeAt(0);
tokenTypes.at = at;
var comma = 44; // `,`.charCodeAt(0);
tokenTypes.comma = comma;
var colon = 58; // `:`.charCodeAt(0);
tokenTypes.colon = colon;
var semicolon = 59; // `;`.charCodeAt(0);
tokenTypes.semicolon = semicolon;
var openParenthesis = 40; // `(`.charCodeAt(0);
tokenTypes.openParenthesis = openParenthesis;
var closeParenthesis = 41; // `)`.charCodeAt(0);
tokenTypes.closeParenthesis = closeParenthesis;
var openSquare = 91; // `[`.charCodeAt(0);
tokenTypes.openSquare = openSquare;
var closeSquare = 93; // `]`.charCodeAt(0);
tokenTypes.closeSquare = closeSquare;
var dollar = 36; // `$`.charCodeAt(0);
tokenTypes.dollar = dollar;
var tilde = 126; // `~`.charCodeAt(0);
tokenTypes.tilde = tilde;
var caret = 94; // `^`.charCodeAt(0);
tokenTypes.caret = caret;
var plus = 43; // `+`.charCodeAt(0);
tokenTypes.plus = plus;
var equals = 61; // `=`.charCodeAt(0);
tokenTypes.equals = equals;
var pipe = 124; // `|`.charCodeAt(0);
tokenTypes.pipe = pipe;
var greaterThan = 62; // `>`.charCodeAt(0);
tokenTypes.greaterThan = greaterThan;
var space = 32; // ` `.charCodeAt(0);
tokenTypes.space = space;
var singleQuote = 39; // `'`.charCodeAt(0);
tokenTypes.singleQuote = singleQuote;
var doubleQuote = 34; // `"`.charCodeAt(0);
tokenTypes.doubleQuote = doubleQuote;
var slash = 47; // `/`.charCodeAt(0);
tokenTypes.slash = slash;
var bang = 33; // `!`.charCodeAt(0);
tokenTypes.bang = bang;
var backslash = 92; // '\\'.charCodeAt(0);
tokenTypes.backslash = backslash;
var cr = 13; // '\r'.charCodeAt(0);
tokenTypes.cr = cr;
var feed = 12; // '\f'.charCodeAt(0);
tokenTypes.feed = feed;
var newline = 10; // '\n'.charCodeAt(0);
tokenTypes.newline = newline;
var tab = 9; // '\t'.charCodeAt(0);
// Expose aliases primarily for readability.
tokenTypes.tab = tab;
var str = singleQuote; // No good single character representation!
tokenTypes.str = str;
var comment$1 = -1;
tokenTypes.comment = comment$1;
var word = -2;
tokenTypes.word = word;
var combinator$1 = -3;
tokenTypes.combinator = combinator$1;
(function (exports) {
exports.__esModule = true;
exports["default"] = tokenize;
exports.FIELDS = void 0;
var t = _interopRequireWildcard(tokenTypes);
var _unescapable, _wordDelimiters;
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
var wordDelimiters = (_wordDelimiters = {}, _wordDelimiters[t.space] = true, _wordDelimiters[t.tab] = true, _wordDelimiters[t.newline] = true, _wordDelimiters[t.cr] = true, _wordDelimiters[t.feed] = true, _wordDelimiters[t.ampersand] = true, _wordDelimiters[t.asterisk] = true, _wordDelimiters[t.bang] = true, _wordDelimiters[t.comma] = true, _wordDelimiters[t.colon] = true, _wordDelimiters[t.semicolon] = true, _wordDelimiters[t.openParenthesis] = true, _wordDelimiters[t.closeParenthesis] = true, _wordDelimiters[t.openSquare] = true, _wordDelimiters[t.closeSquare] = true, _wordDelimiters[t.singleQuote] = true, _wordDelimiters[t.doubleQuote] = true, _wordDelimiters[t.plus] = true, _wordDelimiters[t.pipe] = true, _wordDelimiters[t.tilde] = true, _wordDelimiters[t.greaterThan] = true, _wordDelimiters[t.equals] = true, _wordDelimiters[t.dollar] = true, _wordDelimiters[t.caret] = true, _wordDelimiters[t.slash] = true, _wordDelimiters);
var hex = {};
var hexChars = "0123456789abcdefABCDEF";
for (var i = 0; i < hexChars.length; i++) {
hex[hexChars.charCodeAt(i)] = true;
}
/**
* Returns the last index of the bar css word
* @param {string} css The string in which the word begins
* @param {number} start The index into the string where word's first letter occurs
*/
function consumeWord(css, start) {
var next = start;
var code;
do {
code = css.charCodeAt(next);
if (wordDelimiters[code]) {
return next - 1;
} else if (code === t.backslash) {
next = consumeEscape(css, next) + 1;
} else {
// All other characters are part of the word
next++;
}
} while (next < css.length);
return next - 1;
}
/**
* Returns the last index of the escape sequence
* @param {string} css The string in which the sequence begins
* @param {number} start The index into the string where escape character (`\`) occurs.
*/
function consumeEscape(css, start) {
var next = start;
var code = css.charCodeAt(next + 1);
if (unescapable[code]) ; else if (hex[code]) {
var hexDigits = 0; // consume up to 6 hex chars
do {
next++;
hexDigits++;
code = css.charCodeAt(next + 1);
} while (hex[code] && hexDigits < 6); // if fewer than 6 hex chars, a trailing space ends the escape
if (hexDigits < 6 && code === t.space) {
next++;
}
} else {
// the next char is part of the current word
next++;
}
return next;
}
var FIELDS = {
TYPE: 0,
START_LINE: 1,
START_COL: 2,
END_LINE: 3,
END_COL: 4,
START_POS: 5,
END_POS: 6
};
exports.FIELDS = FIELDS;
function tokenize(input) {
var tokens = [];
var css = input.css.valueOf();
var _css = css,
length = _css.length;
var offset = -1;
var line = 1;
var start = 0;
var end = 0;
var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;
function unclosed(what, fix) {
if (input.safe) {
// fyi: this is never set to true.
css += fix;
next = css.length - 1;
} else {
throw input.error('Unclosed ' + what, line, start - offset, start);
}
}
while (start < length) {
code = css.charCodeAt(start);
if (code === t.newline) {
offset = start;
line += 1;
}
switch (code) {
case t.space:
case t.tab:
case t.newline:
case t.cr:
case t.feed:
next = start;
do {
next += 1;
code = css.charCodeAt(next);
if (code === t.newline) {
offset = next;
line += 1;
}
} while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
tokenType = t.space;
endLine = line;
endColumn = next - offset - 1;
end = next;
break;
case t.plus:
case t.greaterThan:
case t.tilde:
case t.pipe:
next = start;
do {
next += 1;
code = css.charCodeAt(next);
} while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
tokenType = t.combinator;
endLine = line;
endColumn = start - offset;
end = next;
break;
// Consume these characters as single tokens.
case t.asterisk:
case t.ampersand:
case t.bang:
case t.comma:
case t.equals:
case t.dollar:
case t.caret:
case t.openSquare:
case t.closeSquare:
case t.colon:
case t.semicolon:
case t.openParenthesis:
case t.closeParenthesis:
next = start;
tokenType = code;
endLine = line;
endColumn = start - offset;
end = next + 1;
break;
case t.singleQuote:
case t.doubleQuote:
quote = code === t.singleQuote ? "'" : '"';
next = start;
do {
escaped = false;
next = css.indexOf(quote, next + 1);
if (next === -1) {
unclosed('quote', quote);
}
escapePos = next;
while (css.charCodeAt(escapePos - 1) === t.backslash) {
escapePos -= 1;
escaped = !escaped;
}
} while (escaped);
tokenType = t.str;
endLine = line;
endColumn = start - offset;
end = next + 1;
break;
default:
if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
next = css.indexOf('*/', start + 2) + 1;
if (next === 0) {
unclosed('comment', '*/');
}
content = css.slice(start, next + 1);
lines = content.split('\n');
last = lines.length - 1;
if (last > 0) {
nextLine = line + last;
nextOffset = next - lines[last].length;
} else {
nextLine = line;
nextOffset = offset;
}
tokenType = t.comment;
line = nextLine;
endLine = nextLine;
endColumn = next - nextOffset;
} else if (code === t.slash) {
next = start;
tokenType = code;
endLine = line;
endColumn = start - offset;
end = next + 1;
} else {
next = consumeWord(css, start);
tokenType = t.word;
endLine = line;
endColumn = next - offset;
}
end = next + 1;
break;
} // Ensure that the token structure remains consistent
tokens.push([tokenType, // [0] Token type
line, // [1] Starting line
start - offset, // [2] Starting column
endLine, // [3] Ending line
endColumn, // [4] Ending column
start, // [5] Start position / Source index
end // [6] End position
]); // Reset offset for the next token
if (nextOffset) {
offset = nextOffset;
nextOffset = null;
}
start = end;
}
return tokens;
}
} (tokenize));
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _root = _interopRequireDefault(rootExports);
var _selector = _interopRequireDefault(selectorExports);
var _className = _interopRequireDefault(classNameExports);
var _comment = _interopRequireDefault(commentExports);
var _id = _interopRequireDefault(idExports);
var _tag = _interopRequireDefault(tagExports);
var _string = _interopRequireDefault(stringExports);
var _pseudo = _interopRequireDefault(pseudoExports);
var _attribute = _interopRequireWildcard(attribute$1);
var _universal = _interopRequireDefault(universalExports);
var _combinator = _interopRequireDefault(combinatorExports);
var _nesting = _interopRequireDefault(nestingExports);
var _sortAscending = _interopRequireDefault(sortAscendingExports);
var _tokenize = _interopRequireWildcard(tokenize);
var tokens = _interopRequireWildcard(tokenTypes);
var types$1 = _interopRequireWildcard(types);
var _util = util;
var _WHITESPACE_TOKENS, _Object$assign;
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var WHITESPACE_TOKENS = (_WHITESPACE_TOKENS = {}, _WHITESPACE_TOKENS[tokens.space] = true, _WHITESPACE_TOKENS[tokens.cr] = true, _WHITESPACE_TOKENS[tokens.feed] = true, _WHITESPACE_TOKENS[tokens.newline] = true, _WHITESPACE_TOKENS[tokens.tab] = true, _WHITESPACE_TOKENS);
var WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign));
function tokenStart(token) {
return {
line: token[_tokenize.FIELDS.START_LINE],
column: token[_tokenize.FIELDS.START_COL]
};
}
function tokenEnd(token) {
return {
line: token[_tokenize.FIELDS.END_LINE],
column: token[_tokenize.FIELDS.END_COL]
};
}
function getSource(startLine, startColumn, endLine, endColumn) {
return {
start: {
line: startLine,
column: startColumn
},
end: {
line: endLine,
column: endColumn
}
};
}
function getTokenSource(token) {
return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]);
}
function getTokenSourceSpan(startToken, endToken) {
if (!startToken) {
return undefined;
}
return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]);
}
function unescapeProp(node, prop) {
var value = node[prop];
if (typeof value !== "string") {
return;
}
if (value.indexOf("\\") !== -1) {
(0, _util.ensureObject)(node, 'raws');
node[prop] = (0, _util.unesc)(value);
if (node.raws[prop] === undefined) {
node.raws[prop] = value;
}
}
return node;
}
function indexesOf(array, item) {
var i = -1;
var indexes = [];
while ((i = array.indexOf(item, i + 1)) !== -1) {
indexes.push(i);
}
return indexes;
}
function uniqs() {
var list = Array.prototype.concat.apply([], arguments);
return list.filter(function (item, i) {
return i === list.indexOf(item);
});
}
var Parser = /*#__PURE__*/function () {
function Parser(rule, options) {
if (options === void 0) {
options = {};
}
this.rule = rule;
this.options = Object.assign({
lossy: false,
safe: false
}, options);
this.position = 0;
this.css = typeof this.rule === 'string' ? this.rule : this.rule.selector;
this.tokens = (0, _tokenize["default"])({
css: this.css,
error: this._errorGenerator(),
safe: this.options.safe
});
var rootSource = getTokenSourceSpan(this.tokens[0], this.tokens[this.tokens.length - 1]);
this.root = new _root["default"]({
source: rootSource
});
this.root.errorGenerator = this._errorGenerator();
var selector = new _selector["default"]({
source: {
start: {
line: 1,
column: 1
}
}
});
this.root.append(selector);
this.current = selector;
this.loop();
}
var _proto = Parser.prototype;
_proto._errorGenerator = function _errorGenerator() {
var _this = this;
return function (message, errorOptions) {
if (typeof _this.rule === 'string') {
return new Error(message);
}
return _this.rule.error(message, errorOptions);
};
};
_proto.attribute = function attribute() {
var attr = [];
var startingToken = this.currToken;
this.position++;
while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
attr.push(this.currToken);
this.position++;
}
if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
}
var len = attr.length;
var node = {
source: getSource(startingToken[1], startingToken[2], this.currToken[3], this.currToken[4]),
sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
};
if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) {
return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]);
}
var pos = 0;
var spaceBefore = '';
var commentBefore = '';
var lastAdded = null;
var spaceAfterMeaningfulToken = false;
while (pos < len) {
var token = attr[pos];
var content = this.content(token);
var next = attr[pos + 1];
switch (token[_tokenize.FIELDS.TYPE]) {
case tokens.space:
// if (
// len === 1 ||
// pos === 0 && this.content(next) === '|'
// ) {
// return this.expected('attribute', token[TOKEN.START_POS], content);
// }
spaceAfterMeaningfulToken = true;
if (this.options.lossy) {
break;
}
if (lastAdded) {
(0, _util.ensureObject)(node, 'spaces', lastAdded);
var prevContent = node.spaces[lastAdded].after || '';
node.spaces[lastAdded].after = prevContent + content;
var existingComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null;
if (existingComment) {
node.raws.spaces[lastAdded].after = existingComment + content;
}
} else {
spaceBefore = spaceBefore + content;
commentBefore = commentBefore + content;
}
break;
case tokens.asterisk:
if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
node.operator = content;
lastAdded = 'operator';
} else if ((!node.namespace || lastAdded === "namespace" && !spaceAfterMeaningfulToken) && next) {
if (spaceBefore) {
(0, _util.ensureObject)(node, 'spaces', 'attribute');
node.spaces.attribute.before = spaceBefore;
spaceBefore = '';
}
if (commentBefore) {
(0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');
node.raws.spaces.attribute.before = spaceBefore;
commentBefore = '';
}
node.namespace = (node.namespace || "") + content;
var rawValue = (0, _util.getProp)(node, 'raws', 'namespace') || null;
if (rawValue) {
node.raws.namespace += content;
}
lastAdded = 'namespace';
}
spaceAfterMeaningfulToken = false;
break;
case tokens.dollar:
if (lastAdded === "value") {
var oldRawValue = (0, _util.getProp)(node, 'raws', 'value');
node.value += "$";
if (oldRawValue) {
node.raws.value = oldRawValue + "$";
}
break;
}
// Falls through
case tokens.caret:
if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
node.operator = content;
lastAdded = 'operator';
}
spaceAfterMeaningfulToken = false;
break;
case tokens.combinator:
if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) {
node.operator = content;
lastAdded = 'operator';
}
if (content !== '|') {
spaceAfterMeaningfulToken = false;
break;
}
if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
node.operator = content;
lastAdded = 'operator';
} else if (!node.namespace && !node.attribute) {
node.namespace = true;
}
spaceAfterMeaningfulToken = false;
break;
case tokens.word:
if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][_tokenize.FIELDS.TYPE] !== tokens.equals && // this look-ahead probably fails with comment nodes involved.
!node.operator && !node.namespace) {
node.namespace = content;
lastAdded = 'namespace';
} else if (!node.attribute || lastAdded === "attribute" && !spaceAfterMeaningfulToken) {
if (spaceBefore) {
(0, _util.ensureObject)(node, 'spaces', 'attribute');
node.spaces.attribute.before = spaceBefore;
spaceBefore = '';
}
if (commentBefore) {
(0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');
node.raws.spaces.attribute.before = commentBefore;
commentBefore = '';
}
node.attribute = (node.attribute || "") + content;
var _rawValue = (0, _util.getProp)(node, 'raws', 'attribute') || null;
if (_rawValue) {
node.raws.attribute += content;
}
lastAdded = 'attribute';
} else if (!node.value && node.value !== "" || lastAdded === "value" && !spaceAfterMeaningfulToken) {
var _unescaped = (0, _util.unesc)(content);
var _oldRawValue = (0, _util.getProp)(node, 'raws', 'value') || '';
var oldValue = node.value || '';
node.value = oldValue + _unescaped;
node.quoteMark = null;
if (_unescaped !== content || _oldRawValue) {
(0, _util.ensureObject)(node, 'raws');
node.raws.value = (_oldRawValue || oldValue) + content;
}
lastAdded = 'value';
} else {
var insensitive = content === 'i' || content === "I";
if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) {
node.insensitive = insensitive;
if (!insensitive || content === "I") {
(0, _util.ensureObject)(node, 'raws');
node.raws.insensitiveFlag = content;
}
lastAdded = 'insensitive';
if (spaceBefore) {
(0, _util.ensureObject)(node, 'spaces', 'insensitive');
node.spaces.insensitive.before = spaceBefore;
spaceBefore = '';
}
if (commentBefore) {
(0, _util.ensureObject)(node, 'raws', 'spaces', 'insensitive');
node.raws.spaces.insensitive.before = commentBefore;
commentBefore = '';
}
} else if (node.value || node.value === '') {
lastAdded = 'value';
node.value += content;
if (node.raws.value) {
node.raws.value += content;
}
}
}
spaceAfterMeaningfulToken = false;
break;
case tokens.str:
if (!node.attribute || !node.operator) {
return this.error("Expected an attribute followed by an operator preceding the string.", {
index: token[_tokenize.FIELDS.START_POS]
});
}
var _unescapeValue = (0, _attribute.unescapeValue)(content),
unescaped = _unescapeValue.unescaped,
quoteMark = _unescapeValue.quoteMark;
node.value = unescaped;
node.quoteMark = quoteMark;
lastAdded = 'value';
(0, _util.ensureObject)(node, 'raws');
node.raws.value = content;
spaceAfterMeaningfulToken = false;
break;
case tokens.equals:
if (!node.attribute) {
return this.expected('attribute', token[_tokenize.FIELDS.START_POS], content);
}
if (node.value) {
return this.error('Unexpected "=" found; an operator was already defined.', {
index: token[_tokenize.FIELDS.START_POS]
});
}
node.operator = node.operator ? node.operator + content : content;
lastAdded = 'operator';
spaceAfterMeaningfulToken = false;
break;
case tokens.comment:
if (lastAdded) {
if (spaceAfterMeaningfulToken || next && next[_tokenize.FIELDS.TYPE] === tokens.space || lastAdded === 'insensitive') {
var lastComment = (0, _util.getProp)(node, 'spaces', lastAdded, 'after') || '';
var rawLastComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || lastComment;
(0, _util.ensureObject)(node, 'raws', 'spaces', lastAdded);
node.raws.spaces[lastAdded].after = rawLastComment + content;
} else {
var lastValue = node[lastAdded] || '';
var rawLastValue = (0, _util.getProp)(node, 'raws', lastAdded) || lastValue;
(0, _util.ensureObject)(node, 'raws');
node.raws[lastAdded] = rawLastValue + content;
}
} else {
commentBefore = commentBefore + content;
}
break;
default:
return this.error("Unexpected \"" + content + "\" found.", {
index: token[_tokenize.FIELDS.START_POS]
});
}
pos++;
}
unescapeProp(node, "attribute");
unescapeProp(node, "namespace");
this.newNode(new _attribute["default"](node));
this.position++;
}
/**
* return a node containing meaningless garbage up to (but not including) the specified token position.
* if the token position is negative, all remaining tokens are consumed.
*
* This returns an array containing a single string node if all whitespace,
* otherwise an array of comment nodes with space before and after.
*
* These tokens are not added to the current selector, the caller can add them or use them to amend
* a previous node's space metadata.
*
* In lossy mode, this returns only comments.
*/
;
_proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) {
if (stopPosition < 0) {
stopPosition = this.tokens.length;
}
var startPosition = this.position;
var nodes = [];
var space = "";
var lastComment = undefined;
do {
if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {
if (!this.options.lossy) {
space += this.content();
}
} else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.comment) {
var spaces = {};
if (space) {
spaces.before = space;
space = "";
}
lastComment = new _comment["default"]({
value: this.content(),
source: getTokenSource(this.currToken),
sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
spaces: spaces
});
nodes.push(lastComment);
}
} while (++this.position < stopPosition);
if (space) {
if (lastComment) {
lastComment.spaces.after = space;
} else if (!this.options.lossy) {
var firstToken = this.tokens[startPosition];
var lastToken = this.tokens[this.position - 1];
nodes.push(new _string["default"]({
value: '',
source: getSource(firstToken[_tokenize.FIELDS.START_LINE], firstToken[_tokenize.FIELDS.START_COL], lastToken[_tokenize.FIELDS.END_LINE], lastToken[_tokenize.FIELDS.END_COL]),
sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
spaces: {
before: space,
after: ''
}
}));
}
}
return nodes;
}
/**
*
* @param {*} nodes
*/
;
_proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) {
var _this2 = this;
if (requiredSpace === void 0) {
requiredSpace = false;
}
var space = "";
var rawSpace = "";
nodes.forEach(function (n) {
var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace);
var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace);
space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0);
rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0);
});
if (rawSpace === space) {
rawSpace = undefined;
}
var result = {
space: space,
rawSpace: rawSpace
};
return result;
};
_proto.isNamedCombinator = function isNamedCombinator(position) {
if (position === void 0) {
position = this.position;
}
return this.tokens[position + 0] && this.tokens[position + 0][_tokenize.FIELDS.TYPE] === tokens.slash && this.tokens[position + 1] && this.tokens[position + 1][_tokenize.FIELDS.TYPE] === tokens.word && this.tokens[position + 2] && this.tokens[position + 2][_tokenize.FIELDS.TYPE] === tokens.slash;
};
_proto.namedCombinator = function namedCombinator() {
if (this.isNamedCombinator()) {
var nameRaw = this.content(this.tokens[this.position + 1]);
var name = (0, _util.unesc)(nameRaw).toLowerCase();
var raws = {};
if (name !== nameRaw) {
raws.value = "/" + nameRaw + "/";
}
var node = new _combinator["default"]({
value: "/" + name + "/",
source: getSource(this.currToken[_tokenize.FIELDS.START_LINE], this.currToken[_tokenize.FIELDS.START_COL], this.tokens[this.position + 2][_tokenize.FIELDS.END_LINE], this.tokens[this.position + 2][_tokenize.FIELDS.END_COL]),
sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
raws: raws
});
this.position = this.position + 3;
return node;
} else {
this.unexpected();
}
};
_proto.combinator = function combinator() {
var _this3 = this;
if (this.content() === '|') {
return this.namespace();
} // We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector.
var nextSigTokenPos = this.locateNextMeaningfulToken(this.position);
if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma) {
var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
if (nodes.length > 0) {
var last = this.current.last;
if (last) {
var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes),
space = _this$convertWhitespa.space,
rawSpace = _this$convertWhitespa.rawSpace;
if (rawSpace !== undefined) {
last.rawSpaceAfter += rawSpace;
}
last.spaces.after += space;
} else {
nodes.forEach(function (n) {
return _this3.newNode(n);
});
}
}
return;
}
var firstToken = this.currToken;
var spaceOrDescendantSelectorNodes = undefined;
if (nextSigTokenPos > this.position) {
spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
}
var node;
if (this.isNamedCombinator()) {
node = this.namedCombinator();
} else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.combinator) {
node = new _combinator["default"]({
value: this.content(),
source: getTokenSource(this.currToken),
sourceIndex: this.currToken[_tokenize.FIELDS.START_POS]
});
this.position++;
} else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) ; else if (!spaceOrDescendantSelectorNodes) {
this.unexpected();
}
if (node) {
if (spaceOrDescendantSelectorNodes) {
var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes),
_space = _this$convertWhitespa2.space,
_rawSpace = _this$convertWhitespa2.rawSpace;
node.spaces.before = _space;
node.rawSpaceBefore = _rawSpace;
}
} else {
// descendant combinator
var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true),
_space2 = _this$convertWhitespa3.space,
_rawSpace2 = _this$convertWhitespa3.rawSpace;
if (!_rawSpace2) {
_rawSpace2 = _space2;
}
var spaces = {};
var raws = {
spaces: {}
};
if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) {
spaces.before = _space2.slice(0, _space2.length - 1);
raws.spaces.before = _rawSpace2.slice(0, _rawSpace2.length - 1);
} else if (_space2.startsWith(' ') && _rawSpace2.startsWith(' ')) {
spaces.after = _space2.slice(1);
raws.spaces.after = _rawSpace2.slice(1);
} else {
raws.value = _rawSpace2;
}
node = new _combinator["default"]({
value: ' ',
source: getTokenSourceSpan(firstToken, this.tokens[this.position - 1]),
sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
spaces: spaces,
raws: raws
});
}
if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) {
node.spaces.after = this.optionalSpace(this.content());
this.position++;
}
return this.newNode(node);
};
_proto.comma = function comma() {
if (this.position === this.tokens.length - 1) {
this.root.trailingComma = true;
this.position++;
return;
}
this.current._inferEndPosition();
var selector = new _selector["default"]({
source: {
start: tokenStart(this.tokens[this.position + 1])
}
});
this.current.parent.append(selector);
this.current = selector;
this.position++;
};
_proto.comment = function comment() {
var current = this.currToken;
this.newNode(new _comment["default"]({
value: this.content(),
source: getTokenSource(current),
sourceIndex: current[_tokenize.FIELDS.START_POS]
}));
this.position++;
};
_proto.error = function error(message, opts) {
throw this.root.error(message, opts);
};
_proto.missingBackslash = function missingBackslash() {
return this.error('Expected a backslash preceding the semicolon.', {
index: this.currToken[_tokenize.FIELDS.START_POS]
});
};
_proto.missingParenthesis = function missingParenthesis() {
return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
};
_proto.missingSquareBracket = function missingSquareBracket() {
return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
};
_proto.unexpected = function unexpected() {
return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]);
};
_proto.namespace = function namespace() {
var before = this.prevToken && this.content(this.prevToken) || true;
if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) {
this.position++;
return this.word(before);
} else if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.asterisk) {
this.position++;
return this.universal(before);
}
};
_proto.nesting = function nesting() {
if (this.nextToken) {
var nextContent = this.content(this.nextToken);
if (nextContent === "|") {
this.position++;
return;
}
}
var current = this.currToken;
this.newNode(new _nesting["default"]({
value: this.content(),
source: getTokenSource(current),
sourceIndex: current[_tokenize.FIELDS.START_POS]
}));
this.position++;
};
_proto.parentheses = function parentheses() {
var last = this.current.last;
var unbalanced = 1;
this.position++;
if (last && last.type === types$1.PSEUDO) {
var selector = new _selector["default"]({
source: {
start: tokenStart(this.tokens[this.position - 1])
}
});
var cache = this.current;
last.append(selector);
this.current = selector;
while (this.position < this.tokens.length && unbalanced) {
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
unbalanced++;
}
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
unbalanced--;
}
if (unbalanced) {
this.parse();
} else {
this.current.source.end = tokenEnd(this.currToken);
this.current.parent.source.end = tokenEnd(this.currToken);
this.position++;
}
}
this.current = cache;
} else {
// I think this case should be an error. It's used to implement a basic parse of media queries
// but I don't think it's a good idea.
var parenStart = this.currToken;
var parenValue = "(";
var parenEnd;
while (this.position < this.tokens.length && unbalanced) {
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
unbalanced++;
}
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
unbalanced--;
}
parenEnd = this.currToken;
parenValue += this.parseParenthesisToken(this.currToken);
this.position++;
}
if (last) {
last.appendToPropertyAndEscape("value", parenValue, parenValue);
} else {
this.newNode(new _string["default"]({
value: parenValue,
source: getSource(parenStart[_tokenize.FIELDS.START_LINE], parenStart[_tokenize.FIELDS.START_COL], parenEnd[_tokenize.FIELDS.END_LINE], parenEnd[_tokenize.FIELDS.END_COL]),
sourceIndex: parenStart[_tokenize.FIELDS.START_POS]
}));
}
}
if (unbalanced) {
return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
}
};
_proto.pseudo = function pseudo() {
var _this4 = this;
var pseudoStr = '';
var startingToken = this.currToken;
while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) {
pseudoStr += this.content();
this.position++;
}
if (!this.currToken) {
return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1);
}
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) {
this.splitWord(false, function (first, length) {
pseudoStr += first;
_this4.newNode(new _pseudo["default"]({
value: pseudoStr,
source: getTokenSourceSpan(startingToken, _this4.currToken),
sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
}));
if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
_this4.error('Misplaced parenthesis.', {
index: _this4.nextToken[_tokenize.FIELDS.START_POS]
});
}
});
} else {
return this.expected(['pseudo-class', 'pseudo-element'], this.currToken[_tokenize.FIELDS.START_POS]);
}
};
_proto.space = function space() {
var content = this.content(); // Handle space before and after the selector
if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) {
return node.type === 'comment';
})) {
this.spaces = this.optionalSpace(content);
this.position++;
} else if (this.position === this.tokens.length - 1 || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
this.current.last.spaces.after = this.optionalSpace(content);
this.position++;
} else {
this.combinator();
}
};
_proto.string = function string() {
var current = this.currToken;
this.newNode(new _string["default"]({
value: this.content(),
source: getTokenSource(current),
sourceIndex: current[_tokenize.FIELDS.START_POS]
}));
this.position++;
};
_proto.universal = function universal(namespace) {
var nextToken = this.nextToken;
if (nextToken && this.content(nextToken) === '|') {
this.position++;
return this.namespace();
}
var current = this.currToken;
this.newNode(new _universal["default"]({
value: this.content(),
source: getTokenSource(current),
sourceIndex: current[_tokenize.FIELDS.START_POS]
}), namespace);
this.position++;
};
_proto.splitWord = function splitWord(namespace, firstCallback) {
var _this5 = this;
var nextToken = this.nextToken;
var word = this.content();
while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) {
this.position++;
var current = this.content();
word += current;
if (current.lastIndexOf('\\') === current.length - 1) {
var next = this.nextToken;
if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) {
word += this.requiredSpace(this.content(next));
this.position++;
}
}
nextToken = this.nextToken;
}
var hasClass = indexesOf(word, '.').filter(function (i) {
// Allow escaped dot within class name
var escapedDot = word[i - 1] === '\\'; // Allow decimal numbers percent in @keyframes
var isKeyframesPercent = /^\d+\.\d+%$/.test(word);
return !escapedDot && !isKeyframesPercent;
});
var hasId = indexesOf(word, '#').filter(function (i) {
return word[i - 1] !== '\\';
}); // Eliminate Sass interpolations from the list of id indexes
var interpolations = indexesOf(word, '#{');
if (interpolations.length) {
hasId = hasId.filter(function (hashIndex) {
return !~interpolations.indexOf(hashIndex);
});
}
var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId)));
indices.forEach(function (ind, i) {
var index = indices[i + 1] || word.length;
var value = word.slice(ind, index);
if (i === 0 && firstCallback) {
return firstCallback.call(_this5, value, indices.length);
}
var node;
var current = _this5.currToken;
var sourceIndex = current[_tokenize.FIELDS.START_POS] + indices[i];
var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
if (~hasClass.indexOf(ind)) {
var classNameOpts = {
value: value.slice(1),
source: source,
sourceIndex: sourceIndex
};
node = new _className["default"](unescapeProp(classNameOpts, "value"));
} else if (~hasId.indexOf(ind)) {
var idOpts = {
value: value.slice(1),
source: source,
sourceIndex: sourceIndex
};
node = new _id["default"](unescapeProp(idOpts, "value"));
} else {
var tagOpts = {
value: value,
source: source,
sourceIndex: sourceIndex
};
unescapeProp(tagOpts, "value");
node = new _tag["default"](tagOpts);
}
_this5.newNode(node, namespace); // Ensure that the namespace is used only once
namespace = null;
});
this.position++;
};
_proto.word = function word(namespace) {
var nextToken = this.nextToken;
if (nextToken && this.content(nextToken) === '|') {
this.position++;
return this.namespace();
}
return this.splitWord(namespace);
};
_proto.loop = function loop() {
while (this.position < this.tokens.length) {
this.parse(true);
}
this.current._inferEndPosition();
return this.root;
};
_proto.parse = function parse(throwOnParenthesis) {
switch (this.currToken[_tokenize.FIELDS.TYPE]) {
case tokens.space:
this.space();
break;
case tokens.comment:
this.comment();
break;
case tokens.openParenthesis:
this.parentheses();
break;
case tokens.closeParenthesis:
if (throwOnParenthesis) {
this.missingParenthesis();
}
break;
case tokens.openSquare:
this.attribute();
break;
case tokens.dollar:
case tokens.caret:
case tokens.equals:
case tokens.word:
this.word();
break;
case tokens.colon:
this.pseudo();
break;
case tokens.comma:
this.comma();
break;
case tokens.asterisk:
this.universal();
break;
case tokens.ampersand:
this.nesting();
break;
case tokens.slash:
case tokens.combinator:
this.combinator();
break;
case tokens.str:
this.string();
break;
// These cases throw; no break needed.
case tokens.closeSquare:
this.missingSquareBracket();
case tokens.semicolon:
this.missingBackslash();
default:
this.unexpected();
}
}
/**
* Helpers
*/
;
_proto.expected = function expected(description, index, found) {
if (Array.isArray(description)) {
var last = description.pop();
description = description.join(', ') + " or " + last;
}
var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a';
if (!found) {
return this.error("Expected " + an + " " + description + ".", {
index: index
});
}
return this.error("Expected " + an + " " + description + ", found \"" + found + "\" instead.", {
index: index
});
};
_proto.requiredSpace = function requiredSpace(space) {
return this.options.lossy ? ' ' : space;
};
_proto.optionalSpace = function optionalSpace(space) {
return this.options.lossy ? '' : space;
};
_proto.lossySpace = function lossySpace(space, required) {
if (this.options.lossy) {
return required ? ' ' : '';
} else {
return space;
}
};
_proto.parseParenthesisToken = function parseParenthesisToken(token) {
var content = this.content(token);
if (token[_tokenize.FIELDS.TYPE] === tokens.space) {
return this.requiredSpace(content);
} else {
return content;
}
};
_proto.newNode = function newNode(node, namespace) {
if (namespace) {
if (/^ +$/.test(namespace)) {
if (!this.options.lossy) {
this.spaces = (this.spaces || '') + namespace;
}
namespace = true;
}
node.namespace = namespace;
unescapeProp(node, "namespace");
}
if (this.spaces) {
node.spaces.before = this.spaces;
this.spaces = '';
}
return this.current.append(node);
};
_proto.content = function content(token) {
if (token === void 0) {
token = this.currToken;
}
return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]);
};
/**
* returns the index of the next non-whitespace, non-comment token.
* returns -1 if no meaningful token is found.
*/
_proto.locateNextMeaningfulToken = function locateNextMeaningfulToken(startPosition) {
if (startPosition === void 0) {
startPosition = this.position + 1;
}
var searchPosition = startPosition;
while (searchPosition < this.tokens.length) {
if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) {
searchPosition++;
continue;
} else {
return searchPosition;
}
}
return -1;
};
_createClass(Parser, [{
key: "currToken",
get: function get() {
return this.tokens[this.position];
}
}, {
key: "nextToken",
get: function get() {
return this.tokens[this.position + 1];
}
}, {
key: "prevToken",
get: function get() {
return this.tokens[this.position - 1];
}
}]);
return Parser;
}();
exports["default"] = Parser;
module.exports = exports.default;
} (parser, parser.exports));
var parserExports = parser.exports;
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _parser = _interopRequireDefault(parserExports);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var Processor = /*#__PURE__*/function () {
function Processor(func, options) {
this.func = func || function noop() {};
this.funcRes = null;
this.options = options;
}
var _proto = Processor.prototype;
_proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {
if (options === void 0) {
options = {};
}
var merged = Object.assign({}, this.options, options);
if (merged.updateSelector === false) {
return false;
} else {
return typeof rule !== "string";
}
};
_proto._isLossy = function _isLossy(options) {
if (options === void 0) {
options = {};
}
var merged = Object.assign({}, this.options, options);
if (merged.lossless === false) {
return true;
} else {
return false;
}
};
_proto._root = function _root(rule, options) {
if (options === void 0) {
options = {};
}
var parser = new _parser["default"](rule, this._parseOptions(options));
return parser.root;
};
_proto._parseOptions = function _parseOptions(options) {
return {
lossy: this._isLossy(options)
};
};
_proto._run = function _run(rule, options) {
var _this = this;
if (options === void 0) {
options = {};
}
return new Promise(function (resolve, reject) {
try {
var root = _this._root(rule, options);
Promise.resolve(_this.func(root)).then(function (transform) {
var string = undefined;
if (_this._shouldUpdateSelector(rule, options)) {
string = root.toString();
rule.selector = string;
}
return {
transform: transform,
root: root,
string: string
};
}).then(resolve, reject);
} catch (e) {
reject(e);
return;
}
});
};
_proto._runSync = function _runSync(rule, options) {
if (options === void 0) {
options = {};
}
var root = this._root(rule, options);
var transform = this.func(root);
if (transform && typeof transform.then === "function") {
throw new Error("Selector processor returned a promise to a synchronous call.");
}
var string = undefined;
if (options.updateSelector && typeof rule !== "string") {
string = root.toString();
rule.selector = string;
}
return {
transform: transform,
root: root,
string: string
};
}
/**
* Process rule into a selector AST.
*
* @param rule {postcss.Rule | string} The css selector to be processed
* @param options The options for processing
* @returns {Promise<parser.Root>} The AST of the selector after processing it.
*/
;
_proto.ast = function ast(rule, options) {
return this._run(rule, options).then(function (result) {
return result.root;
});
}
/**
* Process rule into a selector AST synchronously.
*
* @param rule {postcss.Rule | string} The css selector to be processed
* @param options The options for processing
* @returns {parser.Root} The AST of the selector after processing it.
*/
;
_proto.astSync = function astSync(rule, options) {
return this._runSync(rule, options).root;
}
/**
* Process a selector into a transformed value asynchronously
*
* @param rule {postcss.Rule | string} The css selector to be processed
* @param options The options for processing
* @returns {Promise<any>} The value returned by the processor.
*/
;
_proto.transform = function transform(rule, options) {
return this._run(rule, options).then(function (result) {
return result.transform;
});
}
/**
* Process a selector into a transformed value synchronously.
*
* @param rule {postcss.Rule | string} The css selector to be processed
* @param options The options for processing
* @returns {any} The value returned by the processor.
*/
;
_proto.transformSync = function transformSync(rule, options) {
return this._runSync(rule, options).transform;
}
/**
* Process a selector into a new selector string asynchronously.
*
* @param rule {postcss.Rule | string} The css selector to be processed
* @param options The options for processing
* @returns {string} the selector after processing.
*/
;
_proto.process = function process(rule, options) {
return this._run(rule, options).then(function (result) {
return result.string || result.root.toString();
});
}
/**
* Process a selector into a new selector string synchronously.
*
* @param rule {postcss.Rule | string} The css selector to be processed
* @param options The options for processing
* @returns {string} the selector after processing.
*/
;
_proto.processSync = function processSync(rule, options) {
var result = this._runSync(rule, options);
return result.string || result.root.toString();
};
return Processor;
}();
exports["default"] = Processor;
module.exports = exports.default;
} (processor, processor.exports));
var processorExports = processor.exports;
var selectors = {};
var constructors = {};
constructors.__esModule = true;
constructors.universal = constructors.tag = constructors.string = constructors.selector = constructors.root = constructors.pseudo = constructors.nesting = constructors.id = constructors.comment = constructors.combinator = constructors.className = constructors.attribute = void 0;
var _attribute = _interopRequireDefault$2(attribute$1);
var _className = _interopRequireDefault$2(classNameExports);
var _combinator = _interopRequireDefault$2(combinatorExports);
var _comment = _interopRequireDefault$2(commentExports);
var _id = _interopRequireDefault$2(idExports);
var _nesting = _interopRequireDefault$2(nestingExports);
var _pseudo = _interopRequireDefault$2(pseudoExports);
var _root = _interopRequireDefault$2(rootExports);
var _selector = _interopRequireDefault$2(selectorExports);
var _string = _interopRequireDefault$2(stringExports);
var _tag = _interopRequireDefault$2(tagExports);
var _universal = _interopRequireDefault$2(universalExports);
function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var attribute = function attribute(opts) {
return new _attribute["default"](opts);
};
constructors.attribute = attribute;
var className = function className(opts) {
return new _className["default"](opts);
};
constructors.className = className;
var combinator = function combinator(opts) {
return new _combinator["default"](opts);
};
constructors.combinator = combinator;
var comment = function comment(opts) {
return new _comment["default"](opts);
};
constructors.comment = comment;
var id = function id(opts) {
return new _id["default"](opts);
};
constructors.id = id;
var nesting = function nesting(opts) {
return new _nesting["default"](opts);
};
constructors.nesting = nesting;
var pseudo = function pseudo(opts) {
return new _pseudo["default"](opts);
};
constructors.pseudo = pseudo;
var root = function root(opts) {
return new _root["default"](opts);
};
constructors.root = root;
var selector = function selector(opts) {
return new _selector["default"](opts);
};
constructors.selector = selector;
var string = function string(opts) {
return new _string["default"](opts);
};
constructors.string = string;
var tag = function tag(opts) {
return new _tag["default"](opts);
};
constructors.tag = tag;
var universal = function universal(opts) {
return new _universal["default"](opts);
};
constructors.universal = universal;
var guards = {};
guards.__esModule = true;
guards.isNode = isNode;
guards.isPseudoElement = isPseudoElement;
guards.isPseudoClass = isPseudoClass;
guards.isContainer = isContainer;
guards.isNamespace = isNamespace;
guards.isUniversal = guards.isTag = guards.isString = guards.isSelector = guards.isRoot = guards.isPseudo = guards.isNesting = guards.isIdentifier = guards.isComment = guards.isCombinator = guards.isClassName = guards.isAttribute = void 0;
var _types = types;
var _IS_TYPE;
var IS_TYPE = (_IS_TYPE = {}, _IS_TYPE[_types.ATTRIBUTE] = true, _IS_TYPE[_types.CLASS] = true, _IS_TYPE[_types.COMBINATOR] = true, _IS_TYPE[_types.COMMENT] = true, _IS_TYPE[_types.ID] = true, _IS_TYPE[_types.NESTING] = true, _IS_TYPE[_types.PSEUDO] = true, _IS_TYPE[_types.ROOT] = true, _IS_TYPE[_types.SELECTOR] = true, _IS_TYPE[_types.STRING] = true, _IS_TYPE[_types.TAG] = true, _IS_TYPE[_types.UNIVERSAL] = true, _IS_TYPE);
function isNode(node) {
return typeof node === "object" && IS_TYPE[node.type];
}
function isNodeType(type, node) {
return isNode(node) && node.type === type;
}
var isAttribute = isNodeType.bind(null, _types.ATTRIBUTE);
guards.isAttribute = isAttribute;
var isClassName = isNodeType.bind(null, _types.CLASS);
guards.isClassName = isClassName;
var isCombinator = isNodeType.bind(null, _types.COMBINATOR);
guards.isCombinator = isCombinator;
var isComment = isNodeType.bind(null, _types.COMMENT);
guards.isComment = isComment;
var isIdentifier = isNodeType.bind(null, _types.ID);
guards.isIdentifier = isIdentifier;
var isNesting = isNodeType.bind(null, _types.NESTING);
guards.isNesting = isNesting;
var isPseudo = isNodeType.bind(null, _types.PSEUDO);
guards.isPseudo = isPseudo;
var isRoot = isNodeType.bind(null, _types.ROOT);
guards.isRoot = isRoot;
var isSelector = isNodeType.bind(null, _types.SELECTOR);
guards.isSelector = isSelector;
var isString = isNodeType.bind(null, _types.STRING);
guards.isString = isString;
var isTag = isNodeType.bind(null, _types.TAG);
guards.isTag = isTag;
var isUniversal = isNodeType.bind(null, _types.UNIVERSAL);
guards.isUniversal = isUniversal;
function isPseudoElement(node) {
return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after" || node.value.toLowerCase() === ":first-letter" || node.value.toLowerCase() === ":first-line");
}
function isPseudoClass(node) {
return isPseudo(node) && !isPseudoElement(node);
}
function isContainer(node) {
return !!(isNode(node) && node.walk);
}
function isNamespace(node) {
return isAttribute(node) || isTag(node);
}
(function (exports) {
exports.__esModule = true;
var _types = types;
Object.keys(_types).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _types[key]) return;
exports[key] = _types[key];
});
var _constructors = constructors;
Object.keys(_constructors).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _constructors[key]) return;
exports[key] = _constructors[key];
});
var _guards = guards;
Object.keys(_guards).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _guards[key]) return;
exports[key] = _guards[key];
});
} (selectors));
(function (module, exports) {
exports.__esModule = true;
exports["default"] = void 0;
var _processor = _interopRequireDefault(processorExports);
var selectors$1 = _interopRequireWildcard(selectors);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var parser = function parser(processor) {
return new _processor["default"](processor);
};
Object.assign(parser, selectors$1);
delete parser.__esModule;
var _default = parser;
exports["default"] = _default;
module.exports = exports.default;
} (dist, dist.exports));
var distExports = dist.exports;
const selectorParser$1 = distExports;
const valueParser = lib;
const { extractICSS } = src$4;
const isSpacing = (node) => node.type === "combinator" && node.value === " ";
function normalizeNodeArray(nodes) {
const array = [];
nodes.forEach((x) => {
if (Array.isArray(x)) {
normalizeNodeArray(x).forEach((item) => {
array.push(item);
});
} else if (x) {
array.push(x);
}
});
if (array.length > 0 && isSpacing(array[array.length - 1])) {
array.pop();
}
return array;
}
function localizeNode(rule, mode, localAliasMap) {
const transform = (node, context) => {
if (context.ignoreNextSpacing && !isSpacing(node)) {
throw new Error("Missing whitespace after " + context.ignoreNextSpacing);
}
if (context.enforceNoSpacing && isSpacing(node)) {
throw new Error("Missing whitespace before " + context.enforceNoSpacing);
}
let newNodes;
switch (node.type) {
case "root": {
let resultingGlobal;
context.hasPureGlobals = false;
newNodes = node.nodes.map((n) => {
const nContext = {
global: context.global,
lastWasSpacing: true,
hasLocals: false,
explicit: false,
};
n = transform(n, nContext);
if (typeof resultingGlobal === "undefined") {
resultingGlobal = nContext.global;
} else if (resultingGlobal !== nContext.global) {
throw new Error(
'Inconsistent rule global/local result in rule "' +
node +
'" (multiple selectors must result in the same mode for the rule)'
);
}
if (!nContext.hasLocals) {
context.hasPureGlobals = true;
}
return n;
});
context.global = resultingGlobal;
node.nodes = normalizeNodeArray(newNodes);
break;
}
case "selector": {
newNodes = node.map((childNode) => transform(childNode, context));
node = node.clone();
node.nodes = normalizeNodeArray(newNodes);
break;
}
case "combinator": {
if (isSpacing(node)) {
if (context.ignoreNextSpacing) {
context.ignoreNextSpacing = false;
context.lastWasSpacing = false;
context.enforceNoSpacing = false;
return null;
}
context.lastWasSpacing = true;
return node;
}
break;
}
case "pseudo": {
let childContext;
const isNested = !!node.length;
const isScoped = node.value === ":local" || node.value === ":global";
const isImportExport =
node.value === ":import" || node.value === ":export";
if (isImportExport) {
context.hasLocals = true;
// :local(.foo)
} else if (isNested) {
if (isScoped) {
if (node.nodes.length === 0) {
throw new Error(`${node.value}() can't be empty`);
}
if (context.inside) {
throw new Error(
`A ${node.value} is not allowed inside of a ${context.inside}(...)`
);
}
childContext = {
global: node.value === ":global",
inside: node.value,
hasLocals: false,
explicit: true,
};
newNodes = node
.map((childNode) => transform(childNode, childContext))
.reduce((acc, next) => acc.concat(next.nodes), []);
if (newNodes.length) {
const { before, after } = node.spaces;
const first = newNodes[0];
const last = newNodes[newNodes.length - 1];
first.spaces = { before, after: first.spaces.after };
last.spaces = { before: last.spaces.before, after };
}
node = newNodes;
break;
} else {
childContext = {
global: context.global,
inside: context.inside,
lastWasSpacing: true,
hasLocals: false,
explicit: context.explicit,
};
newNodes = node.map((childNode) =>
transform(childNode, childContext)
);
node = node.clone();
node.nodes = normalizeNodeArray(newNodes);
if (childContext.hasLocals) {
context.hasLocals = true;
}
}
break;
//:local .foo .bar
} else if (isScoped) {
if (context.inside) {
throw new Error(
`A ${node.value} is not allowed inside of a ${context.inside}(...)`
);
}
const addBackSpacing = !!node.spaces.before;
context.ignoreNextSpacing = context.lastWasSpacing
? node.value
: false;
context.enforceNoSpacing = context.lastWasSpacing
? false
: node.value;
context.global = node.value === ":global";
context.explicit = true;
// because this node has spacing that is lost when we remove it
// we make up for it by adding an extra combinator in since adding
// spacing on the parent selector doesn't work
return addBackSpacing
? selectorParser$1.combinator({ value: " " })
: null;
}
break;
}
case "id":
case "class": {
if (!node.value) {
throw new Error("Invalid class or id selector syntax");
}
if (context.global) {
break;
}
const isImportedValue = localAliasMap.has(node.value);
const isImportedWithExplicitScope = isImportedValue && context.explicit;
if (!isImportedValue || isImportedWithExplicitScope) {
const innerNode = node.clone();
innerNode.spaces = { before: "", after: "" };
node = selectorParser$1.pseudo({
value: ":local",
nodes: [innerNode],
spaces: node.spaces,
});
context.hasLocals = true;
}
break;
}
}
context.lastWasSpacing = false;
context.ignoreNextSpacing = false;
context.enforceNoSpacing = false;
return node;
};
const rootContext = {
global: mode === "global",
hasPureGlobals: false,
};
rootContext.selector = selectorParser$1((root) => {
transform(root, rootContext);
}).processSync(rule, { updateSelector: false, lossless: true });
return rootContext;
}
function localizeDeclNode(node, context) {
switch (node.type) {
case "word":
if (context.localizeNextItem) {
if (!context.localAliasMap.has(node.value)) {
node.value = ":local(" + node.value + ")";
context.localizeNextItem = false;
}
}
break;
case "function":
if (
context.options &&
context.options.rewriteUrl &&
node.value.toLowerCase() === "url"
) {
node.nodes.map((nestedNode) => {
if (nestedNode.type !== "string" && nestedNode.type !== "word") {
return;
}
let newUrl = context.options.rewriteUrl(
context.global,
nestedNode.value
);
switch (nestedNode.type) {
case "string":
if (nestedNode.quote === "'") {
newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/'/g, "\\'");
}
if (nestedNode.quote === '"') {
newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/"/g, '\\"');
}
break;
case "word":
newUrl = newUrl.replace(/("|'|\)|\\)/g, "\\$1");
break;
}
nestedNode.value = newUrl;
});
}
break;
}
return node;
}
function isWordAFunctionArgument(wordNode, functionNode) {
return functionNode
? functionNode.nodes.some(
(functionNodeChild) =>
functionNodeChild.sourceIndex === wordNode.sourceIndex
)
: false;
}
function localizeDeclarationValues(localize, declaration, context) {
const valueNodes = valueParser(declaration.value);
valueNodes.walk((node, index, nodes) => {
const subContext = {
options: context.options,
global: context.global,
localizeNextItem: localize && !context.global,
localAliasMap: context.localAliasMap,
};
nodes[index] = localizeDeclNode(node, subContext);
});
declaration.value = valueNodes.toString();
}
function localizeDeclaration(declaration, context) {
const isAnimation = /animation$/i.test(declaration.prop);
if (isAnimation) {
const validIdent = /^-?[_a-z][_a-z0-9-]*$/i;
/*
The spec defines some keywords that you can use to describe properties such as the timing
function. These are still valid animation names, so as long as there is a property that accepts
a keyword, it is given priority. Only when all the properties that can take a keyword are
exhausted can the animation name be set to the keyword. I.e.
animation: infinite infinite;
The animation will repeat an infinite number of times from the first argument, and will have an
animation name of infinite from the second.
*/
const animationKeywords = {
$alternate: 1,
"$alternate-reverse": 1,
$backwards: 1,
$both: 1,
$ease: 1,
"$ease-in": 1,
"$ease-in-out": 1,
"$ease-out": 1,
$forwards: 1,
$infinite: 1,
$linear: 1,
$none: Infinity, // No matter how many times you write none, it will never be an animation name
$normal: 1,
$paused: 1,
$reverse: 1,
$running: 1,
"$step-end": 1,
"$step-start": 1,
$initial: Infinity,
$inherit: Infinity,
$unset: Infinity,
};
let parsedAnimationKeywords = {};
let stepsFunctionNode = null;
const valueNodes = valueParser(declaration.value).walk((node) => {
/* If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. */
if (node.type === "div") {
parsedAnimationKeywords = {};
}
if (node.type === "function" && node.value.toLowerCase() === "steps") {
stepsFunctionNode = node;
}
const value =
node.type === "word" &&
!isWordAFunctionArgument(node, stepsFunctionNode)
? node.value.toLowerCase()
: null;
let shouldParseAnimationName = false;
if (value && validIdent.test(value)) {
if ("$" + value in animationKeywords) {
parsedAnimationKeywords["$" + value] =
"$" + value in parsedAnimationKeywords
? parsedAnimationKeywords["$" + value] + 1
: 0;
shouldParseAnimationName =
parsedAnimationKeywords["$" + value] >=
animationKeywords["$" + value];
} else {
shouldParseAnimationName = true;
}
}
const subContext = {
options: context.options,
global: context.global,
localizeNextItem: shouldParseAnimationName && !context.global,
localAliasMap: context.localAliasMap,
};
return localizeDeclNode(node, subContext);
});
declaration.value = valueNodes.toString();
return;
}
const isAnimationName = /animation(-name)?$/i.test(declaration.prop);
if (isAnimationName) {
return localizeDeclarationValues(true, declaration, context);
}
const hasUrl = /url\(/i.test(declaration.value);
if (hasUrl) {
return localizeDeclarationValues(false, declaration, context);
}
}
src$2.exports = (options = {}) => {
if (
options &&
options.mode &&
options.mode !== "global" &&
options.mode !== "local" &&
options.mode !== "pure"
) {
throw new Error(
'options.mode must be either "global", "local" or "pure" (default "local")'
);
}
const pureMode = options && options.mode === "pure";
const globalMode = options && options.mode === "global";
return {
postcssPlugin: "postcss-modules-local-by-default",
prepare() {
const localAliasMap = new Map();
return {
Once(root) {
const { icssImports } = extractICSS(root, false);
Object.keys(icssImports).forEach((key) => {
Object.keys(icssImports[key]).forEach((prop) => {
localAliasMap.set(prop, icssImports[key][prop]);
});
});
root.walkAtRules((atRule) => {
if (/keyframes$/i.test(atRule.name)) {
const globalMatch = /^\s*:global\s*\((.+)\)\s*$/.exec(
atRule.params
);
const localMatch = /^\s*:local\s*\((.+)\)\s*$/.exec(
atRule.params
);
let globalKeyframes = globalMode;
if (globalMatch) {
if (pureMode) {
throw atRule.error(
"@keyframes :global(...) is not allowed in pure mode"
);
}
atRule.params = globalMatch[1];
globalKeyframes = true;
} else if (localMatch) {
atRule.params = localMatch[0];
globalKeyframes = false;
} else if (!globalMode) {
if (atRule.params && !localAliasMap.has(atRule.params)) {
atRule.params = ":local(" + atRule.params + ")";
}
}
atRule.walkDecls((declaration) => {
localizeDeclaration(declaration, {
localAliasMap,
options: options,
global: globalKeyframes,
});
});
} else if (atRule.nodes) {
atRule.nodes.forEach((declaration) => {
if (declaration.type === "decl") {
localizeDeclaration(declaration, {
localAliasMap,
options: options,
global: globalMode,
});
}
});
}
});
root.walkRules((rule) => {
if (
rule.parent &&
rule.parent.type === "atrule" &&
/keyframes$/i.test(rule.parent.name)
) {
// ignore keyframe rules
return;
}
const context = localizeNode(rule, options.mode, localAliasMap);
context.options = options;
context.localAliasMap = localAliasMap;
if (pureMode && context.hasPureGlobals) {
throw rule.error(
'Selector "' +
rule.selector +
'" is not pure ' +
"(pure selectors must contain at least one local class or id)"
);
}
rule.selector = context.selector;
// Less-syntax mixins parse as rules with no nodes
if (rule.nodes) {
rule.nodes.forEach((declaration) =>
localizeDeclaration(declaration, context)
);
}
});
},
};
},
};
};
src$2.exports.postcss = true;
var srcExports$1 = src$2.exports;
const selectorParser = distExports;
const hasOwnProperty = Object.prototype.hasOwnProperty;
function getSingleLocalNamesForComposes(root) {
return root.nodes.map((node) => {
if (node.type !== "selector" || node.nodes.length !== 1) {
throw new Error(
`composition is only allowed when selector is single :local class name not in "${root}"`
);
}
node = node.nodes[0];
if (
node.type !== "pseudo" ||
node.value !== ":local" ||
node.nodes.length !== 1
) {
throw new Error(
'composition is only allowed when selector is single :local class name not in "' +
root +
'", "' +
node +
'" is weird'
);
}
node = node.first;
if (node.type !== "selector" || node.length !== 1) {
throw new Error(
'composition is only allowed when selector is single :local class name not in "' +
root +
'", "' +
node +
'" is weird'
);
}
node = node.first;
if (node.type !== "class") {
// 'id' is not possible, because you can't compose ids
throw new Error(
'composition is only allowed when selector is single :local class name not in "' +
root +
'", "' +
node +
'" is weird'
);
}
return node.value;
});
}
const whitespace = "[\\x20\\t\\r\\n\\f]";
const unescapeRegExp = new RegExp(
"\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)",
"ig"
);
function unescape(str) {
return str.replace(unescapeRegExp, (_, escaped, escapedWhitespace) => {
const high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
// 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);
});
}
const plugin = (options = {}) => {
const generateScopedName =
(options && options.generateScopedName) || plugin.generateScopedName;
const generateExportEntry =
(options && options.generateExportEntry) || plugin.generateExportEntry;
const exportGlobals = options && options.exportGlobals;
return {
postcssPlugin: "postcss-modules-scope",
Once(root, { rule }) {
const exports = Object.create(null);
function exportScopedName(name, rawName) {
const scopedName = generateScopedName(
rawName ? rawName : name,
root.source.input.from,
root.source.input.css
);
const exportEntry = generateExportEntry(
rawName ? rawName : name,
scopedName,
root.source.input.from,
root.source.input.css
);
const { key, value } = exportEntry;
exports[key] = exports[key] || [];
if (exports[key].indexOf(value) < 0) {
exports[key].push(value);
}
return scopedName;
}
function localizeNode(node) {
switch (node.type) {
case "selector":
node.nodes = node.map(localizeNode);
return node;
case "class":
return selectorParser.className({
value: exportScopedName(
node.value,
node.raws && node.raws.value ? node.raws.value : null
),
});
case "id": {
return selectorParser.id({
value: exportScopedName(
node.value,
node.raws && node.raws.value ? node.raws.value : null
),
});
}
}
throw new Error(
`${node.type} ("${node}") is not allowed in a :local block`
);
}
function traverseNode(node) {
switch (node.type) {
case "pseudo":
if (node.value === ":local") {
if (node.nodes.length !== 1) {
throw new Error('Unexpected comma (",") in :local block');
}
const selector = localizeNode(node.first);
// move the spaces that were around the psuedo selector to the first
// non-container node
selector.first.spaces = node.spaces;
const nextNode = node.next();
if (
nextNode &&
nextNode.type === "combinator" &&
nextNode.value === " " &&
/\\[A-F0-9]{1,6}$/.test(selector.last.value)
) {
selector.last.spaces.after = " ";
}
node.replaceWith(selector);
return;
}
/* falls through */
case "root":
case "selector": {
node.each(traverseNode);
break;
}
case "id":
case "class":
if (exportGlobals) {
exports[node.value] = [node.value];
}
break;
}
return node;
}
// Find any :import and remember imported names
const importedNames = {};
root.walkRules(/^:import\(.+\)$/, (rule) => {
rule.walkDecls((decl) => {
importedNames[decl.prop] = true;
});
});
// Find any :local selectors
root.walkRules((rule) => {
let parsedSelector = selectorParser().astSync(rule);
rule.selector = traverseNode(parsedSelector.clone()).toString();
rule.walkDecls(/composes|compose-with/i, (decl) => {
const localNames = getSingleLocalNamesForComposes(parsedSelector);
const classes = decl.value.split(/\s+/);
classes.forEach((className) => {
const global = /^global\(([^)]+)\)$/.exec(className);
if (global) {
localNames.forEach((exportedName) => {
exports[exportedName].push(global[1]);
});
} else if (hasOwnProperty.call(importedNames, className)) {
localNames.forEach((exportedName) => {
exports[exportedName].push(className);
});
} else if (hasOwnProperty.call(exports, className)) {
localNames.forEach((exportedName) => {
exports[className].forEach((item) => {
exports[exportedName].push(item);
});
});
} else {
throw decl.error(
`referenced class name "${className}" in ${decl.prop} not found`
);
}
});
decl.remove();
});
// Find any :local values
rule.walkDecls((decl) => {
if (!/:local\s*\((.+?)\)/.test(decl.value)) {
return;
}
let tokens = decl.value.split(/(,|'[^']*'|"[^"]*")/);
tokens = tokens.map((token, idx) => {
if (idx === 0 || tokens[idx - 1] === ",") {
let result = token;
const localMatch = /:local\s*\((.+?)\)/.exec(token);
if (localMatch) {
const input = localMatch.input;
const matchPattern = localMatch[0];
const matchVal = localMatch[1];
const newVal = exportScopedName(matchVal);
result = input.replace(matchPattern, newVal);
} else {
return token;
}
return result;
} else {
return token;
}
});
decl.value = tokens.join("");
});
});
// Find any :local keyframes
root.walkAtRules(/keyframes$/i, (atRule) => {
const localMatch = /^\s*:local\s*\((.+?)\)\s*$/.exec(atRule.params);
if (!localMatch) {
return;
}
atRule.params = exportScopedName(localMatch[1]);
});
// If we found any :locals, insert an :export rule
const exportedNames = Object.keys(exports);
if (exportedNames.length > 0) {
const exportRule = rule({ selector: ":export" });
exportedNames.forEach((exportedName) =>
exportRule.append({
prop: exportedName,
value: exports[exportedName].join(" "),
raws: { before: "\n " },
})
);
root.append(exportRule);
}
},
};
};
plugin.postcss = true;
plugin.generateScopedName = function (name, path) {
const sanitisedPath = path
.replace(/\.[^./\\]+$/, "")
.replace(/[\W_]+/g, "_")
.replace(/^_|_$/g, "");
return `_${sanitisedPath}__${name}`.trim();
};
plugin.generateExportEntry = function (name, scopedName) {
return {
key: unescape(name),
value: unescape(scopedName),
};
};
var src$1 = plugin;
function hash(str) {
var hash = 5381,
i = str.length;
while(i) {
hash = (hash * 33) ^ str.charCodeAt(--i);
}
/* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
* integers. Since we want the results to be always positive, convert the
* signed int to an unsigned by doing an unsigned bitshift. */
return hash >>> 0;
}
var stringHash = hash;
var src = {exports: {}};
const ICSSUtils = src$4;
const matchImports = /^(.+?|\([\s\S]+?\))\s+from\s+("[^"]*"|'[^']*'|[\w-]+)$/;
const matchValueDefinition = /(?:\s+|^)([\w-]+):?(.*?)$/;
const matchImport = /^([\w-]+)(?:\s+as\s+([\w-]+))?/;
src.exports = (options) => {
let importIndex = 0;
const createImportedName =
(options && options.createImportedName) ||
((importName /*, path*/) =>
`i__const_${importName.replace(/\W/g, "_")}_${importIndex++}`);
return {
postcssPlugin: "postcss-modules-values",
prepare(result) {
const importAliases = [];
const definitions = {};
return {
Once(root, postcss) {
root.walkAtRules(/value/i, (atRule) => {
const matches = atRule.params.match(matchImports);
if (matches) {
let [, /*match*/ aliases, path] = matches;
// We can use constants for path names
if (definitions[path]) {
path = definitions[path];
}
const imports = aliases
.replace(/^\(\s*([\s\S]+)\s*\)$/, "$1")
.split(/\s*,\s*/)
.map((alias) => {
const tokens = matchImport.exec(alias);
if (tokens) {
const [, /*match*/ theirName, myName = theirName] = tokens;
const importedName = createImportedName(myName);
definitions[myName] = importedName;
return { theirName, importedName };
} else {
throw new Error(`@import statement "${alias}" is invalid!`);
}
});
importAliases.push({ path, imports });
atRule.remove();
return;
}
if (atRule.params.indexOf("@value") !== -1) {
result.warn("Invalid value definition: " + atRule.params);
}
let [, key, value] = `${atRule.params}${atRule.raws.between}`.match(
matchValueDefinition
);
const normalizedValue = value.replace(/\/\*((?!\*\/).*?)\*\//g, "");
if (normalizedValue.length === 0) {
result.warn("Invalid value definition: " + atRule.params);
atRule.remove();
return;
}
let isOnlySpace = /^\s+$/.test(normalizedValue);
if (!isOnlySpace) {
value = value.trim();
}
// Add to the definitions, knowing that values can refer to each other
definitions[key] = ICSSUtils.replaceValueSymbols(
value,
definitions
);
atRule.remove();
});
/* If we have no definitions, don't continue */
if (!Object.keys(definitions).length) {
return;
}
/* Perform replacements */
ICSSUtils.replaceSymbols(root, definitions);
/* We want to export anything defined by now, but don't add it to the CSS yet or it well get picked up by the replacement stuff */
const exportDeclarations = Object.keys(definitions).map((key) =>
postcss.decl({
value: definitions[key],
prop: key,
raws: { before: "\n " },
})
);
/* Add export rules if any */
if (exportDeclarations.length > 0) {
const exportRule = postcss.rule({
selector: ":export",
raws: { after: "\n" },
});
exportRule.append(exportDeclarations);
root.prepend(exportRule);
}
/* Add import rules */
importAliases.reverse().forEach(({ path, imports }) => {
const importRule = postcss.rule({
selector: `:import(${path})`,
raws: { after: "\n" },
});
imports.forEach(({ theirName, importedName }) => {
importRule.append({
value: theirName,
prop: importedName,
raws: { before: "\n " },
});
});
root.prepend(importRule);
});
},
};
},
};
};
src.exports.postcss = true;
var srcExports = src.exports;
Object.defineProperty(scoping, "__esModule", {
value: true
});
scoping.behaviours = void 0;
scoping.getDefaultPlugins = getDefaultPlugins;
scoping.getDefaultScopeBehaviour = getDefaultScopeBehaviour;
scoping.getScopedNameGenerator = getScopedNameGenerator;
var _postcssModulesExtractImports = _interopRequireDefault$1(srcExports$2);
var _genericNames = _interopRequireDefault$1(genericNames);
var _postcssModulesLocalByDefault = _interopRequireDefault$1(srcExports$1);
var _postcssModulesScope = _interopRequireDefault$1(src$1);
var _stringHash = _interopRequireDefault$1(stringHash);
var _postcssModulesValues = _interopRequireDefault$1(srcExports);
function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const behaviours = {
LOCAL: "local",
GLOBAL: "global"
};
scoping.behaviours = behaviours;
function getDefaultPlugins({
behaviour,
generateScopedName,
exportGlobals
}) {
const scope = (0, _postcssModulesScope.default)({
generateScopedName,
exportGlobals
});
const plugins = {
[behaviours.LOCAL]: [_postcssModulesValues.default, (0, _postcssModulesLocalByDefault.default)({
mode: "local"
}), _postcssModulesExtractImports.default, scope],
[behaviours.GLOBAL]: [_postcssModulesValues.default, (0, _postcssModulesLocalByDefault.default)({
mode: "global"
}), _postcssModulesExtractImports.default, scope]
};
return plugins[behaviour];
}
function isValidBehaviour(behaviour) {
return Object.keys(behaviours).map(key => behaviours[key]).indexOf(behaviour) > -1;
}
function getDefaultScopeBehaviour(scopeBehaviour) {
return scopeBehaviour && isValidBehaviour(scopeBehaviour) ? scopeBehaviour : behaviours.LOCAL;
}
function generateScopedNameDefault(name, filename, css) {
const i = css.indexOf(`.${name}`);
const lineNumber = css.substr(0, i).split(/[\r\n]/).length;
const hash = (0, _stringHash.default)(css).toString(36).substr(0, 5);
return `_${name}_${hash}_${lineNumber}`;
}
function getScopedNameGenerator(generateScopedName, hashPrefix) {
const scopedNameGenerator = generateScopedName || generateScopedNameDefault;
if (typeof scopedNameGenerator === "function") {
return scopedNameGenerator;
}
return (0, _genericNames.default)(scopedNameGenerator, {
context: process.cwd(),
hashPrefix: hashPrefix
});
}
Object.defineProperty(pluginFactory, "__esModule", {
value: true
});
pluginFactory.makePlugin = makePlugin;
var _postcss = _interopRequireDefault(postcss$1);
var _unquote = _interopRequireDefault(unquote$1);
var _Parser = _interopRequireDefault(Parser$1);
var _saveJSON = _interopRequireDefault(saveJSON$1);
var _localsConvention = localsConvention;
var _FileSystemLoader = _interopRequireDefault(FileSystemLoader$1);
var _scoping = scoping;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const PLUGIN_NAME = "postcss-modules";
function isGlobalModule(globalModules, inputFile) {
return globalModules.some(regex => inputFile.match(regex));
}
function getDefaultPluginsList(opts, inputFile) {
const globalModulesList = opts.globalModulePaths || null;
const exportGlobals = opts.exportGlobals || false;
const defaultBehaviour = (0, _scoping.getDefaultScopeBehaviour)(opts.scopeBehaviour);
const generateScopedName = (0, _scoping.getScopedNameGenerator)(opts.generateScopedName, opts.hashPrefix);
if (globalModulesList && isGlobalModule(globalModulesList, inputFile)) {
return (0, _scoping.getDefaultPlugins)({
behaviour: _scoping.behaviours.GLOBAL,
generateScopedName,
exportGlobals
});
}
return (0, _scoping.getDefaultPlugins)({
behaviour: defaultBehaviour,
generateScopedName,
exportGlobals
});
}
function getLoader(opts, plugins) {
const root = typeof opts.root === "undefined" ? "/" : opts.root;
return typeof opts.Loader === "function" ? new opts.Loader(root, plugins, opts.resolve) : new _FileSystemLoader.default(root, plugins, opts.resolve);
}
function isOurPlugin(plugin) {
return plugin.postcssPlugin === PLUGIN_NAME;
}
function makePlugin(opts) {
return {
postcssPlugin: PLUGIN_NAME,
async OnceExit(css, {
result
}) {
const getJSON = opts.getJSON || _saveJSON.default;
const inputFile = css.source.input.file;
const pluginList = getDefaultPluginsList(opts, inputFile);
const resultPluginIndex = result.processor.plugins.findIndex(plugin => isOurPlugin(plugin));
if (resultPluginIndex === -1) {
throw new Error("Plugin missing from options.");
}
const earlierPlugins = result.processor.plugins.slice(0, resultPluginIndex);
const loaderPlugins = [...earlierPlugins, ...pluginList];
const loader = getLoader(opts, loaderPlugins);
const fetcher = async (file, relativeTo, depTrace) => {
const unquoteFile = (0, _unquote.default)(file);
return loader.fetch.call(loader, unquoteFile, relativeTo, depTrace);
};
const parser = new _Parser.default(fetcher);
await (0, _postcss.default)([...pluginList, parser.plugin()]).process(css, {
from: inputFile
});
const out = loader.finalSource;
if (out) css.prepend(out);
if (opts.localsConvention) {
const reducer = (0, _localsConvention.makeLocalsConventionReducer)(opts.localsConvention, inputFile);
parser.exportTokens = Object.entries(parser.exportTokens).reduce(reducer, {});
}
result.messages.push({
type: "export",
plugin: "postcss-modules",
exportTokens: parser.exportTokens
}); // getJSON may return a promise
return getJSON(css.source.input.file, parser.exportTokens, result.opts.to);
}
};
}
var _fs = require$$0__default__default;
var _fs2 = fs;
var _pluginFactory = pluginFactory;
(0, _fs2.setFileSystem)({
readFile: _fs.readFile,
writeFile: _fs.writeFile
});
build.exports = (opts = {}) => (0, _pluginFactory.makePlugin)(opts);
var postcss = build.exports.postcss = true;
var buildExports = build.exports;
var index = /*@__PURE__*/getDefaultExportFromCjs(buildExports);
var index$1 = /*#__PURE__*/_mergeNamespaces({
__proto__: null,
default: index,
postcss: postcss
}, [buildExports]);
export { index$1 as i };
|