sw2at-ui 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (387) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/Gemfile +21 -0
  4. data/LICENSE.txt +20 -0
  5. data/README.rdoc +19 -0
  6. data/Rakefile +51 -0
  7. data/VERSION +1 -0
  8. data/app/assets/images/swat/loading-green.gif +0 -0
  9. data/app/assets/javascripts/swat/.bowerrc +3 -0
  10. data/app/assets/javascripts/swat/app/app.coffee +38 -0
  11. data/app/assets/javascripts/swat/app/controllers/revision.coffee +25 -0
  12. data/app/assets/javascripts/swat/app/controllers/revisions.coffee +10 -0
  13. data/app/assets/javascripts/swat/app/controllers/root.coffee +8 -0
  14. data/app/assets/javascripts/swat/app/factories/response.coffee +9 -0
  15. data/app/assets/javascripts/swat/app/factories/revision_model.coffee +20 -0
  16. data/app/assets/javascripts/swat/app/services/revision.coffee +16 -0
  17. data/app/assets/javascripts/swat/app/services/test_case.coffee +8 -0
  18. data/app/assets/javascripts/swat/application.coffee +5 -0
  19. data/app/assets/javascripts/swat/bower.json +16 -0
  20. data/app/assets/javascripts/swat/bower_components/angular/angular-csp.css +21 -0
  21. data/app/assets/javascripts/swat/bower_components/angular/angular.js +28133 -0
  22. data/app/assets/javascripts/swat/bower_components/angular/angular.min.js +289 -0
  23. data/app/assets/javascripts/swat/bower_components/angular/index.js +2 -0
  24. data/app/assets/javascripts/swat/bower_components/angular-animate/angular-animate.js +2137 -0
  25. data/app/assets/javascripts/swat/bower_components/angular-animate/angular-animate.min.js +33 -0
  26. data/app/assets/javascripts/swat/bower_components/angular-aria/angular-aria.js +339 -0
  27. data/app/assets/javascripts/swat/bower_components/angular-aria/angular-aria.min.js +12 -0
  28. data/app/assets/javascripts/swat/bower_components/angular-bootstrap/ui-bootstrap-csp.css +6 -0
  29. data/app/assets/javascripts/swat/bower_components/angular-bootstrap/ui-bootstrap-tpls.js +4840 -0
  30. data/app/assets/javascripts/swat/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js +10 -0
  31. data/app/assets/javascripts/swat/bower_components/angular-bootstrap/ui-bootstrap.js +4461 -0
  32. data/app/assets/javascripts/swat/bower_components/angular-bootstrap/ui-bootstrap.min.js +9 -0
  33. data/app/assets/javascripts/swat/bower_components/angular-material/LICENSE.txt +21 -0
  34. data/app/assets/javascripts/swat/bower_components/angular-material/angular-material.css +6228 -0
  35. data/app/assets/javascripts/swat/bower_components/angular-material/angular-material.js +8602 -0
  36. data/app/assets/javascripts/swat/bower_components/angular-material/angular-material.min.css +6 -0
  37. data/app/assets/javascripts/swat/bower_components/angular-material/angular-material.min.js +277 -0
  38. data/app/assets/javascripts/swat/bower_components/angular-material/default-theme.css +394 -0
  39. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/backdrop/backdrop-default-theme.css +8 -0
  40. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/backdrop/backdrop.css +54 -0
  41. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/backdrop/backdrop.js +40 -0
  42. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/bottomSheet/bottomSheet-default-theme.css +15 -0
  43. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/bottomSheet/bottomSheet.css +161 -0
  44. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/bottomSheet/bottomSheet.js +263 -0
  45. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/button/button-default-theme.css +49 -0
  46. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/button/button.css +134 -0
  47. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/button/button.js +101 -0
  48. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/card/card-default-theme.css +10 -0
  49. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/card/card.css +26 -0
  50. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/card/card.js +60 -0
  51. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/checkbox/checkbox-default-theme.css +38 -0
  52. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/checkbox/checkbox.css +78 -0
  53. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/checkbox/checkbox.js +135 -0
  54. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/content/content-default-theme.css +8 -0
  55. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/content/content.css +24 -0
  56. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/content/content.js +87 -0
  57. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/core/core.css +2736 -0
  58. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/core/core.js +3090 -0
  59. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/core/default-theme.js +1 -0
  60. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/dialog/dialog-default-theme.css +11 -0
  61. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/dialog/dialog.css +75 -0
  62. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/dialog/dialog.js +500 -0
  63. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/divider/divider-default-theme.css +8 -0
  64. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/divider/divider.css +12 -0
  65. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/divider/divider.js +50 -0
  66. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/icon/icon.css +24 -0
  67. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/icon/icon.js +52 -0
  68. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/input/input-default-theme.css +39 -0
  69. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/input/input.css +113 -0
  70. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/input/input.js +355 -0
  71. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/list/list.css +56 -0
  72. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/list/list.js +96 -0
  73. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/menu/menu.css +6 -0
  74. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/menu/menu.js +29 -0
  75. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/progressCircular/progressCircular-default-theme.css +35 -0
  76. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/progressCircular/progressCircular.css +1395 -0
  77. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/progressCircular/progressCircular.js +129 -0
  78. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/progressLinear/progressLinear-default-theme.css +26 -0
  79. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/progressLinear/progressLinear.css +366 -0
  80. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/progressLinear/progressLinear.js +130 -0
  81. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/radioButton/radioButton-default-theme.css +39 -0
  82. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/radioButton/radioButton.css +66 -0
  83. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/radioButton/radioButton.js +302 -0
  84. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/sidenav/sidenav-default-theme.css +8 -0
  85. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/sidenav/sidenav.css +86 -0
  86. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/sidenav/sidenav.js +320 -0
  87. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/slider/slider-default-theme.css +55 -0
  88. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/slider/slider.css +210 -0
  89. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/slider/slider.js +391 -0
  90. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/sticky/sticky.css +20 -0
  91. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/sticky/sticky.js +314 -0
  92. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/subheader/subheader-default-theme.css +15 -0
  93. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/subheader/subheader.css +62 -0
  94. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/subheader/subheader.js +89 -0
  95. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/swipe/swipe.js +79 -0
  96. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/switch/switch-default-theme.css +29 -0
  97. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/switch/switch.css +81 -0
  98. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/switch/switch.js +171 -0
  99. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/tabs/tabs-default-theme.css +34 -0
  100. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/tabs/tabs.css +171 -0
  101. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/tabs/tabs.js +1009 -0
  102. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/textField/textField-default-theme.css +29 -0
  103. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/textField/textField.css +72 -0
  104. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/textField/textField.js +145 -0
  105. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/toast/toast-default-theme.css +17 -0
  106. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/toast/toast.css +110 -0
  107. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/toast/toast.js +236 -0
  108. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/toolbar/toolbar-default-theme.css +17 -0
  109. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/toolbar/toolbar.css +69 -0
  110. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/toolbar/toolbar.js +161 -0
  111. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/tooltip/tooltip-default-theme.css +10 -0
  112. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/tooltip/tooltip.css +133 -0
  113. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/tooltip/tooltip.js +199 -0
  114. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/whiteframe/whiteframe.css +20 -0
  115. data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/whiteframe/whiteframe.js +17 -0
  116. data/app/assets/javascripts/swat/bower_components/angular-material/modules/css/angular-material-layout.css +2582 -0
  117. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/backdrop-default-theme.css +8 -0
  118. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/backdrop-default-theme.min.css +6 -0
  119. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/backdrop.css +54 -0
  120. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/backdrop.js +38 -0
  121. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/backdrop.min.css +6 -0
  122. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/backdrop.min.js +7 -0
  123. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/bower.json +7 -0
  124. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bottomSheet-default-theme.css +15 -0
  125. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bottomSheet-default-theme.min.css +6 -0
  126. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bottomSheet.css +188 -0
  127. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bottomSheet.js +293 -0
  128. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bottomSheet.min.css +6 -0
  129. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bottomSheet.min.js +7 -0
  130. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bower.json +8 -0
  131. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/bower.json +7 -0
  132. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/button-default-theme.css +42 -0
  133. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/button-default-theme.min.css +6 -0
  134. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/button.css +132 -0
  135. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/button.js +94 -0
  136. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/button.min.css +6 -0
  137. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/button.min.js +7 -0
  138. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/bower.json +7 -0
  139. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/card-default-theme.css +10 -0
  140. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/card-default-theme.min.css +6 -0
  141. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/card.css +31 -0
  142. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/card.js +58 -0
  143. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/card.min.css +6 -0
  144. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/card.min.js +7 -0
  145. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/bower.json +7 -0
  146. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/checkbox-default-theme.css +38 -0
  147. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/checkbox-default-theme.min.css +6 -0
  148. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/checkbox.css +79 -0
  149. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/checkbox.js +133 -0
  150. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/checkbox.min.css +6 -0
  151. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/checkbox.min.js +7 -0
  152. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/bower.json +7 -0
  153. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/content-default-theme.css +8 -0
  154. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/content-default-theme.min.css +6 -0
  155. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/content.css +24 -0
  156. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/content.js +60 -0
  157. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/content.min.css +6 -0
  158. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/content.min.js +7 -0
  159. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/core/bower.json +7 -0
  160. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/core/core.css +3067 -0
  161. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/core/core.js +2780 -0
  162. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/core/core.min.css +6 -0
  163. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/core/core.min.js +7 -0
  164. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/core/default-theme.js +1 -0
  165. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/bower.json +8 -0
  166. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/dialog-default-theme.css +11 -0
  167. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/dialog-default-theme.min.css +6 -0
  168. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/dialog.css +88 -0
  169. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/dialog.js +495 -0
  170. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/dialog.min.css +6 -0
  171. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/dialog.min.js +7 -0
  172. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/bower.json +7 -0
  173. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/divider-default-theme.css +8 -0
  174. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/divider-default-theme.min.css +6 -0
  175. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/divider.css +12 -0
  176. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/divider.js +48 -0
  177. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/divider.min.css +6 -0
  178. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/divider.min.js +7 -0
  179. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/icon/bower.json +7 -0
  180. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/icon/icon.css +24 -0
  181. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/icon/icon.js +50 -0
  182. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/icon/icon.min.css +6 -0
  183. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/icon/icon.min.js +7 -0
  184. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/bower.json +7 -0
  185. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/input-default-theme.css +40 -0
  186. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/input-default-theme.min.css +6 -0
  187. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/input.css +102 -0
  188. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/input.js +333 -0
  189. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/input.min.css +6 -0
  190. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/input.min.js +7 -0
  191. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/list/bower.json +7 -0
  192. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/list/list.css +61 -0
  193. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/list/list.js +94 -0
  194. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/list/list.min.css +6 -0
  195. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/list/list.min.js +7 -0
  196. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/menu/bower.json +5 -0
  197. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/menu/menu.css +6 -0
  198. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/menu/menu.js +27 -0
  199. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/menu/menu.min.css +6 -0
  200. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/menu/menu.min.js +7 -0
  201. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/bower.json +7 -0
  202. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/progressCircular-default-theme.css +35 -0
  203. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/progressCircular-default-theme.min.css +6 -0
  204. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/progressCircular.css +1445 -0
  205. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/progressCircular.js +127 -0
  206. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/progressCircular.min.css +6 -0
  207. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/progressCircular.min.js +7 -0
  208. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/bower.json +7 -0
  209. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/progressLinear-default-theme.css +28 -0
  210. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/progressLinear-default-theme.min.css +6 -0
  211. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/progressLinear.css +368 -0
  212. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/progressLinear.js +128 -0
  213. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/progressLinear.min.css +6 -0
  214. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/progressLinear.min.js +7 -0
  215. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/bower.json +7 -0
  216. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/radioButton-default-theme.css +39 -0
  217. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/radioButton-default-theme.min.css +6 -0
  218. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/radioButton.css +67 -0
  219. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/radioButton.js +296 -0
  220. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/radioButton.min.css +6 -0
  221. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/radioButton.min.js +7 -0
  222. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/bower.json +8 -0
  223. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/sidenav-default-theme.css +8 -0
  224. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/sidenav-default-theme.min.css +6 -0
  225. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/sidenav.css +90 -0
  226. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/sidenav.js +302 -0
  227. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/sidenav.min.css +6 -0
  228. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/sidenav.min.js +7 -0
  229. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/bower.json +7 -0
  230. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/slider-default-theme.css +55 -0
  231. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/slider-default-theme.min.css +6 -0
  232. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/slider.css +218 -0
  233. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/slider.js +411 -0
  234. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/slider.min.css +6 -0
  235. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/slider.min.js +7 -0
  236. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sticky/bower.json +8 -0
  237. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sticky/sticky.css +20 -0
  238. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sticky/sticky.js +309 -0
  239. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sticky/sticky.min.css +6 -0
  240. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sticky/sticky.min.js +7 -0
  241. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/bower.json +8 -0
  242. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/subheader-default-theme.css +15 -0
  243. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/subheader-default-theme.min.css +6 -0
  244. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/subheader.css +61 -0
  245. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/subheader.js +86 -0
  246. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/subheader.min.css +6 -0
  247. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/subheader.min.js +7 -0
  248. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/swipe/bower.json +5 -0
  249. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/swipe/swipe.js +213 -0
  250. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/swipe/swipe.min.js +7 -0
  251. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/bower.json +8 -0
  252. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/switch-default-theme.css +29 -0
  253. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/switch-default-theme.min.css +6 -0
  254. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/switch.css +77 -0
  255. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/switch.js +144 -0
  256. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/switch.min.css +6 -0
  257. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/switch.min.js +7 -0
  258. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/bower.json +7 -0
  259. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/tabs-default-theme.css +34 -0
  260. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/tabs-default-theme.min.css +6 -0
  261. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/tabs.css +181 -0
  262. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/tabs.js +992 -0
  263. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/tabs.min.css +6 -0
  264. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/tabs.min.js +7 -0
  265. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/bower.json +7 -0
  266. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/textField-default-theme.css +29 -0
  267. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/textField-default-theme.min.css +6 -0
  268. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/textField.css +76 -0
  269. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/textField.js +143 -0
  270. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/textField.min.css +6 -0
  271. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/textField.min.js +7 -0
  272. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/bower.json +9 -0
  273. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/toast-default-theme.css +17 -0
  274. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/toast-default-theme.min.css +6 -0
  275. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/toast.css +115 -0
  276. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/toast.js +235 -0
  277. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/toast.min.css +6 -0
  278. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/toast.min.js +7 -0
  279. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/bower.json +8 -0
  280. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/toolbar-default-theme.css +17 -0
  281. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/toolbar-default-theme.min.css +6 -0
  282. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/toolbar.css +78 -0
  283. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/toolbar.js +158 -0
  284. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/toolbar.min.css +6 -0
  285. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/toolbar.min.js +7 -0
  286. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/bower.json +7 -0
  287. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/tooltip-default-theme.css +10 -0
  288. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/tooltip-default-theme.min.css +6 -0
  289. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/tooltip.css +136 -0
  290. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/tooltip.js +197 -0
  291. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/tooltip.min.css +6 -0
  292. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/tooltip.min.js +7 -0
  293. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/whiteframe/bower.json +5 -0
  294. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/whiteframe/whiteframe.css +20 -0
  295. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/whiteframe/whiteframe.js +15 -0
  296. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/whiteframe/whiteframe.min.css +6 -0
  297. data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/whiteframe/whiteframe.min.js +7 -0
  298. data/app/assets/javascripts/swat/bower_components/angular-resource/angular-resource.js +668 -0
  299. data/app/assets/javascripts/swat/bower_components/angular-resource/angular-resource.min.js +13 -0
  300. data/app/assets/javascripts/swat/bower_components/angular-resource/index.js +2 -0
  301. data/app/assets/javascripts/swat/bower_components/angular-route/angular-route.js +991 -0
  302. data/app/assets/javascripts/swat/bower_components/angular-route/angular-route.min.js +15 -0
  303. data/app/assets/javascripts/swat/bower_components/angular-route/index.js +2 -0
  304. data/app/assets/javascripts/swat/bower_components/angular-ui-router/LICENSE.txt +21 -0
  305. data/app/assets/javascripts/swat/bower_components/angular-ui-router/api/angular-ui-router.d.ts +126 -0
  306. data/app/assets/javascripts/swat/bower_components/angular-ui-router/release/angular-ui-router.js +4370 -0
  307. data/app/assets/javascripts/swat/bower_components/angular-ui-router/release/angular-ui-router.min.js +7 -0
  308. data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/common.js +292 -0
  309. data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/resolve.js +252 -0
  310. data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/state.js +1465 -0
  311. data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/stateDirectives.js +285 -0
  312. data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/stateFilters.js +39 -0
  313. data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/templateFactory.js +110 -0
  314. data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/urlMatcherFactory.js +1050 -0
  315. data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/urlRouter.js +427 -0
  316. data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/view.js +71 -0
  317. data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/viewDirective.js +303 -0
  318. data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/viewScroll.js +52 -0
  319. data/app/assets/javascripts/swat/bower_components/lodash/lodash.js +12235 -0
  320. data/app/assets/javascripts/swat/bower_components/lodash/lodash.min.js +98 -0
  321. data/app/assets/javascripts/swat/bower_components/ng-clip/.editorconfig +10 -0
  322. data/app/assets/javascripts/swat/bower_components/ng-clip/.gitignore +3 -0
  323. data/app/assets/javascripts/swat/bower_components/ng-clip/Gruntfile.js +96 -0
  324. data/app/assets/javascripts/swat/bower_components/ng-clip/dest/ng-clip.min.js +2 -0
  325. data/app/assets/javascripts/swat/bower_components/ng-clip/example/bootstrap-tooltip.html +49 -0
  326. data/app/assets/javascripts/swat/bower_components/ng-clip/example/index.html +68 -0
  327. data/app/assets/javascripts/swat/bower_components/ng-clip/example/ng-repeat.html +44 -0
  328. data/app/assets/javascripts/swat/bower_components/ng-clip/npm-debug.log +145 -0
  329. data/app/assets/javascripts/swat/bower_components/ng-clip/src/ngClip.js +84 -0
  330. data/app/assets/javascripts/swat/bower_components/zeroclipboard/dist/.jshintrc +70 -0
  331. data/app/assets/javascripts/swat/bower_components/zeroclipboard/dist/ZeroClipboard.Core.js +2017 -0
  332. data/app/assets/javascripts/swat/bower_components/zeroclipboard/dist/ZeroClipboard.Core.min.js +10 -0
  333. data/app/assets/javascripts/swat/bower_components/zeroclipboard/dist/ZeroClipboard.js +2581 -0
  334. data/app/assets/javascripts/swat/bower_components/zeroclipboard/dist/ZeroClipboard.min.js +10 -0
  335. data/app/assets/javascripts/swat/bower_components/zeroclipboard/dist/ZeroClipboard.swf +0 -0
  336. data/app/assets/javascripts/swat/bower_components.coffee +12 -0
  337. data/app/assets/stylesheets/swat/application.sass +59 -0
  338. data/app/assets/stylesheets/swat/default-theme.css +394 -0
  339. data/app/assets/stylesheets/swat/font-awesome.css +1801 -0
  340. data/app/assets/stylesheets/swat/fonts/FontAwesome.otf +0 -0
  341. data/app/assets/stylesheets/swat/fonts/fontawesome-webfont.eot +0 -0
  342. data/app/assets/stylesheets/swat/fonts/fontawesome-webfont.svg +565 -0
  343. data/app/assets/stylesheets/swat/fonts/fontawesome-webfont.ttf +0 -0
  344. data/app/assets/stylesheets/swat/fonts/fontawesome-webfont.woff +0 -0
  345. data/app/assets/stylesheets/swat/fonts/fontawesome-webfont.woff2 +0 -0
  346. data/app/assets/stylesheets/swat/swat_theme.sass +177 -0
  347. data/app/controllers/swat/api/revisions_controller.rb +27 -0
  348. data/app/controllers/swat/api/test_cases_controller.rb +20 -0
  349. data/app/controllers/swat/application_controller.rb +4 -0
  350. data/app/controllers/swat/info/states_controller.rb +12 -0
  351. data/app/controllers/swat/pages/base_pages_controller.rb +7 -0
  352. data/app/controllers/swat/pages/revisions_controller.rb +8 -0
  353. data/app/controllers/swat/revisions_controller.rb +4 -0
  354. data/app/helpers/swat/application_helper.rb +4 -0
  355. data/app/models/concerns/root_revision_ext.rb +14 -0
  356. data/app/models/full_revision.rb +88 -0
  357. data/app/models/revision.rb +84 -0
  358. data/app/models/revision_status_calculator.rb +98 -0
  359. data/app/models/test_case.rb +25 -0
  360. data/app/views/layouts/swat/application.slim +36 -0
  361. data/app/views/layouts/swat/page.slim +2 -0
  362. data/app/views/swat/application/index.slim +0 -0
  363. data/app/views/swat/pages/revisions/index.slim +25 -0
  364. data/app/views/swat/pages/revisions/show.slim +43 -0
  365. data/app/views/swat/shared/_footer.slim +5 -0
  366. data/app/views/swat/shared/_header.slim +9 -0
  367. data/bin/rails +12 -0
  368. data/config/routes.rb +38 -0
  369. data/fixtures/firebase_collection.rb +97 -0
  370. data/lib/sw2at-ui.rb +19 -0
  371. data/lib/swat/engine.rb +5 -0
  372. data/lib/swat/ui/config.rb +28 -0
  373. data/lib/swat/ui/rspec_commands.rb +191 -0
  374. data/lib/swat/ui/rspec_setup.rb +42 -0
  375. data/lib/swat/ui/stats_collector.rb +90 -0
  376. data/lib/swat/ui/version.rb +5 -0
  377. data/lib/tasks/swat_tasks.rake +36 -0
  378. data/spec/lib/commands_spec.rb +88 -0
  379. data/spec/models/calculator_spec.rb +130 -0
  380. data/spec/models/full_revision_spec.rb +263 -0
  381. data/spec/models/revision_spec.rb +59 -0
  382. data/spec/models/testcase_spec.rb +94 -0
  383. data/spec/spec_helper.rb +45 -0
  384. data/sw2at-ui.gemspec +465 -0
  385. data/test/helper.rb +34 -0
  386. data/test/test_sw2at-ui.rb +7 -0
  387. metadata +628 -0
