swgg (2019.2.20)

Code coverage report for node-swgg/lib.swgg.js

Ignored Statements Branches Functions Lines
branches: 18
statements: 14
functions: 3
97.7%
(1571 / 1608)
97.39%
(1119 / 1149)
96.77%
(210 / 217)
97.7%
(1571 / 1608)
All files » node-swgg/ » lib.swgg.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 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                           2   2 2   2 2 2     2   2 1 1         1 1   1 1 1 1   1       2 2 2   2               2       520 520 520   1                                 1   2           1   2       331   2       106824   2           2 2 1         1     2     2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1           2             2   2             2 1   1 1     2           2       1 1   1       2   2 2           2               2           2           2           2                                                                                                                                                                                                                                   2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             2 58           2                                                                                                             2                                     2                                                                                                                                                                                                                                                                     2                                                                                                                                   2                                                                                                                       2                                       2                                                 2                             2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     2                     2           2 2       325 325           325 10     325                         325                                           325 2133 2133 1631     502 160   13 13   20 39                           20   6 6   5 5   4 4     112   342 153   482   70 70   18     8 2   8           8   6 6   4 2   4         18   2 2   43   43   349       349       325   325   325   325 325 55           325 325       325 325 325 325 325     325 90 90   235   235   235 235     235       235       2       14 14 14   14   1045 821 6   821 815           14   14                                                                                                                                                                                                                       14 14 28 56     14 14 56     14   14   14         14 145                 145 145 4               145     14 396 474 474 474 474 474 474       14 485           14 898 898 338   560 560   560   560 560   560       560     560 560   560 560   560 474                                               560                             560 560 766         766   560   560     560   953     76       76     953 188   188       953     560       1120 3     560     25 25 28 28 28   25     560 560 560   560 325   560                                                           560 74     560 560 10231 6107       560 560 560 560         14   14 14     14         14         2       21542 21542 21542 21542 21542 21542 21542         21542 21542 21542 2868     18674 616     18058 872         872             17186 17186     3210 12   3198 3198 3198                     3198         3198   3198   818         818       4394 4394 4394 394           4000 3600 2600 2600 1000 200   800       4000 4000 2400     4394 4394   4394 66     4394 48     4394 836 836 62     4394     8038         8038   224 224     626 626   400 400   208     208   218               218   8038 200   8038 8038     726 30     696             17186     2       8 8 8 800 800   8     2       1498 1498 1498 1498 1498       1498             1498 1498 1498 12     12   1498 17608                       1498   1498 1498             1498     2         227 227             2       1076 1076   1076 1076   1076 1076   1076 390 390     1076 1076 1076 1076     2       285 285 285 285 285 285 285   285 46 46   239 6     6       6     10   6 6     239       8 8 8   4 4     8 8 8           4                                         4 4 4   4 4 4 2   2 2 2 8         8 2   6 6         6 6 6   2   223   223 223     239     2         234 234 234 234 234 234 234 947   234 234 234   2 2   2 2     28 28 28 28 28     12 12 12 12 12                 14 14   2 2 2             2 2   2 2 2 2   2   68 68   2     2               16 16   2 2   14 14   11     11 11   4     4 4 6 2         4   6     4 4   4                       4   4 4       14 10 10 10 10 10   4 4   43 43   224   167     40 40   2     2   4 4 4   4   2     2   2       2   117   167   167   11 4 4   7     7 7   2 2   154   163   156 156 156   223     234 234     2       209 166 166   43     2         249   249                   249 4 4     245         245 295               295 241   241 241   54   54       245     2       249 249 249 249 249 557   249     249 249 249 249       249 249     2 2   6 6 6 4     4   2   241   55 55     55     188 188 188   59   4 4       2 2 2     2     2 2   2 2       2       2   55 55 55   16   16 2 2 2           55 55   249     249 249     2       242 242 242 242 242 484   242 3 3 3     239   239     239 727     46     239 499     52       52     44     32     32   44     8     8     349     349     499 499         4                   499       122           239   239           239 239     235   235             235 40 40     195 191     195 195   203         8       195                                         975                     195 195   195     40 12   28 28     195 195 195 195   7     242 242     2       18 18 18   160         4       18         18 18 144     144 144   18 142   144 2 2       18 144 162   162         4           162 305 10           18 7 16       16 16   16 16       18 18         54 240 240 50 50 318   50   190     18 144 162 162 162 162 162       18         16     2                 2 6 6 4 4 2         2 4 4 4 2 2     4 2       2 2           2     2       1134 1134 3677   3677         1581   3677 663           3677 957 28   2 2   2 2   4 4     4   2 2   2 2   2 2     16   26   10 10 20           2720                 70 70     3675   1134     2             246 246   492         236     256 236     256 30   30 2   30 30 6         30             30 30 30   226         246 492 204   288 288 288 246   42   288           246       2         14 14 14             2       37138     2       437     2       118160     2           228 228     228   32         32   228 228 228 228       2         10 10 10 10 10 10 10 10 18 32 4 12 4     4     14       10                     10         10   10                     10     8 8   10 10 10     10       10 2               10     4 4                 10 2             10 10 4     6             6 6   6 2     4 4                       4                         4     2         2 2 2 2 2 2 2 2   2       2       2     124 124     124 124 44   80 80   124 80     4     4 4       2     2 2   80 80 80         2 80   2 2 82           6 6     2 2 2 2     2 2   72 12 10 10   12         72     8     2     2         8 8 8 8 8 8 8 8       8 8 12 12 12 4   12         12                           12 12 8     4             4 2   2     8         2       98 98 98 98 98 98 98 98 98             49 49 568   568 568       566       566 566         564   564 564     89 89         87     562 562           41 171             171 1116                 41 116               41 558 654 654               654 654         652 652           652     161 161 161   652   1068     2       2     1068 1068             1066         1066         1064 1064 1064   1064 1064           1060           1060 161 161   161 161             642   161 161             640       640           638             638                   2         564 564 564 2632 2632                       175 175 175     564     2         118104 118104 118104 118104 118104 118104 118104 118104 118104 118104 118104 39861   78243 78243 78243 78243 78243 78243   114004 343     114004 114004 114004 9310   9310             1208 1208   8102     3007 3007     9310 4215   5095     114004 114004 78221   35783 35783           35781   35781       35781         35779     1208 1208           1206 1206           1204 1204         1202   2094 2094 2094 40   40         40         38     2092 2092           2090 2090           2088 2088           2086 2086           2084   35763 35763         35763 35763 35763             78221 20506 165 165 261                   20506     57715 2292     57715           57715           57576 3781     53795       53795           53787 4           53787   6900 6900   2219 2219   38 38   2748 2748   526   1009   2748   2567 2567   232   232   2567   22810       22810       260     260     696 696   521 521   387 387 385   387   219 219   22810   16505   53787             53770 53770 7974   53770         7974   9482                   7950 7950             7948 7948             7946 3402 3402   7946             7944       5502 5502             5500         5500                       5496         5496                     5492       12053       12053             12051       12051             12049   4755 4755                 11541 41489 41489 34594   34594                         41332 22598 2018   2018                                                             41290 41290               40548                 10598 100 98       2               2 2 2                   10596       25937 25937             25935 25935             25933 25933           25931       52267 52267         5022   52267               52228   52228   922                 52228 52228 1430   1430             1408   1430 1430   52228               52217         52217 1084   1084             480   1084   52217 52217               52215   670             2   52215             52213   52213 8               52207     2       4 12   4 2 2     2     1     1   1     1 1     4 4             4 3 3   4           4     4 4     2       689100 689100 687556   1544 3088     9892     1544       1544       1544 1544 4   1544             1544             1544 1544 1544     2   3     3       3                                     3     3 3   3 3     2       2   2       55 55 55 55 55     55 5   55         2         59 59 59 59       207 207           59     59 59 59 59 59 59 59 647     647     321       321 321 310     11 5   11   56   140     56       56 28   28 14   28   270 270 117     153 25   128         2     126 16 16     110 210           110   192   59   59 59 137     59     647 647     647                 59             59 59 59   59     62                     59       59                               2         3         3 6     3   3         3     9 9   3       3     3   3 3         3           3         9     3         3   3 3       3         3                 3 3                     3     9       3 3     2       1 1 1         1 1       1           1                     1     1       1     1         2                                                                                                                           2       3 3 3 3 3 7   2                     2       2                     2 1         1     1     1     2         1 1 1     1     1     2     1         1         1 1     1     1     1 1   1     1 1   1 1 1   1   1   1             1   1           1   1         1   2   2 2             2       3 2 2 2       1 1           1 6     1   148 148 148   148             148 148 148             1   1   6       1 494 494 494 494 494           74 74 74   74 74 74     90           74       74   74             1     6     74       1     1         1       121 121   121 55           1 4     28             1                   1     2         131   131           131 4   127 18   109   6 6 2           6 6   13       13                                           6 3                 6 16 8 8 2 2         103       37   66 27     39     131 149       149   131   131           485               485   131 16               131               131 78 16 62 27 46             35   53 13     131                   131     2       24 24 24                 2       4               2       10               2 2 1   1       1       1                  
//#!/usr/bin/env node
/*
 * lib.swgg.js (2019.2.20)
 * https://github.com/kaizhu256/node-swgg
 * this zero-dependency package will run a virtual swagger-ui server with persistent-storage in the browser, that your webapp can use (in-place of a real backend), with a working web-demo
 *
 */
 
 
 
/* istanbul instrument in package swgg */
/* istanbul ignore next */
/* jslint utility2:true */
(function (globalThis) {
    "use strict";
    var consoleError;
    var local;
    // init globalThis
    (function () {
        try {
            globalThis = Function("return this")(); // jslint ignore:line
        } catch (ignore) {}
    }());
    globalThis.globalThis = globalThis;
    // init debug_inline
    Iif (!globalThis["debug\u0049nline"]) {
        consoleError = console.error;
        globalThis["debug\u0049nline"] = function () {
        /*
         * this function will both print <arguments> to stderr
         * and return <arguments>[0]
         */
            var argList;
            argList = Array.from(arguments); // jslint ignore:line
            // debug arguments
            globalThis["debug\u0049nlineArguments"] = argList;
            consoleError("\n\ndebug\u0049nline");
            consoleError.apply(console, argList);
            consoleError("\n");
            // return arg0 for inspection
            return argList[0];
        };
    }
    // init local
    local = {};
    local.local = local;
    globalThis.globalLocal = local;
    // init isBrowser
    local.isBrowser = (
        typeof window === "object"
        && window === globalThis
        && typeof window.XMLHttpRequest === "function"
        && window.document
        && typeof window.document.querySelector === "function"
    );
    // init function
    local.assertThrow = function (passed, message) {
    /*
     * this function will throw error <message> if <passed> is falsy
     */
        var error;
        Eif (passed) {
            return;
        }
        error = (
            // ternary-condition
            (
                message
                && typeof message.message === "string"
                && typeof message.stack === "string"
            )
            // if message is an error-object, then leave it as is
            ? message
            : new Error(
                typeof message === "string"
                // if message is a string, then leave it as is
                ? message
                // else JSON.stringify message
                : JSON.stringify(message, null, 4)
            )
        );
        throw error;
    };
    local.functionOrNop = function (fnc) {
    /*
     * this function will if <fnc> exists,
     * them return <fnc>,
     * else return <nop>
     */
        return fnc || local.nop;
    };
    local.identity = function (value) {
    /*
     * this function will return <value>
     */
        return value;
    };
    local.nop = function () {
    /*
     * this function will do nothing
     */
        return;
    };
    local.objectAssignDefault = function (target, source) {
    /*
     * this function will if items from <target> are
     * null, undefined, or empty-string,
     * then overwrite them with items from <source>
     */
        target = target || {};
        Object.keys(source || {}).forEach(function (key) {
            if (
                target[key] === null
                || target[key] === undefined
                || target[key] === ""
            ) {
                target[key] = target[key] || source[key];
            }
        });
        return target;
    };
    // require builtin
    if (!local.isBrowser) {
        local.assert = require("assert");
        local.buffer = require("buffer");
        local.child_process = require("child_process");
        local.cluster = require("cluster");
        local.crypto = require("crypto");
        local.dgram = require("dgram");
        local.dns = require("dns");
        local.domain = require("domain");
        local.events = require("events");
        local.fs = require("fs");
        local.http = require("http");
        local.https = require("https");
        local.net = require("net");
        local.os = require("os");
        local.path = require("path");
        local.querystring = require("querystring");
        local.readline = require("readline");
        local.repl = require("repl");
        local.stream = require("stream");
        local.string_decoder = require("string_decoder");
        local.timers = require("timers");
        local.tls = require("tls");
        local.tty = require("tty");
        local.url = require("url");
        local.util = require("util");
        local.vm = require("vm");
        local.zlib = require("zlib");
    }
}(this));
 
 
 
