diff --git a/jobvisualization/apps/__init__.py b/apps/__init__.py similarity index 100% rename from jobvisualization/apps/__init__.py rename to apps/__init__.py diff --git a/apps/__init__.pyc b/apps/__init__.pyc new file mode 100644 index 0000000..ab872ca Binary files /dev/null and b/apps/__init__.pyc differ diff --git a/jobvisualization/apps/data_storage/__init__.py b/apps/data_storage/__init__.py similarity index 100% rename from jobvisualization/apps/data_storage/__init__.py rename to apps/data_storage/__init__.py diff --git a/apps/data_storage/__init__.pyc b/apps/data_storage/__init__.pyc new file mode 100644 index 0000000..12ba3f7 Binary files /dev/null and b/apps/data_storage/__init__.pyc differ diff --git a/jobvisualization/apps/data_storage/admin.py b/apps/data_storage/admin.py similarity index 100% rename from jobvisualization/apps/data_storage/admin.py rename to apps/data_storage/admin.py diff --git a/apps/data_storage/admin.pyc b/apps/data_storage/admin.pyc new file mode 100644 index 0000000..3ebda17 Binary files /dev/null and b/apps/data_storage/admin.pyc differ diff --git a/jobvisualization/apps/data_storage/job_query.py b/apps/data_storage/job_query.py similarity index 100% rename from jobvisualization/apps/data_storage/job_query.py rename to apps/data_storage/job_query.py diff --git a/jobvisualization/apps/data_storage/job_query.pyc b/apps/data_storage/job_query.pyc similarity index 100% rename from jobvisualization/apps/data_storage/job_query.pyc rename to apps/data_storage/job_query.pyc diff --git a/jobvisualization/apps/data_storage/migrations/0001_initial.py b/apps/data_storage/migrations/0001_initial.py similarity index 100% rename from jobvisualization/apps/data_storage/migrations/0001_initial.py rename to apps/data_storage/migrations/0001_initial.py diff --git a/jobvisualization/apps/data_storage/migrations/0001_initial.pyc b/apps/data_storage/migrations/0001_initial.pyc similarity index 67% rename from jobvisualization/apps/data_storage/migrations/0001_initial.pyc rename to apps/data_storage/migrations/0001_initial.pyc index 2865e90..65a3c2c 100644 Binary files a/jobvisualization/apps/data_storage/migrations/0001_initial.pyc and b/apps/data_storage/migrations/0001_initial.pyc differ diff --git a/jobvisualization/apps/data_storage/migrations/0002_auto_20150727_2312.py b/apps/data_storage/migrations/0002_auto_20150727_2312.py similarity index 100% rename from jobvisualization/apps/data_storage/migrations/0002_auto_20150727_2312.py rename to apps/data_storage/migrations/0002_auto_20150727_2312.py diff --git a/apps/data_storage/migrations/0002_auto_20150727_2312.pyc b/apps/data_storage/migrations/0002_auto_20150727_2312.pyc new file mode 100644 index 0000000..b49f3e9 Binary files /dev/null and b/apps/data_storage/migrations/0002_auto_20150727_2312.pyc differ diff --git a/jobvisualization/apps/data_storage/migrations/0003_auto_20150728_2302.py b/apps/data_storage/migrations/0003_auto_20150728_2302.py similarity index 100% rename from jobvisualization/apps/data_storage/migrations/0003_auto_20150728_2302.py rename to apps/data_storage/migrations/0003_auto_20150728_2302.py diff --git a/jobvisualization/apps/data_storage/migrations/0003_auto_20150728_2302.pyc b/apps/data_storage/migrations/0003_auto_20150728_2302.pyc similarity index 58% rename from jobvisualization/apps/data_storage/migrations/0003_auto_20150728_2302.pyc rename to apps/data_storage/migrations/0003_auto_20150728_2302.pyc index aa90369..75021f9 100644 Binary files a/jobvisualization/apps/data_storage/migrations/0003_auto_20150728_2302.pyc and b/apps/data_storage/migrations/0003_auto_20150728_2302.pyc differ diff --git a/jobvisualization/apps/data_storage/migrations/__init__.py b/apps/data_storage/migrations/__init__.py similarity index 100% rename from jobvisualization/apps/data_storage/migrations/__init__.py rename to apps/data_storage/migrations/__init__.py diff --git a/apps/data_storage/migrations/__init__.pyc b/apps/data_storage/migrations/__init__.pyc new file mode 100644 index 0000000..c066429 Binary files /dev/null and b/apps/data_storage/migrations/__init__.pyc differ diff --git a/jobvisualization/apps/data_storage/models.py b/apps/data_storage/models.py similarity index 100% rename from jobvisualization/apps/data_storage/models.py rename to apps/data_storage/models.py diff --git a/apps/data_storage/models.pyc b/apps/data_storage/models.pyc new file mode 100644 index 0000000..f927249 Binary files /dev/null and b/apps/data_storage/models.pyc differ diff --git a/jobvisualization/apps/data_storage/tests.py b/apps/data_storage/tests.py similarity index 100% rename from jobvisualization/apps/data_storage/tests.py rename to apps/data_storage/tests.py diff --git a/jobvisualization/apps/data_storage/views.py b/apps/data_storage/views.py similarity index 100% rename from jobvisualization/apps/data_storage/views.py rename to apps/data_storage/views.py diff --git a/jobvisualization/apps/data_storage/views.pyc b/apps/data_storage/views.pyc similarity index 100% rename from jobvisualization/apps/data_storage/views.pyc rename to apps/data_storage/views.pyc diff --git a/jobvisualization/apps/mapvisuals/__init__.py b/apps/mapvisuals/__init__.py similarity index 100% rename from jobvisualization/apps/mapvisuals/__init__.py rename to apps/mapvisuals/__init__.py diff --git a/apps/mapvisuals/__init__.pyc b/apps/mapvisuals/__init__.pyc new file mode 100644 index 0000000..d4a2900 Binary files /dev/null and b/apps/mapvisuals/__init__.pyc differ diff --git a/jobvisualization/apps/mapvisuals/admin.py b/apps/mapvisuals/admin.py similarity index 100% rename from jobvisualization/apps/mapvisuals/admin.py rename to apps/mapvisuals/admin.py diff --git a/apps/mapvisuals/admin.pyc b/apps/mapvisuals/admin.pyc new file mode 100644 index 0000000..937f2ee Binary files /dev/null and b/apps/mapvisuals/admin.pyc differ diff --git a/jobvisualization/apps/mapvisuals/migrations/__init__.py b/apps/mapvisuals/lib/__init__.py similarity index 100% rename from jobvisualization/apps/mapvisuals/migrations/__init__.py rename to apps/mapvisuals/lib/__init__.py diff --git a/apps/mapvisuals/lib/__init__.pyc b/apps/mapvisuals/lib/__init__.pyc new file mode 100644 index 0000000..ebf51bd Binary files /dev/null and b/apps/mapvisuals/lib/__init__.pyc differ diff --git a/apps/mapvisuals/lib/states.py b/apps/mapvisuals/lib/states.py new file mode 100644 index 0000000..0e109bc --- /dev/null +++ b/apps/mapvisuals/lib/states.py @@ -0,0 +1,15090 @@ +import json + +def state_data(): + return json.loads({ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "id": "01", + "properties": { + "name": "Alabama" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -87.359296, + 35.00118 + ], + [ + -85.606675, + 34.984749 + ], + [ + -85.431413, + 34.124869 + ], + [ + -85.184951, + 32.859696 + ], + [ + -85.069935, + 32.580372 + ], + [ + -84.960397, + 32.421541 + ], + [ + -85.004212, + 32.322956 + ], + [ + -84.889196, + 32.262709 + ], + [ + -85.058981, + 32.13674 + ], + [ + -85.053504, + 32.01077 + ], + [ + -85.141136, + 31.840985 + ], + [ + -85.042551, + 31.539753 + ], + [ + -85.113751, + 31.27686 + ], + [ + -85.004212, + 31.003013 + ], + [ + -85.497137, + 30.997536 + ], + [ + -87.600282, + 30.997536 + ], + [ + -87.633143, + 30.86609 + ], + [ + -87.408589, + 30.674397 + ], + [ + -87.446927, + 30.510088 + ], + [ + -87.37025, + 30.427934 + ], + [ + -87.518128, + 30.280057 + ], + [ + -87.655051, + 30.247195 + ], + [ + -87.90699, + 30.411504 + ], + [ + -87.934375, + 30.657966 + ], + [ + -88.011052, + 30.685351 + ], + [ + -88.10416, + 30.499135 + ], + [ + -88.137022, + 30.318396 + ], + [ + -88.394438, + 30.367688 + ], + [ + -88.471115, + 31.895754 + ], + [ + -88.241084, + 33.796253 + ], + [ + -88.098683, + 34.891641 + ], + [ + -88.202745, + 34.995703 + ], + [ + -87.359296, + 35.00118 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "02", + "properties": { + "name": "Alaska" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -131.602021, + 55.117982 + ], + [ + -131.569159, + 55.28229 + ], + [ + -131.355558, + 55.183705 + ], + [ + -131.38842, + 55.01392 + ], + [ + -131.645836, + 55.035827 + ], + [ + -131.602021, + 55.117982 + ] + ] + ], + [ + [ + [ + -131.832052, + 55.42469 + ], + [ + -131.645836, + 55.304197 + ], + [ + -131.749898, + 55.128935 + ], + [ + -131.832052, + 55.189182 + ], + [ + -131.832052, + 55.42469 + ] + ] + ], + [ + [ + [ + -132.976733, + 56.437924 + ], + [ + -132.735747, + 56.459832 + ], + [ + -132.631685, + 56.421493 + ], + [ + -132.664547, + 56.273616 + ], + [ + -132.878148, + 56.240754 + ], + [ + -133.069841, + 56.333862 + ], + [ + -132.976733, + 56.437924 + ] + ] + ], + [ + [ + [ + -133.595627, + 56.350293 + ], + [ + -133.162949, + 56.317431 + ], + [ + -133.05341, + 56.125739 + ], + [ + -132.620732, + 55.912138 + ], + [ + -132.472854, + 55.780691 + ], + [ + -132.4619, + 55.671152 + ], + [ + -132.357838, + 55.649245 + ], + [ + -132.341408, + 55.506844 + ], + [ + -132.166146, + 55.364444 + ], + [ + -132.144238, + 55.238474 + ], + [ + -132.029222, + 55.276813 + ], + [ + -131.97993, + 55.178228 + ], + [ + -131.958022, + 54.789365 + ], + [ + -132.029222, + 54.701734 + ], + [ + -132.308546, + 54.718165 + ], + [ + -132.385223, + 54.915335 + ], + [ + -132.483808, + 54.898904 + ], + [ + -132.686455, + 55.046781 + ], + [ + -132.746701, + 54.997489 + ], + [ + -132.916486, + 55.046781 + ], + [ + -132.889102, + 54.898904 + ], + [ + -132.73027, + 54.937242 + ], + [ + -132.626209, + 54.882473 + ], + [ + -132.675501, + 54.679826 + ], + [ + -132.867194, + 54.701734 + ], + [ + -133.157472, + 54.95915 + ], + [ + -133.239626, + 55.090597 + ], + [ + -133.223195, + 55.22752 + ], + [ + -133.453227, + 55.216566 + ], + [ + -133.453227, + 55.320628 + ], + [ + -133.277964, + 55.331582 + ], + [ + -133.102702, + 55.42469 + ], + [ + -133.17938, + 55.588998 + ], + [ + -133.387503, + 55.62186 + ], + [ + -133.420365, + 55.884753 + ], + [ + -133.497042, + 56.0162 + ], + [ + -133.639442, + 55.923092 + ], + [ + -133.694212, + 56.070969 + ], + [ + -133.546335, + 56.142169 + ], + [ + -133.666827, + 56.311955 + ], + [ + -133.595627, + 56.350293 + ] + ] + ], + [ + [ + [ + -133.738027, + 55.556137 + ], + [ + -133.546335, + 55.490413 + ], + [ + -133.414888, + 55.572568 + ], + [ + -133.283441, + 55.534229 + ], + [ + -133.420365, + 55.386352 + ], + [ + -133.633966, + 55.430167 + ], + [ + -133.738027, + 55.556137 + ] + ] + ], + [ + [ + [ + -133.907813, + 56.930849 + ], + [ + -134.050213, + 57.029434 + ], + [ + -133.885905, + 57.095157 + ], + [ + -133.343688, + 57.002049 + ], + [ + -133.102702, + 57.007526 + ], + [ + -132.932917, + 56.82131 + ], + [ + -132.620732, + 56.667956 + ], + [ + -132.653593, + 56.55294 + ], + [ + -132.817901, + 56.492694 + ], + [ + -133.042456, + 56.520078 + ], + [ + -133.201287, + 56.448878 + ], + [ + -133.420365, + 56.492694 + ], + [ + -133.66135, + 56.448878 + ], + [ + -133.710643, + 56.684386 + ], + [ + -133.688735, + 56.837741 + ], + [ + -133.869474, + 56.843218 + ], + [ + -133.907813, + 56.930849 + ] + ] + ], + [ + [ + [ + -134.115936, + 56.48174 + ], + [ + -134.25286, + 56.558417 + ], + [ + -134.400737, + 56.722725 + ], + [ + -134.417168, + 56.848695 + ], + [ + -134.296675, + 56.908941 + ], + [ + -134.170706, + 56.848695 + ], + [ + -134.143321, + 56.952757 + ], + [ + -133.748981, + 56.772017 + ], + [ + -133.710643, + 56.596755 + ], + [ + -133.847566, + 56.574848 + ], + [ + -133.935197, + 56.377678 + ], + [ + -133.836612, + 56.322908 + ], + [ + -133.957105, + 56.092877 + ], + [ + -134.110459, + 56.142169 + ], + [ + -134.132367, + 55.999769 + ], + [ + -134.230952, + 56.070969 + ], + [ + -134.291198, + 56.350293 + ], + [ + -134.115936, + 56.48174 + ] + ] + ], + [ + [ + [ + -134.636246, + 56.28457 + ], + [ + -134.669107, + 56.169554 + ], + [ + -134.806031, + 56.235277 + ], + [ + -135.178463, + 56.67891 + ], + [ + -135.413971, + 56.810356 + ], + [ + -135.331817, + 56.914418 + ], + [ + -135.424925, + 57.166357 + ], + [ + -135.687818, + 57.369004 + ], + [ + -135.419448, + 57.566174 + ], + [ + -135.298955, + 57.48402 + ], + [ + -135.063447, + 57.418296 + ], + [ + -134.849846, + 57.407343 + ], + [ + -134.844369, + 57.248511 + ], + [ + -134.636246, + 56.728202 + ], + [ + -134.636246, + 56.28457 + ] + ] + ], + [ + [ + [ + -134.712923, + 58.223407 + ], + [ + -134.373353, + 58.14673 + ], + [ + -134.176183, + 58.157683 + ], + [ + -134.187137, + 58.081006 + ], + [ + -133.902336, + 57.807159 + ], + [ + -134.099505, + 57.850975 + ], + [ + -134.148798, + 57.757867 + ], + [ + -133.935197, + 57.615466 + ], + [ + -133.869474, + 57.363527 + ], + [ + -134.083075, + 57.297804 + ], + [ + -134.154275, + 57.210173 + ], + [ + -134.499322, + 57.029434 + ], + [ + -134.603384, + 57.034911 + ], + [ + -134.6472, + 57.226604 + ], + [ + -134.575999, + 57.341619 + ], + [ + -134.608861, + 57.511404 + ], + [ + -134.729354, + 57.719528 + ], + [ + -134.707446, + 57.829067 + ], + [ + -134.784123, + 58.097437 + ], + [ + -134.91557, + 58.212453 + ], + [ + -134.953908, + 58.409623 + ], + [ + -134.712923, + 58.223407 + ] + ] + ], + [ + [ + [ + -135.857603, + 57.330665 + ], + [ + -135.715203, + 57.330665 + ], + [ + -135.567326, + 57.149926 + ], + [ + -135.633049, + 57.023957 + ], + [ + -135.857603, + 56.996572 + ], + [ + -135.824742, + 57.193742 + ], + [ + -135.857603, + 57.330665 + ] + ] + ], + [ + [ + [ + -136.279328, + 58.206976 + ], + [ + -135.978096, + 58.201499 + ], + [ + -135.780926, + 58.28913 + ], + [ + -135.496125, + 58.168637 + ], + [ + -135.64948, + 58.037191 + ], + [ + -135.59471, + 57.987898 + ], + [ + -135.45231, + 58.135776 + ], + [ + -135.107263, + 58.086483 + ], + [ + -134.91557, + 57.976944 + ], + [ + -135.025108, + 57.779775 + ], + [ + -134.937477, + 57.763344 + ], + [ + -134.822462, + 57.500451 + ], + [ + -135.085355, + 57.462112 + ], + [ + -135.572802, + 57.675713 + ], + [ + -135.556372, + 57.456635 + ], + [ + -135.709726, + 57.369004 + ], + [ + -135.890465, + 57.407343 + ], + [ + -136.000004, + 57.544266 + ], + [ + -136.208128, + 57.637374 + ], + [ + -136.366959, + 57.829067 + ], + [ + -136.569606, + 57.916698 + ], + [ + -136.558652, + 58.075529 + ], + [ + -136.421728, + 58.130299 + ], + [ + -136.377913, + 58.267222 + ], + [ + -136.279328, + 58.206976 + ] + ] + ], + [ + [ + [ + -147.079854, + 60.200582 + ], + [ + -147.501579, + 59.948643 + ], + [ + -147.53444, + 59.850058 + ], + [ + -147.874011, + 59.784335 + ], + [ + -147.80281, + 59.937689 + ], + [ + -147.435855, + 60.09652 + ], + [ + -147.205824, + 60.271782 + ], + [ + -147.079854, + 60.200582 + ] + ] + ], + [ + [ + [ + -147.561825, + 60.578491 + ], + [ + -147.616594, + 60.370367 + ], + [ + -147.758995, + 60.156767 + ], + [ + -147.956165, + 60.227967 + ], + [ + -147.791856, + 60.474429 + ], + [ + -147.561825, + 60.578491 + ] + ] + ], + [ + [ + [ + -147.786379, + 70.245291 + ], + [ + -147.682318, + 70.201475 + ], + [ + -147.162008, + 70.15766 + ], + [ + -146.888161, + 70.185044 + ], + [ + -146.510252, + 70.185044 + ], + [ + -146.099482, + 70.146706 + ], + [ + -145.858496, + 70.168614 + ], + [ + -145.622988, + 70.08646 + ], + [ + -145.195787, + 69.993352 + ], + [ + -144.620708, + 69.971444 + ], + [ + -144.461877, + 70.026213 + ], + [ + -144.078491, + 70.059075 + ], + [ + -143.914183, + 70.130275 + ], + [ + -143.497935, + 70.141229 + ], + [ + -143.503412, + 70.091936 + ], + [ + -143.25695, + 70.119321 + ], + [ + -142.747594, + 70.042644 + ], + [ + -142.402547, + 69.916674 + ], + [ + -142.079408, + 69.856428 + ], + [ + -142.008207, + 69.801659 + ], + [ + -141.712453, + 69.790705 + ], + [ + -141.433129, + 69.697597 + ], + [ + -141.378359, + 69.63735 + ], + [ + -141.208574, + 69.686643 + ], + [ + -141.00045, + 69.648304 + ], + [ + -141.00045, + 60.304644 + ], + [ + -140.53491, + 60.22249 + ], + [ + -140.474664, + 60.310121 + ], + [ + -139.987216, + 60.184151 + ], + [ + -139.696939, + 60.342983 + ], + [ + -139.088998, + 60.359413 + ], + [ + -139.198537, + 60.091043 + ], + [ + -139.045183, + 59.997935 + ], + [ + -138.700135, + 59.910304 + ], + [ + -138.623458, + 59.767904 + ], + [ + -137.604747, + 59.242118 + ], + [ + -137.445916, + 58.908024 + ], + [ + -137.265177, + 59.001132 + ], + [ + -136.827022, + 59.159963 + ], + [ + -136.580559, + 59.16544 + ], + [ + -136.465544, + 59.285933 + ], + [ + -136.476498, + 59.466672 + ], + [ + -136.301236, + 59.466672 + ], + [ + -136.25742, + 59.625503 + ], + [ + -135.945234, + 59.663842 + ], + [ + -135.479694, + 59.800766 + ], + [ + -135.025108, + 59.565257 + ], + [ + -135.068924, + 59.422857 + ], + [ + -134.959385, + 59.280456 + ], + [ + -134.701969, + 59.247595 + ], + [ + -134.378829, + 59.033994 + ], + [ + -134.400737, + 58.973748 + ], + [ + -134.25286, + 58.858732 + ], + [ + -133.842089, + 58.727285 + ], + [ + -133.173903, + 58.152206 + ], + [ + -133.075318, + 57.998852 + ], + [ + -132.867194, + 57.845498 + ], + [ + -132.560485, + 57.505928 + ], + [ + -132.253777, + 57.21565 + ], + [ + -132.368792, + 57.095157 + ], + [ + -132.05113, + 57.051341 + ], + [ + -132.127807, + 56.876079 + ], + [ + -131.870391, + 56.804879 + ], + [ + -131.837529, + 56.602232 + ], + [ + -131.580113, + 56.613186 + ], + [ + -131.087188, + 56.405062 + ], + [ + -130.78048, + 56.366724 + ], + [ + -130.621648, + 56.268139 + ], + [ + -130.468294, + 56.240754 + ], + [ + -130.424478, + 56.142169 + ], + [ + -130.101339, + 56.114785 + ], + [ + -130.002754, + 55.994292 + ], + [ + -130.150631, + 55.769737 + ], + [ + -130.128724, + 55.583521 + ], + [ + -129.986323, + 55.276813 + ], + [ + -130.095862, + 55.200136 + ], + [ + -130.336847, + 54.920812 + ], + [ + -130.687372, + 54.718165 + ], + [ + -130.785957, + 54.822227 + ], + [ + -130.917403, + 54.789365 + ], + [ + -131.010511, + 54.997489 + ], + [ + -130.983126, + 55.08512 + ], + [ + -131.092665, + 55.189182 + ], + [ + -130.862634, + 55.298721 + ], + [ + -130.928357, + 55.337059 + ], + [ + -131.158389, + 55.200136 + ], + [ + -131.284358, + 55.287767 + ], + [ + -131.426759, + 55.238474 + ], + [ + -131.843006, + 55.457552 + ], + [ + -131.700606, + 55.698537 + ], + [ + -131.963499, + 55.616383 + ], + [ + -131.974453, + 55.49589 + ], + [ + -132.182576, + 55.588998 + ], + [ + -132.226392, + 55.704014 + ], + [ + -132.083991, + 55.829984 + ], + [ + -132.127807, + 55.955953 + ], + [ + -132.324977, + 55.851892 + ], + [ + -132.522147, + 56.076446 + ], + [ + -132.642639, + 56.032631 + ], + [ + -132.719317, + 56.218847 + ], + [ + -132.527624, + 56.339339 + ], + [ + -132.341408, + 56.339339 + ], + [ + -132.396177, + 56.487217 + ], + [ + -132.297592, + 56.67891 + ], + [ + -132.450946, + 56.673433 + ], + [ + -132.768609, + 56.837741 + ], + [ + -132.993164, + 57.034911 + ], + [ + -133.51895, + 57.177311 + ], + [ + -133.507996, + 57.577128 + ], + [ + -133.677781, + 57.62642 + ], + [ + -133.639442, + 57.790728 + ], + [ + -133.814705, + 57.834544 + ], + [ + -134.072121, + 58.053622 + ], + [ + -134.143321, + 58.168637 + ], + [ + -134.586953, + 58.206976 + ], + [ + -135.074401, + 58.502731 + ], + [ + -135.282525, + 59.192825 + ], + [ + -135.38111, + 59.033994 + ], + [ + -135.337294, + 58.891593 + ], + [ + -135.140124, + 58.617746 + ], + [ + -135.189417, + 58.573931 + ], + [ + -135.05797, + 58.349376 + ], + [ + -135.085355, + 58.201499 + ], + [ + -135.277048, + 58.234361 + ], + [ + -135.430402, + 58.398669 + ], + [ + -135.633049, + 58.426053 + ], + [ + -135.91785, + 58.382238 + ], + [ + -135.912373, + 58.617746 + ], + [ + -136.087635, + 58.814916 + ], + [ + -136.246466, + 58.75467 + ], + [ + -136.876314, + 58.962794 + ], + [ + -136.931084, + 58.902547 + ], + [ + -136.586036, + 58.836824 + ], + [ + -136.317666, + 58.672516 + ], + [ + -136.213604, + 58.667039 + ], + [ + -136.180743, + 58.535592 + ], + [ + -136.043819, + 58.382238 + ], + [ + -136.388867, + 58.294607 + ], + [ + -136.591513, + 58.349376 + ], + [ + -136.59699, + 58.212453 + ], + [ + -136.859883, + 58.316515 + ], + [ + -136.947514, + 58.393192 + ], + [ + -137.111823, + 58.393192 + ], + [ + -137.566409, + 58.590362 + ], + [ + -137.900502, + 58.765624 + ], + [ + -137.933364, + 58.869686 + ], + [ + -138.11958, + 59.02304 + ], + [ + -138.634412, + 59.132579 + ], + [ + -138.919213, + 59.247595 + ], + [ + -139.417615, + 59.379041 + ], + [ + -139.746231, + 59.505011 + ], + [ + -139.718846, + 59.641934 + ], + [ + -139.625738, + 59.598119 + ], + [ + -139.5162, + 59.68575 + ], + [ + -139.625738, + 59.88292 + ], + [ + -139.488815, + 59.992458 + ], + [ + -139.554538, + 60.041751 + ], + [ + -139.801, + 59.833627 + ], + [ + -140.315833, + 59.696704 + ], + [ + -140.92925, + 59.745996 + ], + [ + -141.444083, + 59.871966 + ], + [ + -141.46599, + 59.970551 + ], + [ + -141.706976, + 59.948643 + ], + [ + -141.964392, + 60.019843 + ], + [ + -142.539471, + 60.085566 + ], + [ + -142.873564, + 60.091043 + ], + [ + -143.623905, + 60.036274 + ], + [ + -143.892275, + 59.997935 + ], + [ + -144.231845, + 60.140336 + ], + [ + -144.65357, + 60.206059 + ], + [ + -144.785016, + 60.29369 + ], + [ + -144.834309, + 60.441568 + ], + [ + -145.124586, + 60.430614 + ], + [ + -145.223171, + 60.299167 + ], + [ + -145.738004, + 60.474429 + ], + [ + -145.820158, + 60.551106 + ], + [ + -146.351421, + 60.408706 + ], + [ + -146.608837, + 60.238921 + ], + [ + -146.718376, + 60.397752 + ], + [ + -146.608837, + 60.485383 + ], + [ + -146.455483, + 60.463475 + ], + [ + -145.951604, + 60.578491 + ], + [ + -146.017328, + 60.666122 + ], + [ + -146.252836, + 60.622307 + ], + [ + -146.345944, + 60.737322 + ], + [ + -146.565022, + 60.753753 + ], + [ + -146.784099, + 61.044031 + ], + [ + -146.866253, + 60.972831 + ], + [ + -147.172962, + 60.934492 + ], + [ + -147.271547, + 60.972831 + ], + [ + -147.375609, + 60.879723 + ], + [ + -147.758995, + 60.912584 + ], + [ + -147.775426, + 60.808523 + ], + [ + -148.032842, + 60.781138 + ], + [ + -148.153334, + 60.819476 + ], + [ + -148.065703, + 61.005692 + ], + [ + -148.175242, + 61.000215 + ], + [ + -148.350504, + 60.803046 + ], + [ + -148.109519, + 60.737322 + ], + [ + -148.087611, + 60.594922 + ], + [ + -147.939734, + 60.441568 + ], + [ + -148.027365, + 60.277259 + ], + [ + -148.219058, + 60.332029 + ], + [ + -148.273827, + 60.249875 + ], + [ + -148.087611, + 60.217013 + ], + [ + -147.983549, + 59.997935 + ], + [ + -148.251919, + 59.95412 + ], + [ + -148.399797, + 59.997935 + ], + [ + -148.635305, + 59.937689 + ], + [ + -148.755798, + 59.986981 + ], + [ + -149.067984, + 59.981505 + ], + [ + -149.05703, + 60.063659 + ], + [ + -149.204907, + 60.008889 + ], + [ + -149.287061, + 59.904827 + ], + [ + -149.418508, + 59.997935 + ], + [ + -149.582816, + 59.866489 + ], + [ + -149.511616, + 59.806242 + ], + [ + -149.741647, + 59.729565 + ], + [ + -149.949771, + 59.718611 + ], + [ + -150.031925, + 59.61455 + ], + [ + -150.25648, + 59.521442 + ], + [ + -150.409834, + 59.554303 + ], + [ + -150.579619, + 59.444764 + ], + [ + -150.716543, + 59.450241 + ], + [ + -151.001343, + 59.225687 + ], + [ + -151.308052, + 59.209256 + ], + [ + -151.406637, + 59.280456 + ], + [ + -151.592853, + 59.159963 + ], + [ + -151.976239, + 59.253071 + ], + [ + -151.888608, + 59.422857 + ], + [ + -151.636669, + 59.483103 + ], + [ + -151.47236, + 59.472149 + ], + [ + -151.423068, + 59.537872 + ], + [ + -151.127313, + 59.669319 + ], + [ + -151.116359, + 59.778858 + ], + [ + -151.505222, + 59.63098 + ], + [ + -151.828361, + 59.718611 + ], + [ + -151.8667, + 59.778858 + ], + [ + -151.702392, + 60.030797 + ], + [ + -151.423068, + 60.211536 + ], + [ + -151.379252, + 60.359413 + ], + [ + -151.297098, + 60.386798 + ], + [ + -151.264237, + 60.545629 + ], + [ + -151.406637, + 60.720892 + ], + [ + -151.06159, + 60.786615 + ], + [ + -150.404357, + 61.038554 + ], + [ + -150.245526, + 60.939969 + ], + [ + -150.042879, + 60.912584 + ], + [ + -149.741647, + 61.016646 + ], + [ + -150.075741, + 61.15357 + ], + [ + -150.207187, + 61.257632 + ], + [ + -150.47008, + 61.246678 + ], + [ + -150.656296, + 61.29597 + ], + [ + -150.711066, + 61.252155 + ], + [ + -151.023251, + 61.180954 + ], + [ + -151.165652, + 61.044031 + ], + [ + -151.477837, + 61.011169 + ], + [ + -151.800977, + 60.852338 + ], + [ + -151.833838, + 60.748276 + ], + [ + -152.080301, + 60.693507 + ], + [ + -152.13507, + 60.578491 + ], + [ + -152.310332, + 60.507291 + ], + [ + -152.392486, + 60.304644 + ], + [ + -152.732057, + 60.173197 + ], + [ + -152.567748, + 60.069136 + ], + [ + -152.704672, + 59.915781 + ], + [ + -153.022334, + 59.888397 + ], + [ + -153.049719, + 59.691227 + ], + [ + -153.345474, + 59.620026 + ], + [ + -153.438582, + 59.702181 + ], + [ + -153.586459, + 59.548826 + ], + [ + -153.761721, + 59.543349 + ], + [ + -153.72886, + 59.433811 + ], + [ + -154.117723, + 59.368087 + ], + [ + -154.1944, + 59.066856 + ], + [ + -153.750768, + 59.050425 + ], + [ + -153.400243, + 58.968271 + ], + [ + -153.301658, + 58.869686 + ], + [ + -153.444059, + 58.710854 + ], + [ + -153.679567, + 58.612269 + ], + [ + -153.898645, + 58.606793 + ], + [ + -153.920553, + 58.519161 + ], + [ + -154.062953, + 58.4863 + ], + [ + -153.99723, + 58.376761 + ], + [ + -154.145107, + 58.212453 + ], + [ + -154.46277, + 58.059098 + ], + [ + -154.643509, + 58.059098 + ], + [ + -154.818771, + 58.004329 + ], + [ + -154.988556, + 58.015283 + ], + [ + -155.120003, + 57.955037 + ], + [ + -155.081664, + 57.872883 + ], + [ + -155.328126, + 57.829067 + ], + [ + -155.377419, + 57.708574 + ], + [ + -155.547204, + 57.785251 + ], + [ + -155.73342, + 57.549743 + ], + [ + -156.045606, + 57.566174 + ], + [ + -156.023698, + 57.440204 + ], + [ + -156.209914, + 57.473066 + ], + [ + -156.34136, + 57.418296 + ], + [ + -156.34136, + 57.248511 + ], + [ + -156.549484, + 56.985618 + ], + [ + -156.883577, + 56.952757 + ], + [ + -157.157424, + 56.832264 + ], + [ + -157.20124, + 56.766541 + ], + [ + -157.376502, + 56.859649 + ], + [ + -157.672257, + 56.607709 + ], + [ + -157.754411, + 56.67891 + ], + [ + -157.918719, + 56.657002 + ], + [ + -157.957058, + 56.514601 + ], + [ + -158.126843, + 56.459832 + ], + [ + -158.32949, + 56.48174 + ], + [ + -158.488321, + 56.339339 + ], + [ + -158.208997, + 56.295524 + ], + [ + -158.510229, + 55.977861 + ], + [ + -159.375585, + 55.873799 + ], + [ + -159.616571, + 55.594475 + ], + [ + -159.676817, + 55.654722 + ], + [ + -159.643955, + 55.829984 + ], + [ + -159.813741, + 55.857368 + ], + [ + -160.027341, + 55.791645 + ], + [ + -160.060203, + 55.720445 + ], + [ + -160.394296, + 55.605429 + ], + [ + -160.536697, + 55.473983 + ], + [ + -160.580512, + 55.567091 + ], + [ + -160.668143, + 55.457552 + ], + [ + -160.865313, + 55.528752 + ], + [ + -161.232268, + 55.358967 + ], + [ + -161.506115, + 55.364444 + ], + [ + -161.467776, + 55.49589 + ], + [ + -161.588269, + 55.62186 + ], + [ + -161.697808, + 55.517798 + ], + [ + -161.686854, + 55.408259 + ], + [ + -162.053809, + 55.074166 + ], + [ + -162.179779, + 55.15632 + ], + [ + -162.218117, + 55.03035 + ], + [ + -162.470057, + 55.052258 + ], + [ + -162.508395, + 55.249428 + ], + [ + -162.661749, + 55.293244 + ], + [ + -162.716519, + 55.222043 + ], + [ + -162.579595, + 55.134412 + ], + [ + -162.645319, + 54.997489 + ], + [ + -162.847965, + 54.926289 + ], + [ + -163.00132, + 55.079643 + ], + [ + -163.187536, + 55.090597 + ], + [ + -163.220397, + 55.03035 + ], + [ + -163.034181, + 54.942719 + ], + [ + -163.373752, + 54.800319 + ], + [ + -163.14372, + 54.76198 + ], + [ + -163.138243, + 54.696257 + ], + [ + -163.329936, + 54.74555 + ], + [ + -163.587352, + 54.614103 + ], + [ + -164.085754, + 54.61958 + ], + [ + -164.332216, + 54.531949 + ], + [ + -164.354124, + 54.466226 + ], + [ + -164.638925, + 54.389548 + ], + [ + -164.847049, + 54.416933 + ], + [ + -164.918249, + 54.603149 + ], + [ + -164.710125, + 54.663395 + ], + [ + -164.551294, + 54.88795 + ], + [ + -164.34317, + 54.893427 + ], + [ + -163.894061, + 55.041304 + ], + [ + -163.532583, + 55.046781 + ], + [ + -163.39566, + 54.904381 + ], + [ + -163.291598, + 55.008443 + ], + [ + -163.313505, + 55.128935 + ], + [ + -163.105382, + 55.183705 + ], + [ + -162.880827, + 55.183705 + ], + [ + -162.579595, + 55.446598 + ], + [ + -162.245502, + 55.682106 + ], + [ + -161.807347, + 55.89023 + ], + [ + -161.292514, + 55.983338 + ], + [ + -161.078914, + 55.939523 + ], + [ + -160.87079, + 55.999769 + ], + [ + -160.816021, + 55.912138 + ], + [ + -160.931036, + 55.813553 + ], + [ + -160.805067, + 55.736876 + ], + [ + -160.766728, + 55.857368 + ], + [ + -160.509312, + 55.868322 + ], + [ + -160.438112, + 55.791645 + ], + [ + -160.27928, + 55.76426 + ], + [ + -160.273803, + 55.857368 + ], + [ + -160.536697, + 55.939523 + ], + [ + -160.558604, + 55.994292 + ], + [ + -160.383342, + 56.251708 + ], + [ + -160.147834, + 56.399586 + ], + [ + -159.830171, + 56.541986 + ], + [ + -159.326293, + 56.667956 + ], + [ + -158.959338, + 56.848695 + ], + [ + -158.784076, + 56.782971 + ], + [ + -158.641675, + 56.810356 + ], + [ + -158.701922, + 56.925372 + ], + [ + -158.658106, + 57.034911 + ], + [ + -158.378782, + 57.264942 + ], + [ + -157.995396, + 57.41282 + ], + [ + -157.688688, + 57.609989 + ], + [ + -157.705118, + 57.719528 + ], + [ + -157.458656, + 58.497254 + ], + [ + -157.07527, + 58.705377 + ], + [ + -157.119086, + 58.869686 + ], + [ + -158.039212, + 58.634177 + ], + [ + -158.32949, + 58.661562 + ], + [ + -158.40069, + 58.760147 + ], + [ + -158.564998, + 58.803962 + ], + [ + -158.619768, + 58.913501 + ], + [ + -158.767645, + 58.864209 + ], + [ + -158.860753, + 58.694424 + ], + [ + -158.701922, + 58.480823 + ], + [ + -158.893615, + 58.387715 + ], + [ + -159.0634, + 58.420577 + ], + [ + -159.392016, + 58.760147 + ], + [ + -159.616571, + 58.929932 + ], + [ + -159.731586, + 58.929932 + ], + [ + -159.808264, + 58.803962 + ], + [ + -159.906848, + 58.782055 + ], + [ + -160.054726, + 58.886116 + ], + [ + -160.235465, + 58.902547 + ], + [ + -160.317619, + 59.072332 + ], + [ + -160.854359, + 58.88064 + ], + [ + -161.33633, + 58.743716 + ], + [ + -161.374669, + 58.667039 + ], + [ + -161.752577, + 58.552023 + ], + [ + -161.938793, + 58.656085 + ], + [ + -161.769008, + 58.776578 + ], + [ + -161.829255, + 59.061379 + ], + [ + -161.955224, + 59.36261 + ], + [ + -161.703285, + 59.48858 + ], + [ + -161.911409, + 59.740519 + ], + [ + -162.092148, + 59.88292 + ], + [ + -162.234548, + 60.091043 + ], + [ + -162.448149, + 60.178674 + ], + [ + -162.502918, + 59.997935 + ], + [ + -162.760334, + 59.959597 + ], + [ + -163.171105, + 59.844581 + ], + [ + -163.66403, + 59.795289 + ], + [ + -163.9324, + 59.806242 + ], + [ + -164.162431, + 59.866489 + ], + [ + -164.189816, + 60.02532 + ], + [ + -164.386986, + 60.074613 + ], + [ + -164.699171, + 60.29369 + ], + [ + -164.962064, + 60.337506 + ], + [ + -165.268773, + 60.578491 + ], + [ + -165.060649, + 60.68803 + ], + [ + -165.016834, + 60.890677 + ], + [ + -165.175665, + 60.846861 + ], + [ + -165.197573, + 60.972831 + ], + [ + -165.120896, + 61.076893 + ], + [ + -165.323543, + 61.170001 + ], + [ + -165.34545, + 61.071416 + ], + [ + -165.591913, + 61.109754 + ], + [ + -165.624774, + 61.279539 + ], + [ + -165.816467, + 61.301447 + ], + [ + -165.920529, + 61.416463 + ], + [ + -165.915052, + 61.558863 + ], + [ + -166.106745, + 61.49314 + ], + [ + -166.139607, + 61.630064 + ], + [ + -165.904098, + 61.662925 + ], + [ + -166.095791, + 61.81628 + ], + [ + -165.756221, + 61.827233 + ], + [ + -165.756221, + 62.013449 + ], + [ + -165.674067, + 62.139419 + ], + [ + -165.044219, + 62.539236 + ], + [ + -164.912772, + 62.659728 + ], + [ + -164.819664, + 62.637821 + ], + [ + -164.874433, + 62.807606 + ], + [ + -164.633448, + 63.097884 + ], + [ + -164.425324, + 63.212899 + ], + [ + -164.036462, + 63.262192 + ], + [ + -163.73523, + 63.212899 + ], + [ + -163.313505, + 63.037637 + ], + [ + -163.039658, + 63.059545 + ], + [ + -162.661749, + 63.22933 + ], + [ + -162.272887, + 63.486746 + ], + [ + -162.075717, + 63.514131 + ], + [ + -162.026424, + 63.448408 + ], + [ + -161.555408, + 63.448408 + ], + [ + -161.13916, + 63.503177 + ], + [ + -160.766728, + 63.771547 + ], + [ + -160.766728, + 63.837271 + ], + [ + -160.952944, + 64.08921 + ], + [ + -160.974852, + 64.237087 + ], + [ + -161.26513, + 64.395918 + ], + [ + -161.374669, + 64.532842 + ], + [ + -161.078914, + 64.494503 + ], + [ + -160.79959, + 64.609519 + ], + [ + -160.783159, + 64.719058 + ], + [ + -161.144637, + 64.921705 + ], + [ + -161.413007, + 64.762873 + ], + [ + -161.664946, + 64.790258 + ], + [ + -161.900455, + 64.702627 + ], + [ + -162.168825, + 64.680719 + ], + [ + -162.234548, + 64.620473 + ], + [ + -162.541257, + 64.532842 + ], + [ + -162.634365, + 64.384965 + ], + [ + -162.787719, + 64.324718 + ], + [ + -162.858919, + 64.49998 + ], + [ + -163.045135, + 64.538319 + ], + [ + -163.176582, + 64.401395 + ], + [ + -163.253259, + 64.467119 + ], + [ + -163.598306, + 64.565704 + ], + [ + -164.304832, + 64.560227 + ], + [ + -164.80871, + 64.450688 + ], + [ + -165.000403, + 64.434257 + ], + [ + -165.411174, + 64.49998 + ], + [ + -166.188899, + 64.576658 + ], + [ + -166.391546, + 64.636904 + ], + [ + -166.484654, + 64.735489 + ], + [ + -166.413454, + 64.872412 + ], + [ + -166.692778, + 64.987428 + ], + [ + -166.638008, + 65.113398 + ], + [ + -166.462746, + 65.179121 + ], + [ + -166.517516, + 65.337952 + ], + [ + -166.796839, + 65.337952 + ], + [ + -167.026871, + 65.381768 + ], + [ + -167.47598, + 65.414629 + ], + [ + -167.711489, + 65.496784 + ], + [ + -168.072967, + 65.578938 + ], + [ + -168.105828, + 65.682999 + ], + [ + -167.541703, + 65.819923 + ], + [ + -166.829701, + 66.049954 + ], + [ + -166.3313, + 66.186878 + ], + [ + -166.046499, + 66.110201 + ], + [ + -165.756221, + 66.09377 + ], + [ + -165.690498, + 66.203309 + ], + [ + -165.86576, + 66.21974 + ], + [ + -165.88219, + 66.312848 + ], + [ + -165.186619, + 66.466202 + ], + [ + -164.403417, + 66.581218 + ], + [ + -163.981692, + 66.592172 + ], + [ + -163.751661, + 66.553833 + ], + [ + -163.872153, + 66.389525 + ], + [ + -163.828338, + 66.274509 + ], + [ + -163.915969, + 66.192355 + ], + [ + -163.768091, + 66.060908 + ], + [ + -163.494244, + 66.082816 + ], + [ + -163.149197, + 66.060908 + ], + [ + -162.749381, + 66.088293 + ], + [ + -162.634365, + 66.039001 + ], + [ + -162.371472, + 66.028047 + ], + [ + -162.14144, + 66.077339 + ], + [ + -161.840208, + 66.02257 + ], + [ + -161.549931, + 66.241647 + ], + [ + -161.341807, + 66.252601 + ], + [ + -161.199406, + 66.208786 + ], + [ + -161.128206, + 66.334755 + ], + [ + -161.528023, + 66.395002 + ], + [ + -161.911409, + 66.345709 + ], + [ + -161.87307, + 66.510017 + ], + [ + -162.174302, + 66.68528 + ], + [ + -162.502918, + 66.740049 + ], + [ + -162.601503, + 66.89888 + ], + [ + -162.344087, + 66.937219 + ], + [ + -162.015471, + 66.778388 + ], + [ + -162.075717, + 66.652418 + ], + [ + -161.916886, + 66.553833 + ], + [ + -161.571838, + 66.438817 + ], + [ + -161.489684, + 66.55931 + ], + [ + -161.884024, + 66.718141 + ], + [ + -161.714239, + 67.002942 + ], + [ + -161.851162, + 67.052235 + ], + [ + -162.240025, + 66.991988 + ], + [ + -162.639842, + 67.008419 + ], + [ + -162.700088, + 67.057712 + ], + [ + -162.902735, + 67.008419 + ], + [ + -163.740707, + 67.128912 + ], + [ + -163.757138, + 67.254881 + ], + [ + -164.009077, + 67.534205 + ], + [ + -164.211724, + 67.638267 + ], + [ + -164.534863, + 67.725898 + ], + [ + -165.192096, + 67.966884 + ], + [ + -165.493328, + 68.059992 + ], + [ + -165.794559, + 68.081899 + ], + [ + -166.243668, + 68.246208 + ], + [ + -166.681824, + 68.339316 + ], + [ + -166.703731, + 68.372177 + ], + [ + -166.375115, + 68.42147 + ], + [ + -166.227238, + 68.574824 + ], + [ + -166.216284, + 68.881533 + ], + [ + -165.329019, + 68.859625 + ], + [ + -164.255539, + 68.930825 + ], + [ + -163.976215, + 68.985595 + ], + [ + -163.532583, + 69.138949 + ], + [ + -163.110859, + 69.374457 + ], + [ + -163.023228, + 69.609966 + ], + [ + -162.842489, + 69.812613 + ], + [ + -162.470057, + 69.982398 + ], + [ + -162.311225, + 70.108367 + ], + [ + -161.851162, + 70.311014 + ], + [ + -161.779962, + 70.256245 + ], + [ + -161.396576, + 70.239814 + ], + [ + -160.837928, + 70.343876 + ], + [ + -160.487404, + 70.453415 + ], + [ + -159.649432, + 70.792985 + ], + [ + -159.33177, + 70.809416 + ], + [ + -159.298908, + 70.760123 + ], + [ + -158.975769, + 70.798462 + ], + [ + -158.658106, + 70.787508 + ], + [ + -158.033735, + 70.831323 + ], + [ + -157.420318, + 70.979201 + ], + [ + -156.812377, + 71.285909 + ], + [ + -156.565915, + 71.351633 + ], + [ + -156.522099, + 71.296863 + ], + [ + -155.585543, + 71.170894 + ], + [ + -155.508865, + 71.083263 + ], + [ + -155.832005, + 70.968247 + ], + [ + -155.979882, + 70.96277 + ], + [ + -155.974405, + 70.809416 + ], + [ + -155.503388, + 70.858708 + ], + [ + -155.476004, + 70.940862 + ], + [ + -155.262403, + 71.017539 + ], + [ + -155.191203, + 70.973724 + ], + [ + -155.032372, + 71.148986 + ], + [ + -154.566832, + 70.990155 + ], + [ + -154.643509, + 70.869662 + ], + [ + -154.353231, + 70.8368 + ], + [ + -154.183446, + 70.7656 + ], + [ + -153.931507, + 70.880616 + ], + [ + -153.487874, + 70.886093 + ], + [ + -153.235935, + 70.924431 + ], + [ + -152.589656, + 70.886093 + ], + [ + -152.26104, + 70.842277 + ], + [ + -152.419871, + 70.606769 + ], + [ + -151.817408, + 70.546523 + ], + [ + -151.773592, + 70.486276 + ], + [ + -151.187559, + 70.382214 + ], + [ + -151.182082, + 70.431507 + ], + [ + -150.760358, + 70.49723 + ], + [ + -150.355064, + 70.491753 + ], + [ + -150.349588, + 70.436984 + ], + [ + -150.114079, + 70.431507 + ], + [ + -149.867617, + 70.508184 + ], + [ + -149.462323, + 70.519138 + ], + [ + -149.177522, + 70.486276 + ], + [ + -148.78866, + 70.404122 + ], + [ + -148.607921, + 70.420553 + ], + [ + -148.350504, + 70.305537 + ], + [ + -148.202627, + 70.349353 + ], + [ + -147.961642, + 70.316491 + ], + [ + -147.786379, + 70.245291 + ] + ] + ], + [ + [ + [ + -152.94018, + 58.026237 + ], + [ + -152.945657, + 57.982421 + ], + [ + -153.290705, + 58.048145 + ], + [ + -153.044242, + 58.305561 + ], + [ + -152.819688, + 58.327469 + ], + [ + -152.666333, + 58.562977 + ], + [ + -152.496548, + 58.354853 + ], + [ + -152.354148, + 58.426053 + ], + [ + -152.080301, + 58.311038 + ], + [ + -152.080301, + 58.152206 + ], + [ + -152.480117, + 58.130299 + ], + [ + -152.655379, + 58.059098 + ], + [ + -152.94018, + 58.026237 + ] + ] + ], + [ + [ + [ + -153.958891, + 57.538789 + ], + [ + -153.67409, + 57.670236 + ], + [ + -153.931507, + 57.69762 + ], + [ + -153.936983, + 57.812636 + ], + [ + -153.723383, + 57.889313 + ], + [ + -153.570028, + 57.834544 + ], + [ + -153.548121, + 57.719528 + ], + [ + -153.46049, + 57.796205 + ], + [ + -153.455013, + 57.96599 + ], + [ + -153.268797, + 57.889313 + ], + [ + -153.235935, + 57.998852 + ], + [ + -153.071627, + 57.933129 + ], + [ + -152.874457, + 57.933129 + ], + [ + -152.721103, + 57.993375 + ], + [ + -152.469163, + 57.889313 + ], + [ + -152.469163, + 57.599035 + ], + [ + -152.151501, + 57.620943 + ], + [ + -152.359625, + 57.42925 + ], + [ + -152.74301, + 57.505928 + ], + [ + -152.60061, + 57.379958 + ], + [ + -152.710149, + 57.275896 + ], + [ + -152.907319, + 57.325188 + ], + [ + -152.912796, + 57.128019 + ], + [ + -153.214027, + 57.073249 + ], + [ + -153.312612, + 56.991095 + ], + [ + -153.498828, + 57.067772 + ], + [ + -153.695998, + 56.859649 + ], + [ + -153.849352, + 56.837741 + ], + [ + -154.013661, + 56.744633 + ], + [ + -154.073907, + 56.969187 + ], + [ + -154.303938, + 56.848695 + ], + [ + -154.314892, + 56.919895 + ], + [ + -154.523016, + 56.991095 + ], + [ + -154.539447, + 57.193742 + ], + [ + -154.742094, + 57.275896 + ], + [ + -154.627078, + 57.511404 + ], + [ + -154.227261, + 57.659282 + ], + [ + -153.980799, + 57.648328 + ], + [ + -153.958891, + 57.538789 + ] + ] + ], + [ + [ + [ + -154.53397, + 56.602232 + ], + [ + -154.742094, + 56.399586 + ], + [ + -154.807817, + 56.432447 + ], + [ + -154.53397, + 56.602232 + ] + ] + ], + [ + [ + [ + -155.634835, + 55.923092 + ], + [ + -155.476004, + 55.912138 + ], + [ + -155.530773, + 55.704014 + ], + [ + -155.793666, + 55.731399 + ], + [ + -155.837482, + 55.802599 + ], + [ + -155.634835, + 55.923092 + ] + ] + ], + [ + [ + [ + -159.890418, + 55.28229 + ], + [ + -159.950664, + 55.068689 + ], + [ + -160.257373, + 54.893427 + ], + [ + -160.109495, + 55.161797 + ], + [ + -160.005433, + 55.134412 + ], + [ + -159.890418, + 55.28229 + ] + ] + ], + [ + [ + [ + -160.520266, + 55.358967 + ], + [ + -160.33405, + 55.358967 + ], + [ + -160.339527, + 55.249428 + ], + [ + -160.525743, + 55.128935 + ], + [ + -160.690051, + 55.211089 + ], + [ + -160.794113, + 55.134412 + ], + [ + -160.854359, + 55.320628 + ], + [ + -160.79959, + 55.380875 + ], + [ + -160.520266, + 55.358967 + ] + ] + ], + [ + [ + [ + -162.256456, + 54.981058 + ], + [ + -162.234548, + 54.893427 + ], + [ + -162.349564, + 54.838658 + ], + [ + -162.437195, + 54.931766 + ], + [ + -162.256456, + 54.981058 + ] + ] + ], + [ + [ + [ + -162.415287, + 63.634624 + ], + [ + -162.563165, + 63.536039 + ], + [ + -162.612457, + 63.62367 + ], + [ + -162.415287, + 63.634624 + ] + ] + ], + [ + [ + [ + -162.80415, + 54.488133 + ], + [ + -162.590549, + 54.449795 + ], + [ + -162.612457, + 54.367641 + ], + [ + -162.782242, + 54.373118 + ], + [ + -162.80415, + 54.488133 + ] + ] + ], + [ + [ + [ + -165.548097, + 54.29644 + ], + [ + -165.476897, + 54.181425 + ], + [ + -165.630251, + 54.132132 + ], + [ + -165.685021, + 54.252625 + ], + [ + -165.548097, + 54.29644 + ] + ] + ], + [ + [ + [ + -165.73979, + 54.15404 + ], + [ + -166.046499, + 54.044501 + ], + [ + -166.112222, + 54.121178 + ], + [ + -165.980775, + 54.219763 + ], + [ + -165.73979, + 54.15404 + ] + ] + ], + [ + [ + [ + -166.364161, + 60.359413 + ], + [ + -166.13413, + 60.397752 + ], + [ + -166.084837, + 60.326552 + ], + [ + -165.88219, + 60.342983 + ], + [ + -165.685021, + 60.277259 + ], + [ + -165.646682, + 59.992458 + ], + [ + -165.750744, + 59.89935 + ], + [ + -166.00816, + 59.844581 + ], + [ + -166.062929, + 59.745996 + ], + [ + -166.440838, + 59.855535 + ], + [ + -166.6161, + 59.850058 + ], + [ + -166.994009, + 59.992458 + ], + [ + -167.125456, + 59.992458 + ], + [ + -167.344534, + 60.074613 + ], + [ + -167.421211, + 60.206059 + ], + [ + -167.311672, + 60.238921 + ], + [ + -166.93924, + 60.206059 + ], + [ + -166.763978, + 60.310121 + ], + [ + -166.577762, + 60.321075 + ], + [ + -166.495608, + 60.392275 + ], + [ + -166.364161, + 60.359413 + ] + ] + ], + [ + [ + [ + -166.375115, + 54.01164 + ], + [ + -166.210807, + 53.934962 + ], + [ + -166.5449, + 53.748746 + ], + [ + -166.539423, + 53.715885 + ], + [ + -166.117699, + 53.852808 + ], + [ + -166.112222, + 53.776131 + ], + [ + -166.282007, + 53.683023 + ], + [ + -166.555854, + 53.622777 + ], + [ + -166.583239, + 53.529669 + ], + [ + -166.878994, + 53.431084 + ], + [ + -167.13641, + 53.425607 + ], + [ + -167.306195, + 53.332499 + ], + [ + -167.623857, + 53.250345 + ], + [ + -167.793643, + 53.337976 + ], + [ + -167.459549, + 53.442038 + ], + [ + -167.355487, + 53.425607 + ], + [ + -167.103548, + 53.513238 + ], + [ + -167.163794, + 53.611823 + ], + [ + -167.021394, + 53.715885 + ], + [ + -166.807793, + 53.666592 + ], + [ + -166.785886, + 53.732316 + ], + [ + -167.015917, + 53.754223 + ], + [ + -167.141887, + 53.825424 + ], + [ + -167.032348, + 53.945916 + ], + [ + -166.643485, + 54.017116 + ], + [ + -166.561331, + 53.880193 + ], + [ + -166.375115, + 54.01164 + ] + ] + ], + [ + [ + [ + -168.790446, + 53.157237 + ], + [ + -168.40706, + 53.34893 + ], + [ + -168.385152, + 53.431084 + ], + [ + -168.237275, + 53.524192 + ], + [ + -168.007243, + 53.568007 + ], + [ + -167.886751, + 53.518715 + ], + [ + -167.842935, + 53.387268 + ], + [ + -168.270136, + 53.244868 + ], + [ + -168.500168, + 53.036744 + ], + [ + -168.686384, + 52.965544 + ], + [ + -168.790446, + 53.157237 + ] + ] + ], + [ + [ + [ + -169.74891, + 52.894344 + ], + [ + -169.705095, + 52.795759 + ], + [ + -169.962511, + 52.790282 + ], + [ + -169.989896, + 52.856005 + ], + [ + -169.74891, + 52.894344 + ] + ] + ], + [ + [ + [ + -170.148727, + 57.221127 + ], + [ + -170.28565, + 57.128019 + ], + [ + -170.313035, + 57.221127 + ], + [ + -170.148727, + 57.221127 + ] + ] + ], + [ + [ + [ + -170.669036, + 52.697174 + ], + [ + -170.603313, + 52.604066 + ], + [ + -170.789529, + 52.538343 + ], + [ + -170.816914, + 52.636928 + ], + [ + -170.669036, + 52.697174 + ] + ] + ], + [ + [ + [ + -171.742517, + 63.716778 + ], + [ + -170.94836, + 63.5689 + ], + [ + -170.488297, + 63.69487 + ], + [ + -170.280174, + 63.683916 + ], + [ + -170.093958, + 63.612716 + ], + [ + -170.044665, + 63.492223 + ], + [ + -169.644848, + 63.4265 + ], + [ + -169.518879, + 63.366254 + ], + [ + -168.99857, + 63.338869 + ], + [ + -168.686384, + 63.295053 + ], + [ + -168.856169, + 63.147176 + ], + [ + -169.108108, + 63.180038 + ], + [ + -169.376478, + 63.152653 + ], + [ + -169.513402, + 63.08693 + ], + [ + -169.639372, + 62.939052 + ], + [ + -169.831064, + 63.075976 + ], + [ + -170.055619, + 63.169084 + ], + [ + -170.263743, + 63.180038 + ], + [ + -170.362328, + 63.2841 + ], + [ + -170.866206, + 63.415546 + ], + [ + -171.101715, + 63.421023 + ], + [ + -171.463193, + 63.306007 + ], + [ + -171.73704, + 63.366254 + ], + [ + -171.852055, + 63.486746 + ], + [ + -171.742517, + 63.716778 + ] + ] + ], + [ + [ + [ + -172.432611, + 52.390465 + ], + [ + -172.41618, + 52.275449 + ], + [ + -172.607873, + 52.253542 + ], + [ + -172.569535, + 52.352127 + ], + [ + -172.432611, + 52.390465 + ] + ] + ], + [ + [ + [ + -173.626584, + 52.14948 + ], + [ + -173.495138, + 52.105664 + ], + [ + -173.122706, + 52.111141 + ], + [ + -173.106275, + 52.07828 + ], + [ + -173.549907, + 52.028987 + ], + [ + -173.626584, + 52.14948 + ] + ] + ], + [ + [ + [ + -174.322156, + 52.280926 + ], + [ + -174.327632, + 52.379511 + ], + [ + -174.185232, + 52.41785 + ], + [ + -173.982585, + 52.319265 + ], + [ + -174.059262, + 52.226157 + ], + [ + -174.179755, + 52.231634 + ], + [ + -174.141417, + 52.127572 + ], + [ + -174.333109, + 52.116618 + ], + [ + -174.738403, + 52.007079 + ], + [ + -174.968435, + 52.039941 + ], + [ + -174.902711, + 52.116618 + ], + [ + -174.656249, + 52.105664 + ], + [ + -174.322156, + 52.280926 + ] + ] + ], + [ + [ + [ + -176.469116, + 51.853725 + ], + [ + -176.288377, + 51.870156 + ], + [ + -176.288377, + 51.744186 + ], + [ + -176.518409, + 51.760617 + ], + [ + -176.80321, + 51.61274 + ], + [ + -176.912748, + 51.80991 + ], + [ + -176.792256, + 51.815386 + ], + [ + -176.775825, + 51.963264 + ], + [ + -176.627947, + 51.968741 + ], + [ + -176.627947, + 51.859202 + ], + [ + -176.469116, + 51.853725 + ] + ] + ], + [ + [ + [ + -177.153734, + 51.946833 + ], + [ + -177.044195, + 51.897541 + ], + [ + -177.120872, + 51.727755 + ], + [ + -177.274226, + 51.678463 + ], + [ + -177.279703, + 51.782525 + ], + [ + -177.153734, + 51.946833 + ] + ] + ], + [ + [ + [ + -178.123152, + 51.919448 + ], + [ + -177.953367, + 51.913971 + ], + [ + -177.800013, + 51.793479 + ], + [ + -177.964321, + 51.651078 + ], + [ + -178.123152, + 51.919448 + ] + ] + ], + [ + [ + [ + 173.107557, + 52.992929 + ], + [ + 173.293773, + 52.927205 + ], + [ + 173.304726, + 52.823143 + ], + [ + 172.90491, + 52.762897 + ], + [ + 172.642017, + 52.927205 + ], + [ + 172.642017, + 53.003883 + ], + [ + 173.107557, + 52.992929 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "04", + "properties": { + "name": "Arizona" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -109.042503, + 37.000263 + ], + [ + -109.04798, + 31.331629 + ], + [ + -111.074448, + 31.331629 + ], + [ + -112.246513, + 31.704061 + ], + [ + -114.815198, + 32.492741 + ], + [ + -114.72209, + 32.717295 + ], + [ + -114.524921, + 32.755634 + ], + [ + -114.470151, + 32.843265 + ], + [ + -114.524921, + 33.029481 + ], + [ + -114.661844, + 33.034958 + ], + [ + -114.727567, + 33.40739 + ], + [ + -114.524921, + 33.54979 + ], + [ + -114.497536, + 33.697668 + ], + [ + -114.535874, + 33.933176 + ], + [ + -114.415382, + 34.108438 + ], + [ + -114.256551, + 34.174162 + ], + [ + -114.136058, + 34.305608 + ], + [ + -114.333228, + 34.448009 + ], + [ + -114.470151, + 34.710902 + ], + [ + -114.634459, + 34.87521 + ], + [ + -114.634459, + 35.00118 + ], + [ + -114.574213, + 35.138103 + ], + [ + -114.596121, + 35.324319 + ], + [ + -114.678275, + 35.516012 + ], + [ + -114.738521, + 36.102045 + ], + [ + -114.371566, + 36.140383 + ], + [ + -114.251074, + 36.01989 + ], + [ + -114.152489, + 36.025367 + ], + [ + -114.048427, + 36.195153 + ], + [ + -114.048427, + 37.000263 + ], + [ + -110.499369, + 37.00574 + ], + [ + -109.042503, + 37.000263 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "05", + "properties": { + "name": "Arkansas" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -94.473842, + 36.501861 + ], + [ + -90.152536, + 36.496384 + ], + [ + -90.064905, + 36.304691 + ], + [ + -90.218259, + 36.184199 + ], + [ + -90.377091, + 35.997983 + ], + [ + -89.730812, + 35.997983 + ], + [ + -89.763673, + 35.811767 + ], + [ + -89.911551, + 35.756997 + ], + [ + -89.944412, + 35.603643 + ], + [ + -90.130628, + 35.439335 + ], + [ + -90.114197, + 35.198349 + ], + [ + -90.212782, + 35.023087 + ], + [ + -90.311367, + 34.995703 + ], + [ + -90.251121, + 34.908072 + ], + [ + -90.409952, + 34.831394 + ], + [ + -90.481152, + 34.661609 + ], + [ + -90.585214, + 34.617794 + ], + [ + -90.568783, + 34.420624 + ], + [ + -90.749522, + 34.365854 + ], + [ + -90.744046, + 34.300131 + ], + [ + -90.952169, + 34.135823 + ], + [ + -90.891923, + 34.026284 + ], + [ + -91.072662, + 33.867453 + ], + [ + -91.231493, + 33.560744 + ], + [ + -91.056231, + 33.429298 + ], + [ + -91.143862, + 33.347144 + ], + [ + -91.089093, + 33.13902 + ], + [ + -91.16577, + 33.002096 + ], + [ + -93.608485, + 33.018527 + ], + [ + -94.041164, + 33.018527 + ], + [ + -94.041164, + 33.54979 + ], + [ + -94.183564, + 33.593606 + ], + [ + -94.380734, + 33.544313 + ], + [ + -94.484796, + 33.637421 + ], + [ + -94.430026, + 35.395519 + ], + [ + -94.616242, + 36.501861 + ], + [ + -94.473842, + 36.501861 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "06", + "properties": { + "name": "California" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -123.233256, + 42.006186 + ], + [ + -122.378853, + 42.011663 + ], + [ + -121.037003, + 41.995232 + ], + [ + -120.001861, + 41.995232 + ], + [ + -119.996384, + 40.264519 + ], + [ + -120.001861, + 38.999346 + ], + [ + -118.71478, + 38.101128 + ], + [ + -117.498899, + 37.21934 + ], + [ + -116.540435, + 36.501861 + ], + [ + -115.85034, + 35.970598 + ], + [ + -114.634459, + 35.00118 + ], + [ + -114.634459, + 34.87521 + ], + [ + -114.470151, + 34.710902 + ], + [ + -114.333228, + 34.448009 + ], + [ + -114.136058, + 34.305608 + ], + [ + -114.256551, + 34.174162 + ], + [ + -114.415382, + 34.108438 + ], + [ + -114.535874, + 33.933176 + ], + [ + -114.497536, + 33.697668 + ], + [ + -114.524921, + 33.54979 + ], + [ + -114.727567, + 33.40739 + ], + [ + -114.661844, + 33.034958 + ], + [ + -114.524921, + 33.029481 + ], + [ + -114.470151, + 32.843265 + ], + [ + -114.524921, + 32.755634 + ], + [ + -114.72209, + 32.717295 + ], + [ + -116.04751, + 32.624187 + ], + [ + -117.126467, + 32.536556 + ], + [ + -117.24696, + 32.668003 + ], + [ + -117.252437, + 32.876127 + ], + [ + -117.329114, + 33.122589 + ], + [ + -117.471515, + 33.297851 + ], + [ + -117.7837, + 33.538836 + ], + [ + -118.183517, + 33.763391 + ], + [ + -118.260194, + 33.703145 + ], + [ + -118.413548, + 33.741483 + ], + [ + -118.391641, + 33.840068 + ], + [ + -118.566903, + 34.042715 + ], + [ + -118.802411, + 33.998899 + ], + [ + -119.218659, + 34.146777 + ], + [ + -119.278905, + 34.26727 + ], + [ + -119.558229, + 34.415147 + ], + [ + -119.875891, + 34.40967 + ], + [ + -120.138784, + 34.475393 + ], + [ + -120.472878, + 34.448009 + ], + [ + -120.64814, + 34.579455 + ], + [ + -120.609801, + 34.858779 + ], + [ + -120.670048, + 34.902595 + ], + [ + -120.631709, + 35.099764 + ], + [ + -120.894602, + 35.247642 + ], + [ + -120.905556, + 35.450289 + ], + [ + -121.004141, + 35.461243 + ], + [ + -121.168449, + 35.636505 + ], + [ + -121.283465, + 35.674843 + ], + [ + -121.332757, + 35.784382 + ], + [ + -121.716143, + 36.195153 + ], + [ + -121.896882, + 36.315645 + ], + [ + -121.935221, + 36.638785 + ], + [ + -121.858544, + 36.6114 + ], + [ + -121.787344, + 36.803093 + ], + [ + -121.929744, + 36.978355 + ], + [ + -122.105006, + 36.956447 + ], + [ + -122.335038, + 37.115279 + ], + [ + -122.417192, + 37.241248 + ], + [ + -122.400761, + 37.361741 + ], + [ + -122.515777, + 37.520572 + ], + [ + -122.515777, + 37.783465 + ], + [ + -122.329561, + 37.783465 + ], + [ + -122.406238, + 38.15042 + ], + [ + -122.488392, + 38.112082 + ], + [ + -122.504823, + 37.931343 + ], + [ + -122.701993, + 37.893004 + ], + [ + -122.937501, + 38.029928 + ], + [ + -122.97584, + 38.265436 + ], + [ + -123.129194, + 38.451652 + ], + [ + -123.331841, + 38.566668 + ], + [ + -123.44138, + 38.698114 + ], + [ + -123.737134, + 38.95553 + ], + [ + -123.687842, + 39.032208 + ], + [ + -123.824765, + 39.366301 + ], + [ + -123.764519, + 39.552517 + ], + [ + -123.85215, + 39.831841 + ], + [ + -124.109566, + 40.105688 + ], + [ + -124.361506, + 40.259042 + ], + [ + -124.410798, + 40.439781 + ], + [ + -124.158859, + 40.877937 + ], + [ + -124.109566, + 41.025814 + ], + [ + -124.158859, + 41.14083 + ], + [ + -124.065751, + 41.442061 + ], + [ + -124.147905, + 41.715908 + ], + [ + -124.257444, + 41.781632 + ], + [ + -124.213628, + 42.000709 + ], + [ + -123.233256, + 42.006186 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "08", + "properties": { + "name": "Colorado" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -107.919731, + 41.003906 + ], + [ + -105.728954, + 40.998429 + ], + [ + -104.053011, + 41.003906 + ], + [ + -102.053927, + 41.003906 + ], + [ + -102.053927, + 40.001626 + ], + [ + -102.042974, + 36.994786 + ], + [ + -103.001438, + 37.000263 + ], + [ + -104.337812, + 36.994786 + ], + [ + -106.868158, + 36.994786 + ], + [ + -107.421329, + 37.000263 + ], + [ + -109.042503, + 37.000263 + ], + [ + -109.042503, + 38.166851 + ], + [ + -109.058934, + 38.27639 + ], + [ + -109.053457, + 39.125316 + ], + [ + -109.04798, + 40.998429 + ], + [ + -107.919731, + 41.003906 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "09", + "properties": { + "name": "Connecticut" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.053528, + 42.039048 + ], + [ + -71.799309, + 42.022617 + ], + [ + -71.799309, + 42.006186 + ], + [ + -71.799309, + 41.414677 + ], + [ + -71.859555, + 41.321569 + ], + [ + -71.947186, + 41.338 + ], + [ + -72.385341, + 41.261322 + ], + [ + -72.905651, + 41.28323 + ], + [ + -73.130205, + 41.146307 + ], + [ + -73.371191, + 41.102491 + ], + [ + -73.655992, + 40.987475 + ], + [ + -73.727192, + 41.102491 + ], + [ + -73.48073, + 41.21203 + ], + [ + -73.55193, + 41.294184 + ], + [ + -73.486206, + 42.050002 + ], + [ + -73.053528, + 42.039048 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "10", + "properties": { + "name": "Delaware" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -75.414089, + 39.804456 + ], + [ + -75.507197, + 39.683964 + ], + [ + -75.611259, + 39.61824 + ], + [ + -75.589352, + 39.459409 + ], + [ + -75.441474, + 39.311532 + ], + [ + -75.403136, + 39.065069 + ], + [ + -75.189535, + 38.807653 + ], + [ + -75.09095, + 38.796699 + ], + [ + -75.047134, + 38.451652 + ], + [ + -75.693413, + 38.462606 + ], + [ + -75.786521, + 39.722302 + ], + [ + -75.616736, + 39.831841 + ], + [ + -75.414089, + 39.804456 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "11", + "properties": { + "name": "District of Columbia" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -77.035264, + 38.993869 + ], + [ + -76.909294, + 38.895284 + ], + [ + -77.040741, + 38.791222 + ], + [ + -77.117418, + 38.933623 + ], + [ + -77.035264, + 38.993869 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "12", + "properties": { + "name": "Florida" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -85.497137, + 30.997536 + ], + [ + -85.004212, + 31.003013 + ], + [ + -84.867289, + 30.712735 + ], + [ + -83.498053, + 30.647012 + ], + [ + -82.216449, + 30.570335 + ], + [ + -82.167157, + 30.356734 + ], + [ + -82.046664, + 30.362211 + ], + [ + -82.002849, + 30.564858 + ], + [ + -82.041187, + 30.751074 + ], + [ + -81.948079, + 30.827751 + ], + [ + -81.718048, + 30.745597 + ], + [ + -81.444201, + 30.707258 + ], + [ + -81.383954, + 30.27458 + ], + [ + -81.257985, + 29.787132 + ], + [ + -80.967707, + 29.14633 + ], + [ + -80.524075, + 28.461713 + ], + [ + -80.589798, + 28.41242 + ], + [ + -80.56789, + 28.094758 + ], + [ + -80.381674, + 27.738757 + ], + [ + -80.091397, + 27.021277 + ], + [ + -80.03115, + 26.796723 + ], + [ + -80.036627, + 26.566691 + ], + [ + -80.146166, + 25.739673 + ], + [ + -80.239274, + 25.723243 + ], + [ + -80.337859, + 25.465826 + ], + [ + -80.304997, + 25.383672 + ], + [ + -80.49669, + 25.197456 + ], + [ + -80.573367, + 25.241272 + ], + [ + -80.759583, + 25.164595 + ], + [ + -81.077246, + 25.120779 + ], + [ + -81.170354, + 25.224841 + ], + [ + -81.126538, + 25.378195 + ], + [ + -81.351093, + 25.821827 + ], + [ + -81.526355, + 25.903982 + ], + [ + -81.679709, + 25.843735 + ], + [ + -81.800202, + 26.090198 + ], + [ + -81.833064, + 26.292844 + ], + [ + -82.041187, + 26.517399 + ], + [ + -82.09048, + 26.665276 + ], + [ + -82.057618, + 26.878877 + ], + [ + -82.172634, + 26.917216 + ], + [ + -82.145249, + 26.791246 + ], + [ + -82.249311, + 26.758384 + ], + [ + -82.566974, + 27.300601 + ], + [ + -82.692943, + 27.437525 + ], + [ + -82.391711, + 27.837342 + ], + [ + -82.588881, + 27.815434 + ], + [ + -82.720328, + 27.689464 + ], + [ + -82.851774, + 27.886634 + ], + [ + -82.676512, + 28.434328 + ], + [ + -82.643651, + 28.888914 + ], + [ + -82.764143, + 28.998453 + ], + [ + -82.802482, + 29.14633 + ], + [ + -82.994175, + 29.179192 + ], + [ + -83.218729, + 29.420177 + ], + [ + -83.399469, + 29.518762 + ], + [ + -83.410422, + 29.66664 + ], + [ + -83.536392, + 29.721409 + ], + [ + -83.640454, + 29.885717 + ], + [ + -84.02384, + 30.104795 + ], + [ + -84.357933, + 30.055502 + ], + [ + -84.341502, + 29.902148 + ], + [ + -84.451041, + 29.929533 + ], + [ + -84.867289, + 29.743317 + ], + [ + -85.310921, + 29.699501 + ], + [ + -85.299967, + 29.80904 + ], + [ + -85.404029, + 29.940487 + ], + [ + -85.924338, + 30.236241 + ], + [ + -86.29677, + 30.362211 + ], + [ + -86.630863, + 30.395073 + ], + [ + -86.910187, + 30.373165 + ], + [ + -87.518128, + 30.280057 + ], + [ + -87.37025, + 30.427934 + ], + [ + -87.446927, + 30.510088 + ], + [ + -87.408589, + 30.674397 + ], + [ + -87.633143, + 30.86609 + ], + [ + -87.600282, + 30.997536 + ], + [ + -85.497137, + 30.997536 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "13", + "properties": { + "name": "Georgia" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -83.109191, + 35.00118 + ], + [ + -83.322791, + 34.787579 + ], + [ + -83.339222, + 34.683517 + ], + [ + -83.005129, + 34.469916 + ], + [ + -82.901067, + 34.486347 + ], + [ + -82.747713, + 34.26727 + ], + [ + -82.714851, + 34.152254 + ], + [ + -82.55602, + 33.94413 + ], + [ + -82.325988, + 33.81816 + ], + [ + -82.194542, + 33.631944 + ], + [ + -81.926172, + 33.462159 + ], + [ + -81.937125, + 33.347144 + ], + [ + -81.761863, + 33.160928 + ], + [ + -81.493493, + 33.007573 + ], + [ + -81.42777, + 32.843265 + ], + [ + -81.416816, + 32.629664 + ], + [ + -81.279893, + 32.558464 + ], + [ + -81.121061, + 32.290094 + ], + [ + -81.115584, + 32.120309 + ], + [ + -80.885553, + 32.032678 + ], + [ + -81.132015, + 31.693108 + ], + [ + -81.175831, + 31.517845 + ], + [ + -81.279893, + 31.364491 + ], + [ + -81.290846, + 31.20566 + ], + [ + -81.400385, + 31.13446 + ], + [ + -81.444201, + 30.707258 + ], + [ + -81.718048, + 30.745597 + ], + [ + -81.948079, + 30.827751 + ], + [ + -82.041187, + 30.751074 + ], + [ + -82.002849, + 30.564858 + ], + [ + -82.046664, + 30.362211 + ], + [ + -82.167157, + 30.356734 + ], + [ + -82.216449, + 30.570335 + ], + [ + -83.498053, + 30.647012 + ], + [ + -84.867289, + 30.712735 + ], + [ + -85.004212, + 31.003013 + ], + [ + -85.113751, + 31.27686 + ], + [ + -85.042551, + 31.539753 + ], + [ + -85.141136, + 31.840985 + ], + [ + -85.053504, + 32.01077 + ], + [ + -85.058981, + 32.13674 + ], + [ + -84.889196, + 32.262709 + ], + [ + -85.004212, + 32.322956 + ], + [ + -84.960397, + 32.421541 + ], + [ + -85.069935, + 32.580372 + ], + [ + -85.184951, + 32.859696 + ], + [ + -85.431413, + 34.124869 + ], + [ + -85.606675, + 34.984749 + ], + [ + -84.319594, + 34.990226 + ], + [ + -83.618546, + 34.984749 + ], + [ + -83.109191, + 35.00118 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "15", + "properties": { + "name": "Hawaii" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -155.634835, + 18.948267 + ], + [ + -155.881297, + 19.035898 + ], + [ + -155.919636, + 19.123529 + ], + [ + -155.886774, + 19.348084 + ], + [ + -156.062036, + 19.73147 + ], + [ + -155.925113, + 19.857439 + ], + [ + -155.826528, + 20.032702 + ], + [ + -155.897728, + 20.147717 + ], + [ + -155.87582, + 20.26821 + ], + [ + -155.596496, + 20.12581 + ], + [ + -155.284311, + 20.021748 + ], + [ + -155.092618, + 19.868393 + ], + [ + -155.092618, + 19.736947 + ], + [ + -154.807817, + 19.523346 + ], + [ + -154.983079, + 19.348084 + ], + [ + -155.295265, + 19.26593 + ], + [ + -155.514342, + 19.134483 + ], + [ + -155.634835, + 18.948267 + ] + ] + ], + [ + [ + [ + -156.587823, + 21.029505 + ], + [ + -156.472807, + 20.892581 + ], + [ + -156.324929, + 20.952827 + ], + [ + -156.00179, + 20.793996 + ], + [ + -156.051082, + 20.651596 + ], + [ + -156.379699, + 20.580396 + ], + [ + -156.445422, + 20.60778 + ], + [ + -156.461853, + 20.783042 + ], + [ + -156.631638, + 20.821381 + ], + [ + -156.697361, + 20.919966 + ], + [ + -156.587823, + 21.029505 + ] + ] + ], + [ + [ + [ + -156.982162, + 21.210244 + ], + [ + -157.080747, + 21.106182 + ], + [ + -157.310779, + 21.106182 + ], + [ + -157.239579, + 21.221198 + ], + [ + -156.982162, + 21.210244 + ] + ] + ], + [ + [ + [ + -157.951581, + 21.697691 + ], + [ + -157.842042, + 21.462183 + ], + [ + -157.896811, + 21.325259 + ], + [ + -158.110412, + 21.303352 + ], + [ + -158.252813, + 21.582676 + ], + [ + -158.126843, + 21.588153 + ], + [ + -157.951581, + 21.697691 + ] + ] + ], + [ + [ + [ + -159.468693, + 22.228955 + ], + [ + -159.353678, + 22.218001 + ], + [ + -159.298908, + 22.113939 + ], + [ + -159.33177, + 21.966061 + ], + [ + -159.446786, + 21.872953 + ], + [ + -159.764448, + 21.987969 + ], + [ + -159.726109, + 22.152277 + ], + [ + -159.468693, + 22.228955 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "16", + "properties": { + "name": "Idaho" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -116.04751, + 49.000239 + ], + [ + -116.04751, + 47.976051 + ], + [ + -115.724371, + 47.696727 + ], + [ + -115.718894, + 47.42288 + ], + [ + -115.527201, + 47.302388 + ], + [ + -115.324554, + 47.258572 + ], + [ + -115.302646, + 47.187372 + ], + [ + -114.930214, + 46.919002 + ], + [ + -114.886399, + 46.809463 + ], + [ + -114.623506, + 46.705401 + ], + [ + -114.612552, + 46.639678 + ], + [ + -114.322274, + 46.645155 + ], + [ + -114.464674, + 46.272723 + ], + [ + -114.492059, + 46.037214 + ], + [ + -114.387997, + 45.88386 + ], + [ + -114.568736, + 45.774321 + ], + [ + -114.497536, + 45.670259 + ], + [ + -114.546828, + 45.560721 + ], + [ + -114.333228, + 45.456659 + ], + [ + -114.086765, + 45.593582 + ], + [ + -113.98818, + 45.703121 + ], + [ + -113.807441, + 45.604536 + ], + [ + -113.834826, + 45.522382 + ], + [ + -113.736241, + 45.330689 + ], + [ + -113.571933, + 45.128042 + ], + [ + -113.45144, + 45.056842 + ], + [ + -113.456917, + 44.865149 + ], + [ + -113.341901, + 44.782995 + ], + [ + -113.133778, + 44.772041 + ], + [ + -113.002331, + 44.448902 + ], + [ + -112.887315, + 44.394132 + ], + [ + -112.783254, + 44.48724 + ], + [ + -112.471068, + 44.481763 + ], + [ + -112.241036, + 44.569394 + ], + [ + -112.104113, + 44.520102 + ], + [ + -111.868605, + 44.563917 + ], + [ + -111.819312, + 44.509148 + ], + [ + -111.616665, + 44.547487 + ], + [ + -111.386634, + 44.75561 + ], + [ + -111.227803, + 44.580348 + ], + [ + -111.047063, + 44.476286 + ], + [ + -111.047063, + 42.000709 + ], + [ + -112.164359, + 41.995232 + ], + [ + -114.04295, + 41.995232 + ], + [ + -117.027882, + 42.000709 + ], + [ + -117.027882, + 43.830007 + ], + [ + -116.896436, + 44.158624 + ], + [ + -116.97859, + 44.240778 + ], + [ + -117.170283, + 44.257209 + ], + [ + -117.241483, + 44.394132 + ], + [ + -117.038836, + 44.750133 + ], + [ + -116.934774, + 44.782995 + ], + [ + -116.830713, + 44.930872 + ], + [ + -116.847143, + 45.02398 + ], + [ + -116.732128, + 45.144473 + ], + [ + -116.671881, + 45.319735 + ], + [ + -116.463758, + 45.61549 + ], + [ + -116.545912, + 45.752413 + ], + [ + -116.78142, + 45.823614 + ], + [ + -116.918344, + 45.993399 + ], + [ + -116.92382, + 46.168661 + ], + [ + -117.055267, + 46.343923 + ], + [ + -117.038836, + 46.426077 + ], + [ + -117.044313, + 47.762451 + ], + [ + -117.033359, + 49.000239 + ], + [ + -116.04751, + 49.000239 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "17", + "properties": { + "name": "Illinois" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -90.639984, + 42.510065 + ], + [ + -88.788778, + 42.493634 + ], + [ + -87.802929, + 42.493634 + ], + [ + -87.83579, + 42.301941 + ], + [ + -87.682436, + 42.077386 + ], + [ + -87.523605, + 41.710431 + ], + [ + -87.529082, + 39.34987 + ], + [ + -87.63862, + 39.169131 + ], + [ + -87.512651, + 38.95553 + ], + [ + -87.49622, + 38.780268 + ], + [ + -87.62219, + 38.637868 + ], + [ + -87.655051, + 38.506421 + ], + [ + -87.83579, + 38.292821 + ], + [ + -87.950806, + 38.27639 + ], + [ + -87.923421, + 38.15042 + ], + [ + -88.000098, + 38.101128 + ], + [ + -88.060345, + 37.865619 + ], + [ + -88.027483, + 37.799896 + ], + [ + -88.15893, + 37.657496 + ], + [ + -88.065822, + 37.482234 + ], + [ + -88.476592, + 37.389126 + ], + [ + -88.514931, + 37.285064 + ], + [ + -88.421823, + 37.153617 + ], + [ + -88.547792, + 37.071463 + ], + [ + -88.914747, + 37.224817 + ], + [ + -89.029763, + 37.213863 + ], + [ + -89.183118, + 37.038601 + ], + [ + -89.133825, + 36.983832 + ], + [ + -89.292656, + 36.994786 + ], + [ + -89.517211, + 37.279587 + ], + [ + -89.435057, + 37.34531 + ], + [ + -89.517211, + 37.537003 + ], + [ + -89.517211, + 37.690357 + ], + [ + -89.84035, + 37.903958 + ], + [ + -89.949889, + 37.88205 + ], + [ + -90.059428, + 38.013497 + ], + [ + -90.355183, + 38.216144 + ], + [ + -90.349706, + 38.374975 + ], + [ + -90.179921, + 38.632391 + ], + [ + -90.207305, + 38.725499 + ], + [ + -90.10872, + 38.845992 + ], + [ + -90.251121, + 38.917192 + ], + [ + -90.470199, + 38.961007 + ], + [ + -90.585214, + 38.867899 + ], + [ + -90.661891, + 38.928146 + ], + [ + -90.727615, + 39.256762 + ], + [ + -91.061708, + 39.470363 + ], + [ + -91.368417, + 39.727779 + ], + [ + -91.494386, + 40.034488 + ], + [ + -91.50534, + 40.237135 + ], + [ + -91.417709, + 40.379535 + ], + [ + -91.401278, + 40.560274 + ], + [ + -91.121954, + 40.669813 + ], + [ + -91.09457, + 40.823167 + ], + [ + -90.963123, + 40.921752 + ], + [ + -90.946692, + 41.097014 + ], + [ + -91.111001, + 41.239415 + ], + [ + -91.045277, + 41.414677 + ], + [ + -90.656414, + 41.463969 + ], + [ + -90.344229, + 41.589939 + ], + [ + -90.311367, + 41.743293 + ], + [ + -90.179921, + 41.809016 + ], + [ + -90.141582, + 42.000709 + ], + [ + -90.168967, + 42.126679 + ], + [ + -90.393521, + 42.225264 + ], + [ + -90.420906, + 42.329326 + ], + [ + -90.639984, + 42.510065 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "18", + "properties": { + "name": "Indiana" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -85.990061, + 41.759724 + ], + [ + -84.807042, + 41.759724 + ], + [ + -84.807042, + 41.694001 + ], + [ + -84.801565, + 40.500028 + ], + [ + -84.817996, + 39.103408 + ], + [ + -84.894673, + 39.059592 + ], + [ + -84.812519, + 38.785745 + ], + [ + -84.987781, + 38.780268 + ], + [ + -85.173997, + 38.68716 + ], + [ + -85.431413, + 38.730976 + ], + [ + -85.42046, + 38.533806 + ], + [ + -85.590245, + 38.451652 + ], + [ + -85.655968, + 38.325682 + ], + [ + -85.83123, + 38.27639 + ], + [ + -85.924338, + 38.024451 + ], + [ + -86.039354, + 37.958727 + ], + [ + -86.263908, + 38.051835 + ], + [ + -86.302247, + 38.166851 + ], + [ + -86.521325, + 38.040881 + ], + [ + -86.504894, + 37.931343 + ], + [ + -86.729448, + 37.893004 + ], + [ + -86.795172, + 37.991589 + ], + [ + -87.047111, + 37.893004 + ], + [ + -87.129265, + 37.788942 + ], + [ + -87.381204, + 37.93682 + ], + [ + -87.512651, + 37.903958 + ], + [ + -87.600282, + 37.975158 + ], + [ + -87.682436, + 37.903958 + ], + [ + -87.934375, + 37.893004 + ], + [ + -88.027483, + 37.799896 + ], + [ + -88.060345, + 37.865619 + ], + [ + -88.000098, + 38.101128 + ], + [ + -87.923421, + 38.15042 + ], + [ + -87.950806, + 38.27639 + ], + [ + -87.83579, + 38.292821 + ], + [ + -87.655051, + 38.506421 + ], + [ + -87.62219, + 38.637868 + ], + [ + -87.49622, + 38.780268 + ], + [ + -87.512651, + 38.95553 + ], + [ + -87.63862, + 39.169131 + ], + [ + -87.529082, + 39.34987 + ], + [ + -87.523605, + 41.710431 + ], + [ + -87.42502, + 41.644708 + ], + [ + -87.118311, + 41.644708 + ], + [ + -86.822556, + 41.759724 + ], + [ + -85.990061, + 41.759724 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "19", + "properties": { + "name": "Iowa" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -91.368417, + 43.501391 + ], + [ + -91.215062, + 43.501391 + ], + [ + -91.204109, + 43.353514 + ], + [ + -91.056231, + 43.254929 + ], + [ + -91.176724, + 43.134436 + ], + [ + -91.143862, + 42.909881 + ], + [ + -91.067185, + 42.75105 + ], + [ + -90.711184, + 42.636034 + ], + [ + -90.639984, + 42.510065 + ], + [ + -90.420906, + 42.329326 + ], + [ + -90.393521, + 42.225264 + ], + [ + -90.168967, + 42.126679 + ], + [ + -90.141582, + 42.000709 + ], + [ + -90.179921, + 41.809016 + ], + [ + -90.311367, + 41.743293 + ], + [ + -90.344229, + 41.589939 + ], + [ + -90.656414, + 41.463969 + ], + [ + -91.045277, + 41.414677 + ], + [ + -91.111001, + 41.239415 + ], + [ + -90.946692, + 41.097014 + ], + [ + -90.963123, + 40.921752 + ], + [ + -91.09457, + 40.823167 + ], + [ + -91.121954, + 40.669813 + ], + [ + -91.401278, + 40.560274 + ], + [ + -91.417709, + 40.379535 + ], + [ + -91.527248, + 40.412397 + ], + [ + -91.729895, + 40.615043 + ], + [ + -91.833957, + 40.609566 + ], + [ + -93.257961, + 40.582182 + ], + [ + -94.632673, + 40.571228 + ], + [ + -95.7664, + 40.587659 + ], + [ + -95.881416, + 40.719105 + ], + [ + -95.826646, + 40.976521 + ], + [ + -95.925231, + 41.201076 + ], + [ + -95.919754, + 41.453015 + ], + [ + -96.095016, + 41.540646 + ], + [ + -96.122401, + 41.67757 + ], + [ + -96.062155, + 41.798063 + ], + [ + -96.127878, + 41.973325 + ], + [ + -96.264801, + 42.039048 + ], + [ + -96.44554, + 42.488157 + ], + [ + -96.631756, + 42.707235 + ], + [ + -96.544125, + 42.855112 + ], + [ + -96.511264, + 43.052282 + ], + [ + -96.434587, + 43.123482 + ], + [ + -96.560556, + 43.222067 + ], + [ + -96.527695, + 43.397329 + ], + [ + -96.582464, + 43.479483 + ], + [ + -96.451017, + 43.501391 + ], + [ + -91.368417, + 43.501391 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "20", + "properties": { + "name": "Kansas" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -101.90605, + 40.001626 + ], + [ + -95.306337, + 40.001626 + ], + [ + -95.207752, + 39.908518 + ], + [ + -94.884612, + 39.831841 + ], + [ + -95.109167, + 39.541563 + ], + [ + -94.983197, + 39.442978 + ], + [ + -94.824366, + 39.20747 + ], + [ + -94.610765, + 39.158177 + ], + [ + -94.616242, + 37.000263 + ], + [ + -100.087706, + 37.000263 + ], + [ + -102.042974, + 36.994786 + ], + [ + -102.053927, + 40.001626 + ], + [ + -101.90605, + 40.001626 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "21", + "properties": { + "name": "Kentucky" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -83.903347, + 38.769315 + ], + [ + -83.678792, + 38.632391 + ], + [ + -83.519961, + 38.703591 + ], + [ + -83.142052, + 38.626914 + ], + [ + -83.032514, + 38.725499 + ], + [ + -82.890113, + 38.758361 + ], + [ + -82.846298, + 38.588575 + ], + [ + -82.731282, + 38.561191 + ], + [ + -82.594358, + 38.424267 + ], + [ + -82.621743, + 38.123036 + ], + [ + -82.50125, + 37.931343 + ], + [ + -82.342419, + 37.783465 + ], + [ + -82.293127, + 37.668449 + ], + [ + -82.101434, + 37.553434 + ], + [ + -81.969987, + 37.537003 + ], + [ + -82.353373, + 37.268633 + ], + [ + -82.720328, + 37.120755 + ], + [ + -82.720328, + 37.044078 + ], + [ + -82.868205, + 36.978355 + ], + [ + -82.879159, + 36.890724 + ], + [ + -83.070852, + 36.852385 + ], + [ + -83.136575, + 36.742847 + ], + [ + -83.673316, + 36.600446 + ], + [ + -83.689746, + 36.584015 + ], + [ + -84.544149, + 36.594969 + ], + [ + -85.289013, + 36.627831 + ], + [ + -85.486183, + 36.616877 + ], + [ + -86.592525, + 36.655216 + ], + [ + -87.852221, + 36.633308 + ], + [ + -88.071299, + 36.677123 + ], + [ + -88.054868, + 36.496384 + ], + [ + -89.298133, + 36.507338 + ], + [ + -89.418626, + 36.496384 + ], + [ + -89.363857, + 36.622354 + ], + [ + -89.215979, + 36.578538 + ], + [ + -89.133825, + 36.983832 + ], + [ + -89.183118, + 37.038601 + ], + [ + -89.029763, + 37.213863 + ], + [ + -88.914747, + 37.224817 + ], + [ + -88.547792, + 37.071463 + ], + [ + -88.421823, + 37.153617 + ], + [ + -88.514931, + 37.285064 + ], + [ + -88.476592, + 37.389126 + ], + [ + -88.065822, + 37.482234 + ], + [ + -88.15893, + 37.657496 + ], + [ + -88.027483, + 37.799896 + ], + [ + -87.934375, + 37.893004 + ], + [ + -87.682436, + 37.903958 + ], + [ + -87.600282, + 37.975158 + ], + [ + -87.512651, + 37.903958 + ], + [ + -87.381204, + 37.93682 + ], + [ + -87.129265, + 37.788942 + ], + [ + -87.047111, + 37.893004 + ], + [ + -86.795172, + 37.991589 + ], + [ + -86.729448, + 37.893004 + ], + [ + -86.504894, + 37.931343 + ], + [ + -86.521325, + 38.040881 + ], + [ + -86.302247, + 38.166851 + ], + [ + -86.263908, + 38.051835 + ], + [ + -86.039354, + 37.958727 + ], + [ + -85.924338, + 38.024451 + ], + [ + -85.83123, + 38.27639 + ], + [ + -85.655968, + 38.325682 + ], + [ + -85.590245, + 38.451652 + ], + [ + -85.42046, + 38.533806 + ], + [ + -85.431413, + 38.730976 + ], + [ + -85.173997, + 38.68716 + ], + [ + -84.987781, + 38.780268 + ], + [ + -84.812519, + 38.785745 + ], + [ + -84.894673, + 39.059592 + ], + [ + -84.817996, + 39.103408 + ], + [ + -84.43461, + 39.103408 + ], + [ + -84.231963, + 38.895284 + ], + [ + -84.215533, + 38.807653 + ], + [ + -83.903347, + 38.769315 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "22", + "properties": { + "name": "Louisiana" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -93.608485, + 33.018527 + ], + [ + -91.16577, + 33.002096 + ], + [ + -91.072662, + 32.887081 + ], + [ + -91.143862, + 32.843265 + ], + [ + -91.154816, + 32.640618 + ], + [ + -91.006939, + 32.514649 + ], + [ + -90.985031, + 32.218894 + ], + [ + -91.105524, + 31.988862 + ], + [ + -91.341032, + 31.846462 + ], + [ + -91.401278, + 31.621907 + ], + [ + -91.499863, + 31.643815 + ], + [ + -91.516294, + 31.27686 + ], + [ + -91.636787, + 31.265906 + ], + [ + -91.565587, + 31.068736 + ], + [ + -91.636787, + 30.997536 + ], + [ + -89.747242, + 30.997536 + ], + [ + -89.845827, + 30.66892 + ], + [ + -89.681519, + 30.449842 + ], + [ + -89.643181, + 30.285534 + ], + [ + -89.522688, + 30.181472 + ], + [ + -89.818443, + 30.044549 + ], + [ + -89.84035, + 29.945964 + ], + [ + -89.599365, + 29.88024 + ], + [ + -89.495303, + 30.039072 + ], + [ + -89.287179, + 29.88024 + ], + [ + -89.30361, + 29.754271 + ], + [ + -89.424103, + 29.699501 + ], + [ + -89.648657, + 29.748794 + ], + [ + -89.621273, + 29.655686 + ], + [ + -89.69795, + 29.513285 + ], + [ + -89.506257, + 29.387316 + ], + [ + -89.199548, + 29.348977 + ], + [ + -89.09001, + 29.2011 + ], + [ + -89.002379, + 29.179192 + ], + [ + -89.16121, + 29.009407 + ], + [ + -89.336472, + 29.042268 + ], + [ + -89.484349, + 29.217531 + ], + [ + -89.851304, + 29.310638 + ], + [ + -89.851304, + 29.480424 + ], + [ + -90.032043, + 29.425654 + ], + [ + -90.021089, + 29.283254 + ], + [ + -90.103244, + 29.151807 + ], + [ + -90.23469, + 29.129899 + ], + [ + -90.333275, + 29.277777 + ], + [ + -90.563307, + 29.283254 + ], + [ + -90.645461, + 29.129899 + ], + [ + -90.798815, + 29.086084 + ], + [ + -90.963123, + 29.179192 + ], + [ + -91.09457, + 29.190146 + ], + [ + -91.220539, + 29.436608 + ], + [ + -91.445094, + 29.546147 + ], + [ + -91.532725, + 29.529716 + ], + [ + -91.620356, + 29.73784 + ], + [ + -91.883249, + 29.710455 + ], + [ + -91.888726, + 29.836425 + ], + [ + -92.146142, + 29.715932 + ], + [ + -92.113281, + 29.622824 + ], + [ + -92.31045, + 29.535193 + ], + [ + -92.617159, + 29.579009 + ], + [ + -92.97316, + 29.715932 + ], + [ + -93.2251, + 29.776178 + ], + [ + -93.767317, + 29.726886 + ], + [ + -93.838517, + 29.688547 + ], + [ + -93.926148, + 29.787132 + ], + [ + -93.690639, + 30.143133 + ], + [ + -93.767317, + 30.334826 + ], + [ + -93.696116, + 30.438888 + ], + [ + -93.728978, + 30.575812 + ], + [ + -93.630393, + 30.679874 + ], + [ + -93.526331, + 30.93729 + ], + [ + -93.542762, + 31.15089 + ], + [ + -93.816609, + 31.556184 + ], + [ + -93.822086, + 31.775262 + ], + [ + -94.041164, + 31.994339 + ], + [ + -94.041164, + 33.018527 + ], + [ + -93.608485, + 33.018527 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "23", + "properties": { + "name": "Maine" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -70.703921, + 43.057759 + ], + [ + -70.824413, + 43.128959 + ], + [ + -70.807983, + 43.227544 + ], + [ + -70.966814, + 43.34256 + ], + [ + -71.032537, + 44.657025 + ], + [ + -71.08183, + 45.303304 + ], + [ + -70.649151, + 45.440228 + ], + [ + -70.720352, + 45.511428 + ], + [ + -70.556043, + 45.664782 + ], + [ + -70.386258, + 45.735983 + ], + [ + -70.41912, + 45.796229 + ], + [ + -70.260289, + 45.889337 + ], + [ + -70.309581, + 46.064599 + ], + [ + -70.210996, + 46.327492 + ], + [ + -70.057642, + 46.415123 + ], + [ + -69.997395, + 46.694447 + ], + [ + -69.225147, + 47.461219 + ], + [ + -69.044408, + 47.428357 + ], + [ + -69.033454, + 47.242141 + ], + [ + -68.902007, + 47.176418 + ], + [ + -68.578868, + 47.285957 + ], + [ + -68.376221, + 47.285957 + ], + [ + -68.233821, + 47.357157 + ], + [ + -67.954497, + 47.198326 + ], + [ + -67.790188, + 47.066879 + ], + [ + -67.779235, + 45.944106 + ], + [ + -67.801142, + 45.675736 + ], + [ + -67.456095, + 45.604536 + ], + [ + -67.505388, + 45.48952 + ], + [ + -67.417757, + 45.379982 + ], + [ + -67.488957, + 45.281397 + ], + [ + -67.346556, + 45.128042 + ], + [ + -67.16034, + 45.160904 + ], + [ + -66.979601, + 44.804903 + ], + [ + -67.187725, + 44.646072 + ], + [ + -67.308218, + 44.706318 + ], + [ + -67.406803, + 44.596779 + ], + [ + -67.549203, + 44.624164 + ], + [ + -67.565634, + 44.531056 + ], + [ + -67.75185, + 44.54201 + ], + [ + -68.047605, + 44.328409 + ], + [ + -68.118805, + 44.476286 + ], + [ + -68.222867, + 44.48724 + ], + [ + -68.173574, + 44.328409 + ], + [ + -68.403606, + 44.251732 + ], + [ + -68.458375, + 44.377701 + ], + [ + -68.567914, + 44.311978 + ], + [ + -68.82533, + 44.311978 + ], + [ + -68.830807, + 44.459856 + ], + [ + -68.984161, + 44.426994 + ], + [ + -68.956777, + 44.322932 + ], + [ + -69.099177, + 44.103854 + ], + [ + -69.071793, + 44.043608 + ], + [ + -69.258008, + 43.923115 + ], + [ + -69.444224, + 43.966931 + ], + [ + -69.553763, + 43.840961 + ], + [ + -69.707118, + 43.82453 + ], + [ + -69.833087, + 43.720469 + ], + [ + -69.986442, + 43.742376 + ], + [ + -70.030257, + 43.851915 + ], + [ + -70.254812, + 43.676653 + ], + [ + -70.194565, + 43.567114 + ], + [ + -70.358873, + 43.528776 + ], + [ + -70.369827, + 43.435668 + ], + [ + -70.556043, + 43.320652 + ], + [ + -70.703921, + 43.057759 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "24", + "properties": { + "name": "Maryland" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -75.994645, + 37.95325 + ], + [ + -76.016553, + 37.95325 + ], + [ + -76.043938, + 37.95325 + ], + [ + -75.994645, + 37.95325 + ] + ] + ], + [ + [ + [ + -79.477979, + 39.722302 + ], + [ + -75.786521, + 39.722302 + ], + [ + -75.693413, + 38.462606 + ], + [ + -75.047134, + 38.451652 + ], + [ + -75.244304, + 38.029928 + ], + [ + -75.397659, + 38.013497 + ], + [ + -75.671506, + 37.95325 + ], + [ + -75.885106, + 37.909435 + ], + [ + -75.879629, + 38.073743 + ], + [ + -75.961783, + 38.139466 + ], + [ + -75.846768, + 38.210667 + ], + [ + -76.000122, + 38.374975 + ], + [ + -76.049415, + 38.303775 + ], + [ + -76.257538, + 38.320205 + ], + [ + -76.328738, + 38.500944 + ], + [ + -76.263015, + 38.500944 + ], + [ + -76.257538, + 38.736453 + ], + [ + -76.191815, + 38.829561 + ], + [ + -76.279446, + 39.147223 + ], + [ + -76.169907, + 39.333439 + ], + [ + -76.000122, + 39.366301 + ], + [ + -75.972737, + 39.557994 + ], + [ + -76.098707, + 39.536086 + ], + [ + -76.104184, + 39.437501 + ], + [ + -76.367077, + 39.311532 + ], + [ + -76.443754, + 39.196516 + ], + [ + -76.460185, + 38.906238 + ], + [ + -76.55877, + 38.769315 + ], + [ + -76.514954, + 38.539283 + ], + [ + -76.383508, + 38.380452 + ], + [ + -76.399939, + 38.259959 + ], + [ + -76.317785, + 38.139466 + ], + [ + -76.3616, + 38.057312 + ], + [ + -76.591632, + 38.216144 + ], + [ + -76.920248, + 38.292821 + ], + [ + -77.018833, + 38.446175 + ], + [ + -77.205049, + 38.358544 + ], + [ + -77.276249, + 38.479037 + ], + [ + -77.128372, + 38.632391 + ], + [ + -77.040741, + 38.791222 + ], + [ + -76.909294, + 38.895284 + ], + [ + -77.035264, + 38.993869 + ], + [ + -77.117418, + 38.933623 + ], + [ + -77.248864, + 39.026731 + ], + [ + -77.456988, + 39.076023 + ], + [ + -77.456988, + 39.223901 + ], + [ + -77.566527, + 39.306055 + ], + [ + -77.719881, + 39.322485 + ], + [ + -77.834897, + 39.601809 + ], + [ + -78.004682, + 39.601809 + ], + [ + -78.174467, + 39.694917 + ], + [ + -78.267575, + 39.61824 + ], + [ + -78.431884, + 39.623717 + ], + [ + -78.470222, + 39.514178 + ], + [ + -78.765977, + 39.585379 + ], + [ + -78.963147, + 39.437501 + ], + [ + -79.094593, + 39.470363 + ], + [ + -79.291763, + 39.300578 + ], + [ + -79.488933, + 39.20747 + ], + [ + -79.477979, + 39.722302 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "25", + "properties": { + "name": "Massachusetts" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -70.917521, + 42.887974 + ], + [ + -70.818936, + 42.871543 + ], + [ + -70.780598, + 42.696281 + ], + [ + -70.824413, + 42.55388 + ], + [ + -70.983245, + 42.422434 + ], + [ + -70.988722, + 42.269079 + ], + [ + -70.769644, + 42.247172 + ], + [ + -70.638197, + 42.08834 + ], + [ + -70.660105, + 41.962371 + ], + [ + -70.550566, + 41.929509 + ], + [ + -70.539613, + 41.814493 + ], + [ + -70.260289, + 41.715908 + ], + [ + -69.937149, + 41.809016 + ], + [ + -70.008349, + 41.672093 + ], + [ + -70.484843, + 41.5516 + ], + [ + -70.660105, + 41.546123 + ], + [ + -70.764167, + 41.639231 + ], + [ + -70.928475, + 41.611847 + ], + [ + -70.933952, + 41.540646 + ], + [ + -71.120168, + 41.496831 + ], + [ + -71.196845, + 41.67757 + ], + [ + -71.22423, + 41.710431 + ], + [ + -71.328292, + 41.781632 + ], + [ + -71.383061, + 42.01714 + ], + [ + -71.530939, + 42.01714 + ], + [ + -71.799309, + 42.006186 + ], + [ + -71.799309, + 42.022617 + ], + [ + -73.053528, + 42.039048 + ], + [ + -73.486206, + 42.050002 + ], + [ + -73.508114, + 42.08834 + ], + [ + -73.267129, + 42.745573 + ], + [ + -72.456542, + 42.729142 + ], + [ + -71.29543, + 42.696281 + ], + [ + -71.185891, + 42.789389 + ], + [ + -70.917521, + 42.887974 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "26", + "properties": { + "name": "Michigan" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -83.454238, + 41.732339 + ], + [ + -84.807042, + 41.694001 + ], + [ + -84.807042, + 41.759724 + ], + [ + -85.990061, + 41.759724 + ], + [ + -86.822556, + 41.759724 + ], + [ + -86.619909, + 41.891171 + ], + [ + -86.482986, + 42.115725 + ], + [ + -86.357016, + 42.252649 + ], + [ + -86.263908, + 42.444341 + ], + [ + -86.209139, + 42.718189 + ], + [ + -86.231047, + 43.013943 + ], + [ + -86.526801, + 43.594499 + ], + [ + -86.433693, + 43.813577 + ], + [ + -86.499417, + 44.07647 + ], + [ + -86.269385, + 44.34484 + ], + [ + -86.220093, + 44.569394 + ], + [ + -86.252954, + 44.689887 + ], + [ + -86.088646, + 44.73918 + ], + [ + -86.066738, + 44.903488 + ], + [ + -85.809322, + 44.947303 + ], + [ + -85.612152, + 45.128042 + ], + [ + -85.628583, + 44.766564 + ], + [ + -85.524521, + 44.750133 + ], + [ + -85.393075, + 44.930872 + ], + [ + -85.387598, + 45.237581 + ], + [ + -85.305444, + 45.314258 + ], + [ + -85.031597, + 45.363551 + ], + [ + -85.119228, + 45.577151 + ], + [ + -84.938489, + 45.75789 + ], + [ + -84.713934, + 45.768844 + ], + [ + -84.461995, + 45.653829 + ], + [ + -84.215533, + 45.637398 + ], + [ + -84.09504, + 45.494997 + ], + [ + -83.908824, + 45.484043 + ], + [ + -83.596638, + 45.352597 + ], + [ + -83.4871, + 45.358074 + ], + [ + -83.317314, + 45.144473 + ], + [ + -83.454238, + 45.029457 + ], + [ + -83.322791, + 44.88158 + ], + [ + -83.273499, + 44.711795 + ], + [ + -83.333745, + 44.339363 + ], + [ + -83.536392, + 44.246255 + ], + [ + -83.585684, + 44.054562 + ], + [ + -83.82667, + 43.988839 + ], + [ + -83.958116, + 43.758807 + ], + [ + -83.908824, + 43.671176 + ], + [ + -83.667839, + 43.589022 + ], + [ + -83.481623, + 43.714992 + ], + [ + -83.262545, + 43.972408 + ], + [ + -82.917498, + 44.070993 + ], + [ + -82.747713, + 43.994316 + ], + [ + -82.643651, + 43.851915 + ], + [ + -82.539589, + 43.435668 + ], + [ + -82.523158, + 43.227544 + ], + [ + -82.413619, + 42.975605 + ], + [ + -82.517681, + 42.614127 + ], + [ + -82.681989, + 42.559357 + ], + [ + -82.687466, + 42.690804 + ], + [ + -82.797005, + 42.652465 + ], + [ + -82.922975, + 42.351234 + ], + [ + -83.125621, + 42.236218 + ], + [ + -83.185868, + 42.006186 + ], + [ + -83.437807, + 41.814493 + ], + [ + -83.454238, + 41.732339 + ] + ] + ], + [ + [ + [ + -85.508091, + 45.730506 + ], + [ + -85.49166, + 45.610013 + ], + [ + -85.623106, + 45.588105 + ], + [ + -85.568337, + 45.75789 + ], + [ + -85.508091, + 45.730506 + ] + ] + ], + [ + [ + [ + -87.589328, + 45.095181 + ], + [ + -87.742682, + 45.199243 + ], + [ + -87.649574, + 45.341643 + ], + [ + -87.885083, + 45.363551 + ], + [ + -87.791975, + 45.500474 + ], + [ + -87.781021, + 45.675736 + ], + [ + -87.989145, + 45.796229 + ], + [ + -88.10416, + 45.922199 + ], + [ + -88.531362, + 46.020784 + ], + [ + -88.662808, + 45.987922 + ], + [ + -89.09001, + 46.135799 + ], + [ + -90.119674, + 46.338446 + ], + [ + -90.229213, + 46.508231 + ], + [ + -90.415429, + 46.568478 + ], + [ + -90.026566, + 46.672539 + ], + [ + -89.851304, + 46.793032 + ], + [ + -89.413149, + 46.842325 + ], + [ + -89.128348, + 46.990202 + ], + [ + -88.996902, + 46.995679 + ], + [ + -88.887363, + 47.099741 + ], + [ + -88.575177, + 47.247618 + ], + [ + -88.416346, + 47.373588 + ], + [ + -88.180837, + 47.455742 + ], + [ + -87.956283, + 47.384542 + ], + [ + -88.350623, + 47.077833 + ], + [ + -88.443731, + 46.973771 + ], + [ + -88.438254, + 46.787555 + ], + [ + -88.246561, + 46.929956 + ], + [ + -87.901513, + 46.908048 + ], + [ + -87.633143, + 46.809463 + ], + [ + -87.392158, + 46.535616 + ], + [ + -87.260711, + 46.486323 + ], + [ + -87.008772, + 46.530139 + ], + [ + -86.948526, + 46.469893 + ], + [ + -86.696587, + 46.437031 + ], + [ + -86.159846, + 46.667063 + ], + [ + -85.880522, + 46.68897 + ], + [ + -85.508091, + 46.678016 + ], + [ + -85.256151, + 46.754694 + ], + [ + -85.064458, + 46.760171 + ], + [ + -85.02612, + 46.480847 + ], + [ + -84.82895, + 46.442508 + ], + [ + -84.63178, + 46.486323 + ], + [ + -84.549626, + 46.4206 + ], + [ + -84.418179, + 46.502754 + ], + [ + -84.127902, + 46.530139 + ], + [ + -84.122425, + 46.179615 + ], + [ + -83.990978, + 46.031737 + ], + [ + -83.793808, + 45.993399 + ], + [ + -83.7719, + 46.091984 + ], + [ + -83.580208, + 46.091984 + ], + [ + -83.476146, + 45.987922 + ], + [ + -83.563777, + 45.911245 + ], + [ + -84.111471, + 45.976968 + ], + [ + -84.374364, + 45.933153 + ], + [ + -84.659165, + 46.053645 + ], + [ + -84.741319, + 45.944106 + ], + [ + -84.70298, + 45.850998 + ], + [ + -84.82895, + 45.872906 + ], + [ + -85.015166, + 46.00983 + ], + [ + -85.338305, + 46.091984 + ], + [ + -85.502614, + 46.097461 + ], + [ + -85.661445, + 45.966014 + ], + [ + -85.924338, + 45.933153 + ], + [ + -86.209139, + 45.960537 + ], + [ + -86.324155, + 45.905768 + ], + [ + -86.351539, + 45.796229 + ], + [ + -86.663725, + 45.703121 + ], + [ + -86.647294, + 45.834568 + ], + [ + -86.784218, + 45.861952 + ], + [ + -86.838987, + 45.725029 + ], + [ + -87.069019, + 45.719552 + ], + [ + -87.17308, + 45.659305 + ], + [ + -87.326435, + 45.423797 + ], + [ + -87.611236, + 45.122565 + ], + [ + -87.589328, + 45.095181 + ] + ] + ], + [ + [ + [ + -88.805209, + 47.976051 + ], + [ + -89.057148, + 47.850082 + ], + [ + -89.188594, + 47.833651 + ], + [ + -89.177641, + 47.937713 + ], + [ + -88.547792, + 48.173221 + ], + [ + -88.668285, + 48.008913 + ], + [ + -88.805209, + 47.976051 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "27", + "properties": { + "name": "Minnesota" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -92.014696, + 46.705401 + ], + [ + -92.091373, + 46.749217 + ], + [ + -92.29402, + 46.667063 + ], + [ + -92.29402, + 46.075553 + ], + [ + -92.354266, + 46.015307 + ], + [ + -92.639067, + 45.933153 + ], + [ + -92.869098, + 45.719552 + ], + [ + -92.885529, + 45.577151 + ], + [ + -92.770513, + 45.566198 + ], + [ + -92.644544, + 45.440228 + ], + [ + -92.75956, + 45.286874 + ], + [ + -92.737652, + 45.117088 + ], + [ + -92.808852, + 44.750133 + ], + [ + -92.545959, + 44.569394 + ], + [ + -92.337835, + 44.552964 + ], + [ + -92.233773, + 44.443425 + ], + [ + -91.927065, + 44.333886 + ], + [ + -91.877772, + 44.202439 + ], + [ + -91.592971, + 44.032654 + ], + [ + -91.43414, + 43.994316 + ], + [ + -91.242447, + 43.775238 + ], + [ + -91.269832, + 43.616407 + ], + [ + -91.215062, + 43.501391 + ], + [ + -91.368417, + 43.501391 + ], + [ + -96.451017, + 43.501391 + ], + [ + -96.451017, + 45.297827 + ], + [ + -96.681049, + 45.412843 + ], + [ + -96.856311, + 45.604536 + ], + [ + -96.582464, + 45.818137 + ], + [ + -96.560556, + 45.933153 + ], + [ + -96.598895, + 46.332969 + ], + [ + -96.719387, + 46.437031 + ], + [ + -96.801542, + 46.656109 + ], + [ + -96.785111, + 46.924479 + ], + [ + -96.823449, + 46.968294 + ], + [ + -96.856311, + 47.609096 + ], + [ + -97.053481, + 47.948667 + ], + [ + -97.130158, + 48.140359 + ], + [ + -97.16302, + 48.545653 + ], + [ + -97.097296, + 48.682577 + ], + [ + -97.228743, + 49.000239 + ], + [ + -95.152983, + 49.000239 + ], + [ + -95.152983, + 49.383625 + ], + [ + -94.955813, + 49.372671 + ], + [ + -94.824366, + 49.295994 + ], + [ + -94.69292, + 48.775685 + ], + [ + -94.588858, + 48.715438 + ], + [ + -94.260241, + 48.699007 + ], + [ + -94.221903, + 48.649715 + ], + [ + -93.838517, + 48.627807 + ], + [ + -93.794701, + 48.518268 + ], + [ + -93.466085, + 48.545653 + ], + [ + -93.466085, + 48.589469 + ], + [ + -93.208669, + 48.644238 + ], + [ + -92.984114, + 48.62233 + ], + [ + -92.726698, + 48.540176 + ], + [ + -92.655498, + 48.436114 + ], + [ + -92.50762, + 48.447068 + ], + [ + -92.370697, + 48.222514 + ], + [ + -92.304974, + 48.315622 + ], + [ + -92.053034, + 48.359437 + ], + [ + -92.009219, + 48.266329 + ], + [ + -91.713464, + 48.200606 + ], + [ + -91.713464, + 48.112975 + ], + [ + -91.565587, + 48.041775 + ], + [ + -91.264355, + 48.080113 + ], + [ + -91.083616, + 48.178698 + ], + [ + -90.837154, + 48.238944 + ], + [ + -90.749522, + 48.091067 + ], + [ + -90.579737, + 48.123929 + ], + [ + -90.377091, + 48.091067 + ], + [ + -90.141582, + 48.112975 + ], + [ + -89.873212, + 47.987005 + ], + [ + -89.615796, + 48.008913 + ], + [ + -89.637704, + 47.954144 + ], + [ + -89.971797, + 47.828174 + ], + [ + -90.437337, + 47.729589 + ], + [ + -90.738569, + 47.625527 + ], + [ + -91.171247, + 47.368111 + ], + [ + -91.357463, + 47.20928 + ], + [ + -91.642264, + 47.028541 + ], + [ + -92.091373, + 46.787555 + ], + [ + -92.014696, + 46.705401 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "28", + "properties": { + "name": "Mississippi" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -88.471115, + 34.995703 + ], + [ + -88.202745, + 34.995703 + ], + [ + -88.098683, + 34.891641 + ], + [ + -88.241084, + 33.796253 + ], + [ + -88.471115, + 31.895754 + ], + [ + -88.394438, + 30.367688 + ], + [ + -88.503977, + 30.323872 + ], + [ + -88.744962, + 30.34578 + ], + [ + -88.843547, + 30.411504 + ], + [ + -89.084533, + 30.367688 + ], + [ + -89.418626, + 30.252672 + ], + [ + -89.522688, + 30.181472 + ], + [ + -89.643181, + 30.285534 + ], + [ + -89.681519, + 30.449842 + ], + [ + -89.845827, + 30.66892 + ], + [ + -89.747242, + 30.997536 + ], + [ + -91.636787, + 30.997536 + ], + [ + -91.565587, + 31.068736 + ], + [ + -91.636787, + 31.265906 + ], + [ + -91.516294, + 31.27686 + ], + [ + -91.499863, + 31.643815 + ], + [ + -91.401278, + 31.621907 + ], + [ + -91.341032, + 31.846462 + ], + [ + -91.105524, + 31.988862 + ], + [ + -90.985031, + 32.218894 + ], + [ + -91.006939, + 32.514649 + ], + [ + -91.154816, + 32.640618 + ], + [ + -91.143862, + 32.843265 + ], + [ + -91.072662, + 32.887081 + ], + [ + -91.16577, + 33.002096 + ], + [ + -91.089093, + 33.13902 + ], + [ + -91.143862, + 33.347144 + ], + [ + -91.056231, + 33.429298 + ], + [ + -91.231493, + 33.560744 + ], + [ + -91.072662, + 33.867453 + ], + [ + -90.891923, + 34.026284 + ], + [ + -90.952169, + 34.135823 + ], + [ + -90.744046, + 34.300131 + ], + [ + -90.749522, + 34.365854 + ], + [ + -90.568783, + 34.420624 + ], + [ + -90.585214, + 34.617794 + ], + [ + -90.481152, + 34.661609 + ], + [ + -90.409952, + 34.831394 + ], + [ + -90.251121, + 34.908072 + ], + [ + -90.311367, + 34.995703 + ], + [ + -88.471115, + 34.995703 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "29", + "properties": { + "name": "Missouri" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -91.833957, + 40.609566 + ], + [ + -91.729895, + 40.615043 + ], + [ + -91.527248, + 40.412397 + ], + [ + -91.417709, + 40.379535 + ], + [ + -91.50534, + 40.237135 + ], + [ + -91.494386, + 40.034488 + ], + [ + -91.368417, + 39.727779 + ], + [ + -91.061708, + 39.470363 + ], + [ + -90.727615, + 39.256762 + ], + [ + -90.661891, + 38.928146 + ], + [ + -90.585214, + 38.867899 + ], + [ + -90.470199, + 38.961007 + ], + [ + -90.251121, + 38.917192 + ], + [ + -90.10872, + 38.845992 + ], + [ + -90.207305, + 38.725499 + ], + [ + -90.179921, + 38.632391 + ], + [ + -90.349706, + 38.374975 + ], + [ + -90.355183, + 38.216144 + ], + [ + -90.059428, + 38.013497 + ], + [ + -89.949889, + 37.88205 + ], + [ + -89.84035, + 37.903958 + ], + [ + -89.517211, + 37.690357 + ], + [ + -89.517211, + 37.537003 + ], + [ + -89.435057, + 37.34531 + ], + [ + -89.517211, + 37.279587 + ], + [ + -89.292656, + 36.994786 + ], + [ + -89.133825, + 36.983832 + ], + [ + -89.215979, + 36.578538 + ], + [ + -89.363857, + 36.622354 + ], + [ + -89.418626, + 36.496384 + ], + [ + -89.484349, + 36.496384 + ], + [ + -89.539119, + 36.496384 + ], + [ + -89.533642, + 36.249922 + ], + [ + -89.730812, + 35.997983 + ], + [ + -90.377091, + 35.997983 + ], + [ + -90.218259, + 36.184199 + ], + [ + -90.064905, + 36.304691 + ], + [ + -90.152536, + 36.496384 + ], + [ + -94.473842, + 36.501861 + ], + [ + -94.616242, + 36.501861 + ], + [ + -94.616242, + 37.000263 + ], + [ + -94.610765, + 39.158177 + ], + [ + -94.824366, + 39.20747 + ], + [ + -94.983197, + 39.442978 + ], + [ + -95.109167, + 39.541563 + ], + [ + -94.884612, + 39.831841 + ], + [ + -95.207752, + 39.908518 + ], + [ + -95.306337, + 40.001626 + ], + [ + -95.552799, + 40.264519 + ], + [ + -95.7664, + 40.587659 + ], + [ + -94.632673, + 40.571228 + ], + [ + -93.257961, + 40.582182 + ], + [ + -91.833957, + 40.609566 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "30", + "properties": { + "name": "Montana" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -104.047534, + 49.000239 + ], + [ + -104.042057, + 47.861036 + ], + [ + -104.047534, + 45.944106 + ], + [ + -104.042057, + 44.996596 + ], + [ + -104.058488, + 44.996596 + ], + [ + -105.91517, + 45.002073 + ], + [ + -109.080842, + 45.002073 + ], + [ + -111.05254, + 45.002073 + ], + [ + -111.047063, + 44.476286 + ], + [ + -111.227803, + 44.580348 + ], + [ + -111.386634, + 44.75561 + ], + [ + -111.616665, + 44.547487 + ], + [ + -111.819312, + 44.509148 + ], + [ + -111.868605, + 44.563917 + ], + [ + -112.104113, + 44.520102 + ], + [ + -112.241036, + 44.569394 + ], + [ + -112.471068, + 44.481763 + ], + [ + -112.783254, + 44.48724 + ], + [ + -112.887315, + 44.394132 + ], + [ + -113.002331, + 44.448902 + ], + [ + -113.133778, + 44.772041 + ], + [ + -113.341901, + 44.782995 + ], + [ + -113.456917, + 44.865149 + ], + [ + -113.45144, + 45.056842 + ], + [ + -113.571933, + 45.128042 + ], + [ + -113.736241, + 45.330689 + ], + [ + -113.834826, + 45.522382 + ], + [ + -113.807441, + 45.604536 + ], + [ + -113.98818, + 45.703121 + ], + [ + -114.086765, + 45.593582 + ], + [ + -114.333228, + 45.456659 + ], + [ + -114.546828, + 45.560721 + ], + [ + -114.497536, + 45.670259 + ], + [ + -114.568736, + 45.774321 + ], + [ + -114.387997, + 45.88386 + ], + [ + -114.492059, + 46.037214 + ], + [ + -114.464674, + 46.272723 + ], + [ + -114.322274, + 46.645155 + ], + [ + -114.612552, + 46.639678 + ], + [ + -114.623506, + 46.705401 + ], + [ + -114.886399, + 46.809463 + ], + [ + -114.930214, + 46.919002 + ], + [ + -115.302646, + 47.187372 + ], + [ + -115.324554, + 47.258572 + ], + [ + -115.527201, + 47.302388 + ], + [ + -115.718894, + 47.42288 + ], + [ + -115.724371, + 47.696727 + ], + [ + -116.04751, + 47.976051 + ], + [ + -116.04751, + 49.000239 + ], + [ + -111.50165, + 48.994762 + ], + [ + -109.453274, + 49.000239 + ], + [ + -104.047534, + 49.000239 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "31", + "properties": { + "name": "Nebraska" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -103.324578, + 43.002989 + ], + [ + -101.626726, + 42.997512 + ], + [ + -98.499393, + 42.997512 + ], + [ + -98.466531, + 42.94822 + ], + [ + -97.951699, + 42.767481 + ], + [ + -97.831206, + 42.866066 + ], + [ + -97.688806, + 42.844158 + ], + [ + -97.217789, + 42.844158 + ], + [ + -96.692003, + 42.657942 + ], + [ + -96.626279, + 42.515542 + ], + [ + -96.44554, + 42.488157 + ], + [ + -96.264801, + 42.039048 + ], + [ + -96.127878, + 41.973325 + ], + [ + -96.062155, + 41.798063 + ], + [ + -96.122401, + 41.67757 + ], + [ + -96.095016, + 41.540646 + ], + [ + -95.919754, + 41.453015 + ], + [ + -95.925231, + 41.201076 + ], + [ + -95.826646, + 40.976521 + ], + [ + -95.881416, + 40.719105 + ], + [ + -95.7664, + 40.587659 + ], + [ + -95.552799, + 40.264519 + ], + [ + -95.306337, + 40.001626 + ], + [ + -101.90605, + 40.001626 + ], + [ + -102.053927, + 40.001626 + ], + [ + -102.053927, + 41.003906 + ], + [ + -104.053011, + 41.003906 + ], + [ + -104.053011, + 43.002989 + ], + [ + -103.324578, + 43.002989 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "32", + "properties": { + "name": "Nevada" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -117.027882, + 42.000709 + ], + [ + -114.04295, + 41.995232 + ], + [ + -114.048427, + 37.000263 + ], + [ + -114.048427, + 36.195153 + ], + [ + -114.152489, + 36.025367 + ], + [ + -114.251074, + 36.01989 + ], + [ + -114.371566, + 36.140383 + ], + [ + -114.738521, + 36.102045 + ], + [ + -114.678275, + 35.516012 + ], + [ + -114.596121, + 35.324319 + ], + [ + -114.574213, + 35.138103 + ], + [ + -114.634459, + 35.00118 + ], + [ + -115.85034, + 35.970598 + ], + [ + -116.540435, + 36.501861 + ], + [ + -117.498899, + 37.21934 + ], + [ + -118.71478, + 38.101128 + ], + [ + -120.001861, + 38.999346 + ], + [ + -119.996384, + 40.264519 + ], + [ + -120.001861, + 41.995232 + ], + [ + -118.698349, + 41.989755 + ], + [ + -117.027882, + 42.000709 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "33", + "properties": { + "name": "New Hampshire" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -71.08183, + 45.303304 + ], + [ + -71.032537, + 44.657025 + ], + [ + -70.966814, + 43.34256 + ], + [ + -70.807983, + 43.227544 + ], + [ + -70.824413, + 43.128959 + ], + [ + -70.703921, + 43.057759 + ], + [ + -70.818936, + 42.871543 + ], + [ + -70.917521, + 42.887974 + ], + [ + -71.185891, + 42.789389 + ], + [ + -71.29543, + 42.696281 + ], + [ + -72.456542, + 42.729142 + ], + [ + -72.544173, + 42.80582 + ], + [ + -72.533219, + 42.953697 + ], + [ + -72.445588, + 43.008466 + ], + [ + -72.456542, + 43.150867 + ], + [ + -72.379864, + 43.572591 + ], + [ + -72.204602, + 43.769761 + ], + [ + -72.116971, + 43.994316 + ], + [ + -72.02934, + 44.07647 + ], + [ + -72.034817, + 44.322932 + ], + [ + -71.700724, + 44.41604 + ], + [ + -71.536416, + 44.585825 + ], + [ + -71.629524, + 44.750133 + ], + [ + -71.4926, + 44.914442 + ], + [ + -71.503554, + 45.013027 + ], + [ + -71.361154, + 45.270443 + ], + [ + -71.131122, + 45.243058 + ], + [ + -71.08183, + 45.303304 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "34", + "properties": { + "name": "New Jersey" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.236547, + 41.14083 + ], + [ + -73.902454, + 40.998429 + ], + [ + -74.022947, + 40.708151 + ], + [ + -74.187255, + 40.642428 + ], + [ + -74.274886, + 40.489074 + ], + [ + -74.001039, + 40.412397 + ], + [ + -73.979131, + 40.297381 + ], + [ + -74.099624, + 39.760641 + ], + [ + -74.411809, + 39.360824 + ], + [ + -74.614456, + 39.245808 + ], + [ + -74.795195, + 38.993869 + ], + [ + -74.888303, + 39.158177 + ], + [ + -75.178581, + 39.240331 + ], + [ + -75.534582, + 39.459409 + ], + [ + -75.55649, + 39.607286 + ], + [ + -75.561967, + 39.629194 + ], + [ + -75.507197, + 39.683964 + ], + [ + -75.414089, + 39.804456 + ], + [ + -75.145719, + 39.88661 + ], + [ + -75.129289, + 39.963288 + ], + [ + -74.82258, + 40.127596 + ], + [ + -74.773287, + 40.215227 + ], + [ + -75.058088, + 40.417874 + ], + [ + -75.069042, + 40.543843 + ], + [ + -75.195012, + 40.576705 + ], + [ + -75.205966, + 40.691721 + ], + [ + -75.052611, + 40.866983 + ], + [ + -75.134765, + 40.971045 + ], + [ + -74.882826, + 41.179168 + ], + [ + -74.828057, + 41.288707 + ], + [ + -74.69661, + 41.359907 + ], + [ + -74.236547, + 41.14083 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "35", + "properties": { + "name": "New Mexico" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -107.421329, + 37.000263 + ], + [ + -106.868158, + 36.994786 + ], + [ + -104.337812, + 36.994786 + ], + [ + -103.001438, + 37.000263 + ], + [ + -103.001438, + 36.501861 + ], + [ + -103.039777, + 36.501861 + ], + [ + -103.045254, + 34.01533 + ], + [ + -103.067161, + 33.002096 + ], + [ + -103.067161, + 31.999816 + ], + [ + -106.616219, + 31.999816 + ], + [ + -106.643603, + 31.901231 + ], + [ + -106.528588, + 31.786216 + ], + [ + -108.210008, + 31.786216 + ], + [ + -108.210008, + 31.331629 + ], + [ + -109.04798, + 31.331629 + ], + [ + -109.042503, + 37.000263 + ], + [ + -107.421329, + 37.000263 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "36", + "properties": { + "name": "New York" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.343806, + 45.013027 + ], + [ + -73.332852, + 44.804903 + ], + [ + -73.387622, + 44.618687 + ], + [ + -73.294514, + 44.437948 + ], + [ + -73.321898, + 44.246255 + ], + [ + -73.436914, + 44.043608 + ], + [ + -73.349283, + 43.769761 + ], + [ + -73.404052, + 43.687607 + ], + [ + -73.245221, + 43.523299 + ], + [ + -73.278083, + 42.833204 + ], + [ + -73.267129, + 42.745573 + ], + [ + -73.508114, + 42.08834 + ], + [ + -73.486206, + 42.050002 + ], + [ + -73.55193, + 41.294184 + ], + [ + -73.48073, + 41.21203 + ], + [ + -73.727192, + 41.102491 + ], + [ + -73.655992, + 40.987475 + ], + [ + -73.22879, + 40.905321 + ], + [ + -73.141159, + 40.965568 + ], + [ + -72.774204, + 40.965568 + ], + [ + -72.587988, + 40.998429 + ], + [ + -72.28128, + 41.157261 + ], + [ + -72.259372, + 41.042245 + ], + [ + -72.100541, + 40.992952 + ], + [ + -72.467496, + 40.845075 + ], + [ + -73.239744, + 40.625997 + ], + [ + -73.562884, + 40.582182 + ], + [ + -73.776484, + 40.593136 + ], + [ + -73.935316, + 40.543843 + ], + [ + -74.022947, + 40.708151 + ], + [ + -73.902454, + 40.998429 + ], + [ + -74.236547, + 41.14083 + ], + [ + -74.69661, + 41.359907 + ], + [ + -74.740426, + 41.431108 + ], + [ + -74.89378, + 41.436584 + ], + [ + -75.074519, + 41.60637 + ], + [ + -75.052611, + 41.754247 + ], + [ + -75.173104, + 41.869263 + ], + [ + -75.249781, + 41.863786 + ], + [ + -75.35932, + 42.000709 + ], + [ + -79.76278, + 42.000709 + ], + [ + -79.76278, + 42.252649 + ], + [ + -79.76278, + 42.269079 + ], + [ + -79.149363, + 42.55388 + ], + [ + -79.050778, + 42.690804 + ], + [ + -78.853608, + 42.783912 + ], + [ + -78.930285, + 42.953697 + ], + [ + -79.012439, + 42.986559 + ], + [ + -79.072686, + 43.260406 + ], + [ + -78.486653, + 43.375421 + ], + [ + -77.966344, + 43.369944 + ], + [ + -77.75822, + 43.34256 + ], + [ + -77.533665, + 43.233021 + ], + [ + -77.391265, + 43.276836 + ], + [ + -76.958587, + 43.271359 + ], + [ + -76.695693, + 43.34256 + ], + [ + -76.41637, + 43.523299 + ], + [ + -76.235631, + 43.528776 + ], + [ + -76.230154, + 43.802623 + ], + [ + -76.137046, + 43.961454 + ], + [ + -76.3616, + 44.070993 + ], + [ + -76.312308, + 44.196962 + ], + [ + -75.912491, + 44.366748 + ], + [ + -75.764614, + 44.514625 + ], + [ + -75.282643, + 44.848718 + ], + [ + -74.828057, + 45.018503 + ], + [ + -74.148916, + 44.991119 + ], + [ + -73.343806, + 45.013027 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "37", + "properties": { + "name": "North Carolina" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -80.978661, + 36.562108 + ], + [ + -80.294043, + 36.545677 + ], + [ + -79.510841, + 36.5402 + ], + [ + -75.868676, + 36.551154 + ], + [ + -75.75366, + 36.151337 + ], + [ + -76.032984, + 36.189676 + ], + [ + -76.071322, + 36.140383 + ], + [ + -76.410893, + 36.080137 + ], + [ + -76.460185, + 36.025367 + ], + [ + -76.68474, + 36.008937 + ], + [ + -76.673786, + 35.937736 + ], + [ + -76.399939, + 35.987029 + ], + [ + -76.3616, + 35.943213 + ], + [ + -76.060368, + 35.992506 + ], + [ + -75.961783, + 35.899398 + ], + [ + -75.781044, + 35.937736 + ], + [ + -75.715321, + 35.696751 + ], + [ + -75.775568, + 35.581735 + ], + [ + -75.89606, + 35.570781 + ], + [ + -76.147999, + 35.324319 + ], + [ + -76.482093, + 35.313365 + ], + [ + -76.536862, + 35.14358 + ], + [ + -76.394462, + 34.973795 + ], + [ + -76.279446, + 34.940933 + ], + [ + -76.493047, + 34.661609 + ], + [ + -76.673786, + 34.694471 + ], + [ + -76.991448, + 34.667086 + ], + [ + -77.210526, + 34.60684 + ], + [ + -77.555573, + 34.415147 + ], + [ + -77.82942, + 34.163208 + ], + [ + -77.971821, + 33.845545 + ], + [ + -78.179944, + 33.916745 + ], + [ + -78.541422, + 33.851022 + ], + [ + -79.675149, + 34.80401 + ], + [ + -80.797922, + 34.820441 + ], + [ + -80.781491, + 34.935456 + ], + [ + -80.934845, + 35.105241 + ], + [ + -81.038907, + 35.044995 + ], + [ + -81.044384, + 35.149057 + ], + [ + -82.276696, + 35.198349 + ], + [ + -82.550543, + 35.160011 + ], + [ + -82.764143, + 35.066903 + ], + [ + -83.109191, + 35.00118 + ], + [ + -83.618546, + 34.984749 + ], + [ + -84.319594, + 34.990226 + ], + [ + -84.29221, + 35.225734 + ], + [ + -84.09504, + 35.247642 + ], + [ + -84.018363, + 35.41195 + ], + [ + -83.7719, + 35.559827 + ], + [ + -83.498053, + 35.565304 + ], + [ + -83.251591, + 35.718659 + ], + [ + -82.994175, + 35.773428 + ], + [ + -82.775097, + 35.997983 + ], + [ + -82.638174, + 36.063706 + ], + [ + -82.610789, + 35.965121 + ], + [ + -82.216449, + 36.156814 + ], + [ + -82.03571, + 36.118475 + ], + [ + -81.909741, + 36.304691 + ], + [ + -81.723525, + 36.353984 + ], + [ + -81.679709, + 36.589492 + ], + [ + -80.978661, + 36.562108 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "38", + "properties": { + "name": "North Dakota" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -97.228743, + 49.000239 + ], + [ + -97.097296, + 48.682577 + ], + [ + -97.16302, + 48.545653 + ], + [ + -97.130158, + 48.140359 + ], + [ + -97.053481, + 47.948667 + ], + [ + -96.856311, + 47.609096 + ], + [ + -96.823449, + 46.968294 + ], + [ + -96.785111, + 46.924479 + ], + [ + -96.801542, + 46.656109 + ], + [ + -96.719387, + 46.437031 + ], + [ + -96.598895, + 46.332969 + ], + [ + -96.560556, + 45.933153 + ], + [ + -104.047534, + 45.944106 + ], + [ + -104.042057, + 47.861036 + ], + [ + -104.047534, + 49.000239 + ], + [ + -97.228743, + 49.000239 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "39", + "properties": { + "name": "Ohio" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -80.518598, + 41.978802 + ], + [ + -80.518598, + 40.636951 + ], + [ + -80.666475, + 40.582182 + ], + [ + -80.595275, + 40.472643 + ], + [ + -80.600752, + 40.319289 + ], + [ + -80.737675, + 40.078303 + ], + [ + -80.830783, + 39.711348 + ], + [ + -81.219646, + 39.388209 + ], + [ + -81.345616, + 39.344393 + ], + [ + -81.455155, + 39.410117 + ], + [ + -81.57017, + 39.267716 + ], + [ + -81.685186, + 39.273193 + ], + [ + -81.811156, + 39.0815 + ], + [ + -81.783771, + 38.966484 + ], + [ + -81.887833, + 38.873376 + ], + [ + -82.03571, + 39.026731 + ], + [ + -82.221926, + 38.785745 + ], + [ + -82.172634, + 38.632391 + ], + [ + -82.293127, + 38.577622 + ], + [ + -82.331465, + 38.446175 + ], + [ + -82.594358, + 38.424267 + ], + [ + -82.731282, + 38.561191 + ], + [ + -82.846298, + 38.588575 + ], + [ + -82.890113, + 38.758361 + ], + [ + -83.032514, + 38.725499 + ], + [ + -83.142052, + 38.626914 + ], + [ + -83.519961, + 38.703591 + ], + [ + -83.678792, + 38.632391 + ], + [ + -83.903347, + 38.769315 + ], + [ + -84.215533, + 38.807653 + ], + [ + -84.231963, + 38.895284 + ], + [ + -84.43461, + 39.103408 + ], + [ + -84.817996, + 39.103408 + ], + [ + -84.801565, + 40.500028 + ], + [ + -84.807042, + 41.694001 + ], + [ + -83.454238, + 41.732339 + ], + [ + -83.065375, + 41.595416 + ], + [ + -82.933929, + 41.513262 + ], + [ + -82.835344, + 41.589939 + ], + [ + -82.616266, + 41.431108 + ], + [ + -82.479343, + 41.381815 + ], + [ + -82.013803, + 41.513262 + ], + [ + -81.739956, + 41.485877 + ], + [ + -81.444201, + 41.672093 + ], + [ + -81.011523, + 41.852832 + ], + [ + -80.518598, + 41.978802 + ], + [ + -80.518598, + 41.978802 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "40", + "properties": { + "name": "Oklahoma" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -100.087706, + 37.000263 + ], + [ + -94.616242, + 37.000263 + ], + [ + -94.616242, + 36.501861 + ], + [ + -94.430026, + 35.395519 + ], + [ + -94.484796, + 33.637421 + ], + [ + -94.868182, + 33.74696 + ], + [ + -94.966767, + 33.861976 + ], + [ + -95.224183, + 33.960561 + ], + [ + -95.289906, + 33.87293 + ], + [ + -95.547322, + 33.878407 + ], + [ + -95.602092, + 33.933176 + ], + [ + -95.8376, + 33.834591 + ], + [ + -95.936185, + 33.889361 + ], + [ + -96.149786, + 33.840068 + ], + [ + -96.346956, + 33.686714 + ], + [ + -96.423633, + 33.774345 + ], + [ + -96.631756, + 33.845545 + ], + [ + -96.850834, + 33.845545 + ], + [ + -96.922034, + 33.960561 + ], + [ + -97.173974, + 33.736006 + ], + [ + -97.256128, + 33.861976 + ], + [ + -97.371143, + 33.823637 + ], + [ + -97.458774, + 33.905791 + ], + [ + -97.694283, + 33.982469 + ], + [ + -97.869545, + 33.851022 + ], + [ + -97.946222, + 33.987946 + ], + [ + -98.088623, + 34.004376 + ], + [ + -98.170777, + 34.113915 + ], + [ + -98.36247, + 34.157731 + ], + [ + -98.488439, + 34.064623 + ], + [ + -98.570593, + 34.146777 + ], + [ + -98.767763, + 34.135823 + ], + [ + -98.986841, + 34.223454 + ], + [ + -99.189488, + 34.2125 + ], + [ + -99.260688, + 34.404193 + ], + [ + -99.57835, + 34.415147 + ], + [ + -99.698843, + 34.382285 + ], + [ + -99.923398, + 34.573978 + ], + [ + -100.000075, + 34.563024 + ], + [ + -100.000075, + 36.501861 + ], + [ + -101.812942, + 36.501861 + ], + [ + -103.001438, + 36.501861 + ], + [ + -103.001438, + 37.000263 + ], + [ + -102.042974, + 36.994786 + ], + [ + -100.087706, + 37.000263 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "41", + "properties": { + "name": "Oregon" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -123.211348, + 46.174138 + ], + [ + -123.11824, + 46.185092 + ], + [ + -122.904639, + 46.08103 + ], + [ + -122.811531, + 45.960537 + ], + [ + -122.762239, + 45.659305 + ], + [ + -122.247407, + 45.549767 + ], + [ + -121.809251, + 45.708598 + ], + [ + -121.535404, + 45.725029 + ], + [ + -121.217742, + 45.670259 + ], + [ + -121.18488, + 45.604536 + ], + [ + -120.637186, + 45.746937 + ], + [ + -120.505739, + 45.697644 + ], + [ + -120.209985, + 45.725029 + ], + [ + -119.963522, + 45.823614 + ], + [ + -119.525367, + 45.911245 + ], + [ + -119.125551, + 45.933153 + ], + [ + -118.988627, + 45.998876 + ], + [ + -116.918344, + 45.993399 + ], + [ + -116.78142, + 45.823614 + ], + [ + -116.545912, + 45.752413 + ], + [ + -116.463758, + 45.61549 + ], + [ + -116.671881, + 45.319735 + ], + [ + -116.732128, + 45.144473 + ], + [ + -116.847143, + 45.02398 + ], + [ + -116.830713, + 44.930872 + ], + [ + -116.934774, + 44.782995 + ], + [ + -117.038836, + 44.750133 + ], + [ + -117.241483, + 44.394132 + ], + [ + -117.170283, + 44.257209 + ], + [ + -116.97859, + 44.240778 + ], + [ + -116.896436, + 44.158624 + ], + [ + -117.027882, + 43.830007 + ], + [ + -117.027882, + 42.000709 + ], + [ + -118.698349, + 41.989755 + ], + [ + -120.001861, + 41.995232 + ], + [ + -121.037003, + 41.995232 + ], + [ + -122.378853, + 42.011663 + ], + [ + -123.233256, + 42.006186 + ], + [ + -124.213628, + 42.000709 + ], + [ + -124.356029, + 42.115725 + ], + [ + -124.432706, + 42.438865 + ], + [ + -124.416275, + 42.663419 + ], + [ + -124.553198, + 42.838681 + ], + [ + -124.454613, + 43.002989 + ], + [ + -124.383413, + 43.271359 + ], + [ + -124.235536, + 43.55616 + ], + [ + -124.169813, + 43.8081 + ], + [ + -124.060274, + 44.657025 + ], + [ + -124.076705, + 44.772041 + ], + [ + -123.97812, + 45.144473 + ], + [ + -123.939781, + 45.659305 + ], + [ + -123.994551, + 45.944106 + ], + [ + -123.945258, + 46.113892 + ], + [ + -123.545441, + 46.261769 + ], + [ + -123.370179, + 46.146753 + ], + [ + -123.211348, + 46.174138 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "42", + "properties": { + "name": "Pennsylvania" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -79.76278, + 42.252649 + ], + [ + -79.76278, + 42.000709 + ], + [ + -75.35932, + 42.000709 + ], + [ + -75.249781, + 41.863786 + ], + [ + -75.173104, + 41.869263 + ], + [ + -75.052611, + 41.754247 + ], + [ + -75.074519, + 41.60637 + ], + [ + -74.89378, + 41.436584 + ], + [ + -74.740426, + 41.431108 + ], + [ + -74.69661, + 41.359907 + ], + [ + -74.828057, + 41.288707 + ], + [ + -74.882826, + 41.179168 + ], + [ + -75.134765, + 40.971045 + ], + [ + -75.052611, + 40.866983 + ], + [ + -75.205966, + 40.691721 + ], + [ + -75.195012, + 40.576705 + ], + [ + -75.069042, + 40.543843 + ], + [ + -75.058088, + 40.417874 + ], + [ + -74.773287, + 40.215227 + ], + [ + -74.82258, + 40.127596 + ], + [ + -75.129289, + 39.963288 + ], + [ + -75.145719, + 39.88661 + ], + [ + -75.414089, + 39.804456 + ], + [ + -75.616736, + 39.831841 + ], + [ + -75.786521, + 39.722302 + ], + [ + -79.477979, + 39.722302 + ], + [ + -80.518598, + 39.722302 + ], + [ + -80.518598, + 40.636951 + ], + [ + -80.518598, + 41.978802 + ], + [ + -80.518598, + 41.978802 + ], + [ + -80.332382, + 42.033571 + ], + [ + -79.76278, + 42.269079 + ], + [ + -79.76278, + 42.252649 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "44", + "properties": { + "name": "Rhode Island" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -71.196845, + 41.67757 + ], + [ + -71.120168, + 41.496831 + ], + [ + -71.317338, + 41.474923 + ], + [ + -71.196845, + 41.67757 + ] + ] + ], + [ + [ + [ + -71.530939, + 42.01714 + ], + [ + -71.383061, + 42.01714 + ], + [ + -71.328292, + 41.781632 + ], + [ + -71.22423, + 41.710431 + ], + [ + -71.344723, + 41.726862 + ], + [ + -71.448785, + 41.578985 + ], + [ + -71.481646, + 41.370861 + ], + [ + -71.859555, + 41.321569 + ], + [ + -71.799309, + 41.414677 + ], + [ + -71.799309, + 42.006186 + ], + [ + -71.530939, + 42.01714 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "45", + "properties": { + "name": "South Carolina" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -82.764143, + 35.066903 + ], + [ + -82.550543, + 35.160011 + ], + [ + -82.276696, + 35.198349 + ], + [ + -81.044384, + 35.149057 + ], + [ + -81.038907, + 35.044995 + ], + [ + -80.934845, + 35.105241 + ], + [ + -80.781491, + 34.935456 + ], + [ + -80.797922, + 34.820441 + ], + [ + -79.675149, + 34.80401 + ], + [ + -78.541422, + 33.851022 + ], + [ + -78.716684, + 33.80173 + ], + [ + -78.935762, + 33.637421 + ], + [ + -79.149363, + 33.380005 + ], + [ + -79.187701, + 33.171881 + ], + [ + -79.357487, + 33.007573 + ], + [ + -79.582041, + 33.007573 + ], + [ + -79.631334, + 32.887081 + ], + [ + -79.866842, + 32.755634 + ], + [ + -79.998289, + 32.613234 + ], + [ + -80.206412, + 32.552987 + ], + [ + -80.430967, + 32.399633 + ], + [ + -80.452875, + 32.328433 + ], + [ + -80.660998, + 32.246279 + ], + [ + -80.885553, + 32.032678 + ], + [ + -81.115584, + 32.120309 + ], + [ + -81.121061, + 32.290094 + ], + [ + -81.279893, + 32.558464 + ], + [ + -81.416816, + 32.629664 + ], + [ + -81.42777, + 32.843265 + ], + [ + -81.493493, + 33.007573 + ], + [ + -81.761863, + 33.160928 + ], + [ + -81.937125, + 33.347144 + ], + [ + -81.926172, + 33.462159 + ], + [ + -82.194542, + 33.631944 + ], + [ + -82.325988, + 33.81816 + ], + [ + -82.55602, + 33.94413 + ], + [ + -82.714851, + 34.152254 + ], + [ + -82.747713, + 34.26727 + ], + [ + -82.901067, + 34.486347 + ], + [ + -83.005129, + 34.469916 + ], + [ + -83.339222, + 34.683517 + ], + [ + -83.322791, + 34.787579 + ], + [ + -83.109191, + 35.00118 + ], + [ + -82.764143, + 35.066903 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "46", + "properties": { + "name": "South Dakota" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -104.047534, + 45.944106 + ], + [ + -96.560556, + 45.933153 + ], + [ + -96.582464, + 45.818137 + ], + [ + -96.856311, + 45.604536 + ], + [ + -96.681049, + 45.412843 + ], + [ + -96.451017, + 45.297827 + ], + [ + -96.451017, + 43.501391 + ], + [ + -96.582464, + 43.479483 + ], + [ + -96.527695, + 43.397329 + ], + [ + -96.560556, + 43.222067 + ], + [ + -96.434587, + 43.123482 + ], + [ + -96.511264, + 43.052282 + ], + [ + -96.544125, + 42.855112 + ], + [ + -96.631756, + 42.707235 + ], + [ + -96.44554, + 42.488157 + ], + [ + -96.626279, + 42.515542 + ], + [ + -96.692003, + 42.657942 + ], + [ + -97.217789, + 42.844158 + ], + [ + -97.688806, + 42.844158 + ], + [ + -97.831206, + 42.866066 + ], + [ + -97.951699, + 42.767481 + ], + [ + -98.466531, + 42.94822 + ], + [ + -98.499393, + 42.997512 + ], + [ + -101.626726, + 42.997512 + ], + [ + -103.324578, + 43.002989 + ], + [ + -104.053011, + 43.002989 + ], + [ + -104.058488, + 44.996596 + ], + [ + -104.042057, + 44.996596 + ], + [ + -104.047534, + 45.944106 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "47", + "properties": { + "name": "Tennessee" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -88.054868, + 36.496384 + ], + [ + -88.071299, + 36.677123 + ], + [ + -87.852221, + 36.633308 + ], + [ + -86.592525, + 36.655216 + ], + [ + -85.486183, + 36.616877 + ], + [ + -85.289013, + 36.627831 + ], + [ + -84.544149, + 36.594969 + ], + [ + -83.689746, + 36.584015 + ], + [ + -83.673316, + 36.600446 + ], + [ + -81.679709, + 36.589492 + ], + [ + -81.723525, + 36.353984 + ], + [ + -81.909741, + 36.304691 + ], + [ + -82.03571, + 36.118475 + ], + [ + -82.216449, + 36.156814 + ], + [ + -82.610789, + 35.965121 + ], + [ + -82.638174, + 36.063706 + ], + [ + -82.775097, + 35.997983 + ], + [ + -82.994175, + 35.773428 + ], + [ + -83.251591, + 35.718659 + ], + [ + -83.498053, + 35.565304 + ], + [ + -83.7719, + 35.559827 + ], + [ + -84.018363, + 35.41195 + ], + [ + -84.09504, + 35.247642 + ], + [ + -84.29221, + 35.225734 + ], + [ + -84.319594, + 34.990226 + ], + [ + -85.606675, + 34.984749 + ], + [ + -87.359296, + 35.00118 + ], + [ + -88.202745, + 34.995703 + ], + [ + -88.471115, + 34.995703 + ], + [ + -90.311367, + 34.995703 + ], + [ + -90.212782, + 35.023087 + ], + [ + -90.114197, + 35.198349 + ], + [ + -90.130628, + 35.439335 + ], + [ + -89.944412, + 35.603643 + ], + [ + -89.911551, + 35.756997 + ], + [ + -89.763673, + 35.811767 + ], + [ + -89.730812, + 35.997983 + ], + [ + -89.533642, + 36.249922 + ], + [ + -89.539119, + 36.496384 + ], + [ + -89.484349, + 36.496384 + ], + [ + -89.418626, + 36.496384 + ], + [ + -89.298133, + 36.507338 + ], + [ + -88.054868, + 36.496384 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "48", + "properties": { + "name": "Texas" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -101.812942, + 36.501861 + ], + [ + -100.000075, + 36.501861 + ], + [ + -100.000075, + 34.563024 + ], + [ + -99.923398, + 34.573978 + ], + [ + -99.698843, + 34.382285 + ], + [ + -99.57835, + 34.415147 + ], + [ + -99.260688, + 34.404193 + ], + [ + -99.189488, + 34.2125 + ], + [ + -98.986841, + 34.223454 + ], + [ + -98.767763, + 34.135823 + ], + [ + -98.570593, + 34.146777 + ], + [ + -98.488439, + 34.064623 + ], + [ + -98.36247, + 34.157731 + ], + [ + -98.170777, + 34.113915 + ], + [ + -98.088623, + 34.004376 + ], + [ + -97.946222, + 33.987946 + ], + [ + -97.869545, + 33.851022 + ], + [ + -97.694283, + 33.982469 + ], + [ + -97.458774, + 33.905791 + ], + [ + -97.371143, + 33.823637 + ], + [ + -97.256128, + 33.861976 + ], + [ + -97.173974, + 33.736006 + ], + [ + -96.922034, + 33.960561 + ], + [ + -96.850834, + 33.845545 + ], + [ + -96.631756, + 33.845545 + ], + [ + -96.423633, + 33.774345 + ], + [ + -96.346956, + 33.686714 + ], + [ + -96.149786, + 33.840068 + ], + [ + -95.936185, + 33.889361 + ], + [ + -95.8376, + 33.834591 + ], + [ + -95.602092, + 33.933176 + ], + [ + -95.547322, + 33.878407 + ], + [ + -95.289906, + 33.87293 + ], + [ + -95.224183, + 33.960561 + ], + [ + -94.966767, + 33.861976 + ], + [ + -94.868182, + 33.74696 + ], + [ + -94.484796, + 33.637421 + ], + [ + -94.380734, + 33.544313 + ], + [ + -94.183564, + 33.593606 + ], + [ + -94.041164, + 33.54979 + ], + [ + -94.041164, + 33.018527 + ], + [ + -94.041164, + 31.994339 + ], + [ + -93.822086, + 31.775262 + ], + [ + -93.816609, + 31.556184 + ], + [ + -93.542762, + 31.15089 + ], + [ + -93.526331, + 30.93729 + ], + [ + -93.630393, + 30.679874 + ], + [ + -93.728978, + 30.575812 + ], + [ + -93.696116, + 30.438888 + ], + [ + -93.767317, + 30.334826 + ], + [ + -93.690639, + 30.143133 + ], + [ + -93.926148, + 29.787132 + ], + [ + -93.838517, + 29.688547 + ], + [ + -94.002825, + 29.68307 + ], + [ + -94.523134, + 29.546147 + ], + [ + -94.70935, + 29.622824 + ], + [ + -94.742212, + 29.787132 + ], + [ + -94.873659, + 29.672117 + ], + [ + -94.966767, + 29.699501 + ], + [ + -95.016059, + 29.557101 + ], + [ + -94.911997, + 29.496854 + ], + [ + -94.895566, + 29.310638 + ], + [ + -95.081782, + 29.113469 + ], + [ + -95.383014, + 28.867006 + ], + [ + -95.985477, + 28.604113 + ], + [ + -96.045724, + 28.647929 + ], + [ + -96.226463, + 28.582205 + ], + [ + -96.23194, + 28.642452 + ], + [ + -96.478402, + 28.598636 + ], + [ + -96.593418, + 28.724606 + ], + [ + -96.664618, + 28.697221 + ], + [ + -96.401725, + 28.439805 + ], + [ + -96.593418, + 28.357651 + ], + [ + -96.774157, + 28.406943 + ], + [ + -96.801542, + 28.226204 + ], + [ + -97.026096, + 28.039988 + ], + [ + -97.256128, + 27.694941 + ], + [ + -97.404005, + 27.333463 + ], + [ + -97.513544, + 27.360848 + ], + [ + -97.540929, + 27.229401 + ], + [ + -97.425913, + 27.262263 + ], + [ + -97.480682, + 26.99937 + ], + [ + -97.557359, + 26.988416 + ], + [ + -97.562836, + 26.840538 + ], + [ + -97.469728, + 26.758384 + ], + [ + -97.442344, + 26.457153 + ], + [ + -97.332805, + 26.353091 + ], + [ + -97.30542, + 26.161398 + ], + [ + -97.217789, + 25.991613 + ], + [ + -97.524498, + 25.887551 + ], + [ + -97.650467, + 26.018997 + ], + [ + -97.885976, + 26.06829 + ], + [ + -98.198161, + 26.057336 + ], + [ + -98.466531, + 26.221644 + ], + [ + -98.669178, + 26.238075 + ], + [ + -98.822533, + 26.369522 + ], + [ + -99.030656, + 26.413337 + ], + [ + -99.173057, + 26.539307 + ], + [ + -99.266165, + 26.840538 + ], + [ + -99.446904, + 27.021277 + ], + [ + -99.424996, + 27.174632 + ], + [ + -99.50715, + 27.33894 + ], + [ + -99.479765, + 27.48134 + ], + [ + -99.605735, + 27.640172 + ], + [ + -99.709797, + 27.656603 + ], + [ + -99.879582, + 27.799003 + ], + [ + -99.934351, + 27.979742 + ], + [ + -100.082229, + 28.14405 + ], + [ + -100.29583, + 28.280974 + ], + [ + -100.399891, + 28.582205 + ], + [ + -100.498476, + 28.66436 + ], + [ + -100.629923, + 28.905345 + ], + [ + -100.673738, + 29.102515 + ], + [ + -100.799708, + 29.244915 + ], + [ + -101.013309, + 29.370885 + ], + [ + -101.062601, + 29.458516 + ], + [ + -101.259771, + 29.535193 + ], + [ + -101.413125, + 29.754271 + ], + [ + -101.851281, + 29.803563 + ], + [ + -102.114174, + 29.792609 + ], + [ + -102.338728, + 29.869286 + ], + [ + -102.388021, + 29.765225 + ], + [ + -102.629006, + 29.732363 + ], + [ + -102.809745, + 29.524239 + ], + [ + -102.919284, + 29.190146 + ], + [ + -102.97953, + 29.184669 + ], + [ + -103.116454, + 28.987499 + ], + [ + -103.280762, + 28.982022 + ], + [ + -103.527224, + 29.135376 + ], + [ + -104.146119, + 29.381839 + ], + [ + -104.266611, + 29.513285 + ], + [ + -104.507597, + 29.639255 + ], + [ + -104.677382, + 29.924056 + ], + [ + -104.688336, + 30.181472 + ], + [ + -104.858121, + 30.389596 + ], + [ + -104.896459, + 30.570335 + ], + [ + -105.005998, + 30.685351 + ], + [ + -105.394861, + 30.855136 + ], + [ + -105.602985, + 31.085167 + ], + [ + -105.77277, + 31.167321 + ], + [ + -105.953509, + 31.364491 + ], + [ + -106.205448, + 31.468553 + ], + [ + -106.38071, + 31.731446 + ], + [ + -106.528588, + 31.786216 + ], + [ + -106.643603, + 31.901231 + ], + [ + -106.616219, + 31.999816 + ], + [ + -103.067161, + 31.999816 + ], + [ + -103.067161, + 33.002096 + ], + [ + -103.045254, + 34.01533 + ], + [ + -103.039777, + 36.501861 + ], + [ + -103.001438, + 36.501861 + ], + [ + -101.812942, + 36.501861 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "49", + "properties": { + "name": "Utah" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -112.164359, + 41.995232 + ], + [ + -111.047063, + 42.000709 + ], + [ + -111.047063, + 40.998429 + ], + [ + -109.04798, + 40.998429 + ], + [ + -109.053457, + 39.125316 + ], + [ + -109.058934, + 38.27639 + ], + [ + -109.042503, + 38.166851 + ], + [ + -109.042503, + 37.000263 + ], + [ + -110.499369, + 37.00574 + ], + [ + -114.048427, + 37.000263 + ], + [ + -114.04295, + 41.995232 + ], + [ + -112.164359, + 41.995232 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "50", + "properties": { + "name": "Vermont" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -71.503554, + 45.013027 + ], + [ + -71.4926, + 44.914442 + ], + [ + -71.629524, + 44.750133 + ], + [ + -71.536416, + 44.585825 + ], + [ + -71.700724, + 44.41604 + ], + [ + -72.034817, + 44.322932 + ], + [ + -72.02934, + 44.07647 + ], + [ + -72.116971, + 43.994316 + ], + [ + -72.204602, + 43.769761 + ], + [ + -72.379864, + 43.572591 + ], + [ + -72.456542, + 43.150867 + ], + [ + -72.445588, + 43.008466 + ], + [ + -72.533219, + 42.953697 + ], + [ + -72.544173, + 42.80582 + ], + [ + -72.456542, + 42.729142 + ], + [ + -73.267129, + 42.745573 + ], + [ + -73.278083, + 42.833204 + ], + [ + -73.245221, + 43.523299 + ], + [ + -73.404052, + 43.687607 + ], + [ + -73.349283, + 43.769761 + ], + [ + -73.436914, + 44.043608 + ], + [ + -73.321898, + 44.246255 + ], + [ + -73.294514, + 44.437948 + ], + [ + -73.387622, + 44.618687 + ], + [ + -73.332852, + 44.804903 + ], + [ + -73.343806, + 45.013027 + ], + [ + -72.308664, + 45.002073 + ], + [ + -71.503554, + 45.013027 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "51", + "properties": { + "name": "Virginia" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -78.349729, + 39.464886 + ], + [ + -77.82942, + 39.130793 + ], + [ + -77.719881, + 39.322485 + ], + [ + -77.566527, + 39.306055 + ], + [ + -77.456988, + 39.223901 + ], + [ + -77.456988, + 39.076023 + ], + [ + -77.248864, + 39.026731 + ], + [ + -77.117418, + 38.933623 + ], + [ + -77.040741, + 38.791222 + ], + [ + -77.128372, + 38.632391 + ], + [ + -77.248864, + 38.588575 + ], + [ + -77.325542, + 38.446175 + ], + [ + -77.281726, + 38.342113 + ], + [ + -77.013356, + 38.374975 + ], + [ + -76.964064, + 38.216144 + ], + [ + -76.613539, + 38.15042 + ], + [ + -76.514954, + 38.024451 + ], + [ + -76.235631, + 37.887527 + ], + [ + -76.3616, + 37.608203 + ], + [ + -76.246584, + 37.389126 + ], + [ + -76.383508, + 37.285064 + ], + [ + -76.399939, + 37.159094 + ], + [ + -76.273969, + 37.082417 + ], + [ + -76.410893, + 36.961924 + ], + [ + -76.619016, + 37.120755 + ], + [ + -76.668309, + 37.065986 + ], + [ + -76.48757, + 36.95097 + ], + [ + -75.994645, + 36.923586 + ], + [ + -75.868676, + 36.551154 + ], + [ + -79.510841, + 36.5402 + ], + [ + -80.294043, + 36.545677 + ], + [ + -80.978661, + 36.562108 + ], + [ + -81.679709, + 36.589492 + ], + [ + -83.673316, + 36.600446 + ], + [ + -83.136575, + 36.742847 + ], + [ + -83.070852, + 36.852385 + ], + [ + -82.879159, + 36.890724 + ], + [ + -82.868205, + 36.978355 + ], + [ + -82.720328, + 37.044078 + ], + [ + -82.720328, + 37.120755 + ], + [ + -82.353373, + 37.268633 + ], + [ + -81.969987, + 37.537003 + ], + [ + -81.986418, + 37.454849 + ], + [ + -81.849494, + 37.285064 + ], + [ + -81.679709, + 37.20291 + ], + [ + -81.55374, + 37.208387 + ], + [ + -81.362047, + 37.339833 + ], + [ + -81.225123, + 37.235771 + ], + [ + -80.967707, + 37.290541 + ], + [ + -80.513121, + 37.482234 + ], + [ + -80.474782, + 37.421987 + ], + [ + -80.29952, + 37.509618 + ], + [ + -80.294043, + 37.690357 + ], + [ + -80.184505, + 37.849189 + ], + [ + -79.998289, + 37.997066 + ], + [ + -79.921611, + 38.177805 + ], + [ + -79.724442, + 38.364021 + ], + [ + -79.647764, + 38.594052 + ], + [ + -79.477979, + 38.457129 + ], + [ + -79.313671, + 38.413313 + ], + [ + -79.209609, + 38.495467 + ], + [ + -78.996008, + 38.851469 + ], + [ + -78.870039, + 38.763838 + ], + [ + -78.404499, + 39.169131 + ], + [ + -78.349729, + 39.464886 + ] + ] + ], + [ + [ + [ + -75.397659, + 38.013497 + ], + [ + -75.244304, + 38.029928 + ], + [ + -75.375751, + 37.860142 + ], + [ + -75.512674, + 37.799896 + ], + [ + -75.594828, + 37.569865 + ], + [ + -75.802952, + 37.197433 + ], + [ + -75.972737, + 37.120755 + ], + [ + -76.027507, + 37.257679 + ], + [ + -75.939876, + 37.564388 + ], + [ + -75.671506, + 37.95325 + ], + [ + -75.397659, + 38.013497 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "53", + "properties": { + "name": "Washington" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -117.033359, + 49.000239 + ], + [ + -117.044313, + 47.762451 + ], + [ + -117.038836, + 46.426077 + ], + [ + -117.055267, + 46.343923 + ], + [ + -116.92382, + 46.168661 + ], + [ + -116.918344, + 45.993399 + ], + [ + -118.988627, + 45.998876 + ], + [ + -119.125551, + 45.933153 + ], + [ + -119.525367, + 45.911245 + ], + [ + -119.963522, + 45.823614 + ], + [ + -120.209985, + 45.725029 + ], + [ + -120.505739, + 45.697644 + ], + [ + -120.637186, + 45.746937 + ], + [ + -121.18488, + 45.604536 + ], + [ + -121.217742, + 45.670259 + ], + [ + -121.535404, + 45.725029 + ], + [ + -121.809251, + 45.708598 + ], + [ + -122.247407, + 45.549767 + ], + [ + -122.762239, + 45.659305 + ], + [ + -122.811531, + 45.960537 + ], + [ + -122.904639, + 46.08103 + ], + [ + -123.11824, + 46.185092 + ], + [ + -123.211348, + 46.174138 + ], + [ + -123.370179, + 46.146753 + ], + [ + -123.545441, + 46.261769 + ], + [ + -123.72618, + 46.300108 + ], + [ + -123.874058, + 46.239861 + ], + [ + -124.065751, + 46.327492 + ], + [ + -124.027412, + 46.464416 + ], + [ + -123.895966, + 46.535616 + ], + [ + -124.098612, + 46.74374 + ], + [ + -124.235536, + 47.285957 + ], + [ + -124.31769, + 47.357157 + ], + [ + -124.427229, + 47.740543 + ], + [ + -124.624399, + 47.88842 + ], + [ + -124.706553, + 48.184175 + ], + [ + -124.597014, + 48.381345 + ], + [ + -124.394367, + 48.288237 + ], + [ + -123.983597, + 48.162267 + ], + [ + -123.704273, + 48.167744 + ], + [ + -123.424949, + 48.118452 + ], + [ + -123.162056, + 48.167744 + ], + [ + -123.036086, + 48.080113 + ], + [ + -122.800578, + 48.08559 + ], + [ + -122.636269, + 47.866512 + ], + [ + -122.515777, + 47.882943 + ], + [ + -122.493869, + 47.587189 + ], + [ + -122.422669, + 47.318818 + ], + [ + -122.324084, + 47.346203 + ], + [ + -122.422669, + 47.576235 + ], + [ + -122.395284, + 47.800789 + ], + [ + -122.230976, + 48.030821 + ], + [ + -122.362422, + 48.123929 + ], + [ + -122.373376, + 48.288237 + ], + [ + -122.471961, + 48.468976 + ], + [ + -122.422669, + 48.600422 + ], + [ + -122.488392, + 48.753777 + ], + [ + -122.647223, + 48.775685 + ], + [ + -122.795101, + 48.8907 + ], + [ + -122.756762, + 49.000239 + ], + [ + -117.033359, + 49.000239 + ] + ] + ], + [ + [ + [ + -122.718423, + 48.310145 + ], + [ + -122.586977, + 48.35396 + ], + [ + -122.608885, + 48.151313 + ], + [ + -122.767716, + 48.227991 + ], + [ + -122.718423, + 48.310145 + ] + ] + ], + [ + [ + [ + -123.025132, + 48.583992 + ], + [ + -122.915593, + 48.715438 + ], + [ + -122.767716, + 48.556607 + ], + [ + -122.811531, + 48.419683 + ], + [ + -123.041563, + 48.458022 + ], + [ + -123.025132, + 48.583992 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "54", + "properties": { + "name": "West Virginia" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -80.518598, + 40.636951 + ], + [ + -80.518598, + 39.722302 + ], + [ + -79.477979, + 39.722302 + ], + [ + -79.488933, + 39.20747 + ], + [ + -79.291763, + 39.300578 + ], + [ + -79.094593, + 39.470363 + ], + [ + -78.963147, + 39.437501 + ], + [ + -78.765977, + 39.585379 + ], + [ + -78.470222, + 39.514178 + ], + [ + -78.431884, + 39.623717 + ], + [ + -78.267575, + 39.61824 + ], + [ + -78.174467, + 39.694917 + ], + [ + -78.004682, + 39.601809 + ], + [ + -77.834897, + 39.601809 + ], + [ + -77.719881, + 39.322485 + ], + [ + -77.82942, + 39.130793 + ], + [ + -78.349729, + 39.464886 + ], + [ + -78.404499, + 39.169131 + ], + [ + -78.870039, + 38.763838 + ], + [ + -78.996008, + 38.851469 + ], + [ + -79.209609, + 38.495467 + ], + [ + -79.313671, + 38.413313 + ], + [ + -79.477979, + 38.457129 + ], + [ + -79.647764, + 38.594052 + ], + [ + -79.724442, + 38.364021 + ], + [ + -79.921611, + 38.177805 + ], + [ + -79.998289, + 37.997066 + ], + [ + -80.184505, + 37.849189 + ], + [ + -80.294043, + 37.690357 + ], + [ + -80.29952, + 37.509618 + ], + [ + -80.474782, + 37.421987 + ], + [ + -80.513121, + 37.482234 + ], + [ + -80.967707, + 37.290541 + ], + [ + -81.225123, + 37.235771 + ], + [ + -81.362047, + 37.339833 + ], + [ + -81.55374, + 37.208387 + ], + [ + -81.679709, + 37.20291 + ], + [ + -81.849494, + 37.285064 + ], + [ + -81.986418, + 37.454849 + ], + [ + -81.969987, + 37.537003 + ], + [ + -82.101434, + 37.553434 + ], + [ + -82.293127, + 37.668449 + ], + [ + -82.342419, + 37.783465 + ], + [ + -82.50125, + 37.931343 + ], + [ + -82.621743, + 38.123036 + ], + [ + -82.594358, + 38.424267 + ], + [ + -82.331465, + 38.446175 + ], + [ + -82.293127, + 38.577622 + ], + [ + -82.172634, + 38.632391 + ], + [ + -82.221926, + 38.785745 + ], + [ + -82.03571, + 39.026731 + ], + [ + -81.887833, + 38.873376 + ], + [ + -81.783771, + 38.966484 + ], + [ + -81.811156, + 39.0815 + ], + [ + -81.685186, + 39.273193 + ], + [ + -81.57017, + 39.267716 + ], + [ + -81.455155, + 39.410117 + ], + [ + -81.345616, + 39.344393 + ], + [ + -81.219646, + 39.388209 + ], + [ + -80.830783, + 39.711348 + ], + [ + -80.737675, + 40.078303 + ], + [ + -80.600752, + 40.319289 + ], + [ + -80.595275, + 40.472643 + ], + [ + -80.666475, + 40.582182 + ], + [ + -80.518598, + 40.636951 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "55", + "properties": { + "name": "Wisconsin" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -90.415429, + 46.568478 + ], + [ + -90.229213, + 46.508231 + ], + [ + -90.119674, + 46.338446 + ], + [ + -89.09001, + 46.135799 + ], + [ + -88.662808, + 45.987922 + ], + [ + -88.531362, + 46.020784 + ], + [ + -88.10416, + 45.922199 + ], + [ + -87.989145, + 45.796229 + ], + [ + -87.781021, + 45.675736 + ], + [ + -87.791975, + 45.500474 + ], + [ + -87.885083, + 45.363551 + ], + [ + -87.649574, + 45.341643 + ], + [ + -87.742682, + 45.199243 + ], + [ + -87.589328, + 45.095181 + ], + [ + -87.627666, + 44.974688 + ], + [ + -87.819359, + 44.95278 + ], + [ + -87.983668, + 44.722749 + ], + [ + -88.043914, + 44.563917 + ], + [ + -87.928898, + 44.536533 + ], + [ + -87.775544, + 44.640595 + ], + [ + -87.611236, + 44.837764 + ], + [ + -87.403112, + 44.914442 + ], + [ + -87.238804, + 45.166381 + ], + [ + -87.03068, + 45.22115 + ], + [ + -87.047111, + 45.089704 + ], + [ + -87.189511, + 44.969211 + ], + [ + -87.468835, + 44.552964 + ], + [ + -87.545512, + 44.322932 + ], + [ + -87.540035, + 44.158624 + ], + [ + -87.644097, + 44.103854 + ], + [ + -87.737205, + 43.8793 + ], + [ + -87.704344, + 43.687607 + ], + [ + -87.791975, + 43.561637 + ], + [ + -87.912467, + 43.249452 + ], + [ + -87.885083, + 43.002989 + ], + [ + -87.76459, + 42.783912 + ], + [ + -87.802929, + 42.493634 + ], + [ + -88.788778, + 42.493634 + ], + [ + -90.639984, + 42.510065 + ], + [ + -90.711184, + 42.636034 + ], + [ + -91.067185, + 42.75105 + ], + [ + -91.143862, + 42.909881 + ], + [ + -91.176724, + 43.134436 + ], + [ + -91.056231, + 43.254929 + ], + [ + -91.204109, + 43.353514 + ], + [ + -91.215062, + 43.501391 + ], + [ + -91.269832, + 43.616407 + ], + [ + -91.242447, + 43.775238 + ], + [ + -91.43414, + 43.994316 + ], + [ + -91.592971, + 44.032654 + ], + [ + -91.877772, + 44.202439 + ], + [ + -91.927065, + 44.333886 + ], + [ + -92.233773, + 44.443425 + ], + [ + -92.337835, + 44.552964 + ], + [ + -92.545959, + 44.569394 + ], + [ + -92.808852, + 44.750133 + ], + [ + -92.737652, + 45.117088 + ], + [ + -92.75956, + 45.286874 + ], + [ + -92.644544, + 45.440228 + ], + [ + -92.770513, + 45.566198 + ], + [ + -92.885529, + 45.577151 + ], + [ + -92.869098, + 45.719552 + ], + [ + -92.639067, + 45.933153 + ], + [ + -92.354266, + 46.015307 + ], + [ + -92.29402, + 46.075553 + ], + [ + -92.29402, + 46.667063 + ], + [ + -92.091373, + 46.749217 + ], + [ + -92.014696, + 46.705401 + ], + [ + -91.790141, + 46.694447 + ], + [ + -91.09457, + 46.864232 + ], + [ + -90.837154, + 46.95734 + ], + [ + -90.749522, + 46.88614 + ], + [ + -90.886446, + 46.754694 + ], + [ + -90.55783, + 46.584908 + ], + [ + -90.415429, + 46.568478 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "56", + "properties": { + "name": "Wyoming" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -109.080842, + 45.002073 + ], + [ + -105.91517, + 45.002073 + ], + [ + -104.058488, + 44.996596 + ], + [ + -104.053011, + 43.002989 + ], + [ + -104.053011, + 41.003906 + ], + [ + -105.728954, + 40.998429 + ], + [ + -107.919731, + 41.003906 + ], + [ + -109.04798, + 40.998429 + ], + [ + -111.047063, + 40.998429 + ], + [ + -111.047063, + 42.000709 + ], + [ + -111.047063, + 44.476286 + ], + [ + -111.05254, + 45.002073 + ], + [ + -109.080842, + 45.002073 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "72", + "properties": { + "name": "Puerto Rico" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -66.448338, + 17.984326 + ], + [ + -66.771478, + 18.006234 + ], + [ + -66.924832, + 17.929556 + ], + [ + -66.985078, + 17.973372 + ], + [ + -67.209633, + 17.956941 + ], + [ + -67.154863, + 18.19245 + ], + [ + -67.269879, + 18.362235 + ], + [ + -67.094617, + 18.515589 + ], + [ + -66.957694, + 18.488204 + ], + [ + -66.409999, + 18.488204 + ], + [ + -65.840398, + 18.433435 + ], + [ + -65.632274, + 18.367712 + ], + [ + -65.626797, + 18.203403 + ], + [ + -65.730859, + 18.186973 + ], + [ + -65.834921, + 18.017187 + ], + [ + -66.234737, + 17.929556 + ], + [ + -66.448338, + 17.984326 + ] + ] + ] + } + } + ) + return data \ No newline at end of file diff --git a/apps/mapvisuals/lib/states.pyc b/apps/mapvisuals/lib/states.pyc new file mode 100644 index 0000000..4eb009d Binary files /dev/null and b/apps/mapvisuals/lib/states.pyc differ diff --git a/jobvisualization/jobvisualization/__init__.py b/apps/mapvisuals/migrations/__init__.py similarity index 100% rename from jobvisualization/jobvisualization/__init__.py rename to apps/mapvisuals/migrations/__init__.py diff --git a/apps/mapvisuals/migrations/__init__.pyc b/apps/mapvisuals/migrations/__init__.pyc new file mode 100644 index 0000000..0269e71 Binary files /dev/null and b/apps/mapvisuals/migrations/__init__.pyc differ diff --git a/jobvisualization/apps/mapvisuals/models.py b/apps/mapvisuals/models.py similarity index 100% rename from jobvisualization/apps/mapvisuals/models.py rename to apps/mapvisuals/models.py diff --git a/apps/mapvisuals/models.pyc b/apps/mapvisuals/models.pyc new file mode 100644 index 0000000..a9ccdfb Binary files /dev/null and b/apps/mapvisuals/models.pyc differ diff --git a/apps/mapvisuals/states.json b/apps/mapvisuals/states.json new file mode 100644 index 0000000..2cac1ce --- /dev/null +++ b/apps/mapvisuals/states.json @@ -0,0 +1,15087 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "id": "01", + "properties": { + "name": "Alabama" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -87.359296, + 35.00118 + ], + [ + -85.606675, + 34.984749 + ], + [ + -85.431413, + 34.124869 + ], + [ + -85.184951, + 32.859696 + ], + [ + -85.069935, + 32.580372 + ], + [ + -84.960397, + 32.421541 + ], + [ + -85.004212, + 32.322956 + ], + [ + -84.889196, + 32.262709 + ], + [ + -85.058981, + 32.13674 + ], + [ + -85.053504, + 32.01077 + ], + [ + -85.141136, + 31.840985 + ], + [ + -85.042551, + 31.539753 + ], + [ + -85.113751, + 31.27686 + ], + [ + -85.004212, + 31.003013 + ], + [ + -85.497137, + 30.997536 + ], + [ + -87.600282, + 30.997536 + ], + [ + -87.633143, + 30.86609 + ], + [ + -87.408589, + 30.674397 + ], + [ + -87.446927, + 30.510088 + ], + [ + -87.37025, + 30.427934 + ], + [ + -87.518128, + 30.280057 + ], + [ + -87.655051, + 30.247195 + ], + [ + -87.90699, + 30.411504 + ], + [ + -87.934375, + 30.657966 + ], + [ + -88.011052, + 30.685351 + ], + [ + -88.10416, + 30.499135 + ], + [ + -88.137022, + 30.318396 + ], + [ + -88.394438, + 30.367688 + ], + [ + -88.471115, + 31.895754 + ], + [ + -88.241084, + 33.796253 + ], + [ + -88.098683, + 34.891641 + ], + [ + -88.202745, + 34.995703 + ], + [ + -87.359296, + 35.00118 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "02", + "properties": { + "name": "Alaska" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -131.602021, + 55.117982 + ], + [ + -131.569159, + 55.28229 + ], + [ + -131.355558, + 55.183705 + ], + [ + -131.38842, + 55.01392 + ], + [ + -131.645836, + 55.035827 + ], + [ + -131.602021, + 55.117982 + ] + ] + ], + [ + [ + [ + -131.832052, + 55.42469 + ], + [ + -131.645836, + 55.304197 + ], + [ + -131.749898, + 55.128935 + ], + [ + -131.832052, + 55.189182 + ], + [ + -131.832052, + 55.42469 + ] + ] + ], + [ + [ + [ + -132.976733, + 56.437924 + ], + [ + -132.735747, + 56.459832 + ], + [ + -132.631685, + 56.421493 + ], + [ + -132.664547, + 56.273616 + ], + [ + -132.878148, + 56.240754 + ], + [ + -133.069841, + 56.333862 + ], + [ + -132.976733, + 56.437924 + ] + ] + ], + [ + [ + [ + -133.595627, + 56.350293 + ], + [ + -133.162949, + 56.317431 + ], + [ + -133.05341, + 56.125739 + ], + [ + -132.620732, + 55.912138 + ], + [ + -132.472854, + 55.780691 + ], + [ + -132.4619, + 55.671152 + ], + [ + -132.357838, + 55.649245 + ], + [ + -132.341408, + 55.506844 + ], + [ + -132.166146, + 55.364444 + ], + [ + -132.144238, + 55.238474 + ], + [ + -132.029222, + 55.276813 + ], + [ + -131.97993, + 55.178228 + ], + [ + -131.958022, + 54.789365 + ], + [ + -132.029222, + 54.701734 + ], + [ + -132.308546, + 54.718165 + ], + [ + -132.385223, + 54.915335 + ], + [ + -132.483808, + 54.898904 + ], + [ + -132.686455, + 55.046781 + ], + [ + -132.746701, + 54.997489 + ], + [ + -132.916486, + 55.046781 + ], + [ + -132.889102, + 54.898904 + ], + [ + -132.73027, + 54.937242 + ], + [ + -132.626209, + 54.882473 + ], + [ + -132.675501, + 54.679826 + ], + [ + -132.867194, + 54.701734 + ], + [ + -133.157472, + 54.95915 + ], + [ + -133.239626, + 55.090597 + ], + [ + -133.223195, + 55.22752 + ], + [ + -133.453227, + 55.216566 + ], + [ + -133.453227, + 55.320628 + ], + [ + -133.277964, + 55.331582 + ], + [ + -133.102702, + 55.42469 + ], + [ + -133.17938, + 55.588998 + ], + [ + -133.387503, + 55.62186 + ], + [ + -133.420365, + 55.884753 + ], + [ + -133.497042, + 56.0162 + ], + [ + -133.639442, + 55.923092 + ], + [ + -133.694212, + 56.070969 + ], + [ + -133.546335, + 56.142169 + ], + [ + -133.666827, + 56.311955 + ], + [ + -133.595627, + 56.350293 + ] + ] + ], + [ + [ + [ + -133.738027, + 55.556137 + ], + [ + -133.546335, + 55.490413 + ], + [ + -133.414888, + 55.572568 + ], + [ + -133.283441, + 55.534229 + ], + [ + -133.420365, + 55.386352 + ], + [ + -133.633966, + 55.430167 + ], + [ + -133.738027, + 55.556137 + ] + ] + ], + [ + [ + [ + -133.907813, + 56.930849 + ], + [ + -134.050213, + 57.029434 + ], + [ + -133.885905, + 57.095157 + ], + [ + -133.343688, + 57.002049 + ], + [ + -133.102702, + 57.007526 + ], + [ + -132.932917, + 56.82131 + ], + [ + -132.620732, + 56.667956 + ], + [ + -132.653593, + 56.55294 + ], + [ + -132.817901, + 56.492694 + ], + [ + -133.042456, + 56.520078 + ], + [ + -133.201287, + 56.448878 + ], + [ + -133.420365, + 56.492694 + ], + [ + -133.66135, + 56.448878 + ], + [ + -133.710643, + 56.684386 + ], + [ + -133.688735, + 56.837741 + ], + [ + -133.869474, + 56.843218 + ], + [ + -133.907813, + 56.930849 + ] + ] + ], + [ + [ + [ + -134.115936, + 56.48174 + ], + [ + -134.25286, + 56.558417 + ], + [ + -134.400737, + 56.722725 + ], + [ + -134.417168, + 56.848695 + ], + [ + -134.296675, + 56.908941 + ], + [ + -134.170706, + 56.848695 + ], + [ + -134.143321, + 56.952757 + ], + [ + -133.748981, + 56.772017 + ], + [ + -133.710643, + 56.596755 + ], + [ + -133.847566, + 56.574848 + ], + [ + -133.935197, + 56.377678 + ], + [ + -133.836612, + 56.322908 + ], + [ + -133.957105, + 56.092877 + ], + [ + -134.110459, + 56.142169 + ], + [ + -134.132367, + 55.999769 + ], + [ + -134.230952, + 56.070969 + ], + [ + -134.291198, + 56.350293 + ], + [ + -134.115936, + 56.48174 + ] + ] + ], + [ + [ + [ + -134.636246, + 56.28457 + ], + [ + -134.669107, + 56.169554 + ], + [ + -134.806031, + 56.235277 + ], + [ + -135.178463, + 56.67891 + ], + [ + -135.413971, + 56.810356 + ], + [ + -135.331817, + 56.914418 + ], + [ + -135.424925, + 57.166357 + ], + [ + -135.687818, + 57.369004 + ], + [ + -135.419448, + 57.566174 + ], + [ + -135.298955, + 57.48402 + ], + [ + -135.063447, + 57.418296 + ], + [ + -134.849846, + 57.407343 + ], + [ + -134.844369, + 57.248511 + ], + [ + -134.636246, + 56.728202 + ], + [ + -134.636246, + 56.28457 + ] + ] + ], + [ + [ + [ + -134.712923, + 58.223407 + ], + [ + -134.373353, + 58.14673 + ], + [ + -134.176183, + 58.157683 + ], + [ + -134.187137, + 58.081006 + ], + [ + -133.902336, + 57.807159 + ], + [ + -134.099505, + 57.850975 + ], + [ + -134.148798, + 57.757867 + ], + [ + -133.935197, + 57.615466 + ], + [ + -133.869474, + 57.363527 + ], + [ + -134.083075, + 57.297804 + ], + [ + -134.154275, + 57.210173 + ], + [ + -134.499322, + 57.029434 + ], + [ + -134.603384, + 57.034911 + ], + [ + -134.6472, + 57.226604 + ], + [ + -134.575999, + 57.341619 + ], + [ + -134.608861, + 57.511404 + ], + [ + -134.729354, + 57.719528 + ], + [ + -134.707446, + 57.829067 + ], + [ + -134.784123, + 58.097437 + ], + [ + -134.91557, + 58.212453 + ], + [ + -134.953908, + 58.409623 + ], + [ + -134.712923, + 58.223407 + ] + ] + ], + [ + [ + [ + -135.857603, + 57.330665 + ], + [ + -135.715203, + 57.330665 + ], + [ + -135.567326, + 57.149926 + ], + [ + -135.633049, + 57.023957 + ], + [ + -135.857603, + 56.996572 + ], + [ + -135.824742, + 57.193742 + ], + [ + -135.857603, + 57.330665 + ] + ] + ], + [ + [ + [ + -136.279328, + 58.206976 + ], + [ + -135.978096, + 58.201499 + ], + [ + -135.780926, + 58.28913 + ], + [ + -135.496125, + 58.168637 + ], + [ + -135.64948, + 58.037191 + ], + [ + -135.59471, + 57.987898 + ], + [ + -135.45231, + 58.135776 + ], + [ + -135.107263, + 58.086483 + ], + [ + -134.91557, + 57.976944 + ], + [ + -135.025108, + 57.779775 + ], + [ + -134.937477, + 57.763344 + ], + [ + -134.822462, + 57.500451 + ], + [ + -135.085355, + 57.462112 + ], + [ + -135.572802, + 57.675713 + ], + [ + -135.556372, + 57.456635 + ], + [ + -135.709726, + 57.369004 + ], + [ + -135.890465, + 57.407343 + ], + [ + -136.000004, + 57.544266 + ], + [ + -136.208128, + 57.637374 + ], + [ + -136.366959, + 57.829067 + ], + [ + -136.569606, + 57.916698 + ], + [ + -136.558652, + 58.075529 + ], + [ + -136.421728, + 58.130299 + ], + [ + -136.377913, + 58.267222 + ], + [ + -136.279328, + 58.206976 + ] + ] + ], + [ + [ + [ + -147.079854, + 60.200582 + ], + [ + -147.501579, + 59.948643 + ], + [ + -147.53444, + 59.850058 + ], + [ + -147.874011, + 59.784335 + ], + [ + -147.80281, + 59.937689 + ], + [ + -147.435855, + 60.09652 + ], + [ + -147.205824, + 60.271782 + ], + [ + -147.079854, + 60.200582 + ] + ] + ], + [ + [ + [ + -147.561825, + 60.578491 + ], + [ + -147.616594, + 60.370367 + ], + [ + -147.758995, + 60.156767 + ], + [ + -147.956165, + 60.227967 + ], + [ + -147.791856, + 60.474429 + ], + [ + -147.561825, + 60.578491 + ] + ] + ], + [ + [ + [ + -147.786379, + 70.245291 + ], + [ + -147.682318, + 70.201475 + ], + [ + -147.162008, + 70.15766 + ], + [ + -146.888161, + 70.185044 + ], + [ + -146.510252, + 70.185044 + ], + [ + -146.099482, + 70.146706 + ], + [ + -145.858496, + 70.168614 + ], + [ + -145.622988, + 70.08646 + ], + [ + -145.195787, + 69.993352 + ], + [ + -144.620708, + 69.971444 + ], + [ + -144.461877, + 70.026213 + ], + [ + -144.078491, + 70.059075 + ], + [ + -143.914183, + 70.130275 + ], + [ + -143.497935, + 70.141229 + ], + [ + -143.503412, + 70.091936 + ], + [ + -143.25695, + 70.119321 + ], + [ + -142.747594, + 70.042644 + ], + [ + -142.402547, + 69.916674 + ], + [ + -142.079408, + 69.856428 + ], + [ + -142.008207, + 69.801659 + ], + [ + -141.712453, + 69.790705 + ], + [ + -141.433129, + 69.697597 + ], + [ + -141.378359, + 69.63735 + ], + [ + -141.208574, + 69.686643 + ], + [ + -141.00045, + 69.648304 + ], + [ + -141.00045, + 60.304644 + ], + [ + -140.53491, + 60.22249 + ], + [ + -140.474664, + 60.310121 + ], + [ + -139.987216, + 60.184151 + ], + [ + -139.696939, + 60.342983 + ], + [ + -139.088998, + 60.359413 + ], + [ + -139.198537, + 60.091043 + ], + [ + -139.045183, + 59.997935 + ], + [ + -138.700135, + 59.910304 + ], + [ + -138.623458, + 59.767904 + ], + [ + -137.604747, + 59.242118 + ], + [ + -137.445916, + 58.908024 + ], + [ + -137.265177, + 59.001132 + ], + [ + -136.827022, + 59.159963 + ], + [ + -136.580559, + 59.16544 + ], + [ + -136.465544, + 59.285933 + ], + [ + -136.476498, + 59.466672 + ], + [ + -136.301236, + 59.466672 + ], + [ + -136.25742, + 59.625503 + ], + [ + -135.945234, + 59.663842 + ], + [ + -135.479694, + 59.800766 + ], + [ + -135.025108, + 59.565257 + ], + [ + -135.068924, + 59.422857 + ], + [ + -134.959385, + 59.280456 + ], + [ + -134.701969, + 59.247595 + ], + [ + -134.378829, + 59.033994 + ], + [ + -134.400737, + 58.973748 + ], + [ + -134.25286, + 58.858732 + ], + [ + -133.842089, + 58.727285 + ], + [ + -133.173903, + 58.152206 + ], + [ + -133.075318, + 57.998852 + ], + [ + -132.867194, + 57.845498 + ], + [ + -132.560485, + 57.505928 + ], + [ + -132.253777, + 57.21565 + ], + [ + -132.368792, + 57.095157 + ], + [ + -132.05113, + 57.051341 + ], + [ + -132.127807, + 56.876079 + ], + [ + -131.870391, + 56.804879 + ], + [ + -131.837529, + 56.602232 + ], + [ + -131.580113, + 56.613186 + ], + [ + -131.087188, + 56.405062 + ], + [ + -130.78048, + 56.366724 + ], + [ + -130.621648, + 56.268139 + ], + [ + -130.468294, + 56.240754 + ], + [ + -130.424478, + 56.142169 + ], + [ + -130.101339, + 56.114785 + ], + [ + -130.002754, + 55.994292 + ], + [ + -130.150631, + 55.769737 + ], + [ + -130.128724, + 55.583521 + ], + [ + -129.986323, + 55.276813 + ], + [ + -130.095862, + 55.200136 + ], + [ + -130.336847, + 54.920812 + ], + [ + -130.687372, + 54.718165 + ], + [ + -130.785957, + 54.822227 + ], + [ + -130.917403, + 54.789365 + ], + [ + -131.010511, + 54.997489 + ], + [ + -130.983126, + 55.08512 + ], + [ + -131.092665, + 55.189182 + ], + [ + -130.862634, + 55.298721 + ], + [ + -130.928357, + 55.337059 + ], + [ + -131.158389, + 55.200136 + ], + [ + -131.284358, + 55.287767 + ], + [ + -131.426759, + 55.238474 + ], + [ + -131.843006, + 55.457552 + ], + [ + -131.700606, + 55.698537 + ], + [ + -131.963499, + 55.616383 + ], + [ + -131.974453, + 55.49589 + ], + [ + -132.182576, + 55.588998 + ], + [ + -132.226392, + 55.704014 + ], + [ + -132.083991, + 55.829984 + ], + [ + -132.127807, + 55.955953 + ], + [ + -132.324977, + 55.851892 + ], + [ + -132.522147, + 56.076446 + ], + [ + -132.642639, + 56.032631 + ], + [ + -132.719317, + 56.218847 + ], + [ + -132.527624, + 56.339339 + ], + [ + -132.341408, + 56.339339 + ], + [ + -132.396177, + 56.487217 + ], + [ + -132.297592, + 56.67891 + ], + [ + -132.450946, + 56.673433 + ], + [ + -132.768609, + 56.837741 + ], + [ + -132.993164, + 57.034911 + ], + [ + -133.51895, + 57.177311 + ], + [ + -133.507996, + 57.577128 + ], + [ + -133.677781, + 57.62642 + ], + [ + -133.639442, + 57.790728 + ], + [ + -133.814705, + 57.834544 + ], + [ + -134.072121, + 58.053622 + ], + [ + -134.143321, + 58.168637 + ], + [ + -134.586953, + 58.206976 + ], + [ + -135.074401, + 58.502731 + ], + [ + -135.282525, + 59.192825 + ], + [ + -135.38111, + 59.033994 + ], + [ + -135.337294, + 58.891593 + ], + [ + -135.140124, + 58.617746 + ], + [ + -135.189417, + 58.573931 + ], + [ + -135.05797, + 58.349376 + ], + [ + -135.085355, + 58.201499 + ], + [ + -135.277048, + 58.234361 + ], + [ + -135.430402, + 58.398669 + ], + [ + -135.633049, + 58.426053 + ], + [ + -135.91785, + 58.382238 + ], + [ + -135.912373, + 58.617746 + ], + [ + -136.087635, + 58.814916 + ], + [ + -136.246466, + 58.75467 + ], + [ + -136.876314, + 58.962794 + ], + [ + -136.931084, + 58.902547 + ], + [ + -136.586036, + 58.836824 + ], + [ + -136.317666, + 58.672516 + ], + [ + -136.213604, + 58.667039 + ], + [ + -136.180743, + 58.535592 + ], + [ + -136.043819, + 58.382238 + ], + [ + -136.388867, + 58.294607 + ], + [ + -136.591513, + 58.349376 + ], + [ + -136.59699, + 58.212453 + ], + [ + -136.859883, + 58.316515 + ], + [ + -136.947514, + 58.393192 + ], + [ + -137.111823, + 58.393192 + ], + [ + -137.566409, + 58.590362 + ], + [ + -137.900502, + 58.765624 + ], + [ + -137.933364, + 58.869686 + ], + [ + -138.11958, + 59.02304 + ], + [ + -138.634412, + 59.132579 + ], + [ + -138.919213, + 59.247595 + ], + [ + -139.417615, + 59.379041 + ], + [ + -139.746231, + 59.505011 + ], + [ + -139.718846, + 59.641934 + ], + [ + -139.625738, + 59.598119 + ], + [ + -139.5162, + 59.68575 + ], + [ + -139.625738, + 59.88292 + ], + [ + -139.488815, + 59.992458 + ], + [ + -139.554538, + 60.041751 + ], + [ + -139.801, + 59.833627 + ], + [ + -140.315833, + 59.696704 + ], + [ + -140.92925, + 59.745996 + ], + [ + -141.444083, + 59.871966 + ], + [ + -141.46599, + 59.970551 + ], + [ + -141.706976, + 59.948643 + ], + [ + -141.964392, + 60.019843 + ], + [ + -142.539471, + 60.085566 + ], + [ + -142.873564, + 60.091043 + ], + [ + -143.623905, + 60.036274 + ], + [ + -143.892275, + 59.997935 + ], + [ + -144.231845, + 60.140336 + ], + [ + -144.65357, + 60.206059 + ], + [ + -144.785016, + 60.29369 + ], + [ + -144.834309, + 60.441568 + ], + [ + -145.124586, + 60.430614 + ], + [ + -145.223171, + 60.299167 + ], + [ + -145.738004, + 60.474429 + ], + [ + -145.820158, + 60.551106 + ], + [ + -146.351421, + 60.408706 + ], + [ + -146.608837, + 60.238921 + ], + [ + -146.718376, + 60.397752 + ], + [ + -146.608837, + 60.485383 + ], + [ + -146.455483, + 60.463475 + ], + [ + -145.951604, + 60.578491 + ], + [ + -146.017328, + 60.666122 + ], + [ + -146.252836, + 60.622307 + ], + [ + -146.345944, + 60.737322 + ], + [ + -146.565022, + 60.753753 + ], + [ + -146.784099, + 61.044031 + ], + [ + -146.866253, + 60.972831 + ], + [ + -147.172962, + 60.934492 + ], + [ + -147.271547, + 60.972831 + ], + [ + -147.375609, + 60.879723 + ], + [ + -147.758995, + 60.912584 + ], + [ + -147.775426, + 60.808523 + ], + [ + -148.032842, + 60.781138 + ], + [ + -148.153334, + 60.819476 + ], + [ + -148.065703, + 61.005692 + ], + [ + -148.175242, + 61.000215 + ], + [ + -148.350504, + 60.803046 + ], + [ + -148.109519, + 60.737322 + ], + [ + -148.087611, + 60.594922 + ], + [ + -147.939734, + 60.441568 + ], + [ + -148.027365, + 60.277259 + ], + [ + -148.219058, + 60.332029 + ], + [ + -148.273827, + 60.249875 + ], + [ + -148.087611, + 60.217013 + ], + [ + -147.983549, + 59.997935 + ], + [ + -148.251919, + 59.95412 + ], + [ + -148.399797, + 59.997935 + ], + [ + -148.635305, + 59.937689 + ], + [ + -148.755798, + 59.986981 + ], + [ + -149.067984, + 59.981505 + ], + [ + -149.05703, + 60.063659 + ], + [ + -149.204907, + 60.008889 + ], + [ + -149.287061, + 59.904827 + ], + [ + -149.418508, + 59.997935 + ], + [ + -149.582816, + 59.866489 + ], + [ + -149.511616, + 59.806242 + ], + [ + -149.741647, + 59.729565 + ], + [ + -149.949771, + 59.718611 + ], + [ + -150.031925, + 59.61455 + ], + [ + -150.25648, + 59.521442 + ], + [ + -150.409834, + 59.554303 + ], + [ + -150.579619, + 59.444764 + ], + [ + -150.716543, + 59.450241 + ], + [ + -151.001343, + 59.225687 + ], + [ + -151.308052, + 59.209256 + ], + [ + -151.406637, + 59.280456 + ], + [ + -151.592853, + 59.159963 + ], + [ + -151.976239, + 59.253071 + ], + [ + -151.888608, + 59.422857 + ], + [ + -151.636669, + 59.483103 + ], + [ + -151.47236, + 59.472149 + ], + [ + -151.423068, + 59.537872 + ], + [ + -151.127313, + 59.669319 + ], + [ + -151.116359, + 59.778858 + ], + [ + -151.505222, + 59.63098 + ], + [ + -151.828361, + 59.718611 + ], + [ + -151.8667, + 59.778858 + ], + [ + -151.702392, + 60.030797 + ], + [ + -151.423068, + 60.211536 + ], + [ + -151.379252, + 60.359413 + ], + [ + -151.297098, + 60.386798 + ], + [ + -151.264237, + 60.545629 + ], + [ + -151.406637, + 60.720892 + ], + [ + -151.06159, + 60.786615 + ], + [ + -150.404357, + 61.038554 + ], + [ + -150.245526, + 60.939969 + ], + [ + -150.042879, + 60.912584 + ], + [ + -149.741647, + 61.016646 + ], + [ + -150.075741, + 61.15357 + ], + [ + -150.207187, + 61.257632 + ], + [ + -150.47008, + 61.246678 + ], + [ + -150.656296, + 61.29597 + ], + [ + -150.711066, + 61.252155 + ], + [ + -151.023251, + 61.180954 + ], + [ + -151.165652, + 61.044031 + ], + [ + -151.477837, + 61.011169 + ], + [ + -151.800977, + 60.852338 + ], + [ + -151.833838, + 60.748276 + ], + [ + -152.080301, + 60.693507 + ], + [ + -152.13507, + 60.578491 + ], + [ + -152.310332, + 60.507291 + ], + [ + -152.392486, + 60.304644 + ], + [ + -152.732057, + 60.173197 + ], + [ + -152.567748, + 60.069136 + ], + [ + -152.704672, + 59.915781 + ], + [ + -153.022334, + 59.888397 + ], + [ + -153.049719, + 59.691227 + ], + [ + -153.345474, + 59.620026 + ], + [ + -153.438582, + 59.702181 + ], + [ + -153.586459, + 59.548826 + ], + [ + -153.761721, + 59.543349 + ], + [ + -153.72886, + 59.433811 + ], + [ + -154.117723, + 59.368087 + ], + [ + -154.1944, + 59.066856 + ], + [ + -153.750768, + 59.050425 + ], + [ + -153.400243, + 58.968271 + ], + [ + -153.301658, + 58.869686 + ], + [ + -153.444059, + 58.710854 + ], + [ + -153.679567, + 58.612269 + ], + [ + -153.898645, + 58.606793 + ], + [ + -153.920553, + 58.519161 + ], + [ + -154.062953, + 58.4863 + ], + [ + -153.99723, + 58.376761 + ], + [ + -154.145107, + 58.212453 + ], + [ + -154.46277, + 58.059098 + ], + [ + -154.643509, + 58.059098 + ], + [ + -154.818771, + 58.004329 + ], + [ + -154.988556, + 58.015283 + ], + [ + -155.120003, + 57.955037 + ], + [ + -155.081664, + 57.872883 + ], + [ + -155.328126, + 57.829067 + ], + [ + -155.377419, + 57.708574 + ], + [ + -155.547204, + 57.785251 + ], + [ + -155.73342, + 57.549743 + ], + [ + -156.045606, + 57.566174 + ], + [ + -156.023698, + 57.440204 + ], + [ + -156.209914, + 57.473066 + ], + [ + -156.34136, + 57.418296 + ], + [ + -156.34136, + 57.248511 + ], + [ + -156.549484, + 56.985618 + ], + [ + -156.883577, + 56.952757 + ], + [ + -157.157424, + 56.832264 + ], + [ + -157.20124, + 56.766541 + ], + [ + -157.376502, + 56.859649 + ], + [ + -157.672257, + 56.607709 + ], + [ + -157.754411, + 56.67891 + ], + [ + -157.918719, + 56.657002 + ], + [ + -157.957058, + 56.514601 + ], + [ + -158.126843, + 56.459832 + ], + [ + -158.32949, + 56.48174 + ], + [ + -158.488321, + 56.339339 + ], + [ + -158.208997, + 56.295524 + ], + [ + -158.510229, + 55.977861 + ], + [ + -159.375585, + 55.873799 + ], + [ + -159.616571, + 55.594475 + ], + [ + -159.676817, + 55.654722 + ], + [ + -159.643955, + 55.829984 + ], + [ + -159.813741, + 55.857368 + ], + [ + -160.027341, + 55.791645 + ], + [ + -160.060203, + 55.720445 + ], + [ + -160.394296, + 55.605429 + ], + [ + -160.536697, + 55.473983 + ], + [ + -160.580512, + 55.567091 + ], + [ + -160.668143, + 55.457552 + ], + [ + -160.865313, + 55.528752 + ], + [ + -161.232268, + 55.358967 + ], + [ + -161.506115, + 55.364444 + ], + [ + -161.467776, + 55.49589 + ], + [ + -161.588269, + 55.62186 + ], + [ + -161.697808, + 55.517798 + ], + [ + -161.686854, + 55.408259 + ], + [ + -162.053809, + 55.074166 + ], + [ + -162.179779, + 55.15632 + ], + [ + -162.218117, + 55.03035 + ], + [ + -162.470057, + 55.052258 + ], + [ + -162.508395, + 55.249428 + ], + [ + -162.661749, + 55.293244 + ], + [ + -162.716519, + 55.222043 + ], + [ + -162.579595, + 55.134412 + ], + [ + -162.645319, + 54.997489 + ], + [ + -162.847965, + 54.926289 + ], + [ + -163.00132, + 55.079643 + ], + [ + -163.187536, + 55.090597 + ], + [ + -163.220397, + 55.03035 + ], + [ + -163.034181, + 54.942719 + ], + [ + -163.373752, + 54.800319 + ], + [ + -163.14372, + 54.76198 + ], + [ + -163.138243, + 54.696257 + ], + [ + -163.329936, + 54.74555 + ], + [ + -163.587352, + 54.614103 + ], + [ + -164.085754, + 54.61958 + ], + [ + -164.332216, + 54.531949 + ], + [ + -164.354124, + 54.466226 + ], + [ + -164.638925, + 54.389548 + ], + [ + -164.847049, + 54.416933 + ], + [ + -164.918249, + 54.603149 + ], + [ + -164.710125, + 54.663395 + ], + [ + -164.551294, + 54.88795 + ], + [ + -164.34317, + 54.893427 + ], + [ + -163.894061, + 55.041304 + ], + [ + -163.532583, + 55.046781 + ], + [ + -163.39566, + 54.904381 + ], + [ + -163.291598, + 55.008443 + ], + [ + -163.313505, + 55.128935 + ], + [ + -163.105382, + 55.183705 + ], + [ + -162.880827, + 55.183705 + ], + [ + -162.579595, + 55.446598 + ], + [ + -162.245502, + 55.682106 + ], + [ + -161.807347, + 55.89023 + ], + [ + -161.292514, + 55.983338 + ], + [ + -161.078914, + 55.939523 + ], + [ + -160.87079, + 55.999769 + ], + [ + -160.816021, + 55.912138 + ], + [ + -160.931036, + 55.813553 + ], + [ + -160.805067, + 55.736876 + ], + [ + -160.766728, + 55.857368 + ], + [ + -160.509312, + 55.868322 + ], + [ + -160.438112, + 55.791645 + ], + [ + -160.27928, + 55.76426 + ], + [ + -160.273803, + 55.857368 + ], + [ + -160.536697, + 55.939523 + ], + [ + -160.558604, + 55.994292 + ], + [ + -160.383342, + 56.251708 + ], + [ + -160.147834, + 56.399586 + ], + [ + -159.830171, + 56.541986 + ], + [ + -159.326293, + 56.667956 + ], + [ + -158.959338, + 56.848695 + ], + [ + -158.784076, + 56.782971 + ], + [ + -158.641675, + 56.810356 + ], + [ + -158.701922, + 56.925372 + ], + [ + -158.658106, + 57.034911 + ], + [ + -158.378782, + 57.264942 + ], + [ + -157.995396, + 57.41282 + ], + [ + -157.688688, + 57.609989 + ], + [ + -157.705118, + 57.719528 + ], + [ + -157.458656, + 58.497254 + ], + [ + -157.07527, + 58.705377 + ], + [ + -157.119086, + 58.869686 + ], + [ + -158.039212, + 58.634177 + ], + [ + -158.32949, + 58.661562 + ], + [ + -158.40069, + 58.760147 + ], + [ + -158.564998, + 58.803962 + ], + [ + -158.619768, + 58.913501 + ], + [ + -158.767645, + 58.864209 + ], + [ + -158.860753, + 58.694424 + ], + [ + -158.701922, + 58.480823 + ], + [ + -158.893615, + 58.387715 + ], + [ + -159.0634, + 58.420577 + ], + [ + -159.392016, + 58.760147 + ], + [ + -159.616571, + 58.929932 + ], + [ + -159.731586, + 58.929932 + ], + [ + -159.808264, + 58.803962 + ], + [ + -159.906848, + 58.782055 + ], + [ + -160.054726, + 58.886116 + ], + [ + -160.235465, + 58.902547 + ], + [ + -160.317619, + 59.072332 + ], + [ + -160.854359, + 58.88064 + ], + [ + -161.33633, + 58.743716 + ], + [ + -161.374669, + 58.667039 + ], + [ + -161.752577, + 58.552023 + ], + [ + -161.938793, + 58.656085 + ], + [ + -161.769008, + 58.776578 + ], + [ + -161.829255, + 59.061379 + ], + [ + -161.955224, + 59.36261 + ], + [ + -161.703285, + 59.48858 + ], + [ + -161.911409, + 59.740519 + ], + [ + -162.092148, + 59.88292 + ], + [ + -162.234548, + 60.091043 + ], + [ + -162.448149, + 60.178674 + ], + [ + -162.502918, + 59.997935 + ], + [ + -162.760334, + 59.959597 + ], + [ + -163.171105, + 59.844581 + ], + [ + -163.66403, + 59.795289 + ], + [ + -163.9324, + 59.806242 + ], + [ + -164.162431, + 59.866489 + ], + [ + -164.189816, + 60.02532 + ], + [ + -164.386986, + 60.074613 + ], + [ + -164.699171, + 60.29369 + ], + [ + -164.962064, + 60.337506 + ], + [ + -165.268773, + 60.578491 + ], + [ + -165.060649, + 60.68803 + ], + [ + -165.016834, + 60.890677 + ], + [ + -165.175665, + 60.846861 + ], + [ + -165.197573, + 60.972831 + ], + [ + -165.120896, + 61.076893 + ], + [ + -165.323543, + 61.170001 + ], + [ + -165.34545, + 61.071416 + ], + [ + -165.591913, + 61.109754 + ], + [ + -165.624774, + 61.279539 + ], + [ + -165.816467, + 61.301447 + ], + [ + -165.920529, + 61.416463 + ], + [ + -165.915052, + 61.558863 + ], + [ + -166.106745, + 61.49314 + ], + [ + -166.139607, + 61.630064 + ], + [ + -165.904098, + 61.662925 + ], + [ + -166.095791, + 61.81628 + ], + [ + -165.756221, + 61.827233 + ], + [ + -165.756221, + 62.013449 + ], + [ + -165.674067, + 62.139419 + ], + [ + -165.044219, + 62.539236 + ], + [ + -164.912772, + 62.659728 + ], + [ + -164.819664, + 62.637821 + ], + [ + -164.874433, + 62.807606 + ], + [ + -164.633448, + 63.097884 + ], + [ + -164.425324, + 63.212899 + ], + [ + -164.036462, + 63.262192 + ], + [ + -163.73523, + 63.212899 + ], + [ + -163.313505, + 63.037637 + ], + [ + -163.039658, + 63.059545 + ], + [ + -162.661749, + 63.22933 + ], + [ + -162.272887, + 63.486746 + ], + [ + -162.075717, + 63.514131 + ], + [ + -162.026424, + 63.448408 + ], + [ + -161.555408, + 63.448408 + ], + [ + -161.13916, + 63.503177 + ], + [ + -160.766728, + 63.771547 + ], + [ + -160.766728, + 63.837271 + ], + [ + -160.952944, + 64.08921 + ], + [ + -160.974852, + 64.237087 + ], + [ + -161.26513, + 64.395918 + ], + [ + -161.374669, + 64.532842 + ], + [ + -161.078914, + 64.494503 + ], + [ + -160.79959, + 64.609519 + ], + [ + -160.783159, + 64.719058 + ], + [ + -161.144637, + 64.921705 + ], + [ + -161.413007, + 64.762873 + ], + [ + -161.664946, + 64.790258 + ], + [ + -161.900455, + 64.702627 + ], + [ + -162.168825, + 64.680719 + ], + [ + -162.234548, + 64.620473 + ], + [ + -162.541257, + 64.532842 + ], + [ + -162.634365, + 64.384965 + ], + [ + -162.787719, + 64.324718 + ], + [ + -162.858919, + 64.49998 + ], + [ + -163.045135, + 64.538319 + ], + [ + -163.176582, + 64.401395 + ], + [ + -163.253259, + 64.467119 + ], + [ + -163.598306, + 64.565704 + ], + [ + -164.304832, + 64.560227 + ], + [ + -164.80871, + 64.450688 + ], + [ + -165.000403, + 64.434257 + ], + [ + -165.411174, + 64.49998 + ], + [ + -166.188899, + 64.576658 + ], + [ + -166.391546, + 64.636904 + ], + [ + -166.484654, + 64.735489 + ], + [ + -166.413454, + 64.872412 + ], + [ + -166.692778, + 64.987428 + ], + [ + -166.638008, + 65.113398 + ], + [ + -166.462746, + 65.179121 + ], + [ + -166.517516, + 65.337952 + ], + [ + -166.796839, + 65.337952 + ], + [ + -167.026871, + 65.381768 + ], + [ + -167.47598, + 65.414629 + ], + [ + -167.711489, + 65.496784 + ], + [ + -168.072967, + 65.578938 + ], + [ + -168.105828, + 65.682999 + ], + [ + -167.541703, + 65.819923 + ], + [ + -166.829701, + 66.049954 + ], + [ + -166.3313, + 66.186878 + ], + [ + -166.046499, + 66.110201 + ], + [ + -165.756221, + 66.09377 + ], + [ + -165.690498, + 66.203309 + ], + [ + -165.86576, + 66.21974 + ], + [ + -165.88219, + 66.312848 + ], + [ + -165.186619, + 66.466202 + ], + [ + -164.403417, + 66.581218 + ], + [ + -163.981692, + 66.592172 + ], + [ + -163.751661, + 66.553833 + ], + [ + -163.872153, + 66.389525 + ], + [ + -163.828338, + 66.274509 + ], + [ + -163.915969, + 66.192355 + ], + [ + -163.768091, + 66.060908 + ], + [ + -163.494244, + 66.082816 + ], + [ + -163.149197, + 66.060908 + ], + [ + -162.749381, + 66.088293 + ], + [ + -162.634365, + 66.039001 + ], + [ + -162.371472, + 66.028047 + ], + [ + -162.14144, + 66.077339 + ], + [ + -161.840208, + 66.02257 + ], + [ + -161.549931, + 66.241647 + ], + [ + -161.341807, + 66.252601 + ], + [ + -161.199406, + 66.208786 + ], + [ + -161.128206, + 66.334755 + ], + [ + -161.528023, + 66.395002 + ], + [ + -161.911409, + 66.345709 + ], + [ + -161.87307, + 66.510017 + ], + [ + -162.174302, + 66.68528 + ], + [ + -162.502918, + 66.740049 + ], + [ + -162.601503, + 66.89888 + ], + [ + -162.344087, + 66.937219 + ], + [ + -162.015471, + 66.778388 + ], + [ + -162.075717, + 66.652418 + ], + [ + -161.916886, + 66.553833 + ], + [ + -161.571838, + 66.438817 + ], + [ + -161.489684, + 66.55931 + ], + [ + -161.884024, + 66.718141 + ], + [ + -161.714239, + 67.002942 + ], + [ + -161.851162, + 67.052235 + ], + [ + -162.240025, + 66.991988 + ], + [ + -162.639842, + 67.008419 + ], + [ + -162.700088, + 67.057712 + ], + [ + -162.902735, + 67.008419 + ], + [ + -163.740707, + 67.128912 + ], + [ + -163.757138, + 67.254881 + ], + [ + -164.009077, + 67.534205 + ], + [ + -164.211724, + 67.638267 + ], + [ + -164.534863, + 67.725898 + ], + [ + -165.192096, + 67.966884 + ], + [ + -165.493328, + 68.059992 + ], + [ + -165.794559, + 68.081899 + ], + [ + -166.243668, + 68.246208 + ], + [ + -166.681824, + 68.339316 + ], + [ + -166.703731, + 68.372177 + ], + [ + -166.375115, + 68.42147 + ], + [ + -166.227238, + 68.574824 + ], + [ + -166.216284, + 68.881533 + ], + [ + -165.329019, + 68.859625 + ], + [ + -164.255539, + 68.930825 + ], + [ + -163.976215, + 68.985595 + ], + [ + -163.532583, + 69.138949 + ], + [ + -163.110859, + 69.374457 + ], + [ + -163.023228, + 69.609966 + ], + [ + -162.842489, + 69.812613 + ], + [ + -162.470057, + 69.982398 + ], + [ + -162.311225, + 70.108367 + ], + [ + -161.851162, + 70.311014 + ], + [ + -161.779962, + 70.256245 + ], + [ + -161.396576, + 70.239814 + ], + [ + -160.837928, + 70.343876 + ], + [ + -160.487404, + 70.453415 + ], + [ + -159.649432, + 70.792985 + ], + [ + -159.33177, + 70.809416 + ], + [ + -159.298908, + 70.760123 + ], + [ + -158.975769, + 70.798462 + ], + [ + -158.658106, + 70.787508 + ], + [ + -158.033735, + 70.831323 + ], + [ + -157.420318, + 70.979201 + ], + [ + -156.812377, + 71.285909 + ], + [ + -156.565915, + 71.351633 + ], + [ + -156.522099, + 71.296863 + ], + [ + -155.585543, + 71.170894 + ], + [ + -155.508865, + 71.083263 + ], + [ + -155.832005, + 70.968247 + ], + [ + -155.979882, + 70.96277 + ], + [ + -155.974405, + 70.809416 + ], + [ + -155.503388, + 70.858708 + ], + [ + -155.476004, + 70.940862 + ], + [ + -155.262403, + 71.017539 + ], + [ + -155.191203, + 70.973724 + ], + [ + -155.032372, + 71.148986 + ], + [ + -154.566832, + 70.990155 + ], + [ + -154.643509, + 70.869662 + ], + [ + -154.353231, + 70.8368 + ], + [ + -154.183446, + 70.7656 + ], + [ + -153.931507, + 70.880616 + ], + [ + -153.487874, + 70.886093 + ], + [ + -153.235935, + 70.924431 + ], + [ + -152.589656, + 70.886093 + ], + [ + -152.26104, + 70.842277 + ], + [ + -152.419871, + 70.606769 + ], + [ + -151.817408, + 70.546523 + ], + [ + -151.773592, + 70.486276 + ], + [ + -151.187559, + 70.382214 + ], + [ + -151.182082, + 70.431507 + ], + [ + -150.760358, + 70.49723 + ], + [ + -150.355064, + 70.491753 + ], + [ + -150.349588, + 70.436984 + ], + [ + -150.114079, + 70.431507 + ], + [ + -149.867617, + 70.508184 + ], + [ + -149.462323, + 70.519138 + ], + [ + -149.177522, + 70.486276 + ], + [ + -148.78866, + 70.404122 + ], + [ + -148.607921, + 70.420553 + ], + [ + -148.350504, + 70.305537 + ], + [ + -148.202627, + 70.349353 + ], + [ + -147.961642, + 70.316491 + ], + [ + -147.786379, + 70.245291 + ] + ] + ], + [ + [ + [ + -152.94018, + 58.026237 + ], + [ + -152.945657, + 57.982421 + ], + [ + -153.290705, + 58.048145 + ], + [ + -153.044242, + 58.305561 + ], + [ + -152.819688, + 58.327469 + ], + [ + -152.666333, + 58.562977 + ], + [ + -152.496548, + 58.354853 + ], + [ + -152.354148, + 58.426053 + ], + [ + -152.080301, + 58.311038 + ], + [ + -152.080301, + 58.152206 + ], + [ + -152.480117, + 58.130299 + ], + [ + -152.655379, + 58.059098 + ], + [ + -152.94018, + 58.026237 + ] + ] + ], + [ + [ + [ + -153.958891, + 57.538789 + ], + [ + -153.67409, + 57.670236 + ], + [ + -153.931507, + 57.69762 + ], + [ + -153.936983, + 57.812636 + ], + [ + -153.723383, + 57.889313 + ], + [ + -153.570028, + 57.834544 + ], + [ + -153.548121, + 57.719528 + ], + [ + -153.46049, + 57.796205 + ], + [ + -153.455013, + 57.96599 + ], + [ + -153.268797, + 57.889313 + ], + [ + -153.235935, + 57.998852 + ], + [ + -153.071627, + 57.933129 + ], + [ + -152.874457, + 57.933129 + ], + [ + -152.721103, + 57.993375 + ], + [ + -152.469163, + 57.889313 + ], + [ + -152.469163, + 57.599035 + ], + [ + -152.151501, + 57.620943 + ], + [ + -152.359625, + 57.42925 + ], + [ + -152.74301, + 57.505928 + ], + [ + -152.60061, + 57.379958 + ], + [ + -152.710149, + 57.275896 + ], + [ + -152.907319, + 57.325188 + ], + [ + -152.912796, + 57.128019 + ], + [ + -153.214027, + 57.073249 + ], + [ + -153.312612, + 56.991095 + ], + [ + -153.498828, + 57.067772 + ], + [ + -153.695998, + 56.859649 + ], + [ + -153.849352, + 56.837741 + ], + [ + -154.013661, + 56.744633 + ], + [ + -154.073907, + 56.969187 + ], + [ + -154.303938, + 56.848695 + ], + [ + -154.314892, + 56.919895 + ], + [ + -154.523016, + 56.991095 + ], + [ + -154.539447, + 57.193742 + ], + [ + -154.742094, + 57.275896 + ], + [ + -154.627078, + 57.511404 + ], + [ + -154.227261, + 57.659282 + ], + [ + -153.980799, + 57.648328 + ], + [ + -153.958891, + 57.538789 + ] + ] + ], + [ + [ + [ + -154.53397, + 56.602232 + ], + [ + -154.742094, + 56.399586 + ], + [ + -154.807817, + 56.432447 + ], + [ + -154.53397, + 56.602232 + ] + ] + ], + [ + [ + [ + -155.634835, + 55.923092 + ], + [ + -155.476004, + 55.912138 + ], + [ + -155.530773, + 55.704014 + ], + [ + -155.793666, + 55.731399 + ], + [ + -155.837482, + 55.802599 + ], + [ + -155.634835, + 55.923092 + ] + ] + ], + [ + [ + [ + -159.890418, + 55.28229 + ], + [ + -159.950664, + 55.068689 + ], + [ + -160.257373, + 54.893427 + ], + [ + -160.109495, + 55.161797 + ], + [ + -160.005433, + 55.134412 + ], + [ + -159.890418, + 55.28229 + ] + ] + ], + [ + [ + [ + -160.520266, + 55.358967 + ], + [ + -160.33405, + 55.358967 + ], + [ + -160.339527, + 55.249428 + ], + [ + -160.525743, + 55.128935 + ], + [ + -160.690051, + 55.211089 + ], + [ + -160.794113, + 55.134412 + ], + [ + -160.854359, + 55.320628 + ], + [ + -160.79959, + 55.380875 + ], + [ + -160.520266, + 55.358967 + ] + ] + ], + [ + [ + [ + -162.256456, + 54.981058 + ], + [ + -162.234548, + 54.893427 + ], + [ + -162.349564, + 54.838658 + ], + [ + -162.437195, + 54.931766 + ], + [ + -162.256456, + 54.981058 + ] + ] + ], + [ + [ + [ + -162.415287, + 63.634624 + ], + [ + -162.563165, + 63.536039 + ], + [ + -162.612457, + 63.62367 + ], + [ + -162.415287, + 63.634624 + ] + ] + ], + [ + [ + [ + -162.80415, + 54.488133 + ], + [ + -162.590549, + 54.449795 + ], + [ + -162.612457, + 54.367641 + ], + [ + -162.782242, + 54.373118 + ], + [ + -162.80415, + 54.488133 + ] + ] + ], + [ + [ + [ + -165.548097, + 54.29644 + ], + [ + -165.476897, + 54.181425 + ], + [ + -165.630251, + 54.132132 + ], + [ + -165.685021, + 54.252625 + ], + [ + -165.548097, + 54.29644 + ] + ] + ], + [ + [ + [ + -165.73979, + 54.15404 + ], + [ + -166.046499, + 54.044501 + ], + [ + -166.112222, + 54.121178 + ], + [ + -165.980775, + 54.219763 + ], + [ + -165.73979, + 54.15404 + ] + ] + ], + [ + [ + [ + -166.364161, + 60.359413 + ], + [ + -166.13413, + 60.397752 + ], + [ + -166.084837, + 60.326552 + ], + [ + -165.88219, + 60.342983 + ], + [ + -165.685021, + 60.277259 + ], + [ + -165.646682, + 59.992458 + ], + [ + -165.750744, + 59.89935 + ], + [ + -166.00816, + 59.844581 + ], + [ + -166.062929, + 59.745996 + ], + [ + -166.440838, + 59.855535 + ], + [ + -166.6161, + 59.850058 + ], + [ + -166.994009, + 59.992458 + ], + [ + -167.125456, + 59.992458 + ], + [ + -167.344534, + 60.074613 + ], + [ + -167.421211, + 60.206059 + ], + [ + -167.311672, + 60.238921 + ], + [ + -166.93924, + 60.206059 + ], + [ + -166.763978, + 60.310121 + ], + [ + -166.577762, + 60.321075 + ], + [ + -166.495608, + 60.392275 + ], + [ + -166.364161, + 60.359413 + ] + ] + ], + [ + [ + [ + -166.375115, + 54.01164 + ], + [ + -166.210807, + 53.934962 + ], + [ + -166.5449, + 53.748746 + ], + [ + -166.539423, + 53.715885 + ], + [ + -166.117699, + 53.852808 + ], + [ + -166.112222, + 53.776131 + ], + [ + -166.282007, + 53.683023 + ], + [ + -166.555854, + 53.622777 + ], + [ + -166.583239, + 53.529669 + ], + [ + -166.878994, + 53.431084 + ], + [ + -167.13641, + 53.425607 + ], + [ + -167.306195, + 53.332499 + ], + [ + -167.623857, + 53.250345 + ], + [ + -167.793643, + 53.337976 + ], + [ + -167.459549, + 53.442038 + ], + [ + -167.355487, + 53.425607 + ], + [ + -167.103548, + 53.513238 + ], + [ + -167.163794, + 53.611823 + ], + [ + -167.021394, + 53.715885 + ], + [ + -166.807793, + 53.666592 + ], + [ + -166.785886, + 53.732316 + ], + [ + -167.015917, + 53.754223 + ], + [ + -167.141887, + 53.825424 + ], + [ + -167.032348, + 53.945916 + ], + [ + -166.643485, + 54.017116 + ], + [ + -166.561331, + 53.880193 + ], + [ + -166.375115, + 54.01164 + ] + ] + ], + [ + [ + [ + -168.790446, + 53.157237 + ], + [ + -168.40706, + 53.34893 + ], + [ + -168.385152, + 53.431084 + ], + [ + -168.237275, + 53.524192 + ], + [ + -168.007243, + 53.568007 + ], + [ + -167.886751, + 53.518715 + ], + [ + -167.842935, + 53.387268 + ], + [ + -168.270136, + 53.244868 + ], + [ + -168.500168, + 53.036744 + ], + [ + -168.686384, + 52.965544 + ], + [ + -168.790446, + 53.157237 + ] + ] + ], + [ + [ + [ + -169.74891, + 52.894344 + ], + [ + -169.705095, + 52.795759 + ], + [ + -169.962511, + 52.790282 + ], + [ + -169.989896, + 52.856005 + ], + [ + -169.74891, + 52.894344 + ] + ] + ], + [ + [ + [ + -170.148727, + 57.221127 + ], + [ + -170.28565, + 57.128019 + ], + [ + -170.313035, + 57.221127 + ], + [ + -170.148727, + 57.221127 + ] + ] + ], + [ + [ + [ + -170.669036, + 52.697174 + ], + [ + -170.603313, + 52.604066 + ], + [ + -170.789529, + 52.538343 + ], + [ + -170.816914, + 52.636928 + ], + [ + -170.669036, + 52.697174 + ] + ] + ], + [ + [ + [ + -171.742517, + 63.716778 + ], + [ + -170.94836, + 63.5689 + ], + [ + -170.488297, + 63.69487 + ], + [ + -170.280174, + 63.683916 + ], + [ + -170.093958, + 63.612716 + ], + [ + -170.044665, + 63.492223 + ], + [ + -169.644848, + 63.4265 + ], + [ + -169.518879, + 63.366254 + ], + [ + -168.99857, + 63.338869 + ], + [ + -168.686384, + 63.295053 + ], + [ + -168.856169, + 63.147176 + ], + [ + -169.108108, + 63.180038 + ], + [ + -169.376478, + 63.152653 + ], + [ + -169.513402, + 63.08693 + ], + [ + -169.639372, + 62.939052 + ], + [ + -169.831064, + 63.075976 + ], + [ + -170.055619, + 63.169084 + ], + [ + -170.263743, + 63.180038 + ], + [ + -170.362328, + 63.2841 + ], + [ + -170.866206, + 63.415546 + ], + [ + -171.101715, + 63.421023 + ], + [ + -171.463193, + 63.306007 + ], + [ + -171.73704, + 63.366254 + ], + [ + -171.852055, + 63.486746 + ], + [ + -171.742517, + 63.716778 + ] + ] + ], + [ + [ + [ + -172.432611, + 52.390465 + ], + [ + -172.41618, + 52.275449 + ], + [ + -172.607873, + 52.253542 + ], + [ + -172.569535, + 52.352127 + ], + [ + -172.432611, + 52.390465 + ] + ] + ], + [ + [ + [ + -173.626584, + 52.14948 + ], + [ + -173.495138, + 52.105664 + ], + [ + -173.122706, + 52.111141 + ], + [ + -173.106275, + 52.07828 + ], + [ + -173.549907, + 52.028987 + ], + [ + -173.626584, + 52.14948 + ] + ] + ], + [ + [ + [ + -174.322156, + 52.280926 + ], + [ + -174.327632, + 52.379511 + ], + [ + -174.185232, + 52.41785 + ], + [ + -173.982585, + 52.319265 + ], + [ + -174.059262, + 52.226157 + ], + [ + -174.179755, + 52.231634 + ], + [ + -174.141417, + 52.127572 + ], + [ + -174.333109, + 52.116618 + ], + [ + -174.738403, + 52.007079 + ], + [ + -174.968435, + 52.039941 + ], + [ + -174.902711, + 52.116618 + ], + [ + -174.656249, + 52.105664 + ], + [ + -174.322156, + 52.280926 + ] + ] + ], + [ + [ + [ + -176.469116, + 51.853725 + ], + [ + -176.288377, + 51.870156 + ], + [ + -176.288377, + 51.744186 + ], + [ + -176.518409, + 51.760617 + ], + [ + -176.80321, + 51.61274 + ], + [ + -176.912748, + 51.80991 + ], + [ + -176.792256, + 51.815386 + ], + [ + -176.775825, + 51.963264 + ], + [ + -176.627947, + 51.968741 + ], + [ + -176.627947, + 51.859202 + ], + [ + -176.469116, + 51.853725 + ] + ] + ], + [ + [ + [ + -177.153734, + 51.946833 + ], + [ + -177.044195, + 51.897541 + ], + [ + -177.120872, + 51.727755 + ], + [ + -177.274226, + 51.678463 + ], + [ + -177.279703, + 51.782525 + ], + [ + -177.153734, + 51.946833 + ] + ] + ], + [ + [ + [ + -178.123152, + 51.919448 + ], + [ + -177.953367, + 51.913971 + ], + [ + -177.800013, + 51.793479 + ], + [ + -177.964321, + 51.651078 + ], + [ + -178.123152, + 51.919448 + ] + ] + ], + [ + [ + [ + 173.107557, + 52.992929 + ], + [ + 173.293773, + 52.927205 + ], + [ + 173.304726, + 52.823143 + ], + [ + 172.90491, + 52.762897 + ], + [ + 172.642017, + 52.927205 + ], + [ + 172.642017, + 53.003883 + ], + [ + 173.107557, + 52.992929 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "04", + "properties": { + "name": "Arizona" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -109.042503, + 37.000263 + ], + [ + -109.04798, + 31.331629 + ], + [ + -111.074448, + 31.331629 + ], + [ + -112.246513, + 31.704061 + ], + [ + -114.815198, + 32.492741 + ], + [ + -114.72209, + 32.717295 + ], + [ + -114.524921, + 32.755634 + ], + [ + -114.470151, + 32.843265 + ], + [ + -114.524921, + 33.029481 + ], + [ + -114.661844, + 33.034958 + ], + [ + -114.727567, + 33.40739 + ], + [ + -114.524921, + 33.54979 + ], + [ + -114.497536, + 33.697668 + ], + [ + -114.535874, + 33.933176 + ], + [ + -114.415382, + 34.108438 + ], + [ + -114.256551, + 34.174162 + ], + [ + -114.136058, + 34.305608 + ], + [ + -114.333228, + 34.448009 + ], + [ + -114.470151, + 34.710902 + ], + [ + -114.634459, + 34.87521 + ], + [ + -114.634459, + 35.00118 + ], + [ + -114.574213, + 35.138103 + ], + [ + -114.596121, + 35.324319 + ], + [ + -114.678275, + 35.516012 + ], + [ + -114.738521, + 36.102045 + ], + [ + -114.371566, + 36.140383 + ], + [ + -114.251074, + 36.01989 + ], + [ + -114.152489, + 36.025367 + ], + [ + -114.048427, + 36.195153 + ], + [ + -114.048427, + 37.000263 + ], + [ + -110.499369, + 37.00574 + ], + [ + -109.042503, + 37.000263 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "05", + "properties": { + "name": "Arkansas" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -94.473842, + 36.501861 + ], + [ + -90.152536, + 36.496384 + ], + [ + -90.064905, + 36.304691 + ], + [ + -90.218259, + 36.184199 + ], + [ + -90.377091, + 35.997983 + ], + [ + -89.730812, + 35.997983 + ], + [ + -89.763673, + 35.811767 + ], + [ + -89.911551, + 35.756997 + ], + [ + -89.944412, + 35.603643 + ], + [ + -90.130628, + 35.439335 + ], + [ + -90.114197, + 35.198349 + ], + [ + -90.212782, + 35.023087 + ], + [ + -90.311367, + 34.995703 + ], + [ + -90.251121, + 34.908072 + ], + [ + -90.409952, + 34.831394 + ], + [ + -90.481152, + 34.661609 + ], + [ + -90.585214, + 34.617794 + ], + [ + -90.568783, + 34.420624 + ], + [ + -90.749522, + 34.365854 + ], + [ + -90.744046, + 34.300131 + ], + [ + -90.952169, + 34.135823 + ], + [ + -90.891923, + 34.026284 + ], + [ + -91.072662, + 33.867453 + ], + [ + -91.231493, + 33.560744 + ], + [ + -91.056231, + 33.429298 + ], + [ + -91.143862, + 33.347144 + ], + [ + -91.089093, + 33.13902 + ], + [ + -91.16577, + 33.002096 + ], + [ + -93.608485, + 33.018527 + ], + [ + -94.041164, + 33.018527 + ], + [ + -94.041164, + 33.54979 + ], + [ + -94.183564, + 33.593606 + ], + [ + -94.380734, + 33.544313 + ], + [ + -94.484796, + 33.637421 + ], + [ + -94.430026, + 35.395519 + ], + [ + -94.616242, + 36.501861 + ], + [ + -94.473842, + 36.501861 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "06", + "properties": { + "name": "California" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -123.233256, + 42.006186 + ], + [ + -122.378853, + 42.011663 + ], + [ + -121.037003, + 41.995232 + ], + [ + -120.001861, + 41.995232 + ], + [ + -119.996384, + 40.264519 + ], + [ + -120.001861, + 38.999346 + ], + [ + -118.71478, + 38.101128 + ], + [ + -117.498899, + 37.21934 + ], + [ + -116.540435, + 36.501861 + ], + [ + -115.85034, + 35.970598 + ], + [ + -114.634459, + 35.00118 + ], + [ + -114.634459, + 34.87521 + ], + [ + -114.470151, + 34.710902 + ], + [ + -114.333228, + 34.448009 + ], + [ + -114.136058, + 34.305608 + ], + [ + -114.256551, + 34.174162 + ], + [ + -114.415382, + 34.108438 + ], + [ + -114.535874, + 33.933176 + ], + [ + -114.497536, + 33.697668 + ], + [ + -114.524921, + 33.54979 + ], + [ + -114.727567, + 33.40739 + ], + [ + -114.661844, + 33.034958 + ], + [ + -114.524921, + 33.029481 + ], + [ + -114.470151, + 32.843265 + ], + [ + -114.524921, + 32.755634 + ], + [ + -114.72209, + 32.717295 + ], + [ + -116.04751, + 32.624187 + ], + [ + -117.126467, + 32.536556 + ], + [ + -117.24696, + 32.668003 + ], + [ + -117.252437, + 32.876127 + ], + [ + -117.329114, + 33.122589 + ], + [ + -117.471515, + 33.297851 + ], + [ + -117.7837, + 33.538836 + ], + [ + -118.183517, + 33.763391 + ], + [ + -118.260194, + 33.703145 + ], + [ + -118.413548, + 33.741483 + ], + [ + -118.391641, + 33.840068 + ], + [ + -118.566903, + 34.042715 + ], + [ + -118.802411, + 33.998899 + ], + [ + -119.218659, + 34.146777 + ], + [ + -119.278905, + 34.26727 + ], + [ + -119.558229, + 34.415147 + ], + [ + -119.875891, + 34.40967 + ], + [ + -120.138784, + 34.475393 + ], + [ + -120.472878, + 34.448009 + ], + [ + -120.64814, + 34.579455 + ], + [ + -120.609801, + 34.858779 + ], + [ + -120.670048, + 34.902595 + ], + [ + -120.631709, + 35.099764 + ], + [ + -120.894602, + 35.247642 + ], + [ + -120.905556, + 35.450289 + ], + [ + -121.004141, + 35.461243 + ], + [ + -121.168449, + 35.636505 + ], + [ + -121.283465, + 35.674843 + ], + [ + -121.332757, + 35.784382 + ], + [ + -121.716143, + 36.195153 + ], + [ + -121.896882, + 36.315645 + ], + [ + -121.935221, + 36.638785 + ], + [ + -121.858544, + 36.6114 + ], + [ + -121.787344, + 36.803093 + ], + [ + -121.929744, + 36.978355 + ], + [ + -122.105006, + 36.956447 + ], + [ + -122.335038, + 37.115279 + ], + [ + -122.417192, + 37.241248 + ], + [ + -122.400761, + 37.361741 + ], + [ + -122.515777, + 37.520572 + ], + [ + -122.515777, + 37.783465 + ], + [ + -122.329561, + 37.783465 + ], + [ + -122.406238, + 38.15042 + ], + [ + -122.488392, + 38.112082 + ], + [ + -122.504823, + 37.931343 + ], + [ + -122.701993, + 37.893004 + ], + [ + -122.937501, + 38.029928 + ], + [ + -122.97584, + 38.265436 + ], + [ + -123.129194, + 38.451652 + ], + [ + -123.331841, + 38.566668 + ], + [ + -123.44138, + 38.698114 + ], + [ + -123.737134, + 38.95553 + ], + [ + -123.687842, + 39.032208 + ], + [ + -123.824765, + 39.366301 + ], + [ + -123.764519, + 39.552517 + ], + [ + -123.85215, + 39.831841 + ], + [ + -124.109566, + 40.105688 + ], + [ + -124.361506, + 40.259042 + ], + [ + -124.410798, + 40.439781 + ], + [ + -124.158859, + 40.877937 + ], + [ + -124.109566, + 41.025814 + ], + [ + -124.158859, + 41.14083 + ], + [ + -124.065751, + 41.442061 + ], + [ + -124.147905, + 41.715908 + ], + [ + -124.257444, + 41.781632 + ], + [ + -124.213628, + 42.000709 + ], + [ + -123.233256, + 42.006186 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "08", + "properties": { + "name": "Colorado" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -107.919731, + 41.003906 + ], + [ + -105.728954, + 40.998429 + ], + [ + -104.053011, + 41.003906 + ], + [ + -102.053927, + 41.003906 + ], + [ + -102.053927, + 40.001626 + ], + [ + -102.042974, + 36.994786 + ], + [ + -103.001438, + 37.000263 + ], + [ + -104.337812, + 36.994786 + ], + [ + -106.868158, + 36.994786 + ], + [ + -107.421329, + 37.000263 + ], + [ + -109.042503, + 37.000263 + ], + [ + -109.042503, + 38.166851 + ], + [ + -109.058934, + 38.27639 + ], + [ + -109.053457, + 39.125316 + ], + [ + -109.04798, + 40.998429 + ], + [ + -107.919731, + 41.003906 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "09", + "properties": { + "name": "Connecticut" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.053528, + 42.039048 + ], + [ + -71.799309, + 42.022617 + ], + [ + -71.799309, + 42.006186 + ], + [ + -71.799309, + 41.414677 + ], + [ + -71.859555, + 41.321569 + ], + [ + -71.947186, + 41.338 + ], + [ + -72.385341, + 41.261322 + ], + [ + -72.905651, + 41.28323 + ], + [ + -73.130205, + 41.146307 + ], + [ + -73.371191, + 41.102491 + ], + [ + -73.655992, + 40.987475 + ], + [ + -73.727192, + 41.102491 + ], + [ + -73.48073, + 41.21203 + ], + [ + -73.55193, + 41.294184 + ], + [ + -73.486206, + 42.050002 + ], + [ + -73.053528, + 42.039048 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "10", + "properties": { + "name": "Delaware" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -75.414089, + 39.804456 + ], + [ + -75.507197, + 39.683964 + ], + [ + -75.611259, + 39.61824 + ], + [ + -75.589352, + 39.459409 + ], + [ + -75.441474, + 39.311532 + ], + [ + -75.403136, + 39.065069 + ], + [ + -75.189535, + 38.807653 + ], + [ + -75.09095, + 38.796699 + ], + [ + -75.047134, + 38.451652 + ], + [ + -75.693413, + 38.462606 + ], + [ + -75.786521, + 39.722302 + ], + [ + -75.616736, + 39.831841 + ], + [ + -75.414089, + 39.804456 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "11", + "properties": { + "name": "District of Columbia" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -77.035264, + 38.993869 + ], + [ + -76.909294, + 38.895284 + ], + [ + -77.040741, + 38.791222 + ], + [ + -77.117418, + 38.933623 + ], + [ + -77.035264, + 38.993869 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "12", + "properties": { + "name": "Florida" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -85.497137, + 30.997536 + ], + [ + -85.004212, + 31.003013 + ], + [ + -84.867289, + 30.712735 + ], + [ + -83.498053, + 30.647012 + ], + [ + -82.216449, + 30.570335 + ], + [ + -82.167157, + 30.356734 + ], + [ + -82.046664, + 30.362211 + ], + [ + -82.002849, + 30.564858 + ], + [ + -82.041187, + 30.751074 + ], + [ + -81.948079, + 30.827751 + ], + [ + -81.718048, + 30.745597 + ], + [ + -81.444201, + 30.707258 + ], + [ + -81.383954, + 30.27458 + ], + [ + -81.257985, + 29.787132 + ], + [ + -80.967707, + 29.14633 + ], + [ + -80.524075, + 28.461713 + ], + [ + -80.589798, + 28.41242 + ], + [ + -80.56789, + 28.094758 + ], + [ + -80.381674, + 27.738757 + ], + [ + -80.091397, + 27.021277 + ], + [ + -80.03115, + 26.796723 + ], + [ + -80.036627, + 26.566691 + ], + [ + -80.146166, + 25.739673 + ], + [ + -80.239274, + 25.723243 + ], + [ + -80.337859, + 25.465826 + ], + [ + -80.304997, + 25.383672 + ], + [ + -80.49669, + 25.197456 + ], + [ + -80.573367, + 25.241272 + ], + [ + -80.759583, + 25.164595 + ], + [ + -81.077246, + 25.120779 + ], + [ + -81.170354, + 25.224841 + ], + [ + -81.126538, + 25.378195 + ], + [ + -81.351093, + 25.821827 + ], + [ + -81.526355, + 25.903982 + ], + [ + -81.679709, + 25.843735 + ], + [ + -81.800202, + 26.090198 + ], + [ + -81.833064, + 26.292844 + ], + [ + -82.041187, + 26.517399 + ], + [ + -82.09048, + 26.665276 + ], + [ + -82.057618, + 26.878877 + ], + [ + -82.172634, + 26.917216 + ], + [ + -82.145249, + 26.791246 + ], + [ + -82.249311, + 26.758384 + ], + [ + -82.566974, + 27.300601 + ], + [ + -82.692943, + 27.437525 + ], + [ + -82.391711, + 27.837342 + ], + [ + -82.588881, + 27.815434 + ], + [ + -82.720328, + 27.689464 + ], + [ + -82.851774, + 27.886634 + ], + [ + -82.676512, + 28.434328 + ], + [ + -82.643651, + 28.888914 + ], + [ + -82.764143, + 28.998453 + ], + [ + -82.802482, + 29.14633 + ], + [ + -82.994175, + 29.179192 + ], + [ + -83.218729, + 29.420177 + ], + [ + -83.399469, + 29.518762 + ], + [ + -83.410422, + 29.66664 + ], + [ + -83.536392, + 29.721409 + ], + [ + -83.640454, + 29.885717 + ], + [ + -84.02384, + 30.104795 + ], + [ + -84.357933, + 30.055502 + ], + [ + -84.341502, + 29.902148 + ], + [ + -84.451041, + 29.929533 + ], + [ + -84.867289, + 29.743317 + ], + [ + -85.310921, + 29.699501 + ], + [ + -85.299967, + 29.80904 + ], + [ + -85.404029, + 29.940487 + ], + [ + -85.924338, + 30.236241 + ], + [ + -86.29677, + 30.362211 + ], + [ + -86.630863, + 30.395073 + ], + [ + -86.910187, + 30.373165 + ], + [ + -87.518128, + 30.280057 + ], + [ + -87.37025, + 30.427934 + ], + [ + -87.446927, + 30.510088 + ], + [ + -87.408589, + 30.674397 + ], + [ + -87.633143, + 30.86609 + ], + [ + -87.600282, + 30.997536 + ], + [ + -85.497137, + 30.997536 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "13", + "properties": { + "name": "Georgia" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -83.109191, + 35.00118 + ], + [ + -83.322791, + 34.787579 + ], + [ + -83.339222, + 34.683517 + ], + [ + -83.005129, + 34.469916 + ], + [ + -82.901067, + 34.486347 + ], + [ + -82.747713, + 34.26727 + ], + [ + -82.714851, + 34.152254 + ], + [ + -82.55602, + 33.94413 + ], + [ + -82.325988, + 33.81816 + ], + [ + -82.194542, + 33.631944 + ], + [ + -81.926172, + 33.462159 + ], + [ + -81.937125, + 33.347144 + ], + [ + -81.761863, + 33.160928 + ], + [ + -81.493493, + 33.007573 + ], + [ + -81.42777, + 32.843265 + ], + [ + -81.416816, + 32.629664 + ], + [ + -81.279893, + 32.558464 + ], + [ + -81.121061, + 32.290094 + ], + [ + -81.115584, + 32.120309 + ], + [ + -80.885553, + 32.032678 + ], + [ + -81.132015, + 31.693108 + ], + [ + -81.175831, + 31.517845 + ], + [ + -81.279893, + 31.364491 + ], + [ + -81.290846, + 31.20566 + ], + [ + -81.400385, + 31.13446 + ], + [ + -81.444201, + 30.707258 + ], + [ + -81.718048, + 30.745597 + ], + [ + -81.948079, + 30.827751 + ], + [ + -82.041187, + 30.751074 + ], + [ + -82.002849, + 30.564858 + ], + [ + -82.046664, + 30.362211 + ], + [ + -82.167157, + 30.356734 + ], + [ + -82.216449, + 30.570335 + ], + [ + -83.498053, + 30.647012 + ], + [ + -84.867289, + 30.712735 + ], + [ + -85.004212, + 31.003013 + ], + [ + -85.113751, + 31.27686 + ], + [ + -85.042551, + 31.539753 + ], + [ + -85.141136, + 31.840985 + ], + [ + -85.053504, + 32.01077 + ], + [ + -85.058981, + 32.13674 + ], + [ + -84.889196, + 32.262709 + ], + [ + -85.004212, + 32.322956 + ], + [ + -84.960397, + 32.421541 + ], + [ + -85.069935, + 32.580372 + ], + [ + -85.184951, + 32.859696 + ], + [ + -85.431413, + 34.124869 + ], + [ + -85.606675, + 34.984749 + ], + [ + -84.319594, + 34.990226 + ], + [ + -83.618546, + 34.984749 + ], + [ + -83.109191, + 35.00118 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "15", + "properties": { + "name": "Hawaii" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -155.634835, + 18.948267 + ], + [ + -155.881297, + 19.035898 + ], + [ + -155.919636, + 19.123529 + ], + [ + -155.886774, + 19.348084 + ], + [ + -156.062036, + 19.73147 + ], + [ + -155.925113, + 19.857439 + ], + [ + -155.826528, + 20.032702 + ], + [ + -155.897728, + 20.147717 + ], + [ + -155.87582, + 20.26821 + ], + [ + -155.596496, + 20.12581 + ], + [ + -155.284311, + 20.021748 + ], + [ + -155.092618, + 19.868393 + ], + [ + -155.092618, + 19.736947 + ], + [ + -154.807817, + 19.523346 + ], + [ + -154.983079, + 19.348084 + ], + [ + -155.295265, + 19.26593 + ], + [ + -155.514342, + 19.134483 + ], + [ + -155.634835, + 18.948267 + ] + ] + ], + [ + [ + [ + -156.587823, + 21.029505 + ], + [ + -156.472807, + 20.892581 + ], + [ + -156.324929, + 20.952827 + ], + [ + -156.00179, + 20.793996 + ], + [ + -156.051082, + 20.651596 + ], + [ + -156.379699, + 20.580396 + ], + [ + -156.445422, + 20.60778 + ], + [ + -156.461853, + 20.783042 + ], + [ + -156.631638, + 20.821381 + ], + [ + -156.697361, + 20.919966 + ], + [ + -156.587823, + 21.029505 + ] + ] + ], + [ + [ + [ + -156.982162, + 21.210244 + ], + [ + -157.080747, + 21.106182 + ], + [ + -157.310779, + 21.106182 + ], + [ + -157.239579, + 21.221198 + ], + [ + -156.982162, + 21.210244 + ] + ] + ], + [ + [ + [ + -157.951581, + 21.697691 + ], + [ + -157.842042, + 21.462183 + ], + [ + -157.896811, + 21.325259 + ], + [ + -158.110412, + 21.303352 + ], + [ + -158.252813, + 21.582676 + ], + [ + -158.126843, + 21.588153 + ], + [ + -157.951581, + 21.697691 + ] + ] + ], + [ + [ + [ + -159.468693, + 22.228955 + ], + [ + -159.353678, + 22.218001 + ], + [ + -159.298908, + 22.113939 + ], + [ + -159.33177, + 21.966061 + ], + [ + -159.446786, + 21.872953 + ], + [ + -159.764448, + 21.987969 + ], + [ + -159.726109, + 22.152277 + ], + [ + -159.468693, + 22.228955 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "16", + "properties": { + "name": "Idaho" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -116.04751, + 49.000239 + ], + [ + -116.04751, + 47.976051 + ], + [ + -115.724371, + 47.696727 + ], + [ + -115.718894, + 47.42288 + ], + [ + -115.527201, + 47.302388 + ], + [ + -115.324554, + 47.258572 + ], + [ + -115.302646, + 47.187372 + ], + [ + -114.930214, + 46.919002 + ], + [ + -114.886399, + 46.809463 + ], + [ + -114.623506, + 46.705401 + ], + [ + -114.612552, + 46.639678 + ], + [ + -114.322274, + 46.645155 + ], + [ + -114.464674, + 46.272723 + ], + [ + -114.492059, + 46.037214 + ], + [ + -114.387997, + 45.88386 + ], + [ + -114.568736, + 45.774321 + ], + [ + -114.497536, + 45.670259 + ], + [ + -114.546828, + 45.560721 + ], + [ + -114.333228, + 45.456659 + ], + [ + -114.086765, + 45.593582 + ], + [ + -113.98818, + 45.703121 + ], + [ + -113.807441, + 45.604536 + ], + [ + -113.834826, + 45.522382 + ], + [ + -113.736241, + 45.330689 + ], + [ + -113.571933, + 45.128042 + ], + [ + -113.45144, + 45.056842 + ], + [ + -113.456917, + 44.865149 + ], + [ + -113.341901, + 44.782995 + ], + [ + -113.133778, + 44.772041 + ], + [ + -113.002331, + 44.448902 + ], + [ + -112.887315, + 44.394132 + ], + [ + -112.783254, + 44.48724 + ], + [ + -112.471068, + 44.481763 + ], + [ + -112.241036, + 44.569394 + ], + [ + -112.104113, + 44.520102 + ], + [ + -111.868605, + 44.563917 + ], + [ + -111.819312, + 44.509148 + ], + [ + -111.616665, + 44.547487 + ], + [ + -111.386634, + 44.75561 + ], + [ + -111.227803, + 44.580348 + ], + [ + -111.047063, + 44.476286 + ], + [ + -111.047063, + 42.000709 + ], + [ + -112.164359, + 41.995232 + ], + [ + -114.04295, + 41.995232 + ], + [ + -117.027882, + 42.000709 + ], + [ + -117.027882, + 43.830007 + ], + [ + -116.896436, + 44.158624 + ], + [ + -116.97859, + 44.240778 + ], + [ + -117.170283, + 44.257209 + ], + [ + -117.241483, + 44.394132 + ], + [ + -117.038836, + 44.750133 + ], + [ + -116.934774, + 44.782995 + ], + [ + -116.830713, + 44.930872 + ], + [ + -116.847143, + 45.02398 + ], + [ + -116.732128, + 45.144473 + ], + [ + -116.671881, + 45.319735 + ], + [ + -116.463758, + 45.61549 + ], + [ + -116.545912, + 45.752413 + ], + [ + -116.78142, + 45.823614 + ], + [ + -116.918344, + 45.993399 + ], + [ + -116.92382, + 46.168661 + ], + [ + -117.055267, + 46.343923 + ], + [ + -117.038836, + 46.426077 + ], + [ + -117.044313, + 47.762451 + ], + [ + -117.033359, + 49.000239 + ], + [ + -116.04751, + 49.000239 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "17", + "properties": { + "name": "Illinois" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -90.639984, + 42.510065 + ], + [ + -88.788778, + 42.493634 + ], + [ + -87.802929, + 42.493634 + ], + [ + -87.83579, + 42.301941 + ], + [ + -87.682436, + 42.077386 + ], + [ + -87.523605, + 41.710431 + ], + [ + -87.529082, + 39.34987 + ], + [ + -87.63862, + 39.169131 + ], + [ + -87.512651, + 38.95553 + ], + [ + -87.49622, + 38.780268 + ], + [ + -87.62219, + 38.637868 + ], + [ + -87.655051, + 38.506421 + ], + [ + -87.83579, + 38.292821 + ], + [ + -87.950806, + 38.27639 + ], + [ + -87.923421, + 38.15042 + ], + [ + -88.000098, + 38.101128 + ], + [ + -88.060345, + 37.865619 + ], + [ + -88.027483, + 37.799896 + ], + [ + -88.15893, + 37.657496 + ], + [ + -88.065822, + 37.482234 + ], + [ + -88.476592, + 37.389126 + ], + [ + -88.514931, + 37.285064 + ], + [ + -88.421823, + 37.153617 + ], + [ + -88.547792, + 37.071463 + ], + [ + -88.914747, + 37.224817 + ], + [ + -89.029763, + 37.213863 + ], + [ + -89.183118, + 37.038601 + ], + [ + -89.133825, + 36.983832 + ], + [ + -89.292656, + 36.994786 + ], + [ + -89.517211, + 37.279587 + ], + [ + -89.435057, + 37.34531 + ], + [ + -89.517211, + 37.537003 + ], + [ + -89.517211, + 37.690357 + ], + [ + -89.84035, + 37.903958 + ], + [ + -89.949889, + 37.88205 + ], + [ + -90.059428, + 38.013497 + ], + [ + -90.355183, + 38.216144 + ], + [ + -90.349706, + 38.374975 + ], + [ + -90.179921, + 38.632391 + ], + [ + -90.207305, + 38.725499 + ], + [ + -90.10872, + 38.845992 + ], + [ + -90.251121, + 38.917192 + ], + [ + -90.470199, + 38.961007 + ], + [ + -90.585214, + 38.867899 + ], + [ + -90.661891, + 38.928146 + ], + [ + -90.727615, + 39.256762 + ], + [ + -91.061708, + 39.470363 + ], + [ + -91.368417, + 39.727779 + ], + [ + -91.494386, + 40.034488 + ], + [ + -91.50534, + 40.237135 + ], + [ + -91.417709, + 40.379535 + ], + [ + -91.401278, + 40.560274 + ], + [ + -91.121954, + 40.669813 + ], + [ + -91.09457, + 40.823167 + ], + [ + -90.963123, + 40.921752 + ], + [ + -90.946692, + 41.097014 + ], + [ + -91.111001, + 41.239415 + ], + [ + -91.045277, + 41.414677 + ], + [ + -90.656414, + 41.463969 + ], + [ + -90.344229, + 41.589939 + ], + [ + -90.311367, + 41.743293 + ], + [ + -90.179921, + 41.809016 + ], + [ + -90.141582, + 42.000709 + ], + [ + -90.168967, + 42.126679 + ], + [ + -90.393521, + 42.225264 + ], + [ + -90.420906, + 42.329326 + ], + [ + -90.639984, + 42.510065 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "18", + "properties": { + "name": "Indiana" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -85.990061, + 41.759724 + ], + [ + -84.807042, + 41.759724 + ], + [ + -84.807042, + 41.694001 + ], + [ + -84.801565, + 40.500028 + ], + [ + -84.817996, + 39.103408 + ], + [ + -84.894673, + 39.059592 + ], + [ + -84.812519, + 38.785745 + ], + [ + -84.987781, + 38.780268 + ], + [ + -85.173997, + 38.68716 + ], + [ + -85.431413, + 38.730976 + ], + [ + -85.42046, + 38.533806 + ], + [ + -85.590245, + 38.451652 + ], + [ + -85.655968, + 38.325682 + ], + [ + -85.83123, + 38.27639 + ], + [ + -85.924338, + 38.024451 + ], + [ + -86.039354, + 37.958727 + ], + [ + -86.263908, + 38.051835 + ], + [ + -86.302247, + 38.166851 + ], + [ + -86.521325, + 38.040881 + ], + [ + -86.504894, + 37.931343 + ], + [ + -86.729448, + 37.893004 + ], + [ + -86.795172, + 37.991589 + ], + [ + -87.047111, + 37.893004 + ], + [ + -87.129265, + 37.788942 + ], + [ + -87.381204, + 37.93682 + ], + [ + -87.512651, + 37.903958 + ], + [ + -87.600282, + 37.975158 + ], + [ + -87.682436, + 37.903958 + ], + [ + -87.934375, + 37.893004 + ], + [ + -88.027483, + 37.799896 + ], + [ + -88.060345, + 37.865619 + ], + [ + -88.000098, + 38.101128 + ], + [ + -87.923421, + 38.15042 + ], + [ + -87.950806, + 38.27639 + ], + [ + -87.83579, + 38.292821 + ], + [ + -87.655051, + 38.506421 + ], + [ + -87.62219, + 38.637868 + ], + [ + -87.49622, + 38.780268 + ], + [ + -87.512651, + 38.95553 + ], + [ + -87.63862, + 39.169131 + ], + [ + -87.529082, + 39.34987 + ], + [ + -87.523605, + 41.710431 + ], + [ + -87.42502, + 41.644708 + ], + [ + -87.118311, + 41.644708 + ], + [ + -86.822556, + 41.759724 + ], + [ + -85.990061, + 41.759724 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "19", + "properties": { + "name": "Iowa" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -91.368417, + 43.501391 + ], + [ + -91.215062, + 43.501391 + ], + [ + -91.204109, + 43.353514 + ], + [ + -91.056231, + 43.254929 + ], + [ + -91.176724, + 43.134436 + ], + [ + -91.143862, + 42.909881 + ], + [ + -91.067185, + 42.75105 + ], + [ + -90.711184, + 42.636034 + ], + [ + -90.639984, + 42.510065 + ], + [ + -90.420906, + 42.329326 + ], + [ + -90.393521, + 42.225264 + ], + [ + -90.168967, + 42.126679 + ], + [ + -90.141582, + 42.000709 + ], + [ + -90.179921, + 41.809016 + ], + [ + -90.311367, + 41.743293 + ], + [ + -90.344229, + 41.589939 + ], + [ + -90.656414, + 41.463969 + ], + [ + -91.045277, + 41.414677 + ], + [ + -91.111001, + 41.239415 + ], + [ + -90.946692, + 41.097014 + ], + [ + -90.963123, + 40.921752 + ], + [ + -91.09457, + 40.823167 + ], + [ + -91.121954, + 40.669813 + ], + [ + -91.401278, + 40.560274 + ], + [ + -91.417709, + 40.379535 + ], + [ + -91.527248, + 40.412397 + ], + [ + -91.729895, + 40.615043 + ], + [ + -91.833957, + 40.609566 + ], + [ + -93.257961, + 40.582182 + ], + [ + -94.632673, + 40.571228 + ], + [ + -95.7664, + 40.587659 + ], + [ + -95.881416, + 40.719105 + ], + [ + -95.826646, + 40.976521 + ], + [ + -95.925231, + 41.201076 + ], + [ + -95.919754, + 41.453015 + ], + [ + -96.095016, + 41.540646 + ], + [ + -96.122401, + 41.67757 + ], + [ + -96.062155, + 41.798063 + ], + [ + -96.127878, + 41.973325 + ], + [ + -96.264801, + 42.039048 + ], + [ + -96.44554, + 42.488157 + ], + [ + -96.631756, + 42.707235 + ], + [ + -96.544125, + 42.855112 + ], + [ + -96.511264, + 43.052282 + ], + [ + -96.434587, + 43.123482 + ], + [ + -96.560556, + 43.222067 + ], + [ + -96.527695, + 43.397329 + ], + [ + -96.582464, + 43.479483 + ], + [ + -96.451017, + 43.501391 + ], + [ + -91.368417, + 43.501391 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "20", + "properties": { + "name": "Kansas" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -101.90605, + 40.001626 + ], + [ + -95.306337, + 40.001626 + ], + [ + -95.207752, + 39.908518 + ], + [ + -94.884612, + 39.831841 + ], + [ + -95.109167, + 39.541563 + ], + [ + -94.983197, + 39.442978 + ], + [ + -94.824366, + 39.20747 + ], + [ + -94.610765, + 39.158177 + ], + [ + -94.616242, + 37.000263 + ], + [ + -100.087706, + 37.000263 + ], + [ + -102.042974, + 36.994786 + ], + [ + -102.053927, + 40.001626 + ], + [ + -101.90605, + 40.001626 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "21", + "properties": { + "name": "Kentucky" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -83.903347, + 38.769315 + ], + [ + -83.678792, + 38.632391 + ], + [ + -83.519961, + 38.703591 + ], + [ + -83.142052, + 38.626914 + ], + [ + -83.032514, + 38.725499 + ], + [ + -82.890113, + 38.758361 + ], + [ + -82.846298, + 38.588575 + ], + [ + -82.731282, + 38.561191 + ], + [ + -82.594358, + 38.424267 + ], + [ + -82.621743, + 38.123036 + ], + [ + -82.50125, + 37.931343 + ], + [ + -82.342419, + 37.783465 + ], + [ + -82.293127, + 37.668449 + ], + [ + -82.101434, + 37.553434 + ], + [ + -81.969987, + 37.537003 + ], + [ + -82.353373, + 37.268633 + ], + [ + -82.720328, + 37.120755 + ], + [ + -82.720328, + 37.044078 + ], + [ + -82.868205, + 36.978355 + ], + [ + -82.879159, + 36.890724 + ], + [ + -83.070852, + 36.852385 + ], + [ + -83.136575, + 36.742847 + ], + [ + -83.673316, + 36.600446 + ], + [ + -83.689746, + 36.584015 + ], + [ + -84.544149, + 36.594969 + ], + [ + -85.289013, + 36.627831 + ], + [ + -85.486183, + 36.616877 + ], + [ + -86.592525, + 36.655216 + ], + [ + -87.852221, + 36.633308 + ], + [ + -88.071299, + 36.677123 + ], + [ + -88.054868, + 36.496384 + ], + [ + -89.298133, + 36.507338 + ], + [ + -89.418626, + 36.496384 + ], + [ + -89.363857, + 36.622354 + ], + [ + -89.215979, + 36.578538 + ], + [ + -89.133825, + 36.983832 + ], + [ + -89.183118, + 37.038601 + ], + [ + -89.029763, + 37.213863 + ], + [ + -88.914747, + 37.224817 + ], + [ + -88.547792, + 37.071463 + ], + [ + -88.421823, + 37.153617 + ], + [ + -88.514931, + 37.285064 + ], + [ + -88.476592, + 37.389126 + ], + [ + -88.065822, + 37.482234 + ], + [ + -88.15893, + 37.657496 + ], + [ + -88.027483, + 37.799896 + ], + [ + -87.934375, + 37.893004 + ], + [ + -87.682436, + 37.903958 + ], + [ + -87.600282, + 37.975158 + ], + [ + -87.512651, + 37.903958 + ], + [ + -87.381204, + 37.93682 + ], + [ + -87.129265, + 37.788942 + ], + [ + -87.047111, + 37.893004 + ], + [ + -86.795172, + 37.991589 + ], + [ + -86.729448, + 37.893004 + ], + [ + -86.504894, + 37.931343 + ], + [ + -86.521325, + 38.040881 + ], + [ + -86.302247, + 38.166851 + ], + [ + -86.263908, + 38.051835 + ], + [ + -86.039354, + 37.958727 + ], + [ + -85.924338, + 38.024451 + ], + [ + -85.83123, + 38.27639 + ], + [ + -85.655968, + 38.325682 + ], + [ + -85.590245, + 38.451652 + ], + [ + -85.42046, + 38.533806 + ], + [ + -85.431413, + 38.730976 + ], + [ + -85.173997, + 38.68716 + ], + [ + -84.987781, + 38.780268 + ], + [ + -84.812519, + 38.785745 + ], + [ + -84.894673, + 39.059592 + ], + [ + -84.817996, + 39.103408 + ], + [ + -84.43461, + 39.103408 + ], + [ + -84.231963, + 38.895284 + ], + [ + -84.215533, + 38.807653 + ], + [ + -83.903347, + 38.769315 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "22", + "properties": { + "name": "Louisiana" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -93.608485, + 33.018527 + ], + [ + -91.16577, + 33.002096 + ], + [ + -91.072662, + 32.887081 + ], + [ + -91.143862, + 32.843265 + ], + [ + -91.154816, + 32.640618 + ], + [ + -91.006939, + 32.514649 + ], + [ + -90.985031, + 32.218894 + ], + [ + -91.105524, + 31.988862 + ], + [ + -91.341032, + 31.846462 + ], + [ + -91.401278, + 31.621907 + ], + [ + -91.499863, + 31.643815 + ], + [ + -91.516294, + 31.27686 + ], + [ + -91.636787, + 31.265906 + ], + [ + -91.565587, + 31.068736 + ], + [ + -91.636787, + 30.997536 + ], + [ + -89.747242, + 30.997536 + ], + [ + -89.845827, + 30.66892 + ], + [ + -89.681519, + 30.449842 + ], + [ + -89.643181, + 30.285534 + ], + [ + -89.522688, + 30.181472 + ], + [ + -89.818443, + 30.044549 + ], + [ + -89.84035, + 29.945964 + ], + [ + -89.599365, + 29.88024 + ], + [ + -89.495303, + 30.039072 + ], + [ + -89.287179, + 29.88024 + ], + [ + -89.30361, + 29.754271 + ], + [ + -89.424103, + 29.699501 + ], + [ + -89.648657, + 29.748794 + ], + [ + -89.621273, + 29.655686 + ], + [ + -89.69795, + 29.513285 + ], + [ + -89.506257, + 29.387316 + ], + [ + -89.199548, + 29.348977 + ], + [ + -89.09001, + 29.2011 + ], + [ + -89.002379, + 29.179192 + ], + [ + -89.16121, + 29.009407 + ], + [ + -89.336472, + 29.042268 + ], + [ + -89.484349, + 29.217531 + ], + [ + -89.851304, + 29.310638 + ], + [ + -89.851304, + 29.480424 + ], + [ + -90.032043, + 29.425654 + ], + [ + -90.021089, + 29.283254 + ], + [ + -90.103244, + 29.151807 + ], + [ + -90.23469, + 29.129899 + ], + [ + -90.333275, + 29.277777 + ], + [ + -90.563307, + 29.283254 + ], + [ + -90.645461, + 29.129899 + ], + [ + -90.798815, + 29.086084 + ], + [ + -90.963123, + 29.179192 + ], + [ + -91.09457, + 29.190146 + ], + [ + -91.220539, + 29.436608 + ], + [ + -91.445094, + 29.546147 + ], + [ + -91.532725, + 29.529716 + ], + [ + -91.620356, + 29.73784 + ], + [ + -91.883249, + 29.710455 + ], + [ + -91.888726, + 29.836425 + ], + [ + -92.146142, + 29.715932 + ], + [ + -92.113281, + 29.622824 + ], + [ + -92.31045, + 29.535193 + ], + [ + -92.617159, + 29.579009 + ], + [ + -92.97316, + 29.715932 + ], + [ + -93.2251, + 29.776178 + ], + [ + -93.767317, + 29.726886 + ], + [ + -93.838517, + 29.688547 + ], + [ + -93.926148, + 29.787132 + ], + [ + -93.690639, + 30.143133 + ], + [ + -93.767317, + 30.334826 + ], + [ + -93.696116, + 30.438888 + ], + [ + -93.728978, + 30.575812 + ], + [ + -93.630393, + 30.679874 + ], + [ + -93.526331, + 30.93729 + ], + [ + -93.542762, + 31.15089 + ], + [ + -93.816609, + 31.556184 + ], + [ + -93.822086, + 31.775262 + ], + [ + -94.041164, + 31.994339 + ], + [ + -94.041164, + 33.018527 + ], + [ + -93.608485, + 33.018527 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "23", + "properties": { + "name": "Maine" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -70.703921, + 43.057759 + ], + [ + -70.824413, + 43.128959 + ], + [ + -70.807983, + 43.227544 + ], + [ + -70.966814, + 43.34256 + ], + [ + -71.032537, + 44.657025 + ], + [ + -71.08183, + 45.303304 + ], + [ + -70.649151, + 45.440228 + ], + [ + -70.720352, + 45.511428 + ], + [ + -70.556043, + 45.664782 + ], + [ + -70.386258, + 45.735983 + ], + [ + -70.41912, + 45.796229 + ], + [ + -70.260289, + 45.889337 + ], + [ + -70.309581, + 46.064599 + ], + [ + -70.210996, + 46.327492 + ], + [ + -70.057642, + 46.415123 + ], + [ + -69.997395, + 46.694447 + ], + [ + -69.225147, + 47.461219 + ], + [ + -69.044408, + 47.428357 + ], + [ + -69.033454, + 47.242141 + ], + [ + -68.902007, + 47.176418 + ], + [ + -68.578868, + 47.285957 + ], + [ + -68.376221, + 47.285957 + ], + [ + -68.233821, + 47.357157 + ], + [ + -67.954497, + 47.198326 + ], + [ + -67.790188, + 47.066879 + ], + [ + -67.779235, + 45.944106 + ], + [ + -67.801142, + 45.675736 + ], + [ + -67.456095, + 45.604536 + ], + [ + -67.505388, + 45.48952 + ], + [ + -67.417757, + 45.379982 + ], + [ + -67.488957, + 45.281397 + ], + [ + -67.346556, + 45.128042 + ], + [ + -67.16034, + 45.160904 + ], + [ + -66.979601, + 44.804903 + ], + [ + -67.187725, + 44.646072 + ], + [ + -67.308218, + 44.706318 + ], + [ + -67.406803, + 44.596779 + ], + [ + -67.549203, + 44.624164 + ], + [ + -67.565634, + 44.531056 + ], + [ + -67.75185, + 44.54201 + ], + [ + -68.047605, + 44.328409 + ], + [ + -68.118805, + 44.476286 + ], + [ + -68.222867, + 44.48724 + ], + [ + -68.173574, + 44.328409 + ], + [ + -68.403606, + 44.251732 + ], + [ + -68.458375, + 44.377701 + ], + [ + -68.567914, + 44.311978 + ], + [ + -68.82533, + 44.311978 + ], + [ + -68.830807, + 44.459856 + ], + [ + -68.984161, + 44.426994 + ], + [ + -68.956777, + 44.322932 + ], + [ + -69.099177, + 44.103854 + ], + [ + -69.071793, + 44.043608 + ], + [ + -69.258008, + 43.923115 + ], + [ + -69.444224, + 43.966931 + ], + [ + -69.553763, + 43.840961 + ], + [ + -69.707118, + 43.82453 + ], + [ + -69.833087, + 43.720469 + ], + [ + -69.986442, + 43.742376 + ], + [ + -70.030257, + 43.851915 + ], + [ + -70.254812, + 43.676653 + ], + [ + -70.194565, + 43.567114 + ], + [ + -70.358873, + 43.528776 + ], + [ + -70.369827, + 43.435668 + ], + [ + -70.556043, + 43.320652 + ], + [ + -70.703921, + 43.057759 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "24", + "properties": { + "name": "Maryland" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -75.994645, + 37.95325 + ], + [ + -76.016553, + 37.95325 + ], + [ + -76.043938, + 37.95325 + ], + [ + -75.994645, + 37.95325 + ] + ] + ], + [ + [ + [ + -79.477979, + 39.722302 + ], + [ + -75.786521, + 39.722302 + ], + [ + -75.693413, + 38.462606 + ], + [ + -75.047134, + 38.451652 + ], + [ + -75.244304, + 38.029928 + ], + [ + -75.397659, + 38.013497 + ], + [ + -75.671506, + 37.95325 + ], + [ + -75.885106, + 37.909435 + ], + [ + -75.879629, + 38.073743 + ], + [ + -75.961783, + 38.139466 + ], + [ + -75.846768, + 38.210667 + ], + [ + -76.000122, + 38.374975 + ], + [ + -76.049415, + 38.303775 + ], + [ + -76.257538, + 38.320205 + ], + [ + -76.328738, + 38.500944 + ], + [ + -76.263015, + 38.500944 + ], + [ + -76.257538, + 38.736453 + ], + [ + -76.191815, + 38.829561 + ], + [ + -76.279446, + 39.147223 + ], + [ + -76.169907, + 39.333439 + ], + [ + -76.000122, + 39.366301 + ], + [ + -75.972737, + 39.557994 + ], + [ + -76.098707, + 39.536086 + ], + [ + -76.104184, + 39.437501 + ], + [ + -76.367077, + 39.311532 + ], + [ + -76.443754, + 39.196516 + ], + [ + -76.460185, + 38.906238 + ], + [ + -76.55877, + 38.769315 + ], + [ + -76.514954, + 38.539283 + ], + [ + -76.383508, + 38.380452 + ], + [ + -76.399939, + 38.259959 + ], + [ + -76.317785, + 38.139466 + ], + [ + -76.3616, + 38.057312 + ], + [ + -76.591632, + 38.216144 + ], + [ + -76.920248, + 38.292821 + ], + [ + -77.018833, + 38.446175 + ], + [ + -77.205049, + 38.358544 + ], + [ + -77.276249, + 38.479037 + ], + [ + -77.128372, + 38.632391 + ], + [ + -77.040741, + 38.791222 + ], + [ + -76.909294, + 38.895284 + ], + [ + -77.035264, + 38.993869 + ], + [ + -77.117418, + 38.933623 + ], + [ + -77.248864, + 39.026731 + ], + [ + -77.456988, + 39.076023 + ], + [ + -77.456988, + 39.223901 + ], + [ + -77.566527, + 39.306055 + ], + [ + -77.719881, + 39.322485 + ], + [ + -77.834897, + 39.601809 + ], + [ + -78.004682, + 39.601809 + ], + [ + -78.174467, + 39.694917 + ], + [ + -78.267575, + 39.61824 + ], + [ + -78.431884, + 39.623717 + ], + [ + -78.470222, + 39.514178 + ], + [ + -78.765977, + 39.585379 + ], + [ + -78.963147, + 39.437501 + ], + [ + -79.094593, + 39.470363 + ], + [ + -79.291763, + 39.300578 + ], + [ + -79.488933, + 39.20747 + ], + [ + -79.477979, + 39.722302 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "25", + "properties": { + "name": "Massachusetts" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -70.917521, + 42.887974 + ], + [ + -70.818936, + 42.871543 + ], + [ + -70.780598, + 42.696281 + ], + [ + -70.824413, + 42.55388 + ], + [ + -70.983245, + 42.422434 + ], + [ + -70.988722, + 42.269079 + ], + [ + -70.769644, + 42.247172 + ], + [ + -70.638197, + 42.08834 + ], + [ + -70.660105, + 41.962371 + ], + [ + -70.550566, + 41.929509 + ], + [ + -70.539613, + 41.814493 + ], + [ + -70.260289, + 41.715908 + ], + [ + -69.937149, + 41.809016 + ], + [ + -70.008349, + 41.672093 + ], + [ + -70.484843, + 41.5516 + ], + [ + -70.660105, + 41.546123 + ], + [ + -70.764167, + 41.639231 + ], + [ + -70.928475, + 41.611847 + ], + [ + -70.933952, + 41.540646 + ], + [ + -71.120168, + 41.496831 + ], + [ + -71.196845, + 41.67757 + ], + [ + -71.22423, + 41.710431 + ], + [ + -71.328292, + 41.781632 + ], + [ + -71.383061, + 42.01714 + ], + [ + -71.530939, + 42.01714 + ], + [ + -71.799309, + 42.006186 + ], + [ + -71.799309, + 42.022617 + ], + [ + -73.053528, + 42.039048 + ], + [ + -73.486206, + 42.050002 + ], + [ + -73.508114, + 42.08834 + ], + [ + -73.267129, + 42.745573 + ], + [ + -72.456542, + 42.729142 + ], + [ + -71.29543, + 42.696281 + ], + [ + -71.185891, + 42.789389 + ], + [ + -70.917521, + 42.887974 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "26", + "properties": { + "name": "Michigan" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -83.454238, + 41.732339 + ], + [ + -84.807042, + 41.694001 + ], + [ + -84.807042, + 41.759724 + ], + [ + -85.990061, + 41.759724 + ], + [ + -86.822556, + 41.759724 + ], + [ + -86.619909, + 41.891171 + ], + [ + -86.482986, + 42.115725 + ], + [ + -86.357016, + 42.252649 + ], + [ + -86.263908, + 42.444341 + ], + [ + -86.209139, + 42.718189 + ], + [ + -86.231047, + 43.013943 + ], + [ + -86.526801, + 43.594499 + ], + [ + -86.433693, + 43.813577 + ], + [ + -86.499417, + 44.07647 + ], + [ + -86.269385, + 44.34484 + ], + [ + -86.220093, + 44.569394 + ], + [ + -86.252954, + 44.689887 + ], + [ + -86.088646, + 44.73918 + ], + [ + -86.066738, + 44.903488 + ], + [ + -85.809322, + 44.947303 + ], + [ + -85.612152, + 45.128042 + ], + [ + -85.628583, + 44.766564 + ], + [ + -85.524521, + 44.750133 + ], + [ + -85.393075, + 44.930872 + ], + [ + -85.387598, + 45.237581 + ], + [ + -85.305444, + 45.314258 + ], + [ + -85.031597, + 45.363551 + ], + [ + -85.119228, + 45.577151 + ], + [ + -84.938489, + 45.75789 + ], + [ + -84.713934, + 45.768844 + ], + [ + -84.461995, + 45.653829 + ], + [ + -84.215533, + 45.637398 + ], + [ + -84.09504, + 45.494997 + ], + [ + -83.908824, + 45.484043 + ], + [ + -83.596638, + 45.352597 + ], + [ + -83.4871, + 45.358074 + ], + [ + -83.317314, + 45.144473 + ], + [ + -83.454238, + 45.029457 + ], + [ + -83.322791, + 44.88158 + ], + [ + -83.273499, + 44.711795 + ], + [ + -83.333745, + 44.339363 + ], + [ + -83.536392, + 44.246255 + ], + [ + -83.585684, + 44.054562 + ], + [ + -83.82667, + 43.988839 + ], + [ + -83.958116, + 43.758807 + ], + [ + -83.908824, + 43.671176 + ], + [ + -83.667839, + 43.589022 + ], + [ + -83.481623, + 43.714992 + ], + [ + -83.262545, + 43.972408 + ], + [ + -82.917498, + 44.070993 + ], + [ + -82.747713, + 43.994316 + ], + [ + -82.643651, + 43.851915 + ], + [ + -82.539589, + 43.435668 + ], + [ + -82.523158, + 43.227544 + ], + [ + -82.413619, + 42.975605 + ], + [ + -82.517681, + 42.614127 + ], + [ + -82.681989, + 42.559357 + ], + [ + -82.687466, + 42.690804 + ], + [ + -82.797005, + 42.652465 + ], + [ + -82.922975, + 42.351234 + ], + [ + -83.125621, + 42.236218 + ], + [ + -83.185868, + 42.006186 + ], + [ + -83.437807, + 41.814493 + ], + [ + -83.454238, + 41.732339 + ] + ] + ], + [ + [ + [ + -85.508091, + 45.730506 + ], + [ + -85.49166, + 45.610013 + ], + [ + -85.623106, + 45.588105 + ], + [ + -85.568337, + 45.75789 + ], + [ + -85.508091, + 45.730506 + ] + ] + ], + [ + [ + [ + -87.589328, + 45.095181 + ], + [ + -87.742682, + 45.199243 + ], + [ + -87.649574, + 45.341643 + ], + [ + -87.885083, + 45.363551 + ], + [ + -87.791975, + 45.500474 + ], + [ + -87.781021, + 45.675736 + ], + [ + -87.989145, + 45.796229 + ], + [ + -88.10416, + 45.922199 + ], + [ + -88.531362, + 46.020784 + ], + [ + -88.662808, + 45.987922 + ], + [ + -89.09001, + 46.135799 + ], + [ + -90.119674, + 46.338446 + ], + [ + -90.229213, + 46.508231 + ], + [ + -90.415429, + 46.568478 + ], + [ + -90.026566, + 46.672539 + ], + [ + -89.851304, + 46.793032 + ], + [ + -89.413149, + 46.842325 + ], + [ + -89.128348, + 46.990202 + ], + [ + -88.996902, + 46.995679 + ], + [ + -88.887363, + 47.099741 + ], + [ + -88.575177, + 47.247618 + ], + [ + -88.416346, + 47.373588 + ], + [ + -88.180837, + 47.455742 + ], + [ + -87.956283, + 47.384542 + ], + [ + -88.350623, + 47.077833 + ], + [ + -88.443731, + 46.973771 + ], + [ + -88.438254, + 46.787555 + ], + [ + -88.246561, + 46.929956 + ], + [ + -87.901513, + 46.908048 + ], + [ + -87.633143, + 46.809463 + ], + [ + -87.392158, + 46.535616 + ], + [ + -87.260711, + 46.486323 + ], + [ + -87.008772, + 46.530139 + ], + [ + -86.948526, + 46.469893 + ], + [ + -86.696587, + 46.437031 + ], + [ + -86.159846, + 46.667063 + ], + [ + -85.880522, + 46.68897 + ], + [ + -85.508091, + 46.678016 + ], + [ + -85.256151, + 46.754694 + ], + [ + -85.064458, + 46.760171 + ], + [ + -85.02612, + 46.480847 + ], + [ + -84.82895, + 46.442508 + ], + [ + -84.63178, + 46.486323 + ], + [ + -84.549626, + 46.4206 + ], + [ + -84.418179, + 46.502754 + ], + [ + -84.127902, + 46.530139 + ], + [ + -84.122425, + 46.179615 + ], + [ + -83.990978, + 46.031737 + ], + [ + -83.793808, + 45.993399 + ], + [ + -83.7719, + 46.091984 + ], + [ + -83.580208, + 46.091984 + ], + [ + -83.476146, + 45.987922 + ], + [ + -83.563777, + 45.911245 + ], + [ + -84.111471, + 45.976968 + ], + [ + -84.374364, + 45.933153 + ], + [ + -84.659165, + 46.053645 + ], + [ + -84.741319, + 45.944106 + ], + [ + -84.70298, + 45.850998 + ], + [ + -84.82895, + 45.872906 + ], + [ + -85.015166, + 46.00983 + ], + [ + -85.338305, + 46.091984 + ], + [ + -85.502614, + 46.097461 + ], + [ + -85.661445, + 45.966014 + ], + [ + -85.924338, + 45.933153 + ], + [ + -86.209139, + 45.960537 + ], + [ + -86.324155, + 45.905768 + ], + [ + -86.351539, + 45.796229 + ], + [ + -86.663725, + 45.703121 + ], + [ + -86.647294, + 45.834568 + ], + [ + -86.784218, + 45.861952 + ], + [ + -86.838987, + 45.725029 + ], + [ + -87.069019, + 45.719552 + ], + [ + -87.17308, + 45.659305 + ], + [ + -87.326435, + 45.423797 + ], + [ + -87.611236, + 45.122565 + ], + [ + -87.589328, + 45.095181 + ] + ] + ], + [ + [ + [ + -88.805209, + 47.976051 + ], + [ + -89.057148, + 47.850082 + ], + [ + -89.188594, + 47.833651 + ], + [ + -89.177641, + 47.937713 + ], + [ + -88.547792, + 48.173221 + ], + [ + -88.668285, + 48.008913 + ], + [ + -88.805209, + 47.976051 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "27", + "properties": { + "name": "Minnesota" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -92.014696, + 46.705401 + ], + [ + -92.091373, + 46.749217 + ], + [ + -92.29402, + 46.667063 + ], + [ + -92.29402, + 46.075553 + ], + [ + -92.354266, + 46.015307 + ], + [ + -92.639067, + 45.933153 + ], + [ + -92.869098, + 45.719552 + ], + [ + -92.885529, + 45.577151 + ], + [ + -92.770513, + 45.566198 + ], + [ + -92.644544, + 45.440228 + ], + [ + -92.75956, + 45.286874 + ], + [ + -92.737652, + 45.117088 + ], + [ + -92.808852, + 44.750133 + ], + [ + -92.545959, + 44.569394 + ], + [ + -92.337835, + 44.552964 + ], + [ + -92.233773, + 44.443425 + ], + [ + -91.927065, + 44.333886 + ], + [ + -91.877772, + 44.202439 + ], + [ + -91.592971, + 44.032654 + ], + [ + -91.43414, + 43.994316 + ], + [ + -91.242447, + 43.775238 + ], + [ + -91.269832, + 43.616407 + ], + [ + -91.215062, + 43.501391 + ], + [ + -91.368417, + 43.501391 + ], + [ + -96.451017, + 43.501391 + ], + [ + -96.451017, + 45.297827 + ], + [ + -96.681049, + 45.412843 + ], + [ + -96.856311, + 45.604536 + ], + [ + -96.582464, + 45.818137 + ], + [ + -96.560556, + 45.933153 + ], + [ + -96.598895, + 46.332969 + ], + [ + -96.719387, + 46.437031 + ], + [ + -96.801542, + 46.656109 + ], + [ + -96.785111, + 46.924479 + ], + [ + -96.823449, + 46.968294 + ], + [ + -96.856311, + 47.609096 + ], + [ + -97.053481, + 47.948667 + ], + [ + -97.130158, + 48.140359 + ], + [ + -97.16302, + 48.545653 + ], + [ + -97.097296, + 48.682577 + ], + [ + -97.228743, + 49.000239 + ], + [ + -95.152983, + 49.000239 + ], + [ + -95.152983, + 49.383625 + ], + [ + -94.955813, + 49.372671 + ], + [ + -94.824366, + 49.295994 + ], + [ + -94.69292, + 48.775685 + ], + [ + -94.588858, + 48.715438 + ], + [ + -94.260241, + 48.699007 + ], + [ + -94.221903, + 48.649715 + ], + [ + -93.838517, + 48.627807 + ], + [ + -93.794701, + 48.518268 + ], + [ + -93.466085, + 48.545653 + ], + [ + -93.466085, + 48.589469 + ], + [ + -93.208669, + 48.644238 + ], + [ + -92.984114, + 48.62233 + ], + [ + -92.726698, + 48.540176 + ], + [ + -92.655498, + 48.436114 + ], + [ + -92.50762, + 48.447068 + ], + [ + -92.370697, + 48.222514 + ], + [ + -92.304974, + 48.315622 + ], + [ + -92.053034, + 48.359437 + ], + [ + -92.009219, + 48.266329 + ], + [ + -91.713464, + 48.200606 + ], + [ + -91.713464, + 48.112975 + ], + [ + -91.565587, + 48.041775 + ], + [ + -91.264355, + 48.080113 + ], + [ + -91.083616, + 48.178698 + ], + [ + -90.837154, + 48.238944 + ], + [ + -90.749522, + 48.091067 + ], + [ + -90.579737, + 48.123929 + ], + [ + -90.377091, + 48.091067 + ], + [ + -90.141582, + 48.112975 + ], + [ + -89.873212, + 47.987005 + ], + [ + -89.615796, + 48.008913 + ], + [ + -89.637704, + 47.954144 + ], + [ + -89.971797, + 47.828174 + ], + [ + -90.437337, + 47.729589 + ], + [ + -90.738569, + 47.625527 + ], + [ + -91.171247, + 47.368111 + ], + [ + -91.357463, + 47.20928 + ], + [ + -91.642264, + 47.028541 + ], + [ + -92.091373, + 46.787555 + ], + [ + -92.014696, + 46.705401 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "28", + "properties": { + "name": "Mississippi" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -88.471115, + 34.995703 + ], + [ + -88.202745, + 34.995703 + ], + [ + -88.098683, + 34.891641 + ], + [ + -88.241084, + 33.796253 + ], + [ + -88.471115, + 31.895754 + ], + [ + -88.394438, + 30.367688 + ], + [ + -88.503977, + 30.323872 + ], + [ + -88.744962, + 30.34578 + ], + [ + -88.843547, + 30.411504 + ], + [ + -89.084533, + 30.367688 + ], + [ + -89.418626, + 30.252672 + ], + [ + -89.522688, + 30.181472 + ], + [ + -89.643181, + 30.285534 + ], + [ + -89.681519, + 30.449842 + ], + [ + -89.845827, + 30.66892 + ], + [ + -89.747242, + 30.997536 + ], + [ + -91.636787, + 30.997536 + ], + [ + -91.565587, + 31.068736 + ], + [ + -91.636787, + 31.265906 + ], + [ + -91.516294, + 31.27686 + ], + [ + -91.499863, + 31.643815 + ], + [ + -91.401278, + 31.621907 + ], + [ + -91.341032, + 31.846462 + ], + [ + -91.105524, + 31.988862 + ], + [ + -90.985031, + 32.218894 + ], + [ + -91.006939, + 32.514649 + ], + [ + -91.154816, + 32.640618 + ], + [ + -91.143862, + 32.843265 + ], + [ + -91.072662, + 32.887081 + ], + [ + -91.16577, + 33.002096 + ], + [ + -91.089093, + 33.13902 + ], + [ + -91.143862, + 33.347144 + ], + [ + -91.056231, + 33.429298 + ], + [ + -91.231493, + 33.560744 + ], + [ + -91.072662, + 33.867453 + ], + [ + -90.891923, + 34.026284 + ], + [ + -90.952169, + 34.135823 + ], + [ + -90.744046, + 34.300131 + ], + [ + -90.749522, + 34.365854 + ], + [ + -90.568783, + 34.420624 + ], + [ + -90.585214, + 34.617794 + ], + [ + -90.481152, + 34.661609 + ], + [ + -90.409952, + 34.831394 + ], + [ + -90.251121, + 34.908072 + ], + [ + -90.311367, + 34.995703 + ], + [ + -88.471115, + 34.995703 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "29", + "properties": { + "name": "Missouri" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -91.833957, + 40.609566 + ], + [ + -91.729895, + 40.615043 + ], + [ + -91.527248, + 40.412397 + ], + [ + -91.417709, + 40.379535 + ], + [ + -91.50534, + 40.237135 + ], + [ + -91.494386, + 40.034488 + ], + [ + -91.368417, + 39.727779 + ], + [ + -91.061708, + 39.470363 + ], + [ + -90.727615, + 39.256762 + ], + [ + -90.661891, + 38.928146 + ], + [ + -90.585214, + 38.867899 + ], + [ + -90.470199, + 38.961007 + ], + [ + -90.251121, + 38.917192 + ], + [ + -90.10872, + 38.845992 + ], + [ + -90.207305, + 38.725499 + ], + [ + -90.179921, + 38.632391 + ], + [ + -90.349706, + 38.374975 + ], + [ + -90.355183, + 38.216144 + ], + [ + -90.059428, + 38.013497 + ], + [ + -89.949889, + 37.88205 + ], + [ + -89.84035, + 37.903958 + ], + [ + -89.517211, + 37.690357 + ], + [ + -89.517211, + 37.537003 + ], + [ + -89.435057, + 37.34531 + ], + [ + -89.517211, + 37.279587 + ], + [ + -89.292656, + 36.994786 + ], + [ + -89.133825, + 36.983832 + ], + [ + -89.215979, + 36.578538 + ], + [ + -89.363857, + 36.622354 + ], + [ + -89.418626, + 36.496384 + ], + [ + -89.484349, + 36.496384 + ], + [ + -89.539119, + 36.496384 + ], + [ + -89.533642, + 36.249922 + ], + [ + -89.730812, + 35.997983 + ], + [ + -90.377091, + 35.997983 + ], + [ + -90.218259, + 36.184199 + ], + [ + -90.064905, + 36.304691 + ], + [ + -90.152536, + 36.496384 + ], + [ + -94.473842, + 36.501861 + ], + [ + -94.616242, + 36.501861 + ], + [ + -94.616242, + 37.000263 + ], + [ + -94.610765, + 39.158177 + ], + [ + -94.824366, + 39.20747 + ], + [ + -94.983197, + 39.442978 + ], + [ + -95.109167, + 39.541563 + ], + [ + -94.884612, + 39.831841 + ], + [ + -95.207752, + 39.908518 + ], + [ + -95.306337, + 40.001626 + ], + [ + -95.552799, + 40.264519 + ], + [ + -95.7664, + 40.587659 + ], + [ + -94.632673, + 40.571228 + ], + [ + -93.257961, + 40.582182 + ], + [ + -91.833957, + 40.609566 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "30", + "properties": { + "name": "Montana" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -104.047534, + 49.000239 + ], + [ + -104.042057, + 47.861036 + ], + [ + -104.047534, + 45.944106 + ], + [ + -104.042057, + 44.996596 + ], + [ + -104.058488, + 44.996596 + ], + [ + -105.91517, + 45.002073 + ], + [ + -109.080842, + 45.002073 + ], + [ + -111.05254, + 45.002073 + ], + [ + -111.047063, + 44.476286 + ], + [ + -111.227803, + 44.580348 + ], + [ + -111.386634, + 44.75561 + ], + [ + -111.616665, + 44.547487 + ], + [ + -111.819312, + 44.509148 + ], + [ + -111.868605, + 44.563917 + ], + [ + -112.104113, + 44.520102 + ], + [ + -112.241036, + 44.569394 + ], + [ + -112.471068, + 44.481763 + ], + [ + -112.783254, + 44.48724 + ], + [ + -112.887315, + 44.394132 + ], + [ + -113.002331, + 44.448902 + ], + [ + -113.133778, + 44.772041 + ], + [ + -113.341901, + 44.782995 + ], + [ + -113.456917, + 44.865149 + ], + [ + -113.45144, + 45.056842 + ], + [ + -113.571933, + 45.128042 + ], + [ + -113.736241, + 45.330689 + ], + [ + -113.834826, + 45.522382 + ], + [ + -113.807441, + 45.604536 + ], + [ + -113.98818, + 45.703121 + ], + [ + -114.086765, + 45.593582 + ], + [ + -114.333228, + 45.456659 + ], + [ + -114.546828, + 45.560721 + ], + [ + -114.497536, + 45.670259 + ], + [ + -114.568736, + 45.774321 + ], + [ + -114.387997, + 45.88386 + ], + [ + -114.492059, + 46.037214 + ], + [ + -114.464674, + 46.272723 + ], + [ + -114.322274, + 46.645155 + ], + [ + -114.612552, + 46.639678 + ], + [ + -114.623506, + 46.705401 + ], + [ + -114.886399, + 46.809463 + ], + [ + -114.930214, + 46.919002 + ], + [ + -115.302646, + 47.187372 + ], + [ + -115.324554, + 47.258572 + ], + [ + -115.527201, + 47.302388 + ], + [ + -115.718894, + 47.42288 + ], + [ + -115.724371, + 47.696727 + ], + [ + -116.04751, + 47.976051 + ], + [ + -116.04751, + 49.000239 + ], + [ + -111.50165, + 48.994762 + ], + [ + -109.453274, + 49.000239 + ], + [ + -104.047534, + 49.000239 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "31", + "properties": { + "name": "Nebraska" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -103.324578, + 43.002989 + ], + [ + -101.626726, + 42.997512 + ], + [ + -98.499393, + 42.997512 + ], + [ + -98.466531, + 42.94822 + ], + [ + -97.951699, + 42.767481 + ], + [ + -97.831206, + 42.866066 + ], + [ + -97.688806, + 42.844158 + ], + [ + -97.217789, + 42.844158 + ], + [ + -96.692003, + 42.657942 + ], + [ + -96.626279, + 42.515542 + ], + [ + -96.44554, + 42.488157 + ], + [ + -96.264801, + 42.039048 + ], + [ + -96.127878, + 41.973325 + ], + [ + -96.062155, + 41.798063 + ], + [ + -96.122401, + 41.67757 + ], + [ + -96.095016, + 41.540646 + ], + [ + -95.919754, + 41.453015 + ], + [ + -95.925231, + 41.201076 + ], + [ + -95.826646, + 40.976521 + ], + [ + -95.881416, + 40.719105 + ], + [ + -95.7664, + 40.587659 + ], + [ + -95.552799, + 40.264519 + ], + [ + -95.306337, + 40.001626 + ], + [ + -101.90605, + 40.001626 + ], + [ + -102.053927, + 40.001626 + ], + [ + -102.053927, + 41.003906 + ], + [ + -104.053011, + 41.003906 + ], + [ + -104.053011, + 43.002989 + ], + [ + -103.324578, + 43.002989 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "32", + "properties": { + "name": "Nevada" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -117.027882, + 42.000709 + ], + [ + -114.04295, + 41.995232 + ], + [ + -114.048427, + 37.000263 + ], + [ + -114.048427, + 36.195153 + ], + [ + -114.152489, + 36.025367 + ], + [ + -114.251074, + 36.01989 + ], + [ + -114.371566, + 36.140383 + ], + [ + -114.738521, + 36.102045 + ], + [ + -114.678275, + 35.516012 + ], + [ + -114.596121, + 35.324319 + ], + [ + -114.574213, + 35.138103 + ], + [ + -114.634459, + 35.00118 + ], + [ + -115.85034, + 35.970598 + ], + [ + -116.540435, + 36.501861 + ], + [ + -117.498899, + 37.21934 + ], + [ + -118.71478, + 38.101128 + ], + [ + -120.001861, + 38.999346 + ], + [ + -119.996384, + 40.264519 + ], + [ + -120.001861, + 41.995232 + ], + [ + -118.698349, + 41.989755 + ], + [ + -117.027882, + 42.000709 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "33", + "properties": { + "name": "New Hampshire" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -71.08183, + 45.303304 + ], + [ + -71.032537, + 44.657025 + ], + [ + -70.966814, + 43.34256 + ], + [ + -70.807983, + 43.227544 + ], + [ + -70.824413, + 43.128959 + ], + [ + -70.703921, + 43.057759 + ], + [ + -70.818936, + 42.871543 + ], + [ + -70.917521, + 42.887974 + ], + [ + -71.185891, + 42.789389 + ], + [ + -71.29543, + 42.696281 + ], + [ + -72.456542, + 42.729142 + ], + [ + -72.544173, + 42.80582 + ], + [ + -72.533219, + 42.953697 + ], + [ + -72.445588, + 43.008466 + ], + [ + -72.456542, + 43.150867 + ], + [ + -72.379864, + 43.572591 + ], + [ + -72.204602, + 43.769761 + ], + [ + -72.116971, + 43.994316 + ], + [ + -72.02934, + 44.07647 + ], + [ + -72.034817, + 44.322932 + ], + [ + -71.700724, + 44.41604 + ], + [ + -71.536416, + 44.585825 + ], + [ + -71.629524, + 44.750133 + ], + [ + -71.4926, + 44.914442 + ], + [ + -71.503554, + 45.013027 + ], + [ + -71.361154, + 45.270443 + ], + [ + -71.131122, + 45.243058 + ], + [ + -71.08183, + 45.303304 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "34", + "properties": { + "name": "New Jersey" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.236547, + 41.14083 + ], + [ + -73.902454, + 40.998429 + ], + [ + -74.022947, + 40.708151 + ], + [ + -74.187255, + 40.642428 + ], + [ + -74.274886, + 40.489074 + ], + [ + -74.001039, + 40.412397 + ], + [ + -73.979131, + 40.297381 + ], + [ + -74.099624, + 39.760641 + ], + [ + -74.411809, + 39.360824 + ], + [ + -74.614456, + 39.245808 + ], + [ + -74.795195, + 38.993869 + ], + [ + -74.888303, + 39.158177 + ], + [ + -75.178581, + 39.240331 + ], + [ + -75.534582, + 39.459409 + ], + [ + -75.55649, + 39.607286 + ], + [ + -75.561967, + 39.629194 + ], + [ + -75.507197, + 39.683964 + ], + [ + -75.414089, + 39.804456 + ], + [ + -75.145719, + 39.88661 + ], + [ + -75.129289, + 39.963288 + ], + [ + -74.82258, + 40.127596 + ], + [ + -74.773287, + 40.215227 + ], + [ + -75.058088, + 40.417874 + ], + [ + -75.069042, + 40.543843 + ], + [ + -75.195012, + 40.576705 + ], + [ + -75.205966, + 40.691721 + ], + [ + -75.052611, + 40.866983 + ], + [ + -75.134765, + 40.971045 + ], + [ + -74.882826, + 41.179168 + ], + [ + -74.828057, + 41.288707 + ], + [ + -74.69661, + 41.359907 + ], + [ + -74.236547, + 41.14083 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "35", + "properties": { + "name": "New Mexico" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -107.421329, + 37.000263 + ], + [ + -106.868158, + 36.994786 + ], + [ + -104.337812, + 36.994786 + ], + [ + -103.001438, + 37.000263 + ], + [ + -103.001438, + 36.501861 + ], + [ + -103.039777, + 36.501861 + ], + [ + -103.045254, + 34.01533 + ], + [ + -103.067161, + 33.002096 + ], + [ + -103.067161, + 31.999816 + ], + [ + -106.616219, + 31.999816 + ], + [ + -106.643603, + 31.901231 + ], + [ + -106.528588, + 31.786216 + ], + [ + -108.210008, + 31.786216 + ], + [ + -108.210008, + 31.331629 + ], + [ + -109.04798, + 31.331629 + ], + [ + -109.042503, + 37.000263 + ], + [ + -107.421329, + 37.000263 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "36", + "properties": { + "name": "New York" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.343806, + 45.013027 + ], + [ + -73.332852, + 44.804903 + ], + [ + -73.387622, + 44.618687 + ], + [ + -73.294514, + 44.437948 + ], + [ + -73.321898, + 44.246255 + ], + [ + -73.436914, + 44.043608 + ], + [ + -73.349283, + 43.769761 + ], + [ + -73.404052, + 43.687607 + ], + [ + -73.245221, + 43.523299 + ], + [ + -73.278083, + 42.833204 + ], + [ + -73.267129, + 42.745573 + ], + [ + -73.508114, + 42.08834 + ], + [ + -73.486206, + 42.050002 + ], + [ + -73.55193, + 41.294184 + ], + [ + -73.48073, + 41.21203 + ], + [ + -73.727192, + 41.102491 + ], + [ + -73.655992, + 40.987475 + ], + [ + -73.22879, + 40.905321 + ], + [ + -73.141159, + 40.965568 + ], + [ + -72.774204, + 40.965568 + ], + [ + -72.587988, + 40.998429 + ], + [ + -72.28128, + 41.157261 + ], + [ + -72.259372, + 41.042245 + ], + [ + -72.100541, + 40.992952 + ], + [ + -72.467496, + 40.845075 + ], + [ + -73.239744, + 40.625997 + ], + [ + -73.562884, + 40.582182 + ], + [ + -73.776484, + 40.593136 + ], + [ + -73.935316, + 40.543843 + ], + [ + -74.022947, + 40.708151 + ], + [ + -73.902454, + 40.998429 + ], + [ + -74.236547, + 41.14083 + ], + [ + -74.69661, + 41.359907 + ], + [ + -74.740426, + 41.431108 + ], + [ + -74.89378, + 41.436584 + ], + [ + -75.074519, + 41.60637 + ], + [ + -75.052611, + 41.754247 + ], + [ + -75.173104, + 41.869263 + ], + [ + -75.249781, + 41.863786 + ], + [ + -75.35932, + 42.000709 + ], + [ + -79.76278, + 42.000709 + ], + [ + -79.76278, + 42.252649 + ], + [ + -79.76278, + 42.269079 + ], + [ + -79.149363, + 42.55388 + ], + [ + -79.050778, + 42.690804 + ], + [ + -78.853608, + 42.783912 + ], + [ + -78.930285, + 42.953697 + ], + [ + -79.012439, + 42.986559 + ], + [ + -79.072686, + 43.260406 + ], + [ + -78.486653, + 43.375421 + ], + [ + -77.966344, + 43.369944 + ], + [ + -77.75822, + 43.34256 + ], + [ + -77.533665, + 43.233021 + ], + [ + -77.391265, + 43.276836 + ], + [ + -76.958587, + 43.271359 + ], + [ + -76.695693, + 43.34256 + ], + [ + -76.41637, + 43.523299 + ], + [ + -76.235631, + 43.528776 + ], + [ + -76.230154, + 43.802623 + ], + [ + -76.137046, + 43.961454 + ], + [ + -76.3616, + 44.070993 + ], + [ + -76.312308, + 44.196962 + ], + [ + -75.912491, + 44.366748 + ], + [ + -75.764614, + 44.514625 + ], + [ + -75.282643, + 44.848718 + ], + [ + -74.828057, + 45.018503 + ], + [ + -74.148916, + 44.991119 + ], + [ + -73.343806, + 45.013027 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "37", + "properties": { + "name": "North Carolina" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -80.978661, + 36.562108 + ], + [ + -80.294043, + 36.545677 + ], + [ + -79.510841, + 36.5402 + ], + [ + -75.868676, + 36.551154 + ], + [ + -75.75366, + 36.151337 + ], + [ + -76.032984, + 36.189676 + ], + [ + -76.071322, + 36.140383 + ], + [ + -76.410893, + 36.080137 + ], + [ + -76.460185, + 36.025367 + ], + [ + -76.68474, + 36.008937 + ], + [ + -76.673786, + 35.937736 + ], + [ + -76.399939, + 35.987029 + ], + [ + -76.3616, + 35.943213 + ], + [ + -76.060368, + 35.992506 + ], + [ + -75.961783, + 35.899398 + ], + [ + -75.781044, + 35.937736 + ], + [ + -75.715321, + 35.696751 + ], + [ + -75.775568, + 35.581735 + ], + [ + -75.89606, + 35.570781 + ], + [ + -76.147999, + 35.324319 + ], + [ + -76.482093, + 35.313365 + ], + [ + -76.536862, + 35.14358 + ], + [ + -76.394462, + 34.973795 + ], + [ + -76.279446, + 34.940933 + ], + [ + -76.493047, + 34.661609 + ], + [ + -76.673786, + 34.694471 + ], + [ + -76.991448, + 34.667086 + ], + [ + -77.210526, + 34.60684 + ], + [ + -77.555573, + 34.415147 + ], + [ + -77.82942, + 34.163208 + ], + [ + -77.971821, + 33.845545 + ], + [ + -78.179944, + 33.916745 + ], + [ + -78.541422, + 33.851022 + ], + [ + -79.675149, + 34.80401 + ], + [ + -80.797922, + 34.820441 + ], + [ + -80.781491, + 34.935456 + ], + [ + -80.934845, + 35.105241 + ], + [ + -81.038907, + 35.044995 + ], + [ + -81.044384, + 35.149057 + ], + [ + -82.276696, + 35.198349 + ], + [ + -82.550543, + 35.160011 + ], + [ + -82.764143, + 35.066903 + ], + [ + -83.109191, + 35.00118 + ], + [ + -83.618546, + 34.984749 + ], + [ + -84.319594, + 34.990226 + ], + [ + -84.29221, + 35.225734 + ], + [ + -84.09504, + 35.247642 + ], + [ + -84.018363, + 35.41195 + ], + [ + -83.7719, + 35.559827 + ], + [ + -83.498053, + 35.565304 + ], + [ + -83.251591, + 35.718659 + ], + [ + -82.994175, + 35.773428 + ], + [ + -82.775097, + 35.997983 + ], + [ + -82.638174, + 36.063706 + ], + [ + -82.610789, + 35.965121 + ], + [ + -82.216449, + 36.156814 + ], + [ + -82.03571, + 36.118475 + ], + [ + -81.909741, + 36.304691 + ], + [ + -81.723525, + 36.353984 + ], + [ + -81.679709, + 36.589492 + ], + [ + -80.978661, + 36.562108 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "38", + "properties": { + "name": "North Dakota" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -97.228743, + 49.000239 + ], + [ + -97.097296, + 48.682577 + ], + [ + -97.16302, + 48.545653 + ], + [ + -97.130158, + 48.140359 + ], + [ + -97.053481, + 47.948667 + ], + [ + -96.856311, + 47.609096 + ], + [ + -96.823449, + 46.968294 + ], + [ + -96.785111, + 46.924479 + ], + [ + -96.801542, + 46.656109 + ], + [ + -96.719387, + 46.437031 + ], + [ + -96.598895, + 46.332969 + ], + [ + -96.560556, + 45.933153 + ], + [ + -104.047534, + 45.944106 + ], + [ + -104.042057, + 47.861036 + ], + [ + -104.047534, + 49.000239 + ], + [ + -97.228743, + 49.000239 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "39", + "properties": { + "name": "Ohio" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -80.518598, + 41.978802 + ], + [ + -80.518598, + 40.636951 + ], + [ + -80.666475, + 40.582182 + ], + [ + -80.595275, + 40.472643 + ], + [ + -80.600752, + 40.319289 + ], + [ + -80.737675, + 40.078303 + ], + [ + -80.830783, + 39.711348 + ], + [ + -81.219646, + 39.388209 + ], + [ + -81.345616, + 39.344393 + ], + [ + -81.455155, + 39.410117 + ], + [ + -81.57017, + 39.267716 + ], + [ + -81.685186, + 39.273193 + ], + [ + -81.811156, + 39.0815 + ], + [ + -81.783771, + 38.966484 + ], + [ + -81.887833, + 38.873376 + ], + [ + -82.03571, + 39.026731 + ], + [ + -82.221926, + 38.785745 + ], + [ + -82.172634, + 38.632391 + ], + [ + -82.293127, + 38.577622 + ], + [ + -82.331465, + 38.446175 + ], + [ + -82.594358, + 38.424267 + ], + [ + -82.731282, + 38.561191 + ], + [ + -82.846298, + 38.588575 + ], + [ + -82.890113, + 38.758361 + ], + [ + -83.032514, + 38.725499 + ], + [ + -83.142052, + 38.626914 + ], + [ + -83.519961, + 38.703591 + ], + [ + -83.678792, + 38.632391 + ], + [ + -83.903347, + 38.769315 + ], + [ + -84.215533, + 38.807653 + ], + [ + -84.231963, + 38.895284 + ], + [ + -84.43461, + 39.103408 + ], + [ + -84.817996, + 39.103408 + ], + [ + -84.801565, + 40.500028 + ], + [ + -84.807042, + 41.694001 + ], + [ + -83.454238, + 41.732339 + ], + [ + -83.065375, + 41.595416 + ], + [ + -82.933929, + 41.513262 + ], + [ + -82.835344, + 41.589939 + ], + [ + -82.616266, + 41.431108 + ], + [ + -82.479343, + 41.381815 + ], + [ + -82.013803, + 41.513262 + ], + [ + -81.739956, + 41.485877 + ], + [ + -81.444201, + 41.672093 + ], + [ + -81.011523, + 41.852832 + ], + [ + -80.518598, + 41.978802 + ], + [ + -80.518598, + 41.978802 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "40", + "properties": { + "name": "Oklahoma" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -100.087706, + 37.000263 + ], + [ + -94.616242, + 37.000263 + ], + [ + -94.616242, + 36.501861 + ], + [ + -94.430026, + 35.395519 + ], + [ + -94.484796, + 33.637421 + ], + [ + -94.868182, + 33.74696 + ], + [ + -94.966767, + 33.861976 + ], + [ + -95.224183, + 33.960561 + ], + [ + -95.289906, + 33.87293 + ], + [ + -95.547322, + 33.878407 + ], + [ + -95.602092, + 33.933176 + ], + [ + -95.8376, + 33.834591 + ], + [ + -95.936185, + 33.889361 + ], + [ + -96.149786, + 33.840068 + ], + [ + -96.346956, + 33.686714 + ], + [ + -96.423633, + 33.774345 + ], + [ + -96.631756, + 33.845545 + ], + [ + -96.850834, + 33.845545 + ], + [ + -96.922034, + 33.960561 + ], + [ + -97.173974, + 33.736006 + ], + [ + -97.256128, + 33.861976 + ], + [ + -97.371143, + 33.823637 + ], + [ + -97.458774, + 33.905791 + ], + [ + -97.694283, + 33.982469 + ], + [ + -97.869545, + 33.851022 + ], + [ + -97.946222, + 33.987946 + ], + [ + -98.088623, + 34.004376 + ], + [ + -98.170777, + 34.113915 + ], + [ + -98.36247, + 34.157731 + ], + [ + -98.488439, + 34.064623 + ], + [ + -98.570593, + 34.146777 + ], + [ + -98.767763, + 34.135823 + ], + [ + -98.986841, + 34.223454 + ], + [ + -99.189488, + 34.2125 + ], + [ + -99.260688, + 34.404193 + ], + [ + -99.57835, + 34.415147 + ], + [ + -99.698843, + 34.382285 + ], + [ + -99.923398, + 34.573978 + ], + [ + -100.000075, + 34.563024 + ], + [ + -100.000075, + 36.501861 + ], + [ + -101.812942, + 36.501861 + ], + [ + -103.001438, + 36.501861 + ], + [ + -103.001438, + 37.000263 + ], + [ + -102.042974, + 36.994786 + ], + [ + -100.087706, + 37.000263 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "41", + "properties": { + "name": "Oregon" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -123.211348, + 46.174138 + ], + [ + -123.11824, + 46.185092 + ], + [ + -122.904639, + 46.08103 + ], + [ + -122.811531, + 45.960537 + ], + [ + -122.762239, + 45.659305 + ], + [ + -122.247407, + 45.549767 + ], + [ + -121.809251, + 45.708598 + ], + [ + -121.535404, + 45.725029 + ], + [ + -121.217742, + 45.670259 + ], + [ + -121.18488, + 45.604536 + ], + [ + -120.637186, + 45.746937 + ], + [ + -120.505739, + 45.697644 + ], + [ + -120.209985, + 45.725029 + ], + [ + -119.963522, + 45.823614 + ], + [ + -119.525367, + 45.911245 + ], + [ + -119.125551, + 45.933153 + ], + [ + -118.988627, + 45.998876 + ], + [ + -116.918344, + 45.993399 + ], + [ + -116.78142, + 45.823614 + ], + [ + -116.545912, + 45.752413 + ], + [ + -116.463758, + 45.61549 + ], + [ + -116.671881, + 45.319735 + ], + [ + -116.732128, + 45.144473 + ], + [ + -116.847143, + 45.02398 + ], + [ + -116.830713, + 44.930872 + ], + [ + -116.934774, + 44.782995 + ], + [ + -117.038836, + 44.750133 + ], + [ + -117.241483, + 44.394132 + ], + [ + -117.170283, + 44.257209 + ], + [ + -116.97859, + 44.240778 + ], + [ + -116.896436, + 44.158624 + ], + [ + -117.027882, + 43.830007 + ], + [ + -117.027882, + 42.000709 + ], + [ + -118.698349, + 41.989755 + ], + [ + -120.001861, + 41.995232 + ], + [ + -121.037003, + 41.995232 + ], + [ + -122.378853, + 42.011663 + ], + [ + -123.233256, + 42.006186 + ], + [ + -124.213628, + 42.000709 + ], + [ + -124.356029, + 42.115725 + ], + [ + -124.432706, + 42.438865 + ], + [ + -124.416275, + 42.663419 + ], + [ + -124.553198, + 42.838681 + ], + [ + -124.454613, + 43.002989 + ], + [ + -124.383413, + 43.271359 + ], + [ + -124.235536, + 43.55616 + ], + [ + -124.169813, + 43.8081 + ], + [ + -124.060274, + 44.657025 + ], + [ + -124.076705, + 44.772041 + ], + [ + -123.97812, + 45.144473 + ], + [ + -123.939781, + 45.659305 + ], + [ + -123.994551, + 45.944106 + ], + [ + -123.945258, + 46.113892 + ], + [ + -123.545441, + 46.261769 + ], + [ + -123.370179, + 46.146753 + ], + [ + -123.211348, + 46.174138 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "42", + "properties": { + "name": "Pennsylvania" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -79.76278, + 42.252649 + ], + [ + -79.76278, + 42.000709 + ], + [ + -75.35932, + 42.000709 + ], + [ + -75.249781, + 41.863786 + ], + [ + -75.173104, + 41.869263 + ], + [ + -75.052611, + 41.754247 + ], + [ + -75.074519, + 41.60637 + ], + [ + -74.89378, + 41.436584 + ], + [ + -74.740426, + 41.431108 + ], + [ + -74.69661, + 41.359907 + ], + [ + -74.828057, + 41.288707 + ], + [ + -74.882826, + 41.179168 + ], + [ + -75.134765, + 40.971045 + ], + [ + -75.052611, + 40.866983 + ], + [ + -75.205966, + 40.691721 + ], + [ + -75.195012, + 40.576705 + ], + [ + -75.069042, + 40.543843 + ], + [ + -75.058088, + 40.417874 + ], + [ + -74.773287, + 40.215227 + ], + [ + -74.82258, + 40.127596 + ], + [ + -75.129289, + 39.963288 + ], + [ + -75.145719, + 39.88661 + ], + [ + -75.414089, + 39.804456 + ], + [ + -75.616736, + 39.831841 + ], + [ + -75.786521, + 39.722302 + ], + [ + -79.477979, + 39.722302 + ], + [ + -80.518598, + 39.722302 + ], + [ + -80.518598, + 40.636951 + ], + [ + -80.518598, + 41.978802 + ], + [ + -80.518598, + 41.978802 + ], + [ + -80.332382, + 42.033571 + ], + [ + -79.76278, + 42.269079 + ], + [ + -79.76278, + 42.252649 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "44", + "properties": { + "name": "Rhode Island" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -71.196845, + 41.67757 + ], + [ + -71.120168, + 41.496831 + ], + [ + -71.317338, + 41.474923 + ], + [ + -71.196845, + 41.67757 + ] + ] + ], + [ + [ + [ + -71.530939, + 42.01714 + ], + [ + -71.383061, + 42.01714 + ], + [ + -71.328292, + 41.781632 + ], + [ + -71.22423, + 41.710431 + ], + [ + -71.344723, + 41.726862 + ], + [ + -71.448785, + 41.578985 + ], + [ + -71.481646, + 41.370861 + ], + [ + -71.859555, + 41.321569 + ], + [ + -71.799309, + 41.414677 + ], + [ + -71.799309, + 42.006186 + ], + [ + -71.530939, + 42.01714 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "45", + "properties": { + "name": "South Carolina" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -82.764143, + 35.066903 + ], + [ + -82.550543, + 35.160011 + ], + [ + -82.276696, + 35.198349 + ], + [ + -81.044384, + 35.149057 + ], + [ + -81.038907, + 35.044995 + ], + [ + -80.934845, + 35.105241 + ], + [ + -80.781491, + 34.935456 + ], + [ + -80.797922, + 34.820441 + ], + [ + -79.675149, + 34.80401 + ], + [ + -78.541422, + 33.851022 + ], + [ + -78.716684, + 33.80173 + ], + [ + -78.935762, + 33.637421 + ], + [ + -79.149363, + 33.380005 + ], + [ + -79.187701, + 33.171881 + ], + [ + -79.357487, + 33.007573 + ], + [ + -79.582041, + 33.007573 + ], + [ + -79.631334, + 32.887081 + ], + [ + -79.866842, + 32.755634 + ], + [ + -79.998289, + 32.613234 + ], + [ + -80.206412, + 32.552987 + ], + [ + -80.430967, + 32.399633 + ], + [ + -80.452875, + 32.328433 + ], + [ + -80.660998, + 32.246279 + ], + [ + -80.885553, + 32.032678 + ], + [ + -81.115584, + 32.120309 + ], + [ + -81.121061, + 32.290094 + ], + [ + -81.279893, + 32.558464 + ], + [ + -81.416816, + 32.629664 + ], + [ + -81.42777, + 32.843265 + ], + [ + -81.493493, + 33.007573 + ], + [ + -81.761863, + 33.160928 + ], + [ + -81.937125, + 33.347144 + ], + [ + -81.926172, + 33.462159 + ], + [ + -82.194542, + 33.631944 + ], + [ + -82.325988, + 33.81816 + ], + [ + -82.55602, + 33.94413 + ], + [ + -82.714851, + 34.152254 + ], + [ + -82.747713, + 34.26727 + ], + [ + -82.901067, + 34.486347 + ], + [ + -83.005129, + 34.469916 + ], + [ + -83.339222, + 34.683517 + ], + [ + -83.322791, + 34.787579 + ], + [ + -83.109191, + 35.00118 + ], + [ + -82.764143, + 35.066903 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "46", + "properties": { + "name": "South Dakota" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -104.047534, + 45.944106 + ], + [ + -96.560556, + 45.933153 + ], + [ + -96.582464, + 45.818137 + ], + [ + -96.856311, + 45.604536 + ], + [ + -96.681049, + 45.412843 + ], + [ + -96.451017, + 45.297827 + ], + [ + -96.451017, + 43.501391 + ], + [ + -96.582464, + 43.479483 + ], + [ + -96.527695, + 43.397329 + ], + [ + -96.560556, + 43.222067 + ], + [ + -96.434587, + 43.123482 + ], + [ + -96.511264, + 43.052282 + ], + [ + -96.544125, + 42.855112 + ], + [ + -96.631756, + 42.707235 + ], + [ + -96.44554, + 42.488157 + ], + [ + -96.626279, + 42.515542 + ], + [ + -96.692003, + 42.657942 + ], + [ + -97.217789, + 42.844158 + ], + [ + -97.688806, + 42.844158 + ], + [ + -97.831206, + 42.866066 + ], + [ + -97.951699, + 42.767481 + ], + [ + -98.466531, + 42.94822 + ], + [ + -98.499393, + 42.997512 + ], + [ + -101.626726, + 42.997512 + ], + [ + -103.324578, + 43.002989 + ], + [ + -104.053011, + 43.002989 + ], + [ + -104.058488, + 44.996596 + ], + [ + -104.042057, + 44.996596 + ], + [ + -104.047534, + 45.944106 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "47", + "properties": { + "name": "Tennessee" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -88.054868, + 36.496384 + ], + [ + -88.071299, + 36.677123 + ], + [ + -87.852221, + 36.633308 + ], + [ + -86.592525, + 36.655216 + ], + [ + -85.486183, + 36.616877 + ], + [ + -85.289013, + 36.627831 + ], + [ + -84.544149, + 36.594969 + ], + [ + -83.689746, + 36.584015 + ], + [ + -83.673316, + 36.600446 + ], + [ + -81.679709, + 36.589492 + ], + [ + -81.723525, + 36.353984 + ], + [ + -81.909741, + 36.304691 + ], + [ + -82.03571, + 36.118475 + ], + [ + -82.216449, + 36.156814 + ], + [ + -82.610789, + 35.965121 + ], + [ + -82.638174, + 36.063706 + ], + [ + -82.775097, + 35.997983 + ], + [ + -82.994175, + 35.773428 + ], + [ + -83.251591, + 35.718659 + ], + [ + -83.498053, + 35.565304 + ], + [ + -83.7719, + 35.559827 + ], + [ + -84.018363, + 35.41195 + ], + [ + -84.09504, + 35.247642 + ], + [ + -84.29221, + 35.225734 + ], + [ + -84.319594, + 34.990226 + ], + [ + -85.606675, + 34.984749 + ], + [ + -87.359296, + 35.00118 + ], + [ + -88.202745, + 34.995703 + ], + [ + -88.471115, + 34.995703 + ], + [ + -90.311367, + 34.995703 + ], + [ + -90.212782, + 35.023087 + ], + [ + -90.114197, + 35.198349 + ], + [ + -90.130628, + 35.439335 + ], + [ + -89.944412, + 35.603643 + ], + [ + -89.911551, + 35.756997 + ], + [ + -89.763673, + 35.811767 + ], + [ + -89.730812, + 35.997983 + ], + [ + -89.533642, + 36.249922 + ], + [ + -89.539119, + 36.496384 + ], + [ + -89.484349, + 36.496384 + ], + [ + -89.418626, + 36.496384 + ], + [ + -89.298133, + 36.507338 + ], + [ + -88.054868, + 36.496384 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "48", + "properties": { + "name": "Texas" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -101.812942, + 36.501861 + ], + [ + -100.000075, + 36.501861 + ], + [ + -100.000075, + 34.563024 + ], + [ + -99.923398, + 34.573978 + ], + [ + -99.698843, + 34.382285 + ], + [ + -99.57835, + 34.415147 + ], + [ + -99.260688, + 34.404193 + ], + [ + -99.189488, + 34.2125 + ], + [ + -98.986841, + 34.223454 + ], + [ + -98.767763, + 34.135823 + ], + [ + -98.570593, + 34.146777 + ], + [ + -98.488439, + 34.064623 + ], + [ + -98.36247, + 34.157731 + ], + [ + -98.170777, + 34.113915 + ], + [ + -98.088623, + 34.004376 + ], + [ + -97.946222, + 33.987946 + ], + [ + -97.869545, + 33.851022 + ], + [ + -97.694283, + 33.982469 + ], + [ + -97.458774, + 33.905791 + ], + [ + -97.371143, + 33.823637 + ], + [ + -97.256128, + 33.861976 + ], + [ + -97.173974, + 33.736006 + ], + [ + -96.922034, + 33.960561 + ], + [ + -96.850834, + 33.845545 + ], + [ + -96.631756, + 33.845545 + ], + [ + -96.423633, + 33.774345 + ], + [ + -96.346956, + 33.686714 + ], + [ + -96.149786, + 33.840068 + ], + [ + -95.936185, + 33.889361 + ], + [ + -95.8376, + 33.834591 + ], + [ + -95.602092, + 33.933176 + ], + [ + -95.547322, + 33.878407 + ], + [ + -95.289906, + 33.87293 + ], + [ + -95.224183, + 33.960561 + ], + [ + -94.966767, + 33.861976 + ], + [ + -94.868182, + 33.74696 + ], + [ + -94.484796, + 33.637421 + ], + [ + -94.380734, + 33.544313 + ], + [ + -94.183564, + 33.593606 + ], + [ + -94.041164, + 33.54979 + ], + [ + -94.041164, + 33.018527 + ], + [ + -94.041164, + 31.994339 + ], + [ + -93.822086, + 31.775262 + ], + [ + -93.816609, + 31.556184 + ], + [ + -93.542762, + 31.15089 + ], + [ + -93.526331, + 30.93729 + ], + [ + -93.630393, + 30.679874 + ], + [ + -93.728978, + 30.575812 + ], + [ + -93.696116, + 30.438888 + ], + [ + -93.767317, + 30.334826 + ], + [ + -93.690639, + 30.143133 + ], + [ + -93.926148, + 29.787132 + ], + [ + -93.838517, + 29.688547 + ], + [ + -94.002825, + 29.68307 + ], + [ + -94.523134, + 29.546147 + ], + [ + -94.70935, + 29.622824 + ], + [ + -94.742212, + 29.787132 + ], + [ + -94.873659, + 29.672117 + ], + [ + -94.966767, + 29.699501 + ], + [ + -95.016059, + 29.557101 + ], + [ + -94.911997, + 29.496854 + ], + [ + -94.895566, + 29.310638 + ], + [ + -95.081782, + 29.113469 + ], + [ + -95.383014, + 28.867006 + ], + [ + -95.985477, + 28.604113 + ], + [ + -96.045724, + 28.647929 + ], + [ + -96.226463, + 28.582205 + ], + [ + -96.23194, + 28.642452 + ], + [ + -96.478402, + 28.598636 + ], + [ + -96.593418, + 28.724606 + ], + [ + -96.664618, + 28.697221 + ], + [ + -96.401725, + 28.439805 + ], + [ + -96.593418, + 28.357651 + ], + [ + -96.774157, + 28.406943 + ], + [ + -96.801542, + 28.226204 + ], + [ + -97.026096, + 28.039988 + ], + [ + -97.256128, + 27.694941 + ], + [ + -97.404005, + 27.333463 + ], + [ + -97.513544, + 27.360848 + ], + [ + -97.540929, + 27.229401 + ], + [ + -97.425913, + 27.262263 + ], + [ + -97.480682, + 26.99937 + ], + [ + -97.557359, + 26.988416 + ], + [ + -97.562836, + 26.840538 + ], + [ + -97.469728, + 26.758384 + ], + [ + -97.442344, + 26.457153 + ], + [ + -97.332805, + 26.353091 + ], + [ + -97.30542, + 26.161398 + ], + [ + -97.217789, + 25.991613 + ], + [ + -97.524498, + 25.887551 + ], + [ + -97.650467, + 26.018997 + ], + [ + -97.885976, + 26.06829 + ], + [ + -98.198161, + 26.057336 + ], + [ + -98.466531, + 26.221644 + ], + [ + -98.669178, + 26.238075 + ], + [ + -98.822533, + 26.369522 + ], + [ + -99.030656, + 26.413337 + ], + [ + -99.173057, + 26.539307 + ], + [ + -99.266165, + 26.840538 + ], + [ + -99.446904, + 27.021277 + ], + [ + -99.424996, + 27.174632 + ], + [ + -99.50715, + 27.33894 + ], + [ + -99.479765, + 27.48134 + ], + [ + -99.605735, + 27.640172 + ], + [ + -99.709797, + 27.656603 + ], + [ + -99.879582, + 27.799003 + ], + [ + -99.934351, + 27.979742 + ], + [ + -100.082229, + 28.14405 + ], + [ + -100.29583, + 28.280974 + ], + [ + -100.399891, + 28.582205 + ], + [ + -100.498476, + 28.66436 + ], + [ + -100.629923, + 28.905345 + ], + [ + -100.673738, + 29.102515 + ], + [ + -100.799708, + 29.244915 + ], + [ + -101.013309, + 29.370885 + ], + [ + -101.062601, + 29.458516 + ], + [ + -101.259771, + 29.535193 + ], + [ + -101.413125, + 29.754271 + ], + [ + -101.851281, + 29.803563 + ], + [ + -102.114174, + 29.792609 + ], + [ + -102.338728, + 29.869286 + ], + [ + -102.388021, + 29.765225 + ], + [ + -102.629006, + 29.732363 + ], + [ + -102.809745, + 29.524239 + ], + [ + -102.919284, + 29.190146 + ], + [ + -102.97953, + 29.184669 + ], + [ + -103.116454, + 28.987499 + ], + [ + -103.280762, + 28.982022 + ], + [ + -103.527224, + 29.135376 + ], + [ + -104.146119, + 29.381839 + ], + [ + -104.266611, + 29.513285 + ], + [ + -104.507597, + 29.639255 + ], + [ + -104.677382, + 29.924056 + ], + [ + -104.688336, + 30.181472 + ], + [ + -104.858121, + 30.389596 + ], + [ + -104.896459, + 30.570335 + ], + [ + -105.005998, + 30.685351 + ], + [ + -105.394861, + 30.855136 + ], + [ + -105.602985, + 31.085167 + ], + [ + -105.77277, + 31.167321 + ], + [ + -105.953509, + 31.364491 + ], + [ + -106.205448, + 31.468553 + ], + [ + -106.38071, + 31.731446 + ], + [ + -106.528588, + 31.786216 + ], + [ + -106.643603, + 31.901231 + ], + [ + -106.616219, + 31.999816 + ], + [ + -103.067161, + 31.999816 + ], + [ + -103.067161, + 33.002096 + ], + [ + -103.045254, + 34.01533 + ], + [ + -103.039777, + 36.501861 + ], + [ + -103.001438, + 36.501861 + ], + [ + -101.812942, + 36.501861 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "49", + "properties": { + "name": "Utah" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -112.164359, + 41.995232 + ], + [ + -111.047063, + 42.000709 + ], + [ + -111.047063, + 40.998429 + ], + [ + -109.04798, + 40.998429 + ], + [ + -109.053457, + 39.125316 + ], + [ + -109.058934, + 38.27639 + ], + [ + -109.042503, + 38.166851 + ], + [ + -109.042503, + 37.000263 + ], + [ + -110.499369, + 37.00574 + ], + [ + -114.048427, + 37.000263 + ], + [ + -114.04295, + 41.995232 + ], + [ + -112.164359, + 41.995232 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "50", + "properties": { + "name": "Vermont" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -71.503554, + 45.013027 + ], + [ + -71.4926, + 44.914442 + ], + [ + -71.629524, + 44.750133 + ], + [ + -71.536416, + 44.585825 + ], + [ + -71.700724, + 44.41604 + ], + [ + -72.034817, + 44.322932 + ], + [ + -72.02934, + 44.07647 + ], + [ + -72.116971, + 43.994316 + ], + [ + -72.204602, + 43.769761 + ], + [ + -72.379864, + 43.572591 + ], + [ + -72.456542, + 43.150867 + ], + [ + -72.445588, + 43.008466 + ], + [ + -72.533219, + 42.953697 + ], + [ + -72.544173, + 42.80582 + ], + [ + -72.456542, + 42.729142 + ], + [ + -73.267129, + 42.745573 + ], + [ + -73.278083, + 42.833204 + ], + [ + -73.245221, + 43.523299 + ], + [ + -73.404052, + 43.687607 + ], + [ + -73.349283, + 43.769761 + ], + [ + -73.436914, + 44.043608 + ], + [ + -73.321898, + 44.246255 + ], + [ + -73.294514, + 44.437948 + ], + [ + -73.387622, + 44.618687 + ], + [ + -73.332852, + 44.804903 + ], + [ + -73.343806, + 45.013027 + ], + [ + -72.308664, + 45.002073 + ], + [ + -71.503554, + 45.013027 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "51", + "properties": { + "name": "Virginia" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -78.349729, + 39.464886 + ], + [ + -77.82942, + 39.130793 + ], + [ + -77.719881, + 39.322485 + ], + [ + -77.566527, + 39.306055 + ], + [ + -77.456988, + 39.223901 + ], + [ + -77.456988, + 39.076023 + ], + [ + -77.248864, + 39.026731 + ], + [ + -77.117418, + 38.933623 + ], + [ + -77.040741, + 38.791222 + ], + [ + -77.128372, + 38.632391 + ], + [ + -77.248864, + 38.588575 + ], + [ + -77.325542, + 38.446175 + ], + [ + -77.281726, + 38.342113 + ], + [ + -77.013356, + 38.374975 + ], + [ + -76.964064, + 38.216144 + ], + [ + -76.613539, + 38.15042 + ], + [ + -76.514954, + 38.024451 + ], + [ + -76.235631, + 37.887527 + ], + [ + -76.3616, + 37.608203 + ], + [ + -76.246584, + 37.389126 + ], + [ + -76.383508, + 37.285064 + ], + [ + -76.399939, + 37.159094 + ], + [ + -76.273969, + 37.082417 + ], + [ + -76.410893, + 36.961924 + ], + [ + -76.619016, + 37.120755 + ], + [ + -76.668309, + 37.065986 + ], + [ + -76.48757, + 36.95097 + ], + [ + -75.994645, + 36.923586 + ], + [ + -75.868676, + 36.551154 + ], + [ + -79.510841, + 36.5402 + ], + [ + -80.294043, + 36.545677 + ], + [ + -80.978661, + 36.562108 + ], + [ + -81.679709, + 36.589492 + ], + [ + -83.673316, + 36.600446 + ], + [ + -83.136575, + 36.742847 + ], + [ + -83.070852, + 36.852385 + ], + [ + -82.879159, + 36.890724 + ], + [ + -82.868205, + 36.978355 + ], + [ + -82.720328, + 37.044078 + ], + [ + -82.720328, + 37.120755 + ], + [ + -82.353373, + 37.268633 + ], + [ + -81.969987, + 37.537003 + ], + [ + -81.986418, + 37.454849 + ], + [ + -81.849494, + 37.285064 + ], + [ + -81.679709, + 37.20291 + ], + [ + -81.55374, + 37.208387 + ], + [ + -81.362047, + 37.339833 + ], + [ + -81.225123, + 37.235771 + ], + [ + -80.967707, + 37.290541 + ], + [ + -80.513121, + 37.482234 + ], + [ + -80.474782, + 37.421987 + ], + [ + -80.29952, + 37.509618 + ], + [ + -80.294043, + 37.690357 + ], + [ + -80.184505, + 37.849189 + ], + [ + -79.998289, + 37.997066 + ], + [ + -79.921611, + 38.177805 + ], + [ + -79.724442, + 38.364021 + ], + [ + -79.647764, + 38.594052 + ], + [ + -79.477979, + 38.457129 + ], + [ + -79.313671, + 38.413313 + ], + [ + -79.209609, + 38.495467 + ], + [ + -78.996008, + 38.851469 + ], + [ + -78.870039, + 38.763838 + ], + [ + -78.404499, + 39.169131 + ], + [ + -78.349729, + 39.464886 + ] + ] + ], + [ + [ + [ + -75.397659, + 38.013497 + ], + [ + -75.244304, + 38.029928 + ], + [ + -75.375751, + 37.860142 + ], + [ + -75.512674, + 37.799896 + ], + [ + -75.594828, + 37.569865 + ], + [ + -75.802952, + 37.197433 + ], + [ + -75.972737, + 37.120755 + ], + [ + -76.027507, + 37.257679 + ], + [ + -75.939876, + 37.564388 + ], + [ + -75.671506, + 37.95325 + ], + [ + -75.397659, + 38.013497 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "53", + "properties": { + "name": "Washington" + }, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -117.033359, + 49.000239 + ], + [ + -117.044313, + 47.762451 + ], + [ + -117.038836, + 46.426077 + ], + [ + -117.055267, + 46.343923 + ], + [ + -116.92382, + 46.168661 + ], + [ + -116.918344, + 45.993399 + ], + [ + -118.988627, + 45.998876 + ], + [ + -119.125551, + 45.933153 + ], + [ + -119.525367, + 45.911245 + ], + [ + -119.963522, + 45.823614 + ], + [ + -120.209985, + 45.725029 + ], + [ + -120.505739, + 45.697644 + ], + [ + -120.637186, + 45.746937 + ], + [ + -121.18488, + 45.604536 + ], + [ + -121.217742, + 45.670259 + ], + [ + -121.535404, + 45.725029 + ], + [ + -121.809251, + 45.708598 + ], + [ + -122.247407, + 45.549767 + ], + [ + -122.762239, + 45.659305 + ], + [ + -122.811531, + 45.960537 + ], + [ + -122.904639, + 46.08103 + ], + [ + -123.11824, + 46.185092 + ], + [ + -123.211348, + 46.174138 + ], + [ + -123.370179, + 46.146753 + ], + [ + -123.545441, + 46.261769 + ], + [ + -123.72618, + 46.300108 + ], + [ + -123.874058, + 46.239861 + ], + [ + -124.065751, + 46.327492 + ], + [ + -124.027412, + 46.464416 + ], + [ + -123.895966, + 46.535616 + ], + [ + -124.098612, + 46.74374 + ], + [ + -124.235536, + 47.285957 + ], + [ + -124.31769, + 47.357157 + ], + [ + -124.427229, + 47.740543 + ], + [ + -124.624399, + 47.88842 + ], + [ + -124.706553, + 48.184175 + ], + [ + -124.597014, + 48.381345 + ], + [ + -124.394367, + 48.288237 + ], + [ + -123.983597, + 48.162267 + ], + [ + -123.704273, + 48.167744 + ], + [ + -123.424949, + 48.118452 + ], + [ + -123.162056, + 48.167744 + ], + [ + -123.036086, + 48.080113 + ], + [ + -122.800578, + 48.08559 + ], + [ + -122.636269, + 47.866512 + ], + [ + -122.515777, + 47.882943 + ], + [ + -122.493869, + 47.587189 + ], + [ + -122.422669, + 47.318818 + ], + [ + -122.324084, + 47.346203 + ], + [ + -122.422669, + 47.576235 + ], + [ + -122.395284, + 47.800789 + ], + [ + -122.230976, + 48.030821 + ], + [ + -122.362422, + 48.123929 + ], + [ + -122.373376, + 48.288237 + ], + [ + -122.471961, + 48.468976 + ], + [ + -122.422669, + 48.600422 + ], + [ + -122.488392, + 48.753777 + ], + [ + -122.647223, + 48.775685 + ], + [ + -122.795101, + 48.8907 + ], + [ + -122.756762, + 49.000239 + ], + [ + -117.033359, + 49.000239 + ] + ] + ], + [ + [ + [ + -122.718423, + 48.310145 + ], + [ + -122.586977, + 48.35396 + ], + [ + -122.608885, + 48.151313 + ], + [ + -122.767716, + 48.227991 + ], + [ + -122.718423, + 48.310145 + ] + ] + ], + [ + [ + [ + -123.025132, + 48.583992 + ], + [ + -122.915593, + 48.715438 + ], + [ + -122.767716, + 48.556607 + ], + [ + -122.811531, + 48.419683 + ], + [ + -123.041563, + 48.458022 + ], + [ + -123.025132, + 48.583992 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "54", + "properties": { + "name": "West Virginia" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -80.518598, + 40.636951 + ], + [ + -80.518598, + 39.722302 + ], + [ + -79.477979, + 39.722302 + ], + [ + -79.488933, + 39.20747 + ], + [ + -79.291763, + 39.300578 + ], + [ + -79.094593, + 39.470363 + ], + [ + -78.963147, + 39.437501 + ], + [ + -78.765977, + 39.585379 + ], + [ + -78.470222, + 39.514178 + ], + [ + -78.431884, + 39.623717 + ], + [ + -78.267575, + 39.61824 + ], + [ + -78.174467, + 39.694917 + ], + [ + -78.004682, + 39.601809 + ], + [ + -77.834897, + 39.601809 + ], + [ + -77.719881, + 39.322485 + ], + [ + -77.82942, + 39.130793 + ], + [ + -78.349729, + 39.464886 + ], + [ + -78.404499, + 39.169131 + ], + [ + -78.870039, + 38.763838 + ], + [ + -78.996008, + 38.851469 + ], + [ + -79.209609, + 38.495467 + ], + [ + -79.313671, + 38.413313 + ], + [ + -79.477979, + 38.457129 + ], + [ + -79.647764, + 38.594052 + ], + [ + -79.724442, + 38.364021 + ], + [ + -79.921611, + 38.177805 + ], + [ + -79.998289, + 37.997066 + ], + [ + -80.184505, + 37.849189 + ], + [ + -80.294043, + 37.690357 + ], + [ + -80.29952, + 37.509618 + ], + [ + -80.474782, + 37.421987 + ], + [ + -80.513121, + 37.482234 + ], + [ + -80.967707, + 37.290541 + ], + [ + -81.225123, + 37.235771 + ], + [ + -81.362047, + 37.339833 + ], + [ + -81.55374, + 37.208387 + ], + [ + -81.679709, + 37.20291 + ], + [ + -81.849494, + 37.285064 + ], + [ + -81.986418, + 37.454849 + ], + [ + -81.969987, + 37.537003 + ], + [ + -82.101434, + 37.553434 + ], + [ + -82.293127, + 37.668449 + ], + [ + -82.342419, + 37.783465 + ], + [ + -82.50125, + 37.931343 + ], + [ + -82.621743, + 38.123036 + ], + [ + -82.594358, + 38.424267 + ], + [ + -82.331465, + 38.446175 + ], + [ + -82.293127, + 38.577622 + ], + [ + -82.172634, + 38.632391 + ], + [ + -82.221926, + 38.785745 + ], + [ + -82.03571, + 39.026731 + ], + [ + -81.887833, + 38.873376 + ], + [ + -81.783771, + 38.966484 + ], + [ + -81.811156, + 39.0815 + ], + [ + -81.685186, + 39.273193 + ], + [ + -81.57017, + 39.267716 + ], + [ + -81.455155, + 39.410117 + ], + [ + -81.345616, + 39.344393 + ], + [ + -81.219646, + 39.388209 + ], + [ + -80.830783, + 39.711348 + ], + [ + -80.737675, + 40.078303 + ], + [ + -80.600752, + 40.319289 + ], + [ + -80.595275, + 40.472643 + ], + [ + -80.666475, + 40.582182 + ], + [ + -80.518598, + 40.636951 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "55", + "properties": { + "name": "Wisconsin" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -90.415429, + 46.568478 + ], + [ + -90.229213, + 46.508231 + ], + [ + -90.119674, + 46.338446 + ], + [ + -89.09001, + 46.135799 + ], + [ + -88.662808, + 45.987922 + ], + [ + -88.531362, + 46.020784 + ], + [ + -88.10416, + 45.922199 + ], + [ + -87.989145, + 45.796229 + ], + [ + -87.781021, + 45.675736 + ], + [ + -87.791975, + 45.500474 + ], + [ + -87.885083, + 45.363551 + ], + [ + -87.649574, + 45.341643 + ], + [ + -87.742682, + 45.199243 + ], + [ + -87.589328, + 45.095181 + ], + [ + -87.627666, + 44.974688 + ], + [ + -87.819359, + 44.95278 + ], + [ + -87.983668, + 44.722749 + ], + [ + -88.043914, + 44.563917 + ], + [ + -87.928898, + 44.536533 + ], + [ + -87.775544, + 44.640595 + ], + [ + -87.611236, + 44.837764 + ], + [ + -87.403112, + 44.914442 + ], + [ + -87.238804, + 45.166381 + ], + [ + -87.03068, + 45.22115 + ], + [ + -87.047111, + 45.089704 + ], + [ + -87.189511, + 44.969211 + ], + [ + -87.468835, + 44.552964 + ], + [ + -87.545512, + 44.322932 + ], + [ + -87.540035, + 44.158624 + ], + [ + -87.644097, + 44.103854 + ], + [ + -87.737205, + 43.8793 + ], + [ + -87.704344, + 43.687607 + ], + [ + -87.791975, + 43.561637 + ], + [ + -87.912467, + 43.249452 + ], + [ + -87.885083, + 43.002989 + ], + [ + -87.76459, + 42.783912 + ], + [ + -87.802929, + 42.493634 + ], + [ + -88.788778, + 42.493634 + ], + [ + -90.639984, + 42.510065 + ], + [ + -90.711184, + 42.636034 + ], + [ + -91.067185, + 42.75105 + ], + [ + -91.143862, + 42.909881 + ], + [ + -91.176724, + 43.134436 + ], + [ + -91.056231, + 43.254929 + ], + [ + -91.204109, + 43.353514 + ], + [ + -91.215062, + 43.501391 + ], + [ + -91.269832, + 43.616407 + ], + [ + -91.242447, + 43.775238 + ], + [ + -91.43414, + 43.994316 + ], + [ + -91.592971, + 44.032654 + ], + [ + -91.877772, + 44.202439 + ], + [ + -91.927065, + 44.333886 + ], + [ + -92.233773, + 44.443425 + ], + [ + -92.337835, + 44.552964 + ], + [ + -92.545959, + 44.569394 + ], + [ + -92.808852, + 44.750133 + ], + [ + -92.737652, + 45.117088 + ], + [ + -92.75956, + 45.286874 + ], + [ + -92.644544, + 45.440228 + ], + [ + -92.770513, + 45.566198 + ], + [ + -92.885529, + 45.577151 + ], + [ + -92.869098, + 45.719552 + ], + [ + -92.639067, + 45.933153 + ], + [ + -92.354266, + 46.015307 + ], + [ + -92.29402, + 46.075553 + ], + [ + -92.29402, + 46.667063 + ], + [ + -92.091373, + 46.749217 + ], + [ + -92.014696, + 46.705401 + ], + [ + -91.790141, + 46.694447 + ], + [ + -91.09457, + 46.864232 + ], + [ + -90.837154, + 46.95734 + ], + [ + -90.749522, + 46.88614 + ], + [ + -90.886446, + 46.754694 + ], + [ + -90.55783, + 46.584908 + ], + [ + -90.415429, + 46.568478 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "56", + "properties": { + "name": "Wyoming" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -109.080842, + 45.002073 + ], + [ + -105.91517, + 45.002073 + ], + [ + -104.058488, + 44.996596 + ], + [ + -104.053011, + 43.002989 + ], + [ + -104.053011, + 41.003906 + ], + [ + -105.728954, + 40.998429 + ], + [ + -107.919731, + 41.003906 + ], + [ + -109.04798, + 40.998429 + ], + [ + -111.047063, + 40.998429 + ], + [ + -111.047063, + 42.000709 + ], + [ + -111.047063, + 44.476286 + ], + [ + -111.05254, + 45.002073 + ], + [ + -109.080842, + 45.002073 + ] + ] + ] + } + }, + { + "type": "Feature", + "id": "72", + "properties": { + "name": "Puerto Rico" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -66.448338, + 17.984326 + ], + [ + -66.771478, + 18.006234 + ], + [ + -66.924832, + 17.929556 + ], + [ + -66.985078, + 17.973372 + ], + [ + -67.209633, + 17.956941 + ], + [ + -67.154863, + 18.19245 + ], + [ + -67.269879, + 18.362235 + ], + [ + -67.094617, + 18.515589 + ], + [ + -66.957694, + 18.488204 + ], + [ + -66.409999, + 18.488204 + ], + [ + -65.840398, + 18.433435 + ], + [ + -65.632274, + 18.367712 + ], + [ + -65.626797, + 18.203403 + ], + [ + -65.730859, + 18.186973 + ], + [ + -65.834921, + 18.017187 + ], + [ + -66.234737, + 17.929556 + ], + [ + -66.448338, + 17.984326 + ] + ] + ] + } + } + ] + } \ No newline at end of file diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/LICENSE.txt b/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/LICENSE.txt new file mode 100644 index 0000000..542f653 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/LICENSE.txt @@ -0,0 +1,428 @@ +https://github.com/google/material-design-icons/blob/master/LICENSE +https://github.com/FezVrasta/bootstrap-material-design/blob/master/fonts/LICENSE.txt + +Attribution-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-ShareAlike 4.0 International Public +License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-ShareAlike 4.0 International Public License ("Public +License"). To the extent this Public License may be interpreted as a +contract, You are granted the Licensed Rights in consideration of Your +acceptance of these terms and conditions, and the Licensor grants You +such rights in consideration of benefits the Licensor receives from +making the Licensed Material available under these terms and +conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + l. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + m. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + + including for purposes of Section 3(b); and + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public licenses. +Notwithstanding, Creative Commons may elect to apply one of its public +licenses to material it publishes and in those instances will be +considered the "Licensor." Except for the limited purpose of indicating +that material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the public +licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.eot b/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.eot new file mode 100644 index 0000000..d9c296e Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.eot differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.svg b/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.svg new file mode 100644 index 0000000..def1e9b --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.svg @@ -0,0 +1,769 @@ + + + +Generated by IcoMoon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.ttf b/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.ttf new file mode 100644 index 0000000..e12f0cc Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.ttf differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.woff b/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.woff new file mode 100644 index 0000000..201581f Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.woff differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.woff2 b/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.woff2 new file mode 100644 index 0000000..5efd1b9 Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/material-design-icons/Material-Design-Icons.woff2 differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/materialize.min.css b/apps/mapvisuals/static/mapvisuals/css/lib/materialize.min.css new file mode 100644 index 0000000..fccfb80 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/css/lib/materialize.min.css @@ -0,0 +1,16 @@ +/*! + * Materialize v0.97.0 (http://materializecss.com) + * Copyright 2014-2015 Materialize + * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE) + */ +.materialize-red.lighten-5{background-color:#fdeaeb !important}.materialize-red-text.text-lighten-5{color:#fdeaeb !important}.materialize-red.lighten-4{background-color:#f8c1c3 !important}.materialize-red-text.text-lighten-4{color:#f8c1c3 !important}.materialize-red.lighten-3{background-color:#f3989b !important}.materialize-red-text.text-lighten-3{color:#f3989b !important}.materialize-red.lighten-2{background-color:#ee6e73 !important}.materialize-red-text.text-lighten-2{color:#ee6e73 !important}.materialize-red.lighten-1{background-color:#ea454b !important}.materialize-red-text.text-lighten-1{color:#ea454b !important}.materialize-red{background-color:#e51c23 !important}.materialize-red-text{color:#e51c23 !important}.materialize-red.darken-1{background-color:#d0181e !important}.materialize-red-text.text-darken-1{color:#d0181e !important}.materialize-red.darken-2{background-color:#b9151b !important}.materialize-red-text.text-darken-2{color:#b9151b !important}.materialize-red.darken-3{background-color:#a21318 !important}.materialize-red-text.text-darken-3{color:#a21318 !important}.materialize-red.darken-4{background-color:#8b1014 !important}.materialize-red-text.text-darken-4{color:#8b1014 !important}.red.lighten-5{background-color:#FFEBEE !important}.red-text.text-lighten-5{color:#FFEBEE !important}.red.lighten-4{background-color:#FFCDD2 !important}.red-text.text-lighten-4{color:#FFCDD2 !important}.red.lighten-3{background-color:#EF9A9A !important}.red-text.text-lighten-3{color:#EF9A9A !important}.red.lighten-2{background-color:#E57373 !important}.red-text.text-lighten-2{color:#E57373 !important}.red.lighten-1{background-color:#EF5350 !important}.red-text.text-lighten-1{color:#EF5350 !important}.red{background-color:#F44336 !important}.red-text{color:#F44336 !important}.red.darken-1{background-color:#E53935 !important}.red-text.text-darken-1{color:#E53935 !important}.red.darken-2{background-color:#D32F2F !important}.red-text.text-darken-2{color:#D32F2F !important}.red.darken-3{background-color:#C62828 !important}.red-text.text-darken-3{color:#C62828 !important}.red.darken-4{background-color:#B71C1C !important}.red-text.text-darken-4{color:#B71C1C !important}.red.accent-1{background-color:#FF8A80 !important}.red-text.text-accent-1{color:#FF8A80 !important}.red.accent-2{background-color:#FF5252 !important}.red-text.text-accent-2{color:#FF5252 !important}.red.accent-3{background-color:#FF1744 !important}.red-text.text-accent-3{color:#FF1744 !important}.red.accent-4{background-color:#D50000 !important}.red-text.text-accent-4{color:#D50000 !important}.pink.lighten-5{background-color:#fce4ec !important}.pink-text.text-lighten-5{color:#fce4ec !important}.pink.lighten-4{background-color:#f8bbd0 !important}.pink-text.text-lighten-4{color:#f8bbd0 !important}.pink.lighten-3{background-color:#f48fb1 !important}.pink-text.text-lighten-3{color:#f48fb1 !important}.pink.lighten-2{background-color:#f06292 !important}.pink-text.text-lighten-2{color:#f06292 !important}.pink.lighten-1{background-color:#ec407a !important}.pink-text.text-lighten-1{color:#ec407a !important}.pink{background-color:#e91e63 !important}.pink-text{color:#e91e63 !important}.pink.darken-1{background-color:#d81b60 !important}.pink-text.text-darken-1{color:#d81b60 !important}.pink.darken-2{background-color:#c2185b !important}.pink-text.text-darken-2{color:#c2185b !important}.pink.darken-3{background-color:#ad1457 !important}.pink-text.text-darken-3{color:#ad1457 !important}.pink.darken-4{background-color:#880e4f !important}.pink-text.text-darken-4{color:#880e4f !important}.pink.accent-1{background-color:#ff80ab !important}.pink-text.text-accent-1{color:#ff80ab !important}.pink.accent-2{background-color:#ff4081 !important}.pink-text.text-accent-2{color:#ff4081 !important}.pink.accent-3{background-color:#f50057 !important}.pink-text.text-accent-3{color:#f50057 !important}.pink.accent-4{background-color:#c51162 !important}.pink-text.text-accent-4{color:#c51162 !important}.purple.lighten-5{background-color:#f3e5f5 !important}.purple-text.text-lighten-5{color:#f3e5f5 !important}.purple.lighten-4{background-color:#e1bee7 !important}.purple-text.text-lighten-4{color:#e1bee7 !important}.purple.lighten-3{background-color:#ce93d8 !important}.purple-text.text-lighten-3{color:#ce93d8 !important}.purple.lighten-2{background-color:#ba68c8 !important}.purple-text.text-lighten-2{color:#ba68c8 !important}.purple.lighten-1{background-color:#ab47bc !important}.purple-text.text-lighten-1{color:#ab47bc !important}.purple{background-color:#9c27b0 !important}.purple-text{color:#9c27b0 !important}.purple.darken-1{background-color:#8e24aa !important}.purple-text.text-darken-1{color:#8e24aa !important}.purple.darken-2{background-color:#7b1fa2 !important}.purple-text.text-darken-2{color:#7b1fa2 !important}.purple.darken-3{background-color:#6a1b9a !important}.purple-text.text-darken-3{color:#6a1b9a !important}.purple.darken-4{background-color:#4a148c !important}.purple-text.text-darken-4{color:#4a148c !important}.purple.accent-1{background-color:#ea80fc !important}.purple-text.text-accent-1{color:#ea80fc !important}.purple.accent-2{background-color:#e040fb !important}.purple-text.text-accent-2{color:#e040fb !important}.purple.accent-3{background-color:#d500f9 !important}.purple-text.text-accent-3{color:#d500f9 !important}.purple.accent-4{background-color:#aa00ff !important}.purple-text.text-accent-4{color:#aa00ff !important}.deep-purple.lighten-5{background-color:#ede7f6 !important}.deep-purple-text.text-lighten-5{color:#ede7f6 !important}.deep-purple.lighten-4{background-color:#d1c4e9 !important}.deep-purple-text.text-lighten-4{color:#d1c4e9 !important}.deep-purple.lighten-3{background-color:#b39ddb !important}.deep-purple-text.text-lighten-3{color:#b39ddb !important}.deep-purple.lighten-2{background-color:#9575cd !important}.deep-purple-text.text-lighten-2{color:#9575cd !important}.deep-purple.lighten-1{background-color:#7e57c2 !important}.deep-purple-text.text-lighten-1{color:#7e57c2 !important}.deep-purple{background-color:#673ab7 !important}.deep-purple-text{color:#673ab7 !important}.deep-purple.darken-1{background-color:#5e35b1 !important}.deep-purple-text.text-darken-1{color:#5e35b1 !important}.deep-purple.darken-2{background-color:#512da8 !important}.deep-purple-text.text-darken-2{color:#512da8 !important}.deep-purple.darken-3{background-color:#4527a0 !important}.deep-purple-text.text-darken-3{color:#4527a0 !important}.deep-purple.darken-4{background-color:#311b92 !important}.deep-purple-text.text-darken-4{color:#311b92 !important}.deep-purple.accent-1{background-color:#b388ff !important}.deep-purple-text.text-accent-1{color:#b388ff !important}.deep-purple.accent-2{background-color:#7c4dff !important}.deep-purple-text.text-accent-2{color:#7c4dff !important}.deep-purple.accent-3{background-color:#651fff !important}.deep-purple-text.text-accent-3{color:#651fff !important}.deep-purple.accent-4{background-color:#6200ea !important}.deep-purple-text.text-accent-4{color:#6200ea !important}.indigo.lighten-5{background-color:#e8eaf6 !important}.indigo-text.text-lighten-5{color:#e8eaf6 !important}.indigo.lighten-4{background-color:#c5cae9 !important}.indigo-text.text-lighten-4{color:#c5cae9 !important}.indigo.lighten-3{background-color:#9fa8da !important}.indigo-text.text-lighten-3{color:#9fa8da !important}.indigo.lighten-2{background-color:#7986cb !important}.indigo-text.text-lighten-2{color:#7986cb !important}.indigo.lighten-1{background-color:#5c6bc0 !important}.indigo-text.text-lighten-1{color:#5c6bc0 !important}.indigo{background-color:#3f51b5 !important}.indigo-text{color:#3f51b5 !important}.indigo.darken-1{background-color:#3949ab !important}.indigo-text.text-darken-1{color:#3949ab !important}.indigo.darken-2{background-color:#303f9f !important}.indigo-text.text-darken-2{color:#303f9f !important}.indigo.darken-3{background-color:#283593 !important}.indigo-text.text-darken-3{color:#283593 !important}.indigo.darken-4{background-color:#1a237e !important}.indigo-text.text-darken-4{color:#1a237e !important}.indigo.accent-1{background-color:#8c9eff !important}.indigo-text.text-accent-1{color:#8c9eff !important}.indigo.accent-2{background-color:#536dfe !important}.indigo-text.text-accent-2{color:#536dfe !important}.indigo.accent-3{background-color:#3d5afe !important}.indigo-text.text-accent-3{color:#3d5afe !important}.indigo.accent-4{background-color:#304ffe !important}.indigo-text.text-accent-4{color:#304ffe !important}.blue.lighten-5{background-color:#E3F2FD !important}.blue-text.text-lighten-5{color:#E3F2FD !important}.blue.lighten-4{background-color:#BBDEFB !important}.blue-text.text-lighten-4{color:#BBDEFB !important}.blue.lighten-3{background-color:#90CAF9 !important}.blue-text.text-lighten-3{color:#90CAF9 !important}.blue.lighten-2{background-color:#64B5F6 !important}.blue-text.text-lighten-2{color:#64B5F6 !important}.blue.lighten-1{background-color:#42A5F5 !important}.blue-text.text-lighten-1{color:#42A5F5 !important}.blue{background-color:#2196F3 !important}.blue-text{color:#2196F3 !important}.blue.darken-1{background-color:#1E88E5 !important}.blue-text.text-darken-1{color:#1E88E5 !important}.blue.darken-2{background-color:#1976D2 !important}.blue-text.text-darken-2{color:#1976D2 !important}.blue.darken-3{background-color:#1565C0 !important}.blue-text.text-darken-3{color:#1565C0 !important}.blue.darken-4{background-color:#0D47A1 !important}.blue-text.text-darken-4{color:#0D47A1 !important}.blue.accent-1{background-color:#82B1FF !important}.blue-text.text-accent-1{color:#82B1FF !important}.blue.accent-2{background-color:#448AFF !important}.blue-text.text-accent-2{color:#448AFF !important}.blue.accent-3{background-color:#2979FF !important}.blue-text.text-accent-3{color:#2979FF !important}.blue.accent-4{background-color:#2962FF !important}.blue-text.text-accent-4{color:#2962FF !important}.light-blue.lighten-5{background-color:#e1f5fe !important}.light-blue-text.text-lighten-5{color:#e1f5fe !important}.light-blue.lighten-4{background-color:#b3e5fc !important}.light-blue-text.text-lighten-4{color:#b3e5fc !important}.light-blue.lighten-3{background-color:#81d4fa !important}.light-blue-text.text-lighten-3{color:#81d4fa !important}.light-blue.lighten-2{background-color:#4fc3f7 !important}.light-blue-text.text-lighten-2{color:#4fc3f7 !important}.light-blue.lighten-1{background-color:#29b6f6 !important}.light-blue-text.text-lighten-1{color:#29b6f6 !important}.light-blue{background-color:#03a9f4 !important}.light-blue-text{color:#03a9f4 !important}.light-blue.darken-1{background-color:#039be5 !important}.light-blue-text.text-darken-1{color:#039be5 !important}.light-blue.darken-2{background-color:#0288d1 !important}.light-blue-text.text-darken-2{color:#0288d1 !important}.light-blue.darken-3{background-color:#0277bd !important}.light-blue-text.text-darken-3{color:#0277bd !important}.light-blue.darken-4{background-color:#01579b !important}.light-blue-text.text-darken-4{color:#01579b !important}.light-blue.accent-1{background-color:#80d8ff !important}.light-blue-text.text-accent-1{color:#80d8ff !important}.light-blue.accent-2{background-color:#40c4ff !important}.light-blue-text.text-accent-2{color:#40c4ff !important}.light-blue.accent-3{background-color:#00b0ff !important}.light-blue-text.text-accent-3{color:#00b0ff !important}.light-blue.accent-4{background-color:#0091ea !important}.light-blue-text.text-accent-4{color:#0091ea !important}.cyan.lighten-5{background-color:#e0f7fa !important}.cyan-text.text-lighten-5{color:#e0f7fa !important}.cyan.lighten-4{background-color:#b2ebf2 !important}.cyan-text.text-lighten-4{color:#b2ebf2 !important}.cyan.lighten-3{background-color:#80deea !important}.cyan-text.text-lighten-3{color:#80deea !important}.cyan.lighten-2{background-color:#4dd0e1 !important}.cyan-text.text-lighten-2{color:#4dd0e1 !important}.cyan.lighten-1{background-color:#26c6da !important}.cyan-text.text-lighten-1{color:#26c6da !important}.cyan{background-color:#00bcd4 !important}.cyan-text{color:#00bcd4 !important}.cyan.darken-1{background-color:#00acc1 !important}.cyan-text.text-darken-1{color:#00acc1 !important}.cyan.darken-2{background-color:#0097a7 !important}.cyan-text.text-darken-2{color:#0097a7 !important}.cyan.darken-3{background-color:#00838f !important}.cyan-text.text-darken-3{color:#00838f !important}.cyan.darken-4{background-color:#006064 !important}.cyan-text.text-darken-4{color:#006064 !important}.cyan.accent-1{background-color:#84ffff !important}.cyan-text.text-accent-1{color:#84ffff !important}.cyan.accent-2{background-color:#18ffff !important}.cyan-text.text-accent-2{color:#18ffff !important}.cyan.accent-3{background-color:#00e5ff !important}.cyan-text.text-accent-3{color:#00e5ff !important}.cyan.accent-4{background-color:#00b8d4 !important}.cyan-text.text-accent-4{color:#00b8d4 !important}.teal.lighten-5{background-color:#e0f2f1 !important}.teal-text.text-lighten-5{color:#e0f2f1 !important}.teal.lighten-4{background-color:#b2dfdb !important}.teal-text.text-lighten-4{color:#b2dfdb !important}.teal.lighten-3{background-color:#80cbc4 !important}.teal-text.text-lighten-3{color:#80cbc4 !important}.teal.lighten-2{background-color:#4db6ac !important}.teal-text.text-lighten-2{color:#4db6ac !important}.teal.lighten-1{background-color:#26a69a !important}.teal-text.text-lighten-1{color:#26a69a !important}.teal{background-color:#009688 !important}.teal-text{color:#009688 !important}.teal.darken-1{background-color:#00897b !important}.teal-text.text-darken-1{color:#00897b !important}.teal.darken-2{background-color:#00796b !important}.teal-text.text-darken-2{color:#00796b !important}.teal.darken-3{background-color:#00695c !important}.teal-text.text-darken-3{color:#00695c !important}.teal.darken-4{background-color:#004d40 !important}.teal-text.text-darken-4{color:#004d40 !important}.teal.accent-1{background-color:#a7ffeb !important}.teal-text.text-accent-1{color:#a7ffeb !important}.teal.accent-2{background-color:#64ffda !important}.teal-text.text-accent-2{color:#64ffda !important}.teal.accent-3{background-color:#1de9b6 !important}.teal-text.text-accent-3{color:#1de9b6 !important}.teal.accent-4{background-color:#00bfa5 !important}.teal-text.text-accent-4{color:#00bfa5 !important}.green.lighten-5{background-color:#E8F5E9 !important}.green-text.text-lighten-5{color:#E8F5E9 !important}.green.lighten-4{background-color:#C8E6C9 !important}.green-text.text-lighten-4{color:#C8E6C9 !important}.green.lighten-3{background-color:#A5D6A7 !important}.green-text.text-lighten-3{color:#A5D6A7 !important}.green.lighten-2{background-color:#81C784 !important}.green-text.text-lighten-2{color:#81C784 !important}.green.lighten-1{background-color:#66BB6A !important}.green-text.text-lighten-1{color:#66BB6A !important}.green{background-color:#4CAF50 !important}.green-text{color:#4CAF50 !important}.green.darken-1{background-color:#43A047 !important}.green-text.text-darken-1{color:#43A047 !important}.green.darken-2{background-color:#388E3C !important}.green-text.text-darken-2{color:#388E3C !important}.green.darken-3{background-color:#2E7D32 !important}.green-text.text-darken-3{color:#2E7D32 !important}.green.darken-4{background-color:#1B5E20 !important}.green-text.text-darken-4{color:#1B5E20 !important}.green.accent-1{background-color:#B9F6CA !important}.green-text.text-accent-1{color:#B9F6CA !important}.green.accent-2{background-color:#69F0AE !important}.green-text.text-accent-2{color:#69F0AE !important}.green.accent-3{background-color:#00E676 !important}.green-text.text-accent-3{color:#00E676 !important}.green.accent-4{background-color:#00C853 !important}.green-text.text-accent-4{color:#00C853 !important}.light-green.lighten-5{background-color:#f1f8e9 !important}.light-green-text.text-lighten-5{color:#f1f8e9 !important}.light-green.lighten-4{background-color:#dcedc8 !important}.light-green-text.text-lighten-4{color:#dcedc8 !important}.light-green.lighten-3{background-color:#c5e1a5 !important}.light-green-text.text-lighten-3{color:#c5e1a5 !important}.light-green.lighten-2{background-color:#aed581 !important}.light-green-text.text-lighten-2{color:#aed581 !important}.light-green.lighten-1{background-color:#9ccc65 !important}.light-green-text.text-lighten-1{color:#9ccc65 !important}.light-green{background-color:#8bc34a !important}.light-green-text{color:#8bc34a !important}.light-green.darken-1{background-color:#7cb342 !important}.light-green-text.text-darken-1{color:#7cb342 !important}.light-green.darken-2{background-color:#689f38 !important}.light-green-text.text-darken-2{color:#689f38 !important}.light-green.darken-3{background-color:#558b2f !important}.light-green-text.text-darken-3{color:#558b2f !important}.light-green.darken-4{background-color:#33691e !important}.light-green-text.text-darken-4{color:#33691e !important}.light-green.accent-1{background-color:#ccff90 !important}.light-green-text.text-accent-1{color:#ccff90 !important}.light-green.accent-2{background-color:#b2ff59 !important}.light-green-text.text-accent-2{color:#b2ff59 !important}.light-green.accent-3{background-color:#76ff03 !important}.light-green-text.text-accent-3{color:#76ff03 !important}.light-green.accent-4{background-color:#64dd17 !important}.light-green-text.text-accent-4{color:#64dd17 !important}.lime.lighten-5{background-color:#f9fbe7 !important}.lime-text.text-lighten-5{color:#f9fbe7 !important}.lime.lighten-4{background-color:#f0f4c3 !important}.lime-text.text-lighten-4{color:#f0f4c3 !important}.lime.lighten-3{background-color:#e6ee9c !important}.lime-text.text-lighten-3{color:#e6ee9c !important}.lime.lighten-2{background-color:#dce775 !important}.lime-text.text-lighten-2{color:#dce775 !important}.lime.lighten-1{background-color:#d4e157 !important}.lime-text.text-lighten-1{color:#d4e157 !important}.lime{background-color:#cddc39 !important}.lime-text{color:#cddc39 !important}.lime.darken-1{background-color:#c0ca33 !important}.lime-text.text-darken-1{color:#c0ca33 !important}.lime.darken-2{background-color:#afb42b !important}.lime-text.text-darken-2{color:#afb42b !important}.lime.darken-3{background-color:#9e9d24 !important}.lime-text.text-darken-3{color:#9e9d24 !important}.lime.darken-4{background-color:#827717 !important}.lime-text.text-darken-4{color:#827717 !important}.lime.accent-1{background-color:#f4ff81 !important}.lime-text.text-accent-1{color:#f4ff81 !important}.lime.accent-2{background-color:#eeff41 !important}.lime-text.text-accent-2{color:#eeff41 !important}.lime.accent-3{background-color:#c6ff00 !important}.lime-text.text-accent-3{color:#c6ff00 !important}.lime.accent-4{background-color:#aeea00 !important}.lime-text.text-accent-4{color:#aeea00 !important}.yellow.lighten-5{background-color:#fffde7 !important}.yellow-text.text-lighten-5{color:#fffde7 !important}.yellow.lighten-4{background-color:#fff9c4 !important}.yellow-text.text-lighten-4{color:#fff9c4 !important}.yellow.lighten-3{background-color:#fff59d !important}.yellow-text.text-lighten-3{color:#fff59d !important}.yellow.lighten-2{background-color:#fff176 !important}.yellow-text.text-lighten-2{color:#fff176 !important}.yellow.lighten-1{background-color:#ffee58 !important}.yellow-text.text-lighten-1{color:#ffee58 !important}.yellow{background-color:#ffeb3b !important}.yellow-text{color:#ffeb3b !important}.yellow.darken-1{background-color:#fdd835 !important}.yellow-text.text-darken-1{color:#fdd835 !important}.yellow.darken-2{background-color:#fbc02d !important}.yellow-text.text-darken-2{color:#fbc02d !important}.yellow.darken-3{background-color:#f9a825 !important}.yellow-text.text-darken-3{color:#f9a825 !important}.yellow.darken-4{background-color:#f57f17 !important}.yellow-text.text-darken-4{color:#f57f17 !important}.yellow.accent-1{background-color:#ffff8d !important}.yellow-text.text-accent-1{color:#ffff8d !important}.yellow.accent-2{background-color:#ffff00 !important}.yellow-text.text-accent-2{color:#ffff00 !important}.yellow.accent-3{background-color:#ffea00 !important}.yellow-text.text-accent-3{color:#ffea00 !important}.yellow.accent-4{background-color:#ffd600 !important}.yellow-text.text-accent-4{color:#ffd600 !important}.amber.lighten-5{background-color:#fff8e1 !important}.amber-text.text-lighten-5{color:#fff8e1 !important}.amber.lighten-4{background-color:#ffecb3 !important}.amber-text.text-lighten-4{color:#ffecb3 !important}.amber.lighten-3{background-color:#ffe082 !important}.amber-text.text-lighten-3{color:#ffe082 !important}.amber.lighten-2{background-color:#ffd54f !important}.amber-text.text-lighten-2{color:#ffd54f !important}.amber.lighten-1{background-color:#ffca28 !important}.amber-text.text-lighten-1{color:#ffca28 !important}.amber{background-color:#ffc107 !important}.amber-text{color:#ffc107 !important}.amber.darken-1{background-color:#ffb300 !important}.amber-text.text-darken-1{color:#ffb300 !important}.amber.darken-2{background-color:#ffa000 !important}.amber-text.text-darken-2{color:#ffa000 !important}.amber.darken-3{background-color:#ff8f00 !important}.amber-text.text-darken-3{color:#ff8f00 !important}.amber.darken-4{background-color:#ff6f00 !important}.amber-text.text-darken-4{color:#ff6f00 !important}.amber.accent-1{background-color:#ffe57f !important}.amber-text.text-accent-1{color:#ffe57f !important}.amber.accent-2{background-color:#ffd740 !important}.amber-text.text-accent-2{color:#ffd740 !important}.amber.accent-3{background-color:#ffc400 !important}.amber-text.text-accent-3{color:#ffc400 !important}.amber.accent-4{background-color:#ffab00 !important}.amber-text.text-accent-4{color:#ffab00 !important}.orange.lighten-5{background-color:#fff3e0 !important}.orange-text.text-lighten-5{color:#fff3e0 !important}.orange.lighten-4{background-color:#ffe0b2 !important}.orange-text.text-lighten-4{color:#ffe0b2 !important}.orange.lighten-3{background-color:#ffcc80 !important}.orange-text.text-lighten-3{color:#ffcc80 !important}.orange.lighten-2{background-color:#ffb74d !important}.orange-text.text-lighten-2{color:#ffb74d !important}.orange.lighten-1{background-color:#ffa726 !important}.orange-text.text-lighten-1{color:#ffa726 !important}.orange{background-color:#ff9800 !important}.orange-text{color:#ff9800 !important}.orange.darken-1{background-color:#fb8c00 !important}.orange-text.text-darken-1{color:#fb8c00 !important}.orange.darken-2{background-color:#f57c00 !important}.orange-text.text-darken-2{color:#f57c00 !important}.orange.darken-3{background-color:#ef6c00 !important}.orange-text.text-darken-3{color:#ef6c00 !important}.orange.darken-4{background-color:#e65100 !important}.orange-text.text-darken-4{color:#e65100 !important}.orange.accent-1{background-color:#ffd180 !important}.orange-text.text-accent-1{color:#ffd180 !important}.orange.accent-2{background-color:#ffab40 !important}.orange-text.text-accent-2{color:#ffab40 !important}.orange.accent-3{background-color:#ff9100 !important}.orange-text.text-accent-3{color:#ff9100 !important}.orange.accent-4{background-color:#ff6d00 !important}.orange-text.text-accent-4{color:#ff6d00 !important}.deep-orange.lighten-5{background-color:#fbe9e7 !important}.deep-orange-text.text-lighten-5{color:#fbe9e7 !important}.deep-orange.lighten-4{background-color:#ffccbc !important}.deep-orange-text.text-lighten-4{color:#ffccbc !important}.deep-orange.lighten-3{background-color:#ffab91 !important}.deep-orange-text.text-lighten-3{color:#ffab91 !important}.deep-orange.lighten-2{background-color:#ff8a65 !important}.deep-orange-text.text-lighten-2{color:#ff8a65 !important}.deep-orange.lighten-1{background-color:#ff7043 !important}.deep-orange-text.text-lighten-1{color:#ff7043 !important}.deep-orange{background-color:#ff5722 !important}.deep-orange-text{color:#ff5722 !important}.deep-orange.darken-1{background-color:#f4511e !important}.deep-orange-text.text-darken-1{color:#f4511e !important}.deep-orange.darken-2{background-color:#e64a19 !important}.deep-orange-text.text-darken-2{color:#e64a19 !important}.deep-orange.darken-3{background-color:#d84315 !important}.deep-orange-text.text-darken-3{color:#d84315 !important}.deep-orange.darken-4{background-color:#bf360c !important}.deep-orange-text.text-darken-4{color:#bf360c !important}.deep-orange.accent-1{background-color:#ff9e80 !important}.deep-orange-text.text-accent-1{color:#ff9e80 !important}.deep-orange.accent-2{background-color:#ff6e40 !important}.deep-orange-text.text-accent-2{color:#ff6e40 !important}.deep-orange.accent-3{background-color:#ff3d00 !important}.deep-orange-text.text-accent-3{color:#ff3d00 !important}.deep-orange.accent-4{background-color:#dd2c00 !important}.deep-orange-text.text-accent-4{color:#dd2c00 !important}.brown.lighten-5{background-color:#efebe9 !important}.brown-text.text-lighten-5{color:#efebe9 !important}.brown.lighten-4{background-color:#d7ccc8 !important}.brown-text.text-lighten-4{color:#d7ccc8 !important}.brown.lighten-3{background-color:#bcaaa4 !important}.brown-text.text-lighten-3{color:#bcaaa4 !important}.brown.lighten-2{background-color:#a1887f !important}.brown-text.text-lighten-2{color:#a1887f !important}.brown.lighten-1{background-color:#8d6e63 !important}.brown-text.text-lighten-1{color:#8d6e63 !important}.brown{background-color:#795548 !important}.brown-text{color:#795548 !important}.brown.darken-1{background-color:#6d4c41 !important}.brown-text.text-darken-1{color:#6d4c41 !important}.brown.darken-2{background-color:#5d4037 !important}.brown-text.text-darken-2{color:#5d4037 !important}.brown.darken-3{background-color:#4e342e !important}.brown-text.text-darken-3{color:#4e342e !important}.brown.darken-4{background-color:#3e2723 !important}.brown-text.text-darken-4{color:#3e2723 !important}.blue-grey.lighten-5{background-color:#eceff1 !important}.blue-grey-text.text-lighten-5{color:#eceff1 !important}.blue-grey.lighten-4{background-color:#cfd8dc !important}.blue-grey-text.text-lighten-4{color:#cfd8dc !important}.blue-grey.lighten-3{background-color:#b0bec5 !important}.blue-grey-text.text-lighten-3{color:#b0bec5 !important}.blue-grey.lighten-2{background-color:#90a4ae !important}.blue-grey-text.text-lighten-2{color:#90a4ae !important}.blue-grey.lighten-1{background-color:#78909c !important}.blue-grey-text.text-lighten-1{color:#78909c !important}.blue-grey{background-color:#607d8b !important}.blue-grey-text{color:#607d8b !important}.blue-grey.darken-1{background-color:#546e7a !important}.blue-grey-text.text-darken-1{color:#546e7a !important}.blue-grey.darken-2{background-color:#455a64 !important}.blue-grey-text.text-darken-2{color:#455a64 !important}.blue-grey.darken-3{background-color:#37474f !important}.blue-grey-text.text-darken-3{color:#37474f !important}.blue-grey.darken-4{background-color:#263238 !important}.blue-grey-text.text-darken-4{color:#263238 !important}.grey.lighten-5{background-color:#fafafa !important}.grey-text.text-lighten-5{color:#fafafa !important}.grey.lighten-4{background-color:#f5f5f5 !important}.grey-text.text-lighten-4{color:#f5f5f5 !important}.grey.lighten-3{background-color:#eeeeee !important}.grey-text.text-lighten-3{color:#eeeeee !important}.grey.lighten-2{background-color:#e0e0e0 !important}.grey-text.text-lighten-2{color:#e0e0e0 !important}.grey.lighten-1{background-color:#bdbdbd !important}.grey-text.text-lighten-1{color:#bdbdbd !important}.grey{background-color:#9e9e9e !important}.grey-text{color:#9e9e9e !important}.grey.darken-1{background-color:#757575 !important}.grey-text.text-darken-1{color:#757575 !important}.grey.darken-2{background-color:#616161 !important}.grey-text.text-darken-2{color:#616161 !important}.grey.darken-3{background-color:#424242 !important}.grey-text.text-darken-3{color:#424242 !important}.grey.darken-4{background-color:#212121 !important}.grey-text.text-darken-4{color:#212121 !important}.shades.black{background-color:#000000 !important}.shades-text.text-black{color:#000000 !important}.shades.white{background-color:#FFFFFF !important}.shades-text.text-white{color:#FFFFFF !important}.shades.transparent{background-color:transparent !important}.shades-text.text-transparent{color:transparent !important}.black{background-color:#000000 !important}.black-text{color:#000000 !important}.white{background-color:#FFFFFF !important}.white-text{color:#FFFFFF !important}.transparent{background-color:transparent !important}.transparent-text{color:transparent !important}/*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}html input[type="button"],button,input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}ul{list-style-type:none}a{color:#039be5;text-decoration:none;-webkit-tap-highlight-color:transparent}.valign-wrapper{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-flex-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center}.valign-wrapper .valign{display:block}ul{padding:0}ul li{list-style-type:none}.clearfix{clear:both}.z-depth-0{box-shadow:none !important}.z-depth-1,nav,.card-panel,.card,.toast,.btn,.btn-large,.btn-floating,.dropdown-content,.collapsible,.side-nav{box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12)}.z-depth-1-half,.btn:hover,.btn-large:hover,.btn-floating:hover{box-shadow:0 5px 11px 0 rgba(0,0,0,0.18),0 4px 15px 0 rgba(0,0,0,0.15)}.z-depth-2{box-shadow:0 8px 17px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19)}.z-depth-3{box-shadow:0 12px 15px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19)}.z-depth-4,.modal{box-shadow:0 16px 28px 0 rgba(0,0,0,0.22),0 25px 55px 0 rgba(0,0,0,0.21)}.z-depth-5{box-shadow:0 27px 24px 0 rgba(0,0,0,0.2),0 40px 77px 0 rgba(0,0,0,0.22)}.hoverable:hover{transition:box-shadow .25s;box-shadow:0 8px 17px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19)}.divider{height:1px;overflow:hidden;background-color:#e0e0e0}blockquote{margin:20px 0;padding-left:1.5rem;border-left:5px solid #ee6e73}i{line-height:inherit}i.left{float:left;margin-right:15px}i.right{float:right;margin-left:15px}i.tiny{font-size:1rem}i.small{font-size:2rem}i.medium{font-size:4rem}i.large{font-size:6rem}img.responsive-img,video.responsive-video{max-width:100%;height:auto}.pagination li{float:left;font-size:1.2rem;padding:0 10px;line-height:30px;border-radius:2px;text-align:center}.pagination li a{color:#444}.pagination li.active a{color:#fff}.pagination li.active{background-color:#ee6e73}.pagination li.disabled a{cursor:default;color:#999}.pagination li i{font-size:2rem}.pagination li.pages ul li{display:inline-block;float:none}@media only screen and (max-width : 992px){.pagination{width:100%}.pagination li.prev,.pagination li.next{width:10%}.pagination li.pages{width:80%;overflow:hidden;white-space:nowrap}}.parallax-container{position:relative;overflow:hidden;height:500px}.parallax{position:absolute;top:0;left:0;right:0;bottom:0;z-index:-1}.parallax img{display:none;position:absolute;left:50%;bottom:0;min-width:100%;min-height:100%;-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);transform:translateX(-50%)}.pin-top,.pin-bottom{position:relative}.pinned{position:fixed !important}ul.staggered-list li{opacity:0}.fade-in{opacity:0;transform-origin:0 50%}@media only screen and (max-width : 600px){.hide-on-small-only,.hide-on-small-and-down{display:none !important;}}@media only screen and (max-width : 992px){.hide-on-med-and-down{display:none !important;}}@media only screen and (min-width : 601px){.hide-on-med-and-up{display:none !important;}}@media only screen and (min-width: 600px) and (max-width: 992px){.hide-on-med-only{display:none !important;}}@media only screen and (min-width : 993px){.hide-on-large-only{display:none !important;}}@media only screen and (min-width : 993px){.show-on-large{display:initial !important;}}@media only screen and (min-width: 600px) and (max-width: 992px){.show-on-medium{display:initial !important;}}@media only screen and (max-width : 600px){.show-on-small{display:initial !important;}}@media only screen and (min-width : 601px){.show-on-medium-and-up{display:initial !important;}}@media only screen and (max-width : 992px){.show-on-medium-and-down{display:initial !important;}}@media only screen and (max-width : 600px){.center-on-small-only{text-align:center;}}footer.page-footer{margin-top:20px;padding-top:20px;background-color:#ee6e73}footer.page-footer .footer-copyright{overflow:hidden;height:50px;line-height:50px;color:rgba(255,255,255,0.8);background-color:rgba(51,51,51,0.08)}table,th,td{border:none}table{width:100%;display:table}table.bordered>thead>tr,table.bordered>tbody>tr{border-bottom:1px solid #d0d0d0}table.striped>tbody>tr:nth-child(odd){background-color:#f2f2f2}table.striped>tbody>tr>td{border-radius:0px}table.hoverable>tbody>tr{-webkit-transition:background-color .25s ease;-moz-transition:background-color .25s ease;-o-transition:background-color .25s ease;-ms-transition:background-color .25s ease;transition:background-color .25s ease}table.hoverable>tbody>tr:hover{background-color:#f2f2f2}table.centered thead tr th,table.centered tbody tr td{text-align:center}thead{border-bottom:1px solid #d0d0d0}td,th{padding:15px 5px;display:table-cell;text-align:left;vertical-align:middle;border-radius:2px}@media only screen and (max-width : 992px){table.responsive-table{width:100%;border-collapse:collapse;border-spacing:0;display:block;position:relative}table.responsive-table th,table.responsive-table td{margin:0;vertical-align:top}table.responsive-table th{text-align:left}table.responsive-table thead{display:block;float:left}table.responsive-table thead tr{display:block;padding:0 10px 0 0}table.responsive-table thead tr th::before{content:"\00a0"}table.responsive-table tbody{display:block;width:auto;position:relative;overflow-x:auto;white-space:nowrap}table.responsive-table tbody tr{display:inline-block;vertical-align:top}table.responsive-table th{display:block;text-align:right}table.responsive-table td{display:block;min-height:1.25em;text-align:left}table.responsive-table tr{padding:0 10px}table.responsive-table thead{border:0;border-right:1px solid #d0d0d0}table.responsive-table.bordered th{border-bottom:0;border-left:0}table.responsive-table.bordered td{border-left:0;border-right:0;border-bottom:0}table.responsive-table.bordered tr{border:0}table.responsive-table.bordered tbody tr{border-right:1px solid #d0d0d0}}.collection{margin:0.5rem 0 1rem 0;border:1px solid #e0e0e0;border-radius:2px;overflow:hidden;position:relative}.collection .collection-item{background-color:#fff;line-height:1.5rem;padding:10px 20px;margin:0;border-bottom:1px solid #e0e0e0}.collection .collection-item.avatar{min-height:84px;padding-left:72px;position:relative}.collection .collection-item.avatar .circle{position:absolute;width:42px;height:42px;overflow:hidden;left:15px;display:inline-block;vertical-align:middle}.collection .collection-item.avatar i.circle{font-size:18px;line-height:42px;color:#fff;background-color:#999;text-align:center}.collection .collection-item.avatar .title{font-size:16px}.collection .collection-item.avatar p{margin:0}.collection .collection-item.avatar .secondary-content{position:absolute;top:16px;right:16px}.collection .collection-item:last-child{border-bottom:none}.collection .collection-item.active{background-color:#26a69a;color:#eafaf9}.collection a.collection-item{display:block;-webkit-transition:0.25s;-moz-transition:0.25s;-o-transition:0.25s;-ms-transition:0.25s;transition:0.25s;color:#26a69a}.collection a.collection-item:not(.active):hover{background-color:#ddd}.collection.with-header .collection-header{background-color:#fff;border-bottom:1px solid #e0e0e0;padding:10px 20px}.collection.with-header .collection-item{padding-left:30px}.collection.with-header .collection-item.avatar{padding-left:72px}.secondary-content{float:right;color:#26a69a}span.badge{min-width:3rem;padding:0 6px;text-align:center;font-size:1rem;line-height:inherit;color:#757575;position:absolute;right:15px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}span.badge.new{font-weight:300;font-size:0.8rem;color:#fff;background-color:#26a69a;border-radius:2px}span.badge.new:after{content:" new"}.video-container{position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden}.video-container.no-controls{padding-top:0}.video-container iframe,.video-container object,.video-container embed{position:absolute;top:0;left:0;width:100%;height:100%}.progress{position:relative;height:4px;display:block;width:100%;background-color:#acece6;border-radius:2px;margin:0.5rem 0 1rem 0;overflow:hidden}.progress .determinate{position:absolute;background-color:inherit;top:0;left:0;bottom:0;background-color:#26a69a;-webkit-transition:width .3s linear;-moz-transition:width .3s linear;-o-transition:width .3s linear;-ms-transition:width .3s linear;transition:width .3s linear}.progress .indeterminate{background-color:#26a69a}.progress .indeterminate:before{content:'';position:absolute;background-color:inherit;top:0;left:0;bottom:0;will-change:left, right;-webkit-animation:indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;-moz-animation:indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;-ms-animation:indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;-o-animation:indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;animation:indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite}.progress .indeterminate:after{content:'';position:absolute;background-color:inherit;top:0;left:0;bottom:0;will-change:left, right;-webkit-animation:indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;-moz-animation:indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;-ms-animation:indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;-o-animation:indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;animation:indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;-webkit-animation-delay:1.15s;-moz-animation-delay:1.15s;-ms-animation-delay:1.15s;-o-animation-delay:1.15s;animation-delay:1.15s}@-webkit-keyframes indeterminate{0%{left:-35%;right:100%}60%{left:100%;right:-90%}100%{left:100%;right:-90%}}@-moz-keyframes indeterminate{0%{left:-35%;right:100%}60%{left:100%;right:-90%}100%{left:100%;right:-90%}}@keyframes indeterminate{0%{left:-35%;right:100%}60%{left:100%;right:-90%}100%{left:100%;right:-90%}}@-webkit-keyframes indeterminate-short{0%{left:-200%;right:100%}60%{left:107%;right:-8%}100%{left:107%;right:-8%}}@-moz-keyframes indeterminate-short{0%{left:-200%;right:100%}60%{left:107%;right:-8%}100%{left:107%;right:-8%}}@keyframes indeterminate-short{0%{left:-200%;right:100%}60%{left:107%;right:-8%}100%{left:107%;right:-8%}}.hide{display:none !important}.left-align{text-align:left}.right-align{text-align:right}.center,.center-align{text-align:center}.left{float:left !important}.right{float:right !important}.no-select,input[type=range],input[type=range]+.thumb{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.circle{border-radius:50%}.center-block{display:block;margin-left:auto;margin-right:auto}.truncate{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.no-padding{padding:0 !important}@font-face{font-family:"Material-Design-Icons";src:url("../font/material-design-icons/Material-Design-Icons.eot?#iefix") format("embedded-opentype"),url("../font/material-design-icons/Material-Design-Icons.woff2") format("woff2"),url("../font/material-design-icons/Material-Design-Icons.woff") format("woff"),url("../font/material-design-icons/Material-Design-Icons.ttf") format("truetype"),url("../font/material-design-icons/Material-Design-Icons.svg#Material-Design-Icons") format("svg");font-weight:normal;font-style:normal;}[class^="mdi-"],[class*="mdi-"]{speak:none;display:inline-block;font-family:"Material-Design-Icons";font-style:normal;font-weight:normal;font-variant:normal;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;transform:translate(0, 0)}[class^="mdi-"]:before,[class*="mdi-"]:before{display:inline-block;speak:none;text-decoration:inherit}[class^="mdi-"].pull-left,[class*="mdi-"].pull-left{margin-right:.3em}[class^="mdi-"].pull-right,[class*="mdi-"].pull-right{margin-left:.3em}[class^="mdi-"].mdi-lg:before,[class^="mdi-"].mdi-lg:after,[class*="mdi-"].mdi-lg:before,[class*="mdi-"].mdi-lg:after{font-size:1.33333333em;line-height:0.75em;vertical-align:-15%}[class^="mdi-"].mdi-2x:before,[class^="mdi-"].mdi-2x:after,[class*="mdi-"].mdi-2x:before,[class*="mdi-"].mdi-2x:after{font-size:2em}[class^="mdi-"].mdi-3x:before,[class^="mdi-"].mdi-3x:after,[class*="mdi-"].mdi-3x:before,[class*="mdi-"].mdi-3x:after{font-size:3em}[class^="mdi-"].mdi-4x:before,[class^="mdi-"].mdi-4x:after,[class*="mdi-"].mdi-4x:before,[class*="mdi-"].mdi-4x:after{font-size:4em}[class^="mdi-"].mdi-5x:before,[class^="mdi-"].mdi-5x:after,[class*="mdi-"].mdi-5x:before,[class*="mdi-"].mdi-5x:after{font-size:5em}[class^="mdi-device-signal-cellular-"]:after,[class^="mdi-device-battery-"]:after,[class^="mdi-device-battery-charging-"]:after,[class^="mdi-device-signal-cellular-connected-no-internet-"]:after,[class^="mdi-device-signal-wifi-"]:after,[class^="mdi-device-signal-wifi-statusbar-not-connected"]:after,.mdi-device-network-wifi:after{opacity:.3;position:absolute;left:0;top:0;z-index:1;display:inline-block;speak:none;text-decoration:inherit}[class^="mdi-device-signal-cellular-"]:after{content:"\e758"}[class^="mdi-device-battery-"]:after{content:"\e735"}[class^="mdi-device-battery-charging-"]:after{content:"\e733"}[class^="mdi-device-signal-cellular-connected-no-internet-"]:after{content:"\e75d"}[class^="mdi-device-signal-wifi-"]:after,.mdi-device-network-wifi:after{content:"\e765"}[class^="mdi-device-signal-wifi-statusbasr-not-connected"]:after{content:"\e8f7"}.mdi-device-signal-cellular-off:after,.mdi-device-signal-cellular-null:after,.mdi-device-signal-cellular-no-sim:after,.mdi-device-signal-wifi-off:after,.mdi-device-signal-wifi-4-bar:after,.mdi-device-signal-cellular-4-bar:after,.mdi-device-battery-alert:after,.mdi-device-signal-cellular-connected-no-internet-4-bar:after,.mdi-device-battery-std:after,.mdi-device-battery-full .mdi-device-battery-unknown:after{content:""}.mdi-fw{width:1.28571429em;text-align:center}.mdi-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.mdi-ul>li{position:relative}.mdi-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:0.14285714em;text-align:center}.mdi-li.mdi-lg{left:-1.85714286em}.mdi-border{padding:.2em .25em .15em;border:solid 0.08em #eeeeee;border-radius:.1em}.mdi-spin{-webkit-animation:mdi-spin 2s infinite linear;animation:mdi-spin 2s infinite linear;-webkit-transform-origin:50% 50%;-moz-transform-origin:50% 50%;-o-transform-origin:50% 50%;transform-origin:50% 50%}.mdi-pulse{-webkit-animation:mdi-spin 1s steps(8) infinite;animation:mdi-spin 1s steps(8) infinite;-webkit-transform-origin:50% 50%;-moz-transform-origin:50% 50%;-o-transform-origin:50% 50%;transform-origin:50% 50%}@-webkit-keyframes mdi-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes mdi-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.mdi-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.mdi-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.mdi-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.mdi-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.mdi-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .mdi-rotate-90,:root .mdi-rotate-180,:root .mdi-rotate-270,:root .mdi-flip-horizontal,:root .mdi-flip-vertical{filter:none}.mdi-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.mdi-stack-1x,.mdi-stack-2x{position:absolute;left:0;width:100%;text-align:center}.mdi-stack-1x{line-height:inherit}.mdi-stack-2x{font-size:2em}.mdi-inverse{color:#ffffff}.mdi-action-3d-rotation:before{content:"\e600"}.mdi-action-accessibility:before{content:"\e601"}.mdi-action-account-balance-wallet:before{content:"\e602"}.mdi-action-account-balance:before{content:"\e603"}.mdi-action-account-box:before{content:"\e604"}.mdi-action-account-child:before{content:"\e605"}.mdi-action-account-circle:before{content:"\e606"}.mdi-action-add-shopping-cart:before{content:"\e607"}.mdi-action-alarm-add:before{content:"\e608"}.mdi-action-alarm-off:before{content:"\e609"}.mdi-action-alarm-on:before{content:"\e60a"}.mdi-action-alarm:before{content:"\e60b"}.mdi-action-android:before{content:"\e60c"}.mdi-action-announcement:before{content:"\e60d"}.mdi-action-aspect-ratio:before{content:"\e60e"}.mdi-action-assessment:before{content:"\e60f"}.mdi-action-assignment-ind:before{content:"\e610"}.mdi-action-assignment-late:before{content:"\e611"}.mdi-action-assignment-return:before{content:"\e612"}.mdi-action-assignment-returned:before{content:"\e613"}.mdi-action-assignment-turned-in:before{content:"\e614"}.mdi-action-assignment:before{content:"\e615"}.mdi-action-autorenew:before{content:"\e616"}.mdi-action-backup:before{content:"\e617"}.mdi-action-book:before{content:"\e618"}.mdi-action-bookmark-outline:before{content:"\e619"}.mdi-action-bookmark:before{content:"\e61a"}.mdi-action-bug-report:before{content:"\e61b"}.mdi-action-cached:before{content:"\e61c"}.mdi-action-check-circle:before{content:"\e61d"}.mdi-action-class:before{content:"\e61e"}.mdi-action-credit-card:before{content:"\e61f"}.mdi-action-dashboard:before{content:"\e620"}.mdi-action-delete:before{content:"\e621"}.mdi-action-description:before{content:"\e622"}.mdi-action-dns:before{content:"\e623"}.mdi-action-done-all:before{content:"\e624"}.mdi-action-done:before{content:"\e625"}.mdi-action-event:before{content:"\e626"}.mdi-action-exit-to-app:before{content:"\e627"}.mdi-action-explore:before{content:"\e628"}.mdi-action-extension:before{content:"\e629"}.mdi-action-face-unlock:before{content:"\e62a"}.mdi-action-favorite-outline:before{content:"\e62b"}.mdi-action-favorite:before{content:"\e62c"}.mdi-action-find-in-page:before{content:"\e62d"}.mdi-action-find-replace:before{content:"\e62e"}.mdi-action-flip-to-back:before{content:"\e62f"}.mdi-action-flip-to-front:before{content:"\e630"}.mdi-action-get-app:before{content:"\e631"}.mdi-action-grade:before{content:"\e632"}.mdi-action-group-work:before{content:"\e633"}.mdi-action-help:before{content:"\e634"}.mdi-action-highlight-remove:before{content:"\e635"}.mdi-action-history:before{content:"\e636"}.mdi-action-home:before{content:"\e637"}.mdi-action-https:before{content:"\e638"}.mdi-action-info-outline:before{content:"\e639"}.mdi-action-info:before{content:"\e63a"}.mdi-action-input:before{content:"\e63b"}.mdi-action-invert-colors:before{content:"\e63c"}.mdi-action-label-outline:before{content:"\e63d"}.mdi-action-label:before{content:"\e63e"}.mdi-action-language:before{content:"\e63f"}.mdi-action-launch:before{content:"\e640"}.mdi-action-list:before{content:"\e641"}.mdi-action-lock-open:before{content:"\e642"}.mdi-action-lock-outline:before{content:"\e643"}.mdi-action-lock:before{content:"\e644"}.mdi-action-loyalty:before{content:"\e645"}.mdi-action-markunread-mailbox:before{content:"\e646"}.mdi-action-note-add:before{content:"\e647"}.mdi-action-open-in-browser:before{content:"\e648"}.mdi-action-open-in-new:before{content:"\e649"}.mdi-action-open-with:before{content:"\e64a"}.mdi-action-pageview:before{content:"\e64b"}.mdi-action-payment:before{content:"\e64c"}.mdi-action-perm-camera-mic:before{content:"\e64d"}.mdi-action-perm-contact-cal:before{content:"\e64e"}.mdi-action-perm-data-setting:before{content:"\e64f"}.mdi-action-perm-device-info:before{content:"\e650"}.mdi-action-perm-identity:before{content:"\e651"}.mdi-action-perm-media:before{content:"\e652"}.mdi-action-perm-phone-msg:before{content:"\e653"}.mdi-action-perm-scan-wifi:before{content:"\e654"}.mdi-action-picture-in-picture:before{content:"\e655"}.mdi-action-polymer:before{content:"\e656"}.mdi-action-print:before{content:"\e657"}.mdi-action-query-builder:before{content:"\e658"}.mdi-action-question-answer:before{content:"\e659"}.mdi-action-receipt:before{content:"\e65a"}.mdi-action-redeem:before{content:"\e65b"}.mdi-action-reorder:before{content:"\e65c"}.mdi-action-report-problem:before{content:"\e65d"}.mdi-action-restore:before{content:"\e65e"}.mdi-action-room:before{content:"\e65f"}.mdi-action-schedule:before{content:"\e660"}.mdi-action-search:before{content:"\e661"}.mdi-action-settings-applications:before{content:"\e662"}.mdi-action-settings-backup-restore:before{content:"\e663"}.mdi-action-settings-bluetooth:before{content:"\e664"}.mdi-action-settings-cell:before{content:"\e665"}.mdi-action-settings-display:before{content:"\e666"}.mdi-action-settings-ethernet:before{content:"\e667"}.mdi-action-settings-input-antenna:before{content:"\e668"}.mdi-action-settings-input-component:before{content:"\e669"}.mdi-action-settings-input-composite:before{content:"\e66a"}.mdi-action-settings-input-hdmi:before{content:"\e66b"}.mdi-action-settings-input-svideo:before{content:"\e66c"}.mdi-action-settings-overscan:before{content:"\e66d"}.mdi-action-settings-phone:before{content:"\e66e"}.mdi-action-settings-power:before{content:"\e66f"}.mdi-action-settings-remote:before{content:"\e670"}.mdi-action-settings-voice:before{content:"\e671"}.mdi-action-settings:before{content:"\e672"}.mdi-action-shop-two:before{content:"\e673"}.mdi-action-shop:before{content:"\e674"}.mdi-action-shopping-basket:before{content:"\e675"}.mdi-action-shopping-cart:before{content:"\e676"}.mdi-action-speaker-notes:before{content:"\e677"}.mdi-action-spellcheck:before{content:"\e678"}.mdi-action-star-rate:before{content:"\e679"}.mdi-action-stars:before{content:"\e67a"}.mdi-action-store:before{content:"\e67b"}.mdi-action-subject:before{content:"\e67c"}.mdi-action-supervisor-account:before{content:"\e67d"}.mdi-action-swap-horiz:before{content:"\e67e"}.mdi-action-swap-vert-circle:before{content:"\e67f"}.mdi-action-swap-vert:before{content:"\e680"}.mdi-action-system-update-tv:before{content:"\e681"}.mdi-action-tab-unselected:before{content:"\e682"}.mdi-action-tab:before{content:"\e683"}.mdi-action-theaters:before{content:"\e684"}.mdi-action-thumb-down:before{content:"\e685"}.mdi-action-thumb-up:before{content:"\e686"}.mdi-action-thumbs-up-down:before{content:"\e687"}.mdi-action-toc:before{content:"\e688"}.mdi-action-today:before{content:"\e689"}.mdi-action-track-changes:before{content:"\e68a"}.mdi-action-translate:before{content:"\e68b"}.mdi-action-trending-down:before{content:"\e68c"}.mdi-action-trending-neutral:before{content:"\e68d"}.mdi-action-trending-up:before{content:"\e68e"}.mdi-action-turned-in-not:before{content:"\e68f"}.mdi-action-turned-in:before{content:"\e690"}.mdi-action-verified-user:before{content:"\e691"}.mdi-action-view-agenda:before{content:"\e692"}.mdi-action-view-array:before{content:"\e693"}.mdi-action-view-carousel:before{content:"\e694"}.mdi-action-view-column:before{content:"\e695"}.mdi-action-view-day:before{content:"\e696"}.mdi-action-view-headline:before{content:"\e697"}.mdi-action-view-list:before{content:"\e698"}.mdi-action-view-module:before{content:"\e699"}.mdi-action-view-quilt:before{content:"\e69a"}.mdi-action-view-stream:before{content:"\e69b"}.mdi-action-view-week:before{content:"\e69c"}.mdi-action-visibility-off:before{content:"\e69d"}.mdi-action-visibility:before{content:"\e69e"}.mdi-action-wallet-giftcard:before{content:"\e69f"}.mdi-action-wallet-membership:before{content:"\e6a0"}.mdi-action-wallet-travel:before{content:"\e6a1"}.mdi-action-work:before{content:"\e6a2"}.mdi-alert-error:before{content:"\e6a3"}.mdi-alert-warning:before{content:"\e6a4"}.mdi-av-album:before{content:"\e6a5"}.mdi-av-closed-caption:before{content:"\e6a6"}.mdi-av-equalizer:before{content:"\e6a7"}.mdi-av-explicit:before{content:"\e6a8"}.mdi-av-fast-forward:before{content:"\e6a9"}.mdi-av-fast-rewind:before{content:"\e6aa"}.mdi-av-games:before{content:"\e6ab"}.mdi-av-hearing:before{content:"\e6ac"}.mdi-av-high-quality:before{content:"\e6ad"}.mdi-av-loop:before{content:"\e6ae"}.mdi-av-mic-none:before{content:"\e6af"}.mdi-av-mic-off:before{content:"\e6b0"}.mdi-av-mic:before{content:"\e6b1"}.mdi-av-movie:before{content:"\e6b2"}.mdi-av-my-library-add:before{content:"\e6b3"}.mdi-av-my-library-books:before{content:"\e6b4"}.mdi-av-my-library-music:before{content:"\e6b5"}.mdi-av-new-releases:before{content:"\e6b6"}.mdi-av-not-interested:before{content:"\e6b7"}.mdi-av-pause-circle-fill:before{content:"\e6b8"}.mdi-av-pause-circle-outline:before{content:"\e6b9"}.mdi-av-pause:before{content:"\e6ba"}.mdi-av-play-arrow:before{content:"\e6bb"}.mdi-av-play-circle-fill:before{content:"\e6bc"}.mdi-av-play-circle-outline:before{content:"\e6bd"}.mdi-av-play-shopping-bag:before{content:"\e6be"}.mdi-av-playlist-add:before{content:"\e6bf"}.mdi-av-queue-music:before{content:"\e6c0"}.mdi-av-queue:before{content:"\e6c1"}.mdi-av-radio:before{content:"\e6c2"}.mdi-av-recent-actors:before{content:"\e6c3"}.mdi-av-repeat-one:before{content:"\e6c4"}.mdi-av-repeat:before{content:"\e6c5"}.mdi-av-replay:before{content:"\e6c6"}.mdi-av-shuffle:before{content:"\e6c7"}.mdi-av-skip-next:before{content:"\e6c8"}.mdi-av-skip-previous:before{content:"\e6c9"}.mdi-av-snooze:before{content:"\e6ca"}.mdi-av-stop:before{content:"\e6cb"}.mdi-av-subtitles:before{content:"\e6cc"}.mdi-av-surround-sound:before{content:"\e6cd"}.mdi-av-timer:before{content:"\e6ce"}.mdi-av-video-collection:before{content:"\e6cf"}.mdi-av-videocam-off:before{content:"\e6d0"}.mdi-av-videocam:before{content:"\e6d1"}.mdi-av-volume-down:before{content:"\e6d2"}.mdi-av-volume-mute:before{content:"\e6d3"}.mdi-av-volume-off:before{content:"\e6d4"}.mdi-av-volume-up:before{content:"\e6d5"}.mdi-av-web:before{content:"\e6d6"}.mdi-communication-business:before{content:"\e6d7"}.mdi-communication-call-end:before{content:"\e6d8"}.mdi-communication-call-made:before{content:"\e6d9"}.mdi-communication-call-merge:before{content:"\e6da"}.mdi-communication-call-missed:before{content:"\e6db"}.mdi-communication-call-received:before{content:"\e6dc"}.mdi-communication-call-split:before{content:"\e6dd"}.mdi-communication-call:before{content:"\e6de"}.mdi-communication-chat:before{content:"\e6df"}.mdi-communication-clear-all:before{content:"\e6e0"}.mdi-communication-comment:before{content:"\e6e1"}.mdi-communication-contacts:before{content:"\e6e2"}.mdi-communication-dialer-sip:before{content:"\e6e3"}.mdi-communication-dialpad:before{content:"\e6e4"}.mdi-communication-dnd-on:before{content:"\e6e5"}.mdi-communication-email:before{content:"\e6e6"}.mdi-communication-forum:before{content:"\e6e7"}.mdi-communication-import-export:before{content:"\e6e8"}.mdi-communication-invert-colors-off:before{content:"\e6e9"}.mdi-communication-invert-colors-on:before{content:"\e6ea"}.mdi-communication-live-help:before{content:"\e6eb"}.mdi-communication-location-off:before{content:"\e6ec"}.mdi-communication-location-on:before{content:"\e6ed"}.mdi-communication-message:before{content:"\e6ee"}.mdi-communication-messenger:before{content:"\e6ef"}.mdi-communication-no-sim:before{content:"\e6f0"}.mdi-communication-phone:before{content:"\e6f1"}.mdi-communication-portable-wifi-off:before{content:"\e6f2"}.mdi-communication-quick-contacts-dialer:before{content:"\e6f3"}.mdi-communication-quick-contacts-mail:before{content:"\e6f4"}.mdi-communication-ring-volume:before{content:"\e6f5"}.mdi-communication-stay-current-landscape:before{content:"\e6f6"}.mdi-communication-stay-current-portrait:before{content:"\e6f7"}.mdi-communication-stay-primary-landscape:before{content:"\e6f8"}.mdi-communication-stay-primary-portrait:before{content:"\e6f9"}.mdi-communication-swap-calls:before{content:"\e6fa"}.mdi-communication-textsms:before{content:"\e6fb"}.mdi-communication-voicemail:before{content:"\e6fc"}.mdi-communication-vpn-key:before{content:"\e6fd"}.mdi-content-add-box:before{content:"\e6fe"}.mdi-content-add-circle-outline:before{content:"\e6ff"}.mdi-content-add-circle:before{content:"\e700"}.mdi-content-add:before{content:"\e701"}.mdi-content-archive:before{content:"\e702"}.mdi-content-backspace:before{content:"\e703"}.mdi-content-block:before{content:"\e704"}.mdi-content-clear:before{content:"\e705"}.mdi-content-content-copy:before{content:"\e706"}.mdi-content-content-cut:before{content:"\e707"}.mdi-content-content-paste:before{content:"\e708"}.mdi-content-create:before{content:"\e709"}.mdi-content-drafts:before{content:"\e70a"}.mdi-content-filter-list:before{content:"\e70b"}.mdi-content-flag:before{content:"\e70c"}.mdi-content-forward:before{content:"\e70d"}.mdi-content-gesture:before{content:"\e70e"}.mdi-content-inbox:before{content:"\e70f"}.mdi-content-link:before{content:"\e710"}.mdi-content-mail:before{content:"\e711"}.mdi-content-markunread:before{content:"\e712"}.mdi-content-redo:before{content:"\e713"}.mdi-content-remove-circle-outline:before{content:"\e714"}.mdi-content-remove-circle:before{content:"\e715"}.mdi-content-remove:before{content:"\e716"}.mdi-content-reply-all:before{content:"\e717"}.mdi-content-reply:before{content:"\e718"}.mdi-content-report:before{content:"\e719"}.mdi-content-save:before{content:"\e71a"}.mdi-content-select-all:before{content:"\e71b"}.mdi-content-send:before{content:"\e71c"}.mdi-content-sort:before{content:"\e71d"}.mdi-content-text-format:before{content:"\e71e"}.mdi-content-undo:before{content:"\e71f"}.mdi-editor-attach-file:before{content:"\e776"}.mdi-editor-attach-money:before{content:"\e777"}.mdi-editor-border-all:before{content:"\e778"}.mdi-editor-border-bottom:before{content:"\e779"}.mdi-editor-border-clear:before{content:"\e77a"}.mdi-editor-border-color:before{content:"\e77b"}.mdi-editor-border-horizontal:before{content:"\e77c"}.mdi-editor-border-inner:before{content:"\e77d"}.mdi-editor-border-left:before{content:"\e77e"}.mdi-editor-border-outer:before{content:"\e77f"}.mdi-editor-border-right:before{content:"\e780"}.mdi-editor-border-style:before{content:"\e781"}.mdi-editor-border-top:before{content:"\e782"}.mdi-editor-border-vertical:before{content:"\e783"}.mdi-editor-format-align-center:before{content:"\e784"}.mdi-editor-format-align-justify:before{content:"\e785"}.mdi-editor-format-align-left:before{content:"\e786"}.mdi-editor-format-align-right:before{content:"\e787"}.mdi-editor-format-bold:before{content:"\e788"}.mdi-editor-format-clear:before{content:"\e789"}.mdi-editor-format-color-fill:before{content:"\e78a"}.mdi-editor-format-color-reset:before{content:"\e78b"}.mdi-editor-format-color-text:before{content:"\e78c"}.mdi-editor-format-indent-decrease:before{content:"\e78d"}.mdi-editor-format-indent-increase:before{content:"\e78e"}.mdi-editor-format-italic:before{content:"\e78f"}.mdi-editor-format-line-spacing:before{content:"\e790"}.mdi-editor-format-list-bulleted:before{content:"\e791"}.mdi-editor-format-list-numbered:before{content:"\e792"}.mdi-editor-format-paint:before{content:"\e793"}.mdi-editor-format-quote:before{content:"\e794"}.mdi-editor-format-size:before{content:"\e795"}.mdi-editor-format-strikethrough:before{content:"\e796"}.mdi-editor-format-textdirection-l-to-r:before{content:"\e797"}.mdi-editor-format-textdirection-r-to-l:before{content:"\e798"}.mdi-editor-format-underline:before{content:"\e799"}.mdi-editor-functions:before{content:"\e79a"}.mdi-editor-insert-chart:before{content:"\e79b"}.mdi-editor-insert-comment:before{content:"\e79c"}.mdi-editor-insert-drive-file:before{content:"\e79d"}.mdi-editor-insert-emoticon:before{content:"\e79e"}.mdi-editor-insert-invitation:before{content:"\e79f"}.mdi-editor-insert-link:before{content:"\e7a0"}.mdi-editor-insert-photo:before{content:"\e7a1"}.mdi-editor-merge-type:before{content:"\e7a2"}.mdi-editor-mode-comment:before{content:"\e7a3"}.mdi-editor-mode-edit:before{content:"\e7a4"}.mdi-editor-publish:before{content:"\e7a5"}.mdi-editor-vertical-align-bottom:before{content:"\e7a6"}.mdi-editor-vertical-align-center:before{content:"\e7a7"}.mdi-editor-vertical-align-top:before{content:"\e7a8"}.mdi-editor-wrap-text:before{content:"\e7a9"}.mdi-file-attachment:before{content:"\e7aa"}.mdi-file-cloud-circle:before{content:"\e7ab"}.mdi-file-cloud-done:before{content:"\e7ac"}.mdi-file-cloud-download:before{content:"\e7ad"}.mdi-file-cloud-off:before{content:"\e7ae"}.mdi-file-cloud-queue:before{content:"\e7af"}.mdi-file-cloud-upload:before{content:"\e7b0"}.mdi-file-cloud:before{content:"\e7b1"}.mdi-file-file-download:before{content:"\e7b2"}.mdi-file-file-upload:before{content:"\e7b3"}.mdi-file-folder-open:before{content:"\e7b4"}.mdi-file-folder-shared:before{content:"\e7b5"}.mdi-file-folder:before{content:"\e7b6"}.mdi-device-access-alarm:before{content:"\e720"}.mdi-device-access-alarms:before{content:"\e721"}.mdi-device-access-time:before{content:"\e722"}.mdi-device-add-alarm:before{content:"\e723"}.mdi-device-airplanemode-off:before{content:"\e724"}.mdi-device-airplanemode-on:before{content:"\e725"}.mdi-device-battery-20:before{content:"\e726"}.mdi-device-battery-30:before{content:"\e727"}.mdi-device-battery-50:before{content:"\e728"}.mdi-device-battery-60:before{content:"\e729"}.mdi-device-battery-80:before{content:"\e72a"}.mdi-device-battery-90:before{content:"\e72b"}.mdi-device-battery-alert:before{content:"\e72c"}.mdi-device-battery-charging-20:before{content:"\e72d"}.mdi-device-battery-charging-30:before{content:"\e72e"}.mdi-device-battery-charging-50:before{content:"\e72f"}.mdi-device-battery-charging-60:before{content:"\e730"}.mdi-device-battery-charging-80:before{content:"\e731"}.mdi-device-battery-charging-90:before{content:"\e732"}.mdi-device-battery-charging-full:before{content:"\e733"}.mdi-device-battery-full:before{content:"\e734"}.mdi-device-battery-std:before{content:"\e735"}.mdi-device-battery-unknown:before{content:"\e736"}.mdi-device-bluetooth-connected:before{content:"\e737"}.mdi-device-bluetooth-disabled:before{content:"\e738"}.mdi-device-bluetooth-searching:before{content:"\e739"}.mdi-device-bluetooth:before{content:"\e73a"}.mdi-device-brightness-auto:before{content:"\e73b"}.mdi-device-brightness-high:before{content:"\e73c"}.mdi-device-brightness-low:before{content:"\e73d"}.mdi-device-brightness-medium:before{content:"\e73e"}.mdi-device-data-usage:before{content:"\e73f"}.mdi-device-developer-mode:before{content:"\e740"}.mdi-device-devices:before{content:"\e741"}.mdi-device-dvr:before{content:"\e742"}.mdi-device-gps-fixed:before{content:"\e743"}.mdi-device-gps-not-fixed:before{content:"\e744"}.mdi-device-gps-off:before{content:"\e745"}.mdi-device-location-disabled:before{content:"\e746"}.mdi-device-location-searching:before{content:"\e747"}.mdi-device-multitrack-audio:before{content:"\e748"}.mdi-device-network-cell:before{content:"\e749"}.mdi-device-network-wifi:before{content:"\e74a"}.mdi-device-nfc:before{content:"\e74b"}.mdi-device-now-wallpaper:before{content:"\e74c"}.mdi-device-now-widgets:before{content:"\e74d"}.mdi-device-screen-lock-landscape:before{content:"\e74e"}.mdi-device-screen-lock-portrait:before{content:"\e74f"}.mdi-device-screen-lock-rotation:before{content:"\e750"}.mdi-device-screen-rotation:before{content:"\e751"}.mdi-device-sd-storage:before{content:"\e752"}.mdi-device-settings-system-daydream:before{content:"\e753"}.mdi-device-signal-cellular-0-bar:before{content:"\e754"}.mdi-device-signal-cellular-1-bar:before{content:"\e755"}.mdi-device-signal-cellular-2-bar:before{content:"\e756"}.mdi-device-signal-cellular-3-bar:before{content:"\e757"}.mdi-device-signal-cellular-4-bar:before{content:"\e758"}.mdi-signal-wifi-statusbar-connected-no-internet-after:before{content:"\e8f6"}.mdi-device-signal-cellular-connected-no-internet-0-bar:before{content:"\e759"}.mdi-device-signal-cellular-connected-no-internet-1-bar:before{content:"\e75a"}.mdi-device-signal-cellular-connected-no-internet-2-bar:before{content:"\e75b"}.mdi-device-signal-cellular-connected-no-internet-3-bar:before{content:"\e75c"}.mdi-device-signal-cellular-connected-no-internet-4-bar:before{content:"\e75d"}.mdi-device-signal-cellular-no-sim:before{content:"\e75e"}.mdi-device-signal-cellular-null:before{content:"\e75f"}.mdi-device-signal-cellular-off:before{content:"\e760"}.mdi-device-signal-wifi-0-bar:before{content:"\e761"}.mdi-device-signal-wifi-1-bar:before{content:"\e762"}.mdi-device-signal-wifi-2-bar:before{content:"\e763"}.mdi-device-signal-wifi-3-bar:before{content:"\e764"}.mdi-device-signal-wifi-4-bar:before{content:"\e765"}.mdi-device-signal-wifi-off:before{content:"\e766"}.mdi-device-signal-wifi-statusbar-1-bar:before{content:"\e767"}.mdi-device-signal-wifi-statusbar-2-bar:before{content:"\e768"}.mdi-device-signal-wifi-statusbar-3-bar:before{content:"\e769"}.mdi-device-signal-wifi-statusbar-4-bar:before{content:"\e76a"}.mdi-device-signal-wifi-statusbar-connected-no-internet-:before{content:"\e76b"}.mdi-device-signal-wifi-statusbar-connected-no-internet:before{content:"\e76f"}.mdi-device-signal-wifi-statusbar-connected-no-internet-2:before{content:"\e76c"}.mdi-device-signal-wifi-statusbar-connected-no-internet-3:before{content:"\e76d"}.mdi-device-signal-wifi-statusbar-connected-no-internet-4:before{content:"\e76e"}.mdi-signal-wifi-statusbar-not-connected-after:before{content:"\e8f7"}.mdi-device-signal-wifi-statusbar-not-connected:before{content:"\e770"}.mdi-device-signal-wifi-statusbar-null:before{content:"\e771"}.mdi-device-storage:before{content:"\e772"}.mdi-device-usb:before{content:"\e773"}.mdi-device-wifi-lock:before{content:"\e774"}.mdi-device-wifi-tethering:before{content:"\e775"}.mdi-hardware-cast-connected:before{content:"\e7b7"}.mdi-hardware-cast:before{content:"\e7b8"}.mdi-hardware-computer:before{content:"\e7b9"}.mdi-hardware-desktop-mac:before{content:"\e7ba"}.mdi-hardware-desktop-windows:before{content:"\e7bb"}.mdi-hardware-dock:before{content:"\e7bc"}.mdi-hardware-gamepad:before{content:"\e7bd"}.mdi-hardware-headset-mic:before{content:"\e7be"}.mdi-hardware-headset:before{content:"\e7bf"}.mdi-hardware-keyboard-alt:before{content:"\e7c0"}.mdi-hardware-keyboard-arrow-down:before{content:"\e7c1"}.mdi-hardware-keyboard-arrow-left:before{content:"\e7c2"}.mdi-hardware-keyboard-arrow-right:before{content:"\e7c3"}.mdi-hardware-keyboard-arrow-up:before{content:"\e7c4"}.mdi-hardware-keyboard-backspace:before{content:"\e7c5"}.mdi-hardware-keyboard-capslock:before{content:"\e7c6"}.mdi-hardware-keyboard-control:before{content:"\e7c7"}.mdi-hardware-keyboard-hide:before{content:"\e7c8"}.mdi-hardware-keyboard-return:before{content:"\e7c9"}.mdi-hardware-keyboard-tab:before{content:"\e7ca"}.mdi-hardware-keyboard-voice:before{content:"\e7cb"}.mdi-hardware-keyboard:before{content:"\e7cc"}.mdi-hardware-laptop-chromebook:before{content:"\e7cd"}.mdi-hardware-laptop-mac:before{content:"\e7ce"}.mdi-hardware-laptop-windows:before{content:"\e7cf"}.mdi-hardware-laptop:before{content:"\e7d0"}.mdi-hardware-memory:before{content:"\e7d1"}.mdi-hardware-mouse:before{content:"\e7d2"}.mdi-hardware-phone-android:before{content:"\e7d3"}.mdi-hardware-phone-iphone:before{content:"\e7d4"}.mdi-hardware-phonelink-off:before{content:"\e7d5"}.mdi-hardware-phonelink:before{content:"\e7d6"}.mdi-hardware-security:before{content:"\e7d7"}.mdi-hardware-sim-card:before{content:"\e7d8"}.mdi-hardware-smartphone:before{content:"\e7d9"}.mdi-hardware-speaker:before{content:"\e7da"}.mdi-hardware-tablet-android:before{content:"\e7db"}.mdi-hardware-tablet-mac:before{content:"\e7dc"}.mdi-hardware-tablet:before{content:"\e7dd"}.mdi-hardware-tv:before{content:"\e7de"}.mdi-hardware-watch:before{content:"\e7df"}.mdi-image-add-to-photos:before{content:"\e7e0"}.mdi-image-adjust:before{content:"\e7e1"}.mdi-image-assistant-photo:before{content:"\e7e2"}.mdi-image-audiotrack:before{content:"\e7e3"}.mdi-image-blur-circular:before{content:"\e7e4"}.mdi-image-blur-linear:before{content:"\e7e5"}.mdi-image-blur-off:before{content:"\e7e6"}.mdi-image-blur-on:before{content:"\e7e7"}.mdi-image-brightness-1:before{content:"\e7e8"}.mdi-image-brightness-2:before{content:"\e7e9"}.mdi-image-brightness-3:before{content:"\e7ea"}.mdi-image-brightness-4:before{content:"\e7eb"}.mdi-image-brightness-5:before{content:"\e7ec"}.mdi-image-brightness-6:before{content:"\e7ed"}.mdi-image-brightness-7:before{content:"\e7ee"}.mdi-image-brush:before{content:"\e7ef"}.mdi-image-camera-alt:before{content:"\e7f0"}.mdi-image-camera-front:before{content:"\e7f1"}.mdi-image-camera-rear:before{content:"\e7f2"}.mdi-image-camera-roll:before{content:"\e7f3"}.mdi-image-camera:before{content:"\e7f4"}.mdi-image-center-focus-strong:before{content:"\e7f5"}.mdi-image-center-focus-weak:before{content:"\e7f6"}.mdi-image-collections:before{content:"\e7f7"}.mdi-image-color-lens:before{content:"\e7f8"}.mdi-image-colorize:before{content:"\e7f9"}.mdi-image-compare:before{content:"\e7fa"}.mdi-image-control-point-duplicate:before{content:"\e7fb"}.mdi-image-control-point:before{content:"\e7fc"}.mdi-image-crop-3-2:before{content:"\e7fd"}.mdi-image-crop-5-4:before{content:"\e7fe"}.mdi-image-crop-7-5:before{content:"\e7ff"}.mdi-image-crop-16-9:before{content:"\e800"}.mdi-image-crop-din:before{content:"\e801"}.mdi-image-crop-free:before{content:"\e802"}.mdi-image-crop-landscape:before{content:"\e803"}.mdi-image-crop-original:before{content:"\e804"}.mdi-image-crop-portrait:before{content:"\e805"}.mdi-image-crop-square:before{content:"\e806"}.mdi-image-crop:before{content:"\e807"}.mdi-image-dehaze:before{content:"\e808"}.mdi-image-details:before{content:"\e809"}.mdi-image-edit:before{content:"\e80a"}.mdi-image-exposure-minus-1:before{content:"\e80b"}.mdi-image-exposure-minus-2:before{content:"\e80c"}.mdi-image-exposure-plus-1:before{content:"\e80d"}.mdi-image-exposure-plus-2:before{content:"\e80e"}.mdi-image-exposure-zero:before{content:"\e80f"}.mdi-image-exposure:before{content:"\e810"}.mdi-image-filter-1:before{content:"\e811"}.mdi-image-filter-2:before{content:"\e812"}.mdi-image-filter-3:before{content:"\e813"}.mdi-image-filter-4:before{content:"\e814"}.mdi-image-filter-5:before{content:"\e815"}.mdi-image-filter-6:before{content:"\e816"}.mdi-image-filter-7:before{content:"\e817"}.mdi-image-filter-8:before{content:"\e818"}.mdi-image-filter-9-plus:before{content:"\e819"}.mdi-image-filter-9:before{content:"\e81a"}.mdi-image-filter-b-and-w:before{content:"\e81b"}.mdi-image-filter-center-focus:before{content:"\e81c"}.mdi-image-filter-drama:before{content:"\e81d"}.mdi-image-filter-frames:before{content:"\e81e"}.mdi-image-filter-hdr:before{content:"\e81f"}.mdi-image-filter-none:before{content:"\e820"}.mdi-image-filter-tilt-shift:before{content:"\e821"}.mdi-image-filter-vintage:before{content:"\e822"}.mdi-image-filter:before{content:"\e823"}.mdi-image-flare:before{content:"\e824"}.mdi-image-flash-auto:before{content:"\e825"}.mdi-image-flash-off:before{content:"\e826"}.mdi-image-flash-on:before{content:"\e827"}.mdi-image-flip:before{content:"\e828"}.mdi-image-gradient:before{content:"\e829"}.mdi-image-grain:before{content:"\e82a"}.mdi-image-grid-off:before{content:"\e82b"}.mdi-image-grid-on:before{content:"\e82c"}.mdi-image-hdr-off:before{content:"\e82d"}.mdi-image-hdr-on:before{content:"\e82e"}.mdi-image-hdr-strong:before{content:"\e82f"}.mdi-image-hdr-weak:before{content:"\e830"}.mdi-image-healing:before{content:"\e831"}.mdi-image-image-aspect-ratio:before{content:"\e832"}.mdi-image-image:before{content:"\e833"}.mdi-image-iso:before{content:"\e834"}.mdi-image-landscape:before{content:"\e835"}.mdi-image-leak-add:before{content:"\e836"}.mdi-image-leak-remove:before{content:"\e837"}.mdi-image-lens:before{content:"\e838"}.mdi-image-looks-3:before{content:"\e839"}.mdi-image-looks-4:before{content:"\e83a"}.mdi-image-looks-5:before{content:"\e83b"}.mdi-image-looks-6:before{content:"\e83c"}.mdi-image-looks-one:before{content:"\e83d"}.mdi-image-looks-two:before{content:"\e83e"}.mdi-image-looks:before{content:"\e83f"}.mdi-image-loupe:before{content:"\e840"}.mdi-image-movie-creation:before{content:"\e841"}.mdi-image-nature-people:before{content:"\e842"}.mdi-image-nature:before{content:"\e843"}.mdi-image-navigate-before:before{content:"\e844"}.mdi-image-navigate-next:before{content:"\e845"}.mdi-image-palette:before{content:"\e846"}.mdi-image-panorama-fisheye:before{content:"\e847"}.mdi-image-panorama-horizontal:before{content:"\e848"}.mdi-image-panorama-vertical:before{content:"\e849"}.mdi-image-panorama-wide-angle:before{content:"\e84a"}.mdi-image-panorama:before{content:"\e84b"}.mdi-image-photo-album:before{content:"\e84c"}.mdi-image-photo-camera:before{content:"\e84d"}.mdi-image-photo-library:before{content:"\e84e"}.mdi-image-photo:before{content:"\e84f"}.mdi-image-portrait:before{content:"\e850"}.mdi-image-remove-red-eye:before{content:"\e851"}.mdi-image-rotate-left:before{content:"\e852"}.mdi-image-rotate-right:before{content:"\e853"}.mdi-image-slideshow:before{content:"\e854"}.mdi-image-straighten:before{content:"\e855"}.mdi-image-style:before{content:"\e856"}.mdi-image-switch-camera:before{content:"\e857"}.mdi-image-switch-video:before{content:"\e858"}.mdi-image-tag-faces:before{content:"\e859"}.mdi-image-texture:before{content:"\e85a"}.mdi-image-timelapse:before{content:"\e85b"}.mdi-image-timer-3:before{content:"\e85c"}.mdi-image-timer-10:before{content:"\e85d"}.mdi-image-timer-auto:before{content:"\e85e"}.mdi-image-timer-off:before{content:"\e85f"}.mdi-image-timer:before{content:"\e860"}.mdi-image-tonality:before{content:"\e861"}.mdi-image-transform:before{content:"\e862"}.mdi-image-tune:before{content:"\e863"}.mdi-image-wb-auto:before{content:"\e864"}.mdi-image-wb-cloudy:before{content:"\e865"}.mdi-image-wb-incandescent:before{content:"\e866"}.mdi-image-wb-irradescent:before{content:"\e867"}.mdi-image-wb-sunny:before{content:"\e868"}.mdi-maps-beenhere:before{content:"\e869"}.mdi-maps-directions-bike:before{content:"\e86a"}.mdi-maps-directions-bus:before{content:"\e86b"}.mdi-maps-directions-car:before{content:"\e86c"}.mdi-maps-directions-ferry:before{content:"\e86d"}.mdi-maps-directions-subway:before{content:"\e86e"}.mdi-maps-directions-train:before{content:"\e86f"}.mdi-maps-directions-transit:before{content:"\e870"}.mdi-maps-directions-walk:before{content:"\e871"}.mdi-maps-directions:before{content:"\e872"}.mdi-maps-flight:before{content:"\e873"}.mdi-maps-hotel:before{content:"\e874"}.mdi-maps-layers-clear:before{content:"\e875"}.mdi-maps-layers:before{content:"\e876"}.mdi-maps-local-airport:before{content:"\e877"}.mdi-maps-local-atm:before{content:"\e878"}.mdi-maps-local-attraction:before{content:"\e879"}.mdi-maps-local-bar:before{content:"\e87a"}.mdi-maps-local-cafe:before{content:"\e87b"}.mdi-maps-local-car-wash:before{content:"\e87c"}.mdi-maps-local-convenience-store:before{content:"\e87d"}.mdi-maps-local-drink:before{content:"\e87e"}.mdi-maps-local-florist:before{content:"\e87f"}.mdi-maps-local-gas-station:before{content:"\e880"}.mdi-maps-local-grocery-store:before{content:"\e881"}.mdi-maps-local-hospital:before{content:"\e882"}.mdi-maps-local-hotel:before{content:"\e883"}.mdi-maps-local-laundry-service:before{content:"\e884"}.mdi-maps-local-library:before{content:"\e885"}.mdi-maps-local-mall:before{content:"\e886"}.mdi-maps-local-movies:before{content:"\e887"}.mdi-maps-local-offer:before{content:"\e888"}.mdi-maps-local-parking:before{content:"\e889"}.mdi-maps-local-pharmacy:before{content:"\e88a"}.mdi-maps-local-phone:before{content:"\e88b"}.mdi-maps-local-pizza:before{content:"\e88c"}.mdi-maps-local-play:before{content:"\e88d"}.mdi-maps-local-post-office:before{content:"\e88e"}.mdi-maps-local-print-shop:before{content:"\e88f"}.mdi-maps-local-restaurant:before{content:"\e890"}.mdi-maps-local-see:before{content:"\e891"}.mdi-maps-local-shipping:before{content:"\e892"}.mdi-maps-local-taxi:before{content:"\e893"}.mdi-maps-location-history:before{content:"\e894"}.mdi-maps-map:before{content:"\e895"}.mdi-maps-my-location:before{content:"\e896"}.mdi-maps-navigation:before{content:"\e897"}.mdi-maps-pin-drop:before{content:"\e898"}.mdi-maps-place:before{content:"\e899"}.mdi-maps-rate-review:before{content:"\e89a"}.mdi-maps-restaurant-menu:before{content:"\e89b"}.mdi-maps-satellite:before{content:"\e89c"}.mdi-maps-store-mall-directory:before{content:"\e89d"}.mdi-maps-terrain:before{content:"\e89e"}.mdi-maps-traffic:before{content:"\e89f"}.mdi-navigation-apps:before{content:"\e8a0"}.mdi-navigation-arrow-back:before{content:"\e8a1"}.mdi-navigation-arrow-drop-down-circle:before{content:"\e8a2"}.mdi-navigation-arrow-drop-down:before{content:"\e8a3"}.mdi-navigation-arrow-drop-up:before{content:"\e8a4"}.mdi-navigation-arrow-forward:before{content:"\e8a5"}.mdi-navigation-cancel:before{content:"\e8a6"}.mdi-navigation-check:before{content:"\e8a7"}.mdi-navigation-chevron-left:before{content:"\e8a8"}.mdi-navigation-chevron-right:before{content:"\e8a9"}.mdi-navigation-close:before{content:"\e8aa"}.mdi-navigation-expand-less:before{content:"\e8ab"}.mdi-navigation-expand-more:before{content:"\e8ac"}.mdi-navigation-fullscreen-exit:before{content:"\e8ad"}.mdi-navigation-fullscreen:before{content:"\e8ae"}.mdi-navigation-menu:before{content:"\e8af"}.mdi-navigation-more-horiz:before{content:"\e8b0"}.mdi-navigation-more-vert:before{content:"\e8b1"}.mdi-navigation-refresh:before{content:"\e8b2"}.mdi-navigation-unfold-less:before{content:"\e8b3"}.mdi-navigation-unfold-more:before{content:"\e8b4"}.mdi-notification-adb:before{content:"\e8b5"}.mdi-notification-bluetooth-audio:before{content:"\e8b6"}.mdi-notification-disc-full:before{content:"\e8b7"}.mdi-notification-dnd-forwardslash:before{content:"\e8b8"}.mdi-notification-do-not-disturb:before{content:"\e8b9"}.mdi-notification-drive-eta:before{content:"\e8ba"}.mdi-notification-event-available:before{content:"\e8bb"}.mdi-notification-event-busy:before{content:"\e8bc"}.mdi-notification-event-note:before{content:"\e8bd"}.mdi-notification-folder-special:before{content:"\e8be"}.mdi-notification-mms:before{content:"\e8bf"}.mdi-notification-more:before{content:"\e8c0"}.mdi-notification-network-locked:before{content:"\e8c1"}.mdi-notification-phone-bluetooth-speaker:before{content:"\e8c2"}.mdi-notification-phone-forwarded:before{content:"\e8c3"}.mdi-notification-phone-in-talk:before{content:"\e8c4"}.mdi-notification-phone-locked:before{content:"\e8c5"}.mdi-notification-phone-missed:before{content:"\e8c6"}.mdi-notification-phone-paused:before{content:"\e8c7"}.mdi-notification-play-download:before{content:"\e8c8"}.mdi-notification-play-install:before{content:"\e8c9"}.mdi-notification-sd-card:before{content:"\e8ca"}.mdi-notification-sim-card-alert:before{content:"\e8cb"}.mdi-notification-sms-failed:before{content:"\e8cc"}.mdi-notification-sms:before{content:"\e8cd"}.mdi-notification-sync-disabled:before{content:"\e8ce"}.mdi-notification-sync-problem:before{content:"\e8cf"}.mdi-notification-sync:before{content:"\e8d0"}.mdi-notification-system-update:before{content:"\e8d1"}.mdi-notification-tap-and-play:before{content:"\e8d2"}.mdi-notification-time-to-leave:before{content:"\e8d3"}.mdi-notification-vibration:before{content:"\e8d4"}.mdi-notification-voice-chat:before{content:"\e8d5"}.mdi-notification-vpn-lock:before{content:"\e8d6"}.mdi-social-cake:before{content:"\e8d7"}.mdi-social-domain:before{content:"\e8d8"}.mdi-social-group-add:before{content:"\e8d9"}.mdi-social-group:before{content:"\e8da"}.mdi-social-location-city:before{content:"\e8db"}.mdi-social-mood:before{content:"\e8dc"}.mdi-social-notifications-none:before{content:"\e8dd"}.mdi-social-notifications-off:before{content:"\e8de"}.mdi-social-notifications-on:before{content:"\e8df"}.mdi-social-notifications-paused:before{content:"\e8e0"}.mdi-social-notifications:before{content:"\e8e1"}.mdi-social-pages:before{content:"\e8e2"}.mdi-social-party-mode:before{content:"\e8e3"}.mdi-social-people-outline:before{content:"\e8e4"}.mdi-social-people:before{content:"\e8e5"}.mdi-social-person-add:before{content:"\e8e6"}.mdi-social-person-outline:before{content:"\e8e7"}.mdi-social-person:before{content:"\e8e8"}.mdi-social-plus-one:before{content:"\e8e9"}.mdi-social-poll:before{content:"\e8ea"}.mdi-social-public:before{content:"\e8eb"}.mdi-social-school:before{content:"\e8ec"}.mdi-social-share:before{content:"\e8ed"}.mdi-social-whatshot:before{content:"\e8ee"}.mdi-toggle-check-box-outline-blank:before{content:"\e8ef"}.mdi-toggle-check-box:before{content:"\e8f0"}.mdi-toggle-radio-button-off:before{content:"\e8f1"}.mdi-toggle-radio-button-on:before{content:"\e8f2"}.mdi-toggle-star-half:before{content:"\e8f3"}.mdi-toggle-star-outline:before{content:"\e8f4"}.mdi-toggle-star:before{content:"\e8f5"}.container{margin:0 auto;max-width:1280px;width:90%}@media only screen and (min-width : 601px){.container{width:85%}}@media only screen and (min-width : 993px){.container{width:70%}}.container .row{margin-left:-0.75rem;margin-right:-0.75rem}.section{padding-top:1rem;padding-bottom:1rem}.section.no-pad{padding:0}.section.no-pad-bot{padding-bottom:0}.section.no-pad-top{padding-top:0}.row{margin-left:auto;margin-right:auto;margin-bottom:20px}.row:after{content:"";display:table;clear:both}.row .col{float:left;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0 0.75rem}.row .col.s1{width:8.33333%;margin-left:0}.row .col.s2{width:16.66667%;margin-left:0}.row .col.s3{width:25%;margin-left:0}.row .col.s4{width:33.33333%;margin-left:0}.row .col.s5{width:41.66667%;margin-left:0}.row .col.s6{width:50%;margin-left:0}.row .col.s7{width:58.33333%;margin-left:0}.row .col.s8{width:66.66667%;margin-left:0}.row .col.s9{width:75%;margin-left:0}.row .col.s10{width:83.33333%;margin-left:0}.row .col.s11{width:91.66667%;margin-left:0}.row .col.s12{width:100%;margin-left:0}.row .col.offset-s1{margin-left:8.33333%}.row .col.offset-s2{margin-left:16.66667%}.row .col.offset-s3{margin-left:25%}.row .col.offset-s4{margin-left:33.33333%}.row .col.offset-s5{margin-left:41.66667%}.row .col.offset-s6{margin-left:50%}.row .col.offset-s7{margin-left:58.33333%}.row .col.offset-s8{margin-left:66.66667%}.row .col.offset-s9{margin-left:75%}.row .col.offset-s10{margin-left:83.33333%}.row .col.offset-s11{margin-left:91.66667%}.row .col.offset-s12{margin-left:100%}@media only screen and (min-width : 601px){.row .col.m1{width:8.33333%;margin-left:0}.row .col.m2{width:16.66667%;margin-left:0}.row .col.m3{width:25%;margin-left:0}.row .col.m4{width:33.33333%;margin-left:0}.row .col.m5{width:41.66667%;margin-left:0}.row .col.m6{width:50%;margin-left:0}.row .col.m7{width:58.33333%;margin-left:0}.row .col.m8{width:66.66667%;margin-left:0}.row .col.m9{width:75%;margin-left:0}.row .col.m10{width:83.33333%;margin-left:0}.row .col.m11{width:91.66667%;margin-left:0}.row .col.m12{width:100%;margin-left:0}.row .col.offset-m1{margin-left:8.33333%}.row .col.offset-m2{margin-left:16.66667%}.row .col.offset-m3{margin-left:25%}.row .col.offset-m4{margin-left:33.33333%}.row .col.offset-m5{margin-left:41.66667%}.row .col.offset-m6{margin-left:50%}.row .col.offset-m7{margin-left:58.33333%}.row .col.offset-m8{margin-left:66.66667%}.row .col.offset-m9{margin-left:75%}.row .col.offset-m10{margin-left:83.33333%}.row .col.offset-m11{margin-left:91.66667%}.row .col.offset-m12{margin-left:100%}}@media only screen and (min-width : 993px){.row .col.l1{width:8.33333%;margin-left:0}.row .col.l2{width:16.66667%;margin-left:0}.row .col.l3{width:25%;margin-left:0}.row .col.l4{width:33.33333%;margin-left:0}.row .col.l5{width:41.66667%;margin-left:0}.row .col.l6{width:50%;margin-left:0}.row .col.l7{width:58.33333%;margin-left:0}.row .col.l8{width:66.66667%;margin-left:0}.row .col.l9{width:75%;margin-left:0}.row .col.l10{width:83.33333%;margin-left:0}.row .col.l11{width:91.66667%;margin-left:0}.row .col.l12{width:100%;margin-left:0}.row .col.offset-l1{margin-left:8.33333%}.row .col.offset-l2{margin-left:16.66667%}.row .col.offset-l3{margin-left:25%}.row .col.offset-l4{margin-left:33.33333%}.row .col.offset-l5{margin-left:41.66667%}.row .col.offset-l6{margin-left:50%}.row .col.offset-l7{margin-left:58.33333%}.row .col.offset-l8{margin-left:66.66667%}.row .col.offset-l9{margin-left:75%}.row .col.offset-l10{margin-left:83.33333%}.row .col.offset-l11{margin-left:91.66667%}.row .col.offset-l12{margin-left:100%}}nav{color:#fff;background-color:#ee6e73;width:100%;height:56px;line-height:56px}nav a{color:#fff}nav .nav-wrapper{position:relative;height:100%}nav .nav-wrapper i{display:block;font-size:2rem}@media only screen and (min-width : 993px){nav a.button-collapse{display:none}}nav .button-collapse{float:left;position:relative;z-index:1;height:56px}nav .button-collapse i{font-size:2.7rem;height:56px;line-height:56px}nav .brand-logo{position:absolute;color:#fff;display:inline-block;font-size:2.1rem;padding:0;white-space:nowrap}nav .brand-logo.center{left:50%;-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);-ms-transform:translateX(-50%);-o-transform:translateX(-50%);transform:translateX(-50%)}@media only screen and (max-width : 992px){nav .brand-logo{left:50%;-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);-ms-transform:translateX(-50%);-o-transform:translateX(-50%);transform:translateX(-50%);}}nav .brand-logo.right{right:0.5rem;padding:0}nav ul{margin:0}nav ul li{-webkit-transition:background-color .3s;-moz-transition:background-color .3s;-o-transition:background-color .3s;-ms-transition:background-color .3s;transition:background-color .3s;float:left;padding:0}nav ul li:hover,nav ul li.active{background-color:rgba(0,0,0,0.1)}nav ul a{font-size:1rem;color:#fff;display:block;padding:0 15px}nav ul.left{float:left}nav .input-field{margin:0}nav .input-field input{height:100%;font-size:1.2rem;border:none;padding-left:2rem}nav .input-field input:focus,nav .input-field input[type=text]:valid,nav .input-field input[type=password]:valid,nav .input-field input[type=email]:valid,nav .input-field input[type=url]:valid,nav .input-field input[type=date]:valid{border:none;box-shadow:none}nav .input-field label{top:0;left:0}nav .input-field label i{color:rgba(255,255,255,0.7);-webkit-transition:color .3s;-moz-transition:color .3s;-o-transition:color .3s;-ms-transition:color .3s;transition:color .3s}nav .input-field label.active i{color:#fff}nav .input-field label.active{-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);transform:translateY(0)}.navbar-fixed{position:relative;height:56px;z-index:998}.navbar-fixed nav{position:fixed}@media only screen and (min-width : 601px){nav,nav .nav-wrapper i,nav a.button-collapse,nav a.button-collapse i{height:64px;line-height:64px}.navbar-fixed{height:64px}}@font-face{font-family:"Roboto";src:url("../font/roboto/Roboto-Thin.woff2") format("woff2"),url("../font/roboto/Roboto-Thin.woff") format("woff"),url("../font/roboto/Roboto-Thin.ttf") format("truetype");font-weight:200;}@font-face{font-family:"Roboto";src:url("../font/roboto/Roboto-Light.woff2") format("woff2"),url("../font/roboto/Roboto-Light.woff") format("woff"),url("../font/roboto/Roboto-Light.ttf") format("truetype");font-weight:300;}@font-face{font-family:"Roboto";src:url("../font/roboto/Roboto-Regular.woff2") format("woff2"),url("../font/roboto/Roboto-Regular.woff") format("woff"),url("../font/roboto/Roboto-Regular.ttf") format("truetype");font-weight:400;}@font-face{font-family:"Roboto";src:url("../font/roboto/Roboto-Medium.woff2") format("woff2"),url("../font/roboto/Roboto-Medium.woff") format("woff"),url("../font/roboto/Roboto-Medium.ttf") format("truetype");font-weight:500;}@font-face{font-family:"Roboto";src:url("../font/roboto/Roboto-Bold.woff2") format("woff2"),url("../font/roboto/Roboto-Bold.woff") format("woff"),url("../font/roboto/Roboto-Bold.ttf") format("truetype");font-weight:700;}a{text-decoration:none}html{line-height:1.5;font-family:"Roboto", sans-serif;font-weight:normal;color:rgba(0,0,0,0.87)}@media only screen and (min-width: 0){html{font-size:14px;}}@media only screen and (min-width: 992px){html{font-size:14.5px;}}@media only screen and (min-width: 1200px){html{font-size:15px;}}h1,h2,h3,h4,h5,h6{font-weight:400;line-height:1.1}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{font-weight:inherit}h1{font-size:4.2rem;line-height:110%;margin:2.1rem 0 1.68rem 0}h2{font-size:3.56rem;line-height:110%;margin:1.78rem 0 1.424rem 0}h3{font-size:2.92rem;line-height:110%;margin:1.46rem 0 1.168rem 0}h4{font-size:2.28rem;line-height:110%;margin:1.14rem 0 0.912rem 0}h5{font-size:1.64rem;line-height:110%;margin:0.82rem 0 0.656rem 0}h6{font-size:1rem;line-height:110%;margin:0.5rem 0 0.4rem 0}em{font-style:italic}strong{font-weight:500}small{font-size:75%}.light,footer.page-footer .footer-copyright{font-weight:300}.thin{font-weight:200}.flow-text{font-weight:300}@media only screen and (min-width: 360px){.flow-text{font-size:1.2rem;}}@media only screen and (min-width: 390px){.flow-text{font-size:1.224rem;}}@media only screen and (min-width: 420px){.flow-text{font-size:1.248rem;}}@media only screen and (min-width: 450px){.flow-text{font-size:1.272rem;}}@media only screen and (min-width: 480px){.flow-text{font-size:1.296rem;}}@media only screen and (min-width: 510px){.flow-text{font-size:1.32rem;}}@media only screen and (min-width: 540px){.flow-text{font-size:1.344rem;}}@media only screen and (min-width: 570px){.flow-text{font-size:1.368rem;}}@media only screen and (min-width: 600px){.flow-text{font-size:1.392rem;}}@media only screen and (min-width: 630px){.flow-text{font-size:1.416rem;}}@media only screen and (min-width: 660px){.flow-text{font-size:1.44rem;}}@media only screen and (min-width: 690px){.flow-text{font-size:1.464rem;}}@media only screen and (min-width: 720px){.flow-text{font-size:1.488rem;}}@media only screen and (min-width: 750px){.flow-text{font-size:1.512rem;}}@media only screen and (min-width: 780px){.flow-text{font-size:1.536rem;}}@media only screen and (min-width: 810px){.flow-text{font-size:1.56rem;}}@media only screen and (min-width: 840px){.flow-text{font-size:1.584rem;}}@media only screen and (min-width: 870px){.flow-text{font-size:1.608rem;}}@media only screen and (min-width: 900px){.flow-text{font-size:1.632rem;}}@media only screen and (min-width: 930px){.flow-text{font-size:1.656rem;}}@media only screen and (min-width: 960px){.flow-text{font-size:1.68rem;}}@media only screen and (max-width: 360px){.flow-text{font-size:1.2rem;}}.card-panel{transition:box-shadow .25s;padding:20px;margin:0.5rem 0 1rem 0;border-radius:2px;background-color:#fff}.card{position:relative;overflow:hidden;margin:0.5rem 0 1rem 0;background-color:#fff;transition:box-shadow .25s;border-radius:2px}.card .card-title{color:#fff;font-size:24px;font-weight:300}.card .card-title.activator{cursor:pointer}.card.small,.card.medium,.card.large{position:relative}.card.small .card-image,.card.medium .card-image,.card.large .card-image{overflow:hidden}.card.small .card-content,.card.medium .card-content,.card.large .card-content{overflow:hidden}.card.small .card-action,.card.medium .card-action,.card.large .card-action{position:absolute;bottom:0;left:0;right:0}.card.small{height:300px}.card.small .card-image{height:150px}.card.small .card-content{height:150px}.card.medium{height:400px}.card.medium .card-image{height:250px}.card.medium .card-content{height:150px}.card.large{height:500px}.card.large .card-image{height:330px}.card.large .card-content{height:170px}.card .card-image{position:relative}.card .card-image img{border-radius:2px 2px 0 0;position:relative;left:0;right:0;top:0;bottom:0;width:100%}.card .card-image .card-title{position:absolute;bottom:0;left:0;padding:20px}.card .card-content{padding:20px;border-radius:0 0 2px 2px}.card .card-content p{margin:0;color:inherit}.card .card-content .card-title{line-height:48px}.card .card-action{border-top:1px solid rgba(160,160,160,0.2);padding:20px}.card .card-action a{color:#ffab40;margin-right:20px;-webkit-transition:color .3s ease;-moz-transition:color .3s ease;-o-transition:color .3s ease;-ms-transition:color .3s ease;transition:color .3s ease;text-transform:uppercase}.card .card-action a:hover{color:#ffd8a6}.card .card-reveal{padding:20px;position:absolute;background-color:#fff;width:100%;overflow-y:auto;top:100%;height:100%;z-index:1;display:none}.card .card-reveal .card-title{cursor:pointer;display:block}#toast-container{display:block;position:fixed;z-index:1001}@media only screen and (max-width : 600px){#toast-container{min-width:100%;bottom:0%;}}@media only screen and (min-width : 601px) and (max-width : 992px){#toast-container{min-width:30%;left:5%;bottom:7%;}}@media only screen and (min-width : 993px){#toast-container{min-width:8%;top:10%;right:7%;}}.toast{border-radius:2px;top:0;width:auto;clear:both;margin-top:10px;position:relative;max-width:100%;height:48px;line-height:48px;background-color:#323232;padding:0 25px;font-size:1.1rem;font-weight:300;color:#fff;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-flex-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;-webkit-justify-content:space-between;justify-content:space-between}.toast .btn,.toast .btn-large,.toast .btn-flat{margin:0;margin-left:3rem}.toast.rounded{border-radius:24px}@media only screen and (max-width : 600px){.toast{width:100%;border-radius:0;}}@media only screen and (min-width : 601px) and (max-width : 992px){.toast{float:left;}}@media only screen and (min-width : 993px){.toast{float:right;}}.tabs{position:relative;height:48px;background-color:#fff;margin:0 auto;width:100%;white-space:nowrap}.tabs .tab{display:block;float:left;text-align:center;line-height:48px;height:48px;padding:0 20px;margin:0;text-transform:uppercase;letter-spacing:.8px;width:15%}.tabs .tab a{color:#ee6e73;display:block;width:100%;height:100%;-webkit-transition:color .28s ease;-moz-transition:color .28s ease;-o-transition:color .28s ease;-ms-transition:color .28s ease;transition:color .28s ease}.tabs .tab a:hover{color:#f9c9cb}.tabs .tab.disabled a{color:#f9c9cb;cursor:default}.tabs .indicator{position:absolute;bottom:0;height:2px;background-color:#f6b2b5;will-change:left, right}.tabs .tab{padding:0}.material-tooltip{padding:10px 8px;font-size:1rem;z-index:2000;background-color:transparent;border-radius:2px;color:#fff;min-height:36px;line-height:1rem;opacity:0;display:none;position:absolute;text-align:center;overflow:hidden;left:0;top:0;will-change:top, left}.backdrop{position:absolute;opacity:0;display:none;height:7px;width:14px;border-radius:0 0 14px 14px;background-color:#323232;z-index:-1;-webkit-transform-origin:50% 10%;-moz-transform-origin:50% 10%;-ms-transform-origin:50% 10%;-o-transform-origin:50% 10%;transform-origin:50% 10%;will-change:transform, opacity}.btn,.btn-large,.btn-flat{border:none;border-radius:2px;display:inline-block;height:36px;line-height:36px;outline:0;padding:0 2rem;text-transform:uppercase;vertical-align:middle;-webkit-tap-highlight-color:transparent}.btn.disabled,.disabled.btn-large,.btn-floating.disabled,.btn-large.disabled,.btn:disabled,.btn-large:disabled,.btn-large:disabled,.btn-floating:disabled{background-color:#DFDFDF !important;box-shadow:none;color:#9F9F9F !important;cursor:default}.btn.disabled *,.disabled.btn-large *,.btn-floating.disabled *,.btn-large.disabled *,.btn:disabled *,.btn-large:disabled *,.btn-large:disabled *,.btn-floating:disabled *{pointer-events:none}.btn.disabled:hover,.disabled.btn-large:hover,.btn-floating.disabled:hover,.btn-large.disabled:hover,.btn:disabled:hover,.btn-large:disabled:hover,.btn-large:disabled:hover,.btn-floating:disabled:hover{background-color:#DFDFDF;color:#9F9F9F}.btn i,.btn-large i,.btn-floating i,.btn-large i,.btn-flat i{font-size:1.3rem;line-height:inherit}.btn,.btn-large{text-decoration:none;color:#fff;background-color:#26a69a;text-align:center;letter-spacing:.5px;-webkit-transition:.2s ease-out;-moz-transition:.2s ease-out;-o-transition:.2s ease-out;-ms-transition:.2s ease-out;transition:.2s ease-out;cursor:pointer}.btn:hover,.btn-large:hover{background-color:#2bbbad}.btn-floating{display:inline-block;color:#fff;position:relative;overflow:hidden;z-index:1;width:37px;height:37px;line-height:37px;padding:0;background-color:#26a69a;border-radius:50%;transition:.3s;cursor:pointer;vertical-align:middle}.btn-floating i{width:inherit;display:inline-block;text-align:center;color:#fff;font-size:1.6rem;line-height:37px}.btn-floating:before{border-radius:0}.btn-floating.btn-large{width:55.5px;height:55.5px}.btn-floating.btn-large i{line-height:55.5px}button.btn-floating{border:none}.fixed-action-btn{position:fixed;right:23px;bottom:23px;padding-top:15px;margin-bottom:0;z-index:998}.fixed-action-btn ul{left:0;right:0;text-align:center;position:absolute;bottom:64px;margin:0}.fixed-action-btn ul li{margin-bottom:15px}.fixed-action-btn ul a.btn-floating{opacity:0}.btn-flat{box-shadow:none;background-color:transparent;color:#343434;cursor:pointer}.btn-flat.disabled{color:#b3b3b3;cursor:default}.btn-large{height:54px;line-height:56px}.btn-large i{font-size:1.6rem}.btn-block{display:block}.dropdown-content{background-color:#fff;margin:0;display:none;min-width:100px;max-height:650px;overflow-y:auto;opacity:0;position:absolute;z-index:999;will-change:width, height}.dropdown-content li{clear:both;color:rgba(0,0,0,0.87);cursor:pointer;line-height:1.5rem;width:100%;text-align:left;text-transform:none}.dropdown-content li:hover,.dropdown-content li.active{background-color:#eee}.dropdown-content li>a,.dropdown-content li>span{font-size:1.2rem;color:#26a69a;display:block;padding:1rem 1rem}.dropdown-content li>a>i{height:inherit;line-height:inherit}/*! + * Waves v0.6.0 + * http://fian.my.id/Waves + * + * Copyright 2014 Alfiana E. Sibuea and other contributors + * Released under the MIT license + * https://github.com/fians/Waves/blob/master/LICENSE + */.waves-effect{position:relative;cursor:pointer;display:inline-block;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;vertical-align:middle;z-index:1;will-change:opacity, transform;-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;-o-transition:all .3s ease-out;-ms-transition:all .3s ease-out;transition:all .3s ease-out}.waves-effect .waves-ripple{position:absolute;border-radius:50%;width:20px;height:20px;margin-top:-10px;margin-left:-10px;opacity:0;background:rgba(0,0,0,0.2);-webkit-transition:all 0.7s ease-out;-moz-transition:all 0.7s ease-out;-o-transition:all 0.7s ease-out;-ms-transition:all 0.7s ease-out;transition:all 0.7s ease-out;-webkit-transition-property:-webkit-transform, opacity;-moz-transition-property:-moz-transform, opacity;-o-transition-property:-o-transform, opacity;transition-property:transform, opacity;-webkit-transform:scale(0);-moz-transform:scale(0);-ms-transform:scale(0);-o-transform:scale(0);transform:scale(0);pointer-events:none}.waves-effect.waves-light .waves-ripple{background-color:rgba(255,255,255,0.45)}.waves-effect.waves-red .waves-ripple{background-color:rgba(244,67,54,0.7)}.waves-effect.waves-yellow .waves-ripple{background-color:rgba(255,235,59,0.7)}.waves-effect.waves-orange .waves-ripple{background-color:rgba(255,152,0,0.7)}.waves-effect.waves-purple .waves-ripple{background-color:rgba(156,39,176,0.7)}.waves-effect.waves-green .waves-ripple{background-color:rgba(76,175,80,0.7)}.waves-effect.waves-teal .waves-ripple{background-color:rgba(0,150,136,0.7)}.waves-notransition{-webkit-transition:none !important;-moz-transition:none !important;-o-transition:none !important;-ms-transition:none !important;transition:none !important}.waves-circle{-webkit-transform:translateZ(0);-moz-transform:translateZ(0);-ms-transform:translateZ(0);-o-transform:translateZ(0);transform:translateZ(0);-webkit-mask-image:-webkit-radial-gradient(circle, white 100%, black 100%)}.waves-input-wrapper{border-radius:0.2em;vertical-align:bottom}.waves-input-wrapper .waves-button-input{position:relative;top:0;left:0;z-index:1}.waves-circle{text-align:center;width:2.5em;height:2.5em;line-height:2.5em;border-radius:50%;-webkit-mask-image:none}.waves-block{display:block}a.waves-effect .waves-ripple{z-index:-1}.modal{display:none;position:fixed;left:0;right:0;background-color:#fafafa;padding:0;max-height:70%;width:55%;margin:auto;overflow-y:auto;border-radius:2px;will-change:top, opacity}@media only screen and (max-width : 992px){.modal{width:80%;}}.modal h1,.modal h2,.modal h3,.modal h4{margin-top:0}.modal .modal-content{padding:24px}.modal .modal-close{cursor:pointer}.modal .modal-footer{border-radius:0 0 2px 2px;background-color:#fafafa;padding:4px 6px;height:56px;width:100%}.modal .modal-footer .btn,.modal .modal-footer .btn-large,.modal .modal-footer .btn-flat{float:right;margin:6px 0}.lean-overlay{position:fixed;z-index:999;top:-100px;left:0;bottom:0;right:0;height:125%;width:100%;background:#000;display:none;will-change:opacity}.modal.modal-fixed-footer{padding:0;height:70%}.modal.modal-fixed-footer .modal-content{position:absolute;height:calc(100% - 56px);max-height:100%;width:100%;overflow-y:auto}.modal.modal-fixed-footer .modal-footer{border-top:1px solid rgba(0,0,0,0.1);position:absolute;bottom:0}.modal.bottom-sheet{top:auto;bottom:-100%;margin:0;width:100%;max-height:45%;border-radius:0;will-change:bottom, opacity}.collapsible{border-top:1px solid #ddd;border-right:1px solid #ddd;border-left:1px solid #ddd;margin:0.5rem 0 1rem 0}.collapsible-header{display:block;cursor:pointer;height:3rem;line-height:3rem;padding:0 1rem;background-color:#fff;border-bottom:1px solid #ddd}.collapsible-header i{width:2rem;font-size:1.6rem;line-height:3rem;display:block;float:left;text-align:center;margin-right:1rem}.collapsible-body{display:none;border-bottom:1px solid #ddd;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.collapsible-body p{margin:0;padding:2rem}.side-nav .collapsible{border:none;box-shadow:none}.side-nav .collapsible li{padding:0}.side-nav .collapsible-header{background-color:transparent;border:none;line-height:inherit;height:inherit;margin:0 1rem}.side-nav .collapsible-header i{line-height:inherit}.side-nav .collapsible-body{border:0;background-color:#fff}.side-nav .collapsible-body li a{margin:0 1rem 0 2rem}.collapsible.popout{border:none;box-shadow:none}.collapsible.popout>li{box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);margin:0 24px;transition:margin .35s cubic-bezier(0.25, 0.46, 0.45, 0.94)}.collapsible.popout>li.active{box-shadow:0 5px 11px 0 rgba(0,0,0,0.18),0 4px 15px 0 rgba(0,0,0,0.15);margin:16px 0}.materialboxed{cursor:zoom-in;position:relative;-webkit-transition:opacity .4s;-moz-transition:opacity .4s;-o-transition:opacity .4s;-ms-transition:opacity .4s;transition:opacity .4s}.materialboxed:hover{will-change:left, top, width, height}.materialboxed:hover:not(.active){opacity:.8}.materialboxed.active{cursor:zoom-out}#materialbox-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:#292929;z-index:999;will-change:opacity}.materialbox-caption{position:fixed;display:none;color:#fff;line-height:50px;bottom:0;width:100%;text-align:center;padding:0% 15%;height:50px;z-index:1000;-webkit-font-smoothing:antialiased}select:focus{outline:1px solid #c9f3ef}button:focus{outline:none;background-color:#2ab7a9}label{font-size:0.8rem;color:#9e9e9e}::-webkit-input-placeholder{color:#d1d1d1}:-moz-placeholder{color:#d1d1d1}::-moz-placeholder{color:#d1d1d1}:-ms-input-placeholder{color:#d1d1d1}input[type=text],input[type=password],input[type=email],input[type=url],input[type=time],input[type=date],input[type=datetime-local],input[type=tel],input[type=number],input[type=search],textarea.materialize-textarea{background-color:transparent;border:none;border-bottom:1px solid #9e9e9e;border-radius:0;outline:none;height:3rem;width:100%;font-size:1rem;margin:0 0 15px 0;padding:0;box-shadow:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;transition:all .3s}input[type=text]:disabled,input[type=text][readonly="readonly"],input[type=password]:disabled,input[type=password][readonly="readonly"],input[type=email]:disabled,input[type=email][readonly="readonly"],input[type=url]:disabled,input[type=url][readonly="readonly"],input[type=time]:disabled,input[type=time][readonly="readonly"],input[type=date]:disabled,input[type=date][readonly="readonly"],input[type=datetime-local]:disabled,input[type=datetime-local][readonly="readonly"],input[type=tel]:disabled,input[type=tel][readonly="readonly"],input[type=number]:disabled,input[type=number][readonly="readonly"],input[type=search]:disabled,input[type=search][readonly="readonly"],textarea.materialize-textarea:disabled,textarea.materialize-textarea[readonly="readonly"]{color:rgba(0,0,0,0.26);border-bottom:1px dotted rgba(0,0,0,0.26)}input[type=text]:disabled+label,input[type=text][readonly="readonly"]+label,input[type=password]:disabled+label,input[type=password][readonly="readonly"]+label,input[type=email]:disabled+label,input[type=email][readonly="readonly"]+label,input[type=url]:disabled+label,input[type=url][readonly="readonly"]+label,input[type=time]:disabled+label,input[type=time][readonly="readonly"]+label,input[type=date]:disabled+label,input[type=date][readonly="readonly"]+label,input[type=datetime-local]:disabled+label,input[type=datetime-local][readonly="readonly"]+label,input[type=tel]:disabled+label,input[type=tel][readonly="readonly"]+label,input[type=number]:disabled+label,input[type=number][readonly="readonly"]+label,input[type=search]:disabled+label,input[type=search][readonly="readonly"]+label,textarea.materialize-textarea:disabled+label,textarea.materialize-textarea[readonly="readonly"]+label{color:rgba(0,0,0,0.26)}input[type=text]:focus:not([readonly]),input[type=password]:focus:not([readonly]),input[type=email]:focus:not([readonly]),input[type=url]:focus:not([readonly]),input[type=time]:focus:not([readonly]),input[type=date]:focus:not([readonly]),input[type=datetime-local]:focus:not([readonly]),input[type=tel]:focus:not([readonly]),input[type=number]:focus:not([readonly]),input[type=search]:focus:not([readonly]),textarea.materialize-textarea:focus:not([readonly]){border-bottom:1px solid #26a69a;box-shadow:0 1px 0 0 #26a69a}input[type=text]:focus:not([readonly])+label,input[type=password]:focus:not([readonly])+label,input[type=email]:focus:not([readonly])+label,input[type=url]:focus:not([readonly])+label,input[type=time]:focus:not([readonly])+label,input[type=date]:focus:not([readonly])+label,input[type=datetime-local]:focus:not([readonly])+label,input[type=tel]:focus:not([readonly])+label,input[type=number]:focus:not([readonly])+label,input[type=search]:focus:not([readonly])+label,textarea.materialize-textarea:focus:not([readonly])+label{color:#26a69a}input[type=text].valid,input[type=text]:focus.valid,input[type=password].valid,input[type=password]:focus.valid,input[type=email].valid,input[type=email]:focus.valid,input[type=url].valid,input[type=url]:focus.valid,input[type=time].valid,input[type=time]:focus.valid,input[type=date].valid,input[type=date]:focus.valid,input[type=datetime-local].valid,input[type=datetime-local]:focus.valid,input[type=tel].valid,input[type=tel]:focus.valid,input[type=number].valid,input[type=number]:focus.valid,input[type=search].valid,input[type=search]:focus.valid,textarea.materialize-textarea.valid,textarea.materialize-textarea:focus.valid{border-bottom:1px solid #4CAF50;box-shadow:0 1px 0 0 #4CAF50}input[type=text].valid+label:after,input[type=text]:focus.valid+label:after,input[type=password].valid+label:after,input[type=password]:focus.valid+label:after,input[type=email].valid+label:after,input[type=email]:focus.valid+label:after,input[type=url].valid+label:after,input[type=url]:focus.valid+label:after,input[type=time].valid+label:after,input[type=time]:focus.valid+label:after,input[type=date].valid+label:after,input[type=date]:focus.valid+label:after,input[type=datetime-local].valid+label:after,input[type=datetime-local]:focus.valid+label:after,input[type=tel].valid+label:after,input[type=tel]:focus.valid+label:after,input[type=number].valid+label:after,input[type=number]:focus.valid+label:after,input[type=search].valid+label:after,input[type=search]:focus.valid+label:after,textarea.materialize-textarea.valid+label:after,textarea.materialize-textarea:focus.valid+label:after{content:attr(data-success);color:#4CAF50;opacity:1}input[type=text].invalid,input[type=text]:focus.invalid,input[type=password].invalid,input[type=password]:focus.invalid,input[type=email].invalid,input[type=email]:focus.invalid,input[type=url].invalid,input[type=url]:focus.invalid,input[type=time].invalid,input[type=time]:focus.invalid,input[type=date].invalid,input[type=date]:focus.invalid,input[type=datetime-local].invalid,input[type=datetime-local]:focus.invalid,input[type=tel].invalid,input[type=tel]:focus.invalid,input[type=number].invalid,input[type=number]:focus.invalid,input[type=search].invalid,input[type=search]:focus.invalid,textarea.materialize-textarea.invalid,textarea.materialize-textarea:focus.invalid{border-bottom:1px solid #F44336;box-shadow:0 1px 0 0 #F44336}input[type=text].invalid+label:after,input[type=text]:focus.invalid+label:after,input[type=password].invalid+label:after,input[type=password]:focus.invalid+label:after,input[type=email].invalid+label:after,input[type=email]:focus.invalid+label:after,input[type=url].invalid+label:after,input[type=url]:focus.invalid+label:after,input[type=time].invalid+label:after,input[type=time]:focus.invalid+label:after,input[type=date].invalid+label:after,input[type=date]:focus.invalid+label:after,input[type=datetime-local].invalid+label:after,input[type=datetime-local]:focus.invalid+label:after,input[type=tel].invalid+label:after,input[type=tel]:focus.invalid+label:after,input[type=number].invalid+label:after,input[type=number]:focus.invalid+label:after,input[type=search].invalid+label:after,input[type=search]:focus.invalid+label:after,textarea.materialize-textarea.invalid+label:after,textarea.materialize-textarea:focus.invalid+label:after{content:attr(data-error);color:#F44336;opacity:1}input[type=text]+label:after,input[type=password]+label:after,input[type=email]+label:after,input[type=url]+label:after,input[type=time]+label:after,input[type=date]+label:after,input[type=datetime-local]+label:after,input[type=tel]+label:after,input[type=number]+label:after,input[type=search]+label:after,textarea.materialize-textarea+label:after{display:block;content:"";position:absolute;top:65px;opacity:0;transition:.2s opacity ease-out,.2s color ease-out}.input-field{position:relative;margin-top:1rem}.input-field label{color:#9e9e9e;position:absolute;top:0.8rem;left:0.75rem;font-size:1rem;cursor:text;-webkit-transition:.2s ease-out;-moz-transition:.2s ease-out;-o-transition:.2s ease-out;-ms-transition:.2s ease-out;transition:.2s ease-out}.input-field label.active{font-size:0.8rem;-webkit-transform:translateY(-140%);-moz-transform:translateY(-140%);-ms-transform:translateY(-140%);-o-transform:translateY(-140%);transform:translateY(-140%)}.input-field .prefix{position:absolute;width:3rem;font-size:2rem;-webkit-transition:color .2s;-moz-transition:color .2s;-o-transition:color .2s;-ms-transition:color .2s;transition:color .2s}.input-field .prefix.active{color:#26a69a}.input-field .prefix ~ input,.input-field .prefix ~ textarea{margin-left:3rem;width:92%;width:calc(100% - 3rem)}.input-field .prefix ~ textarea{padding-top:.8rem}.input-field .prefix ~ label{margin-left:3rem}@media only screen and (max-width : 992px){.input-field .prefix ~ input{width:86%;width:calc(100% - 3rem)}}@media only screen and (max-width : 600px){.input-field .prefix ~ input{width:80%;width:calc(100% - 3rem)}}.input-field input[type=search]{display:block;line-height:inherit;padding-left:4rem;width:calc(100% - 4rem)}.input-field input[type=search]:focus{background-color:#fff;border:0;box-shadow:none;color:#444}.input-field input[type=search]:focus+label i,.input-field input[type=search]:focus ~ .mdi-navigation-close{color:#444}.input-field input[type=search]+label{left:1rem}.input-field input[type=search] ~ .mdi-navigation-close{position:absolute;top:0;right:1rem;color:transparent;cursor:pointer;font-size:2rem;transition:.3s color}textarea{width:100%;height:3rem;background-color:transparent}textarea.materialize-textarea{overflow-y:hidden;padding:1.6rem 0;resize:none;min-height:3rem}.hiddendiv{display:none;white-space:pre-wrap;word-wrap:break-word;overflow-wrap:break-word;padding-top:1.2rem}[type="radio"]:not(:checked),[type="radio"]:checked{position:absolute;left:-9999px;visibility:hidden}[type="radio"]:not(:checked)+label,[type="radio"]:checked+label{position:relative;padding-left:35px;cursor:pointer;display:inline-block;height:25px;line-height:25px;font-size:1rem;-webkit-transition:.28s ease;-moz-transition:.28s ease;-o-transition:.28s ease;-ms-transition:.28s ease;transition:.28s ease;-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none}[type="radio"]+label:before,[type="radio"]+label:after{content:'';position:absolute;left:0;top:0;margin:4px;width:16px;height:16px;z-index:0;-webkit-transition:.28s ease;-moz-transition:.28s ease;-o-transition:.28s ease;-ms-transition:.28s ease;transition:.28s ease}[type="radio"]:not(:checked)+label:before{border-radius:50%;border:2px solid #5a5a5a}[type="radio"]:not(:checked)+label:after{border-radius:50%;border:2px solid #5a5a5a;z-index:-1;-webkit-transform:scale(0);-moz-transform:scale(0);-ms-transform:scale(0);-o-transform:scale(0);transform:scale(0)}[type="radio"]:checked+label:before{border-radius:50%;border:2px solid transparent}[type="radio"]:checked+label:after{border-radius:50%;border:2px solid #26a69a;background-color:#26a69a;z-index:0;-webkit-transform:scale(1.02);-moz-transform:scale(1.02);-ms-transform:scale(1.02);-o-transform:scale(1.02);transform:scale(1.02)}[type="radio"].with-gap:checked+label:before{border-radius:50%;border:2px solid #26a69a}[type="radio"].with-gap:checked+label:after{border-radius:50%;border:2px solid #26a69a;background-color:#26a69a;z-index:0;-webkit-transform:scale(.5);-moz-transform:scale(.5);-ms-transform:scale(.5);-o-transform:scale(.5);transform:scale(.5)}[type="radio"].with-gap:disabled:checked+label:before{border:2px solid rgba(0,0,0,0.26)}[type="radio"].with-gap:disabled:checked+label:after{border:none;background-color:rgba(0,0,0,0.26)}[type="radio"]:disabled:not(:checked)+label:before,[type="radio"]:disabled:checked+label:before{background-color:transparent;border-color:rgba(0,0,0,0.26)}[type="radio"]:disabled+label{color:rgba(0,0,0,0.26)}[type="radio"]:disabled:not(:checked)+label:before{border-color:rgba(0,0,0,0.26)}[type="radio"]:disabled:checked+label:after{background-color:rgba(0,0,0,0.26);border-color:#BDBDBD}form p{margin-bottom:10px;text-align:left}form p:last-child{margin-bottom:0}[type="checkbox"]:not(:checked),[type="checkbox"]:checked{position:absolute;left:-9999px;visibility:hidden}[type="checkbox"]{}[type="checkbox"]+label{position:relative;padding-left:35px;cursor:pointer;display:inline-block;height:25px;line-height:25px;font-size:1rem;-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none}[type="checkbox"]+label:before{content:'';position:absolute;top:0;left:0;width:18px;height:18px;z-index:0;border:2px solid #5a5a5a;border-radius:1px;margin-top:2px;-webkit-transition:0.2s;-moz-transition:0.2s;-o-transition:0.2s;-ms-transition:0.2s;transition:0.2s}[type="checkbox"]:not(:checked):disabled+label:before{border:none;background-color:rgba(0,0,0,0.26)}[type="checkbox"]:checked+label:before{top:-4px;left:-3px;width:12px;height:22px;border-top:2px solid transparent;border-left:2px solid transparent;border-right:2px solid #26a69a;border-bottom:2px solid #26a69a;-webkit-transform:rotate(40deg);-moz-transform:rotate(40deg);-ms-transform:rotate(40deg);-o-transform:rotate(40deg);transform:rotate(40deg);-webkit-backface-visibility:hidden;-webkit-transform-origin:100% 100%;-moz-transform-origin:100% 100%;-ms-transform-origin:100% 100%;-o-transform-origin:100% 100%;transform-origin:100% 100%}[type="checkbox"]:checked:disabled+label:before{border-right:2px solid rgba(0,0,0,0.26);border-bottom:2px solid rgba(0,0,0,0.26)}[type="checkbox"]:indeterminate+label:before{left:-10px;top:-11px;width:10px;height:22px;border-top:none;border-left:none;border-right:2px solid #26a69a;border-bottom:none;-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg);-webkit-backface-visibility:hidden;-webkit-transform-origin:100% 100%;-moz-transform-origin:100% 100%;-ms-transform-origin:100% 100%;-o-transform-origin:100% 100%;transform-origin:100% 100%}[type="checkbox"]:indeterminate:disabled+label:before{border-right:2px solid rgba(0,0,0,0.26);background-color:transparent}[type="checkbox"].filled-in+label:after{border-radius:2px}[type="checkbox"].filled-in+label:before,[type="checkbox"].filled-in+label:after{content:'';left:0;position:absolute;transition:border .25s,background-color .25s,width .2s .1s,height .2s .1s,top .2s .1s,left .2s .1s;z-index:1}[type="checkbox"].filled-in:not(:checked)+label:before{width:0;height:0;border:3px solid transparent;left:6px;top:10px;-webkit-transform:rotateZ(37deg);transform:rotateZ(37deg);-webkit-transform-origin:20% 40%;transform-origin:100% 100%}[type="checkbox"].filled-in:not(:checked)+label:after{height:20px;width:20px;background-color:transparent;border:2px solid #5a5a5a;top:0px;z-index:0}[type="checkbox"].filled-in:checked+label:before{top:0;left:1px;width:8px;height:13px;border-top:2px solid transparent;border-left:2px solid transparent;border-right:2px solid #fff;border-bottom:2px solid #fff;-webkit-transform:rotateZ(37deg);transform:rotateZ(37deg);-webkit-transform-origin:100% 100%;transform-origin:100% 100%}[type="checkbox"].filled-in:checked+label:after{top:0px;width:20px;height:20px;border:2px solid #26a69a;background-color:#26a69a;z-index:0}[type="checkbox"].filled-in:disabled:not(:checked)+label:before{background-color:transparent;border:2px solid transparent}[type="checkbox"].filled-in:disabled:not(:checked)+label:after{border-color:transparent;background-color:#BDBDBD}[type="checkbox"].filled-in:disabled:checked+label:before{background-color:transparent}[type="checkbox"].filled-in:disabled:checked+label:after{background-color:#BDBDBD;border-color:#BDBDBD}.switch,.switch *{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none}.switch label{cursor:pointer}.switch label input[type=checkbox]{opacity:0;width:0;height:0}.switch label input[type=checkbox]:checked+.lever{background-color:#84c7c1}.switch label input[type=checkbox]:checked+.lever:after{background-color:#26a69a}.switch label .lever{content:"";display:inline-block;position:relative;width:40px;height:15px;background-color:#818181;border-radius:15px;margin-right:10px;transition:background 0.3s ease;vertical-align:middle;margin:0 16px}.switch label .lever:after{content:"";position:absolute;display:inline-block;width:21px;height:21px;background-color:#F1F1F1;border-radius:21px;box-shadow:0 1px 3px 1px rgba(0,0,0,0.4);left:-5px;top:-3px;transition:left 0.3s ease,background .3s ease,box-shadow 0.1s ease}input[type=checkbox]:checked:not(:disabled) ~ .lever:active:after{box-shadow:0 1px 3px 1px rgba(0,0,0,0.4),0 0 0 15px rgba(38,166,154,0.1)}input[type=checkbox]:not(:disabled) ~ .lever:active:after{box-shadow:0 1px 3px 1px rgba(0,0,0,0.4),0 0 0 15px rgba(0,0,0,0.08)}.switch label input[type=checkbox]:checked+.lever:after{left:24px}.switch input[type=checkbox][disabled]+.lever{cursor:default}.switch label input[type=checkbox][disabled]+.lever:after,.switch label input[type=checkbox][disabled]:checked+.lever:after{background-color:#BDBDBD}.select-label{position:absolute}.select-wrapper{position:relative}.select-wrapper input.select-dropdown{position:relative;cursor:pointer;background-color:transparent;border:none;border-bottom:1px solid #9e9e9e;outline:none;height:3rem;line-height:3rem;width:100%;font-size:1rem;margin:0 0 15px 0;padding:0;display:block}.select-wrapper span.caret{color:initial;position:absolute;right:0;top:16px;font-size:10px}.select-wrapper span.caret.disabled{color:rgba(0,0,0,0.26)}.select-wrapper+label{position:absolute;top:-14px;font-size:0.8rem}select{display:none}select.browser-default{display:block}select:disabled{color:rgba(0,0,0,0.3)}.select-wrapper input.select-dropdown:disabled{color:rgba(0,0,0,0.3);cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;border-bottom:1px solid rgba(0,0,0,0.3)}.select-wrapper i{color:rgba(0,0,0,0.3)}.select-dropdown li.disabled{color:rgba(0,0,0,0.3);background-color:transparent}.file-field{position:relative}.file-field .file-path-wrapper{overflow:hidden;padding-left:10px}.file-field input.file-path{width:100%}.file-field .btn,.file-field .btn-large{float:left;height:3rem;line-height:3rem}.file-field span{cursor:pointer}.file-field input[type=file]{position:absolute;top:0;right:0;left:0;bottom:0;width:100%;margin:0;padding:0;font-size:20px;cursor:pointer;opacity:0;filter:alpha(opacity=0)}.range-field{position:relative}input[type=range],input[type=range]+.thumb{cursor:pointer}input[type=range]{position:relative;background-color:transparent;border:none;outline:none;width:100%;margin:15px 0px;padding:0}input[type=range]+.thumb{position:absolute;border:none;height:0;width:0;border-radius:50%;background-color:#26a69a;top:10px;margin-left:-6px;-webkit-transform-origin:50% 50%;-moz-transform-origin:50% 50%;-ms-transform-origin:50% 50%;-o-transform-origin:50% 50%;transform-origin:50% 50%;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg)}input[type=range]+.thumb .value{display:block;width:30px;text-align:center;color:#26a69a;font-size:0;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}input[type=range]+.thumb.active{border-radius:50% 50% 50% 0}input[type=range]+.thumb.active .value{color:#fff;margin-left:-1px;margin-top:8px;font-size:10px}input[type=range]:focus{outline:none}input[type=range]{-webkit-appearance:none}input[type=range]::-webkit-slider-runnable-track{height:3px;background:#c2c0c2;border:none}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;border:none;height:14px;width:14px;border-radius:50%;background-color:#26a69a;transform-origin:50% 50%;margin:-5px 0 0 0;-webkit-transition:0.3s;-moz-transition:0.3s;-o-transition:0.3s;-ms-transition:0.3s;transition:0.3s}input[type=range]:focus::-webkit-slider-runnable-track{background:#ccc}input[type=range]{border:1px solid white}input[type=range]::-moz-range-track{height:3px;background:#ddd;border:none}input[type=range]::-moz-range-thumb{border:none;height:14px;width:14px;border-radius:50%;background:#26a69a;margin-top:-5px}input[type=range]:-moz-focusring{outline:1px solid white;outline-offset:-1px}input[type=range]:focus::-moz-range-track{background:#ccc}input[type=range]::-ms-track{height:3px;background:transparent;border-color:transparent;border-width:6px 0;color:transparent}input[type=range]::-ms-fill-lower{background:#777}input[type=range]::-ms-fill-upper{background:#ddd}input[type=range]::-ms-thumb{border:none;height:14px;width:14px;border-radius:50%;background:#26a69a}input[type=range]:focus::-ms-fill-lower{background:#888}input[type=range]:focus::-ms-fill-upper{background:#ccc}select{background-color:rgba(255,255,255,0.9);width:100%;padding:5px;border:1px solid #f2f2f2;border-radius:2px;height:3rem}.table-of-contents.fixed{position:fixed}.table-of-contents li{padding:2px 0}.table-of-contents a{display:inline-block;font-weight:300;color:#757575;padding-left:20px;height:1.5rem;line-height:1.5rem;letter-spacing:.4;display:inline-block}.table-of-contents a:hover{color:#a8a8a8;padding-left:19px;border-left:1px solid #ea4a4f}.table-of-contents a.active{font-weight:500;padding-left:18px;border-left:2px solid #ea4a4f}.side-nav{position:fixed;width:240px;left:-105%;top:0;margin:0;height:100%;height:calc(100% + 60px);height:-moz-calc(100%);padding-bottom:60px;background-color:#fff;z-index:999;overflow-y:auto;will-change:left}.side-nav.right-aligned{will-change:right;right:-105%;left:auto}.side-nav .collapsible{margin:0}.side-nav li{float:none;padding:0 15px}.side-nav li:hover,.side-nav li.active{background-color:#ddd}.side-nav a{color:#444;display:block;font-size:1rem;height:64px;line-height:64px;padding:0 15px}.drag-target{height:100%;width:10px;position:fixed;top:0;z-index:998}.side-nav.fixed a{display:block;padding:0 15px;color:#444}.side-nav.fixed{left:0;position:fixed}.side-nav.fixed.right-aligned{right:0;left:auto}@media only screen and (max-width : 992px){.side-nav.fixed{left:-105%}.side-nav.fixed.right-aligned{right:-105%;left:auto}}.side-nav .collapsible-body li.active,.side-nav.fixed .collapsible-body li.active{background-color:#ee6e73}.side-nav .collapsible-body li.active a,.side-nav.fixed .collapsible-body li.active a{color:#fff}#sidenav-overlay{position:fixed;top:0;left:0;right:0;height:120vh;background-color:rgba(0,0,0,0.5);z-index:997;will-change:opacity}.preloader-wrapper{display:inline-block;position:relative;width:48px;height:48px}.preloader-wrapper.small{width:36px;height:36px}.preloader-wrapper.big{width:64px;height:64px}.preloader-wrapper.active{-webkit-animation:container-rotate 1568ms linear infinite;animation:container-rotate 1568ms linear infinite}@-webkit-keyframes container-rotate{to{-webkit-transform:rotate(360deg)}}@keyframes container-rotate{to{transform:rotate(360deg)}}.spinner-layer{position:absolute;width:100%;height:100%;opacity:0}.spinner-blue,.spinner-blue-only{border-color:#4285f4}.spinner-red,.spinner-red-only{border-color:#db4437}.spinner-yellow,.spinner-yellow-only{border-color:#f4b400}.spinner-green,.spinner-green-only{border-color:#0f9d58}.active .spinner-layer.spinner-blue{-webkit-animation:fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both,blue-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;animation:fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both,blue-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.active .spinner-layer.spinner-red{-webkit-animation:fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both,red-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;animation:fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both,red-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.active .spinner-layer.spinner-yellow{-webkit-animation:fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both,yellow-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;animation:fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both,yellow-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.active .spinner-layer.spinner-green{-webkit-animation:fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both,green-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;animation:fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both,green-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.active .spinner-layer.spinner-blue-only,.active .spinner-layer.spinner-red-only,.active .spinner-layer.spinner-yellow-only,.active .spinner-layer.spinner-green-only{opacity:1;-webkit-animation:fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;animation:fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}@-webkit-keyframes fill-unfill-rotate{12.5%{-webkit-transform:rotate(135deg)}25%{-webkit-transform:rotate(270deg)}37.5%{-webkit-transform:rotate(405deg)}50%{-webkit-transform:rotate(540deg)}62.5%{-webkit-transform:rotate(675deg)}75%{-webkit-transform:rotate(810deg)}87.5%{-webkit-transform:rotate(945deg)}to{-webkit-transform:rotate(1080deg)}}@keyframes fill-unfill-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}to{transform:rotate(1080deg)}}@-webkit-keyframes blue-fade-in-out{from{opacity:1}25%{opacity:1}26%{opacity:0}89%{opacity:0}90%{opacity:1}100%{opacity:1}}@keyframes blue-fade-in-out{from{opacity:1}25%{opacity:1}26%{opacity:0}89%{opacity:0}90%{opacity:1}100%{opacity:1}}@-webkit-keyframes red-fade-in-out{from{opacity:0}15%{opacity:0}25%{opacity:1}50%{opacity:1}51%{opacity:0}}@keyframes red-fade-in-out{from{opacity:0}15%{opacity:0}25%{opacity:1}50%{opacity:1}51%{opacity:0}}@-webkit-keyframes yellow-fade-in-out{from{opacity:0}40%{opacity:0}50%{opacity:1}75%{opacity:1}76%{opacity:0}}@keyframes yellow-fade-in-out{from{opacity:0}40%{opacity:0}50%{opacity:1}75%{opacity:1}76%{opacity:0}}@-webkit-keyframes green-fade-in-out{from{opacity:0}65%{opacity:0}75%{opacity:1}90%{opacity:1}100%{opacity:0}}@keyframes green-fade-in-out{from{opacity:0}65%{opacity:0}75%{opacity:1}90%{opacity:1}100%{opacity:0}}.gap-patch{position:absolute;top:0;left:45%;width:10%;height:100%;overflow:hidden;border-color:inherit}.gap-patch .circle{width:1000%;left:-450%}.circle-clipper{display:inline-block;position:relative;width:50%;height:100%;overflow:hidden;border-color:inherit}.circle-clipper .circle{width:200%;height:100%;border-width:3px;border-style:solid;border-color:inherit;border-bottom-color:transparent !important;border-radius:50%;-webkit-animation:none;animation:none;position:absolute;top:0;right:0;bottom:0}.circle-clipper.left .circle{left:0;border-right-color:transparent !important;-webkit-transform:rotate(129deg);transform:rotate(129deg)}.circle-clipper.right .circle{left:-100%;border-left-color:transparent !important;-webkit-transform:rotate(-129deg);transform:rotate(-129deg)}.active .circle-clipper.left .circle{-webkit-animation:left-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;animation:left-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.active .circle-clipper.right .circle{-webkit-animation:right-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;animation:right-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}@-webkit-keyframes left-spin{from{-webkit-transform:rotate(130deg)}50%{-webkit-transform:rotate(-5deg)}to{-webkit-transform:rotate(130deg)}}@keyframes left-spin{from{transform:rotate(130deg)}50%{transform:rotate(-5deg)}to{transform:rotate(130deg)}}@-webkit-keyframes right-spin{from{-webkit-transform:rotate(-130deg)}50%{-webkit-transform:rotate(5deg)}to{-webkit-transform:rotate(-130deg)}}@keyframes right-spin{from{transform:rotate(-130deg)}50%{transform:rotate(5deg)}to{transform:rotate(-130deg)}}#spinnerContainer.cooldown{-webkit-animation:container-rotate 1568ms linear infinite,fade-out 400ms cubic-bezier(0.4, 0, 0.2, 1);animation:container-rotate 1568ms linear infinite,fade-out 400ms cubic-bezier(0.4, 0, 0.2, 1)}@-webkit-keyframes fade-out{from{opacity:1}to{opacity:0}}@keyframes fade-out{from{opacity:1}to{opacity:0}}.slider{position:relative;height:400px;width:100%}.slider.fullscreen{height:100%;width:100%;position:absolute;top:0;left:0;right:0;bottom:0}.slider.fullscreen ul.slides{height:100%}.slider.fullscreen ul.indicators{z-index:2;bottom:30px}.slider .slides{background-color:#9e9e9e;margin:0;height:400px}.slider .slides li{opacity:0;position:absolute;top:0;left:0;z-index:1;width:100%;height:inherit;overflow:hidden}.slider .slides li img{height:100%;width:100%;background-size:cover;background-position:center}.slider .slides li .caption{color:#fff;position:absolute;top:15%;left:15%;width:70%;opacity:0}.slider .slides li .caption p{color:#e0e0e0}.slider .slides li.active{z-index:2}.slider .indicators{position:absolute;text-align:center;left:0;right:0;bottom:0;margin:0}.slider .indicators .indicator-item{display:inline-block;position:relative;cursor:pointer;height:16px;width:16px;margin:0 12px;background-color:#e0e0e0;-webkit-transition:background-color .3s;-moz-transition:background-color .3s;-o-transition:background-color .3s;-ms-transition:background-color .3s;transition:background-color .3s;border-radius:50%}.slider .indicators .indicator-item.active{background-color:#4CAF50}.picker{font-size:16px;text-align:left;line-height:1.2;color:#000000;position:absolute;z-index:10000;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.picker__input{cursor:default}.picker__input.picker__input--active{border-color:#0089ec}.picker__holder{width:100%;overflow-y:auto;-webkit-overflow-scrolling:touch}/*! + * Default mobile-first, responsive styling for pickadate.js + * Demo: http://amsul.github.io/pickadate.js + */.picker__holder,.picker__frame{bottom:0;left:0;right:0;top:100%}.picker__holder{position:fixed;-webkit-transition:background 0.15s ease-out,top 0s 0.15s;-moz-transition:background 0.15s ease-out,top 0s 0.15s;transition:background 0.15s ease-out,top 0s 0.15s;-webkit-backface-visibility:hidden}.picker__frame{position:absolute;margin:0 auto;min-width:256px;width:300px;max-height:350px;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);-moz-opacity:0;opacity:0;-webkit-transition:all 0.15s ease-out;-moz-transition:all 0.15s ease-out;transition:all 0.15s ease-out}@media (min-height: 28.875em){.picker__frame{overflow:visible;top:auto;bottom:-100%;max-height:80%}}@media (min-height: 40.125em){.picker__frame{margin-bottom:7.5%}}.picker__wrap{display:table;width:100%;height:100%}@media (min-height: 28.875em){.picker__wrap{display:block}}.picker__box{background:#ffffff;display:table-cell;vertical-align:middle}@media (min-height: 28.875em){.picker__box{display:block;border:1px solid #777777;border-top-color:#898989;border-bottom-width:0;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0;-webkit-box-shadow:0 12px 36px 16px rgba(0,0,0,0.24);-moz-box-shadow:0 12px 36px 16px rgba(0,0,0,0.24);box-shadow:0 12px 36px 16px rgba(0,0,0,0.24)}}.picker--opened .picker__holder{top:0;background:transparent;-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#1E000000,endColorstr=#1E000000)";zoom:1;background:rgba(0,0,0,0.32);-webkit-transition:background 0.15s ease-out;-moz-transition:background 0.15s ease-out;transition:background 0.15s ease-out}.picker--opened .picker__frame{top:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);-moz-opacity:1;opacity:1}@media (min-height: 35.875em){.picker--opened .picker__frame{top:10%;bottom:20% auto}}.picker__input.picker__input--active{border-color:#E3F2FD}.picker__frame{margin:0 auto;max-width:325px}@media (min-height: 38.875em){.picker--opened .picker__frame{top:10%;bottom:auto}}.picker__box{padding:0 1em}.picker__header{text-align:center;position:relative;margin-top:.75em}.picker__month,.picker__year{display:inline-block;margin-left:.25em;margin-right:.25em}.picker__select--month,.picker__select--year{height:2em;padding:0;margin-left:.25em;margin-right:.25em}.picker__select--month.browser-default{display:inline;background-color:#FFFFFF;width:40%}.picker__select--year.browser-default{display:inline;background-color:#FFFFFF;width:25%}.picker__select--month:focus,.picker__select--year:focus{border-color:rgba(0,0,0,0.05)}.picker__nav--prev,.picker__nav--next{position:absolute;padding:.5em 1.25em;width:1em;height:1em;box-sizing:content-box;top:-0.25em}.picker__nav--prev{left:-1em;padding-right:1.25em}.picker__nav--next{right:-1em;padding-left:1.25em}.picker__nav--disabled,.picker__nav--disabled:hover,.picker__nav--disabled:before,.picker__nav--disabled:before:hover{cursor:default;background:none;border-right-color:#f5f5f5;border-left-color:#f5f5f5}.picker__table{text-align:center;border-collapse:collapse;border-spacing:0;table-layout:fixed;font-size:1rem;width:100%;margin-top:.75em;margin-bottom:.5em}.picker__table th,.picker__table td{text-align:center}.picker__table td{margin:0;padding:0}.picker__weekday{width:14.285714286%;font-size:.75em;padding-bottom:.25em;color:#999999;font-weight:500}@media (min-height: 33.875em){.picker__weekday{padding-bottom:.5em}}.picker__day--today{position:relative;color:#595959;letter-spacing:-.3;padding:.75rem 0;font-weight:400;border:1px solid transparent}.picker__day--disabled:before{border-top-color:#aaaaaa}.picker__day--infocus:hover{cursor:pointer;color:#000;font-weight:500}.picker__day--outfocus{display:none;padding:.75rem 0;color:#fff}.picker__day--outfocus:hover{cursor:pointer;color:#dddddd;font-weight:500}.picker__day--highlighted:hover,.picker--focused .picker__day--highlighted{cursor:pointer}.picker__day--selected,.picker__day--selected:hover,.picker--focused .picker__day--selected{border-radius:50%;-webkit-transform:scale(.75);-moz-transform:scale(.75);-ms-transform:scale(.75);-o-transform:scale(.75);transform:scale(.75);background:#0089ec;color:#ffffff}.picker__day--disabled,.picker__day--disabled:hover,.picker--focused .picker__day--disabled{background:#f5f5f5;border-color:#f5f5f5;color:#dddddd;cursor:default}.picker__day--highlighted.picker__day--disabled,.picker__day--highlighted.picker__day--disabled:hover{background:#bbbbbb}.picker__footer{text-align:center;display:flex;align-items:center;justify-content:space-between}.picker__button--today,.picker__button--clear,.picker__button--close{border:1px solid #ffffff;background:#ffffff;font-size:.8em;padding:.66em 0;font-weight:bold;width:33%;display:inline-block;vertical-align:bottom}.picker__button--today:hover,.picker__button--clear:hover,.picker__button--close:hover{cursor:pointer;color:#000000;background:#b1dcfb;border-bottom-color:#b1dcfb}.picker__button--today:focus,.picker__button--clear:focus,.picker__button--close:focus{background:#b1dcfb;border-color:rgba(0,0,0,0.05);outline:none}.picker__button--today:before,.picker__button--clear:before,.picker__button--close:before{position:relative;display:inline-block;height:0}.picker__button--today:before,.picker__button--clear:before{content:" ";margin-right:.45em}.picker__button--today:before{top:-0.05em;width:0;border-top:0.66em solid #0059bc;border-left:.66em solid transparent}.picker__button--clear:before{top:-0.25em;width:.66em;border-top:3px solid #ee2200}.picker__button--close:before{content:"\D7";top:-0.1em;vertical-align:top;font-size:1.1em;margin-right:.35em;color:#777777}.picker__button--today[disabled],.picker__button--today[disabled]:hover{background:#f5f5f5;border-color:#f5f5f5;color:#dddddd;cursor:default}.picker__button--today[disabled]:before{border-top-color:#aaaaaa}.picker__box{border-radius:2px;overflow:hidden}.picker__date-display{text-align:center;background-color:#26a69a;color:#fff;padding-bottom:15px;font-weight:300}.picker__nav--prev:hover,.picker__nav--next:hover{cursor:pointer;color:#000000;background:#a1ded8}.picker__weekday-display{background-color:#1f897f;padding:10px;font-weight:200;letter-spacing:.5;font-size:1rem;margin-bottom:15px}.picker__month-display{text-transform:uppercase;font-size:2rem}.picker__day-display{font-size:4.5rem;font-weight:400}.picker__year-display{font-size:1.8rem;color:rgba(255,255,255,0.4)}.picker__box{padding:0}.picker__calendar-container{padding:0 1rem}.picker__calendar-container thead{border:none}.picker__table{margin-top:0;margin-bottom:.5em}.picker__day--infocus{color:#595959;letter-spacing:-.3;padding:.75rem 0;font-weight:400;border:1px solid transparent}.picker__day.picker__day--today{color:#26a69a}.picker__day.picker__day--today.picker__day--selected{color:#fff}.picker__weekday{font-size:.9rem}.picker__day--selected,.picker__day--selected:hover,.picker--focused .picker__day--selected{border-radius:50%;-webkit-transform:scale(.9);-moz-transform:scale(.9);-ms-transform:scale(.9);-o-transform:scale(.9);transform:scale(.9);background-color:#26a69a;color:#ffffff}.picker__day--selected.picker__day--outfocus,.picker__day--selected:hover.picker__day--outfocus,.picker--focused .picker__day--selected.picker__day--outfocus{background-color:#a1ded8}.picker__footer{text-align:right;padding:5px 10px}.picker__close,.picker__today{font-size:1.1rem;padding:0 1rem;color:#26a69a}.picker__nav--prev:before,.picker__nav--next:before{content:" ";border-top:.5em solid transparent;border-bottom:.5em solid transparent;border-right:0.75em solid #676767;width:0;height:0;display:block;margin:0 auto}.picker__nav--next:before{border-right:0;border-left:0.75em solid #676767}button.picker__today:focus,button.picker__clear:focus,button.picker__close:focus{background-color:#a1ded8}.picker__list{list-style:none;padding:0.75em 0 4.2em;margin:0}.picker__list-item{border-bottom:1px solid #dddddd;border-top:1px solid #dddddd;margin-bottom:-1px;position:relative;background:#ffffff;padding:.75em 1.25em}@media (min-height: 46.75em){.picker__list-item{padding:.5em 1em}}.picker__list-item:hover{cursor:pointer;color:#000000;background:#b1dcfb;border-color:#0089ec;z-index:10}.picker__list-item--highlighted{border-color:#0089ec;z-index:10}.picker__list-item--highlighted:hover,.picker--focused .picker__list-item--highlighted{cursor:pointer;color:#000000;background:#b1dcfb}.picker__list-item--selected,.picker__list-item--selected:hover,.picker--focused .picker__list-item--selected{background:#0089ec;color:#ffffff;z-index:10}.picker__list-item--disabled,.picker__list-item--disabled:hover,.picker--focused .picker__list-item--disabled{background:#f5f5f5;border-color:#f5f5f5;color:#dddddd;cursor:default;border-color:#dddddd;z-index:auto}.picker--time .picker__button--clear{display:block;width:80%;margin:1em auto 0;padding:1em 1.25em;background:none;border:0;font-weight:500;font-size:.67em;text-align:center;text-transform:uppercase;color:#666}.picker--time .picker__button--clear:hover,.picker--time .picker__button--clear:focus{color:#000000;background:#b1dcfb;background:#ee2200;border-color:#ee2200;cursor:pointer;color:#ffffff;outline:none}.picker--time .picker__button--clear:before{top:-0.25em;color:#666;font-size:1.25em;font-weight:bold}.picker--time .picker__button--clear:hover:before,.picker--time .picker__button--clear:focus:before{color:#ffffff}.picker--time .picker__frame{min-width:256px;max-width:320px}.picker--time .picker__box{font-size:1em;background:#f2f2f2;padding:0}@media (min-height: 40.125em){.picker--time .picker__box{margin-bottom:5em}} \ No newline at end of file diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Bold.ttf b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Bold.ttf new file mode 100644 index 0000000..68822ca Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Bold.ttf differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Bold.woff b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Bold.woff new file mode 100644 index 0000000..1f75afd Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Bold.woff differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Bold.woff2 b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Bold.woff2 new file mode 100644 index 0000000..350d1c3 Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Bold.woff2 differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Light.ttf b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Light.ttf new file mode 100644 index 0000000..aa45340 Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Light.ttf differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Light.woff b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Light.woff new file mode 100644 index 0000000..3480c6c Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Light.woff differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Light.woff2 b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Light.woff2 new file mode 100644 index 0000000..9a4d98c Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Light.woff2 differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Medium.ttf b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Medium.ttf new file mode 100644 index 0000000..a3c1a1f Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Medium.ttf differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Medium.woff b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Medium.woff new file mode 100644 index 0000000..1186773 Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Medium.woff differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Medium.woff2 b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Medium.woff2 new file mode 100644 index 0000000..d10a592 Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Medium.woff2 differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Regular.ttf b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Regular.ttf new file mode 100644 index 0000000..0e58508 Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Regular.ttf differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Regular.woff b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Regular.woff new file mode 100644 index 0000000..f823258 Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Regular.woff differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Regular.woff2 b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Regular.woff2 new file mode 100644 index 0000000..b7082ef Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Regular.woff2 differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Thin.ttf b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Thin.ttf new file mode 100644 index 0000000..8779333 Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Thin.ttf differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Thin.woff b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Thin.woff new file mode 100644 index 0000000..2a98c1e Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Thin.woff differ diff --git a/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Thin.woff2 b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Thin.woff2 new file mode 100644 index 0000000..a38025a Binary files /dev/null and b/apps/mapvisuals/static/mapvisuals/css/lib/roboto/Roboto-Thin.woff2 differ diff --git a/apps/mapvisuals/static/mapvisuals/css/style.css b/apps/mapvisuals/static/mapvisuals/css/style.css new file mode 100644 index 0000000..438c223 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/css/style.css @@ -0,0 +1,4 @@ +.tasks-container{ + margin-bottom: 40px; + padding: 20px; +} \ No newline at end of file diff --git a/apps/mapvisuals/static/mapvisuals/index.html b/apps/mapvisuals/static/mapvisuals/index.html new file mode 100644 index 0000000..601f02a --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/index.html @@ -0,0 +1,74 @@ + + + + Project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/apps/mapvisuals/static/mapvisuals/js/controllers/mapController.js b/apps/mapvisuals/static/mapvisuals/js/controllers/mapController.js new file mode 100644 index 0000000..7e0994d --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/controllers/mapController.js @@ -0,0 +1,280 @@ +app.controller('MapController', ['$scope', 'leafletData', + + function($scope, leafletData) { + + // Start the map zoomed in on the center of the country + //and add custom event listenters for our leaflet directive + angular.extend($scope, { + center: { + lat: 39.8282, + lng: -98.5795, + zoom: 4, + }, + events: { + map: { + enable: ['zoomstart', 'zoomend'], + logic: 'emit' + } + } + }); + + /********************************************************* + MAP INITIALIZATIONS + *********************************************************/ + // Grabs our map objects as a promise and then adds a click handler and runs our + // d3Map function which generates our d3 overlay. + d3.json("/statedata", function(stateData) { + console.log(stateData); + d3.json("/mapdata", function(jobsData){ + leafletData.getMap().then(function(map) { + // var popup = L.popup(); + + function onMapClick(e) { + popup.setLatLng(e.latlng) + .setContent("You clicked the map at " + e.latlng.toString()) + .openOn(map); + } + + // map.on('click', onMapClick); + d3Map(map); + }); + + + /********************************************************* + MAP EVENT HANDLERS + *********************************************************/ + // This uses the custom event handlers that we registered at the top + //of the document to clear out the old svg and redraw it when the map + //is zoomed in or out. + + $scope.$on('leafletDirectiveMap.zoomstart', function(event){ + d3.selectAll('svg').remove(); + $scope.$on('leafletDirectiveMap.zoomend', function(event){ + leafletData.getMap().then(function(map){ + map.getPanes().overlayPane.innerHTML = ""; + d3.select(".tooltip").innerHTML = ""; + d3Map(map); + }); + }); + }); + + + /********************************************************* + D3 STUFFS + *********************************************************/ + // MAP DRAWING FUNCTION + function d3Map(map){ + + //-------------------D3 INITIALIZATION--------------------// + + // Main SVG which sits in the leaflet overlay pane + var svg = d3.select(map.getPanes().overlayPane).append("svg"); + + // This is the group which will contain all of our svg elements for our map overlay + var g = svg.append("g").attr("class", "leaflet-zoom-hide"); + var transform = d3.geo.transform({point: projectPoint}); + var path = d3.geo.path().projection(transform); + + // This is the functionality that allows our dots to be correctly projected onto the map + //The function in our point radius method will use what we pass in below in our radius key in our + //datum method to our projection to draw the dots. + var g2 = svg.append("g").attr("class", "leaflet-zoom-hide"); + var feature2 = g2.selectAll("path.point"); + var transform2 = d3.geo.transform({point: projectPoint}); + var path2 = d3.geo.path().projection(transform2).pointRadius(function(d){ + var zoom = map.getZoom(); + if(zoom < 5){ + return Math.min(((d.radius + zoom) * 0.08), 10); + }else if( zoom >= 5 && zoom < 7){ + return Math.min(((d.radius + zoom) * 0.09), 36); + } else if(zoom >= 7 && zoom < 10){ + return Math.max(((d.radius + zoom) * 0.038), 5); + } else{ + return Math.max(((d.radius + zoom) * 0.028), 5); + } + }); + + // This sets up our color and range to map the various color to different points based + //on job availability per point + var colors = ["#6363FF", "#6373FF", "#63A3FF", "#63E3FF", "#63FFFB", "#63FFCB", + "#63FF9B", "#63FF6B", "#7BFF63", "#BBFF63", "#DBFF63", "#FBFF63", + "#FFD363", "#FFB363", "#FF8363", "#FF7363", "#FF6364"]; + + var heatmapColor = d3.scale.linear() + .domain(d3.range(0, 1, 1.0 / (colors.length-1))) + .range(colors); + + var range = []; + for(var i=0; i 80) ? '300px' : null;}) + // .html(tooltipText); + }) + .on('mousemove', function(d, i) { + // Move tooltip + var absoluteMousePos = d3.mouse(bodyNode); + tooltipDiv.style('left', (absoluteMousePos[0] + 10)+'px') + .style('top', (absoluteMousePos[1] - 15)+'px'); + var tooltipText = accessor(d, i) || ''; + tooltipDiv.html(tooltipText); + }) + .on("mouseout", function(d, i){ + // Remove tooltip + tooltipDiv.remove(); + }); + + }; + }; + + //^^^^^^^^^^^^^^^^^^^^^^^END INITIALIZATION^^^^^^^^^^^^^^^^^^^^^^^^^// + + + //----------------APPEND NEW SVG ELEMENTS TO DOM-------------------// + // This runs through our geo-JSON file containing the data for the state overlays + var stateColors = d3.scale.linear() + .domain(d3.range(0, 1, 1.0 / (colorbrewer.Accent['7'].length-1))) + .range(colorbrewer.Accent['7']); + + var newRange = [100, 1200]; + + var colorRange = d3.scale.linear().domain(d3.extent(newRange)).range([0,1]); + colorRange.clamp(true); + var zoom = map.getZoom(); + + var feature = g.selectAll("path") + .data(stateData.features) + .enter() + .append("path") + .attr("class", "state") + .attr("fill-opacity", function(d){ + if( zoom < 5){ + return 0.8; + }else if( zoom <= 6){ + return 0.6; + } else if(zoom >=6 && zoom < 7){ + return 0.3; + } else if (zoom >= 7 && zoom < 8){ + return 0.2; + } else if (zoom >= 8 && zoom < 9){ + return 0.1; + } else { + return 0; + } + }) + // .style("fill", function(d) { + // if(d.properties.numJobs < 2900){ + // return stateColors(colorRange(d.properties.numJobs)); + // } else if(!d.properties.numJobs){ + // return "lightblue"; + // } else{ + // return "red"; + // } + // }) + .attr("fill", "#000") + .attr("stroke", function(d){ + if(zoom >= 9){ + return "#666"; + } else { + return "#fff"; + } + }) + .attr("stroke-width", function(d){ + if(zoom >= 9){ + return "2"; + } + }); + + // Where our job data is actually put into SVG form and appended to the DOM + feature2.data(jobsData.features) + .enter() + .append("path") + .call(d3.helper.tooltip(function(d, i){ + return ""+d.name + "
Jobs: "+d.radius; + })) + .style("fill", function(d) { + return heatmapColor(c(d.properties.numJobs)); + }) + .datum(function(d){ + return {type: "Point", coordinates: [d.geometry.coordinates[1], d.geometry.coordinates[0]], radius: d.properties.numJobs, name:d.properties.name}; + }) + .attr("class", "point") + .attr("d", path2); + + //^^^^^^^^^^^^^^^^^^^^^^^END DATA/APPEND^^^^^^^^^^^^^^^^^^^^^^^// + + + + //-------------------CLEAN UP-------------------// + //Reposition our SVG's on zoom in/out + map.on("viewreset", reset); + reset(); + + function reset() { + var bounds = path.bounds(stateData), + topLeft = bounds[0], + bottomRight = bounds[1]; + + svg.attr("width", bottomRight[0] - topLeft[0]) + .attr("height", bottomRight[1] - topLeft[1]) + .style("left", topLeft[0] + "px") + .style("top", topLeft[1] + "px"); + + g.attr("transform", "translate(" + -topLeft[0] + "," + -topLeft[1] + ")"); + g2.attr("transform", "translate(" + -topLeft[0] + "," + -topLeft[1] + ")"); + feature.attr("d", path); + feature2.attr("d", path2); + + } //End reset + } //End D3Map + }); // End D3.json for mapdata + }); // End D3.json for statedata + } // End main controller function +]); // End controller wrapper + + + + + + + + + + + + + + + + + + + diff --git a/apps/mapvisuals/static/mapvisuals/js/controllers/pieChartController.js b/apps/mapvisuals/static/mapvisuals/js/controllers/pieChartController.js new file mode 100644 index 0000000..2cfedae --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/controllers/pieChartController.js @@ -0,0 +1,217 @@ +app.controller('PieChartController', ['$scope', + + function($scope){ + console.log('here'); + d3.json('/jensrocks', function(data){ + freqData = data; + console.log(freqData); + dashboard('#dashboard',freqData); + }); + + + function dashboard(id, fData){ + var barColor = 'steelblue'; + function segColor(c){ return {Front:"#807dba", Back:"#e08214",Full:"#41ab5d"}[c]; } + + // compute total for each state. + fData.forEach(function(d){d.total=d.freq.Front+d.freq.Back+d.freq.Full;}); + + // function to handle histogram. + function histoGram(fD){ + var hG={}; + var hGDim = {t: 60, r: 0, b: 30, l: 0}; + hGDim.w = 960 - hGDim.l - hGDim.r; + hGDim.h = 300 - hGDim.t - hGDim.b; + + //create svg for histogram. + var hGsvg = d3.select(id).append("svg") + .attr("width", hGDim.w + hGDim.l + hGDim.r) + .attr("height", hGDim.h + hGDim.t + hGDim.b).append("g") + .attr("transform", "translate(" + hGDim.l + "," + hGDim.t + ")"); + + // create function for x-axis mapping. + var x = d3.scale.ordinal().rangeRoundBands([0, hGDim.w], 0.1) + .domain(fD.map(function(d) { return d[0]; })); + + // Add x-axis to the histogram svg. + hGsvg.append("g").attr("class", "x axis") + .attr("transform", "translate(0," + hGDim.h + ")") + .call(d3.svg.axis().scale(x).orient("bottom")); + + // Create function for y-axis map. + var y = d3.scale.linear().range([hGDim.h, 0]) + .domain([0, d3.max(fD, function(d) { return d[1]; })]); + + // Create bars for histogram to contain rectangles and freq labels. + var bars = hGsvg.selectAll(".bar").data(fD).enter() + .append("g").attr("class", "bar"); + + //create the rectangles. + bars.append("rect") + .attr("x", function(d) { return x(d[0]); }) + .attr("y", function(d) { return y(d[1]); }) + .attr("width", x.rangeBand()) + .attr("height", function(d) { return hGDim.h - y(d[1]); }) + .attr('fill',barColor) + .on("mouseover",mouseover)// mouseover is defined below. + .on("mouseout",mouseout);// mouseout is defined below. + + //Create the frequency labels above the rectangles. + bars.append("text").text(function(d){ return d3.format(",")(d[1])}) + .attr("x", function(d) { return x(d[0])+x.rangeBand()/2; }) + .attr("y", function(d) { return y(d[1])-5; }) + .attr("text-anchor", "middle"); + + function mouseover(d){ // utility function to be called on mouseover. + // filter for selected state. + var st = fData.filter(function(s){ return s.State == d[0];})[0], + nD = d3.keys(st.freq).map(function(s){ return {type:s, freq:st.freq[s]};}); + + // call update functions of pie-chart and legend. + pC.update(nD); + leg.update(nD); + } + + function mouseout(d){ // utility function to be called on mouseout. + // reset the pie-chart and legend. + pC.update(tF); + leg.update(tF); + } + + // create function to update the bars. This will be used by pie-chart. + hG.update = function(nD, color){ + // update the domain of the y-axis map to reflect change in frequencies. + y.domain([0, d3.max(nD, function(d) { return d[1]; })]); + + // Attach the new data to the bars. + var bars = hGsvg.selectAll(".bar").data(nD); + + // transition the height and color of rectangles. + bars.select("rect").transition().duration(500) + .attr("y", function(d) {return y(d[1]); }) + .attr("height", function(d) { return hGDim.h - y(d[1]); }) + .attr("fill", color); + + // transition the frequency labels location and change value. + bars.select("text").transition().duration(500) + .text(function(d){ return d3.format(",")(d[1]); }) + .attr("y", function(d) {return y(d[1])-5; }); + }; + return hG; + } + + // function to handle pieChart. + function pieChart(pD){ + var pC ={}; + var pieDim ={w:250, h: 250}; + pieDim.r = Math.min(pieDim.w, pieDim.h) / 2; + + // create svg for pie chart. + var piesvg = d3.select(id).append("svg") + .attr("width", pieDim.w).attr("height", pieDim.h).append("g") + .attr("transform", "translate("+pieDim.w/2+","+pieDim.h/2+")"); + + // create function to draw the arcs of the pie slices. + var arc = d3.svg.arc().outerRadius(pieDim.r - 10).innerRadius(0); + + // create a function to compute the pie slice angles. + var pie = d3.layout.pie().sort(null).value(function(d) { return d.freq; }); + + // Draw the pie slices. + piesvg.selectAll("path").data(pie(pD)).enter().append("path").attr("d", arc) + .each(function(d) { this._current = d; }) + .style("fill", function(d) { return segColor(d.data.type); }) + .on("mouseover",mouseover).on("mouseout",mouseout); + + // create function to update pie-chart. This will be used by histogram. + pC.update = function(nD){ + piesvg.selectAll("path").data(pie(nD)).transition().duration(500) + .attrTween("d", arcTween); + }; + // Utility function to be called on mouseover a pie slice. + function mouseover(d){ + // call the update function of histogram with new data. + hG.update(fData.map(function(v){ + return [v.State,v.freq[d.data.type]];}),segColor(d.data.type)); + } + //Utility function to be called on mouseout a pie slice. + function mouseout(d){ + // call the update function of histogram with all data. + hG.update(fData.map(function(v){ + return [v.State,v.total];}), barColor); + } + // Animating the pie-slice requiring a custom function which specifies + // how the intermediate paths should be drawn. + function arcTween(a) { + var i = d3.interpolate(this._current, a); + this._current = i(0); + return function(t) { return arc(i(t)); }; + } + return pC; + } + + // function to handle legend. + function legend(lD){ + var leg = {}; + + // create table for legend. + var legend = d3.select(id).append("table").attr('class','legend'); + + // create one row per segment. + var tr = legend.append("tbody").selectAll("tr").data(lD).enter().append("tr"); + + // create the first column for each segment. + tr.append("td").append("svg").attr("width", '16').attr("height", '16').append("rect") + .attr("width", '16').attr("height", '16') + .attr("fill",function(d){ return segColor(d.type); }); + + // create the second column for each segment. + tr.append("td").text(function(d){ + if (d.type == 'Full'){ + return d.type + ' Stack'; + } + else{ + return d.type + ' End'; + }}); + + // create the third column for each segment. + tr.append("td").attr("class",'legendFreq') + .text(function(d){ return d3.format(",")(d.freq);}); + + // create the fourth column for each segment. + tr.append("td").attr("class",'legendPerc') + .text(function(d){ return getLegend(d,lD);}); + + // Utility function to be used to update the legend. + leg.update = function(nD){ + // update the data attached to the row elements. + var l = legend.select("tbody").selectAll("tr").data(nD); + + // update the frequencies. + l.select(".legendFreq").text(function(d){ return d3.format(",")(d.freq);}); + + // update the percentage column. + l.select(".legendPerc").text(function(d){ return getLegend(d,nD);}); + }; + + function getLegend(d,aD){ // Utility function to compute percentage. + return d3.format("%")(d.freq/d3.sum(aD.map(function(v){ return v.freq; }))); + } + + return leg; + } + + // calculate total frequency by segment for all state. + var tF = ['Front','Back','Full'].map(function(d){ + return {type:d, freq: d3.sum(fData.map(function(t){ return t.freq[d];}))}; + }); + + // calculate total frequency by state for all segment. + var sF = fData.map(function(d){return [d.State,d.total];}); + + var hG = histoGram(sF), // create the histogram. + pC = pieChart(tF), // create the pie-chart. + leg= legend(tF); // create the legend. + } + } +]); \ No newline at end of file diff --git a/apps/mapvisuals/static/mapvisuals/js/directives/directives.js b/apps/mapvisuals/static/mapvisuals/js/directives/directives.js new file mode 100644 index 0000000..6101f52 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/directives/directives.js @@ -0,0 +1,69 @@ +app + +.directive('colors', function(){ + return { + restrict: "AE", + link: function(scope, element, attrs){ + element.css("background-color", "yellow") + + element.bind('mouseenter', function(){ + element.css("background-color", "red") + }) + element.bind('mouseleave', function(){ + element.css("background-color", "green") + }) + } + } +}) + + +.directive('sampleLink', function() { + return { + restrict: "E", + template: "
...loaded template (div) through sample-link directive!...
", // OR + // templateUrl: path/to/file/template.html + link: function(scope, element, attrs){ + console.log(" link executing") + + element.addClass("sampleLinkLinked") + + element.bind("mouseenter", function(){ + + // Do things after mouseenter... + console.log(" mouseenter triggered.") + + // Add a class... + element.addClass("mouseenterEntered") + // addClass() + // after() + // append() + // detach() + // empty() + // eq() + // hasClass() + // html() + // prepend() + // prop() + // text() + // toggleClass() + // val() + + }); + + } + }; +}) + + + + + + + + + + + + + + diff --git a/apps/mapvisuals/static/mapvisuals/js/factories/factories.js b/apps/mapvisuals/static/mapvisuals/js/factories/factories.js new file mode 100644 index 0000000..4c99f7e --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/factories/factories.js @@ -0,0 +1,19 @@ +"use strict"; +app + +.factory('taskFactory', function(){ + var tasks = [ + {task: 'Eat Lunch', priority: 'HIGH', deadline: new Date(), createdAt: new Date()}, + {task: 'Eat Pray', priority: 'HIGH', deadline: new Date(), createdAt: new Date()}, + {task: 'Eat Pray Love', priority: 'HIGH', deadline: new Date(), createdAt: new Date()}, + {task: 'Eat Pray Lunch', priority: 'HIGH', deadline: new Date(), createdAt: new Date()}, + ]; + + var factory = {}; + + factory.getTasks = function(callback){ + callback(tasks); + }; + + return factory; +}); diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-animate.js b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-animate.js new file mode 100755 index 0000000..27d5295 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-animate.js @@ -0,0 +1,1226 @@ +/** + * @license AngularJS v1.2.0 + * (c) 2010-2012 Google, Inc. http://angularjs.org + * License: MIT + */ +(function(window, angular, undefined) {'use strict'; + +/* jshint maxlen: false */ + +/** + * @ngdoc overview + * @name ngAnimate + * @description + * + * # ngAnimate + * + * The `ngAnimate` module provides support for JavaScript, CSS3 transition and CSS3 keyframe animation hooks within existing core and custom directives. + * + * {@installModule animate} + * + *
+ * + * # Usage + * + * To see animations in action, all that is required is to define the appropriate CSS classes + * or to register a JavaScript animation via the myModule.animation() function. The directives that support animation automatically are: + * `ngRepeat`, `ngInclude`, `ngIf`, `ngSwitch`, `ngShow`, `ngHide`, `ngView` and `ngClass`. Custom directives can take advantage of animation + * by using the `$animate` service. + * + * Below is a more detailed breakdown of the supported animation events provided by pre-existing ng directives: + * + * | Directive | Supported Animations | + * |---------------------------------------------------------- |----------------------------------------------------| + * | {@link ng.directive:ngRepeat#usage_animations ngRepeat} | enter, leave and move | + * | {@link ngRoute.directive:ngView#usage_animations ngView} | enter and leave | + * | {@link ng.directive:ngInclude#usage_animations ngInclude} | enter and leave | + * | {@link ng.directive:ngSwitch#usage_animations ngSwitch} | enter and leave | + * | {@link ng.directive:ngIf#usage_animations ngIf} | enter and leave | + * | {@link ng.directive:ngClass#usage_animations ngClass} | add and remove | + * | {@link ng.directive:ngShow#usage_animations ngShow & ngHide} | add and remove (the ng-hide class value) | + * + * You can find out more information about animations upon visiting each directive page. + * + * Below is an example of how to apply animations to a directive that supports animation hooks: + * + *
+ * 
+ *
+ * 
+ * 
+ * 
+ * + * Keep in mind that if an animation is running, any child elements cannot be animated until the parent element's + * animation has completed. + * + *

CSS-defined Animations

+ * The animate service will automatically apply two CSS classes to the animated element and these two CSS classes + * are designed to contain the start and end CSS styling. Both CSS transitions and keyframe animations are supported + * and can be used to play along with this naming structure. + * + * The following code below demonstrates how to perform animations using **CSS transitions** with Angular: + * + *
+ * 
+ *
+ * 
+ *
+ *
+ *
+ * + * The following code below demonstrates how to perform animations using **CSS animations** with Angular: + * + *
+ * 
+ *
+ * 
+ *
+ *
+ *
+ * + * Both CSS3 animations and transitions can be used together and the animate service will figure out the correct duration and delay timing. + * + * Upon DOM mutation, the event class is added first (something like `ng-enter`), then the browser prepares itself to add + * the active class (in this case `ng-enter-active`) which then triggers the animation. The animation module will automatically + * detect the CSS code to determine when the animation ends. Once the animation is over then both CSS classes will be + * removed from the DOM. If a browser does not support CSS transitions or CSS animations then the animation will start and end + * immediately resulting in a DOM element that is at its final state. This final state is when the DOM element + * has no CSS transition/animation classes applied to it. + * + *

CSS Staggering Animations

+ * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a + * curtain-like effect. The ngAnimate module, as of 1.2.0, supports staggering animations and the stagger effect can be + * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for + * the animation. The style property expected within the stagger class can either be a **transition-delay** or an + * **animation-delay** property (or both if your animation contains both transitions and keyframe animations). + * + *
+ * .my-animation.ng-enter {
+ *   /* standard transition code */
+ *   -webkit-transition: 1s linear all;
+ *   transition: 1s linear all;
+ *   opacity:0;
+ * }
+ * .my-animation.ng-enter-stagger {
+ *   /* this will have a 100ms delay between each successive leave animation */
+ *   -webkit-transition-delay: 0.1s;
+ *   transition-delay: 0.1s;
+ *
+ *   /* in case the stagger doesn't work then these two values
+ *    must be set to 0 to avoid an accidental CSS inheritance */
+ *   -webkit-transition-duration: 0s;
+ *   transition-duration: 0s;
+ * }
+ * .my-animation.ng-enter.ng-enter-active {
+ *   /* standard transition styles */
+ *   opacity:1;
+ * }
+ * 
+ * + * Staggering animations work by default in ngRepeat (so long as the CSS class is defiend). Outside of ngRepeat, to use staggering animations + * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this + * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation + * will also be reset if more than 10ms has passed after the last animation has been fired. + * + * The following code will issue the **ng-leave-stagger** event on the element provided: + * + *
+ * var kids = parent.children();
+ *
+ * $animate.leave(kids[0]); //stagger index=0
+ * $animate.leave(kids[1]); //stagger index=1
+ * $animate.leave(kids[2]); //stagger index=2
+ * $animate.leave(kids[3]); //stagger index=3
+ * $animate.leave(kids[4]); //stagger index=4
+ *
+ * $timeout(function() {
+ *   //stagger has reset itself
+ *   $animate.leave(kids[5]); //stagger index=0
+ *   $animate.leave(kids[6]); //stagger index=1
+ * }, 100, false);
+ * 
+ * + * Stagger animations are currently only supported within CSS-defined animations. + * + *

JavaScript-defined Animations

+ * In the event that you do not want to use CSS3 transitions or CSS3 animations or if you wish to offer animations on browsers that do not + * yet support CSS transitions/animations, then you can make use of JavaScript animations defined inside of your AngularJS module. + * + *
+ * //!annotate="YourApp" Your AngularJS Module|Replace this or ngModule with the module that you used to define your application.
+ * var ngModule = angular.module('YourApp', []);
+ * ngModule.animation('.my-crazy-animation', function() {
+ *   return {
+ *     enter: function(element, done) {
+ *       //run the animation here and call done when the animation is complete
+ *       return function(cancelled) {
+ *         //this (optional) function will be called when the animation
+ *         //completes or when the animation is cancelled (the cancelled
+ *         //flag will be set to true if cancelled).
+ *       }
+ *     }
+ *     leave: function(element, done) { },
+ *     move: function(element, done) { },
+ *
+ *     //animation that can be triggered before the class is added
+ *     beforeAddClass: function(element, className, done) { },
+ *
+ *     //animation that can be triggered after the class is added
+ *     addClass: function(element, className, done) { },
+ *
+ *     //animation that can be triggered before the class is removed
+ *     beforeRemoveClass: function(element, className, done) { },
+ *
+ *     //animation that can be triggered after the class is removed
+ *     removeClass: function(element, className, done) { }
+ *   }
+ * });
+ * 
+ * + * JavaScript-defined animations are created with a CSS-like class selector and a collection of events which are set to run + * a javascript callback function. When an animation is triggered, $animate will look for a matching animation which fits + * the element's CSS class attribute value and then run the matching animation event function (if found). + * In other words, if the CSS classes present on the animated element match any of the JavaScript animations then the callback function + * be executed. It should be also noted that only simple, single class selectors are allowed (compound class selectors are not supported). + * + * Within a JavaScript animation, an object containing various event callback animation functions is expected to be returned. + * As explained above, these callbacks are triggered based on the animation event. Therefore if an enter animation is run, + * and the JavaScript animation is found, then the enter callback will handle that animation (in addition to the CSS keyframe animation + * or transition code that is defined via a stylesheet). + * + */ + +angular.module('ngAnimate', ['ng']) + + /** + * @ngdoc object + * @name ngAnimate.$animateProvider + * @description + * + * The `$animateProvider` allows developers to register JavaScript animation event handlers directly inside of a module. + * When an animation is triggered, the $animate service will query the $animate service to find any animations that match + * the provided name value. + * + * Requires the {@link ngAnimate `ngAnimate`} module to be installed. + * + * Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application. + * + */ + .config(['$provide', '$animateProvider', function($provide, $animateProvider) { + var noop = angular.noop; + var forEach = angular.forEach; + var selectors = $animateProvider.$$selectors; + + var ELEMENT_NODE = 1; + var NG_ANIMATE_STATE = '$$ngAnimateState'; + var NG_ANIMATE_CLASS_NAME = 'ng-animate'; + var rootAnimateState = {running: true}; + + $provide.decorator('$animate', ['$delegate', '$injector', '$sniffer', '$rootElement', '$timeout', '$rootScope', '$document', + function($delegate, $injector, $sniffer, $rootElement, $timeout, $rootScope, $document) { + + $rootElement.data(NG_ANIMATE_STATE, rootAnimateState); + + // disable animations during bootstrap, but once we bootstrapped, enable animations + $rootScope.$$postDigest(function() { + rootAnimateState.running = false; + }); + + function lookup(name) { + if (name) { + var matches = [], + flagMap = {}, + classes = name.substr(1).split('.'); + + //the empty string value is the default animation + //operation which performs CSS transition and keyframe + //animations sniffing. This is always included for each + //element animation procedure if the browser supports + //transitions and/or keyframe animations + if ($sniffer.transitions || $sniffer.animations) { + classes.push(''); + } + + for(var i=0; i < classes.length; i++) { + var klass = classes[i], + selectorFactoryName = selectors[klass]; + if(selectorFactoryName && !flagMap[klass]) { + matches.push($injector.get(selectorFactoryName)); + flagMap[klass] = true; + } + } + return matches; + } + } + + /** + * @ngdoc object + * @name ngAnimate.$animate + * @function + * + * @description + * The `$animate` service provides animation detection support while performing DOM operations (enter, leave and move) as well as during addClass and removeClass operations. + * When any of these operations are run, the $animate service + * will examine any JavaScript-defined animations (which are defined by using the $animateProvider provider object) + * as well as any CSS-defined animations against the CSS classes present on the element once the DOM operation is run. + * + * The `$animate` service is used behind the scenes with pre-existing directives and animation with these directives + * will work out of the box without any extra configuration. + * + * Requires the {@link ngAnimate `ngAnimate`} module to be installed. + * + * Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application. + * + */ + return { + /** + * @ngdoc function + * @name ngAnimate.$animate#enter + * @methodOf ngAnimate.$animate + * @function + * + * @description + * Appends the element to the parentElement element that resides in the document and then runs the enter animation. Once + * the animation is started, the following CSS classes will be present on the element for the duration of the animation: + * + * Below is a breakdown of each step that occurs during enter animation: + * + * | Animation Step | What the element class attribute looks like | + * |----------------------------------------------------------------------------------------------|---------------------------------------------| + * | 1. $animate.enter(...) is called | class="my-animation" | + * | 2. element is inserted into the parentElement element or beside the afterElement element | class="my-animation" | + * | 3. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" | + * | 4. the .ng-enter class is added to the element | class="my-animation ng-animate ng-enter" | + * | 5. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate ng-enter" | + * | 6. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate ng-enter" | + * | 7. the .ng-enter-active and .ng-animate-active classes are added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active ng-enter ng-enter-active" | + * | 8. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active ng-enter ng-enter-active" | + * | 9. The animation ends and all generated CSS classes are removed from the element | class="my-animation" | + * | 10. The doneCallback() callback is fired (if provided) | class="my-animation" | + * + * @param {jQuery/jqLite element} element the element that will be the focus of the enter animation + * @param {jQuery/jqLite element} parentElement the parent element of the element that will be the focus of the enter animation + * @param {jQuery/jqLite element} afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation + * @param {function()=} doneCallback the callback function that will be called once the animation is complete + */ + enter : function(element, parentElement, afterElement, doneCallback) { + this.enabled(false, element); + $delegate.enter(element, parentElement, afterElement); + $rootScope.$$postDigest(function() { + performAnimation('enter', 'ng-enter', element, parentElement, afterElement, noop, doneCallback); + }); + }, + + /** + * @ngdoc function + * @name ngAnimate.$animate#leave + * @methodOf ngAnimate.$animate + * @function + * + * @description + * Runs the leave animation operation and, upon completion, removes the element from the DOM. Once + * the animation is started, the following CSS classes will be added for the duration of the animation: + * + * Below is a breakdown of each step that occurs during enter animation: + * + * | Animation Step | What the element class attribute looks like | + * |----------------------------------------------------------------------------------------------|---------------------------------------------| + * | 1. $animate.leave(...) is called | class="my-animation" | + * | 2. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" | + * | 3. the .ng-leave class is added to the element | class="my-animation ng-animate ng-leave" | + * | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate ng-leave" | + * | 5. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate ng-leave" | + * | 6. the .ng-leave-active and .ng-animate-active classes is added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active ng-leave ng-leave-active" | + * | 7. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active ng-leave ng-leave-active" | + * | 8. The animation ends and all generated CSS classes are removed from the element | class="my-animation" | + * | 9. The element is removed from the DOM | ... | + * | 10. The doneCallback() callback is fired (if provided) | ... | + * + * @param {jQuery/jqLite element} element the element that will be the focus of the leave animation + * @param {function()=} doneCallback the callback function that will be called once the animation is complete + */ + leave : function(element, doneCallback) { + cancelChildAnimations(element); + this.enabled(false, element); + $rootScope.$$postDigest(function() { + performAnimation('leave', 'ng-leave', element, null, null, function() { + $delegate.leave(element); + }, doneCallback); + }); + }, + + /** + * @ngdoc function + * @name ngAnimate.$animate#move + * @methodOf ngAnimate.$animate + * @function + * + * @description + * Fires the move DOM operation. Just before the animation starts, the animate service will either append it into the parentElement container or + * add the element directly after the afterElement element if present. Then the move animation will be run. Once + * the animation is started, the following CSS classes will be added for the duration of the animation: + * + * Below is a breakdown of each step that occurs during move animation: + * + * | Animation Step | What the element class attribute looks like | + * |----------------------------------------------------------------------------------------------|---------------------------------------------| + * | 1. $animate.move(...) is called | class="my-animation" | + * | 2. element is moved into the parentElement element or beside the afterElement element | class="my-animation" | + * | 3. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" | + * | 4. the .ng-move class is added to the element | class="my-animation ng-animate ng-move" | + * | 5. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate ng-move" | + * | 6. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate ng-move" | + * | 7. the .ng-move-active and .ng-animate-active classes is added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active ng-move ng-move-active" | + * | 8. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active ng-move ng-move-active" | + * | 9. The animation ends and all generated CSS classes are removed from the element | class="my-animation" | + * | 10. The doneCallback() callback is fired (if provided) | class="my-animation" | + * + * @param {jQuery/jqLite element} element the element that will be the focus of the move animation + * @param {jQuery/jqLite element} parentElement the parentElement element of the element that will be the focus of the move animation + * @param {jQuery/jqLite element} afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation + * @param {function()=} doneCallback the callback function that will be called once the animation is complete + */ + move : function(element, parentElement, afterElement, doneCallback) { + cancelChildAnimations(element); + this.enabled(false, element); + $delegate.move(element, parentElement, afterElement); + $rootScope.$$postDigest(function() { + performAnimation('move', 'ng-move', element, parentElement, afterElement, noop, doneCallback); + }); + }, + + /** + * @ngdoc function + * @name ngAnimate.$animate#addClass + * @methodOf ngAnimate.$animate + * + * @description + * Triggers a custom animation event based off the className variable and then attaches the className value to the element as a CSS class. + * Unlike the other animation methods, the animate service will suffix the className value with {@type -add} in order to provide + * the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if no CSS transitions + * or keyframes are defined on the -add or base CSS class). + * + * Below is a breakdown of each step that occurs during addClass animation: + * + * | Animation Step | What the element class attribute looks like | + * |------------------------------------------------------------------------------------------------|---------------------------------------------| + * | 1. $animate.addClass(element, 'super') is called | class="my-animation" | + * | 2. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" | + * | 3. the .super-add class are added to the element | class="my-animation ng-animate super-add" | + * | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate super-add" | + * | 5. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate super-add" | + * | 6. the .super, .super-add-active and .ng-animate-active classes are added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active super super-add super-add-active" | + * | 7. $animate waits for X milliseconds for the animation to complete | class="my-animation super-add super-add-active" | + * | 8. The animation ends and all generated CSS classes are removed from the element | class="my-animation super" | + * | 9. The super class is kept on the element | class="my-animation super" | + * | 10. The doneCallback() callback is fired (if provided) | class="my-animation super" | + * + * @param {jQuery/jqLite element} element the element that will be animated + * @param {string} className the CSS class that will be added to the element and then animated + * @param {function()=} doneCallback the callback function that will be called once the animation is complete + */ + addClass : function(element, className, doneCallback) { + performAnimation('addClass', className, element, null, null, function() { + $delegate.addClass(element, className); + }, doneCallback); + }, + + /** + * @ngdoc function + * @name ngAnimate.$animate#removeClass + * @methodOf ngAnimate.$animate + * + * @description + * Triggers a custom animation event based off the className variable and then removes the CSS class provided by the className value + * from the element. Unlike the other animation methods, the animate service will suffix the className value with {@type -remove} in + * order to provide the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if + * no CSS transitions or keyframes are defined on the -remove or base CSS classes). + * + * Below is a breakdown of each step that occurs during removeClass animation: + * + * | Animation Step | What the element class attribute looks like | + * |-----------------------------------------------------------------------------------------------|---------------------------------------------| + * | 1. $animate.removeClass(element, 'super') is called | class="my-animation super" | + * | 2. $animate runs any JavaScript-defined animations on the element | class="my-animation super ng-animate" | + * | 3. the .super-remove class are added to the element | class="my-animation super ng-animate super-remove"| + * | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation super ng-animate super-remove" | + * | 5. $animate waits for 10ms (this performs a reflow) | class="my-animation super ng-animate super-remove" | + * | 6. the .super-remove-active and .ng-animate-active classes are added and .super is removed (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active super-remove super-remove-active" | + * | 7. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active super-remove super-remove-active" | + * | 8. The animation ends and all generated CSS classes are removed from the element | class="my-animation" | + * | 9. The doneCallback() callback is fired (if provided) | class="my-animation" | + * + * + * @param {jQuery/jqLite element} element the element that will be animated + * @param {string} className the CSS class that will be animated and then removed from the element + * @param {function()=} doneCallback the callback function that will be called once the animation is complete + */ + removeClass : function(element, className, doneCallback) { + performAnimation('removeClass', className, element, null, null, function() { + $delegate.removeClass(element, className); + }, doneCallback); + }, + + /** + * @ngdoc function + * @name ngAnimate.$animate#enabled + * @methodOf ngAnimate.$animate + * @function + * + * @param {boolean=} value If provided then set the animation on or off. + * @return {boolean} Current animation state. + * + * @description + * Globally enables/disables animations. + * + */ + enabled : function(value, element) { + switch(arguments.length) { + case 2: + if(value) { + cleanup(element); + } else { + var data = element.data(NG_ANIMATE_STATE) || {}; + data.disabled = true; + element.data(NG_ANIMATE_STATE, data); + } + break; + + case 1: + rootAnimateState.disabled = !value; + break; + + default: + value = !rootAnimateState.disabled; + break; + } + return !!value; + } + }; + + /* + all animations call this shared animation triggering function internally. + The animationEvent variable refers to the JavaScript animation event that will be triggered + and the className value is the name of the animation that will be applied within the + CSS code. Element, parentElement and afterElement are provided DOM elements for the animation + and the onComplete callback will be fired once the animation is fully complete. + */ + function performAnimation(animationEvent, className, element, parentElement, afterElement, domOperation, doneCallback) { + var classes = (element.attr('class') || '') + ' ' + className; + var animationLookup = (' ' + classes).replace(/\s+/g,'.'); + if (!parentElement) { + parentElement = afterElement ? afterElement.parent() : element.parent(); + } + + var matches = lookup(animationLookup); + var isClassBased = animationEvent == 'addClass' || animationEvent == 'removeClass'; + var ngAnimateState = element.data(NG_ANIMATE_STATE) || {}; + + //skip the animation if animations are disabled, a parent is already being animated, + //the element is not currently attached to the document body or then completely close + //the animation if any matching animations are not found at all. + //NOTE: IE8 + IE9 should close properly (run closeAnimation()) in case a NO animation is not found. + if (animationsDisabled(element, parentElement) || matches.length === 0) { + domOperation(); + closeAnimation(); + return; + } + + var animations = []; + //only add animations if the currently running animation is not structural + //or if there is no animation running at all + if(!ngAnimateState.running || !(isClassBased && ngAnimateState.structural)) { + forEach(matches, function(animation) { + //add the animation to the queue to if it is allowed to be cancelled + if(!animation.allowCancel || animation.allowCancel(element, animationEvent, className)) { + var beforeFn, afterFn = animation[animationEvent]; + + //Special case for a leave animation since there is no point in performing an + //animation on a element node that has already been removed from the DOM + if(animationEvent == 'leave') { + beforeFn = afterFn; + afterFn = null; //this must be falsy so that the animation is skipped for leave + } else { + beforeFn = animation['before' + animationEvent.charAt(0).toUpperCase() + animationEvent.substr(1)]; + } + animations.push({ + before : beforeFn, + after : afterFn + }); + } + }); + } + + //this would mean that an animation was not allowed so let the existing + //animation do it's thing and close this one early + if(animations.length === 0) { + domOperation(); + fireDoneCallbackAsync(); + return; + } + + if(ngAnimateState.running) { + //if an animation is currently running on the element then lets take the steps + //to cancel that animation and fire any required callbacks + $timeout.cancel(ngAnimateState.closeAnimationTimeout); + cleanup(element); + cancelAnimations(ngAnimateState.animations); + (ngAnimateState.done || noop)(true); + } + + //There is no point in perform a class-based animation if the element already contains + //(on addClass) or doesn't contain (on removeClass) the className being animated. + //The reason why this is being called after the previous animations are cancelled + //is so that the CSS classes present on the element can be properly examined. + if((animationEvent == 'addClass' && element.hasClass(className)) || + (animationEvent == 'removeClass' && !element.hasClass(className))) { + domOperation(); + fireDoneCallbackAsync(); + return; + } + + //the ng-animate class does nothing, but it's here to allow for + //parent animations to find and cancel child animations when needed + element.addClass(NG_ANIMATE_CLASS_NAME); + + element.data(NG_ANIMATE_STATE, { + running:true, + structural:!isClassBased, + animations:animations, + done:onBeforeAnimationsComplete + }); + + //first we run the before animations and when all of those are complete + //then we perform the DOM operation and run the next set of animations + invokeRegisteredAnimationFns(animations, 'before', onBeforeAnimationsComplete); + + function onBeforeAnimationsComplete(cancelled) { + domOperation(); + if(cancelled === true) { + closeAnimation(); + return; + } + + //set the done function to the final done function + //so that the DOM event won't be executed twice by accident + //if the after animation is cancelled as well + var data = element.data(NG_ANIMATE_STATE); + if(data) { + data.done = closeAnimation; + element.data(NG_ANIMATE_STATE, data); + } + invokeRegisteredAnimationFns(animations, 'after', closeAnimation); + } + + function invokeRegisteredAnimationFns(animations, phase, allAnimationFnsComplete) { + var endFnName = phase + 'End'; + forEach(animations, function(animation, index) { + var animationPhaseCompleted = function() { + progress(index, phase); + }; + + //there are no before functions for enter + move since the DOM + //operations happen before the performAnimation method fires + if(phase == 'before' && (animationEvent == 'enter' || animationEvent == 'move')) { + animationPhaseCompleted(); + return; + } + + if(animation[phase]) { + animation[endFnName] = isClassBased ? + animation[phase](element, className, animationPhaseCompleted) : + animation[phase](element, animationPhaseCompleted); + } else { + animationPhaseCompleted(); + } + }); + + function progress(index, phase) { + var phaseCompletionFlag = phase + 'Complete'; + var currentAnimation = animations[index]; + currentAnimation[phaseCompletionFlag] = true; + (currentAnimation[endFnName] || noop)(); + + for(var i=0;i 0 ? '; ' : '') + style; + node.setAttribute('style', newStyle); + return oldStyle; + } + + function getElementAnimationDetails(element, cacheKey) { + var data = cacheKey ? lookupCache[cacheKey] : null; + if(!data) { + var transitionDuration = 0; + var transitionDelay = 0; + var animationDuration = 0; + var animationDelay = 0; + var transitionDelayStyle; + var animationDelayStyle; + var transitionDurationStyle; + var transitionPropertyStyle; + + //we want all the styles defined before and after + forEach(element, function(element) { + if (element.nodeType == ELEMENT_NODE) { + var elementStyles = $window.getComputedStyle(element) || {}; + + transitionDurationStyle = elementStyles[TRANSITION_PROP + DURATION_KEY]; + + transitionDuration = Math.max(parseMaxTime(transitionDurationStyle), transitionDuration); + + transitionPropertyStyle = elementStyles[TRANSITION_PROP + PROPERTY_KEY]; + + transitionDelayStyle = elementStyles[TRANSITION_PROP + DELAY_KEY]; + + transitionDelay = Math.max(parseMaxTime(transitionDelayStyle), transitionDelay); + + animationDelayStyle = elementStyles[ANIMATION_PROP + DELAY_KEY]; + + animationDelay = Math.max(parseMaxTime(animationDelayStyle), animationDelay); + + var aDuration = parseMaxTime(elementStyles[ANIMATION_PROP + DURATION_KEY]); + + if(aDuration > 0) { + aDuration *= parseInt(elementStyles[ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY], 10) || 1; + } + + animationDuration = Math.max(aDuration, animationDuration); + } + }); + data = { + total : 0, + transitionPropertyStyle: transitionPropertyStyle, + transitionDurationStyle: transitionDurationStyle, + transitionDelayStyle: transitionDelayStyle, + transitionDelay: transitionDelay, + transitionDuration: transitionDuration, + animationDelayStyle: animationDelayStyle, + animationDelay: animationDelay, + animationDuration: animationDuration + }; + if(cacheKey) { + lookupCache[cacheKey] = data; + } + } + return data; + } + + function parseMaxTime(str) { + var maxValue = 0; + var values = angular.isString(str) ? + str.split(/\s*,\s*/) : + []; + forEach(values, function(value) { + maxValue = Math.max(parseFloat(value) || 0, maxValue); + }); + return maxValue; + } + + function getCacheKey(element) { + var parentElement = element.parent(); + var parentID = parentElement.data(NG_ANIMATE_PARENT_KEY); + if(!parentID) { + parentElement.data(NG_ANIMATE_PARENT_KEY, ++parentCounter); + parentID = parentCounter; + } + return parentID + '-' + element[0].className; + } + + function animateSetup(element, className) { + var cacheKey = getCacheKey(element); + var eventCacheKey = cacheKey + ' ' + className; + var stagger = {}; + var ii = lookupCache[eventCacheKey] ? ++lookupCache[eventCacheKey].total : 0; + + if(ii > 0) { + var staggerClassName = className + '-stagger'; + var staggerCacheKey = cacheKey + ' ' + staggerClassName; + var applyClasses = !lookupCache[staggerCacheKey]; + + applyClasses && element.addClass(staggerClassName); + + stagger = getElementAnimationDetails(element, staggerCacheKey); + + applyClasses && element.removeClass(staggerClassName); + } + + element.addClass(className); + + var timings = getElementAnimationDetails(element, eventCacheKey); + + /* there is no point in performing a reflow if the animation + timeout is empty (this would cause a flicker bug normally + in the page. There is also no point in performing an animation + that only has a delay and no duration */ + var maxDuration = Math.max(timings.transitionDuration, timings.animationDuration); + if(maxDuration === 0) { + element.removeClass(className); + return false; + } + + var node = element[0]; + //temporarily disable the transition so that the enter styles + //don't animate twice (this is here to avoid a bug in Chrome/FF). + var activeClassName = ''; + if(timings.transitionDuration > 0) { + element.addClass(NG_ANIMATE_FALLBACK_CLASS_NAME); + activeClassName += NG_ANIMATE_FALLBACK_ACTIVE_CLASS_NAME + ' '; + node.style[TRANSITION_PROP + PROPERTY_KEY] = 'none'; + } + + forEach(className.split(' '), function(klass, i) { + activeClassName += (i > 0 ? ' ' : '') + klass + '-active'; + }); + + element.data(NG_ANIMATE_CSS_DATA_KEY, { + className : className, + activeClassName : activeClassName, + maxDuration : maxDuration, + classes : className + ' ' + activeClassName, + timings : timings, + stagger : stagger, + ii : ii + }); + + return true; + } + + function animateRun(element, className, activeAnimationComplete) { + var data = element.data(NG_ANIMATE_CSS_DATA_KEY); + if(!element.hasClass(className) || !data) { + activeAnimationComplete(); + return; + } + + var node = element[0]; + var timings = data.timings; + var stagger = data.stagger; + var maxDuration = data.maxDuration; + var activeClassName = data.activeClassName; + var maxDelayTime = Math.max(timings.transitionDelay, timings.animationDelay) * 1000; + var startTime = Date.now(); + var css3AnimationEvents = ANIMATIONEND_EVENT + ' ' + TRANSITIONEND_EVENT; + var formerStyle; + var ii = data.ii; + + var applyFallbackStyle, style = ''; + if(timings.transitionDuration > 0) { + node.style[TRANSITION_PROP + PROPERTY_KEY] = ''; + + var propertyStyle = timings.transitionPropertyStyle; + if(propertyStyle.indexOf('all') == -1) { + applyFallbackStyle = true; + var fallbackProperty = $sniffer.msie ? '-ms-zoom' : 'clip'; + style += CSS_PREFIX + 'transition-property: ' + propertyStyle + ', ' + fallbackProperty + '; '; + style += CSS_PREFIX + 'transition-duration: ' + timings.transitionDurationStyle + ', ' + timings.transitionDuration + 's; '; + } + } + + if(ii > 0) { + if(stagger.transitionDelay > 0 && stagger.transitionDuration === 0) { + var delayStyle = timings.transitionDelayStyle; + if(applyFallbackStyle) { + delayStyle += ', ' + timings.transitionDelay + 's'; + } + + style += CSS_PREFIX + 'transition-delay: ' + + prepareStaggerDelay(delayStyle, stagger.transitionDelay, ii) + '; '; + } + + if(stagger.animationDelay > 0 && stagger.animationDuration === 0) { + style += CSS_PREFIX + 'animation-delay: ' + + prepareStaggerDelay(timings.animationDelayStyle, stagger.animationDelay, ii) + '; '; + } + } + + if(style.length > 0) { + formerStyle = applyStyle(node, style); + } + + element.on(css3AnimationEvents, onAnimationProgress); + element.addClass(activeClassName); + + // This will automatically be called by $animate so + // there is no need to attach this internally to the + // timeout done method. + return function onEnd(cancelled) { + element.off(css3AnimationEvents, onAnimationProgress); + element.removeClass(activeClassName); + animateClose(element, className); + if(formerStyle != null) { + formerStyle.length > 0 ? + node.setAttribute('style', formerStyle) : + node.removeAttribute('style'); + } + }; + + function onAnimationProgress(event) { + event.stopPropagation(); + var ev = event.originalEvent || event; + var timeStamp = ev.$manualTimeStamp || ev.timeStamp || Date.now(); + /* $manualTimeStamp is a mocked timeStamp value which is set + * within browserTrigger(). This is only here so that tests can + * mock animations properly. Real events fallback to event.timeStamp, + * or, if they don't, then a timeStamp is automatically created for them. + * We're checking to see if the timeStamp surpasses the expected delay, + * but we're using elapsedTime instead of the timeStamp on the 2nd + * pre-condition since animations sometimes close off early */ + if(Math.max(timeStamp - startTime, 0) >= maxDelayTime && ev.elapsedTime >= maxDuration) { + activeAnimationComplete(); + } + } + } + + function prepareStaggerDelay(delayStyle, staggerDelay, index) { + var style = ''; + forEach(delayStyle.split(','), function(val, i) { + style += (i > 0 ? ',' : '') + + (index * staggerDelay + parseInt(val, 10)) + 's'; + }); + return style; + } + + function animateBefore(element, className) { + if(animateSetup(element, className)) { + return function(cancelled) { + cancelled && animateClose(element, className); + }; + } + } + + function animateAfter(element, className, afterAnimationComplete) { + if(element.data(NG_ANIMATE_CSS_DATA_KEY)) { + return animateRun(element, className, afterAnimationComplete); + } else { + animateClose(element, className); + afterAnimationComplete(); + } + } + + function animate(element, className, animationComplete) { + //If the animateSetup function doesn't bother returning a + //cancellation function then it means that there is no animation + //to perform at all + var preReflowCancellation = animateBefore(element, className); + if(!preReflowCancellation) { + animationComplete(); + return; + } + + //There are two cancellation functions: one is before the first + //reflow animation and the second is during the active state + //animation. The first function will take care of removing the + //data from the element which will not make the 2nd animation + //happen in the first place + var cancel = preReflowCancellation; + afterReflow(function() { + //once the reflow is complete then we point cancel to + //the new cancellation function which will remove all of the + //animation properties from the active animation + cancel = animateAfter(element, className, animationComplete); + }); + + return function(cancelled) { + (cancel || noop)(cancelled); + }; + } + + function animateClose(element, className) { + element.removeClass(className); + element.removeClass(NG_ANIMATE_FALLBACK_CLASS_NAME); + element.removeData(NG_ANIMATE_CSS_DATA_KEY); + } + + return { + allowCancel : function(element, animationEvent, className) { + //always cancel the current animation if it is a + //structural animation + var oldClasses = (element.data(NG_ANIMATE_CSS_DATA_KEY) || {}).classes; + if(!oldClasses || ['enter','leave','move'].indexOf(animationEvent) >= 0) { + return true; + } + + var parentElement = element.parent(); + var clone = angular.element(element[0].cloneNode()); + + //make the element super hidden and override any CSS style values + clone.attr('style','position:absolute; top:-9999px; left:-9999px'); + clone.removeAttr('id'); + clone.html(''); + + forEach(oldClasses.split(' '), function(klass) { + clone.removeClass(klass); + }); + + var suffix = animationEvent == 'addClass' ? '-add' : '-remove'; + clone.addClass(suffixClasses(className, suffix)); + parentElement.append(clone); + + var timings = getElementAnimationDetails(clone); + clone.remove(); + + return Math.max(timings.transitionDuration, timings.animationDuration) > 0; + }, + + enter : function(element, animationCompleted) { + return animate(element, 'ng-enter', animationCompleted); + }, + + leave : function(element, animationCompleted) { + return animate(element, 'ng-leave', animationCompleted); + }, + + move : function(element, animationCompleted) { + return animate(element, 'ng-move', animationCompleted); + }, + + beforeAddClass : function(element, className, animationCompleted) { + var cancellationMethod = animateBefore(element, suffixClasses(className, '-add')); + if(cancellationMethod) { + afterReflow(animationCompleted); + return cancellationMethod; + } + animationCompleted(); + }, + + addClass : function(element, className, animationCompleted) { + return animateAfter(element, suffixClasses(className, '-add'), animationCompleted); + }, + + beforeRemoveClass : function(element, className, animationCompleted) { + var cancellationMethod = animateBefore(element, suffixClasses(className, '-remove')); + if(cancellationMethod) { + afterReflow(animationCompleted); + return cancellationMethod; + } + animationCompleted(); + }, + + removeClass : function(element, className, animationCompleted) { + return animateAfter(element, suffixClasses(className, '-remove'), animationCompleted); + } + }; + + function suffixClasses(classes, suffix) { + var className = ''; + classes = angular.isArray(classes) ? classes : classes.split(/\s+/); + forEach(classes, function(klass, i) { + if(klass && klass.length > 0) { + className += (i > 0 ? ' ' : '') + klass + suffix; + } + }); + return className; + } + }]); + }]); + + +})(window, window.angular); diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-animate.min.js b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-animate.min.js new file mode 100755 index 0000000..0128b6e --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-animate.min.js @@ -0,0 +1,21 @@ +/* + AngularJS v1.2.0 + (c) 2010-2012 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(A,s,B){'use strict';s.module("ngAnimate",["ng"]).config(["$provide","$animateProvider",function(N,D){var z=s.noop,k=s.forEach,X=D.$$selectors,T=1,f="$$ngAnimateState",E="ng-animate",g={running:!0};N.decorator("$animate",["$delegate","$injector","$sniffer","$rootElement","$timeout","$rootScope","$document",function(t,A,F,m,G,p,H){function B(a){if(a){var d=[],b={};a=a.substr(1).split(".");(F.transitions||F.animations)&&a.push("");for(var c=0;c=p&&a.elapsedTime>=n&&w()}var x=a.data(v);if(a.hasClass(b)&&x){var M=a[0],l=x.timings,k=x.stagger,n=x.maxDuration,m=x.activeClassName,p=1E3*Math.max(l.transitionDelay,l.animationDelay),t=Date.now(),s=P+" "+O,r,x=x.ii,u,y="";if(0 + * + * See {@link ngCookies.$cookies `$cookies`} and + * {@link ngCookies.$cookieStore `$cookieStore`} for usage. + */ + + +angular.module('ngCookies', ['ng']). + /** + * @ngdoc object + * @name ngCookies.$cookies + * @requires $browser + * + * @description + * Provides read/write access to browser's cookies. + * + * Only a simple Object is exposed and by adding or removing properties to/from + * this object, new cookies are created/deleted at the end of current $eval. + * + * Requires the {@link ngCookies `ngCookies`} module to be installed. + * + * @example + + + + + + */ + factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) { + var cookies = {}, + lastCookies = {}, + lastBrowserCookies, + runEval = false, + copy = angular.copy, + isUndefined = angular.isUndefined; + + //creates a poller fn that copies all cookies from the $browser to service & inits the service + $browser.addPollFn(function() { + var currentCookies = $browser.cookies(); + if (lastBrowserCookies != currentCookies) { //relies on browser.cookies() impl + lastBrowserCookies = currentCookies; + copy(currentCookies, lastCookies); + copy(currentCookies, cookies); + if (runEval) $rootScope.$apply(); + } + })(); + + runEval = true; + + //at the end of each eval, push cookies + //TODO: this should happen before the "delayed" watches fire, because if some cookies are not + // strings or browser refuses to store some cookies, we update the model in the push fn. + $rootScope.$watch(push); + + return cookies; + + + /** + * Pushes all the cookies from the service to the browser and verifies if all cookies were + * stored. + */ + function push() { + var name, + value, + browserCookies, + updated; + + //delete any cookies deleted in $cookies + for (name in lastCookies) { + if (isUndefined(cookies[name])) { + $browser.cookies(name, undefined); + } + } + + //update all cookies updated in $cookies + for(name in cookies) { + value = cookies[name]; + if (!angular.isString(value)) { + if (angular.isDefined(lastCookies[name])) { + cookies[name] = lastCookies[name]; + } else { + delete cookies[name]; + } + } else if (value !== lastCookies[name]) { + $browser.cookies(name, value); + updated = true; + } + } + + //verify what was actually stored + if (updated){ + updated = false; + browserCookies = $browser.cookies(); + + for (name in cookies) { + if (cookies[name] !== browserCookies[name]) { + //delete or reset all cookies that the browser dropped from $cookies + if (isUndefined(browserCookies[name])) { + delete cookies[name]; + } else { + cookies[name] = browserCookies[name]; + } + updated = true; + } + } + } + } + }]). + + + /** + * @ngdoc object + * @name ngCookies.$cookieStore + * @requires $cookies + * + * @description + * Provides a key-value (string-object) storage, that is backed by session cookies. + * Objects put or retrieved from this storage are automatically serialized or + * deserialized by angular's toJson/fromJson. + * + * Requires the {@link ngCookies `ngCookies`} module to be installed. + * + * @example + */ + factory('$cookieStore', ['$cookies', function($cookies) { + + return { + /** + * @ngdoc method + * @name ngCookies.$cookieStore#get + * @methodOf ngCookies.$cookieStore + * + * @description + * Returns the value of given cookie key + * + * @param {string} key Id to use for lookup. + * @returns {Object} Deserialized cookie value. + */ + get: function(key) { + var value = $cookies[key]; + return value ? angular.fromJson(value) : value; + }, + + /** + * @ngdoc method + * @name ngCookies.$cookieStore#put + * @methodOf ngCookies.$cookieStore + * + * @description + * Sets a value for given cookie key + * + * @param {string} key Id for the `value`. + * @param {Object} value Value to be stored. + */ + put: function(key, value) { + $cookies[key] = angular.toJson(value); + }, + + /** + * @ngdoc method + * @name ngCookies.$cookieStore#remove + * @methodOf ngCookies.$cookieStore + * + * @description + * Remove given cookie + * + * @param {string} key Id of the key-value pair to delete. + */ + remove: function(key) { + delete $cookies[key]; + } + }; + + }]); + + +})(window, window.angular); diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-cookies.min.js b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-cookies.min.js new file mode 100755 index 0000000..dd270fe --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-cookies.min.js @@ -0,0 +1,8 @@ +/* + AngularJS v1.2.0 + (c) 2010-2012 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(p,f,n){'use strict';f.module("ngCookies",["ng"]).factory("$cookies",["$rootScope","$browser",function(d,b){var c={},g={},h,k=!1,l=f.copy,m=f.isUndefined;b.addPollFn(function(){var a=b.cookies();h!=a&&(h=a,l(a,g),l(a,c),k&&d.$apply())})();k=!0;d.$watch(function(){var a,e,d;for(a in g)m(c[a])&&b.cookies(a,n);for(a in c)(e=c[a],f.isString(e))?e!==g[a]&&(b.cookies(a,e),d=!0):f.isDefined(g[a])?c[a]=g[a]:delete c[a];if(d)for(a in e=b.cookies(),c)c[a]!==e[a]&&(m(e[a])?delete c[a]:c[a]=e[a])}); +return c}]).factory("$cookieStore",["$cookies",function(d){return{get:function(b){return(b=d[b])?f.fromJson(b):b},put:function(b,c){d[b]=f.toJson(c)},remove:function(b){delete d[b]}}}])})(window,window.angular); +//# sourceMappingURL=angular-cookies.min.js.map diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-cookies.min.js.map b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-cookies.min.js.map new file mode 100755 index 0000000..a7fd1e9 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-cookies.min.js.map @@ -0,0 +1,8 @@ +{ +"version":3, +"file":"angular-cookies.min.js", +"lineCount":7, +"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CAoBtCD,CAAAE,OAAA,CAAe,WAAf,CAA4B,CAAC,IAAD,CAA5B,CAAAC,QAAA,CA4BW,UA5BX,CA4BuB,CAAC,YAAD,CAAe,UAAf,CAA2B,QAAS,CAACC,CAAD,CAAaC,CAAb,CAAuB,CAAA,IACxEC,EAAU,EAD8D,CAExEC,EAAc,EAF0D,CAGxEC,CAHwE,CAIxEC,EAAU,CAAA,CAJ8D,CAKxEC,EAAOV,CAAAU,KALiE,CAMxEC,EAAcX,CAAAW,YAGlBN,EAAAO,UAAA,CAAmB,QAAQ,EAAG,CAC5B,IAAIC,EAAiBR,CAAAC,QAAA,EACjBE,EAAJ,EAA0BK,CAA1B,GACEL,CAGA,CAHqBK,CAGrB,CAFAH,CAAA,CAAKG,CAAL,CAAqBN,CAArB,CAEA,CADAG,CAAA,CAAKG,CAAL,CAAqBP,CAArB,CACA,CAAIG,CAAJ,EAAaL,CAAAU,OAAA,EAJf,CAF4B,CAA9B,CAAA,EAUAL,EAAA,CAAU,CAAA,CAKVL,EAAAW,OAAA,CASAC,QAAa,EAAG,CAAA,IACVC,CADU,CAEVC,CAFU,CAIVC,CAGJ,KAAKF,CAAL,GAAaV,EAAb,CACMI,CAAA,CAAYL,CAAA,CAAQW,CAAR,CAAZ,CAAJ,EACEZ,CAAAC,QAAA,CAAiBW,CAAjB,CAAuBhB,CAAvB,CAKJ,KAAIgB,CAAJ,GAAYX,EAAZ,CAEE,CADAY,CACK,CADGZ,CAAA,CAAQW,CAAR,CACH,CAAAjB,CAAAoB,SAAA,CAAiBF,CAAjB,CAAL,EAMWA,CANX,GAMqBX,CAAA,CAAYU,CAAZ,CANrB,GAOEZ,CAAAC,QAAA,CAAiBW,CAAjB,CAAuBC,CAAvB,CACA,CAAAC,CAAA,CAAU,CAAA,CARZ,EACMnB,CAAAqB,UAAA,CAAkBd,CAAA,CAAYU,CAAZ,CAAlB,CAAJ,CACEX,CAAA,CAAQW,CAAR,CADF,CACkBV,CAAA,CAAYU,CAAZ,CADlB,CAGE,OAAOX,CAAA,CAAQW,CAAR,CASb,IAAIE,CAAJ,CAIE,IAAKF,CAAL,GAFAK,EAEahB,CAFID,CAAAC,QAAA,EAEJA,CAAAA,CAAb,CACMA,CAAA,CAAQW,CAAR,CAAJ,GAAsBK,CAAA,CAAeL,CAAf,CAAtB,GAEMN,CAAA,CAAYW,CAAA,CAAeL,CAAf,CAAZ,CAAJ,CACE,OAAOX,CAAA,CAAQW,CAAR,CADT,CAGEX,CAAA,CAAQW,CAAR,CAHF,CAGkBK,CAAA,CAAeL,CAAf,CALpB,CAlCU,CAThB,CAEA;MAAOX,EA1BqE,CAA3D,CA5BvB,CAAAH,QAAA,CA4HW,cA5HX,CA4H2B,CAAC,UAAD,CAAa,QAAQ,CAACoB,CAAD,CAAW,CAErD,MAAO,KAYAC,QAAQ,CAACC,CAAD,CAAM,CAEjB,MAAO,CADHP,CACG,CADKK,CAAA,CAASE,CAAT,CACL,EAAQzB,CAAA0B,SAAA,CAAiBR,CAAjB,CAAR,CAAkCA,CAFxB,CAZd,KA4BAS,QAAQ,CAACF,CAAD,CAAMP,CAAN,CAAa,CACxBK,CAAA,CAASE,CAAT,CAAA,CAAgBzB,CAAA4B,OAAA,CAAeV,CAAf,CADQ,CA5BrB,QA0CGW,QAAQ,CAACJ,CAAD,CAAM,CACpB,OAAOF,CAAA,CAASE,CAAT,CADa,CA1CjB,CAF8C,CAAhC,CA5H3B,CApBsC,CAArC,CAAA,CAoME1B,MApMF,CAoMUA,MAAAC,QApMV;", +"sources":["angular-cookies.js"], +"names":["window","angular","undefined","module","factory","$rootScope","$browser","cookies","lastCookies","lastBrowserCookies","runEval","copy","isUndefined","addPollFn","currentCookies","$apply","$watch","push","name","value","updated","isString","isDefined","browserCookies","$cookies","get","key","fromJson","put","toJson","remove"] +} diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-loader.js b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-loader.js new file mode 100755 index 0000000..919ae18 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-loader.js @@ -0,0 +1,323 @@ +/** + * @license AngularJS v1.2.0 + * (c) 2010-2012 Google, Inc. http://angularjs.org + * License: MIT + */ + +( + +/** + * @ngdoc interface + * @name angular.Module + * @description + * + * Interface for configuring angular {@link angular.module modules}. + */ + +function setupModuleLoader(window) { + + var $injectorMinErr = minErr('$injector'); + + function ensure(obj, name, factory) { + return obj[name] || (obj[name] = factory()); + } + + return ensure(ensure(window, 'angular', Object), 'module', function() { + /** @type {Object.} */ + var modules = {}; + + /** + * @ngdoc function + * @name angular.module + * @description + * + * The `angular.module` is a global place for creating, registering and retrieving Angular + * modules. + * All modules (angular core or 3rd party) that should be available to an application must be + * registered using this mechanism. + * + * When passed two or more arguments, a new module is created. If passed only one argument, an + * existing module (the name passed as the first argument to `module`) is retrieved. + * + * + * # Module + * + * A module is a collection of services, directives, filters, and configuration information. + * `angular.module` is used to configure the {@link AUTO.$injector $injector}. + * + *
+     * // Create a new module
+     * var myModule = angular.module('myModule', []);
+     *
+     * // register a new service
+     * myModule.value('appName', 'MyCoolApp');
+     *
+     * // configure existing services inside initialization blocks.
+     * myModule.config(function($locationProvider) {'use strict';
+     *   // Configure existing providers
+     *   $locationProvider.hashPrefix('!');
+     * });
+     * 
+ * + * Then you can create an injector and load your modules like this: + * + *
+     * var injector = angular.injector(['ng', 'MyModule'])
+     * 
+ * + * However it's more likely that you'll just use + * {@link ng.directive:ngApp ngApp} or + * {@link angular.bootstrap} to simplify this process for you. + * + * @param {!string} name The name of the module to create or retrieve. + * @param {Array.=} requires If specified then new module is being created. If + * unspecified then the the module is being retrieved for further configuration. + * @param {Function} configFn Optional configuration function for the module. Same as + * {@link angular.Module#methods_config Module#config()}. + * @returns {module} new module with the {@link angular.Module} api. + */ + return function module(name, requires, configFn) { + assertNotHasOwnProperty(name, 'module'); + if (requires && modules.hasOwnProperty(name)) { + modules[name] = null; + } + return ensure(modules, name, function() { + if (!requires) { + throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " + + "the module name or forgot to load it. If registering a module ensure that you " + + "specify the dependencies as the second argument.", name); + } + + /** @type {!Array.>} */ + var invokeQueue = []; + + /** @type {!Array.} */ + var runBlocks = []; + + var config = invokeLater('$injector', 'invoke'); + + /** @type {angular.Module} */ + var moduleInstance = { + // Private state + _invokeQueue: invokeQueue, + _runBlocks: runBlocks, + + /** + * @ngdoc property + * @name angular.Module#requires + * @propertyOf angular.Module + * @returns {Array.} List of module names which must be loaded before this module. + * @description + * Holds the list of modules which the injector will load before the current module is + * loaded. + */ + requires: requires, + + /** + * @ngdoc property + * @name angular.Module#name + * @propertyOf angular.Module + * @returns {string} Name of the module. + * @description + */ + name: name, + + + /** + * @ngdoc method + * @name angular.Module#provider + * @methodOf angular.Module + * @param {string} name service name + * @param {Function} providerType Construction function for creating new instance of the + * service. + * @description + * See {@link AUTO.$provide#provider $provide.provider()}. + */ + provider: invokeLater('$provide', 'provider'), + + /** + * @ngdoc method + * @name angular.Module#factory + * @methodOf angular.Module + * @param {string} name service name + * @param {Function} providerFunction Function for creating new instance of the service. + * @description + * See {@link AUTO.$provide#factory $provide.factory()}. + */ + factory: invokeLater('$provide', 'factory'), + + /** + * @ngdoc method + * @name angular.Module#service + * @methodOf angular.Module + * @param {string} name service name + * @param {Function} constructor A constructor function that will be instantiated. + * @description + * See {@link AUTO.$provide#service $provide.service()}. + */ + service: invokeLater('$provide', 'service'), + + /** + * @ngdoc method + * @name angular.Module#value + * @methodOf angular.Module + * @param {string} name service name + * @param {*} object Service instance object. + * @description + * See {@link AUTO.$provide#value $provide.value()}. + */ + value: invokeLater('$provide', 'value'), + + /** + * @ngdoc method + * @name angular.Module#constant + * @methodOf angular.Module + * @param {string} name constant name + * @param {*} object Constant value. + * @description + * Because the constant are fixed, they get applied before other provide methods. + * See {@link AUTO.$provide#constant $provide.constant()}. + */ + constant: invokeLater('$provide', 'constant', 'unshift'), + + /** + * @ngdoc method + * @name angular.Module#animation + * @methodOf angular.Module + * @param {string} name animation name + * @param {Function} animationFactory Factory function for creating new instance of an + * animation. + * @description + * + * **NOTE**: animations take effect only if the **ngAnimate** module is loaded. + * + * + * Defines an animation hook that can be later used with + * {@link ngAnimate.$animate $animate} service and directives that use this service. + * + *
+           * module.animation('.animation-name', function($inject1, $inject2) {
+           *   return {
+           *     eventName : function(element, done) {
+           *       //code to run the animation
+           *       //once complete, then run done()
+           *       return function cancellationFunction(element) {
+           *         //code to cancel the animation
+           *       }
+           *     }
+           *   }
+           * })
+           * 
+ * + * See {@link ngAnimate.$animateProvider#register $animateProvider.register()} and + * {@link ngAnimate ngAnimate module} for more information. + */ + animation: invokeLater('$animateProvider', 'register'), + + /** + * @ngdoc method + * @name angular.Module#filter + * @methodOf angular.Module + * @param {string} name Filter name. + * @param {Function} filterFactory Factory function for creating new instance of filter. + * @description + * See {@link ng.$filterProvider#register $filterProvider.register()}. + */ + filter: invokeLater('$filterProvider', 'register'), + + /** + * @ngdoc method + * @name angular.Module#controller + * @methodOf angular.Module + * @param {string|Object} name Controller name, or an object map of controllers where the + * keys are the names and the values are the constructors. + * @param {Function} constructor Controller constructor function. + * @description + * See {@link ng.$controllerProvider#register $controllerProvider.register()}. + */ + controller: invokeLater('$controllerProvider', 'register'), + + /** + * @ngdoc method + * @name angular.Module#directive + * @methodOf angular.Module + * @param {string|Object} name Directive name, or an object map of directives where the + * keys are the names and the values are the factories. + * @param {Function} directiveFactory Factory function for creating new instance of + * directives. + * @description + * See {@link ng.$compileProvider#methods_directive $compileProvider.directive()}. + */ + directive: invokeLater('$compileProvider', 'directive'), + + /** + * @ngdoc method + * @name angular.Module#config + * @methodOf angular.Module + * @param {Function} configFn Execute this function on module load. Useful for service + * configuration. + * @description + * Use this method to register work which needs to be performed on module loading. + */ + config: config, + + /** + * @ngdoc method + * @name angular.Module#run + * @methodOf angular.Module + * @param {Function} initializationFn Execute this function after injector creation. + * Useful for application initialization. + * @description + * Use this method to register work which should be performed when the injector is done + * loading all modules. + */ + run: function(block) { + runBlocks.push(block); + return this; + } + }; + + if (configFn) { + config(configFn); + } + + return moduleInstance; + + /** + * @param {string} provider + * @param {string} method + * @param {String=} insertMethod + * @returns {angular.Module} + */ + function invokeLater(provider, method, insertMethod) { + return function() { + invokeQueue[insertMethod || 'push']([provider, method, arguments]); + return moduleInstance; + }; + } + }); + }; + }); + +} + +)(window); + +/** + * Closure compiler type information + * + * @typedef { { + * requires: !Array., + * invokeQueue: !Array.>, + * + * service: function(string, Function):angular.Module, + * factory: function(string, Function):angular.Module, + * value: function(string, *):angular.Module, + * + * filter: function(string, Function):angular.Module, + * + * init: function(Function):angular.Module + * } } + */ +angular.Module; + diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-loader.min.js b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-loader.min.js new file mode 100755 index 0000000..8919389 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-loader.min.js @@ -0,0 +1,8 @@ +/* + AngularJS v1.2.0 + (c) 2010-2012 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(k){'use strict';function d(c,b,e){return c[b]||(c[b]=e())}var l=minErr("$injector");return d(d(k,"angular",Object),"module",function(){var c={};return function(b,e,f){assertNotHasOwnProperty(b,"module");e&&c.hasOwnProperty(b)&&(c[b]=null);return d(c,b,function(){function a(a,b,d){return function(){c[d||"push"]([a,b,arguments]);return g}}if(!e)throw l("nomod",b);var c=[],d=[],h=a("$injector","invoke"),g={_invokeQueue:c,_runBlocks:d,requires:e,name:b,provider:a("$provide","provider"),factory:a("$provide", +"factory"),service:a("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),animation:a("$animateProvider","register"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),config:h,run:function(a){d.push(a);return this}};f&&h(f);return g})}})})(window); +//# sourceMappingURL=angular-loader.min.js.map diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-loader.min.js.map b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-loader.min.js.map new file mode 100755 index 0000000..1ffea5e --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-loader.min.js.map @@ -0,0 +1,8 @@ +{ +"version":3, +"file":"angular-loader.min.js", +"lineCount":7, +"mappings":"A;;;;;aAgBAA,SAA0B,CAACC,CAAD,CAAS,CAIjCC,QAASA,EAAM,CAACC,CAAD,CAAMC,CAAN,CAAYC,CAAZ,CAAqB,CAClC,MAAOF,EAAA,CAAIC,CAAJ,CAAP,GAAqBD,CAAA,CAAIC,CAAJ,CAArB,CAAiCC,CAAA,EAAjC,CADkC,CAFpC,IAAIC,EAAkBC,MAAA,CAAO,WAAP,CAMtB,OAAOL,EAAA,CAAOA,CAAA,CAAOD,CAAP,CAAe,SAAf,CAA0BO,MAA1B,CAAP,CAA0C,QAA1C,CAAoD,QAAQ,EAAG,CAEpE,IAAIC,EAAU,EAoDd,OAAOC,SAAe,CAACN,CAAD,CAAOO,CAAP,CAAiBC,CAAjB,CAA2B,CAC/CC,uBAAA,CAAwBT,CAAxB,CAA8B,QAA9B,CACIO,EAAJ,EAAgBF,CAAAK,eAAA,CAAuBV,CAAvB,CAAhB,GACEK,CAAA,CAAQL,CAAR,CADF,CACkB,IADlB,CAGA,OAAOF,EAAA,CAAOO,CAAP,CAAgBL,CAAhB,CAAsB,QAAQ,EAAG,CAgNtCW,QAASA,EAAW,CAACC,CAAD,CAAWC,CAAX,CAAmBC,CAAnB,CAAiC,CACnD,MAAO,SAAQ,EAAG,CAChBC,CAAA,CAAYD,CAAZ,EAA4B,MAA5B,CAAA,CAAoC,CAACF,CAAD,CAAWC,CAAX,CAAmBG,SAAnB,CAApC,CACA,OAAOC,EAFS,CADiC,CA/MrD,GAAI,CAACV,CAAL,CACE,KAAML,EAAA,CAAgB,OAAhB,CAEiDF,CAFjD,CAAN,CAMF,IAAIe,EAAc,EAAlB,CAGIG,EAAY,EAHhB,CAKIC,EAASR,CAAA,CAAY,WAAZ,CAAyB,QAAzB,CALb,CAQIM,EAAiB,cAELF,CAFK,YAGPG,CAHO,UAcTX,CAdS,MAuBbP,CAvBa,UAoCTW,CAAA,CAAY,UAAZ,CAAwB,UAAxB,CApCS,SA+CVA,CAAA,CAAY,UAAZ;AAAwB,SAAxB,CA/CU,SA0DVA,CAAA,CAAY,UAAZ,CAAwB,SAAxB,CA1DU,OAqEZA,CAAA,CAAY,UAAZ,CAAwB,OAAxB,CArEY,UAiFTA,CAAA,CAAY,UAAZ,CAAwB,UAAxB,CAAoC,SAApC,CAjFS,WAmHRA,CAAA,CAAY,kBAAZ,CAAgC,UAAhC,CAnHQ,QA8HXA,CAAA,CAAY,iBAAZ,CAA+B,UAA/B,CA9HW,YA0IPA,CAAA,CAAY,qBAAZ,CAAmC,UAAnC,CA1IO,WAuJRA,CAAA,CAAY,kBAAZ,CAAgC,WAAhC,CAvJQ,QAkKXQ,CAlKW,KA8KdC,QAAQ,CAACC,CAAD,CAAQ,CACnBH,CAAAI,KAAA,CAAeD,CAAf,CACA,OAAO,KAFY,CA9KF,CAoLjBb,EAAJ,EACEW,CAAA,CAAOX,CAAP,CAGF,OAAQS,EAxM8B,CAAjC,CALwC,CAtDmB,CAA/D,CAR0B,CAAnCrB,CAAA,CA+REC,MA/RF;", +"sources":["angular-loader.js"], +"names":["setupModuleLoader","window","ensure","obj","name","factory","$injectorMinErr","minErr","Object","modules","module","requires","configFn","assertNotHasOwnProperty","hasOwnProperty","invokeLater","provider","method","insertMethod","invokeQueue","arguments","moduleInstance","runBlocks","config","run","block","push"] +} diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-resource.js b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-resource.js new file mode 100755 index 0000000..4011a6e --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-resource.js @@ -0,0 +1,578 @@ +/** + * @license AngularJS v1.2.0 + * (c) 2010-2012 Google, Inc. http://angularjs.org + * License: MIT + */ +(function(window, angular, undefined) {'use strict'; + +var $resourceMinErr = angular.$$minErr('$resource'); + +/** + * @ngdoc overview + * @name ngResource + * @description + * + * # ngResource + * + * The `ngResource` module provides interaction support with RESTful services + * via the $resource service. + * + * {@installModule resource} + * + *
+ * + * See {@link ngResource.$resource `$resource`} for usage. + */ + +/** + * @ngdoc object + * @name ngResource.$resource + * @requires $http + * + * @description + * A factory which creates a resource object that lets you interact with + * [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources. + * + * The returned resource object has action methods which provide high-level behaviors without + * the need to interact with the low level {@link ng.$http $http} service. + * + * Requires the {@link ngResource `ngResource`} module to be installed. + * + * @param {string} url A parametrized URL template with parameters prefixed by `:` as in + * `/user/:username`. If you are using a URL with a port number (e.g. + * `http://example.com:8080/api`), it will be respected. + * + * If you are using a url with a suffix, just add the suffix, like this: + * `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')` + * or even `$resource('http://example.com/resource/:resource_id.:format')` + * If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be + * collapsed down to a single `.`. If you need this sequence to appear and not collapse then you + * can escape it with `/\.`. + * + * @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in + * `actions` methods. If any of the parameter value is a function, it will be executed every time + * when a param value needs to be obtained for a request (unless the param was overridden). + * + * Each key value in the parameter object is first bound to url template if present and then any + * excess keys are appended to the url search query after the `?`. + * + * Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in + * URL `/path/greet?salutation=Hello`. + * + * If the parameter value is prefixed with `@` then the value of that parameter is extracted from + * the data object (useful for non-GET operations). + * + * @param {Object.=} actions Hash with declaration of custom action that should extend the + * default set of resource actions. The declaration should be created in the format of {@link + * ng.$http#usage_parameters $http.config}: + * + * {action1: {method:?, params:?, isArray:?, headers:?, ...}, + * action2: {method:?, params:?, isArray:?, headers:?, ...}, + * ...} + * + * Where: + * + * - **`action`** – {string} – The name of action. This name becomes the name of the method on + * your resource object. + * - **`method`** – {string} – HTTP request method. Valid methods are: `GET`, `POST`, `PUT`, + * `DELETE`, and `JSONP`. + * - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of + * the parameter value is a function, it will be executed every time when a param value needs to + * be obtained for a request (unless the param was overridden). + * - **`url`** – {string} – action specific `url` override. The url templating is supported just + * like for the resource-level urls. + * - **`isArray`** – {boolean=} – If true then the returned object for this action is an array, + * see `returns` section. + * - **`transformRequest`** – + * `{function(data, headersGetter)|Array.}` – + * transform function or an array of such functions. The transform function takes the http + * request body and headers and returns its transformed (typically serialized) version. + * - **`transformResponse`** – + * `{function(data, headersGetter)|Array.}` – + * transform function or an array of such functions. The transform function takes the http + * response body and headers and returns its transformed (typically deserialized) version. + * - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the + * GET request, otherwise if a cache instance built with + * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for + * caching. + * - **`timeout`** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} that + * should abort the request when resolved. + * - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the + * XHR object. See {@link https://developer.mozilla.org/en/http_access_control#section_5 + * requests with credentials} for more information. + * - **`responseType`** - `{string}` - see {@link + * https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType requestType}. + * - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods - + * `response` and `responseError`. Both `response` and `responseError` interceptors get called + * with `http response` object. See {@link ng.$http $http interceptors}. + * + * @returns {Object} A resource "class" object with methods for the default set of resource actions + * optionally extended with custom `actions`. The default set contains these actions: + * + * { 'get': {method:'GET'}, + * 'save': {method:'POST'}, + * 'query': {method:'GET', isArray:true}, + * 'remove': {method:'DELETE'}, + * 'delete': {method:'DELETE'} }; + * + * Calling these methods invoke an {@link ng.$http} with the specified http method, + * destination and parameters. When the data is returned from the server then the object is an + * instance of the resource class. The actions `save`, `remove` and `delete` are available on it + * as methods with the `$` prefix. This allows you to easily perform CRUD operations (create, + * read, update, delete) on server-side data like this: + *
+        var User = $resource('/user/:userId', {userId:'@id'});
+        var user = User.get({userId:123}, function() {
+          user.abc = true;
+          user.$save();
+        });
+     
+ * + * It is important to realize that invoking a $resource object method immediately returns an + * empty reference (object or array depending on `isArray`). Once the data is returned from the + * server the existing reference is populated with the actual data. This is a useful trick since + * usually the resource is assigned to a model which is then rendered by the view. Having an empty + * object results in no rendering, once the data arrives from the server then the object is + * populated with the data and the view automatically re-renders itself showing the new data. This + * means that in most case one never has to write a callback function for the action methods. + * + * The action methods on the class object or instance object can be invoked with the following + * parameters: + * + * - HTTP GET "class" actions: `Resource.action([parameters], [success], [error])` + * - non-GET "class" actions: `Resource.action([parameters], postData, [success], [error])` + * - non-GET instance actions: `instance.$action([parameters], [success], [error])` + * + * Success callback is called with (value, responseHeaders) arguments. Error callback is called + * with (httpResponse) argument. + * + * Class actions return empty instance (with additional properties below). + * Instance actions return promise of the action. + * + * The Resource instances and collection have these additional properties: + * + * - `$promise`: the {@link ng.$q promise} of the original server interaction that created this + * instance or collection. + * + * On success, the promise is resolved with the same resource instance or collection object, + * updated with data from server. This makes it easy to use in + * {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view + * rendering until the resource(s) are loaded. + * + * On failure, the promise is resolved with the {@link ng.$http http response} object, without + * the `resource` property. + * + * - `$resolved`: `true` after first server interaction is completed (either with success or + * rejection), `false` before that. Knowing if the Resource has been resolved is useful in + * data-binding. + * + * @example + * + * # Credit card resource + * + *
+     // Define CreditCard class
+     var CreditCard = $resource('/user/:userId/card/:cardId',
+      {userId:123, cardId:'@id'}, {
+       charge: {method:'POST', params:{charge:true}}
+      });
+
+     // We can retrieve a collection from the server
+     var cards = CreditCard.query(function() {
+       // GET: /user/123/card
+       // server returns: [ {id:456, number:'1234', name:'Smith'} ];
+
+       var card = cards[0];
+       // each item is an instance of CreditCard
+       expect(card instanceof CreditCard).toEqual(true);
+       card.name = "J. Smith";
+       // non GET methods are mapped onto the instances
+       card.$save();
+       // POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'}
+       // server returns: {id:456, number:'1234', name: 'J. Smith'};
+
+       // our custom method is mapped as well.
+       card.$charge({amount:9.99});
+       // POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'}
+     });
+
+     // we can create an instance as well
+     var newCard = new CreditCard({number:'0123'});
+     newCard.name = "Mike Smith";
+     newCard.$save();
+     // POST: /user/123/card {number:'0123', name:'Mike Smith'}
+     // server returns: {id:789, number:'01234', name: 'Mike Smith'};
+     expect(newCard.id).toEqual(789);
+ * 
+ * + * The object returned from this function execution is a resource "class" which has "static" method + * for each action in the definition. + * + * Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and + * `headers`. + * When the data is returned from the server then the object is an instance of the resource type and + * all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD + * operations (create, read, update, delete) on server-side data. + +
+     var User = $resource('/user/:userId', {userId:'@id'});
+     var user = User.get({userId:123}, function() {
+       user.abc = true;
+       user.$save();
+     });
+   
+ * + * It's worth noting that the success callback for `get`, `query` and other methods gets passed + * in the response that came from the server as well as $http header getter function, so one + * could rewrite the above example and get access to http headers as: + * +
+     var User = $resource('/user/:userId', {userId:'@id'});
+     User.get({userId:123}, function(u, getResponseHeaders){
+       u.abc = true;
+       u.$save(function(u, putResponseHeaders) {
+         //u => saved user object
+         //putResponseHeaders => $http header getter
+       });
+     });
+   
+ + * # Buzz client + + Let's look at what a buzz client created with the `$resource` service looks like: + + + + +
+ + +
+
+

+ + {{item.actor.name}} + Expand replies: + {{item.links.replies[0].count}} +

+ {{item.object.content | html}} +
+ + {{reply.actor.name}}: {{reply.content | html}} +
+
+
+
+ + +
+ */ +angular.module('ngResource', ['ng']). + factory('$resource', ['$http', '$parse', '$q', function($http, $parse, $q) { + var DEFAULT_ACTIONS = { + 'get': {method:'GET'}, + 'save': {method:'POST'}, + 'query': {method:'GET', isArray:true}, + 'remove': {method:'DELETE'}, + 'delete': {method:'DELETE'} + }; + var noop = angular.noop, + forEach = angular.forEach, + extend = angular.extend, + copy = angular.copy, + isFunction = angular.isFunction, + getter = function(obj, path) { + return $parse(path)(obj); + }; + + /** + * We need our custom method because encodeURIComponent is too aggressive and doesn't follow + * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path + * segments: + * segment = *pchar + * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" + * pct-encoded = "%" HEXDIG HEXDIG + * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" + * / "*" / "+" / "," / ";" / "=" + */ + function encodeUriSegment(val) { + return encodeUriQuery(val, true). + replace(/%26/gi, '&'). + replace(/%3D/gi, '='). + replace(/%2B/gi, '+'); + } + + + /** + * This method is intended for encoding *key* or *value* parts of query component. We need a + * custom method because encodeURIComponent is too aggressive and encodes stuff that doesn't + * have to be encoded per http://tools.ietf.org/html/rfc3986: + * query = *( pchar / "/" / "?" ) + * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" + * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + * pct-encoded = "%" HEXDIG HEXDIG + * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" + * / "*" / "+" / "," / ";" / "=" + */ + function encodeUriQuery(val, pctEncodeSpaces) { + return encodeURIComponent(val). + replace(/%40/gi, '@'). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, (pctEncodeSpaces ? '%20' : '+')); + } + + function Route(template, defaults) { + this.template = template; + this.defaults = defaults || {}; + this.urlParams = {}; + } + + Route.prototype = { + setUrlParams: function(config, params, actionUrl) { + var self = this, + url = actionUrl || self.template, + val, + encodedVal; + + var urlParams = self.urlParams = {}; + forEach(url.split(/\W/), function(param){ + if (param === 'hasOwnProperty') { + throw $resourceMinErr('badname', "hasOwnProperty is not a valid parameter name."); + } + if (!(new RegExp("^\\d+$").test(param)) && param && + (new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) { + urlParams[param] = true; + } + }); + url = url.replace(/\\:/g, ':'); + + params = params || {}; + forEach(self.urlParams, function(_, urlParam){ + val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam]; + if (angular.isDefined(val) && val !== null) { + encodedVal = encodeUriSegment(val); + url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), encodedVal + "$1"); + } else { + url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function(match, + leadingSlashes, tail) { + if (tail.charAt(0) == '/') { + return tail; + } else { + return leadingSlashes + tail; + } + }); + } + }); + + // strip trailing slashes and set the url + url = url.replace(/\/+$/, ''); + // then replace collapse `/.` if found in the last URL path segment before the query + // E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x` + url = url.replace(/\/\.(?=\w+($|\?))/, '.'); + // replace escaped `/\.` with `/.` + config.url = url.replace(/\/\\\./, '/.'); + + + // set params - delegate param encoding to $http + forEach(params, function(value, key){ + if (!self.urlParams[key]) { + config.params = config.params || {}; + config.params[key] = value; + } + }); + } + }; + + + function resourceFactory(url, paramDefaults, actions) { + var route = new Route(url); + + actions = extend({}, DEFAULT_ACTIONS, actions); + + function extractParams(data, actionParams){ + var ids = {}; + actionParams = extend({}, paramDefaults, actionParams); + forEach(actionParams, function(value, key){ + if (isFunction(value)) { value = value(); } + ids[key] = value && value.charAt && value.charAt(0) == '@' ? + getter(data, value.substr(1)) : value; + }); + return ids; + } + + function defaultResponseInterceptor(response) { + return response.resource; + } + + function Resource(value){ + copy(value || {}, this); + } + + forEach(actions, function(action, name) { + var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method); + + Resource[name] = function(a1, a2, a3, a4) { + var params = {}, data, success, error; + + /* jshint -W086 */ /* (purposefully fall through case statements) */ + switch(arguments.length) { + case 4: + error = a4; + success = a3; + //fallthrough + case 3: + case 2: + if (isFunction(a2)) { + if (isFunction(a1)) { + success = a1; + error = a2; + break; + } + + success = a2; + error = a3; + //fallthrough + } else { + params = a1; + data = a2; + success = a3; + break; + } + case 1: + if (isFunction(a1)) success = a1; + else if (hasBody) data = a1; + else params = a1; + break; + case 0: break; + default: + throw $resourceMinErr('badargs', + "Expected up to 4 arguments [params, data, success, error], got {0} arguments", + arguments.length); + } + /* jshint +W086 */ /* (purposefully fall through case statements) */ + + var isInstanceCall = data instanceof Resource; + var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data)); + var httpConfig = {}; + var responseInterceptor = action.interceptor && action.interceptor.response || + defaultResponseInterceptor; + var responseErrorInterceptor = action.interceptor && action.interceptor.responseError || + undefined; + + forEach(action, function(value, key) { + if (key != 'params' && key != 'isArray' && key != 'interceptor') { + httpConfig[key] = copy(value); + } + }); + + if (hasBody) httpConfig.data = data; + route.setUrlParams(httpConfig, + extend({}, extractParams(data, action.params || {}), params), + action.url); + + var promise = $http(httpConfig).then(function(response) { + var data = response.data, + promise = value.$promise; + + if (data) { + // Need to convert action.isArray to boolean in case it is undefined + // jshint -W018 + if ( angular.isArray(data) !== (!!action.isArray) ) { + throw $resourceMinErr('badcfg', 'Error in resource configuration. Expected ' + + 'response to contain an {0} but got an {1}', + action.isArray?'array':'object', angular.isArray(data)?'array':'object'); + } + // jshint +W018 + if (action.isArray) { + value.length = 0; + forEach(data, function(item) { + value.push(new Resource(item)); + }); + } else { + copy(data, value); + value.$promise = promise; + } + } + + value.$resolved = true; + + response.resource = value; + + return response; + }, function(response) { + value.$resolved = true; + + (error||noop)(response); + + return $q.reject(response); + }); + + promise = promise.then( + function(response) { + var value = responseInterceptor(response); + (success||noop)(value, response.headers); + return value; + }, + responseErrorInterceptor); + + if (!isInstanceCall) { + // we are creating instance / collection + // - set the initial promise + // - return the instance / collection + value.$promise = promise; + value.$resolved = false; + + return value; + } + + // instance call + return promise; + }; + + + Resource.prototype['$' + name] = function(params, success, error) { + if (isFunction(params)) { + error = success; success = params; params = {}; + } + var result = Resource[name](params, this, success, error); + return result.$promise || result; + }; + }); + + Resource.bind = function(additionalParamDefaults){ + return resourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions); + }; + + return Resource; + } + + return resourceFactory; + }]); + + +})(window, window.angular); diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-resource.min.js b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-resource.min.js new file mode 100755 index 0000000..9d0959f --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-resource.min.js @@ -0,0 +1,12 @@ +/* + AngularJS v1.2.0 + (c) 2010-2012 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(H,h,C){'use strict';var x=h.$$minErr("$resource");h.module("ngResource",["ng"]).factory("$resource",["$http","$parse","$q",function(D,y,E){function n(h,k){this.template=h;this.defaults=k||{};this.urlParams={}}function t(e,k,f){function q(b,c){var d={};c=u({},k,c);r(c,function(a,c){s(a)&&(a=a());var m;a&&a.charAt&&"@"==a.charAt(0)?(m=a.substr(1),m=y(m)(b)):m=a;d[c]=m});return d}function d(b){return b.resource}function g(b){z(b||{},this)}var F=new n(e);f=u({},G,f);r(f,function(b,c){var A= +/^(POST|PUT|PATCH)$/i.test(b.method);g[c]=function(a,c,m,k){var p={},e,f,v;switch(arguments.length){case 4:v=k,f=m;case 3:case 2:if(s(c)){if(s(a)){f=a;v=c;break}f=c;v=m}else{p=a;e=c;f=m;break}case 1:s(a)?f=a:A?e=a:p=a;break;case 0:break;default:throw x("badargs",arguments.length);}var n=e instanceof g,l=n?e:b.isArray?[]:new g(e),w={},t=b.interceptor&&b.interceptor.response||d,y=b.interceptor&&b.interceptor.responseError||C;r(b,function(a,c){"params"!=c&&("isArray"!=c&&"interceptor"!=c)&&(w[c]=z(a))}); +A&&(w.data=e);F.setUrlParams(w,u({},q(e,b.params||{}),p),b.url);p=D(w).then(function(c){var a=c.data,d=l.$promise;if(a){if(h.isArray(a)!==!!b.isArray)throw x("badcfg",b.isArray?"array":"object",h.isArray(a)?"array":"object");b.isArray?(l.length=0,r(a,function(a){l.push(new g(a))})):(z(a,l),l.$promise=d)}l.$resolved=!0;c.resource=l;return c},function(a){l.$resolved=!0;(v||B)(a);return E.reject(a)});p=p.then(function(a){var c=t(a);(f||B)(c,a.headers);return c},y);return n?p:(l.$promise=p,l.$resolved= +!1,l)};g.prototype["$"+c]=function(a,b,d){s(a)&&(d=b,b=a,a={});a=g[c](a,this,b,d);return a.$promise||a}});g.bind=function(b){return t(e,u({},k,b),f)};return g}var G={get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}},B=h.noop,r=h.forEach,u=h.extend,z=h.copy,s=h.isFunction;n.prototype={setUrlParams:function(e,k,f){var q=this,d=f||q.template,g,n,b=q.urlParams={};r(d.split(/\W/),function(c){if("hasOwnProperty"===c)throw x("badname"); +!/^\d+$/.test(c)&&(c&&RegExp("(^|[^\\\\]):"+c+"(\\W|$)").test(d))&&(b[c]=!0)});d=d.replace(/\\:/g,":");k=k||{};r(q.urlParams,function(c,b){g=k.hasOwnProperty(b)?k[b]:q.defaults[b];h.isDefined(g)&&null!==g?(n=encodeURIComponent(g).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"%20").replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+"),d=d.replace(RegExp(":"+b+"(\\W|$)","g"),n+"$1")):d=d.replace(RegExp("(/?):"+b+"(\\W|$)","g"),function(a, +c,b){return"/"==b.charAt(0)?b:c+b})});d=d.replace(/\/+$/,"");d=d.replace(/\/\.(?=\w+($|\?))/,".");e.url=d.replace(/\/\\\./,"/.");r(k,function(c,b){q.urlParams[b]||(e.params=e.params||{},e.params[b]=c)})}};return t}])})(window,window.angular); +//# sourceMappingURL=angular-resource.min.js.map diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-resource.min.js.map b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-resource.min.js.map new file mode 100755 index 0000000..4cd6e44 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-resource.min.js.map @@ -0,0 +1,8 @@ +{ +"version":3, +"file":"angular-resource.min.js", +"lineCount":11, +"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CAEtC,IAAIC,EAAkBF,CAAAG,SAAA,CAAiB,WAAjB,CA4RtBH,EAAAI,OAAA,CAAe,YAAf,CAA6B,CAAC,IAAD,CAA7B,CAAAC,QAAA,CACU,WADV,CACuB,CAAC,OAAD,CAAU,QAAV,CAAoB,IAApB,CAA0B,QAAQ,CAACC,CAAD,CAAQC,CAAR,CAAgBC,CAAhB,CAAoB,CAwDzEC,QAASA,EAAK,CAACC,CAAD,CAAWC,CAAX,CAAqB,CACjC,IAAAD,SAAA,CAAgBA,CAChB,KAAAC,SAAA,CAAgBA,CAAhB,EAA4B,EAC5B,KAAAC,UAAA,CAAiB,EAHgB,CA+DnCC,QAASA,EAAe,CAACC,CAAD,CAAMC,CAAN,CAAqBC,CAArB,CAA8B,CAKpDC,QAASA,EAAa,CAACC,CAAD,CAAOC,CAAP,CAAoB,CACxC,IAAIC,EAAM,EACVD,EAAA,CAAeE,CAAA,CAAO,EAAP,CAAWN,CAAX,CAA0BI,CAA1B,CACfG,EAAA,CAAQH,CAAR,CAAsB,QAAQ,CAACI,CAAD,CAAQC,CAAR,CAAY,CACpCC,CAAA,CAAWF,CAAX,CAAJ,GAAyBA,CAAzB,CAAiCA,CAAA,EAAjC,CACW,KAAA,CAAAA,EAAA,EAASA,CAAAG,OAAT,EAA4C,GAA5C,EAAyBH,CAAAG,OAAA,CAAa,CAAb,CAAzB,EACT,CApHF,CAoHE,CAAA,OAAA,CAAA,CAAA,CApHF,CAAA,CAAA,CAAOnB,CAAA,CAAOoB,CAAP,CAAA,CAoHLC,CApHK,CAmHI,EACuBL,CADvB,CACuBA,CADlCH,EAAA,CAAII,CAAJ,CAAA,CAAW,CAF6B,CAA1C,CAKA,OAAOJ,EARiC,CAW1CS,QAASA,EAA0B,CAACC,CAAD,CAAW,CAC5C,MAAOA,EAAAC,SADqC,CAI9CC,QAASA,EAAQ,CAACT,CAAD,CAAO,CACtBU,CAAA,CAAKV,CAAL,EAAc,EAAd,CAAkB,IAAlB,CADsB,CAnBxB,IAAIW,EAAQ,IAAIzB,CAAJ,CAAUK,CAAV,CAEZE,EAAA,CAAUK,CAAA,CAAO,EAAP,CAAWc,CAAX,CAA4BnB,CAA5B,CAqBVM,EAAA,CAAQN,CAAR,CAAiB,QAAQ,CAACoB,CAAD,CAASC,CAAT,CAAe,CACtC,IAAIC;AAAU,qBAAAC,KAAA,CAA2BH,CAAAI,OAA3B,CAEdR,EAAA,CAASK,CAAT,CAAA,CAAiB,QAAQ,CAACI,CAAD,CAAKC,CAAL,CAASC,CAAT,CAAaC,CAAb,CAAiB,CAAA,IACpCC,EAAS,EAD2B,CACvB3B,CADuB,CACjB4B,CADiB,CACRC,CAGhC,QAAOC,SAAAC,OAAP,EACA,KAAK,CAAL,CACEF,CACA,CADQH,CACR,CAAAE,CAAA,CAAUH,CAEZ,MAAK,CAAL,CACA,KAAK,CAAL,CACE,GAAIlB,CAAA,CAAWiB,CAAX,CAAJ,CAAoB,CAClB,GAAIjB,CAAA,CAAWgB,CAAX,CAAJ,CAAoB,CAClBK,CAAA,CAAUL,CACVM,EAAA,CAAQL,CACR,MAHkB,CAMpBI,CAAA,CAAUJ,CACVK,EAAA,CAAQJ,CARU,CAApB,IAUO,CACLE,CAAA,CAASJ,CACTvB,EAAA,CAAOwB,CACPI,EAAA,CAAUH,CACV,MAJK,CAMT,KAAK,CAAL,CACMlB,CAAA,CAAWgB,CAAX,CAAJ,CAAoBK,CAApB,CAA8BL,CAA9B,CACSH,CAAJ,CAAapB,CAAb,CAAoBuB,CAApB,CACAI,CADA,CACSJ,CACd,MACF,MAAK,CAAL,CAAQ,KACR,SACE,KAAMvC,EAAA,CAAgB,SAAhB,CAEJ8C,SAAAC,OAFI,CAAN,CA9BF,CAoCA,IAAIC,EAAiBhC,CAAjBgC,WAAiClB,EAArC,CACIT,EAAQ2B,CAAA,CAAiBhC,CAAjB,CAAyBkB,CAAAe,QAAA,CAAiB,EAAjB,CAAsB,IAAInB,CAAJ,CAAad,CAAb,CAD3D,CAEIkC,EAAa,EAFjB,CAGIC,EAAsBjB,CAAAkB,YAAtBD,EAA4CjB,CAAAkB,YAAAxB,SAA5CuB,EACsBxB,CAJ1B,CAKI0B,EAA2BnB,CAAAkB,YAA3BC,EAAiDnB,CAAAkB,YAAAE,cAAjDD,EACsBtD,CAE1BqB,EAAA,CAAQc,CAAR,CAAgB,QAAQ,CAACb,CAAD,CAAQC,CAAR,CAAa,CACxB,QAAX,EAAIA,CAAJ,GAA8B,SAA9B,EAAuBA,CAAvB,EAAkD,aAAlD,EAA2CA,CAA3C,IACE4B,CAAA,CAAW5B,CAAX,CADF,CACoBS,CAAA,CAAKV,CAAL,CADpB,CADmC,CAArC,CAMIe;CAAJ,GAAac,CAAAlC,KAAb,CAA+BA,CAA/B,CACAgB,EAAAuB,aAAA,CAAmBL,CAAnB,CACmB/B,CAAA,CAAO,EAAP,CAAWJ,CAAA,CAAcC,CAAd,CAAoBkB,CAAAS,OAApB,EAAqC,EAArC,CAAX,CAAqDA,CAArD,CADnB,CAEmBT,CAAAtB,IAFnB,CAII4C,EAAAA,CAAUpD,CAAA,CAAM8C,CAAN,CAAAO,KAAA,CAAuB,QAAQ,CAAC7B,CAAD,CAAW,CAAA,IAClDZ,EAAOY,CAAAZ,KAD2C,CAElDwC,EAAUnC,CAAAqC,SAEd,IAAI1C,CAAJ,CAAU,CAGR,GAAKlB,CAAAmD,QAAA,CAAgBjC,CAAhB,CAAL,GAAgC,CAAC,CAACkB,CAAAe,QAAlC,CACE,KAAMjD,EAAA,CAAgB,QAAhB,CAEJkC,CAAAe,QAAA,CAAe,OAAf,CAAuB,QAFnB,CAE6BnD,CAAAmD,QAAA,CAAgBjC,CAAhB,CAAA,CAAsB,OAAtB,CAA8B,QAF3D,CAAN,CAKEkB,CAAAe,QAAJ,EACE5B,CAAA0B,OACA,CADe,CACf,CAAA3B,CAAA,CAAQJ,CAAR,CAAc,QAAQ,CAAC2C,CAAD,CAAO,CAC3BtC,CAAAuC,KAAA,CAAW,IAAI9B,CAAJ,CAAa6B,CAAb,CAAX,CAD2B,CAA7B,CAFF,GAME5B,CAAA,CAAKf,CAAL,CAAWK,CAAX,CACA,CAAAA,CAAAqC,SAAA,CAAiBF,CAPnB,CATQ,CAoBVnC,CAAAwC,UAAA,CAAkB,CAAA,CAElBjC,EAAAC,SAAA,CAAoBR,CAEpB,OAAOO,EA5B+C,CAA1C,CA6BX,QAAQ,CAACA,CAAD,CAAW,CACpBP,CAAAwC,UAAA,CAAkB,CAAA,CAEjB,EAAAhB,CAAA,EAAOiB,CAAP,EAAalC,CAAb,CAED,OAAOtB,EAAAyD,OAAA,CAAUnC,CAAV,CALa,CA7BR,CAqCd4B,EAAA,CAAUA,CAAAC,KAAA,CACN,QAAQ,CAAC7B,CAAD,CAAW,CACjB,IAAIP,EAAQ8B,CAAA,CAAoBvB,CAApB,CACX,EAAAgB,CAAA,EAASkB,CAAT,EAAezC,CAAf,CAAsBO,CAAAoC,QAAtB,CACD,OAAO3C,EAHU,CADb,CAMNgC,CANM,CAQV,OAAKL,EAAL,CAWOQ,CAXP,EAIEnC,CAAAqC,SAGOrC,CAHUmC,CAGVnC,CAFPA,CAAAwC,UAEOxC;AAFW,CAAA,CAEXA,CAAAA,CAPT,CAxGwC,CAuH1CS,EAAAmC,UAAA,CAAmB,GAAnB,CAAyB9B,CAAzB,CAAA,CAAiC,QAAQ,CAACQ,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAAyB,CAC5DtB,CAAA,CAAWoB,CAAX,CAAJ,GACEE,CAAmC,CAA3BD,CAA2B,CAAlBA,CAAkB,CAARD,CAAQ,CAAAA,CAAA,CAAS,EAD9C,CAGIuB,EAAAA,CAASpC,CAAA,CAASK,CAAT,CAAA,CAAeQ,CAAf,CAAuB,IAAvB,CAA6BC,CAA7B,CAAsCC,CAAtC,CACb,OAAOqB,EAAAR,SAAP,EAA0BQ,CALsC,CA1H5B,CAAxC,CAmIApC,EAAAqC,KAAA,CAAgBC,QAAQ,CAACC,CAAD,CAAyB,CAC/C,MAAO1D,EAAA,CAAgBC,CAAhB,CAAqBO,CAAA,CAAO,EAAP,CAAWN,CAAX,CAA0BwD,CAA1B,CAArB,CAAyEvD,CAAzE,CADwC,CAIjD,OAAOgB,EA/J6C,CAtHtD,IAAIG,EAAkB,KACV,QAAQ,KAAR,CADU,MAEV,QAAQ,MAAR,CAFU,OAGV,QAAQ,KAAR,SAAuB,CAAA,CAAvB,CAHU,QAIV,QAAQ,QAAR,CAJU,CAKpB,QALoB,CAKV,QAAQ,QAAR,CALU,CAAtB,CAOI6B,EAAOhE,CAAAgE,KAPX,CAQI1C,EAAUtB,CAAAsB,QARd,CASID,EAASrB,CAAAqB,OATb,CAUIY,EAAOjC,CAAAiC,KAVX,CAWIR,EAAazB,CAAAyB,WAkDjBhB,EAAA0D,UAAA,CAAkB,cACFV,QAAQ,CAACe,CAAD,CAAS3B,CAAT,CAAiB4B,CAAjB,CAA4B,CAAA,IAC5CC,EAAO,IADqC,CAE5C5D,EAAM2D,CAAN3D,EAAmB4D,CAAAhE,SAFyB,CAG5CiE,CAH4C,CAI5CC,CAJ4C,CAM5ChE,EAAY8D,CAAA9D,UAAZA,CAA6B,EACjCU,EAAA,CAAQR,CAAA+D,MAAA,CAAU,IAAV,CAAR,CAAyB,QAAQ,CAACC,CAAD,CAAO,CACtC,GAAc,gBAAd,GAAIA,CAAJ,CACE,KAAM5E,EAAA,CAAgB,SAAhB,CAAN;AAEI,CAAA,OAAAqC,KAAA,CAA0BuC,CAA1B,CAAN,GAA2CA,CAA3C,EACUC,MAAJ,CAAW,cAAX,CAA4BD,CAA5B,CAAoC,SAApC,CAAAvC,KAAA,CAAoDzB,CAApD,CADN,IAEEF,CAAA,CAAUkE,CAAV,CAFF,CAEqB,CAAA,CAFrB,CAJsC,CAAxC,CASAhE,EAAA,CAAMA,CAAAkE,QAAA,CAAY,MAAZ,CAAoB,GAApB,CAENnC,EAAA,CAASA,CAAT,EAAmB,EACnBvB,EAAA,CAAQoD,CAAA9D,UAAR,CAAwB,QAAQ,CAACqE,CAAD,CAAIC,CAAJ,CAAa,CAC3CP,CAAA,CAAM9B,CAAAsC,eAAA,CAAsBD,CAAtB,CAAA,CAAkCrC,CAAA,CAAOqC,CAAP,CAAlC,CAAqDR,CAAA/D,SAAA,CAAcuE,CAAd,CACvDlF,EAAAoF,UAAA,CAAkBT,CAAlB,CAAJ,EAAsC,IAAtC,GAA8BA,CAA9B,EACEC,CACA,CAtCCS,kBAAA,CAqC6BV,CArC7B,CAAAK,QAAA,CACG,OADH,CACY,GADZ,CAAAA,QAAA,CAEG,OAFH,CAEY,GAFZ,CAAAA,QAAA,CAGG,MAHH,CAGW,GAHX,CAAAA,QAAA,CAIG,OAJH,CAIY,GAJZ,CAAAA,QAAA,CAKG,MALH,CAK8B,KAL9B,CAnBAA,QAAA,CACG,OADH,CACY,GADZ,CAAAA,QAAA,CAEG,OAFH,CAEY,GAFZ,CAAAA,QAAA,CAGG,OAHH,CAGY,GAHZ,CAyDD,CAAAlE,CAAA,CAAMA,CAAAkE,QAAA,CAAgBD,MAAJ,CAAW,GAAX,CAAiBG,CAAjB,CAA4B,SAA5B,CAAuC,GAAvC,CAAZ,CAAyDN,CAAzD,CAAsE,IAAtE,CAFR,EAIE9D,CAJF,CAIQA,CAAAkE,QAAA,CAAgBD,MAAJ,CAAW,OAAX,CAAsBG,CAAtB,CAAiC,SAAjC,CAA4C,GAA5C,CAAZ,CAA8D,QAAQ,CAACI,CAAD;AACxEC,CADwE,CACxDC,CADwD,CAClD,CACxB,MAAsB,GAAtB,EAAIA,CAAA9D,OAAA,CAAY,CAAZ,CAAJ,CACS8D,CADT,CAGSD,CAHT,CAG0BC,CAJF,CADpB,CANmC,CAA7C,CAkBA1E,EAAA,CAAMA,CAAAkE,QAAA,CAAY,MAAZ,CAAoB,EAApB,CAGNlE,EAAA,CAAMA,CAAAkE,QAAA,CAAY,mBAAZ,CAAiC,GAAjC,CAENR,EAAA1D,IAAA,CAAaA,CAAAkE,QAAA,CAAY,QAAZ,CAAsB,IAAtB,CAIb1D,EAAA,CAAQuB,CAAR,CAAgB,QAAQ,CAACtB,CAAD,CAAQC,CAAR,CAAY,CAC7BkD,CAAA9D,UAAA,CAAeY,CAAf,CAAL,GACEgD,CAAA3B,OACA,CADgB2B,CAAA3B,OAChB,EADiC,EACjC,CAAA2B,CAAA3B,OAAA,CAAcrB,CAAd,CAAA,CAAqBD,CAFvB,CADkC,CAApC,CA9CgD,CADlC,CA2NlB,OAAOV,EAzRkE,CAAtD,CADvB,CA9RsC,CAArC,CAAA,CA4jBEd,MA5jBF,CA4jBUA,MAAAC,QA5jBV;", +"sources":["angular-resource.js"], +"names":["window","angular","undefined","$resourceMinErr","$$minErr","module","factory","$http","$parse","$q","Route","template","defaults","urlParams","resourceFactory","url","paramDefaults","actions","extractParams","data","actionParams","ids","extend","forEach","value","key","isFunction","charAt","path","obj","defaultResponseInterceptor","response","resource","Resource","copy","route","DEFAULT_ACTIONS","action","name","hasBody","test","method","a1","a2","a3","a4","params","success","error","arguments","length","isInstanceCall","isArray","httpConfig","responseInterceptor","interceptor","responseErrorInterceptor","responseError","setUrlParams","promise","then","$promise","item","push","$resolved","noop","reject","headers","prototype","result","bind","Resource.bind","additionalParamDefaults","config","actionUrl","self","val","encodedVal","split","param","RegExp","replace","_","urlParam","hasOwnProperty","isDefined","encodeURIComponent","match","leadingSlashes","tail"] +} diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-route.js b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-route.js new file mode 100755 index 0000000..b3b4ccf --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-route.js @@ -0,0 +1,880 @@ +/** + * @license AngularJS v1.2.0 + * (c) 2010-2012 Google, Inc. http://angularjs.org + * License: MIT + */ +(function(window, angular, undefined) {'use strict'; + +/** + * @ngdoc overview + * @name ngRoute + * @description + * + * # ngRoute + * + * The `ngRoute` module provides routing and deeplinking services and directives for angular apps. + * + * {@installModule route} + * + *
+ */ + /* global -ngRouteModule */ +var ngRouteModule = angular.module('ngRoute', ['ng']). + provider('$route', $RouteProvider); + +/** + * @ngdoc object + * @name ngRoute.$routeProvider + * @function + * + * @description + * + * Used for configuring routes. See {@link ngRoute.$route $route} for an example. + * + * Requires the {@link ngRoute `ngRoute`} module to be installed. + */ +function $RouteProvider(){ + function inherit(parent, extra) { + return angular.extend(new (angular.extend(function() {}, {prototype:parent}))(), extra); + } + + var routes = {}; + + /** + * @ngdoc method + * @name ngRoute.$routeProvider#when + * @methodOf ngRoute.$routeProvider + * + * @param {string} path Route path (matched against `$location.path`). If `$location.path` + * contains redundant trailing slash or is missing one, the route will still match and the + * `$location.path` will be updated to add or drop the trailing slash to exactly match the + * route definition. + * + * * `path` can contain named groups starting with a colon (`:name`). All characters up + * to the next slash are matched and stored in `$routeParams` under the given `name` + * when the route matches. + * * `path` can contain named groups starting with a colon and ending with a star (`:name*`). + * All characters are eagerly stored in `$routeParams` under the given `name` + * when the route matches. + * * `path` can contain optional named groups with a question mark (`:name?`). + * + * For example, routes like `/color/:color/largecode/:largecode*\/edit` will match + * `/color/brown/largecode/code/with/slashs/edit` and extract: + * + * * `color: brown` + * * `largecode: code/with/slashs`. + * + * + * @param {Object} route Mapping information to be assigned to `$route.current` on route + * match. + * + * Object properties: + * + * - `controller` – `{(string|function()=}` – Controller fn that should be associated with + * newly created scope or the name of a {@link angular.Module#controller registered + * controller} if passed as a string. + * - `controllerAs` – `{string=}` – A controller alias name. If present the controller will be + * published to scope under the `controllerAs` name. + * - `template` – `{string=|function()=}` – html template as a string or a function that + * returns an html template as a string which should be used by {@link + * ngRoute.directive:ngView ngView} or {@link ng.directive:ngInclude ngInclude} directives. + * This property takes precedence over `templateUrl`. + * + * If `template` is a function, it will be called with the following parameters: + * + * - `{Array.}` - route parameters extracted from the current + * `$location.path()` by applying the current route + * + * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html + * template that should be used by {@link ngRoute.directive:ngView ngView}. + * + * If `templateUrl` is a function, it will be called with the following parameters: + * + * - `{Array.}` - route parameters extracted from the current + * `$location.path()` by applying the current route + * + * - `resolve` - `{Object.=}` - An optional map of dependencies which should + * be injected into the controller. If any of these dependencies are promises, the router + * will wait for them all to be resolved or one to be rejected before the controller is + * instantiated. + * If all the promises are resolved successfully, the values of the resolved promises are + * injected and {@link ngRoute.$route#$routeChangeSuccess $routeChangeSuccess} event is + * fired. If any of the promises are rejected the + * {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired. The map object + * is: + * + * - `key` – `{string}`: a name of a dependency to be injected into the controller. + * - `factory` - `{string|function}`: If `string` then it is an alias for a service. + * Otherwise if function, then it is {@link api/AUTO.$injector#invoke injected} + * and the return value is treated as the dependency. If the result is a promise, it is + * resolved before its value is injected into the controller. Be aware that + * `ngRoute.$routeParams` will still refer to the previous route within these resolve + * functions. Use `$route.current.params` to access the new route parameters, instead. + * + * - `redirectTo` – {(string|function())=} – value to update + * {@link ng.$location $location} path with and trigger route redirection. + * + * If `redirectTo` is a function, it will be called with the following parameters: + * + * - `{Object.}` - route parameters extracted from the current + * `$location.path()` by applying the current route templateUrl. + * - `{string}` - current `$location.path()` + * - `{Object}` - current `$location.search()` + * + * The custom `redirectTo` function is expected to return a string which will be used + * to update `$location.path()` and `$location.search()`. + * + * - `[reloadOnSearch=true]` - {boolean=} - reload route when only `$location.search()` + * or `$location.hash()` changes. + * + * If the option is set to `false` and url in the browser changes, then + * `$routeUpdate` event is broadcasted on the root scope. + * + * - `[caseInsensitiveMatch=false]` - {boolean=} - match routes without being case sensitive + * + * If the option is set to `true`, then the particular route can be matched without being + * case sensitive + * + * @returns {Object} self + * + * @description + * Adds a new route definition to the `$route` service. + */ + this.when = function(path, route) { + routes[path] = angular.extend( + {reloadOnSearch: true}, + route, + path && pathRegExp(path, route) + ); + + // create redirection for trailing slashes + if (path) { + var redirectPath = (path[path.length-1] == '/') + ? path.substr(0, path.length-1) + : path +'/'; + + routes[redirectPath] = angular.extend( + {redirectTo: path}, + pathRegExp(redirectPath, route) + ); + } + + return this; + }; + + /** + * @param path {string} path + * @param opts {Object} options + * @return {?Object} + * + * @description + * Normalizes the given path, returning a regular expression + * and the original path. + * + * Inspired by pathRexp in visionmedia/express/lib/utils.js. + */ + function pathRegExp(path, opts) { + var insensitive = opts.caseInsensitiveMatch, + ret = { + originalPath: path, + regexp: path + }, + keys = ret.keys = []; + + path = path + .replace(/([().])/g, '\\$1') + .replace(/(\/)?:(\w+)([\?|\*])?/g, function(_, slash, key, option){ + var optional = option === '?' ? option : null; + var star = option === '*' ? option : null; + keys.push({ name: key, optional: !!optional }); + slash = slash || ''; + return '' + + (optional ? '' : slash) + + '(?:' + + (optional ? slash : '') + + (star && '(.+?)' || '([^/]+)') + + (optional || '') + + ')' + + (optional || ''); + }) + .replace(/([\/$\*])/g, '\\$1'); + + ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : ''); + return ret; + } + + /** + * @ngdoc method + * @name ngRoute.$routeProvider#otherwise + * @methodOf ngRoute.$routeProvider + * + * @description + * Sets route definition that will be used on route change when no other route definition + * is matched. + * + * @param {Object} params Mapping information to be assigned to `$route.current`. + * @returns {Object} self + */ + this.otherwise = function(params) { + this.when(null, params); + return this; + }; + + + this.$get = ['$rootScope', + '$location', + '$routeParams', + '$q', + '$injector', + '$http', + '$templateCache', + '$sce', + function($rootScope, $location, $routeParams, $q, $injector, $http, $templateCache, $sce) { + + /** + * @ngdoc object + * @name ngRoute.$route + * @requires $location + * @requires $routeParams + * + * @property {Object} current Reference to the current route definition. + * The route definition contains: + * + * - `controller`: The controller constructor as define in route definition. + * - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for + * controller instantiation. The `locals` contain + * the resolved values of the `resolve` map. Additionally the `locals` also contain: + * + * - `$scope` - The current route scope. + * - `$template` - The current route template HTML. + * + * @property {Array.} routes Array of all configured routes. + * + * @description + * `$route` is used for deep-linking URLs to controllers and views (HTML partials). + * It watches `$location.url()` and tries to map the path to an existing route definition. + * + * Requires the {@link ngRoute `ngRoute`} module to be installed. + * + * You can define routes through {@link ngRoute.$routeProvider $routeProvider}'s API. + * + * The `$route` service is typically used in conjunction with the + * {@link ngRoute.directive:ngView `ngView`} directive and the + * {@link ngRoute.$routeParams `$routeParams`} service. + * + * @example + This example shows how changing the URL hash causes the `$route` to match a route against the + URL, and the `ngView` pulls in the partial. + + Note that this example is using {@link ng.directive:script inlined templates} + to get it working on jsfiddle as well. + + + +
+ Choose: + Moby | + Moby: Ch1 | + Gatsby | + Gatsby: Ch4 | + Scarlet Letter
+ +
+
+ +
$location.path() = {{$location.path()}}
+
$route.current.templateUrl = {{$route.current.templateUrl}}
+
$route.current.params = {{$route.current.params}}
+
$route.current.scope.name = {{$route.current.scope.name}}
+
$routeParams = {{$routeParams}}
+
+
+ + + controller: {{name}}
+ Book Id: {{params.bookId}}
+
+ + + controller: {{name}}
+ Book Id: {{params.bookId}}
+ Chapter Id: {{params.chapterId}} +
+ + + angular.module('ngViewExample', ['ngRoute']) + + .config(function($routeProvider, $locationProvider) { + $routeProvider.when('/Book/:bookId', { + templateUrl: 'book.html', + controller: BookCntl, + resolve: { + // I will cause a 1 second delay + delay: function($q, $timeout) { + var delay = $q.defer(); + $timeout(delay.resolve, 1000); + return delay.promise; + } + } + }); + $routeProvider.when('/Book/:bookId/ch/:chapterId', { + templateUrl: 'chapter.html', + controller: ChapterCntl + }); + + // configure html5 to get links working on jsfiddle + $locationProvider.html5Mode(true); + }); + + function MainCntl($scope, $route, $routeParams, $location) { + $scope.$route = $route; + $scope.$location = $location; + $scope.$routeParams = $routeParams; + } + + function BookCntl($scope, $routeParams) { + $scope.name = "BookCntl"; + $scope.params = $routeParams; + } + + function ChapterCntl($scope, $routeParams) { + $scope.name = "ChapterCntl"; + $scope.params = $routeParams; + } + + + + it('should load and compile correct template', function() { + element('a:contains("Moby: Ch1")').click(); + var content = element('.doc-example-live [ng-view]').text(); + expect(content).toMatch(/controller\: ChapterCntl/); + expect(content).toMatch(/Book Id\: Moby/); + expect(content).toMatch(/Chapter Id\: 1/); + + element('a:contains("Scarlet")').click(); + sleep(2); // promises are not part of scenario waiting + content = element('.doc-example-live [ng-view]').text(); + expect(content).toMatch(/controller\: BookCntl/); + expect(content).toMatch(/Book Id\: Scarlet/); + }); + +
+ */ + + /** + * @ngdoc event + * @name ngRoute.$route#$routeChangeStart + * @eventOf ngRoute.$route + * @eventType broadcast on root scope + * @description + * Broadcasted before a route change. At this point the route services starts + * resolving all of the dependencies needed for the route change to occurs. + * Typically this involves fetching the view template as well as any dependencies + * defined in `resolve` route property. Once all of the dependencies are resolved + * `$routeChangeSuccess` is fired. + * + * @param {Object} angularEvent Synthetic event object. + * @param {Route} next Future route information. + * @param {Route} current Current route information. + */ + + /** + * @ngdoc event + * @name ngRoute.$route#$routeChangeSuccess + * @eventOf ngRoute.$route + * @eventType broadcast on root scope + * @description + * Broadcasted after a route dependencies are resolved. + * {@link ngRoute.directive:ngView ngView} listens for the directive + * to instantiate the controller and render the view. + * + * @param {Object} angularEvent Synthetic event object. + * @param {Route} current Current route information. + * @param {Route|Undefined} previous Previous route information, or undefined if current is + * first route entered. + */ + + /** + * @ngdoc event + * @name ngRoute.$route#$routeChangeError + * @eventOf ngRoute.$route + * @eventType broadcast on root scope + * @description + * Broadcasted if any of the resolve promises are rejected. + * + * @param {Object} angularEvent Synthetic event object + * @param {Route} current Current route information. + * @param {Route} previous Previous route information. + * @param {Route} rejection Rejection of the promise. Usually the error of the failed promise. + */ + + /** + * @ngdoc event + * @name ngRoute.$route#$routeUpdate + * @eventOf ngRoute.$route + * @eventType broadcast on root scope + * @description + * + * The `reloadOnSearch` property has been set to false, and we are reusing the same + * instance of the Controller. + */ + + var forceReload = false, + $route = { + routes: routes, + + /** + * @ngdoc method + * @name ngRoute.$route#reload + * @methodOf ngRoute.$route + * + * @description + * Causes `$route` service to reload the current route even if + * {@link ng.$location $location} hasn't changed. + * + * As a result of that, {@link ngRoute.directive:ngView ngView} + * creates new scope, reinstantiates the controller. + */ + reload: function() { + forceReload = true; + $rootScope.$evalAsync(updateRoute); + } + }; + + $rootScope.$on('$locationChangeSuccess', updateRoute); + + return $route; + + ///////////////////////////////////////////////////// + + /** + * @param on {string} current url + * @param route {Object} route regexp to match the url against + * @return {?Object} + * + * @description + * Check if the route matches the current url. + * + * Inspired by match in + * visionmedia/express/lib/router/router.js. + */ + function switchRouteMatcher(on, route) { + var keys = route.keys, + params = {}; + + if (!route.regexp) return null; + + var m = route.regexp.exec(on); + if (!m) return null; + + for (var i = 1, len = m.length; i < len; ++i) { + var key = keys[i - 1]; + + var val = 'string' == typeof m[i] + ? decodeURIComponent(m[i]) + : m[i]; + + if (key && val) { + params[key.name] = val; + } + } + return params; + } + + function updateRoute() { + var next = parseRoute(), + last = $route.current; + + if (next && last && next.$$route === last.$$route + && angular.equals(next.pathParams, last.pathParams) + && !next.reloadOnSearch && !forceReload) { + last.params = next.params; + angular.copy(last.params, $routeParams); + $rootScope.$broadcast('$routeUpdate', last); + } else if (next || last) { + forceReload = false; + $rootScope.$broadcast('$routeChangeStart', next, last); + $route.current = next; + if (next) { + if (next.redirectTo) { + if (angular.isString(next.redirectTo)) { + $location.path(interpolate(next.redirectTo, next.params)).search(next.params) + .replace(); + } else { + $location.url(next.redirectTo(next.pathParams, $location.path(), $location.search())) + .replace(); + } + } + } + + $q.when(next). + then(function() { + if (next) { + var locals = angular.extend({}, next.resolve), + template, templateUrl; + + angular.forEach(locals, function(value, key) { + locals[key] = angular.isString(value) ? + $injector.get(value) : $injector.invoke(value); + }); + + if (angular.isDefined(template = next.template)) { + if (angular.isFunction(template)) { + template = template(next.params); + } + } else if (angular.isDefined(templateUrl = next.templateUrl)) { + if (angular.isFunction(templateUrl)) { + templateUrl = templateUrl(next.params); + } + templateUrl = $sce.getTrustedResourceUrl(templateUrl); + if (angular.isDefined(templateUrl)) { + next.loadedTemplateUrl = templateUrl; + template = $http.get(templateUrl, {cache: $templateCache}). + then(function(response) { return response.data; }); + } + } + if (angular.isDefined(template)) { + locals['$template'] = template; + } + return $q.all(locals); + } + }). + // after route change + then(function(locals) { + if (next == $route.current) { + if (next) { + next.locals = locals; + angular.copy(next.params, $routeParams); + } + $rootScope.$broadcast('$routeChangeSuccess', next, last); + } + }, function(error) { + if (next == $route.current) { + $rootScope.$broadcast('$routeChangeError', next, last, error); + } + }); + } + } + + + /** + * @returns the current active route, by matching it against the URL + */ + function parseRoute() { + // Match a route + var params, match; + angular.forEach(routes, function(route, path) { + if (!match && (params = switchRouteMatcher($location.path(), route))) { + match = inherit(route, { + params: angular.extend({}, $location.search(), params), + pathParams: params}); + match.$$route = route; + } + }); + // No route matched; fallback to "otherwise" route + return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}}); + } + + /** + * @returns interpolation of the redirect path with the parameters + */ + function interpolate(string, params) { + var result = []; + angular.forEach((string||'').split(':'), function(segment, i) { + if (i === 0) { + result.push(segment); + } else { + var segmentMatch = segment.match(/(\w+)(.*)/); + var key = segmentMatch[1]; + result.push(params[key]); + result.push(segmentMatch[2] || ''); + delete params[key]; + } + }); + return result.join(''); + } + }]; +} + +ngRouteModule.provider('$routeParams', $RouteParamsProvider); + + +/** + * @ngdoc object + * @name ngRoute.$routeParams + * @requires $route + * + * @description + * The `$routeParams` service allows you to retrieve the current set of route parameters. + * + * Requires the {@link ngRoute `ngRoute`} module to be installed. + * + * The route parameters are a combination of {@link ng.$location `$location`}'s + * {@link ng.$location#methods_search `search()`} and {@link ng.$location#methods_path `path()`}. + * The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched. + * + * In case of parameter name collision, `path` params take precedence over `search` params. + * + * The service guarantees that the identity of the `$routeParams` object will remain unchanged + * (but its properties will likely change) even when a route change occurs. + * + * Note that the `$routeParams` are only updated *after* a route change completes successfully. + * This means that you cannot rely on `$routeParams` being correct in route resolve functions. + * Instead you can use `$route.current.params` to access the new route's parameters. + * + * @example + *
+ *  // Given:
+ *  // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
+ *  // Route: /Chapter/:chapterId/Section/:sectionId
+ *  //
+ *  // Then
+ *  $routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
+ * 
+ */ +function $RouteParamsProvider() { + this.$get = function() { return {}; }; +} + +ngRouteModule.directive('ngView', ngViewFactory); + +/** + * @ngdoc directive + * @name ngRoute.directive:ngView + * @restrict ECA + * + * @description + * # Overview + * `ngView` is a directive that complements the {@link ngRoute.$route $route} service by + * including the rendered template of the current route into the main layout (`index.html`) file. + * Every time the current route changes, the included view changes with it according to the + * configuration of the `$route` service. + * + * Requires the {@link ngRoute `ngRoute`} module to be installed. + * + * @animations + * enter - animation is used to bring new content into the browser. + * leave - animation is used to animate existing content away. + * + * The enter and leave animation occur concurrently. + * + * @scope + * @priority 400 + * @example + + +
+ Choose: + Moby | + Moby: Ch1 | + Gatsby | + Gatsby: Ch4 | + Scarlet Letter
+ +
+
+
+
+ +
$location.path() = {{main.$location.path()}}
+
$route.current.templateUrl = {{main.$route.current.templateUrl}}
+
$route.current.params = {{main.$route.current.params}}
+
$route.current.scope.name = {{main.$route.current.scope.name}}
+
$routeParams = {{main.$routeParams}}
+
+
+ + +
+ controller: {{book.name}}
+ Book Id: {{book.params.bookId}}
+
+
+ + +
+ controller: {{chapter.name}}
+ Book Id: {{chapter.params.bookId}}
+ Chapter Id: {{chapter.params.chapterId}} +
+
+ + + .view-animate-container { + position:relative; + height:100px!important; + position:relative; + background:white; + border:1px solid black; + height:40px; + overflow:hidden; + } + + .view-animate { + padding:10px; + } + + .view-animate.ng-enter, .view-animate.ng-leave { + -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; + transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; + + display:block; + width:100%; + border-left:1px solid black; + + position:absolute; + top:0; + left:0; + right:0; + bottom:0; + padding:10px; + } + + .view-animate.ng-enter { + left:100%; + } + .view-animate.ng-enter.ng-enter-active { + left:0; + } + .view-animate.ng-leave.ng-leave-active { + left:-100%; + } + + + + angular.module('ngViewExample', ['ngRoute', 'ngAnimate'], + function($routeProvider, $locationProvider) { + $routeProvider.when('/Book/:bookId', { + templateUrl: 'book.html', + controller: BookCntl, + controllerAs: 'book' + }); + $routeProvider.when('/Book/:bookId/ch/:chapterId', { + templateUrl: 'chapter.html', + controller: ChapterCntl, + controllerAs: 'chapter' + }); + + // configure html5 to get links working on jsfiddle + $locationProvider.html5Mode(true); + }); + + function MainCntl($route, $routeParams, $location) { + this.$route = $route; + this.$location = $location; + this.$routeParams = $routeParams; + } + + function BookCntl($routeParams) { + this.name = "BookCntl"; + this.params = $routeParams; + } + + function ChapterCntl($routeParams) { + this.name = "ChapterCntl"; + this.params = $routeParams; + } + + + + it('should load and compile correct template', function() { + element('a:contains("Moby: Ch1")').click(); + var content = element('.doc-example-live [ng-view]').text(); + expect(content).toMatch(/controller\: ChapterCntl/); + expect(content).toMatch(/Book Id\: Moby/); + expect(content).toMatch(/Chapter Id\: 1/); + + element('a:contains("Scarlet")').click(); + content = element('.doc-example-live [ng-view]').text(); + expect(content).toMatch(/controller\: BookCntl/); + expect(content).toMatch(/Book Id\: Scarlet/); + }); + +
+ */ + + +/** + * @ngdoc event + * @name ngRoute.directive:ngView#$viewContentLoaded + * @eventOf ngRoute.directive:ngView + * @eventType emit on the current ngView scope + * @description + * Emitted every time the ngView content is reloaded. + */ +ngViewFactory.$inject = ['$route', '$anchorScroll', '$compile', '$controller', '$animate']; +function ngViewFactory( $route, $anchorScroll, $compile, $controller, $animate) { + return { + restrict: 'ECA', + terminal: true, + priority: 400, + transclude: 'element', + compile: function(element, attr, linker) { + return function(scope, $element, attr) { + var currentScope, + currentElement, + autoScrollExp = attr.autoscroll, + onloadExp = attr.onload || ''; + + scope.$on('$routeChangeSuccess', update); + update(); + + function cleanupLastView() { + if (currentScope) { + currentScope.$destroy(); + currentScope = null; + } + if(currentElement) { + $animate.leave(currentElement); + currentElement = null; + } + } + + function update() { + var locals = $route.current && $route.current.locals, + template = locals && locals.$template; + + if (template) { + var newScope = scope.$new(); + linker(newScope, function(clone) { + clone.html(template); + $animate.enter(clone, null, currentElement || $element, function onNgViewEnter () { + if (angular.isDefined(autoScrollExp) + && (!autoScrollExp || scope.$eval(autoScrollExp))) { + $anchorScroll(); + } + }); + + cleanupLastView(); + + var link = $compile(clone.contents()), + current = $route.current; + + currentScope = current.scope = newScope; + currentElement = clone; + + if (current.controller) { + locals.$scope = currentScope; + var controller = $controller(current.controller, locals); + if (current.controllerAs) { + currentScope[current.controllerAs] = controller; + } + clone.data('$ngControllerController', controller); + clone.children().data('$ngControllerController', controller); + } + + link(currentScope); + currentScope.$emit('$viewContentLoaded'); + currentScope.$eval(onloadExp); + }); + } else { + cleanupLastView(); + } + } + }; + } + }; +} + + +})(window, window.angular); diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-route.min.js b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-route.min.js new file mode 100755 index 0000000..efdc1a2 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-route.min.js @@ -0,0 +1,14 @@ +/* + AngularJS v1.2.0 + (c) 2010-2012 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(t,c,B){'use strict';function w(s,r,g,a,h){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(k,d,A){return function(u,k,d){function v(){l&&(l.$destroy(),l=null);m&&(h.leave(m),m=null)}function x(){var f=s.current&&s.current.locals,y=f&&f.$template;if(y){var z=u.$new();A(z,function(e){e.html(y);h.enter(e,null,m||k,function(){!c.isDefined(n)||n&&!u.$eval(n)||r()});v();var p=g(e.contents()),q=s.current;l=q.scope=z;m=e;if(q.controller){f.$scope=l;var d=a(q.controller, +f);q.controllerAs&&(l[q.controllerAs]=d);e.data("$ngControllerController",d);e.children().data("$ngControllerController",d)}p(l);l.$emit("$viewContentLoaded");l.$eval(b)})}else v()}var l,m,n=d.autoscroll,b=d.onload||"";u.$on("$routeChangeSuccess",x);x()}}}}t=c.module("ngRoute",["ng"]).provider("$route",function(){function s(a,h){return c.extend(new (c.extend(function(){},{prototype:a})),h)}function r(a,c){var k=c.caseInsensitiveMatch,d={originalPath:a,regexp:a},g=d.keys=[];a=a.replace(/([().])/g, +"\\$1").replace(/(\/)?:(\w+)([\?|\*])?/g,function(a,c,h,d){a="?"===d?d:null;d="*"===d?d:null;g.push({name:h,optional:!!a});c=c||"";return""+(a?"":c)+"(?:"+(a?c:"")+(d&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([\/$\*])/g,"\\$1");d.regexp=RegExp("^"+a+"$",k?"i":"");return d}var g={};this.when=function(a,h){g[a]=c.extend({reloadOnSearch:!0},h,a&&r(a,h));if(a){var k="/"==a[a.length-1]?a.substr(0,a.length-1):a+"/";g[k]=c.extend({redirectTo:a},r(k,h))}return this};this.otherwise=function(a){this.when(null, +a);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$http","$templateCache","$sce",function(a,h,k,d,r,u,t,w){function v(){var b=x(),f=n.current;if(b&&f&&b.$$route===f.$$route&&c.equals(b.pathParams,f.pathParams)&&!b.reloadOnSearch&&!m)f.params=b.params,c.copy(f.params,k),a.$broadcast("$routeUpdate",f);else if(b||f)m=!1,a.$broadcast("$routeChangeStart",b,f),(n.current=b)&&b.redirectTo&&(c.isString(b.redirectTo)?h.path(l(b.redirectTo,b.params)).search(b.params).replace(): +h.url(b.redirectTo(b.pathParams,h.path(),h.search())).replace()),d.when(b).then(function(){if(b){var a=c.extend({},b.resolve),f,e;c.forEach(a,function(b,f){a[f]=c.isString(b)?r.get(b):r.invoke(b)});c.isDefined(f=b.template)?c.isFunction(f)&&(f=f(b.params)):c.isDefined(e=b.templateUrl)&&(c.isFunction(e)&&(e=e(b.params)),e=w.getTrustedResourceUrl(e),c.isDefined(e)&&(b.loadedTemplateUrl=e,f=u.get(e,{cache:t}).then(function(b){return b.data})));c.isDefined(f)&&(a.$template=f);return d.all(a)}}).then(function(d){b== +n.current&&(b&&(b.locals=d,c.copy(b.params,k)),a.$broadcast("$routeChangeSuccess",b,f))},function(c){b==n.current&&a.$broadcast("$routeChangeError",b,f,c)})}function x(){var b,a;c.forEach(g,function(d,l){var e;if(e=!a){var p=h.path();e=d.keys;var q={};if(d.regexp)if(p=d.regexp.exec(p)){for(var g=1,k=p.length;g + * + * See {@link ngSanitize.$sanitize `$sanitize`} for usage. + */ + +/* + * HTML Parser By Misko Hevery (misko@hevery.com) + * based on: HTML Parser By John Resig (ejohn.org) + * Original code by Erik Arvidsson, Mozilla Public License + * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js + * + * // Use like so: + * htmlParser(htmlString, { + * start: function(tag, attrs, unary) {}, + * end: function(tag) {}, + * chars: function(text) {}, + * comment: function(text) {} + * }); + * + */ + + +/** + * @ngdoc service + * @name ngSanitize.$sanitize + * @function + * + * @description + * The input is sanitized by parsing the html into tokens. All safe tokens (from a whitelist) are + * then serialized back to properly escaped html string. This means that no unsafe input can make + * it into the returned string, however, since our parser is more strict than a typical browser + * parser, it's possible that some obscure input, which would be recognized as valid HTML by a + * browser, won't make it through the sanitizer. + * + * @param {string} html Html input. + * @returns {string} Sanitized html. + * + * @example + + + +
+ Snippet: + + + + + + + + + + + + + + + + + + + + + + + + + +
DirectiveHowSourceRendered
ng-bind-htmlAutomatically uses $sanitize
<div ng-bind-html="snippet">
</div>
ng-bind-htmlBypass $sanitize by explicitly trusting the dangerous value +
<div ng-bind-html="deliberatelyTrustDangerousSnippet()">
+</div>
+
ng-bindAutomatically escapes
<div ng-bind="snippet">
</div>
+
+
+ + it('should sanitize the html snippet by default', function() { + expect(using('#bind-html-with-sanitize').element('div').html()). + toBe('

an html\nclick here\nsnippet

'); + }); + + it('should inline raw snippet if bound to a trusted value', function() { + expect(using('#bind-html-with-trust').element("div").html()). + toBe("

an html\n" + + "click here\n" + + "snippet

"); + }); + + it('should escape snippet without any filter', function() { + expect(using('#bind-default').element('div').html()). + toBe("<p style=\"color:blue\">an html\n" + + "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" + + "snippet</p>"); + }); + + it('should update', function() { + input('snippet').enter('new text'); + expect(using('#bind-html-with-sanitize').element('div').html()).toBe('new text'); + expect(using('#bind-html-with-trust').element('div').html()).toBe( + 'new text'); + expect(using('#bind-default').element('div').html()).toBe( + "new <b onclick=\"alert(1)\">text</b>"); + }); +
+
+ */ +var $sanitize = function(html) { + var buf = []; + htmlParser(html, htmlSanitizeWriter(buf)); + return buf.join(''); +}; + + +// Regular Expressions for parsing tags and attributes +var START_TAG_REGEXP = + /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/, + END_TAG_REGEXP = /^<\s*\/\s*([\w:-]+)[^>]*>/, + ATTR_REGEXP = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g, + BEGIN_TAG_REGEXP = /^/g, + DOCTYPE_REGEXP = /]*?)>/i, + CDATA_REGEXP = //g, + URI_REGEXP = /^((ftp|https?):\/\/|mailto:|tel:|#)/i, + // Match everything outside of normal chars and " (quote character) + NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g; + + +// Good source of info about elements and attributes +// http://dev.w3.org/html5/spec/Overview.html#semantics +// http://simon.html5.org/html-elements + +// Safe Void Elements - HTML5 +// http://dev.w3.org/html5/spec/Overview.html#void-elements +var voidElements = makeMap("area,br,col,hr,img,wbr"); + +// Elements that you can, intentionally, leave open (and which close themselves) +// http://dev.w3.org/html5/spec/Overview.html#optional-tags +var optionalEndTagBlockElements = makeMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"), + optionalEndTagInlineElements = makeMap("rp,rt"), + optionalEndTagElements = angular.extend({}, + optionalEndTagInlineElements, + optionalEndTagBlockElements); + +// Safe Block Elements - HTML5 +var blockElements = angular.extend({}, optionalEndTagBlockElements, makeMap("address,article," + + "aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," + + "h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")); + +// Inline Elements - HTML5 +var inlineElements = angular.extend({}, optionalEndTagInlineElements, makeMap("a,abbr,acronym,b," + + "bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," + + "samp,small,span,strike,strong,sub,sup,time,tt,u,var")); + + +// Special Elements (can contain anything) +var specialElements = makeMap("script,style"); + +var validElements = angular.extend({}, + voidElements, + blockElements, + inlineElements, + optionalEndTagElements); + +//Attributes that have href and hence need to be sanitized +var uriAttrs = makeMap("background,cite,href,longdesc,src,usemap"); +var validAttrs = angular.extend({}, uriAttrs, makeMap( + 'abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,'+ + 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,'+ + 'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,'+ + 'scope,scrolling,shape,span,start,summary,target,title,type,'+ + 'valign,value,vspace,width')); + +function makeMap(str) { + var obj = {}, items = str.split(','), i; + for (i = 0; i < items.length; i++) obj[items[i]] = true; + return obj; +} + + +/** + * @example + * htmlParser(htmlString, { + * start: function(tag, attrs, unary) {}, + * end: function(tag) {}, + * chars: function(text) {}, + * comment: function(text) {} + * }); + * + * @param {string} html string + * @param {object} handler + */ +function htmlParser( html, handler ) { + var index, chars, match, stack = [], last = html; + stack.last = function() { return stack[ stack.length - 1 ]; }; + + while ( html ) { + chars = true; + + // Make sure we're not in a script or style element + if ( !stack.last() || !specialElements[ stack.last() ] ) { + + // Comment + if ( html.indexOf("", index) === index) { + if (handler.comment) handler.comment( html.substring( 4, index ) ); + html = html.substring( index + 3 ); + chars = false; + } + // DOCTYPE + } else if ( DOCTYPE_REGEXP.test(html) ) { + match = html.match( DOCTYPE_REGEXP ); + + if ( match ) { + html = html.replace( match[0] , ''); + chars = false; + } + // end tag + } else if ( BEGING_END_TAGE_REGEXP.test(html) ) { + match = html.match( END_TAG_REGEXP ); + + if ( match ) { + html = html.substring( match[0].length ); + match[0].replace( END_TAG_REGEXP, parseEndTag ); + chars = false; + } + + // start tag + } else if ( BEGIN_TAG_REGEXP.test(html) ) { + match = html.match( START_TAG_REGEXP ); + + if ( match ) { + html = html.substring( match[0].length ); + match[0].replace( START_TAG_REGEXP, parseStartTag ); + chars = false; + } + } + + if ( chars ) { + index = html.indexOf("<"); + + var text = index < 0 ? html : html.substring( 0, index ); + html = index < 0 ? "" : html.substring( index ); + + if (handler.chars) handler.chars( decodeEntities(text) ); + } + + } else { + html = html.replace(new RegExp("(.*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'), + function(all, text){ + text = text.replace(COMMENT_REGEXP, "$1").replace(CDATA_REGEXP, "$1"); + + if (handler.chars) handler.chars( decodeEntities(text) ); + + return ""; + }); + + parseEndTag( "", stack.last() ); + } + + if ( html == last ) { + throw $sanitizeMinErr('badparse', "The sanitizer was unable to parse the following block " + + "of html: {0}", html); + } + last = html; + } + + // Clean up any remaining tags + parseEndTag(); + + function parseStartTag( tag, tagName, rest, unary ) { + tagName = angular.lowercase(tagName); + if ( blockElements[ tagName ] ) { + while ( stack.last() && inlineElements[ stack.last() ] ) { + parseEndTag( "", stack.last() ); + } + } + + if ( optionalEndTagElements[ tagName ] && stack.last() == tagName ) { + parseEndTag( "", tagName ); + } + + unary = voidElements[ tagName ] || !!unary; + + if ( !unary ) + stack.push( tagName ); + + var attrs = {}; + + rest.replace(ATTR_REGEXP, + function(match, name, doubleQuotedValue, singleQuotedValue, unquotedValue) { + var value = doubleQuotedValue + || singleQuotedValue + || unquotedValue + || ''; + + attrs[name] = decodeEntities(value); + }); + if (handler.start) handler.start( tagName, attrs, unary ); + } + + function parseEndTag( tag, tagName ) { + var pos = 0, i; + tagName = angular.lowercase(tagName); + if ( tagName ) + // Find the closest opened tag of the same type + for ( pos = stack.length - 1; pos >= 0; pos-- ) + if ( stack[ pos ] == tagName ) + break; + + if ( pos >= 0 ) { + // Close all the open elements, up the stack + for ( i = stack.length - 1; i >= pos; i-- ) + if (handler.end) handler.end( stack[ i ] ); + + // Remove the open elements from the stack + stack.length = pos; + } + } +} + +/** + * decodes all entities into regular string + * @param value + * @returns {string} A string with decoded entities. + */ +var hiddenPre=document.createElement("pre"); +function decodeEntities(value) { + hiddenPre.innerHTML=value.replace(//g, '>'); +} + +/** + * create an HTML/XML writer which writes to buffer + * @param {Array} buf use buf.jain('') to get out sanitized html string + * @returns {object} in the form of { + * start: function(tag, attrs, unary) {}, + * end: function(tag) {}, + * chars: function(text) {}, + * comment: function(text) {} + * } + */ +function htmlSanitizeWriter(buf){ + var ignore = false; + var out = angular.bind(buf, buf.push); + return { + start: function(tag, attrs, unary){ + tag = angular.lowercase(tag); + if (!ignore && specialElements[tag]) { + ignore = tag; + } + if (!ignore && validElements[tag] === true) { + out('<'); + out(tag); + angular.forEach(attrs, function(value, key){ + var lkey=angular.lowercase(key); + if (validAttrs[lkey]===true && (uriAttrs[lkey]!==true || value.match(URI_REGEXP))) { + out(' '); + out(key); + out('="'); + out(encodeEntities(value)); + out('"'); + } + }); + out(unary ? '/>' : '>'); + } + }, + end: function(tag){ + tag = angular.lowercase(tag); + if (!ignore && validElements[tag] === true) { + out(''); + } + if (tag == ignore) { + ignore = false; + } + }, + chars: function(chars){ + if (!ignore) { + out(encodeEntities(chars)); + } + } + }; +} + + +// define ngSanitize module and register $sanitize service +angular.module('ngSanitize', []).value('$sanitize', $sanitize); + +/* global htmlSanitizeWriter: false */ + +/** + * @ngdoc filter + * @name ngSanitize.filter:linky + * @function + * + * @description + * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and + * plain email address links. + * + * Requires the {@link ngSanitize `ngSanitize`} module to be installed. + * + * @param {string} text Input text. + * @param {string} target Window (_blank|_self|_parent|_top) or named frame to open links in. + * @returns {string} Html-linkified text. + * + * @usage + + * + * @example + + + +
+ Snippet: + + + + + + + + + + + + + + + + + + + + + +
FilterSourceRendered
linky filter +
<div ng-bind-html="snippet | linky">
</div>
+
+
+
linky target +
<div ng-bind-html="snippetWithTarget | linky:'_blank'">
</div>
+
+
+
no filter
<div ng-bind="snippet">
</div>
+ + + it('should linkify the snippet with urls', function() { + expect(using('#linky-filter').binding('snippet | linky')). + toBe('Pretty text with some links: ' + + 'http://angularjs.org/, ' + + 'us@somewhere.org, ' + + 'another@somewhere.org, ' + + 'and one more: ftp://127.0.0.1/.'); + }); + + it ('should not linkify snippet without the linky filter', function() { + expect(using('#escaped-html').binding('snippet')). + toBe("Pretty text with some links:\n" + + "http://angularjs.org/,\n" + + "mailto:us@somewhere.org,\n" + + "another@somewhere.org,\n" + + "and one more: ftp://127.0.0.1/."); + }); + + it('should update', function() { + input('snippet').enter('new http://link.'); + expect(using('#linky-filter').binding('snippet | linky')). + toBe('new http://link.'); + expect(using('#escaped-html').binding('snippet')).toBe('new http://link.'); + }); + + it('should work with the target property', function() { + expect(using('#linky-target').binding("snippetWithTarget | linky:'_blank'")). + toBe('http://angularjs.org/'); + }); + + + */ +angular.module('ngSanitize').filter('linky', function() { + var LINKY_URL_REGEXP = + /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/, + MAILTO_REGEXP = /^mailto:/; + + return function(text, target) { + if (!text) return text; + var match; + var raw = text; + var html = []; + // TODO(vojta): use $sanitize instead + var writer = htmlSanitizeWriter(html); + var url; + var i; + var properties = {}; + if (angular.isDefined(target)) { + properties.target = target; + } + while ((match = raw.match(LINKY_URL_REGEXP))) { + // We can not end in these as they are sometimes found at the end of the sentence + url = match[0]; + // if we did not match ftp/http/mailto then assume mailto + if (match[2] == match[3]) url = 'mailto:' + url; + i = match.index; + writer.chars(raw.substr(0, i)); + properties.href = url; + writer.start('a', properties); + writer.chars(match[0].replace(MAILTO_REGEXP, '')); + writer.end('a'); + raw = raw.substring(i + match[0].length); + } + writer.chars(raw); + return html.join(''); + }; +}); + + +})(window, window.angular); diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-sanitize.min.js b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-sanitize.min.js new file mode 100755 index 0000000..15bfb59 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-sanitize.min.js @@ -0,0 +1,14 @@ +/* + AngularJS v1.2.0 + (c) 2010-2012 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(m,g,n){'use strict';function h(a){var d={};a=a.split(",");var c;for(c=0;c=c;k--)d.end&&d.end(e[k]);e.length= +c}}var b,f,e=[],l=a;for(e.last=function(){return e[e.length-1]};a;){f=!0;if(e.last()&&v[e.last()])a=a.replace(RegExp("(.*)<\\s*\\/\\s*"+e.last()+"[^>]*>","i"),function(a,b){b=b.replace(F,"$1").replace(G,"$1");d.chars&&d.chars(p(b));return""}),k("",e.last());else{if(0===a.indexOf("\x3c!--"))b=a.indexOf("--",4),0<=b&&a.lastIndexOf("--\x3e",b)===b&&(d.comment&&d.comment(a.substring(4,b)),a=a.substring(b+3),f=!1);else if(w.test(a)){if(b=a.match(w))a=a.replace(b[0],""),f=!1}else if(H.test(a)){if(b=a.match(x))a= +a.substring(b[0].length),b[0].replace(x,k),f=!1}else I.test(a)&&(b=a.match(y))&&(a=a.substring(b[0].length),b[0].replace(y,c),f=!1);f&&(b=a.indexOf("<"),f=0>b?a:a.substring(0,b),a=0>b?"":a.substring(b),d.chars&&d.chars(p(f)))}if(a==l)throw J("badparse",a);l=a}k()}function p(a){q.innerHTML=a.replace(//g,">")}function A(a){var d= +!1,c=g.bind(a,a.push);return{start:function(a,b,f){a=g.lowercase(a);!d&&v[a]&&(d=a);d||!0!==B[a]||(c("<"),c(a),g.forEach(b,function(a,b){var d=g.lowercase(b);!0!==L[d]||!0===C[d]&&!a.match(M)||(c(" "),c(b),c('="'),c(z(a)),c('"'))}),c(f?"/>":">"))},end:function(a){a=g.lowercase(a);d||!0!==B[a]||(c(""));a==d&&(d=!1)},chars:function(a){d||c(z(a))}}}var J=g.$$minErr("$sanitize"),y=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,x=/^<\s*\/\s*([\w:-]+)[^>]*>/, +E=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,I=/^]*?)>/i,G=/]/,d=/^mailto:/;return function(c,k){if(!c)return c;var b,f=c,e=[],l=A(e),h,m,n={};g.isDefined(k)&&(n.target=k);for(;b=f.match(a);)h=b[0],b[2]==b[3]&&(h="mailto:"+h),m=b.index,l.chars(f.substr(0,m)),n.href=h,l.start("a",n),l.chars(b[0].replace(d,"")),l.end("a"), +f=f.substring(m+b[0].length);l.chars(f);return e.join("")}})})(window,window.angular); +//# sourceMappingURL=angular-sanitize.min.js.map diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-sanitize.min.js.map b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-sanitize.min.js.map new file mode 100755 index 0000000..07c439c --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-sanitize.min.js.map @@ -0,0 +1,8 @@ +{ +"version":3, +"file":"angular-sanitize.min.js", +"lineCount":13, +"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CAqMtCC,QAASA,EAAO,CAACC,CAAD,CAAM,CAAA,IAChBC,EAAM,EAAIC,EAAAA,CAAQF,CAAAG,MAAA,CAAU,GAAV,CAAtB,KAAsCC,CACtC,KAAKA,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgBF,CAAAG,OAAhB,CAA8BD,CAAA,EAA9B,CAAmCH,CAAA,CAAIC,CAAA,CAAME,CAAN,CAAJ,CAAA,CAAgB,CAAA,CACnD,OAAOH,EAHa,CAmBtBK,QAASA,EAAU,CAAEC,CAAF,CAAQC,CAAR,CAAkB,CAiFnCC,QAASA,EAAa,CAAEC,CAAF,CAAOC,CAAP,CAAgBC,CAAhB,CAAsBC,CAAtB,CAA8B,CAClDF,CAAA,CAAUd,CAAAiB,UAAA,CAAkBH,CAAlB,CACV,IAAKI,CAAA,CAAeJ,CAAf,CAAL,CACE,IAAA,CAAQK,CAAAC,KAAA,EAAR,EAAwBC,CAAA,CAAgBF,CAAAC,KAAA,EAAhB,CAAxB,CAAA,CACEE,CAAA,CAAa,EAAb,CAAiBH,CAAAC,KAAA,EAAjB,CAICG,EAAA,CAAwBT,CAAxB,CAAL,EAA0CK,CAAAC,KAAA,EAA1C,EAA0DN,CAA1D,EACEQ,CAAA,CAAa,EAAb,CAAiBR,CAAjB,CAKF,EAFAE,CAEA,CAFQQ,CAAA,CAAcV,CAAd,CAER,EAFmC,CAAC,CAACE,CAErC,GACEG,CAAAM,KAAA,CAAYX,CAAZ,CAEF,KAAIY,EAAQ,EAEZX,EAAAY,QAAA,CAAaC,CAAb,CACE,QAAQ,CAACC,CAAD,CAAQC,CAAR,CAAcC,CAAd,CAAiCC,CAAjC,CAAoDC,CAApD,CAAmE,CAMzEP,CAAA,CAAMI,CAAN,CAAA,CAAcI,CAAA,CALFH,CAKE,EAJTC,CAIS,EAHTC,CAGS,EAFT,EAES,CAN2D,CAD7E,CASItB,EAAAwB,MAAJ,EAAmBxB,CAAAwB,MAAA,CAAerB,CAAf,CAAwBY,CAAxB,CAA+BV,CAA/B,CA5B+B,CA+BpDM,QAASA,EAAW,CAAET,CAAF,CAAOC,CAAP,CAAiB,CAAA,IAC/BsB,EAAM,CADyB,CACtB7B,CAEb,IADAO,CACA,CADUd,CAAAiB,UAAA,CAAkBH,CAAlB,CACV,CAEE,IAAMsB,CAAN,CAAYjB,CAAAX,OAAZ,CAA2B,CAA3B,CAAqC,CAArC,EAA8B4B,CAA9B,EACOjB,CAAA,CAAOiB,CAAP,CADP,EACuBtB,CADvB,CAAwCsB,CAAA,EAAxC,EAIF,GAAY,CAAZ,EAAKA,CAAL,CAAgB,CAEd,IAAM7B,CAAN,CAAUY,CAAAX,OAAV,CAAyB,CAAzB,CAA4BD,CAA5B,EAAiC6B,CAAjC,CAAsC7B,CAAA,EAAtC,CACMI,CAAA0B,IAAJ,EAAiB1B,CAAA0B,IAAA,CAAalB,CAAA,CAAOZ,CAAP,CAAb,CAGnBY,EAAAX,OAAA;AAAe4B,CAND,CATmB,CAhHF,IAC/BE,CAD+B,CACxBC,CADwB,CACVpB,EAAQ,EADE,CACEC,EAAOV,CAG5C,KAFAS,CAAAC,KAEA,CAFaoB,QAAQ,EAAG,CAAE,MAAOrB,EAAA,CAAOA,CAAAX,OAAP,CAAsB,CAAtB,CAAT,CAExB,CAAQE,CAAR,CAAA,CAAe,CACb6B,CAAA,CAAQ,CAAA,CAGR,IAAMpB,CAAAC,KAAA,EAAN,EAAuBqB,CAAA,CAAiBtB,CAAAC,KAAA,EAAjB,CAAvB,CAmDEV,CASA,CATOA,CAAAiB,QAAA,CAAiBe,MAAJ,CAAW,kBAAX,CAAgCvB,CAAAC,KAAA,EAAhC,CAA+C,QAA/C,CAAyD,GAAzD,CAAb,CACL,QAAQ,CAACuB,CAAD,CAAMC,CAAN,CAAW,CACjBA,CAAA,CAAOA,CAAAjB,QAAA,CAAakB,CAAb,CAA6B,IAA7B,CAAAlB,QAAA,CAA2CmB,CAA3C,CAAyD,IAAzD,CAEHnC,EAAA4B,MAAJ,EAAmB5B,CAAA4B,MAAA,CAAeL,CAAA,CAAeU,CAAf,CAAf,CAEnB,OAAO,EALU,CADd,CASP,CAAAtB,CAAA,CAAa,EAAb,CAAiBH,CAAAC,KAAA,EAAjB,CA5DF,KAAyD,CAGvD,GAA8B,CAA9B,GAAKV,CAAAqC,QAAA,CAAa,SAAb,CAAL,CAEET,CAEA,CAFQ5B,CAAAqC,QAAA,CAAa,IAAb,CAAmB,CAAnB,CAER,CAAc,CAAd,EAAKT,CAAL,EAAmB5B,CAAAsC,YAAA,CAAiB,QAAjB,CAAwBV,CAAxB,CAAnB,GAAsDA,CAAtD,GACM3B,CAAAsC,QAEJ,EAFqBtC,CAAAsC,QAAA,CAAiBvC,CAAAwC,UAAA,CAAgB,CAAhB,CAAmBZ,CAAnB,CAAjB,CAErB,CADA5B,CACA,CADOA,CAAAwC,UAAA,CAAgBZ,CAAhB,CAAwB,CAAxB,CACP,CAAAC,CAAA,CAAQ,CAAA,CAHV,CAJF,KAUO,IAAKY,CAAAC,KAAA,CAAoB1C,CAApB,CAAL,CAGL,IAFAmB,CAEA,CAFQnB,CAAAmB,MAAA,CAAYsB,CAAZ,CAER,CACEzC,CACA,CADOA,CAAAiB,QAAA,CAAcE,CAAA,CAAM,CAAN,CAAd,CAAyB,EAAzB,CACP,CAAAU,CAAA,CAAQ,CAAA,CAFV,CAHK,IAQA,IAAKc,CAAAD,KAAA,CAA4B1C,CAA5B,CAAL,CAGL,IAFAmB,CAEA,CAFQnB,CAAAmB,MAAA,CAAYyB,CAAZ,CAER,CACE5C,CAEA;AAFOA,CAAAwC,UAAA,CAAgBrB,CAAA,CAAM,CAAN,CAAArB,OAAhB,CAEP,CADAqB,CAAA,CAAM,CAAN,CAAAF,QAAA,CAAkB2B,CAAlB,CAAkChC,CAAlC,CACA,CAAAiB,CAAA,CAAQ,CAAA,CAHV,CAHK,IAUKgB,EAAAH,KAAA,CAAsB1C,CAAtB,CAAL,GACLmB,CADK,CACGnB,CAAAmB,MAAA,CAAY2B,CAAZ,CADH,IAIH9C,CAEA,CAFOA,CAAAwC,UAAA,CAAgBrB,CAAA,CAAM,CAAN,CAAArB,OAAhB,CAEP,CADAqB,CAAA,CAAM,CAAN,CAAAF,QAAA,CAAkB6B,CAAlB,CAAoC5C,CAApC,CACA,CAAA2B,CAAA,CAAQ,CAAA,CANL,CAUFA,EAAL,GACED,CAKA,CALQ5B,CAAAqC,QAAA,CAAa,GAAb,CAKR,CAHIH,CAGJ,CAHmB,CAAR,CAAAN,CAAA,CAAY5B,CAAZ,CAAmBA,CAAAwC,UAAA,CAAgB,CAAhB,CAAmBZ,CAAnB,CAG9B,CAFA5B,CAEA,CAFe,CAAR,CAAA4B,CAAA,CAAY,EAAZ,CAAiB5B,CAAAwC,UAAA,CAAgBZ,CAAhB,CAExB,CAAI3B,CAAA4B,MAAJ,EAAmB5B,CAAA4B,MAAA,CAAeL,CAAA,CAAeU,CAAf,CAAf,CANrB,CAzCuD,CA+DzD,GAAKlC,CAAL,EAAaU,CAAb,CACE,KAAMqC,EAAA,CAAgB,UAAhB,CAC4C/C,CAD5C,CAAN,CAGFU,CAAA,CAAOV,CAvEM,CA2EfY,CAAA,EA/EmC,CA0IrCY,QAASA,EAAc,CAACwB,CAAD,CAAQ,CAC7BC,CAAAC,UAAA,CAAoBF,CAAA/B,QAAA,CAAc,IAAd,CAAmB,MAAnB,CACpB,OAAOgC,EAAAE,UAAP,EAA8BF,CAAAG,YAA9B,EAAuD,EAF1B,CAY/BC,QAASA,EAAc,CAACL,CAAD,CAAQ,CAC7B,MAAOA,EAAA/B,QAAA,CACG,IADH,CACS,OADT,CAAAA,QAAA,CAEGqC,CAFH,CAE4B,QAAQ,CAACN,CAAD,CAAO,CAC9C,MAAO,IAAP,CAAcA,CAAAO,WAAA,CAAiB,CAAjB,CAAd,CAAoC,GADU,CAF3C,CAAAtC,QAAA,CAKG,IALH,CAKS,MALT,CAAAA,QAAA,CAMG,IANH,CAMS,MANT,CADsB,CAoB/BuC,QAASA,EAAkB,CAACC,CAAD,CAAK,CAC9B,IAAIC;AAAS,CAAA,CAAb,CACIC,EAAMrE,CAAAsE,KAAA,CAAaH,CAAb,CAAkBA,CAAA1C,KAAlB,CACV,OAAO,OACEU,QAAQ,CAACtB,CAAD,CAAMa,CAAN,CAAaV,CAAb,CAAmB,CAChCH,CAAA,CAAMb,CAAAiB,UAAA,CAAkBJ,CAAlB,CACDuD,EAAAA,CAAL,EAAe3B,CAAA,CAAgB5B,CAAhB,CAAf,GACEuD,CADF,CACWvD,CADX,CAGKuD,EAAL,EAAsC,CAAA,CAAtC,GAAeG,CAAA,CAAc1D,CAAd,CAAf,GACEwD,CAAA,CAAI,GAAJ,CAYA,CAXAA,CAAA,CAAIxD,CAAJ,CAWA,CAVAb,CAAAwE,QAAA,CAAgB9C,CAAhB,CAAuB,QAAQ,CAACgC,CAAD,CAAQe,CAAR,CAAY,CACzC,IAAIC,EAAK1E,CAAAiB,UAAA,CAAkBwD,CAAlB,CACc,EAAA,CAAvB,GAAIE,CAAA,CAAWD,CAAX,CAAJ,EAAiD,CAAA,CAAjD,GAAgCE,CAAA,CAASF,CAAT,CAAhC,EAAyD,CAAAhB,CAAA7B,MAAA,CAAYgD,CAAZ,CAAzD,GACER,CAAA,CAAI,GAAJ,CAIA,CAHAA,CAAA,CAAII,CAAJ,CAGA,CAFAJ,CAAA,CAAI,IAAJ,CAEA,CADAA,CAAA,CAAIN,CAAA,CAAeL,CAAf,CAAJ,CACA,CAAAW,CAAA,CAAI,GAAJ,CALF,CAFyC,CAA3C,CAUA,CAAAA,CAAA,CAAIrD,CAAA,CAAQ,IAAR,CAAe,GAAnB,CAbF,CALgC,CAD7B,KAsBAqB,QAAQ,CAACxB,CAAD,CAAK,CACdA,CAAA,CAAMb,CAAAiB,UAAA,CAAkBJ,CAAlB,CACDuD,EAAL,EAAsC,CAAA,CAAtC,GAAeG,CAAA,CAAc1D,CAAd,CAAf,GACEwD,CAAA,CAAI,IAAJ,CAEA,CADAA,CAAA,CAAIxD,CAAJ,CACA,CAAAwD,CAAA,CAAI,GAAJ,CAHF,CAKIxD,EAAJ,EAAWuD,CAAX,GACEA,CADF,CACW,CAAA,CADX,CAPc,CAtBb,OAiCE7B,QAAQ,CAACA,CAAD,CAAO,CACb6B,CAAL,EACEC,CAAA,CAAIN,CAAA,CAAexB,CAAf,CAAJ,CAFgB,CAjCjB,CAHuB,CAhYhC,IAAIkB,EAAkBzD,CAAA8E,SAAA,CAAiB,WAAjB,CAAtB,CAwIItB,EACG,4FAzIP,CA0IEF,EAAiB,2BA1InB;AA2IE1B,EAAc,yEA3IhB,CA4IE2B,EAAmB,IA5IrB,CA6IEF,EAAyB,SA7I3B,CA8IER,EAAiB,qBA9InB,CA+IEM,EAAiB,qBA/InB,CAgJEL,EAAe,yBAhJjB,CAiJE+B,EAAa,sCAjJf,CAmJEb,EAA0B,gBAnJ5B,CA4JIxC,EAAetB,CAAA,CAAQ,wBAAR,CAIf6E,EAAAA,CAA8B7E,CAAA,CAAQ,gDAAR,CAC9B8E,EAAAA,CAA+B9E,CAAA,CAAQ,OAAR,CADnC,KAEIqB,EAAyBvB,CAAAiF,OAAA,CAAe,EAAf,CACeD,CADf,CAEeD,CAFf,CAF7B,CAOI7D,EAAgBlB,CAAAiF,OAAA,CAAe,EAAf,CAAmBF,CAAnB,CAAgD7E,CAAA,CAAQ,4KAAR,CAAhD,CAPpB;AAYImB,EAAiBrB,CAAAiF,OAAA,CAAe,EAAf,CAAmBD,CAAnB,CAAiD9E,CAAA,CAAQ,2JAAR,CAAjD,CAZrB,CAkBIuC,EAAkBvC,CAAA,CAAQ,cAAR,CAlBtB,CAoBIqE,EAAgBvE,CAAAiF,OAAA,CAAe,EAAf,CACezD,CADf,CAEeN,CAFf,CAGeG,CAHf,CAIeE,CAJf,CApBpB,CA2BIqD,EAAW1E,CAAA,CAAQ,0CAAR,CA3Bf,CA4BIyE,EAAa3E,CAAAiF,OAAA,CAAe,EAAf,CAAmBL,CAAnB,CAA6B1E,CAAA,CAC1C,oSAD0C,CAA7B,CA5BjB;AA+LIyD,EAAUuB,QAAAC,cAAA,CAAuB,KAAvB,CA+EdnF,EAAAoF,OAAA,CAAe,YAAf,CAA6B,EAA7B,CAAA1B,MAAA,CAAuC,WAAvC,CA9SgB2B,QAAQ,CAAC3E,CAAD,CAAO,CAC7B,IAAIyD,EAAM,EACR1D,EAAA,CAAWC,CAAX,CAAiBwD,CAAA,CAAmBC,CAAnB,CAAjB,CACA,OAAOA,EAAAmB,KAAA,CAAS,EAAT,CAHoB,CA8S/B,CAsGAtF,EAAAoF,OAAA,CAAe,YAAf,CAAAG,OAAA,CAAoC,OAApC,CAA6C,QAAQ,EAAG,CAAA,IAClDC,EACE,mEAFgD,CAGlDC,EAAgB,UAEpB,OAAO,SAAQ,CAAC7C,CAAD,CAAO8C,CAAP,CAAe,CAC5B,GAAI,CAAC9C,CAAL,CAAW,MAAOA,EAClB,KAAIf,CAAJ,CACI8D,EAAM/C,CADV,CAEIlC,EAAO,EAFX,CAIIkF,EAAS1B,CAAA,CAAmBxD,CAAnB,CAJb,CAKImF,CALJ,CAMItF,CANJ,CAOIuF,EAAa,EACb9F,EAAA+F,UAAA,CAAkBL,CAAlB,CAAJ,GACEI,CAAAJ,OADF,CACsBA,CADtB,CAGA,KAAA,CAAQ7D,CAAR,CAAgB8D,CAAA9D,MAAA,CAAU2D,CAAV,CAAhB,CAAA,CAEEK,CASA,CATMhE,CAAA,CAAM,CAAN,CASN,CAPIA,CAAA,CAAM,CAAN,CAOJ,EAPgBA,CAAA,CAAM,CAAN,CAOhB,GAP0BgE,CAO1B,CAPgC,SAOhC,CAP4CA,CAO5C,EANAtF,CAMA,CANIsB,CAAAS,MAMJ,CALAsD,CAAArD,MAAA,CAAaoD,CAAAK,OAAA,CAAW,CAAX,CAAczF,CAAd,CAAb,CAKA,CAJAuF,CAAAG,KAIA,CAJkBJ,CAIlB,CAHAD,CAAAzD,MAAA,CAAa,GAAb,CAAkB2D,CAAlB,CAGA,CAFAF,CAAArD,MAAA,CAAaV,CAAA,CAAM,CAAN,CAAAF,QAAA,CAAiB8D,CAAjB,CAAgC,EAAhC,CAAb,CAEA,CADAG,CAAAvD,IAAA,CAAW,GAAX,CACA;AAAAsD,CAAA,CAAMA,CAAAzC,UAAA,CAAc3C,CAAd,CAAkBsB,CAAA,CAAM,CAAN,CAAArB,OAAlB,CAERoF,EAAArD,MAAA,CAAaoD,CAAb,CACA,OAAOjF,EAAA4E,KAAA,CAAU,EAAV,CA3BqB,CALwB,CAAxD,CAthBsC,CAArC,CAAA,CA2jBEvF,MA3jBF,CA2jBUA,MAAAC,QA3jBV;", +"sources":["angular-sanitize.js"], +"names":["window","angular","undefined","makeMap","str","obj","items","split","i","length","htmlParser","html","handler","parseStartTag","tag","tagName","rest","unary","lowercase","blockElements","stack","last","inlineElements","parseEndTag","optionalEndTagElements","voidElements","push","attrs","replace","ATTR_REGEXP","match","name","doubleQuotedValue","singleQuotedValue","unquotedValue","decodeEntities","start","pos","end","index","chars","stack.last","specialElements","RegExp","all","text","COMMENT_REGEXP","CDATA_REGEXP","indexOf","lastIndexOf","comment","substring","DOCTYPE_REGEXP","test","BEGING_END_TAGE_REGEXP","END_TAG_REGEXP","BEGIN_TAG_REGEXP","START_TAG_REGEXP","$sanitizeMinErr","value","hiddenPre","innerHTML","innerText","textContent","encodeEntities","NON_ALPHANUMERIC_REGEXP","charCodeAt","htmlSanitizeWriter","buf","ignore","out","bind","validElements","forEach","key","lkey","validAttrs","uriAttrs","URI_REGEXP","$$minErr","optionalEndTagBlockElements","optionalEndTagInlineElements","extend","document","createElement","module","$sanitize","join","filter","LINKY_URL_REGEXP","MAILTO_REGEXP","target","raw","writer","url","properties","isDefined","substr","href"] +} diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-touch.js b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-touch.js new file mode 100755 index 0000000..195f499 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-touch.js @@ -0,0 +1,563 @@ +/** + * @license AngularJS v1.2.0 + * (c) 2010-2012 Google, Inc. http://angularjs.org + * License: MIT + */ +(function(window, angular, undefined) {'use strict'; + +/** + * @ngdoc overview + * @name ngTouch + * @description + * + * # ngTouch + * + * The `ngTouch` module provides touch events and other helpers for touch-enabled devices. + * The implementation is based on jQuery Mobile touch event handling + * ([jquerymobile.com](http://jquerymobile.com/)). + * + * {@installModule touch} + * + * See {@link ngTouch.$swipe `$swipe`} for usage. + * + *
+ * + */ + +// define ngTouch module +/* global -ngTouch */ +var ngTouch = angular.module('ngTouch', []); + +/* global ngTouch: false */ + + /** + * @ngdoc object + * @name ngTouch.$swipe + * + * @description + * The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe + * behavior, to make implementing swipe-related directives more convenient. + * + * Requires the {@link ngTouch `ngTouch`} module to be installed. + * + * `$swipe` is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngTouch`, and by + * `ngCarousel` in a separate component. + * + * # Usage + * The `$swipe` service is an object with a single method: `bind`. `bind` takes an element + * which is to be watched for swipes, and an object with four handler functions. See the + * documentation for `bind` below. + */ + +ngTouch.factory('$swipe', [function() { + // The total distance in any direction before we make the call on swipe vs. scroll. + var MOVE_BUFFER_RADIUS = 10; + + function getCoordinates(event) { + var touches = event.touches && event.touches.length ? event.touches : [event]; + var e = (event.changedTouches && event.changedTouches[0]) || + (event.originalEvent && event.originalEvent.changedTouches && + event.originalEvent.changedTouches[0]) || + touches[0].originalEvent || touches[0]; + + return { + x: e.clientX, + y: e.clientY + }; + } + + return { + /** + * @ngdoc method + * @name ngTouch.$swipe#bind + * @methodOf ngTouch.$swipe + * + * @description + * The main method of `$swipe`. It takes an element to be watched for swipe motions, and an + * object containing event handlers. + * + * The four events are `start`, `move`, `end`, and `cancel`. `start`, `move`, and `end` + * receive as a parameter a coordinates object of the form `{ x: 150, y: 310 }`. + * + * `start` is called on either `mousedown` or `touchstart`. After this event, `$swipe` is + * watching for `touchmove` or `mousemove` events. These events are ignored until the total + * distance moved in either dimension exceeds a small threshold. + * + * Once this threshold is exceeded, either the horizontal or vertical delta is greater. + * - If the horizontal distance is greater, this is a swipe and `move` and `end` events follow. + * - If the vertical distance is greater, this is a scroll, and we let the browser take over. + * A `cancel` event is sent. + * + * `move` is called on `mousemove` and `touchmove` after the above logic has determined that + * a swipe is in progress. + * + * `end` is called when a swipe is successfully completed with a `touchend` or `mouseup`. + * + * `cancel` is called either on a `touchcancel` from the browser, or when we begin scrolling + * as described above. + * + */ + bind: function(element, eventHandlers) { + // Absolute total movement, used to control swipe vs. scroll. + var totalX, totalY; + // Coordinates of the start position. + var startCoords; + // Last event's position. + var lastPos; + // Whether a swipe is active. + var active = false; + + element.on('touchstart mousedown', function(event) { + startCoords = getCoordinates(event); + active = true; + totalX = 0; + totalY = 0; + lastPos = startCoords; + eventHandlers['start'] && eventHandlers['start'](startCoords, event); + }); + + element.on('touchcancel', function(event) { + active = false; + eventHandlers['cancel'] && eventHandlers['cancel'](event); + }); + + element.on('touchmove mousemove', function(event) { + if (!active) return; + + // Android will send a touchcancel if it thinks we're starting to scroll. + // So when the total distance (+ or - or both) exceeds 10px in either direction, + // we either: + // - On totalX > totalY, we send preventDefault() and treat this as a swipe. + // - On totalY > totalX, we let the browser handle it as a scroll. + + if (!startCoords) return; + var coords = getCoordinates(event); + + totalX += Math.abs(coords.x - lastPos.x); + totalY += Math.abs(coords.y - lastPos.y); + + lastPos = coords; + + if (totalX < MOVE_BUFFER_RADIUS && totalY < MOVE_BUFFER_RADIUS) { + return; + } + + // One of totalX or totalY has exceeded the buffer, so decide on swipe vs. scroll. + if (totalY > totalX) { + // Allow native scrolling to take over. + active = false; + eventHandlers['cancel'] && eventHandlers['cancel'](event); + return; + } else { + // Prevent the browser from scrolling. + event.preventDefault(); + eventHandlers['move'] && eventHandlers['move'](coords, event); + } + }); + + element.on('touchend mouseup', function(event) { + if (!active) return; + active = false; + eventHandlers['end'] && eventHandlers['end'](getCoordinates(event), event); + }); + } + }; +}]); + +/* global ngTouch: false */ + +/** + * @ngdoc directive + * @name ngTouch.directive:ngClick + * + * @description + * A more powerful replacement for the default ngClick designed to be used on touchscreen + * devices. Most mobile browsers wait about 300ms after a tap-and-release before sending + * the click event. This version handles them immediately, and then prevents the + * following click event from propagating. + * + * Requires the {@link ngTouch `ngTouch`} module to be installed. + * + * This directive can fall back to using an ordinary click event, and so works on desktop + * browsers as well as mobile. + * + * This directive also sets the CSS class `ng-click-active` while the element is being held + * down (by a mouse click or touch) so you can restyle the depressed element if you wish. + * + * @element ANY + * @param {expression} ngClick {@link guide/expression Expression} to evaluate + * upon tap. (Event object is available as `$event`) + * + * @example + + + + count: {{ count }} + + + */ + +ngTouch.config(['$provide', function($provide) { + $provide.decorator('ngClickDirective', ['$delegate', function($delegate) { + // drop the default ngClick directive + $delegate.shift(); + return $delegate; + }]); +}]); + +ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement', + function($parse, $timeout, $rootElement) { + var TAP_DURATION = 750; // Shorter than 750ms is a tap, longer is a taphold or drag. + var MOVE_TOLERANCE = 12; // 12px seems to work in most mobile browsers. + var PREVENT_DURATION = 2500; // 2.5 seconds maximum from preventGhostClick call to click + var CLICKBUSTER_THRESHOLD = 25; // 25 pixels in any dimension is the limit for busting clicks. + + var ACTIVE_CLASS_NAME = 'ng-click-active'; + var lastPreventedTime; + var touchCoordinates; + + + // TAP EVENTS AND GHOST CLICKS + // + // Why tap events? + // Mobile browsers detect a tap, then wait a moment (usually ~300ms) to see if you're + // double-tapping, and then fire a click event. + // + // This delay sucks and makes mobile apps feel unresponsive. + // So we detect touchstart, touchmove, touchcancel and touchend ourselves and determine when + // the user has tapped on something. + // + // What happens when the browser then generates a click event? + // The browser, of course, also detects the tap and fires a click after a delay. This results in + // tapping/clicking twice. So we do "clickbusting" to prevent it. + // + // How does it work? + // We attach global touchstart and click handlers, that run during the capture (early) phase. + // So the sequence for a tap is: + // - global touchstart: Sets an "allowable region" at the point touched. + // - element's touchstart: Starts a touch + // (- touchmove or touchcancel ends the touch, no click follows) + // - element's touchend: Determines if the tap is valid (didn't move too far away, didn't hold + // too long) and fires the user's tap handler. The touchend also calls preventGhostClick(). + // - preventGhostClick() removes the allowable region the global touchstart created. + // - The browser generates a click event. + // - The global click handler catches the click, and checks whether it was in an allowable region. + // - If preventGhostClick was called, the region will have been removed, the click is busted. + // - If the region is still there, the click proceeds normally. Therefore clicks on links and + // other elements without ngTap on them work normally. + // + // This is an ugly, terrible hack! + // Yeah, tell me about it. The alternatives are using the slow click events, or making our users + // deal with the ghost clicks, so I consider this the least of evils. Fortunately Angular + // encapsulates this ugly logic away from the user. + // + // Why not just put click handlers on the element? + // We do that too, just to be sure. The problem is that the tap event might have caused the DOM + // to change, so that the click fires in the same position but something else is there now. So + // the handlers are global and care only about coordinates and not elements. + + // Checks if the coordinates are close enough to be within the region. + function hit(x1, y1, x2, y2) { + return Math.abs(x1 - x2) < CLICKBUSTER_THRESHOLD && Math.abs(y1 - y2) < CLICKBUSTER_THRESHOLD; + } + + // Checks a list of allowable regions against a click location. + // Returns true if the click should be allowed. + // Splices out the allowable region from the list after it has been used. + function checkAllowableRegions(touchCoordinates, x, y) { + for (var i = 0; i < touchCoordinates.length; i += 2) { + if (hit(touchCoordinates[i], touchCoordinates[i+1], x, y)) { + touchCoordinates.splice(i, i + 2); + return true; // allowable region + } + } + return false; // No allowable region; bust it. + } + + // Global click handler that prevents the click if it's in a bustable zone and preventGhostClick + // was called recently. + function onClick(event) { + if (Date.now() - lastPreventedTime > PREVENT_DURATION) { + return; // Too old. + } + + var touches = event.touches && event.touches.length ? event.touches : [event]; + var x = touches[0].clientX; + var y = touches[0].clientY; + // Work around desktop Webkit quirk where clicking a label will fire two clicks (on the label + // and on the input element). Depending on the exact browser, this second click we don't want + // to bust has either (0,0) or negative coordinates. + if (x < 1 && y < 1) { + return; // offscreen + } + + // Look for an allowable region containing this click. + // If we find one, that means it was created by touchstart and not removed by + // preventGhostClick, so we don't bust it. + if (checkAllowableRegions(touchCoordinates, x, y)) { + return; + } + + // If we didn't find an allowable region, bust the click. + event.stopPropagation(); + event.preventDefault(); + + // Blur focused form elements + event.target && event.target.blur(); + } + + + // Global touchstart handler that creates an allowable region for a click event. + // This allowable region can be removed by preventGhostClick if we want to bust it. + function onTouchStart(event) { + var touches = event.touches && event.touches.length ? event.touches : [event]; + var x = touches[0].clientX; + var y = touches[0].clientY; + touchCoordinates.push(x, y); + + $timeout(function() { + // Remove the allowable region. + for (var i = 0; i < touchCoordinates.length; i += 2) { + if (touchCoordinates[i] == x && touchCoordinates[i+1] == y) { + touchCoordinates.splice(i, i + 2); + return; + } + } + }, PREVENT_DURATION, false); + } + + // On the first call, attaches some event handlers. Then whenever it gets called, it creates a + // zone around the touchstart where clicks will get busted. + function preventGhostClick(x, y) { + if (!touchCoordinates) { + $rootElement[0].addEventListener('click', onClick, true); + $rootElement[0].addEventListener('touchstart', onTouchStart, true); + touchCoordinates = []; + } + + lastPreventedTime = Date.now(); + + checkAllowableRegions(touchCoordinates, x, y); + } + + // Actual linking function. + return function(scope, element, attr) { + var clickHandler = $parse(attr.ngClick), + tapping = false, + tapElement, // Used to blur the element after a tap. + startTime, // Used to check if the tap was held too long. + touchStartX, + touchStartY; + + function resetState() { + tapping = false; + element.removeClass(ACTIVE_CLASS_NAME); + } + + element.on('touchstart', function(event) { + tapping = true; + tapElement = event.target ? event.target : event.srcElement; // IE uses srcElement. + // Hack for Safari, which can target text nodes instead of containers. + if(tapElement.nodeType == 3) { + tapElement = tapElement.parentNode; + } + + element.addClass(ACTIVE_CLASS_NAME); + + startTime = Date.now(); + + var touches = event.touches && event.touches.length ? event.touches : [event]; + var e = touches[0].originalEvent || touches[0]; + touchStartX = e.clientX; + touchStartY = e.clientY; + }); + + element.on('touchmove', function(event) { + resetState(); + }); + + element.on('touchcancel', function(event) { + resetState(); + }); + + element.on('touchend', function(event) { + var diff = Date.now() - startTime; + + var touches = (event.changedTouches && event.changedTouches.length) ? event.changedTouches : + ((event.touches && event.touches.length) ? event.touches : [event]); + var e = touches[0].originalEvent || touches[0]; + var x = e.clientX; + var y = e.clientY; + var dist = Math.sqrt( Math.pow(x - touchStartX, 2) + Math.pow(y - touchStartY, 2) ); + + if (tapping && diff < TAP_DURATION && dist < MOVE_TOLERANCE) { + // Call preventGhostClick so the clickbuster will catch the corresponding click. + preventGhostClick(x, y); + + // Blur the focused element (the button, probably) before firing the callback. + // This doesn't work perfectly on Android Chrome, but seems to work elsewhere. + // I couldn't get anything to work reliably on Android Chrome. + if (tapElement) { + tapElement.blur(); + } + + if (!angular.isDefined(attr.disabled) || attr.disabled === false) { + element.triggerHandler('click', [event]); + } + } + + resetState(); + }); + + // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click + // something else nearby. + element.onclick = function(event) { }; + + // Actual click handler. + // There are three different kinds of clicks, only two of which reach this point. + // - On desktop browsers without touch events, their clicks will always come here. + // - On mobile browsers, the simulated "fast" click will call this. + // - But the browser's follow-up slow click will be "busted" before it reaches this handler. + // Therefore it's safe to use this directive on both mobile and desktop. + element.on('click', function(event, touchend) { + scope.$apply(function() { + clickHandler(scope, {$event: (touchend || event)}); + }); + }); + + element.on('mousedown', function(event) { + element.addClass(ACTIVE_CLASS_NAME); + }); + + element.on('mousemove mouseup', function(event) { + element.removeClass(ACTIVE_CLASS_NAME); + }); + + }; +}]); + +/* global ngTouch: false */ + +/** + * @ngdoc directive + * @name ngTouch.directive:ngSwipeLeft + * + * @description + * Specify custom behavior when an element is swiped to the left on a touchscreen device. + * A leftward swipe is a quick, right-to-left slide of the finger. + * Though ngSwipeLeft is designed for touch-based devices, it will work with a mouse click and drag + * too. + * + * Requires the {@link ngTouch `ngTouch`} module to be installed. + * + * @element ANY + * @param {expression} ngSwipeLeft {@link guide/expression Expression} to evaluate + * upon left swipe. (Event object is available as `$event`) + * + * @example + + +
+ Some list content, like an email in the inbox +
+
+ + +
+
+
+ */ + +/** + * @ngdoc directive + * @name ngTouch.directive:ngSwipeRight + * + * @description + * Specify custom behavior when an element is swiped to the right on a touchscreen device. + * A rightward swipe is a quick, left-to-right slide of the finger. + * Though ngSwipeRight is designed for touch-based devices, it will work with a mouse click and drag + * too. + * + * Requires the {@link ngTouch `ngTouch`} module to be installed. + * + * @element ANY + * @param {expression} ngSwipeRight {@link guide/expression Expression} to evaluate + * upon right swipe. (Event object is available as `$event`) + * + * @example + + +
+ Some list content, like an email in the inbox +
+
+ + +
+
+
+ */ + +function makeSwipeDirective(directiveName, direction, eventName) { + ngTouch.directive(directiveName, ['$parse', '$swipe', function($parse, $swipe) { + // The maximum vertical delta for a swipe should be less than 75px. + var MAX_VERTICAL_DISTANCE = 75; + // Vertical distance should not be more than a fraction of the horizontal distance. + var MAX_VERTICAL_RATIO = 0.3; + // At least a 30px lateral motion is necessary for a swipe. + var MIN_HORIZONTAL_DISTANCE = 30; + + return function(scope, element, attr) { + var swipeHandler = $parse(attr[directiveName]); + + var startCoords, valid; + + function validSwipe(coords) { + // Check that it's within the coordinates. + // Absolute vertical distance must be within tolerances. + // Horizontal distance, we take the current X - the starting X. + // This is negative for leftward swipes and positive for rightward swipes. + // After multiplying by the direction (-1 for left, +1 for right), legal swipes + // (ie. same direction as the directive wants) will have a positive delta and + // illegal ones a negative delta. + // Therefore this delta must be positive, and larger than the minimum. + if (!startCoords) return false; + var deltaY = Math.abs(coords.y - startCoords.y); + var deltaX = (coords.x - startCoords.x) * direction; + return valid && // Short circuit for already-invalidated swipes. + deltaY < MAX_VERTICAL_DISTANCE && + deltaX > 0 && + deltaX > MIN_HORIZONTAL_DISTANCE && + deltaY / deltaX < MAX_VERTICAL_RATIO; + } + + $swipe.bind(element, { + 'start': function(coords, event) { + startCoords = coords; + valid = true; + }, + 'cancel': function(event) { + valid = false; + }, + 'end': function(coords, event) { + if (validSwipe(coords)) { + scope.$apply(function() { + element.triggerHandler(eventName); + swipeHandler(scope, {$event: event}); + }); + } + } + }); + }; + }]); +} + +// Left is negative X-coordinate, right is positive. +makeSwipeDirective('ngSwipeLeft', -1, 'swipeleft'); +makeSwipeDirective('ngSwipeRight', 1, 'swiperight'); + + + +})(window, window.angular); diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-touch.min.js b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-touch.min.js new file mode 100755 index 0000000..b3740b6 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-touch.min.js @@ -0,0 +1,13 @@ +/* + AngularJS v1.2.0 + (c) 2010-2012 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(y,v,z){'use strict';function t(g,a,b){q.directive(g,["$parse","$swipe",function(l,n){var r=75,h=0.3,d=30;return function(p,m,k){function e(e){if(!u)return!1;var c=Math.abs(e.y-u.y);e=(e.x-u.x)*a;return f&&cd&&c/el&&10>n|| +(n>l?(d=!1,b.cancel&&b.cancel(a)):(a.preventDefault(),b.move&&b.move(m,a)))}});a.on("touchend mouseup",function(a){d&&(d=!1,b.end&&b.end(g(a),a))})}}}]);q.config(["$provide",function(g){g.decorator("ngClickDirective",["$delegate",function(a){a.shift();return a}])}]);q.directive("ngClick",["$parse","$timeout","$rootElement",function(g,a,b){function l(a,c,b){for(var f=0;fh)){var c= +a.touches&&a.touches.length?a.touches:[a],b=c[0].clientX,c=c[0].clientY;1>b&&1>c||l(k,b,c)||(a.stopPropagation(),a.preventDefault(),a.target&&a.target.blur())}}function r(b){b=b.touches&&b.touches.length?b.touches:[b];var c=b[0].clientX,d=b[0].clientY;k.push(c,d);a(function(){for(var a=0;ah&&12>p)&&(k||(b[0].addEventListener("click",n,!0),b[0].addEventListener("touchstart",r,!0),k=[]),m=Date.now(),l(k,e,g),s&&s.blur(),v.isDefined(d.disabled)&&!1!==d.disabled||c.triggerHandler("click",[a]));f()});c.onclick=function(a){};c.on("click",function(b,c){a.$apply(function(){h(a,{$event:c||b})})});c.on("mousedown",function(a){c.addClass(p)});c.on("mousemove mouseup",function(a){c.removeClass(p)})}}]);t("ngSwipeLeft",-1,"swipeleft");t("ngSwipeRight",1,"swiperight")})(window, +window.angular); +//# sourceMappingURL=angular-touch.min.js.map diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-touch.min.js.map b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-touch.min.js.map new file mode 100755 index 0000000..6681ba1 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular-touch.min.js.map @@ -0,0 +1,8 @@ +{ +"version":3, +"file":"angular-touch.min.js", +"lineCount":12, +"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CAiftCC,QAASA,EAAkB,CAACC,CAAD,CAAgBC,CAAhB,CAA2BC,CAA3B,CAAsC,CAC/DC,CAAAC,UAAA,CAAkBJ,CAAlB,CAAiC,CAAC,QAAD,CAAW,QAAX,CAAqB,QAAQ,CAACK,CAAD,CAASC,CAAT,CAAiB,CAE7E,IAAIC,EAAwB,EAA5B,CAEIC,EAAqB,GAFzB,CAIIC,EAA0B,EAE9B,OAAO,SAAQ,CAACC,CAAD,CAAQC,CAAR,CAAiBC,CAAjB,CAAuB,CAKpCC,QAASA,EAAU,CAACC,CAAD,CAAS,CAS1B,GAAI,CAACC,CAAL,CAAkB,MAAO,CAAA,CACzB,KAAIC,EAASC,IAAAC,IAAA,CAASJ,CAAAK,EAAT,CAAoBJ,CAAAI,EAApB,CACTC,EAAAA,EAAUN,CAAAO,EAAVD,CAAqBL,CAAAM,EAArBD,EAAsCnB,CAC1C,OAAOqB,EAAP,EACIN,CADJ,CACaT,CADb,EAEa,CAFb,CAEIa,CAFJ,EAGIA,CAHJ,CAGaX,CAHb,EAIIO,CAJJ,CAIaI,CAJb,CAIsBZ,CAhBI,CAJ5B,IAAIe,EAAelB,CAAA,CAAOO,CAAA,CAAKZ,CAAL,CAAP,CAAnB,CAEIe,CAFJ,CAEiBO,CAqBjBhB,EAAAkB,KAAA,CAAYb,CAAZ,CAAqB,OACVc,QAAQ,CAACX,CAAD,CAASY,CAAT,CAAgB,CAC/BX,CAAA,CAAcD,CACdQ,EAAA,CAAQ,CAAA,CAFuB,CADd,QAKTK,QAAQ,CAACD,CAAD,CAAQ,CACxBJ,CAAA,CAAQ,CAAA,CADgB,CALP,KAQZM,QAAQ,CAACd,CAAD,CAASY,CAAT,CAAgB,CACzBb,CAAA,CAAWC,CAAX,CAAJ,EACEJ,CAAAmB,OAAA,CAAa,QAAQ,EAAG,CACtBlB,CAAAmB,eAAA,CAAuB5B,CAAvB,CACAqB,EAAA,CAAab,CAAb,CAAoB,QAASgB,CAAT,CAApB,CAFsB,CAAxB,CAF2B,CARZ,CAArB,CAxBoC,CARuC,CAA9C,CAAjC,CAD+D,CA1djE,IAAIvB,EAAUN,CAAAkC,OAAA,CAAe,SAAf,CAA0B,EAA1B,CAuBd5B,EAAA6B,QAAA,CAAgB,QAAhB,CAA0B,CAAC,QAAQ,EAAG,CAIpCC,QAASA,EAAc,CAACP,CAAD,CAAQ,CAC7B,IAAIQ,EAAUR,CAAAQ,QAAA,EAAiBR,CAAAQ,QAAAC,OAAjB;AAAwCT,CAAAQ,QAAxC,CAAwD,CAACR,CAAD,CAClEU,EAAAA,CAAKV,CAAAW,eAALD,EAA6BV,CAAAW,eAAA,CAAqB,CAArB,CAA7BD,EACCV,CAAAY,cADDF,EACwBV,CAAAY,cAAAD,eADxBD,EAEIV,CAAAY,cAAAD,eAAA,CAAmC,CAAnC,CAFJD,EAGAF,CAAA,CAAQ,CAAR,CAAAI,cAHAF,EAG4BF,CAAA,CAAQ,CAAR,CAEhC,OAAO,GACFE,CAAAG,QADE,GAEFH,CAAAI,QAFE,CAPsB,CAa/B,MAAO,MA+BChB,QAAQ,CAACb,CAAD,CAAU8B,CAAV,CAAyB,CAAA,IAEjCC,CAFiC,CAEzBC,CAFyB,CAIjC5B,CAJiC,CAMjC6B,CANiC,CAQjCC,EAAS,CAAA,CAEblC,EAAAmC,GAAA,CAAW,sBAAX,CAAmC,QAAQ,CAACpB,CAAD,CAAQ,CACjDX,CAAA,CAAckB,CAAA,CAAeP,CAAf,CACdmB,EAAA,CAAS,CAAA,CAETF,EAAA,CADAD,CACA,CADS,CAETE,EAAA,CAAU7B,CACV0B,EAAA,MAAA,EAA0BA,CAAA,MAAA,CAAuB1B,CAAvB,CAAoCW,CAApC,CANuB,CAAnD,CASAf,EAAAmC,GAAA,CAAW,aAAX,CAA0B,QAAQ,CAACpB,CAAD,CAAQ,CACxCmB,CAAA,CAAS,CAAA,CACTJ,EAAA,OAAA,EAA2BA,CAAA,OAAA,CAAwBf,CAAxB,CAFa,CAA1C,CAKAf,EAAAmC,GAAA,CAAW,qBAAX,CAAkC,QAAQ,CAACpB,CAAD,CAAQ,CAChD,GAAKmB,CAAL,EAQK9B,CARL,CAQA,CACA,IAAID,EAASmB,CAAA,CAAeP,CAAf,CAEbgB,EAAA,EAAUzB,IAAAC,IAAA,CAASJ,CAAAO,EAAT,CAAoBuB,CAAAvB,EAApB,CACVsB,EAAA,EAAU1B,IAAAC,IAAA,CAASJ,CAAAK,EAAT,CAAoByB,CAAAzB,EAApB,CAEVyB,EAAA,CAAU9B,CArFSiC,GAuFnB,CAAIL,CAAJ,EAvFmBK,EAuFnB,CAAmCJ,CAAnC;CAKIA,CAAJ,CAAaD,CAAb,EAEEG,CACA,CADS,CAAA,CACT,CAAAJ,CAAA,OAAA,EAA2BA,CAAA,OAAA,CAAwBf,CAAxB,CAH7B,GAOEA,CAAAsB,eAAA,EACA,CAAAP,CAAA,KAAA,EAAyBA,CAAA,KAAA,CAAsB3B,CAAtB,CAA8BY,CAA9B,CAR3B,CALA,CARA,CATgD,CAAlD,CAkCAf,EAAAmC,GAAA,CAAW,kBAAX,CAA+B,QAAQ,CAACpB,CAAD,CAAQ,CACxCmB,CAAL,GACAA,CACA,CADS,CAAA,CACT,CAAAJ,CAAA,IAAA,EAAwBA,CAAA,IAAA,CAAqBR,CAAA,CAAeP,CAAf,CAArB,CAA4CA,CAA5C,CAFxB,CAD6C,CAA/C,CA1DqC,CA/BlC,CAjB6B,CAAZ,CAA1B,CAsJAvB,EAAA8C,OAAA,CAAe,CAAC,UAAD,CAAa,QAAQ,CAACC,CAAD,CAAW,CAC7CA,CAAAC,UAAA,CAAmB,kBAAnB,CAAuC,CAAC,WAAD,CAAc,QAAQ,CAACC,CAAD,CAAY,CAEvEA,CAAAC,MAAA,EACA,OAAOD,EAHgE,CAAlC,CAAvC,CAD6C,CAAhC,CAAf,CAQAjD,EAAAC,UAAA,CAAkB,SAAlB,CAA6B,CAAC,QAAD,CAAW,UAAX,CAAuB,cAAvB,CACzB,QAAQ,CAACC,CAAD,CAASiD,CAAT,CAAmBC,CAAnB,CAAiC,CA0D3CC,QAASA,EAAqB,CAACC,CAAD,CAAmBpC,CAAnB,CAAsBF,CAAtB,CAAyB,CACrD,IAAK,IAAIuC,EAAI,CAAb,CAAgBA,CAAhB,CAAoBD,CAAAtB,OAApB,CAA6CuB,CAA7C,EAAkD,CAAlD,CACE,GARKzC,IAAAC,IAAA,CAQGuC,CAAAE,CAAiBD,CAAjBC,CARH,CAQ+CtC,CAR/C,CAQL,CARyBuC,CAQzB,EARkD3C,IAAAC,IAAA,CAQrBuC,CAAAI,CAAiBH,CAAjBG,CAAmB,CAAnBA,CARqB,CAQK1C,CARL,CAQlD,CARsEyC,CAQtE,CAEE,MADAH,EAAAK,OAAA,CAAwBJ,CAAxB,CAA2BA,CAA3B,CAA+B,CAA/B,CACO,CAAA,CAAA,CAGX,OAAO,CAAA,CAP8C,CAYvDK,QAASA,EAAO,CAACrC,CAAD,CAAQ,CACtB,GAAI,EAAAsC,IAAAC,IAAA,EAAA,CAAaC,CAAb,CAAiCC,CAAjC,CAAJ,CAAA,CAIA,IAAIjC;AAAUR,CAAAQ,QAAA,EAAiBR,CAAAQ,QAAAC,OAAjB,CAAwCT,CAAAQ,QAAxC,CAAwD,CAACR,CAAD,CAAtE,CACIL,EAAIa,CAAA,CAAQ,CAAR,CAAAK,QADR,CAEIpB,EAAIe,CAAA,CAAQ,CAAR,CAAAM,QAIA,EAAR,CAAInB,CAAJ,EAAiB,CAAjB,CAAaF,CAAb,EAOIqC,CAAA,CAAsBC,CAAtB,CAAwCpC,CAAxC,CAA2CF,CAA3C,CAPJ,GAYAO,CAAA0C,gBAAA,EAIA,CAHA1C,CAAAsB,eAAA,EAGA,CAAAtB,CAAA2C,OAAA,EAAgB3C,CAAA2C,OAAAC,KAAA,EAhBhB,CAVA,CADsB,CAiCxBC,QAASA,EAAY,CAAC7C,CAAD,CAAQ,CACvBQ,CAAAA,CAAUR,CAAAQ,QAAA,EAAiBR,CAAAQ,QAAAC,OAAjB,CAAwCT,CAAAQ,QAAxC,CAAwD,CAACR,CAAD,CACtE,KAAIL,EAAIa,CAAA,CAAQ,CAAR,CAAAK,QAAR,CACIpB,EAAIe,CAAA,CAAQ,CAAR,CAAAM,QACRiB,EAAAe,KAAA,CAAsBnD,CAAtB,CAAyBF,CAAzB,CAEAmC,EAAA,CAAS,QAAQ,EAAG,CAElB,IAAK,IAAII,EAAI,CAAb,CAAgBA,CAAhB,CAAoBD,CAAAtB,OAApB,CAA6CuB,CAA7C,EAAkD,CAAlD,CACE,GAAID,CAAA,CAAiBC,CAAjB,CAAJ,EAA2BrC,CAA3B,EAAgCoC,CAAA,CAAiBC,CAAjB,CAAmB,CAAnB,CAAhC,EAAyDvC,CAAzD,CAA4D,CAC1DsC,CAAAK,OAAA,CAAwBJ,CAAxB,CAA2BA,CAA3B,CAA+B,CAA/B,CACA,MAF0D,CAH5C,CAApB,CAQGS,CARH,CAQqB,CAAA,CARrB,CAN2B,CApG7B,IAAIA,EAAmB,IAAvB,CACIP,EAAwB,EAD5B,CAGIa,EAAoB,iBAHxB,CAIIP,CAJJ,CAKIT,CA+HJ,OAAO,SAAQ,CAAC/C,CAAD,CAAQC,CAAR,CAAiBC,CAAjB,CAAuB,CAQpC8D,QAASA,EAAU,EAAG,CACpBC,CAAA,CAAU,CAAA,CACVhE,EAAAiE,YAAA,CAAoBH,CAApB,CAFoB,CARc,IAChCI,EAAexE,CAAA,CAAOO,CAAAkE,QAAP,CADiB,CAEhCH,EAAU,CAAA,CAFsB,CAGhCI,CAHgC,CAIhCC,CAJgC,CAKhCC,CALgC,CAMhCC,CAOJvE,EAAAmC,GAAA,CAAW,YAAX;AAAyB,QAAQ,CAACpB,CAAD,CAAQ,CACvCiD,CAAA,CAAU,CAAA,CACVI,EAAA,CAAarD,CAAA2C,OAAA,CAAe3C,CAAA2C,OAAf,CAA8B3C,CAAAyD,WAEjB,EAA1B,EAAGJ,CAAAK,SAAH,GACEL,CADF,CACeA,CAAAM,WADf,CAIA1E,EAAA2E,SAAA,CAAiBb,CAAjB,CAEAO,EAAA,CAAYhB,IAAAC,IAAA,EAER/B,EAAAA,CAAUR,CAAAQ,QAAA,EAAiBR,CAAAQ,QAAAC,OAAjB,CAAwCT,CAAAQ,QAAxC,CAAwD,CAACR,CAAD,CAClEU,EAAAA,CAAIF,CAAA,CAAQ,CAAR,CAAAI,cAAJF,EAAgCF,CAAA,CAAQ,CAAR,CACpC+C,EAAA,CAAc7C,CAAAG,QACd2C,EAAA,CAAc9C,CAAAI,QAfyB,CAAzC,CAkBA7B,EAAAmC,GAAA,CAAW,WAAX,CAAwB,QAAQ,CAACpB,CAAD,CAAQ,CACtCgD,CAAA,EADsC,CAAxC,CAIA/D,EAAAmC,GAAA,CAAW,aAAX,CAA0B,QAAQ,CAACpB,CAAD,CAAQ,CACxCgD,CAAA,EADwC,CAA1C,CAIA/D,EAAAmC,GAAA,CAAW,UAAX,CAAuB,QAAQ,CAACpB,CAAD,CAAQ,CACrC,IAAI6D,EAAOvB,IAAAC,IAAA,EAAPsB,CAAoBP,CAAxB,CAEI9C,EAAWR,CAAAW,eAAD,EAAyBX,CAAAW,eAAAF,OAAzB,CAAwDT,CAAAW,eAAxD,CACRX,CAAAQ,QAAD,EAAkBR,CAAAQ,QAAAC,OAAlB,CAA0CT,CAAAQ,QAA1C,CAA0D,CAACR,CAAD,CAH/D,CAIIU,EAAIF,CAAA,CAAQ,CAAR,CAAAI,cAAJF,EAAgCF,CAAA,CAAQ,CAAR,CAJpC,CAKIb,EAAIe,CAAAG,QALR,CAMIpB,EAAIiB,CAAAI,QANR,CAOIgD,EAAOvE,IAAAwE,KAAA,CAAWxE,IAAAyE,IAAA,CAASrE,CAAT;AAAa4D,CAAb,CAA0B,CAA1B,CAAX,CAA0ChE,IAAAyE,IAAA,CAASvE,CAAT,CAAa+D,CAAb,CAA0B,CAA1B,CAA1C,CAEPP,EAAJ,GAvLegB,GAuLf,CAAeJ,CAAf,EAtLiBK,EAsLjB,CAAsCJ,CAAtC,IA7DG/B,CAwED,GAvEFF,CAAA,CAAa,CAAb,CAAAsC,iBAAA,CAAiC,OAAjC,CAA0C9B,CAA1C,CAAmD,CAAA,CAAnD,CAEA,CADAR,CAAA,CAAa,CAAb,CAAAsC,iBAAA,CAAiC,YAAjC,CAA+CtB,CAA/C,CAA6D,CAAA,CAA7D,CACA,CAAAd,CAAA,CAAmB,EAqEjB,EAlEJS,CAkEI,CAlEgBF,IAAAC,IAAA,EAkEhB,CAhEJT,CAAA,CAAsBC,CAAtB,CAuDsBpC,CAvDtB,CAuDyBF,CAvDzB,CAgEI,CAJI4D,CAIJ,EAHEA,CAAAT,KAAA,EAGF,CAAKzE,CAAAiG,UAAA,CAAkBlF,CAAAmF,SAAlB,CAAL,EAA2D,CAAA,CAA3D,GAAyCnF,CAAAmF,SAAzC,EACEpF,CAAAmB,eAAA,CAAuB,OAAvB,CAAgC,CAACJ,CAAD,CAAhC,CAZJ,CAgBAgD,EAAA,EA1BqC,CAAvC,CA+BA/D,EAAAqF,QAAA,CAAkBC,QAAQ,CAACvE,CAAD,CAAQ,EAQlCf,EAAAmC,GAAA,CAAW,OAAX,CAAoB,QAAQ,CAACpB,CAAD,CAAQwE,CAAR,CAAkB,CAC5CxF,CAAAmB,OAAA,CAAa,QAAQ,EAAG,CACtBgD,CAAA,CAAanE,CAAb,CAAoB,QAAUwF,CAAV,EAAsBxE,CAAtB,CAApB,CADsB,CAAxB,CAD4C,CAA9C,CAMAf,EAAAmC,GAAA,CAAW,WAAX,CAAwB,QAAQ,CAACpB,CAAD,CAAQ,CACtCf,CAAA2E,SAAA,CAAiBb,CAAjB,CADsC,CAAxC,CAIA9D,EAAAmC,GAAA,CAAW,mBAAX,CAAgC,QAAQ,CAACpB,CAAD,CAAQ,CAC9Cf,CAAAiE,YAAA,CAAoBH,CAApB,CAD8C,CAAhD,CAxFoC,CAvIK,CADhB,CAA7B,CA4VA1E,EAAA,CAAmB,aAAnB,CAAmC,EAAnC,CAAsC,WAAtC,CACAA,EAAA,CAAmB,cAAnB,CAAmC,CAAnC,CAAsC,YAAtC,CAziBsC,CAArC,CAAA,CA6iBEH,MA7iBF;AA6iBUA,MAAAC,QA7iBV;", +"sources":["angular-touch.js"], +"names":["window","angular","undefined","makeSwipeDirective","directiveName","direction","eventName","ngTouch","directive","$parse","$swipe","MAX_VERTICAL_DISTANCE","MAX_VERTICAL_RATIO","MIN_HORIZONTAL_DISTANCE","scope","element","attr","validSwipe","coords","startCoords","deltaY","Math","abs","y","deltaX","x","valid","swipeHandler","bind","start","event","cancel","end","$apply","triggerHandler","module","factory","getCoordinates","touches","length","e","changedTouches","originalEvent","clientX","clientY","eventHandlers","totalX","totalY","lastPos","active","on","MOVE_BUFFER_RADIUS","preventDefault","config","$provide","decorator","$delegate","shift","$timeout","$rootElement","checkAllowableRegions","touchCoordinates","i","x1","CLICKBUSTER_THRESHOLD","y1","splice","onClick","Date","now","lastPreventedTime","PREVENT_DURATION","stopPropagation","target","blur","onTouchStart","push","ACTIVE_CLASS_NAME","resetState","tapping","removeClass","clickHandler","ngClick","tapElement","startTime","touchStartX","touchStartY","srcElement","nodeType","parentNode","addClass","diff","dist","sqrt","pow","TAP_DURATION","MOVE_TOLERANCE","addEventListener","isDefined","disabled","onclick","element.onclick","touchend"] +} diff --git a/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular.js b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular.js new file mode 100755 index 0000000..fc5ab04 --- /dev/null +++ b/apps/mapvisuals/static/mapvisuals/js/lib/angular/angular.js @@ -0,0 +1,20031 @@ +/** + * @license AngularJS v1.2.0 + * (c) 2010-2012 Google, Inc. http://angularjs.org + * License: MIT + */ +(function(window, document, undefined) {'use strict'; + +/** + * @description + * + * This object provides a utility for producing rich Error messages within + * Angular. It can be called as follows: + * + * var exampleMinErr = minErr('example'); + * throw exampleMinErr('one', 'This {0} is {1}', foo, bar); + * + * The above creates an instance of minErr in the example namespace. The + * resulting error will have a namespaced error code of example.one. The + * resulting error will replace {0} with the value of foo, and {1} with the + * value of bar. The object is not restricted in the number of arguments it can + * take. + * + * If fewer arguments are specified than necessary for interpolation, the extra + * interpolation markers will be preserved in the final string. + * + * Since data will be parsed statically during a build step, some restrictions + * are applied with respect to how minErr instances are created and called. + * Instances should have names of the form namespaceMinErr for a minErr created + * using minErr('namespace') . Error codes, namespaces and template strings + * should all be static strings, not variables or general expressions. + * + * @param {string} module The namespace to use for the new minErr instance. + * @returns {function(string, string, ...): Error} instance + */ + +function minErr(module) { + return function () { + var code = arguments[0], + prefix = '[' + (module ? module + ':' : '') + code + '] ', + template = arguments[1], + templateArgs = arguments, + stringify = function (obj) { + if (isFunction(obj)) { + return obj.toString().replace(/ \{[\s\S]*$/, ''); + } else if (isUndefined(obj)) { + return 'undefined'; + } else if (!isString(obj)) { + return JSON.stringify(obj); + } + return obj; + }, + message, i; + + message = prefix + template.replace(/\{\d+\}/g, function (match) { + var index = +match.slice(1, -1), arg; + + if (index + 2 < templateArgs.length) { + arg = templateArgs[index + 2]; + if (isFunction(arg)) { + return arg.toString().replace(/ ?\{[\s\S]*$/, ''); + } else if (isUndefined(arg)) { + return 'undefined'; + } else if (!isString(arg)) { + return toJson(arg); + } + return arg; + } + return match; + }); + + message = message + '\nhttp://errors.angularjs.org/' + version.full + '/' + + (module ? module + '/' : '') + code; + for (i = 2; i < arguments.length; i++) { + message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' + + encodeURIComponent(stringify(arguments[i])); + } + + return new Error(message); + }; +} + +/* We need to tell jshint what variables are being exported */ +/* global + -angular, + -msie, + -jqLite, + -jQuery, + -slice, + -push, + -toString, + -ngMinErr, + -_angular, + -angularModule, + -nodeName_, + -uid, + + -lowercase, + -uppercase, + -manualLowercase, + -manualUppercase, + -nodeName_, + -isArrayLike, + -forEach, + -sortedKeys, + -forEachSorted, + -reverseParams, + -nextUid, + -setHashKey, + -extend, + -int, + -inherit, + -noop, + -identity, + -valueFn, + -isUndefined, + -isDefined, + -isObject, + -isString, + -isNumber, + -isDate, + -isArray, + -isFunction, + -isRegExp, + -isWindow, + -isScope, + -isFile, + -isBoolean, + -trim, + -isElement, + -makeMap, + -map, + -size, + -includes, + -indexOf, + -arrayRemove, + -isLeafNode, + -copy, + -shallowCopy, + -equals, + -csp, + -concat, + -sliceArgs, + -bind, + -toJsonReplacer, + -toJson, + -fromJson, + -toBoolean, + -startingTag, + -tryDecodeURIComponent, + -parseKeyValue, + -toKeyValue, + -encodeUriSegment, + -encodeUriQuery, + -angularInit, + -bootstrap, + -snake_case, + -bindJQuery, + -assertArg, + -assertArgFn, + -assertNotHasOwnProperty, + -getter, + -getBlockElements + +*/ + +//////////////////////////////////// + +/** + * @ngdoc function + * @name angular.lowercase + * @function + * + * @description Converts the specified string to lowercase. + * @param {string} string String to be converted to lowercase. + * @returns {string} Lowercased string. + */ +var lowercase = function(string){return isString(string) ? string.toLowerCase() : string;}; + + +/** + * @ngdoc function + * @name angular.uppercase + * @function + * + * @description Converts the specified string to uppercase. + * @param {string} string String to be converted to uppercase. + * @returns {string} Uppercased string. + */ +var uppercase = function(string){return isString(string) ? string.toUpperCase() : string;}; + + +var manualLowercase = function(s) { + /* jshint bitwise: false */ + return isString(s) + ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);}) + : s; +}; +var manualUppercase = function(s) { + /* jshint bitwise: false */ + return isString(s) + ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);}) + : s; +}; + + +// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish +// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods +// with correct but slower alternatives. +if ('i' !== 'I'.toLowerCase()) { + lowercase = manualLowercase; + uppercase = manualUppercase; +} + + +var /** holds major version number for IE or NaN for real browsers */ + msie, + jqLite, // delay binding since jQuery could be loaded after us. + jQuery, // delay binding + slice = [].slice, + push = [].push, + toString = Object.prototype.toString, + ngMinErr = minErr('ng'), + + + _angular = window.angular, + /** @name angular */ + angular = window.angular || (window.angular = {}), + angularModule, + nodeName_, + uid = ['0', '0', '0']; + +/** + * IE 11 changed the format of the UserAgent string. + * See http://msdn.microsoft.com/en-us/library/ms537503.aspx + */ +msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]); +if (isNaN(msie)) { + msie = int((/trident\/.*; rv:(\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]); +} + + +/** + * @private + * @param {*} obj + * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, + * String ...) + */ +function isArrayLike(obj) { + if (obj == null || isWindow(obj)) { + return false; + } + + var length = obj.length; + + if (obj.nodeType === 1 && length) { + return true; + } + + return isString(obj) || isArray(obj) || length === 0 || + typeof length === 'number' && length > 0 && (length - 1) in obj; +} + +/** + * @ngdoc function + * @name angular.forEach + * @function + * + * @description + * Invokes the `iterator` function once for each item in `obj` collection, which can be either an + * object or an array. The `iterator` function is invoked with `iterator(value, key)`, where `value` + * is the value of an object property or an array element and `key` is the object property key or + * array element index. Specifying a `context` for the function is optional. + * + * Note: this function was previously known as `angular.foreach`. + * +
+     var values = {name: 'misko', gender: 'male'};
+     var log = [];
+     angular.forEach(values, function(value, key){
+       this.push(key + ': ' + value);
+     }, log);
+     expect(log).toEqual(['name: misko', 'gender:male']);
+   
+ * + * @param {Object|Array} obj Object to iterate over. + * @param {Function} iterator Iterator function. + * @param {Object=} context Object to become context (`this`) for the iterator function. + * @returns {Object|Array} Reference to `obj`. + */ +function forEach(obj, iterator, context) { + var key; + if (obj) { + if (isFunction(obj)){ + for (key in obj) { + if (key != 'prototype' && key != 'length' && key != 'name' && obj.hasOwnProperty(key)) { + iterator.call(context, obj[key], key); + } + } + } else if (obj.forEach && obj.forEach !== forEach) { + obj.forEach(iterator, context); + } else if (isArrayLike(obj)) { + for (key = 0; key < obj.length; key++) + iterator.call(context, obj[key], key); + } else { + for (key in obj) { + if (obj.hasOwnProperty(key)) { + iterator.call(context, obj[key], key); + } + } + } + } + return obj; +} + +function sortedKeys(obj) { + var keys = []; + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + keys.push(key); + } + } + return keys.sort(); +} + +function forEachSorted(obj, iterator, context) { + var keys = sortedKeys(obj); + for ( var i = 0; i < keys.length; i++) { + iterator.call(context, obj[keys[i]], keys[i]); + } + return keys; +} + + +/** + * when using forEach the params are value, key, but it is often useful to have key, value. + * @param {function(string, *)} iteratorFn + * @returns {function(*, string)} + */ +function reverseParams(iteratorFn) { + return function(value, key) { iteratorFn(key, value); }; +} + +/** + * A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric + * characters such as '012ABC'. The reason why we are not using simply a number counter is that + * the number string gets longer over time, and it can also overflow, where as the nextId + * will grow much slower, it is a string, and it will never overflow. + * + * @returns an unique alpha-numeric string + */ +function nextUid() { + var index = uid.length; + var digit; + + while(index) { + index--; + digit = uid[index].charCodeAt(0); + if (digit == 57 /*'9'*/) { + uid[index] = 'A'; + return uid.join(''); + } + if (digit == 90 /*'Z'*/) { + uid[index] = '0'; + } else { + uid[index] = String.fromCharCode(digit + 1); + return uid.join(''); + } + } + uid.unshift('0'); + return uid.join(''); +} + + +/** + * Set or clear the hashkey for an object. + * @param obj object + * @param h the hashkey (!truthy to delete the hashkey) + */ +function setHashKey(obj, h) { + if (h) { + obj.$$hashKey = h; + } + else { + delete obj.$$hashKey; + } +} + +/** + * @ngdoc function + * @name angular.extend + * @function + * + * @description + * Extends the destination object `dst` by copying all of the properties from the `src` object(s) + * to `dst`. You can specify multiple `src` objects. + * + * @param {Object} dst Destination object. + * @param {...Object} src Source object(s). + * @returns {Object} Reference to `dst`. + */ +function extend(dst) { + var h = dst.$$hashKey; + forEach(arguments, function(obj){ + if (obj !== dst) { + forEach(obj, function(value, key){ + dst[key] = value; + }); + } + }); + + setHashKey(dst,h); + return dst; +} + +function int(str) { + return parseInt(str, 10); +} + + +function inherit(parent, extra) { + return extend(new (extend(function() {}, {prototype:parent}))(), extra); +} + +/** + * @ngdoc function + * @name angular.noop + * @function + * + * @description + * A function that performs no operations. This function can be useful when writing code in the + * functional style. +
+     function foo(callback) {
+       var result = calculateResult();
+       (callback || angular.noop)(result);
+     }
+   
+ */ +function noop() {} +noop.$inject = []; + + +/** + * @ngdoc function + * @name angular.identity + * @function + * + * @description + * A function that returns its first argument. This function is useful when writing code in the + * functional style. + * +
+     function transformer(transformationFn, value) {
+       return (transformationFn || angular.identity)(value);
+     };
+   
+ */ +function identity($) {return $;} +identity.$inject = []; + + +function valueFn(value) {return function() {return value;};} + +/** + * @ngdoc function + * @name angular.isUndefined + * @function + * + * @description + * Determines if a reference is undefined. + * + * @param {*} value Reference to check. + * @returns {boolean} True if `value` is undefined. + */ +function isUndefined(value){return typeof value == 'undefined';} + + +/** + * @ngdoc function + * @name angular.isDefined + * @function + * + * @description + * Determines if a reference is defined. + * + * @param {*} value Reference to check. + * @returns {boolean} True if `value` is defined. + */ +function isDefined(value){return typeof value != 'undefined';} + + +/** + * @ngdoc function + * @name angular.isObject + * @function + * + * @description + * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not + * considered to be objects. + * + * @param {*} value Reference to check. + * @returns {boolean} True if `value` is an `Object` but not `null`. + */ +function isObject(value){return value != null && typeof value == 'object';} + + +/** + * @ngdoc function + * @name angular.isString + * @function + * + * @description + * Determines if a reference is a `String`. + * + * @param {*} value Reference to check. + * @returns {boolean} True if `value` is a `String`. + */ +function isString(value){return typeof value == 'string';} + + +/** + * @ngdoc function + * @name angular.isNumber + * @function + * + * @description + * Determines if a reference is a `Number`. + * + * @param {*} value Reference to check. + * @returns {boolean} True if `value` is a `Number`. + */ +function isNumber(value){return typeof value == 'number';} + + +/** + * @ngdoc function + * @name angular.isDate + * @function + * + * @description + * Determines if a value is a date. + * + * @param {*} value Reference to check. + * @returns {boolean} True if `value` is a `Date`. + */ +function isDate(value){ + return toString.apply(value) == '[object Date]'; +} + + +/** + * @ngdoc function + * @name angular.isArray + * @function + * + * @description + * Determines if a reference is an `Array`. + * + * @param {*} value Reference to check. + * @returns {boolean} True if `value` is an `Array`. + */ +function isArray(value) { + return toString.apply(value) == '[object Array]'; +} + + +/** + * @ngdoc function + * @name angular.isFunction + * @function + * + * @description + * Determines if a reference is a `Function`. + * + * @param {*} value Reference to check. + * @returns {boolean} True if `value` is a `Function`. + */ +function isFunction(value){return typeof value == 'function';} + + +/** + * Determines if a value is a regular expression object. + * + * @private + * @param {*} value Reference to check. + * @returns {boolean} True if `value` is a `RegExp`. + */ +function isRegExp(value) { + return toString.apply(value) == '[object RegExp]'; +} + + +/** + * Checks if `obj` is a window object. + * + * @private + * @param {*} obj Object to check + * @returns {boolean} True if `obj` is a window obj. + */ +function isWindow(obj) { + return obj && obj.document && obj.location && obj.alert && obj.setInterval; +} + + +function isScope(obj) { + return obj && obj.$evalAsync && obj.$watch; +} + + +function isFile(obj) { + return toString.apply(obj) === '[object File]'; +} + + +function isBoolean(value) { + return typeof value == 'boolean'; +} + + +var trim = (function() { + // native trim is way faster: http://jsperf.com/angular-trim-test + // but IE doesn't have it... :-( + // TODO: we should move this into IE/ES5 polyfill + if (!String.prototype.trim) { + return function(value) { + return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value; + }; + } + return function(value) { + return isString(value) ? value.trim() : value; + }; +})(); + + +/** + * @ngdoc function + * @name angular.isElement + * @function + * + * @description + * Determines if a reference is a DOM element (or wrapped jQuery element). + * + * @param {*} value Reference to check. + * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element). + */ +function isElement(node) { + return node && + (node.nodeName // we are a direct element + || (node.on && node.find)); // we have an on and find method part of jQuery API +} + +/** + * @param str 'key1,key2,...' + * @returns {object} in the form of {key1:true, key2:true, ...} + */ +function makeMap(str){ + var obj = {}, items = str.split(","), i; + for ( i = 0; i < items.length; i++ ) + obj[ items[i] ] = true; + return obj; +} + + +if (msie < 9) { + nodeName_ = function(element) { + element = element.nodeName ? element : element[0]; + return (element.scopeName && element.scopeName != 'HTML') + ? uppercase(element.scopeName + ':' + element.nodeName) : element.nodeName; + }; +} else { + nodeName_ = function(element) { + return element.nodeName ? element.nodeName : element[0].nodeName; + }; +} + + +function map(obj, iterator, context) { + var results = []; + forEach(obj, function(value, index, list) { + results.push(iterator.call(context, value, index, list)); + }); + return results; +} + + +/** + * @description + * Determines the number of elements in an array, the number of properties an object has, or + * the length of a string. + * + * Note: This function is used to augment the Object type in Angular expressions. See + * {@link angular.Object} for more information about Angular arrays. + * + * @param {Object|Array|string} obj Object, array, or string to inspect. + * @param {boolean} [ownPropsOnly=false] Count only "own" properties in an object + * @returns {number} The size of `obj` or `0` if `obj` is neither an object nor an array. + */ +function size(obj, ownPropsOnly) { + var count = 0, key; + + if (isArray(obj) || isString(obj)) { + return obj.length; + } else if (isObject(obj)){ + for (key in obj) + if (!ownPropsOnly || obj.hasOwnProperty(key)) + count++; + } + + return count; +} + + +function includes(array, obj) { + return indexOf(array, obj) != -1; +} + +function indexOf(array, obj) { + if (array.indexOf) return array.indexOf(obj); + + for ( var i = 0; i < array.length; i++) { + if (obj === array[i]) return i; + } + return -1; +} + +function arrayRemove(array, value) { + var index = indexOf(array, value); + if (index >=0) + array.splice(index, 1); + return value; +} + +function isLeafNode (node) { + if (node) { + switch (node.nodeName) { + case "OPTION": + case "PRE": + case "TITLE": + return true; + } + } + return false; +} + +/** + * @ngdoc function + * @name angular.copy + * @function + * + * @description + * Creates a deep copy of `source`, which should be an object or an array. + * + * * If no destination is supplied, a copy of the object or array is created. + * * If a destination is provided, all of its elements (for array) or properties (for objects) + * are deleted and then all elements/properties from the source are copied to it. + * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned. + * * If `source` is identical to 'destination' an exception will be thrown. + * + * @param {*} source The source that will be used to make a copy. + * Can be any type, including primitives, `null`, and `undefined`. + * @param {(Object|Array)=} destination Destination into which the source is copied. If + * provided, must be of the same type as `source`. + * @returns {*} The copy or updated `destination`, if `destination` was specified. + * + * @example + + +
+
+ Name:
+ E-mail:
+ Gender: male + female
+ + +
+
form = {{user | json}}
+
master = {{master | json}}
+
+ + +
+
+ */ +function copy(source, destination){ + if (isWindow(source) || isScope(source)) { + throw ngMinErr('cpws', + "Can't copy! Making copies of Window or Scope instances is not supported."); + } + + if (!destination) { + destination = source; + if (source) { + if (isArray(source)) { + destination = copy(source, []); + } else if (isDate(source)) { + destination = new Date(source.getTime()); + } else if (isRegExp(source)) { + destination = new RegExp(source.source); + } else if (isObject(source)) { + destination = copy(source, {}); + } + } + } else { + if (source === destination) throw ngMinErr('cpi', + "Can't copy! Source and destination are identical."); + if (isArray(source)) { + destination.length = 0; + for ( var i = 0; i < source.length; i++) { + destination.push(copy(source[i])); + } + } else { + var h = destination.$$hashKey; + forEach(destination, function(value, key){ + delete destination[key]; + }); + for ( var key in source) { + destination[key] = copy(source[key]); + } + setHashKey(destination,h); + } + } + return destination; +} + +/** + * Create a shallow copy of an object + */ +function shallowCopy(src, dst) { + dst = dst || {}; + + for(var key in src) { + // shallowCopy is only ever called by $compile nodeLinkFn, which has control over src + // so we don't need to worry hasOwnProperty here + if (src.hasOwnProperty(key) && key.substr(0, 2) !== '$$') { + dst[key] = src[key]; + } + } + + return dst; +} + + +/** + * @ngdoc function + * @name angular.equals + * @function + * + * @description + * Determines if two objects or two values are equivalent. Supports value types, regular + * expressions, arrays and objects. + * + * Two objects or values are considered equivalent if at least one of the following is true: + * + * * Both objects or values pass `===` comparison. + * * Both objects or values are of the same type and all of their properties are equal by + * comparing them with `angular.equals`. + * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal) + * * Both values represent the same regular expression (In JavasScript, + * /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual + * representation matches). + * + * During a property comparison, properties of `function` type and properties with names + * that begin with `$` are ignored. + * + * Scope and DOMWindow objects are being compared only by identify (`===`). + * + * @param {*} o1 Object or value to compare. + * @param {*} o2 Object or value to compare. + * @returns {boolean} True if arguments are equal. + */ +function equals(o1, o2) { + if (o1 === o2) return true; + if (o1 === null || o2 === null) return false; + if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN + var t1 = typeof o1, t2 = typeof o2, length, key, keySet; + if (t1 == t2) { + if (t1 == 'object') { + if (isArray(o1)) { + if (!isArray(o2)) return false; + if ((length = o1.length) == o2.length) { + for(key=0; key 2 ? sliceArgs(arguments, 2) : []; + if (isFunction(fn) && !(fn instanceof RegExp)) { + return curryArgs.length + ? function() { + return arguments.length + ? fn.apply(self, curryArgs.concat(slice.call(arguments, 0))) + : fn.apply(self, curryArgs); + } + : function() { + return arguments.length + ? fn.apply(self, arguments) + : fn.call(self); + }; + } else { + // in IE, native methods are not functions so they cannot be bound (note: they don't need to be) + return fn; + } +} + + +function toJsonReplacer(key, value) { + var val = value; + + if (typeof key === 'string' && key.charAt(0) === '$') { + val = undefined; + } else if (isWindow(value)) { + val = '$WINDOW'; + } else if (value && document === value) { + val = '$DOCUMENT'; + } else if (isScope(value)) { + val = '$SCOPE'; + } + + return val; +} + + +/** + * @ngdoc function + * @name angular.toJson + * @function + * + * @description + * Serializes input into a JSON-formatted string. Properties with leading $ characters will be + * stripped since angular uses this notation internally. + * + * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON. + * @param {boolean=} pretty If set to true, the JSON output will contain newlines and whitespace. + * @returns {string|undefined} JSON-ified string representing `obj`. + */ +function toJson(obj, pretty) { + if (typeof obj === 'undefined') return undefined; + return JSON.stringify(obj, toJsonReplacer, pretty ? ' ' : null); +} + + +/** + * @ngdoc function + * @name angular.fromJson + * @function + * + * @description + * Deserializes a JSON string. + * + * @param {string} json JSON string to deserialize. + * @returns {Object|Array|Date|string|number} Deserialized thingy. + */ +function fromJson(json) { + return isString(json) + ? JSON.parse(json) + : json; +} + + +function toBoolean(value) { + if (value && value.length !== 0) { + var v = lowercase("" + value); + value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]'); + } else { + value = false; + } + return value; +} + +/** + * @returns {string} Returns the string representation of the element. + */ +function startingTag(element) { + element = jqLite(element).clone(); + try { + // turns out IE does not let you set .html() on elements which + // are not allowed to have children. So we just ignore it. + element.html(''); + } catch(e) {} + // As Per DOM Standards + var TEXT_NODE = 3; + var elemHtml = jqLite('
').append(element).html(); + try { + return element[0].nodeType === TEXT_NODE ? lowercase(elemHtml) : + elemHtml. + match(/^(<[^>]+>)/)[1]. + replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); }); + } catch(e) { + return lowercase(elemHtml); + } + +} + + +///////////////////////////////////////////////// + +/** + * Tries to decode the URI component without throwing an exception. + * + * @private + * @param str value potential URI component to check. + * @returns {boolean} True if `value` can be decoded + * with the decodeURIComponent function. + */ +function tryDecodeURIComponent(value) { + try { + return decodeURIComponent(value); + } catch(e) { + // Ignore any invalid uri component + } +} + + +/** + * Parses an escaped url query string into key-value pairs. + * @returns Object.<(string|boolean)> + */ +function parseKeyValue(/**string*/keyValue) { + var obj = {}, key_value, key; + forEach((keyValue || "").split('&'), function(keyValue){ + if ( keyValue ) { + key_value = keyValue.split('='); + key = tryDecodeURIComponent(key_value[0]); + if ( isDefined(key) ) { + var val = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true; + if (!obj[key]) { + obj[key] = val; + } else if(isArray(obj[key])) { + obj[key].push(val); + } else { + obj[key] = [obj[key],val]; + } + } + } + }); + return obj; +} + +function toKeyValue(obj) { + var parts = []; + forEach(obj, function(value, key) { + if (isArray(value)) { + forEach(value, function(arrayValue) { + parts.push(encodeUriQuery(key, true) + + (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true))); + }); + } else { + parts.push(encodeUriQuery(key, true) + + (value === true ? '' : '=' + encodeUriQuery(value, true))); + } + }); + return parts.length ? parts.join('&') : ''; +} + + +/** + * We need our custom method because encodeURIComponent is too aggressive and doesn't follow + * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path + * segments: + * segment = *pchar + * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" + * pct-encoded = "%" HEXDIG HEXDIG + * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" + * / "*" / "+" / "," / ";" / "=" + */ +function encodeUriSegment(val) { + return encodeUriQuery(val, true). + replace(/%26/gi, '&'). + replace(/%3D/gi, '='). + replace(/%2B/gi, '+'); +} + + +/** + * This method is intended for encoding *key* or *value* parts of query component. We need a custom + * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be + * encoded per http://tools.ietf.org/html/rfc3986: + * query = *( pchar / "/" / "?" ) + * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" + * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + * pct-encoded = "%" HEXDIG HEXDIG + * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" + * / "*" / "+" / "," / ";" / "=" + */ +function encodeUriQuery(val, pctEncodeSpaces) { + return encodeURIComponent(val). + replace(/%40/gi, '@'). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, (pctEncodeSpaces ? '%20' : '+')); +} + + +/** + * @ngdoc directive + * @name ng.directive:ngApp + * + * @element ANY + * @param {angular.Module} ngApp an optional application + * {@link angular.module module} name to load. + * + * @description + * + * Use this directive to auto-bootstrap an application. Only + * one ngApp directive can be used per HTML document. The directive + * designates the root of the application and is typically placed + * at the root of the page. + * + * The first ngApp found in the document will be auto-bootstrapped. To use multiple applications in + * an HTML document you must manually bootstrap them using {@link angular.bootstrap}. + * Applications cannot be nested. + * + * In the example below if the `ngApp` directive were not placed + * on the `html` element then the document would not be compiled + * and the `{{ 1+2 }}` would not be resolved to `3`. + * + * `ngApp` is the easiest way to bootstrap an application. + * + + + I can add: 1 + 2 = {{ 1+2 }} + + + * + */ +function angularInit(element, bootstrap) { + var elements = [element], + appElement, + module, + names = ['ng:app', 'ng-app', 'x-ng-app', 'data-ng-app'], + NG_APP_CLASS_REGEXP = /\sng[:\-]app(:\s*([\w\d_]+);?)?\s/; + + function append(element) { + element && elements.push(element); + } + + forEach(names, function(name) { + names[name] = true; + append(document.getElementById(name)); + name = name.replace(':', '\\:'); + if (element.querySelectorAll) { + forEach(element.querySelectorAll('.' + name), append); + forEach(element.querySelectorAll('.' + name + '\\:'), append); + forEach(element.querySelectorAll('[' + name + ']'), append); + } + }); + + forEach(elements, function(element) { + if (!appElement) { + var className = ' ' + element.className + ' '; + var match = NG_APP_CLASS_REGEXP.exec(className); + if (match) { + appElement = element; + module = (match[2] || '').replace(/\s+/g, ','); + } else { + forEach(element.attributes, function(attr) { + if (!appElement && names[attr.name]) { + appElement = element; + module = attr.value; + } + }); + } + } + }); + if (appElement) { + bootstrap(appElement, module ? [module] : []); + } +} + +/** + * @ngdoc function + * @name angular.bootstrap + * @description + * Use this function to manually start up angular application. + * + * See: {@link guide/bootstrap Bootstrap} + * + * Note that ngScenario-based end-to-end tests cannot use this function to bootstrap manually. + * They must use {@link api/ng.directive:ngApp ngApp}. + * + * @param {Element} element DOM element which is the root of angular application. + * @param {Array=} modules an array of modules to load into the application. + * Each item in the array should be the name of a predefined module or a (DI annotated) + * function that will be invoked by the injector as a run block. + * See: {@link angular.module modules} + * @returns {AUTO.$injector} Returns the newly created injector for this app. + */ +function bootstrap(element, modules) { + var doBootstrap = function() { + element = jqLite(element); + + if (element.injector()) { + var tag = (element[0] === document) ? 'document' : startingTag(element); + throw ngMinErr('btstrpd', "App Already Bootstrapped with this Element '{0}'", tag); + } + + modules = modules || []; + modules.unshift(['$provide', function($provide) { + $provide.value('$rootElement', element); + }]); + modules.unshift('ng'); + var injector = createInjector(modules); + injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector', '$animate', + function(scope, element, compile, injector, animate) { + scope.$apply(function() { + element.data('$injector', injector); + compile(element)(scope); + }); + }] + ); + return injector; + }; + + var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/; + + if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) { + return doBootstrap(); + } + + window.name = window.name.replace(NG_DEFER_BOOTSTRAP, ''); + angular.resumeBootstrap = function(extraModules) { + forEach(extraModules, function(module) { + modules.push(module); + }); + doBootstrap(); + }; +} + +var SNAKE_CASE_REGEXP = /[A-Z]/g; +function snake_case(name, separator){ + separator = separator || '_'; + return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) { + return (pos ? separator : '') + letter.toLowerCase(); + }); +} + +function bindJQuery() { + // bind to jQuery if present; + jQuery = window.jQuery; + // reset to jQuery or default to us. + if (jQuery) { + jqLite = jQuery; + extend(jQuery.fn, { + scope: JQLitePrototype.scope, + isolateScope: JQLitePrototype.isolateScope, + controller: JQLitePrototype.controller, + injector: JQLitePrototype.injector, + inheritedData: JQLitePrototype.inheritedData + }); + // Method signature: + // jqLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments) + jqLitePatchJQueryRemove('remove', true, true, false); + jqLitePatchJQueryRemove('empty', false, false, false); + jqLitePatchJQueryRemove('html', false, false, true); + } else { + jqLite = JQLite; + } + angular.element = jqLite; +} + +/** + * throw error if the argument is falsy. + */ +function assertArg(arg, name, reason) { + if (!arg) { + throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required")); + } + return arg; +} + +function assertArgFn(arg, name, acceptArrayAnnotation) { + if (acceptArrayAnnotation && isArray(arg)) { + arg = arg[arg.length - 1]; + } + + assertArg(isFunction(arg), name, 'not a function, got ' + + (arg && typeof arg == 'object' ? arg.constructor.name || 'Object' : typeof arg)); + return arg; +} + +/** + * throw error if the name given is hasOwnProperty + * @param {String} name the name to test + * @param {String} context the context in which the name is used, such as module or directive + */ +function assertNotHasOwnProperty(name, context) { + if (name === 'hasOwnProperty') { + throw ngMinErr('badname', "hasOwnProperty is not a valid {0} name", context); + } +} + +/** + * Return the value accessible from the object by path. Any undefined traversals are ignored + * @param {Object} obj starting object + * @param {string} path path to traverse + * @param {boolean=true} bindFnToScope + * @returns value as accessible by path + */ +//TODO(misko): this function needs to be removed +function getter(obj, path, bindFnToScope) { + if (!path) return obj; + var keys = path.split('.'); + var key; + var lastInstance = obj; + var len = keys.length; + + for (var i = 0; i < len; i++) { + key = keys[i]; + if (obj) { + obj = (lastInstance = obj)[key]; + } + } + if (!bindFnToScope && isFunction(obj)) { + return bind(lastInstance, obj); + } + return obj; +} + +/** + * Return the siblings between `startNode` and `endNode`, inclusive + * @param {Object} object with `startNode` and `endNode` properties + * @returns jQlite object containing the elements + */ +function getBlockElements(block) { + if (block.startNode === block.endNode) { + return jqLite(block.startNode); + } + + var element = block.startNode; + var elements = [element]; + + do { + element = element.nextSibling; + if (!element) break; + elements.push(element); + } while (element !== block.endNode); + + return jqLite(elements); +} + +/** + * @ngdoc interface + * @name angular.Module + * @description + * + * Interface for configuring angular {@link angular.module modules}. + */ + +function setupModuleLoader(window) { + + var $injectorMinErr = minErr('$injector'); + + function ensure(obj, name, factory) { + return obj[name] || (obj[name] = factory()); + } + + return ensure(ensure(window, 'angular', Object), 'module', function() { + /** @type {Object.} */ + var modules = {}; + + /** + * @ngdoc function + * @name angular.module + * @description + * + * The `angular.module` is a global place for creating, registering and retrieving Angular + * modules. + * All modules (angular core or 3rd party) that should be available to an application must be + * registered using this mechanism. + * + * When passed two or more arguments, a new module is created. If passed only one argument, an + * existing module (the name passed as the first argument to `module`) is retrieved. + * + * + * # Module + * + * A module is a collection of services, directives, filters, and configuration information. + * `angular.module` is used to configure the {@link AUTO.$injector $injector}. + * + *
+     * // Create a new module
+     * var myModule = angular.module('myModule', []);
+     *
+     * // register a new service
+     * myModule.value('appName', 'MyCoolApp');
+     *
+     * // configure existing services inside initialization blocks.
+     * myModule.config(function($locationProvider) {
+     *   // Configure existing providers
+     *   $locationProvider.hashPrefix('!');
+     * });
+     * 
+ * + * Then you can create an injector and load your modules like this: + * + *
+     * var injector = angular.injector(['ng', 'MyModule'])
+     * 
+ * + * However it's more likely that you'll just use + * {@link ng.directive:ngApp ngApp} or + * {@link angular.bootstrap} to simplify this process for you. + * + * @param {!string} name The name of the module to create or retrieve. + * @param {Array.=} requires If specified then new module is being created. If + * unspecified then the the module is being retrieved for further configuration. + * @param {Function} configFn Optional configuration function for the module. Same as + * {@link angular.Module#methods_config Module#config()}. + * @returns {module} new module with the {@link angular.Module} api. + */ + return function module(name, requires, configFn) { + assertNotHasOwnProperty(name, 'module'); + if (requires && modules.hasOwnProperty(name)) { + modules[name] = null; + } + return ensure(modules, name, function() { + if (!requires) { + throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " + + "the module name or forgot to load it. If registering a module ensure that you " + + "specify the dependencies as the second argument.", name); + } + + /** @type {!Array.>} */ + var invokeQueue = []; + + /** @type {!Array.} */ + var runBlocks = []; + + var config = invokeLater('$injector', 'invoke'); + + /** @type {angular.Module} */ + var moduleInstance = { + // Private state + _invokeQueue: invokeQueue, + _runBlocks: runBlocks, + + /** + * @ngdoc property + * @name angular.Module#requires + * @propertyOf angular.Module + * @returns {Array.} List of module names which must be loaded before this module. + * @description + * Holds the list of modules which the injector will load before the current module is + * loaded. + */ + requires: requires, + + /** + * @ngdoc property + * @name angular.Module#name + * @propertyOf angular.Module + * @returns {string} Name of the module. + * @description + */ + name: name, + + + /** + * @ngdoc method + * @name angular.Module#provider + * @methodOf angular.Module + * @param {string} name service name + * @param {Function} providerType Construction function for creating new instance of the + * service. + * @description + * See {@link AUTO.$provide#provider $provide.provider()}. + */ + provider: invokeLater('$provide', 'provider'), + + /** + * @ngdoc method + * @name angular.Module#factory + * @methodOf angular.Module + * @param {string} name service name + * @param {Function} providerFunction Function for creating new instance of the service. + * @description + * See {@link AUTO.$provide#factory $provide.factory()}. + */ + factory: invokeLater('$provide', 'factory'), + + /** + * @ngdoc method + * @name angular.Module#service + * @methodOf angular.Module + * @param {string} name service name + * @param {Function} constructor A constructor function that will be instantiated. + * @description + * See {@link AUTO.$provide#service $provide.service()}. + */ + service: invokeLater('$provide', 'service'), + + /** + * @ngdoc method + * @name angular.Module#value + * @methodOf angular.Module + * @param {string} name service name + * @param {*} object Service instance object. + * @description + * See {@link AUTO.$provide#value $provide.value()}. + */ + value: invokeLater('$provide', 'value'), + + /** + * @ngdoc method + * @name angular.Module#constant + * @methodOf angular.Module + * @param {string} name constant name + * @param {*} object Constant value. + * @description + * Because the constant are fixed, they get applied before other provide methods. + * See {@link AUTO.$provide#constant $provide.constant()}. + */ + constant: invokeLater('$provide', 'constant', 'unshift'), + + /** + * @ngdoc method + * @name angular.Module#animation + * @methodOf angular.Module + * @param {string} name animation name + * @param {Function} animationFactory Factory function for creating new instance of an + * animation. + * @description + * + * **NOTE**: animations take effect only if the **ngAnimate** module is loaded. + * + * + * Defines an animation hook that can be later used with + * {@link ngAnimate.$animate $animate} service and directives that use this service. + * + *
+           * module.animation('.animation-name', function($inject1, $inject2) {
+           *   return {
+           *     eventName : function(element, done) {
+           *       //code to run the animation
+           *       //once complete, then run done()
+           *       return function cancellationFunction(element) {
+           *         //code to cancel the animation
+           *       }
+           *     }
+           *   }
+           * })
+           * 
+ * + * See {@link ngAnimate.$animateProvider#register $animateProvider.register()} and + * {@link ngAnimate ngAnimate module} for more information. + */ + animation: invokeLater('$animateProvider', 'register'), + + /** + * @ngdoc method + * @name angular.Module#filter + * @methodOf angular.Module + * @param {string} name Filter name. + * @param {Function} filterFactory Factory function for creating new instance of filter. + * @description + * See {@link ng.$filterProvider#register $filterProvider.register()}. + */ + filter: invokeLater('$filterProvider', 'register'), + + /** + * @ngdoc method + * @name angular.Module#controller + * @methodOf angular.Module + * @param {string|Object} name Controller name, or an object map of controllers where the + * keys are the names and the values are the constructors. + * @param {Function} constructor Controller constructor function. + * @description + * See {@link ng.$controllerProvider#register $controllerProvider.register()}. + */ + controller: invokeLater('$controllerProvider', 'register'), + + /** + * @ngdoc method + * @name angular.Module#directive + * @methodOf angular.Module + * @param {string|Object} name Directive name, or an object map of directives where the + * keys are the names and the values are the factories. + * @param {Function} directiveFactory Factory function for creating new instance of + * directives. + * @description + * See {@link ng.$compileProvider#methods_directive $compileProvider.directive()}. + */ + directive: invokeLater('$compileProvider', 'directive'), + + /** + * @ngdoc method + * @name angular.Module#config + * @methodOf angular.Module + * @param {Function} configFn Execute this function on module load. Useful for service + * configuration. + * @description + * Use this method to register work which needs to be performed on module loading. + */ + config: config, + + /** + * @ngdoc method + * @name angular.Module#run + * @methodOf angular.Module + * @param {Function} initializationFn Execute this function after injector creation. + * Useful for application initialization. + * @description + * Use this method to register work which should be performed when the injector is done + * loading all modules. + */ + run: function(block) { + runBlocks.push(block); + return this; + } + }; + + if (configFn) { + config(configFn); + } + + return moduleInstance; + + /** + * @param {string} provider + * @param {string} method + * @param {String=} insertMethod + * @returns {angular.Module} + */ + function invokeLater(provider, method, insertMethod) { + return function() { + invokeQueue[insertMethod || 'push']([provider, method, arguments]); + return moduleInstance; + }; + } + }); + }; + }); + +} + +/* global + angularModule: true, + version: true, + + $LocaleProvider, + $CompileProvider, + + htmlAnchorDirective, + inputDirective, + inputDirective, + formDirective, + scriptDirective, + selectDirective, + styleDirective, + optionDirective, + ngBindDirective, + ngBindHtmlDirective, + ngBindTemplateDirective, + ngClassDirective, + ngClassEvenDirective, + ngClassOddDirective, + ngCspDirective, + ngCloakDirective, + ngControllerDirective, + ngFormDirective, + ngHideDirective, + ngIfDirective, + ngIncludeDirective, + ngInitDirective, + ngNonBindableDirective, + ngPluralizeDirective, + ngRepeatDirective, + ngShowDirective, + ngStyleDirective, + ngSwitchDirective, + ngSwitchWhenDirective, + ngSwitchDefaultDirective, + ngOptionsDirective, + ngTranscludeDirective, + ngModelDirective, + ngListDirective, + ngChangeDirective, + requiredDirective, + requiredDirective, + ngValueDirective, + ngAttributeAliasDirectives, + ngEventDirectives, + + $AnchorScrollProvider, + $AnimateProvider, + $BrowserProvider, + $CacheFactoryProvider, + $ControllerProvider, + $DocumentProvider, + $ExceptionHandlerProvider, + $FilterProvider, + $InterpolateProvider, + $IntervalProvider, + $HttpProvider, + $HttpBackendProvider, + $LocationProvider, + $LogProvider, + $ParseProvider, + $RootScopeProvider, + $QProvider, + $SceProvider, + $SceDelegateProvider, + $SnifferProvider, + $TemplateCacheProvider, + $TimeoutProvider, + $WindowProvider +*/ + + +/** + * @ngdoc property + * @name angular.version + * @description + * An object that contains information about the current AngularJS version. This object has the + * following properties: + * + * - `full` – `{string}` – Full version string, such as "0.9.18". + * - `major` – `{number}` – Major version number, such as "0". + * - `minor` – `{number}` – Minor version number, such as "9". + * - `dot` – `{number}` – Dot version number, such as "18". + * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". + */ +var version = { + full: '1.2.0', // all of these placeholder strings will be replaced by grunt's + major: 1, // package task + minor: "NG_VERSION_MINOR", + dot: 0, + codeName: 'timely-delivery' +}; + + +function publishExternalAPI(angular){ + extend(angular, { + 'bootstrap': bootstrap, + 'copy': copy, + 'extend': extend, + 'equals': equals, + 'element': jqLite, + 'forEach': forEach, + 'injector': createInjector, + 'noop':noop, + 'bind':bind, + 'toJson': toJson, + 'fromJson': fromJson, + 'identity':identity, + 'isUndefined': isUndefined, + 'isDefined': isDefined, + 'isString': isString, + 'isFunction': isFunction, + 'isObject': isObject, + 'isNumber': isNumber, + 'isElement': isElement, + 'isArray': isArray, + 'version': version, + 'isDate': isDate, + 'lowercase': lowercase, + 'uppercase': uppercase, + 'callbacks': {counter: 0}, + '$$minErr': minErr, + '$$csp': csp + }); + + angularModule = setupModuleLoader(window); + try { + angularModule('ngLocale'); + } catch (e) { + angularModule('ngLocale', []).provider('$locale', $LocaleProvider); + } + + angularModule('ng', ['ngLocale'], ['$provide', + function ngModule($provide) { + $provide.provider('$compile', $CompileProvider). + directive({ + a: htmlAnchorDirective, + input: inputDirective, + textarea: inputDirective, + form: formDirective, + script: scriptDirective, + select: selectDirective, + style: styleDirective, + option: optionDirective, + ngBind: ngBindDirective, + ngBindHtml: ngBindHtmlDirective, + ngBindTemplate: ngBindTemplateDirective, + ngClass: ngClassDirective, + ngClassEven: ngClassEvenDirective, + ngClassOdd: ngClassOddDirective, + ngCloak: ngCloakDirective, + ngController: ngControllerDirective, + ngForm: ngFormDirective, + ngHide: ngHideDirective, + ngIf: ngIfDirective, + ngInclude: ngIncludeDirective, + ngInit: ngInitDirective, + ngNonBindable: ngNonBindableDirective, + ngPluralize: ngPluralizeDirective, + ngRepeat: ngRepeatDirective, + ngShow: ngShowDirective, + ngStyle: ngStyleDirective, + ngSwitch: ngSwitchDirective, + ngSwitchWhen: ngSwitchWhenDirective, + ngSwitchDefault: ngSwitchDefaultDirective, + ngOptions: ngOptionsDirective, + ngTransclude: ngTranscludeDirective, + ngModel: ngModelDirective, + ngList: ngListDirective, + ngChange: ngChangeDirective, + required: requiredDirective, + ngRequired: requiredDirective, + ngValue: ngValueDirective + }). + directive(ngAttributeAliasDirectives). + directive(ngEventDirectives); + $provide.provider({ + $anchorScroll: $AnchorScrollProvider, + $animate: $AnimateProvider, + $browser: $BrowserProvider, + $cacheFactory: $CacheFactoryProvider, + $controller: $ControllerProvider, + $document: $DocumentProvider, + $exceptionHandler: $ExceptionHandlerProvider, + $filter: $FilterProvider, + $interpolate: $InterpolateProvider, + $interval: $IntervalProvider, + $http: $HttpProvider, + $httpBackend: $HttpBackendProvider, + $location: $LocationProvider, + $log: $LogProvider, + $parse: $ParseProvider, + $rootScope: $RootScopeProvider, + $q: $QProvider, + $sce: $SceProvider, + $sceDelegate: $SceDelegateProvider, + $sniffer: $SnifferProvider, + $templateCache: $TemplateCacheProvider, + $timeout: $TimeoutProvider, + $window: $WindowProvider + }); + } + ]); +} + +/* global + + -JQLitePrototype, + -addEventListenerFn, + -removeEventListenerFn, + -BOOLEAN_ATTR +*/ + +////////////////////////////////// +//JQLite +////////////////////////////////// + +/** + * @ngdoc function + * @name angular.element + * @function + * + * @description + * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element. + * + * If jQuery is available, `angular.element` is an alias for the + * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element` + * delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite." + * + *
jqLite is a tiny, API-compatible subset of jQuery that allows + * Angular to manipulate the DOM in a cross-browser compatible way. **jqLite** implements only the most + * commonly needed functionality with the goal of having a very small footprint.
+ * + * To use jQuery, simply load it before `DOMContentLoaded` event fired. + * + *
**Note:** all element references in Angular are always wrapped with jQuery or + * jqLite; they are never raw DOM references.
+ * + * ## Angular's jqLite + * jqLite provides only the following jQuery methods: + * + * - [`addClass()`](http://api.jquery.com/addClass/) + * - [`after()`](http://api.jquery.com/after/) + * - [`append()`](http://api.jquery.com/append/) + * - [`attr()`](http://api.jquery.com/attr/) + * - [`bind()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData + * - [`children()`](http://api.jquery.com/children/) - Does not support selectors + * - [`clone()`](http://api.jquery.com/clone/) + * - [`contents()`](http://api.jquery.com/contents/) + * - [`css()`](http://api.jquery.com/css/) + * - [`data()`](http://api.jquery.com/data/) + * - [`eq()`](http://api.jquery.com/eq/) + * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name + * - [`hasClass()`](http://api.jquery.com/hasClass/) + * - [`html()`](http://api.jquery.com/html/) + * - [`next()`](http://api.jquery.com/next/) - Does not support selectors + * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData + * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces or selectors + * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors + * - [`prepend()`](http://api.jquery.com/prepend/) + * - [`prop()`](http://api.jquery.com/prop/) + * - [`ready()`](http://api.jquery.com/ready/) + * - [`remove()`](http://api.jquery.com/remove/) + * - [`removeAttr()`](http://api.jquery.com/removeAttr/) + * - [`removeClass()`](http://api.jquery.com/removeClass/) + * - [`removeData()`](http://api.jquery.com/removeData/) + * - [`replaceWith()`](http://api.jquery.com/replaceWith/) + * - [`text()`](http://api.jquery.com/text/) + * - [`toggleClass()`](http://api.jquery.com/toggleClass/) + * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers. + * - [`unbind()`](http://api.jquery.com/off/) - Does not support namespaces + * - [`val()`](http://api.jquery.com/val/) + * - [`wrap()`](http://api.jquery.com/wrap/) + * + * ## jQuery/jqLite Extras + * Angular also provides the following additional methods and events to both jQuery and jqLite: + * + * ### Events + * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event + * on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM + * element before it is removed. + * + * ### Methods + * - `controller(name)` - retrieves the controller of the current element or its parent. By default + * retrieves controller associated with the `ngController` directive. If `name` is provided as + * camelCase directive name, then the controller for this directive will be retrieved (e.g. + * `'ngModel'`). + * - `injector()` - retrieves the injector of the current element or its parent. + * - `scope()` - retrieves the {@link api/ng.$rootScope.Scope scope} of the current + * element or its parent. + * - `isolateScope()` - retrieves an isolate {@link api/ng.$rootScope.Scope scope} if one is attached directly to the + * current element. This getter should be used only on elements that contain a directive which starts a new isolate + * scope. Calling `scope()` on this element always returns the original non-isolate scope. + * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top + * parent element is reached. + * + * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery. + * @returns {Object} jQuery object. + */ + +var jqCache = JQLite.cache = {}, + jqName = JQLite.expando = 'ng-' + new Date().getTime(), + jqId = 1, + addEventListenerFn = (window.document.addEventListener + ? function(element, type, fn) {element.addEventListener(type, fn, false);} + : function(element, type, fn) {element.attachEvent('on' + type, fn);}), + removeEventListenerFn = (window.document.removeEventListener + ? function(element, type, fn) {element.removeEventListener(type, fn, false); } + : function(element, type, fn) {element.detachEvent('on' + type, fn); }); + +function jqNextId() { return ++jqId; } + + +var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g; +var MOZ_HACK_REGEXP = /^moz([A-Z])/; +var jqLiteMinErr = minErr('jqLite'); + +/** + * Converts snake_case to camelCase. + * Also there is special case for Moz prefix starting with upper case letter. + * @param name Name to normalize + */ +function camelCase(name) { + return name. + replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) { + return offset ? letter.toUpperCase() : letter; + }). + replace(MOZ_HACK_REGEXP, 'Moz$1'); +} + +///////////////////////////////////////////// +// jQuery mutation patch +// +// In conjunction with bindJQuery intercepts all jQuery's DOM destruction apis and fires a +// $destroy event on all DOM nodes being removed. +// +///////////////////////////////////////////// + +function jqLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments) { + var originalJqFn = jQuery.fn[name]; + originalJqFn = originalJqFn.$original || originalJqFn; + removePatch.$original = originalJqFn; + jQuery.fn[name] = removePatch; + + function removePatch(param) { + // jshint -W040 + var list = filterElems && param ? [this.filter(param)] : [this], + fireEvent = dispatchThis, + set, setIndex, setLength, + element, childIndex, childLength, children; + + if (!getterIfNoArguments || param != null) { + while(list.length) { + set = list.shift(); + for(setIndex = 0, setLength = set.length; setIndex < setLength; setIndex++) { + element = jqLite(set[setIndex]); + if (fireEvent) { + element.triggerHandler('$destroy'); + } else { + fireEvent = !fireEvent; + } + for(childIndex = 0, childLength = (children = element.children()).length; + childIndex < childLength; + childIndex++) { + list.push(jQuery(children[childIndex])); + } + } + } + } + return originalJqFn.apply(this, arguments); + } +} + +///////////////////////////////////////////// +function JQLite(element) { + if (element instanceof JQLite) { + return element; + } + if (!(this instanceof JQLite)) { + if (isString(element) && element.charAt(0) != '<') { + throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element'); + } + return new JQLite(element); + } + + if (isString(element)) { + var div = document.createElement('div'); + // Read about the NoScope elements here: + // http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx + div.innerHTML = '
 
' + element; // IE insanity to make NoScope elements work! + div.removeChild(div.firstChild); // remove the superfluous div + jqLiteAddNodes(this, div.childNodes); + var fragment = jqLite(document.createDocumentFragment()); + fragment.append(this); // detach the elements from the temporary DOM div. + } else { + jqLiteAddNodes(this, element); + } +} + +function jqLiteClone(element) { + return element.cloneNode(true); +} + +function jqLiteDealoc(element){ + jqLiteRemoveData(element); + for ( var i = 0, children = element.childNodes || []; i < children.length; i++) { + jqLiteDealoc(children[i]); + } +} + +function jqLiteOff(element, type, fn, unsupported) { + if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument'); + + var events = jqLiteExpandoStore(element, 'events'), + handle = jqLiteExpandoStore(element, 'handle'); + + if (!handle) return; //no listeners registered + + if (isUndefined(type)) { + forEach(events, function(eventHandler, type) { + removeEventListenerFn(element, type, eventHandler); + delete events[type]; + }); + } else { + forEach(type.split(' '), function(type) { + if (isUndefined(fn)) { + removeEventListenerFn(element, type, events[type]); + delete events[type]; + } else { + arrayRemove(events[type] || [], fn); + } + }); + } +} + +function jqLiteRemoveData(element, name) { + var expandoId = element[jqName], + expandoStore = jqCache[expandoId]; + + if (expandoStore) { + if (name) { + delete jqCache[expandoId].data[name]; + return; + } + + if (expandoStore.handle) { + expandoStore.events.$destroy && expandoStore.handle({}, '$destroy'); + jqLiteOff(element); + } + delete jqCache[expandoId]; + element[jqName] = undefined; // ie does not allow deletion of attributes on elements. + } +} + +function jqLiteExpandoStore(element, key, value) { + var expandoId = element[jqName], + expandoStore = jqCache[expandoId || -1]; + + if (isDefined(value)) { + if (!expandoStore) { + element[jqName] = expandoId = jqNextId(); + expandoStore = jqCache[expandoId] = {}; + } + expandoStore[key] = value; + } else { + return expandoStore && expandoStore[key]; + } +} + +function jqLiteData(element, key, value) { + var data = jqLiteExpandoStore(element, 'data'), + isSetter = isDefined(value), + keyDefined = !isSetter && isDefined(key), + isSimpleGetter = keyDefined && !isObject(key); + + if (!data && !isSimpleGetter) { + jqLiteExpandoStore(element, 'data', data = {}); + } + + if (isSetter) { + data[key] = value; + } else { + if (keyDefined) { + if (isSimpleGetter) { + // don't create data in this case. + return data && data[key]; + } else { + extend(data, key); + } + } else { + return data; + } + } +} + +function jqLiteHasClass(element, selector) { + if (!element.getAttribute) return false; + return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " "). + indexOf( " " + selector + " " ) > -1); +} + +function jqLiteRemoveClass(element, cssClasses) { + if (cssClasses && element.setAttribute) { + forEach(cssClasses.split(' '), function(cssClass) { + element.setAttribute('class', trim( + (" " + (element.getAttribute('class') || '') + " ") + .replace(/[\n\t]/g, " ") + .replace(" " + trim(cssClass) + " ", " ")) + ); + }); + } +} + +function jqLiteAddClass(element, cssClasses) { + if (cssClasses && element.setAttribute) { + var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ') + .replace(/[\n\t]/g, " "); + + forEach(cssClasses.split(' '), function(cssClass) { + cssClass = trim(cssClass); + if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) { + existingClasses += cssClass + ' '; + } + }); + + element.setAttribute('class', trim(existingClasses)); + } +} + +function jqLiteAddNodes(root, elements) { + if (elements) { + elements = (!elements.nodeName && isDefined(elements.length) && !isWindow(elements)) + ? elements + : [ elements ]; + for(var i=0; i < elements.length; i++) { + root.push(elements[i]); + } + } +} + +function jqLiteController(element, name) { + return jqLiteInheritedData(element, '$' + (name || 'ngController' ) + 'Controller'); +} + +function jqLiteInheritedData(element, name, value) { + element = jqLite(element); + + // if element is the document object work with the html element instead + // this makes $(document).scope() possible + if(element[0].nodeType == 9) { + element = element.find('html'); + } + var names = isArray(name) ? name : [name]; + + while (element.length) { + + for (var i = 0, ii = names.length; i < ii; i++) { + if ((value = element.data(names[i])) !== undefined) return value; + } + element = element.parent(); + } +} + +////////////////////////////////////////// +// Functions which are declared directly. +////////////////////////////////////////// +var JQLitePrototype = JQLite.prototype = { + ready: function(fn) { + var fired = false; + + function trigger() { + if (fired) return; + fired = true; + fn(); + } + + // check if document already is loaded + if (document.readyState === 'complete'){ + setTimeout(trigger); + } else { + this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9 + // we can not use jqLite since we are not done loading and jQuery could be loaded later. + // jshint -W064 + JQLite(window).on('load', trigger); // fallback to window.onload for others + // jshint +W064 + } + }, + toString: function() { + var value = []; + forEach(this, function(e){ value.push('' + e);}); + return '[' + value.join(', ') + ']'; + }, + + eq: function(index) { + return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]); + }, + + length: 0, + push: push, + sort: [].sort, + splice: [].splice +}; + +////////////////////////////////////////// +// Functions iterating getter/setters. +// these functions return self on setter and +// value on get. +////////////////////////////////////////// +var BOOLEAN_ATTR = {}; +forEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) { + BOOLEAN_ATTR[lowercase(value)] = value; +}); +var BOOLEAN_ELEMENTS = {}; +forEach('input,select,option,textarea,button,form,details'.split(','), function(value) { + BOOLEAN_ELEMENTS[uppercase(value)] = true; +}); + +function getBooleanAttrName(element, name) { + // check dom last since we will most likely fail on name + var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()]; + + // booleanAttr is here twice to minimize DOM access + return booleanAttr && BOOLEAN_ELEMENTS[element.nodeName] && booleanAttr; +} + +forEach({ + data: jqLiteData, + inheritedData: jqLiteInheritedData, + + scope: function(element) { + // Can't use jqLiteData here directly so we stay compatible with jQuery! + return jqLite(element).data('$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']); + }, + + isolateScope: function(element) { + // Can't use jqLiteData here directly so we stay compatible with jQuery! + return jqLite(element).data('$isolateScope') || jqLite(element).data('$isolateScopeNoTemplate'); + }, + + controller: jqLiteController , + + injector: function(element) { + return jqLiteInheritedData(element, '$injector'); + }, + + removeAttr: function(element,name) { + element.removeAttribute(name); + }, + + hasClass: jqLiteHasClass, + + css: function(element, name, value) { + name = camelCase(name); + + if (isDefined(value)) { + element.style[name] = value; + } else { + var val; + + if (msie <= 8) { + // this is some IE specific weirdness that jQuery 1.6.4 does not sure why + val = element.currentStyle && element.currentStyle[name]; + if (val === '') val = 'auto'; + } + + val = val || element.style[name]; + + if (msie <= 8) { + // jquery weirdness :-/ + val = (val === '') ? undefined : val; + } + + return val; + } + }, + + attr: function(element, name, value){ + var lowercasedName = lowercase(name); + if (BOOLEAN_ATTR[lowercasedName]) { + if (isDefined(value)) { + if (!!value) { + element[name] = true; + element.setAttribute(name, lowercasedName); + } else { + element[name] = false; + element.removeAttribute(lowercasedName); + } + } else { + return (element[name] || + (element.attributes.getNamedItem(name)|| noop).specified) + ? lowercasedName + : undefined; + } + } else if (isDefined(value)) { + element.setAttribute(name, value); + } else if (element.getAttribute) { + // the extra argument "2" is to get the right thing for a.href in IE, see jQuery code + // some elements (e.g. Document) don't have get attribute, so return undefined + var ret = element.getAttribute(name, 2); + // normalize non-existing attributes to undefined (as jQuery) + return ret === null ? undefined : ret; + } + }, + + prop: function(element, name, value) { + if (isDefined(value)) { + element[name] = value; + } else { + return element[name]; + } + }, + + text: (function() { + var NODE_TYPE_TEXT_PROPERTY = []; + if (msie < 9) { + NODE_TYPE_TEXT_PROPERTY[1] = 'innerText'; /** Element **/ + NODE_TYPE_TEXT_PROPERTY[3] = 'nodeValue'; /** Text **/ + } else { + NODE_TYPE_TEXT_PROPERTY[1] = /** Element **/ + NODE_TYPE_TEXT_PROPERTY[3] = 'textContent'; /** Text **/ + } + getText.$dv = ''; + return getText; + + function getText(element, value) { + var textProp = NODE_TYPE_TEXT_PROPERTY[element.nodeType]; + if (isUndefined(value)) { + return textProp ? element[textProp] : ''; + } + element[textProp] = value; + } + })(), + + val: function(element, value) { + if (isUndefined(value)) { + if (nodeName_(element) === 'SELECT' && element.multiple) { + var result = []; + forEach(element.options, function (option) { + if (option.selected) { + result.push(option.value || option.text); + } + }); + return result.length === 0 ? null : result; + } + return element.value; + } + element.value = value; + }, + + html: function(element, value) { + if (isUndefined(value)) { + return element.innerHTML; + } + for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) { + jqLiteDealoc(childNodes[i]); + } + element.innerHTML = value; + } +}, function(fn, name){ + /** + * Properties: writes return selection, reads return first value + */ + JQLite.prototype[name] = function(arg1, arg2) { + var i, key; + + // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it + // in a way that survives minification. + if (((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2) === undefined) { + if (isObject(arg1)) { + + // we are a write, but the object properties are the key/values + for(i=0; i < this.length; i++) { + if (fn === jqLiteData) { + // data() takes the whole object in jQuery + fn(this[i], arg1); + } else { + for (key in arg1) { + fn(this[i], key, arg1[key]); + } + } + } + // return self for chaining + return this; + } else { + // we are a read, so read the first child. + var value = fn.$dv; + // Only if we have $dv do we iterate over all, otherwise it is just the first element. + var jj = (value === undefined) ? Math.min(this.length, 1) : this.length; + for (var j = 0; j < jj; j++) { + var nodeValue = fn(this[j], arg1, arg2); + value = value ? value + nodeValue : nodeValue; + } + return value; + } + } else { + // we are a write, so apply to all children + for(i=0; i < this.length; i++) { + fn(this[i], arg1, arg2); + } + // return self for chaining + return this; + } + }; +}); + +function createEventHandler(element, events) { + var eventHandler = function (event, type) { + if (!event.preventDefault) { + event.preventDefault = function() { + event.returnValue = false; //ie + }; + } + + if (!event.stopPropagation) { + event.stopPropagation = function() { + event.cancelBubble = true; //ie + }; + } + + if (!event.target) { + event.target = event.srcElement || document; + } + + if (isUndefined(event.defaultPrevented)) { + var prevent = event.preventDefault; + event.preventDefault = function() { + event.defaultPrevented = true; + prevent.call(event); + }; + event.defaultPrevented = false; + } + + event.isDefaultPrevented = function() { + return event.defaultPrevented || event.returnValue === false; + }; + + forEach(events[type || event.type], function(fn) { + fn.call(element, event); + }); + + // Remove monkey-patched methods (IE), + // as they would cause memory leaks in IE8. + if (msie <= 8) { + // IE7/8 does not allow to delete property on native object + event.preventDefault = null; + event.stopPropagation = null; + event.isDefaultPrevented = null; + } else { + // It shouldn't affect normal browsers (native methods are defined on prototype). + delete event.preventDefault; + delete event.stopPropagation; + delete event.isDefaultPrevented; + } + }; + eventHandler.elem = element; + return eventHandler; +} + +////////////////////////////////////////// +// Functions iterating traversal. +// These functions chain results into a single +// selector. +////////////////////////////////////////// +forEach({ + removeData: jqLiteRemoveData, + + dealoc: jqLiteDealoc, + + on: function onFn(element, type, fn, unsupported){ + if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters'); + + var events = jqLiteExpandoStore(element, 'events'), + handle = jqLiteExpandoStore(element, 'handle'); + + if (!events) jqLiteExpandoStore(element, 'events', events = {}); + if (!handle) jqLiteExpandoStore(element, 'handle', handle = createEventHandler(element, events)); + + forEach(type.split(' '), function(type){ + var eventFns = events[type]; + + if (!eventFns) { + if (type == 'mouseenter' || type == 'mouseleave') { + var contains = document.body.contains || document.body.compareDocumentPosition ? + function( a, b ) { + // jshint bitwise: false + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + events[type] = []; + + // Refer to jQuery's implementation of mouseenter & mouseleave + // Read about mouseenter and mouseleave: + // http://www.quirksmode.org/js/events_mouse.html#link8 + var eventmap = { mouseleave : "mouseout", mouseenter : "mouseover"}; + + onFn(element, eventmap[type], function(event) { + var target = this, related = event.relatedTarget; + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !contains(target, related)) ){ + handle(event, type); + } + }); + + } else { + addEventListenerFn(element, type, handle); + events[type] = []; + } + eventFns = events[type]; + } + eventFns.push(fn); + }); + }, + + off: jqLiteOff, + + replaceWith: function(element, replaceNode) { + var index, parent = element.parentNode; + jqLiteDealoc(element); + forEach(new JQLite(replaceNode), function(node){ + if (index) { + parent.insertBefore(node, index.nextSibling); + } else { + parent.replaceChild(node, element); + } + index = node; + }); + }, + + children: function(element) { + var children = []; + forEach(element.childNodes, function(element){ + if (element.nodeType === 1) + children.push(element); + }); + return children; + }, + + contents: function(element) { + return element.childNodes || []; + }, + + append: function(element, node) { + forEach(new JQLite(node), function(child){ + if (element.nodeType === 1 || element.nodeType === 11) { + element.appendChild(child); + } + }); + }, + + prepend: function(element, node) { + if (element.nodeType === 1) { + var index = element.firstChild; + forEach(new JQLite(node), function(child){ + element.insertBefore(child, index); + }); + } + }, + + wrap: function(element, wrapNode) { + wrapNode = jqLite(wrapNode)[0]; + var parent = element.parentNode; + if (parent) { + parent.replaceChild(wrapNode, element); + } + wrapNode.appendChild(element); + }, + + remove: function(element) { + jqLiteDealoc(element); + var parent = element.parentNode; + if (parent) parent.removeChild(element); + }, + + after: function(element, newElement) { + var index = element, parent = element.parentNode; + forEach(new JQLite(newElement), function(node){ + parent.insertBefore(node, index.nextSibling); + index = node; + }); + }, + + addClass: jqLiteAddClass, + removeClass: jqLiteRemoveClass, + + toggleClass: function(element, selector, condition) { + if (isUndefined(condition)) { + condition = !jqLiteHasClass(element, selector); + } + (condition ? jqLiteAddClass : jqLiteRemoveClass)(element, selector); + }, + + parent: function(element) { + var parent = element.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + + next: function(element) { + if (element.nextElementSibling) { + return element.nextElementSibling; + } + + // IE8 doesn't have nextElementSibling + var elm = element.nextSibling; + while (elm != null && elm.nodeType !== 1) { + elm = elm.nextSibling; + } + return elm; + }, + + find: function(element, selector) { + return element.getElementsByTagName(selector); + }, + + clone: jqLiteClone, + + triggerHandler: function(element, eventName, eventData) { + var eventFns = (jqLiteExpandoStore(element, 'events') || {})[eventName]; + + eventData = eventData || []; + + var event = [{ + preventDefault: noop, + stopPropagation: noop + }]; + + forEach(eventFns, function(fn) { + fn.apply(element, event.concat(eventData)); + }); + } +}, function(fn, name){ + /** + * chaining functions + */ + JQLite.prototype[name] = function(arg1, arg2, arg3) { + var value; + for(var i=0; i < this.length; i++) { + if (isUndefined(value)) { + value = fn(this[i], arg1, arg2, arg3); + if (isDefined(value)) { + // any function which returns a value needs to be wrapped + value = jqLite(value); + } + } else { + jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3)); + } + } + return isDefined(value) ? value : this; + }; + + // bind legacy bind/unbind to on/off + JQLite.prototype.bind = JQLite.prototype.on; + JQLite.prototype.unbind = JQLite.prototype.off; +}); + +/** + * Computes a hash of an 'obj'. + * Hash of a: + * string is string + * number is number as string + * object is either result of calling $$hashKey function on the object or uniquely generated id, + * that is also assigned to the $$hashKey property of the object. + * + * @param obj + * @returns {string} hash string such that the same input will have the same hash string. + * The resulting string key is in 'type:hashKey' format. + */ +function hashKey(obj) { + var objType = typeof obj, + key; + + if (objType == 'object' && obj !== null) { + if (typeof (key = obj.$$hashKey) == 'function') { + // must invoke on object to keep the right this + key = obj.$$hashKey(); + } else if (key === undefined) { + key = obj.$$hashKey = nextUid(); + } + } else { + key = obj; + } + + return objType + ':' + key; +} + +/** + * HashMap which can use objects as keys + */ +function HashMap(array){ + forEach(array, this.put, this); +} +HashMap.prototype = { + /** + * Store key value pair + * @param key key to store can be any type + * @param value value to store can be any type + */ + put: function(key, value) { + this[hashKey(key)] = value; + }, + + /** + * @param key + * @returns the value for the key + */ + get: function(key) { + return this[hashKey(key)]; + }, + + /** + * Remove the key/value pair + * @param key + */ + remove: function(key) { + var value = this[key = hashKey(key)]; + delete this[key]; + return value; + } +}; + +/** + * @ngdoc function + * @name angular.injector + * @function + * + * @description + * Creates an injector function that can be used for retrieving services as well as for + * dependency injection (see {@link guide/di dependency injection}). + * + + * @param {Array.} modules A list of module functions or their aliases. See + * {@link angular.module}. The `ng` module must be explicitly added. + * @returns {function()} Injector function. See {@link AUTO.$injector $injector}. + * + * @example + * Typical usage + *
+ *   // create an injector
+ *   var $injector = angular.injector(['ng']);
+ *
+ *   // use the injector to kick off your application
+ *   // use the type inference to auto inject arguments, or use implicit injection
+ *   $injector.invoke(function($rootScope, $compile, $document){
+ *     $compile($document)($rootScope);
+ *     $rootScope.$digest();
+ *   });
+ * 
+ */ + + +/** + * @ngdoc overview + * @name AUTO + * @description + * + * Implicit module which gets automatically added to each {@link AUTO.$injector $injector}. + */ + +var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m; +var FN_ARG_SPLIT = /,/; +var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/; +var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; +var $injectorMinErr = minErr('$injector'); +function annotate(fn) { + var $inject, + fnText, + argDecl, + last; + + if (typeof fn == 'function') { + if (!($inject = fn.$inject)) { + $inject = []; + if (fn.length) { + fnText = fn.toString().replace(STRIP_COMMENTS, ''); + argDecl = fnText.match(FN_ARGS); + forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){ + arg.replace(FN_ARG, function(all, underscore, name){ + $inject.push(name); + }); + }); + } + fn.$inject = $inject; + } + } else if (isArray(fn)) { + last = fn.length - 1; + assertArgFn(fn[last], 'fn'); + $inject = fn.slice(0, last); + } else { + assertArgFn(fn, 'fn', true); + } + return $inject; +} + +/////////////////////////////////////// + +/** + * @ngdoc object + * @name AUTO.$injector + * @function + * + * @description + * + * `$injector` is used to retrieve object instances as defined by + * {@link AUTO.$provide provider}, instantiate types, invoke methods, + * and load modules. + * + * The following always holds true: + * + *
+ *   var $injector = angular.injector();
+ *   expect($injector.get('$injector')).toBe($injector);
+ *   expect($injector.invoke(function($injector){
+ *     return $injector;
+ *   }).toBe($injector);
+ * 
+ * + * # Injection Function Annotation + * + * JavaScript does not have annotations, and annotations are needed for dependency injection. The + * following are all valid ways of annotating function with injection arguments and are equivalent. + * + *
+ *   // inferred (only works if code not minified/obfuscated)
+ *   $injector.invoke(function(serviceA){});
+ *
+ *   // annotated
+ *   function explicit(serviceA) {};
+ *   explicit.$inject = ['serviceA'];
+ *   $injector.invoke(explicit);
+ *
+ *   // inline
+ *   $injector.invoke(['serviceA', function(serviceA){}]);
+ * 
+ * + * ## Inference + * + * In JavaScript calling `toString()` on a function returns the function definition. The definition + * can then be parsed and the function arguments can be extracted. *NOTE:* This does not work with + * minification, and obfuscation tools since these tools change the argument names. + * + * ## `$inject` Annotation + * By adding a `$inject` property onto a function the injection parameters can be specified. + * + * ## Inline + * As an array of injection names, where the last item in the array is the function to call. + */ + +/** + * @ngdoc method + * @name AUTO.$injector#get + * @methodOf AUTO.$injector + * + * @description + * Return an instance of the service. + * + * @param {string} name The name of the instance to retrieve. + * @return {*} The instance. + */ + +/** + * @ngdoc method + * @name AUTO.$injector#invoke + * @methodOf AUTO.$injector + * + * @description + * Invoke the method and supply the method arguments from the `$injector`. + * + * @param {!function} fn The function to invoke. Function parameters are injected according to the + * {@link guide/di $inject Annotation} rules. + * @param {Object=} self The `this` for the invoked method. + * @param {Object=} locals Optional object. If preset then any argument names are read from this + * object first, before the `$injector` is consulted. + * @returns {*} the value returned by the invoked `fn` function. + */ + +/** + * @ngdoc method + * @name AUTO.$injector#has + * @methodOf AUTO.$injector + * + * @description + * Allows the user to query if the particular service exist. + * + * @param {string} Name of the service to query. + * @returns {boolean} returns true if injector has given service. + */ + +/** + * @ngdoc method + * @name AUTO.$injector#instantiate + * @methodOf AUTO.$injector + * @description + * Create a new instance of JS type. The method takes a constructor function invokes the new + * operator and supplies all of the arguments to the constructor function as specified by the + * constructor annotation. + * + * @param {function} Type Annotated constructor function. + * @param {Object=} locals Optional object. If preset then any argument names are read from this + * object first, before the `$injector` is consulted. + * @returns {Object} new instance of `Type`. + */ + +/** + * @ngdoc method + * @name AUTO.$injector#annotate + * @methodOf AUTO.$injector + * + * @description + * Returns an array of service names which the function is requesting for injection. This API is + * used by the injector to determine which services need to be injected into the function when the + * function is invoked. There are three ways in which the function can be annotated with the needed + * dependencies. + * + * # Argument names + * + * The simplest form is to extract the dependencies from the arguments of the function. This is done + * by converting the function into a string using `toString()` method and extracting the argument + * names. + *
+ *   // Given
+ *   function MyController($scope, $route) {
+ *     // ...
+ *   }
+ *
+ *   // Then
+ *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+ * 
+ * + * This method does not work with code minification / obfuscation. For this reason the following + * annotation strategies are supported. + * + * # The `$inject` property + * + * If a function has an `$inject` property and its value is an array of strings, then the strings + * represent names of services to be injected into the function. + *
+ *   // Given
+ *   var MyController = function(obfuscatedScope, obfuscatedRoute) {
+ *     // ...
+ *   }
+ *   // Define function dependencies
+ *   MyController.$inject = ['$scope', '$route'];
+ *
+ *   // Then
+ *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+ * 
+ * + * # The array notation + * + * It is often desirable to inline Injected functions and that's when setting the `$inject` property + * is very inconvenient. In these situations using the array notation to specify the dependencies in + * a way that survives minification is a better choice: + * + *
+ *   // We wish to write this (not minification / obfuscation safe)
+ *   injector.invoke(function($compile, $rootScope) {
+ *     // ...
+ *   });
+ *
+ *   // We are forced to write break inlining
+ *   var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {
+ *     // ...
+ *   };
+ *   tmpFn.$inject = ['$compile', '$rootScope'];
+ *   injector.invoke(tmpFn);
+ *
+ *   // To better support inline function the inline annotation is supported
+ *   injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {
+ *     // ...
+ *   }]);
+ *
+ *   // Therefore
+ *   expect(injector.annotate(
+ *      ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
+ *    ).toEqual(['$compile', '$rootScope']);
+ * 
+ * + * @param {function|Array.} fn Function for which dependent service names need to + * be retrieved as described above. + * + * @returns {Array.} The names of the services which the function requires. + */ + + + + +/** + * @ngdoc object + * @name AUTO.$provide + * + * @description + * + * The {@link AUTO.$provide $provide} service has a number of methods for registering components + * with the {@link AUTO.$injector $injector}. Many of these functions are also exposed on + * {@link angular.Module}. + * + * An Angular **service** is a singleton object created by a **service factory**. These **service + * factories** are functions which, in turn, are created by a **service provider**. + * The **service providers** are constructor functions. When instantiated they must contain a + * property called `$get`, which holds the **service factory** function. + * + * When you request a service, the {@link AUTO.$injector $injector} is responsible for finding the + * correct **service provider**, instantiating it and then calling its `$get` **service factory** + * function to get the instance of the **service**. + * + * Often services have no configuration options and there is no need to add methods to the service + * provider. The provider will be no more than a constructor function with a `$get` property. For + * these cases the {@link AUTO.$provide $provide} service has additional helper methods to register + * services without specifying a provider. + * + * * {@link AUTO.$provide#methods_provider provider(provider)} - registers a **service provider** with the + * {@link AUTO.$injector $injector} + * * {@link AUTO.$provide#methods_constant constant(obj)} - registers a value/object that can be accessed by + * providers and services. + * * {@link AUTO.$provide#methods_value value(obj)} - registers a value/object that can only be accessed by + * services, not providers. + * * {@link AUTO.$provide#methods_factory factory(fn)} - registers a service **factory function**, `fn`, + * that will be wrapped in a **service provider** object, whose `$get` property will contain the + * given factory function. + * * {@link AUTO.$provide#methods_service service(class)} - registers a **constructor function**, `class` that + * that will be wrapped in a **service provider** object, whose `$get` property will instantiate + * a new object using the given constructor function. + * + * See the individual methods for more information and examples. + */ + +/** + * @ngdoc method + * @name AUTO.$provide#provider + * @methodOf AUTO.$provide + * @description + * + * Register a **provider function** with the {@link AUTO.$injector $injector}. Provider functions + * are constructor functions, whose instances are responsible for "providing" a factory for a + * service. + * + * Service provider names start with the name of the service they provide followed by `Provider`. + * For example, the {@link ng.$log $log} service has a provider called + * {@link ng.$logProvider $logProvider}. + * + * Service provider objects can have additional methods which allow configuration of the provider + * and its service. Importantly, you can configure what kind of service is created by the `$get` + * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a + * method {@link ng.$logProvider#debugEnabled debugEnabled} + * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the + * console or not. + * + * @param {string} name The name of the instance. NOTE: the provider will be available under `name + + 'Provider'` key. + * @param {(Object|function())} provider If the provider is: + * + * - `Object`: then it should have a `$get` method. The `$get` method will be invoked using + * {@link AUTO.$injector#invoke $injector.invoke()} when an instance needs to be + * created. + * - `Constructor`: a new instance of the provider will be created using + * {@link AUTO.$injector#instantiate $injector.instantiate()}, then treated as + * `object`. + * + * @returns {Object} registered provider instance + + * @example + * + * The following example shows how to create a simple event tracking service and register it using + * {@link AUTO.$provide#methods_provider $provide.provider()}. + * + *
+ *  // Define the eventTracker provider
+ *  function EventTrackerProvider() {
+ *    var trackingUrl = '/track';
+ *
+ *    // A provider method for configuring where the tracked events should been saved
+ *    this.setTrackingUrl = function(url) {
+ *      trackingUrl = url;
+ *    };
+ *
+ *    // The service factory function
+ *    this.$get = ['$http', function($http) {
+ *      var trackedEvents = {};
+ *      return {
+ *        // Call this to track an event
+ *        event: function(event) {
+ *          var count = trackedEvents[event] || 0;
+ *          count += 1;
+ *          trackedEvents[event] = count;
+ *          return count;
+ *        },
+ *        // Call this to save the tracked events to the trackingUrl
+ *        save: function() {
+ *          $http.post(trackingUrl, trackedEvents);
+ *        }
+ *      };
+ *    }];
+ *  }
+ *
+ *  describe('eventTracker', function() {
+ *    var postSpy;
+ *
+ *    beforeEach(module(function($provide) {
+ *      // Register the eventTracker provider
+ *      $provide.provider('eventTracker', EventTrackerProvider);
+ *    }));
+ *
+ *    beforeEach(module(function(eventTrackerProvider) {
+ *      // Configure eventTracker provider
+ *      eventTrackerProvider.setTrackingUrl('/custom-track');
+ *    }));
+ *
+ *    it('tracks events', inject(function(eventTracker) {
+ *      expect(eventTracker.event('login')).toEqual(1);
+ *      expect(eventTracker.event('login')).toEqual(2);
+ *    }));
+ *
+ *    it('saves to the tracking url', inject(function(eventTracker, $http) {
+ *      postSpy = spyOn($http, 'post');
+ *      eventTracker.event('login');
+ *      eventTracker.save();
+ *      expect(postSpy).toHaveBeenCalled();
+ *      expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');
+ *      expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');
+ *      expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });
+ *    }));
+ *  });
+ * 
+ */ + +/** + * @ngdoc method + * @name AUTO.$provide#factory + * @methodOf AUTO.$provide + * @description + * + * Register a **service factory**, which will be called to return the service instance. + * This is short for registering a service where its provider consists of only a `$get` property, + * which is the given service factory function. + * You should use {@link AUTO.$provide#factory $provide.factory(getFn)} if you do not need to + * configure your service in a provider. + * + * @param {string} name The name of the instance. + * @param {function()} $getFn The $getFn for the instance creation. Internally this is a short hand + * for `$provide.provider(name, {$get: $getFn})`. + * @returns {Object} registered provider instance + * + * @example + * Here is an example of registering a service + *
+ *   $provide.factory('ping', ['$http', function($http) {
+ *     return function ping() {
+ *       return $http.send('/ping');
+ *     };
+ *   }]);
+ * 
+ * You would then inject and use this service like this: + *
+ *   someModule.controller('Ctrl', ['ping', function(ping) {
+ *     ping();
+ *   }]);
+ * 
+ */ + + +/** + * @ngdoc method + * @name AUTO.$provide#service + * @methodOf AUTO.$provide + * @description + * + * Register a **service constructor**, which will be invoked with `new` to create the service + * instance. + * This is short for registering a service where its provider's `$get` property is the service + * constructor function that will be used to instantiate the service instance. + * + * You should use {@link AUTO.$provide#methods_service $provide.service(class)} if you define your service + * as a type/class. This is common when using {@link http://coffeescript.org CoffeeScript}. + * + * @param {string} name The name of the instance. + * @param {Function} constructor A class (constructor function) that will be instantiated. + * @returns {Object} registered provider instance + * + * @example + * Here is an example of registering a service using + * {@link AUTO.$provide#methods_service $provide.service(class)} that is defined as a CoffeeScript class. + *
+ *   class Ping
+ *     constructor: (@$http)->
+ *     send: ()=>
+ *       @$http.get('/ping')
+ *
+ *   $provide.service('ping', ['$http', Ping])
+ * 
+ * You would then inject and use this service like this: + *
+ *   someModule.controller 'Ctrl', ['ping', (ping)->
+ *     ping.send()
+ *   ]
+ * 
+ */ + + +/** + * @ngdoc method + * @name AUTO.$provide#value + * @methodOf AUTO.$provide + * @description + * + * Register a **value service** with the {@link AUTO.$injector $injector}, such as a string, a + * number, an array, an object or a function. This is short for registering a service where its + * provider's `$get` property is a factory function that takes no arguments and returns the **value + * service**. + * + * Value services are similar to constant services, except that they cannot be injected into a + * module configuration function (see {@link angular.Module#config}) but they can be overridden by + * an Angular + * {@link AUTO.$provide#decorator decorator}. + * + * @param {string} name The name of the instance. + * @param {*} value The value. + * @returns {Object} registered provider instance + * + * @example + * Here are some examples of creating value services. + *
+ *   $provide.constant('ADMIN_USER', 'admin');
+ *
+ *   $provide.constant('RoleLookup', { admin: 0, writer: 1, reader: 2 });
+ *
+ *   $provide.constant('halfOf', function(value) {
+ *     return value / 2;
+ *   });
+ * 
+ */ + + +/** + * @ngdoc method + * @name AUTO.$provide#constant + * @methodOf AUTO.$provide + * @description + * + * Register a **constant service**, such as a string, a number, an array, an object or a function, + * with the {@link AUTO.$injector $injector}. Unlike {@link AUTO.$provide#value value} it can be + * injected into a module configuration function (see {@link angular.Module#config}) and it cannot + * be overridden by an Angular {@link AUTO.$provide#decorator decorator}. + * + * @param {string} name The name of the constant. + * @param {*} value The constant value. + * @returns {Object} registered instance + * + * @example + * Here a some examples of creating constants: + *
+ *   $provide.constant('SHARD_HEIGHT', 306);
+ *
+ *   $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);
+ *
+ *   $provide.constant('double', function(value) {
+ *     return value * 2;
+ *   });
+ * 
+ */ + + +/** + * @ngdoc method + * @name AUTO.$provide#decorator + * @methodOf AUTO.$provide + * @description + * + * Register a **service decorator** with the {@link AUTO.$injector $injector}. A service decorator + * intercepts the creation of a service, allowing it to override or modify the behaviour of the + * service. The object returned by the decorator may be the original service, or a new service + * object which replaces or wraps and delegates to the original service. + * + * @param {string} name The name of the service to decorate. + * @param {function()} decorator This function will be invoked when the service needs to be + * instantiated and should return the decorated service instance. The function is called using + * the {@link AUTO.$injector#invoke injector.invoke} method and is therefore fully injectable. + * Local injection arguments: + * + * * `$delegate` - The original service instance, which can be monkey patched, configured, + * decorated or delegated to. + * + * @example + * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting + * calls to {@link ng.$log#error $log.warn()}. + *
+ *   $provider.decorator('$log', ['$delegate', function($delegate) {
+ *     $delegate.warn = $delegate.error;
+ *     return $delegate;
+ *   }]);
+ * 
+ */ + + +function createInjector(modulesToLoad) { + var INSTANTIATING = {}, + providerSuffix = 'Provider', + path = [], + loadedModules = new HashMap(), + providerCache = { + $provide: { + provider: supportObject(provider), + factory: supportObject(factory), + service: supportObject(service), + value: supportObject(value), + constant: supportObject(constant), + decorator: decorator + } + }, + providerInjector = (providerCache.$injector = + createInternalInjector(providerCache, function() { + throw $injectorMinErr('unpr', "Unknown provider: {0}", path.join(' <- ')); + })), + instanceCache = {}, + instanceInjector = (instanceCache.$injector = + createInternalInjector(instanceCache, function(servicename) { + var provider = providerInjector.get(servicename + providerSuffix); + return instanceInjector.invoke(provider.$get, provider); + })); + + + forEach(loadModules(modulesToLoad), function(fn) { instanceInjector.invoke(fn || noop); }); + + return instanceInjector; + + //////////////////////////////////// + // $provider + //////////////////////////////////// + + function supportObject(delegate) { + return function(key, value) { + if (isObject(key)) { + forEach(key, reverseParams(delegate)); + } else { + return delegate(key, value); + } + }; + } + + function provider(name, provider_) { + assertNotHasOwnProperty(name, 'service'); + if (isFunction(provider_) || isArray(provider_)) { + provider_ = providerInjector.instantiate(provider_); + } + if (!provider_.$get) { + throw $injectorMinErr('pget', "Provider '{0}' must define $get factory method.", name); + } + return providerCache[name + providerSuffix] = provider_; + } + + function factory(name, factoryFn) { return provider(name, { $get: factoryFn }); } + + function service(name, constructor) { + return factory(name, ['$injector', function($injector) { + return $injector.instantiate(constructor); + }]); + } + + function value(name, val) { return factory(name, valueFn(val)); } + + function constant(name, value) { + assertNotHasOwnProperty(name, 'constant'); + providerCache[name] = value; + instanceCache[name] = value; + } + + function decorator(serviceName, decorFn) { + var origProvider = providerInjector.get(serviceName + providerSuffix), + orig$get = origProvider.$get; + + origProvider.$get = function() { + var origInstance = instanceInjector.invoke(orig$get, origProvider); + return instanceInjector.invoke(decorFn, null, {$delegate: origInstance}); + }; + } + + //////////////////////////////////// + // Module Loading + //////////////////////////////////// + function loadModules(modulesToLoad){ + var runBlocks = [], moduleFn, invokeQueue, i, ii; + forEach(modulesToLoad, function(module) { + if (loadedModules.get(module)) return; + loadedModules.put(module, true); + + try { + if (isString(module)) { + moduleFn = angularModule(module); + runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks); + + for(invokeQueue = moduleFn._invokeQueue, i = 0, ii = invokeQueue.length; i < ii; i++) { + var invokeArgs = invokeQueue[i], + provider = providerInjector.get(invokeArgs[0]); + + provider[invokeArgs[1]].apply(provider, invokeArgs[2]); + } + } else if (isFunction(module)) { + runBlocks.push(providerInjector.invoke(module)); + } else if (isArray(module)) { + runBlocks.push(providerInjector.invoke(module)); + } else { + assertArgFn(module, 'module'); + } + } catch (e) { + if (isArray(module)) { + module = module[module.length - 1]; + } + if (e.message && e.stack && e.stack.indexOf(e.message) == -1) { + // Safari & FF's stack traces don't contain error.message content + // unlike those of Chrome and IE + // So if stack doesn't contain message, we create a new string that contains both. + // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here. + /* jshint -W022 */ + e = e.message + '\n' + e.stack; + } + throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}", + module, e.stack || e.message || e); + } + }); + return runBlocks; + } + + //////////////////////////////////// + // internal Injector + //////////////////////////////////// + + function createInternalInjector(cache, factory) { + + function getService(serviceName) { + if (cache.hasOwnProperty(serviceName)) { + if (cache[serviceName] === INSTANTIATING) { + throw $injectorMinErr('cdep', 'Circular dependency found: {0}', path.join(' <- ')); + } + return cache[serviceName]; + } else { + try { + path.unshift(serviceName); + cache[serviceName] = INSTANTIATING; + return cache[serviceName] = factory(serviceName); + } finally { + path.shift(); + } + } + } + + function invoke(fn, self, locals){ + var args = [], + $inject = annotate(fn), + length, i, + key; + + for(i = 0, length = $inject.length; i < length; i++) { + key = $inject[i]; + if (typeof key !== 'string') { + throw $injectorMinErr('itkn', + 'Incorrect injection token! Expected service name as string, got {0}', key); + } + args.push( + locals && locals.hasOwnProperty(key) + ? locals[key] + : getService(key) + ); + } + if (!fn.$inject) { + // this means that we must be an array. + fn = fn[length]; + } + + + // Performance optimization: http://jsperf.com/apply-vs-call-vs-invoke + switch (self ? -1 : args.length) { + case 0: return fn(); + case 1: return fn(args[0]); + case 2: return fn(args[0], args[1]); + case 3: return fn(args[0], args[1], args[2]); + case 4: return fn(args[0], args[1], args[2], args[3]); + case 5: return fn(args[0], args[1], args[2], args[3], args[4]); + case 6: return fn(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + case 8: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); + case 9: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], + args[8]); + case 10: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], + args[8], args[9]); + default: return fn.apply(self, args); + } + } + + function instantiate(Type, locals) { + var Constructor = function() {}, + instance, returnedValue; + + // Check if Type is annotated and use just the given function at n-1 as parameter + // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]); + Constructor.prototype = (isArray(Type) ? Type[Type.length - 1] : Type).prototype; + instance = new Constructor(); + returnedValue = invoke(Type, instance, locals); + + return isObject(returnedValue) || isFunction(returnedValue) ? returnedValue : instance; + } + + return { + invoke: invoke, + instantiate: instantiate, + get: getService, + annotate: annotate, + has: function(name) { + return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name); + } + }; + } +} + +/** + * @ngdoc function + * @name ng.$anchorScroll + * @requires $window + * @requires $location + * @requires $rootScope + * + * @description + * When called, it checks current value of `$location.hash()` and scroll to related element, + * according to rules specified in + * {@link http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document Html5 spec}. + * + * It also watches the `$location.hash()` and scrolls whenever it changes to match any anchor. + * This can be disabled by calling `$anchorScrollProvider.disableAutoScrolling()`. + * + * @example + + +
+ Go to bottom + You're at the bottom! +
+
+ + function ScrollCtrl($scope, $location, $anchorScroll) { + $scope.gotoBottom = function (){ + // set the location.hash to the id of + // the element you wish to scroll to. + $location.hash('bottom'); + + // call $anchorScroll() + $anchorScroll(); + } + } + + + #scrollArea { + height: 350px; + overflow: auto; + } + + #bottom { + display: block; + margin-top: 2000px; + } + +
+ */ +function $AnchorScrollProvider() { + + var autoScrollingEnabled = true; + + this.disableAutoScrolling = function() { + autoScrollingEnabled = false; + }; + + this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) { + var document = $window.document; + + // helper function to get first anchor from a NodeList + // can't use filter.filter, as it accepts only instances of Array + // and IE can't convert NodeList to an array using [].slice + // TODO(vojta): use filter if we change it to accept lists as well + function getFirstAnchor(list) { + var result = null; + forEach(list, function(element) { + if (!result && lowercase(element.nodeName) === 'a') result = element; + }); + return result; + } + + function scroll() { + var hash = $location.hash(), elm; + + // empty hash, scroll to the top of the page + if (!hash) $window.scrollTo(0, 0); + + // element with given id + else if ((elm = document.getElementById(hash))) elm.scrollIntoView(); + + // first anchor with given name :-D + else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView(); + + // no element and hash == 'top', scroll to the top of the page + else if (hash === 'top') $window.scrollTo(0, 0); + } + + // does not scroll when user clicks on anchor link that is currently on + // (no url change, no $location.hash() change), browser native does scroll + if (autoScrollingEnabled) { + $rootScope.$watch(function autoScrollWatch() {return $location.hash();}, + function autoScrollWatchAction() { + $rootScope.$evalAsync(scroll); + }); + } + + return scroll; + }]; +} + +var $animateMinErr = minErr('$animate'); + +/** + * @ngdoc object + * @name ng.$animateProvider + * + * @description + * Default implementation of $animate that doesn't perform any animations, instead just + * synchronously performs DOM + * updates and calls done() callbacks. + * + * In order to enable animations the ngAnimate module has to be loaded. + * + * To see the functional implementation check out src/ngAnimate/animate.js + */ +var $AnimateProvider = ['$provide', function($provide) { + + + this.$$selectors = {}; + + + /** + * @ngdoc function + * @name ng.$animateProvider#register + * @methodOf ng.$animateProvider + * + * @description + * Registers a new injectable animation factory function. The factory function produces the + * animation object which contains callback functions for each event that is expected to be + * animated. + * + * * `eventFn`: `function(Element, doneFunction)` The element to animate, the `doneFunction` + * must be called once the element animation is complete. If a function is returned then the + * animation service will use this function to cancel the animation whenever a cancel event is + * triggered. + * + * + *
+   *   return {
+     *     eventFn : function(element, done) {
+     *       //code to run the animation
+     *       //once complete, then run done()
+     *       return function cancellationFunction() {
+     *         //code to cancel the animation
+     *       }
+     *     }
+     *   }
+   *
+ * + * @param {string} name The name of the animation. + * @param {function} factory The factory function that will be executed to return the animation + * object. + */ + this.register = function(name, factory) { + var key = name + '-animation'; + if (name && name.charAt(0) != '.') throw $animateMinErr('notcsel', + "Expecting class selector starting with '.' got '{0}'.", name); + this.$$selectors[name.substr(1)] = key; + $provide.factory(key, factory); + }; + + this.$get = ['$timeout', function($timeout) { + + /** + * + * @ngdoc object + * @name ng.$animate + * @description The $animate service provides rudimentary DOM manipulation functions to + * insert, remove and move elements within the DOM, as well as adding and removing classes. + * This service is the core service used by the ngAnimate $animator service which provides + * high-level animation hooks for CSS and JavaScript. + * + * $animate is available in the AngularJS core, however, the ngAnimate module must be included + * to enable full out animation support. Otherwise, $animate will only perform simple DOM + * manipulation operations. + * + * To learn more about enabling animation support, click here to visit the {@link ngAnimate + * ngAnimate module page} as well as the {@link ngAnimate.$animate ngAnimate $animate service + * page}. + */ + return { + + /** + * + * @ngdoc function + * @name ng.$animate#enter + * @methodOf ng.$animate + * @function + * @description Inserts the element into the DOM either after the `after` element or within + * the `parent` element. Once complete, the done() callback will be fired (if provided). + * @param {jQuery/jqLite element} element the element which will be inserted into the DOM + * @param {jQuery/jqLite element} parent the parent element which will append the element as + * a child (if the after element is not present) + * @param {jQuery/jqLite element} after the sibling element which will append the element + * after itself + * @param {function=} done callback function that will be called after the element has been + * inserted into the DOM + */ + enter : function(element, parent, after, done) { + var afterNode = after && after[after.length - 1]; + var parentNode = parent && parent[0] || afterNode && afterNode.parentNode; + // IE does not like undefined so we have to pass null. + var afterNextSibling = (afterNode && afterNode.nextSibling) || null; + forEach(element, function(node) { + parentNode.insertBefore(node, afterNextSibling); + }); + done && $timeout(done, 0, false); + }, + + /** + * + * @ngdoc function + * @name ng.$animate#leave + * @methodOf ng.$animate + * @function + * @description Removes the element from the DOM. Once complete, the done() callback will be + * fired (if provided). + * @param {jQuery/jqLite element} element the element which will be removed from the DOM + * @param {function=} done callback function that will be called after the element has been + * removed from the DOM + */ + leave : function(element, done) { + element.remove(); + done && $timeout(done, 0, false); + }, + + /** + * + * @ngdoc function + * @name ng.$animate#move + * @methodOf ng.$animate + * @function + * @description Moves the position of the provided element within the DOM to be placed + * either after the `after` element or inside of the `parent` element. Once complete, the + * done() callback will be fired (if provided). + * + * @param {jQuery/jqLite element} element the element which will be moved around within the + * DOM + * @param {jQuery/jqLite element} parent the parent element where the element will be + * inserted into (if the after element is not present) + * @param {jQuery/jqLite element} after the sibling element where the element will be + * positioned next to + * @param {function=} done the callback function (if provided) that will be fired after the + * element has been moved to its new position + */ + move : function(element, parent, after, done) { + // Do not remove element before insert. Removing will cause data associated with the + // element to be dropped. Insert will implicitly do the remove. + this.enter(element, parent, after, done); + }, + + /** + * + * @ngdoc function + * @name ng.$animate#addClass + * @methodOf ng.$animate + * @function + * @description Adds the provided className CSS class value to the provided element. Once + * complete, the done() callback will be fired (if provided). + * @param {jQuery/jqLite element} element the element which will have the className value + * added to it + * @param {string} className the CSS class which will be added to the element + * @param {function=} done the callback function (if provided) that will be fired after the + * className value has been added to the element + */ + addClass : function(element, className, done) { + className = isString(className) ? + className : + isArray(className) ? className.join(' ') : ''; + forEach(element, function (element) { + jqLiteAddClass(element, className); + }); + done && $timeout(done, 0, false); + }, + + /** + * + * @ngdoc function + * @name ng.$animate#removeClass + * @methodOf ng.$animate + * @function + * @description Removes the provided className CSS class value from the provided element. + * Once complete, the done() callback will be fired (if provided). + * @param {jQuery/jqLite element} element the element which will have the className value + * removed from it + * @param {string} className the CSS class which will be removed from the element + * @param {function=} done the callback function (if provided) that will be fired after the + * className value has been removed from the element + */ + removeClass : function(element, className, done) { + className = isString(className) ? + className : + isArray(className) ? className.join(' ') : ''; + forEach(element, function (element) { + jqLiteRemoveClass(element, className); + }); + done && $timeout(done, 0, false); + }, + + enabled : noop + }; + }]; +}]; + +/** + * ! This is a private undocumented service ! + * + * @name ng.$browser + * @requires $log + * @description + * This object has two goals: + * + * - hide all the global state in the browser caused by the window object + * - abstract away all the browser specific features and inconsistencies + * + * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser` + * service, which can be used for convenient testing of the application without the interaction with + * the real browser apis. + */ +/** + * @param {object} window The global window object. + * @param {object} document jQuery wrapped document. + * @param {function()} XHR XMLHttpRequest constructor. + * @param {object} $log console.log or an object with the same interface. + * @param {object} $sniffer $sniffer service + */ +function Browser(window, document, $log, $sniffer) { + var self = this, + rawDocument = document[0], + location = window.location, + history = window.history, + setTimeout = window.setTimeout, + clearTimeout = window.clearTimeout, + pendingDeferIds = {}; + + self.isMock = false; + + var outstandingRequestCount = 0; + var outstandingRequestCallbacks = []; + + // TODO(vojta): remove this temporary api + self.$$completeOutstandingRequest = completeOutstandingRequest; + self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; }; + + /** + * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks` + * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed. + */ + function completeOutstandingRequest(fn) { + try { + fn.apply(null, sliceArgs(arguments, 1)); + } finally { + outstandingRequestCount--; + if (outstandingRequestCount === 0) { + while(outstandingRequestCallbacks.length) { + try { + outstandingRequestCallbacks.pop()(); + } catch (e) { + $log.error(e); + } + } + } + } + } + + /** + * @private + * Note: this method is used only by scenario runner + * TODO(vojta): prefix this method with $$ ? + * @param {function()} callback Function that will be called when no outstanding request + */ + self.notifyWhenNoOutstandingRequests = function(callback) { + // force browser to execute all pollFns - this is needed so that cookies and other pollers fire + // at some deterministic time in respect to the test runner's actions. Leaving things up to the + // regular poller would result in flaky tests. + forEach(pollFns, function(pollFn){ pollFn(); }); + + if (outstandingRequestCount === 0) { + callback(); + } else { + outstandingRequestCallbacks.push(callback); + } + }; + + ////////////////////////////////////////////////////////////// + // Poll Watcher API + ////////////////////////////////////////////////////////////// + var pollFns = [], + pollTimeout; + + /** + * @name ng.$browser#addPollFn + * @methodOf ng.$browser + * + * @param {function()} fn Poll function to add + * + * @description + * Adds a function to the list of functions that poller periodically executes, + * and starts polling if not started yet. + * + * @returns {function()} the added function + */ + self.addPollFn = function(fn) { + if (isUndefined(pollTimeout)) startPoller(100, setTimeout); + pollFns.push(fn); + return fn; + }; + + /** + * @param {number} interval How often should browser call poll functions (ms) + * @param {function()} setTimeout Reference to a real or fake `setTimeout` function. + * + * @description + * Configures the poller to run in the specified intervals, using the specified + * setTimeout fn and kicks it off. + */ + function startPoller(interval, setTimeout) { + (function check() { + forEach(pollFns, function(pollFn){ pollFn(); }); + pollTimeout = setTimeout(check, interval); + })(); + } + + ////////////////////////////////////////////////////////////// + // URL API + ////////////////////////////////////////////////////////////// + + var lastBrowserUrl = location.href, + baseElement = document.find('base'), + newLocation = null; + + /** + * @name ng.$browser#url + * @methodOf ng.$browser + * + * @description + * GETTER: + * Without any argument, this method just returns current value of location.href. + * + * SETTER: + * With at least one argument, this method sets url to new value. + * If html5 history api supported, pushState/replaceState is used, otherwise + * location.href/location.replace is used. + * Returns its own instance to allow chaining + * + * NOTE: this api is intended for use only by the $location service. Please use the + * {@link ng.$location $location service} to change url. + * + * @param {string} url New url (when used as setter) + * @param {boolean=} replace Should new url replace current history record ? + */ + self.url = function(url, replace) { + // Android Browser BFCache causes location reference to become stale. + if (location !== window.location) location = window.location; + + // setter + if (url) { + if (lastBrowserUrl == url) return; + lastBrowserUrl = url; + if ($sniffer.history) { + if (replace) history.replaceState(null, '', url); + else { + history.pushState(null, '', url); + // Crazy Opera Bug: http://my.opera.com/community/forums/topic.dml?id=1185462 + baseElement.attr('href', baseElement.attr('href')); + } + } else { + newLocation = url; + if (replace) { + location.replace(url); + } else { + location.href = url; + } + } + return self; + // getter + } else { + // - newLocation is a workaround for an IE7-9 issue with location.replace and location.href + // methods not updating location.href synchronously. + // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172 + return newLocation || location.href.replace(/%27/g,"'"); + } + }; + + var urlChangeListeners = [], + urlChangeInit = false; + + function fireUrlChange() { + newLocation = null; + if (lastBrowserUrl == self.url()) return; + + lastBrowserUrl = self.url(); + forEach(urlChangeListeners, function(listener) { + listener(self.url()); + }); + } + + /** + * @name ng.$browser#onUrlChange + * @methodOf ng.$browser + * @TODO(vojta): refactor to use node's syntax for events + * + * @description + * Register callback function that will be called, when url changes. + * + * It's only called when the url is changed by outside of angular: + * - user types different url into address bar + * - user clicks on history (forward/back) button + * - user clicks on a link + * + * It's not called when url is changed by $browser.url() method + * + * The listener gets called with new url as parameter. + * + * NOTE: this api is intended for use only by the $location service. Please use the + * {@link ng.$location $location service} to monitor url changes in angular apps. + * + * @param {function(string)} listener Listener function to be called when url changes. + * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous. + */ + self.onUrlChange = function(callback) { + if (!urlChangeInit) { + // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera) + // don't fire popstate when user change the address bar and don't fire hashchange when url + // changed by push/replaceState + + // html5 history api - popstate event + if ($sniffer.history) jqLite(window).on('popstate', fireUrlChange); + // hashchange event + if ($sniffer.hashchange) jqLite(window).on('hashchange', fireUrlChange); + // polling + else self.addPollFn(fireUrlChange); + + urlChangeInit = true; + } + + urlChangeListeners.push(callback); + return callback; + }; + + ////////////////////////////////////////////////////////////// + // Misc API + ////////////////////////////////////////////////////////////// + + /** + * @name ng.$browser#baseHref + * @methodOf ng.$browser + * + * @description + * Returns current + * (always relative - without domain) + * + * @returns {string=} current + */ + self.baseHref = function() { + var href = baseElement.attr('href'); + return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : ''; + }; + + ////////////////////////////////////////////////////////////// + // Cookies API + ////////////////////////////////////////////////////////////// + var lastCookies = {}; + var lastCookieString = ''; + var cookiePath = self.baseHref(); + + /** + * @name ng.$browser#cookies + * @methodOf ng.$browser + * + * @param {string=} name Cookie name + * @param {string=} value Cookie value + * + * @description + * The cookies method provides a 'private' low level access to browser cookies. + * It is not meant to be used directly, use the $cookie service instead. + * + * The return values vary depending on the arguments that the method was called with as follows: + * + * - cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify + * it + * - cookies(name, value) -> set name to value, if value is undefined delete the cookie + * - cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that + * way) + * + * @returns {Object} Hash of all cookies (if called without any parameter) + */ + self.cookies = function(name, value) { + /* global escape: false, unescape: false */ + var cookieLength, cookieArray, cookie, i, index; + + if (name) { + if (value === undefined) { + rawDocument.cookie = escape(name) + "=;path=" + cookiePath + + ";expires=Thu, 01 Jan 1970 00:00:00 GMT"; + } else { + if (isString(value)) { + cookieLength = (rawDocument.cookie = escape(name) + '=' + escape(value) + + ';path=' + cookiePath).length + 1; + + // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum: + // - 300 cookies + // - 20 cookies per unique domain + // - 4096 bytes per cookie + if (cookieLength > 4096) { + $log.warn("Cookie '"+ name + + "' possibly not set or overflowed because it was too large ("+ + cookieLength + " > 4096 bytes)!"); + } + } + } + } else { + if (rawDocument.cookie !== lastCookieString) { + lastCookieString = rawDocument.cookie; + cookieArray = lastCookieString.split("; "); + lastCookies = {}; + + for (i = 0; i < cookieArray.length; i++) { + cookie = cookieArray[i]; + index = cookie.indexOf('='); + if (index > 0) { //ignore nameless cookies + name = unescape(cookie.substring(0, index)); + // the first value that is seen for a cookie is the most + // specific one. values for the same cookie name that + // follow are for less specific paths. + if (lastCookies[name] === undefined) { + lastCookies[name] = unescape(cookie.substring(index + 1)); + } + } + } + } + return lastCookies; + } + }; + + + /** + * @name ng.$browser#defer + * @methodOf ng.$browser + * @param {function()} fn A function, who's execution should be deferred. + * @param {number=} [delay=0] of milliseconds to defer the function execution. + * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`. + * + * @description + * Executes a fn asynchronously via `setTimeout(fn, delay)`. + * + * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using + * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed + * via `$browser.defer.flush()`. + * + */ + self.defer = function(fn, delay) { + var timeoutId; + outstandingRequestCount++; + timeoutId = setTimeout(function() { + delete pendingDeferIds[timeoutId]; + completeOutstandingRequest(fn); + }, delay || 0); + pendingDeferIds[timeoutId] = true; + return timeoutId; + }; + + + /** + * @name ng.$browser#defer.cancel + * @methodOf ng.$browser.defer + * + * @description + * Cancels a deferred task identified with `deferId`. + * + * @param {*} deferId Token returned by the `$browser.defer` function. + * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully + * canceled. + */ + self.defer.cancel = function(deferId) { + if (pendingDeferIds[deferId]) { + delete pendingDeferIds[deferId]; + clearTimeout(deferId); + completeOutstandingRequest(noop); + return true; + } + return false; + }; + +} + +function $BrowserProvider(){ + this.$get = ['$window', '$log', '$sniffer', '$document', + function( $window, $log, $sniffer, $document){ + return new Browser($window, $document, $log, $sniffer); + }]; +} + +/** + * @ngdoc object + * @name ng.$cacheFactory + * + * @description + * Factory that constructs cache objects and gives access to them. + * + *
+ * 
+ *  var cache = $cacheFactory('cacheId');
+ *  expect($cacheFactory.get('cacheId')).toBe(cache);
+ *  expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
+ *
+ *  cache.put("key", "value");
+ *  cache.put("another key", "another value");
+ *
+ *  // We've specified no options on creation
+ *  expect(cache.info()).toEqual({id: 'cacheId', size: 2}); 
+ * 
+ * 
+ * + * + * @param {string} cacheId Name or id of the newly created cache. + * @param {object=} options Options object that specifies the cache behavior. Properties: + * + * - `{number=}` `capacity` — turns the cache into LRU cache. + * + * @returns {object} Newly created cache object with the following set of methods: + * + * - `{object}` `info()` — Returns id, size, and options of cache. + * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns + * it. + * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss. + * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache. + * - `{void}` `removeAll()` — Removes all cached values. + * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory. + * + */ +function $CacheFactoryProvider() { + + this.$get = function() { + var caches = {}; + + function cacheFactory(cacheId, options) { + if (cacheId in caches) { + throw minErr('$cacheFactory')('iid', "CacheId '{0}' is already taken!", cacheId); + } + + var size = 0, + stats = extend({}, options, {id: cacheId}), + data = {}, + capacity = (options && options.capacity) || Number.MAX_VALUE, + lruHash = {}, + freshEnd = null, + staleEnd = null; + + return caches[cacheId] = { + + put: function(key, value) { + var lruEntry = lruHash[key] || (lruHash[key] = {key: key}); + + refresh(lruEntry); + + if (isUndefined(value)) return; + if (!(key in data)) size++; + data[key] = value; + + if (size > capacity) { + this.remove(staleEnd.key); + } + + return value; + }, + + + get: function(key) { + var lruEntry = lruHash[key]; + + if (!lruEntry) return; + + refresh(lruEntry); + + return data[key]; + }, + + + remove: function(key) { + var lruEntry = lruHash[key]; + + if (!lruEntry) return; + + if (lruEntry == freshEnd) freshEnd = lruEntry.p; + if (lruEntry == staleEnd) staleEnd = lruEntry.n; + link(lruEntry.n,lruEntry.p); + + delete lruHash[key]; + delete data[key]; + size--; + }, + + + removeAll: function() { + data = {}; + size = 0; + lruHash = {}; + freshEnd = staleEnd = null; + }, + + + destroy: function() { + data = null; + stats = null; + lruHash = null; + delete caches[cacheId]; + }, + + + info: function() { + return extend({}, stats, {size: size}); + } + }; + + + /** + * makes the `entry` the freshEnd of the LRU linked list + */ + function refresh(entry) { + if (entry != freshEnd) { + if (!staleEnd) { + staleEnd = entry; + } else if (staleEnd == entry) { + staleEnd = entry.n; + } + + link(entry.n, entry.p); + link(entry, freshEnd); + freshEnd = entry; + freshEnd.n = null; + } + } + + + /** + * bidirectionally links two entries of the LRU linked list + */ + function link(nextEntry, prevEntry) { + if (nextEntry != prevEntry) { + if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify + if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify + } + } + } + + + /** + * @ngdoc method + * @name ng.$cacheFactory#info + * @methodOf ng.$cacheFactory + * + * @description + * Get information about all the of the caches that have been created + * + * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info` + */ + cacheFactory.info = function() { + var info = {}; + forEach(caches, function(cache, cacheId) { + info[cacheId] = cache.info(); + }); + return info; + }; + + + /** + * @ngdoc method + * @name ng.$cacheFactory#get + * @methodOf ng.$cacheFactory + * + * @description + * Get access to a cache object by the `cacheId` used when it was created. + * + * @param {string} cacheId Name or id of a cache to access. + * @returns {object} Cache object identified by the cacheId or undefined if no such cache. + */ + cacheFactory.get = function(cacheId) { + return caches[cacheId]; + }; + + + return cacheFactory; + }; +} + +/** + * @ngdoc object + * @name ng.$templateCache + * + * @description + * The first time a template is used, it is loaded in the template cache for quick retrieval. You + * can load templates directly into the cache in a `script` tag, or by consuming the + * `$templateCache` service directly. + * + * Adding via the `script` tag: + *
+ * 
+ * 
+ * 
+ * 
+ *   ...
+ * 
+ * 
+ * + * **Note:** the `script` tag containing the template does not need to be included in the `head` of + * the document, but it must be below the `ng-app` definition. + * + * Adding via the $templateCache service: + * + *
+ * var myApp = angular.module('myApp', []);
+ * myApp.run(function($templateCache) {
+ *   $templateCache.put('templateId.html', 'This is the content of the template');
+ * });
+ * 
+ * + * To retrieve the template later, simply use it in your HTML: + *
+ * 
+ *
+ * + * or get it via Javascript: + *
+ * $templateCache.get('templateId.html')
+ * 
+ * + * See {@link ng.$cacheFactory $cacheFactory}. + * + */ +function $TemplateCacheProvider() { + this.$get = ['$cacheFactory', function($cacheFactory) { + return $cacheFactory('templates'); + }]; +} + +/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE! + * + * DOM-related variables: + * + * - "node" - DOM Node + * - "element" - DOM Element or Node + * - "$node" or "$element" - jqLite-wrapped node or element + * + * + * Compiler related stuff: + * + * - "linkFn" - linking fn of a single directive + * - "nodeLinkFn" - function that aggregates all linking fns for a particular node + * - "childLinkFn" - function that aggregates all linking fns for child nodes of a particular node + * - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList) + */ + + +/** + * @ngdoc function + * @name ng.$compile + * @function + * + * @description + * Compiles a piece of HTML string or DOM into a template and produces a template function, which + * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together. + * + * The compilation is a process of walking the DOM tree and matching DOM elements to + * {@link ng.$compileProvider#methods_directive directives}. + * + *
+ * **Note:** This document is an in-depth reference of all directive options. + * For a gentle introduction to directives with examples of common use cases, + * see the {@link guide/directive directive guide}. + *
+ * + * ## Comprehensive Directive API + * + * There are many different options for a directive. + * + * The difference resides in the return value of the factory function. + * You can either return a "Directive Definition Object" (see below) that defines the directive properties, + * or just the `postLink` function (all other properties will have the default values). + * + *
+ * **Best Practice:** It's recommended to use the "directive definition object" form. + *
+ * + * Here's an example directive declared with a Directive Definition Object: + * + *
+ *   var myModule = angular.module(...);
+ *
+ *   myModule.directive('directiveName', function factory(injectables) {
+ *     var directiveDefinitionObject = {
+ *       priority: 0,
+ *       template: '
', // or // function(tElement, tAttrs) { ... }, + * // or + * // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... }, + * replace: false, + * transclude: false, + * restrict: 'A', + * scope: false, + * controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... }, + * require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'], + * compile: function compile(tElement, tAttrs, transclude) { + * return { + * pre: function preLink(scope, iElement, iAttrs, controller) { ... }, + * post: function postLink(scope, iElement, iAttrs, controller) { ... } + * } + * // or + * // return function postLink( ... ) { ... } + * }, + * // or + * // link: { + * // pre: function preLink(scope, iElement, iAttrs, controller) { ... }, + * // post: function postLink(scope, iElement, iAttrs, controller) { ... } + * // } + * // or + * // link: function postLink( ... ) { ... } + * }; + * return directiveDefinitionObject; + * }); + *
+ * + *
+ * **Note:** Any unspecified options will use the default value. You can see the default values below. + *
+ * + * Therefore the above can be simplified as: + * + *
+ *   var myModule = angular.module(...);
+ *
+ *   myModule.directive('directiveName', function factory(injectables) {
+ *     var directiveDefinitionObject = {
+ *       link: function postLink(scope, iElement, iAttrs) { ... }
+ *     };
+ *     return directiveDefinitionObject;
+ *     // or
+ *     // return function postLink(scope, iElement, iAttrs) { ... }
+ *   });
+ * 
+ * + * + * + * ### Directive Definition Object + * + * The directive definition object provides instructions to the {@link api/ng.$compile + * compiler}. The attributes are: + * + * #### `priority` + * When there are multiple directives defined on a single DOM element, sometimes it + * is necessary to specify the order in which the directives are applied. The `priority` is used + * to sort the directives before their `compile` functions get called. Priority is defined as a + * number. Directives with greater numerical `priority` are compiled first. The order of directives with + * the same priority is undefined. The default priority is `0`. + * + * #### `terminal` + * If set to true then the current `priority` will be the last set of directives + * which will execute (any directives at the current priority will still execute + * as the order of execution on same `priority` is undefined). + * + * #### `scope` + * **If set to `true`,** then a new scope will be created for this directive. If multiple directives on the + * same element request a new scope, only one new scope is created. The new scope rule does not + * apply for the root of the template since the root of the template always gets a new scope. + * + * **If set to `{}` (object hash),** then a new "isolate" scope is created. The 'isolate' scope differs from + * normal scope in that it does not prototypically inherit from the parent scope. This is useful + * when creating reusable components, which should not accidentally read or modify data in the + * parent scope. + * + * The 'isolate' scope takes an object hash which defines a set of local scope properties + * derived from the parent scope. These local properties are useful for aliasing values for + * templates. Locals definition is a hash of local scope property to its source: + * + * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is + * always a string since DOM attributes are strings. If no `attr` name is specified then the + * attribute name is assumed to be the same as the local name. + * Given `` and widget definition + * of `scope: { localName:'@myAttr' }`, then widget scope property `localName` will reflect + * the interpolated value of `hello {{name}}`. As the `name` attribute changes so will the + * `localName` property on the widget scope. The `name` is read from the parent scope (not + * component scope). + * + * * `=` or `=attr` - set up bi-directional binding between a local scope property and the + * parent scope property of name defined via the value of the `attr` attribute. If no `attr` + * name is specified then the attribute name is assumed to be the same as the local name. + * Given `` and widget definition of + * `scope: { localModel:'=myAttr' }`, then widget scope property `localModel` will reflect the + * value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected + * in `localModel` and any changes in `localModel` will reflect in `parentModel`. If the parent + * scope property doesn't exist, it will throw a NON_ASSIGNABLE_MODEL_EXPRESSION exception. You + * can avoid this behavior using `=?` or `=?attr` in order to flag the property as optional. + * + * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope. + * If no `attr` name is specified then the attribute name is assumed to be the same as the + * local name. Given `` and widget definition of + * `scope: { localFn:'&myAttr' }`, then isolate scope property `localFn` will point to + * a function wrapper for the `count = count + value` expression. Often it's desirable to + * pass data from the isolated scope via an expression and to the parent scope, this can be + * done by passing a map of local variable names and values into the expression wrapper fn. + * For example, if the expression is `increment(amount)` then we can specify the amount value + * by calling the `localFn` as `localFn({amount: 22})`. + * + * + * + * #### `controller` + * Controller constructor function. The controller is instantiated before the + * pre-linking phase and it is shared with other directives (see + * `require` attribute). This allows the directives to communicate with each other and augment + * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals: + * + * * `$scope` - Current scope associated with the element + * * `$element` - Current element + * * `$attrs` - Current attributes object for the element + * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope: + * `function(cloneLinkingFn)`. + * + * + * #### `require` + * Require another directive and inject its controller as the fourth argument to the linking function. The + * `require` takes a string name (or array of strings) of the directive(s) to pass in. If an array is used, the + * injected argument will be an array in corresponding order. If no such directive can be + * found, or if the directive does not have a controller, then an error is raised. The name can be prefixed with: + * + * * (no prefix) - Locate the required controller on the current element. Throw an error if not found. + * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found. + * * `^` - Locate the required controller by searching the element's parents. Throw an error if not found. + * * `?^` - Attempt to locate the required controller by searching the element's parentsor pass `null` to the + * `link` fn if not found. + * + * + * #### `controllerAs` + * Controller alias at the directive scope. An alias for the controller so it + * can be referenced at the directive template. The directive needs to define a scope for this + * configuration to be used. Useful in the case when directive is used as component. + * + * + * #### `restrict` + * String of subset of `EACM` which restricts the directive to a specific directive + * declaration style. If omitted, the default (attributes only) is used. + * + * * `E` - Element name: `` + * * `A` - Attribute (default): `
` + * * `C` - Class: `
` + * * `M` - Comment: `` + * + * + * #### `template` + * replace the current element with the contents of the HTML. The replacement process + * migrates all of the attributes / classes from the old element to the new one. See the + * {@link guide/directive#creating-custom-directives_creating-directives_template-expanding-directive + * Directives Guide} for an example. + * + * You can specify `template` as a string representing the template or as a function which takes + * two arguments `tElement` and `tAttrs` (described in the `compile` function api below) and + * returns a string value representing the template. + * + * + * #### `templateUrl` + * Same as `template` but the template is loaded from the specified URL. Because + * the template loading is asynchronous the compilation/linking is suspended until the template + * is loaded. + * + * You can specify `templateUrl` as a string representing the URL or as a function which takes two + * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns + * a string value representing the url. In either case, the template URL is passed through {@link + * api/ng.$sce#methods_getTrustedResourceUrl $sce.getTrustedResourceUrl}. + * + * + * #### `replace` + * specify where the template should be inserted. Defaults to `false`. + * + * * `true` - the template will replace the current element. + * * `false` - the template will replace the contents of the current element. + * + * + * #### `transclude` + * compile the content of the element and make it available to the directive. + * Typically used with {@link api/ng.directive:ngTransclude + * ngTransclude}. The advantage of transclusion is that the linking function receives a + * transclusion function which is pre-bound to the correct scope. In a typical setup the widget + * creates an `isolate` scope, but the transclusion is not a child, but a sibling of the `isolate` + * scope. This makes it possible for the widget to have private state, and the transclusion to + * be bound to the parent (pre-`isolate`) scope. + * + * * `true` - transclude the content of the directive. + * * `'element'` - transclude the whole element including any directives defined at lower priority. + * + * + * #### `compile` + * + *
+ *   function compile(tElement, tAttrs, transclude) { ... }
+ * 
+ * + * The compile function deals with transforming the template DOM. Since most directives do not do + * template transformation, it is not used often. Examples that require compile functions are + * directives that transform template DOM, such as {@link + * api/ng.directive:ngRepeat ngRepeat}, or load the contents + * asynchronously, such as {@link api/ngRoute.directive:ngView ngView}. The + * compile function takes the following arguments. + * + * * `tElement` - template element - The element where the directive has been declared. It is + * safe to do template transformation on the element and child elements only. + * + * * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared + * between all directive compile functions. + * + * * `transclude` - A transclude linking function: `function(scope, cloneLinkingFn)`. + * + *
+ * **Note:** The template instance and the link instance may be different objects if the template has + * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that + * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration + * should be done in a linking function rather than in a compile function. + *
+ * + * A compile function can have a return value which can be either a function or an object. + * + * * returning a (post-link) function - is equivalent to registering the linking function via the + * `link` property of the config object when the compile function is empty. + * + * * returning an object with function(s) registered via `pre` and `post` properties - allows you to + * control when a linking function should be called during the linking phase. See info about + * pre-linking and post-linking functions below. + * + * + * #### `link` + * This property is used only if the `compile` property is not defined. + * + *
+ *   function link(scope, iElement, iAttrs, controller) { ... }
+ * 
+ * + * The link function is responsible for registering DOM listeners as well as updating the DOM. It is + * executed after the template has been cloned. This is where most of the directive logic will be + * put. + * + * * `scope` - {@link api/ng.$rootScope.Scope Scope} - The scope to be used by the + * directive for registering {@link api/ng.$rootScope.Scope#methods_$watch watches}. + * + * * `iElement` - instance element - The element where the directive is to be used. It is safe to + * manipulate the children of the element only in `postLink` function since the children have + * already been linked. + * + * * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared + * between all directive linking functions. + * + * * `controller` - a controller instance - A controller instance if at least one directive on the + * element defines a controller. The controller is shared among all the directives, which allows + * the directives to use the controllers as a communication channel. + * + * + * + * #### Pre-linking function + * + * Executed before the child elements are linked. Not safe to do DOM transformation since the + * compiler linking function will fail to locate the correct elements for linking. + * + * #### Post-linking function + * + * Executed after the child elements are linked. It is safe to do DOM transformation in the post-linking function. + * + * + * ### Attributes + * + * The {@link api/ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the + * `link()` or `compile()` functions. It has a variety of uses. + * + * accessing *Normalized attribute names:* + * Directives like 'ngBind' can be expressed in many ways: 'ng:bind', `data-ng-bind`, or 'x-ng-bind'. + * the attributes object allows for normalized access to + * the attributes. + * + * * *Directive inter-communication:* All directives share the same instance of the attributes + * object which allows the directives to use the attributes object as inter directive + * communication. + * + * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object + * allowing other directives to read the interpolated value. + * + * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes + * that contain interpolation (e.g. `src="{{bar}}"`). Not only is this very efficient but it's also + * the only way to easily get the actual value because during the linking phase the interpolation + * hasn't been evaluated yet and so the value is at this time set to `undefined`. + * + *
+ * function linkingFn(scope, elm, attrs, ctrl) {
+ *   // get the attribute value
+ *   console.log(attrs.ngModel);
+ *
+ *   // change the attribute
+ *   attrs.$set('ngModel', 'new value');
+ *
+ *   // observe changes to interpolated attribute
+ *   attrs.$observe('ngModel', function(value) {
+ *     console.log('ngModel has changed value to ' + value);
+ *   });
+ * }
+ * 
+ * + * Below is an example using `$compileProvider`. + * + *
+ * **Note**: Typically directives are registered with `module.directive`. The example below is + * to illustrate how `$compile` works. + *
+ * + + + +
+
+
+
+
+
+ + it('should auto compile', function() { + expect(element('div[compile]').text()).toBe('Hello Angular'); + input('html').enter('{{name}}!'); + expect(element('div[compile]').text()).toBe('Angular!'); + }); + +
+ + * + * + * @param {string|DOMElement} element Element or HTML string to compile into a template function. + * @param {function(angular.Scope[, cloneAttachFn]} transclude function available to directives. + * @param {number} maxPriority only apply directives lower then given priority (Only effects the + * root element(s), not their children) + * @returns {function(scope[, cloneAttachFn])} a link function which is used to bind template + * (a DOM element/tree) to a scope. Where: + * + * * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to. + * * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the + * `template` and call the `cloneAttachFn` function allowing the caller to attach the + * cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is + * called as:
`cloneAttachFn(clonedElement, scope)` where: + * + * * `clonedElement` - is a clone of the original `element` passed into the compiler. + * * `scope` - is the current scope with which the linking function is working with. + * + * Calling the linking function returns the element of the template. It is either the original + * element passed in, or the clone of the element if the `cloneAttachFn` is provided. + * + * After linking the view is not updated until after a call to $digest which typically is done by + * Angular automatically. + * + * If you need access to the bound view, there are two ways to do it: + * + * - If you are not asking the linking function to clone the template, create the DOM element(s) + * before you send them to the compiler and keep this reference around. + *
+ *     var element = $compile('

{{total}}

')(scope); + *
+ * + * - if on the other hand, you need the element to be cloned, the view reference from the original + * example would not point to the clone, but rather to the original template that was cloned. In + * this case, you can access the clone via the cloneAttachFn: + *
+ *     var templateHTML = angular.element('

{{total}}

'), + * scope = ....; + * + * var clonedElement = $compile(templateHTML)(scope, function(clonedElement, scope) { + * //attach the clone to DOM document at the right place + * }); + * + * //now we have reference to the cloned DOM via `clone` + *
+ * + * + * For information on how the compiler works, see the + * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide. + */ + +var $compileMinErr = minErr('$compile'); + +/** + * @ngdoc service + * @name ng.$compileProvider + * @function + * + * @description + */ +$CompileProvider.$inject = ['$provide']; +function $CompileProvider($provide) { + var hasDirectives = {}, + Suffix = 'Directive', + COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/, + CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/, + aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/, + imgSrcSanitizationWhitelist = /^\s*(https?|ftp|file):|data:image\//; + + // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes + // The assumption is that future DOM event attribute names will begin with + // 'on' and be composed of only English letters. + var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/; + + /** + * @ngdoc function + * @name ng.$compileProvider#directive + * @methodOf ng.$compileProvider + * @function + * + * @description + * Register a new directive with the compiler. + * + * @param {string|Object} name Name of the directive in camel-case (i.e. ngBind which + * will match as ng-bind), or an object map of directives where the keys are the + * names and the values are the factories. + * @param {function|Array} directiveFactory An injectable directive factory function. See + * {@link guide/directive} for more info. + * @returns {ng.$compileProvider} Self for chaining. + */ + this.directive = function registerDirective(name, directiveFactory) { + assertNotHasOwnProperty(name, 'directive'); + if (isString(name)) { + assertArg(directiveFactory, 'directiveFactory'); + if (!hasDirectives.hasOwnProperty(name)) { + hasDirectives[name] = []; + $provide.factory(name + Suffix, ['$injector', '$exceptionHandler', + function($injector, $exceptionHandler) { + var directives = []; + forEach(hasDirectives[name], function(directiveFactory, index) { + try { + var directive = $injector.invoke(directiveFactory); + if (isFunction(directive)) { + directive = { compile: valueFn(directive) }; + } else if (!directive.compile && directive.link) { + directive.compile = valueFn(directive.link); + } + directive.priority = directive.priority || 0; + directive.index = index; + directive.name = directive.name || name; + directive.require = directive.require || (directive.controller && directive.name); + directive.restrict = directive.restrict || 'A'; + directives.push(directive); + } catch (e) { + $exceptionHandler(e); + } + }); + return directives; + }]); + } + hasDirectives[name].push(directiveFactory); + } else { + forEach(name, reverseParams(registerDirective)); + } + return this; + }; + + + /** + * @ngdoc function + * @name ng.$compileProvider#aHrefSanitizationWhitelist + * @methodOf ng.$compileProvider + * @function + * + * @description + * Retrieves or overrides the default regular expression that is used for whitelisting of safe + * urls during a[href] sanitization. + * + * The sanitization is a security measure aimed at prevent XSS attacks via html links. + * + * Any url about to be assigned to a[href] via data-binding is first normalized and turned into + * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist` + * regular expression. If a match is found, the original url is written into the dom. Otherwise, + * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM. + * + * @param {RegExp=} regexp New regexp to whitelist urls with. + * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for + * chaining otherwise. + */ + this.aHrefSanitizationWhitelist = function(regexp) { + if (isDefined(regexp)) { + aHrefSanitizationWhitelist = regexp; + return this; + } + return aHrefSanitizationWhitelist; + }; + + + /** + * @ngdoc function + * @name ng.$compileProvider#imgSrcSanitizationWhitelist + * @methodOf ng.$compileProvider + * @function + * + * @description + * Retrieves or overrides the default regular expression that is used for whitelisting of safe + * urls during img[src] sanitization. + * + * The sanitization is a security measure aimed at prevent XSS attacks via html links. + * + * Any url about to be assigned to img[src] via data-binding is first normalized and turned into + * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist` + * regular expression. If a match is found, the original url is written into the dom. Otherwise, + * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM. + * + * @param {RegExp=} regexp New regexp to whitelist urls with. + * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for + * chaining otherwise. + */ + this.imgSrcSanitizationWhitelist = function(regexp) { + if (isDefined(regexp)) { + imgSrcSanitizationWhitelist = regexp; + return this; + } + return imgSrcSanitizationWhitelist; + }; + + + this.$get = [ + '$injector', '$interpolate', '$exceptionHandler', '$http', '$templateCache', '$parse', + '$controller', '$rootScope', '$document', '$sce', '$animate', + function($injector, $interpolate, $exceptionHandler, $http, $templateCache, $parse, + $controller, $rootScope, $document, $sce, $animate) { + + var Attributes = function(element, attr) { + this.$$element = element; + this.$attr = attr || {}; + }; + + Attributes.prototype = { + $normalize: directiveNormalize, + + + /** + * @ngdoc function + * @name ng.$compile.directive.Attributes#$addClass + * @methodOf ng.$compile.directive.Attributes + * @function + * + * @description + * Adds the CSS class value specified by the classVal parameter to the element. If animations + * are enabled then an animation will be triggered for the class addition. + * + * @param {string} classVal The className value that will be added to the element + */ + $addClass : function(classVal) { + if(classVal && classVal.length > 0) { + $animate.addClass(this.$$element, classVal); + } + }, + + /** + * @ngdoc function + * @name ng.$compile.directive.Attributes#$removeClass + * @methodOf ng.$compile.directive.Attributes + * @function + * + * @description + * Removes the CSS class value specified by the classVal parameter from the element. If + * animations are enabled then an animation will be triggered for the class removal. + * + * @param {string} classVal The className value that will be removed from the element + */ + $removeClass : function(classVal) { + if(classVal && classVal.length > 0) { + $animate.removeClass(this.$$element, classVal); + } + }, + + /** + * Set a normalized attribute on the element in a way such that all directives + * can share the attribute. This function properly handles boolean attributes. + * @param {string} key Normalized key. (ie ngAttribute) + * @param {string|boolean} value The value to set. If `null` attribute will be deleted. + * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute. + * Defaults to true. + * @param {string=} attrName Optional none normalized name. Defaults to key. + */ + $set: function(key, value, writeAttr, attrName) { + //special case for class attribute addition + removal + //so that class changes can tap into the animation + //hooks provided by the $animate service + if(key == 'class') { + value = value || ''; + var current = this.$$element.attr('class') || ''; + this.$removeClass(tokenDifference(current, value).join(' ')); + this.$addClass(tokenDifference(value, current).join(' ')); + } else { + var booleanKey = getBooleanAttrName(this.$$element[0], key), + normalizedVal, + nodeName; + + if (booleanKey) { + this.$$element.prop(key, value); + attrName = booleanKey; + } + + this[key] = value; + + // translate normalized key to actual key + if (attrName) { + this.$attr[key] = attrName; + } else { + attrName = this.$attr[key]; + if (!attrName) { + this.$attr[key] = attrName = snake_case(key, '-'); + } + } + + nodeName = nodeName_(this.$$element); + + // sanitize a[href] and img[src] values + if ((nodeName === 'A' && key === 'href') || + (nodeName === 'IMG' && key === 'src')) { + // NOTE: urlResolve() doesn't support IE < 8 so we don't sanitize for that case. + if (!msie || msie >= 8 ) { + normalizedVal = urlResolve(value).href; + if (normalizedVal !== '') { + if ((key === 'href' && !normalizedVal.match(aHrefSanitizationWhitelist)) || + (key === 'src' && !normalizedVal.match(imgSrcSanitizationWhitelist))) { + this[key] = value = 'unsafe:' + normalizedVal; + } + } + } + } + + if (writeAttr !== false) { + if (value === null || value === undefined) { + this.$$element.removeAttr(attrName); + } else { + this.$$element.attr(attrName, value); + } + } + } + + // fire observers + var $$observers = this.$$observers; + $$observers && forEach($$observers[key], function(fn) { + try { + fn(value); + } catch (e) { + $exceptionHandler(e); + } + }); + + function tokenDifference(str1, str2) { + var values = [], + tokens1 = str1.split(/\s+/), + tokens2 = str2.split(/\s+/); + + outer: + for(var i=0;i + forEach($compileNodes, function(node, index){ + if (node.nodeType == 3 /* text node */ && node.nodeValue.match(/\S+/) /* non-empty */ ) { + $compileNodes[index] = node = jqLite(node).wrap('').parent()[0]; + } + }); + var compositeLinkFn = + compileNodes($compileNodes, transcludeFn, $compileNodes, + maxPriority, ignoreDirective, previousCompileContext); + return function publicLinkFn(scope, cloneConnectFn){ + assertArg(scope, 'scope'); + // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart + // and sometimes changes the structure of the DOM. + var $linkNode = cloneConnectFn + ? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!! + : $compileNodes; + + // Attach scope only to non-text nodes. + for(var i = 0, ii = $linkNode.length; i + addDirective(directives, + directiveNormalize(nodeName_(node).toLowerCase()), 'E', maxPriority, ignoreDirective); + + // iterate over the attributes + for (var attr, name, nName, ngAttrName, value, nAttrs = node.attributes, + j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) { + var attrStartName = false; + var attrEndName = false; + + attr = nAttrs[j]; + if (!msie || msie >= 8 || attr.specified) { + name = attr.name; + // support ngAttr attribute binding + ngAttrName = directiveNormalize(name); + if (NG_ATTR_BINDING.test(ngAttrName)) { + name = snake_case(ngAttrName.substr(6), '-'); + } + + var directiveNName = ngAttrName.replace(/(Start|End)$/, ''); + if (ngAttrName === directiveNName + 'Start') { + attrStartName = name; + attrEndName = name.substr(0, name.length - 5) + 'end'; + name = name.substr(0, name.length - 6); + } + + nName = directiveNormalize(name.toLowerCase()); + attrsMap[nName] = name; + attrs[nName] = value = trim((msie && name == 'href') + ? decodeURIComponent(node.getAttribute(name, 2)) + : attr.value); + if (getBooleanAttrName(node, nName)) { + attrs[nName] = true; // presence means true + } + addAttrInterpolateDirective(node, directives, value, nName); + addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName, + attrEndName); + } + } + + // use class as directive + className = node.className; + if (isString(className) && className !== '') { + while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) { + nName = directiveNormalize(match[2]); + if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) { + attrs[nName] = trim(match[3]); + } + className = className.substr(match.index + match[0].length); + } + } + break; + case 3: /* Text Node */ + addTextInterpolateDirective(directives, node.nodeValue); + break; + case 8: /* Comment */ + try { + match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue); + if (match) { + nName = directiveNormalize(match[1]); + if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) { + attrs[nName] = trim(match[2]); + } + } + } catch (e) { + // turns out that under some circumstances IE9 throws errors when one attempts to read + // comment's node value. + // Just ignore it and continue. (Can't seem to reproduce in test case.) + } + break; + } + + directives.sort(byPriority); + return directives; + } + + /** + * Given a node with an directive-start it collects all of the siblings until it finds + * directive-end. + * @param node + * @param attrStart + * @param attrEnd + * @returns {*} + */ + function groupScan(node, attrStart, attrEnd) { + var nodes = []; + var depth = 0; + if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) { + var startNode = node; + do { + if (!node) { + throw $compileMinErr('uterdir', + "Unterminated attribute, found '{0}' but no matching '{1}' found.", + attrStart, attrEnd); + } + if (node.nodeType == 1 /** Element **/) { + if (node.hasAttribute(attrStart)) depth++; + if (node.hasAttribute(attrEnd)) depth--; + } + nodes.push(node); + node = node.nextSibling; + } while (depth > 0); + } else { + nodes.push(node); + } + + return jqLite(nodes); + } + + /** + * Wrapper for linking function which converts normal linking function into a grouped + * linking function. + * @param linkFn + * @param attrStart + * @param attrEnd + * @returns {Function} + */ + function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) { + return function(scope, element, attrs, controllers) { + element = groupScan(element[0], attrStart, attrEnd); + return linkFn(scope, element, attrs, controllers); + }; + } + + /** + * Once the directives have been collected, their compile functions are executed. This method + * is responsible for inlining directive templates as well as terminating the application + * of the directives if the terminal directive has been reached. + * + * @param {Array} directives Array of collected directives to execute their compile function. + * this needs to be pre-sorted by priority order. + * @param {Node} compileNode The raw DOM node to apply the compile functions to + * @param {Object} templateAttrs The shared attribute function + * @param {function(angular.Scope[, cloneAttachFn]} transcludeFn A linking function, where the + * scope argument is auto-generated to the new + * child of the transcluded parent scope. + * @param {JQLite} jqCollection If we are working on the root of the compile tree then this + * argument has the root jqLite array so that we can replace nodes + * on it. + * @param {Object=} originalReplaceDirective An optional directive that will be ignored when + * compiling the transclusion. + * @param {Array.} preLinkFns + * @param {Array.} postLinkFns + * @param {Object} previousCompileContext Context used for previous compilation of the current + * node + * @returns linkFn + */ + function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, + jqCollection, originalReplaceDirective, preLinkFns, postLinkFns, + previousCompileContext) { + previousCompileContext = previousCompileContext || {}; + + var terminalPriority = -Number.MAX_VALUE, + newScopeDirective, + controllerDirectives = previousCompileContext.controllerDirectives, + newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, + templateDirective = previousCompileContext.templateDirective, + transcludeDirective = previousCompileContext.transcludeDirective, + $compileNode = templateAttrs.$$element = jqLite(compileNode), + directive, + directiveName, + $template, + replaceDirective = originalReplaceDirective, + childTranscludeFn = transcludeFn, + linkFn, + directiveValue; + + // executes all directives on the current element + for(var i = 0, ii = directives.length; i < ii; i++) { + directive = directives[i]; + var attrStart = directive.$$start; + var attrEnd = directive.$$end; + + // collect multiblock sections + if (attrStart) { + $compileNode = groupScan(compileNode, attrStart, attrEnd); + } + $template = undefined; + + if (terminalPriority > directive.priority) { + break; // prevent further processing of directives + } + + if (directiveValue = directive.scope) { + newScopeDirective = newScopeDirective || directive; + + // skip the check for directives with async templates, we'll check the derived sync + // directive when the template arrives + if (!directive.templateUrl) { + assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive, + $compileNode); + if (isObject(directiveValue)) { + newIsolateScopeDirective = directive; + } + } + } + + directiveName = directive.name; + + if (!directive.templateUrl && directive.controller) { + directiveValue = directive.controller; + controllerDirectives = controllerDirectives || {}; + assertNoDuplicate("'" + directiveName + "' controller", + controllerDirectives[directiveName], directive, $compileNode); + controllerDirectives[directiveName] = directive; + } + + if (directiveValue = directive.transclude) { + // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion. + // This option should only be used by directives that know how to how to safely handle element transclusion, + // where the transcluded nodes are added or replaced after linking. + if (!directive.$$tlb) { + assertNoDuplicate('transclusion', transcludeDirective, directive, $compileNode); + transcludeDirective = directive; + } + + if (directiveValue == 'element') { + terminalPriority = directive.priority; + $template = groupScan(compileNode, attrStart, attrEnd); + $compileNode = templateAttrs.$$element = + jqLite(document.createComment(' ' + directiveName + ': ' + + templateAttrs[directiveName] + ' ')); + compileNode = $compileNode[0]; + replaceWith(jqCollection, jqLite(sliceArgs($template)), compileNode); + + childTranscludeFn = compile($template, transcludeFn, terminalPriority, + replaceDirective && replaceDirective.name, { + // Don't pass in: + // - controllerDirectives - otherwise we'll create duplicates controllers + // - newIsolateScopeDirective or templateDirective - combining templates with + // element transclusion doesn't make sense. + // + // We need only transcludeDirective so that we prevent putting transclusion + // on the same element more than once. + transcludeDirective: transcludeDirective + }); + } else { + $template = jqLite(jqLiteClone(compileNode)).contents(); + $compileNode.html(''); // clear contents + childTranscludeFn = compile($template, transcludeFn); + } + } + + if (directive.template) { + assertNoDuplicate('template', templateDirective, directive, $compileNode); + templateDirective = directive; + + directiveValue = (isFunction(directive.template)) + ? directive.template($compileNode, templateAttrs) + : directive.template; + + directiveValue = denormalizeTemplate(directiveValue); + + if (directive.replace) { + replaceDirective = directive; + $template = jqLite('
' + + trim(directiveValue) + + '
').contents(); + compileNode = $template[0]; + + if ($template.length != 1 || compileNode.nodeType !== 1) { + throw $compileMinErr('tplrt', + "Template for directive '{0}' must have exactly one root element. {1}", + directiveName, ''); + } + + replaceWith(jqCollection, $compileNode, compileNode); + + var newTemplateAttrs = {$attr: {}}; + + // combine directives from the original node and from the template: + // - take the array of directives for this element + // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed) + // - collect directives from the template and sort them by priority + // - combine directives as: processed + template + unprocessed + var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs); + var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1)); + + if (newIsolateScopeDirective) { + markDirectivesAsIsolate(templateDirectives); + } + directives = directives.concat(templateDirectives).concat(unprocessedDirectives); + mergeTemplateAttributes(templateAttrs, newTemplateAttrs); + + ii = directives.length; + } else { + $compileNode.html(directiveValue); + } + } + + if (directive.templateUrl) { + assertNoDuplicate('template', templateDirective, directive, $compileNode); + templateDirective = directive; + + if (directive.replace) { + replaceDirective = directive; + } + + nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode, + templateAttrs, jqCollection, childTranscludeFn, preLinkFns, postLinkFns, { + controllerDirectives: controllerDirectives, + newIsolateScopeDirective: newIsolateScopeDirective, + templateDirective: templateDirective, + transcludeDirective: transcludeDirective + }); + ii = directives.length; + } else if (directive.compile) { + try { + linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn); + if (isFunction(linkFn)) { + addLinkFns(null, linkFn, attrStart, attrEnd); + } else if (linkFn) { + addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd); + } + } catch (e) { + $exceptionHandler(e, startingTag($compileNode)); + } + } + + if (directive.terminal) { + nodeLinkFn.terminal = true; + terminalPriority = Math.max(terminalPriority, directive.priority); + } + + } + + nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true; + nodeLinkFn.transclude = transcludeDirective && childTranscludeFn; + + // might be normal or delayed nodeLinkFn depending on if templateUrl is present + return nodeLinkFn; + + //////////////////// + + function addLinkFns(pre, post, attrStart, attrEnd) { + if (pre) { + if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd); + pre.require = directive.require; + if (newIsolateScopeDirective === directive || directive.$$isolateScope) { + pre = cloneAndAnnotateFn(pre, {isolateScope: true}); + } + preLinkFns.push(pre); + } + if (post) { + if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd); + post.require = directive.require; + if (newIsolateScopeDirective === directive || directive.$$isolateScope) { + post = cloneAndAnnotateFn(post, {isolateScope: true}); + } + postLinkFns.push(post); + } + } + + + function getControllers(require, $element) { + var value, retrievalMethod = 'data', optional = false; + if (isString(require)) { + while((value = require.charAt(0)) == '^' || value == '?') { + require = require.substr(1); + if (value == '^') { + retrievalMethod = 'inheritedData'; + } + optional = optional || value == '?'; + } + + value = $element[retrievalMethod]('$' + require + 'Controller'); + + if ($element[0].nodeType == 8 && $element[0].$$controller) { // Transclusion comment node + value = value || $element[0].$$controller; + $element[0].$$controller = null; + } + + if (!value && !optional) { + throw $compileMinErr('ctreq', + "Controller '{0}', required by directive '{1}', can't be found!", + require, directiveName); + } + return value; + } else if (isArray(require)) { + value = []; + forEach(require, function(require) { + value.push(getControllers(require, $element)); + }); + } + return value; + } + + + function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) { + var attrs, $element, i, ii, linkFn, controller, isolateScope; + + if (compileNode === linkNode) { + attrs = templateAttrs; + } else { + attrs = shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr)); + } + $element = attrs.$$element; + + if (newIsolateScopeDirective) { + var LOCAL_REGEXP = /^\s*([@=&])(\??)\s*(\w*)\s*$/; + var $linkNode = jqLite(linkNode); + + isolateScope = scope.$new(true); + + if (templateDirective && (templateDirective === newIsolateScopeDirective.$$originalDirective)) { + $linkNode.data('$isolateScope', isolateScope) ; + } else { + $linkNode.data('$isolateScopeNoTemplate', isolateScope); + } + + + + safeAddClass($linkNode, 'ng-isolate-scope'); + + forEach(newIsolateScopeDirective.scope, function(definition, scopeName) { + var match = definition.match(LOCAL_REGEXP) || [], + attrName = match[3] || scopeName, + optional = (match[2] == '?'), + mode = match[1], // @, =, or & + lastValue, + parentGet, parentSet; + + isolateScope.$$isolateBindings[scopeName] = mode + attrName; + + switch (mode) { + + case '@': + attrs.$observe(attrName, function(value) { + isolateScope[scopeName] = value; + }); + attrs.$$observers[attrName].$$scope = scope; + if( attrs[attrName] ) { + // If the attribute has been provided then we trigger an interpolation to ensure + // the value is there for use in the link fn + isolateScope[scopeName] = $interpolate(attrs[attrName])(scope); + } + break; + + case '=': + if (optional && !attrs[attrName]) { + return; + } + parentGet = $parse(attrs[attrName]); + parentSet = parentGet.assign || function() { + // reset the change, or we will throw this exception on every $digest + lastValue = isolateScope[scopeName] = parentGet(scope); + throw $compileMinErr('nonassign', + "Expression '{0}' used with directive '{1}' is non-assignable!", + attrs[attrName], newIsolateScopeDirective.name); + }; + lastValue = isolateScope[scopeName] = parentGet(scope); + isolateScope.$watch(function parentValueWatch() { + var parentValue = parentGet(scope); + + if (parentValue !== isolateScope[scopeName]) { + // we are out of sync and need to copy + if (parentValue !== lastValue) { + // parent changed and it has precedence + lastValue = isolateScope[scopeName] = parentValue; + } else { + // if the parent can be assigned then do so + parentSet(scope, parentValue = lastValue = isolateScope[scopeName]); + } + } + return parentValue; + }); + break; + + case '&': + parentGet = $parse(attrs[attrName]); + isolateScope[scopeName] = function(locals) { + return parentGet(scope, locals); + }; + break; + + default: + throw $compileMinErr('iscp', + "Invalid isolate scope definition for directive '{0}'." + + " Definition: {... {1}: '{2}' ...}", + newIsolateScopeDirective.name, scopeName, definition); + } + }); + } + + if (controllerDirectives) { + forEach(controllerDirectives, function(directive) { + var locals = { + $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope, + $element: $element, + $attrs: attrs, + $transclude: boundTranscludeFn + }, controllerInstance; + + controller = directive.controller; + if (controller == '@') { + controller = attrs[directive.name]; + } + + controllerInstance = $controller(controller, locals); + + // Directives with element transclusion and a controller need to attach controller + // to the comment node created by the compiler, but jQuery .data doesn't support + // attaching data to comment nodes so instead we set it directly on the element and + // remove it after we read it later. + if ($element[0].nodeType == 8) { // Transclusion comment node + $element[0].$$controller = controllerInstance; + } else { + $element.data('$' + directive.name + 'Controller', controllerInstance); + } + if (directive.controllerAs) { + locals.$scope[directive.controllerAs] = controllerInstance; + } + }); + } + + // PRELINKING + for(i = 0, ii = preLinkFns.length; i < ii; i++) { + try { + linkFn = preLinkFns[i]; + linkFn(linkFn.isolateScope ? isolateScope : scope, $element, attrs, + linkFn.require && getControllers(linkFn.require, $element)); + } catch (e) { + $exceptionHandler(e, startingTag($element)); + } + } + + // RECURSION + // We only pass the isolate scope, if the isolate directive has a template, + // otherwise the child elements do not belong to the isolate directive. + var scopeToChild = scope; + if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) { + scopeToChild = isolateScope; + } + childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn); + + // POSTLINKING + for(i = postLinkFns.length - 1; i >= 0; i--) { + try { + linkFn = postLinkFns[i]; + linkFn(linkFn.isolateScope ? isolateScope : scope, $element, attrs, + linkFn.require && getControllers(linkFn.require, $element)); + } catch (e) { + $exceptionHandler(e, startingTag($element)); + } + } + } + } + + function markDirectivesAsIsolate(directives) { + // mark all directives as needing isolate scope. + for (var j = 0, jj = directives.length; j < jj; j++) { + directives[j] = inherit(directives[j], {$$isolateScope: true}); + } + } + + /** + * looks up the directive and decorates it with exception handling and proper parameters. We + * call this the boundDirective. + * + * @param {string} name name of the directive to look up. + * @param {string} location The directive must be found in specific format. + * String containing any of theses characters: + * + * * `E`: element name + * * `A': attribute + * * `C`: class + * * `M`: comment + * @returns true if directive was added. + */ + function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName, + endAttrName) { + if (name === ignoreDirective) return null; + var match = null; + if (hasDirectives.hasOwnProperty(name)) { + for(var directive, directives = $injector.get(name + Suffix), + i = 0, ii = directives.length; i directive.priority) && + directive.restrict.indexOf(location) != -1) { + if (startAttrName) { + directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName}); + } + tDirectives.push(directive); + match = directive; + } + } catch(e) { $exceptionHandler(e); } + } + } + return match; + } + + + /** + * When the element is replaced with HTML template then the new attributes + * on the template need to be merged with the existing attributes in the DOM. + * The desired effect is to have both of the attributes present. + * + * @param {object} dst destination attributes (original DOM) + * @param {object} src source attributes (from the directive template) + */ + function mergeTemplateAttributes(dst, src) { + var srcAttr = src.$attr, + dstAttr = dst.$attr, + $element = dst.$$element; + + // reapply the old attributes to the new element + forEach(dst, function(value, key) { + if (key.charAt(0) != '$') { + if (src[key]) { + value += (key === 'style' ? ';' : ' ') + src[key]; + } + dst.$set(key, value, true, srcAttr[key]); + } + }); + + // copy the new attributes on the old attrs object + forEach(src, function(value, key) { + if (key == 'class') { + safeAddClass($element, value); + dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value; + } else if (key == 'style') { + $element.attr('style', $element.attr('style') + ';' + value); + // `dst` will never contain hasOwnProperty as DOM parser won't let it. + // You will get an "InvalidCharacterError: DOM Exception 5" error if you + // have an attribute like "has-own-property" or "data-has-own-property", etc. + } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) { + dst[key] = value; + dstAttr[key] = srcAttr[key]; + } + }); + } + + + function compileTemplateUrl(directives, $compileNode, tAttrs, + $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) { + var linkQueue = [], + afterTemplateNodeLinkFn, + afterTemplateChildLinkFn, + beforeTemplateCompileNode = $compileNode[0], + origAsyncDirective = directives.shift(), + // The fact that we have to copy and patch the directive seems wrong! + derivedSyncDirective = extend({}, origAsyncDirective, { + templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective + }), + templateUrl = (isFunction(origAsyncDirective.templateUrl)) + ? origAsyncDirective.templateUrl($compileNode, tAttrs) + : origAsyncDirective.templateUrl; + + $compileNode.html(''); + + $http.get($sce.getTrustedResourceUrl(templateUrl), {cache: $templateCache}). + success(function(content) { + var compileNode, tempTemplateAttrs, $template; + + content = denormalizeTemplate(content); + + if (origAsyncDirective.replace) { + $template = jqLite('
' + trim(content) + '
').contents(); + compileNode = $template[0]; + + if ($template.length != 1 || compileNode.nodeType !== 1) { + throw $compileMinErr('tplrt', + "Template for directive '{0}' must have exactly one root element. {1}", + origAsyncDirective.name, templateUrl); + } + + tempTemplateAttrs = {$attr: {}}; + replaceWith($rootElement, $compileNode, compileNode); + var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs); + + if (isObject(origAsyncDirective.scope)) { + markDirectivesAsIsolate(templateDirectives); + } + directives = templateDirectives.concat(directives); + mergeTemplateAttributes(tAttrs, tempTemplateAttrs); + } else { + compileNode = beforeTemplateCompileNode; + $compileNode.html(content); + } + + directives.unshift(derivedSyncDirective); + + afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs, + childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns, + previousCompileContext); + forEach($rootElement, function(node, i) { + if (node == compileNode) { + $rootElement[i] = $compileNode[0]; + } + }); + afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn); + + + while(linkQueue.length) { + var scope = linkQueue.shift(), + beforeTemplateLinkNode = linkQueue.shift(), + linkRootElement = linkQueue.shift(), + controller = linkQueue.shift(), + linkNode = $compileNode[0]; + + if (beforeTemplateLinkNode !== beforeTemplateCompileNode) { + // it was cloned therefore we have to clone as well. + linkNode = jqLiteClone(compileNode); + replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode); + } + + afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement, + controller); + } + linkQueue = null; + }). + error(function(response, code, headers, config) { + throw $compileMinErr('tpload', 'Failed to load template: {0}', config.url); + }); + + return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, controller) { + if (linkQueue) { + linkQueue.push(scope); + linkQueue.push(node); + linkQueue.push(rootElement); + linkQueue.push(controller); + } else { + afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, controller); + } + }; + } + + + /** + * Sorting function for bound directives. + */ + function byPriority(a, b) { + var diff = b.priority - a.priority; + if (diff !== 0) return diff; + if (a.name !== b.name) return (a.name < b.name) ? -1 : 1; + return a.index - b.index; + } + + + function assertNoDuplicate(what, previousDirective, directive, element) { + if (previousDirective) { + throw $compileMinErr('multidir', 'Multiple directives [{0}, {1}] asking for {2} on: {3}', + previousDirective.name, directive.name, what, startingTag(element)); + } + } + + + function addTextInterpolateDirective(directives, text) { + var interpolateFn = $interpolate(text, true); + if (interpolateFn) { + directives.push({ + priority: 0, + compile: valueFn(function textInterpolateLinkFn(scope, node) { + var parent = node.parent(), + bindings = parent.data('$binding') || []; + bindings.push(interpolateFn); + safeAddClass(parent.data('$binding', bindings), 'ng-binding'); + scope.$watch(interpolateFn, function interpolateFnWatchAction(value) { + node[0].nodeValue = value; + }); + }) + }); + } + } + + + function getTrustedContext(node, attrNormalizedName) { + // maction[xlink:href] can source SVG. It's not limited to . + if (attrNormalizedName == "xlinkHref" || + (nodeName_(node) != "IMG" && (attrNormalizedName == "src" || + attrNormalizedName == "ngSrc"))) { + return $sce.RESOURCE_URL; + } + } + + + function addAttrInterpolateDirective(node, directives, value, name) { + var interpolateFn = $interpolate(value, true); + + // no interpolation found -> ignore + if (!interpolateFn) return; + + + if (name === "multiple" && nodeName_(node) === "SELECT") { + throw $compileMinErr("selmulti", + "Binding to the 'multiple' attribute is not supported. Element: {0}", + startingTag(node)); + } + + directives.push({ + priority: 100, + compile: function() { + return { + pre: function attrInterpolatePreLinkFn(scope, element, attr) { + var $$observers = (attr.$$observers || (attr.$$observers = {})); + + if (EVENT_HANDLER_ATTR_REGEXP.test(name)) { + throw $compileMinErr('nodomevents', + "Interpolations for HTML DOM event attributes are disallowed. Please use the " + + "ng- versions (such as ng-click instead of onclick) instead."); + } + + // we need to interpolate again, in case the attribute value has been updated + // (e.g. by another directive's compile function) + interpolateFn = $interpolate(attr[name], true, getTrustedContext(node, name)); + + // if attribute was updated so that there is no interpolation going on we don't want to + // register any observers + if (!interpolateFn) return; + + // TODO(i): this should likely be attr.$set(name, iterpolateFn(scope) so that we reset the + // actual attr value + attr[name] = interpolateFn(scope); + ($$observers[name] || ($$observers[name] = [])).$$inter = true; + (attr.$$observers && attr.$$observers[name].$$scope || scope). + $watch(interpolateFn, function interpolateFnWatchAction(value) { + attr.$set(name, value); + }); + } + }; + } + }); + } + + + /** + * This is a special jqLite.replaceWith, which can replace items which + * have no parents, provided that the containing jqLite collection is provided. + * + * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes + * in the root of the tree. + * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep + * the shell, but replace its DOM node reference. + * @param {Node} newNode The new DOM node. + */ + function replaceWith($rootElement, elementsToRemove, newNode) { + var firstElementToRemove = elementsToRemove[0], + removeCount = elementsToRemove.length, + parent = firstElementToRemove.parentNode, + i, ii; + + if ($rootElement) { + for(i = 0, ii = $rootElement.length; i < ii; i++) { + if ($rootElement[i] == firstElementToRemove) { + $rootElement[i++] = newNode; + for (var j = i, j2 = j + removeCount - 1, + jj = $rootElement.length; + j < jj; j++, j2++) { + if (j2 < jj) { + $rootElement[j] = $rootElement[j2]; + } else { + delete $rootElement[j]; + } + } + $rootElement.length -= removeCount - 1; + break; + } + } + } + + if (parent) { + parent.replaceChild(newNode, firstElementToRemove); + } + var fragment = document.createDocumentFragment(); + fragment.appendChild(firstElementToRemove); + newNode[jqLite.expando] = firstElementToRemove[jqLite.expando]; + for (var k = 1, kk = elementsToRemove.length; k < kk; k++) { + var element = elementsToRemove[k]; + jqLite(element).remove(); // must do this way to clean up expando + fragment.appendChild(element); + delete elementsToRemove[k]; + } + + elementsToRemove[0] = newNode; + elementsToRemove.length = 1; + } + + + function cloneAndAnnotateFn(fn, annotation) { + return extend(function() { return fn.apply(null, arguments); }, fn, annotation); + } + }]; +} + +var PREFIX_REGEXP = /^(x[\:\-_]|data[\:\-_])/i; +/** + * Converts all accepted directives format into proper directive name. + * All of these will become 'myDirective': + * my:Directive + * my-directive + * x-my-directive + * data-my:directive + * + * Also there is special case for Moz prefix starting with upper case letter. + * @param name Name to normalize + */ +function directiveNormalize(name) { + return camelCase(name.replace(PREFIX_REGEXP, '')); +} + +/** + * @ngdoc object + * @name ng.$compile.directive.Attributes + * + * @description + * A shared object between directive compile / linking functions which contains normalized DOM + * element attributes. The values reflect current binding state `{{ }}`. The normalization is + * needed since all of these are treated as equivalent in Angular: + * + * + */ + +/** + * @ngdoc property + * @name ng.$compile.directive.Attributes#$attr + * @propertyOf ng.$compile.directive.Attributes + * @returns {object} A map of DOM element attribute names to the normalized name. This is + * needed to do reverse lookup from normalized name back to actual name. + */ + + +/** + * @ngdoc function + * @name ng.$compile.directive.Attributes#$set + * @methodOf ng.$compile.directive.Attributes + * @function + * + * @description + * Set DOM element attribute value. + * + * + * @param {string} name Normalized element attribute name of the property to modify. The name is + * revers translated using the {@link ng.$compile.directive.Attributes#$attr $attr} + * property to the original name. + * @param {string} value Value to set the attribute to. The value can be an interpolated string. + */ + + + +/** + * Closure compiler type information + */ + +function nodesetLinkingFn( + /* angular.Scope */ scope, + /* NodeList */ nodeList, + /* Element */ rootElement, + /* function(Function) */ boundTranscludeFn +){} + +function directiveLinkingFn( + /* nodesetLinkingFn */ nodesetLinkingFn, + /* angular.Scope */ scope, + /* Node */ node, + /* Element */ rootElement, + /* function(Function) */ boundTranscludeFn +){} + +/** + * @ngdoc object + * @name ng.$controllerProvider + * @description + * The {@link ng.$controller $controller service} is used by Angular to create new + * controllers. + * + * This provider allows controller registration via the + * {@link ng.$controllerProvider#methods_register register} method. + */ +function $ControllerProvider() { + var controllers = {}, + CNTRL_REG = /^(\S+)(\s+as\s+(\w+))?$/; + + + /** + * @ngdoc function + * @name ng.$controllerProvider#register + * @methodOf ng.$controllerProvider + * @param {string|Object} name Controller name, or an object map of controllers where the keys are + * the names and the values are the constructors. + * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI + * annotations in the array notation). + */ + this.register = function(name, constructor) { + assertNotHasOwnProperty(name, 'controller'); + if (isObject(name)) { + extend(controllers, name); + } else { + controllers[name] = constructor; + } + }; + + + this.$get = ['$injector', '$window', function($injector, $window) { + + /** + * @ngdoc function + * @name ng.$controller + * @requires $injector + * + * @param {Function|string} constructor If called with a function then it's considered to be the + * controller constructor function. Otherwise it's considered to be a string which is used + * to retrieve the controller constructor using the following steps: + * + * * check if a controller with given name is registered via `$controllerProvider` + * * check if evaluating the string on the current scope returns a constructor + * * check `window[constructor]` on the global `window` object + * + * @param {Object} locals Injection locals for Controller. + * @return {Object} Instance of given controller. + * + * @description + * `$controller` service is responsible for instantiating controllers. + * + * It's just a simple call to {@link AUTO.$injector $injector}, but extracted into + * a service, so that one can override this service with {@link https://gist.github.com/1649788 + * BC version}. + */ + return function(expression, locals) { + var instance, match, constructor, identifier; + + if(isString(expression)) { + match = expression.match(CNTRL_REG), + constructor = match[1], + identifier = match[3]; + expression = controllers.hasOwnProperty(constructor) + ? controllers[constructor] + : getter(locals.$scope, constructor, true) || getter($window, constructor, true); + + assertArgFn(expression, constructor, true); + } + + instance = $injector.instantiate(expression, locals); + + if (identifier) { + if (!(locals && typeof locals.$scope == 'object')) { + throw minErr('$controller')('noscp', + "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.", + constructor || expression.name, identifier); + } + + locals.$scope[identifier] = instance; + } + + return instance; + }; + }]; +} + +/** + * @ngdoc object + * @name ng.$document + * @requires $window + * + * @description + * A {@link angular.element jQuery (lite)}-wrapped reference to the browser's `window.document` + * element. + */ +function $DocumentProvider(){ + this.$get = ['$window', function(window){ + return jqLite(window.document); + }]; +} + +/** + * @ngdoc function + * @name ng.$exceptionHandler + * @requires $log + * + * @description + * Any uncaught exception in angular expressions is delegated to this service. + * The default implementation simply delegates to `$log.error` which logs it into + * the browser console. + * + * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by + * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing. + * + * ## Example: + * + *
+ *   angular.module('exceptionOverride', []).factory('$exceptionHandler', function () {
+ *     return function (exception, cause) {
+ *       exception.message += ' (caused by "' + cause + '")';
+ *       throw exception;
+ *     };
+ *   });
+ * 
+ * + * This example will override the normal action of `$exceptionHandler`, to make angular + * exceptions fail hard when they happen, instead of just logging to the console. + * + * @param {Error} exception Exception associated with the error. + * @param {string=} cause optional information about the context in which + * the error was thrown. + * + */ +function $ExceptionHandlerProvider() { + this.$get = ['$log', function($log) { + return function(exception, cause) { + $log.error.apply($log, arguments); + }; + }]; +} + +/** + * Parse headers into key value object + * + * @param {string} headers Raw headers as a string + * @returns {Object} Parsed headers as key value object + */ +function parseHeaders(headers) { + var parsed = {}, key, val, i; + + if (!headers) return parsed; + + forEach(headers.split('\n'), function(line) { + i = line.indexOf(':'); + key = lowercase(trim(line.substr(0, i))); + val = trim(line.substr(i + 1)); + + if (key) { + if (parsed[key]) { + parsed[key] += ', ' + val; + } else { + parsed[key] = val; + } + } + }); + + return parsed; +} + + +/** + * Returns a function that provides access to parsed headers. + * + * Headers are lazy parsed when first requested. + * @see parseHeaders + * + * @param {(string|Object)} headers Headers to provide access to. + * @returns {function(string=)} Returns a getter function which if called with: + * + * - if called with single an argument returns a single header value or null + * - if called with no arguments returns an object containing all headers. + */ +function headersGetter(headers) { + var headersObj = isObject(headers) ? headers : undefined; + + return function(name) { + if (!headersObj) headersObj = parseHeaders(headers); + + if (name) { + return headersObj[lowercase(name)] || null; + } + + return headersObj; + }; +} + + +/** + * Chain all given functions + * + * This function is used for both request and response transforming + * + * @param {*} data Data to transform. + * @param {function(string=)} headers Http headers getter fn. + * @param {(function|Array.)} fns Function or an array of functions. + * @returns {*} Transformed data. + */ +function transformData(data, headers, fns) { + if (isFunction(fns)) + return fns(data, headers); + + forEach(fns, function(fn) { + data = fn(data, headers); + }); + + return data; +} + + +function isSuccess(status) { + return 200 <= status && status < 300; +} + + +function $HttpProvider() { + var JSON_START = /^\s*(\[|\{[^\{])/, + JSON_END = /[\}\]]\s*$/, + PROTECTION_PREFIX = /^\)\]\}',?\n/, + CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': 'application/json;charset=utf-8'}; + + var defaults = this.defaults = { + // transform incoming response data + transformResponse: [function(data) { + if (isString(data)) { + // strip json vulnerability protection prefix + data = data.replace(PROTECTION_PREFIX, ''); + if (JSON_START.test(data) && JSON_END.test(data)) + data = fromJson(data); + } + return data; + }], + + // transform outgoing request data + transformRequest: [function(d) { + return isObject(d) && !isFile(d) ? toJson(d) : d; + }], + + // default headers + headers: { + common: { + 'Accept': 'application/json, text/plain, */*' + }, + post: CONTENT_TYPE_APPLICATION_JSON, + put: CONTENT_TYPE_APPLICATION_JSON, + patch: CONTENT_TYPE_APPLICATION_JSON + }, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN' + }; + + /** + * Are ordered by request, i.e. they are applied in the same order as the + * array, on request, but reverse order, on response. + */ + var interceptorFactories = this.interceptors = []; + + /** + * For historical reasons, response interceptors are ordered by the order in which + * they are applied to the response. (This is the opposite of interceptorFactories) + */ + var responseInterceptorFactories = this.responseInterceptors = []; + + this.$get = ['$httpBackend', '$browser', '$cacheFactory', '$rootScope', '$q', '$injector', + function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector) { + + var defaultCache = $cacheFactory('$http'); + + /** + * Interceptors stored in reverse order. Inner interceptors before outer interceptors. + * The reversal is needed so that we can build up the interception chain around the + * server request. + */ + var reversedInterceptors = []; + + forEach(interceptorFactories, function(interceptorFactory) { + reversedInterceptors.unshift(isString(interceptorFactory) + ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory)); + }); + + forEach(responseInterceptorFactories, function(interceptorFactory, index) { + var responseFn = isString(interceptorFactory) + ? $injector.get(interceptorFactory) + : $injector.invoke(interceptorFactory); + + /** + * Response interceptors go before "around" interceptors (no real reason, just + * had to pick one.) But they are already reversed, so we can't use unshift, hence + * the splice. + */ + reversedInterceptors.splice(index, 0, { + response: function(response) { + return responseFn($q.when(response)); + }, + responseError: function(response) { + return responseFn($q.reject(response)); + } + }); + }); + + + /** + * @ngdoc function + * @name ng.$http + * @requires $httpBackend + * @requires $browser + * @requires $cacheFactory + * @requires $rootScope + * @requires $q + * @requires $injector + * + * @description + * The `$http` service is a core Angular service that facilitates communication with the remote + * HTTP servers via the browser's {@link https://developer.mozilla.org/en/xmlhttprequest + * XMLHttpRequest} object or via {@link http://en.wikipedia.org/wiki/JSONP JSONP}. + * + * For unit testing applications that use `$http` service, see + * {@link ngMock.$httpBackend $httpBackend mock}. + * + * For a higher level of abstraction, please check out the {@link ngResource.$resource + * $resource} service. + * + * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by + * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage + * it is important to familiarize yourself with these APIs and the guarantees they provide. + * + * + * # General usage + * The `$http` service is a function which takes a single argument — a configuration object — + * that is used to generate an HTTP request and returns a {@link ng.$q promise} + * with two $http specific methods: `success` and `error`. + * + *
+     *   $http({method: 'GET', url: '/someUrl'}).
+     *     success(function(data, status, headers, config) {
+     *       // this callback will be called asynchronously
+     *       // when the response is available
+     *     }).
+     *     error(function(data, status, headers, config) {
+     *       // called asynchronously if an error occurs
+     *       // or server returns response with an error status.
+     *     });
+     * 
+ * + * Since the returned value of calling the $http function is a `promise`, you can also use + * the `then` method to register callbacks, and these callbacks will receive a single argument – + * an object representing the response. See the API signature and type info below for more + * details. + * + * A response status code between 200 and 299 is considered a success status and + * will result in the success callback being called. Note that if the response is a redirect, + * XMLHttpRequest will transparently follow it, meaning that the error callback will not be + * called for such responses. + * + * # Calling $http from outside AngularJS + * The `$http` service will not actually send the request until the next `$digest()` is + * executed. Normally this is not an issue, since almost all the time your call to `$http` will + * be from within a `$apply()` block. + * If you are calling `$http` from outside Angular, then you should wrap it in a call to + * `$apply` to cause a $digest to occur and also to handle errors in the block correctly. + * + * ``` + * $scope.$apply(function() { + * $http(...); + * }); + * ``` + * + * # Writing Unit Tests that use $http + * When unit testing you are mostly responsible for scheduling the `$digest` cycle. If you do + * not trigger a `$digest` before calling `$httpBackend.flush()` then the request will not have + * been made and `$httpBackend.expect(...)` expectations will fail. The solution is to run the + * code that calls the `$http()` method inside a $apply block as explained in the previous + * section. + * + * ``` + * $httpBackend.expectGET(...); + * $scope.$apply(function() { + * $http.get(...); + * }); + * $httpBackend.flush(); + * ``` + * + * # Shortcut methods + * + * Since all invocations of the $http service require passing in an HTTP method and URL, and + * POST/PUT requests require request data to be provided as well, shortcut methods + * were created: + * + *
+     *   $http.get('/someUrl').success(successCallback);
+     *   $http.post('/someUrl', data).success(successCallback);
+     * 
+ * + * Complete list of shortcut methods: + * + * - {@link ng.$http#methods_get $http.get} + * - {@link ng.$http#methods_head $http.head} + * - {@link ng.$http#methods_post $http.post} + * - {@link ng.$http#methods_put $http.put} + * - {@link ng.$http#methods_delete $http.delete} + * - {@link ng.$http#methods_jsonp $http.jsonp} + * + * + * # Setting HTTP Headers + * + * The $http service will automatically add certain HTTP headers to all requests. These defaults + * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration + * object, which currently contains this default configuration: + * + * - `$httpProvider.defaults.headers.common` (headers that are common for all requests): + * - `Accept: application/json, text/plain, * / *` + * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests) + * - `Content-Type: application/json` + * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests) + * - `Content-Type: application/json` + * + * To add or overwrite these defaults, simply add or remove a property from these configuration + * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object + * with the lowercased HTTP method name as the key, e.g. + * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }. + * + * The defaults can also be set at runtime via the `$http.defaults` object in the same + * fashion. In addition, you can supply a `headers` property in the config object passed when + * calling `$http(config)`, which overrides the defaults without changing them globally. + * + * + * # Transforming Requests and Responses + * + * Both requests and responses can be transformed using transform functions. By default, Angular + * applies these transformations: + * + * Request transformations: + * + * - If the `data` property of the request configuration object contains an object, serialize it + * into JSON format. + * + * Response transformations: + * + * - If XSRF prefix is detected, strip it (see Security Considerations section below). + * - If JSON response is detected, deserialize it using a JSON parser. + * + * To globally augment or override the default transforms, modify the + * `$httpProvider.defaults.transformRequest` and `$httpProvider.defaults.transformResponse` + * properties. These properties are by default an array of transform functions, which allows you + * to `push` or `unshift` a new transformation function into the transformation chain. You can + * also decide to completely override any default transformations by assigning your + * transformation functions to these properties directly without the array wrapper. + * + * Similarly, to locally override the request/response transforms, augment the + * `transformRequest` and/or `transformResponse` properties of the configuration object passed + * into `$http`. + * + * + * # Caching + * + * To enable caching, set the configuration property `cache` to `true`. When the cache is + * enabled, `$http` stores the response from the server in local cache. Next time the + * response is served from the cache without sending a request to the server. + * + * Note that even if the response is served from cache, delivery of the data is asynchronous in + * the same way that real requests are. + * + * If there are multiple GET requests for the same URL that should be cached using the same + * cache, but the cache is not populated yet, only one request to the server will be made and + * the remaining requests will be fulfilled using the response from the first request. + * + * A custom default cache built with $cacheFactory can be provided in $http.defaults.cache. + * To skip it, set configuration property `cache` to `false`. + * + * + * # Interceptors + * + * Before you start creating interceptors, be sure to understand the + * {@link ng.$q $q and deferred/promise APIs}. + * + * For purposes of global error handling, authentication, or any kind of synchronous or + * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be + * able to intercept requests before they are handed to the server and + * responses before they are handed over to the application code that + * initiated these requests. The interceptors leverage the {@link ng.$q + * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing. + * + * The interceptors are service factories that are registered with the `$httpProvider` by + * adding them to the `$httpProvider.interceptors` array. The factory is called and + * injected with dependencies (if specified) and returns the interceptor. + * + * There are two kinds of interceptors (and two kinds of rejection interceptors): + * + * * `request`: interceptors get called with http `config` object. The function is free to + * modify the `config` or create a new one. The function needs to return the `config` + * directly or as a promise. + * * `requestError`: interceptor gets called when a previous interceptor threw an error or + * resolved with a rejection. + * * `response`: interceptors get called with http `response` object. The function is free to + * modify the `response` or create a new one. The function needs to return the `response` + * directly or as a promise. + * * `responseError`: interceptor gets called when a previous interceptor threw an error or + * resolved with a rejection. + * + * + *
+     *   // register the interceptor as a service
+     *   $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
+     *     return {
+     *       // optional method
+     *       'request': function(config) {
+     *         // do something on success
+     *         return config || $q.when(config);
+     *       },
+     *
+     *       // optional method
+     *      'requestError': function(rejection) {
+     *         // do something on error
+     *         if (canRecover(rejection)) {
+     *           return responseOrNewPromise
+     *         }
+     *         return $q.reject(rejection);
+     *       },
+     *
+     *
+     *
+     *       // optional method
+     *       'response': function(response) {
+     *         // do something on success
+     *         return response || $q.when(response);
+     *       },
+     *
+     *       // optional method
+     *      'responseError': function(rejection) {
+     *         // do something on error
+     *         if (canRecover(rejection)) {
+     *           return responseOrNewPromise
+     *         }
+     *         return $q.reject(rejection);
+     *       };
+     *     }
+     *   });
+     *
+     *   $httpProvider.interceptors.push('myHttpInterceptor');
+     *
+     *
+     *   // register the interceptor via an anonymous factory
+     *   $httpProvider.interceptors.push(function($q, dependency1, dependency2) {
+     *     return {
+     *      'request': function(config) {
+     *          // same as above
+     *       },
+     *       'response': function(response) {
+     *          // same as above
+     *       }
+     *     };
+     *   });
+     * 
+ * + * # Response interceptors (DEPRECATED) + * + * Before you start creating interceptors, be sure to understand the + * {@link ng.$q $q and deferred/promise APIs}. + * + * For purposes of global error handling, authentication or any kind of synchronous or + * asynchronous preprocessing of received responses, it is desirable to be able to intercept + * responses for http requests before they are handed over to the application code that + * initiated these requests. The response interceptors leverage the {@link ng.$q + * promise apis} to fulfil this need for both synchronous and asynchronous preprocessing. + * + * The interceptors are service factories that are registered with the $httpProvider by + * adding them to the `$httpProvider.responseInterceptors` array. The factory is called and + * injected with dependencies (if specified) and returns the interceptor — a function that + * takes a {@link ng.$q promise} and returns the original or a new promise. + * + *
+     *   // register the interceptor as a service
+     *   $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
+     *     return function(promise) {
+     *       return promise.then(function(response) {
+     *         // do something on success
+     *         return response;
+     *       }, function(response) {
+     *         // do something on error
+     *         if (canRecover(response)) {
+     *           return responseOrNewPromise
+     *         }
+     *         return $q.reject(response);
+     *       });
+     *     }
+     *   });
+     *
+     *   $httpProvider.responseInterceptors.push('myHttpInterceptor');
+     *
+     *
+     *   // register the interceptor via an anonymous factory
+     *   $httpProvider.responseInterceptors.push(function($q, dependency1, dependency2) {
+     *     return function(promise) {
+     *       // same as above
+     *     }
+     *   });
+     * 
+ * + * + * # Security Considerations + * + * When designing web applications, consider security threats from: + * + * - {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx + * JSON vulnerability} + * - {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF} + * + * Both server and the client must cooperate in order to eliminate these threats. Angular comes + * pre-configured with strategies that address these issues, but for this to work backend server + * cooperation is required. + * + * ## JSON Vulnerability Protection + * + * A {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx + * JSON vulnerability} allows third party website to turn your JSON resource URL into + * {@link http://en.wikipedia.org/wiki/JSONP JSONP} request under some conditions. To + * counter this your server can prefix all JSON requests with following string `")]}',\n"`. + * Angular will automatically strip the prefix before processing it as JSON. + * + * For example if your server needs to return: + *
+     * ['one','two']
+     * 
+ * + * which is vulnerable to attack, your server can return: + *
+     * )]}',
+     * ['one','two']
+     * 
+ * + * Angular will strip the prefix, before processing the JSON. + * + * + * ## Cross Site Request Forgery (XSRF) Protection + * + * {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF} is a technique by which + * an unauthorized site can gain your user's private data. Angular provides a mechanism + * to counter XSRF. When performing XHR requests, the $http service reads a token from a cookie + * (by default, `XSRF-TOKEN`) and sets it as an HTTP header (`X-XSRF-TOKEN`). Since only + * JavaScript that runs on your domain could read the cookie, your server can be assured that + * the XHR came from JavaScript running on your domain. The header will not be set for + * cross-domain requests. + * + * To take advantage of this, your server needs to set a token in a JavaScript readable session + * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the + * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure + * that only JavaScript running on your domain could have sent the request. The token must be + * unique for each user and must be verifiable by the server (to prevent the JavaScript from + * making up its own tokens). We recommend that the token is a digest of your site's + * authentication cookie with a {@link https://en.wikipedia.org/wiki/Salt_(cryptography) salt} + * for added security. + * + * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName + * properties of either $httpProvider.defaults, or the per-request config object. + * + * + * @param {object} config Object describing the request to be made and how it should be + * processed. The object has following properties: + * + * - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc) + * - **url** – `{string}` – Absolute or relative URL of the resource that is being requested. + * - **params** – `{Object.}` – Map of strings or objects which will be turned + * to `?key1=value1&key2=value2` after the url. If the value is not a string, it will be + * JSONified. + * - **data** – `{string|Object}` – Data to be sent as the request message data. + * - **headers** – `{Object}` – Map of strings or functions which return strings representing + * HTTP headers to send to the server. If the return value of a function is null, the + * header will not be sent. + * - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token. + * - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token. + * - **transformRequest** – + * `{function(data, headersGetter)|Array.}` – + * transform function or an array of such functions. The transform function takes the http + * request body and headers and returns its transformed (typically serialized) version. + * - **transformResponse** – + * `{function(data, headersGetter)|Array.}` – + * transform function or an array of such functions. The transform function takes the http + * response body and headers and returns its transformed (typically deserialized) version. + * - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the + * GET request, otherwise if a cache instance built with + * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for + * caching. + * - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} + * that should abort the request when resolved. + * - **withCredentials** - `{boolean}` - whether to to set the `withCredentials` flag on the + * XHR object. See {@link https://developer.mozilla.org/en/http_access_control#section_5 + * requests with credentials} for more information. + * - **responseType** - `{string}` - see {@link + * https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType requestType}. + * + * @returns {HttpPromise} Returns a {@link ng.$q promise} object with the + * standard `then` method and two http specific methods: `success` and `error`. The `then` + * method takes two arguments a success and an error callback which will be called with a + * response object. The `success` and `error` methods take a single argument - a function that + * will be called when the request succeeds or fails respectively. The arguments passed into + * these functions are destructured representation of the response object passed into the + * `then` method. The response object has these properties: + * + * - **data** – `{string|Object}` – The response body transformed with the transform + * functions. + * - **status** – `{number}` – HTTP status code of the response. + * - **headers** – `{function([headerName])}` – Header getter function. + * - **config** – `{Object}` – The configuration object that was used to generate the request. + * + * @property {Array.} pendingRequests Array of config objects for currently pending + * requests. This is primarily meant to be used for debugging purposes. + * + * + * @example + + +
+ + +
+ + + +
http status code: {{status}}
+
http response data: {{data}}
+
+
+ + function FetchCtrl($scope, $http, $templateCache) { + $scope.method = 'GET'; + $scope.url = 'http-hello.html'; + + $scope.fetch = function() { + $scope.code = null; + $scope.response = null; + + $http({method: $scope.method, url: $scope.url, cache: $templateCache}). + success(function(data, status) { + $scope.status = status; + $scope.data = data; + }). + error(function(data, status) { + $scope.data = data || "Request failed"; + $scope.status = status; + }); + }; + + $scope.updateModel = function(method, url) { + $scope.method = method; + $scope.url = url; + }; + } + + + Hello, $http! + + + it('should make an xhr GET request', function() { + element(':button:contains("Sample GET")').click(); + element(':button:contains("fetch")').click(); + expect(binding('status')).toBe('200'); + expect(binding('data')).toMatch(/Hello, \$http!/); + }); + + it('should make a JSONP request to angularjs.org', function() { + element(':button:contains("Sample JSONP")').click(); + element(':button:contains("fetch")').click(); + expect(binding('status')).toBe('200'); + expect(binding('data')).toMatch(/Super Hero!/); + }); + + it('should make JSONP request to invalid URL and invoke the error handler', + function() { + element(':button:contains("Invalid JSONP")').click(); + element(':button:contains("fetch")').click(); + expect(binding('status')).toBe('0'); + expect(binding('data')).toBe('Request failed'); + }); + +
+ */ + function $http(requestConfig) { + var config = { + transformRequest: defaults.transformRequest, + transformResponse: defaults.transformResponse + }; + var headers = mergeHeaders(requestConfig); + + extend(config, requestConfig); + config.headers = headers; + config.method = uppercase(config.method); + + var xsrfValue = urlIsSameOrigin(config.url) + ? $browser.cookies()[config.xsrfCookieName || defaults.xsrfCookieName] + : undefined; + if (xsrfValue) { + headers[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue; + } + + + var serverRequest = function(config) { + headers = config.headers; + var reqData = transformData(config.data, headersGetter(headers), config.transformRequest); + + // strip content-type if data is undefined + if (isUndefined(config.data)) { + forEach(headers, function(value, header) { + if (lowercase(header) === 'content-type') { + delete headers[header]; + } + }); + } + + if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) { + config.withCredentials = defaults.withCredentials; + } + + // send request + return sendReq(config, reqData, headers).then(transformResponse, transformResponse); + }; + + var chain = [serverRequest, undefined]; + var promise = $q.when(config); + + // apply interceptors + forEach(reversedInterceptors, function(interceptor) { + if (interceptor.request || interceptor.requestError) { + chain.unshift(interceptor.request, interceptor.requestError); + } + if (interceptor.response || interceptor.responseError) { + chain.push(interceptor.response, interceptor.responseError); + } + }); + + while(chain.length) { + var thenFn = chain.shift(); + var rejectFn = chain.shift(); + + promise = promise.then(thenFn, rejectFn); + } + + promise.success = function(fn) { + promise.then(function(response) { + fn(response.data, response.status, response.headers, config); + }); + return promise; + }; + + promise.error = function(fn) { + promise.then(null, function(response) { + fn(response.data, response.status, response.headers, config); + }); + return promise; + }; + + return promise; + + function transformResponse(response) { + // make a copy since the response must be cacheable + var resp = extend({}, response, { + data: transformData(response.data, response.headers, config.transformResponse) + }); + return (isSuccess(response.status)) + ? resp + : $q.reject(resp); + } + + function mergeHeaders(config) { + var defHeaders = defaults.headers, + reqHeaders = extend({}, config.headers), + defHeaderName, lowercaseDefHeaderName, reqHeaderName; + + defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]); + + // execute if header value is function + execHeaders(defHeaders); + execHeaders(reqHeaders); + + // using for-in instead of forEach to avoid unecessary iteration after header has been found + defaultHeadersIteration: + for (defHeaderName in defHeaders) { + lowercaseDefHeaderName = lowercase(defHeaderName); + + for (reqHeaderName in reqHeaders) { + if (lowercase(reqHeaderName) === lowercaseDefHeaderName) { + continue defaultHeadersIteration; + } + } + + reqHeaders[defHeaderName] = defHeaders[defHeaderName]; + } + + return reqHeaders; + + function execHeaders(headers) { + var headerContent; + + forEach(headers, function(headerFn, header) { + if (isFunction(headerFn)) { + headerContent = headerFn(); + if (headerContent != null) { + headers[header] = headerContent; + } else { + delete headers[header]; + } + } + }); + } + } + } + + $http.pendingRequests = []; + + /** + * @ngdoc method + * @name ng.$http#get + * @methodOf ng.$http + * + * @description + * Shortcut method to perform `GET` request. + * + * @param {string} url Relative or absolute URL specifying the destination of the request + * @param {Object=} config Optional configuration object + * @returns {HttpPromise} Future object + */ + + /** + * @ngdoc method + * @name ng.$http#delete + * @methodOf ng.$http + * + * @description + * Shortcut method to perform `DELETE` request. + * + * @param {string} url Relative or absolute URL specifying the destination of the request + * @param {Object=} config Optional configuration object + * @returns {HttpPromise} Future object + */ + + /** + * @ngdoc method + * @name ng.$http#head + * @methodOf ng.$http + * + * @description + * Shortcut method to perform `HEAD` request. + * + * @param {string} url Relative or absolute URL specifying the destination of the request + * @param {Object=} config Optional configuration object + * @returns {HttpPromise} Future object + */ + + /** + * @ngdoc method + * @name ng.$http#jsonp + * @methodOf ng.$http + * + * @description + * Shortcut method to perform `JSONP` request. + * + * @param {string} url Relative or absolute URL specifying the destination of the request. + * Should contain `JSON_CALLBACK` string. + * @param {Object=} config Optional configuration object + * @returns {HttpPromise} Future object + */ + createShortMethods('get', 'delete', 'head', 'jsonp'); + + /** + * @ngdoc method + * @name ng.$http#post + * @methodOf ng.$http + * + * @description + * Shortcut method to perform `POST` request. + * + * @param {string} url Relative or absolute URL specifying the destination of the request + * @param {*} data Request content + * @param {Object=} config Optional configuration object + * @returns {HttpPromise} Future object + */ + + /** + * @ngdoc method + * @name ng.$http#put + * @methodOf ng.$http + * + * @description + * Shortcut method to perform `PUT` request. + * + * @param {string} url Relative or absolute URL specifying the destination of the request + * @param {*} data Request content + * @param {Object=} config Optional configuration object + * @returns {HttpPromise} Future object + */ + createShortMethodsWithData('post', 'put'); + + /** + * @ngdoc property + * @name ng.$http#defaults + * @propertyOf ng.$http + * + * @description + * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of + * default headers, withCredentials as well as request and response transformations. + * + * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above. + */ + $http.defaults = defaults; + + + return $http; + + + function createShortMethods(names) { + forEach(arguments, function(name) { + $http[name] = function(url, config) { + return $http(extend(config || {}, { + method: name, + url: url + })); + }; + }); + } + + + function createShortMethodsWithData(name) { + forEach(arguments, function(name) { + $http[name] = function(url, data, config) { + return $http(extend(config || {}, { + method: name, + url: url, + data: data + })); + }; + }); + } + + + /** + * Makes the request. + * + * !!! ACCESSES CLOSURE VARS: + * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests + */ + function sendReq(config, reqData, reqHeaders) { + var deferred = $q.defer(), + promise = deferred.promise, + cache, + cachedResp, + url = buildUrl(config.url, config.params); + + $http.pendingRequests.push(config); + promise.then(removePendingReq, removePendingReq); + + + if ((config.cache || defaults.cache) && config.cache !== false && config.method == 'GET') { + cache = isObject(config.cache) ? config.cache + : isObject(defaults.cache) ? defaults.cache + : defaultCache; + } + + if (cache) { + cachedResp = cache.get(url); + if (isDefined(cachedResp)) { + if (cachedResp.then) { + // cached request has already been sent, but there is no response yet + cachedResp.then(removePendingReq, removePendingReq); + return cachedResp; + } else { + // serving from cache + if (isArray(cachedResp)) { + resolvePromise(cachedResp[1], cachedResp[0], copy(cachedResp[2])); + } else { + resolvePromise(cachedResp, 200, {}); + } + } + } else { + // put the promise for the non-transformed response into cache as a placeholder + cache.put(url, promise); + } + } + + // if we won't have the response in cache, send the request to the backend + if (isUndefined(cachedResp)) { + $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout, + config.withCredentials, config.responseType); + } + + return promise; + + + /** + * Callback registered to $httpBackend(): + * - caches the response if desired + * - resolves the raw $http promise + * - calls $apply + */ + function done(status, response, headersString) { + if (cache) { + if (isSuccess(status)) { + cache.put(url, [status, response, parseHeaders(headersString)]); + } else { + // remove promise from the cache + cache.remove(url); + } + } + + resolvePromise(response, status, headersString); + if (!$rootScope.$$phase) $rootScope.$apply(); + } + + + /** + * Resolves the raw $http promise. + */ + function resolvePromise(response, status, headers) { + // normalize internal statuses to 0 + status = Math.max(status, 0); + + (isSuccess(status) ? deferred.resolve : deferred.reject)({ + data: response, + status: status, + headers: headersGetter(headers), + config: config + }); + } + + + function removePendingReq() { + var idx = indexOf($http.pendingRequests, config); + if (idx !== -1) $http.pendingRequests.splice(idx, 1); + } + } + + + function buildUrl(url, params) { + if (!params) return url; + var parts = []; + forEachSorted(params, function(value, key) { + if (value === null || isUndefined(value)) return; + if (!isArray(value)) value = [value]; + + forEach(value, function(v) { + if (isObject(v)) { + v = toJson(v); + } + parts.push(encodeUriQuery(key) + '=' + + encodeUriQuery(v)); + }); + }); + return url + ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&'); + } + + + }]; +} + +var XHR = window.XMLHttpRequest || function() { + /* global ActiveXObject */ + try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e1) {} + try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e2) {} + try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e3) {} + throw minErr('$httpBackend')('noxhr', "This browser does not support XMLHttpRequest."); +}; + + +/** + * @ngdoc object + * @name ng.$httpBackend + * @requires $browser + * @requires $window + * @requires $document + * + * @description + * HTTP backend used by the {@link ng.$http service} that delegates to + * XMLHttpRequest object or JSONP and deals with browser incompatibilities. + * + * You should never need to use this service directly, instead use the higher-level abstractions: + * {@link ng.$http $http} or {@link ngResource.$resource $resource}. + * + * During testing this implementation is swapped with {@link ngMock.$httpBackend mock + * $httpBackend} which can be trained with responses. + */ +function $HttpBackendProvider() { + this.$get = ['$browser', '$window', '$document', function($browser, $window, $document) { + return createHttpBackend($browser, XHR, $browser.defer, $window.angular.callbacks, + $document[0], $window.location.protocol.replace(':', '')); + }]; +} + +function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, locationProtocol) { + // TODO(vojta): fix the signature + return function(method, url, post, callback, headers, timeout, withCredentials, responseType) { + var status; + $browser.$$incOutstandingRequestCount(); + url = url || $browser.url(); + + if (lowercase(method) == 'jsonp') { + var callbackId = '_' + (callbacks.counter++).toString(36); + callbacks[callbackId] = function(data) { + callbacks[callbackId].data = data; + }; + + var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId), + function() { + if (callbacks[callbackId].data) { + completeRequest(callback, 200, callbacks[callbackId].data); + } else { + completeRequest(callback, status || -2); + } + delete callbacks[callbackId]; + }); + } else { + var xhr = new XHR(); + xhr.open(method, url, true); + forEach(headers, function(value, key) { + if (isDefined(value)) { + xhr.setRequestHeader(key, value); + } + }); + + // In IE6 and 7, this might be called synchronously when xhr.send below is called and the + // response is in the cache. the promise api will ensure that to the app code the api is + // always async + xhr.onreadystatechange = function() { + if (xhr.readyState == 4) { + var responseHeaders = xhr.getAllResponseHeaders(); + + // responseText is the old-school way of retrieving response (supported by IE8 & 9) + // response/responseType properties were introduced in XHR Level2 spec (supported by IE10) + completeRequest(callback, + status || xhr.status, + (xhr.responseType ? xhr.response : xhr.responseText), + responseHeaders); + } + }; + + if (withCredentials) { + xhr.withCredentials = true; + } + + if (responseType) { + xhr.responseType = responseType; + } + + xhr.send(post || null); + } + + if (timeout > 0) { + var timeoutId = $browserDefer(timeoutRequest, timeout); + } else if (timeout && timeout.then) { + timeout.then(timeoutRequest); + } + + + function timeoutRequest() { + status = -1; + jsonpDone && jsonpDone(); + xhr && xhr.abort(); + } + + function completeRequest(callback, status, response, headersString) { + var protocol = locationProtocol || urlResolve(url).protocol; + + // cancel timeout and subsequent timeout promise resolution + timeoutId && $browserDefer.cancel(timeoutId); + jsonpDone = xhr = null; + + // fix status code for file protocol (it's always 0) + status = (protocol == 'file') ? (response ? 200 : 404) : status; + + // normalize IE bug (http://bugs.jquery.com/ticket/1450) + status = status == 1223 ? 204 : status; + + callback(status, response, headersString); + $browser.$$completeOutstandingRequest(noop); + } + }; + + function jsonpReq(url, done) { + // we can't use jQuery/jqLite here because jQuery does crazy shit with script elements, e.g.: + // - fetches local scripts via XHR and evals them + // - adds and immediately removes script elements from the document + var script = rawDocument.createElement('script'), + doneWrapper = function() { + rawDocument.body.removeChild(script); + if (done) done(); + }; + + script.type = 'text/javascript'; + script.src = url; + + if (msie) { + script.onreadystatechange = function() { + if (/loaded|complete/.test(script.readyState)) doneWrapper(); + }; + } else { + script.onload = script.onerror = doneWrapper; + } + + rawDocument.body.appendChild(script); + return doneWrapper; + } +} + +var $interpolateMinErr = minErr('$interpolate'); + +/** + * @ngdoc object + * @name ng.$interpolateProvider + * @function + * + * @description + * + * Used for configuring the interpolation markup. Defaults to `{{` and `}}`. + * + * @example + + + +
+ //demo.label// +
+
+ + it('should interpolate binding with custom symbols', function() { + expect(binding('demo.label')).toBe('This binding is brought you by // interpolation symbols.'); + }); + +
+ */ +function $InterpolateProvider() { + var startSymbol = '{{'; + var endSymbol = '}}'; + + /** + * @ngdoc method + * @name ng.$interpolateProvider#startSymbol + * @methodOf ng.$interpolateProvider + * @description + * Symbol to denote start of expression in the interpolated string. Defaults to `{{`. + * + * @param {string=} value new value to set the starting symbol to. + * @returns {string|self} Returns the symbol when used as getter and self if used as setter. + */ + this.startSymbol = function(value){ + if (value) { + startSymbol = value; + return this; + } else { + return startSymbol; + } + }; + + /** + * @ngdoc method + * @name ng.$interpolateProvider#endSymbol + * @methodOf ng.$interpolateProvider + * @description + * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`. + * + * @param {string=} value new value to set the ending symbol to. + * @returns {string|self} Returns the symbol when used as getter and self if used as setter. + */ + this.endSymbol = function(value){ + if (value) { + endSymbol = value; + return this; + } else { + return endSymbol; + } + }; + + + this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) { + var startSymbolLength = startSymbol.length, + endSymbolLength = endSymbol.length; + + /** + * @ngdoc function + * @name ng.$interpolate + * @function + * + * @requires $parse + * @requires $sce + * + * @description + * + * Compiles a string with markup into an interpolation function. This service is used by the + * HTML {@link ng.$compile $compile} service for data binding. See + * {@link ng.$interpolateProvider $interpolateProvider} for configuring the + * interpolation markup. + * + * +
+         var $interpolate = ...; // injected
+         var exp = $interpolate('Hello {{name}}!');
+         expect(exp({name:'Angular'}).toEqual('Hello Angular!');
+       
+ * + * + * @param {string} text The text with markup to interpolate. + * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have + * embedded expression in order to return an interpolation function. Strings with no + * embedded expression will return null for the interpolation function. + * @param {string=} trustedContext when provided, the returned function passes the interpolated + * result through {@link ng.$sce#methods_getTrusted $sce.getTrusted(interpolatedResult, + * trustedContext)} before returning it. Refer to the {@link ng.$sce $sce} service that + * provides Strict Contextual Escaping for details. + * @returns {function(context)} an interpolation function which is used to compute the + * interpolated string. The function has these parameters: + * + * * `context`: an object against which any expressions embedded in the strings are evaluated + * against. + * + */ + function $interpolate(text, mustHaveExpression, trustedContext) { + var startIndex, + endIndex, + index = 0, + parts = [], + length = text.length, + hasInterpolation = false, + fn, + exp, + concat = []; + + while(index < length) { + if ( ((startIndex = text.indexOf(startSymbol, index)) != -1) && + ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1) ) { + (index != startIndex) && parts.push(text.substring(index, startIndex)); + parts.push(fn = $parse(exp = text.substring(startIndex + startSymbolLength, endIndex))); + fn.exp = exp; + index = endIndex + endSymbolLength; + hasInterpolation = true; + } else { + // we did not find anything, so we have to add the remainder to the parts array + (index != length) && parts.push(text.substring(index)); + index = length; + } + } + + if (!(length = parts.length)) { + // we added, nothing, must have been an empty string. + parts.push(''); + length = 1; + } + + // Concatenating expressions makes it hard to reason about whether some combination of + // concatenated values are unsafe to use and could easily lead to XSS. By requiring that a + // single expression be used for iframe[src], object[src], etc., we ensure that the value + // that's used is assigned or constructed by some JS code somewhere that is more testable or + // make it obvious that you bound the value to some user controlled value. This helps reduce + // the load when auditing for XSS issues. + if (trustedContext && parts.length > 1) { + throw $interpolateMinErr('noconcat', + "Error while interpolating: {0}\nStrict Contextual Escaping disallows " + + "interpolations that concatenate multiple expressions when a trusted value is " + + "required. See http://docs.angularjs.org/api/ng.$sce", text); + } + + if (!mustHaveExpression || hasInterpolation) { + concat.length = length; + fn = function(context) { + try { + for(var i = 0, ii = length, part; i 0 && iteration >= count) { + deferred.resolve(iteration); + clearInterval(promise.$$intervalId); + delete intervals[promise.$$intervalId]; + } + + if (!skipApply) $rootScope.$apply(); + + }, delay); + + intervals[promise.$$intervalId] = deferred; + + return promise; + } + + + /** + * @ngdoc function + * @name ng.$interval#cancel + * @methodOf ng.$interval + * + * @description + * Cancels a task associated with the `promise`. + * + * @param {number} promise Promise returned by the `$interval` function. + * @returns {boolean} Returns `true` if the task was successfully canceled. + */ + interval.cancel = function(promise) { + if (promise && promise.$$intervalId in intervals) { + intervals[promise.$$intervalId].reject('canceled'); + clearInterval(promise.$$intervalId); + delete intervals[promise.$$intervalId]; + return true; + } + return false; + }; + + return interval; + }]; +} + +/** + * @ngdoc object + * @name ng.$locale + * + * @description + * $locale service provides localization rules for various Angular components. As of right now the + * only public api is: + * + * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`) + */ +function $LocaleProvider(){ + this.$get = function() { + return { + id: 'en-us', + + NUMBER_FORMATS: { + DECIMAL_SEP: '.', + GROUP_SEP: ',', + PATTERNS: [ + { // Decimal Pattern + minInt: 1, + minFrac: 0, + maxFrac: 3, + posPre: '', + posSuf: '', + negPre: '-', + negSuf: '', + gSize: 3, + lgSize: 3 + },{ //Currency Pattern + minInt: 1, + minFrac: 2, + maxFrac: 2, + posPre: '\u00A4', + posSuf: '', + negPre: '(\u00A4', + negSuf: ')', + gSize: 3, + lgSize: 3 + } + ], + CURRENCY_SYM: '$' + }, + + DATETIME_FORMATS: { + MONTH: + 'January,February,March,April,May,June,July,August,September,October,November,December' + .split(','), + SHORTMONTH: 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','), + DAY: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','), + SHORTDAY: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(','), + AMPMS: ['AM','PM'], + medium: 'MMM d, y h:mm:ss a', + short: 'M/d/yy h:mm a', + fullDate: 'EEEE, MMMM d, y', + longDate: 'MMMM d, y', + mediumDate: 'MMM d, y', + shortDate: 'M/d/yy', + mediumTime: 'h:mm:ss a', + shortTime: 'h:mm a' + }, + + pluralCat: function(num) { + if (num === 1) { + return 'one'; + } + return 'other'; + } + }; + }; +} + +var PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/, + DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21}; +var $locationMinErr = minErr('$location'); + + +/** + * Encode path using encodeUriSegment, ignoring forward slashes + * + * @param {string} path Path to encode + * @returns {string} + */ +function encodePath(path) { + var segments = path.split('/'), + i = segments.length; + + while (i--) { + segments[i] = encodeUriSegment(segments[i]); + } + + return segments.join('/'); +} + +function parseAbsoluteUrl(absoluteUrl, locationObj) { + var parsedUrl = urlResolve(absoluteUrl); + + locationObj.$$protocol = parsedUrl.protocol; + locationObj.$$host = parsedUrl.hostname; + locationObj.$$port = int(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null; +} + + +function parseAppUrl(relativeUrl, locationObj) { + var prefixed = (relativeUrl.charAt(0) !== '/'); + if (prefixed) { + relativeUrl = '/' + relativeUrl; + } + var match = urlResolve(relativeUrl); + locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ? + match.pathname.substring(1) : match.pathname); + locationObj.$$search = parseKeyValue(match.search); + locationObj.$$hash = decodeURIComponent(match.hash); + + // make sure path starts with '/'; + if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') { + locationObj.$$path = '/' + locationObj.$$path; + } +} + + +/** + * + * @param {string} begin + * @param {string} whole + * @returns {string} returns text from whole after begin or undefined if it does not begin with + * expected string. + */ +function beginsWith(begin, whole) { + if (whole.indexOf(begin) === 0) { + return whole.substr(begin.length); + } +} + + +function stripHash(url) { + var index = url.indexOf('#'); + return index == -1 ? url : url.substr(0, index); +} + + +function stripFile(url) { + return url.substr(0, stripHash(url).lastIndexOf('/') + 1); +} + +/* return the server only (scheme://host:port) */ +function serverBase(url) { + return url.substring(0, url.indexOf('/', url.indexOf('//') + 2)); +} + + +/** + * LocationHtml5Url represents an url + * This object is exposed as $location service when HTML5 mode is enabled and supported + * + * @constructor + * @param {string} appBase application base URL + * @param {string} basePrefix url path prefix + */ +function LocationHtml5Url(appBase, basePrefix) { + this.$$html5 = true; + basePrefix = basePrefix || ''; + var appBaseNoFile = stripFile(appBase); + parseAbsoluteUrl(appBase, this); + + + /** + * Parse given html5 (regular) url string into properties + * @param {string} newAbsoluteUrl HTML5 url + * @private + */ + this.$$parse = function(url) { + var pathUrl = beginsWith(appBaseNoFile, url); + if (!isString(pathUrl)) { + throw $locationMinErr('ipthprfx', 'Invalid url "{0}", missing path prefix "{1}".', url, + appBaseNoFile); + } + + parseAppUrl(pathUrl, this); + + if (!this.$$path) { + this.$$path = '/'; + } + + this.$$compose(); + }; + + /** + * Compose url and update `absUrl` property + * @private + */ + this.$$compose = function() { + var search = toKeyValue(this.$$search), + hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; + + this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; + this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/' + }; + + this.$$rewrite = function(url) { + var appUrl, prevAppUrl; + + if ( (appUrl = beginsWith(appBase, url)) !== undefined ) { + prevAppUrl = appUrl; + if ( (appUrl = beginsWith(basePrefix, appUrl)) !== undefined ) { + return appBaseNoFile + (beginsWith('/', appUrl) || appUrl); + } else { + return appBase + prevAppUrl; + } + } else if ( (appUrl = beginsWith(appBaseNoFile, url)) !== undefined ) { + return appBaseNoFile + appUrl; + } else if (appBaseNoFile == url + '/') { + return appBaseNoFile; + } + }; +} + + +/** + * LocationHashbangUrl represents url + * This object is exposed as $location service when developer doesn't opt into html5 mode. + * It also serves as the base class for html5 mode fallback on legacy browsers. + * + * @constructor + * @param {string} appBase application base URL + * @param {string} hashPrefix hashbang prefix + */ +function LocationHashbangUrl(appBase, hashPrefix) { + var appBaseNoFile = stripFile(appBase); + + parseAbsoluteUrl(appBase, this); + + + /** + * Parse given hashbang url into properties + * @param {string} url Hashbang url + * @private + */ + this.$$parse = function(url) { + var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url); + var withoutHashUrl = withoutBaseUrl.charAt(0) == '#' + ? beginsWith(hashPrefix, withoutBaseUrl) + : (this.$$html5) + ? withoutBaseUrl + : ''; + + if (!isString(withoutHashUrl)) { + throw $locationMinErr('ihshprfx', 'Invalid url "{0}", missing hash prefix "{1}".', url, + hashPrefix); + } + parseAppUrl(withoutHashUrl, this); + this.$$compose(); + }; + + /** + * Compose hashbang url and update `absUrl` property + * @private + */ + this.$$compose = function() { + var search = toKeyValue(this.$$search), + hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; + + this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; + this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : ''); + }; + + this.$$rewrite = function(url) { + if(stripHash(appBase) == stripHash(url)) { + return url; + } + }; +} + + +/** + * LocationHashbangUrl represents url + * This object is exposed as $location service when html5 history api is enabled but the browser + * does not support it. + * + * @constructor + * @param {string} appBase application base URL + * @param {string} hashPrefix hashbang prefix + */ +function LocationHashbangInHtml5Url(appBase, hashPrefix) { + this.$$html5 = true; + LocationHashbangUrl.apply(this, arguments); + + var appBaseNoFile = stripFile(appBase); + + this.$$rewrite = function(url) { + var appUrl; + + if ( appBase == stripHash(url) ) { + return url; + } else if ( (appUrl = beginsWith(appBaseNoFile, url)) ) { + return appBase + hashPrefix + appUrl; + } else if ( appBaseNoFile === url + '/') { + return appBaseNoFile; + } + }; +} + + +LocationHashbangInHtml5Url.prototype = + LocationHashbangUrl.prototype = + LocationHtml5Url.prototype = { + + /** + * Are we in html5 mode? + * @private + */ + $$html5: false, + + /** + * Has any change been replacing ? + * @private + */ + $$replace: false, + + /** + * @ngdoc method + * @name ng.$location#absUrl + * @methodOf ng.$location + * + * @description + * This method is getter only. + * + * Return full url representation with all segments encoded according to rules specified in + * {@link http://www.ietf.org/rfc/rfc3986.txt RFC 3986}. + * + * @return {string} full url + */ + absUrl: locationGetter('$$absUrl'), + + /** + * @ngdoc method + * @name ng.$location#url + * @methodOf ng.$location + * + * @description + * This method is getter / setter. + * + * Return url (e.g. `/path?a=b#hash`) when called without any parameter. + * + * Change path, search and hash, when called with parameter and return `$location`. + * + * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`) + * @param {string=} replace The path that will be changed + * @return {string} url + */ + url: function(url, replace) { + if (isUndefined(url)) + return this.$$url; + + var match = PATH_MATCH.exec(url); + if (match[1]) this.path(decodeURIComponent(match[1])); + if (match[2] || match[1]) this.search(match[3] || ''); + this.hash(match[5] || '', replace); + + return this; + }, + + /** + * @ngdoc method + * @name ng.$location#protocol + * @methodOf ng.$location + * + * @description + * This method is getter only. + * + * Return protocol of current url. + * + * @return {string} protocol of current url + */ + protocol: locationGetter('$$protocol'), + + /** + * @ngdoc method + * @name ng.$location#host + * @methodOf ng.$location + * + * @description + * This method is getter only. + * + * Return host of current url. + * + * @return {string} host of current url. + */ + host: locationGetter('$$host'), + + /** + * @ngdoc method + * @name ng.$location#port + * @methodOf ng.$location + * + * @description + * This method is getter only. + * + * Return port of current url. + * + * @return {Number} port + */ + port: locationGetter('$$port'), + + /** + * @ngdoc method + * @name ng.$location#path + * @methodOf ng.$location + * + * @description + * This method is getter / setter. + * + * Return path of current url when called without any parameter. + * + * Change path when called with parameter and return `$location`. + * + * Note: Path should always begin with forward slash (/), this method will add the forward slash + * if it is missing. + * + * @param {string=} path New path + * @return {string} path + */ + path: locationGetterSetter('$$path', function(path) { + return path.charAt(0) == '/' ? path : '/' + path; + }), + + /** + * @ngdoc method + * @name ng.$location#search + * @methodOf ng.$location + * + * @description + * This method is getter / setter. + * + * Return search part (as object) of current url when called without any parameter. + * + * Change search part when called with parameter and return `$location`. + * + * @param {string|Object.|Object.>} search New search params - string or + * hash object. Hash object may contain an array of values, which will be decoded as duplicates in + * the url. + * + * @param {(string|Array)=} paramValue If `search` is a string, then `paramValue` will override only a + * single search parameter. If `paramValue` is an array, it will set the parameter as a + * comma-separated value. If `paramValue` is `null`, the parameter will be deleted. + * + * @return {string} search + */ + search: function(search, paramValue) { + switch (arguments.length) { + case 0: + return this.$$search; + case 1: + if (isString(search)) { + this.$$search = parseKeyValue(search); + } else if (isObject(search)) { + this.$$search = search; + } else { + throw $locationMinErr('isrcharg', + 'The first argument of the `$location#search()` call must be a string or an object.'); + } + break; + default: + if (isUndefined(paramValue) || paramValue === null) { + delete this.$$search[search]; + } else { + this.$$search[search] = paramValue; + } + } + + this.$$compose(); + return this; + }, + + /** + * @ngdoc method + * @name ng.$location#hash + * @methodOf ng.$location + * + * @description + * This method is getter / setter. + * + * Return hash fragment when called without any parameter. + * + * Change hash fragment when called with parameter and return `$location`. + * + * @param {string=} hash New hash fragment + * @return {string} hash + */ + hash: locationGetterSetter('$$hash', identity), + + /** + * @ngdoc method + * @name ng.$location#replace + * @methodOf ng.$location + * + * @description + * If called, all changes to $location during current `$digest` will be replacing current history + * record, instead of adding new one. + */ + replace: function() { + this.$$replace = true; + return this; + } +}; + +function locationGetter(property) { + return function() { + return this[property]; + }; +} + + +function locationGetterSetter(property, preprocess) { + return function(value) { + if (isUndefined(value)) + return this[property]; + + this[property] = preprocess(value); + this.$$compose(); + + return this; + }; +} + + +/** + * @ngdoc object + * @name ng.$location + * + * @requires $browser + * @requires $sniffer + * @requires $rootElement + * + * @description + * The $location service parses the URL in the browser address bar (based on the + * {@link https://developer.mozilla.org/en/window.location window.location}) and makes the URL + * available to your application. Changes to the URL in the address bar are reflected into + * $location service and changes to $location are reflected into the browser address bar. + * + * **The $location service:** + * + * - Exposes the current URL in the browser address bar, so you can + * - Watch and observe the URL. + * - Change the URL. + * - Synchronizes the URL with the browser when the user + * - Changes the address bar. + * - Clicks the back or forward button (or clicks a History link). + * - Clicks on a link. + * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash). + * + * For more information see {@link guide/dev_guide.services.$location Developer Guide: Angular + * Services: Using $location} + */ + +/** + * @ngdoc object + * @name ng.$locationProvider + * @description + * Use the `$locationProvider` to configure how the application deep linking paths are stored. + */ +function $LocationProvider(){ + var hashPrefix = '', + html5Mode = false; + + /** + * @ngdoc property + * @name ng.$locationProvider#hashPrefix + * @methodOf ng.$locationProvider + * @description + * @param {string=} prefix Prefix for hash part (containing path and search) + * @returns {*} current value if used as getter or itself (chaining) if used as setter + */ + this.hashPrefix = function(prefix) { + if (isDefined(prefix)) { + hashPrefix = prefix; + return this; + } else { + return hashPrefix; + } + }; + + /** + * @ngdoc property + * @name ng.$locationProvider#html5Mode + * @methodOf ng.$locationProvider + * @description + * @param {boolean=} mode Use HTML5 strategy if available. + * @returns {*} current value if used as getter or itself (chaining) if used as setter + */ + this.html5Mode = function(mode) { + if (isDefined(mode)) { + html5Mode = mode; + return this; + } else { + return html5Mode; + } + }; + + /** + * @ngdoc event + * @name ng.$location#$locationChangeStart + * @eventOf ng.$location + * @eventType broadcast on root scope + * @description + * Broadcasted before a URL will change. This change can be prevented by calling + * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more + * details about event object. Upon successful change + * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired. + * + * @param {Object} angularEvent Synthetic event object. + * @param {string} newUrl New URL + * @param {string=} oldUrl URL that was before it was changed. + */ + + /** + * @ngdoc event + * @name ng.$location#$locationChangeSuccess + * @eventOf ng.$location + * @eventType broadcast on root scope + * @description + * Broadcasted after a URL was changed. + * + * @param {Object} angularEvent Synthetic event object. + * @param {string} newUrl New URL + * @param {string=} oldUrl URL that was before it was changed. + */ + + this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', + function( $rootScope, $browser, $sniffer, $rootElement) { + var $location, + LocationMode, + baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to '' + initialUrl = $browser.url(), + appBase; + + if (html5Mode) { + appBase = serverBase(initialUrl) + (baseHref || '/'); + LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url; + } else { + appBase = stripHash(initialUrl); + LocationMode = LocationHashbangUrl; + } + $location = new LocationMode(appBase, '#' + hashPrefix); + $location.$$parse($location.$$rewrite(initialUrl)); + + $rootElement.on('click', function(event) { + // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser) + // currently we open nice url link and redirect then + + if (event.ctrlKey || event.metaKey || event.which == 2) return; + + var elm = jqLite(event.target); + + // traverse the DOM up to find first A tag + while (lowercase(elm[0].nodeName) !== 'a') { + // ignore rewriting if no A tag (reached root element, or no parent - removed from document) + if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return; + } + + var absHref = elm.prop('href'); + var rewrittenUrl = $location.$$rewrite(absHref); + + if (absHref && !elm.attr('target') && rewrittenUrl && !event.isDefaultPrevented()) { + event.preventDefault(); + if (rewrittenUrl != $browser.url()) { + // update location manually + $location.$$parse(rewrittenUrl); + $rootScope.$apply(); + // hack to work around FF6 bug 684208 when scenario runner clicks on links + window.angular['ff-684208-preventDefault'] = true; + } + } + }); + + + // rewrite hashbang url <> html5 url + if ($location.absUrl() != initialUrl) { + $browser.url($location.absUrl(), true); + } + + // update $location when $browser url changes + $browser.onUrlChange(function(newUrl) { + if ($location.absUrl() != newUrl) { + if ($rootScope.$broadcast('$locationChangeStart', newUrl, + $location.absUrl()).defaultPrevented) { + $browser.url($location.absUrl()); + return; + } + $rootScope.$evalAsync(function() { + var oldUrl = $location.absUrl(); + + $location.$$parse(newUrl); + afterLocationChange(oldUrl); + }); + if (!$rootScope.$$phase) $rootScope.$digest(); + } + }); + + // update browser + var changeCounter = 0; + $rootScope.$watch(function $locationWatch() { + var oldUrl = $browser.url(); + var currentReplace = $location.$$replace; + + if (!changeCounter || oldUrl != $location.absUrl()) { + changeCounter++; + $rootScope.$evalAsync(function() { + if ($rootScope.$broadcast('$locationChangeStart', $location.absUrl(), oldUrl). + defaultPrevented) { + $location.$$parse(oldUrl); + } else { + $browser.url($location.absUrl(), currentReplace); + afterLocationChange(oldUrl); + } + }); + } + $location.$$replace = false; + + return changeCounter; + }); + + return $location; + + function afterLocationChange(oldUrl) { + $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl); + } +}]; +} + +/** + * @ngdoc object + * @name ng.$log + * @requires $window + * + * @description + * Simple service for logging. Default implementation safely writes the message + * into the browser's console (if present). + * + * The main purpose of this service is to simplify debugging and troubleshooting. + * + * The default is not to log `debug` messages. You can use + * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this. + * + * @example + + + function LogCtrl($scope, $log) { + $scope.$log = $log; + $scope.message = 'Hello World!'; + } + + +
+

Reload this page with open console, enter text and hit the log button...

+ Message: + + + + + +
+
+
+ */ + +/** + * @ngdoc object + * @name ng.$logProvider + * @description + * Use the `$logProvider` to configure how the application logs messages + */ +function $LogProvider(){ + var debug = true, + self = this; + + /** + * @ngdoc property + * @name ng.$logProvider#debugEnabled + * @methodOf ng.$logProvider + * @description + * @param {string=} flag enable or disable debug level messages + * @returns {*} current value if used as getter or itself (chaining) if used as setter + */ + this.debugEnabled = function(flag) { + if (isDefined(flag)) { + debug = flag; + return this; + } else { + return debug; + } + }; + + this.$get = ['$window', function($window){ + return { + /** + * @ngdoc method + * @name ng.$log#log + * @methodOf ng.$log + * + * @description + * Write a log message + */ + log: consoleLog('log'), + + /** + * @ngdoc method + * @name ng.$log#info + * @methodOf ng.$log + * + * @description + * Write an information message + */ + info: consoleLog('info'), + + /** + * @ngdoc method + * @name ng.$log#warn + * @methodOf ng.$log + * + * @description + * Write a warning message + */ + warn: consoleLog('warn'), + + /** + * @ngdoc method + * @name ng.$log#error + * @methodOf ng.$log + * + * @description + * Write an error message + */ + error: consoleLog('error'), + + /** + * @ngdoc method + * @name ng.$log#debug + * @methodOf ng.$log + * + * @description + * Write a debug message + */ + debug: (function () { + var fn = consoleLog('debug'); + + return function() { + if (debug) { + fn.apply(self, arguments); + } + }; + }()) + }; + + function formatError(arg) { + if (arg instanceof Error) { + if (arg.stack) { + arg = (arg.message && arg.stack.indexOf(arg.message) === -1) + ? 'Error: ' + arg.message + '\n' + arg.stack + : arg.stack; + } else if (arg.sourceURL) { + arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line; + } + } + return arg; + } + + function consoleLog(type) { + var console = $window.console || {}, + logFn = console[type] || console.log || noop; + + if (logFn.apply) { + return function() { + var args = []; + forEach(arguments, function(arg) { + args.push(formatError(arg)); + }); + return logFn.apply(console, args); + }; + } + + // we are IE which either doesn't have window.console => this is noop and we do nothing, + // or we are IE where console.log doesn't have apply so we log at least first 2 args + return function(arg1, arg2) { + logFn(arg1, arg2 == null ? '' : arg2); + }; + } + }]; +} + +var $parseMinErr = minErr('$parse'); +var promiseWarningCache = {}; +var promiseWarning; + +// Sandboxing Angular Expressions +// ------------------------------ +// Angular expressions are generally considered safe because these expressions only have direct +// access to $scope and locals. However, one can obtain the ability to execute arbitrary JS code by +// obtaining a reference to native JS functions such as the Function constructor, the global Window +// or Document object. In addition, many powerful functions for use by JavaScript code are +// published on scope that shouldn't be available from within an Angular expression. +// +// As an example, consider the following Angular expression: +// +// {}.toString.constructor(alert("evil JS code")) +// +// We want to prevent this type of access. For the sake of performance, during the lexing phase we +// disallow any "dotted" access to any member named "constructor" or to any member whose name begins +// or ends with an underscore. The latter allows one to exclude the private / JavaScript only API +// available on the scope and controllers from the context of an Angular expression. +// +// For reflective calls (a[b]), we check that the value of the lookup is not the Function +// constructor, Window or DOM node while evaluating the expression, which is a stronger but more +// expensive test. Since reflective calls are expensive anyway, this is not such a big deal compared +// to static dereferencing. +// +// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits +// against the expression language, but not to prevent exploits that were enabled by exposing +// sensitive JavaScript or browser apis on Scope. Exposing such objects on a Scope is never a good +// practice and therefore we are not even trying to protect against interaction with an object +// explicitly exposed in this way. +// +// A developer could foil the name check by aliasing the Function constructor under a different +// name on the scope. +// +// In general, it is not possible to access a Window object from an angular expression unless a +// window or some DOM object that has a reference to window is published onto a Scope. + +function ensureSafeMemberName(name, fullExpression, allowConstructor) { + if (typeof name !== 'string' && toString.apply(name) !== "[object String]") { + return name; + } + if (name === "constructor" && !allowConstructor) { + throw $parseMinErr('isecfld', + 'Referencing "constructor" field in Angular expressions is disallowed! Expression: {0}', + fullExpression); + } + if (name.charAt(0) === '_' || name.charAt(name.length-1) === '_') { + throw $parseMinErr('isecprv', + 'Referencing private fields in Angular expressions is disallowed! Expression: {0}', + fullExpression); + } + return name; +} + +function ensureSafeObject(obj, fullExpression) { + // nifty check if obj is Function that is fast and works across iframes and other contexts + if (obj && obj.constructor === obj) { + throw $parseMinErr('isecfn', + 'Referencing Function in Angular expressions is disallowed! Expression: {0}', + fullExpression); + } else if (// isWindow(obj) + obj && obj.document && obj.location && obj.alert && obj.setInterval) { + throw $parseMinErr('isecwindow', + 'Referencing the Window in Angular expressions is disallowed! Expression: {0}', + fullExpression); + } else if (// isElement(obj) + obj && (obj.nodeName || (obj.on && obj.find))) { + throw $parseMinErr('isecdom', + 'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}', + fullExpression); + } else { + return obj; + } +} + +var OPERATORS = { + /* jshint bitwise : false */ + 'null':function(){return null;}, + 'true':function(){return true;}, + 'false':function(){return false;}, + undefined:noop, + '+':function(self, locals, a,b){ + a=a(self, locals); b=b(self, locals); + if (isDefined(a)) { + if (isDefined(b)) { + return a + b; + } + return a; + } + return isDefined(b)?b:undefined;}, + '-':function(self, locals, a,b){ + a=a(self, locals); b=b(self, locals); + return (isDefined(a)?a:0)-(isDefined(b)?b:0); + }, + '*':function(self, locals, a,b){return a(self, locals)*b(self, locals);}, + '/':function(self, locals, a,b){return a(self, locals)/b(self, locals);}, + '%':function(self, locals, a,b){return a(self, locals)%b(self, locals);}, + '^':function(self, locals, a,b){return a(self, locals)^b(self, locals);}, + '=':noop, + '===':function(self, locals, a, b){return a(self, locals)===b(self, locals);}, + '!==':function(self, locals, a, b){return a(self, locals)!==b(self, locals);}, + '==':function(self, locals, a,b){return a(self, locals)==b(self, locals);}, + '!=':function(self, locals, a,b){return a(self, locals)!=b(self, locals);}, + '<':function(self, locals, a,b){return a(self, locals)':function(self, locals, a,b){return a(self, locals)>b(self, locals);}, + '<=':function(self, locals, a,b){return a(self, locals)<=b(self, locals);}, + '>=':function(self, locals, a,b){return a(self, locals)>=b(self, locals);}, + '&&':function(self, locals, a,b){return a(self, locals)&&b(self, locals);}, + '||':function(self, locals, a,b){return a(self, locals)||b(self, locals);}, + '&':function(self, locals, a,b){return a(self, locals)&b(self, locals);}, +// '|':function(self, locals, a,b){return a|b;}, + '|':function(self, locals, a,b){return b(self, locals)(self, locals, a(self, locals));}, + '!':function(self, locals, a){return !a(self, locals);} +}; +/* jshint bitwise: true */ +var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'}; + + +///////////////////////////////////////// + + +/** + * @constructor + */ +var Lexer = function (options) { + this.options = options; +}; + +Lexer.prototype = { + constructor: Lexer, + + lex: function (text) { + this.text = text; + + this.index = 0; + this.ch = undefined; + this.lastCh = ':'; // can start regexp + + this.tokens = []; + + var token; + var json = []; + + while (this.index < this.text.length) { + this.ch = this.text.charAt(this.index); + if (this.is('"\'')) { + this.readString(this.ch); + } else if (this.isNumber(this.ch) || this.is('.') && this.isNumber(this.peek())) { + this.readNumber(); + } else if (this.isIdent(this.ch)) { + this.readIdent(); + // identifiers can only be if the preceding char was a { or , + if (this.was('{,') && json[0] === '{' && + (token = this.tokens[this.tokens.length - 1])) { + token.json = token.text.indexOf('.') === -1; + } + } else if (this.is('(){}[].,;:?')) { + this.tokens.push({ + index: this.index, + text: this.ch, + json: (this.was(':[,') && this.is('{[')) || this.is('}]:,') + }); + if (this.is('{[')) json.unshift(this.ch); + if (this.is('}]')) json.shift(); + this.index++; + } else if (this.isWhitespace(this.ch)) { + this.index++; + continue; + } else { + var ch2 = this.ch + this.peek(); + var ch3 = ch2 + this.peek(2); + var fn = OPERATORS[this.ch]; + var fn2 = OPERATORS[ch2]; + var fn3 = OPERATORS[ch3]; + if (fn3) { + this.tokens.push({index: this.index, text: ch3, fn: fn3}); + this.index += 3; + } else if (fn2) { + this.tokens.push({index: this.index, text: ch2, fn: fn2}); + this.index += 2; + } else if (fn) { + this.tokens.push({ + index: this.index, + text: this.ch, + fn: fn, + json: (this.was('[,:') && this.is('+-')) + }); + this.index += 1; + } else { + this.throwError('Unexpected next character ', this.index, this.index + 1); + } + } + this.lastCh = this.ch; + } + return this.tokens; + }, + + is: function(chars) { + return chars.indexOf(this.ch) !== -1; + }, + + was: function(chars) { + return chars.indexOf(this.lastCh) !== -1; + }, + + peek: function(i) { + var num = i || 1; + return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false; + }, + + isNumber: function(ch) { + return ('0' <= ch && ch <= '9'); + }, + + isWhitespace: function(ch) { + // IE treats non-breaking space as \u00A0 + return (ch === ' ' || ch === '\r' || ch === '\t' || + ch === '\n' || ch === '\v' || ch === '\u00A0'); + }, + + isIdent: function(ch) { + return ('a' <= ch && ch <= 'z' || + 'A' <= ch && ch <= 'Z' || + '_' === ch || ch === '$'); + }, + + isExpOperator: function(ch) { + return (ch === '-' || ch === '+' || this.isNumber(ch)); + }, + + throwError: function(error, start, end) { + end = end || this.index; + var colStr = (isDefined(start) + ? 's ' + start + '-' + this.index + ' [' + this.text.substring(start, end) + ']' + : ' ' + end); + throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].', + error, colStr, this.text); + }, + + readNumber: function() { + var number = ''; + var start = this.index; + while (this.index < this.text.length) { + var ch = lowercase(this.text.charAt(this.index)); + if (ch == '.' || this.isNumber(ch)) { + number += ch; + } else { + var peekCh = this.peek(); + if (ch == 'e' && this.isExpOperator(peekCh)) { + number += ch; + } else if (this.isExpOperator(ch) && + peekCh && this.isNumber(peekCh) && + number.charAt(number.length - 1) == 'e') { + number += ch; + } else if (this.isExpOperator(ch) && + (!peekCh || !this.isNumber(peekCh)) && + number.charAt(number.length - 1) == 'e') { + this.throwError('Invalid exponent'); + } else { + break; + } + } + this.index++; + } + number = 1 * number; + this.tokens.push({ + index: start, + text: number, + json: true, + fn: function() { return number; } + }); + }, + + readIdent: function() { + var parser = this; + + var ident = ''; + var start = this.index; + + var lastDot, peekIndex, methodName, ch; + + while (this.index < this.text.length) { + ch = this.text.charAt(this.index); + if (ch === '.' || this.isIdent(ch) || this.isNumber(ch)) { + if (ch === '.') lastDot = this.index; + ident += ch; + } else { + break; + } + this.index++; + } + + //check if this is not a method invocation and if it is back out to last dot + if (lastDot) { + peekIndex = this.index; + while (peekIndex < this.text.length) { + ch = this.text.charAt(peekIndex); + if (ch === '(') { + methodName = ident.substr(lastDot - start + 1); + ident = ident.substr(0, lastDot - start); + this.index = peekIndex; + break; + } + if (this.isWhitespace(ch)) { + peekIndex++; + } else { + break; + } + } + } + + + var token = { + index: start, + text: ident + }; + + // OPERATORS is our own object so we don't need to use special hasOwnPropertyFn + if (OPERATORS.hasOwnProperty(ident)) { + token.fn = OPERATORS[ident]; + token.json = OPERATORS[ident]; + } else { + var getter = getterFn(ident, this.options, this.text); + token.fn = extend(function(self, locals) { + return (getter(self, locals)); + }, { + assign: function(self, value) { + return setter(self, ident, value, parser.text, parser.options); + } + }); + } + + this.tokens.push(token); + + if (methodName) { + this.tokens.push({ + index:lastDot, + text: '.', + json: false + }); + this.tokens.push({ + index: lastDot + 1, + text: methodName, + json: false + }); + } + }, + + readString: function(quote) { + var start = this.index; + this.index++; + var string = ''; + var rawString = quote; + var escape = false; + while (this.index < this.text.length) { + var ch = this.text.charAt(this.index); + rawString += ch; + if (escape) { + if (ch === 'u') { + var hex = this.text.substring(this.index + 1, this.index + 5); + if (!hex.match(/[\da-f]{4}/i)) + this.throwError('Invalid unicode escape [\\u' + hex + ']'); + this.index += 4; + string += String.fromCharCode(parseInt(hex, 16)); + } else { + var rep = ESCAPE[ch]; + if (rep) { + string += rep; + } else { + string += ch; + } + } + escape = false; + } else if (ch === '\\') { + escape = true; + } else if (ch === quote) { + this.index++; + this.tokens.push({ + index: start, + text: rawString, + string: string, + json: true, + fn: function() { return string; } + }); + return; + } else { + string += ch; + } + this.index++; + } + this.throwError('Unterminated quote', start); + } +}; + + +/** + * @constructor + */ +var Parser = function (lexer, $filter, options) { + this.lexer = lexer; + this.$filter = $filter; + this.options = options; +}; + +Parser.ZERO = function () { return 0; }; + +Parser.prototype = { + constructor: Parser, + + parse: function (text, json) { + this.text = text; + + //TODO(i): strip all the obsolte json stuff from this file + this.json = json; + + this.tokens = this.lexer.lex(text); + + if (json) { + // The extra level of aliasing is here, just in case the lexer misses something, so that + // we prevent any accidental execution in JSON. + this.assignment = this.logicalOR; + + this.functionCall = + this.fieldAccess = + this.objectIndex = + this.filterChain = function() { + this.throwError('is not valid json', {text: text, index: 0}); + }; + } + + var value = json ? this.primary() : this.statements(); + + if (this.tokens.length !== 0) { + this.throwError('is an unexpected token', this.tokens[0]); + } + + value.literal = !!value.literal; + value.constant = !!value.constant; + + return value; + }, + + primary: function () { + var primary; + if (this.expect('(')) { + primary = this.filterChain(); + this.consume(')'); + } else if (this.expect('[')) { + primary = this.arrayDeclaration(); + } else if (this.expect('{')) { + primary = this.object(); + } else { + var token = this.expect(); + primary = token.fn; + if (!primary) { + this.throwError('not a primary expression', token); + } + if (token.json) { + primary.constant = true; + primary.literal = true; + } + } + + var next, context; + while ((next = this.expect('(', '[', '.'))) { + if (next.text === '(') { + primary = this.functionCall(primary, context); + context = null; + } else if (next.text === '[') { + context = primary; + primary = this.objectIndex(primary); + } else if (next.text === '.') { + context = primary; + primary = this.fieldAccess(primary); + } else { + this.throwError('IMPOSSIBLE'); + } + } + return primary; + }, + + throwError: function(msg, token) { + throw $parseMinErr('syntax', + 'Syntax Error: Token \'{0}\' {1} at column {2} of the expression [{3}] starting at [{4}].', + token.text, msg, (token.index + 1), this.text, this.text.substring(token.index)); + }, + + peekToken: function() { + if (this.tokens.length === 0) + throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text); + return this.tokens[0]; + }, + + peek: function(e1, e2, e3, e4) { + if (this.tokens.length > 0) { + var token = this.tokens[0]; + var t = token.text; + if (t === e1 || t === e2 || t === e3 || t === e4 || + (!e1 && !e2 && !e3 && !e4)) { + return token; + } + } + return false; + }, + + expect: function(e1, e2, e3, e4){ + var token = this.peek(e1, e2, e3, e4); + if (token) { + if (this.json && !token.json) { + this.throwError('is not valid json', token); + } + this.tokens.shift(); + return token; + } + return false; + }, + + consume: function(e1){ + if (!this.expect(e1)) { + this.throwError('is unexpected, expecting [' + e1 + ']', this.peek()); + } + }, + + unaryFn: function(fn, right) { + return extend(function(self, locals) { + return fn(self, locals, right); + }, { + constant:right.constant + }); + }, + + ternaryFn: function(left, middle, right){ + return extend(function(self, locals){ + return left(self, locals) ? middle(self, locals) : right(self, locals); + }, { + constant: left.constant && middle.constant && right.constant + }); + }, + + binaryFn: function(left, fn, right) { + return extend(function(self, locals) { + return fn(self, locals, left, right); + }, { + constant:left.constant && right.constant + }); + }, + + statements: function() { + var statements = []; + while (true) { + if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']')) + statements.push(this.filterChain()); + if (!this.expect(';')) { + // optimize for the common case where there is only one statement. + // TODO(size): maybe we should not support multiple statements? + return (statements.length === 1) + ? statements[0] + : function(self, locals) { + var value; + for (var i = 0; i < statements.length; i++) { + var statement = statements[i]; + if (statement) { + value = statement(self, locals); + } + } + return value; + }; + } + } + }, + + filterChain: function() { + var left = this.expression(); + var token; + while (true) { + if ((token = this.expect('|'))) { + left = this.binaryFn(left, token.fn, this.filter()); + } else { + return left; + } + } + }, + + filter: function() { + var token = this.expect(); + var fn = this.$filter(token.text); + var argsFn = []; + while (true) { + if ((token = this.expect(':'))) { + argsFn.push(this.expression()); + } else { + var fnInvoke = function(self, locals, input) { + var args = [input]; + for (var i = 0; i < argsFn.length; i++) { + args.push(argsFn[i](self, locals)); + } + return fn.apply(self, args); + }; + return function() { + return fnInvoke; + }; + } + } + }, + + expression: function() { + return this.assignment(); + }, + + assignment: function() { + var left = this.ternary(); + var right; + var token; + if ((token = this.expect('='))) { + if (!left.assign) { + this.throwError('implies assignment but [' + + this.text.substring(0, token.index) + '] can not be assigned to', token); + } + right = this.ternary(); + return function(scope, locals) { + return left.assign(scope, right(scope, locals), locals); + }; + } + return left; + }, + + ternary: function() { + var left = this.logicalOR(); + var middle; + var token; + if ((token = this.expect('?'))) { + middle = this.ternary(); + if ((token = this.expect(':'))) { + return this.ternaryFn(left, middle, this.ternary()); + } else { + this.throwError('expected :', token); + } + } else { + return left; + } + }, + + logicalOR: function() { + var left = this.logicalAND(); + var token; + while (true) { + if ((token = this.expect('||'))) { + left = this.binaryFn(left, token.fn, this.logicalAND()); + } else { + return left; + } + } + }, + + logicalAND: function() { + var left = this.equality(); + var token; + if ((token = this.expect('&&'))) { + left = this.binaryFn(left, token.fn, this.logicalAND()); + } + return left; + }, + + equality: function() { + var left = this.relational(); + var token; + if ((token = this.expect('==','!=','===','!=='))) { + left = this.binaryFn(left, token.fn, this.equality()); + } + return left; + }, + + relational: function() { + var left = this.additive(); + var token; + if ((token = this.expect('<', '>', '<=', '>='))) { + left = this.binaryFn(left, token.fn, this.relational()); + } + return left; + }, + + additive: function() { + var left = this.multiplicative(); + var token; + while ((token = this.expect('+','-'))) { + left = this.binaryFn(left, token.fn, this.multiplicative()); + } + return left; + }, + + multiplicative: function() { + var left = this.unary(); + var token; + while ((token = this.expect('*','/','%'))) { + left = this.binaryFn(left, token.fn, this.unary()); + } + return left; + }, + + unary: function() { + var token; + if (this.expect('+')) { + return this.primary(); + } else if ((token = this.expect('-'))) { + return this.binaryFn(Parser.ZERO, token.fn, this.unary()); + } else if ((token = this.expect('!'))) { + return this.unaryFn(token.fn, this.unary()); + } else { + return this.primary(); + } + }, + + fieldAccess: function(object) { + var parser = this; + var field = this.expect().text; + var getter = getterFn(field, this.options, this.text); + + return extend(function(scope, locals, self) { + return getter(self || object(scope, locals), locals); + }, { + assign: function(scope, value, locals) { + return setter(object(scope, locals), field, value, parser.text, parser.options); + } + }); + }, + + objectIndex: function(obj) { + var parser = this; + + var indexFn = this.expression(); + this.consume(']'); + + return extend(function(self, locals) { + var o = obj(self, locals), + // In the getter, we will not block looking up "constructor" by name in order to support user defined + // constructors. However, if value looked up is the Function constructor, we will still block it in the + // ensureSafeObject call right after we look up o[i] (a few lines below.) + i = ensureSafeMemberName(indexFn(self, locals), parser.text, true /* allowConstructor */), + v, p; + + if (!o) return undefined; + v = ensureSafeObject(o[i], parser.text); + if (v && v.then && parser.options.unwrapPromises) { + p = v; + if (!('$$v' in v)) { + p.$$v = undefined; + p.then(function(val) { p.$$v = val; }); + } + v = v.$$v; + } + return v; + }, { + assign: function(self, value, locals) { + var key = ensureSafeMemberName(indexFn(self, locals), parser.text); + // prevent overwriting of Function.constructor which would break ensureSafeObject check + var safe = ensureSafeObject(obj(self, locals), parser.text); + return safe[key] = value; + } + }); + }, + + functionCall: function(fn, contextGetter) { + var argsFn = []; + if (this.peekToken().text !== ')') { + do { + argsFn.push(this.expression()); + } while (this.expect(',')); + } + this.consume(')'); + + var parser = this; + + return function(scope, locals) { + var args = []; + var context = contextGetter ? contextGetter(scope, locals) : scope; + + for (var i = 0; i < argsFn.length; i++) { + args.push(argsFn[i](scope, locals)); + } + var fnPtr = fn(scope, locals, context) || noop; + + ensureSafeObject(context, parser.text); + ensureSafeObject(fnPtr, parser.text); + + // IE stupidity! (IE doesn't have apply for some native functions) + var v = fnPtr.apply + ? fnPtr.apply(context, args) + : fnPtr(args[0], args[1], args[2], args[3], args[4]); + + return ensureSafeObject(v, parser.text); + }; + }, + + // This is used with json array declaration + arrayDeclaration: function () { + var elementFns = []; + var allConstant = true; + if (this.peekToken().text !== ']') { + do { + var elementFn = this.expression(); + elementFns.push(elementFn); + if (!elementFn.constant) { + allConstant = false; + } + } while (this.expect(',')); + } + this.consume(']'); + + return extend(function(self, locals) { + var array = []; + for (var i = 0; i < elementFns.length; i++) { + array.push(elementFns[i](self, locals)); + } + return array; + }, { + literal: true, + constant: allConstant + }); + }, + + object: function () { + var keyValues = []; + var allConstant = true; + if (this.peekToken().text !== '}') { + do { + var token = this.expect(), + key = token.string || token.text; + this.consume(':'); + var value = this.expression(); + keyValues.push({key: key, value: value}); + if (!value.constant) { + allConstant = false; + } + } while (this.expect(',')); + } + this.consume('}'); + + return extend(function(self, locals) { + var object = {}; + for (var i = 0; i < keyValues.length; i++) { + var keyValue = keyValues[i]; + object[keyValue.key] = keyValue.value(self, locals); + } + return object; + }, { + literal: true, + constant: allConstant + }); + } +}; + + +////////////////////////////////////////////////// +// Parser helper functions +////////////////////////////////////////////////// + +function setter(obj, path, setValue, fullExp, options) { + //needed? + options = options || {}; + + var element = path.split('.'), key; + for (var i = 0; element.length > 1; i++) { + key = ensureSafeMemberName(element.shift(), fullExp); + var propertyObj = obj[key]; + if (!propertyObj) { + propertyObj = {}; + obj[key] = propertyObj; + } + obj = propertyObj; + if (obj.then && options.unwrapPromises) { + promiseWarning(fullExp); + if (!("$$v" in obj)) { + (function(promise) { + promise.then(function(val) { promise.$$v = val; }); } + )(obj); + } + if (obj.$$v === undefined) { + obj.$$v = {}; + } + obj = obj.$$v; + } + } + key = ensureSafeMemberName(element.shift(), fullExp); + obj[key] = setValue; + return setValue; +} + +var getterFnCache = {}; + +/** + * Implementation of the "Black Hole" variant from: + * - http://jsperf.com/angularjs-parse-getter/4 + * - http://jsperf.com/path-evaluation-simplified/7 + */ +function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) { + ensureSafeMemberName(key0, fullExp); + ensureSafeMemberName(key1, fullExp); + ensureSafeMemberName(key2, fullExp); + ensureSafeMemberName(key3, fullExp); + ensureSafeMemberName(key4, fullExp); + + return !options.unwrapPromises + ? function cspSafeGetter(scope, locals) { + var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope; + + if (pathVal === null || pathVal === undefined) return pathVal; + pathVal = pathVal[key0]; + + if (!key1 || pathVal === null || pathVal === undefined) return pathVal; + pathVal = pathVal[key1]; + + if (!key2 || pathVal === null || pathVal === undefined) return pathVal; + pathVal = pathVal[key2]; + + if (!key3 || pathVal === null || pathVal === undefined) return pathVal; + pathVal = pathVal[key3]; + + if (!key4 || pathVal === null || pathVal === undefined) return pathVal; + pathVal = pathVal[key4]; + + return pathVal; + } + : function cspSafePromiseEnabledGetter(scope, locals) { + var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope, + promise; + + if (pathVal === null || pathVal === undefined) return pathVal; + + pathVal = pathVal[key0]; + if (pathVal && pathVal.then) { + promiseWarning(fullExp); + if (!("$$v" in pathVal)) { + promise = pathVal; + promise.$$v = undefined; + promise.then(function(val) { promise.$$v = val; }); + } + pathVal = pathVal.$$v; + } + if (!key1 || pathVal === null || pathVal === undefined) return pathVal; + + pathVal = pathVal[key1]; + if (pathVal && pathVal.then) { + promiseWarning(fullExp); + if (!("$$v" in pathVal)) { + promise = pathVal; + promise.$$v = undefined; + promise.then(function(val) { promise.$$v = val; }); + } + pathVal = pathVal.$$v; + } + if (!key2 || pathVal === null || pathVal === undefined) return pathVal; + + pathVal = pathVal[key2]; + if (pathVal && pathVal.then) { + promiseWarning(fullExp); + if (!("$$v" in pathVal)) { + promise = pathVal; + promise.$$v = undefined; + promise.then(function(val) { promise.$$v = val; }); + } + pathVal = pathVal.$$v; + } + if (!key3 || pathVal === null || pathVal === undefined) return pathVal; + + pathVal = pathVal[key3]; + if (pathVal && pathVal.then) { + promiseWarning(fullExp); + if (!("$$v" in pathVal)) { + promise = pathVal; + promise.$$v = undefined; + promise.then(function(val) { promise.$$v = val; }); + } + pathVal = pathVal.$$v; + } + if (!key4 || pathVal === null || pathVal === undefined) return pathVal; + + pathVal = pathVal[key4]; + if (pathVal && pathVal.then) { + promiseWarning(fullExp); + if (!("$$v" in pathVal)) { + promise = pathVal; + promise.$$v = undefined; + promise.then(function(val) { promise.$$v = val; }); + } + pathVal = pathVal.$$v; + } + return pathVal; + }; +} + +function getterFn(path, options, fullExp) { + // Check whether the cache has this getter already. + // We can use hasOwnProperty directly on the cache because we ensure, + // see below, that the cache never stores a path called 'hasOwnProperty' + if (getterFnCache.hasOwnProperty(path)) { + return getterFnCache[path]; + } + + var pathKeys = path.split('.'), + pathKeysLength = pathKeys.length, + fn; + + if (options.csp) { + if (pathKeysLength < 6) { + fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp, + options); + } else { + fn = function(scope, locals) { + var i = 0, val; + do { + val = cspSafeGetterFn(pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++], + pathKeys[i++], fullExp, options)(scope, locals); + + locals = undefined; // clear after first iteration + scope = val; + } while (i < pathKeysLength); + return val; + }; + } + } else { + var code = 'var l, fn, p;\n'; + forEach(pathKeys, function(key, index) { + ensureSafeMemberName(key, fullExp); + code += 'if(s === null || s === undefined) return s;\n' + + 'l=s;\n' + + 's='+ (index + // we simply dereference 's' on any .dot notation + ? 's' + // but if we are first then we check locals first, and if so read it first + : '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"]' + ';\n' + + (options.unwrapPromises + ? 'if (s && s.then) {\n' + + ' pw("' + fullExp.replace(/\"/g, '\\"') + '");\n' + + ' if (!("$$v" in s)) {\n' + + ' p=s;\n' + + ' p.$$v = undefined;\n' + + ' p.then(function(v) {p.$$v=v;});\n' + + '}\n' + + ' s=s.$$v\n' + + '}\n' + : ''); + }); + code += 'return s;'; + + /* jshint -W054 */ + var evaledFnGetter = new Function('s', 'k', 'pw', code); // s=scope, k=locals, pw=promiseWarning + /* jshint +W054 */ + evaledFnGetter.toString = function() { return code; }; + fn = function(scope, locals) { + return evaledFnGetter(scope, locals, promiseWarning); + }; + } + + // Only cache the value if it's not going to mess up the cache object + // This is more performant that using Object.prototype.hasOwnProperty.call + if (path !== 'hasOwnProperty') { + getterFnCache[path] = fn; + } + return fn; +} + +/////////////////////////////////// + +/** + * @ngdoc function + * @name ng.$parse + * @function + * + * @description + * + * Converts Angular {@link guide/expression expression} into a function. + * + *
+ *   var getter = $parse('user.name');
+ *   var setter = getter.assign;
+ *   var context = {user:{name:'angular'}};
+ *   var locals = {user:{name:'local'}};
+ *
+ *   expect(getter(context)).toEqual('angular');
+ *   setter(context, 'newValue');
+ *   expect(context.user.name).toEqual('newValue');
+ *   expect(getter(context, locals)).toEqual('local');
+ * 
+ * + * + * @param {string} expression String expression to compile. + * @returns {function(context, locals)} a function which represents the compiled expression: + * + * * `context` – `{object}` – an object against which any expressions embedded in the strings + * are evaluated against (typically a scope object). + * * `locals` – `{object=}` – local variables context object, useful for overriding values in + * `context`. + * + * The returned function also has the following properties: + * * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript + * literal. + * * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript + * constant literals. + * * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be + * set to a function to change its value on the given context. + * + */ + + +/** + * @ngdoc object + * @name ng.$parseProvider + * @function + * + * @description + * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse} + * service. + */ +function $ParseProvider() { + var cache = {}; + + var $parseOptions = { + csp: false, + unwrapPromises: false, + logPromiseWarnings: true + }; + + + /** + * @deprecated Promise unwrapping via $parse is deprecated and will be removed in the future. + * + * @ngdoc method + * @name ng.$parseProvider#unwrapPromises + * @methodOf ng.$parseProvider + * @description + * + * **This feature is deprecated, see deprecation notes below for more info** + * + * If set to true (default is false), $parse will unwrap promises automatically when a promise is + * found at any part of the expression. In other words, if set to true, the expression will always + * result in a non-promise value. + * + * While the promise is unresolved, it's treated as undefined, but once resolved and fulfilled, + * the fulfillment value is used in place of the promise while evaluating the expression. + * + * **Deprecation notice** + * + * This is a feature that didn't prove to be wildly useful or popular, primarily because of the + * dichotomy between data access in templates (accessed as raw values) and controller code + * (accessed as promises). + * + * In most code we ended up resolving promises manually in controllers anyway and thus unifying + * the model access there. + * + * Other downsides of automatic promise unwrapping: + * + * - when building components it's often desirable to receive the raw promises + * - adds complexity and slows down expression evaluation + * - makes expression code pre-generation unattractive due to the amount of code that needs to be + * generated + * - makes IDE auto-completion and tool support hard + * + * **Warning Logs** + * + * If the unwrapping is enabled, Angular will log a warning about each expression that unwraps a + * promise (to reduce the noise, each expression is logged only once). To disable this logging use + * `$parseProvider.logPromiseWarnings(false)` api. + * + * + * @param {boolean=} value New value. + * @returns {boolean|self} Returns the current setting when used as getter and self if used as + * setter. + */ + this.unwrapPromises = function(value) { + if (isDefined(value)) { + $parseOptions.unwrapPromises = !!value; + return this; + } else { + return $parseOptions.unwrapPromises; + } + }; + + + /** + * @deprecated Promise unwrapping via $parse is deprecated and will be removed in the future. + * + * @ngdoc method + * @name ng.$parseProvider#logPromiseWarnings + * @methodOf ng.$parseProvider + * @description + * + * Controls whether Angular should log a warning on any encounter of a promise in an expression. + * + * The default is set to `true`. + * + * This setting applies only if `$parseProvider.unwrapPromises` setting is set to true as well. + * + * @param {boolean=} value New value. + * @returns {boolean|self} Returns the current setting when used as getter and self if used as + * setter. + */ + this.logPromiseWarnings = function(value) { + if (isDefined(value)) { + $parseOptions.logPromiseWarnings = value; + return this; + } else { + return $parseOptions.logPromiseWarnings; + } + }; + + + this.$get = ['$filter', '$sniffer', '$log', function($filter, $sniffer, $log) { + $parseOptions.csp = $sniffer.csp; + + promiseWarning = function promiseWarningFn(fullExp) { + if (!$parseOptions.logPromiseWarnings || promiseWarningCache.hasOwnProperty(fullExp)) return; + promiseWarningCache[fullExp] = true; + $log.warn('[$parse] Promise found in the expression `' + fullExp + '`. ' + + 'Automatic unwrapping of promises in Angular expressions is deprecated.'); + }; + + return function(exp) { + var parsedExpression; + + switch (typeof exp) { + case 'string': + + if (cache.hasOwnProperty(exp)) { + return cache[exp]; + } + + var lexer = new Lexer($parseOptions); + var parser = new Parser(lexer, $filter, $parseOptions); + parsedExpression = parser.parse(exp, false); + + if (exp !== 'hasOwnProperty') { + // Only cache the value if it's not going to mess up the cache object + // This is more performant that using Object.prototype.hasOwnProperty.call + cache[exp] = parsedExpression; + } + + return parsedExpression; + + case 'function': + return exp; + + default: + return noop; + } + }; + }]; +} + +/** + * @ngdoc service + * @name ng.$q + * @requires $rootScope + * + * @description + * A promise/deferred implementation inspired by [Kris Kowal's Q](https://github.com/kriskowal/q). + * + * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an + * interface for interacting with an object that represents the result of an action that is + * performed asynchronously, and may or may not be finished at any given point in time. + * + * From the perspective of dealing with error handling, deferred and promise APIs are to + * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming. + * + *
+ *   // for the purpose of this example let's assume that variables `$q` and `scope` are
+ *   // available in the current lexical scope (they could have been injected or passed in).
+ *
+ *   function asyncGreet(name) {
+ *     var deferred = $q.defer();
+ *
+ *     setTimeout(function() {
+ *       // since this fn executes async in a future turn of the event loop, we need to wrap
+ *       // our code into an $apply call so that the model changes are properly observed.
+ *       scope.$apply(function() {
+ *         deferred.notify('About to greet ' + name + '.');
+ *
+ *         if (okToGreet(name)) {
+ *           deferred.resolve('Hello, ' + name + '!');
+ *         } else {
+ *           deferred.reject('Greeting ' + name + ' is not allowed.');
+ *         }
+ *       });
+ *     }, 1000);
+ *
+ *     return deferred.promise;
+ *   }
+ *
+ *   var promise = asyncGreet('Robin Hood');
+ *   promise.then(function(greeting) {
+ *     alert('Success: ' + greeting);
+ *   }, function(reason) {
+ *     alert('Failed: ' + reason);
+ *   }, function(update) {
+ *     alert('Got notification: ' + update);
+ *   });
+ * 
+ * + * At first it might not be obvious why this extra complexity is worth the trouble. The payoff + * comes in the way of guarantees that promise and deferred APIs make, see + * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md. + * + * Additionally the promise api allows for composition that is very hard to do with the + * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach. + * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the + * section on serial or parallel joining of promises. + * + * + * # The Deferred API + * + * A new instance of deferred is constructed by calling `$q.defer()`. + * + * The purpose of the deferred object is to expose the associated Promise instance as well as APIs + * that can be used for signaling the successful or unsuccessful completion, as well as the status + * of the task. + * + * **Methods** + * + * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection + * constructed via `$q.reject`, the promise will be rejected instead. + * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to + * resolving it with a rejection constructed via `$q.reject`. + * - `notify(value)` - provides updates on the status of the promises execution. This may be called + * multiple times before the promise is either resolved or rejected. + * + * **Properties** + * + * - promise – `{Promise}` – promise object associated with this deferred. + * + * + * # The Promise API + * + * A new promise instance is created when a deferred instance is created and can be retrieved by + * calling `deferred.promise`. + * + * The purpose of the promise object is to allow for interested parties to get access to the result + * of the deferred task when it completes. + * + * **Methods** + * + * - `then(successCallback, errorCallback, notifyCallback)` – regardless of when the promise was or + * will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously + * as soon as the result is available. The callbacks are called with a single argument: the result + * or rejection reason. Additionally, the notify callback may be called zero or more times to + * provide a progress indication, before the promise is resolved or rejected. + * + * This method *returns a new promise* which is resolved or rejected via the return value of the + * `successCallback`, `errorCallback`. It also notifies via the return value of the + * `notifyCallback` method. The promise can not be resolved or rejected from the notifyCallback + * method. + * + * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)` + * + * - `finally(callback)` – allows you to observe either the fulfillment or rejection of a promise, + * but to do so without modifying the final value. This is useful to release resources or do some + * clean-up that needs to be done whether the promise was rejected or resolved. See the [full + * specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for + * more information. + * + * Because `finally` is a reserved word in JavaScript and reserved keywords are not supported as + * property names by ES3, you'll need to invoke the method like `promise['finally'](callback)` to + * make your code IE8 compatible. + * + * # Chaining promises + * + * Because calling the `then` method of a promise returns a new derived promise, it is easily + * possible to create a chain of promises: + * + *
+ *   promiseB = promiseA.then(function(result) {
+ *     return result + 1;
+ *   });
+ *
+ *   // promiseB will be resolved immediately after promiseA is resolved and its value
+ *   // will be the result of promiseA incremented by 1
+ * 
+ * + * It is possible to create chains of any length and since a promise can be resolved with another + * promise (which will defer its resolution further), it is possible to pause/defer resolution of + * the promises at any point in the chain. This makes it possible to implement powerful APIs like + * $http's response interceptors. + * + * + * # Differences between Kris Kowal's Q and $q + * + * There are three main differences: + * + * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation + * mechanism in angular, which means faster propagation of resolution or rejection into your + * models and avoiding unnecessary browser repaints, which would result in flickering UI. + * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains + * all the important functionality needed for common async tasks. + * + * # Testing + * + *
+ *    it('should simulate promise', inject(function($q, $rootScope) {
+ *      var deferred = $q.defer();
+ *      var promise = deferred.promise;
+ *      var resolvedValue;
+ *
+ *      promise.then(function(value) { resolvedValue = value; });
+ *      expect(resolvedValue).toBeUndefined();
+ *
+ *      // Simulate resolving of promise
+ *      deferred.resolve(123);
+ *      // Note that the 'then' function does not get called synchronously.
+ *      // This is because we want the promise API to always be async, whether or not
+ *      // it got called synchronously or asynchronously.
+ *      expect(resolvedValue).toBeUndefined();
+ *
+ *      // Propagate promise resolution to 'then' functions using $apply().
+ *      $rootScope.$apply();
+ *      expect(resolvedValue).toEqual(123);
+ *    });
+ *  
+ */ +function $QProvider() { + + this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) { + return qFactory(function(callback) { + $rootScope.$evalAsync(callback); + }, $exceptionHandler); + }]; +} + + +/** + * Constructs a promise manager. + * + * @param {function(function)} nextTick Function for executing functions in the next turn. + * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for + * debugging purposes. + * @returns {object} Promise manager. + */ +function qFactory(nextTick, exceptionHandler) { + + /** + * @ngdoc + * @name ng.$q#defer + * @methodOf ng.$q + * @description + * Creates a `Deferred` object which represents a task which will finish in the future. + * + * @returns {Deferred} Returns a new instance of deferred. + */ + var defer = function() { + var pending = [], + value, deferred; + + deferred = { + + resolve: function(val) { + if (pending) { + var callbacks = pending; + pending = undefined; + value = ref(val); + + if (callbacks.length) { + nextTick(function() { + var callback; + for (var i = 0, ii = callbacks.length; i < ii; i++) { + callback = callbacks[i]; + value.then(callback[0], callback[1], callback[2]); + } + }); + } + } + }, + + + reject: function(reason) { + deferred.resolve(reject(reason)); + }, + + + notify: function(progress) { + if (pending) { + var callbacks = pending; + + if (pending.length) { + nextTick(function() { + var callback; + for (var i = 0, ii = callbacks.length; i < ii; i++) { + callback = callbacks[i]; + callback[2](progress); + } + }); + } + } + }, + + + promise: { + then: function(callback, errback, progressback) { + var result = defer(); + + var wrappedCallback = function(value) { + try { + result.resolve((isFunction(callback) ? callback : defaultCallback)(value)); + } catch(e) { + result.reject(e); + exceptionHandler(e); + } + }; + + var wrappedErrback = function(reason) { + try { + result.resolve((isFunction(errback) ? errback : defaultErrback)(reason)); + } catch(e) { + result.reject(e); + exceptionHandler(e); + } + }; + + var wrappedProgressback = function(progress) { + try { + result.notify((isFunction(progressback) ? progressback : defaultCallback)(progress)); + } catch(e) { + exceptionHandler(e); + } + }; + + if (pending) { + pending.push([wrappedCallback, wrappedErrback, wrappedProgressback]); + } else { + value.then(wrappedCallback, wrappedErrback, wrappedProgressback); + } + + return result.promise; + }, + + "catch": function(callback) { + return this.then(null, callback); + }, + + "finally": function(callback) { + + function makePromise(value, resolved) { + var result = defer(); + if (resolved) { + result.resolve(value); + } else { + result.reject(value); + } + return result.promise; + } + + function handleCallback(value, isResolved) { + var callbackOutput = null; + try { + callbackOutput = (callback ||defaultCallback)(); + } catch(e) { + return makePromise(e, false); + } + if (callbackOutput && isFunction(callbackOutput.then)) { + return callbackOutput.then(function() { + return makePromise(value, isResolved); + }, function(error) { + return makePromise(error, false); + }); + } else { + return makePromise(value, isResolved); + } + } + + return this.then(function(value) { + return handleCallback(value, true); + }, function(error) { + return handleCallback(error, false); + }); + } + } + }; + + return deferred; + }; + + + var ref = function(value) { + if (value && isFunction(value.then)) return value; + return { + then: function(callback) { + var result = defer(); + nextTick(function() { + result.resolve(callback(value)); + }); + return result.promise; + } + }; + }; + + + /** + * @ngdoc + * @name ng.$q#reject + * @methodOf ng.$q + * @description + * Creates a promise that is resolved as rejected with the specified `reason`. This api should be + * used to forward rejection in a chain of promises. If you are dealing with the last promise in + * a promise chain, you don't need to worry about it. + * + * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of + * `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via + * a promise error callback and you want to forward the error to the promise derived from the + * current promise, you have to "rethrow" the error by returning a rejection constructed via + * `reject`. + * + *
+   *   promiseB = promiseA.then(function(result) {
+   *     // success: do something and resolve promiseB
+   *     //          with the old or a new result
+   *     return result;
+   *   }, function(reason) {
+   *     // error: handle the error if possible and
+   *     //        resolve promiseB with newPromiseOrValue,
+   *     //        otherwise forward the rejection to promiseB
+   *     if (canHandle(reason)) {
+   *      // handle the error and recover
+   *      return newPromiseOrValue;
+   *     }
+   *     return $q.reject(reason);
+   *   });
+   * 
+ * + * @param {*} reason Constant, message, exception or an object representing the rejection reason. + * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`. + */ + var reject = function(reason) { + return { + then: function(callback, errback) { + var result = defer(); + nextTick(function() { + try { + result.resolve((isFunction(errback) ? errback : defaultErrback)(reason)); + } catch(e) { + result.reject(e); + exceptionHandler(e); + } + }); + return result.promise; + } + }; + }; + + + /** + * @ngdoc + * @name ng.$q#when + * @methodOf ng.$q + * @description + * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. + * This is useful when you are dealing with an object that might or might not be a promise, or if + * the promise comes from a source that can't be trusted. + * + * @param {*} value Value or a promise + * @returns {Promise} Returns a promise of the passed value or promise + */ + var when = function(value, callback, errback, progressback) { + var result = defer(), + done; + + var wrappedCallback = function(value) { + try { + return (isFunction(callback) ? callback : defaultCallback)(value); + } catch (e) { + exceptionHandler(e); + return reject(e); + } + }; + + var wrappedErrback = function(reason) { + try { + return (isFunction(errback) ? errback : defaultErrback)(reason); + } catch (e) { + exceptionHandler(e); + return reject(e); + } + }; + + var wrappedProgressback = function(progress) { + try { + return (isFunction(progressback) ? progressback : defaultCallback)(progress); + } catch (e) { + exceptionHandler(e); + } + }; + + nextTick(function() { + ref(value).then(function(value) { + if (done) return; + done = true; + result.resolve(ref(value).then(wrappedCallback, wrappedErrback, wrappedProgressback)); + }, function(reason) { + if (done) return; + done = true; + result.resolve(wrappedErrback(reason)); + }, function(progress) { + if (done) return; + result.notify(wrappedProgressback(progress)); + }); + }); + + return result.promise; + }; + + + function defaultCallback(value) { + return value; + } + + + function defaultErrback(reason) { + return reject(reason); + } + + + /** + * @ngdoc + * @name ng.$q#all + * @methodOf ng.$q + * @description + * Combines multiple promises into a single promise that is resolved when all of the input + * promises are resolved. + * + * @param {Array.|Object.} promises An array or hash of promises. + * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values, + * each value corresponding to the promise at the same index/key in the `promises` array/hash. + * If any of the promises is resolved with a rejection, this resulting promise will be rejected + * with the same rejection value. + */ + function all(promises) { + var deferred = defer(), + counter = 0, + results = isArray(promises) ? [] : {}; + + forEach(promises, function(promise, key) { + counter++; + ref(promise).then(function(value) { + if (results.hasOwnProperty(key)) return; + results[key] = value; + if (!(--counter)) deferred.resolve(results); + }, function(reason) { + if (results.hasOwnProperty(key)) return; + deferred.reject(reason); + }); + }); + + if (counter === 0) { + deferred.resolve(results); + } + + return deferred.promise; + } + + return { + defer: defer, + reject: reject, + when: when, + all: all + }; +} + +/** + * DESIGN NOTES + * + * The design decisions behind the scope are heavily favored for speed and memory consumption. + * + * The typical use of scope is to watch the expressions, which most of the time return the same + * value as last time so we optimize the operation. + * + * Closures construction is expensive in terms of speed as well as memory: + * - No closures, instead use prototypical inheritance for API + * - Internal state needs to be stored on scope directly, which means that private state is + * exposed as $$____ properties + * + * Loop operations are optimized by using while(count--) { ... } + * - this means that in order to keep the same order of execution as addition we have to add + * items to the array at the beginning (shift) instead of at the end (push) + * + * Child scopes are created and removed often + * - Using an array would be slow since inserts in middle are expensive so we use linked list + * + * There are few watches then a lot of observers. This is why you don't want the observer to be + * implemented in the same way as watch. Watch requires return of initialization function which + * are expensive to construct. + */ + + +/** + * @ngdoc object + * @name ng.$rootScopeProvider + * @description + * + * Provider for the $rootScope service. + */ + +/** + * @ngdoc function + * @name ng.$rootScopeProvider#digestTtl + * @methodOf ng.$rootScopeProvider + * @description + * + * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and + * assuming that the model is unstable. + * + * The current default is 10 iterations. + * + * In complex applications it's possible that the dependencies between `$watch`s will result in + * several digest iterations. However if an application needs more than the default 10 digest + * iterations for its model to stabilize then you should investigate what is causing the model to + * continuously change during the digest. + * + * Increasing the TTL could have performance implications, so you should not change it without + * proper justification. + * + * @param {number} limit The number of digest iterations. + */ + + +/** + * @ngdoc object + * @name ng.$rootScope + * @description + * + * Every application has a single root {@link ng.$rootScope.Scope scope}. + * All other scopes are descendant scopes of the root scope. Scopes provide separation + * between the model and the view, via a mechanism for watching the model for changes. + * They also provide an event emission/broadcast and subscription facility. See the + * {@link guide/scope developer guide on scopes}. + */ +function $RootScopeProvider(){ + var TTL = 10; + var $rootScopeMinErr = minErr('$rootScope'); + + this.digestTtl = function(value) { + if (arguments.length) { + TTL = value; + } + return TTL; + }; + + this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser', + function( $injector, $exceptionHandler, $parse, $browser) { + + /** + * @ngdoc function + * @name ng.$rootScope.Scope + * + * @description + * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the + * {@link AUTO.$injector $injector}. Child scopes are created using the + * {@link ng.$rootScope.Scope#methods_$new $new()} method. (Most scopes are created automatically when + * compiled HTML template is executed.) + * + * Here is a simple scope snippet to show how you can interact with the scope. + *
+     * 
+     * 
+ * + * # Inheritance + * A scope can inherit from a parent scope, as in this example: + *
+         var parent = $rootScope;
+         var child = parent.$new();
+
+         parent.salutation = "Hello";
+         child.name = "World";
+         expect(child.salutation).toEqual('Hello');
+
+         child.salutation = "Welcome";
+         expect(child.salutation).toEqual('Welcome');
+         expect(parent.salutation).toEqual('Hello');
+     * 
+ * + * + * @param {Object.=} providers Map of service factory which need to be + * provided for the current scope. Defaults to {@link ng}. + * @param {Object.=} instanceCache Provides pre-instantiated services which should + * append/override services provided by `providers`. This is handy + * when unit-testing and having the need to override a default + * service. + * @returns {Object} Newly created scope. + * + */ + function Scope() { + this.$id = nextUid(); + this.$$phase = this.$parent = this.$$watchers = + this.$$nextSibling = this.$$prevSibling = + this.$$childHead = this.$$childTail = null; + this['this'] = this.$root = this; + this.$$destroyed = false; + this.$$asyncQueue = []; + this.$$postDigestQueue = []; + this.$$listeners = {}; + this.$$isolateBindings = {}; + } + + /** + * @ngdoc property + * @name ng.$rootScope.Scope#$id + * @propertyOf ng.$rootScope.Scope + * @returns {number} Unique scope ID (monotonically increasing alphanumeric sequence) useful for + * debugging. + */ + + + Scope.prototype = { + constructor: Scope, + /** + * @ngdoc function + * @name ng.$rootScope.Scope#$new + * @methodOf ng.$rootScope.Scope + * @function + * + * @description + * Creates a new child {@link ng.$rootScope.Scope scope}. + * + * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} and + * {@link ng.$rootScope.Scope#$digest $digest()} events. The scope can be removed from the + * scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}. + * + * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is + * desired for the scope and its child scopes to be permanently detached from the parent and + * thus stop participating in model change detection and listener notification by invoking. + * + * @param {boolean} isolate If true, then the scope does not prototypically inherit from the + * parent scope. The scope is isolated, as it can not see parent scope properties. + * When creating widgets, it is useful for the widget to not accidentally read parent + * state. + * + * @returns {Object} The newly created child scope. + * + */ + $new: function(isolate) { + var Child, + child; + + if (isolate) { + child = new Scope(); + child.$root = this.$root; + // ensure that there is just one async queue per $rootScope and its children + child.$$asyncQueue = this.$$asyncQueue; + child.$$postDigestQueue = this.$$postDigestQueue; + } else { + Child = function() {}; // should be anonymous; This is so that when the minifier munges + // the name it does not become random set of chars. This will then show up as class + // name in the debugger. + Child.prototype = this; + child = new Child(); + child.$id = nextUid(); + } + child['this'] = child; + child.$$listeners = {}; + child.$parent = this; + child.$$watchers = child.$$nextSibling = child.$$childHead = child.$$childTail = null; + child.$$prevSibling = this.$$childTail; + if (this.$$childHead) { + this.$$childTail.$$nextSibling = child; + this.$$childTail = child; + } else { + this.$$childHead = this.$$childTail = child; + } + return child; + }, + + /** + * @ngdoc function + * @name ng.$rootScope.Scope#$watch + * @methodOf ng.$rootScope.Scope + * @function + * + * @description + * Registers a `listener` callback to be executed whenever the `watchExpression` changes. + * + * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest + * $digest()} and should return the value that will be watched. (Since + * {@link ng.$rootScope.Scope#$digest $digest()} reruns when it detects changes the + * `watchExpression` can execute multiple times per + * {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.) + * - The `listener` is called only when the value from the current `watchExpression` and the + * previous call to `watchExpression` are not equal (with the exception of the initial run, + * see below). The inequality is determined according to + * {@link angular.equals} function. To save the value of the object for later comparison, + * the {@link angular.copy} function is used. It also means that watching complex options + * will have adverse memory and performance implications. + * - The watch `listener` may change the model, which may trigger other `listener`s to fire. + * This is achieved by rerunning the watchers until no changes are detected. The rerun + * iteration limit is 10 to prevent an infinite loop deadlock. + * + * + * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called, + * you can register a `watchExpression` function with no `listener`. (Since `watchExpression` + * can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a + * change is detected, be prepared for multiple calls to your listener.) + * + * After a watcher is registered with the scope, the `listener` fn is called asynchronously + * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the + * watcher. In rare cases, this is undesirable because the listener is called when the result + * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you + * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the + * listener was called due to initialization. + * + * The example below contains an illustration of using a function as your $watch listener + * + * + * # Example + *
+           // let's assume that scope was dependency injected as the $rootScope
+           var scope = $rootScope;
+           scope.name = 'misko';
+           scope.counter = 0;
+
+           expect(scope.counter).toEqual(0);
+           scope.$watch('name', function(newValue, oldValue) {
+             scope.counter = scope.counter + 1;
+           });
+           expect(scope.counter).toEqual(0);
+
+           scope.$digest();
+           // no variable change
+           expect(scope.counter).toEqual(0);
+
+           scope.name = 'adam';
+           scope.$digest();
+           expect(scope.counter).toEqual(1);
+
+
+
+           // Using a listener function 
+           var food;
+           scope.foodCounter = 0;
+           expect(scope.foodCounter).toEqual(0);
+           scope.$watch(
+             // This is the listener function
+             function() { return food; },
+             // This is the change handler
+             function(newValue, oldValue) {
+               if ( newValue !== oldValue ) {
+                 // Only increment the counter if the value changed
+                 scope.foodCounter = scope.foodCounter + 1;
+               }
+             }
+           );
+           // No digest has been run so the counter will be zero
+           expect(scope.foodCounter).toEqual(0);
+
+           // Run the digest but since food has not changed cout will still be zero
+           scope.$digest();
+           expect(scope.foodCounter).toEqual(0);
+
+           // Update food and run digest.  Now the counter will increment
+           food = 'cheeseburger';
+           scope.$digest();
+           expect(scope.foodCounter).toEqual(1);  
+
+       * 
+ * + * + * + * @param {(function()|string)} watchExpression Expression that is evaluated on each + * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers + * a call to the `listener`. + * + * - `string`: Evaluated as {@link guide/expression expression} + * - `function(scope)`: called with current `scope` as a parameter. + * @param {(function()|string)=} listener Callback called whenever the return value of + * the `watchExpression` changes. + * + * - `string`: Evaluated as {@link guide/expression expression} + * - `function(newValue, oldValue, scope)`: called with current and previous values as + * parameters. + * + * @param {boolean=} objectEquality Compare object for equality rather than for reference. + * @returns {function()} Returns a deregistration function for this listener. + */ + $watch: function(watchExp, listener, objectEquality) { + var scope = this, + get = compileToFn(watchExp, 'watch'), + array = scope.$$watchers, + watcher = { + fn: listener, + last: initWatchVal, + get: get, + exp: watchExp, + eq: !!objectEquality + }; + + // in the case user pass string, we need to compile it, do we really need this ? + if (!isFunction(listener)) { + var listenFn = compileToFn(listener || noop, 'listener'); + watcher.fn = function(newVal, oldVal, scope) {listenFn(scope);}; + } + + if (typeof watchExp == 'string' && get.constant) { + var originalFn = watcher.fn; + watcher.fn = function(newVal, oldVal, scope) { + originalFn.call(this, newVal, oldVal, scope); + arrayRemove(array, watcher); + }; + } + + if (!array) { + array = scope.$$watchers = []; + } + // we use unshift since we use a while loop in $digest for speed. + // the while loop reads in reverse order. + array.unshift(watcher); + + return function() { + arrayRemove(array, watcher); + }; + }, + + + /** + * @ngdoc function + * @name ng.$rootScope.Scope#$watchCollection + * @methodOf ng.$rootScope.Scope + * @function + * + * @description + * Shallow watches the properties of an object and fires whenever any of the properties change + * (for arrays, this implies watching the array items; for object maps, this implies watching + * the properties). If a change is detected, the `listener` callback is fired. + * + * - The `obj` collection is observed via standard $watch operation and is examined on every + * call to $digest() to see if any items have been added, removed, or moved. + * - The `listener` is called whenever anything within the `obj` has changed. Examples include + * adding, removing, and moving items belonging to an object or array. + * + * + * # Example + *
+          $scope.names = ['igor', 'matias', 'misko', 'james'];
+          $scope.dataCount = 4;
+
+          $scope.$watchCollection('names', function(newNames, oldNames) {
+            $scope.dataCount = newNames.length;
+          });
+
+          expect($scope.dataCount).toEqual(4);
+          $scope.$digest();
+
+          //still at 4 ... no changes
+          expect($scope.dataCount).toEqual(4);
+
+          $scope.names.pop();
+          $scope.$digest();
+
+          //now there's been a change
+          expect($scope.dataCount).toEqual(3);
+       * 
+ * + * + * @param {string|Function(scope)} obj Evaluated as {@link guide/expression expression}. The + * expression value should evaluate to an object or an array which is observed on each + * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the + * collection will trigger a call to the `listener`. + * + * @param {function(newCollection, oldCollection, scope)} listener a callback function that is + * fired with both the `newCollection` and `oldCollection` as parameters. + * The `newCollection` object is the newly modified data obtained from the `obj` expression + * and the `oldCollection` object is a copy of the former collection data. + * The `scope` refers to the current scope. + * + * @returns {function()} Returns a de-registration function for this listener. When the + * de-registration function is executed, the internal watch operation is terminated. + */ + $watchCollection: function(obj, listener) { + var self = this; + var oldValue; + var newValue; + var changeDetected = 0; + var objGetter = $parse(obj); + var internalArray = []; + var internalObject = {}; + var oldLength = 0; + + function $watchCollectionWatch() { + newValue = objGetter(self); + var newLength, key; + + if (!isObject(newValue)) { + if (oldValue !== newValue) { + oldValue = newValue; + changeDetected++; + } + } else if (isArrayLike(newValue)) { + if (oldValue !== internalArray) { + // we are transitioning from something which was not an array into array. + oldValue = internalArray; + oldLength = oldValue.length = 0; + changeDetected++; + } + + newLength = newValue.length; + + if (oldLength !== newLength) { + // if lengths do not match we need to trigger change notification + changeDetected++; + oldValue.length = oldLength = newLength; + } + // copy the items to oldValue and look for changes. + for (var i = 0; i < newLength; i++) { + if (oldValue[i] !== newValue[i]) { + changeDetected++; + oldValue[i] = newValue[i]; + } + } + } else { + if (oldValue !== internalObject) { + // we are transitioning from something which was not an object into object. + oldValue = internalObject = {}; + oldLength = 0; + changeDetected++; + } + // copy the items to oldValue and look for changes. + newLength = 0; + for (key in newValue) { + if (newValue.hasOwnProperty(key)) { + newLength++; + if (oldValue.hasOwnProperty(key)) { + if (oldValue[key] !== newValue[key]) { + changeDetected++; + oldValue[key] = newValue[key]; + } + } else { + oldLength++; + oldValue[key] = newValue[key]; + changeDetected++; + } + } + } + if (oldLength > newLength) { + // we used to have more keys, need to find them and destroy them. + changeDetected++; + for(key in oldValue) { + if (oldValue.hasOwnProperty(key) && !newValue.hasOwnProperty(key)) { + oldLength--; + delete oldValue[key]; + } + } + } + } + return changeDetected; + } + + function $watchCollectionAction() { + listener(newValue, oldValue, self); + } + + return this.$watch($watchCollectionWatch, $watchCollectionAction); + }, + + /** + * @ngdoc function + * @name ng.$rootScope.Scope#$digest + * @methodOf ng.$rootScope.Scope + * @function + * + * @description + * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and + * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change + * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers} + * until no more listeners are firing. This means that it is possible to get into an infinite + * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of + * iterations exceeds 10. + * + * Usually, you don't call `$digest()` directly in + * {@link ng.directive:ngController controllers} or in + * {@link ng.$compileProvider#methods_directive directives}. + * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within + * a {@link ng.$compileProvider#methods_directive directives}), which will force a `$digest()`. + * + * If you want to be notified whenever `$digest()` is called, + * you can register a `watchExpression` function with + * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`. + * + * In unit tests, you may need to call `$digest()` to simulate the scope life cycle. + * + * # Example + *
+           var scope = ...;
+           scope.name = 'misko';
+           scope.counter = 0;
+
+           expect(scope.counter).toEqual(0);
+           scope.$watch('name', function(newValue, oldValue) {
+             scope.counter = scope.counter + 1;
+           });
+           expect(scope.counter).toEqual(0);
+
+           scope.$digest();
+           // no variable change
+           expect(scope.counter).toEqual(0);
+
+           scope.name = 'adam';
+           scope.$digest();
+           expect(scope.counter).toEqual(1);
+       * 
+ * + */ + $digest: function() { + var watch, value, last, + watchers, + asyncQueue = this.$$asyncQueue, + postDigestQueue = this.$$postDigestQueue, + length, + dirty, ttl = TTL, + next, current, target = this, + watchLog = [], + logIdx, logMsg, asyncTask; + + beginPhase('$digest'); + + do { // "while dirty" loop + dirty = false; + current = target; + + while(asyncQueue.length) { + try { + asyncTask = asyncQueue.shift(); + asyncTask.scope.$eval(asyncTask.expression); + } catch (e) { + $exceptionHandler(e); + } + } + + do { // "traverse the scopes" loop + if ((watchers = current.$$watchers)) { + // process our watches + length = watchers.length; + while (length--) { + try { + watch = watchers[length]; + // Most common watches are on primitives, in which case we can short + // circuit it with === operator, only when === fails do we use .equals + if (watch && (value = watch.get(current)) !== (last = watch.last) && + !(watch.eq + ? equals(value, last) + : (typeof value == 'number' && typeof last == 'number' + && isNaN(value) && isNaN(last)))) { + dirty = true; + watch.last = watch.eq ? copy(value) : value; + watch.fn(value, ((last === initWatchVal) ? value : last), current); + if (ttl < 5) { + logIdx = 4 - ttl; + if (!watchLog[logIdx]) watchLog[logIdx] = []; + logMsg = (isFunction(watch.exp)) + ? 'fn: ' + (watch.exp.name || watch.exp.toString()) + : watch.exp; + logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last); + watchLog[logIdx].push(logMsg); + } + } + } catch (e) { + $exceptionHandler(e); + } + } + } + + // Insanity Warning: scope depth-first traversal + // yes, this code is a bit crazy, but it works and we have tests to prove it! + // this piece should be kept in sync with the traversal in $broadcast + if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) { + while(current !== target && !(next = current.$$nextSibling)) { + current = current.$parent; + } + } + } while ((current = next)); + + if(dirty && !(ttl--)) { + clearPhase(); + throw $rootScopeMinErr('infdig', + '{0} $digest() iterations reached. Aborting!\n' + + 'Watchers fired in the last 5 iterations: {1}', + TTL, toJson(watchLog)); + } + } while (dirty || asyncQueue.length); + + clearPhase(); + + while(postDigestQueue.length) { + try { + postDigestQueue.shift()(); + } catch (e) { + $exceptionHandler(e); + } + } + }, + + + /** + * @ngdoc event + * @name ng.$rootScope.Scope#$destroy + * @eventOf ng.$rootScope.Scope + * @eventType broadcast on scope being destroyed + * + * @description + * Broadcasted when a scope and its children are being destroyed. + * + * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to + * clean up DOM bindings before an element is removed from the DOM. + */ + + /** + * @ngdoc function + * @name ng.$rootScope.Scope#$destroy + * @methodOf ng.$rootScope.Scope + * @function + * + * @description + * Removes the current scope (and all of its children) from the parent scope. Removal implies + * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer + * propagate to the current scope and its children. Removal also implies that the current + * scope is eligible for garbage collection. + * + * The `$destroy()` is usually used by directives such as + * {@link ng.directive:ngRepeat ngRepeat} for managing the + * unrolling of the loop. + * + * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope. + * Application code can register a `$destroy` event handler that will give it a chance to + * perform any necessary cleanup. + * + * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to + * clean up DOM bindings before an element is removed from the DOM. + */ + $destroy: function() { + // we can't destroy the root scope or a scope that has been already destroyed + if ($rootScope == this || this.$$destroyed) return; + var parent = this.$parent; + + this.$broadcast('$destroy'); + this.$$destroyed = true; + + if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling; + if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling; + if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling; + if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling; + + // This is bogus code that works around Chrome's GC leak + // see: https://github.com/angular/angular.js/issues/1313#issuecomment-10378451 + this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead = + this.$$childTail = null; + }, + + /** + * @ngdoc function + * @name ng.$rootScope.Scope#$eval + * @methodOf ng.$rootScope.Scope + * @function + * + * @description + * Executes the `expression` on the current scope and returns the result. Any exceptions in + * the expression are propagated (uncaught). This is useful when evaluating Angular + * expressions. + * + * # Example + *
+           var scope = ng.$rootScope.Scope();
+           scope.a = 1;
+           scope.b = 2;
+
+           expect(scope.$eval('a+b')).toEqual(3);
+           expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
+       * 
+ * + * @param {(string|function())=} expression An angular expression to be executed. + * + * - `string`: execute using the rules as defined in {@link guide/expression expression}. + * - `function(scope)`: execute the function with the current `scope` parameter. + * + * @param {(object)=} locals Local variables object, useful for overriding values in scope. + * @returns {*} The result of evaluating the expression. + */ + $eval: function(expr, locals) { + return $parse(expr)(this, locals); + }, + + /** + * @ngdoc function + * @name ng.$rootScope.Scope#$evalAsync + * @methodOf ng.$rootScope.Scope + * @function + * + * @description + * Executes the expression on the current scope at a later point in time. + * + * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only + * that: + * + * - it will execute after the function that scheduled the evaluation (preferably before DOM + * rendering). + * - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after + * `expression` execution. + * + * Any exceptions from the execution of the expression are forwarded to the + * {@link ng.$exceptionHandler $exceptionHandler} service. + * + * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle + * will be scheduled. However, it is encouraged to always call code that changes the model + * from within an `$apply` call. That includes code evaluated via `$evalAsync`. + * + * @param {(string|function())=} expression An angular expression to be executed. + * + * - `string`: execute using the rules as defined in {@link guide/expression expression}. + * - `function(scope)`: execute the function with the current `scope` parameter. + * + */ + $evalAsync: function(expr) { + // if we are outside of an $digest loop and this is the first time we are scheduling async + // task also schedule async auto-flush + if (!$rootScope.$$phase && !$rootScope.$$asyncQueue.length) { + $browser.defer(function() { + if ($rootScope.$$asyncQueue.length) { + $rootScope.$digest(); + } + }); + } + + this.$$asyncQueue.push({scope: this, expression: expr}); + }, + + $$postDigest : function(fn) { + this.$$postDigestQueue.push(fn); + }, + + /** + * @ngdoc function + * @name ng.$rootScope.Scope#$apply + * @methodOf ng.$rootScope.Scope + * @function + * + * @description + * `$apply()` is used to execute an expression in angular from outside of the angular + * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries). + * Because we are calling into the angular framework we need to perform proper scope life + * cycle of {@link ng.$exceptionHandler exception handling}, + * {@link ng.$rootScope.Scope#$digest executing watches}. + * + * ## Life cycle + * + * # Pseudo-Code of `$apply()` + *
+           function $apply(expr) {
+             try {
+               return $eval(expr);
+             } catch (e) {
+               $exceptionHandler(e);
+             } finally {
+               $root.$digest();
+             }
+           }
+       * 
+ * + * + * Scope's `$apply()` method transitions through the following stages: + * + * 1. The {@link guide/expression expression} is executed using the + * {@link ng.$rootScope.Scope#$eval $eval()} method. + * 2. Any exceptions from the execution of the expression are forwarded to the + * {@link ng.$exceptionHandler $exceptionHandler} service. + * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the + * expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method. + * + * + * @param {(string|function())=} exp An angular expression to be executed. + * + * - `string`: execute using the rules as defined in {@link guide/expression expression}. + * - `function(scope)`: execute the function with current `scope` parameter. + * + * @returns {*} The result of evaluating the expression. + */ + $apply: function(expr) { + try { + beginPhase('$apply'); + return this.$eval(expr); + } catch (e) { + $exceptionHandler(e); + } finally { + clearPhase(); + try { + $rootScope.$digest(); + } catch (e) { + $exceptionHandler(e); + throw e; + } + } + }, + + /** + * @ngdoc function + * @name ng.$rootScope.Scope#$on + * @methodOf ng.$rootScope.Scope + * @function + * + * @description + * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for + * discussion of event life cycle. + * + * The event listener function format is: `function(event, args...)`. The `event` object + * passed into the listener has the following attributes: + * + * - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or + * `$broadcast`-ed. + * - `currentScope` - `{Scope}`: the current scope which is handling the event. + * - `name` - `{string}`: name of the event. + * - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel + * further event propagation (available only for events that were `$emit`-ed). + * - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag + * to true. + * - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called. + * + * @param {string} name Event name to listen on. + * @param {function(event, args...)} listener Function to call when the event is emitted. + * @returns {function()} Returns a deregistration function for this listener. + */ + $on: function(name, listener) { + var namedListeners = this.$$listeners[name]; + if (!namedListeners) { + this.$$listeners[name] = namedListeners = []; + } + namedListeners.push(listener); + + return function() { + namedListeners[indexOf(namedListeners, listener)] = null; + }; + }, + + + /** + * @ngdoc function + * @name ng.$rootScope.Scope#$emit + * @methodOf ng.$rootScope.Scope + * @function + * + * @description + * Dispatches an event `name` upwards through the scope hierarchy notifying the + * registered {@link ng.$rootScope.Scope#$on} listeners. + * + * The event life cycle starts at the scope on which `$emit` was called. All + * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get + * notified. Afterwards, the event traverses upwards toward the root scope and calls all + * registered listeners along the way. The event will stop propagating if one of the listeners + * cancels it. + * + * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed + * onto the {@link ng.$exceptionHandler $exceptionHandler} service. + * + * @param {string} name Event name to emit. + * @param {...*} args Optional set of arguments which will be passed onto the event listeners. + * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}). + */ + $emit: function(name, args) { + var empty = [], + namedListeners, + scope = this, + stopPropagation = false, + event = { + name: name, + targetScope: scope, + stopPropagation: function() {stopPropagation = true;}, + preventDefault: function() { + event.defaultPrevented = true; + }, + defaultPrevented: false + }, + listenerArgs = concat([event], arguments, 1), + i, length; + + do { + namedListeners = scope.$$listeners[name] || empty; + event.currentScope = scope; + for (i=0, length=namedListeners.length; i -1) { + throw $sceMinErr('iwcard', + 'Illegal sequence *** in string matcher. String: {0}', matcher); + } + matcher = escapeForRegexp(matcher). + replace('\\*\\*', '.*'). + replace('\\*', '[^:/.?&;]*'); + return new RegExp('^' + matcher + '$'); + } else if (isRegExp(matcher)) { + // The only other type of matcher allowed is a Regexp. + // Match entire URL / disallow partial matches. + // Flags are reset (i.e. no global, ignoreCase or multiline) + return new RegExp('^' + matcher.source + '$'); + } else { + throw $sceMinErr('imatcher', + 'Matchers may only be "self", string patterns or RegExp objects'); + } +} + + +function adjustMatchers(matchers) { + var adjustedMatchers = []; + if (isDefined(matchers)) { + forEach(matchers, function(matcher) { + adjustedMatchers.push(adjustMatcher(matcher)); + }); + } + return adjustedMatchers; +} + + +/** + * @ngdoc service + * @name ng.$sceDelegate + * @function + * + * @description + * + * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict + * Contextual Escaping (SCE)} services to AngularJS. + * + * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of + * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS. This is + * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to + * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things + * work because `$sce` delegates to `$sceDelegate` for these operations. + * + * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service. + * + * The default instance of `$sceDelegate` should work out of the box with little pain. While you + * can override it completely to change the behavior of `$sce`, the common case would + * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting + * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as + * templates. Refer {@link ng.$sceDelegateProvider#methods_resourceUrlWhitelist + * $sceDelegateProvider.resourceUrlWhitelist} and {@link + * ng.$sceDelegateProvider#methods_resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist} + */ + +/** + * @ngdoc object + * @name ng.$sceDelegateProvider + * @description + * + * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate + * $sceDelegate} service. This allows one to get/set the whitelists and blacklists used to ensure + * that the URLs used for sourcing Angular templates are safe. Refer {@link + * ng.$sceDelegateProvider#methods_resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and + * {@link ng.$sceDelegateProvider#methods_resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist} + * + * For the general details about this service in Angular, read the main page for {@link ng.$sce + * Strict Contextual Escaping (SCE)}. + * + * **Example**: Consider the following case. + * + * - your app is hosted at url `http://myapp.example.com/` + * - but some of your templates are hosted on other domains you control such as + * `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc. + * - and you have an open redirect at `http://myapp.example.com/clickThru?...`. + * + * Here is what a secure configuration for this scenario might look like: + * + *
+ *    angular.module('myApp', []).config(function($sceDelegateProvider) {
+ *      $sceDelegateProvider.resourceUrlWhitelist([
+ *        // Allow same origin resource loads.
+ *        'self',
+ *        // Allow loading from our assets domain.  Notice the difference between * and **.
+ *        'http://srv*.assets.example.com/**']);
+ *
+ *      // The blacklist overrides the whitelist so the open redirect here is blocked.
+ *      $sceDelegateProvider.resourceUrlBlacklist([
+ *        'http://myapp.example.com/clickThru**']);
+ *      });
+ * 
+ */ + +function $SceDelegateProvider() { + this.SCE_CONTEXTS = SCE_CONTEXTS; + + // Resource URLs can also be trusted by policy. + var resourceUrlWhitelist = ['self'], + resourceUrlBlacklist = []; + + /** + * @ngdoc function + * @name ng.sceDelegateProvider#resourceUrlWhitelist + * @methodOf ng.$sceDelegateProvider + * @function + * + * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value + * provided. This must be an array or null. A snapshot of this array is used so further + * changes to the array are ignored. + * + * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items + * allowed in this array. + * + * Note: **an empty whitelist array will block all URLs**! + * + * @return {Array} the currently set whitelist array. + * + * The **default value** when no whitelist has been explicitly set is `['self']` allowing only + * same origin resource requests. + * + * @description + * Sets/Gets the whitelist of trusted resource URLs. + */ + this.resourceUrlWhitelist = function (value) { + if (arguments.length) { + resourceUrlWhitelist = adjustMatchers(value); + } + return resourceUrlWhitelist; + }; + + /** + * @ngdoc function + * @name ng.sceDelegateProvider#resourceUrlBlacklist + * @methodOf ng.$sceDelegateProvider + * @function + * + * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value + * provided. This must be an array or null. A snapshot of this array is used so further + * changes to the array are ignored. + * + * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items + * allowed in this array. + * + * The typical usage for the blacklist is to **block + * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as + * these would otherwise be trusted but actually return content from the redirected domain. + * + * Finally, **the blacklist overrides the whitelist** and has the final say. + * + * @return {Array} the currently set blacklist array. + * + * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there + * is no blacklist.) + * + * @description + * Sets/Gets the blacklist of trusted resource URLs. + */ + + this.resourceUrlBlacklist = function (value) { + if (arguments.length) { + resourceUrlBlacklist = adjustMatchers(value); + } + return resourceUrlBlacklist; + }; + + this.$get = ['$log', '$document', '$injector', function( + $log, $document, $injector) { + + var htmlSanitizer = function htmlSanitizer(html) { + throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.'); + }; + + if ($injector.has('$sanitize')) { + htmlSanitizer = $injector.get('$sanitize'); + } + + + function matchUrl(matcher, parsedUrl) { + if (matcher === 'self') { + return urlIsSameOrigin(parsedUrl); + } else { + // definitely a regex. See adjustMatchers() + return !!matcher.exec(parsedUrl.href); + } + } + + function isResourceUrlAllowedByPolicy(url) { + var parsedUrl = urlResolve(url.toString()); + var i, n, allowed = false; + // Ensure that at least one item from the whitelist allows this url. + for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) { + if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) { + allowed = true; + break; + } + } + if (allowed) { + // Ensure that no item from the blacklist blocked this url. + for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) { + if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) { + allowed = false; + break; + } + } + } + return allowed; + } + + function generateHolderType(Base) { + var holderType = function TrustedValueHolderType(trustedValue) { + this.$$unwrapTrustedValue = function() { + return trustedValue; + }; + }; + if (Base) { + holderType.prototype = new Base(); + } + holderType.prototype.valueOf = function sceValueOf() { + return this.$$unwrapTrustedValue(); + }; + holderType.prototype.toString = function sceToString() { + return this.$$unwrapTrustedValue().toString(); + }; + return holderType; + } + + var trustedValueHolderBase = generateHolderType(), + byType = {}; + + byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase); + byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase); + byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase); + byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase); + byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]); + + /** + * @ngdoc method + * @name ng.$sceDelegate#trustAs + * @methodOf ng.$sceDelegate + * + * @description + * Returns an object that is trusted by angular for use in specified strict + * contextual escaping contexts (such as ng-html-bind-unsafe, ng-include, any src + * attribute interpolation, any dom event binding attribute interpolation + * such as for onclick, etc.) that uses the provided value. + * See {@link ng.$sce $sce} for enabling strict contextual escaping. + * + * @param {string} type The kind of context in which this value is safe for use. e.g. url, + * resourceUrl, html, js and css. + * @param {*} value The value that that should be considered trusted/safe. + * @returns {*} A value that can be used to stand in for the provided `value` in places + * where Angular expects a $sce.trustAs() return value. + */ + function trustAs(type, trustedValue) { + var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null); + if (!Constructor) { + throw $sceMinErr('icontext', + 'Attempted to trust a value in invalid context. Context: {0}; Value: {1}', + type, trustedValue); + } + if (trustedValue === null || trustedValue === undefined || trustedValue === '') { + return trustedValue; + } + // All the current contexts in SCE_CONTEXTS happen to be strings. In order to avoid trusting + // mutable objects, we ensure here that the value passed in is actually a string. + if (typeof trustedValue !== 'string') { + throw $sceMinErr('itype', + 'Attempted to trust a non-string value in a content requiring a string: Context: {0}', + type); + } + return new Constructor(trustedValue); + } + + /** + * @ngdoc method + * @name ng.$sceDelegate#valueOf + * @methodOf ng.$sceDelegate + * + * @description + * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#methods_trustAs + * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link + * ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`}. + * + * If the passed parameter is not a value that had been returned by {@link + * ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`}, returns it as-is. + * + * @param {*} value The result of a prior {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`} + * call or anything else. + * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#methods_trustAs + * `$sceDelegate.trustAs`} if `value` is the result of such a call. Otherwise, returns + * `value` unchanged. + */ + function valueOf(maybeTrusted) { + if (maybeTrusted instanceof trustedValueHolderBase) { + return maybeTrusted.$$unwrapTrustedValue(); + } else { + return maybeTrusted; + } + } + + /** + * @ngdoc method + * @name ng.$sceDelegate#getTrusted + * @methodOf ng.$sceDelegate + * + * @description + * Takes the result of a {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`} call and + * returns the originally supplied value if the queried context type is a supertype of the + * created type. If this condition isn't satisfied, throws an exception. + * + * @param {string} type The kind of context in which this value is to be used. + * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#methods_trustAs + * `$sceDelegate.trustAs`} call. + * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#methods_trustAs + * `$sceDelegate.trustAs`} if valid in this context. Otherwise, throws an exception. + */ + function getTrusted(type, maybeTrusted) { + if (maybeTrusted === null || maybeTrusted === undefined || maybeTrusted === '') { + return maybeTrusted; + } + var constructor = (byType.hasOwnProperty(type) ? byType[type] : null); + if (constructor && maybeTrusted instanceof constructor) { + return maybeTrusted.$$unwrapTrustedValue(); + } + // If we get here, then we may only take one of two actions. + // 1. sanitize the value for the requested type, or + // 2. throw an exception. + if (type === SCE_CONTEXTS.RESOURCE_URL) { + if (isResourceUrlAllowedByPolicy(maybeTrusted)) { + return maybeTrusted; + } else { + throw $sceMinErr('insecurl', + 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}', + maybeTrusted.toString()); + } + } else if (type === SCE_CONTEXTS.HTML) { + return htmlSanitizer(maybeTrusted); + } + throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.'); + } + + return { trustAs: trustAs, + getTrusted: getTrusted, + valueOf: valueOf }; + }]; +} + + +/** + * @ngdoc object + * @name ng.$sceProvider + * @description + * + * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service. + * - enable/disable Strict Contextual Escaping (SCE) in a module + * - override the default implementation with a custom delegate + * + * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}. + */ + +/* jshint maxlen: false*/ + +/** + * @ngdoc service + * @name ng.$sce + * @function + * + * @description + * + * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS. + * + * # Strict Contextual Escaping + * + * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain + * contexts to result in a value that is marked as safe to use for that context. One example of + * such a context is binding arbitrary html controlled by the user via `ng-bind-html`. We refer + * to these contexts as privileged or SCE contexts. + * + * As of version 1.2, Angular ships with SCE enabled by default. + * + * Note: When enabled (the default), IE8 in quirks mode is not supported. In this mode, IE8 allows + * one to execute arbitrary javascript by the use of the expression() syntax. Refer + * to learn more about them. + * You can ensure your document is in standards mode and not quirks mode by adding `` + * to the top of your HTML document. + * + * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for + * security vulnerabilities such as XSS, clickjacking, etc. a lot easier. + * + * Here's an example of a binding in a privileged context: + * + *
+ *     
+ *     
+ *
+ * + * Notice that `ng-bind-html` is bound to `{{userHtml}}` controlled by the user. With SCE + * disabled, this application allows the user to render arbitrary HTML into the DIV. + * In a more realistic example, one may be rendering user comments, blog articles, etc. via + * bindings. (HTML is just one example of a context where rendering user controlled input creates + * security vulnerabilities.) + * + * For the case of HTML, you might use a library, either on the client side, or on the server side, + * to sanitize unsafe HTML before binding to the value and rendering it in the document. + * + * How would you ensure that every place that used these types of bindings was bound to a value that + * was sanitized by your library (or returned as safe for rendering by your server?) How can you + * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some + * properties/fields and forgot to update the binding to the sanitized value? + * + * To be secure by default, you want to ensure that any such bindings are disallowed unless you can + * determine that something explicitly says it's safe to use a value for binding in that + * context. You can then audit your code (a simple grep would do) to ensure that this is only done + * for those values that you can easily tell are safe - because they were received from your server, + * sanitized by your library, etc. You can organize your codebase to help with this - perhaps + * allowing only the files in a specific directory to do this. Ensuring that the internal API + * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task. + * + * In the case of AngularJS' SCE service, one uses {@link ng.$sce#methods_trustAs $sce.trustAs} + * (and shorthand methods such as {@link ng.$sce#methods_trustAsHtml $sce.trustAsHtml}, etc.) to + * obtain values that will be accepted by SCE / privileged contexts. + * + * + * ## How does it work? + * + * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#methods_getTrusted + * $sce.getTrusted(context, value)} rather than to the value directly. Directives use {@link + * ng.$sce#methods_parse $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the + * {@link ng.$sce#methods_getTrusted $sce.getTrusted} behind the scenes on non-constant literals. + * + * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link + * ng.$sce#methods_parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly + * simplified): + * + *
+ *   var ngBindHtmlDirective = ['$sce', function($sce) {
+ *     return function(scope, element, attr) {
+ *       scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {
+ *         element.html(value || '');
+ *       });
+ *     };
+ *   }];
+ * 
+ * + * ## Impact on loading templates + * + * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as + * `templateUrl`'s specified by {@link guide/directive directives}. + * + * By default, Angular only loads templates from the same domain and protocol as the application + * document. This is done by calling {@link ng.$sce#methods_getTrustedResourceUrl + * $sce.getTrustedResourceUrl} on the template URL. To load templates from other domains and/or + * protocols, you may either either {@link ng.$sceDelegateProvider#methods_resourceUrlWhitelist whitelist + * them} or {@link ng.$sce#methods_trustAsResourceUrl wrap it} into a trusted value. + * + * *Please note*: + * The browser's + * {@link https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest + * Same Origin Policy} and {@link http://www.w3.org/TR/cors/ Cross-Origin Resource Sharing (CORS)} + * policy apply in addition to this and may further restrict whether the template is successfully + * loaded. This means that without the right CORS policy, loading templates from a different domain + * won't work on all browsers. Also, loading templates from `file://` URL does not work on some + * browsers. + * + * ## This feels like too much overhead for the developer? + * + * It's important to remember that SCE only applies to interpolation expressions. + * + * If your expressions are constant literals, they're automatically trusted and you don't need to + * call `$sce.trustAs` on them. (e.g. + * `
`) just works. + * + * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them + * through {@link ng.$sce#methods_getTrusted $sce.getTrusted}. SCE doesn't play a role here. + * + * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load + * templates in `ng-include` from your application's domain without having to even know about SCE. + * It blocks loading templates from other domains or loading templates over http from an https + * served document. You can change these by setting your own custom {@link + * ng.$sceDelegateProvider#methods_resourceUrlWhitelist whitelists} and {@link + * ng.$sceDelegateProvider#methods_resourceUrlBlacklist blacklists} for matching such URLs. + * + * This significantly reduces the overhead. It is far easier to pay the small overhead and have an + * application that's secure and can be audited to verify that with much more ease than bolting + * security onto an application later. + * + * + * ## What trusted context types are supported? + * + * | Context | Notes | + * |---------------------|----------------| + * | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. | + * | `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. | + * | `$sce.URL` | For URLs that are safe to follow as links. Currently unused (`
Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. | + * | `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. | + * + * ## Format of items in {@link ng.$sceDelegateProvider#methods_resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#methods_resourceUrlBlacklist Blacklist}
+ * + * Each element in these arrays must be one of the following: + * + * - **'self'** + * - The special **string**, `'self'`, can be used to match against all URLs of the **same + * domain** as the application document using the **same protocol**. + * - **String** (except the special value `'self'`) + * - The string is matched against the full *normalized / absolute URL* of the resource + * being tested (substring matches are not good enough.) + * - There are exactly **two wildcard sequences** - `*` and `**`. All other characters + * match themselves. + * - `*`: matches zero or more occurances of any character other than one of the following 6 + * characters: '`:`', '`/`', '`.`', '`?`', '`&`' and ';'. It's a useful wildcard for use + * in a whitelist. + * - `**`: matches zero or more occurances of *any* character. As such, it's not + * not appropriate to use in for a scheme, domain, etc. as it would match too much. (e.g. + * http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might + * not have been the intention.) It's usage at the very end of the path is ok. (e.g. + * http://foo.example.com/templates/**). + * - **RegExp** (*see caveat below*) + * - *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax + * (and all the inevitable escaping) makes them *harder to maintain*. It's easy to + * accidentally introduce a bug when one updates a complex expression (imho, all regexes should + * have good test coverage.). For instance, the use of `.` in the regex is correct only in a + * small number of cases. A `.` character in the regex used when matching the scheme or a + * subdomain could be matched against a `:` or literal `.` that was likely not intended. It + * is highly recommended to use the string patterns and only fall back to regular expressions + * if they as a last resort. + * - The regular expression must be an instance of RegExp (i.e. not a string.) It is + * matched against the **entire** *normalized / absolute URL* of the resource being tested + * (even when the RegExp did not have the `^` and `$` codes.) In addition, any flags + * present on the RegExp (such as multiline, global, ignoreCase) are ignored. + * - If you are generating your Javascript from some other templating engine (not + * recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)), + * remember to escape your regular expression (and be aware that you might need more than + * one level of escaping depending on your templating engine and the way you interpolated + * the value.) Do make use of your platform's escaping mechanism as it might be good + * enough before coding your own. e.g. Ruby has + * [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape) + * and Python has [re.escape](http://docs.python.org/library/re.html#re.escape). + * Javascript lacks a similar built in function for escaping. Take a look at Google + * Closure library's [goog.string.regExpEscape(s)]( + * http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962). + * + * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example. + * + * ## Show me an example using SCE. + * + * @example + + +
+

+ User comments
+ By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when + $sanitize is available. If $sanitize isn't available, this results in an error instead of an + exploit. +
+
+ {{userComment.name}}: + +
+
+
+
+
+ + + var mySceApp = angular.module('mySceApp', ['ngSanitize']); + + mySceApp.controller("myAppController", function myAppController($http, $templateCache, $sce) { + var self = this; + $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) { + self.userComments = userComments; + }); + self.explicitlyTrustedHtml = $sce.trustAsHtml( + 'Hover over this text.'); + }); + + + +[ + { "name": "Alice", + "htmlComment": + "Is anyone reading this?" + }, + { "name": "Bob", + "htmlComment": "Yes! Am I the only other one?" + } +] + + + + describe('SCE doc demo', function() { + it('should sanitize untrusted values', function() { + expect(element('.htmlComment').html()).toBe('Is anyone reading this?'); + }); + it('should NOT sanitize explicitly trusted values', function() { + expect(element('#explicitlyTrustedHtml').html()).toBe( + 'Hover over this text.'); + }); + }); + +
+ * + * + * + * ## Can I disable SCE completely? + * + * Yes, you can. However, this is strongly discouraged. SCE gives you a lot of security benefits + * for little coding overhead. It will be much harder to take an SCE disabled application and + * either secure it on your own or enable SCE at a later stage. It might make sense to disable SCE + * for cases where you have a lot of existing code that was written before SCE was introduced and + * you're migrating them a module at a time. + * + * That said, here's how you can completely disable SCE: + * + *
+ *   angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
+ *     // Completely disable SCE.  For demonstration purposes only!
+ *     // Do not use in new projects.
+ *     $sceProvider.enabled(false);
+ *   });
+ * 
+ * + */ +/* jshint maxlen: 100 */ + +function $SceProvider() { + var enabled = true; + + /** + * @ngdoc function + * @name ng.sceProvider#enabled + * @methodOf ng.$sceProvider + * @function + * + * @param {boolean=} value If provided, then enables/disables SCE. + * @return {boolean} true if SCE is enabled, false otherwise. + * + * @description + * Enables/disables SCE and returns the current value. + */ + this.enabled = function (value) { + if (arguments.length) { + enabled = !!value; + } + return enabled; + }; + + + /* Design notes on the default implementation for SCE. + * + * The API contract for the SCE delegate + * ------------------------------------- + * The SCE delegate object must provide the following 3 methods: + * + * - trustAs(contextEnum, value) + * This method is used to tell the SCE service that the provided value is OK to use in the + * contexts specified by contextEnum. It must return an object that will be accepted by + * getTrusted() for a compatible contextEnum and return this value. + * + * - valueOf(value) + * For values that were not produced by trustAs(), return them as is. For values that were + * produced by trustAs(), return the corresponding input value to trustAs. Basically, if + * trustAs is wrapping the given values into some type, this operation unwraps it when given + * such a value. + * + * - getTrusted(contextEnum, value) + * This function should return the a value that is safe to use in the context specified by + * contextEnum or throw and exception otherwise. + * + * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be + * opaque or wrapped in some holder object. That happens to be an implementation detail. For + * instance, an implementation could maintain a registry of all trusted objects by context. In + * such a case, trustAs() would return the same object that was passed in. getTrusted() would + * return the same object passed in if it was found in the registry under a compatible context or + * throw an exception otherwise. An implementation might only wrap values some of the time based + * on some criteria. getTrusted() might return a value and not throw an exception for special + * constants or objects even if not wrapped. All such implementations fulfill this contract. + * + * + * A note on the inheritance model for SCE contexts + * ------------------------------------------------ + * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types. This + * is purely an implementation details. + * + * The contract is simply this: + * + * getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value) + * will also succeed. + * + * Inheritance happens to capture this in a natural way. In some future, we + * may not use inheritance anymore. That is OK because no code outside of + * sce.js and sceSpecs.js would need to be aware of this detail. + */ + + this.$get = ['$parse', '$document', '$sceDelegate', function( + $parse, $document, $sceDelegate) { + // Prereq: Ensure that we're not running in IE8 quirks mode. In that mode, IE allows + // the "expression(javascript expression)" syntax which is insecure. + if (enabled && msie) { + var documentMode = $document[0].documentMode; + if (documentMode !== undefined && documentMode < 8) { + throw $sceMinErr('iequirks', + 'Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks ' + + 'mode. You can fix this by adding the text to the top of your HTML ' + + 'document. See http://docs.angularjs.org/api/ng.$sce for more information.'); + } + } + + var sce = copy(SCE_CONTEXTS); + + /** + * @ngdoc function + * @name ng.sce#isEnabled + * @methodOf ng.$sce + * @function + * + * @return {Boolean} true if SCE is enabled, false otherwise. If you want to set the value, you + * have to do it at module config time on {@link ng.$sceProvider $sceProvider}. + * + * @description + * Returns a boolean indicating if SCE is enabled. + */ + sce.isEnabled = function () { + return enabled; + }; + sce.trustAs = $sceDelegate.trustAs; + sce.getTrusted = $sceDelegate.getTrusted; + sce.valueOf = $sceDelegate.valueOf; + + if (!enabled) { + sce.trustAs = sce.getTrusted = function(type, value) { return value; }; + sce.valueOf = identity; + } + + /** + * @ngdoc method + * @name ng.$sce#parse + * @methodOf ng.$sce + * + * @description + * Converts Angular {@link guide/expression expression} into a function. This is like {@link + * ng.$parse $parse} and is identical when the expression is a literal constant. Otherwise, it + * wraps the expression in a call to {@link ng.$sce#methods_getTrusted $sce.getTrusted(*type*, + * *result*)} + * + * @param {string} type The kind of SCE context in which this result will be used. + * @param {string} expression String expression to compile. + * @returns {function(context, locals)} a function which represents the compiled expression: + * + * * `context` – `{object}` – an object against which any expressions embedded in the strings + * are evaluated against (typically a scope object). + * * `locals` – `{object=}` – local variables context object, useful for overriding values in + * `context`. + */ + sce.parseAs = function sceParseAs(type, expr) { + var parsed = $parse(expr); + if (parsed.literal && parsed.constant) { + return parsed; + } else { + return function sceParseAsTrusted(self, locals) { + return sce.getTrusted(type, parsed(self, locals)); + }; + } + }; + + /** + * @ngdoc method + * @name ng.$sce#trustAs + * @methodOf ng.$sce + * + * @description + * Delegates to {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`}. As such, + * returns an objectthat is trusted by angular for use in specified strict contextual + * escaping contexts (such as ng-html-bind-unsafe, ng-include, any src attribute + * interpolation, any dom event binding attribute interpolation such as for onclick, etc.) + * that uses the provided value. See * {@link ng.$sce $sce} for enabling strict contextual + * escaping. + * + * @param {string} type The kind of context in which this value is safe for use. e.g. url, + * resource_url, html, js and css. + * @param {*} value The value that that should be considered trusted/safe. + * @returns {*} A value that can be used to stand in for the provided `value` in places + * where Angular expects a $sce.trustAs() return value. + */ + + /** + * @ngdoc method + * @name ng.$sce#trustAsHtml + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.trustAsHtml(value)` → + * {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs($sce.HTML, value)`} + * + * @param {*} value The value to trustAs. + * @returns {*} An object that can be passed to {@link ng.$sce#methods_getTrustedHtml + * $sce.getTrustedHtml(value)} to obtain the original value. (privileged directives + * only accept expressions that are either literal constants or are the + * return value of {@link ng.$sce#methods_trustAs $sce.trustAs}.) + */ + + /** + * @ngdoc method + * @name ng.$sce#trustAsUrl + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.trustAsUrl(value)` → + * {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs($sce.URL, value)`} + * + * @param {*} value The value to trustAs. + * @returns {*} An object that can be passed to {@link ng.$sce#methods_getTrustedUrl + * $sce.getTrustedUrl(value)} to obtain the original value. (privileged directives + * only accept expressions that are either literal constants or are the + * return value of {@link ng.$sce#methods_trustAs $sce.trustAs}.) + */ + + /** + * @ngdoc method + * @name ng.$sce#trustAsResourceUrl + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.trustAsResourceUrl(value)` → + * {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`} + * + * @param {*} value The value to trustAs. + * @returns {*} An object that can be passed to {@link ng.$sce#methods_getTrustedResourceUrl + * $sce.getTrustedResourceUrl(value)} to obtain the original value. (privileged directives + * only accept expressions that are either literal constants or are the return + * value of {@link ng.$sce#methods_trustAs $sce.trustAs}.) + */ + + /** + * @ngdoc method + * @name ng.$sce#trustAsJs + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.trustAsJs(value)` → + * {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs($sce.JS, value)`} + * + * @param {*} value The value to trustAs. + * @returns {*} An object that can be passed to {@link ng.$sce#methods_getTrustedJs + * $sce.getTrustedJs(value)} to obtain the original value. (privileged directives + * only accept expressions that are either literal constants or are the + * return value of {@link ng.$sce#methods_trustAs $sce.trustAs}.) + */ + + /** + * @ngdoc method + * @name ng.$sce#getTrusted + * @methodOf ng.$sce + * + * @description + * Delegates to {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted`}. As such, + * takes the result of a {@link ng.$sce#methods_trustAs `$sce.trustAs`}() call and returns the + * originally supplied value if the queried context type is a supertype of the created type. + * If this condition isn't satisfied, throws an exception. + * + * @param {string} type The kind of context in which this value is to be used. + * @param {*} maybeTrusted The result of a prior {@link ng.$sce#methods_trustAs `$sce.trustAs`} + * call. + * @returns {*} The value the was originally provided to + * {@link ng.$sce#methods_trustAs `$sce.trustAs`} if valid in this context. + * Otherwise, throws an exception. + */ + + /** + * @ngdoc method + * @name ng.$sce#getTrustedHtml + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.getTrustedHtml(value)` → + * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`} + * + * @param {*} value The value to pass to `$sce.getTrusted`. + * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)` + */ + + /** + * @ngdoc method + * @name ng.$sce#getTrustedCss + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.getTrustedCss(value)` → + * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`} + * + * @param {*} value The value to pass to `$sce.getTrusted`. + * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)` + */ + + /** + * @ngdoc method + * @name ng.$sce#getTrustedUrl + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.getTrustedUrl(value)` → + * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.URL, value)`} + * + * @param {*} value The value to pass to `$sce.getTrusted`. + * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)` + */ + + /** + * @ngdoc method + * @name ng.$sce#getTrustedResourceUrl + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.getTrustedResourceUrl(value)` → + * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`} + * + * @param {*} value The value to pass to `$sceDelegate.getTrusted`. + * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)` + */ + + /** + * @ngdoc method + * @name ng.$sce#getTrustedJs + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.getTrustedJs(value)` → + * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.JS, value)`} + * + * @param {*} value The value to pass to `$sce.getTrusted`. + * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)` + */ + + /** + * @ngdoc method + * @name ng.$sce#parseAsHtml + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.parseAsHtml(expression string)` → + * {@link ng.$sce#methods_parse `$sce.parseAs($sce.HTML, value)`} + * + * @param {string} expression String expression to compile. + * @returns {function(context, locals)} a function which represents the compiled expression: + * + * * `context` – `{object}` – an object against which any expressions embedded in the strings + * are evaluated against (typically a scope object). + * * `locals` – `{object=}` – local variables context object, useful for overriding values in + * `context`. + */ + + /** + * @ngdoc method + * @name ng.$sce#parseAsCss + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.parseAsCss(value)` → + * {@link ng.$sce#methods_parse `$sce.parseAs($sce.CSS, value)`} + * + * @param {string} expression String expression to compile. + * @returns {function(context, locals)} a function which represents the compiled expression: + * + * * `context` – `{object}` – an object against which any expressions embedded in the strings + * are evaluated against (typically a scope object). + * * `locals` – `{object=}` – local variables context object, useful for overriding values in + * `context`. + */ + + /** + * @ngdoc method + * @name ng.$sce#parseAsUrl + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.parseAsUrl(value)` → + * {@link ng.$sce#methods_parse `$sce.parseAs($sce.URL, value)`} + * + * @param {string} expression String expression to compile. + * @returns {function(context, locals)} a function which represents the compiled expression: + * + * * `context` – `{object}` – an object against which any expressions embedded in the strings + * are evaluated against (typically a scope object). + * * `locals` – `{object=}` – local variables context object, useful for overriding values in + * `context`. + */ + + /** + * @ngdoc method + * @name ng.$sce#parseAsResourceUrl + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.parseAsResourceUrl(value)` → + * {@link ng.$sce#methods_parse `$sce.parseAs($sce.RESOURCE_URL, value)`} + * + * @param {string} expression String expression to compile. + * @returns {function(context, locals)} a function which represents the compiled expression: + * + * * `context` – `{object}` – an object against which any expressions embedded in the strings + * are evaluated against (typically a scope object). + * * `locals` – `{object=}` – local variables context object, useful for overriding values in + * `context`. + */ + + /** + * @ngdoc method + * @name ng.$sce#parseAsJs + * @methodOf ng.$sce + * + * @description + * Shorthand method. `$sce.parseAsJs(value)` → + * {@link ng.$sce#methods_parse `$sce.parseAs($sce.JS, value)`} + * + * @param {string} expression String expression to compile. + * @returns {function(context, locals)} a function which represents the compiled expression: + * + * * `context` – `{object}` – an object against which any expressions embedded in the strings + * are evaluated against (typically a scope object). + * * `locals` – `{object=}` – local variables context object, useful for overriding values in + * `context`. + */ + + // Shorthand delegations. + var parse = sce.parseAs, + getTrusted = sce.getTrusted, + trustAs = sce.trustAs; + + forEach(SCE_CONTEXTS, function (enumValue, name) { + var lName = lowercase(name); + sce[camelCase("parse_as_" + lName)] = function (expr) { + return parse(enumValue, expr); + }; + sce[camelCase("get_trusted_" + lName)] = function (value) { + return getTrusted(enumValue, value); + }; + sce[camelCase("trust_as_" + lName)] = function (value) { + return trustAs(enumValue, value); + }; + }); + + return sce; + }]; +} + +/** + * !!! This is an undocumented "private" service !!! + * + * @name ng.$sniffer + * @requires $window + * @requires $document + * + * @property {boolean} history Does the browser support html5 history api ? + * @property {boolean} hashchange Does the browser support hashchange event ? + * @property {boolean} transitions Does the browser support CSS transition events ? + * @property {boolean} animations Does the browser support CSS animation events ? + * + * @description + * This is very simple implementation of testing browser's features. + */ +function $SnifferProvider() { + this.$get = ['$window', '$document', function($window, $document) { + var eventSupport = {}, + android = + int((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]), + boxee = /Boxee/i.test(($window.navigator || {}).userAgent), + document = $document[0] || {}, + vendorPrefix, + vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/, + bodyStyle = document.body && document.body.style, + transitions = false, + animations = false, + match; + + if (bodyStyle) { + for(var prop in bodyStyle) { + if(match = vendorRegex.exec(prop)) { + vendorPrefix = match[0]; + vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1); + break; + } + } + + if(!vendorPrefix) { + vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit'; + } + + transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle)); + animations = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle)); + + if (android && (!transitions||!animations)) { + transitions = isString(document.body.style.webkitTransition); + animations = isString(document.body.style.webkitAnimation); + } + } + + + return { + // Android has history.pushState, but it does not update location correctly + // so let's not use the history API at all. + // http://code.google.com/p/android/issues/detail?id=17471 + // https://github.com/angular/angular.js/issues/904 + + // older webit browser (533.9) on Boxee box has exactly the same problem as Android has + // so let's not use the history API also + // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined + // jshint -W018 + history: !!($window.history && $window.history.pushState && !(android < 4) && !boxee), + // jshint +W018 + hashchange: 'onhashchange' in $window && + // IE8 compatible mode lies + (!document.documentMode || document.documentMode > 7), + hasEvent: function(event) { + // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have + // it. In particular the event is not fired when backspace or delete key are pressed or + // when cut operation is performed. + if (event == 'input' && msie == 9) return false; + + if (isUndefined(eventSupport[event])) { + var divElm = document.createElement('div'); + eventSupport[event] = 'on' + event in divElm; + } + + return eventSupport[event]; + }, + csp: csp(), + vendorPrefix: vendorPrefix, + transitions : transitions, + animations : animations, + msie : msie + }; + }]; +} + +function $TimeoutProvider() { + this.$get = ['$rootScope', '$browser', '$q', '$exceptionHandler', + function($rootScope, $browser, $q, $exceptionHandler) { + var deferreds = {}; + + + /** + * @ngdoc function + * @name ng.$timeout + * @requires $browser + * + * @description + * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch + * block and delegates any exceptions to + * {@link ng.$exceptionHandler $exceptionHandler} service. + * + * The return value of registering a timeout function is a promise, which will be resolved when + * the timeout is reached and the timeout function is executed. + * + * To cancel a timeout request, call `$timeout.cancel(promise)`. + * + * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to + * synchronously flush the queue of deferred functions. + * + * @param {function()} fn A function, whose execution should be delayed. + * @param {number=} [delay=0] Delay in milliseconds. + * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise + * will invoke `fn` within the {@link ng.$rootScope.Scope#methods_$apply $apply} block. + * @returns {Promise} Promise that will be resolved when the timeout is reached. The value this + * promise will be resolved with is the return value of the `fn` function. + * + * @example + + + + +
+
+ Date format:
+ Current time is: +
+ Blood 1 : {{blood_1}} + Blood 2 : {{blood_2}} + + + +
+
+ +
+
+ */ + function timeout(fn, delay, invokeApply) { + var deferred = $q.defer(), + promise = deferred.promise, + skipApply = (isDefined(invokeApply) && !invokeApply), + timeoutId; + + timeoutId = $browser.defer(function() { + try { + deferred.resolve(fn()); + } catch(e) { + deferred.reject(e); + $exceptionHandler(e); + } + finally { + delete deferreds[promise.$$timeoutId]; + } + + if (!skipApply) $rootScope.$apply(); + }, delay); + + promise.$$timeoutId = timeoutId; + deferreds[timeoutId] = deferred; + + return promise; + } + + + /** + * @ngdoc function + * @name ng.$timeout#cancel + * @methodOf ng.$timeout + * + * @description + * Cancels a task associated with the `promise`. As a result of this, the promise will be + * resolved with a rejection. + * + * @param {Promise=} promise Promise returned by the `$timeout` function. + * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully + * canceled. + */ + timeout.cancel = function(promise) { + if (promise && promise.$$timeoutId in deferreds) { + deferreds[promise.$$timeoutId].reject('canceled'); + delete deferreds[promise.$$timeoutId]; + return $browser.defer.cancel(promise.$$timeoutId); + } + return false; + }; + + return timeout; + }]; +} + +// NOTE: The usage of window and document instead of $window and $document here is +// deliberate. This service depends on the specific behavior of anchor nodes created by the +// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and +// cause us to break tests. In addition, when the browser resolves a URL for XHR, it +// doesn't know about mocked locations and resolves URLs to the real document - which is +// exactly the behavior needed here. There is little value is mocking these out for this +// service. +var urlParsingNode = document.createElement("a"); +var originUrl = urlResolve(window.location.href, true); + +/** + * + * Implementation Notes for non-IE browsers + * ---------------------------------------- + * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM, + * results both in the normalizing and parsing of the URL. Normalizing means that a relative + * URL will be resolved into an absolute URL in the context of the application document. + * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related + * properties are all populated to reflect the normalized URL. This approach has wide + * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See + * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html + * + * Implementation Notes for IE + * --------------------------- + * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other + * browsers. However, the parsed components will not be set if the URL assigned did not specify + * them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We + * work around that by performing the parsing in a 2nd step by taking a previously normalized + * URL (e.g. by assining to a.href) and assigning it a.href again. This correctly populates the + * properties such as protocol, hostname, port, etc. + * + * IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one + * uses the inner HTML approach to assign the URL as part of an HTML snippet - + * http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL. + * Unfortunately, setting img[src] to something like "javascript:foo" on IE throws an exception. + * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that + * method and IE < 8 is unsupported. + * + * References: + * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement + * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html + * http://url.spec.whatwg.org/#urlutils + * https://github.com/angular/angular.js/pull/2902 + * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/ + * + * @function + * @param {string} url The URL to be parsed. + * @description Normalizes and parses a URL. + * @returns {object} Returns the normalized URL as a dictionary. + * + * | member name | Description | + * |---------------|----------------| + * | href | A normalized version of the provided URL if it was not an absolute URL | + * | protocol | The protocol including the trailing colon | + * | host | The host and port (if the port is non-default) of the normalizedUrl | + * | search | The search params, minus the question mark | + * | hash | The hash string, minus the hash symbol + * | hostname | The hostname + * | port | The port, without ":" + * | pathname | The pathname, beginning with "/" + * + */ +function urlResolve(url) { + var href = url; + if (msie) { + // Normalize before parse. Refer Implementation Notes on why this is + // done in two steps on IE. + urlParsingNode.setAttribute("href", href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // $$urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: urlParsingNode.pathname && urlParsingNode.pathname.charAt(0) === '/' ? + urlParsingNode.pathname : '/' + urlParsingNode.pathname + }; +} + + +/** + * Parse a request URL and determine whether this is a same-origin request as the application document. + * + * @param {string|object} requestUrl The url of the request as a string that will be resolved + * or a parsed URL object. + * @returns {boolean} Whether the request is for the same origin as the application document. + */ +function urlIsSameOrigin(requestUrl) { + var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl; + return (parsed.protocol === originUrl.protocol && + parsed.host === originUrl.host); +} + +/** + * @ngdoc object + * @name ng.$window + * + * @description + * A reference to the browser's `window` object. While `window` + * is globally available in JavaScript, it causes testability problems, because + * it is a global variable. In angular we always refer to it through the + * `$window` service, so it may be overridden, removed or mocked for testing. + * + * Expressions, like the one defined for the `ngClick` directive in the example + * below, are evaluated with respect to the current scope. Therefore, there is + * no risk of inadvertently coding in a dependency on a global value in such an + * expression. + * + * @example + + + +
+ + +
+
+ + it('should display the greeting in the input box', function() { + input('greeting').enter('Hello, E2E Tests'); + // If we click the button it will block the test runner + // element(':button').click(); + }); + +
+ */ +function $WindowProvider(){ + this.$get = valueFn(window); +} + +/** + * @ngdoc object + * @name ng.$filterProvider + * @description + * + * Filters are just functions which transform input to an output. However filters need to be + * Dependency Injected. To achieve this a filter definition consists of a factory function which is + * annotated with dependencies and is responsible for creating a filter function. + * + *
+ *   // Filter registration
+ *   function MyModule($provide, $filterProvider) {
+ *     // create a service to demonstrate injection (not always needed)
+ *     $provide.value('greet', function(name){
+ *       return 'Hello ' + name + '!';
+ *     });
+ *
+ *     // register a filter factory which uses the
+ *     // greet service to demonstrate DI.
+ *     $filterProvider.register('greet', function(greet){
+ *       // return the filter function which uses the greet service
+ *       // to generate salutation
+ *       return function(text) {
+ *         // filters need to be forgiving so check input validity
+ *         return text && greet(text) || text;
+ *       };
+ *     });
+ *   }
+ * 
+ * + * The filter function is registered with the `$injector` under the filter name suffix with + * `Filter`. + * + *
+ *   it('should be the same instance', inject(
+ *     function($filterProvider) {
+ *       $filterProvider.register('reverse', function(){
+ *         return ...;
+ *       });
+ *     },
+ *     function($filter, reverseFilter) {
+ *       expect($filter('reverse')).toBe(reverseFilter);
+ *     });
+ * 
+ * + * + * For more information about how angular filters work, and how to create your own filters, see + * {@link guide/filter Filters} in the Angular Developer Guide. + */ +/** + * @ngdoc method + * @name ng.$filterProvider#register + * @methodOf ng.$filterProvider + * @description + * Register filter factory function. + * + * @param {String} name Name of the filter. + * @param {function} fn The filter factory function which is injectable. + */ + + +/** + * @ngdoc function + * @name ng.$filter + * @function + * @description + * Filters are used for formatting data displayed to the user. + * + * The general syntax in templates is as follows: + * + * {{ expression [| filter_name[:parameter_value] ... ] }} + * + * @param {String} name Name of the filter function to retrieve + * @return {Function} the filter function + */ +$FilterProvider.$inject = ['$provide']; +function $FilterProvider($provide) { + var suffix = 'Filter'; + + /** + * @ngdoc function + * @name ng.$controllerProvider#register + * @methodOf ng.$controllerProvider + * @param {string|Object} name Name of the filter function, or an object map of filters where + * the keys are the filter names and the values are the filter factories. + * @returns {Object} Registered filter instance, or if a map of filters was provided then a map + * of the registered filter instances. + */ + function register(name, factory) { + if(isObject(name)) { + var filters = {}; + forEach(name, function(filter, key) { + filters[key] = register(key, filter); + }); + return filters; + } else { + return $provide.factory(name + suffix, factory); + } + } + this.register = register; + + this.$get = ['$injector', function($injector) { + return function(name) { + return $injector.get(name + suffix); + }; + }]; + + //////////////////////////////////////// + + /* global + currencyFilter: false, + dateFilter: false, + filterFilter: false, + jsonFilter: false, + limitToFilter: false, + lowercaseFilter: false, + numberFilter: false, + orderByFilter: false, + uppercaseFilter: false, + */ + + register('currency', currencyFilter); + register('date', dateFilter); + register('filter', filterFilter); + register('json', jsonFilter); + register('limitTo', limitToFilter); + register('lowercase', lowercaseFilter); + register('number', numberFilter); + register('orderBy', orderByFilter); + register('uppercase', uppercaseFilter); +} + +/** + * @ngdoc filter + * @name ng.filter:filter + * @function + * + * @description + * Selects a subset of items from `array` and returns it as a new array. + * + * @param {Array} array The source array. + * @param {string|Object|function()} expression The predicate to be used for selecting items from + * `array`. + * + * Can be one of: + * + * - `string`: Predicate that results in a substring match using the value of `expression` + * string. All strings or objects with string properties in `array` that contain this string + * will be returned. The predicate can be negated by prefixing the string with `!`. + * + * - `Object`: A pattern object can be used to filter specific properties on objects contained + * by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items + * which have property `name` containing "M" and property `phone` containing "1". A special + * property name `$` can be used (as in `{$:"text"}`) to accept a match against any + * property of the object. That's equivalent to the simple substring match with a `string` + * as described above. + * + * - `function`: A predicate function can be used to write arbitrary filters. The function is + * called for each element of `array`. The final result is an array of those elements that + * the predicate returned true for. + * + * @param {function(expected, actual)|true|undefined} comparator Comparator which is used in + * determining if the expected value (from the filter expression) and actual value (from + * the object in the array) should be considered a match. + * + * Can be one of: + * + * - `function(expected, actual)`: + * The function will be given the object value and the predicate value to compare and + * should return true if the item should be included in filtered result. + * + * - `true`: A shorthand for `function(expected, actual) { return angular.equals(expected, actual)}`. + * this is essentially strict comparison of expected and actual. + * + * - `false|undefined`: A short hand for a function which will look for a substring match in case + * insensitive way. + * + * @example + + +
+ + Search: + + + + + + +
NamePhone
{{friend.name}}{{friend.phone}}
+
+ Any:
+ Name only
+ Phone only
+ Equality
+ + + + + + +
NamePhone
{{friend.name}}{{friend.phone}}
+
+ + it('should search across all fields when filtering with a string', function() { + input('searchText').enter('m'); + expect(repeater('#searchTextResults tr', 'friend in friends').column('friend.name')). + toEqual(['Mary', 'Mike', 'Adam']); + + input('searchText').enter('76'); + expect(repeater('#searchTextResults tr', 'friend in friends').column('friend.name')). + toEqual(['John', 'Julie']); + }); + + it('should search in specific fields when filtering with a predicate object', function() { + input('search.$').enter('i'); + expect(repeater('#searchObjResults tr', 'friend in friends').column('friend.name')). + toEqual(['Mary', 'Mike', 'Julie', 'Juliette']); + }); + it('should use a equal comparison when comparator is true', function() { + input('search.name').enter('Julie'); + input('strict').check(); + expect(repeater('#searchObjResults tr', 'friend in friends').column('friend.name')). + toEqual(['Julie']); + }); + +
+ */ +function filterFilter() { + return function(array, expression, comparator) { + if (!isArray(array)) return array; + + var comparatorType = typeof(comparator), + predicates = []; + + predicates.check = function(value) { + for (var j = 0; j < predicates.length; j++) { + if(!predicates[j](value)) { + return false; + } + } + return true; + }; + + if (comparatorType !== 'function') { + if (comparatorType === 'boolean' && comparator) { + comparator = function(obj, text) { + return angular.equals(obj, text); + }; + } else { + comparator = function(obj, text) { + text = (''+text).toLowerCase(); + return (''+obj).toLowerCase().indexOf(text) > -1; + }; + } + } + + var search = function(obj, text){ + if (typeof text == 'string' && text.charAt(0) === '!') { + return !search(obj, text.substr(1)); + } + switch (typeof obj) { + case "boolean": + case "number": + case "string": + return comparator(obj, text); + case "object": + switch (typeof text) { + case "object": + return comparator(obj, text); + default: + for ( var objKey in obj) { + if (objKey.charAt(0) !== '$' && search(obj[objKey], text)) { + return true; + } + } + break; + } + return false; + case "array": + for ( var i = 0; i < obj.length; i++) { + if (search(obj[i], text)) { + return true; + } + } + return false; + default: + return false; + } + }; + switch (typeof expression) { + case "boolean": + case "number": + case "string": + // Set up expression object and fall through + expression = {$:expression}; + // jshint -W086 + case "object": + // jshint +W086 + for (var key in expression) { + if (key == '$') { + (function() { + if (!expression[key]) return; + var path = key; + predicates.push(function(value) { + return search(value, expression[path]); + }); + })(); + } else { + (function() { + if (typeof(expression[key]) == 'undefined') { return; } + var path = key; + predicates.push(function(value) { + return search(getter(value,path), expression[path]); + }); + })(); + } + } + break; + case 'function': + predicates.push(expression); + break; + default: + return array; + } + var filtered = []; + for ( var j = 0; j < array.length; j++) { + var value = array[j]; + if (predicates.check(value)) { + filtered.push(value); + } + } + return filtered; + }; +} + +/** + * @ngdoc filter + * @name ng.filter:currency + * @function + * + * @description + * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default + * symbol for current locale is used. + * + * @param {number} amount Input to filter. + * @param {string=} symbol Currency symbol or identifier to be displayed. + * @returns {string} Formatted number. + * + * + * @example + + + +
+
+ default currency symbol ($): {{amount | currency}}
+ custom currency identifier (USD$): {{amount | currency:"USD$"}} +
+
+ + it('should init with 1234.56', function() { + expect(binding('amount | currency')).toBe('$1,234.56'); + expect(binding('amount | currency:"USD$"')).toBe('USD$1,234.56'); + }); + it('should update', function() { + input('amount').enter('-1234'); + expect(binding('amount | currency')).toBe('($1,234.00)'); + expect(binding('amount | currency:"USD$"')).toBe('(USD$1,234.00)'); + }); + +
+ */ +currencyFilter.$inject = ['$locale']; +function currencyFilter($locale) { + var formats = $locale.NUMBER_FORMATS; + return function(amount, currencySymbol){ + if (isUndefined(currencySymbol)) currencySymbol = formats.CURRENCY_SYM; + return formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, 2). + replace(/\u00A4/g, currencySymbol); + }; +} + +/** + * @ngdoc filter + * @name ng.filter:number + * @function + * + * @description + * Formats a number as text. + * + * If the input is not a number an empty string is returned. + * + * @param {number|string} number Number to format. + * @param {(number|string)=} fractionSize Number of decimal places to round the number to. + * If this is not provided then the fraction size is computed from the current locale's number + * formatting pattern. In the case of the default locale, it will be 3. + * @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit. + * + * @example + + + +
+ Enter number:
+ Default formatting: {{val | number}}
+ No fractions: {{val | number:0}}
+ Negative number: {{-val | number:4}} +
+
+ + it('should format numbers', function() { + expect(binding('val | number')).toBe('1,234.568'); + expect(binding('val | number:0')).toBe('1,235'); + expect(binding('-val | number:4')).toBe('-1,234.5679'); + }); + + it('should update', function() { + input('val').enter('3374.333'); + expect(binding('val | number')).toBe('3,374.333'); + expect(binding('val | number:0')).toBe('3,374'); + expect(binding('-val | number:4')).toBe('-3,374.3330'); + }); + +
+ */ + + +numberFilter.$inject = ['$locale']; +function numberFilter($locale) { + var formats = $locale.NUMBER_FORMATS; + return function(number, fractionSize) { + return formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP, + fractionSize); + }; +} + +var DECIMAL_SEP = '.'; +function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) { + if (isNaN(number) || !isFinite(number)) return ''; + + var isNegative = number < 0; + number = Math.abs(number); + var numStr = number + '', + formatedText = '', + parts = []; + + var hasExponent = false; + if (numStr.indexOf('e') !== -1) { + var match = numStr.match(/([\d\.]+)e(-?)(\d+)/); + if (match && match[2] == '-' && match[3] > fractionSize + 1) { + numStr = '0'; + } else { + formatedText = numStr; + hasExponent = true; + } + } + + if (!hasExponent) { + var fractionLen = (numStr.split(DECIMAL_SEP)[1] || '').length; + + // determine fractionSize if it is not specified + if (isUndefined(fractionSize)) { + fractionSize = Math.min(Math.max(pattern.minFrac, fractionLen), pattern.maxFrac); + } + + var pow = Math.pow(10, fractionSize); + number = Math.round(number * pow) / pow; + var fraction = ('' + number).split(DECIMAL_SEP); + var whole = fraction[0]; + fraction = fraction[1] || ''; + + var i, pos = 0, + lgroup = pattern.lgSize, + group = pattern.gSize; + + if (whole.length >= (lgroup + group)) { + pos = whole.length - lgroup; + for (i = 0; i < pos; i++) { + if ((pos - i)%group === 0 && i !== 0) { + formatedText += groupSep; + } + formatedText += whole.charAt(i); + } + } + + for (i = pos; i < whole.length; i++) { + if ((whole.length - i)%lgroup === 0 && i !== 0) { + formatedText += groupSep; + } + formatedText += whole.charAt(i); + } + + // format fraction part. + while(fraction.length < fractionSize) { + fraction += '0'; + } + + if (fractionSize && fractionSize !== "0") formatedText += decimalSep + fraction.substr(0, fractionSize); + } else { + + if (fractionSize > 0 && number > -1 && number < 1) { + formatedText = number.toFixed(fractionSize); + } + } + + parts.push(isNegative ? pattern.negPre : pattern.posPre); + parts.push(formatedText); + parts.push(isNegative ? pattern.negSuf : pattern.posSuf); + return parts.join(''); +} + +function padNumber(num, digits, trim) { + var neg = ''; + if (num < 0) { + neg = '-'; + num = -num; + } + num = '' + num; + while(num.length < digits) num = '0' + num; + if (trim) + num = num.substr(num.length - digits); + return neg + num; +} + + +function dateGetter(name, size, offset, trim) { + offset = offset || 0; + return function(date) { + var value = date['get' + name](); + if (offset > 0 || value > -offset) + value += offset; + if (value === 0 && offset == -12 ) value = 12; + return padNumber(value, size, trim); + }; +} + +function dateStrGetter(name, shortForm) { + return function(date, formats) { + var value = date['get' + name](); + var get = uppercase(shortForm ? ('SHORT' + name) : name); + + return formats[get][value]; + }; +} + +function timeZoneGetter(date) { + var zone = -1 * date.getTimezoneOffset(); + var paddedZone = (zone >= 0) ? "+" : ""; + + paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) + + padNumber(Math.abs(zone % 60), 2); + + return paddedZone; +} + +function ampmGetter(date, formats) { + return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1]; +} + +var DATE_FORMATS = { + yyyy: dateGetter('FullYear', 4), + yy: dateGetter('FullYear', 2, 0, true), + y: dateGetter('FullYear', 1), + MMMM: dateStrGetter('Month'), + MMM: dateStrGetter('Month', true), + MM: dateGetter('Month', 2, 1), + M: dateGetter('Month', 1, 1), + dd: dateGetter('Date', 2), + d: dateGetter('Date', 1), + HH: dateGetter('Hours', 2), + H: dateGetter('Hours', 1), + hh: dateGetter('Hours', 2, -12), + h: dateGetter('Hours', 1, -12), + mm: dateGetter('Minutes', 2), + m: dateGetter('Minutes', 1), + ss: dateGetter('Seconds', 2), + s: dateGetter('Seconds', 1), + // while ISO 8601 requires fractions to be prefixed with `.` or `,` + // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions + sss: dateGetter('Milliseconds', 3), + EEEE: dateStrGetter('Day'), + EEE: dateStrGetter('Day', true), + a: ampmGetter, + Z: timeZoneGetter +}; + +var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/, + NUMBER_STRING = /^\-?\d+$/; + +/** + * @ngdoc filter + * @name ng.filter:date + * @function + * + * @description + * Formats `date` to a string based on the requested `format`. + * + * `format` string can be composed of the following elements: + * + * * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010) + * * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10) + * * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199) + * * `'MMMM'`: Month in year (January-December) + * * `'MMM'`: Month in year (Jan-Dec) + * * `'MM'`: Month in year, padded (01-12) + * * `'M'`: Month in year (1-12) + * * `'dd'`: Day in month, padded (01-31) + * * `'d'`: Day in month (1-31) + * * `'EEEE'`: Day in Week,(Sunday-Saturday) + * * `'EEE'`: Day in Week, (Sun-Sat) + * * `'HH'`: Hour in day, padded (00-23) + * * `'H'`: Hour in day (0-23) + * * `'hh'`: Hour in am/pm, padded (01-12) + * * `'h'`: Hour in am/pm, (1-12) + * * `'mm'`: Minute in hour, padded (00-59) + * * `'m'`: Minute in hour (0-59) + * * `'ss'`: Second in minute, padded (00-59) + * * `'s'`: Second in minute (0-59) + * * `'.sss' or ',sss'`: Millisecond in second, padded (000-999) + * * `'a'`: am/pm marker + * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200) + * + * `format` string can also be one of the following predefined + * {@link guide/i18n localizable formats}: + * + * * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale + * (e.g. Sep 3, 2010 12:05:08 pm) + * * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 pm) + * * `'fullDate'`: equivalent to `'EEEE, MMMM d,y'` for en_US locale + * (e.g. Friday, September 3, 2010) + * * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010) + * * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010) + * * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10) + * * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 pm) + * * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 pm) + * + * `format` string can contain literal values. These need to be quoted with single quotes (e.g. + * `"h 'in the morning'"`). In order to output single quote, use two single quotes in a sequence + * (e.g. `"h 'o''clock'"`). + * + * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or + * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.SSSZ and its + * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is + * specified in the string input, the time is considered to be in the local timezone. + * @param {string=} format Formatting rules (see Description). If not specified, + * `mediumDate` is used. + * @returns {string} Formatted string or the input if input is not recognized as date/millis. + * + * @example + + + {{1288323623006 | date:'medium'}}: + {{1288323623006 | date:'medium'}}
+ {{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}: + {{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}
+ {{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}: + {{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}
+
+ + it('should format date', function() { + expect(binding("1288323623006 | date:'medium'")). + toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/); + expect(binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")). + toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/); + expect(binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")). + toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/); + }); + +
+ */ +dateFilter.$inject = ['$locale']; +function dateFilter($locale) { + + + var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; + // 1 2 3 4 5 6 7 8 9 10 11 + function jsonStringToDate(string) { + var match; + if (match = string.match(R_ISO8601_STR)) { + var date = new Date(0), + tzHour = 0, + tzMin = 0, + dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear, + timeSetter = match[8] ? date.setUTCHours : date.setHours; + + if (match[9]) { + tzHour = int(match[9] + match[10]); + tzMin = int(match[9] + match[11]); + } + dateSetter.call(date, int(match[1]), int(match[2]) - 1, int(match[3])); + var h = int(match[4]||0) - tzHour; + var m = int(match[5]||0) - tzMin; + var s = int(match[6]||0); + var ms = Math.round(parseFloat('0.' + (match[7]||0)) * 1000); + timeSetter.call(date, h, m, s, ms); + return date; + } + return string; + } + + + return function(date, format) { + var text = '', + parts = [], + fn, match; + + format = format || 'mediumDate'; + format = $locale.DATETIME_FORMATS[format] || format; + if (isString(date)) { + if (NUMBER_STRING.test(date)) { + date = int(date); + } else { + date = jsonStringToDate(date); + } + } + + if (isNumber(date)) { + date = new Date(date); + } + + if (!isDate(date)) { + return date; + } + + while(format) { + match = DATE_FORMATS_SPLIT.exec(format); + if (match) { + parts = concat(parts, match, 1); + format = parts.pop(); + } else { + parts.push(format); + format = null; + } + } + + forEach(parts, function(value){ + fn = DATE_FORMATS[value]; + text += fn ? fn(date, $locale.DATETIME_FORMATS) + : value.replace(/(^'|'$)/g, '').replace(/''/g, "'"); + }); + + return text; + }; +} + + +/** + * @ngdoc filter + * @name ng.filter:json + * @function + * + * @description + * Allows you to convert a JavaScript object into JSON string. + * + * This filter is mostly useful for debugging. When using the double curly {{value}} notation + * the binding is automatically converted to JSON. + * + * @param {*} object Any JavaScript object (including arrays and primitive types) to filter. + * @returns {string} JSON string. + * + * + * @example: + + +
{{ {'name':'value'} | json }}
+
+ + it('should jsonify filtered objects', function() { + expect(binding("{'name':'value'}")).toMatch(/\{\n "name": ?"value"\n}/); + }); + +
+ * + */ +function jsonFilter() { + return function(object) { + return toJson(object, true); + }; +} + + +/** + * @ngdoc filter + * @name ng.filter:lowercase + * @function + * @description + * Converts string to lowercase. + * @see angular.lowercase + */ +var lowercaseFilter = valueFn(lowercase); + + +/** + * @ngdoc filter + * @name ng.filter:uppercase + * @function + * @description + * Converts string to uppercase. + * @see angular.uppercase + */ +var uppercaseFilter = valueFn(uppercase); + +/** + * @ngdoc function + * @name ng.filter:limitTo + * @function + * + * @description + * Creates a new array or string containing only a specified number of elements. The elements + * are taken from either the beginning or the end of the source array or string, as specified by + * the value and sign (positive or negative) of `limit`. + * + * @param {Array|string} input Source array or string to be limited. + * @param {string|number} limit The length of the returned array or string. If the `limit` number + * is positive, `limit` number of items from the beginning of the source array/string are copied. + * If the number is negative, `limit` number of items from the end of the source array/string + * are copied. The `limit` will be trimmed if it exceeds `array.length` + * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array + * had less than `limit` elements. + * + * @example + + + +
+ Limit {{numbers}} to: +

Output numbers: {{ numbers | limitTo:numLimit }}

+ Limit {{letters}} to: +

Output letters: {{ letters | limitTo:letterLimit }}

+
+
+ + it('should limit the number array to first three items', function() { + expect(element('.doc-example-live input[ng-model=numLimit]').val()).toBe('3'); + expect(element('.doc-example-live input[ng-model=letterLimit]').val()).toBe('3'); + expect(binding('numbers | limitTo:numLimit')).toEqual('[1,2,3]'); + expect(binding('letters | limitTo:letterLimit')).toEqual('abc'); + }); + + it('should update the output when -3 is entered', function() { + input('numLimit').enter(-3); + input('letterLimit').enter(-3); + expect(binding('numbers | limitTo:numLimit')).toEqual('[7,8,9]'); + expect(binding('letters | limitTo:letterLimit')).toEqual('ghi'); + }); + + it('should not exceed the maximum size of input array', function() { + input('numLimit').enter(100); + input('letterLimit').enter(100); + expect(binding('numbers | limitTo:numLimit')).toEqual('[1,2,3,4,5,6,7,8,9]'); + expect(binding('letters | limitTo:letterLimit')).toEqual('abcdefghi'); + }); + +
+ */ +function limitToFilter(){ + return function(input, limit) { + if (!isArray(input) && !isString(input)) return input; + + limit = int(limit); + + if (isString(input)) { + //NaN check on limit + if (limit) { + return limit >= 0 ? input.slice(0, limit) : input.slice(limit, input.length); + } else { + return ""; + } + } + + var out = [], + i, n; + + // if abs(limit) exceeds maximum length, trim it + if (limit > input.length) + limit = input.length; + else if (limit < -input.length) + limit = -input.length; + + if (limit > 0) { + i = 0; + n = limit; + } else { + i = input.length + limit; + n = input.length; + } + + for (; i} expression A predicate to be + * used by the comparator to determine the order of elements. + * + * Can be one of: + * + * - `function`: Getter function. The result of this function will be sorted using the + * `<`, `=`, `>` operator. + * - `string`: An Angular expression which evaluates to an object to order by, such as 'name' + * to sort by a property called 'name'. Optionally prefixed with `+` or `-` to control + * ascending or descending sort order (for example, +name or -name). + * - `Array`: An array of function or string predicates. The first predicate in the array + * is used for sorting, but when two items are equivalent, the next predicate is used. + * + * @param {boolean=} reverse Reverse the order the array. + * @returns {Array} Sorted copy of the source array. + * + * @example + + + +
+
Sorting predicate = {{predicate}}; reverse = {{reverse}}
+
+ [ unsorted ] + + + + + + + + + + + +
Name + (^)Phone NumberAge
{{friend.name}}{{friend.phone}}{{friend.age}}
+
+
+ + it('should be reverse ordered by aged', function() { + expect(binding('predicate')).toBe('-age'); + expect(repeater('table.friend', 'friend in friends').column('friend.age')). + toEqual(['35', '29', '21', '19', '10']); + expect(repeater('table.friend', 'friend in friends').column('friend.name')). + toEqual(['Adam', 'Julie', 'Mike', 'Mary', 'John']); + }); + + it('should reorder the table when user selects different predicate', function() { + element('.doc-example-live a:contains("Name")').click(); + expect(repeater('table.friend', 'friend in friends').column('friend.name')). + toEqual(['Adam', 'John', 'Julie', 'Mary', 'Mike']); + expect(repeater('table.friend', 'friend in friends').column('friend.age')). + toEqual(['35', '10', '29', '19', '21']); + + element('.doc-example-live a:contains("Phone")').click(); + expect(repeater('table.friend', 'friend in friends').column('friend.phone')). + toEqual(['555-9876', '555-8765', '555-5678', '555-4321', '555-1212']); + expect(repeater('table.friend', 'friend in friends').column('friend.name')). + toEqual(['Mary', 'Julie', 'Adam', 'Mike', 'John']); + }); + +
+ */ +orderByFilter.$inject = ['$parse']; +function orderByFilter($parse){ + return function(array, sortPredicate, reverseOrder) { + if (!isArray(array)) return array; + if (!sortPredicate) return array; + sortPredicate = isArray(sortPredicate) ? sortPredicate: [sortPredicate]; + sortPredicate = map(sortPredicate, function(predicate){ + var descending = false, get = predicate || identity; + if (isString(predicate)) { + if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) { + descending = predicate.charAt(0) == '-'; + predicate = predicate.substring(1); + } + get = $parse(predicate); + } + return reverseComparator(function(a,b){ + return compare(get(a),get(b)); + }, descending); + }); + var arrayCopy = []; + for ( var i = 0; i < array.length; i++) { arrayCopy.push(array[i]); } + return arrayCopy.sort(reverseComparator(comparator, reverseOrder)); + + function comparator(o1, o2){ + for ( var i = 0; i < sortPredicate.length; i++) { + var comp = sortPredicate[i](o1, o2); + if (comp !== 0) return comp; + } + return 0; + } + function reverseComparator(comp, descending) { + return toBoolean(descending) + ? function(a,b){return comp(b,a);} + : comp; + } + function compare(v1, v2){ + var t1 = typeof v1; + var t2 = typeof v2; + if (t1 == t2) { + if (t1 == "string") { + v1 = v1.toLowerCase(); + v2 = v2.toLowerCase(); + } + if (v1 === v2) return 0; + return v1 < v2 ? -1 : 1; + } else { + return t1 < t2 ? -1 : 1; + } + } + }; +} + +function ngDirective(directive) { + if (isFunction(directive)) { + directive = { + link: directive + }; + } + directive.restrict = directive.restrict || 'AC'; + return valueFn(directive); +} + +/** + * @ngdoc directive + * @name ng.directive:a + * @restrict E + * + * @description + * Modifies the default behavior of the html A tag so that the default action is prevented when + * the href attribute is empty. + * + * This change permits the easy creation of action links with the `ngClick` directive + * without changing the location or causing page reloads, e.g.: + * `Add Item` + */ +var htmlAnchorDirective = valueFn({ + restrict: 'E', + compile: function(element, attr) { + + if (msie <= 8) { + + // turn link into a stylable link in IE + // but only if it doesn't have name attribute, in which case it's an anchor + if (!attr.href && !attr.name) { + attr.$set('href', ''); + } + + // add a comment node to anchors to workaround IE bug that causes element content to be reset + // to new attribute content if attribute is updated with value containing @ and element also + // contains value with @ + // see issue #1949 + element.append(document.createComment('IE fix')); + } + + return function(scope, element) { + element.on('click', function(event){ + // if we have no href url, then don't navigate anywhere. + if (!element.attr('href')) { + event.preventDefault(); + } + }); + }; + } +}); + +/** + * @ngdoc directive + * @name ng.directive:ngHref + * @restrict A + * + * @description + * Using Angular markup like `{{hash}}` in an href attribute will + * make the link go to the wrong URL if the user clicks it before + * Angular has a chance to replace the `{{hash}}` markup with its + * value. Until Angular replaces the markup the link will be broken + * and will most likely return a 404 error. + * + * The `ngHref` directive solves this problem. + * + * The wrong way to write it: + *
+ * 
+ * 
+ * + * The correct way to write it: + *
+ * 
+ * 
+ * + * @element A + * @param {template} ngHref any string which can contain `{{}}` markup. + * + * @example + * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes + * in links and their different behaviors: + + +
+
link 1 (link, don't reload)
+ link 2 (link, don't reload)
+ link 3 (link, reload!)
+ anchor (link, don't reload)
+ anchor (no link)
+ link (link, change location) + + + it('should execute ng-click but not reload when href without value', function() { + element('#link-1').click(); + expect(input('value').val()).toEqual('1'); + expect(element('#link-1').attr('href')).toBe(""); + }); + + it('should execute ng-click but not reload when href empty string', function() { + element('#link-2').click(); + expect(input('value').val()).toEqual('2'); + expect(element('#link-2').attr('href')).toBe(""); + }); + + it('should execute ng-click and change url when ng-href specified', function() { + expect(element('#link-3').attr('href')).toBe("/123"); + + element('#link-3').click(); + expect(browser().window().path()).toEqual('/123'); + }); + + it('should execute ng-click but not reload when href empty string and name specified', function() { + element('#link-4').click(); + expect(input('value').val()).toEqual('4'); + expect(element('#link-4').attr('href')).toBe(''); + }); + + it('should execute ng-click but not reload when no href but name specified', function() { + element('#link-5').click(); + expect(input('value').val()).toEqual('5'); + expect(element('#link-5').attr('href')).toBe(undefined); + }); + + it('should only change url when only ng-href', function() { + input('value').enter('6'); + expect(element('#link-6').attr('href')).toBe('6'); + + element('#link-6').click(); + expect(browser().location().url()).toEqual('/6'); + }); + + + */ + +/** + * @ngdoc directive + * @name ng.directive:ngSrc + * @restrict A + * + * @description + * Using Angular markup like `{{hash}}` in a `src` attribute doesn't + * work right: The browser will fetch from the URL with the literal + * text `{{hash}}` until Angular replaces the expression inside + * `{{hash}}`. The `ngSrc` directive solves this problem. + * + * The buggy way to write it: + *
+ * 
+ * 
+ * + * The correct way to write it: + *
+ * 
+ * 
+ * + * @element IMG + * @param {template} ngSrc any string which can contain `{{}}` markup. + */ + +/** + * @ngdoc directive + * @name ng.directive:ngSrcset + * @restrict A + * + * @description + * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't + * work right: The browser will fetch from the URL with the literal + * text `{{hash}}` until Angular replaces the expression inside + * `{{hash}}`. The `ngSrcset` directive solves this problem. + * + * The buggy way to write it: + *
+ * 
+ * 
+ * + * The correct way to write it: + *
+ * 
+ * 
+ * + * @element IMG + * @param {template} ngSrcset any string which can contain `{{}}` markup. + */ + +/** + * @ngdoc directive + * @name ng.directive:ngDisabled + * @restrict A + * + * @description + * + * The following markup will make the button enabled on Chrome/Firefox but not on IE8 and older IEs: + *
+ * 
+ * + *
+ *
+ * + * The HTML specification does not require browsers to preserve the values of boolean attributes + * such as disabled. (Their presence means true and their absence means false.) + * This prevents the Angular compiler from retrieving the binding expression. + * The `ngDisabled` directive solves this problem for the `disabled` attribute. + * + * @example + + + Click me to toggle:
+ +
+ + it('should toggle button', function() { + expect(element('.doc-example-live :button').prop('disabled')).toBeFalsy(); + input('checked').check(); + expect(element('.doc-example-live :button').prop('disabled')).toBeTruthy(); + }); + +
+ * + * @element INPUT + * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy, + * then special attribute "disabled" will be set on the element + */ + + +/** + * @ngdoc directive + * @name ng.directive:ngChecked + * @restrict A + * + * @description + * The HTML specification does not require browsers to preserve the values of boolean attributes + * such as checked. (Their presence means true and their absence means false.) + * This prevents the Angular compiler from retrieving the binding expression. + * The `ngChecked` directive solves this problem for the `checked` attribute. + * @example + + + Check me to check both:
+ +
+ + it('should check both checkBoxes', function() { + expect(element('.doc-example-live #checkSlave').prop('checked')).toBeFalsy(); + input('master').check(); + expect(element('.doc-example-live #checkSlave').prop('checked')).toBeTruthy(); + }); + +
+ * + * @element INPUT + * @param {expression} ngChecked If the {@link guide/expression expression} is truthy, + * then special attribute "checked" will be set on the element + */ + + +/** + * @ngdoc directive + * @name ng.directive:ngReadonly + * @restrict A + * + * @description + * The HTML specification does not require browsers to preserve the values of boolean attributes + * such as readonly. (Their presence means true and their absence means false.) + * This prevents the Angular compiler from retrieving the binding expression. + * The `ngReadonly` directive solves this problem for the `readonly` attribute. + * @example + + + Check me to make text readonly:
+ +
+ + it('should toggle readonly attr', function() { + expect(element('.doc-example-live :text').prop('readonly')).toBeFalsy(); + input('checked').check(); + expect(element('.doc-example-live :text').prop('readonly')).toBeTruthy(); + }); + +
+ * + * @element INPUT + * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy, + * then special attribute "readonly" will be set on the element + */ + + +/** + * @ngdoc directive + * @name ng.directive:ngSelected + * @restrict A + * + * @description + * The HTML specification does not require browsers to preserve the values of boolean attributes + * such as selected. (Their presence means true and their absence means false.) + * This prevents the Angular compiler from retrieving the binding expression. + * The `ngSelected` directive solves this problem for the `selected` atttribute. + * @example + + + Check me to select:
+ +
+ + it('should select Greetings!', function() { + expect(element('.doc-example-live #greet').prop('selected')).toBeFalsy(); + input('selected').check(); + expect(element('.doc-example-live #greet').prop('selected')).toBeTruthy(); + }); + +
+ * + * @element OPTION + * @param {expression} ngSelected If the {@link guide/expression expression} is truthy, + * then special attribute "selected" will be set on the element + */ + +/** + * @ngdoc directive + * @name ng.directive:ngOpen + * @restrict A + * + * @description + * The HTML specification does not require browsers to preserve the values of boolean attributes + * such as open. (Their presence means true and their absence means false.) + * This prevents the Angular compiler from retrieving the binding expression. + * The `ngOpen` directive solves this problem for the `open` attribute. + * + * @example + + + Check me check multiple:
+
+ Show/Hide me +
+
+ + it('should toggle open', function() { + expect(element('#details').prop('open')).toBeFalsy(); + input('open').check(); + expect(element('#details').prop('open')).toBeTruthy(); + }); + +
+ * + * @element DETAILS + * @param {expression} ngOpen If the {@link guide/expression expression} is truthy, + * then special attribute "open" will be set on the element + */ + +var ngAttributeAliasDirectives = {}; + + +// boolean attrs are evaluated +forEach(BOOLEAN_ATTR, function(propName, attrName) { + // binding to multiple is not supported + if (propName == "multiple") return; + + var normalized = directiveNormalize('ng-' + attrName); + ngAttributeAliasDirectives[normalized] = function() { + return { + priority: 100, + compile: function() { + return function(scope, element, attr) { + scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) { + attr.$set(attrName, !!value); + }); + }; + } + }; + }; +}); + + +// ng-src, ng-srcset, ng-href are interpolated +forEach(['src', 'srcset', 'href'], function(attrName) { + var normalized = directiveNormalize('ng-' + attrName); + ngAttributeAliasDirectives[normalized] = function() { + return { + priority: 99, // it needs to run after the attributes are interpolated + link: function(scope, element, attr) { + attr.$observe(normalized, function(value) { + if (!value) + return; + + attr.$set(attrName, value); + + // on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist + // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need + // to set the property as well to achieve the desired effect. + // we use attr[attrName] value since $set can sanitize the url. + if (msie) element.prop(attrName, attr[attrName]); + }); + } + }; + }; +}); + +/* global -nullFormCtrl */ +var nullFormCtrl = { + $addControl: noop, + $removeControl: noop, + $setValidity: noop, + $setDirty: noop, + $setPristine: noop +}; + +/** + * @ngdoc object + * @name ng.directive:form.FormController + * + * @property {boolean} $pristine True if user has not interacted with the form yet. + * @property {boolean} $dirty True if user has already interacted with the form. + * @property {boolean} $valid True if all of the containing forms and controls are valid. + * @property {boolean} $invalid True if at least one containing control or form is invalid. + * + * @property {Object} $error Is an object hash, containing references to all invalid controls or + * forms, where: + * + * - keys are validation tokens (error names) — such as `required`, `url` or `email`), + * - values are arrays of controls or forms that are invalid with given error. + * + * @description + * `FormController` keeps track of all its controls and nested forms as well as state of them, + * such as being valid/invalid or dirty/pristine. + * + * Each {@link ng.directive:form form} directive creates an instance + * of `FormController`. + * + */ +//asks for $scope to fool the BC controller module +FormController.$inject = ['$element', '$attrs', '$scope']; +function FormController(element, attrs) { + var form = this, + parentForm = element.parent().controller('form') || nullFormCtrl, + invalidCount = 0, // used to easily determine if we are valid + errors = form.$error = {}, + controls = []; + + // init state + form.$name = attrs.name || attrs.ngForm; + form.$dirty = false; + form.$pristine = true; + form.$valid = true; + form.$invalid = false; + + parentForm.$addControl(form); + + // Setup initial state of the control + element.addClass(PRISTINE_CLASS); + toggleValidCss(true); + + // convenience method for easy toggling of classes + function toggleValidCss(isValid, validationErrorKey) { + validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : ''; + element. + removeClass((isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey). + addClass((isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey); + } + + /** + * @ngdoc function + * @name ng.directive:form.FormController#$addControl + * @methodOf ng.directive:form.FormController + * + * @description + * Register a control with the form. + * + * Input elements using ngModelController do this automatically when they are linked. + */ + form.$addControl = function(control) { + // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored + // and not added to the scope. Now we throw an error. + assertNotHasOwnProperty(control.$name, 'input'); + controls.push(control); + + if (control.$name) { + form[control.$name] = control; + } + }; + + /** + * @ngdoc function + * @name ng.directive:form.FormController#$removeControl + * @methodOf ng.directive:form.FormController + * + * @description + * Deregister a control from the form. + * + * Input elements using ngModelController do this automatically when they are destroyed. + */ + form.$removeControl = function(control) { + if (control.$name && form[control.$name] === control) { + delete form[control.$name]; + } + forEach(errors, function(queue, validationToken) { + form.$setValidity(validationToken, true, control); + }); + + arrayRemove(controls, control); + }; + + /** + * @ngdoc function + * @name ng.directive:form.FormController#$setValidity + * @methodOf ng.directive:form.FormController + * + * @description + * Sets the validity of a form control. + * + * This method will also propagate to parent forms. + */ + form.$setValidity = function(validationToken, isValid, control) { + var queue = errors[validationToken]; + + if (isValid) { + if (queue) { + arrayRemove(queue, control); + if (!queue.length) { + invalidCount--; + if (!invalidCount) { + toggleValidCss(isValid); + form.$valid = true; + form.$invalid = false; + } + errors[validationToken] = false; + toggleValidCss(true, validationToken); + parentForm.$setValidity(validationToken, true, form); + } + } + + } else { + if (!invalidCount) { + toggleValidCss(isValid); + } + if (queue) { + if (includes(queue, control)) return; + } else { + errors[validationToken] = queue = []; + invalidCount++; + toggleValidCss(false, validationToken); + parentForm.$setValidity(validationToken, false, form); + } + queue.push(control); + + form.$valid = false; + form.$invalid = true; + } + }; + + /** + * @ngdoc function + * @name ng.directive:form.FormController#$setDirty + * @methodOf ng.directive:form.FormController + * + * @description + * Sets the form to a dirty state. + * + * This method can be called to add the 'ng-dirty' class and set the form to a dirty + * state (ng-dirty class). This method will also propagate to parent forms. + */ + form.$setDirty = function() { + element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS); + form.$dirty = true; + form.$pristine = false; + parentForm.$setDirty(); + }; + + /** + * @ngdoc function + * @name ng.directive:form.FormController#$setPristine + * @methodOf ng.directive:form.FormController + * + * @description + * Sets the form to its pristine state. + * + * This method can be called to remove the 'ng-dirty' class and set the form to its pristine + * state (ng-pristine class). This method will also propagate to all the controls contained + * in this form. + * + * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after + * saving or resetting it. + */ + form.$setPristine = function () { + element.removeClass(DIRTY_CLASS).addClass(PRISTINE_CLASS); + form.$dirty = false; + form.$pristine = true; + forEach(controls, function(control) { + control.$setPristine(); + }); + }; +} + + +/** + * @ngdoc directive + * @name ng.directive:ngForm + * @restrict EAC + * + * @description + * Nestable alias of {@link ng.directive:form `form`} directive. HTML + * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a + * sub-group of controls needs to be determined. + * + * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into + * related scope, under this name. + * + */ + + /** + * @ngdoc directive + * @name ng.directive:form + * @restrict E + * + * @description + * Directive that instantiates + * {@link ng.directive:form.FormController FormController}. + * + * If the `name` attribute is specified, the form controller is published onto the current scope under + * this name. + * + * # Alias: {@link ng.directive:ngForm `ngForm`} + * + * In Angular forms can be nested. This means that the outer form is valid when all of the child + * forms are valid as well. However, browsers do not allow nesting of `
` elements, so + * Angular provides the {@link ng.directive:ngForm `ngForm`} directive which behaves identically to + * `` but can be nested. This allows you to have nested forms, which is very useful when + * using Angular validation directives in forms that are dynamically generated using the + * {@link ng.directive:ngRepeat `ngRepeat`} directive. Since you cannot dynamically generate the `name` + * attribute of input elements using interpolation, you have to wrap each set of repeated inputs in an + * `ngForm` directive and nest these in an outer `form` element. + * + * + * # CSS classes + * - `ng-valid` Is set if the form is valid. + * - `ng-invalid` Is set if the form is invalid. + * - `ng-pristine` Is set if the form is pristine. + * - `ng-dirty` Is set if the form is dirty. + * + * + * # Submitting a form and preventing the default action + * + * Since the role of forms in client-side Angular applications is different than in classical + * roundtrip apps, it is desirable for the browser not to translate the form submission into a full + * page reload that sends the data to the server. Instead some javascript logic should be triggered + * to handle the form submission in an application-specific way. + * + * For this reason, Angular prevents the default action (form submission to the server) unless the + * `` element has an `action` attribute specified. + * + * You can use one of the following two ways to specify what javascript method should be called when + * a form is submitted: + * + * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element + * - {@link ng.directive:ngClick ngClick} directive on the first + * button or input field of type submit (input[type=submit]) + * + * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit} + * or {@link ng.directive:ngClick ngClick} directives. + * This is because of the following form submission rules in the HTML specification: + * + * - If a form has only one input field then hitting enter in this field triggers form submit + * (`ngSubmit`) + * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter + * doesn't trigger submit + * - if a form has one or more input fields and one or more buttons or input[type=submit] then + * hitting enter in any of the input fields will trigger the click handler on the *first* button or + * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`) + * + * @param {string=} name Name of the form. If specified, the form controller will be published into + * related scope, under this name. + * + * @example + + + + + userType: + Required!
+ userType = {{userType}}
+ myForm.input.$valid = {{myForm.input.$valid}}
+ myForm.input.$error = {{myForm.input.$error}}
+ myForm.$valid = {{myForm.$valid}}
+ myForm.$error.required = {{!!myForm.$error.required}}
+ +
+ + it('should initialize to model', function() { + expect(binding('userType')).toEqual('guest'); + expect(binding('myForm.input.$valid')).toEqual('true'); + }); + + it('should be invalid if empty', function() { + input('userType').enter(''); + expect(binding('userType')).toEqual(''); + expect(binding('myForm.input.$valid')).toEqual('false'); + }); + +
+ */ +var formDirectiveFactory = function(isNgForm) { + return ['$timeout', function($timeout) { + var formDirective = { + name: 'form', + restrict: isNgForm ? 'EAC' : 'E', + controller: FormController, + compile: function() { + return { + pre: function(scope, formElement, attr, controller) { + if (!attr.action) { + // we can't use jq events because if a form is destroyed during submission the default + // action is not prevented. see #1238 + // + // IE 9 is not affected because it doesn't fire a submit event and try to do a full + // page reload if the form was destroyed by submission of the form via a click handler + // on a button in the form. Looks like an IE9 specific bug. + var preventDefaultListener = function(event) { + event.preventDefault + ? event.preventDefault() + : event.returnValue = false; // IE + }; + + addEventListenerFn(formElement[0], 'submit', preventDefaultListener); + + // unregister the preventDefault listener so that we don't not leak memory but in a + // way that will achieve the prevention of the default action. + formElement.on('$destroy', function() { + $timeout(function() { + removeEventListenerFn(formElement[0], 'submit', preventDefaultListener); + }, 0, false); + }); + } + + var parentFormCtrl = formElement.parent().controller('form'), + alias = attr.name || attr.ngForm; + + if (alias) { + setter(scope, alias, controller, alias); + } + if (parentFormCtrl) { + formElement.on('$destroy', function() { + parentFormCtrl.$removeControl(controller); + if (alias) { + setter(scope, alias, undefined, alias); + } + extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards + }); + } + } + }; + } + }; + + return formDirective; + }]; +}; + +var formDirective = formDirectiveFactory(); +var ngFormDirective = formDirectiveFactory(true); + +/* global + + -VALID_CLASS, + -INVALID_CLASS, + -PRISTINE_CLASS, + -DIRTY_CLASS +*/ + +var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/; +var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/; +var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/; + +var inputType = { + + /** + * @ngdoc inputType + * @name ng.directive:input.text + * + * @description + * Standard HTML text input with angular data binding. + * + * @param {string} ngModel Assignable angular expression to data-bind to. + * @param {string=} name Property name of the form under which the control is published. + * @param {string=} required Adds `required` validation error key if the value is not entered. + * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to + * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of + * `required` when you want to data-bind to the `required` attribute. + * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than + * minlength. + * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than + * maxlength. + * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the + * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for + * patterns defined as scope expressions. + * @param {string=} ngChange Angular expression to be executed when input changes due to user + * interaction with the input element. + * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input. + * + * @example + + + +
+ Single word: + + Required! + + Single word only! + + text = {{text}}
+ myForm.input.$valid = {{myForm.input.$valid}}
+ myForm.input.$error = {{myForm.input.$error}}
+ myForm.$valid = {{myForm.$valid}}
+ myForm.$error.required = {{!!myForm.$error.required}}
+
+
+ + it('should initialize to model', function() { + expect(binding('text')).toEqual('guest'); + expect(binding('myForm.input.$valid')).toEqual('true'); + }); + + it('should be invalid if empty', function() { + input('text').enter(''); + expect(binding('text')).toEqual(''); + expect(binding('myForm.input.$valid')).toEqual('false'); + }); + + it('should be invalid if multi word', function() { + input('text').enter('hello world'); + expect(binding('myForm.input.$valid')).toEqual('false'); + }); + + it('should not be trimmed', function() { + input('text').enter('untrimmed '); + expect(binding('text')).toEqual('untrimmed '); + expect(binding('myForm.input.$valid')).toEqual('true'); + }); + +
+ */ + 'text': textInputType, + + + /** + * @ngdoc inputType + * @name ng.directive:input.number + * + * @description + * Text input with number validation and transformation. Sets the `number` validation + * error if not a valid number. + * + * @param {string} ngModel Assignable angular expression to data-bind to. + * @param {string=} name Property name of the form under which the control is published. + * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. + * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. + * @param {string=} required Sets `required` validation error key if the value is not entered. + * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to + * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of + * `required` when you want to data-bind to the `required` attribute. + * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than + * minlength. + * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than + * maxlength. + * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the + * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for + * patterns defined as scope expressions. + * @param {string=} ngChange Angular expression to be executed when input changes due to user + * interaction with the input element. + * + * @example + + + +
+ Number: + + Required! + + Not valid number! + value = {{value}}
+ myForm.input.$valid = {{myForm.input.$valid}}
+ myForm.input.$error = {{myForm.input.$error}}
+ myForm.$valid = {{myForm.$valid}}
+ myForm.$error.required = {{!!myForm.$error.required}}
+
+
+ + it('should initialize to model', function() { + expect(binding('value')).toEqual('12'); + expect(binding('myForm.input.$valid')).toEqual('true'); + }); + + it('should be invalid if empty', function() { + input('value').enter(''); + expect(binding('value')).toEqual(''); + expect(binding('myForm.input.$valid')).toEqual('false'); + }); + + it('should be invalid if over max', function() { + input('value').enter('123'); + expect(binding('value')).toEqual(''); + expect(binding('myForm.input.$valid')).toEqual('false'); + }); + +
+ */ + 'number': numberInputType, + + + /** + * @ngdoc inputType + * @name ng.directive:input.url + * + * @description + * Text input with URL validation. Sets the `url` validation error key if the content is not a + * valid URL. + * + * @param {string} ngModel Assignable angular expression to data-bind to. + * @param {string=} name Property name of the form under which the control is published. + * @param {string=} required Sets `required` validation error key if the value is not entered. + * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to + * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of + * `required` when you want to data-bind to the `required` attribute. + * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than + * minlength. + * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than + * maxlength. + * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the + * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for + * patterns defined as scope expressions. + * @param {string=} ngChange Angular expression to be executed when input changes due to user + * interaction with the input element. + * + * @example + + + +
+ URL: + + Required! + + Not valid url! + text = {{text}}
+ myForm.input.$valid = {{myForm.input.$valid}}
+ myForm.input.$error = {{myForm.input.$error}}
+ myForm.$valid = {{myForm.$valid}}
+ myForm.$error.required = {{!!myForm.$error.required}}
+ myForm.$error.url = {{!!myForm.$error.url}}
+
+
+ + it('should initialize to model', function() { + expect(binding('text')).toEqual('http://google.com'); + expect(binding('myForm.input.$valid')).toEqual('true'); + }); + + it('should be invalid if empty', function() { + input('text').enter(''); + expect(binding('text')).toEqual(''); + expect(binding('myForm.input.$valid')).toEqual('false'); + }); + + it('should be invalid if not url', function() { + input('text').enter('xxx'); + expect(binding('myForm.input.$valid')).toEqual('false'); + }); + +
+ */ + 'url': urlInputType, + + + /** + * @ngdoc inputType + * @name ng.directive:input.email + * + * @description + * Text input with email validation. Sets the `email` validation error key if not a valid email + * address. + * + * @param {string} ngModel Assignable angular expression to data-bind to. + * @param {string=} name Property name of the form under which the control is published. + * @param {string=} required Sets `required` validation error key if the value is not entered. + * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to + * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of + * `required` when you want to data-bind to the `required` attribute. + * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than + * minlength. + * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than + * maxlength. + * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the + * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for + * patterns defined as scope expressions. + * @param {string=} ngChange Angular expression to be executed when input changes due to user + * interaction with the input element. + * + * @example + + + +
+ Email: + + Required! + + Not valid email! + text = {{text}}
+ myForm.input.$valid = {{myForm.input.$valid}}
+ myForm.input.$error = {{myForm.input.$error}}
+ myForm.$valid = {{myForm.$valid}}
+ myForm.$error.required = {{!!myForm.$error.required}}
+ myForm.$error.email = {{!!myForm.$error.email}}
+
+
+ + it('should initialize to model', function() { + expect(binding('text')).toEqual('me@example.com'); + expect(binding('myForm.input.$valid')).toEqual('true'); + }); + + it('should be invalid if empty', function() { + input('text').enter(''); + expect(binding('text')).toEqual(''); + expect(binding('myForm.input.$valid')).toEqual('false'); + }); + + it('should be invalid if not email', function() { + input('text').enter('xxx'); + expect(binding('myForm.input.$valid')).toEqual('false'); + }); + +
+ */ + 'email': emailInputType, + + + /** + * @ngdoc inputType + * @name ng.directive:input.radio + * + * @description + * HTML radio button. + * + * @param {string} ngModel Assignable angular expression to data-bind to. + * @param {string} value The value to which the expression should be set when selected. + * @param {string=} name Property name of the form under which the control is published. + * @param {string=} ngChange Angular expression to be executed when input changes due to user + * interaction with the input element. + * + * @example + + + +
+ Red
+ Green
+ Blue
+ color = {{color}}
+
+
+ + it('should change state', function() { + expect(binding('color')).toEqual('blue'); + + input('color').select('red'); + expect(binding('color')).toEqual('red'); + }); + +
+ */ + 'radio': radioInputType, + + + /** + * @ngdoc inputType + * @name ng.directive:input.checkbox + * + * @description + * HTML checkbox. + * + * @param {string} ngModel Assignable angular expression to data-bind to. + * @param {string=} name Property name of the form under which the control is published. + * @param {string=} ngTrueValue The value to which the expression should be set when selected. + * @param {string=} ngFalseValue The value to which the expression should be set when not selected. + * @param {string=} ngChange Angular expression to be executed when input changes due to user + * interaction with the input element. + * + * @example + + + +
+ Value1:
+ Value2:
+ value1 = {{value1}}
+ value2 = {{value2}}
+
+
+ + it('should change state', function() { + expect(binding('value1')).toEqual('true'); + expect(binding('value2')).toEqual('YES'); + + input('value1').check(); + input('value2').check(); + expect(binding('value1')).toEqual('false'); + expect(binding('value2')).toEqual('NO'); + }); + +
+ */ + 'checkbox': checkboxInputType, + + 'hidden': noop, + 'button': noop, + 'submit': noop, + 'reset': noop +}; + + +function textInputType(scope, element, attr, ctrl, $sniffer, $browser) { + + var listener = function() { + var value = element.val(); + + // By default we will trim the value + // If the attribute ng-trim exists we will avoid trimming + // e.g. + if (toBoolean(attr.ngTrim || 'T')) { + value = trim(value); + } + + if (ctrl.$viewValue !== value) { + scope.$apply(function() { + ctrl.$setViewValue(value); + }); + } + }; + + // if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the + // input event on backspace, delete or cut + if ($sniffer.hasEvent('input')) { + element.on('input', listener); + } else { + var timeout; + + var deferListener = function() { + if (!timeout) { + timeout = $browser.defer(function() { + listener(); + timeout = null; + }); + } + }; + + element.on('keydown', function(event) { + var key = event.keyCode; + + // ignore + // command modifiers arrows + if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return; + + deferListener(); + }); + + // if user paste into input using mouse, we need "change" event to catch it + element.on('change', listener); + + // if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it + if ($sniffer.hasEvent('paste')) { + element.on('paste cut', deferListener); + } + } + + + ctrl.$render = function() { + element.val(ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue); + }; + + // pattern validator + var pattern = attr.ngPattern, + patternValidator, + match; + + var validate = function(regexp, value) { + if (ctrl.$isEmpty(value) || regexp.test(value)) { + ctrl.$setValidity('pattern', true); + return value; + } else { + ctrl.$setValidity('pattern', false); + return undefined; + } + }; + + if (pattern) { + match = pattern.match(/^\/(.*)\/([gim]*)$/); + if (match) { + pattern = new RegExp(match[1], match[2]); + patternValidator = function(value) { + return validate(pattern, value); + }; + } else { + patternValidator = function(value) { + var patternObj = scope.$eval(pattern); + + if (!patternObj || !patternObj.test) { + throw minErr('ngPattern')('noregexp', + 'Expected {0} to be a RegExp but was {1}. Element: {2}', pattern, + patternObj, startingTag(element)); + } + return validate(patternObj, value); + }; + } + + ctrl.$formatters.push(patternValidator); + ctrl.$parsers.push(patternValidator); + } + + // min length validator + if (attr.ngMinlength) { + var minlength = int(attr.ngMinlength); + var minLengthValidator = function(value) { + if (!ctrl.$isEmpty(value) && value.length < minlength) { + ctrl.$setValidity('minlength', false); + return undefined; + } else { + ctrl.$setValidity('minlength', true); + return value; + } + }; + + ctrl.$parsers.push(minLengthValidator); + ctrl.$formatters.push(minLengthValidator); + } + + // max length validator + if (attr.ngMaxlength) { + var maxlength = int(attr.ngMaxlength); + var maxLengthValidator = function(value) { + if (!ctrl.$isEmpty(value) && value.length > maxlength) { + ctrl.$setValidity('maxlength', false); + return undefined; + } else { + ctrl.$setValidity('maxlength', true); + return value; + } + }; + + ctrl.$parsers.push(maxLengthValidator); + ctrl.$formatters.push(maxLengthValidator); + } +} + +function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) { + textInputType(scope, element, attr, ctrl, $sniffer, $browser); + + ctrl.$parsers.push(function(value) { + var empty = ctrl.$isEmpty(value); + if (empty || NUMBER_REGEXP.test(value)) { + ctrl.$setValidity('number', true); + return value === '' ? null : (empty ? value : parseFloat(value)); + } else { + ctrl.$setValidity('number', false); + return undefined; + } + }); + + ctrl.$formatters.push(function(value) { + return ctrl.$isEmpty(value) ? '' : '' + value; + }); + + if (attr.min) { + var minValidator = function(value) { + var min = parseFloat(attr.min); + if (!ctrl.$isEmpty(value) && value < min) { + ctrl.$setValidity('min', false); + return undefined; + } else { + ctrl.$setValidity('min', true); + return value; + } + }; + + ctrl.$parsers.push(minValidator); + ctrl.$formatters.push(minValidator); + } + + if (attr.max) { + var maxValidator = function(value) { + var max = parseFloat(attr.max); + if (!ctrl.$isEmpty(value) && value > max) { + ctrl.$setValidity('max', false); + return undefined; + } else { + ctrl.$setValidity('max', true); + return value; + } + }; + + ctrl.$parsers.push(maxValidator); + ctrl.$formatters.push(maxValidator); + } + + ctrl.$formatters.push(function(value) { + + if (ctrl.$isEmpty(value) || isNumber(value)) { + ctrl.$setValidity('number', true); + return value; + } else { + ctrl.$setValidity('number', false); + return undefined; + } + }); +} + +function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) { + textInputType(scope, element, attr, ctrl, $sniffer, $browser); + + var urlValidator = function(value) { + if (ctrl.$isEmpty(value) || URL_REGEXP.test(value)) { + ctrl.$setValidity('url', true); + return value; + } else { + ctrl.$setValidity('url', false); + return undefined; + } + }; + + ctrl.$formatters.push(urlValidator); + ctrl.$parsers.push(urlValidator); +} + +function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) { + textInputType(scope, element, attr, ctrl, $sniffer, $browser); + + var emailValidator = function(value) { + if (ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value)) { + ctrl.$setValidity('email', true); + return value; + } else { + ctrl.$setValidity('email', false); + return undefined; + } + }; + + ctrl.$formatters.push(emailValidator); + ctrl.$parsers.push(emailValidator); +} + +function radioInputType(scope, element, attr, ctrl) { + // make the name unique, if not defined + if (isUndefined(attr.name)) { + element.attr('name', nextUid()); + } + + element.on('click', function() { + if (element[0].checked) { + scope.$apply(function() { + ctrl.$setViewValue(attr.value); + }); + } + }); + + ctrl.$render = function() { + var value = attr.value; + element[0].checked = (value == ctrl.$viewValue); + }; + + attr.$observe('value', ctrl.$render); +} + +function checkboxInputType(scope, element, attr, ctrl) { + var trueValue = attr.ngTrueValue, + falseValue = attr.ngFalseValue; + + if (!isString(trueValue)) trueValue = true; + if (!isString(falseValue)) falseValue = false; + + element.on('click', function() { + scope.$apply(function() { + ctrl.$setViewValue(element[0].checked); + }); + }); + + ctrl.$render = function() { + element[0].checked = ctrl.$viewValue; + }; + + // Override the standard `$isEmpty` because a value of `false` means empty in a checkbox. + ctrl.$isEmpty = function(value) { + return value !== trueValue; + }; + + ctrl.$formatters.push(function(value) { + return value === trueValue; + }); + + ctrl.$parsers.push(function(value) { + return value ? trueValue : falseValue; + }); +} + + +/** + * @ngdoc directive + * @name ng.directive:textarea + * @restrict E + * + * @description + * HTML textarea element control with angular data-binding. The data-binding and validation + * properties of this element are exactly the same as those of the + * {@link ng.directive:input input element}. + * + * @param {string} ngModel Assignable angular expression to data-bind to. + * @param {string=} name Property name of the form under which the control is published. + * @param {string=} required Sets `required` validation error key if the value is not entered. + * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to + * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of + * `required` when you want to data-bind to the `required` attribute. + * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than + * minlength. + * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than + * maxlength. + * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the + * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for + * patterns defined as scope expressions. + * @param {string=} ngChange Angular expression to be executed when input changes due to user + * interaction with the input element. + */ + + +/** + * @ngdoc directive + * @name ng.directive:input + * @restrict E + * + * @description + * HTML input element control with angular data-binding. Input control follows HTML5 input types + * and polyfills the HTML5 validation behavior for older browsers. + * + * @param {string} ngModel Assignable angular expression to data-bind to. + * @param {string=} name Property name of the form under which the control is published. + * @param {string=} required Sets `required` validation error key if the value is not entered. + * @param {boolean=} ngRequired Sets `required` attribute if set to true + * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than + * minlength. + * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than + * maxlength. + * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the + * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for + * patterns defined as scope expressions. + * @param {string=} ngChange Angular expression to be executed when input changes due to user + * interaction with the input element. + * + * @example + + + +
+
+ User name: + + Required!
+ Last name: + + Too short! + + Too long!
+
+
+ user = {{user}}
+ myForm.userName.$valid = {{myForm.userName.$valid}}
+ myForm.userName.$error = {{myForm.userName.$error}}
+ myForm.lastName.$valid = {{myForm.lastName.$valid}}
+ myForm.lastName.$error = {{myForm.lastName.$error}}
+ myForm.$valid = {{myForm.$valid}}
+ myForm.$error.required = {{!!myForm.$error.required}}
+ myForm.$error.minlength = {{!!myForm.$error.minlength}}
+ myForm.$error.maxlength = {{!!myForm.$error.maxlength}}
+
+
+ + it('should initialize to model', function() { + expect(binding('user')).toEqual('{"name":"guest","last":"visitor"}'); + expect(binding('myForm.userName.$valid')).toEqual('true'); + expect(binding('myForm.$valid')).toEqual('true'); + }); + + it('should be invalid if empty when required', function() { + input('user.name').enter(''); + expect(binding('user')).toEqual('{"last":"visitor"}'); + expect(binding('myForm.userName.$valid')).toEqual('false'); + expect(binding('myForm.$valid')).toEqual('false'); + }); + + it('should be valid if empty when min length is set', function() { + input('user.last').enter(''); + expect(binding('user')).toEqual('{"name":"guest","last":""}'); + expect(binding('myForm.lastName.$valid')).toEqual('true'); + expect(binding('myForm.$valid')).toEqual('true'); + }); + + it('should be invalid if less than required min length', function() { + input('user.last').enter('xx'); + expect(binding('user')).toEqual('{"name":"guest"}'); + expect(binding('myForm.lastName.$valid')).toEqual('false'); + expect(binding('myForm.lastName.$error')).toMatch(/minlength/); + expect(binding('myForm.$valid')).toEqual('false'); + }); + + it('should be invalid if longer than max length', function() { + input('user.last').enter('some ridiculously long name'); + expect(binding('user')) + .toEqual('{"name":"guest"}'); + expect(binding('myForm.lastName.$valid')).toEqual('false'); + expect(binding('myForm.lastName.$error')).toMatch(/maxlength/); + expect(binding('myForm.$valid')).toEqual('false'); + }); + +
+ */ +var inputDirective = ['$browser', '$sniffer', function($browser, $sniffer) { + return { + restrict: 'E', + require: '?ngModel', + link: function(scope, element, attr, ctrl) { + if (ctrl) { + (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrl, $sniffer, + $browser); + } + } + }; +}]; + +var VALID_CLASS = 'ng-valid', + INVALID_CLASS = 'ng-invalid', + PRISTINE_CLASS = 'ng-pristine', + DIRTY_CLASS = 'ng-dirty'; + +/** + * @ngdoc object + * @name ng.directive:ngModel.NgModelController + * + * @property {string} $viewValue Actual string value in the view. + * @property {*} $modelValue The value in the model, that the control is bound to. + * @property {Array.} $parsers Array of functions to execute, as a pipeline, whenever + the control reads value from the DOM. Each function is called, in turn, passing the value + through to the next. Used to sanitize / convert the value as well as validation. + For validation, the parsers should update the validity state using + {@link ng.directive:ngModel.NgModelController#methods_$setValidity $setValidity()}, + and return `undefined` for invalid values. + + * + * @property {Array.} $formatters Array of functions to execute, as a pipeline, whenever + the model value changes. Each function is called, in turn, passing the value through to the + next. Used to format / convert values for display in the control and validation. + *
+ *      function formatter(value) {
+ *        if (value) {
+ *          return value.toUpperCase();
+ *        }
+ *      }
+ *      ngModel.$formatters.push(formatter);
+ *      
+ * @property {Object} $error An object hash with all errors as keys. + * + * @property {boolean} $pristine True if user has not interacted with the control yet. + * @property {boolean} $dirty True if user has already interacted with the control. + * @property {boolean} $valid True if there is no error. + * @property {boolean} $invalid True if at least one error on the control. + * + * @description + * + * `NgModelController` provides API for the `ng-model` directive. The controller contains + * services for data-binding, validation, CSS updates, and value formatting and parsing. It + * purposefully does not contain any logic which deals with DOM rendering or listening to + * DOM events. Such DOM related logic should be provided by other directives which make use of + * `NgModelController` for data-binding. + * + * ## Custom Control Example + * This example shows how to use `NgModelController` with a custom control to achieve + * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`) + * collaborate together to achieve the desired result. + * + * Note that `contenteditable` is an HTML5 attribute, which tells the browser to let the element + * contents be edited in place by the user. This will not work on older browsers. + * + * + + [contenteditable] { + border: 1px solid black; + background-color: white; + min-height: 20px; + } + + .ng-invalid { + border: 1px solid red; + } + + + + angular.module('customControl', []). + directive('contenteditable', function() { + return { + restrict: 'A', // only activate on element attribute + require: '?ngModel', // get a hold of NgModelController + link: function(scope, element, attrs, ngModel) { + if(!ngModel) return; // do nothing if no ng-model + + // Specify how UI should be updated + ngModel.$render = function() { + element.html(ngModel.$viewValue || ''); + }; + + // Listen for change events to enable binding + element.on('blur keyup change', function() { + scope.$apply(read); + }); + read(); // initialize + + // Write data to the model + function read() { + var html = element.html(); + // When we clear the content editable the browser leaves a
behind + // If strip-br attribute is provided then we strip this out + if( attrs.stripBr && html == '
' ) { + html = ''; + } + ngModel.$setViewValue(html); + } + } + }; + }); +
+ +
+
Change me!
+ Required! +
+ +
+
+ + it('should data-bind and become invalid', function() { + var contentEditable = element('[contenteditable]'); + + expect(contentEditable.text()).toEqual('Change me!'); + input('userContent').enter(''); + expect(contentEditable.text()).toEqual(''); + expect(contentEditable.prop('className')).toMatch(/ng-invalid-required/); + }); + + *
+ * + * ## Isolated Scope Pitfall + * + * Note that if you have a directive with an isolated scope, you cannot require `ngModel` + * since the model value will be looked up on the isolated scope rather than the outer scope. + * When the directive updates the model value, calling `ngModel.$setViewValue()` the property + * on the outer scope will not be updated. However you can get around this by using $parent. + * + * Here is an example of this situation. You'll notice that the first div is not updating the input. + * However the second div can update the input properly. + * + * + + angular.module('badIsolatedDirective', []).directive('isolate', function() { + return { + require: 'ngModel', + scope: { }, + template: '', + link: function(scope, element, attrs, ngModel) { + scope.$watch('innerModel', function(value) { + console.log(value); + ngModel.$setViewValue(value); + }); + } + }; + }); + + + +
+
+
+ *
+ * + * + */ +var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', + function($scope, $exceptionHandler, $attr, $element, $parse) { + this.$viewValue = Number.NaN; + this.$modelValue = Number.NaN; + this.$parsers = []; + this.$formatters = []; + this.$viewChangeListeners = []; + this.$pristine = true; + this.$dirty = false; + this.$valid = true; + this.$invalid = false; + this.$name = $attr.name; + + var ngModelGet = $parse($attr.ngModel), + ngModelSet = ngModelGet.assign; + + if (!ngModelSet) { + throw minErr('ngModel')('nonassign', "Expression '{0}' is non-assignable. Element: {1}", + $attr.ngModel, startingTag($element)); + } + + /** + * @ngdoc function + * @name ng.directive:ngModel.NgModelController#$render + * @methodOf ng.directive:ngModel.NgModelController + * + * @description + * Called when the view needs to be updated. It is expected that the user of the ng-model + * directive will implement this method. + */ + this.$render = noop; + + /** + * @ngdoc function + * @name { ng.directive:ngModel.NgModelController#$isEmpty + * @methodOf ng.directive:ngModel.NgModelController + * + * @description + * This is called when we need to determine if the value of the input is empty. + * + * For instance, the required directive does this to work out if the input has data or not. + * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`. + * + * You can override this for input directives whose concept of being empty is different to the + * default. The `checkboxInputType` directive does this because in its case a value of `false` + * implies empty. + */ + this.$isEmpty = function(value) { + return isUndefined(value) || value === '' || value === null || value !== value; + }; + + var parentForm = $element.inheritedData('$formController') || nullFormCtrl, + invalidCount = 0, // used to easily determine if we are valid + $error = this.$error = {}; // keep invalid keys here + + + // Setup initial state of the control + $element.addClass(PRISTINE_CLASS); + toggleValidCss(true); + + // convenience method for easy toggling of classes + function toggleValidCss(isValid, validationErrorKey) { + validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : ''; + $element. + removeClass((isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey). + addClass((isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey); + } + + /** + * @ngdoc function + * @name ng.directive:ngModel.NgModelController#$setValidity + * @methodOf ng.directive:ngModel.NgModelController + * + * @description + * Change the validity state, and notifies the form when the control changes validity. (i.e. it + * does not notify form if given validator is already marked as invalid). + * + * This method should be called by validators - i.e. the parser or formatter functions. + * + * @param {string} validationErrorKey Name of the validator. the `validationErrorKey` will assign + * to `$error[validationErrorKey]=isValid` so that it is available for data-binding. + * The `validationErrorKey` should be in camelCase and will get converted into dash-case + * for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error` + * class and can be bound to as `{{someForm.someControl.$error.myError}}` . + * @param {boolean} isValid Whether the current state is valid (true) or invalid (false). + */ + this.$setValidity = function(validationErrorKey, isValid) { + // Purposeful use of ! here to cast isValid to boolean in case it is undefined + // jshint -W018 + if ($error[validationErrorKey] === !isValid) return; + // jshint +W018 + + if (isValid) { + if ($error[validationErrorKey]) invalidCount--; + if (!invalidCount) { + toggleValidCss(true); + this.$valid = true; + this.$invalid = false; + } + } else { + toggleValidCss(false); + this.$invalid = true; + this.$valid = false; + invalidCount++; + } + + $error[validationErrorKey] = !isValid; + toggleValidCss(isValid, validationErrorKey); + + parentForm.$setValidity(validationErrorKey, isValid, this); + }; + + /** + * @ngdoc function + * @name ng.directive:ngModel.NgModelController#$setPristine + * @methodOf ng.directive:ngModel.NgModelController + * + * @description + * Sets the control to its pristine state. + * + * This method can be called to remove the 'ng-dirty' class and set the control to its pristine + * state (ng-pristine class). + */ + this.$setPristine = function () { + this.$dirty = false; + this.$pristine = true; + $element.removeClass(DIRTY_CLASS).addClass(PRISTINE_CLASS); + }; + + /** + * @ngdoc function + * @name ng.directive:ngModel.NgModelController#$setViewValue + * @methodOf ng.directive:ngModel.NgModelController + * + * @description + * Read a value from view. + * + * This method should be called from within a DOM event handler. + * For example {@link ng.directive:input input} or + * {@link ng.directive:select select} directives call it. + * + * It internally calls all `$parsers` (including validators) and updates the `$modelValue` and the actual model path. + * Lastly it calls all registered change listeners. + * + * @param {string} value Value from the view. + */ + this.$setViewValue = function(value) { + this.$viewValue = value; + + // change to dirty + if (this.$pristine) { + this.$dirty = true; + this.$pristine = false; + $element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS); + parentForm.$setDirty(); + } + + forEach(this.$parsers, function(fn) { + value = fn(value); + }); + + if (this.$modelValue !== value) { + this.$modelValue = value; + ngModelSet($scope, value); + forEach(this.$viewChangeListeners, function(listener) { + try { + listener(); + } catch(e) { + $exceptionHandler(e); + } + }); + } + }; + + // model -> value + var ctrl = this; + + $scope.$watch(function ngModelWatch() { + var value = ngModelGet($scope); + + // if scope model value and ngModel value are out of sync + if (ctrl.$modelValue !== value) { + + var formatters = ctrl.$formatters, + idx = formatters.length; + + ctrl.$modelValue = value; + while(idx--) { + value = formatters[idx](value); + } + + if (ctrl.$viewValue !== value) { + ctrl.$viewValue = value; + ctrl.$render(); + } + } + }); +}]; + + +/** + * @ngdoc directive + * @name ng.directive:ngModel + * + * @element input + * + * @description + * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a + * property on the scope using {@link ng.directive:ngModel.NgModelController NgModelController}, + * which is created and exposed by this directive. + * + * `ngModel` is responsible for: + * + * - Binding the view into the model, which other directives such as `input`, `textarea` or `select` + * require. + * - Providing validation behavior (i.e. required, number, email, url). + * - Keeping the state of the control (valid/invalid, dirty/pristine, validation errors). + * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`). + * - Registering the control with its parent {@link ng.directive:form form}. + * + * Note: `ngModel` will try to bind to the property given by evaluating the expression on the + * current scope. If the property doesn't already exist on this scope, it will be created + * implicitly and added to the scope. + * + * For best practices on using `ngModel`, see: + * + * - {@link https://github.com/angular/angular.js/wiki/Understanding-Scopes} + * + * For basic examples, how to use `ngModel`, see: + * + * - {@link ng.directive:input input} + * - {@link ng.directive:input.text text} + * - {@link ng.directive:input.checkbox checkbox} + * - {@link ng.directive:input.radio radio} + * - {@link ng.directive:input.number number} + * - {@link ng.directive:input.email email} + * - {@link ng.directive:input.url url} + * - {@link ng.directive:select select} + * - {@link ng.directive:textarea textarea} + * + */ +var ngModelDirective = function() { + return { + require: ['ngModel', '^?form'], + controller: NgModelController, + link: function(scope, element, attr, ctrls) { + // notify others, especially parent forms + + var modelCtrl = ctrls[0], + formCtrl = ctrls[1] || nullFormCtrl; + + formCtrl.$addControl(modelCtrl); + + scope.$on('$destroy', function() { + formCtrl.$removeControl(modelCtrl); + }); + } + }; +}; + + +/** + * @ngdoc directive + * @name ng.directive:ngChange + * + * @description + * Evaluate given expression when user changes the input. + * The expression is not evaluated when the value change is coming from the model. + * + * Note, this directive requires `ngModel` to be present. + * + * @element input + * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change + * in input value. + * + * @example + * + * + * + *
+ * + * + *
+ * debug = {{confirmed}}
+ * counter = {{counter}} + *
+ *
+ * + * it('should evaluate the expression if changing from view', function() { + * expect(binding('counter')).toEqual('0'); + * element('#ng-change-example1').click(); + * expect(binding('counter')).toEqual('1'); + * expect(binding('confirmed')).toEqual('true'); + * }); + * + * it('should not evaluate the expression if changing from model', function() { + * element('#ng-change-example2').click(); + * expect(binding('counter')).toEqual('0'); + * expect(binding('confirmed')).toEqual('true'); + * }); + * + *
+ */ +var ngChangeDirective = valueFn({ + require: 'ngModel', + link: function(scope, element, attr, ctrl) { + ctrl.$viewChangeListeners.push(function() { + scope.$eval(attr.ngChange); + }); + } +}); + + +var requiredDirective = function() { + return { + require: '?ngModel', + link: function(scope, elm, attr, ctrl) { + if (!ctrl) return; + attr.required = true; // force truthy in case we are on non input element + + var validator = function(value) { + if (attr.required && ctrl.$isEmpty(value)) { + ctrl.$setValidity('required', false); + return; + } else { + ctrl.$setValidity('required', true); + return value; + } + }; + + ctrl.$formatters.push(validator); + ctrl.$parsers.unshift(validator); + + attr.$observe('required', function() { + validator(ctrl.$viewValue); + }); + } + }; +}; + + +/** + * @ngdoc directive + * @name ng.directive:ngList + * + * @description + * Text input that converts between a delimited string and an array of strings. The delimiter + * can be a fixed string (by default a comma) or a regular expression. + * + * @element input + * @param {string=} ngList optional delimiter that should be used to split the value. If + * specified in form `/something/` then the value will be converted into a regular expression. + * + * @example + + + +
+ List: + + Required! +
+ names = {{names}}
+ myForm.namesInput.$valid = {{myForm.namesInput.$valid}}
+ myForm.namesInput.$error = {{myForm.namesInput.$error}}
+ myForm.$valid = {{myForm.$valid}}
+ myForm.$error.required = {{!!myForm.$error.required}}
+
+
+ + it('should initialize to model', function() { + expect(binding('names')).toEqual('["igor","misko","vojta"]'); + expect(binding('myForm.namesInput.$valid')).toEqual('true'); + expect(element('span.error').css('display')).toBe('none'); + }); + + it('should be invalid if empty', function() { + input('names').enter(''); + expect(binding('names')).toEqual(''); + expect(binding('myForm.namesInput.$valid')).toEqual('false'); + expect(element('span.error').css('display')).not().toBe('none'); + }); + +
+ */ +var ngListDirective = function() { + return { + require: 'ngModel', + link: function(scope, element, attr, ctrl) { + var match = /\/(.*)\//.exec(attr.ngList), + separator = match && new RegExp(match[1]) || attr.ngList || ','; + + var parse = function(viewValue) { + // If the viewValue is invalid (say required but empty) it will be `undefined` + if (isUndefined(viewValue)) return; + + var list = []; + + if (viewValue) { + forEach(viewValue.split(separator), function(value) { + if (value) list.push(trim(value)); + }); + } + + return list; + }; + + ctrl.$parsers.push(parse); + ctrl.$formatters.push(function(value) { + if (isArray(value)) { + return value.join(', '); + } + + return undefined; + }); + + // Override the standard $isEmpty because an empty array means the input is empty. + ctrl.$isEmpty = function(value) { + return !value || !value.length; + }; + } + }; +}; + + +var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/; +/** + * @ngdoc directive + * @name ng.directive:ngValue + * + * @description + * Binds the given expression to the value of `input[select]` or `input[radio]`, so + * that when the element is selected, the `ngModel` of that element is set to the + * bound value. + * + * `ngValue` is useful when dynamically generating lists of radio buttons using `ng-repeat`, as + * shown below. + * + * @element input + * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute + * of the `input` element + * + * @example + + + +
+

Which is your favorite?

+ + +
You chose {{my.favorite}}
+
+
+ + it('should initialize to model', function() { + expect(binding('my.favorite')).toEqual('unicorns'); + }); + it('should bind the values to the inputs', function() { + input('my.favorite').select('pizza'); + expect(binding('my.favorite')).toEqual('pizza'); + }); + +
+ */ +var ngValueDirective = function() { + return { + priority: 100, + compile: function(tpl, tplAttr) { + if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) { + return function ngValueConstantLink(scope, elm, attr) { + attr.$set('value', scope.$eval(attr.ngValue)); + }; + } else { + return function ngValueLink(scope, elm, attr) { + scope.$watch(attr.ngValue, function valueWatchAction(value) { + attr.$set('value', value); + }); + }; + } + } + }; +}; + +/** + * @ngdoc directive + * @name ng.directive:ngBind + * @restrict AC + * + * @description + * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element + * with the value of a given expression, and to update the text content when the value of that + * expression changes. + * + * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like + * `{{ expression }}` which is similar but less verbose. + * + * It is preferrable to use `ngBind` instead of `{{ expression }}` when a template is momentarily + * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an + * element attribute, it makes the bindings invisible to the user while the page is loading. + * + * An alternative solution to this problem would be using the + * {@link ng.directive:ngCloak ngCloak} directive. + * + * + * @element ANY + * @param {expression} ngBind {@link guide/expression Expression} to evaluate. + * + * @example + * Enter a name in the Live Preview text box; the greeting below the text box changes instantly. + + + +
+ Enter name:
+ Hello ! +
+
+ + it('should check ng-bind', function() { + expect(using('.doc-example-live').binding('name')).toBe('Whirled'); + using('.doc-example-live').input('name').enter('world'); + expect(using('.doc-example-live').binding('name')).toBe('world'); + }); + +
+ */ +var ngBindDirective = ngDirective(function(scope, element, attr) { + element.addClass('ng-binding').data('$binding', attr.ngBind); + scope.$watch(attr.ngBind, function ngBindWatchAction(value) { + // We are purposefully using == here rather than === because we want to + // catch when value is "null or undefined" + // jshint -W041 + element.text(value == undefined ? '' : value); + }); +}); + + +/** + * @ngdoc directive + * @name ng.directive:ngBindTemplate + * + * @description + * The `ngBindTemplate` directive specifies that the element + * text content should be replaced with the interpolation of the template + * in the `ngBindTemplate` attribute. + * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}` + * expressions. This directive is needed since some HTML elements + * (such as TITLE and OPTION) cannot contain SPAN elements. + * + * @element ANY + * @param {string} ngBindTemplate template of form + * {{ expression }} to eval. + * + * @example + * Try it here: enter text in text box and watch the greeting change. + + + +
+ Salutation:
+ Name:
+

+       
+
+ + it('should check ng-bind', function() { + expect(using('.doc-example-live').binding('salutation')). + toBe('Hello'); + expect(using('.doc-example-live').binding('name')). + toBe('World'); + using('.doc-example-live').input('salutation').enter('Greetings'); + using('.doc-example-live').input('name').enter('user'); + expect(using('.doc-example-live').binding('salutation')). + toBe('Greetings'); + expect(using('.doc-example-live').binding('name')). + toBe('user'); + }); + +
+ */ +var ngBindTemplateDirective = ['$interpolate', function($interpolate) { + return function(scope, element, attr) { + // TODO: move this to scenario runner + var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate)); + element.addClass('ng-binding').data('$binding', interpolateFn); + attr.$observe('ngBindTemplate', function(value) { + element.text(value); + }); + }; +}]; + + +/** + * @ngdoc directive + * @name ng.directive:ngBindHtml + * + * @description + * Creates a binding that will innerHTML the result of evaluating the `expression` into the current + * element in a secure way. By default, the innerHTML-ed content will be sanitized using the {@link + * ngSanitize.$sanitize $sanitize} service. To utilize this functionality, ensure that `$sanitize` + * is available, for example, by including {@link ngSanitize} in your module's dependencies (not in + * core Angular.) You may also bypass sanitization for values you know are safe. To do so, bind to + * an explicitly trusted value via {@link ng.$sce#methods_trustAsHtml $sce.trustAsHtml}. See the example + * under {@link ng.$sce#Example Strict Contextual Escaping (SCE)}. + * + * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you + * will have an exception (instead of an exploit.) + * + * @element ANY + * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate. + * + * @example + * Try it here: enter text in text box and watch the greeting change. + + + +
+

+
+
+ + it('should check ng-bind-html', function() { + expect(using('.doc-example-live').binding('myHTML')). + toBe('I am an HTMLstring with links! and other stuff'); + }); + +
+ */ +var ngBindHtmlDirective = ['$sce', '$parse', function($sce, $parse) { + return function(scope, element, attr) { + element.addClass('ng-binding').data('$binding', attr.ngBindHtml); + + var parsed = $parse(attr.ngBindHtml); + function getStringValue() { return (parsed(scope) || '').toString(); } + + scope.$watch(getStringValue, function ngBindHtmlWatchAction(value) { + element.html($sce.getTrustedHtml(parsed(scope)) || ''); + }); + }; +}]; + +function classDirective(name, selector) { + name = 'ngClass' + name; + return function() { + return { + restrict: 'AC', + link: function(scope, element, attr) { + var oldVal; + + scope.$watch(attr[name], ngClassWatchAction, true); + + attr.$observe('class', function(value) { + ngClassWatchAction(scope.$eval(attr[name])); + }); + + + if (name !== 'ngClass') { + scope.$watch('$index', function($index, old$index) { + // jshint bitwise: false + var mod = $index & 1; + if (mod !== old$index & 1) { + if (mod === selector) { + addClass(scope.$eval(attr[name])); + } else { + removeClass(scope.$eval(attr[name])); + } + } + }); + } + + + function ngClassWatchAction(newVal) { + if (selector === true || scope.$index % 2 === selector) { + if (oldVal && !equals(newVal,oldVal)) { + removeClass(oldVal); + } + addClass(newVal); + } + oldVal = copy(newVal); + } + + + function removeClass(classVal) { + attr.$removeClass(flattenClasses(classVal)); + } + + + function addClass(classVal) { + attr.$addClass(flattenClasses(classVal)); + } + + function flattenClasses(classVal) { + if(isArray(classVal)) { + return classVal.join(' '); + } else if (isObject(classVal)) { + var classes = [], i = 0; + forEach(classVal, function(v, k) { + if (v) { + classes.push(k); + } + }); + return classes.join(' '); + } + + return classVal; + } + } + }; + }; +} + +/** + * @ngdoc directive + * @name ng.directive:ngClass + * @restrict AC + * + * @description + * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding + * an expression that represents all classes to be added. + * + * The directive won't add duplicate classes if a particular class was already set. + * + * When the expression changes, the previously added classes are removed and only then the + * new classes are added. + * + * @animations + * add - happens just before the class is applied to the element + * remove - happens just before the class is removed from the element + * + * @element ANY + * @param {expression} ngClass {@link guide/expression Expression} to eval. The result + * of the evaluation can be a string representing space delimited class + * names, an array, or a map of class names to boolean values. In the case of a map, the + * names of the properties whose values are truthy will be added as css classes to the + * element. + * + * @example Example that demonstrates basic bindings via ngClass directive. + + +

Map Syntax Example

+ bold + strike + red +
+

Using String Syntax

+ +
+

Using Array Syntax

+
+
+
+
+ + .strike { + text-decoration: line-through; + } + .bold { + font-weight: bold; + } + .red { + color: red; + } + + + it('should let you toggle the class', function() { + + expect(element('.doc-example-live p:first').prop('className')).not().toMatch(/bold/); + expect(element('.doc-example-live p:first').prop('className')).not().toMatch(/red/); + + input('bold').check(); + expect(element('.doc-example-live p:first').prop('className')).toMatch(/bold/); + + input('red').check(); + expect(element('.doc-example-live p:first').prop('className')).toMatch(/red/); + }); + + it('should let you toggle string example', function() { + expect(element('.doc-example-live p:nth-of-type(2)').prop('className')).toBe(''); + input('style').enter('red'); + expect(element('.doc-example-live p:nth-of-type(2)').prop('className')).toBe('red'); + }); + + it('array example should have 3 classes', function() { + expect(element('.doc-example-live p:last').prop('className')).toBe(''); + input('style1').enter('bold'); + input('style2').enter('strike'); + input('style3').enter('red'); + expect(element('.doc-example-live p:last').prop('className')).toBe('bold strike red'); + }); + +
+ + ## Animations + + The example below demonstrates how to perform animations using ngClass. + + + + + +
+ Sample Text +
+ + .base-class { + -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; + transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; + } + + .base-class.my-class { + color: red; + font-size:3em; + } + + + it('should check ng-class', function() { + expect(element('.doc-example-live span').prop('className')).not(). + toMatch(/my-class/); + + using('.doc-example-live').element(':button:first').click(); + + expect(element('.doc-example-live span').prop('className')). + toMatch(/my-class/); + + using('.doc-example-live').element(':button:last').click(); + + expect(element('.doc-example-live span').prop('className')).not(). + toMatch(/my-class/); + }); + +
+ + + ## ngClass and pre-existing CSS3 Transitions/Animations + The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure. + Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder + any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure + to view the step by step details of {@link ngAnimate.$animate#methods_addclass $animate.addClass} and + {@link ngAnimate.$animate#methods_removeclass $animate.removeClass}. + */ +var ngClassDirective = classDirective('', true); + +/** + * @ngdoc directive + * @name ng.directive:ngClassOdd + * @restrict AC + * + * @description + * The `ngClassOdd` and `ngClassEven` directives work exactly as + * {@link ng.directive:ngClass ngClass}, except they work in + * conjunction with `ngRepeat` and take effect only on odd (even) rows. + * + * This directive can be applied only within the scope of an + * {@link ng.directive:ngRepeat ngRepeat}. + * + * @element ANY + * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result + * of the evaluation can be a string representing space delimited class names or an array. + * + * @example + + +
    +
  1. + + {{name}} + +
  2. +
+
+ + .odd { + color: red; + } + .even { + color: blue; + } + + + it('should check ng-class-odd and ng-class-even', function() { + expect(element('.doc-example-live li:first span').prop('className')). + toMatch(/odd/); + expect(element('.doc-example-live li:last span').prop('className')). + toMatch(/even/); + }); + +
+ */ +var ngClassOddDirective = classDirective('Odd', 0); + +/** + * @ngdoc directive + * @name ng.directive:ngClassEven + * @restrict AC + * + * @description + * The `ngClassOdd` and `ngClassEven` directives work exactly as + * {@link ng.directive:ngClass ngClass}, except they work in + * conjunction with `ngRepeat` and take effect only on odd (even) rows. + * + * This directive can be applied only within the scope of an + * {@link ng.directive:ngRepeat ngRepeat}. + * + * @element ANY + * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The + * result of the evaluation can be a string representing space delimited class names or an array. + * + * @example + + +
    +
  1. + + {{name}}       + +
  2. +
+
+ + .odd { + color: red; + } + .even { + color: blue; + } + + + it('should check ng-class-odd and ng-class-even', function() { + expect(element('.doc-example-live li:first span').prop('className')). + toMatch(/odd/); + expect(element('.doc-example-live li:last span').prop('className')). + toMatch(/even/); + }); + +
+ */ +var ngClassEvenDirective = classDirective('Even', 1); + +/** + * @ngdoc directive + * @name ng.directive:ngCloak + * @restrict AC + * + * @description + * The `ngCloak` directive is used to prevent the Angular html template from being briefly + * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this + * directive to avoid the undesirable flicker effect caused by the html template display. + * + * The directive can be applied to the `` element, but the preferred usage is to apply + * multiple `ngCloak` directives to small portions of the page to permit progressive rendering + * of the browser view. + * + * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and + * `angular.min.js`. + * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}). + * + *
+ * [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
+ *   display: none !important;
+ * }
+ * 
+ * + * When this css rule is loaded by the browser, all html elements (including their children) that + * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive + * during the compilation of the template it deletes the `ngCloak` element attribute, making + * the compiled element visible. + * + * For the best result, the `angular.js` script must be loaded in the head section of the html + * document; alternatively, the css rule above must be included in the external stylesheet of the + * application. + * + * Legacy browsers, like IE7, do not provide attribute selector support (added in CSS 2.1) so they + * cannot match the `[ng\:cloak]` selector. To work around this limitation, you must add the css + * class `ngCloak` in addition to the `ngCloak` directive as shown in the example below. + * + * @element ANY + * + * @example + + +
{{ 'hello' }}
+
{{ 'hello IE7' }}
+
+ + it('should remove the template directive and css class', function() { + expect(element('.doc-example-live #template1').attr('ng-cloak')). + not().toBeDefined(); + expect(element('.doc-example-live #template2').attr('ng-cloak')). + not().toBeDefined(); + }); + +
+ * + */ +var ngCloakDirective = ngDirective({ + compile: function(element, attr) { + attr.$set('ngCloak', undefined); + element.removeClass('ng-cloak'); + } +}); + +/** + * @ngdoc directive + * @name ng.directive:ngController + * + * @description + * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular + * supports the principles behind the Model-View-Controller design pattern. + * + * MVC components in angular: + * + * * Model — The Model is scope properties; scopes are attached to the DOM where scope properties + * are accessed through bindings. + * * View — The template (HTML with data bindings) that is rendered into the View. + * * Controller — The `ngController` directive specifies a Controller class; the class contains business + * logic behind the application to decorate the scope with functions and values + * + * Note that you can also attach controllers to the DOM by declaring it in a route definition + * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller + * again using `ng-controller` in the template itself. This will cause the controller to be attached + * and executed twice. + * + * @element ANY + * @scope + * @param {expression} ngController Name of a globally accessible constructor function or an + * {@link guide/expression expression} that on the current scope evaluates to a + * constructor function. The controller instance can be published into a scope property + * by specifying `as propertyName`. + * + * @example + * Here is a simple form for editing user contact information. Adding, removing, clearing, and + * greeting are methods declared on the controller (see source tab). These methods can + * easily be called from the angular markup. Notice that the scope becomes the `this` for the + * controller's instance. This allows for easy access to the view data from the controller. Also + * notice that any changes to the data are automatically reflected in the View without the need + * for a manual update. The example is shown in two different declaration styles you may use + * according to preference. + + + +
+ Name: + [ greet ]
+ Contact: +
    +
  • + + + [ clear + | X ] +
  • +
  • [ add ]
  • +
+
+
+ + it('should check controller as', function() { + expect(element('#ctrl-as-exmpl>:input').val()).toBe('John Smith'); + expect(element('#ctrl-as-exmpl li:nth-child(1) input').val()) + .toBe('408 555 1212'); + expect(element('#ctrl-as-exmpl li:nth-child(2) input').val()) + .toBe('john.smith@example.org'); + + element('#ctrl-as-exmpl li:first a:contains("clear")').click(); + expect(element('#ctrl-as-exmpl li:first input').val()).toBe(''); + + element('#ctrl-as-exmpl li:last a:contains("add")').click(); + expect(element('#ctrl-as-exmpl li:nth-child(3) input').val()) + .toBe('yourname@example.org'); + }); + +
+ + + +
+ Name: + [ greet ]
+ Contact: +
    +
  • + + + [ clear + | X ] +
  • +
  • [ add ]
  • +
+
+
+ + it('should check controller', function() { + expect(element('#ctrl-exmpl>:input').val()).toBe('John Smith'); + expect(element('#ctrl-exmpl li:nth-child(1) input').val()) + .toBe('408 555 1212'); + expect(element('#ctrl-exmpl li:nth-child(2) input').val()) + .toBe('john.smith@example.org'); + + element('#ctrl-exmpl li:first a:contains("clear")').click(); + expect(element('#ctrl-exmpl li:first input').val()).toBe(''); + + element('#ctrl-exmpl li:last a:contains("add")').click(); + expect(element('#ctrl-exmpl li:nth-child(3) input').val()) + .toBe('yourname@example.org'); + }); + +
+ + */ +var ngControllerDirective = [function() { + return { + scope: true, + controller: '@' + }; +}]; + +/** + * @ngdoc directive + * @name ng.directive:ngCsp + * + * @element html + * @description + * Enables [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) support. + * + * This is necessary when developing things like Google Chrome Extensions. + * + * CSP forbids apps to use `eval` or `Function(string)` generated functions (among other things). + * For us to be compatible, we just need to implement the "getterFn" in $parse without violating + * any of these restrictions. + * + * AngularJS uses `Function(string)` generated functions as a speed optimization. Applying the `ngCsp` + * directive will cause Angular to use CSP compatibility mode. When this mode is on AngularJS will + * evaluate all expressions up to 30% slower than in non-CSP mode, but no security violations will + * be raised. + * + * CSP forbids JavaScript to inline stylesheet rules. In non CSP mode Angular automatically + * includes some CSS rules (e.g. {@link ng.directive:ngCloak ngCloak}). + * To make those directives work in CSP mode, include the `angular-csp.css` manually. + * + * In order to use this feature put the `ngCsp` directive on the root element of the application. + * + * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.* + * + * @example + * This example shows how to apply the `ngCsp` directive to the `html` tag. +
+     
+     
+     ...
+     ...
+     
+   
+ */ + +// ngCsp is not implemented as a proper directive any more, because we need it be processed while we bootstrap +// the system (before $parse is instantiated), for this reason we just have a csp() fn that looks for ng-csp attribute +// anywhere in the current doc + +/** + * @ngdoc directive + * @name ng.directive:ngClick + * + * @description + * The ngClick directive allows you to specify custom behavior when + * an element is clicked. + * + * @element ANY + * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon + * click. (Event object is available as `$event`) + * + * @example + + + + count: {{count}} + + + it('should check ng-click', function() { + expect(binding('count')).toBe('0'); + element('.doc-example-live :button').click(); + expect(binding('count')).toBe('1'); + }); + + + */ +/* + * A directive that allows creation of custom onclick handlers that are defined as angular + * expressions and are compiled and executed within the current scope. + * + * Events that are handled via these handler are always configured not to propagate further. + */ +var ngEventDirectives = {}; +forEach( + 'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '), + function(name) { + var directiveName = directiveNormalize('ng-' + name); + ngEventDirectives[directiveName] = ['$parse', function($parse) { + return { + compile: function($element, attr) { + var fn = $parse(attr[directiveName]); + return function(scope, element, attr) { + element.on(lowercase(name), function(event) { + scope.$apply(function() { + fn(scope, {$event:event}); + }); + }); + }; + } + }; + }]; + } +); + +/** + * @ngdoc directive + * @name ng.directive:ngDblclick + * + * @description + * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event. + * + * @element ANY + * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon + * a dblclick. (The Event object is available as `$event`) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + + +/** + * @ngdoc directive + * @name ng.directive:ngMousedown + * + * @description + * The ngMousedown directive allows you to specify custom behavior on mousedown event. + * + * @element ANY + * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon + * mousedown. (Event object is available as `$event`) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + + +/** + * @ngdoc directive + * @name ng.directive:ngMouseup + * + * @description + * Specify custom behavior on mouseup event. + * + * @element ANY + * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon + * mouseup. (Event object is available as `$event`) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + +/** + * @ngdoc directive + * @name ng.directive:ngMouseover + * + * @description + * Specify custom behavior on mouseover event. + * + * @element ANY + * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon + * mouseover. (Event object is available as `$event`) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + + +/** + * @ngdoc directive + * @name ng.directive:ngMouseenter + * + * @description + * Specify custom behavior on mouseenter event. + * + * @element ANY + * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon + * mouseenter. (Event object is available as `$event`) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + + +/** + * @ngdoc directive + * @name ng.directive:ngMouseleave + * + * @description + * Specify custom behavior on mouseleave event. + * + * @element ANY + * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon + * mouseleave. (Event object is available as `$event`) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + + +/** + * @ngdoc directive + * @name ng.directive:ngMousemove + * + * @description + * Specify custom behavior on mousemove event. + * + * @element ANY + * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon + * mousemove. (Event object is available as `$event`) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + + +/** + * @ngdoc directive + * @name ng.directive:ngKeydown + * + * @description + * Specify custom behavior on keydown event. + * + * @element ANY + * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon + * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + + +/** + * @ngdoc directive + * @name ng.directive:ngKeyup + * + * @description + * Specify custom behavior on keyup event. + * + * @element ANY + * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon + * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + + +/** + * @ngdoc directive + * @name ng.directive:ngKeypress + * + * @description + * Specify custom behavior on keypress event. + * + * @element ANY + * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon + * keypress. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + + +/** + * @ngdoc directive + * @name ng.directive:ngSubmit + * + * @description + * Enables binding angular expressions to onsubmit events. + * + * Additionally it prevents the default action (which for form means sending the request to the + * server and reloading the current page) **but only if the form does not contain an `action` + * attribute**. + * + * @element form + * @param {expression} ngSubmit {@link guide/expression Expression} to eval. (Event object is available as `$event`) + * + * @example + + + +
+ Enter text and hit enter: + + +
list={{list}}
+
+
+ + it('should check ng-submit', function() { + expect(binding('list')).toBe('[]'); + element('.doc-example-live #submit').click(); + expect(binding('list')).toBe('["hello"]'); + expect(input('text').val()).toBe(''); + }); + it('should ignore empty strings', function() { + expect(binding('list')).toBe('[]'); + element('.doc-example-live #submit').click(); + element('.doc-example-live #submit').click(); + expect(binding('list')).toBe('["hello"]'); + }); + +
+ */ + +/** + * @ngdoc directive + * @name ng.directive:ngFocus + * + * @description + * Specify custom behavior on focus event. + * + * @element window, input, select, textarea, a + * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon + * focus. (Event object is available as `$event`) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + +/** + * @ngdoc directive + * @name ng.directive:ngBlur + * + * @description + * Specify custom behavior on blur event. + * + * @element window, input, select, textarea, a + * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon + * blur. (Event object is available as `$event`) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + +/** + * @ngdoc directive + * @name ng.directive:ngCopy + * + * @description + * Specify custom behavior on copy event. + * + * @element window, input, select, textarea, a + * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon + * copy. (Event object is available as `$event`) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + +/** + * @ngdoc directive + * @name ng.directive:ngCut + * + * @description + * Specify custom behavior on cut event. + * + * @element window, input, select, textarea, a + * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon + * cut. (Event object is available as `$event`) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + +/** + * @ngdoc directive + * @name ng.directive:ngPaste + * + * @description + * Specify custom behavior on paste event. + * + * @element window, input, select, textarea, a + * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon + * paste. (Event object is available as `$event`) + * + * @example + * See {@link ng.directive:ngClick ngClick} + */ + +/** + * @ngdoc directive + * @name ng.directive:ngIf + * @restrict A + * + * @description + * The `ngIf` directive removes or recreates a portion of the DOM tree based on an + * {expression}. If the expression assigned to `ngIf` evaluates to a false + * value then the element is removed from the DOM, otherwise a clone of the + * element is reinserted into the DOM. + * + * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the + * element in the DOM rather than changing its visibility via the `display` css property. A common + * case when this difference is significant is when using css selectors that rely on an element's + * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes. + * + * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope + * is created when the element is restored. The scope created within `ngIf` inherits from + * its parent scope using + * {@link https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-Prototypal-Inheritance prototypal inheritance}. + * An important implication of this is if `ngModel` is used within `ngIf` to bind to + * a javascript primitive defined in the parent scope. In this case any modifications made to the + * variable within the child scope will override (hide) the value in the parent scope. + * + * Also, `ngIf` recreates elements using their compiled state. An example of this behavior + * is if an element's class attribute is directly modified after it's compiled, using something like + * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element + * the added class will be lost because the original compiled state is used to regenerate the element. + * + * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter` + * and `leave` effects. + * + * @animations + * enter - happens just after the ngIf contents change and a new DOM element is created and injected into the ngIf container + * leave - happens just before the ngIf contents are removed from the DOM + * + * @element ANY + * @scope + * @priority 600 + * @param {expression} ngIf If the {@link guide/expression expression} is falsy then + * the element is removed from the DOM tree. If it is truthy a copy of the compiled + * element is added to the DOM tree. + * + * @example + + + Click me:
+ Show when checked: + + I'm removed when the checkbox is unchecked. + +
+ + .animate-if { + background:white; + border:1px solid black; + padding:10px; + } + + /* + The transition styles can also be placed on the CSS base class above + */ + .animate-if.ng-enter, .animate-if.ng-leave { + -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; + transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; + } + + .animate-if.ng-enter, + .animate-if.ng-leave.ng-leave-active { + opacity:0; + } + + .animate-if.ng-leave, + .animate-if.ng-enter.ng-enter-active { + opacity:1; + } + +
+ */ +var ngIfDirective = ['$animate', function($animate) { + return { + transclude: 'element', + priority: 600, + terminal: true, + restrict: 'A', + $$tlb: true, + compile: function (element, attr, transclude) { + return function ($scope, $element, $attr) { + var block, childScope; + $scope.$watch($attr.ngIf, function ngIfWatchAction(value) { + + if (toBoolean(value)) { + + childScope = $scope.$new(); + transclude(childScope, function (clone) { + block = { + startNode: clone[0], + endNode: clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ') + }; + $animate.enter(clone, $element.parent(), $element); + }); + + } else { + + if (childScope) { + childScope.$destroy(); + childScope = null; + } + + if (block) { + $animate.leave(getBlockElements(block)); + block = null; + } + } + }); + }; + } + }; +}]; + +/** + * @ngdoc directive + * @name ng.directive:ngInclude + * @restrict ECA + * + * @description + * Fetches, compiles and includes an external HTML fragment. + * + * By default, the template URL is restricted to the same domain and protocol as the + * application document. This is done by calling {@link ng.$sce#methods_getTrustedResourceUrl + * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols + * you may either {@link ng.$sceDelegateProvider#methods_resourceUrlWhitelist whitelist them} or + * {@link ng.$sce#methods_trustAsResourceUrl wrap them} as trusted values. Refer to Angular's {@link + * ng.$sce Strict Contextual Escaping}. + * + * In addition, the browser's + * {@link https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest + * Same Origin Policy} and {@link http://www.w3.org/TR/cors/ Cross-Origin Resource Sharing + * (CORS)} policy may further restrict whether the template is successfully loaded. + * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://` + * access on some browsers. + * + * @animations + * enter - animation is used to bring new content into the browser. + * leave - animation is used to animate existing content away. + * + * The enter and leave animation occur concurrently. + * + * @scope + * @priority 400 + * + * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant, + * make sure you wrap it in quotes, e.g. `src="'myPartialTemplate.html'"`. + * @param {string=} onload Expression to evaluate when a new partial is loaded. + * + * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll + * $anchorScroll} to scroll the viewport after the content is loaded. + * + * - If the attribute is not set, disable scrolling. + * - If the attribute is set without value, enable scrolling. + * - Otherwise enable scrolling only if the expression evaluates to truthy value. + * + * @example + + +
+ + url of the template: {{template.url}} +
+
+
+
+
+
+ + function Ctrl($scope) { + $scope.templates = + [ { name: 'template1.html', url: 'template1.html'} + , { name: 'template2.html', url: 'template2.html'} ]; + $scope.template = $scope.templates[0]; + } + + + Content of template1.html + + + Content of template2.html + + + .slide-animate-container { + position:relative; + background:white; + border:1px solid black; + height:40px; + overflow:hidden; + } + + .slide-animate { + padding:10px; + } + + .slide-animate.ng-enter, .slide-animate.ng-leave { + -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; + transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; + + position:absolute; + top:0; + left:0; + right:0; + bottom:0; + display:block; + padding:10px; + } + + .slide-animate.ng-enter { + top:-50px; + } + .slide-animate.ng-enter.ng-enter-active { + top:0; + } + + .slide-animate.ng-leave { + top:0; + } + .slide-animate.ng-leave.ng-leave-active { + top:50px; + } + + + it('should load template1.html', function() { + expect(element('.doc-example-live [ng-include]').text()). + toMatch(/Content of template1.html/); + }); + it('should load template2.html', function() { + select('template').option('1'); + expect(element('.doc-example-live [ng-include]').text()). + toMatch(/Content of template2.html/); + }); + it('should change to blank', function() { + select('template').option(''); + expect(element('.doc-example-live [ng-include]')).toBe(undefined); + }); + +
+ */ + + +/** + * @ngdoc event + * @name ng.directive:ngInclude#$includeContentRequested + * @eventOf ng.directive:ngInclude + * @eventType emit on the scope ngInclude was declared in + * @description + * Emitted every time the ngInclude content is requested. + */ + + +/** + * @ngdoc event + * @name ng.directive:ngInclude#$includeContentLoaded + * @eventOf ng.directive:ngInclude + * @eventType emit on the current ngInclude scope + * @description + * Emitted every time the ngInclude content is reloaded. + */ +var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile', '$animate', '$sce', + function($http, $templateCache, $anchorScroll, $compile, $animate, $sce) { + return { + restrict: 'ECA', + priority: 400, + terminal: true, + transclude: 'element', + compile: function(element, attr, transclusion) { + var srcExp = attr.ngInclude || attr.src, + onloadExp = attr.onload || '', + autoScrollExp = attr.autoscroll; + + return function(scope, $element) { + var changeCounter = 0, + currentScope, + currentElement; + + var cleanupLastIncludeContent = function() { + if (currentScope) { + currentScope.$destroy(); + currentScope = null; + } + if(currentElement) { + $animate.leave(currentElement); + currentElement = null; + } + }; + + scope.$watch($sce.parseAsResourceUrl(srcExp), function ngIncludeWatchAction(src) { + var afterAnimation = function() { + if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) { + $anchorScroll(); + } + }; + var thisChangeId = ++changeCounter; + + if (src) { + $http.get(src, {cache: $templateCache}).success(function(response) { + if (thisChangeId !== changeCounter) return; + var newScope = scope.$new(); + + transclusion(newScope, function(clone) { + cleanupLastIncludeContent(); + + currentScope = newScope; + currentElement = clone; + + currentElement.html(response); + $animate.enter(currentElement, null, $element, afterAnimation); + $compile(currentElement.contents())(currentScope); + currentScope.$emit('$includeContentLoaded'); + scope.$eval(onloadExp); + }); + }).error(function() { + if (thisChangeId === changeCounter) cleanupLastIncludeContent(); + }); + scope.$emit('$includeContentRequested'); + } else { + cleanupLastIncludeContent(); + } + }); + }; + } + }; +}]; + +/** + * @ngdoc directive + * @name ng.directive:ngInit + * @restrict AC + * + * @description + * The `ngInit` directive allows you to evaluate an expression in the + * current scope. + * + *
+ * The only appropriate use of `ngInit` for aliasing special properties of + * {@link api/ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below. Besides this case, you + * should use {@link guide/controller controllers} rather than `ngInit` + * to initialize values on a scope. + *
+ * + * @element ANY + * @param {expression} ngInit {@link guide/expression Expression} to eval. + * + * @example + + + +
+
+
+ list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}}; +
+
+
+
+ + it('should alias index positions', function() { + expect(element('.example-init').text()) + .toBe('list[ 0 ][ 0 ] = a;' + + 'list[ 0 ][ 1 ] = b;' + + 'list[ 1 ][ 0 ] = c;' + + 'list[ 1 ][ 1 ] = d;'); + }); + +
+ */ +var ngInitDirective = ngDirective({ + compile: function() { + return { + pre: function(scope, element, attrs) { + scope.$eval(attrs.ngInit); + } + }; + } +}); + +/** + * @ngdoc directive + * @name ng.directive:ngNonBindable + * @restrict AC + * @priority 1000 + * + * @description + * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current + * DOM element. This is useful if the element contains what appears to be Angular directives and + * bindings but which should be ignored by Angular. This could be the case if you have a site that + * displays snippets of code, for instance. + * + * @element ANY + * + * @example + * In this example there are two locations where a simple interpolation binding (`{{}}`) is present, + * but the one wrapped in `ngNonBindable` is left alone. + * + * @example + + +
Normal: {{1 + 2}}
+
Ignored: {{1 + 2}}
+
+ + it('should check ng-non-bindable', function() { + expect(using('.doc-example-live').binding('1 + 2')).toBe('3'); + expect(using('.doc-example-live').element('div:last').text()). + toMatch(/1 \+ 2/); + }); + +
+ */ +var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 }); + +/** + * @ngdoc directive + * @name ng.directive:ngPluralize + * @restrict EA + * + * @description + * # Overview + * `ngPluralize` is a directive that displays messages according to en-US localization rules. + * These rules are bundled with angular.js, but can be overridden + * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive + * by specifying the mappings between + * {@link http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html + * plural categories} and the strings to be displayed. + * + * # Plural categories and explicit number rules + * There are two + * {@link http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html + * plural categories} in Angular's default en-US locale: "one" and "other". + * + * While a plural category may match many numbers (for example, in en-US locale, "other" can match + * any number that is not 1), an explicit number rule can only match one number. For example, the + * explicit number rule for "3" matches the number 3. There are examples of plural categories + * and explicit number rules throughout the rest of this documentation. + * + * # Configuring ngPluralize + * You configure ngPluralize by providing 2 attributes: `count` and `when`. + * You can also provide an optional attribute, `offset`. + * + * The value of the `count` attribute can be either a string or an {@link guide/expression + * Angular expression}; these are evaluated on the current scope for its bound value. + * + * The `when` attribute specifies the mappings between plural categories and the actual + * string to be displayed. The value of the attribute should be a JSON object. + * + * The following example shows how to configure ngPluralize: + * + *
+ * 
+ * 
+ *
+ * + * In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not + * specify this rule, 0 would be matched to the "other" category and "0 people are viewing" + * would be shown instead of "Nobody is viewing". You can specify an explicit number rule for + * other numbers, for example 12, so that instead of showing "12 people are viewing", you can + * show "a dozen people are viewing". + * + * You can use a set of closed braces(`{}`) as a placeholder for the number that you want substituted + * into pluralized strings. In the previous example, Angular will replace `{}` with + * `{{personCount}}`. The closed braces `{}` is a placeholder + * for {{numberExpression}}. + * + * # Configuring ngPluralize with offset + * The `offset` attribute allows further customization of pluralized text, which can result in + * a better user experience. For example, instead of the message "4 people are viewing this document", + * you might display "John, Kate and 2 others are viewing this document". + * The offset attribute allows you to offset a number by any desired value. + * Let's take a look at an example: + * + *
+ * 
+ * 
+ * 
+ * + * Notice that we are still using two plural categories(one, other), but we added + * three explicit number rules 0, 1 and 2. + * When one person, perhaps John, views the document, "John is viewing" will be shown. + * When three people view the document, no explicit number rule is found, so + * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category. + * In this case, plural category 'one' is matched and "John, Marry and one other person are viewing" + * is shown. + * + * Note that when you specify offsets, you must provide explicit number rules for + * numbers from 0 up to and including the offset. If you use an offset of 3, for example, + * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for + * plural categories "one" and "other". + * + * @param {string|expression} count The variable to be bounded to. + * @param {string} when The mapping between plural category to its corresponding strings. + * @param {number=} offset Offset to deduct from the total number. + * + * @example + + + +
+ Person 1:
+ Person 2:
+ Number of People:
+ + + Without Offset: + +
+ + + With Offset(2): + + +
+
+ + it('should show correct pluralized string', function() { + expect(element('.doc-example-live ng-pluralize:first').text()). + toBe('1 person is viewing.'); + expect(element('.doc-example-live ng-pluralize:last').text()). + toBe('Igor is viewing.'); + + using('.doc-example-live').input('personCount').enter('0'); + expect(element('.doc-example-live ng-pluralize:first').text()). + toBe('Nobody is viewing.'); + expect(element('.doc-example-live ng-pluralize:last').text()). + toBe('Nobody is viewing.'); + + using('.doc-example-live').input('personCount').enter('2'); + expect(element('.doc-example-live ng-pluralize:first').text()). + toBe('2 people are viewing.'); + expect(element('.doc-example-live ng-pluralize:last').text()). + toBe('Igor and Misko are viewing.'); + + using('.doc-example-live').input('personCount').enter('3'); + expect(element('.doc-example-live ng-pluralize:first').text()). + toBe('3 people are viewing.'); + expect(element('.doc-example-live ng-pluralize:last').text()). + toBe('Igor, Misko and one other person are viewing.'); + + using('.doc-example-live').input('personCount').enter('4'); + expect(element('.doc-example-live ng-pluralize:first').text()). + toBe('4 people are viewing.'); + expect(element('.doc-example-live ng-pluralize:last').text()). + toBe('Igor, Misko and 2 other people are viewing.'); + }); + + it('should show data-binded names', function() { + using('.doc-example-live').input('personCount').enter('4'); + expect(element('.doc-example-live ng-pluralize:last').text()). + toBe('Igor, Misko and 2 other people are viewing.'); + + using('.doc-example-live').input('person1').enter('Di'); + using('.doc-example-live').input('person2').enter('Vojta'); + expect(element('.doc-example-live ng-pluralize:last').text()). + toBe('Di, Vojta and 2 other people are viewing.'); + }); + +
+ */ +var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interpolate) { + var BRACE = /{}/g; + return { + restrict: 'EA', + link: function(scope, element, attr) { + var numberExp = attr.count, + whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs + offset = attr.offset || 0, + whens = scope.$eval(whenExp) || {}, + whensExpFns = {}, + startSymbol = $interpolate.startSymbol(), + endSymbol = $interpolate.endSymbol(), + isWhen = /^when(Minus)?(.+)$/; + + forEach(attr, function(expression, attributeName) { + if (isWhen.test(attributeName)) { + whens[lowercase(attributeName.replace('when', '').replace('Minus', '-'))] = + element.attr(attr.$attr[attributeName]); + } + }); + forEach(whens, function(expression, key) { + whensExpFns[key] = + $interpolate(expression.replace(BRACE, startSymbol + numberExp + '-' + + offset + endSymbol)); + }); + + scope.$watch(function ngPluralizeWatch() { + var value = parseFloat(scope.$eval(numberExp)); + + if (!isNaN(value)) { + //if explicit number rule such as 1, 2, 3... is defined, just use it. Otherwise, + //check it against pluralization rules in $locale service + if (!(value in whens)) value = $locale.pluralCat(value - offset); + return whensExpFns[value](scope, element, true); + } else { + return ''; + } + }, function ngPluralizeWatchAction(newVal) { + element.text(newVal); + }); + } + }; +}]; + +/** + * @ngdoc directive + * @name ng.directive:ngRepeat + * + * @description + * The `ngRepeat` directive instantiates a template once per item from a collection. Each template + * instance gets its own scope, where the given loop variable is set to the current collection item, + * and `$index` is set to the item index or key. + * + * Special properties are exposed on the local scope of each template instance, including: + * + * | Variable | Type | Details | + * |-----------|-----------------|-----------------------------------------------------------------------------| + * | `$index` | {@type number} | iterator offset of the repeated element (0..length-1) | + * | `$first` | {@type boolean} | true if the repeated element is first in the iterator. | + * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. | + * | `$last` | {@type boolean} | true if the repeated element is last in the iterator. | + * | `$even` | {@type boolean} | true if the iterator position `$index` is even (otherwise false). | + * | `$odd` | {@type boolean} | true if the iterator position `$index` is odd (otherwise false). | + * + * + * # Special repeat start and end points + * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending + * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively. + * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on) + * up to and including the ending HTML tag where **ng-repeat-end** is placed. + * + * The example below makes use of this feature: + *
+ *   
+ * Header {{ item }} + *
+ *
+ * Body {{ item }} + *
+ *
+ * Footer {{ item }} + *
+ *
+ * + * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to: + *
+ *   
+ * Header A + *
+ *
+ * Body A + *
+ *
+ * Footer A + *
+ *
+ * Header B + *
+ *
+ * Body B + *
+ *
+ * Footer B + *
+ *
+ * + * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such + * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**). + * + * @animations + * enter - when a new item is added to the list or when an item is revealed after a filter + * leave - when an item is removed from the list or when an item is filtered out + * move - when an adjacent item is filtered out causing a reorder or when the item contents are reordered + * + * @element ANY + * @scope + * @priority 1000 + * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These + * formats are currently supported: + * + * * `variable in expression` – where variable is the user defined loop variable and `expression` + * is a scope expression giving the collection to enumerate. + * + * For example: `album in artist.albums`. + * + * * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers, + * and `expression` is the scope expression giving the collection to enumerate. + * + * For example: `(name, age) in {'adam':10, 'amalie':12}`. + * + * * `variable in expression track by tracking_expression` – You can also provide an optional tracking function + * which can be used to associate the objects in the collection with the DOM elements. If no tracking function + * is specified the ng-repeat associates elements by identity in the collection. It is an error to have + * more than one tracking function to resolve to the same key. (This would mean that two distinct objects are + * mapped to the same DOM element, which is not possible.) Filters should be applied to the expression, + * before specifying a tracking expression. + * + * For example: `item in items` is equivalent to `item in items track by $id(item)'. This implies that the DOM elements + * will be associated by item identity in the array. + * + * For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique + * `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements + * with the corresponding item in the array by identity. Moving the same object in array would move the DOM + * element in the same way ian the DOM. + * + * For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this + * case the object identity does not matter. Two objects are considered equivalent as long as their `id` + * property is same. + * + * For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter + * to items in conjunction with a tracking expression. + * + * @example + * This example initializes the scope to a list of names and + * then uses `ngRepeat` to display every person: + + +
+ I have {{friends.length}} friends. They are: + +
    +
  • + [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old. +
  • +
+
+
+ + .example-animate-container { + background:white; + border:1px solid black; + list-style:none; + margin:0; + padding:0 10px; + } + + .animate-repeat { + line-height:40px; + list-style:none; + box-sizing:border-box; + } + + .animate-repeat.ng-move, + .animate-repeat.ng-enter, + .animate-repeat.ng-leave { + -webkit-transition:all linear 0.5s; + transition:all linear 0.5s; + } + + .animate-repeat.ng-leave.ng-leave-active, + .animate-repeat.ng-move, + .animate-repeat.ng-enter { + opacity:0; + max-height:0; + } + + .animate-repeat.ng-leave, + .animate-repeat.ng-move.ng-move-active, + .animate-repeat.ng-enter.ng-enter-active { + opacity:1; + max-height:40px; + } + + + it('should render initial data set', function() { + var r = using('.doc-example-live').repeater('ul li'); + expect(r.count()).toBe(10); + expect(r.row(0)).toEqual(["1","John","25"]); + expect(r.row(1)).toEqual(["2","Jessie","30"]); + expect(r.row(9)).toEqual(["10","Samantha","60"]); + expect(binding('friends.length')).toBe("10"); + }); + + it('should update repeater when filter predicate changes', function() { + var r = using('.doc-example-live').repeater('ul li'); + expect(r.count()).toBe(10); + + input('q').enter('ma'); + + expect(r.count()).toBe(2); + expect(r.row(0)).toEqual(["1","Mary","28"]); + expect(r.row(1)).toEqual(["2","Samantha","60"]); + }); + +
+ */ +var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { + var NG_REMOVED = '$$NG_REMOVED'; + var ngRepeatMinErr = minErr('ngRepeat'); + return { + transclude: 'element', + priority: 1000, + terminal: true, + $$tlb: true, + compile: function(element, attr, linker) { + return function($scope, $element, $attr){ + var expression = $attr.ngRepeat; + var match = expression.match(/^\s*(.+)\s+in\s+(.*?)\s*(\s+track\s+by\s+(.+)\s*)?$/), + trackByExp, trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn, + lhs, rhs, valueIdentifier, keyIdentifier, + hashFnLocals = {$id: hashKey}; + + if (!match) { + throw ngRepeatMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.", + expression); + } + + lhs = match[1]; + rhs = match[2]; + trackByExp = match[4]; + + if (trackByExp) { + trackByExpGetter = $parse(trackByExp); + trackByIdExpFn = function(key, value, index) { + // assign key, value, and $index to the locals so that they can be used in hash functions + if (keyIdentifier) hashFnLocals[keyIdentifier] = key; + hashFnLocals[valueIdentifier] = value; + hashFnLocals.$index = index; + return trackByExpGetter($scope, hashFnLocals); + }; + } else { + trackByIdArrayFn = function(key, value) { + return hashKey(value); + }; + trackByIdObjFn = function(key) { + return key; + }; + } + + match = lhs.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/); + if (!match) { + throw ngRepeatMinErr('iidexp', "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.", + lhs); + } + valueIdentifier = match[3] || match[1]; + keyIdentifier = match[2]; + + // Store a list of elements from previous run. This is a hash where key is the item from the + // iterator, and the value is objects with following properties. + // - scope: bound scope + // - element: previous element. + // - index: position + var lastBlockMap = {}; + + //watch props + $scope.$watchCollection(rhs, function ngRepeatAction(collection){ + var index, length, + previousNode = $element[0], // current position of the node + nextNode, + // Same as lastBlockMap but it has the current state. It will become the + // lastBlockMap on the next iteration. + nextBlockMap = {}, + arrayLength, + childScope, + key, value, // key/value of iteration + trackById, + trackByIdFn, + collectionKeys, + block, // last object information {scope, element, id} + nextBlockOrder = [], + elementsToRemove; + + + if (isArrayLike(collection)) { + collectionKeys = collection; + trackByIdFn = trackByIdExpFn || trackByIdArrayFn; + } else { + trackByIdFn = trackByIdExpFn || trackByIdObjFn; + // if object, extract keys, sort them and use to determine order of iteration over obj props + collectionKeys = []; + for (key in collection) { + if (collection.hasOwnProperty(key) && key.charAt(0) != '$') { + collectionKeys.push(key); + } + } + collectionKeys.sort(); + } + + arrayLength = collectionKeys.length; + + // locate existing items + length = nextBlockOrder.length = collectionKeys.length; + for(index = 0; index < length; index++) { + key = (collection === collectionKeys) ? index : collectionKeys[index]; + value = collection[key]; + trackById = trackByIdFn(key, value, index); + assertNotHasOwnProperty(trackById, '`track by` id'); + if(lastBlockMap.hasOwnProperty(trackById)) { + block = lastBlockMap[trackById]; + delete lastBlockMap[trackById]; + nextBlockMap[trackById] = block; + nextBlockOrder[index] = block; + } else if (nextBlockMap.hasOwnProperty(trackById)) { + // restore lastBlockMap + forEach(nextBlockOrder, function(block) { + if (block && block.startNode) lastBlockMap[block.id] = block; + }); + // This is a duplicate and we need to throw an error + throw ngRepeatMinErr('dupes', "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}", + expression, trackById); + } else { + // new never before seen block + nextBlockOrder[index] = { id: trackById }; + nextBlockMap[trackById] = false; + } + } + + // remove existing items + for (key in lastBlockMap) { + // lastBlockMap is our own object so we don't need to use special hasOwnPropertyFn + if (lastBlockMap.hasOwnProperty(key)) { + block = lastBlockMap[key]; + elementsToRemove = getBlockElements(block); + $animate.leave(elementsToRemove); + forEach(elementsToRemove, function(element) { element[NG_REMOVED] = true; }); + block.scope.$destroy(); + } + } + + // we are not using forEach for perf reasons (trying to avoid #call) + for (index = 0, length = collectionKeys.length; index < length; index++) { + key = (collection === collectionKeys) ? index : collectionKeys[index]; + value = collection[key]; + block = nextBlockOrder[index]; + if (nextBlockOrder[index - 1]) previousNode = nextBlockOrder[index - 1].endNode; + + if (block.startNode) { + // if we have already seen this object, then we need to reuse the + // associated scope/element + childScope = block.scope; + + nextNode = previousNode; + do { + nextNode = nextNode.nextSibling; + } while(nextNode && nextNode[NG_REMOVED]); + + if (block.startNode != nextNode) { + // existing item which got moved + $animate.move(getBlockElements(block), null, jqLite(previousNode)); + } + previousNode = block.endNode; + } else { + // new item which we don't know about + childScope = $scope.$new(); + } + + childScope[valueIdentifier] = value; + if (keyIdentifier) childScope[keyIdentifier] = key; + childScope.$index = index; + childScope.$first = (index === 0); + childScope.$last = (index === (arrayLength - 1)); + childScope.$middle = !(childScope.$first || childScope.$last); + // jshint bitwise: false + childScope.$odd = !(childScope.$even = (index&1) === 0); + // jshint bitwise: true + + if (!block.startNode) { + linker(childScope, function(clone) { + clone[clone.length++] = document.createComment(' end ngRepeat: ' + expression + ' '); + $animate.enter(clone, null, jqLite(previousNode)); + previousNode = clone; + block.scope = childScope; + block.startNode = previousNode && previousNode.endNode ? previousNode.endNode : clone[0]; + block.endNode = clone[clone.length - 1]; + nextBlockMap[block.id] = block; + }); + } + } + lastBlockMap = nextBlockMap; + }); + }; + } + }; +}]; + +/** + * @ngdoc directive + * @name ng.directive:ngShow + * + * @description + * The `ngShow` directive shows or hides the given HTML element based on the expression + * provided to the ngShow attribute. The element is shown or hidden by removing or adding + * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined + * in AngularJS and sets the display style to none (using an !important flag). + * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}). + * + *
+ * 
+ * 
+ * + * + *
+ *
+ * + * When the ngShow expression evaluates to false then the ng-hide CSS class is added to the class attribute + * on the element causing it to become hidden. When true, the ng-hide CSS class is removed + * from the element causing the element not to appear hidden. + * + * ## Why is !important used? + * + * You may be wondering why !important is used for the .ng-hide CSS class. This is because the `.ng-hide` selector + * can be easily overridden by heavier selectors. For example, something as simple + * as changing the display style on a HTML list item would make hidden elements appear visible. + * This also becomes a bigger issue when dealing with CSS frameworks. + * + * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector + * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the + * styling to change how to hide an element then it is just a matter of using !important in their own CSS code. + * + * ### Overriding .ng-hide + * + * If you wish to change the hide behavior with ngShow/ngHide then this can be achieved by + * restating the styles for the .ng-hide class in CSS: + *
+ * .ng-hide {
+ *   //!annotate CSS Specificity|Not to worry, this will override the AngularJS default...
+ *   display:block!important;
+ *
+ *   //this is just another form of hiding an element
+ *   position:absolute;
+ *   top:-9999px;
+ *   left:-9999px;
+ * }
+ * 
+ * + * Just remember to include the important flag so the CSS override will function. + * + * ## A note about animations with ngShow + * + * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression + * is true and false. This system works like the animation system present with ngClass except that + * you must also include the !important flag to override the display property + * so that you can perform an animation when the element is hidden during the time of the animation. + * + *
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
+ * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ *   transition:0.5s linear all;
+ *   display:block!important;
+ * }
+ *
+ * .my-element.ng-hide-add { ... }
+ * .my-element.ng-hide-add.ng-hide-add-active { ... }
+ * .my-element.ng-hide-remove { ... }
+ * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+ * 
+ * + * @animations + * addClass: .ng-hide - happens after the ngShow expression evaluates to a truthy value and the just before contents are set to visible + * removeClass: .ng-hide - happens after the ngShow expression evaluates to a non truthy value and just before the contents are set to hidden + * + * @element ANY + * @param {expression} ngShow If the {@link guide/expression expression} is truthy + * then the element is shown or hidden respectively. + * + * @example + + + Click me:
+
+ Show: +
+ I show up when your checkbox is checked. +
+
+
+ Hide: +
+ I hide when your checkbox is checked. +
+
+
+ + .animate-show { + -webkit-transition:all linear 0.5s; + transition:all linear 0.5s; + line-height:20px; + opacity:1; + padding:10px; + border:1px solid black; + background:white; + } + + .animate-show.ng-hide-add, + .animate-show.ng-hide-remove { + display:block!important; + } + + .animate-show.ng-hide { + line-height:0; + opacity:0; + padding:0 10px; + } + + .check-element { + padding:10px; + border:1px solid black; + background:white; + } + + + it('should check ng-show / ng-hide', function() { + expect(element('.doc-example-live span:first:hidden').count()).toEqual(1); + expect(element('.doc-example-live span:last:visible').count()).toEqual(1); + + input('checked').check(); + + expect(element('.doc-example-live span:first:visible').count()).toEqual(1); + expect(element('.doc-example-live span:last:hidden').count()).toEqual(1); + }); + +
+ */ +var ngShowDirective = ['$animate', function($animate) { + return function(scope, element, attr) { + scope.$watch(attr.ngShow, function ngShowWatchAction(value){ + $animate[toBoolean(value) ? 'removeClass' : 'addClass'](element, 'ng-hide'); + }); + }; +}]; + + +/** + * @ngdoc directive + * @name ng.directive:ngHide + * + * @description + * The `ngHide` directive shows or hides the given HTML element based on the expression + * provided to the ngHide attribute. The element is shown or hidden by removing or adding + * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined + * in AngularJS and sets the display style to none (using an !important flag). + * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}). + * + *
+ * 
+ * 
+ * + * + *
+ *
+ * + * When the ngHide expression evaluates to true then the .ng-hide CSS class is added to the class attribute + * on the element causing it to become hidden. When false, the ng-hide CSS class is removed + * from the element causing the element not to appear hidden. + * + * ## Why is !important used? + * + * You may be wondering why !important is used for the .ng-hide CSS class. This is because the `.ng-hide` selector + * can be easily overridden by heavier selectors. For example, something as simple + * as changing the display style on a HTML list item would make hidden elements appear visible. + * This also becomes a bigger issue when dealing with CSS frameworks. + * + * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector + * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the + * styling to change how to hide an element then it is just a matter of using !important in their own CSS code. + * + * ### Overriding .ng-hide + * + * If you wish to change the hide behavior with ngShow/ngHide then this can be achieved by + * restating the styles for the .ng-hide class in CSS: + *
+ * .ng-hide {
+ *   //!annotate CSS Specificity|Not to worry, this will override the AngularJS default...
+ *   display:block!important;
+ *
+ *   //this is just another form of hiding an element
+ *   position:absolute;
+ *   top:-9999px;
+ *   left:-9999px;
+ * }
+ * 
+ * + * Just remember to include the important flag so the CSS override will function. + * + * ## A note about animations with ngHide + * + * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression + * is true and false. This system works like the animation system present with ngClass, except that + * you must also include the !important flag to override the display property so + * that you can perform an animation when the element is hidden during the time of the animation. + * + *
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
+ * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ *   transition:0.5s linear all;
+ *   display:block!important;
+ * }
+ *
+ * .my-element.ng-hide-add { ... }
+ * .my-element.ng-hide-add.ng-hide-add-active { ... }
+ * .my-element.ng-hide-remove { ... }
+ * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+ * 
+ * + * @animations + * removeClass: .ng-hide - happens after the ngHide expression evaluates to a truthy value and just before the contents are set to hidden + * addClass: .ng-hide - happens after the ngHide expression evaluates to a non truthy value and just before the contents are set to visible + * + * @element ANY + * @param {expression} ngHide If the {@link guide/expression expression} is truthy then + * the element is shown or hidden respectively. + * + * @example + + + Click me:
+
+ Show: +
+ I show up when your checkbox is checked. +
+
+
+ Hide: +
+ I hide when your checkbox is checked. +
+
+
+ + .animate-hide { + -webkit-transition:all linear 0.5s; + transition:all linear 0.5s; + line-height:20px; + opacity:1; + padding:10px; + border:1px solid black; + background:white; + } + + .animate-hide.ng-hide-add, + .animate-hide.ng-hide-remove { + display:block!important; + } + + .animate-hide.ng-hide { + line-height:0; + opacity:0; + padding:0 10px; + } + + .check-element { + padding:10px; + border:1px solid black; + background:white; + } + + + it('should check ng-show / ng-hide', function() { + expect(element('.doc-example-live .check-element:first:hidden').count()).toEqual(1); + expect(element('.doc-example-live .check-element:last:visible').count()).toEqual(1); + + input('checked').check(); + + expect(element('.doc-example-live .check-element:first:visible').count()).toEqual(1); + expect(element('.doc-example-live .check-element:last:hidden').count()).toEqual(1); + }); + +
+ */ +var ngHideDirective = ['$animate', function($animate) { + return function(scope, element, attr) { + scope.$watch(attr.ngHide, function ngHideWatchAction(value){ + $animate[toBoolean(value) ? 'addClass' : 'removeClass'](element, 'ng-hide'); + }); + }; +}]; + +/** + * @ngdoc directive + * @name ng.directive:ngStyle + * @restrict AC + * + * @description + * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally. + * + * @element ANY + * @param {expression} ngStyle {@link guide/expression Expression} which evals to an + * object whose keys are CSS style names and values are corresponding values for those CSS + * keys. + * + * @example + + + + +
+ Sample Text +
myStyle={{myStyle}}
+
+ + span { + color: black; + } + + + it('should check ng-style', function() { + expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)'); + element('.doc-example-live :button[value=set]').click(); + expect(element('.doc-example-live span').css('color')).toBe('rgb(255, 0, 0)'); + element('.doc-example-live :button[value=clear]').click(); + expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)'); + }); + +
+ */ +var ngStyleDirective = ngDirective(function(scope, element, attr) { + scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) { + if (oldStyles && (newStyles !== oldStyles)) { + forEach(oldStyles, function(val, style) { element.css(style, '');}); + } + if (newStyles) element.css(newStyles); + }, true); +}); + +/** + * @ngdoc directive + * @name ng.directive:ngSwitch + * @restrict EA + * + * @description + * The ngSwitch directive is used to conditionally swap DOM structure on your template based on a scope expression. + * Elements within ngSwitch but without ngSwitchWhen or ngSwitchDefault directives will be preserved at the location + * as specified in the template. + * + * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it + * from the template cache), ngSwitch simply choses one of the nested elements and makes it visible based on which element + * matches the value obtained from the evaluated expression. In other words, you define a container element + * (where you place the directive), place an expression on the **on="..." attribute** + * (or the **ng-switch="..." attribute**), define any inner elements inside of the directive and place + * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on + * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default + * attribute is displayed. + * + * @animations + * enter - happens after the ngSwitch contents change and the matched child element is placed inside the container + * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM + * + * @usage + * + * ... + * ... + * ... + * + * + * @scope + * @priority 800 + * @param {*} ngSwitch|on expression to match against ng-switch-when. + * @paramDescription + * On child elements add: + * + * * `ngSwitchWhen`: the case statement to match against. If match then this + * case will be displayed. If the same match appears multiple times, all the + * elements will be displayed. + * * `ngSwitchDefault`: the default case when no other case match. If there + * are multiple default cases, all of them will be displayed when no other + * case match. + * + * + * @example + + +
+ + selection={{selection}} +
+
+
Settings Div
+
Home Span
+
default
+
+
+
+ + function Ctrl($scope) { + $scope.items = ['settings', 'home', 'other']; + $scope.selection = $scope.items[0]; + } + + + .animate-switch-container { + position:relative; + background:white; + border:1px solid black; + height:40px; + overflow:hidden; + } + + .animate-switch { + padding:10px; + } + + .animate-switch.ng-animate { + -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; + transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; + + position:absolute; + top:0; + left:0; + right:0; + bottom:0; + } + + .animate-switch.ng-leave.ng-leave-active, + .animate-switch.ng-enter { + top:-50px; + } + .animate-switch.ng-leave, + .animate-switch.ng-enter.ng-enter-active { + top:0; + } + + + it('should start in settings', function() { + expect(element('.doc-example-live [ng-switch]').text()).toMatch(/Settings Div/); + }); + it('should change to home', function() { + select('selection').option('home'); + expect(element('.doc-example-live [ng-switch]').text()).toMatch(/Home Span/); + }); + it('should select default', function() { + select('selection').option('other'); + expect(element('.doc-example-live [ng-switch]').text()).toMatch(/default/); + }); + +
+ */ +var ngSwitchDirective = ['$animate', function($animate) { + return { + restrict: 'EA', + require: 'ngSwitch', + + // asks for $scope to fool the BC controller module + controller: ['$scope', function ngSwitchController() { + this.cases = {}; + }], + link: function(scope, element, attr, ngSwitchController) { + var watchExpr = attr.ngSwitch || attr.on, + selectedTranscludes, + selectedElements, + selectedScopes = []; + + scope.$watch(watchExpr, function ngSwitchWatchAction(value) { + for (var i= 0, ii=selectedScopes.length; i + + +
+
+
+ {{text}} +
+
+ + it('should have transcluded', function() { + input('title').enter('TITLE'); + input('text').enter('TEXT'); + expect(binding('title')).toEqual('TITLE'); + expect(binding('text')).toEqual('TEXT'); + }); + + + * + */ +var ngTranscludeDirective = ngDirective({ + controller: ['$element', '$transclude', function($element, $transclude) { + if (!$transclude) { + throw minErr('ngTransclude')('orphan', + 'Illegal use of ngTransclude directive in the template! ' + + 'No parent directive that requires a transclusion found. ' + + 'Element: {0}', + startingTag($element)); + } + + // remember the transclusion fn but call it during linking so that we don't process transclusion before directives on + // the parent element even when the transclusion replaces the current element. (we can't use priority here because + // that applies only to compile fns and not controllers + this.$transclude = $transclude; + }], + + link: function($scope, $element, $attrs, controller) { + controller.$transclude(function(clone) { + $element.html(''); + $element.append(clone); + }); + } +}); + +/** + * @ngdoc directive + * @name ng.directive:script + * @restrict E + * + * @description + * Load content of a script tag, with type `text/ng-template`, into `$templateCache`, so that the + * template can be used by `ngInclude`, `ngView` or directive templates. + * + * @param {'text/ng-template'} type must be set to `'text/ng-template'` + * + * @example + + + + + Load inlined template +
+
+ + it('should load template defined inside script tag', function() { + element('#tpl-link').click(); + expect(element('#tpl-content').text()).toMatch(/Content of the template/); + }); + +
+ */ +var scriptDirective = ['$templateCache', function($templateCache) { + return { + restrict: 'E', + terminal: true, + compile: function(element, attr) { + if (attr.type == 'text/ng-template') { + var templateUrl = attr.id, + // IE is not consistent, in scripts we have to read .text but in other nodes we have to read .textContent + text = element[0].text; + + $templateCache.put(templateUrl, text); + } + } + }; +}]; + +var ngOptionsMinErr = minErr('ngOptions'); +/** + * @ngdoc directive + * @name ng.directive:select + * @restrict E + * + * @description + * HTML `SELECT` element with angular data-binding. + * + * # `ngOptions` + * + * The `ngOptions` attribute can be used to dynamically generate a list of `` + * DOM element. + * * `trackexpr`: Used when working with an array of objects. The result of this expression will be + * used to identify the objects in the array. The `trackexpr` will most likely refer to the + * `value` variable (e.g. `value.propertyName`). + * + * @example + + + +
+
    +
  • + Name: + [X] +
  • +
  • + [add] +
  • +
+
+ Color (null not allowed): +
+ + Color (null allowed): + + +
+ + Color grouped by shade: +
+ + + Select bogus.
+
+ Currently selected: {{ {selected_color:color} }} +
+
+
+
+ + it('should check ng-options', function() { + expect(binding('{selected_color:color}')).toMatch('red'); + select('color').option('0'); + expect(binding('{selected_color:color}')).toMatch('black'); + using('.nullable').select('color').option(''); + expect(binding('{selected_color:color}')).toMatch('null'); + }); + +
+ */ + +var ngOptionsDirective = valueFn({ terminal: true }); +// jshint maxlen: false +var selectDirective = ['$compile', '$parse', function($compile, $parse) { + //0000111110000000000022220000000000000000000000333300000000000000444444444444444000000000555555555555555000000066666666666666600000000000000007777000000000000000000088888 + var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/, + nullModelCtrl = {$setViewValue: noop}; +// jshint maxlen: 100 + + return { + restrict: 'E', + require: ['select', '?ngModel'], + controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) { + var self = this, + optionsMap = {}, + ngModelCtrl = nullModelCtrl, + nullOption, + unknownOption; + + + self.databound = $attrs.ngModel; + + + self.init = function(ngModelCtrl_, nullOption_, unknownOption_) { + ngModelCtrl = ngModelCtrl_; + nullOption = nullOption_; + unknownOption = unknownOption_; + }; + + + self.addOption = function(value) { + assertNotHasOwnProperty(value, '"option value"'); + optionsMap[value] = true; + + if (ngModelCtrl.$viewValue == value) { + $element.val(value); + if (unknownOption.parent()) unknownOption.remove(); + } + }; + + + self.removeOption = function(value) { + if (this.hasOption(value)) { + delete optionsMap[value]; + if (ngModelCtrl.$viewValue == value) { + this.renderUnknownOption(value); + } + } + }; + + + self.renderUnknownOption = function(val) { + var unknownVal = '? ' + hashKey(val) + ' ?'; + unknownOption.val(unknownVal); + $element.prepend(unknownOption); + $element.val(unknownVal); + unknownOption.prop('selected', true); // needed for IE + }; + + + self.hasOption = function(value) { + return optionsMap.hasOwnProperty(value); + }; + + $scope.$on('$destroy', function() { + // disable unknown option so that we don't do work when the whole select is being destroyed + self.renderUnknownOption = noop; + }); + }], + + link: function(scope, element, attr, ctrls) { + // if ngModel is not defined, we don't need to do anything + if (!ctrls[1]) return; + + var selectCtrl = ctrls[0], + ngModelCtrl = ctrls[1], + multiple = attr.multiple, + optionsExp = attr.ngOptions, + nullOption = false, // if false, user will not be able to select it (used by ngOptions) + emptyOption, + // we can't just jqLite('