mock.js
300 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
(function webpackUniversalModuleDefinition(root, factory) {
if (typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if (typeof define === 'function' && define.amd)
define([], factory);
else if (typeof exports === 'object')
exports["Mock"] = factory();
else
root["Mock"] = factory();
})(this, function () {
return /******/ (function (modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if (installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/
};
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/
}
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/
})
/************************************************************************/
/******/([
/* 0 */
/***/ function (module, exports, __webpack_require__) {
/* global require, module, window */
var Handler = __webpack_require__(1)
var Util = __webpack_require__(3)
var Random = __webpack_require__(5)
var RE = __webpack_require__(20)
var toJSONSchema = __webpack_require__(23)
var valid = __webpack_require__(25)
var XHR
if (typeof window !== 'undefined') XHR = __webpack_require__(27)
/*!
Mock - 模拟请求 & 模拟数据
https://github.com/nuysoft/Mock
墨智 mozhi.gyy@taobao.com nuysoft@gmail.com
*/
var Mock = {
Handler: Handler,
Random: Random,
Util: Util,
XHR: XHR,
RE: RE,
toJSONSchema: toJSONSchema,
valid: valid,
heredoc: Util.heredoc,
setup: function (settings) {
return XHR.setup(settings)
},
_mocked: {}
}
Mock.version = '1.0.1-beta3'
// 避免循环依赖
if (XHR) XHR.Mock = Mock
/*
* Mock.mock( template )
* Mock.mock( function() )
* Mock.mock( rurl, template )
* Mock.mock( rurl, function(options) )
* Mock.mock( rurl, rtype, template )
* Mock.mock( rurl, rtype, function(options) )
根据数据模板生成模拟数据。
*/
Mock.mock = function (rurl, rtype, template) {
// Mock.mock(template)
if (arguments.length === 1) {
return Handler.gen(rurl)
}
// Mock.mock(rurl, template)
if (arguments.length === 2) {
template = rtype
rtype = undefined
}
// 拦截 XHR
if (XHR) window.XMLHttpRequest = XHR
Mock._mocked[rurl + (rtype || '')] = {
rurl: rurl,
rtype: rtype,
template: template
}
return Mock
}
module.exports = Mock
/***/
},
/* 1 */
/***/ function (module, exports, __webpack_require__) {
/*
## Handler
处理数据模板。
* Handler.gen( template, name?, context? )
入口方法。
* Data Template Definition, DTD
处理数据模板定义。
* Handler.array( options )
* Handler.object( options )
* Handler.number( options )
* Handler.boolean( options )
* Handler.string( options )
* Handler.function( options )
* Handler.regexp( options )
处理路径(相对和绝对)。
* Handler.getValueByKeyPath( key, options )
* Data Placeholder Definition, DPD
处理数据占位符定义
* Handler.placeholder( placeholder, context, templateContext, options )
*/
var Constant = __webpack_require__(2)
var Util = __webpack_require__(3)
var Parser = __webpack_require__(4)
var Random = __webpack_require__(5)
var RE = __webpack_require__(20)
var Handler = {
extend: Util.extend
}
/*
template 属性值(即数据模板)
name 属性名
context 数据上下文,生成后的数据
templateContext 模板上下文,
Handle.gen(template, name, options)
context
currentContext, templateCurrentContext,
path, templatePath
root, templateRoot
*/
Handler.gen = function (template, name, context) {
/* jshint -W041 */
name = name == undefined ? '' : (name + '')
context = context || {}
context = {
// 当前访问路径,只有属性名,不包括生成规则
path: context.path || [Constant.GUID],
templatePath: context.templatePath || [Constant.GUID++],
// 最终属性值的上下文
currentContext: context.currentContext,
// 属性值模板的上下文
templateCurrentContext: context.templateCurrentContext || template,
// 最终值的根
root: context.root || context.currentContext,
// 模板的根
templateRoot: context.templateRoot || context.templateCurrentContext || template
}
// console.log('path:', context.path.join('.'), template)
var rule = Parser.parse(name)
var type = Util.type(template)
var data
if (Handler[type]) {
data = Handler[type]({
// 属性值类型
type: type,
// 属性值模板
template: template,
// 属性名 + 生成规则
name: name,
// 属性名
parsedName: name ? name.replace(Constant.RE_KEY, '$1') : name,
// 解析后的生成规则
rule: rule,
// 相关上下文
context: context
})
if (!context.root) context.root = data
return data
}
return template
}
Handler.extend({
array: function (options) {
var result = [],
i, ii;
// 'name|1': []
// 'name|count': []
// 'name|min-max': []
if (options.template.length === 0) return result
// 'arr': [{ 'email': '@EMAIL' }, { 'email': '@EMAIL' }]
if (!options.rule.parameters) {
for (i = 0; i < options.template.length; i++) {
options.context.path.push(i)
options.context.templatePath.push(i)
result.push(
Handler.gen(options.template[i], i, {
path: options.context.path,
templatePath: options.context.templatePath,
currentContext: result,
templateCurrentContext: options.template,
root: options.context.root || result,
templateRoot: options.context.templateRoot || options.template
})
)
options.context.path.pop()
options.context.templatePath.pop()
}
} else {
// 'method|1': ['GET', 'POST', 'HEAD', 'DELETE']
if (options.rule.min === 1 && options.rule.max === undefined) {
// fix #17
options.context.path.push(options.name)
options.context.templatePath.push(options.name)
result = Random.pick(
Handler.gen(options.template, undefined, {
path: options.context.path,
templatePath: options.context.templatePath,
currentContext: result,
templateCurrentContext: options.template,
root: options.context.root || result,
templateRoot: options.context.templateRoot || options.template
})
)
options.context.path.pop()
options.context.templatePath.pop()
} else {
// 'data|+1': [{}, {}]
if (options.rule.parameters[2]) {
options.template.__order_index = options.template.__order_index || 0
options.context.path.push(options.name)
options.context.templatePath.push(options.name)
result = Handler.gen(options.template, undefined, {
path: options.context.path,
templatePath: options.context.templatePath,
currentContext: result,
templateCurrentContext: options.template,
root: options.context.root || result,
templateRoot: options.context.templateRoot || options.template
})[
options.template.__order_index % options.template.length
]
options.template.__order_index += +options.rule.parameters[2]
options.context.path.pop()
options.context.templatePath.pop()
} else {
// 'data|1-10': [{}]
for (i = 0; i < options.rule.count; i++) {
// 'data|1-10': [{}, {}]
for (ii = 0; ii < options.template.length; ii++) {
options.context.path.push(result.length)
options.context.templatePath.push(ii)
result.push(
Handler.gen(options.template[ii], result.length, {
path: options.context.path,
templatePath: options.context.templatePath,
currentContext: result,
templateCurrentContext: options.template,
root: options.context.root || result,
templateRoot: options.context.templateRoot || options.template
})
)
options.context.path.pop()
options.context.templatePath.pop()
}
}
}
}
}
return result
},
object: function (options) {
var result = {},
keys, fnKeys, key, parsedKey, inc, i;
// 'obj|min-max': {}
/* jshint -W041 */
if (options.rule.min != undefined) {
keys = Util.keys(options.template)
keys = Random.shuffle(keys)
keys = keys.slice(0, options.rule.count)
for (i = 0; i < keys.length; i++) {
key = keys[i]
parsedKey = key.replace(Constant.RE_KEY, '$1')
options.context.path.push(parsedKey)
options.context.templatePath.push(key)
result[parsedKey] = Handler.gen(options.template[key], key, {
path: options.context.path,
templatePath: options.context.templatePath,
currentContext: result,
templateCurrentContext: options.template,
root: options.context.root || result,
templateRoot: options.context.templateRoot || options.template
})
options.context.path.pop()
options.context.templatePath.pop()
}
} else {
// 'obj': {}
keys = []
fnKeys = [] // #25 改变了非函数属性的顺序,查找起来不方便
for (key in options.template) {
(typeof options.template[key] === 'function' ? fnKeys : keys).push(key)
}
keys = keys.concat(fnKeys)
/*
会改变非函数属性的顺序
keys = Util.keys(options.template)
keys.sort(function(a, b) {
var afn = typeof options.template[a] === 'function'
var bfn = typeof options.template[b] === 'function'
if (afn === bfn) return 0
if (afn && !bfn) return 1
if (!afn && bfn) return -1
})
*/
for (i = 0; i < keys.length; i++) {
key = keys[i]
parsedKey = key.replace(Constant.RE_KEY, '$1')
options.context.path.push(parsedKey)
options.context.templatePath.push(key)
result[parsedKey] = Handler.gen(options.template[key], key, {
path: options.context.path,
templatePath: options.context.templatePath,
currentContext: result,
templateCurrentContext: options.template,
root: options.context.root || result,
templateRoot: options.context.templateRoot || options.template
})
options.context.path.pop()
options.context.templatePath.pop()
// 'id|+1': 1
inc = key.match(Constant.RE_KEY)
if (inc && inc[2] && Util.type(options.template[key]) === 'number') {
options.template[key] += parseInt(inc[2], 10)
}
}
}
return result
},
number: function (options) {
var result, parts;
if (options.rule.decimal) { // float
options.template += ''
parts = options.template.split('.')
// 'float1|.1-10': 10,
// 'float2|1-100.1-10': 1,
// 'float3|999.1-10': 1,
// 'float4|.3-10': 123.123,
parts[0] = options.rule.range ? options.rule.count : parts[0]
parts[1] = (parts[1] || '').slice(0, options.rule.dcount)
while (parts[1].length < options.rule.dcount) {
parts[1] += (
// 最后一位不能为 0:如果最后一位为 0,会被 JS 引擎忽略掉。
(parts[1].length < options.rule.dcount - 1) ? Random.character('number') : Random.character('123456789')
)
}
result = parseFloat(parts.join('.'), 10)
} else { // integer
// 'grade1|1-100': 1,
result = options.rule.range && !options.rule.parameters[2] ? options.rule.count : options.template
}
return result
},
boolean: function (options) {
var result;
// 'prop|multiple': false, 当前值是相反值的概率倍数
// 'prop|probability-probability': false, 当前值与相反值的概率
result = options.rule.parameters ? Random.bool(options.rule.min, options.rule.max, options.template) : options.template
return result
},
string: function (options) {
var result = '',
i, placeholders, ph, phed;
if (options.template.length) {
// 'foo': '★',
/* jshint -W041 */
if (options.rule.count == undefined) {
result += options.template
}
// 'star|1-5': '★',
for (i = 0; i < options.rule.count; i++) {
result += options.template
}
// 'email|1-10': '@EMAIL, ',
placeholders = result.match(Constant.RE_PLACEHOLDER) || [] // A-Z_0-9 > \w_
for (i = 0; i < placeholders.length; i++) {
ph = placeholders[i]
// 遇到转义斜杠,不需要解析占位符
if (/^\\/.test(ph)) {
placeholders.splice(i--, 1)
continue
}
phed = Handler.placeholder(ph, options.context.currentContext, options.context.templateCurrentContext, options)
// 只有一个占位符,并且没有其他字符
if (placeholders.length === 1 && ph === result && typeof phed !== typeof result) { //
result = phed
break
if (Util.isNumeric(phed)) {
result = parseFloat(phed, 10)
break
}
if (/^(true|false)$/.test(phed)) {
result = phed === 'true' ? true :
phed === 'false' ? false :
phed // 已经是布尔值
break
}
}
result = result.replace(ph, phed)
}
} else {
// 'ASCII|1-10': '',
// 'ASCII': '',
result = options.rule.range ? Random.string(options.rule.count) : options.template
}
return result
},
'function': function (options) {
// ( context, options )
return options.template.call(options.context.currentContext, options)
},
'regexp': function (options) {
var source = ''
// 'name': /regexp/,
/* jshint -W041 */
if (options.rule.count == undefined) {
source += options.template.source // regexp.source
}
// 'name|1-5': /regexp/,
for (var i = 0; i < options.rule.count; i++) {
source += options.template.source
}
return RE.Handler.gen(
RE.Parser.parse(
source
)
)
}
})
Handler.extend({
_all: function () {
var re = {};
for (var key in Random) re[key.toLowerCase()] = key
return re
},
// 处理占位符,转换为最终值
placeholder: function (placeholder, obj, templateContext, options) {
// console.log(options.context.path)
// 1 key, 2 params
Constant.RE_PLACEHOLDER.exec('')
var parts = Constant.RE_PLACEHOLDER.exec(placeholder),
key = parts && parts[1],
lkey = key && key.toLowerCase(),
okey = this._all()[lkey],
params = parts && parts[2] || ''
var pathParts = this.splitPathToArray(key)
// 解析占位符的参数
try {
// 1. 尝试保持参数的类型
/*
#24 [Window Firefox 30.0 引用 占位符 抛错](https://github.com/nuysoft/Mock/issues/24)
[BX9056: 各浏览器下 window.eval 方法的执行上下文存在差异](http://www.w3help.org/zh-cn/causes/BX9056)
应该属于 Window Firefox 30.0 的 BUG
*/
/* jshint -W061 */
params = eval('(function(){ return [].splice.call(arguments, 0 ) })(' + params + ')')
} catch (error) {
// 2. 如果失败,只能解析为字符串
// console.error(error)
// if (error instanceof ReferenceError) params = parts[2].split(/,\s*/);
// else throw error
params = parts[2].split(/,\s*/)
}
// 占位符优先引用数据模板中的属性
if (obj && (key in obj)) return obj[key]
// @index @key
// if (Constant.RE_INDEX.test(key)) return +options.name
// if (Constant.RE_KEY.test(key)) return options.name
// 绝对路径 or 相对路径
if (
key.charAt(0) === '/' ||
pathParts.length > 1
) return this.getValueByKeyPath(key, options)
// 递归引用数据模板中的属性
if (templateContext &&
(typeof templateContext === 'object') &&
(key in templateContext) &&
(placeholder !== templateContext[key]) // fix #15 避免自己依赖自己
) {
// 先计算被引用的属性值
templateContext[key] = Handler.gen(templateContext[key], key, {
currentContext: obj,
templateCurrentContext: templateContext
})
return templateContext[key]
}
// 如果未找到,则原样返回
if (!(key in Random) && !(lkey in Random) && !(okey in Random)) return placeholder
// 递归解析参数中的占位符
for (var i = 0; i < params.length; i++) {
Constant.RE_PLACEHOLDER.exec('')
if (Constant.RE_PLACEHOLDER.test(params[i])) {
params[i] = Handler.placeholder(params[i], obj, templateContext, options)
}
}
var handle = Random[key] || Random[lkey] || Random[okey]
switch (Util.type(handle)) {
case 'array':
// 自动从数组中取一个,例如 @areas
return Random.pick(handle)
case 'function':
// 执行占位符方法(大多数情况)
handle.options = options
var re = handle.apply(Random, params)
if (re === undefined) re = '' // 因为是在字符串中,所以默认为空字符串。
delete handle.options
return re
}
},
getValueByKeyPath: function (key, options) {
var originalKey = key
var keyPathParts = this.splitPathToArray(key)
var absolutePathParts = []
// 绝对路径
if (key.charAt(0) === '/') {
absolutePathParts = [options.context.path[0]].concat(
this.normalizePath(keyPathParts)
)
} else {
// 相对路径
if (keyPathParts.length > 1) {
absolutePathParts = options.context.path.slice(0)
absolutePathParts.pop()
absolutePathParts = this.normalizePath(
absolutePathParts.concat(keyPathParts)
)
}
}
key = keyPathParts[keyPathParts.length - 1]
var currentContext = options.context.root
var templateCurrentContext = options.context.templateRoot
for (var i = 1; i < absolutePathParts.length - 1; i++) {
currentContext = currentContext[absolutePathParts[i]]
templateCurrentContext = templateCurrentContext[absolutePathParts[i]]
}
// 引用的值已经计算好
if (currentContext && (key in currentContext)) return currentContext[key]
// 尚未计算,递归引用数据模板中的属性
if (templateCurrentContext &&
(typeof templateCurrentContext === 'object') &&
(key in templateCurrentContext) &&
(originalKey !== templateCurrentContext[key]) // fix #15 避免自己依赖自己
) {
// 先计算被引用的属性值
templateCurrentContext[key] = Handler.gen(templateCurrentContext[key], key, {
currentContext: currentContext,
templateCurrentContext: templateCurrentContext
})
return templateCurrentContext[key]
}
},
// https://github.com/kissyteam/kissy/blob/master/src/path/src/path.js
normalizePath: function (pathParts) {
var newPathParts = []
for (var i = 0; i < pathParts.length; i++) {
switch (pathParts[i]) {
case '..':
newPathParts.pop()
break
case '.':
break
default:
newPathParts.push(pathParts[i])
}
}
return newPathParts
},
splitPathToArray: function (path) {
var parts = path.split(/\/+/);
if (!parts[parts.length - 1]) parts = parts.slice(0, -1)
if (!parts[0]) parts = parts.slice(1)
return parts;
}
})
module.exports = Handler
/***/
},
/* 2 */
/***/ function (module, exports) {
/*
## Constant
常量集合。
*/
/*
RE_KEY
'name|min-max': value
'name|count': value
'name|min-max.dmin-dmax': value
'name|min-max.dcount': value
'name|count.dmin-dmax': value
'name|count.dcount': value
'name|+step': value
1 name, 2 step, 3 range [ min, max ], 4 drange [ dmin, dmax ]
RE_PLACEHOLDER
placeholder(*)
[正则查看工具](http://www.regexper.com/)
#26 生成规则 支持 负数,例如 number|-100-100
*/
module.exports = {
GUID: 1,
RE_KEY: /(.+)\|(?:\+(\d+)|([\+\-]?\d+-?[\+\-]?\d*)?(?:\.(\d+-?\d*))?)/,
RE_RANGE: /([\+\-]?\d+)-?([\+\-]?\d+)?/,
RE_PLACEHOLDER: /\\*@([^@#%&()\?\s]+)(?:\((.*?)\))?/g
// /\\*@([^@#%&()\?\s\/\.]+)(?:\((.*?)\))?/g
// RE_INDEX: /^index$/,
// RE_KEY: /^key$/
}
/***/
},
/* 3 */
/***/ function (module, exports) {
/*
## Utilities
*/
var Util = {}
Util.extend = function extend() {
var target = arguments[0] || {},
i = 1,
length = arguments.length,
options, name, src, copy, clone
if (length === 1) {
target = this
i = 0
}
for (; i < length; i++) {
options = arguments[i]
if (!options) continue
for (name in options) {
src = target[name]
copy = options[name]
if (target === copy) continue
if (copy === undefined) continue
if (Util.isArray(copy) || Util.isObject(copy)) {
if (Util.isArray(copy)) clone = src && Util.isArray(src) ? src : []
if (Util.isObject(copy)) clone = src && Util.isObject(src) ? src : {}
target[name] = Util.extend(clone, copy)
} else {
target[name] = copy
}
}
}
return target
}
Util.each = function each(obj, iterator, context) {
var i, key
if (this.type(obj) === 'number') {
for (i = 0; i < obj; i++) {
iterator(i, i)
}
} else if (obj.length === +obj.length) {
for (i = 0; i < obj.length; i++) {
if (iterator.call(context, obj[i], i, obj) === false) break
}
} else {
for (key in obj) {
if (iterator.call(context, obj[key], key, obj) === false) break
}
}
}
Util.type = function type(obj) {
return (obj === null || obj === undefined) ? String(obj) : Object.prototype.toString.call(obj).match(/\[object (\w+)\]/)[1].toLowerCase()
}
Util.each('String Object Array RegExp Function'.split(' '), function (value) {
Util['is' + value] = function (obj) {
return Util.type(obj) === value.toLowerCase()
}
})
Util.isObjectOrArray = function (value) {
return Util.isObject(value) || Util.isArray(value)
}
Util.isNumeric = function (value) {
return !isNaN(parseFloat(value)) && isFinite(value)
}
Util.keys = function (obj) {
var keys = [];
for (var key in obj) {
if (obj.hasOwnProperty(key)) keys.push(key)
}
return keys;
}
Util.values = function (obj) {
var values = [];
for (var key in obj) {
if (obj.hasOwnProperty(key)) values.push(obj[key])
}
return values;
}
/*
### Mock.heredoc(fn)
* Mock.heredoc(fn)
以直观、安全的方式书写(多行)HTML 模板。
**使用示例**如下所示:
var tpl = Mock.heredoc(function() {
/*!
{{email}}{{age}}
<!-- Mock {
email: '@EMAIL',
age: '@INT(1,100)'
} -->
*\/
})
**相关阅读**
* [Creating multiline strings in JavaScript](http://stackoverflow.com/questions/805107/creating-multiline-strings-in-javascript)、
*/
Util.heredoc = function heredoc(fn) {
// 1. 移除起始的 function(){ /*!
// 2. 移除末尾的 */ }
// 3. 移除起始和末尾的空格
return fn.toString()
.replace(/^[^\/]+\/\*!?/, '')
.replace(/\*\/[^\/]+$/, '')
.replace(/^[\s\xA0]+/, '').replace(/[\s\xA0]+$/, '') // .trim()
}
Util.noop = function () { }
module.exports = Util
/***/
},
/* 4 */
/***/ function (module, exports, __webpack_require__) {
/*
## Parser
解析数据模板(属性名部分)。
* Parser.parse( name )
```json
{
parameters: [ name, inc, range, decimal ],
rnage: [ min , max ],
min: min,
max: max,
count : count,
decimal: decimal,
dmin: dmin,
dmax: dmax,
dcount: dcount
}
```
*/
var Constant = __webpack_require__(2)
var Random = __webpack_require__(5)
/* jshint -W041 */
module.exports = {
parse: function (name) {
name = name == undefined ? '' : (name + '')
var parameters = (name || '').match(Constant.RE_KEY)
var range = parameters && parameters[3] && parameters[3].match(Constant.RE_RANGE)
var min = range && range[1] && parseInt(range[1], 10) // || 1
var max = range && range[2] && parseInt(range[2], 10) // || 1
// repeat || min-max || 1
// var count = range ? !range[2] && parseInt(range[1], 10) || Random.integer(min, max) : 1
var count = range ? !range[2] ? parseInt(range[1], 10) : Random.integer(min, max) : undefined
var decimal = parameters && parameters[4] && parameters[4].match(Constant.RE_RANGE)
var dmin = decimal && parseInt(decimal[1], 10) // || 0,
var dmax = decimal && parseInt(decimal[2], 10) // || 0,
// int || dmin-dmax || 0
var dcount = decimal ? !decimal[2] && parseInt(decimal[1], 10) || Random.integer(dmin, dmax) : undefined
var result = {
// 1 name, 2 inc, 3 range, 4 decimal
parameters: parameters,
// 1 min, 2 max
range: range,
min: min,
max: max,
// min-max
count: count,
// 是否有 decimal
decimal: decimal,
dmin: dmin,
dmax: dmax,
// dmin-dimax
dcount: dcount
}
for (var r in result) {
if (result[r] != undefined) return result
}
return {}
}
}
/***/
},
/* 5 */
/***/ function (module, exports, __webpack_require__) {
/*
## Mock.Random
工具类,用于生成各种随机数据。
*/
var Util = __webpack_require__(3)
var Random = {
extend: Util.extend
}
Random.extend(__webpack_require__(6))
Random.extend(__webpack_require__(7))
Random.extend(__webpack_require__(8))
Random.extend(__webpack_require__(10))
Random.extend(__webpack_require__(13))
Random.extend(__webpack_require__(15))
Random.extend(__webpack_require__(16))
Random.extend(__webpack_require__(17))
Random.extend(__webpack_require__(14))
Random.extend(__webpack_require__(19))
module.exports = Random
/***/
},
/* 6 */
/***/ function (module, exports) {
/*
## Basics
*/
module.exports = {
// 返回一个随机的布尔值。
boolean: function (min, max, cur) {
if (cur !== undefined) {
min = typeof min !== 'undefined' && !isNaN(min) ? parseInt(min, 10) : 1
max = typeof max !== 'undefined' && !isNaN(max) ? parseInt(max, 10) : 1
return Math.random() > 1.0 / (min + max) * min ? !cur : cur
}
return Math.random() >= 0.5
},
bool: function (min, max, cur) {
return this.boolean(min, max, cur)
},
// 返回一个随机的自然数(大于等于 0 的整数)。
natural: function (min, max) {
min = typeof min !== 'undefined' ? parseInt(min, 10) : 0
max = typeof max !== 'undefined' ? parseInt(max, 10) : 9007199254740992 // 2^53
return Math.round(Math.random() * (max - min)) + min
},
// 返回一个随机的整数。
integer: function (min, max) {
min = typeof min !== 'undefined' ? parseInt(min, 10) : -9007199254740992
max = typeof max !== 'undefined' ? parseInt(max, 10) : 9007199254740992 // 2^53
return Math.round(Math.random() * (max - min)) + min
},
int: function (min, max) {
return this.integer(min, max)
},
// 返回一个随机的浮点数。
float: function (min, max, dmin, dmax) {
dmin = dmin === undefined ? 0 : dmin
dmin = Math.max(Math.min(dmin, 17), 0)
dmax = dmax === undefined ? 17 : dmax
dmax = Math.max(Math.min(dmax, 17), 0)
var ret = this.integer(min, max) + '.';
for (var i = 0, dcount = this.natural(dmin, dmax); i < dcount; i++) {
ret += (
// 最后一位不能为 0:如果最后一位为 0,会被 JS 引擎忽略掉。
(i < dcount - 1) ? this.character('number') : this.character('123456789')
)
}
return parseFloat(ret, 10)
},
// 返回一个随机字符。
character: function (pool) {
var pools = {
lower: 'abcdefghijklmnopqrstuvwxyz',
upper: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
number: '0123456789',
symbol: '!@#$%^&*()[]'
}
pools.alpha = pools.lower + pools.upper
pools['undefined'] = pools.lower + pools.upper + pools.number + pools.symbol
pool = pools[('' + pool).toLowerCase()] || pool
return pool.charAt(this.natural(0, pool.length - 1))
},
char: function (pool) {
return this.character(pool)
},
// 返回一个随机字符串。
string: function (pool, min, max) {
var len
switch (arguments.length) {
case 0: // ()
len = this.natural(3, 7)
break
case 1: // ( length )
len = pool
pool = undefined
break
case 2:
// ( pool, length )
if (typeof arguments[0] === 'string') {
len = min
} else {
// ( min, max )
len = this.natural(pool, min)
pool = undefined
}
break
case 3:
len = this.natural(min, max)
break
}
var text = ''
for (var i = 0; i < len; i++) {
text += this.character(pool)
}
return text
},
str: function ( /*pool, min, max*/) {
return this.string.apply(this, arguments)
},
// 返回一个整型数组。
range: function (start, stop, step) {
// range( stop )
if (arguments.length <= 1) {
stop = start || 0;
start = 0;
}
// range( start, stop )
step = arguments[2] || 1;
start = +start
stop = +stop
step = +step
var len = Math.max(Math.ceil((stop - start) / step), 0);
var idx = 0;
var range = new Array(len);
while (idx < len) {
range[idx++] = start;
start += step;
}
return range;
}
}
/***/
},
/* 7 */
/***/ function (module, exports) {
/*
## Date
*/
var patternLetters = {
yyyy: 'getFullYear',
yy: function (date) {
return ('' + date.getFullYear()).slice(2)
},
y: 'yy',
MM: function (date) {
var m = date.getMonth() + 1
return m < 10 ? '0' + m : m
},
M: function (date) {
return date.getMonth() + 1
},
dd: function (date) {
var d = date.getDate()
return d < 10 ? '0' + d : d
},
d: 'getDate',
HH: function (date) {
var h = date.getHours()
return h < 10 ? '0' + h : h
},
H: 'getHours',
hh: function (date) {
var h = date.getHours() % 12
return h < 10 ? '0' + h : h
},
h: function (date) {
return date.getHours() % 12
},
mm: function (date) {
var m = date.getMinutes()
return m < 10 ? '0' + m : m
},
m: 'getMinutes',
ss: function (date) {
var s = date.getSeconds()
return s < 10 ? '0' + s : s
},
s: 'getSeconds',
SS: function (date) {
var ms = date.getMilliseconds()
return ms < 10 && '00' + ms || ms < 100 && '0' + ms || ms
},
S: 'getMilliseconds',
A: function (date) {
return date.getHours() < 12 ? 'AM' : 'PM'
},
a: function (date) {
return date.getHours() < 12 ? 'am' : 'pm'
},
T: 'getTime'
}
module.exports = {
// 日期占位符集合。
_patternLetters: patternLetters,
// 日期占位符正则。
_rformat: new RegExp((function () {
var re = []
for (var i in patternLetters) re.push(i)
return '(' + re.join('|') + ')'
})(), 'g'),
// 格式化日期。
_formatDate: function (date, format) {
return format.replace(this._rformat, function creatNewSubString($0, flag) {
return typeof patternLetters[flag] === 'function' ? patternLetters[flag](date) :
patternLetters[flag] in patternLetters ? creatNewSubString($0, patternLetters[flag]) :
date[patternLetters[flag]]()
})
},
// 生成一个随机的 Date 对象。
_randomDate: function (min, max) { // min, max
min = min === undefined ? new Date(0) : min
max = max === undefined ? new Date() : max
return new Date(Math.random() * (max.getTime() - min.getTime()))
},
// 返回一个随机的日期字符串。
date: function (format) {
format = format || 'yyyy-MM-dd'
return this._formatDate(this._randomDate(), format)
},
// 返回一个随机的时间字符串。
time: function (format) {
format = format || 'HH:mm:ss'
return this._formatDate(this._randomDate(), format)
},
// 返回一个随机的日期和时间字符串。
datetime: function (format) {
format = format || 'yyyy-MM-dd HH:mm:ss'
return this._formatDate(this._randomDate(), format)
},
// 返回当前的日期和时间字符串。
now: function (unit, format) {
// now(unit) now(format)
if (arguments.length === 1) {
// now(format)
if (!/year|month|day|hour|minute|second|week/.test(unit)) {
format = unit
unit = ''
}
}
unit = (unit || '').toLowerCase()
format = format || 'yyyy-MM-dd HH:mm:ss'
var date = new Date()
/* jshint -W086 */
// 参考自 http://momentjs.cn/docs/#/manipulating/start-of/
switch (unit) {
case 'year':
date.setMonth(0)
case 'month':
date.setDate(1)
case 'week':
case 'day':
date.setHours(0)
case 'hour':
date.setMinutes(0)
case 'minute':
date.setSeconds(0)
case 'second':
date.setMilliseconds(0)
}
switch (unit) {
case 'week':
date.setDate(date.getDate() - date.getDay())
}
return this._formatDate(date, format)
}
}
/***/
},
/* 8 */
/***/ function (module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function (module) {/* global document */
/*
## Image
*/
module.exports = {
// 常见的广告宽高
_adSize: [
'300x250', '250x250', '240x400', '336x280', '180x150',
'720x300', '468x60', '234x60', '88x31', '120x90',
'120x60', '120x240', '125x125', '728x90', '160x600',
'120x600', '300x600'
],
// 常见的屏幕宽高
_screenSize: [
'320x200', '320x240', '640x480', '800x480', '800x480',
'1024x600', '1024x768', '1280x800', '1440x900', '1920x1200',
'2560x1600'
],
// 常见的视频宽高
_videoSize: ['720x480', '768x576', '1280x720', '1920x1080'],
/*
生成一个随机的图片地址。
替代图片源
http://fpoimg.com/
参考自
http://rensanning.iteye.com/blog/1933310
http://code.tutsplus.com/articles/the-top-8-placeholders-for-web-designers--net-19485
*/
image: function (size, background, foreground, format, text) {
// Random.image( size, background, foreground, text )
if (arguments.length === 4) {
text = format
format = undefined
}
// Random.image( size, background, text )
if (arguments.length === 3) {
text = foreground
foreground = undefined
}
// Random.image()
if (!size) size = this.pick(this._adSize)
if (background && ~background.indexOf('#')) background = background.slice(1)
if (foreground && ~foreground.indexOf('#')) foreground = foreground.slice(1)
// http://dummyimage.com/600x400/cc00cc/470047.png&text=hello
return 'http://dummyimage.com/' + size +
(background ? '/' + background : '') +
(foreground ? '/' + foreground : '') +
(format ? '.' + format : '') +
(text ? '&text=' + text : '')
},
img: function () {
return this.image.apply(this, arguments)
},
/*
BrandColors
http://brandcolors.net/
A collection of major brand color codes curated by Galen Gidman.
大牌公司的颜色集合
// 获取品牌和颜色
$('h2').each(function(index, item){
item = $(item)
console.log('\'' + item.text() + '\'', ':', '\'' + item.next().text() + '\'', ',')
})
*/
_brandColors: {
'4ormat': '#fb0a2a',
'500px': '#02adea',
'About.me (blue)': '#00405d',
'About.me (yellow)': '#ffcc33',
'Addvocate': '#ff6138',
'Adobe': '#ff0000',
'Aim': '#fcd20b',
'Amazon': '#e47911',
'Android': '#a4c639',
'Angie\'s List': '#7fbb00',
'AOL': '#0060a3',
'Atlassian': '#003366',
'Behance': '#053eff',
'Big Cartel': '#97b538',
'bitly': '#ee6123',
'Blogger': '#fc4f08',
'Boeing': '#0039a6',
'Booking.com': '#003580',
'Carbonmade': '#613854',
'Cheddar': '#ff7243',
'Code School': '#3d4944',
'Delicious': '#205cc0',
'Dell': '#3287c1',
'Designmoo': '#e54a4f',
'Deviantart': '#4e6252',
'Designer News': '#2d72da',
'Devour': '#fd0001',
'DEWALT': '#febd17',
'Disqus (blue)': '#59a3fc',
'Disqus (orange)': '#db7132',
'Dribbble': '#ea4c89',
'Dropbox': '#3d9ae8',
'Drupal': '#0c76ab',
'Dunked': '#2a323a',
'eBay': '#89c507',
'Ember': '#f05e1b',
'Engadget': '#00bdf6',
'Envato': '#528036',
'Etsy': '#eb6d20',
'Evernote': '#5ba525',
'Fab.com': '#dd0017',
'Facebook': '#3b5998',
'Firefox': '#e66000',
'Flickr (blue)': '#0063dc',
'Flickr (pink)': '#ff0084',
'Forrst': '#5b9a68',
'Foursquare': '#25a0ca',
'Garmin': '#007cc3',
'GetGlue': '#2d75a2',
'Gimmebar': '#f70078',
'GitHub': '#171515',
'Google Blue': '#0140ca',
'Google Green': '#16a61e',
'Google Red': '#dd1812',
'Google Yellow': '#fcca03',
'Google+': '#dd4b39',
'Grooveshark': '#f77f00',
'Groupon': '#82b548',
'Hacker News': '#ff6600',
'HelloWallet': '#0085ca',
'Heroku (light)': '#c7c5e6',
'Heroku (dark)': '#6567a5',
'HootSuite': '#003366',
'Houzz': '#73ba37',
'HTML5': '#ec6231',
'IKEA': '#ffcc33',
'IMDb': '#f3ce13',
'Instagram': '#3f729b',
'Intel': '#0071c5',
'Intuit': '#365ebf',
'Kickstarter': '#76cc1e',
'kippt': '#e03500',
'Kodery': '#00af81',
'LastFM': '#c3000d',
'LinkedIn': '#0e76a8',
'Livestream': '#cf0005',
'Lumo': '#576396',
'Mixpanel': '#a086d3',
'Meetup': '#e51937',
'Nokia': '#183693',
'NVIDIA': '#76b900',
'Opera': '#cc0f16',
'Path': '#e41f11',
'PayPal (dark)': '#1e477a',
'PayPal (light)': '#3b7bbf',
'Pinboard': '#0000e6',
'Pinterest': '#c8232c',
'PlayStation': '#665cbe',
'Pocket': '#ee4056',
'Prezi': '#318bff',
'Pusha': '#0f71b4',
'Quora': '#a82400',
'QUOTE.fm': '#66ceff',
'Rdio': '#008fd5',
'Readability': '#9c0000',
'Red Hat': '#cc0000',
'Resource': '#7eb400',
'Rockpack': '#0ba6ab',
'Roon': '#62b0d9',
'RSS': '#ee802f',
'Salesforce': '#1798c1',
'Samsung': '#0c4da2',
'Shopify': '#96bf48',
'Skype': '#00aff0',
'Snagajob': '#f47a20',
'Softonic': '#008ace',
'SoundCloud': '#ff7700',
'Space Box': '#f86960',
'Spotify': '#81b71a',
'Sprint': '#fee100',
'Squarespace': '#121212',
'StackOverflow': '#ef8236',
'Staples': '#cc0000',
'Status Chart': '#d7584f',
'Stripe': '#008cdd',
'StudyBlue': '#00afe1',
'StumbleUpon': '#f74425',
'T-Mobile': '#ea0a8e',
'Technorati': '#40a800',
'The Next Web': '#ef4423',
'Treehouse': '#5cb868',
'Trulia': '#5eab1f',
'Tumblr': '#34526f',
'Twitch.tv': '#6441a5',
'Twitter': '#00acee',
'TYPO3': '#ff8700',
'Ubuntu': '#dd4814',
'Ustream': '#3388ff',
'Verizon': '#ef1d1d',
'Vimeo': '#86c9ef',
'Vine': '#00a478',
'Virb': '#06afd8',
'Virgin Media': '#cc0000',
'Wooga': '#5b009c',
'WordPress (blue)': '#21759b',
'WordPress (orange)': '#d54e21',
'WordPress (grey)': '#464646',
'Wunderlist': '#2b88d9',
'XBOX': '#9bc848',
'XING': '#126567',
'Yahoo!': '#720e9e',
'Yandex': '#ffcc00',
'Yelp': '#c41200',
'YouTube': '#c4302b',
'Zalongo': '#5498dc',
'Zendesk': '#78a300',
'Zerply': '#9dcc7a',
'Zootool': '#5e8b1d'
},
_brandNames: function () {
var brands = [];
for (var b in this._brandColors) {
brands.push(b)
}
return brands
},
/*
生成一段随机的 Base64 图片编码。
https://github.com/imsky/holder
Holder renders image placeholders entirely on the client side.
dataImageHolder: function(size) {
return 'holder.js/' + size
},
*/
dataImage: function (size, text) {
var canvas
if (typeof document !== 'undefined') {
canvas = document.createElement('canvas')
} else {
/*
https://github.com/Automattic/node-canvas
npm install canvas --save
安装问题:
* http://stackoverflow.com/questions/22953206/gulp-issues-with-cario-install-command-not-found-when-trying-to-installing-canva
* https://github.com/Automattic/node-canvas/issues/415
* https://github.com/Automattic/node-canvas/wiki/_pages
PS:node-canvas 的安装过程实在是太繁琐了,所以不放入 package.json 的 dependencies。
*/
var Canvas = module.require('canvas')
canvas = new Canvas()
}
var ctx = canvas && canvas.getContext && canvas.getContext("2d")
if (!canvas || !ctx) return ''
if (!size) size = this.pick(this._adSize)
text = text !== undefined ? text : size
size = size.split('x')
var width = parseInt(size[0], 10),
height = parseInt(size[1], 10),
background = this._brandColors[this.pick(this._brandNames())],
foreground = '#FFF',
text_height = 14,
font = 'sans-serif';
canvas.width = width
canvas.height = height
ctx.textAlign = 'center'
ctx.textBaseline = 'middle'
ctx.fillStyle = background
ctx.fillRect(0, 0, width, height)
ctx.fillStyle = foreground
ctx.font = 'bold ' + text_height + 'px ' + font
ctx.fillText(text, (width / 2), (height / 2), width)
return canvas.toDataURL('image/png')
}
}
/* WEBPACK VAR INJECTION */
}.call(exports, __webpack_require__(9)(module)))
/***/
},
/* 9 */
/***/ function (module, exports) {
module.exports = function (module) {
if (!module.webpackPolyfill) {
module.deprecate = function () { };
module.paths = [];
// module.parent = undefined by default
module.children = [];
module.webpackPolyfill = 1;
}
return module;
}
/***/
},
/* 10 */
/***/ function (module, exports, __webpack_require__) {
/*
## Color
http://llllll.li/randomColor/
A color generator for JavaScript.
randomColor generates attractive colors by default. More specifically, randomColor produces bright colors with a reasonably high saturation. This makes randomColor particularly useful for data visualizations and generative art.
http://randomcolour.com/
var bg_colour = Math.floor(Math.random() * 16777215).toString(16);
bg_colour = "#" + ("000000" + bg_colour).slice(-6);
document.bgColor = bg_colour;
http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/
Creating random colors is actually more difficult than it seems. The randomness itself is easy, but aesthetically pleasing randomness is more difficult.
https://github.com/devongovett/color-generator
http://www.paulirish.com/2009/random-hex-color-code-snippets/
Random Hex Color Code Generator in JavaScript
http://chancejs.com/#color
chance.color()
// => '#79c157'
chance.color({format: 'hex'})
// => '#d67118'
chance.color({format: 'shorthex'})
// => '#60f'
chance.color({format: 'rgb'})
// => 'rgb(110,52,164)'
http://tool.c7sky.com/webcolor
网页设计常用色彩搭配表
https://github.com/One-com/one-color
An OO-based JavaScript color parser/computation toolkit with support for RGB, HSV, HSL, CMYK, and alpha channels.
API 很赞
https://github.com/harthur/color
JavaScript color conversion and manipulation library
https://github.com/leaverou/css-colors
Share & convert CSS colors
http://leaverou.github.io/css-colors/#slategray
Type a CSS color keyword, #hex, hsl(), rgba(), whatever:
色调 hue
http://baike.baidu.com/view/23368.htm
色调指的是一幅画中画面色彩的总体倾向,是大的色彩效果。
饱和度 saturation
http://baike.baidu.com/view/189644.htm
饱和度是指色彩的鲜艳程度,也称色彩的纯度。饱和度取决于该色中含色成分和消色成分(灰色)的比例。含色成分越大,饱和度越大;消色成分越大,饱和度越小。
亮度 brightness
http://baike.baidu.com/view/34773.htm
亮度是指发光体(反光体)表面发光(反光)强弱的物理量。
照度 luminosity
物体被照亮的程度,采用单位面积所接受的光通量来表示,表示单位为勒[克斯](Lux,lx) ,即 1m / m2 。
http://stackoverflow.com/questions/1484506/random-color-generator-in-javascript
var letters = '0123456789ABCDEF'.split('')
var color = '#'
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)]
}
return color
// 随机生成一个无脑的颜色,格式为 '#RRGGBB'。
// _brainlessColor()
var color = Math.floor(
Math.random() *
(16 * 16 * 16 * 16 * 16 * 16 - 1)
).toString(16)
color = "#" + ("000000" + color).slice(-6)
return color.toUpperCase()
*/
var Convert = __webpack_require__(11)
var DICT = __webpack_require__(12)
module.exports = {
// 随机生成一个有吸引力的颜色,格式为 '#RRGGBB'。
color: function (name) {
if (name || DICT[name]) return DICT[name].nicer
return this.hex()
},
// #DAC0DE
hex: function () {
var hsv = this._goldenRatioColor()
var rgb = Convert.hsv2rgb(hsv)
var hex = Convert.rgb2hex(rgb[0], rgb[1], rgb[2])
return hex
},
// rgb(128,255,255)
rgb: function () {
var hsv = this._goldenRatioColor()
var rgb = Convert.hsv2rgb(hsv)
return 'rgb(' +
parseInt(rgb[0], 10) + ', ' +
parseInt(rgb[1], 10) + ', ' +
parseInt(rgb[2], 10) + ')'
},
// rgba(128,255,255,0.3)
rgba: function () {
var hsv = this._goldenRatioColor()
var rgb = Convert.hsv2rgb(hsv)
return 'rgba(' +
parseInt(rgb[0], 10) + ', ' +
parseInt(rgb[1], 10) + ', ' +
parseInt(rgb[2], 10) + ', ' +
Math.random().toFixed(2) + ')'
},
// hsl(300,80%,90%)
hsl: function () {
var hsv = this._goldenRatioColor()
var hsl = Convert.hsv2hsl(hsv)
return 'hsl(' +
parseInt(hsl[0], 10) + ', ' +
parseInt(hsl[1], 10) + ', ' +
parseInt(hsl[2], 10) + ')'
},
// http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/
// https://github.com/devongovett/color-generator/blob/master/index.js
// 随机生成一个有吸引力的颜色。
_goldenRatioColor: function (saturation, value) {
this._goldenRatio = 0.618033988749895
this._hue = this._hue || Math.random()
this._hue += this._goldenRatio
this._hue %= 1
if (typeof saturation !== "number") saturation = 0.5;
if (typeof value !== "number") value = 0.95;
return [
this._hue * 360,
saturation * 100,
value * 100
]
}
}
/***/
},
/* 11 */
/***/ function (module, exports) {
/*
## Color Convert
http://blog.csdn.net/idfaya/article/details/6770414
颜色空间RGB与HSV(HSL)的转换
*/
// https://github.com/harthur/color-convert/blob/master/conversions.js
module.exports = {
rgb2hsl: function rgb2hsl(rgb) {
var r = rgb[0] / 255,
g = rgb[1] / 255,
b = rgb[2] / 255,
min = Math.min(r, g, b),
max = Math.max(r, g, b),
delta = max - min,
h, s, l;
if (max == min)
h = 0;
else if (r == max)
h = (g - b) / delta;
else if (g == max)
h = 2 + (b - r) / delta;
else if (b == max)
h = 4 + (r - g) / delta;
h = Math.min(h * 60, 360);
if (h < 0)
h += 360;
l = (min + max) / 2;
if (max == min)
s = 0;
else if (l <= 0.5)
s = delta / (max + min);
else
s = delta / (2 - max - min);
return [h, s * 100, l * 100];
},
rgb2hsv: function rgb2hsv(rgb) {
var r = rgb[0],
g = rgb[1],
b = rgb[2],
min = Math.min(r, g, b),
max = Math.max(r, g, b),
delta = max - min,
h, s, v;
if (max === 0)
s = 0;
else
s = (delta / max * 1000) / 10;
if (max == min)
h = 0;
else if (r == max)
h = (g - b) / delta;
else if (g == max)
h = 2 + (b - r) / delta;
else if (b == max)
h = 4 + (r - g) / delta;
h = Math.min(h * 60, 360);
if (h < 0)
h += 360;
v = ((max / 255) * 1000) / 10;
return [h, s, v];
},
hsl2rgb: function hsl2rgb(hsl) {
var h = hsl[0] / 360,
s = hsl[1] / 100,
l = hsl[2] / 100,
t1, t2, t3, rgb, val;
if (s === 0) {
val = l * 255;
return [val, val, val];
}
if (l < 0.5)
t2 = l * (1 + s);
else
t2 = l + s - l * s;
t1 = 2 * l - t2;
rgb = [0, 0, 0];
for (var i = 0; i < 3; i++) {
t3 = h + 1 / 3 * -(i - 1);
if (t3 < 0) t3++;
if (t3 > 1) t3--;
if (6 * t3 < 1)
val = t1 + (t2 - t1) * 6 * t3;
else if (2 * t3 < 1)
val = t2;
else if (3 * t3 < 2)
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
else
val = t1;
rgb[i] = val * 255;
}
return rgb;
},
hsl2hsv: function hsl2hsv(hsl) {
var h = hsl[0],
s = hsl[1] / 100,
l = hsl[2] / 100,
sv, v;
l *= 2;
s *= (l <= 1) ? l : 2 - l;
v = (l + s) / 2;
sv = (2 * s) / (l + s);
return [h, sv * 100, v * 100];
},
hsv2rgb: function hsv2rgb(hsv) {
var h = hsv[0] / 60
var s = hsv[1] / 100
var v = hsv[2] / 100
var hi = Math.floor(h) % 6
var f = h - Math.floor(h)
var p = 255 * v * (1 - s)
var q = 255 * v * (1 - (s * f))
var t = 255 * v * (1 - (s * (1 - f)))
v = 255 * v
switch (hi) {
case 0:
return [v, t, p]
case 1:
return [q, v, p]
case 2:
return [p, v, t]
case 3:
return [p, q, v]
case 4:
return [t, p, v]
case 5:
return [v, p, q]
}
},
hsv2hsl: function hsv2hsl(hsv) {
var h = hsv[0],
s = hsv[1] / 100,
v = hsv[2] / 100,
sl, l;
l = (2 - s) * v;
sl = s * v;
sl /= (l <= 1) ? l : 2 - l;
l /= 2;
return [h, sl * 100, l * 100];
},
// http://www.140byt.es/keywords/color
rgb2hex: function (
a, // red, as a number from 0 to 255
b, // green, as a number from 0 to 255
c // blue, as a number from 0 to 255
) {
return "#" + ((256 + a << 8 | b) << 8 | c).toString(16).slice(1)
},
hex2rgb: function (
a // take a "#xxxxxx" hex string,
) {
a = '0x' + a.slice(1).replace(a.length > 4 ? a : /./g, '$&$&') | 0;
return [a >> 16, a >> 8 & 255, a & 255]
}
}
/***/
},
/* 12 */
/***/ function (module, exports) {
/*
## Color 字典数据
字典数据来源 [A nicer color palette for the web](http://clrs.cc/)
*/
module.exports = {
// name value nicer
navy: {
value: '#000080',
nicer: '#001F3F'
},
blue: {
value: '#0000ff',
nicer: '#0074D9'
},
aqua: {
value: '#00ffff',
nicer: '#7FDBFF'
},
teal: {
value: '#008080',
nicer: '#39CCCC'
},
olive: {
value: '#008000',
nicer: '#3D9970'
},
green: {
value: '#008000',
nicer: '#2ECC40'
},
lime: {
value: '#00ff00',
nicer: '#01FF70'
},
yellow: {
value: '#ffff00',
nicer: '#FFDC00'
},
orange: {
value: '#ffa500',
nicer: '#FF851B'
},
red: {
value: '#ff0000',
nicer: '#FF4136'
},
maroon: {
value: '#800000',
nicer: '#85144B'
},
fuchsia: {
value: '#ff00ff',
nicer: '#F012BE'
},
purple: {
value: '#800080',
nicer: '#B10DC9'
},
silver: {
value: '#c0c0c0',
nicer: '#DDDDDD'
},
gray: {
value: '#808080',
nicer: '#AAAAAA'
},
black: {
value: '#000000',
nicer: '#111111'
},
white: {
value: '#FFFFFF',
nicer: '#FFFFFF'
}
}
/***/
},
/* 13 */
/***/ function (module, exports, __webpack_require__) {
/*
## Text
http://www.lipsum.com/
*/
var Basic = __webpack_require__(6)
var Helper = __webpack_require__(14)
function range(defaultMin, defaultMax, min, max) {
return min === undefined ? Basic.natural(defaultMin, defaultMax) : // ()
max === undefined ? min : // ( len )
Basic.natural(parseInt(min, 10), parseInt(max, 10)) // ( min, max )
}
module.exports = {
// 随机生成一段文本。
paragraph: function (min, max) {
var len = range(3, 7, min, max)
var result = []
for (var i = 0; i < len; i++) {
result.push(this.sentence())
}
return result.join(' ')
},
//
cparagraph: function (min, max) {
var len = range(3, 7, min, max)
var result = []
for (var i = 0; i < len; i++) {
result.push(this.csentence())
}
return result.join('')
},
// 随机生成一个句子,第一个单词的首字母大写。
sentence: function (min, max) {
var len = range(12, 18, min, max)
var result = []
for (var i = 0; i < len; i++) {
result.push(this.word())
}
return Helper.capitalize(result.join(' ')) + '.'
},
// 随机生成一个中文句子。
csentence: function (min, max) {
var len = range(12, 18, min, max)
var result = []
for (var i = 0; i < len; i++) {
result.push(this.cword())
}
return result.join('') + '。'
},
// 随机生成一个单词。
word: function (min, max) {
var len = range(3, 10, min, max)
var result = '';
for (var i = 0; i < len; i++) {
result += Basic.character('lower')
}
return result
},
// 随机生成一个或多个汉字。
cword: function (pool, min, max) {
// 最常用的 500 个汉字 http://baike.baidu.com/view/568436.htm
var DICT_KANZI = '的一是在不了有和人这中大为上个国我以要他时来用们生到作地于出就分对成会可主发年动同工也能下过子说产种面而方后多定行学法所民得经十三之进着等部度家电力里如水化高自二理起小物现实加量都两体制机当使点从业本去把性好应开它合还因由其些然前外天政四日那社义事平形相全表间样与关各重新线内数正心反你明看原又么利比或但质气第向道命此变条只没结解问意建月公无系军很情者最立代想已通并提直题党程展五果料象员革位入常文总次品式活设及管特件长求老头基资边流路级少图山统接知较将组见计别她手角期根论运农指几九区强放决西被干做必战先回则任取据处队南给色光门即保治北造百规热领七海口东导器压志世金增争济阶油思术极交受联什认六共权收证改清己美再采转更单风切打白教速花带安场身车例真务具万每目至达走积示议声报斗完类八离华名确才科张信马节话米整空元况今集温传土许步群广石记需段研界拉林律叫且究观越织装影算低持音众书布复容儿须际商非验连断深难近矿千周委素技备半办青省列习响约支般史感劳便团往酸历市克何除消构府称太准精值号率族维划选标写存候毛亲快效斯院查江型眼王按格养易置派层片始却专状育厂京识适属圆包火住调满县局照参红细引听该铁价严龙飞'
var len
switch (arguments.length) {
case 0: // ()
pool = DICT_KANZI
len = 1
break
case 1: // ( pool )
if (typeof arguments[0] === 'string') {
len = 1
} else {
// ( length )
len = pool
pool = DICT_KANZI
}
break
case 2:
// ( pool, length )
if (typeof arguments[0] === 'string') {
len = min
} else {
// ( min, max )
len = this.natural(pool, min)
pool = DICT_KANZI
}
break
case 3:
len = this.natural(min, max)
break
}
var result = ''
for (var i = 0; i < len; i++) {
result += pool.charAt(this.natural(0, pool.length - 1))
}
return result
},
// 随机生成一句标题,其中每个单词的首字母大写。
title: function (min, max) {
var len = range(3, 7, min, max)
var result = []
for (var i = 0; i < len; i++) {
result.push(this.capitalize(this.word()))
}
return result.join(' ')
},
// 随机生成一句中文标题。
ctitle: function (min, max) {
var len = range(3, 7, min, max)
var result = []
for (var i = 0; i < len; i++) {
result.push(this.cword())
}
return result.join('')
}
}
/***/
},
/* 14 */
/***/ function (module, exports, __webpack_require__) {
/*
## Helpers
*/
var Util = __webpack_require__(3)
module.exports = {
// 把字符串的第一个字母转换为大写。
capitalize: function (word) {
return (word + '').charAt(0).toUpperCase() + (word + '').substr(1)
},
// 把字符串转换为大写。
upper: function (str) {
return (str + '').toUpperCase()
},
// 把字符串转换为小写。
lower: function (str) {
return (str + '').toLowerCase()
},
// 从数组中随机选取一个元素,并返回。
pick: function pick(arr, min, max) {
// pick( item1, item2 ... )
if (!Util.isArray(arr)) {
arr = [].slice.call(arguments)
min = 1
max = 1
} else {
// pick( [ item1, item2 ... ] )
if (min === undefined) min = 1
// pick( [ item1, item2 ... ], count )
if (max === undefined) max = min
}
if (min === 1 && max === 1) return arr[this.natural(0, arr.length - 1)]
// pick( [ item1, item2 ... ], min, max )
return this.shuffle(arr, min, max)
// 通过参数个数判断方法签名,扩展性太差!#90
// switch (arguments.length) {
// case 1:
// // pick( [ item1, item2 ... ] )
// return arr[this.natural(0, arr.length - 1)]
// case 2:
// // pick( [ item1, item2 ... ], count )
// max = min
// /* falls through */
// case 3:
// // pick( [ item1, item2 ... ], min, max )
// return this.shuffle(arr, min, max)
// }
},
/*
打乱数组中元素的顺序,并返回。
Given an array, scramble the order and return it.
其他的实现思路:
// https://code.google.com/p/jslibs/wiki/JavascriptTips
result = result.sort(function() {
return Math.random() - 0.5
})
*/
shuffle: function shuffle(arr, min, max) {
arr = arr || []
var old = arr.slice(0),
result = [],
index = 0,
length = old.length;
for (var i = 0; i < length; i++) {
index = this.natural(0, old.length - 1)
result.push(old[index])
old.splice(index, 1)
}
switch (arguments.length) {
case 0:
case 1:
return result
case 2:
max = min
/* falls through */
case 3:
min = parseInt(min, 10)
max = parseInt(max, 10)
return result.slice(0, this.natural(min, max))
}
},
/*
* Random.order(item, item)
* Random.order([item, item ...])
顺序获取数组中的元素
[JSON导入数组支持数组数据录入](https://github.com/thx/RAP/issues/22)
不支持单独调用!
*/
order: function order(array) {
order.cache = order.cache || {}
if (arguments.length > 1) array = [].slice.call(arguments, 0)
// options.context.path/templatePath
var options = order.options
var templatePath = options.context.templatePath.join('.')
var cache = (
order.cache[templatePath] = order.cache[templatePath] || {
index: 0,
array: array
}
)
return cache.array[cache.index++ % cache.array.length]
}
}
/***/
},
/* 15 */
/***/ function (module, exports) {
/*
## Name
[Beyond the Top 1000 Names](http://www.ssa.gov/oact/babynames/limits.html)
*/
module.exports = {
// 随机生成一个常见的英文名。
first: function () {
var names = [
// male
"James", "John", "Robert", "Michael", "William",
"David", "Richard", "Charles", "Joseph", "Thomas",
"Christopher", "Daniel", "Paul", "Mark", "Donald",
"George", "Kenneth", "Steven", "Edward", "Brian",
"Ronald", "Anthony", "Kevin", "Jason", "Matthew",
"Gary", "Timothy", "Jose", "Larry", "Jeffrey",
"Frank", "Scott", "Eric"
].concat([
// female
"Mary", "Patricia", "Linda", "Barbara", "Elizabeth",
"Jennifer", "Maria", "Susan", "Margaret", "Dorothy",
"Lisa", "Nancy", "Karen", "Betty", "Helen",
"Sandra", "Donna", "Carol", "Ruth", "Sharon",
"Michelle", "Laura", "Sarah", "Kimberly", "Deborah",
"Jessica", "Shirley", "Cynthia", "Angela", "Melissa",
"Brenda", "Amy", "Anna"
])
return this.pick(names)
// or this.capitalize(this.word())
},
// 随机生成一个常见的英文姓。
last: function () {
var names = [
"Smith", "Johnson", "Williams", "Brown", "Jones",
"Miller", "Davis", "Garcia", "Rodriguez", "Wilson",
"Martinez", "Anderson", "Taylor", "Thomas", "Hernandez",
"Moore", "Martin", "Jackson", "Thompson", "White",
"Lopez", "Lee", "Gonzalez", "Harris", "Clark",
"Lewis", "Robinson", "Walker", "Perez", "Hall",
"Young", "Allen"
]
return this.pick(names)
// or this.capitalize(this.word())
},
// 随机生成一个常见的英文姓名。
name: function (middle) {
return this.first() + ' ' +
(middle ? this.first() + ' ' : '') +
this.last()
},
/*
随机生成一个常见的中文姓。
[世界常用姓氏排行](http://baike.baidu.com/view/1719115.htm)
[玄派网 - 网络小说创作辅助平台](http://xuanpai.sinaapp.com/)
*/
cfirst: function () {
var names = (
'王 李 张 刘 陈 杨 赵 黄 周 吴 ' +
'徐 孙 胡 朱 高 林 何 郭 马 罗 ' +
'梁 宋 郑 谢 韩 唐 冯 于 董 萧 ' +
'程 曹 袁 邓 许 傅 沈 曾 彭 吕 ' +
'苏 卢 蒋 蔡 贾 丁 魏 薛 叶 阎 ' +
'余 潘 杜 戴 夏 锺 汪 田 任 姜 ' +
'范 方 石 姚 谭 廖 邹 熊 金 陆 ' +
'郝 孔 白 崔 康 毛 邱 秦 江 史 ' +
'顾 侯 邵 孟 龙 万 段 雷 钱 汤 ' +
'尹 黎 易 常 武 乔 贺 赖 龚 文'
).split(' ')
return this.pick(names)
},
/*
随机生成一个常见的中文名。
[中国最常见名字前50名_三九算命网](http://www.name999.net/xingming/xingshi/20131004/48.html)
*/
clast: function () {
var names = (
'伟 芳 娜 秀英 敏 静 丽 强 磊 军 ' +
'洋 勇 艳 杰 娟 涛 明 超 秀兰 霞 ' +
'平 刚 桂英'
).split(' ')
return this.pick(names)
},
// 随机生成一个常见的中文姓名。
cname: function () {
return this.cfirst() + this.clast()
}
}
/***/
},
/* 16 */
/***/ function (module, exports) {
/*
## Web
*/
module.exports = {
/*
随机生成一个 URL。
[URL 规范](http://www.w3.org/Addressing/URL/url-spec.txt)
http Hypertext Transfer Protocol
ftp File Transfer protocol
gopher The Gopher protocol
mailto Electronic mail address
mid Message identifiers for electronic mail
cid Content identifiers for MIME body part
news Usenet news
nntp Usenet news for local NNTP access only
prospero Access using the prospero protocols
telnet rlogin tn3270 Reference to interactive sessions
wais Wide Area Information Servers
*/
url: function (protocol, host) {
return (protocol || this.protocol()) + '://' + // protocol?
(host || this.domain()) + // host?
'/' + this.word()
},
// 随机生成一个 URL 协议。
protocol: function () {
return this.pick(
// 协议簇
'http ftp gopher mailto mid cid news nntp prospero telnet rlogin tn3270 wais'.split(' ')
)
},
// 随机生成一个域名。
domain: function (tld) {
return this.word() + '.' + (tld || this.tld())
},
/*
随机生成一个顶级域名。
国际顶级域名 international top-level domain-names, iTLDs
国家顶级域名 national top-level domainnames, nTLDs
[域名后缀大全](http://www.163ns.com/zixun/post/4417.html)
*/
tld: function () { // Top Level Domain
return this.pick(
(
// 域名后缀
'com net org edu gov int mil cn ' +
// 国内域名
'com.cn net.cn gov.cn org.cn ' +
// 中文国内域名
'中国 中国互联.公司 中国互联.网络 ' +
// 新国际域名
'tel biz cc tv info name hk mobi asia cd travel pro museum coop aero ' +
// 世界各国域名后缀
'ad ae af ag ai al am an ao aq ar as at au aw az ba bb bd be bf bg bh bi bj bm bn bo br bs bt bv bw by bz ca cc cf cg ch ci ck cl cm cn co cq cr cu cv cx cy cz de dj dk dm do dz ec ee eg eh es et ev fi fj fk fm fo fr ga gb gd ge gf gh gi gl gm gn gp gr gt gu gw gy hk hm hn hr ht hu id ie il in io iq ir is it jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc li lk lr ls lt lu lv ly ma mc md mg mh ml mm mn mo mp mq mr ms mt mv mw mx my mz na nc ne nf ng ni nl no np nr nt nu nz om qa pa pe pf pg ph pk pl pm pn pr pt pw py re ro ru rw sa sb sc sd se sg sh si sj sk sl sm sn so sr st su sy sz tc td tf tg th tj tk tm tn to tp tr tt tv tw tz ua ug uk us uy va vc ve vg vn vu wf ws ye yu za zm zr zw'
).split(' ')
)
},
// 随机生成一个邮件地址。
email: function (domain) {
return this.character('lower') + '.' + this.word() + '@' +
(
domain ||
(this.word() + '.' + this.tld())
)
// return this.character('lower') + '.' + this.last().toLowerCase() + '@' + this.last().toLowerCase() + '.' + this.tld()
// return this.word() + '@' + (domain || this.domain())
},
// 随机生成一个 IP 地址。
ip: function () {
return this.natural(0, 255) + '.' +
this.natural(0, 255) + '.' +
this.natural(0, 255) + '.' +
this.natural(0, 255)
}
}
/***/
},
/* 17 */
/***/ function (module, exports, __webpack_require__) {
/*
## Address
*/
var DICT = __webpack_require__(18)
var REGION = ['东北', '华北', '华东', '华中', '华南', '西南', '西北']
module.exports = {
// 随机生成一个大区。
region: function () {
return this.pick(REGION)
},
// 随机生成一个(中国)省(或直辖市、自治区、特别行政区)。
province: function () {
return this.pick(DICT).name
},
// 随机生成一个(中国)市。
city: function (prefix) {
var province = this.pick(DICT)
var city = this.pick(province.children)
return prefix ? [province.name, city.name].join(' ') : city.name
},
// 随机生成一个(中国)县。
county: function (prefix) {
var province = this.pick(DICT)
var city = this.pick(province.children)
var county = this.pick(city.children) || {
name: '-'
}
return prefix ? [province.name, city.name, county.name].join(' ') : county.name
},
// 随机生成一个邮政编码(六位数字)。
zip: function (len) {
var zip = ''
for (var i = 0; i < (len || 6); i++) zip += this.natural(0, 9)
return zip
}
// address: function() {},
// phone: function() {},
// areacode: function() {},
// street: function() {},
// street_suffixes: function() {},
// street_suffix: function() {},
// states: function() {},
// state: function() {},
}
/***/
},
/* 18 */
/***/ function (module, exports) {
/*
## Address 字典数据
字典数据来源 http://www.atatech.org/articles/30028?rnd=254259856
国标 省(市)级行政区划码表
华北 北京市 天津市 河北省 山西省 内蒙古自治区
东北 辽宁省 吉林省 黑龙江省
华东 上海市 江苏省 浙江省 安徽省 福建省 江西省 山东省
华南 广东省 广西壮族自治区 海南省
华中 河南省 湖北省 湖南省
西南 重庆市 四川省 贵州省 云南省 西藏自治区
西北 陕西省 甘肃省 青海省 宁夏回族自治区 新疆维吾尔自治区
港澳台 香港特别行政区 澳门特别行政区 台湾省
**排序**
```js
var map = {}
_.each(_.keys(REGIONS),function(id){
map[id] = REGIONS[ID]
})
JSON.stringify(map)
```
*/
var DICT = {
"110000": "北京",
"110100": "北京市",
"110101": "东城区",
"110102": "西城区",
"110105": "朝阳区",
"110106": "丰台区",
"110107": "石景山区",
"110108": "海淀区",
"110109": "门头沟区",
"110111": "房山区",
"110112": "通州区",
"110113": "顺义区",
"110114": "昌平区",
"110115": "大兴区",
"110116": "怀柔区",
"110117": "平谷区",
"110228": "密云县",
"110229": "延庆县",
"110230": "其它区",
"120000": "天津",
"120100": "天津市",
"120101": "和平区",
"120102": "河东区",
"120103": "河西区",
"120104": "南开区",
"120105": "河北区",
"120106": "红桥区",
"120110": "东丽区",
"120111": "西青区",
"120112": "津南区",
"120113": "北辰区",
"120114": "武清区",
"120115": "宝坻区",
"120116": "滨海新区",
"120221": "宁河县",
"120223": "静海县",
"120225": "蓟县",
"120226": "其它区",
"130000": "河北省",
"130100": "石家庄市",
"130102": "长安区",
"130103": "桥东区",
"130104": "桥西区",
"130105": "新华区",
"130107": "井陉矿区",
"130108": "裕华区",
"130121": "井陉县",
"130123": "正定县",
"130124": "栾城县",
"130125": "行唐县",
"130126": "灵寿县",
"130127": "高邑县",
"130128": "深泽县",
"130129": "赞皇县",
"130130": "无极县",
"130131": "平山县",
"130132": "元氏县",
"130133": "赵县",
"130181": "辛集市",
"130182": "藁城市",
"130183": "晋州市",
"130184": "新乐市",
"130185": "鹿泉市",
"130186": "其它区",
"130200": "唐山市",
"130202": "路南区",
"130203": "路北区",
"130204": "古冶区",
"130205": "开平区",
"130207": "丰南区",
"130208": "丰润区",
"130223": "滦县",
"130224": "滦南县",
"130225": "乐亭县",
"130227": "迁西县",
"130229": "玉田县",
"130230": "曹妃甸区",
"130281": "遵化市",
"130283": "迁安市",
"130284": "其它区",
"130300": "秦皇岛市",
"130302": "海港区",
"130303": "山海关区",
"130304": "北戴河区",
"130321": "青龙满族自治县",
"130322": "昌黎县",
"130323": "抚宁县",
"130324": "卢龙县",
"130398": "其它区",
"130400": "邯郸市",
"130402": "邯山区",
"130403": "丛台区",
"130404": "复兴区",
"130406": "峰峰矿区",
"130421": "邯郸县",
"130423": "临漳县",
"130424": "成安县",
"130425": "大名县",
"130426": "涉县",
"130427": "磁县",
"130428": "肥乡县",
"130429": "永年县",
"130430": "邱县",
"130431": "鸡泽县",
"130432": "广平县",
"130433": "馆陶县",
"130434": "魏县",
"130435": "曲周县",
"130481": "武安市",
"130482": "其它区",
"130500": "邢台市",
"130502": "桥东区",
"130503": "桥西区",
"130521": "邢台县",
"130522": "临城县",
"130523": "内丘县",
"130524": "柏乡县",
"130525": "隆尧县",
"130526": "任县",
"130527": "南和县",
"130528": "宁晋县",
"130529": "巨鹿县",
"130530": "新河县",
"130531": "广宗县",
"130532": "平乡县",
"130533": "威县",
"130534": "清河县",
"130535": "临西县",
"130581": "南宫市",
"130582": "沙河市",
"130583": "其它区",
"130600": "保定市",
"130602": "新市区",
"130603": "北市区",
"130604": "南市区",
"130621": "满城县",
"130622": "清苑县",
"130623": "涞水县",
"130624": "阜平县",
"130625": "徐水县",
"130626": "定兴县",
"130627": "唐县",
"130628": "高阳县",
"130629": "容城县",
"130630": "涞源县",
"130631": "望都县",
"130632": "安新县",
"130633": "易县",
"130634": "曲阳县",
"130635": "蠡县",
"130636": "顺平县",
"130637": "博野县",
"130638": "雄县",
"130681": "涿州市",
"130682": "定州市",
"130683": "安国市",
"130684": "高碑店市",
"130699": "其它区",
"130700": "张家口市",
"130702": "桥东区",
"130703": "桥西区",
"130705": "宣化区",
"130706": "下花园区",
"130721": "宣化县",
"130722": "张北县",
"130723": "康保县",
"130724": "沽源县",
"130725": "尚义县",
"130726": "蔚县",
"130727": "阳原县",
"130728": "怀安县",
"130729": "万全县",
"130730": "怀来县",
"130731": "涿鹿县",
"130732": "赤城县",
"130733": "崇礼县",
"130734": "其它区",
"130800": "承德市",
"130802": "双桥区",
"130803": "双滦区",
"130804": "鹰手营子矿区",
"130821": "承德县",
"130822": "兴隆县",
"130823": "平泉县",
"130824": "滦平县",
"130825": "隆化县",
"130826": "丰宁满族自治县",
"130827": "宽城满族自治县",
"130828": "围场满族蒙古族自治县",
"130829": "其它区",
"130900": "沧州市",
"130902": "新华区",
"130903": "运河区",
"130921": "沧县",
"130922": "青县",
"130923": "东光县",
"130924": "海兴县",
"130925": "盐山县",
"130926": "肃宁县",
"130927": "南皮县",
"130928": "吴桥县",
"130929": "献县",
"130930": "孟村回族自治县",
"130981": "泊头市",
"130982": "任丘市",
"130983": "黄骅市",
"130984": "河间市",
"130985": "其它区",
"131000": "廊坊市",
"131002": "安次区",
"131003": "广阳区",
"131022": "固安县",
"131023": "永清县",
"131024": "香河县",
"131025": "大城县",
"131026": "文安县",
"131028": "大厂回族自治县",
"131081": "霸州市",
"131082": "三河市",
"131083": "其它区",
"131100": "衡水市",
"131102": "桃城区",
"131121": "枣强县",
"131122": "武邑县",
"131123": "武强县",
"131124": "饶阳县",
"131125": "安平县",
"131126": "故城县",
"131127": "景县",
"131128": "阜城县",
"131181": "冀州市",
"131182": "深州市",
"131183": "其它区",
"140000": "山西省",
"140100": "太原市",
"140105": "小店区",
"140106": "迎泽区",
"140107": "杏花岭区",
"140108": "尖草坪区",
"140109": "万柏林区",
"140110": "晋源区",
"140121": "清徐县",
"140122": "阳曲县",
"140123": "娄烦县",
"140181": "古交市",
"140182": "其它区",
"140200": "大同市",
"140202": "城区",
"140203": "矿区",
"140211": "南郊区",
"140212": "新荣区",
"140221": "阳高县",
"140222": "天镇县",
"140223": "广灵县",
"140224": "灵丘县",
"140225": "浑源县",
"140226": "左云县",
"140227": "大同县",
"140228": "其它区",
"140300": "阳泉市",
"140302": "城区",
"140303": "矿区",
"140311": "郊区",
"140321": "平定县",
"140322": "盂县",
"140323": "其它区",
"140400": "长治市",
"140421": "长治县",
"140423": "襄垣县",
"140424": "屯留县",
"140425": "平顺县",
"140426": "黎城县",
"140427": "壶关县",
"140428": "长子县",
"140429": "武乡县",
"140430": "沁县",
"140431": "沁源县",
"140481": "潞城市",
"140482": "城区",
"140483": "郊区",
"140485": "其它区",
"140500": "晋城市",
"140502": "城区",
"140521": "沁水县",
"140522": "阳城县",
"140524": "陵川县",
"140525": "泽州县",
"140581": "高平市",
"140582": "其它区",
"140600": "朔州市",
"140602": "朔城区",
"140603": "平鲁区",
"140621": "山阴县",
"140622": "应县",
"140623": "右玉县",
"140624": "怀仁县",
"140625": "其它区",
"140700": "晋中市",
"140702": "榆次区",
"140721": "榆社县",
"140722": "左权县",
"140723": "和顺县",
"140724": "昔阳县",
"140725": "寿阳县",
"140726": "太谷县",
"140727": "祁县",
"140728": "平遥县",
"140729": "灵石县",
"140781": "介休市",
"140782": "其它区",
"140800": "运城市",
"140802": "盐湖区",
"140821": "临猗县",
"140822": "万荣县",
"140823": "闻喜县",
"140824": "稷山县",
"140825": "新绛县",
"140826": "绛县",
"140827": "垣曲县",
"140828": "夏县",
"140829": "平陆县",
"140830": "芮城县",
"140881": "永济市",
"140882": "河津市",
"140883": "其它区",
"140900": "忻州市",
"140902": "忻府区",
"140921": "定襄县",
"140922": "五台县",
"140923": "代县",
"140924": "繁峙县",
"140925": "宁武县",
"140926": "静乐县",
"140927": "神池县",
"140928": "五寨县",
"140929": "岢岚县",
"140930": "河曲县",
"140931": "保德县",
"140932": "偏关县",
"140981": "原平市",
"140982": "其它区",
"141000": "临汾市",
"141002": "尧都区",
"141021": "曲沃县",
"141022": "翼城县",
"141023": "襄汾县",
"141024": "洪洞县",
"141025": "古县",
"141026": "安泽县",
"141027": "浮山县",
"141028": "吉县",
"141029": "乡宁县",
"141030": "大宁县",
"141031": "隰县",
"141032": "永和县",
"141033": "蒲县",
"141034": "汾西县",
"141081": "侯马市",
"141082": "霍州市",
"141083": "其它区",
"141100": "吕梁市",
"141102": "离石区",
"141121": "文水县",
"141122": "交城县",
"141123": "兴县",
"141124": "临县",
"141125": "柳林县",
"141126": "石楼县",
"141127": "岚县",
"141128": "方山县",
"141129": "中阳县",
"141130": "交口县",
"141181": "孝义市",
"141182": "汾阳市",
"141183": "其它区",
"150000": "内蒙古自治区",
"150100": "呼和浩特市",
"150102": "新城区",
"150103": "回民区",
"150104": "玉泉区",
"150105": "赛罕区",
"150121": "土默特左旗",
"150122": "托克托县",
"150123": "和林格尔县",
"150124": "清水河县",
"150125": "武川县",
"150126": "其它区",
"150200": "包头市",
"150202": "东河区",
"150203": "昆都仑区",
"150204": "青山区",
"150205": "石拐区",
"150206": "白云鄂博矿区",
"150207": "九原区",
"150221": "土默特右旗",
"150222": "固阳县",
"150223": "达尔罕茂明安联合旗",
"150224": "其它区",
"150300": "乌海市",
"150302": "海勃湾区",
"150303": "海南区",
"150304": "乌达区",
"150305": "其它区",
"150400": "赤峰市",
"150402": "红山区",
"150403": "元宝山区",
"150404": "松山区",
"150421": "阿鲁科尔沁旗",
"150422": "巴林左旗",
"150423": "巴林右旗",
"150424": "林西县",
"150425": "克什克腾旗",
"150426": "翁牛特旗",
"150428": "喀喇沁旗",
"150429": "宁城县",
"150430": "敖汉旗",
"150431": "其它区",
"150500": "通辽市",
"150502": "科尔沁区",
"150521": "科尔沁左翼中旗",
"150522": "科尔沁左翼后旗",
"150523": "开鲁县",
"150524": "库伦旗",
"150525": "奈曼旗",
"150526": "扎鲁特旗",
"150581": "霍林郭勒市",
"150582": "其它区",
"150600": "鄂尔多斯市",
"150602": "东胜区",
"150621": "达拉特旗",
"150622": "准格尔旗",
"150623": "鄂托克前旗",
"150624": "鄂托克旗",
"150625": "杭锦旗",
"150626": "乌审旗",
"150627": "伊金霍洛旗",
"150628": "其它区",
"150700": "呼伦贝尔市",
"150702": "海拉尔区",
"150703": "扎赉诺尔区",
"150721": "阿荣旗",
"150722": "莫力达瓦达斡尔族自治旗",
"150723": "鄂伦春自治旗",
"150724": "鄂温克族自治旗",
"150725": "陈巴尔虎旗",
"150726": "新巴尔虎左旗",
"150727": "新巴尔虎右旗",
"150781": "满洲里市",
"150782": "牙克石市",
"150783": "扎兰屯市",
"150784": "额尔古纳市",
"150785": "根河市",
"150786": "其它区",
"150800": "巴彦淖尔市",
"150802": "临河区",
"150821": "五原县",
"150822": "磴口县",
"150823": "乌拉特前旗",
"150824": "乌拉特中旗",
"150825": "乌拉特后旗",
"150826": "杭锦后旗",
"150827": "其它区",
"150900": "乌兰察布市",
"150902": "集宁区",
"150921": "卓资县",
"150922": "化德县",
"150923": "商都县",
"150924": "兴和县",
"150925": "凉城县",
"150926": "察哈尔右翼前旗",
"150927": "察哈尔右翼中旗",
"150928": "察哈尔右翼后旗",
"150929": "四子王旗",
"150981": "丰镇市",
"150982": "其它区",
"152200": "兴安盟",
"152201": "乌兰浩特市",
"152202": "阿尔山市",
"152221": "科尔沁右翼前旗",
"152222": "科尔沁右翼中旗",
"152223": "扎赉特旗",
"152224": "突泉县",
"152225": "其它区",
"152500": "锡林郭勒盟",
"152501": "二连浩特市",
"152502": "锡林浩特市",
"152522": "阿巴嘎旗",
"152523": "苏尼特左旗",
"152524": "苏尼特右旗",
"152525": "东乌珠穆沁旗",
"152526": "西乌珠穆沁旗",
"152527": "太仆寺旗",
"152528": "镶黄旗",
"152529": "正镶白旗",
"152530": "正蓝旗",
"152531": "多伦县",
"152532": "其它区",
"152900": "阿拉善盟",
"152921": "阿拉善左旗",
"152922": "阿拉善右旗",
"152923": "额济纳旗",
"152924": "其它区",
"210000": "辽宁省",
"210100": "沈阳市",
"210102": "和平区",
"210103": "沈河区",
"210104": "大东区",
"210105": "皇姑区",
"210106": "铁西区",
"210111": "苏家屯区",
"210112": "东陵区",
"210113": "新城子区",
"210114": "于洪区",
"210122": "辽中县",
"210123": "康平县",
"210124": "法库县",
"210181": "新民市",
"210184": "沈北新区",
"210185": "其它区",
"210200": "大连市",
"210202": "中山区",
"210203": "西岗区",
"210204": "沙河口区",
"210211": "甘井子区",
"210212": "旅顺口区",
"210213": "金州区",
"210224": "长海县",
"210281": "瓦房店市",
"210282": "普兰店市",
"210283": "庄河市",
"210298": "其它区",
"210300": "鞍山市",
"210302": "铁东区",
"210303": "铁西区",
"210304": "立山区",
"210311": "千山区",
"210321": "台安县",
"210323": "岫岩满族自治县",
"210381": "海城市",
"210382": "其它区",
"210400": "抚顺市",
"210402": "新抚区",
"210403": "东洲区",
"210404": "望花区",
"210411": "顺城区",
"210421": "抚顺县",
"210422": "新宾满族自治县",
"210423": "清原满族自治县",
"210424": "其它区",
"210500": "本溪市",
"210502": "平山区",
"210503": "溪湖区",
"210504": "明山区",
"210505": "南芬区",
"210521": "本溪满族自治县",
"210522": "桓仁满族自治县",
"210523": "其它区",
"210600": "丹东市",
"210602": "元宝区",
"210603": "振兴区",
"210604": "振安区",
"210624": "宽甸满族自治县",
"210681": "东港市",
"210682": "凤城市",
"210683": "其它区",
"210700": "锦州市",
"210702": "古塔区",
"210703": "凌河区",
"210711": "太和区",
"210726": "黑山县",
"210727": "义县",
"210781": "凌海市",
"210782": "北镇市",
"210783": "其它区",
"210800": "营口市",
"210802": "站前区",
"210803": "西市区",
"210804": "鲅鱼圈区",
"210811": "老边区",
"210881": "盖州市",
"210882": "大石桥市",
"210883": "其它区",
"210900": "阜新市",
"210902": "海州区",
"210903": "新邱区",
"210904": "太平区",
"210905": "清河门区",
"210911": "细河区",
"210921": "阜新蒙古族自治县",
"210922": "彰武县",
"210923": "其它区",
"211000": "辽阳市",
"211002": "白塔区",
"211003": "文圣区",
"211004": "宏伟区",
"211005": "弓长岭区",
"211011": "太子河区",
"211021": "辽阳县",
"211081": "灯塔市",
"211082": "其它区",
"211100": "盘锦市",
"211102": "双台子区",
"211103": "兴隆台区",
"211121": "大洼县",
"211122": "盘山县",
"211123": "其它区",
"211200": "铁岭市",
"211202": "银州区",
"211204": "清河区",
"211221": "铁岭县",
"211223": "西丰县",
"211224": "昌图县",
"211281": "调兵山市",
"211282": "开原市",
"211283": "其它区",
"211300": "朝阳市",
"211302": "双塔区",
"211303": "龙城区",
"211321": "朝阳县",
"211322": "建平县",
"211324": "喀喇沁左翼蒙古族自治县",
"211381": "北票市",
"211382": "凌源市",
"211383": "其它区",
"211400": "葫芦岛市",
"211402": "连山区",
"211403": "龙港区",
"211404": "南票区",
"211421": "绥中县",
"211422": "建昌县",
"211481": "兴城市",
"211482": "其它区",
"220000": "吉林省",
"220100": "长春市",
"220102": "南关区",
"220103": "宽城区",
"220104": "朝阳区",
"220105": "二道区",
"220106": "绿园区",
"220112": "双阳区",
"220122": "农安县",
"220181": "九台市",
"220182": "榆树市",
"220183": "德惠市",
"220188": "其它区",
"220200": "吉林市",
"220202": "昌邑区",
"220203": "龙潭区",
"220204": "船营区",
"220211": "丰满区",
"220221": "永吉县",
"220281": "蛟河市",
"220282": "桦甸市",
"220283": "舒兰市",
"220284": "磐石市",
"220285": "其它区",
"220300": "四平市",
"220302": "铁西区",
"220303": "铁东区",
"220322": "梨树县",
"220323": "伊通满族自治县",
"220381": "公主岭市",
"220382": "双辽市",
"220383": "其它区",
"220400": "辽源市",
"220402": "龙山区",
"220403": "西安区",
"220421": "东丰县",
"220422": "东辽县",
"220423": "其它区",
"220500": "通化市",
"220502": "东昌区",
"220503": "二道江区",
"220521": "通化县",
"220523": "辉南县",
"220524": "柳河县",
"220581": "梅河口市",
"220582": "集安市",
"220583": "其它区",
"220600": "白山市",
"220602": "浑江区",
"220621": "抚松县",
"220622": "靖宇县",
"220623": "长白朝鲜族自治县",
"220625": "江源区",
"220681": "临江市",
"220682": "其它区",
"220700": "松原市",
"220702": "宁江区",
"220721": "前郭尔罗斯蒙古族自治县",
"220722": "长岭县",
"220723": "乾安县",
"220724": "扶余市",
"220725": "其它区",
"220800": "白城市",
"220802": "洮北区",
"220821": "镇赉县",
"220822": "通榆县",
"220881": "洮南市",
"220882": "大安市",
"220883": "其它区",
"222400": "延边朝鲜族自治州",
"222401": "延吉市",
"222402": "图们市",
"222403": "敦化市",
"222404": "珲春市",
"222405": "龙井市",
"222406": "和龙市",
"222424": "汪清县",
"222426": "安图县",
"222427": "其它区",
"230000": "黑龙江省",
"230100": "哈尔滨市",
"230102": "道里区",
"230103": "南岗区",
"230104": "道外区",
"230106": "香坊区",
"230108": "平房区",
"230109": "松北区",
"230111": "呼兰区",
"230123": "依兰县",
"230124": "方正县",
"230125": "宾县",
"230126": "巴彦县",
"230127": "木兰县",
"230128": "通河县",
"230129": "延寿县",
"230181": "阿城区",
"230182": "双城市",
"230183": "尚志市",
"230184": "五常市",
"230186": "其它区",
"230200": "齐齐哈尔市",
"230202": "龙沙区",
"230203": "建华区",
"230204": "铁锋区",
"230205": "昂昂溪区",
"230206": "富拉尔基区",
"230207": "碾子山区",
"230208": "梅里斯达斡尔族区",
"230221": "龙江县",
"230223": "依安县",
"230224": "泰来县",
"230225": "甘南县",
"230227": "富裕县",
"230229": "克山县",
"230230": "克东县",
"230231": "拜泉县",
"230281": "讷河市",
"230282": "其它区",
"230300": "鸡西市",
"230302": "鸡冠区",
"230303": "恒山区",
"230304": "滴道区",
"230305": "梨树区",
"230306": "城子河区",
"230307": "麻山区",
"230321": "鸡东县",
"230381": "虎林市",
"230382": "密山市",
"230383": "其它区",
"230400": "鹤岗市",
"230402": "向阳区",
"230403": "工农区",
"230404": "南山区",
"230405": "兴安区",
"230406": "东山区",
"230407": "兴山区",
"230421": "萝北县",
"230422": "绥滨县",
"230423": "其它区",
"230500": "双鸭山市",
"230502": "尖山区",
"230503": "岭东区",
"230505": "四方台区",
"230506": "宝山区",
"230521": "集贤县",
"230522": "友谊县",
"230523": "宝清县",
"230524": "饶河县",
"230525": "其它区",
"230600": "大庆市",
"230602": "萨尔图区",
"230603": "龙凤区",
"230604": "让胡路区",
"230605": "红岗区",
"230606": "大同区",
"230621": "肇州县",
"230622": "肇源县",
"230623": "林甸县",
"230624": "杜尔伯特蒙古族自治县",
"230625": "其它区",
"230700": "伊春市",
"230702": "伊春区",
"230703": "南岔区",
"230704": "友好区",
"230705": "西林区",
"230706": "翠峦区",
"230707": "新青区",
"230708": "美溪区",
"230709": "金山屯区",
"230710": "五营区",
"230711": "乌马河区",
"230712": "汤旺河区",
"230713": "带岭区",
"230714": "乌伊岭区",
"230715": "红星区",
"230716": "上甘岭区",
"230722": "嘉荫县",
"230781": "铁力市",
"230782": "其它区",
"230800": "佳木斯市",
"230803": "向阳区",
"230804": "前进区",
"230805": "东风区",
"230811": "郊区",
"230822": "桦南县",
"230826": "桦川县",
"230828": "汤原县",
"230833": "抚远县",
"230881": "同江市",
"230882": "富锦市",
"230883": "其它区",
"230900": "七台河市",
"230902": "新兴区",
"230903": "桃山区",
"230904": "茄子河区",
"230921": "勃利县",
"230922": "其它区",
"231000": "牡丹江市",
"231002": "东安区",
"231003": "阳明区",
"231004": "爱民区",
"231005": "西安区",
"231024": "东宁县",
"231025": "林口县",
"231081": "绥芬河市",
"231083": "海林市",
"231084": "宁安市",
"231085": "穆棱市",
"231086": "其它区",
"231100": "黑河市",
"231102": "爱辉区",
"231121": "嫩江县",
"231123": "逊克县",
"231124": "孙吴县",
"231181": "北安市",
"231182": "五大连池市",
"231183": "其它区",
"231200": "绥化市",
"231202": "北林区",
"231221": "望奎县",
"231222": "兰西县",
"231223": "青冈县",
"231224": "庆安县",
"231225": "明水县",
"231226": "绥棱县",
"231281": "安达市",
"231282": "肇东市",
"231283": "海伦市",
"231284": "其它区",
"232700": "大兴安岭地区",
"232702": "松岭区",
"232703": "新林区",
"232704": "呼中区",
"232721": "呼玛县",
"232722": "塔河县",
"232723": "漠河县",
"232724": "加格达奇区",
"232725": "其它区",
"310000": "上海",
"310100": "上海市",
"310101": "黄浦区",
"310104": "徐汇区",
"310105": "长宁区",
"310106": "静安区",
"310107": "普陀区",
"310108": "闸北区",
"310109": "虹口区",
"310110": "杨浦区",
"310112": "闵行区",
"310113": "宝山区",
"310114": "嘉定区",
"310115": "浦东新区",
"310116": "金山区",
"310117": "松江区",
"310118": "青浦区",
"310120": "奉贤区",
"310230": "崇明县",
"310231": "其它区",
"320000": "江苏省",
"320100": "南京市",
"320102": "玄武区",
"320104": "秦淮区",
"320105": "建邺区",
"320106": "鼓楼区",
"320111": "浦口区",
"320113": "栖霞区",
"320114": "雨花台区",
"320115": "江宁区",
"320116": "六合区",
"320124": "溧水区",
"320125": "高淳区",
"320126": "其它区",
"320200": "无锡市",
"320202": "崇安区",
"320203": "南长区",
"320204": "北塘区",
"320205": "锡山区",
"320206": "惠山区",
"320211": "滨湖区",
"320281": "江阴市",
"320282": "宜兴市",
"320297": "其它区",
"320300": "徐州市",
"320302": "鼓楼区",
"320303": "云龙区",
"320305": "贾汪区",
"320311": "泉山区",
"320321": "丰县",
"320322": "沛县",
"320323": "铜山区",
"320324": "睢宁县",
"320381": "新沂市",
"320382": "邳州市",
"320383": "其它区",
"320400": "常州市",
"320402": "天宁区",
"320404": "钟楼区",
"320405": "戚墅堰区",
"320411": "新北区",
"320412": "武进区",
"320481": "溧阳市",
"320482": "金坛市",
"320483": "其它区",
"320500": "苏州市",
"320505": "虎丘区",
"320506": "吴中区",
"320507": "相城区",
"320508": "姑苏区",
"320581": "常熟市",
"320582": "张家港市",
"320583": "昆山市",
"320584": "吴江区",
"320585": "太仓市",
"320596": "其它区",
"320600": "南通市",
"320602": "崇川区",
"320611": "港闸区",
"320612": "通州区",
"320621": "海安县",
"320623": "如东县",
"320681": "启东市",
"320682": "如皋市",
"320684": "海门市",
"320694": "其它区",
"320700": "连云港市",
"320703": "连云区",
"320705": "新浦区",
"320706": "海州区",
"320721": "赣榆县",
"320722": "东海县",
"320723": "灌云县",
"320724": "灌南县",
"320725": "其它区",
"320800": "淮安市",
"320802": "清河区",
"320803": "淮安区",
"320804": "淮阴区",
"320811": "清浦区",
"320826": "涟水县",
"320829": "洪泽县",
"320830": "盱眙县",
"320831": "金湖县",
"320832": "其它区",
"320900": "盐城市",
"320902": "亭湖区",
"320903": "盐都区",
"320921": "响水县",
"320922": "滨海县",
"320923": "阜宁县",
"320924": "射阳县",
"320925": "建湖县",
"320981": "东台市",
"320982": "大丰市",
"320983": "其它区",
"321000": "扬州市",
"321002": "广陵区",
"321003": "邗江区",
"321023": "宝应县",
"321081": "仪征市",
"321084": "高邮市",
"321088": "江都区",
"321093": "其它区",
"321100": "镇江市",
"321102": "京口区",
"321111": "润州区",
"321112": "丹徒区",
"321181": "丹阳市",
"321182": "扬中市",
"321183": "句容市",
"321184": "其它区",
"321200": "泰州市",
"321202": "海陵区",
"321203": "高港区",
"321281": "兴化市",
"321282": "靖江市",
"321283": "泰兴市",
"321284": "姜堰区",
"321285": "其它区",
"321300": "宿迁市",
"321302": "宿城区",
"321311": "宿豫区",
"321322": "沭阳县",
"321323": "泗阳县",
"321324": "泗洪县",
"321325": "其它区",
"330000": "浙江省",
"330100": "杭州市",
"330102": "上城区",
"330103": "下城区",
"330104": "江干区",
"330105": "拱墅区",
"330106": "西湖区",
"330108": "滨江区",
"330109": "萧山区",
"330110": "余杭区",
"330122": "桐庐县",
"330127": "淳安县",
"330182": "建德市",
"330183": "富阳市",
"330185": "临安市",
"330186": "其它区",
"330200": "宁波市",
"330203": "海曙区",
"330204": "江东区",
"330205": "江北区",
"330206": "北仑区",
"330211": "镇海区",
"330212": "鄞州区",
"330225": "象山县",
"330226": "宁海县",
"330281": "余姚市",
"330282": "慈溪市",
"330283": "奉化市",
"330284": "其它区",
"330300": "温州市",
"330302": "鹿城区",
"330303": "龙湾区",
"330304": "瓯海区",
"330322": "洞头县",
"330324": "永嘉县",
"330326": "平阳县",
"330327": "苍南县",
"330328": "文成县",
"330329": "泰顺县",
"330381": "瑞安市",
"330382": "乐清市",
"330383": "其它区",
"330400": "嘉兴市",
"330402": "南湖区",
"330411": "秀洲区",
"330421": "嘉善县",
"330424": "海盐县",
"330481": "海宁市",
"330482": "平湖市",
"330483": "桐乡市",
"330484": "其它区",
"330500": "湖州市",
"330502": "吴兴区",
"330503": "南浔区",
"330521": "德清县",
"330522": "长兴县",
"330523": "安吉县",
"330524": "其它区",
"330600": "绍兴市",
"330602": "越城区",
"330621": "绍兴县",
"330624": "新昌县",
"330681": "诸暨市",
"330682": "上虞市",
"330683": "嵊州市",
"330684": "其它区",
"330700": "金华市",
"330702": "婺城区",
"330703": "金东区",
"330723": "武义县",
"330726": "浦江县",
"330727": "磐安县",
"330781": "兰溪市",
"330782": "义乌市",
"330783": "东阳市",
"330784": "永康市",
"330785": "其它区",
"330800": "衢州市",
"330802": "柯城区",
"330803": "衢江区",
"330822": "常山县",
"330824": "开化县",
"330825": "龙游县",
"330881": "江山市",
"330882": "其它区",
"330900": "舟山市",
"330902": "定海区",
"330903": "普陀区",
"330921": "岱山县",
"330922": "嵊泗县",
"330923": "其它区",
"331000": "台州市",
"331002": "椒江区",
"331003": "黄岩区",
"331004": "路桥区",
"331021": "玉环县",
"331022": "三门县",
"331023": "天台县",
"331024": "仙居县",
"331081": "温岭市",
"331082": "临海市",
"331083": "其它区",
"331100": "丽水市",
"331102": "莲都区",
"331121": "青田县",
"331122": "缙云县",
"331123": "遂昌县",
"331124": "松阳县",
"331125": "云和县",
"331126": "庆元县",
"331127": "景宁畲族自治县",
"331181": "龙泉市",
"331182": "其它区",
"340000": "安徽省",
"340100": "合肥市",
"340102": "瑶海区",
"340103": "庐阳区",
"340104": "蜀山区",
"340111": "包河区",
"340121": "长丰县",
"340122": "肥东县",
"340123": "肥西县",
"340192": "其它区",
"340200": "芜湖市",
"340202": "镜湖区",
"340203": "弋江区",
"340207": "鸠江区",
"340208": "三山区",
"340221": "芜湖县",
"340222": "繁昌县",
"340223": "南陵县",
"340224": "其它区",
"340300": "蚌埠市",
"340302": "龙子湖区",
"340303": "蚌山区",
"340304": "禹会区",
"340311": "淮上区",
"340321": "怀远县",
"340322": "五河县",
"340323": "固镇县",
"340324": "其它区",
"340400": "淮南市",
"340402": "大通区",
"340403": "田家庵区",
"340404": "谢家集区",
"340405": "八公山区",
"340406": "潘集区",
"340421": "凤台县",
"340422": "其它区",
"340500": "马鞍山市",
"340503": "花山区",
"340504": "雨山区",
"340506": "博望区",
"340521": "当涂县",
"340522": "其它区",
"340600": "淮北市",
"340602": "杜集区",
"340603": "相山区",
"340604": "烈山区",
"340621": "濉溪县",
"340622": "其它区",
"340700": "铜陵市",
"340702": "铜官山区",
"340703": "狮子山区",
"340711": "郊区",
"340721": "铜陵县",
"340722": "其它区",
"340800": "安庆市",
"340802": "迎江区",
"340803": "大观区",
"340811": "宜秀区",
"340822": "怀宁县",
"340823": "枞阳县",
"340824": "潜山县",
"340825": "太湖县",
"340826": "宿松县",
"340827": "望江县",
"340828": "岳西县",
"340881": "桐城市",
"340882": "其它区",
"341000": "黄山市",
"341002": "屯溪区",
"341003": "黄山区",
"341004": "徽州区",
"341021": "歙县",
"341022": "休宁县",
"341023": "黟县",
"341024": "祁门县",
"341025": "其它区",
"341100": "滁州市",
"341102": "琅琊区",
"341103": "南谯区",
"341122": "来安县",
"341124": "全椒县",
"341125": "定远县",
"341126": "凤阳县",
"341181": "天长市",
"341182": "明光市",
"341183": "其它区",
"341200": "阜阳市",
"341202": "颍州区",
"341203": "颍东区",
"341204": "颍泉区",
"341221": "临泉县",
"341222": "太和县",
"341225": "阜南县",
"341226": "颍上县",
"341282": "界首市",
"341283": "其它区",
"341300": "宿州市",
"341302": "埇桥区",
"341321": "砀山县",
"341322": "萧县",
"341323": "灵璧县",
"341324": "泗县",
"341325": "其它区",
"341400": "巢湖市",
"341421": "庐江县",
"341422": "无为县",
"341423": "含山县",
"341424": "和县",
"341500": "六安市",
"341502": "金安区",
"341503": "裕安区",
"341521": "寿县",
"341522": "霍邱县",
"341523": "舒城县",
"341524": "金寨县",
"341525": "霍山县",
"341526": "其它区",
"341600": "亳州市",
"341602": "谯城区",
"341621": "涡阳县",
"341622": "蒙城县",
"341623": "利辛县",
"341624": "其它区",
"341700": "池州市",
"341702": "贵池区",
"341721": "东至县",
"341722": "石台县",
"341723": "青阳县",
"341724": "其它区",
"341800": "宣城市",
"341802": "宣州区",
"341821": "郎溪县",
"341822": "广德县",
"341823": "泾县",
"341824": "绩溪县",
"341825": "旌德县",
"341881": "宁国市",
"341882": "其它区",
"350000": "福建省",
"350100": "福州市",
"350102": "鼓楼区",
"350103": "台江区",
"350104": "仓山区",
"350105": "马尾区",
"350111": "晋安区",
"350121": "闽侯县",
"350122": "连江县",
"350123": "罗源县",
"350124": "闽清县",
"350125": "永泰县",
"350128": "平潭县",
"350181": "福清市",
"350182": "长乐市",
"350183": "其它区",
"350200": "厦门市",
"350203": "思明区",
"350205": "海沧区",
"350206": "湖里区",
"350211": "集美区",
"350212": "同安区",
"350213": "翔安区",
"350214": "其它区",
"350300": "莆田市",
"350302": "城厢区",
"350303": "涵江区",
"350304": "荔城区",
"350305": "秀屿区",
"350322": "仙游县",
"350323": "其它区",
"350400": "三明市",
"350402": "梅列区",
"350403": "三元区",
"350421": "明溪县",
"350423": "清流县",
"350424": "宁化县",
"350425": "大田县",
"350426": "尤溪县",
"350427": "沙县",
"350428": "将乐县",
"350429": "泰宁县",
"350430": "建宁县",
"350481": "永安市",
"350482": "其它区",
"350500": "泉州市",
"350502": "鲤城区",
"350503": "丰泽区",
"350504": "洛江区",
"350505": "泉港区",
"350521": "惠安县",
"350524": "安溪县",
"350525": "永春县",
"350526": "德化县",
"350527": "金门县",
"350581": "石狮市",
"350582": "晋江市",
"350583": "南安市",
"350584": "其它区",
"350600": "漳州市",
"350602": "芗城区",
"350603": "龙文区",
"350622": "云霄县",
"350623": "漳浦县",
"350624": "诏安县",
"350625": "长泰县",
"350626": "东山县",
"350627": "南靖县",
"350628": "平和县",
"350629": "华安县",
"350681": "龙海市",
"350682": "其它区",
"350700": "南平市",
"350702": "延平区",
"350721": "顺昌县",
"350722": "浦城县",
"350723": "光泽县",
"350724": "松溪县",
"350725": "政和县",
"350781": "邵武市",
"350782": "武夷山市",
"350783": "建瓯市",
"350784": "建阳市",
"350785": "其它区",
"350800": "龙岩市",
"350802": "新罗区",
"350821": "长汀县",
"350822": "永定县",
"350823": "上杭县",
"350824": "武平县",
"350825": "连城县",
"350881": "漳平市",
"350882": "其它区",
"350900": "宁德市",
"350902": "蕉城区",
"350921": "霞浦县",
"350922": "古田县",
"350923": "屏南县",
"350924": "寿宁县",
"350925": "周宁县",
"350926": "柘荣县",
"350981": "福安市",
"350982": "福鼎市",
"350983": "其它区",
"360000": "江西省",
"360100": "南昌市",
"360102": "东湖区",
"360103": "西湖区",
"360104": "青云谱区",
"360105": "湾里区",
"360111": "青山湖区",
"360121": "南昌县",
"360122": "新建县",
"360123": "安义县",
"360124": "进贤县",
"360128": "其它区",
"360200": "景德镇市",
"360202": "昌江区",
"360203": "珠山区",
"360222": "浮梁县",
"360281": "乐平市",
"360282": "其它区",
"360300": "萍乡市",
"360302": "安源区",
"360313": "湘东区",
"360321": "莲花县",
"360322": "上栗县",
"360323": "芦溪县",
"360324": "其它区",
"360400": "九江市",
"360402": "庐山区",
"360403": "浔阳区",
"360421": "九江县",
"360423": "武宁县",
"360424": "修水县",
"360425": "永修县",
"360426": "德安县",
"360427": "星子县",
"360428": "都昌县",
"360429": "湖口县",
"360430": "彭泽县",
"360481": "瑞昌市",
"360482": "其它区",
"360483": "共青城市",
"360500": "新余市",
"360502": "渝水区",
"360521": "分宜县",
"360522": "其它区",
"360600": "鹰潭市",
"360602": "月湖区",
"360622": "余江县",
"360681": "贵溪市",
"360682": "其它区",
"360700": "赣州市",
"360702": "章贡区",
"360721": "赣县",
"360722": "信丰县",
"360723": "大余县",
"360724": "上犹县",
"360725": "崇义县",
"360726": "安远县",
"360727": "龙南县",
"360728": "定南县",
"360729": "全南县",
"360730": "宁都县",
"360731": "于都县",
"360732": "兴国县",
"360733": "会昌县",
"360734": "寻乌县",
"360735": "石城县",
"360781": "瑞金市",
"360782": "南康市",
"360783": "其它区",
"360800": "吉安市",
"360802": "吉州区",
"360803": "青原区",
"360821": "吉安县",
"360822": "吉水县",
"360823": "峡江县",
"360824": "新干县",
"360825": "永丰县",
"360826": "泰和县",
"360827": "遂川县",
"360828": "万安县",
"360829": "安福县",
"360830": "永新县",
"360881": "井冈山市",
"360882": "其它区",
"360900": "宜春市",
"360902": "袁州区",
"360921": "奉新县",
"360922": "万载县",
"360923": "上高县",
"360924": "宜丰县",
"360925": "靖安县",
"360926": "铜鼓县",
"360981": "丰城市",
"360982": "樟树市",
"360983": "高安市",
"360984": "其它区",
"361000": "抚州市",
"361002": "临川区",
"361021": "南城县",
"361022": "黎川县",
"361023": "南丰县",
"361024": "崇仁县",
"361025": "乐安县",
"361026": "宜黄县",
"361027": "金溪县",
"361028": "资溪县",
"361029": "东乡县",
"361030": "广昌县",
"361031": "其它区",
"361100": "上饶市",
"361102": "信州区",
"361121": "上饶县",
"361122": "广丰县",
"361123": "玉山县",
"361124": "铅山县",
"361125": "横峰县",
"361126": "弋阳县",
"361127": "余干县",
"361128": "鄱阳县",
"361129": "万年县",
"361130": "婺源县",
"361181": "德兴市",
"361182": "其它区",
"370000": "山东省",
"370100": "济南市",
"370102": "历下区",
"370103": "市中区",
"370104": "槐荫区",
"370105": "天桥区",
"370112": "历城区",
"370113": "长清区",
"370124": "平阴县",
"370125": "济阳县",
"370126": "商河县",
"370181": "章丘市",
"370182": "其它区",
"370200": "青岛市",
"370202": "市南区",
"370203": "市北区",
"370211": "黄岛区",
"370212": "崂山区",
"370213": "李沧区",
"370214": "城阳区",
"370281": "胶州市",
"370282": "即墨市",
"370283": "平度市",
"370285": "莱西市",
"370286": "其它区",
"370300": "淄博市",
"370302": "淄川区",
"370303": "张店区",
"370304": "博山区",
"370305": "临淄区",
"370306": "周村区",
"370321": "桓台县",
"370322": "高青县",
"370323": "沂源县",
"370324": "其它区",
"370400": "枣庄市",
"370402": "市中区",
"370403": "薛城区",
"370404": "峄城区",
"370405": "台儿庄区",
"370406": "山亭区",
"370481": "滕州市",
"370482": "其它区",
"370500": "东营市",
"370502": "东营区",
"370503": "河口区",
"370521": "垦利县",
"370522": "利津县",
"370523": "广饶县",
"370591": "其它区",
"370600": "烟台市",
"370602": "芝罘区",
"370611": "福山区",
"370612": "牟平区",
"370613": "莱山区",
"370634": "长岛县",
"370681": "龙口市",
"370682": "莱阳市",
"370683": "莱州市",
"370684": "蓬莱市",
"370685": "招远市",
"370686": "栖霞市",
"370687": "海阳市",
"370688": "其它区",
"370700": "潍坊市",
"370702": "潍城区",
"370703": "寒亭区",
"370704": "坊子区",
"370705": "奎文区",
"370724": "临朐县",
"370725": "昌乐县",
"370781": "青州市",
"370782": "诸城市",
"370783": "寿光市",
"370784": "安丘市",
"370785": "高密市",
"370786": "昌邑市",
"370787": "其它区",
"370800": "济宁市",
"370802": "市中区",
"370811": "任城区",
"370826": "微山县",
"370827": "鱼台县",
"370828": "金乡县",
"370829": "嘉祥县",
"370830": "汶上县",
"370831": "泗水县",
"370832": "梁山县",
"370881": "曲阜市",
"370882": "兖州市",
"370883": "邹城市",
"370884": "其它区",
"370900": "泰安市",
"370902": "泰山区",
"370903": "岱岳区",
"370921": "宁阳县",
"370923": "东平县",
"370982": "新泰市",
"370983": "肥城市",
"370984": "其它区",
"371000": "威海市",
"371002": "环翠区",
"371081": "文登市",
"371082": "荣成市",
"371083": "乳山市",
"371084": "其它区",
"371100": "日照市",
"371102": "东港区",
"371103": "岚山区",
"371121": "五莲县",
"371122": "莒县",
"371123": "其它区",
"371200": "莱芜市",
"371202": "莱城区",
"371203": "钢城区",
"371204": "其它区",
"371300": "临沂市",
"371302": "兰山区",
"371311": "罗庄区",
"371312": "河东区",
"371321": "沂南县",
"371322": "郯城县",
"371323": "沂水县",
"371324": "苍山县",
"371325": "费县",
"371326": "平邑县",
"371327": "莒南县",
"371328": "蒙阴县",
"371329": "临沭县",
"371330": "其它区",
"371400": "德州市",
"371402": "德城区",
"371421": "陵县",
"371422": "宁津县",
"371423": "庆云县",
"371424": "临邑县",
"371425": "齐河县",
"371426": "平原县",
"371427": "夏津县",
"371428": "武城县",
"371481": "乐陵市",
"371482": "禹城市",
"371483": "其它区",
"371500": "聊城市",
"371502": "东昌府区",
"371521": "阳谷县",
"371522": "莘县",
"371523": "茌平县",
"371524": "东阿县",
"371525": "冠县",
"371526": "高唐县",
"371581": "临清市",
"371582": "其它区",
"371600": "滨州市",
"371602": "滨城区",
"371621": "惠民县",
"371622": "阳信县",
"371623": "无棣县",
"371624": "沾化县",
"371625": "博兴县",
"371626": "邹平县",
"371627": "其它区",
"371700": "菏泽市",
"371702": "牡丹区",
"371721": "曹县",
"371722": "单县",
"371723": "成武县",
"371724": "巨野县",
"371725": "郓城县",
"371726": "鄄城县",
"371727": "定陶县",
"371728": "东明县",
"371729": "其它区",
"410000": "河南省",
"410100": "郑州市",
"410102": "中原区",
"410103": "二七区",
"410104": "管城回族区",
"410105": "金水区",
"410106": "上街区",
"410108": "惠济区",
"410122": "中牟县",
"410181": "巩义市",
"410182": "荥阳市",
"410183": "新密市",
"410184": "新郑市",
"410185": "登封市",
"410188": "其它区",
"410200": "开封市",
"410202": "龙亭区",
"410203": "顺河回族区",
"410204": "鼓楼区",
"410205": "禹王台区",
"410211": "金明区",
"410221": "杞县",
"410222": "通许县",
"410223": "尉氏县",
"410224": "开封县",
"410225": "兰考县",
"410226": "其它区",
"410300": "洛阳市",
"410302": "老城区",
"410303": "西工区",
"410304": "瀍河回族区",
"410305": "涧西区",
"410306": "吉利区",
"410307": "洛龙区",
"410322": "孟津县",
"410323": "新安县",
"410324": "栾川县",
"410325": "嵩县",
"410326": "汝阳县",
"410327": "宜阳县",
"410328": "洛宁县",
"410329": "伊川县",
"410381": "偃师市",
"410400": "平顶山市",
"410402": "新华区",
"410403": "卫东区",
"410404": "石龙区",
"410411": "湛河区",
"410421": "宝丰县",
"410422": "叶县",
"410423": "鲁山县",
"410425": "郏县",
"410481": "舞钢市",
"410482": "汝州市",
"410483": "其它区",
"410500": "安阳市",
"410502": "文峰区",
"410503": "北关区",
"410505": "殷都区",
"410506": "龙安区",
"410522": "安阳县",
"410523": "汤阴县",
"410526": "滑县",
"410527": "内黄县",
"410581": "林州市",
"410582": "其它区",
"410600": "鹤壁市",
"410602": "鹤山区",
"410603": "山城区",
"410611": "淇滨区",
"410621": "浚县",
"410622": "淇县",
"410623": "其它区",
"410700": "新乡市",
"410702": "红旗区",
"410703": "卫滨区",
"410704": "凤泉区",
"410711": "牧野区",
"410721": "新乡县",
"410724": "获嘉县",
"410725": "原阳县",
"410726": "延津县",
"410727": "封丘县",
"410728": "长垣县",
"410781": "卫辉市",
"410782": "辉县市",
"410783": "其它区",
"410800": "焦作市",
"410802": "解放区",
"410803": "中站区",
"410804": "马村区",
"410811": "山阳区",
"410821": "修武县",
"410822": "博爱县",
"410823": "武陟县",
"410825": "温县",
"410881": "济源市",
"410882": "沁阳市",
"410883": "孟州市",
"410884": "其它区",
"410900": "濮阳市",
"410902": "华龙区",
"410922": "清丰县",
"410923": "南乐县",
"410926": "范县",
"410927": "台前县",
"410928": "濮阳县",
"410929": "其它区",
"411000": "许昌市",
"411002": "魏都区",
"411023": "许昌县",
"411024": "鄢陵县",
"411025": "襄城县",
"411081": "禹州市",
"411082": "长葛市",
"411083": "其它区",
"411100": "漯河市",
"411102": "源汇区",
"411103": "郾城区",
"411104": "召陵区",
"411121": "舞阳县",
"411122": "临颍县",
"411123": "其它区",
"411200": "三门峡市",
"411202": "湖滨区",
"411221": "渑池县",
"411222": "陕县",
"411224": "卢氏县",
"411281": "义马市",
"411282": "灵宝市",
"411283": "其它区",
"411300": "南阳市",
"411302": "宛城区",
"411303": "卧龙区",
"411321": "南召县",
"411322": "方城县",
"411323": "西峡县",
"411324": "镇平县",
"411325": "内乡县",
"411326": "淅川县",
"411327": "社旗县",
"411328": "唐河县",
"411329": "新野县",
"411330": "桐柏县",
"411381": "邓州市",
"411382": "其它区",
"411400": "商丘市",
"411402": "梁园区",
"411403": "睢阳区",
"411421": "民权县",
"411422": "睢县",
"411423": "宁陵县",
"411424": "柘城县",
"411425": "虞城县",
"411426": "夏邑县",
"411481": "永城市",
"411482": "其它区",
"411500": "信阳市",
"411502": "浉河区",
"411503": "平桥区",
"411521": "罗山县",
"411522": "光山县",
"411523": "新县",
"411524": "商城县",
"411525": "固始县",
"411526": "潢川县",
"411527": "淮滨县",
"411528": "息县",
"411529": "其它区",
"411600": "周口市",
"411602": "川汇区",
"411621": "扶沟县",
"411622": "西华县",
"411623": "商水县",
"411624": "沈丘县",
"411625": "郸城县",
"411626": "淮阳县",
"411627": "太康县",
"411628": "鹿邑县",
"411681": "项城市",
"411682": "其它区",
"411700": "驻马店市",
"411702": "驿城区",
"411721": "西平县",
"411722": "上蔡县",
"411723": "平舆县",
"411724": "正阳县",
"411725": "确山县",
"411726": "泌阳县",
"411727": "汝南县",
"411728": "遂平县",
"411729": "新蔡县",
"411730": "其它区",
"420000": "湖北省",
"420100": "武汉市",
"420102": "江岸区",
"420103": "江汉区",
"420104": "硚口区",
"420105": "汉阳区",
"420106": "武昌区",
"420107": "青山区",
"420111": "洪山区",
"420112": "东西湖区",
"420113": "汉南区",
"420114": "蔡甸区",
"420115": "江夏区",
"420116": "黄陂区",
"420117": "新洲区",
"420118": "其它区",
"420200": "黄石市",
"420202": "黄石港区",
"420203": "西塞山区",
"420204": "下陆区",
"420205": "铁山区",
"420222": "阳新县",
"420281": "大冶市",
"420282": "其它区",
"420300": "十堰市",
"420302": "茅箭区",
"420303": "张湾区",
"420321": "郧县",
"420322": "郧西县",
"420323": "竹山县",
"420324": "竹溪县",
"420325": "房县",
"420381": "丹江口市",
"420383": "其它区",
"420500": "宜昌市",
"420502": "西陵区",
"420503": "伍家岗区",
"420504": "点军区",
"420505": "猇亭区",
"420506": "夷陵区",
"420525": "远安县",
"420526": "兴山县",
"420527": "秭归县",
"420528": "长阳土家族自治县",
"420529": "五峰土家族自治县",
"420581": "宜都市",
"420582": "当阳市",
"420583": "枝江市",
"420584": "其它区",
"420600": "襄阳市",
"420602": "襄城区",
"420606": "樊城区",
"420607": "襄州区",
"420624": "南漳县",
"420625": "谷城县",
"420626": "保康县",
"420682": "老河口市",
"420683": "枣阳市",
"420684": "宜城市",
"420685": "其它区",
"420700": "鄂州市",
"420702": "梁子湖区",
"420703": "华容区",
"420704": "鄂城区",
"420705": "其它区",
"420800": "荆门市",
"420802": "东宝区",
"420804": "掇刀区",
"420821": "京山县",
"420822": "沙洋县",
"420881": "钟祥市",
"420882": "其它区",
"420900": "孝感市",
"420902": "孝南区",
"420921": "孝昌县",
"420922": "大悟县",
"420923": "云梦县",
"420981": "应城市",
"420982": "安陆市",
"420984": "汉川市",
"420985": "其它区",
"421000": "荆州市",
"421002": "沙市区",
"421003": "荆州区",
"421022": "公安县",
"421023": "监利县",
"421024": "江陵县",
"421081": "石首市",
"421083": "洪湖市",
"421087": "松滋市",
"421088": "其它区",
"421100": "黄冈市",
"421102": "黄州区",
"421121": "团风县",
"421122": "红安县",
"421123": "罗田县",
"421124": "英山县",
"421125": "浠水县",
"421126": "蕲春县",
"421127": "黄梅县",
"421181": "麻城市",
"421182": "武穴市",
"421183": "其它区",
"421200": "咸宁市",
"421202": "咸安区",
"421221": "嘉鱼县",
"421222": "通城县",
"421223": "崇阳县",
"421224": "通山县",
"421281": "赤壁市",
"421283": "其它区",
"421300": "随州市",
"421302": "曾都区",
"421321": "随县",
"421381": "广水市",
"421382": "其它区",
"422800": "恩施土家族苗族自治州",
"422801": "恩施市",
"422802": "利川市",
"422822": "建始县",
"422823": "巴东县",
"422825": "宣恩县",
"422826": "咸丰县",
"422827": "来凤县",
"422828": "鹤峰县",
"422829": "其它区",
"429004": "仙桃市",
"429005": "潜江市",
"429006": "天门市",
"429021": "神农架林区",
"430000": "湖南省",
"430100": "长沙市",
"430102": "芙蓉区",
"430103": "天心区",
"430104": "岳麓区",
"430105": "开福区",
"430111": "雨花区",
"430121": "长沙县",
"430122": "望城区",
"430124": "宁乡县",
"430181": "浏阳市",
"430182": "其它区",
"430200": "株洲市",
"430202": "荷塘区",
"430203": "芦淞区",
"430204": "石峰区",
"430211": "天元区",
"430221": "株洲县",
"430223": "攸县",
"430224": "茶陵县",
"430225": "炎陵县",
"430281": "醴陵市",
"430282": "其它区",
"430300": "湘潭市",
"430302": "雨湖区",
"430304": "岳塘区",
"430321": "湘潭县",
"430381": "湘乡市",
"430382": "韶山市",
"430383": "其它区",
"430400": "衡阳市",
"430405": "珠晖区",
"430406": "雁峰区",
"430407": "石鼓区",
"430408": "蒸湘区",
"430412": "南岳区",
"430421": "衡阳县",
"430422": "衡南县",
"430423": "衡山县",
"430424": "衡东县",
"430426": "祁东县",
"430481": "耒阳市",
"430482": "常宁市",
"430483": "其它区",
"430500": "邵阳市",
"430502": "双清区",
"430503": "大祥区",
"430511": "北塔区",
"430521": "邵东县",
"430522": "新邵县",
"430523": "邵阳县",
"430524": "隆回县",
"430525": "洞口县",
"430527": "绥宁县",
"430528": "新宁县",
"430529": "城步苗族自治县",
"430581": "武冈市",
"430582": "其它区",
"430600": "岳阳市",
"430602": "岳阳楼区",
"430603": "云溪区",
"430611": "君山区",
"430621": "岳阳县",
"430623": "华容县",
"430624": "湘阴县",
"430626": "平江县",
"430681": "汨罗市",
"430682": "临湘市",
"430683": "其它区",
"430700": "常德市",
"430702": "武陵区",
"430703": "鼎城区",
"430721": "安乡县",
"430722": "汉寿县",
"430723": "澧县",
"430724": "临澧县",
"430725": "桃源县",
"430726": "石门县",
"430781": "津市市",
"430782": "其它区",
"430800": "张家界市",
"430802": "永定区",
"430811": "武陵源区",
"430821": "慈利县",
"430822": "桑植县",
"430823": "其它区",
"430900": "益阳市",
"430902": "资阳区",
"430903": "赫山区",
"430921": "南县",
"430922": "桃江县",
"430923": "安化县",
"430981": "沅江市",
"430982": "其它区",
"431000": "郴州市",
"431002": "北湖区",
"431003": "苏仙区",
"431021": "桂阳县",
"431022": "宜章县",
"431023": "永兴县",
"431024": "嘉禾县",
"431025": "临武县",
"431026": "汝城县",
"431027": "桂东县",
"431028": "安仁县",
"431081": "资兴市",
"431082": "其它区",
"431100": "永州市",
"431102": "零陵区",
"431103": "冷水滩区",
"431121": "祁阳县",
"431122": "东安县",
"431123": "双牌县",
"431124": "道县",
"431125": "江永县",
"431126": "宁远县",
"431127": "蓝山县",
"431128": "新田县",
"431129": "江华瑶族自治县",
"431130": "其它区",
"431200": "怀化市",
"431202": "鹤城区",
"431221": "中方县",
"431222": "沅陵县",
"431223": "辰溪县",
"431224": "溆浦县",
"431225": "会同县",
"431226": "麻阳苗族自治县",
"431227": "新晃侗族自治县",
"431228": "芷江侗族自治县",
"431229": "靖州苗族侗族自治县",
"431230": "通道侗族自治县",
"431281": "洪江市",
"431282": "其它区",
"431300": "娄底市",
"431302": "娄星区",
"431321": "双峰县",
"431322": "新化县",
"431381": "冷水江市",
"431382": "涟源市",
"431383": "其它区",
"433100": "湘西土家族苗族自治州",
"433101": "吉首市",
"433122": "泸溪县",
"433123": "凤凰县",
"433124": "花垣县",
"433125": "保靖县",
"433126": "古丈县",
"433127": "永顺县",
"433130": "龙山县",
"433131": "其它区",
"440000": "广东省",
"440100": "广州市",
"440103": "荔湾区",
"440104": "越秀区",
"440105": "海珠区",
"440106": "天河区",
"440111": "白云区",
"440112": "黄埔区",
"440113": "番禺区",
"440114": "花都区",
"440115": "南沙区",
"440116": "萝岗区",
"440183": "增城市",
"440184": "从化市",
"440189": "其它区",
"440200": "韶关市",
"440203": "武江区",
"440204": "浈江区",
"440205": "曲江区",
"440222": "始兴县",
"440224": "仁化县",
"440229": "翁源县",
"440232": "乳源瑶族自治县",
"440233": "新丰县",
"440281": "乐昌市",
"440282": "南雄市",
"440283": "其它区",
"440300": "深圳市",
"440303": "罗湖区",
"440304": "福田区",
"440305": "南山区",
"440306": "宝安区",
"440307": "龙岗区",
"440308": "盐田区",
"440309": "其它区",
"440320": "光明新区",
"440321": "坪山新区",
"440322": "大鹏新区",
"440323": "龙华新区",
"440400": "珠海市",
"440402": "香洲区",
"440403": "斗门区",
"440404": "金湾区",
"440488": "其它区",
"440500": "汕头市",
"440507": "龙湖区",
"440511": "金平区",
"440512": "濠江区",
"440513": "潮阳区",
"440514": "潮南区",
"440515": "澄海区",
"440523": "南澳县",
"440524": "其它区",
"440600": "佛山市",
"440604": "禅城区",
"440605": "南海区",
"440606": "顺德区",
"440607": "三水区",
"440608": "高明区",
"440609": "其它区",
"440700": "江门市",
"440703": "蓬江区",
"440704": "江海区",
"440705": "新会区",
"440781": "台山市",
"440783": "开平市",
"440784": "鹤山市",
"440785": "恩平市",
"440786": "其它区",
"440800": "湛江市",
"440802": "赤坎区",
"440803": "霞山区",
"440804": "坡头区",
"440811": "麻章区",
"440823": "遂溪县",
"440825": "徐闻县",
"440881": "廉江市",
"440882": "雷州市",
"440883": "吴川市",
"440884": "其它区",
"440900": "茂名市",
"440902": "茂南区",
"440903": "茂港区",
"440923": "电白县",
"440981": "高州市",
"440982": "化州市",
"440983": "信宜市",
"440984": "其它区",
"441200": "肇庆市",
"441202": "端州区",
"441203": "鼎湖区",
"441223": "广宁县",
"441224": "怀集县",
"441225": "封开县",
"441226": "德庆县",
"441283": "高要市",
"441284": "四会市",
"441285": "其它区",
"441300": "惠州市",
"441302": "惠城区",
"441303": "惠阳区",
"441322": "博罗县",
"441323": "惠东县",
"441324": "龙门县",
"441325": "其它区",
"441400": "梅州市",
"441402": "梅江区",
"441421": "梅县",
"441422": "大埔县",
"441423": "丰顺县",
"441424": "五华县",
"441426": "平远县",
"441427": "蕉岭县",
"441481": "兴宁市",
"441482": "其它区",
"441500": "汕尾市",
"441502": "城区",
"441521": "海丰县",
"441523": "陆河县",
"441581": "陆丰市",
"441582": "其它区",
"441600": "河源市",
"441602": "源城区",
"441621": "紫金县",
"441622": "龙川县",
"441623": "连平县",
"441624": "和平县",
"441625": "东源县",
"441626": "其它区",
"441700": "阳江市",
"441702": "江城区",
"441721": "阳西县",
"441723": "阳东县",
"441781": "阳春市",
"441782": "其它区",
"441800": "清远市",
"441802": "清城区",
"441821": "佛冈县",
"441823": "阳山县",
"441825": "连山壮族瑶族自治县",
"441826": "连南瑶族自治县",
"441827": "清新区",
"441881": "英德市",
"441882": "连州市",
"441883": "其它区",
"441900": "东莞市",
"442000": "中山市",
"442101": "东沙群岛",
"445100": "潮州市",
"445102": "湘桥区",
"445121": "潮安区",
"445122": "饶平县",
"445186": "其它区",
"445200": "揭阳市",
"445202": "榕城区",
"445221": "揭东区",
"445222": "揭西县",
"445224": "惠来县",
"445281": "普宁市",
"445285": "其它区",
"445300": "云浮市",
"445302": "云城区",
"445321": "新兴县",
"445322": "郁南县",
"445323": "云安县",
"445381": "罗定市",
"445382": "其它区",
"450000": "广西壮族自治区",
"450100": "南宁市",
"450102": "兴宁区",
"450103": "青秀区",
"450105": "江南区",
"450107": "西乡塘区",
"450108": "良庆区",
"450109": "邕宁区",
"450122": "武鸣县",
"450123": "隆安县",
"450124": "马山县",
"450125": "上林县",
"450126": "宾阳县",
"450127": "横县",
"450128": "其它区",
"450200": "柳州市",
"450202": "城中区",
"450203": "鱼峰区",
"450204": "柳南区",
"450205": "柳北区",
"450221": "柳江县",
"450222": "柳城县",
"450223": "鹿寨县",
"450224": "融安县",
"450225": "融水苗族自治县",
"450226": "三江侗族自治县",
"450227": "其它区",
"450300": "桂林市",
"450302": "秀峰区",
"450303": "叠彩区",
"450304": "象山区",
"450305": "七星区",
"450311": "雁山区",
"450321": "阳朔县",
"450322": "临桂区",
"450323": "灵川县",
"450324": "全州县",
"450325": "兴安县",
"450326": "永福县",
"450327": "灌阳县",
"450328": "龙胜各族自治县",
"450329": "资源县",
"450330": "平乐县",
"450331": "荔浦县",
"450332": "恭城瑶族自治县",
"450333": "其它区",
"450400": "梧州市",
"450403": "万秀区",
"450405": "长洲区",
"450406": "龙圩区",
"450421": "苍梧县",
"450422": "藤县",
"450423": "蒙山县",
"450481": "岑溪市",
"450482": "其它区",
"450500": "北海市",
"450502": "海城区",
"450503": "银海区",
"450512": "铁山港区",
"450521": "合浦县",
"450522": "其它区",
"450600": "防城港市",
"450602": "港口区",
"450603": "防城区",
"450621": "上思县",
"450681": "东兴市",
"450682": "其它区",
"450700": "钦州市",
"450702": "钦南区",
"450703": "钦北区",
"450721": "灵山县",
"450722": "浦北县",
"450723": "其它区",
"450800": "贵港市",
"450802": "港北区",
"450803": "港南区",
"450804": "覃塘区",
"450821": "平南县",
"450881": "桂平市",
"450882": "其它区",
"450900": "玉林市",
"450902": "玉州区",
"450903": "福绵区",
"450921": "容县",
"450922": "陆川县",
"450923": "博白县",
"450924": "兴业县",
"450981": "北流市",
"450982": "其它区",
"451000": "百色市",
"451002": "右江区",
"451021": "田阳县",
"451022": "田东县",
"451023": "平果县",
"451024": "德保县",
"451025": "靖西县",
"451026": "那坡县",
"451027": "凌云县",
"451028": "乐业县",
"451029": "田林县",
"451030": "西林县",
"451031": "隆林各族自治县",
"451032": "其它区",
"451100": "贺州市",
"451102": "八步区",
"451119": "平桂管理区",
"451121": "昭平县",
"451122": "钟山县",
"451123": "富川瑶族自治县",
"451124": "其它区",
"451200": "河池市",
"451202": "金城江区",
"451221": "南丹县",
"451222": "天峨县",
"451223": "凤山县",
"451224": "东兰县",
"451225": "罗城仫佬族自治县",
"451226": "环江毛南族自治县",
"451227": "巴马瑶族自治县",
"451228": "都安瑶族自治县",
"451229": "大化瑶族自治县",
"451281": "宜州市",
"451282": "其它区",
"451300": "来宾市",
"451302": "兴宾区",
"451321": "忻城县",
"451322": "象州县",
"451323": "武宣县",
"451324": "金秀瑶族自治县",
"451381": "合山市",
"451382": "其它区",
"451400": "崇左市",
"451402": "江州区",
"451421": "扶绥县",
"451422": "宁明县",
"451423": "龙州县",
"451424": "大新县",
"451425": "天等县",
"451481": "凭祥市",
"451482": "其它区",
"460000": "海南省",
"460100": "海口市",
"460105": "秀英区",
"460106": "龙华区",
"460107": "琼山区",
"460108": "美兰区",
"460109": "其它区",
"460200": "三亚市",
"460300": "三沙市",
"460321": "西沙群岛",
"460322": "南沙群岛",
"460323": "中沙群岛的岛礁及其海域",
"469001": "五指山市",
"469002": "琼海市",
"469003": "儋州市",
"469005": "文昌市",
"469006": "万宁市",
"469007": "东方市",
"469025": "定安县",
"469026": "屯昌县",
"469027": "澄迈县",
"469028": "临高县",
"469030": "白沙黎族自治县",
"469031": "昌江黎族自治县",
"469033": "乐东黎族自治县",
"469034": "陵水黎族自治县",
"469035": "保亭黎族苗族自治县",
"469036": "琼中黎族苗族自治县",
"471005": "其它区",
"500000": "重庆",
"500100": "重庆市",
"500101": "万州区",
"500102": "涪陵区",
"500103": "渝中区",
"500104": "大渡口区",
"500105": "江北区",
"500106": "沙坪坝区",
"500107": "九龙坡区",
"500108": "南岸区",
"500109": "北碚区",
"500110": "万盛区",
"500111": "双桥区",
"500112": "渝北区",
"500113": "巴南区",
"500114": "黔江区",
"500115": "长寿区",
"500222": "綦江区",
"500223": "潼南县",
"500224": "铜梁县",
"500225": "大足区",
"500226": "荣昌县",
"500227": "璧山县",
"500228": "梁平县",
"500229": "城口县",
"500230": "丰都县",
"500231": "垫江县",
"500232": "武隆县",
"500233": "忠县",
"500234": "开县",
"500235": "云阳县",
"500236": "奉节县",
"500237": "巫山县",
"500238": "巫溪县",
"500240": "石柱土家族自治县",
"500241": "秀山土家族苗族自治县",
"500242": "酉阳土家族苗族自治县",
"500243": "彭水苗族土家族自治县",
"500381": "江津区",
"500382": "合川区",
"500383": "永川区",
"500384": "南川区",
"500385": "其它区",
"510000": "四川省",
"510100": "成都市",
"510104": "锦江区",
"510105": "青羊区",
"510106": "金牛区",
"510107": "武侯区",
"510108": "成华区",
"510112": "龙泉驿区",
"510113": "青白江区",
"510114": "新都区",
"510115": "温江区",
"510121": "金堂县",
"510122": "双流县",
"510124": "郫县",
"510129": "大邑县",
"510131": "蒲江县",
"510132": "新津县",
"510181": "都江堰市",
"510182": "彭州市",
"510183": "邛崃市",
"510184": "崇州市",
"510185": "其它区",
"510300": "自贡市",
"510302": "自流井区",
"510303": "贡井区",
"510304": "大安区",
"510311": "沿滩区",
"510321": "荣县",
"510322": "富顺县",
"510323": "其它区",
"510400": "攀枝花市",
"510402": "东区",
"510403": "西区",
"510411": "仁和区",
"510421": "米易县",
"510422": "盐边县",
"510423": "其它区",
"510500": "泸州市",
"510502": "江阳区",
"510503": "纳溪区",
"510504": "龙马潭区",
"510521": "泸县",
"510522": "合江县",
"510524": "叙永县",
"510525": "古蔺县",
"510526": "其它区",
"510600": "德阳市",
"510603": "旌阳区",
"510623": "中江县",
"510626": "罗江县",
"510681": "广汉市",
"510682": "什邡市",
"510683": "绵竹市",
"510684": "其它区",
"510700": "绵阳市",
"510703": "涪城区",
"510704": "游仙区",
"510722": "三台县",
"510723": "盐亭县",
"510724": "安县",
"510725": "梓潼县",
"510726": "北川羌族自治县",
"510727": "平武县",
"510781": "江油市",
"510782": "其它区",
"510800": "广元市",
"510802": "利州区",
"510811": "昭化区",
"510812": "朝天区",
"510821": "旺苍县",
"510822": "青川县",
"510823": "剑阁县",
"510824": "苍溪县",
"510825": "其它区",
"510900": "遂宁市",
"510903": "船山区",
"510904": "安居区",
"510921": "蓬溪县",
"510922": "射洪县",
"510923": "大英县",
"510924": "其它区",
"511000": "内江市",
"511002": "市中区",
"511011": "东兴区",
"511024": "威远县",
"511025": "资中县",
"511028": "隆昌县",
"511029": "其它区",
"511100": "乐山市",
"511102": "市中区",
"511111": "沙湾区",
"511112": "五通桥区",
"511113": "金口河区",
"511123": "犍为县",
"511124": "井研县",
"511126": "夹江县",
"511129": "沐川县",
"511132": "峨边彝族自治县",
"511133": "马边彝族自治县",
"511181": "峨眉山市",
"511182": "其它区",
"511300": "南充市",
"511302": "顺庆区",
"511303": "高坪区",
"511304": "嘉陵区",
"511321": "南部县",
"511322": "营山县",
"511323": "蓬安县",
"511324": "仪陇县",
"511325": "西充县",
"511381": "阆中市",
"511382": "其它区",
"511400": "眉山市",
"511402": "东坡区",
"511421": "仁寿县",
"511422": "彭山县",
"511423": "洪雅县",
"511424": "丹棱县",
"511425": "青神县",
"511426": "其它区",
"511500": "宜宾市",
"511502": "翠屏区",
"511521": "宜宾县",
"511522": "南溪区",
"511523": "江安县",
"511524": "长宁县",
"511525": "高县",
"511526": "珙县",
"511527": "筠连县",
"511528": "兴文县",
"511529": "屏山县",
"511530": "其它区",
"511600": "广安市",
"511602": "广安区",
"511603": "前锋区",
"511621": "岳池县",
"511622": "武胜县",
"511623": "邻水县",
"511681": "华蓥市",
"511683": "其它区",
"511700": "达州市",
"511702": "通川区",
"511721": "达川区",
"511722": "宣汉县",
"511723": "开江县",
"511724": "大竹县",
"511725": "渠县",
"511781": "万源市",
"511782": "其它区",
"511800": "雅安市",
"511802": "雨城区",
"511821": "名山区",
"511822": "荥经县",
"511823": "汉源县",
"511824": "石棉县",
"511825": "天全县",
"511826": "芦山县",
"511827": "宝兴县",
"511828": "其它区",
"511900": "巴中市",
"511902": "巴州区",
"511903": "恩阳区",
"511921": "通江县",
"511922": "南江县",
"511923": "平昌县",
"511924": "其它区",
"512000": "资阳市",
"512002": "雁江区",
"512021": "安岳县",
"512022": "乐至县",
"512081": "简阳市",
"512082": "其它区",
"513200": "阿坝藏族羌族自治州",
"513221": "汶川县",
"513222": "理县",
"513223": "茂县",
"513224": "松潘县",
"513225": "九寨沟县",
"513226": "金川县",
"513227": "小金县",
"513228": "黑水县",
"513229": "马尔康县",
"513230": "壤塘县",
"513231": "阿坝县",
"513232": "若尔盖县",
"513233": "红原县",
"513234": "其它区",
"513300": "甘孜藏族自治州",
"513321": "康定县",
"513322": "泸定县",
"513323": "丹巴县",
"513324": "九龙县",
"513325": "雅江县",
"513326": "道孚县",
"513327": "炉霍县",
"513328": "甘孜县",
"513329": "新龙县",
"513330": "德格县",
"513331": "白玉县",
"513332": "石渠县",
"513333": "色达县",
"513334": "理塘县",
"513335": "巴塘县",
"513336": "乡城县",
"513337": "稻城县",
"513338": "得荣县",
"513339": "其它区",
"513400": "凉山彝族自治州",
"513401": "西昌市",
"513422": "木里藏族自治县",
"513423": "盐源县",
"513424": "德昌县",
"513425": "会理县",
"513426": "会东县",
"513427": "宁南县",
"513428": "普格县",
"513429": "布拖县",
"513430": "金阳县",
"513431": "昭觉县",
"513432": "喜德县",
"513433": "冕宁县",
"513434": "越西县",
"513435": "甘洛县",
"513436": "美姑县",
"513437": "雷波县",
"513438": "其它区",
"520000": "贵州省",
"520100": "贵阳市",
"520102": "南明区",
"520103": "云岩区",
"520111": "花溪区",
"520112": "乌当区",
"520113": "白云区",
"520121": "开阳县",
"520122": "息烽县",
"520123": "修文县",
"520151": "观山湖区",
"520181": "清镇市",
"520182": "其它区",
"520200": "六盘水市",
"520201": "钟山区",
"520203": "六枝特区",
"520221": "水城县",
"520222": "盘县",
"520223": "其它区",
"520300": "遵义市",
"520302": "红花岗区",
"520303": "汇川区",
"520321": "遵义县",
"520322": "桐梓县",
"520323": "绥阳县",
"520324": "正安县",
"520325": "道真仡佬族苗族自治县",
"520326": "务川仡佬族苗族自治县",
"520327": "凤冈县",
"520328": "湄潭县",
"520329": "余庆县",
"520330": "习水县",
"520381": "赤水市",
"520382": "仁怀市",
"520383": "其它区",
"520400": "安顺市",
"520402": "西秀区",
"520421": "平坝县",
"520422": "普定县",
"520423": "镇宁布依族苗族自治县",
"520424": "关岭布依族苗族自治县",
"520425": "紫云苗族布依族自治县",
"520426": "其它区",
"522200": "铜仁市",
"522201": "碧江区",
"522222": "江口县",
"522223": "玉屏侗族自治县",
"522224": "石阡县",
"522225": "思南县",
"522226": "印江土家族苗族自治县",
"522227": "德江县",
"522228": "沿河土家族自治县",
"522229": "松桃苗族自治县",
"522230": "万山区",
"522231": "其它区",
"522300": "黔西南布依族苗族自治州",
"522301": "兴义市",
"522322": "兴仁县",
"522323": "普安县",
"522324": "晴隆县",
"522325": "贞丰县",
"522326": "望谟县",
"522327": "册亨县",
"522328": "安龙县",
"522329": "其它区",
"522400": "毕节市",
"522401": "七星关区",
"522422": "大方县",
"522423": "黔西县",
"522424": "金沙县",
"522425": "织金县",
"522426": "纳雍县",
"522427": "威宁彝族回族苗族自治县",
"522428": "赫章县",
"522429": "其它区",
"522600": "黔东南苗族侗族自治州",
"522601": "凯里市",
"522622": "黄平县",
"522623": "施秉县",
"522624": "三穗县",
"522625": "镇远县",
"522626": "岑巩县",
"522627": "天柱县",
"522628": "锦屏县",
"522629": "剑河县",
"522630": "台江县",
"522631": "黎平县",
"522632": "榕江县",
"522633": "从江县",
"522634": "雷山县",
"522635": "麻江县",
"522636": "丹寨县",
"522637": "其它区",
"522700": "黔南布依族苗族自治州",
"522701": "都匀市",
"522702": "福泉市",
"522722": "荔波县",
"522723": "贵定县",
"522725": "瓮安县",
"522726": "独山县",
"522727": "平塘县",
"522728": "罗甸县",
"522729": "长顺县",
"522730": "龙里县",
"522731": "惠水县",
"522732": "三都水族自治县",
"522733": "其它区",
"530000": "云南省",
"530100": "昆明市",
"530102": "五华区",
"530103": "盘龙区",
"530111": "官渡区",
"530112": "西山区",
"530113": "东川区",
"530121": "呈贡区",
"530122": "晋宁县",
"530124": "富民县",
"530125": "宜良县",
"530126": "石林彝族自治县",
"530127": "嵩明县",
"530128": "禄劝彝族苗族自治县",
"530129": "寻甸回族彝族自治县",
"530181": "安宁市",
"530182": "其它区",
"530300": "曲靖市",
"530302": "麒麟区",
"530321": "马龙县",
"530322": "陆良县",
"530323": "师宗县",
"530324": "罗平县",
"530325": "富源县",
"530326": "会泽县",
"530328": "沾益县",
"530381": "宣威市",
"530382": "其它区",
"530400": "玉溪市",
"530402": "红塔区",
"530421": "江川县",
"530422": "澄江县",
"530423": "通海县",
"530424": "华宁县",
"530425": "易门县",
"530426": "峨山彝族自治县",
"530427": "新平彝族傣族自治县",
"530428": "元江哈尼族彝族傣族自治县",
"530429": "其它区",
"530500": "保山市",
"530502": "隆阳区",
"530521": "施甸县",
"530522": "腾冲县",
"530523": "龙陵县",
"530524": "昌宁县",
"530525": "其它区",
"530600": "昭通市",
"530602": "昭阳区",
"530621": "鲁甸县",
"530622": "巧家县",
"530623": "盐津县",
"530624": "大关县",
"530625": "永善县",
"530626": "绥江县",
"530627": "镇雄县",
"530628": "彝良县",
"530629": "威信县",
"530630": "水富县",
"530631": "其它区",
"530700": "丽江市",
"530702": "古城区",
"530721": "玉龙纳西族自治县",
"530722": "永胜县",
"530723": "华坪县",
"530724": "宁蒗彝族自治县",
"530725": "其它区",
"530800": "普洱市",
"530802": "思茅区",
"530821": "宁洱哈尼族彝族自治县",
"530822": "墨江哈尼族自治县",
"530823": "景东彝族自治县",
"530824": "景谷傣族彝族自治县",
"530825": "镇沅彝族哈尼族拉祜族自治县",
"530826": "江城哈尼族彝族自治县",
"530827": "孟连傣族拉祜族佤族自治县",
"530828": "澜沧拉祜族自治县",
"530829": "西盟佤族自治县",
"530830": "其它区",
"530900": "临沧市",
"530902": "临翔区",
"530921": "凤庆县",
"530922": "云县",
"530923": "永德县",
"530924": "镇康县",
"530925": "双江拉祜族佤族布朗族傣族自治县",
"530926": "耿马傣族佤族自治县",
"530927": "沧源佤族自治县",
"530928": "其它区",
"532300": "楚雄彝族自治州",
"532301": "楚雄市",
"532322": "双柏县",
"532323": "牟定县",
"532324": "南华县",
"532325": "姚安县",
"532326": "大姚县",
"532327": "永仁县",
"532328": "元谋县",
"532329": "武定县",
"532331": "禄丰县",
"532332": "其它区",
"532500": "红河哈尼族彝族自治州",
"532501": "个旧市",
"532502": "开远市",
"532522": "蒙自市",
"532523": "屏边苗族自治县",
"532524": "建水县",
"532525": "石屏县",
"532526": "弥勒市",
"532527": "泸西县",
"532528": "元阳县",
"532529": "红河县",
"532530": "金平苗族瑶族傣族自治县",
"532531": "绿春县",
"532532": "河口瑶族自治县",
"532533": "其它区",
"532600": "文山壮族苗族自治州",
"532621": "文山市",
"532622": "砚山县",
"532623": "西畴县",
"532624": "麻栗坡县",
"532625": "马关县",
"532626": "丘北县",
"532627": "广南县",
"532628": "富宁县",
"532629": "其它区",
"532800": "西双版纳傣族自治州",
"532801": "景洪市",
"532822": "勐海县",
"532823": "勐腊县",
"532824": "其它区",
"532900": "大理白族自治州",
"532901": "大理市",
"532922": "漾濞彝族自治县",
"532923": "祥云县",
"532924": "宾川县",
"532925": "弥渡县",
"532926": "南涧彝族自治县",
"532927": "巍山彝族回族自治县",
"532928": "永平县",
"532929": "云龙县",
"532930": "洱源县",
"532931": "剑川县",
"532932": "鹤庆县",
"532933": "其它区",
"533100": "德宏傣族景颇族自治州",
"533102": "瑞丽市",
"533103": "芒市",
"533122": "梁河县",
"533123": "盈江县",
"533124": "陇川县",
"533125": "其它区",
"533300": "怒江傈僳族自治州",
"533321": "泸水县",
"533323": "福贡县",
"533324": "贡山独龙族怒族自治县",
"533325": "兰坪白族普米族自治县",
"533326": "其它区",
"533400": "迪庆藏族自治州",
"533421": "香格里拉县",
"533422": "德钦县",
"533423": "维西傈僳族自治县",
"533424": "其它区",
"540000": "西藏自治区",
"540100": "拉萨市",
"540102": "城关区",
"540121": "林周县",
"540122": "当雄县",
"540123": "尼木县",
"540124": "曲水县",
"540125": "堆龙德庆县",
"540126": "达孜县",
"540127": "墨竹工卡县",
"540128": "其它区",
"542100": "昌都地区",
"542121": "昌都县",
"542122": "江达县",
"542123": "贡觉县",
"542124": "类乌齐县",
"542125": "丁青县",
"542126": "察雅县",
"542127": "八宿县",
"542128": "左贡县",
"542129": "芒康县",
"542132": "洛隆县",
"542133": "边坝县",
"542134": "其它区",
"542200": "山南地区",
"542221": "乃东县",
"542222": "扎囊县",
"542223": "贡嘎县",
"542224": "桑日县",
"542225": "琼结县",
"542226": "曲松县",
"542227": "措美县",
"542228": "洛扎县",
"542229": "加查县",
"542231": "隆子县",
"542232": "错那县",
"542233": "浪卡子县",
"542234": "其它区",
"542300": "日喀则地区",
"542301": "日喀则市",
"542322": "南木林县",
"542323": "江孜县",
"542324": "定日县",
"542325": "萨迦县",
"542326": "拉孜县",
"542327": "昂仁县",
"542328": "谢通门县",
"542329": "白朗县",
"542330": "仁布县",
"542331": "康马县",
"542332": "定结县",
"542333": "仲巴县",
"542334": "亚东县",
"542335": "吉隆县",
"542336": "聂拉木县",
"542337": "萨嘎县",
"542338": "岗巴县",
"542339": "其它区",
"542400": "那曲地区",
"542421": "那曲县",
"542422": "嘉黎县",
"542423": "比如县",
"542424": "聂荣县",
"542425": "安多县",
"542426": "申扎县",
"542427": "索县",
"542428": "班戈县",
"542429": "巴青县",
"542430": "尼玛县",
"542431": "其它区",
"542432": "双湖县",
"542500": "阿里地区",
"542521": "普兰县",
"542522": "札达县",
"542523": "噶尔县",
"542524": "日土县",
"542525": "革吉县",
"542526": "改则县",
"542527": "措勤县",
"542528": "其它区",
"542600": "林芝地区",
"542621": "林芝县",
"542622": "工布江达县",
"542623": "米林县",
"542624": "墨脱县",
"542625": "波密县",
"542626": "察隅县",
"542627": "朗县",
"542628": "其它区",
"610000": "陕西省",
"610100": "西安市",
"610102": "新城区",
"610103": "碑林区",
"610104": "莲湖区",
"610111": "灞桥区",
"610112": "未央区",
"610113": "雁塔区",
"610114": "阎良区",
"610115": "临潼区",
"610116": "长安区",
"610122": "蓝田县",
"610124": "周至县",
"610125": "户县",
"610126": "高陵县",
"610127": "其它区",
"610200": "铜川市",
"610202": "王益区",
"610203": "印台区",
"610204": "耀州区",
"610222": "宜君县",
"610223": "其它区",
"610300": "宝鸡市",
"610302": "渭滨区",
"610303": "金台区",
"610304": "陈仓区",
"610322": "凤翔县",
"610323": "岐山县",
"610324": "扶风县",
"610326": "眉县",
"610327": "陇县",
"610328": "千阳县",
"610329": "麟游县",
"610330": "凤县",
"610331": "太白县",
"610332": "其它区",
"610400": "咸阳市",
"610402": "秦都区",
"610403": "杨陵区",
"610404": "渭城区",
"610422": "三原县",
"610423": "泾阳县",
"610424": "乾县",
"610425": "礼泉县",
"610426": "永寿县",
"610427": "彬县",
"610428": "长武县",
"610429": "旬邑县",
"610430": "淳化县",
"610431": "武功县",
"610481": "兴平市",
"610482": "其它区",
"610500": "渭南市",
"610502": "临渭区",
"610521": "华县",
"610522": "潼关县",
"610523": "大荔县",
"610524": "合阳县",
"610525": "澄城县",
"610526": "蒲城县",
"610527": "白水县",
"610528": "富平县",
"610581": "韩城市",
"610582": "华阴市",
"610583": "其它区",
"610600": "延安市",
"610602": "宝塔区",
"610621": "延长县",
"610622": "延川县",
"610623": "子长县",
"610624": "安塞县",
"610625": "志丹县",
"610626": "吴起县",
"610627": "甘泉县",
"610628": "富县",
"610629": "洛川县",
"610630": "宜川县",
"610631": "黄龙县",
"610632": "黄陵县",
"610633": "其它区",
"610700": "汉中市",
"610702": "汉台区",
"610721": "南郑县",
"610722": "城固县",
"610723": "洋县",
"610724": "西乡县",
"610725": "勉县",
"610726": "宁强县",
"610727": "略阳县",
"610728": "镇巴县",
"610729": "留坝县",
"610730": "佛坪县",
"610731": "其它区",
"610800": "榆林市",
"610802": "榆阳区",
"610821": "神木县",
"610822": "府谷县",
"610823": "横山县",
"610824": "靖边县",
"610825": "定边县",
"610826": "绥德县",
"610827": "米脂县",
"610828": "佳县",
"610829": "吴堡县",
"610830": "清涧县",
"610831": "子洲县",
"610832": "其它区",
"610900": "安康市",
"610902": "汉滨区",
"610921": "汉阴县",
"610922": "石泉县",
"610923": "宁陕县",
"610924": "紫阳县",
"610925": "岚皋县",
"610926": "平利县",
"610927": "镇坪县",
"610928": "旬阳县",
"610929": "白河县",
"610930": "其它区",
"611000": "商洛市",
"611002": "商州区",
"611021": "洛南县",
"611022": "丹凤县",
"611023": "商南县",
"611024": "山阳县",
"611025": "镇安县",
"611026": "柞水县",
"611027": "其它区",
"620000": "甘肃省",
"620100": "兰州市",
"620102": "城关区",
"620103": "七里河区",
"620104": "西固区",
"620105": "安宁区",
"620111": "红古区",
"620121": "永登县",
"620122": "皋兰县",
"620123": "榆中县",
"620124": "其它区",
"620200": "嘉峪关市",
"620300": "金昌市",
"620302": "金川区",
"620321": "永昌县",
"620322": "其它区",
"620400": "白银市",
"620402": "白银区",
"620403": "平川区",
"620421": "靖远县",
"620422": "会宁县",
"620423": "景泰县",
"620424": "其它区",
"620500": "天水市",
"620502": "秦州区",
"620503": "麦积区",
"620521": "清水县",
"620522": "秦安县",
"620523": "甘谷县",
"620524": "武山县",
"620525": "张家川回族自治县",
"620526": "其它区",
"620600": "武威市",
"620602": "凉州区",
"620621": "民勤县",
"620622": "古浪县",
"620623": "天祝藏族自治县",
"620624": "其它区",
"620700": "张掖市",
"620702": "甘州区",
"620721": "肃南裕固族自治县",
"620722": "民乐县",
"620723": "临泽县",
"620724": "高台县",
"620725": "山丹县",
"620726": "其它区",
"620800": "平凉市",
"620802": "崆峒区",
"620821": "泾川县",
"620822": "灵台县",
"620823": "崇信县",
"620824": "华亭县",
"620825": "庄浪县",
"620826": "静宁县",
"620827": "其它区",
"620900": "酒泉市",
"620902": "肃州区",
"620921": "金塔县",
"620922": "瓜州县",
"620923": "肃北蒙古族自治县",
"620924": "阿克塞哈萨克族自治县",
"620981": "玉门市",
"620982": "敦煌市",
"620983": "其它区",
"621000": "庆阳市",
"621002": "西峰区",
"621021": "庆城县",
"621022": "环县",
"621023": "华池县",
"621024": "合水县",
"621025": "正宁县",
"621026": "宁县",
"621027": "镇原县",
"621028": "其它区",
"621100": "定西市",
"621102": "安定区",
"621121": "通渭县",
"621122": "陇西县",
"621123": "渭源县",
"621124": "临洮县",
"621125": "漳县",
"621126": "岷县",
"621127": "其它区",
"621200": "陇南市",
"621202": "武都区",
"621221": "成县",
"621222": "文县",
"621223": "宕昌县",
"621224": "康县",
"621225": "西和县",
"621226": "礼县",
"621227": "徽县",
"621228": "两当县",
"621229": "其它区",
"622900": "临夏回族自治州",
"622901": "临夏市",
"622921": "临夏县",
"622922": "康乐县",
"622923": "永靖县",
"622924": "广河县",
"622925": "和政县",
"622926": "东乡族自治县",
"622927": "积石山保安族东乡族撒拉族自治县",
"622928": "其它区",
"623000": "甘南藏族自治州",
"623001": "合作市",
"623021": "临潭县",
"623022": "卓尼县",
"623023": "舟曲县",
"623024": "迭部县",
"623025": "玛曲县",
"623026": "碌曲县",
"623027": "夏河县",
"623028": "其它区",
"630000": "青海省",
"630100": "西宁市",
"630102": "城东区",
"630103": "城中区",
"630104": "城西区",
"630105": "城北区",
"630121": "大通回族土族自治县",
"630122": "湟中县",
"630123": "湟源县",
"630124": "其它区",
"632100": "海东市",
"632121": "平安县",
"632122": "民和回族土族自治县",
"632123": "乐都区",
"632126": "互助土族自治县",
"632127": "化隆回族自治县",
"632128": "循化撒拉族自治县",
"632129": "其它区",
"632200": "海北藏族自治州",
"632221": "门源回族自治县",
"632222": "祁连县",
"632223": "海晏县",
"632224": "刚察县",
"632225": "其它区",
"632300": "黄南藏族自治州",
"632321": "同仁县",
"632322": "尖扎县",
"632323": "泽库县",
"632324": "河南蒙古族自治县",
"632325": "其它区",
"632500": "海南藏族自治州",
"632521": "共和县",
"632522": "同德县",
"632523": "贵德县",
"632524": "兴海县",
"632525": "贵南县",
"632526": "其它区",
"632600": "果洛藏族自治州",
"632621": "玛沁县",
"632622": "班玛县",
"632623": "甘德县",
"632624": "达日县",
"632625": "久治县",
"632626": "玛多县",
"632627": "其它区",
"632700": "玉树藏族自治州",
"632721": "玉树市",
"632722": "杂多县",
"632723": "称多县",
"632724": "治多县",
"632725": "囊谦县",
"632726": "曲麻莱县",
"632727": "其它区",
"632800": "海西蒙古族藏族自治州",
"632801": "格尔木市",
"632802": "德令哈市",
"632821": "乌兰县",
"632822": "都兰县",
"632823": "天峻县",
"632824": "其它区",
"640000": "宁夏回族自治区",
"640100": "银川市",
"640104": "兴庆区",
"640105": "西夏区",
"640106": "金凤区",
"640121": "永宁县",
"640122": "贺兰县",
"640181": "灵武市",
"640182": "其它区",
"640200": "石嘴山市",
"640202": "大武口区",
"640205": "惠农区",
"640221": "平罗县",
"640222": "其它区",
"640300": "吴忠市",
"640302": "利通区",
"640303": "红寺堡区",
"640323": "盐池县",
"640324": "同心县",
"640381": "青铜峡市",
"640382": "其它区",
"640400": "固原市",
"640402": "原州区",
"640422": "西吉县",
"640423": "隆德县",
"640424": "泾源县",
"640425": "彭阳县",
"640426": "其它区",
"640500": "中卫市",
"640502": "沙坡头区",
"640521": "中宁县",
"640522": "海原县",
"640523": "其它区",
"650000": "新疆维吾尔自治区",
"650100": "乌鲁木齐市",
"650102": "天山区",
"650103": "沙依巴克区",
"650104": "新市区",
"650105": "水磨沟区",
"650106": "头屯河区",
"650107": "达坂城区",
"650109": "米东区",
"650121": "乌鲁木齐县",
"650122": "其它区",
"650200": "克拉玛依市",
"650202": "独山子区",
"650203": "克拉玛依区",
"650204": "白碱滩区",
"650205": "乌尔禾区",
"650206": "其它区",
"652100": "吐鲁番地区",
"652101": "吐鲁番市",
"652122": "鄯善县",
"652123": "托克逊县",
"652124": "其它区",
"652200": "哈密地区",
"652201": "哈密市",
"652222": "巴里坤哈萨克自治县",
"652223": "伊吾县",
"652224": "其它区",
"652300": "昌吉回族自治州",
"652301": "昌吉市",
"652302": "阜康市",
"652323": "呼图壁县",
"652324": "玛纳斯县",
"652325": "奇台县",
"652327": "吉木萨尔县",
"652328": "木垒哈萨克自治县",
"652329": "其它区",
"652700": "博尔塔拉蒙古自治州",
"652701": "博乐市",
"652702": "阿拉山口市",
"652722": "精河县",
"652723": "温泉县",
"652724": "其它区",
"652800": "巴音郭楞蒙古自治州",
"652801": "库尔勒市",
"652822": "轮台县",
"652823": "尉犁县",
"652824": "若羌县",
"652825": "且末县",
"652826": "焉耆回族自治县",
"652827": "和静县",
"652828": "和硕县",
"652829": "博湖县",
"652830": "其它区",
"652900": "阿克苏地区",
"652901": "阿克苏市",
"652922": "温宿县",
"652923": "库车县",
"652924": "沙雅县",
"652925": "新和县",
"652926": "拜城县",
"652927": "乌什县",
"652928": "阿瓦提县",
"652929": "柯坪县",
"652930": "其它区",
"653000": "克孜勒苏柯尔克孜自治州",
"653001": "阿图什市",
"653022": "阿克陶县",
"653023": "阿合奇县",
"653024": "乌恰县",
"653025": "其它区",
"653100": "喀什地区",
"653101": "喀什市",
"653121": "疏附县",
"653122": "疏勒县",
"653123": "英吉沙县",
"653124": "泽普县",
"653125": "莎车县",
"653126": "叶城县",
"653127": "麦盖提县",
"653128": "岳普湖县",
"653129": "伽师县",
"653130": "巴楚县",
"653131": "塔什库尔干塔吉克自治县",
"653132": "其它区",
"653200": "和田地区",
"653201": "和田市",
"653221": "和田县",
"653222": "墨玉县",
"653223": "皮山县",
"653224": "洛浦县",
"653225": "策勒县",
"653226": "于田县",
"653227": "民丰县",
"653228": "其它区",
"654000": "伊犁哈萨克自治州",
"654002": "伊宁市",
"654003": "奎屯市",
"654021": "伊宁县",
"654022": "察布查尔锡伯自治县",
"654023": "霍城县",
"654024": "巩留县",
"654025": "新源县",
"654026": "昭苏县",
"654027": "特克斯县",
"654028": "尼勒克县",
"654029": "其它区",
"654200": "塔城地区",
"654201": "塔城市",
"654202": "乌苏市",
"654221": "额敏县",
"654223": "沙湾县",
"654224": "托里县",
"654225": "裕民县",
"654226": "和布克赛尔蒙古自治县",
"654227": "其它区",
"654300": "阿勒泰地区",
"654301": "阿勒泰市",
"654321": "布尔津县",
"654322": "富蕴县",
"654323": "福海县",
"654324": "哈巴河县",
"654325": "青河县",
"654326": "吉木乃县",
"654327": "其它区",
"659001": "石河子市",
"659002": "阿拉尔市",
"659003": "图木舒克市",
"659004": "五家渠市",
"710000": "台湾",
"710100": "台北市",
"710101": "中正区",
"710102": "大同区",
"710103": "中山区",
"710104": "松山区",
"710105": "大安区",
"710106": "万华区",
"710107": "信义区",
"710108": "士林区",
"710109": "北投区",
"710110": "内湖区",
"710111": "南港区",
"710112": "文山区",
"710113": "其它区",
"710200": "高雄市",
"710201": "新兴区",
"710202": "前金区",
"710203": "芩雅区",
"710204": "盐埕区",
"710205": "鼓山区",
"710206": "旗津区",
"710207": "前镇区",
"710208": "三民区",
"710209": "左营区",
"710210": "楠梓区",
"710211": "小港区",
"710212": "其它区",
"710241": "苓雅区",
"710242": "仁武区",
"710243": "大社区",
"710244": "冈山区",
"710245": "路竹区",
"710246": "阿莲区",
"710247": "田寮区",
"710248": "燕巢区",
"710249": "桥头区",
"710250": "梓官区",
"710251": "弥陀区",
"710252": "永安区",
"710253": "湖内区",
"710254": "凤山区",
"710255": "大寮区",
"710256": "林园区",
"710257": "鸟松区",
"710258": "大树区",
"710259": "旗山区",
"710260": "美浓区",
"710261": "六龟区",
"710262": "内门区",
"710263": "杉林区",
"710264": "甲仙区",
"710265": "桃源区",
"710266": "那玛夏区",
"710267": "茂林区",
"710268": "茄萣区",
"710300": "台南市",
"710301": "中西区",
"710302": "东区",
"710303": "南区",
"710304": "北区",
"710305": "安平区",
"710306": "安南区",
"710307": "其它区",
"710339": "永康区",
"710340": "归仁区",
"710341": "新化区",
"710342": "左镇区",
"710343": "玉井区",
"710344": "楠西区",
"710345": "南化区",
"710346": "仁德区",
"710347": "关庙区",
"710348": "龙崎区",
"710349": "官田区",
"710350": "麻豆区",
"710351": "佳里区",
"710352": "西港区",
"710353": "七股区",
"710354": "将军区",
"710355": "学甲区",
"710356": "北门区",
"710357": "新营区",
"710358": "后壁区",
"710359": "白河区",
"710360": "东山区",
"710361": "六甲区",
"710362": "下营区",
"710363": "柳营区",
"710364": "盐水区",
"710365": "善化区",
"710366": "大内区",
"710367": "山上区",
"710368": "新市区",
"710369": "安定区",
"710400": "台中市",
"710401": "中区",
"710402": "东区",
"710403": "南区",
"710404": "西区",
"710405": "北区",
"710406": "北屯区",
"710407": "西屯区",
"710408": "南屯区",
"710409": "其它区",
"710431": "太平区",
"710432": "大里区",
"710433": "雾峰区",
"710434": "乌日区",
"710435": "丰原区",
"710436": "后里区",
"710437": "石冈区",
"710438": "东势区",
"710439": "和平区",
"710440": "新社区",
"710441": "潭子区",
"710442": "大雅区",
"710443": "神冈区",
"710444": "大肚区",
"710445": "沙鹿区",
"710446": "龙井区",
"710447": "梧栖区",
"710448": "清水区",
"710449": "大甲区",
"710450": "外埔区",
"710451": "大安区",
"710500": "金门县",
"710507": "金沙镇",
"710508": "金湖镇",
"710509": "金宁乡",
"710510": "金城镇",
"710511": "烈屿乡",
"710512": "乌坵乡",
"710600": "南投县",
"710614": "南投市",
"710615": "中寮乡",
"710616": "草屯镇",
"710617": "国姓乡",
"710618": "埔里镇",
"710619": "仁爱乡",
"710620": "名间乡",
"710621": "集集镇",
"710622": "水里乡",
"710623": "鱼池乡",
"710624": "信义乡",
"710625": "竹山镇",
"710626": "鹿谷乡",
"710700": "基隆市",
"710701": "仁爱区",
"710702": "信义区",
"710703": "中正区",
"710704": "中山区",
"710705": "安乐区",
"710706": "暖暖区",
"710707": "七堵区",
"710708": "其它区",
"710800": "新竹市",
"710801": "东区",
"710802": "北区",
"710803": "香山区",
"710804": "其它区",
"710900": "嘉义市",
"710901": "东区",
"710902": "西区",
"710903": "其它区",
"711100": "新北市",
"711130": "万里区",
"711131": "金山区",
"711132": "板桥区",
"711133": "汐止区",
"711134": "深坑区",
"711135": "石碇区",
"711136": "瑞芳区",
"711137": "平溪区",
"711138": "双溪区",
"711139": "贡寮区",
"711140": "新店区",
"711141": "坪林区",
"711142": "乌来区",
"711143": "永和区",
"711144": "中和区",
"711145": "土城区",
"711146": "三峡区",
"711147": "树林区",
"711148": "莺歌区",
"711149": "三重区",
"711150": "新庄区",
"711151": "泰山区",
"711152": "林口区",
"711153": "芦洲区",
"711154": "五股区",
"711155": "八里区",
"711156": "淡水区",
"711157": "三芝区",
"711158": "石门区",
"711200": "宜兰县",
"711214": "宜兰市",
"711215": "头城镇",
"711216": "礁溪乡",
"711217": "壮围乡",
"711218": "员山乡",
"711219": "罗东镇",
"711220": "三星乡",
"711221": "大同乡",
"711222": "五结乡",
"711223": "冬山乡",
"711224": "苏澳镇",
"711225": "南澳乡",
"711226": "钓鱼台",
"711300": "新竹县",
"711314": "竹北市",
"711315": "湖口乡",
"711316": "新丰乡",
"711317": "新埔镇",
"711318": "关西镇",
"711319": "芎林乡",
"711320": "宝山乡",
"711321": "竹东镇",
"711322": "五峰乡",
"711323": "横山乡",
"711324": "尖石乡",
"711325": "北埔乡",
"711326": "峨眉乡",
"711400": "桃园县",
"711414": "中坜市",
"711415": "平镇市",
"711416": "龙潭乡",
"711417": "杨梅市",
"711418": "新屋乡",
"711419": "观音乡",
"711420": "桃园市",
"711421": "龟山乡",
"711422": "八德市",
"711423": "大溪镇",
"711424": "复兴乡",
"711425": "大园乡",
"711426": "芦竹乡",
"711500": "苗栗县",
"711519": "竹南镇",
"711520": "头份镇",
"711521": "三湾乡",
"711522": "南庄乡",
"711523": "狮潭乡",
"711524": "后龙镇",
"711525": "通霄镇",
"711526": "苑里镇",
"711527": "苗栗市",
"711528": "造桥乡",
"711529": "头屋乡",
"711530": "公馆乡",
"711531": "大湖乡",
"711532": "泰安乡",
"711533": "铜锣乡",
"711534": "三义乡",
"711535": "西湖乡",
"711536": "卓兰镇",
"711700": "彰化县",
"711727": "彰化市",
"711728": "芬园乡",
"711729": "花坛乡",
"711730": "秀水乡",
"711731": "鹿港镇",
"711732": "福兴乡",
"711733": "线西乡",
"711734": "和美镇",
"711735": "伸港乡",
"711736": "员林镇",
"711737": "社头乡",
"711738": "永靖乡",
"711739": "埔心乡",
"711740": "溪湖镇",
"711741": "大村乡",
"711742": "埔盐乡",
"711743": "田中镇",
"711744": "北斗镇",
"711745": "田尾乡",
"711746": "埤头乡",
"711747": "溪州乡",
"711748": "竹塘乡",
"711749": "二林镇",
"711750": "大城乡",
"711751": "芳苑乡",
"711752": "二水乡",
"711900": "嘉义县",
"711919": "番路乡",
"711920": "梅山乡",
"711921": "竹崎乡",
"711922": "阿里山乡",
"711923": "中埔乡",
"711924": "大埔乡",
"711925": "水上乡",
"711926": "鹿草乡",
"711927": "太保市",
"711928": "朴子市",
"711929": "东石乡",
"711930": "六脚乡",
"711931": "新港乡",
"711932": "民雄乡",
"711933": "大林镇",
"711934": "溪口乡",
"711935": "义竹乡",
"711936": "布袋镇",
"712100": "云林县",
"712121": "斗南镇",
"712122": "大埤乡",
"712123": "虎尾镇",
"712124": "土库镇",
"712125": "褒忠乡",
"712126": "东势乡",
"712127": "台西乡",
"712128": "仑背乡",
"712129": "麦寮乡",
"712130": "斗六市",
"712131": "林内乡",
"712132": "古坑乡",
"712133": "莿桐乡",
"712134": "西螺镇",
"712135": "二仑乡",
"712136": "北港镇",
"712137": "水林乡",
"712138": "口湖乡",
"712139": "四湖乡",
"712140": "元长乡",
"712400": "屏东县",
"712434": "屏东市",
"712435": "三地门乡",
"712436": "雾台乡",
"712437": "玛家乡",
"712438": "九如乡",
"712439": "里港乡",
"712440": "高树乡",
"712441": "盐埔乡",
"712442": "长治乡",
"712443": "麟洛乡",
"712444": "竹田乡",
"712445": "内埔乡",
"712446": "万丹乡",
"712447": "潮州镇",
"712448": "泰武乡",
"712449": "来义乡",
"712450": "万峦乡",
"712451": "崁顶乡",
"712452": "新埤乡",
"712453": "南州乡",
"712454": "林边乡",
"712455": "东港镇",
"712456": "琉球乡",
"712457": "佳冬乡",
"712458": "新园乡",
"712459": "枋寮乡",
"712460": "枋山乡",
"712461": "春日乡",
"712462": "狮子乡",
"712463": "车城乡",
"712464": "牡丹乡",
"712465": "恒春镇",
"712466": "满州乡",
"712500": "台东县",
"712517": "台东市",
"712518": "绿岛乡",
"712519": "兰屿乡",
"712520": "延平乡",
"712521": "卑南乡",
"712522": "鹿野乡",
"712523": "关山镇",
"712524": "海端乡",
"712525": "池上乡",
"712526": "东河乡",
"712527": "成功镇",
"712528": "长滨乡",
"712529": "金峰乡",
"712530": "大武乡",
"712531": "达仁乡",
"712532": "太麻里乡",
"712600": "花莲县",
"712615": "花莲市",
"712616": "新城乡",
"712617": "太鲁阁",
"712618": "秀林乡",
"712619": "吉安乡",
"712620": "寿丰乡",
"712621": "凤林镇",
"712622": "光复乡",
"712623": "丰滨乡",
"712624": "瑞穗乡",
"712625": "万荣乡",
"712626": "玉里镇",
"712627": "卓溪乡",
"712628": "富里乡",
"712700": "澎湖县",
"712707": "马公市",
"712708": "西屿乡",
"712709": "望安乡",
"712710": "七美乡",
"712711": "白沙乡",
"712712": "湖西乡",
"712800": "连江县",
"712805": "南竿乡",
"712806": "北竿乡",
"712807": "莒光乡",
"712808": "东引乡",
"810000": "香港特别行政区",
"810100": "香港岛",
"810101": "中西区",
"810102": "湾仔",
"810103": "东区",
"810104": "南区",
"810200": "九龙",
"810201": "九龙城区",
"810202": "油尖旺区",
"810203": "深水埗区",
"810204": "黄大仙区",
"810205": "观塘区",
"810300": "新界",
"810301": "北区",
"810302": "大埔区",
"810303": "沙田区",
"810304": "西贡区",
"810305": "元朗区",
"810306": "屯门区",
"810307": "荃湾区",
"810308": "葵青区",
"810309": "离岛区",
"820000": "澳门特别行政区",
"820100": "澳门半岛",
"820200": "离岛",
"990000": "海外",
"990100": "海外"
}
// id pid/parentId name children
function tree(list) {
var mapped = {}
for (var i = 0, item; i < list.length; i++) {
item = list[i]
if (!item || !item.id) continue
mapped[item.id] = item
}
var result = []
for (var ii = 0; ii < list.length; ii++) {
item = list[ii]
if (!item) continue
/* jshint -W041 */
if (item.pid == undefined && item.parentId == undefined) {
result.push(item)
continue
}
var parent = mapped[item.pid] || mapped[item.parentId]
if (!parent) continue
if (!parent.children) parent.children = []
parent.children.push(item)
}
return result
}
var DICT_FIXED = function () {
var fixed = []
for (var id in DICT) {
var pid = id.slice(2, 6) === '0000' ? undefined :
id.slice(4, 6) == '00' ? (id.slice(0, 2) + '0000') :
id.slice(0, 4) + '00'
fixed.push({
id: id,
pid: pid,
name: DICT[id]
})
}
return tree(fixed)
}()
module.exports = DICT_FIXED
/***/
},
/* 19 */
/***/ function (module, exports, __webpack_require__) {
/*
## Miscellaneous
*/
var DICT = __webpack_require__(18)
module.exports = {
// Dice
d4: function () {
return this.natural(1, 4)
},
d6: function () {
return this.natural(1, 6)
},
d8: function () {
return this.natural(1, 8)
},
d12: function () {
return this.natural(1, 12)
},
d20: function () {
return this.natural(1, 20)
},
d100: function () {
return this.natural(1, 100)
},
/*
随机生成一个 GUID。
http://www.broofa.com/2008/09/javascript-uuid-function/
[UUID 规范](http://www.ietf.org/rfc/rfc4122.txt)
UUIDs (Universally Unique IDentifier)
GUIDs (Globally Unique IDentifier)
The formal definition of the UUID string representation is provided by the following ABNF [7]:
UUID = time-low "-" time-mid "-"
time-high-and-version "-"
clock-seq-and-reserved
clock-seq-low "-" node
time-low = 4hexOctet
time-mid = 2hexOctet
time-high-and-version = 2hexOctet
clock-seq-and-reserved = hexOctet
clock-seq-low = hexOctet
node = 6hexOctet
hexOctet = hexDigit hexDigit
hexDigit =
"0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" /
"a" / "b" / "c" / "d" / "e" / "f" /
"A" / "B" / "C" / "D" / "E" / "F"
https://github.com/victorquinn/chancejs/blob/develop/chance.js#L1349
*/
guid: function () {
var pool = "abcdefABCDEF1234567890",
guid = this.string(pool, 8) + '-' +
this.string(pool, 4) + '-' +
this.string(pool, 4) + '-' +
this.string(pool, 4) + '-' +
this.string(pool, 12);
return guid
},
uuid: function () {
return this.guid()
},
/*
随机生成一个 18 位身份证。
[身份证](http://baike.baidu.com/view/1697.htm#4)
地址码 6 + 出生日期码 8 + 顺序码 3 + 校验码 1
[《中华人民共和国行政区划代码》国家标准(GB/T2260)](http://zhidao.baidu.com/question/1954561.html)
*/
id: function () {
var id,
sum = 0,
rank = [
"7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9", "10", "5", "8", "4", "2"
],
last = [
"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"
]
id = this.pick(DICT).id +
this.date('yyyyMMdd') +
this.string('number', 3)
for (var i = 0; i < id.length; i++) {
sum += id[i] * rank[i];
}
id += last[sum % 11];
return id
},
/*
生成一个全局的自增整数。
类似自增主键(auto increment primary key)。
*/
increment: function () {
var key = 0
return function (step) {
return key += (+step || 1) // step?
}
}(),
inc: function (step) {
return this.increment(step)
}
}
/***/
},
/* 20 */
/***/ function (module, exports, __webpack_require__) {
var Parser = __webpack_require__(21)
var Handler = __webpack_require__(22)
module.exports = {
Parser: Parser,
Handler: Handler
}
/***/
},
/* 21 */
/***/ function (module, exports) {
// https://github.com/nuysoft/regexp
// forked from https://github.com/ForbesLindesay/regexp
function parse(n) {
if ("string" != typeof n) {
var l = new TypeError("The regexp to parse must be represented as a string.");
throw l;
}
return index = 1, cgs = {}, parser.parse(n);
}
function Token(n) {
this.type = n, this.offset = Token.offset(), this.text = Token.text();
}
function Alternate(n, l) {
Token.call(this, "alternate"), this.left = n, this.right = l;
}
function Match(n) {
Token.call(this, "match"), this.body = n.filter(Boolean);
}
function Group(n, l) {
Token.call(this, n), this.body = l;
}
function CaptureGroup(n) {
Group.call(this, "capture-group"), this.index = cgs[this.offset] || (cgs[this.offset] = index++),
this.body = n;
}
function Quantified(n, l) {
Token.call(this, "quantified"), this.body = n, this.quantifier = l;
}
function Quantifier(n, l) {
Token.call(this, "quantifier"), this.min = n, this.max = l, this.greedy = !0;
}
function CharSet(n, l) {
Token.call(this, "charset"), this.invert = n, this.body = l;
}
function CharacterRange(n, l) {
Token.call(this, "range"), this.start = n, this.end = l;
}
function Literal(n) {
Token.call(this, "literal"), this.body = n, this.escaped = this.body != this.text;
}
function Unicode(n) {
Token.call(this, "unicode"), this.code = n.toUpperCase();
}
function Hex(n) {
Token.call(this, "hex"), this.code = n.toUpperCase();
}
function Octal(n) {
Token.call(this, "octal"), this.code = n.toUpperCase();
}
function BackReference(n) {
Token.call(this, "back-reference"), this.code = n.toUpperCase();
}
function ControlCharacter(n) {
Token.call(this, "control-character"), this.code = n.toUpperCase();
}
var parser = function () {
function n(n, l) {
function u() {
this.constructor = n;
}
u.prototype = l.prototype, n.prototype = new u();
}
function l(n, l, u, t, r) {
function e(n, l) {
function u(n) {
function l(n) {
return n.charCodeAt(0).toString(16).toUpperCase();
}
return n.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\x08/g, "\\b").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\f/g, "\\f").replace(/\r/g, "\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g, function (n) {
return "\\x0" + l(n);
}).replace(/[\x10-\x1F\x80-\xFF]/g, function (n) {
return "\\x" + l(n);
}).replace(/[\u0180-\u0FFF]/g, function (n) {
return "\\u0" + l(n);
}).replace(/[\u1080-\uFFFF]/g, function (n) {
return "\\u" + l(n);
});
}
var t, r;
switch (n.length) {
case 0:
t = "end of input";
break;
case 1:
t = n[0];
break;
default:
t = n.slice(0, -1).join(", ") + " or " + n[n.length - 1];
}
return r = l ? '"' + u(l) + '"' : "end of input", "Expected " + t + " but " + r + " found.";
}
this.expected = n, this.found = l, this.offset = u, this.line = t, this.column = r,
this.name = "SyntaxError", this.message = e(n, l);
}
function u(n) {
function u() {
return n.substring(Lt, qt);
}
function t() {
return Lt;
}
function r(l) {
function u(l, u, t) {
var r, e;
for (r = u; t > r; r++) e = n.charAt(r), "\n" === e ? (l.seenCR || l.line++ , l.column = 1,
l.seenCR = !1) : "\r" === e || "\u2028" === e || "\u2029" === e ? (l.line++ , l.column = 1,
l.seenCR = !0) : (l.column++ , l.seenCR = !1);
}
return Mt !== l && (Mt > l && (Mt = 0, Dt = {
line: 1,
column: 1,
seenCR: !1
}), u(Dt, Mt, l), Mt = l), Dt;
}
function e(n) {
Ht > qt || (qt > Ht && (Ht = qt, Ot = []), Ot.push(n));
}
function o(n) {
var l = 0;
for (n.sort(); l < n.length;) n[l - 1] === n[l] ? n.splice(l, 1) : l++;
}
function c() {
var l, u, t, r, o;
return l = qt, u = i(), null !== u ? (t = qt, 124 === n.charCodeAt(qt) ? (r = fl,
qt++) : (r = null, 0 === Wt && e(sl)), null !== r ? (o = c(), null !== o ? (r = [r, o],
t = r) : (qt = t, t = il)) : (qt = t, t = il), null === t && (t = al), null !== t ? (Lt = l,
u = hl(u, t), null === u ? (qt = l, l = u) : l = u) : (qt = l, l = il)) : (qt = l,
l = il), l;
}
function i() {
var n, l, u, t, r;
if (n = qt, l = f(), null === l && (l = al), null !== l) if (u = qt, Wt++ , t = d(),
Wt-- , null === t ? u = al : (qt = u, u = il), null !== u) {
for (t = [], r = h(), null === r && (r = a()); null !== r;) t.push(r), r = h(),
null === r && (r = a());
null !== t ? (r = s(), null === r && (r = al), null !== r ? (Lt = n, l = dl(l, t, r),
null === l ? (qt = n, n = l) : n = l) : (qt = n, n = il)) : (qt = n, n = il);
} else qt = n, n = il; else qt = n, n = il;
return n;
}
function a() {
var n;
return n = x(), null === n && (n = Q(), null === n && (n = B())), n;
}
function f() {
var l, u;
return l = qt, 94 === n.charCodeAt(qt) ? (u = pl, qt++) : (u = null, 0 === Wt && e(vl)),
null !== u && (Lt = l, u = wl()), null === u ? (qt = l, l = u) : l = u, l;
}
function s() {
var l, u;
return l = qt, 36 === n.charCodeAt(qt) ? (u = Al, qt++) : (u = null, 0 === Wt && e(Cl)),
null !== u && (Lt = l, u = gl()), null === u ? (qt = l, l = u) : l = u, l;
}
function h() {
var n, l, u;
return n = qt, l = a(), null !== l ? (u = d(), null !== u ? (Lt = n, l = bl(l, u),
null === l ? (qt = n, n = l) : n = l) : (qt = n, n = il)) : (qt = n, n = il), n;
}
function d() {
var n, l, u;
return Wt++ , n = qt, l = p(), null !== l ? (u = k(), null === u && (u = al), null !== u ? (Lt = n,
l = Tl(l, u), null === l ? (qt = n, n = l) : n = l) : (qt = n, n = il)) : (qt = n,
n = il), Wt-- , null === n && (l = null, 0 === Wt && e(kl)), n;
}
function p() {
var n;
return n = v(), null === n && (n = w(), null === n && (n = A(), null === n && (n = C(),
null === n && (n = g(), null === n && (n = b()))))), n;
}
function v() {
var l, u, t, r, o, c;
return l = qt, 123 === n.charCodeAt(qt) ? (u = xl, qt++) : (u = null, 0 === Wt && e(yl)),
null !== u ? (t = T(), null !== t ? (44 === n.charCodeAt(qt) ? (r = ml, qt++) : (r = null,
0 === Wt && e(Rl)), null !== r ? (o = T(), null !== o ? (125 === n.charCodeAt(qt) ? (c = Fl,
qt++) : (c = null, 0 === Wt && e(Ql)), null !== c ? (Lt = l, u = Sl(t, o), null === u ? (qt = l,
l = u) : l = u) : (qt = l, l = il)) : (qt = l, l = il)) : (qt = l, l = il)) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
function w() {
var l, u, t, r;
return l = qt, 123 === n.charCodeAt(qt) ? (u = xl, qt++) : (u = null, 0 === Wt && e(yl)),
null !== u ? (t = T(), null !== t ? (n.substr(qt, 2) === Ul ? (r = Ul, qt += 2) : (r = null,
0 === Wt && e(El)), null !== r ? (Lt = l, u = Gl(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il)) : (qt = l, l = il), l;
}
function A() {
var l, u, t, r;
return l = qt, 123 === n.charCodeAt(qt) ? (u = xl, qt++) : (u = null, 0 === Wt && e(yl)),
null !== u ? (t = T(), null !== t ? (125 === n.charCodeAt(qt) ? (r = Fl, qt++) : (r = null,
0 === Wt && e(Ql)), null !== r ? (Lt = l, u = Bl(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il)) : (qt = l, l = il), l;
}
function C() {
var l, u;
return l = qt, 43 === n.charCodeAt(qt) ? (u = jl, qt++) : (u = null, 0 === Wt && e($l)),
null !== u && (Lt = l, u = ql()), null === u ? (qt = l, l = u) : l = u, l;
}
function g() {
var l, u;
return l = qt, 42 === n.charCodeAt(qt) ? (u = Ll, qt++) : (u = null, 0 === Wt && e(Ml)),
null !== u && (Lt = l, u = Dl()), null === u ? (qt = l, l = u) : l = u, l;
}
function b() {
var l, u;
return l = qt, 63 === n.charCodeAt(qt) ? (u = Hl, qt++) : (u = null, 0 === Wt && e(Ol)),
null !== u && (Lt = l, u = Wl()), null === u ? (qt = l, l = u) : l = u, l;
}
function k() {
var l;
return 63 === n.charCodeAt(qt) ? (l = Hl, qt++) : (l = null, 0 === Wt && e(Ol)),
l;
}
function T() {
var l, u, t;
if (l = qt, u = [], zl.test(n.charAt(qt)) ? (t = n.charAt(qt), qt++) : (t = null,
0 === Wt && e(Il)), null !== t) for (; null !== t;) u.push(t), zl.test(n.charAt(qt)) ? (t = n.charAt(qt),
qt++) : (t = null, 0 === Wt && e(Il)); else u = il;
return null !== u && (Lt = l, u = Jl(u)), null === u ? (qt = l, l = u) : l = u,
l;
}
function x() {
var l, u, t, r;
return l = qt, 40 === n.charCodeAt(qt) ? (u = Kl, qt++) : (u = null, 0 === Wt && e(Nl)),
null !== u ? (t = R(), null === t && (t = F(), null === t && (t = m(), null === t && (t = y()))),
null !== t ? (41 === n.charCodeAt(qt) ? (r = Pl, qt++) : (r = null, 0 === Wt && e(Vl)),
null !== r ? (Lt = l, u = Xl(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il)) : (qt = l, l = il), l;
}
function y() {
var n, l;
return n = qt, l = c(), null !== l && (Lt = n, l = Yl(l)), null === l ? (qt = n,
n = l) : n = l, n;
}
function m() {
var l, u, t;
return l = qt, n.substr(qt, 2) === Zl ? (u = Zl, qt += 2) : (u = null, 0 === Wt && e(_l)),
null !== u ? (t = c(), null !== t ? (Lt = l, u = nu(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
function R() {
var l, u, t;
return l = qt, n.substr(qt, 2) === lu ? (u = lu, qt += 2) : (u = null, 0 === Wt && e(uu)),
null !== u ? (t = c(), null !== t ? (Lt = l, u = tu(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
function F() {
var l, u, t;
return l = qt, n.substr(qt, 2) === ru ? (u = ru, qt += 2) : (u = null, 0 === Wt && e(eu)),
null !== u ? (t = c(), null !== t ? (Lt = l, u = ou(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
function Q() {
var l, u, t, r, o;
if (Wt++ , l = qt, 91 === n.charCodeAt(qt) ? (u = iu, qt++) : (u = null, 0 === Wt && e(au)),
null !== u) if (94 === n.charCodeAt(qt) ? (t = pl, qt++) : (t = null, 0 === Wt && e(vl)),
null === t && (t = al), null !== t) {
for (r = [], o = S(), null === o && (o = U()); null !== o;) r.push(o), o = S(),
null === o && (o = U());
null !== r ? (93 === n.charCodeAt(qt) ? (o = fu, qt++) : (o = null, 0 === Wt && e(su)),
null !== o ? (Lt = l, u = hu(t, r), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il);
} else qt = l, l = il; else qt = l, l = il;
return Wt-- , null === l && (u = null, 0 === Wt && e(cu)), l;
}
function S() {
var l, u, t, r;
return Wt++ , l = qt, u = U(), null !== u ? (45 === n.charCodeAt(qt) ? (t = pu, qt++) : (t = null,
0 === Wt && e(vu)), null !== t ? (r = U(), null !== r ? (Lt = l, u = wu(u, r), null === u ? (qt = l,
l = u) : l = u) : (qt = l, l = il)) : (qt = l, l = il)) : (qt = l, l = il), Wt-- ,
null === l && (u = null, 0 === Wt && e(du)), l;
}
function U() {
var n, l;
return Wt++ , n = G(), null === n && (n = E()), Wt-- , null === n && (l = null, 0 === Wt && e(Au)),
n;
}
function E() {
var l, u;
return l = qt, Cu.test(n.charAt(qt)) ? (u = n.charAt(qt), qt++) : (u = null, 0 === Wt && e(gu)),
null !== u && (Lt = l, u = bu(u)), null === u ? (qt = l, l = u) : l = u, l;
}
function G() {
var n;
return n = L(), null === n && (n = Y(), null === n && (n = H(), null === n && (n = O(),
null === n && (n = W(), null === n && (n = z(), null === n && (n = I(), null === n && (n = J(),
null === n && (n = K(), null === n && (n = N(), null === n && (n = P(), null === n && (n = V(),
null === n && (n = X(), null === n && (n = _(), null === n && (n = nl(), null === n && (n = ll(),
null === n && (n = ul(), null === n && (n = tl()))))))))))))))))), n;
}
function B() {
var n;
return n = j(), null === n && (n = q(), null === n && (n = $())), n;
}
function j() {
var l, u;
return l = qt, 46 === n.charCodeAt(qt) ? (u = ku, qt++) : (u = null, 0 === Wt && e(Tu)),
null !== u && (Lt = l, u = xu()), null === u ? (qt = l, l = u) : l = u, l;
}
function $() {
var l, u;
return Wt++ , l = qt, mu.test(n.charAt(qt)) ? (u = n.charAt(qt), qt++) : (u = null,
0 === Wt && e(Ru)), null !== u && (Lt = l, u = bu(u)), null === u ? (qt = l, l = u) : l = u,
Wt-- , null === l && (u = null, 0 === Wt && e(yu)), l;
}
function q() {
var n;
return n = M(), null === n && (n = D(), null === n && (n = Y(), null === n && (n = H(),
null === n && (n = O(), null === n && (n = W(), null === n && (n = z(), null === n && (n = I(),
null === n && (n = J(), null === n && (n = K(), null === n && (n = N(), null === n && (n = P(),
null === n && (n = V(), null === n && (n = X(), null === n && (n = Z(), null === n && (n = _(),
null === n && (n = nl(), null === n && (n = ll(), null === n && (n = ul(), null === n && (n = tl()))))))))))))))))))),
n;
}
function L() {
var l, u;
return l = qt, n.substr(qt, 2) === Fu ? (u = Fu, qt += 2) : (u = null, 0 === Wt && e(Qu)),
null !== u && (Lt = l, u = Su()), null === u ? (qt = l, l = u) : l = u, l;
}
function M() {
var l, u;
return l = qt, n.substr(qt, 2) === Fu ? (u = Fu, qt += 2) : (u = null, 0 === Wt && e(Qu)),
null !== u && (Lt = l, u = Uu()), null === u ? (qt = l, l = u) : l = u, l;
}
function D() {
var l, u;
return l = qt, n.substr(qt, 2) === Eu ? (u = Eu, qt += 2) : (u = null, 0 === Wt && e(Gu)),
null !== u && (Lt = l, u = Bu()), null === u ? (qt = l, l = u) : l = u, l;
}
function H() {
var l, u;
return l = qt, n.substr(qt, 2) === ju ? (u = ju, qt += 2) : (u = null, 0 === Wt && e($u)),
null !== u && (Lt = l, u = qu()), null === u ? (qt = l, l = u) : l = u, l;
}
function O() {
var l, u;
return l = qt, n.substr(qt, 2) === Lu ? (u = Lu, qt += 2) : (u = null, 0 === Wt && e(Mu)),
null !== u && (Lt = l, u = Du()), null === u ? (qt = l, l = u) : l = u, l;
}
function W() {
var l, u;
return l = qt, n.substr(qt, 2) === Hu ? (u = Hu, qt += 2) : (u = null, 0 === Wt && e(Ou)),
null !== u && (Lt = l, u = Wu()), null === u ? (qt = l, l = u) : l = u, l;
}
function z() {
var l, u;
return l = qt, n.substr(qt, 2) === zu ? (u = zu, qt += 2) : (u = null, 0 === Wt && e(Iu)),
null !== u && (Lt = l, u = Ju()), null === u ? (qt = l, l = u) : l = u, l;
}
function I() {
var l, u;
return l = qt, n.substr(qt, 2) === Ku ? (u = Ku, qt += 2) : (u = null, 0 === Wt && e(Nu)),
null !== u && (Lt = l, u = Pu()), null === u ? (qt = l, l = u) : l = u, l;
}
function J() {
var l, u;
return l = qt, n.substr(qt, 2) === Vu ? (u = Vu, qt += 2) : (u = null, 0 === Wt && e(Xu)),
null !== u && (Lt = l, u = Yu()), null === u ? (qt = l, l = u) : l = u, l;
}
function K() {
var l, u;
return l = qt, n.substr(qt, 2) === Zu ? (u = Zu, qt += 2) : (u = null, 0 === Wt && e(_u)),
null !== u && (Lt = l, u = nt()), null === u ? (qt = l, l = u) : l = u, l;
}
function N() {
var l, u;
return l = qt, n.substr(qt, 2) === lt ? (u = lt, qt += 2) : (u = null, 0 === Wt && e(ut)),
null !== u && (Lt = l, u = tt()), null === u ? (qt = l, l = u) : l = u, l;
}
function P() {
var l, u;
return l = qt, n.substr(qt, 2) === rt ? (u = rt, qt += 2) : (u = null, 0 === Wt && e(et)),
null !== u && (Lt = l, u = ot()), null === u ? (qt = l, l = u) : l = u, l;
}
function V() {
var l, u;
return l = qt, n.substr(qt, 2) === ct ? (u = ct, qt += 2) : (u = null, 0 === Wt && e(it)),
null !== u && (Lt = l, u = at()), null === u ? (qt = l, l = u) : l = u, l;
}
function X() {
var l, u;
return l = qt, n.substr(qt, 2) === ft ? (u = ft, qt += 2) : (u = null, 0 === Wt && e(st)),
null !== u && (Lt = l, u = ht()), null === u ? (qt = l, l = u) : l = u, l;
}
function Y() {
var l, u, t;
return l = qt, n.substr(qt, 2) === dt ? (u = dt, qt += 2) : (u = null, 0 === Wt && e(pt)),
null !== u ? (n.length > qt ? (t = n.charAt(qt), qt++) : (t = null, 0 === Wt && e(vt)),
null !== t ? (Lt = l, u = wt(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
function Z() {
var l, u, t;
return l = qt, 92 === n.charCodeAt(qt) ? (u = At, qt++) : (u = null, 0 === Wt && e(Ct)),
null !== u ? (gt.test(n.charAt(qt)) ? (t = n.charAt(qt), qt++) : (t = null, 0 === Wt && e(bt)),
null !== t ? (Lt = l, u = kt(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
function _() {
var l, u, t, r;
if (l = qt, n.substr(qt, 2) === Tt ? (u = Tt, qt += 2) : (u = null, 0 === Wt && e(xt)),
null !== u) {
if (t = [], yt.test(n.charAt(qt)) ? (r = n.charAt(qt), qt++) : (r = null, 0 === Wt && e(mt)),
null !== r) for (; null !== r;) t.push(r), yt.test(n.charAt(qt)) ? (r = n.charAt(qt),
qt++) : (r = null, 0 === Wt && e(mt)); else t = il;
null !== t ? (Lt = l, u = Rt(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il);
} else qt = l, l = il;
return l;
}
function nl() {
var l, u, t, r;
if (l = qt, n.substr(qt, 2) === Ft ? (u = Ft, qt += 2) : (u = null, 0 === Wt && e(Qt)),
null !== u) {
if (t = [], St.test(n.charAt(qt)) ? (r = n.charAt(qt), qt++) : (r = null, 0 === Wt && e(Ut)),
null !== r) for (; null !== r;) t.push(r), St.test(n.charAt(qt)) ? (r = n.charAt(qt),
qt++) : (r = null, 0 === Wt && e(Ut)); else t = il;
null !== t ? (Lt = l, u = Et(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il);
} else qt = l, l = il;
return l;
}
function ll() {
var l, u, t, r;
if (l = qt, n.substr(qt, 2) === Gt ? (u = Gt, qt += 2) : (u = null, 0 === Wt && e(Bt)),
null !== u) {
if (t = [], St.test(n.charAt(qt)) ? (r = n.charAt(qt), qt++) : (r = null, 0 === Wt && e(Ut)),
null !== r) for (; null !== r;) t.push(r), St.test(n.charAt(qt)) ? (r = n.charAt(qt),
qt++) : (r = null, 0 === Wt && e(Ut)); else t = il;
null !== t ? (Lt = l, u = jt(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il);
} else qt = l, l = il;
return l;
}
function ul() {
var l, u;
return l = qt, n.substr(qt, 2) === Tt ? (u = Tt, qt += 2) : (u = null, 0 === Wt && e(xt)),
null !== u && (Lt = l, u = $t()), null === u ? (qt = l, l = u) : l = u, l;
}
function tl() {
var l, u, t;
return l = qt, 92 === n.charCodeAt(qt) ? (u = At, qt++) : (u = null, 0 === Wt && e(Ct)),
null !== u ? (n.length > qt ? (t = n.charAt(qt), qt++) : (t = null, 0 === Wt && e(vt)),
null !== t ? (Lt = l, u = bu(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
var rl, el = arguments.length > 1 ? arguments[1] : {}, ol = {
regexp: c
}, cl = c, il = null, al = "", fl = "|", sl = '"|"', hl = function (n, l) {
return l ? new Alternate(n, l[1]) : n;
}, dl = function (n, l, u) {
return new Match([n].concat(l).concat([u]));
}, pl = "^", vl = '"^"', wl = function () {
return new Token("start");
}, Al = "$", Cl = '"$"', gl = function () {
return new Token("end");
}, bl = function (n, l) {
return new Quantified(n, l);
}, kl = "Quantifier", Tl = function (n, l) {
return l && (n.greedy = !1), n;
}, xl = "{", yl = '"{"', ml = ",", Rl = '","', Fl = "}", Ql = '"}"', Sl = function (n, l) {
return new Quantifier(n, l);
}, Ul = ",}", El = '",}"', Gl = function (n) {
return new Quantifier(n, 1 / 0);
}, Bl = function (n) {
return new Quantifier(n, n);
}, jl = "+", $l = '"+"', ql = function () {
return new Quantifier(1, 1 / 0);
}, Ll = "*", Ml = '"*"', Dl = function () {
return new Quantifier(0, 1 / 0);
}, Hl = "?", Ol = '"?"', Wl = function () {
return new Quantifier(0, 1);
}, zl = /^[0-9]/, Il = "[0-9]", Jl = function (n) {
return +n.join("");
}, Kl = "(", Nl = '"("', Pl = ")", Vl = '")"', Xl = function (n) {
return n;
}, Yl = function (n) {
return new CaptureGroup(n);
}, Zl = "?:", _l = '"?:"', nu = function (n) {
return new Group("non-capture-group", n);
}, lu = "?=", uu = '"?="', tu = function (n) {
return new Group("positive-lookahead", n);
}, ru = "?!", eu = '"?!"', ou = function (n) {
return new Group("negative-lookahead", n);
}, cu = "CharacterSet", iu = "[", au = '"["', fu = "]", su = '"]"', hu = function (n, l) {
return new CharSet(!!n, l);
}, du = "CharacterRange", pu = "-", vu = '"-"', wu = function (n, l) {
return new CharacterRange(n, l);
}, Au = "Character", Cu = /^[^\\\]]/, gu = "[^\\\\\\]]", bu = function (n) {
return new Literal(n);
}, ku = ".", Tu = '"."', xu = function () {
return new Token("any-character");
}, yu = "Literal", mu = /^[^|\\\/.[()?+*$\^]/, Ru = "[^|\\\\\\/.[()?+*$\\^]", Fu = "\\b", Qu = '"\\\\b"', Su = function () {
return new Token("backspace");
}, Uu = function () {
return new Token("word-boundary");
}, Eu = "\\B", Gu = '"\\\\B"', Bu = function () {
return new Token("non-word-boundary");
}, ju = "\\d", $u = '"\\\\d"', qu = function () {
return new Token("digit");
}, Lu = "\\D", Mu = '"\\\\D"', Du = function () {
return new Token("non-digit");
}, Hu = "\\f", Ou = '"\\\\f"', Wu = function () {
return new Token("form-feed");
}, zu = "\\n", Iu = '"\\\\n"', Ju = function () {
return new Token("line-feed");
}, Ku = "\\r", Nu = '"\\\\r"', Pu = function () {
return new Token("carriage-return");
}, Vu = "\\s", Xu = '"\\\\s"', Yu = function () {
return new Token("white-space");
}, Zu = "\\S", _u = '"\\\\S"', nt = function () {
return new Token("non-white-space");
}, lt = "\\t", ut = '"\\\\t"', tt = function () {
return new Token("tab");
}, rt = "\\v", et = '"\\\\v"', ot = function () {
return new Token("vertical-tab");
}, ct = "\\w", it = '"\\\\w"', at = function () {
return new Token("word");
}, ft = "\\W", st = '"\\\\W"', ht = function () {
return new Token("non-word");
}, dt = "\\c", pt = '"\\\\c"', vt = "any character", wt = function (n) {
return new ControlCharacter(n);
}, At = "\\", Ct = '"\\\\"', gt = /^[1-9]/, bt = "[1-9]", kt = function (n) {
return new BackReference(n);
}, Tt = "\\0", xt = '"\\\\0"', yt = /^[0-7]/, mt = "[0-7]", Rt = function (n) {
return new Octal(n.join(""));
}, Ft = "\\x", Qt = '"\\\\x"', St = /^[0-9a-fA-F]/, Ut = "[0-9a-fA-F]", Et = function (n) {
return new Hex(n.join(""));
}, Gt = "\\u", Bt = '"\\\\u"', jt = function (n) {
return new Unicode(n.join(""));
}, $t = function () {
return new Token("null-character");
}, qt = 0, Lt = 0, Mt = 0, Dt = {
line: 1,
column: 1,
seenCR: !1
}, Ht = 0, Ot = [], Wt = 0;
if ("startRule" in el) {
if (!(el.startRule in ol)) throw new Error("Can't start parsing from rule \"" + el.startRule + '".');
cl = ol[el.startRule];
}
if (Token.offset = t, Token.text = u, rl = cl(), null !== rl && qt === n.length) return rl;
throw o(Ot), Lt = Math.max(qt, Ht), new l(Ot, Lt < n.length ? n.charAt(Lt) : null, Lt, r(Lt).line, r(Lt).column);
}
return n(l, Error), {
SyntaxError: l,
parse: u
};
}(), index = 1, cgs = {};
module.exports = parser
/***/
},
/* 22 */
/***/ function (module, exports, __webpack_require__) {
/*
## RegExp Handler
https://github.com/ForbesLindesay/regexp
https://github.com/dmajda/pegjs
http://www.regexper.com/
每个节点的结构
{
type: '',
offset: number,
text: '',
body: {},
escaped: true/false
}
type 可选值
alternate | 选择
match 匹配
capture-group () 捕获组
non-capture-group (?:...) 非捕获组
positive-lookahead (?=p) 零宽正向先行断言
negative-lookahead (?!p) 零宽负向先行断言
quantified a* 重复节点
quantifier * 量词
charset [] 字符集
range {m, n} 范围
literal a 直接量字符
unicode \uxxxx Unicode
hex \x 十六进制
octal 八进制
back-reference \n 反向引用
control-character \cX 控制字符
// Token
start ^ 开头
end $ 结尾
any-character . 任意字符
backspace [\b] 退格直接量
word-boundary \b 单词边界
non-word-boundary \B 非单词边界
digit \d ASCII 数字,[0-9]
non-digit \D 非 ASCII 数字,[^0-9]
form-feed \f 换页符
line-feed \n 换行符
carriage-return \r 回车符
white-space \s 空白符
non-white-space \S 非空白符
tab \t 制表符
vertical-tab \v 垂直制表符
word \w ASCII 字符,[a-zA-Z0-9]
non-word \W 非 ASCII 字符,[^a-zA-Z0-9]
null-character \o NUL 字符
*/
var Util = __webpack_require__(3)
var Random = __webpack_require__(5)
/*
*/
var Handler = {
extend: Util.extend
}
// http://en.wikipedia.org/wiki/ASCII#ASCII_printable_code_chart
/*var ASCII_CONTROL_CODE_CHART = {
'@': ['\u0000'],
A: ['\u0001'],
B: ['\u0002'],
C: ['\u0003'],
D: ['\u0004'],
E: ['\u0005'],
F: ['\u0006'],
G: ['\u0007', '\a'],
H: ['\u0008', '\b'],
I: ['\u0009', '\t'],
J: ['\u000A', '\n'],
K: ['\u000B', '\v'],
L: ['\u000C', '\f'],
M: ['\u000D', '\r'],
N: ['\u000E'],
O: ['\u000F'],
P: ['\u0010'],
Q: ['\u0011'],
R: ['\u0012'],
S: ['\u0013'],
T: ['\u0014'],
U: ['\u0015'],
V: ['\u0016'],
W: ['\u0017'],
X: ['\u0018'],
Y: ['\u0019'],
Z: ['\u001A'],
'[': ['\u001B', '\e'],
'\\': ['\u001C'],
']': ['\u001D'],
'^': ['\u001E'],
'_': ['\u001F']
}*/
// ASCII printable code chart
// var LOWER = 'abcdefghijklmnopqrstuvwxyz'
// var UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
// var NUMBER = '0123456789'
// var SYMBOL = ' !"#$%&\'()*+,-./' + ':;<=>?@' + '[\\]^_`' + '{|}~'
var LOWER = ascii(97, 122)
var UPPER = ascii(65, 90)
var NUMBER = ascii(48, 57)
var OTHER = ascii(32, 47) + ascii(58, 64) + ascii(91, 96) + ascii(123, 126) // 排除 95 _ ascii(91, 94) + ascii(96, 96)
var PRINTABLE = ascii(32, 126)
var SPACE = ' \f\n\r\t\v\u00A0\u2028\u2029'
var CHARACTER_CLASSES = {
'\\w': LOWER + UPPER + NUMBER + '_', // ascii(95, 95)
'\\W': OTHER.replace('_', ''),
'\\s': SPACE,
'\\S': function () {
var result = PRINTABLE
for (var i = 0; i < SPACE.length; i++) {
result = result.replace(SPACE[i], '')
}
return result
}(),
'\\d': NUMBER,
'\\D': LOWER + UPPER + OTHER
}
function ascii(from, to) {
var result = ''
for (var i = from; i <= to; i++) {
result += String.fromCharCode(i)
}
return result
}
// var ast = RegExpParser.parse(regexp.source)
Handler.gen = function (node, result, cache) {
cache = cache || {
guid: 1
}
return Handler[node.type] ? Handler[node.type](node, result, cache) :
Handler.token(node, result, cache)
}
Handler.extend({
/* jshint unused:false */
token: function (node, result, cache) {
switch (node.type) {
case 'start':
case 'end':
return ''
case 'any-character':
return Random.character()
case 'backspace':
return ''
case 'word-boundary': // TODO
return ''
case 'non-word-boundary': // TODO
break
case 'digit':
return Random.pick(
NUMBER.split('')
)
case 'non-digit':
return Random.pick(
(LOWER + UPPER + OTHER).split('')
)
case 'form-feed':
break
case 'line-feed':
return node.body || node.text
case 'carriage-return':
break
case 'white-space':
return Random.pick(
SPACE.split('')
)
case 'non-white-space':
return Random.pick(
(LOWER + UPPER + NUMBER).split('')
)
case 'tab':
break
case 'vertical-tab':
break
case 'word': // \w [a-zA-Z0-9]
return Random.pick(
(LOWER + UPPER + NUMBER).split('')
)
case 'non-word': // \W [^a-zA-Z0-9]
return Random.pick(
OTHER.replace('_', '').split('')
)
case 'null-character':
break
}
return node.body || node.text
},
/*
{
type: 'alternate',
offset: 0,
text: '',
left: {
boyd: []
},
right: {
boyd: []
}
}
*/
alternate: function (node, result, cache) {
// node.left/right {}
return this.gen(
Random.boolean() ? node.left : node.right,
result,
cache
)
},
/*
{
type: 'match',
offset: 0,
text: '',
body: []
}
*/
match: function (node, result, cache) {
result = ''
// node.body []
for (var i = 0; i < node.body.length; i++) {
result += this.gen(node.body[i], result, cache)
}
return result
},
// ()
'capture-group': function (node, result, cache) {
// node.body {}
result = this.gen(node.body, result, cache)
cache[cache.guid++] = result
return result
},
// (?:...)
'non-capture-group': function (node, result, cache) {
// node.body {}
return this.gen(node.body, result, cache)
},
// (?=p)
'positive-lookahead': function (node, result, cache) {
// node.body
return this.gen(node.body, result, cache)
},
// (?!p)
'negative-lookahead': function (node, result, cache) {
// node.body
return ''
},
/*
{
type: 'quantified',
offset: 3,
text: 'c*',
body: {
type: 'literal',
offset: 3,
text: 'c',
body: 'c',
escaped: false
},
quantifier: {
type: 'quantifier',
offset: 4,
text: '*',
min: 0,
max: Infinity,
greedy: true
}
}
*/
quantified: function (node, result, cache) {
result = ''
// node.quantifier {}
var count = this.quantifier(node.quantifier);
// node.body {}
for (var i = 0; i < count; i++) {
result += this.gen(node.body, result, cache)
}
return result
},
/*
quantifier: {
type: 'quantifier',
offset: 4,
text: '*',
min: 0,
max: Infinity,
greedy: true
}
*/
quantifier: function (node, result, cache) {
var min = Math.max(node.min, 0)
var max = isFinite(node.max) ? node.max :
min + Random.integer(3, 7)
return Random.integer(min, max)
},
/*
*/
charset: function (node, result, cache) {
// node.invert
if (node.invert) return this['invert-charset'](node, result, cache)
// node.body []
var literal = Random.pick(node.body)
return this.gen(literal, result, cache)
},
'invert-charset': function (node, result, cache) {
var pool = PRINTABLE
for (var i = 0, item; i < node.body.length; i++) {
item = node.body[i]
switch (item.type) {
case 'literal':
pool = pool.replace(item.body, '')
break
case 'range':
var min = this.gen(item.start, result, cache).charCodeAt()
var max = this.gen(item.end, result, cache).charCodeAt()
for (var ii = min; ii <= max; ii++) {
pool = pool.replace(String.fromCharCode(ii), '')
}
/* falls through */
default:
var characters = CHARACTER_CLASSES[item.text]
if (characters) {
for (var iii = 0; iii <= characters.length; iii++) {
pool = pool.replace(characters[iii], '')
}
}
}
}
return Random.pick(pool.split(''))
},
range: function (node, result, cache) {
// node.start, node.end
var min = this.gen(node.start, result, cache).charCodeAt()
var max = this.gen(node.end, result, cache).charCodeAt()
return String.fromCharCode(
Random.integer(min, max)
)
},
literal: function (node, result, cache) {
return node.escaped ? node.body : node.text
},
// Unicode \u
unicode: function (node, result, cache) {
return String.fromCharCode(
parseInt(node.code, 16)
)
},
// 十六进制 \xFF
hex: function (node, result, cache) {
return String.fromCharCode(
parseInt(node.code, 16)
)
},
// 八进制 \0
octal: function (node, result, cache) {
return String.fromCharCode(
parseInt(node.code, 8)
)
},
// 反向引用
'back-reference': function (node, result, cache) {
return cache[node.code] || ''
},
/*
http://en.wikipedia.org/wiki/C0_and_C1_control_codes
*/
CONTROL_CHARACTER_MAP: function () {
var CONTROL_CHARACTER = '@ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \\ ] ^ _'.split(' ')
var CONTROL_CHARACTER_UNICODE = '\u0000 \u0001 \u0002 \u0003 \u0004 \u0005 \u0006 \u0007 \u0008 \u0009 \u000A \u000B \u000C \u000D \u000E \u000F \u0010 \u0011 \u0012 \u0013 \u0014 \u0015 \u0016 \u0017 \u0018 \u0019 \u001A \u001B \u001C \u001D \u001E \u001F'.split(' ')
var map = {}
for (var i = 0; i < CONTROL_CHARACTER.length; i++) {
map[CONTROL_CHARACTER[i]] = CONTROL_CHARACTER_UNICODE[i]
}
return map
}(),
'control-character': function (node, result, cache) {
return this.CONTROL_CHARACTER_MAP[node.code]
}
})
module.exports = Handler
/***/
},
/* 23 */
/***/ function (module, exports, __webpack_require__) {
module.exports = __webpack_require__(24)
/***/
},
/* 24 */
/***/ function (module, exports, __webpack_require__) {
/*
## toJSONSchema
把 Mock.js 风格的数据模板转换成 JSON Schema。
> [JSON Schema](http://json-schema.org/)
*/
var Constant = __webpack_require__(2)
var Util = __webpack_require__(3)
var Parser = __webpack_require__(4)
function toJSONSchema(template, name, path /* Internal Use Only */) {
// type rule properties items
path = path || []
var result = {
name: typeof name === 'string' ? name.replace(Constant.RE_KEY, '$1') : name,
template: template,
type: Util.type(template), // 可能不准确,例如 { 'name|1': [{}, {} ...] }
rule: Parser.parse(name)
}
result.path = path.slice(0)
result.path.push(name === undefined ? 'ROOT' : result.name)
switch (result.type) {
case 'array':
result.items = []
Util.each(template, function (value, index) {
result.items.push(
toJSONSchema(value, index, result.path)
)
})
break
case 'object':
result.properties = []
Util.each(template, function (value, name) {
result.properties.push(
toJSONSchema(value, name, result.path)
)
})
break
}
return result
}
module.exports = toJSONSchema
/***/
},
/* 25 */
/***/ function (module, exports, __webpack_require__) {
module.exports = __webpack_require__(26)
/***/
},
/* 26 */
/***/ function (module, exports, __webpack_require__) {
/*
## valid(template, data)
校验真实数据 data 是否与数据模板 template 匹配。
实现思路:
1. 解析规则。
先把数据模板 template 解析为更方便机器解析的 JSON-Schame
name 属性名
type 属性值类型
template 属性值模板
properties 对象属性数组
items 数组元素数组
rule 属性值生成规则
2. 递归验证规则。
然后用 JSON-Schema 校验真实数据,校验项包括属性名、值类型、值、值生成规则。
提示信息
https://github.com/fge/json-schema-validator/blob/master/src/main/resources/com/github/fge/jsonschema/validator/validation.properties
[JSON-Schama validator](http://json-schema-validator.herokuapp.com/)
[Regexp Demo](http://demos.forbeslindesay.co.uk/regexp/)
*/
var Constant = __webpack_require__(2)
var Util = __webpack_require__(3)
var toJSONSchema = __webpack_require__(23)
function valid(template, data) {
var schema = toJSONSchema(template)
var result = Diff.diff(schema, data)
for (var i = 0; i < result.length; i++) {
// console.log(Assert.message(result[i]))
}
return result
}
/*
## name
有生成规则:比较解析后的 name
无生成规则:直接比较
## type
无类型转换:直接比较
有类型转换:先试着解析 template,然后再检查?
## value vs. template
基本类型
无生成规则:直接比较
有生成规则:
number
min-max.dmin-dmax
min-max.dcount
count.dmin-dmax
count.dcount
+step
整数部分
小数部分
boolean
string
min-max
count
## properties
对象
有生成规则:检测期望的属性个数,继续递归
无生成规则:检测全部的属性个数,继续递归
## items
数组
有生成规则:
`'name|1': [{}, {} ...]` 其中之一,继续递归
`'name|+1': [{}, {} ...]` 顺序检测,继续递归
`'name|min-max': [{}, {} ...]` 检测个数,继续递归
`'name|count': [{}, {} ...]` 检测个数,继续递归
无生成规则:检测全部的元素个数,继续递归
*/
var Diff = {
diff: function diff(schema, data, name /* Internal Use Only */) {
var result = []
// 先检测名称 name 和类型 type,如果匹配,才有必要继续检测
if (
this.name(schema, data, name, result) &&
this.type(schema, data, name, result)
) {
this.value(schema, data, name, result)
this.properties(schema, data, name, result)
this.items(schema, data, name, result)
}
return result
},
/* jshint unused:false */
name: function (schema, data, name, result) {
var length = result.length
Assert.equal('name', schema.path, name + '', schema.name + '', result)
return result.length === length
},
type: function (schema, data, name, result) {
var length = result.length
switch (schema.type) {
// 跳过含有『占位符』的属性值,因为『占位符』返回值的类型可能和模板不一致,例如 '@int' 会返回一个整形值
case 'string':
if (schema.template.match(Constant.RE_PLACEHOLDER)) return true
break
}
Assert.equal('type', schema.path, Util.type(data), schema.type, result)
return result.length === length
},
value: function (schema, data, name, result) {
var length = result.length
var rule = schema.rule
var templateType = schema.type
if (templateType === 'object' || templateType === 'array') return
// 无生成规则
if (!rule.parameters) {
switch (templateType) {
case 'regexp':
Assert.match('value', schema.path, data, schema.template, result)
return result.length === length
case 'string':
// 同样跳过含有『占位符』的属性值,因为『占位符』的返回值会通常会与模板不一致
if (schema.template.match(Constant.RE_PLACEHOLDER)) return result.length === length
break
}
Assert.equal('value', schema.path, data, schema.template, result)
return result.length === length
}
// 有生成规则
var actualRepeatCount
switch (templateType) {
case 'number':
var parts = (data + '').split('.')
parts[0] = +parts[0]
// 整数部分
// |min-max
if (rule.min !== undefined && rule.max !== undefined) {
Assert.greaterThanOrEqualTo('value', schema.path, parts[0], rule.min, result)
// , 'numeric instance is lower than the required minimum (minimum: {expected}, found: {actual})')
Assert.lessThanOrEqualTo('value', schema.path, parts[0], rule.max, result)
}
// |count
if (rule.min !== undefined && rule.max === undefined) {
Assert.equal('value', schema.path, parts[0], rule.min, result, '[value] ' + name)
}
// 小数部分
if (rule.decimal) {
// |dmin-dmax
if (rule.dmin !== undefined && rule.dmax !== undefined) {
Assert.greaterThanOrEqualTo('value', schema.path, parts[1].length, rule.dmin, result)
Assert.lessThanOrEqualTo('value', schema.path, parts[1].length, rule.dmax, result)
}
// |dcount
if (rule.dmin !== undefined && rule.dmax === undefined) {
Assert.equal('value', schema.path, parts[1].length, rule.dmin, result)
}
}
break
case 'boolean':
break
case 'string':
// 'aaa'.match(/a/g)
actualRepeatCount = data.match(new RegExp(schema.template, 'g'))
actualRepeatCount = actualRepeatCount ? actualRepeatCount.length : actualRepeatCount
// |min-max
if (rule.min !== undefined && rule.max !== undefined) {
Assert.greaterThanOrEqualTo('repeat count', schema.path, actualRepeatCount, rule.min, result)
Assert.lessThanOrEqualTo('repeat count', schema.path, actualRepeatCount, rule.max, result)
}
// |count
if (rule.min !== undefined && rule.max === undefined) {
Assert.equal('repeat count', schema.path, actualRepeatCount, rule.min, result)
}
break
case 'regexp':
actualRepeatCount = data.match(new RegExp(schema.template.source.replace(/^\^|\$$/g, ''), 'g'))
actualRepeatCount = actualRepeatCount ? actualRepeatCount.length : actualRepeatCount
// |min-max
if (rule.min !== undefined && rule.max !== undefined) {
Assert.greaterThanOrEqualTo('repeat count', schema.path, actualRepeatCount, rule.min, result)
Assert.lessThanOrEqualTo('repeat count', schema.path, actualRepeatCount, rule.max, result)
}
// |count
if (rule.min !== undefined && rule.max === undefined) {
Assert.equal('repeat count', schema.path, actualRepeatCount, rule.min, result)
}
break
}
return result.length === length
},
properties: function (schema, data, name, result) {
var length = result.length
var rule = schema.rule
var keys = Util.keys(data)
if (!schema.properties) return
// 无生成规则
if (!schema.rule.parameters) {
Assert.equal('properties length', schema.path, keys.length, schema.properties.length, result)
} else {
// 有生成规则
// |min-max
if (rule.min !== undefined && rule.max !== undefined) {
Assert.greaterThanOrEqualTo('properties length', schema.path, keys.length, rule.min, result)
Assert.lessThanOrEqualTo('properties length', schema.path, keys.length, rule.max, result)
}
// |count
if (rule.min !== undefined && rule.max === undefined) {
Assert.equal('properties length', schema.path, keys.length, rule.min, result)
}
}
if (result.length !== length) return false
for (var i = 0; i < keys.length; i++) {
result.push.apply(
result,
this.diff(
schema.properties[i],
data[keys[i]],
keys[i]
)
)
}
return result.length === length
},
items: function (schema, data, name, result) {
var length = result.length
if (!schema.items) return
var rule = schema.rule
// 无生成规则
if (!schema.rule.parameters) {
Assert.equal('items length', schema.path, data.length, schema.items.length, result)
} else {
// 有生成规则
// |min-max
if (rule.min !== undefined && rule.max !== undefined) {
Assert.greaterThanOrEqualTo('items', schema.path, data.length, (rule.min * schema.items.length), result,
'[{utype}] array is too short: {path} must have at least {expected} elements but instance has {actual} elements')
Assert.lessThanOrEqualTo('items', schema.path, data.length, (rule.max * schema.items.length), result,
'[{utype}] array is too long: {path} must have at most {expected} elements but instance has {actual} elements')
}
// |count
if (rule.min !== undefined && rule.max === undefined) {
Assert.equal('items length', schema.path, data.length, (rule.min * schema.items.length), result)
}
}
if (result.length !== length) return false
for (var i = 0; i < data.length; i++) {
result.push.apply(
result,
this.diff(
schema.items[i % schema.items.length],
data[i],
i % schema.items.length
)
)
}
return result.length === length
}
}
/*
完善、友好的提示信息
Equal, not equal to, greater than, less than, greater than or equal to, less than or equal to
路径 验证类型 描述
Expect path.name is less than or equal to expected, but path.name is actual.
Expect path.name is less than or equal to expected, but path.name is actual.
Expect path.name is greater than or equal to expected, but path.name is actual.
*/
var Assert = {
message: function (item) {
return (item.message ||
'[{utype}] Expect {path}\'{ltype} {action} {expected}, but is {actual}')
.replace('{utype}', item.type.toUpperCase())
.replace('{ltype}', item.type.toLowerCase())
.replace('{path}', Util.isArray(item.path) && item.path.join('.') || item.path)
.replace('{action}', item.action)
.replace('{expected}', item.expected)
.replace('{actual}', item.actual)
},
equal: function (type, path, actual, expected, result, message) {
if (actual === expected) return true
switch (type) {
case 'type':
// 正则模板 === 字符串最终值
if (expected === 'regexp' && actual === 'string') return true
break
}
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'is equal to',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
},
// actual matches expected
match: function (type, path, actual, expected, result, message) {
if (expected.test(actual)) return true
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'matches',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
},
notEqual: function (type, path, actual, expected, result, message) {
if (actual !== expected) return true
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'is not equal to',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
},
greaterThan: function (type, path, actual, expected, result, message) {
if (actual > expected) return true
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'is greater than',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
},
lessThan: function (type, path, actual, expected, result, message) {
if (actual < expected) return true
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'is less to',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
},
greaterThanOrEqualTo: function (type, path, actual, expected, result, message) {
if (actual >= expected) return true
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'is greater than or equal to',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
},
lessThanOrEqualTo: function (type, path, actual, expected, result, message) {
if (actual <= expected) return true
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'is less than or equal to',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
}
}
valid.Diff = Diff
valid.Assert = Assert
module.exports = valid
/***/
},
/* 27 */
/***/ function (module, exports, __webpack_require__) {
module.exports = __webpack_require__(28)
/***/
},
/* 28 */
/***/ function (module, exports, __webpack_require__) {
/* global window, document, location, Event, setTimeout */
/*
## MockXMLHttpRequest
期望的功能:
1. 完整地覆盖原生 XHR 的行为
2. 完整地模拟原生 XHR 的行为
3. 在发起请求时,自动检测是否需要拦截
4. 如果不必拦截,则执行原生 XHR 的行为
5. 如果需要拦截,则执行虚拟 XHR 的行为
6. 兼容 XMLHttpRequest 和 ActiveXObject
new window.XMLHttpRequest()
new window.ActiveXObject("Microsoft.XMLHTTP")
关键方法的逻辑:
* new 此时尚无法确定是否需要拦截,所以创建原生 XHR 对象是必须的。
* open 此时可以取到 URL,可以决定是否进行拦截。
* send 此时已经确定了请求方式。
规范:
http://xhr.spec.whatwg.org/
http://www.w3.org/TR/XMLHttpRequest2/
参考实现:
https://github.com/philikon/MockHttpRequest/blob/master/lib/mock.js
https://github.com/trek/FakeXMLHttpRequest/blob/master/fake_xml_http_request.js
https://github.com/ilinsky/xmlhttprequest/blob/master/XMLHttpRequest.js
https://github.com/firebug/firebug-lite/blob/master/content/lite/xhr.js
https://github.com/thx/RAP/blob/master/lab/rap.plugin.xinglie.js
**需不需要全面重写 XMLHttpRequest?**
http://xhr.spec.whatwg.org/#interface-xmlhttprequest
关键属性 readyState、status、statusText、response、responseText、responseXML 是 readonly,所以,试图通过修改这些状态,来模拟响应是不可行的。
因此,唯一的办法是模拟整个 XMLHttpRequest,就像 jQuery 对事件模型的封装。
// Event handlers
onloadstart loadstart
onprogress progress
onabort abort
onerror error
onload load
ontimeout timeout
onloadend loadend
onreadystatechange readystatechange
*/
var Util = __webpack_require__(3)
// 备份原生 XMLHttpRequest
window._XMLHttpRequest = window.XMLHttpRequest
window._ActiveXObject = window.ActiveXObject
/*
PhantomJS
TypeError: '[object EventConstructor]' is not a constructor (evaluating 'new Event("readystatechange")')
https://github.com/bluerail/twitter-bootstrap-rails-confirm/issues/18
https://github.com/ariya/phantomjs/issues/11289
*/
try {
new window.Event('custom')
} catch (exception) {
window.Event = function (type, bubbles, cancelable, detail) {
var event = document.createEvent('CustomEvent') // MUST be 'CustomEvent'
event.initCustomEvent(type, bubbles, cancelable, detail)
return event
}
}
var XHR_STATES = {
// The object has been constructed.
UNSENT: 0,
// The open() method has been successfully invoked.
OPENED: 1,
// All redirects (if any) have been followed and all HTTP headers of the response have been received.
HEADERS_RECEIVED: 2,
// The response's body is being received.
LOADING: 3,
// The data transfer has been completed or something went wrong during the transfer (e.g. infinite redirects).
DONE: 4
}
var XHR_EVENTS = 'readystatechange loadstart progress abort error load timeout loadend'.split(' ')
var XHR_REQUEST_PROPERTIES = 'timeout withCredentials'.split(' ')
var XHR_RESPONSE_PROPERTIES = 'readyState responseURL status statusText responseType response responseText responseXML'.split(' ')
// https://github.com/trek/FakeXMLHttpRequest/blob/master/fake_xml_http_request.js#L32
var HTTP_STATUS_CODES = {
100: "Continue",
101: "Switching Protocols",
200: "OK",
201: "Created",
202: "Accepted",
203: "Non-Authoritative Information",
204: "No Content",
205: "Reset Content",
206: "Partial Content",
300: "Multiple Choice",
301: "Moved Permanently",
302: "Found",
303: "See Other",
304: "Not Modified",
305: "Use Proxy",
307: "Temporary Redirect",
400: "Bad Request",
401: "Unauthorized",
402: "Payment Required",
403: "Forbidden",
404: "Not Found",
405: "Method Not Allowed",
406: "Not Acceptable",
407: "Proxy Authentication Required",
408: "Request Timeout",
409: "Conflict",
410: "Gone",
411: "Length Required",
412: "Precondition Failed",
413: "Request Entity Too Large",
414: "Request-URI Too Long",
415: "Unsupported Media Type",
416: "Requested Range Not Satisfiable",
417: "Expectation Failed",
422: "Unprocessable Entity",
500: "Internal Server Error",
501: "Not Implemented",
502: "Bad Gateway",
503: "Service Unavailable",
504: "Gateway Timeout",
505: "HTTP Version Not Supported"
}
/*
MockXMLHttpRequest
*/
function MockXMLHttpRequest() {
// 初始化 custom 对象,用于存储自定义属性
this.custom = {
events: {},
requestHeaders: {},
responseHeaders: {}
}
}
MockXMLHttpRequest._settings = {
timeout: '10-100',
/*
timeout: 50,
timeout: '10-100',
*/
}
MockXMLHttpRequest.setup = function (settings) {
Util.extend(MockXMLHttpRequest._settings, settings)
return MockXMLHttpRequest._settings
}
Util.extend(MockXMLHttpRequest, XHR_STATES)
Util.extend(MockXMLHttpRequest.prototype, XHR_STATES)
// 标记当前对象为 MockXMLHttpRequest
MockXMLHttpRequest.prototype.mock = true
// 是否拦截 Ajax 请求
MockXMLHttpRequest.prototype.match = false
// 初始化 Request 相关的属性和方法
Util.extend(MockXMLHttpRequest.prototype, {
// https://xhr.spec.whatwg.org/#the-open()-method
// Sets the request method, request URL, and synchronous flag.
open: function (method, url, async, username, password) {
var that = this
Util.extend(this.custom, {
method: method,
url: url,
async: typeof async === 'boolean' ? async : true,
username: username,
password: password,
options: {
url: url,
type: method
}
})
this.custom.timeout = function (timeout) {
if (typeof timeout === 'number') return timeout
if (typeof timeout === 'string' && !~timeout.indexOf('-')) return parseInt(timeout, 10)
if (typeof timeout === 'string' && ~timeout.indexOf('-')) {
var tmp = timeout.split('-')
var min = parseInt(tmp[0], 10)
var max = parseInt(tmp[1], 10)
return Math.round(Math.random() * (max - min)) + min
}
}(MockXMLHttpRequest._settings.timeout)
// 查找与请求参数匹配的数据模板
var item = find(this.custom.options)
function handle(event) {
// 同步属性 NativeXMLHttpRequest => MockXMLHttpRequest
for (var i = 0; i < XHR_RESPONSE_PROPERTIES.length; i++) {
try {
that[XHR_RESPONSE_PROPERTIES[i]] = xhr[XHR_RESPONSE_PROPERTIES[i]]
} catch (e) { }
}
// 触发 MockXMLHttpRequest 上的同名事件
that.dispatchEvent(new Event(event.type /*, false, false, that*/))
}
// 如果未找到匹配的数据模板,则采用原生 XHR 发送请求。
if (!item) {
// 创建原生 XHR 对象,调用原生 open(),监听所有原生事件
var xhr = createNativeXMLHttpRequest()
this.custom.xhr = xhr
// 初始化所有事件,用于监听原生 XHR 对象的事件
for (var i = 0; i < XHR_EVENTS.length; i++) {
xhr.addEventListener(XHR_EVENTS[i], handle)
}
// xhr.open()
if (username) xhr.open(method, url, async, username, password)
else xhr.open(method, url, async)
// 同步属性 MockXMLHttpRequest => NativeXMLHttpRequest
for (var j = 0; j < XHR_REQUEST_PROPERTIES.length; j++) {
try {
xhr[XHR_REQUEST_PROPERTIES[j]] = that[XHR_REQUEST_PROPERTIES[j]]
} catch (e) { }
}
return
}
// 找到了匹配的数据模板,开始拦截 XHR 请求
this.match = true
this.custom.template = item
this.readyState = MockXMLHttpRequest.OPENED
this.dispatchEvent(new Event('readystatechange' /*, false, false, this*/))
},
// https://xhr.spec.whatwg.org/#the-setrequestheader()-method
// Combines a header in author request headers.
setRequestHeader: function (name, value) {
// 原生 XHR
if (!this.match) {
this.custom.xhr.setRequestHeader(name, value)
return
}
// 拦截 XHR
var requestHeaders = this.custom.requestHeaders
if (requestHeaders[name]) requestHeaders[name] += ',' + value
else requestHeaders[name] = value
},
timeout: 0,
withCredentials: false,
upload: {},
// https://xhr.spec.whatwg.org/#the-send()-method
// Initiates the request.
send: function send(data) {
var that = this
this.custom.options.body = data
// 原生 XHR
if (!this.match) {
this.custom.xhr.send(data)
return
}
// 拦截 XHR
// X-Requested-With header
this.setRequestHeader('X-Requested-With', 'MockXMLHttpRequest')
// loadstart The fetch initiates.
this.dispatchEvent(new Event('loadstart' /*, false, false, this*/))
if (this.custom.async) setTimeout(done, this.custom.timeout) // 异步
else done() // 同步
function done() {
that.readyState = MockXMLHttpRequest.HEADERS_RECEIVED
that.dispatchEvent(new Event('readystatechange' /*, false, false, that*/))
that.readyState = MockXMLHttpRequest.LOADING
that.dispatchEvent(new Event('readystatechange' /*, false, false, that*/))
that.status = 200
that.statusText = HTTP_STATUS_CODES[200]
// fix #92 #93 by @qddegtya
that.response = that.responseText = JSON.stringify(
convert(that.custom.template, that.custom.options),
null, 4
)
that.readyState = MockXMLHttpRequest.DONE
that.dispatchEvent(new Event('readystatechange' /*, false, false, that*/))
that.dispatchEvent(new Event('load' /*, false, false, that*/));
that.dispatchEvent(new Event('loadend' /*, false, false, that*/));
}
},
// https://xhr.spec.whatwg.org/#the-abort()-method
// Cancels any network activity.
abort: function abort() {
// 原生 XHR
if (!this.match) {
this.custom.xhr.abort()
return
}
// 拦截 XHR
this.readyState = MockXMLHttpRequest.UNSENT
this.dispatchEvent(new Event('abort', false, false, this))
this.dispatchEvent(new Event('error', false, false, this))
}
})
// 初始化 Response 相关的属性和方法
Util.extend(MockXMLHttpRequest.prototype, {
responseURL: '',
status: MockXMLHttpRequest.UNSENT,
statusText: '',
// https://xhr.spec.whatwg.org/#the-getresponseheader()-method
getResponseHeader: function (name) {
// 原生 XHR
if (!this.match) {
return this.custom.xhr.getResponseHeader(name)
}
// 拦截 XHR
return this.custom.responseHeaders[name.toLowerCase()]
},
// https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method
// http://www.utf8-chartable.de/
getAllResponseHeaders: function () {
// 原生 XHR
if (!this.match) {
return this.custom.xhr.getAllResponseHeaders()
}
// 拦截 XHR
var responseHeaders = this.custom.responseHeaders
var headers = ''
for (var h in responseHeaders) {
if (!responseHeaders.hasOwnProperty(h)) continue
headers += h + ': ' + responseHeaders[h] + '\r\n'
}
return headers
},
overrideMimeType: function ( /*mime*/) { },
responseType: '', // '', 'text', 'arraybuffer', 'blob', 'document', 'json'
response: null,
responseText: '',
responseXML: null
})
// EventTarget
Util.extend(MockXMLHttpRequest.prototype, {
addEventListener: function addEventListener(type, handle) {
var events = this.custom.events
if (!events[type]) events[type] = []
events[type].push(handle)
},
removeEventListener: function removeEventListener(type, handle) {
var handles = this.custom.events[type] || []
for (var i = 0; i < handles.length; i++) {
if (handles[i] === handle) {
handles.splice(i--, 1)
}
}
},
dispatchEvent: function dispatchEvent(event) {
var handles = this.custom.events[event.type] || []
for (var i = 0; i < handles.length; i++) {
handles[i].call(this, event)
}
var ontype = 'on' + event.type
if (this[ontype]) this[ontype](event)
}
})
// Inspired by jQuery
function createNativeXMLHttpRequest() {
var isLocal = function () {
var rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/
var rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/
var ajaxLocation = location.href
var ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || []
return rlocalProtocol.test(ajaxLocParts[1])
}()
return window.ActiveXObject ?
(!isLocal && createStandardXHR() || createActiveXHR()) : createStandardXHR()
function createStandardXHR() {
try {
return new window._XMLHttpRequest();
} catch (e) { }
}
function createActiveXHR() {
try {
return new window._ActiveXObject("Microsoft.XMLHTTP");
} catch (e) { }
}
}
// 查找与请求参数匹配的数据模板:URL,Type
function find(options) {
for (var sUrlType in MockXMLHttpRequest.Mock._mocked) {
var item = MockXMLHttpRequest.Mock._mocked[sUrlType]
if (
(!item.rurl || match(item.rurl, options.url)) &&
(!item.rtype || match(item.rtype, options.type.toLowerCase()))
) {
// console.log('[mock]', options.url, '>', item.rurl)
return item
}
}
function match(expected, actual) {
if (Util.type(expected) === 'string') {
return expected === actual
}
if (Util.type(expected) === 'regexp') {
return expected.test(actual)
}
}
}
// 数据模板 => 响应数据
function convert(item, options) {
return Util.isFunction(item.template) ?
item.template(options) : MockXMLHttpRequest.Mock.mock(item.template)
}
module.exports = MockXMLHttpRequest
/***/
}
/******/])
});
;