(function (local) {
"use strict";
 
 
 
/* istanbul ignore next */
// run shared js-env code - init-before
(function () {
// init local
local = (
    globalThis.utility2_rollup
    // || globalThis.utility2_rollup_old
    // || require("./assets.utility2.rollup.js")
    || globalThis.globalLocal
);
// init exports
if (local.isBrowser) {
    globalThis.utility2_swgg = local;
} else {
    module.exports = local;
    module.exports.__dirname = __dirname;
}
// init lib main
local.swgg = local;
 
 
 
/* validateLineSortedReset */
// init lib utility2
local.utility2 = globalThis.utility2_rollup || (
    local.isBrowser
    ? globalThis.utility2
    : (function () {
        try {
            return require("./lib.utility2.js");
        } catch (ignore) {
            return require("./assets.utility2.rollup.js");
        }
    }())
);
local.utility2.objectSetDefault(local, local.utility2);
// init lib swgg
globalThis.swgg = local;
local.utility2.swgg = local;
/* validateLineSortedReset */
// init assets and templates
// https://github.com/json-schema-org/json-schema-org.github.io/blob/eb4805e94c3e27932352344767d19cc4c3c3381c/draft-04/schema
/* jslint ignore:start */
// curl -Ls https://raw.githubusercontent.com/json-schema-org/json-schema-org.github.io/eb4805e94c3e27932352344767d19cc4c3c3381c/draft-04/schema > /tmp/aa.json; node -e "console.log(JSON.stringify(require('/tmp/aa.json')));"
local.assetsDict["/assets.swgg.json-schema.json"] = JSON.stringify(
{"id":"http://json-schema.org/draft-04/schema#","$schema":"http://json-schema.org/draft-04/schema#","description":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"positiveInteger":{"type":"integer","minimum":0},"positiveIntegerDefault0":{"allOf":[{"$ref":"#/definitions/positiveInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"minItems":1,"uniqueItems":true}},"type":"object","properties":{"id":{"type":"string","format":"uri"},"$schema":{"type":"string","format":"uri"},"title":{"type":"string"},"description":{"type":"string"},"default":{},"multipleOf":{"type":"number","minimum":0,"exclusiveMinimum":true},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"boolean","default":false},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"boolean","default":false},"maxLength":{"$ref":"#/definitions/positiveInteger"},"minLength":{"$ref":"#/definitions/positiveIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"anyOf":[{"type":"boolean"},{"$ref":"#"}],"default":{}},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":{}},"maxItems":{"$ref":"#/definitions/positiveInteger"},"minItems":{"$ref":"#/definitions/positiveIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"maxProperties":{"$ref":"#/definitions/positiveInteger"},"minProperties":{"$ref":"#/definitions/positiveIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"anyOf":[{"type":"boolean"},{"$ref":"#"}],"default":{}},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"enum":{"type":"array","minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"dependencies":{"exclusiveMaximum":["maximum"],"exclusiveMinimum":["minimum"]},"default":{}}
);
 
 
 
// https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/schemas/v2.0/schema.json
// curl -Ls https://raw.githubusercontent.com/OAI/OpenAPI-Specification/3.0.0/schemas/v2.0/schema.json > /tmp/aa.json; node -e "console.log(JSON.stringify(require('/tmp/aa.json')));"
local.assetsDict["/assets.swgg.schema.json"] = JSON.stringify(
{"title":"A JSON Schema for Swagger 2.0 API.","id":"http://swagger.io/v2/schema.json#","$schema":"http://json-schema.org/draft-04/schema#","type":"object","required":["swagger","info","paths"],"additionalProperties":false,"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}},"properties":{"swagger":{"type":"string","enum":["2.0"],"description":"The Swagger version of this document."},"info":{"$ref":"#/definitions/info"},"host":{"type":"string","pattern":"^[^{}/ :\\\\]+(?::\\d+)?$","description":"The host (name or ip) of the API. Example: 'swagger.io'"},"basePath":{"type":"string","pattern":"^/","description":"The base path to the API. Example: '/api'."},"schemes":{"$ref":"#/definitions/schemesList"},"consumes":{"description":"A list of MIME types accepted by the API.","allOf":[{"$ref":"#/definitions/mediaTypeList"}]},"produces":{"description":"A list of MIME types the API can produce.","allOf":[{"$ref":"#/definitions/mediaTypeList"}]},"paths":{"$ref":"#/definitions/paths"},"definitions":{"$ref":"#/definitions/definitions"},"parameters":{"$ref":"#/definitions/parameterDefinitions"},"responses":{"$ref":"#/definitions/responseDefinitions"},"security":{"$ref":"#/definitions/security"},"securityDefinitions":{"$ref":"#/definitions/securityDefinitions"},"tags":{"type":"array","items":{"$ref":"#/definitions/tag"},"uniqueItems":true},"externalDocs":{"$ref":"#/definitions/externalDocs"}},"definitions":{"info":{"type":"object","description":"General information about the API.","required":["version","title"],"additionalProperties":false,"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}},"properties":{"title":{"type":"string","description":"A unique and precise title of the API."},"version":{"type":"string","description":"A semantic version number of the API."},"description":{"type":"string","description":"A longer description of the API. Should be different from the title.  GitHub Flavored Markdown is allowed."},"termsOfService":{"type":"string","description":"The terms of service for the API."},"contact":{"$ref":"#/definitions/contact"},"license":{"$ref":"#/definitions/license"}}},"contact":{"type":"object","description":"Contact information for the owners of the API.","additionalProperties":false,"properties":{"name":{"type":"string","description":"The identifying name of the contact person/organization."},"url":{"type":"string","description":"The URL pointing to the contact information.","format":"uri"},"email":{"type":"string","description":"The email address of the contact person/organization.","format":"email"}},"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"license":{"type":"object","required":["name"],"additionalProperties":false,"properties":{"name":{"type":"string","description":"The name of the license type. It's encouraged to use an OSI compatible license."},"url":{"type":"string","description":"The URL pointing to the license.","format":"uri"}},"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"paths":{"type":"object","description":"Relative paths to the individual endpoints. They must be relative to the 'basePath'.","patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"},"^/":{"$ref":"#/definitions/pathItem"}},"additionalProperties":false},"definitions":{"type":"object","additionalProperties":{"$ref":"#/definitions/schema"},"description":"One or more JSON objects describing the schemas being consumed and produced by the API."},"parameterDefinitions":{"type":"object","additionalProperties":{"$ref":"#/definitions/parameter"},"description":"One or more JSON representations for parameters"},"responseDefinitions":{"type":"object","additionalProperties":{"$ref":"#/definitions/response"},"description":"One or more JSON representations for parameters"},"externalDocs":{"type":"object","additionalProperties":false,"description":"information about external documentation","required":["url"],"properties":{"description":{"type":"string"},"url":{"type":"string","format":"uri"}},"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"examples":{"type":"object","additionalProperties":true},"mimeType":{"type":"string","description":"The MIME type of the HTTP message."},"operation":{"type":"object","required":["responses"],"additionalProperties":false,"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}},"properties":{"tags":{"type":"array","items":{"type":"string"},"uniqueItems":true},"summary":{"type":"string","description":"A brief summary of the operation."},"description":{"type":"string","description":"A longer description of the operation, GitHub Flavored Markdown is allowed."},"externalDocs":{"$ref":"#/definitions/externalDocs"},"operationId":{"type":"string","description":"A unique identifier of the operation."},"produces":{"description":"A list of MIME types the API can produce.","allOf":[{"$ref":"#/definitions/mediaTypeList"}]},"consumes":{"description":"A list of MIME types the API can consume.","allOf":[{"$ref":"#/definitions/mediaTypeList"}]},"parameters":{"$ref":"#/definitions/parametersList"},"responses":{"$ref":"#/definitions/responses"},"schemes":{"$ref":"#/definitions/schemesList"},"deprecated":{"type":"boolean","default":false},"security":{"$ref":"#/definitions/security"}}},"pathItem":{"type":"object","additionalProperties":false,"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}},"properties":{"$ref":{"type":"string"},"get":{"$ref":"#/definitions/operation"},"put":{"$ref":"#/definitions/operation"},"post":{"$ref":"#/definitions/operation"},"delete":{"$ref":"#/definitions/operation"},"options":{"$ref":"#/definitions/operation"},"head":{"$ref":"#/definitions/operation"},"patch":{"$ref":"#/definitions/operation"},"parameters":{"$ref":"#/definitions/parametersList"}}},"responses":{"type":"object","description":"Response objects names can either be any valid HTTP status code or 'default'.","minProperties":1,"additionalProperties":false,"patternProperties":{"^([0-9]{3})$|^(default)$":{"$ref":"#/definitions/responseValue"},"^x-":{"$ref":"#/definitions/vendorExtension"}},"not":{"type":"object","additionalProperties":false,"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}}},"responseValue":{"oneOf":[{"$ref":"#/definitions/response"},{"$ref":"#/definitions/jsonReference"}]},"response":{"type":"object","required":["description"],"properties":{"description":{"type":"string"},"schema":{"oneOf":[{"$ref":"#/definitions/schema"},{"$ref":"#/definitions/fileSchema"}]},"headers":{"$ref":"#/definitions/headers"},"examples":{"$ref":"#/definitions/examples"}},"additionalProperties":false,"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"headers":{"type":"object","additionalProperties":{"$ref":"#/definitions/header"}},"header":{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["string","number","integer","boolean","array"]},"format":{"type":"string"},"items":{"$ref":"#/definitions/primitivesItems"},"collectionFormat":{"$ref":"#/definitions/collectionFormat"},"default":{"$ref":"#/definitions/default"},"maximum":{"$ref":"#/definitions/maximum"},"exclusiveMaximum":{"$ref":"#/definitions/exclusiveMaximum"},"minimum":{"$ref":"#/definitions/minimum"},"exclusiveMinimum":{"$ref":"#/definitions/exclusiveMinimum"},"maxLength":{"$ref":"#/definitions/maxLength"},"minLength":{"$ref":"#/definitions/minLength"},"pattern":{"$ref":"#/definitions/pattern"},"maxItems":{"$ref":"#/definitions/maxItems"},"minItems":{"$ref":"#/definitions/minItems"},"uniqueItems":{"$ref":"#/definitions/uniqueItems"},"enum":{"$ref":"#/definitions/enum"},"multipleOf":{"$ref":"#/definitions/multipleOf"},"description":{"type":"string"}},"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"vendorExtension":{"description":"Any property starting with x- is valid.","additionalProperties":true,"additionalItems":true},"bodyParameter":{"type":"object","required":["name","in","schema"],"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}},"properties":{"description":{"type":"string","description":"A brief description of the parameter. This could contain examples of use.  GitHub Flavored Markdown is allowed."},"name":{"type":"string","description":"The name of the parameter."},"in":{"type":"string","description":"Determines the location of the parameter.","enum":["body"]},"required":{"type":"boolean","description":"Determines whether or not this parameter is required or optional.","default":false},"schema":{"$ref":"#/definitions/schema"}},"additionalProperties":false},"headerParameterSubSchema":{"additionalProperties":false,"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}},"properties":{"required":{"type":"boolean","description":"Determines whether or not this parameter is required or optional.","default":false},"in":{"type":"string","description":"Determines the location of the parameter.","enum":["header"]},"description":{"type":"string","description":"A brief description of the parameter. This could contain examples of use.  GitHub Flavored Markdown is allowed."},"name":{"type":"string","description":"The name of the parameter."},"type":{"type":"string","enum":["string","number","boolean","integer","array"]},"format":{"type":"string"},"items":{"$ref":"#/definitions/primitivesItems"},"collectionFormat":{"$ref":"#/definitions/collectionFormat"},"default":{"$ref":"#/definitions/default"},"maximum":{"$ref":"#/definitions/maximum"},"exclusiveMaximum":{"$ref":"#/definitions/exclusiveMaximum"},"minimum":{"$ref":"#/definitions/minimum"},"exclusiveMinimum":{"$ref":"#/definitions/exclusiveMinimum"},"maxLength":{"$ref":"#/definitions/maxLength"},"minLength":{"$ref":"#/definitions/minLength"},"pattern":{"$ref":"#/definitions/pattern"},"maxItems":{"$ref":"#/definitions/maxItems"},"minItems":{"$ref":"#/definitions/minItems"},"uniqueItems":{"$ref":"#/definitions/uniqueItems"},"enum":{"$ref":"#/definitions/enum"},"multipleOf":{"$ref":"#/definitions/multipleOf"}}},"queryParameterSubSchema":{"additionalProperties":false,"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}},"properties":{"required":{"type":"boolean","description":"Determines whether or not this parameter is required or optional.","default":false},"in":{"type":"string","description":"Determines the location of the parameter.","enum":["query"]},"description":{"type":"string","description":"A brief description of the parameter. This could contain examples of use.  GitHub Flavored Markdown is allowed."},"name":{"type":"string","description":"The name of the parameter."},"allowEmptyValue":{"type":"boolean","default":false,"description":"allows sending a parameter by name only or with an empty value."},"type":{"type":"string","enum":["string","number","boolean","integer","array"]},"format":{"type":"string"},"items":{"$ref":"#/definitions/primitivesItems"},"collectionFormat":{"$ref":"#/definitions/collectionFormatWithMulti"},"default":{"$ref":"#/definitions/default"},"maximum":{"$ref":"#/definitions/maximum"},"exclusiveMaximum":{"$ref":"#/definitions/exclusiveMaximum"},"minimum":{"$ref":"#/definitions/minimum"},"exclusiveMinimum":{"$ref":"#/definitions/exclusiveMinimum"},"maxLength":{"$ref":"#/definitions/maxLength"},"minLength":{"$ref":"#/definitions/minLength"},"pattern":{"$ref":"#/definitions/pattern"},"maxItems":{"$ref":"#/definitions/maxItems"},"minItems":{"$ref":"#/definitions/minItems"},"uniqueItems":{"$ref":"#/definitions/uniqueItems"},"enum":{"$ref":"#/definitions/enum"},"multipleOf":{"$ref":"#/definitions/multipleOf"}}},"formDataParameterSubSchema":{"additionalProperties":false,"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}},"properties":{"required":{"type":"boolean","description":"Determines whether or not this parameter is required or optional.","default":false},"in":{"type":"string","description":"Determines the location of the parameter.","enum":["formData"]},"description":{"type":"string","description":"A brief description of the parameter. This could contain examples of use.  GitHub Flavored Markdown is allowed."},"name":{"type":"string","description":"The name of the parameter."},"allowEmptyValue":{"type":"boolean","default":false,"description":"allows sending a parameter by name only or with an empty value."},"type":{"type":"string","enum":["string","number","boolean","integer","array","file"]},"format":{"type":"string"},"items":{"$ref":"#/definitions/primitivesItems"},"collectionFormat":{"$ref":"#/definitions/collectionFormatWithMulti"},"default":{"$ref":"#/definitions/default"},"maximum":{"$ref":"#/definitions/maximum"},"exclusiveMaximum":{"$ref":"#/definitions/exclusiveMaximum"},"minimum":{"$ref":"#/definitions/minimum"},"exclusiveMinimum":{"$ref":"#/definitions/exclusiveMinimum"},"maxLength":{"$ref":"#/definitions/maxLength"},"minLength":{"$ref":"#/definitions/minLength"},"pattern":{"$ref":"#/definitions/pattern"},"maxItems":{"$ref":"#/definitions/maxItems"},"minItems":{"$ref":"#/definitions/minItems"},"uniqueItems":{"$ref":"#/definitions/uniqueItems"},"enum":{"$ref":"#/definitions/enum"},"multipleOf":{"$ref":"#/definitions/multipleOf"}}},"pathParameterSubSchema":{"additionalProperties":false,"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}},"required":["required"],"properties":{"required":{"type":"boolean","enum":[true],"description":"Determines whether or not this parameter is required or optional."},"in":{"type":"string","description":"Determines the location of the parameter.","enum":["path"]},"description":{"type":"string","description":"A brief description of the parameter. This could contain examples of use.  GitHub Flavored Markdown is allowed."},"name":{"type":"string","description":"The name of the parameter."},"type":{"type":"string","enum":["string","number","boolean","integer","array"]},"format":{"type":"string"},"items":{"$ref":"#/definitions/primitivesItems"},"collectionFormat":{"$ref":"#/definitions/collectionFormat"},"default":{"$ref":"#/definitions/default"},"maximum":{"$ref":"#/definitions/maximum"},"exclusiveMaximum":{"$ref":"#/definitions/exclusiveMaximum"},"minimum":{"$ref":"#/definitions/minimum"},"exclusiveMinimum":{"$ref":"#/definitions/exclusiveMinimum"},"maxLength":{"$ref":"#/definitions/maxLength"},"minLength":{"$ref":"#/definitions/minLength"},"pattern":{"$ref":"#/definitions/pattern"},"maxItems":{"$ref":"#/definitions/maxItems"},"minItems":{"$ref":"#/definitions/minItems"},"uniqueItems":{"$ref":"#/definitions/uniqueItems"},"enum":{"$ref":"#/definitions/enum"},"multipleOf":{"$ref":"#/definitions/multipleOf"}}},"nonBodyParameter":{"type":"object","required":["name","in","type"],"oneOf":[{"$ref":"#/definitions/headerParameterSubSchema"},{"$ref":"#/definitions/formDataParameterSubSchema"},{"$ref":"#/definitions/queryParameterSubSchema"},{"$ref":"#/definitions/pathParameterSubSchema"}]},"parameter":{"oneOf":[{"$ref":"#/definitions/bodyParameter"},{"$ref":"#/definitions/nonBodyParameter"}]},"schema":{"type":"object","description":"A deterministic version of a JSON Schema object.","patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}},"properties":{"$ref":{"type":"string"},"format":{"type":"string"},"title":{"$ref":"http://json-schema.org/draft-04/schema#/properties/title"},"description":{"$ref":"http://json-schema.org/draft-04/schema#/properties/description"},"default":{"$ref":"http://json-schema.org/draft-04/schema#/properties/default"},"multipleOf":{"$ref":"http://json-schema.org/draft-04/schema#/properties/multipleOf"},"maximum":{"$ref":"http://json-schema.org/draft-04/schema#/properties/maximum"},"exclusiveMaximum":{"$ref":"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"},"minimum":{"$ref":"http://json-schema.org/draft-04/schema#/properties/minimum"},"exclusiveMinimum":{"$ref":"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"},"maxLength":{"$ref":"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},"minLength":{"$ref":"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},"pattern":{"$ref":"http://json-schema.org/draft-04/schema#/properties/pattern"},"maxItems":{"$ref":"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},"minItems":{"$ref":"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},"uniqueItems":{"$ref":"http://json-schema.org/draft-04/schema#/properties/uniqueItems"},"maxProperties":{"$ref":"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},"minProperties":{"$ref":"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},"required":{"$ref":"http://json-schema.org/draft-04/schema#/definitions/stringArray"},"enum":{"$ref":"http://json-schema.org/draft-04/schema#/properties/enum"},"additionalProperties":{"anyOf":[{"$ref":"#/definitions/schema"},{"type":"boolean"}],"default":{}},"type":{"$ref":"http://json-schema.org/draft-04/schema#/properties/type"},"items":{"anyOf":[{"$ref":"#/definitions/schema"},{"type":"array","minItems":1,"items":{"$ref":"#/definitions/schema"}}],"default":{}},"allOf":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/schema"}},"properties":{"type":"object","additionalProperties":{"$ref":"#/definitions/schema"},"default":{}},"discriminator":{"type":"string"},"readOnly":{"type":"boolean","default":false},"xml":{"$ref":"#/definitions/xml"},"externalDocs":{"$ref":"#/definitions/externalDocs"},"example":{}},"additionalProperties":false},"fileSchema":{"type":"object","description":"A deterministic version of a JSON Schema object.","patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}},"required":["type"],"properties":{"format":{"type":"string"},"title":{"$ref":"http://json-schema.org/draft-04/schema#/properties/title"},"description":{"$ref":"http://json-schema.org/draft-04/schema#/properties/description"},"default":{"$ref":"http://json-schema.org/draft-04/schema#/properties/default"},"required":{"$ref":"http://json-schema.org/draft-04/schema#/definitions/stringArray"},"type":{"type":"string","enum":["file"]},"readOnly":{"type":"boolean","default":false},"externalDocs":{"$ref":"#/definitions/externalDocs"},"example":{}},"additionalProperties":false},"primitivesItems":{"type":"object","additionalProperties":false,"properties":{"type":{"type":"string","enum":["string","number","integer","boolean","array"]},"format":{"type":"string"},"items":{"$ref":"#/definitions/primitivesItems"},"collectionFormat":{"$ref":"#/definitions/collectionFormat"},"default":{"$ref":"#/definitions/default"},"maximum":{"$ref":"#/definitions/maximum"},"exclusiveMaximum":{"$ref":"#/definitions/exclusiveMaximum"},"minimum":{"$ref":"#/definitions/minimum"},"exclusiveMinimum":{"$ref":"#/definitions/exclusiveMinimum"},"maxLength":{"$ref":"#/definitions/maxLength"},"minLength":{"$ref":"#/definitions/minLength"},"pattern":{"$ref":"#/definitions/pattern"},"maxItems":{"$ref":"#/definitions/maxItems"},"minItems":{"$ref":"#/definitions/minItems"},"uniqueItems":{"$ref":"#/definitions/uniqueItems"},"enum":{"$ref":"#/definitions/enum"},"multipleOf":{"$ref":"#/definitions/multipleOf"}},"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"security":{"type":"array","items":{"$ref":"#/definitions/securityRequirement"},"uniqueItems":true},"securityRequirement":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"},"uniqueItems":true}},"xml":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string"},"namespace":{"type":"string"},"prefix":{"type":"string"},"attribute":{"type":"boolean","default":false},"wrapped":{"type":"boolean","default":false}},"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"tag":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"externalDocs":{"$ref":"#/definitions/externalDocs"}},"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"securityDefinitions":{"type":"object","additionalProperties":{"oneOf":[{"$ref":"#/definitions/basicAuthenticationSecurity"},{"$ref":"#/definitions/apiKeySecurity"},{"$ref":"#/definitions/oauth2ImplicitSecurity"},{"$ref":"#/definitions/oauth2PasswordSecurity"},{"$ref":"#/definitions/oauth2ApplicationSecurity"},{"$ref":"#/definitions/oauth2AccessCodeSecurity"}]}},"basicAuthenticationSecurity":{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["basic"]},"description":{"type":"string"}},"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"apiKeySecurity":{"type":"object","additionalProperties":false,"required":["type","name","in"],"properties":{"type":{"type":"string","enum":["apiKey"]},"name":{"type":"string"},"in":{"type":"string","enum":["header","query"]},"description":{"type":"string"}},"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"oauth2ImplicitSecurity":{"type":"object","additionalProperties":false,"required":["type","flow","authorizationUrl"],"properties":{"type":{"type":"string","enum":["oauth2"]},"flow":{"type":"string","enum":["implicit"]},"scopes":{"$ref":"#/definitions/oauth2Scopes"},"authorizationUrl":{"type":"string","format":"uri"},"description":{"type":"string"}},"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"oauth2PasswordSecurity":{"type":"object","additionalProperties":false,"required":["type","flow","tokenUrl"],"properties":{"type":{"type":"string","enum":["oauth2"]},"flow":{"type":"string","enum":["password"]},"scopes":{"$ref":"#/definitions/oauth2Scopes"},"tokenUrl":{"type":"string","format":"uri"},"description":{"type":"string"}},"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"oauth2ApplicationSecurity":{"type":"object","additionalProperties":false,"required":["type","flow","tokenUrl"],"properties":{"type":{"type":"string","enum":["oauth2"]},"flow":{"type":"string","enum":["application"]},"scopes":{"$ref":"#/definitions/oauth2Scopes"},"tokenUrl":{"type":"string","format":"uri"},"description":{"type":"string"}},"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"oauth2AccessCodeSecurity":{"type":"object","additionalProperties":false,"required":["type","flow","authorizationUrl","tokenUrl"],"properties":{"type":{"type":"string","enum":["oauth2"]},"flow":{"type":"string","enum":["accessCode"]},"scopes":{"$ref":"#/definitions/oauth2Scopes"},"authorizationUrl":{"type":"string","format":"uri"},"tokenUrl":{"type":"string","format":"uri"},"description":{"type":"string"}},"patternProperties":{"^x-":{"$ref":"#/definitions/vendorExtension"}}},"oauth2Scopes":{"type":"object","additionalProperties":{"type":"string"}},"mediaTypeList":{"type":"array","items":{"$ref":"#/definitions/mimeType"},"uniqueItems":true},"parametersList":{"type":"array","description":"The parameters needed to send a valid API call.","additionalItems":false,"items":{"oneOf":[{"$ref":"#/definitions/parameter"},{"$ref":"#/definitions/jsonReference"}]},"uniqueItems":true},"schemesList":{"type":"array","description":"The transfer protocol of the API.","items":{"type":"string","enum":["http","https","ws","wss"]},"uniqueItems":true},"collectionFormat":{"type":"string","enum":["csv","ssv","tsv","pipes"],"default":"csv"},"collectionFormatWithMulti":{"type":"string","enum":["csv","ssv","tsv","pipes","multi"],"default":"csv"},"title":{"$ref":"http://json-schema.org/draft-04/schema#/properties/title"},"description":{"$ref":"http://json-schema.org/draft-04/schema#/properties/description"},"default":{"$ref":"http://json-schema.org/draft-04/schema#/properties/default"},"multipleOf":{"$ref":"http://json-schema.org/draft-04/schema#/properties/multipleOf"},"maximum":{"$ref":"http://json-schema.org/draft-04/schema#/properties/maximum"},"exclusiveMaximum":{"$ref":"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"},"minimum":{"$ref":"http://json-schema.org/draft-04/schema#/properties/minimum"},"exclusiveMinimum":{"$ref":"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"},"maxLength":{"$ref":"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},"minLength":{"$ref":"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},"pattern":{"$ref":"http://json-schema.org/draft-04/schema#/properties/pattern"},"maxItems":{"$ref":"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},"minItems":{"$ref":"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},"uniqueItems":{"$ref":"http://json-schema.org/draft-04/schema#/properties/uniqueItems"},"enum":{"$ref":"http://json-schema.org/draft-04/schema#/properties/enum"},"jsonReference":{"type":"object","required":["$ref"],"additionalProperties":false,"properties":{"$ref":{"type":"string"}}}}}
);
 
 
 
local.assetsDict["/assets.swgg.swagger.json"] = local.assetsDict["/assets.swgg.swagger.json"] || "";
 
 
 
// https://petstore.swagger.io/v2/swagger.json
// curl -Ls https://petstore.swagger.io/v2/swagger.json > /tmp/aa.json; node -e "console.log(JSON.stringify(require('/tmp/aa.json')));"
local.assetsDict["/assets.swgg.swagger.petstore.json"] = JSON.stringify(
{"swagger":"2.0","info":{"description":"This is a sample server Petstore server.  You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).  For this sample, you can use the api key `special-key` to test the authorization filters.","version":"1.0.0","title":"Swagger Petstore","termsOfService":"http://swagger.io/terms/","contact":{"email":"apiteam@swagger.io"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"host":"petstore.swagger.io","basePath":"/v2","tags":[{"name":"pet","description":"Everything about your Pets","externalDocs":{"description":"Find out more","url":"http://swagger.io"}},{"name":"store","description":"Access to Petstore orders"},{"name":"user","description":"Operations about user","externalDocs":{"description":"Find out more about our store","url":"http://swagger.io"}}],"schemes":["http"],"paths":{"/pet":{"post":{"tags":["pet"],"summary":"Add a new pet to the store","description":"","operationId":"addPet","consumes":["application/json","application/xml"],"produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"Pet object that needs to be added to the store","required":true,"schema":{"$ref":"#/definitions/Pet"}}],"responses":{"405":{"description":"Invalid input"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]},"put":{"tags":["pet"],"summary":"Update an existing pet","description":"","operationId":"updatePet","consumes":["application/json","application/xml"],"produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"Pet object that needs to be added to the store","required":true,"schema":{"$ref":"#/definitions/Pet"}}],"responses":{"400":{"description":"Invalid ID supplied"},"404":{"description":"Pet not found"},"405":{"description":"Validation exception"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/findByStatus":{"get":{"tags":["pet"],"summary":"Finds Pets by status","description":"Multiple status values can be provided with comma separated strings","operationId":"findPetsByStatus","produces":["application/xml","application/json"],"parameters":[{"name":"status","in":"query","description":"Status values that need to be considered for filter","required":true,"type":"array","items":{"type":"string","enum":["available","pending","sold"],"default":"available"},"collectionFormat":"multi"}],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"$ref":"#/definitions/Pet"}}},"400":{"description":"Invalid status value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/findByTags":{"get":{"tags":["pet"],"summary":"Finds Pets by tags","description":"Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.","operationId":"findPetsByTags","produces":["application/xml","application/json"],"parameters":[{"name":"tags","in":"query","description":"Tags to filter by","required":true,"type":"array","items":{"type":"string"},"collectionFormat":"multi"}],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"$ref":"#/definitions/Pet"}}},"400":{"description":"Invalid tag value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}],"deprecated":true}},"/pet/{petId}":{"get":{"tags":["pet"],"summary":"Find pet by ID","description":"Returns a single pet","operationId":"getPetById","produces":["application/xml","application/json"],"parameters":[{"name":"petId","in":"path","description":"ID of pet to return","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/Pet"}},"400":{"description":"Invalid ID supplied"},"404":{"description":"Pet not found"}},"security":[{"api_key":[]}]},"post":{"tags":["pet"],"summary":"Updates a pet in the store with form data","description":"","operationId":"updatePetWithForm","consumes":["application/x-www-form-urlencoded"],"produces":["application/xml","application/json"],"parameters":[{"name":"petId","in":"path","description":"ID of pet that needs to be updated","required":true,"type":"integer","format":"int64"},{"name":"name","in":"formData","description":"Updated name of the pet","required":false,"type":"string"},{"name":"status","in":"formData","description":"Updated status of the pet","required":false,"type":"string"}],"responses":{"405":{"description":"Invalid input"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]},"delete":{"tags":["pet"],"summary":"Deletes a pet","description":"","operationId":"deletePet","produces":["application/xml","application/json"],"parameters":[{"name":"api_key","in":"header","required":false,"type":"string"},{"name":"petId","in":"path","description":"Pet id to delete","required":true,"type":"integer","format":"int64"}],"responses":{"400":{"description":"Invalid ID supplied"},"404":{"description":"Pet not found"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/{petId}/uploadImage":{"post":{"tags":["pet"],"summary":"uploads an image","description":"","operationId":"uploadFile","consumes":["multipart/form-data"],"produces":["application/json"],"parameters":[{"name":"petId","in":"path","description":"ID of pet to update","required":true,"type":"integer","format":"int64"},{"name":"additionalMetadata","in":"formData","description":"Additional data to pass to server","required":false,"type":"string"},{"name":"file","in":"formData","description":"file to upload","required":false,"type":"file"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiResponse"}}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/store/inventory":{"get":{"tags":["store"],"summary":"Returns pet inventories by status","description":"Returns a map of status codes to quantities","operationId":"getInventory","produces":["application/json"],"parameters":[],"responses":{"200":{"description":"successful operation","schema":{"type":"object","additionalProperties":{"type":"integer","format":"int32"}}}},"security":[{"api_key":[]}]}},"/store/order":{"post":{"tags":["store"],"summary":"Place an order for a pet","description":"","operationId":"placeOrder","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"order placed for purchasing the pet","required":true,"schema":{"$ref":"#/definitions/Order"}}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/Order"}},"400":{"description":"Invalid Order"}}}},"/store/order/{orderId}":{"get":{"tags":["store"],"summary":"Find purchase order by ID","description":"For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions","operationId":"getOrderById","produces":["application/xml","application/json"],"parameters":[{"name":"orderId","in":"path","description":"ID of pet that needs to be fetched","required":true,"type":"integer","maximum":10,"minimum":1,"format":"int64"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/Order"}},"400":{"description":"Invalid ID supplied"},"404":{"description":"Order not found"}}},"delete":{"tags":["store"],"summary":"Delete purchase order by ID","description":"For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors","operationId":"deleteOrder","produces":["application/xml","application/json"],"parameters":[{"name":"orderId","in":"path","description":"ID of the order that needs to be deleted","required":true,"type":"integer","minimum":1,"format":"int64"}],"responses":{"400":{"description":"Invalid ID supplied"},"404":{"description":"Order not found"}}}},"/user":{"post":{"tags":["user"],"summary":"Create user","description":"This can only be done by the logged in user.","operationId":"createUser","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"Created user object","required":true,"schema":{"$ref":"#/definitions/User"}}],"responses":{"default":{"description":"successful operation"}}}},"/user/createWithArray":{"post":{"tags":["user"],"summary":"Creates list of users with given input array","description":"","operationId":"createUsersWithArrayInput","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"List of user object","required":true,"schema":{"type":"array","items":{"$ref":"#/definitions/User"}}}],"responses":{"default":{"description":"successful operation"}}}},"/user/createWithList":{"post":{"tags":["user"],"summary":"Creates list of users with given input array","description":"","operationId":"createUsersWithListInput","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"List of user object","required":true,"schema":{"type":"array","items":{"$ref":"#/definitions/User"}}}],"responses":{"default":{"description":"successful operation"}}}},"/user/login":{"get":{"tags":["user"],"summary":"Logs user into the system","description":"","operationId":"loginUser","produces":["application/xml","application/json"],"parameters":[{"name":"username","in":"query","description":"The user name for login","required":true,"type":"string"},{"name":"password","in":"query","description":"The password for login in clear text","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"type":"string"},"headers":{"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"},"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when token expires"}}},"400":{"description":"Invalid username/password supplied"}}}},"/user/logout":{"get":{"tags":["user"],"summary":"Logs out current logged in user session","description":"","operationId":"logoutUser","produces":["application/xml","application/json"],"parameters":[],"responses":{"default":{"description":"successful operation"}}}},"/user/{username}":{"get":{"tags":["user"],"summary":"Get user by user name","description":"","operationId":"getUserByName","produces":["application/xml","application/json"],"parameters":[{"name":"username","in":"path","description":"The name that needs to be fetched. Use user1 for testing. ","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/User"}},"400":{"description":"Invalid username supplied"},"404":{"description":"User not found"}}},"put":{"tags":["user"],"summary":"Updated user","description":"This can only be done by the logged in user.","operationId":"updateUser","produces":["application/xml","application/json"],"parameters":[{"name":"username","in":"path","description":"name that need to be updated","required":true,"type":"string"},{"in":"body","name":"body","description":"Updated user object","required":true,"schema":{"$ref":"#/definitions/User"}}],"responses":{"400":{"description":"Invalid user supplied"},"404":{"description":"User not found"}}},"delete":{"tags":["user"],"summary":"Delete user","description":"This can only be done by the logged in user.","operationId":"deleteUser","produces":["application/xml","application/json"],"parameters":[{"name":"username","in":"path","description":"The name that needs to be deleted","required":true,"type":"string"}],"responses":{"400":{"description":"Invalid username supplied"},"404":{"description":"User not found"}}}}},"securityDefinitions":{"petstore_auth":{"type":"oauth2","authorizationUrl":"http://petstore.swagger.io/oauth/dialog","flow":"implicit","scopes":{"write:pets":"modify pets in your account","read:pets":"read your pets"}},"api_key":{"type":"apiKey","name":"api_key","in":"header"}},"definitions":{"Order":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"petId":{"type":"integer","format":"int64"},"quantity":{"type":"integer","format":"int32"},"shipDate":{"type":"string","format":"date-time"},"status":{"type":"string","description":"Order Status","enum":["placed","approved","delivered"]},"complete":{"type":"boolean","default":false}},"xml":{"name":"Order"}},"Category":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"}},"xml":{"name":"Category"}},"User":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"username":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"},"phone":{"type":"string"},"userStatus":{"type":"integer","format":"int32","description":"User Status"}},"xml":{"name":"User"}},"Tag":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"}},"xml":{"name":"Tag"}},"Pet":{"type":"object","required":["name","photoUrls"],"properties":{"id":{"type":"integer","format":"int64"},"category":{"$ref":"#/definitions/Category"},"name":{"type":"string","example":"doggie"},"photoUrls":{"type":"array","xml":{"name":"photoUrl","wrapped":true},"items":{"type":"string"}},"tags":{"type":"array","xml":{"name":"tag","wrapped":true},"items":{"$ref":"#/definitions/Tag"}},"status":{"type":"string","description":"pet status in the store","enum":["available","pending","sold"]}},"xml":{"name":"Pet"}},"ApiResponse":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"type":{"type":"string"},"message":{"type":"string"}}}},"externalDocs":{"description":"Find out more about Swagger","url":"http://swagger.io"}}
);
 
 
 
local.swaggerErrorTypeDict = {
    arrayMaxItems: '{{type2}} {{prefix0}} must have <= {{schema.maxItems}} items',
    arrayMinItems: '{{type2}} {{prefix0}} must have >= {{schema.minItems}} items',
    arrayUniqueItems: '{{type2}} {{prefix0}} must have unique items (has duplicate item {{tmp jsonStringify}})',
    itemEnum: '{{type2}} {{prefix0}} can only have items from the list {{schema.enum jsonStringify}}',
    itemAnyOf: '{{tmp}} (from schama.anyOf {{schema2}})',
    itemNot: '{{type2}} {{prefix0}} must not validate against schama.not {{schema2}}',
    itemOneOf: '{{type2}} {{prefix0}} did not validate against exactly one schema (validated {{tmp}}) in schema.oneOf {{schema2}}',
    itemType: 'value {{prefix0}} is not a valid {{type2}}',
    numberMultipleOf: '{{type2}} {{prefix0}} must be a multiple of {{schema.multipleOf}}',
    numberExclusiveMaximum: '{{type2}} {{prefix0}} must be < {{schema.maximum}}',
    numberExclusiveMinimum: '{{type2}} {{prefix0}} must be > {{schema.minimum}}',
    numberMaximum: '{{type2}} {{prefix0}} must be <= {{schema.maximum}}',
    numberMinimum: '{{type2}} {{prefix0}} must be >= {{schema.minimum}}',
    objectAdditionalProperties: '{{type2}} {{prefix0}} cannot have additional property {{key jsonStringify}}',
    objectDependencies: '{{type2}} {{prefix0}} with item {{key jsonStringify}} must have dependency {{key2 jsonStringify}}',
    objectMaxProperties: '{{type2}} {{prefix0}} must have <= {{schema.maxProperties}} properties',
    objectMinProperties: '{{type2}} {{prefix0}} must have >= {{schema.minProperties}} properties',
    objectRequired: '{{type2}} {{prefix0}} is required',
    schemaDereferenceCircular: 'cannot dereference circular-reference schema {{schema2}}',
    schemaDereference: 'cannot dereference schema {{schema2}}',
    // https://github.com/swagger-api/swagger-editor/tree/v3.1.20/src/plugins/validation/semantic-validators/validators
    // shGrep swagger-editor/src/plugins/validation/semantic-validators/validators 'message:'
    // form-data.js:90: "Parameter \"in: formdata\" is invalid, did you mean \"in: formData\" ( camelCase )?",
    semanticFormData1: "Parameter {{prefix0}} is invalid, did you mean \"in: formData\" ( camelCase )?",
    // form-data.js:109: "Parameters cannot have both a \"in: body\" and \"in: formData\", as \"formData\" _will_ be the body"
    semanticFormData2: "Parameters cannot have both a \"in: body\" and \"in: formData\", as \"formData\" _will_ be the body",
    // form-data.js:131: "Parameters with \"type: file\" must have \"in: formData\"",
    semanticFormData3: "Parameter {{prefix0}} with \"type: file\" must have \"in: formData\"",
    // form-data.js:140: "Operations with Parameters of \"type: file\" must include \"multipart/form-data\" in their \"consumes\" property",
    semanticFormData4: "Operation {{prefix0}} with Parameters of \"type: file\" must include \"multipart/form-data\" in their \"consumes\" property",
    // form-data.js:163: "Operations with Parameters of \"in: formData\" must include \"application/x-www-form-urlencoded\" or \"multipart/form-data\" in their \"consumes\" property",
    semanticFormData5: "Operation {{prefix0}} with Parameters of \"in: formData\" must include \"application/x-www-form-urlencoded\" or \"multipart/form-data\" in their \"consumes\" property",
    // items-required-for-array-objects.js:27: "Schema objects with 'array' type require an 'items' property"
    semanticItemsRequiredForArrayObjects1: "Schema {{schema2}} with 'array' type require an 'items' property",
    // items-required-for-array-objects.js:38: "Schema properties specified as 'required' must be defined"
    semanticItemsRequiredForArrayObjects2: "{{type2}} {{prefix0}} must have property {{key jsonStringify}}",
    // items-required-for-array-objects.js:50: "Headers with 'array' type require an 'items' property"
    semanticItemsRequiredForArrayObjects3: "Headers with 'array' type require an 'items' property",
    // items-required-for-array-objects.js:59: "Model properties with 'array' type require an 'items' property"
    semanticItemsRequiredForArrayObjects4: "Model properties with 'array' type require an 'items' property",
    // operation-ids.js:40: "operationIds must be unique"
    semanticOperationIds1: 'operationId {{prefix0}} must be unique',
    // operations.js:30: "Operations cannot have both a \"body\" parameter and \"formData\" parameter"
    semanticOperations1: "Operation {{prefix0}} cannot have both a \"body\" parameter and \"formData\" parameter",
    // operations.js:38: "Operations must have no more than one body parameter"
    semanticOperations2: "Operation {{prefix0}} must have no more than one body parameter",
    // operations.js:53: "Operation parameters must have unique 'name' + 'in' properties"
    semanticOperations3: "Operation parameters {{prefix0}} must have unique 'name' + 'in' properties",
    // parameters.js:18: "Parameters with 'array' type require an 'items' property."
    semanticParameters1: "Parameters with 'array' type require an 'items' property.",
    // parameters.js:24: "Non-body parameters require a 'type' property."
    semanticParameters2: "Non-body parameter {{prefix0}} require a 'type' property.",
    // paths.js:48: "Query strings in paths are not allowed."
    semanticPaths1: "Query strings in path {{prefix2 jsonStringify}} are not allowed",
    // paths.js:79: "Equivalent paths are not allowed."
    semanticPaths2: 'Equivalent paths {{pathList jsonStringify}} are not allowed',
    // paths.js:94: "Path parameters must have unique 'name' + 'in' properties"
    semanticPaths3: "Path parameter ${parameterDefinition.name jsonStringify} must be unique",
    // paths.js:107: `Path parameter ${parameterDefinition.name} was defined but never used`
    semanticPaths4: 'Path parameter ${parameterDefinition.name} was defined but never used',
    // paths.js:119: "Empty path parameter declarations are not valid"
    semanticPaths5: "Empty path parameter declarations are not valid - {{prefix2 jsonStringify}}",
    // paths.js:131: `Declared path parameter "${parameter}" needs to be defined as a path parameter at either the path or operation level`
    semanticPaths6: 'Declared path parameter {{name jsonStringify}} needs to be defined as a path parameter {{prefix2 jsonStringify}} at either the path or operation level',
    // paths.js:141: `Path parameter ${parameterDefinition.name} was defined but never used`
    semanticPaths7: 'Path parameter {{prefix0}} was defined but never used',
    // refs.js:37: "Definition was declared but never used in document"
    semanticRefs1: 'Definition was declared but never used in document',
    // schema.js:61: "Read only properties cannot marked as required by a schema."
    semanticSchema1: "Read only property {{prefix0}} cannot be marked as required by a schema.",
    // security-definitions.js:33: `${path} must have required string 'type' param`,
    semanticSecurityDefinitions1: '${path} must have required string "type" param',
    // security-definitions.js:44: "apiKey authorization must have required 'in' param, valid values are 'query' or 'header'.",
    semanticSecurityDefinitions2: 'apiKey authorization must have required "in" param, valid values are "query" or "header".',
    // security-definitions.js:52: "apiKey authorization must have required 'name' string param. The name of the header or query parameter to be used.",
    semanticSecurityDefinitions3: "apiKey authorization must have required 'name' string param. The name of the header or query parameter to be used.",
    // security-definitions.js:66: "oauth2 authorization must have required 'flow' string param. Valid values are 'implicit', 'password', 'application' or 'accessCode'",
    semanticSecurityDefinitions4: "oauth2 authorization must have required 'flow' string param. Valid values are 'implicit', 'password', 'application' or 'accessCode'",
    // security-definitions.js:73: "oauth2 authorization implicit flow must have required 'authorizationUrl' parameter.",
    semanticSecurityDefinitions5: "oauth2 authorization implicit flow must have required 'authorizationUrl' parameter.",
    // security-definitions.js:81: "oauth2 authorization accessCode flow must have required 'authorizationUrl' and 'tokenUrl' string parameters.",
    semanticSecurityDefinitions6: "oauth2 authorization accessCode flow must have required 'authorizationUrl' and 'tokenUrl' string parameters.",
    // security-definitions.js:89: "oauth2 authorization password flow must have required 'tokenUrl' string parameter.",
    semanticSecurityDefinitions7: "oauth2 authorization password flow must have required 'tokenUrl' string parameter.",
    // security-definitions.js:97: "oauth2 authorization application flow must have required 'tokenUrl' string parameter.",
    semanticSecurityDefinitions8: "oauth2 authorization application flow must have required 'tokenUrl' string parameter.",
    // security-definitions.js:106: "'scopes' is required property type object. The available scopes for the OAuth2 security scheme.",
    semanticSecurityDefinitions9: "'scopes' is required property type object. The available scopes for the OAuth2 security scheme.",
    // security.js:23: "security requirements must match a security definition",
    semanticSecurity1: "security requirements must match a security definition",
    // security.js:37: `Security scope definition ${scope} could not be resolved`,
    semanticSecurity2: 'Security scope definition ${scope} could not be resolved',
    // walker.js:27: "\"type\" should be a string"
    semanticWalker1: "type {{prefix0}} should be a string",
    // walker.js:39: "Minimum cannot be more than maximum"
    semanticWalker2: 'Minimum cannot be more than maximum - {{prefix0}}',
    // walker.js:48: "minProperties cannot be more than maxProperties"
    semanticWalker3: 'minProperties cannot be more than maxProperties - {{prefix0}}',
    // walker.js:57: "minLength cannot be more than maxLength"
    semanticWalker4: 'minLength cannot be more than maxLength - {{prefix0}}',
    // walker.js:76: `${path[path.length - 2]} $refs cannot match any of the following: ${humanFriendlyRefBlacklist}`
    // semanticWalker5: '${path[path.length - 2]} $refs cannot match any of the following: ${humanFriendlyRefBlacklist}',
    // walker.js:89: "$ref paths must begin with `#/`"
    semanticWalker6: '$ref {{prefix0}} must begin with "#/"',
    // walker.js:108: "Values alongside a $ref will be ignored."
    semanticWalker7: 'Values alongside a $ref will be ignored.',
    stringMaxLength: '{{type2}} {{prefix0}} must have <= {{schema.maxLength}} characters',
    stringMinLength: '{{type2}} {{prefix0}} must have >= {{schema.minLength}} characters',
    stringPattern: '{{type2}} {{prefix0}} must match regexp pattern {{schema.pattern jsonStringify}}'
};
 
 
 
local.templateApiDict =
{
    "crudCountManyByQuery": {
        "_method": "GET",
        "_path": "/{{_tags0}}/crudCountManyByQuery",
        "parameters": [
            {
                "default": "{\"id\":{\"$exists\":true}}",
                "description": "query param",
                "format": "json",
                "in": "query",
                "name": "_queryWhere",
                "type": "string"
            }
        ],
        "summary": "count many {{_schemaName}} objects by query"
    },
    "crudErrorDelete": {
        "_method": "DELETE",
        "_path": "/{{_tags0}}/crudErrorDelete",
        "responses": {
            "500": {
                "description": "500 error - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return error response"
    },
    "crudErrorGet": {
        "_method": "GET",
        "_path": "/{{_tags0}}/crudErrorGet",
        "responses": {
            "500": {
                "description": "500 error - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return error response"
    },
    "crudErrorHead": {
        "_method": "HEAD",
        "_path": "/{{_tags0}}/crudErrorHead",
        "responses": {
            "500": {
                "description": "500 error - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return error response"
    },
    "crudErrorLogin": {
        "_method": "GET",
        "_path": "/{{_tags0}}/crudErrorLogin",
        "responses": {
            "500": {
                "description": "500 error - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "login by password"
    },
    "crudErrorOptions": {
        "_method": "OPTIONS",
        "_path": "/{{_tags0}}/crudErrorOptions",
        "responses": {
            "500": {
                "description": "500 error - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return error response"
    },
    "crudErrorPatch": {
        "_method": "PATCH",
        "_path": "/{{_tags0}}/crudErrorPatch",
        "responses": {
            "500": {
                "description": "500 error - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return error response"
    },
    "crudErrorPost": {
        "_method": "POST",
        "_path": "/{{_tags0}}/crudErrorPost",
        "responses": {
            "500": {
                "description": "500 error - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return error response"
    },
    "crudErrorPre": {
        "_method": "GET",
        "_path": "/{{_tags0}}/crudErrorPre",
        "responses": {
            "500": {
                "description": "500 error - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return error response"
    },
    "crudErrorPut": {
        "_method": "PUT",
        "_path": "/{{_tags0}}/crudErrorPut",
        "responses": {
            "500": {
                "description": "500 error - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return error response"
    },
    "crudGetManyByQuery": {
        "_method": "GET",
        "_path": "/{{_tags0}}/crudGetManyByQuery",
        "parameters": [
            {
                "default": "{\"id\":{\"$exists\":true}}",
                "description": "query param",
                "format": "json",
                "in": "query",
                "name": "_queryWhere",
                "required": true,
                "type": "string"
            },
            {
                "default": null,
                "description": "projection-fields param",
                "format": "json",
                "in": "query",
                "name": "_queryFields",
                "type": "string",
                "x-swgg-collectionFormat": "json",
                "x-swgg-items": {
                    "type": "string"
                },
                "x-swgg-type": "array"
            },
            {
                "default": 20,
                "description": "cursor-limit param",
                "in": "query",
                "name": "_queryLimit",
                "required": true,
                "type": "integer"
            },
            {
                "default": 0,
                "description": "cursor-skip param",
                "in": "query",
                "name": "_querySkip",
                "type": "integer"
            },
            {
                "default": [
                    {
                        "fieldName": "id"
                    },
                    {
                        "fieldName": "_timeUpdated",
                        "isDescending": true
                    }
                ],
                "description": "cursor-sort param",
                "format": "json",
                "in": "query",
                "name": "_querySort",
                "type": "string",
                "x-swgg-collectionFormat": "json",
                "x-swgg-items": {
                    "type": "object"
                },
                "x-swgg-type": "array"
            }
        ],
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "get many {{_schemaName}} objects by query"
    },
    "crudGetOneById": {
        "_idName": "{{_idName}}",
        "_method": "GET",
        "_path": "/{{_tags0}}/crudGetOneById.{{_idName}}.{{_idBackend}}",
        "parameters": [
            {
                "description": "{{_schemaName}} {{_idName}}",
                "in": "query",
                "name": "{{_idName}}",
                "required": true,
                "type": "string"
            }
        ],
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "get one {{_schemaName}} object by {{_idName}}"
    },
    "crudGetOneByQuery": {
        "_method": "GET",
        "_path": "/{{_tags0}}/crudGetOneByQuery",
        "parameters": [
            {
                "default": "{\"id\":{\"$exists\":true}}",
                "description": "query param",
                "format": "json",
                "in": "query",
                "name": "_queryWhere",
                "required": true,
                "type": "string"
            }
        ],
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "get one {{_schemaName}} object by query"
    },
    "crudNullDelete": {
        "_method": "DELETE",
        "_path": "/{{_tags0}}/crudNullDelete",
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return null response"
    },
    "crudNullGet": {
        "_method": "GET",
        "_path": "/{{_tags0}}/crudNullGet",
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return null response"
    },
    "crudNullHead": {
        "_method": "HEAD",
        "_path": "/{{_tags0}}/crudNullHead",
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return null response"
    },
    "crudNullOptions": {
        "_method": "OPTIONS",
        "_path": "/{{_tags0}}/crudNullOptions",
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return null response"
    },
    "crudNullPatch": {
        "_method": "PATCH",
        "_path": "/{{_tags0}}/crudNullPatch",
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return null response"
    },
    "crudNullPost": {
        "_method": "POST",
        "_path": "/{{_tags0}}/crudNullPost",
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return null response"
    },
    "crudNullPut": {
        "_method": "PUT",
        "_path": "/{{_tags0}}/crudNullPut",
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "return null response"
    },
    "crudRemoveManyByQuery": {
        "_method": "DELETE",
        "_path": "/{{_tags0}}/crudRemoveManyByQuery",
        "parameters": [
            {
                "default": "{\"id\":\"undefined\"}",
                "description": "query param",
                "format": "json",
                "in": "query",
                "name": "_queryWhere",
                "required": true,
                "type": "string"
            }
        ],
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "remove many {{_schemaName}} objects by query"
    },
    "crudRemoveOneById": {
        "_idName": "{{_idName}}",
        "_method": "DELETE",
        "_path": "/{{_tags0}}/crudRemoveOneById.{{_idName}}.{{_idBackend}}",
        "parameters": [
            {
                "description": "{{_schemaName}} {{_idName}}",
                "in": "query",
                "name": "{{_idName}}",
                "required": true,
                "type": "string"
            }
        ],
        "summary": "remove one {{_schemaName}} object by {{_idName}}"
    },
    "crudSetManyById": {
        "_method": "PUT",
        "_path": "/{{_tags0}}/crudSetManyById",
        "parameters": [
            {
                "description": "{{_schemaName}} object",
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                    "items": {
                        "$ref": "#/definitions/{{_schemaName}}"
                    },
                    "type": "array"
                }
            }
        ],
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "create or replace many {{_schemaName}} objects"
    },
    "crudSetOneById": {
        "_idName": "{{_idName}}",
        "_method": "PUT",
        "_path": "/{{_tags0}}/crudSetOneById.{{_idName}}.{{_idBackend}}",
        "parameters": [
            {
                "description": "{{_schemaName}} {{_idName}}",
                "in": "query",
                "name": "{{_idName}}",
                "type": "string"
            },
            {
                "description": "{{_schemaName}} object",
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                    "$ref": "#/definitions/{{_schemaName}}"
                }
            }
        ],
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "create or replace one {{_schemaName}} object by {{_idName}}"
    },
    "crudUpdateOneById": {
        "_idName": "{{_idName}}",
        "_method": "PATCH",
        "_path": "/{{_tags0}}/crudUpdateOneById.{{_idName}}.{{_idBackend}}",
        "parameters": [
            {
                "description": "{{_schemaName}} {{_idName}}",
                "in": "query",
                "name": "{{_idName}}",
                "type": "string"
            },
            {
                "description": "{{_schemaName}} object",
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                    "$ref": "#/definitions/{{_schemaName}}"
                },
                "x-swgg-notRequired": true
            }
        ],
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "create or update one {{_schemaName}} object by {{_idName}}"
    },
    "fileGetOneById": {
        "_idName": "{{_idName}}",
        "_method": "GET",
        "_path": "/{{_tags0}}/fileGetOneById.{{_idName}}.{{_idBackend}}",
        "parameters": [
            {
                "description": "{{_schemaName}} {{_idName}}",
                "in": "query",
                "name": "{{_idName}}",
                "required": true,
                "type": "string"
            }
        ],
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "type": "file"
                }
            }
        },
        "summary": "get one {{_schemaName}} file by {{_idName}}",
        "x-swgg-consumes0": "application/octet-stream"
    },
    "fileUploadManyByForm": {
        "_fileUploadNumber": "{{_fileUploadNumber}}",
        "_method": "POST",
        "_path": "/{{_tags0}}/fileUploadManyByForm.{{_fileUploadNumber}}",
        "consumes": [
            "multipart/form-data"
        ],
        "parameters": [
            {
                "description": "{{_schemaName}} file description",
                "in": "formData",
                "name": "fileDescription",
                "type": "string"
            },
            {
                "description": "{{_schemaName}} file to upload by form",
                "in": "formData",
                "name": "file1",
                "type": "file"
            }
        ],
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "upload many {{_schemaName}} files by form",
        "x-swgg-consumes0": "multipart/form-data"
    },
    "userLoginByPassword": {
        "_method": "GET",
        "_path": "/{{_tags0}}/userLoginByPassword",
        "parameters": [
            {
                "description": "The user name for login",
                "in": "query",
                "name": "username",
                "required": true,
                "type": "string"
            },
            {
                "description": "The password for login in clear text",
                "in": "query",
                "name": "password",
                "required": true,
                "type": "string"
            }
        ],
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "login by password"
    },
    "userLogout": {
        "_method": "GET",
        "_path": "/{{_tags0}}/userLogout",
        "responses": {
            "200": {
                "description": "200 ok - http://jsonapi.org/format/#document-structure-top-level",
                "schema": {
                    "$ref": "#/definitions/BuiltinJsonapiResponse"
                }
            }
        },
        "summary": "logout"
    }
}
;
// JSON.stringify templateApiDict items to prevent side-effects
Object.keys(local.templateApiDict).forEach(function (key) {
    local.templateApiDict[key] = JSON.stringify(local.templateApiDict[key]);
});
 
 
 
// https://swaggerhub.com/wp-content/uploads/2017/10/Swagger-Icon.svg
local.templateSwaggerUiLogoMediumBase64 = '\
iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAMAAAAL34HQAAAC6FBMVEUAAABqn0BqmUBumUBtmj9tmUBt\
mT9tmkBtmj9tmT9tmUBsmkBsmUBtmj9smkBsmUBsmT9tm0BtmkFvmTxsnEFtmT9smT9smUBtmT9tmkBs\
mkBtmkBsmj9tmz+AgABqmj9smT9tmUBtmkBsmkBsmj9tm0BVqlVgn0BtmkBsmj9tmUBxnDltkkltmD5s\
mT9tmj9smkBtmUFsmEBsmUBtmkBtmT9vnUEA/wBsmj5smkBsmkBmmTNtmj5smj9smT9rmz9smT9smj9t\
mj9um0Fvmz1tmj9qmz5wmT1smj9smkBtmj9mmTNsmT9tmkBrmj9tmEFtmT9smkBtmUBsmUBtmD9roUNt\
mT9smkCAv0Bsm0Bqnj5tmz5smUBrmUBtmkBsmj9smkBtmT9smUBtmkBsmUBtmUBsmkFsnTttmkBwl0Bt\
mkBtmT9tmUCRs2+kwIe2zZ92oEyauXttmkBrmkDj7Nv///+/0qt/p1htmj+JrWTa5s/I2bdtmT9pljxt\
mkCkwIj2+fObunxsmEB0okZsmUBtmT9Vqittmj9rmkGtx5TS4MRumj7b5tDt8+j2+fSStHBrmEFsmT/k\
7Ny2zKBtmT5um0Ftmj9umD5smj9tmj9tmkBsmT9tmkBsmj9smT9tmj9smT5tnD5smj9tmT9smUBtmUJs\
mEDI2bhrmD/R38Nsmj+sxpNtmz9/pljt8ue1zJ+IrWSauXyjv4dsmT5tmT9rmj+txpS/06xrmj9sm0Bs\
mT+Rs3C2zaBsmkBtmUBsmUBtmkBrmUBsmkFinTttmUBsmkBtpDdqnEBsmkBsmT9smD9tmUBtmD1smT9t\
mUBtmUBolzpsmT9umj9smz5tmT9qlUBumT9tnj2txpNsmT9rmjxrnEJtmT9smj9rmUFsmUBtmT9smT9r\
mT1rmD5smkBxqjltmT9smUBtmT9tmkBtm0BsmUBsmUBmmURtmUBsmT9smkBsmj9unEBrmz5tmUBtmT9s\
m0Bvm0OD9tkQAAAA+HRSTlMAGDxkgYyWn6myvL+vnYt4ZlQ/Hjt6pcvx/9SwiT0CNXa39Pe9OAMIW7Zs\
EgdS9fmsSzSg6IonAU7EuAVi1sFFVd7KTy7JKRn+/I0KfeNRL9pv+PBNE7mQBEAdXntrk4anraODgGdH\
Gu8gzM6P//////+ITP/////y////5hG7////Vwvn4QZ+K///Vv////9Dzf//RjPFJZLqpJ5grqrtLTFt\
buwjXP85/0n/Wf///////1ppef//cn+Z//+Xm4d3X1MNw3QOJM/pYdwq7nOUFt1dIXUMQRX/xiYfkdk3\
UP36Mj6cCfYo1asc89cP6+Lg5SxKcL5jF9reEmcAAAc2SURBVHgB7NGDYQNAAAXQX9v8sW2ntt0Gtfdf\
oQOUl0Oqt8ID8O9fS2tbe0dnV3dPb1//wODQ8MjoGJprfGJyappvsFhtw3Y0gcPpcnv4Ia9vwh+AQcGQ\
dZpf4glHojAiFu9OUEAylQ5At0w2QWG5fAEaFUtlNmjGD01m5+YpYWEROiwtU9LKKlRbK1OB9Q2otJnd\
ohLbO7tQJbjnoTL7B1Dj8IhKhcegwPEJFTs9g6xKlRrU6pBynqMW6xeQcLlFYfojr6jRNRp0Q61u0YjA\
HTXLQlywSu3u6xDlpgHVXQgppmiE2wERXTTkAQIeacwTvuyZBoXwwrxdfbltxFEcnzLTU88tMzMzMzMz\
k7PaZhWvvG1ll+3KUrNhLjvMTOU2KTP/L0WtZGfvaH6Nxj77ee5Rv7EmI82MInT2JeigSx9SIg8/go7a\
71HRNPoYOuxxyTryCWgVhnX9B5BzCoXuru5CAXpPKqPh0BjW4yYAOXdAz4giuEuM2yiP9oLySq6bIyvW\
54B66mmV7RlQvuvayHLLFVC7q0zPgvLcvFkJH1Tmeui558EUy/ayXA/MCy8qvZtB9bgWs0qgXlJaL18K\
pujazNLcxutuUzqPgarazaqBOkZpvALBPQz+ATkEf6u7zRxQuslrN1COmwgjbCQ/dBMRqF0VdQq4iP8t\
EiJzTBXcq4oZCa6S3kDk0O8OGAVuW0WMhsYofj0hcpkaNMaQrLHm61XsZAXQuFcNchJ0avqxajnrknFq\
QydCJ+hYFsarDU1od5YvmI1P2Msw4O1nRYIsnK1aTRwaWZNUi8v3h5ZrJ8uRZPW2bpZMRtuzQLJMr4NT\
hkrWVNVsWgeyAklW78kq9Rr0nI5m4XWVekP2N6iIPGqirDdV6hhZFmBnmo+Eg2uaKCvsRNZbGY9p/iYf\
IJcKWWQQbydZR8rfk3KIZO9t78hOKwLD1eRkf777+QNRv+6p2MoqI8M9fH2on7Y85BOIZprzkqyjRa9J\
Iaxl+dB7RMVug56T3sMGcqrKBtfhcdZ06M1wrQ0tFGXX2jvOmgnAvAdYx//ndM8q0KVi2YPWDXHWbFrU\
1dVX4hstc2bNmFuaNx8tFvSVSjMWtkaN+LdgVvOEmugrQGNRnLWYz6Kt+jFgfrwJN6u5IL7ZJYcMyxlk\
0Gc8N3aOs5YIssJiU1VsKXk7KLFbtgyxYijIWh5n7WHOCj3yJy47yR0k93qBS/5DLzRnrYizVmqzyAbS\
fDbclrmJRvoDplaBdvGsHcmzh2b1O0gsdVOryZgJ2DhagIRTM2WtibPWmrJ6HL5Dvywrq0F/LaCPZNGT\
9SeMN7HsiW9ijfU75KmhzdqSnbXyIV9mQz6ckzXknZD834s95iH/bpz1njnLLacTRJg1QQTAoNbQSVLn\
uuasneKsO0H4QUh3+ZOucCkGD+TAGfzy0T8fzTc7UQ8aFRCL46z3wTmVgD98/EZQWz0HLRYsC4KGjxZz\
ljaCZT5dRIVVmB4+H0ArSn+yucgtvYX9RWgNF7zYeBZfbCrkUZZxbPAhMjTyLXz4parI8Kh+g5L9XGXk\
VBYtz49WAz5ChrqVnRH5scPIJGutbEejamux35B9dfNxvqsROU5DliRZM+W/vZWsKjKcn2R9ggyRlZlL\
fhryqUqsk81cyCUQZa2nR+eE/ayi8Duzq2RZXgf2Tj9TqcMxVHaacZvgmLrzWZ+rZncPlayVqtkXHcia\
K8k6VrVYNzQOV77cS7X4SnI5v+1ZX6tW31wiuNwoO1l1aB3IvyfrSFYAnW/Vhr5rd5bHswyf7J6+Hhqh\
naxI8Pb9vRrkB/N8E7T5EOMANdiPve3N8s2vWz8p4m5wo+y8cDWM099Yxfx8NCjfynzqlY0vIjMVtcZ4\
zlnuxsYp/JJWhdolD7fJUcJvIZfl+jawof/WgLvC9BIeC9rwJSV+VTovvgDGt5vlgLn0N6W1C6i6zaxR\
oC5TGc4CE1nMqoF6/mCV4aJLwPjWsvodULuoTHuAqlrKCjRVpymD80B5gYWsegXcfr8L/nkBFzXCPFlh\
sMx39PuSRkdCqxhVR40aVYkc2PWHEpiEv9qDZ4BcozAAwO+1zffatpndkq0p7UPTv+U929qz7bHlt5mx\
tscP55z4PIwlhgAH3jJkKj4OOKkcR5bsgSP5R2SnHDhTeCArncBDEzJyCnhpQSY+/QR+viIDr4G3KKTu\
bgrw14WUnQRBwpVIkUcXCPRZhdSoroBg6lGkJEkDInhrkYr/gyCO8ziSl68DsY70IWH6BiDg57FiJOm/\
AcgIvOCBpOibXwIxNUYkw2QGkl40WVA8qwZIm4q+jeLE+74ACmw3plG4mUc2oERXNovCOGUCVaHaD8jX\
h7yjQJ2uSqJE7vzOZ+qAjbcNX+eQC0/JPxswNT8R9BS38vF35+cB2AnZC76TQY64zu1beTeuwk67VnNl\
8V7M0tkzp0+dPHF8+f4KHDoEq3MUjwHy2w4OAAAAAElFTkSuQmCC\
';
 
 
 
// https://github.com/swagger-api/swagger-ui/blob/v2.1.3/dist/images/logo_small.png
local.templateSwaggerUiLogoSmallBase64 = '\
iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFn\
ZVJlYWR5ccllPAAAAqRJREFUeNrEVz1s00AUfnGXii5maMXoEUEHVwIpEkPNgkBdMnQoU5ytiKHJwpp2\
Q2JIO8DCUDOxIJFIVOoWZyJSh3pp1Q2PVVlcCVBH3ufeVZZ9Zye1Ay86nXV+ue/9fO/lheg/Se02X1rv\
ksmbnTiKvuxQMBNgBnN4a/LCbmnUAP6JV58NCUsBC8CuAJxGPF47OgNqBaA93tolUhnx6jC4NxGwyOEw\
lccyAs+3kwdzKq0HDn2vEBTi8J2XpyMaywNDE157BhXUE3zJhlq8GKq+Zd2zaWHepPA8oN9XkfLmRdOi\
JV4XUUg/IyWncLjCYY/SHndV2u7zHr3bPKZtdxgboJOnthvrfGj/oMf3G0r7JVmNlLfKklmrt2MvvcNO\
7LFOhoFHfuAJI5o6ta10jpt5CQLgwXhXG2YIwvu+34qf78ybOjWTnWwkgR36d7JqJOrW0hHmNrKg9xhi\
S4+1jFmrxymh03B0w+6kURIAu3yHtOD5oaUNojMnGgbcctNvwdAnyxvxRR+/vaJnjzbpzcZX+nN1SdGv\
85i9eH8w3qPO+mdm/y4dnQ1iI8Fq6Nf4cxL6GWSjiFDSs0VRnxC5g0xSB2cgHpaseTxfqOv5uoHkNQ6H\
a/N1Yz9mNMppEkEkYKj79q6uCq4bCHcSX3fJ0Vk/k9siASjCm1N6gZH6Ec9IXt2WkFES2K/ixoIyktJP\
Au/ptOA1SgO5zqtr6KASJPF0nMV8dgMsRhRPOcMwqQAOoi0VAIMLAEWJ6YYC1c8ibj1GP51RqwzYwZVM\
HQuvOzMCBUtb2tGHx5NAdLKqp5AX7Ng4d+Zi8AGDI9z1ijx9yaCH04y3GCP2S+QcvaGl+pcxyUBvinFl\
awoDQjHSelX8hQEoIrAq8p/mgC88HOS1YCl/BRgAmiD/1gn6Nu8AAAAASUVORK5CYII=\
';
 
 
 
// https://github.com/swagger-api/swagger-ui/blob/v2.1.3/src/main/template/main.handlebars
local.templateUiMain = '\
<!-- <div class="swggUiContainer"> -->\n\
<h2 class="eventDelegateSubmit hXxx thead" data-onevent="onEventUiReload">\n\
    <a class="td td1" href="https://github.com/kaizhu256/node-swgg" target="_blank">swgg</a>\n\
    <input\n\
        class="td td2"\n\
        placeholder="http://petstore.swagger.io/v2/swagger.json"\n\
        type="text"\n\
        value="{{urlSwaggerJson}}"\n\
    >\n\
    <input\n\
        class="td td3"\n\
        id="swggApiKeyInput1"\n\
        placeholder="api-key"\n\
        type="text"\n\
        value="{{apiKeyValue}}"\n\
    >\n\
    <button class="button eventDelegateClick td td4" data-onevent="onEventUiReload">explore</button>\n\
    <button\n\
        class="button eventDelegateClick td td5" data-onevent="onEventUiReload"\n\
        id="swggApiKeyClearButton1"\n\
    >\n\
        clear api-keys\n\
    </button>\n\
</h2>\n\
<div\n\
    class="colorError"\n\
    id="swggUiReloadErrorDiv1"\n\
    style="background: none; border: 0;"\n\
></div>\n\
<div class="eventDelegateClick info reset">\n\
    {{#if info}}\n\
    {{#if info.x-swgg-homepage}}\n\
    <h2 class="hXxx">\n\
        <a href="{{info.x-swgg-homepage}}" target="_blank">{{info.title}} ({{info.version}})</a>\n\
    </h2>\n\
    {{#unless info.x-swgg-homepage}}\n\
    <h2 class="hXxx">{{info.title}} ({{info.version}})</h2>\n\
    {{/if info.x-swgg-homepage}}\n\
    {{#if info.x-swgg-description}}\n\
    <div class="markdown">{{info.x-swgg-description markdownToHtml}}</div>\n\
    {{/if info.x-swgg-description}}\n\
    {{#if info.description}}\n\
    <div class="description markdown">{{info.description markdownToHtml}}</div>\n\
    {{/if info.description}}\n\
    {{#if x-swgg-downloadStandaloneApp}}\n\
    <a class="button" download href="{{x-swgg-downloadStandaloneApp notHtmlSafe}}">\n\
        download standalone app\n\
    </a><br>\n\
    {{/if x-swgg-downloadStandaloneApp}}\n\
    {{#if x-swgg-onEventDomDb}}\n\
    <button class="button" data-onevent="onEventDomDb" data-onevent-db="dbReset">reset database</button><br>\n\
    <button class="button" data-onevent="onEventDomDb" data-onevent-db="dbExport">export database -&gt; file</button><br>\n\
    <button class="button" data-onevent="onEventDomDb" data-onevent-db="dbImport">import database &lt;- file</button><br>\n\
    {{/if x-swgg-onEventDomDb}}\n\
    <ul>\n\
        {{#if externalDocs.url}}\n\
        <li>\n\
            <a href="{{externalDocs.url}}" target="_blank">\n\
                {{#if externalDocs.description}}\n\
                {{externalDocs.description}}\n\
                {{#unless externalDocs.description}}\n\
                external url\n\
                {{/if externalDocs.description}}\n\
            </a>\n\
        </li>\n\
        {{/if externalDocs.url}}\n\
        {{#if info.termsOfService}}\n\
        <li><a target="_blank" href="{{info.termsOfService}}">terms of service</a></li>\n\
        {{/if info.termsOfService}}\n\
        {{#if info.contact.name}}\n\
        <li>created by {{info.contact.name}}</li>\n\
        {{/if info.contact.name}}\n\
        {{#if info.contact.url}}\n\
        <li>see more at <a href="{{info.contact.url}}">{{info.contact.url}}</a></li>\n\
        {{/if info.contact.url}}\n\
        {{#if info.contact.email}}\n\
        <li>\n\
            <a\n\
                target="_parent"\n\
                href="mailto:{{info.contact.email}}?subject={{info.title}}"\n\
            >\n\
                contact the developer\n\
            </a>\n\
        </li>\n\
        {{/if info.contact.email}}\n\
        {{#if info.license}}\n\
        <li><a target="_blank" href="{{info.license.url}}">{{info.license.name}}</a></li>\n\
        {{/if info.license}}\n\
    </ul>\n\
    {{/if info}}\n\
</div>\n\
{{#if urlSwaggerJson}}\n\
<h4 class="label">nodejs initialization</h4>\n\
<pre id="swggAjaxProgressPre1" tabIndex="0">\n\
/*\n\
 * initialize nodejs swgg-client\n\
 * 1. download currently-loaded apis to file swagger.json:\n\
 *     $ curl -L -o swagger.json "{{urlSwaggerJson}}"\n\
 * 2. npm install swgg\n\
 *     $ npm install swgg\n\
 * 3. run code below to initialize nodejs swgg-client\n\
 * 4. (optional) edit file swagger.json to suit your needs\n\
 */\n\
var swgg;\n\
swgg = require("swgg");\n\
swgg.apiUpdate(require("./swagger.json"));\n\
console.log("printing currently loaded apis ...");\n\
Object.keys(swgg.apiDict).sort().forEach(function (key) {\n\
    console.log("swgg.apiDict[" + JSON.stringify(key) + "].ajax");\n\
});\n\
console.log("initialized nodejs swgg-client");\n\
</pre>\n\
<div class="color777 reset">[ <span>base url</span>: {{basePath}} ]</div>\n\
{{/if urlSwaggerJson}}\n\
<div id="swggAjaxProgressDiv1" style="text-align: center;">\n\
    <span>{{ajaxProgressText}}</span>\n\
    <div class="uiAnimateSpin" style="animation: uiAnimateSpin 2s linear infinite; border: 5px solid #999; border-radius: 50%; border-top: 5px solid #7d7; display: inline-block; height: 25px; vertical-align: middle; width: 25px;"></div>\n\
</div>\n\
<ol class="reset resourceList" style="list-style-type: upper-roman;"></ol>\n\
<div class="utility2FooterDiv">\n\
    [ this document was created with\n\
    <a href="https://github.com/kaizhu256/node-swgg" target="_blank">swgg</a>\n\
    ]\n\
</div>\n\
<!-- </div> -->\n\
';
 
 
 
// https://github.com/swagger-api/swagger-ui/blob/v2.1.3/src/main/template/operation.handlebars
local.templateUiOperation = '\
<div class="operation" data-_method-path="{{_methodPath}}" id="{{id}}">\n\
<div class="thead" data-onevent="onEventOperationDisplayShow" tabindex="0">\n\
    <span class="td td1"></span>\n\
    <span class="method{{_method}} td td2">{{_method}}</span>\n\
    <span\n\
        class="td td3"\n\
        {{#if deprecated}}style="text-decoration: line-through;"{{/if deprecated}}\n\
    >\n\
        {{_path}}\n\
    </span>\n\
    <span class="color777 td td4 textOverflowEllipsis">{{summary}}</span>\n\
</div>\n\
<form accept-charset="UTF-8"\n\
    class="onEventInputValidateAndAjax uiAnimateSlide"\n\
    style="border-bottom: 0; border-top: 0; margin-bottom: 0; margin-top: 0; max-height: 0; padding-bottom: 0; padding-top: 0;"\n\
>\n\
    {{#if deprecated}}\n\
    <h4 class="colorError label">(warning: deprecated)</h4><br>\n\
    {{/if deprecated}}\n\
    <h4 class="label">description</h4>\n\
    <div class="description markdown">\n\
        {{description markdownToHtml}}\n\
    </div>\n\
    {{#if parameters.length}}\n\
    <h4 class="label">parameters</h4>\n\
    <div class="borderBottom1Px color777 schemaP thead">\n\
        <span class="td td1">name and description</span>\n\
        <span class="td td2">data type</span>\n\
        <span class="td td3">value</span>\n\
        <span class="td td4">schema</span>\n\
    </div>\n\
    {{#each parameters}}\n\
    {{innerHTML notHtmlSafe}}\n\
    {{/each parameters}}\n\
    {{/if parameters.length}}\n\
    <h4 class="label">response messages</h4>\n\
    <div class="borderBottom1Px color777 schemaResponse thead">\n\
        <span class="td td1">http status code</span>\n\
        <span class="td td2">reason</span>\n\
    </div>\n\
    {{#each responseList}}\n\
    <div class="schemaResponse tr">\n\
        <span class="td td1">{{key}}</span>\n\
        <span class="markdown td td2">{{value.description markdownToHtml}}</span>\n\
    </div>\n\
    {{/each responseList}}\n\
    <button class="button" data-onevent="onEventOperationAjax">try it out!</button>\n\
    <h4 class="label">nodejs request</h4>\n\
    <pre class="requestJavascript" tabIndex="0"></pre>\n\
    <h4 class="label">curl request</h4>\n\
    <pre class="requestCurl" tabIndex="0"></pre>\n\
    <h4 class="label">response status code</h4>\n\
    <pre class="responseStatusCode" tabindex="0"></pre>\n\
    <h4 class="label">response headers</h4>\n\
    <pre class="responseHeaders" tabIndex="0"></pre>\n\
    <h4 class="label">response body</h4>\n\
    <pre class="responseBody" tabIndex="0"></pre>\n\
    <div class="responseMedia"></div>\n\
</form>\n\
</div>\n\
';
 
 
 
// https://github.com/swagger-api/swagger-ui/blob/v2.1.3/src/main/template/param.handlebars
local.templateUiParameter = '\
<div class="schemaP tr" id="{{id}}" data-name="{{name}}">\n\
<span class="td td1">\n\
    {{name}}\n\
    {{#if required}}<br><span style="font-weight: bold;">(required)</span>{{/if required}}\n\
    {{#if description}}\n\
    <br>\n\
    <span class="color777 markdown">{{description markdownToHtml}}</span>\n\
    {{/if description}}\n\
</span>\n\
<span class="td td2">{{type2}}{{#if format2}}<br>({{format2}}){{/if format2}}</span>\n\
<span class="td td3" data-onevent="onEventInputValidateAndAjax">\n\
    {{#if isTextarea}}\n\
    <div class="multilinePlaceholderContainer">\n\
        <pre class="multilinePlaceholderPre">{{placeholder}}</pre>\n\
        <textarea\n\
            class="input multilinePlaceholderTextarea textarea" data-onevent="onEventInputTextareaChange"\n\
            data-value-text="{{valueText encodeURIComponent notHtmlSafe}}"\n\
        ></textarea>\n\
    </div>\n\
    {{/if isTextarea}}\n\
    {{#if isFile}}<input class="input" type="file">{{/if isFile}}\n\
    {{#if enum2}}\n\
    <select class="input" {{#if isSelectMultiple}}multiple{{/if isSelectMultiple}}>\n\
        {{#each selectOptionList}}\n\
        <option\n\
            data-value-select-option=\n\
                "{{valueSelectOption jsonStringify encodeURIComponent notHtmlSafe}}"\n\
            id="{{id}}"\n\
            {{selected}}\n\
        >{{placeholder}}</option>\n\
        {{/each selectOptionList}}\n\
    </select>\n\
    {{/if enum2}}\n\
    {{#if isInputNumber}}\n\
    <input\n\
        class="input"\n\
        data-value-text="{{valueText encodeURIComponent notHtmlSafe}}"\n\
        placeholder="{{placeholder}}"\n\
        type="number"\n\
    >\n\
    {{/if isInputNumber}}\n\
    {{#if isInputText}}\n\
    <input\n\
        class="input"\n\
        data-value-text="{{valueText encodeURIComponent notHtmlSafe}}"\n\
        placeholder="{{placeholder}}"\n\
        type="text"\n\
    >\n\
    {{/if isInputText}}\n\
    <div class="colorError"></div>\n\
</span>\n\
<span class="td td4">\n\
    {{#if schemaText}}<pre tabIndex="0">{{schemaText}}</pre>{{/if schemaText}}\n\
</span>\n\
</div>\n\
';
 
 
 
local.templateUiRequestJavascript = '\
/*\n\
 * reproduce api-call {{option.api._methodPath jsonStringify}}\n\
 * 1. initialize nodejs swgg-client from previous step\n\
 * 2. run code below to reproduce api-call\n\
 */\n\
swgg.apiDict[{{option.api._methodPath jsonStringify}}].ajax({{optionJson}}, \
function (error, data) {\n\
    if (error) {\n\
        console.error(error);\n\
        return;\n\
    }\n\
    console.log(data.responseJson || data.responseText);\n\
}\
);\n\
';
 
 
 
// https://github.com/swagger-api/swagger-ui/blob/v2.1.3/src/main/template/resource.handlebars
local.templateUiResource = '\
<li\n\
    class="eventDelegateChange eventDelegateClick eventDelegateKeyup eventDelegateSubmit resource"\n\
    data-name="{{name}}"\n\
    id="{{id}}"\n\
>\n\
<h3 class="thead">\n\
    <span class="td td1 textOverflowEllipsis" data-onevent="onEventResourceDisplayAction" tabindex="0">\n\
        {{name}}:&nbsp;&nbsp;{{summary}}\n\
    </span>\n\
    <span class="td td2" data-onevent="onEventResourceDisplayAction" tabindex="0">\n\
    expand / collapse operations\n\
    </span>\n\
</h3>\n\
<ol\n\
    class="operationList uiAnimateSlide"\n\
    style="border-bottom: 0; border-top: 0; margin-bottom: 0; margin-top: 0; max-height: 0; padding-bottom: 0; padding-top: 0;"\n\
>\n\
    <div class="description markdown">{{description markdownToHtml}}</div>\n\
</ol>\n\
</li>\n\
';
 
 
 
local.templateUiTitle = '\
{{#if info.title}}\n\
{{#if info.version}}\n\
{{info.title}} ({{info.version}})\n\
{{#unless info.version}}\n\
{{info.title}}\n\
{{/if info.version}}\n\
{{#unless info.title}}\n\
swgg\n\
{{/if info.title}}\n\
';
 
 
 
/* validateLineSortedReset */
local.assetsDict["/assets.swgg.html"] = local.assetsDict["/assets.utility2.template.html"]
    .replace("assets.utility2.template.html", "")
    .replace((/<title>.*?<\/title>/), "<title>swgg</title>")
    .replace("\n<!-- utility2-comment\n", "\n")
    .replace("\n</style>\n", '\
\n\
</style>\n\
<style>\n\
/* jslint utility2:true */\n\
/*csslint\n\
*/\n\
/* csslint ignore:start */\n\
.swggUiContainer,\n\
.swggUiContainer * {\n\
    border: 0;\n\
    border-radius: 0;\n\
    margin: 0;\n\
    max-width: 100%;\n\
    padding: 0;\n\
}\n\
.swggUiContainer pre,\n\
.swggUiContainer .operation > .thead:focus,\n\
.swggUiContainer .resource > .thead > .td:focus {\n\
    outline: none;\n\
}\n\
.swggUiContainer .description > * {\n\
    margin-top: 20px;\n\
}\n\
.swggUiContainer .description > *:first-child {\n\
    margin-top: 0;\n\
}\n\
/* csslint ignore:end */\n\
/* validateLineSortedReset */\n\
/* general */\n\
.swggUiContainer code,\n\
.swggUiContainer pre,\n\
.swggUiContainer textarea {\n\
    line-height: 1.25rem;\n\
    max-height: 50rem;\n\
    overflow: auto;\n\
}\n\
.swggUiContainer input,\n\
.swggUiContainer pre,\n\
.swggUiContainer textarea {\n\
    min-height: 1.5rem;\n\
}\n\
.swggUiContainer pre {\n\
    white-space: pre;\n\
}\n\
.swggUiContainer .button,\n\
.swggUiContainer .operation > .thead,\n\
.swggUiContainer .resource > .thead {\n\
    cursor: pointer;\n\
}\n\
.swggUiContainer .button,\n\
.swggUiContainer .operation > .thead > .td3,\n\
.swggUiContainer .resource > .thead > .td {\n\
    font-weight: bold;\n\
    text-decoration: underline;\n\
}\n\
.swggUiContainer .markdown pre {\n\
    max-height: none;\n\
}\n\
.swggUiContainer .multilinePlaceholderContainer {\n\
    min-height: 10rem;\n\
    position: relative;\n\
}\n\
.swggUiContainer .multilinePlaceholderPre {\n\
    position: absolute;\n\
    white-space: pre;\n\
}\n\
.swggUiContainer .multilinePlaceholderTextarea {\n\
    position: absolute;\n\
}\n\
.swggUiContainer .operation > .thead > .td1 {\n\
    text-align: left;\n\
    width: 2rem;\n\
}\n\
.swggUiContainer .operation > .thead > .td2 {\n\
    text-align: center;\n\
    width: 5rem;\n\
}\n\
.swggUiContainer .responseBody,\n\
.swggUiContainer .responseHeaders,\n\
.swggUiContainer .responseStatusCode {\n\
    font-weight: bold;\n\
}\n\
.swggUiContainer .schemaP pre,\n\
.swggUiContainer .schemaP select[multiple],\n\
.swggUiContainer .schemaP textarea,\n\
.swggUiContainer .schemaP .multilinePlaceholderContainer {\n\
    height: 10rem;\n\
}\n\
.swggUiContainer .schemaP > .td3 {\n\
    overflow: visible;\n\
}\n\
.swggUiContainer .td {\n\
    overflow: auto;\n\
    overflow-wrap: break-word;\n\
}\n\
.swggUiContainer .td input,\n\
.swggUiContainer .td pre,\n\
.swggUiContainer .td select,\n\
.swggUiContainer .td textarea {\n\
    width: 100%;\n\
}\n\
.swggUiContainer .zeroPixel {\n\
    border: 0;\n\
    height: 0;\n\
    margin: 0;\n\
    padding: 0;\n\
    width: 0;\n\
}\n\
/* validateLineSortedReset */\n\
/* background */\n\
.swggUiContainer code,\n\
.swggUiContainer pre {\n\
    background: #ddd;\n\
}\n\
.swggUiContainer .button {\n\
    background: #ddf;\n\
}\n\
.swggUiContainer .description {\n\
    background: #bdb;\n\
}\n\
.swggUiContainer .methodDELETE {\n\
    background: #b07;\n\
}\n\
.swggUiContainer .methodGET {\n\
    background: #373;\n\
}\n\
.swggUiContainer .methodHEAD {\n\
    background: #7b7;\n\
}\n\
.swggUiContainer .methodOPTIONS {\n\
    background: #777;\n\
}\n\
.swggUiContainer .methodPATCH {\n\
    background: #99f;\n\
}\n\
.swggUiContainer .methodPOST {\n\
    background: #33d;\n\
}\n\
.swggUiContainer .methodPUT {\n\
    background: #77d;\n\
}\n\
.swggUiContainer .multilinePlaceholderPre {\n\
    background: #fff;\n\
}\n\
.swggUiContainer .operation {\n\
    background: #dfd;\n\
}\n\
.swggUiContainer .resource > .thead,\n\
.swggUiContainer > .thead {\n\
    background: #7b7;\n\
}\n\
.swggUiContainer > .info > .button {\n\
    width: 20rem;\n\
}\n\
.swggUiContainer > .thead > .td1 {\n\
    background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAqRJREFUeNrEVz1s00AUfnGXii5maMXoEUEHVwIpEkPNgkBdMnQoU5ytiKHJwpp2Q2JIO8DCUDOxIJFIVOoWZyJSh3pp1Q2PVVlcCVBH3ufeVZZ9Zye1Ay86nXV+ue/9fO/lheg/Se02X1rvksmbnTiKvuxQMBNgBnN4a/LCbmnUAP6JV58NCUsBC8CuAJxGPF47OgNqBaA93tolUhnx6jC4NxGwyOEwlccyAs+3kwdzKq0HDn2vEBTi8J2XpyMaywNDE157BhXUE3zJhlq8GKq+Zd2zaWHepPA8oN9XkfLmRdOiJV4XUUg/IyWncLjCYY/SHndV2u7zHr3bPKZtdxgboJOnthvrfGj/oMf3G0r7JVmNlLfKklmrt2MvvcNO7LFOhoFHfuAJI5o6ta10jpt5CQLgwXhXG2YIwvu+34qf78ybOjWTnWwkgR36d7JqJOrW0hHmNrKg9xhiS4+1jFmrxymh03B0w+6kURIAu3yHtOD5oaUNojMnGgbcctNvwdAnyxvxRR+/vaJnjzbpzcZX+nN1SdGv85i9eH8w3qPO+mdm/y4dnQ1iI8Fq6Nf4cxL6GWSjiFDSs0VRnxC5g0xSB2cgHpaseTxfqOv5uoHkNQ6Ha/N1Yz9mNMppEkEkYKj79q6uCq4bCHcSX3fJ0Vk/k9siASjCm1N6gZH6Ec9IXt2WkFES2K/ixoIyktJPAu/ptOA1SgO5zqtr6KASJPF0nMV8dgMsRhRPOcMwqQAOoi0VAIMLAEWJ6YYC1c8ibj1GP51RqwzYwZVMHQuvOzMCBUtb2tGHx5NAdLKqp5AX7Ng4d+Zi8AGDI9z1ijx9yaCH04y3GCP2S+QcvaGl+pcxyUBvinFlawoDQjHSelX8hQEoIrAq8p/mgC88HOS1YCl/BRgAmiD/1gn6Nu8AAAAASUVORK5CYII=) no-repeat left center;\n\
}\n\
/* validateLineSortedReset */\n\
/* border */\n\
.swggUiContainer input,\n\
.swggUiContainer pre,\n\
.swggUiContainer select,\n\
.swggUiContainer textarea {\n\
    border: 1px solid #999;\n\
}\n\
.swggUiContainer .borderBottom1Px {\n\
    border-bottom: 1px solid #777;\n\
}\n\
.swggUiContainer .button {\n\
    border: 1px solid #35b;\n\
    border-radius: 5px;\n\
}\n\
.swggUiContainer .resource > .thead > .td2 {\n\
    border-left: 1px solid #333;\n\
}\n\
/* validateLineSortedReset */\n\
/* color */\n\
.swggUiContainer a,\n\
.swggUiContainer .button,\n\
.swggUiContainer .operation > .thead,\n\
.swggUiContainer .resource > .thead {\n\
    color: #35b;\n\
}\n\
.swggUiContainer code {\n\
    color: #333;\n\
}\n\
.swggUiContainer .color777 {\n\
    color: #777;\n\
}\n\
.swggUiContainer .label {\n\
    color: #373;\n\
}\n\
.swggUiContainer .multilinePlaceholderPre {\n\
    color: #999;\n\
}\n\
.swggUiContainer .operation > .thead > .td2,\n\
.swggUiContainer .resource > .thead,\n\
.swggUiContainer > .thead > .td1 {\n\
    color: #fff;\n\
}\n\
.swggUiContainer .thead,\n\
.swggUiContainer .tr {\n\
    display: flex;\n\
}\n\
/* validateLineSortedReset */\n\
/* flex */\n\
.swggUiContainer .operation > .thead > .td3 {\n\
    flex: 1;\n\
}\n\
.swggUiContainer .operation > .thead > .td4 {\n\
    flex: 1;\n\
}\n\
.swggUiContainer .resource > .thead > .td1 {\n\
    flex: 1;\n\
}\n\
.swggUiContainer .schemaP > .td1 {\n\
    flex: 2;\n\
}\n\
.swggUiContainer .schemaP > .td2 {\n\
    flex: 1;\n\
}\n\
.swggUiContainer .schemaP > .td3 {\n\
    flex: 4;\n\
}\n\
.swggUiContainer .schemaP > .td4 {\n\
    flex: 3;\n\
}\n\
.swggUiContainer .schemaResponse > .td1 {\n\
    flex: 1;\n\
}\n\
.swggUiContainer .schemaResponse > .td2 {\n\
    flex: 4;\n\
}\n\
.swggUiContainer > .thead > .td2 {\n\
    flex: 4;\n\
}\n\
.swggUiContainer > .thead > .td3 {\n\
    flex: 1;\n\
}\n\
/* validateLineSortedReset */\n\
/* margin */\n\
.swggUiContainer li {\n\
    margin-top: 10px;\n\
}\n\
.swggUiContainer ol,\n\
.swggUiContainer ul,\n\
.swggUiContainer .td {\n\
    margin-left: 20px;\n\
}\n\
.swggUiContainer .description,\n\
.swggUiContainer .label,\n\
.swggUiContainer .operation,\n\
.swggUiContainer .operation > form > div,\n\
.swggUiContainer .operation > form > pre,\n\
.swggUiContainer .resource,\n\
.swggUiContainer > div,\n\
.swggUiContainer > ol,\n\
.swggUiContainer > pre,\n\
.swggUiContainer > .info > div,\n\
.swggUiContainer > .info > ul,\n\
.swggUiContainer > .info > .button,\n\
.swggUiContainer > .info > .hXxx {\n\
    margin-top: 20px;\n\
}\n\
.swggUiContainer .label {\n\
    margin-bottom: -19px;\n\
}\n\
.swggUiContainer .operation > form > .button {\n\
    margin: 40px 0 20px 0;\n\
}\n\
.swggUiContainer .resource > ol,\n\
.swggUiContainer .resource > .thead > .td,\n\
.swggUiContainer .td:first-child,\n\
.swggUiContainer > ol {\n\
    margin-left: 0;\n\
}\n\
.swggUiContainer .resource > ol > .description {\n\
    margin-top: 0;\n\
}\n\
/* validateLineSortedReset */\n\
/* padding */\n\
.swggUiContainer code {\n\
    padding: 2px;\n\
}\n\
.swggUiContainer input {\n\
    padding: 0 5px;\n\
}\n\
.swggUiContainer pre,\n\
.swggUiContainer textarea {\n\
    padding: 5px;\n\
}\n\
.swggUiContainer .button,\n\
.swggUiContainer .resource > .thead > .td,\n\
.swggUiContainer > .thead {\n\
    padding: 10px 20px;\n\
}\n\
.swggUiContainer .description {\n\
    padding: 20px;\n\
}\n\
.swggUiContainer .operation > form {\n\
    padding: 0 20px;\n\
}\n\
.swggUiContainer .operation > form .td1 {\n\
    padding-left: 0;\n\
}\n\
.swggUiContainer .operation > .thead {\n\
    padding: 0 20px;\n\
}\n\
.swggUiContainer .operation > .thead > .td {\n\
    padding: 10px 0;\n\
}\n\
.swggUiContainer > .thead > .td1 {\n\
    padding-left: 40px;\n\
    padding-top: 4px;\n\
}\n\
/* validateLineSortedReset */\n\
/* .textOverflowEllipsis */\n\
.swggUiContainer .textOverflowEllipsis {\n\
    overflow: hidden;\n\
    text-overflow: ellipsis;\n\
    white-space: nowrap;\n\
}\n\
/* validateLineSortedReset */\n\
/* @media */\n\
@media screen and (max-width: 640px) {\n\
    .swggUiContainer .operation {\n\
        font-size: small;\n\
    }\n\
    .swggUiContainer .resource > .thead > .td {\n\
        flex: 1;\n\
    }\n\
    .swggUiContainer > .thead {\n\
        display: block;\n\
        padding: 0;\n\
    }\n\
    .swggUiContainer > .thead > .td {\n\
        display: block;\n\
        margin: 0;\n\
        width: 100%;\n\
    }\n\
}\n\
/* validateLineSortedReset */\n\
/* hover */\n\
.swggUiContainer a:hover,\n\
.swggUiContainer .resource > .thead > .td:hover,\n\
.swggUiContainer > .thead > .td1:hover {\n\
    color: #037;\n\
}\n\
.swggUiContainer .button:hover,\n\
.swggUiContainer .operation > .thead:hover {\n\
    background: #bbf;\n\
}\n\
/* validateLineSortedReset */\n\
/* error */\n\
.swggUiContainer button.hasError,\n\
.swggUiContainer pre.hasError,\n\
.swggUiContainer textarea.hasError {\n\
    background: #fbb;\n\
}\n\
.swggUiContainer input.hasError,\n\
.swggUiContainer select.hasError {\n\
    border: 5px solid #d00;\n\
}\n\
</style>\n\
')
    .replace((/\n<\/script>\n[\S\s]*\n<\/html>\n/), '\
\n\
</script>\n\
<div class="swggUiContainer" style="margin: 0 auto; max-width: 1200px;">\n\
' + local.templateRender(local.templateUiMain, {
    ajaxProgressText: "loading script",
    apiKeyValue: "",
    urlSwaggerJson: ""
}) + '\
</div>\n\
<script>\n\
/* jslint utility2:true */\n\
// init domOnEventMediaHotkeys\n\
(function () {\n\
/*\n\
 * this function will add media-hotkeys to elements\n\
 * with class=".domOnEventMediaHotkeysInit"\n\
 */\n\
    "use strict";\n\
    var currentTarget;\n\
    var identity;\n\
    var input;\n\
    var onEvent;\n\
    if (window.domOnEventMediaHotkeys) {\n\
        return;\n\
    }\n\
    identity = function (value) {\n\
    /*\n\
     * this function will return <value>\n\
     */\n\
        return value;\n\
    };\n\
    window.domOnEventMediaHotkeys = function (event) {\n\
        var media;\n\
        if (event === "init") {\n\
            Array.from(document.querySelectorAll(\n\
                ".domOnEventMediaHotkeysInit"\n\
            )).forEach(function (media) {\n\
                media.classList.remove("domOnEventMediaHotkeysInit");\n\
                media.classList.add("domOnEventMediaHotkeys");\n\
                ["play", "pause", "seeking"].forEach(function (event) {\n\
                    media.addEventListener(event, onEvent);\n\
                });\n\
            });\n\
            return;\n\
        }\n\
        if (event.currentTarget.classList.contains("domOnEventMediaHotkeys")) {\n\
            currentTarget = event.currentTarget;\n\
            input.focus();\n\
            return;\n\
        }\n\
        media = currentTarget;\n\
        try {\n\
            switch (event.key || event.type) {\n\
            case ",":\n\
            case ".":\n\
                media.currentTime += (\n\
                    event.key === "," && identity(-0.03125)\n\
                ) || 0.03125;\n\
                break;\n\
            case "<":\n\
            case ">":\n\
                media.playbackRate *= (\n\
                    event.key === "<" && identity(0.5)\n\
                ) || 2;\n\
                break;\n\
            case "ArrowDown":\n\
            case "ArrowUp":\n\
                media.volume += (\n\
                    event.key === "ArrowDown" && identity(-0.05)\n\
                ) || 0.05;\n\
                break;\n\
            case "ArrowLeft":\n\
            case "ArrowRight":\n\
                media.currentTime += (\n\
                    event.key === "ArrowLeft" && identity(-5)\n\
                ) || 5;\n\
                break;\n\
            case "j":\n\
            case "l":\n\
                media.currentTime += (event.key === "j" && identity(-10)) || 10;\n\
                break;\n\
            case "k":\n\
            case " ":\n\
                if (media.paused) {\n\
                    media.play();\n\
                } else {\n\
                    media.pause();\n\
                }\n\
                break;\n\
            case "m":\n\
                media.muted = !media.muted;\n\
                break;\n\
            default:\n\
                if (event.key >= 0) {\n\
                    media.currentTime = 0.1 * event.key * media.duration;\n\
                    break;\n\
                }\n\
                return;\n\
            }\n\
        } catch (ignore) {}\n\
        event.preventDefault();\n\
    };\n\
    onEvent = window.domOnEventMediaHotkeys;\n\
    input = document.createElement("button");\n\
    input.style = (\n\
        "border:0;height:0;margin:0;padding:0;position:fixed;width:0;"\n\
        + "z-index:-1;"\n\
    );\n\
    input.addEventListener("click", onEvent);\n\
    input.addEventListener("keydown", onEvent);\n\
    document.body.appendChild(input);\n\
    onEvent("init");\n\
}());\n\
\n\
\n\
\n\
document.querySelector(\n\
    ".swggUiContainer > .thead > .td2"\n\
).value = ((\n\
    /\\bmodeSwaggerJsonUrl=([^&]+)|$/gm\n\
).exec(location.search)[1] || "assets.swgg.swagger.json");\n\
</script>\n\
<script src="assets.utility2.rollup.js"></script>\n\
<script>\n\
/* jslint utility2:true */\n\
window.local = window.local || window.swgg;\n\
window.swgg.uiEventListenerDict.onEventUiReload({\n\
    swggInit: true\n\
});\n\
</script>\n\
<!-- swgg-script-extra-begin -->\n\
<!-- swgg-script-extra-end -->\n\
</body>\n\
</html>\n\
');
/* jslint ignore:end */
local.assetsDict["/assets.swgg.swagger.schema.json"] = local.jsonStringifyOrdered(
    local.objectSetOverride(
        JSON.parse(local.assetsDict["/assets.swgg.json-schema.json"].replace((
            /"\$ref":".*?#/g
        ), "\"$ref\":\"http://json-schema.org/draft-04/schema#")),
        JSON.parse(local.assetsDict["/assets.swgg.schema.json"].replace((
            /"\$ref":".*?#/g
        ), "\"$ref\":\"http://json-schema.org/draft-04/schema#")),
        2
    )
);
local.swaggerSchemaJson = JSON.parse(local.assetsDict["/assets.swgg.swagger.schema.json"]);
}());
 
 
 
// run shared js-env code - function
(function () {
local.apiAjax = function (that, option, onError) {
/*
 * this function will send a swagger-api ajax-request with the operation that
 */
    var tmp;
    local.objectSetDefault(option, {
        data: "",
        operation: that,
        paramDict: {},
        url: ""
    });
    if (option.modeDefault) {
        local.normalizeSwaggerParamDict(option);
    }
    // try to validate paramDict
    option.error = local.swaggerValidateDataParameters({
        // normalize paramDict
        data: local.normalizeSwaggerParamDict({
            modeNoDefault: option.modeNoDefault,
            operation: that,
            paramDict: local.jsonCopy(option.paramDict)
        }).paramDict,
        dataReadonlyRemove: option.paramDict,
        prefix: ["operation", that._methodPath],
        parameters: that.parameters,
        swaggerJson: local.swaggerJson
    })[0];
    // init option-defaults
    local.objectSetDefault(option, {
        inForm: (
            // ternary-condition
            that._consumes0 === "multipart/form-data"
            ? new local.FormData()
            : ""
        ),
        inHeader: {},
        inPath: that._path.replace((
            /#.*?$/
        ), ""),
        inQuery: "",
        headers: {},
        method: that._method,
        responseType: (
            // ternary-condition
            that._consumes0.indexOf("application/octet-stream") === 0
            ? "arraybuffer"
            : ""
        )
    });
    // init paramDict
    that.parameters.forEach(function (schemaP) {
        tmp = option.paramDict[schemaP.name];
        if (local.isNullOrUndefined(tmp)) {
            return;
        }
        // serialize array
        if (Array.isArray(tmp) && schemaP.in !== "body") {
            switch (schemaP.collectionFormat || schemaP["x-swgg-collectionFormat"]) {
            case "json":
                tmp = JSON.stringify(tmp);
                break;
            case "multi":
                tmp.forEach(function (value) {
                    option[(
                        // ternary-condition
                        schemaP.in === "formData"
                        ? "inForm"
                        : "inQuery"
                    )] += (
                        "&" + encodeURIComponent(schemaP.name) + "="
                        + encodeURIComponent(
                            local.schemaPItemsType(schemaP) === "string"
                            ? value
                            : JSON.stringify(value)
                        )
                    );
                });
                return;
            case "pipes":
                tmp = tmp.join("|");
                break;
            case "ssv":
                tmp = tmp.join(" ");
                break;
            case "tsv":
                tmp = tmp.join("\t");
                break;
            // default to csv
            default:
                tmp = tmp.join(",");
            }
        } else if (typeof tmp !== "string" && !(tmp && tmp.constructor === local.Blob)) {
            tmp = JSON.stringify(tmp);
        }
        switch (schemaP.in) {
        case "body":
            option.inBody = tmp;
            break;
        case "formData":
            switch (that._consumes0) {
            case "application/xml":
                // init xml header
                if (!option.inForm) {
                    option.inForm += "<?xml version=\"1.0\"?>";
                }
                option.inForm += (
                    "\n<" + schemaP.name + ">" + "<![CDATA["
                    + tmp.replace((
                        /\]\]>/g
                    ), "]]&#x3e;") + "]]></" + schemaP.name + ">"
                );
                break;
            case "multipart/form-data":
                option.inForm.append(schemaP.name, tmp, tmp && tmp.name);
                break;
            default:
                if (option.inForm) {
                    option.inForm += "&";
                }
                option.inForm += (
                    encodeURIComponent(schemaP.name) + "="
                    + encodeURIComponent(tmp)
                );
            }
            break;
        case "header":
            option.inHeader[encodeURIComponent(schemaP.name.toLowerCase())] = tmp;
            break;
        case "path":
            option.inPath = option.inPath
            .replace("{" + schemaP.name + "}", encodeURIComponent(tmp));
            break;
        case "query":
            option.inQuery += (
                "&" + encodeURIComponent(schemaP.name) + "="
                + encodeURIComponent(tmp)
            );
            break;
        }
    });
    // init data
    option.data = option.inBody || option.inForm;
    // init headers
    local.objectSetOverride(option.headers, option.inHeader);
    // init headers - Content-Type
    option.headers["Content-Type"] = that._consumes0;
    // init headers - Authorization
    option.jwtEncrypted = option.jwtEncrypted || local.userJwtEncrypted;
    if (option.jwtEncrypted) {
        option.headers.Authorization = (
            option.headers.Authorization
            || "Bearer " + option.jwtEncrypted
        );
    }
    // init url
    option.url = "";
    option.url += (
        local.identity(that["x-swgg-schemes"] || local.swaggerJson.schemes || [])[0]
        || local.urlParse("").protocol.slice(0, -1)
    );
    option.url += "://";
    option.url += that["x-swgg-host"] || local.swaggerJson.host || local.urlParse("").host;
    option.url += local.swaggerJsonBasePath;
    option.url += option.inPath + "?" + option.inQuery.slice(1);
    option.url = option.url.replace((
        /\?$/
    ), "");
    if (option.modeAjax === "validate" || (option.error && option.modeAjax !== "ajax")) {
        onError(option.error);
        return;
    }
    option.error = null;
    // send ajax-request
    return local.ajax(option, function (error, xhr) {
        // try to init responseJson
        local.tryCatchOnError(function () {
            xhr.responseJson = JSON.parse(xhr.responseText);
        }, local.nop);
        // init userJwtEncrypted
        local.userJwtEncrypted = (
            xhr.responseHeaders["swgg-jwt-encrypted"]
            || local.userJwtEncrypted
        );
        onError(error, xhr);
    });
};
 
local.apiUpdate = function (swaggerJson) {
/*
 * this function will update the swagger-api dict of api-calls
 */
    var pathDict;
    var tmp;
    swaggerJson = swaggerJson || {};
    // normalize swaggerJson
    swaggerJson = local.normalizeSwaggerJson(swaggerJson, {
        objectSetDescription: function (dict) {
            if (typeof dict === "object" && dict && !dict.$ref) {
                if (Array.isArray(dict["x-swgg-descriptionLineList"])) {
                    dict.description = dict["x-swgg-descriptionLineList"].join("\n");
                }
                if (!(dict === swaggerJson.externalDocs || dict === swaggerJson.info)) {
                    dict.description = dict.description || "no description";
                }
            }
        }
    });
    // init apiDict
    local.apiDict = local.apiDict || {};
    // init swaggerJson
    local.swaggerJson = local.swaggerJson || {
        "basePath": "/api/v0",
        "definitions": {
            "BuiltinFile": {
                "properties": {
                    "_id": {
                        "readOnly": true,
                        "type": "string"
                    },
                    "_timeCreated": {
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                    },
                    "_timeUpdated": {
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                    },
                    "fileBlob": {
                        "format": "byte",
                        "type": "string"
                    },
                    "fileContentType": {
                        "type": "string"
                    },
                    "fileDescription": {
                        "type": "string"
                    },
                    "fileFilename": {
                        "type": "string"
                    },
                    "fileInputName": {
                        "type": "string"
                    },
                    "fileSize": {
                        "minimum": 0,
                        "type": "integer"
                    },
                    "fileUrl": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    }
                }
            },
            "BuiltinJsonapiResponse": {
                "properties": {
                    "data": {
                        "items": {
                            "type": "object"
                        },
                        "type": "array"
                    },
                    "errors": {
                        "items": {
                            "type": "object"
                        },
                        "type": "array"
                    },
                    "meta": {
                        "type": "object"
                    }
                }
            },
            "BuiltinUser": {
                "properties": {
                    "_id": {
                        "readOnly": true,
                        "type": "string"
                    },
                    "_timeCreated": {
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                    },
                    "_timeUpdated": {
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "jwtEncrypted": {
                        "type": "string"
                    },
                    "password": {
                        "format": "password",
                        "type": "string"
                    },
                    "username": {
                        "type": "string"
                    }
                }
            }
        },
        "info": {
            "title": "swgg api",
            "version": "0.0.1"
        },
        "paths": {},
        "securityDefinitions": {},
        "swagger": "2.0",
        "tags": []
    };
    // save tags
    tmp = {};
    [local.swaggerJson.tags, swaggerJson.tags].forEach(function (tagList) {
        tagList.forEach(function (tag) {
            tmp[tag.name] = local.objectSetOverride(tmp[tag.name], tag);
        });
    });
    local.swaggerJson["x-swgg-tagNameList"] = Object.keys(tmp).sort();
    tmp = local.swaggerJson["x-swgg-tagNameList"].map(function (key) {
        return tmp[key];
    });
    // merge swaggerJson into local.swaggerJson
    swaggerJson = local.objectSetOverride(local.swaggerJson, swaggerJson, 10);
    // restore tags
    local.swaggerJson.tags = tmp;
    // init swaggerJsonBasePath
    local.swaggerJsonBasePath = (
        local.swaggerJson.basePath === "/"
        ? ""
        : local.swaggerJson.basePath
    );
    Object.keys(swaggerJson.definitions).forEach(function (schemaName) {
        swaggerJson.definitions[schemaName] = local.jsonCopy(
            local.swaggerValidateDataSchema({
                // dereference definition
                modeDereference: true,
                prefix: ["swaggerJson", "definitions", schemaName],
                schema: swaggerJson.definitions[schemaName],
                swaggerJson: local.swaggerJson
            })
        );
        tmp = swaggerJson.definitions[schemaName];
        (tmp.allOf || []).forEach(function (element) {
            local.objectSetDefault(tmp, local.jsonCopy(local.swaggerValidateDataSchema({
                // dereference definition.allOf
                modeDereference: true,
                prefix: ["swaggerJson", "definitions", schemaName, "allOf"],
                schema: element,
                swaggerJson: local.swaggerJson
            })), 2);
        });
        delete tmp.allOf;
    });
    // init apiDict from paths
    Object.keys(swaggerJson.paths).forEach(function (path) {
        Object.keys(swaggerJson.paths[path]).forEach(function (method) {
            var that;
            that = local.jsonCopy(swaggerJson.paths[path][method]);
            that._method = method.toUpperCase();
            that._path = path;
            tmp = "operationId." + that.operationId;
            local.apiDict[tmp] = local.objectSetOverride(local.apiDict[tmp], that);
        });
    });
    // init apiDict from x-swgg-apiDict
    Object.keys(swaggerJson["x-swgg-apiDict"] || {}).forEach(function (key) {
        local.apiDict[key] = local.objectSetOverride(
            local.apiDict[key],
            local.jsonCopy(swaggerJson["x-swgg-apiDict"][key])
        );
    });
    // init apiDict
    Object.keys(local.apiDict).forEach(function (key) {
        var that;
        if (key.indexOf("operationId.") !== 0) {
            return;
        }
        key = key.split(".");
        that = local.apiDict[key.join(".")];
        // init operationId
        that.operationId = that.operationId || key.slice(1).join(".");
        // init _crudType
        that._crudType = that._crudType || key.slice(2);
        that._crudType[0] = that._crudType[0] || that.operationId;
        // init _fileUploadNumber
        that._fileUploadNumber = Number(
            that._crudType[0] === "fileUploadManyByForm" && that._crudType[1]
        ) || 1;
        // init _idBackend and _idName
        tmp = local.idNameInit({
            crudType: that._crudType
        });
        that._idBackend = tmp.idBackend;
        that._idName = tmp.idName;
        // init tags
        that.tags = that.tags || [];
        that.tags[0] = that.tags[0] || key[1];
        // init templateApiDict
        if (local.templateApiDict[that._crudType[0]]) {
            local.objectSetDefault(
                that,
                JSON.parse(local.templateApiDict[that._crudType[0]]
                .replace((
                    /\{\{_fileUploadNumber\}\}/g
                ), that._fileUploadNumber)
                .replace((
                    /\{\{_idBackend\}\}/g
                ), that._idBackend)
                .replace((
                    /\{\{_idName\}\}/g
                ), that._idName)
                .replace((
                    /\{\{_operationId\}\}/g
                ), that.operationId)
                .replace((
                    /\{\{_schemaName\}\}/g
                ), that._schemaName)
                .replace((
                    /\{\{_tags0\}\}/g
                ), that.tags[0]))
            );
        }
        // init default
        local.objectSetDefault(that, {
            _schemaPDict: {},
            consumes: [],
            parameters: [],
            responses: {
                "200": {
                    description: "ok - " + "http://jsonapi.org/format/#document-top-level",
                    schema: {
                        $ref: "#/definitions/BuiltinJsonapiResponse"
                    }
                }
            },
            tags: []
        });
        // init _consumes0
        tmp = that["x-swgg-consumes0"] || (that.consumes && that.consumes[0]);
        that.parameters.some(function (schemaP) {
            tmp = tmp || (
                schemaP.in === "body"
                && schemaP.schema.type === "string"
                && local.identity("text/plain")
            );
            return tmp;
        });
        that._consumes0 = tmp || "application/json";
        // init _methodPath
        that._methodPath = that._method + " " + that._path.replace((
            /\{.*?\}/g
        ), "{}");
        that.parameters.forEach(function (schemaP) {
            // dereference schemaP
            String(schemaP["x-swgg-$ref"] || schemaP.$ref).replace((
                /#\/parameters\/(.+?$)/m
            ), function (ignore, match1) {
                local.objectSetDefault(
                    schemaP,
                    local.jsonCopy(swaggerJson.parameters[match1])
                );
                delete schemaP.$ref;
            });
            // init _idName.format and _idName.type
            if (that._schemaName && schemaP.name === that._idName) {
                schemaP.format = swaggerJson.definitions[that._schemaName]
                .properties[that._idBackend].format;
                schemaP.type = local.schemaPType(swaggerJson.definitions[that._schemaName]
                .properties[that._idBackend]);
            }
            // init _schemaPDict
            that._schemaPDict[schemaP.name] = schemaP;
        });
        // init required
        [
            that["x-swgg-notRequired"],
            that["x-swgg-required"]
        ].forEach(function (element, ii) {
            (element || []).forEach(function (name) {
                that._schemaPDict[name].required = Boolean(ii);
            });
        });
        switch (that._crudType[0]) {
        // add extra file-upload forms
        case "fileUploadManyByForm":
            tmp = 1;
            while (tmp <= that._fileUploadNumber) {
                that.parameters[tmp] = local.jsonCopy(that.parameters[1]);
                that.parameters[tmp].name = "file" + tmp;
                tmp += 1;
            }
            break;
        }
        // update apiDict
        that = local.jsonCopy(that);
        local.apiDict[key.join(".")] = that;
        local.apiDict[that._methodPath] = that;
        // init ajax
        that.ajax = function (swaggerJson, onError) {
            return local.apiAjax(that, swaggerJson, onError);
        };
        that._ajaxToString = (
            that.ajax.toString()
            .replace("{", (
                "{\n"
                + "/*\n"
                + " * this function will run the api-call "
                + JSON.stringify(that._methodPath) + "\n"
                + " * example usage:" + (
                    "\n"
                    + "swgg.apiDict[" + JSON.stringify(key.join(".")) + "].ajax("
                    + JSON.stringify(local.normalizeSwaggerParamDict({
                        modeDefault: true,
                        operation: that,
                        paramDict: {}
                    }).paramDict, null, 4)
                    + ", function (error, data) {\n"
                    + "    if (error) {\n"
                    + "        console.error(error);\n"
                    + "        return;\n"
                    + "    }\n"
                    + "    console.log(data.responseJson || data.responseText);\n"
                    + "});"
                ).replace((
                    /\n/g
                ), "\n    ") + "\n */"
            )
                .replace((
                /\n/g
            ), "\n                "))
        );
        that.ajax.toString = function () {
            return that._ajaxToString;
        };
        // remove underscored keys from that
        tmp = local.jsonCopy(that);
        Object.keys(tmp).forEach(function (key) {
            if (key[0] === "_") {
                tmp[key] = undefined;
            }
        });
        // update paths
        pathDict = {};
        pathDict[that._path] = {};
        pathDict[that._path][that._method.toLowerCase()] = tmp;
        local.objectSetOverride(swaggerJson, {
            paths: pathDict
        }, 3);
    });
    // normalize swaggerJson
    local.swaggerJson = JSON.parse(local.jsonStringifyOrdered(swaggerJson));
    // try to validate swaggerJson
    local.tryCatchOnError(function () {
        local.swaggerValidate(local.swaggerJson);
    }, local.onErrorDefault);
    // init corsForwardProxyHost
    local.corsForwardProxyHost = (
        local.corsForwardProxyHost
        || local.swaggerJson["x-swgg-corsForwardProxyHost"]
    );
    // init assets.swgg.swagger.server.json
    local.assetsDict["/assets.swgg.swagger.server.json"] = JSON.stringify(
        local.swaggerJson
    );
};
 
local.dbFieldRandomCreate = function (option) {
/*
 * this function will create a random dbField from <option>.schemaP
 */
    var depth;
    var ii;
    var max;
    var min;
    var schemaP;
    var value;
    depth = (
        Number.isFinite(option.depth)
        ? option.depth
        : 3
    );
    schemaP = option.schemaP;
    schemaP = schemaP.schema || schemaP;
    if (schemaP.readOnly) {
        return;
    }
    // init default-value
    if (option.modeNotRandom && !local.isNullOrUndefined(schemaP.default)) {
        return local.jsonCopy(schemaP.default);
    }
    // init enum-value
    if (schemaP.enum) {
        value = (
            option.modeNotRandom
            ? schemaP.enum[0]
            : local.listGetElementRandom(schemaP.enum)
        );
        return (
            local.schemaPType(schemaP) === "array"
            ? [value]
            : value
        );
    }
    // init default-value
    value = null;
    switch (local.schemaPType(schemaP)) {
    // 5.3. Validation keywords for arrays
    case "array":
        if (depth <= 0) {
            break;
        }
        value = [];
        ii = 0;
        while (ii < Math.min(
            // 5.3.2. maxItems
            schemaP.maxItems || 2,
            // 5.3.3. minItems
            schemaP.minItems || 2,
            // 5.3.4. uniqueItems
            schemaP.uniqueItems
            ? 2
            : 1
        )) {
            // recurse dbFieldRandomCreate
            value.push(local.dbFieldRandomCreate({
                depth: depth - 1,
                modeNotRandom: option.modeNotRandom,
                schemaP: local.schemaPItems(schemaP)
            }));
            ii += 1;
        }
        break;
    case "boolean":
        value = (
            option.modeNotRandom
            ? false
            : Boolean(Math.random() > 0.5)
        );
        break;
    // 5.1. Validation keywords for numeric instances (number and integer)
    case "integer":
    case "number":
        max = schemaP.maximum;
        min = schemaP.minimum;
        if (option.modeNotRandom) {
            value = (
                !(0 < min || max < 0)
                ? 0
                : min || max
            );
        } else {
            if (!(Number.isFinite(max) && Number.isFinite(min))) {
                if (!Number.isFinite(max) && !Number.isFinite(min)) {
                    max = 1000;
                    min = 0;
                } else if (Number.isFinite(max)) {
                    min = max - 1000;
                } else {
                    max = min + 1000;
                }
            }
            // exclusiveMaximum and exclusiveMinimum for float
            value = min + (max - min) * Math.max(Math.random(), min * 0.000000000000001);
            if (local.schemaPType(schemaP) === "integer") {
                value = Math.round(value);
            }
        }
        max = schemaP.maximum;
        min = schemaP.minimum;
        // exclusiveMaximum for integer
        if (schemaP.exclusiveMaximum && value === max) {
            value -= 1;
        }
        // exclusiveMinimum for integer
        if (schemaP.exclusiveMaximum && value === min) {
            value += 1;
        }
        // multipleOf
        if (schemaP.multipleOf > 0) {
            value = schemaP.multipleOf * Math.floor(value / schemaP.multipleOf);
            if (value < min || (schemaP.exclusiveMinimum && value <= min)) {
                value += schemaP.multipleOf;
            }
        }
        break;
    // 5.2. Validation keywords for strings
    case "string":
        value = (
            option.modeNotRandom
            ? "abcd1234"
            : ((1 + Math.random()) * 0x10000000000000).toString(36).slice(1)
        );
        switch (schemaP.format) {
        case "byte":
            value = local.base64FromBuffer(value);
            break;
        case "date":
        case "date-time":
            value = new Date().toISOString();
            break;
        case "email":
            value = value + "@example.com";
            break;
        case "json":
            value = JSON.stringify({
                foo: value
            });
            break;
        case "phone":
            value = (
                option.modeNotRandom
                ? "+123 (1234) 1234-1234"
                : "+" + Math.random().toString().slice(-3)
                + " (" + Math.random().toString().slice(-4) + ") "
                + Math.random().toString().slice(-4) + "-"
                + Math.random().toString().slice(-4)
            );
            break;
        }
        while (value.length < schemaP.minLength) {
            value += value;
        }
        value = value.slice(0, schemaP.maxLength || Infinity);
        break;
    // 5.4. Validation keywords for objects
    default:
        if (depth <= 0) {
            break;
        }
        // recurse dbRowRandomCreate
        value = local.dbRowRandomCreate({
            depth: depth - 1,
            modeNotRandom: option.modeNotRandom,
            prefix: ["schema<" + JSON.stringify(schemaP) + ">"],
            schema: schemaP
        });
    }
    return value;
};
 
local.dbRowListRandomCreate = function (option) {
/*
 * this function will create a dbRowList of option.length random dbRow's
 */
    var ii;
    ii = 0;
    while (ii < option.length) {
        option.dbRowList.push(local.dbRowRandomCreate(option));
        ii += 1;
    }
    return option.dbRowList;
};
 
local.dbRowRandomCreate = function (option) {
/*
 * this function will create a random dbRow from option.properties
 */
    var dbRow;
    var ii;
    var properties;
    dbRow = {};
    option = local.objectSetDefault(option, {
        override: local.nop,
        prefix: ["dbRow"]
    });
    properties = local.swaggerValidateDataSchema({
        // dereference property
        modeDereference: true,
        prefix: option.prefix,
        schema: option.schema,
        swaggerJson: local.swaggerJson
    });
    properties = local.jsonCopy((properties && properties.properties) || {});
    ii = Object.keys(properties).length;
    while (ii < (option.schema && option.schema.minProperties)) {
        properties["property" + ii] = {
            type: "string"
        };
        ii += 1;
    }
    Object.keys(properties).forEach(function (key) {
        dbRow[key] = local.dbFieldRandomCreate({
            depth: option.depth,
            modeNotRandom: option.modeNotRandom,
            schemaP: local.swaggerValidateDataSchema({
                // dereference property
                modeDereference: true,
                prefix: option.prefix.concat([key]),
                schema: properties[key],
                swaggerJson: local.swaggerJson
            })
        });
    });
    dbRow = local.jsonCopy(local.objectSetOverride(dbRow, option.override(option)));
    // try to validate data
    local.tryCatchOnError(function () {
        local.swaggerValidateDataSchema({
            data: dbRow,
            prefix: option.prefix,
            schema: option.schema,
            swaggerJson: local.swaggerJson
        });
    }, local.onErrorDefault);
    return dbRow;
};
 
local.idDomElementCreate = function (seed) {
/*
 * this function will create a deterministic and unique dom-element id from the seed,
 * that is both dom-selector and url friendly
 */
    local.idDomElementDict[seed] = (local.idDomElementDict[seed] || 0) + 1;
    return encodeURIComponent(
        seed + "_" + local.idDomElementDict[seed]
    ).replace((
        /\W/g
    ), "_");
};
 
local.idNameInit = function (option) {
/*
 * this function will init option.idBackend, option.idName, and option.queryById
 */
    var idBackend;
    var idName;
    // init idName
    idName = option.crudType[1] || "id";
    option.idName = idName;
    // init idBackend
    idBackend = option.crudType[2] || option.idName;
    option.idBackend = idBackend;
    // invert queryById
    if (option.modeQueryByIdInvert) {
        idBackend = option.idName;
        idName = option.idBackend;
    }
    // init queryById
    option.idValue = (option.data && option.data[idBackend]) || option.idValue;
    option.queryById = {};
    option.queryById[idName] = option.idValue;
    return option;
};
 
local.middlewareBodyParse = function (request, response, nextMiddleware) {
/*
 * this function will run the middleware that will parse request.bodyRaw
 */
    var boundary;
    var crlf;
    var data;
    var headerParse;
    var ii;
    var jj;
    var name;
    // if request is already parsed, then goto nextMiddleware
    if (!request.swgg.operation || !local.isNullOrUndefined(request.swgg.bodyParsed)) {
        nextMiddleware();
        return;
    }
    headerParse = function () {
        local.bufferToUtf8(request.bodyRaw.slice(ii, ii + 1024)).replace((
            /^content-disposition:\u0020?form-data;(.+?)\r\n(?:content-type:\u0020?(.*?)$)?/im
        ), function (ignore, match1, match2) {
            data = {
                contentType: match2,
                name: ""
            };
            match1.replace((
                /(\w+)="([^"]+)/g
            ), function (ignore, match1, match2) {
                data[match1.toLowerCase()] = match2;
            });
            name = data.name;
            request.swgg.bodyMeta[name] = data;
        });
    };
    switch (request.swgg.operation._consumes0) {
    // parse application/x-www-form-urlencoded, e.g.
    // aa=hello%20world&bb=bye%20world
    case "application/x-www-form-urlencoded":
        request.swgg.bodyParsed = local.bufferToUtf8(request.bodyRaw);
        request.swgg.bodyParsed = local.urlParse("?" + request.swgg.bodyParsed, true).query;
        break;
    case "application/xml":
        request.swgg.bodyParsed = {};
        local.bufferToUtf8(request.bodyRaw).replace((
            /<(.+?)><!\[CDATA\[([\S\s]+?)\]\]>/g
        ), function (name, match1, value) {
            name = match1;
            name = decodeURIComponent(name);
            request.swgg.bodyParsed[name] = (
                local.schemaPType(request.swgg.operation._schemaPDict[name]) === "string"
                ? value
                : JSON.parse(value)
            );
        });
        break;
    /*
     * parse multipart/form-data, e.g.
     * --Boundary\r\n
     * Content-Disposition: form-data; name="key"\r\n
     * \r\n
     * value\r\n
     * --Boundary\r\n
     * Content-Disposition: form-data; name="input1"; filename="file1.png"\r\n
     * Content-Type: image/jpeg\r\n
     * \r\n
     * <data1>\r\n
     * --Boundary\r\n
     * Content-Disposition: form-data; name="input2"; filename="file2.png"\r\n
     * Content-Type: image/jpeg\r\n
     * \r\n
     * <data2>\r\n
     * --Boundary--\r\n
     * https://tools.ietf.org/html/rfc7578
     */
    case "multipart/form-data":
        request.swgg.bodyParsed = {};
        request.swgg.bodyMeta = {};
        crlf = new Uint8Array([0x0d, 0x0a]);
        // init boundary
        ii = 0;
        jj = local.bufferIndexOfSubBuffer(request.bodyRaw, crlf, ii);
        if (jj <= 0) {
            break;
        }
        boundary = local.bufferConcat([crlf, request.bodyRaw.slice(ii, jj)]);
        ii = jj + 2;
        while (true) {
            jj = local.bufferIndexOfSubBuffer(
                request.bodyRaw,
                boundary,
                ii
            );
            if (jj < 0) {
                break;
            }
            headerParse();
            ii = local.bufferIndexOfSubBuffer(
                request.bodyRaw,
                [0x0d, 0x0a, 0x0d, 0x0a],
                ii + 2
            ) + 4;
            data = request.bodyRaw.slice(ii, jj);
            request.swgg.bodyParsed[name] = data;
            ii = jj + boundary.length + 2;
        }
        break;
    default:
        request.swgg.bodyParsed = local.bufferToUtf8(request.bodyRaw);
        // try to JSON.parse the string
        local.tryCatchOnError(function () {
            request.swgg.bodyParsed = JSON.parse(request.swgg.bodyParsed);
        }, local.nop);
    }
    nextMiddleware(null, request, response);
};
 
local.middlewareCrudBuiltin = function (request, response, nextMiddleware) {
/*
 * this function will run the middleware that will
 * run the builtin crud-operations backed by db-lite
 */
    var crud;
    var onParallel;
    var option;
    var tmp;
    var user;
    option = {};
    local.onNext(option, function (error, data, meta) {
        switch (option.modeNext) {
        case 1:
            crud = request.swgg.crud;
            user = request.swgg.user;
            switch (crud.crudType[0]) {
            case "crudCountManyByQuery":
                crud.dbTable.crudCountManyByQuery(crud.queryWhere, option.onNext);
                break;
            case "crudSetManyById":
                crud.dbTable.crudSetManyById(crud.body, option.onNext);
                break;
            case "crudSetOneById":
                // replace idName with idBackend in body
                delete crud.body.id;
                delete crud.body[crud.idName];
                crud.body[crud.idBackend] = crud.data[crud.idName];
                crud.dbTable.crudSetOneById(crud.body, option.onNext);
                break;
            case "crudUpdateOneById":
                // replace idName with idBackend in body
                delete crud.body.id;
                delete crud.body[crud.idName];
                crud.body[crud.idBackend] = crud.data[crud.idName];
                crud.dbTable.crudUpdateOneById(crud.body, option.onNext);
                break;
            // coverage-hack - test error handling-behavior
            case "crudErrorDelete":
            case "crudErrorGet":
            case "crudErrorHead":
            case "crudErrorOptions":
            case "crudErrorPatch":
            case "crudErrorPost":
            case "crudErrorPut":
                option.onNext(local.errorDefault);
                break;
            case "crudGetManyByQuery":
                onParallel = local.onParallel(option.onNext);
                onParallel.counter += 1;
                crud.dbTable.crudGetManyByQuery({
                    fieldList: crud.queryFields,
                    limit: crud.queryLimit,
                    query: crud.queryWhere,
                    skip: crud.querySkip,
                    sort: crud.querySort
                }, function (error, data) {
                    crud.queryData = data;
                    onParallel(error);
                });
                onParallel.counter += 1;
                crud.dbTable.crudCountAll(function (error, data) {
                    crud.paginationCountTotal = data;
                    onParallel(error);
                });
                break;
            case "crudGetOneById":
                crud.dbTable.crudGetOneById(crud.queryById, option.onNext);
                break;
            case "crudGetOneByQuery":
                crud.dbTable.crudGetOneByQuery({
                    query: crud.queryWhere
                }, option.onNext);
                break;
            case "crudNullDelete":
            case "crudNullGet":
            case "crudNullHead":
            case "crudNullOptions":
            case "crudNullPatch":
            case "crudNullPost":
            case "crudNullPut":
                option.onNext();
                break;
            case "crudRemoveManyByQuery":
                crud.dbTable.crudRemoveManyByQuery(crud.queryWhere, option.onNext);
                break;
            case "crudRemoveOneById":
                crud.dbTable.crudRemoveOneById(crud.queryById, option.onNext);
                break;
            case "fileGetOneById":
                local.dbTableFile = local.db.dbTableCreateOne({
                    name: "File"
                });
                crud.dbTable.crudGetOneById(crud.queryById, option.onNext);
                break;
            case "fileUploadManyByForm":
                local.dbTableFile = local.db.dbTableCreateOne({
                    name: "File"
                });
                request.swgg.paramDict = {};
                Object.keys(request.swgg.bodyMeta).forEach(function (key) {
                    if (typeof request.swgg.bodyMeta[key].filename !== "string") {
                        request.swgg.paramDict[key] = local.bufferToUtf8(
                            request.swgg.bodyParsed[key]
                        );
                    }
                });
                crud.body = Object.keys(request.swgg.bodyMeta)
                .filter(function (key) {
                    return typeof request.swgg.bodyMeta[key].filename === "string";
                })
                .map(function (key) {
                    tmp = local.jsonCopy(request.swgg.paramDict);
                    tmp.id = tmp.id || ((1 + Math.random()) * 0x10000000000000)
                    .toString(36).slice(1);
                    local.objectSetOverride(tmp, {
                        fileBlob: local.base64FromBuffer(request.swgg.bodyParsed[key]),
                        fileContentType: request.swgg.bodyMeta[key].contentType,
                        fileFilename: request.swgg.bodyMeta[key].filename,
                        fileInputName: request.swgg.bodyMeta[key].name,
                        fileSize: request.swgg.bodyParsed[key].length,
                        fileUrl: (
                            local.swaggerJsonBasePath
                            + "/" + request.swgg.operation.tags[0]
                            + "/fileGetOneById/" + tmp.id
                        )
                    });
                    return tmp;
                });
                local.dbTableFile.crudSetManyById(crud.body, option.onNext);
                break;
            case "userLoginByPassword":
            case "userLogout":
                // respond with 401 Unauthorized
                if (!user.isAuthenticated) {
                    local.serverRespondHeadSet(request, response, 401, {});
                    request.swgg.crud.endArgList = [request, response];
                    option.modeNext = Infinity;
                    option.onNext();
                    return;
                }
                option.onNext();
                break;
            default:
                option.modeNext = Infinity;
                option.onNext();
            }
            break;
        case 2:
            switch (crud.crudType[0]) {
            case "crudSetOneById":
            case "crudUpdateOneById":
                option.onNext(null, data);
                break;
            case "crudGetManyByQuery":
                option.onNext(null, crud.queryData, {
                    paginationCountTotal: crud.paginationCountTotal
                });
                break;
            case "fileUploadManyByForm":
                option.onNext(null, data.map(function (element) {
                    delete element.fileBlob;
                    return element;
                }));
                break;
            case "userLoginByPassword":
                option.onNext(null, {
                    jwtEncrypted: user.jwtEncrypted
                });
                break;
            case "userLogout":
                crud.dbTable.crudUpdateOneById({
                    jwtEncrypted: null,
                    username: user.username
                }, option.onNext);
                break;
            default:
                option.onNext(null, data, meta);
            }
            break;
        case 3:
            switch (crud.crudType[0]) {
            case "fileGetOneById":
                if (!data) {
                    local.serverRespondDefault(request, response, 404);
                    return;
                }
                local.serverRespondHeadSet(request, response, null, {
                    "Content-Type": data.fileContentType
                });
                response.end(local.base64ToBuffer(data.fileBlob));
                break;
            case "userLogout":
                option.onNext();
                break;
            default:
                option.onNext(null, data, meta);
            }
            break;
        case 4:
            request.swgg.crud.endArgList = [request, response, null, data, meta];
            option.onNext();
            break;
        default:
            nextMiddleware(error);
        }
    });
    option.modeNext = 0;
    option.onNext();
};
 
local.middlewareCrudEnd = function (request, response, nextMiddleware) {
/*
 * this function will run the middleware that will end the builtin crud-operations
 */
    if (request.swgg.crud.endArgList) {
        local.serverRespondJsonapi.apply(null, request.swgg.crud.endArgList);
        return;
    }
    nextMiddleware(null, request, response);
};
 
local.middlewareRouter = function (request, response, nextMiddleware) {
/*
 * this function will run the middleware that will
 * map the request's method-path to swagger's tags[0]-crudType
 */
    var tmp;
    // init swgg object
    local.objectSetDefault(request, {
        swgg: {
            crud: {
                crudType: []
            },
            user: {}
        }
    }, 3);
    // if request.url is not prefixed with swaggerJsonBasePath,
    // then default to nextMiddleware
    if (request.urlParsed.pathname.indexOf(local.swaggerJsonBasePath) !== 0) {
        nextMiddleware();
        return;
    }
    // init methodPath
    request.swgg.methodPath = (
        request.method + " "
        + request.urlParsed.pathname.replace(local.swaggerJsonBasePath, "")
    );
    // init operation
    while (request.swgg.methodPath !== tmp) {
        request.swgg.operation = (
            local.apiDict[request.swgg.methodPath]
            // handle /foo/{id}/bar case
            || local.apiDict[request.swgg.methodPath.replace((
                /\/[^\/]+\/([^\/]*?)$/
            ), "/{}/$1")]
        );
        // if operation exists, then break
        if (request.swgg.operation) {
            request.swgg.operation = local.jsonCopy(request.swgg.operation);
            // init crud.crudType
            request.swgg.crud.crudType = request.swgg.operation._crudType;
            break;
        }
        tmp = request.swgg.methodPath;
        // handle /foo/{id} case
        request.swgg.methodPath = request.swgg.methodPath.replace((
            /\/[^\/]+?(\/*?)$/
        ), "/$1{}");
    }
    nextMiddleware(null, request, response);
};
 
local.middlewareUserLogin = function (request, response, nextMiddleware) {
/*
 * this function will run the middleware that will handle user login
 */
    var crud;
    var option;
    var user;
    option = {};
    local.onNext(option, function (error, data) {
        switch (option.modeNext) {
        case 1:
            local.dbTableUser = local.db.dbTableCreateOne({
                name: "User"
            });
            crud = request.swgg.crud;
            user = {};
            request.swgg.user = user;
            user.jwtEncrypted = (
                request.headers.authorization
                && request.headers.authorization.replace("Bearer ", "")
            );
            user.jwtDecrypted = local.jwtAes256GcmDecrypt(user.jwtEncrypted);
            switch (crud.crudType[0]) {
            // coverage-hack - test error handling-behavior
            case "crudErrorLogin":
                option.onNext(local.errorDefault);
                return;
            case "userLoginByPassword":
                user.password = request.urlParsed.query.password;
                user.username = request.urlParsed.query.username;
                if (user.password && user.username) {
                    local.dbTableUser.crudGetOneById({
                        username: user.username
                    }, option.onNext);
                    return;
                }
                break;
            default:
                if (user.jwtDecrypted.sub) {
                    // init username
                    user.username = user.jwtDecrypted.sub;
                    local.dbTableUser.crudGetOneById({
                        username: user.username
                    }, option.onNext);
                    return;
                }
            }
            option.modeNext = Infinity;
            option.onNext();
            break;
        case 2:
            switch (crud.crudType[0]) {
            case "userLoginByPassword":
                user.data = data;
                if (!local.sjclHashScryptValidate(
                    user.password,
                    user.data && user.data.password
                )) {
                    option.modeNext = Infinity;
                    option.onNext();
                    return;
                }
                // init isAuthenticated
                user.isAuthenticated = true;
                // create JSON Web Token (JWT)
                // https://tools.ietf.org/html/rfc7519
                user.jwtDecrypted = {};
                user.jwtDecrypted.sub = user.data.username;
                // update jwtEncrypted in client
                user.jwtEncrypted = local.jwtAes256GcmEncrypt(user.jwtDecrypted);
                local.serverRespondHeadSet(request, response, null, {
                    "swgg-jwt-encrypted": user.jwtEncrypted
                });
                // update jwtEncrypted in dbTableUser
                local.dbTableUser.crudUpdateOneById({
                    jwtEncrypted: user.jwtEncrypted,
                    username: user.jwtDecrypted.sub
                }, option.onNext);
                return;
            default:
                data = data || {};
                user.data = data;
                if (data.jwtEncrypted) {
                    // init isAuthenticated
                    user.isAuthenticated = true;
                    // update jwtEncrypted in client
                    if (data.jwtEncrypted !== user.jwtEncrypted) {
                        user.jwtEncrypted = data.jwtEncrypted;
                        user.jwtDecrypted = local.jwtAes256GcmDecrypt(user.jwtEncrypted);
                        local.serverRespondHeadSet(request, response, null, {
                            "swgg-jwt-encrypted": user.jwtEncrypted
                        });
                    }
                }
            }
            option.onNext();
            break;
        default:
            nextMiddleware(error);
        }
    });
    option.modeNext = 0;
    option.onNext();
};
 
local.middlewareValidate = function (request, response, nextMiddleware) {
/*
 * this function will run the middleware that will validate the swagger-request
 */
    var crud;
    var option;
    var tmp;
    option = {};
    local.onNext(option, function (error) {
        switch (option.modeNext) {
        case 1:
            if (!request.swgg.operation) {
                option.modeNext = Infinity;
                option.onNext();
                return;
            }
            // init paramDict
            request.swgg.paramDict = {};
            // parse path param
            tmp = request.urlParsed.pathname
            .replace(local.swaggerJsonBasePath, "")
            .split("/");
            request.swgg.operation._path.split("/").forEach(function (key, ii) {
                if ((
                    /^\{\S*?\}$/
                ).test(key)) {
                    request.swgg.paramDict[key.slice(1, -1)] = decodeURIComponent(tmp[ii]);
                }
            });
            request.swgg.operation.parameters.forEach(function (schemaP) {
                switch (schemaP.in) {
                // parse body param
                case "body":
                    request.swgg.paramDict[schemaP.name] = (
                        request.swgg.bodyParsed
                        || undefined
                    );
                    break;
                // parse formData param
                case "formData":
                    switch (request.swgg.operation._consumes0) {
                    case "application/x-www-form-urlencoded":
                    case "application/xml":
                        request.swgg.paramDict[schemaP.name] = (
                            request.swgg.bodyParsed[schemaP.name]
                        );
                        break;
                    }
                    break;
                // parse header param
                case "header":
                    request.swgg.paramDict[schemaP.name] = (
                        request.headers[schemaP.name.toLowerCase()]
                    );
                    break;
                // parse query param
                case "query":
                    request.swgg.paramDict[schemaP.name] = (
                        request.urlParsed.query[schemaP.name]
                    );
                    break;
                }
                // parse array-multi
                tmp = request.swgg.paramDict[schemaP.name];
                if (
                    tmp
                    && local.schemaPType(schemaP) === "array"
                    && schemaP.collectionFormat === "multi"
                ) {
                    request.swgg.paramDict[schemaP.name] = (
                        encodeURIComponent(schemaP.name)
                        + "=" + (
                            Array.isArray(tmp)
                            ? tmp
                            : [tmp]
                        ).join("&" + encodeURIComponent(schemaP.name) + "=")
                    );
                }
                // init default param
                if (
                    local.isNullOrUndefined(request.swgg.paramDict[schemaP.name])
                    && schemaP.default !== undefined
                ) {
                    request.swgg.paramDict[schemaP.name] = local.jsonCopy(
                        schemaP.default
                    );
                }
            });
            // normalize paramDict
            local.normalizeSwaggerParamDict(request.swgg);
            // validate paramDict
            error = local.swaggerValidateDataParameters({
                data: request.swgg.paramDict,
                prefix: ["operation", request.swgg.methodPath],
                parameters: request.swgg.operation.parameters,
                swaggerJson: local.swaggerJson
            })[0];
            option.onNext(error);
            break;
        case 2:
            // init crud
            crud = request.swgg.crud;
            // init crud.dbTable
            crud.dbTable = (
                request.swgg.operation
                && request.swgg.operation._schemaName
                && local.db.dbTableCreateOne({
                    name: request.swgg.operation._schemaName
                })
            );
            if (!crud.dbTable) {
                nextMiddleware();
                return;
            }
            // init crud.body
            if (request.swgg.operation._consumes0 !== "multipart/form-data") {
                crud.body = local.jsonCopy(request.swgg.bodyParsed);
            }
            // init crud.data
            crud.data = local.jsonCopy(request.swgg.paramDict);
            request.swgg.operation.parameters.forEach(function (schemaP) {
                // JSON.parse json-string
                if (
                    schemaP.format === "json"
                    && local.schemaPType(schemaP) === "string"
                    && crud.data[schemaP.name]
                ) {
                    crud.data[schemaP.name] = JSON.parse(crud.data[schemaP.name]);
                }
            });
            // init crud.query*
            [{
                key: "queryFields",
                value: {}
            }, {
                key: "queryLimit",
                value: 100
            }, {
                key: "querySkip",
                value: 0
            }, {
                key: "querySort",
                value: [{
                    fieldName: "id"
                }, {
                    fieldName: "_timeUpdated",
                    isDescending: true
                }]
            }, {
                key: "queryWhere",
                value: {}
            }].forEach(function (element) {
                crud[element.key] = crud.data["_" + element.key] || JSON.parse(
                    local.templateRender(
                        request.swgg.operation["_" + element.key] || "null",
                        request.swgg.paramDict,
                        {
                            notHtmlSafe: true
                        }
                    )
                ) || element.value;
            });
            // init-before crud.idName
            crud.modeQueryByIdInvert = true;
            local.idNameInit(crud);
            // init crud.data.id
            switch (crud.crudType[0]) {
            case "crudSetOneById":
            case "crudUpdateOneById":
                if (!local.isNullOrUndefined(crud.data[crud.idName])) {
                    break;
                }
                crud.data[crud.idName] = (crud.body && crud.body[crud.idBackend]);
                break;
            }
            // init-after crud.idName
            crud.modeQueryByIdInvert = true;
            local.idNameInit(crud);
            nextMiddleware();
            break;
        default:
            nextMiddleware(error, request, response);
        }
    });
    option.modeNext = 0;
    option.onNext();
};
 
local.normalizeSwaggerJson = function (swaggerJson, option) {
/*
 * this function will normalize swaggerJson and filter $npm_package_swggTags0
 */
    var pathDict;
    var tmp;
    option = local.objectSetDefault(option, {
        objectSetDescription: function (dict) {
            if (
                dict
                && dict.description
                && Array.isArray(dict["x-swgg-descriptionLineList"])
            ) {
                delete dict.description;
            }
        }
    });
    local.objectSetDefault(swaggerJson, {
        paths: {},
        tags: []
    });
    // fix error - semanticPaths2
    pathDict = {};
    Object.keys(swaggerJson.paths).forEach(function (path) {
        tmp = path.replace((
            /\{.*?\}/g
        ), "{}");
        pathDict[tmp] = pathDict[tmp] || {};
        pathDict[tmp][path] = true;
    });
    Object.keys(pathDict).forEach(function (key) {
        Object.keys(pathDict[key]).sort().forEach(function (path, ii) {
            // fix error.semanticUniquePath
            if (ii && swaggerJson["x-swgg-fixErrorSemanticUniquePath"]) {
                swaggerJson.paths[path + "#" + ii] = swaggerJson.paths[path];
                delete swaggerJson.paths[path];
            }
        });
    });
    Object.keys(swaggerJson.paths).forEach(function (path) {
        Object.keys(swaggerJson.paths[path]).forEach(function (method) {
            tmp = swaggerJson.paths[path][method];
            // auto-create operationId from path
            if (
                swaggerJson["x-swgg-operationIdFromPath"]
                || tmp["x-swgg-operationIdFromPath"]
                || !tmp.operationId
            ) {
                tmp.operationId = local.operationIdFromAjax({
                    method: method,
                    url: path
                });
            }
            // normalize parameter.required
            (tmp.parameters || []).forEach(function (schemaP) {
                if (schemaP.required === false) {
                    delete schemaP.required;
                }
            });
        });
    });
    // override tag.description with x-swgg-tags0-override
    if (swaggerJson["x-swgg-tags0-override"]) {
        swaggerJson.tags.forEach(function (tag) {
            tmp = local.objectSetDefault(swaggerJson["x-swgg-tags0-override"][tag.name], {
                description: tag.description,
                "x-swgg-descriptionLineList": tag["x-swgg-descriptionLineList"]
            });
            tag.description = tmp.description;
            tag["x-swgg-descriptionLineList"] = tmp["x-swgg-descriptionLineList"];
            // objectSetDescription
            option.objectSetDescription(tmp);
            option.objectSetDescription(tag);
        });
    }
    // apply option.objectSetDescription
    [swaggerJson.externalDocs, swaggerJson.info].forEach(option.objectSetDescription);
    [
        swaggerJson.definitions,
        swaggerJson.parameters,
        swaggerJson.responses
    ].forEach(function (dict) {
        Object.keys(dict || {}).forEach(function (key) {
            tmp = dict[key];
            if (dict === swaggerJson.definitions) {
                tmp = tmp.properties || {};
                Object.keys(tmp).forEach(function (key) {
                    option.objectSetDescription(tmp[key]);
                });
                return;
            }
            option.objectSetDescription(tmp);
        });
    });
    Object.keys(swaggerJson.paths).forEach(function (path) {
        Object.keys(swaggerJson.paths[path]).forEach(function (method) {
            tmp = swaggerJson.paths[path][method];
            option.objectSetDescription(tmp);
            (tmp.parameters || []).forEach(option.objectSetDescription);
            Object.keys(tmp.responses || {}).forEach(function (key) {
                option.objectSetDescription(tmp.responses[key]);
            });
        });
    });
    if (
        !local.env.npm_package_swggTags0 || (
            /-all$/
        ).test(local.env.npm_package_swggTags0)
    ) {
        return swaggerJson;
    }
    // override swaggerJson with x-swgg-tags0-override
    local.objectSetOverride(
        swaggerJson,
        (
            swaggerJson["x-swgg-tags0-override"]
            && swaggerJson["x-swgg-tags0-override"][local.env.npm_package_swggTags0]
        ),
        10
    );
    // filter $npm_package_swggTags0 - definitions and parameters
    ["definitions", "parameters", "responses"].forEach(function (schema) {
        schema = swaggerJson[schema] || {};
        Object.keys(schema).forEach(function (key) {
            tmp = schema[key]["x-swgg-tags0"];
            if (tmp && tmp !== "all" && tmp !== local.env.npm_package_swggTags0) {
                delete schema[key];
            }
        });
    });
    // filter $npm_package_swggTags0 - paths
    Object.keys(swaggerJson.paths).forEach(function (path) {
        Object.keys(swaggerJson.paths[path]).forEach(function (method) {
            tmp = swaggerJson.paths[path][method]["x-swgg-tags0"];
            if (tmp && tmp !== "all" && tmp !== local.env.npm_package_swggTags0) {
                delete swaggerJson.paths[path][method];
                return;
            }
        });
        if (!Object.keys(swaggerJson.paths[path]).length) {
            delete swaggerJson.paths[path];
        }
    });
    // filter $npm_package_swggTags0 - tags
    swaggerJson.tags = swaggerJson.tags.filter(function (tag) {
        return (
            !tag["x-swgg-tags0"]
            || tmp["x-swgg-tags0"] === "all"
            || tag["x-swgg-tags0"] === local.env.npm_package_swggTags0
        );
    });
    return swaggerJson;
};
 
local.normalizeSwaggerParamDict = function (option) {
/*
 * this function will parse the option according to option.operation.parameters
 */
    var tmp;
    option.operation.parameters.forEach(function (schemaP) {
        tmp = option.paramDict[schemaP.name];
        // init default value
        if (
            !option.modeNoDefault
            && (option.modeDefault || schemaP.required)
            && local.isNullOrUndefined(tmp)
        ) {
            tmp = local.jsonCopy(schemaP.default);
        }
        if (option.modeDefault && local.isNullOrUndefined(tmp)) {
            tmp = local.dbFieldRandomCreate({
                modeNotRandom: true,
                schemaP: schemaP
            });
        }
        // parse array
        if (local.schemaPType(schemaP) === "array" && schemaP.in !== "body") {
            if (typeof tmp === "string") {
                switch (schemaP.collectionFormat || schemaP["x-swgg-collectionFormat"]) {
                case "json":
                    local.tryCatchOnError(function () {
                        tmp = JSON.parse(tmp);
                    }, local.nop);
                    option.paramDict[schemaP.name] = tmp;
                    return;
                case "multi":
                    tmp = local.urlParse("?" + tmp, true).query[schemaP.name];
                    Iif (!Array.isArray(tmp)) {
                        tmp = [tmp];
                    }
                    break;
                case "pipes":
                    tmp = tmp.split("|");
                    break;
                case "ssv":
                    tmp = tmp.split(" ");
                    break;
                case "tsv":
                    tmp = tmp.split("\t");
                    break;
                // default to csv
                default:
                    tmp = tmp.split(",");
                }
                if (local.schemaPItemsType(schemaP) !== "string") {
                    // try to JSON.parse the string
                    local.tryCatchOnError(function () {
                        tmp = tmp.map(function (element) {
                            return JSON.parse(element);
                        });
                    }, local.nop);
                }
            }
        // JSON.parse paramDict
        } else if (
            local.schemaPType(schemaP) !== "file"
            && local.schemaPType(schemaP) !== "string"
            && (
                typeof tmp === "string"
                || Object.prototype.toString.call(tmp) === "[object Uint8Array]"
            )
        ) {
            // try to JSON.parse the string
            local.tryCatchOnError(function () {
                tmp = JSON.parse(local.bufferToUtf8(tmp));
            }, local.nop);
        }
        option.paramDict[schemaP.name] = tmp;
    });
    return option;
};
 
local.onErrorJsonapi = function (onError) {
/*
 * this function will normalize the error and data to jsonapi format,
 * and pass them to onError
 * http://jsonapi.org/format/#errors
 * http://jsonapi.org/format/#document-structure-resource-objects
 */
    return function (error, data, meta) {
        data = [error, data].map(function (data, ii) {
            // if no error occurred, then return
            if (
                (ii === 0 && !data)
                // if data is already normalized, then return it
                || (data && data.meta && data.meta.isJsonapiResponse)
            ) {
                return data;
            }
            // normalize data-list
            if (!Array.isArray(data)) {
                data = [data];
            }
            // normalize error-list to contain non-null objects
            if (!ii) {
                data = data.errorList || data;
                // normalize error-list to be non-empty
                if (!data.length) {
                    data.push(null);
                }
                data = data.map(function (element) {
                    if (!(typeof element === "object" && element)) {
                        element = {
                            message: String(element)
                        };
                    }
                    // normalize error-object to plain json-object
                    return {
                        message: element.message,
                        name: element.name,
                        stack: element.stack,
                        statusCode: Number(element.statusCode) || 500
                    };
                });
                error = local.jsonCopy(data[0]);
                error.errors = data;
                return error;
            }
            return {
                data: data
            };
        });
        // init data.meta
        data.forEach(function (data, ii) {
            if (!data) {
                return;
            }
            data.meta = local.jsonCopy(meta || {});
            data.meta.isJsonapiResponse = true;
            if (ii) {
                data.meta.dataLength = data.data.length;
            } else {
                data.meta.errorsLength = data.errors.length;
            }
            data.meta.statusCode = (
                Number(data.meta.statusCode)
                || Number(data.statusCode)
                || 0
            );
        });
        onError(data[0], data[1]);
    };
};
 
local.operationIdFromAjax = function (option) {
/*
 * this function will create a sortable operationId
 * from given ajax-option
 */
    var urlParsed;
    urlParsed = local.urlParseWithBraket(option.url);
    return encodeURIComponent(
        urlParsed.pathname + urlParsed.hash + " " + option.method.toUpperCase()
    ).replace((
        /[^\w\-.]/g
    ), "_");
};
 
local.schemaPItems = function (schemaP) {
/*
 * this function will return schemaP.items
 */
    return schemaP["x-swgg-items"] || schemaP.items;
};
 
local.schemaPItemsType = function (schemaP) {
/*
 * this function will return schemaP.items.type
 */
    return local.schemaPType(local.schemaPItems(schemaP) || {});
};
 
local.schemaPType = function (schemaP) {
/*
 * this function will return schemaP.type
 */
    return schemaP && (schemaP["x-swgg-type"] || schemaP.type);
};
 
local.serverRespondJsonapi = function (request, response, error, data, meta) {
/*
 * this function will respond in jsonapi format
 * http://jsonapi.org/format/#errors
 * http://jsonapi.org/format/#document-structure-resource-objects
 */
    local.onErrorJsonapi(function (error, data) {
        local.serverRespondHeadSet(request, response, error && error.statusCode, {
            "Content-Type": "application/json"
        });
        if (error) {
            // debug statusCode / method / url
            local.errorMessagePrepend(
                error,
                response.statusCode + " " + request.method + " " + request.url + "\n"
            );
            // print error.stack to stderr
            local.onErrorDefault(error);
        }
        data = error || data;
        response.statusCode = data.meta.statusCode || response.statusCode;
        data.meta.statusCode = response.statusCode;
        response.end(JSON.stringify(data));
    })(error, data, meta);
};
 
local.swaggerJsonFromAjax = function (swaggerJson, option) {
/*
 * this function will update swaggerJson
 * with definitions and paths created from given ajax-option
 */
    var data;
    var isArray;
    var operation;
    var pathDict;
    var type;
    var upsertSchemaP;
    var urlParsed;
    upsertSchemaP = function (schemaP) {
        if (!operation.parameters.some(function (element) {
            if (element.in === schemaP.in && element.name === schemaP.name) {
                ["default", "items", "schema"].forEach(function (key) {
                    if (!local.isNullOrUndefined(schemaP[key])) {
                        element[key] = schemaP[key];
                    }
                });
                return true;
            }
        })) {
            operation.parameters.push(schemaP);
        }
    };
    // init swaggerJson
    swaggerJson = local.objectSetDefault(swaggerJson, {
        basePath: "/",
        definitions: {},
        info: {
            title: "",
            version: ""
        },
        paths: {},
        swagger: "2.0"
    });
    // init option
    option = local.objectSetDefault(option, {
        headers: {},
        method: "GET"
    });
    // init urlParsed
    urlParsed = local.urlParseWithBraket(option.url);
    // init operation
    operation = {
        operationId: option.operationId || local.operationIdFromAjax(option),
        parameters: [],
        responses: {
            default: {
                description: "default response"
            }
        },
        tags: option.tags || ["undefined"],
        "x-swgg-tags0": option["x-swgg-tags0"]
    };
    if ((
        /^(?:http|https):\/\//
    ).test(option.url)) {
        operation["x-swgg-host"] = urlParsed.host;
        operation["x-swgg-schemes"] = [urlParsed.protocol.slice(0, -1)];
    }
    pathDict = {};
    pathDict[urlParsed.pathname + urlParsed.hash] = {};
    pathDict[urlParsed.pathname + urlParsed.hash][
        option.method.toLowerCase()
    ] = operation;
    local.objectSetDefault(swaggerJson, {
        paths: pathDict
    }, 3);
    // init param in header
    Object.keys(option.headers).forEach(function (key) {
        upsertSchemaP({
            default: option.headers[key],
            in: "header",
            name: key,
            type: "string"
        });
    });
    // init param in path
    urlParsed.pathname.replace((
        /\{[^}]+?\}/g
    ), function (match0) {
        match0 = match0.slice(1, -1);
        upsertSchemaP({
            default: match0,
            in: "path",
            name: match0,
            required: true,
            type: "string"
        });
    });
    // init param in query
    Object.keys(urlParsed.query).forEach(function (key) {
        upsertSchemaP({
            default: urlParsed.query[key],
            in: "query",
            name: key,
            type: "string"
        });
    });
    data = option.data;
    if (!data) {
        return swaggerJson;
    }
    // init param in body - text-data
    upsertSchemaP({
        in: "body",
        name: "body",
        schema: {
            type: "string"
        }
    });
    local.tryCatchOnError(function () {
        data = JSON.parse(data);
    }, local.nop);
    if (typeof data !== "object") {
        return swaggerJson;
    }
    // init param in body - json-data
    isArray = Array.isArray(data);
    type = local.swaggerJsonFromPostBody(swaggerJson, {
        data: (
            // ternary-condition
            isArray
            ? data[0]
            : data
        ),
        depth: 2,
        key: "body",
        prefix: operation.operationId,
        "x-swgg-tags0": option["x-swgg-tags0"]
    });
    upsertSchemaP({
        in: "body",
        name: "body",
        schema: (
            // ternary-condition
            isArray
            ? {
                items: type,
                type: "array"
            }
            : type
        )
    });
    return swaggerJson;
};
 
local.swaggerJsonFromCurl = function (swaggerJson, text) {
/*
 * this function will update swaggerJson
 * with definitions and paths created from given curl-command-text
 */
    var arg;
    var argList;
    var doubleBackslash;
    var option;
    var quote;
    arg = "";
    argList = [];
    doubleBackslash = local.stringUniqueKey(text);
    // parse doubleBackslash
    text = text.replace((
        /\\\\/g
    ), doubleBackslash);
    // parse line-continuation
    text = text.replace((
        /\\\n/g
    ), "");
    // parse quotes
    text.replace((
        /(\s*?)(\S+)/g
    ), function (match0, line, word) {
        line = match0;
        word.replace((
            /^(["']?).*?(?:\\")?(["']?)$/
        ), function (quote1, match1, quote2) {
            quote1 = match1;
            if (quote) {
                arg += line;
            } else {
                arg = word;
                quote = quote1;
            }
            if (!quote || quote === quote2) {
                switch (quote) {
                // parse escapes in single-quotes
                case "'":
                    arg = arg.replace((
                        /'"'"'/g
                    ), "'");
                    arg = arg.slice(1, -1);
                    break;
                // parse escapes in double-quotes
                // https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
                case "\"":
                    arg = arg.replace((
                        /\\([$`"\n])/g
                    ), "$1");
                    arg = arg.slice(1, -1);
                    break;
                }
                argList.push(arg);
                arg = "";
                quote = "";
            }
        });
    });
    // un-parse doubleBackslash
    argList = argList.map(function (arg) {
        return arg.replace(new RegExp(doubleBackslash, "g"), "\\\\");
    });
    argList.push("curl");
    argList.forEach(function (arg, ii) {
        switch (argList[ii - 1]) {
        case "--data":
        case "--data-ascii":
        case "--data-binary":
        case "--data-raw":
        case "-d":
            option.data = arg;
            return;
        case "--header":
        case "-H":
            arg = arg.split(":");
            arg[1] = arg.slice(1).join(":").trim();
            option.headers[arg[0].toLowerCase()] = arg[1];
            return;
        case "--request":
        case "-X":
            option.method = arg;
            return;
        }
        if (arg === "curl") {
            if (option) {
                option.url = option.url || argList[ii - 1];
                swaggerJson = local.swaggerJsonFromAjax(swaggerJson, option);
            }
            option = {
                headers: {},
                method: "GET"
            };
        }
        if ((
            /^(?:http|https):\/\//
        ).test(arg)) {
            option.url = arg;
        }
    });
    return swaggerJson;
};
 
local.swaggerJsonFromPostBody = function (swaggerJson, option) {
/*
 * this function will update swaggerJson
 * with definitions created from the post-body-data
 */
    var definition;
    var isArray;
    var prefix;
    var schemaP;
    var type;
    var value;
    prefix = option.prefix + "." + encodeURIComponent(option.key);
    definition = {
        properties: {},
        "x-swgg-tags0": option["x-swgg-tags0"]
    };
    swaggerJson.definitions[prefix] = definition;
    Object.keys(option.data).forEach(function (key) {
        value = option.data[key];
        isArray = Array.isArray(value);
        if (isArray) {
            value = value[0];
        }
        type = (
            local.isNullOrUndefined(value)
            ? "string"
            : typeof value
        );
        schemaP = (
            isArray
            ? {
                default: option.data[key],
                items: {
                    type: type
                },
                type: "array"
            }
            : {
                default: value,
                type: type
            }
        );
        definition.properties[key] = schemaP;
        if (!(type === "object" && option.depth > 1)) {
            return;
        }
        // recurse
        type = local.swaggerJsonFromPostBody(swaggerJson, {
            data: value,
            depth: option.depth - 1,
            key: key,
            prefix: prefix,
            "x-swgg-tags0": option["x-swgg-tags0"]
        });
        if (isArray) {
            schemaP.items = type;
        } else {
            definition.properties[key] = type;
        }
    });
    return {
        $ref: "#/definitions/" + prefix
    };
};
 
local.swaggerValidate = function (swaggerJson) {
/*
 * this function will validate the json-object swaggerJson
 */
    var operation;
    var operationIdDict;
    var pathDict;
    var prefix;
    var test;
    var tmp;
    operationIdDict = {};
    swaggerJson = swaggerJson || {};
    local.swaggerValidateDataSchema({
        data: swaggerJson,
        modeSchema: true,
        prefix: ["swaggerJson"],
        schema: local.swaggerSchemaJson,
        swaggerJson: swaggerJson
    });
    pathDict = {};
    Object.keys(swaggerJson.paths).forEach(function (path) {
        prefix = ["swaggerJson", "paths", path];
        // validate semanticPaths1
        test = path.indexOf("?") < 0;
        local.throwSwaggerError(!test && {
            errorType: "semanticPaths1",
            prefix: prefix
        });
        tmp = path.replace((
            /\{.*?\}/g
        ), "{}");
        // validate semanticPaths2
        test = !pathDict[tmp];
        local.throwSwaggerError(!test && {
            errorType: "semanticPaths2",
            pathList: [pathDict[tmp], path],
            prefix: prefix
        });
        pathDict[tmp] = path;
        // validate semanticPaths3
        tmp = {};
        path.replace((
            /\{.*?\}/g
        ), function (match0) {
            test = !tmp[match0];
            local.throwSwaggerError(!test && {
                errorType: "semanticPaths3",
                name: match0,
                prefix: prefix
            });
            tmp[match0] = true;
        });
        // validate semanticPaths5
        test = path.indexOf("{}") < 0;
        local.throwSwaggerError(!test && {
            errorType: "semanticPaths5",
            prefix: prefix
        });
    });
    // validate swaggerJson.definitions[key].properties[ii].default
    Object.keys(swaggerJson.definitions || {}).forEach(function (schemaName) {
        tmp = local.swaggerValidateDataSchema({
            // dereference definition
            modeDereference: true,
            prefix: ["swaggerJson", "definitions", schemaName],
            schema: swaggerJson.definitions[schemaName],
            swaggerJson: swaggerJson
        });
        Object.keys(tmp.properties || {}).forEach(function (key) {
            local.swaggerValidateDataSchema({
                modeDefault: true,
                prefix: ["swaggerJson", "definitions", schemaName, "properties", key],
                schema: tmp.properties[key],
                swaggerJson: swaggerJson
            });
        });
    });
    // validate swaggerJson.parameters[key].default
    Object.keys(swaggerJson.parameters || []).forEach(function (key) {
        local.swaggerValidateDataSchema({
            modeDefault: true,
            prefix: ["swaggerJson", "parameters", key],
            schema: swaggerJson.parameters[key],
            swaggerJson: swaggerJson
        });
    });
    // validate swaggerJson.paths[key][key].parameters[ii].default
    Object.keys(swaggerJson.paths).forEach(function (path) {
        Object.keys(swaggerJson.paths[path]).forEach(function (method) {
            prefix = ["swaggerJson", "paths", path, method];
            operation = local.swaggerValidateDataSchema({
                // dereference operation
                modeDereference: true,
                prefix: prefix,
                schema: swaggerJson.paths[path][method],
                swaggerJson: swaggerJson
            });
            // validate semanticOperationIds1
            test = !operationIdDict[operation.operationId];
            local.throwSwaggerError(!test && {
                data: operation.operationId,
                errorType: "semanticOperationIds1",
                prefix: prefix.concat(["operationId"])
            });
            operationIdDict[operation.operationId] = true;
            tmp = {
                in: {},
                name: {},
                path: {},
                type: {}
            };
            path.replace((
                /\{.*?\}/g
            ), function (match0) {
                match0 = match0.slice(1, -1);
                tmp.path[match0] = tmp.path[match0] || [];
                tmp.path[match0][0] = true;
            });
            (operation.parameters || []).forEach(function (schemaP, ii) {
                // dereference schemaP
                String(schemaP["x-swgg-$ref"] || schemaP.$ref).replace((
                    /#\/parameters\/(.+?$)/m
                ), function (ignore, match1) {
                    schemaP = local.objectSetDefault(
                        local.jsonCopy(schemaP),
                        local.jsonCopy(swaggerJson.parameters[match1])
                    );
                    delete schemaP.$ref;
                });
                // validate semanticOperations2
                test = !(tmp.in.body && schemaP.in === "body");
                local.throwSwaggerError(!test && {
                    data: operation,
                    errorType: "semanticOperations2",
                    prefix: prefix,
                    schema: operation
                });
                // validate semanticOperations3
                test = (
                    schemaP.name === undefined
                    || schemaP.in === undefined
                    || !tmp.name[schemaP.name + " " + schemaP.in]
                );
                local.throwSwaggerError(!test && {
                    data: operation.parameters,
                    errorType: "semanticOperations3",
                    prefix: prefix.concat(["parameters"])
                });
                tmp.in[schemaP.in] = true;
                tmp.name[schemaP.name + " " + schemaP.in] = true;
                tmp.type[schemaP.type] = true;
                // validate semanticOperations1
                test = !(tmp.in.body && tmp.in.formData);
                local.throwSwaggerError(!test && {
                    data: operation,
                    errorType: "semanticOperations1",
                    prefix: prefix
                });
                // validate schemaP
                local.swaggerValidateDataSchema({
                    modeDefault: true,
                    prefix: prefix.concat(["parameters", schemaP.name]),
                    schema: schemaP,
                    swaggerJson: swaggerJson
                });
                if (schemaP.in === "path") {
                    tmp.path[schemaP.name] = tmp.path[schemaP.name] || [];
                    tmp.path[schemaP.name][1] = true;
                    // validate semanticPaths7
                    test = tmp.path[schemaP.name][0];
                    local.throwSwaggerError(!test && {
                        data: schemaP,
                        errorType: "semanticPaths7",
                        prefix: prefix.concat(["parameters", ii])
                    });
                }
            });
            Object.keys(tmp.path).forEach(function (name) {
                // validate semanticPaths6
                test = tmp.path[name][1];
                local.throwSwaggerError(!test && {
                    errorType: "semanticPaths6",
                    name: name,
                    prefix: prefix.concat(["parameters", "ii"])
                });
            });
            // validate semanticFormData4
            test = (
                !tmp.type.file
                || (operation.consumes || []).indexOf("multipart/form-data") >= 0
            );
            local.throwSwaggerError(!test && {
                data: operation,
                errorType: "semanticFormData4",
                prefix: prefix
            });
            // validate semanticFormData5
            test = (
                !tmp.in.formData
                || (operation.consumes || []).indexOf(
                    "application/x-www-form-urlencoded"
                ) >= 0
                || (operation.consumes || []).indexOf("multipart/form-data") >= 0
            );
            local.throwSwaggerError(!test && {
                data: operation,
                errorType: "semanticFormData5",
                prefix: prefix,
                schema: operation
            });
        });
    });
};
 
local.swaggerValidateDataParameters = function (option) {
/*
 * this function will validate the items in option.paramDict
 * against the schemaP's in option.parameters
 */
    var errorList;
    errorList = [];
    option.parameters.forEach(function (schemaP) {
        local.tryCatchOnError(function () {
            local.swaggerValidateDataSchema({
                data: option.data[schemaP.name],
                dataReadonlyRemove: [
                    option.dataReadonlyRemove || {},
                    schemaP.name,
                    option.dataReadonlyRemove && option.dataReadonlyRemove[schemaP.name]
                ],
                prefix: option.prefix.concat([schemaP.name]),
                schema: schemaP,
                swaggerJson: local.swaggerJson
            });
        }, function (errorCaught) {
            console.error(errorCaught.message);
            errorList.push(errorCaught);
            errorCaught.errorList = errorList;
        });
    });
    return errorList;
};
 
local.swaggerValidateDataSchema = function (option) {
/*
 * this function will validate option.data against the swagger option.schema
 * http://json-schema.org/draft-04/json-schema-validation.html#rfc.section.5
 */
    var $ref;
    var circularSet;
    var data;
    var dataReadonlyRemove2;
    var ii;
    var list;
    var oneOf;
    var schema;
    var test;
    var tmp;
    if (!option.schema) {
        return;
    }
    data = option.data;
    option.dataReadonlyRemove = option.dataReadonlyRemove || [{}, "", null];
    dataReadonlyRemove2 = option.dataReadonlyRemove[2] || {};
    schema = option.schema;
    circularSet = new Set();
    while (true) {
        // dereference schema.schema
        while (schema.schema) {
            schema = schema.schema;
        }
        // dereference schema.oneOf
        oneOf = (data && schema.oneOf) || [];
        ii = 0;
        while (ii < oneOf.length) {
            tmp = String(oneOf[ii] && oneOf[ii].$ref)
            .replace("http://json-schema.org/draft-04/schema#", "#");
            switch (tmp + " " + (!local.isNullOrUndefined(data.$ref) || data.in)) {
            case "#/definitions/bodyParameter body":
            case "#/definitions/formDataParameterSubSchema formData":
            case "#/definitions/headerParameterSubSchema header":
            case "#/definitions/jsonReference true":
            case "#/definitions/pathParameterSubSchema path":
            case "#/definitions/queryParameterSubSchema query":
                schema = local.swaggerSchemaJson.definitions[tmp.split("/")[2]];
                break;
            default:
                switch (tmp) {
                case "#/definitions/bodyParameter":
                case "#/definitions/jsonReference":
                    schema = oneOf[ii ^ 1];
                    break;
                }
            }
            if (!schema.oneOf) {
                break;
            }
            ii += 1;
        }
        // dereference schema.$ref
        $ref = schema && schema.$ref;
        if (!$ref) {
            break;
        }
        test = !circularSet.has($ref);
        local.throwSwaggerError(!test && {
            data: data,
            errorType: "schemaDereferenceCircular",
            prefix: option.prefix,
            schema: schema
        });
        circularSet.add($ref);
        // validate semanticWalker6
        test = (
            $ref.indexOf("#/") === 0
            || $ref.indexOf("http://json-schema.org/draft-04/schema#/") === 0
        );
        local.throwSwaggerError(!test && {
            data: $ref,
            errorType: "semanticWalker6",
            prefix: option.prefix.concat(["$ref"])
        });
        switch (option.modeSchema && $ref) {
        case "http://json-schema.org/draft-04/schema#/definitions/parameter":
            // validate semanticFormData1
            test = data.in !== "formdata";
            local.throwSwaggerError(!test && {
                data: data.in,
                errorType: "semanticFormData1",
                prefix: option.prefix.concat(["in"])
            });
            // validate semanticFormData3
            test = data.type !== "file" || data.in === "formData";
            local.throwSwaggerError(!test && {
                data: data,
                errorType: "semanticFormData3",
                prefix: option.prefix
            });
            // validate semanticParameters2
            test = data.in === "body" || !local.isNullOrUndefined(data.type);
            local.throwSwaggerError(!test && {
                data: data,
                errorType: "semanticParameters2",
                prefix: option.prefix
            });
            break;
        case "http://json-schema.org/draft-04/schema#/definitions/schema":
            list = data.required || [];
            ii = 0;
            while (ii < list.length) {
                tmp = list[ii];
                // validate semanticSchema1
                test = !(
                    data.properties
                    && data.properties[tmp]
                    && data.properties[tmp].readOnly
                );
                local.throwSwaggerError(!test && {
                    data: data.properties[tmp],
                    errorType: "semanticSchema1",
                    prefix: option.prefix.concat(["properties", tmp])
                });
                ii += 1;
            }
            // validate semanticWalker1
            test = local.isNullOrUndefined(data.type) || typeof data.type === "string";
            local.throwSwaggerError(!test && {
                data: data.type,
                errorType: "semanticWalker1",
                prefix: option.prefix.concat(["type"])
            });
            // validate semanticWalker2
            test = !(data.maximum < data.minimum);
            local.throwSwaggerError(!test && {
                data: data,
                errorType: "semanticWalker2",
                prefix: option.prefix
            });
            // validate semanticWalker3
            test = !(data.maxProperties < data.minProperties);
            local.throwSwaggerError(!test && {
                data: data,
                errorType: "semanticWalker3",
                prefix: option.prefix
            });
            // validate semanticWalker4
            test = !(data.maxLength < data.minLength);
            local.throwSwaggerError(!test && {
                data: data,
                errorType: "semanticWalker4",
                prefix: option.prefix,
                schema: schema
            });
            break;
        }
        tmp = $ref.split("/").slice(-2);
        schema = (
            $ref.indexOf("http://json-schema.org/draft-04/schema#/") === 0
            ? local.swaggerSchemaJson[tmp[0]]
            : option.swaggerJson[tmp[0]]
        );
        schema = schema && schema[tmp[1]];
        test = schema;
        local.throwSwaggerError(!test && {
            data: data,
            errorType: "schemaDereference",
            prefix: option.prefix,
            schema: option.schema
        });
    }
    if (option.modeDereference) {
        if (option.modeDereferenceDepth > 1) {
            schema = local.jsonCopy(schema);
            Object.keys(schema.properties || {}).forEach(function (key) {
                schema.properties[key] = local.swaggerValidateDataSchema({
                    // dereference property
                    modeDereference: true,
                    modeDereferenceDepth: option.modeDereferenceDepth - 1,
                    prefix: option.prefix.concat(["properties", key]),
                    schema: schema.properties[key],
                    swaggerJson: option.swaggerJson
                });
            });
        }
        return schema;
    }
    // validate schema.default
    if (option.modeDefault) {
        data = schema.default;
    }
    // validate schema.required
    test = (
        option.modeDefault
        || !local.isNullOrUndefined(data)
        || schema.required !== true
        || schema["x-swgg-notRequired"]
    );
    local.throwSwaggerError(!test && {
        data: data,
        errorType: "objectRequired",
        prefix: option.prefix,
        schema: schema
    });
    if (local.isNullOrUndefined(data)) {
        return;
    }
    // validate semanticItemsRequiredForArrayObjects1
    test = (
        !option.modeSchema || local.schemaPType(data) !== "array"
        || (typeof local.schemaPItems(data) === "object" && local.schemaPItems(data))
    );
    local.throwSwaggerError(!test && {
        errorType: "semanticItemsRequiredForArrayObjects1",
        prefix: option.prefix,
        schema: data
    });
    // remove readOnly property
    if (schema.readOnly) {
        delete option.dataReadonlyRemove[0][option.dataReadonlyRemove[1]];
    }
    // optimization - validate schema.type first
    // 5.5.2. type
    // https://swagger.io/docs/specification/data-models/data-types/
    // https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#data-types
    switch (local.schemaPType(schema)) {
    case "array":
        test = Array.isArray(data);
        break;
    case "boolean":
        test = typeof data === "boolean";
        break;
    case "file":
        test = !option.modeSchema;
        break;
    case "integer":
        test = Number.isInteger(data);
        switch (schema.format) {
        case "int32":
            break;
        case "int64":
            break;
        }
        break;
    case "number":
        test = Number.isFinite(data);
        switch (schema.format) {
        case "double":
            break;
        case "float":
            break;
        }
        break;
    case "string":
        test = (
            typeof data === "string"
            || (!option.modeSchema && schema.format === "binary")
        );
        switch (test && !option.modeSchema && schema.format) {
        // Clarify 'byte' format #50
        // https://github.com/swagger-api/swagger-spec/issues/50
        case "byte":
            test = !(
                /[^\n\r+\/0-9=A-Za-z]/
            ).test(data);
            break;
        case "date":
        case "date-time":
            test = JSON.stringify(new Date(data)) !== "null";
            break;
        case "email":
            test = local.regexpValidateEmail.test(data);
            break;
        case "json":
            test = local.tryCatchOnError(function () {
                JSON.parse(data);
                return true;
            }, local.nop);
            break;
        case "phone":
            test = local.regexpValidatePhone.test(data);
            break;
        }
        break;
    default:
        test = option.modeSchema || typeof data === "object";
    }
    local.throwSwaggerError(!test && {
        data: data,
        errorType: "itemType",
        prefix: option.prefix,
        schema: schema,
        typeof: typeof data
    });
    tmp = typeof data;
    if (tmp === "object" && Array.isArray(data)) {
        tmp = "array";
    }
    switch (tmp) {
    // 5.3. Validation keywords for arrays
    case "array":
        // 5.3.1. additionalItems and items
        // swagger disallows array items
        data.forEach(function (element, ii) {
            // recurse - schema.additionalItems and schema.items
            local.swaggerValidateDataSchema({
                data: element,
                dataReadonlyRemove: [dataReadonlyRemove2, ii, dataReadonlyRemove2[ii]],
                modeSchema: option.modeSchema,
                prefix: option.prefix.concat([ii]),
                schema: local.schemaPItems(schema) || schema.additionalItems,
                swaggerJson: option.swaggerJson
            });
        });
        // 5.3.2. maxItems
        test = typeof schema.maxItems !== "number" || data.length <= schema.maxItems;
        local.throwSwaggerError(!test && {
            data: data,
            errorType: "arrayMaxItems",
            prefix: option.prefix,
            schema: schema
        });
        // 5.3.3. minItems
        test = typeof schema.minItems !== "number" || data.length >= schema.minItems;
        local.throwSwaggerError(!test && {
            data: data,
            errorType: "arrayMinItems",
            prefix: option.prefix,
            schema: schema
        });
        // 5.3.4. uniqueItems
        test = !schema.uniqueItems || data.every(function (element) {
            tmp = element;
            return data.indexOf(element) === data.lastIndexOf(element);
        });
        local.throwSwaggerError(!test && {
            data: data,
            errorType: "arrayUniqueItems",
            prefix: option.prefix,
            schema: schema,
            tmp: tmp
        });
        break;
    // 5.1. Validation keywords for numeric instances (number and integer)
    case "number":
        // 5.1.1. multipleOf
        test = typeof schema.multipleOf !== "number" || data % schema.multipleOf === 0;
        local.throwSwaggerError(!test && {
            data: data,
            errorType: "numberMultipleOf",
            prefix: option.prefix,
            schema: schema
        });
        // 5.1.2. maximum and exclusiveMaximum
        test = typeof schema.maximum !== "number" || (
            schema.exclusiveMaximum
            ? data < schema.maximum
            : data <= schema.maximum
        );
        local.throwSwaggerError(!test && {
            data: data,
            errorType: (
                // ternary-condition
                schema.exclusiveMaximum
                ? "numberExclusiveMaximum"
                : "numberMaximum"
            ),
            prefix: option.prefix,
            schema: schema
        });
        // 5.1.3. minimum and exclusiveMinimum
        test = typeof schema.minimum !== "number" || (
            schema.exclusiveMinimum
            ? data > schema.minimum
            : data >= schema.minimum
        );
        local.throwSwaggerError(!test && {
            data: data,
            errorType: (
                // ternary-condition
                schema.exclusiveMinimum
                ? "numberExclusiveMinimum"
                : "numberMinimum"
            ),
            prefix: option.prefix,
            schema: schema
        });
        break;
    // 5.4. Validation keywords for objects
    case "object":
        // 5.4.1. maxProperties
        test = (
            typeof schema.maxProperties !== "number"
            || Object.keys(data).length <= schema.maxProperties
        );
        local.throwSwaggerError(!test && {
            data: data,
            errorType: "objectMaxProperties",
            prefix: option.prefix,
            schema: schema
        });
        // 5.4.2. minProperties
        test = (
            typeof schema.minProperties !== "number"
            || Object.keys(data).length >= schema.minProperties
        );
        local.throwSwaggerError(!test && {
            data: data,
            errorType: "objectMinProperties",
            prefix: option.prefix,
            schema: schema
        });
        // 5.4.3. required
        (schema.required || []).forEach(function (key) {
            // validate semanticItemsRequiredForArrayObjects2
            test = !local.isNullOrUndefined(data[key]);
            local.throwSwaggerError(!test && {
                data: data,
                errorType: "semanticItemsRequiredForArrayObjects2",
                key: key,
                prefix: option.prefix,
                schema: schema
            });
        });
        // 5.4.4. additionalProperties, properties and patternProperties
        Object.keys(data).forEach(function (key) {
            tmp = null;
            if (schema.properties && schema.properties[key]) {
                tmp = true;
                // recurse - schema.properties
                local.swaggerValidateDataSchema({
                    data: data[key],
                    dataReadonlyRemove: [
                        dataReadonlyRemove2,
                        key,
                        dataReadonlyRemove2[key]
                    ],
                    modeSchema: option.modeSchema,
                    prefix: option.prefix.concat([key]),
                    schema: schema.properties[key],
                    swaggerJson: option.swaggerJson
                });
            }
            Object.keys(schema.patternProperties || {}).forEach(function (rgx) {
                if (new RegExp(rgx).test(key)) {
                    tmp = true;
                    // recurse - schema.patternProperties
                    local.swaggerValidateDataSchema({
                        data: data[key],
                        modeSchema: option.modeSchema,
                        prefix: option.prefix.concat([key]),
                        schema: schema.patternProperties[rgx],
                        swaggerJson: option.swaggerJson
                    });
                }
            });
/*
* validate
* 5.4.4.4. If "additionalProperties" has boolean value false
*
* In this case, validation of the instance depends on the property set of
* "properties" and "patternProperties". In this section, the property names of
* "patternProperties" will be called regexes for convenience.
*
* The first step is to collect the following sets:
*
* s
* The property set of the instance to validate.
* p
* The property set from "properties".
* pp
* The property set from "patternProperties".
* Having collected these three sets, the process is as follows:
*
* remove from "s" all elements of "p", if any;
* for each regex in "pp", remove all elements of "s" which this regex matches.
* Validation of the instance succeeds if, after these two steps, set "s" is empty.
*/
            test = tmp || schema.additionalProperties !== false;
            local.throwSwaggerError(!test && {
                data: data,
                errorType: "objectAdditionalProperties",
                key: key,
                prefix: option.prefix,
                schema: schema
            });
            // recurse - schema.additionalProperties
            local.swaggerValidateDataSchema({
                data: data[key],
                modeSchema: option.modeSchema,
                prefix: option.prefix.concat([key]),
                schema: schema.additionalProperties,
                swaggerJson: option.swaggerJson
            });
        });
        // 5.4.5. dependencies
        Object.keys(schema.dependencies || {}).forEach(function (key) {
            if (local.isNullOrUndefined(data[key])) {
                return;
            }
            // 5.4.5.2.1. Schema dependencies
            // recurse - schema.dependencies
            local.swaggerValidateDataSchema({
                data: data[key],
                modeSchema: option.modeSchema,
                prefix: option.prefix.concat([key]),
                schema: schema.dependencies[key],
                swaggerJson: option.swaggerJson
            });
            // 5.4.5.2.2. Property dependencies
            schema.dependencies[key].every(function (key2) {
                test = !local.isNullOrUndefined(data[key2]);
                local.throwSwaggerError(!test && {
                    data: data,
                    errorType: "objectDependencies",
                    key: key,
                    key2: key2,
                    prefix: option.prefix,
                    schema: schema
                });
            });
        });
        break;
    // 5.2. Validation keywords for strings
    case "string":
        // 5.2.1. maxLength
        test = typeof schema.maxLength !== "number" || data.length <= schema.maxLength;
        local.throwSwaggerError(!test && {
            data: data,
            errorType: "stringMaxLength",
            prefix: option.prefix,
            schema: schema
        });
        // 5.2.2. minLength
        test = typeof schema.minLength !== "number" || data.length >= schema.minLength;
        local.throwSwaggerError(!test && {
            data: data,
            errorType: "stringMinLength",
            prefix: option.prefix,
            schema: schema
        });
        // 5.2.3. pattern
        test = !schema.pattern || new RegExp(schema.pattern).test(data);
        local.throwSwaggerError(!test && {
            data: data,
            errorType: "stringPattern",
            prefix: option.prefix,
            schema: schema
        });
        break;
    }
    // 5.5. Validation keywords for any instance type
    // 5.5.1. enum
    tmp = schema.enum || (!option.modeSchema && (local.schemaPItems(schema) || {}).enum);
    test = !tmp || (
        Array.isArray(data)
        ? data
        : [data]
    ).every(function (element) {
        return tmp.indexOf(element) >= 0;
    });
    local.throwSwaggerError(!test && {
        data: data,
        errorType: "itemEnum",
        prefix: option.prefix,
        schema: schema,
        tmp: tmp
    });
    // 5.5.2. type
    local.nop();
    // 5.5.3. allOf
    (schema.allOf || []).forEach(function (element) {
        // recurse - schema.allOf
        local.swaggerValidateDataSchema({
            data: data,
            prefix: option.prefix,
            modeSchema: option.modeSchema,
            schema: element,
            swaggerJson: option.swaggerJson
        });
    });
    // 5.5.4. anyOf
    tmp = null;
    test = !schema.anyOf || schema.anyOf.some(function (element) {
        local.tryCatchOnError(function () {
            // recurse - schema.anyOf
            local.swaggerValidateDataSchema({
                data: data,
                modeSchema: option.modeSchema,
                prefix: option.prefix,
                schema: element,
                swaggerJson: option.swaggerJson
            });
            return true;
        }, local.nop);
        tmp = tmp || local.utility2._debugTryCatchError;
        return !tmp;
    });
    local.throwSwaggerError(!test && {
        data: data,
        errorType: "itemOneOf",
        prefix: option.prefix,
        schema: schema,
        tmp: tmp
    });
    // 5.5.5. oneOf
    tmp = (
        !schema.oneOf
        ? 1
        : 0
    );
    (schema.oneOf || []).some(function (element) {
        local.tryCatchOnError(function () {
            // recurse - schema.oneOf
            local.swaggerValidateDataSchema({
                data: data,
                modeSchema: option.modeSchema,
                prefix: option.prefix,
                schema: element,
                swaggerJson: option.swaggerJson
            });
            tmp += 1;
        }, local.nop);
        return tmp > 1;
    });
    test = tmp === 1;
    local.throwSwaggerError(!test && {
        data: data,
        errorType: "itemOneOf",
        prefix: option.prefix,
        schema: schema,
        tmp: tmp
    });
    // 5.5.6. not
    test = !schema.not || !local.tryCatchOnError(function () {
        // recurse - schema.not
        local.swaggerValidateDataSchema({
            data: data,
            modeSchema: option.modeSchema,
            prefix: option.prefix,
            schema: schema.not,
            swaggerJson: option.swaggerJson
        });
        return true;
    }, local.nop);
    local.throwSwaggerError(!test && {
        data: data,
        errorType: "itemNot",
        prefix: option.prefix,
        schema: schema
    });
    // 5.5.7. definitions
    local.nop();
    // validate data.$ref
    if (schema === local.swaggerSchemaJson.definitions.jsonReference) {
        local.swaggerValidateDataSchema({
            modeDereference: true,
            modeSchema: option.modeSchema,
            prefix: option.prefix,
            schema: data,
            swaggerJson: option.swaggerJson
        });
    }
    return schema;
};
 
local.swaggerValidateFile = function (option, onError) {
/*
 * this function will validate the json-file option.file
 */
    local.onNext(option, function (error, data) {
        switch (option.modeNext) {
        case 1:
            if (typeof option.data === "string") {
                option.onNext(null, option.data);
                return;
            }
            // fetch url
            if ((
                /^(?:http|https):\/\//
            ).test(option.file)) {
                local.ajax({
                    url: option.file
                }, function (error, xhr) {
                    option.onNext(error, xhr && xhr.responseText);
                });
                return;
            }
            // read file
            local.fs.readFile(option.file, "utf8", option.onNext);
            break;
        case 2:
            // jslint
            local.jslint.jslintAndPrint(data, option.file);
            local.assertThrow(
                !local.jslint.jslintResult.errorText,
                local.jslint.jslintResult.errorText.replace((
                    /\u001b\[\d*m/g
                ), "")
            );
            // validate
            local.swgg.swaggerValidate(JSON.parse(data));
            option.onNext();
            break;
        default:
            console.error(
                error
                ? "\u001b[31mswagger-validate - failed - " + option.file + "\n"
                + error.message + "\u001b[39m"
                : "swagger-validate - passed - " + option.file
            );
            onError(error);
        }
    });
    option.modeNext = 0;
    option.onNext();
};
 
local.throwSwaggerError = function (option) {
/*
 * this function will throw a swaggerError with given option.errorType
 */
    var error;
    if (!option) {
        return;
    }
    [0, 2].forEach(function (ii) {
        option["prefix" + ii] = option.prefix[ii] + option.prefix.slice(
            ii + 1
        ).map(function (element) {
            return "[" + JSON.stringify(element) + "]";
        }).join("");
    });
    option.prefix0 += " = " + local.stringTruncate(
        JSON.stringify(option.data) || "undefined",
        100
    );
    option.schema2 = local.stringTruncate(
        JSON.stringify(option.schema) || "undefined",
        500
    );
    option.type2 = (option.schema && local.schemaPType(option.schema)) || "object";
    if (option.schema && option.schema.format) {
        option.type2 += " (" + option.schema.format + ")";
    }
    error = new Error("error." + option.errorType + " - " + local.templateRender(
        local.swaggerErrorTypeDict[option.errorType],
        option,
        {
            notHtmlSafe: true
        }
    ));
    error.messageShort = local.templateRender(
        local.swaggerErrorTypeDict[option.errorType].replace("{{prefix0}}", "{{prefix2}}"),
        option,
        {
            notHtmlSafe: true
        }
    );
    error.option = option;
    error.statusCode = 400;
    throw error;
};
 
local.uiEventDelegate = function (event) {
    // filter non-input keyup-event
    event.targetOnEvent = event.target.closest(
        "[data-onevent]"
    );
    Iif (!event.targetOnEvent) {
        return;
    }
    // rate-limit keyup
    Iif (event.type === "keyup") {
        local.uiEventDelegateKeyupEvent = event;
        if (local.uiEventDelegateKeyupTimerTimeout !== 2) {
            local.uiEventDelegateKeyupTimerTimeout = (
                local.uiEventDelegateKeyupTimerTimeout
                || setTimeout(function () {
                    local.uiEventDelegateKeyupTimerTimeout = 2;
                    local.uiEventDelegate(local.uiEventDelegateKeyupEvent);
                }, 100)
            );
            return;
        }
        local.uiEventDelegateKeyupTimerTimeout = null;
        if (!event.target.closest(
            "input, option, select, textarea"
        )) {
            return;
        }
    }
    switch (event.targetOnEvent.tagName) {
    case "BUTTON":
    case "FORM":
        event.preventDefault();
        break;
    }
    event.stopPropagation();
    local.uiEventListenerDict[event.targetOnEvent.dataset.onevent](event);
};
 
local.uiEventListenerDict = local.objectAssignDefault(
    globalThis.domOnEventDelegateDict
);
 
local.uiEventListenerDict.onEventDomDb = local.db.onEventDomDb;
 
local.uiEventListenerDict.onEventInputTextareaChange = function (event) {
/*
 * this function will show/hide the textarea's multiline placeholder
 */
    var isTransparent;
    var value;
    isTransparent = event.targetOnEvent.style.background.indexOf("transparent") >= 0;
    value = event.targetOnEvent.value;
    Iif (value && isTransparent) {
        event.targetOnEvent.style.background = "";
    }
    if (!value && !isTransparent) {
        event.targetOnEvent.style.background = "transparent";
    }
    local.uiEventListenerDict.onEventInputValidateAndAjax({
        targetOnEvent: event.targetOnEvent
    });
};
 
local.uiEventListenerDict.onEventInputValidateAndAjax = function (option, onError) {
/*
 * this function will validate the input parameters
 * against the schemas in option.parameters
 */
    var errorDict;
    var jsonParse;
    var tmp;
    jsonParse = function (text) {
    /*
     * this function will try to JSON.parse(text)
     */
        return local.tryCatchOnError(function () {
            return JSON.parse(text);
        }, function () {
            return text;
        });
    };
    // jslint-hack
    option.targetOnEvent = option.targetOnEvent.closest(
        ".operation"
    );
    option.api = local.apiDict[option.targetOnEvent.dataset._methodPath];
    option.headers = {};
    option.modeAjax = option.modeAjax || "validate";
    option.modeNoDefault = true;
    option.paramDict = {};
    option.url = "";
    option.api.parameters.forEach(function (schemaP) {
        tmp = option.targetOnEvent.querySelector(
            ".schemaP[data-name=" + JSON.stringify(schemaP.name) + "] .input"
        );
        switch (tmp.tagName) {
        case "INPUT":
            // parse file
            Iif (local.schemaPType(tmp) === "file") {
                tmp = tmp.files && tmp.files[0];
                break;
            }
            tmp = tmp.value;
            if (!tmp) {
                return;
            }
            // parse string
            if (local.schemaPType(schemaP) !== "string") {
                tmp = jsonParse(tmp);
            }
            break;
        case "SELECT":
            tmp = Array.from(tmp.options)
            .filter(function (element) {
                return element.selected;
            })
            .map(function (element) {
                return jsonParse(decodeURIComponent(
                    element.dataset.valueSelectOption
                ));
            });
            if (!tmp.length || tmp[0] === "$swggUndefined") {
                return;
            }
            if (local.schemaPType(schemaP) !== "array") {
                tmp = tmp[0];
            }
            break;
        case "TEXTAREA":
            tmp = tmp.value;
            if (!tmp) {
                return;
            }
            // ignore string (json)
            if (schemaP.format === "json" && local.schemaPType(schemaP) === "string") {
                break;
            }
            if (
                schemaP.schema
                && local.schemaPType(schemaP.schema) === "string"
                && typeof tmp === "string"
            ) {
                break;
            }
            // parse schema
            if (schemaP.in === "body") {
                tmp = jsonParse(tmp);
                break;
            }
            // parse array
            tmp = tmp.split("\n").map(function (element) {
                return (
                    local.schemaPItemsType(schemaP) === "string"
                    ? element
                    : jsonParse(element)
                );
            });
            break;
        }
        option.paramDict[schemaP.name] = tmp;
    });
    option.api.ajax(option, onError || local.nop);
    // init errorDict
    errorDict = {};
    ((option.error && option.error.errorList) || []).forEach(function (error) {
        errorDict[error.option.prefix[2]] = error;
    });
    // shake input on error
    Array.from(option.targetOnEvent.querySelectorAll(
        ".schemaP[data-name]"
    )).forEach(function (element) {
        tmp = errorDict[element.dataset.name];
        local.uiAnimateShakeIfError(tmp, element.querySelector(
            ".input"
        ));
        element.querySelector(
            ".colorError"
        ).textContent = (
            tmp
            ? tmp.messageShort
            : ""
        );
    });
    // shake submit-button on error
    local.uiAnimateShakeIfError(
        option.error,
        option.targetOnEvent.querySelector(
            ".onEventOperationAjax"
        )
    );
    // init requestCurl
    tmp = option.data;
    local.tryCatchOnError(function () {
        tmp = JSON.stringify(JSON.parse(option.data), null, 4);
    }, local.nop);
    tmp = (
        "curl \\\n" + "--request " + option.api._method + " \\\n"
        + Object.keys(option.headers).map(function (key) {
            return "--header '" + key + ": " + option.headers[key] + "' \\\n";
        }).join("") + "--data-binary " + (
            typeof tmp === "string"
            ? "'" + tmp.replace((
                /'/g
            ), "'\"'\"'") + "'"
            : "<blob>"
        ) + " \\\n\"" + option.url.replace((
            /&/g
        ), "&\\\n") + "\""
    );
    option.targetOnEvent.querySelector(
        ".requestCurl"
    ).textContent = tmp;
    // init requestJavascript
    option.targetOnEvent.querySelector(
        ".requestJavascript"
    ).textContent = local.templateRender(
        local.templateUiRequestJavascript,
        {
            option: option,
            optionJson: JSON.stringify({
                paramDict: option.paramDict
            }, null, 4)
        },
        {
            notHtmlSafe: true
        }
    );
};
 
local.uiEventListenerDict.onEventOperationAjax = function (option) {
/*
 * this function will submit the operation to the backend
 */
    // ensure option is stateless
    option = {
        targetOnEvent: option.targetOnEvent.closest(
            ".operation"
        )
    };
    local.onNext(option, function (error, data) {
        switch (option.modeNext) {
        case 1:
            // force ajax
            option.modeAjax = "ajax";
            // validate input
            local.uiEventListenerDict.onEventInputValidateAndAjax(
                option,
                option.onNext
            );
            // reset response output
            Array.from(option.targetOnEvent.querySelectorAll(
                ".responseBody, .responseHeaders, .responseStatusCode"
            )).forEach(function (element) {
                element.classList.remove("hasError");
                element.textContent = "loading ...";
            });
            option.targetOnEvent.querySelector(
                ".responseMedia"
            ).innerHTML = "";
            // scrollTo response
            option.targetOnEvent.querySelector(
                ".responseStatusCode"
            ).focus();
            break;
        default:
            local.onErrorDefault(error);
            data = local.objectSetDefault(data, {
                contentType: "undefined",
                statusCode: "undefined"
            });
            // init responseStatusCode
            option.targetOnEvent.querySelector(
                ".responseStatusCode"
            ).textContent = (
                data.statusCode
            );
            // init responseHeaders
            option.targetOnEvent.querySelector(
                ".responseHeaders"
            ).textContent = Object.keys(
                data.responseHeaders
            ).map(function (key) {
                return key + ": " + data.responseHeaders[key] + "\r\n";
            }).join("");
            // init responseBody
            option.targetOnEvent.querySelector(
                ".responseHeaders"
            ).textContent.replace((
                /^content-type:(.*?)$/im
            ), function (ignore, match1) {
                data.contentType = match1.trim();
            });
            data.mediaType = data.contentType.split("/")[0].replace("image", "img");
            switch (data.mediaType) {
            case "audio":
            case "img":
            case "video":
                option.targetOnEvent.querySelector(
                    ".responseBody"
                ).textContent = (
                    data.contentType
                );
                option.targetOnEvent.querySelector(
                    ".responseMedia"
                ).innerHTML = (
                    "<" + data.mediaType
                    + " class=\"domOnEventMediaHotkeysInit\" controls src=\"data:"
                    + data.contentType
                    + ";base64," + local.base64FromBuffer(data.responseBuffer) + "\"></"
                    + data.mediaType + ">"
                );
                globalThis.domOnEventMediaHotkeys("init");
                break;
            default:
                option.targetOnEvent.querySelector(
                    ".responseBody"
                ).textContent = (
                    data.responseJson
                    ? JSON.stringify(data.responseJson, null, 4)
                    : data.response
                );
            }
            // shake response on error
            Array.from(option.targetOnEvent.querySelectorAll(
                ".responseBody, .responseHeaders, .responseStatusCode"
            )).forEach(function (element) {
                local.uiAnimateShakeIfError(data.statusCode >= 400, element);
            });
        }
    });
    option.modeNext = 0;
    option.onNext();
};
 
local.uiEventListenerDict.onEventOperationDisplayShow = function (event, onError) {
/*
 * this function will toggle the display of the operation
 */
    var element;
    element = event.targetOnEvent;
    element = element.querySelector(
        ".operation"
    ) || element.closest(
        ".operation"
    );
    location.hash = "!" + element.id;
    element.closest(
        ".resource"
    ).classList.remove("expanded");
    // show parent resource
    local.uiAnimateSlideDown(element.closest(
        ".resource"
    ).querySelector(
        ".operationList"
    ));
    // show the operation, but hide all other operations
    local.uiAnimateSlideAccordian(
        element.querySelector(
            ".operation > form"
        ),
        Array.from(element.closest(
            ".operationList"
        ).querySelectorAll(
            ".operation > form"
        )),
        function () {
            // scrollTo operation
            element.querySelector(
                "[tabIndex]"
            ).blur();
            element.querySelector(
                "[tabIndex]"
            ).focus();
            // validate input
            local.uiEventListenerDict.onEventInputValidateAndAjax({
                targetOnEvent: element
            });
            local.setTimeoutOnError(onError, 0, null, element);
        }
    );
};
 
local.uiEventListenerDict.onEventResourceDisplayAction = function (event) {
/*
 * this function will toggle the display of the resource
 */
    location.hash = "!" + event.currentTarget.id;
    event.targetOnEvent.className.split(" ").some(function (className) {
        switch (className) {
        case "td1":
            // show the resource, but hide all other resources
            local.uiAnimateSlideAccordian(
                event.currentTarget.querySelector(
                    ".operationList"
                ),
                Array.from(document.querySelectorAll(
                    ".swggUiContainer .operationList"
                ))
            );
            // show at least one operation in the resource
            local.uiEventListenerDict.onEventOperationDisplayShow({
                targetOnEvent: event.currentTarget.querySelector(
                    ".operation .uiAnimateSlide[style*=\"max-height: 100%\"]"
                ) || event.currentTarget.querySelector(
                    ".operation"
                )
            });
            return true;
        case "td2":
            // show the resource, but hide all other resources
            local.uiAnimateSlideAccordian(
                event.currentTarget.querySelector(
                    ".operationList"
                ),
                Array.from(document.querySelectorAll(
                    ".swggUiContainer .operationList"
                ))
            );
            // collapse all operations in the resource
            if (event.currentTarget.classList.contains("expanded")) {
                event.currentTarget.classList.remove("expanded");
                Array.from(event.currentTarget.querySelectorAll(
                    ".operation > form"
                )).forEach(function (element) {
                    local.uiAnimateSlideUp(element);
                });
            // expand all operations in the resource
            } else {
                event.currentTarget.classList.add("expanded");
                Array.from(event.currentTarget.querySelectorAll(
                    ".operation > form"
                )).forEach(function (element) {
                    local.uiAnimateSlideDown(element);
                    // validate input
                    local.uiEventListenerDict.onEventInputValidateAndAjax({
                        targetOnEvent: element
                    });
                });
            }
            return true;
        }
    });
};
 
local.uiEventListenerDict.onEventUiReload = function (option, onError) {
/*
 * this function will reload the ui
 */
    var resource;
    var swaggerJson;
    option = option || {};
    swaggerJson = option;
    local.onNext(option, function (error, data) {
        switch (option.modeNext) {
        case 1:
            Iif (
                event
                && event.targetOnEvent
                && !event.targetOnEvent.classList.contains(
                    "eventDelegate"
                    + event.type[0].toUpperCase()
                    + event.type.slice(1)
                )
            ) {
                return;
            }
            option.inputUrl = document.querySelector(
                ".swggUiContainer > .thead > .td2"
            );
            // clear all apiKeyValue's from localStorage
            Iif (
                option.targetOnEvent
                && option.targetOnEvent.id === "swggApiKeyClearButton1"
            ) {
                local.apiKeyValue = "";
                Object.keys(localStorage).forEach(function (key) {
                    if (key.indexOf("utility2_swgg_apiKeyKey_") === 0) {
                        localStorage.removeItem(key);
                    }
                });
            // restore apiKeyValue
            } else if (option.swggInit) {
                local.apiKeyKey = "utility2_swgg_apiKeyKey_" + encodeURIComponent(
                    local.urlParse(option.inputUrl.value.replace((
                        /^\//
                    ), "")).href
                );
                local.apiKeyValue = localStorage.getItem(local.apiKeyKey) || "";
            // save apiKeyValue
            } else {
                local.apiKeyValue = document.querySelector(
                    "#swggApiKeyInput1"
                ).value;
                local.localStorageSetItemOrClear(local.apiKeyKey, local.apiKeyValue);
            }
            // if keyup-event is not return-key, then return
            if (
                (option.type === "keyup" && option.code !== "Enter")
                // do not reload ui during test
                || globalThis.utility2_modeTest >= 4
            ) {
                option.modeNext = Infinity;
                option.onNext();
                return;
            }
            // reset ui
            document.querySelector(
                "#swggUiReloadErrorDiv1"
            ).textContent = "";
            Array.from(document.querySelectorAll(
                ".swggUiContainer > .reset"
            )).forEach(function (element) {
                element.remove();
            });
            // normalize swaggerJsonUrl
            option.inputUrl.value = local.urlParse(
                option.inputUrl.value.replace((
                    /^\//
                ), "")
            ).href;
            document.querySelector(
                "#swggAjaxProgressDiv1 span"
            ).innerHTML = (
                "loading swagger.json"
            );
            option.onNext();
            break;
        case 2:
            // fetch swagger.json file
            local.ajax({
                url: option.inputUrl.value
            }, option.onNext);
            break;
        case 3:
            // JSON.parse swagger.json string
            local.tryCatchOnError(function () {
                option.onNext(null, JSON.parse(data.responseText));
            }, option.onNext);
            break;
        case 4:
            // reset state
            local.apiDict = null;
            local.swaggerJson = null;
            // apiUpdate swagger.json object
            local.apiUpdate(data);
            swaggerJson = local.jsonCopy(local.swaggerJson);
            local.uiState = swaggerJson;
            // init ajaxProgressText
            swaggerJson.ajaxProgressText = "rendering swagger.json";
            // init apiKeyValue
            swaggerJson.apiKeyValue = local.apiKeyValue;
            // templateRender title
            document.querySelector(
                "head > title"
            ).textContent = local.templateRender(
                local.templateUiTitle,
                swaggerJson
            ).trim();
            // init urlSwaggerJson
            swaggerJson.urlSwaggerJson = option.inputUrl.value;
            // templateRender main
            document.querySelector(
                ".swggUiContainer"
            ).innerHTML = local.templateRender(
                local.templateUiMain,
                swaggerJson
            );
            setTimeout(function () {
                // recurse - render .resourceList
                local.uiEventListenerDict.onEventUiReload(
                    swaggerJson,
                    option.onNext
                );
            }, 100);
            break;
        default:
            local.onErrorDefault(error);
            // debug error
            local._debugOnEventUiReload = error || local._debugOnEventUiReload;
            document.querySelector(
                "#swggUiReloadErrorDiv1"
            ).textContent = (
                (error || {
                    message: ""
                }).message
            );
            local.setTimeoutOnError(onError, 0, error);
        }
    });
    // optimization - render .swggUiContainer first
    if (!swaggerJson.swagger) {
        option.modeNext = 0;
        option.onNext();
        return;
    }
    // optimization - render .resourceList in separate event-loop
    // reset state
    local.idDomElementDict = {};
    local.objectSetDefault(swaggerJson, {
        resourceDict: {},
        operationDict: {},
        tagDict: {}
    });
    // init tagDict
    swaggerJson.tags.forEach(function (tag) {
        swaggerJson.tagDict[tag.name] = tag;
    });
    // init operationDict
    Object.keys(local.apiDict).sort().forEach(function (operation) {
        // init operation
        operation = local.jsonCopy(local.apiDict[operation]);
        operation.tags.forEach(function (tag) {
            swaggerJson.operationDict[operation._methodPath] = operation;
            // init resource
            swaggerJson.resourceDict[tag] = local.objectSetDefault(
                swaggerJson.resourceDict[tag] || swaggerJson.tagDict[tag],
                {
                    description: "no description",
                    name: tag
                }
            );
            resource = swaggerJson.resourceDict[tag];
            resource.id = resource.id || local.idDomElementCreate("swgg_id_" + tag);
            resource.summary = resource.summary || String(resource.description)
            .replace((
                /\bhttps?:\/\/[^\s<]+[^<.,:;"')\]\s]/g
            ), "");
        });
    });
    // init uiFragment
    swaggerJson.uiFragment = document.createDocumentFragment();
    // init resourceDict
    Object.keys(swaggerJson.resourceDict).sort().forEach(function (key) {
        // templateRender resource
        swaggerJson.uiFragment.appendChild(
            local.domElementRender(local.templateUiResource, swaggerJson.resourceDict[key])
        );
    });
    Object.keys(swaggerJson.operationDict).sort(function (aa, bb) {
        aa = swaggerJson.operationDict[aa];
        aa = aa["x-swgg-sortValue"] || (aa._path + " " + aa._method);
        bb = swaggerJson.operationDict[bb];
        bb = bb["x-swgg-sortValue"] || (bb._path + " " + bb._method);
        return (
            aa < bb
            ? -1
            : 1
        );
    }).forEach(function (operation) {
        operation = swaggerJson.operationDict[operation];
        operation.id = local.idDomElementCreate("swgg_id_" + operation.operationId);
        operation.tags.forEach(function (tag) {
            // create new operation for each tag
            operation = local.jsonCopy(operation);
            resource = swaggerJson.resourceDict[tag];
            local.objectSetDefault(operation, {
                description: "no description",
                responseList: Object.keys(operation.responses).sort().map(function (key) {
                    return {
                        key: key,
                        value: operation.responses[key]
                    };
                })
            });
            operation.summary = operation.summary || operation.description
            .replace((
                /\bhttps?:\/\/[^\s<]+[^<.,:;"')\]\s]/g
            ), "");
            operation.parameters.forEach(local.uiRenderSchemaP);
            // templateRender operation
            swaggerJson.uiFragment.querySelector(
                "#" + resource.id + " .operationList"
            )
            .appendChild(local.domElementRender(local.templateUiOperation, operation));
        });
    });
    // emulate <ol></ol> for operations
    Array.from(swaggerJson.uiFragment.querySelectorAll(
        ".operationList"
    )).forEach(function (element) {
        Array.from(element.querySelectorAll(
            ".operation > .thead > .td1"
        )).forEach(function (element, ii) {
            element.textContent = ii + 1 + ".";
        });
    });
    // append uiFragment to swggUiContainer
    document.querySelector(
        "#swggAjaxProgressDiv1"
    ).style.display = "none";
    document.querySelector(
        ".swggUiContainer .resourceList"
    ).appendChild(
        swaggerJson.uiFragment
    );
    Array.from(document.querySelectorAll(
        ".swggUiContainer [data-value-text]"
    )).forEach(function (element) {
        // render valueText
        element.value = decodeURIComponent(element.dataset.valueText);
        delete element.dataset.valueText;
        // init textarea's multiline placeholder
        if (element.tagName === "TEXTAREA") {
            local.uiEventListenerDict.onEventInputTextareaChange({
                targetOnEvent: element
            });
        }
    });
    // init event-handling
    ["Change", "Click", "Keyup", "Submit"].forEach(function (eventType) {
        Array.from(document.querySelectorAll(
            ".eventDelegate" + eventType
        )).forEach(function (element) {
            element.addEventListener(
                eventType.toLowerCase(),
                local.uiEventDelegate
            );
        });
    });
    // scrollTo location.hash
    local.uiEventListenerDict.onEventOperationDisplayShow({
        targetOnEvent: (
            document.querySelector(
                "#" + (location.hash.slice(2) || "undefined")
            )
            || document.querySelector(
                ".swggUiContainer .operation"
            )
        )
    });
    local.setTimeoutOnError(onError);
};
 
local.uiRenderSchemaP = function (schemaP) {
/*
 * this function will render schemaP
 */
    // init schemaP.id
    schemaP.id = local.idDomElementCreate("swgg_id_" + schemaP.name);
    // init enum
    schemaP.enum2 = (
        schemaP.enum
        || (local.schemaPItems(schemaP) || {}).enum
        || (local.schemaPType(schemaP) === "boolean" && [false, true])
    );
    // init input - file
    if (local.schemaPType(schemaP) === "file") {
        schemaP.isFile = true;
    // init input - textarea
    } else if (schemaP.in === "body") {
        schemaP.isTextarea = true;
    // init input - select
    } else if (schemaP.enum2) {
        // init enumDefault
        schemaP.enumDefault = [];
        if (schemaP.required && schemaP.default !== undefined) {
            schemaP.enumDefault = (
                local.schemaPType(schemaP) === "array"
                ? schemaP.default
                : [schemaP.default]
            );
        }
        schemaP.isSelectMultiple = local.schemaPType(schemaP) === "array";
        schemaP.selectOptionList = schemaP.enum2.map(function (element) {
            // init hasDefault
            schemaP.hasDefault = (
                schemaP.hasDefault
                || schemaP.enumDefault.indexOf(element) >= 0
            );
            return {
                id: local.idDomElementCreate("swgg_id_" + schemaP.name),
                selected: (
                    // ternary-condition
                    schemaP.enumDefault.indexOf(element) >= 0
                    ? "selected"
                    : ""
                ),
                type: (
                    local.schemaPItemsType(schemaP)
                    || local.schemaPType(schemaP)
                ),
                placeholder: (
                    // ternary-condition
                    typeof element === "string"
                    ? element
                    : JSON.stringify(element)
                ),
                valueSelectOption: element
            };
        });
        // init 'undefined' value
        if (!schemaP.required && !schemaP.hasDefault) {
            schemaP.selectOptionList.unshift({
                id: local.idDomElementCreate("swgg_id_" + schemaP.name),
                selected: "selected",
                type: local.schemaPType(schemaP),
                placeholder: "<none>",
                valueSelectOption: "$swggUndefined"
            });
        }
        // select at least one value
        schemaP.selectOptionList.some(function (element, ii) {
            if (ii === 0 || element.selected) {
                element.selected = "selected";
                if (ii !== 0) {
                    schemaP.selectOptionList[0].selected = "";
                    return true;
                }
            }
        });
    // init input - textarea
    } else if (local.schemaPType(schemaP) === "array" || (
        schemaP.format === "json"
        && local.schemaPType(schemaP) === "string"
    )) {
        schemaP.isTextarea = true;
    // init input - number
    } else if (schemaP.type === "integer" || schemaP.type === "number") {
        schemaP.isInputNumber = true;
    // init input - text
    } else {
        schemaP.isInputText = true;
    }
    // init format2 / type2
    ([schemaP, schemaP.schema || {}]).some(function (element) {
        local.objectSetDefault(schemaP, {
            format2: local.schemaPItemsType(element) || element.format,
            type2: local.schemaPType(element)
        });
        return schemaP.type2;
    });
    schemaP.type2 = schemaP.type2 || "object";
    // init schema2
    ([
        schemaP,
        local.schemaPItems(schemaP),
        schemaP.schema,
        schemaP.schema && local.schemaPItems(schemaP.schema)
    ]).some(function (element) {
        schemaP.schema2 = (local.swaggerValidateDataSchema({
            // dereference schemaP
            modeDereference: true,
            modeDereferenceDepth: 2,
            prefix: ["parameters", schemaP.name],
            schema: element,
            swaggerJson: local.swaggerJson
        }) || {});
        return schemaP.schema2.properties;
    });
    if (schemaP.schema2.properties) {
        schemaP.schemaText = JSON.stringify((
            // ternary-condition
            schemaP.type2 === "array"
            ? [schemaP.schema2.properties]
            : schemaP.schema2.properties
        ), null, 4);
    }
    // init placeholder
    schemaP.placeholder = (
        !local.isNullOrUndefined(schemaP.default)
        ? schemaP.default
        : local.dbFieldRandomCreate({
            modeNotRandom: true,
            schemaP: schemaP
        })
    );
    if (typeof schemaP.placeholder !== "string") {
        if (schemaP.in === "body") {
            schemaP.placeholder = JSON.stringify(schemaP.placeholder, null, 4);
        } else if (Array.isArray(schemaP.placeholder)) {
            schemaP.placeholder = schemaP.placeholder.map(function (element) {
                return (
                    typeof element === "string"
                    ? element
                    : JSON.stringify(element)
                );
            }).join("\n");
        } else {
            schemaP.placeholder = JSON.stringify(schemaP.placeholder);
        }
    } else if (schemaP.format === "json") {
        schemaP.placeholder = JSON.stringify(JSON.parse(schemaP.placeholder), null, 4);
    }
    // init valueText
    schemaP.valueText = (
        schemaP["x-swgg-apiKey"]
        ? local.apiKeyValue
        : schemaP.default === null
        ? ""
        : (schemaP.required || schemaP.isTextarea)
        ? schemaP.placeholder
        : ""
    );
    // templateRender schemaP
    schemaP.innerHTML = local.templateRender(local.templateUiParameter, schemaP);
};
 
local.urlParseWithBraket = function (url) {
/*
 * this function will urlParse the url with curly-brackets preserved
 */
    var tmp;
    tmp = local.stringUniqueKey(url);
    return JSON.parse(JSON.stringify(
        local.urlParse(url.replace((
            /\{/g
        ), tmp + 1).replace((
            /\}/g
        ), tmp + 2))
    ).replace(new RegExp(tmp + 1, "g"), "{").replace(new RegExp(tmp + 2, "g"), "}"));
};
 
local.userLoginByPassword = function (option, onError) {
/*
 * this function will send a login-by-password request
 */
    local.apiDict["GET /user/userLoginByPassword"].ajax({
        paramDict: {
            password: option.password,
            username: option.username
        }
    }, onError);
};
 
local.userLogout = function (option, onError) {
/*
 * this function will send a logout request
 */
    local.apiDict["GET /user/userLogout"].ajax(option, onError);
};
}());
 
 
 
// run node js-env code - init-after
/* istanbul ignore next */
(function () {
if (local.isBrowser) {
    return;
}
local.assetsDict["/assets.swagger-ui.logo.medium.png"] = Buffer.from(
    local.templateSwaggerUiLogoMediumBase64,
    "base64"
);
local.assetsDict["/assets.swagger-ui.logo.small.png"] = Buffer.from(
    local.templateSwaggerUiLogoSmallBase64,
    "base64"
);
local.swgg.apiUpdate(
    local.fsReadFileOrEmptyStringSync(local.__dirname + "/assets.swgg.swagger.json", "json")
);
}());
 
 
 
}());