@@ -0,0 +1,1465 @@
1
+ /**
2
+ * @ngdoc object
3
+ * @name ui.router.state.$stateProvider
4
+ *
5
+ * @requires ui.router.router.$urlRouterProvider
6
+ * @requires ui.router.util.$urlMatcherFactoryProvider
7
+ *
8
+ * @description
9
+ * The new `$stateProvider` works similar to Angular's v1 router, but it focuses purely
10
+ * on state.
11
+ *
12
+ * A state corresponds to a "place" in the application in terms of the overall UI and
13
+ * navigation. A state describes (via the controller / template / view properties) what
14
+ * the UI looks like and does at that place.
15
+ *
16
+ * States often have things in common, and the primary way of factoring out these
17
+ * commonalities in this model is via the state hierarchy, i.e. parent/child states aka
18
+ * nested states.
19
+ *
20
+ * The `$stateProvider` provides interfaces to declare these states for your app.
21
+ */
22
+ $StateProvider.$inject = ['$urlRouterProvider', '$urlMatcherFactoryProvider'];
23
+ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
24
+
25
+ var root, states = {}, $state, queue = {}, abstractKey = 'abstract';
26
+
27
+ // Builds state properties from definition passed to registerState()
28
+ var stateBuilder = {
29
+
30
+ // Derive parent state from a hierarchical name only if 'parent' is not explicitly defined.
31
+ // state.children = [];
32
+ // if (parent) parent.children.push(state);
33
+ parent: function(state) {
34
+ if (isDefined(state.parent) && state.parent) return findState(state.parent);
35
+ // regex matches any valid composite state name
36
+ // would match "contact.list" but not "contacts"
37
+ var compositeName = /^(.+)\.[^.]+$/.exec(state.name);
38
+ return compositeName ? findState(compositeName[1]) : root;
39
+ },
40
+
41
+ // inherit 'data' from parent and override by own values (if any)
42
+ data: function(state) {
43
+ if (state.parent && state.parent.data) {
44
+ state.data = state.self.data = extend({}, state.parent.data, state.data);
45
+ }
46
+ return state.data;
47
+ },
48
+
49
+ // Build a URLMatcher if necessary, either via a relative or absolute URL
50
+ url: function(state) {
51
+ var url = state.url, config = { params: state.params || {} };
52
+
53
+ if (isString(url)) {
54
+ if (url.charAt(0) == '^') return $urlMatcherFactory.compile(url.substring(1), config);
55
+ return (state.parent.navigable || root).url.concat(url, config);
56
+ }
57
+
58
+ if (!url || $urlMatcherFactory.isMatcher(url)) return url;
59
+ throw new Error("Invalid url '" + url + "' in state '" + state + "'");
60
+ },
61
+
62
+ // Keep track of the closest ancestor state that has a URL (i.e. is navigable)
63
+ navigable: function(state) {
64
+ return state.url ? state : (state.parent ? state.parent.navigable : null);
65
+ },
66
+
67
+ // Own parameters for this state. state.url.params is already built at this point. Create and add non-url params
68
+ ownParams: function(state) {
69
+ var params = state.url && state.url.params || new $$UMFP.ParamSet();
70
+ forEach(state.params || {}, function(config, id) {
71
+ if (!params[id]) params[id] = new $$UMFP.Param(id, null, config, "config");
72
+ });
73
+ return params;
74
+ },
75
+
76
+ // Derive parameters for this state and ensure they're a super-set of parent's parameters
77
+ params: function(state) {
78
+ return state.parent && state.parent.params ? extend(state.parent.params.$$new(), state.ownParams) : new $$UMFP.ParamSet();
79
+ },
80
+
81
+ // If there is no explicit multi-view configuration, make one up so we don't have
82
+ // to handle both cases in the view directive later. Note that having an explicit
83
+ // 'views' property will mean the default unnamed view properties are ignored. This
84
+ // is also a good time to resolve view names to absolute names, so everything is a
85
+ // straight lookup at link time.
86
+ views: function(state) {
87
+ var views = {};
88
+
89
+ forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) {
90
+ if (name.indexOf('@') < 0) name += '@' + state.parent.name;
91
+ views[name] = view;
92
+ });
93
+ return views;
94
+ },
95
+
96
+ // Keep a full path from the root down to this state as this is needed for state activation.
97
+ path: function(state) {
98
+ return state.parent ? state.parent.path.concat(state) : []; // exclude root from path
99
+ },
100
+
101
+ // Speed up $state.contains() as it's used a lot
102
+ includes: function(state) {
103
+ var includes = state.parent ? extend({}, state.parent.includes) : {};
104
+ includes[state.name] = true;
105
+ return includes;
106
+ },
107
+
108
+ $delegates: {}
109
+ };
110
+
111
+ function isRelative(stateName) {
112
+ return stateName.indexOf(".") === 0 || stateName.indexOf("^") === 0;
113
+ }
114
+
115
+ function findState(stateOrName, base) {
116
+ if (!stateOrName) return undefined;
117
+
118
+ var isStr = isString(stateOrName),
119
+ name = isStr ? stateOrName : stateOrName.name,
120
+ path = isRelative(name);
121
+
122
+ if (path) {
123
+ if (!base) throw new Error("No reference point given for path '" + name + "'");
124
+ base = findState(base);
125
+
126
+ var rel = name.split("."), i = 0, pathLength = rel.length, current = base;
127
+
128
+ for (; i < pathLength; i++) {
129
+ if (rel[i] === "" && i === 0) {
130
+ current = base;
131
+ continue;
132
+ }
133
+ if (rel[i] === "^") {
134
+ if (!current.parent) throw new Error("Path '" + name + "' not valid for state '" + base.name + "'");
135
+ current = current.parent;
136
+ continue;
137
+ }
138
+ break;
139
+ }
140
+ rel = rel.slice(i).join(".");
141
+ name = current.name + (current.name && rel ? "." : "") + rel;
142
+ }
143
+ var state = states[name];
144
+
145
+ if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {
146
+ return state;
147
+ }
148
+ return undefined;
149
+ }
150
+
151
+ function queueState(parentName, state) {
152
+ if (!queue[parentName]) {
153
+ queue[parentName] = [];
154
+ }
155
+ queue[parentName].push(state);
156
+ }
157
+
158
+ function flushQueuedChildren(parentName) {
159
+ var queued = queue[parentName] || [];
160
+ while(queued.length) {
161
+ registerState(queued.shift());
162
+ }
163
+ }
164
+
165
+ function registerState(state) {
166
+ // Wrap a new object around the state so we can store our private details easily.
167
+ state = inherit(state, {
168
+ self: state,
169
+ resolve: state.resolve || {},
170
+ toString: function() { return this.name; }
171
+ });
172
+
173
+ var name = state.name;
174
+ if (!isString(name) || name.indexOf('@') >= 0) throw new Error("State must have a valid name");
175
+ if (states.hasOwnProperty(name)) throw new Error("State '" + name + "'' is already defined");
176
+
177
+ // Get parent name
178
+ var parentName = (name.indexOf('.') !== -1) ? name.substring(0, name.lastIndexOf('.'))
179
+ : (isString(state.parent)) ? state.parent
180
+ : (isObject(state.parent) && isString(state.parent.name)) ? state.parent.name
181
+ : '';
182
+
183
+ // If parent is not registered yet, add state to queue and register later
184
+ if (parentName && !states[parentName]) {
185
+ return queueState(parentName, state.self);
186
+ }
187
+
188
+ for (var key in stateBuilder) {
189
+ if (isFunction(stateBuilder[key])) state[key] = stateBuilder[key](state, stateBuilder.$delegates[key]);
190
+ }
191
+ states[name] = state;
192
+
193
+ // Register the state in the global state list and with $urlRouter if necessary.
194
+ if (!state[abstractKey] && state.url) {
195
+ $urlRouterProvider.when(state.url, ['$match', '$stateParams', function ($match, $stateParams) {
196
+ if ($state.$current.navigable != state || !equalForKeys($match, $stateParams)) {
197
+ $state.transitionTo(state, $match, { inherit: true, location: false });
198
+ }
199
+ }]);
200
+ }
201
+
202
+ // Register any queued children
203
+ flushQueuedChildren(name);
204
+
205
+ return state;
206
+ }
207
+
208
+ // Checks text to see if it looks like a glob.
209
+ function isGlob (text) {
210
+ return text.indexOf('*') > -1;
211
+ }
212
+
213
+ // Returns true if glob matches current $state name.
214
+ function doesStateMatchGlob (glob) {
215
+ var globSegments = glob.split('.'),
216
+ segments = $state.$current.name.split('.');
217
+
218
+ //match single stars
219
+ for (var i = 0, l = globSegments.length; i < l; i++) {
220
+ if (globSegments[i] === '*') {
221
+ segments[i] = '*';
222
+ }
223
+ }
224
+
225
+ //match greedy starts
226
+ if (globSegments[0] === '**') {
227
+ segments = segments.slice(indexOf(segments, globSegments[1]));
228
+ segments.unshift('**');
229
+ }
230
+ //match greedy ends
231
+ if (globSegments[globSegments.length - 1] === '**') {
232
+ segments.splice(indexOf(segments, globSegments[globSegments.length - 2]) + 1, Number.MAX_VALUE);
233
+ segments.push('**');
234
+ }
235
+
236
+ if (globSegments.length != segments.length) {
237
+ return false;
238
+ }
239
+
240
+ return segments.join('') === globSegments.join('');
241
+ }
242
+
243
+
244
+ // Implicit root state that is always active
245
+ root = registerState({
246
+ name: '',
247
+ url: '^',
248
+ views: null,
249
+ 'abstract': true
250
+ });
251
+ root.navigable = null;
252
+
253
+
254
+ /**
255
+ * @ngdoc function
256
+ * @name ui.router.state.$stateProvider#decorator
257
+ * @methodOf ui.router.state.$stateProvider
258
+ *
259
+ * @description
260
+ * Allows you to extend (carefully) or override (at your own peril) the
261
+ * `stateBuilder` object used internally by `$stateProvider`. This can be used
262
+ * to add custom functionality to ui-router, for example inferring templateUrl
263
+ * based on the state name.
264
+ *
265
+ * When passing only a name, it returns the current (original or decorated) builder
266
+ * function that matches `name`.
267
+ *
268
+ * The builder functions that can be decorated are listed below. Though not all
269
+ * necessarily have a good use case for decoration, that is up to you to decide.
270
+ *
271
+ * In addition, users can attach custom decorators, which will generate new
272
+ * properties within the state's internal definition. There is currently no clear
273
+ * use-case for this beyond accessing internal states (i.e. $state.$current),
274
+ * however, expect this to become increasingly relevant as we introduce additional
275
+ * meta-programming features.
276
+ *
277
+ * **Warning**: Decorators should not be interdependent because the order of
278
+ * execution of the builder functions in non-deterministic. Builder functions
279
+ * should only be dependent on the state definition object and super function.
280
+ *
281
+ *
282
+ * Existing builder functions and current return values:
283
+ *
284
+ * - **parent** `{object}` - returns the parent state object.
285
+ * - **data** `{object}` - returns state data, including any inherited data that is not
286
+ * overridden by own values (if any).
287
+ * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}
288
+ * or `null`.
289
+ * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is
290
+ * navigable).
291
+ * - **params** `{object}` - returns an array of state params that are ensured to
292
+ * be a super-set of parent's params.
293
+ * - **views** `{object}` - returns a views object where each key is an absolute view
294
+ * name (i.e. "viewName@stateName") and each value is the config object
295
+ * (template, controller) for the view. Even when you don't use the views object
296
+ * explicitly on a state config, one is still created for you internally.
297
+ * So by decorating this builder function you have access to decorating template
298
+ * and controller properties.
299
+ * - **ownParams** `{object}` - returns an array of params that belong to the state,
300
+ * not including any params defined by ancestor states.
301
+ * - **path** `{string}` - returns the full path from the root down to this state.
302
+ * Needed for state activation.
303
+ * - **includes** `{object}` - returns an object that includes every state that
304
+ * would pass a `$state.includes()` test.
305
+ *
306
+ * @example
307
+ * <pre>
308
+ * // Override the internal 'views' builder with a function that takes the state
309
+ * // definition, and a reference to the internal function being overridden:
310
+ * $stateProvider.decorator('views', function (state, parent) {
311
+ * var result = {},
312
+ * views = parent(state);
313
+ *
314
+ * angular.forEach(views, function (config, name) {
315
+ * var autoName = (state.name + '.' + name).replace('.', '/');
316
+ * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';
317
+ * result[name] = config;
318
+ * });
319
+ * return result;
320
+ * });
321
+ *
322
+ * $stateProvider.state('home', {
323
+ * views: {
324
+ * 'contact.list': { controller: 'ListController' },
325
+ * 'contact.item': { controller: 'ItemController' }
326
+ * }
327
+ * });
328
+ *
329
+ * // ...
330
+ *
331
+ * $state.go('home');
332
+ * // Auto-populates list and item views with /partials/home/contact/list.html,
333
+ * // and /partials/home/contact/item.html, respectively.
334
+ * </pre>
335
+ *
336
+ * @param {string} name The name of the builder function to decorate.
337
+ * @param {object} func A function that is responsible for decorating the original
338
+ * builder function. The function receives two parameters:
339
+ *
340
+ * - `{object}` - state - The state config object.
341
+ * - `{object}` - super - The original builder function.
342
+ *
343
+ * @return {object} $stateProvider - $stateProvider instance
344
+ */
345
+ this.decorator = decorator;
346
+ function decorator(name, func) {
347
+ /*jshint validthis: true */
348
+ if (isString(name) && !isDefined(func)) {
349
+ return stateBuilder[name];
350
+ }
351
+ if (!isFunction(func) || !isString(name)) {
352
+ return this;
353
+ }
354
+ if (stateBuilder[name] && !stateBuilder.$delegates[name]) {
355
+ stateBuilder.$delegates[name] = stateBuilder[name];
356
+ }
357
+ stateBuilder[name] = func;
358
+ return this;
359
+ }
360
+
361
+ /**
362
+ * @ngdoc function
363
+ * @name ui.router.state.$stateProvider#state
364
+ * @methodOf ui.router.state.$stateProvider
365
+ *
366
+ * @description
367
+ * Registers a state configuration under a given state name. The stateConfig object
368
+ * has the following acceptable properties.
369
+ *
370
+ * @param {string} name A unique state name, e.g. "home", "about", "contacts".
371
+ * To create a parent/child state use a dot, e.g. "about.sales", "home.newest".
372
+ * @param {object} stateConfig State configuration object.
373
+ * @param {string|function=} stateConfig.template
374
+ * <a id='template'></a>
375
+ * html template as a string or a function that returns
376
+ * an html template as a string which should be used by the uiView directives. This property
377
+ * takes precedence over templateUrl.
378
+ *
379
+ * If `template` is a function, it will be called with the following parameters:
380
+ *
381
+ * - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by
382
+ * applying the current state
383
+ *
384
+ * <pre>template:
385
+ * "<h1>inline template definition</h1>" +
386
+ * "<div ui-view></div>"</pre>
387
+ * <pre>template: function(params) {
388
+ * return "<h1>generated template</h1>"; }</pre>
389
+ * </div>
390
+ *
391
+ * @param {string|function=} stateConfig.templateUrl
392
+ * <a id='templateUrl'></a>
393
+ *
394
+ * path or function that returns a path to an html
395
+ * template that should be used by uiView.
396
+ *
397
+ * If `templateUrl` is a function, it will be called with the following parameters:
398
+ *
399
+ * - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by
400
+ * applying the current state
401
+ *
402
+ * <pre>templateUrl: "home.html"</pre>
403
+ * <pre>templateUrl: function(params) {
404
+ * return myTemplates[params.pageId]; }</pre>
405
+ *
406
+ * @param {function=} stateConfig.templateProvider
407
+ * <a id='templateProvider'></a>
408
+ * Provider function that returns HTML content string.
409
+ * <pre> templateProvider:
410
+ * function(MyTemplateService, params) {
411
+ * return MyTemplateService.getTemplate(params.pageId);
412
+ * }</pre>
413
+ *
414
+ * @param {string|function=} stateConfig.controller
415
+ * <a id='controller'></a>
416
+ *
417
+ * Controller fn that should be associated with newly
418
+ * related scope or the name of a registered controller if passed as a string.
419
+ * Optionally, the ControllerAs may be declared here.
420
+ * <pre>controller: "MyRegisteredController"</pre>
421
+ * <pre>controller:
422
+ * "MyRegisteredController as fooCtrl"}</pre>
423
+ * <pre>controller: function($scope, MyService) {
424
+ * $scope.data = MyService.getData(); }</pre>
425
+ *
426
+ * @param {function=} stateConfig.controllerProvider
427
+ * <a id='controllerProvider'></a>
428
+ *
429
+ * Injectable provider function that returns the actual controller or string.
430
+ * <pre>controllerProvider:
431
+ * function(MyResolveData) {
432
+ * if (MyResolveData.foo)
433
+ * return "FooCtrl"
434
+ * else if (MyResolveData.bar)
435
+ * return "BarCtrl";
436
+ * else return function($scope) {
437
+ * $scope.baz = "Qux";
438
+ * }
439
+ * }</pre>
440
+ *
441
+ * @param {string=} stateConfig.controllerAs
442
+ * <a id='controllerAs'></a>
443
+ *
444
+ * A controller alias name. If present the controller will be
445
+ * published to scope under the controllerAs name.
446
+ * <pre>controllerAs: "myCtrl"</pre>
447
+ *
448
+ * @param {string|object=} stateConfig.parent
449
+ * <a id='parent'></a>
450
+ * Optionally specifies the parent state of this state.
451
+ *
452
+ * <pre>parent: 'parentState'</pre>
453
+ * <pre>parent: parentState // JS variable</pre>
454
+ *
455
+ * @param {object=} stateConfig.resolve
456
+ * <a id='resolve'></a>
457
+ *
458
+ * An optional map&lt;string, function&gt; of dependencies which
459
+ * should be injected into the controller. If any of these dependencies are promises,
460
+ * the router will wait for them all to be resolved before the controller is instantiated.
461
+ * If all the promises are resolved successfully, the $stateChangeSuccess event is fired
462
+ * and the values of the resolved promises are injected into any controllers that reference them.
463
+ * If any of the promises are rejected the $stateChangeError event is fired.
464
+ *
465
+ * The map object is:
466
+ *
467
+ * - key - {string}: name of dependency to be injected into controller
468
+ * - factory - {string|function}: If string then it is alias for service. Otherwise if function,
469
+ * it is injected and return value it treated as dependency. If result is a promise, it is
470
+ * resolved before its value is injected into controller.
471
+ *
472
+ * <pre>resolve: {
473
+ * myResolve1:
474
+ * function($http, $stateParams) {
475
+ * return $http.get("/api/foos/"+stateParams.fooID);
476
+ * }
477
+ * }</pre>
478
+ *
479
+ * @param {string=} stateConfig.url
480
+ * <a id='url'></a>
481
+ *
482
+ * A url fragment with optional parameters. When a state is navigated or
483
+ * transitioned to, the `$stateParams` service will be populated with any
484
+ * parameters that were passed.
485
+ *
486
+ * (See {@link ui.router.util.type:UrlMatcher UrlMatcher} `UrlMatcher`} for
487
+ * more details on acceptable patterns )
488
+ *
489
+ * examples:
490
+ * <pre>url: "/home"
491
+ * url: "/users/:userid"
492
+ * url: "/books/{bookid:[a-zA-Z_-]}"
493
+ * url: "/books/{categoryid:int}"
494
+ * url: "/books/{publishername:string}/{categoryid:int}"
495
+ * url: "/messages?before&after"
496
+ * url: "/messages?{before:date}&{after:date}"
497
+ * url: "/messages/:mailboxid?{before:date}&{after:date}"
498
+ * </pre>
499
+ *
500
+ * @param {object=} stateConfig.views
501
+ * <a id='views'></a>
502
+ * an optional map&lt;string, object&gt; which defined multiple views, or targets views
503
+ * manually/explicitly.
504
+ *
505
+ * Examples:
506
+ *
507
+ * Targets three named `ui-view`s in the parent state's template
508
+ * <pre>views: {
509
+ * header: {
510
+ * controller: "headerCtrl",
511
+ * templateUrl: "header.html"
512
+ * }, body: {
513
+ * controller: "bodyCtrl",
514
+ * templateUrl: "body.html"
515
+ * }, footer: {
516
+ * controller: "footCtrl",
517
+ * templateUrl: "footer.html"
518
+ * }
519
+ * }</pre>
520
+ *
521
+ * Targets named `ui-view="header"` from grandparent state 'top''s template, and named `ui-view="body" from parent state's template.
522
+ * <pre>views: {
523
+ * 'header@top': {
524
+ * controller: "msgHeaderCtrl",
525
+ * templateUrl: "msgHeader.html"
526
+ * }, 'body': {
527
+ * controller: "messagesCtrl",
528
+ * templateUrl: "messages.html"
529
+ * }
530
+ * }</pre>
531
+ *
532
+ * @param {boolean=} [stateConfig.abstract=false]
533
+ * <a id='abstract'></a>
534
+ * An abstract state will never be directly activated,
535
+ * but can provide inherited properties to its common children states.
536
+ * <pre>abstract: true</pre>
537
+ *
538
+ * @param {function=} stateConfig.onEnter
539
+ * <a id='onEnter'></a>
540
+ *
541
+ * Callback function for when a state is entered. Good way
542
+ * to trigger an action or dispatch an event, such as opening a dialog.
543
+ * If minifying your scripts, make sure to explictly annotate this function,
544
+ * because it won't be automatically annotated by your build tools.
545
+ *
546
+ * <pre>onEnter: function(MyService, $stateParams) {
547
+ * MyService.foo($stateParams.myParam);
548
+ * }</pre>
549
+ *
550
+ * @param {function=} stateConfig.onExit
551
+ * <a id='onExit'></a>
552
+ *
553
+ * Callback function for when a state is exited. Good way to
554
+ * trigger an action or dispatch an event, such as opening a dialog.
555
+ * If minifying your scripts, make sure to explictly annotate this function,
556
+ * because it won't be automatically annotated by your build tools.
557
+ *
558
+ * <pre>onExit: function(MyService, $stateParams) {
559
+ * MyService.cleanup($stateParams.myParam);
560
+ * }</pre>
561
+ *
562
+ * @param {boolean=} [stateConfig.reloadOnSearch=true]
563
+ * <a id='reloadOnSearch'></a>
564
+ *
565
+ * If `false`, will not retrigger the same state
566
+ * just because a search/query parameter has changed (via $location.search() or $location.hash()).
567
+ * Useful for when you'd like to modify $location.search() without triggering a reload.
568
+ * <pre>reloadOnSearch: false</pre>
569
+ *
570
+ * @param {object=} stateConfig.data
571
+ * <a id='data'></a>
572
+ *
573
+ * Arbitrary data object, useful for custom configuration. The parent state's `data` is
574
+ * prototypally inherited. In other words, adding a data property to a state adds it to
575
+ * the entire subtree via prototypal inheritance.
576
+ *
577
+ * <pre>data: {
578
+ * requiredRole: 'foo'
579
+ * } </pre>
580
+ *
581
+ * @param {object=} stateConfig.params
582
+ * <a id='params'></a>
583
+ *
584
+ * A map which optionally configures parameters declared in the `url`, or
585
+ * defines additional non-url parameters. For each parameter being
586
+ * configured, add a configuration object keyed to the name of the parameter.
587
+ *
588
+ * Each parameter configuration object may contain the following properties:
589
+ *
590
+ * - ** value ** - {object|function=}: specifies the default value for this
591
+ * parameter. This implicitly sets this parameter as optional.
592
+ *
593
+ * When UI-Router routes to a state and no value is
594
+ * specified for this parameter in the URL or transition, the
595
+ * default value will be used instead. If `value` is a function,
596
+ * it will be injected and invoked, and the return value used.
597
+ *
598
+ * *Note*: `undefined` is treated as "no default value" while `null`
599
+ * is treated as "the default value is `null`".
600
+ *
601
+ * *Shorthand*: If you only need to configure the default value of the
602
+ * parameter, you may use a shorthand syntax. In the **`params`**
603
+ * map, instead mapping the param name to a full parameter configuration
604
+ * object, simply set map it to the default parameter value, e.g.:
605
+ *
606
+ * <pre>// define a parameter's default value
607
+ * params: {
608
+ * param1: { value: "defaultValue" }
609
+ * }
610
+ * // shorthand default values
611
+ * params: {
612
+ * param1: "defaultValue",
613
+ * param2: "param2Default"
614
+ * }</pre>
615
+ *
616
+ * - ** array ** - {boolean=}: *(default: false)* If true, the param value will be
617
+ * treated as an array of values. If you specified a Type, the value will be
618
+ * treated as an array of the specified Type. Note: query parameter values
619
+ * default to a special `"auto"` mode.
620
+ *
621
+ * For query parameters in `"auto"` mode, if multiple values for a single parameter
622
+ * are present in the URL (e.g.: `/foo?bar=1&bar=2&bar=3`) then the values
623
+ * are mapped to an array (e.g.: `{ foo: [ '1', '2', '3' ] }`). However, if
624
+ * only one value is present (e.g.: `/foo?bar=1`) then the value is treated as single
625
+ * value (e.g.: `{ foo: '1' }`).
626
+ *
627
+ * <pre>params: {
628
+ * param1: { array: true }
629
+ * }</pre>
630
+ *
631
+ * - ** squash ** - {bool|string=}: `squash` configures how a default parameter value is represented in the URL when
632
+ * the current parameter value is the same as the default value. If `squash` is not set, it uses the
633
+ * configured default squash policy.
634
+ * (See {@link ui.router.util.$urlMatcherFactory#methods_defaultSquashPolicy `defaultSquashPolicy()`})
635
+ *
636
+ * There are three squash settings:
637
+ *
638
+ * - false: The parameter's default value is not squashed. It is encoded and included in the URL
639
+ * - true: The parameter's default value is omitted from the URL. If the parameter is preceeded and followed
640
+ * by slashes in the state's `url` declaration, then one of those slashes are omitted.
641
+ * This can allow for cleaner looking URLs.
642
+ * - `"<arbitrary string>"`: The parameter's default value is replaced with an arbitrary placeholder of your choice.
643
+ *
644
+ * <pre>params: {
645
+ * param1: {
646
+ * value: "defaultId",
647
+ * squash: true
648
+ * } }
649
+ * // squash "defaultValue" to "~"
650
+ * params: {
651
+ * param1: {
652
+ * value: "defaultValue",
653
+ * squash: "~"
654
+ * } }
655
+ * </pre>
656
+ *
657
+ *
658
+ * @example
659
+ * <pre>
660
+ * // Some state name examples
661
+ *
662
+ * // stateName can be a single top-level name (must be unique).
663
+ * $stateProvider.state("home", {});
664
+ *
665
+ * // Or it can be a nested state name. This state is a child of the
666
+ * // above "home" state.
667
+ * $stateProvider.state("home.newest", {});
668
+ *
669
+ * // Nest states as deeply as needed.
670
+ * $stateProvider.state("home.newest.abc.xyz.inception", {});
671
+ *
672
+ * // state() returns $stateProvider, so you can chain state declarations.
673
+ * $stateProvider
674
+ * .state("home", {})
675
+ * .state("about", {})
676
+ * .state("contacts", {});
677
+ * </pre>
678
+ *
679
+ */
680
+ this.state = state;
681
+ function state(name, definition) {
682
+ /*jshint validthis: true */
683
+ if (isObject(name)) definition = name;
684
+ else definition.name = name;
685
+ registerState(definition);
686
+ return this;
687
+ }
688
+
689
+ /**
690
+ * @ngdoc object
691
+ * @name ui.router.state.$state
692
+ *
693
+ * @requires $rootScope
694
+ * @requires $q
695
+ * @requires ui.router.state.$view
696
+ * @requires $injector
697
+ * @requires ui.router.util.$resolve
698
+ * @requires ui.router.state.$stateParams
699
+ * @requires ui.router.router.$urlRouter
700
+ *
701
+ * @property {object} params A param object, e.g. {sectionId: section.id)}, that
702
+ * you'd like to test against the current active state.
703
+ * @property {object} current A reference to the state's config object. However
704
+ * you passed it in. Useful for accessing custom data.
705
+ * @property {object} transition Currently pending transition. A promise that'll
706
+ * resolve or reject.
707
+ *
708
+ * @description
709
+ * `$state` service is responsible for representing states as well as transitioning
710
+ * between them. It also provides interfaces to ask for current state or even states
711
+ * you're coming from.
712
+ */
713
+ this.$get = $get;
714
+ $get.$inject = ['$rootScope', '$q', '$view', '$injector', '$resolve', '$stateParams', '$urlRouter', '$location', '$urlMatcherFactory'];
715
+ function $get( $rootScope, $q, $view, $injector, $resolve, $stateParams, $urlRouter, $location, $urlMatcherFactory) {
716
+
717
+ var TransitionSuperseded = $q.reject(new Error('transition superseded'));
718
+ var TransitionPrevented = $q.reject(new Error('transition prevented'));
719
+ var TransitionAborted = $q.reject(new Error('transition aborted'));
720
+ var TransitionFailed = $q.reject(new Error('transition failed'));
721
+
722
+ // Handles the case where a state which is the target of a transition is not found, and the user
723
+ // can optionally retry or defer the transition
724
+ function handleRedirect(redirect, state, params, options) {
725
+ /**
726
+ * @ngdoc event
727
+ * @name ui.router.state.$state#$stateNotFound
728
+ * @eventOf ui.router.state.$state
729
+ * @eventType broadcast on root scope
730
+ * @description
731
+ * Fired when a requested state **cannot be found** using the provided state name during transition.
732
+ * The event is broadcast allowing any handlers a single chance to deal with the error (usually by
733
+ * lazy-loading the unfound state). A special `unfoundState` object is passed to the listener handler,
734
+ * you can see its three properties in the example. You can use `event.preventDefault()` to abort the
735
+ * transition and the promise returned from `go` will be rejected with a `'transition aborted'` value.
736
+ *
737
+ * @param {Object} event Event object.
738
+ * @param {Object} unfoundState Unfound State information. Contains: `to, toParams, options` properties.
739
+ * @param {State} fromState Current state object.
740
+ * @param {Object} fromParams Current state params.
741
+ *
742
+ * @example
743
+ *
744
+ * <pre>
745
+ * // somewhere, assume lazy.state has not been defined
746
+ * $state.go("lazy.state", {a:1, b:2}, {inherit:false});
747
+ *
748
+ * // somewhere else
749
+ * $scope.$on('$stateNotFound',
750
+ * function(event, unfoundState, fromState, fromParams){
751
+ * console.log(unfoundState.to); // "lazy.state"
752
+ * console.log(unfoundState.toParams); // {a:1, b:2}
753
+ * console.log(unfoundState.options); // {inherit:false} + default options
754
+ * })
755
+ * </pre>
756
+ */
757
+ var evt = $rootScope.$broadcast('$stateNotFound', redirect, state, params);
758
+
759
+ if (evt.defaultPrevented) {
760
+ $urlRouter.update();
761
+ return TransitionAborted;
762
+ }
763
+
764
+ if (!evt.retry) {
765
+ return null;
766
+ }
767
+
768
+ // Allow the handler to return a promise to defer state lookup retry
769
+ if (options.$retry) {
770
+ $urlRouter.update();
771
+ return TransitionFailed;
772
+ }
773
+ var retryTransition = $state.transition = $q.when(evt.retry);
774
+
775
+ retryTransition.then(function() {
776
+ if (retryTransition !== $state.transition) return TransitionSuperseded;
777
+ redirect.options.$retry = true;
778
+ return $state.transitionTo(redirect.to, redirect.toParams, redirect.options);
779
+ }, function() {
780
+ return TransitionAborted;
781
+ });
782
+ $urlRouter.update();
783
+
784
+ return retryTransition;
785
+ }
786
+
787
+ root.locals = { resolve: null, globals: { $stateParams: {} } };
788
+
789
+ $state = {
790
+ params: {},
791
+ current: root.self,
792
+ $current: root,
793
+ transition: null
794
+ };
795
+
796
+ /**
797
+ * @ngdoc function
798
+ * @name ui.router.state.$state#reload
799
+ * @methodOf ui.router.state.$state
800
+ *
801
+ * @description
802
+ * A method that force reloads the current state. All resolves are re-resolved,
803
+ * controllers reinstantiated, and events re-fired.
804
+ *
805
+ * @example
806
+ * <pre>
807
+ * var app angular.module('app', ['ui.router']);
808
+ *
809
+ * app.controller('ctrl', function ($scope, $state) {
810
+ * $scope.reload = function(){
811
+ * $state.reload();
812
+ * }
813
+ * });
814
+ * </pre>
815
+ *
816
+ * `reload()` is just an alias for:
817
+ * <pre>
818
+ * $state.transitionTo($state.current, $stateParams, {
819
+ * reload: true, inherit: false, notify: true
820
+ * });
821
+ * </pre>
822
+ *
823
+ * @param {string=|object=} state - A state name or a state object, which is the root of the resolves to be re-resolved.
824
+ * @example
825
+ * <pre>
826
+ * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'
827
+ * //and current state is 'contacts.detail.item'
828
+ * var app angular.module('app', ['ui.router']);
829
+ *
830
+ * app.controller('ctrl', function ($scope, $state) {
831
+ * $scope.reload = function(){
832
+ * //will reload 'contact.detail' and 'contact.detail.item' states
833
+ * $state.reload('contact.detail');
834
+ * }
835
+ * });
836
+ * </pre>
837
+ *
838
+ * `reload()` is just an alias for:
839
+ * <pre>
840
+ * $state.transitionTo($state.current, $stateParams, {
841
+ * reload: true, inherit: false, notify: true
842
+ * });
843
+ * </pre>
844
+
845
+ * @returns {promise} A promise representing the state of the new transition. See
846
+ * {@link ui.router.state.$state#methods_go $state.go}.
847
+ */
848
+ $state.reload = function reload(state) {
849
+ return $state.transitionTo($state.current, $stateParams, { reload: state || true, inherit: false, notify: true});
850
+ };
851
+
852
+ /**
853
+ * @ngdoc function
854
+ * @name ui.router.state.$state#go
855
+ * @methodOf ui.router.state.$state
856
+ *
857
+ * @description
858
+ * Convenience method for transitioning to a new state. `$state.go` calls
859
+ * `$state.transitionTo` internally but automatically sets options to
860
+ * `{ location: true, inherit: true, relative: $state.$current, notify: true }`.
861
+ * This allows you to easily use an absolute or relative to path and specify
862
+ * only the parameters you'd like to update (while letting unspecified parameters
863
+ * inherit from the currently active ancestor states).
864
+ *
865
+ * @example
866
+ * <pre>
867
+ * var app = angular.module('app', ['ui.router']);
868
+ *
869
+ * app.controller('ctrl', function ($scope, $state) {
870
+ * $scope.changeState = function () {
871
+ * $state.go('contact.detail');
872
+ * };
873
+ * });
874
+ * </pre>
875
+ * <img src='../ngdoc_assets/StateGoExamples.png'/>
876
+ *
877
+ * @param {string} to Absolute state name or relative state path. Some examples:
878
+ *
879
+ * - `$state.go('contact.detail')` - will go to the `contact.detail` state
880
+ * - `$state.go('^')` - will go to a parent state
881
+ * - `$state.go('^.sibling')` - will go to a sibling state
882
+ * - `$state.go('.child.grandchild')` - will go to grandchild state
883
+ *
884
+ * @param {object=} params A map of the parameters that will be sent to the state,
885
+ * will populate $stateParams. Any parameters that are not specified will be inherited from currently
886
+ * defined parameters. This allows, for example, going to a sibling state that shares parameters
887
+ * specified in a parent state. Parameter inheritance only works between common ancestor states, I.e.
888
+ * transitioning to a sibling will get you the parameters for all parents, transitioning to a child
889
+ * will get you all current parameters, etc.
890
+ * @param {object=} options Options object. The options are:
891
+ *
892
+ * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`
893
+ * will not. If string, must be `"replace"`, which will update url and also replace last history record.
894
+ * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.
895
+ * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'),
896
+ * defines which state to be relative from.
897
+ * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.
898
+ * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params
899
+ * have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd
900
+ * use this when you want to force a reload when *everything* is the same, including search params.
901
+ *
902
+ * @returns {promise} A promise representing the state of the new transition.
903
+ *
904
+ * Possible success values:
905
+ *
906
+ * - $state.current
907
+ *
908
+ * <br/>Possible rejection values:
909
+ *
910
+ * - 'transition superseded' - when a newer transition has been started after this one
911
+ * - 'transition prevented' - when `event.preventDefault()` has been called in a `$stateChangeStart` listener
912
+ * - 'transition aborted' - when `event.preventDefault()` has been called in a `$stateNotFound` listener or
913
+ * when a `$stateNotFound` `event.retry` promise errors.
914
+ * - 'transition failed' - when a state has been unsuccessfully found after 2 tries.
915
+ * - *resolve error* - when an error has occurred with a `resolve`
916
+ *
917
+ */
918
+ $state.go = function go(to, params, options) {
919
+ return $state.transitionTo(to, params, extend({ inherit: true, relative: $state.$current }, options));
920
+ };
921
+
922
+ /**
923
+ * @ngdoc function
924
+ * @name ui.router.state.$state#transitionTo
925
+ * @methodOf ui.router.state.$state
926
+ *
927
+ * @description
928
+ * Low-level method for transitioning to a new state. {@link ui.router.state.$state#methods_go $state.go}
929
+ * uses `transitionTo` internally. `$state.go` is recommended in most situations.
930
+ *
931
+ * @example
932
+ * <pre>
933
+ * var app = angular.module('app', ['ui.router']);
934
+ *
935
+ * app.controller('ctrl', function ($scope, $state) {
936
+ * $scope.changeState = function () {
937
+ * $state.transitionTo('contact.detail');
938
+ * };
939
+ * });
940
+ * </pre>
941
+ *
942
+ * @param {string} to State name.
943
+ * @param {object=} toParams A map of the parameters that will be sent to the state,
944
+ * will populate $stateParams.
945
+ * @param {object=} options Options object. The options are:
946
+ *
947
+ * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`
948
+ * will not. If string, must be `"replace"`, which will update url and also replace last history record.
949
+ * - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.
950
+ * - **`relative`** - {object=}, When transitioning with relative path (e.g '^'),
951
+ * defines which state to be relative from.
952
+ * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.
953
+ * - **`reload`** (v0.2.5) - {boolean=false|string=|object=}, If `true` will force transition even if the state or params
954
+ * have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd
955
+ * use this when you want to force a reload when *everything* is the same, including search params.
956
+ * if String, then will reload the state with the name given in reload, and any children.
957
+ * if Object, then a stateObj is expected, will reload the state found in stateObj, and any children.
958
+ *
959
+ * @returns {promise} A promise representing the state of the new transition. See
960
+ * {@link ui.router.state.$state#methods_go $state.go}.
961
+ */
962
+ $state.transitionTo = function transitionTo(to, toParams, options) {
963
+ toParams = toParams || {};
964
+ options = extend({
965
+ location: true, inherit: false, relative: null, notify: true, reload: false, $retry: false
966
+ }, options || {});
967
+
968
+ var from = $state.$current, fromParams = $state.params, fromPath = from.path;
969
+ var evt, toState = findState(to, options.relative);
970
+
971
+ // Store the hash param for later (since it will be stripped out by various methods)
972
+ var hash = toParams['#'];
973
+
974
+ if (!isDefined(toState)) {
975
+ var redirect = { to: to, toParams: toParams, options: options };
976
+ var redirectResult = handleRedirect(redirect, from.self, fromParams, options);
977
+
978
+ if (redirectResult) {
979
+ return redirectResult;
980
+ }
981
+
982
+ // Always retry once if the $stateNotFound was not prevented
983
+ // (handles either redirect changed or state lazy-definition)
984
+ to = redirect.to;
985
+ toParams = redirect.toParams;
986
+ options = redirect.options;
987
+ toState = findState(to, options.relative);
988
+
989
+ if (!isDefined(toState)) {
990
+ if (!options.relative) throw new Error("No such state '" + to + "'");
991
+ throw new Error("Could not resolve '" + to + "' from state '" + options.relative + "'");
992
+ }
993
+ }
994
+ if (toState[abstractKey]) throw new Error("Cannot transition to abstract state '" + to + "'");
995
+ if (options.inherit) toParams = inheritParams($stateParams, toParams || {}, $state.$current, toState);
996
+ if (!toState.params.$$validates(toParams)) return TransitionFailed;
997
+
998
+ toParams = toState.params.$$values(toParams);
999
+ to = toState;
1000
+
1001
+ var toPath = to.path;
1002
+
1003
+ // Starting from the root of the path, keep all levels that haven't changed
1004
+ var keep = 0, state = toPath[keep], locals = root.locals, toLocals = [];
1005
+
1006
+ if (!options.reload) {
1007
+ while (state && state === fromPath[keep] && state.ownParams.$$equals(toParams, fromParams)) {
1008
+ locals = toLocals[keep] = state.locals;
1009
+ keep++;
1010
+ state = toPath[keep];
1011
+ }
1012
+ } else if (isString(options.reload) || isObject(options.reload)) {
1013
+ if (isObject(options.reload) && !options.reload.name) {
1014
+ throw new Error('Invalid reload state object');
1015
+ }
1016
+
1017
+ var reloadState = options.reload === true ? fromPath[0] : findState(options.reload);
1018
+ if (options.reload && !reloadState) {
1019
+ throw new Error("No such reload state '" + (isString(options.reload) ? options.reload : options.reload.name) + "'");
1020
+ }
1021
+
1022
+ while (state && state === fromPath[keep] && state !== reloadState) {
1023
+ locals = toLocals[keep] = state.locals;
1024
+ keep++;
1025
+ state = toPath[keep];
1026
+ }
1027
+ }
1028
+
1029
+ // If we're going to the same state and all locals are kept, we've got nothing to do.
1030
+ // But clear 'transition', as we still want to cancel any other pending transitions.
1031
+ // TODO: We may not want to bump 'transition' if we're called from a location change
1032
+ // that we've initiated ourselves, because we might accidentally abort a legitimate
1033
+ // transition initiated from code?
1034
+ if (shouldSkipReload(to, toParams, from, fromParams, locals, options)) {
1035
+ if (hash) toParams['#'] = hash;
1036
+ $state.params = toParams;
1037
+ copy($state.params, $stateParams);
1038
+ if (options.location && to.navigable && to.navigable.url) {
1039
+ $urlRouter.push(to.navigable.url, toParams, {
1040
+ $$avoidResync: true, replace: options.location === 'replace'
1041
+ });
1042
+ $urlRouter.update(true);
1043
+ }
1044
+ $state.transition = null;
1045
+ return $q.when($state.current);
1046
+ }
1047
+
1048
+ // Filter parameters before we pass them to event handlers etc.
1049
+ toParams = filterByKeys(to.params.$$keys(), toParams || {});
1050
+
1051
+ // Broadcast start event and cancel the transition if requested
1052
+ if (options.notify) {
1053
+ /**
1054
+ * @ngdoc event
1055
+ * @name ui.router.state.$state#$stateChangeStart
1056
+ * @eventOf ui.router.state.$state
1057
+ * @eventType broadcast on root scope
1058
+ * @description
1059
+ * Fired when the state transition **begins**. You can use `event.preventDefault()`
1060
+ * to prevent the transition from happening and then the transition promise will be
1061
+ * rejected with a `'transition prevented'` value.
1062
+ *
1063
+ * @param {Object} event Event object.
1064
+ * @param {State} toState The state being transitioned to.
1065
+ * @param {Object} toParams The params supplied to the `toState`.
1066
+ * @param {State} fromState The current state, pre-transition.
1067
+ * @param {Object} fromParams The params supplied to the `fromState`.
1068
+ *
1069
+ * @example
1070
+ *
1071
+ * <pre>
1072
+ * $rootScope.$on('$stateChangeStart',
1073
+ * function(event, toState, toParams, fromState, fromParams){
1074
+ * event.preventDefault();
1075
+ * // transitionTo() promise will be rejected with
1076
+ * // a 'transition prevented' error
1077
+ * })
1078
+ * </pre>
1079
+ */
1080
+ if ($rootScope.$broadcast('$stateChangeStart', to.self, toParams, from.self, fromParams).defaultPrevented) {
1081
+ $rootScope.$broadcast('$stateChangeCancel', to.self, toParams, from.self, fromParams);
1082
+ $urlRouter.update();
1083
+ return TransitionPrevented;
1084
+ }
1085
+ }
1086
+
1087
+ // Resolve locals for the remaining states, but don't update any global state just
1088
+ // yet -- if anything fails to resolve the current state needs to remain untouched.
1089
+ // We also set up an inheritance chain for the locals here. This allows the view directive
1090
+ // to quickly look up the correct definition for each view in the current state. Even
1091
+ // though we create the locals object itself outside resolveState(), it is initially
1092
+ // empty and gets filled asynchronously. We need to keep track of the promise for the
1093
+ // (fully resolved) current locals, and pass this down the chain.
1094
+ var resolved = $q.when(locals);
1095
+
1096
+ for (var l = keep; l < toPath.length; l++, state = toPath[l]) {
1097
+ locals = toLocals[l] = inherit(locals);
1098
+ resolved = resolveState(state, toParams, state === to, resolved, locals, options);
1099
+ }
1100
+
1101
+ // Once everything is resolved, we are ready to perform the actual transition
1102
+ // and return a promise for the new state. We also keep track of what the
1103
+ // current promise is, so that we can detect overlapping transitions and
1104
+ // keep only the outcome of the last transition.
1105
+ var transition = $state.transition = resolved.then(function () {
1106
+ var l, entering, exiting;
1107
+
1108
+ if ($state.transition !== transition) return TransitionSuperseded;
1109
+
1110
+ // Exit 'from' states not kept
1111
+ for (l = fromPath.length - 1; l >= keep; l--) {
1112
+ exiting = fromPath[l];
1113
+ if (exiting.self.onExit) {
1114
+ $injector.invoke(exiting.self.onExit, exiting.self, exiting.locals.globals);
1115
+ }
1116
+ exiting.locals = null;
1117
+ }
1118
+
1119
+ // Enter 'to' states not kept
1120
+ for (l = keep; l < toPath.length; l++) {
1121
+ entering = toPath[l];
1122
+ entering.locals = toLocals[l];
1123
+ if (entering.self.onEnter) {
1124
+ $injector.invoke(entering.self.onEnter, entering.self, entering.locals.globals);
1125
+ }
1126
+ }
1127
+
1128
+ // Re-add the saved hash before we start returning things
1129
+ if (hash) toParams['#'] = hash;
1130
+
1131
+ // Run it again, to catch any transitions in callbacks
1132
+ if ($state.transition !== transition) return TransitionSuperseded;
1133
+
1134
+ // Update globals in $state
1135
+ $state.$current = to;
1136
+ $state.current = to.self;
1137
+ $state.params = toParams;
1138
+ copy($state.params, $stateParams);
1139
+ $state.transition = null;
1140
+
1141
+ if (options.location && to.navigable) {
1142
+ $urlRouter.push(to.navigable.url, to.navigable.locals.globals.$stateParams, {
1143
+ $$avoidResync: true, replace: options.location === 'replace'
1144
+ });
1145
+ }
1146
+
1147
+ if (options.notify) {
1148
+ /**
1149
+ * @ngdoc event
1150
+ * @name ui.router.state.$state#$stateChangeSuccess
1151
+ * @eventOf ui.router.state.$state
1152
+ * @eventType broadcast on root scope
1153
+ * @description
1154
+ * Fired once the state transition is **complete**.
1155
+ *
1156
+ * @param {Object} event Event object.
1157
+ * @param {State} toState The state being transitioned to.
1158
+ * @param {Object} toParams The params supplied to the `toState`.
1159
+ * @param {State} fromState The current state, pre-transition.
1160
+ * @param {Object} fromParams The params supplied to the `fromState`.
1161
+ */
1162
+ $rootScope.$broadcast('$stateChangeSuccess', to.self, toParams, from.self, fromParams);
1163
+ }
1164
+ $urlRouter.update(true);
1165
+
1166
+ return $state.current;
1167
+ }, function (error) {
1168
+ if ($state.transition !== transition) return TransitionSuperseded;
1169
+
1170
+ $state.transition = null;
1171
+ /**
1172
+ * @ngdoc event
1173
+ * @name ui.router.state.$state#$stateChangeError
1174
+ * @eventOf ui.router.state.$state
1175
+ * @eventType broadcast on root scope
1176
+ * @description
1177
+ * Fired when an **error occurs** during transition. It's important to note that if you
1178
+ * have any errors in your resolve functions (javascript errors, non-existent services, etc)
1179
+ * they will not throw traditionally. You must listen for this $stateChangeError event to
1180
+ * catch **ALL** errors.
1181
+ *
1182
+ * @param {Object} event Event object.
1183
+ * @param {State} toState The state being transitioned to.
1184
+ * @param {Object} toParams The params supplied to the `toState`.
1185
+ * @param {State} fromState The current state, pre-transition.
1186
+ * @param {Object} fromParams The params supplied to the `fromState`.
1187
+ * @param {Error} error The resolve error object.
1188
+ */
1189
+ evt = $rootScope.$broadcast('$stateChangeError', to.self, toParams, from.self, fromParams, error);
1190
+
1191
+ if (!evt.defaultPrevented) {
1192
+ $urlRouter.update();
1193
+ }
1194
+
1195
+ return $q.reject(error);
1196
+ });
1197
+
1198
+ return transition;
1199
+ };
1200
+
1201
+ /**
1202
+ * @ngdoc function
1203
+ * @name ui.router.state.$state#is
1204
+ * @methodOf ui.router.state.$state
1205
+ *
1206
+ * @description
1207
+ * Similar to {@link ui.router.state.$state#methods_includes $state.includes},
1208
+ * but only checks for the full state name. If params is supplied then it will be
1209
+ * tested for strict equality against the current active params object, so all params
1210
+ * must match with none missing and no extras.
1211
+ *
1212
+ * @example
1213
+ * <pre>
1214
+ * $state.$current.name = 'contacts.details.item';
1215
+ *
1216
+ * // absolute name
1217
+ * $state.is('contact.details.item'); // returns true
1218
+ * $state.is(contactDetailItemStateObject); // returns true
1219
+ *
1220
+ * // relative name (. and ^), typically from a template
1221
+ * // E.g. from the 'contacts.details' template
1222
+ * <div ng-class="{highlighted: $state.is('.item')}">Item</div>
1223
+ * </pre>
1224
+ *
1225
+ * @param {string|object} stateOrName The state name (absolute or relative) or state object you'd like to check.
1226
+ * @param {object=} params A param object, e.g. `{sectionId: section.id}`, that you'd like
1227
+ * to test against the current active state.
1228
+ * @param {object=} options An options object. The options are:
1229
+ *
1230
+ * - **`relative`** - {string|object} - If `stateOrName` is a relative state name and `options.relative` is set, .is will
1231
+ * test relative to `options.relative` state (or name).
1232
+ *
1233
+ * @returns {boolean} Returns true if it is the state.
1234
+ */
1235
+ $state.is = function is(stateOrName, params, options) {
1236
+ options = extend({ relative: $state.$current }, options || {});
1237
+ var state = findState(stateOrName, options.relative);
1238
+
1239
+ if (!isDefined(state)) { return undefined; }
1240
+ if ($state.$current !== state) { return false; }
1241
+ return params ? equalForKeys(state.params.$$values(params), $stateParams) : true;
1242
+ };
1243
+
1244
+ /**
1245
+ * @ngdoc function
1246
+ * @name ui.router.state.$state#includes
1247
+ * @methodOf ui.router.state.$state
1248
+ *
1249
+ * @description
1250
+ * A method to determine if the current active state is equal to or is the child of the
1251
+ * state stateName. If any params are passed then they will be tested for a match as well.
1252
+ * Not all the parameters need to be passed, just the ones you'd like to test for equality.
1253
+ *
1254
+ * @example
1255
+ * Partial and relative names
1256
+ * <pre>
1257
+ * $state.$current.name = 'contacts.details.item';
1258
+ *
1259
+ * // Using partial names
1260
+ * $state.includes("contacts"); // returns true
1261
+ * $state.includes("contacts.details"); // returns true
1262
+ * $state.includes("contacts.details.item"); // returns true
1263
+ * $state.includes("contacts.list"); // returns false
1264
+ * $state.includes("about"); // returns false
1265
+ *
1266
+ * // Using relative names (. and ^), typically from a template
1267
+ * // E.g. from the 'contacts.details' template
1268
+ * <div ng-class="{highlighted: $state.includes('.item')}">Item</div>
1269
+ * </pre>
1270
+ *
1271
+ * Basic globbing patterns
1272
+ * <pre>
1273
+ * $state.$current.name = 'contacts.details.item.url';
1274
+ *
1275
+ * $state.includes("*.details.*.*"); // returns true
1276
+ * $state.includes("*.details.**"); // returns true
1277
+ * $state.includes("**.item.**"); // returns true
1278
+ * $state.includes("*.details.item.url"); // returns true
1279
+ * $state.includes("*.details.*.url"); // returns true
1280
+ * $state.includes("*.details.*"); // returns false
1281
+ * $state.includes("item.**"); // returns false
1282
+ * </pre>
1283
+ *
1284
+ * @param {string} stateOrName A partial name, relative name, or glob pattern
1285
+ * to be searched for within the current state name.
1286
+ * @param {object=} params A param object, e.g. `{sectionId: section.id}`,
1287
+ * that you'd like to test against the current active state.
1288
+ * @param {object=} options An options object. The options are:
1289
+ *
1290
+ * - **`relative`** - {string|object=} - If `stateOrName` is a relative state reference and `options.relative` is set,
1291
+ * .includes will test relative to `options.relative` state (or name).
1292
+ *
1293
+ * @returns {boolean} Returns true if it does include the state
1294
+ */
1295
+ $state.includes = function includes(stateOrName, params, options) {
1296
+ options = extend({ relative: $state.$current }, options || {});
1297
+ if (isString(stateOrName) && isGlob(stateOrName)) {
1298
+ if (!doesStateMatchGlob(stateOrName)) {
1299
+ return false;
1300
+ }
1301
+ stateOrName = $state.$current.name;
1302
+ }
1303
+
1304
+ var state = findState(stateOrName, options.relative);
1305
+ if (!isDefined(state)) { return undefined; }
1306
+ if (!isDefined($state.$current.includes[state.name])) { return false; }
1307
+ return params ? equalForKeys(state.params.$$values(params), $stateParams, objectKeys(params)) : true;
1308
+ };
1309
+
1310
+
1311
+ /**
1312
+ * @ngdoc function
1313
+ * @name ui.router.state.$state#href
1314
+ * @methodOf ui.router.state.$state
1315
+ *
1316
+ * @description
1317
+ * A url generation method that returns the compiled url for the given state populated with the given params.
1318
+ *
1319
+ * @example
1320
+ * <pre>
1321
+ * expect($state.href("about.person", { person: "bob" })).toEqual("/about/bob");
1322
+ * </pre>
1323
+ *
1324
+ * @param {string|object} stateOrName The state name or state object you'd like to generate a url from.
1325
+ * @param {object=} params An object of parameter values to fill the state's required parameters.
1326
+ * @param {object=} options Options object. The options are:
1327
+ *
1328
+ * - **`lossy`** - {boolean=true} - If true, and if there is no url associated with the state provided in the
1329
+ * first parameter, then the constructed href url will be built from the first navigable ancestor (aka
1330
+ * ancestor with a valid url).
1331
+ * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.
1332
+ * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'),
1333
+ * defines which state to be relative from.
1334
+ * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl".
1335
+ *
1336
+ * @returns {string} compiled state url
1337
+ */
1338
+ $state.href = function href(stateOrName, params, options) {
1339
+ options = extend({
1340
+ lossy: true,
1341
+ inherit: true,
1342
+ absolute: false,
1343
+ relative: $state.$current
1344
+ }, options || {});
1345
+
1346
+ var state = findState(stateOrName, options.relative);
1347
+
1348
+ if (!isDefined(state)) return null;
1349
+ if (options.inherit) params = inheritParams($stateParams, params || {}, $state.$current, state);
1350
+
1351
+ var nav = (state && options.lossy) ? state.navigable : state;
1352
+
1353
+ if (!nav || nav.url === undefined || nav.url === null) {
1354
+ return null;
1355
+ }
1356
+ return $urlRouter.href(nav.url, filterByKeys(state.params.$$keys().concat('#'), params || {}), {
1357
+ absolute: options.absolute
1358
+ });
1359
+ };
1360
+
1361
+ /**
1362
+ * @ngdoc function
1363
+ * @name ui.router.state.$state#get
1364
+ * @methodOf ui.router.state.$state
1365
+ *
1366
+ * @description
1367
+ * Returns the state configuration object for any specific state or all states.
1368
+ *
1369
+ * @param {string|object=} stateOrName (absolute or relative) If provided, will only get the config for
1370
+ * the requested state. If not provided, returns an array of ALL state configs.
1371
+ * @param {string|object=} context When stateOrName is a relative state reference, the state will be retrieved relative to context.
1372
+ * @returns {Object|Array} State configuration object or array of all objects.
1373
+ */
1374
+ $state.get = function (stateOrName, context) {
1375
+ if (arguments.length === 0) return map(objectKeys(states), function(name) { return states[name].self; });
1376
+ var state = findState(stateOrName, context || $state.$current);
1377
+ return (state && state.self) ? state.self : null;
1378
+ };
1379
+
1380
+ function resolveState(state, params, paramsAreFiltered, inherited, dst, options) {
1381
+ // Make a restricted $stateParams with only the parameters that apply to this state if
1382
+ // necessary. In addition to being available to the controller and onEnter/onExit callbacks,
1383
+ // we also need $stateParams to be available for any $injector calls we make during the
1384
+ // dependency resolution process.
1385
+ var $stateParams = (paramsAreFiltered) ? params : filterByKeys(state.params.$$keys(), params);
1386
+ var locals = { $stateParams: $stateParams };
1387
+
1388
+ // Resolve 'global' dependencies for the state, i.e. those not specific to a view.
1389
+ // We're also including $stateParams in this; that way the parameters are restricted
1390
+ // to the set that should be visible to the state, and are independent of when we update
1391
+ // the global $state and $stateParams values.
1392
+ dst.resolve = $resolve.resolve(state.resolve, locals, dst.resolve, state);
1393
+ var promises = [dst.resolve.then(function (globals) {
1394
+ dst.globals = globals;
1395
+ })];
1396
+ if (inherited) promises.push(inherited);
1397
+
1398
+ function resolveViews() {
1399
+ var viewsPromises = [];
1400
+
1401
+ // Resolve template and dependencies for all views.
1402
+ forEach(state.views, function (view, name) {
1403
+ var injectables = (view.resolve && view.resolve !== state.resolve ? view.resolve : {});
1404
+ injectables.$template = [ function () {
1405
+ return $view.load(name, { view: view, locals: dst.globals, params: $stateParams, notify: options.notify }) || '';
1406
+ }];
1407
+
1408
+ viewsPromises.push($resolve.resolve(injectables, dst.globals, dst.resolve, state).then(function (result) {
1409
+ // References to the controller (only instantiated at link time)
1410
+ if (isFunction(view.controllerProvider) || isArray(view.controllerProvider)) {
1411
+ var injectLocals = angular.extend({}, injectables, dst.globals);
1412
+ result.$$controller = $injector.invoke(view.controllerProvider, null, injectLocals);
1413
+ } else {
1414
+ result.$$controller = view.controller;
1415
+ }
1416
+ // Provide access to the state itself for internal use
1417
+ result.$$state = state;
1418
+ result.$$controllerAs = view.controllerAs;
1419
+ dst[name] = result;
1420
+ }));
1421
+ });
1422
+
1423
+ return $q.all(viewsPromises).then(function(){
1424
+ return dst.globals;
1425
+ });
1426
+ }
1427
+
1428
+ // Wait for all the promises and then return the activation object
1429
+ return $q.all(promises).then(resolveViews).then(function (values) {
1430
+ return dst;
1431
+ });
1432
+ }
1433
+
1434
+ return $state;
1435
+ }
1436
+
1437
+ function shouldSkipReload(to, toParams, from, fromParams, locals, options) {
1438
+ // Return true if there are no differences in non-search (path/object) params, false if there are differences
1439
+ function nonSearchParamsEqual(fromAndToState, fromParams, toParams) {
1440
+ // Identify whether all the parameters that differ between `fromParams` and `toParams` were search params.
1441
+ function notSearchParam(key) {
1442
+ return fromAndToState.params[key].location != "search";
1443
+ }
1444
+ var nonQueryParamKeys = fromAndToState.params.$$keys().filter(notSearchParam);
1445
+ var nonQueryParams = pick.apply({}, [fromAndToState.params].concat(nonQueryParamKeys));
1446
+ var nonQueryParamSet = new $$UMFP.ParamSet(nonQueryParams);
1447
+ return nonQueryParamSet.$$equals(fromParams, toParams);
1448
+ }
1449
+
1450
+ // If reload was not explicitly requested
1451
+ // and we're transitioning to the same state we're already in
1452
+ // and the locals didn't change
1453
+ // or they changed in a way that doesn't merit reloading
1454
+ // (reloadOnParams:false, or reloadOnSearch.false and only search params changed)
1455
+ // Then return true.
1456
+ if (!options.reload && to === from &&
1457
+ (locals === from.locals || (to.self.reloadOnSearch === false && nonSearchParamsEqual(from, fromParams, toParams)))) {
1458
+ return true;
1459
+ }
1460
+ }
1461
+ }
1462
+
1463
+ angular.module('ui.router.state')
1464
+ .value('$stateParams', {})
1465
+ .provider('$state', $StateProvider);